mirror of
https://github.com/Instadapp/boardroom-inc-protocol-Info.git
synced 2024-07-29 22:37:02 +00:00
fix: ignore node modules
This commit is contained in:
parent
4caf18472e
commit
20edb55118
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules
|
1
node_modules/.bin/tsc
generated
vendored
1
node_modules/.bin/tsc
generated
vendored
|
@ -1 +0,0 @@
|
|||
../typescript/bin/tsc
|
1
node_modules/.bin/tsserver
generated
vendored
1
node_modules/.bin/tsserver
generated
vendored
|
@ -1 +0,0 @@
|
|||
../typescript/bin/tsserver
|
32
node_modules/.yarn-integrity
generated
vendored
32
node_modules/.yarn-integrity
generated
vendored
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"systemParams": "darwin-x64-88",
|
||||
"modulesFolders": [
|
||||
"node_modules"
|
||||
],
|
||||
"flags": [],
|
||||
"linkedModules": [
|
||||
"@boardroom/proposal-comments",
|
||||
"@boardroom/sdk"
|
||||
],
|
||||
"topLevelPatterns": [
|
||||
"@rollup/plugin-typescript@^8.1.1",
|
||||
"tslib@^2.1.0",
|
||||
"typescript@^4.1.3"
|
||||
],
|
||||
"lockfileEntries": {
|
||||
"@rollup/plugin-typescript@^8.1.1": "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.1.1.tgz#cadd6c381a92cc7e8148cc8b1eeba146020635d0",
|
||||
"@rollup/pluginutils@^3.1.0": "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b",
|
||||
"@types/estree@0.0.39": "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f",
|
||||
"estree-walker@^1.0.1": "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700",
|
||||
"function-bind@^1.1.1": "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d",
|
||||
"has@^1.0.3": "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796",
|
||||
"is-core-module@^2.1.0": "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a",
|
||||
"path-parse@^1.0.6": "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c",
|
||||
"picomatch@^2.2.2": "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad",
|
||||
"resolve@^1.17.0": "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c",
|
||||
"tslib@^2.1.0": "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a",
|
||||
"typescript@^4.1.3": "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7"
|
||||
},
|
||||
"files": [],
|
||||
"artifacts": {}
|
||||
}
|
346
node_modules/@rollup/plugin-typescript/CHANGELOG.md
generated
vendored
346
node_modules/@rollup/plugin-typescript/CHANGELOG.md
generated
vendored
|
@ -1,346 +0,0 @@
|
|||
# @rollup/plugin-typescript ChangeLog
|
||||
|
||||
## v8.1.1
|
||||
|
||||
_2021-01-29_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: fix plugin type declarations (#647)
|
||||
- fix: only emit tsbuildinfo file when there is something to emit (#771)
|
||||
|
||||
## v8.1.0
|
||||
|
||||
_2020-12-14_
|
||||
|
||||
### Features
|
||||
|
||||
- feat: support multiple output targets with declarations (#687)
|
||||
|
||||
### Updates
|
||||
|
||||
- chore: fix TypeScript warnings (#673)
|
||||
- test: code in src sub-directory (#682)
|
||||
- chore: use TypeScript 4 (#674)
|
||||
|
||||
## v8.0.0
|
||||
|
||||
_2020-11-30_
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- fix: pick up new files in watch mode (#657)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: add missing imports (#633)
|
||||
- fix: normalize returned module ids (#653)
|
||||
|
||||
### Features
|
||||
|
||||
- feat: Implement cached incremental code (#535)
|
||||
|
||||
### Updates
|
||||
|
||||
- docs: fix minor markdown syntax in transformers-section (#624)
|
||||
|
||||
## v7.0.0
|
||||
|
||||
_2020-11-30_
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- fix: pick up new files in watch mode (#657)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: add missing imports (#633)
|
||||
- fix: normalize returned module ids (#653)
|
||||
|
||||
### Features
|
||||
|
||||
- feat: Implement cached incremental code (#535)
|
||||
|
||||
### Updates
|
||||
|
||||
- docs: fix minor markdown syntax in transformers-section (#624)
|
||||
|
||||
## v6.1.0
|
||||
|
||||
_2020-10-27_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: add composite to validation checks (#618)
|
||||
|
||||
### Features
|
||||
|
||||
- feat: Add CustomTransformers support (#280)
|
||||
|
||||
### Updates
|
||||
|
||||
- docs: More informative error messages (#619)
|
||||
|
||||
## v6.0.0
|
||||
|
||||
_2020-09-09_
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- fix!: Change `noEmitOnError` default to false (#544)
|
||||
|
||||
### Updates
|
||||
|
||||
- test: add generating declarations with non-default rootDir (#553)
|
||||
- chore: update dependencies (9e52818)
|
||||
|
||||
## v5.0.2
|
||||
|
||||
_2020-07-12_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: utilize 'this.meta.watchMode' (#449)
|
||||
|
||||
### Updates
|
||||
|
||||
- chore: linting update (410ceb8)
|
||||
|
||||
## v5.0.1
|
||||
|
||||
_2020-06-28_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: load empty emitted files (#476)
|
||||
|
||||
## v5.0.0
|
||||
|
||||
_2020-06-22_
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- fix!: sync rollup and typescript file watch (#425)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: Fix peer dep version (#461)
|
||||
|
||||
## v4.1.2
|
||||
|
||||
_2020-05-20_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: memory leak. fixes #322 (#352)
|
||||
|
||||
### Updates
|
||||
|
||||
- docs: update readme examples (#391)
|
||||
- docs: update link to @rollup/plugin-babel in README.md (#372)
|
||||
|
||||
## v4.1.1
|
||||
|
||||
_2020-04-12_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: sourcemap generated as null (#276)
|
||||
- fix: use parsedOptions.fileNames for emit declaration files (#270) (#271)
|
||||
|
||||
## v4.1.0
|
||||
|
||||
_2020-04-12_
|
||||
|
||||
### Features
|
||||
|
||||
- feat: Refine options interface (#284)
|
||||
|
||||
## v4.0.0
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: Use builtin extends resolution (#199)
|
||||
|
||||
### Features
|
||||
|
||||
- feat: Move to BuilderProgram API (#217)
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
Please see https://github.com/rollup/plugins/pull/217 for more information.
|
||||
|
||||
## v3.1.0
|
||||
|
||||
_2020-03-05_
|
||||
|
||||
_Note: This was a bad release due to breaking changes. v3.1.1 has been published to revert the latest 3.x.x version to a non-breaking state. For the changes in this erroneous version, please use v4.0.0._
|
||||
|
||||
### Updates
|
||||
|
||||
- test: Add preserveModules test (#234)
|
||||
- chore: refactor compiler host (#214)
|
||||
- test: Add test for optional chaining (#207)
|
||||
- chore: Use typechecking (4bb8753)
|
||||
|
||||
## v3.0.0
|
||||
|
||||
_2020-01-27_
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- feat: Add typechecking! (#177)
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: extended config file path (#157)
|
||||
|
||||
### Updates
|
||||
|
||||
- core: Add note about old behaviour (#181)
|
||||
- chore: Always use ParsedCommandLine (#162)
|
||||
- chore: update devDeps (96c45ff)
|
||||
- chore: Remove resolveHost (#148)
|
||||
|
||||
## v2.1.0
|
||||
|
||||
_2020-01-07_
|
||||
|
||||
### Features
|
||||
|
||||
- feat: Warning objects for type errors (#144)
|
||||
- feat: Find tslib asynchronously (#131)
|
||||
|
||||
### Updates
|
||||
|
||||
- chore: Use ts.findConfigFile helper (#145)
|
||||
|
||||
## v2.0.2
|
||||
|
||||
_2020-01-04_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: Use this.warn for ts errors (#129)
|
||||
|
||||
### Updates
|
||||
|
||||
- refactor: use typescript in typescript plugin (#122)
|
||||
- chore: update changelog (b723f92)
|
||||
- chore: misc linting updates (4de10f0)
|
||||
|
||||
## 2.0.1
|
||||
|
||||
_2019-12-04_
|
||||
|
||||
- fix(typescript): import from scoped utils (#78)
|
||||
|
||||
## 2.0.0
|
||||
|
||||
_2019-11-25_
|
||||
|
||||
- **Breaking:** Minimum compatible Rollup version is 1.20.0
|
||||
- **Breaking:** Minimum supported Node version is 8.0.0
|
||||
- Published as @rollup/plugin-typescript
|
||||
|
||||
## 1.0.1
|
||||
|
||||
_2019-03-24_
|
||||
|
||||
- Update dependencies ([#136](https://github.com/rollup/rollup-plugin-typescript/issues/136))
|
||||
|
||||
## 1.0.0
|
||||
|
||||
_2018-09-16_
|
||||
|
||||
- Major update for TypeScript 2/3, Rollup 1 compatibility, lots of fixes ([#124](https://github.com/rollup/rollup-plugin-typescript/issues/124))
|
||||
- Require TypeScript as peer dependency ([#121](https://github.com/rollup/rollup-plugin-typescript/issues/121))
|
||||
- Also test on Node 10 ([#119](https://github.com/rollup/rollup-plugin-typescript/issues/119))
|
||||
- Fix example in readme ([#98](https://github.com/rollup/rollup-plugin-typescript/issues/98))
|
||||
|
||||
## 0.8.1
|
||||
|
||||
- Ignore typescript-helpers in source maps ([#61](https://github.com/rollup/rollup-plugin-typescript/issues/61))
|
||||
|
||||
## 0.8.0
|
||||
|
||||
- Fix the rollup breaking change with paths ([#52](https://github.com/rollup/rollup-plugin-typescript/issues/52))
|
||||
- Don't fail without source maps ([#57](https://github.com/rollup/rollup-plugin-typescript/pull/57))
|
||||
|
||||
## 0.7.7
|
||||
|
||||
- Add missing `__assign` helper ([#49](https://github.com/rollup/rollup-plugin-typescript/issues/49))
|
||||
|
||||
## 0.7.6
|
||||
|
||||
- Ignore the `declaration` option ([#45](https://github.com/rollup/rollup-plugin-typescript/issues/45))
|
||||
- Disable `strictNullChecks` with a warning for TypeScript versions that don't support it ([#46](https://github.com/rollup/rollup-plugin-typescript/issues/46))
|
||||
|
||||
## 0.7.5
|
||||
|
||||
- Ensure NPM doesn't ignore typescript-helpers
|
||||
|
||||
## 0.7.4
|
||||
|
||||
- Resolve typescript-helpers to a file in the filesystem.
|
||||
|
||||
## 0.7.3
|
||||
|
||||
- Update Tippex to ^2.1.1
|
||||
|
||||
## 0.7.2
|
||||
|
||||
- Don't error if both `sourceMap` and `inlineSourceMap` are specified
|
||||
|
||||
## 0.7.1
|
||||
|
||||
- No plugin specific options should be forwarded to TypeScript
|
||||
|
||||
## 0.7.0
|
||||
|
||||
- Use `compilerOptions` from `tsconfig.json` if found ([#39](https://github.com/rollup/rollup-plugin-typescript/pull/32))
|
||||
|
||||
## 0.6.1
|
||||
|
||||
- Upgrade Tippex to ^2.1.0
|
||||
- Upgrade TypeScript to ^1.8.9
|
||||
|
||||
## 0.6.0
|
||||
|
||||
- Upgrade to TypeScript ^1.8.7
|
||||
- Update `__awaiter` helper to support TypeScript 1.8.x ([#32](https://github.com/rollup/rollup-plugin-typescript/pull/32))
|
||||
- Update `ts.nodeModuleNameResolver` to support both 1.7.x and 1.8.x ([#31](https://github.com/rollup/rollup-plugin-typescript/issues/31))
|
||||
|
||||
## 0.5.0
|
||||
|
||||
- Do not duplicate TypeScript's helpers ([#24](https://github.com/rollup/rollup-plugin-typescript/issues/24))
|
||||
- Handle `export abstract class` ([#23](https://github.com/rollup/rollup-plugin-typescript/issues/23))
|
||||
|
||||
## 0.4.1
|
||||
|
||||
- Does not attempt resolve or transform `.d.ts` files ([#22](https://github.com/rollup/rollup-plugin-typescript/pull/22))
|
||||
|
||||
## 0.4.0
|
||||
|
||||
- Work around TypeScript 1.7.5's transpilation issues ([#9](https://github.com/rollup/rollup-plugin-typescript/issues/9))
|
||||
- Overridable TypeScript version when transpiling ([#4](https://github.com/rollup/rollup-plugin-typescript/issues/4))
|
||||
- Add `jsx` support ([#11](https://github.com/rollup/rollup-plugin-typescript/issues/11))
|
||||
|
||||
## 0.3.0
|
||||
|
||||
- Author plugin in TypeScript
|
||||
- Report diagnostics
|
||||
- Resolve identifiers using `ts.nodeModuleNameResolver`
|
||||
|
||||
## 0.2.1
|
||||
|
||||
- Upgrade to TypeScript ^1.7.5
|
||||
- Enable source maps per default
|
||||
|
||||
## 0.2.0
|
||||
|
||||
- Use (_prerelease version of_) TypeScript 1.7.0 to generate ES5 while preserving ES2015 imports for efficient bundling.
|
||||
|
||||
## 0.1.0
|
||||
|
||||
- Initial release
|
21
node_modules/@rollup/plugin-typescript/LICENSE
generated
vendored
21
node_modules/@rollup/plugin-typescript/LICENSE
generated
vendored
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)
|
||||
|
||||
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.
|
286
node_modules/@rollup/plugin-typescript/README.md
generated
vendored
286
node_modules/@rollup/plugin-typescript/README.md
generated
vendored
|
@ -1,286 +0,0 @@
|
|||
[npm]: https://img.shields.io/npm/v/@rollup/plugin-typescript
|
||||
[npm-url]: https://www.npmjs.com/package/@rollup/plugin-typescript
|
||||
[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-typescript
|
||||
[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-typescript
|
||||
|
||||
[![npm][npm]][npm-url]
|
||||
[![size][size]][size-url]
|
||||
[](https://liberamanifesto.com)
|
||||
|
||||
# @rollup/plugin-typescript
|
||||
|
||||
🍣 A Rollup plugin for seamless integration between Rollup and Typescript.
|
||||
|
||||
## Requirements
|
||||
|
||||
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.0.0+) and Rollup v1.20.0+. This plugin also requires at least [TypeScript 3.4](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html).
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```console
|
||||
npm install @rollup/plugin-typescript --save-dev
|
||||
```
|
||||
|
||||
Note that both `typescript` and `tslib` are peer dependencies of this plugin that need to be installed separately.
|
||||
|
||||
## Why?
|
||||
|
||||
See [@rollup/plugin-babel](https://github.com/rollup/plugins/tree/master/packages/babel).
|
||||
|
||||
## Usage
|
||||
|
||||
Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:
|
||||
|
||||
```js
|
||||
// rollup.config.js
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
|
||||
export default {
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
dir: 'output',
|
||||
format: 'cjs'
|
||||
},
|
||||
plugins: [typescript()]
|
||||
};
|
||||
```
|
||||
|
||||
Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).
|
||||
|
||||
## Options
|
||||
|
||||
The plugin loads any [`compilerOptions`](http://www.typescriptlang.org/docs/handbook/compiler-options.html) from the `tsconfig.json` file by default. Passing options to the plugin directly overrides those options:
|
||||
|
||||
```js
|
||||
...
|
||||
export default {
|
||||
input: './main.ts',
|
||||
plugins: [
|
||||
typescript({lib: ["es5", "es6", "dom"], target: "es5"})
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The following options are unique to `rollup-plugin-typescript`:
|
||||
|
||||
### `exclude`
|
||||
|
||||
Type: `String` | `Array[...String]`<br>
|
||||
Default: `null`
|
||||
|
||||
A [minimatch pattern](https://github.com/isaacs/minimatch), or array of patterns, which specifies the files in the build the plugin should _ignore_. By default no files are ignored.
|
||||
|
||||
### `include`
|
||||
|
||||
Type: `String` | `Array[...String]`<br>
|
||||
Default: `null`
|
||||
|
||||
A [minimatch pattern](https://github.com/isaacs/minimatch), or array of patterns, which specifies the files in the build the plugin should operate on. By default all `.ts` and `.tsx` files are targeted.
|
||||
|
||||
### `tsconfig`
|
||||
|
||||
Type: `String` | `Boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
When set to false, ignores any options specified in the config file. If set to a string that corresponds to a file path, the specified file will be used as config file.
|
||||
|
||||
### `typescript`
|
||||
|
||||
Type: `import('typescript')`<br>
|
||||
Default: _peer dependency_
|
||||
|
||||
Overrides the TypeScript module used for transpilation.
|
||||
|
||||
```js
|
||||
typescript({
|
||||
typescript: require('some-fork-of-typescript')
|
||||
});
|
||||
```
|
||||
|
||||
### `tslib`
|
||||
|
||||
Type: `String`<br>
|
||||
Default: _peer dependency_
|
||||
|
||||
Overrides the injected TypeScript helpers with a custom version.
|
||||
|
||||
```js
|
||||
typescript({
|
||||
tslib: require.resolve('some-fork-of-tslib')
|
||||
});
|
||||
```
|
||||
|
||||
### `transformers`
|
||||
|
||||
Type: `{ [before | after | afterDeclarations]: TransformerFactory[] }`<br>
|
||||
Default: `undefined`
|
||||
|
||||
Allows registration of TypeScript custom transformers at any of the supported stages:
|
||||
|
||||
- **before**: transformers will execute before the TypeScript's own transformers on raw TypeScript files
|
||||
- **after**: transformers will execute after the TypeScript transformers on transpiled code
|
||||
- **afterDeclarations**: transformers will execute after declaration file generation allowing to modify existing declaration files
|
||||
|
||||
Supported transformer factories:
|
||||
|
||||
- all **built-in** TypeScript custom transformer factories:
|
||||
|
||||
- `import('typescript').TransformerFactory` annotated **TransformerFactory** bellow
|
||||
- `import('typescript').CustomTransformerFactory` annotated **CustomTransformerFactory** bellow
|
||||
|
||||
- **ProgramTransformerFactory** represents a transformer factory allowing the resulting transformer to grab a reference to the **Program** instance
|
||||
|
||||
```js
|
||||
{
|
||||
type: 'program',
|
||||
factory: (program: Program) => TransformerFactory | CustomTransformerFactory
|
||||
}
|
||||
```
|
||||
|
||||
- **TypeCheckerTransformerFactory** represents a transformer factory allowing the resulting transformer to grab a reference to the **TypeChecker** instance
|
||||
```js
|
||||
{
|
||||
type: 'typeChecker',
|
||||
factory: (typeChecker: TypeChecker) => TransformerFactory | CustomTransformerFactory
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
typescript({
|
||||
transformers: {
|
||||
before: [
|
||||
{
|
||||
// Allow the transformer to get a Program reference in it's factory
|
||||
type: 'program',
|
||||
factory: program => {
|
||||
return ProgramRequiringTransformerFactory(program);
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'typeChecker',
|
||||
factory: typeChecker => {
|
||||
// Allow the transformer to get a Program reference in it's factory
|
||||
return TypeCheckerRequiringTransformerFactory(program);
|
||||
}
|
||||
}
|
||||
],
|
||||
after: [
|
||||
// You can use normal transformers directly
|
||||
require('custom-transformer-based-on-Context')
|
||||
],
|
||||
afterDeclarations: [
|
||||
// Or even define in place
|
||||
function fixDeclarationFactory(context) {
|
||||
return function fixDeclaration(source) {
|
||||
function visitor(node) {
|
||||
// Do real work here
|
||||
|
||||
return ts.visitEachChild(node, visitor, context);
|
||||
}
|
||||
|
||||
return ts.visitEachChild(source, visitor, context);
|
||||
};
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### `cacheDir`
|
||||
|
||||
Type: `String`<br>
|
||||
Default: _.rollup.cache_
|
||||
|
||||
When compiling with `incremental` or `composite` options the plugin will
|
||||
store compiled files in this folder. This allows the use of incremental
|
||||
compilation.
|
||||
|
||||
```js
|
||||
typescript({
|
||||
cacheDir: '.rollup.tscache'
|
||||
});
|
||||
```
|
||||
|
||||
### Typescript compiler options
|
||||
|
||||
Some of Typescript's [CompilerOptions](https://www.typescriptlang.org/docs/handbook/compiler-options.html) affect how Rollup builds files.
|
||||
|
||||
#### `noEmitOnError`
|
||||
|
||||
Type: `Boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
If a type error is detected, the Rollup build is aborted when this option is set to true.
|
||||
|
||||
#### `files`, `include`, `exclude`
|
||||
|
||||
Type: `Array[...String]`<br>
|
||||
Default: `[]`
|
||||
|
||||
Declaration files are automatically included if they are listed in the `files` field in your `tsconfig.json` file. Source files in these fields are ignored as Rollup's configuration is used instead.
|
||||
|
||||
#### Ignored options
|
||||
|
||||
These compiler options are ignored by Rollup:
|
||||
|
||||
- `noEmitHelpers`, `importHelpers`: The `tslib` helper module always must be used.
|
||||
- `noEmit`, `emitDeclarationOnly`: Typescript needs to emit code for the plugin to work with.
|
||||
- `noResolve`: Preventing Typescript from resolving code may break compilation
|
||||
|
||||
### Importing CommonJS
|
||||
|
||||
Though it is not recommended, it is possible to configure this plugin to handle imports of CommonJS files from TypeScript. For this, you need to specify `CommonJS` as the module format and add `rollup-plugin-commonjs` to transpile the CommonJS output generated by TypeScript to ES Modules so that rollup can process it.
|
||||
|
||||
```js
|
||||
// rollup.config.js
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
|
||||
export default {
|
||||
input: './main.ts',
|
||||
plugins: [
|
||||
typescript({ module: 'CommonJS' }),
|
||||
commonjs({ extensions: ['.js', '.ts'] }) // the ".ts" extension is required
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
Note that this will often result in less optimal output.
|
||||
|
||||
### Preserving JSX output
|
||||
|
||||
Whenever choosing to preserve JSX output to be further consumed by another transform step via `tsconfig` `compilerOptions` by setting `jsx: 'preserve'` or [overriding options](#options), please bear in mind that, by itself, this plugin won't be able to preserve JSX output, usually failing with:
|
||||
|
||||
```sh
|
||||
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
|
||||
file.tsx (1:15)
|
||||
1: export default <span>Foobar</span>
|
||||
^
|
||||
```
|
||||
|
||||
To prevent that, make sure to use the acorn plugin, namely `acorn-jsx`, which will make Rollup's parser acorn handle JSX tokens. (See https://rollupjs.org/guide/en/#acorninjectplugins)
|
||||
|
||||
After adding `acorn-jsx` plugin, your Rollup config would look like the following, correctly preserving your JSX output.
|
||||
|
||||
```js
|
||||
import jsx from 'acorn-jsx';
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
|
||||
export default {
|
||||
// … other options …
|
||||
acornInjectPlugins: [jsx()],
|
||||
plugins: [typescript({ jsx: 'preserve' })]
|
||||
};
|
||||
```
|
||||
|
||||
### Faster compiling
|
||||
|
||||
Previous versions of this plugin used Typescript's `transpileModule` API, which is faster but does not perform typechecking and does not support cross-file features like `const enum`s and emit-less types. If you want this behaviour, you can use [@rollup/plugin-sucrase](https://github.com/rollup/plugins/tree/master/packages/sucrase) instead.
|
||||
|
||||
## Meta
|
||||
|
||||
[CONTRIBUTING](/.github/CONTRIBUTING.md)
|
||||
|
||||
[LICENSE (MIT)](/LICENSE)
|
750
node_modules/@rollup/plugin-typescript/dist/index.es.js
generated
vendored
750
node_modules/@rollup/plugin-typescript/dist/index.es.js
generated
vendored
|
@ -1,750 +0,0 @@
|
|||
import path, { resolve, dirname, relative, win32, posix, normalize } from 'path';
|
||||
import { createFilter } from '@rollup/pluginutils';
|
||||
import * as defaultTs from 'typescript';
|
||||
import { DiagnosticCategory } from 'typescript';
|
||||
import resolveId from 'resolve';
|
||||
import fs, { readFileSync } from 'fs';
|
||||
|
||||
/**
|
||||
* Create a format diagnostics host to use with the Typescript type checking APIs.
|
||||
* Typescript hosts are used to represent the user's system,
|
||||
* with an API for checking case sensitivity etc.
|
||||
* @param compilerOptions Typescript compiler options. Affects functions such as `getNewLine`.
|
||||
* @see https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
|
||||
*/
|
||||
function createFormattingHost(ts, compilerOptions) {
|
||||
return {
|
||||
/** Returns the compiler options for the project. */
|
||||
getCompilationSettings: () => compilerOptions,
|
||||
/** Returns the current working directory. */
|
||||
getCurrentDirectory: () => process.cwd(),
|
||||
/** Returns the string that corresponds with the selected `NewLineKind`. */
|
||||
getNewLine() {
|
||||
switch (compilerOptions.newLine) {
|
||||
case ts.NewLineKind.CarriageReturnLineFeed:
|
||||
return '\r\n';
|
||||
case ts.NewLineKind.LineFeed:
|
||||
return '\n';
|
||||
default:
|
||||
return ts.sys.newLine;
|
||||
}
|
||||
},
|
||||
/** Returns a lower case name on case insensitive systems, otherwise the original name. */
|
||||
getCanonicalFileName: (fileName) => ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase()
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a helper for resolving modules using Typescript.
|
||||
* @param host Typescript host that extends `ModuleResolutionHost`
|
||||
* with methods for sanitizing filenames and getting compiler options.
|
||||
*/
|
||||
function createModuleResolver(ts, host) {
|
||||
const compilerOptions = host.getCompilationSettings();
|
||||
const cache = ts.createModuleResolutionCache(process.cwd(), host.getCanonicalFileName, compilerOptions);
|
||||
const moduleHost = Object.assign(Object.assign({}, ts.sys), host);
|
||||
return (moduleName, containingFile) => {
|
||||
const resolved = ts.nodeModuleNameResolver(moduleName, containingFile, compilerOptions, moduleHost, cache);
|
||||
return resolved.resolvedModule;
|
||||
};
|
||||
}
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
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.
|
||||
***************************************************************************** */
|
||||
|
||||
function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
const resolveIdAsync = (file, opts) => new Promise((fulfil, reject) => resolveId(file, opts, (err, contents) => (err || typeof contents === 'undefined' ? reject(err) : fulfil(contents))));
|
||||
/**
|
||||
* Returns code asynchronously for the tslib helper library.
|
||||
*/
|
||||
function getTsLibPath() {
|
||||
return resolveIdAsync('tslib/tslib.es6.js', { basedir: __dirname });
|
||||
}
|
||||
|
||||
/**
|
||||
* Separate the Rollup plugin options from the Typescript compiler options,
|
||||
* and normalize the Rollup options.
|
||||
* @returns Object with normalized options:
|
||||
* - `filter`: Checks if a file should be included.
|
||||
* - `tsconfig`: Path to a tsconfig, or directive to ignore tsconfig.
|
||||
* - `compilerOptions`: Custom Typescript compiler options that override tsconfig.
|
||||
* - `typescript`: Instance of Typescript library (possibly custom).
|
||||
* - `tslib`: ESM code from the tslib helper library (possibly custom).
|
||||
*/
|
||||
function getPluginOptions(options) {
|
||||
const { cacheDir, exclude, include, transformers, tsconfig, tslib, typescript } = options, compilerOptions = __rest(options, ["cacheDir", "exclude", "include", "transformers", "tsconfig", "tslib", "typescript"]);
|
||||
const filter = createFilter(include || ['*.ts+(|x)', '**/*.ts+(|x)'], exclude);
|
||||
return {
|
||||
cacheDir,
|
||||
filter,
|
||||
tsconfig,
|
||||
compilerOptions: compilerOptions,
|
||||
typescript: typescript || defaultTs,
|
||||
tslib: tslib || getTsLibPath(),
|
||||
transformers
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Typescript type error into an equivalent Rollup warning object.
|
||||
*/
|
||||
function diagnosticToWarning(ts, host, diagnostic) {
|
||||
const pluginCode = `TS${diagnostic.code}`;
|
||||
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
// Build a Rollup warning object from the diagnostics object.
|
||||
const warning = {
|
||||
pluginCode,
|
||||
message: `@rollup/plugin-typescript ${pluginCode}: ${message}`
|
||||
};
|
||||
if (diagnostic.file) {
|
||||
// Add information about the file location
|
||||
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
warning.loc = {
|
||||
column: character + 1,
|
||||
line: line + 1,
|
||||
file: diagnostic.file.fileName
|
||||
};
|
||||
if (host) {
|
||||
// Extract a code frame from Typescript
|
||||
const formatted = ts.formatDiagnosticsWithColorAndContext([diagnostic], host);
|
||||
// Typescript only exposes this formatter as a string prefixed with the flattened message.
|
||||
// We need to remove it here since Rollup treats the properties as separate parts.
|
||||
let frame = formatted.slice(formatted.indexOf(message) + message.length);
|
||||
const newLine = host.getNewLine();
|
||||
if (frame.startsWith(newLine)) {
|
||||
frame = frame.slice(frame.indexOf(newLine) + newLine.length);
|
||||
}
|
||||
warning.frame = frame;
|
||||
}
|
||||
}
|
||||
return warning;
|
||||
}
|
||||
|
||||
const DEFAULT_COMPILER_OPTIONS = {
|
||||
module: 'esnext',
|
||||
skipLibCheck: true
|
||||
};
|
||||
const FORCED_COMPILER_OPTIONS = {
|
||||
// Always use tslib
|
||||
noEmitHelpers: true,
|
||||
importHelpers: true,
|
||||
// Typescript needs to emit the code for us to work with
|
||||
noEmit: false,
|
||||
emitDeclarationOnly: false,
|
||||
// Preventing Typescript from resolving code may break compilation
|
||||
noResolve: false
|
||||
};
|
||||
|
||||
/* eslint-disable no-param-reassign */
|
||||
const DIRECTORY_PROPS = ['outDir', 'declarationDir'];
|
||||
/**
|
||||
* Mutates the compiler options to convert paths from relative to absolute.
|
||||
* This should be used with compiler options passed through the Rollup plugin options,
|
||||
* not those found from loading a tsconfig.json file.
|
||||
* @param compilerOptions Compiler options to _mutate_.
|
||||
* @param relativeTo Paths are resolved relative to this path.
|
||||
*/
|
||||
function makePathsAbsolute(compilerOptions, relativeTo) {
|
||||
for (const pathProp of DIRECTORY_PROPS) {
|
||||
if (compilerOptions[pathProp]) {
|
||||
compilerOptions[pathProp] = resolve(relativeTo, compilerOptions[pathProp]);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Mutates the compiler options to normalize some values for Rollup.
|
||||
* @param compilerOptions Compiler options to _mutate_.
|
||||
* @returns True if the source map compiler option was not initially set.
|
||||
*/
|
||||
function normalizeCompilerOptions(ts, compilerOptions) {
|
||||
let autoSetSourceMap = false;
|
||||
if (compilerOptions.inlineSourceMap) {
|
||||
// Force separate source map files for Rollup to work with.
|
||||
compilerOptions.sourceMap = true;
|
||||
compilerOptions.inlineSourceMap = false;
|
||||
}
|
||||
else if (typeof compilerOptions.sourceMap !== 'boolean') {
|
||||
// Default to using source maps.
|
||||
// If the plugin user sets sourceMap to false we keep that option.
|
||||
compilerOptions.sourceMap = true;
|
||||
// Using inlineSources to make sure typescript generate source content
|
||||
// instead of source path.
|
||||
compilerOptions.inlineSources = true;
|
||||
autoSetSourceMap = true;
|
||||
}
|
||||
switch (compilerOptions.module) {
|
||||
case ts.ModuleKind.ES2015:
|
||||
case ts.ModuleKind.ESNext:
|
||||
case ts.ModuleKind.CommonJS:
|
||||
// OK module type
|
||||
return autoSetSourceMap;
|
||||
case ts.ModuleKind.None:
|
||||
case ts.ModuleKind.AMD:
|
||||
case ts.ModuleKind.UMD:
|
||||
case ts.ModuleKind.System: {
|
||||
// Invalid module type
|
||||
const moduleType = ts.ModuleKind[compilerOptions.module];
|
||||
throw new Error(`@rollup/plugin-typescript: The module kind should be 'ES2015' or 'ESNext, found: '${moduleType}'`);
|
||||
}
|
||||
default:
|
||||
// Unknown or unspecified module type, force ESNext
|
||||
compilerOptions.module = ts.ModuleKind.ESNext;
|
||||
}
|
||||
return autoSetSourceMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the tsconfig file relative to the current working directory.
|
||||
* @param relativePath Relative tsconfig path given by the user.
|
||||
* If `false` is passed, then a null path is returned.
|
||||
* @returns The absolute path, or null if the file does not exist.
|
||||
*/
|
||||
function getTsConfigPath(ts, relativePath) {
|
||||
if (relativePath === false)
|
||||
return null;
|
||||
// Resolve path to file. `tsConfigOption` defaults to 'tsconfig.json'.
|
||||
const tsConfigPath = resolve(process.cwd(), relativePath || 'tsconfig.json');
|
||||
if (!ts.sys.fileExists(tsConfigPath)) {
|
||||
if (relativePath) {
|
||||
// If an explicit path was provided but no file was found, throw
|
||||
throw new Error(`Could not find specified tsconfig.json at ${tsConfigPath}`);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return tsConfigPath;
|
||||
}
|
||||
/**
|
||||
* Tries to read the tsconfig file at `tsConfigPath`.
|
||||
* @param tsConfigPath Absolute path to tsconfig JSON file.
|
||||
* @param explicitPath If true, the path was set by the plugin user.
|
||||
* If false, the path was computed automatically.
|
||||
*/
|
||||
function readTsConfigFile(ts, tsConfigPath) {
|
||||
const { config, error } = ts.readConfigFile(tsConfigPath, (path) => readFileSync(path, 'utf8'));
|
||||
if (error) {
|
||||
throw Object.assign(Error(), diagnosticToWarning(ts, null, error));
|
||||
}
|
||||
return config || {};
|
||||
}
|
||||
/**
|
||||
* Returns true if any of the `compilerOptions` contain an enum value (i.e.: ts.ScriptKind) rather than a string.
|
||||
* This indicates that the internal CompilerOptions type is used rather than the JsonCompilerOptions.
|
||||
*/
|
||||
function containsEnumOptions(compilerOptions) {
|
||||
const enums = [
|
||||
'module',
|
||||
'target',
|
||||
'jsx',
|
||||
'moduleResolution',
|
||||
'newLine'
|
||||
];
|
||||
return enums.some((prop) => prop in compilerOptions && typeof compilerOptions[prop] === 'number');
|
||||
}
|
||||
const configCache = new Map();
|
||||
/**
|
||||
* Parse the Typescript config to use with the plugin.
|
||||
* @param ts Typescript library instance.
|
||||
* @param tsconfig Path to the tsconfig file, or `false` to ignore the file.
|
||||
* @param compilerOptions Options passed to the plugin directly for Typescript.
|
||||
*
|
||||
* @returns Parsed tsconfig.json file with some important properties:
|
||||
* - `options`: Parsed compiler options.
|
||||
* - `fileNames` Type definition files that should be included in the build.
|
||||
* - `errors`: Any errors from parsing the config file.
|
||||
*/
|
||||
function parseTypescriptConfig(ts, tsconfig, compilerOptions) {
|
||||
/* eslint-disable no-undefined */
|
||||
const cwd = process.cwd();
|
||||
makePathsAbsolute(compilerOptions, cwd);
|
||||
let parsedConfig;
|
||||
// Resolve path to file. If file is not found, pass undefined path to `parseJsonConfigFileContent`.
|
||||
// eslint-disable-next-line no-undefined
|
||||
const tsConfigPath = getTsConfigPath(ts, tsconfig) || undefined;
|
||||
const tsConfigFile = tsConfigPath ? readTsConfigFile(ts, tsConfigPath) : {};
|
||||
const basePath = tsConfigPath ? dirname(tsConfigPath) : cwd;
|
||||
// If compilerOptions has enums, it represents an CompilerOptions object instead of parsed JSON.
|
||||
// This determines where the data is passed to the parser.
|
||||
if (containsEnumOptions(compilerOptions)) {
|
||||
parsedConfig = ts.parseJsonConfigFileContent(Object.assign(Object.assign({}, tsConfigFile), { compilerOptions: Object.assign(Object.assign({}, DEFAULT_COMPILER_OPTIONS), tsConfigFile.compilerOptions) }), ts.sys, basePath, Object.assign(Object.assign({}, compilerOptions), FORCED_COMPILER_OPTIONS), tsConfigPath, undefined, undefined, configCache);
|
||||
}
|
||||
else {
|
||||
parsedConfig = ts.parseJsonConfigFileContent(Object.assign(Object.assign({}, tsConfigFile), { compilerOptions: Object.assign(Object.assign(Object.assign({}, DEFAULT_COMPILER_OPTIONS), tsConfigFile.compilerOptions), compilerOptions) }), ts.sys, basePath, FORCED_COMPILER_OPTIONS, tsConfigPath, undefined, undefined, configCache);
|
||||
}
|
||||
const autoSetSourceMap = normalizeCompilerOptions(ts, parsedConfig.options);
|
||||
return Object.assign(Object.assign({}, parsedConfig), { autoSetSourceMap });
|
||||
}
|
||||
/**
|
||||
* If errors are detected in the parsed options,
|
||||
* display all of them as warnings then emit an error.
|
||||
*/
|
||||
function emitParsedOptionsErrors(ts, context, parsedOptions) {
|
||||
if (parsedOptions.errors.length > 0) {
|
||||
parsedOptions.errors.forEach((error) => context.warn(diagnosticToWarning(ts, null, error)));
|
||||
context.error(`@rollup/plugin-typescript: Couldn't process compiler options`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that the `compilerOptions.sourceMap` option matches `outputOptions.sourcemap`.
|
||||
* @param context Rollup plugin context used to emit warnings.
|
||||
* @param compilerOptions Typescript compiler options.
|
||||
* @param outputOptions Rollup output options.
|
||||
* @param autoSetSourceMap True if the `compilerOptions.sourceMap` property was set to `true`
|
||||
* by the plugin, not the user.
|
||||
*/
|
||||
function validateSourceMap(context, compilerOptions, outputOptions, autoSetSourceMap) {
|
||||
if (compilerOptions.sourceMap && !outputOptions.sourcemap && !autoSetSourceMap) {
|
||||
context.warn(`@rollup/plugin-typescript: Rollup 'sourcemap' option must be set to generate source maps.`);
|
||||
}
|
||||
else if (!compilerOptions.sourceMap && outputOptions.sourcemap) {
|
||||
context.warn(`@rollup/plugin-typescript: Typescript 'sourceMap' compiler option must be set to generate source maps.`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Validate that the out directory used by Typescript can be controlled by Rollup.
|
||||
* @param context Rollup plugin context used to emit errors.
|
||||
* @param compilerOptions Typescript compiler options.
|
||||
* @param outputOptions Rollup output options.
|
||||
*/
|
||||
function validatePaths(ts, context, compilerOptions, outputOptions) {
|
||||
if (compilerOptions.out) {
|
||||
context.error(`@rollup/plugin-typescript: Deprecated Typescript compiler option 'out' is not supported. Use 'outDir' instead.`);
|
||||
}
|
||||
else if (compilerOptions.outFile) {
|
||||
context.error(`@rollup/plugin-typescript: Typescript compiler option 'outFile' is not supported. Use 'outDir' instead.`);
|
||||
}
|
||||
for (const dirProperty of DIRECTORY_PROPS) {
|
||||
if (compilerOptions[dirProperty] && outputOptions.dir) {
|
||||
// Checks if the given path lies within Rollup output dir
|
||||
const fromRollupDirToTs = relative(outputOptions.dir, compilerOptions[dirProperty]);
|
||||
if (fromRollupDirToTs.startsWith('..')) {
|
||||
context.error(`@rollup/plugin-typescript: Path of Typescript compiler option '${dirProperty}' must be located inside Rollup 'dir' option.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
const tsBuildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
||||
if (tsBuildInfoPath && compilerOptions.incremental) {
|
||||
if (!outputOptions.dir) {
|
||||
context.error(`@rollup/plugin-typescript: Rollup 'dir' option must be used when Typescript compiler options 'tsBuildInfoFile' or 'incremental' are specified.`);
|
||||
}
|
||||
// Checks if the given path lies within Rollup output dir
|
||||
const fromRollupDirToTs = relative(outputOptions.dir, tsBuildInfoPath);
|
||||
if (fromRollupDirToTs.startsWith('..')) {
|
||||
context.error(`@rollup/plugin-typescript: Path of Typescript compiler option 'tsBuildInfoFile' must be located inside Rollup 'dir' option.`);
|
||||
}
|
||||
}
|
||||
if (compilerOptions.declaration || compilerOptions.declarationMap || compilerOptions.composite) {
|
||||
if (DIRECTORY_PROPS.every((dirProperty) => !compilerOptions[dirProperty])) {
|
||||
context.error(`@rollup/plugin-typescript: You are using one of Typescript's compiler options 'declaration', 'declarationMap' or 'composite'. ` +
|
||||
`In this case 'outDir' or 'declarationDir' must be specified to generate declaration files.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given OutputFile represents some code
|
||||
*/
|
||||
function isCodeOutputFile(name) {
|
||||
return !isMapOutputFile(name) && !name.endsWith('.d.ts');
|
||||
}
|
||||
/**
|
||||
* Checks if the given OutputFile represents some source map
|
||||
*/
|
||||
function isMapOutputFile(name) {
|
||||
return name.endsWith('.map');
|
||||
}
|
||||
/**
|
||||
* Returns the content of a filename either from the current
|
||||
* typescript compiler instance or from the cached content.
|
||||
* @param fileName The filename for the contents to retrieve
|
||||
* @param emittedFiles The files emitted in the current typescript instance
|
||||
* @param tsCache A cache to files cached by Typescript
|
||||
*/
|
||||
function getEmittedFile(fileName, emittedFiles, tsCache) {
|
||||
let code;
|
||||
if (fileName) {
|
||||
if (emittedFiles.has(fileName)) {
|
||||
code = emittedFiles.get(fileName);
|
||||
}
|
||||
else {
|
||||
code = tsCache.getCached(fileName);
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
/**
|
||||
* Finds the corresponding emitted Javascript files for a given Typescript file.
|
||||
* @param id Path to the Typescript file.
|
||||
* @param emittedFiles Map of file names to source code,
|
||||
* containing files emitted by the Typescript compiler.
|
||||
*/
|
||||
function findTypescriptOutput(ts, parsedOptions, id, emittedFiles, tsCache) {
|
||||
const emittedFileNames = ts.getOutputFileNames(parsedOptions, id, !ts.sys.useCaseSensitiveFileNames);
|
||||
const codeFile = emittedFileNames.find(isCodeOutputFile);
|
||||
const mapFile = emittedFileNames.find(isMapOutputFile);
|
||||
return {
|
||||
code: getEmittedFile(codeFile, emittedFiles, tsCache),
|
||||
map: getEmittedFile(mapFile, emittedFiles, tsCache),
|
||||
declarations: emittedFileNames.filter((name) => name !== codeFile && name !== mapFile)
|
||||
};
|
||||
}
|
||||
|
||||
// `Cannot compile modules into 'es6' when targeting 'ES5' or lower.`
|
||||
const CANNOT_COMPILE_ESM = 1204;
|
||||
/**
|
||||
* Emit a Rollup warning or error for a Typescript type error.
|
||||
*/
|
||||
function emitDiagnostic(ts, context, host, diagnostic) {
|
||||
if (diagnostic.code === CANNOT_COMPILE_ESM)
|
||||
return;
|
||||
const { noEmitOnError } = host.getCompilationSettings();
|
||||
// Build a Rollup warning object from the diagnostics object.
|
||||
const warning = diagnosticToWarning(ts, host, diagnostic);
|
||||
// Errors are fatal. Otherwise emit warnings.
|
||||
if (noEmitOnError && diagnostic.category === ts.DiagnosticCategory.Error) {
|
||||
context.error(warning);
|
||||
}
|
||||
else {
|
||||
context.warn(warning);
|
||||
}
|
||||
}
|
||||
function buildDiagnosticReporter(ts, context, host) {
|
||||
return function reportDiagnostics(diagnostic) {
|
||||
emitDiagnostic(ts, context, host, diagnostic);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges all received custom transformer definitions into a single CustomTransformers object
|
||||
*/
|
||||
function mergeTransformers(builder, ...input) {
|
||||
// List of all transformer stages
|
||||
const transformerTypes = ['after', 'afterDeclarations', 'before'];
|
||||
const accumulator = {
|
||||
after: [],
|
||||
afterDeclarations: [],
|
||||
before: []
|
||||
};
|
||||
let program;
|
||||
let typeChecker;
|
||||
input.forEach((transformers) => {
|
||||
if (!transformers) {
|
||||
// Skip empty arguments lists
|
||||
return;
|
||||
}
|
||||
transformerTypes.forEach((stage) => {
|
||||
getTransformers(transformers[stage]).forEach((transformer) => {
|
||||
if (!transformer) {
|
||||
// Skip empty
|
||||
return;
|
||||
}
|
||||
if ('type' in transformer) {
|
||||
if (typeof transformer.factory === 'function') {
|
||||
// Allow custom factories to grab the extra information required
|
||||
program = program || builder.getProgram();
|
||||
typeChecker = typeChecker || program.getTypeChecker();
|
||||
let factory;
|
||||
if (transformer.type === 'program') {
|
||||
program = program || builder.getProgram();
|
||||
factory = transformer.factory(program);
|
||||
}
|
||||
else {
|
||||
program = program || builder.getProgram();
|
||||
typeChecker = typeChecker || program.getTypeChecker();
|
||||
factory = transformer.factory(typeChecker);
|
||||
}
|
||||
// Forward the requested reference to the custom transformer factory
|
||||
if (factory) {
|
||||
accumulator[stage].push(factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Add normal transformer factories as is
|
||||
accumulator[stage].push(transformer);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
return accumulator;
|
||||
}
|
||||
function getTransformers(transformers) {
|
||||
return transformers || [];
|
||||
}
|
||||
|
||||
// @see https://github.com/microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json
|
||||
var DiagnosticCode;
|
||||
(function (DiagnosticCode) {
|
||||
DiagnosticCode[DiagnosticCode["FILE_CHANGE_DETECTED"] = 6032] = "FILE_CHANGE_DETECTED";
|
||||
DiagnosticCode[DiagnosticCode["FOUND_1_ERROR_WATCHING_FOR_FILE_CHANGES"] = 6193] = "FOUND_1_ERROR_WATCHING_FOR_FILE_CHANGES";
|
||||
DiagnosticCode[DiagnosticCode["FOUND_N_ERRORS_WATCHING_FOR_FILE_CHANGES"] = 6194] = "FOUND_N_ERRORS_WATCHING_FOR_FILE_CHANGES";
|
||||
})(DiagnosticCode || (DiagnosticCode = {}));
|
||||
function createDeferred(timeout) {
|
||||
let promise;
|
||||
let resolve = () => { };
|
||||
if (timeout) {
|
||||
promise = Promise.race([
|
||||
new Promise((r) => setTimeout(r, timeout, true)),
|
||||
new Promise((r) => (resolve = r))
|
||||
]);
|
||||
}
|
||||
else {
|
||||
promise = new Promise((r) => (resolve = r));
|
||||
}
|
||||
return { promise, resolve };
|
||||
}
|
||||
/**
|
||||
* Typescript watch program helper to sync Typescript watch status with Rollup hooks.
|
||||
*/
|
||||
class WatchProgramHelper {
|
||||
constructor() {
|
||||
this._startDeferred = null;
|
||||
this._finishDeferred = null;
|
||||
}
|
||||
watch(timeout = 1000) {
|
||||
// Race watcher start promise against a timeout in case Typescript and Rollup change detection is not in sync.
|
||||
this._startDeferred = createDeferred(timeout);
|
||||
this._finishDeferred = createDeferred();
|
||||
}
|
||||
handleStatus(diagnostic) {
|
||||
// Fullfil deferred promises by Typescript diagnostic message codes.
|
||||
if (diagnostic.category === DiagnosticCategory.Message) {
|
||||
switch (diagnostic.code) {
|
||||
case DiagnosticCode.FILE_CHANGE_DETECTED:
|
||||
this.resolveStart();
|
||||
break;
|
||||
case DiagnosticCode.FOUND_1_ERROR_WATCHING_FOR_FILE_CHANGES:
|
||||
case DiagnosticCode.FOUND_N_ERRORS_WATCHING_FOR_FILE_CHANGES:
|
||||
this.resolveFinish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
resolveStart() {
|
||||
if (this._startDeferred) {
|
||||
this._startDeferred.resolve(false);
|
||||
this._startDeferred = null;
|
||||
}
|
||||
}
|
||||
resolveFinish() {
|
||||
if (this._finishDeferred) {
|
||||
this._finishDeferred.resolve(false);
|
||||
this._finishDeferred = null;
|
||||
}
|
||||
}
|
||||
async wait() {
|
||||
var _a;
|
||||
if (this._startDeferred) {
|
||||
const timeout = await this._startDeferred.promise;
|
||||
// If there is no file change detected by Typescript skip deferred promises.
|
||||
if (timeout) {
|
||||
this._startDeferred = null;
|
||||
this._finishDeferred = null;
|
||||
}
|
||||
await ((_a = this._finishDeferred) === null || _a === void 0 ? void 0 : _a.promise);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create a language service host to use with the Typescript compiler & type checking APIs.
|
||||
* Typescript hosts are used to represent the user's system,
|
||||
* with an API for reading files, checking directories and case sensitivity etc.
|
||||
* @see https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
|
||||
*/
|
||||
function createWatchHost(ts, context, { formatHost, parsedOptions, writeFile, status, resolveModule, transformers }) {
|
||||
const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram;
|
||||
const baseHost = ts.createWatchCompilerHost(parsedOptions.fileNames, parsedOptions.options, ts.sys, createProgram, buildDiagnosticReporter(ts, context, formatHost), status, parsedOptions.projectReferences);
|
||||
return Object.assign(Object.assign({}, baseHost), {
|
||||
/** Override the created program so an in-memory emit is used */
|
||||
afterProgramCreate(program) {
|
||||
const origEmit = program.emit;
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
program.emit = (targetSourceFile, _, ...args) => origEmit(targetSourceFile, writeFile,
|
||||
// cancellationToken
|
||||
args[0],
|
||||
// emitOnlyDtsFiles
|
||||
args[1], mergeTransformers(program, transformers, args[2]));
|
||||
return baseHost.afterProgramCreate(program);
|
||||
},
|
||||
/** Add helper to deal with module resolution */
|
||||
resolveModuleNames(moduleNames, containingFile) {
|
||||
return moduleNames.map((moduleName) => resolveModule(moduleName, containingFile));
|
||||
} });
|
||||
}
|
||||
function createWatchProgram(ts, context, options) {
|
||||
return ts.createWatchProgram(createWatchHost(ts, context, options));
|
||||
}
|
||||
|
||||
/** Creates the folders needed given a path to a file to be saved*/
|
||||
const createFileFolder = (filePath) => {
|
||||
const folderPath = path.dirname(filePath);
|
||||
fs.mkdirSync(folderPath, { recursive: true });
|
||||
};
|
||||
class TSCache {
|
||||
constructor(cacheFolder = '.rollup.cache') {
|
||||
this._cacheFolder = cacheFolder;
|
||||
}
|
||||
/** Returns the path to the cached file */
|
||||
cachedFilename(fileName) {
|
||||
return path.join(this._cacheFolder, fileName.replace(/^([A-Z]+):/, '$1'));
|
||||
}
|
||||
/** Emits a file in the cache folder */
|
||||
cacheCode(fileName, code) {
|
||||
const cachedPath = this.cachedFilename(fileName);
|
||||
createFileFolder(cachedPath);
|
||||
fs.writeFileSync(cachedPath, code);
|
||||
}
|
||||
/** Checks if a file is in the cache */
|
||||
isCached(fileName) {
|
||||
return fs.existsSync(this.cachedFilename(fileName));
|
||||
}
|
||||
/** Read a file from the cache given the output name*/
|
||||
getCached(fileName) {
|
||||
let code;
|
||||
if (this.isCached(fileName)) {
|
||||
code = fs.readFileSync(this.cachedFilename(fileName), { encoding: 'utf-8' });
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
function typescript(options = {}) {
|
||||
const { cacheDir, compilerOptions, filter, transformers, tsconfig, tslib, typescript: ts } = getPluginOptions(options);
|
||||
const tsCache = new TSCache(cacheDir);
|
||||
const emittedFiles = new Map();
|
||||
const watchProgramHelper = new WatchProgramHelper();
|
||||
const parsedOptions = parseTypescriptConfig(ts, tsconfig, compilerOptions);
|
||||
parsedOptions.fileNames = parsedOptions.fileNames.filter(filter);
|
||||
const formatHost = createFormattingHost(ts, parsedOptions.options);
|
||||
const resolveModule = createModuleResolver(ts, formatHost);
|
||||
let program = null;
|
||||
function normalizePath(fileName) {
|
||||
return fileName.split(win32.sep).join(posix.sep);
|
||||
}
|
||||
return {
|
||||
name: 'typescript',
|
||||
buildStart() {
|
||||
emitParsedOptionsErrors(ts, this, parsedOptions);
|
||||
// Fixes a memory leak https://github.com/rollup/plugins/issues/322
|
||||
if (!program) {
|
||||
program = createWatchProgram(ts, this, {
|
||||
formatHost,
|
||||
resolveModule,
|
||||
parsedOptions,
|
||||
writeFile(fileName, data) {
|
||||
if (parsedOptions.options.composite || parsedOptions.options.incremental) {
|
||||
tsCache.cacheCode(fileName, data);
|
||||
}
|
||||
emittedFiles.set(fileName, data);
|
||||
},
|
||||
status(diagnostic) {
|
||||
watchProgramHelper.handleStatus(diagnostic);
|
||||
},
|
||||
transformers
|
||||
});
|
||||
}
|
||||
},
|
||||
watchChange(id) {
|
||||
if (!filter(id))
|
||||
return;
|
||||
watchProgramHelper.watch();
|
||||
},
|
||||
buildEnd() {
|
||||
if (this.meta.watchMode !== true) {
|
||||
// ESLint doesn't understand optional chaining
|
||||
// eslint-disable-next-line
|
||||
program === null || program === void 0 ? void 0 : program.close();
|
||||
}
|
||||
},
|
||||
renderStart(outputOptions) {
|
||||
validateSourceMap(this, parsedOptions.options, outputOptions, parsedOptions.autoSetSourceMap);
|
||||
validatePaths(ts, this, parsedOptions.options, outputOptions);
|
||||
},
|
||||
resolveId(importee, importer) {
|
||||
if (importee === 'tslib') {
|
||||
return tslib;
|
||||
}
|
||||
if (!importer)
|
||||
return null;
|
||||
// Convert path from windows separators to posix separators
|
||||
const containingFile = normalizePath(importer);
|
||||
const resolved = resolveModule(importee, containingFile);
|
||||
if (resolved) {
|
||||
if (resolved.extension === '.d.ts')
|
||||
return null;
|
||||
return normalize(resolved.resolvedFileName);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
async load(id) {
|
||||
if (!filter(id))
|
||||
return null;
|
||||
await watchProgramHelper.wait();
|
||||
const fileName = normalizePath(id);
|
||||
if (!parsedOptions.fileNames.includes(fileName)) {
|
||||
// Discovered new file that was not known when originally parsing the TypeScript config
|
||||
parsedOptions.fileNames.push(fileName);
|
||||
}
|
||||
const output = findTypescriptOutput(ts, parsedOptions, id, emittedFiles, tsCache);
|
||||
return output.code != null ? output : null;
|
||||
},
|
||||
generateBundle(outputOptions) {
|
||||
parsedOptions.fileNames.forEach((fileName) => {
|
||||
const output = findTypescriptOutput(ts, parsedOptions, fileName, emittedFiles, tsCache);
|
||||
output.declarations.forEach((id) => {
|
||||
const code = getEmittedFile(id, emittedFiles, tsCache);
|
||||
let baseDir = outputOptions.dir;
|
||||
if (!baseDir && tsconfig) {
|
||||
baseDir = tsconfig.substring(0, tsconfig.lastIndexOf('/'));
|
||||
}
|
||||
if (!code || !baseDir)
|
||||
return;
|
||||
this.emitFile({
|
||||
type: 'asset',
|
||||
fileName: normalizePath(relative(baseDir, id)),
|
||||
source: code
|
||||
});
|
||||
});
|
||||
});
|
||||
const tsBuildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(parsedOptions.options);
|
||||
if (tsBuildInfoPath) {
|
||||
const tsBuildInfoSource = emittedFiles.get(tsBuildInfoPath);
|
||||
// https://github.com/rollup/plugins/issues/681
|
||||
if (tsBuildInfoSource) {
|
||||
this.emitFile({
|
||||
type: 'asset',
|
||||
fileName: normalizePath(relative(outputOptions.dir, tsBuildInfoPath)),
|
||||
source: tsBuildInfoSource
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default typescript;
|
778
node_modules/@rollup/plugin-typescript/dist/index.js
generated
vendored
778
node_modules/@rollup/plugin-typescript/dist/index.js
generated
vendored
|
@ -1,778 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var pluginutils = require('@rollup/pluginutils');
|
||||
var defaultTs = require('typescript');
|
||||
var resolveId = require('resolve');
|
||||
var fs = require('fs');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
function _interopNamespace(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
var n = Object.create(null);
|
||||
if (e) {
|
||||
Object.keys(e).forEach(function (k) {
|
||||
if (k !== 'default') {
|
||||
var d = Object.getOwnPropertyDescriptor(e, k);
|
||||
Object.defineProperty(n, k, d.get ? d : {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return e[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
n['default'] = e;
|
||||
return Object.freeze(n);
|
||||
}
|
||||
|
||||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
||||
var defaultTs__namespace = /*#__PURE__*/_interopNamespace(defaultTs);
|
||||
var resolveId__default = /*#__PURE__*/_interopDefaultLegacy(resolveId);
|
||||
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
||||
|
||||
/**
|
||||
* Create a format diagnostics host to use with the Typescript type checking APIs.
|
||||
* Typescript hosts are used to represent the user's system,
|
||||
* with an API for checking case sensitivity etc.
|
||||
* @param compilerOptions Typescript compiler options. Affects functions such as `getNewLine`.
|
||||
* @see https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
|
||||
*/
|
||||
function createFormattingHost(ts, compilerOptions) {
|
||||
return {
|
||||
/** Returns the compiler options for the project. */
|
||||
getCompilationSettings: () => compilerOptions,
|
||||
/** Returns the current working directory. */
|
||||
getCurrentDirectory: () => process.cwd(),
|
||||
/** Returns the string that corresponds with the selected `NewLineKind`. */
|
||||
getNewLine() {
|
||||
switch (compilerOptions.newLine) {
|
||||
case ts.NewLineKind.CarriageReturnLineFeed:
|
||||
return '\r\n';
|
||||
case ts.NewLineKind.LineFeed:
|
||||
return '\n';
|
||||
default:
|
||||
return ts.sys.newLine;
|
||||
}
|
||||
},
|
||||
/** Returns a lower case name on case insensitive systems, otherwise the original name. */
|
||||
getCanonicalFileName: (fileName) => ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase()
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a helper for resolving modules using Typescript.
|
||||
* @param host Typescript host that extends `ModuleResolutionHost`
|
||||
* with methods for sanitizing filenames and getting compiler options.
|
||||
*/
|
||||
function createModuleResolver(ts, host) {
|
||||
const compilerOptions = host.getCompilationSettings();
|
||||
const cache = ts.createModuleResolutionCache(process.cwd(), host.getCanonicalFileName, compilerOptions);
|
||||
const moduleHost = Object.assign(Object.assign({}, ts.sys), host);
|
||||
return (moduleName, containingFile) => {
|
||||
const resolved = ts.nodeModuleNameResolver(moduleName, containingFile, compilerOptions, moduleHost, cache);
|
||||
return resolved.resolvedModule;
|
||||
};
|
||||
}
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
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.
|
||||
***************************************************************************** */
|
||||
|
||||
function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
const resolveIdAsync = (file, opts) => new Promise((fulfil, reject) => resolveId__default['default'](file, opts, (err, contents) => (err || typeof contents === 'undefined' ? reject(err) : fulfil(contents))));
|
||||
/**
|
||||
* Returns code asynchronously for the tslib helper library.
|
||||
*/
|
||||
function getTsLibPath() {
|
||||
return resolveIdAsync('tslib/tslib.es6.js', { basedir: __dirname });
|
||||
}
|
||||
|
||||
/**
|
||||
* Separate the Rollup plugin options from the Typescript compiler options,
|
||||
* and normalize the Rollup options.
|
||||
* @returns Object with normalized options:
|
||||
* - `filter`: Checks if a file should be included.
|
||||
* - `tsconfig`: Path to a tsconfig, or directive to ignore tsconfig.
|
||||
* - `compilerOptions`: Custom Typescript compiler options that override tsconfig.
|
||||
* - `typescript`: Instance of Typescript library (possibly custom).
|
||||
* - `tslib`: ESM code from the tslib helper library (possibly custom).
|
||||
*/
|
||||
function getPluginOptions(options) {
|
||||
const { cacheDir, exclude, include, transformers, tsconfig, tslib, typescript } = options, compilerOptions = __rest(options, ["cacheDir", "exclude", "include", "transformers", "tsconfig", "tslib", "typescript"]);
|
||||
const filter = pluginutils.createFilter(include || ['*.ts+(|x)', '**/*.ts+(|x)'], exclude);
|
||||
return {
|
||||
cacheDir,
|
||||
filter,
|
||||
tsconfig,
|
||||
compilerOptions: compilerOptions,
|
||||
typescript: typescript || defaultTs__namespace,
|
||||
tslib: tslib || getTsLibPath(),
|
||||
transformers
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Typescript type error into an equivalent Rollup warning object.
|
||||
*/
|
||||
function diagnosticToWarning(ts, host, diagnostic) {
|
||||
const pluginCode = `TS${diagnostic.code}`;
|
||||
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
// Build a Rollup warning object from the diagnostics object.
|
||||
const warning = {
|
||||
pluginCode,
|
||||
message: `@rollup/plugin-typescript ${pluginCode}: ${message}`
|
||||
};
|
||||
if (diagnostic.file) {
|
||||
// Add information about the file location
|
||||
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
warning.loc = {
|
||||
column: character + 1,
|
||||
line: line + 1,
|
||||
file: diagnostic.file.fileName
|
||||
};
|
||||
if (host) {
|
||||
// Extract a code frame from Typescript
|
||||
const formatted = ts.formatDiagnosticsWithColorAndContext([diagnostic], host);
|
||||
// Typescript only exposes this formatter as a string prefixed with the flattened message.
|
||||
// We need to remove it here since Rollup treats the properties as separate parts.
|
||||
let frame = formatted.slice(formatted.indexOf(message) + message.length);
|
||||
const newLine = host.getNewLine();
|
||||
if (frame.startsWith(newLine)) {
|
||||
frame = frame.slice(frame.indexOf(newLine) + newLine.length);
|
||||
}
|
||||
warning.frame = frame;
|
||||
}
|
||||
}
|
||||
return warning;
|
||||
}
|
||||
|
||||
const DEFAULT_COMPILER_OPTIONS = {
|
||||
module: 'esnext',
|
||||
skipLibCheck: true
|
||||
};
|
||||
const FORCED_COMPILER_OPTIONS = {
|
||||
// Always use tslib
|
||||
noEmitHelpers: true,
|
||||
importHelpers: true,
|
||||
// Typescript needs to emit the code for us to work with
|
||||
noEmit: false,
|
||||
emitDeclarationOnly: false,
|
||||
// Preventing Typescript from resolving code may break compilation
|
||||
noResolve: false
|
||||
};
|
||||
|
||||
/* eslint-disable no-param-reassign */
|
||||
const DIRECTORY_PROPS = ['outDir', 'declarationDir'];
|
||||
/**
|
||||
* Mutates the compiler options to convert paths from relative to absolute.
|
||||
* This should be used with compiler options passed through the Rollup plugin options,
|
||||
* not those found from loading a tsconfig.json file.
|
||||
* @param compilerOptions Compiler options to _mutate_.
|
||||
* @param relativeTo Paths are resolved relative to this path.
|
||||
*/
|
||||
function makePathsAbsolute(compilerOptions, relativeTo) {
|
||||
for (const pathProp of DIRECTORY_PROPS) {
|
||||
if (compilerOptions[pathProp]) {
|
||||
compilerOptions[pathProp] = path.resolve(relativeTo, compilerOptions[pathProp]);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Mutates the compiler options to normalize some values for Rollup.
|
||||
* @param compilerOptions Compiler options to _mutate_.
|
||||
* @returns True if the source map compiler option was not initially set.
|
||||
*/
|
||||
function normalizeCompilerOptions(ts, compilerOptions) {
|
||||
let autoSetSourceMap = false;
|
||||
if (compilerOptions.inlineSourceMap) {
|
||||
// Force separate source map files for Rollup to work with.
|
||||
compilerOptions.sourceMap = true;
|
||||
compilerOptions.inlineSourceMap = false;
|
||||
}
|
||||
else if (typeof compilerOptions.sourceMap !== 'boolean') {
|
||||
// Default to using source maps.
|
||||
// If the plugin user sets sourceMap to false we keep that option.
|
||||
compilerOptions.sourceMap = true;
|
||||
// Using inlineSources to make sure typescript generate source content
|
||||
// instead of source path.
|
||||
compilerOptions.inlineSources = true;
|
||||
autoSetSourceMap = true;
|
||||
}
|
||||
switch (compilerOptions.module) {
|
||||
case ts.ModuleKind.ES2015:
|
||||
case ts.ModuleKind.ESNext:
|
||||
case ts.ModuleKind.CommonJS:
|
||||
// OK module type
|
||||
return autoSetSourceMap;
|
||||
case ts.ModuleKind.None:
|
||||
case ts.ModuleKind.AMD:
|
||||
case ts.ModuleKind.UMD:
|
||||
case ts.ModuleKind.System: {
|
||||
// Invalid module type
|
||||
const moduleType = ts.ModuleKind[compilerOptions.module];
|
||||
throw new Error(`@rollup/plugin-typescript: The module kind should be 'ES2015' or 'ESNext, found: '${moduleType}'`);
|
||||
}
|
||||
default:
|
||||
// Unknown or unspecified module type, force ESNext
|
||||
compilerOptions.module = ts.ModuleKind.ESNext;
|
||||
}
|
||||
return autoSetSourceMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the tsconfig file relative to the current working directory.
|
||||
* @param relativePath Relative tsconfig path given by the user.
|
||||
* If `false` is passed, then a null path is returned.
|
||||
* @returns The absolute path, or null if the file does not exist.
|
||||
*/
|
||||
function getTsConfigPath(ts, relativePath) {
|
||||
if (relativePath === false)
|
||||
return null;
|
||||
// Resolve path to file. `tsConfigOption` defaults to 'tsconfig.json'.
|
||||
const tsConfigPath = path.resolve(process.cwd(), relativePath || 'tsconfig.json');
|
||||
if (!ts.sys.fileExists(tsConfigPath)) {
|
||||
if (relativePath) {
|
||||
// If an explicit path was provided but no file was found, throw
|
||||
throw new Error(`Could not find specified tsconfig.json at ${tsConfigPath}`);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return tsConfigPath;
|
||||
}
|
||||
/**
|
||||
* Tries to read the tsconfig file at `tsConfigPath`.
|
||||
* @param tsConfigPath Absolute path to tsconfig JSON file.
|
||||
* @param explicitPath If true, the path was set by the plugin user.
|
||||
* If false, the path was computed automatically.
|
||||
*/
|
||||
function readTsConfigFile(ts, tsConfigPath) {
|
||||
const { config, error } = ts.readConfigFile(tsConfigPath, (path) => fs.readFileSync(path, 'utf8'));
|
||||
if (error) {
|
||||
throw Object.assign(Error(), diagnosticToWarning(ts, null, error));
|
||||
}
|
||||
return config || {};
|
||||
}
|
||||
/**
|
||||
* Returns true if any of the `compilerOptions` contain an enum value (i.e.: ts.ScriptKind) rather than a string.
|
||||
* This indicates that the internal CompilerOptions type is used rather than the JsonCompilerOptions.
|
||||
*/
|
||||
function containsEnumOptions(compilerOptions) {
|
||||
const enums = [
|
||||
'module',
|
||||
'target',
|
||||
'jsx',
|
||||
'moduleResolution',
|
||||
'newLine'
|
||||
];
|
||||
return enums.some((prop) => prop in compilerOptions && typeof compilerOptions[prop] === 'number');
|
||||
}
|
||||
const configCache = new Map();
|
||||
/**
|
||||
* Parse the Typescript config to use with the plugin.
|
||||
* @param ts Typescript library instance.
|
||||
* @param tsconfig Path to the tsconfig file, or `false` to ignore the file.
|
||||
* @param compilerOptions Options passed to the plugin directly for Typescript.
|
||||
*
|
||||
* @returns Parsed tsconfig.json file with some important properties:
|
||||
* - `options`: Parsed compiler options.
|
||||
* - `fileNames` Type definition files that should be included in the build.
|
||||
* - `errors`: Any errors from parsing the config file.
|
||||
*/
|
||||
function parseTypescriptConfig(ts, tsconfig, compilerOptions) {
|
||||
/* eslint-disable no-undefined */
|
||||
const cwd = process.cwd();
|
||||
makePathsAbsolute(compilerOptions, cwd);
|
||||
let parsedConfig;
|
||||
// Resolve path to file. If file is not found, pass undefined path to `parseJsonConfigFileContent`.
|
||||
// eslint-disable-next-line no-undefined
|
||||
const tsConfigPath = getTsConfigPath(ts, tsconfig) || undefined;
|
||||
const tsConfigFile = tsConfigPath ? readTsConfigFile(ts, tsConfigPath) : {};
|
||||
const basePath = tsConfigPath ? path.dirname(tsConfigPath) : cwd;
|
||||
// If compilerOptions has enums, it represents an CompilerOptions object instead of parsed JSON.
|
||||
// This determines where the data is passed to the parser.
|
||||
if (containsEnumOptions(compilerOptions)) {
|
||||
parsedConfig = ts.parseJsonConfigFileContent(Object.assign(Object.assign({}, tsConfigFile), { compilerOptions: Object.assign(Object.assign({}, DEFAULT_COMPILER_OPTIONS), tsConfigFile.compilerOptions) }), ts.sys, basePath, Object.assign(Object.assign({}, compilerOptions), FORCED_COMPILER_OPTIONS), tsConfigPath, undefined, undefined, configCache);
|
||||
}
|
||||
else {
|
||||
parsedConfig = ts.parseJsonConfigFileContent(Object.assign(Object.assign({}, tsConfigFile), { compilerOptions: Object.assign(Object.assign(Object.assign({}, DEFAULT_COMPILER_OPTIONS), tsConfigFile.compilerOptions), compilerOptions) }), ts.sys, basePath, FORCED_COMPILER_OPTIONS, tsConfigPath, undefined, undefined, configCache);
|
||||
}
|
||||
const autoSetSourceMap = normalizeCompilerOptions(ts, parsedConfig.options);
|
||||
return Object.assign(Object.assign({}, parsedConfig), { autoSetSourceMap });
|
||||
}
|
||||
/**
|
||||
* If errors are detected in the parsed options,
|
||||
* display all of them as warnings then emit an error.
|
||||
*/
|
||||
function emitParsedOptionsErrors(ts, context, parsedOptions) {
|
||||
if (parsedOptions.errors.length > 0) {
|
||||
parsedOptions.errors.forEach((error) => context.warn(diagnosticToWarning(ts, null, error)));
|
||||
context.error(`@rollup/plugin-typescript: Couldn't process compiler options`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that the `compilerOptions.sourceMap` option matches `outputOptions.sourcemap`.
|
||||
* @param context Rollup plugin context used to emit warnings.
|
||||
* @param compilerOptions Typescript compiler options.
|
||||
* @param outputOptions Rollup output options.
|
||||
* @param autoSetSourceMap True if the `compilerOptions.sourceMap` property was set to `true`
|
||||
* by the plugin, not the user.
|
||||
*/
|
||||
function validateSourceMap(context, compilerOptions, outputOptions, autoSetSourceMap) {
|
||||
if (compilerOptions.sourceMap && !outputOptions.sourcemap && !autoSetSourceMap) {
|
||||
context.warn(`@rollup/plugin-typescript: Rollup 'sourcemap' option must be set to generate source maps.`);
|
||||
}
|
||||
else if (!compilerOptions.sourceMap && outputOptions.sourcemap) {
|
||||
context.warn(`@rollup/plugin-typescript: Typescript 'sourceMap' compiler option must be set to generate source maps.`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Validate that the out directory used by Typescript can be controlled by Rollup.
|
||||
* @param context Rollup plugin context used to emit errors.
|
||||
* @param compilerOptions Typescript compiler options.
|
||||
* @param outputOptions Rollup output options.
|
||||
*/
|
||||
function validatePaths(ts, context, compilerOptions, outputOptions) {
|
||||
if (compilerOptions.out) {
|
||||
context.error(`@rollup/plugin-typescript: Deprecated Typescript compiler option 'out' is not supported. Use 'outDir' instead.`);
|
||||
}
|
||||
else if (compilerOptions.outFile) {
|
||||
context.error(`@rollup/plugin-typescript: Typescript compiler option 'outFile' is not supported. Use 'outDir' instead.`);
|
||||
}
|
||||
for (const dirProperty of DIRECTORY_PROPS) {
|
||||
if (compilerOptions[dirProperty] && outputOptions.dir) {
|
||||
// Checks if the given path lies within Rollup output dir
|
||||
const fromRollupDirToTs = path.relative(outputOptions.dir, compilerOptions[dirProperty]);
|
||||
if (fromRollupDirToTs.startsWith('..')) {
|
||||
context.error(`@rollup/plugin-typescript: Path of Typescript compiler option '${dirProperty}' must be located inside Rollup 'dir' option.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
const tsBuildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
||||
if (tsBuildInfoPath && compilerOptions.incremental) {
|
||||
if (!outputOptions.dir) {
|
||||
context.error(`@rollup/plugin-typescript: Rollup 'dir' option must be used when Typescript compiler options 'tsBuildInfoFile' or 'incremental' are specified.`);
|
||||
}
|
||||
// Checks if the given path lies within Rollup output dir
|
||||
const fromRollupDirToTs = path.relative(outputOptions.dir, tsBuildInfoPath);
|
||||
if (fromRollupDirToTs.startsWith('..')) {
|
||||
context.error(`@rollup/plugin-typescript: Path of Typescript compiler option 'tsBuildInfoFile' must be located inside Rollup 'dir' option.`);
|
||||
}
|
||||
}
|
||||
if (compilerOptions.declaration || compilerOptions.declarationMap || compilerOptions.composite) {
|
||||
if (DIRECTORY_PROPS.every((dirProperty) => !compilerOptions[dirProperty])) {
|
||||
context.error(`@rollup/plugin-typescript: You are using one of Typescript's compiler options 'declaration', 'declarationMap' or 'composite'. ` +
|
||||
`In this case 'outDir' or 'declarationDir' must be specified to generate declaration files.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given OutputFile represents some code
|
||||
*/
|
||||
function isCodeOutputFile(name) {
|
||||
return !isMapOutputFile(name) && !name.endsWith('.d.ts');
|
||||
}
|
||||
/**
|
||||
* Checks if the given OutputFile represents some source map
|
||||
*/
|
||||
function isMapOutputFile(name) {
|
||||
return name.endsWith('.map');
|
||||
}
|
||||
/**
|
||||
* Returns the content of a filename either from the current
|
||||
* typescript compiler instance or from the cached content.
|
||||
* @param fileName The filename for the contents to retrieve
|
||||
* @param emittedFiles The files emitted in the current typescript instance
|
||||
* @param tsCache A cache to files cached by Typescript
|
||||
*/
|
||||
function getEmittedFile(fileName, emittedFiles, tsCache) {
|
||||
let code;
|
||||
if (fileName) {
|
||||
if (emittedFiles.has(fileName)) {
|
||||
code = emittedFiles.get(fileName);
|
||||
}
|
||||
else {
|
||||
code = tsCache.getCached(fileName);
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
/**
|
||||
* Finds the corresponding emitted Javascript files for a given Typescript file.
|
||||
* @param id Path to the Typescript file.
|
||||
* @param emittedFiles Map of file names to source code,
|
||||
* containing files emitted by the Typescript compiler.
|
||||
*/
|
||||
function findTypescriptOutput(ts, parsedOptions, id, emittedFiles, tsCache) {
|
||||
const emittedFileNames = ts.getOutputFileNames(parsedOptions, id, !ts.sys.useCaseSensitiveFileNames);
|
||||
const codeFile = emittedFileNames.find(isCodeOutputFile);
|
||||
const mapFile = emittedFileNames.find(isMapOutputFile);
|
||||
return {
|
||||
code: getEmittedFile(codeFile, emittedFiles, tsCache),
|
||||
map: getEmittedFile(mapFile, emittedFiles, tsCache),
|
||||
declarations: emittedFileNames.filter((name) => name !== codeFile && name !== mapFile)
|
||||
};
|
||||
}
|
||||
|
||||
// `Cannot compile modules into 'es6' when targeting 'ES5' or lower.`
|
||||
const CANNOT_COMPILE_ESM = 1204;
|
||||
/**
|
||||
* Emit a Rollup warning or error for a Typescript type error.
|
||||
*/
|
||||
function emitDiagnostic(ts, context, host, diagnostic) {
|
||||
if (diagnostic.code === CANNOT_COMPILE_ESM)
|
||||
return;
|
||||
const { noEmitOnError } = host.getCompilationSettings();
|
||||
// Build a Rollup warning object from the diagnostics object.
|
||||
const warning = diagnosticToWarning(ts, host, diagnostic);
|
||||
// Errors are fatal. Otherwise emit warnings.
|
||||
if (noEmitOnError && diagnostic.category === ts.DiagnosticCategory.Error) {
|
||||
context.error(warning);
|
||||
}
|
||||
else {
|
||||
context.warn(warning);
|
||||
}
|
||||
}
|
||||
function buildDiagnosticReporter(ts, context, host) {
|
||||
return function reportDiagnostics(diagnostic) {
|
||||
emitDiagnostic(ts, context, host, diagnostic);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges all received custom transformer definitions into a single CustomTransformers object
|
||||
*/
|
||||
function mergeTransformers(builder, ...input) {
|
||||
// List of all transformer stages
|
||||
const transformerTypes = ['after', 'afterDeclarations', 'before'];
|
||||
const accumulator = {
|
||||
after: [],
|
||||
afterDeclarations: [],
|
||||
before: []
|
||||
};
|
||||
let program;
|
||||
let typeChecker;
|
||||
input.forEach((transformers) => {
|
||||
if (!transformers) {
|
||||
// Skip empty arguments lists
|
||||
return;
|
||||
}
|
||||
transformerTypes.forEach((stage) => {
|
||||
getTransformers(transformers[stage]).forEach((transformer) => {
|
||||
if (!transformer) {
|
||||
// Skip empty
|
||||
return;
|
||||
}
|
||||
if ('type' in transformer) {
|
||||
if (typeof transformer.factory === 'function') {
|
||||
// Allow custom factories to grab the extra information required
|
||||
program = program || builder.getProgram();
|
||||
typeChecker = typeChecker || program.getTypeChecker();
|
||||
let factory;
|
||||
if (transformer.type === 'program') {
|
||||
program = program || builder.getProgram();
|
||||
factory = transformer.factory(program);
|
||||
}
|
||||
else {
|
||||
program = program || builder.getProgram();
|
||||
typeChecker = typeChecker || program.getTypeChecker();
|
||||
factory = transformer.factory(typeChecker);
|
||||
}
|
||||
// Forward the requested reference to the custom transformer factory
|
||||
if (factory) {
|
||||
accumulator[stage].push(factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Add normal transformer factories as is
|
||||
accumulator[stage].push(transformer);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
return accumulator;
|
||||
}
|
||||
function getTransformers(transformers) {
|
||||
return transformers || [];
|
||||
}
|
||||
|
||||
// @see https://github.com/microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json
|
||||
var DiagnosticCode;
|
||||
(function (DiagnosticCode) {
|
||||
DiagnosticCode[DiagnosticCode["FILE_CHANGE_DETECTED"] = 6032] = "FILE_CHANGE_DETECTED";
|
||||
DiagnosticCode[DiagnosticCode["FOUND_1_ERROR_WATCHING_FOR_FILE_CHANGES"] = 6193] = "FOUND_1_ERROR_WATCHING_FOR_FILE_CHANGES";
|
||||
DiagnosticCode[DiagnosticCode["FOUND_N_ERRORS_WATCHING_FOR_FILE_CHANGES"] = 6194] = "FOUND_N_ERRORS_WATCHING_FOR_FILE_CHANGES";
|
||||
})(DiagnosticCode || (DiagnosticCode = {}));
|
||||
function createDeferred(timeout) {
|
||||
let promise;
|
||||
let resolve = () => { };
|
||||
if (timeout) {
|
||||
promise = Promise.race([
|
||||
new Promise((r) => setTimeout(r, timeout, true)),
|
||||
new Promise((r) => (resolve = r))
|
||||
]);
|
||||
}
|
||||
else {
|
||||
promise = new Promise((r) => (resolve = r));
|
||||
}
|
||||
return { promise, resolve };
|
||||
}
|
||||
/**
|
||||
* Typescript watch program helper to sync Typescript watch status with Rollup hooks.
|
||||
*/
|
||||
class WatchProgramHelper {
|
||||
constructor() {
|
||||
this._startDeferred = null;
|
||||
this._finishDeferred = null;
|
||||
}
|
||||
watch(timeout = 1000) {
|
||||
// Race watcher start promise against a timeout in case Typescript and Rollup change detection is not in sync.
|
||||
this._startDeferred = createDeferred(timeout);
|
||||
this._finishDeferred = createDeferred();
|
||||
}
|
||||
handleStatus(diagnostic) {
|
||||
// Fullfil deferred promises by Typescript diagnostic message codes.
|
||||
if (diagnostic.category === defaultTs.DiagnosticCategory.Message) {
|
||||
switch (diagnostic.code) {
|
||||
case DiagnosticCode.FILE_CHANGE_DETECTED:
|
||||
this.resolveStart();
|
||||
break;
|
||||
case DiagnosticCode.FOUND_1_ERROR_WATCHING_FOR_FILE_CHANGES:
|
||||
case DiagnosticCode.FOUND_N_ERRORS_WATCHING_FOR_FILE_CHANGES:
|
||||
this.resolveFinish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
resolveStart() {
|
||||
if (this._startDeferred) {
|
||||
this._startDeferred.resolve(false);
|
||||
this._startDeferred = null;
|
||||
}
|
||||
}
|
||||
resolveFinish() {
|
||||
if (this._finishDeferred) {
|
||||
this._finishDeferred.resolve(false);
|
||||
this._finishDeferred = null;
|
||||
}
|
||||
}
|
||||
async wait() {
|
||||
var _a;
|
||||
if (this._startDeferred) {
|
||||
const timeout = await this._startDeferred.promise;
|
||||
// If there is no file change detected by Typescript skip deferred promises.
|
||||
if (timeout) {
|
||||
this._startDeferred = null;
|
||||
this._finishDeferred = null;
|
||||
}
|
||||
await ((_a = this._finishDeferred) === null || _a === void 0 ? void 0 : _a.promise);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create a language service host to use with the Typescript compiler & type checking APIs.
|
||||
* Typescript hosts are used to represent the user's system,
|
||||
* with an API for reading files, checking directories and case sensitivity etc.
|
||||
* @see https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
|
||||
*/
|
||||
function createWatchHost(ts, context, { formatHost, parsedOptions, writeFile, status, resolveModule, transformers }) {
|
||||
const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram;
|
||||
const baseHost = ts.createWatchCompilerHost(parsedOptions.fileNames, parsedOptions.options, ts.sys, createProgram, buildDiagnosticReporter(ts, context, formatHost), status, parsedOptions.projectReferences);
|
||||
return Object.assign(Object.assign({}, baseHost), {
|
||||
/** Override the created program so an in-memory emit is used */
|
||||
afterProgramCreate(program) {
|
||||
const origEmit = program.emit;
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
program.emit = (targetSourceFile, _, ...args) => origEmit(targetSourceFile, writeFile,
|
||||
// cancellationToken
|
||||
args[0],
|
||||
// emitOnlyDtsFiles
|
||||
args[1], mergeTransformers(program, transformers, args[2]));
|
||||
return baseHost.afterProgramCreate(program);
|
||||
},
|
||||
/** Add helper to deal with module resolution */
|
||||
resolveModuleNames(moduleNames, containingFile) {
|
||||
return moduleNames.map((moduleName) => resolveModule(moduleName, containingFile));
|
||||
} });
|
||||
}
|
||||
function createWatchProgram(ts, context, options) {
|
||||
return ts.createWatchProgram(createWatchHost(ts, context, options));
|
||||
}
|
||||
|
||||
/** Creates the folders needed given a path to a file to be saved*/
|
||||
const createFileFolder = (filePath) => {
|
||||
const folderPath = path__default['default'].dirname(filePath);
|
||||
fs__default['default'].mkdirSync(folderPath, { recursive: true });
|
||||
};
|
||||
class TSCache {
|
||||
constructor(cacheFolder = '.rollup.cache') {
|
||||
this._cacheFolder = cacheFolder;
|
||||
}
|
||||
/** Returns the path to the cached file */
|
||||
cachedFilename(fileName) {
|
||||
return path__default['default'].join(this._cacheFolder, fileName.replace(/^([A-Z]+):/, '$1'));
|
||||
}
|
||||
/** Emits a file in the cache folder */
|
||||
cacheCode(fileName, code) {
|
||||
const cachedPath = this.cachedFilename(fileName);
|
||||
createFileFolder(cachedPath);
|
||||
fs__default['default'].writeFileSync(cachedPath, code);
|
||||
}
|
||||
/** Checks if a file is in the cache */
|
||||
isCached(fileName) {
|
||||
return fs__default['default'].existsSync(this.cachedFilename(fileName));
|
||||
}
|
||||
/** Read a file from the cache given the output name*/
|
||||
getCached(fileName) {
|
||||
let code;
|
||||
if (this.isCached(fileName)) {
|
||||
code = fs__default['default'].readFileSync(this.cachedFilename(fileName), { encoding: 'utf-8' });
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
function typescript(options = {}) {
|
||||
const { cacheDir, compilerOptions, filter, transformers, tsconfig, tslib, typescript: ts } = getPluginOptions(options);
|
||||
const tsCache = new TSCache(cacheDir);
|
||||
const emittedFiles = new Map();
|
||||
const watchProgramHelper = new WatchProgramHelper();
|
||||
const parsedOptions = parseTypescriptConfig(ts, tsconfig, compilerOptions);
|
||||
parsedOptions.fileNames = parsedOptions.fileNames.filter(filter);
|
||||
const formatHost = createFormattingHost(ts, parsedOptions.options);
|
||||
const resolveModule = createModuleResolver(ts, formatHost);
|
||||
let program = null;
|
||||
function normalizePath(fileName) {
|
||||
return fileName.split(path.win32.sep).join(path.posix.sep);
|
||||
}
|
||||
return {
|
||||
name: 'typescript',
|
||||
buildStart() {
|
||||
emitParsedOptionsErrors(ts, this, parsedOptions);
|
||||
// Fixes a memory leak https://github.com/rollup/plugins/issues/322
|
||||
if (!program) {
|
||||
program = createWatchProgram(ts, this, {
|
||||
formatHost,
|
||||
resolveModule,
|
||||
parsedOptions,
|
||||
writeFile(fileName, data) {
|
||||
if (parsedOptions.options.composite || parsedOptions.options.incremental) {
|
||||
tsCache.cacheCode(fileName, data);
|
||||
}
|
||||
emittedFiles.set(fileName, data);
|
||||
},
|
||||
status(diagnostic) {
|
||||
watchProgramHelper.handleStatus(diagnostic);
|
||||
},
|
||||
transformers
|
||||
});
|
||||
}
|
||||
},
|
||||
watchChange(id) {
|
||||
if (!filter(id))
|
||||
return;
|
||||
watchProgramHelper.watch();
|
||||
},
|
||||
buildEnd() {
|
||||
if (this.meta.watchMode !== true) {
|
||||
// ESLint doesn't understand optional chaining
|
||||
// eslint-disable-next-line
|
||||
program === null || program === void 0 ? void 0 : program.close();
|
||||
}
|
||||
},
|
||||
renderStart(outputOptions) {
|
||||
validateSourceMap(this, parsedOptions.options, outputOptions, parsedOptions.autoSetSourceMap);
|
||||
validatePaths(ts, this, parsedOptions.options, outputOptions);
|
||||
},
|
||||
resolveId(importee, importer) {
|
||||
if (importee === 'tslib') {
|
||||
return tslib;
|
||||
}
|
||||
if (!importer)
|
||||
return null;
|
||||
// Convert path from windows separators to posix separators
|
||||
const containingFile = normalizePath(importer);
|
||||
const resolved = resolveModule(importee, containingFile);
|
||||
if (resolved) {
|
||||
if (resolved.extension === '.d.ts')
|
||||
return null;
|
||||
return path.normalize(resolved.resolvedFileName);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
async load(id) {
|
||||
if (!filter(id))
|
||||
return null;
|
||||
await watchProgramHelper.wait();
|
||||
const fileName = normalizePath(id);
|
||||
if (!parsedOptions.fileNames.includes(fileName)) {
|
||||
// Discovered new file that was not known when originally parsing the TypeScript config
|
||||
parsedOptions.fileNames.push(fileName);
|
||||
}
|
||||
const output = findTypescriptOutput(ts, parsedOptions, id, emittedFiles, tsCache);
|
||||
return output.code != null ? output : null;
|
||||
},
|
||||
generateBundle(outputOptions) {
|
||||
parsedOptions.fileNames.forEach((fileName) => {
|
||||
const output = findTypescriptOutput(ts, parsedOptions, fileName, emittedFiles, tsCache);
|
||||
output.declarations.forEach((id) => {
|
||||
const code = getEmittedFile(id, emittedFiles, tsCache);
|
||||
let baseDir = outputOptions.dir;
|
||||
if (!baseDir && tsconfig) {
|
||||
baseDir = tsconfig.substring(0, tsconfig.lastIndexOf('/'));
|
||||
}
|
||||
if (!code || !baseDir)
|
||||
return;
|
||||
this.emitFile({
|
||||
type: 'asset',
|
||||
fileName: normalizePath(path.relative(baseDir, id)),
|
||||
source: code
|
||||
});
|
||||
});
|
||||
});
|
||||
const tsBuildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(parsedOptions.options);
|
||||
if (tsBuildInfoPath) {
|
||||
const tsBuildInfoSource = emittedFiles.get(tsBuildInfoPath);
|
||||
// https://github.com/rollup/plugins/issues/681
|
||||
if (tsBuildInfoSource) {
|
||||
this.emitFile({
|
||||
type: 'asset',
|
||||
fileName: normalizePath(path.relative(outputOptions.dir, tsBuildInfoPath)),
|
||||
source: tsBuildInfoSource
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = typescript;
|
1
node_modules/@rollup/plugin-typescript/node_modules/.bin/tsc
generated
vendored
1
node_modules/@rollup/plugin-typescript/node_modules/.bin/tsc
generated
vendored
|
@ -1 +0,0 @@
|
|||
../../../../typescript/bin/tsc
|
1
node_modules/@rollup/plugin-typescript/node_modules/.bin/tsserver
generated
vendored
1
node_modules/@rollup/plugin-typescript/node_modules/.bin/tsserver
generated
vendored
|
@ -1 +0,0 @@
|
|||
../../../../typescript/bin/tsserver
|
84
node_modules/@rollup/plugin-typescript/package.json
generated
vendored
84
node_modules/@rollup/plugin-typescript/package.json
generated
vendored
|
@ -1,84 +0,0 @@
|
|||
{
|
||||
"name": "@rollup/plugin-typescript",
|
||||
"version": "8.1.1",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"description": "Seamless integration between Rollup and TypeScript.",
|
||||
"license": "MIT",
|
||||
"repository": "rollup/plugins",
|
||||
"author": "Oskar Segersvärd",
|
||||
"homepage": "https://github.com/rollup/plugins/tree/master/packages/typescript/#readme",
|
||||
"bugs": "https://github.com/rollup/plugins/issues",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.es.js",
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
|
||||
"ci:lint": "pnpm run build && pnpm run lint",
|
||||
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
|
||||
"ci:test": "pnpm run test -- --verbose --serial",
|
||||
"lint": "pnpm run lint:js && pnpm run lint:docs && pnpm run lint:json && pnpm run lint:package",
|
||||
"lint:docs": "prettier --single-quote --arrow-parens avoid --trailing-comma none --write README.md",
|
||||
"lint:js": "eslint --fix --cache src test --ext .js,.ts",
|
||||
"lint:json": "prettier --write **/tsconfig.json",
|
||||
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
|
||||
"prebuild": "del-cli dist",
|
||||
"prepare": "pnpm run build",
|
||||
"prepublishOnly": "pnpm run lint",
|
||||
"pretest": "pnpm run build",
|
||||
"test": "ava"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"types",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"keywords": [
|
||||
"rollup",
|
||||
"plugin",
|
||||
"typescript",
|
||||
"es2015"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"rollup": "^2.14.0",
|
||||
"tslib": "*",
|
||||
"typescript": ">=3.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^3.1.0",
|
||||
"resolve": "^1.17.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-buble": "^0.21.3",
|
||||
"@rollup/plugin-commonjs": "^11.1.0",
|
||||
"@rollup/plugin-typescript": "^5.0.2",
|
||||
"@types/node": "^10.0.0",
|
||||
"buble": "^0.20.0",
|
||||
"rollup": "^2.14.0",
|
||||
"typescript": "^4.1.2"
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"ava": {
|
||||
"babel": {
|
||||
"compileEnhancements": false
|
||||
},
|
||||
"extensions": [
|
||||
"ts"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
],
|
||||
"files": [
|
||||
"!**/fixtures/**",
|
||||
"!**/output/**",
|
||||
"!**/helpers/**",
|
||||
"!**/recipes/**",
|
||||
"!**/types.ts"
|
||||
]
|
||||
}
|
||||
}
|
81
node_modules/@rollup/plugin-typescript/types/index.d.ts
generated
vendored
81
node_modules/@rollup/plugin-typescript/types/index.d.ts
generated
vendored
|
@ -1,81 +0,0 @@
|
|||
import { FilterPattern } from '@rollup/pluginutils';
|
||||
import { Plugin } from 'rollup';
|
||||
import { CompilerOptions, CustomTransformers, Program, TypeChecker } from 'typescript';
|
||||
|
||||
export interface RollupTypescriptPluginOptions {
|
||||
/**
|
||||
* If using incremental this is the folder where the cached
|
||||
* files will be created and kept for Typescript incremental
|
||||
* compilation.
|
||||
*/
|
||||
cacheDir?: string;
|
||||
/**
|
||||
* Determine which files are transpiled by Typescript (all `.ts` and
|
||||
* `.tsx` files by default).
|
||||
*/
|
||||
include?: FilterPattern;
|
||||
/**
|
||||
* Determine which files are ignored by Typescript
|
||||
*/
|
||||
exclude?: FilterPattern;
|
||||
/**
|
||||
* When set to false, ignores any options specified in the config file.
|
||||
* If set to a string that corresponds to a file path, the specified file
|
||||
* will be used as config file.
|
||||
*/
|
||||
tsconfig?: string | false;
|
||||
/**
|
||||
* Overrides TypeScript used for transpilation
|
||||
*/
|
||||
typescript?: typeof import('typescript');
|
||||
/**
|
||||
* Overrides the injected TypeScript helpers with a custom version.
|
||||
*/
|
||||
tslib?: Promise<string> | string;
|
||||
/**
|
||||
* TypeScript custom transformers
|
||||
*/
|
||||
transformers?: CustomTransformerFactories;
|
||||
}
|
||||
|
||||
type ElementType<T extends Array<any> | undefined> = T extends (infer U)[] ? U : never;
|
||||
|
||||
export type TransformerStage = keyof CustomTransformers;
|
||||
type StagedTransformerFactory<T extends TransformerStage> = ElementType<CustomTransformers[T]>;
|
||||
type TransformerFactory<T extends TransformerStage> =
|
||||
| StagedTransformerFactory<T>
|
||||
| ProgramTransformerFactory<T>
|
||||
| TypeCheckerTransformerFactory<T>;
|
||||
|
||||
export type CustomTransformerFactories = {
|
||||
[stage in TransformerStage]?: Array<TransformerFactory<stage>>;
|
||||
};
|
||||
|
||||
interface ProgramTransformerFactory<T extends TransformerStage> {
|
||||
type: 'program';
|
||||
|
||||
factory(program: Program): StagedTransformerFactory<T>;
|
||||
}
|
||||
|
||||
interface TypeCheckerTransformerFactory<T extends TransformerStage> {
|
||||
type: 'typeChecker';
|
||||
|
||||
factory(typeChecker: TypeChecker): StagedTransformerFactory<T>;
|
||||
}
|
||||
|
||||
/** Properties of `CompilerOptions` that are normally enums */
|
||||
export type EnumCompilerOptions = 'module' | 'moduleResolution' | 'newLine' | 'jsx' | 'target';
|
||||
|
||||
/** JSON representation of Typescript compiler options */
|
||||
export type JsonCompilerOptions = Omit<CompilerOptions, EnumCompilerOptions> &
|
||||
Record<EnumCompilerOptions, string>;
|
||||
|
||||
/** Compiler options set by the plugin user. */
|
||||
export type PartialCompilerOptions = Partial<CompilerOptions> | Partial<JsonCompilerOptions>;
|
||||
|
||||
export type RollupTypescriptOptions = RollupTypescriptPluginOptions & PartialCompilerOptions;
|
||||
|
||||
/**
|
||||
* Seamless integration between Rollup and Typescript.
|
||||
*/
|
||||
export default function typescript(options?: RollupTypescriptOptions): Plugin;
|
315
node_modules/@rollup/pluginutils/CHANGELOG.md
generated
vendored
315
node_modules/@rollup/pluginutils/CHANGELOG.md
generated
vendored
|
@ -1,315 +0,0 @@
|
|||
# @rollup/pluginutils ChangeLog
|
||||
|
||||
## v3.1.0
|
||||
|
||||
_2020-06-05_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: resolve relative paths starting with "./" (#180)
|
||||
|
||||
### Features
|
||||
|
||||
- feat: add native node es modules support (#419)
|
||||
|
||||
### Updates
|
||||
|
||||
- refactor: replace micromatch with picomatch. (#306)
|
||||
- chore: Don't bundle micromatch (#220)
|
||||
- chore: add missing typescript devDep (238b140)
|
||||
- chore: Use readonly arrays, add TSDoc (#187)
|
||||
- chore: Use typechecking (2ae08eb)
|
||||
|
||||
## v3.0.10
|
||||
|
||||
_2020-05-02_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: resolve relative paths starting with "./" (#180)
|
||||
|
||||
### Updates
|
||||
|
||||
- refactor: replace micromatch with picomatch. (#306)
|
||||
- chore: Don't bundle micromatch (#220)
|
||||
- chore: add missing typescript devDep (238b140)
|
||||
- chore: Use readonly arrays, add TSDoc (#187)
|
||||
- chore: Use typechecking (2ae08eb)
|
||||
|
||||
## v3.0.9
|
||||
|
||||
_2020-04-12_
|
||||
|
||||
### Updates
|
||||
|
||||
- chore: support Rollup v2
|
||||
|
||||
## v3.0.8
|
||||
|
||||
_2020-02-01_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: resolve relative paths starting with "./" (#180)
|
||||
|
||||
### Updates
|
||||
|
||||
- chore: add missing typescript devDep (238b140)
|
||||
- chore: Use readonly arrays, add TSDoc (#187)
|
||||
- chore: Use typechecking (2ae08eb)
|
||||
|
||||
## v3.0.7
|
||||
|
||||
_2020-02-01_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: resolve relative paths starting with "./" (#180)
|
||||
|
||||
### Updates
|
||||
|
||||
- chore: Use readonly arrays, add TSDoc (#187)
|
||||
- chore: Use typechecking (2ae08eb)
|
||||
|
||||
## v3.0.6
|
||||
|
||||
_2020-01-27_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: resolve relative paths starting with "./" (#180)
|
||||
|
||||
## v3.0.5
|
||||
|
||||
_2020-01-25_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: bring back named exports (#176)
|
||||
|
||||
## v3.0.4
|
||||
|
||||
_2020-01-10_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: keep for(const..) out of scope (#151)
|
||||
|
||||
## v3.0.3
|
||||
|
||||
_2020-01-07_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: createFilter Windows regression (#141)
|
||||
|
||||
### Updates
|
||||
|
||||
- test: fix windows path failure (0a0de65)
|
||||
- chore: fix test script (5eae320)
|
||||
|
||||
## v3.0.2
|
||||
|
||||
_2020-01-04_
|
||||
|
||||
### Bugfixes
|
||||
|
||||
- fix: makeLegalIdentifier - potentially unsafe input for blacklisted identifier (#116)
|
||||
|
||||
### Updates
|
||||
|
||||
- docs: Fix documented type of createFilter's include/exclude (#123)
|
||||
- chore: update minor linting correction (bcbf9d2)
|
||||
|
||||
## 3.0.1
|
||||
|
||||
- fix: Escape glob characters in folder (#84)
|
||||
|
||||
## 3.0.0
|
||||
|
||||
_2019-11-25_
|
||||
|
||||
- **Breaking:** Minimum compatible Rollup version is 1.20.0
|
||||
- **Breaking:** Minimum supported Node version is 8.0.0
|
||||
- Published as @rollup/plugins-image
|
||||
|
||||
## 2.8.2
|
||||
|
||||
_2019-09-13_
|
||||
|
||||
- Handle optional catch parameter in attachScopes ([#70](https://github.com/rollup/rollup-pluginutils/pulls/70))
|
||||
|
||||
## 2.8.1
|
||||
|
||||
_2019-06-04_
|
||||
|
||||
- Support serialization of many edge cases ([#64](https://github.com/rollup/rollup-pluginutils/issues/64))
|
||||
|
||||
## 2.8.0
|
||||
|
||||
_2019-05-30_
|
||||
|
||||
- Bundle updated micromatch dependency ([#60](https://github.com/rollup/rollup-pluginutils/issues/60))
|
||||
|
||||
## 2.7.1
|
||||
|
||||
_2019-05-17_
|
||||
|
||||
- Do not ignore files with a leading "." in createFilter ([#62](https://github.com/rollup/rollup-pluginutils/issues/62))
|
||||
|
||||
## 2.7.0
|
||||
|
||||
_2019-05-15_
|
||||
|
||||
- Add `resolve` option to createFilter ([#59](https://github.com/rollup/rollup-pluginutils/issues/59))
|
||||
|
||||
## 2.6.0
|
||||
|
||||
_2019-04-04_
|
||||
|
||||
- Add `extractAssignedNames` ([#59](https://github.com/rollup/rollup-pluginutils/issues/59))
|
||||
- Provide dedicated TypeScript typings file ([#58](https://github.com/rollup/rollup-pluginutils/issues/58))
|
||||
|
||||
## 2.5.0
|
||||
|
||||
_2019-03-18_
|
||||
|
||||
- Generalize dataToEsm type ([#55](https://github.com/rollup/rollup-pluginutils/issues/55))
|
||||
- Handle empty keys in dataToEsm ([#56](https://github.com/rollup/rollup-pluginutils/issues/56))
|
||||
|
||||
## 2.4.1
|
||||
|
||||
_2019-02-16_
|
||||
|
||||
- Remove unnecessary dependency
|
||||
|
||||
## 2.4.0
|
||||
|
||||
_2019-02-16_
|
||||
Update dependencies to solve micromatch vulnerability ([#53](https://github.com/rollup/rollup-pluginutils/issues/53))
|
||||
|
||||
## 2.3.3
|
||||
|
||||
_2018-09-19_
|
||||
|
||||
- Revert micromatch update ([#43](https://github.com/rollup/rollup-pluginutils/issues/43))
|
||||
|
||||
## 2.3.2
|
||||
|
||||
_2018-09-18_
|
||||
|
||||
- Bumb micromatch dependency ([#36](https://github.com/rollup/rollup-pluginutils/issues/36))
|
||||
- Bumb dependencies ([#41](https://github.com/rollup/rollup-pluginutils/issues/41))
|
||||
- Split up tests ([#40](https://github.com/rollup/rollup-pluginutils/issues/40))
|
||||
|
||||
## 2.3.1
|
||||
|
||||
_2018-08-06_
|
||||
|
||||
- Fixed ObjectPattern scope in attachScopes to recognise { ...rest } syntax ([#37](https://github.com/rollup/rollup-pluginutils/issues/37))
|
||||
|
||||
## 2.3.0
|
||||
|
||||
_2018-05-21_
|
||||
|
||||
- Add option to not generate named exports ([#32](https://github.com/rollup/rollup-pluginutils/issues/32))
|
||||
|
||||
## 2.2.1
|
||||
|
||||
_2018-05-21_
|
||||
|
||||
- Support `null` serialization ([#34](https://github.com/rollup/rollup-pluginutils/issues/34))
|
||||
|
||||
## 2.2.0
|
||||
|
||||
_2018-05-11_
|
||||
|
||||
- Improve white-space handling in `dataToEsm` and add `prepare` script ([#31](https://github.com/rollup/rollup-pluginutils/issues/31))
|
||||
|
||||
## 2.1.1
|
||||
|
||||
_2018-05-09_
|
||||
|
||||
- Update dependencies
|
||||
|
||||
## 2.1.0
|
||||
|
||||
_2018-05-08_
|
||||
|
||||
- Add `dataToEsm` helper to create named exports from objects ([#29](https://github.com/rollup/rollup-pluginutils/issues/29))
|
||||
- Support literal keys in object patterns ([#27](https://github.com/rollup/rollup-pluginutils/issues/27))
|
||||
- Support function declarations without id in `attachScopes` ([#28](https://github.com/rollup/rollup-pluginutils/issues/28))
|
||||
|
||||
## 2.0.1
|
||||
|
||||
_2017-01-03_
|
||||
|
||||
- Don't add extension to file with trailing dot ([#14](https://github.com/rollup/rollup-pluginutils/issues/14))
|
||||
|
||||
## 2.0.0
|
||||
|
||||
_2017-01-03_
|
||||
|
||||
- Use `micromatch` instead of `minimatch` ([#19](https://github.com/rollup/rollup-pluginutils/issues/19))
|
||||
- Allow `createFilter` to take regexes ([#5](https://github.com/rollup/rollup-pluginutils/issues/5))
|
||||
|
||||
## 1.5.2
|
||||
|
||||
_2016-08-29_
|
||||
|
||||
- Treat `arguments` as a reserved word ([#10](https://github.com/rollup/rollup-pluginutils/issues/10))
|
||||
|
||||
## 1.5.1
|
||||
|
||||
_2016-06-24_
|
||||
|
||||
- Add all declarators in a var declaration to scope, not just the first
|
||||
|
||||
## 1.5.0
|
||||
|
||||
_2016-06-07_
|
||||
|
||||
- Exclude IDs with null character (`\0`)
|
||||
|
||||
## 1.4.0
|
||||
|
||||
_2016-06-07_
|
||||
|
||||
- Workaround minimatch issue ([#6](https://github.com/rollup/rollup-pluginutils/pull/6))
|
||||
- Exclude non-string IDs in `createFilter`
|
||||
|
||||
## 1.3.1
|
||||
|
||||
_2015-12-16_
|
||||
|
||||
- Build with Rollup directly, rather than via Gobble
|
||||
|
||||
## 1.3.0
|
||||
|
||||
_2015-12-16_
|
||||
|
||||
- Use correct path separator on Windows
|
||||
|
||||
## 1.2.0
|
||||
|
||||
_2015-11-02_
|
||||
|
||||
- Add `attachScopes` and `makeLegalIdentifier`
|
||||
|
||||
## 1.1.0
|
||||
|
||||
2015-10-24\*
|
||||
|
||||
- Add `addExtension` function
|
||||
|
||||
## 1.0.1
|
||||
|
||||
_2015-10-24_
|
||||
|
||||
- Include dist files in package
|
||||
|
||||
## 1.0.0
|
||||
|
||||
_2015-10-24_
|
||||
|
||||
- First release
|
21
node_modules/@rollup/pluginutils/LICENSE
generated
vendored
21
node_modules/@rollup/pluginutils/LICENSE
generated
vendored
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)
|
||||
|
||||
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/@rollup/pluginutils/README.md
generated
vendored
237
node_modules/@rollup/pluginutils/README.md
generated
vendored
|
@ -1,237 +0,0 @@
|
|||
[npm]: https://img.shields.io/npm/v/@rollup/pluginutils
|
||||
[npm-url]: https://www.npmjs.com/package/@rollup/pluginutils
|
||||
[size]: https://packagephobia.now.sh/badge?p=@rollup/pluginutils
|
||||
[size-url]: https://packagephobia.now.sh/result?p=@rollup/pluginutils
|
||||
|
||||
[![npm][npm]][npm-url]
|
||||
[![size][size]][size-url]
|
||||
[](https://liberamanifesto.com)
|
||||
|
||||
# @rollup/pluginutils
|
||||
|
||||
A set of utility functions commonly used by 🍣 Rollup plugins.
|
||||
|
||||
## Requirements
|
||||
|
||||
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.0.0+) and Rollup v1.20.0+.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```console
|
||||
npm install @rollup/pluginutils --save-dev
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import utils from '@rollup/pluginutils';
|
||||
//...
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Available utility functions are listed below:
|
||||
|
||||
_Note: Parameter names immediately followed by a `?` indicate that the parameter is optional._
|
||||
|
||||
### addExtension
|
||||
|
||||
Adds an extension to a module ID if one does not exist.
|
||||
|
||||
Parameters: `(filename: String, ext?: String)`<br>
|
||||
Returns: `String`
|
||||
|
||||
```js
|
||||
import { addExtension } from '@rollup/pluginutils';
|
||||
|
||||
export default function myPlugin(options = {}) {
|
||||
return {
|
||||
resolveId(code, id) {
|
||||
// only adds an extension if there isn't one already
|
||||
id = addExtension(id); // `foo` -> `foo.js`, `foo.js -> foo.js`
|
||||
id = addExtension(id, '.myext'); // `foo` -> `foo.myext`, `foo.js -> `foo.js`
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### attachScopes
|
||||
|
||||
Attaches `Scope` objects to the relevant nodes of an AST. Each `Scope` object has a `scope.contains(name)` method that returns `true` if a given name is defined in the current scope or a parent scope.
|
||||
|
||||
Parameters: `(ast: Node, propertyName?: String)`<br>
|
||||
Returns: `Object`
|
||||
|
||||
See [rollup-plugin-inject](https://github.com/rollup/rollup-plugin-inject) or [rollup-plugin-commonjs](https://github.com/rollup/rollup-plugin-commonjs) for an example of usage.
|
||||
|
||||
```js
|
||||
import { attachScopes } from '@rollup/pluginutils';
|
||||
import { walk } from 'estree-walker';
|
||||
|
||||
export default function myPlugin(options = {}) {
|
||||
return {
|
||||
transform(code) {
|
||||
const ast = this.parse(code);
|
||||
|
||||
let scope = attachScopes(ast, 'scope');
|
||||
|
||||
walk(ast, {
|
||||
enter(node) {
|
||||
if (node.scope) scope = node.scope;
|
||||
|
||||
if (!scope.contains('foo')) {
|
||||
// `foo` is not defined, so if we encounter it,
|
||||
// we assume it's a global
|
||||
}
|
||||
},
|
||||
leave(node) {
|
||||
if (node.scope) scope = scope.parent;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### createFilter
|
||||
|
||||
Constructs a filter function which can be used to determine whether or not certain modules should be operated upon.
|
||||
|
||||
Parameters: `(include?: <minmatch>, exclude?: <minmatch>, options?: Object)`<br>
|
||||
Returns: `String`
|
||||
|
||||
#### `include` and `exclude`
|
||||
|
||||
Type: `String | RegExp | Array[...String|RegExp]`<br>
|
||||
|
||||
A valid [`minimatch`](https://www.npmjs.com/package/minimatch) pattern, or array of patterns. If `options.include` is omitted or has zero length, filter will return `true` by default. Otherwise, an ID must match one or more of the `minimatch` patterns, and must not match any of the `options.exclude` patterns.
|
||||
|
||||
#### `options`
|
||||
|
||||
##### `resolve`
|
||||
|
||||
Type: `String | Boolean | null`
|
||||
|
||||
Optionally resolves the patterns against a directory other than `process.cwd()`. If a `String` is specified, then the value will be used as the base directory. Relative paths will be resolved against `process.cwd()` first. If `false`, then the patterns will not be resolved against any directory. This can be useful if you want to create a filter for virtual module names.
|
||||
|
||||
#### Usage
|
||||
|
||||
```js
|
||||
import { createFilter } from '@rollup/pluginutils';
|
||||
|
||||
export default function myPlugin(options = {}) {
|
||||
// assume that the myPlugin accepts options of `options.include` and `options.exclude`
|
||||
var filter = createFilter(options.include, options.exclude, {
|
||||
resolve: '/my/base/dir'
|
||||
});
|
||||
|
||||
return {
|
||||
transform(code, id) {
|
||||
if (!filter(id)) return;
|
||||
|
||||
// proceed with the transformation...
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### dataToEsm
|
||||
|
||||
Transforms objects into tree-shakable ES Module imports.
|
||||
|
||||
Parameters: `(data: Object)`<br>
|
||||
Returns: `String`
|
||||
|
||||
#### `data`
|
||||
|
||||
Type: `Object`
|
||||
|
||||
An object to transform into an ES module.
|
||||
|
||||
#### Usage
|
||||
|
||||
```js
|
||||
import { dataToEsm } from '@rollup/pluginutils';
|
||||
|
||||
const esModuleSource = dataToEsm(
|
||||
{
|
||||
custom: 'data',
|
||||
to: ['treeshake']
|
||||
},
|
||||
{
|
||||
compact: false,
|
||||
indent: '\t',
|
||||
preferConst: false,
|
||||
objectShorthand: false,
|
||||
namedExports: true
|
||||
}
|
||||
);
|
||||
/*
|
||||
Outputs the string ES module source:
|
||||
export const custom = 'data';
|
||||
export const to = ['treeshake'];
|
||||
export default { custom, to };
|
||||
*/
|
||||
```
|
||||
|
||||
### extractAssignedNames
|
||||
|
||||
Extracts the names of all assignment targets based upon specified patterns.
|
||||
|
||||
Parameters: `(param: Node)`<br>
|
||||
Returns: `Array[...String]`
|
||||
|
||||
#### `param`
|
||||
|
||||
Type: `Node`
|
||||
|
||||
An `acorn` AST Node.
|
||||
|
||||
#### Usage
|
||||
|
||||
```js
|
||||
import { extractAssignedNames } from '@rollup/pluginutils';
|
||||
import { walk } from 'estree-walker';
|
||||
|
||||
export default function myPlugin(options = {}) {
|
||||
return {
|
||||
transform(code) {
|
||||
const ast = this.parse(code);
|
||||
|
||||
walk(ast, {
|
||||
enter(node) {
|
||||
if (node.type === 'VariableDeclarator') {
|
||||
const declaredNames = extractAssignedNames(node.id);
|
||||
// do something with the declared names
|
||||
// e.g. for `const {x, y: z} = ... => declaredNames = ['x', 'z']
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### makeLegalIdentifier
|
||||
|
||||
Constructs a bundle-safe identifier from a `String`.
|
||||
|
||||
Parameters: `(str: String)`<br>
|
||||
Returns: `String`
|
||||
|
||||
#### Usage
|
||||
|
||||
```js
|
||||
import { makeLegalIdentifier } from '@rollup/pluginutils';
|
||||
|
||||
makeLegalIdentifier('foo-bar'); // 'foo_bar'
|
||||
makeLegalIdentifier('typeof'); // '_typeof'
|
||||
```
|
||||
|
||||
## Meta
|
||||
|
||||
[CONTRIBUTING](/.github/CONTRIBUTING.md)
|
||||
|
||||
[LICENSE (MIT)](/LICENSE)
|
447
node_modules/@rollup/pluginutils/dist/cjs/index.js
generated
vendored
447
node_modules/@rollup/pluginutils/dist/cjs/index.js
generated
vendored
|
@ -1,447 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
|
||||
var path = require('path');
|
||||
var pm = _interopDefault(require('picomatch'));
|
||||
|
||||
const addExtension = function addExtension(filename, ext = '.js') {
|
||||
let result = `${filename}`;
|
||||
if (!path.extname(filename))
|
||||
result += ext;
|
||||
return result;
|
||||
};
|
||||
|
||||
function walk(ast, { enter, leave }) {
|
||||
return visit(ast, null, enter, leave);
|
||||
}
|
||||
|
||||
let should_skip = false;
|
||||
let should_remove = false;
|
||||
let replacement = null;
|
||||
const context = {
|
||||
skip: () => should_skip = true,
|
||||
remove: () => should_remove = true,
|
||||
replace: (node) => replacement = node
|
||||
};
|
||||
|
||||
function replace(parent, prop, index, node) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop][index] = node;
|
||||
} else {
|
||||
parent[prop] = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove(parent, prop, index) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop].splice(index, 1);
|
||||
} else {
|
||||
delete parent[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function visit(
|
||||
node,
|
||||
parent,
|
||||
enter,
|
||||
leave,
|
||||
prop,
|
||||
index
|
||||
) {
|
||||
if (node) {
|
||||
if (enter) {
|
||||
const _should_skip = should_skip;
|
||||
const _should_remove = should_remove;
|
||||
const _replacement = replacement;
|
||||
should_skip = false;
|
||||
should_remove = false;
|
||||
replacement = null;
|
||||
|
||||
enter.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const skipped = should_skip;
|
||||
const removed = should_remove;
|
||||
|
||||
should_skip = _should_skip;
|
||||
should_remove = _should_remove;
|
||||
replacement = _replacement;
|
||||
|
||||
if (skipped) return node;
|
||||
if (removed) return null;
|
||||
}
|
||||
|
||||
for (const key in node) {
|
||||
const value = (node )[key];
|
||||
|
||||
if (typeof value !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (Array.isArray(value)) {
|
||||
for (let j = 0, k = 0; j < value.length; j += 1, k += 1) {
|
||||
if (value[j] !== null && typeof value[j].type === 'string') {
|
||||
if (!visit(value[j], node, enter, leave, key, k)) {
|
||||
// removed
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (value !== null && typeof value.type === 'string') {
|
||||
visit(value, node, enter, leave, key, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (leave) {
|
||||
const _replacement = replacement;
|
||||
const _should_remove = should_remove;
|
||||
replacement = null;
|
||||
should_remove = false;
|
||||
|
||||
leave.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const removed = should_remove;
|
||||
|
||||
replacement = _replacement;
|
||||
should_remove = _should_remove;
|
||||
|
||||
if (removed) return null;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
const extractors = {
|
||||
ArrayPattern(names, param) {
|
||||
for (const element of param.elements) {
|
||||
if (element)
|
||||
extractors[element.type](names, element);
|
||||
}
|
||||
},
|
||||
AssignmentPattern(names, param) {
|
||||
extractors[param.left.type](names, param.left);
|
||||
},
|
||||
Identifier(names, param) {
|
||||
names.push(param.name);
|
||||
},
|
||||
MemberExpression() { },
|
||||
ObjectPattern(names, param) {
|
||||
for (const prop of param.properties) {
|
||||
// @ts-ignore Typescript reports that this is not a valid type
|
||||
if (prop.type === 'RestElement') {
|
||||
extractors.RestElement(names, prop);
|
||||
}
|
||||
else {
|
||||
extractors[prop.value.type](names, prop.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
RestElement(names, param) {
|
||||
extractors[param.argument.type](names, param.argument);
|
||||
}
|
||||
};
|
||||
const extractAssignedNames = function extractAssignedNames(param) {
|
||||
const names = [];
|
||||
extractors[param.type](names, param);
|
||||
return names;
|
||||
};
|
||||
|
||||
const blockDeclarations = {
|
||||
const: true,
|
||||
let: true
|
||||
};
|
||||
class Scope {
|
||||
constructor(options = {}) {
|
||||
this.parent = options.parent;
|
||||
this.isBlockScope = !!options.block;
|
||||
this.declarations = Object.create(null);
|
||||
if (options.params) {
|
||||
options.params.forEach((param) => {
|
||||
extractAssignedNames(param).forEach((name) => {
|
||||
this.declarations[name] = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
addDeclaration(node, isBlockDeclaration, isVar) {
|
||||
if (!isBlockDeclaration && this.isBlockScope) {
|
||||
// it's a `var` or function node, and this
|
||||
// is a block scope, so we need to go up
|
||||
this.parent.addDeclaration(node, isBlockDeclaration, isVar);
|
||||
}
|
||||
else if (node.id) {
|
||||
extractAssignedNames(node.id).forEach((name) => {
|
||||
this.declarations[name] = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
contains(name) {
|
||||
return this.declarations[name] || (this.parent ? this.parent.contains(name) : false);
|
||||
}
|
||||
}
|
||||
const attachScopes = function attachScopes(ast, propertyName = 'scope') {
|
||||
let scope = new Scope();
|
||||
walk(ast, {
|
||||
enter(n, parent) {
|
||||
const node = n;
|
||||
// function foo () {...}
|
||||
// class Foo {...}
|
||||
if (/(Function|Class)Declaration/.test(node.type)) {
|
||||
scope.addDeclaration(node, false, false);
|
||||
}
|
||||
// var foo = 1
|
||||
if (node.type === 'VariableDeclaration') {
|
||||
const { kind } = node;
|
||||
const isBlockDeclaration = blockDeclarations[kind];
|
||||
// don't add const/let declarations in the body of a for loop #113
|
||||
const parentType = parent ? parent.type : '';
|
||||
if (!(isBlockDeclaration && /ForOfStatement/.test(parentType))) {
|
||||
node.declarations.forEach((declaration) => {
|
||||
scope.addDeclaration(declaration, isBlockDeclaration, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
let newScope;
|
||||
// create new function scope
|
||||
if (/Function/.test(node.type)) {
|
||||
const func = node;
|
||||
newScope = new Scope({
|
||||
parent: scope,
|
||||
block: false,
|
||||
params: func.params
|
||||
});
|
||||
// named function expressions - the name is considered
|
||||
// part of the function's scope
|
||||
if (func.type === 'FunctionExpression' && func.id) {
|
||||
newScope.addDeclaration(func, false, false);
|
||||
}
|
||||
}
|
||||
// create new block scope
|
||||
if (node.type === 'BlockStatement' && !/Function/.test(parent.type)) {
|
||||
newScope = new Scope({
|
||||
parent: scope,
|
||||
block: true
|
||||
});
|
||||
}
|
||||
// catch clause has its own block scope
|
||||
if (node.type === 'CatchClause') {
|
||||
newScope = new Scope({
|
||||
parent: scope,
|
||||
params: node.param ? [node.param] : [],
|
||||
block: true
|
||||
});
|
||||
}
|
||||
if (newScope) {
|
||||
Object.defineProperty(node, propertyName, {
|
||||
value: newScope,
|
||||
configurable: true
|
||||
});
|
||||
scope = newScope;
|
||||
}
|
||||
},
|
||||
leave(n) {
|
||||
const node = n;
|
||||
if (node[propertyName])
|
||||
scope = scope.parent;
|
||||
}
|
||||
});
|
||||
return scope;
|
||||
};
|
||||
|
||||
// Helper since Typescript can't detect readonly arrays with Array.isArray
|
||||
function isArray(arg) {
|
||||
return Array.isArray(arg);
|
||||
}
|
||||
function ensureArray(thing) {
|
||||
if (isArray(thing))
|
||||
return thing;
|
||||
if (thing == null)
|
||||
return [];
|
||||
return [thing];
|
||||
}
|
||||
|
||||
function getMatcherString(id, resolutionBase) {
|
||||
if (resolutionBase === false) {
|
||||
return id;
|
||||
}
|
||||
// resolve('') is valid and will default to process.cwd()
|
||||
const basePath = path.resolve(resolutionBase || '')
|
||||
.split(path.sep)
|
||||
.join('/')
|
||||
// escape all possible (posix + win) path characters that might interfere with regex
|
||||
.replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
|
||||
// Note that we use posix.join because:
|
||||
// 1. the basePath has been normalized to use /
|
||||
// 2. the incoming glob (id) matcher, also uses /
|
||||
// otherwise Node will force backslash (\) on windows
|
||||
return path.posix.join(basePath, id);
|
||||
}
|
||||
const createFilter = function createFilter(include, exclude, options) {
|
||||
const resolutionBase = options && options.resolve;
|
||||
const getMatcher = (id) => id instanceof RegExp
|
||||
? id
|
||||
: {
|
||||
test: (what) => {
|
||||
// this refactor is a tad overly verbose but makes for easy debugging
|
||||
const pattern = getMatcherString(id, resolutionBase);
|
||||
const fn = pm(pattern, { dot: true });
|
||||
const result = fn(what);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
const includeMatchers = ensureArray(include).map(getMatcher);
|
||||
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
||||
return function result(id) {
|
||||
if (typeof id !== 'string')
|
||||
return false;
|
||||
if (/\0/.test(id))
|
||||
return false;
|
||||
const pathId = id.split(path.sep).join('/');
|
||||
for (let i = 0; i < excludeMatchers.length; ++i) {
|
||||
const matcher = excludeMatchers[i];
|
||||
if (matcher.test(pathId))
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < includeMatchers.length; ++i) {
|
||||
const matcher = includeMatchers[i];
|
||||
if (matcher.test(pathId))
|
||||
return true;
|
||||
}
|
||||
return !includeMatchers.length;
|
||||
};
|
||||
};
|
||||
|
||||
const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
|
||||
const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
|
||||
const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
|
||||
forbiddenIdentifiers.add('');
|
||||
const makeLegalIdentifier = function makeLegalIdentifier(str) {
|
||||
let identifier = str
|
||||
.replace(/-(\w)/g, (_, letter) => letter.toUpperCase())
|
||||
.replace(/[^$_a-zA-Z0-9]/g, '_');
|
||||
if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) {
|
||||
identifier = `_${identifier}`;
|
||||
}
|
||||
return identifier || '_';
|
||||
};
|
||||
|
||||
function stringify(obj) {
|
||||
return (JSON.stringify(obj) || 'undefined').replace(/[\u2028\u2029]/g, (char) => `\\u${`000${char.charCodeAt(0).toString(16)}`.slice(-4)}`);
|
||||
}
|
||||
function serializeArray(arr, indent, baseIndent) {
|
||||
let output = '[';
|
||||
const separator = indent ? `\n${baseIndent}${indent}` : '';
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const key = arr[i];
|
||||
output += `${i > 0 ? ',' : ''}${separator}${serialize(key, indent, baseIndent + indent)}`;
|
||||
}
|
||||
return `${output}${indent ? `\n${baseIndent}` : ''}]`;
|
||||
}
|
||||
function serializeObject(obj, indent, baseIndent) {
|
||||
let output = '{';
|
||||
const separator = indent ? `\n${baseIndent}${indent}` : '';
|
||||
const entries = Object.entries(obj);
|
||||
for (let i = 0; i < entries.length; i++) {
|
||||
const [key, value] = entries[i];
|
||||
const stringKey = makeLegalIdentifier(key) === key ? key : stringify(key);
|
||||
output += `${i > 0 ? ',' : ''}${separator}${stringKey}:${indent ? ' ' : ''}${serialize(value, indent, baseIndent + indent)}`;
|
||||
}
|
||||
return `${output}${indent ? `\n${baseIndent}` : ''}}`;
|
||||
}
|
||||
function serialize(obj, indent, baseIndent) {
|
||||
if (obj === Infinity)
|
||||
return 'Infinity';
|
||||
if (obj === -Infinity)
|
||||
return '-Infinity';
|
||||
if (obj === 0 && 1 / obj === -Infinity)
|
||||
return '-0';
|
||||
if (obj instanceof Date)
|
||||
return `new Date(${obj.getTime()})`;
|
||||
if (obj instanceof RegExp)
|
||||
return obj.toString();
|
||||
if (obj !== obj)
|
||||
return 'NaN'; // eslint-disable-line no-self-compare
|
||||
if (Array.isArray(obj))
|
||||
return serializeArray(obj, indent, baseIndent);
|
||||
if (obj === null)
|
||||
return 'null';
|
||||
if (typeof obj === 'object')
|
||||
return serializeObject(obj, indent, baseIndent);
|
||||
return stringify(obj);
|
||||
}
|
||||
const dataToEsm = function dataToEsm(data, options = {}) {
|
||||
const t = options.compact ? '' : 'indent' in options ? options.indent : '\t';
|
||||
const _ = options.compact ? '' : ' ';
|
||||
const n = options.compact ? '' : '\n';
|
||||
const declarationType = options.preferConst ? 'const' : 'var';
|
||||
if (options.namedExports === false ||
|
||||
typeof data !== 'object' ||
|
||||
Array.isArray(data) ||
|
||||
data instanceof Date ||
|
||||
data instanceof RegExp ||
|
||||
data === null) {
|
||||
const code = serialize(data, options.compact ? null : t, '');
|
||||
const magic = _ || (/^[{[\-\/]/.test(code) ? '' : ' '); // eslint-disable-line no-useless-escape
|
||||
return `export default${magic}${code};`;
|
||||
}
|
||||
let namedExportCode = '';
|
||||
const defaultExportRows = [];
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
if (key === makeLegalIdentifier(key)) {
|
||||
if (options.objectShorthand)
|
||||
defaultExportRows.push(key);
|
||||
else
|
||||
defaultExportRows.push(`${key}:${_}${key}`);
|
||||
namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize(value, options.compact ? null : t, '')};${n}`;
|
||||
}
|
||||
else {
|
||||
defaultExportRows.push(`${stringify(key)}:${_}${serialize(value, options.compact ? null : t, '')}`);
|
||||
}
|
||||
}
|
||||
return `${namedExportCode}export default${_}{${n}${t}${defaultExportRows.join(`,${n}${t}`)}${n}};${n}`;
|
||||
};
|
||||
|
||||
// TODO: remove this in next major
|
||||
var index = {
|
||||
addExtension,
|
||||
attachScopes,
|
||||
createFilter,
|
||||
dataToEsm,
|
||||
extractAssignedNames,
|
||||
makeLegalIdentifier
|
||||
};
|
||||
|
||||
exports.addExtension = addExtension;
|
||||
exports.attachScopes = attachScopes;
|
||||
exports.createFilter = createFilter;
|
||||
exports.dataToEsm = dataToEsm;
|
||||
exports.default = index;
|
||||
exports.extractAssignedNames = extractAssignedNames;
|
||||
exports.makeLegalIdentifier = makeLegalIdentifier;
|
436
node_modules/@rollup/pluginutils/dist/es/index.js
generated
vendored
436
node_modules/@rollup/pluginutils/dist/es/index.js
generated
vendored
|
@ -1,436 +0,0 @@
|
|||
import { extname, sep, resolve, posix } from 'path';
|
||||
import pm from 'picomatch';
|
||||
|
||||
const addExtension = function addExtension(filename, ext = '.js') {
|
||||
let result = `${filename}`;
|
||||
if (!extname(filename))
|
||||
result += ext;
|
||||
return result;
|
||||
};
|
||||
|
||||
function walk(ast, { enter, leave }) {
|
||||
return visit(ast, null, enter, leave);
|
||||
}
|
||||
|
||||
let should_skip = false;
|
||||
let should_remove = false;
|
||||
let replacement = null;
|
||||
const context = {
|
||||
skip: () => should_skip = true,
|
||||
remove: () => should_remove = true,
|
||||
replace: (node) => replacement = node
|
||||
};
|
||||
|
||||
function replace(parent, prop, index, node) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop][index] = node;
|
||||
} else {
|
||||
parent[prop] = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove(parent, prop, index) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop].splice(index, 1);
|
||||
} else {
|
||||
delete parent[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function visit(
|
||||
node,
|
||||
parent,
|
||||
enter,
|
||||
leave,
|
||||
prop,
|
||||
index
|
||||
) {
|
||||
if (node) {
|
||||
if (enter) {
|
||||
const _should_skip = should_skip;
|
||||
const _should_remove = should_remove;
|
||||
const _replacement = replacement;
|
||||
should_skip = false;
|
||||
should_remove = false;
|
||||
replacement = null;
|
||||
|
||||
enter.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const skipped = should_skip;
|
||||
const removed = should_remove;
|
||||
|
||||
should_skip = _should_skip;
|
||||
should_remove = _should_remove;
|
||||
replacement = _replacement;
|
||||
|
||||
if (skipped) return node;
|
||||
if (removed) return null;
|
||||
}
|
||||
|
||||
for (const key in node) {
|
||||
const value = (node )[key];
|
||||
|
||||
if (typeof value !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (Array.isArray(value)) {
|
||||
for (let j = 0, k = 0; j < value.length; j += 1, k += 1) {
|
||||
if (value[j] !== null && typeof value[j].type === 'string') {
|
||||
if (!visit(value[j], node, enter, leave, key, k)) {
|
||||
// removed
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (value !== null && typeof value.type === 'string') {
|
||||
visit(value, node, enter, leave, key, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (leave) {
|
||||
const _replacement = replacement;
|
||||
const _should_remove = should_remove;
|
||||
replacement = null;
|
||||
should_remove = false;
|
||||
|
||||
leave.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const removed = should_remove;
|
||||
|
||||
replacement = _replacement;
|
||||
should_remove = _should_remove;
|
||||
|
||||
if (removed) return null;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
const extractors = {
|
||||
ArrayPattern(names, param) {
|
||||
for (const element of param.elements) {
|
||||
if (element)
|
||||
extractors[element.type](names, element);
|
||||
}
|
||||
},
|
||||
AssignmentPattern(names, param) {
|
||||
extractors[param.left.type](names, param.left);
|
||||
},
|
||||
Identifier(names, param) {
|
||||
names.push(param.name);
|
||||
},
|
||||
MemberExpression() { },
|
||||
ObjectPattern(names, param) {
|
||||
for (const prop of param.properties) {
|
||||
// @ts-ignore Typescript reports that this is not a valid type
|
||||
if (prop.type === 'RestElement') {
|
||||
extractors.RestElement(names, prop);
|
||||
}
|
||||
else {
|
||||
extractors[prop.value.type](names, prop.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
RestElement(names, param) {
|
||||
extractors[param.argument.type](names, param.argument);
|
||||
}
|
||||
};
|
||||
const extractAssignedNames = function extractAssignedNames(param) {
|
||||
const names = [];
|
||||
extractors[param.type](names, param);
|
||||
return names;
|
||||
};
|
||||
|
||||
const blockDeclarations = {
|
||||
const: true,
|
||||
let: true
|
||||
};
|
||||
class Scope {
|
||||
constructor(options = {}) {
|
||||
this.parent = options.parent;
|
||||
this.isBlockScope = !!options.block;
|
||||
this.declarations = Object.create(null);
|
||||
if (options.params) {
|
||||
options.params.forEach((param) => {
|
||||
extractAssignedNames(param).forEach((name) => {
|
||||
this.declarations[name] = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
addDeclaration(node, isBlockDeclaration, isVar) {
|
||||
if (!isBlockDeclaration && this.isBlockScope) {
|
||||
// it's a `var` or function node, and this
|
||||
// is a block scope, so we need to go up
|
||||
this.parent.addDeclaration(node, isBlockDeclaration, isVar);
|
||||
}
|
||||
else if (node.id) {
|
||||
extractAssignedNames(node.id).forEach((name) => {
|
||||
this.declarations[name] = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
contains(name) {
|
||||
return this.declarations[name] || (this.parent ? this.parent.contains(name) : false);
|
||||
}
|
||||
}
|
||||
const attachScopes = function attachScopes(ast, propertyName = 'scope') {
|
||||
let scope = new Scope();
|
||||
walk(ast, {
|
||||
enter(n, parent) {
|
||||
const node = n;
|
||||
// function foo () {...}
|
||||
// class Foo {...}
|
||||
if (/(Function|Class)Declaration/.test(node.type)) {
|
||||
scope.addDeclaration(node, false, false);
|
||||
}
|
||||
// var foo = 1
|
||||
if (node.type === 'VariableDeclaration') {
|
||||
const { kind } = node;
|
||||
const isBlockDeclaration = blockDeclarations[kind];
|
||||
// don't add const/let declarations in the body of a for loop #113
|
||||
const parentType = parent ? parent.type : '';
|
||||
if (!(isBlockDeclaration && /ForOfStatement/.test(parentType))) {
|
||||
node.declarations.forEach((declaration) => {
|
||||
scope.addDeclaration(declaration, isBlockDeclaration, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
let newScope;
|
||||
// create new function scope
|
||||
if (/Function/.test(node.type)) {
|
||||
const func = node;
|
||||
newScope = new Scope({
|
||||
parent: scope,
|
||||
block: false,
|
||||
params: func.params
|
||||
});
|
||||
// named function expressions - the name is considered
|
||||
// part of the function's scope
|
||||
if (func.type === 'FunctionExpression' && func.id) {
|
||||
newScope.addDeclaration(func, false, false);
|
||||
}
|
||||
}
|
||||
// create new block scope
|
||||
if (node.type === 'BlockStatement' && !/Function/.test(parent.type)) {
|
||||
newScope = new Scope({
|
||||
parent: scope,
|
||||
block: true
|
||||
});
|
||||
}
|
||||
// catch clause has its own block scope
|
||||
if (node.type === 'CatchClause') {
|
||||
newScope = new Scope({
|
||||
parent: scope,
|
||||
params: node.param ? [node.param] : [],
|
||||
block: true
|
||||
});
|
||||
}
|
||||
if (newScope) {
|
||||
Object.defineProperty(node, propertyName, {
|
||||
value: newScope,
|
||||
configurable: true
|
||||
});
|
||||
scope = newScope;
|
||||
}
|
||||
},
|
||||
leave(n) {
|
||||
const node = n;
|
||||
if (node[propertyName])
|
||||
scope = scope.parent;
|
||||
}
|
||||
});
|
||||
return scope;
|
||||
};
|
||||
|
||||
// Helper since Typescript can't detect readonly arrays with Array.isArray
|
||||
function isArray(arg) {
|
||||
return Array.isArray(arg);
|
||||
}
|
||||
function ensureArray(thing) {
|
||||
if (isArray(thing))
|
||||
return thing;
|
||||
if (thing == null)
|
||||
return [];
|
||||
return [thing];
|
||||
}
|
||||
|
||||
function getMatcherString(id, resolutionBase) {
|
||||
if (resolutionBase === false) {
|
||||
return id;
|
||||
}
|
||||
// resolve('') is valid and will default to process.cwd()
|
||||
const basePath = resolve(resolutionBase || '')
|
||||
.split(sep)
|
||||
.join('/')
|
||||
// escape all possible (posix + win) path characters that might interfere with regex
|
||||
.replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
|
||||
// Note that we use posix.join because:
|
||||
// 1. the basePath has been normalized to use /
|
||||
// 2. the incoming glob (id) matcher, also uses /
|
||||
// otherwise Node will force backslash (\) on windows
|
||||
return posix.join(basePath, id);
|
||||
}
|
||||
const createFilter = function createFilter(include, exclude, options) {
|
||||
const resolutionBase = options && options.resolve;
|
||||
const getMatcher = (id) => id instanceof RegExp
|
||||
? id
|
||||
: {
|
||||
test: (what) => {
|
||||
// this refactor is a tad overly verbose but makes for easy debugging
|
||||
const pattern = getMatcherString(id, resolutionBase);
|
||||
const fn = pm(pattern, { dot: true });
|
||||
const result = fn(what);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
const includeMatchers = ensureArray(include).map(getMatcher);
|
||||
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
||||
return function result(id) {
|
||||
if (typeof id !== 'string')
|
||||
return false;
|
||||
if (/\0/.test(id))
|
||||
return false;
|
||||
const pathId = id.split(sep).join('/');
|
||||
for (let i = 0; i < excludeMatchers.length; ++i) {
|
||||
const matcher = excludeMatchers[i];
|
||||
if (matcher.test(pathId))
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < includeMatchers.length; ++i) {
|
||||
const matcher = includeMatchers[i];
|
||||
if (matcher.test(pathId))
|
||||
return true;
|
||||
}
|
||||
return !includeMatchers.length;
|
||||
};
|
||||
};
|
||||
|
||||
const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
|
||||
const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
|
||||
const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
|
||||
forbiddenIdentifiers.add('');
|
||||
const makeLegalIdentifier = function makeLegalIdentifier(str) {
|
||||
let identifier = str
|
||||
.replace(/-(\w)/g, (_, letter) => letter.toUpperCase())
|
||||
.replace(/[^$_a-zA-Z0-9]/g, '_');
|
||||
if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) {
|
||||
identifier = `_${identifier}`;
|
||||
}
|
||||
return identifier || '_';
|
||||
};
|
||||
|
||||
function stringify(obj) {
|
||||
return (JSON.stringify(obj) || 'undefined').replace(/[\u2028\u2029]/g, (char) => `\\u${`000${char.charCodeAt(0).toString(16)}`.slice(-4)}`);
|
||||
}
|
||||
function serializeArray(arr, indent, baseIndent) {
|
||||
let output = '[';
|
||||
const separator = indent ? `\n${baseIndent}${indent}` : '';
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const key = arr[i];
|
||||
output += `${i > 0 ? ',' : ''}${separator}${serialize(key, indent, baseIndent + indent)}`;
|
||||
}
|
||||
return `${output}${indent ? `\n${baseIndent}` : ''}]`;
|
||||
}
|
||||
function serializeObject(obj, indent, baseIndent) {
|
||||
let output = '{';
|
||||
const separator = indent ? `\n${baseIndent}${indent}` : '';
|
||||
const entries = Object.entries(obj);
|
||||
for (let i = 0; i < entries.length; i++) {
|
||||
const [key, value] = entries[i];
|
||||
const stringKey = makeLegalIdentifier(key) === key ? key : stringify(key);
|
||||
output += `${i > 0 ? ',' : ''}${separator}${stringKey}:${indent ? ' ' : ''}${serialize(value, indent, baseIndent + indent)}`;
|
||||
}
|
||||
return `${output}${indent ? `\n${baseIndent}` : ''}}`;
|
||||
}
|
||||
function serialize(obj, indent, baseIndent) {
|
||||
if (obj === Infinity)
|
||||
return 'Infinity';
|
||||
if (obj === -Infinity)
|
||||
return '-Infinity';
|
||||
if (obj === 0 && 1 / obj === -Infinity)
|
||||
return '-0';
|
||||
if (obj instanceof Date)
|
||||
return `new Date(${obj.getTime()})`;
|
||||
if (obj instanceof RegExp)
|
||||
return obj.toString();
|
||||
if (obj !== obj)
|
||||
return 'NaN'; // eslint-disable-line no-self-compare
|
||||
if (Array.isArray(obj))
|
||||
return serializeArray(obj, indent, baseIndent);
|
||||
if (obj === null)
|
||||
return 'null';
|
||||
if (typeof obj === 'object')
|
||||
return serializeObject(obj, indent, baseIndent);
|
||||
return stringify(obj);
|
||||
}
|
||||
const dataToEsm = function dataToEsm(data, options = {}) {
|
||||
const t = options.compact ? '' : 'indent' in options ? options.indent : '\t';
|
||||
const _ = options.compact ? '' : ' ';
|
||||
const n = options.compact ? '' : '\n';
|
||||
const declarationType = options.preferConst ? 'const' : 'var';
|
||||
if (options.namedExports === false ||
|
||||
typeof data !== 'object' ||
|
||||
Array.isArray(data) ||
|
||||
data instanceof Date ||
|
||||
data instanceof RegExp ||
|
||||
data === null) {
|
||||
const code = serialize(data, options.compact ? null : t, '');
|
||||
const magic = _ || (/^[{[\-\/]/.test(code) ? '' : ' '); // eslint-disable-line no-useless-escape
|
||||
return `export default${magic}${code};`;
|
||||
}
|
||||
let namedExportCode = '';
|
||||
const defaultExportRows = [];
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
if (key === makeLegalIdentifier(key)) {
|
||||
if (options.objectShorthand)
|
||||
defaultExportRows.push(key);
|
||||
else
|
||||
defaultExportRows.push(`${key}:${_}${key}`);
|
||||
namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize(value, options.compact ? null : t, '')};${n}`;
|
||||
}
|
||||
else {
|
||||
defaultExportRows.push(`${stringify(key)}:${_}${serialize(value, options.compact ? null : t, '')}`);
|
||||
}
|
||||
}
|
||||
return `${namedExportCode}export default${_}{${n}${t}${defaultExportRows.join(`,${n}${t}`)}${n}};${n}`;
|
||||
};
|
||||
|
||||
// TODO: remove this in next major
|
||||
var index = {
|
||||
addExtension,
|
||||
attachScopes,
|
||||
createFilter,
|
||||
dataToEsm,
|
||||
extractAssignedNames,
|
||||
makeLegalIdentifier
|
||||
};
|
||||
|
||||
export default index;
|
||||
export { addExtension, attachScopes, createFilter, dataToEsm, extractAssignedNames, makeLegalIdentifier };
|
1
node_modules/@rollup/pluginutils/dist/es/package.json
generated
vendored
1
node_modules/@rollup/pluginutils/dist/es/package.json
generated
vendored
|
@ -1 +0,0 @@
|
|||
{"type":"module"}
|
91
node_modules/@rollup/pluginutils/package.json
generated
vendored
91
node_modules/@rollup/pluginutils/package.json
generated
vendored
|
@ -1,91 +0,0 @@
|
|||
{
|
||||
"name": "@rollup/pluginutils",
|
||||
"version": "3.1.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"description": "A set of utility functions commonly used by Rollup plugins",
|
||||
"license": "MIT",
|
||||
"repository": "rollup/plugins",
|
||||
"author": "Rich Harris <richard.a.harris@gmail.com>",
|
||||
"homepage": "https://github.com/rollup/plugins/tree/master/packages/pluginutils#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/rollup/plugins/issues"
|
||||
},
|
||||
"main": "./dist/cjs/index.js",
|
||||
"engines": {
|
||||
"node": ">= 8.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
|
||||
"ci:lint": "pnpm run build && pnpm run lint",
|
||||
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
|
||||
"ci:test": "pnpm run test -- --verbose",
|
||||
"lint": "pnpm run lint:js && pnpm run lint:docs && pnpm run lint:package",
|
||||
"lint:docs": "prettier --single-quote --write README.md",
|
||||
"lint:js": "eslint --fix --cache src test types --ext .js,.ts",
|
||||
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
|
||||
"prebuild": "del-cli dist",
|
||||
"prepare": "pnpm run build",
|
||||
"prepublishOnly": "pnpm run lint && pnpm run build",
|
||||
"pretest": "pnpm run build -- --sourcemap",
|
||||
"test": "ava"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"types",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"keywords": [
|
||||
"rollup",
|
||||
"plugin",
|
||||
"utils"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"rollup": "^1.20.0||^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/estree": "0.0.39",
|
||||
"estree-walker": "^1.0.1",
|
||||
"picomatch": "^2.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^11.0.2",
|
||||
"@rollup/plugin-node-resolve": "^7.1.1",
|
||||
"@rollup/plugin-typescript": "^3.0.0",
|
||||
"@types/jest": "^24.9.0",
|
||||
"@types/node": "^12.12.25",
|
||||
"@types/picomatch": "^2.2.1",
|
||||
"typescript": "^3.7.5"
|
||||
},
|
||||
"ava": {
|
||||
"compileEnhancements": false,
|
||||
"extensions": [
|
||||
"ts"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
],
|
||||
"files": [
|
||||
"!**/fixtures/**",
|
||||
"!**/helpers/**",
|
||||
"!**/recipes/**",
|
||||
"!**/types.ts"
|
||||
]
|
||||
},
|
||||
"exports": {
|
||||
"require": "./dist/cjs/index.js",
|
||||
"import": "./dist/es/index.js"
|
||||
},
|
||||
"module": "./dist/es/index.js",
|
||||
"nyc": {
|
||||
"extension": [
|
||||
".js",
|
||||
".ts"
|
||||
]
|
||||
},
|
||||
"type": "commonjs",
|
||||
"types": "types/index.d.ts"
|
||||
}
|
86
node_modules/@rollup/pluginutils/types/index.d.ts
generated
vendored
86
node_modules/@rollup/pluginutils/types/index.d.ts
generated
vendored
|
@ -1,86 +0,0 @@
|
|||
// eslint-disable-next-line import/no-unresolved
|
||||
import { BaseNode } from 'estree';
|
||||
|
||||
export interface AttachedScope {
|
||||
parent?: AttachedScope;
|
||||
isBlockScope: boolean;
|
||||
declarations: { [key: string]: boolean };
|
||||
addDeclaration(node: BaseNode, isBlockDeclaration: boolean, isVar: boolean): void;
|
||||
contains(name: string): boolean;
|
||||
}
|
||||
|
||||
export interface DataToEsmOptions {
|
||||
compact?: boolean;
|
||||
indent?: string;
|
||||
namedExports?: boolean;
|
||||
objectShorthand?: boolean;
|
||||
preferConst?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A valid `minimatch` pattern, or array of patterns.
|
||||
*/
|
||||
export type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
||||
|
||||
/**
|
||||
* Adds an extension to a module ID if one does not exist.
|
||||
*/
|
||||
export function addExtension(filename: string, ext?: string): string;
|
||||
|
||||
/**
|
||||
* Attaches `Scope` objects to the relevant nodes of an AST.
|
||||
* Each `Scope` object has a `scope.contains(name)` method that returns `true`
|
||||
* if a given name is defined in the current scope or a parent scope.
|
||||
*/
|
||||
export function attachScopes(ast: BaseNode, propertyName?: string): AttachedScope;
|
||||
|
||||
/**
|
||||
* Constructs a filter function which can be used to determine whether or not
|
||||
* certain modules should be operated upon.
|
||||
* @param include If `include` is omitted or has zero length, filter will return `true` by default.
|
||||
* @param exclude ID must not match any of the `exclude` patterns.
|
||||
* @param options Optionally resolves the patterns against a directory other than `process.cwd()`.
|
||||
* If a `string` is specified, then the value will be used as the base directory.
|
||||
* Relative paths will be resolved against `process.cwd()` first.
|
||||
* If `false`, then the patterns will not be resolved against any directory.
|
||||
* This can be useful if you want to create a filter for virtual module names.
|
||||
*/
|
||||
export function createFilter(
|
||||
include?: FilterPattern,
|
||||
exclude?: FilterPattern,
|
||||
options?: { resolve?: string | false | null }
|
||||
): (id: string | unknown) => boolean;
|
||||
|
||||
/**
|
||||
* Transforms objects into tree-shakable ES Module imports.
|
||||
* @param data An object to transform into an ES module.
|
||||
*/
|
||||
export function dataToEsm(data: unknown, options?: DataToEsmOptions): string;
|
||||
|
||||
/**
|
||||
* Extracts the names of all assignment targets based upon specified patterns.
|
||||
* @param param An `acorn` AST Node.
|
||||
*/
|
||||
export function extractAssignedNames(param: BaseNode): string[];
|
||||
|
||||
/**
|
||||
* Constructs a bundle-safe identifier from a `string`.
|
||||
*/
|
||||
export function makeLegalIdentifier(str: string): string;
|
||||
|
||||
export type AddExtension = typeof addExtension;
|
||||
export type AttachScopes = typeof attachScopes;
|
||||
export type CreateFilter = typeof createFilter;
|
||||
export type ExtractAssignedNames = typeof extractAssignedNames;
|
||||
export type MakeLegalIdentifier = typeof makeLegalIdentifier;
|
||||
export type DataToEsm = typeof dataToEsm;
|
||||
|
||||
declare const defaultExport: {
|
||||
addExtension: AddExtension;
|
||||
attachScopes: AttachScopes;
|
||||
createFilter: CreateFilter;
|
||||
dataToEsm: DataToEsm;
|
||||
extractAssignedNames: ExtractAssignedNames;
|
||||
makeLegalIdentifier: MakeLegalIdentifier;
|
||||
};
|
||||
export default defaultExport;
|
21
node_modules/@types/estree/LICENSE
generated
vendored
21
node_modules/@types/estree/LICENSE
generated
vendored
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
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
|
16
node_modules/@types/estree/README.md
generated
vendored
16
node_modules/@types/estree/README.md
generated
vendored
|
@ -1,16 +0,0 @@
|
|||
# Installation
|
||||
> `npm install --save @types/estree`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for ESTree AST specification (https://github.com/estree/estree).
|
||||
|
||||
# Details
|
||||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree
|
||||
|
||||
Additional Details
|
||||
* Last updated: Tue, 17 Apr 2018 20:22:09 GMT
|
||||
* Dependencies: none
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by RReverser <https://github.com/RReverser>.
|
548
node_modules/@types/estree/index.d.ts
generated
vendored
548
node_modules/@types/estree/index.d.ts
generated
vendored
|
@ -1,548 +0,0 @@
|
|||
// Type definitions for ESTree AST specification
|
||||
// Project: https://github.com/estree/estree
|
||||
// Definitions by: RReverser <https://github.com/RReverser>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// This definition file follows a somewhat unusual format. ESTree allows
|
||||
// runtime type checks based on the `type` parameter. In order to explain this
|
||||
// to typescript we want to use discriminated union types:
|
||||
// https://github.com/Microsoft/TypeScript/pull/9163
|
||||
//
|
||||
// For ESTree this is a bit tricky because the high level interfaces like
|
||||
// Node or Function are pulling double duty. We want to pass common fields down
|
||||
// to the interfaces that extend them (like Identifier or
|
||||
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
||||
// common fields on them. So we've split the high level interfaces into two
|
||||
// types, a base type which passes down inhereted fields, and a type union of
|
||||
// all types which extend the base type. Only the type union is exported, and
|
||||
// the union is how other types refer to the collection of inheriting types.
|
||||
//
|
||||
// This makes the definitions file here somewhat more difficult to maintain,
|
||||
// but it has the notable advantage of making ESTree much easier to use as
|
||||
// an end user.
|
||||
|
||||
interface BaseNodeWithoutComments {
|
||||
// Every leaf interface that extends BaseNode must specify a type property.
|
||||
// The type property should be a string literal. For example, Identifier
|
||||
// has: `type: "Identifier"`
|
||||
type: string;
|
||||
loc?: SourceLocation | null;
|
||||
range?: [number, number];
|
||||
}
|
||||
|
||||
interface BaseNode extends BaseNodeWithoutComments {
|
||||
leadingComments?: Array<Comment>;
|
||||
trailingComments?: Array<Comment>;
|
||||
}
|
||||
|
||||
export type Node =
|
||||
Identifier | Literal | Program | Function | SwitchCase | CatchClause |
|
||||
VariableDeclarator | Statement | Expression | Property |
|
||||
AssignmentProperty | Super | TemplateElement | SpreadElement | Pattern |
|
||||
ClassBody | Class | MethodDefinition | ModuleDeclaration | ModuleSpecifier;
|
||||
|
||||
export interface Comment extends BaseNodeWithoutComments {
|
||||
type: "Line" | "Block";
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface SourceLocation {
|
||||
source?: string | null;
|
||||
start: Position;
|
||||
end: Position;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
/** >= 1 */
|
||||
line: number;
|
||||
/** >= 0 */
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface Program extends BaseNode {
|
||||
type: "Program";
|
||||
sourceType: "script" | "module";
|
||||
body: Array<Statement | ModuleDeclaration>;
|
||||
comments?: Array<Comment>;
|
||||
}
|
||||
|
||||
interface BaseFunction extends BaseNode {
|
||||
params: Array<Pattern>;
|
||||
generator?: boolean;
|
||||
async?: boolean;
|
||||
// The body is either BlockStatement or Expression because arrow functions
|
||||
// can have a body that's either. FunctionDeclarations and
|
||||
// FunctionExpressions have only BlockStatement bodies.
|
||||
body: BlockStatement | Expression;
|
||||
}
|
||||
|
||||
export type Function =
|
||||
FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
||||
|
||||
export type Statement =
|
||||
ExpressionStatement | BlockStatement | EmptyStatement |
|
||||
DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement |
|
||||
BreakStatement | ContinueStatement | IfStatement | SwitchStatement |
|
||||
ThrowStatement | TryStatement | WhileStatement | DoWhileStatement |
|
||||
ForStatement | ForInStatement | ForOfStatement | Declaration;
|
||||
|
||||
interface BaseStatement extends BaseNode { }
|
||||
|
||||
export interface EmptyStatement extends BaseStatement {
|
||||
type: "EmptyStatement";
|
||||
}
|
||||
|
||||
export interface BlockStatement extends BaseStatement {
|
||||
type: "BlockStatement";
|
||||
body: Array<Statement>;
|
||||
innerComments?: Array<Comment>;
|
||||
}
|
||||
|
||||
export interface ExpressionStatement extends BaseStatement {
|
||||
type: "ExpressionStatement";
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
export interface IfStatement extends BaseStatement {
|
||||
type: "IfStatement";
|
||||
test: Expression;
|
||||
consequent: Statement;
|
||||
alternate?: Statement | null;
|
||||
}
|
||||
|
||||
export interface LabeledStatement extends BaseStatement {
|
||||
type: "LabeledStatement";
|
||||
label: Identifier;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface BreakStatement extends BaseStatement {
|
||||
type: "BreakStatement";
|
||||
label?: Identifier | null;
|
||||
}
|
||||
|
||||
export interface ContinueStatement extends BaseStatement {
|
||||
type: "ContinueStatement";
|
||||
label?: Identifier | null;
|
||||
}
|
||||
|
||||
export interface WithStatement extends BaseStatement {
|
||||
type: "WithStatement";
|
||||
object: Expression;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface SwitchStatement extends BaseStatement {
|
||||
type: "SwitchStatement";
|
||||
discriminant: Expression;
|
||||
cases: Array<SwitchCase>;
|
||||
}
|
||||
|
||||
export interface ReturnStatement extends BaseStatement {
|
||||
type: "ReturnStatement";
|
||||
argument?: Expression | null;
|
||||
}
|
||||
|
||||
export interface ThrowStatement extends BaseStatement {
|
||||
type: "ThrowStatement";
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export interface TryStatement extends BaseStatement {
|
||||
type: "TryStatement";
|
||||
block: BlockStatement;
|
||||
handler?: CatchClause | null;
|
||||
finalizer?: BlockStatement | null;
|
||||
}
|
||||
|
||||
export interface WhileStatement extends BaseStatement {
|
||||
type: "WhileStatement";
|
||||
test: Expression;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface DoWhileStatement extends BaseStatement {
|
||||
type: "DoWhileStatement";
|
||||
body: Statement;
|
||||
test: Expression;
|
||||
}
|
||||
|
||||
export interface ForStatement extends BaseStatement {
|
||||
type: "ForStatement";
|
||||
init?: VariableDeclaration | Expression | null;
|
||||
test?: Expression | null;
|
||||
update?: Expression | null;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
interface BaseForXStatement extends BaseStatement {
|
||||
left: VariableDeclaration | Pattern;
|
||||
right: Expression;
|
||||
body: Statement;
|
||||
}
|
||||
|
||||
export interface ForInStatement extends BaseForXStatement {
|
||||
type: "ForInStatement";
|
||||
}
|
||||
|
||||
export interface DebuggerStatement extends BaseStatement {
|
||||
type: "DebuggerStatement";
|
||||
}
|
||||
|
||||
export type Declaration =
|
||||
FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
||||
|
||||
interface BaseDeclaration extends BaseStatement { }
|
||||
|
||||
export interface FunctionDeclaration extends BaseFunction, BaseDeclaration {
|
||||
type: "FunctionDeclaration";
|
||||
/** It is null when a function declaration is a part of the `export default function` statement */
|
||||
id: Identifier | null;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
export interface VariableDeclaration extends BaseDeclaration {
|
||||
type: "VariableDeclaration";
|
||||
declarations: Array<VariableDeclarator>;
|
||||
kind: "var" | "let" | "const";
|
||||
}
|
||||
|
||||
export interface VariableDeclarator extends BaseNode {
|
||||
type: "VariableDeclarator";
|
||||
id: Pattern;
|
||||
init?: Expression | null;
|
||||
}
|
||||
|
||||
type Expression =
|
||||
ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression |
|
||||
ArrowFunctionExpression | YieldExpression | Literal | UnaryExpression |
|
||||
UpdateExpression | BinaryExpression | AssignmentExpression |
|
||||
LogicalExpression | MemberExpression | ConditionalExpression |
|
||||
CallExpression | NewExpression | SequenceExpression | TemplateLiteral |
|
||||
TaggedTemplateExpression | ClassExpression | MetaProperty | Identifier |
|
||||
AwaitExpression;
|
||||
|
||||
export interface BaseExpression extends BaseNode { }
|
||||
|
||||
export interface ThisExpression extends BaseExpression {
|
||||
type: "ThisExpression";
|
||||
}
|
||||
|
||||
export interface ArrayExpression extends BaseExpression {
|
||||
type: "ArrayExpression";
|
||||
elements: Array<Expression | SpreadElement>;
|
||||
}
|
||||
|
||||
export interface ObjectExpression extends BaseExpression {
|
||||
type: "ObjectExpression";
|
||||
properties: Array<Property>;
|
||||
}
|
||||
|
||||
export interface Property extends BaseNode {
|
||||
type: "Property";
|
||||
key: Expression;
|
||||
value: Expression | Pattern; // Could be an AssignmentProperty
|
||||
kind: "init" | "get" | "set";
|
||||
method: boolean;
|
||||
shorthand: boolean;
|
||||
computed: boolean;
|
||||
}
|
||||
|
||||
export interface FunctionExpression extends BaseFunction, BaseExpression {
|
||||
id?: Identifier | null;
|
||||
type: "FunctionExpression";
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
export interface SequenceExpression extends BaseExpression {
|
||||
type: "SequenceExpression";
|
||||
expressions: Array<Expression>;
|
||||
}
|
||||
|
||||
export interface UnaryExpression extends BaseExpression {
|
||||
type: "UnaryExpression";
|
||||
operator: UnaryOperator;
|
||||
prefix: true;
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export interface BinaryExpression extends BaseExpression {
|
||||
type: "BinaryExpression";
|
||||
operator: BinaryOperator;
|
||||
left: Expression;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface AssignmentExpression extends BaseExpression {
|
||||
type: "AssignmentExpression";
|
||||
operator: AssignmentOperator;
|
||||
left: Pattern | MemberExpression;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface UpdateExpression extends BaseExpression {
|
||||
type: "UpdateExpression";
|
||||
operator: UpdateOperator;
|
||||
argument: Expression;
|
||||
prefix: boolean;
|
||||
}
|
||||
|
||||
export interface LogicalExpression extends BaseExpression {
|
||||
type: "LogicalExpression";
|
||||
operator: LogicalOperator;
|
||||
left: Expression;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface ConditionalExpression extends BaseExpression {
|
||||
type: "ConditionalExpression";
|
||||
test: Expression;
|
||||
alternate: Expression;
|
||||
consequent: Expression;
|
||||
}
|
||||
|
||||
interface BaseCallExpression extends BaseExpression {
|
||||
callee: Expression | Super;
|
||||
arguments: Array<Expression | SpreadElement>;
|
||||
}
|
||||
export type CallExpression = SimpleCallExpression | NewExpression;
|
||||
|
||||
export interface SimpleCallExpression extends BaseCallExpression {
|
||||
type: "CallExpression";
|
||||
}
|
||||
|
||||
export interface NewExpression extends BaseCallExpression {
|
||||
type: "NewExpression";
|
||||
}
|
||||
|
||||
export interface MemberExpression extends BaseExpression, BasePattern {
|
||||
type: "MemberExpression";
|
||||
object: Expression | Super;
|
||||
property: Expression;
|
||||
computed: boolean;
|
||||
}
|
||||
|
||||
export type Pattern =
|
||||
Identifier | ObjectPattern | ArrayPattern | RestElement |
|
||||
AssignmentPattern | MemberExpression;
|
||||
|
||||
interface BasePattern extends BaseNode { }
|
||||
|
||||
export interface SwitchCase extends BaseNode {
|
||||
type: "SwitchCase";
|
||||
test?: Expression | null;
|
||||
consequent: Array<Statement>;
|
||||
}
|
||||
|
||||
export interface CatchClause extends BaseNode {
|
||||
type: "CatchClause";
|
||||
param: Pattern;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
export interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
||||
type: "Identifier";
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type Literal = SimpleLiteral | RegExpLiteral;
|
||||
|
||||
export interface SimpleLiteral extends BaseNode, BaseExpression {
|
||||
type: "Literal";
|
||||
value: string | boolean | number | null;
|
||||
raw?: string;
|
||||
}
|
||||
|
||||
export interface RegExpLiteral extends BaseNode, BaseExpression {
|
||||
type: "Literal";
|
||||
value?: RegExp | null;
|
||||
regex: {
|
||||
pattern: string;
|
||||
flags: string;
|
||||
};
|
||||
raw?: string;
|
||||
}
|
||||
|
||||
export type UnaryOperator =
|
||||
"-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
||||
|
||||
export type BinaryOperator =
|
||||
"==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" |
|
||||
">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" |
|
||||
"instanceof";
|
||||
|
||||
export type LogicalOperator = "||" | "&&";
|
||||
|
||||
export type AssignmentOperator =
|
||||
"=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" |
|
||||
"|=" | "^=" | "&=";
|
||||
|
||||
export type UpdateOperator = "++" | "--";
|
||||
|
||||
export interface ForOfStatement extends BaseForXStatement {
|
||||
type: "ForOfStatement";
|
||||
}
|
||||
|
||||
export interface Super extends BaseNode {
|
||||
type: "Super";
|
||||
}
|
||||
|
||||
export interface SpreadElement extends BaseNode {
|
||||
type: "SpreadElement";
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
||||
type: "ArrowFunctionExpression";
|
||||
expression: boolean;
|
||||
body: BlockStatement | Expression;
|
||||
}
|
||||
|
||||
export interface YieldExpression extends BaseExpression {
|
||||
type: "YieldExpression";
|
||||
argument?: Expression | null;
|
||||
delegate: boolean;
|
||||
}
|
||||
|
||||
export interface TemplateLiteral extends BaseExpression {
|
||||
type: "TemplateLiteral";
|
||||
quasis: Array<TemplateElement>;
|
||||
expressions: Array<Expression>;
|
||||
}
|
||||
|
||||
export interface TaggedTemplateExpression extends BaseExpression {
|
||||
type: "TaggedTemplateExpression";
|
||||
tag: Expression;
|
||||
quasi: TemplateLiteral;
|
||||
}
|
||||
|
||||
export interface TemplateElement extends BaseNode {
|
||||
type: "TemplateElement";
|
||||
tail: boolean;
|
||||
value: {
|
||||
cooked: string;
|
||||
raw: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AssignmentProperty extends Property {
|
||||
value: Pattern;
|
||||
kind: "init";
|
||||
method: boolean; // false
|
||||
}
|
||||
|
||||
export interface ObjectPattern extends BasePattern {
|
||||
type: "ObjectPattern";
|
||||
properties: Array<AssignmentProperty>;
|
||||
}
|
||||
|
||||
export interface ArrayPattern extends BasePattern {
|
||||
type: "ArrayPattern";
|
||||
elements: Array<Pattern>;
|
||||
}
|
||||
|
||||
export interface RestElement extends BasePattern {
|
||||
type: "RestElement";
|
||||
argument: Pattern;
|
||||
}
|
||||
|
||||
export interface AssignmentPattern extends BasePattern {
|
||||
type: "AssignmentPattern";
|
||||
left: Pattern;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export type Class = ClassDeclaration | ClassExpression;
|
||||
interface BaseClass extends BaseNode {
|
||||
superClass?: Expression | null;
|
||||
body: ClassBody;
|
||||
}
|
||||
|
||||
export interface ClassBody extends BaseNode {
|
||||
type: "ClassBody";
|
||||
body: Array<MethodDefinition>;
|
||||
}
|
||||
|
||||
export interface MethodDefinition extends BaseNode {
|
||||
type: "MethodDefinition";
|
||||
key: Expression;
|
||||
value: FunctionExpression;
|
||||
kind: "constructor" | "method" | "get" | "set";
|
||||
computed: boolean;
|
||||
static: boolean;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends BaseClass, BaseDeclaration {
|
||||
type: "ClassDeclaration";
|
||||
/** It is null when a class declaration is a part of the `export default class` statement */
|
||||
id: Identifier | null;
|
||||
}
|
||||
|
||||
export interface ClassExpression extends BaseClass, BaseExpression {
|
||||
type: "ClassExpression";
|
||||
id?: Identifier | null;
|
||||
}
|
||||
|
||||
export interface MetaProperty extends BaseExpression {
|
||||
type: "MetaProperty";
|
||||
meta: Identifier;
|
||||
property: Identifier;
|
||||
}
|
||||
|
||||
export type ModuleDeclaration =
|
||||
ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration |
|
||||
ExportAllDeclaration;
|
||||
interface BaseModuleDeclaration extends BaseNode { }
|
||||
|
||||
export type ModuleSpecifier =
|
||||
ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier |
|
||||
ExportSpecifier;
|
||||
interface BaseModuleSpecifier extends BaseNode {
|
||||
local: Identifier;
|
||||
}
|
||||
|
||||
export interface ImportDeclaration extends BaseModuleDeclaration {
|
||||
type: "ImportDeclaration";
|
||||
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
||||
source: Literal;
|
||||
}
|
||||
|
||||
export interface ImportSpecifier extends BaseModuleSpecifier {
|
||||
type: "ImportSpecifier";
|
||||
imported: Identifier;
|
||||
}
|
||||
|
||||
export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
||||
type: "ImportDefaultSpecifier";
|
||||
}
|
||||
|
||||
export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
||||
type: "ImportNamespaceSpecifier";
|
||||
}
|
||||
|
||||
export interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
||||
type: "ExportNamedDeclaration";
|
||||
declaration?: Declaration | null;
|
||||
specifiers: Array<ExportSpecifier>;
|
||||
source?: Literal | null;
|
||||
}
|
||||
|
||||
export interface ExportSpecifier extends BaseModuleSpecifier {
|
||||
type: "ExportSpecifier";
|
||||
exported: Identifier;
|
||||
}
|
||||
|
||||
export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
||||
type: "ExportDefaultDeclaration";
|
||||
declaration: Declaration | Expression;
|
||||
}
|
||||
|
||||
export interface ExportAllDeclaration extends BaseModuleDeclaration {
|
||||
type: "ExportAllDeclaration";
|
||||
source: Literal;
|
||||
}
|
||||
|
||||
export interface AwaitExpression extends BaseExpression {
|
||||
type: "AwaitExpression";
|
||||
argument: Expression;
|
||||
}
|
22
node_modules/@types/estree/package.json
generated
vendored
22
node_modules/@types/estree/package.json
generated
vendored
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"name": "@types/estree",
|
||||
"version": "0.0.39",
|
||||
"description": "TypeScript definitions for ESTree AST specification",
|
||||
"license": "MIT",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "RReverser",
|
||||
"url": "https://github.com/RReverser",
|
||||
"githubUsername": "RReverser"
|
||||
}
|
||||
],
|
||||
"main": "",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "427ba878ebb5570e15aab870f708720d146a1c4b272e4a9d9990db4d1d033170",
|
||||
"typeScriptVersion": "2.0"
|
||||
}
|
79
node_modules/estree-walker/CHANGELOG.md
generated
vendored
79
node_modules/estree-walker/CHANGELOG.md
generated
vendored
|
@ -1,79 +0,0 @@
|
|||
# changelog
|
||||
|
||||
## 1.0.1
|
||||
|
||||
* Relax node type to `BaseNode` ([#17](https://github.com/Rich-Harris/estree-walker/pull/17))
|
||||
|
||||
## 1.0.0
|
||||
|
||||
* Don't cache child keys
|
||||
|
||||
## 0.9.0
|
||||
|
||||
* Add `this.remove()` method
|
||||
|
||||
## 0.8.1
|
||||
|
||||
* Fix pkg.files
|
||||
|
||||
## 0.8.0
|
||||
|
||||
* Adopt `estree` types
|
||||
|
||||
## 0.7.0
|
||||
|
||||
* Add a `this.replace(node)` method
|
||||
|
||||
## 0.6.1
|
||||
|
||||
* Only traverse nodes that exist and have a type ([#9](https://github.com/Rich-Harris/estree-walker/pull/9))
|
||||
* Only cache keys for nodes with a type ([#8](https://github.com/Rich-Harris/estree-walker/pull/8))
|
||||
|
||||
## 0.6.0
|
||||
|
||||
* Fix walker context type
|
||||
* Update deps, remove unncessary Bublé transformation
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* Add types to package
|
||||
|
||||
## 0.5.1
|
||||
|
||||
* Prevent context corruption when `walk()` is called during a walk
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Export `childKeys`, for manually fixing in case of malformed ASTs
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* Add TypeScript typings ([#3](https://github.com/Rich-Harris/estree-walker/pull/3))
|
||||
|
||||
## 0.3.1
|
||||
|
||||
* Include `pkg.repository` ([#2](https://github.com/Rich-Harris/estree-walker/pull/2))
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* More predictable ordering
|
||||
|
||||
## 0.2.1
|
||||
|
||||
* Keep `context` shape
|
||||
|
||||
## 0.2.0
|
||||
|
||||
* Add ES6 build
|
||||
|
||||
## 0.1.3
|
||||
|
||||
* npm snafu
|
||||
|
||||
## 0.1.2
|
||||
|
||||
* Pass current prop and index to `enter`/`leave` callbacks
|
||||
|
||||
## 0.1.1
|
||||
|
||||
* First release
|
48
node_modules/estree-walker/README.md
generated
vendored
48
node_modules/estree-walker/README.md
generated
vendored
|
@ -1,48 +0,0 @@
|
|||
# estree-walker
|
||||
|
||||
Simple utility for walking an [ESTree](https://github.com/estree/estree)-compliant AST, such as one generated by [acorn](https://github.com/marijnh/acorn).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm i estree-walker
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var walk = require( 'estree-walker' ).walk;
|
||||
var acorn = require( 'acorn' );
|
||||
|
||||
ast = acorn.parse( sourceCode, options ); // https://github.com/acornjs/acorn
|
||||
|
||||
walk( ast, {
|
||||
enter: function ( node, parent, prop, index ) {
|
||||
// some code happens
|
||||
},
|
||||
leave: function ( node, parent, prop, index ) {
|
||||
// some code happens
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Inside the `enter` function, calling `this.skip()` will prevent the node's children being walked, or the `leave` function (which is optional) being called.
|
||||
|
||||
Call `this.replace(new_node)` in either `enter` or `leave` to replace the current node with a new one.
|
||||
|
||||
Call `this.remove()` in either `enter` or `leave` to remove the current node.
|
||||
|
||||
## Why not use estraverse?
|
||||
|
||||
The ESTree spec is evolving to accommodate ES6/7. I've had a couple of experiences where [estraverse](https://github.com/estools/estraverse) was unable to handle an AST generated by recent versions of acorn, because it hard-codes visitor keys.
|
||||
|
||||
estree-walker, by contrast, simply enumerates a node's properties to find child nodes (and child lists of nodes), and is therefore resistant to spec changes. It's also much smaller. (The performance, if you're wondering, is basically identical.)
|
||||
|
||||
None of which should be taken as criticism of estraverse, which has more features and has been battle-tested in many more situations, and for which I'm very grateful.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
135
node_modules/estree-walker/dist/estree-walker.umd.js
generated
vendored
135
node_modules/estree-walker/dist/estree-walker.umd.js
generated
vendored
|
@ -1,135 +0,0 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.estreeWalker = {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
function walk(ast, { enter, leave }) {
|
||||
return visit(ast, null, enter, leave);
|
||||
}
|
||||
|
||||
let should_skip = false;
|
||||
let should_remove = false;
|
||||
let replacement = null;
|
||||
const context = {
|
||||
skip: () => should_skip = true,
|
||||
remove: () => should_remove = true,
|
||||
replace: (node) => replacement = node
|
||||
};
|
||||
|
||||
function replace(parent, prop, index, node) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop][index] = node;
|
||||
} else {
|
||||
parent[prop] = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove(parent, prop, index) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop].splice(index, 1);
|
||||
} else {
|
||||
delete parent[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function visit(
|
||||
node,
|
||||
parent,
|
||||
enter,
|
||||
leave,
|
||||
prop,
|
||||
index
|
||||
) {
|
||||
if (node) {
|
||||
if (enter) {
|
||||
const _should_skip = should_skip;
|
||||
const _should_remove = should_remove;
|
||||
const _replacement = replacement;
|
||||
should_skip = false;
|
||||
should_remove = false;
|
||||
replacement = null;
|
||||
|
||||
enter.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const skipped = should_skip;
|
||||
const removed = should_remove;
|
||||
|
||||
should_skip = _should_skip;
|
||||
should_remove = _should_remove;
|
||||
replacement = _replacement;
|
||||
|
||||
if (skipped) return node;
|
||||
if (removed) return null;
|
||||
}
|
||||
|
||||
for (const key in node) {
|
||||
const value = (node )[key];
|
||||
|
||||
if (typeof value !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (Array.isArray(value)) {
|
||||
for (let j = 0, k = 0; j < value.length; j += 1, k += 1) {
|
||||
if (value[j] !== null && typeof value[j].type === 'string') {
|
||||
if (!visit(value[j], node, enter, leave, key, k)) {
|
||||
// removed
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (value !== null && typeof value.type === 'string') {
|
||||
visit(value, node, enter, leave, key, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (leave) {
|
||||
const _replacement = replacement;
|
||||
const _should_remove = should_remove;
|
||||
replacement = null;
|
||||
should_remove = false;
|
||||
|
||||
leave.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const removed = should_remove;
|
||||
|
||||
replacement = _replacement;
|
||||
should_remove = _should_remove;
|
||||
|
||||
if (removed) return null;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
exports.walk = walk;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
1
node_modules/estree-walker/dist/estree-walker.umd.js.map
generated
vendored
1
node_modules/estree-walker/dist/estree-walker.umd.js.map
generated
vendored
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"estree-walker.umd.js","sources":["../src/estree-walker.js"],"sourcesContent":["export function walk(ast, { enter, leave }) {\n\tvisit(ast, null, enter, leave);\n}\n\nlet shouldSkip = false;\nconst context = { skip: () => shouldSkip = true };\n\nexport const childKeys = {};\n\nconst toString = Object.prototype.toString;\n\nfunction isArray(thing) {\n\treturn toString.call(thing) === '[object Array]';\n}\n\nfunction visit(node, parent, enter, leave, prop, index) {\n\tif (!node) return;\n\n\tif (enter) {\n\t\tconst _shouldSkip = shouldSkip;\n\t\tshouldSkip = false;\n\t\tenter.call(context, node, parent, prop, index);\n\t\tconst skipped = shouldSkip;\n\t\tshouldSkip = _shouldSkip;\n\n\t\tif (skipped) return;\n\t}\n\n\tconst keys = childKeys[node.type] || (\n\t\tchildKeys[node.type] = Object.keys(node).filter(key => typeof node[key] === 'object')\n\t);\n\n\tfor (let i = 0; i < keys.length; i += 1) {\n\t\tconst key = keys[i];\n\t\tconst value = node[key];\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let j = 0; j < value.length; j += 1) {\n\t\t\t\tvisit(value[j], node, enter, leave, key, j);\n\t\t\t}\n\t\t}\n\n\t\telse if (value && value.type) {\n\t\t\tvisit(value, node, enter, leave, key, null);\n\t\t}\n\t}\n\n\tif (leave) {\n\t\tleave(node, parent, prop, index);\n\t}\n}\n"],"names":[],"mappings":";;;;;;CAAO,SAAS,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;CAC5C,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;CAChC,CAAC;;CAED,IAAI,UAAU,GAAG,KAAK,CAAC;CACvB,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,UAAU,GAAG,IAAI,EAAE,CAAC;;AAElD,AAAY,OAAC,SAAS,GAAG,EAAE,CAAC;;CAE5B,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;;CAE3C,SAAS,OAAO,CAAC,KAAK,EAAE;CACxB,CAAC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,gBAAgB,CAAC;CAClD,CAAC;;CAED,SAAS,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE;CACxD,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO;;CAEnB,CAAC,IAAI,KAAK,EAAE;CACZ,EAAE,MAAM,WAAW,GAAG,UAAU,CAAC;CACjC,EAAE,UAAU,GAAG,KAAK,CAAC;CACrB,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;CACjD,EAAE,MAAM,OAAO,GAAG,UAAU,CAAC;CAC7B,EAAE,UAAU,GAAG,WAAW,CAAC;;CAE3B,EAAE,IAAI,OAAO,EAAE,OAAO;CACtB,EAAE;;CAEF,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;CAClC,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC;CACvF,EAAE,CAAC;;CAEH,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;CAC1C,EAAE,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;CACtB,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;;CAE1B,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;CACtB,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;CAC7C,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;CAChD,IAAI;CACJ,GAAG;;CAEH,OAAO,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE;CAChC,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;CAC/C,GAAG;CACH,EAAE;;CAEF,CAAC,IAAI,KAAK,EAAE;CACZ,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;CACnC,EAAE;CACF,CAAC;;;;;;;;;;;;;"}
|
32
node_modules/estree-walker/package.json
generated
vendored
32
node_modules/estree-walker/package.json
generated
vendored
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"name": "estree-walker",
|
||||
"description": "Traverse an ESTree-compliant AST",
|
||||
"version": "1.0.1",
|
||||
"author": "Rich Harris",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Rich-Harris/estree-walker"
|
||||
},
|
||||
"main": "dist/estree-walker.umd.js",
|
||||
"module": "src/estree-walker.js",
|
||||
"types": "types/index.d.ts",
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run build && npm test",
|
||||
"build": "tsc && rollup -c",
|
||||
"test": "mocha --opts mocha.opts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/estree": "0.0.39",
|
||||
"mocha": "^5.2.0",
|
||||
"rollup": "^0.67.3",
|
||||
"rollup-plugin-sucrase": "^2.1.0",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"dist",
|
||||
"types",
|
||||
"README.md"
|
||||
]
|
||||
}
|
125
node_modules/estree-walker/src/estree-walker.js
generated
vendored
125
node_modules/estree-walker/src/estree-walker.js
generated
vendored
|
@ -1,125 +0,0 @@
|
|||
function walk(ast, { enter, leave }) {
|
||||
return visit(ast, null, enter, leave);
|
||||
}
|
||||
|
||||
let should_skip = false;
|
||||
let should_remove = false;
|
||||
let replacement = null;
|
||||
const context = {
|
||||
skip: () => should_skip = true,
|
||||
remove: () => should_remove = true,
|
||||
replace: (node) => replacement = node
|
||||
};
|
||||
|
||||
function replace(parent, prop, index, node) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop][index] = node;
|
||||
} else {
|
||||
parent[prop] = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove(parent, prop, index) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop].splice(index, 1);
|
||||
} else {
|
||||
delete parent[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function visit(
|
||||
node,
|
||||
parent,
|
||||
enter,
|
||||
leave,
|
||||
prop,
|
||||
index
|
||||
) {
|
||||
if (node) {
|
||||
if (enter) {
|
||||
const _should_skip = should_skip;
|
||||
const _should_remove = should_remove;
|
||||
const _replacement = replacement;
|
||||
should_skip = false;
|
||||
should_remove = false;
|
||||
replacement = null;
|
||||
|
||||
enter.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const skipped = should_skip;
|
||||
const removed = should_remove;
|
||||
|
||||
should_skip = _should_skip;
|
||||
should_remove = _should_remove;
|
||||
replacement = _replacement;
|
||||
|
||||
if (skipped) return node;
|
||||
if (removed) return null;
|
||||
}
|
||||
|
||||
for (const key in node) {
|
||||
const value = (node )[key];
|
||||
|
||||
if (typeof value !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (Array.isArray(value)) {
|
||||
for (let j = 0, k = 0; j < value.length; j += 1, k += 1) {
|
||||
if (value[j] !== null && typeof value[j].type === 'string') {
|
||||
if (!visit(value[j], node, enter, leave, key, k)) {
|
||||
// removed
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (value !== null && typeof value.type === 'string') {
|
||||
visit(value, node, enter, leave, key, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (leave) {
|
||||
const _replacement = replacement;
|
||||
const _should_remove = should_remove;
|
||||
replacement = null;
|
||||
should_remove = false;
|
||||
|
||||
leave.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const removed = should_remove;
|
||||
|
||||
replacement = _replacement;
|
||||
should_remove = _should_remove;
|
||||
|
||||
if (removed) return null;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
export { walk };
|
144
node_modules/estree-walker/src/index.ts
generated
vendored
144
node_modules/estree-walker/src/index.ts
generated
vendored
|
@ -1,144 +0,0 @@
|
|||
import { BaseNode } from "estree";
|
||||
|
||||
type WalkerContext = {
|
||||
skip: () => void;
|
||||
remove: () => void;
|
||||
replace: (node: BaseNode) => void;
|
||||
};
|
||||
|
||||
type WalkerHandler = (
|
||||
this: WalkerContext,
|
||||
node: BaseNode,
|
||||
parent: BaseNode,
|
||||
key: string,
|
||||
index: number
|
||||
) => void
|
||||
|
||||
type Walker = {
|
||||
enter?: WalkerHandler;
|
||||
leave?: WalkerHandler;
|
||||
}
|
||||
|
||||
export function walk(ast: BaseNode, { enter, leave }: Walker) {
|
||||
return visit(ast, null, enter, leave);
|
||||
}
|
||||
|
||||
let should_skip = false;
|
||||
let should_remove = false;
|
||||
let replacement: BaseNode = null;
|
||||
const context: WalkerContext = {
|
||||
skip: () => should_skip = true,
|
||||
remove: () => should_remove = true,
|
||||
replace: (node: BaseNode) => replacement = node
|
||||
};
|
||||
|
||||
function replace(parent: any, prop: string, index: number, node: BaseNode) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop][index] = node;
|
||||
} else {
|
||||
parent[prop] = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove(parent: any, prop: string, index: number) {
|
||||
if (parent) {
|
||||
if (index !== null) {
|
||||
parent[prop].splice(index, 1);
|
||||
} else {
|
||||
delete parent[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function visit(
|
||||
node: BaseNode,
|
||||
parent: BaseNode,
|
||||
enter: WalkerHandler,
|
||||
leave: WalkerHandler,
|
||||
prop?: string,
|
||||
index?: number
|
||||
) {
|
||||
if (node) {
|
||||
if (enter) {
|
||||
const _should_skip = should_skip;
|
||||
const _should_remove = should_remove;
|
||||
const _replacement = replacement;
|
||||
should_skip = false;
|
||||
should_remove = false;
|
||||
replacement = null;
|
||||
|
||||
enter.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const skipped = should_skip;
|
||||
const removed = should_remove;
|
||||
|
||||
should_skip = _should_skip;
|
||||
should_remove = _should_remove;
|
||||
replacement = _replacement;
|
||||
|
||||
if (skipped) return node;
|
||||
if (removed) return null;
|
||||
}
|
||||
|
||||
for (const key in node) {
|
||||
const value = (node as any)[key];
|
||||
|
||||
if (typeof value !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
else if (Array.isArray(value)) {
|
||||
for (let j = 0, k = 0; j < value.length; j += 1, k += 1) {
|
||||
if (value[j] !== null && typeof value[j].type === 'string') {
|
||||
if (!visit(value[j], node, enter, leave, key, k)) {
|
||||
// removed
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (value !== null && typeof value.type === 'string') {
|
||||
visit(value, node, enter, leave, key, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (leave) {
|
||||
const _replacement = replacement;
|
||||
const _should_remove = should_remove;
|
||||
replacement = null;
|
||||
should_remove = false;
|
||||
|
||||
leave.call(context, node, parent, prop, index);
|
||||
|
||||
if (replacement) {
|
||||
node = replacement;
|
||||
replace(parent, prop, index, node);
|
||||
}
|
||||
|
||||
if (should_remove) {
|
||||
remove(parent, prop, index);
|
||||
}
|
||||
|
||||
const removed = should_remove;
|
||||
|
||||
replacement = _replacement;
|
||||
should_remove = _should_remove;
|
||||
|
||||
if (removed) return null;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
13
node_modules/estree-walker/types/index.d.ts
generated
vendored
13
node_modules/estree-walker/types/index.d.ts
generated
vendored
|
@ -1,13 +0,0 @@
|
|||
import { BaseNode } from "estree";
|
||||
declare type WalkerContext = {
|
||||
skip: () => void;
|
||||
remove: () => void;
|
||||
replace: (node: BaseNode) => void;
|
||||
};
|
||||
declare type WalkerHandler = (this: WalkerContext, node: BaseNode, parent: BaseNode, key: string, index: number) => void;
|
||||
declare type Walker = {
|
||||
enter?: WalkerHandler;
|
||||
leave?: WalkerHandler;
|
||||
};
|
||||
export declare function walk(ast: BaseNode, { enter, leave }: Walker): BaseNode;
|
||||
export {};
|
20
node_modules/function-bind/.editorconfig
generated
vendored
20
node_modules/function-bind/.editorconfig
generated
vendored
|
@ -1,20 +0,0 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 120
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
15
node_modules/function-bind/.eslintrc
generated
vendored
15
node_modules/function-bind/.eslintrc
generated
vendored
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"func-name-matching": 0,
|
||||
"indent": [2, 4],
|
||||
"max-nested-callbacks": [2, 3],
|
||||
"max-params": [2, 3],
|
||||
"max-statements": [2, 20],
|
||||
"no-new-func": [1],
|
||||
"strict": [0]
|
||||
}
|
||||
}
|
176
node_modules/function-bind/.jscs.json
generated
vendored
176
node_modules/function-bind/.jscs.json
generated
vendored
|
@ -1,176 +0,0 @@
|
|||
{
|
||||
"es3": true,
|
||||
|
||||
"additionalRules": [],
|
||||
|
||||
"requireSemicolons": true,
|
||||
|
||||
"disallowMultipleSpaces": true,
|
||||
|
||||
"disallowIdentifierNames": [],
|
||||
|
||||
"requireCurlyBraces": {
|
||||
"allExcept": [],
|
||||
"keywords": ["if", "else", "for", "while", "do", "try", "catch"]
|
||||
},
|
||||
|
||||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],
|
||||
|
||||
"disallowSpaceAfterKeywords": [],
|
||||
|
||||
"disallowSpaceBeforeComma": true,
|
||||
"disallowSpaceAfterComma": false,
|
||||
"disallowSpaceBeforeSemicolon": true,
|
||||
|
||||
"disallowNodeTypes": [
|
||||
"DebuggerStatement",
|
||||
"ForInStatement",
|
||||
"LabeledStatement",
|
||||
"SwitchCase",
|
||||
"SwitchStatement",
|
||||
"WithStatement"
|
||||
],
|
||||
|
||||
"requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] },
|
||||
|
||||
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
|
||||
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
|
||||
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true },
|
||||
"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true },
|
||||
"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true },
|
||||
|
||||
"requireSpaceBetweenArguments": true,
|
||||
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
|
||||
"disallowSpacesInsideArrayBrackets": true,
|
||||
|
||||
"disallowQuotedKeysInObjects": { "allExcept": ["reserved"] },
|
||||
|
||||
"disallowSpaceAfterObjectKeys": true,
|
||||
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
|
||||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
|
||||
"requireSpaceAfterPrefixUnaryOperators": [],
|
||||
|
||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
||||
"requireSpaceBeforePostfixUnaryOperators": [],
|
||||
|
||||
"disallowSpaceBeforeBinaryOperators": [],
|
||||
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
|
||||
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
|
||||
"disallowSpaceAfterBinaryOperators": [],
|
||||
|
||||
"disallowImplicitTypeConversion": ["binary", "string"],
|
||||
|
||||
"disallowKeywords": ["with", "eval"],
|
||||
|
||||
"requireKeywordsOnNewLine": [],
|
||||
"disallowKeywordsOnNewLine": ["else"],
|
||||
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
|
||||
"disallowTrailingWhitespace": true,
|
||||
|
||||
"disallowTrailingComma": true,
|
||||
|
||||
"excludeFiles": ["node_modules/**", "vendor/**"],
|
||||
|
||||
"disallowMultipleLineStrings": true,
|
||||
|
||||
"requireDotNotation": { "allExcept": ["keywords"] },
|
||||
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
|
||||
"validateLineBreaks": "LF",
|
||||
|
||||
"validateQuoteMarks": {
|
||||
"escape": true,
|
||||
"mark": "'"
|
||||
},
|
||||
|
||||
"disallowOperatorBeforeLineBreak": [],
|
||||
|
||||
"requireSpaceBeforeKeywords": [
|
||||
"do",
|
||||
"for",
|
||||
"if",
|
||||
"else",
|
||||
"switch",
|
||||
"case",
|
||||
"try",
|
||||
"catch",
|
||||
"finally",
|
||||
"while",
|
||||
"with",
|
||||
"return"
|
||||
],
|
||||
|
||||
"validateAlignedFunctionParameters": {
|
||||
"lineBreakAfterOpeningBraces": true,
|
||||
"lineBreakBeforeClosingBraces": true
|
||||
},
|
||||
|
||||
"requirePaddingNewLinesBeforeExport": true,
|
||||
|
||||
"validateNewlineAfterArrayElements": {
|
||||
"maximum": 8
|
||||
},
|
||||
|
||||
"requirePaddingNewLinesAfterUseStrict": true,
|
||||
|
||||
"disallowArrowFunctions": true,
|
||||
|
||||
"disallowMultiLineTernary": true,
|
||||
|
||||
"validateOrderInObjectKeys": "asc-insensitive",
|
||||
|
||||
"disallowIdenticalDestructuringNames": true,
|
||||
|
||||
"disallowNestedTernaries": { "maxLevel": 1 },
|
||||
|
||||
"requireSpaceAfterComma": { "allExcept": ["trailing"] },
|
||||
"requireAlignedMultilineParams": false,
|
||||
|
||||
"requireSpacesInGenerator": {
|
||||
"afterStar": true
|
||||
},
|
||||
|
||||
"disallowSpacesInGenerator": {
|
||||
"beforeStar": true
|
||||
},
|
||||
|
||||
"disallowVar": false,
|
||||
|
||||
"requireArrayDestructuring": false,
|
||||
|
||||
"requireEnhancedObjectLiterals": false,
|
||||
|
||||
"requireObjectDestructuring": false,
|
||||
|
||||
"requireEarlyReturn": false,
|
||||
|
||||
"requireCapitalizedConstructorsNew": {
|
||||
"allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"]
|
||||
},
|
||||
|
||||
"requireImportAlphabetized": false,
|
||||
|
||||
"requireSpaceBeforeObjectValues": true,
|
||||
"requireSpaceBeforeDestructuredValues": true,
|
||||
|
||||
"disallowSpacesInsideTemplateStringPlaceholders": true,
|
||||
|
||||
"disallowArrayDestructuringReturn": false,
|
||||
|
||||
"requireNewlineBeforeSingleStatementsInIf": false,
|
||||
|
||||
"disallowUnusedVariables": true,
|
||||
|
||||
"requireSpacesInsideImportedObjectBraces": true,
|
||||
|
||||
"requireUseStrict": true
|
||||
}
|
||||
|
22
node_modules/function-bind/.npmignore
generated
vendored
22
node_modules/function-bind/.npmignore
generated
vendored
|
@ -1,22 +0,0 @@
|
|||
# gitignore
|
||||
.DS_Store
|
||||
.monitor
|
||||
.*.swp
|
||||
.nodemonignore
|
||||
releases
|
||||
*.log
|
||||
*.err
|
||||
fleet.json
|
||||
public/browserify
|
||||
bin/*.json
|
||||
.bin
|
||||
build
|
||||
compile
|
||||
.lock-wscript
|
||||
coverage
|
||||
node_modules
|
||||
|
||||
# Only apps should have lockfiles
|
||||
npm-shrinkwrap.json
|
||||
package-lock.json
|
||||
yarn.lock
|
168
node_modules/function-bind/.travis.yml
generated
vendored
168
node_modules/function-bind/.travis.yml
generated
vendored
|
@ -1,168 +0,0 @@
|
|||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
node_js:
|
||||
- "8.4"
|
||||
- "7.10"
|
||||
- "6.11"
|
||||
- "5.12"
|
||||
- "4.8"
|
||||
- "iojs-v3.3"
|
||||
- "iojs-v2.5"
|
||||
- "iojs-v1.8"
|
||||
- "0.12"
|
||||
- "0.10"
|
||||
- "0.8"
|
||||
before_install:
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi'
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ] || [ "${TRAVIS_NODE_VERSION:0:4}" = "iojs" ]; then npm install -g npm@4.5 ; else npm install -g npm; fi; fi'
|
||||
install:
|
||||
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;'
|
||||
script:
|
||||
- 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi'
|
||||
- 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi'
|
||||
- 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi'
|
||||
- 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi'
|
||||
sudo: false
|
||||
env:
|
||||
- TEST=true
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- node_js: "node"
|
||||
env: PRETEST=true
|
||||
- node_js: "4"
|
||||
env: COVERAGE=true
|
||||
- node_js: "8.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "8.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "7.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "6.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.10"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.8"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "5.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "4.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v3.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v2.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.7"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.5"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.3"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.2"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.1"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "iojs-v1.0"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.11"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.9"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.6"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
- node_js: "0.4"
|
||||
env: TEST=true ALLOW_FAILURE=true
|
||||
allow_failures:
|
||||
- os: osx
|
||||
- env: TEST=true ALLOW_FAILURE=true
|
20
node_modules/function-bind/LICENSE
generated
vendored
20
node_modules/function-bind/LICENSE
generated
vendored
|
@ -1,20 +0,0 @@
|
|||
Copyright (c) 2013 Raynos.
|
||||
|
||||
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.
|
||||
|
48
node_modules/function-bind/README.md
generated
vendored
48
node_modules/function-bind/README.md
generated
vendored
|
@ -1,48 +0,0 @@
|
|||
# function-bind
|
||||
|
||||
<!--
|
||||
[![build status][travis-svg]][travis-url]
|
||||
[![NPM version][npm-badge-svg]][npm-url]
|
||||
[![Coverage Status][5]][6]
|
||||
[![gemnasium Dependency Status][7]][8]
|
||||
[![Dependency status][deps-svg]][deps-url]
|
||||
[![Dev Dependency status][dev-deps-svg]][dev-deps-url]
|
||||
-->
|
||||
|
||||
<!-- [![browser support][11]][12] -->
|
||||
|
||||
Implementation of function.prototype.bind
|
||||
|
||||
## Example
|
||||
|
||||
I mainly do this for unit tests I run on phantomjs.
|
||||
PhantomJS does not have Function.prototype.bind :(
|
||||
|
||||
```js
|
||||
Function.prototype.bind = require("function-bind")
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install function-bind`
|
||||
|
||||
## Contributors
|
||||
|
||||
- Raynos
|
||||
|
||||
## MIT Licenced
|
||||
|
||||
[travis-svg]: https://travis-ci.org/Raynos/function-bind.svg
|
||||
[travis-url]: https://travis-ci.org/Raynos/function-bind
|
||||
[npm-badge-svg]: https://badge.fury.io/js/function-bind.svg
|
||||
[npm-url]: https://npmjs.org/package/function-bind
|
||||
[5]: https://coveralls.io/repos/Raynos/function-bind/badge.png
|
||||
[6]: https://coveralls.io/r/Raynos/function-bind
|
||||
[7]: https://gemnasium.com/Raynos/function-bind.png
|
||||
[8]: https://gemnasium.com/Raynos/function-bind
|
||||
[deps-svg]: https://david-dm.org/Raynos/function-bind.svg
|
||||
[deps-url]: https://david-dm.org/Raynos/function-bind
|
||||
[dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies
|
||||
[11]: https://ci.testling.com/Raynos/function-bind.png
|
||||
[12]: https://ci.testling.com/Raynos/function-bind
|
52
node_modules/function-bind/implementation.js
generated
vendored
52
node_modules/function-bind/implementation.js
generated
vendored
|
@ -1,52 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/* eslint no-invalid-this: 1 */
|
||||
|
||||
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
||||
var slice = Array.prototype.slice;
|
||||
var toStr = Object.prototype.toString;
|
||||
var funcType = '[object Function]';
|
||||
|
||||
module.exports = function bind(that) {
|
||||
var target = this;
|
||||
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
||||
throw new TypeError(ERROR_MESSAGE + target);
|
||||
}
|
||||
var args = slice.call(arguments, 1);
|
||||
|
||||
var bound;
|
||||
var binder = function () {
|
||||
if (this instanceof bound) {
|
||||
var result = target.apply(
|
||||
this,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
if (Object(result) === result) {
|
||||
return result;
|
||||
}
|
||||
return this;
|
||||
} else {
|
||||
return target.apply(
|
||||
that,
|
||||
args.concat(slice.call(arguments))
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
var boundLength = Math.max(0, target.length - args.length);
|
||||
var boundArgs = [];
|
||||
for (var i = 0; i < boundLength; i++) {
|
||||
boundArgs.push('$' + i);
|
||||
}
|
||||
|
||||
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
||||
|
||||
if (target.prototype) {
|
||||
var Empty = function Empty() {};
|
||||
Empty.prototype = target.prototype;
|
||||
bound.prototype = new Empty();
|
||||
Empty.prototype = null;
|
||||
}
|
||||
|
||||
return bound;
|
||||
};
|
5
node_modules/function-bind/index.js
generated
vendored
5
node_modules/function-bind/index.js
generated
vendored
|
@ -1,5 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = Function.prototype.bind || implementation;
|
63
node_modules/function-bind/package.json
generated
vendored
63
node_modules/function-bind/package.json
generated
vendored
|
@ -1,63 +0,0 @@
|
|||
{
|
||||
"name": "function-bind",
|
||||
"version": "1.1.1",
|
||||
"description": "Implementation of Function.prototype.bind",
|
||||
"keywords": [
|
||||
"function",
|
||||
"bind",
|
||||
"shim",
|
||||
"es5"
|
||||
],
|
||||
"author": "Raynos <raynos2@gmail.com>",
|
||||
"repository": "git://github.com/Raynos/function-bind.git",
|
||||
"main": "index",
|
||||
"homepage": "https://github.com/Raynos/function-bind",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Raynos"
|
||||
},
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"url": "https://github.com/ljharb"
|
||||
}
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Raynos/function-bind/issues",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^12.2.1",
|
||||
"covert": "^1.1.0",
|
||||
"eslint": "^4.5.0",
|
||||
"jscs": "^3.0.7",
|
||||
"tape": "^4.8.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "npm run coverage -- --quiet",
|
||||
"tests-only": "node test",
|
||||
"coverage": "covert test/*.js",
|
||||
"lint": "npm run jscs && npm run eslint",
|
||||
"jscs": "jscs *.js */*.js",
|
||||
"eslint": "eslint *.js */*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/16..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/22..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
}
|
||||
}
|
9
node_modules/function-bind/test/.eslintrc
generated
vendored
9
node_modules/function-bind/test/.eslintrc
generated
vendored
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"rules": {
|
||||
"array-bracket-newline": 0,
|
||||
"array-element-newline": 0,
|
||||
"max-statements-per-line": [2, { "max": 2 }],
|
||||
"no-invalid-this": 0,
|
||||
"no-magic-numbers": 0,
|
||||
}
|
||||
}
|
252
node_modules/function-bind/test/index.js
generated
vendored
252
node_modules/function-bind/test/index.js
generated
vendored
|
@ -1,252 +0,0 @@
|
|||
// jscs:disable requireUseStrict
|
||||
|
||||
var test = require('tape');
|
||||
|
||||
var functionBind = require('../implementation');
|
||||
var getCurrentContext = function () { return this; };
|
||||
|
||||
test('functionBind is a function', function (t) {
|
||||
t.equal(typeof functionBind, 'function');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('non-functions', function (t) {
|
||||
var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g];
|
||||
t.plan(nonFunctions.length);
|
||||
for (var i = 0; i < nonFunctions.length; ++i) {
|
||||
try { functionBind.call(nonFunctions[i]); } catch (ex) {
|
||||
t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i]));
|
||||
}
|
||||
}
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('without a context', function (t) {
|
||||
t.test('binds properly', function (st) {
|
||||
var args, context;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
context = this;
|
||||
})
|
||||
};
|
||||
namespace.func(1, 2, 3);
|
||||
st.deepEqual(args, [1, 2, 3]);
|
||||
st.equal(context, getCurrentContext.call());
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('binds properly, and still supplies bound arguments', function (st) {
|
||||
var args, context;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
context = this;
|
||||
}, undefined, 1, 2, 3)
|
||||
};
|
||||
namespace.func(4, 5, 6);
|
||||
st.deepEqual(args, [1, 2, 3, 4, 5, 6]);
|
||||
st.equal(context, getCurrentContext.call());
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns properly', function (st) {
|
||||
var args;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
return this;
|
||||
}, null)
|
||||
};
|
||||
var context = namespace.func(1, 2, 3);
|
||||
st.equal(context, getCurrentContext.call(), 'returned context is namespaced context');
|
||||
st.deepEqual(args, [1, 2, 3], 'passed arguments are correct');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns properly with bound arguments', function (st) {
|
||||
var args;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
return this;
|
||||
}, null, 1, 2, 3)
|
||||
};
|
||||
var context = namespace.func(4, 5, 6);
|
||||
st.equal(context, getCurrentContext.call(), 'returned context is namespaced context');
|
||||
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('called as a constructor', function (st) {
|
||||
var thunkify = function (value) {
|
||||
return function () { return value; };
|
||||
};
|
||||
st.test('returns object value', function (sst) {
|
||||
var expectedReturnValue = [1, 2, 3];
|
||||
var Constructor = functionBind.call(thunkify(expectedReturnValue), null);
|
||||
var result = new Constructor();
|
||||
sst.equal(result, expectedReturnValue);
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.test('does not return primitive value', function (sst) {
|
||||
var Constructor = functionBind.call(thunkify(42), null);
|
||||
var result = new Constructor();
|
||||
sst.notEqual(result, 42);
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.test('object from bound constructor is instance of original and bound constructor', function (sst) {
|
||||
var A = function (x) {
|
||||
this.name = x || 'A';
|
||||
};
|
||||
var B = functionBind.call(A, null, 'B');
|
||||
|
||||
var result = new B();
|
||||
sst.ok(result instanceof B, 'result is instance of bound constructor');
|
||||
sst.ok(result instanceof A, 'result is instance of original constructor');
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('with a context', function (t) {
|
||||
t.test('with no bound arguments', function (st) {
|
||||
var args, context;
|
||||
var boundContext = {};
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
context = this;
|
||||
}, boundContext)
|
||||
};
|
||||
namespace.func(1, 2, 3);
|
||||
st.equal(context, boundContext, 'binds a context properly');
|
||||
st.deepEqual(args, [1, 2, 3], 'supplies passed arguments');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('with bound arguments', function (st) {
|
||||
var args, context;
|
||||
var boundContext = {};
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
context = this;
|
||||
}, boundContext, 1, 2, 3)
|
||||
};
|
||||
namespace.func(4, 5, 6);
|
||||
st.equal(context, boundContext, 'binds a context properly');
|
||||
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns properly', function (st) {
|
||||
var boundContext = {};
|
||||
var args;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
return this;
|
||||
}, boundContext)
|
||||
};
|
||||
var context = namespace.func(1, 2, 3);
|
||||
st.equal(context, boundContext, 'returned context is bound context');
|
||||
st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context');
|
||||
st.deepEqual(args, [1, 2, 3], 'passed arguments are correct');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('returns properly with bound arguments', function (st) {
|
||||
var boundContext = {};
|
||||
var args;
|
||||
var namespace = {
|
||||
func: functionBind.call(function () {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
return this;
|
||||
}, boundContext, 1, 2, 3)
|
||||
};
|
||||
var context = namespace.func(4, 5, 6);
|
||||
st.equal(context, boundContext, 'returned context is bound context');
|
||||
st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context');
|
||||
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('passes the correct arguments when called as a constructor', function (st) {
|
||||
var expected = { name: 'Correct' };
|
||||
var namespace = {
|
||||
Func: functionBind.call(function (arg) {
|
||||
return arg;
|
||||
}, { name: 'Incorrect' })
|
||||
};
|
||||
var returned = new namespace.Func(expected);
|
||||
st.equal(returned, expected, 'returns the right arg when called as a constructor');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('has the new instance\'s context when called as a constructor', function (st) {
|
||||
var actualContext;
|
||||
var expectedContext = { foo: 'bar' };
|
||||
var namespace = {
|
||||
Func: functionBind.call(function () {
|
||||
actualContext = this;
|
||||
}, expectedContext)
|
||||
};
|
||||
var result = new namespace.Func();
|
||||
st.equal(result instanceof namespace.Func, true);
|
||||
st.notEqual(actualContext, expectedContext);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('bound function length', function (t) {
|
||||
t.test('sets a correct length without thisArg', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; });
|
||||
st.equal(subject.length, 3);
|
||||
st.equal(subject(1, 2, 3), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length with thisArg', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {});
|
||||
st.equal(subject.length, 3);
|
||||
st.equal(subject(1, 2, 3), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length without thisArg and first argument', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1);
|
||||
st.equal(subject.length, 2);
|
||||
st.equal(subject(2, 3), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length with thisArg and first argument', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1);
|
||||
st.equal(subject.length, 2);
|
||||
st.equal(subject(2, 3), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length without thisArg and too many arguments', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4);
|
||||
st.equal(subject.length, 0);
|
||||
st.equal(subject(), 6);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets a correct length with thisArg and too many arguments', function (st) {
|
||||
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4);
|
||||
st.equal(subject.length, 0);
|
||||
st.equal(subject(), 6);
|
||||
st.end();
|
||||
});
|
||||
});
|
22
node_modules/has/LICENSE-MIT
generated
vendored
22
node_modules/has/LICENSE-MIT
generated
vendored
|
@ -1,22 +0,0 @@
|
|||
Copyright (c) 2013 Thiago de Arruda
|
||||
|
||||
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.
|
18
node_modules/has/README.md
generated
vendored
18
node_modules/has/README.md
generated
vendored
|
@ -1,18 +0,0 @@
|
|||
# has
|
||||
|
||||
> Object.prototype.hasOwnProperty.call shortcut
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save has
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var has = require('has');
|
||||
|
||||
has({}, 'hasOwnProperty'); // false
|
||||
has(Object.prototype, 'hasOwnProperty'); // true
|
||||
```
|
48
node_modules/has/package.json
generated
vendored
48
node_modules/has/package.json
generated
vendored
|
@ -1,48 +0,0 @@
|
|||
{
|
||||
"name": "has",
|
||||
"description": "Object.prototype.hasOwnProperty.call shortcut",
|
||||
"version": "1.0.3",
|
||||
"homepage": "https://github.com/tarruda/has",
|
||||
"author": {
|
||||
"name": "Thiago de Arruda",
|
||||
"email": "tpadilha84@gmail.com"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/tarruda/has.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tarruda/has/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT"
|
||||
}
|
||||
],
|
||||
"main": "./src",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^12.2.1",
|
||||
"eslint": "^4.19.1",
|
||||
"tape": "^4.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"test": "tape test"
|
||||
}
|
||||
}
|
5
node_modules/has/src/index.js
generated
vendored
5
node_modules/has/src/index.js
generated
vendored
|
@ -1,5 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var bind = require('function-bind');
|
||||
|
||||
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
10
node_modules/has/test/index.js
generated
vendored
10
node_modules/has/test/index.js
generated
vendored
|
@ -1,10 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var has = require('../');
|
||||
|
||||
test('has', function (t) {
|
||||
t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"');
|
||||
t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"');
|
||||
t.end();
|
||||
});
|
1
node_modules/is-core-module/.eslintignore
generated
vendored
1
node_modules/is-core-module/.eslintignore
generated
vendored
|
@ -1 +0,0 @@
|
|||
coverage/
|
18
node_modules/is-core-module/.eslintrc
generated
vendored
18
node_modules/is-core-module/.eslintrc
generated
vendored
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"extends": "@ljharb",
|
||||
"root": true,
|
||||
"rules": {
|
||||
"func-style": 1,
|
||||
"operator-linebreak": [2, "before"],
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"global-require": 0,
|
||||
"max-lines-per-function": 0,
|
||||
"no-negated-condition": 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
12
node_modules/is-core-module/.github/FUNDING.yml
generated
vendored
12
node_modules/is-core-module/.github/FUNDING.yml
generated
vendored
|
@ -1,12 +0,0 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/is-core-module
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
54
node_modules/is-core-module/.github/workflows/node-4+.yml
generated
vendored
54
node_modules/is-core-module/.github/workflows/node-4+.yml
generated
vendored
|
@ -1,54 +0,0 @@
|
|||
name: 'Tests: node.js'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
latest: ${{ steps.set-matrix.outputs.requireds }}
|
||||
minors: ${{ steps.set-matrix.outputs.optionals }}
|
||||
steps:
|
||||
- uses: ljharb/actions/node/matrix@main
|
||||
id: set-matrix
|
||||
with:
|
||||
preset: '>=4'
|
||||
|
||||
latest:
|
||||
needs: [matrix]
|
||||
name: 'latest minors'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run tests-only'
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
minors:
|
||||
needs: [matrix, latest]
|
||||
name: 'non-latest minors'
|
||||
continue-on-error: true
|
||||
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
|
||||
node:
|
||||
name: 'node 4+'
|
||||
needs: [latest, minors]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo tests completed'
|
58
node_modules/is-core-module/.github/workflows/node-iojs.yml
generated
vendored
58
node_modules/is-core-module/.github/workflows/node-iojs.yml
generated
vendored
|
@ -1,58 +0,0 @@
|
|||
name: 'Tests: node.js (io.js)'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
latest: ${{ steps.set-matrix.outputs.requireds }}
|
||||
minors: ${{ steps.set-matrix.outputs.optionals }}
|
||||
steps:
|
||||
- uses: ljharb/actions/node/matrix@main
|
||||
id: set-matrix
|
||||
with:
|
||||
preset: 'iojs'
|
||||
|
||||
latest:
|
||||
needs: [matrix]
|
||||
name: 'latest minors'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run tests-only'
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
skip-ls-check: true
|
||||
|
||||
minors:
|
||||
needs: [matrix, latest]
|
||||
name: 'non-latest minors'
|
||||
continue-on-error: true
|
||||
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run tests-only'
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
skip-ls-check: true
|
||||
|
||||
node:
|
||||
name: 'io.js'
|
||||
needs: [latest, minors]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo tests completed'
|
26
node_modules/is-core-module/.github/workflows/node-pretest.yml
generated
vendored
26
node_modules/is-core-module/.github/workflows/node-pretest.yml
generated
vendored
|
@ -1,26 +0,0 @@
|
|||
name: 'Tests: pretest/posttest'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
pretest:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run pretest'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
command: 'pretest'
|
||||
|
||||
posttest:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run posttest'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
command: 'posttest'
|
58
node_modules/is-core-module/.github/workflows/node-zero.yml
generated
vendored
58
node_modules/is-core-module/.github/workflows/node-zero.yml
generated
vendored
|
@ -1,58 +0,0 @@
|
|||
name: 'Tests: node.js (0.x)'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
stable: ${{ steps.set-matrix.outputs.requireds }}
|
||||
unstable: ${{ steps.set-matrix.outputs.optionals }}
|
||||
steps:
|
||||
- uses: ljharb/actions/node/matrix@main
|
||||
id: set-matrix
|
||||
with:
|
||||
preset: '0.x'
|
||||
|
||||
stable:
|
||||
needs: [matrix]
|
||||
name: 'stable minors'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.stable) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
|
||||
skip-ls-check: true
|
||||
|
||||
unstable:
|
||||
needs: [matrix, stable]
|
||||
name: 'unstable minors'
|
||||
continue-on-error: true
|
||||
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.unstable) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
|
||||
skip-ls-check: true
|
||||
|
||||
node:
|
||||
name: 'node 0.x'
|
||||
needs: [stable, unstable]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo tests completed'
|
15
node_modules/is-core-module/.github/workflows/rebase.yml
generated
vendored
15
node_modules/is-core-module/.github/workflows/rebase.yml
generated
vendored
|
@ -1,15 +0,0 @@
|
|||
name: Automatic Rebase
|
||||
|
||||
on: [pull_request_target]
|
||||
|
||||
jobs:
|
||||
_:
|
||||
name: "Automatic Rebase"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: ljharb/rebase@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
14
node_modules/is-core-module/.github/workflows/require-allow-edits.yml
generated
vendored
14
node_modules/is-core-module/.github/workflows/require-allow-edits.yml
generated
vendored
|
@ -1,14 +0,0 @@
|
|||
name: Require “Allow Edits”
|
||||
|
||||
on: [pull_request_target]
|
||||
|
||||
jobs:
|
||||
_:
|
||||
name: "Require “Allow Edits”"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: ljharb/require-allow-edits@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
13
node_modules/is-core-module/.nycrc
generated
vendored
13
node_modules/is-core-module/.nycrc
generated
vendored
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"lines": 86,
|
||||
"statements": 85.93,
|
||||
"functions": 82.43,
|
||||
"branches": 76.06,
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
58
node_modules/is-core-module/CHANGELOG.md
generated
vendored
58
node_modules/is-core-module/CHANGELOG.md
generated
vendored
|
@ -1,58 +0,0 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v2.2.0](https://github.com/inspect-js/is-core-module/compare/v2.1.0...v2.2.0) - 2020-11-26
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] migrate tests to Github Actions [`c919f57`](https://github.com/inspect-js/is-core-module/commit/c919f573c0a92d10a0acad0b650b5aecb033d426)
|
||||
- [patch] `core.json`: %s/ /\t/g [`db3f685`](https://github.com/inspect-js/is-core-module/commit/db3f68581f53e73cc09cd675955eb1bdd6a5a39b)
|
||||
- [Tests] run `nyc` on all tests [`b2f925f`](https://github.com/inspect-js/is-core-module/commit/b2f925f8866f210ef441f39fcc8cc42692ab89b1)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`; add `safe-publish-latest` [`89f02a2`](https://github.com/inspect-js/is-core-module/commit/89f02a2b4162246dea303a6ee31bb9a550b05c72)
|
||||
- [New] add `path/posix`, `path/win32`, `util/types` [`77f94f1`](https://github.com/inspect-js/is-core-module/commit/77f94f1e90ffd7c0be2a3f1aa8574ebf7fd981b3)
|
||||
|
||||
## [v2.1.0](https://github.com/inspect-js/is-core-module/compare/v2.0.0...v2.1.0) - 2020-11-04
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `eslint` [`5e0034e`](https://github.com/inspect-js/is-core-module/commit/5e0034eae57c09c8f1bd769f502486a00f56c6e4)
|
||||
- [New] Add `diagnostics_channel` [`c2d83d0`](https://github.com/inspect-js/is-core-module/commit/c2d83d0a0225a1a658945d9bab7036ea347d29ec)
|
||||
|
||||
## [v2.0.0](https://github.com/inspect-js/is-core-module/compare/v1.0.2...v2.0.0) - 2020-09-29
|
||||
|
||||
### Commits
|
||||
|
||||
- v2 implementation [`865aeb5`](https://github.com/inspect-js/is-core-module/commit/865aeb5ca0e90248a3dfff5d7622e4751fdeb9cd)
|
||||
- Only apps should have lockfiles [`5a5e660`](https://github.com/inspect-js/is-core-module/commit/5a5e660d568e37eb44e17fb1ebb12a105205fc2b)
|
||||
- Initial commit for v2 [`5a51524`](https://github.com/inspect-js/is-core-module/commit/5a51524e06f92adece5fbb138c69b7b9748a2348)
|
||||
- Tests [`116eae4`](https://github.com/inspect-js/is-core-module/commit/116eae4fccd01bc72c1fd3cc4b7561c387afc496)
|
||||
- [meta] add `auto-changelog` [`c24388b`](https://github.com/inspect-js/is-core-module/commit/c24388bee828d223040519d1f5b226ca35beee63)
|
||||
- [actions] add "Automatic Rebase" and "require allow edits" actions [`34292db`](https://github.com/inspect-js/is-core-module/commit/34292dbcbadae0868aff03c22dbd8b7b8a11558a)
|
||||
- [Tests] add `npm run lint` [`4f9eeee`](https://github.com/inspect-js/is-core-module/commit/4f9eeee7ddff10698bbf528620f4dc8d4fa3e697)
|
||||
- [readme] fix travis badges, https all URLs [`e516a73`](https://github.com/inspect-js/is-core-module/commit/e516a73b0dccce20938c432b1ba512eae8eff9e9)
|
||||
- [meta] create FUNDING.yml [`1aabebc`](https://github.com/inspect-js/is-core-module/commit/1aabebca98d01f8a04e46bc2e2520fa93cf21ac6)
|
||||
- [Fix] `domain`: domain landed sometime > v0.7.7 and <= v0.7.12 [`2df7d37`](https://github.com/inspect-js/is-core-module/commit/2df7d37595d41b15eeada732b706b926c2771655)
|
||||
- [Fix] `sys`: worked in 0.6, not 0.7, and 0.8+ [`a75c134`](https://github.com/inspect-js/is-core-module/commit/a75c134229e1e9441801f6b73f6a52489346eb65)
|
||||
|
||||
## [v1.0.2](https://github.com/inspect-js/is-core-module/compare/v1.0.1...v1.0.2) - 2014-09-28
|
||||
|
||||
### Commits
|
||||
|
||||
- simpler [`66fe90f`](https://github.com/inspect-js/is-core-module/commit/66fe90f9771581b9adc0c3900baa52c21b5baea2)
|
||||
|
||||
## [v1.0.1](https://github.com/inspect-js/is-core-module/compare/v1.0.0...v1.0.1) - 2014-09-28
|
||||
|
||||
### Commits
|
||||
|
||||
- remove stupid [`f21f906`](https://github.com/inspect-js/is-core-module/commit/f21f906f882c2bd656a5fc5ed6fbe48ddaffb2ac)
|
||||
- update readme [`1eff0ec`](https://github.com/inspect-js/is-core-module/commit/1eff0ec69798d1ec65771552d1562911e90a8027)
|
||||
|
||||
## v1.0.0 - 2014-09-28
|
||||
|
||||
### Commits
|
||||
|
||||
- init [`48e5e76`](https://github.com/inspect-js/is-core-module/commit/48e5e76cac378fddb8c1f7d4055b8dfc943d6b96)
|
20
node_modules/is-core-module/LICENSE
generated
vendored
20
node_modules/is-core-module/LICENSE
generated
vendored
|
@ -1,20 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Dave Justice
|
||||
|
||||
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.
|
37
node_modules/is-core-module/README.md
generated
vendored
37
node_modules/is-core-module/README.md
generated
vendored
|
@ -1,37 +0,0 @@
|
|||
# is-core-module <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
[![Build Status][3]][4]
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var isCore = require('is-core-module');
|
||||
var assert = require('assert');
|
||||
assert(isCore('fs'));
|
||||
assert(!isCore('butts'));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[1]: https://npmjs.org/package/is-core-module
|
||||
[2]: https://versionbadg.es/inspect-js/is-core-module.svg
|
||||
[3]: https://travis-ci.com/inspect-js/is-core-module.svg
|
||||
[4]: https://travis-ci.com/inspect-js/is-core-module
|
||||
[5]: https://david-dm.org/inspect-js/is-core-module.svg
|
||||
[6]: https://david-dm.org/inspect-js/is-core-module
|
||||
[7]: https://david-dm.org/inspect-js/is-core-module/dev-status.svg
|
||||
[8]: https://david-dm.org/inspect-js/is-core-module#info=devDependencies
|
||||
[11]: https://nodei.co/npm/is-core-module.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/is-core-module.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/is-core-module.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=is-core-module
|
83
node_modules/is-core-module/core.json
generated
vendored
83
node_modules/is-core-module/core.json
generated
vendored
|
@ -1,83 +0,0 @@
|
|||
{
|
||||
"assert": true,
|
||||
"assert/strict": ">= 15",
|
||||
"async_hooks": ">= 8",
|
||||
"buffer_ieee754": "< 0.9.7",
|
||||
"buffer": true,
|
||||
"child_process": true,
|
||||
"cluster": true,
|
||||
"console": true,
|
||||
"constants": true,
|
||||
"crypto": true,
|
||||
"_debug_agent": ">= 1 && < 8",
|
||||
"_debugger": "< 8",
|
||||
"dgram": true,
|
||||
"diagnostics_channel": ">= 15.1",
|
||||
"dns": true,
|
||||
"dns/promises": ">= 15",
|
||||
"domain": ">= 0.7.12",
|
||||
"events": true,
|
||||
"freelist": "< 6",
|
||||
"fs": true,
|
||||
"fs/promises": [">= 10 && < 10.1", ">= 14"],
|
||||
"_http_agent": ">= 0.11.1",
|
||||
"_http_client": ">= 0.11.1",
|
||||
"_http_common": ">= 0.11.1",
|
||||
"_http_incoming": ">= 0.11.1",
|
||||
"_http_outgoing": ">= 0.11.1",
|
||||
"_http_server": ">= 0.11.1",
|
||||
"http": true,
|
||||
"http2": ">= 8.8",
|
||||
"https": true,
|
||||
"inspector": ">= 8.0.0",
|
||||
"_linklist": "< 8",
|
||||
"module": true,
|
||||
"net": true,
|
||||
"node-inspect/lib/_inspect": ">= 7.6.0 && < 12",
|
||||
"node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12",
|
||||
"node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12",
|
||||
"os": true,
|
||||
"path": true,
|
||||
"path/posix": ">= 15.3",
|
||||
"path/win32": ">= 15.3",
|
||||
"perf_hooks": ">= 8.5",
|
||||
"process": ">= 1",
|
||||
"punycode": true,
|
||||
"querystring": true,
|
||||
"readline": true,
|
||||
"repl": true,
|
||||
"smalloc": ">= 0.11.5 && < 3",
|
||||
"_stream_duplex": ">= 0.9.4",
|
||||
"_stream_transform": ">= 0.9.4",
|
||||
"_stream_wrap": ">= 1.4.1",
|
||||
"_stream_passthrough": ">= 0.9.4",
|
||||
"_stream_readable": ">= 0.9.4",
|
||||
"_stream_writable": ">= 0.9.4",
|
||||
"stream": true,
|
||||
"stream/promises": ">= 15",
|
||||
"string_decoder": true,
|
||||
"sys": [">= 0.6 && < 0.7", ">= 0.8"],
|
||||
"timers": true,
|
||||
"timers/promises": ">= 15",
|
||||
"_tls_common": ">= 0.11.13",
|
||||
"_tls_legacy": ">= 0.11.3 && < 10",
|
||||
"_tls_wrap": ">= 0.11.3",
|
||||
"tls": true,
|
||||
"trace_events": ">= 10",
|
||||
"tty": true,
|
||||
"url": true,
|
||||
"util": true,
|
||||
"util/types": ">= 15.3",
|
||||
"v8/tools/arguments": ">= 10 && < 12",
|
||||
"v8/tools/codemap": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/consarray": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/csvparser": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/logreader": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/profile_view": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8": ">= 1",
|
||||
"vm": true,
|
||||
"wasi": ">= 13.4 && < 13.5",
|
||||
"worker_threads": ">= 11.7",
|
||||
"zlib": true
|
||||
}
|
69
node_modules/is-core-module/index.js
generated
vendored
69
node_modules/is-core-module/index.js
generated
vendored
|
@ -1,69 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var has = require('has');
|
||||
|
||||
function specifierIncluded(current, specifier) {
|
||||
var nodeParts = current.split('.');
|
||||
var parts = specifier.split(' ');
|
||||
var op = parts.length > 1 ? parts[0] : '=';
|
||||
var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');
|
||||
|
||||
for (var i = 0; i < 3; ++i) {
|
||||
var cur = parseInt(nodeParts[i] || 0, 10);
|
||||
var ver = parseInt(versionParts[i] || 0, 10);
|
||||
if (cur === ver) {
|
||||
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
||||
}
|
||||
if (op === '<') {
|
||||
return cur < ver;
|
||||
}
|
||||
if (op === '>=') {
|
||||
return cur >= ver;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return op === '>=';
|
||||
}
|
||||
|
||||
function matchesRange(current, range) {
|
||||
var specifiers = range.split(/ ?&& ?/);
|
||||
if (specifiers.length === 0) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < specifiers.length; ++i) {
|
||||
if (!specifierIncluded(current, specifiers[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function versionIncluded(nodeVersion, specifierValue) {
|
||||
if (typeof specifierValue === 'boolean') {
|
||||
return specifierValue;
|
||||
}
|
||||
|
||||
var current = typeof nodeVersion === 'undefined'
|
||||
? process.versions && process.versions.node && process.versions.node
|
||||
: nodeVersion;
|
||||
|
||||
if (typeof current !== 'string') {
|
||||
throw new TypeError(typeof nodeVersion === 'undefined' ? 'Unable to determine current node version' : 'If provided, a valid node version is required');
|
||||
}
|
||||
|
||||
if (specifierValue && typeof specifierValue === 'object') {
|
||||
for (var i = 0; i < specifierValue.length; ++i) {
|
||||
if (matchesRange(current, specifierValue[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return matchesRange(current, specifierValue);
|
||||
}
|
||||
|
||||
var data = require('./core.json');
|
||||
|
||||
module.exports = function isCore(x, nodeVersion) {
|
||||
return has(data, x) && versionIncluded(nodeVersion, data[x]);
|
||||
};
|
66
node_modules/is-core-module/package.json
generated
vendored
66
node_modules/is-core-module/package.json
generated
vendored
|
@ -1,66 +0,0 @@
|
|||
{
|
||||
"name": "is-core-module",
|
||||
"version": "2.2.0",
|
||||
"description": "Is this specifier a node.js core module?",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./index.js"
|
||||
],
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "safe-publish-latest",
|
||||
"lint": "eslint .",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "tape 'test/**/*.js'",
|
||||
"test": "nyc npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/inspect-js/is-core-module.git"
|
||||
},
|
||||
"keywords": [
|
||||
"core",
|
||||
"modules",
|
||||
"module",
|
||||
"npm",
|
||||
"node",
|
||||
"dependencies"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/inspect-js/is-core-module/issues"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/is-core-module",
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^17.3.0",
|
||||
"aud": "^1.1.3",
|
||||
"auto-changelog": "^2.2.1",
|
||||
"eslint": "^7.14.0",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"tape": "^5.0.1"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
}
|
||||
}
|
83
node_modules/is-core-module/test/index.js
generated
vendored
83
node_modules/is-core-module/test/index.js
generated
vendored
|
@ -1,83 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var keys = require('object-keys');
|
||||
var isCore = require('../');
|
||||
var data = require('../core.json');
|
||||
|
||||
test('core modules', function (t) {
|
||||
t.test('isCore()', function (st) {
|
||||
st.ok(isCore('fs'));
|
||||
st.ok(isCore('net'));
|
||||
st.ok(isCore('http'));
|
||||
|
||||
st.ok(!isCore('seq'));
|
||||
st.ok(!isCore('../'));
|
||||
|
||||
st.ok(!isCore('toString'));
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('core list', function (st) {
|
||||
var cores = keys(data);
|
||||
st.plan(cores.length);
|
||||
|
||||
for (var i = 0; i < cores.length; ++i) {
|
||||
var mod = cores[i];
|
||||
var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func
|
||||
if (isCore(mod)) {
|
||||
st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw');
|
||||
} else {
|
||||
st['throws'](requireFunc, mod + ' not supported; requiring throws');
|
||||
}
|
||||
}
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('core via repl module', { skip: !data.repl }, function (st) {
|
||||
var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle
|
||||
if (!libs) {
|
||||
st.skip('module.builtinModules does not exist');
|
||||
} else {
|
||||
for (var i = 0; i < libs.length; ++i) {
|
||||
var mod = libs[i];
|
||||
st.ok(data[mod], mod + ' is a core module');
|
||||
st.doesNotThrow(
|
||||
function () { require(mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring ' + mod + ' does not throw'
|
||||
);
|
||||
}
|
||||
}
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('core via builtinModules list', { skip: !data.module }, function (st) {
|
||||
var libs = require('module').builtinModules;
|
||||
if (!libs) {
|
||||
st.skip('module.builtinModules does not exist');
|
||||
} else {
|
||||
var excludeList = [
|
||||
'_debug_agent',
|
||||
'v8/tools/tickprocessor-driver',
|
||||
'v8/tools/SourceMap',
|
||||
'v8/tools/tickprocessor',
|
||||
'v8/tools/profile'
|
||||
];
|
||||
for (var i = 0; i < libs.length; ++i) {
|
||||
var mod = libs[i];
|
||||
if (excludeList.indexOf(mod) === -1) {
|
||||
st.ok(data[mod], mod + ' is a core module');
|
||||
st.doesNotThrow(
|
||||
function () { require(mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring ' + mod + ' does not throw'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
9
node_modules/path-parse/.travis.yml
generated
vendored
9
node_modules/path-parse/.travis.yml
generated
vendored
|
@ -1,9 +0,0 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.12"
|
||||
- "0.11"
|
||||
- "0.10"
|
||||
- "0.10.12"
|
||||
- "0.8"
|
||||
- "0.6"
|
||||
- "iojs"
|
21
node_modules/path-parse/LICENSE
generated
vendored
21
node_modules/path-parse/LICENSE
generated
vendored
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Javier Blanco
|
||||
|
||||
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.
|
42
node_modules/path-parse/README.md
generated
vendored
42
node_modules/path-parse/README.md
generated
vendored
|
@ -1,42 +0,0 @@
|
|||
# path-parse [](https://travis-ci.org/jbgutierrez/path-parse)
|
||||
|
||||
> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) [ponyfill](https://ponyfill.com).
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-parse
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var pathParse = require('path-parse');
|
||||
|
||||
pathParse('/home/user/dir/file.txt');
|
||||
//=> {
|
||||
// root : "/",
|
||||
// dir : "/home/user/dir",
|
||||
// base : "file.txt",
|
||||
// ext : ".txt",
|
||||
// name : "file"
|
||||
// }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs.
|
||||
|
||||
### pathParse(path)
|
||||
|
||||
### pathParse.posix(path)
|
||||
|
||||
The Posix specific version.
|
||||
|
||||
### pathParse.win32(path)
|
||||
|
||||
The Windows specific version.
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Javier Blanco](http://jbgutierrez.info)
|
93
node_modules/path-parse/index.js
generated
vendored
93
node_modules/path-parse/index.js
generated
vendored
|
@ -1,93 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
var isWindows = process.platform === 'win32';
|
||||
|
||||
// Regex to split a windows path into three parts: [*, device, slash,
|
||||
// tail] windows-only
|
||||
var splitDeviceRe =
|
||||
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
||||
|
||||
// Regex to split the tail part of the above into [*, dir, basename, ext]
|
||||
var splitTailRe =
|
||||
/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;
|
||||
|
||||
var win32 = {};
|
||||
|
||||
// Function to split a filename into [root, dir, basename, ext]
|
||||
function win32SplitPath(filename) {
|
||||
// Separate device+slash from tail
|
||||
var result = splitDeviceRe.exec(filename),
|
||||
device = (result[1] || '') + (result[2] || ''),
|
||||
tail = result[3] || '';
|
||||
// Split the tail into dir, basename and extension
|
||||
var result2 = splitTailRe.exec(tail),
|
||||
dir = result2[1],
|
||||
basename = result2[2],
|
||||
ext = result2[3];
|
||||
return [device, dir, basename, ext];
|
||||
}
|
||||
|
||||
win32.parse = function(pathString) {
|
||||
if (typeof pathString !== 'string') {
|
||||
throw new TypeError(
|
||||
"Parameter 'pathString' must be a string, not " + typeof pathString
|
||||
);
|
||||
}
|
||||
var allParts = win32SplitPath(pathString);
|
||||
if (!allParts || allParts.length !== 4) {
|
||||
throw new TypeError("Invalid path '" + pathString + "'");
|
||||
}
|
||||
return {
|
||||
root: allParts[0],
|
||||
dir: allParts[0] + allParts[1].slice(0, -1),
|
||||
base: allParts[2],
|
||||
ext: allParts[3],
|
||||
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Split a filename into [root, dir, basename, ext], unix version
|
||||
// 'root' is just a slash, or nothing.
|
||||
var splitPathRe =
|
||||
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
||||
var posix = {};
|
||||
|
||||
|
||||
function posixSplitPath(filename) {
|
||||
return splitPathRe.exec(filename).slice(1);
|
||||
}
|
||||
|
||||
|
||||
posix.parse = function(pathString) {
|
||||
if (typeof pathString !== 'string') {
|
||||
throw new TypeError(
|
||||
"Parameter 'pathString' must be a string, not " + typeof pathString
|
||||
);
|
||||
}
|
||||
var allParts = posixSplitPath(pathString);
|
||||
if (!allParts || allParts.length !== 4) {
|
||||
throw new TypeError("Invalid path '" + pathString + "'");
|
||||
}
|
||||
allParts[1] = allParts[1] || '';
|
||||
allParts[2] = allParts[2] || '';
|
||||
allParts[3] = allParts[3] || '';
|
||||
|
||||
return {
|
||||
root: allParts[0],
|
||||
dir: allParts[0] + allParts[1].slice(0, -1),
|
||||
base: allParts[2],
|
||||
ext: allParts[3],
|
||||
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
if (isWindows)
|
||||
module.exports = win32.parse;
|
||||
else /* posix */
|
||||
module.exports = posix.parse;
|
||||
|
||||
module.exports.posix = posix.parse;
|
||||
module.exports.win32 = win32.parse;
|
33
node_modules/path-parse/package.json
generated
vendored
33
node_modules/path-parse/package.json
generated
vendored
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"name": "path-parse",
|
||||
"version": "1.0.6",
|
||||
"description": "Node.js path.parse() ponyfill",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jbgutierrez/path-parse.git"
|
||||
},
|
||||
"keywords": [
|
||||
"path",
|
||||
"paths",
|
||||
"file",
|
||||
"dir",
|
||||
"parse",
|
||||
"built-in",
|
||||
"util",
|
||||
"utils",
|
||||
"core",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"shim"
|
||||
],
|
||||
"author": "Javier Blanco <http://jbgutierrez.info>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jbgutierrez/path-parse/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jbgutierrez/path-parse#readme"
|
||||
}
|
77
node_modules/path-parse/test.js
generated
vendored
77
node_modules/path-parse/test.js
generated
vendored
|
@ -1,77 +0,0 @@
|
|||
var assert = require('assert');
|
||||
var pathParse = require('./index');
|
||||
|
||||
var winParseTests = [
|
||||
[{ root: 'C:\\', dir: 'C:\\path\\dir', base: 'index.html', ext: '.html', name: 'index' }, 'C:\\path\\dir\\index.html'],
|
||||
[{ root: 'C:\\', dir: 'C:\\another_path\\DIR\\1\\2\\33', base: 'index', ext: '', name: 'index' }, 'C:\\another_path\\DIR\\1\\2\\33\\index'],
|
||||
[{ root: '', dir: 'another_path\\DIR with spaces\\1\\2\\33', base: 'index', ext: '', name: 'index' }, 'another_path\\DIR with spaces\\1\\2\\33\\index'],
|
||||
[{ root: '\\', dir: '\\foo', base: 'C:', ext: '', name: 'C:' }, '\\foo\\C:'],
|
||||
[{ root: '', dir: '', base: 'file', ext: '', name: 'file' }, 'file'],
|
||||
[{ root: '', dir: '.', base: 'file', ext: '', name: 'file' }, '.\\file'],
|
||||
|
||||
// unc
|
||||
[{ root: '\\\\server\\share\\', dir: '\\\\server\\share\\', base: 'file_path', ext: '', name: 'file_path' }, '\\\\server\\share\\file_path'],
|
||||
[{ root: '\\\\server two\\shared folder\\', dir: '\\\\server two\\shared folder\\', base: 'file path.zip', ext: '.zip', name: 'file path' }, '\\\\server two\\shared folder\\file path.zip'],
|
||||
[{ root: '\\\\teela\\admin$\\', dir: '\\\\teela\\admin$\\', base: 'system32', ext: '', name: 'system32' }, '\\\\teela\\admin$\\system32'],
|
||||
[{ root: '\\\\?\\UNC\\', dir: '\\\\?\\UNC\\server', base: 'share', ext: '', name: 'share' }, '\\\\?\\UNC\\server\\share']
|
||||
];
|
||||
|
||||
var winSpecialCaseFormatTests = [
|
||||
[{dir: 'some\\dir'}, 'some\\dir\\'],
|
||||
[{base: 'index.html'}, 'index.html'],
|
||||
[{}, '']
|
||||
];
|
||||
|
||||
var unixParseTests = [
|
||||
[{ root: '/', dir: '/home/user/dir', base: 'file.txt', ext: '.txt', name: 'file' }, '/home/user/dir/file.txt'],
|
||||
[{ root: '/', dir: '/home/user/a dir', base: 'another File.zip', ext: '.zip', name: 'another File' }, '/home/user/a dir/another File.zip'],
|
||||
[{ root: '/', dir: '/home/user/a dir/', base: 'another&File.', ext: '.', name: 'another&File' }, '/home/user/a dir//another&File.'],
|
||||
[{ root: '/', dir: '/home/user/a$$$dir/', base: 'another File.zip', ext: '.zip', name: 'another File' }, '/home/user/a$$$dir//another File.zip'],
|
||||
[{ root: '', dir: 'user/dir', base: 'another File.zip', ext: '.zip', name: 'another File' }, 'user/dir/another File.zip'],
|
||||
[{ root: '', dir: '', base: 'file', ext: '', name: 'file' }, 'file'],
|
||||
[{ root: '', dir: '', base: '.\\file', ext: '', name: '.\\file' }, '.\\file'],
|
||||
[{ root: '', dir: '.', base: 'file', ext: '', name: 'file' }, './file'],
|
||||
[{ root: '', dir: '', base: 'C:\\foo', ext: '', name: 'C:\\foo' }, 'C:\\foo']
|
||||
];
|
||||
|
||||
var unixSpecialCaseFormatTests = [
|
||||
[{dir: 'some/dir'}, 'some/dir/'],
|
||||
[{base: 'index.html'}, 'index.html'],
|
||||
[{}, '']
|
||||
];
|
||||
|
||||
var errors = [
|
||||
{input: null, message: /Parameter 'pathString' must be a string, not/},
|
||||
{input: {}, message: /Parameter 'pathString' must be a string, not object/},
|
||||
{input: true, message: /Parameter 'pathString' must be a string, not boolean/},
|
||||
{input: 1, message: /Parameter 'pathString' must be a string, not number/},
|
||||
{input: undefined, message: /Parameter 'pathString' must be a string, not undefined/},
|
||||
];
|
||||
|
||||
checkParseFormat(pathParse.win32, winParseTests);
|
||||
checkParseFormat(pathParse.posix, unixParseTests);
|
||||
checkErrors(pathParse.win32);
|
||||
checkErrors(pathParse.posix);
|
||||
|
||||
function checkErrors(parse) {
|
||||
errors.forEach(function(errorCase) {
|
||||
try {
|
||||
parse(errorCase.input);
|
||||
} catch(err) {
|
||||
assert.ok(err instanceof TypeError);
|
||||
assert.ok(
|
||||
errorCase.message.test(err.message),
|
||||
'expected ' + errorCase.message + ' to match ' + err.message
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
assert.fail('should have thrown');
|
||||
});
|
||||
}
|
||||
|
||||
function checkParseFormat(parse, testCases) {
|
||||
testCases.forEach(function(testCase) {
|
||||
assert.deepEqual(parse(testCase[1]), testCase[0]);
|
||||
});
|
||||
}
|
113
node_modules/picomatch/CHANGELOG.md
generated
vendored
113
node_modules/picomatch/CHANGELOG.md
generated
vendored
|
@ -1,113 +0,0 @@
|
|||
# Release history
|
||||
|
||||
**All notable changes to this project will be documented in this file.**
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
<details>
|
||||
<summary><strong>Guiding Principles</strong></summary>
|
||||
|
||||
- Changelogs are for humans, not machines.
|
||||
- There should be an entry for every single version.
|
||||
- The same types of changes should be grouped.
|
||||
- Versions and sections should be linkable.
|
||||
- The latest version comes first.
|
||||
- The release date of each versions is displayed.
|
||||
- Mention whether you follow Semantic Versioning.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Types of changes</strong></summary>
|
||||
|
||||
Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_):
|
||||
|
||||
- `Added` for new features.
|
||||
- `Changed` for changes in existing functionality.
|
||||
- `Deprecated` for soon-to-be removed features.
|
||||
- `Removed` for now removed features.
|
||||
- `Fixed` for any bug fixes.
|
||||
- `Security` in case of vulnerabilities.
|
||||
|
||||
</details>
|
||||
|
||||
## 2.2.2 (2020-03-21)
|
||||
|
||||
### Fixed
|
||||
|
||||
* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)).
|
||||
|
||||
## 2.2.1 (2020-01-04)
|
||||
|
||||
* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals.
|
||||
|
||||
## 2.2.0 (2020-01-04)
|
||||
|
||||
* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f))
|
||||
* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`.
|
||||
|
||||
## 2.1.0 (2019-10-31)
|
||||
|
||||
* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92))
|
||||
* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650))
|
||||
* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c))
|
||||
* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9))
|
||||
* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625))
|
||||
* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0))
|
||||
* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8))
|
||||
* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07))
|
||||
* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45))
|
||||
* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34))
|
||||
* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55))
|
||||
* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03))
|
||||
* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87))
|
||||
* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d))
|
||||
* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa))
|
||||
* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d))
|
||||
* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54))
|
||||
* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367))
|
||||
* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569))
|
||||
* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77))
|
||||
* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038))
|
||||
* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd))
|
||||
|
||||
## 2.0.7 (2019-05-14)
|
||||
|
||||
* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71))
|
||||
* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e))
|
||||
* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279))
|
||||
* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44))
|
||||
|
||||
## 2.0.4 (2019-04-10)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez.
|
||||
- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza.
|
||||
|
||||
## 2.0.0 (2019-04-10)
|
||||
|
||||
### Added
|
||||
|
||||
- Adds support for `options.onIgnore`. See the readme for details
|
||||
- Adds support for `options.onResult`. See the readme for details
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- The unixify option was renamed to `windows`
|
||||
- caching and all related options and methods have been removed
|
||||
|
||||
## 1.0.0 (2018-11-05)
|
||||
|
||||
- adds `.onMatch` option
|
||||
- improvements to `.scan` method
|
||||
- numerous improvements and optimizations for matching and parsing
|
||||
- better windows path handling
|
||||
|
||||
## 0.1.0 - 2017-04-13
|
||||
|
||||
First release.
|
||||
|
||||
|
||||
[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog
|
21
node_modules/picomatch/LICENSE
generated
vendored
21
node_modules/picomatch/LICENSE
generated
vendored
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
691
node_modules/picomatch/README.md
generated
vendored
691
node_modules/picomatch/README.md
generated
vendored
|
@ -1,691 +0,0 @@
|
|||
<h1 align="center">Picomatch</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://npmjs.org/package/picomatch">
|
||||
<img src="https://img.shields.io/npm/v/picomatch.svg" alt="version">
|
||||
</a>
|
||||
<a href="https://github.com/micromatch/picomatch/actions?workflow=Tests">
|
||||
<img src="https://github.com/micromatch/picomatch/workflows/Tests/badge.svg" alt="test status">
|
||||
</a>
|
||||
<a href="https://coveralls.io/github/micromatch/picomatch">
|
||||
<img src="https://img.shields.io/coveralls/github/micromatch/picomatch/master.svg" alt="coverage status">
|
||||
</a>
|
||||
<a href="https://npmjs.org/package/picomatch">
|
||||
<img src="https://img.shields.io/npm/dm/picomatch.svg" alt="downloads">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<strong>Blazing fast and accurate glob matcher written in JavaScript.</strong></br>
|
||||
<em>No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.</em>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Why picomatch?
|
||||
|
||||
* **Lightweight** - No dependencies
|
||||
* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function.
|
||||
* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps)
|
||||
* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files)
|
||||
* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes.
|
||||
* **Well tested** - Thousands of unit tests
|
||||
|
||||
See the [library comparison](#library-comparisons) to other libraries.
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Table of Contents
|
||||
|
||||
<details><summary> Click to expand </summary>
|
||||
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [API](#api)
|
||||
* [picomatch](#picomatch)
|
||||
* [.test](#test)
|
||||
* [.matchBase](#matchbase)
|
||||
* [.isMatch](#ismatch)
|
||||
* [.parse](#parse)
|
||||
* [.scan](#scan)
|
||||
* [.compileRe](#compilere)
|
||||
* [.toRegex](#toregex)
|
||||
- [Options](#options)
|
||||
* [Picomatch options](#picomatch-options)
|
||||
* [Scan Options](#scan-options)
|
||||
* [Options Examples](#options-examples)
|
||||
- [Globbing features](#globbing-features)
|
||||
* [Basic globbing](#basic-globbing)
|
||||
* [Advanced globbing](#advanced-globbing)
|
||||
* [Braces](#braces)
|
||||
* [Matching special characters as literals](#matching-special-characters-as-literals)
|
||||
- [Library Comparisons](#library-comparisons)
|
||||
- [Benchmarks](#benchmarks)
|
||||
- [Philosophies](#philosophies)
|
||||
- [About](#about)
|
||||
* [Author](#author)
|
||||
* [License](#license)
|
||||
|
||||
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
|
||||
|
||||
</details>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install --save picomatch
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Usage
|
||||
|
||||
The main export is a function that takes a glob pattern and an options object and returns a function for matching strings.
|
||||
|
||||
```js
|
||||
const pm = require('picomatch');
|
||||
const isMatch = pm('*.js');
|
||||
|
||||
console.log(isMatch('abcd')); //=> false
|
||||
console.log(isMatch('a.js')); //=> true
|
||||
console.log(isMatch('a.md')); //=> false
|
||||
console.log(isMatch('a/b.js')); //=> false
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## API
|
||||
|
||||
### [picomatch](lib/picomatch.js#L32)
|
||||
|
||||
Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information.
|
||||
|
||||
**Params**
|
||||
|
||||
* `globs` **{String|Array}**: One or more glob patterns.
|
||||
* `options` **{Object=}**
|
||||
* `returns` **{Function=}**: Returns a matcher function.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch(glob[, options]);
|
||||
|
||||
const isMatch = picomatch('*.!(*a)');
|
||||
console.log(isMatch('a.a')); //=> false
|
||||
console.log(isMatch('a.b')); //=> true
|
||||
```
|
||||
|
||||
### [.test](lib/picomatch.js#L117)
|
||||
|
||||
Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: String to test.
|
||||
* `regex` **{RegExp}**
|
||||
* `returns` **{Object}**: Returns an object with matching info.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.test(input, regex[, options]);
|
||||
|
||||
console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
||||
// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
||||
```
|
||||
|
||||
### [.matchBase](lib/picomatch.js#L161)
|
||||
|
||||
Match the basename of a filepath.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: String to test.
|
||||
* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe).
|
||||
* `returns` **{Boolean}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.matchBase(input, glob[, options]);
|
||||
console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
||||
```
|
||||
|
||||
### [.isMatch](lib/picomatch.js#L183)
|
||||
|
||||
Returns true if **any** of the given glob `patterns` match the specified `string`.
|
||||
|
||||
**Params**
|
||||
|
||||
* **{String|Array}**: str The string to test.
|
||||
* **{String|Array}**: patterns One or more glob patterns to use for matching.
|
||||
* **{Object}**: See available [options](#options).
|
||||
* `returns` **{Boolean}**: Returns true if any patterns match `str`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.isMatch(string, patterns[, options]);
|
||||
|
||||
console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
||||
console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
||||
```
|
||||
|
||||
### [.parse](lib/picomatch.js#L199)
|
||||
|
||||
Parse a glob pattern to create the source string for a regular expression.
|
||||
|
||||
**Params**
|
||||
|
||||
* `pattern` **{String}**
|
||||
* `options` **{Object}**
|
||||
* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
const result = picomatch.parse(pattern[, options]);
|
||||
```
|
||||
|
||||
### [.scan](lib/picomatch.js#L231)
|
||||
|
||||
Scan a glob pattern to separate the pattern into segments.
|
||||
|
||||
**Params**
|
||||
|
||||
* `input` **{String}**: Glob pattern to scan.
|
||||
* `options` **{Object}**
|
||||
* `returns` **{Object}**: Returns an object with
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.scan(input[, options]);
|
||||
|
||||
const result = picomatch.scan('!./foo/*.js');
|
||||
console.log(result);
|
||||
{ prefix: '!./',
|
||||
input: '!./foo/*.js',
|
||||
start: 3,
|
||||
base: 'foo',
|
||||
glob: '*.js',
|
||||
isBrace: false,
|
||||
isBracket: false,
|
||||
isGlob: true,
|
||||
isExtglob: false,
|
||||
isGlobstar: false,
|
||||
negated: true }
|
||||
```
|
||||
|
||||
### [.compileRe](lib/picomatch.js#L250)
|
||||
|
||||
Create a regular expression from a parsed glob pattern.
|
||||
|
||||
**Params**
|
||||
|
||||
* `state` **{String}**: The object returned from the `.parse` method.
|
||||
* `options` **{Object}**
|
||||
* `returns` **{RegExp}**: Returns a regex created from the given pattern.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
const state = picomatch.parse('*.js');
|
||||
// picomatch.compileRe(state[, options]);
|
||||
|
||||
console.log(picomatch.compileRe(state));
|
||||
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
```
|
||||
|
||||
### [.toRegex](lib/picomatch.js#L318)
|
||||
|
||||
Create a regular expression from the given regex source string.
|
||||
|
||||
**Params**
|
||||
|
||||
* `source` **{String}**: Regular expression source string.
|
||||
* `options` **{Object}**
|
||||
* `returns` **{RegExp}**
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
// picomatch.toRegex(source[, options]);
|
||||
|
||||
const { output } = picomatch.parse('*.js');
|
||||
console.log(picomatch.toRegex(output));
|
||||
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Options
|
||||
|
||||
### Picomatch options
|
||||
|
||||
The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API.
|
||||
|
||||
| **Option** | **Type** | **Default value** | **Description** |
|
||||
| --- | --- | --- | --- |
|
||||
| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. |
|
||||
| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). |
|
||||
| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. |
|
||||
| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). |
|
||||
| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` |
|
||||
| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. |
|
||||
| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true |
|
||||
| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. |
|
||||
| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. |
|
||||
| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. |
|
||||
| `flags` | `boolean` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. |
|
||||
| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. |
|
||||
| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. |
|
||||
| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. |
|
||||
| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. |
|
||||
| `lookbehinds` | `boolean` | `true` | Support regex positive and negative lookbehinds. Note that you must be using Node 8.1.10 or higher to enable regex lookbehinds. |
|
||||
| `matchBase` | `boolean` | `false` | Alias for `basename` |
|
||||
| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. |
|
||||
| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. |
|
||||
| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. |
|
||||
| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. |
|
||||
| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. |
|
||||
| `noext` | `boolean` | `false` | Alias for `noextglob` |
|
||||
| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) |
|
||||
| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) |
|
||||
| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` |
|
||||
| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. |
|
||||
| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. |
|
||||
| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. |
|
||||
| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. |
|
||||
| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). |
|
||||
| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself |
|
||||
| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. |
|
||||
| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). |
|
||||
| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. |
|
||||
| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. |
|
||||
| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. |
|
||||
| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. |
|
||||
|
||||
### Scan Options
|
||||
|
||||
In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method.
|
||||
|
||||
| **Option** | **Type** | **Default value** | **Description** |
|
||||
| --- | --- | --- | --- |
|
||||
| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern |
|
||||
| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true |
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const picomatch = require('picomatch');
|
||||
const result = picomatch.scan('!./foo/*.js', { tokens: true });
|
||||
console.log(result);
|
||||
// {
|
||||
// prefix: '!./',
|
||||
// input: '!./foo/*.js',
|
||||
// start: 3,
|
||||
// base: 'foo',
|
||||
// glob: '*.js',
|
||||
// isBrace: false,
|
||||
// isBracket: false,
|
||||
// isGlob: true,
|
||||
// isExtglob: false,
|
||||
// isGlobstar: false,
|
||||
// negated: true,
|
||||
// maxDepth: 2,
|
||||
// tokens: [
|
||||
// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true },
|
||||
// { value: 'foo', depth: 1, isGlob: false },
|
||||
// { value: '*.js', depth: 1, isGlob: true }
|
||||
// ],
|
||||
// slashes: [ 2, 6 ],
|
||||
// parts: [ 'foo', '*.js' ]
|
||||
// }
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### Options Examples
|
||||
|
||||
#### options.expandRange
|
||||
|
||||
**Type**: `function`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need.
|
||||
|
||||
**Example**
|
||||
|
||||
The following example shows how to create a glob that matches a folder
|
||||
|
||||
```js
|
||||
const fill = require('fill-range');
|
||||
const regex = pm.makeRe('foo/{01..25}/bar', {
|
||||
expandRange(a, b) {
|
||||
return `(${fill(a, b, { toRegex: true })})`;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(regex);
|
||||
//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/
|
||||
|
||||
console.log(regex.test('foo/00/bar')) // false
|
||||
console.log(regex.test('foo/01/bar')) // true
|
||||
console.log(regex.test('foo/10/bar')) // true
|
||||
console.log(regex.test('foo/22/bar')) // true
|
||||
console.log(regex.test('foo/25/bar')) // true
|
||||
console.log(regex.test('foo/26/bar')) // false
|
||||
```
|
||||
|
||||
#### options.format
|
||||
|
||||
**Type**: `function`
|
||||
|
||||
**Default**: `undefined`
|
||||
|
||||
Custom function for formatting strings before they're matched.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
// strip leading './' from strings
|
||||
const format = str => str.replace(/^\.\//, '');
|
||||
const isMatch = picomatch('foo/*.js', { format });
|
||||
console.log(isMatch('./foo/bar.js')); //=> true
|
||||
```
|
||||
|
||||
#### options.onMatch
|
||||
|
||||
```js
|
||||
const onMatch = ({ glob, regex, input, output }) => {
|
||||
console.log({ glob, regex, input, output });
|
||||
};
|
||||
|
||||
const isMatch = picomatch('*', { onMatch });
|
||||
isMatch('foo');
|
||||
isMatch('bar');
|
||||
isMatch('baz');
|
||||
```
|
||||
|
||||
#### options.onIgnore
|
||||
|
||||
```js
|
||||
const onIgnore = ({ glob, regex, input, output }) => {
|
||||
console.log({ glob, regex, input, output });
|
||||
};
|
||||
|
||||
const isMatch = picomatch('*', { onIgnore, ignore: 'f*' });
|
||||
isMatch('foo');
|
||||
isMatch('bar');
|
||||
isMatch('baz');
|
||||
```
|
||||
|
||||
#### options.onResult
|
||||
|
||||
```js
|
||||
const onResult = ({ glob, regex, input, output }) => {
|
||||
console.log({ glob, regex, input, output });
|
||||
};
|
||||
|
||||
const isMatch = picomatch('*', { onResult, ignore: 'f*' });
|
||||
isMatch('foo');
|
||||
isMatch('bar');
|
||||
isMatch('baz');
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Globbing features
|
||||
|
||||
* [Basic globbing](#basic-globbing) (Wildcard matching)
|
||||
* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching)
|
||||
|
||||
### Basic globbing
|
||||
|
||||
| **Character** | **Description** |
|
||||
| --- | --- |
|
||||
| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. |
|
||||
| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. |
|
||||
| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. |
|
||||
| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. |
|
||||
|
||||
#### Matching behavior vs. Bash
|
||||
|
||||
Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions:
|
||||
|
||||
* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`.
|
||||
* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`.
|
||||
|
||||
<br>
|
||||
|
||||
### Advanced globbing
|
||||
|
||||
* [extglobs](#extglobs)
|
||||
* [POSIX brackets](#posix-brackets)
|
||||
* [Braces](#brace-expansion)
|
||||
|
||||
#### Extglobs
|
||||
|
||||
| **Pattern** | **Description** |
|
||||
| --- | --- |
|
||||
| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` |
|
||||
| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` |
|
||||
| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` |
|
||||
| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` |
|
||||
| `!(pattern)` | Match _anything but_ `pattern` |
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const pm = require('picomatch');
|
||||
|
||||
// *(pattern) matches ZERO or more of "pattern"
|
||||
console.log(pm.isMatch('a', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('az', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('azzz', 'a*(z)')); // true
|
||||
|
||||
// +(pattern) matches ONE or more of "pattern"
|
||||
console.log(pm.isMatch('a', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('az', 'a*(z)')); // true
|
||||
console.log(pm.isMatch('azzz', 'a*(z)')); // true
|
||||
|
||||
// supports multiple extglobs
|
||||
console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false
|
||||
|
||||
// supports nested extglobs
|
||||
console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true
|
||||
```
|
||||
|
||||
#### POSIX brackets
|
||||
|
||||
POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true.
|
||||
|
||||
**Enable POSIX bracket support**
|
||||
|
||||
```js
|
||||
console.log(pm.makeRe('[[:word:]]+', { posix: true }));
|
||||
//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/
|
||||
```
|
||||
|
||||
**Supported POSIX classes**
|
||||
|
||||
The following named POSIX bracket expressions are supported:
|
||||
|
||||
* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]`
|
||||
* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`.
|
||||
* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`.
|
||||
* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`.
|
||||
* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`.
|
||||
* `[:digit:]` - Numerical digits, equivalent to `[0-9]`.
|
||||
* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`.
|
||||
* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`.
|
||||
* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`.
|
||||
* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`.
|
||||
* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`.
|
||||
* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`.
|
||||
* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`.
|
||||
* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`.
|
||||
|
||||
See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information.
|
||||
|
||||
### Braces
|
||||
|
||||
Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces.
|
||||
|
||||
### Matching special characters as literals
|
||||
|
||||
If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes:
|
||||
|
||||
**Special Characters**
|
||||
|
||||
Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms.
|
||||
|
||||
To match any of the following characters as literals: `$^*+?()[]
|
||||
|
||||
Examples:
|
||||
|
||||
```js
|
||||
console.log(pm.makeRe('foo/bar \\(1\\)'));
|
||||
console.log(pm.makeRe('foo/bar \\(1\\)'));
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Library Comparisons
|
||||
|
||||
The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets).
|
||||
|
||||
| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - |
|
||||
| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - |
|
||||
| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - |
|
||||
| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - |
|
||||
| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - |
|
||||
| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ |
|
||||
| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ |
|
||||
| File system operations | - | - | - | - | - | - | - |
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Benchmarks
|
||||
|
||||
Performance comparison of picomatch and minimatch.
|
||||
|
||||
```
|
||||
# .makeRe star
|
||||
picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled)
|
||||
minimatch x 627,206 ops/sec ±1.96% (87 runs sampled))
|
||||
|
||||
# .makeRe star; dot=true
|
||||
picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled)
|
||||
minimatch x 525,876 ops/sec ±0.60% (88 runs sampled)
|
||||
|
||||
# .makeRe globstar
|
||||
picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled)
|
||||
minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d)
|
||||
|
||||
# .makeRe globstars
|
||||
picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled)
|
||||
minimatch x 477,179 ops/sec ±1.33% (91 runs sampled)
|
||||
|
||||
# .makeRe with leading star
|
||||
picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled)
|
||||
minimatch x 453,564 ops/sec ±1.43% (94 runs sampled)
|
||||
|
||||
# .makeRe - basic braces
|
||||
picomatch x 392,067 ops/sec ±0.70% (90 runs sampled)
|
||||
minimatch x 99,532 ops/sec ±2.03% (87 runs sampled))
|
||||
```
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## Philosophies
|
||||
|
||||
The goal of this library is to be blazing fast, without compromising on accuracy.
|
||||
|
||||
**Accuracy**
|
||||
|
||||
The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`.
|
||||
|
||||
Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements.
|
||||
|
||||
**Performance**
|
||||
|
||||
Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer.
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## About
|
||||
|
||||
<details>
|
||||
<summary><strong>Contributing</strong></summary>
|
||||
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||||
|
||||
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Running Tests</strong></summary>
|
||||
|
||||
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
||||
|
||||
```sh
|
||||
npm install && npm test
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><strong>Building docs</strong></summary>
|
||||
|
||||
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
||||
|
||||
To generate the readme, run the following command:
|
||||
|
||||
```sh
|
||||
npm install -g verbose/verb#dev verb-generate-readme && verb
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
* [GitHub Profile](https://github.com/jonschlinkert)
|
||||
* [Twitter Profile](https://twitter.com/jonschlinkert)
|
||||
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
|
||||
|
||||
### License
|
||||
|
||||
Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||||
Released under the [MIT License](LICENSE).
|
3
node_modules/picomatch/index.js
generated
vendored
3
node_modules/picomatch/index.js
generated
vendored
|
@ -1,3 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = require('./lib/picomatch');
|
179
node_modules/picomatch/lib/constants.js
generated
vendored
179
node_modules/picomatch/lib/constants.js
generated
vendored
|
@ -1,179 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const WIN_SLASH = '\\\\/';
|
||||
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
||||
|
||||
/**
|
||||
* Posix glob regex
|
||||
*/
|
||||
|
||||
const DOT_LITERAL = '\\.';
|
||||
const PLUS_LITERAL = '\\+';
|
||||
const QMARK_LITERAL = '\\?';
|
||||
const SLASH_LITERAL = '\\/';
|
||||
const ONE_CHAR = '(?=.)';
|
||||
const QMARK = '[^/]';
|
||||
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
||||
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
||||
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
||||
const NO_DOT = `(?!${DOT_LITERAL})`;
|
||||
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
||||
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
||||
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
||||
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
||||
const STAR = `${QMARK}*?`;
|
||||
|
||||
const POSIX_CHARS = {
|
||||
DOT_LITERAL,
|
||||
PLUS_LITERAL,
|
||||
QMARK_LITERAL,
|
||||
SLASH_LITERAL,
|
||||
ONE_CHAR,
|
||||
QMARK,
|
||||
END_ANCHOR,
|
||||
DOTS_SLASH,
|
||||
NO_DOT,
|
||||
NO_DOTS,
|
||||
NO_DOT_SLASH,
|
||||
NO_DOTS_SLASH,
|
||||
QMARK_NO_DOT,
|
||||
STAR,
|
||||
START_ANCHOR
|
||||
};
|
||||
|
||||
/**
|
||||
* Windows glob regex
|
||||
*/
|
||||
|
||||
const WINDOWS_CHARS = {
|
||||
...POSIX_CHARS,
|
||||
|
||||
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
||||
QMARK: WIN_NO_SLASH,
|
||||
STAR: `${WIN_NO_SLASH}*?`,
|
||||
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
||||
NO_DOT: `(?!${DOT_LITERAL})`,
|
||||
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
||||
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
||||
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
||||
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
||||
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
||||
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
||||
};
|
||||
|
||||
/**
|
||||
* POSIX Bracket Regex
|
||||
*/
|
||||
|
||||
const POSIX_REGEX_SOURCE = {
|
||||
alnum: 'a-zA-Z0-9',
|
||||
alpha: 'a-zA-Z',
|
||||
ascii: '\\x00-\\x7F',
|
||||
blank: ' \\t',
|
||||
cntrl: '\\x00-\\x1F\\x7F',
|
||||
digit: '0-9',
|
||||
graph: '\\x21-\\x7E',
|
||||
lower: 'a-z',
|
||||
print: '\\x20-\\x7E ',
|
||||
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
||||
space: ' \\t\\r\\n\\v\\f',
|
||||
upper: 'A-Z',
|
||||
word: 'A-Za-z0-9_',
|
||||
xdigit: 'A-Fa-f0-9'
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
MAX_LENGTH: 1024 * 64,
|
||||
POSIX_REGEX_SOURCE,
|
||||
|
||||
// regular expressions
|
||||
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
||||
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
||||
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
||||
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
||||
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
||||
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
||||
|
||||
// Replace globs with equivalent patterns to reduce parsing time.
|
||||
REPLACEMENTS: {
|
||||
'***': '*',
|
||||
'**/**': '**',
|
||||
'**/**/**': '**'
|
||||
},
|
||||
|
||||
// Digits
|
||||
CHAR_0: 48, /* 0 */
|
||||
CHAR_9: 57, /* 9 */
|
||||
|
||||
// Alphabet chars.
|
||||
CHAR_UPPERCASE_A: 65, /* A */
|
||||
CHAR_LOWERCASE_A: 97, /* a */
|
||||
CHAR_UPPERCASE_Z: 90, /* Z */
|
||||
CHAR_LOWERCASE_Z: 122, /* z */
|
||||
|
||||
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
||||
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
||||
|
||||
CHAR_ASTERISK: 42, /* * */
|
||||
|
||||
// Non-alphabetic chars.
|
||||
CHAR_AMPERSAND: 38, /* & */
|
||||
CHAR_AT: 64, /* @ */
|
||||
CHAR_BACKWARD_SLASH: 92, /* \ */
|
||||
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
||||
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
||||
CHAR_COLON: 58, /* : */
|
||||
CHAR_COMMA: 44, /* , */
|
||||
CHAR_DOT: 46, /* . */
|
||||
CHAR_DOUBLE_QUOTE: 34, /* " */
|
||||
CHAR_EQUAL: 61, /* = */
|
||||
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
||||
CHAR_FORM_FEED: 12, /* \f */
|
||||
CHAR_FORWARD_SLASH: 47, /* / */
|
||||
CHAR_GRAVE_ACCENT: 96, /* ` */
|
||||
CHAR_HASH: 35, /* # */
|
||||
CHAR_HYPHEN_MINUS: 45, /* - */
|
||||
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
||||
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
||||
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
||||
CHAR_LINE_FEED: 10, /* \n */
|
||||
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
||||
CHAR_PERCENT: 37, /* % */
|
||||
CHAR_PLUS: 43, /* + */
|
||||
CHAR_QUESTION_MARK: 63, /* ? */
|
||||
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
||||
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
||||
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
||||
CHAR_SEMICOLON: 59, /* ; */
|
||||
CHAR_SINGLE_QUOTE: 39, /* ' */
|
||||
CHAR_SPACE: 32, /* */
|
||||
CHAR_TAB: 9, /* \t */
|
||||
CHAR_UNDERSCORE: 95, /* _ */
|
||||
CHAR_VERTICAL_LINE: 124, /* | */
|
||||
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
||||
|
||||
SEP: path.sep,
|
||||
|
||||
/**
|
||||
* Create EXTGLOB_CHARS
|
||||
*/
|
||||
|
||||
extglobChars(chars) {
|
||||
return {
|
||||
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
||||
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
||||
'+': { type: 'plus', open: '(?:', close: ')+' },
|
||||
'*': { type: 'star', open: '(?:', close: ')*' },
|
||||
'@': { type: 'at', open: '(?:', close: ')' }
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Create GLOB_CHARS
|
||||
*/
|
||||
|
||||
globChars(win32) {
|
||||
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
||||
}
|
||||
};
|
1078
node_modules/picomatch/lib/parse.js
generated
vendored
1078
node_modules/picomatch/lib/parse.js
generated
vendored
File diff suppressed because it is too large
Load Diff
339
node_modules/picomatch/lib/picomatch.js
generated
vendored
339
node_modules/picomatch/lib/picomatch.js
generated
vendored
|
@ -1,339 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const scan = require('./scan');
|
||||
const parse = require('./parse');
|
||||
const utils = require('./utils');
|
||||
const constants = require('./constants');
|
||||
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
||||
|
||||
/**
|
||||
* Creates a matcher function from one or more glob patterns. The
|
||||
* returned function takes a string to match as its first argument,
|
||||
* and returns true if the string is a match. The returned matcher
|
||||
* function also takes a boolean as the second argument that, when true,
|
||||
* returns an object with additional information.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch(glob[, options]);
|
||||
*
|
||||
* const isMatch = picomatch('*.!(*a)');
|
||||
* console.log(isMatch('a.a')); //=> false
|
||||
* console.log(isMatch('a.b')); //=> true
|
||||
* ```
|
||||
* @name picomatch
|
||||
* @param {String|Array} `globs` One or more glob patterns.
|
||||
* @param {Object=} `options`
|
||||
* @return {Function=} Returns a matcher function.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
const picomatch = (glob, options, returnState = false) => {
|
||||
if (Array.isArray(glob)) {
|
||||
const fns = glob.map(input => picomatch(input, options, returnState));
|
||||
const arrayMatcher = str => {
|
||||
for (const isMatch of fns) {
|
||||
const state = isMatch(str);
|
||||
if (state) return state;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
return arrayMatcher;
|
||||
}
|
||||
|
||||
const isState = isObject(glob) && glob.tokens && glob.input;
|
||||
|
||||
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
||||
throw new TypeError('Expected pattern to be a non-empty string');
|
||||
}
|
||||
|
||||
const opts = options || {};
|
||||
const posix = utils.isWindows(options);
|
||||
const regex = isState
|
||||
? picomatch.compileRe(glob, options)
|
||||
: picomatch.makeRe(glob, options, false, true);
|
||||
|
||||
const state = regex.state;
|
||||
delete regex.state;
|
||||
|
||||
let isIgnored = () => false;
|
||||
if (opts.ignore) {
|
||||
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
||||
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
||||
}
|
||||
|
||||
const matcher = (input, returnObject = false) => {
|
||||
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
||||
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
||||
|
||||
if (typeof opts.onResult === 'function') {
|
||||
opts.onResult(result);
|
||||
}
|
||||
|
||||
if (isMatch === false) {
|
||||
result.isMatch = false;
|
||||
return returnObject ? result : false;
|
||||
}
|
||||
|
||||
if (isIgnored(input)) {
|
||||
if (typeof opts.onIgnore === 'function') {
|
||||
opts.onIgnore(result);
|
||||
}
|
||||
result.isMatch = false;
|
||||
return returnObject ? result : false;
|
||||
}
|
||||
|
||||
if (typeof opts.onMatch === 'function') {
|
||||
opts.onMatch(result);
|
||||
}
|
||||
return returnObject ? result : true;
|
||||
};
|
||||
|
||||
if (returnState) {
|
||||
matcher.state = state;
|
||||
}
|
||||
|
||||
return matcher;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test `input` with the given `regex`. This is used by the main
|
||||
* `picomatch()` function to test the input string.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.test(input, regex[, options]);
|
||||
*
|
||||
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
||||
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
||||
* ```
|
||||
* @param {String} `input` String to test.
|
||||
* @param {RegExp} `regex`
|
||||
* @return {Object} Returns an object with matching info.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
||||
if (typeof input !== 'string') {
|
||||
throw new TypeError('Expected input to be a string');
|
||||
}
|
||||
|
||||
if (input === '') {
|
||||
return { isMatch: false, output: '' };
|
||||
}
|
||||
|
||||
const opts = options || {};
|
||||
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
||||
let match = input === glob;
|
||||
let output = (match && format) ? format(input) : input;
|
||||
|
||||
if (match === false) {
|
||||
output = format ? format(input) : input;
|
||||
match = output === glob;
|
||||
}
|
||||
|
||||
if (match === false || opts.capture === true) {
|
||||
if (opts.matchBase === true || opts.basename === true) {
|
||||
match = picomatch.matchBase(input, regex, options, posix);
|
||||
} else {
|
||||
match = regex.exec(output);
|
||||
}
|
||||
}
|
||||
|
||||
return { isMatch: Boolean(match), match, output };
|
||||
};
|
||||
|
||||
/**
|
||||
* Match the basename of a filepath.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.matchBase(input, glob[, options]);
|
||||
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
||||
* ```
|
||||
* @param {String} `input` String to test.
|
||||
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
||||
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
||||
return regex.test(path.basename(input));
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.isMatch(string, patterns[, options]);
|
||||
*
|
||||
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
||||
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
||||
* ```
|
||||
* @param {String|Array} str The string to test.
|
||||
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
||||
* @param {Object} [options] See available [options](#options).
|
||||
* @return {Boolean} Returns true if any patterns match `str`
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
||||
|
||||
/**
|
||||
* Parse a glob pattern to create the source string for a regular
|
||||
* expression.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* const result = picomatch.parse(pattern[, options]);
|
||||
* ```
|
||||
* @param {String} `pattern`
|
||||
* @param {Object} `options`
|
||||
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.parse = (pattern, options) => {
|
||||
if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
|
||||
return parse(pattern, { ...options, fastpaths: false });
|
||||
};
|
||||
|
||||
/**
|
||||
* Scan a glob pattern to separate the pattern into segments.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.scan(input[, options]);
|
||||
*
|
||||
* const result = picomatch.scan('!./foo/*.js');
|
||||
* console.log(result);
|
||||
* { prefix: '!./',
|
||||
* input: '!./foo/*.js',
|
||||
* start: 3,
|
||||
* base: 'foo',
|
||||
* glob: '*.js',
|
||||
* isBrace: false,
|
||||
* isBracket: false,
|
||||
* isGlob: true,
|
||||
* isExtglob: false,
|
||||
* isGlobstar: false,
|
||||
* negated: true }
|
||||
* ```
|
||||
* @param {String} `input` Glob pattern to scan.
|
||||
* @param {Object} `options`
|
||||
* @return {Object} Returns an object with
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.scan = (input, options) => scan(input, options);
|
||||
|
||||
/**
|
||||
* Create a regular expression from a parsed glob pattern.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* const state = picomatch.parse('*.js');
|
||||
* // picomatch.compileRe(state[, options]);
|
||||
*
|
||||
* console.log(picomatch.compileRe(state));
|
||||
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
* ```
|
||||
* @param {String} `state` The object returned from the `.parse` method.
|
||||
* @param {Object} `options`
|
||||
* @return {RegExp} Returns a regex created from the given pattern.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => {
|
||||
if (returnOutput === true) {
|
||||
return parsed.output;
|
||||
}
|
||||
|
||||
const opts = options || {};
|
||||
const prepend = opts.contains ? '' : '^';
|
||||
const append = opts.contains ? '' : '$';
|
||||
|
||||
let source = `${prepend}(?:${parsed.output})${append}`;
|
||||
if (parsed && parsed.negated === true) {
|
||||
source = `^(?!${source}).*$`;
|
||||
}
|
||||
|
||||
const regex = picomatch.toRegex(source, options);
|
||||
if (returnState === true) {
|
||||
regex.state = parsed;
|
||||
}
|
||||
|
||||
return regex;
|
||||
};
|
||||
|
||||
picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => {
|
||||
if (!input || typeof input !== 'string') {
|
||||
throw new TypeError('Expected a non-empty string');
|
||||
}
|
||||
|
||||
const opts = options || {};
|
||||
let parsed = { negated: false, fastpaths: true };
|
||||
let prefix = '';
|
||||
let output;
|
||||
|
||||
if (input.startsWith('./')) {
|
||||
input = input.slice(2);
|
||||
prefix = parsed.prefix = './';
|
||||
}
|
||||
|
||||
if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
||||
output = parse.fastpaths(input, options);
|
||||
}
|
||||
|
||||
if (output === undefined) {
|
||||
parsed = parse(input, options);
|
||||
parsed.prefix = prefix + (parsed.prefix || '');
|
||||
} else {
|
||||
parsed.output = output;
|
||||
}
|
||||
|
||||
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a regular expression from the given regex source string.
|
||||
*
|
||||
* ```js
|
||||
* const picomatch = require('picomatch');
|
||||
* // picomatch.toRegex(source[, options]);
|
||||
*
|
||||
* const { output } = picomatch.parse('*.js');
|
||||
* console.log(picomatch.toRegex(output));
|
||||
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||||
* ```
|
||||
* @param {String} `source` Regular expression source string.
|
||||
* @param {Object} `options`
|
||||
* @return {RegExp}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
picomatch.toRegex = (source, options) => {
|
||||
try {
|
||||
const opts = options || {};
|
||||
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
||||
} catch (err) {
|
||||
if (options && options.debug === true) throw err;
|
||||
return /$^/;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Picomatch constants.
|
||||
* @return {Object}
|
||||
*/
|
||||
|
||||
picomatch.constants = constants;
|
||||
|
||||
/**
|
||||
* Expose "picomatch"
|
||||
*/
|
||||
|
||||
module.exports = picomatch;
|
383
node_modules/picomatch/lib/scan.js
generated
vendored
383
node_modules/picomatch/lib/scan.js
generated
vendored
|
@ -1,383 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const utils = require('./utils');
|
||||
const {
|
||||
CHAR_ASTERISK, /* * */
|
||||
CHAR_AT, /* @ */
|
||||
CHAR_BACKWARD_SLASH, /* \ */
|
||||
CHAR_COMMA, /* , */
|
||||
CHAR_DOT, /* . */
|
||||
CHAR_EXCLAMATION_MARK, /* ! */
|
||||
CHAR_FORWARD_SLASH, /* / */
|
||||
CHAR_LEFT_CURLY_BRACE, /* { */
|
||||
CHAR_LEFT_PARENTHESES, /* ( */
|
||||
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
||||
CHAR_PLUS, /* + */
|
||||
CHAR_QUESTION_MARK, /* ? */
|
||||
CHAR_RIGHT_CURLY_BRACE, /* } */
|
||||
CHAR_RIGHT_PARENTHESES, /* ) */
|
||||
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
||||
} = require('./constants');
|
||||
|
||||
const isPathSeparator = code => {
|
||||
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
||||
};
|
||||
|
||||
const depth = token => {
|
||||
if (token.isPrefix !== true) {
|
||||
token.depth = token.isGlobstar ? Infinity : 1;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Quickly scans a glob pattern and returns an object with a handful of
|
||||
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
||||
* `glob` (the actual pattern), and `negated` (true if the path starts with `!`).
|
||||
*
|
||||
* ```js
|
||||
* const pm = require('picomatch');
|
||||
* console.log(pm.scan('foo/bar/*.js'));
|
||||
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
||||
* ```
|
||||
* @param {String} `str`
|
||||
* @param {Object} `options`
|
||||
* @return {Object} Returns an object with tokens and regex source string.
|
||||
* @api public
|
||||
*/
|
||||
|
||||
const scan = (input, options) => {
|
||||
const opts = options || {};
|
||||
|
||||
const length = input.length - 1;
|
||||
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
||||
const slashes = [];
|
||||
const tokens = [];
|
||||
const parts = [];
|
||||
|
||||
let str = input;
|
||||
let index = -1;
|
||||
let start = 0;
|
||||
let lastIndex = 0;
|
||||
let isBrace = false;
|
||||
let isBracket = false;
|
||||
let isGlob = false;
|
||||
let isExtglob = false;
|
||||
let isGlobstar = false;
|
||||
let braceEscaped = false;
|
||||
let backslashes = false;
|
||||
let negated = false;
|
||||
let finished = false;
|
||||
let braces = 0;
|
||||
let prev;
|
||||
let code;
|
||||
let token = { value: '', depth: 0, isGlob: false };
|
||||
|
||||
const eos = () => index >= length;
|
||||
const peek = () => str.charCodeAt(index + 1);
|
||||
const advance = () => {
|
||||
prev = code;
|
||||
return str.charCodeAt(++index);
|
||||
};
|
||||
|
||||
while (index < length) {
|
||||
code = advance();
|
||||
let next;
|
||||
|
||||
if (code === CHAR_BACKWARD_SLASH) {
|
||||
backslashes = token.backslashes = true;
|
||||
code = advance();
|
||||
|
||||
if (code === CHAR_LEFT_CURLY_BRACE) {
|
||||
braceEscaped = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
||||
braces++;
|
||||
|
||||
while (eos() !== true && (code = advance())) {
|
||||
if (code === CHAR_BACKWARD_SLASH) {
|
||||
backslashes = token.backslashes = true;
|
||||
advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (code === CHAR_LEFT_CURLY_BRACE) {
|
||||
braces++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
||||
isBrace = token.isBrace = true;
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (braceEscaped !== true && code === CHAR_COMMA) {
|
||||
isBrace = token.isBrace = true;
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
||||
braces--;
|
||||
|
||||
if (braces === 0) {
|
||||
braceEscaped = false;
|
||||
isBrace = token.isBrace = true;
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (code === CHAR_FORWARD_SLASH) {
|
||||
slashes.push(index);
|
||||
tokens.push(token);
|
||||
token = { value: '', depth: 0, isGlob: false };
|
||||
|
||||
if (finished === true) continue;
|
||||
if (prev === CHAR_DOT && index === (start + 1)) {
|
||||
start += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
lastIndex = index + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (opts.noext !== true) {
|
||||
const isExtglobChar = code === CHAR_PLUS
|
||||
|| code === CHAR_AT
|
||||
|| code === CHAR_ASTERISK
|
||||
|| code === CHAR_QUESTION_MARK
|
||||
|| code === CHAR_EXCLAMATION_MARK;
|
||||
|
||||
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
||||
isGlob = token.isGlob = true;
|
||||
isExtglob = token.isExtglob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
while (eos() !== true && (code = advance())) {
|
||||
if (code === CHAR_BACKWARD_SLASH) {
|
||||
backslashes = token.backslashes = true;
|
||||
code = advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (code === CHAR_RIGHT_PARENTHESES) {
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (code === CHAR_ASTERISK) {
|
||||
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (code === CHAR_QUESTION_MARK) {
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
||||
while (eos() !== true && (next = advance())) {
|
||||
if (next === CHAR_BACKWARD_SLASH) {
|
||||
backslashes = token.backslashes = true;
|
||||
advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
||||
isBracket = token.isBracket = true;
|
||||
isGlob = token.isGlob = true;
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
||||
negated = token.negated = true;
|
||||
start++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
||||
isGlob = token.isGlob = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
while (eos() !== true && (code = advance())) {
|
||||
if (code === CHAR_LEFT_PARENTHESES) {
|
||||
backslashes = token.backslashes = true;
|
||||
code = advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (code === CHAR_RIGHT_PARENTHESES) {
|
||||
finished = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (isGlob === true) {
|
||||
finished = true;
|
||||
|
||||
if (scanToEnd === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.noext === true) {
|
||||
isExtglob = false;
|
||||
isGlob = false;
|
||||
}
|
||||
|
||||
let base = str;
|
||||
let prefix = '';
|
||||
let glob = '';
|
||||
|
||||
if (start > 0) {
|
||||
prefix = str.slice(0, start);
|
||||
str = str.slice(start);
|
||||
lastIndex -= start;
|
||||
}
|
||||
|
||||
if (base && isGlob === true && lastIndex > 0) {
|
||||
base = str.slice(0, lastIndex);
|
||||
glob = str.slice(lastIndex);
|
||||
} else if (isGlob === true) {
|
||||
base = '';
|
||||
glob = str;
|
||||
} else {
|
||||
base = str;
|
||||
}
|
||||
|
||||
if (base && base !== '' && base !== '/' && base !== str) {
|
||||
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
||||
base = base.slice(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.unescape === true) {
|
||||
if (glob) glob = utils.removeBackslashes(glob);
|
||||
|
||||
if (base && backslashes === true) {
|
||||
base = utils.removeBackslashes(base);
|
||||
}
|
||||
}
|
||||
|
||||
const state = {
|
||||
prefix,
|
||||
input,
|
||||
start,
|
||||
base,
|
||||
glob,
|
||||
isBrace,
|
||||
isBracket,
|
||||
isGlob,
|
||||
isExtglob,
|
||||
isGlobstar,
|
||||
negated
|
||||
};
|
||||
|
||||
if (opts.tokens === true) {
|
||||
state.maxDepth = 0;
|
||||
if (!isPathSeparator(code)) {
|
||||
tokens.push(token);
|
||||
}
|
||||
state.tokens = tokens;
|
||||
}
|
||||
|
||||
if (opts.parts === true || opts.tokens === true) {
|
||||
let prevIndex;
|
||||
|
||||
for (let idx = 0; idx < slashes.length; idx++) {
|
||||
const n = prevIndex ? prevIndex + 1 : start;
|
||||
const i = slashes[idx];
|
||||
const value = input.slice(n, i);
|
||||
if (opts.tokens) {
|
||||
if (idx === 0 && start !== 0) {
|
||||
tokens[idx].isPrefix = true;
|
||||
tokens[idx].value = prefix;
|
||||
} else {
|
||||
tokens[idx].value = value;
|
||||
}
|
||||
depth(tokens[idx]);
|
||||
state.maxDepth += tokens[idx].depth;
|
||||
}
|
||||
if (idx !== 0 || value !== '') {
|
||||
parts.push(value);
|
||||
}
|
||||
prevIndex = i;
|
||||
}
|
||||
|
||||
if (prevIndex && prevIndex + 1 < input.length) {
|
||||
const value = input.slice(prevIndex + 1);
|
||||
parts.push(value);
|
||||
|
||||
if (opts.tokens) {
|
||||
tokens[tokens.length - 1].value = value;
|
||||
depth(tokens[tokens.length - 1]);
|
||||
state.maxDepth += tokens[tokens.length - 1].depth;
|
||||
}
|
||||
}
|
||||
|
||||
state.slashes = slashes;
|
||||
state.parts = parts;
|
||||
}
|
||||
|
||||
return state;
|
||||
};
|
||||
|
||||
module.exports = scan;
|
64
node_modules/picomatch/lib/utils.js
generated
vendored
64
node_modules/picomatch/lib/utils.js
generated
vendored
|
@ -1,64 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const win32 = process.platform === 'win32';
|
||||
const {
|
||||
REGEX_BACKSLASH,
|
||||
REGEX_REMOVE_BACKSLASH,
|
||||
REGEX_SPECIAL_CHARS,
|
||||
REGEX_SPECIAL_CHARS_GLOBAL
|
||||
} = require('./constants');
|
||||
|
||||
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
||||
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
||||
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
||||
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
||||
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
||||
|
||||
exports.removeBackslashes = str => {
|
||||
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
||||
return match === '\\' ? '' : match;
|
||||
});
|
||||
};
|
||||
|
||||
exports.supportsLookbehinds = () => {
|
||||
const segs = process.version.slice(1).split('.').map(Number);
|
||||
if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.isWindows = options => {
|
||||
if (options && typeof options.windows === 'boolean') {
|
||||
return options.windows;
|
||||
}
|
||||
return win32 === true || path.sep === '\\';
|
||||
};
|
||||
|
||||
exports.escapeLast = (input, char, lastIdx) => {
|
||||
const idx = input.lastIndexOf(char, lastIdx);
|
||||
if (idx === -1) return input;
|
||||
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
||||
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
||||
};
|
||||
|
||||
exports.removePrefix = (input, state = {}) => {
|
||||
let output = input;
|
||||
if (output.startsWith('./')) {
|
||||
output = output.slice(2);
|
||||
state.prefix = './';
|
||||
}
|
||||
return output;
|
||||
};
|
||||
|
||||
exports.wrapOutput = (input, state = {}, options = {}) => {
|
||||
const prepend = options.contains ? '' : '^';
|
||||
const append = options.contains ? '' : '$';
|
||||
|
||||
let output = `${prepend}(?:${input})${append}`;
|
||||
if (state.negated === true) {
|
||||
output = `(?:^(?!${output}).*$)`;
|
||||
}
|
||||
return output;
|
||||
};
|
81
node_modules/picomatch/package.json
generated
vendored
81
node_modules/picomatch/package.json
generated
vendored
|
@ -1,81 +0,0 @@
|
|||
{
|
||||
"name": "picomatch",
|
||||
"description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.",
|
||||
"version": "2.2.2",
|
||||
"homepage": "https://github.com/micromatch/picomatch",
|
||||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
||||
"funding": "https://github.com/sponsors/jonschlinkert",
|
||||
"repository": "micromatch/picomatch",
|
||||
"bugs": {
|
||||
"url": "https://github.com/micromatch/picomatch/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .",
|
||||
"mocha": "mocha --reporter dot",
|
||||
"test": "npm run lint && npm run mocha",
|
||||
"test:ci": "npm run test:cover",
|
||||
"test:cover": "nyc npm run mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.8.0",
|
||||
"fill-range": "^7.0.1",
|
||||
"gulp-format-md": "^2.0.0",
|
||||
"mocha": "^6.2.2",
|
||||
"nyc": "^15.0.0",
|
||||
"time-require": "github:jonschlinkert/time-require"
|
||||
},
|
||||
"keywords": [
|
||||
"glob",
|
||||
"match",
|
||||
"picomatch"
|
||||
],
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"html",
|
||||
"lcov",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"verb": {
|
||||
"toc": {
|
||||
"render": true,
|
||||
"method": "preWrite",
|
||||
"maxdepth": 3
|
||||
},
|
||||
"layout": "empty",
|
||||
"tasks": [
|
||||
"readme"
|
||||
],
|
||||
"plugins": [
|
||||
"gulp-format-md"
|
||||
],
|
||||
"lint": {
|
||||
"reflinks": true
|
||||
},
|
||||
"related": {
|
||||
"list": [
|
||||
"braces",
|
||||
"micromatch"
|
||||
]
|
||||
},
|
||||
"reflinks": [
|
||||
"braces",
|
||||
"expand-brackets",
|
||||
"extglob",
|
||||
"fill-range",
|
||||
"micromatch",
|
||||
"minimatch",
|
||||
"nanomatch",
|
||||
"picomatch"
|
||||
]
|
||||
}
|
||||
}
|
34
node_modules/resolve/.editorconfig
generated
vendored
34
node_modules/resolve/.editorconfig
generated
vendored
|
@ -1,34 +0,0 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 200
|
||||
|
||||
[*.js]
|
||||
block_comment_start = /*
|
||||
block_comment = *
|
||||
block_comment_end = */
|
||||
|
||||
[*.yml]
|
||||
indent_size = 1
|
||||
|
||||
[package.json]
|
||||
indent_style = tab
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{*.json,Makefile}]
|
||||
max_line_length = off
|
||||
|
||||
[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*]
|
||||
indent_style = off
|
||||
indent_size = off
|
||||
max_line_length = off
|
||||
insert_final_newline = off
|
1
node_modules/resolve/.eslintignore
generated
vendored
1
node_modules/resolve/.eslintignore
generated
vendored
|
@ -1 +0,0 @@
|
|||
node_modules
|
39
node_modules/resolve/.eslintrc
generated
vendored
39
node_modules/resolve/.eslintrc
generated
vendored
|
@ -1,39 +0,0 @@
|
|||
{
|
||||
"extends": "@ljharb",
|
||||
"root": true,
|
||||
"rules": {
|
||||
"array-bracket-newline": 0,
|
||||
"array-element-newline": 0,
|
||||
"indent": [2, 4],
|
||||
"strict": 0,
|
||||
"complexity": 0,
|
||||
"consistent-return": 0,
|
||||
"curly": 0,
|
||||
"dot-notation": [2, { "allowKeywords": true }],
|
||||
"func-name-matching": 0,
|
||||
"func-style": 0,
|
||||
"global-require": 0,
|
||||
"id-length": [2, { "min": 1, "max": 30 }],
|
||||
"max-lines-per-function": 0,
|
||||
"max-nested-callbacks": 0,
|
||||
"max-params": 0,
|
||||
"max-statements-per-line": [2, { "max": 2 }],
|
||||
"max-statements": 0,
|
||||
"no-magic-numbers": 0,
|
||||
"no-console": 0,
|
||||
"no-shadow": 0,
|
||||
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
|
||||
"no-use-before-define": 0,
|
||||
"object-curly-newline": 0,
|
||||
"operator-linebreak": [2, "before"],
|
||||
"sort-keys": 0,
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/resolver/nested_symlinks/mylib/*.js",
|
||||
"rules": {
|
||||
"no-throw-literal": 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
54
node_modules/resolve/.github/workflows/node-4+.yml
generated
vendored
54
node_modules/resolve/.github/workflows/node-4+.yml
generated
vendored
|
@ -1,54 +0,0 @@
|
|||
name: 'Tests: node.js'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
latest: ${{ steps.set-matrix.outputs.requireds }}
|
||||
minors: ${{ steps.set-matrix.outputs.optionals }}
|
||||
steps:
|
||||
- uses: ljharb/actions/node/matrix@main
|
||||
id: set-matrix
|
||||
with:
|
||||
preset: '>=4'
|
||||
|
||||
latest:
|
||||
needs: [matrix]
|
||||
name: 'latest minors'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run tests-only'
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
minors:
|
||||
needs: [matrix, latest]
|
||||
name: 'non-latest minors'
|
||||
continue-on-error: true
|
||||
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
|
||||
node:
|
||||
name: 'node 4+'
|
||||
needs: [latest, minors]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo tests completed'
|
55
node_modules/resolve/.github/workflows/node-iojs.yml
generated
vendored
55
node_modules/resolve/.github/workflows/node-iojs.yml
generated
vendored
|
@ -1,55 +0,0 @@
|
|||
name: 'Tests: node.js (io.js)'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
latest: ${{ steps.set-matrix.outputs.requireds }}
|
||||
minors: ${{ steps.set-matrix.outputs.optionals }}
|
||||
steps:
|
||||
- uses: ljharb/actions/node/matrix@main
|
||||
id: set-matrix
|
||||
with:
|
||||
preset: 'iojs'
|
||||
|
||||
latest:
|
||||
needs: [matrix]
|
||||
name: 'latest minors'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run tests-only'
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
minors:
|
||||
needs: [matrix, latest]
|
||||
name: 'non-latest minors'
|
||||
continue-on-error: true
|
||||
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run tests-only'
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
|
||||
node:
|
||||
name: 'io.js'
|
||||
needs: [latest, minors]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo tests completed'
|
27
node_modules/resolve/.github/workflows/node-pretest.yml
generated
vendored
27
node_modules/resolve/.github/workflows/node-pretest.yml
generated
vendored
|
@ -1,27 +0,0 @@
|
|||
name: 'Tests: pretest/posttest'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
pretest:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run pretest'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
command: 'pretest'
|
||||
|
||||
posttest:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
name: 'npm install && npm run posttest'
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
command: 'posttest'
|
55
node_modules/resolve/.github/workflows/node-zero.yml
generated
vendored
55
node_modules/resolve/.github/workflows/node-zero.yml
generated
vendored
|
@ -1,55 +0,0 @@
|
|||
name: 'Tests: node.js (0.x)'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
stable: ${{ steps.set-matrix.outputs.requireds }}
|
||||
unstable: ${{ steps.set-matrix.outputs.optionals }}
|
||||
steps:
|
||||
- uses: ljharb/actions/node/matrix@main
|
||||
id: set-matrix
|
||||
with:
|
||||
preset: '0.x'
|
||||
|
||||
stable:
|
||||
needs: [matrix]
|
||||
name: 'stable minors'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.stable) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
|
||||
unstable:
|
||||
needs: [matrix, stable]
|
||||
name: 'unstable minors'
|
||||
continue-on-error: true
|
||||
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix: ${{ fromJson(needs.matrix.outputs.unstable) }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/actions/node/run@main
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
command: 'tests-only'
|
||||
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
|
||||
|
||||
node:
|
||||
name: 'node 0.x'
|
||||
needs: [stable, unstable]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: 'echo tests completed'
|
15
node_modules/resolve/.github/workflows/rebase.yml
generated
vendored
15
node_modules/resolve/.github/workflows/rebase.yml
generated
vendored
|
@ -1,15 +0,0 @@
|
|||
name: Automatic Rebase
|
||||
|
||||
on: [pull_request_target]
|
||||
|
||||
jobs:
|
||||
_:
|
||||
name: "Automatic Rebase"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ljharb/rebase@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
14
node_modules/resolve/.github/workflows/require-allow-edits.yml
generated
vendored
14
node_modules/resolve/.github/workflows/require-allow-edits.yml
generated
vendored
|
@ -1,14 +0,0 @@
|
|||
name: Require “Allow Edits”
|
||||
|
||||
on: [pull_request_target]
|
||||
|
||||
jobs:
|
||||
_:
|
||||
name: "Require “Allow Edits”"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: ljharb/require-allow-edits@main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
21
node_modules/resolve/LICENSE
generated
vendored
21
node_modules/resolve/LICENSE
generated
vendored
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2012 James Halliday
|
||||
|
||||
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.
|
74
node_modules/resolve/appveyor.yml
generated
vendored
74
node_modules/resolve/appveyor.yml
generated
vendored
|
@ -1,74 +0,0 @@
|
|||
version: 1.0.{build}
|
||||
skip_branch_with_pr: true
|
||||
build: off
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
#- nodejs_version: "15"
|
||||
- nodejs_version: "14"
|
||||
- nodejs_version: "13"
|
||||
- nodejs_version: "12"
|
||||
- nodejs_version: "11"
|
||||
- nodejs_version: "10"
|
||||
- nodejs_version: "9"
|
||||
- nodejs_version: "8"
|
||||
- nodejs_version: "7"
|
||||
- nodejs_version: "6"
|
||||
- nodejs_version: "5"
|
||||
- nodejs_version: "4"
|
||||
- nodejs_version: "3"
|
||||
- nodejs_version: "2"
|
||||
- nodejs_version: "1"
|
||||
- nodejs_version: "0.12"
|
||||
- nodejs_version: "0.10"
|
||||
- nodejs_version: "0.8"
|
||||
- nodejs_version: "0.6"
|
||||
matrix:
|
||||
# fast_finish: true
|
||||
allow_failures:
|
||||
- nodejs_version: "5" # due to windows npm bug, registry-side
|
||||
- nodejs_version: "0.8"
|
||||
# platform: x86 # x64 has started failing on the registry side, around early November 2020
|
||||
- nodejs_version: "0.6"
|
||||
|
||||
platform:
|
||||
- x86
|
||||
- x64
|
||||
|
||||
# Install scripts. (runs after repo cloning)
|
||||
install:
|
||||
# Fix symlinks in working copy (see https://github.com/appveyor/ci/issues/650#issuecomment-186592582) / https://github.com/charleskorn/batect/commit/d08986802ec43086902958c4ee7e57ff3e71dbef
|
||||
- git config core.symlinks true
|
||||
- git reset --hard
|
||||
# Get the latest stable version of Node.js or io.js
|
||||
- ps: if ($env:nodejs_version -ne '0.6') { Install-Product node $env:nodejs_version $env:platform }
|
||||
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:platform
|
||||
- IF %nodejs_version% EQU 0.6 npm config set strict-ssl false && npm -g install npm@1.3
|
||||
- IF %nodejs_version% EQU 0.8 npm config set strict-ssl false && npm -g install npm@1.4.28 && npm install -g npm@4.5
|
||||
- IF %nodejs_version% EQU 1 npm -g install npm@2.9
|
||||
- IF %nodejs_version% EQU 2 npm -g install npm@4
|
||||
- IF %nodejs_version% EQU 3 npm -g install npm@4
|
||||
- IF %nodejs_version% EQU 4 npm -g install npm@5.3
|
||||
- IF %nodejs_version% EQU 5 npm -g install npm@5.3
|
||||
- IF %nodejs_version% EQU 6 npm -g install npm@6.9
|
||||
- IF %nodejs_version% EQU 7 npm -g install npm@6
|
||||
- IF %nodejs_version% EQU 8 npm -g install npm@6
|
||||
- IF %nodejs_version% EQU 9 npm -g install npm@6.9
|
||||
- IF %nodejs_version% EQU 10 npm -g install npm@7
|
||||
- IF %nodejs_version% EQU 11 npm -g install npm@7
|
||||
- IF %nodejs_version% EQU 12 npm -g install npm@7
|
||||
- IF %nodejs_version% EQU 13 npm -g install npm@7
|
||||
- IF %nodejs_version% EQU 14 npm -g install npm@7
|
||||
- IF %nodejs_version% EQU 15 npm -g install npm@7
|
||||
- set PATH=%APPDATA%\npm;%PATH%
|
||||
#- IF %nodejs_version% NEQ 0.6 AND %nodejs_version% NEQ 0.8 npm -g install npm
|
||||
# install modules
|
||||
- npm install
|
||||
|
||||
# Post-install test scripts.
|
||||
test_script:
|
||||
# Output useful info for debugging.
|
||||
- node --version
|
||||
- npm --version
|
||||
# run tests
|
||||
- npm run tests-only
|
5
node_modules/resolve/example/async.js
generated
vendored
5
node_modules/resolve/example/async.js
generated
vendored
|
@ -1,5 +0,0 @@
|
|||
var resolve = require('../');
|
||||
resolve('tap', { basedir: __dirname }, function (err, res) {
|
||||
if (err) console.error(err);
|
||||
else console.log(res);
|
||||
});
|
3
node_modules/resolve/example/sync.js
generated
vendored
3
node_modules/resolve/example/sync.js
generated
vendored
|
@ -1,3 +0,0 @@
|
|||
var resolve = require('../');
|
||||
var res = resolve.sync('tap', { basedir: __dirname });
|
||||
console.log(res);
|
6
node_modules/resolve/index.js
generated
vendored
6
node_modules/resolve/index.js
generated
vendored
|
@ -1,6 +0,0 @@
|
|||
var async = require('./lib/async');
|
||||
async.core = require('./lib/core');
|
||||
async.isCore = require('./lib/is-core');
|
||||
async.sync = require('./lib/sync');
|
||||
|
||||
module.exports = async;
|
299
node_modules/resolve/lib/async.js
generated
vendored
299
node_modules/resolve/lib/async.js
generated
vendored
|
@ -1,299 +0,0 @@
|
|||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var caller = require('./caller');
|
||||
var nodeModulesPaths = require('./node-modules-paths');
|
||||
var normalizeOptions = require('./normalize-options');
|
||||
var isCore = require('is-core-module');
|
||||
|
||||
var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
|
||||
|
||||
var defaultIsFile = function isFile(file, cb) {
|
||||
fs.stat(file, function (err, stat) {
|
||||
if (!err) {
|
||||
return cb(null, stat.isFile() || stat.isFIFO());
|
||||
}
|
||||
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
|
||||
var defaultIsDir = function isDirectory(dir, cb) {
|
||||
fs.stat(dir, function (err, stat) {
|
||||
if (!err) {
|
||||
return cb(null, stat.isDirectory());
|
||||
}
|
||||
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
|
||||
var defaultRealpath = function realpath(x, cb) {
|
||||
realpathFS(x, function (realpathErr, realPath) {
|
||||
if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr);
|
||||
else cb(null, realpathErr ? x : realPath);
|
||||
});
|
||||
};
|
||||
|
||||
var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) {
|
||||
if (opts && opts.preserveSymlinks === false) {
|
||||
realpath(x, cb);
|
||||
} else {
|
||||
cb(null, x);
|
||||
}
|
||||
};
|
||||
|
||||
var getPackageCandidates = function getPackageCandidates(x, start, opts) {
|
||||
var dirs = nodeModulesPaths(start, opts, x);
|
||||
for (var i = 0; i < dirs.length; i++) {
|
||||
dirs[i] = path.join(dirs[i], x);
|
||||
}
|
||||
return dirs;
|
||||
};
|
||||
|
||||
module.exports = function resolve(x, options, callback) {
|
||||
var cb = callback;
|
||||
var opts = options;
|
||||
if (typeof options === 'function') {
|
||||
cb = opts;
|
||||
opts = {};
|
||||
}
|
||||
if (typeof x !== 'string') {
|
||||
var err = new TypeError('Path must be a string.');
|
||||
return process.nextTick(function () {
|
||||
cb(err);
|
||||
});
|
||||
}
|
||||
|
||||
opts = normalizeOptions(x, opts);
|
||||
|
||||
var isFile = opts.isFile || defaultIsFile;
|
||||
var isDirectory = opts.isDirectory || defaultIsDir;
|
||||
var readFile = opts.readFile || fs.readFile;
|
||||
var realpath = opts.realpath || defaultRealpath;
|
||||
var packageIterator = opts.packageIterator;
|
||||
|
||||
var extensions = opts.extensions || ['.js'];
|
||||
var includeCoreModules = opts.includeCoreModules !== false;
|
||||
var basedir = opts.basedir || path.dirname(caller());
|
||||
var parent = opts.filename || basedir;
|
||||
|
||||
opts.paths = opts.paths || [];
|
||||
|
||||
// ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
|
||||
var absoluteStart = path.resolve(basedir);
|
||||
|
||||
maybeRealpath(
|
||||
realpath,
|
||||
absoluteStart,
|
||||
opts,
|
||||
function (err, realStart) {
|
||||
if (err) cb(err);
|
||||
else init(realStart);
|
||||
}
|
||||
);
|
||||
|
||||
var res;
|
||||
function init(basedir) {
|
||||
if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) {
|
||||
res = path.resolve(basedir, x);
|
||||
if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
|
||||
if ((/\/$/).test(x) && res === basedir) {
|
||||
loadAsDirectory(res, opts.package, onfile);
|
||||
} else loadAsFile(res, opts.package, onfile);
|
||||
} else if (includeCoreModules && isCore(x)) {
|
||||
return cb(null, x);
|
||||
} else loadNodeModules(x, basedir, function (err, n, pkg) {
|
||||
if (err) cb(err);
|
||||
else if (n) {
|
||||
return maybeRealpath(realpath, n, opts, function (err, realN) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
} else {
|
||||
cb(null, realN, pkg);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
||||
moduleError.code = 'MODULE_NOT_FOUND';
|
||||
cb(moduleError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onfile(err, m, pkg) {
|
||||
if (err) cb(err);
|
||||
else if (m) cb(null, m, pkg);
|
||||
else loadAsDirectory(res, function (err, d, pkg) {
|
||||
if (err) cb(err);
|
||||
else if (d) {
|
||||
maybeRealpath(realpath, d, opts, function (err, realD) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
} else {
|
||||
cb(null, realD, pkg);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
||||
moduleError.code = 'MODULE_NOT_FOUND';
|
||||
cb(moduleError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadAsFile(x, thePackage, callback) {
|
||||
var loadAsFilePackage = thePackage;
|
||||
var cb = callback;
|
||||
if (typeof loadAsFilePackage === 'function') {
|
||||
cb = loadAsFilePackage;
|
||||
loadAsFilePackage = undefined;
|
||||
}
|
||||
|
||||
var exts = [''].concat(extensions);
|
||||
load(exts, x, loadAsFilePackage);
|
||||
|
||||
function load(exts, x, loadPackage) {
|
||||
if (exts.length === 0) return cb(null, undefined, loadPackage);
|
||||
var file = x + exts[0];
|
||||
|
||||
var pkg = loadPackage;
|
||||
if (pkg) onpkg(null, pkg);
|
||||
else loadpkg(path.dirname(file), onpkg);
|
||||
|
||||
function onpkg(err, pkg_, dir) {
|
||||
pkg = pkg_;
|
||||
if (err) return cb(err);
|
||||
if (dir && pkg && opts.pathFilter) {
|
||||
var rfile = path.relative(dir, file);
|
||||
var rel = rfile.slice(0, rfile.length - exts[0].length);
|
||||
var r = opts.pathFilter(pkg, x, rel);
|
||||
if (r) return load(
|
||||
[''].concat(extensions.slice()),
|
||||
path.resolve(dir, r),
|
||||
pkg
|
||||
);
|
||||
}
|
||||
isFile(file, onex);
|
||||
}
|
||||
function onex(err, ex) {
|
||||
if (err) return cb(err);
|
||||
if (ex) return cb(null, file, pkg);
|
||||
load(exts.slice(1), x, pkg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadpkg(dir, cb) {
|
||||
if (dir === '' || dir === '/') return cb(null);
|
||||
if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) {
|
||||
return cb(null);
|
||||
}
|
||||
if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null);
|
||||
|
||||
maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) {
|
||||
if (unwrapErr) return loadpkg(path.dirname(dir), cb);
|
||||
var pkgfile = path.join(pkgdir, 'package.json');
|
||||
isFile(pkgfile, function (err, ex) {
|
||||
// on err, ex is false
|
||||
if (!ex) return loadpkg(path.dirname(dir), cb);
|
||||
|
||||
readFile(pkgfile, function (err, body) {
|
||||
if (err) cb(err);
|
||||
try { var pkg = JSON.parse(body); } catch (jsonErr) {}
|
||||
|
||||
if (pkg && opts.packageFilter) {
|
||||
pkg = opts.packageFilter(pkg, pkgfile);
|
||||
}
|
||||
cb(null, pkg, dir);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadAsDirectory(x, loadAsDirectoryPackage, callback) {
|
||||
var cb = callback;
|
||||
var fpkg = loadAsDirectoryPackage;
|
||||
if (typeof fpkg === 'function') {
|
||||
cb = fpkg;
|
||||
fpkg = opts.package;
|
||||
}
|
||||
|
||||
maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) {
|
||||
if (unwrapErr) return cb(unwrapErr);
|
||||
var pkgfile = path.join(pkgdir, 'package.json');
|
||||
isFile(pkgfile, function (err, ex) {
|
||||
if (err) return cb(err);
|
||||
if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb);
|
||||
|
||||
readFile(pkgfile, function (err, body) {
|
||||
if (err) return cb(err);
|
||||
try {
|
||||
var pkg = JSON.parse(body);
|
||||
} catch (jsonErr) {}
|
||||
|
||||
if (pkg && opts.packageFilter) {
|
||||
pkg = opts.packageFilter(pkg, pkgfile);
|
||||
}
|
||||
|
||||
if (pkg && pkg.main) {
|
||||
if (typeof pkg.main !== 'string') {
|
||||
var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
|
||||
mainError.code = 'INVALID_PACKAGE_MAIN';
|
||||
return cb(mainError);
|
||||
}
|
||||
if (pkg.main === '.' || pkg.main === './') {
|
||||
pkg.main = 'index';
|
||||
}
|
||||
loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (m) return cb(null, m, pkg);
|
||||
if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb);
|
||||
|
||||
var dir = path.resolve(x, pkg.main);
|
||||
loadAsDirectory(dir, pkg, function (err, n, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (n) return cb(null, n, pkg);
|
||||
loadAsFile(path.join(x, 'index'), pkg, cb);
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
loadAsFile(path.join(x, '/index'), pkg, cb);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function processDirs(cb, dirs) {
|
||||
if (dirs.length === 0) return cb(null, undefined);
|
||||
var dir = dirs[0];
|
||||
|
||||
isDirectory(path.dirname(dir), isdir);
|
||||
|
||||
function isdir(err, isdir) {
|
||||
if (err) return cb(err);
|
||||
if (!isdir) return processDirs(cb, dirs.slice(1));
|
||||
loadAsFile(dir, opts.package, onfile);
|
||||
}
|
||||
|
||||
function onfile(err, m, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (m) return cb(null, m, pkg);
|
||||
loadAsDirectory(dir, opts.package, ondir);
|
||||
}
|
||||
|
||||
function ondir(err, n, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (n) return cb(null, n, pkg);
|
||||
processDirs(cb, dirs.slice(1));
|
||||
}
|
||||
}
|
||||
function loadNodeModules(x, start, cb) {
|
||||
var thunk = function () { return getPackageCandidates(x, start, opts); };
|
||||
processDirs(
|
||||
cb,
|
||||
packageIterator ? packageIterator(x, start, thunk, opts) : thunk()
|
||||
);
|
||||
}
|
||||
};
|
8
node_modules/resolve/lib/caller.js
generated
vendored
8
node_modules/resolve/lib/caller.js
generated
vendored
|
@ -1,8 +0,0 @@
|
|||
module.exports = function () {
|
||||
// see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
|
||||
var origPrepareStackTrace = Error.prepareStackTrace;
|
||||
Error.prepareStackTrace = function (_, stack) { return stack; };
|
||||
var stack = (new Error()).stack;
|
||||
Error.prepareStackTrace = origPrepareStackTrace;
|
||||
return stack[2].getFileName();
|
||||
};
|
53
node_modules/resolve/lib/core.js
generated
vendored
53
node_modules/resolve/lib/core.js
generated
vendored
|
@ -1,53 +0,0 @@
|
|||
var current = (process.versions && process.versions.node && process.versions.node.split('.')) || [];
|
||||
|
||||
function specifierIncluded(specifier) {
|
||||
var parts = specifier.split(' ');
|
||||
var op = parts.length > 1 ? parts[0] : '=';
|
||||
var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');
|
||||
|
||||
for (var i = 0; i < 3; ++i) {
|
||||
var cur = parseInt(current[i] || 0, 10);
|
||||
var ver = parseInt(versionParts[i] || 0, 10);
|
||||
if (cur === ver) {
|
||||
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
||||
}
|
||||
if (op === '<') {
|
||||
return cur < ver;
|
||||
} else if (op === '>=') {
|
||||
return cur >= ver;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return op === '>=';
|
||||
}
|
||||
|
||||
function matchesRange(range) {
|
||||
var specifiers = range.split(/ ?&& ?/);
|
||||
if (specifiers.length === 0) { return false; }
|
||||
for (var i = 0; i < specifiers.length; ++i) {
|
||||
if (!specifierIncluded(specifiers[i])) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function versionIncluded(specifierValue) {
|
||||
if (typeof specifierValue === 'boolean') { return specifierValue; }
|
||||
if (specifierValue && typeof specifierValue === 'object') {
|
||||
for (var i = 0; i < specifierValue.length; ++i) {
|
||||
if (matchesRange(specifierValue[i])) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return matchesRange(specifierValue);
|
||||
}
|
||||
|
||||
var data = require('./core.json');
|
||||
|
||||
var core = {};
|
||||
for (var mod in data) { // eslint-disable-line no-restricted-syntax
|
||||
if (Object.prototype.hasOwnProperty.call(data, mod)) {
|
||||
core[mod] = versionIncluded(data[mod]);
|
||||
}
|
||||
}
|
||||
module.exports = core;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user