Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
16
Frontend-Learner/node_modules/tailwindcss/node_modules/.bin/jiti
generated
vendored
Normal file
16
Frontend-Learner/node_modules/tailwindcss/node_modules/.bin/jiti
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../jiti/bin/jiti.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../jiti/bin/jiti.js" "$@"
|
||||
fi
|
||||
17
Frontend-Learner/node_modules/tailwindcss/node_modules/.bin/jiti.cmd
generated
vendored
Normal file
17
Frontend-Learner/node_modules/tailwindcss/node_modules/.bin/jiti.cmd
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\jiti\bin\jiti.js" %*
|
||||
28
Frontend-Learner/node_modules/tailwindcss/node_modules/.bin/jiti.ps1
generated
vendored
Normal file
28
Frontend-Learner/node_modules/tailwindcss/node_modules/.bin/jiti.ps1
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../jiti/bin/jiti.js" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../jiti/bin/jiti.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../jiti/bin/jiti.js" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../jiti/bin/jiti.js" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/LICENSE
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the “Software”), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
308
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/README.md
generated
vendored
Normal file
308
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
# Chokidar [](https://github.com/paulmillr/chokidar) [](https://github.com/paulmillr/chokidar)
|
||||
|
||||
> Minimal and efficient cross-platform file watching library
|
||||
|
||||
[](https://www.npmjs.com/package/chokidar)
|
||||
|
||||
## Why?
|
||||
|
||||
Node.js `fs.watch`:
|
||||
|
||||
* Doesn't report filenames on MacOS.
|
||||
* Doesn't report events at all when using editors like Sublime on MacOS.
|
||||
* Often reports events twice.
|
||||
* Emits most changes as `rename`.
|
||||
* Does not provide an easy way to recursively watch file trees.
|
||||
* Does not support recursive watching on Linux.
|
||||
|
||||
Node.js `fs.watchFile`:
|
||||
|
||||
* Almost as bad at event handling.
|
||||
* Also does not provide any recursive watching.
|
||||
* Results in high CPU utilization.
|
||||
|
||||
Chokidar resolves these problems.
|
||||
|
||||
Initially made for **[Brunch](https://brunch.io/)** (an ultra-swift web app build tool), it is now used in
|
||||
[Microsoft's Visual Studio Code](https://github.com/microsoft/vscode),
|
||||
[gulp](https://github.com/gulpjs/gulp/),
|
||||
[karma](https://karma-runner.github.io/),
|
||||
[PM2](https://github.com/Unitech/PM2),
|
||||
[browserify](http://browserify.org/),
|
||||
[webpack](https://webpack.github.io/),
|
||||
[BrowserSync](https://www.browsersync.io/),
|
||||
and [many others](https://www.npmjs.com/browse/depended/chokidar).
|
||||
It has proven itself in production environments.
|
||||
|
||||
Version 3 is out! Check out our blog post about it: [Chokidar 3: How to save 32TB of traffic every week](https://paulmillr.com/posts/chokidar-3-save-32tb-of-traffic/)
|
||||
|
||||
## How?
|
||||
|
||||
Chokidar does still rely on the Node.js core `fs` module, but when using
|
||||
`fs.watch` and `fs.watchFile` for watching, it normalizes the events it
|
||||
receives, often checking for truth by getting file stats and/or dir contents.
|
||||
|
||||
On MacOS, chokidar by default uses a native extension exposing the Darwin
|
||||
`FSEvents` API. This provides very efficient recursive watching compared with
|
||||
implementations like `kqueue` available on most \*nix platforms. Chokidar still
|
||||
does have to do some work to normalize the events received that way as well.
|
||||
|
||||
On most other platforms, the `fs.watch`-based implementation is the default, which
|
||||
avoids polling and keeps CPU usage down. Be advised that chokidar will initiate
|
||||
watchers recursively for everything within scope of the paths that have been
|
||||
specified, so be judicious about not wasting system resources by watching much
|
||||
more than needed.
|
||||
|
||||
## Getting started
|
||||
|
||||
Install with npm:
|
||||
|
||||
```sh
|
||||
npm install chokidar
|
||||
```
|
||||
|
||||
Then `require` and use it in your code:
|
||||
|
||||
```javascript
|
||||
const chokidar = require('chokidar');
|
||||
|
||||
// One-liner for current directory
|
||||
chokidar.watch('.').on('all', (event, path) => {
|
||||
console.log(event, path);
|
||||
});
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```javascript
|
||||
// Example of a more typical implementation structure
|
||||
|
||||
// Initialize watcher.
|
||||
const watcher = chokidar.watch('file, dir, glob, or array', {
|
||||
ignored: /(^|[\/\\])\../, // ignore dotfiles
|
||||
persistent: true
|
||||
});
|
||||
|
||||
// Something to use when events are received.
|
||||
const log = console.log.bind(console);
|
||||
// Add event listeners.
|
||||
watcher
|
||||
.on('add', path => log(`File ${path} has been added`))
|
||||
.on('change', path => log(`File ${path} has been changed`))
|
||||
.on('unlink', path => log(`File ${path} has been removed`));
|
||||
|
||||
// More possible events.
|
||||
watcher
|
||||
.on('addDir', path => log(`Directory ${path} has been added`))
|
||||
.on('unlinkDir', path => log(`Directory ${path} has been removed`))
|
||||
.on('error', error => log(`Watcher error: ${error}`))
|
||||
.on('ready', () => log('Initial scan complete. Ready for changes'))
|
||||
.on('raw', (event, path, details) => { // internal
|
||||
log('Raw event info:', event, path, details);
|
||||
});
|
||||
|
||||
// 'add', 'addDir' and 'change' events also receive stat() results as second
|
||||
// argument when available: https://nodejs.org/api/fs.html#fs_class_fs_stats
|
||||
watcher.on('change', (path, stats) => {
|
||||
if (stats) console.log(`File ${path} changed size to ${stats.size}`);
|
||||
});
|
||||
|
||||
// Watch new files.
|
||||
watcher.add('new-file');
|
||||
watcher.add(['new-file-2', 'new-file-3', '**/other-file*']);
|
||||
|
||||
// Get list of actual paths being watched on the filesystem
|
||||
var watchedPaths = watcher.getWatched();
|
||||
|
||||
// Un-watch some files.
|
||||
await watcher.unwatch('new-file*');
|
||||
|
||||
// Stop watching.
|
||||
// The method is async!
|
||||
watcher.close().then(() => console.log('closed'));
|
||||
|
||||
// Full list of options. See below for descriptions.
|
||||
// Do not use this example!
|
||||
chokidar.watch('file', {
|
||||
persistent: true,
|
||||
|
||||
ignored: '*.txt',
|
||||
ignoreInitial: false,
|
||||
followSymlinks: true,
|
||||
cwd: '.',
|
||||
disableGlobbing: false,
|
||||
|
||||
usePolling: false,
|
||||
interval: 100,
|
||||
binaryInterval: 300,
|
||||
alwaysStat: false,
|
||||
depth: 99,
|
||||
awaitWriteFinish: {
|
||||
stabilityThreshold: 2000,
|
||||
pollInterval: 100
|
||||
},
|
||||
|
||||
ignorePermissionErrors: false,
|
||||
atomic: true // or a custom 'atomicity delay', in milliseconds (default 100)
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
`chokidar.watch(paths, [options])`
|
||||
|
||||
* `paths` (string or array of strings). Paths to files, dirs to be watched
|
||||
recursively, or glob patterns.
|
||||
- Note: globs must not contain windows separators (`\`),
|
||||
because that's how they work by the standard —
|
||||
you'll need to replace them with forward slashes (`/`).
|
||||
- Note 2: for additional glob documentation, check out low-level
|
||||
library: [picomatch](https://github.com/micromatch/picomatch).
|
||||
* `options` (object) Options object as defined below:
|
||||
|
||||
#### Persistence
|
||||
|
||||
* `persistent` (default: `true`). Indicates whether the process
|
||||
should continue to run as long as files are being watched. If set to
|
||||
`false` when using `fsevents` to watch, no more events will be emitted
|
||||
after `ready`, even if the process continues to run.
|
||||
|
||||
#### Path filtering
|
||||
|
||||
* `ignored` ([anymatch](https://github.com/es128/anymatch)-compatible definition)
|
||||
Defines files/paths to be ignored. The whole relative or absolute path is
|
||||
tested, not just filename. If a function with two arguments is provided, it
|
||||
gets called twice per path - once with a single argument (the path), second
|
||||
time with two arguments (the path and the
|
||||
[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
|
||||
object of that path).
|
||||
* `ignoreInitial` (default: `false`). If set to `false` then `add`/`addDir` events are also emitted for matching paths while
|
||||
instantiating the watching as chokidar discovers these file paths (before the `ready` event).
|
||||
* `followSymlinks` (default: `true`). When `false`, only the
|
||||
symlinks themselves will be watched for changes instead of following
|
||||
the link references and bubbling events through the link's path.
|
||||
* `cwd` (no default). The base directory from which watch `paths` are to be
|
||||
derived. Paths emitted with events will be relative to this.
|
||||
* `disableGlobbing` (default: `false`). If set to `true` then the strings passed to `.watch()` and `.add()` are treated as
|
||||
literal path names, even if they look like globs.
|
||||
|
||||
#### Performance
|
||||
|
||||
* `usePolling` (default: `false`).
|
||||
Whether to use fs.watchFile (backed by polling), or fs.watch. If polling
|
||||
leads to high CPU utilization, consider setting this to `false`. It is
|
||||
typically necessary to **set this to `true` to successfully watch files over
|
||||
a network**, and it may be necessary to successfully watch files in other
|
||||
non-standard situations. Setting to `true` explicitly on MacOS overrides the
|
||||
`useFsEvents` default. You may also set the CHOKIDAR_USEPOLLING env variable
|
||||
to true (1) or false (0) in order to override this option.
|
||||
* _Polling-specific settings_ (effective when `usePolling: true`)
|
||||
* `interval` (default: `100`). Interval of file system polling, in milliseconds. You may also
|
||||
set the CHOKIDAR_INTERVAL env variable to override this option.
|
||||
* `binaryInterval` (default: `300`). Interval of file system
|
||||
polling for binary files.
|
||||
([see list of binary extensions](https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
|
||||
* `useFsEvents` (default: `true` on MacOS). Whether to use the
|
||||
`fsevents` watching interface if available. When set to `true` explicitly
|
||||
and `fsevents` is available this supercedes the `usePolling` setting. When
|
||||
set to `false` on MacOS, `usePolling: true` becomes the default.
|
||||
* `alwaysStat` (default: `false`). If relying upon the
|
||||
[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
|
||||
object that may get passed with `add`, `addDir`, and `change` events, set
|
||||
this to `true` to ensure it is provided even in cases where it wasn't
|
||||
already available from the underlying watch events.
|
||||
* `depth` (default: `undefined`). If set, limits how many levels of
|
||||
subdirectories will be traversed.
|
||||
* `awaitWriteFinish` (default: `false`).
|
||||
By default, the `add` event will fire when a file first appears on disk, before
|
||||
the entire file has been written. Furthermore, in some cases some `change`
|
||||
events will be emitted while the file is being written. In some cases,
|
||||
especially when watching for large files there will be a need to wait for the
|
||||
write operation to finish before responding to a file creation or modification.
|
||||
Setting `awaitWriteFinish` to `true` (or a truthy value) will poll file size,
|
||||
holding its `add` and `change` events until the size does not change for a
|
||||
configurable amount of time. The appropriate duration setting is heavily
|
||||
dependent on the OS and hardware. For accurate detection this parameter should
|
||||
be relatively high, making file watching much less responsive.
|
||||
Use with caution.
|
||||
* *`options.awaitWriteFinish` can be set to an object in order to adjust
|
||||
timing params:*
|
||||
* `awaitWriteFinish.stabilityThreshold` (default: 2000). Amount of time in
|
||||
milliseconds for a file size to remain constant before emitting its event.
|
||||
* `awaitWriteFinish.pollInterval` (default: 100). File size polling interval, in milliseconds.
|
||||
|
||||
#### Errors
|
||||
|
||||
* `ignorePermissionErrors` (default: `false`). Indicates whether to watch files
|
||||
that don't have read permissions if possible. If watching fails due to `EPERM`
|
||||
or `EACCES` with this set to `true`, the errors will be suppressed silently.
|
||||
* `atomic` (default: `true` if `useFsEvents` and `usePolling` are `false`).
|
||||
Automatically filters out artifacts that occur when using editors that use
|
||||
"atomic writes" instead of writing directly to the source file. If a file is
|
||||
re-added within 100 ms of being deleted, Chokidar emits a `change` event
|
||||
rather than `unlink` then `add`. If the default of 100 ms does not work well
|
||||
for you, you can override it by setting `atomic` to a custom value, in
|
||||
milliseconds.
|
||||
|
||||
### Methods & Events
|
||||
|
||||
`chokidar.watch()` produces an instance of `FSWatcher`. Methods of `FSWatcher`:
|
||||
|
||||
* `.add(path / paths)`: Add files, directories, or glob patterns for tracking.
|
||||
Takes an array of strings or just one string.
|
||||
* `.on(event, callback)`: Listen for an FS event.
|
||||
Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`,
|
||||
`raw`, `error`.
|
||||
Additionally `all` is available which gets emitted with the underlying event
|
||||
name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully.
|
||||
* `.unwatch(path / paths)`: Stop watching files, directories, or glob patterns.
|
||||
Takes an array of strings or just one string.
|
||||
* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. Use with `await` to ensure bugs don't happen.
|
||||
* `.getWatched()`: Returns an object representing all the paths on the file
|
||||
system being watched by this `FSWatcher` instance. The object's keys are all the
|
||||
directories (using absolute paths unless the `cwd` option was used), and the
|
||||
values are arrays of the names of the items contained in each directory.
|
||||
|
||||
## CLI
|
||||
|
||||
If you need a CLI interface for your file watching, check out
|
||||
[chokidar-cli](https://github.com/open-cli-tools/chokidar-cli), allowing you to
|
||||
execute a command on each change, or get a stdio stream of change events.
|
||||
|
||||
## Install Troubleshooting
|
||||
|
||||
* `npm WARN optional dep failed, continuing fsevents@n.n.n`
|
||||
* This message is normal part of how `npm` handles optional dependencies and is
|
||||
not indicative of a problem. Even if accompanied by other related error messages,
|
||||
Chokidar should function properly.
|
||||
|
||||
* `TypeError: fsevents is not a constructor`
|
||||
* Update chokidar by doing `rm -rf node_modules package-lock.json yarn.lock && npm install`, or update your dependency that uses chokidar.
|
||||
|
||||
* Chokidar is producing `ENOSP` error on Linux, like this:
|
||||
* `bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell`
|
||||
`Error: watch /home/ ENOSPC`
|
||||
* This means Chokidar ran out of file handles and you'll need to increase their count by executing the following command in Terminal:
|
||||
`echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p`
|
||||
|
||||
## Changelog
|
||||
|
||||
For more detailed changelog, see [`full_changelog.md`](.github/full_changelog.md).
|
||||
- **v3.5 (Jan 6, 2021):** Support for ARM Macs with Apple Silicon. Fixes for deleted symlinks.
|
||||
- **v3.4 (Apr 26, 2020):** Support for directory-based symlinks. Fixes for macos file replacement.
|
||||
- **v3.3 (Nov 2, 2019):** `FSWatcher#close()` method became async. That fixes IO race conditions related to close method.
|
||||
- **v3.2 (Oct 1, 2019):** Improve Linux RAM usage by 50%. Race condition fixes. Windows glob fixes. Improve stability by using tight range of dependency versions.
|
||||
- **v3.1 (Sep 16, 2019):** dotfiles are no longer filtered out by default. Use `ignored` option if needed. Improve initial Linux scan time by 50%.
|
||||
- **v3 (Apr 30, 2019):** massive CPU & RAM consumption improvements; reduces deps / package size by a factor of 17x and bumps Node.js requirement to v8.16 and higher.
|
||||
- **v2 (Dec 29, 2017):** Globs are now posix-style-only; without windows support. Tons of bugfixes.
|
||||
- **v1 (Apr 7, 2015):** Glob support, symlink support, tons of bugfixes. Node 0.8+ is supported
|
||||
- **v0.1 (Apr 20, 2012):** Initial release, extracted from [Brunch](https://github.com/brunch/brunch/blob/9847a065aea300da99bd0753f90354cde9de1261/src/helpers.coffee#L66)
|
||||
|
||||
## Also
|
||||
|
||||
Why was chokidar named this way? What's the meaning behind it?
|
||||
|
||||
>Chowkidar is a transliteration of a Hindi word meaning 'watchman, gatekeeper', चौकीदार. This ultimately comes from Sanskrit _ चतुष्क_ (crossway, quadrangle, consisting-of-four). This word is also used in other languages like Urdu as (چوکیدار) which is widely used in Pakistan and India.
|
||||
|
||||
## License
|
||||
|
||||
MIT (c) Paul Miller (<https://paulmillr.com>), see [LICENSE](LICENSE) file.
|
||||
973
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/index.js
generated
vendored
Normal file
973
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,973 @@
|
|||
'use strict';
|
||||
|
||||
const { EventEmitter } = require('events');
|
||||
const fs = require('fs');
|
||||
const sysPath = require('path');
|
||||
const { promisify } = require('util');
|
||||
const readdirp = require('readdirp');
|
||||
const anymatch = require('anymatch').default;
|
||||
const globParent = require('glob-parent');
|
||||
const isGlob = require('is-glob');
|
||||
const braces = require('braces');
|
||||
const normalizePath = require('normalize-path');
|
||||
|
||||
const NodeFsHandler = require('./lib/nodefs-handler');
|
||||
const FsEventsHandler = require('./lib/fsevents-handler');
|
||||
const {
|
||||
EV_ALL,
|
||||
EV_READY,
|
||||
EV_ADD,
|
||||
EV_CHANGE,
|
||||
EV_UNLINK,
|
||||
EV_ADD_DIR,
|
||||
EV_UNLINK_DIR,
|
||||
EV_RAW,
|
||||
EV_ERROR,
|
||||
|
||||
STR_CLOSE,
|
||||
STR_END,
|
||||
|
||||
BACK_SLASH_RE,
|
||||
DOUBLE_SLASH_RE,
|
||||
SLASH_OR_BACK_SLASH_RE,
|
||||
DOT_RE,
|
||||
REPLACER_RE,
|
||||
|
||||
SLASH,
|
||||
SLASH_SLASH,
|
||||
BRACE_START,
|
||||
BANG,
|
||||
ONE_DOT,
|
||||
TWO_DOTS,
|
||||
GLOBSTAR,
|
||||
SLASH_GLOBSTAR,
|
||||
ANYMATCH_OPTS,
|
||||
STRING_TYPE,
|
||||
FUNCTION_TYPE,
|
||||
EMPTY_STR,
|
||||
EMPTY_FN,
|
||||
|
||||
isWindows,
|
||||
isMacos,
|
||||
isIBMi
|
||||
} = require('./lib/constants');
|
||||
|
||||
const stat = promisify(fs.stat);
|
||||
const readdir = promisify(fs.readdir);
|
||||
|
||||
/**
|
||||
* @typedef {String} Path
|
||||
* @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName
|
||||
* @typedef {'readdir'|'watch'|'add'|'remove'|'change'} ThrottleType
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @typedef {Object} WatchHelpers
|
||||
* @property {Boolean} followSymlinks
|
||||
* @property {'stat'|'lstat'} statMethod
|
||||
* @property {Path} path
|
||||
* @property {Path} watchPath
|
||||
* @property {Function} entryPath
|
||||
* @property {Boolean} hasGlob
|
||||
* @property {Object} globFilter
|
||||
* @property {Function} filterPath
|
||||
* @property {Function} filterDir
|
||||
*/
|
||||
|
||||
const arrify = (value = []) => Array.isArray(value) ? value : [value];
|
||||
const flatten = (list, result = []) => {
|
||||
list.forEach(item => {
|
||||
if (Array.isArray(item)) {
|
||||
flatten(item, result);
|
||||
} else {
|
||||
result.push(item);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
const unifyPaths = (paths_) => {
|
||||
/**
|
||||
* @type {Array<String>}
|
||||
*/
|
||||
const paths = flatten(arrify(paths_));
|
||||
if (!paths.every(p => typeof p === STRING_TYPE)) {
|
||||
throw new TypeError(`Non-string provided as watch path: ${paths}`);
|
||||
}
|
||||
return paths.map(normalizePathToUnix);
|
||||
};
|
||||
|
||||
// If SLASH_SLASH occurs at the beginning of path, it is not replaced
|
||||
// because "//StoragePC/DrivePool/Movies" is a valid network path
|
||||
const toUnix = (string) => {
|
||||
let str = string.replace(BACK_SLASH_RE, SLASH);
|
||||
let prepend = false;
|
||||
if (str.startsWith(SLASH_SLASH)) {
|
||||
prepend = true;
|
||||
}
|
||||
while (str.match(DOUBLE_SLASH_RE)) {
|
||||
str = str.replace(DOUBLE_SLASH_RE, SLASH);
|
||||
}
|
||||
if (prepend) {
|
||||
str = SLASH + str;
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
// Our version of upath.normalize
|
||||
// TODO: this is not equal to path-normalize module - investigate why
|
||||
const normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path)));
|
||||
|
||||
const normalizeIgnored = (cwd = EMPTY_STR) => (path) => {
|
||||
if (typeof path !== STRING_TYPE) return path;
|
||||
return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path));
|
||||
};
|
||||
|
||||
const getAbsolutePath = (path, cwd) => {
|
||||
if (sysPath.isAbsolute(path)) {
|
||||
return path;
|
||||
}
|
||||
if (path.startsWith(BANG)) {
|
||||
return BANG + sysPath.join(cwd, path.slice(1));
|
||||
}
|
||||
return sysPath.join(cwd, path);
|
||||
};
|
||||
|
||||
const undef = (opts, key) => opts[key] === undefined;
|
||||
|
||||
/**
|
||||
* Directory entry.
|
||||
* @property {Path} path
|
||||
* @property {Set<Path>} items
|
||||
*/
|
||||
class DirEntry {
|
||||
/**
|
||||
* @param {Path} dir
|
||||
* @param {Function} removeWatcher
|
||||
*/
|
||||
constructor(dir, removeWatcher) {
|
||||
this.path = dir;
|
||||
this._removeWatcher = removeWatcher;
|
||||
/** @type {Set<Path>} */
|
||||
this.items = new Set();
|
||||
}
|
||||
|
||||
add(item) {
|
||||
const {items} = this;
|
||||
if (!items) return;
|
||||
if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item);
|
||||
}
|
||||
|
||||
async remove(item) {
|
||||
const {items} = this;
|
||||
if (!items) return;
|
||||
items.delete(item);
|
||||
if (items.size > 0) return;
|
||||
|
||||
const dir = this.path;
|
||||
try {
|
||||
await readdir(dir);
|
||||
} catch (err) {
|
||||
if (this._removeWatcher) {
|
||||
this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
has(item) {
|
||||
const {items} = this;
|
||||
if (!items) return;
|
||||
return items.has(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Array<String>}
|
||||
*/
|
||||
getChildren() {
|
||||
const {items} = this;
|
||||
if (!items) return;
|
||||
return [...items.values()];
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.items.clear();
|
||||
delete this.path;
|
||||
delete this._removeWatcher;
|
||||
delete this.items;
|
||||
Object.freeze(this);
|
||||
}
|
||||
}
|
||||
|
||||
const STAT_METHOD_F = 'stat';
|
||||
const STAT_METHOD_L = 'lstat';
|
||||
class WatchHelper {
|
||||
constructor(path, watchPath, follow, fsw) {
|
||||
this.fsw = fsw;
|
||||
this.path = path = path.replace(REPLACER_RE, EMPTY_STR);
|
||||
this.watchPath = watchPath;
|
||||
this.fullWatchPath = sysPath.resolve(watchPath);
|
||||
this.hasGlob = watchPath !== path;
|
||||
/** @type {object|boolean} */
|
||||
if (path === EMPTY_STR) this.hasGlob = false;
|
||||
this.globSymlink = this.hasGlob && follow ? undefined : false;
|
||||
this.globFilter = this.hasGlob ? anymatch(path, undefined, ANYMATCH_OPTS) : false;
|
||||
this.dirParts = this.getDirParts(path);
|
||||
this.dirParts.forEach((parts) => {
|
||||
if (parts.length > 1) parts.pop();
|
||||
});
|
||||
this.followSymlinks = follow;
|
||||
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
||||
}
|
||||
|
||||
checkGlobSymlink(entry) {
|
||||
// only need to resolve once
|
||||
// first entry should always have entry.parentDir === EMPTY_STR
|
||||
if (this.globSymlink === undefined) {
|
||||
this.globSymlink = entry.fullParentDir === this.fullWatchPath ?
|
||||
false : {realPath: entry.fullParentDir, linkPath: this.fullWatchPath};
|
||||
}
|
||||
|
||||
if (this.globSymlink) {
|
||||
return entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath);
|
||||
}
|
||||
|
||||
return entry.fullPath;
|
||||
}
|
||||
|
||||
entryPath(entry) {
|
||||
return sysPath.join(this.watchPath,
|
||||
sysPath.relative(this.watchPath, this.checkGlobSymlink(entry))
|
||||
);
|
||||
}
|
||||
|
||||
filterPath(entry) {
|
||||
const {stats} = entry;
|
||||
if (stats && stats.isSymbolicLink()) return this.filterDir(entry);
|
||||
const resolvedPath = this.entryPath(entry);
|
||||
const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ?
|
||||
this.globFilter(resolvedPath) : true;
|
||||
return matchesGlob &&
|
||||
this.fsw._isntIgnored(resolvedPath, stats) &&
|
||||
this.fsw._hasReadPermissions(stats);
|
||||
}
|
||||
|
||||
getDirParts(path) {
|
||||
if (!this.hasGlob) return [];
|
||||
const parts = [];
|
||||
const expandedPath = path.includes(BRACE_START) ? braces.expand(path) : [path];
|
||||
expandedPath.forEach((path) => {
|
||||
parts.push(sysPath.relative(this.watchPath, path).split(SLASH_OR_BACK_SLASH_RE));
|
||||
});
|
||||
return parts;
|
||||
}
|
||||
|
||||
filterDir(entry) {
|
||||
if (this.hasGlob) {
|
||||
const entryParts = this.getDirParts(this.checkGlobSymlink(entry));
|
||||
let globstar = false;
|
||||
this.unmatchedGlob = !this.dirParts.some((parts) => {
|
||||
return parts.every((part, i) => {
|
||||
if (part === GLOBSTAR) globstar = true;
|
||||
return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS);
|
||||
});
|
||||
});
|
||||
}
|
||||
return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Watches files & directories for changes. Emitted events:
|
||||
* `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
|
||||
*
|
||||
* new FSWatcher()
|
||||
* .add(directories)
|
||||
* .on('add', path => log('File', path, 'was added'))
|
||||
*/
|
||||
class FSWatcher extends EventEmitter {
|
||||
// Not indenting methods for history sake; for now.
|
||||
constructor(_opts) {
|
||||
super();
|
||||
|
||||
const opts = {};
|
||||
if (_opts) Object.assign(opts, _opts); // for frozen objects
|
||||
|
||||
/** @type {Map<String, DirEntry>} */
|
||||
this._watched = new Map();
|
||||
/** @type {Map<String, Array>} */
|
||||
this._closers = new Map();
|
||||
/** @type {Set<String>} */
|
||||
this._ignoredPaths = new Set();
|
||||
|
||||
/** @type {Map<ThrottleType, Map>} */
|
||||
this._throttled = new Map();
|
||||
|
||||
/** @type {Map<Path, String|Boolean>} */
|
||||
this._symlinkPaths = new Map();
|
||||
|
||||
this._streams = new Set();
|
||||
this.closed = false;
|
||||
|
||||
// Set up default options.
|
||||
if (undef(opts, 'persistent')) opts.persistent = true;
|
||||
if (undef(opts, 'ignoreInitial')) opts.ignoreInitial = false;
|
||||
if (undef(opts, 'ignorePermissionErrors')) opts.ignorePermissionErrors = false;
|
||||
if (undef(opts, 'interval')) opts.interval = 100;
|
||||
if (undef(opts, 'binaryInterval')) opts.binaryInterval = 300;
|
||||
if (undef(opts, 'disableGlobbing')) opts.disableGlobbing = false;
|
||||
opts.enableBinaryInterval = opts.binaryInterval !== opts.interval;
|
||||
|
||||
// Enable fsevents on OS X when polling isn't explicitly enabled.
|
||||
if (undef(opts, 'useFsEvents')) opts.useFsEvents = !opts.usePolling;
|
||||
|
||||
// If we can't use fsevents, ensure the options reflect it's disabled.
|
||||
const canUseFsEvents = FsEventsHandler.canUse();
|
||||
if (!canUseFsEvents) opts.useFsEvents = false;
|
||||
|
||||
// Use polling on Mac if not using fsevents.
|
||||
// Other platforms use non-polling fs_watch.
|
||||
if (undef(opts, 'usePolling') && !opts.useFsEvents) {
|
||||
opts.usePolling = isMacos;
|
||||
}
|
||||
|
||||
// Always default to polling on IBM i because fs.watch() is not available on IBM i.
|
||||
if(isIBMi) {
|
||||
opts.usePolling = true;
|
||||
}
|
||||
|
||||
// Global override (useful for end-developers that need to force polling for all
|
||||
// instances of chokidar, regardless of usage/dependency depth)
|
||||
const envPoll = process.env.CHOKIDAR_USEPOLLING;
|
||||
if (envPoll !== undefined) {
|
||||
const envLower = envPoll.toLowerCase();
|
||||
|
||||
if (envLower === 'false' || envLower === '0') {
|
||||
opts.usePolling = false;
|
||||
} else if (envLower === 'true' || envLower === '1') {
|
||||
opts.usePolling = true;
|
||||
} else {
|
||||
opts.usePolling = !!envLower;
|
||||
}
|
||||
}
|
||||
const envInterval = process.env.CHOKIDAR_INTERVAL;
|
||||
if (envInterval) {
|
||||
opts.interval = Number.parseInt(envInterval, 10);
|
||||
}
|
||||
|
||||
// Editor atomic write normalization enabled by default with fs.watch
|
||||
if (undef(opts, 'atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents;
|
||||
if (opts.atomic) this._pendingUnlinks = new Map();
|
||||
|
||||
if (undef(opts, 'followSymlinks')) opts.followSymlinks = true;
|
||||
|
||||
if (undef(opts, 'awaitWriteFinish')) opts.awaitWriteFinish = false;
|
||||
if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {};
|
||||
const awf = opts.awaitWriteFinish;
|
||||
if (awf) {
|
||||
if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000;
|
||||
if (!awf.pollInterval) awf.pollInterval = 100;
|
||||
this._pendingWrites = new Map();
|
||||
}
|
||||
if (opts.ignored) opts.ignored = arrify(opts.ignored);
|
||||
|
||||
let readyCalls = 0;
|
||||
this._emitReady = () => {
|
||||
readyCalls++;
|
||||
if (readyCalls >= this._readyCount) {
|
||||
this._emitReady = EMPTY_FN;
|
||||
this._readyEmitted = true;
|
||||
// use process.nextTick to allow time for listener to be bound
|
||||
process.nextTick(() => this.emit(EV_READY));
|
||||
}
|
||||
};
|
||||
this._emitRaw = (...args) => this.emit(EV_RAW, ...args);
|
||||
this._readyEmitted = false;
|
||||
this.options = opts;
|
||||
|
||||
// Initialize with proper watcher.
|
||||
if (opts.useFsEvents) {
|
||||
this._fsEventsHandler = new FsEventsHandler(this);
|
||||
} else {
|
||||
this._nodeFsHandler = new NodeFsHandler(this);
|
||||
}
|
||||
|
||||
// You’re frozen when your heart’s not open.
|
||||
Object.freeze(opts);
|
||||
}
|
||||
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Adds paths to be watched on an existing FSWatcher instance
|
||||
* @param {Path|Array<Path>} paths_
|
||||
* @param {String=} _origAdd private; for handling non-existent paths to be watched
|
||||
* @param {Boolean=} _internal private; indicates a non-user add
|
||||
* @returns {FSWatcher} for chaining
|
||||
*/
|
||||
add(paths_, _origAdd, _internal) {
|
||||
const {cwd, disableGlobbing} = this.options;
|
||||
this.closed = false;
|
||||
let paths = unifyPaths(paths_);
|
||||
if (cwd) {
|
||||
paths = paths.map((path) => {
|
||||
const absPath = getAbsolutePath(path, cwd);
|
||||
|
||||
// Check `path` instead of `absPath` because the cwd portion can't be a glob
|
||||
if (disableGlobbing || !isGlob(path)) {
|
||||
return absPath;
|
||||
}
|
||||
return normalizePath(absPath);
|
||||
});
|
||||
}
|
||||
|
||||
// set aside negated glob strings
|
||||
paths = paths.filter((path) => {
|
||||
if (path.startsWith(BANG)) {
|
||||
this._ignoredPaths.add(path.slice(1));
|
||||
return false;
|
||||
}
|
||||
|
||||
// if a path is being added that was previously ignored, stop ignoring it
|
||||
this._ignoredPaths.delete(path);
|
||||
this._ignoredPaths.delete(path + SLASH_GLOBSTAR);
|
||||
|
||||
// reset the cached userIgnored anymatch fn
|
||||
// to make ignoredPaths changes effective
|
||||
this._userIgnored = undefined;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (this.options.useFsEvents && this._fsEventsHandler) {
|
||||
if (!this._readyCount) this._readyCount = paths.length;
|
||||
if (this.options.persistent) this._readyCount += paths.length;
|
||||
paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path));
|
||||
} else {
|
||||
if (!this._readyCount) this._readyCount = 0;
|
||||
this._readyCount += paths.length;
|
||||
Promise.all(
|
||||
paths.map(async path => {
|
||||
const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd);
|
||||
if (res) this._emitReady();
|
||||
return res;
|
||||
})
|
||||
).then(results => {
|
||||
if (this.closed) return;
|
||||
results.filter(item => item).forEach(item => {
|
||||
this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close watchers or start ignoring events from specified paths.
|
||||
* @param {Path|Array<Path>} paths_ - string or array of strings, file/directory paths and/or globs
|
||||
* @returns {FSWatcher} for chaining
|
||||
*/
|
||||
unwatch(paths_) {
|
||||
if (this.closed) return this;
|
||||
const paths = unifyPaths(paths_);
|
||||
const {cwd} = this.options;
|
||||
|
||||
paths.forEach((path) => {
|
||||
// convert to absolute path unless relative path already matches
|
||||
if (!sysPath.isAbsolute(path) && !this._closers.has(path)) {
|
||||
if (cwd) path = sysPath.join(cwd, path);
|
||||
path = sysPath.resolve(path);
|
||||
}
|
||||
|
||||
this._closePath(path);
|
||||
|
||||
this._ignoredPaths.add(path);
|
||||
if (this._watched.has(path)) {
|
||||
this._ignoredPaths.add(path + SLASH_GLOBSTAR);
|
||||
}
|
||||
|
||||
// reset the cached userIgnored anymatch fn
|
||||
// to make ignoredPaths changes effective
|
||||
this._userIgnored = undefined;
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close watchers and remove all listeners from watched paths.
|
||||
* @returns {Promise<void>}.
|
||||
*/
|
||||
close() {
|
||||
if (this.closed) return this._closePromise;
|
||||
this.closed = true;
|
||||
|
||||
// Memory management.
|
||||
this.removeAllListeners();
|
||||
const closers = [];
|
||||
this._closers.forEach(closerList => closerList.forEach(closer => {
|
||||
const promise = closer();
|
||||
if (promise instanceof Promise) closers.push(promise);
|
||||
}));
|
||||
this._streams.forEach(stream => stream.destroy());
|
||||
this._userIgnored = undefined;
|
||||
this._readyCount = 0;
|
||||
this._readyEmitted = false;
|
||||
this._watched.forEach(dirent => dirent.dispose());
|
||||
['closers', 'watched', 'streams', 'symlinkPaths', 'throttled'].forEach(key => {
|
||||
this[`_${key}`].clear();
|
||||
});
|
||||
|
||||
this._closePromise = closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve();
|
||||
return this._closePromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose list of watched paths
|
||||
* @returns {Object} for chaining
|
||||
*/
|
||||
getWatched() {
|
||||
const watchList = {};
|
||||
this._watched.forEach((entry, dir) => {
|
||||
const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir;
|
||||
watchList[key || ONE_DOT] = entry.getChildren().sort();
|
||||
});
|
||||
return watchList;
|
||||
}
|
||||
|
||||
emitWithAll(event, args) {
|
||||
this.emit(...args);
|
||||
if (event !== EV_ERROR) this.emit(EV_ALL, ...args);
|
||||
}
|
||||
|
||||
// Common helpers
|
||||
// --------------
|
||||
|
||||
/**
|
||||
* Normalize and emit events.
|
||||
* Calling _emit DOES NOT MEAN emit() would be called!
|
||||
* @param {EventName} event Type of event
|
||||
* @param {Path} path File or directory path
|
||||
* @param {*=} val1 arguments to be passed with event
|
||||
* @param {*=} val2
|
||||
* @param {*=} val3
|
||||
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
||||
*/
|
||||
async _emit(event, path, val1, val2, val3) {
|
||||
if (this.closed) return;
|
||||
|
||||
const opts = this.options;
|
||||
if (isWindows) path = sysPath.normalize(path);
|
||||
if (opts.cwd) path = sysPath.relative(opts.cwd, path);
|
||||
/** @type Array<any> */
|
||||
const args = [event, path];
|
||||
if (val3 !== undefined) args.push(val1, val2, val3);
|
||||
else if (val2 !== undefined) args.push(val1, val2);
|
||||
else if (val1 !== undefined) args.push(val1);
|
||||
|
||||
const awf = opts.awaitWriteFinish;
|
||||
let pw;
|
||||
if (awf && (pw = this._pendingWrites.get(path))) {
|
||||
pw.lastChange = new Date();
|
||||
return this;
|
||||
}
|
||||
|
||||
if (opts.atomic) {
|
||||
if (event === EV_UNLINK) {
|
||||
this._pendingUnlinks.set(path, args);
|
||||
setTimeout(() => {
|
||||
this._pendingUnlinks.forEach((entry, path) => {
|
||||
this.emit(...entry);
|
||||
this.emit(EV_ALL, ...entry);
|
||||
this._pendingUnlinks.delete(path);
|
||||
});
|
||||
}, typeof opts.atomic === 'number' ? opts.atomic : 100);
|
||||
return this;
|
||||
}
|
||||
if (event === EV_ADD && this._pendingUnlinks.has(path)) {
|
||||
event = args[0] = EV_CHANGE;
|
||||
this._pendingUnlinks.delete(path);
|
||||
}
|
||||
}
|
||||
|
||||
if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) {
|
||||
const awfEmit = (err, stats) => {
|
||||
if (err) {
|
||||
event = args[0] = EV_ERROR;
|
||||
args[1] = err;
|
||||
this.emitWithAll(event, args);
|
||||
} else if (stats) {
|
||||
// if stats doesn't exist the file must have been deleted
|
||||
if (args.length > 2) {
|
||||
args[2] = stats;
|
||||
} else {
|
||||
args.push(stats);
|
||||
}
|
||||
this.emitWithAll(event, args);
|
||||
}
|
||||
};
|
||||
|
||||
this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit);
|
||||
return this;
|
||||
}
|
||||
|
||||
if (event === EV_CHANGE) {
|
||||
const isThrottled = !this._throttle(EV_CHANGE, path, 50);
|
||||
if (isThrottled) return this;
|
||||
}
|
||||
|
||||
if (opts.alwaysStat && val1 === undefined &&
|
||||
(event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE)
|
||||
) {
|
||||
const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path;
|
||||
let stats;
|
||||
try {
|
||||
stats = await stat(fullPath);
|
||||
} catch (err) {}
|
||||
// Suppress event when fs_stat fails, to avoid sending undefined 'stat'
|
||||
if (!stats || this.closed) return;
|
||||
args.push(stats);
|
||||
}
|
||||
this.emitWithAll(event, args);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Common handler for errors
|
||||
* @param {Error} error
|
||||
* @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
||||
*/
|
||||
_handleError(error) {
|
||||
const code = error && error.code;
|
||||
if (error && code !== 'ENOENT' && code !== 'ENOTDIR' &&
|
||||
(!this.options.ignorePermissionErrors || (code !== 'EPERM' && code !== 'EACCES'))
|
||||
) {
|
||||
this.emit(EV_ERROR, error);
|
||||
}
|
||||
return error || this.closed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper utility for throttling
|
||||
* @param {ThrottleType} actionType type being throttled
|
||||
* @param {Path} path being acted upon
|
||||
* @param {Number} timeout duration of time to suppress duplicate actions
|
||||
* @returns {Object|false} tracking object or false if action should be suppressed
|
||||
*/
|
||||
_throttle(actionType, path, timeout) {
|
||||
if (!this._throttled.has(actionType)) {
|
||||
this._throttled.set(actionType, new Map());
|
||||
}
|
||||
|
||||
/** @type {Map<Path, Object>} */
|
||||
const action = this._throttled.get(actionType);
|
||||
/** @type {Object} */
|
||||
const actionPath = action.get(path);
|
||||
|
||||
if (actionPath) {
|
||||
actionPath.count++;
|
||||
return false;
|
||||
}
|
||||
|
||||
let timeoutObject;
|
||||
const clear = () => {
|
||||
const item = action.get(path);
|
||||
const count = item ? item.count : 0;
|
||||
action.delete(path);
|
||||
clearTimeout(timeoutObject);
|
||||
if (item) clearTimeout(item.timeoutObject);
|
||||
return count;
|
||||
};
|
||||
timeoutObject = setTimeout(clear, timeout);
|
||||
const thr = {timeoutObject, clear, count: 0};
|
||||
action.set(path, thr);
|
||||
return thr;
|
||||
}
|
||||
|
||||
_incrReadyCount() {
|
||||
return this._readyCount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Awaits write operation to finish.
|
||||
* Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
|
||||
* @param {Path} path being acted upon
|
||||
* @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
|
||||
* @param {EventName} event
|
||||
* @param {Function} awfEmit Callback to be called when ready for event to be emitted.
|
||||
*/
|
||||
_awaitWriteFinish(path, threshold, event, awfEmit) {
|
||||
let timeoutHandler;
|
||||
|
||||
let fullPath = path;
|
||||
if (this.options.cwd && !sysPath.isAbsolute(path)) {
|
||||
fullPath = sysPath.join(this.options.cwd, path);
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
|
||||
const awaitWriteFinish = (prevStat) => {
|
||||
fs.stat(fullPath, (err, curStat) => {
|
||||
if (err || !this._pendingWrites.has(path)) {
|
||||
if (err && err.code !== 'ENOENT') awfEmit(err);
|
||||
return;
|
||||
}
|
||||
|
||||
const now = Number(new Date());
|
||||
|
||||
if (prevStat && curStat.size !== prevStat.size) {
|
||||
this._pendingWrites.get(path).lastChange = now;
|
||||
}
|
||||
const pw = this._pendingWrites.get(path);
|
||||
const df = now - pw.lastChange;
|
||||
|
||||
if (df >= threshold) {
|
||||
this._pendingWrites.delete(path);
|
||||
awfEmit(undefined, curStat);
|
||||
} else {
|
||||
timeoutHandler = setTimeout(
|
||||
awaitWriteFinish,
|
||||
this.options.awaitWriteFinish.pollInterval,
|
||||
curStat
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (!this._pendingWrites.has(path)) {
|
||||
this._pendingWrites.set(path, {
|
||||
lastChange: now,
|
||||
cancelWait: () => {
|
||||
this._pendingWrites.delete(path);
|
||||
clearTimeout(timeoutHandler);
|
||||
return event;
|
||||
}
|
||||
});
|
||||
timeoutHandler = setTimeout(
|
||||
awaitWriteFinish,
|
||||
this.options.awaitWriteFinish.pollInterval
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
_getGlobIgnored() {
|
||||
return [...this._ignoredPaths.values()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether user has asked to ignore this path.
|
||||
* @param {Path} path filepath or dir
|
||||
* @param {fs.Stats=} stats result of fs.stat
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
_isIgnored(path, stats) {
|
||||
if (this.options.atomic && DOT_RE.test(path)) return true;
|
||||
if (!this._userIgnored) {
|
||||
const {cwd} = this.options;
|
||||
const ign = this.options.ignored;
|
||||
|
||||
const ignored = ign && ign.map(normalizeIgnored(cwd));
|
||||
const paths = arrify(ignored)
|
||||
.filter((path) => typeof path === STRING_TYPE && !isGlob(path))
|
||||
.map((path) => path + SLASH_GLOBSTAR);
|
||||
const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths);
|
||||
this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS);
|
||||
}
|
||||
|
||||
return this._userIgnored([path, stats]);
|
||||
}
|
||||
|
||||
_isntIgnored(path, stat) {
|
||||
return !this._isIgnored(path, stat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a set of common helpers and properties relating to symlink and glob handling.
|
||||
* @param {Path} path file, directory, or glob pattern being watched
|
||||
* @param {Number=} depth at any depth > 0, this isn't a glob
|
||||
* @returns {WatchHelper} object containing helpers for this path
|
||||
*/
|
||||
_getWatchHelpers(path, depth) {
|
||||
const watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path);
|
||||
const follow = this.options.followSymlinks;
|
||||
|
||||
return new WatchHelper(path, watchPath, follow, this);
|
||||
}
|
||||
|
||||
// Directory helpers
|
||||
// -----------------
|
||||
|
||||
/**
|
||||
* Provides directory tracking objects
|
||||
* @param {String} directory path of the directory
|
||||
* @returns {DirEntry} the directory's tracking object
|
||||
*/
|
||||
_getWatchedDir(directory) {
|
||||
if (!this._boundRemove) this._boundRemove = this._remove.bind(this);
|
||||
const dir = sysPath.resolve(directory);
|
||||
if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
||||
return this._watched.get(dir);
|
||||
}
|
||||
|
||||
// File helpers
|
||||
// ------------
|
||||
|
||||
/**
|
||||
* Check for read permissions.
|
||||
* Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405
|
||||
* @param {fs.Stats} stats - object, result of fs_stat
|
||||
* @returns {Boolean} indicates whether the file can be read
|
||||
*/
|
||||
_hasReadPermissions(stats) {
|
||||
if (this.options.ignorePermissionErrors) return true;
|
||||
|
||||
// stats.mode may be bigint
|
||||
const md = stats && Number.parseInt(stats.mode, 10);
|
||||
const st = md & 0o777;
|
||||
const it = Number.parseInt(st.toString(8)[0], 10);
|
||||
return Boolean(4 & it);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles emitting unlink events for
|
||||
* files and directories, and via recursion, for
|
||||
* files and directories within directories that are unlinked
|
||||
* @param {String} directory within which the following item is located
|
||||
* @param {String} item base path of item/directory
|
||||
* @returns {void}
|
||||
*/
|
||||
_remove(directory, item, isDirectory) {
|
||||
// if what is being deleted is a directory, get that directory's paths
|
||||
// for recursive deleting and cleaning of watched object
|
||||
// if it is not a directory, nestedDirectoryChildren will be empty array
|
||||
const path = sysPath.join(directory, item);
|
||||
const fullPath = sysPath.resolve(path);
|
||||
isDirectory = isDirectory != null
|
||||
? isDirectory
|
||||
: this._watched.has(path) || this._watched.has(fullPath);
|
||||
|
||||
// prevent duplicate handling in case of arriving here nearly simultaneously
|
||||
// via multiple paths (such as _handleFile and _handleDir)
|
||||
if (!this._throttle('remove', path, 100)) return;
|
||||
|
||||
// if the only watched file is removed, watch for its return
|
||||
if (!isDirectory && !this.options.useFsEvents && this._watched.size === 1) {
|
||||
this.add(directory, item, true);
|
||||
}
|
||||
|
||||
// This will create a new entry in the watched object in either case
|
||||
// so we got to do the directory check beforehand
|
||||
const wp = this._getWatchedDir(path);
|
||||
const nestedDirectoryChildren = wp.getChildren();
|
||||
|
||||
// Recursively remove children directories / files.
|
||||
nestedDirectoryChildren.forEach(nested => this._remove(path, nested));
|
||||
|
||||
// Check if item was on the watched list and remove it
|
||||
const parent = this._getWatchedDir(directory);
|
||||
const wasTracked = parent.has(item);
|
||||
parent.remove(item);
|
||||
|
||||
// Fixes issue #1042 -> Relative paths were detected and added as symlinks
|
||||
// (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612),
|
||||
// but never removed from the map in case the path was deleted.
|
||||
// This leads to an incorrect state if the path was recreated:
|
||||
// https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553
|
||||
if (this._symlinkPaths.has(fullPath)) {
|
||||
this._symlinkPaths.delete(fullPath);
|
||||
}
|
||||
|
||||
// If we wait for this file to be fully written, cancel the wait.
|
||||
let relPath = path;
|
||||
if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path);
|
||||
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
||||
const event = this._pendingWrites.get(relPath).cancelWait();
|
||||
if (event === EV_ADD) return;
|
||||
}
|
||||
|
||||
// The Entry will either be a directory that just got removed
|
||||
// or a bogus entry to a file, in either case we have to remove it
|
||||
this._watched.delete(path);
|
||||
this._watched.delete(fullPath);
|
||||
const eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK;
|
||||
if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path);
|
||||
|
||||
// Avoid conflicts if we later create another file with the same name
|
||||
if (!this.options.useFsEvents) {
|
||||
this._closePath(path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all watchers for a path
|
||||
* @param {Path} path
|
||||
*/
|
||||
_closePath(path) {
|
||||
this._closeFile(path)
|
||||
const dir = sysPath.dirname(path);
|
||||
this._getWatchedDir(dir).remove(sysPath.basename(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes only file-specific watchers
|
||||
* @param {Path} path
|
||||
*/
|
||||
_closeFile(path) {
|
||||
const closers = this._closers.get(path);
|
||||
if (!closers) return;
|
||||
closers.forEach(closer => closer());
|
||||
this._closers.delete(path);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Path} path
|
||||
* @param {Function} closer
|
||||
*/
|
||||
_addPathCloser(path, closer) {
|
||||
if (!closer) return;
|
||||
let list = this._closers.get(path);
|
||||
if (!list) {
|
||||
list = [];
|
||||
this._closers.set(path, list);
|
||||
}
|
||||
list.push(closer);
|
||||
}
|
||||
|
||||
_readdirp(root, opts) {
|
||||
if (this.closed) return;
|
||||
const options = {type: EV_ALL, alwaysStat: true, lstat: true, ...opts};
|
||||
let stream = readdirp(root, options);
|
||||
this._streams.add(stream);
|
||||
stream.once(STR_CLOSE, () => {
|
||||
stream = undefined;
|
||||
});
|
||||
stream.once(STR_END, () => {
|
||||
if (stream) {
|
||||
this._streams.delete(stream);
|
||||
stream = undefined;
|
||||
}
|
||||
});
|
||||
return stream;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Export FSWatcher class
|
||||
exports.FSWatcher = FSWatcher;
|
||||
|
||||
/**
|
||||
* Instantiates watcher with paths to be tracked.
|
||||
* @param {String|Array<String>} paths file/directory paths and/or globs
|
||||
* @param {Object=} options chokidar opts
|
||||
* @returns an instance of FSWatcher for chaining.
|
||||
*/
|
||||
const watch = (paths, options) => {
|
||||
const watcher = new FSWatcher(options);
|
||||
watcher.add(paths);
|
||||
return watcher;
|
||||
};
|
||||
|
||||
exports.watch = watch;
|
||||
66
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/lib/constants.js
generated
vendored
Normal file
66
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/lib/constants.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
'use strict';
|
||||
|
||||
const {sep} = require('path');
|
||||
const {platform} = process;
|
||||
const os = require('os');
|
||||
|
||||
exports.EV_ALL = 'all';
|
||||
exports.EV_READY = 'ready';
|
||||
exports.EV_ADD = 'add';
|
||||
exports.EV_CHANGE = 'change';
|
||||
exports.EV_ADD_DIR = 'addDir';
|
||||
exports.EV_UNLINK = 'unlink';
|
||||
exports.EV_UNLINK_DIR = 'unlinkDir';
|
||||
exports.EV_RAW = 'raw';
|
||||
exports.EV_ERROR = 'error';
|
||||
|
||||
exports.STR_DATA = 'data';
|
||||
exports.STR_END = 'end';
|
||||
exports.STR_CLOSE = 'close';
|
||||
|
||||
exports.FSEVENT_CREATED = 'created';
|
||||
exports.FSEVENT_MODIFIED = 'modified';
|
||||
exports.FSEVENT_DELETED = 'deleted';
|
||||
exports.FSEVENT_MOVED = 'moved';
|
||||
exports.FSEVENT_CLONED = 'cloned';
|
||||
exports.FSEVENT_UNKNOWN = 'unknown';
|
||||
exports.FSEVENT_FLAG_MUST_SCAN_SUBDIRS = 1;
|
||||
exports.FSEVENT_TYPE_FILE = 'file';
|
||||
exports.FSEVENT_TYPE_DIRECTORY = 'directory';
|
||||
exports.FSEVENT_TYPE_SYMLINK = 'symlink';
|
||||
|
||||
exports.KEY_LISTENERS = 'listeners';
|
||||
exports.KEY_ERR = 'errHandlers';
|
||||
exports.KEY_RAW = 'rawEmitters';
|
||||
exports.HANDLER_KEYS = [exports.KEY_LISTENERS, exports.KEY_ERR, exports.KEY_RAW];
|
||||
|
||||
exports.DOT_SLASH = `.${sep}`;
|
||||
|
||||
exports.BACK_SLASH_RE = /\\/g;
|
||||
exports.DOUBLE_SLASH_RE = /\/\//;
|
||||
exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/;
|
||||
exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
|
||||
exports.REPLACER_RE = /^\.[/\\]/;
|
||||
|
||||
exports.SLASH = '/';
|
||||
exports.SLASH_SLASH = '//';
|
||||
exports.BRACE_START = '{';
|
||||
exports.BANG = '!';
|
||||
exports.ONE_DOT = '.';
|
||||
exports.TWO_DOTS = '..';
|
||||
exports.STAR = '*';
|
||||
exports.GLOBSTAR = '**';
|
||||
exports.ROOT_GLOBSTAR = '/**/*';
|
||||
exports.SLASH_GLOBSTAR = '/**';
|
||||
exports.DIR_SUFFIX = 'Dir';
|
||||
exports.ANYMATCH_OPTS = {dot: true};
|
||||
exports.STRING_TYPE = 'string';
|
||||
exports.FUNCTION_TYPE = 'function';
|
||||
exports.EMPTY_STR = '';
|
||||
exports.EMPTY_FN = () => {};
|
||||
exports.IDENTITY_FN = val => val;
|
||||
|
||||
exports.isWindows = platform === 'win32';
|
||||
exports.isMacos = platform === 'darwin';
|
||||
exports.isLinux = platform === 'linux';
|
||||
exports.isIBMi = os.type() === 'OS400';
|
||||
526
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/lib/fsevents-handler.js
generated
vendored
Normal file
526
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/lib/fsevents-handler.js
generated
vendored
Normal file
|
|
@ -0,0 +1,526 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const sysPath = require('path');
|
||||
const { promisify } = require('util');
|
||||
|
||||
let fsevents;
|
||||
try {
|
||||
fsevents = require('fsevents');
|
||||
} catch (error) {
|
||||
if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error);
|
||||
}
|
||||
|
||||
if (fsevents) {
|
||||
// TODO: real check
|
||||
const mtch = process.version.match(/v(\d+)\.(\d+)/);
|
||||
if (mtch && mtch[1] && mtch[2]) {
|
||||
const maj = Number.parseInt(mtch[1], 10);
|
||||
const min = Number.parseInt(mtch[2], 10);
|
||||
if (maj === 8 && min < 16) {
|
||||
fsevents = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
EV_ADD,
|
||||
EV_CHANGE,
|
||||
EV_ADD_DIR,
|
||||
EV_UNLINK,
|
||||
EV_ERROR,
|
||||
STR_DATA,
|
||||
STR_END,
|
||||
FSEVENT_CREATED,
|
||||
FSEVENT_MODIFIED,
|
||||
FSEVENT_DELETED,
|
||||
FSEVENT_MOVED,
|
||||
// FSEVENT_CLONED,
|
||||
FSEVENT_UNKNOWN,
|
||||
FSEVENT_FLAG_MUST_SCAN_SUBDIRS,
|
||||
FSEVENT_TYPE_FILE,
|
||||
FSEVENT_TYPE_DIRECTORY,
|
||||
FSEVENT_TYPE_SYMLINK,
|
||||
|
||||
ROOT_GLOBSTAR,
|
||||
DIR_SUFFIX,
|
||||
DOT_SLASH,
|
||||
FUNCTION_TYPE,
|
||||
EMPTY_FN,
|
||||
IDENTITY_FN
|
||||
} = require('./constants');
|
||||
|
||||
const Depth = (value) => isNaN(value) ? {} : {depth: value};
|
||||
|
||||
const stat = promisify(fs.stat);
|
||||
const lstat = promisify(fs.lstat);
|
||||
const realpath = promisify(fs.realpath);
|
||||
|
||||
const statMethods = { stat, lstat };
|
||||
|
||||
/**
|
||||
* @typedef {String} Path
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} FsEventsWatchContainer
|
||||
* @property {Set<Function>} listeners
|
||||
* @property {Function} rawEmitter
|
||||
* @property {{stop: Function}} watcher
|
||||
*/
|
||||
|
||||
// fsevents instance helper functions
|
||||
/**
|
||||
* Object to hold per-process fsevents instances (may be shared across chokidar FSWatcher instances)
|
||||
* @type {Map<Path,FsEventsWatchContainer>}
|
||||
*/
|
||||
const FSEventsWatchers = new Map();
|
||||
|
||||
// Threshold of duplicate path prefixes at which to start
|
||||
// consolidating going forward
|
||||
const consolidateThreshhold = 10;
|
||||
|
||||
const wrongEventFlags = new Set([
|
||||
69888, 70400, 71424, 72704, 73472, 131328, 131840, 262912
|
||||
]);
|
||||
|
||||
/**
|
||||
* Instantiates the fsevents interface
|
||||
* @param {Path} path path to be watched
|
||||
* @param {Function} callback called when fsevents is bound and ready
|
||||
* @returns {{stop: Function}} new fsevents instance
|
||||
*/
|
||||
const createFSEventsInstance = (path, callback) => {
|
||||
const stop = fsevents.watch(path, callback);
|
||||
return {stop};
|
||||
};
|
||||
|
||||
/**
|
||||
* Instantiates the fsevents interface or binds listeners to an existing one covering
|
||||
* the same file tree.
|
||||
* @param {Path} path - to be watched
|
||||
* @param {Path} realPath - real path for symlinks
|
||||
* @param {Function} listener - called when fsevents emits events
|
||||
* @param {Function} rawEmitter - passes data to listeners of the 'raw' event
|
||||
* @returns {Function} closer
|
||||
*/
|
||||
function setFSEventsListener(path, realPath, listener, rawEmitter) {
|
||||
let watchPath = sysPath.extname(realPath) ? sysPath.dirname(realPath) : realPath;
|
||||
|
||||
const parentPath = sysPath.dirname(watchPath);
|
||||
let cont = FSEventsWatchers.get(watchPath);
|
||||
|
||||
// If we've accumulated a substantial number of paths that
|
||||
// could have been consolidated by watching one directory
|
||||
// above the current one, create a watcher on the parent
|
||||
// path instead, so that we do consolidate going forward.
|
||||
if (couldConsolidate(parentPath)) {
|
||||
watchPath = parentPath;
|
||||
}
|
||||
|
||||
const resolvedPath = sysPath.resolve(path);
|
||||
const hasSymlink = resolvedPath !== realPath;
|
||||
|
||||
const filteredListener = (fullPath, flags, info) => {
|
||||
if (hasSymlink) fullPath = fullPath.replace(realPath, resolvedPath);
|
||||
if (
|
||||
fullPath === resolvedPath ||
|
||||
!fullPath.indexOf(resolvedPath + sysPath.sep)
|
||||
) listener(fullPath, flags, info);
|
||||
};
|
||||
|
||||
// check if there is already a watcher on a parent path
|
||||
// modifies `watchPath` to the parent path when it finds a match
|
||||
let watchedParent = false;
|
||||
for (const watchedPath of FSEventsWatchers.keys()) {
|
||||
if (realPath.indexOf(sysPath.resolve(watchedPath) + sysPath.sep) === 0) {
|
||||
watchPath = watchedPath;
|
||||
cont = FSEventsWatchers.get(watchPath);
|
||||
watchedParent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cont || watchedParent) {
|
||||
cont.listeners.add(filteredListener);
|
||||
} else {
|
||||
cont = {
|
||||
listeners: new Set([filteredListener]),
|
||||
rawEmitter,
|
||||
watcher: createFSEventsInstance(watchPath, (fullPath, flags) => {
|
||||
if (!cont.listeners.size) return;
|
||||
if (flags & FSEVENT_FLAG_MUST_SCAN_SUBDIRS) return;
|
||||
const info = fsevents.getInfo(fullPath, flags);
|
||||
cont.listeners.forEach(list => {
|
||||
list(fullPath, flags, info);
|
||||
});
|
||||
|
||||
cont.rawEmitter(info.event, fullPath, info);
|
||||
})
|
||||
};
|
||||
FSEventsWatchers.set(watchPath, cont);
|
||||
}
|
||||
|
||||
// removes this instance's listeners and closes the underlying fsevents
|
||||
// instance if there are no more listeners left
|
||||
return () => {
|
||||
const lst = cont.listeners;
|
||||
|
||||
lst.delete(filteredListener);
|
||||
if (!lst.size) {
|
||||
FSEventsWatchers.delete(watchPath);
|
||||
if (cont.watcher) return cont.watcher.stop().then(() => {
|
||||
cont.rawEmitter = cont.watcher = undefined;
|
||||
Object.freeze(cont);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Decide whether or not we should start a new higher-level
|
||||
// parent watcher
|
||||
const couldConsolidate = (path) => {
|
||||
let count = 0;
|
||||
for (const watchPath of FSEventsWatchers.keys()) {
|
||||
if (watchPath.indexOf(path) === 0) {
|
||||
count++;
|
||||
if (count >= consolidateThreshhold) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// returns boolean indicating whether fsevents can be used
|
||||
const canUse = () => fsevents && FSEventsWatchers.size < 128;
|
||||
|
||||
// determines subdirectory traversal levels from root to path
|
||||
const calcDepth = (path, root) => {
|
||||
let i = 0;
|
||||
while (!path.indexOf(root) && (path = sysPath.dirname(path)) !== root) i++;
|
||||
return i;
|
||||
};
|
||||
|
||||
// returns boolean indicating whether the fsevents' event info has the same type
|
||||
// as the one returned by fs.stat
|
||||
const sameTypes = (info, stats) => (
|
||||
info.type === FSEVENT_TYPE_DIRECTORY && stats.isDirectory() ||
|
||||
info.type === FSEVENT_TYPE_SYMLINK && stats.isSymbolicLink() ||
|
||||
info.type === FSEVENT_TYPE_FILE && stats.isFile()
|
||||
)
|
||||
|
||||
/**
|
||||
* @mixin
|
||||
*/
|
||||
class FsEventsHandler {
|
||||
|
||||
/**
|
||||
* @param {import('../index').FSWatcher} fsw
|
||||
*/
|
||||
constructor(fsw) {
|
||||
this.fsw = fsw;
|
||||
}
|
||||
checkIgnored(path, stats) {
|
||||
const ipaths = this.fsw._ignoredPaths;
|
||||
if (this.fsw._isIgnored(path, stats)) {
|
||||
ipaths.add(path);
|
||||
if (stats && stats.isDirectory()) {
|
||||
ipaths.add(path + ROOT_GLOBSTAR);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ipaths.delete(path);
|
||||
ipaths.delete(path + ROOT_GLOBSTAR);
|
||||
}
|
||||
|
||||
addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) {
|
||||
const event = watchedDir.has(item) ? EV_CHANGE : EV_ADD;
|
||||
this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
}
|
||||
|
||||
async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts) {
|
||||
try {
|
||||
const stats = await stat(path)
|
||||
if (this.fsw.closed) return;
|
||||
if (sameTypes(info, stats)) {
|
||||
this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
} else {
|
||||
this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.code === 'EACCES') {
|
||||
this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
} else {
|
||||
this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts) {
|
||||
if (this.fsw.closed || this.checkIgnored(path)) return;
|
||||
|
||||
if (event === EV_UNLINK) {
|
||||
const isDirectory = info.type === FSEVENT_TYPE_DIRECTORY
|
||||
// suppress unlink events on never before seen files
|
||||
if (isDirectory || watchedDir.has(item)) {
|
||||
this.fsw._remove(parent, item, isDirectory);
|
||||
}
|
||||
} else {
|
||||
if (event === EV_ADD) {
|
||||
// track new directories
|
||||
if (info.type === FSEVENT_TYPE_DIRECTORY) this.fsw._getWatchedDir(path);
|
||||
|
||||
if (info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) {
|
||||
// push symlinks back to the top of the stack to get handled
|
||||
const curDepth = opts.depth === undefined ?
|
||||
undefined : calcDepth(fullPath, realPath) + 1;
|
||||
return this._addToFsEvents(path, false, true, curDepth);
|
||||
}
|
||||
|
||||
// track new paths
|
||||
// (other than symlinks being followed, which will be tracked soon)
|
||||
this.fsw._getWatchedDir(parent).add(item);
|
||||
}
|
||||
/**
|
||||
* @type {'add'|'addDir'|'unlink'|'unlinkDir'}
|
||||
*/
|
||||
const eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event;
|
||||
this.fsw._emit(eventName, path);
|
||||
if (eventName === EV_ADD_DIR) this._addToFsEvents(path, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle symlinks encountered during directory scan
|
||||
* @param {String} watchPath - file/dir path to be watched with fsevents
|
||||
* @param {String} realPath - real path (in case of symlinks)
|
||||
* @param {Function} transform - path transformer
|
||||
* @param {Function} globFilter - path filter in case a glob pattern was provided
|
||||
* @returns {Function} closer for the watcher instance
|
||||
*/
|
||||
_watchWithFsEvents(watchPath, realPath, transform, globFilter) {
|
||||
if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return;
|
||||
const opts = this.fsw.options;
|
||||
const watchCallback = async (fullPath, flags, info) => {
|
||||
if (this.fsw.closed) return;
|
||||
if (
|
||||
opts.depth !== undefined &&
|
||||
calcDepth(fullPath, realPath) > opts.depth
|
||||
) return;
|
||||
const path = transform(sysPath.join(
|
||||
watchPath, sysPath.relative(watchPath, fullPath)
|
||||
));
|
||||
if (globFilter && !globFilter(path)) return;
|
||||
// ensure directories are tracked
|
||||
const parent = sysPath.dirname(path);
|
||||
const item = sysPath.basename(path);
|
||||
const watchedDir = this.fsw._getWatchedDir(
|
||||
info.type === FSEVENT_TYPE_DIRECTORY ? path : parent
|
||||
);
|
||||
|
||||
// correct for wrong events emitted
|
||||
if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) {
|
||||
if (typeof opts.ignored === FUNCTION_TYPE) {
|
||||
let stats;
|
||||
try {
|
||||
stats = await stat(path);
|
||||
} catch (error) {}
|
||||
if (this.fsw.closed) return;
|
||||
if (this.checkIgnored(path, stats)) return;
|
||||
if (sameTypes(info, stats)) {
|
||||
this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
} else {
|
||||
this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
}
|
||||
} else {
|
||||
this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
}
|
||||
} else {
|
||||
switch (info.event) {
|
||||
case FSEVENT_CREATED:
|
||||
case FSEVENT_MODIFIED:
|
||||
return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
case FSEVENT_DELETED:
|
||||
case FSEVENT_MOVED:
|
||||
return this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const closer = setFSEventsListener(
|
||||
watchPath,
|
||||
realPath,
|
||||
watchCallback,
|
||||
this.fsw._emitRaw
|
||||
);
|
||||
|
||||
this.fsw._emitReady();
|
||||
return closer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle symlinks encountered during directory scan
|
||||
* @param {String} linkPath path to symlink
|
||||
* @param {String} fullPath absolute path to the symlink
|
||||
* @param {Function} transform pre-existing path transformer
|
||||
* @param {Number} curDepth level of subdirectories traversed to where symlink is
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) {
|
||||
// don't follow the same symlink more than once
|
||||
if (this.fsw.closed || this.fsw._symlinkPaths.has(fullPath)) return;
|
||||
|
||||
this.fsw._symlinkPaths.set(fullPath, true);
|
||||
this.fsw._incrReadyCount();
|
||||
|
||||
try {
|
||||
const linkTarget = await realpath(linkPath);
|
||||
if (this.fsw.closed) return;
|
||||
if (this.fsw._isIgnored(linkTarget)) {
|
||||
return this.fsw._emitReady();
|
||||
}
|
||||
|
||||
this.fsw._incrReadyCount();
|
||||
|
||||
// add the linkTarget for watching with a wrapper for transform
|
||||
// that causes emitted paths to incorporate the link's path
|
||||
this._addToFsEvents(linkTarget || linkPath, (path) => {
|
||||
let aliasedPath = linkPath;
|
||||
if (linkTarget && linkTarget !== DOT_SLASH) {
|
||||
aliasedPath = path.replace(linkTarget, linkPath);
|
||||
} else if (path !== DOT_SLASH) {
|
||||
aliasedPath = sysPath.join(linkPath, path);
|
||||
}
|
||||
return transform(aliasedPath);
|
||||
}, false, curDepth);
|
||||
} catch(error) {
|
||||
if (this.fsw._handleError(error)) {
|
||||
return this.fsw._emitReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Path} newPath
|
||||
* @param {fs.Stats} stats
|
||||
*/
|
||||
emitAdd(newPath, stats, processPath, opts, forceAdd) {
|
||||
const pp = processPath(newPath);
|
||||
const isDir = stats.isDirectory();
|
||||
const dirObj = this.fsw._getWatchedDir(sysPath.dirname(pp));
|
||||
const base = sysPath.basename(pp);
|
||||
|
||||
// ensure empty dirs get tracked
|
||||
if (isDir) this.fsw._getWatchedDir(pp);
|
||||
if (dirObj.has(base)) return;
|
||||
dirObj.add(base);
|
||||
|
||||
if (!opts.ignoreInitial || forceAdd === true) {
|
||||
this.fsw._emit(isDir ? EV_ADD_DIR : EV_ADD, pp, stats);
|
||||
}
|
||||
}
|
||||
|
||||
initWatch(realPath, path, wh, processPath) {
|
||||
if (this.fsw.closed) return;
|
||||
const closer = this._watchWithFsEvents(
|
||||
wh.watchPath,
|
||||
sysPath.resolve(realPath || wh.watchPath),
|
||||
processPath,
|
||||
wh.globFilter
|
||||
);
|
||||
this.fsw._addPathCloser(path, closer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle added path with fsevents
|
||||
* @param {String} path file/dir path or glob pattern
|
||||
* @param {Function|Boolean=} transform converts working path to what the user expects
|
||||
* @param {Boolean=} forceAdd ensure add is emitted
|
||||
* @param {Number=} priorDepth Level of subdirectories already traversed.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async _addToFsEvents(path, transform, forceAdd, priorDepth) {
|
||||
if (this.fsw.closed) {
|
||||
return;
|
||||
}
|
||||
const opts = this.fsw.options;
|
||||
const processPath = typeof transform === FUNCTION_TYPE ? transform : IDENTITY_FN;
|
||||
|
||||
const wh = this.fsw._getWatchHelpers(path);
|
||||
|
||||
// evaluate what is at the path we're being asked to watch
|
||||
try {
|
||||
const stats = await statMethods[wh.statMethod](wh.watchPath);
|
||||
if (this.fsw.closed) return;
|
||||
if (this.fsw._isIgnored(wh.watchPath, stats)) {
|
||||
throw null;
|
||||
}
|
||||
if (stats.isDirectory()) {
|
||||
// emit addDir unless this is a glob parent
|
||||
if (!wh.globFilter) this.emitAdd(processPath(path), stats, processPath, opts, forceAdd);
|
||||
|
||||
// don't recurse further if it would exceed depth setting
|
||||
if (priorDepth && priorDepth > opts.depth) return;
|
||||
|
||||
// scan the contents of the dir
|
||||
this.fsw._readdirp(wh.watchPath, {
|
||||
fileFilter: entry => wh.filterPath(entry),
|
||||
directoryFilter: entry => wh.filterDir(entry),
|
||||
...Depth(opts.depth - (priorDepth || 0))
|
||||
}).on(STR_DATA, (entry) => {
|
||||
// need to check filterPath on dirs b/c filterDir is less restrictive
|
||||
if (this.fsw.closed) {
|
||||
return;
|
||||
}
|
||||
if (entry.stats.isDirectory() && !wh.filterPath(entry)) return;
|
||||
|
||||
const joinedPath = sysPath.join(wh.watchPath, entry.path);
|
||||
const {fullPath} = entry;
|
||||
|
||||
if (wh.followSymlinks && entry.stats.isSymbolicLink()) {
|
||||
// preserve the current depth here since it can't be derived from
|
||||
// real paths past the symlink
|
||||
const curDepth = opts.depth === undefined ?
|
||||
undefined : calcDepth(joinedPath, sysPath.resolve(wh.watchPath)) + 1;
|
||||
|
||||
this._handleFsEventsSymlink(joinedPath, fullPath, processPath, curDepth);
|
||||
} else {
|
||||
this.emitAdd(joinedPath, entry.stats, processPath, opts, forceAdd);
|
||||
}
|
||||
}).on(EV_ERROR, EMPTY_FN).on(STR_END, () => {
|
||||
this.fsw._emitReady();
|
||||
});
|
||||
} else {
|
||||
this.emitAdd(wh.watchPath, stats, processPath, opts, forceAdd);
|
||||
this.fsw._emitReady();
|
||||
}
|
||||
} catch (error) {
|
||||
if (!error || this.fsw._handleError(error)) {
|
||||
// TODO: Strange thing: "should not choke on an ignored watch path" will be failed without 2 ready calls -__-
|
||||
this.fsw._emitReady();
|
||||
this.fsw._emitReady();
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.persistent && forceAdd !== true) {
|
||||
if (typeof transform === FUNCTION_TYPE) {
|
||||
// realpath has already been resolved
|
||||
this.initWatch(undefined, path, wh, processPath);
|
||||
} else {
|
||||
let realPath;
|
||||
try {
|
||||
realPath = await realpath(wh.watchPath);
|
||||
} catch (e) {}
|
||||
this.initWatch(realPath, path, wh, processPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = FsEventsHandler;
|
||||
module.exports.canUse = canUse;
|
||||
654
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/lib/nodefs-handler.js
generated
vendored
Normal file
654
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/lib/nodefs-handler.js
generated
vendored
Normal file
|
|
@ -0,0 +1,654 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const sysPath = require('path');
|
||||
const { promisify } = require('util');
|
||||
const isBinaryPath = require('is-binary-path');
|
||||
const {
|
||||
isWindows,
|
||||
isLinux,
|
||||
EMPTY_FN,
|
||||
EMPTY_STR,
|
||||
KEY_LISTENERS,
|
||||
KEY_ERR,
|
||||
KEY_RAW,
|
||||
HANDLER_KEYS,
|
||||
EV_CHANGE,
|
||||
EV_ADD,
|
||||
EV_ADD_DIR,
|
||||
EV_ERROR,
|
||||
STR_DATA,
|
||||
STR_END,
|
||||
BRACE_START,
|
||||
STAR
|
||||
} = require('./constants');
|
||||
|
||||
const THROTTLE_MODE_WATCH = 'watch';
|
||||
|
||||
const open = promisify(fs.open);
|
||||
const stat = promisify(fs.stat);
|
||||
const lstat = promisify(fs.lstat);
|
||||
const close = promisify(fs.close);
|
||||
const fsrealpath = promisify(fs.realpath);
|
||||
|
||||
const statMethods = { lstat, stat };
|
||||
|
||||
// TODO: emit errors properly. Example: EMFILE on Macos.
|
||||
const foreach = (val, fn) => {
|
||||
if (val instanceof Set) {
|
||||
val.forEach(fn);
|
||||
} else {
|
||||
fn(val);
|
||||
}
|
||||
};
|
||||
|
||||
const addAndConvert = (main, prop, item) => {
|
||||
let container = main[prop];
|
||||
if (!(container instanceof Set)) {
|
||||
main[prop] = container = new Set([container]);
|
||||
}
|
||||
container.add(item);
|
||||
};
|
||||
|
||||
const clearItem = cont => key => {
|
||||
const set = cont[key];
|
||||
if (set instanceof Set) {
|
||||
set.clear();
|
||||
} else {
|
||||
delete cont[key];
|
||||
}
|
||||
};
|
||||
|
||||
const delFromSet = (main, prop, item) => {
|
||||
const container = main[prop];
|
||||
if (container instanceof Set) {
|
||||
container.delete(item);
|
||||
} else if (container === item) {
|
||||
delete main[prop];
|
||||
}
|
||||
};
|
||||
|
||||
const isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
|
||||
|
||||
/**
|
||||
* @typedef {String} Path
|
||||
*/
|
||||
|
||||
// fs_watch helpers
|
||||
|
||||
// object to hold per-process fs_watch instances
|
||||
// (may be shared across chokidar FSWatcher instances)
|
||||
|
||||
/**
|
||||
* @typedef {Object} FsWatchContainer
|
||||
* @property {Set} listeners
|
||||
* @property {Set} errHandlers
|
||||
* @property {Set} rawEmitters
|
||||
* @property {fs.FSWatcher=} watcher
|
||||
* @property {Boolean=} watcherUnusable
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {Map<String,FsWatchContainer>}
|
||||
*/
|
||||
const FsWatchInstances = new Map();
|
||||
|
||||
/**
|
||||
* Instantiates the fs_watch interface
|
||||
* @param {String} path to be watched
|
||||
* @param {Object} options to be passed to fs_watch
|
||||
* @param {Function} listener main event handler
|
||||
* @param {Function} errHandler emits info about errors
|
||||
* @param {Function} emitRaw emits raw event data
|
||||
* @returns {fs.FSWatcher} new fsevents instance
|
||||
*/
|
||||
function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
||||
const handleEvent = (rawEvent, evPath) => {
|
||||
listener(path);
|
||||
emitRaw(rawEvent, evPath, {watchedPath: path});
|
||||
|
||||
// emit based on events occurring for files from a directory's watcher in
|
||||
// case the file's watcher misses it (and rely on throttling to de-dupe)
|
||||
if (evPath && path !== evPath) {
|
||||
fsWatchBroadcast(
|
||||
sysPath.resolve(path, evPath), KEY_LISTENERS, sysPath.join(path, evPath)
|
||||
);
|
||||
}
|
||||
};
|
||||
try {
|
||||
return fs.watch(path, options, handleEvent);
|
||||
} catch (error) {
|
||||
errHandler(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for passing fs_watch event data to a collection of listeners
|
||||
* @param {Path} fullPath absolute path bound to fs_watch instance
|
||||
* @param {String} type listener type
|
||||
* @param {*=} val1 arguments to be passed to listeners
|
||||
* @param {*=} val2
|
||||
* @param {*=} val3
|
||||
*/
|
||||
const fsWatchBroadcast = (fullPath, type, val1, val2, val3) => {
|
||||
const cont = FsWatchInstances.get(fullPath);
|
||||
if (!cont) return;
|
||||
foreach(cont[type], (listener) => {
|
||||
listener(val1, val2, val3);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Instantiates the fs_watch interface or binds listeners
|
||||
* to an existing one covering the same file system entry
|
||||
* @param {String} path
|
||||
* @param {String} fullPath absolute path
|
||||
* @param {Object} options to be passed to fs_watch
|
||||
* @param {Object} handlers container for event listener functions
|
||||
*/
|
||||
const setFsWatchListener = (path, fullPath, options, handlers) => {
|
||||
const {listener, errHandler, rawEmitter} = handlers;
|
||||
let cont = FsWatchInstances.get(fullPath);
|
||||
|
||||
/** @type {fs.FSWatcher=} */
|
||||
let watcher;
|
||||
if (!options.persistent) {
|
||||
watcher = createFsWatchInstance(
|
||||
path, options, listener, errHandler, rawEmitter
|
||||
);
|
||||
return watcher.close.bind(watcher);
|
||||
}
|
||||
if (cont) {
|
||||
addAndConvert(cont, KEY_LISTENERS, listener);
|
||||
addAndConvert(cont, KEY_ERR, errHandler);
|
||||
addAndConvert(cont, KEY_RAW, rawEmitter);
|
||||
} else {
|
||||
watcher = createFsWatchInstance(
|
||||
path,
|
||||
options,
|
||||
fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
|
||||
errHandler, // no need to use broadcast here
|
||||
fsWatchBroadcast.bind(null, fullPath, KEY_RAW)
|
||||
);
|
||||
if (!watcher) return;
|
||||
watcher.on(EV_ERROR, async (error) => {
|
||||
const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
|
||||
cont.watcherUnusable = true; // documented since Node 10.4.1
|
||||
// Workaround for https://github.com/joyent/node/issues/4337
|
||||
if (isWindows && error.code === 'EPERM') {
|
||||
try {
|
||||
const fd = await open(path, 'r');
|
||||
await close(fd);
|
||||
broadcastErr(error);
|
||||
} catch (err) {}
|
||||
} else {
|
||||
broadcastErr(error);
|
||||
}
|
||||
});
|
||||
cont = {
|
||||
listeners: listener,
|
||||
errHandlers: errHandler,
|
||||
rawEmitters: rawEmitter,
|
||||
watcher
|
||||
};
|
||||
FsWatchInstances.set(fullPath, cont);
|
||||
}
|
||||
// const index = cont.listeners.indexOf(listener);
|
||||
|
||||
// removes this instance's listeners and closes the underlying fs_watch
|
||||
// instance if there are no more listeners left
|
||||
return () => {
|
||||
delFromSet(cont, KEY_LISTENERS, listener);
|
||||
delFromSet(cont, KEY_ERR, errHandler);
|
||||
delFromSet(cont, KEY_RAW, rawEmitter);
|
||||
if (isEmptySet(cont.listeners)) {
|
||||
// Check to protect against issue gh-730.
|
||||
// if (cont.watcherUnusable) {
|
||||
cont.watcher.close();
|
||||
// }
|
||||
FsWatchInstances.delete(fullPath);
|
||||
HANDLER_KEYS.forEach(clearItem(cont));
|
||||
cont.watcher = undefined;
|
||||
Object.freeze(cont);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// fs_watchFile helpers
|
||||
|
||||
// object to hold per-process fs_watchFile instances
|
||||
// (may be shared across chokidar FSWatcher instances)
|
||||
const FsWatchFileInstances = new Map();
|
||||
|
||||
/**
|
||||
* Instantiates the fs_watchFile interface or binds listeners
|
||||
* to an existing one covering the same file system entry
|
||||
* @param {String} path to be watched
|
||||
* @param {String} fullPath absolute path
|
||||
* @param {Object} options options to be passed to fs_watchFile
|
||||
* @param {Object} handlers container for event listener functions
|
||||
* @returns {Function} closer
|
||||
*/
|
||||
const setFsWatchFileListener = (path, fullPath, options, handlers) => {
|
||||
const {listener, rawEmitter} = handlers;
|
||||
let cont = FsWatchFileInstances.get(fullPath);
|
||||
|
||||
/* eslint-disable no-unused-vars, prefer-destructuring */
|
||||
let listeners = new Set();
|
||||
let rawEmitters = new Set();
|
||||
|
||||
const copts = cont && cont.options;
|
||||
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
||||
// "Upgrade" the watcher to persistence or a quicker interval.
|
||||
// This creates some unlikely edge case issues if the user mixes
|
||||
// settings in a very weird way, but solving for those cases
|
||||
// doesn't seem worthwhile for the added complexity.
|
||||
listeners = cont.listeners;
|
||||
rawEmitters = cont.rawEmitters;
|
||||
fs.unwatchFile(fullPath);
|
||||
cont = undefined;
|
||||
}
|
||||
|
||||
/* eslint-enable no-unused-vars, prefer-destructuring */
|
||||
|
||||
if (cont) {
|
||||
addAndConvert(cont, KEY_LISTENERS, listener);
|
||||
addAndConvert(cont, KEY_RAW, rawEmitter);
|
||||
} else {
|
||||
// TODO
|
||||
// listeners.add(listener);
|
||||
// rawEmitters.add(rawEmitter);
|
||||
cont = {
|
||||
listeners: listener,
|
||||
rawEmitters: rawEmitter,
|
||||
options,
|
||||
watcher: fs.watchFile(fullPath, options, (curr, prev) => {
|
||||
foreach(cont.rawEmitters, (rawEmitter) => {
|
||||
rawEmitter(EV_CHANGE, fullPath, {curr, prev});
|
||||
});
|
||||
const currmtime = curr.mtimeMs;
|
||||
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
||||
foreach(cont.listeners, (listener) => listener(path, curr));
|
||||
}
|
||||
})
|
||||
};
|
||||
FsWatchFileInstances.set(fullPath, cont);
|
||||
}
|
||||
// const index = cont.listeners.indexOf(listener);
|
||||
|
||||
// Removes this instance's listeners and closes the underlying fs_watchFile
|
||||
// instance if there are no more listeners left.
|
||||
return () => {
|
||||
delFromSet(cont, KEY_LISTENERS, listener);
|
||||
delFromSet(cont, KEY_RAW, rawEmitter);
|
||||
if (isEmptySet(cont.listeners)) {
|
||||
FsWatchFileInstances.delete(fullPath);
|
||||
fs.unwatchFile(fullPath);
|
||||
cont.options = cont.watcher = undefined;
|
||||
Object.freeze(cont);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @mixin
|
||||
*/
|
||||
class NodeFsHandler {
|
||||
|
||||
/**
|
||||
* @param {import("../index").FSWatcher} fsW
|
||||
*/
|
||||
constructor(fsW) {
|
||||
this.fsw = fsW;
|
||||
this._boundHandleError = (error) => fsW._handleError(error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Watch file for changes with fs_watchFile or fs_watch.
|
||||
* @param {String} path to file or dir
|
||||
* @param {Function} listener on fs change
|
||||
* @returns {Function} closer for the watcher instance
|
||||
*/
|
||||
_watchWithNodeFs(path, listener) {
|
||||
const opts = this.fsw.options;
|
||||
const directory = sysPath.dirname(path);
|
||||
const basename = sysPath.basename(path);
|
||||
const parent = this.fsw._getWatchedDir(directory);
|
||||
parent.add(basename);
|
||||
const absolutePath = sysPath.resolve(path);
|
||||
const options = {persistent: opts.persistent};
|
||||
if (!listener) listener = EMPTY_FN;
|
||||
|
||||
let closer;
|
||||
if (opts.usePolling) {
|
||||
options.interval = opts.enableBinaryInterval && isBinaryPath(basename) ?
|
||||
opts.binaryInterval : opts.interval;
|
||||
closer = setFsWatchFileListener(path, absolutePath, options, {
|
||||
listener,
|
||||
rawEmitter: this.fsw._emitRaw
|
||||
});
|
||||
} else {
|
||||
closer = setFsWatchListener(path, absolutePath, options, {
|
||||
listener,
|
||||
errHandler: this._boundHandleError,
|
||||
rawEmitter: this.fsw._emitRaw
|
||||
});
|
||||
}
|
||||
return closer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Watch a file and emit add event if warranted.
|
||||
* @param {Path} file Path
|
||||
* @param {fs.Stats} stats result of fs_stat
|
||||
* @param {Boolean} initialAdd was the file added at watch instantiation?
|
||||
* @returns {Function} closer for the watcher instance
|
||||
*/
|
||||
_handleFile(file, stats, initialAdd) {
|
||||
if (this.fsw.closed) {
|
||||
return;
|
||||
}
|
||||
const dirname = sysPath.dirname(file);
|
||||
const basename = sysPath.basename(file);
|
||||
const parent = this.fsw._getWatchedDir(dirname);
|
||||
// stats is always present
|
||||
let prevStats = stats;
|
||||
|
||||
// if the file is already being watched, do nothing
|
||||
if (parent.has(basename)) return;
|
||||
|
||||
const listener = async (path, newStats) => {
|
||||
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
|
||||
if (!newStats || newStats.mtimeMs === 0) {
|
||||
try {
|
||||
const newStats = await stat(file);
|
||||
if (this.fsw.closed) return;
|
||||
// Check that change event was not fired because of changed only accessTime.
|
||||
const at = newStats.atimeMs;
|
||||
const mt = newStats.mtimeMs;
|
||||
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
|
||||
this.fsw._emit(EV_CHANGE, file, newStats);
|
||||
}
|
||||
if (isLinux && prevStats.ino !== newStats.ino) {
|
||||
this.fsw._closeFile(path)
|
||||
prevStats = newStats;
|
||||
this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener));
|
||||
} else {
|
||||
prevStats = newStats;
|
||||
}
|
||||
} catch (error) {
|
||||
// Fix issues where mtime is null but file is still present
|
||||
this.fsw._remove(dirname, basename);
|
||||
}
|
||||
// add is about to be emitted if file not already tracked in parent
|
||||
} else if (parent.has(basename)) {
|
||||
// Check that change event was not fired because of changed only accessTime.
|
||||
const at = newStats.atimeMs;
|
||||
const mt = newStats.mtimeMs;
|
||||
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
|
||||
this.fsw._emit(EV_CHANGE, file, newStats);
|
||||
}
|
||||
prevStats = newStats;
|
||||
}
|
||||
}
|
||||
// kick off the watcher
|
||||
const closer = this._watchWithNodeFs(file, listener);
|
||||
|
||||
// emit an add event if we're supposed to
|
||||
if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
|
||||
if (!this.fsw._throttle(EV_ADD, file, 0)) return;
|
||||
this.fsw._emit(EV_ADD, file, stats);
|
||||
}
|
||||
|
||||
return closer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle symlinks encountered while reading a dir.
|
||||
* @param {Object} entry returned by readdirp
|
||||
* @param {String} directory path of dir being read
|
||||
* @param {String} path of this item
|
||||
* @param {String} item basename of this item
|
||||
* @returns {Promise<Boolean>} true if no more processing is needed for this entry.
|
||||
*/
|
||||
async _handleSymlink(entry, directory, path, item) {
|
||||
if (this.fsw.closed) {
|
||||
return;
|
||||
}
|
||||
const full = entry.fullPath;
|
||||
const dir = this.fsw._getWatchedDir(directory);
|
||||
|
||||
if (!this.fsw.options.followSymlinks) {
|
||||
// watch symlink directly (don't follow) and detect changes
|
||||
this.fsw._incrReadyCount();
|
||||
|
||||
let linkPath;
|
||||
try {
|
||||
linkPath = await fsrealpath(path);
|
||||
} catch (e) {
|
||||
this.fsw._emitReady();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.fsw.closed) return;
|
||||
if (dir.has(item)) {
|
||||
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
||||
this.fsw._symlinkPaths.set(full, linkPath);
|
||||
this.fsw._emit(EV_CHANGE, path, entry.stats);
|
||||
}
|
||||
} else {
|
||||
dir.add(item);
|
||||
this.fsw._symlinkPaths.set(full, linkPath);
|
||||
this.fsw._emit(EV_ADD, path, entry.stats);
|
||||
}
|
||||
this.fsw._emitReady();
|
||||
return true;
|
||||
}
|
||||
|
||||
// don't follow the same symlink more than once
|
||||
if (this.fsw._symlinkPaths.has(full)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.fsw._symlinkPaths.set(full, true);
|
||||
}
|
||||
|
||||
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
||||
// Normalize the directory name on Windows
|
||||
directory = sysPath.join(directory, EMPTY_STR);
|
||||
|
||||
if (!wh.hasGlob) {
|
||||
throttler = this.fsw._throttle('readdir', directory, 1000);
|
||||
if (!throttler) return;
|
||||
}
|
||||
|
||||
const previous = this.fsw._getWatchedDir(wh.path);
|
||||
const current = new Set();
|
||||
|
||||
let stream = this.fsw._readdirp(directory, {
|
||||
fileFilter: entry => wh.filterPath(entry),
|
||||
directoryFilter: entry => wh.filterDir(entry),
|
||||
depth: 0
|
||||
}).on(STR_DATA, async (entry) => {
|
||||
if (this.fsw.closed) {
|
||||
stream = undefined;
|
||||
return;
|
||||
}
|
||||
const item = entry.path;
|
||||
let path = sysPath.join(directory, item);
|
||||
current.add(item);
|
||||
|
||||
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.fsw.closed) {
|
||||
stream = undefined;
|
||||
return;
|
||||
}
|
||||
// Files that present in current directory snapshot
|
||||
// but absent in previous are added to watch list and
|
||||
// emit `add` event.
|
||||
if (item === target || !target && !previous.has(item)) {
|
||||
this.fsw._incrReadyCount();
|
||||
|
||||
// ensure relativeness of path is preserved in case of watcher reuse
|
||||
path = sysPath.join(dir, sysPath.relative(dir, path));
|
||||
|
||||
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
||||
}
|
||||
}).on(EV_ERROR, this._boundHandleError);
|
||||
|
||||
return new Promise(resolve =>
|
||||
stream.once(STR_END, () => {
|
||||
if (this.fsw.closed) {
|
||||
stream = undefined;
|
||||
return;
|
||||
}
|
||||
const wasThrottled = throttler ? throttler.clear() : false;
|
||||
|
||||
resolve();
|
||||
|
||||
// Files that absent in current directory snapshot
|
||||
// but present in previous emit `remove` event
|
||||
// and are removed from @watched[directory].
|
||||
previous.getChildren().filter((item) => {
|
||||
return item !== directory &&
|
||||
!current.has(item) &&
|
||||
// in case of intersecting globs;
|
||||
// a path may have been filtered out of this readdir, but
|
||||
// shouldn't be removed because it matches a different glob
|
||||
(!wh.hasGlob || wh.filterPath({
|
||||
fullPath: sysPath.resolve(directory, item)
|
||||
}));
|
||||
}).forEach((item) => {
|
||||
this.fsw._remove(directory, item);
|
||||
});
|
||||
|
||||
stream = undefined;
|
||||
|
||||
// one more time for any missed in case changes came in extremely quickly
|
||||
if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read directory to add / remove files from `@watched` list and re-read it on change.
|
||||
* @param {String} dir fs path
|
||||
* @param {fs.Stats} stats
|
||||
* @param {Boolean} initialAdd
|
||||
* @param {Number} depth relative to user-supplied path
|
||||
* @param {String} target child path targeted for watch
|
||||
* @param {Object} wh Common watch helpers for this path
|
||||
* @param {String} realpath
|
||||
* @returns {Promise<Function>} closer for the watcher instance.
|
||||
*/
|
||||
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
|
||||
const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
|
||||
const tracked = parentDir.has(sysPath.basename(dir));
|
||||
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
|
||||
if (!wh.hasGlob || wh.globFilter(dir)) this.fsw._emit(EV_ADD_DIR, dir, stats);
|
||||
}
|
||||
|
||||
// ensure dir is tracked (harmless if redundant)
|
||||
parentDir.add(sysPath.basename(dir));
|
||||
this.fsw._getWatchedDir(dir);
|
||||
let throttler;
|
||||
let closer;
|
||||
|
||||
const oDepth = this.fsw.options.depth;
|
||||
if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
|
||||
if (!target) {
|
||||
await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
|
||||
if (this.fsw.closed) return;
|
||||
}
|
||||
|
||||
closer = this._watchWithNodeFs(dir, (dirPath, stats) => {
|
||||
// if current directory is removed, do nothing
|
||||
if (stats && stats.mtimeMs === 0) return;
|
||||
|
||||
this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
|
||||
});
|
||||
}
|
||||
return closer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle added file, directory, or glob pattern.
|
||||
* Delegates call to _handleFile / _handleDir after checks.
|
||||
* @param {String} path to file or ir
|
||||
* @param {Boolean} initialAdd was the file added at watch instantiation?
|
||||
* @param {Object} priorWh depth relative to user-supplied path
|
||||
* @param {Number} depth Child path actually targeted for watch
|
||||
* @param {String=} target Child path actually targeted for watch
|
||||
* @returns {Promise}
|
||||
*/
|
||||
async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
|
||||
const ready = this.fsw._emitReady;
|
||||
if (this.fsw._isIgnored(path) || this.fsw.closed) {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
|
||||
const wh = this.fsw._getWatchHelpers(path, depth);
|
||||
if (!wh.hasGlob && priorWh) {
|
||||
wh.hasGlob = priorWh.hasGlob;
|
||||
wh.globFilter = priorWh.globFilter;
|
||||
wh.filterPath = entry => priorWh.filterPath(entry);
|
||||
wh.filterDir = entry => priorWh.filterDir(entry);
|
||||
}
|
||||
|
||||
// evaluate what is at the path we're being asked to watch
|
||||
try {
|
||||
const stats = await statMethods[wh.statMethod](wh.watchPath);
|
||||
if (this.fsw.closed) return;
|
||||
if (this.fsw._isIgnored(wh.watchPath, stats)) {
|
||||
ready();
|
||||
return false;
|
||||
}
|
||||
|
||||
const follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START);
|
||||
let closer;
|
||||
if (stats.isDirectory()) {
|
||||
const absPath = sysPath.resolve(path);
|
||||
const targetPath = follow ? await fsrealpath(path) : path;
|
||||
if (this.fsw.closed) return;
|
||||
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
||||
if (this.fsw.closed) return;
|
||||
// preserve this symlink's target path
|
||||
if (absPath !== targetPath && targetPath !== undefined) {
|
||||
this.fsw._symlinkPaths.set(absPath, targetPath);
|
||||
}
|
||||
} else if (stats.isSymbolicLink()) {
|
||||
const targetPath = follow ? await fsrealpath(path) : path;
|
||||
if (this.fsw.closed) return;
|
||||
const parent = sysPath.dirname(wh.watchPath);
|
||||
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
||||
this.fsw._emit(EV_ADD, wh.watchPath, stats);
|
||||
closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
|
||||
if (this.fsw.closed) return;
|
||||
|
||||
// preserve this symlink's target path
|
||||
if (targetPath !== undefined) {
|
||||
this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath);
|
||||
}
|
||||
} else {
|
||||
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
||||
}
|
||||
ready();
|
||||
|
||||
this.fsw._addPathCloser(path, closer);
|
||||
return false;
|
||||
|
||||
} catch (error) {
|
||||
if (this.fsw._handleError(error)) {
|
||||
ready();
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = NodeFsHandler;
|
||||
110
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/CHANGELOG.md
generated
vendored
Normal file
110
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
### [5.1.2](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) (2021-03-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* eliminate ReDoS ([#36](https://github.com/gulpjs/glob-parent/issues/36)) ([f923116](https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366))
|
||||
|
||||
### [5.1.1](https://github.com/gulpjs/glob-parent/compare/v5.1.0...v5.1.1) (2021-01-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* unescape exclamation mark ([#26](https://github.com/gulpjs/glob-parent/issues/26)) ([a98874f](https://github.com/gulpjs/glob-parent/commit/a98874f1a59e407f4fb1beb0db4efa8392da60bb))
|
||||
|
||||
## [5.1.0](https://github.com/gulpjs/glob-parent/compare/v5.0.0...v5.1.0) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add `flipBackslashes` option to disable auto conversion of slashes (closes [#24](https://github.com/gulpjs/glob-parent/issues/24)) ([#25](https://github.com/gulpjs/glob-parent/issues/25)) ([eecf91d](https://github.com/gulpjs/glob-parent/commit/eecf91d5e3834ed78aee39c4eaaae654d76b87b3))
|
||||
|
||||
## [5.0.0](https://github.com/gulpjs/glob-parent/compare/v4.0.0...v5.0.0) (2021-01-27)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* Drop support for node <6 & bump dependencies
|
||||
|
||||
### Miscellaneous Chores
|
||||
|
||||
* Drop support for node <6 & bump dependencies ([896c0c0](https://github.com/gulpjs/glob-parent/commit/896c0c00b4e7362f60b96e7fc295ae929245255a))
|
||||
|
||||
## [4.0.0](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v4.0.0) (2021-01-27)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* question marks are valid path characters on Windows so avoid flagging as a glob when alone
|
||||
* Update is-glob dependency
|
||||
|
||||
### Features
|
||||
|
||||
* hoist regexps and strings for performance gains ([4a80667](https://github.com/gulpjs/glob-parent/commit/4a80667c69355c76a572a5892b0f133c8e1f457e))
|
||||
* question marks are valid path characters on Windows so avoid flagging as a glob when alone ([2a551dd](https://github.com/gulpjs/glob-parent/commit/2a551dd0dc3235e78bf3c94843d4107072d17841))
|
||||
* Update is-glob dependency ([e41fcd8](https://github.com/gulpjs/glob-parent/commit/e41fcd895d1f7bc617dba45c9d935a7949b9c281))
|
||||
|
||||
## [3.1.0](https://github.com/gulpjs/glob-parent/compare/v3.0.1...v3.1.0) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* allow basic win32 backslash use ([272afa5](https://github.com/gulpjs/glob-parent/commit/272afa5fd070fc0f796386a5993d4ee4a846988b))
|
||||
* handle extglobs (parentheses) containing separators ([7db1bdb](https://github.com/gulpjs/glob-parent/commit/7db1bdb0756e55fd14619e8ce31aa31b17b117fd))
|
||||
* new approach to braces/brackets handling ([8269bd8](https://github.com/gulpjs/glob-parent/commit/8269bd89290d99fac9395a354fb56fdcdb80f0be))
|
||||
* pre-process braces/brackets sections ([9ef8a87](https://github.com/gulpjs/glob-parent/commit/9ef8a87f66b1a43d0591e7a8e4fc5a18415ee388))
|
||||
* preserve escaped brace/bracket at end of string ([8cfb0ba](https://github.com/gulpjs/glob-parent/commit/8cfb0ba84202d51571340dcbaf61b79d16a26c76))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* trailing escaped square brackets ([99ec9fe](https://github.com/gulpjs/glob-parent/commit/99ec9fecc60ee488ded20a94dd4f18b4f55c4ccf))
|
||||
|
||||
### [3.0.1](https://github.com/gulpjs/glob-parent/compare/v3.0.0...v3.0.1) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* use path-dirname ponyfill ([cdbea5f](https://github.com/gulpjs/glob-parent/commit/cdbea5f32a58a54e001a75ddd7c0fccd4776aacc))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* unescape glob-escaped dirnames on output ([598c533](https://github.com/gulpjs/glob-parent/commit/598c533bdf49c1428bc063aa9b8db40c5a86b030))
|
||||
|
||||
## [3.0.0](https://github.com/gulpjs/glob-parent/compare/v2.0.0...v3.0.0) (2021-01-27)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* update is-glob dependency
|
||||
|
||||
### Features
|
||||
|
||||
* update is-glob dependency ([5c5f8ef](https://github.com/gulpjs/glob-parent/commit/5c5f8efcee362a8e7638cf8220666acd8784f6bd))
|
||||
|
||||
## [2.0.0](https://github.com/gulpjs/glob-parent/compare/v1.3.0...v2.0.0) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* move up to dirname regardless of glob characters ([f97fb83](https://github.com/gulpjs/glob-parent/commit/f97fb83be2e0a9fc8d3b760e789d2ecadd6aa0c2))
|
||||
|
||||
## [1.3.0](https://github.com/gulpjs/glob-parent/compare/v1.2.0...v1.3.0) (2021-01-27)
|
||||
|
||||
## [1.2.0](https://github.com/gulpjs/glob-parent/compare/v1.1.0...v1.2.0) (2021-01-27)
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* feat: make regex test strings smaller ([dc80fa9](https://github.com/gulpjs/glob-parent/commit/dc80fa9658dca20549cfeba44bbd37d5246fcce0))
|
||||
|
||||
## [1.1.0](https://github.com/gulpjs/glob-parent/compare/v1.0.0...v1.1.0) (2021-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* make regex test strings smaller ([cd83220](https://github.com/gulpjs/glob-parent/commit/cd832208638f45169f986d80fcf66e401f35d233))
|
||||
|
||||
## 1.0.0 (2021-01-27)
|
||||
|
||||
15
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/LICENSE
generated
vendored
Normal file
15
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) 2015, 2019 Elan Shanker
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
137
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/README.md
generated
vendored
Normal file
137
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
<p align="center">
|
||||
<a href="https://gulpjs.com">
|
||||
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# glob-parent
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
|
||||
|
||||
Extract the non-magic parent path from a glob string.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var globParent = require('glob-parent');
|
||||
|
||||
globParent('path/to/*.js'); // 'path/to'
|
||||
globParent('/root/path/to/*.js'); // '/root/path/to'
|
||||
globParent('/*.js'); // '/'
|
||||
globParent('*.js'); // '.'
|
||||
globParent('**/*.js'); // '.'
|
||||
globParent('path/{to,from}'); // 'path'
|
||||
globParent('path/!(to|from)'); // 'path'
|
||||
globParent('path/?(to|from)'); // 'path'
|
||||
globParent('path/+(to|from)'); // 'path'
|
||||
globParent('path/*(to|from)'); // 'path'
|
||||
globParent('path/@(to|from)'); // 'path'
|
||||
globParent('path/**/*'); // 'path'
|
||||
|
||||
// if provided a non-glob path, returns the nearest dir
|
||||
globParent('path/foo/bar.js'); // 'path/foo'
|
||||
globParent('path/foo/'); // 'path/foo'
|
||||
globParent('path/foo'); // 'path' (see issue #3 for details)
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `globParent(maybeGlobString, [options])`
|
||||
|
||||
Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below.
|
||||
|
||||
#### options
|
||||
|
||||
```js
|
||||
{
|
||||
// Disables the automatic conversion of slashes for Windows
|
||||
flipBackslashes: true
|
||||
}
|
||||
```
|
||||
|
||||
## Escaping
|
||||
|
||||
The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters:
|
||||
|
||||
- `?` (question mark) unless used as a path segment alone
|
||||
- `*` (asterisk)
|
||||
- `|` (pipe)
|
||||
- `(` (opening parenthesis)
|
||||
- `)` (closing parenthesis)
|
||||
- `{` (opening curly brace)
|
||||
- `}` (closing curly brace)
|
||||
- `[` (opening bracket)
|
||||
- `]` (closing bracket)
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
globParent('foo/[bar]/') // 'foo'
|
||||
globParent('foo/\\[bar]/') // 'foo/[bar]'
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
### Braces & Brackets
|
||||
This library attempts a quick and imperfect method of determining which path
|
||||
parts have glob magic without fully parsing/lexing the pattern. There are some
|
||||
advanced use cases that can trip it up, such as nested braces where the outer
|
||||
pair is escaped and the inner one contains a path separator. If you find
|
||||
yourself in the unlikely circumstance of being affected by this or need to
|
||||
ensure higher-fidelity glob handling in your library, it is recommended that you
|
||||
pre-process your input with [expand-braces] and/or [expand-brackets].
|
||||
|
||||
### Windows
|
||||
Backslashes are not valid path separators for globs. If a path with backslashes
|
||||
is provided anyway, for simple cases, glob-parent will replace the path
|
||||
separator for you and return the non-glob parent path (now with
|
||||
forward-slashes, which are still valid as Windows path separators).
|
||||
|
||||
This cannot be used in conjunction with escape characters.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)'
|
||||
|
||||
// GOOD
|
||||
globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)'
|
||||
```
|
||||
|
||||
If you are using escape characters for a pattern without path parts (i.e.
|
||||
relative to `cwd`), prefix with `./` to avoid confusing glob-parent.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('foo \\[bar]') // 'foo '
|
||||
globParent('foo \\[bar]*') // 'foo '
|
||||
|
||||
// GOOD
|
||||
globParent('./foo \\[bar]') // 'foo [bar]'
|
||||
globParent('./foo \\[bar]*') // '.'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
[expand-braces]: https://github.com/jonschlinkert/expand-braces
|
||||
[expand-brackets]: https://github.com/jonschlinkert/expand-brackets
|
||||
|
||||
[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg
|
||||
[npm-url]: https://www.npmjs.com/package/glob-parent
|
||||
[npm-image]: https://img.shields.io/npm/v/glob-parent.svg
|
||||
|
||||
[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=2&branchName=master
|
||||
[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/glob-parent?branchName=master
|
||||
|
||||
[travis-url]: https://travis-ci.org/gulpjs/glob-parent
|
||||
[travis-image]: https://img.shields.io/travis/gulpjs/glob-parent.svg?label=travis-ci
|
||||
|
||||
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glob-parent
|
||||
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glob-parent.svg?label=appveyor
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent
|
||||
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg
|
||||
|
||||
[gitter-url]: https://gitter.im/gulpjs/gulp
|
||||
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
|
||||
42
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/index.js
generated
vendored
Normal file
42
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
'use strict';
|
||||
|
||||
var isGlob = require('is-glob');
|
||||
var pathPosixDirname = require('path').posix.dirname;
|
||||
var isWin32 = require('os').platform() === 'win32';
|
||||
|
||||
var slash = '/';
|
||||
var backslash = /\\/g;
|
||||
var enclosure = /[\{\[].*[\}\]]$/;
|
||||
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
|
||||
var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @param {Object} opts
|
||||
* @param {boolean} [opts.flipBackslashes=true]
|
||||
* @returns {string}
|
||||
*/
|
||||
module.exports = function globParent(str, opts) {
|
||||
var options = Object.assign({ flipBackslashes: true }, opts);
|
||||
|
||||
// flip windows path separators
|
||||
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
|
||||
str = str.replace(backslash, slash);
|
||||
}
|
||||
|
||||
// special case for strings ending in enclosure containing path separator
|
||||
if (enclosure.test(str)) {
|
||||
str += slash;
|
||||
}
|
||||
|
||||
// preserves full path in case of trailing path separator
|
||||
str += 'a';
|
||||
|
||||
// remove path parts that are globby
|
||||
do {
|
||||
str = pathPosixDirname(str);
|
||||
} while (isGlob(str) || globby.test(str));
|
||||
|
||||
// remove escape chars and return result
|
||||
return str.replace(escaped, '$1');
|
||||
};
|
||||
48
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/package.json
generated
vendored
Normal file
48
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/node_modules/glob-parent/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "glob-parent",
|
||||
"version": "5.1.2",
|
||||
"description": "Extract the non-magic parent path from a glob string.",
|
||||
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
|
||||
"contributors": [
|
||||
"Elan Shanker (https://github.com/es128)",
|
||||
"Blaine Bublitz <blaine.bublitz@gmail.com>"
|
||||
],
|
||||
"repository": "gulpjs/glob-parent",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"test": "nyc mocha --async-only",
|
||||
"azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit",
|
||||
"coveralls": "nyc report --reporter=text-lcov | coveralls"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.0.11",
|
||||
"eslint": "^2.13.1",
|
||||
"eslint-config-gulp": "^3.0.1",
|
||||
"expect": "^1.20.2",
|
||||
"mocha": "^6.0.2",
|
||||
"nyc": "^13.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"glob",
|
||||
"parent",
|
||||
"strip",
|
||||
"path",
|
||||
"dirname",
|
||||
"directory",
|
||||
"base",
|
||||
"wildcard"
|
||||
]
|
||||
}
|
||||
70
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/package.json
generated
vendored
Normal file
70
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
"name": "chokidar",
|
||||
"description": "Minimal and efficient cross-platform file watching library",
|
||||
"version": "3.6.0",
|
||||
"homepage": "https://github.com/paulmillr/chokidar",
|
||||
"author": "Paul Miller (https://paulmillr.com)",
|
||||
"contributors": [
|
||||
"Paul Miller (https://paulmillr.com)",
|
||||
"Elan Shanker"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 8.10.0"
|
||||
},
|
||||
"main": "index.js",
|
||||
"types": "./types/index.d.ts",
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
"normalize-path": "~3.0.0",
|
||||
"readdirp": "~3.6.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14",
|
||||
"chai": "^4.3",
|
||||
"dtslint": "^3.3.0",
|
||||
"eslint": "^7.0.0",
|
||||
"mocha": "^7.0.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"sinon": "^9.0.1",
|
||||
"sinon-chai": "^3.3.0",
|
||||
"typescript": "^4.4.3",
|
||||
"upath": "^1.2.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib/*.js",
|
||||
"types/index.d.ts"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/paulmillr/chokidar.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/paulmillr/chokidar/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dtslint": "dtslint types",
|
||||
"lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .",
|
||||
"build": "npm ls",
|
||||
"mocha": "mocha --exit --timeout 90000",
|
||||
"test": "npm run lint && npm run mocha"
|
||||
},
|
||||
"keywords": [
|
||||
"fs",
|
||||
"watch",
|
||||
"watchFile",
|
||||
"watcher",
|
||||
"watching",
|
||||
"file",
|
||||
"fsevents"
|
||||
],
|
||||
"funding": "https://paulmillr.com/funding/"
|
||||
}
|
||||
192
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/types/index.d.ts
generated
vendored
Normal file
192
Frontend-Learner/node_modules/tailwindcss/node_modules/chokidar/types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
// TypeScript Version: 3.0
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as fs from "fs";
|
||||
import { EventEmitter } from "events";
|
||||
import { Matcher } from 'anymatch';
|
||||
|
||||
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
||||
options: WatchOptions;
|
||||
|
||||
/**
|
||||
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
|
||||
*/
|
||||
constructor(options?: WatchOptions);
|
||||
|
||||
/**
|
||||
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
|
||||
* string.
|
||||
*/
|
||||
add(paths: string | ReadonlyArray<string>): this;
|
||||
|
||||
/**
|
||||
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
|
||||
* string.
|
||||
*/
|
||||
unwatch(paths: string | ReadonlyArray<string>): this;
|
||||
|
||||
/**
|
||||
* Returns an object representing all the paths on the file system being watched by this
|
||||
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
|
||||
* the `cwd` option was used), and the values are arrays of the names of the items contained in
|
||||
* each directory.
|
||||
*/
|
||||
getWatched(): {
|
||||
[directory: string]: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all listeners from watched files.
|
||||
*/
|
||||
close(): Promise<void>;
|
||||
|
||||
on(event: 'add'|'addDir'|'change', listener: (path: string, stats?: fs.Stats) => void): this;
|
||||
|
||||
on(event: 'all', listener: (eventName: 'add'|'addDir'|'change'|'unlink'|'unlinkDir', path: string, stats?: fs.Stats) => void): this;
|
||||
|
||||
/**
|
||||
* Error occurred
|
||||
*/
|
||||
on(event: 'error', listener: (error: Error) => void): this;
|
||||
|
||||
/**
|
||||
* Exposes the native Node `fs.FSWatcher events`
|
||||
*/
|
||||
on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this;
|
||||
|
||||
/**
|
||||
* Fires when the initial scan is complete
|
||||
*/
|
||||
on(event: 'ready', listener: () => void): this;
|
||||
|
||||
on(event: 'unlink'|'unlinkDir', listener: (path: string) => void): this;
|
||||
|
||||
on(event: string, listener: (...args: any[]) => void): this;
|
||||
|
||||
ref(): this;
|
||||
|
||||
unref(): this;
|
||||
}
|
||||
|
||||
export interface WatchOptions {
|
||||
/**
|
||||
* Indicates whether the process should continue to run as long as files are being watched. If
|
||||
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
|
||||
* even if the process continues to run.
|
||||
*/
|
||||
persistent?: boolean;
|
||||
|
||||
/**
|
||||
* ([anymatch](https://github.com/micromatch/anymatch)-compatible definition) Defines files/paths to
|
||||
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
|
||||
* with two arguments is provided, it gets called twice per path - once with a single argument
|
||||
* (the path), second time with two arguments (the path and the
|
||||
* [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
|
||||
*/
|
||||
ignored?: Matcher;
|
||||
|
||||
/**
|
||||
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while
|
||||
* instantiating the watching as chokidar discovers these file paths (before the `ready` event).
|
||||
*/
|
||||
ignoreInitial?: boolean;
|
||||
|
||||
/**
|
||||
* When `false`, only the symlinks themselves will be watched for changes instead of following
|
||||
* the link references and bubbling events through the link's path.
|
||||
*/
|
||||
followSymlinks?: boolean;
|
||||
|
||||
/**
|
||||
* The base directory from which watch `paths` are to be derived. Paths emitted with events will
|
||||
* be relative to this.
|
||||
*/
|
||||
cwd?: string;
|
||||
|
||||
/**
|
||||
* If set to true then the strings passed to .watch() and .add() are treated as literal path
|
||||
* names, even if they look like globs. Default: false.
|
||||
*/
|
||||
disableGlobbing?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
|
||||
* utilization, consider setting this to `false`. It is typically necessary to **set this to
|
||||
* `true` to successfully watch files over a network**, and it may be necessary to successfully
|
||||
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
|
||||
* the `useFsEvents` default.
|
||||
*/
|
||||
usePolling?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
|
||||
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
|
||||
* OS X, `usePolling: true` becomes the default.
|
||||
*/
|
||||
useFsEvents?: boolean;
|
||||
|
||||
/**
|
||||
* If relying upon the [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that
|
||||
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
|
||||
* provided even in cases where it wasn't already available from the underlying watch events.
|
||||
*/
|
||||
alwaysStat?: boolean;
|
||||
|
||||
/**
|
||||
* If set, limits how many levels of subdirectories will be traversed.
|
||||
*/
|
||||
depth?: number;
|
||||
|
||||
/**
|
||||
* Interval of file system polling.
|
||||
*/
|
||||
interval?: number;
|
||||
|
||||
/**
|
||||
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
|
||||
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
|
||||
*/
|
||||
binaryInterval?: number;
|
||||
|
||||
/**
|
||||
* Indicates whether to watch files that don't have read permissions if possible. If watching
|
||||
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
|
||||
* silently.
|
||||
*/
|
||||
ignorePermissionErrors?: boolean;
|
||||
|
||||
/**
|
||||
* `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts
|
||||
* that occur when using editors that use "atomic writes" instead of writing directly to the
|
||||
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
|
||||
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
|
||||
* you can override it by setting `atomic` to a custom value, in milliseconds.
|
||||
*/
|
||||
atomic?: boolean | number;
|
||||
|
||||
/**
|
||||
* can be set to an object in order to adjust timing params:
|
||||
*/
|
||||
awaitWriteFinish?: AwaitWriteFinishOptions | boolean;
|
||||
}
|
||||
|
||||
export interface AwaitWriteFinishOptions {
|
||||
/**
|
||||
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
|
||||
*/
|
||||
stabilityThreshold?: number;
|
||||
|
||||
/**
|
||||
* File size polling interval.
|
||||
*/
|
||||
pollInterval?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* produces an instance of `FSWatcher`.
|
||||
*/
|
||||
export function watch(
|
||||
paths: string | ReadonlyArray<string>,
|
||||
options?: WatchOptions
|
||||
): FSWatcher;
|
||||
15
Frontend-Learner/node_modules/tailwindcss/node_modules/glob-parent/LICENSE
generated
vendored
Normal file
15
Frontend-Learner/node_modules/tailwindcss/node_modules/glob-parent/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) 2015, 2019 Elan Shanker, 2021 Blaine Bublitz <blaine.bublitz@gmail.com>, Eric Schoffstall <yo@contra.io> and other contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
134
Frontend-Learner/node_modules/tailwindcss/node_modules/glob-parent/README.md
generated
vendored
Normal file
134
Frontend-Learner/node_modules/tailwindcss/node_modules/glob-parent/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
<p align="center">
|
||||
<a href="https://gulpjs.com">
|
||||
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# glob-parent
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]
|
||||
|
||||
Extract the non-magic parent path from a glob string.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var globParent = require('glob-parent');
|
||||
|
||||
globParent('path/to/*.js'); // 'path/to'
|
||||
globParent('/root/path/to/*.js'); // '/root/path/to'
|
||||
globParent('/*.js'); // '/'
|
||||
globParent('*.js'); // '.'
|
||||
globParent('**/*.js'); // '.'
|
||||
globParent('path/{to,from}'); // 'path'
|
||||
globParent('path/!(to|from)'); // 'path'
|
||||
globParent('path/?(to|from)'); // 'path'
|
||||
globParent('path/+(to|from)'); // 'path'
|
||||
globParent('path/*(to|from)'); // 'path'
|
||||
globParent('path/@(to|from)'); // 'path'
|
||||
globParent('path/**/*'); // 'path'
|
||||
|
||||
// if provided a non-glob path, returns the nearest dir
|
||||
globParent('path/foo/bar.js'); // 'path/foo'
|
||||
globParent('path/foo/'); // 'path/foo'
|
||||
globParent('path/foo'); // 'path' (see issue #3 for details)
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `globParent(maybeGlobString, [options])`
|
||||
|
||||
Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below.
|
||||
|
||||
#### options
|
||||
|
||||
```js
|
||||
{
|
||||
// Disables the automatic conversion of slashes for Windows
|
||||
flipBackslashes: true;
|
||||
}
|
||||
```
|
||||
|
||||
## Escaping
|
||||
|
||||
The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters:
|
||||
|
||||
- `?` (question mark) unless used as a path segment alone
|
||||
- `*` (asterisk)
|
||||
- `|` (pipe)
|
||||
- `(` (opening parenthesis)
|
||||
- `)` (closing parenthesis)
|
||||
- `{` (opening curly brace)
|
||||
- `}` (closing curly brace)
|
||||
- `[` (opening bracket)
|
||||
- `]` (closing bracket)
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
globParent('foo/[bar]/'); // 'foo'
|
||||
globParent('foo/\\[bar]/'); // 'foo/[bar]'
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
### Braces & Brackets
|
||||
|
||||
This library attempts a quick and imperfect method of determining which path
|
||||
parts have glob magic without fully parsing/lexing the pattern. There are some
|
||||
advanced use cases that can trip it up, such as nested braces where the outer
|
||||
pair is escaped and the inner one contains a path separator. If you find
|
||||
yourself in the unlikely circumstance of being affected by this or need to
|
||||
ensure higher-fidelity glob handling in your library, it is recommended that you
|
||||
pre-process your input with [expand-braces] and/or [expand-brackets].
|
||||
|
||||
### Windows
|
||||
|
||||
Backslashes are not valid path separators for globs. If a path with backslashes
|
||||
is provided anyway, for simple cases, glob-parent will replace the path
|
||||
separator for you and return the non-glob parent path (now with
|
||||
forward-slashes, which are still valid as Windows path separators).
|
||||
|
||||
This cannot be used in conjunction with escape characters.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('C:\\Program Files \\(x86\\)\\*.ext'); // 'C:/Program Files /(x86/)'
|
||||
|
||||
// GOOD
|
||||
globParent('C:/Program Files\\(x86\\)/*.ext'); // 'C:/Program Files (x86)'
|
||||
```
|
||||
|
||||
If you are using escape characters for a pattern without path parts (i.e.
|
||||
relative to `cwd`), prefix with `./` to avoid confusing glob-parent.
|
||||
|
||||
```js
|
||||
// BAD
|
||||
globParent('foo \\[bar]'); // 'foo '
|
||||
globParent('foo \\[bar]*'); // 'foo '
|
||||
|
||||
// GOOD
|
||||
globParent('./foo \\[bar]'); // 'foo [bar]'
|
||||
globParent('./foo \\[bar]*'); // '.'
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/glob-parent
|
||||
[npm-image]: https://img.shields.io/npm/v/glob-parent.svg?style=flat-square
|
||||
|
||||
[ci-url]: https://github.com/gulpjs/glob-parent/actions?query=workflow:dev
|
||||
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/glob-parent/dev?style=flat-square
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent
|
||||
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg?style=flat-square
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
[expand-braces]: https://github.com/jonschlinkert/expand-braces
|
||||
[expand-brackets]: https://github.com/jonschlinkert/expand-brackets
|
||||
<!-- prettier-ignore-end -->
|
||||
75
Frontend-Learner/node_modules/tailwindcss/node_modules/glob-parent/index.js
generated
vendored
Normal file
75
Frontend-Learner/node_modules/tailwindcss/node_modules/glob-parent/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
'use strict';
|
||||
|
||||
var isGlob = require('is-glob');
|
||||
var pathPosixDirname = require('path').posix.dirname;
|
||||
var isWin32 = require('os').platform() === 'win32';
|
||||
|
||||
var slash = '/';
|
||||
var backslash = /\\/g;
|
||||
var escaped = /\\([!*?|[\](){}])/g;
|
||||
|
||||
/**
|
||||
* @param {string} str
|
||||
* @param {Object} opts
|
||||
* @param {boolean} [opts.flipBackslashes=true]
|
||||
*/
|
||||
module.exports = function globParent(str, opts) {
|
||||
var options = Object.assign({ flipBackslashes: true }, opts);
|
||||
|
||||
// flip windows path separators
|
||||
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
|
||||
str = str.replace(backslash, slash);
|
||||
}
|
||||
|
||||
// special case for strings ending in enclosure containing path separator
|
||||
if (isEnclosure(str)) {
|
||||
str += slash;
|
||||
}
|
||||
|
||||
// preserves full path in case of trailing path separator
|
||||
str += 'a';
|
||||
|
||||
// remove path parts that are globby
|
||||
do {
|
||||
str = pathPosixDirname(str);
|
||||
} while (isGlobby(str));
|
||||
|
||||
// remove escape chars and return result
|
||||
return str.replace(escaped, '$1');
|
||||
};
|
||||
|
||||
function isEnclosure(str) {
|
||||
var lastChar = str.slice(-1);
|
||||
|
||||
var enclosureStart;
|
||||
switch (lastChar) {
|
||||
case '}':
|
||||
enclosureStart = '{';
|
||||
break;
|
||||
case ']':
|
||||
enclosureStart = '[';
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
var foundIndex = str.indexOf(enclosureStart);
|
||||
if (foundIndex < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return str.slice(foundIndex + 1, -1).includes(slash);
|
||||
}
|
||||
|
||||
function isGlobby(str) {
|
||||
if (/\([^()]+$/.test(str)) {
|
||||
return true;
|
||||
}
|
||||
if (str[0] === '{' || str[0] === '[') {
|
||||
return true;
|
||||
}
|
||||
if (/[^\\][{[]/.test(str)) {
|
||||
return true;
|
||||
}
|
||||
return isGlob(str);
|
||||
}
|
||||
54
Frontend-Learner/node_modules/tailwindcss/node_modules/glob-parent/package.json
generated
vendored
Normal file
54
Frontend-Learner/node_modules/tailwindcss/node_modules/glob-parent/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "glob-parent",
|
||||
"version": "6.0.2",
|
||||
"description": "Extract the non-magic parent path from a glob string.",
|
||||
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
|
||||
"contributors": [
|
||||
"Elan Shanker (https://github.com/es128)",
|
||||
"Blaine Bublitz <blaine.bublitz@gmail.com>"
|
||||
],
|
||||
"repository": "gulpjs/glob-parent",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"test": "nyc mocha --async-only"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-gulp": "^5.0.0",
|
||||
"expect": "^26.0.1",
|
||||
"mocha": "^7.1.2",
|
||||
"nyc": "^15.0.1"
|
||||
},
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": true
|
||||
},
|
||||
"keywords": [
|
||||
"glob",
|
||||
"parent",
|
||||
"strip",
|
||||
"path",
|
||||
"dirname",
|
||||
"directory",
|
||||
"base",
|
||||
"wildcard"
|
||||
]
|
||||
}
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/LICENSE
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
164
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/README.md
generated
vendored
Normal file
164
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
# jiti
|
||||
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![bundle][bundle-src]][bundle-href]
|
||||
[![License][license-src]][license-href]
|
||||
|
||||
Runtime Typescript and ESM support for Node.js.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> This is the support branch for jiti v1. Check out [jiti/main](https://github.com/unjs/jiti/tree/main) for the latest version and [unjs/jiti#174](https://github.com/unjs/jiti/issues/174) for the roadmap.
|
||||
|
||||
## Features
|
||||
|
||||
- Seamless typescript and ESM syntax support
|
||||
- Seamless interoperability between ESM and CommonJS
|
||||
- Synchronous API to replace `require`
|
||||
- Super slim and zero dependency
|
||||
- Smart syntax detection to avoid extra transforms
|
||||
- CommonJS cache integration
|
||||
- Filesystem transpile hard cache
|
||||
- V8 compile cache
|
||||
- Custom resolve alias
|
||||
|
||||
## Usage
|
||||
|
||||
### Programmatic
|
||||
|
||||
```js
|
||||
const jiti = require("jiti")(__filename);
|
||||
|
||||
jiti("./path/to/file.ts");
|
||||
```
|
||||
|
||||
You can also pass options as second argument:
|
||||
|
||||
```js
|
||||
const jiti = require("jiti")(__filename, { debug: true });
|
||||
```
|
||||
|
||||
### CLI
|
||||
|
||||
```bash
|
||||
jiti index.ts
|
||||
# or npx jiti index.ts
|
||||
```
|
||||
|
||||
### Register require hook
|
||||
|
||||
```bash
|
||||
node -r jiti/register index.ts
|
||||
```
|
||||
|
||||
Alternatively, you can register `jiti` as a require hook programmatically:
|
||||
|
||||
```js
|
||||
const jiti = require("jiti")();
|
||||
const unregister = jiti.register();
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### `debug`
|
||||
|
||||
- Type: Boolean
|
||||
- Default: `false`
|
||||
- Environment Variable: `JITI_DEBUG`
|
||||
|
||||
Enable debug to see which files are transpiled
|
||||
|
||||
### `cache`
|
||||
|
||||
- Type: Boolean | String
|
||||
- Default: `true`
|
||||
- Environment Variable: `JITI_CACHE`
|
||||
|
||||
Use transpile cache
|
||||
|
||||
If set to `true` will use `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/node-jiti`
|
||||
|
||||
### `esmResolve`
|
||||
|
||||
- Type: Boolean | String
|
||||
- Default: `false`
|
||||
- Environment Variable: `JITI_ESM_RESOLVE`
|
||||
|
||||
Using esm resolution algorithm to support `import` condition.
|
||||
|
||||
### `transform`
|
||||
|
||||
- Type: Function
|
||||
- Default: Babel (lazy loaded)
|
||||
|
||||
Transform function. See [src/babel](./src/babel.ts) for more details
|
||||
|
||||
### `sourceMaps`
|
||||
|
||||
- Type: Boolean
|
||||
- Default `false`
|
||||
- Environment Variable: `JITI_SOURCE_MAPS`
|
||||
|
||||
Add inline source map to transformed source for better debugging.
|
||||
|
||||
### `interopDefault`
|
||||
|
||||
- Type: Boolean
|
||||
- Default: `false`
|
||||
|
||||
Return the `.default` export of a module at the top-level.
|
||||
|
||||
### `alias`
|
||||
|
||||
- Type: Object
|
||||
- Default: -
|
||||
- Environment Variable: `JITI_ALIAS`
|
||||
|
||||
Custom alias map used to resolve ids.
|
||||
|
||||
### `nativeModules`
|
||||
|
||||
- Type: Array
|
||||
- Default: ['typescript`]
|
||||
- Environment Variable: `JITI_NATIVE_MODULES`
|
||||
|
||||
List of modules (within `node_modules`) to always use native require for them.
|
||||
|
||||
### `transformModules`
|
||||
|
||||
- Type: Array
|
||||
- Default: []
|
||||
- Environment Variable: `JITI_TRANSFORM_MODULES`
|
||||
|
||||
List of modules (within `node_modules`) to transform them regardless of syntax.
|
||||
|
||||
### `experimentalBun`
|
||||
|
||||
- Type: Boolean
|
||||
- Default: Enabled if `process.versions.bun` exists (Bun runtime)
|
||||
- Environment Variable: `JITI_EXPERIMENTAL_BUN`
|
||||
|
||||
Enable experimental native Bun support for transformations.
|
||||
|
||||
## Development
|
||||
|
||||
- Clone this repository
|
||||
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
|
||||
- Install dependencies using `pnpm install`
|
||||
- Run `pnpm dev`
|
||||
- Run `pnpm jiti ./test/path/to/file.ts`
|
||||
|
||||
## License
|
||||
|
||||
MIT. Made with 💖
|
||||
|
||||
<!-- Badged -->
|
||||
|
||||
[npm-version-src]: https://img.shields.io/npm/v/jiti?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-version-href]: https://npmjs.com/package/jiti
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/jiti?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-downloads-href]: https://npmjs.com/package/jiti
|
||||
[bundle-src]: https://img.shields.io/bundlephobia/minzip/jiti?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[bundle-href]: https://bundlephobia.com/result?p=h3
|
||||
[license-src]: https://img.shields.io/github/license/unjs/jiti.svg?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[license-href]: https://github.com/unjs/jiti/blob/main/LICENSE
|
||||
16
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/bin/jiti.js
generated
vendored
Normal file
16
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/bin/jiti.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const { resolve } = require("node:path");
|
||||
|
||||
const script = process.argv.splice(2, 1)[0];
|
||||
|
||||
if (!script) {
|
||||
|
||||
console.error("Usage: jiti <path> [...arguments]");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const pwd = process.cwd();
|
||||
const jiti = require("..")(pwd);
|
||||
const resolved = (process.argv[1] = jiti.resolve(resolve(pwd, script)));
|
||||
jiti(resolved);
|
||||
2
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/babel.d.ts
generated
vendored
Normal file
2
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/babel.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { TransformOptions, TRANSFORM_RESULT } from "./types";
|
||||
export default function transform(opts: TransformOptions): TRANSFORM_RESULT;
|
||||
227
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/babel.js
generated
vendored
Normal file
227
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/babel.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
20
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/jiti.d.ts
generated
vendored
Normal file
20
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/jiti.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { Module } from "module";
|
||||
import { TransformOptions, JITIOptions, JITIImportOptions } from "./types";
|
||||
export type { JITIOptions, TransformOptions } from "./types";
|
||||
type Require = typeof require;
|
||||
type Module = typeof module;
|
||||
type ModuleCache = Record<string, Module>;
|
||||
export type EvalModuleOptions = Partial<{
|
||||
id: string;
|
||||
filename: string;
|
||||
ext: string;
|
||||
cache: ModuleCache;
|
||||
}>;
|
||||
export interface JITI extends Require {
|
||||
transform: (opts: TransformOptions) => string;
|
||||
register: () => () => void;
|
||||
evalModule: (source: string, options?: EvalModuleOptions) => unknown;
|
||||
/** @experimental Behavior of `jiti.import` might change in the future. */
|
||||
import: (id: string, importOptions: JITIImportOptions) => Promise<unknown>;
|
||||
}
|
||||
export default function createJITI(_filename: string, opts?: JITIOptions, parentModule?: Module, parentCache?: ModuleCache): JITI;
|
||||
1
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/jiti.js
generated
vendored
Normal file
1
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/jiti.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/plugins/babel-plugin-transform-import-meta.d.ts
generated
vendored
Normal file
4
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/plugins/babel-plugin-transform-import-meta.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import type { PluginObj } from "@babel/core";
|
||||
export declare function TransformImportMetaPlugin(_ctx: any, opts: {
|
||||
filename?: string;
|
||||
}): PluginObj;
|
||||
5
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/plugins/import-meta-env.d.ts
generated
vendored
Normal file
5
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/plugins/import-meta-env.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/**
|
||||
* Forked from https://github.com/iendeavor/import-meta-env/tree/main/packages/babel 0.4.2 (MIT License - Copyright (c) 2021 Ernest)
|
||||
*/
|
||||
import type { PluginObj } from "@babel/core";
|
||||
export declare function importMetaEnvPlugin({ template, types }: any): PluginObj;
|
||||
35
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/types.d.ts
generated
vendored
Normal file
35
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
export type TransformOptions = {
|
||||
source: string;
|
||||
filename?: string;
|
||||
ts?: boolean;
|
||||
retainLines?: boolean;
|
||||
legacy?: boolean;
|
||||
[key: string]: any;
|
||||
};
|
||||
export type TRANSFORM_RESULT = {
|
||||
code: string;
|
||||
error?: any;
|
||||
};
|
||||
export type JITIOptions = {
|
||||
transform?: (opts: TransformOptions) => TRANSFORM_RESULT;
|
||||
debug?: boolean;
|
||||
cache?: boolean | string;
|
||||
sourceMaps?: boolean;
|
||||
requireCache?: boolean;
|
||||
v8cache?: boolean;
|
||||
interopDefault?: boolean;
|
||||
esmResolve?: boolean;
|
||||
cacheVersion?: string;
|
||||
onError?: (error: Error) => void;
|
||||
legacy?: boolean;
|
||||
extensions?: string[];
|
||||
transformOptions?: Omit<TransformOptions, "source">;
|
||||
alias?: Record<string, string>;
|
||||
nativeModules?: string[];
|
||||
transformModules?: string[];
|
||||
experimentalBun?: boolean;
|
||||
};
|
||||
export interface JITIImportOptions {
|
||||
/** @internal */
|
||||
_import?: () => Promise<any>;
|
||||
}
|
||||
8
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/utils.d.ts
generated
vendored
Normal file
8
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/dist/utils.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import type { PackageJson } from "pkg-types";
|
||||
export declare function getCacheDir(): string;
|
||||
export declare function isDir(filename: string): boolean;
|
||||
export declare function isWritable(filename: string): boolean;
|
||||
export declare function md5(content: string, len?: number): string;
|
||||
export declare function detectLegacySyntax(code: string): RegExpMatchArray | null;
|
||||
export declare function isObject(val: any): boolean;
|
||||
export declare function readNearestPackageJSON(path: string): PackageJson | undefined;
|
||||
15
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/lib/index.js
generated
vendored
Normal file
15
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
function onError(err) {
|
||||
throw err; /* ↓ Check stack trace ↓ */
|
||||
}
|
||||
|
||||
module.exports = function jiti(filename, opts) {
|
||||
const jiti = require("../dist/jiti");
|
||||
|
||||
opts = { onError, ...opts };
|
||||
|
||||
if (!opts.transform) {
|
||||
opts.transform = require("../dist/babel");
|
||||
}
|
||||
|
||||
return jiti(filename, opts);
|
||||
};
|
||||
81
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/package.json
generated
vendored
Normal file
81
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"name": "jiti",
|
||||
"version": "1.21.7",
|
||||
"description": "Runtime typescript and ESM support for Node.js",
|
||||
"repository": "unjs/jiti",
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"types": "dist/jiti.d.ts",
|
||||
"bin": "bin/jiti.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"dist",
|
||||
"register.js"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pnpm clean && NODE_ENV=production pnpm webpack",
|
||||
"clean": "rm -rf dist",
|
||||
"dev": "pnpm clean && pnpm webpack --watch",
|
||||
"jiti": "JITI_DEBUG=1 JITI_CACHE=false JITI_REQUIRE_CACHE=false ./bin/jiti.js",
|
||||
"jiti:legacy": "JITI_DEBUG=1 npx node@12 ./bin/jiti.js",
|
||||
"lint": "eslint . && prettier -c src lib test stubs",
|
||||
"lint:fix": "eslint --fix . && prettier -w src lib test stubs",
|
||||
"release": "pnpm build && pnpm test && changelogen --release --push && npm publish --tag 1x",
|
||||
"test": "pnpm lint && vitest run --coverage && pnpm test:bun",
|
||||
"test:bun": "bun --bun test test/bun"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.26.0",
|
||||
"@babel/plugin-proposal-decorators": "^7.25.9",
|
||||
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
||||
"@babel/plugin-syntax-import-assertions": "^7.26.0",
|
||||
"@babel/plugin-transform-export-namespace-from": "^7.25.9",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
|
||||
"@babel/plugin-transform-nullish-coalescing-operator": "^7.25.9",
|
||||
"@babel/plugin-transform-optional-chaining": "^7.25.9",
|
||||
"@babel/plugin-transform-typescript": "^7.26.3",
|
||||
"@babel/preset-typescript": "^7.26.0",
|
||||
"@babel/template": "^7.25.9",
|
||||
"@babel/types": "^7.26.3",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"@types/babel__template": "^7.4.4",
|
||||
"@types/node": "^22.10.2",
|
||||
"@types/object-hash": "^3.0.6",
|
||||
"@types/resolve": "^1.20.6",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@vitest/coverage-v8": "^2.1.8",
|
||||
"acorn": "^8.14.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.3",
|
||||
"babel-plugin-parameter-decorator": "^1.0.16",
|
||||
"babel-plugin-transform-typescript-metadata": "^0.3.2",
|
||||
"changelogen": "^0.5.7",
|
||||
"config": "^3.3.12",
|
||||
"create-require": "^1.1.1",
|
||||
"destr": "^2.0.3",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-config-unjs": "^0.4.2",
|
||||
"esm": "^3.2.25",
|
||||
"estree-walker": "^3.0.3",
|
||||
"execa": "^9.5.2",
|
||||
"fast-glob": "^3.3.2",
|
||||
"mlly": "^1.7.3",
|
||||
"object-hash": "^3.0.0",
|
||||
"pathe": "^1.1.2",
|
||||
"pirates": "^4.0.6",
|
||||
"pkg-types": "^1.2.1",
|
||||
"prettier": "^3.4.2",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"semver": "^7.6.3",
|
||||
"std-env": "^3.8.0",
|
||||
"terser-webpack-plugin": "^5.3.11",
|
||||
"ts-loader": "^9.5.1",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^6.0.3",
|
||||
"vitest": "^2.1.8",
|
||||
"webpack": "^5.97.1",
|
||||
"webpack-cli": "^5.1.4"
|
||||
},
|
||||
"packageManager": "pnpm@9.15.0"
|
||||
}
|
||||
3
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/register.js
generated
vendored
Normal file
3
Frontend-Learner/node_modules/tailwindcss/node_modules/jiti/register.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
const jiti = require(".")();
|
||||
|
||||
jiti.register();
|
||||
136
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/CHANGELOG.md
generated
vendored
Normal file
136
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
# Release history
|
||||
|
||||
**All notable changes to this project will be documented in this file.**
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
<details>
|
||||
<summary><strong>Guiding Principles</strong></summary>
|
||||
|
||||
- Changelogs are for humans, not machines.
|
||||
- There should be an entry for every single version.
|
||||
- The same types of changes should be grouped.
|
||||
- Versions and sections should be linkable.
|
||||
- The latest version comes first.
|
||||
- The release date of each versions is displayed.
|
||||
- Mention whether you follow Semantic Versioning.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Types of changes</strong></summary>
|
||||
|
||||
Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_):
|
||||
|
||||
- `Added` for new features.
|
||||
- `Changed` for changes in existing functionality.
|
||||
- `Deprecated` for soon-to-be removed features.
|
||||
- `Removed` for now removed features.
|
||||
- `Fixed` for any bug fixes.
|
||||
- `Security` in case of vulnerabilities.
|
||||
|
||||
</details>
|
||||
|
||||
## 2.3.1 (2022-01-02)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)).
|
||||
|
||||
### Changed
|
||||
|
||||
* Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)).
|
||||
|
||||
## 2.3.0 (2021-05-21)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixes bug where file names with two dots were not being matched consistently with negation extglobs containing a star ([56083ef](https://github.com/micromatch/picomatch/commit/56083ef))
|
||||
|
||||
## 2.2.3 (2021-04-10)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)).
|
||||
* Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)).
|
||||
|
||||
## 2.2.2 (2020-03-21)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)).
|
||||
|
||||
## 2.2.1 (2020-01-04)
|
||||
|
||||
* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals.
|
||||
|
||||
## 2.2.0 (2020-01-04)
|
||||
|
||||
* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f))
|
||||
* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`.
|
||||
|
||||
## 2.1.0 (2019-10-31)
|
||||
|
||||
* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92))
|
||||
* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650))
|
||||
* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c))
|
||||
* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9))
|
||||
* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625))
|
||||
* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0))
|
||||
* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8))
|
||||
* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07))
|
||||
* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45))
|
||||
* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34))
|
||||
* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55))
|
||||
* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03))
|
||||
* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87))
|
||||
* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d))
|
||||
* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa))
|
||||
* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d))
|
||||
* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54))
|
||||
* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367))
|
||||
* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569))
|
||||
* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77))
|
||||
* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038))
|
||||
* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd))
|
||||
|
||||
## 2.0.7 (2019-05-14)
|
||||
|
||||
* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71))
|
||||
* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e))
|
||||
* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279))
|
||||
* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44))
|
||||
|
||||
## 2.0.4 (2019-04-10)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez.
|
||||
- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza.
|
||||
|
||||
## 2.0.0 (2019-04-10)
|
||||
|
||||
### Added
|
||||
|
||||
- Adds support for `options.onIgnore`. See the readme for details
|
||||
- Adds support for `options.onResult`. See the readme for details
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- The unixify option was renamed to `windows`
|
||||
- caching and all related options and methods have been removed
|
||||
|
||||
## 1.0.0 (2018-11-05)
|
||||
|
||||
- adds `.onMatch` option
|
||||
- improvements to `.scan` method
|
||||
- numerous improvements and optimizations for matching and parsing
|
||||
- better windows path handling
|
||||
|
||||
## 0.1.0 - 2017-04-13
|
||||
|
||||
First release.
|
||||
|
||||
|
||||
[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/LICENSE
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
708
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/README.md
generated
vendored
Normal file
708
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,708 @@
|
|||
<h1 align="center">Picomatch</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://npmjs.org/package/picomatch">
|
||||
<img src="https://img.shields.io/npm/v/picomatch.svg" alt="version">
|
||||
</a>
|
||||
<a href="https://github.com/micromatch/picomatch/actions?workflow=Tests">
|
||||
<img src="https://github.com/micromatch/picomatch/workflows/Tests/badge.svg" alt="test status">
|
||||
</a>
|
||||
<a href="https://coveralls.io/github/micromatch/picomatch">
|
||||
<img src="https://img.shields.io/coveralls/github/micromatch/picomatch/master.svg" alt="coverage status">
|
||||
</a>
|
||||
<a href="https://npmjs.org/package/picomatch">
|
||||
<img src="https://img.shields.io/npm/dm/picomatch.svg" alt="downloads">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<strong>Blazing fast and accurate glob matcher written in JavaScript.</strong></br>
|
||||
<em>No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.</em>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Why picomatch?
|
||||
|
||||
* **Lightweight** - No dependencies
|
||||
* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function.
|
||||
* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps)
|
||||
* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files)
|
||||
* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes.
|
||||
* **Well tested** - Thousands of unit tests
|
||||
|
||||
See the [library comparison](#library-comparisons) to other libraries.
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Table of Contents
|
||||
|
||||
<details><summary> Click to expand </summary>
|
||||
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [API](#api)
|
||||
* [picomatch](#picomatch)
|
||||
* [.test](#test)
|
||||
* [.matchBase](#matchbase)
|
||||
* [.isMatch](#ismatch)
|
||||
* [.parse](#parse)
|
||||
* [.scan](#scan)
|
||||
* [.compileRe](#compilere)
|
||||
* [.makeRe](#makere)
|
||||
* [.toRegex](#toregex)
|
||||
- [Options](#options)
|
||||
* [Picomatch options](#picomatch-options)
|
||||
* [Scan Options](#scan-options)
|
||||
* [Options Examples](#options-examples)
|
||||
- [Globbing features](#globbing-features)
|
||||
* [Basic globbing](#basic-globbing)
|
||||
* [Advanced globbing](#advanced-globbing)
|
||||
* [Braces](#braces)
|
||||
* [Matching special characters as literals](#matching-special-characters-as-literals)
|
||||
- [Library Comparisons](#library-comparisons)
|
||||
- [Benchmarks](#benchmarks)
|
||||
- [Philosophies](#philosophies)
|
||||
- [About](#about)
|
||||
* [Author](#author)
|
||||
* [License](#license)
|
||||
|
||||
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
|
||||
|
||||
</details>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install --save picomatch
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Usage
|
||||
|
||||
The main export is a function that takes a glob pattern and an options object and returns a function for matching strings.
|
||||
|
||||
```js
|
||||
const pm = require('picomatch');
|
||||
const isMatch = pm('*.js');
|
||||
|
||||
console.log(isMatch('abcd')); //=> false
|
||||
console.log(isMatch('a.js')); //=> true
|
||||
console.log(isMatch('a.md')); //=> false
|
||||
console.log(isMatch('a/b.js')); //=> false
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## API
|
||||
|
||||
### [picomatch](lib/picomatch.js#L32)
|
||||
|
||||
Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information.
|
||||
|
||||
**Params**
|
||||
|
||||
* `globs` **{String|Array}**: One or more glob patterns.
|
||||
* `options` **{Object=}**
|
||||
* `returns` **{Function=}**: Returns a matcher function.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch(glob[, options]);
|
||||
|
||||
const isMatch = picomatch('*.!(*a)');
|
||||
console.log(isMatch('a.a')); //=> false
|
||||
console.log(isMatch('a.b')); //=> true
|
||||
```
|
||||
|
||||
### [.test](lib/picomatch.js#L117)
|
||||
|
||||
Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: String to test.
|
||||
* `regex` **{RegExp}**
|
||||
* `returns` **{Object}**: Returns an object with matching info.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.test(input, regex[, options]);
|
||||
|
||||
console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
||||
// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
||||
```
|
||||
|
||||
### [.matchBase](lib/picomatch.js#L161)
|
||||
|
||||
Match the basename of a filepath.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: String to test.
|
||||
* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe).
|
||||
* `returns` **{Boolean}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.matchBase(input, glob[, options]);
|
||||
console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
||||
```
|
||||
|
||||
### [.isMatch](lib/picomatch.js#L183)
|
||||
|
||||
Returns true if **any** of the given glob `patterns` match the specified `string`.
|
||||
|
||||
**Params**
|
||||
|
||||
* **{String|Array}**: str The string to test.
|
||||
* **{String|Array}**: patterns One or more glob patterns to use for matching.
|
||||
* **{Object}**: See available [options](#options).
|
||||
* `returns` **{Boolean}**: Returns true if any patterns match `str`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.isMatch(string, patterns[, options]);
|
||||
|
||||
console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
||||
console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
||||
```
|
||||
|
||||
### [.parse](lib/picomatch.js#L199)
|
||||
|
||||
Parse a glob pattern to create the source string for a regular expression.
|
||||
|
||||
**Params**
|
||||
|
||||
* `pattern` **{String}**
|
||||
* `options` **{Object}**
|
||||
* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
const result = picomatch.parse(pattern[, options]);
|
||||
```
|
||||
|
||||
### [.scan](lib/picomatch.js#L231)
|
||||
|
||||
Scan a glob pattern to separate the pattern into segments.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: Glob pattern to scan.
|
||||
* `options` **{Object}**
|
||||
* `returns` **{Object}**: Returns an object with
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.scan(input[, options]);
|
||||
|
||||
const result = picomatch.scan('!./foo/*.js');
|
||||
console.log(result);
|
||||
{ prefix: '!./',
|
||||
input: '!./foo/*.js',
|
||||
start: 3,
|
||||
base: 'foo',
|
||||
glob: '*.js',
|
||||
isBrace: false,
|
||||
isBracket: false,
|
||||
isGlob: true,
|
||||
isExtglob: false,
|
||||
isGlobstar: false,
|
||||
negated: true }
|
||||
```
|
||||
|
||||
### [.compileRe](lib/picomatch.js#L245)
|
||||
|
||||
Compile a regular expression from the `state` object returned by the
|
||||
[parse()](#parse) method.
|
||||
|
||||
**Params**
|
||||
|
||||
* `state` **{Object}**
|
||||
* `options` **{Object}**
|
||||
* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser.
|
||||
* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
||||
* `returns` **{RegExp}**
|
||||
|
||||
### [.makeRe](lib/picomatch.js#L286)
|
||||
|
||||
Create a regular expression from a parsed glob pattern.
|
||||
|
||||
**Params**
|
||||
|
||||
* `state` **{String}**: The object returned from the `.parse` method.
|
||||
* `options` **{Object}**
|
||||
* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
||||
* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
||||
* `returns` **{RegExp}**: Returns a regex created from the given pattern.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
const state = picomatch.parse('*.js');
|
||||
// picomatch.compileRe(state[, options]);
|
||||
|
||||
console.log(picomatch.compileRe(state));
|
||||
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
```
|
||||
|
||||
### [.toRegex](lib/picomatch.js#L321)
|
||||
|
||||
Create a regular expression from the given regex source string.
|
||||
|
||||
**Params**
|
||||
|
||||
* `source` **{String}**: Regular expression source string.
|
||||
* `options` **{Object}**
|
||||
* `returns` **{RegExp}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.toRegex(source[, options]);
|
||||
|
||||
const { output } = picomatch.parse('*.js');
|
||||
console.log(picomatch.toRegex(output));
|
||||
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Options
|
||||
|
||||
### Picomatch options
|
||||
|
||||
The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API.
|
||||
|
||||
| **Option** | **Type** | **Default value** | **Description** |
|
||||
| --- | --- | --- | --- |
|
||||
| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. |
|
||||
| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). |
|
||||
| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. |
|
||||
| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). |
|
||||
| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` |
|
||||
| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. |
|
||||
| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true |
|
||||
| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. |
|
||||
| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. |
|
||||
| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. |
|
||||
| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. |
|
||||
| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. |
|
||||
| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. |
|
||||
| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. |
|
||||
| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. |
|
||||
| `matchBase` | `boolean` | `false` | Alias for `basename` |
|
||||
| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. |
|
||||
| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. |
|
||||
| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. |
|
||||
| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. |
|
||||
| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. |
|
||||
| `noext` | `boolean` | `false` | Alias for `noextglob` |
|
||||
| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) |
|
||||
| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) |
|
||||
| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` |
|
||||
| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. |
|
||||
| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. |
|
||||
| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. |
|
||||
| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. |
|
||||
| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). |
|
||||
| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself |
|
||||
| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. |
|
||||
| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). |
|
||||
| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. |
|
||||
| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. |
|
||||
| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. |
|
||||
| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. |
|
||||
|
||||
picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error.
|
||||
|
||||
### Scan Options
|
||||
|
||||
In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method.
|
||||
|
||||
| **Option** | **Type** | **Default value** | **Description** |
|
||||
| --- | --- | --- | --- |
|
||||
| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern |
|
||||
| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
const result = picomatch.scan('!./foo/*.js', { tokens: true });
|
||||
console.log(result);
|
||||
// {
|
||||
// prefix: '!./',
|
||||
// input: '!./foo/*.js',
|
||||
// start: 3,
|
||||
// base: 'foo',
|
||||
// glob: '*.js',
|
||||
// isBrace: false,
|
||||
// isBracket: false,
|
||||
// isGlob: true,
|
||||
// isExtglob: false,
|
||||
// isGlobstar: false,
|
||||
// negated: true,
|
||||
// maxDepth: 2,
|
||||
// tokens: [
|
||||
// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true },
|
||||
// { value: 'foo', depth: 1, isGlob: false },
|
||||
// { value: '*.js', depth: 1, isGlob: true }
|
||||
// ],
|
||||
// slashes: [ 2, 6 ],
|
||||
// parts: [ 'foo', '*.js' ]
|
||||
// }
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### Options Examples
|
||||
|
||||
#### options.expandRange
|
||||
|
||||
**Type**: `function`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need.
|
||||
|
||||
**Example**
|
||||
|
||||
The following example shows how to create a glob that matches a folder
|
||||
|
||||
```js
|
||||
const fill = require('fill-range');
|
||||
const regex = pm.makeRe('foo/{01..25}/bar', {
|
||||
expandRange(a, b) {
|
||||
return `(${fill(a, b, { toRegex: true })})`;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(regex);
|
||||
//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/
|
||||
|
||||
console.log(regex.test('foo/00/bar')) // false
|
||||
console.log(regex.test('foo/01/bar')) // true
|
||||
console.log(regex.test('foo/10/bar')) // true
|
||||
console.log(regex.test('foo/22/bar')) // true
|
||||
console.log(regex.test('foo/25/bar')) // true
|
||||
console.log(regex.test('foo/26/bar')) // false
|
||||
```
|
||||
|
||||
#### options.format
|
||||
|
||||
**Type**: `function`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
Custom function for formatting strings before they're matched.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
// strip leading './' from strings
|
||||
const format = str => str.replace(/^\.\//, '');
|
||||
const isMatch = picomatch('foo/*.js', { format });
|
||||
console.log(isMatch('./foo/bar.js')); //=> true
|
||||
```
|
||||
|
||||
#### options.onMatch
|
||||
|
||||
```js
|
||||
const onMatch = ({ glob, regex, input, output }) => {
|
||||
console.log({ glob, regex, input, output });
|
||||
};
|
||||
|
||||
const isMatch = picomatch('*', { onMatch });
|
||||
isMatch('foo');
|
||||
isMatch('bar');
|
||||
isMatch('baz');
|
||||
```
|
||||
|
||||
#### options.onIgnore
|
||||
|
||||
```js
|
||||
const onIgnore = ({ glob, regex, input, output }) => {
|
||||
console.log({ glob, regex, input, output });
|
||||
};
|
||||
|
||||
const isMatch = picomatch('*', { onIgnore, ignore: 'f*' });
|
||||
isMatch('foo');
|
||||
isMatch('bar');
|
||||
isMatch('baz');
|
||||
```
|
||||
|
||||
#### options.onResult
|
||||
|
||||
```js
|
||||
const onResult = ({ glob, regex, input, output }) => {
|
||||
console.log({ glob, regex, input, output });
|
||||
};
|
||||
|
||||
const isMatch = picomatch('*', { onResult, ignore: 'f*' });
|
||||
isMatch('foo');
|
||||
isMatch('bar');
|
||||
isMatch('baz');
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Globbing features
|
||||
|
||||
* [Basic globbing](#basic-globbing) (Wildcard matching)
|
||||
* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching)
|
||||
|
||||
### Basic globbing
|
||||
|
||||
| **Character** | **Description** |
|
||||
| --- | --- |
|
||||
| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. |
|
||||
| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. |
|
||||
| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. |
|
||||
| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. |
|
||||
|
||||
#### Matching behavior vs. Bash
|
||||
|
||||
Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions:
|
||||
|
||||
* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`.
|
||||
* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`.
|
||||
|
||||
<br>
|
||||
|
||||
### Advanced globbing
|
||||
|
||||
* [extglobs](#extglobs)
|
||||
* [POSIX brackets](#posix-brackets)
|
||||
* [Braces](#brace-expansion)
|
||||
|
||||
#### Extglobs
|
||||
|
||||
| **Pattern** | **Description** |
|
||||
| --- | --- |
|
||||
| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` |
|
||||
| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` |
|
||||
| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` |
|
||||
| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` |
|
||||
| `!(pattern)` | Match _anything but_ `pattern` |
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const pm = require('picomatch');
|
||||
|
||||
// *(pattern) matches ZERO or more of "pattern"
|
||||
console.log(pm.isMatch('a', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('az', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('azzz', 'a*(z)')); // true
|
||||
|
||||
// +(pattern) matches ONE or more of "pattern"
|
||||
console.log(pm.isMatch('a', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('az', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('azzz', 'a*(z)')); // true
|
||||
|
||||
// supports multiple extglobs
|
||||
console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false
|
||||
|
||||
// supports nested extglobs
|
||||
console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true
|
||||
```
|
||||
|
||||
#### POSIX brackets
|
||||
|
||||
POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true.
|
||||
|
||||
**Enable POSIX bracket support**
|
||||
|
||||
```js
|
||||
console.log(pm.makeRe('[[:word:]]+', { posix: true }));
|
||||
//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/
|
||||
```
|
||||
|
||||
**Supported POSIX classes**
|
||||
|
||||
The following named POSIX bracket expressions are supported:
|
||||
|
||||
* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]`
|
||||
* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`.
|
||||
* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`.
|
||||
* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`.
|
||||
* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`.
|
||||
* `[:digit:]` - Numerical digits, equivalent to `[0-9]`.
|
||||
* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`.
|
||||
* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`.
|
||||
* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`.
|
||||
* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`.
|
||||
* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`.
|
||||
* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`.
|
||||
* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`.
|
||||
* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`.
|
||||
|
||||
See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information.
|
||||
|
||||
### Braces
|
||||
|
||||
Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces.
|
||||
|
||||
### Matching special characters as literals
|
||||
|
||||
If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes:
|
||||
|
||||
**Special Characters**
|
||||
|
||||
Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms.
|
||||
|
||||
To match any of the following characters as literals: `$^*+?()[]
|
||||
|
||||
Examples:
|
||||
|
||||
```js
|
||||
console.log(pm.makeRe('foo/bar \\(1\\)'));
|
||||
console.log(pm.makeRe('foo/bar \\(1\\)'));
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Library Comparisons
|
||||
|
||||
The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets).
|
||||
|
||||
| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - |
|
||||
| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - |
|
||||
| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - |
|
||||
| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - |
|
||||
| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - |
|
||||
| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ |
|
||||
| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ |
|
||||
| File system operations | - | - | - | - | - | - | - |
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Benchmarks
|
||||
|
||||
Performance comparison of picomatch and minimatch.
|
||||
|
||||
```
|
||||
# .makeRe star
|
||||
picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled)
|
||||
minimatch x 627,206 ops/sec ±1.96% (87 runs sampled))
|
||||
|
||||
# .makeRe star; dot=true
|
||||
picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled)
|
||||
minimatch x 525,876 ops/sec ±0.60% (88 runs sampled)
|
||||
|
||||
# .makeRe globstar
|
||||
picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled)
|
||||
minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d)
|
||||
|
||||
# .makeRe globstars
|
||||
picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled)
|
||||
minimatch x 477,179 ops/sec ±1.33% (91 runs sampled)
|
||||
|
||||
# .makeRe with leading star
|
||||
picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled)
|
||||
minimatch x 453,564 ops/sec ±1.43% (94 runs sampled)
|
||||
|
||||
# .makeRe - basic braces
|
||||
picomatch x 392,067 ops/sec ±0.70% (90 runs sampled)
|
||||
minimatch x 99,532 ops/sec ±2.03% (87 runs sampled))
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Philosophies
|
||||
|
||||
The goal of this library is to be blazing fast, without compromising on accuracy.
|
||||
|
||||
**Accuracy**
|
||||
|
||||
The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`.
|
||||
|
||||
Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements.
|
||||
|
||||
**Performance**
|
||||
|
||||
Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer.
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
3
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/index.js
generated
vendored
Normal file
3
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = require('./lib/picomatch');
|
||||
179
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/constants.js
generated
vendored
Normal file
179
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/constants.js
generated
vendored
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const WIN_SLASH = '\\\\/';
|
||||
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
||||
|
||||
/**
|
||||
* Posix glob regex
|
||||
*/
|
||||
|
||||
const DOT_LITERAL = '\\.';
|
||||
const PLUS_LITERAL = '\\+';
|
||||
const QMARK_LITERAL = '\\?';
|
||||
const SLASH_LITERAL = '\\/';
|
||||
const ONE_CHAR = '(?=.)';
|
||||
const QMARK = '[^/]';
|
||||
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
||||
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
||||
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
||||
const NO_DOT = `(?!${DOT_LITERAL})`;
|
||||
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
||||
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
||||
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
||||
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
||||
const STAR = `${QMARK}*?`;
|
||||
|
||||
const POSIX_CHARS = {
|
||||
DOT_LITERAL,
|
||||
PLUS_LITERAL,
|
||||
QMARK_LITERAL,
|
||||
SLASH_LITERAL,
|
||||
ONE_CHAR,
|
||||
QMARK,
|
||||
END_ANCHOR,
|
||||
DOTS_SLASH,
|
||||
NO_DOT,
|
||||
NO_DOTS,
|
||||
NO_DOT_SLASH,
|
||||
NO_DOTS_SLASH,
|
||||
QMARK_NO_DOT,
|
||||
STAR,
|
||||
START_ANCHOR
|
||||
};
|
||||
|
||||
/**
|
||||
* Windows glob regex
|
||||
*/
|
||||
|
||||
const WINDOWS_CHARS = {
|
||||
...POSIX_CHARS,
|
||||
|
||||
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
||||
QMARK: WIN_NO_SLASH,
|
||||
STAR: `${WIN_NO_SLASH}*?`,
|
||||
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
||||
NO_DOT: `(?!${DOT_LITERAL})`,
|
||||
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
||||
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
||||
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
||||
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
||||
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
||||
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
||||
};
|
||||
|
||||
/**
|
||||
* POSIX Bracket Regex
|
||||
*/
|
||||
|
||||
const POSIX_REGEX_SOURCE = {
|
||||
alnum: 'a-zA-Z0-9',
|
||||
alpha: 'a-zA-Z',
|
||||
ascii: '\\x00-\\x7F',
|
||||
blank: ' \\t',
|
||||
cntrl: '\\x00-\\x1F\\x7F',
|
||||
digit: '0-9',
|
||||
graph: '\\x21-\\x7E',
|
||||
lower: 'a-z',
|
||||
print: '\\x20-\\x7E ',
|
||||
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
||||
space: ' \\t\\r\\n\\v\\f',
|
||||
upper: 'A-Z',
|
||||
word: 'A-Za-z0-9_',
|
||||
xdigit: 'A-Fa-f0-9'
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
MAX_LENGTH: 1024 * 64,
|
||||
POSIX_REGEX_SOURCE,
|
||||
|
||||
// regular expressions
|
||||
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
||||
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
||||
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
||||
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
||||
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
||||
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
||||
|
||||
// Replace globs with equivalent patterns to reduce parsing time.
|
||||
REPLACEMENTS: {
|
||||
'***': '*',
|
||||
'**/**': '**',
|
||||
'**/**/**': '**'
|
||||
},
|
||||
|
||||
// Digits
|
||||
CHAR_0: 48, /* 0 */
|
||||
CHAR_9: 57, /* 9 */
|
||||
|
||||
// Alphabet chars.
|
||||
CHAR_UPPERCASE_A: 65, /* A */
|
||||
CHAR_LOWERCASE_A: 97, /* a */
|
||||
CHAR_UPPERCASE_Z: 90, /* Z */
|
||||
CHAR_LOWERCASE_Z: 122, /* z */
|
||||
|
||||
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
||||
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
||||
|
||||
CHAR_ASTERISK: 42, /* * */
|
||||
|
||||
// Non-alphabetic chars.
|
||||
CHAR_AMPERSAND: 38, /* & */
|
||||
CHAR_AT: 64, /* @ */
|
||||
CHAR_BACKWARD_SLASH: 92, /* \ */
|
||||
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
||||
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
||||
CHAR_COLON: 58, /* : */
|
||||
CHAR_COMMA: 44, /* , */
|
||||
CHAR_DOT: 46, /* . */
|
||||
CHAR_DOUBLE_QUOTE: 34, /* " */
|
||||
CHAR_EQUAL: 61, /* = */
|
||||
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
||||
CHAR_FORM_FEED: 12, /* \f */
|
||||
CHAR_FORWARD_SLASH: 47, /* / */
|
||||
CHAR_GRAVE_ACCENT: 96, /* ` */
|
||||
CHAR_HASH: 35, /* # */
|
||||
CHAR_HYPHEN_MINUS: 45, /* - */
|
||||
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
||||
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
||||
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
||||
CHAR_LINE_FEED: 10, /* \n */
|
||||
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
||||
CHAR_PERCENT: 37, /* % */
|
||||
CHAR_PLUS: 43, /* + */
|
||||
CHAR_QUESTION_MARK: 63, /* ? */
|
||||
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
||||
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
||||
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
||||
CHAR_SEMICOLON: 59, /* ; */
|
||||
CHAR_SINGLE_QUOTE: 39, /* ' */
|
||||
CHAR_SPACE: 32, /* */
|
||||
CHAR_TAB: 9, /* \t */
|
||||
CHAR_UNDERSCORE: 95, /* _ */
|
||||
CHAR_VERTICAL_LINE: 124, /* | */
|
||||
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
||||
|
||||
SEP: path.sep,
|
||||
|
||||
/**
|
||||
* Create EXTGLOB_CHARS
|
||||
*/
|
||||
|
||||
extglobChars(chars) {
|
||||
return {
|
||||
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
||||
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
||||
'+': { type: 'plus', open: '(?:', close: ')+' },
|
||||
'*': { type: 'star', open: '(?:', close: ')*' },
|
||||
'@': { type: 'at', open: '(?:', close: ')' }
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Create GLOB_CHARS
|
||||
*/
|
||||
|
||||
globChars(win32) {
|
||||
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
||||
}
|
||||
};
|
||||
1091
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/parse.js
generated
vendored
Normal file
1091
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/parse.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
342
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/picomatch.js
generated
vendored
Normal file
342
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/picomatch.js
generated
vendored
Normal file
|
|
@ -0,0 +1,342 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const scan = require('./scan');
|
||||
const parse = require('./parse');
|
||||
const utils = require('./utils');
|
||||
const constants = require('./constants');
|
||||
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
||||
|
||||
/**
|
||||
* Creates a matcher function from one or more glob patterns. The
|
||||
* returned function takes a string to match as its first argument,
|
||||
* and returns true if the string is a match. The returned matcher
|
||||
* function also takes a boolean as the second argument that, when true,
|
||||
* returns an object with additional information.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch(glob[, options]);
|
||||
*
|
||||
* const isMatch = picomatch('*.!(*a)');
|
||||
* console.log(isMatch('a.a')); //=> false
|
||||
* console.log(isMatch('a.b')); //=> true
|
||||
* ```
|
||||
* @name picomatch
|
||||
* @param {String|Array} `globs` One or more glob patterns.
|
||||
* @param {Object=} `options`
|
||||
* @return {Function=} Returns a matcher function.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
const picomatch = (glob, options, returnState = false) => {
|
||||
if (Array.isArray(glob)) {
|
||||
const fns = glob.map(input => picomatch(input, options, returnState));
|
||||
const arrayMatcher = str => {
|
||||
for (const isMatch of fns) {
|
||||
const state = isMatch(str);
|
||||
if (state) return state;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
return arrayMatcher;
|
||||
}
|
||||
|
||||
const isState = isObject(glob) && glob.tokens && glob.input;
|
||||
|
||||
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
||||
throw new TypeError('Expected pattern to be a non-empty string');
|
||||
}
|
||||
|
||||
const opts = options || {};
|
||||
const posix = utils.isWindows(options);
|
||||
const regex = isState
|
||||
? picomatch.compileRe(glob, options)
|
||||
: picomatch.makeRe(glob, options, false, true);
|
||||
|
||||
const state = regex.state;
|
||||
delete regex.state;
|
||||
|
||||
let isIgnored = () => false;
|
||||
if (opts.ignore) {
|
||||
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
||||
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
||||
}
|
||||
|
||||
const matcher = (input, returnObject = false) => {
|
||||
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
||||
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
||||
|
||||
if (typeof opts.onResult === 'function') {
|
||||
opts.onResult(result);
|
||||
}
|
||||
|
||||
if (isMatch === false) {
|
||||
result.isMatch = false;
|
||||
return returnObject ? result : false;
|
||||
}
|
||||
|
||||
if (isIgnored(input)) {
|
||||
if (typeof opts.onIgnore === 'function') {
|
||||
opts.onIgnore(result);
|
||||
}
|
||||
result.isMatch = false;
|
||||
return returnObject ? result : false;
|
||||
}
|
||||
|
||||
if (typeof opts.onMatch === 'function') {
|
||||
opts.onMatch(result);
|
||||
}
|
||||
return returnObject ? result : true;
|
||||
};
|
||||
|
||||
if (returnState) {
|
||||
matcher.state = state;
|
||||
}
|
||||
|
||||
return matcher;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test `input` with the given `regex`. This is used by the main
|
||||
* `picomatch()` function to test the input string.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.test(input, regex[, options]);
|
||||
*
|
||||
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
||||
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
||||
* ```
|
||||
* @param {String} `input` String to test.
|
||||
* @param {RegExp} `regex`
|
||||
* @return {Object} Returns an object with matching info.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
||||
if (typeof input !== 'string') {
|
||||
throw new TypeError('Expected input to be a string');
|
||||
}
|
||||
|
||||
if (input === '') {
|
||||
return { isMatch: false, output: '' };
|
||||
}
|
||||
|
||||
const opts = options || {};
|
||||
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
||||
let match = input === glob;
|
||||
let output = (match && format) ? format(input) : input;
|
||||
|
||||
if (match === false) {
|
||||
output = format ? format(input) : input;
|
||||
match = output === glob;
|
||||
}
|
||||
|
||||
if (match === false || opts.capture === true) {
|
||||
if (opts.matchBase === true || opts.basename === true) {
|
||||
match = picomatch.matchBase(input, regex, options, posix);
|
||||
} else {
|
||||
match = regex.exec(output);
|
||||
}
|
||||
}
|
||||
|
||||
return { isMatch: Boolean(match), match, output };
|
||||
};
|
||||
|
||||
/**
|
||||
* Match the basename of a filepath.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.matchBase(input, glob[, options]);
|
||||
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
||||
* ```
|
||||
* @param {String} `input` String to test.
|
||||
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
||||
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
||||
return regex.test(path.basename(input));
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.isMatch(string, patterns[, options]);
|
||||
*
|
||||
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
||||
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
||||
* ```
|
||||
* @param {String|Array} str The string to test.
|
||||
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
||||
* @param {Object} [options] See available [options](#options).
|
||||
* @return {Boolean} Returns true if any patterns match `str`
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
||||
|
||||
/**
|
||||
* Parse a glob pattern to create the source string for a regular
|
||||
* expression.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* const result = picomatch.parse(pattern[, options]);
|
||||
* ```
|
||||
* @param {String} `pattern`
|
||||
* @param {Object} `options`
|
||||
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.parse = (pattern, options) => {
|
||||
if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
|
||||
return parse(pattern, { ...options, fastpaths: false });
|
||||
};
|
||||
|
||||
/**
|
||||
* Scan a glob pattern to separate the pattern into segments.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.scan(input[, options]);
|
||||
*
|
||||
* const result = picomatch.scan('!./foo/*.js');
|
||||
* console.log(result);
|
||||
* { prefix: '!./',
|
||||
* input: '!./foo/*.js',
|
||||
* start: 3,
|
||||
* base: 'foo',
|
||||
* glob: '*.js',
|
||||
* isBrace: false,
|
||||
* isBracket: false,
|
||||
* isGlob: true,
|
||||
* isExtglob: false,
|
||||
* isGlobstar: false,
|
||||
* negated: true }
|
||||
* ```
|
||||
* @param {String} `input` Glob pattern to scan.
|
||||
* @param {Object} `options`
|
||||
* @return {Object} Returns an object with
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.scan = (input, options) => scan(input, options);
|
||||
|
||||
/**
|
||||
* Compile a regular expression from the `state` object returned by the
|
||||
* [parse()](#parse) method.
|
||||
*
|
||||
* @param {Object} `state`
|
||||
* @param {Object} `options`
|
||||
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
||||
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
||||
* @return {RegExp}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
||||
if (returnOutput === true) {
|
||||
return state.output;
|
||||
}
|
||||
|
||||
const opts = options || {};
|
||||
const prepend = opts.contains ? '' : '^';
|
||||
const append = opts.contains ? '' : '$';
|
||||
|
||||
let source = `${prepend}(?:${state.output})${append}`;
|
||||
if (state && state.negated === true) {
|
||||
source = `^(?!${source}).*$`;
|
||||
}
|
||||
|
||||
const regex = picomatch.toRegex(source, options);
|
||||
if (returnState === true) {
|
||||
regex.state = state;
|
||||
}
|
||||
|
||||
return regex;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a regular expression from a parsed glob pattern.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* const state = picomatch.parse('*.js');
|
||||
* // picomatch.compileRe(state[, options]);
|
||||
*
|
||||
* console.log(picomatch.compileRe(state));
|
||||
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
* ```
|
||||
* @param {String} `state` The object returned from the `.parse` method.
|
||||
* @param {Object} `options`
|
||||
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
||||
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
||||
* @return {RegExp} Returns a regex created from the given pattern.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
||||
if (!input || typeof input !== 'string') {
|
||||
throw new TypeError('Expected a non-empty string');
|
||||
}
|
||||
|
||||
let parsed = { negated: false, fastpaths: true };
|
||||
|
||||
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
||||
parsed.output = parse.fastpaths(input, options);
|
||||
}
|
||||
|
||||
if (!parsed.output) {
|
||||
parsed = parse(input, options);
|
||||
}
|
||||
|
||||
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a regular expression from the given regex source string.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.toRegex(source[, options]);
|
||||
*
|
||||
* const { output } = picomatch.parse('*.js');
|
||||
* console.log(picomatch.toRegex(output));
|
||||
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
* ```
|
||||
* @param {String} `source` Regular expression source string.
|
||||
* @param {Object} `options`
|
||||
* @return {RegExp}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.toRegex = (source, options) => {
|
||||
try {
|
||||
const opts = options || {};
|
||||
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
||||
} catch (err) {
|
||||
if (options && options.debug === true) throw err;
|
||||
return /$^/;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Picomatch constants.
|
||||
* @return {Object}
|
||||
*/
|
||||
|
||||
picomatch.constants = constants;
|
||||
|
||||
/**
|
||||
* Expose "picomatch"
|
||||
*/
|
||||
|
||||
module.exports = picomatch;
|
||||
391
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/scan.js
generated
vendored
Normal file
391
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/scan.js
generated
vendored
Normal file
|
|
@ -0,0 +1,391 @@
|
|||
'use strict';
|
||||
|
||||
const utils = require('./utils');
|
||||
const {
|
||||
CHAR_ASTERISK, /* * */
|
||||
CHAR_AT, /* @ */
|
||||
CHAR_BACKWARD_SLASH, /* \ */
|
||||
CHAR_COMMA, /* , */
|
||||
CHAR_DOT, /* . */
|
||||
CHAR_EXCLAMATION_MARK, /* ! */
|
||||
CHAR_FORWARD_SLASH, /* / */
|
||||
CHAR_LEFT_CURLY_BRACE, /* { */
|
||||
CHAR_LEFT_PARENTHESES, /* ( */
|
||||
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
||||
CHAR_PLUS, /* + */
|
||||
CHAR_QUESTION_MARK, /* ? */
|
||||
CHAR_RIGHT_CURLY_BRACE, /* } */
|
||||
CHAR_RIGHT_PARENTHESES, /* ) */
|
||||
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
||||
} = require('./constants');
|
||||
|
||||
const isPathSeparator = code => {
|
||||
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
||||
};
|
||||
|
||||
const depth = token => {
|
||||
if (token.isPrefix !== true) {
|
||||
token.depth = token.isGlobstar ? Infinity : 1;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Quickly scans a glob pattern and returns an object with a handful of
|
||||
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
||||
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
||||
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
||||
*
|
||||
* ```js
|
||||
* const pm = require('picomatch');
|
||||
* console.log(pm.scan('foo/bar/*.js'));
|
||||
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
||||
* ```
|
||||
* @param {String} `str`
|
||||
* @param {Object} `options`
|
||||
* @return {Object} Returns an object with tokens and regex source string.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
const scan = (input, options) => {
|
||||
const opts = options || {};
|
||||
|
||||
const length = input.length - 1;
|
||||
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
||||
const slashes = [];
|
||||
const tokens = [];
|
||||
const parts = [];
|
||||
|
||||
let str = input;
|
||||
let index = -1;
|
||||
let start = 0;
|
||||
let lastIndex = 0;
|
||||
let isBrace = false;
|
||||
let isBracket = false;
|
||||
let isGlob = false;
|
||||
let isExtglob = false;
|
||||
let isGlobstar = false;
|
||||
let braceEscaped = false;
|
||||
let backslashes = false;
|
||||
let negated = false;
|
||||
let negatedExtglob = false;
|
||||
let finished = false;
|
||||
let braces = 0;
|
||||
let prev;
|
||||
let code;
|
||||
let token = { value: '', depth: 0, isGlob: false };
|
||||
|
||||
const eos = () => index >= length;
|
||||
const peek = () => str.charCodeAt(index + 1);
|
||||
const advance = () => {
|
||||
prev = code;
|
||||
return str.charCodeAt(++index);
|
||||
};
|
||||
|
||||
while (index < length) {
|
||||
code = advance();
|
||||
let next;
|
||||
|
||||
if (code === CHAR_BACKWARD_SLASH) {
|
||||
backslashes = token.backslashes = true;
|
||||
code = advance();
|
||||
|
||||
if (code === CHAR_LEFT_CURLY_BRACE) {
|
||||
braceEscaped = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
||||
braces++;
|
||||
|
||||
while (eos() !== true && (code = advance())) {
|
||||
if (code === CHAR_BACKWARD_SLASH) {
|
||||
backslashes = token.backslashes = true;
|
||||
advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (code === CHAR_LEFT_CURLY_BRACE) {
|
||||
braces++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
||||
isBrace = token.isBrace = true;
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (braceEscaped !== true && code === CHAR_COMMA) {
|
||||
isBrace = token.isBrace = true;
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
||||
braces--;
|
||||
|
||||
if (braces === 0) {
|
||||
braceEscaped = false;
|
||||
isBrace = token.isBrace = true;
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (code === CHAR_FORWARD_SLASH) {
|
||||
slashes.push(index);
|
||||
tokens.push(token);
|
||||
token = { value: '', depth: 0, isGlob: false };
|
||||
|
||||
if (finished === true) continue;
|
||||
if (prev === CHAR_DOT && index === (start + 1)) {
|
||||
start += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
lastIndex = index + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (opts.noext !== true) {
|
||||
const isExtglobChar = code === CHAR_PLUS
|
||||
|| code === CHAR_AT
|
||||
|| code === CHAR_ASTERISK
|
||||
|| code === CHAR_QUESTION_MARK
|
||||
|| code === CHAR_EXCLAMATION_MARK;
|
||||
|
||||
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
||||
isGlob = token.isGlob = true;
|
||||
isExtglob = token.isExtglob = true;
|
||||
finished = true;
|
||||
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
||||
negatedExtglob = true;
|
||||
}
|
||||
|
||||
if (scanToEnd === true) {
|
||||
while (eos() !== true && (code = advance())) {
|
||||
if (code === CHAR_BACKWARD_SLASH) {
|
||||
backslashes = token.backslashes = true;
|
||||
code = advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (code === CHAR_RIGHT_PARENTHESES) {
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (code === CHAR_ASTERISK) {
|
||||
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (code === CHAR_QUESTION_MARK) {
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
||||
while (eos() !== true && (next = advance())) {
|
||||
if (next === CHAR_BACKWARD_SLASH) {
|
||||
backslashes = token.backslashes = true;
|
||||
advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
||||
isBracket = token.isBracket = true;
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
||||
negated = token.negated = true;
|
||||
start++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
||||
isGlob = token.isGlob = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
while (eos() !== true && (code = advance())) {
|
||||
if (code === CHAR_LEFT_PARENTHESES) {
|
||||
backslashes = token.backslashes = true;
|
||||
code = advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (code === CHAR_RIGHT_PARENTHESES) {
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (isGlob === true) {
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.noext === true) {
|
||||
isExtglob = false;
|
||||
isGlob = false;
|
||||
}
|
||||
|
||||
let base = str;
|
||||
let prefix = '';
|
||||
let glob = '';
|
||||
|
||||
if (start > 0) {
|
||||
prefix = str.slice(0, start);
|
||||
str = str.slice(start);
|
||||
lastIndex -= start;
|
||||
}
|
||||
|
||||
if (base && isGlob === true && lastIndex > 0) {
|
||||
base = str.slice(0, lastIndex);
|
||||
glob = str.slice(lastIndex);
|
||||
} else if (isGlob === true) {
|
||||
base = '';
|
||||
glob = str;
|
||||
} else {
|
||||
base = str;
|
||||
}
|
||||
|
||||
if (base && base !== '' && base !== '/' && base !== str) {
|
||||
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
||||
base = base.slice(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.unescape === true) {
|
||||
if (glob) glob = utils.removeBackslashes(glob);
|
||||
|
||||
if (base && backslashes === true) {
|
||||
base = utils.removeBackslashes(base);
|
||||
}
|
||||
}
|
||||
|
||||
const state = {
|
||||
prefix,
|
||||
input,
|
||||
start,
|
||||
base,
|
||||
glob,
|
||||
isBrace,
|
||||
isBracket,
|
||||
isGlob,
|
||||
isExtglob,
|
||||
isGlobstar,
|
||||
negated,
|
||||
negatedExtglob
|
||||
};
|
||||
|
||||
if (opts.tokens === true) {
|
||||
state.maxDepth = 0;
|
||||
if (!isPathSeparator(code)) {
|
||||
tokens.push(token);
|
||||
}
|
||||
state.tokens = tokens;
|
||||
}
|
||||
|
||||
if (opts.parts === true || opts.tokens === true) {
|
||||
let prevIndex;
|
||||
|
||||
for (let idx = 0; idx < slashes.length; idx++) {
|
||||
const n = prevIndex ? prevIndex + 1 : start;
|
||||
const i = slashes[idx];
|
||||
const value = input.slice(n, i);
|
||||
if (opts.tokens) {
|
||||
if (idx === 0 && start !== 0) {
|
||||
tokens[idx].isPrefix = true;
|
||||
tokens[idx].value = prefix;
|
||||
} else {
|
||||
tokens[idx].value = value;
|
||||
}
|
||||
depth(tokens[idx]);
|
||||
state.maxDepth += tokens[idx].depth;
|
||||
}
|
||||
if (idx !== 0 || value !== '') {
|
||||
parts.push(value);
|
||||
}
|
||||
prevIndex = i;
|
||||
}
|
||||
|
||||
if (prevIndex && prevIndex + 1 < input.length) {
|
||||
const value = input.slice(prevIndex + 1);
|
||||
parts.push(value);
|
||||
|
||||
if (opts.tokens) {
|
||||
tokens[tokens.length - 1].value = value;
|
||||
depth(tokens[tokens.length - 1]);
|
||||
state.maxDepth += tokens[tokens.length - 1].depth;
|
||||
}
|
||||
}
|
||||
|
||||
state.slashes = slashes;
|
||||
state.parts = parts;
|
||||
}
|
||||
|
||||
return state;
|
||||
};
|
||||
|
||||
module.exports = scan;
|
||||
64
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/utils.js
generated
vendored
Normal file
64
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/lib/utils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const win32 = process.platform === 'win32';
|
||||
const {
|
||||
REGEX_BACKSLASH,
|
||||
REGEX_REMOVE_BACKSLASH,
|
||||
REGEX_SPECIAL_CHARS,
|
||||
REGEX_SPECIAL_CHARS_GLOBAL
|
||||
} = require('./constants');
|
||||
|
||||
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
||||
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
||||
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
||||
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
||||
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
||||
|
||||
exports.removeBackslashes = str => {
|
||||
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
||||
return match === '\\' ? '' : match;
|
||||
});
|
||||
};
|
||||
|
||||
exports.supportsLookbehinds = () => {
|
||||
const segs = process.version.slice(1).split('.').map(Number);
|
||||
if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.isWindows = options => {
|
||||
if (options && typeof options.windows === 'boolean') {
|
||||
return options.windows;
|
||||
}
|
||||
return win32 === true || path.sep === '\\';
|
||||
};
|
||||
|
||||
exports.escapeLast = (input, char, lastIdx) => {
|
||||
const idx = input.lastIndexOf(char, lastIdx);
|
||||
if (idx === -1) return input;
|
||||
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
||||
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
||||
};
|
||||
|
||||
exports.removePrefix = (input, state = {}) => {
|
||||
let output = input;
|
||||
if (output.startsWith('./')) {
|
||||
output = output.slice(2);
|
||||
state.prefix = './';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
exports.wrapOutput = (input, state = {}, options = {}) => {
|
||||
const prepend = options.contains ? '' : '^';
|
||||
const append = options.contains ? '' : '$';
|
||||
|
||||
let output = `${prepend}(?:${input})${append}`;
|
||||
if (state.negated === true) {
|
||||
output = `(?:^(?!${output}).*$)`;
|
||||
}
|
||||
return output;
|
||||
};
|
||||
81
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/package.json
generated
vendored
Normal file
81
Frontend-Learner/node_modules/tailwindcss/node_modules/picomatch/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"name": "picomatch",
|
||||
"description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.",
|
||||
"version": "2.3.1",
|
||||
"homepage": "https://github.com/micromatch/picomatch",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"funding": "https://github.com/sponsors/jonschlinkert",
|
||||
"repository": "micromatch/picomatch",
|
||||
"bugs": {
|
||||
"url": "https://github.com/micromatch/picomatch/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .",
|
||||
"mocha": "mocha --reporter dot",
|
||||
"test": "npm run lint && npm run mocha",
|
||||
"test:ci": "npm run test:cover",
|
||||
"test:cover": "nyc npm run mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.8.0",
|
||||
"fill-range": "^7.0.1",
|
||||
"gulp-format-md": "^2.0.0",
|
||||
"mocha": "^6.2.2",
|
||||
"nyc": "^15.0.0",
|
||||
"time-require": "github:jonschlinkert/time-require"
|
||||
},
|
||||
"keywords": [
|
||||
"glob",
|
||||
"match",
|
||||
"picomatch"
|
||||
],
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"html",
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"verb": {
|
||||
"toc": {
|
||||
"render": true,
|
||||
"method": "preWrite",
|
||||
"maxdepth": 3
|
||||
},
|
||||
"layout": "empty",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
},
|
||||
"related": {
|
||||
"list": [
|
||||
"braces",
|
||||
"micromatch"
|
||||
]
|
||||
},
|
||||
"reflinks": [
|
||||
"braces",
|
||||
"expand-brackets",
|
||||
"extglob",
|
||||
"fill-range",
|
||||
"micromatch",
|
||||
"minimatch",
|
||||
"nanomatch",
|
||||
"picomatch"
|
||||
]
|
||||
}
|
||||
}
|
||||
872
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/API.md
generated
vendored
Normal file
872
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/API.md
generated
vendored
Normal file
|
|
@ -0,0 +1,872 @@
|
|||
# API Documentation
|
||||
|
||||
*Please use only this documented API when working with the parser. Methods
|
||||
not documented here are subject to change at any point.*
|
||||
|
||||
## `parser` function
|
||||
|
||||
This is the module's main entry point.
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
```
|
||||
|
||||
### `parser([transform], [options])`
|
||||
|
||||
Creates a new `processor` instance
|
||||
|
||||
```js
|
||||
const processor = parser();
|
||||
```
|
||||
|
||||
Or, with optional transform function
|
||||
|
||||
```js
|
||||
const transform = selectors => {
|
||||
selectors.walkUniversals(selector => {
|
||||
selector.remove();
|
||||
});
|
||||
};
|
||||
|
||||
const processor = parser(transform)
|
||||
|
||||
// Example
|
||||
const result = processor.processSync('*.class');
|
||||
// => .class
|
||||
```
|
||||
|
||||
[See processor documentation](#processor)
|
||||
|
||||
Arguments:
|
||||
|
||||
* `transform (function)`: Provide a function to work with the parsed AST.
|
||||
* `options (object)`: Provide default options for all calls on the returned `Processor`.
|
||||
|
||||
### `parser.attribute([props])`
|
||||
|
||||
Creates a new attribute selector.
|
||||
|
||||
```js
|
||||
parser.attribute({attribute: 'href'});
|
||||
// => [href]
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.className([props])`
|
||||
|
||||
Creates a new class selector.
|
||||
|
||||
```js
|
||||
parser.className({value: 'button'});
|
||||
// => .button
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.combinator([props])`
|
||||
|
||||
Creates a new selector combinator.
|
||||
|
||||
```js
|
||||
parser.combinator({value: '+'});
|
||||
// => +
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
Notes:
|
||||
* **Descendant Combinators** The value of descendant combinators created by the
|
||||
parser always just a single space (`" "`). For descendant selectors with no
|
||||
comments, additional space is now stored in `node.spaces.before`. Depending
|
||||
on the location of comments, additional spaces may be stored in
|
||||
`node.raws.spaces.before`, `node.raws.spaces.after`, or `node.raws.value`.
|
||||
* **Named Combinators** Although, nonstandard and unlikely to ever become a standard,
|
||||
named combinators like `/deep/` and `/for/` are parsed as combinators. The
|
||||
`node.value` is name after being unescaped and normalized as lowercase. The
|
||||
original value for the combinator name is stored in `node.raws.value`.
|
||||
|
||||
|
||||
### `parser.comment([props])`
|
||||
|
||||
Creates a new comment.
|
||||
|
||||
```js
|
||||
parser.comment({value: '/* Affirmative, Dave. I read you. */'});
|
||||
// => /* Affirmative, Dave. I read you. */
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.id([props])`
|
||||
|
||||
Creates a new id selector.
|
||||
|
||||
```js
|
||||
parser.id({value: 'search'});
|
||||
// => #search
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.nesting([props])`
|
||||
|
||||
Creates a new nesting selector.
|
||||
|
||||
```js
|
||||
parser.nesting();
|
||||
// => &
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.pseudo([props])`
|
||||
|
||||
Creates a new pseudo selector.
|
||||
|
||||
```js
|
||||
parser.pseudo({value: '::before'});
|
||||
// => ::before
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.root([props])`
|
||||
|
||||
Creates a new root node.
|
||||
|
||||
```js
|
||||
parser.root();
|
||||
// => (empty)
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.selector([props])`
|
||||
|
||||
Creates a new selector node.
|
||||
|
||||
```js
|
||||
parser.selector();
|
||||
// => (empty)
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.string([props])`
|
||||
|
||||
Creates a new string node.
|
||||
|
||||
```js
|
||||
parser.string();
|
||||
// => (empty)
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.tag([props])`
|
||||
|
||||
Creates a new tag selector.
|
||||
|
||||
```js
|
||||
parser.tag({value: 'button'});
|
||||
// => button
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
### `parser.universal([props])`
|
||||
|
||||
Creates a new universal selector.
|
||||
|
||||
```js
|
||||
parser.universal();
|
||||
// => *
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `props (object)`: The new node's properties.
|
||||
|
||||
## Node types
|
||||
|
||||
### `node.type`
|
||||
|
||||
A string representation of the selector type. It can be one of the following;
|
||||
`attribute`, `class`, `combinator`, `comment`, `id`, `nesting`, `pseudo`,
|
||||
`root`, `selector`, `string`, `tag`, or `universal`. Note that for convenience,
|
||||
these constants are exposed on the main `parser` as uppercased keys. So for
|
||||
example you can get `id` by querying `parser.ID`.
|
||||
|
||||
```js
|
||||
parser.attribute({attribute: 'href'}).type;
|
||||
// => 'attribute'
|
||||
```
|
||||
|
||||
### `node.parent`
|
||||
|
||||
Returns the parent node.
|
||||
|
||||
```js
|
||||
root.nodes[0].parent === root;
|
||||
```
|
||||
|
||||
### `node.toString()`, `String(node)`, or `'' + node`
|
||||
|
||||
Returns a string representation of the node.
|
||||
|
||||
```js
|
||||
const id = parser.id({value: 'search'});
|
||||
console.log(String(id));
|
||||
// => #search
|
||||
```
|
||||
|
||||
### `node.next()` & `node.prev()`
|
||||
|
||||
Returns the next/previous child of the parent node.
|
||||
|
||||
```js
|
||||
const next = id.next();
|
||||
if (next && next.type !== 'combinator') {
|
||||
throw new Error('Qualified IDs are not allowed!');
|
||||
}
|
||||
```
|
||||
|
||||
### `node.replaceWith(node)`
|
||||
|
||||
Replace a node with another.
|
||||
|
||||
```js
|
||||
const attr = selectors.first.first;
|
||||
const className = parser.className({value: 'test'});
|
||||
attr.replaceWith(className);
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: The node to substitute the original with.
|
||||
|
||||
### `node.remove()`
|
||||
|
||||
Removes the node from its parent node.
|
||||
|
||||
```js
|
||||
if (node.type === 'id') {
|
||||
node.remove();
|
||||
}
|
||||
```
|
||||
|
||||
### `node.clone([opts])`
|
||||
|
||||
Returns a copy of a node, detached from any parent containers that the
|
||||
original might have had.
|
||||
|
||||
```js
|
||||
const cloned = node.clone();
|
||||
```
|
||||
|
||||
### `node.isAtPosition(line, column)`
|
||||
|
||||
Return a `boolean` indicating whether this node includes the character at the
|
||||
position of the given line and column. Returns `undefined` if the nodes lack
|
||||
sufficient source metadata to determine the position.
|
||||
|
||||
Arguments:
|
||||
|
||||
* `line`: 1-index based line number relative to the start of the selector.
|
||||
* `column`: 1-index based column number relative to the start of the selector.
|
||||
|
||||
### `node.spaces`
|
||||
|
||||
Extra whitespaces around the node will be moved into `node.spaces.before` and
|
||||
`node.spaces.after`. So for example, these spaces will be moved as they have
|
||||
no semantic meaning:
|
||||
|
||||
```css
|
||||
h1 , h2 {}
|
||||
```
|
||||
|
||||
For descendent selectors, the value is always a single space.
|
||||
|
||||
```css
|
||||
h1 h2 {}
|
||||
```
|
||||
|
||||
Additional whitespace is found in either the `node.spaces.before` and `node.spaces.after` depending on the presence of comments or other whitespace characters. If the actual whitespace does not start or end with a single space, the node's raw value is set to the actual space(s) found in the source.
|
||||
|
||||
### `node.source`
|
||||
|
||||
An object describing the node's start/end, line/column source position.
|
||||
|
||||
Within the following CSS, the `.bar` class node ...
|
||||
|
||||
```css
|
||||
.foo,
|
||||
.bar {}
|
||||
```
|
||||
|
||||
... will contain the following `source` object.
|
||||
|
||||
```js
|
||||
source: {
|
||||
start: {
|
||||
line: 2,
|
||||
column: 3
|
||||
},
|
||||
end: {
|
||||
line: 2,
|
||||
column: 6
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `node.sourceIndex`
|
||||
|
||||
The zero-based index of the node within the original source string.
|
||||
|
||||
Within the following CSS, the `.baz` class node will have a `sourceIndex` of `12`.
|
||||
|
||||
```css
|
||||
.foo, .bar, .baz {}
|
||||
```
|
||||
|
||||
## Container types
|
||||
|
||||
The `root`, `selector`, and `pseudo` nodes have some helper methods for working
|
||||
with their children.
|
||||
|
||||
### `container.nodes`
|
||||
|
||||
An array of the container's children.
|
||||
|
||||
```js
|
||||
// Input: h1 h2
|
||||
selectors.at(0).nodes.length // => 3
|
||||
selectors.at(0).nodes[0].value // => 'h1'
|
||||
selectors.at(0).nodes[1].value // => ' '
|
||||
```
|
||||
|
||||
### `container.first` & `container.last`
|
||||
|
||||
The first/last child of the container.
|
||||
|
||||
```js
|
||||
selector.first === selector.nodes[0];
|
||||
selector.last === selector.nodes[selector.nodes.length - 1];
|
||||
```
|
||||
|
||||
### `container.at(index)`
|
||||
|
||||
Returns the node at position `index`.
|
||||
|
||||
```js
|
||||
selector.at(0) === selector.first;
|
||||
selector.at(0) === selector.nodes[0];
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `index`: The index of the node to return.
|
||||
|
||||
### `container.atPosition(line, column)`
|
||||
|
||||
Returns the node at the source position `line` and `column`.
|
||||
|
||||
```js
|
||||
// Input: :not(.foo),\n#foo > :matches(ol, ul)
|
||||
selector.atPosition(1, 1); // => :not(.foo)
|
||||
selector.atPosition(2, 1); // => \n#foo
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `line`: The line number of the node to return.
|
||||
* `column`: The column number of the node to return.
|
||||
|
||||
### `container.index(node)`
|
||||
|
||||
Return the index of the node within its container.
|
||||
|
||||
```js
|
||||
selector.index(selector.nodes[2]) // => 2
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: A node within the current container.
|
||||
|
||||
### `container.length`
|
||||
|
||||
Proxy to the length of the container's nodes.
|
||||
|
||||
```js
|
||||
container.length === container.nodes.length
|
||||
```
|
||||
|
||||
### `container` Array iterators
|
||||
|
||||
The container class provides proxies to certain Array methods; these are:
|
||||
|
||||
* `container.map === container.nodes.map`
|
||||
* `container.reduce === container.nodes.reduce`
|
||||
* `container.every === container.nodes.every`
|
||||
* `container.some === container.nodes.some`
|
||||
* `container.filter === container.nodes.filter`
|
||||
* `container.sort === container.nodes.sort`
|
||||
|
||||
Note that these methods only work on a container's immediate children; recursive
|
||||
iteration is provided by `container.walk`.
|
||||
|
||||
### `container.each(callback)`
|
||||
|
||||
Iterate the container's immediate children, calling `callback` for each child.
|
||||
You may return `false` within the callback to break the iteration.
|
||||
|
||||
```js
|
||||
let className;
|
||||
selectors.each((selector, index) => {
|
||||
if (selector.type === 'class') {
|
||||
className = selector.value;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Note that unlike `Array#forEach()`, this iterator is safe to use whilst adding
|
||||
or removing nodes from the container.
|
||||
|
||||
Arguments:
|
||||
|
||||
* `callback (function)`: A function to call for each node, which receives `node`
|
||||
and `index` arguments.
|
||||
|
||||
### `container.walk(callback)`
|
||||
|
||||
Like `container#each`, but will also iterate child nodes as long as they are
|
||||
`container` types.
|
||||
|
||||
```js
|
||||
selectors.walk((selector, index) => {
|
||||
// all nodes
|
||||
});
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `callback (function)`: A function to call for each node, which receives `node`
|
||||
and `index` arguments.
|
||||
|
||||
This iterator is safe to use whilst mutating `container.nodes`,
|
||||
like `container#each`.
|
||||
|
||||
### `container.walk` proxies
|
||||
|
||||
The container class provides proxy methods for iterating over types of nodes,
|
||||
so that it is easier to write modules that target specific selectors. Those
|
||||
methods are:
|
||||
|
||||
* `container.walkAttributes`
|
||||
* `container.walkClasses`
|
||||
* `container.walkCombinators`
|
||||
* `container.walkComments`
|
||||
* `container.walkIds`
|
||||
* `container.walkNesting`
|
||||
* `container.walkPseudos`
|
||||
* `container.walkTags`
|
||||
* `container.walkUniversals`
|
||||
|
||||
### `container.split(callback)`
|
||||
|
||||
This method allows you to split a group of nodes by returning `true` from
|
||||
a callback. It returns an array of arrays, where each inner array corresponds
|
||||
to the groups that you created via the callback.
|
||||
|
||||
```js
|
||||
// (input) => h1 h2>>h3
|
||||
const list = selectors.first.split(selector => {
|
||||
return selector.type === 'combinator';
|
||||
});
|
||||
|
||||
// (node values) => [['h1', ' '], ['h2', '>>'], ['h3']]
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `callback (function)`: A function to call for each node, which receives `node`
|
||||
as an argument.
|
||||
|
||||
### `container.prepend(node)` & `container.append(node)`
|
||||
|
||||
Add a node to the start/end of the container. Note that doing so will set
|
||||
the parent property of the node to this container.
|
||||
|
||||
```js
|
||||
const id = parser.id({value: 'search'});
|
||||
selector.append(id);
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: The node to add.
|
||||
|
||||
### `container.insertBefore(old, new)` & `container.insertAfter(old, new)`
|
||||
|
||||
Add a node before or after an existing node in a container:
|
||||
|
||||
```js
|
||||
selectors.walk(selector => {
|
||||
if (selector.type !== 'class') {
|
||||
const className = parser.className({value: 'theme-name'});
|
||||
selector.parent.insertAfter(selector, className);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `old`: The existing node in the container.
|
||||
* `new`: The new node to add before/after the existing node.
|
||||
|
||||
### `container.removeChild(node)`
|
||||
|
||||
Remove the node from the container. Note that you can also use
|
||||
`node.remove()` if you would like to remove just a single node.
|
||||
|
||||
```js
|
||||
selector.length // => 2
|
||||
selector.remove(id)
|
||||
selector.length // => 1;
|
||||
id.parent // undefined
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `node`: The node to remove.
|
||||
|
||||
### `container.removeAll()` or `container.empty()`
|
||||
|
||||
Remove all children from the container.
|
||||
|
||||
```js
|
||||
selector.removeAll();
|
||||
selector.length // => 0
|
||||
```
|
||||
|
||||
## Root nodes
|
||||
|
||||
A root node represents a comma separated list of selectors. Indeed, all
|
||||
a root's `toString()` method does is join its selector children with a ','.
|
||||
Other than this, it has no special functionality and acts like a container.
|
||||
|
||||
### `root.trailingComma`
|
||||
|
||||
This will be set to `true` if the input has a trailing comma, in order to
|
||||
support parsing of legacy CSS hacks.
|
||||
|
||||
## Selector nodes
|
||||
|
||||
A selector node represents a single complex selector. For example, this
|
||||
selector string `h1 h2 h3, [href] > p`, is represented as two selector nodes.
|
||||
It has no special functionality of its own.
|
||||
|
||||
## Pseudo nodes
|
||||
|
||||
A pseudo selector extends a container node; if it has any parameters of its
|
||||
own (such as `h1:not(h2, h3)`), they will be its children. Note that the pseudo
|
||||
`value` will always contain the colons preceding the pseudo identifier. This
|
||||
is so that both `:before` and `::before` are properly represented in the AST.
|
||||
|
||||
## Attribute nodes
|
||||
|
||||
### `attribute.quoted`
|
||||
|
||||
Returns `true` if the attribute's value is wrapped in quotation marks, false if it is not.
|
||||
Remains `undefined` if there is no attribute value.
|
||||
|
||||
```css
|
||||
[href=foo] /* false */
|
||||
[href='foo'] /* true */
|
||||
[href="foo"] /* true */
|
||||
[href] /* undefined */
|
||||
```
|
||||
|
||||
### `attribute.qualifiedAttribute`
|
||||
|
||||
Returns the attribute name qualified with the namespace if one is given.
|
||||
|
||||
### `attribute.offsetOf(part)`
|
||||
|
||||
Returns the offset of the attribute part specified relative to the
|
||||
start of the node of the output string. This is useful in raising
|
||||
error messages about a specific part of the attribute, especially
|
||||
in combination with `attribute.sourceIndex`.
|
||||
|
||||
Returns `-1` if the name is invalid or the value doesn't exist in this
|
||||
attribute.
|
||||
|
||||
The legal values for `part` are:
|
||||
|
||||
* `"ns"` - alias for "namespace"
|
||||
* `"namespace"` - the namespace if it exists.
|
||||
* `"attribute"` - the attribute name
|
||||
* `"attributeNS"` - the start of the attribute or its namespace
|
||||
* `"operator"` - the match operator of the attribute
|
||||
* `"value"` - The value (string or identifier)
|
||||
* `"insensitive"` - the case insensitivity flag
|
||||
|
||||
### `attribute.raws.unquoted`
|
||||
|
||||
Returns the unquoted content of the attribute's value.
|
||||
Remains `undefined` if there is no attribute value.
|
||||
|
||||
```css
|
||||
[href=foo] /* foo */
|
||||
[href='foo'] /* foo */
|
||||
[href="foo"] /* foo */
|
||||
[href] /* undefined */
|
||||
```
|
||||
|
||||
### `attribute.spaces`
|
||||
|
||||
Like `node.spaces` with the `before` and `after` values containing the spaces
|
||||
around the element, the parts of the attribute can also have spaces before
|
||||
and after them. The for each of `attribute`, `operator`, `value` and
|
||||
`insensitive` there is corresponding property of the same nam in
|
||||
`node.spaces` that has an optional `before` or `after` string containing only
|
||||
whitespace.
|
||||
|
||||
Note that corresponding values in `attributes.raws.spaces` contain values
|
||||
including any comments. If set, these values will override the
|
||||
`attribute.spaces` value. Take care to remove them if changing
|
||||
`attribute.spaces`.
|
||||
|
||||
### `attribute.raws`
|
||||
|
||||
The raws object stores comments and other information necessary to re-render
|
||||
the node exactly as it was in the source.
|
||||
|
||||
If a comment is embedded within the identifiers for the `namespace`, `attribute`
|
||||
or `value` then a property is placed in the raws for that value containing the full source of the propery including comments.
|
||||
|
||||
If a comment is embedded within the space between parts of the attribute
|
||||
then the raw for that space is set accordingly.
|
||||
|
||||
Setting an attribute's property `raws` value to be deleted.
|
||||
|
||||
For now, changing the spaces required also updating or removing any of the
|
||||
raws values that override them.
|
||||
|
||||
Example: `[ /*before*/ href /* after-attr */ = /* after-operator */ te/*inside-value*/st/* wow */ /*omg*/i/*bbq*/ /*whodoesthis*/]` would parse as:
|
||||
|
||||
```js
|
||||
{
|
||||
attribute: "href",
|
||||
operator: "=",
|
||||
value: "test",
|
||||
spaces: {
|
||||
before: '',
|
||||
after: '',
|
||||
attribute: { before: ' ', after: ' ' },
|
||||
operator: { after: ' ' },
|
||||
value: { after: ' ' },
|
||||
insensitive: { after: ' ' }
|
||||
},
|
||||
raws: {
|
||||
spaces: {
|
||||
attribute: { before: ' /*before*/ ', after: ' /* after-attr */ ' },
|
||||
operator: { after: ' /* after-operator */ ' },
|
||||
value: { after: '/* wow */ /*omg*/' },
|
||||
insensitive: { after: '/*bbq*/ /*whodoesthis*/' }
|
||||
},
|
||||
unquoted: 'test',
|
||||
value: 'te/*inside-value*/st'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## `Processor`
|
||||
|
||||
### `ProcessorOptions`
|
||||
|
||||
* `lossless` - When `true`, whitespace is preserved. Defaults to `true`.
|
||||
* `updateSelector` - When `true`, if any processor methods are passed a postcss
|
||||
`Rule` node instead of a string, then that Rule's selector is updated
|
||||
with the results of the processing. Defaults to `true`.
|
||||
|
||||
### `process|processSync(selectors, [options])`
|
||||
|
||||
Processes the `selectors`, returning a string from the result of processing.
|
||||
|
||||
Note: when the `updateSelector` option is set, the rule's selector
|
||||
will be updated with the resulting string.
|
||||
|
||||
**Example:**
|
||||
|
||||
```js
|
||||
const parser = require("postcss-selector-parser");
|
||||
const processor = parser();
|
||||
|
||||
let result = processor.processSync(' .class');
|
||||
console.log(result);
|
||||
// => .class
|
||||
|
||||
// Asynchronous operation
|
||||
let promise = processor.process(' .class').then(result => {
|
||||
console.log(result)
|
||||
// => .class
|
||||
});
|
||||
|
||||
// To have the parser normalize whitespace values, utilize the options
|
||||
result = processor.processSync(' .class ', {lossless: false});
|
||||
console.log(result);
|
||||
// => .class
|
||||
|
||||
// For better syntax errors, pass a PostCSS Rule node.
|
||||
const postcss = require('postcss');
|
||||
rule = postcss.rule({selector: ' #foo > a, .class '});
|
||||
processor.process(rule, {lossless: false, updateSelector: true}).then(result => {
|
||||
console.log(result);
|
||||
// => #foo>a,.class
|
||||
console.log("rule:", rule.selector);
|
||||
// => rule: #foo>a,.class
|
||||
})
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
* `selectors (string|postcss.Rule)`: Either a selector string or a PostCSS Rule
|
||||
node.
|
||||
* `[options] (object)`: Process options
|
||||
|
||||
|
||||
### `ast|astSync(selectors, [options])`
|
||||
|
||||
Like `process()` and `processSync()` but after
|
||||
processing the `selectors` these methods return the `Root` node of the result
|
||||
instead of a string.
|
||||
|
||||
Note: when the `updateSelector` option is set, the rule's selector
|
||||
will be updated with the resulting string.
|
||||
|
||||
### `transform|transformSync(selectors, [options])`
|
||||
|
||||
Like `process()` and `processSync()` but after
|
||||
processing the `selectors` these methods return the value returned by the
|
||||
processor callback.
|
||||
|
||||
Note: when the `updateSelector` option is set, the rule's selector
|
||||
will be updated with the resulting string.
|
||||
|
||||
### Error Handling Within Selector Processors
|
||||
|
||||
The root node passed to the selector processor callback
|
||||
has a method `error(message, options)` that returns an
|
||||
error object. This method should always be used to raise
|
||||
errors relating to the syntax of selectors. The options
|
||||
to this method are passed to postcss's error constructor
|
||||
([documentation](http://postcss.org/api/#container-error)).
|
||||
|
||||
#### Async Error Example
|
||||
|
||||
```js
|
||||
let processor = (root) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
root.walkClasses((classNode) => {
|
||||
if (/^(.*)[-_]/.test(classNode.value)) {
|
||||
let msg = "classes may not have underscores or dashes in them";
|
||||
reject(root.error(msg, {
|
||||
index: classNode.sourceIndex + RegExp.$1.length + 1,
|
||||
word: classNode.value
|
||||
}));
|
||||
}
|
||||
});
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
const postcss = require("postcss");
|
||||
const parser = require("postcss-selector-parser");
|
||||
const selectorProcessor = parser(processor);
|
||||
const plugin = postcss.plugin('classValidator', (options) => {
|
||||
return (root) => {
|
||||
let promises = [];
|
||||
root.walkRules(rule => {
|
||||
promises.push(selectorProcessor.process(rule));
|
||||
});
|
||||
return Promise.all(promises);
|
||||
};
|
||||
});
|
||||
postcss(plugin()).process(`
|
||||
.foo-bar {
|
||||
color: red;
|
||||
}
|
||||
`.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString()));
|
||||
|
||||
// CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them
|
||||
//
|
||||
// > 1 | .foo-bar {
|
||||
// | ^
|
||||
// 2 | color: red;
|
||||
// 3 | }
|
||||
```
|
||||
|
||||
#### Synchronous Error Example
|
||||
|
||||
```js
|
||||
let processor = (root) => {
|
||||
root.walkClasses((classNode) => {
|
||||
if (/.*[-_]/.test(classNode.value)) {
|
||||
let msg = "classes may not have underscores or dashes in them";
|
||||
throw root.error(msg, {
|
||||
index: classNode.sourceIndex,
|
||||
word: classNode.value
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const postcss = require("postcss");
|
||||
const parser = require("postcss-selector-parser");
|
||||
const selectorProcessor = parser(processor);
|
||||
const plugin = postcss.plugin('classValidator', (options) => {
|
||||
return (root) => {
|
||||
root.walkRules(rule => {
|
||||
selectorProcessor.processSync(rule);
|
||||
});
|
||||
};
|
||||
});
|
||||
postcss(plugin()).process(`
|
||||
.foo-bar {
|
||||
color: red;
|
||||
}
|
||||
`.trim(), {from: 'test.css'}).catch((e) => console.error(e.toString()));
|
||||
|
||||
// CssSyntaxError: classValidator: ./test.css:1:5: classes may not have underscores or dashes in them
|
||||
//
|
||||
// > 1 | .foo-bar {
|
||||
// | ^
|
||||
// 2 | color: red;
|
||||
// 3 | }
|
||||
```
|
||||
549
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/CHANGELOG.md
generated
vendored
Normal file
549
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,549 @@
|
|||
# 6.1.2
|
||||
|
||||
- Fixed: erroneous trailing combinators in pseudos
|
||||
|
||||
# 6.1.1
|
||||
|
||||
- Fixed: improve typings of constructor helpers (#292)
|
||||
|
||||
# 6.1.0
|
||||
|
||||
- Feature: add `sourceIndex` to `Selector` nodes (#290)
|
||||
|
||||
# 6.0.16
|
||||
|
||||
- Fixed: add missing `index` argument to `each`/`walk` callback types (#289)
|
||||
|
||||
# 6.0.15
|
||||
|
||||
- Fixed: Node#prev and Node#next type for the first/last node
|
||||
|
||||
# 6.0.14
|
||||
|
||||
- Fixed: type definitions
|
||||
|
||||
# 6.0.13
|
||||
|
||||
- Fixed: throw on unexpected pipe symbols
|
||||
|
||||
# 6.0.12
|
||||
|
||||
- Fixed: `clone` arguments should be optional
|
||||
|
||||
# 6.0.11
|
||||
|
||||
- Fixed: parse attribute case insensitivity flag
|
||||
|
||||
# 6.0.10
|
||||
|
||||
- Fixed: `isPseudoElement()` supports `:first-letter` and `:first-line`
|
||||
|
||||
# 6.0.9
|
||||
|
||||
- Fixed: `Combinator.raws` property type
|
||||
|
||||
# 6.0.8
|
||||
|
||||
- Fixed: reduced size
|
||||
|
||||
# 6.0.7
|
||||
|
||||
- Fixed: parse animation percents
|
||||
|
||||
# 6.0.6
|
||||
|
||||
- Fixed: parse quoted attributes containing a newline correctly
|
||||
|
||||
# 6.0.5
|
||||
|
||||
- Perf: rework unesc for a 63+% performance boost
|
||||
|
||||
# 6.0.4
|
||||
|
||||
- Fixed: ts errors
|
||||
|
||||
# 6.0.3
|
||||
|
||||
- Fixed: replace node built-in "util" module with "util-deprecate"
|
||||
- Fixed: handle uppercase pseudo elements
|
||||
- Fixed: do not create invalid combinator before comment
|
||||
|
||||
# 6.0.2
|
||||
|
||||
- Fixed an issue with parsing and stringifying an empty attribute value
|
||||
|
||||
# 6.0.1
|
||||
|
||||
- Fixed an issue with unicode surrogate pair parsing
|
||||
|
||||
# 6.0.0
|
||||
|
||||
- Updated: `cssesc` to 3.0.0 (major)
|
||||
- Fixed: Issues with escaped `id` and `class` selectors
|
||||
|
||||
# 5.0.0
|
||||
|
||||
- Allow escaped dot within class name.
|
||||
- Update PostCSS to 7.0.7 (patch)
|
||||
|
||||
# 5.0.0-rc.4
|
||||
|
||||
- Fixed an issue where comments immediately after an insensitive (in attribute)
|
||||
were not parsed correctly.
|
||||
- Updated `cssesc` to 2.0.0 (major).
|
||||
- Removed outdated integration tests.
|
||||
- Added tests for custom selectors, tags with attributes, the universal
|
||||
selector with pseudos, and tokens after combinators.
|
||||
|
||||
# 5.0.0-rc.1
|
||||
|
||||
To ease adoption of the v5.0 release, we have relaxed the node version
|
||||
check performed by npm at installation time to allow for node 4, which
|
||||
remains officially unsupported, but likely to continue working for the
|
||||
time being.
|
||||
|
||||
# 5.0.0-rc.0
|
||||
|
||||
This release has **BREAKING CHANGES** that were required to fix regressions
|
||||
in 4.0.0 and to make the Combinator Node API consistent for all combinator
|
||||
types. Please read carefully.
|
||||
|
||||
## Summary of Changes
|
||||
|
||||
* The way a descendent combinator that isn't a single space character (E.g. `.a .b`) is stored in the AST has changed.
|
||||
* Named Combinators (E.g. `.a /for/ .b`) are now properly parsed as a combinator.
|
||||
* It is now possible to look up a node based on the source location of a character in that node and to query nodes if they contain some character.
|
||||
* Several bug fixes that caused the parser to hang and run out of memory when a `/` was encountered have been fixed.
|
||||
* The minimum supported version of Node is now `v6.0.0`.
|
||||
|
||||
### Changes to the Descendent Combinator
|
||||
|
||||
In prior releases, the value of a descendant combinator with multiple spaces included all the spaces.
|
||||
|
||||
* `.a .b`: Extra spaces are now stored as space before.
|
||||
- Old & Busted:
|
||||
- `combinator.value === " "`
|
||||
- New hotness:
|
||||
- `combinator.value === " " && combinator.spaces.before === " "`
|
||||
* `.a /*comment*/.b`: A comment at the end of the combinator causes extra space to become after space.
|
||||
- Old & Busted:
|
||||
- `combinator.value === " "`
|
||||
- `combinator.raws.value === " /*comment/"`
|
||||
- New hotness:
|
||||
- `combinator.value === " "`
|
||||
- `combinator.spaces.after === " "`
|
||||
- `combinator.raws.spaces.after === " /*comment*/"`
|
||||
* `.a<newline>.b`: whitespace that doesn't start or end with a single space character is stored as a raw value.
|
||||
- Old & Busted:
|
||||
- `combinator.value === "\n"`
|
||||
- `combinator.raws.value === undefined`
|
||||
- New hotness:
|
||||
- `combinator.value === " "`
|
||||
- `combinator.raws.value === "\n"`
|
||||
|
||||
### Support for "Named Combinators"
|
||||
|
||||
Although, nonstandard and unlikely to ever become a standard, combinators like `/deep/` and `/for/` are now properly supported.
|
||||
|
||||
Because they've been taken off the standardization track, there is no spec-official name for combinators of the form `/<ident>/`. However, I talked to [Tab Atkins](https://twitter.com/tabatkins) and we agreed to call them "named combinators" so now they are called that.
|
||||
|
||||
Before this release such named combinators were parsed without intention and generated three nodes of type `"tag"` where the first and last nodes had a value of `"/"`.
|
||||
|
||||
* `.a /for/ .b` is parsed as a combinator.
|
||||
- Old & Busted:
|
||||
- `root.nodes[0].nodes[1].type === "tag"`
|
||||
- `root.nodes[0].nodes[1].value === "/"`
|
||||
- New hotness:
|
||||
- `root.nodes[0].nodes[1].type === "combinator"`
|
||||
- `root.nodes[0].nodes[1].value === "/for/"`
|
||||
* `.a /F\6fR/ .b` escapes are handled and uppercase is normalized.
|
||||
- Old & Busted:
|
||||
- `root.nodes[0].nodes[2].type === "tag"`
|
||||
- `root.nodes[0].nodes[2].value === "F\\6fR"`
|
||||
- New hotness:
|
||||
- `root.nodes[0].nodes[1].type === "combinator"`
|
||||
- `root.nodes[0].nodes[1].value === "/for/"`
|
||||
- `root.nodes[0].nodes[1].raws.value === "/F\\6fR/"`
|
||||
|
||||
### Source position checks and lookups
|
||||
|
||||
A new API was added to look up a node based on the source location.
|
||||
|
||||
```js
|
||||
const selectorParser = require("postcss-selector-parser");
|
||||
// You can find the most specific node for any given character
|
||||
let combinator = selectorParser.astSync(".a > .b").atPosition(1,4);
|
||||
combinator.toString() === " > ";
|
||||
// You can check if a node includes a specific character
|
||||
// Whitespace surrounding the node that is owned by that node
|
||||
// is included in the check.
|
||||
[2,3,4,5,6].map(column => combinator.isAtPosition(1, column));
|
||||
// => [false, true, true, true, false]
|
||||
```
|
||||
|
||||
# 4.0.0
|
||||
|
||||
This release has **BREAKING CHANGES** that were required to fix bugs regarding values with escape sequences. Please read carefully.
|
||||
|
||||
* **Identifiers with escapes** - CSS escape sequences are now hidden from the public API by default.
|
||||
The normal value of a node like a class name or ID, or an aspect of a node such as attribute
|
||||
selector's value, is unescaped. Escapes representing Non-ascii characters are unescaped into
|
||||
unicode characters. For example: `bu\tton, .\31 00, #i\2764\FE0Fu, [attr="value is \"quoted\""]`
|
||||
will parse respectively to the values `button`, `100`, `i❤️u`, `value is "quoted"`.
|
||||
The original escape sequences for these values can be found in the corresponding property name
|
||||
in `node.raws`. Where possible, deprecation warnings were added, but the nature
|
||||
of escape handling makes it impossible to detect what is escaped or not. Our expectation is
|
||||
that most users are neither expecting nor handling escape sequences in their use of this library,
|
||||
and so for them, this is a bug fix. Users who are taking care to handle escapes correctly can
|
||||
now update their code to remove the escape handling and let us do it for them.
|
||||
|
||||
* **Mutating values with escapes** - When you make an update to a node property that has escape handling
|
||||
The value is assumed to be unescaped, and any special characters are escaped automatically and
|
||||
the corresponding `raws` value is immediately updated. This can result in changes to the original
|
||||
escape format. Where the exact value of the escape sequence is important there are methods that
|
||||
allow both values to be set in conjunction. There are a number of new convenience methods for
|
||||
manipulating values that involve escapes, especially for attributes values where the quote mark
|
||||
is involved. See https://github.com/postcss/postcss-selector-parser/pull/133 for an extensive
|
||||
write-up on these changes.
|
||||
|
||||
|
||||
**Upgrade/API Example**
|
||||
|
||||
In `3.x` there was no unescape handling and internal consistency of several properties was the caller's job to maintain. It was very easy for the developer
|
||||
to create a CSS file that did not parse correctly when some types of values
|
||||
were in use.
|
||||
|
||||
```js
|
||||
const selectorParser = require("postcss-selector-parser");
|
||||
let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value"});
|
||||
attr.value; // => "a-value"
|
||||
attr.toString(); // => [id=a-value]
|
||||
// Add quotes to an attribute's value.
|
||||
// All these values have to be set by the caller to be consistent:
|
||||
// no internal consistency is maintained.
|
||||
attr.raws.unquoted = attr.value
|
||||
attr.value = "'" + attr.value + "'";
|
||||
attr.value; // => "'a-value'"
|
||||
attr.quoted = true;
|
||||
attr.toString(); // => "[id='a-value']"
|
||||
```
|
||||
|
||||
In `4.0` there is a convenient API for setting and mutating values
|
||||
that may need escaping. Especially for attributes.
|
||||
|
||||
```js
|
||||
const selectorParser = require("postcss-selector-parser");
|
||||
|
||||
// The constructor requires you specify the exact escape sequence
|
||||
let className = selectorParser.className({value: "illegal class name", raws: {value: "illegal\\ class\\ name"}});
|
||||
className.toString(); // => '.illegal\\ class\\ name'
|
||||
|
||||
// So it's better to set the value as a property
|
||||
className = selectorParser.className();
|
||||
// Most properties that deal with identifiers work like this
|
||||
className.value = "escape for me";
|
||||
className.value; // => 'escape for me'
|
||||
className.toString(); // => '.escape\\ for\\ me'
|
||||
|
||||
// emoji and all non-ascii are escaped to ensure it works in every css file.
|
||||
className.value = "😱🦄😍";
|
||||
className.value; // => '😱🦄😍'
|
||||
className.toString(); // => '.\\1F631\\1F984\\1F60D'
|
||||
|
||||
// you can control the escape sequence if you want, or do bad bad things
|
||||
className.setPropertyAndEscape('value', 'xxxx', 'yyyy');
|
||||
className.value; // => "xxxx"
|
||||
className.toString(); // => ".yyyy"
|
||||
|
||||
// Pass a value directly through to the css output without escaping it.
|
||||
className.setPropertyWithoutEscape('value', '$REPLACE_ME$');
|
||||
className.value; // => "$REPLACE_ME$"
|
||||
className.toString(); // => ".$REPLACE_ME$"
|
||||
|
||||
// The biggest changes are to the Attribute class
|
||||
// passing quoteMark explicitly is required to avoid a deprecation warning.
|
||||
let attr = selectorParser.attribute({attribute: "id", operator: "=", value: "a-value", quoteMark: null});
|
||||
attr.toString(); // => "[id=a-value]"
|
||||
// Get the value with quotes on it and any necessary escapes.
|
||||
// This is the same as reading attr.value in 3.x.
|
||||
attr.getQuotedValue(); // => "a-value";
|
||||
attr.quoteMark; // => null
|
||||
|
||||
// Add quotes to an attribute's value.
|
||||
attr.quoteMark = "'"; // This is all that's required.
|
||||
attr.toString(); // => "[id='a-value']"
|
||||
attr.quoted; // => true
|
||||
// The value is still the same, only the quotes have changed.
|
||||
attr.value; // => a-value
|
||||
attr.getQuotedValue(); // => "'a-value'";
|
||||
|
||||
// deprecated assignment, no warning because there's no escapes
|
||||
attr.value = "new-value";
|
||||
// no quote mark is needed so it is removed
|
||||
attr.getQuotedValue(); // => "new-value";
|
||||
|
||||
// deprecated assignment,
|
||||
attr.value = "\"a 'single quoted' value\"";
|
||||
// > (node:27859) DeprecationWarning: Assigning an attribute a value containing characters that might need to be escaped is deprecated. Call attribute.setValue() instead.
|
||||
attr.getQuotedValue(); // => '"a \'single quoted\' value"';
|
||||
// quote mark inferred from first and last characters.
|
||||
attr.quoteMark; // => '"'
|
||||
|
||||
// setValue takes options to make manipulating the value simple.
|
||||
attr.setValue('foo', {smart: true});
|
||||
// foo doesn't require any escapes or quotes.
|
||||
attr.toString(); // => '[id=foo]'
|
||||
attr.quoteMark; // => null
|
||||
|
||||
// An explicit quote mark can be specified
|
||||
attr.setValue('foo', {quoteMark: '"'});
|
||||
attr.toString(); // => '[id="foo"]'
|
||||
|
||||
// preserves quote mark by default
|
||||
attr.setValue('bar');
|
||||
attr.toString(); // => '[id="bar"]'
|
||||
attr.quoteMark = null;
|
||||
attr.toString(); // => '[id=bar]'
|
||||
|
||||
// with no arguments, it preserves quote mark even when it's not a great idea
|
||||
attr.setValue('a value \n that should be quoted');
|
||||
attr.toString(); // => '[id=a\\ value\\ \\A\\ that\\ should\\ be\\ quoted]'
|
||||
|
||||
// smart preservation with a specified default
|
||||
attr.setValue('a value \n that should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
|
||||
// => "[id='a value \\A that should be quoted']"
|
||||
attr.quoteMark = '"';
|
||||
// => '[id="a value \\A that should be quoted"]'
|
||||
|
||||
// this keeps double quotes because it wants to quote the value and the existing value has double quotes.
|
||||
attr.setValue('this should be quoted', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
|
||||
// => '[id="this should be quoted"]'
|
||||
|
||||
// picks single quotes because the value has double quotes
|
||||
attr.setValue('a "double quoted" value', {smart: true, preferCurrentQuoteMark: true, quoteMark: "'"});
|
||||
// => "[id='a "double quoted" value']"
|
||||
|
||||
// setPropertyAndEscape lets you do anything you want. Even things that are a bad idea and illegal.
|
||||
attr.setPropertyAndEscape('value', 'xxxx', 'the password is 42');
|
||||
attr.value; // => "xxxx"
|
||||
attr.toString(); // => "[id=the password is 42]"
|
||||
|
||||
// Pass a value directly through to the css output without escaping it.
|
||||
attr.setPropertyWithoutEscape('value', '$REPLACEMENT$');
|
||||
attr.value; // => "$REPLACEMENT$"
|
||||
attr.toString(); // => "[id=$REPLACEMENT$]"
|
||||
```
|
||||
|
||||
# 3.1.2
|
||||
|
||||
* Fix: Removed dot-prop dependency since it's no longer written in es5.
|
||||
|
||||
# 3.1.1
|
||||
|
||||
* Fix: typescript definitions weren't in the published package.
|
||||
|
||||
# 3.1.0
|
||||
|
||||
* Fixed numerous bugs in attribute nodes relating to the handling of comments
|
||||
and whitespace. There's significant changes to `attrNode.spaces` and `attrNode.raws` since the `3.0.0` release.
|
||||
* Added `Attribute#offsetOf(part)` to get the offset location of
|
||||
attribute parts like `"operator"` and `"value"`. This is most
|
||||
often added to `Attribute#sourceIndex` for error reporting.
|
||||
|
||||
# 3.0.0
|
||||
|
||||
## Breaking changes
|
||||
|
||||
* Some tweaks to the tokenizer/attribute selector parsing mean that whitespace
|
||||
locations might be slightly different to the 2.x code.
|
||||
* Better attribute selector parsing with more validation; postcss-selector-parser
|
||||
no longer uses regular expressions to parse attribute selectors.
|
||||
* Added an async API (thanks to @jacobp100); the default `process` API is now
|
||||
async, and the sync API is now accessed through `processSync` instead.
|
||||
* `process()` and `processSync()` now return a string instead of the Processor
|
||||
instance.
|
||||
* Tweaks handling of Less interpolation (thanks to @jwilsson).
|
||||
* Removes support for Node 0.12.
|
||||
|
||||
## Other changes
|
||||
|
||||
* `ast()` and `astSync()` methods have been added to the `Processor`. These
|
||||
return the `Root` node of the selectors after processing them.
|
||||
* `transform()` and `transformSync()` methods have been added to the
|
||||
`Processor`. These return the value returned by the processor callback
|
||||
after processing the selectors.
|
||||
* Set the parent when inserting a node (thanks to @chriseppstein).
|
||||
* Correctly adjust indices when using insertBefore/insertAfter (thanks to @tivac).
|
||||
* Fixes handling of namespaces with qualified tag selectors.
|
||||
* `process`, `ast` and `transform` (and their sync variants) now accept a
|
||||
`postcss` rule node. When provided, better errors are generated and selector
|
||||
processing is automatically set back to the rule selector (unless the `updateSelector` option is set to `false`.)
|
||||
* Now more memory efficient when tokenizing selectors.
|
||||
|
||||
### Upgrade hints
|
||||
|
||||
The pattern of:
|
||||
|
||||
`rule.selector = processor.process(rule.selector).result.toString();`
|
||||
|
||||
is now:
|
||||
|
||||
`processor.processSync(rule)`
|
||||
|
||||
# 2.2.3
|
||||
|
||||
* Resolves an issue where the parser would not reduce multiple spaces between an
|
||||
ampersand and another simple selector in lossy mode (thanks to @adam-26).
|
||||
|
||||
# 2.2.2
|
||||
|
||||
* No longer hangs on an unescaped semicolon; instead the parser will throw
|
||||
an exception for these cases.
|
||||
|
||||
# 2.2.1
|
||||
|
||||
* Allows a consumer to specify whitespace tokens when creating a new Node
|
||||
(thanks to @Semigradsky).
|
||||
|
||||
# 2.2.0
|
||||
|
||||
* Added a new option to normalize whitespace when parsing the selector string
|
||||
(thanks to @adam-26).
|
||||
|
||||
# 2.1.1
|
||||
|
||||
* Better unquoted value handling within attribute selectors
|
||||
(thanks to @evilebottnawi).
|
||||
|
||||
# 2.1.0
|
||||
|
||||
* Added: Use string constants for all node types & expose them on the main
|
||||
parser instance (thanks to @Aweary).
|
||||
|
||||
# 2.0.0
|
||||
|
||||
This release contains the following breaking changes:
|
||||
|
||||
* Renamed all `eachInside` iterators to `walk`. For example, `eachTag` is now
|
||||
`walkTags`, and `eachInside` is now `walk`.
|
||||
* Renamed `Node#removeSelf()` to `Node#remove()`.
|
||||
* Renamed `Container#remove()` to `Container#removeChild()`.
|
||||
* Renamed `Node#raw` to `Node#raws` (thanks to @davidtheclark).
|
||||
* Now parses `&` as the *nesting* selector, rather than a *tag* selector.
|
||||
* Fixes misinterpretation of Sass interpolation (e.g. `#{foo}`) as an
|
||||
id selector (thanks to @davidtheclark).
|
||||
|
||||
and;
|
||||
|
||||
* Fixes parsing of attribute selectors with equals signs in them
|
||||
(e.g. `[data-attr="foo=bar"]`) (thanks to @montmanu).
|
||||
* Adds `quoted` and `raw.unquoted` properties to attribute nodes
|
||||
(thanks to @davidtheclark).
|
||||
|
||||
# 1.3.3
|
||||
|
||||
* Fixes an infinite loop on `)` and `]` tokens when they had no opening pairs.
|
||||
Now postcss-selector-parser will throw when it encounters these lone tokens.
|
||||
|
||||
# 1.3.2
|
||||
|
||||
* Now uses plain integers rather than `str.charCodeAt(0)` for compiled builds.
|
||||
|
||||
# 1.3.1
|
||||
|
||||
* Update flatten to v1.x (thanks to @shinnn).
|
||||
|
||||
# 1.3.0
|
||||
|
||||
* Adds a new node type, `String`, to fix a crash on selectors such as
|
||||
`foo:bar("test")`.
|
||||
|
||||
# 1.2.1
|
||||
|
||||
* Fixes a crash when the parser encountered a trailing combinator.
|
||||
|
||||
# 1.2.0
|
||||
|
||||
* A more descriptive error is thrown when the parser expects to find a
|
||||
pseudo-class/pseudo-element (thanks to @ashelley).
|
||||
* Adds support for line/column locations for selector nodes, as well as a
|
||||
`Node#sourceIndex` method (thanks to @davidtheclark).
|
||||
|
||||
# 1.1.4
|
||||
|
||||
* Fixes a crash when a selector started with a `>` combinator. The module will
|
||||
now no longer throw if a selector has a leading/trailing combinator node.
|
||||
|
||||
# 1.1.3
|
||||
|
||||
* Fixes a crash on `@` tokens.
|
||||
|
||||
# 1.1.2
|
||||
|
||||
* Fixes an infinite loop caused by using parentheses in a non-pseudo element
|
||||
context.
|
||||
|
||||
# 1.1.1
|
||||
|
||||
* Fixes a crash when a backslash ended a selector string.
|
||||
|
||||
# 1.1.0
|
||||
|
||||
* Adds support for replacing multiple nodes at once with `replaceWith`
|
||||
(thanks to @jonathantneal).
|
||||
* Parser no longer throws on sequential IDs and trailing commas, to support
|
||||
parsing of selector hacks.
|
||||
|
||||
# 1.0.1
|
||||
|
||||
* Fixes using `insertAfter` and `insertBefore` during iteration.
|
||||
|
||||
# 1.0.0
|
||||
|
||||
* Adds `clone` and `replaceWith` methods to nodes.
|
||||
* Adds `insertBefore` and `insertAfter` to containers.
|
||||
* Stabilises API.
|
||||
|
||||
# 0.0.5
|
||||
|
||||
* Fixes crash on extra whitespace inside a pseudo selector's parentheses.
|
||||
* Adds sort function to the container class.
|
||||
* Enables the parser to pass its input through without transforming.
|
||||
* Iteration-safe `each` and `eachInside`.
|
||||
|
||||
# 0.0.4
|
||||
|
||||
* Tidy up redundant duplication.
|
||||
* Fixes a bug where the parser would loop infinitely on universal selectors
|
||||
inside pseudo selectors.
|
||||
* Adds `length` getter and `eachInside`, `map`, `reduce` to the container class.
|
||||
* When a selector has been removed from the tree, the root node will no longer
|
||||
cast it to a string.
|
||||
* Adds node type iterators to the container class (e.g. `eachComment`).
|
||||
* Adds filter function to the container class.
|
||||
* Adds split function to the container class.
|
||||
* Create new node types by doing `parser.id(opts)` etc.
|
||||
* Adds support for pseudo classes anywhere in the selector.
|
||||
|
||||
# 0.0.3
|
||||
|
||||
* Adds `next` and `prev` to the node class.
|
||||
* Adds `first` and `last` getters to the container class.
|
||||
* Adds `every` and `some` iterators to the container class.
|
||||
* Add `empty` alias for `removeAll`.
|
||||
* Combinators are now types of node.
|
||||
* Fixes the at method so that it is not an alias for `index`.
|
||||
* Tidy up creation of new nodes in the parser.
|
||||
* Refactors how namespaces are handled for consistency & less redundant code.
|
||||
* Refactors AST to use `nodes` exclusively, and eliminates excessive nesting.
|
||||
* Fixes nested pseudo parsing.
|
||||
* Fixes whitespace parsing.
|
||||
|
||||
# 0.0.2
|
||||
|
||||
* Adds support for namespace selectors.
|
||||
* Adds support for selectors joined by escaped spaces - such as `.\31\ 0`.
|
||||
|
||||
# 0.0.1
|
||||
|
||||
* Initial release.
|
||||
22
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/LICENSE-MIT
generated
vendored
Normal file
22
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/LICENSE-MIT
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
49
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/README.md
generated
vendored
Normal file
49
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# postcss-selector-parser [](https://github.com/postcss/postcss-selector-parser/actions/workflows/test.yml)
|
||||
|
||||
> Selector parser with built in methods for working with selector strings.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.com/package/postcss-selector-parser) do:
|
||||
|
||||
```
|
||||
npm install postcss-selector-parser
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
const transform = selectors => {
|
||||
selectors.walk(selector => {
|
||||
// do something with the selector
|
||||
console.log(String(selector))
|
||||
});
|
||||
};
|
||||
|
||||
const transformed = parser(transform).processSync('h1, h2, h3');
|
||||
```
|
||||
|
||||
To normalize selector whitespace:
|
||||
|
||||
```js
|
||||
const parser = require('postcss-selector-parser');
|
||||
const normalized = parser().processSync('h1, h2, h3', {lossless: false});
|
||||
// -> h1,h2,h3
|
||||
```
|
||||
|
||||
Async support is provided through `parser.process` and will resolve a Promise
|
||||
with the resulting selector string.
|
||||
|
||||
## API
|
||||
|
||||
Please see [API.md](API.md).
|
||||
|
||||
## Credits
|
||||
|
||||
* Huge thanks to Andrey Sitnik (@ai) for work on PostCSS which helped
|
||||
accelerate this module's development.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
17
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/index.js
generated
vendored
Normal file
17
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _processor = _interopRequireDefault(require("./processor"));
|
||||
var selectors = _interopRequireWildcard(require("./selectors"));
|
||||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
||||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
var parser = function parser(processor) {
|
||||
return new _processor["default"](processor);
|
||||
};
|
||||
Object.assign(parser, selectors);
|
||||
delete parser.__esModule;
|
||||
var _default = parser;
|
||||
exports["default"] = _default;
|
||||
module.exports = exports.default;
|
||||
1015
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/parser.js
generated
vendored
Normal file
1015
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/parser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
170
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/processor.js
generated
vendored
Normal file
170
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/processor.js
generated
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _parser = _interopRequireDefault(require("./parser"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
var Processor = /*#__PURE__*/function () {
|
||||
function Processor(func, options) {
|
||||
this.func = func || function noop() {};
|
||||
this.funcRes = null;
|
||||
this.options = options;
|
||||
}
|
||||
var _proto = Processor.prototype;
|
||||
_proto._shouldUpdateSelector = function _shouldUpdateSelector(rule, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
var merged = Object.assign({}, this.options, options);
|
||||
if (merged.updateSelector === false) {
|
||||
return false;
|
||||
} else {
|
||||
return typeof rule !== "string";
|
||||
}
|
||||
};
|
||||
_proto._isLossy = function _isLossy(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
var merged = Object.assign({}, this.options, options);
|
||||
if (merged.lossless === false) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
_proto._root = function _root(rule, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
var parser = new _parser["default"](rule, this._parseOptions(options));
|
||||
return parser.root;
|
||||
};
|
||||
_proto._parseOptions = function _parseOptions(options) {
|
||||
return {
|
||||
lossy: this._isLossy(options)
|
||||
};
|
||||
};
|
||||
_proto._run = function _run(rule, options) {
|
||||
var _this = this;
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
var root = _this._root(rule, options);
|
||||
Promise.resolve(_this.func(root)).then(function (transform) {
|
||||
var string = undefined;
|
||||
if (_this._shouldUpdateSelector(rule, options)) {
|
||||
string = root.toString();
|
||||
rule.selector = string;
|
||||
}
|
||||
return {
|
||||
transform: transform,
|
||||
root: root,
|
||||
string: string
|
||||
};
|
||||
}).then(resolve, reject);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto._runSync = function _runSync(rule, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
var root = this._root(rule, options);
|
||||
var transform = this.func(root);
|
||||
if (transform && typeof transform.then === "function") {
|
||||
throw new Error("Selector processor returned a promise to a synchronous call.");
|
||||
}
|
||||
var string = undefined;
|
||||
if (options.updateSelector && typeof rule !== "string") {
|
||||
string = root.toString();
|
||||
rule.selector = string;
|
||||
}
|
||||
return {
|
||||
transform: transform,
|
||||
root: root,
|
||||
string: string
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Process rule into a selector AST.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {Promise<parser.Root>} The AST of the selector after processing it.
|
||||
*/;
|
||||
_proto.ast = function ast(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.root;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Process rule into a selector AST synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {parser.Root} The AST of the selector after processing it.
|
||||
*/;
|
||||
_proto.astSync = function astSync(rule, options) {
|
||||
return this._runSync(rule, options).root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a selector into a transformed value asynchronously
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {Promise<any>} The value returned by the processor.
|
||||
*/;
|
||||
_proto.transform = function transform(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.transform;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a selector into a transformed value synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {any} The value returned by the processor.
|
||||
*/;
|
||||
_proto.transformSync = function transformSync(rule, options) {
|
||||
return this._runSync(rule, options).transform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a selector into a new selector string asynchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {string} the selector after processing.
|
||||
*/;
|
||||
_proto.process = function process(rule, options) {
|
||||
return this._run(rule, options).then(function (result) {
|
||||
return result.string || result.root.toString();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a selector into a new selector string synchronously.
|
||||
*
|
||||
* @param rule {postcss.Rule | string} The css selector to be processed
|
||||
* @param options The options for processing
|
||||
* @returns {string} the selector after processing.
|
||||
*/;
|
||||
_proto.processSync = function processSync(rule, options) {
|
||||
var result = this._runSync(rule, options);
|
||||
return result.string || result.root.toString();
|
||||
};
|
||||
return Processor;
|
||||
}();
|
||||
exports["default"] = Processor;
|
||||
module.exports = exports.default;
|
||||
448
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/attribute.js
generated
vendored
Normal file
448
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/attribute.js
generated
vendored
Normal file
|
|
@ -0,0 +1,448 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
exports.unescapeValue = unescapeValue;
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
var _unesc = _interopRequireDefault(require("../util/unesc"));
|
||||
var _namespace = _interopRequireDefault(require("./namespace"));
|
||||
var _types = require("./types");
|
||||
var _CSSESC_QUOTE_OPTIONS;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var deprecate = require("util-deprecate");
|
||||
var WRAPPED_IN_QUOTES = /^('|")([^]*)\1$/;
|
||||
var warnOfDeprecatedValueAssignment = deprecate(function () {}, "Assigning an attribute a value containing characters that might need to be escaped is deprecated. " + "Call attribute.setValue() instead.");
|
||||
var warnOfDeprecatedQuotedAssignment = deprecate(function () {}, "Assigning attr.quoted is deprecated and has no effect. Assign to attr.quoteMark instead.");
|
||||
var warnOfDeprecatedConstructor = deprecate(function () {}, "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now.");
|
||||
function unescapeValue(value) {
|
||||
var deprecatedUsage = false;
|
||||
var quoteMark = null;
|
||||
var unescaped = value;
|
||||
var m = unescaped.match(WRAPPED_IN_QUOTES);
|
||||
if (m) {
|
||||
quoteMark = m[1];
|
||||
unescaped = m[2];
|
||||
}
|
||||
unescaped = (0, _unesc["default"])(unescaped);
|
||||
if (unescaped !== value) {
|
||||
deprecatedUsage = true;
|
||||
}
|
||||
return {
|
||||
deprecatedUsage: deprecatedUsage,
|
||||
unescaped: unescaped,
|
||||
quoteMark: quoteMark
|
||||
};
|
||||
}
|
||||
function handleDeprecatedContructorOpts(opts) {
|
||||
if (opts.quoteMark !== undefined) {
|
||||
return opts;
|
||||
}
|
||||
if (opts.value === undefined) {
|
||||
return opts;
|
||||
}
|
||||
warnOfDeprecatedConstructor();
|
||||
var _unescapeValue = unescapeValue(opts.value),
|
||||
quoteMark = _unescapeValue.quoteMark,
|
||||
unescaped = _unescapeValue.unescaped;
|
||||
if (!opts.raws) {
|
||||
opts.raws = {};
|
||||
}
|
||||
if (opts.raws.value === undefined) {
|
||||
opts.raws.value = opts.value;
|
||||
}
|
||||
opts.value = unescaped;
|
||||
opts.quoteMark = quoteMark;
|
||||
return opts;
|
||||
}
|
||||
var Attribute = /*#__PURE__*/function (_Namespace) {
|
||||
_inheritsLoose(Attribute, _Namespace);
|
||||
function Attribute(opts) {
|
||||
var _this;
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
}
|
||||
_this = _Namespace.call(this, handleDeprecatedContructorOpts(opts)) || this;
|
||||
_this.type = _types.ATTRIBUTE;
|
||||
_this.raws = _this.raws || {};
|
||||
Object.defineProperty(_this.raws, 'unquoted', {
|
||||
get: deprecate(function () {
|
||||
return _this.value;
|
||||
}, "attr.raws.unquoted is deprecated. Call attr.value instead."),
|
||||
set: deprecate(function () {
|
||||
return _this.value;
|
||||
}, "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now.")
|
||||
});
|
||||
_this._constructed = true;
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Attribute's value quoted such that it would be legal to use
|
||||
* in the value of a css file. The original value's quotation setting
|
||||
* used for stringification is left unchanged. See `setValue(value, options)`
|
||||
* if you want to control the quote settings of a new value for the attribute.
|
||||
*
|
||||
* You can also change the quotation used for the current value by setting quoteMark.
|
||||
*
|
||||
* Options:
|
||||
* * quoteMark {'"' | "'" | null} - Use this value to quote the value. If this
|
||||
* option is not set, the original value for quoteMark will be used. If
|
||||
* indeterminate, a double quote is used. The legal values are:
|
||||
* * `null` - the value will be unquoted and characters will be escaped as necessary.
|
||||
* * `'` - the value will be quoted with a single quote and single quotes are escaped.
|
||||
* * `"` - the value will be quoted with a double quote and double quotes are escaped.
|
||||
* * preferCurrentQuoteMark {boolean} - if true, prefer the source quote mark
|
||||
* over the quoteMark option value.
|
||||
* * smart {boolean} - if true, will select a quote mark based on the value
|
||||
* and the other options specified here. See the `smartQuoteMark()`
|
||||
* method.
|
||||
**/
|
||||
var _proto = Attribute.prototype;
|
||||
_proto.getQuotedValue = function getQuotedValue(options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
var quoteMark = this._determineQuoteMark(options);
|
||||
var cssescopts = CSSESC_QUOTE_OPTIONS[quoteMark];
|
||||
var escaped = (0, _cssesc["default"])(this._value, cssescopts);
|
||||
return escaped;
|
||||
};
|
||||
_proto._determineQuoteMark = function _determineQuoteMark(options) {
|
||||
return options.smart ? this.smartQuoteMark(options) : this.preferredQuoteMark(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the unescaped value with the specified quotation options. The value
|
||||
* provided must not include any wrapping quote marks -- those quotes will
|
||||
* be interpreted as part of the value and escaped accordingly.
|
||||
*/;
|
||||
_proto.setValue = function setValue(value, options) {
|
||||
if (options === void 0) {
|
||||
options = {};
|
||||
}
|
||||
this._value = value;
|
||||
this._quoteMark = this._determineQuoteMark(options);
|
||||
this._syncRawValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Intelligently select a quoteMark value based on the value's contents. If
|
||||
* the value is a legal CSS ident, it will not be quoted. Otherwise a quote
|
||||
* mark will be picked that minimizes the number of escapes.
|
||||
*
|
||||
* If there's no clear winner, the quote mark from these options is used,
|
||||
* then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
|
||||
* true). If the quoteMark is unspecified, a double quote is used.
|
||||
*
|
||||
* @param options This takes the quoteMark and preferCurrentQuoteMark options
|
||||
* from the quoteValue method.
|
||||
*/;
|
||||
_proto.smartQuoteMark = function smartQuoteMark(options) {
|
||||
var v = this.value;
|
||||
var numSingleQuotes = v.replace(/[^']/g, '').length;
|
||||
var numDoubleQuotes = v.replace(/[^"]/g, '').length;
|
||||
if (numSingleQuotes + numDoubleQuotes === 0) {
|
||||
var escaped = (0, _cssesc["default"])(v, {
|
||||
isIdentifier: true
|
||||
});
|
||||
if (escaped === v) {
|
||||
return Attribute.NO_QUOTE;
|
||||
} else {
|
||||
var pref = this.preferredQuoteMark(options);
|
||||
if (pref === Attribute.NO_QUOTE) {
|
||||
// pick a quote mark that isn't none and see if it's smaller
|
||||
var quote = this.quoteMark || options.quoteMark || Attribute.DOUBLE_QUOTE;
|
||||
var opts = CSSESC_QUOTE_OPTIONS[quote];
|
||||
var quoteValue = (0, _cssesc["default"])(v, opts);
|
||||
if (quoteValue.length < escaped.length) {
|
||||
return quote;
|
||||
}
|
||||
}
|
||||
return pref;
|
||||
}
|
||||
} else if (numDoubleQuotes === numSingleQuotes) {
|
||||
return this.preferredQuoteMark(options);
|
||||
} else if (numDoubleQuotes < numSingleQuotes) {
|
||||
return Attribute.DOUBLE_QUOTE;
|
||||
} else {
|
||||
return Attribute.SINGLE_QUOTE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects the preferred quote mark based on the options and the current quote mark value.
|
||||
* If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
|
||||
* instead.
|
||||
*/;
|
||||
_proto.preferredQuoteMark = function preferredQuoteMark(options) {
|
||||
var quoteMark = options.preferCurrentQuoteMark ? this.quoteMark : options.quoteMark;
|
||||
if (quoteMark === undefined) {
|
||||
quoteMark = options.preferCurrentQuoteMark ? options.quoteMark : this.quoteMark;
|
||||
}
|
||||
if (quoteMark === undefined) {
|
||||
quoteMark = Attribute.DOUBLE_QUOTE;
|
||||
}
|
||||
return quoteMark;
|
||||
};
|
||||
_proto._syncRawValue = function _syncRawValue() {
|
||||
var rawValue = (0, _cssesc["default"])(this._value, CSSESC_QUOTE_OPTIONS[this.quoteMark]);
|
||||
if (rawValue === this._value) {
|
||||
if (this.raws) {
|
||||
delete this.raws.value;
|
||||
}
|
||||
} else {
|
||||
this.raws.value = rawValue;
|
||||
}
|
||||
};
|
||||
_proto._handleEscapes = function _handleEscapes(prop, value) {
|
||||
if (this._constructed) {
|
||||
var escaped = (0, _cssesc["default"])(value, {
|
||||
isIdentifier: true
|
||||
});
|
||||
if (escaped !== value) {
|
||||
this.raws[prop] = escaped;
|
||||
} else {
|
||||
delete this.raws[prop];
|
||||
}
|
||||
}
|
||||
};
|
||||
_proto._spacesFor = function _spacesFor(name) {
|
||||
var attrSpaces = {
|
||||
before: '',
|
||||
after: ''
|
||||
};
|
||||
var spaces = this.spaces[name] || {};
|
||||
var rawSpaces = this.raws.spaces && this.raws.spaces[name] || {};
|
||||
return Object.assign(attrSpaces, spaces, rawSpaces);
|
||||
};
|
||||
_proto._stringFor = function _stringFor(name, spaceName, concat) {
|
||||
if (spaceName === void 0) {
|
||||
spaceName = name;
|
||||
}
|
||||
if (concat === void 0) {
|
||||
concat = defaultAttrConcat;
|
||||
}
|
||||
var attrSpaces = this._spacesFor(spaceName);
|
||||
return concat(this.stringifyProperty(name), attrSpaces);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the offset of the attribute part specified relative to the
|
||||
* start of the node of the output string.
|
||||
*
|
||||
* * "ns" - alias for "namespace"
|
||||
* * "namespace" - the namespace if it exists.
|
||||
* * "attribute" - the attribute name
|
||||
* * "attributeNS" - the start of the attribute or its namespace
|
||||
* * "operator" - the match operator of the attribute
|
||||
* * "value" - The value (string or identifier)
|
||||
* * "insensitive" - the case insensitivity flag;
|
||||
* @param part One of the possible values inside an attribute.
|
||||
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
|
||||
*/;
|
||||
_proto.offsetOf = function offsetOf(name) {
|
||||
var count = 1;
|
||||
var attributeSpaces = this._spacesFor("attribute");
|
||||
count += attributeSpaces.before.length;
|
||||
if (name === "namespace" || name === "ns") {
|
||||
return this.namespace ? count : -1;
|
||||
}
|
||||
if (name === "attributeNS") {
|
||||
return count;
|
||||
}
|
||||
count += this.namespaceString.length;
|
||||
if (this.namespace) {
|
||||
count += 1;
|
||||
}
|
||||
if (name === "attribute") {
|
||||
return count;
|
||||
}
|
||||
count += this.stringifyProperty("attribute").length;
|
||||
count += attributeSpaces.after.length;
|
||||
var operatorSpaces = this._spacesFor("operator");
|
||||
count += operatorSpaces.before.length;
|
||||
var operator = this.stringifyProperty("operator");
|
||||
if (name === "operator") {
|
||||
return operator ? count : -1;
|
||||
}
|
||||
count += operator.length;
|
||||
count += operatorSpaces.after.length;
|
||||
var valueSpaces = this._spacesFor("value");
|
||||
count += valueSpaces.before.length;
|
||||
var value = this.stringifyProperty("value");
|
||||
if (name === "value") {
|
||||
return value ? count : -1;
|
||||
}
|
||||
count += value.length;
|
||||
count += valueSpaces.after.length;
|
||||
var insensitiveSpaces = this._spacesFor("insensitive");
|
||||
count += insensitiveSpaces.before.length;
|
||||
if (name === "insensitive") {
|
||||
return this.insensitive ? count : -1;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
_proto.toString = function toString() {
|
||||
var _this2 = this;
|
||||
var selector = [this.rawSpaceBefore, '['];
|
||||
selector.push(this._stringFor('qualifiedAttribute', 'attribute'));
|
||||
if (this.operator && (this.value || this.value === '')) {
|
||||
selector.push(this._stringFor('operator'));
|
||||
selector.push(this._stringFor('value'));
|
||||
selector.push(this._stringFor('insensitiveFlag', 'insensitive', function (attrValue, attrSpaces) {
|
||||
if (attrValue.length > 0 && !_this2.quoted && attrSpaces.before.length === 0 && !(_this2.spaces.value && _this2.spaces.value.after)) {
|
||||
attrSpaces.before = " ";
|
||||
}
|
||||
return defaultAttrConcat(attrValue, attrSpaces);
|
||||
}));
|
||||
}
|
||||
selector.push(']');
|
||||
selector.push(this.rawSpaceAfter);
|
||||
return selector.join('');
|
||||
};
|
||||
_createClass(Attribute, [{
|
||||
key: "quoted",
|
||||
get: function get() {
|
||||
var qm = this.quoteMark;
|
||||
return qm === "'" || qm === '"';
|
||||
},
|
||||
set: function set(value) {
|
||||
warnOfDeprecatedQuotedAssignment();
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a single (`'`) or double (`"`) quote character if the value is quoted.
|
||||
* returns `null` if the value is not quoted.
|
||||
* returns `undefined` if the quotation state is unknown (this can happen when
|
||||
* the attribute is constructed without specifying a quote mark.)
|
||||
*/
|
||||
}, {
|
||||
key: "quoteMark",
|
||||
get: function get() {
|
||||
return this._quoteMark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the quote mark to be used by this attribute's value.
|
||||
* If the quote mark changes, the raw (escaped) value at `attr.raws.value` of the attribute
|
||||
* value is updated accordingly.
|
||||
*
|
||||
* @param {"'" | '"' | null} quoteMark The quote mark or `null` if the value should be unquoted.
|
||||
*/,
|
||||
set: function set(quoteMark) {
|
||||
if (!this._constructed) {
|
||||
this._quoteMark = quoteMark;
|
||||
return;
|
||||
}
|
||||
if (this._quoteMark !== quoteMark) {
|
||||
this._quoteMark = quoteMark;
|
||||
this._syncRawValue();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "qualifiedAttribute",
|
||||
get: function get() {
|
||||
return this.qualifiedName(this.raws.attribute || this.attribute);
|
||||
}
|
||||
}, {
|
||||
key: "insensitiveFlag",
|
||||
get: function get() {
|
||||
return this.insensitive ? 'i' : '';
|
||||
}
|
||||
}, {
|
||||
key: "value",
|
||||
get: function get() {
|
||||
return this._value;
|
||||
},
|
||||
set:
|
||||
/**
|
||||
* Before 3.0, the value had to be set to an escaped value including any wrapped
|
||||
* quote marks. In 3.0, the semantics of `Attribute.value` changed so that the value
|
||||
* is unescaped during parsing and any quote marks are removed.
|
||||
*
|
||||
* Because the ambiguity of this semantic change, if you set `attr.value = newValue`,
|
||||
* a deprecation warning is raised when the new value contains any characters that would
|
||||
* require escaping (including if it contains wrapped quotes).
|
||||
*
|
||||
* Instead, you should call `attr.setValue(newValue, opts)` and pass options that describe
|
||||
* how the new value is quoted.
|
||||
*/
|
||||
function set(v) {
|
||||
if (this._constructed) {
|
||||
var _unescapeValue2 = unescapeValue(v),
|
||||
deprecatedUsage = _unescapeValue2.deprecatedUsage,
|
||||
unescaped = _unescapeValue2.unescaped,
|
||||
quoteMark = _unescapeValue2.quoteMark;
|
||||
if (deprecatedUsage) {
|
||||
warnOfDeprecatedValueAssignment();
|
||||
}
|
||||
if (unescaped === this._value && quoteMark === this._quoteMark) {
|
||||
return;
|
||||
}
|
||||
this._value = unescaped;
|
||||
this._quoteMark = quoteMark;
|
||||
this._syncRawValue();
|
||||
} else {
|
||||
this._value = v;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "insensitive",
|
||||
get: function get() {
|
||||
return this._insensitive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the case insensitive flag.
|
||||
* If the case insensitive flag changes, the raw (escaped) value at `attr.raws.insensitiveFlag`
|
||||
* of the attribute is updated accordingly.
|
||||
*
|
||||
* @param {true | false} insensitive true if the attribute should match case-insensitively.
|
||||
*/,
|
||||
set: function set(insensitive) {
|
||||
if (!insensitive) {
|
||||
this._insensitive = false;
|
||||
|
||||
// "i" and "I" can be used in "this.raws.insensitiveFlag" to store the original notation.
|
||||
// When setting `attr.insensitive = false` both should be erased to ensure correct serialization.
|
||||
if (this.raws && (this.raws.insensitiveFlag === 'I' || this.raws.insensitiveFlag === 'i')) {
|
||||
this.raws.insensitiveFlag = undefined;
|
||||
}
|
||||
}
|
||||
this._insensitive = insensitive;
|
||||
}
|
||||
}, {
|
||||
key: "attribute",
|
||||
get: function get() {
|
||||
return this._attribute;
|
||||
},
|
||||
set: function set(name) {
|
||||
this._handleEscapes("attribute", name);
|
||||
this._attribute = name;
|
||||
}
|
||||
}]);
|
||||
return Attribute;
|
||||
}(_namespace["default"]);
|
||||
exports["default"] = Attribute;
|
||||
Attribute.NO_QUOTE = null;
|
||||
Attribute.SINGLE_QUOTE = "'";
|
||||
Attribute.DOUBLE_QUOTE = '"';
|
||||
var CSSESC_QUOTE_OPTIONS = (_CSSESC_QUOTE_OPTIONS = {
|
||||
"'": {
|
||||
quotes: 'single',
|
||||
wrap: true
|
||||
},
|
||||
'"': {
|
||||
quotes: 'double',
|
||||
wrap: true
|
||||
}
|
||||
}, _CSSESC_QUOTE_OPTIONS[null] = {
|
||||
isIdentifier: true
|
||||
}, _CSSESC_QUOTE_OPTIONS);
|
||||
function defaultAttrConcat(attrValue, attrSpaces) {
|
||||
return "" + attrSpaces.before + attrValue + attrSpaces.after;
|
||||
}
|
||||
50
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/className.js
generated
vendored
Normal file
50
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/className.js
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
var _util = require("../util");
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var ClassName = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(ClassName, _Node);
|
||||
function ClassName(opts) {
|
||||
var _this;
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.CLASS;
|
||||
_this._constructed = true;
|
||||
return _this;
|
||||
}
|
||||
var _proto = ClassName.prototype;
|
||||
_proto.valueToString = function valueToString() {
|
||||
return '.' + _Node.prototype.valueToString.call(this);
|
||||
};
|
||||
_createClass(ClassName, [{
|
||||
key: "value",
|
||||
get: function get() {
|
||||
return this._value;
|
||||
},
|
||||
set: function set(v) {
|
||||
if (this._constructed) {
|
||||
var escaped = (0, _cssesc["default"])(v, {
|
||||
isIdentifier: true
|
||||
});
|
||||
if (escaped !== v) {
|
||||
(0, _util.ensureObject)(this, "raws");
|
||||
this.raws.value = escaped;
|
||||
} else if (this.raws) {
|
||||
delete this.raws.value;
|
||||
}
|
||||
}
|
||||
this._value = v;
|
||||
}
|
||||
}]);
|
||||
return ClassName;
|
||||
}(_node["default"]);
|
||||
exports["default"] = ClassName;
|
||||
module.exports = exports.default;
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/combinator.js
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/combinator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Combinator = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Combinator, _Node);
|
||||
function Combinator(opts) {
|
||||
var _this;
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.COMBINATOR;
|
||||
return _this;
|
||||
}
|
||||
return Combinator;
|
||||
}(_node["default"]);
|
||||
exports["default"] = Combinator;
|
||||
module.exports = exports.default;
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/comment.js
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/comment.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Comment = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Comment, _Node);
|
||||
function Comment(opts) {
|
||||
var _this;
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.COMMENT;
|
||||
return _this;
|
||||
}
|
||||
return Comment;
|
||||
}(_node["default"]);
|
||||
exports["default"] = Comment;
|
||||
module.exports = exports.default;
|
||||
65
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/constructors.js
generated
vendored
Normal file
65
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/constructors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = void 0;
|
||||
var _attribute = _interopRequireDefault(require("./attribute"));
|
||||
var _className = _interopRequireDefault(require("./className"));
|
||||
var _combinator = _interopRequireDefault(require("./combinator"));
|
||||
var _comment = _interopRequireDefault(require("./comment"));
|
||||
var _id = _interopRequireDefault(require("./id"));
|
||||
var _nesting = _interopRequireDefault(require("./nesting"));
|
||||
var _pseudo = _interopRequireDefault(require("./pseudo"));
|
||||
var _root = _interopRequireDefault(require("./root"));
|
||||
var _selector = _interopRequireDefault(require("./selector"));
|
||||
var _string = _interopRequireDefault(require("./string"));
|
||||
var _tag = _interopRequireDefault(require("./tag"));
|
||||
var _universal = _interopRequireDefault(require("./universal"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
var attribute = function attribute(opts) {
|
||||
return new _attribute["default"](opts);
|
||||
};
|
||||
exports.attribute = attribute;
|
||||
var className = function className(opts) {
|
||||
return new _className["default"](opts);
|
||||
};
|
||||
exports.className = className;
|
||||
var combinator = function combinator(opts) {
|
||||
return new _combinator["default"](opts);
|
||||
};
|
||||
exports.combinator = combinator;
|
||||
var comment = function comment(opts) {
|
||||
return new _comment["default"](opts);
|
||||
};
|
||||
exports.comment = comment;
|
||||
var id = function id(opts) {
|
||||
return new _id["default"](opts);
|
||||
};
|
||||
exports.id = id;
|
||||
var nesting = function nesting(opts) {
|
||||
return new _nesting["default"](opts);
|
||||
};
|
||||
exports.nesting = nesting;
|
||||
var pseudo = function pseudo(opts) {
|
||||
return new _pseudo["default"](opts);
|
||||
};
|
||||
exports.pseudo = pseudo;
|
||||
var root = function root(opts) {
|
||||
return new _root["default"](opts);
|
||||
};
|
||||
exports.root = root;
|
||||
var selector = function selector(opts) {
|
||||
return new _selector["default"](opts);
|
||||
};
|
||||
exports.selector = selector;
|
||||
var string = function string(opts) {
|
||||
return new _string["default"](opts);
|
||||
};
|
||||
exports.string = string;
|
||||
var tag = function tag(opts) {
|
||||
return new _tag["default"](opts);
|
||||
};
|
||||
exports.tag = tag;
|
||||
var universal = function universal(opts) {
|
||||
return new _universal["default"](opts);
|
||||
};
|
||||
exports.universal = universal;
|
||||
308
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/container.js
generated
vendored
Normal file
308
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/container.js
generated
vendored
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
var types = _interopRequireWildcard(require("./types"));
|
||||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
||||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Container = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Container, _Node);
|
||||
function Container(opts) {
|
||||
var _this;
|
||||
_this = _Node.call(this, opts) || this;
|
||||
if (!_this.nodes) {
|
||||
_this.nodes = [];
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
var _proto = Container.prototype;
|
||||
_proto.append = function append(selector) {
|
||||
selector.parent = this;
|
||||
this.nodes.push(selector);
|
||||
return this;
|
||||
};
|
||||
_proto.prepend = function prepend(selector) {
|
||||
selector.parent = this;
|
||||
this.nodes.unshift(selector);
|
||||
return this;
|
||||
};
|
||||
_proto.at = function at(index) {
|
||||
return this.nodes[index];
|
||||
};
|
||||
_proto.index = function index(child) {
|
||||
if (typeof child === 'number') {
|
||||
return child;
|
||||
}
|
||||
return this.nodes.indexOf(child);
|
||||
};
|
||||
_proto.removeChild = function removeChild(child) {
|
||||
child = this.index(child);
|
||||
this.at(child).parent = undefined;
|
||||
this.nodes.splice(child, 1);
|
||||
var index;
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
if (index >= child) {
|
||||
this.indexes[id] = index - 1;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
_proto.removeAll = function removeAll() {
|
||||
for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
|
||||
var node = _step.value;
|
||||
node.parent = undefined;
|
||||
}
|
||||
this.nodes = [];
|
||||
return this;
|
||||
};
|
||||
_proto.empty = function empty() {
|
||||
return this.removeAll();
|
||||
};
|
||||
_proto.insertAfter = function insertAfter(oldNode, newNode) {
|
||||
newNode.parent = this;
|
||||
var oldIndex = this.index(oldNode);
|
||||
this.nodes.splice(oldIndex + 1, 0, newNode);
|
||||
newNode.parent = this;
|
||||
var index;
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
if (oldIndex <= index) {
|
||||
this.indexes[id] = index + 1;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
_proto.insertBefore = function insertBefore(oldNode, newNode) {
|
||||
newNode.parent = this;
|
||||
var oldIndex = this.index(oldNode);
|
||||
this.nodes.splice(oldIndex, 0, newNode);
|
||||
newNode.parent = this;
|
||||
var index;
|
||||
for (var id in this.indexes) {
|
||||
index = this.indexes[id];
|
||||
if (index <= oldIndex) {
|
||||
this.indexes[id] = index + 1;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
_proto._findChildAtPosition = function _findChildAtPosition(line, col) {
|
||||
var found = undefined;
|
||||
this.each(function (node) {
|
||||
if (node.atPosition) {
|
||||
var foundChild = node.atPosition(line, col);
|
||||
if (foundChild) {
|
||||
found = foundChild;
|
||||
return false;
|
||||
}
|
||||
} else if (node.isAtPosition(line, col)) {
|
||||
found = node;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the most specific node at the line and column number given.
|
||||
* The source location is based on the original parsed location, locations aren't
|
||||
* updated as selector nodes are mutated.
|
||||
*
|
||||
* Note that this location is relative to the location of the first character
|
||||
* of the selector, and not the location of the selector in the overall document
|
||||
* when used in conjunction with postcss.
|
||||
*
|
||||
* If not found, returns undefined.
|
||||
* @param {number} line The line number of the node to find. (1-based index)
|
||||
* @param {number} col The column number of the node to find. (1-based index)
|
||||
*/;
|
||||
_proto.atPosition = function atPosition(line, col) {
|
||||
if (this.isAtPosition(line, col)) {
|
||||
return this._findChildAtPosition(line, col) || this;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
_proto._inferEndPosition = function _inferEndPosition() {
|
||||
if (this.last && this.last.source && this.last.source.end) {
|
||||
this.source = this.source || {};
|
||||
this.source.end = this.source.end || {};
|
||||
Object.assign(this.source.end, this.last.source.end);
|
||||
}
|
||||
};
|
||||
_proto.each = function each(callback) {
|
||||
if (!this.lastEach) {
|
||||
this.lastEach = 0;
|
||||
}
|
||||
if (!this.indexes) {
|
||||
this.indexes = {};
|
||||
}
|
||||
this.lastEach++;
|
||||
var id = this.lastEach;
|
||||
this.indexes[id] = 0;
|
||||
if (!this.length) {
|
||||
return undefined;
|
||||
}
|
||||
var index, result;
|
||||
while (this.indexes[id] < this.length) {
|
||||
index = this.indexes[id];
|
||||
result = callback(this.at(index), index);
|
||||
if (result === false) {
|
||||
break;
|
||||
}
|
||||
this.indexes[id] += 1;
|
||||
}
|
||||
delete this.indexes[id];
|
||||
if (result === false) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
_proto.walk = function walk(callback) {
|
||||
return this.each(function (node, i) {
|
||||
var result = callback(node, i);
|
||||
if (result !== false && node.length) {
|
||||
result = node.walk(callback);
|
||||
}
|
||||
if (result === false) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.walkAttributes = function walkAttributes(callback) {
|
||||
var _this2 = this;
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.ATTRIBUTE) {
|
||||
return callback.call(_this2, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.walkClasses = function walkClasses(callback) {
|
||||
var _this3 = this;
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.CLASS) {
|
||||
return callback.call(_this3, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.walkCombinators = function walkCombinators(callback) {
|
||||
var _this4 = this;
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.COMBINATOR) {
|
||||
return callback.call(_this4, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.walkComments = function walkComments(callback) {
|
||||
var _this5 = this;
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.COMMENT) {
|
||||
return callback.call(_this5, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.walkIds = function walkIds(callback) {
|
||||
var _this6 = this;
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.ID) {
|
||||
return callback.call(_this6, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.walkNesting = function walkNesting(callback) {
|
||||
var _this7 = this;
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.NESTING) {
|
||||
return callback.call(_this7, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.walkPseudos = function walkPseudos(callback) {
|
||||
var _this8 = this;
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.PSEUDO) {
|
||||
return callback.call(_this8, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.walkTags = function walkTags(callback) {
|
||||
var _this9 = this;
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.TAG) {
|
||||
return callback.call(_this9, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.walkUniversals = function walkUniversals(callback) {
|
||||
var _this10 = this;
|
||||
return this.walk(function (selector) {
|
||||
if (selector.type === types.UNIVERSAL) {
|
||||
return callback.call(_this10, selector);
|
||||
}
|
||||
});
|
||||
};
|
||||
_proto.split = function split(callback) {
|
||||
var _this11 = this;
|
||||
var current = [];
|
||||
return this.reduce(function (memo, node, index) {
|
||||
var split = callback.call(_this11, node);
|
||||
current.push(node);
|
||||
if (split) {
|
||||
memo.push(current);
|
||||
current = [];
|
||||
} else if (index === _this11.length - 1) {
|
||||
memo.push(current);
|
||||
}
|
||||
return memo;
|
||||
}, []);
|
||||
};
|
||||
_proto.map = function map(callback) {
|
||||
return this.nodes.map(callback);
|
||||
};
|
||||
_proto.reduce = function reduce(callback, memo) {
|
||||
return this.nodes.reduce(callback, memo);
|
||||
};
|
||||
_proto.every = function every(callback) {
|
||||
return this.nodes.every(callback);
|
||||
};
|
||||
_proto.some = function some(callback) {
|
||||
return this.nodes.some(callback);
|
||||
};
|
||||
_proto.filter = function filter(callback) {
|
||||
return this.nodes.filter(callback);
|
||||
};
|
||||
_proto.sort = function sort(callback) {
|
||||
return this.nodes.sort(callback);
|
||||
};
|
||||
_proto.toString = function toString() {
|
||||
return this.map(String).join('');
|
||||
};
|
||||
_createClass(Container, [{
|
||||
key: "first",
|
||||
get: function get() {
|
||||
return this.at(0);
|
||||
}
|
||||
}, {
|
||||
key: "last",
|
||||
get: function get() {
|
||||
return this.at(this.length - 1);
|
||||
}
|
||||
}, {
|
||||
key: "length",
|
||||
get: function get() {
|
||||
return this.nodes.length;
|
||||
}
|
||||
}]);
|
||||
return Container;
|
||||
}(_node["default"]);
|
||||
exports["default"] = Container;
|
||||
module.exports = exports.default;
|
||||
58
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/guards.js
generated
vendored
Normal file
58
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/guards.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;
|
||||
exports.isContainer = isContainer;
|
||||
exports.isIdentifier = void 0;
|
||||
exports.isNamespace = isNamespace;
|
||||
exports.isNesting = void 0;
|
||||
exports.isNode = isNode;
|
||||
exports.isPseudo = void 0;
|
||||
exports.isPseudoClass = isPseudoClass;
|
||||
exports.isPseudoElement = isPseudoElement;
|
||||
exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = void 0;
|
||||
var _types = require("./types");
|
||||
var _IS_TYPE;
|
||||
var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE);
|
||||
function isNode(node) {
|
||||
return typeof node === "object" && IS_TYPE[node.type];
|
||||
}
|
||||
function isNodeType(type, node) {
|
||||
return isNode(node) && node.type === type;
|
||||
}
|
||||
var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
|
||||
exports.isAttribute = isAttribute;
|
||||
var isClassName = isNodeType.bind(null, _types.CLASS);
|
||||
exports.isClassName = isClassName;
|
||||
var isCombinator = isNodeType.bind(null, _types.COMBINATOR);
|
||||
exports.isCombinator = isCombinator;
|
||||
var isComment = isNodeType.bind(null, _types.COMMENT);
|
||||
exports.isComment = isComment;
|
||||
var isIdentifier = isNodeType.bind(null, _types.ID);
|
||||
exports.isIdentifier = isIdentifier;
|
||||
var isNesting = isNodeType.bind(null, _types.NESTING);
|
||||
exports.isNesting = isNesting;
|
||||
var isPseudo = isNodeType.bind(null, _types.PSEUDO);
|
||||
exports.isPseudo = isPseudo;
|
||||
var isRoot = isNodeType.bind(null, _types.ROOT);
|
||||
exports.isRoot = isRoot;
|
||||
var isSelector = isNodeType.bind(null, _types.SELECTOR);
|
||||
exports.isSelector = isSelector;
|
||||
var isString = isNodeType.bind(null, _types.STRING);
|
||||
exports.isString = isString;
|
||||
var isTag = isNodeType.bind(null, _types.TAG);
|
||||
exports.isTag = isTag;
|
||||
var isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
|
||||
exports.isUniversal = isUniversal;
|
||||
function isPseudoElement(node) {
|
||||
return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after" || node.value.toLowerCase() === ":first-letter" || node.value.toLowerCase() === ":first-line");
|
||||
}
|
||||
function isPseudoClass(node) {
|
||||
return isPseudo(node) && !isPseudoElement(node);
|
||||
}
|
||||
function isContainer(node) {
|
||||
return !!(isNode(node) && node.walk);
|
||||
}
|
||||
function isNamespace(node) {
|
||||
return isAttribute(node) || isTag(node);
|
||||
}
|
||||
25
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/id.js
generated
vendored
Normal file
25
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/id.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var ID = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(ID, _Node);
|
||||
function ID(opts) {
|
||||
var _this;
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.ID;
|
||||
return _this;
|
||||
}
|
||||
var _proto = ID.prototype;
|
||||
_proto.valueToString = function valueToString() {
|
||||
return '#' + _Node.prototype.valueToString.call(this);
|
||||
};
|
||||
return ID;
|
||||
}(_node["default"]);
|
||||
exports["default"] = ID;
|
||||
module.exports = exports.default;
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/index.js
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
var _types = require("./types");
|
||||
Object.keys(_types).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _types[key]) return;
|
||||
exports[key] = _types[key];
|
||||
});
|
||||
var _constructors = require("./constructors");
|
||||
Object.keys(_constructors).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _constructors[key]) return;
|
||||
exports[key] = _constructors[key];
|
||||
});
|
||||
var _guards = require("./guards");
|
||||
Object.keys(_guards).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (key in exports && exports[key] === _guards[key]) return;
|
||||
exports[key] = _guards[key];
|
||||
});
|
||||
80
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/namespace.js
generated
vendored
Normal file
80
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/namespace.js
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _cssesc = _interopRequireDefault(require("cssesc"));
|
||||
var _util = require("../util");
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Namespace = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Namespace, _Node);
|
||||
function Namespace() {
|
||||
return _Node.apply(this, arguments) || this;
|
||||
}
|
||||
var _proto = Namespace.prototype;
|
||||
_proto.qualifiedName = function qualifiedName(value) {
|
||||
if (this.namespace) {
|
||||
return this.namespaceString + "|" + value;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
_proto.valueToString = function valueToString() {
|
||||
return this.qualifiedName(_Node.prototype.valueToString.call(this));
|
||||
};
|
||||
_createClass(Namespace, [{
|
||||
key: "namespace",
|
||||
get: function get() {
|
||||
return this._namespace;
|
||||
},
|
||||
set: function set(namespace) {
|
||||
if (namespace === true || namespace === "*" || namespace === "&") {
|
||||
this._namespace = namespace;
|
||||
if (this.raws) {
|
||||
delete this.raws.namespace;
|
||||
}
|
||||
return;
|
||||
}
|
||||
var escaped = (0, _cssesc["default"])(namespace, {
|
||||
isIdentifier: true
|
||||
});
|
||||
this._namespace = namespace;
|
||||
if (escaped !== namespace) {
|
||||
(0, _util.ensureObject)(this, "raws");
|
||||
this.raws.namespace = escaped;
|
||||
} else if (this.raws) {
|
||||
delete this.raws.namespace;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "ns",
|
||||
get: function get() {
|
||||
return this._namespace;
|
||||
},
|
||||
set: function set(namespace) {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
}, {
|
||||
key: "namespaceString",
|
||||
get: function get() {
|
||||
if (this.namespace) {
|
||||
var ns = this.stringifyProperty("namespace");
|
||||
if (ns === true) {
|
||||
return '';
|
||||
} else {
|
||||
return ns;
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}]);
|
||||
return Namespace;
|
||||
}(_node["default"]);
|
||||
exports["default"] = Namespace;
|
||||
;
|
||||
module.exports = exports.default;
|
||||
22
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/nesting.js
generated
vendored
Normal file
22
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/nesting.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Nesting = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(Nesting, _Node);
|
||||
function Nesting(opts) {
|
||||
var _this;
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.NESTING;
|
||||
_this.value = '&';
|
||||
return _this;
|
||||
}
|
||||
return Nesting;
|
||||
}(_node["default"]);
|
||||
exports["default"] = Nesting;
|
||||
module.exports = exports.default;
|
||||
192
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/node.js
generated
vendored
Normal file
192
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/node.js
generated
vendored
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _util = require("../util");
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
var cloneNode = function cloneNode(obj, parent) {
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return obj;
|
||||
}
|
||||
var cloned = new obj.constructor();
|
||||
for (var i in obj) {
|
||||
if (!obj.hasOwnProperty(i)) {
|
||||
continue;
|
||||
}
|
||||
var value = obj[i];
|
||||
var type = typeof value;
|
||||
if (i === 'parent' && type === 'object') {
|
||||
if (parent) {
|
||||
cloned[i] = parent;
|
||||
}
|
||||
} else if (value instanceof Array) {
|
||||
cloned[i] = value.map(function (j) {
|
||||
return cloneNode(j, cloned);
|
||||
});
|
||||
} else {
|
||||
cloned[i] = cloneNode(value, cloned);
|
||||
}
|
||||
}
|
||||
return cloned;
|
||||
};
|
||||
var Node = /*#__PURE__*/function () {
|
||||
function Node(opts) {
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
}
|
||||
Object.assign(this, opts);
|
||||
this.spaces = this.spaces || {};
|
||||
this.spaces.before = this.spaces.before || '';
|
||||
this.spaces.after = this.spaces.after || '';
|
||||
}
|
||||
var _proto = Node.prototype;
|
||||
_proto.remove = function remove() {
|
||||
if (this.parent) {
|
||||
this.parent.removeChild(this);
|
||||
}
|
||||
this.parent = undefined;
|
||||
return this;
|
||||
};
|
||||
_proto.replaceWith = function replaceWith() {
|
||||
if (this.parent) {
|
||||
for (var index in arguments) {
|
||||
this.parent.insertBefore(this, arguments[index]);
|
||||
}
|
||||
this.remove();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
_proto.next = function next() {
|
||||
return this.parent.at(this.parent.index(this) + 1);
|
||||
};
|
||||
_proto.prev = function prev() {
|
||||
return this.parent.at(this.parent.index(this) - 1);
|
||||
};
|
||||
_proto.clone = function clone(overrides) {
|
||||
if (overrides === void 0) {
|
||||
overrides = {};
|
||||
}
|
||||
var cloned = cloneNode(this);
|
||||
for (var name in overrides) {
|
||||
cloned[name] = overrides[name];
|
||||
}
|
||||
return cloned;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
||||
* This allows non standard syntax to be appended to an existing property
|
||||
* by specifying the escaped value. By specifying the escaped value,
|
||||
* illegal characters are allowed to be directly inserted into css output.
|
||||
* @param {string} name the property to set
|
||||
* @param {any} value the unescaped value of the property
|
||||
* @param {string} valueEscaped optional. the escaped value of the property.
|
||||
*/;
|
||||
_proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
|
||||
if (!this.raws) {
|
||||
this.raws = {};
|
||||
}
|
||||
var originalValue = this[name];
|
||||
var originalEscaped = this.raws[name];
|
||||
this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
|
||||
if (originalEscaped || valueEscaped !== value) {
|
||||
this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
|
||||
} else {
|
||||
delete this.raws[name]; // delete any escaped value that was created by the setter.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
||||
* This allows the escaped value to be specified directly, allowing illegal
|
||||
* characters to be directly inserted into css output.
|
||||
* @param {string} name the property to set
|
||||
* @param {any} value the unescaped value of the property
|
||||
* @param {string} valueEscaped the escaped value of the property.
|
||||
*/;
|
||||
_proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
|
||||
if (!this.raws) {
|
||||
this.raws = {};
|
||||
}
|
||||
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
|
||||
this.raws[name] = valueEscaped;
|
||||
}
|
||||
|
||||
/**
|
||||
* When you want a value to passed through to CSS directly. This method
|
||||
* deletes the corresponding raw value causing the stringifier to fallback
|
||||
* to the unescaped value.
|
||||
* @param {string} name the property to set.
|
||||
* @param {any} value The value that is both escaped and unescaped.
|
||||
*/;
|
||||
_proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
|
||||
this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
|
||||
if (this.raws) {
|
||||
delete this.raws[name];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} line The number (starting with 1)
|
||||
* @param {number} column The column number (starting with 1)
|
||||
*/;
|
||||
_proto.isAtPosition = function isAtPosition(line, column) {
|
||||
if (this.source && this.source.start && this.source.end) {
|
||||
if (this.source.start.line > line) {
|
||||
return false;
|
||||
}
|
||||
if (this.source.end.line < line) {
|
||||
return false;
|
||||
}
|
||||
if (this.source.start.line === line && this.source.start.column > column) {
|
||||
return false;
|
||||
}
|
||||
if (this.source.end.line === line && this.source.end.column < column) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
_proto.stringifyProperty = function stringifyProperty(name) {
|
||||
return this.raws && this.raws[name] || this[name];
|
||||
};
|
||||
_proto.valueToString = function valueToString() {
|
||||
return String(this.stringifyProperty("value"));
|
||||
};
|
||||
_proto.toString = function toString() {
|
||||
return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join('');
|
||||
};
|
||||
_createClass(Node, [{
|
||||
key: "rawSpaceBefore",
|
||||
get: function get() {
|
||||
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
|
||||
if (rawSpace === undefined) {
|
||||
rawSpace = this.spaces && this.spaces.before;
|
||||
}
|
||||
return rawSpace || "";
|
||||
},
|
||||
set: function set(raw) {
|
||||
(0, _util.ensureObject)(this, "raws", "spaces");
|
||||
this.raws.spaces.before = raw;
|
||||
}
|
||||
}, {
|
||||
key: "rawSpaceAfter",
|
||||
get: function get() {
|
||||
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
|
||||
if (rawSpace === undefined) {
|
||||
rawSpace = this.spaces.after;
|
||||
}
|
||||
return rawSpace || "";
|
||||
},
|
||||
set: function set(raw) {
|
||||
(0, _util.ensureObject)(this, "raws", "spaces");
|
||||
this.raws.spaces.after = raw;
|
||||
}
|
||||
}]);
|
||||
return Node;
|
||||
}();
|
||||
exports["default"] = Node;
|
||||
module.exports = exports.default;
|
||||
26
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/pseudo.js
generated
vendored
Normal file
26
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/pseudo.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _container = _interopRequireDefault(require("./container"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Pseudo = /*#__PURE__*/function (_Container) {
|
||||
_inheritsLoose(Pseudo, _Container);
|
||||
function Pseudo(opts) {
|
||||
var _this;
|
||||
_this = _Container.call(this, opts) || this;
|
||||
_this.type = _types.PSEUDO;
|
||||
return _this;
|
||||
}
|
||||
var _proto = Pseudo.prototype;
|
||||
_proto.toString = function toString() {
|
||||
var params = this.length ? '(' + this.map(String).join(',') + ')' : '';
|
||||
return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join('');
|
||||
};
|
||||
return Pseudo;
|
||||
}(_container["default"]);
|
||||
exports["default"] = Pseudo;
|
||||
module.exports = exports.default;
|
||||
44
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/root.js
generated
vendored
Normal file
44
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/root.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _container = _interopRequireDefault(require("./container"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Root = /*#__PURE__*/function (_Container) {
|
||||
_inheritsLoose(Root, _Container);
|
||||
function Root(opts) {
|
||||
var _this;
|
||||
_this = _Container.call(this, opts) || this;
|
||||
_this.type = _types.ROOT;
|
||||
return _this;
|
||||
}
|
||||
var _proto = Root.prototype;
|
||||
_proto.toString = function toString() {
|
||||
var str = this.reduce(function (memo, selector) {
|
||||
memo.push(String(selector));
|
||||
return memo;
|
||||
}, []).join(',');
|
||||
return this.trailingComma ? str + ',' : str;
|
||||
};
|
||||
_proto.error = function error(message, options) {
|
||||
if (this._error) {
|
||||
return this._error(message, options);
|
||||
} else {
|
||||
return new Error(message);
|
||||
}
|
||||
};
|
||||
_createClass(Root, [{
|
||||
key: "errorGenerator",
|
||||
set: function set(handler) {
|
||||
this._error = handler;
|
||||
}
|
||||
}]);
|
||||
return Root;
|
||||
}(_container["default"]);
|
||||
exports["default"] = Root;
|
||||
module.exports = exports.default;
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/selector.js
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/selector.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _container = _interopRequireDefault(require("./container"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Selector = /*#__PURE__*/function (_Container) {
|
||||
_inheritsLoose(Selector, _Container);
|
||||
function Selector(opts) {
|
||||
var _this;
|
||||
_this = _Container.call(this, opts) || this;
|
||||
_this.type = _types.SELECTOR;
|
||||
return _this;
|
||||
}
|
||||
return Selector;
|
||||
}(_container["default"]);
|
||||
exports["default"] = Selector;
|
||||
module.exports = exports.default;
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/string.js
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/string.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _node = _interopRequireDefault(require("./node"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var String = /*#__PURE__*/function (_Node) {
|
||||
_inheritsLoose(String, _Node);
|
||||
function String(opts) {
|
||||
var _this;
|
||||
_this = _Node.call(this, opts) || this;
|
||||
_this.type = _types.STRING;
|
||||
return _this;
|
||||
}
|
||||
return String;
|
||||
}(_node["default"]);
|
||||
exports["default"] = String;
|
||||
module.exports = exports.default;
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/tag.js
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/tag.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _namespace = _interopRequireDefault(require("./namespace"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Tag = /*#__PURE__*/function (_Namespace) {
|
||||
_inheritsLoose(Tag, _Namespace);
|
||||
function Tag(opts) {
|
||||
var _this;
|
||||
_this = _Namespace.call(this, opts) || this;
|
||||
_this.type = _types.TAG;
|
||||
return _this;
|
||||
}
|
||||
return Tag;
|
||||
}(_namespace["default"]);
|
||||
exports["default"] = Tag;
|
||||
module.exports = exports.default;
|
||||
28
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/types.js
generated
vendored
Normal file
28
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.UNIVERSAL = exports.TAG = exports.STRING = exports.SELECTOR = exports.ROOT = exports.PSEUDO = exports.NESTING = exports.ID = exports.COMMENT = exports.COMBINATOR = exports.CLASS = exports.ATTRIBUTE = void 0;
|
||||
var TAG = 'tag';
|
||||
exports.TAG = TAG;
|
||||
var STRING = 'string';
|
||||
exports.STRING = STRING;
|
||||
var SELECTOR = 'selector';
|
||||
exports.SELECTOR = SELECTOR;
|
||||
var ROOT = 'root';
|
||||
exports.ROOT = ROOT;
|
||||
var PSEUDO = 'pseudo';
|
||||
exports.PSEUDO = PSEUDO;
|
||||
var NESTING = 'nesting';
|
||||
exports.NESTING = NESTING;
|
||||
var ID = 'id';
|
||||
exports.ID = ID;
|
||||
var COMMENT = 'comment';
|
||||
exports.COMMENT = COMMENT;
|
||||
var COMBINATOR = 'combinator';
|
||||
exports.COMBINATOR = COMBINATOR;
|
||||
var CLASS = 'class';
|
||||
exports.CLASS = CLASS;
|
||||
var ATTRIBUTE = 'attribute';
|
||||
exports.ATTRIBUTE = ATTRIBUTE;
|
||||
var UNIVERSAL = 'universal';
|
||||
exports.UNIVERSAL = UNIVERSAL;
|
||||
22
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/universal.js
generated
vendored
Normal file
22
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/selectors/universal.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = void 0;
|
||||
var _namespace = _interopRequireDefault(require("./namespace"));
|
||||
var _types = require("./types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
var Universal = /*#__PURE__*/function (_Namespace) {
|
||||
_inheritsLoose(Universal, _Namespace);
|
||||
function Universal(opts) {
|
||||
var _this;
|
||||
_this = _Namespace.call(this, opts) || this;
|
||||
_this.type = _types.UNIVERSAL;
|
||||
_this.value = '*';
|
||||
return _this;
|
||||
}
|
||||
return Universal;
|
||||
}(_namespace["default"]);
|
||||
exports["default"] = Universal;
|
||||
module.exports = exports.default;
|
||||
11
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/sortAscending.js
generated
vendored
Normal file
11
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/sortAscending.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = sortAscending;
|
||||
function sortAscending(list) {
|
||||
return list.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
}
|
||||
;
|
||||
module.exports = exports.default;
|
||||
70
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/tokenTypes.js
generated
vendored
Normal file
70
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/tokenTypes.js
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.word = exports.tilde = exports.tab = exports.str = exports.space = exports.slash = exports.singleQuote = exports.semicolon = exports.plus = exports.pipe = exports.openSquare = exports.openParenthesis = exports.newline = exports.greaterThan = exports.feed = exports.equals = exports.doubleQuote = exports.dollar = exports.cr = exports.comment = exports.comma = exports.combinator = exports.colon = exports.closeSquare = exports.closeParenthesis = exports.caret = exports.bang = exports.backslash = exports.at = exports.asterisk = exports.ampersand = void 0;
|
||||
var ampersand = 38; // `&`.charCodeAt(0);
|
||||
exports.ampersand = ampersand;
|
||||
var asterisk = 42; // `*`.charCodeAt(0);
|
||||
exports.asterisk = asterisk;
|
||||
var at = 64; // `@`.charCodeAt(0);
|
||||
exports.at = at;
|
||||
var comma = 44; // `,`.charCodeAt(0);
|
||||
exports.comma = comma;
|
||||
var colon = 58; // `:`.charCodeAt(0);
|
||||
exports.colon = colon;
|
||||
var semicolon = 59; // `;`.charCodeAt(0);
|
||||
exports.semicolon = semicolon;
|
||||
var openParenthesis = 40; // `(`.charCodeAt(0);
|
||||
exports.openParenthesis = openParenthesis;
|
||||
var closeParenthesis = 41; // `)`.charCodeAt(0);
|
||||
exports.closeParenthesis = closeParenthesis;
|
||||
var openSquare = 91; // `[`.charCodeAt(0);
|
||||
exports.openSquare = openSquare;
|
||||
var closeSquare = 93; // `]`.charCodeAt(0);
|
||||
exports.closeSquare = closeSquare;
|
||||
var dollar = 36; // `$`.charCodeAt(0);
|
||||
exports.dollar = dollar;
|
||||
var tilde = 126; // `~`.charCodeAt(0);
|
||||
exports.tilde = tilde;
|
||||
var caret = 94; // `^`.charCodeAt(0);
|
||||
exports.caret = caret;
|
||||
var plus = 43; // `+`.charCodeAt(0);
|
||||
exports.plus = plus;
|
||||
var equals = 61; // `=`.charCodeAt(0);
|
||||
exports.equals = equals;
|
||||
var pipe = 124; // `|`.charCodeAt(0);
|
||||
exports.pipe = pipe;
|
||||
var greaterThan = 62; // `>`.charCodeAt(0);
|
||||
exports.greaterThan = greaterThan;
|
||||
var space = 32; // ` `.charCodeAt(0);
|
||||
exports.space = space;
|
||||
var singleQuote = 39; // `'`.charCodeAt(0);
|
||||
exports.singleQuote = singleQuote;
|
||||
var doubleQuote = 34; // `"`.charCodeAt(0);
|
||||
exports.doubleQuote = doubleQuote;
|
||||
var slash = 47; // `/`.charCodeAt(0);
|
||||
exports.slash = slash;
|
||||
var bang = 33; // `!`.charCodeAt(0);
|
||||
exports.bang = bang;
|
||||
var backslash = 92; // '\\'.charCodeAt(0);
|
||||
exports.backslash = backslash;
|
||||
var cr = 13; // '\r'.charCodeAt(0);
|
||||
exports.cr = cr;
|
||||
var feed = 12; // '\f'.charCodeAt(0);
|
||||
exports.feed = feed;
|
||||
var newline = 10; // '\n'.charCodeAt(0);
|
||||
exports.newline = newline;
|
||||
var tab = 9; // '\t'.charCodeAt(0);
|
||||
|
||||
// Expose aliases primarily for readability.
|
||||
exports.tab = tab;
|
||||
var str = singleQuote;
|
||||
|
||||
// No good single character representation!
|
||||
exports.str = str;
|
||||
var comment = -1;
|
||||
exports.comment = comment;
|
||||
var word = -2;
|
||||
exports.word = word;
|
||||
var combinator = -3;
|
||||
exports.combinator = combinator;
|
||||
239
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/tokenize.js
generated
vendored
Normal file
239
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/tokenize.js
generated
vendored
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.FIELDS = void 0;
|
||||
exports["default"] = tokenize;
|
||||
var t = _interopRequireWildcard(require("./tokenTypes"));
|
||||
var _unescapable, _wordDelimiters;
|
||||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
||||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
var unescapable = (_unescapable = {}, _unescapable[t.tab] = true, _unescapable[t.newline] = true, _unescapable[t.cr] = true, _unescapable[t.feed] = true, _unescapable);
|
||||
var wordDelimiters = (_wordDelimiters = {}, _wordDelimiters[t.space] = true, _wordDelimiters[t.tab] = true, _wordDelimiters[t.newline] = true, _wordDelimiters[t.cr] = true, _wordDelimiters[t.feed] = true, _wordDelimiters[t.ampersand] = true, _wordDelimiters[t.asterisk] = true, _wordDelimiters[t.bang] = true, _wordDelimiters[t.comma] = true, _wordDelimiters[t.colon] = true, _wordDelimiters[t.semicolon] = true, _wordDelimiters[t.openParenthesis] = true, _wordDelimiters[t.closeParenthesis] = true, _wordDelimiters[t.openSquare] = true, _wordDelimiters[t.closeSquare] = true, _wordDelimiters[t.singleQuote] = true, _wordDelimiters[t.doubleQuote] = true, _wordDelimiters[t.plus] = true, _wordDelimiters[t.pipe] = true, _wordDelimiters[t.tilde] = true, _wordDelimiters[t.greaterThan] = true, _wordDelimiters[t.equals] = true, _wordDelimiters[t.dollar] = true, _wordDelimiters[t.caret] = true, _wordDelimiters[t.slash] = true, _wordDelimiters);
|
||||
var hex = {};
|
||||
var hexChars = "0123456789abcdefABCDEF";
|
||||
for (var i = 0; i < hexChars.length; i++) {
|
||||
hex[hexChars.charCodeAt(i)] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last index of the bar css word
|
||||
* @param {string} css The string in which the word begins
|
||||
* @param {number} start The index into the string where word's first letter occurs
|
||||
*/
|
||||
function consumeWord(css, start) {
|
||||
var next = start;
|
||||
var code;
|
||||
do {
|
||||
code = css.charCodeAt(next);
|
||||
if (wordDelimiters[code]) {
|
||||
return next - 1;
|
||||
} else if (code === t.backslash) {
|
||||
next = consumeEscape(css, next) + 1;
|
||||
} else {
|
||||
// All other characters are part of the word
|
||||
next++;
|
||||
}
|
||||
} while (next < css.length);
|
||||
return next - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last index of the escape sequence
|
||||
* @param {string} css The string in which the sequence begins
|
||||
* @param {number} start The index into the string where escape character (`\`) occurs.
|
||||
*/
|
||||
function consumeEscape(css, start) {
|
||||
var next = start;
|
||||
var code = css.charCodeAt(next + 1);
|
||||
if (unescapable[code]) {
|
||||
// just consume the escape char
|
||||
} else if (hex[code]) {
|
||||
var hexDigits = 0;
|
||||
// consume up to 6 hex chars
|
||||
do {
|
||||
next++;
|
||||
hexDigits++;
|
||||
code = css.charCodeAt(next + 1);
|
||||
} while (hex[code] && hexDigits < 6);
|
||||
// if fewer than 6 hex chars, a trailing space ends the escape
|
||||
if (hexDigits < 6 && code === t.space) {
|
||||
next++;
|
||||
}
|
||||
} else {
|
||||
// the next char is part of the current word
|
||||
next++;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
var FIELDS = {
|
||||
TYPE: 0,
|
||||
START_LINE: 1,
|
||||
START_COL: 2,
|
||||
END_LINE: 3,
|
||||
END_COL: 4,
|
||||
START_POS: 5,
|
||||
END_POS: 6
|
||||
};
|
||||
exports.FIELDS = FIELDS;
|
||||
function tokenize(input) {
|
||||
var tokens = [];
|
||||
var css = input.css.valueOf();
|
||||
var _css = css,
|
||||
length = _css.length;
|
||||
var offset = -1;
|
||||
var line = 1;
|
||||
var start = 0;
|
||||
var end = 0;
|
||||
var code, content, endColumn, endLine, escaped, escapePos, last, lines, next, nextLine, nextOffset, quote, tokenType;
|
||||
function unclosed(what, fix) {
|
||||
if (input.safe) {
|
||||
// fyi: this is never set to true.
|
||||
css += fix;
|
||||
next = css.length - 1;
|
||||
} else {
|
||||
throw input.error('Unclosed ' + what, line, start - offset, start);
|
||||
}
|
||||
}
|
||||
while (start < length) {
|
||||
code = css.charCodeAt(start);
|
||||
if (code === t.newline) {
|
||||
offset = start;
|
||||
line += 1;
|
||||
}
|
||||
switch (code) {
|
||||
case t.space:
|
||||
case t.tab:
|
||||
case t.newline:
|
||||
case t.cr:
|
||||
case t.feed:
|
||||
next = start;
|
||||
do {
|
||||
next += 1;
|
||||
code = css.charCodeAt(next);
|
||||
if (code === t.newline) {
|
||||
offset = next;
|
||||
line += 1;
|
||||
}
|
||||
} while (code === t.space || code === t.newline || code === t.tab || code === t.cr || code === t.feed);
|
||||
tokenType = t.space;
|
||||
endLine = line;
|
||||
endColumn = next - offset - 1;
|
||||
end = next;
|
||||
break;
|
||||
case t.plus:
|
||||
case t.greaterThan:
|
||||
case t.tilde:
|
||||
case t.pipe:
|
||||
next = start;
|
||||
do {
|
||||
next += 1;
|
||||
code = css.charCodeAt(next);
|
||||
} while (code === t.plus || code === t.greaterThan || code === t.tilde || code === t.pipe);
|
||||
tokenType = t.combinator;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next;
|
||||
break;
|
||||
|
||||
// Consume these characters as single tokens.
|
||||
case t.asterisk:
|
||||
case t.ampersand:
|
||||
case t.bang:
|
||||
case t.comma:
|
||||
case t.equals:
|
||||
case t.dollar:
|
||||
case t.caret:
|
||||
case t.openSquare:
|
||||
case t.closeSquare:
|
||||
case t.colon:
|
||||
case t.semicolon:
|
||||
case t.openParenthesis:
|
||||
case t.closeParenthesis:
|
||||
next = start;
|
||||
tokenType = code;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
break;
|
||||
case t.singleQuote:
|
||||
case t.doubleQuote:
|
||||
quote = code === t.singleQuote ? "'" : '"';
|
||||
next = start;
|
||||
do {
|
||||
escaped = false;
|
||||
next = css.indexOf(quote, next + 1);
|
||||
if (next === -1) {
|
||||
unclosed('quote', quote);
|
||||
}
|
||||
escapePos = next;
|
||||
while (css.charCodeAt(escapePos - 1) === t.backslash) {
|
||||
escapePos -= 1;
|
||||
escaped = !escaped;
|
||||
}
|
||||
} while (escaped);
|
||||
tokenType = t.str;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
break;
|
||||
default:
|
||||
if (code === t.slash && css.charCodeAt(start + 1) === t.asterisk) {
|
||||
next = css.indexOf('*/', start + 2) + 1;
|
||||
if (next === 0) {
|
||||
unclosed('comment', '*/');
|
||||
}
|
||||
content = css.slice(start, next + 1);
|
||||
lines = content.split('\n');
|
||||
last = lines.length - 1;
|
||||
if (last > 0) {
|
||||
nextLine = line + last;
|
||||
nextOffset = next - lines[last].length;
|
||||
} else {
|
||||
nextLine = line;
|
||||
nextOffset = offset;
|
||||
}
|
||||
tokenType = t.comment;
|
||||
line = nextLine;
|
||||
endLine = nextLine;
|
||||
endColumn = next - nextOffset;
|
||||
} else if (code === t.slash) {
|
||||
next = start;
|
||||
tokenType = code;
|
||||
endLine = line;
|
||||
endColumn = start - offset;
|
||||
end = next + 1;
|
||||
} else {
|
||||
next = consumeWord(css, start);
|
||||
tokenType = t.word;
|
||||
endLine = line;
|
||||
endColumn = next - offset;
|
||||
}
|
||||
end = next + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
// Ensure that the token structure remains consistent
|
||||
tokens.push([tokenType,
|
||||
// [0] Token type
|
||||
line,
|
||||
// [1] Starting line
|
||||
start - offset,
|
||||
// [2] Starting column
|
||||
endLine,
|
||||
// [3] Ending line
|
||||
endColumn,
|
||||
// [4] Ending column
|
||||
start,
|
||||
// [5] Start position / Source index
|
||||
end // [6] End position
|
||||
]);
|
||||
|
||||
// Reset offset for the next token
|
||||
if (nextOffset) {
|
||||
offset = nextOffset;
|
||||
nextOffset = null;
|
||||
}
|
||||
start = end;
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
17
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/ensureObject.js
generated
vendored
Normal file
17
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/ensureObject.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = ensureObject;
|
||||
function ensureObject(obj) {
|
||||
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
props[_key - 1] = arguments[_key];
|
||||
}
|
||||
while (props.length > 0) {
|
||||
var prop = props.shift();
|
||||
if (!obj[prop]) {
|
||||
obj[prop] = {};
|
||||
}
|
||||
obj = obj[prop];
|
||||
}
|
||||
}
|
||||
module.exports = exports.default;
|
||||
18
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/getProp.js
generated
vendored
Normal file
18
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/getProp.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = getProp;
|
||||
function getProp(obj) {
|
||||
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
props[_key - 1] = arguments[_key];
|
||||
}
|
||||
while (props.length > 0) {
|
||||
var prop = props.shift();
|
||||
if (!obj[prop]) {
|
||||
return undefined;
|
||||
}
|
||||
obj = obj[prop];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
module.exports = exports.default;
|
||||
13
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/index.js
generated
vendored
Normal file
13
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.unesc = exports.stripComments = exports.getProp = exports.ensureObject = void 0;
|
||||
var _unesc = _interopRequireDefault(require("./unesc"));
|
||||
exports.unesc = _unesc["default"];
|
||||
var _getProp = _interopRequireDefault(require("./getProp"));
|
||||
exports.getProp = _getProp["default"];
|
||||
var _ensureObject = _interopRequireDefault(require("./ensureObject"));
|
||||
exports.ensureObject = _ensureObject["default"];
|
||||
var _stripComments = _interopRequireDefault(require("./stripComments"));
|
||||
exports.stripComments = _stripComments["default"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/stripComments.js
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/stripComments.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = stripComments;
|
||||
function stripComments(str) {
|
||||
var s = "";
|
||||
var commentStart = str.indexOf("/*");
|
||||
var lastEnd = 0;
|
||||
while (commentStart >= 0) {
|
||||
s = s + str.slice(lastEnd, commentStart);
|
||||
var commentEnd = str.indexOf("*/", commentStart + 2);
|
||||
if (commentEnd < 0) {
|
||||
return s;
|
||||
}
|
||||
lastEnd = commentEnd + 2;
|
||||
commentStart = str.indexOf("/*", lastEnd);
|
||||
}
|
||||
s = s + str.slice(lastEnd);
|
||||
return s;
|
||||
}
|
||||
module.exports = exports.default;
|
||||
76
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/unesc.js
generated
vendored
Normal file
76
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/dist/util/unesc.js
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["default"] = unesc;
|
||||
// Many thanks for this post which made this migration much easier.
|
||||
// https://mathiasbynens.be/notes/css-escapes
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} str
|
||||
* @returns {[string, number]|undefined}
|
||||
*/
|
||||
function gobbleHex(str) {
|
||||
var lower = str.toLowerCase();
|
||||
var hex = '';
|
||||
var spaceTerminated = false;
|
||||
for (var i = 0; i < 6 && lower[i] !== undefined; i++) {
|
||||
var code = lower.charCodeAt(i);
|
||||
// check to see if we are dealing with a valid hex char [a-f|0-9]
|
||||
var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57;
|
||||
// https://drafts.csswg.org/css-syntax/#consume-escaped-code-point
|
||||
spaceTerminated = code === 32;
|
||||
if (!valid) {
|
||||
break;
|
||||
}
|
||||
hex += lower[i];
|
||||
}
|
||||
if (hex.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
var codePoint = parseInt(hex, 16);
|
||||
var isSurrogate = codePoint >= 0xD800 && codePoint <= 0xDFFF;
|
||||
// Add special case for
|
||||
// "If this number is zero, or is for a surrogate, or is greater than the maximum allowed code point"
|
||||
// https://drafts.csswg.org/css-syntax/#maximum-allowed-code-point
|
||||
if (isSurrogate || codePoint === 0x0000 || codePoint > 0x10FFFF) {
|
||||
return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
|
||||
}
|
||||
return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
|
||||
}
|
||||
var CONTAINS_ESCAPE = /\\/;
|
||||
function unesc(str) {
|
||||
var needToProcess = CONTAINS_ESCAPE.test(str);
|
||||
if (!needToProcess) {
|
||||
return str;
|
||||
}
|
||||
var ret = "";
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (str[i] === "\\") {
|
||||
var gobbled = gobbleHex(str.slice(i + 1, i + 7));
|
||||
if (gobbled !== undefined) {
|
||||
ret += gobbled[0];
|
||||
i += gobbled[1];
|
||||
continue;
|
||||
}
|
||||
|
||||
// Retain a pair of \\ if double escaped `\\\\`
|
||||
// https://github.com/postcss/postcss-selector-parser/commit/268c9a7656fb53f543dc620aa5b73a30ec3ff20e
|
||||
if (str[i + 1] === "\\") {
|
||||
ret += "\\";
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if \\ is at the end of the string retain it
|
||||
// https://github.com/postcss/postcss-selector-parser/commit/01a6b346e3612ce1ab20219acc26abdc259ccefb
|
||||
if (str.length === i + 1) {
|
||||
ret += str[i];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
ret += str[i];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
module.exports = exports.default;
|
||||
80
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/package.json
generated
vendored
Normal file
80
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"name": "postcss-selector-parser",
|
||||
"version": "6.1.2",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.11.6",
|
||||
"@babel/core": "^7.11.6",
|
||||
"@babel/eslint-parser": "^7.11.5",
|
||||
"@babel/eslint-plugin": "^7.11.5",
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
"@babel/preset-env": "^7.11.5",
|
||||
"@babel/register": "^7.11.5",
|
||||
"ava": "^5.1.0",
|
||||
"babel-plugin-add-module-exports": "^1.0.4",
|
||||
"coveralls": "^3.1.0",
|
||||
"del-cli": "^5.0.0",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"glob": "^8.0.3",
|
||||
"minimist": "^1.2.5",
|
||||
"nyc": "^15.1.0",
|
||||
"postcss": "^8.4.31",
|
||||
"semver": "^7.3.2",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "postcss-selector-parser.d.ts",
|
||||
"files": [
|
||||
"API.md",
|
||||
"CHANGELOG.md",
|
||||
"LICENSE-MIT",
|
||||
"dist",
|
||||
"postcss-selector-parser.d.ts",
|
||||
"!**/__tests__"
|
||||
],
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit --strict postcss-selector-parser.d.ts postcss-selector-parser.test.ts",
|
||||
"pretest": "eslint src && npm run typecheck",
|
||||
"prepare": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
|
||||
"lintfix": "eslint --fix src",
|
||||
"report": "nyc report --reporter=html",
|
||||
"test": "nyc ava src/__tests__/*.mjs",
|
||||
"testone": "ava"
|
||||
},
|
||||
"dependencies": {
|
||||
"cssesc": "^3.0.0",
|
||||
"util-deprecate": "^1.0.2"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"homepage": "https://github.com/postcss/postcss-selector-parser",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Ben Briggs",
|
||||
"email": "beneb.info@gmail.com",
|
||||
"url": "http://beneb.info"
|
||||
},
|
||||
{
|
||||
"name": "Chris Eppstein",
|
||||
"email": "chris@eppsteins.net",
|
||||
"url": "http://twitter.com/chriseppstein"
|
||||
}
|
||||
],
|
||||
"repository": "postcss/postcss-selector-parser",
|
||||
"ava": {
|
||||
"require": [
|
||||
"@babel/register"
|
||||
],
|
||||
"concurrency": 5,
|
||||
"timeout": "25s",
|
||||
"nodeArguments": []
|
||||
},
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/__tests__"
|
||||
]
|
||||
}
|
||||
}
|
||||
555
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/postcss-selector-parser.d.ts
generated
vendored
Normal file
555
Frontend-Learner/node_modules/tailwindcss/node_modules/postcss-selector-parser/postcss-selector-parser.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,555 @@
|
|||
// Type definitions for postcss-selector-parser 2.2.3
|
||||
// Definitions by: Chris Eppstein <chris@eppsteins.net>
|
||||
|
||||
/*~ Note that ES6 modules cannot directly export callable functions.
|
||||
*~ This file should be imported using the CommonJS-style:
|
||||
*~ import x = require('someLibrary');
|
||||
*~
|
||||
*~ Refer to the documentation to understand common
|
||||
*~ workarounds for this limitation of ES6 modules.
|
||||
*/
|
||||
|
||||
/*~ This declaration specifies that the function
|
||||
*~ is the exported object from the file
|
||||
*/
|
||||
export = parser;
|
||||
|
||||
// A type that's T but not U.
|
||||
type Diff<T, U> = T extends U ? never : T;
|
||||
|
||||
// TODO: Conditional types in TS 1.8 will really clean this up.
|
||||
declare function parser(): parser.Processor<never>;
|
||||
declare function parser<Transform>(processor: parser.AsyncProcessor<Transform>): parser.Processor<Transform, never>;
|
||||
declare function parser(processor: parser.AsyncProcessor<void>): parser.Processor<never, never>;
|
||||
declare function parser<Transform>(processor: parser.SyncProcessor<Transform>): parser.Processor<Transform>;
|
||||
declare function parser(processor: parser.SyncProcessor<void>): parser.Processor<never>;
|
||||
declare function parser<Transform>(processor?: parser.SyncProcessor<Transform> | parser.AsyncProcessor<Transform>): parser.Processor<Transform>;
|
||||
|
||||
/*~ If you want to expose types from your module as well, you can
|
||||
*~ place them in this block. Often you will want to describe the
|
||||
*~ shape of the return type of the function; that type should
|
||||
*~ be declared in here, as this example shows.
|
||||
*/
|
||||
declare namespace parser {
|
||||
/* copied from postcss -- so we don't need to add a dependency */
|
||||
type ErrorOptions = {
|
||||
plugin?: string;
|
||||
word?: string;
|
||||
index?: number
|
||||
};
|
||||
/* the bits we use of postcss.Rule, copied from postcss -- so we don't need to add a dependency */
|
||||
type PostCSSRuleNode = {
|
||||
selector: string
|
||||
/**
|
||||
* @returns postcss.CssSyntaxError but it's a complex object, caller
|
||||
* should cast to it if they have a dependency on postcss.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): Error;
|
||||
};
|
||||
/** Accepts a string */
|
||||
type Selectors = string | PostCSSRuleNode
|
||||
type ProcessorFn<ReturnType = void> = (root: parser.Root) => ReturnType;
|
||||
type SyncProcessor<Transform = void> = ProcessorFn<Transform>;
|
||||
type AsyncProcessor<Transform = void> = ProcessorFn<PromiseLike<Transform>>;
|
||||
|
||||
const TAG: "tag";
|
||||
const STRING: "string";
|
||||
const SELECTOR: "selector";
|
||||
const ROOT: "root";
|
||||
const PSEUDO: "pseudo";
|
||||
const NESTING: "nesting";
|
||||
const ID: "id";
|
||||
const COMMENT: "comment";
|
||||
const COMBINATOR: "combinator";
|
||||
const CLASS: "class";
|
||||
const ATTRIBUTE: "attribute";
|
||||
const UNIVERSAL: "universal";
|
||||
|
||||
interface NodeTypes {
|
||||
tag: Tag,
|
||||
string: String,
|
||||
selector: Selector,
|
||||
root: Root,
|
||||
pseudo: Pseudo,
|
||||
nesting: Nesting,
|
||||
id: Identifier,
|
||||
comment: Comment,
|
||||
combinator: Combinator,
|
||||
class: ClassName,
|
||||
attribute: Attribute,
|
||||
universal: Universal
|
||||
}
|
||||
|
||||
type Node = NodeTypes[keyof NodeTypes];
|
||||
|
||||
function isNode(node: any): node is Node;
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Preserve whitespace when true. Default: false;
|
||||
*/
|
||||
lossless: boolean;
|
||||
/**
|
||||
* When true and a postcss.Rule is passed, set the result of
|
||||
* processing back onto the rule when done. Default: false.
|
||||
*/
|
||||
updateSelector: boolean;
|
||||
}
|
||||
class Processor<
|
||||
TransformType = never,
|
||||
SyncSelectorsType extends Selectors | never = Selectors
|
||||
> {
|
||||
res: Root;
|
||||
readonly result: String;
|
||||
ast(selectors: Selectors, options?: Partial<Options>): Promise<Root>;
|
||||
astSync(selectors: SyncSelectorsType, options?: Partial<Options>): Root;
|
||||
transform(selectors: Selectors, options?: Partial<Options>): Promise<TransformType>;
|
||||
transformSync(selectors: SyncSelectorsType, options?: Partial<Options>): TransformType;
|
||||
process(selectors: Selectors, options?: Partial<Options>): Promise<string>;
|
||||
processSync(selectors: SyncSelectorsType, options?: Partial<Options>): string;
|
||||
}
|
||||
interface ParserOptions {
|
||||
css: string;
|
||||
error: (message: string, options: ErrorOptions) => Error;
|
||||
options: Options;
|
||||
}
|
||||
class Parser {
|
||||
input: ParserOptions;
|
||||
lossy: boolean;
|
||||
position: number;
|
||||
root: Root;
|
||||
selectors: string;
|
||||
current: Selector;
|
||||
constructor(input: ParserOptions);
|
||||
/**
|
||||
* Raises an error, if the processor is invoked on
|
||||
* a postcss Rule node, a better error message is raised.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): void;
|
||||
}
|
||||
interface NodeSource {
|
||||
start?: {
|
||||
line: number,
|
||||
column: number
|
||||
},
|
||||
end?: {
|
||||
line: number,
|
||||
column: number
|
||||
}
|
||||
}
|
||||
interface SpaceAround {
|
||||
before: string;
|
||||
after: string;
|
||||
}
|
||||
interface Spaces extends SpaceAround {
|
||||
[spaceType: string]: string | Partial<SpaceAround> | undefined;
|
||||
}
|
||||
interface NodeOptions<Value = string> {
|
||||
value: Value;
|
||||
spaces?: Partial<Spaces>;
|
||||
source?: NodeSource;
|
||||
sourceIndex?: number;
|
||||
}
|
||||
interface Base<
|
||||
Value extends string | undefined = string,
|
||||
ParentType extends Container | undefined = Container | undefined
|
||||
> {
|
||||
type: keyof NodeTypes;
|
||||
parent: ParentType;
|
||||
value: Value;
|
||||
spaces: Spaces;
|
||||
source?: NodeSource;
|
||||
sourceIndex: number;
|
||||
rawSpaceBefore: string;
|
||||
rawSpaceAfter: string;
|
||||
remove(): Node;
|
||||
replaceWith(...nodes: Node[]): Node;
|
||||
next(): Node | undefined;
|
||||
prev(): Node | undefined;
|
||||
clone(opts?: {[override: string]:any}): this;
|
||||
/**
|
||||
* Return whether this node includes the character at the position of the given line and column.
|
||||
* Returns undefined if the nodes lack sufficient source metadata to determine the position.
|
||||
* @param line 1-index based line number relative to the start of the selector.
|
||||
* @param column 1-index based column number relative to the start of the selector.
|
||||
*/
|
||||
isAtPosition(line: number, column: number): boolean | undefined;
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css,
|
||||
* this allows the escaped value to be specified directly, allowing illegal characters to be
|
||||
* directly inserted into css output.
|
||||
* @param name the property to set
|
||||
* @param value the unescaped value of the property
|
||||
* @param valueEscaped optional. the escaped value of the property.
|
||||
*/
|
||||
setPropertyAndEscape(name: string, value: any, valueEscaped: string): void;
|
||||
/**
|
||||
* When you want a value to passed through to CSS directly. This method
|
||||
* deletes the corresponding raw value causing the stringifier to fallback
|
||||
* to the unescaped value.
|
||||
* @param name the property to set.
|
||||
* @param value The value that is both escaped and unescaped.
|
||||
*/
|
||||
setPropertyWithoutEscape(name: string, value: any): void;
|
||||
/**
|
||||
* Some non-standard syntax doesn't follow normal escaping rules for css.
|
||||
* This allows non standard syntax to be appended to an existing property
|
||||
* by specifying the escaped value. By specifying the escaped value,
|
||||
* illegal characters are allowed to be directly inserted into css output.
|
||||
* @param {string} name the property to set
|
||||
* @param {any} value the unescaped value of the property
|
||||
* @param {string} valueEscaped optional. the escaped value of the property.
|
||||
*/
|
||||
appendToPropertyAndEscape(name: string, value: any, valueEscaped: string): void;
|
||||
toString(): string;
|
||||
}
|
||||
interface ContainerOptions extends NodeOptions {
|
||||
nodes?: Array<Node>;
|
||||
}
|
||||
interface Container<
|
||||
Value extends string | undefined = string,
|
||||
Child extends Node = Node
|
||||
> extends Base<Value> {
|
||||
nodes: Array<Child>;
|
||||
append(selector: Child): this;
|
||||
prepend(selector: Child): this;
|
||||
at(index: number): Child;
|
||||
/**
|
||||
* Return the most specific node at the line and column number given.
|
||||
* The source location is based on the original parsed location, locations aren't
|
||||
* updated as selector nodes are mutated.
|
||||
*
|
||||
* Note that this location is relative to the location of the first character
|
||||
* of the selector, and not the location of the selector in the overall document
|
||||
* when used in conjunction with postcss.
|
||||
*
|
||||
* If not found, returns undefined.
|
||||
* @param line The line number of the node to find. (1-based index)
|
||||
* @param col The column number of the node to find. (1-based index)
|
||||
*/
|
||||
atPosition(line: number, column: number): Child;
|
||||
index(child: Child): number;
|
||||
readonly first: Child;
|
||||
readonly last: Child;
|
||||
readonly length: number;
|
||||
removeChild(child: Child): this;
|
||||
removeAll(): this;
|
||||
empty(): this;
|
||||
insertAfter(oldNode: Child, newNode: Child): this;
|
||||
insertBefore(oldNode: Child, newNode: Child): this;
|
||||
each(callback: (node: Child, index: number) => boolean | void): boolean | undefined;
|
||||
walk(
|
||||
callback: (node: Node, index: number) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkAttributes(
|
||||
callback: (node: Attribute) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkClasses(
|
||||
callback: (node: ClassName) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkCombinators(
|
||||
callback: (node: Combinator) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkComments(
|
||||
callback: (node: Comment) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkIds(
|
||||
callback: (node: Identifier) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkNesting(
|
||||
callback: (node: Nesting) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkPseudos(
|
||||
callback: (node: Pseudo) => boolean | void
|
||||
): boolean | undefined;
|
||||
walkTags(callback: (node: Tag) => boolean | void): boolean | undefined;
|
||||
split(callback: (node: Child) => boolean): [Child[], Child[]];
|
||||
map<T>(callback: (node: Child) => T): T[];
|
||||
reduce(
|
||||
callback: (
|
||||
previousValue: Child,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => Child
|
||||
): Child;
|
||||
reduce(
|
||||
callback: (
|
||||
previousValue: Child,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => Child,
|
||||
initialValue: Child
|
||||
): Child;
|
||||
reduce<T>(
|
||||
callback: (
|
||||
previousValue: T,
|
||||
currentValue: Child,
|
||||
currentIndex: number,
|
||||
array: readonly Child[]
|
||||
) => T,
|
||||
initialValue: T
|
||||
): T;
|
||||
every(callback: (node: Child) => boolean): boolean;
|
||||
some(callback: (node: Child) => boolean): boolean;
|
||||
filter(callback: (node: Child) => boolean): Child[];
|
||||
sort(callback: (nodeA: Child, nodeB: Child) => number): Child[];
|
||||
toString(): string;
|
||||
}
|
||||
function isContainer(node: any): node is Root | Selector | Pseudo;
|
||||
|
||||
interface NamespaceOptions<Value extends string | undefined = string> extends NodeOptions<Value> {
|
||||
namespace?: string | true;
|
||||
}
|
||||
interface Namespace<Value extends string | undefined = string> extends Base<Value> {
|
||||
/** alias for namespace */
|
||||
ns: string | true;
|
||||
/**
|
||||
* namespace prefix.
|
||||
*/
|
||||
namespace: string | true;
|
||||
/**
|
||||
* If a namespace exists, prefix the value provided with it, separated by |.
|
||||
*/
|
||||
qualifiedName(value: string): string;
|
||||
/**
|
||||
* A string representing the namespace suitable for output.
|
||||
*/
|
||||
readonly namespaceString: string;
|
||||
}
|
||||
function isNamespace(node: any): node is Attribute | Tag;
|
||||
|
||||
interface Root extends Container<undefined, Selector> {
|
||||
type: "root";
|
||||
/**
|
||||
* Raises an error, if the processor is invoked on
|
||||
* a postcss Rule node, a better error message is raised.
|
||||
*/
|
||||
error(message: string, options?: ErrorOptions): Error;
|
||||
nodeAt(line: number, column: number): Node
|
||||
}
|
||||
function root(opts: ContainerOptions): Root;
|
||||
function isRoot(node: any): node is Root;
|
||||
|
||||
interface _Selector<S> extends Container<string, Diff<Node, S>> {
|
||||
type: "selector";
|
||||
}
|
||||
type Selector = _Selector<Selector>;
|
||||
function selector(opts: ContainerOptions): Selector;
|
||||
function isSelector(node: any): node is Selector;
|
||||
|
||||
interface CombinatorRaws {
|
||||
value?: string;
|
||||
spaces?: {
|
||||
before?: string;
|
||||
after?: string;
|
||||
};
|
||||
}
|
||||
interface Combinator extends Base {
|
||||
type: "combinator";
|
||||
raws?: CombinatorRaws;
|
||||
}
|
||||
function combinator(opts: NodeOptions): Combinator;
|
||||
function isCombinator(node: any): node is Combinator;
|
||||
|
||||
interface ClassName extends Base {
|
||||
type: "class";
|
||||
}
|
||||
function className(opts: NamespaceOptions): ClassName;
|
||||
function isClassName(node: any): node is ClassName;
|
||||
|
||||
type AttributeOperator = "=" | "~=" | "|=" | "^=" | "$=" | "*=";
|
||||
type QuoteMark = '"' | "'" | null;
|
||||
interface PreferredQuoteMarkOptions {
|
||||
quoteMark?: QuoteMark;
|
||||
preferCurrentQuoteMark?: boolean;
|
||||
}
|
||||
interface SmartQuoteMarkOptions extends PreferredQuoteMarkOptions {
|
||||
smart?: boolean;
|
||||
}
|
||||
interface AttributeOptions extends NamespaceOptions<string | undefined> {
|
||||
attribute: string;
|
||||
operator?: AttributeOperator;
|
||||
insensitive?: boolean;
|
||||
quoteMark?: QuoteMark;
|
||||
/** @deprecated Use quoteMark instead. */
|
||||
quoted?: boolean;
|
||||
spaces?: {
|
||||
before?: string;
|
||||
after?: string;
|
||||
attribute?: Partial<SpaceAround>;
|
||||
operator?: Partial<SpaceAround>;
|
||||
value?: Partial<SpaceAround>;
|
||||
insensitive?: Partial<SpaceAround>;
|
||||
}
|
||||
raws: {
|
||||
unquoted?: string;
|
||||
attribute?: string;
|
||||
operator?: string;
|
||||
value?: string;
|
||||
insensitive?: string;
|
||||
spaces?: {
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
};
|
||||
}
|
||||
interface Attribute extends Namespace<string | undefined> {
|
||||
type: "attribute";
|
||||
attribute: string;
|
||||
operator?: AttributeOperator;
|
||||
insensitive?: boolean;
|
||||
quoteMark: QuoteMark;
|
||||
quoted?: boolean;
|
||||
spaces: {
|
||||
before: string;
|
||||
after: string;
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
raws: {
|
||||
/** @deprecated The attribute value is unquoted, use that instead.. */
|
||||
unquoted?: string;
|
||||
attribute?: string;
|
||||
operator?: string;
|
||||
/** The value of the attribute with quotes and escapes. */
|
||||
value?: string;
|
||||
insensitive?: string;
|
||||
spaces?: {
|
||||
attribute?: Partial<Spaces>;
|
||||
operator?: Partial<Spaces>;
|
||||
value?: Partial<Spaces>;
|
||||
insensitive?: Partial<Spaces>;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* The attribute name after having been qualified with a namespace.
|
||||
*/
|
||||
readonly qualifiedAttribute: string;
|
||||
|
||||
/**
|
||||
* The case insensitivity flag or an empty string depending on whether this
|
||||
* attribute is case insensitive.
|
||||
*/
|
||||
readonly insensitiveFlag : 'i' | '';
|
||||
|
||||
/**
|
||||
* Returns the attribute's value quoted such that it would be legal to use
|
||||
* in the value of a css file. The original value's quotation setting
|
||||
* used for stringification is left unchanged. See `setValue(value, options)`
|
||||
* if you want to control the quote settings of a new value for the attribute or
|
||||
* `set quoteMark(mark)` if you want to change the quote settings of the current
|
||||
* value.
|
||||
*
|
||||
* You can also change the quotation used for the current value by setting quoteMark.
|
||||
**/
|
||||
getQuotedValue(options?: SmartQuoteMarkOptions): string;
|
||||
|
||||
/**
|
||||
* Set the unescaped value with the specified quotation options. The value
|
||||
* provided must not include any wrapping quote marks -- those quotes will
|
||||
* be interpreted as part of the value and escaped accordingly.
|
||||
* @param value
|
||||
*/
|
||||
setValue(value: string, options?: SmartQuoteMarkOptions): void;
|
||||
|
||||
/**
|
||||
* Intelligently select a quoteMark value based on the value's contents. If
|
||||
* the value is a legal CSS ident, it will not be quoted. Otherwise a quote
|
||||
* mark will be picked that minimizes the number of escapes.
|
||||
*
|
||||
* If there's no clear winner, the quote mark from these options is used,
|
||||
* then the source quote mark (this is inverted if `preferCurrentQuoteMark` is
|
||||
* true). If the quoteMark is unspecified, a double quote is used.
|
||||
**/
|
||||
smartQuoteMark(options: PreferredQuoteMarkOptions): QuoteMark;
|
||||
|
||||
/**
|
||||
* Selects the preferred quote mark based on the options and the current quote mark value.
|
||||
* If you want the quote mark to depend on the attribute value, call `smartQuoteMark(opts)`
|
||||
* instead.
|
||||
*/
|
||||
preferredQuoteMark(options: PreferredQuoteMarkOptions): QuoteMark
|
||||
|
||||
/**
|
||||
* returns the offset of the attribute part specified relative to the
|
||||
* start of the node of the output string.
|
||||
*
|
||||
* * "ns" - alias for "namespace"
|
||||
* * "namespace" - the namespace if it exists.
|
||||
* * "attribute" - the attribute name
|
||||
* * "attributeNS" - the start of the attribute or its namespace
|
||||
* * "operator" - the match operator of the attribute
|
||||
* * "value" - The value (string or identifier)
|
||||
* * "insensitive" - the case insensitivity flag;
|
||||
* @param part One of the possible values inside an attribute.
|
||||
* @returns -1 if the name is invalid or the value doesn't exist in this attribute.
|
||||
*/
|
||||
offsetOf(part: "ns" | "namespace" | "attribute" | "attributeNS" | "operator" | "value" | "insensitive"): number;
|
||||
}
|
||||
function attribute(opts: AttributeOptions): Attribute;
|
||||
function isAttribute(node: any): node is Attribute;
|
||||
|
||||
interface Pseudo extends Container<string, Selector> {
|
||||
type: "pseudo";
|
||||
}
|
||||
function pseudo(opts: ContainerOptions): Pseudo;
|
||||
/**
|
||||
* Checks whether the node is the Pseudo subtype of node.
|
||||
*/
|
||||
function isPseudo(node: any): node is Pseudo;
|
||||
|
||||
/**
|
||||
* Checks whether the node is, specifically, a pseudo element instead of
|
||||
* pseudo class.
|
||||
*/
|
||||
function isPseudoElement(node: any): node is Pseudo;
|
||||
|
||||
/**
|
||||
* Checks whether the node is, specifically, a pseudo class instead of
|
||||
* pseudo element.
|
||||
*/
|
||||
function isPseudoClass(node: any): node is Pseudo;
|
||||
|
||||
|
||||
interface Tag extends Namespace {
|
||||
type: "tag";
|
||||
}
|
||||
function tag(opts: NamespaceOptions): Tag;
|
||||
function isTag(node: any): node is Tag;
|
||||
|
||||
interface Comment extends Base {
|
||||
type: "comment";
|
||||
}
|
||||
function comment(opts: NodeOptions): Comment;
|
||||
function isComment(node: any): node is Comment;
|
||||
|
||||
interface Identifier extends Base {
|
||||
type: "id";
|
||||
}
|
||||
function id(opts: any): Identifier;
|
||||
function isIdentifier(node: any): node is Identifier;
|
||||
|
||||
interface Nesting extends Base {
|
||||
type: "nesting";
|
||||
}
|
||||
function nesting(opts?: any): Nesting;
|
||||
function isNesting(node: any): node is Nesting;
|
||||
|
||||
interface String extends Base {
|
||||
type: "string";
|
||||
}
|
||||
function string(opts: NodeOptions): String;
|
||||
function isString(node: any): node is String;
|
||||
|
||||
interface Universal extends Base {
|
||||
type: "universal";
|
||||
}
|
||||
function universal(opts?: NamespaceOptions): Universal;
|
||||
function isUniversal(node: any): node is Universal;
|
||||
}
|
||||
21
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/LICENSE
generated
vendored
Normal file
21
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
122
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/README.md
generated
vendored
Normal file
122
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
# readdirp [](https://github.com/paulmillr/readdirp)
|
||||
|
||||
Recursive version of [fs.readdir](https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback). Exposes a **stream API** and a **promise API**.
|
||||
|
||||
|
||||
```sh
|
||||
npm install readdirp
|
||||
```
|
||||
|
||||
```javascript
|
||||
const readdirp = require('readdirp');
|
||||
|
||||
// Use streams to achieve small RAM & CPU footprint.
|
||||
// 1) Streams example with for-await.
|
||||
for await (const entry of readdirp('.')) {
|
||||
const {path} = entry;
|
||||
console.log(`${JSON.stringify({path})}`);
|
||||
}
|
||||
|
||||
// 2) Streams example, non for-await.
|
||||
// Print out all JS files along with their size within the current folder & subfolders.
|
||||
readdirp('.', {fileFilter: '*.js', alwaysStat: true})
|
||||
.on('data', (entry) => {
|
||||
const {path, stats: {size}} = entry;
|
||||
console.log(`${JSON.stringify({path, size})}`);
|
||||
})
|
||||
// Optionally call stream.destroy() in `warn()` in order to abort and cause 'close' to be emitted
|
||||
.on('warn', error => console.error('non-fatal error', error))
|
||||
.on('error', error => console.error('fatal error', error))
|
||||
.on('end', () => console.log('done'));
|
||||
|
||||
// 3) Promise example. More RAM and CPU than streams / for-await.
|
||||
const files = await readdirp.promise('.');
|
||||
console.log(files.map(file => file.path));
|
||||
|
||||
// Other options.
|
||||
readdirp('test', {
|
||||
fileFilter: '*.js',
|
||||
directoryFilter: ['!.git', '!*modules']
|
||||
// directoryFilter: (di) => di.basename.length === 9
|
||||
type: 'files_directories',
|
||||
depth: 1
|
||||
});
|
||||
```
|
||||
|
||||
For more examples, check out `examples` directory.
|
||||
|
||||
## API
|
||||
|
||||
`const stream = readdirp(root[, options])` — **Stream API**
|
||||
|
||||
- Reads given root recursively and returns a `stream` of [entry infos](#entryinfo)
|
||||
- Optionally can be used like `for await (const entry of stream)` with node.js 10+ (`asyncIterator`).
|
||||
- `on('data', (entry) => {})` [entry info](#entryinfo) for every file / dir.
|
||||
- `on('warn', (error) => {})` non-fatal `Error` that prevents a file / dir from being processed. Example: inaccessible to the user.
|
||||
- `on('error', (error) => {})` fatal `Error` which also ends the stream. Example: illegal options where passed.
|
||||
- `on('end')` — we are done. Called when all entries were found and no more will be emitted.
|
||||
- `on('close')` — stream is destroyed via `stream.destroy()`.
|
||||
Could be useful if you want to manually abort even on a non fatal error.
|
||||
At that point the stream is no longer `readable` and no more entries, warning or errors are emitted
|
||||
- To learn more about streams, consult the very detailed [nodejs streams documentation](https://nodejs.org/api/stream.html)
|
||||
or the [stream-handbook](https://github.com/substack/stream-handbook)
|
||||
|
||||
`const entries = await readdirp.promise(root[, options])` — **Promise API**. Returns a list of [entry infos](#entryinfo).
|
||||
|
||||
First argument is awalys `root`, path in which to start reading and recursing into subdirectories.
|
||||
|
||||
### options
|
||||
|
||||
- `fileFilter: ["*.js"]`: filter to include or exclude files. A `Function`, Glob string or Array of glob strings.
|
||||
- **Function**: a function that takes an entry info as a parameter and returns true to include or false to exclude the entry
|
||||
- **Glob string**: a string (e.g., `*.js`) which is matched using [picomatch](https://github.com/micromatch/picomatch), so go there for more
|
||||
information. Globstars (`**`) are not supported since specifying a recursive pattern for an already recursive function doesn't make sense. Negated globs (as explained in the minimatch documentation) are allowed, e.g., `!*.txt` matches everything but text files.
|
||||
- **Array of glob strings**: either need to be all inclusive or all exclusive (negated) patterns otherwise an error is thrown.
|
||||
`['*.json', '*.js']` includes all JavaScript and Json files.
|
||||
`['!.git', '!node_modules']` includes all directories except the '.git' and 'node_modules'.
|
||||
- Directories that do not pass a filter will not be recursed into.
|
||||
- `directoryFilter: ['!.git']`: filter to include/exclude directories found and to recurse into. Directories that do not pass a filter will not be recursed into.
|
||||
- `depth: 5`: depth at which to stop recursing even if more subdirectories are found
|
||||
- `type: 'files'`: determines if data events on the stream should be emitted for `'files'` (default), `'directories'`, `'files_directories'`, or `'all'`. Setting to `'all'` will also include entries for other types of file descriptors like character devices, unix sockets and named pipes.
|
||||
- `alwaysStat: false`: always return `stats` property for every file. Default is `false`, readdirp will return `Dirent` entries. Setting it to `true` can double readdir execution time - use it only when you need file `size`, `mtime` etc. Cannot be enabled on node <10.10.0.
|
||||
- `lstat: false`: include symlink entries in the stream along with files. When `true`, `fs.lstat` would be used instead of `fs.stat`
|
||||
|
||||
### `EntryInfo`
|
||||
|
||||
Has the following properties:
|
||||
|
||||
- `path: 'assets/javascripts/react.js'`: path to the file/directory (relative to given root)
|
||||
- `fullPath: '/Users/dev/projects/app/assets/javascripts/react.js'`: full path to the file/directory found
|
||||
- `basename: 'react.js'`: name of the file/directory
|
||||
- `dirent: fs.Dirent`: built-in [dir entry object](https://nodejs.org/api/fs.html#fs_class_fs_dirent) - only with `alwaysStat: false`
|
||||
- `stats: fs.Stats`: built in [stat object](https://nodejs.org/api/fs.html#fs_class_fs_stats) - only with `alwaysStat: true`
|
||||
|
||||
## Changelog
|
||||
|
||||
- 3.5 (Oct 13, 2020) disallows recursive directory-based symlinks.
|
||||
Before, it could have entered infinite loop.
|
||||
- 3.4 (Mar 19, 2020) adds support for directory-based symlinks.
|
||||
- 3.3 (Dec 6, 2019) stabilizes RAM consumption and enables perf management with `highWaterMark` option. Fixes race conditions related to `for-await` looping.
|
||||
- 3.2 (Oct 14, 2019) improves performance by 250% and makes streams implementation more idiomatic.
|
||||
- 3.1 (Jul 7, 2019) brings `bigint` support to `stat` output on Windows. This is backwards-incompatible for some cases. Be careful. It you use it incorrectly, you'll see "TypeError: Cannot mix BigInt and other types, use explicit conversions".
|
||||
- 3.0 brings huge performance improvements and stream backpressure support.
|
||||
- Upgrading 2.x to 3.x:
|
||||
- Signature changed from `readdirp(options)` to `readdirp(root, options)`
|
||||
- Replaced callback API with promise API.
|
||||
- Renamed `entryType` option to `type`
|
||||
- Renamed `entryType: 'both'` to `'files_directories'`
|
||||
- `EntryInfo`
|
||||
- Renamed `stat` to `stats`
|
||||
- Emitted only when `alwaysStat: true`
|
||||
- `dirent` is emitted instead of `stats` by default with `alwaysStat: false`
|
||||
- Renamed `name` to `basename`
|
||||
- Removed `parentDir` and `fullParentDir` properties
|
||||
- Supported node.js versions:
|
||||
- 3.x: node 8+
|
||||
- 2.x: node 0.6+
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (<https://paulmillr.com>)
|
||||
|
||||
MIT License, see [LICENSE](LICENSE) file.
|
||||
43
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/index.d.ts
generated
vendored
Normal file
43
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// TypeScript Version: 3.2
|
||||
|
||||
/// <reference types="node" lib="esnext" />
|
||||
|
||||
import * as fs from 'fs';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
declare namespace readdir {
|
||||
interface EntryInfo {
|
||||
path: string;
|
||||
fullPath: string;
|
||||
basename: string;
|
||||
stats?: fs.Stats;
|
||||
dirent?: fs.Dirent;
|
||||
}
|
||||
|
||||
interface ReaddirpOptions {
|
||||
root?: string;
|
||||
fileFilter?: string | string[] | ((entry: EntryInfo) => boolean);
|
||||
directoryFilter?: string | string[] | ((entry: EntryInfo) => boolean);
|
||||
type?: 'files' | 'directories' | 'files_directories' | 'all';
|
||||
lstat?: boolean;
|
||||
depth?: number;
|
||||
alwaysStat?: boolean;
|
||||
}
|
||||
|
||||
interface ReaddirpStream extends Readable, AsyncIterable<EntryInfo> {
|
||||
read(): EntryInfo;
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<EntryInfo>;
|
||||
}
|
||||
|
||||
function promise(
|
||||
root: string,
|
||||
options?: ReaddirpOptions
|
||||
): Promise<EntryInfo[]>;
|
||||
}
|
||||
|
||||
declare function readdir(
|
||||
root: string,
|
||||
options?: readdir.ReaddirpOptions
|
||||
): readdir.ReaddirpStream;
|
||||
|
||||
export = readdir;
|
||||
287
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/index.js
generated
vendored
Normal file
287
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,287 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const { Readable } = require('stream');
|
||||
const sysPath = require('path');
|
||||
const { promisify } = require('util');
|
||||
const picomatch = require('picomatch');
|
||||
|
||||
const readdir = promisify(fs.readdir);
|
||||
const stat = promisify(fs.stat);
|
||||
const lstat = promisify(fs.lstat);
|
||||
const realpath = promisify(fs.realpath);
|
||||
|
||||
/**
|
||||
* @typedef {Object} EntryInfo
|
||||
* @property {String} path
|
||||
* @property {String} fullPath
|
||||
* @property {fs.Stats=} stats
|
||||
* @property {fs.Dirent=} dirent
|
||||
* @property {String} basename
|
||||
*/
|
||||
|
||||
const BANG = '!';
|
||||
const RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR';
|
||||
const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP', RECURSIVE_ERROR_CODE]);
|
||||
const FILE_TYPE = 'files';
|
||||
const DIR_TYPE = 'directories';
|
||||
const FILE_DIR_TYPE = 'files_directories';
|
||||
const EVERYTHING_TYPE = 'all';
|
||||
const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
|
||||
|
||||
const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code);
|
||||
const [maj, min] = process.versions.node.split('.').slice(0, 2).map(n => Number.parseInt(n, 10));
|
||||
const wantBigintFsStats = process.platform === 'win32' && (maj > 10 || (maj === 10 && min >= 5));
|
||||
|
||||
const normalizeFilter = filter => {
|
||||
if (filter === undefined) return;
|
||||
if (typeof filter === 'function') return filter;
|
||||
|
||||
if (typeof filter === 'string') {
|
||||
const glob = picomatch(filter.trim());
|
||||
return entry => glob(entry.basename);
|
||||
}
|
||||
|
||||
if (Array.isArray(filter)) {
|
||||
const positive = [];
|
||||
const negative = [];
|
||||
for (const item of filter) {
|
||||
const trimmed = item.trim();
|
||||
if (trimmed.charAt(0) === BANG) {
|
||||
negative.push(picomatch(trimmed.slice(1)));
|
||||
} else {
|
||||
positive.push(picomatch(trimmed));
|
||||
}
|
||||
}
|
||||
|
||||
if (negative.length > 0) {
|
||||
if (positive.length > 0) {
|
||||
return entry =>
|
||||
positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename));
|
||||
}
|
||||
return entry => !negative.some(f => f(entry.basename));
|
||||
}
|
||||
return entry => positive.some(f => f(entry.basename));
|
||||
}
|
||||
};
|
||||
|
||||
class ReaddirpStream extends Readable {
|
||||
static get defaultOptions() {
|
||||
return {
|
||||
root: '.',
|
||||
/* eslint-disable no-unused-vars */
|
||||
fileFilter: (path) => true,
|
||||
directoryFilter: (path) => true,
|
||||
/* eslint-enable no-unused-vars */
|
||||
type: FILE_TYPE,
|
||||
lstat: false,
|
||||
depth: 2147483648,
|
||||
alwaysStat: false
|
||||
};
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super({
|
||||
objectMode: true,
|
||||
autoDestroy: true,
|
||||
highWaterMark: options.highWaterMark || 4096
|
||||
});
|
||||
const opts = { ...ReaddirpStream.defaultOptions, ...options };
|
||||
const { root, type } = opts;
|
||||
|
||||
this._fileFilter = normalizeFilter(opts.fileFilter);
|
||||
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
||||
|
||||
const statMethod = opts.lstat ? lstat : stat;
|
||||
// Use bigint stats if it's windows and stat() supports options (node 10+).
|
||||
if (wantBigintFsStats) {
|
||||
this._stat = path => statMethod(path, { bigint: true });
|
||||
} else {
|
||||
this._stat = statMethod;
|
||||
}
|
||||
|
||||
this._maxDepth = opts.depth;
|
||||
this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
|
||||
this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
|
||||
this._wantsEverything = type === EVERYTHING_TYPE;
|
||||
this._root = sysPath.resolve(root);
|
||||
this._isDirent = ('Dirent' in fs) && !opts.alwaysStat;
|
||||
this._statsProp = this._isDirent ? 'dirent' : 'stats';
|
||||
this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent };
|
||||
|
||||
// Launch stream with one parent, the root dir.
|
||||
this.parents = [this._exploreDir(root, 1)];
|
||||
this.reading = false;
|
||||
this.parent = undefined;
|
||||
}
|
||||
|
||||
async _read(batch) {
|
||||
if (this.reading) return;
|
||||
this.reading = true;
|
||||
|
||||
try {
|
||||
while (!this.destroyed && batch > 0) {
|
||||
const { path, depth, files = [] } = this.parent || {};
|
||||
|
||||
if (files.length > 0) {
|
||||
const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path));
|
||||
for (const entry of await Promise.all(slice)) {
|
||||
if (this.destroyed) return;
|
||||
|
||||
const entryType = await this._getEntryType(entry);
|
||||
if (entryType === 'directory' && this._directoryFilter(entry)) {
|
||||
if (depth <= this._maxDepth) {
|
||||
this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
|
||||
}
|
||||
|
||||
if (this._wantsDir) {
|
||||
this.push(entry);
|
||||
batch--;
|
||||
}
|
||||
} else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) {
|
||||
if (this._wantsFile) {
|
||||
this.push(entry);
|
||||
batch--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const parent = this.parents.pop();
|
||||
if (!parent) {
|
||||
this.push(null);
|
||||
break;
|
||||
}
|
||||
this.parent = await parent;
|
||||
if (this.destroyed) return;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.destroy(error);
|
||||
} finally {
|
||||
this.reading = false;
|
||||
}
|
||||
}
|
||||
|
||||
async _exploreDir(path, depth) {
|
||||
let files;
|
||||
try {
|
||||
files = await readdir(path, this._rdOptions);
|
||||
} catch (error) {
|
||||
this._onError(error);
|
||||
}
|
||||
return { files, depth, path };
|
||||
}
|
||||
|
||||
async _formatEntry(dirent, path) {
|
||||
let entry;
|
||||
try {
|
||||
const basename = this._isDirent ? dirent.name : dirent;
|
||||
const fullPath = sysPath.resolve(sysPath.join(path, basename));
|
||||
entry = { path: sysPath.relative(this._root, fullPath), fullPath, basename };
|
||||
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
||||
} catch (err) {
|
||||
this._onError(err);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
_onError(err) {
|
||||
if (isNormalFlowError(err) && !this.destroyed) {
|
||||
this.emit('warn', err);
|
||||
} else {
|
||||
this.destroy(err);
|
||||
}
|
||||
}
|
||||
|
||||
async _getEntryType(entry) {
|
||||
// entry may be undefined, because a warning or an error were emitted
|
||||
// and the statsProp is undefined
|
||||
const stats = entry && entry[this._statsProp];
|
||||
if (!stats) {
|
||||
return;
|
||||
}
|
||||
if (stats.isFile()) {
|
||||
return 'file';
|
||||
}
|
||||
if (stats.isDirectory()) {
|
||||
return 'directory';
|
||||
}
|
||||
if (stats && stats.isSymbolicLink()) {
|
||||
const full = entry.fullPath;
|
||||
try {
|
||||
const entryRealPath = await realpath(full);
|
||||
const entryRealPathStats = await lstat(entryRealPath);
|
||||
if (entryRealPathStats.isFile()) {
|
||||
return 'file';
|
||||
}
|
||||
if (entryRealPathStats.isDirectory()) {
|
||||
const len = entryRealPath.length;
|
||||
if (full.startsWith(entryRealPath) && full.substr(len, 1) === sysPath.sep) {
|
||||
const recursiveError = new Error(
|
||||
`Circular symlink detected: "${full}" points to "${entryRealPath}"`
|
||||
);
|
||||
recursiveError.code = RECURSIVE_ERROR_CODE;
|
||||
return this._onError(recursiveError);
|
||||
}
|
||||
return 'directory';
|
||||
}
|
||||
} catch (error) {
|
||||
this._onError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_includeAsFile(entry) {
|
||||
const stats = entry && entry[this._statsProp];
|
||||
|
||||
return stats && this._wantsEverything && !stats.isDirectory();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} ReaddirpArguments
|
||||
* @property {Function=} fileFilter
|
||||
* @property {Function=} directoryFilter
|
||||
* @property {String=} type
|
||||
* @property {Number=} depth
|
||||
* @property {String=} root
|
||||
* @property {Boolean=} lstat
|
||||
* @property {Boolean=} bigint
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main function which ends up calling readdirRec and reads all files and directories in given root recursively.
|
||||
* @param {String} root Root directory
|
||||
* @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth
|
||||
*/
|
||||
const readdirp = (root, options = {}) => {
|
||||
let type = options.entryType || options.type;
|
||||
if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility
|
||||
if (type) options.type = type;
|
||||
if (!root) {
|
||||
throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)');
|
||||
} else if (typeof root !== 'string') {
|
||||
throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)');
|
||||
} else if (type && !ALL_TYPES.includes(type)) {
|
||||
throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`);
|
||||
}
|
||||
|
||||
options.root = root;
|
||||
return new ReaddirpStream(options);
|
||||
};
|
||||
|
||||
const readdirpPromise = (root, options = {}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const files = [];
|
||||
readdirp(root, options)
|
||||
.on('data', entry => files.push(entry))
|
||||
.on('end', () => resolve(files))
|
||||
.on('error', error => reject(error));
|
||||
});
|
||||
};
|
||||
|
||||
readdirp.promise = readdirpPromise;
|
||||
readdirp.ReaddirpStream = ReaddirpStream;
|
||||
readdirp.default = readdirp;
|
||||
|
||||
module.exports = readdirp;
|
||||
122
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/package.json
generated
vendored
Normal file
122
Frontend-Learner/node_modules/tailwindcss/node_modules/readdirp/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
{
|
||||
"name": "readdirp",
|
||||
"description": "Recursive version of fs.readdir with streaming API.",
|
||||
"version": "3.6.0",
|
||||
"homepage": "https://github.com/paulmillr/readdirp",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/paulmillr/readdirp.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/paulmillr/readdirp/issues"
|
||||
},
|
||||
"author": "Thorsten Lorenz <thlorenz@gmx.de> (thlorenz.com)",
|
||||
"contributors": [
|
||||
"Thorsten Lorenz <thlorenz@gmx.de> (thlorenz.com)",
|
||||
"Paul Miller (https://paulmillr.com)"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"recursive",
|
||||
"fs",
|
||||
"stream",
|
||||
"streams",
|
||||
"readdir",
|
||||
"filesystem",
|
||||
"find",
|
||||
"filter"
|
||||
],
|
||||
"scripts": {
|
||||
"dtslint": "dtslint",
|
||||
"nyc": "nyc",
|
||||
"mocha": "mocha --exit",
|
||||
"lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .",
|
||||
"test": "npm run lint && nyc npm run mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"picomatch": "^2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14",
|
||||
"chai": "^4.2",
|
||||
"chai-subset": "^1.6",
|
||||
"dtslint": "^3.3.0",
|
||||
"eslint": "^7.0.0",
|
||||
"mocha": "^7.1.1",
|
||||
"nyc": "^15.0.0",
|
||||
"rimraf": "^3.0.0",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"html",
|
||||
"text"
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
"sourceType": "script"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"rules": {
|
||||
"array-callback-return": "error",
|
||||
"no-empty": [
|
||||
"error",
|
||||
{
|
||||
"allowEmptyCatch": true
|
||||
}
|
||||
],
|
||||
"no-else-return": [
|
||||
"error",
|
||||
{
|
||||
"allowElseIf": false
|
||||
}
|
||||
],
|
||||
"no-lonely-if": "error",
|
||||
"no-var": "error",
|
||||
"object-shorthand": "error",
|
||||
"prefer-arrow-callback": [
|
||||
"error",
|
||||
{
|
||||
"allowNamedFunctions": true
|
||||
}
|
||||
],
|
||||
"prefer-const": [
|
||||
"error",
|
||||
{
|
||||
"ignoreReadBeforeAssign": true
|
||||
}
|
||||
],
|
||||
"prefer-destructuring": [
|
||||
"error",
|
||||
{
|
||||
"object": true,
|
||||
"array": false
|
||||
}
|
||||
],
|
||||
"prefer-spread": "error",
|
||||
"prefer-template": "error",
|
||||
"radix": "error",
|
||||
"semi": "error",
|
||||
"strict": "error",
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue