Added Gulp.js for compiling SCSS stylesheets
This commit is contained in:
1619
node_modules/sass/LICENSE
generated
vendored
Normal file
1619
node_modules/sass/LICENSE
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
173
node_modules/sass/README.md
generated
vendored
Normal file
173
node_modules/sass/README.md
generated
vendored
Normal file
@ -0,0 +1,173 @@
|
||||
A pure JavaScript implementation of [Sass][sass]. **Sass makes CSS fun again**.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img width="118px" alt="Sass logo" src="https://rawgit.com/sass/sass-site/master/source/assets/img/logos/logo.svg" />
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<a href="https://www.npmjs.com/package/sass"><img width="100%" alt="npm statistics" src="https://nodei.co/npm/sass.png?downloads=true"></a>
|
||||
</td>
|
||||
<td valign="middle">
|
||||
<a href="https://github.com/sass/dart-sass/actions"><img alt="GitHub actions build status" src="https://github.com/sass/dart-sass/workflows/CI/badge.svg"></a>
|
||||
<br>
|
||||
<a href="https://ci.appveyor.com/project/nex3/dart-sass"><img alt="Appveyor build status" src="https://ci.appveyor.com/api/projects/status/84rl9hvu8uoecgef?svg=true"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
[sass]: https://sass-lang.com/
|
||||
|
||||
This package is a distribution of [Dart Sass][], compiled to pure JavaScript
|
||||
with no native code or external dependencies. It provides a command-line `sass`
|
||||
executable and a Node.js API.
|
||||
|
||||
[Dart Sass]: https://github.com/sass/dart-sass
|
||||
|
||||
* [Usage](#usage)
|
||||
* [See Also](#see-also)
|
||||
* [Behavioral Differences from Ruby Sass](#behavioral-differences-from-ruby-sass)
|
||||
|
||||
## Usage
|
||||
|
||||
You can install Sass globally using `npm install -g sass` which will provide
|
||||
access to the `sass` executable. You can also add it to your project using
|
||||
`npm install --save-dev sass`. This provides the executable as well as a
|
||||
library:
|
||||
|
||||
[npm]: https://www.npmjs.com/package/sass
|
||||
|
||||
```js
|
||||
const sass = require('sass');
|
||||
|
||||
const result = sass.compile(scssFilename);
|
||||
|
||||
// OR
|
||||
|
||||
// Note that `compileAsync()` is substantially slower than `compile()`.
|
||||
const result = await sass.compileAsync(scssFilename);
|
||||
```
|
||||
|
||||
See [the Sass website][js api] for full API documentation.
|
||||
|
||||
[js api]: https://sass-lang.com/documentation/js-api
|
||||
|
||||
### Legacy API
|
||||
|
||||
Dart Sass also supports an older JavaScript API that's fully compatible with
|
||||
[Node Sass] (with a few exceptions listed below), with support for both the
|
||||
[`render()`] and [`renderSync()`] functions. This API is considered deprecated
|
||||
and will be removed in Dart Sass 2.0.0, so it should be avoided in new projects.
|
||||
|
||||
[Node Sass]: https://github.com/sass/node-sass
|
||||
[`render()`]: https://sass-lang.com/documentation/js-api/modules#render
|
||||
[`renderSync()`]: https://sass-lang.com/documentation/js-api/modules#renderSync
|
||||
|
||||
Sass's support for the legacy JavaScript API has the following limitations:
|
||||
|
||||
* Only the `"expanded"` and `"compressed"` values of [`outputStyle`] are
|
||||
supported.
|
||||
|
||||
* Dart Sass doesn't support the [`precision`] option. Dart Sass defaults to a
|
||||
sufficiently high precision for all existing browsers, and making this
|
||||
customizable would make the code substantially less efficient.
|
||||
|
||||
* Dart Sass doesn't support the [`sourceComments`] option. Source maps are the
|
||||
recommended way of locating the origin of generated selectors.
|
||||
|
||||
[`outputStyle`]: https://sass-lang.com/documentation/js-api/interfaces/LegacySharedOptions#outputStyle
|
||||
[`precision`]: https://github.com/sass/node-sass#precision
|
||||
[`sourceComments`]: https://github.com/sass/node-sass#sourcecomments
|
||||
|
||||
## See Also
|
||||
|
||||
* [Dart Sass][], from which this package is compiled, can be used either as a
|
||||
stand-alone executable or as a Dart library. Running Dart Sass on the Dart VM
|
||||
is substantially faster than running the pure JavaScript version, so this may
|
||||
be appropriate for performance-sensitive applications. The Dart API is also
|
||||
(currently) more user-friendly than the JavaScript API. See
|
||||
[the Dart Sass README][Using Dart Sass] for details on how to use it.
|
||||
|
||||
* [Node Sass][], which is a wrapper around [LibSass][], the C++ implementation
|
||||
of Sass. Node Sass supports the same API as this package and is also faster
|
||||
(although it's usually a little slower than Dart Sass). However, it requires a
|
||||
native library which may be difficult to install, and it's generally slower to
|
||||
add features and fix bugs.
|
||||
|
||||
[Using Dart Sass]: https://github.com/sass/dart-sass#using-dart-sass
|
||||
[Node Sass]: https://www.npmjs.com/package/node-sass
|
||||
[LibSass]: https://sass-lang.com/libsass
|
||||
|
||||
## Behavioral Differences from Ruby Sass
|
||||
|
||||
There are a few intentional behavioral differences between Dart Sass and Ruby
|
||||
Sass. These are generally places where Ruby Sass has an undesired behavior, and
|
||||
it's substantially easier to implement the correct behavior than it would be to
|
||||
implement compatible behavior. These should all have tracking bugs against Ruby
|
||||
Sass to update the reference behavior.
|
||||
|
||||
1. `@extend` only accepts simple selectors, as does the second argument of
|
||||
`selector-extend()`. See [issue 1599][].
|
||||
|
||||
2. Subject selectors are not supported. See [issue 1126][].
|
||||
|
||||
3. Pseudo selector arguments are parsed as `<declaration-value>`s rather than
|
||||
having a more limited custom parsing. See [issue 2120][].
|
||||
|
||||
4. The numeric precision is set to 10. See [issue 1122][].
|
||||
|
||||
5. The indented syntax parser is more flexible: it doesn't require consistent
|
||||
indentation across the whole document. See [issue 2176][].
|
||||
|
||||
6. Colors do not support channel-by-channel arithmetic. See [issue 2144][].
|
||||
|
||||
7. Unitless numbers aren't `==` to unit numbers with the same value. In
|
||||
addition, map keys follow the same logic as `==`-equality. See
|
||||
[issue 1496][].
|
||||
|
||||
8. `rgba()` and `hsla()` alpha values with percentage units are interpreted as
|
||||
percentages. Other units are forbidden. See [issue 1525][].
|
||||
|
||||
9. Too many variable arguments passed to a function is an error. See
|
||||
[issue 1408][].
|
||||
|
||||
10. Allow `@extend` to reach outside a media query if there's an identical
|
||||
`@extend` defined outside that query. This isn't tracked explicitly, because
|
||||
it'll be irrelevant when [issue 1050][] is fixed.
|
||||
|
||||
11. Some selector pseudos containing placeholder selectors will be compiled
|
||||
where they wouldn't be in Ruby Sass. This better matches the semantics of
|
||||
the selectors in question, and is more efficient. See [issue 2228][].
|
||||
|
||||
12. The old-style `:property value` syntax is not supported in the indented
|
||||
syntax. See [issue 2245][].
|
||||
|
||||
13. The reference combinator is not supported. See [issue 303][].
|
||||
|
||||
14. Universal selector unification is symmetrical. See [issue 2247][].
|
||||
|
||||
15. `@extend` doesn't produce an error if it matches but fails to unify. See
|
||||
[issue 2250][].
|
||||
|
||||
16. Dart Sass currently only supports UTF-8 documents. We'd like to support
|
||||
more, but Dart currently doesn't support them. See [dart-lang/sdk#11744][],
|
||||
for example.
|
||||
|
||||
[issue 1599]: https://github.com/sass/sass/issues/1599
|
||||
[issue 1126]: https://github.com/sass/sass/issues/1126
|
||||
[issue 2120]: https://github.com/sass/sass/issues/2120
|
||||
[issue 1122]: https://github.com/sass/sass/issues/1122
|
||||
[issue 2176]: https://github.com/sass/sass/issues/2176
|
||||
[issue 2144]: https://github.com/sass/sass/issues/2144
|
||||
[issue 1496]: https://github.com/sass/sass/issues/1496
|
||||
[issue 1525]: https://github.com/sass/sass/issues/1525
|
||||
[issue 1408]: https://github.com/sass/sass/issues/1408
|
||||
[issue 1050]: https://github.com/sass/sass/issues/1050
|
||||
[issue 2228]: https://github.com/sass/sass/issues/2228
|
||||
[issue 2245]: https://github.com/sass/sass/issues/2245
|
||||
[issue 303]: https://github.com/sass/sass/issues/303
|
||||
[issue 2247]: https://github.com/sass/sass/issues/2247
|
||||
[issue 2250]: https://github.com/sass/sass/issues/2250
|
||||
[dart-lang/sdk#11744]: https://github.com/dart-lang/sdk/issues/11744
|
||||
|
||||
Disclaimer: this is not an official Google product.
|
15
node_modules/sass/node_modules/anymatch/LICENSE
generated
vendored
Normal file
15
node_modules/sass/node_modules/anymatch/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com)
|
||||
|
||||
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.
|
87
node_modules/sass/node_modules/anymatch/README.md
generated
vendored
Normal file
87
node_modules/sass/node_modules/anymatch/README.md
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
anymatch [](https://travis-ci.org/micromatch/anymatch) [](https://coveralls.io/r/micromatch/anymatch?branch=master)
|
||||
======
|
||||
Javascript module to match a string against a regular expression, glob, string,
|
||||
or function that takes the string as an argument and returns a truthy or falsy
|
||||
value. The matcher can also be an array of any or all of these. Useful for
|
||||
allowing a very flexible user-defined config to define things like file paths.
|
||||
|
||||
__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
```sh
|
||||
npm install anymatch
|
||||
```
|
||||
|
||||
#### anymatch(matchers, testString, [returnIndex], [options])
|
||||
* __matchers__: (_Array|String|RegExp|Function_)
|
||||
String to be directly matched, string with glob patterns, regular expression
|
||||
test, function that takes the testString as an argument and returns a truthy
|
||||
value if it should be matched, or an array of any number and mix of these types.
|
||||
* __testString__: (_String|Array_) The string to test against the matchers. If
|
||||
passed as an array, the first element of the array will be used as the
|
||||
`testString` for non-function matchers, while the entire array will be applied
|
||||
as the arguments for function matchers.
|
||||
* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options.
|
||||
* __returnIndex__: (_Boolean [optional]_) If true, return the array index of
|
||||
the first matcher that that testString matched, or -1 if no match, instead of a
|
||||
boolean result.
|
||||
|
||||
```js
|
||||
const anymatch = require('anymatch');
|
||||
|
||||
const matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string => string.includes('bar') && string.length > 10 ] ;
|
||||
|
||||
anymatch(matchers, 'path/to/file.js'); // true
|
||||
anymatch(matchers, 'path/anyjs/baz.js'); // true
|
||||
anymatch(matchers, 'path/to/foo.js'); // true
|
||||
anymatch(matchers, 'path/to/bar.js'); // true
|
||||
anymatch(matchers, 'bar.js'); // false
|
||||
|
||||
// returnIndex = true
|
||||
anymatch(matchers, 'foo.js', {returnIndex: true}); // 2
|
||||
anymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1
|
||||
|
||||
// any picomatc
|
||||
|
||||
// using globs to match directories and their children
|
||||
anymatch('node_modules', 'node_modules'); // true
|
||||
anymatch('node_modules', 'node_modules/somelib/index.js'); // false
|
||||
anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true
|
||||
anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false
|
||||
anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true
|
||||
|
||||
const matcher = anymatch(matchers);
|
||||
['foo.js', 'bar.js'].filter(matcher); // [ 'foo.js' ]
|
||||
anymatch master* ❯
|
||||
|
||||
```
|
||||
|
||||
#### anymatch(matchers)
|
||||
You can also pass in only your matcher(s) to get a curried function that has
|
||||
already been bound to the provided matching criteria. This can be used as an
|
||||
`Array#filter` callback.
|
||||
|
||||
```js
|
||||
var matcher = anymatch(matchers);
|
||||
|
||||
matcher('path/to/file.js'); // true
|
||||
matcher('path/anyjs/baz.js', true); // 1
|
||||
|
||||
['foo.js', 'bar.js'].filter(matcher); // ['foo.js']
|
||||
```
|
||||
|
||||
Changelog
|
||||
----------
|
||||
[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases)
|
||||
|
||||
- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only.
|
||||
- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information).
|
||||
- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch)
|
||||
for glob pattern matching. Issues with glob pattern matching should be
|
||||
reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues).
|
||||
|
||||
License
|
||||
-------
|
||||
[ISC](https://raw.github.com/micromatch/anymatch/master/LICENSE)
|
19
node_modules/sass/node_modules/anymatch/index.d.ts
generated
vendored
Normal file
19
node_modules/sass/node_modules/anymatch/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
type AnymatchFn = (testString: string) => boolean;
|
||||
type AnymatchPattern = string|RegExp|AnymatchFn;
|
||||
type AnymatchMatcher = AnymatchPattern|AnymatchPattern[]
|
||||
type AnymatchTester = {
|
||||
(testString: string|any[], returnIndex: true): number;
|
||||
(testString: string|any[]): boolean;
|
||||
}
|
||||
|
||||
type PicomatchOptions = {dot: boolean};
|
||||
|
||||
declare const anymatch: {
|
||||
(matchers: AnymatchMatcher): AnymatchTester;
|
||||
(matchers: AnymatchMatcher, testString: string|any[], returnIndex: true | PicomatchOptions): number;
|
||||
(matchers: AnymatchMatcher, testString: string|any[]): boolean;
|
||||
}
|
||||
|
||||
export {AnymatchMatcher as Matcher}
|
||||
export {AnymatchTester as Tester}
|
||||
export default anymatch
|
104
node_modules/sass/node_modules/anymatch/index.js
generated
vendored
Normal file
104
node_modules/sass/node_modules/anymatch/index.js
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
|
||||
const picomatch = require('picomatch');
|
||||
const normalizePath = require('normalize-path');
|
||||
|
||||
/**
|
||||
* @typedef {(testString: string) => boolean} AnymatchFn
|
||||
* @typedef {string|RegExp|AnymatchFn} AnymatchPattern
|
||||
* @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher
|
||||
*/
|
||||
const BANG = '!';
|
||||
const DEFAULT_OPTIONS = {returnIndex: false};
|
||||
const arrify = (item) => Array.isArray(item) ? item : [item];
|
||||
|
||||
/**
|
||||
* @param {AnymatchPattern} matcher
|
||||
* @param {object} options
|
||||
* @returns {AnymatchFn}
|
||||
*/
|
||||
const createPattern = (matcher, options) => {
|
||||
if (typeof matcher === 'function') {
|
||||
return matcher;
|
||||
}
|
||||
if (typeof matcher === 'string') {
|
||||
const glob = picomatch(matcher, options);
|
||||
return (string) => matcher === string || glob(string);
|
||||
}
|
||||
if (matcher instanceof RegExp) {
|
||||
return (string) => matcher.test(string);
|
||||
}
|
||||
return (string) => false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Array<Function>} patterns
|
||||
* @param {Array<Function>} negPatterns
|
||||
* @param {String|Array} args
|
||||
* @param {Boolean} returnIndex
|
||||
* @returns {boolean|number}
|
||||
*/
|
||||
const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
|
||||
const isList = Array.isArray(args);
|
||||
const _path = isList ? args[0] : args;
|
||||
if (!isList && typeof _path !== 'string') {
|
||||
throw new TypeError('anymatch: second argument must be a string: got ' +
|
||||
Object.prototype.toString.call(_path))
|
||||
}
|
||||
const path = normalizePath(_path);
|
||||
|
||||
for (let index = 0; index < negPatterns.length; index++) {
|
||||
const nglob = negPatterns[index];
|
||||
if (nglob(path)) {
|
||||
return returnIndex ? -1 : false;
|
||||
}
|
||||
}
|
||||
|
||||
const applied = isList && [path].concat(args.slice(1));
|
||||
for (let index = 0; index < patterns.length; index++) {
|
||||
const pattern = patterns[index];
|
||||
if (isList ? pattern(...applied) : pattern(path)) {
|
||||
return returnIndex ? index : true;
|
||||
}
|
||||
}
|
||||
|
||||
return returnIndex ? -1 : false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {AnymatchMatcher} matchers
|
||||
* @param {Array|string} testString
|
||||
* @param {object} options
|
||||
* @returns {boolean|number|Function}
|
||||
*/
|
||||
const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => {
|
||||
if (matchers == null) {
|
||||
throw new TypeError('anymatch: specify first argument');
|
||||
}
|
||||
const opts = typeof options === 'boolean' ? {returnIndex: options} : options;
|
||||
const returnIndex = opts.returnIndex || false;
|
||||
|
||||
// Early cache for matchers.
|
||||
const mtchers = arrify(matchers);
|
||||
const negatedGlobs = mtchers
|
||||
.filter(item => typeof item === 'string' && item.charAt(0) === BANG)
|
||||
.map(item => item.slice(1))
|
||||
.map(item => picomatch(item, opts));
|
||||
const patterns = mtchers
|
||||
.filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG))
|
||||
.map(matcher => createPattern(matcher, opts));
|
||||
|
||||
if (testString == null) {
|
||||
return (testString, ri = false) => {
|
||||
const returnIndex = typeof ri === 'boolean' ? ri : false;
|
||||
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
|
||||
};
|
||||
|
||||
anymatch.default = anymatch;
|
||||
module.exports = anymatch;
|
48
node_modules/sass/node_modules/anymatch/package.json
generated
vendored
Normal file
48
node_modules/sass/node_modules/anymatch/package.json
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "anymatch",
|
||||
"version": "3.1.2",
|
||||
"description": "Matches strings against configurable strings, globs, regular expressions, and/or functions",
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"dependencies": {
|
||||
"normalize-path": "^3.0.0",
|
||||
"picomatch": "^2.0.4"
|
||||
},
|
||||
"author": {
|
||||
"name": "Elan Shanker",
|
||||
"url": "https://github.com/es128"
|
||||
},
|
||||
"license": "ISC",
|
||||
"homepage": "https://github.com/micromatch/anymatch",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/micromatch/anymatch"
|
||||
},
|
||||
"keywords": [
|
||||
"match",
|
||||
"any",
|
||||
"string",
|
||||
"file",
|
||||
"fs",
|
||||
"list",
|
||||
"glob",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular",
|
||||
"expression",
|
||||
"function"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "nyc mocha",
|
||||
"mocha": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^6.1.3",
|
||||
"nyc": "^14.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
}
|
260
node_modules/sass/node_modules/binary-extensions/binary-extensions.json
generated
vendored
Normal file
260
node_modules/sass/node_modules/binary-extensions/binary-extensions.json
generated
vendored
Normal file
@ -0,0 +1,260 @@
|
||||
[
|
||||
"3dm",
|
||||
"3ds",
|
||||
"3g2",
|
||||
"3gp",
|
||||
"7z",
|
||||
"a",
|
||||
"aac",
|
||||
"adp",
|
||||
"ai",
|
||||
"aif",
|
||||
"aiff",
|
||||
"alz",
|
||||
"ape",
|
||||
"apk",
|
||||
"appimage",
|
||||
"ar",
|
||||
"arj",
|
||||
"asf",
|
||||
"au",
|
||||
"avi",
|
||||
"bak",
|
||||
"baml",
|
||||
"bh",
|
||||
"bin",
|
||||
"bk",
|
||||
"bmp",
|
||||
"btif",
|
||||
"bz2",
|
||||
"bzip2",
|
||||
"cab",
|
||||
"caf",
|
||||
"cgm",
|
||||
"class",
|
||||
"cmx",
|
||||
"cpio",
|
||||
"cr2",
|
||||
"cur",
|
||||
"dat",
|
||||
"dcm",
|
||||
"deb",
|
||||
"dex",
|
||||
"djvu",
|
||||
"dll",
|
||||
"dmg",
|
||||
"dng",
|
||||
"doc",
|
||||
"docm",
|
||||
"docx",
|
||||
"dot",
|
||||
"dotm",
|
||||
"dra",
|
||||
"DS_Store",
|
||||
"dsk",
|
||||
"dts",
|
||||
"dtshd",
|
||||
"dvb",
|
||||
"dwg",
|
||||
"dxf",
|
||||
"ecelp4800",
|
||||
"ecelp7470",
|
||||
"ecelp9600",
|
||||
"egg",
|
||||
"eol",
|
||||
"eot",
|
||||
"epub",
|
||||
"exe",
|
||||
"f4v",
|
||||
"fbs",
|
||||
"fh",
|
||||
"fla",
|
||||
"flac",
|
||||
"flatpak",
|
||||
"fli",
|
||||
"flv",
|
||||
"fpx",
|
||||
"fst",
|
||||
"fvt",
|
||||
"g3",
|
||||
"gh",
|
||||
"gif",
|
||||
"graffle",
|
||||
"gz",
|
||||
"gzip",
|
||||
"h261",
|
||||
"h263",
|
||||
"h264",
|
||||
"icns",
|
||||
"ico",
|
||||
"ief",
|
||||
"img",
|
||||
"ipa",
|
||||
"iso",
|
||||
"jar",
|
||||
"jpeg",
|
||||
"jpg",
|
||||
"jpgv",
|
||||
"jpm",
|
||||
"jxr",
|
||||
"key",
|
||||
"ktx",
|
||||
"lha",
|
||||
"lib",
|
||||
"lvp",
|
||||
"lz",
|
||||
"lzh",
|
||||
"lzma",
|
||||
"lzo",
|
||||
"m3u",
|
||||
"m4a",
|
||||
"m4v",
|
||||
"mar",
|
||||
"mdi",
|
||||
"mht",
|
||||
"mid",
|
||||
"midi",
|
||||
"mj2",
|
||||
"mka",
|
||||
"mkv",
|
||||
"mmr",
|
||||
"mng",
|
||||
"mobi",
|
||||
"mov",
|
||||
"movie",
|
||||
"mp3",
|
||||
"mp4",
|
||||
"mp4a",
|
||||
"mpeg",
|
||||
"mpg",
|
||||
"mpga",
|
||||
"mxu",
|
||||
"nef",
|
||||
"npx",
|
||||
"numbers",
|
||||
"nupkg",
|
||||
"o",
|
||||
"odp",
|
||||
"ods",
|
||||
"odt",
|
||||
"oga",
|
||||
"ogg",
|
||||
"ogv",
|
||||
"otf",
|
||||
"ott",
|
||||
"pages",
|
||||
"pbm",
|
||||
"pcx",
|
||||
"pdb",
|
||||
"pdf",
|
||||
"pea",
|
||||
"pgm",
|
||||
"pic",
|
||||
"png",
|
||||
"pnm",
|
||||
"pot",
|
||||
"potm",
|
||||
"potx",
|
||||
"ppa",
|
||||
"ppam",
|
||||
"ppm",
|
||||
"pps",
|
||||
"ppsm",
|
||||
"ppsx",
|
||||
"ppt",
|
||||
"pptm",
|
||||
"pptx",
|
||||
"psd",
|
||||
"pya",
|
||||
"pyc",
|
||||
"pyo",
|
||||
"pyv",
|
||||
"qt",
|
||||
"rar",
|
||||
"ras",
|
||||
"raw",
|
||||
"resources",
|
||||
"rgb",
|
||||
"rip",
|
||||
"rlc",
|
||||
"rmf",
|
||||
"rmvb",
|
||||
"rpm",
|
||||
"rtf",
|
||||
"rz",
|
||||
"s3m",
|
||||
"s7z",
|
||||
"scpt",
|
||||
"sgi",
|
||||
"shar",
|
||||
"snap",
|
||||
"sil",
|
||||
"sketch",
|
||||
"slk",
|
||||
"smv",
|
||||
"snk",
|
||||
"so",
|
||||
"stl",
|
||||
"suo",
|
||||
"sub",
|
||||
"swf",
|
||||
"tar",
|
||||
"tbz",
|
||||
"tbz2",
|
||||
"tga",
|
||||
"tgz",
|
||||
"thmx",
|
||||
"tif",
|
||||
"tiff",
|
||||
"tlz",
|
||||
"ttc",
|
||||
"ttf",
|
||||
"txz",
|
||||
"udf",
|
||||
"uvh",
|
||||
"uvi",
|
||||
"uvm",
|
||||
"uvp",
|
||||
"uvs",
|
||||
"uvu",
|
||||
"viv",
|
||||
"vob",
|
||||
"war",
|
||||
"wav",
|
||||
"wax",
|
||||
"wbmp",
|
||||
"wdp",
|
||||
"weba",
|
||||
"webm",
|
||||
"webp",
|
||||
"whl",
|
||||
"wim",
|
||||
"wm",
|
||||
"wma",
|
||||
"wmv",
|
||||
"wmx",
|
||||
"woff",
|
||||
"woff2",
|
||||
"wrm",
|
||||
"wvx",
|
||||
"xbm",
|
||||
"xif",
|
||||
"xla",
|
||||
"xlam",
|
||||
"xls",
|
||||
"xlsb",
|
||||
"xlsm",
|
||||
"xlsx",
|
||||
"xlt",
|
||||
"xltm",
|
||||
"xltx",
|
||||
"xm",
|
||||
"xmind",
|
||||
"xpi",
|
||||
"xpm",
|
||||
"xwd",
|
||||
"xz",
|
||||
"z",
|
||||
"zip",
|
||||
"zipx"
|
||||
]
|
3
node_modules/sass/node_modules/binary-extensions/binary-extensions.json.d.ts
generated
vendored
Normal file
3
node_modules/sass/node_modules/binary-extensions/binary-extensions.json.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
declare const binaryExtensionsJson: readonly string[];
|
||||
|
||||
export = binaryExtensionsJson;
|
14
node_modules/sass/node_modules/binary-extensions/index.d.ts
generated
vendored
Normal file
14
node_modules/sass/node_modules/binary-extensions/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
List of binary file extensions.
|
||||
|
||||
@example
|
||||
```
|
||||
import binaryExtensions = require('binary-extensions');
|
||||
|
||||
console.log(binaryExtensions);
|
||||
//=> ['3ds', '3g2', …]
|
||||
```
|
||||
*/
|
||||
declare const binaryExtensions: readonly string[];
|
||||
|
||||
export = binaryExtensions;
|
1
node_modules/sass/node_modules/binary-extensions/index.js
generated
vendored
Normal file
1
node_modules/sass/node_modules/binary-extensions/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('./binary-extensions.json');
|
9
node_modules/sass/node_modules/binary-extensions/license
generated
vendored
Normal file
9
node_modules/sass/node_modules/binary-extensions/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com), 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.
|
38
node_modules/sass/node_modules/binary-extensions/package.json
generated
vendored
Normal file
38
node_modules/sass/node_modules/binary-extensions/package.json
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "binary-extensions",
|
||||
"version": "2.2.0",
|
||||
"description": "List of binary file extensions",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/binary-extensions",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"binary-extensions.json",
|
||||
"binary-extensions.json.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"binary",
|
||||
"extensions",
|
||||
"extension",
|
||||
"file",
|
||||
"json",
|
||||
"list",
|
||||
"array"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
41
node_modules/sass/node_modules/binary-extensions/readme.md
generated
vendored
Normal file
41
node_modules/sass/node_modules/binary-extensions/readme.md
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
# binary-extensions
|
||||
|
||||
> List of binary file extensions
|
||||
|
||||
The list is just a [JSON file](binary-extensions.json) and can be used anywhere.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install binary-extensions
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const binaryExtensions = require('binary-extensions');
|
||||
|
||||
console.log(binaryExtensions);
|
||||
//=> ['3ds', '3g2', …]
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [is-binary-path](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file
|
||||
- [text-extensions](https://github.com/sindresorhus/text-extensions) - List of text file extensions
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-binary-extensions?utm_source=npm-binary-extensions&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
184
node_modules/sass/node_modules/braces/CHANGELOG.md
generated
vendored
Normal file
184
node_modules/sass/node_modules/braces/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,184 @@
|
||||
# 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>
|
||||
|
||||
## [3.0.0] - 2018-04-08
|
||||
|
||||
v3.0 is a complete refactor, resulting in a faster, smaller codebase, with fewer deps, and a more accurate parser and compiler.
|
||||
|
||||
**Breaking Changes**
|
||||
|
||||
- The undocumented `.makeRe` method was removed
|
||||
|
||||
**Non-breaking changes**
|
||||
|
||||
- Caching was removed
|
||||
|
||||
## [2.3.2] - 2018-04-08
|
||||
|
||||
- start refactoring
|
||||
- cover sets
|
||||
- better range handling
|
||||
|
||||
## [2.3.1] - 2018-02-17
|
||||
|
||||
- Remove unnecessary escape in Regex. (#14)
|
||||
|
||||
## [2.3.0] - 2017-10-19
|
||||
|
||||
- minor code reorganization
|
||||
- optimize regex
|
||||
- expose `maxLength` option
|
||||
|
||||
## [2.2.1] - 2017-05-30
|
||||
|
||||
- don't condense when braces contain extglobs
|
||||
|
||||
## [2.2.0] - 2017-05-28
|
||||
|
||||
- ensure word boundaries are preserved
|
||||
- fixes edge case where extglob characters precede a brace pattern
|
||||
|
||||
## [2.1.1] - 2017-04-27
|
||||
|
||||
- use snapdragon-node
|
||||
- handle edge case
|
||||
- optimizations, lint
|
||||
|
||||
## [2.0.4] - 2017-04-11
|
||||
|
||||
- pass opts to compiler
|
||||
- minor optimization in create method
|
||||
- re-write parser handlers to remove negation regex
|
||||
|
||||
## [2.0.3] - 2016-12-10
|
||||
|
||||
- use split-string
|
||||
- clear queue at the end
|
||||
- adds sequences example
|
||||
- add unit tests
|
||||
|
||||
## [2.0.2] - 2016-10-21
|
||||
|
||||
- fix comma handling in nested extglobs
|
||||
|
||||
## [2.0.1] - 2016-10-20
|
||||
|
||||
- add comments
|
||||
- more tests, ensure quotes are stripped
|
||||
|
||||
## [2.0.0] - 2016-10-19
|
||||
|
||||
- don't expand braces inside character classes
|
||||
- add quantifier pattern
|
||||
|
||||
## [1.8.5] - 2016-05-21
|
||||
|
||||
- Refactor (#10)
|
||||
|
||||
## [1.8.4] - 2016-04-20
|
||||
|
||||
- fixes https://github.com/jonschlinkert/micromatch/issues/66
|
||||
|
||||
## [1.8.0] - 2015-03-18
|
||||
|
||||
- adds exponent examples, tests
|
||||
- fixes the first example in https://github.com/jonschlinkert/micromatch/issues/38
|
||||
|
||||
## [1.6.0] - 2015-01-30
|
||||
|
||||
- optimizations, `bash` mode:
|
||||
- improve path escaping
|
||||
|
||||
## [1.5.0] - 2015-01-28
|
||||
|
||||
- Merge pull request #5 from eush77/lib-files
|
||||
|
||||
## [1.4.0] - 2015-01-24
|
||||
|
||||
- add extglob tests
|
||||
- externalize exponent function
|
||||
- better whitespace handling
|
||||
|
||||
## [1.3.0] - 2015-01-24
|
||||
|
||||
- make regex patterns explicity
|
||||
|
||||
## [1.1.0] - 2015-01-11
|
||||
|
||||
- don't create a match group with `makeRe`
|
||||
|
||||
## [1.0.0] - 2014-12-23
|
||||
|
||||
- Merge commit '97b05f5544f8348736a8efaecf5c32bbe3e2ad6e'
|
||||
- support empty brace syntax
|
||||
- better bash coverage
|
||||
- better support for regex strings
|
||||
|
||||
## [0.1.4] - 2014-11-14
|
||||
|
||||
- improve recognition of bad args, recognize mismatched argument types
|
||||
- support escaping
|
||||
- remove pathname-expansion
|
||||
- support whitespace in patterns
|
||||
|
||||
## [0.1.0]
|
||||
|
||||
- first commit
|
||||
|
||||
[2.3.2]: https://github.com/micromatch/braces/compare/2.3.1...2.3.2
|
||||
[2.3.1]: https://github.com/micromatch/braces/compare/2.3.0...2.3.1
|
||||
[2.3.0]: https://github.com/micromatch/braces/compare/2.2.1...2.3.0
|
||||
[2.2.1]: https://github.com/micromatch/braces/compare/2.2.0...2.2.1
|
||||
[2.2.0]: https://github.com/micromatch/braces/compare/2.1.1...2.2.0
|
||||
[2.1.1]: https://github.com/micromatch/braces/compare/2.1.0...2.1.1
|
||||
[2.1.0]: https://github.com/micromatch/braces/compare/2.0.4...2.1.0
|
||||
[2.0.4]: https://github.com/micromatch/braces/compare/2.0.3...2.0.4
|
||||
[2.0.3]: https://github.com/micromatch/braces/compare/2.0.2...2.0.3
|
||||
[2.0.2]: https://github.com/micromatch/braces/compare/2.0.1...2.0.2
|
||||
[2.0.1]: https://github.com/micromatch/braces/compare/2.0.0...2.0.1
|
||||
[2.0.0]: https://github.com/micromatch/braces/compare/1.8.5...2.0.0
|
||||
[1.8.5]: https://github.com/micromatch/braces/compare/1.8.4...1.8.5
|
||||
[1.8.4]: https://github.com/micromatch/braces/compare/1.8.0...1.8.4
|
||||
[1.8.0]: https://github.com/micromatch/braces/compare/1.6.0...1.8.0
|
||||
[1.6.0]: https://github.com/micromatch/braces/compare/1.5.0...1.6.0
|
||||
[1.5.0]: https://github.com/micromatch/braces/compare/1.4.0...1.5.0
|
||||
[1.4.0]: https://github.com/micromatch/braces/compare/1.3.0...1.4.0
|
||||
[1.3.0]: https://github.com/micromatch/braces/compare/1.2.0...1.3.0
|
||||
[1.2.0]: https://github.com/micromatch/braces/compare/1.1.0...1.2.0
|
||||
[1.1.0]: https://github.com/micromatch/braces/compare/1.0.0...1.1.0
|
||||
[1.0.0]: https://github.com/micromatch/braces/compare/0.1.4...1.0.0
|
||||
[0.1.4]: https://github.com/micromatch/braces/compare/0.1.0...0.1.4
|
||||
|
||||
[Unreleased]: https://github.com/micromatch/braces/compare/0.1.0...HEAD
|
||||
[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog
|
21
node_modules/sass/node_modules/braces/LICENSE
generated
vendored
Normal file
21
node_modules/sass/node_modules/braces/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2018, 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.
|
593
node_modules/sass/node_modules/braces/README.md
generated
vendored
Normal file
593
node_modules/sass/node_modules/braces/README.md
generated
vendored
Normal file
@ -0,0 +1,593 @@
|
||||
# braces [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [](https://www.npmjs.com/package/braces) [](https://npmjs.org/package/braces) [](https://npmjs.org/package/braces) [](https://travis-ci.org/micromatch/braces)
|
||||
|
||||
> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save braces
|
||||
```
|
||||
|
||||
## v3.0.0 Released!!
|
||||
|
||||
See the [changelog](CHANGELOG.md) for details.
|
||||
|
||||
## Why use braces?
|
||||
|
||||
Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters.
|
||||
|
||||
* **Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests)
|
||||
* **[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity.
|
||||
* **Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up.
|
||||
* **Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written).
|
||||
* **Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)).
|
||||
* [Supports lists](#lists) - (aka "sets") `a/{b,c}/d` => `['a/b/d', 'a/c/d']`
|
||||
* [Supports sequences](#sequences) - (aka "ranges") `{01..03}` => `['01', '02', '03']`
|
||||
* [Supports steps](#steps) - (aka "increments") `{2..10..2}` => `['2', '4', '6', '8', '10']`
|
||||
* [Supports escaping](#escaping) - To prevent evaluation of special characters.
|
||||
|
||||
## Usage
|
||||
|
||||
The main export is a function that takes one or more brace `patterns` and `options`.
|
||||
|
||||
```js
|
||||
const braces = require('braces');
|
||||
// braces(patterns[, options]);
|
||||
|
||||
console.log(braces(['{01..05}', '{a..e}']));
|
||||
//=> ['(0[1-5])', '([a-e])']
|
||||
|
||||
console.log(braces(['{01..05}', '{a..e}'], { expand: true }));
|
||||
//=> ['01', '02', '03', '04', '05', 'a', 'b', 'c', 'd', 'e']
|
||||
```
|
||||
|
||||
### Brace Expansion vs. Compilation
|
||||
|
||||
By default, brace patterns are compiled into strings that are optimized for creating regular expressions and matching.
|
||||
|
||||
**Compiled**
|
||||
|
||||
```js
|
||||
console.log(braces('a/{x,y,z}/b'));
|
||||
//=> ['a/(x|y|z)/b']
|
||||
console.log(braces(['a/{01..20}/b', 'a/{1..5}/b']));
|
||||
//=> [ 'a/(0[1-9]|1[0-9]|20)/b', 'a/([1-5])/b' ]
|
||||
```
|
||||
|
||||
**Expanded**
|
||||
|
||||
Enable brace expansion by setting the `expand` option to true, or by using [braces.expand()](#expand) (returns an array similar to what you'd expect from Bash, or `echo {1..5}`, or [minimatch](https://github.com/isaacs/minimatch)):
|
||||
|
||||
```js
|
||||
console.log(braces('a/{x,y,z}/b', { expand: true }));
|
||||
//=> ['a/x/b', 'a/y/b', 'a/z/b']
|
||||
|
||||
console.log(braces.expand('{01..10}'));
|
||||
//=> ['01','02','03','04','05','06','07','08','09','10']
|
||||
```
|
||||
|
||||
### Lists
|
||||
|
||||
Expand lists (like Bash "sets"):
|
||||
|
||||
```js
|
||||
console.log(braces('a/{foo,bar,baz}/*.js'));
|
||||
//=> ['a/(foo|bar|baz)/*.js']
|
||||
|
||||
console.log(braces.expand('a/{foo,bar,baz}/*.js'));
|
||||
//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js']
|
||||
```
|
||||
|
||||
### Sequences
|
||||
|
||||
Expand ranges of characters (like Bash "sequences"):
|
||||
|
||||
```js
|
||||
console.log(braces.expand('{1..3}')); // ['1', '2', '3']
|
||||
console.log(braces.expand('a/{1..3}/b')); // ['a/1/b', 'a/2/b', 'a/3/b']
|
||||
console.log(braces('{a..c}', { expand: true })); // ['a', 'b', 'c']
|
||||
console.log(braces('foo/{a..c}', { expand: true })); // ['foo/a', 'foo/b', 'foo/c']
|
||||
|
||||
// supports zero-padded ranges
|
||||
console.log(braces('a/{01..03}/b')); //=> ['a/(0[1-3])/b']
|
||||
console.log(braces('a/{001..300}/b')); //=> ['a/(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)/b']
|
||||
```
|
||||
|
||||
See [fill-range](https://github.com/jonschlinkert/fill-range) for all available range-expansion options.
|
||||
|
||||
### Steppped ranges
|
||||
|
||||
Steps, or increments, may be used with ranges:
|
||||
|
||||
```js
|
||||
console.log(braces.expand('{2..10..2}'));
|
||||
//=> ['2', '4', '6', '8', '10']
|
||||
|
||||
console.log(braces('{2..10..2}'));
|
||||
//=> ['(2|4|6|8|10)']
|
||||
```
|
||||
|
||||
When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion.
|
||||
|
||||
### Nesting
|
||||
|
||||
Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved.
|
||||
|
||||
**"Expanded" braces**
|
||||
|
||||
```js
|
||||
console.log(braces.expand('a{b,c,/{x,y}}/e'));
|
||||
//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e']
|
||||
|
||||
console.log(braces.expand('a/{x,{1..5},y}/c'));
|
||||
//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c']
|
||||
```
|
||||
|
||||
**"Optimized" braces**
|
||||
|
||||
```js
|
||||
console.log(braces('a{b,c,/{x,y}}/e'));
|
||||
//=> ['a(b|c|/(x|y))/e']
|
||||
|
||||
console.log(braces('a/{x,{1..5},y}/c'));
|
||||
//=> ['a/(x|([1-5])|y)/c']
|
||||
```
|
||||
|
||||
### Escaping
|
||||
|
||||
**Escaping braces**
|
||||
|
||||
A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_:
|
||||
|
||||
```js
|
||||
console.log(braces.expand('a\\{d,c,b}e'));
|
||||
//=> ['a{d,c,b}e']
|
||||
|
||||
console.log(braces.expand('a{d,c,b\\}e'));
|
||||
//=> ['a{d,c,b}e']
|
||||
```
|
||||
|
||||
**Escaping commas**
|
||||
|
||||
Commas inside braces may also be escaped:
|
||||
|
||||
```js
|
||||
console.log(braces.expand('a{b\\,c}d'));
|
||||
//=> ['a{b,c}d']
|
||||
|
||||
console.log(braces.expand('a{d\\,c,b}e'));
|
||||
//=> ['ad,ce', 'abe']
|
||||
```
|
||||
|
||||
**Single items**
|
||||
|
||||
Following bash conventions, a brace pattern is also not expanded when it contains a single character:
|
||||
|
||||
```js
|
||||
console.log(braces.expand('a{b}c'));
|
||||
//=> ['a{b}c']
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### options.maxLength
|
||||
|
||||
**Type**: `Number`
|
||||
|
||||
**Default**: `65,536`
|
||||
|
||||
**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera.
|
||||
|
||||
```js
|
||||
console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error
|
||||
```
|
||||
|
||||
### options.expand
|
||||
|
||||
**Type**: `Boolean`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
**Description**: Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method, which does the same thing).
|
||||
|
||||
```js
|
||||
console.log(braces('a/{b,c}/d', { expand: true }));
|
||||
//=> [ 'a/b/d', 'a/c/d' ]
|
||||
```
|
||||
|
||||
### options.nodupes
|
||||
|
||||
**Type**: `Boolean`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
**Description**: Remove duplicates from the returned array.
|
||||
|
||||
### options.rangeLimit
|
||||
|
||||
**Type**: `Number`
|
||||
|
||||
**Default**: `1000`
|
||||
|
||||
**Description**: To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` is used or `options.expand` is true and the generated range will exceed the `rangeLimit`.
|
||||
|
||||
You can customize `options.rangeLimit` or set it to `Inifinity` to disable this altogether.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
// pattern exceeds the "rangeLimit", so it's optimized automatically
|
||||
console.log(braces.expand('{1..1000}'));
|
||||
//=> ['([1-9]|[1-9][0-9]{1,2}|1000)']
|
||||
|
||||
// pattern does not exceed "rangeLimit", so it's NOT optimized
|
||||
console.log(braces.expand('{1..100}'));
|
||||
//=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100']
|
||||
```
|
||||
|
||||
### options.transform
|
||||
|
||||
**Type**: `Function`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
**Description**: Customize range expansion.
|
||||
|
||||
**Example: Transforming non-numeric values**
|
||||
|
||||
```js
|
||||
const alpha = braces.expand('x/{a..e}/y', {
|
||||
transform(value, index) {
|
||||
// When non-numeric values are passed, "value" is a character code.
|
||||
return 'foo/' + String.fromCharCode(value) + '-' + index;
|
||||
}
|
||||
});
|
||||
console.log(alpha);
|
||||
//=> [ 'x/foo/a-0/y', 'x/foo/b-1/y', 'x/foo/c-2/y', 'x/foo/d-3/y', 'x/foo/e-4/y' ]
|
||||
```
|
||||
|
||||
**Example: Transforming numeric values**
|
||||
|
||||
```js
|
||||
const numeric = braces.expand('{1..5}', {
|
||||
transform(value) {
|
||||
// when numeric values are passed, "value" is a number
|
||||
return 'foo/' + value * 2;
|
||||
}
|
||||
});
|
||||
console.log(numeric);
|
||||
//=> [ 'foo/2', 'foo/4', 'foo/6', 'foo/8', 'foo/10' ]
|
||||
```
|
||||
|
||||
### options.quantifiers
|
||||
|
||||
**Type**: `Boolean`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times.
|
||||
|
||||
Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists)
|
||||
|
||||
The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const braces = require('braces');
|
||||
console.log(braces('a/b{1,3}/{x,y,z}'));
|
||||
//=> [ 'a/b(1|3)/(x|y|z)' ]
|
||||
console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true}));
|
||||
//=> [ 'a/b{1,3}/(x|y|z)' ]
|
||||
console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true, expand: true}));
|
||||
//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ]
|
||||
```
|
||||
|
||||
### options.unescape
|
||||
|
||||
**Type**: `Boolean`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
**Description**: Strip backslashes that were used for escaping from the result.
|
||||
|
||||
## What is "brace expansion"?
|
||||
|
||||
Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs).
|
||||
|
||||
In addition to "expansion", braces are also used for matching. In other words:
|
||||
|
||||
* [brace expansion](#brace-expansion) is for generating new lists
|
||||
* [brace matching](#brace-matching) is for filtering existing lists
|
||||
|
||||
<details>
|
||||
<summary><strong>More about brace expansion</strong> (click to expand)</summary>
|
||||
|
||||
There are two main types of brace expansion:
|
||||
|
||||
1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}`
|
||||
2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges".
|
||||
|
||||
Here are some example brace patterns to illustrate how they work:
|
||||
|
||||
**Sets**
|
||||
|
||||
```
|
||||
{a,b,c} => a b c
|
||||
{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2
|
||||
```
|
||||
|
||||
**Sequences**
|
||||
|
||||
```
|
||||
{1..9} => 1 2 3 4 5 6 7 8 9
|
||||
{4..-4} => 4 3 2 1 0 -1 -2 -3 -4
|
||||
{1..20..3} => 1 4 7 10 13 16 19
|
||||
{a..j} => a b c d e f g h i j
|
||||
{j..a} => j i h g f e d c b a
|
||||
{a..z..3} => a d g j m p s v y
|
||||
```
|
||||
|
||||
**Combination**
|
||||
|
||||
Sets and sequences can be mixed together or used along with any other strings.
|
||||
|
||||
```
|
||||
{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3
|
||||
foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar
|
||||
```
|
||||
|
||||
The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases.
|
||||
|
||||
## Brace matching
|
||||
|
||||
In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching.
|
||||
|
||||
For example, the pattern `foo/{1..3}/bar` would match any of following strings:
|
||||
|
||||
```
|
||||
foo/1/bar
|
||||
foo/2/bar
|
||||
foo/3/bar
|
||||
```
|
||||
|
||||
But not:
|
||||
|
||||
```
|
||||
baz/1/qux
|
||||
baz/2/qux
|
||||
baz/3/qux
|
||||
```
|
||||
|
||||
Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings:
|
||||
|
||||
```
|
||||
foo/1/bar
|
||||
foo/2/bar
|
||||
foo/3/bar
|
||||
baz/1/qux
|
||||
baz/2/qux
|
||||
baz/3/qux
|
||||
```
|
||||
|
||||
## Brace matching pitfalls
|
||||
|
||||
Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of.
|
||||
|
||||
### tldr
|
||||
|
||||
**"brace bombs"**
|
||||
|
||||
* brace expansion can eat up a huge amount of processing resources
|
||||
* as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially
|
||||
* users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!)
|
||||
|
||||
For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section.
|
||||
|
||||
### The solution
|
||||
|
||||
Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries.
|
||||
|
||||
### Geometric complexity
|
||||
|
||||
At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`.
|
||||
|
||||
For example, the following sets demonstrate quadratic (`O(n^2)`) complexity:
|
||||
|
||||
```
|
||||
{1,2}{3,4} => (2X2) => 13 14 23 24
|
||||
{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246
|
||||
```
|
||||
|
||||
But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity:
|
||||
|
||||
```
|
||||
{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248
|
||||
249 257 258 259 267 268 269 347 348 349 357
|
||||
358 359 367 368 369
|
||||
```
|
||||
|
||||
Now, imagine how this complexity grows given that each element is a n-tuple:
|
||||
|
||||
```
|
||||
{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB)
|
||||
{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB)
|
||||
```
|
||||
|
||||
Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control.
|
||||
|
||||
**More information**
|
||||
|
||||
Interested in learning more about brace expansion?
|
||||
|
||||
* [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion)
|
||||
* [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion)
|
||||
* [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product)
|
||||
|
||||
</details>
|
||||
|
||||
## Performance
|
||||
|
||||
Braces is not only screaming fast, it's also more accurate the other brace expansion libraries.
|
||||
|
||||
### Better algorithms
|
||||
|
||||
Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_.
|
||||
|
||||
Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently.
|
||||
|
||||
**The proof is in the numbers**
|
||||
|
||||
Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively.
|
||||
|
||||
| **Pattern** | **braces** | **[minimatch][]** |
|
||||
| --- | --- | --- |
|
||||
| `{1..9007199254740991}`[^1] | `298 B` (5ms 459μs)| N/A (freezes) |
|
||||
| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) |
|
||||
| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) |
|
||||
| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) |
|
||||
| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) |
|
||||
| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) |
|
||||
| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) |
|
||||
| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) |
|
||||
| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) |
|
||||
| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) |
|
||||
| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) |
|
||||
| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) |
|
||||
| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) |
|
||||
| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) |
|
||||
| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) |
|
||||
| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) |
|
||||
| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) |
|
||||
|
||||
### Faster algorithms
|
||||
|
||||
When you need expansion, braces is still much faster.
|
||||
|
||||
_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_
|
||||
|
||||
| **Pattern** | **braces** | **[minimatch][]** |
|
||||
| --- | --- | --- |
|
||||
| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) |
|
||||
| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) |
|
||||
| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) |
|
||||
| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) |
|
||||
| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) |
|
||||
| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) |
|
||||
| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) |
|
||||
| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) |
|
||||
|
||||
If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js).
|
||||
|
||||
## Benchmarks
|
||||
|
||||
### Running benchmarks
|
||||
|
||||
Install dev dependencies:
|
||||
|
||||
```bash
|
||||
npm i -d && npm benchmark
|
||||
```
|
||||
|
||||
### Latest results
|
||||
|
||||
Braces is more accurate, without sacrificing performance.
|
||||
|
||||
```bash
|
||||
# range (expanded)
|
||||
braces x 29,040 ops/sec ±3.69% (91 runs sampled))
|
||||
minimatch x 4,735 ops/sec ±1.28% (90 runs sampled)
|
||||
|
||||
# range (optimized for regex)
|
||||
braces x 382,878 ops/sec ±0.56% (94 runs sampled)
|
||||
minimatch x 1,040 ops/sec ±0.44% (93 runs sampled)
|
||||
|
||||
# nested ranges (expanded)
|
||||
braces x 19,744 ops/sec ±2.27% (92 runs sampled))
|
||||
minimatch x 4,579 ops/sec ±0.50% (93 runs sampled)
|
||||
|
||||
# nested ranges (optimized for regex)
|
||||
braces x 246,019 ops/sec ±2.02% (93 runs sampled)
|
||||
minimatch x 1,028 ops/sec ±0.39% (94 runs sampled)
|
||||
|
||||
# set (expanded)
|
||||
braces x 138,641 ops/sec ±0.53% (95 runs sampled)
|
||||
minimatch x 219,582 ops/sec ±0.98% (94 runs sampled)
|
||||
|
||||
# set (optimized for regex)
|
||||
braces x 388,408 ops/sec ±0.41% (95 runs sampled)
|
||||
minimatch x 44,724 ops/sec ±0.91% (89 runs sampled)
|
||||
|
||||
# nested sets (expanded)
|
||||
braces x 84,966 ops/sec ±0.48% (94 runs sampled)
|
||||
minimatch x 140,720 ops/sec ±0.37% (95 runs sampled)
|
||||
|
||||
# nested sets (optimized for regex)
|
||||
braces x 263,340 ops/sec ±2.06% (92 runs sampled)
|
||||
minimatch x 28,714 ops/sec ±0.40% (90 runs sampled)
|
||||
```
|
||||
|
||||
## 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).
|
||||
|
||||
</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>
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 197 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 4 | [doowb](https://github.com/doowb) |
|
||||
| 1 | [es128](https://github.com/es128) |
|
||||
| 1 | [eush77](https://github.com/eush77) |
|
||||
| 1 | [hemanth](https://github.com/hemanth) |
|
||||
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._
|
170
node_modules/sass/node_modules/braces/index.js
generated
vendored
Normal file
170
node_modules/sass/node_modules/braces/index.js
generated
vendored
Normal file
@ -0,0 +1,170 @@
|
||||
'use strict';
|
||||
|
||||
const stringify = require('./lib/stringify');
|
||||
const compile = require('./lib/compile');
|
||||
const expand = require('./lib/expand');
|
||||
const parse = require('./lib/parse');
|
||||
|
||||
/**
|
||||
* Expand the given pattern or create a regex-compatible string.
|
||||
*
|
||||
* ```js
|
||||
* const braces = require('braces');
|
||||
* console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
|
||||
* console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
|
||||
* ```
|
||||
* @param {String} `str`
|
||||
* @param {Object} `options`
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
const braces = (input, options = {}) => {
|
||||
let output = [];
|
||||
|
||||
if (Array.isArray(input)) {
|
||||
for (let pattern of input) {
|
||||
let result = braces.create(pattern, options);
|
||||
if (Array.isArray(result)) {
|
||||
output.push(...result);
|
||||
} else {
|
||||
output.push(result);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
output = [].concat(braces.create(input, options));
|
||||
}
|
||||
|
||||
if (options && options.expand === true && options.nodupes === true) {
|
||||
output = [...new Set(output)];
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` with the given `options`.
|
||||
*
|
||||
* ```js
|
||||
* // braces.parse(pattern, [, options]);
|
||||
* const ast = braces.parse('a/{b,c}/d');
|
||||
* console.log(ast);
|
||||
* ```
|
||||
* @param {String} pattern Brace pattern to parse
|
||||
* @param {Object} options
|
||||
* @return {Object} Returns an AST
|
||||
* @api public
|
||||
*/
|
||||
|
||||
braces.parse = (input, options = {}) => parse(input, options);
|
||||
|
||||
/**
|
||||
* Creates a braces string from an AST, or an AST node.
|
||||
*
|
||||
* ```js
|
||||
* const braces = require('braces');
|
||||
* let ast = braces.parse('foo/{a,b}/bar');
|
||||
* console.log(stringify(ast.nodes[2])); //=> '{a,b}'
|
||||
* ```
|
||||
* @param {String} `input` Brace pattern or AST.
|
||||
* @param {Object} `options`
|
||||
* @return {Array} Returns an array of expanded values.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
braces.stringify = (input, options = {}) => {
|
||||
if (typeof input === 'string') {
|
||||
return stringify(braces.parse(input, options), options);
|
||||
}
|
||||
return stringify(input, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Compiles a brace pattern into a regex-compatible, optimized string.
|
||||
* This method is called by the main [braces](#braces) function by default.
|
||||
*
|
||||
* ```js
|
||||
* const braces = require('braces');
|
||||
* console.log(braces.compile('a/{b,c}/d'));
|
||||
* //=> ['a/(b|c)/d']
|
||||
* ```
|
||||
* @param {String} `input` Brace pattern or AST.
|
||||
* @param {Object} `options`
|
||||
* @return {Array} Returns an array of expanded values.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
braces.compile = (input, options = {}) => {
|
||||
if (typeof input === 'string') {
|
||||
input = braces.parse(input, options);
|
||||
}
|
||||
return compile(input, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Expands a brace pattern into an array. This method is called by the
|
||||
* main [braces](#braces) function when `options.expand` is true. Before
|
||||
* using this method it's recommended that you read the [performance notes](#performance))
|
||||
* and advantages of using [.compile](#compile) instead.
|
||||
*
|
||||
* ```js
|
||||
* const braces = require('braces');
|
||||
* console.log(braces.expand('a/{b,c}/d'));
|
||||
* //=> ['a/b/d', 'a/c/d'];
|
||||
* ```
|
||||
* @param {String} `pattern` Brace pattern
|
||||
* @param {Object} `options`
|
||||
* @return {Array} Returns an array of expanded values.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
braces.expand = (input, options = {}) => {
|
||||
if (typeof input === 'string') {
|
||||
input = braces.parse(input, options);
|
||||
}
|
||||
|
||||
let result = expand(input, options);
|
||||
|
||||
// filter out empty strings if specified
|
||||
if (options.noempty === true) {
|
||||
result = result.filter(Boolean);
|
||||
}
|
||||
|
||||
// filter out duplicates if specified
|
||||
if (options.nodupes === true) {
|
||||
result = [...new Set(result)];
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Processes a brace pattern and returns either an expanded array
|
||||
* (if `options.expand` is true), a highly optimized regex-compatible string.
|
||||
* This method is called by the main [braces](#braces) function.
|
||||
*
|
||||
* ```js
|
||||
* const braces = require('braces');
|
||||
* console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
|
||||
* //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
|
||||
* ```
|
||||
* @param {String} `pattern` Brace pattern
|
||||
* @param {Object} `options`
|
||||
* @return {Array} Returns an array of expanded values.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
braces.create = (input, options = {}) => {
|
||||
if (input === '' || input.length < 3) {
|
||||
return [input];
|
||||
}
|
||||
|
||||
return options.expand !== true
|
||||
? braces.compile(input, options)
|
||||
: braces.expand(input, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose "braces"
|
||||
*/
|
||||
|
||||
module.exports = braces;
|
57
node_modules/sass/node_modules/braces/lib/compile.js
generated
vendored
Normal file
57
node_modules/sass/node_modules/braces/lib/compile.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
|
||||
const fill = require('fill-range');
|
||||
const utils = require('./utils');
|
||||
|
||||
const compile = (ast, options = {}) => {
|
||||
let walk = (node, parent = {}) => {
|
||||
let invalidBlock = utils.isInvalidBrace(parent);
|
||||
let invalidNode = node.invalid === true && options.escapeInvalid === true;
|
||||
let invalid = invalidBlock === true || invalidNode === true;
|
||||
let prefix = options.escapeInvalid === true ? '\\' : '';
|
||||
let output = '';
|
||||
|
||||
if (node.isOpen === true) {
|
||||
return prefix + node.value;
|
||||
}
|
||||
if (node.isClose === true) {
|
||||
return prefix + node.value;
|
||||
}
|
||||
|
||||
if (node.type === 'open') {
|
||||
return invalid ? (prefix + node.value) : '(';
|
||||
}
|
||||
|
||||
if (node.type === 'close') {
|
||||
return invalid ? (prefix + node.value) : ')';
|
||||
}
|
||||
|
||||
if (node.type === 'comma') {
|
||||
return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|');
|
||||
}
|
||||
|
||||
if (node.value) {
|
||||
return node.value;
|
||||
}
|
||||
|
||||
if (node.nodes && node.ranges > 0) {
|
||||
let args = utils.reduce(node.nodes);
|
||||
let range = fill(...args, { ...options, wrap: false, toRegex: true });
|
||||
|
||||
if (range.length !== 0) {
|
||||
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
||||
}
|
||||
}
|
||||
|
||||
if (node.nodes) {
|
||||
for (let child of node.nodes) {
|
||||
output += walk(child, node);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
return walk(ast);
|
||||
};
|
||||
|
||||
module.exports = compile;
|
57
node_modules/sass/node_modules/braces/lib/constants.js
generated
vendored
Normal file
57
node_modules/sass/node_modules/braces/lib/constants.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
MAX_LENGTH: 1024 * 64,
|
||||
|
||||
// Digits
|
||||
CHAR_0: '0', /* 0 */
|
||||
CHAR_9: '9', /* 9 */
|
||||
|
||||
// Alphabet chars.
|
||||
CHAR_UPPERCASE_A: 'A', /* A */
|
||||
CHAR_LOWERCASE_A: 'a', /* a */
|
||||
CHAR_UPPERCASE_Z: 'Z', /* Z */
|
||||
CHAR_LOWERCASE_Z: 'z', /* z */
|
||||
|
||||
CHAR_LEFT_PARENTHESES: '(', /* ( */
|
||||
CHAR_RIGHT_PARENTHESES: ')', /* ) */
|
||||
|
||||
CHAR_ASTERISK: '*', /* * */
|
||||
|
||||
// Non-alphabetic chars.
|
||||
CHAR_AMPERSAND: '&', /* & */
|
||||
CHAR_AT: '@', /* @ */
|
||||
CHAR_BACKSLASH: '\\', /* \ */
|
||||
CHAR_BACKTICK: '`', /* ` */
|
||||
CHAR_CARRIAGE_RETURN: '\r', /* \r */
|
||||
CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */
|
||||
CHAR_COLON: ':', /* : */
|
||||
CHAR_COMMA: ',', /* , */
|
||||
CHAR_DOLLAR: '$', /* . */
|
||||
CHAR_DOT: '.', /* . */
|
||||
CHAR_DOUBLE_QUOTE: '"', /* " */
|
||||
CHAR_EQUAL: '=', /* = */
|
||||
CHAR_EXCLAMATION_MARK: '!', /* ! */
|
||||
CHAR_FORM_FEED: '\f', /* \f */
|
||||
CHAR_FORWARD_SLASH: '/', /* / */
|
||||
CHAR_HASH: '#', /* # */
|
||||
CHAR_HYPHEN_MINUS: '-', /* - */
|
||||
CHAR_LEFT_ANGLE_BRACKET: '<', /* < */
|
||||
CHAR_LEFT_CURLY_BRACE: '{', /* { */
|
||||
CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */
|
||||
CHAR_LINE_FEED: '\n', /* \n */
|
||||
CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */
|
||||
CHAR_PERCENT: '%', /* % */
|
||||
CHAR_PLUS: '+', /* + */
|
||||
CHAR_QUESTION_MARK: '?', /* ? */
|
||||
CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */
|
||||
CHAR_RIGHT_CURLY_BRACE: '}', /* } */
|
||||
CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */
|
||||
CHAR_SEMICOLON: ';', /* ; */
|
||||
CHAR_SINGLE_QUOTE: '\'', /* ' */
|
||||
CHAR_SPACE: ' ', /* */
|
||||
CHAR_TAB: '\t', /* \t */
|
||||
CHAR_UNDERSCORE: '_', /* _ */
|
||||
CHAR_VERTICAL_LINE: '|', /* | */
|
||||
CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */
|
||||
};
|
113
node_modules/sass/node_modules/braces/lib/expand.js
generated
vendored
Normal file
113
node_modules/sass/node_modules/braces/lib/expand.js
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
'use strict';
|
||||
|
||||
const fill = require('fill-range');
|
||||
const stringify = require('./stringify');
|
||||
const utils = require('./utils');
|
||||
|
||||
const append = (queue = '', stash = '', enclose = false) => {
|
||||
let result = [];
|
||||
|
||||
queue = [].concat(queue);
|
||||
stash = [].concat(stash);
|
||||
|
||||
if (!stash.length) return queue;
|
||||
if (!queue.length) {
|
||||
return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash;
|
||||
}
|
||||
|
||||
for (let item of queue) {
|
||||
if (Array.isArray(item)) {
|
||||
for (let value of item) {
|
||||
result.push(append(value, stash, enclose));
|
||||
}
|
||||
} else {
|
||||
for (let ele of stash) {
|
||||
if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
|
||||
result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele));
|
||||
}
|
||||
}
|
||||
}
|
||||
return utils.flatten(result);
|
||||
};
|
||||
|
||||
const expand = (ast, options = {}) => {
|
||||
let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
|
||||
|
||||
let walk = (node, parent = {}) => {
|
||||
node.queue = [];
|
||||
|
||||
let p = parent;
|
||||
let q = parent.queue;
|
||||
|
||||
while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
|
||||
p = p.parent;
|
||||
q = p.queue;
|
||||
}
|
||||
|
||||
if (node.invalid || node.dollar) {
|
||||
q.push(append(q.pop(), stringify(node, options)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
|
||||
q.push(append(q.pop(), ['{}']));
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.nodes && node.ranges > 0) {
|
||||
let args = utils.reduce(node.nodes);
|
||||
|
||||
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
|
||||
throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
|
||||
}
|
||||
|
||||
let range = fill(...args, options);
|
||||
if (range.length === 0) {
|
||||
range = stringify(node, options);
|
||||
}
|
||||
|
||||
q.push(append(q.pop(), range));
|
||||
node.nodes = [];
|
||||
return;
|
||||
}
|
||||
|
||||
let enclose = utils.encloseBrace(node);
|
||||
let queue = node.queue;
|
||||
let block = node;
|
||||
|
||||
while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
|
||||
block = block.parent;
|
||||
queue = block.queue;
|
||||
}
|
||||
|
||||
for (let i = 0; i < node.nodes.length; i++) {
|
||||
let child = node.nodes[i];
|
||||
|
||||
if (child.type === 'comma' && node.type === 'brace') {
|
||||
if (i === 1) queue.push('');
|
||||
queue.push('');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child.type === 'close') {
|
||||
q.push(append(q.pop(), queue, enclose));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child.value && child.type !== 'open') {
|
||||
queue.push(append(queue.pop(), child.value));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child.nodes) {
|
||||
walk(child, node);
|
||||
}
|
||||
}
|
||||
|
||||
return queue;
|
||||
};
|
||||
|
||||
return utils.flatten(walk(ast));
|
||||
};
|
||||
|
||||
module.exports = expand;
|
333
node_modules/sass/node_modules/braces/lib/parse.js
generated
vendored
Normal file
333
node_modules/sass/node_modules/braces/lib/parse.js
generated
vendored
Normal file
@ -0,0 +1,333 @@
|
||||
'use strict';
|
||||
|
||||
const stringify = require('./stringify');
|
||||
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
|
||||
const {
|
||||
MAX_LENGTH,
|
||||
CHAR_BACKSLASH, /* \ */
|
||||
CHAR_BACKTICK, /* ` */
|
||||
CHAR_COMMA, /* , */
|
||||
CHAR_DOT, /* . */
|
||||
CHAR_LEFT_PARENTHESES, /* ( */
|
||||
CHAR_RIGHT_PARENTHESES, /* ) */
|
||||
CHAR_LEFT_CURLY_BRACE, /* { */
|
||||
CHAR_RIGHT_CURLY_BRACE, /* } */
|
||||
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
||||
CHAR_RIGHT_SQUARE_BRACKET, /* ] */
|
||||
CHAR_DOUBLE_QUOTE, /* " */
|
||||
CHAR_SINGLE_QUOTE, /* ' */
|
||||
CHAR_NO_BREAK_SPACE,
|
||||
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
||||
} = require('./constants');
|
||||
|
||||
/**
|
||||
* parse
|
||||
*/
|
||||
|
||||
const parse = (input, options = {}) => {
|
||||
if (typeof input !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
let opts = options || {};
|
||||
let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
||||
if (input.length > max) {
|
||||
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
||||
}
|
||||
|
||||
let ast = { type: 'root', input, nodes: [] };
|
||||
let stack = [ast];
|
||||
let block = ast;
|
||||
let prev = ast;
|
||||
let brackets = 0;
|
||||
let length = input.length;
|
||||
let index = 0;
|
||||
let depth = 0;
|
||||
let value;
|
||||
let memo = {};
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
const advance = () => input[index++];
|
||||
const push = node => {
|
||||
if (node.type === 'text' && prev.type === 'dot') {
|
||||
prev.type = 'text';
|
||||
}
|
||||
|
||||
if (prev && prev.type === 'text' && node.type === 'text') {
|
||||
prev.value += node.value;
|
||||
return;
|
||||
}
|
||||
|
||||
block.nodes.push(node);
|
||||
node.parent = block;
|
||||
node.prev = prev;
|
||||
prev = node;
|
||||
return node;
|
||||
};
|
||||
|
||||
push({ type: 'bos' });
|
||||
|
||||
while (index < length) {
|
||||
block = stack[stack.length - 1];
|
||||
value = advance();
|
||||
|
||||
/**
|
||||
* Invalid chars
|
||||
*/
|
||||
|
||||
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escaped chars
|
||||
*/
|
||||
|
||||
if (value === CHAR_BACKSLASH) {
|
||||
push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() });
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Right square bracket (literal): ']'
|
||||
*/
|
||||
|
||||
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
||||
push({ type: 'text', value: '\\' + value });
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Left square bracket: '['
|
||||
*/
|
||||
|
||||
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
||||
brackets++;
|
||||
|
||||
let closed = true;
|
||||
let next;
|
||||
|
||||
while (index < length && (next = advance())) {
|
||||
value += next;
|
||||
|
||||
if (next === CHAR_LEFT_SQUARE_BRACKET) {
|
||||
brackets++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (next === CHAR_BACKSLASH) {
|
||||
value += advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
||||
brackets--;
|
||||
|
||||
if (brackets === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
push({ type: 'text', value });
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parentheses
|
||||
*/
|
||||
|
||||
if (value === CHAR_LEFT_PARENTHESES) {
|
||||
block = push({ type: 'paren', nodes: [] });
|
||||
stack.push(block);
|
||||
push({ type: 'text', value });
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value === CHAR_RIGHT_PARENTHESES) {
|
||||
if (block.type !== 'paren') {
|
||||
push({ type: 'text', value });
|
||||
continue;
|
||||
}
|
||||
block = stack.pop();
|
||||
push({ type: 'text', value });
|
||||
block = stack[stack.length - 1];
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quotes: '|"|`
|
||||
*/
|
||||
|
||||
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
||||
let open = value;
|
||||
let next;
|
||||
|
||||
if (options.keepQuotes !== true) {
|
||||
value = '';
|
||||
}
|
||||
|
||||
while (index < length && (next = advance())) {
|
||||
if (next === CHAR_BACKSLASH) {
|
||||
value += next + advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (next === open) {
|
||||
if (options.keepQuotes === true) value += next;
|
||||
break;
|
||||
}
|
||||
|
||||
value += next;
|
||||
}
|
||||
|
||||
push({ type: 'text', value });
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Left curly brace: '{'
|
||||
*/
|
||||
|
||||
if (value === CHAR_LEFT_CURLY_BRACE) {
|
||||
depth++;
|
||||
|
||||
let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
|
||||
let brace = {
|
||||
type: 'brace',
|
||||
open: true,
|
||||
close: false,
|
||||
dollar,
|
||||
depth,
|
||||
commas: 0,
|
||||
ranges: 0,
|
||||
nodes: []
|
||||
};
|
||||
|
||||
block = push(brace);
|
||||
stack.push(block);
|
||||
push({ type: 'open', value });
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Right curly brace: '}'
|
||||
*/
|
||||
|
||||
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
||||
if (block.type !== 'brace') {
|
||||
push({ type: 'text', value });
|
||||
continue;
|
||||
}
|
||||
|
||||
let type = 'close';
|
||||
block = stack.pop();
|
||||
block.close = true;
|
||||
|
||||
push({ type, value });
|
||||
depth--;
|
||||
|
||||
block = stack[stack.length - 1];
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comma: ','
|
||||
*/
|
||||
|
||||
if (value === CHAR_COMMA && depth > 0) {
|
||||
if (block.ranges > 0) {
|
||||
block.ranges = 0;
|
||||
let open = block.nodes.shift();
|
||||
block.nodes = [open, { type: 'text', value: stringify(block) }];
|
||||
}
|
||||
|
||||
push({ type: 'comma', value });
|
||||
block.commas++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dot: '.'
|
||||
*/
|
||||
|
||||
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
||||
let siblings = block.nodes;
|
||||
|
||||
if (depth === 0 || siblings.length === 0) {
|
||||
push({ type: 'text', value });
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prev.type === 'dot') {
|
||||
block.range = [];
|
||||
prev.value += value;
|
||||
prev.type = 'range';
|
||||
|
||||
if (block.nodes.length !== 3 && block.nodes.length !== 5) {
|
||||
block.invalid = true;
|
||||
block.ranges = 0;
|
||||
prev.type = 'text';
|
||||
continue;
|
||||
}
|
||||
|
||||
block.ranges++;
|
||||
block.args = [];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prev.type === 'range') {
|
||||
siblings.pop();
|
||||
|
||||
let before = siblings[siblings.length - 1];
|
||||
before.value += prev.value + value;
|
||||
prev = before;
|
||||
block.ranges--;
|
||||
continue;
|
||||
}
|
||||
|
||||
push({ type: 'dot', value });
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Text
|
||||
*/
|
||||
|
||||
push({ type: 'text', value });
|
||||
}
|
||||
|
||||
// Mark imbalanced braces and brackets as invalid
|
||||
do {
|
||||
block = stack.pop();
|
||||
|
||||
if (block.type !== 'root') {
|
||||
block.nodes.forEach(node => {
|
||||
if (!node.nodes) {
|
||||
if (node.type === 'open') node.isOpen = true;
|
||||
if (node.type === 'close') node.isClose = true;
|
||||
if (!node.nodes) node.type = 'text';
|
||||
node.invalid = true;
|
||||
}
|
||||
});
|
||||
|
||||
// get the location of the block on parent.nodes (block's siblings)
|
||||
let parent = stack[stack.length - 1];
|
||||
let index = parent.nodes.indexOf(block);
|
||||
// replace the (invalid) block with it's nodes
|
||||
parent.nodes.splice(index, 1, ...block.nodes);
|
||||
}
|
||||
} while (stack.length > 0);
|
||||
|
||||
push({ type: 'eos' });
|
||||
return ast;
|
||||
};
|
||||
|
||||
module.exports = parse;
|
32
node_modules/sass/node_modules/braces/lib/stringify.js
generated
vendored
Normal file
32
node_modules/sass/node_modules/braces/lib/stringify.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = (ast, options = {}) => {
|
||||
let stringify = (node, parent = {}) => {
|
||||
let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
||||
let invalidNode = node.invalid === true && options.escapeInvalid === true;
|
||||
let output = '';
|
||||
|
||||
if (node.value) {
|
||||
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
||||
return '\\' + node.value;
|
||||
}
|
||||
return node.value;
|
||||
}
|
||||
|
||||
if (node.value) {
|
||||
return node.value;
|
||||
}
|
||||
|
||||
if (node.nodes) {
|
||||
for (let child of node.nodes) {
|
||||
output += stringify(child);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
return stringify(ast);
|
||||
};
|
||||
|
112
node_modules/sass/node_modules/braces/lib/utils.js
generated
vendored
Normal file
112
node_modules/sass/node_modules/braces/lib/utils.js
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
'use strict';
|
||||
|
||||
exports.isInteger = num => {
|
||||
if (typeof num === 'number') {
|
||||
return Number.isInteger(num);
|
||||
}
|
||||
if (typeof num === 'string' && num.trim() !== '') {
|
||||
return Number.isInteger(Number(num));
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Find a node of the given type
|
||||
*/
|
||||
|
||||
exports.find = (node, type) => node.nodes.find(node => node.type === type);
|
||||
|
||||
/**
|
||||
* Find a node of the given type
|
||||
*/
|
||||
|
||||
exports.exceedsLimit = (min, max, step = 1, limit) => {
|
||||
if (limit === false) return false;
|
||||
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
||||
return ((Number(max) - Number(min)) / Number(step)) >= limit;
|
||||
};
|
||||
|
||||
/**
|
||||
* Escape the given node with '\\' before node.value
|
||||
*/
|
||||
|
||||
exports.escapeNode = (block, n = 0, type) => {
|
||||
let node = block.nodes[n];
|
||||
if (!node) return;
|
||||
|
||||
if ((type && node.type === type) || node.type === 'open' || node.type === 'close') {
|
||||
if (node.escaped !== true) {
|
||||
node.value = '\\' + node.value;
|
||||
node.escaped = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the given brace node should be enclosed in literal braces
|
||||
*/
|
||||
|
||||
exports.encloseBrace = node => {
|
||||
if (node.type !== 'brace') return false;
|
||||
if ((node.commas >> 0 + node.ranges >> 0) === 0) {
|
||||
node.invalid = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if a brace node is invalid.
|
||||
*/
|
||||
|
||||
exports.isInvalidBrace = block => {
|
||||
if (block.type !== 'brace') return false;
|
||||
if (block.invalid === true || block.dollar) return true;
|
||||
if ((block.commas >> 0 + block.ranges >> 0) === 0) {
|
||||
block.invalid = true;
|
||||
return true;
|
||||
}
|
||||
if (block.open !== true || block.close !== true) {
|
||||
block.invalid = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if a node is an open or close node
|
||||
*/
|
||||
|
||||
exports.isOpenOrClose = node => {
|
||||
if (node.type === 'open' || node.type === 'close') {
|
||||
return true;
|
||||
}
|
||||
return node.open === true || node.close === true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reduce an array of text nodes.
|
||||
*/
|
||||
|
||||
exports.reduce = nodes => nodes.reduce((acc, node) => {
|
||||
if (node.type === 'text') acc.push(node.value);
|
||||
if (node.type === 'range') node.type = 'text';
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Flatten an array
|
||||
*/
|
||||
|
||||
exports.flatten = (...args) => {
|
||||
const result = [];
|
||||
const flat = arr => {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
let ele = arr[i];
|
||||
Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
flat(args);
|
||||
return result;
|
||||
};
|
77
node_modules/sass/node_modules/braces/package.json
generated
vendored
Normal file
77
node_modules/sass/node_modules/braces/package.json
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "braces",
|
||||
"description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.",
|
||||
"version": "3.0.2",
|
||||
"homepage": "https://github.com/micromatch/braces",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"contributors": [
|
||||
"Brian Woodward (https://twitter.com/doowb)",
|
||||
"Elan Shanker (https://github.com/es128)",
|
||||
"Eugene Sharygin (https://github.com/eush77)",
|
||||
"hemanth.hm (http://h3manth.com)",
|
||||
"Jon Schlinkert (http://twitter.com/jonschlinkert)"
|
||||
],
|
||||
"repository": "micromatch/braces",
|
||||
"bugs": {
|
||||
"url": "https://github.com/micromatch/braces/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"benchmark": "node benchmark"
|
||||
},
|
||||
"dependencies": {
|
||||
"fill-range": "^7.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ansi-colors": "^3.2.4",
|
||||
"bash-path": "^2.0.1",
|
||||
"gulp-format-md": "^2.0.0",
|
||||
"mocha": "^6.1.1"
|
||||
},
|
||||
"keywords": [
|
||||
"alpha",
|
||||
"alphabetical",
|
||||
"bash",
|
||||
"brace",
|
||||
"braces",
|
||||
"expand",
|
||||
"expansion",
|
||||
"filepath",
|
||||
"fill",
|
||||
"fs",
|
||||
"glob",
|
||||
"globbing",
|
||||
"letter",
|
||||
"match",
|
||||
"matches",
|
||||
"matching",
|
||||
"number",
|
||||
"numerical",
|
||||
"path",
|
||||
"range",
|
||||
"ranges",
|
||||
"sh"
|
||||
],
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
},
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
]
|
||||
}
|
||||
}
|
21
node_modules/sass/node_modules/chokidar/LICENSE
generated
vendored
Normal file
21
node_modules/sass/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
node_modules/sass/node_modules/chokidar/README.md
generated
vendored
Normal file
308
node_modules/sass/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).
|
||||
|
||||
## License
|
||||
|
||||
MIT (c) Paul Miller (<https://paulmillr.com>), see [LICENSE](LICENSE) file.
|
973
node_modules/sass/node_modules/chokidar/index.js
generated
vendored
Normal file
973
node_modules/sass/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 *= 2;
|
||||
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;
|
65
node_modules/sass/node_modules/chokidar/lib/constants.js
generated
vendored
Normal file
65
node_modules/sass/node_modules/chokidar/lib/constants.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
'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_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';
|
524
node_modules/sass/node_modules/chokidar/lib/fsevents-handler.js
generated
vendored
Normal file
524
node_modules/sass/node_modules/chokidar/lib/fsevents-handler.js
generated
vendored
Normal file
@ -0,0 +1,524 @@
|
||||
'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_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;
|
||||
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
node_modules/sass/node_modules/chokidar/lib/nodefs-handler.js
generated
vendored
Normal file
654
node_modules/sass/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;
|
85
node_modules/sass/node_modules/chokidar/package.json
generated
vendored
Normal file
85
node_modules/sass/node_modules/chokidar/package.json
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"name": "chokidar",
|
||||
"description": "Minimal and efficient cross-platform file watching library",
|
||||
"version": "3.5.3",
|
||||
"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",
|
||||
"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",
|
||||
"nyc": "^15.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 .",
|
||||
"mocha": "mocha --exit --timeout 90000",
|
||||
"test": "npm run lint && npm run mocha"
|
||||
},
|
||||
"keywords": [
|
||||
"fs",
|
||||
"watch",
|
||||
"watchFile",
|
||||
"watcher",
|
||||
"watching",
|
||||
"file",
|
||||
"fsevents"
|
||||
],
|
||||
"types": "./types/index.d.ts",
|
||||
"nyc": {
|
||||
"include": [
|
||||
"index.js",
|
||||
"lib/*.js"
|
||||
],
|
||||
"reporter": [
|
||||
"html",
|
||||
"text"
|
||||
]
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
]
|
||||
}
|
188
node_modules/sass/node_modules/chokidar/types/index.d.ts
generated
vendored
Normal file
188
node_modules/sass/node_modules/chokidar/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,188 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
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;
|
21
node_modules/sass/node_modules/fill-range/LICENSE
generated
vendored
Normal file
21
node_modules/sass/node_modules/fill-range/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-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.
|
237
node_modules/sass/node_modules/fill-range/README.md
generated
vendored
Normal file
237
node_modules/sass/node_modules/fill-range/README.md
generated
vendored
Normal file
@ -0,0 +1,237 @@
|
||||
# fill-range [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [](https://www.npmjs.com/package/fill-range) [](https://npmjs.org/package/fill-range) [](https://npmjs.org/package/fill-range) [](https://travis-ci.org/jonschlinkert/fill-range)
|
||||
|
||||
> Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save fill-range
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Expands numbers and letters, optionally using a `step` as the last argument. _(Numbers may be defined as JavaScript numbers or strings)_.
|
||||
|
||||
```js
|
||||
const fill = require('fill-range');
|
||||
// fill(from, to[, step, options]);
|
||||
|
||||
console.log(fill('1', '10')); //=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
|
||||
console.log(fill('1', '10', { toRegex: true })); //=> [1-9]|10
|
||||
```
|
||||
|
||||
**Params**
|
||||
|
||||
* `from`: **{String|Number}** the number or letter to start with
|
||||
* `to`: **{String|Number}** the number or letter to end with
|
||||
* `step`: **{String|Number|Object|Function}** Optionally pass a [step](#optionsstep) to use.
|
||||
* `options`: **{Object|Function}**: See all available [options](#options)
|
||||
|
||||
## Examples
|
||||
|
||||
By default, an array of values is returned.
|
||||
|
||||
**Alphabetical ranges**
|
||||
|
||||
```js
|
||||
console.log(fill('a', 'e')); //=> ['a', 'b', 'c', 'd', 'e']
|
||||
console.log(fill('A', 'E')); //=> [ 'A', 'B', 'C', 'D', 'E' ]
|
||||
```
|
||||
|
||||
**Numerical ranges**
|
||||
|
||||
Numbers can be defined as actual numbers or strings.
|
||||
|
||||
```js
|
||||
console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ]
|
||||
console.log(fill('1', '5')); //=> [ 1, 2, 3, 4, 5 ]
|
||||
```
|
||||
|
||||
**Negative ranges**
|
||||
|
||||
Numbers can be defined as actual numbers or strings.
|
||||
|
||||
```js
|
||||
console.log(fill('-5', '-1')); //=> [ '-5', '-4', '-3', '-2', '-1' ]
|
||||
console.log(fill('-5', '5')); //=> [ '-5', '-4', '-3', '-2', '-1', '0', '1', '2', '3', '4', '5' ]
|
||||
```
|
||||
|
||||
**Steps (increments)**
|
||||
|
||||
```js
|
||||
// numerical ranges with increments
|
||||
console.log(fill('0', '25', 4)); //=> [ '0', '4', '8', '12', '16', '20', '24' ]
|
||||
console.log(fill('0', '25', 5)); //=> [ '0', '5', '10', '15', '20', '25' ]
|
||||
console.log(fill('0', '25', 6)); //=> [ '0', '6', '12', '18', '24' ]
|
||||
|
||||
// alphabetical ranges with increments
|
||||
console.log(fill('a', 'z', 4)); //=> [ 'a', 'e', 'i', 'm', 'q', 'u', 'y' ]
|
||||
console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ]
|
||||
console.log(fill('a', 'z', 6)); //=> [ 'a', 'g', 'm', 's', 'y' ]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### options.step
|
||||
|
||||
**Type**: `number` (formatted as a string or number)
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
**Description**: The increment to use for the range. Can be used with letters or numbers.
|
||||
|
||||
**Example(s)**
|
||||
|
||||
```js
|
||||
// numbers
|
||||
console.log(fill('1', '10', 2)); //=> [ '1', '3', '5', '7', '9' ]
|
||||
console.log(fill('1', '10', 3)); //=> [ '1', '4', '7', '10' ]
|
||||
console.log(fill('1', '10', 4)); //=> [ '1', '5', '9' ]
|
||||
|
||||
// letters
|
||||
console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ]
|
||||
console.log(fill('a', 'z', 7)); //=> [ 'a', 'h', 'o', 'v' ]
|
||||
console.log(fill('a', 'z', 9)); //=> [ 'a', 'j', 's' ]
|
||||
```
|
||||
|
||||
### options.strictRanges
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Default**: `false`
|
||||
|
||||
**Description**: By default, `null` is returned when an invalid range is passed. Enable this option to throw a `RangeError` on invalid ranges.
|
||||
|
||||
**Example(s)**
|
||||
|
||||
The following are all invalid:
|
||||
|
||||
```js
|
||||
fill('1.1', '2'); // decimals not supported in ranges
|
||||
fill('a', '2'); // incompatible range values
|
||||
fill(1, 10, 'foo'); // invalid "step" argument
|
||||
```
|
||||
|
||||
### options.stringify
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
**Description**: Cast all returned values to strings. By default, integers are returned as numbers.
|
||||
|
||||
**Example(s)**
|
||||
|
||||
```js
|
||||
console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ]
|
||||
console.log(fill(1, 5, { stringify: true })); //=> [ '1', '2', '3', '4', '5' ]
|
||||
```
|
||||
|
||||
### options.toRegex
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
**Description**: Create a regex-compatible source string, instead of expanding values to an array.
|
||||
|
||||
**Example(s)**
|
||||
|
||||
```js
|
||||
// alphabetical range
|
||||
console.log(fill('a', 'e', { toRegex: true })); //=> '[a-e]'
|
||||
// alphabetical with step
|
||||
console.log(fill('a', 'z', 3, { toRegex: true })); //=> 'a|d|g|j|m|p|s|v|y'
|
||||
// numerical range
|
||||
console.log(fill('1', '100', { toRegex: true })); //=> '[1-9]|[1-9][0-9]|100'
|
||||
// numerical range with zero padding
|
||||
console.log(fill('000001', '100000', { toRegex: true }));
|
||||
//=> '0{5}[1-9]|0{4}[1-9][0-9]|0{3}[1-9][0-9]{2}|0{2}[1-9][0-9]{3}|0[1-9][0-9]{4}|100000'
|
||||
```
|
||||
|
||||
### options.transform
|
||||
|
||||
**Type**: `function`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
**Description**: Customize each value in the returned array (or [string](#optionstoRegex)). _(you can also pass this function as the last argument to `fill()`)_.
|
||||
|
||||
**Example(s)**
|
||||
|
||||
```js
|
||||
// add zero padding
|
||||
console.log(fill(1, 5, value => String(value).padStart(4, '0')));
|
||||
//=> ['0001', '0002', '0003', '0004', '0005']
|
||||
```
|
||||
|
||||
## 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).
|
||||
|
||||
</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>
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 116 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 4 | [paulmillr](https://github.com/paulmillr) |
|
||||
| 2 | [realityking](https://github.com/realityking) |
|
||||
| 2 | [bluelovers](https://github.com/bluelovers) |
|
||||
| 1 | [edorivai](https://github.com/edorivai) |
|
||||
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
Please consider supporting me on Patreon, or [start your own Patreon page](https://patreon.com/invite/bxpbvm)!
|
||||
|
||||
<a href="https://www.patreon.com/jonschlinkert">
|
||||
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" height="50">
|
||||
</a>
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._
|
249
node_modules/sass/node_modules/fill-range/index.js
generated
vendored
Normal file
249
node_modules/sass/node_modules/fill-range/index.js
generated
vendored
Normal file
@ -0,0 +1,249 @@
|
||||
/*!
|
||||
* fill-range <https://github.com/jonschlinkert/fill-range>
|
||||
*
|
||||
* Copyright (c) 2014-present, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const util = require('util');
|
||||
const toRegexRange = require('to-regex-range');
|
||||
|
||||
const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
||||
|
||||
const transform = toNumber => {
|
||||
return value => toNumber === true ? Number(value) : String(value);
|
||||
};
|
||||
|
||||
const isValidValue = value => {
|
||||
return typeof value === 'number' || (typeof value === 'string' && value !== '');
|
||||
};
|
||||
|
||||
const isNumber = num => Number.isInteger(+num);
|
||||
|
||||
const zeros = input => {
|
||||
let value = `${input}`;
|
||||
let index = -1;
|
||||
if (value[0] === '-') value = value.slice(1);
|
||||
if (value === '0') return false;
|
||||
while (value[++index] === '0');
|
||||
return index > 0;
|
||||
};
|
||||
|
||||
const stringify = (start, end, options) => {
|
||||
if (typeof start === 'string' || typeof end === 'string') {
|
||||
return true;
|
||||
}
|
||||
return options.stringify === true;
|
||||
};
|
||||
|
||||
const pad = (input, maxLength, toNumber) => {
|
||||
if (maxLength > 0) {
|
||||
let dash = input[0] === '-' ? '-' : '';
|
||||
if (dash) input = input.slice(1);
|
||||
input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0'));
|
||||
}
|
||||
if (toNumber === false) {
|
||||
return String(input);
|
||||
}
|
||||
return input;
|
||||
};
|
||||
|
||||
const toMaxLen = (input, maxLength) => {
|
||||
let negative = input[0] === '-' ? '-' : '';
|
||||
if (negative) {
|
||||
input = input.slice(1);
|
||||
maxLength--;
|
||||
}
|
||||
while (input.length < maxLength) input = '0' + input;
|
||||
return negative ? ('-' + input) : input;
|
||||
};
|
||||
|
||||
const toSequence = (parts, options) => {
|
||||
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
||||
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
||||
|
||||
let prefix = options.capture ? '' : '?:';
|
||||
let positives = '';
|
||||
let negatives = '';
|
||||
let result;
|
||||
|
||||
if (parts.positives.length) {
|
||||
positives = parts.positives.join('|');
|
||||
}
|
||||
|
||||
if (parts.negatives.length) {
|
||||
negatives = `-(${prefix}${parts.negatives.join('|')})`;
|
||||
}
|
||||
|
||||
if (positives && negatives) {
|
||||
result = `${positives}|${negatives}`;
|
||||
} else {
|
||||
result = positives || negatives;
|
||||
}
|
||||
|
||||
if (options.wrap) {
|
||||
return `(${prefix}${result})`;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
const toRange = (a, b, isNumbers, options) => {
|
||||
if (isNumbers) {
|
||||
return toRegexRange(a, b, { wrap: false, ...options });
|
||||
}
|
||||
|
||||
let start = String.fromCharCode(a);
|
||||
if (a === b) return start;
|
||||
|
||||
let stop = String.fromCharCode(b);
|
||||
return `[${start}-${stop}]`;
|
||||
};
|
||||
|
||||
const toRegex = (start, end, options) => {
|
||||
if (Array.isArray(start)) {
|
||||
let wrap = options.wrap === true;
|
||||
let prefix = options.capture ? '' : '?:';
|
||||
return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
|
||||
}
|
||||
return toRegexRange(start, end, options);
|
||||
};
|
||||
|
||||
const rangeError = (...args) => {
|
||||
return new RangeError('Invalid range arguments: ' + util.inspect(...args));
|
||||
};
|
||||
|
||||
const invalidRange = (start, end, options) => {
|
||||
if (options.strictRanges === true) throw rangeError([start, end]);
|
||||
return [];
|
||||
};
|
||||
|
||||
const invalidStep = (step, options) => {
|
||||
if (options.strictRanges === true) {
|
||||
throw new TypeError(`Expected step "${step}" to be a number`);
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
const fillNumbers = (start, end, step = 1, options = {}) => {
|
||||
let a = Number(start);
|
||||
let b = Number(end);
|
||||
|
||||
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
||||
if (options.strictRanges === true) throw rangeError([start, end]);
|
||||
return [];
|
||||
}
|
||||
|
||||
// fix negative zero
|
||||
if (a === 0) a = 0;
|
||||
if (b === 0) b = 0;
|
||||
|
||||
let descending = a > b;
|
||||
let startString = String(start);
|
||||
let endString = String(end);
|
||||
let stepString = String(step);
|
||||
step = Math.max(Math.abs(step), 1);
|
||||
|
||||
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
||||
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
||||
let toNumber = padded === false && stringify(start, end, options) === false;
|
||||
let format = options.transform || transform(toNumber);
|
||||
|
||||
if (options.toRegex && step === 1) {
|
||||
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
|
||||
}
|
||||
|
||||
let parts = { negatives: [], positives: [] };
|
||||
let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
|
||||
let range = [];
|
||||
let index = 0;
|
||||
|
||||
while (descending ? a >= b : a <= b) {
|
||||
if (options.toRegex === true && step > 1) {
|
||||
push(a);
|
||||
} else {
|
||||
range.push(pad(format(a, index), maxLen, toNumber));
|
||||
}
|
||||
a = descending ? a - step : a + step;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (options.toRegex === true) {
|
||||
return step > 1
|
||||
? toSequence(parts, options)
|
||||
: toRegex(range, null, { wrap: false, ...options });
|
||||
}
|
||||
|
||||
return range;
|
||||
};
|
||||
|
||||
const fillLetters = (start, end, step = 1, options = {}) => {
|
||||
if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) {
|
||||
return invalidRange(start, end, options);
|
||||
}
|
||||
|
||||
|
||||
let format = options.transform || (val => String.fromCharCode(val));
|
||||
let a = `${start}`.charCodeAt(0);
|
||||
let b = `${end}`.charCodeAt(0);
|
||||
|
||||
let descending = a > b;
|
||||
let min = Math.min(a, b);
|
||||
let max = Math.max(a, b);
|
||||
|
||||
if (options.toRegex && step === 1) {
|
||||
return toRange(min, max, false, options);
|
||||
}
|
||||
|
||||
let range = [];
|
||||
let index = 0;
|
||||
|
||||
while (descending ? a >= b : a <= b) {
|
||||
range.push(format(a, index));
|
||||
a = descending ? a - step : a + step;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (options.toRegex === true) {
|
||||
return toRegex(range, null, { wrap: false, options });
|
||||
}
|
||||
|
||||
return range;
|
||||
};
|
||||
|
||||
const fill = (start, end, step, options = {}) => {
|
||||
if (end == null && isValidValue(start)) {
|
||||
return [start];
|
||||
}
|
||||
|
||||
if (!isValidValue(start) || !isValidValue(end)) {
|
||||
return invalidRange(start, end, options);
|
||||
}
|
||||
|
||||
if (typeof step === 'function') {
|
||||
return fill(start, end, 1, { transform: step });
|
||||
}
|
||||
|
||||
if (isObject(step)) {
|
||||
return fill(start, end, 0, step);
|
||||
}
|
||||
|
||||
let opts = { ...options };
|
||||
if (opts.capture === true) opts.wrap = true;
|
||||
step = step || opts.step || 1;
|
||||
|
||||
if (!isNumber(step)) {
|
||||
if (step != null && !isObject(step)) return invalidStep(step, opts);
|
||||
return fill(start, end, 1, step);
|
||||
}
|
||||
|
||||
if (isNumber(start) && isNumber(end)) {
|
||||
return fillNumbers(start, end, step, opts);
|
||||
}
|
||||
|
||||
return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
|
||||
};
|
||||
|
||||
module.exports = fill;
|
69
node_modules/sass/node_modules/fill-range/package.json
generated
vendored
Normal file
69
node_modules/sass/node_modules/fill-range/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "fill-range",
|
||||
"description": "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`",
|
||||
"version": "7.0.1",
|
||||
"homepage": "https://github.com/jonschlinkert/fill-range",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"contributors": [
|
||||
"Edo Rivai (edo.rivai.nl)",
|
||||
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
|
||||
"Paul Miller (paulmillr.com)",
|
||||
"Rouven Weßling (www.rouvenwessling.de)",
|
||||
"(https://github.com/wtgtybhertgeghgtwtg)"
|
||||
],
|
||||
"repository": "jonschlinkert/fill-range",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/fill-range/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp-format-md": "^2.0.0",
|
||||
"mocha": "^6.1.1"
|
||||
},
|
||||
"keywords": [
|
||||
"alpha",
|
||||
"alphabetical",
|
||||
"array",
|
||||
"bash",
|
||||
"brace",
|
||||
"expand",
|
||||
"expansion",
|
||||
"fill",
|
||||
"glob",
|
||||
"match",
|
||||
"matches",
|
||||
"matching",
|
||||
"number",
|
||||
"numerical",
|
||||
"range",
|
||||
"ranges",
|
||||
"regex",
|
||||
"sh"
|
||||
],
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
}
|
110
node_modules/sass/node_modules/glob-parent/CHANGELOG.md
generated
vendored
Normal file
110
node_modules/sass/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
node_modules/sass/node_modules/glob-parent/LICENSE
generated
vendored
Normal file
15
node_modules/sass/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
node_modules/sass/node_modules/glob-parent/README.md
generated
vendored
Normal file
137
node_modules/sass/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
node_modules/sass/node_modules/glob-parent/index.js
generated
vendored
Normal file
42
node_modules/sass/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
node_modules/sass/node_modules/glob-parent/package.json
generated
vendored
Normal file
48
node_modules/sass/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"
|
||||
]
|
||||
}
|
17
node_modules/sass/node_modules/is-binary-path/index.d.ts
generated
vendored
Normal file
17
node_modules/sass/node_modules/is-binary-path/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
Check if a file path is a binary file.
|
||||
|
||||
@example
|
||||
```
|
||||
import isBinaryPath = require('is-binary-path');
|
||||
|
||||
isBinaryPath('source/unicorn.png');
|
||||
//=> true
|
||||
|
||||
isBinaryPath('source/unicorn.txt');
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
declare function isBinaryPath(filePath: string): boolean;
|
||||
|
||||
export = isBinaryPath;
|
7
node_modules/sass/node_modules/is-binary-path/index.js
generated
vendored
Normal file
7
node_modules/sass/node_modules/is-binary-path/index.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const binaryExtensions = require('binary-extensions');
|
||||
|
||||
const extensions = new Set(binaryExtensions);
|
||||
|
||||
module.exports = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase());
|
9
node_modules/sass/node_modules/is-binary-path/license
generated
vendored
Normal file
9
node_modules/sass/node_modules/is-binary-path/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com), 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.
|
40
node_modules/sass/node_modules/is-binary-path/package.json
generated
vendored
Normal file
40
node_modules/sass/node_modules/is-binary-path/package.json
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "is-binary-path",
|
||||
"version": "2.1.0",
|
||||
"description": "Check if a file path is a binary file",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-binary-path",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"binary",
|
||||
"extensions",
|
||||
"extension",
|
||||
"file",
|
||||
"path",
|
||||
"check",
|
||||
"detect",
|
||||
"is"
|
||||
],
|
||||
"dependencies": {
|
||||
"binary-extensions": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
34
node_modules/sass/node_modules/is-binary-path/readme.md
generated
vendored
Normal file
34
node_modules/sass/node_modules/is-binary-path/readme.md
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# is-binary-path [](https://travis-ci.org/sindresorhus/is-binary-path)
|
||||
|
||||
> Check if a file path is a binary file
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install is-binary-path
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const isBinaryPath = require('is-binary-path');
|
||||
|
||||
isBinaryPath('source/unicorn.png');
|
||||
//=> true
|
||||
|
||||
isBinaryPath('source/unicorn.txt');
|
||||
//=> false
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [binary-extensions](https://github.com/sindresorhus/binary-extensions) - List of binary file extensions
|
||||
- [is-text-path](https://github.com/sindresorhus/is-text-path) - Check if a filepath is a text file
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com), [Paul Miller](https://paulmillr.com)
|
21
node_modules/sass/node_modules/is-number/LICENSE
generated
vendored
Normal file
21
node_modules/sass/node_modules/is-number/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-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.
|
187
node_modules/sass/node_modules/is-number/README.md
generated
vendored
Normal file
187
node_modules/sass/node_modules/is-number/README.md
generated
vendored
Normal file
@ -0,0 +1,187 @@
|
||||
# is-number [](https://www.npmjs.com/package/is-number) [](https://npmjs.org/package/is-number) [](https://npmjs.org/package/is-number) [](https://travis-ci.org/jonschlinkert/is-number)
|
||||
|
||||
> Returns true if the value is a finite number.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save is-number
|
||||
```
|
||||
|
||||
## Why is this needed?
|
||||
|
||||
In JavaScript, it's not always as straightforward as it should be to reliably check if a value is a number. It's common for devs to use `+`, `-`, or `Number()` to cast a string value to a number (for example, when values are returned from user input, regex matches, parsers, etc). But there are many non-intuitive edge cases that yield unexpected results:
|
||||
|
||||
```js
|
||||
console.log(+[]); //=> 0
|
||||
console.log(+''); //=> 0
|
||||
console.log(+' '); //=> 0
|
||||
console.log(typeof NaN); //=> 'number'
|
||||
```
|
||||
|
||||
This library offers a performant way to smooth out edge cases like these.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const isNumber = require('is-number');
|
||||
```
|
||||
|
||||
See the [tests](./test.js) for more examples.
|
||||
|
||||
### true
|
||||
|
||||
```js
|
||||
isNumber(5e3); // true
|
||||
isNumber(0xff); // true
|
||||
isNumber(-1.1); // true
|
||||
isNumber(0); // true
|
||||
isNumber(1); // true
|
||||
isNumber(1.1); // true
|
||||
isNumber(10); // true
|
||||
isNumber(10.10); // true
|
||||
isNumber(100); // true
|
||||
isNumber('-1.1'); // true
|
||||
isNumber('0'); // true
|
||||
isNumber('012'); // true
|
||||
isNumber('0xff'); // true
|
||||
isNumber('1'); // true
|
||||
isNumber('1.1'); // true
|
||||
isNumber('10'); // true
|
||||
isNumber('10.10'); // true
|
||||
isNumber('100'); // true
|
||||
isNumber('5e3'); // true
|
||||
isNumber(parseInt('012')); // true
|
||||
isNumber(parseFloat('012')); // true
|
||||
```
|
||||
|
||||
### False
|
||||
|
||||
Everything else is false, as you would expect:
|
||||
|
||||
```js
|
||||
isNumber(Infinity); // false
|
||||
isNumber(NaN); // false
|
||||
isNumber(null); // false
|
||||
isNumber(undefined); // false
|
||||
isNumber(''); // false
|
||||
isNumber(' '); // false
|
||||
isNumber('foo'); // false
|
||||
isNumber([1]); // false
|
||||
isNumber([]); // false
|
||||
isNumber(function () {}); // false
|
||||
isNumber({}); // false
|
||||
```
|
||||
|
||||
## Release history
|
||||
|
||||
### 7.0.0
|
||||
|
||||
* Refactor. Now uses `.isFinite` if it exists.
|
||||
* Performance is about the same as v6.0 when the value is a string or number. But it's now 3x-4x faster when the value is not a string or number.
|
||||
|
||||
### 6.0.0
|
||||
|
||||
* Optimizations, thanks to @benaadams.
|
||||
|
||||
### 5.0.0
|
||||
|
||||
**Breaking changes**
|
||||
|
||||
* removed support for `instanceof Number` and `instanceof String`
|
||||
|
||||
## Benchmarks
|
||||
|
||||
As with all benchmarks, take these with a grain of salt. See the [benchmarks](./benchmark/index.js) for more detail.
|
||||
|
||||
```
|
||||
# all
|
||||
v7.0 x 413,222 ops/sec ±2.02% (86 runs sampled)
|
||||
v6.0 x 111,061 ops/sec ±1.29% (85 runs sampled)
|
||||
parseFloat x 317,596 ops/sec ±1.36% (86 runs sampled)
|
||||
fastest is 'v7.0'
|
||||
|
||||
# string
|
||||
v7.0 x 3,054,496 ops/sec ±1.05% (89 runs sampled)
|
||||
v6.0 x 2,957,781 ops/sec ±0.98% (88 runs sampled)
|
||||
parseFloat x 3,071,060 ops/sec ±1.13% (88 runs sampled)
|
||||
fastest is 'parseFloat,v7.0'
|
||||
|
||||
# number
|
||||
v7.0 x 3,146,895 ops/sec ±0.89% (89 runs sampled)
|
||||
v6.0 x 3,214,038 ops/sec ±1.07% (89 runs sampled)
|
||||
parseFloat x 3,077,588 ops/sec ±1.07% (87 runs sampled)
|
||||
fastest is 'v6.0'
|
||||
```
|
||||
|
||||
## 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).
|
||||
|
||||
</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>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
|
||||
* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ")
|
||||
* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
|
||||
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 49 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 5 | [charlike-old](https://github.com/charlike-old) |
|
||||
| 1 | [benaadams](https://github.com/benaadams) |
|
||||
| 1 | [realityking](https://github.com/realityking) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 15, 2018._
|
18
node_modules/sass/node_modules/is-number/index.js
generated
vendored
Normal file
18
node_modules/sass/node_modules/is-number/index.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
/*!
|
||||
* is-number <https://github.com/jonschlinkert/is-number>
|
||||
*
|
||||
* Copyright (c) 2014-present, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function(num) {
|
||||
if (typeof num === 'number') {
|
||||
return num - num === 0;
|
||||
}
|
||||
if (typeof num === 'string' && num.trim() !== '') {
|
||||
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
|
||||
}
|
||||
return false;
|
||||
};
|
82
node_modules/sass/node_modules/is-number/package.json
generated
vendored
Normal file
82
node_modules/sass/node_modules/is-number/package.json
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"name": "is-number",
|
||||
"description": "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.",
|
||||
"version": "7.0.0",
|
||||
"homepage": "https://github.com/jonschlinkert/is-number",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"contributors": [
|
||||
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
|
||||
"Olsten Larck (https://i.am.charlike.online)",
|
||||
"Rouven Weßling (www.rouvenwessling.de)"
|
||||
],
|
||||
"repository": "jonschlinkert/is-number",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/is-number/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.12.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ansi": "^0.3.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"gulp-format-md": "^1.0.0",
|
||||
"mocha": "^3.5.3"
|
||||
},
|
||||
"keywords": [
|
||||
"cast",
|
||||
"check",
|
||||
"coerce",
|
||||
"coercion",
|
||||
"finite",
|
||||
"integer",
|
||||
"is",
|
||||
"isnan",
|
||||
"is-nan",
|
||||
"is-num",
|
||||
"is-number",
|
||||
"isnumber",
|
||||
"isfinite",
|
||||
"istype",
|
||||
"kind",
|
||||
"math",
|
||||
"nan",
|
||||
"num",
|
||||
"number",
|
||||
"numeric",
|
||||
"parseFloat",
|
||||
"parseInt",
|
||||
"test",
|
||||
"type",
|
||||
"typeof",
|
||||
"value"
|
||||
],
|
||||
"verb": {
|
||||
"toc": false,
|
||||
"layout": "default",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"related": {
|
||||
"list": [
|
||||
"is-plain-object",
|
||||
"is-primitive",
|
||||
"isobject",
|
||||
"kind-of"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
}
|
||||
}
|
||||
}
|
21
node_modules/sass/node_modules/readdirp/LICENSE
generated
vendored
Normal file
21
node_modules/sass/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
node_modules/sass/node_modules/readdirp/README.md
generated
vendored
Normal file
122
node_modules/sass/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
node_modules/sass/node_modules/readdirp/index.d.ts
generated
vendored
Normal file
43
node_modules/sass/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
node_modules/sass/node_modules/readdirp/index.js
generated
vendored
Normal file
287
node_modules/sass/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
node_modules/sass/node_modules/readdirp/package.json
generated
vendored
Normal file
122
node_modules/sass/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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
21
node_modules/sass/node_modules/to-regex-range/LICENSE
generated
vendored
Normal file
21
node_modules/sass/node_modules/to-regex-range/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-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.
|
305
node_modules/sass/node_modules/to-regex-range/README.md
generated
vendored
Normal file
305
node_modules/sass/node_modules/to-regex-range/README.md
generated
vendored
Normal file
@ -0,0 +1,305 @@
|
||||
# to-regex-range [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [](https://www.npmjs.com/package/to-regex-range) [](https://npmjs.org/package/to-regex-range) [](https://npmjs.org/package/to-regex-range) [](https://travis-ci.org/micromatch/to-regex-range)
|
||||
|
||||
> Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions.
|
||||
|
||||
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
$ npm install --save to-regex-range
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><strong>What does this do?</strong></summary>
|
||||
|
||||
<br>
|
||||
|
||||
This libary generates the `source` string to be passed to `new RegExp()` for matching a range of numbers.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const toRegexRange = require('to-regex-range');
|
||||
const regex = new RegExp(toRegexRange('15', '95'));
|
||||
```
|
||||
|
||||
A string is returned so that you can do whatever you need with it before passing it to `new RegExp()` (like adding `^` or `$` boundaries, defining flags, or combining it another string).
|
||||
|
||||
<br>
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Why use this library?</strong></summary>
|
||||
|
||||
<br>
|
||||
|
||||
### Convenience
|
||||
|
||||
Creating regular expressions for matching numbers gets deceptively complicated pretty fast.
|
||||
|
||||
For example, let's say you need a validation regex for matching part of a user-id, postal code, social security number, tax id, etc:
|
||||
|
||||
* regex for matching `1` => `/1/` (easy enough)
|
||||
* regex for matching `1` through `5` => `/[1-5]/` (not bad...)
|
||||
* regex for matching `1` or `5` => `/(1|5)/` (still easy...)
|
||||
* regex for matching `1` through `50` => `/([1-9]|[1-4][0-9]|50)/` (uh-oh...)
|
||||
* regex for matching `1` through `55` => `/([1-9]|[1-4][0-9]|5[0-5])/` (no prob, I can do this...)
|
||||
* regex for matching `1` through `555` => `/([1-9]|[1-9][0-9]|[1-4][0-9]{2}|5[0-4][0-9]|55[0-5])/` (maybe not...)
|
||||
* regex for matching `0001` through `5555` => `/(0{3}[1-9]|0{2}[1-9][0-9]|0[1-9][0-9]{2}|[1-4][0-9]{3}|5[0-4][0-9]{2}|55[0-4][0-9]|555[0-5])/` (okay, I get the point!)
|
||||
|
||||
The numbers are contrived, but they're also really basic. In the real world you might need to generate a regex on-the-fly for validation.
|
||||
|
||||
**Learn more**
|
||||
|
||||
If you're interested in learning more about [character classes](http://www.regular-expressions.info/charclass.html) and other regex features, I personally have always found [regular-expressions.info](http://www.regular-expressions.info/charclass.html) to be pretty useful.
|
||||
|
||||
### Heavily tested
|
||||
|
||||
As of April 07, 2019, this library runs [>1m test assertions](./test/test.js) against generated regex-ranges to provide brute-force verification that results are correct.
|
||||
|
||||
Tests run in ~280ms on my MacBook Pro, 2.5 GHz Intel Core i7.
|
||||
|
||||
### Optimized
|
||||
|
||||
Generated regular expressions are optimized:
|
||||
|
||||
* duplicate sequences and character classes are reduced using quantifiers
|
||||
* smart enough to use `?` conditionals when number(s) or range(s) can be positive or negative
|
||||
* uses fragment caching to avoid processing the same exact string more than once
|
||||
|
||||
<br>
|
||||
|
||||
</details>
|
||||
|
||||
## Usage
|
||||
|
||||
Add this library to your javascript application with the following line of code
|
||||
|
||||
```js
|
||||
const toRegexRange = require('to-regex-range');
|
||||
```
|
||||
|
||||
The main export is a function that takes two integers: the `min` value and `max` value (formatted as strings or numbers).
|
||||
|
||||
```js
|
||||
const source = toRegexRange('15', '95');
|
||||
//=> 1[5-9]|[2-8][0-9]|9[0-5]
|
||||
|
||||
const regex = new RegExp(`^${source}$`);
|
||||
console.log(regex.test('14')); //=> false
|
||||
console.log(regex.test('50')); //=> true
|
||||
console.log(regex.test('94')); //=> true
|
||||
console.log(regex.test('96')); //=> false
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
### options.capture
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Deafault**: `undefined`
|
||||
|
||||
Wrap the returned value in parentheses when there is more than one regex condition. Useful when you're dynamically generating ranges.
|
||||
|
||||
```js
|
||||
console.log(toRegexRange('-10', '10'));
|
||||
//=> -[1-9]|-?10|[0-9]
|
||||
|
||||
console.log(toRegexRange('-10', '10', { capture: true }));
|
||||
//=> (-[1-9]|-?10|[0-9])
|
||||
```
|
||||
|
||||
### options.shorthand
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Deafault**: `undefined`
|
||||
|
||||
Use the regex shorthand for `[0-9]`:
|
||||
|
||||
```js
|
||||
console.log(toRegexRange('0', '999999'));
|
||||
//=> [0-9]|[1-9][0-9]{1,5}
|
||||
|
||||
console.log(toRegexRange('0', '999999', { shorthand: true }));
|
||||
//=> \d|[1-9]\d{1,5}
|
||||
```
|
||||
|
||||
### options.relaxZeros
|
||||
|
||||
**Type**: `boolean`
|
||||
|
||||
**Default**: `true`
|
||||
|
||||
This option relaxes matching for leading zeros when when ranges are zero-padded.
|
||||
|
||||
```js
|
||||
const source = toRegexRange('-0010', '0010');
|
||||
const regex = new RegExp(`^${source}$`);
|
||||
console.log(regex.test('-10')); //=> true
|
||||
console.log(regex.test('-010')); //=> true
|
||||
console.log(regex.test('-0010')); //=> true
|
||||
console.log(regex.test('10')); //=> true
|
||||
console.log(regex.test('010')); //=> true
|
||||
console.log(regex.test('0010')); //=> true
|
||||
```
|
||||
|
||||
When `relaxZeros` is false, matching is strict:
|
||||
|
||||
```js
|
||||
const source = toRegexRange('-0010', '0010', { relaxZeros: false });
|
||||
const regex = new RegExp(`^${source}$`);
|
||||
console.log(regex.test('-10')); //=> false
|
||||
console.log(regex.test('-010')); //=> false
|
||||
console.log(regex.test('-0010')); //=> true
|
||||
console.log(regex.test('10')); //=> false
|
||||
console.log(regex.test('010')); //=> false
|
||||
console.log(regex.test('0010')); //=> true
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
| **Range** | **Result** | **Compile time** |
|
||||
| --- | --- | --- |
|
||||
| `toRegexRange(-10, 10)` | `-[1-9]\|-?10\|[0-9]` | _132μs_ |
|
||||
| `toRegexRange(-100, -10)` | `-1[0-9]\|-[2-9][0-9]\|-100` | _50μs_ |
|
||||
| `toRegexRange(-100, 100)` | `-[1-9]\|-?[1-9][0-9]\|-?100\|[0-9]` | _42μs_ |
|
||||
| `toRegexRange(001, 100)` | `0{0,2}[1-9]\|0?[1-9][0-9]\|100` | _109μs_ |
|
||||
| `toRegexRange(001, 555)` | `0{0,2}[1-9]\|0?[1-9][0-9]\|[1-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _51μs_ |
|
||||
| `toRegexRange(0010, 1000)` | `0{0,2}1[0-9]\|0{0,2}[2-9][0-9]\|0?[1-9][0-9]{2}\|1000` | _31μs_ |
|
||||
| `toRegexRange(1, 50)` | `[1-9]\|[1-4][0-9]\|50` | _24μs_ |
|
||||
| `toRegexRange(1, 55)` | `[1-9]\|[1-4][0-9]\|5[0-5]` | _23μs_ |
|
||||
| `toRegexRange(1, 555)` | `[1-9]\|[1-9][0-9]\|[1-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _30μs_ |
|
||||
| `toRegexRange(1, 5555)` | `[1-9]\|[1-9][0-9]{1,2}\|[1-4][0-9]{3}\|5[0-4][0-9]{2}\|55[0-4][0-9]\|555[0-5]` | _43μs_ |
|
||||
| `toRegexRange(111, 555)` | `11[1-9]\|1[2-9][0-9]\|[2-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _38μs_ |
|
||||
| `toRegexRange(29, 51)` | `29\|[34][0-9]\|5[01]` | _24μs_ |
|
||||
| `toRegexRange(31, 877)` | `3[1-9]\|[4-9][0-9]\|[1-7][0-9]{2}\|8[0-6][0-9]\|87[0-7]` | _32μs_ |
|
||||
| `toRegexRange(5, 5)` | `5` | _8μs_ |
|
||||
| `toRegexRange(5, 6)` | `5\|6` | _11μs_ |
|
||||
| `toRegexRange(1, 2)` | `1\|2` | _6μs_ |
|
||||
| `toRegexRange(1, 5)` | `[1-5]` | _15μs_ |
|
||||
| `toRegexRange(1, 10)` | `[1-9]\|10` | _22μs_ |
|
||||
| `toRegexRange(1, 100)` | `[1-9]\|[1-9][0-9]\|100` | _25μs_ |
|
||||
| `toRegexRange(1, 1000)` | `[1-9]\|[1-9][0-9]{1,2}\|1000` | _31μs_ |
|
||||
| `toRegexRange(1, 10000)` | `[1-9]\|[1-9][0-9]{1,3}\|10000` | _34μs_ |
|
||||
| `toRegexRange(1, 100000)` | `[1-9]\|[1-9][0-9]{1,4}\|100000` | _36μs_ |
|
||||
| `toRegexRange(1, 1000000)` | `[1-9]\|[1-9][0-9]{1,5}\|1000000` | _42μs_ |
|
||||
| `toRegexRange(1, 10000000)` | `[1-9]\|[1-9][0-9]{1,6}\|10000000` | _42μs_ |
|
||||
|
||||
## Heads up!
|
||||
|
||||
**Order of arguments**
|
||||
|
||||
When the `min` is larger than the `max`, values will be flipped to create a valid range:
|
||||
|
||||
```js
|
||||
toRegexRange('51', '29');
|
||||
```
|
||||
|
||||
Is effectively flipped to:
|
||||
|
||||
```js
|
||||
toRegexRange('29', '51');
|
||||
//=> 29|[3-4][0-9]|5[0-1]
|
||||
```
|
||||
|
||||
**Steps / increments**
|
||||
|
||||
This library does not support steps (increments). A pr to add support would be welcome.
|
||||
|
||||
## History
|
||||
|
||||
### v2.0.0 - 2017-04-21
|
||||
|
||||
**New features**
|
||||
|
||||
Adds support for zero-padding!
|
||||
|
||||
### v1.0.0
|
||||
|
||||
**Optimizations**
|
||||
|
||||
Repeating ranges are now grouped using quantifiers. rocessing time is roughly the same, but the generated regex is much smaller, which should result in faster matching.
|
||||
|
||||
## Attribution
|
||||
|
||||
Inspired by the python library [range-regex](https://github.com/dimka665/range-regex).
|
||||
|
||||
## 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).
|
||||
|
||||
</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>
|
||||
|
||||
### Related projects
|
||||
|
||||
You might also be interested in these projects:
|
||||
|
||||
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used by micromatch.")
|
||||
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`")
|
||||
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
|
||||
* [repeat-element](https://www.npmjs.com/package/repeat-element): Create an array by repeating the given value n times. | [homepage](https://github.com/jonschlinkert/repeat-element "Create an array by repeating the given value n times.")
|
||||
* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string "Repeat the given string n times. Fastest implementation for repeating a string.")
|
||||
|
||||
### Contributors
|
||||
|
||||
| **Commits** | **Contributor** |
|
||||
| --- | --- |
|
||||
| 63 | [jonschlinkert](https://github.com/jonschlinkert) |
|
||||
| 3 | [doowb](https://github.com/doowb) |
|
||||
| 2 | [realityking](https://github.com/realityking) |
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
Please consider supporting me on Patreon, or [start your own Patreon page](https://patreon.com/invite/bxpbvm)!
|
||||
|
||||
<a href="https://www.patreon.com/jonschlinkert">
|
||||
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" height="50">
|
||||
</a>
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 07, 2019._
|
288
node_modules/sass/node_modules/to-regex-range/index.js
generated
vendored
Normal file
288
node_modules/sass/node_modules/to-regex-range/index.js
generated
vendored
Normal file
@ -0,0 +1,288 @@
|
||||
/*!
|
||||
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
||||
*
|
||||
* Copyright (c) 2015-present, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const isNumber = require('is-number');
|
||||
|
||||
const toRegexRange = (min, max, options) => {
|
||||
if (isNumber(min) === false) {
|
||||
throw new TypeError('toRegexRange: expected the first argument to be a number');
|
||||
}
|
||||
|
||||
if (max === void 0 || min === max) {
|
||||
return String(min);
|
||||
}
|
||||
|
||||
if (isNumber(max) === false) {
|
||||
throw new TypeError('toRegexRange: expected the second argument to be a number.');
|
||||
}
|
||||
|
||||
let opts = { relaxZeros: true, ...options };
|
||||
if (typeof opts.strictZeros === 'boolean') {
|
||||
opts.relaxZeros = opts.strictZeros === false;
|
||||
}
|
||||
|
||||
let relax = String(opts.relaxZeros);
|
||||
let shorthand = String(opts.shorthand);
|
||||
let capture = String(opts.capture);
|
||||
let wrap = String(opts.wrap);
|
||||
let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap;
|
||||
|
||||
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
||||
return toRegexRange.cache[cacheKey].result;
|
||||
}
|
||||
|
||||
let a = Math.min(min, max);
|
||||
let b = Math.max(min, max);
|
||||
|
||||
if (Math.abs(a - b) === 1) {
|
||||
let result = min + '|' + max;
|
||||
if (opts.capture) {
|
||||
return `(${result})`;
|
||||
}
|
||||
if (opts.wrap === false) {
|
||||
return result;
|
||||
}
|
||||
return `(?:${result})`;
|
||||
}
|
||||
|
||||
let isPadded = hasPadding(min) || hasPadding(max);
|
||||
let state = { min, max, a, b };
|
||||
let positives = [];
|
||||
let negatives = [];
|
||||
|
||||
if (isPadded) {
|
||||
state.isPadded = isPadded;
|
||||
state.maxLen = String(state.max).length;
|
||||
}
|
||||
|
||||
if (a < 0) {
|
||||
let newMin = b < 0 ? Math.abs(b) : 1;
|
||||
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
||||
a = state.a = 0;
|
||||
}
|
||||
|
||||
if (b >= 0) {
|
||||
positives = splitToPatterns(a, b, state, opts);
|
||||
}
|
||||
|
||||
state.negatives = negatives;
|
||||
state.positives = positives;
|
||||
state.result = collatePatterns(negatives, positives, opts);
|
||||
|
||||
if (opts.capture === true) {
|
||||
state.result = `(${state.result})`;
|
||||
} else if (opts.wrap !== false && (positives.length + negatives.length) > 1) {
|
||||
state.result = `(?:${state.result})`;
|
||||
}
|
||||
|
||||
toRegexRange.cache[cacheKey] = state;
|
||||
return state.result;
|
||||
};
|
||||
|
||||
function collatePatterns(neg, pos, options) {
|
||||
let onlyNegative = filterPatterns(neg, pos, '-', false, options) || [];
|
||||
let onlyPositive = filterPatterns(pos, neg, '', false, options) || [];
|
||||
let intersected = filterPatterns(neg, pos, '-?', true, options) || [];
|
||||
let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
||||
return subpatterns.join('|');
|
||||
}
|
||||
|
||||
function splitToRanges(min, max) {
|
||||
let nines = 1;
|
||||
let zeros = 1;
|
||||
|
||||
let stop = countNines(min, nines);
|
||||
let stops = new Set([max]);
|
||||
|
||||
while (min <= stop && stop <= max) {
|
||||
stops.add(stop);
|
||||
nines += 1;
|
||||
stop = countNines(min, nines);
|
||||
}
|
||||
|
||||
stop = countZeros(max + 1, zeros) - 1;
|
||||
|
||||
while (min < stop && stop <= max) {
|
||||
stops.add(stop);
|
||||
zeros += 1;
|
||||
stop = countZeros(max + 1, zeros) - 1;
|
||||
}
|
||||
|
||||
stops = [...stops];
|
||||
stops.sort(compare);
|
||||
return stops;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a range to a regex pattern
|
||||
* @param {Number} `start`
|
||||
* @param {Number} `stop`
|
||||
* @return {String}
|
||||
*/
|
||||
|
||||
function rangeToPattern(start, stop, options) {
|
||||
if (start === stop) {
|
||||
return { pattern: start, count: [], digits: 0 };
|
||||
}
|
||||
|
||||
let zipped = zip(start, stop);
|
||||
let digits = zipped.length;
|
||||
let pattern = '';
|
||||
let count = 0;
|
||||
|
||||
for (let i = 0; i < digits; i++) {
|
||||
let [startDigit, stopDigit] = zipped[i];
|
||||
|
||||
if (startDigit === stopDigit) {
|
||||
pattern += startDigit;
|
||||
|
||||
} else if (startDigit !== '0' || stopDigit !== '9') {
|
||||
pattern += toCharacterClass(startDigit, stopDigit, options);
|
||||
|
||||
} else {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count) {
|
||||
pattern += options.shorthand === true ? '\\d' : '[0-9]';
|
||||
}
|
||||
|
||||
return { pattern, count: [count], digits };
|
||||
}
|
||||
|
||||
function splitToPatterns(min, max, tok, options) {
|
||||
let ranges = splitToRanges(min, max);
|
||||
let tokens = [];
|
||||
let start = min;
|
||||
let prev;
|
||||
|
||||
for (let i = 0; i < ranges.length; i++) {
|
||||
let max = ranges[i];
|
||||
let obj = rangeToPattern(String(start), String(max), options);
|
||||
let zeros = '';
|
||||
|
||||
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
||||
if (prev.count.length > 1) {
|
||||
prev.count.pop();
|
||||
}
|
||||
|
||||
prev.count.push(obj.count[0]);
|
||||
prev.string = prev.pattern + toQuantifier(prev.count);
|
||||
start = max + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tok.isPadded) {
|
||||
zeros = padZeros(max, tok, options);
|
||||
}
|
||||
|
||||
obj.string = zeros + obj.pattern + toQuantifier(obj.count);
|
||||
tokens.push(obj);
|
||||
start = max + 1;
|
||||
prev = obj;
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
function filterPatterns(arr, comparison, prefix, intersection, options) {
|
||||
let result = [];
|
||||
|
||||
for (let ele of arr) {
|
||||
let { string } = ele;
|
||||
|
||||
// only push if _both_ are negative...
|
||||
if (!intersection && !contains(comparison, 'string', string)) {
|
||||
result.push(prefix + string);
|
||||
}
|
||||
|
||||
// or _both_ are positive
|
||||
if (intersection && contains(comparison, 'string', string)) {
|
||||
result.push(prefix + string);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Zip strings
|
||||
*/
|
||||
|
||||
function zip(a, b) {
|
||||
let arr = [];
|
||||
for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
|
||||
return arr;
|
||||
}
|
||||
|
||||
function compare(a, b) {
|
||||
return a > b ? 1 : b > a ? -1 : 0;
|
||||
}
|
||||
|
||||
function contains(arr, key, val) {
|
||||
return arr.some(ele => ele[key] === val);
|
||||
}
|
||||
|
||||
function countNines(min, len) {
|
||||
return Number(String(min).slice(0, -len) + '9'.repeat(len));
|
||||
}
|
||||
|
||||
function countZeros(integer, zeros) {
|
||||
return integer - (integer % Math.pow(10, zeros));
|
||||
}
|
||||
|
||||
function toQuantifier(digits) {
|
||||
let [start = 0, stop = ''] = digits;
|
||||
if (stop || start > 1) {
|
||||
return `{${start + (stop ? ',' + stop : '')}}`;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function toCharacterClass(a, b, options) {
|
||||
return `[${a}${(b - a === 1) ? '' : '-'}${b}]`;
|
||||
}
|
||||
|
||||
function hasPadding(str) {
|
||||
return /^-?(0+)\d/.test(str);
|
||||
}
|
||||
|
||||
function padZeros(value, tok, options) {
|
||||
if (!tok.isPadded) {
|
||||
return value;
|
||||
}
|
||||
|
||||
let diff = Math.abs(tok.maxLen - String(value).length);
|
||||
let relax = options.relaxZeros !== false;
|
||||
|
||||
switch (diff) {
|
||||
case 0:
|
||||
return '';
|
||||
case 1:
|
||||
return relax ? '0?' : '0';
|
||||
case 2:
|
||||
return relax ? '0{0,2}' : '00';
|
||||
default: {
|
||||
return relax ? `0{0,${diff}}` : `0{${diff}}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache
|
||||
*/
|
||||
|
||||
toRegexRange.cache = {};
|
||||
toRegexRange.clearCache = () => (toRegexRange.cache = {});
|
||||
|
||||
/**
|
||||
* Expose `toRegexRange`
|
||||
*/
|
||||
|
||||
module.exports = toRegexRange;
|
88
node_modules/sass/node_modules/to-regex-range/package.json
generated
vendored
Normal file
88
node_modules/sass/node_modules/to-regex-range/package.json
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"name": "to-regex-range",
|
||||
"description": "Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions.",
|
||||
"version": "5.0.1",
|
||||
"homepage": "https://github.com/micromatch/to-regex-range",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"contributors": [
|
||||
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
|
||||
"Rouven Weßling (www.rouvenwessling.de)"
|
||||
],
|
||||
"repository": "micromatch/to-regex-range",
|
||||
"bugs": {
|
||||
"url": "https://github.com/micromatch/to-regex-range/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"dependencies": {
|
||||
"is-number": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"fill-range": "^6.0.0",
|
||||
"gulp-format-md": "^2.0.0",
|
||||
"mocha": "^6.0.2",
|
||||
"text-table": "^0.2.0",
|
||||
"time-diff": "^0.3.1"
|
||||
},
|
||||
"keywords": [
|
||||
"bash",
|
||||
"date",
|
||||
"expand",
|
||||
"expansion",
|
||||
"expression",
|
||||
"glob",
|
||||
"match",
|
||||
"match date",
|
||||
"match number",
|
||||
"match numbers",
|
||||
"match year",
|
||||
"matches",
|
||||
"matching",
|
||||
"number",
|
||||
"numbers",
|
||||
"numerical",
|
||||
"range",
|
||||
"ranges",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular",
|
||||
"regular expression",
|
||||
"sequence"
|
||||
],
|
||||
"verb": {
|
||||
"layout": "default",
|
||||
"toc": false,
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
},
|
||||
"helpers": {
|
||||
"examples": {
|
||||
"displayName": "examples"
|
||||
}
|
||||
},
|
||||
"related": {
|
||||
"list": [
|
||||
"expand-range",
|
||||
"fill-range",
|
||||
"micromatch",
|
||||
"repeat-element",
|
||||
"repeat-string"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
1
node_modules/sass/package.json
generated
vendored
Normal file
1
node_modules/sass/package.json
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"name":"sass","description":"A pure JavaScript implementation of Sass.","license":"MIT","bugs":"https://github.com/sass/dart-sass/issues","homepage":"https://github.com/sass/dart-sass","repository":{"type":"git","url":"https://github.com/sass/dart-sass"},"author":{"name":"Natalie Weizenbaum","email":"nweiz@google.com","url":"https://github.com/nex3"},"engines":{"node":">=12.0.0"},"dependencies":{"chokidar":">=3.0.0 <4.0.0","immutable":"^4.0.0","source-map-js":">=0.6.2 <2.0.0"},"keywords":["style","scss","sass","preprocessor","css"],"types":"types/index.d.ts","exports":{"types":"./types/index.d.ts","default":"./sass.default.dart.js"},"version":"1.55.0","bin":{"sass":"sass.js"},"main":"sass.default.dart.js"}
|
101326
node_modules/sass/sass.dart.js
generated
vendored
Normal file
101326
node_modules/sass/sass.dart.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/sass/sass.default.dart.js
generated
vendored
Normal file
4
node_modules/sass/sass.default.dart.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
var library = require('./sass.dart.js');
|
||||
library.load({});
|
||||
|
||||
module.exports = library;
|
9
node_modules/sass/sass.js
generated
vendored
Executable file
9
node_modules/sass/sass.js
generated
vendored
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var library = require('./sass.dart.js');
|
||||
library.load({
|
||||
readline: require("readline"),
|
||||
chokidar: require("chokidar"),
|
||||
});
|
||||
|
||||
library.cli_pkg_main_0_(process.argv.slice(2));
|
152
node_modules/sass/types/compile.d.ts
generated
vendored
Normal file
152
node_modules/sass/types/compile.d.ts
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
import {RawSourceMap} from 'source-map-js';
|
||||
|
||||
import {Options, StringOptions} from './options';
|
||||
|
||||
/**
|
||||
* The result of compiling Sass to CSS. Returned by [[compile]],
|
||||
* [[compileAsync]], [[compileString]], and [[compileStringAsync]].
|
||||
*
|
||||
* @category Compile
|
||||
*/
|
||||
export interface CompileResult {
|
||||
/**
|
||||
* The generated CSS.
|
||||
*
|
||||
* Note that this *never* includes a `sourceMapUrl` comment—it's up to the
|
||||
* caller to determine where to save the source map and how to link to it from
|
||||
* the stylesheet.
|
||||
*/
|
||||
css: string;
|
||||
|
||||
/**
|
||||
* The canonical URLs of all the stylesheets that were loaded during the
|
||||
* Sass compilation. The order of these URLs is not guaranteed.
|
||||
*/
|
||||
loadedUrls: URL[];
|
||||
|
||||
/**
|
||||
* The object representation of the source map that maps locations in the
|
||||
* generated CSS back to locations in the Sass source code.
|
||||
*
|
||||
* This typically uses absolute `file:` URLs to refer to Sass files, although
|
||||
* this can be controlled by having a custom [[Importer]] return
|
||||
* [[ImporterResult.sourceMapUrl]].
|
||||
*
|
||||
* This is set if and only if [[Options.sourceMap]] is `true`.
|
||||
*/
|
||||
sourceMap?: RawSourceMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronously compiles the Sass file at `path` to CSS. If it succeeds it
|
||||
* returns a [[CompileResult]], and if it fails it throws an [[Exception]].
|
||||
*
|
||||
* This only allows synchronous [[Importer]]s and [[CustomFunction]]s.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const sass = require('sass');
|
||||
*
|
||||
* const result = sass.compile("style.scss");
|
||||
* console.log(result.css);
|
||||
* ```
|
||||
*
|
||||
* @category Compile
|
||||
* @compatibility dart: "1.45.0", node: false
|
||||
*/
|
||||
export function compile(path: string, options?: Options<'sync'>): CompileResult;
|
||||
|
||||
/**
|
||||
* Asynchronously compiles the Sass file at `path` to CSS. Returns a promise
|
||||
* that resolves with a [[CompileResult]] if it succeeds and rejects with an
|
||||
* [[Exception]] if it fails.
|
||||
*
|
||||
* This only allows synchronous or asynchronous [[Importer]]s and
|
||||
* [[CustomFunction]]s.
|
||||
*
|
||||
* **Heads up!** When using Dart Sass, **[[compile]] is almost twice as fast as
|
||||
* [[compileAsync]]**, due to the overhead of making the entire evaluation
|
||||
* process asynchronous.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const sass = require('sass');
|
||||
*
|
||||
* const result = await sass.compileAsync("style.scss");
|
||||
* console.log(result.css);
|
||||
* ```
|
||||
*
|
||||
* @category Compile
|
||||
* @compatibility dart: "1.45.0", node: false
|
||||
*/
|
||||
export function compileAsync(
|
||||
path: string,
|
||||
options?: Options<'async'>
|
||||
): Promise<CompileResult>;
|
||||
|
||||
/**
|
||||
* Synchronously compiles a stylesheet whose contents is `source` to CSS. If it
|
||||
* succeeds it returns a [[CompileResult]], and if it fails it throws an
|
||||
* [[Exception]].
|
||||
*
|
||||
* This only allows synchronous [[Importer]]s and [[CustomFunction]]s.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const sass = require('sass');
|
||||
*
|
||||
* const result = sass.compileString(`
|
||||
* h1 {
|
||||
* font-size: 40px;
|
||||
* code {
|
||||
* font-face: Roboto Mono;
|
||||
* }
|
||||
* }`);
|
||||
* console.log(result.css);
|
||||
* ```
|
||||
*
|
||||
* @category Compile
|
||||
* @compatibility dart: "1.45.0", node: false
|
||||
*/
|
||||
export function compileString(
|
||||
source: string,
|
||||
options?: StringOptions<'sync'>
|
||||
): CompileResult;
|
||||
|
||||
/**
|
||||
* Asynchronously compiles a stylesheet whose contents is `source` to CSS.
|
||||
* Returns a promise that resolves with a [[CompileResult]] if it succeeds and
|
||||
* rejects with an [[Exception]] if it fails.
|
||||
*
|
||||
* This only allows synchronous or asynchronous [[Importer]]s and
|
||||
* [[CustomFunction]]s.
|
||||
*
|
||||
* **Heads up!** When using Dart Sass, **[[compile]] is almost twice as fast as
|
||||
* [[compileAsync]]**, due to the overhead of making the entire evaluation
|
||||
* process asynchronous.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const sass = require('sass');
|
||||
*
|
||||
* const result = await sass.compileStringAsync(`
|
||||
* h1 {
|
||||
* font-size: 40px;
|
||||
* code {
|
||||
* font-face: Roboto Mono;
|
||||
* }
|
||||
* }`);
|
||||
* console.log(result.css);
|
||||
* ```
|
||||
*
|
||||
* @category Compile
|
||||
* @compatibility dart: "1.45.0", node: false
|
||||
*/
|
||||
export function compileStringAsync(
|
||||
source: string,
|
||||
options?: StringOptions<'async'>
|
||||
): Promise<CompileResult>;
|
41
node_modules/sass/types/exception.d.ts
generated
vendored
Normal file
41
node_modules/sass/types/exception.d.ts
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
import {SourceSpan} from './logger';
|
||||
|
||||
/**
|
||||
* An exception thrown because a Sass compilation failed.
|
||||
*
|
||||
* @category Other
|
||||
*/
|
||||
export class Exception extends Error {
|
||||
private constructor();
|
||||
|
||||
/**
|
||||
* A human-friendly representation of the exception.
|
||||
*
|
||||
* Because many tools simply print `Error.message` directly, this includes not
|
||||
* only the textual description of what went wrong (the [[sassMessage]]) but
|
||||
* also an indication of where in the Sass stylesheet the error occurred (the
|
||||
* [[span]]) and the Sass stack trace at the point of error (the
|
||||
* [[sassStack]]).
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
* A textual description of what went wrong.
|
||||
*
|
||||
* Unlike [[message]], this does *not* include representations of [[span]] or
|
||||
* [[sassStack]].
|
||||
*/
|
||||
readonly sassMessage: string;
|
||||
|
||||
/**
|
||||
* A human-friendly representation of the Sass stack trace at the point of
|
||||
* error.
|
||||
*/
|
||||
readonly sassStack: string;
|
||||
|
||||
/** The location the error occurred in the Sass file that triggered it. */
|
||||
readonly span: SourceSpan;
|
||||
|
||||
/** Returns the same string as [[message]]. */
|
||||
toString(): string;
|
||||
}
|
294
node_modules/sass/types/importer.d.ts
generated
vendored
Normal file
294
node_modules/sass/types/importer.d.ts
generated
vendored
Normal file
@ -0,0 +1,294 @@
|
||||
import {Syntax} from './options';
|
||||
import {PromiseOr} from './util/promise_or';
|
||||
|
||||
/**
|
||||
* A special type of importer that redirects all loads to existing files on
|
||||
* disk. Although this is less powerful than a full [[Importer]], it
|
||||
* automatically takes care of Sass features like resolving partials and file
|
||||
* extensions and of loading the file from disk.
|
||||
*
|
||||
* Like all importers, this implements custom Sass loading logic for [`@use`
|
||||
* rules](https://sass-lang.com/documentation/at-rules/use) and [`@import`
|
||||
* rules](https://sass-lang.com/documentation/at-rules/import). It can be passed
|
||||
* to [[Options.importers]] or [[StringOptionsWithImporter.importer]].
|
||||
*
|
||||
* @typeParam sync - A `FileImporter<'sync'>`'s [[findFileUrl]] must return
|
||||
* synchronously, but in return it can be passed to [[compile]] and
|
||||
* [[compileString]] in addition to [[compileAsync]] and [[compileStringAsync]].
|
||||
*
|
||||
* A `FileImporter<'async'>`'s [[findFileUrl]] may either return synchronously
|
||||
* or asynchronously, but it can only be used with [[compileAsync]] and
|
||||
* [[compileStringAsync]].
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const {pathToFileURL} = require('url');
|
||||
*
|
||||
* sass.compile('style.scss', {
|
||||
* importers: [{
|
||||
* // An importer that redirects relative URLs starting with "~" to
|
||||
* // `node_modules`.
|
||||
* findFileUrl(url) {
|
||||
* if (!url.startsWith('~')) return null;
|
||||
* return new URL(url.substring(1), pathToFileURL('node_modules'));
|
||||
* }
|
||||
* }]
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @category Importer
|
||||
*/
|
||||
export interface FileImporter<
|
||||
sync extends 'sync' | 'async' = 'sync' | 'async'
|
||||
> {
|
||||
/**
|
||||
* A callback that's called to partially resolve a load (such as
|
||||
* [`@use`](https://sass-lang.com/documentation/at-rules/use) or
|
||||
* [`@import`](https://sass-lang.com/documentation/at-rules/import)) to a file
|
||||
* on disk.
|
||||
*
|
||||
* Unlike an [[Importer]], the compiler will automatically handle relative
|
||||
* loads for a [[FileImporter]]. See [[Options.importers]] for more details on
|
||||
* the way loads are resolved.
|
||||
*
|
||||
* @param url - The loaded URL. Since this might be relative, it's represented
|
||||
* as a string rather than a [[URL]] object.
|
||||
*
|
||||
* @param options.fromImport - Whether this is being invoked because of a Sass
|
||||
* `@import` rule, as opposed to a `@use` or `@forward` rule.
|
||||
*
|
||||
* This should *only* be used for determining whether or not to load
|
||||
* [import-only files](https://sass-lang.com/documentation/at-rules/import#import-only-files).
|
||||
*
|
||||
* @returns An absolute `file:` URL if this importer recognizes the `url`.
|
||||
* This may be only partially resolved: the compiler will automatically look
|
||||
* for [partials](https://sass-lang.com/documentation/at-rules/use#partials),
|
||||
* [index files](https://sass-lang.com/documentation/at-rules/use#index-files),
|
||||
* and file extensions based on the returned URL. An importer may also return
|
||||
* a fully resolved URL if it so chooses.
|
||||
*
|
||||
* If this importer doesn't recognize the URL, it should return `null` instead
|
||||
* to allow other importers or {@link Options.loadPaths | load paths} to
|
||||
* handle it.
|
||||
*
|
||||
* This may also return a `Promise`, but if it does the importer may only be
|
||||
* passed to [[compileAsync]] and [[compileStringAsync]], not [[compile]] or
|
||||
* [[compileString]].
|
||||
*
|
||||
* @throws any - If this importer recognizes `url` but determines that it's
|
||||
* invalid, it may throw an exception that will be wrapped by Sass. If the
|
||||
* exception object has a `message` property, it will be used as the wrapped
|
||||
* exception's message; otherwise, the exception object's `toString()` will be
|
||||
* used. This means it's safe for importers to throw plain strings.
|
||||
*/
|
||||
findFileUrl(
|
||||
url: string,
|
||||
options: {fromImport: boolean}
|
||||
): PromiseOr<URL | null, sync>;
|
||||
|
||||
/** @hidden */
|
||||
canonicalize?: never;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object that implements custom Sass loading logic for [`@use`
|
||||
* rules](https://sass-lang.com/documentation/at-rules/use) and [`@import`
|
||||
* rules](https://sass-lang.com/documentation/at-rules/import). It can be passed
|
||||
* to [[Options.importers]] or [[StringOptionsWithImporter.importer]].
|
||||
*
|
||||
* Importers that simply redirect to files on disk are encouraged to use the
|
||||
* [[FileImporter]] interface instead.
|
||||
*
|
||||
* See [[Options.importers]] for more details on the way loads are resolved.
|
||||
*
|
||||
* @typeParam sync - An `Importer<'sync'>`'s [[canonicalize]] and [[load]] must
|
||||
* return synchronously, but in return it can be passed to [[compile]] and
|
||||
* [[compileString]] in addition to [[compileAsync]] and [[compileStringAsync]].
|
||||
*
|
||||
* An `Importer<'async'>`'s [[canonicalize]] and [[load]] may either return
|
||||
* synchronously or asynchronously, but it can only be used with
|
||||
* [[compileAsync]] and [[compileStringAsync]].
|
||||
*
|
||||
* @example Resolving a Load
|
||||
*
|
||||
* This is the process of resolving a load using a custom importer:
|
||||
*
|
||||
* - The compiler encounters `@use "db:foo/bar/baz"`.
|
||||
* - It calls [[canonicalize]] with `"db:foo/bar/baz"`.
|
||||
* - [[canonicalize]] returns `new URL("db:foo/bar/baz/_index.scss")`.
|
||||
* - If the compiler has already loaded a stylesheet with this canonical URL, it
|
||||
* re-uses the existing module.
|
||||
* - Otherwise, it calls [[load]] with `new URL("db:foo/bar/baz/_index.scss")`.
|
||||
* - [[load]] returns an [[ImporterResult]] that the compiler uses as the
|
||||
* contents of the module.
|
||||
*
|
||||
* @example Code Sample
|
||||
*
|
||||
* ```js
|
||||
* sass.compile('style.scss', {
|
||||
* // An importer for URLs like `bgcolor:orange` that generates a
|
||||
* // stylesheet with the given background color.
|
||||
* importers: [{
|
||||
* canonicalize(url) {
|
||||
* if (!url.startsWith('bgcolor:')) return null;
|
||||
* return new URL(url);
|
||||
* },
|
||||
* load(canonicalUrl) {
|
||||
* return {
|
||||
* contents: `body {background-color: ${canonicalUrl.pathname}}`,
|
||||
* syntax: 'scss'
|
||||
* };
|
||||
* }
|
||||
* }]
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @category Importer
|
||||
*/
|
||||
export interface Importer<sync extends 'sync' | 'async' = 'sync' | 'async'> {
|
||||
/**
|
||||
* If `url` is recognized by this importer, returns its canonical format.
|
||||
*
|
||||
* If Sass has already loaded a stylesheet with the returned canonical URL, it
|
||||
* re-uses the existing parse tree (and the loaded module for `@use`). This
|
||||
* means that importers **must ensure** that the same canonical URL always
|
||||
* refers to the same stylesheet, *even across different importers*. As such,
|
||||
* importers are encouraged to use unique URL schemes to disambiguate between
|
||||
* one another.
|
||||
*
|
||||
* As much as possible, custom importers should canonicalize URLs the same way
|
||||
* as the built-in filesystem importer:
|
||||
*
|
||||
* - The importer should look for stylesheets by adding the prefix `_` to the
|
||||
* URL's basename, and by adding the extensions `.sass` and `.scss` if the
|
||||
* URL doesn't already have one of those extensions. For example, if the
|
||||
* URL was `foo/bar/baz`, the importer would look for:
|
||||
* - `foo/bar/baz.sass`
|
||||
* - `foo/bar/baz.scss`
|
||||
* - `foo/bar/_baz.sass`
|
||||
* - `foo/bar/_baz.scss`
|
||||
*
|
||||
* If the URL was `foo/bar/baz.scss`, the importer would just look for:
|
||||
* - `foo/bar/baz.scss`
|
||||
* - `foo/bar/_baz.scss`
|
||||
*
|
||||
* If the importer finds a stylesheet at more than one of these URLs, it
|
||||
* should throw an exception indicating that the URL is ambiguous. Note that
|
||||
* if the extension is explicitly specified, a stylesheet with the opposite
|
||||
* extension is allowed to exist.
|
||||
*
|
||||
* - If none of the possible paths is valid, the importer should perform the
|
||||
* same resolution on the URL followed by `/index`. In the example above,
|
||||
* it would look for:
|
||||
* - `foo/bar/baz/index.sass`
|
||||
* - `foo/bar/baz/index.scss`
|
||||
* - `foo/bar/baz/_index.sass`
|
||||
* - `foo/bar/baz/_index.scss`
|
||||
*
|
||||
* As above, if the importer finds a stylesheet at more than one of these
|
||||
* URLs, it should throw an exception indicating that the import is
|
||||
* ambiguous.
|
||||
*
|
||||
* If no stylesheets are found, the importer should return `null`.
|
||||
*
|
||||
* Calling [[canonicalize]] multiple times with the same URL must return the
|
||||
* same result. Calling [[canonicalize]] with a URL returned by a previous
|
||||
* call to [[canonicalize]] must return that URL.
|
||||
*
|
||||
* Relative loads in stylesheets loaded from an importer are handled by
|
||||
* resolving the loaded URL relative to the canonical URL of the stylesheet
|
||||
* that contains it, and passing that URL back to the importer's
|
||||
* [[canonicalize]] method. For example, suppose the "Resolving a Load"
|
||||
* example {@link Importer | above} returned a stylesheet that contained
|
||||
* `@use "mixins"`:
|
||||
*
|
||||
* - The compiler resolves the URL `mixins` relative to the current
|
||||
* stylesheet's canonical URL `db:foo/bar/baz/_index.scss` to get
|
||||
* `db:foo/bar/baz/mixins`.
|
||||
* - It calls [[canonicalize]] with `"db:foo/bar/baz/mixins"`.
|
||||
* - [[canonicalize]] returns `new URL("db:foo/bar/baz/_mixins.scss")`.
|
||||
*
|
||||
* Because of this, [[canonicalize]] must return a meaningful result when
|
||||
* called with a URL relative to one returned by an earlier call to
|
||||
* [[canonicalize]].
|
||||
*
|
||||
* @param url - The loaded URL. Since this might be relative, it's represented
|
||||
* as a string rather than a [[URL]] object.
|
||||
*
|
||||
* @param options.fromImport - Whether this is being invoked because of a Sass
|
||||
* `@import` rule, as opposed to a `@use` or `@forward` rule.
|
||||
*
|
||||
* This should *only* be used for determining whether or not to load
|
||||
* [import-only files](https://sass-lang.com/documentation/at-rules/import#import-only-files).
|
||||
*
|
||||
* @returns An absolute URL if this importer recognizes the `url`, or `null`
|
||||
* if it doesn't. If this returns `null`, other importers or {@link
|
||||
* Options.loadPaths | load paths} may handle the load.
|
||||
*
|
||||
* This may also return a `Promise`, but if it does the importer may only be
|
||||
* passed to [[compileAsync]] and [[compileStringAsync]], not [[compile]] or
|
||||
* [[compileString]].
|
||||
*
|
||||
* @throws any - If this importer recognizes `url` but determines that it's
|
||||
* invalid, it may throw an exception that will be wrapped by Sass. If the
|
||||
* exception object has a `message` property, it will be used as the wrapped
|
||||
* exception's message; otherwise, the exception object's `toString()` will be
|
||||
* used. This means it's safe for importers to throw plain strings.
|
||||
*/
|
||||
canonicalize(
|
||||
url: string,
|
||||
options: {fromImport: boolean}
|
||||
): PromiseOr<URL | null, sync>;
|
||||
|
||||
/**
|
||||
* Loads the Sass text for the given `canonicalUrl`, or returns `null` if this
|
||||
* importer can't find the stylesheet it refers to.
|
||||
*
|
||||
* @param canonicalUrl - The canonical URL of the stylesheet to load. This is
|
||||
* guaranteed to come from a call to [[canonicalize]], although not every call
|
||||
* to [[canonicalize]] will result in a call to [[load]].
|
||||
*
|
||||
* @returns The contents of the stylesheet at `canonicalUrl` if it can be
|
||||
* loaded, or `null` if it can't.
|
||||
*
|
||||
* This may also return a `Promise`, but if it does the importer may only be
|
||||
* passed to [[compileAsync]] and [[compileStringAsync]], not [[compile]] or
|
||||
* [[compileString]].
|
||||
*
|
||||
* @throws any - If this importer finds a stylesheet at `url` but it fails to
|
||||
* load for some reason, or if `url` is uniquely associated with this importer
|
||||
* but doesn't refer to a real stylesheet, the importer may throw an exception
|
||||
* that will be wrapped by Sass. If the exception object has a `message`
|
||||
* property, it will be used as the wrapped exception's message; otherwise,
|
||||
* the exception object's `toString()` will be used. This means it's safe for
|
||||
* importers to throw plain strings.
|
||||
*/
|
||||
load(canonicalUrl: URL): PromiseOr<ImporterResult | null, sync>;
|
||||
|
||||
/** @hidden */
|
||||
findFileUrl?: never;
|
||||
}
|
||||
|
||||
/**
|
||||
* The result of successfully loading a stylesheet with an [[Importer]].
|
||||
*
|
||||
* @category Importer
|
||||
*/
|
||||
export interface ImporterResult {
|
||||
/** The contents of the stylesheet. */
|
||||
contents: string;
|
||||
|
||||
/** The syntax with which to parse [[contents]]. */
|
||||
syntax: Syntax;
|
||||
|
||||
/**
|
||||
* The URL to use to link to the loaded stylesheet's source code in source
|
||||
* maps. A `file:` URL is ideal because it's accessible to both browsers and
|
||||
* other build tools, but an `http:` URL is also acceptable.
|
||||
*
|
||||
* If this isn't set, it defaults to a `data:` URL that contains the contents
|
||||
* of the loaded stylesheet.
|
||||
*/
|
||||
sourceMapUrl?: URL;
|
||||
}
|
80
node_modules/sass/types/index.d.ts
generated
vendored
Normal file
80
node_modules/sass/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
// This is a mirror of the JS API definitions in `spec/js-api`, but with comments
|
||||
// written to provide user-facing documentation rather than to specify behavior for
|
||||
// implementations.
|
||||
|
||||
export {
|
||||
CompileResult,
|
||||
compile,
|
||||
compileAsync,
|
||||
compileString,
|
||||
compileStringAsync,
|
||||
} from './compile';
|
||||
export {Exception} from './exception';
|
||||
export {FileImporter, Importer, ImporterResult} from './importer';
|
||||
export {Logger, SourceSpan, SourceLocation} from './logger';
|
||||
export {
|
||||
CustomFunction,
|
||||
Options,
|
||||
OutputStyle,
|
||||
StringOptions,
|
||||
StringOptionsWithImporter,
|
||||
StringOptionsWithoutImporter,
|
||||
Syntax,
|
||||
} from './options';
|
||||
export {PromiseOr} from './util/promise_or';
|
||||
export {
|
||||
ListSeparator,
|
||||
SassArgumentList,
|
||||
SassBoolean,
|
||||
SassColor,
|
||||
SassFunction,
|
||||
SassList,
|
||||
SassMap,
|
||||
SassNumber,
|
||||
SassString,
|
||||
Value,
|
||||
sassFalse,
|
||||
sassNull,
|
||||
sassTrue,
|
||||
} from './value';
|
||||
|
||||
// Legacy APIs
|
||||
export {LegacyException} from './legacy/exception';
|
||||
export {
|
||||
FALSE,
|
||||
LegacyAsyncFunction,
|
||||
LegacyAsyncFunctionDone,
|
||||
LegacyFunction,
|
||||
LegacySyncFunction,
|
||||
LegacyValue,
|
||||
NULL,
|
||||
TRUE,
|
||||
types,
|
||||
} from './legacy/function';
|
||||
export {
|
||||
LegacyAsyncImporter,
|
||||
LegacyImporter,
|
||||
LegacyImporterResult,
|
||||
LegacyImporterThis,
|
||||
LegacySyncImporter,
|
||||
} from './legacy/importer';
|
||||
export {
|
||||
LegacySharedOptions,
|
||||
LegacyFileOptions,
|
||||
LegacyStringOptions,
|
||||
LegacyOptions,
|
||||
} from './legacy/options';
|
||||
export {LegacyPluginThis} from './legacy/plugin_this';
|
||||
export {LegacyResult, render, renderSync} from './legacy/render';
|
||||
|
||||
/**
|
||||
* Information about the Sass implementation. This always begins with a unique
|
||||
* identifier for the Sass implementation, followed by U+0009 TAB, followed by
|
||||
* its npm package version. Some implementations include additional information
|
||||
* as well, but not in any standardized format.
|
||||
*
|
||||
* * For Dart Sass, the implementation name is `dart-sass`.
|
||||
* * For Node Sass, the implementation name is `node-sass`.
|
||||
* * For the embedded host, the implementation name is `sass-embedded`.
|
||||
*/
|
||||
export const info: string;
|
54
node_modules/sass/types/legacy/exception.d.ts
generated
vendored
Normal file
54
node_modules/sass/types/legacy/exception.d.ts
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* The exception type thrown by [[renderSync]] and passed as the error to
|
||||
* [[render]]'s callback.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This is only thrown by the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[compile]], [[compileString]], [[compileAsync]], and
|
||||
* [[compileStringAsync]] instead.
|
||||
*/
|
||||
export interface LegacyException extends Error {
|
||||
/**
|
||||
* The error message. For Dart Sass, when possible this includes a highlighted
|
||||
* indication of where in the source file the error occurred as well as the
|
||||
* Sass stack trace.
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
* The error message. For Dart Sass, this is the same as the result of calling
|
||||
* [[toString]], which is itself the same as [[message]] but with the prefix
|
||||
* "Error:".
|
||||
*/
|
||||
formatted: string;
|
||||
|
||||
/**
|
||||
* The (1-based) line number on which the error occurred, if this exception is
|
||||
* associated with a specific Sass file location.
|
||||
*/
|
||||
line?: number;
|
||||
|
||||
/**
|
||||
* The (1-based) column number within [[line]] at which the error occurred, if
|
||||
* this exception is associated with a specific Sass file location.
|
||||
*/
|
||||
column?: number;
|
||||
|
||||
/**
|
||||
* Analogous to the exit code for an executable. `1` for an error caused by a
|
||||
* Sass file, `3` for any other type of error.
|
||||
*/
|
||||
status: number;
|
||||
|
||||
/**
|
||||
* If this exception was caused by an error in a Sass file, this will
|
||||
* represent the Sass file's location. It can be in one of three formats:
|
||||
*
|
||||
* * If the Sass file was loaded from disk, this is the path to that file.
|
||||
* * If the Sass file was generated by an importer, this is its canonical URL.
|
||||
* * If the Sass file was passed as [[LegacyStringOptions.data]] without a
|
||||
* corresponding [[LegacyStringOptions.file]], this is the special string
|
||||
* `"stdin"`.
|
||||
*/
|
||||
file?: string;
|
||||
}
|
756
node_modules/sass/types/legacy/function.d.ts
generated
vendored
Normal file
756
node_modules/sass/types/legacy/function.d.ts
generated
vendored
Normal file
@ -0,0 +1,756 @@
|
||||
import {LegacyPluginThis} from './plugin_this';
|
||||
|
||||
/**
|
||||
* A synchronous callback that implements a custom Sass function. This can be
|
||||
* passed to [[LegacySharedOptions.functions]] for either [[render]] or
|
||||
* [[renderSync]].
|
||||
*
|
||||
* If this throws an error, Sass will treat that as the function failing with
|
||||
* that error message.
|
||||
*
|
||||
* ```js
|
||||
* const result = sass.renderSync({
|
||||
* file: 'style.scss',
|
||||
* functions: {
|
||||
* "sum($arg1, $arg2)": (arg1, arg2) => {
|
||||
* if (!(arg1 instanceof sass.types.Number)) {
|
||||
* throw new Error("$arg1: Expected a number");
|
||||
* } else if (!(arg2 instanceof sass.types.Number)) {
|
||||
* throw new Error("$arg2: Expected a number");
|
||||
* }
|
||||
* return new sass.types.Number(arg1.getValue() + arg2.getValue());
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param args - One argument for each argument that's declared in the signature
|
||||
* that's passed to [[LegacySharedOptions.functions]]. If the signature [takes
|
||||
* arbitrary arguments](https://sass-lang.com/documentation/at-rules/function#taking-arbitrary-arguments),
|
||||
* they're passed as a single argument list in the last argument.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[CustomFunction]] with [[compile]], [[compileString]],
|
||||
* [[compileAsync]], and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export type LegacySyncFunction = (
|
||||
this: LegacyPluginThis,
|
||||
...args: LegacyValue[]
|
||||
) => LegacyValue;
|
||||
|
||||
/**
|
||||
* An asynchronous callback that implements a custom Sass function. This can be
|
||||
* passed to [[LegacySharedOptions.functions]], but only for [[render]].
|
||||
*
|
||||
* An asynchronous function must return `undefined`. Its final argument will
|
||||
* always be a callback, which it should call with the result of the function
|
||||
* once it's done running.
|
||||
*
|
||||
* If this throws an error, Sass will treat that as the function failing with
|
||||
* that error message.
|
||||
*
|
||||
* ```js
|
||||
* sass.render({
|
||||
* file: 'style.scss',
|
||||
* functions: {
|
||||
* "sum($arg1, $arg2)": (arg1, arg2, done) => {
|
||||
* if (!(arg1 instanceof sass.types.Number)) {
|
||||
* throw new Error("$arg1: Expected a number");
|
||||
* } else if (!(arg2 instanceof sass.types.Number)) {
|
||||
* throw new Error("$arg2: Expected a number");
|
||||
* }
|
||||
* done(new sass.types.Number(arg1.getValue() + arg2.getValue()));
|
||||
* }
|
||||
* }
|
||||
* }, (result, error) => {
|
||||
* // ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* This is passed one argument for each argument that's declared in the
|
||||
* signature that's passed to [[LegacySharedOptions.functions]]. If the
|
||||
* signature [takes arbitrary
|
||||
* arguments](https://sass-lang.com/documentation/at-rules/function#taking-arbitrary-arguments),
|
||||
* they're passed as a single argument list in the last argument before the
|
||||
* callback.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[CustomFunction]] with [[compile]], [[compileString]],
|
||||
* [[compileAsync]], and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export type LegacyAsyncFunction =
|
||||
| ((this: LegacyPluginThis, done: (result: LegacyValue) => void) => void)
|
||||
| ((
|
||||
this: LegacyPluginThis,
|
||||
arg1: LegacyValue,
|
||||
done: LegacyAsyncFunctionDone
|
||||
) => void)
|
||||
| ((
|
||||
this: LegacyPluginThis,
|
||||
arg1: LegacyValue,
|
||||
arg2: LegacyValue,
|
||||
done: LegacyAsyncFunctionDone
|
||||
) => void)
|
||||
| ((
|
||||
this: LegacyPluginThis,
|
||||
arg1: LegacyValue,
|
||||
arg2: LegacyValue,
|
||||
arg3: LegacyValue,
|
||||
done: LegacyAsyncFunctionDone
|
||||
) => void)
|
||||
| ((
|
||||
this: LegacyPluginThis,
|
||||
arg1: LegacyValue,
|
||||
arg2: LegacyValue,
|
||||
arg3: LegacyValue,
|
||||
arg4: LegacyValue,
|
||||
done: LegacyAsyncFunctionDone
|
||||
) => void)
|
||||
| ((
|
||||
this: LegacyPluginThis,
|
||||
arg1: LegacyValue,
|
||||
arg2: LegacyValue,
|
||||
arg3: LegacyValue,
|
||||
arg4: LegacyValue,
|
||||
arg5: LegacyValue,
|
||||
done: LegacyAsyncFunctionDone
|
||||
) => void)
|
||||
| ((
|
||||
this: LegacyPluginThis,
|
||||
arg1: LegacyValue,
|
||||
arg2: LegacyValue,
|
||||
arg3: LegacyValue,
|
||||
arg4: LegacyValue,
|
||||
arg5: LegacyValue,
|
||||
arg6: LegacyValue,
|
||||
done: LegacyAsyncFunctionDone
|
||||
) => void)
|
||||
| ((
|
||||
this: LegacyPluginThis,
|
||||
...args: [...LegacyValue[], LegacyAsyncFunctionDone]
|
||||
) => void);
|
||||
|
||||
/**
|
||||
* The function called by a [[LegacyAsyncFunction]] to indicate that it's
|
||||
* finished.
|
||||
*
|
||||
* @param result - If this is a [[LegacyValue]], that indicates that the
|
||||
* function call completed successfully. If it's a [[types.Error]], that
|
||||
* indicates that the function call failed.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[CustomFunction]] with [[compile]], [[compileString]],
|
||||
* [[compileAsync]], and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export type LegacyAsyncFunctionDone = (
|
||||
result: LegacyValue | types.Error
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* A callback that implements a custom Sass function. For [[renderSync]], this
|
||||
* must be a [[LegacySyncFunction]] which returns its result directly; for
|
||||
* [[render]], it may be either a [[LegacySyncFunction]] or a
|
||||
* [[LegacyAsyncFunction]] which calls a callback with its result.
|
||||
*
|
||||
* See [[LegacySharedOptions.functions]] for more details.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[CustomFunction]] with [[compile]], [[compileString]],
|
||||
* [[compileAsync]], and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export type LegacyFunction<sync extends 'sync' | 'async'> = sync extends 'async'
|
||||
? LegacySyncFunction | LegacyAsyncFunction
|
||||
: LegacySyncFunction;
|
||||
|
||||
/**
|
||||
* A type representing all the possible values that may be passed to or returned
|
||||
* from a [[LegacyFunction]].
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[Value]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export type LegacyValue =
|
||||
| types.Null
|
||||
| types.Number
|
||||
| types.String
|
||||
| types.Boolean
|
||||
| types.Color
|
||||
| types.List
|
||||
| types.Map;
|
||||
|
||||
/**
|
||||
* A shorthand for `sass.types.Boolean.TRUE`.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[sassTrue]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export const TRUE: types.Boolean<true>;
|
||||
|
||||
/**
|
||||
* A shorthand for `sass.types.Boolean.FALSE`.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[sassFalse]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export const FALSE: types.Boolean<false>;
|
||||
|
||||
/**
|
||||
* A shorthand for `sass.types.Null.NULL`.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[sassNull]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export const NULL: types.Null;
|
||||
|
||||
/**
|
||||
* The namespace for value types used in the legacy function API.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[Value]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export namespace types {
|
||||
/**
|
||||
* The class for Sass's singleton [`null`
|
||||
* value](https://sass-lang.com/documentation/values/null). The value itself
|
||||
* can be accessed through the [[NULL]] field.
|
||||
*/
|
||||
export class Null {
|
||||
/** Sass's singleton `null` value. */
|
||||
static readonly NULL: Null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sass's [number type](https://sass-lang.com/documentation/values/numbers).
|
||||
*/
|
||||
export class Number {
|
||||
/**
|
||||
* @param value - The numeric value of the number.
|
||||
*
|
||||
* @param unit - If passed, the number's unit.
|
||||
*
|
||||
* Complex units can be represented as
|
||||
* `<unit>*<unit>*.../<unit>*<unit>*...`, with numerator units on the
|
||||
* left-hand side of the `/` and denominator units on the right. A number
|
||||
* with only numerator units may omit the `/` and the units after it, and a
|
||||
* number with only denominator units may be represented
|
||||
* with no units before the `/`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```scss
|
||||
* new sass.types.Number(0.5); // == 0.5
|
||||
* new sass.types.Number(10, "px"); // == 10px
|
||||
* new sass.types.Number(10, "px*px"); // == 10px * 1px
|
||||
* new sass.types.Number(10, "px/s"); // == math.div(10px, 1s)
|
||||
* new sass.types.Number(10, "px*px/s*s"); // == 10px * math.div(math.div(1px, 1s), 1s)
|
||||
* ```
|
||||
*/
|
||||
constructor(value: number, unit?: string);
|
||||
|
||||
/**
|
||||
* Returns the value of the number, ignoring units.
|
||||
*
|
||||
* **Heads up!** This means that `96px` and `1in` will return different
|
||||
* values, even though they represent the same length.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const number = new sass.types.Number(10, "px");
|
||||
* number.getValue(); // 10
|
||||
* ```
|
||||
*/
|
||||
getValue(): number;
|
||||
|
||||
/**
|
||||
* Destructively modifies this number by setting its numeric value to
|
||||
* `value`, independent of its units.
|
||||
*
|
||||
* @deprecated Use [[constructor]] instead.
|
||||
*/
|
||||
setValue(value: number): void;
|
||||
|
||||
/**
|
||||
* Returns a string representation of this number's units. Complex units are
|
||||
* returned in the same format that [[constructor]] accepts them.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // number is `10px`.
|
||||
* number.getUnit(); // "px"
|
||||
*
|
||||
* // number is `math.div(10px, 1s)`.
|
||||
* number.getUnit(); // "px/s"
|
||||
* ```
|
||||
*/
|
||||
getUnit(): string;
|
||||
|
||||
/**
|
||||
* Destructively modifies this number by setting its units to `unit`,
|
||||
* independent of its numeric value. Complex units are specified in the same
|
||||
* format as [[constructor]].
|
||||
*
|
||||
* @deprecated Use [[constructor]] instead.
|
||||
*/
|
||||
setUnit(unit: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sass's [string type](https://sass-lang.com/documentation/values/strings).
|
||||
*
|
||||
* **Heads up!** This API currently provides no way of distinguishing between
|
||||
* a [quoted](https://sass-lang.com/documentation/values/strings#quoted) and
|
||||
* [unquoted](https://sass-lang.com/documentation/values/strings#unquoted)
|
||||
* string.
|
||||
*/
|
||||
export class String {
|
||||
/**
|
||||
* Creates an unquoted string with the given contents.
|
||||
*
|
||||
* **Heads up!** This API currently provides no way of creating a
|
||||
* [quoted](https://sass-lang.com/documentation/values/strings#quoted)
|
||||
* string.
|
||||
*/
|
||||
constructor(value: string);
|
||||
|
||||
/**
|
||||
* Returns the contents of the string. If the string contains escapes,
|
||||
* those escapes are included literally if it’s
|
||||
* [unquoted](https://sass-lang.com/documentation/values/strings#unquoted),
|
||||
* while the values of the escapes are included if it’s
|
||||
* [quoted](https://sass-lang.com/documentation/values/strings#quoted).
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```
|
||||
* // string is `Arial`.
|
||||
* string.getValue(); // "Arial"
|
||||
*
|
||||
* // string is `"Helvetica Neue"`.
|
||||
* string.getValue(); // "Helvetica Neue"
|
||||
*
|
||||
* // string is `\1F46D`.
|
||||
* string.getValue(); // "\\1F46D"
|
||||
*
|
||||
* // string is `"\1F46D"`.
|
||||
* string.getValue(); // "👭"
|
||||
* ```
|
||||
*/
|
||||
getValue(): string;
|
||||
|
||||
/**
|
||||
* Destructively modifies this string by setting its numeric value to
|
||||
* `value`.
|
||||
*
|
||||
* **Heads up!** Even if the string was originally quoted, this will cause
|
||||
* it to become unquoted.
|
||||
*
|
||||
* @deprecated Use [[constructor]] instead.
|
||||
*/
|
||||
setValue(value: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sass's [boolean type](https://sass-lang.com/documentation/values/booleans).
|
||||
*
|
||||
* Custom functions should respect Sass’s notion of
|
||||
* [truthiness](https://sass-lang.com/documentation/at-rules/control/if#truthiness-and-falsiness)
|
||||
* by treating `false` and `null` as falsey and everything else as truthy.
|
||||
*
|
||||
* **Heads up!** Boolean values can't be constructed, they can only be
|
||||
* accessed through the [[TRUE]] and [[FALSE]] constants.
|
||||
*/
|
||||
export class Boolean<T extends boolean = boolean> {
|
||||
/**
|
||||
* Returns `true` if this is Sass's `true` value and `false` if this is
|
||||
* Sass's `false` value.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // boolean is `true`.
|
||||
* boolean.getValue(); // true
|
||||
* boolean === sass.types.Boolean.TRUE; // true
|
||||
*
|
||||
* // boolean is `false`.
|
||||
* boolean.getValue(); // false
|
||||
* boolean === sass.types.Boolean.FALSE; // true
|
||||
* ```
|
||||
*/
|
||||
getValue(): T;
|
||||
|
||||
/** Sass's `true` value. */
|
||||
static readonly TRUE: Boolean<true>;
|
||||
|
||||
/** Sass's `false` value. */
|
||||
static readonly FALSE: Boolean<false>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sass's [color type](https://sass-lang.com/documentation/values/colors).
|
||||
*/
|
||||
export class Color {
|
||||
/**
|
||||
* Creates a new Sass color with the given red, green, blue, and alpha
|
||||
* channels. The red, green, and blue channels must be integers between 0
|
||||
* and 255 (inclusive), and alpha must be between 0 and 1 (inclusive).
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* new sass.types.Color(107, 113, 127); // #6b717f
|
||||
* new sass.types.Color(0, 0, 0, 0); // rgba(0, 0, 0, 0)
|
||||
* ```
|
||||
*/
|
||||
constructor(r: number, g: number, b: number, a?: number);
|
||||
|
||||
/**
|
||||
* Creates a new Sass color with alpha, red, green, and blue channels taken
|
||||
* from respective two-byte chunks of a hexidecimal number.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* new sass.types.Color(0xff6b717f); // #6b717f
|
||||
* new sass.types.Color(0x00000000); // rgba(0, 0, 0, 0)
|
||||
* ```
|
||||
*/
|
||||
constructor(argb: number);
|
||||
|
||||
/**
|
||||
* Returns the red channel of the color as an integer from 0 to 255.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // color is `#6b717f`.
|
||||
* color.getR(); // 107
|
||||
*
|
||||
* // color is `#b37399`.
|
||||
* color.getR(); // 179
|
||||
* ```
|
||||
*/
|
||||
getR(): number;
|
||||
|
||||
/**
|
||||
* Sets the red channel of the color. The value must be an integer between 0
|
||||
* and 255 (inclusive).
|
||||
*
|
||||
* @deprecated Use [[constructor]] instead.
|
||||
*/
|
||||
setR(value: number): void;
|
||||
|
||||
/**
|
||||
* Returns the green channel of the color as an integer from 0 to 255.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // color is `#6b717f`.
|
||||
* color.getG(); // 113
|
||||
*
|
||||
* // color is `#b37399`.
|
||||
* color.getG(); // 115
|
||||
* ```
|
||||
*/
|
||||
getG(): number;
|
||||
|
||||
/**
|
||||
* Sets the green channel of the color. The value must be an integer between
|
||||
* 0 and 255 (inclusive).
|
||||
*
|
||||
* @deprecated Use [[constructor]] instead.
|
||||
*/
|
||||
setG(value: number): void;
|
||||
|
||||
/**
|
||||
* Returns the blue channel of the color as an integer from 0 to 255.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // color is `#6b717f`.
|
||||
* color.getB(); // 127
|
||||
*
|
||||
* // color is `#b37399`.
|
||||
* color.getB(); // 153
|
||||
* ```
|
||||
*/
|
||||
getB(): number;
|
||||
|
||||
/**
|
||||
* Sets the blue channel of the color. The value must be an integer between
|
||||
* 0 and 255 (inclusive).
|
||||
*
|
||||
* @deprecated Use [[constructor]] instead.
|
||||
*/
|
||||
setB(value: number): void;
|
||||
|
||||
/**
|
||||
* Returns the alpha channel of the color as a number from 0 to 1.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // color is `#6b717f`.
|
||||
* color.getA(); // 1
|
||||
*
|
||||
* // color is `transparent`.
|
||||
* color.getA(); // 0
|
||||
* ```
|
||||
*/
|
||||
getA(): number;
|
||||
|
||||
/**
|
||||
* Sets the alpha channel of the color. The value must be between 0 and 1
|
||||
* (inclusive).
|
||||
*
|
||||
* @deprecated Use [[constructor]] instead.
|
||||
*/
|
||||
setA(value: number): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sass's [list type](https://sass-lang.com/documentation/values/lists).
|
||||
*
|
||||
* **Heads up!** This list type’s methods use 0-based indexing, even though
|
||||
* within Sass lists use 1-based indexing. These methods also don’t support
|
||||
* using negative numbers to index backwards from the end of the list.
|
||||
*/
|
||||
export class List {
|
||||
/**
|
||||
* Creates a new Sass list.
|
||||
*
|
||||
* **Heads up!** The initial values of the list elements are undefined.
|
||||
* These elements must be set using [[setValue]] before accessing them or
|
||||
* passing the list back to Sass.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const list = new sass.types.List(3);
|
||||
* list.setValue(0, new sass.types.Number(10, "px"));
|
||||
* list.setValue(1, new sass.types.Number(15, "px"));
|
||||
* list.setValue(2, new sass.types.Number(32, "px"));
|
||||
* list; // 10px, 15px, 32px
|
||||
* ```
|
||||
*
|
||||
* @param length - The number of (initially undefined) elements in the list.
|
||||
* @param commaSeparator - If `true`, the list is comma-separated; otherwise,
|
||||
* it's space-separated. Defaults to `true`.
|
||||
*/
|
||||
constructor(length: number, commaSeparator?: boolean);
|
||||
|
||||
/**
|
||||
* Returns the element at `index`, or `undefined` if that value hasn't yet
|
||||
* been set.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // list is `10px, 15px, 32px`
|
||||
* list.getValue(0); // 10px
|
||||
* list.getValue(2); // 32px
|
||||
* ```
|
||||
*
|
||||
* @param index - A (0-based) index into this list.
|
||||
* @throws `Error` if `index` is less than 0 or greater than or equal to the
|
||||
* number of elements in this list.
|
||||
*/
|
||||
getValue(index: number): LegacyValue | undefined;
|
||||
|
||||
/**
|
||||
* Sets the element at `index` to `value`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // list is `10px, 15px, 32px`
|
||||
* list.setValue(1, new sass.types.Number(18, "px"));
|
||||
* list; // 10px, 18px, 32px
|
||||
* ```
|
||||
*
|
||||
* @param index - A (0-based) index into this list.
|
||||
* @throws `Error` if `index` is less than 0 or greater than or equal to the
|
||||
* number of elements in this list.
|
||||
*/
|
||||
setValue(index: number, value: LegacyValue): void;
|
||||
|
||||
/**
|
||||
* Returns `true` if this list is comma-separated and `false` otherwise.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // list is `10px, 15px, 32px`
|
||||
* list.getSeparator(); // true
|
||||
*
|
||||
* // list is `1px solid`
|
||||
* list.getSeparator(); // false
|
||||
* ```
|
||||
*/
|
||||
getSeparator(): boolean;
|
||||
|
||||
/**
|
||||
* Sets whether the list is comma-separated.
|
||||
*
|
||||
* @param isComma - `true` to make the list comma-separated, `false` otherwise.
|
||||
*/
|
||||
setSeparator(isComma: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns the number of elements in the list.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // list is `10px, 15px, 32px`
|
||||
* list.getLength(); // 3
|
||||
*
|
||||
* // list is `1px solid`
|
||||
* list.getLength(); // 2
|
||||
* ```
|
||||
*/
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sass's [map type](https://sass-lang.com/documentation/values/maps).
|
||||
*
|
||||
* **Heads up!** This map type is represented as a list of key-value pairs
|
||||
* rather than a mapping from keys to values. The only way to find the value
|
||||
* associated with a given key is to iterate through the map checking for that
|
||||
* key. Maps created through this API are still forbidden from having duplicate
|
||||
* keys.
|
||||
*/
|
||||
export class Map {
|
||||
/**
|
||||
* Creates a new Sass map.
|
||||
*
|
||||
* **Heads up!** The initial keys and values of the map are undefined. They
|
||||
* must be set using [[setKey]] and [[setValue]] before accessing them or
|
||||
* passing the map back to Sass.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const map = new sass.types.Map(2);
|
||||
* map.setKey(0, new sass.types.String("width"));
|
||||
* map.setValue(0, new sass.types.Number(300, "px"));
|
||||
* map.setKey(1, new sass.types.String("height"));
|
||||
* map.setValue(1, new sass.types.Number(100, "px"));
|
||||
* map; // (width: 300px, height: 100px)
|
||||
* ```
|
||||
*
|
||||
* @param length - The number of (initially undefined) key/value pairs in the map.
|
||||
*/
|
||||
constructor(length: number);
|
||||
|
||||
/**
|
||||
* Returns the value in the key/value pair at `index`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // map is `(width: 300px, height: 100px)`
|
||||
* map.getValue(0); // 300px
|
||||
* map.getValue(1); // 100px
|
||||
* ```
|
||||
*
|
||||
* @param index - A (0-based) index of a key/value pair in this map.
|
||||
* @throws `Error` if `index` is less than 0 or greater than or equal to the
|
||||
* number of pairs in this map.
|
||||
*/
|
||||
getValue(index: number): LegacyValue;
|
||||
|
||||
/**
|
||||
* Sets the value in the key/value pair at `index` to `value`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // map is `("light": 200, "medium": 400, "bold": 600)`
|
||||
* map.setValue(1, new sass.types.Number(300));
|
||||
* map; // ("light": 200, "medium": 300, "bold": 600)
|
||||
* ```
|
||||
*
|
||||
* @param index - A (0-based) index of a key/value pair in this map.
|
||||
* @throws `Error` if `index` is less than 0 or greater than or equal to the
|
||||
* number of pairs in this map.
|
||||
*/
|
||||
setValue(index: number, value: LegacyValue): void;
|
||||
|
||||
/**
|
||||
* Returns the key in the key/value pair at `index`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // map is `(width: 300px, height: 100px)`
|
||||
* map.getKey(0); // width
|
||||
* map.getKey(1); // height
|
||||
* ```
|
||||
*
|
||||
* @param index - A (0-based) index of a key/value pair in this map.
|
||||
* @throws `Error` if `index` is less than 0 or greater than or equal to the
|
||||
* number of pairs in this map.
|
||||
*/
|
||||
getKey(index: number): LegacyValue;
|
||||
|
||||
/**
|
||||
* Sets the value in the key/value pair at `index` to `value`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // map is `("light": 200, "medium": 400, "bold": 600)`
|
||||
* map.setValue(1, new sass.types.String("lighter"));
|
||||
* map; // ("lighter": 200, "medium": 300, "bold": 600)
|
||||
* ```
|
||||
*
|
||||
* @param index - A (0-based) index of a key/value pair in this map.
|
||||
* @throws `Error` if `index` is less than 0 or greater than or equal to the
|
||||
* number of pairs in this map.
|
||||
*/
|
||||
setKey(index: number, key: LegacyValue): void;
|
||||
|
||||
/**
|
||||
* Returns the number of key/value pairs in this map.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* // map is `("light": 200, "medium": 400, "bold": 600)`
|
||||
* map.getLength(); // 3
|
||||
*
|
||||
* // map is `(width: 300px, height: 100px)`
|
||||
* map.getLength(); // 2
|
||||
* ```
|
||||
*/
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* An error that can be returned from a Sass function to signal that it
|
||||
* encountered an error. This is the only way to signal an error
|
||||
* asynchronously from a [[LegacyAsyncFunction]].
|
||||
*/
|
||||
export class Error {
|
||||
constructor(message: string);
|
||||
}
|
||||
}
|
168
node_modules/sass/types/legacy/importer.d.ts
generated
vendored
Normal file
168
node_modules/sass/types/legacy/importer.d.ts
generated
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
import {LegacyPluginThis} from './plugin_this';
|
||||
|
||||
/**
|
||||
* The value of `this` in the context of a [[LegacyImporter]] function.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This is only used by the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[Importer]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
interface LegacyImporterThis extends LegacyPluginThis {
|
||||
/**
|
||||
* Whether the importer is being invoked because of a Sass `@import` rule, as
|
||||
* opposed to a `@use` or `@forward` rule.
|
||||
*
|
||||
* This should *only* be used for determining whether or not to load
|
||||
* [import-only files](https://sass-lang.com/documentation/at-rules/import#import-only-files).
|
||||
*
|
||||
* @compatibility dart: "1.33.0", node: false
|
||||
*/
|
||||
fromImport: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The result of running a [[LegacyImporter]]. It must be one of the following
|
||||
* types:
|
||||
*
|
||||
* * An object with the key `contents` whose value is the contents of a stylesheet
|
||||
* (in SCSS syntax). This causes Sass to load that stylesheet’s contents.
|
||||
*
|
||||
* * An object with the key `file` whose value is a path on disk. This causes Sass
|
||||
* to load that file as though it had been imported directly.
|
||||
*
|
||||
* * `null`, which indicates that it doesn’t recognize the URL and another
|
||||
* importer should be tried instead.
|
||||
*
|
||||
* * An [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
|
||||
* object, indicating that importing failed.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[ImporterResult]] with [[compile]], [[compileString]],
|
||||
* [[compileAsync]], and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export type LegacyImporterResult =
|
||||
| {file: string}
|
||||
| {contents: string}
|
||||
| Error
|
||||
| null;
|
||||
|
||||
/**
|
||||
* A synchronous callback that implements custom Sass loading logic for
|
||||
* [`@import` rules](https://sass-lang.com/documentation/at-rules/import) and
|
||||
* [`@use` rules](https://sass-lang.com/documentation/at-rules/use). This can be
|
||||
* passed to [[LegacySharedOptions.importer]] for either [[render]] or
|
||||
* [[renderSync]].
|
||||
*
|
||||
* See [[LegacySharedOptions.importer]] for more detailed documentation.
|
||||
*
|
||||
* ```js
|
||||
* sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* importer: [
|
||||
* function(url, prev) {
|
||||
* if (url != "big-headers") return null;
|
||||
*
|
||||
* return {
|
||||
* contents: 'h1 { font-size: 40px; }'
|
||||
* };
|
||||
* }
|
||||
* ]
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param url - The `@use` or `@import` rule’s URL as a string, exactly as it
|
||||
* appears in the stylesheet.
|
||||
*
|
||||
* @param prev - A string identifying the stylesheet that contained the `@use`
|
||||
* or `@import`. This string’s format depends on how that stylesheet was loaded:
|
||||
*
|
||||
* * If the stylesheet was loaded from the filesystem, it’s the absolute path of
|
||||
* its file.
|
||||
* * If the stylesheet was loaded from an importer that returned its contents,
|
||||
* it’s the URL of the `@use` or `@import` rule that loaded it.
|
||||
* * If the stylesheet came from the data option, it’s the string "stdin".
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[Importer]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
type LegacySyncImporter = (
|
||||
this: LegacyImporterThis,
|
||||
url: string,
|
||||
prev: string
|
||||
) => LegacyImporterResult;
|
||||
|
||||
/**
|
||||
* An asynchronous callback that implements custom Sass loading logic for
|
||||
* [`@import` rules](https://sass-lang.com/documentation/at-rules/import) and
|
||||
* [`@use` rules](https://sass-lang.com/documentation/at-rules/use). This can be
|
||||
* passed to [[LegacySharedOptions.importer]] for either [[render]] or
|
||||
* [[renderSync]].
|
||||
*
|
||||
* An asynchronous importer must return `undefined`, and then call `done` with
|
||||
* the result of its [[LegacyImporterResult]] once it's done running.
|
||||
*
|
||||
* See [[LegacySharedOptions.importer]] for more detailed documentation.
|
||||
*
|
||||
* ```js
|
||||
* sass.render({
|
||||
* file: "style.scss",
|
||||
* importer: [
|
||||
* function(url, prev, done) {
|
||||
* if (url != "big-headers") done(null);
|
||||
*
|
||||
* done({
|
||||
* contents: 'h1 { font-size: 40px; }'
|
||||
* });
|
||||
* }
|
||||
* ]
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param url - The `@use` or `@import` rule’s URL as a string, exactly as it
|
||||
* appears in the stylesheet.
|
||||
*
|
||||
* @param prev - A string identifying the stylesheet that contained the `@use`
|
||||
* or `@import`. This string’s format depends on how that stylesheet was loaded:
|
||||
*
|
||||
* * If the stylesheet was loaded from the filesystem, it’s the absolute path of
|
||||
* its file.
|
||||
* * If the stylesheet was loaded from an importer that returned its contents,
|
||||
* it’s the URL of the `@use` or `@import` rule that loaded it.
|
||||
* * If the stylesheet came from the data option, it’s the string "stdin".
|
||||
*
|
||||
* @param done - The callback to call once the importer has finished running.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[Importer]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
type LegacyAsyncImporter = (
|
||||
this: LegacyImporterThis,
|
||||
url: string,
|
||||
prev: string,
|
||||
done: (result: LegacyImporterResult) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* A callback that implements custom Sass loading logic for [`@import`
|
||||
* rules](https://sass-lang.com/documentation/at-rules/import) and [`@use`
|
||||
* rules](https://sass-lang.com/documentation/at-rules/use). For [[renderSync]],
|
||||
* this must be a [[LegacySyncImporter]] which returns its result directly; for
|
||||
* [[render]], it may be either a [[LegacySyncImporter]] or a
|
||||
* [[LegacyAsyncImporter]] which calls a callback with its result.
|
||||
*
|
||||
* See [[LegacySharedOptions.importer]] for more details.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[Importer]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export type LegacyImporter<sync = 'sync' | 'async'> = sync extends 'async'
|
||||
? LegacySyncImporter | LegacyAsyncImporter
|
||||
: LegacySyncImporter;
|
642
node_modules/sass/types/legacy/options.d.ts
generated
vendored
Normal file
642
node_modules/sass/types/legacy/options.d.ts
generated
vendored
Normal file
@ -0,0 +1,642 @@
|
||||
import {Logger} from '../logger';
|
||||
import {LegacyImporter} from './importer';
|
||||
import {LegacyFunction} from './function';
|
||||
|
||||
/**
|
||||
* Options for [[render]] and [[renderSync]] that are shared between
|
||||
* [[LegacyFileOptions]] and [[LegacyStringOptions]].
|
||||
*
|
||||
* @typeParam sync - This lets the TypeScript checker verify that
|
||||
* [[LegacyAsyncImporter]]s and [[LegacyAsyncFunction]]s aren't passed to
|
||||
* [[renderSync]].
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[Options]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export interface LegacySharedOptions<sync extends 'sync' | 'async'> {
|
||||
/**
|
||||
* This array of strings option provides [load
|
||||
* paths](https://sass-lang.com/documentation/at-rules/import#load-paths) for
|
||||
* Sass to look for stylesheets. Earlier load paths will take precedence over
|
||||
* later ones.
|
||||
*
|
||||
* ```js
|
||||
* sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* includePaths: ["node_modules/bootstrap/dist/css"]
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Load paths are also loaded from the `SASS_PATH` environment variable, if
|
||||
* it’s set. This variable should be a list of paths separated by `;` (on
|
||||
* Windows) or `:` (on other operating systems). Load paths from the
|
||||
* `includePaths` option take precedence over load paths from `SASS_PATH`.
|
||||
*
|
||||
* ```sh
|
||||
* $ SASS_PATH=node_modules/bootstrap/dist/css sass style.scss style.css
|
||||
* ```
|
||||
*
|
||||
* @category Input
|
||||
* @compatibility feature: "SASS_PATH", dart: "1.15.0", node: "3.9.0"
|
||||
*
|
||||
* Earlier versions of Dart Sass and Node Sass didn’t support the `SASS_PATH`
|
||||
* environment variable.
|
||||
*/
|
||||
includePaths?: string[];
|
||||
|
||||
/**
|
||||
* Whether the generated CSS should use spaces or tabs for indentation.
|
||||
*
|
||||
* ```js
|
||||
* const result = sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* indentType: "tab",
|
||||
* indentWidth: 1
|
||||
* });
|
||||
*
|
||||
* result.css.toString();
|
||||
* // "h1 {\n\tfont-size: 40px;\n}\n"
|
||||
* ```
|
||||
*
|
||||
* @defaultValue `'space'`
|
||||
* @category Output
|
||||
* @compatibility dart: true, node: "3.0.0"
|
||||
*/
|
||||
indentType?: 'space' | 'tab';
|
||||
|
||||
/**
|
||||
* How many spaces or tabs (depending on [[indentType]]) should be used per
|
||||
* indentation level in the generated CSS. It must be between 0 and 10
|
||||
* (inclusive).
|
||||
*
|
||||
* @defaultValue `2`
|
||||
* @category Output
|
||||
* @compatibility dart: true, node: "3.0.0"
|
||||
*/
|
||||
indentWidth?: number;
|
||||
|
||||
/**
|
||||
* Which character sequence to use at the end of each line in the generated
|
||||
* CSS. It can have the following values:
|
||||
*
|
||||
* * `'lf'` uses U+000A LINE FEED.
|
||||
* * `'lfcr'` uses U+000A LINE FEED followed by U+000D CARRIAGE RETURN.
|
||||
* * `'cr'` uses U+000D CARRIAGE RETURN.
|
||||
* * `'crlf'` uses U+000D CARRIAGE RETURN followed by U+000A LINE FEED.
|
||||
*
|
||||
* @defaultValue `'lf'`
|
||||
* @category Output
|
||||
* @compatibility dart: true, node: "3.0.0"
|
||||
*/
|
||||
linefeed?: 'cr' | 'crlf' | 'lf' | 'lfcr';
|
||||
|
||||
/**
|
||||
* If `true`, Sass won't add a link from the generated CSS to the source map.
|
||||
*
|
||||
* ```js
|
||||
* const result = sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* sourceMap: "out.map",
|
||||
* omitSourceMapUrl: true
|
||||
* })
|
||||
* console.log(result.css.toString());
|
||||
* // h1 {
|
||||
* // font-size: 40px;
|
||||
* // }
|
||||
* ```
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Source Maps
|
||||
*/
|
||||
omitSourceMapUrl?: boolean;
|
||||
|
||||
/**
|
||||
* The location that Sass expects the generated CSS to be saved to. It’s used
|
||||
* to determine the URL used to link from the generated CSS to the source map,
|
||||
* and from the source map to the Sass source files.
|
||||
*
|
||||
* **Heads up!** Despite the name, Sass does *not* write the CSS output to
|
||||
* this file. The caller must do that themselves.
|
||||
*
|
||||
* ```js
|
||||
* result = sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* sourceMap: true,
|
||||
* outFile: "out.css"
|
||||
* })
|
||||
* console.log(result.css.toString());
|
||||
* // h1 {
|
||||
* // font-size: 40px;
|
||||
* // }
|
||||
* // /*# sourceMappingURL=out.css.map * /
|
||||
* ```
|
||||
*
|
||||
* @category Source Maps
|
||||
*/
|
||||
outFile?: string;
|
||||
|
||||
/**
|
||||
* The output style of the compiled CSS. There are four possible output styles:
|
||||
*
|
||||
* * `"expanded"` (the default for Dart Sass) writes each selector and
|
||||
* declaration on its own line.
|
||||
*
|
||||
* * `"compressed"` removes as many extra characters as possible, and writes
|
||||
* the entire stylesheet on a single line.
|
||||
*
|
||||
* * `"nested"` (the default for Node Sass, not supported by Dart Sass)
|
||||
* indents CSS rules to match the nesting of the Sass source.
|
||||
*
|
||||
* * `"compact"` (not supported by Dart Sass) puts each CSS rule on its own single line.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const source = `
|
||||
* h1 {
|
||||
* font-size: 40px;
|
||||
* code {
|
||||
* font-face: Roboto Mono;
|
||||
* }
|
||||
* }`;
|
||||
*
|
||||
* let result = sass.renderSync({
|
||||
* data: source,
|
||||
* outputStyle: "expanded"
|
||||
* });
|
||||
* console.log(result.css.toString());
|
||||
* // h1 {
|
||||
* // font-size: 40px;
|
||||
* // }
|
||||
* // h1 code {
|
||||
* // font-face: Roboto Mono;
|
||||
* // }
|
||||
*
|
||||
* result = sass.renderSync({
|
||||
* data: source,
|
||||
* outputStyle: "compressed"
|
||||
* });
|
||||
* console.log(result.css.toString());
|
||||
* // h1{font-size:40px}h1 code{font-face:Roboto Mono}
|
||||
*
|
||||
* result = sass.renderSync({
|
||||
* data: source,
|
||||
* outputStyle: "nested"
|
||||
* });
|
||||
* console.log(result.css.toString());
|
||||
* // h1 {
|
||||
* // font-size: 40px; }
|
||||
* // h1 code {
|
||||
* // font-face: Roboto Mono; }
|
||||
*
|
||||
* result = sass.renderSync({
|
||||
* data: source,
|
||||
* outputStyle: "compact"
|
||||
* });
|
||||
* console.log(result.css.toString());
|
||||
* // h1 { font-size: 40px; }
|
||||
* // h1 code { font-face: Roboto Mono; }
|
||||
* ```
|
||||
*
|
||||
* @category Output
|
||||
*/
|
||||
outputStyle?: 'compressed' | 'expanded' | 'nested' | 'compact';
|
||||
|
||||
/**
|
||||
* Whether or not Sass should generate a source map. If it does, the source
|
||||
* map will be available as [[LegacyResult.map]] (unless [[sourceMapEmbed]] is
|
||||
* `true`).
|
||||
*
|
||||
* If this option is a string, it’s the path that the source map is expected
|
||||
* to be written to, which is used to link to the source map from the
|
||||
* generated CSS and to link *from* the source map to the Sass source files.
|
||||
* Note that if `sourceMap` is a string and [[outFile]] isn’t passed, Sass
|
||||
* assumes that the CSS will be written to the same directory as the file
|
||||
* option if it’s passed.
|
||||
*
|
||||
* If this option is `true`, the path is assumed to be [[outFile]] with `.map`
|
||||
* added to the end. If it’s `true` and [[outFile]] isn’t passed, it has no
|
||||
* effect.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* let result = sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* sourceMap: "out.map"
|
||||
* })
|
||||
* console.log(result.css.toString());
|
||||
* // h1 {
|
||||
* // font-size: 40px;
|
||||
* // }
|
||||
* // /*# sourceMappingURL=out.map * /
|
||||
*
|
||||
* result = sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* sourceMap: true,
|
||||
* outFile: "out.css"
|
||||
* })
|
||||
* console.log(result.css.toString());
|
||||
* // h1 {
|
||||
* // font-size: 40px;
|
||||
* // }
|
||||
* // /*# sourceMappingURL=out.css.map * /
|
||||
* ```
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Source Maps
|
||||
*/
|
||||
sourceMap?: boolean | string;
|
||||
|
||||
/**
|
||||
* Whether to embed the entire contents of the Sass files that contributed to
|
||||
* the generated CSS in the source map. This may produce very large source
|
||||
* maps, but it guarantees that the source will be available on any computer
|
||||
* no matter how the CSS is served.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* sourceMap: "out.map",
|
||||
* sourceMapContents: true
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Source Maps
|
||||
*/
|
||||
sourceMapContents?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to embed the contents of the source map file in the generated CSS,
|
||||
* rather than creating a separate file and linking to it from the CSS.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* sourceMap: "out.map",
|
||||
* sourceMapEmbed: true
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Source Maps
|
||||
*/
|
||||
sourceMapEmbed?: boolean;
|
||||
|
||||
/**
|
||||
* If this is passed, it's prepended to all the links from the source map to
|
||||
* the Sass source files.
|
||||
*
|
||||
* @category Source Maps
|
||||
*/
|
||||
sourceMapRoot?: string;
|
||||
|
||||
/**
|
||||
* Additional handler(s) for loading files when a [`@use`
|
||||
* rule](https://sass-lang.com/documentation/at-rules/use) or an [`@import`
|
||||
* rule](https://sass-lang.com/documentation/at-rules/import) is encountered.
|
||||
* It can either be a single [[LegacyImporter]] function, or an array of
|
||||
* [[LegacyImporter]]s.
|
||||
*
|
||||
* Importers take the URL of the `@import` or `@use` rule and return a
|
||||
* [[LegacyImporterResult]] indicating how to handle that rule. For more
|
||||
* details, see [[LegacySyncImporter]] and [[LegacyAsyncImporter]].
|
||||
*
|
||||
* Loads are resolved by trying, in order:
|
||||
*
|
||||
* * Loading a file from disk relative to the file in which the `@use` or
|
||||
* `@import` appeared.
|
||||
*
|
||||
* * Each custom importer.
|
||||
*
|
||||
* * Loading a file relative to the current working directory.
|
||||
*
|
||||
* * Each load path in [[includePaths]].
|
||||
*
|
||||
* * Each load path specified in the `SASS_PATH` environment variable, which
|
||||
* should be semicolon-separated on Windows and colon-separated elsewhere.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* sass.render({
|
||||
* file: "style.scss",
|
||||
* importer: [
|
||||
* // This importer uses the synchronous API, and can be passed to either
|
||||
* // renderSync() or render().
|
||||
* function(url, prev) {
|
||||
* // This generates a stylesheet from scratch for `@use "big-headers"`.
|
||||
* if (url != "big-headers") return null;
|
||||
*
|
||||
* return {
|
||||
* contents: `
|
||||
* h1 {
|
||||
* font-size: 40px;
|
||||
* }`
|
||||
* };
|
||||
* },
|
||||
*
|
||||
* // This importer uses the asynchronous API, and can only be passed to
|
||||
* // render().
|
||||
* function(url, prev, done) {
|
||||
* // Convert `@use "foo/bar"` to "node_modules/foo/sass/bar".
|
||||
* const components = url.split('/');
|
||||
* const innerPath = components.slice(1).join('/');
|
||||
* done({
|
||||
* file: `node_modules/${components.first}/sass/${innerPath}`
|
||||
* });
|
||||
* }
|
||||
* ]
|
||||
* }, function(err, result) {
|
||||
* // ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @category Plugins
|
||||
* @compatibility dart: true, node: "3.0.0"
|
||||
*
|
||||
* Versions of Node Sass before 3.0.0 don’t support arrays of importers, nor
|
||||
* do they support importers that return `Error` objects.
|
||||
*
|
||||
* Versions of Node Sass before 2.0.0 don’t support the `importer` option at
|
||||
* all.
|
||||
*
|
||||
* @compatibility feature: "Import order", dart: "1.20.2", node: false
|
||||
*
|
||||
* Versions of Dart Sass before 1.20.2 preferred resolving imports using
|
||||
* [[includePaths]] before resolving them using custom importers.
|
||||
*
|
||||
* All versions of Node Sass currently pass imports to importers before
|
||||
* loading them relative to the file in which the `@import` appears. This
|
||||
* behavior is considered incorrect and should not be relied on because it
|
||||
* violates the principle of *locality*, which says that it should be possible
|
||||
* to reason about a stylesheet without knowing everything about how the
|
||||
* entire system is set up. If a user tries to import a stylesheet relative to
|
||||
* another stylesheet, that import should *always* work. It shouldn’t be
|
||||
* possible for some configuration somewhere else to break it.
|
||||
*/
|
||||
importer?: LegacyImporter<sync> | LegacyImporter<sync>[];
|
||||
|
||||
/**
|
||||
* Additional built-in Sass functions that are available in all stylesheets.
|
||||
* This option takes an object whose keys are Sass function signatures and
|
||||
* whose values are [[LegacyFunction]]s. Each function should take the same
|
||||
* arguments as its signature.
|
||||
*
|
||||
* Functions are passed JavaScript representations of [Sass value
|
||||
* types](https://sass-lang.com/documentation/js-api#value-types), and must
|
||||
* return the same.
|
||||
*
|
||||
* **Heads up!** When writing custom functions, it’s important to ensure that
|
||||
* all the arguments are the types you expect. Otherwise, users’ stylesheets
|
||||
* could crash in hard-to-debug ways or, worse, compile to meaningless CSS.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* sass.render({
|
||||
* data: `
|
||||
* h1 {
|
||||
* font-size: pow(2, 5) * 1px;
|
||||
* }`,
|
||||
* functions: {
|
||||
* // This function uses the synchronous API, and can be passed to either
|
||||
* // renderSync() or render().
|
||||
* 'pow($base, $exponent)': function(base, exponent) {
|
||||
* if (!(base instanceof sass.types.Number)) {
|
||||
* throw "$base: Expected a number.";
|
||||
* } else if (base.getUnit()) {
|
||||
* throw "$base: Expected a unitless number.";
|
||||
* }
|
||||
*
|
||||
* if (!(exponent instanceof sass.types.Number)) {
|
||||
* throw "$exponent: Expected a number.";
|
||||
* } else if (exponent.getUnit()) {
|
||||
* throw "$exponent: Expected a unitless number.";
|
||||
* }
|
||||
*
|
||||
* return new sass.types.Number(
|
||||
* Math.pow(base.getValue(), exponent.getValue()));
|
||||
* },
|
||||
*
|
||||
* // This function uses the asynchronous API, and can only be passed to
|
||||
* // render().
|
||||
* 'sqrt($number)': function(number, done) {
|
||||
* if (!(number instanceof sass.types.Number)) {
|
||||
* throw "$number: Expected a number.";
|
||||
* } else if (number.getUnit()) {
|
||||
* throw "$number: Expected a unitless number.";
|
||||
* }
|
||||
*
|
||||
* done(new sass.types.Number(Math.sqrt(number.getValue())));
|
||||
* }
|
||||
* }
|
||||
* }, function(err, result) {
|
||||
* console.log(result.css.toString());
|
||||
* // h1 {
|
||||
* // font-size: 32px;
|
||||
* // }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @category Plugins
|
||||
*/
|
||||
functions?: {[key: string]: LegacyFunction<sync>};
|
||||
|
||||
/**
|
||||
* By default, if the CSS document contains non-ASCII characters, Sass adds a
|
||||
* `@charset` declaration (in expanded output mode) or a byte-order mark (in
|
||||
* compressed mode) to indicate its encoding to browsers or other consumers.
|
||||
* If `charset` is `false`, these annotations are omitted.
|
||||
*
|
||||
* @category Output
|
||||
* @compatibility dart: "1.39.0", node: false
|
||||
*/
|
||||
charset?: boolean;
|
||||
|
||||
/**
|
||||
* If this option is set to `true`, Sass won’t print warnings that are caused
|
||||
* by dependencies. A “dependency” is defined as any file that’s loaded
|
||||
* through [[loadPaths]] or [[importer]]. Stylesheets that are imported
|
||||
* relative to the entrypoint are not considered dependencies.
|
||||
*
|
||||
* This is useful for silencing deprecation warnings that you can’t fix on
|
||||
* your own. However, please <em>also</em> notify your dependencies of the deprecations
|
||||
* so that they can get fixed as soon as possible!
|
||||
*
|
||||
* **Heads up!** If [[render]] or [[renderSync]] is called without
|
||||
* [[LegacyFileOptions.file]] or [[LegacyStringOptions.file]], <em>all</em>
|
||||
* stylesheets it loads will be considered dependencies. Since it doesn’t have
|
||||
* a path of its own, everything it loads is coming from a load path rather
|
||||
* than a relative import.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Messages
|
||||
* @compatibility dart: "1.35.0", node: false
|
||||
*/
|
||||
quietDeps?: boolean;
|
||||
|
||||
/**
|
||||
* By default, Dart Sass will print only five instances of the same
|
||||
* deprecation warning per compilation to avoid deluging users in console
|
||||
* noise. If you set `verbose` to `true`, it will instead print every
|
||||
* deprecation warning it encounters.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Messages
|
||||
* @compatibility dart: "1.35.0", node: false
|
||||
*/
|
||||
verbose?: boolean;
|
||||
|
||||
/**
|
||||
* An object to use to handle warnings and/or debug messages from Sass.
|
||||
*
|
||||
* By default, Sass emits warnings and debug messages to standard error, but
|
||||
* if [[Logger.warn]] or [[Logger.debug]] is set, this will invoke them
|
||||
* instead.
|
||||
*
|
||||
* The special value [[Logger.silent]] can be used to easily silence all
|
||||
* messages.
|
||||
*
|
||||
* @category Messages
|
||||
* @compatibility dart: "1.43.0", node: false
|
||||
*/
|
||||
logger?: Logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* If [[file]] is passed without [[data]], Sass will load the stylesheet at
|
||||
* [[file]] and compile it to CSS.
|
||||
*
|
||||
* @typeParam sync - This lets the TypeScript checker verify that
|
||||
* [[LegacyAsyncImporter]]s and [[LegacyAsyncFunction]]s aren't passed to
|
||||
* [[renderSync]].
|
||||
*/
|
||||
export interface LegacyFileOptions<sync extends 'sync' | 'async'>
|
||||
extends LegacySharedOptions<sync> {
|
||||
/**
|
||||
* The path to the file for Sass to load and compile. If the file’s extension
|
||||
* is `.scss`, it will be parsed as SCSS; if it’s `.sass`, it will be parsed
|
||||
* as the indented syntax; and if it’s `.css`, it will be parsed as plain CSS.
|
||||
* If it has no extension, it will be parsed as SCSS.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* sass.renderSync({file: "style.scss"});
|
||||
* ```
|
||||
*
|
||||
* @category Input
|
||||
* @compatibility feature: "Plain CSS files", dart: "1.11.0", node: "partial"
|
||||
*
|
||||
* Node Sass and older versions of Dart Sass support loading files with the
|
||||
* extension `.css`, but contrary to the specification they’re treated as SCSS
|
||||
* files rather than being parsed as CSS. This behavior has been deprecated
|
||||
* and should not be relied on. Any files that use Sass features should use
|
||||
* the `.scss` extension.
|
||||
*
|
||||
* All versions of Node Sass and Dart Sass otherwise support the file option
|
||||
* as described below.
|
||||
*/
|
||||
file: string;
|
||||
|
||||
/**
|
||||
* See [[LegacyStringOptions.file]] for documentation of passing [[file]] along
|
||||
* with [[data]].
|
||||
*
|
||||
* @category Input
|
||||
*/
|
||||
data?: never;
|
||||
}
|
||||
|
||||
/**
|
||||
* If [[data]] is passed, Sass will use it as the contents of the stylesheet to
|
||||
* compile.
|
||||
*
|
||||
* @typeParam sync - This lets the TypeScript checker verify that
|
||||
* [[LegacyAsyncImporter]]s and [[LegacyAsyncFunction]]s aren't passed to
|
||||
* [[renderSync]].
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[StringOptions]] with [[compile]], [[compileString]],
|
||||
* [[compileAsync]], and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export interface LegacyStringOptions<sync extends 'sync' | 'async'>
|
||||
extends LegacySharedOptions<sync> {
|
||||
/**
|
||||
* The contents of the stylesheet to compile. Unless [[file]] is passed as
|
||||
* well, the stylesheet’s URL is set to `"stdin"`.
|
||||
*
|
||||
* By default, this stylesheet is parsed as SCSS. This can be controlled using
|
||||
* [[indentedSyntax]].
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* sass.renderSync({
|
||||
* data: `
|
||||
* h1 {
|
||||
* font-size: 40px;
|
||||
* }`
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @category Input
|
||||
*/
|
||||
data: string;
|
||||
|
||||
/**
|
||||
* If `file` and [[data]] are both passed, `file` is used as the path of the
|
||||
* stylesheet for error reporting, but [[data]] is used as the contents of the
|
||||
* stylesheet. In this case, `file`’s extension is not used to determine the
|
||||
* syntax of the stylesheet.
|
||||
*
|
||||
* @category Input
|
||||
*/
|
||||
file?: string;
|
||||
|
||||
/**
|
||||
* This flag controls whether [[data]] is parsed as the indented syntax or
|
||||
* not.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* sass.renderSync({
|
||||
* data: `
|
||||
* h1
|
||||
* font-size: 40px`,
|
||||
* indentedSyntax: true
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Input
|
||||
*/
|
||||
indentedSyntax?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for [[render]] and [[renderSync]]. This can either be
|
||||
* [[LegacyFileOptions]] to load a file from disk, or [[LegacyStringOptions]] to
|
||||
* compile a string of Sass code.
|
||||
*
|
||||
* See [[LegacySharedOptions]] for options that are shared across both file and
|
||||
* string inputs.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This only works with the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[Options]] with [[compile]], [[compileString]], [[compileAsync]],
|
||||
* and [[compileStringAsync]] instead.
|
||||
*/
|
||||
export type LegacyOptions<sync extends 'sync' | 'async'> =
|
||||
| LegacyFileOptions<sync>
|
||||
| LegacyStringOptions<sync>;
|
73
node_modules/sass/types/legacy/plugin_this.d.ts
generated
vendored
Normal file
73
node_modules/sass/types/legacy/plugin_this.d.ts
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* The value of `this` in the context of a [[LegacyImporter]] or
|
||||
* [[LegacyFunction]] callback.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This is only used by the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[compile]], [[compileString]], [[compileAsync]], and
|
||||
* [[compileStringAsync]] instead.
|
||||
*/
|
||||
export interface LegacyPluginThis {
|
||||
/**
|
||||
* A partial representation of the options passed to [[render]] or
|
||||
* [[renderSync]].
|
||||
*/
|
||||
options: {
|
||||
/** The same [[LegacyPluginThis]] instance that contains this object. */
|
||||
context: LegacyPluginThis;
|
||||
|
||||
/**
|
||||
* The value passed to [[LegacyFileOptions.file]] or
|
||||
* [[LegacyStringOptions.file]].
|
||||
*/
|
||||
file?: string;
|
||||
|
||||
/** The value passed to [[LegacyStringOptions.data]]. */
|
||||
data?: string;
|
||||
|
||||
/**
|
||||
* The value passed to [[LegacySharedOptions.includePaths]] separated by
|
||||
* `";"` on Windows or `":"` on other operating systems. This always
|
||||
* includes the current working directory as the first entry.
|
||||
*/
|
||||
includePaths: string;
|
||||
|
||||
/** Always the number 10. */
|
||||
precision: 10;
|
||||
|
||||
/** Always the number 1. */
|
||||
style: 1;
|
||||
|
||||
/** 1 if [[LegacySharedOptions.indentType]] was `"tab"`, 0 otherwise. */
|
||||
indentType: 1 | 0;
|
||||
|
||||
/**
|
||||
* The value passed to [[LegacySharedOptions.indentWidth]], or `2` otherwise.
|
||||
*/
|
||||
indentWidth: number;
|
||||
|
||||
/**
|
||||
* The value passed to [[LegacySharedOptions.linefeed]], or `"\n"`
|
||||
* otherwise.
|
||||
*/
|
||||
linefeed: '\r' | '\r\n' | '\n' | '\n\r';
|
||||
|
||||
/** A partially-constructed [[LegacyResult]] object. */
|
||||
result: {
|
||||
/** Partial information about the compilation in progress. */
|
||||
stats: {
|
||||
/**
|
||||
* The number of milliseconds between 1 January 1970 at 00:00:00 UTC and
|
||||
* the time at which Sass compilation began.
|
||||
*/
|
||||
start: number;
|
||||
|
||||
/**
|
||||
* [[LegacyFileOptions.file]] if it was passed, otherwise the string
|
||||
* `"data"`.
|
||||
*/
|
||||
entry: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
139
node_modules/sass/types/legacy/render.d.ts
generated
vendored
Normal file
139
node_modules/sass/types/legacy/render.d.ts
generated
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
import {LegacyException} from './exception';
|
||||
import {LegacyOptions} from './options';
|
||||
|
||||
/**
|
||||
* The object returned by [[render]] and [[renderSync]] after a successful
|
||||
* compilation.
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated This is only used by the legacy [[render]] and [[renderSync]]
|
||||
* APIs. Use [[compile]], [[compileString]], [[compileAsync]], and
|
||||
* [[compileStringAsync]] instead.
|
||||
*/
|
||||
export interface LegacyResult {
|
||||
/**
|
||||
* The compiled CSS. This can be converted to a string by calling
|
||||
* [Buffer.toString](https://nodejs.org/api/buffer.html#buffer_buf_tostring_encoding_start_end).
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const result = sass.renderSync({file: "style.scss"});
|
||||
*
|
||||
* console.log(result.css.toString());
|
||||
* ```
|
||||
*/
|
||||
css: Buffer;
|
||||
|
||||
/**
|
||||
* The source map that maps the compiled CSS to the source files from which it
|
||||
* was generated. This can be converted to a string by calling
|
||||
* [Buffer.toString](https://nodejs.org/api/buffer.html#buffer_buf_tostring_encoding_start_end).
|
||||
*
|
||||
* This is `undefined` unless either
|
||||
*
|
||||
* * [[LegacySharedOptions.sourceMap]] is a string; or
|
||||
* * [[LegacySharedOptions.sourceMap]] is `true` and
|
||||
* [[LegacySharedOptions.outFile]] is set.
|
||||
*
|
||||
* The source map uses absolute [`file:`
|
||||
* URLs](https://en.wikipedia.org/wiki/File_URI_scheme) to link to the Sass
|
||||
* source files, except if the source file comes from
|
||||
* [[LegacyStringOptions.data]] in which case it lists its URL as `"stdin"`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const result = sass.renderSync({
|
||||
* file: "style.scss",
|
||||
* sourceMap: true,
|
||||
* outFile: "style.css"
|
||||
* })
|
||||
*
|
||||
* console.log(result.map.toString());
|
||||
* ```
|
||||
*/
|
||||
map?: Buffer;
|
||||
|
||||
/** Additional information about the compilation. */
|
||||
stats: {
|
||||
/**
|
||||
* The absolute path of [[LegacyFileOptions.file]] or
|
||||
* [[LegacyStringOptions.file]], or `"data"` if [[LegacyStringOptions.file]]
|
||||
* wasn't set.
|
||||
*/
|
||||
entry: string;
|
||||
|
||||
/**
|
||||
* The number of milliseconds between 1 January 1970 at 00:00:00 UTC and the
|
||||
* time at which Sass compilation began.
|
||||
*/
|
||||
start: number;
|
||||
|
||||
/**
|
||||
* The number of milliseconds between 1 January 1970 at 00:00:00 UTC and the
|
||||
* time at which Sass compilation ended.
|
||||
*/
|
||||
end: number;
|
||||
|
||||
/**
|
||||
* The number of milliseconds it took to compile the Sass file. This is
|
||||
* always equal to `start` minus `end`.
|
||||
*/
|
||||
duration: number;
|
||||
|
||||
/**
|
||||
* An array of the absolute paths of all Sass files loaded during
|
||||
* compilation. If a stylesheet was loaded from a [[LegacyImporter]] that
|
||||
* returned the stylesheet’s contents, the raw string of the `@use` or
|
||||
* `@import` that loaded that stylesheet included in this array.
|
||||
*/
|
||||
includedFiles: string[];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This function synchronously compiles a Sass file to CSS. If it succeeds, it
|
||||
* returns the result, and if it fails it throws an error.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const sass = require('sass'); // or require('node-sass');
|
||||
*
|
||||
* const result = sass.renderSync({file: "style.scss"});
|
||||
* // ...
|
||||
* ```
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated Use [[compile]] or [[compileString]] instead.
|
||||
*/
|
||||
export function renderSync(options: LegacyOptions<'sync'>): LegacyResult;
|
||||
|
||||
/**
|
||||
|
||||
* This function asynchronously compiles a Sass file to CSS, and calls
|
||||
* `callback` with a [[LegacyResult]] if compilation succeeds or
|
||||
* [[LegacyException]] if it fails.
|
||||
*
|
||||
* **Heads up!** When using Dart Sass, **[[renderSync]] is almost twice as fast
|
||||
* as [[render]]** by default, due to the overhead of making the entire
|
||||
* evaluation process asynchronous.
|
||||
*
|
||||
* ```js
|
||||
* const sass = require('sass'); // or require('node-sass');
|
||||
*
|
||||
* sass.render({
|
||||
* file: "style.scss"
|
||||
* }, function(err, result) {
|
||||
* // ...
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @category Legacy
|
||||
* @deprecated Use [[compileAsync]] or [[compileStringAsync]] instead.
|
||||
*/
|
||||
export function render(
|
||||
options: LegacyOptions<'async'>,
|
||||
callback: (exception?: LegacyException, result?: LegacyResult) => void
|
||||
): void;
|
94
node_modules/sass/types/logger/index.d.ts
generated
vendored
Normal file
94
node_modules/sass/types/logger/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
import {SourceSpan} from './source_span';
|
||||
|
||||
export {SourceLocation} from './source_location';
|
||||
export {SourceSpan} from './source_span';
|
||||
|
||||
/**
|
||||
* An object that can be passed to [[LegacySharedOptions.logger]] to control how
|
||||
* Sass emits warnings and debug messages.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const fs = require('fs');
|
||||
* const sass = require('sass');
|
||||
*
|
||||
* let log = "";
|
||||
* sass.renderSync({
|
||||
* file: 'input.scss',
|
||||
* logger: {
|
||||
* warn(message, options) {
|
||||
* if (options.span) {
|
||||
* log += `${span.url}:${span.start.line}:${span.start.column}: ` +
|
||||
* `${message}\n`;
|
||||
* } else {
|
||||
* log += `::: ${message}\n`;
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* fs.writeFileSync('log.txt', log);
|
||||
* ```
|
||||
*
|
||||
* @category Logger
|
||||
*/
|
||||
export interface Logger {
|
||||
/**
|
||||
* This method is called when Sass emits a warning, whether due to a [`@warn`
|
||||
* rule](https://sass-lang.com/documentation/at-rules/warn) or a warning
|
||||
* generated by the Sass compiler.
|
||||
*
|
||||
* If this is `undefined`, Sass will print warnings to standard error.
|
||||
*
|
||||
* @param message - The warning message.
|
||||
* @param options.deprecation - Whether this is a deprecation warning.
|
||||
* @param options.span - The location in the Sass source code that generated this
|
||||
* warning.
|
||||
* @param options.stack - The Sass stack trace at the point the warning was issued.
|
||||
*/
|
||||
warn?(
|
||||
message: string,
|
||||
options: {
|
||||
deprecation: boolean;
|
||||
span?: SourceSpan;
|
||||
stack?: string;
|
||||
}
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This method is called when Sass emits a debug message due to a [`@debug`
|
||||
* rule](https://sass-lang.com/documentation/at-rules/debug).
|
||||
*
|
||||
* If this is `undefined`, Sass will print debug messages to standard error.
|
||||
*
|
||||
* @param message - The debug message.
|
||||
* @param options.span - The location in the Sass source code that generated this
|
||||
* debug message.
|
||||
*/
|
||||
debug?(message: string, options: {span: SourceSpan}): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A namespace for built-in [[Logger]]s.
|
||||
*
|
||||
* @category Logger
|
||||
* @compatibility dart: "1.43.0", node: false
|
||||
*/
|
||||
export namespace Logger {
|
||||
/**
|
||||
* A [[Logger]] that silently ignores all warnings and debug messages.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const sass = require('sass');
|
||||
*
|
||||
* const result = sass.renderSync({
|
||||
* file: 'input.scss',
|
||||
* logger: sass.Logger.silent,
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export const silent: Logger;
|
||||
}
|
21
node_modules/sass/types/logger/source_location.d.ts
generated
vendored
Normal file
21
node_modules/sass/types/logger/source_location.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* A specific location within a source file.
|
||||
*
|
||||
* This is always associated with a [[SourceSpan]] which indicates *which* file
|
||||
* it refers to.
|
||||
*
|
||||
* @category Logger
|
||||
*/
|
||||
export interface SourceLocation {
|
||||
/**
|
||||
* The 0-based index of this location within its source file, in terms of
|
||||
* UTF-16 code units.
|
||||
*/
|
||||
offset: number;
|
||||
|
||||
/** The 0-based line number of this location. */
|
||||
line: number;
|
||||
|
||||
/** The 0-based column number of this location. */
|
||||
column: number;
|
||||
}
|
34
node_modules/sass/types/logger/source_span.d.ts
generated
vendored
Normal file
34
node_modules/sass/types/logger/source_span.d.ts
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import {SourceLocation} from './source_location';
|
||||
|
||||
/**
|
||||
* A span of text within a source file.
|
||||
*
|
||||
* @category Logger
|
||||
*/
|
||||
export interface SourceSpan {
|
||||
/** The beginning of this span, inclusive. */
|
||||
start: SourceLocation;
|
||||
|
||||
/**
|
||||
* The end of this span, exclusive.
|
||||
*
|
||||
* If [[start]] and [[end]] refer to the same location, the span has zero
|
||||
* length and refers to the point immediately after [[start]] and before the
|
||||
* next character.
|
||||
*/
|
||||
end: SourceLocation;
|
||||
|
||||
/** The canonical URL of the file this span refers to. */
|
||||
url?: URL;
|
||||
|
||||
/** The text covered by the span. */
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* Text surrounding the span.
|
||||
*
|
||||
* If this is set, it must include only whole lines, and it must include at
|
||||
* least all line(s) which are partially covered by this span.
|
||||
*/
|
||||
context?: string;
|
||||
}
|
435
node_modules/sass/types/options.d.ts
generated
vendored
Normal file
435
node_modules/sass/types/options.d.ts
generated
vendored
Normal file
@ -0,0 +1,435 @@
|
||||
import {FileImporter, Importer} from './importer';
|
||||
import {Logger} from './logger';
|
||||
import {Value} from './value';
|
||||
import {PromiseOr} from './util/promise_or';
|
||||
|
||||
/**
|
||||
* Syntaxes supported by Sass:
|
||||
*
|
||||
* - `'scss'` is the [SCSS
|
||||
* syntax](https://sass-lang.com/documentation/syntax#scss).
|
||||
* - `'indented'` is the [indented
|
||||
* syntax](https://sass-lang.com/documentation/syntax#the-indented-syntax)
|
||||
* - `'css'` is plain CSS, which is parsed like SCSS but forbids the use of any
|
||||
* special Sass features.
|
||||
*
|
||||
* @category Options
|
||||
*/
|
||||
export type Syntax = 'scss' | 'indented' | 'css';
|
||||
|
||||
/**
|
||||
* Possible output styles for the compiled CSS:
|
||||
*
|
||||
* - `"expanded"` (the default for Dart Sass) writes each selector and
|
||||
* declaration on its own line.
|
||||
*
|
||||
* - `"compressed"` removes as many extra characters as possible, and writes
|
||||
* the entire stylesheet on a single line.
|
||||
*
|
||||
* @category Options
|
||||
*/
|
||||
export type OutputStyle = 'expanded' | 'compressed';
|
||||
|
||||
/**
|
||||
* A callback that implements a custom Sass function. This can be passed to
|
||||
* [[Options.functions]].
|
||||
*
|
||||
* ```js
|
||||
* const result = sass.compile('style.scss', {
|
||||
* functions: {
|
||||
* "sum($arg1, $arg2)": (args) => {
|
||||
* const arg1 = args[0].assertNumber('arg1');
|
||||
* const value1 = arg1.value;
|
||||
* const value2 = args[1].assertNumber('arg2')
|
||||
* .convertValueToMatch(arg1, 'arg2', 'arg1');
|
||||
* return new sass.SassNumber(value1 + value2).coerceToMatch(arg1);
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @typeParam sync - A `CustomFunction<'sync'>` must return synchronously, but
|
||||
* in return it can be passed to [[compile]] and [[compileString]] in addition
|
||||
* to [[compileAsync]] and [[compileStringAsync]].
|
||||
*
|
||||
* A `CustomFunction<'async'>` may either return synchronously or
|
||||
* asynchronously, but it can only be used with [[compileAsync]] and
|
||||
* [[compileStringAsync]].
|
||||
*
|
||||
* @param args - An array of arguments passed by the function's caller. If the
|
||||
* function takes [arbitrary
|
||||
* arguments](https://sass-lang.com/documentation/at-rules/function#taking-arbitrary-arguments),
|
||||
* the last element will be a [[SassArgumentList]].
|
||||
*
|
||||
* @returns The function's result. This may be in the form of a `Promise`, but
|
||||
* if it is the function may only be passed to [[compileAsync]] and
|
||||
* [[compileStringAsync]], not [[compile]] or [[compileString]].
|
||||
*
|
||||
* @throws any - This function may throw an error, which the Sass compiler will
|
||||
* treat as the function call failing. If the exception object has a `message`
|
||||
* property, it will be used as the wrapped exception's message; otherwise, the
|
||||
* exception object's `toString()` will be used. This means it's safe for custom
|
||||
* functions to throw plain strings.
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export type CustomFunction<sync extends 'sync' | 'async'> = (
|
||||
args: Value[]
|
||||
) => PromiseOr<Value, sync>;
|
||||
|
||||
/**
|
||||
* Options that can be passed to [[compile]], [[compileAsync]],
|
||||
* [[compileString]], or [[compileStringAsync]].
|
||||
*
|
||||
* @typeParam sync - This lets the TypeScript checker verify that asynchronous
|
||||
* [[Importer]]s, [[FileImporter]]s, and [[CustomFunction]]s aren't passed to
|
||||
* [[compile]] or [[compileString]].
|
||||
*
|
||||
* @category Options
|
||||
*/
|
||||
export interface Options<sync extends 'sync' | 'async'> {
|
||||
/**
|
||||
* If this is `true`, the compiler will exclusively use ASCII characters in
|
||||
* its error and warning messages. Otherwise, it may use non-ASCII Unicode
|
||||
* characters as well.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Messages
|
||||
*/
|
||||
alertAscii?: boolean;
|
||||
|
||||
/**
|
||||
* If this is `true`, the compiler will use ANSI color escape codes in its
|
||||
* error and warning messages. If it's `false`, it won't use these. If it's
|
||||
* undefined, the compiler will determine whether or not to use colors
|
||||
* depending on whether the user is using an interactive terminal.
|
||||
*
|
||||
* @category Messages
|
||||
*/
|
||||
alertColor?: boolean;
|
||||
|
||||
/**
|
||||
* If `true`, the compiler may prepend `@charset "UTF-8";` or U+FEFF
|
||||
* (byte-order marker) if it outputs non-ASCII CSS.
|
||||
*
|
||||
* If `false`, the compiler never emits these byte sequences. This is ideal
|
||||
* when concatenating or embedding in HTML `<style>` tags. (The output will
|
||||
* still be UTF-8.)
|
||||
*
|
||||
* @defaultValue `true`
|
||||
* @category Output
|
||||
* @compatibility dart: "1.54.0", node: false
|
||||
*/
|
||||
charset?: boolean;
|
||||
|
||||
/**
|
||||
* Additional built-in Sass functions that are available in all stylesheets.
|
||||
* This option takes an object whose keys are Sass function signatures like
|
||||
* you'd write for the [`@function
|
||||
* rule`](https://sass-lang.com/documentation/at-rules/function) and whose
|
||||
* values are [[CustomFunction]]s.
|
||||
*
|
||||
* Functions are passed JavaScript representations of [Sass value
|
||||
* types](https://sass-lang.com/documentation/js-api#value-types), and must
|
||||
* return the same.
|
||||
*
|
||||
* When writing custom functions, it's important to make them as user-friendly
|
||||
* and as close to the standards set by Sass's core functions as possible. Some
|
||||
* good guidelines to follow include:
|
||||
*
|
||||
* * Use `Value.assert*` methods, like [[Value.assertString]], to cast untyped
|
||||
* `Value` objects to more specific types. For values that were passed
|
||||
* directly as arguments, pass in the argument name as well. This ensures
|
||||
* that the user gets good error messages when they pass in the wrong type
|
||||
* to your function.
|
||||
*
|
||||
* * Individual classes may have more specific `assert*` methods, like
|
||||
* [[SassNumber.assertInt]], which should be used when possible.
|
||||
*
|
||||
* * In Sass, every value counts as a list. Rather than trying to detect the
|
||||
* [[SassList]] type, you should use [[Value.asList]] to treat all values as
|
||||
* lists.
|
||||
*
|
||||
* * When manipulating values like lists, strings, and numbers that have
|
||||
* metadata (comma versus space separated, bracketed versus unbracketed,
|
||||
* quoted versus unquoted, units), the output metadata should match the
|
||||
* input metadata.
|
||||
*
|
||||
* * When in doubt, lists should default to comma-separated, strings should
|
||||
* default to quoted, and numbers should default to unitless.
|
||||
*
|
||||
* * In Sass, lists and strings use one-based indexing and use negative
|
||||
* indices to index from the end of value. Functions should follow these
|
||||
* conventions. [[Value.sassIndexToListIndex]] and
|
||||
* [[SassString.sassIndexToStringIndex]] can be used to do this
|
||||
* automatically.
|
||||
*
|
||||
* * String indexes in Sass refer to Unicode code points while JavaScript
|
||||
* string indices refer to UTF-16 code units. For example, the character
|
||||
* U+1F60A SMILING FACE WITH SMILING EYES is a single Unicode code point but
|
||||
* is represented in UTF-16 as two code units (`0xD83D` and `0xDE0A`). So in
|
||||
* JavaScript, `"a😊b".charCodeAt(1)` returns `0xD83D`, whereas in Sass
|
||||
* `str-slice("a😊b", 1, 1)` returns `"😊"`. Functions should follow Sass's
|
||||
* convention. [[SassString.sassIndexToStringIndex]] can be used to do this
|
||||
* automatically, and the [[SassString.sassLength]] getter can be used to
|
||||
* access a string's length in code points.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* sass.compileString(`
|
||||
* h1 {
|
||||
* font-size: pow(2, 5) * 1px;
|
||||
* }`, {
|
||||
* functions: {
|
||||
* // Note: in real code, you should use `math.pow()` from the built-in
|
||||
* // `sass:math` module.
|
||||
* 'pow($base, $exponent)': function(args) {
|
||||
* const base = args[0].assertNumber('base').assertNoUnits('base');
|
||||
* const exponent =
|
||||
* args[1].assertNumber('exponent').assertNoUnits('exponent');
|
||||
*
|
||||
* return new sass.SassNumber(Math.pow(base.value, exponent.value));
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @category Plugins
|
||||
*/
|
||||
functions?: Record<string, CustomFunction<sync>>;
|
||||
|
||||
/**
|
||||
* Custom importers that control how Sass resolves loads from rules like
|
||||
* [`@use`](https://sass-lang.com/documentation/at-rules/use) and
|
||||
* [`@import`](https://sass-lang.com/documentation/at-rules/import).
|
||||
*
|
||||
* Loads are resolved by trying, in order:
|
||||
*
|
||||
* - The importer that was used to load the current stylesheet, with the
|
||||
* loaded URL resolved relative to the current stylesheet's canonical URL.
|
||||
*
|
||||
* - Each [[Importer]] or [[FileImporter]] in [[importers]], in order.
|
||||
*
|
||||
* - Each load path in [[loadPaths]], in order.
|
||||
*
|
||||
* If none of these return a Sass file, the load fails and Sass throws an
|
||||
* error.
|
||||
*
|
||||
* @category Plugins
|
||||
*/
|
||||
importers?: (Importer<sync> | FileImporter<sync>)[];
|
||||
|
||||
/**
|
||||
* Paths in which to look for stylesheets loaded by rules like
|
||||
* [`@use`](https://sass-lang.com/documentation/at-rules/use) and
|
||||
* [`@import`](https://sass-lang.com/documentation/at-rules/import).
|
||||
*
|
||||
* A load path `loadPath` is equivalent to the following [[FileImporter]]:
|
||||
*
|
||||
* ```js
|
||||
* {
|
||||
* findFileUrl(url) {
|
||||
* // Load paths only support relative URLs.
|
||||
* if (/^[a-z]+:/i.test(url)) return null;
|
||||
* return new URL(url, pathToFileURL(loadPath));
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @category Input
|
||||
*/
|
||||
loadPaths?: string[];
|
||||
|
||||
/**
|
||||
* An object to use to handle warnings and/or debug messages from Sass.
|
||||
*
|
||||
* By default, Sass emits warnings and debug messages to standard error, but
|
||||
* if [[Logger.warn]] or [[Logger.debug]] is set, this will invoke them
|
||||
* instead.
|
||||
*
|
||||
* The special value [[Logger.silent]] can be used to easily silence all
|
||||
* messages.
|
||||
*
|
||||
* @category Messages
|
||||
*/
|
||||
logger?: Logger;
|
||||
|
||||
/**
|
||||
* If this option is set to `true`, Sass won’t print warnings that are caused
|
||||
* by dependencies. A “dependency” is defined as any file that’s loaded
|
||||
* through [[loadPaths]] or [[importer]]. Stylesheets that are imported
|
||||
* relative to the entrypoint are not considered dependencies.
|
||||
*
|
||||
* This is useful for silencing deprecation warnings that you can’t fix on
|
||||
* your own. However, please <em>also</em> notify your dependencies of the deprecations
|
||||
* so that they can get fixed as soon as possible!
|
||||
*
|
||||
* **Heads up!** If [[compileString]] or [[compileStringAsync]] is called
|
||||
* without [[StringWithoutImporter.url]], <em>all</em> stylesheets it loads
|
||||
* will be considered dependencies. Since it doesn’t have a path of its own,
|
||||
* everything it loads is coming from a load path rather than a relative
|
||||
* import.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Messages
|
||||
*/
|
||||
quietDeps?: boolean;
|
||||
|
||||
/**
|
||||
* Whether or not Sass should generate a source map. If it does, the source
|
||||
* map will be available as [[CompileResult.sourceMap]].
|
||||
*
|
||||
* **Heads up!** Sass doesn't automatically add a `sourceMappingURL` comment
|
||||
* to the generated CSS. It's up to callers to do that, since callers have
|
||||
* full knowledge of where the CSS and the source map will exist in relation
|
||||
* to one another and how they'll be served to the browser.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Output
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
|
||||
/**
|
||||
* Whether Sass should include the sources in the generated source map.
|
||||
*
|
||||
* This option has no effect if [[sourceMap]] is `false`.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Output
|
||||
*/
|
||||
sourceMapIncludeSources?: boolean;
|
||||
|
||||
/**
|
||||
* The [[OutputStyle]] of the compiled CSS.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* const source = `
|
||||
* h1 {
|
||||
* font-size: 40px;
|
||||
* code {
|
||||
* font-face: Roboto Mono;
|
||||
* }
|
||||
* }`;
|
||||
*
|
||||
* let result = sass.compileString(source, {style: "expanded"});
|
||||
* console.log(result.css.toString());
|
||||
* // h1 {
|
||||
* // font-size: 40px;
|
||||
* // }
|
||||
* // h1 code {
|
||||
* // font-face: Roboto Mono;
|
||||
* // }
|
||||
*
|
||||
* result = sass.compileString(source, {style: "compressed"})
|
||||
* console.log(result.css.toString());
|
||||
* // h1{font-size:40px}h1 code{font-face:Roboto Mono}
|
||||
* ```
|
||||
*
|
||||
* @category Output
|
||||
*/
|
||||
style?: OutputStyle;
|
||||
|
||||
/**
|
||||
* By default, Dart Sass will print only five instances of the same
|
||||
* deprecation warning per compilation to avoid deluging users in console
|
||||
* noise. If you set `verbose` to `true`, it will instead print every
|
||||
* deprecation warning it encounters.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
* @category Messages
|
||||
*/
|
||||
verbose?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options that can be passed to [[compileString]] or [[compileStringAsync]].
|
||||
*
|
||||
* If the [[StringOptionsWithImporter.importer]] field isn't passed, the
|
||||
* entrypoint file can load files relative to itself if a `file://` URL is
|
||||
* passed to the [[url]] field.
|
||||
*
|
||||
* @typeParam sync - This lets the TypeScript checker verify that asynchronous
|
||||
* [[Importer]]s, [[FileImporter]]s, and [[CustomFunction]]s aren't passed to
|
||||
* [[compile]] or [[compileString]].
|
||||
*
|
||||
* @category Options
|
||||
*/
|
||||
export interface StringOptionsWithoutImporter<sync extends 'sync' | 'async'>
|
||||
extends Options<sync> {
|
||||
/**
|
||||
* The [[Syntax]] to use to parse the entrypoint stylesheet.
|
||||
*
|
||||
* @default `'scss'`
|
||||
*
|
||||
* @category Input
|
||||
*/
|
||||
syntax?: Syntax;
|
||||
|
||||
/**
|
||||
* The canonical URL of the entrypoint stylesheet.
|
||||
*
|
||||
* A relative load's URL is first resolved relative to [[url]], then resolved
|
||||
* to a file on disk if it's a `file://` URL. If it can't be resolved to a
|
||||
* file on disk, it's then passed to [[importers]] and [[loadPaths]].
|
||||
*
|
||||
* @category Input
|
||||
*/
|
||||
url?: URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options that can be passed to [[compileString]] or [[compileStringAsync]].
|
||||
*
|
||||
* If the [[StringOptionsWithImporter.importer]] field is passed, the entrypoint
|
||||
* file uses it to load files relative to itself and the [[url]] field is
|
||||
* mandatory.
|
||||
*
|
||||
* @typeParam sync - This lets the TypeScript checker verify that asynchronous
|
||||
* [[Importer]]s, [[FileImporter]]s, and [[CustomFunction]]s aren't passed to
|
||||
* [[compile]] or [[compileString]].
|
||||
*
|
||||
* @category Options
|
||||
*/
|
||||
export interface StringOptionsWithImporter<sync extends 'sync' | 'async'>
|
||||
extends StringOptionsWithoutImporter<sync> {
|
||||
/**
|
||||
* The importer to use to handle loads that are relative to the entrypoint
|
||||
* stylesheet.
|
||||
*
|
||||
* A relative load's URL is first resolved relative to [[url]], then passed to
|
||||
* [[importer]]. If the importer doesn't recognize it, it's then passed to
|
||||
* [[importers]] and [[loadPaths]].
|
||||
*
|
||||
* @category Input
|
||||
*/
|
||||
importer: Importer<sync> | FileImporter<sync>;
|
||||
|
||||
/**
|
||||
* The canonical URL of the entrypoint stylesheet. If this is passed along
|
||||
* with [[importer]], it's used to resolve relative loads in the entrypoint
|
||||
* stylesheet.
|
||||
*
|
||||
* @category Input
|
||||
*/
|
||||
url: URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options that can be passed to [[compileString]] or [[compileStringAsync]].
|
||||
*
|
||||
* This is a [[StringOptionsWithImporter]] if it has a
|
||||
* [[StringOptionsWithImporter.importer]] field, and a
|
||||
* [[StringOptionsWithoutImporter]] otherwise.
|
||||
*
|
||||
* @typeParam sync - This lets the TypeScript checker verify that asynchronous
|
||||
* [[Importer]]s, [[FileImporter]]s, and [[CustomFunction]]s aren't passed to
|
||||
* [[compile]] or [[compileString]].
|
||||
*
|
||||
* @category Options
|
||||
*/
|
||||
export type StringOptions<sync extends 'sync' | 'async'> =
|
||||
| StringOptionsWithImporter<sync>
|
||||
| StringOptionsWithoutImporter<sync>;
|
17
node_modules/sass/types/util/promise_or.d.ts
generated
vendored
Normal file
17
node_modules/sass/types/util/promise_or.d.ts
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* A utility type for choosing between synchronous and asynchronous return
|
||||
* values.
|
||||
*
|
||||
* This is used as the return value for plugins like [[CustomFunction]],
|
||||
* [[Importer]], and [[FileImporter]] so that TypeScript enforces that
|
||||
* asynchronous plugins are only passed to [[compileAsync]] and
|
||||
* [[compileStringAsync]], not [[compile]] or [[compileString]].
|
||||
*
|
||||
* @typeParam sync - If this is `'sync'`, this can only be a `T`. If it's
|
||||
* `'async'`, this can be either a `T` or a `Promise<T>`.
|
||||
*
|
||||
* @category Other
|
||||
*/
|
||||
export type PromiseOr<T, sync extends 'sync' | 'async'> = sync extends 'async'
|
||||
? T | Promise<T>
|
||||
: T;
|
47
node_modules/sass/types/value/argument_list.d.ts
generated
vendored
Normal file
47
node_modules/sass/types/value/argument_list.d.ts
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
import {List, OrderedMap} from 'immutable';
|
||||
|
||||
import {Value} from './index';
|
||||
import {SassList, ListSeparator} from './list';
|
||||
|
||||
/**
|
||||
* Sass's [argument list
|
||||
* type](https://sass-lang.com/documentation/values/lists#argument-lists).
|
||||
*
|
||||
* An argument list comes from a rest argument. It's distinct from a normal
|
||||
* [[SassList]] in that it may contain a keyword map as well as the positional
|
||||
* arguments.
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export class SassArgumentList extends SassList {
|
||||
/**
|
||||
* Creates a new argument list.
|
||||
*
|
||||
* @param contents - The positional arguments that make up the primary
|
||||
* contents of the list. This may be either a plain JavaScript array or an
|
||||
* immutable [[List]] from the [`immutable`
|
||||
* package](https://immutable-js.com/).
|
||||
*
|
||||
* @param keywords - The keyword arguments attached to this argument list,
|
||||
* whose names should exclude `$`. This can be either a plain JavaScript
|
||||
* object with argument names as fields, or an immutable [[OrderedMap]] from
|
||||
* the [`immutable` package](https://immutable-js.com/)
|
||||
*
|
||||
* @param separator - The separator for this list. Defaults to `','`.
|
||||
*/
|
||||
constructor(
|
||||
contents: Value[] | List<Value>,
|
||||
keywords: Record<string, Value> | OrderedMap<string, Value>,
|
||||
separator?: ListSeparator
|
||||
);
|
||||
|
||||
/**
|
||||
* The keyword arguments attached to this argument list.
|
||||
*
|
||||
* The argument names don't include `$`.
|
||||
*
|
||||
* @returns An immutable [[OrderedMap]] from the [`immutable`
|
||||
* package](https://immutable-js.com/).
|
||||
*/
|
||||
get keywords(): OrderedMap<string, Value>;
|
||||
}
|
29
node_modules/sass/types/value/boolean.d.ts
generated
vendored
Normal file
29
node_modules/sass/types/value/boolean.d.ts
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import {Value} from './index';
|
||||
|
||||
/**
|
||||
* Sass's [`true` value](https://sass-lang.com/documentation/values/booleans).
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export const sassTrue: SassBoolean;
|
||||
|
||||
/**
|
||||
* Sass's [`false` value](https://sass-lang.com/documentation/values/booleans).
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export const sassFalse: SassBoolean;
|
||||
|
||||
/**
|
||||
* Sass's [boolean type](https://sass-lang.com/documentation/values/booleans).
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export class SassBoolean extends Value {
|
||||
private constructor();
|
||||
|
||||
/**
|
||||
* Whether this value is `true` or `false`.
|
||||
*/
|
||||
get value(): boolean;
|
||||
}
|
107
node_modules/sass/types/value/color.d.ts
generated
vendored
Normal file
107
node_modules/sass/types/value/color.d.ts
generated
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
import {Value} from './index';
|
||||
|
||||
/**
|
||||
* Sass's [color type](https://sass-lang.com/documentation/values/colors).
|
||||
*
|
||||
* No matter what representation was originally used to create this color, all
|
||||
* of its channels are accessible.
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export class SassColor extends Value {
|
||||
/**
|
||||
* Creates an RGB color.
|
||||
*
|
||||
* @throws `Error` if `red`, `green`, and `blue` aren't between `0` and
|
||||
* `255`, or if `alpha` isn't between `0` and `1`.
|
||||
*/
|
||||
constructor(options: {
|
||||
red: number;
|
||||
green: number;
|
||||
blue: number;
|
||||
alpha?: number;
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates an HSL color.
|
||||
*
|
||||
* @throws `Error` if `saturation` or `lightness` aren't between `0` and
|
||||
* `100`, or if `alpha` isn't between `0` and `1`.
|
||||
*/
|
||||
constructor(options: {
|
||||
hue: number;
|
||||
saturation: number;
|
||||
lightness: number;
|
||||
alpha?: number;
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates an HWB color.
|
||||
*
|
||||
* @throws `Error` if `whiteness` or `blackness` aren't between `0` and `100`,
|
||||
* or if `alpha` isn't between `0` and `1`.
|
||||
*/
|
||||
constructor(options: {
|
||||
hue: number;
|
||||
whiteness: number;
|
||||
blackness: number;
|
||||
alpha?: number;
|
||||
});
|
||||
|
||||
/** This color's red channel, between `0` and `255`. */
|
||||
get red(): number;
|
||||
|
||||
/** This color's green channel, between `0` and `255`. */
|
||||
get green(): number;
|
||||
|
||||
/** This color's blue channel, between `0` and `255`. */
|
||||
get blue(): number;
|
||||
|
||||
/** This color's hue, between `0` and `360`. */
|
||||
get hue(): number;
|
||||
|
||||
/** This color's saturation, between `0` and `100`. */
|
||||
get saturation(): number;
|
||||
|
||||
/** This color's lightness, between `0` and `100`. */
|
||||
get lightness(): number;
|
||||
|
||||
/** This color's whiteness, between `0` and `100`. */
|
||||
get whiteness(): number;
|
||||
|
||||
/** This color's blackness, between `0` and `100`. */
|
||||
get blackness(): number;
|
||||
|
||||
/** This color's alpha channel, between `0` and `1`. */
|
||||
get alpha(): number;
|
||||
|
||||
/**
|
||||
* Changes one or more of this color's RGB channels and returns the result.
|
||||
*/
|
||||
change(options: {
|
||||
red?: number;
|
||||
green?: number;
|
||||
blue?: number;
|
||||
alpha?: number;
|
||||
}): SassColor;
|
||||
|
||||
/**
|
||||
* Changes one or more of this color's HSL channels and returns the result.
|
||||
*/
|
||||
change(options: {
|
||||
hue?: number;
|
||||
saturation?: number;
|
||||
lightness?: number;
|
||||
alpha?: number;
|
||||
}): SassColor;
|
||||
|
||||
/**
|
||||
* Changes one or more of this color's HWB channels and returns the result.
|
||||
*/
|
||||
change(options: {
|
||||
hue?: number;
|
||||
whiteness?: number;
|
||||
blackness?: number;
|
||||
alpha?: number;
|
||||
}): SassColor;
|
||||
}
|
22
node_modules/sass/types/value/function.d.ts
generated
vendored
Normal file
22
node_modules/sass/types/value/function.d.ts
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import {Value} from './index';
|
||||
|
||||
/**
|
||||
* Sass's [function type](https://sass-lang.com/documentation/values/functions).
|
||||
*
|
||||
* **Heads up!** Although first-class Sass functions can be processed by custom
|
||||
* functions, there's no way to invoke them outside of a Sass stylesheet.
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export class SassFunction extends Value {
|
||||
/**
|
||||
* Creates a new first-class function that can be invoked using
|
||||
* [`meta.call()`](https://sass-lang.com/documentation/modules/meta#call).
|
||||
*
|
||||
* @param signature - The function signature, like you'd write for the
|
||||
* [`@function rule`](https://sass-lang.com/documentation/at-rules/function).
|
||||
* @param callback - The callback that's invoked when this function is called,
|
||||
* just like for a [[CustomFunction]].
|
||||
*/
|
||||
constructor(signature: string, callback: (args: Value[]) => Value);
|
||||
}
|
173
node_modules/sass/types/value/index.d.ts
generated
vendored
Normal file
173
node_modules/sass/types/value/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,173 @@
|
||||
import {List, ValueObject} from 'immutable';
|
||||
|
||||
import {SassBoolean} from './boolean';
|
||||
import {SassColor} from './color';
|
||||
import {SassFunction} from './function';
|
||||
import {ListSeparator} from './list';
|
||||
import {SassMap} from './map';
|
||||
import {SassNumber} from './number';
|
||||
import {SassString} from './string';
|
||||
|
||||
export {SassArgumentList} from './argument_list';
|
||||
export {SassBoolean, sassTrue, sassFalse} from './boolean';
|
||||
export {SassColor} from './color';
|
||||
export {SassFunction} from './function';
|
||||
export {SassList, ListSeparator} from './list';
|
||||
export {SassMap} from './map';
|
||||
export {SassNumber} from './number';
|
||||
export {SassString} from './string';
|
||||
|
||||
/**
|
||||
* Sass's [`null` value](https://sass-lang.com/documentation/values/null).
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export const sassNull: Value;
|
||||
|
||||
/**
|
||||
* The abstract base class of Sass's value types.
|
||||
*
|
||||
* This is passed to and returned by [[CustomFunction]]s, which are passed into
|
||||
* the Sass implementation using [[Options.functions]].
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export abstract class Value implements ValueObject {
|
||||
protected constructor();
|
||||
|
||||
/**
|
||||
* This value as a list.
|
||||
*
|
||||
* All SassScript values can be used as lists. Maps count as lists of pairs,
|
||||
* and all other values count as single-value lists.
|
||||
*
|
||||
* @returns An immutable [[List]] from the [`immutable`
|
||||
* package](https://immutable-js.com/).
|
||||
*/
|
||||
get asList(): List<Value>;
|
||||
|
||||
/**
|
||||
* Whether this value as a list has brackets.
|
||||
*
|
||||
* All SassScript values can be used as lists. Maps count as lists of pairs,
|
||||
* and all other values count as single-value lists.
|
||||
*/
|
||||
get hasBrackets(): boolean;
|
||||
|
||||
/**
|
||||
* Whether the value counts as `true` in an `@if` statement and other
|
||||
* contexts.
|
||||
*/
|
||||
get isTruthy(): boolean;
|
||||
|
||||
/**
|
||||
* Returns JavaScript's `null` value if this is [[sassNull]], and returns
|
||||
* `this` otherwise.
|
||||
*/
|
||||
get realNull(): null | Value;
|
||||
|
||||
/**
|
||||
* The separator for this value as a list.
|
||||
*
|
||||
* All SassScript values can be used as lists. Maps count as lists of pairs,
|
||||
* and all other values count as single-value lists.
|
||||
*/
|
||||
get separator(): ListSeparator;
|
||||
|
||||
/**
|
||||
* Converts `sassIndex` into a JavaScript-style index into the list returned
|
||||
* by [[asList]].
|
||||
*
|
||||
* Sass indexes are one-based, while JavaScript indexes are zero-based. Sass
|
||||
* indexes may also be negative in order to index from the end of the list.
|
||||
*
|
||||
* @param sassIndex - The Sass-style index into this as a list.
|
||||
* @param name - The name of the function argument `sassIndex` came from
|
||||
* (without the `$`) if it came from an argument. Used for error reporting.
|
||||
* @throws `Error` If `sassIndex` isn't a number, if that number isn't an
|
||||
* integer, or if that integer isn't a valid index for [[asList]].
|
||||
*/
|
||||
sassIndexToListIndex(sassIndex: Value, name?: string): number;
|
||||
|
||||
/**
|
||||
* Returns the value at index `index` in this value as a list, or `undefined`
|
||||
* if `index` isn't valid for this list.
|
||||
*
|
||||
* All SassScript values can be used as lists. Maps count as lists of pairs,
|
||||
* and all other values count as single-value lists.
|
||||
*
|
||||
* This is a shorthand for `this.asList.get(index)`, although it may be more
|
||||
* efficient in some cases.
|
||||
*
|
||||
* **Heads up!** This method uses the same indexing conventions as the
|
||||
* `immutable` package: unlike Sass the index of the first element is 0, but
|
||||
* like Sass negative numbers index from the end of the list.
|
||||
*/
|
||||
get(index: number): Value | undefined;
|
||||
|
||||
/**
|
||||
* Throws if `this` isn't a [[SassBoolean]].
|
||||
*
|
||||
* **Heads up!** Functions should generally use [[isTruthy]] rather than
|
||||
* requiring a literal boolean.
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertBoolean(name?: string): SassBoolean;
|
||||
|
||||
/**
|
||||
* Throws if `this` isn't a [[SassColor]].
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertColor(name?: string): SassColor;
|
||||
|
||||
/**
|
||||
* Throws if `this` isn't a [[SassFunction]].
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertFunction(name?: string): SassFunction;
|
||||
|
||||
/**
|
||||
* Throws if `this` isn't a [[SassMap]].
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertMap(name?: string): SassMap;
|
||||
|
||||
/**
|
||||
* Throws if `this` isn't a [[SassNumber]].
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertNumber(name?: string): SassNumber;
|
||||
|
||||
/**
|
||||
* Throws if `this` isn't a [[SassString]].
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertString(name?: string): SassString;
|
||||
|
||||
/**
|
||||
* Returns `this` as a map if it counts as one (empty lists count as empty
|
||||
* maps) or `null` if it doesn't.
|
||||
*/
|
||||
tryMap(): SassMap | null;
|
||||
|
||||
/** Returns whether `this` represents the same value as `other`. */
|
||||
equals(other: Value): boolean;
|
||||
|
||||
/** Returns a hash code that can be used to store `this` in a hash map. */
|
||||
hashCode(): number;
|
||||
|
||||
/** @hidden */
|
||||
toString(): string;
|
||||
}
|
54
node_modules/sass/types/value/list.d.ts
generated
vendored
Normal file
54
node_modules/sass/types/value/list.d.ts
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
import {List} from 'immutable';
|
||||
|
||||
import {Value} from './index';
|
||||
|
||||
/**
|
||||
* Possible separators used by Sass lists. The special separator `null` is only
|
||||
* used for lists with fewer than two elements, and indicates that the separator
|
||||
* has not yet been decided for this list.
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export type ListSeparator = ',' | '/' | ' ' | null;
|
||||
|
||||
/**
|
||||
* Sass's [list type](https://sass-lang.com/documentation/values/lists).
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export class SassList extends Value {
|
||||
/**
|
||||
* Creates a new list.
|
||||
*
|
||||
* @param contents - The contents of the list. This may be either a plain
|
||||
* JavaScript array or an immutable [[List]] from the [`immutable`
|
||||
* package](https://immutable-js.com/).
|
||||
*
|
||||
* @param options.separator - The separator to use between elements of this
|
||||
* list. Defaults to `','`.
|
||||
*
|
||||
* @param options.brackets - Whether the list has square brackets. Defaults to
|
||||
* `false`.
|
||||
*/
|
||||
constructor(
|
||||
contents: Value[] | List<Value>,
|
||||
options?: {
|
||||
separator?: ListSeparator;
|
||||
brackets?: boolean;
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Creates an empty list.
|
||||
*
|
||||
* @param options.separator - The separator to use between elements of this
|
||||
* list. Defaults to `','`.
|
||||
*
|
||||
* @param options.brackets - Whether the list has square brackets. Defaults to
|
||||
* `false`.
|
||||
*/
|
||||
constructor(options?: {separator?: ListSeparator; brackets?: boolean});
|
||||
|
||||
/** @hidden */
|
||||
get separator(): ListSeparator;
|
||||
}
|
41
node_modules/sass/types/value/map.d.ts
generated
vendored
Normal file
41
node_modules/sass/types/value/map.d.ts
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
import {OrderedMap} from 'immutable';
|
||||
|
||||
import {SassList} from './list';
|
||||
import {Value} from './index';
|
||||
|
||||
/**
|
||||
* Sass's [map type](https://sass-lang.com/documentation/values/maps).
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export class SassMap extends Value {
|
||||
/**
|
||||
* Creates a new map.
|
||||
*
|
||||
* @param contents - The contents of the map. This is an immutable
|
||||
* [[OrderedMap]] from the [`immutable` package](https://immutable-js.com/).
|
||||
* Defaults to an empty map.
|
||||
*/
|
||||
constructor(contents?: OrderedMap<Value, Value>);
|
||||
|
||||
/**
|
||||
* Returns the contents of this map as an immutable [[OrderedMap]] from the
|
||||
* [`immutable` package](https://immutable-js.com/).
|
||||
*/
|
||||
get contents(): OrderedMap<Value, Value>;
|
||||
|
||||
/**
|
||||
* Returns the value associated with `key` in this map, or `undefined` if
|
||||
* `key` isn't in the map.
|
||||
*
|
||||
* This is a shorthand for `this.contents.get(key)`, although it may be more
|
||||
* efficient in some cases.
|
||||
*/
|
||||
get(key: Value): Value | undefined;
|
||||
|
||||
/** Inherited from [[Value.get]]. */
|
||||
get(index: number): SassList | undefined;
|
||||
|
||||
/** @hidden */
|
||||
tryMap(): SassMap;
|
||||
}
|
305
node_modules/sass/types/value/number.d.ts
generated
vendored
Normal file
305
node_modules/sass/types/value/number.d.ts
generated
vendored
Normal file
@ -0,0 +1,305 @@
|
||||
import {List} from 'immutable';
|
||||
|
||||
import {Value} from './index';
|
||||
|
||||
/**
|
||||
* Sass's [number type](https://sass-lang.com/documentation/values/numbers).
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export class SassNumber extends Value {
|
||||
/**
|
||||
* Creates a new number with more complex units than just a single numerator.
|
||||
*
|
||||
* Upon construction, any compatible numerator and denominator units are
|
||||
* simplified away according to the conversion factor between them.
|
||||
*
|
||||
* @param value - The number's numeric value.
|
||||
*
|
||||
* @param unit - If this is a string, it's used as the single numerator unit
|
||||
* for the number.
|
||||
*
|
||||
* @param unit.numeratorUnits - If passed, these are the numerator units to
|
||||
* use for the number. This may be either a plain JavaScript array or an
|
||||
* immutable [[List]] from the [`immutable`
|
||||
* package](https://immutable-js.com/).
|
||||
*
|
||||
* @param unit.denominatorUnits - If passed, these are the denominator units
|
||||
* to use for the number. This may be either a plain JavaScript array or an
|
||||
* immutable [[List]] from the [`immutable`
|
||||
* package](https://immutable-js.com/).
|
||||
*/
|
||||
constructor(
|
||||
value: number,
|
||||
unit?:
|
||||
| string
|
||||
| {
|
||||
numeratorUnits?: string[] | List<string>;
|
||||
denominatorUnits?: string[] | List<string>;
|
||||
}
|
||||
);
|
||||
|
||||
/** This number's numeric value. */
|
||||
get value(): number;
|
||||
|
||||
/** Whether [[value]] is an integer according to Sass's equality logic. */
|
||||
get isInt(): boolean;
|
||||
|
||||
/**
|
||||
* If [[value]] is an integer according to [[isInt]], returns [[value]]
|
||||
* rounded to that integer. If it's not an integer, returns `null`.
|
||||
*/
|
||||
get asInt(): number | null;
|
||||
|
||||
/**
|
||||
* This number's numerator units as an immutable [[List]] from the
|
||||
* [`immutable` package](https://immutable-js.com/).
|
||||
*/
|
||||
get numeratorUnits(): List<string>;
|
||||
|
||||
/**
|
||||
* This number's denominator units as an immutable [[List]] from the
|
||||
* [`immutable` package](https://immutable-js.com/).
|
||||
*/
|
||||
get denominatorUnits(): List<string>;
|
||||
|
||||
/** Whether this number has any numerator or denominator units. */
|
||||
get hasUnits(): boolean;
|
||||
|
||||
/**
|
||||
* If [[value]] is an integer according to [[isInt]], returns it rounded to
|
||||
* that integer. Otherwise, throws an error.
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertInt(name?: string): number;
|
||||
|
||||
/**
|
||||
* Returns [[value]] if it's within `min` and `max`. If [[value]] is equal to
|
||||
* `min` or `max` according to Sass's equality, returns `min` or `max`
|
||||
* respectively. Otherwise, throws an error.
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertInRange(min: number, max: number, name?: string): number;
|
||||
|
||||
/**
|
||||
* If this number has no units, returns it. Otherwise, throws an error.
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertNoUnits(name?: string): SassNumber;
|
||||
|
||||
/**
|
||||
* If this number has `unit` as its only unit (and as a numerator), returns
|
||||
* this number. Otherwise, throws an error.
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
assertUnit(unit: string, name?: string): SassNumber;
|
||||
|
||||
/** Whether this number has `unit` as its only unit (and as a numerator). */
|
||||
hasUnit(unit: string): boolean;
|
||||
|
||||
/**
|
||||
* Whether this has exactly one numerator unit, and that unit is compatible
|
||||
* with `unit`.
|
||||
*/
|
||||
compatibleWithUnit(unit: string): boolean;
|
||||
|
||||
/**
|
||||
* Returns a copy of this number, converted to the units represented by
|
||||
* `newNumerators` and `newDenominators`.
|
||||
*
|
||||
* @throws `Error` if this number's units are incompatible with
|
||||
* `newNumerators` and `newDenominators`; or if this number is unitless and
|
||||
* either `newNumerators` or `newDenominators` are not empty, or vice-versa.
|
||||
*
|
||||
* @param newNumerators - The numerator units to convert this number to. This
|
||||
* may be either a plain JavaScript array or an immutable [[List]] from the
|
||||
* [`immutable` package](https://immutable-js.com/).
|
||||
*
|
||||
* @param newDenominators - The denominator units to convert this number to.
|
||||
* This may be either a plain JavaScript array or an immutable [[List]] from
|
||||
* the [`immutable` package](https://immutable-js.com/).
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
convert(
|
||||
newNumerators: string[] | List<string>,
|
||||
newDenominators: string[] | List<string>,
|
||||
name?: string
|
||||
): SassNumber;
|
||||
|
||||
/**
|
||||
* Returns a copy of this number, converted to the same units as `other`.
|
||||
*
|
||||
* @throws `Error` if this number's units are incompatible with `other`'s
|
||||
* units, or if either number is unitless but the other is not.
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*
|
||||
* @param otherName - The name of the function argument `other` came from
|
||||
* (without the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
convertToMatch(
|
||||
other: SassNumber,
|
||||
name?: string,
|
||||
otherName?: string
|
||||
): SassNumber;
|
||||
|
||||
/**
|
||||
* Returns [[value]], converted to the units represented by `newNumerators`
|
||||
* and `newDenominators`.
|
||||
*
|
||||
* @throws `Error` if this number's units are incompatible with
|
||||
* `newNumerators` and `newDenominators`; or if this number is unitless and
|
||||
* either `newNumerators` or `newDenominators` are not empty, or vice-versa.
|
||||
*
|
||||
* @param newNumerators - The numerator units to convert [[value]] to. This
|
||||
* may be either a plain JavaScript array or an immutable [[List]] from the
|
||||
* [`immutable` package](https://immutable-js.com/).
|
||||
*
|
||||
* @param newDenominators - The denominator units to convert [[value]] to.
|
||||
* This may be either a plain JavaScript array or an immutable [[List]] from
|
||||
* the [`immutable` package](https://immutable-js.com/).
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
convertValue(
|
||||
newNumerators: string[] | List<string>,
|
||||
newDenominators: string[] | List<string>,
|
||||
name?: string
|
||||
): number;
|
||||
|
||||
/**
|
||||
* Returns [[value]], converted to the same units as `other`.
|
||||
*
|
||||
* @throws `Error` if this number's units are incompatible with `other`'s
|
||||
* units, or if either number is unitless but the other is not.
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*
|
||||
* @param otherName - The name of the function argument `other` came from
|
||||
* (without the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
convertValueToMatch(
|
||||
other: SassNumber,
|
||||
name?: string,
|
||||
otherName?: string
|
||||
): number;
|
||||
|
||||
/**
|
||||
* Returns a copy of this number, converted to the units represented by
|
||||
* `newNumerators` and `newDenominators`.
|
||||
*
|
||||
* Unlike [[convert]] this does *not* throw an error if this number is
|
||||
* unitless and either `newNumerators` or `newDenominators` are not empty, or
|
||||
* vice-versa. Instead, it treats all unitless numbers as convertible to and
|
||||
* from all units without changing the value.
|
||||
*
|
||||
* @throws `Error` if this number's units are incompatible with
|
||||
* `newNumerators` and `newDenominators`.
|
||||
*
|
||||
* @param newNumerators - The numerator units to convert this number to. This
|
||||
* may be either a plain JavaScript array or an immutable [[List]] from the
|
||||
* [`immutable` package](https://immutable-js.com/).
|
||||
*
|
||||
* @param newDenominators - The denominator units to convert this number to.
|
||||
* This may be either a plain JavaScript array or an immutable [[List]] from
|
||||
* the [`immutable` package](https://immutable-js.com/).
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
coerce(
|
||||
newNumerators: string[] | List<string>,
|
||||
newDenominators: string[] | List<string>,
|
||||
name?: string
|
||||
): SassNumber;
|
||||
|
||||
/**
|
||||
* Returns a copy of this number, converted to the units represented by
|
||||
* `newNumerators` and `newDenominators`.
|
||||
*
|
||||
* Unlike [[convertToMatch]] this does *not* throw an error if this number is
|
||||
* unitless and either `newNumerators` or `newDenominators` are not empty, or
|
||||
* vice-versa. Instead, it treats all unitless numbers as convertible to and
|
||||
* from all units without changing the value.
|
||||
*
|
||||
* @throws `Error` if this number's units are incompatible with `other`'s
|
||||
* units.
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*
|
||||
* @param otherName - The name of the function argument `other` came from
|
||||
* (without the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
coerceToMatch(
|
||||
other: SassNumber,
|
||||
name?: string,
|
||||
otherName?: string
|
||||
): SassNumber;
|
||||
|
||||
/**
|
||||
* Returns [[value]], converted to the units represented by `newNumerators` and
|
||||
* `newDenominators`.
|
||||
*
|
||||
* Unlike [[convertValue]] this does *not* throw an error if this number is
|
||||
* unitless and either `newNumerators` or `newDenominators` are not empty, or
|
||||
* vice-versa. Instead, it treats all unitless numbers as convertible to and
|
||||
* from all units without changing the value.
|
||||
*
|
||||
* @throws `Error` if this number's units are incompatible with
|
||||
* `newNumerators` and `newDenominators`.
|
||||
*
|
||||
* @param newNumerators - The numerator units to convert [[value]] to. This
|
||||
* may be either a plain JavaScript array or an immutable [[List]] from the
|
||||
* [`immutable` package](https://immutable-js.com/).
|
||||
*
|
||||
* @param newDenominators - The denominator units to convert [[value]] to.
|
||||
* This may be either a plain JavaScript array or an immutable [[List]] from
|
||||
* the [`immutable` package](https://immutable-js.com/).
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
coerceValue(
|
||||
newNumerators: string[] | List<string>,
|
||||
newDenominators: string[] | List<string>,
|
||||
name?: string
|
||||
): number;
|
||||
|
||||
/**
|
||||
* Returns [[value]], converted to the units represented by `newNumerators`
|
||||
* and `newDenominators`.
|
||||
*
|
||||
* Unlike [[convertValueToMatch]] this does *not* throw an error if this
|
||||
* number is unitless and either `newNumerators` or `newDenominators` are not
|
||||
* empty, or vice-versa. Instead, it treats all unitless numbers as
|
||||
* convertible to and from all units without changing the value.
|
||||
*
|
||||
* @throws `Error` if this number's units are incompatible with `other`'s
|
||||
* units.
|
||||
*
|
||||
* @param name - The name of the function argument `this` came from (without
|
||||
* the `$`) if it came from an argument. Used for error reporting.
|
||||
*
|
||||
* @param otherName - The name of the function argument `other` came from
|
||||
* (without the `$`) if it came from an argument. Used for error reporting.
|
||||
*/
|
||||
coerceValueToMatch(
|
||||
other: SassNumber,
|
||||
name?: string,
|
||||
otherName?: string
|
||||
): number;
|
||||
}
|
84
node_modules/sass/types/value/string.d.ts
generated
vendored
Normal file
84
node_modules/sass/types/value/string.d.ts
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
import {Value} from './index';
|
||||
|
||||
/**
|
||||
* Sass's [string type](https://sass-lang.com/documentation/values/strings).
|
||||
*
|
||||
* @category Custom Function
|
||||
*/
|
||||
export class SassString extends Value {
|
||||
/**
|
||||
* Creates a new string.
|
||||
*
|
||||
* @param text - The contents of the string. For quoted strings, this is the
|
||||
* semantic content—any escape sequences that were been written in the source
|
||||
* text are resolved to their Unicode values. For unquoted strings, though,
|
||||
* escape sequences are preserved as literal backslashes.
|
||||
*
|
||||
* @param options.quotes - Whether the string is quoted. Defaults to `true`.
|
||||
*/
|
||||
constructor(
|
||||
text: string,
|
||||
options?: {
|
||||
quotes?: boolean;
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Creates an empty string.
|
||||
*
|
||||
* @param options.quotes - Whether the string is quoted. Defaults to `true`.
|
||||
*/
|
||||
constructor(options?: {quotes?: boolean});
|
||||
|
||||
/**
|
||||
* The contents of the string.
|
||||
*
|
||||
* For quoted strings, this is the semantic content—any escape sequences that
|
||||
* were been written in the source text are resolved to their Unicode values.
|
||||
* For unquoted strings, though, escape sequences are preserved as literal
|
||||
* backslashes.
|
||||
*
|
||||
* This difference allows us to distinguish between identifiers with escapes,
|
||||
* such as `url\u28 http://example.com\u29`, and unquoted strings that contain
|
||||
* characters that aren't valid in identifiers, such as
|
||||
* `url(http://example.com)`. Unfortunately, it also means that we don't
|
||||
* consider `foo` and `f\6F\6F` the same string.
|
||||
*/
|
||||
get text(): string;
|
||||
|
||||
/** Whether this string has quotes. */
|
||||
get hasQuotes(): boolean;
|
||||
|
||||
/**
|
||||
* Sass's notion of this string's length.
|
||||
*
|
||||
* Sass treats strings as a series of Unicode code points while JavaScript
|
||||
* treats them as a series of UTF-16 code units. For example, the character
|
||||
* U+1F60A SMILING FACE WITH SMILING EYES is a single Unicode code point but
|
||||
* is represented in UTF-16 as two code units (`0xD83D` and `0xDE0A`). So in
|
||||
* JavaScript, `"n😊b".length` returns `4`, whereas in Sass
|
||||
* `string.length("n😊b")` returns `3`.
|
||||
*/
|
||||
get sassLength(): number;
|
||||
|
||||
/**
|
||||
* Converts `sassIndex` to a JavaScript index into [[text]].
|
||||
*
|
||||
* Sass indices are one-based, while JavaScript indices are zero-based. Sass
|
||||
* indices may also be negative in order to index from the end of the string.
|
||||
*
|
||||
* In addition, Sass indices refer to Unicode code points while JavaScript
|
||||
* string indices refer to UTF-16 code units. For example, the character
|
||||
* U+1F60A SMILING FACE WITH SMILING EYES is a single Unicode code point but
|
||||
* is represented in UTF-16 as two code units (`0xD83D` and `0xDE0A`). So in
|
||||
* JavaScript, `"n😊b".charCodeAt(1)` returns `0xD83D`, whereas in Sass
|
||||
* `string.slice("n😊b", 1, 1)` returns `"😊"`.
|
||||
*
|
||||
* This function converts Sass's code point indices to JavaScript's code unit
|
||||
* indices. This means it's O(n) in the length of `text`.
|
||||
*
|
||||
* @throws `Error` - If `sassIndex` isn't a number, if that number isn't an
|
||||
* integer, or if that integer isn't a valid index for this string.
|
||||
*/
|
||||
sassIndexToStringIndex(sassIndex: Value, name?: string): number;
|
||||
}
|
Reference in New Issue
Block a user