pvincent
2 years ago
1008 changed files with 8 additions and 193739 deletions
-
2.gitignore
-
6README.md
-
1node_modules/.bin/acorn
-
1node_modules/.bin/cssesc
-
1node_modules/.bin/detective
-
1node_modules/.bin/nanoid
-
1node_modules/.bin/resolve
-
1node_modules/.bin/tailwind
-
1node_modules/.bin/tailwindcss
-
778node_modules/.package-lock.json
-
21node_modules/@nodelib/fs.scandir/LICENSE
-
171node_modules/@nodelib/fs.scandir/README.md
-
20node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
-
19node_modules/@nodelib/fs.scandir/out/adapters/fs.js
-
4node_modules/@nodelib/fs.scandir/out/constants.d.ts
-
17node_modules/@nodelib/fs.scandir/out/constants.js
-
12node_modules/@nodelib/fs.scandir/out/index.d.ts
-
26node_modules/@nodelib/fs.scandir/out/index.js
-
7node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
-
104node_modules/@nodelib/fs.scandir/out/providers/async.js
-
1node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
-
13node_modules/@nodelib/fs.scandir/out/providers/common.js
-
5node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts
-
54node_modules/@nodelib/fs.scandir/out/providers/sync.js
-
20node_modules/@nodelib/fs.scandir/out/settings.d.ts
-
24node_modules/@nodelib/fs.scandir/out/settings.js
-
20node_modules/@nodelib/fs.scandir/out/types/index.d.ts
-
2node_modules/@nodelib/fs.scandir/out/types/index.js
-
2node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
-
19node_modules/@nodelib/fs.scandir/out/utils/fs.js
-
2node_modules/@nodelib/fs.scandir/out/utils/index.d.ts
-
5node_modules/@nodelib/fs.scandir/out/utils/index.js
-
44node_modules/@nodelib/fs.scandir/package.json
-
21node_modules/@nodelib/fs.stat/LICENSE
-
126node_modules/@nodelib/fs.stat/README.md
-
13node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
-
17node_modules/@nodelib/fs.stat/out/adapters/fs.js
-
12node_modules/@nodelib/fs.stat/out/index.d.ts
-
26node_modules/@nodelib/fs.stat/out/index.js
-
4node_modules/@nodelib/fs.stat/out/providers/async.d.ts
-
36node_modules/@nodelib/fs.stat/out/providers/async.js
-
3node_modules/@nodelib/fs.stat/out/providers/sync.d.ts
-
23node_modules/@nodelib/fs.stat/out/providers/sync.js
-
16node_modules/@nodelib/fs.stat/out/settings.d.ts
-
16node_modules/@nodelib/fs.stat/out/settings.js
-
4node_modules/@nodelib/fs.stat/out/types/index.d.ts
-
2node_modules/@nodelib/fs.stat/out/types/index.js
-
37node_modules/@nodelib/fs.stat/package.json
-
21node_modules/@nodelib/fs.walk/LICENSE
-
215node_modules/@nodelib/fs.walk/README.md
-
14node_modules/@nodelib/fs.walk/out/index.d.ts
-
34node_modules/@nodelib/fs.walk/out/index.js
-
12node_modules/@nodelib/fs.walk/out/providers/async.d.ts
-
30node_modules/@nodelib/fs.walk/out/providers/async.js
-
4node_modules/@nodelib/fs.walk/out/providers/index.d.ts
-
9node_modules/@nodelib/fs.walk/out/providers/index.js
-
12node_modules/@nodelib/fs.walk/out/providers/stream.d.ts
-
34node_modules/@nodelib/fs.walk/out/providers/stream.js
-
10node_modules/@nodelib/fs.walk/out/providers/sync.d.ts
-
14node_modules/@nodelib/fs.walk/out/providers/sync.js
-
30node_modules/@nodelib/fs.walk/out/readers/async.d.ts
-
97node_modules/@nodelib/fs.walk/out/readers/async.js
-
7node_modules/@nodelib/fs.walk/out/readers/common.d.ts
-
31node_modules/@nodelib/fs.walk/out/readers/common.js
-
6node_modules/@nodelib/fs.walk/out/readers/reader.d.ts
-
11node_modules/@nodelib/fs.walk/out/readers/reader.js
-
15node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
-
59node_modules/@nodelib/fs.walk/out/readers/sync.js
-
30node_modules/@nodelib/fs.walk/out/settings.d.ts
-
26node_modules/@nodelib/fs.walk/out/settings.js
-
8node_modules/@nodelib/fs.walk/out/types/index.d.ts
-
2node_modules/@nodelib/fs.walk/out/types/index.js
-
44node_modules/@nodelib/fs.walk/package.json
-
22node_modules/acorn-node/.travis.yml
-
94node_modules/acorn-node/CHANGELOG.md
-
95node_modules/acorn-node/LICENSE.md
-
65node_modules/acorn-node/README.md
-
36node_modules/acorn-node/build.js
-
38node_modules/acorn-node/index.js
-
71node_modules/acorn-node/lib/bigint/index.js
-
70node_modules/acorn-node/lib/class-fields/index.js
-
86node_modules/acorn-node/lib/dynamic-import/index.js
-
43node_modules/acorn-node/lib/export-ns-from/index.js
-
55node_modules/acorn-node/lib/import-meta/index.js
-
61node_modules/acorn-node/lib/numeric-separator/index.js
-
135node_modules/acorn-node/lib/private-class-elements/index.js
-
139node_modules/acorn-node/lib/static-class-features/index.js
-
51node_modules/acorn-node/package.json
-
154node_modules/acorn-node/test/index.js
-
57node_modules/acorn-node/walk.js
-
131node_modules/acorn-walk/CHANGELOG.md
-
19node_modules/acorn-walk/LICENSE
-
126node_modules/acorn-walk/README.md
-
112node_modules/acorn-walk/dist/walk.d.ts
-
463node_modules/acorn-walk/dist/walk.js
-
1node_modules/acorn-walk/dist/walk.js.map
-
443node_modules/acorn-walk/dist/walk.mjs
-
1node_modules/acorn-walk/dist/walk.mjs.map
-
34node_modules/acorn-walk/package.json
-
620node_modules/acorn/CHANGELOG.md
@ -1 +1 @@ |
|||
node_modules |
|||
node_modules/ |
@ -1 +0,0 @@ |
|||
../acorn/bin/acorn |
@ -1 +0,0 @@ |
|||
../cssesc/bin/cssesc |
@ -1 +0,0 @@ |
|||
../detective/bin/detective.js |
@ -1 +0,0 @@ |
|||
../nanoid/bin/nanoid.cjs |
@ -1 +0,0 @@ |
|||
../resolve/bin/resolve |
@ -1 +0,0 @@ |
|||
../tailwindcss/lib/cli.js |
@ -1 +0,0 @@ |
|||
../tailwindcss/lib/cli.js |
@ -1,778 +0,0 @@ |
|||
{ |
|||
"name": "webdev-minimal", |
|||
"lockfileVersion": 2, |
|||
"requires": true, |
|||
"packages": { |
|||
"node_modules/@nodelib/fs.scandir": { |
|||
"version": "2.1.5", |
|||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", |
|||
"integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"@nodelib/fs.stat": "2.0.5", |
|||
"run-parallel": "^1.1.9" |
|||
}, |
|||
"engines": { |
|||
"node": ">= 8" |
|||
} |
|||
}, |
|||
"node_modules/@nodelib/fs.stat": { |
|||
"version": "2.0.5", |
|||
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", |
|||
"integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">= 8" |
|||
} |
|||
}, |
|||
"node_modules/@nodelib/fs.walk": { |
|||
"version": "1.2.8", |
|||
"resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", |
|||
"integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"@nodelib/fs.scandir": "2.1.5", |
|||
"fastq": "^1.6.0" |
|||
}, |
|||
"engines": { |
|||
"node": ">= 8" |
|||
} |
|||
}, |
|||
"node_modules/acorn": { |
|||
"version": "7.4.1", |
|||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", |
|||
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", |
|||
"dev": true, |
|||
"bin": { |
|||
"acorn": "bin/acorn" |
|||
}, |
|||
"engines": { |
|||
"node": ">=0.4.0" |
|||
} |
|||
}, |
|||
"node_modules/acorn-node": { |
|||
"version": "1.8.2", |
|||
"resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", |
|||
"integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"acorn": "^7.0.0", |
|||
"acorn-walk": "^7.0.0", |
|||
"xtend": "^4.0.2" |
|||
} |
|||
}, |
|||
"node_modules/acorn-walk": { |
|||
"version": "7.2.0", |
|||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", |
|||
"integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=0.4.0" |
|||
} |
|||
}, |
|||
"node_modules/anymatch": { |
|||
"version": "3.1.2", |
|||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", |
|||
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"normalize-path": "^3.0.0", |
|||
"picomatch": "^2.0.4" |
|||
}, |
|||
"engines": { |
|||
"node": ">= 8" |
|||
} |
|||
}, |
|||
"node_modules/arg": { |
|||
"version": "5.0.2", |
|||
"resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", |
|||
"integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/binary-extensions": { |
|||
"version": "2.2.0", |
|||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", |
|||
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=8" |
|||
} |
|||
}, |
|||
"node_modules/braces": { |
|||
"version": "3.0.2", |
|||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", |
|||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"fill-range": "^7.0.1" |
|||
}, |
|||
"engines": { |
|||
"node": ">=8" |
|||
} |
|||
}, |
|||
"node_modules/camelcase-css": { |
|||
"version": "2.0.1", |
|||
"resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", |
|||
"integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">= 6" |
|||
} |
|||
}, |
|||
"node_modules/chokidar": { |
|||
"version": "3.5.3", |
|||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", |
|||
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", |
|||
"dev": true, |
|||
"funding": [ |
|||
{ |
|||
"type": "individual", |
|||
"url": "https://paulmillr.com/funding/" |
|||
} |
|||
], |
|||
"dependencies": { |
|||
"anymatch": "~3.1.2", |
|||
"braces": "~3.0.2", |
|||
"glob-parent": "~5.1.2", |
|||
"is-binary-path": "~2.1.0", |
|||
"is-glob": "~4.0.1", |
|||
"normalize-path": "~3.0.0", |
|||
"readdirp": "~3.6.0" |
|||
}, |
|||
"engines": { |
|||
"node": ">= 8.10.0" |
|||
}, |
|||
"optionalDependencies": { |
|||
"fsevents": "~2.3.2" |
|||
} |
|||
}, |
|||
"node_modules/chokidar/node_modules/glob-parent": { |
|||
"version": "5.1.2", |
|||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", |
|||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"is-glob": "^4.0.1" |
|||
}, |
|||
"engines": { |
|||
"node": ">= 6" |
|||
} |
|||
}, |
|||
"node_modules/color-name": { |
|||
"version": "1.1.4", |
|||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", |
|||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/cssesc": { |
|||
"version": "3.0.0", |
|||
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", |
|||
"integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", |
|||
"dev": true, |
|||
"bin": { |
|||
"cssesc": "bin/cssesc" |
|||
}, |
|||
"engines": { |
|||
"node": ">=4" |
|||
} |
|||
}, |
|||
"node_modules/defined": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", |
|||
"integrity": "sha512-Y2caI5+ZwS5c3RiNDJ6u53VhQHv+hHKwhkI1iHvceKUHw9Df6EK2zRLfjejRgMuCuxK7PfSWIMwWecceVvThjQ==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/detective": { |
|||
"version": "5.2.1", |
|||
"resolved": "https://registry.npmjs.org/detective/-/detective-5.2.1.tgz", |
|||
"integrity": "sha512-v9XE1zRnz1wRtgurGu0Bs8uHKFSTdteYZNbIPFVhUZ39L/S79ppMpdmVOZAnoz1jfEFodc48n6MX483Xo3t1yw==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"acorn-node": "^1.8.2", |
|||
"defined": "^1.0.0", |
|||
"minimist": "^1.2.6" |
|||
}, |
|||
"bin": { |
|||
"detective": "bin/detective.js" |
|||
}, |
|||
"engines": { |
|||
"node": ">=0.8.0" |
|||
} |
|||
}, |
|||
"node_modules/didyoumean": { |
|||
"version": "1.2.2", |
|||
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", |
|||
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/dlv": { |
|||
"version": "1.1.3", |
|||
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", |
|||
"integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/fast-glob": { |
|||
"version": "3.2.12", |
|||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", |
|||
"integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"@nodelib/fs.stat": "^2.0.2", |
|||
"@nodelib/fs.walk": "^1.2.3", |
|||
"glob-parent": "^5.1.2", |
|||
"merge2": "^1.3.0", |
|||
"micromatch": "^4.0.4" |
|||
}, |
|||
"engines": { |
|||
"node": ">=8.6.0" |
|||
} |
|||
}, |
|||
"node_modules/fast-glob/node_modules/glob-parent": { |
|||
"version": "5.1.2", |
|||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", |
|||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"is-glob": "^4.0.1" |
|||
}, |
|||
"engines": { |
|||
"node": ">= 6" |
|||
} |
|||
}, |
|||
"node_modules/fastq": { |
|||
"version": "1.13.0", |
|||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", |
|||
"integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"reusify": "^1.0.4" |
|||
} |
|||
}, |
|||
"node_modules/fill-range": { |
|||
"version": "7.0.1", |
|||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", |
|||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"to-regex-range": "^5.0.1" |
|||
}, |
|||
"engines": { |
|||
"node": ">=8" |
|||
} |
|||
}, |
|||
"node_modules/function-bind": { |
|||
"version": "1.1.1", |
|||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", |
|||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/glob-parent": { |
|||
"version": "6.0.2", |
|||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", |
|||
"integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"is-glob": "^4.0.3" |
|||
}, |
|||
"engines": { |
|||
"node": ">=10.13.0" |
|||
} |
|||
}, |
|||
"node_modules/has": { |
|||
"version": "1.0.3", |
|||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", |
|||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"function-bind": "^1.1.1" |
|||
}, |
|||
"engines": { |
|||
"node": ">= 0.4.0" |
|||
} |
|||
}, |
|||
"node_modules/is-binary-path": { |
|||
"version": "2.1.0", |
|||
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", |
|||
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"binary-extensions": "^2.0.0" |
|||
}, |
|||
"engines": { |
|||
"node": ">=8" |
|||
} |
|||
}, |
|||
"node_modules/is-core-module": { |
|||
"version": "2.10.0", |
|||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", |
|||
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"has": "^1.0.3" |
|||
}, |
|||
"funding": { |
|||
"url": "https://github.com/sponsors/ljharb" |
|||
} |
|||
}, |
|||
"node_modules/is-extglob": { |
|||
"version": "2.1.1", |
|||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", |
|||
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=0.10.0" |
|||
} |
|||
}, |
|||
"node_modules/is-glob": { |
|||
"version": "4.0.3", |
|||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", |
|||
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"is-extglob": "^2.1.1" |
|||
}, |
|||
"engines": { |
|||
"node": ">=0.10.0" |
|||
} |
|||
}, |
|||
"node_modules/is-number": { |
|||
"version": "7.0.0", |
|||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", |
|||
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=0.12.0" |
|||
} |
|||
}, |
|||
"node_modules/lilconfig": { |
|||
"version": "2.0.6", |
|||
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.6.tgz", |
|||
"integrity": "sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=10" |
|||
} |
|||
}, |
|||
"node_modules/merge2": { |
|||
"version": "1.4.1", |
|||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", |
|||
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">= 8" |
|||
} |
|||
}, |
|||
"node_modules/micromatch": { |
|||
"version": "4.0.5", |
|||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", |
|||
"integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"braces": "^3.0.2", |
|||
"picomatch": "^2.3.1" |
|||
}, |
|||
"engines": { |
|||
"node": ">=8.6" |
|||
} |
|||
}, |
|||
"node_modules/minimist": { |
|||
"version": "1.2.6", |
|||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", |
|||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/nanoid": { |
|||
"version": "3.3.4", |
|||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", |
|||
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", |
|||
"dev": true, |
|||
"peer": true, |
|||
"bin": { |
|||
"nanoid": "bin/nanoid.cjs" |
|||
}, |
|||
"engines": { |
|||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" |
|||
} |
|||
}, |
|||
"node_modules/normalize-path": { |
|||
"version": "3.0.0", |
|||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", |
|||
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=0.10.0" |
|||
} |
|||
}, |
|||
"node_modules/object-hash": { |
|||
"version": "3.0.0", |
|||
"resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", |
|||
"integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">= 6" |
|||
} |
|||
}, |
|||
"node_modules/path-parse": { |
|||
"version": "1.0.7", |
|||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", |
|||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/picocolors": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", |
|||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/picomatch": { |
|||
"version": "2.3.1", |
|||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", |
|||
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=8.6" |
|||
}, |
|||
"funding": { |
|||
"url": "https://github.com/sponsors/jonschlinkert" |
|||
} |
|||
}, |
|||
"node_modules/pify": { |
|||
"version": "2.3.0", |
|||
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", |
|||
"integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=0.10.0" |
|||
} |
|||
}, |
|||
"node_modules/postcss": { |
|||
"version": "8.4.17", |
|||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.17.tgz", |
|||
"integrity": "sha512-UNxNOLQydcOFi41yHNMcKRZ39NeXlr8AxGuZJsdub8vIb12fHzcq37DTU/QtbI6WLxNg2gF9Z+8qtRwTj1UI1Q==", |
|||
"dev": true, |
|||
"funding": [ |
|||
{ |
|||
"type": "opencollective", |
|||
"url": "https://opencollective.com/postcss/" |
|||
}, |
|||
{ |
|||
"type": "tidelift", |
|||
"url": "https://tidelift.com/funding/github/npm/postcss" |
|||
} |
|||
], |
|||
"peer": true, |
|||
"dependencies": { |
|||
"nanoid": "^3.3.4", |
|||
"picocolors": "^1.0.0", |
|||
"source-map-js": "^1.0.2" |
|||
}, |
|||
"engines": { |
|||
"node": "^10 || ^12 || >=14" |
|||
} |
|||
}, |
|||
"node_modules/postcss-import": { |
|||
"version": "14.1.0", |
|||
"resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-14.1.0.tgz", |
|||
"integrity": "sha512-flwI+Vgm4SElObFVPpTIT7SU7R3qk2L7PyduMcokiaVKuWv9d/U+Gm/QAd8NDLuykTWTkcrjOeD2Pp1rMeBTGw==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"postcss-value-parser": "^4.0.0", |
|||
"read-cache": "^1.0.0", |
|||
"resolve": "^1.1.7" |
|||
}, |
|||
"engines": { |
|||
"node": ">=10.0.0" |
|||
}, |
|||
"peerDependencies": { |
|||
"postcss": "^8.0.0" |
|||
} |
|||
}, |
|||
"node_modules/postcss-js": { |
|||
"version": "4.0.0", |
|||
"resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.0.tgz", |
|||
"integrity": "sha512-77QESFBwgX4irogGVPgQ5s07vLvFqWr228qZY+w6lW599cRlK/HmnlivnnVUxkjHnCu4J16PDMHcH+e+2HbvTQ==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"camelcase-css": "^2.0.1" |
|||
}, |
|||
"engines": { |
|||
"node": "^12 || ^14 || >= 16" |
|||
}, |
|||
"funding": { |
|||
"type": "opencollective", |
|||
"url": "https://opencollective.com/postcss/" |
|||
}, |
|||
"peerDependencies": { |
|||
"postcss": "^8.3.3" |
|||
} |
|||
}, |
|||
"node_modules/postcss-load-config": { |
|||
"version": "3.1.4", |
|||
"resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.4.tgz", |
|||
"integrity": "sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"lilconfig": "^2.0.5", |
|||
"yaml": "^1.10.2" |
|||
}, |
|||
"engines": { |
|||
"node": ">= 10" |
|||
}, |
|||
"funding": { |
|||
"type": "opencollective", |
|||
"url": "https://opencollective.com/postcss/" |
|||
}, |
|||
"peerDependencies": { |
|||
"postcss": ">=8.0.9", |
|||
"ts-node": ">=9.0.0" |
|||
}, |
|||
"peerDependenciesMeta": { |
|||
"postcss": { |
|||
"optional": true |
|||
}, |
|||
"ts-node": { |
|||
"optional": true |
|||
} |
|||
} |
|||
}, |
|||
"node_modules/postcss-nested": { |
|||
"version": "5.0.6", |
|||
"resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-5.0.6.tgz", |
|||
"integrity": "sha512-rKqm2Fk0KbA8Vt3AdGN0FB9OBOMDVajMG6ZCf/GoHgdxUJ4sBFp0A/uMIRm+MJUdo33YXEtjqIz8u7DAp8B7DA==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"postcss-selector-parser": "^6.0.6" |
|||
}, |
|||
"engines": { |
|||
"node": ">=12.0" |
|||
}, |
|||
"funding": { |
|||
"type": "opencollective", |
|||
"url": "https://opencollective.com/postcss/" |
|||
}, |
|||
"peerDependencies": { |
|||
"postcss": "^8.2.14" |
|||
} |
|||
}, |
|||
"node_modules/postcss-selector-parser": { |
|||
"version": "6.0.10", |
|||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", |
|||
"integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"cssesc": "^3.0.0", |
|||
"util-deprecate": "^1.0.2" |
|||
}, |
|||
"engines": { |
|||
"node": ">=4" |
|||
} |
|||
}, |
|||
"node_modules/postcss-value-parser": { |
|||
"version": "4.2.0", |
|||
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", |
|||
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/queue-microtask": { |
|||
"version": "1.2.3", |
|||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", |
|||
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", |
|||
"dev": true, |
|||
"funding": [ |
|||
{ |
|||
"type": "github", |
|||
"url": "https://github.com/sponsors/feross" |
|||
}, |
|||
{ |
|||
"type": "patreon", |
|||
"url": "https://www.patreon.com/feross" |
|||
}, |
|||
{ |
|||
"type": "consulting", |
|||
"url": "https://feross.org/support" |
|||
} |
|||
] |
|||
}, |
|||
"node_modules/quick-lru": { |
|||
"version": "5.1.1", |
|||
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", |
|||
"integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=10" |
|||
}, |
|||
"funding": { |
|||
"url": "https://github.com/sponsors/sindresorhus" |
|||
} |
|||
}, |
|||
"node_modules/read-cache": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", |
|||
"integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"pify": "^2.3.0" |
|||
} |
|||
}, |
|||
"node_modules/readdirp": { |
|||
"version": "3.6.0", |
|||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", |
|||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"picomatch": "^2.2.1" |
|||
}, |
|||
"engines": { |
|||
"node": ">=8.10.0" |
|||
} |
|||
}, |
|||
"node_modules/resolve": { |
|||
"version": "1.22.1", |
|||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", |
|||
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"is-core-module": "^2.9.0", |
|||
"path-parse": "^1.0.7", |
|||
"supports-preserve-symlinks-flag": "^1.0.0" |
|||
}, |
|||
"bin": { |
|||
"resolve": "bin/resolve" |
|||
}, |
|||
"funding": { |
|||
"url": "https://github.com/sponsors/ljharb" |
|||
} |
|||
}, |
|||
"node_modules/reusify": { |
|||
"version": "1.0.4", |
|||
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", |
|||
"integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", |
|||
"dev": true, |
|||
"engines": { |
|||
"iojs": ">=1.0.0", |
|||
"node": ">=0.10.0" |
|||
} |
|||
}, |
|||
"node_modules/run-parallel": { |
|||
"version": "1.2.0", |
|||
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", |
|||
"integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", |
|||
"dev": true, |
|||
"funding": [ |
|||
{ |
|||
"type": "github", |
|||
"url": "https://github.com/sponsors/feross" |
|||
}, |
|||
{ |
|||
"type": "patreon", |
|||
"url": "https://www.patreon.com/feross" |
|||
}, |
|||
{ |
|||
"type": "consulting", |
|||
"url": "https://feross.org/support" |
|||
} |
|||
], |
|||
"dependencies": { |
|||
"queue-microtask": "^1.2.2" |
|||
} |
|||
}, |
|||
"node_modules/source-map-js": { |
|||
"version": "1.0.2", |
|||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", |
|||
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", |
|||
"dev": true, |
|||
"peer": true, |
|||
"engines": { |
|||
"node": ">=0.10.0" |
|||
} |
|||
}, |
|||
"node_modules/supports-preserve-symlinks-flag": { |
|||
"version": "1.0.0", |
|||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", |
|||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">= 0.4" |
|||
}, |
|||
"funding": { |
|||
"url": "https://github.com/sponsors/ljharb" |
|||
} |
|||
}, |
|||
"node_modules/tailwindcss": { |
|||
"version": "3.1.8", |
|||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.1.8.tgz", |
|||
"integrity": "sha512-YSneUCZSFDYMwk+TGq8qYFdCA3yfBRdBlS7txSq0LUmzyeqRe3a8fBQzbz9M3WS/iFT4BNf/nmw9mEzrnSaC0g==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"arg": "^5.0.2", |
|||
"chokidar": "^3.5.3", |
|||
"color-name": "^1.1.4", |
|||
"detective": "^5.2.1", |
|||
"didyoumean": "^1.2.2", |
|||
"dlv": "^1.1.3", |
|||
"fast-glob": "^3.2.11", |
|||
"glob-parent": "^6.0.2", |
|||
"is-glob": "^4.0.3", |
|||
"lilconfig": "^2.0.6", |
|||
"normalize-path": "^3.0.0", |
|||
"object-hash": "^3.0.0", |
|||
"picocolors": "^1.0.0", |
|||
"postcss": "^8.4.14", |
|||
"postcss-import": "^14.1.0", |
|||
"postcss-js": "^4.0.0", |
|||
"postcss-load-config": "^3.1.4", |
|||
"postcss-nested": "5.0.6", |
|||
"postcss-selector-parser": "^6.0.10", |
|||
"postcss-value-parser": "^4.2.0", |
|||
"quick-lru": "^5.1.1", |
|||
"resolve": "^1.22.1" |
|||
}, |
|||
"bin": { |
|||
"tailwind": "lib/cli.js", |
|||
"tailwindcss": "lib/cli.js" |
|||
}, |
|||
"engines": { |
|||
"node": ">=12.13.0" |
|||
}, |
|||
"peerDependencies": { |
|||
"postcss": "^8.0.9" |
|||
} |
|||
}, |
|||
"node_modules/to-regex-range": { |
|||
"version": "5.0.1", |
|||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", |
|||
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", |
|||
"dev": true, |
|||
"dependencies": { |
|||
"is-number": "^7.0.0" |
|||
}, |
|||
"engines": { |
|||
"node": ">=8.0" |
|||
} |
|||
}, |
|||
"node_modules/util-deprecate": { |
|||
"version": "1.0.2", |
|||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", |
|||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", |
|||
"dev": true |
|||
}, |
|||
"node_modules/xtend": { |
|||
"version": "4.0.2", |
|||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", |
|||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">=0.4" |
|||
} |
|||
}, |
|||
"node_modules/yaml": { |
|||
"version": "1.10.2", |
|||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", |
|||
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", |
|||
"dev": true, |
|||
"engines": { |
|||
"node": ">= 6" |
|||
} |
|||
} |
|||
} |
|||
} |
@ -1,21 +0,0 @@ |
|||
The MIT License (MIT) |
|||
|
|||
Copyright (c) Denis Malinochkin |
|||
|
|||
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. |
@ -1,171 +0,0 @@ |
|||
# @nodelib/fs.scandir |
|||
|
|||
> List files and directories inside the specified directory. |
|||
|
|||
## :bulb: Highlights |
|||
|
|||
The package is aimed at obtaining information about entries in the directory. |
|||
|
|||
* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). |
|||
* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode). |
|||
* :link: Can safely work with broken symbolic links. |
|||
|
|||
## Install |
|||
|
|||
```console |
|||
npm install @nodelib/fs.scandir |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```ts |
|||
import * as fsScandir from '@nodelib/fs.scandir'; |
|||
|
|||
fsScandir.scandir('path', (error, stats) => { /* … */ }); |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### .scandir(path, [optionsOrSettings], callback) |
|||
|
|||
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style. |
|||
|
|||
```ts |
|||
fsScandir.scandir('path', (error, entries) => { /* … */ }); |
|||
fsScandir.scandir('path', {}, (error, entries) => { /* … */ }); |
|||
fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ }); |
|||
``` |
|||
|
|||
### .scandirSync(path, [optionsOrSettings]) |
|||
|
|||
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path. |
|||
|
|||
```ts |
|||
const entries = fsScandir.scandirSync('path'); |
|||
const entries = fsScandir.scandirSync('path', {}); |
|||
const entries = fsScandir.scandirSync(('path', new fsScandir.Settings()); |
|||
``` |
|||
|
|||
#### path |
|||
|
|||
* Required: `true` |
|||
* Type: `string | Buffer | URL` |
|||
|
|||
A path to a file. If a URL is provided, it must use the `file:` protocol. |
|||
|
|||
#### optionsOrSettings |
|||
|
|||
* Required: `false` |
|||
* Type: `Options | Settings` |
|||
* Default: An instance of `Settings` class |
|||
|
|||
An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class. |
|||
|
|||
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. |
|||
|
|||
### Settings([options]) |
|||
|
|||
A class of full settings of the package. |
|||
|
|||
```ts |
|||
const settings = new fsScandir.Settings({ followSymbolicLinks: false }); |
|||
|
|||
const entries = fsScandir.scandirSync('path', settings); |
|||
``` |
|||
|
|||
## Entry |
|||
|
|||
* `name` — The name of the entry (`unknown.txt`). |
|||
* `path` — The path of the entry relative to call directory (`root/unknown.txt`). |
|||
* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class. |
|||
* `stats` (optional) — An instance of `fs.Stats` class. |
|||
|
|||
For example, the `scandir` call for `tools` directory with one directory inside: |
|||
|
|||
```ts |
|||
{ |
|||
dirent: Dirent { name: 'typedoc', /* … */ }, |
|||
name: 'typedoc', |
|||
path: 'tools/typedoc' |
|||
} |
|||
``` |
|||
|
|||
## Options |
|||
|
|||
### stats |
|||
|
|||
* Type: `boolean` |
|||
* Default: `false` |
|||
|
|||
Adds an instance of `fs.Stats` class to the [`Entry`](#entry). |
|||
|
|||
> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO?? |
|||
|
|||
### followSymbolicLinks |
|||
|
|||
* Type: `boolean` |
|||
* Default: `false` |
|||
|
|||
Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. |
|||
|
|||
### `throwErrorOnBrokenSymbolicLink` |
|||
|
|||
* Type: `boolean` |
|||
* Default: `true` |
|||
|
|||
Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`. |
|||
|
|||
### `pathSegmentSeparator` |
|||
|
|||
* Type: `string` |
|||
* Default: `path.sep` |
|||
|
|||
By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. |
|||
|
|||
### `fs` |
|||
|
|||
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) |
|||
* Default: A default FS methods |
|||
|
|||
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. |
|||
|
|||
```ts |
|||
interface FileSystemAdapter { |
|||
lstat?: typeof fs.lstat; |
|||
stat?: typeof fs.stat; |
|||
lstatSync?: typeof fs.lstatSync; |
|||
statSync?: typeof fs.statSync; |
|||
readdir?: typeof fs.readdir; |
|||
readdirSync?: typeof fs.readdirSync; |
|||
} |
|||
|
|||
const settings = new fsScandir.Settings({ |
|||
fs: { lstat: fakeLstat } |
|||
}); |
|||
``` |
|||
|
|||
## `old` and `modern` mode |
|||
|
|||
This package has two modes that are used depending on the environment and parameters of use. |
|||
|
|||
### old |
|||
|
|||
* Node.js below `10.10` or when the `stats` option is enabled |
|||
|
|||
When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links). |
|||
|
|||
### modern |
|||
|
|||
* Node.js 10.10+ and the `stats` option is disabled |
|||
|
|||
In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present. |
|||
|
|||
This mode makes fewer calls to the file system. It's faster. |
|||
|
|||
## Changelog |
|||
|
|||
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. |
|||
|
|||
## License |
|||
|
|||
This software is released under the terms of the MIT license. |
@ -1,20 +0,0 @@ |
|||
import type * as fsStat from '@nodelib/fs.stat'; |
|||
import type { Dirent, ErrnoException } from '../types'; |
|||
export interface ReaddirAsynchronousMethod { |
|||
(filepath: string, options: { |
|||
withFileTypes: true; |
|||
}, callback: (error: ErrnoException | null, files: Dirent[]) => void): void; |
|||
(filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void; |
|||
} |
|||
export interface ReaddirSynchronousMethod { |
|||
(filepath: string, options: { |
|||
withFileTypes: true; |
|||
}): Dirent[]; |
|||
(filepath: string): string[]; |
|||
} |
|||
export declare type FileSystemAdapter = fsStat.FileSystemAdapter & { |
|||
readdir: ReaddirAsynchronousMethod; |
|||
readdirSync: ReaddirSynchronousMethod; |
|||
}; |
|||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; |
|||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter; |
@ -1,19 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; |
|||
const fs = require("fs"); |
|||
exports.FILE_SYSTEM_ADAPTER = { |
|||
lstat: fs.lstat, |
|||
stat: fs.stat, |
|||
lstatSync: fs.lstatSync, |
|||
statSync: fs.statSync, |
|||
readdir: fs.readdir, |
|||
readdirSync: fs.readdirSync |
|||
}; |
|||
function createFileSystemAdapter(fsMethods) { |
|||
if (fsMethods === undefined) { |
|||
return exports.FILE_SYSTEM_ADAPTER; |
|||
} |
|||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); |
|||
} |
|||
exports.createFileSystemAdapter = createFileSystemAdapter; |
@ -1,4 +0,0 @@ |
|||
/** |
|||
* IS `true` for Node.js 10.10 and greater. |
|||
*/ |
|||
export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean; |
@ -1,17 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; |
|||
const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); |
|||
if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) { |
|||
throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`); |
|||
} |
|||
const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); |
|||
const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); |
|||
const SUPPORTED_MAJOR_VERSION = 10; |
|||
const SUPPORTED_MINOR_VERSION = 10; |
|||
const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; |
|||
const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; |
|||
/** |
|||
* IS `true` for Node.js 10.10 and greater. |
|||
*/ |
|||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; |
@ -1,12 +0,0 @@ |
|||
import type { FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from './adapters/fs'; |
|||
import * as async from './providers/async'; |
|||
import Settings, { Options } from './settings'; |
|||
import type { Dirent, Entry } from './types'; |
|||
declare type AsyncCallback = async.AsyncCallback; |
|||
declare function scandir(path: string, callback: AsyncCallback): void; |
|||
declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; |
|||
declare namespace scandir { |
|||
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>; |
|||
} |
|||
declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[]; |
|||
export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod, Options }; |
@ -1,26 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.Settings = exports.scandirSync = exports.scandir = void 0; |
|||
const async = require("./providers/async"); |
|||
const sync = require("./providers/sync"); |
|||
const settings_1 = require("./settings"); |
|||
exports.Settings = settings_1.default; |
|||
function scandir(path, optionsOrSettingsOrCallback, callback) { |
|||
if (typeof optionsOrSettingsOrCallback === 'function') { |
|||
async.read(path, getSettings(), optionsOrSettingsOrCallback); |
|||
return; |
|||
} |
|||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback); |
|||
} |
|||
exports.scandir = scandir; |
|||
function scandirSync(path, optionsOrSettings) { |
|||
const settings = getSettings(optionsOrSettings); |
|||
return sync.read(path, settings); |
|||
} |
|||
exports.scandirSync = scandirSync; |
|||
function getSettings(settingsOrOptions = {}) { |
|||
if (settingsOrOptions instanceof settings_1.default) { |
|||
return settingsOrOptions; |
|||
} |
|||
return new settings_1.default(settingsOrOptions); |
|||
} |
@ -1,7 +0,0 @@ |
|||
/// <reference types="node" />
|
|||
import type Settings from '../settings'; |
|||
import type { Entry } from '../types'; |
|||
export declare type AsyncCallback = (error: NodeJS.ErrnoException, entries: Entry[]) => void; |
|||
export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void; |
|||
export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void; |
|||
export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void; |
@ -1,104 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; |
|||
const fsStat = require("@nodelib/fs.stat"); |
|||
const rpl = require("run-parallel"); |
|||
const constants_1 = require("../constants"); |
|||
const utils = require("../utils"); |
|||
const common = require("./common"); |
|||
function read(directory, settings, callback) { |
|||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { |
|||
readdirWithFileTypes(directory, settings, callback); |
|||
return; |
|||
} |
|||
readdir(directory, settings, callback); |
|||
} |
|||
exports.read = read; |
|||
function readdirWithFileTypes(directory, settings, callback) { |
|||
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { |
|||
if (readdirError !== null) { |
|||
callFailureCallback(callback, readdirError); |
|||
return; |
|||
} |
|||
const entries = dirents.map((dirent) => ({ |
|||
dirent, |
|||
name: dirent.name, |
|||
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) |
|||
})); |
|||
if (!settings.followSymbolicLinks) { |
|||
callSuccessCallback(callback, entries); |
|||
return; |
|||
} |
|||
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); |
|||
rpl(tasks, (rplError, rplEntries) => { |
|||
if (rplError !== null) { |
|||
callFailureCallback(callback, rplError); |
|||
return; |
|||
} |
|||
callSuccessCallback(callback, rplEntries); |
|||
}); |
|||
}); |
|||
} |
|||
exports.readdirWithFileTypes = readdirWithFileTypes; |
|||
function makeRplTaskEntry(entry, settings) { |
|||
return (done) => { |
|||
if (!entry.dirent.isSymbolicLink()) { |
|||
done(null, entry); |
|||
return; |
|||
} |
|||
settings.fs.stat(entry.path, (statError, stats) => { |
|||
if (statError !== null) { |
|||
if (settings.throwErrorOnBrokenSymbolicLink) { |
|||
done(statError); |
|||
return; |
|||
} |
|||
done(null, entry); |
|||
return; |
|||
} |
|||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); |
|||
done(null, entry); |
|||
}); |
|||
}; |
|||
} |
|||
function readdir(directory, settings, callback) { |
|||
settings.fs.readdir(directory, (readdirError, names) => { |
|||
if (readdirError !== null) { |
|||
callFailureCallback(callback, readdirError); |
|||
return; |
|||
} |
|||
const tasks = names.map((name) => { |
|||
const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); |
|||
return (done) => { |
|||
fsStat.stat(path, settings.fsStatSettings, (error, stats) => { |
|||
if (error !== null) { |
|||
done(error); |
|||
return; |
|||
} |
|||
const entry = { |
|||
name, |
|||
path, |
|||
dirent: utils.fs.createDirentFromStats(name, stats) |
|||
}; |
|||
if (settings.stats) { |
|||
entry.stats = stats; |
|||
} |
|||
done(null, entry); |
|||
}); |
|||
}; |
|||
}); |
|||
rpl(tasks, (rplError, entries) => { |
|||
if (rplError !== null) { |
|||
callFailureCallback(callback, rplError); |
|||
return; |
|||
} |
|||
callSuccessCallback(callback, entries); |
|||
}); |
|||
}); |
|||
} |
|||
exports.readdir = readdir; |
|||
function callFailureCallback(callback, error) { |
|||
callback(error); |
|||
} |
|||
function callSuccessCallback(callback, result) { |
|||
callback(null, result); |
|||
} |
@ -1 +0,0 @@ |
|||
export declare function joinPathSegments(a: string, b: string, separator: string): string; |
@ -1,13 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.joinPathSegments = void 0; |
|||
function joinPathSegments(a, b, separator) { |
|||
/** |
|||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). |
|||
*/ |
|||
if (a.endsWith(separator)) { |
|||
return a + b; |
|||
} |
|||
return a + separator + b; |
|||
} |
|||
exports.joinPathSegments = joinPathSegments; |
@ -1,5 +0,0 @@ |
|||
import type Settings from '../settings'; |
|||
import type { Entry } from '../types'; |
|||
export declare function read(directory: string, settings: Settings): Entry[]; |
|||
export declare function readdirWithFileTypes(directory: string, settings: Settings): Entry[]; |
|||
export declare function readdir(directory: string, settings: Settings): Entry[]; |
@ -1,54 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; |
|||
const fsStat = require("@nodelib/fs.stat"); |
|||
const constants_1 = require("../constants"); |
|||
const utils = require("../utils"); |
|||
const common = require("./common"); |
|||
function read(directory, settings) { |
|||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { |
|||
return readdirWithFileTypes(directory, settings); |
|||
} |
|||
return readdir(directory, settings); |
|||
} |
|||
exports.read = read; |
|||
function readdirWithFileTypes(directory, settings) { |
|||
const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); |
|||
return dirents.map((dirent) => { |
|||
const entry = { |
|||
dirent, |
|||
name: dirent.name, |
|||
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) |
|||
}; |
|||
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { |
|||
try { |
|||
const stats = settings.fs.statSync(entry.path); |
|||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); |
|||
} |
|||
catch (error) { |
|||
if (settings.throwErrorOnBrokenSymbolicLink) { |
|||
throw error; |
|||
} |
|||
} |
|||
} |
|||
return entry; |
|||
}); |
|||
} |
|||
exports.readdirWithFileTypes = readdirWithFileTypes; |
|||
function readdir(directory, settings) { |
|||
const names = settings.fs.readdirSync(directory); |
|||
return names.map((name) => { |
|||
const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); |
|||
const stats = fsStat.statSync(entryPath, settings.fsStatSettings); |
|||
const entry = { |
|||
name, |
|||
path: entryPath, |
|||
dirent: utils.fs.createDirentFromStats(name, stats) |
|||
}; |
|||
if (settings.stats) { |
|||
entry.stats = stats; |
|||
} |
|||
return entry; |
|||
}); |
|||
} |
|||
exports.readdir = readdir; |
@ -1,20 +0,0 @@ |
|||
import * as fsStat from '@nodelib/fs.stat'; |
|||
import * as fs from './adapters/fs'; |
|||
export interface Options { |
|||
followSymbolicLinks?: boolean; |
|||
fs?: Partial<fs.FileSystemAdapter>; |
|||
pathSegmentSeparator?: string; |
|||
stats?: boolean; |
|||
throwErrorOnBrokenSymbolicLink?: boolean; |
|||
} |
|||
export default class Settings { |
|||
private readonly _options; |
|||
readonly followSymbolicLinks: boolean; |
|||
readonly fs: fs.FileSystemAdapter; |
|||
readonly pathSegmentSeparator: string; |
|||
readonly stats: boolean; |
|||
readonly throwErrorOnBrokenSymbolicLink: boolean; |
|||
readonly fsStatSettings: fsStat.Settings; |
|||
constructor(_options?: Options); |
|||
private _getValue; |
|||
} |
@ -1,24 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
const path = require("path"); |
|||
const fsStat = require("@nodelib/fs.stat"); |
|||
const fs = require("./adapters/fs"); |
|||
class Settings { |
|||
constructor(_options = {}) { |
|||
this._options = _options; |
|||
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); |
|||
this.fs = fs.createFileSystemAdapter(this._options.fs); |
|||
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); |
|||
this.stats = this._getValue(this._options.stats, false); |
|||
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); |
|||
this.fsStatSettings = new fsStat.Settings({ |
|||
followSymbolicLink: this.followSymbolicLinks, |
|||
fs: this.fs, |
|||
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink |
|||
}); |
|||
} |
|||
_getValue(option, value) { |
|||
return option !== null && option !== void 0 ? option : value; |
|||
} |
|||
} |
|||
exports.default = Settings; |
@ -1,20 +0,0 @@ |
|||
/// <reference types="node" />
|
|||
import type * as fs from 'fs'; |
|||
export interface Entry { |
|||
dirent: Dirent; |
|||
name: string; |
|||
path: string; |
|||
stats?: Stats; |
|||
} |
|||
export declare type Stats = fs.Stats; |
|||
export declare type ErrnoException = NodeJS.ErrnoException; |
|||
export interface Dirent { |
|||
isBlockDevice: () => boolean; |
|||
isCharacterDevice: () => boolean; |
|||
isDirectory: () => boolean; |
|||
isFIFO: () => boolean; |
|||
isFile: () => boolean; |
|||
isSocket: () => boolean; |
|||
isSymbolicLink: () => boolean; |
|||
name: string; |
|||
} |
@ -1,2 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
@ -1,2 +0,0 @@ |
|||
import type { Dirent, Stats } from '../types'; |
|||
export declare function createDirentFromStats(name: string, stats: Stats): Dirent; |
@ -1,19 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.createDirentFromStats = void 0; |
|||
class DirentFromStats { |
|||
constructor(name, stats) { |
|||
this.name = name; |
|||
this.isBlockDevice = stats.isBlockDevice.bind(stats); |
|||
this.isCharacterDevice = stats.isCharacterDevice.bind(stats); |
|||
this.isDirectory = stats.isDirectory.bind(stats); |
|||
this.isFIFO = stats.isFIFO.bind(stats); |
|||
this.isFile = stats.isFile.bind(stats); |
|||
this.isSocket = stats.isSocket.bind(stats); |
|||
this.isSymbolicLink = stats.isSymbolicLink.bind(stats); |
|||
} |
|||
} |
|||
function createDirentFromStats(name, stats) { |
|||
return new DirentFromStats(name, stats); |
|||
} |
|||
exports.createDirentFromStats = createDirentFromStats; |
@ -1,2 +0,0 @@ |
|||
import * as fs from './fs'; |
|||
export { fs }; |
@ -1,5 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.fs = void 0; |
|||
const fs = require("./fs"); |
|||
exports.fs = fs; |
@ -1,44 +0,0 @@ |
|||
{ |
|||
"name": "@nodelib/fs.scandir", |
|||
"version": "2.1.5", |
|||
"description": "List files and directories inside the specified directory", |
|||
"license": "MIT", |
|||
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir", |
|||
"keywords": [ |
|||
"NodeLib", |
|||
"fs", |
|||
"FileSystem", |
|||
"file system", |
|||
"scandir", |
|||
"readdir", |
|||
"dirent" |
|||
], |
|||
"engines": { |
|||
"node": ">= 8" |
|||
}, |
|||
"files": [ |
|||
"out/**", |
|||
"!out/**/*.map", |
|||
"!out/**/*.spec.*" |
|||
], |
|||
"main": "out/index.js", |
|||
"typings": "out/index.d.ts", |
|||
"scripts": { |
|||
"clean": "rimraf {tsconfig.tsbuildinfo,out}", |
|||
"lint": "eslint \"src/**/*.ts\" --cache", |
|||
"compile": "tsc -b .", |
|||
"compile:watch": "tsc -p . --watch --sourceMap", |
|||
"test": "mocha \"out/**/*.spec.js\" -s 0", |
|||
"build": "npm run clean && npm run compile && npm run lint && npm test", |
|||
"watch": "npm run clean && npm run compile:watch" |
|||
}, |
|||
"dependencies": { |
|||
"@nodelib/fs.stat": "2.0.5", |
|||
"run-parallel": "^1.1.9" |
|||
}, |
|||
"devDependencies": { |
|||
"@nodelib/fs.macchiato": "1.0.4", |
|||
"@types/run-parallel": "^1.1.0" |
|||
}, |
|||
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562" |
|||
} |
@ -1,21 +0,0 @@ |
|||
The MIT License (MIT) |
|||
|
|||
Copyright (c) Denis Malinochkin |
|||
|
|||
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. |
@ -1,126 +0,0 @@ |
|||
# @nodelib/fs.stat |
|||
|
|||
> Get the status of a file with some features. |
|||
|
|||
## :bulb: Highlights |
|||
|
|||
Wrapper around standard method `fs.lstat` and `fs.stat` with some features. |
|||
|
|||
* :beginner: Normally follows symbolic link. |
|||
* :gear: Can safely work with broken symbolic link. |
|||
|
|||
## Install |
|||
|
|||
```console |
|||
npm install @nodelib/fs.stat |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```ts |
|||
import * as fsStat from '@nodelib/fs.stat'; |
|||
|
|||
fsStat.stat('path', (error, stats) => { /* … */ }); |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### .stat(path, [optionsOrSettings], callback) |
|||
|
|||
Returns an instance of `fs.Stats` class for provided path with standard callback-style. |
|||
|
|||
```ts |
|||
fsStat.stat('path', (error, stats) => { /* … */ }); |
|||
fsStat.stat('path', {}, (error, stats) => { /* … */ }); |
|||
fsStat.stat('path', new fsStat.Settings(), (error, stats) => { /* … */ }); |
|||
``` |
|||
|
|||
### .statSync(path, [optionsOrSettings]) |
|||
|
|||
Returns an instance of `fs.Stats` class for provided path. |
|||
|
|||
```ts |
|||
const stats = fsStat.stat('path'); |
|||
const stats = fsStat.stat('path', {}); |
|||
const stats = fsStat.stat('path', new fsStat.Settings()); |
|||
``` |
|||
|
|||
#### path |
|||
|
|||
* Required: `true` |
|||
* Type: `string | Buffer | URL` |
|||
|
|||
A path to a file. If a URL is provided, it must use the `file:` protocol. |
|||
|
|||
#### optionsOrSettings |
|||
|
|||
* Required: `false` |
|||
* Type: `Options | Settings` |
|||
* Default: An instance of `Settings` class |
|||
|
|||
An [`Options`](#options) object or an instance of [`Settings`](#settings) class. |
|||
|
|||
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. |
|||
|
|||
### Settings([options]) |
|||
|
|||
A class of full settings of the package. |
|||
|
|||
```ts |
|||
const settings = new fsStat.Settings({ followSymbolicLink: false }); |
|||
|
|||
const stats = fsStat.stat('path', settings); |
|||
``` |
|||
|
|||
## Options |
|||
|
|||
### `followSymbolicLink` |
|||
|
|||
* Type: `boolean` |
|||
* Default: `true` |
|||
|
|||
Follow symbolic link or not. Call `fs.stat` on symbolic link if `true`. |
|||
|
|||
### `markSymbolicLink` |
|||
|
|||
* Type: `boolean` |
|||
* Default: `false` |
|||
|
|||
Mark symbolic link by setting the return value of `isSymbolicLink` function to always `true` (even after `fs.stat`). |
|||
|
|||
> :book: Can be used if you want to know what is hidden behind a symbolic link, but still continue to know that it is a symbolic link. |
|||
|
|||
### `throwErrorOnBrokenSymbolicLink` |
|||
|
|||
* Type: `boolean` |
|||
* Default: `true` |
|||
|
|||
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. |
|||
|
|||
### `fs` |
|||
|
|||
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) |
|||
* Default: A default FS methods |
|||
|
|||
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. |
|||
|
|||
```ts |
|||
interface FileSystemAdapter { |
|||
lstat?: typeof fs.lstat; |
|||
stat?: typeof fs.stat; |
|||
lstatSync?: typeof fs.lstatSync; |
|||
statSync?: typeof fs.statSync; |
|||
} |
|||
|
|||
const settings = new fsStat.Settings({ |
|||
fs: { lstat: fakeLstat } |
|||
}); |
|||
``` |
|||
|
|||
## Changelog |
|||
|
|||
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. |
|||
|
|||
## License |
|||
|
|||
This software is released under the terms of the MIT license. |
@ -1,13 +0,0 @@ |
|||
/// <reference types="node" />
|
|||
import * as fs from 'fs'; |
|||
import type { ErrnoException } from '../types'; |
|||
export declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void; |
|||
export declare type StatSynchronousMethod = (path: string) => fs.Stats; |
|||
export interface FileSystemAdapter { |
|||
lstat: StatAsynchronousMethod; |
|||
stat: StatAsynchronousMethod; |
|||
lstatSync: StatSynchronousMethod; |
|||
statSync: StatSynchronousMethod; |
|||
} |
|||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; |
|||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter; |
@ -1,17 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; |
|||
const fs = require("fs"); |
|||
exports.FILE_SYSTEM_ADAPTER = { |
|||
lstat: fs.lstat, |
|||
stat: fs.stat, |
|||
lstatSync: fs.lstatSync, |
|||
statSync: fs.statSync |
|||
}; |
|||
function createFileSystemAdapter(fsMethods) { |
|||
if (fsMethods === undefined) { |
|||
return exports.FILE_SYSTEM_ADAPTER; |
|||
} |
|||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); |
|||
} |
|||
exports.createFileSystemAdapter = createFileSystemAdapter; |
@ -1,12 +0,0 @@ |
|||
import type { FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod } from './adapters/fs'; |
|||
import * as async from './providers/async'; |
|||
import Settings, { Options } from './settings'; |
|||
import type { Stats } from './types'; |
|||
declare type AsyncCallback = async.AsyncCallback; |
|||
declare function stat(path: string, callback: AsyncCallback): void; |
|||
declare function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; |
|||
declare namespace stat { |
|||
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Stats>; |
|||
} |
|||
declare function statSync(path: string, optionsOrSettings?: Options | Settings): Stats; |
|||
export { Settings, stat, statSync, AsyncCallback, FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod, Options, Stats }; |
@ -1,26 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.statSync = exports.stat = exports.Settings = void 0; |
|||
const async = require("./providers/async"); |
|||
const sync = require("./providers/sync"); |
|||
const settings_1 = require("./settings"); |
|||
exports.Settings = settings_1.default; |
|||
function stat(path, optionsOrSettingsOrCallback, callback) { |
|||
if (typeof optionsOrSettingsOrCallback === 'function') { |
|||
async.read(path, getSettings(), optionsOrSettingsOrCallback); |
|||
return; |
|||
} |
|||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback); |
|||
} |
|||
exports.stat = stat; |
|||
function statSync(path, optionsOrSettings) { |
|||
const settings = getSettings(optionsOrSettings); |
|||
return sync.read(path, settings); |
|||
} |
|||
exports.statSync = statSync; |
|||
function getSettings(settingsOrOptions = {}) { |
|||
if (settingsOrOptions instanceof settings_1.default) { |
|||
return settingsOrOptions; |
|||
} |
|||
return new settings_1.default(settingsOrOptions); |
|||
} |
@ -1,4 +0,0 @@ |
|||
import type Settings from '../settings'; |
|||
import type { ErrnoException, Stats } from '../types'; |
|||
export declare type AsyncCallback = (error: ErrnoException, stats: Stats) => void; |
|||
export declare function read(path: string, settings: Settings, callback: AsyncCallback): void; |
@ -1,36 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.read = void 0; |
|||
function read(path, settings, callback) { |
|||
settings.fs.lstat(path, (lstatError, lstat) => { |
|||
if (lstatError !== null) { |
|||
callFailureCallback(callback, lstatError); |
|||
return; |
|||
} |
|||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { |
|||
callSuccessCallback(callback, lstat); |
|||
return; |
|||
} |
|||
settings.fs.stat(path, (statError, stat) => { |
|||
if (statError !== null) { |
|||
if (settings.throwErrorOnBrokenSymbolicLink) { |
|||
callFailureCallback(callback, statError); |
|||
return; |
|||
} |
|||
callSuccessCallback(callback, lstat); |
|||
return; |
|||
} |
|||
if (settings.markSymbolicLink) { |
|||
stat.isSymbolicLink = () => true; |
|||
} |
|||
callSuccessCallback(callback, stat); |
|||
}); |
|||
}); |
|||
} |
|||
exports.read = read; |
|||
function callFailureCallback(callback, error) { |
|||
callback(error); |
|||
} |
|||
function callSuccessCallback(callback, result) { |
|||
callback(null, result); |
|||
} |
@ -1,3 +0,0 @@ |
|||
import type Settings from '../settings'; |
|||
import type { Stats } from '../types'; |
|||
export declare function read(path: string, settings: Settings): Stats; |
@ -1,23 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.read = void 0; |
|||
function read(path, settings) { |
|||
const lstat = settings.fs.lstatSync(path); |
|||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { |
|||
return lstat; |
|||
} |
|||
try { |
|||
const stat = settings.fs.statSync(path); |
|||
if (settings.markSymbolicLink) { |
|||
stat.isSymbolicLink = () => true; |
|||
} |
|||
return stat; |
|||
} |
|||
catch (error) { |
|||
if (!settings.throwErrorOnBrokenSymbolicLink) { |
|||
return lstat; |
|||
} |
|||
throw error; |
|||
} |
|||
} |
|||
exports.read = read; |
@ -1,16 +0,0 @@ |
|||
import * as fs from './adapters/fs'; |
|||
export interface Options { |
|||
followSymbolicLink?: boolean; |
|||
fs?: Partial<fs.FileSystemAdapter>; |
|||
markSymbolicLink?: boolean; |
|||
throwErrorOnBrokenSymbolicLink?: boolean; |
|||
} |
|||
export default class Settings { |
|||
private readonly _options; |
|||
readonly followSymbolicLink: boolean; |
|||
readonly fs: fs.FileSystemAdapter; |
|||
readonly markSymbolicLink: boolean; |
|||
readonly throwErrorOnBrokenSymbolicLink: boolean; |
|||
constructor(_options?: Options); |
|||
private _getValue; |
|||
} |
@ -1,16 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
const fs = require("./adapters/fs"); |
|||
class Settings { |
|||
constructor(_options = {}) { |
|||
this._options = _options; |
|||
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); |
|||
this.fs = fs.createFileSystemAdapter(this._options.fs); |
|||
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); |
|||
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); |
|||
} |
|||
_getValue(option, value) { |
|||
return option !== null && option !== void 0 ? option : value; |
|||
} |
|||
} |
|||
exports.default = Settings; |
@ -1,4 +0,0 @@ |
|||
/// <reference types="node" />
|
|||
import type * as fs from 'fs'; |
|||
export declare type Stats = fs.Stats; |
|||
export declare type ErrnoException = NodeJS.ErrnoException; |
@ -1,2 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
@ -1,37 +0,0 @@ |
|||
{ |
|||
"name": "@nodelib/fs.stat", |
|||
"version": "2.0.5", |
|||
"description": "Get the status of a file with some features", |
|||
"license": "MIT", |
|||
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat", |
|||
"keywords": [ |
|||
"NodeLib", |
|||
"fs", |
|||
"FileSystem", |
|||
"file system", |
|||
"stat" |
|||
], |
|||
"engines": { |
|||
"node": ">= 8" |
|||
}, |
|||
"files": [ |
|||
"out/**", |
|||
"!out/**/*.map", |
|||
"!out/**/*.spec.*" |
|||
], |
|||
"main": "out/index.js", |
|||
"typings": "out/index.d.ts", |
|||
"scripts": { |
|||
"clean": "rimraf {tsconfig.tsbuildinfo,out}", |
|||
"lint": "eslint \"src/**/*.ts\" --cache", |
|||
"compile": "tsc -b .", |
|||
"compile:watch": "tsc -p . --watch --sourceMap", |
|||
"test": "mocha \"out/**/*.spec.js\" -s 0", |
|||
"build": "npm run clean && npm run compile && npm run lint && npm test", |
|||
"watch": "npm run clean && npm run compile:watch" |
|||
}, |
|||
"devDependencies": { |
|||
"@nodelib/fs.macchiato": "1.0.4" |
|||
}, |
|||
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562" |
|||
} |
@ -1,21 +0,0 @@ |
|||
The MIT License (MIT) |
|||
|
|||
Copyright (c) Denis Malinochkin |
|||
|
|||
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. |
@ -1,215 +0,0 @@ |
|||
# @nodelib/fs.walk |
|||
|
|||
> A library for efficiently walking a directory recursively. |
|||
|
|||
## :bulb: Highlights |
|||
|
|||
* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). |
|||
* :rocket: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type for performance reasons. See [`old` and `modern` mode](https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode). |
|||
* :gear: Built-in directories/files and error filtering system. |
|||
* :link: Can safely work with broken symbolic links. |
|||
|
|||
## Install |
|||
|
|||
```console |
|||
npm install @nodelib/fs.walk |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```ts |
|||
import * as fsWalk from '@nodelib/fs.walk'; |
|||
|
|||
fsWalk.walk('path', (error, entries) => { /* … */ }); |
|||
``` |
|||
|
|||
## API |
|||
|
|||
### .walk(path, [optionsOrSettings], callback) |
|||
|
|||
Reads the directory recursively and asynchronously. Requires a callback function. |
|||
|
|||
> :book: If you want to use the Promise API, use `util.promisify`. |
|||
|
|||
```ts |
|||
fsWalk.walk('path', (error, entries) => { /* … */ }); |
|||
fsWalk.walk('path', {}, (error, entries) => { /* … */ }); |
|||
fsWalk.walk('path', new fsWalk.Settings(), (error, entries) => { /* … */ }); |
|||
``` |
|||
|
|||
### .walkStream(path, [optionsOrSettings]) |
|||
|
|||
Reads the directory recursively and asynchronously. [Readable Stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_readable_streams) is used as a provider. |
|||
|
|||
```ts |
|||
const stream = fsWalk.walkStream('path'); |
|||
const stream = fsWalk.walkStream('path', {}); |
|||
const stream = fsWalk.walkStream('path', new fsWalk.Settings()); |
|||
``` |
|||
|
|||
### .walkSync(path, [optionsOrSettings]) |
|||
|
|||
Reads the directory recursively and synchronously. Returns an array of entries. |
|||
|
|||
```ts |
|||
const entries = fsWalk.walkSync('path'); |
|||
const entries = fsWalk.walkSync('path', {}); |
|||
const entries = fsWalk.walkSync('path', new fsWalk.Settings()); |
|||
``` |
|||
|
|||
#### path |
|||
|
|||
* Required: `true` |
|||
* Type: `string | Buffer | URL` |
|||
|
|||
A path to a file. If a URL is provided, it must use the `file:` protocol. |
|||
|
|||
#### optionsOrSettings |
|||
|
|||
* Required: `false` |
|||
* Type: `Options | Settings` |
|||
* Default: An instance of `Settings` class |
|||
|
|||
An [`Options`](#options) object or an instance of [`Settings`](#settings) class. |
|||
|
|||
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. |
|||
|
|||
### Settings([options]) |
|||
|
|||
A class of full settings of the package. |
|||
|
|||
```ts |
|||
const settings = new fsWalk.Settings({ followSymbolicLinks: true }); |
|||
|
|||
const entries = fsWalk.walkSync('path', settings); |
|||
``` |
|||
|
|||
## Entry |
|||
|
|||
* `name` — The name of the entry (`unknown.txt`). |
|||
* `path` — The path of the entry relative to call directory (`root/unknown.txt`). |
|||
* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. |
|||
* [`stats`] — An instance of `fs.Stats` class. |
|||
|
|||
## Options |
|||
|
|||
### basePath |
|||
|
|||
* Type: `string` |
|||
* Default: `undefined` |
|||
|
|||
By default, all paths are built relative to the root path. You can use this option to set custom root path. |
|||
|
|||
In the example below we read the files from the `root` directory, but in the results the root path will be `custom`. |
|||
|
|||
```ts |
|||
fsWalk.walkSync('root'); // → ['root/file.txt'] |
|||
fsWalk.walkSync('root', { basePath: 'custom' }); // → ['custom/file.txt'] |
|||
``` |
|||
|
|||
### concurrency |
|||
|
|||
* Type: `number` |
|||
* Default: `Infinity` |
|||
|
|||
The maximum number of concurrent calls to `fs.readdir`. |
|||
|
|||
> :book: The higher the number, the higher performance and the load on the File System. If you want to read in quiet mode, set the value to `4 * os.cpus().length` (4 is default size of [thread pool work scheduling](http://docs.libuv.org/en/v1.x/threadpool.html#thread-pool-work-scheduling)). |
|||
|
|||
### deepFilter |
|||
|
|||
* Type: [`DeepFilterFunction`](./src/settings.ts) |
|||
* Default: `undefined` |
|||
|
|||
A function that indicates whether the directory will be read deep or not. |
|||
|
|||
```ts |
|||
// Skip all directories that starts with `node_modules` |
|||
const filter: DeepFilterFunction = (entry) => !entry.path.startsWith('node_modules'); |
|||
``` |
|||
|
|||
### entryFilter |
|||
|
|||
* Type: [`EntryFilterFunction`](./src/settings.ts) |
|||
* Default: `undefined` |
|||
|
|||
A function that indicates whether the entry will be included to results or not. |
|||
|
|||
```ts |
|||
// Exclude all `.js` files from results |
|||
const filter: EntryFilterFunction = (entry) => !entry.name.endsWith('.js'); |
|||
``` |
|||
|
|||
### errorFilter |
|||
|
|||
* Type: [`ErrorFilterFunction`](./src/settings.ts) |
|||
* Default: `undefined` |
|||
|
|||
A function that allows you to skip errors that occur when reading directories. |
|||
|
|||
For example, you can skip `ENOENT` errors if required: |
|||
|
|||
```ts |
|||
// Skip all ENOENT errors |
|||
const filter: ErrorFilterFunction = (error) => error.code == 'ENOENT'; |
|||
``` |
|||
|
|||
### stats |
|||
|
|||
* Type: `boolean` |
|||
* Default: `false` |
|||
|
|||
Adds an instance of `fs.Stats` class to the [`Entry`](#entry). |
|||
|
|||
> :book: Always use `fs.readdir` with additional `fs.lstat/fs.stat` calls to determine the entry type. |
|||
|
|||
### followSymbolicLinks |
|||
|
|||
* Type: `boolean` |
|||
* Default: `false` |
|||
|
|||
Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. |
|||
|
|||
### `throwErrorOnBrokenSymbolicLink` |
|||
|
|||
* Type: `boolean` |
|||
* Default: `true` |
|||
|
|||
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. |
|||
|
|||
### `pathSegmentSeparator` |
|||
|
|||
* Type: `string` |
|||
* Default: `path.sep` |
|||
|
|||
By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. |
|||
|
|||
### `fs` |
|||
|
|||
* Type: `FileSystemAdapter` |
|||
* Default: A default FS methods |
|||
|
|||
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. |
|||
|
|||
```ts |
|||
interface FileSystemAdapter { |
|||
lstat: typeof fs.lstat; |
|||
stat: typeof fs.stat; |
|||
lstatSync: typeof fs.lstatSync; |
|||
statSync: typeof fs.statSync; |
|||
readdir: typeof fs.readdir; |
|||
readdirSync: typeof fs.readdirSync; |
|||
} |
|||
|
|||
const settings = new fsWalk.Settings({ |
|||
fs: { lstat: fakeLstat } |
|||
}); |
|||
``` |
|||
|
|||
## Changelog |
|||
|
|||
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. |
|||
|
|||
## License |
|||
|
|||
This software is released under the terms of the MIT license. |
@ -1,14 +0,0 @@ |
|||
/// <reference types="node" />
|
|||
import type { Readable } from 'stream'; |
|||
import type { Dirent, FileSystemAdapter } from '@nodelib/fs.scandir'; |
|||
import { AsyncCallback } from './providers/async'; |
|||
import Settings, { DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction, Options } from './settings'; |
|||
import type { Entry } from './types'; |
|||
declare function walk(directory: string, callback: AsyncCallback): void; |
|||
declare function walk(directory: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; |
|||
declare namespace walk { |
|||
function __promisify__(directory: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>; |
|||
} |
|||
declare function walkSync(directory: string, optionsOrSettings?: Options | Settings): Entry[]; |
|||
declare function walkStream(directory: string, optionsOrSettings?: Options | Settings): Readable; |
|||
export { walk, walkSync, walkStream, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, Options, DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction }; |
@ -1,34 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; |
|||
const async_1 = require("./providers/async"); |
|||
const stream_1 = require("./providers/stream"); |
|||
const sync_1 = require("./providers/sync"); |
|||
const settings_1 = require("./settings"); |
|||
exports.Settings = settings_1.default; |
|||
function walk(directory, optionsOrSettingsOrCallback, callback) { |
|||
if (typeof optionsOrSettingsOrCallback === 'function') { |
|||
new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); |
|||
return; |
|||
} |
|||
new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); |
|||
} |
|||
exports.walk = walk; |
|||
function walkSync(directory, optionsOrSettings) { |
|||
const settings = getSettings(optionsOrSettings); |
|||
const provider = new sync_1.default(directory, settings); |
|||
return provider.read(); |
|||
} |
|||
exports.walkSync = walkSync; |
|||
function walkStream(directory, optionsOrSettings) { |
|||
const settings = getSettings(optionsOrSettings); |
|||
const provider = new stream_1.default(directory, settings); |
|||
return provider.read(); |
|||
} |
|||
exports.walkStream = walkStream; |
|||
function getSettings(settingsOrOptions = {}) { |
|||
if (settingsOrOptions instanceof settings_1.default) { |
|||
return settingsOrOptions; |
|||
} |
|||
return new settings_1.default(settingsOrOptions); |
|||
} |
@ -1,12 +0,0 @@ |
|||
import AsyncReader from '../readers/async'; |
|||
import type Settings from '../settings'; |
|||
import type { Entry, Errno } from '../types'; |
|||
export declare type AsyncCallback = (error: Errno, entries: Entry[]) => void; |
|||
export default class AsyncProvider { |
|||
private readonly _root; |
|||
private readonly _settings; |
|||
protected readonly _reader: AsyncReader; |
|||
private readonly _storage; |
|||
constructor(_root: string, _settings: Settings); |
|||
read(callback: AsyncCallback): void; |
|||
} |
@ -1,30 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
const async_1 = require("../readers/async"); |
|||
class AsyncProvider { |
|||
constructor(_root, _settings) { |
|||
this._root = _root; |
|||
this._settings = _settings; |
|||
this._reader = new async_1.default(this._root, this._settings); |
|||
this._storage = []; |
|||
} |
|||
read(callback) { |
|||
this._reader.onError((error) => { |
|||
callFailureCallback(callback, error); |
|||
}); |
|||
this._reader.onEntry((entry) => { |
|||
this._storage.push(entry); |
|||
}); |
|||
this._reader.onEnd(() => { |
|||
callSuccessCallback(callback, this._storage); |
|||
}); |
|||
this._reader.read(); |
|||
} |
|||
} |
|||
exports.default = AsyncProvider; |
|||
function callFailureCallback(callback, error) { |
|||
callback(error); |
|||
} |
|||
function callSuccessCallback(callback, entries) { |
|||
callback(null, entries); |
|||
} |
@ -1,4 +0,0 @@ |
|||
import AsyncProvider from './async'; |
|||
import StreamProvider from './stream'; |
|||
import SyncProvider from './sync'; |
|||
export { AsyncProvider, StreamProvider, SyncProvider }; |
@ -1,9 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.SyncProvider = exports.StreamProvider = exports.AsyncProvider = void 0; |
|||
const async_1 = require("./async"); |
|||
exports.AsyncProvider = async_1.default; |
|||
const stream_1 = require("./stream"); |
|||
exports.StreamProvider = stream_1.default; |
|||
const sync_1 = require("./sync"); |
|||
exports.SyncProvider = sync_1.default; |
@ -1,12 +0,0 @@ |
|||
/// <reference types="node" />
|
|||
import { Readable } from 'stream'; |
|||
import AsyncReader from '../readers/async'; |
|||
import type Settings from '../settings'; |
|||
export default class StreamProvider { |
|||
private readonly _root; |
|||
private readonly _settings; |
|||
protected readonly _reader: AsyncReader; |
|||
protected readonly _stream: Readable; |
|||
constructor(_root: string, _settings: Settings); |
|||
read(): Readable; |
|||
} |
@ -1,34 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
const stream_1 = require("stream"); |
|||
const async_1 = require("../readers/async"); |
|||
class StreamProvider { |
|||
constructor(_root, _settings) { |
|||
this._root = _root; |
|||
this._settings = _settings; |
|||
this._reader = new async_1.default(this._root, this._settings); |
|||
this._stream = new stream_1.Readable({ |
|||
objectMode: true, |
|||
read: () => { }, |
|||
destroy: () => { |
|||
if (!this._reader.isDestroyed) { |
|||
this._reader.destroy(); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
read() { |
|||
this._reader.onError((error) => { |
|||
this._stream.emit('error', error); |
|||
}); |
|||
this._reader.onEntry((entry) => { |
|||
this._stream.push(entry); |
|||
}); |
|||
this._reader.onEnd(() => { |
|||
this._stream.push(null); |
|||
}); |
|||
this._reader.read(); |
|||
return this._stream; |
|||
} |
|||
} |
|||
exports.default = StreamProvider; |
@ -1,10 +0,0 @@ |
|||
import SyncReader from '../readers/sync'; |
|||
import type Settings from '../settings'; |
|||
import type { Entry } from '../types'; |
|||
export default class SyncProvider { |
|||
private readonly _root; |
|||
private readonly _settings; |
|||
protected readonly _reader: SyncReader; |
|||
constructor(_root: string, _settings: Settings); |
|||
read(): Entry[]; |
|||
} |
@ -1,14 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
const sync_1 = require("../readers/sync"); |
|||
class SyncProvider { |
|||
constructor(_root, _settings) { |
|||
this._root = _root; |
|||
this._settings = _settings; |
|||
this._reader = new sync_1.default(this._root, this._settings); |
|||
} |
|||
read() { |
|||
return this._reader.read(); |
|||
} |
|||
} |
|||
exports.default = SyncProvider; |
@ -1,30 +0,0 @@ |
|||
/// <reference types="node" />
|
|||
import { EventEmitter } from 'events'; |
|||
import * as fsScandir from '@nodelib/fs.scandir'; |
|||
import type Settings from '../settings'; |
|||
import type { Entry, Errno } from '../types'; |
|||
import Reader from './reader'; |
|||
declare type EntryEventCallback = (entry: Entry) => void; |
|||
declare type ErrorEventCallback = (error: Errno) => void; |
|||
declare type EndEventCallback = () => void; |
|||
export default class AsyncReader extends Reader { |
|||
protected readonly _settings: Settings; |
|||
protected readonly _scandir: typeof fsScandir.scandir; |
|||
protected readonly _emitter: EventEmitter; |
|||
private readonly _queue; |
|||
private _isFatalError; |
|||
private _isDestroyed; |
|||
constructor(_root: string, _settings: Settings); |
|||
read(): EventEmitter; |
|||
get isDestroyed(): boolean; |
|||
destroy(): void; |
|||
onEntry(callback: EntryEventCallback): void; |
|||
onError(callback: ErrorEventCallback): void; |
|||
onEnd(callback: EndEventCallback): void; |
|||
private _pushToQueue; |
|||
private _worker; |
|||
private _handleError; |
|||
private _handleEntry; |
|||
private _emitEntry; |
|||
} |
|||
export {}; |
@ -1,97 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
const events_1 = require("events"); |
|||
const fsScandir = require("@nodelib/fs.scandir"); |
|||
const fastq = require("fastq"); |
|||
const common = require("./common"); |
|||
const reader_1 = require("./reader"); |
|||
class AsyncReader extends reader_1.default { |
|||
constructor(_root, _settings) { |
|||
super(_root, _settings); |
|||
this._settings = _settings; |
|||
this._scandir = fsScandir.scandir; |
|||
this._emitter = new events_1.EventEmitter(); |
|||
this._queue = fastq(this._worker.bind(this), this._settings.concurrency); |
|||
this._isFatalError = false; |
|||
this._isDestroyed = false; |
|||
this._queue.drain = () => { |
|||
if (!this._isFatalError) { |
|||
this._emitter.emit('end'); |
|||
} |
|||
}; |
|||
} |
|||
read() { |
|||
this._isFatalError = false; |
|||
this._isDestroyed = false; |
|||
setImmediate(() => { |
|||
this._pushToQueue(this._root, this._settings.basePath); |
|||
}); |
|||
return this._emitter; |
|||
} |
|||
get isDestroyed() { |
|||
return this._isDestroyed; |
|||
} |
|||
destroy() { |
|||
if (this._isDestroyed) { |
|||
throw new Error('The reader is already destroyed'); |
|||
} |
|||
this._isDestroyed = true; |
|||
this._queue.killAndDrain(); |
|||
} |
|||
onEntry(callback) { |
|||
this._emitter.on('entry', callback); |
|||
} |
|||
onError(callback) { |
|||
this._emitter.once('error', callback); |
|||
} |
|||
onEnd(callback) { |
|||
this._emitter.once('end', callback); |
|||
} |
|||
_pushToQueue(directory, base) { |
|||
const queueItem = { directory, base }; |
|||
this._queue.push(queueItem, (error) => { |
|||
if (error !== null) { |
|||
this._handleError(error); |
|||
} |
|||
}); |
|||
} |
|||
_worker(item, done) { |
|||
this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { |
|||
if (error !== null) { |
|||
done(error, undefined); |
|||
return; |
|||
} |
|||
for (const entry of entries) { |
|||
this._handleEntry(entry, item.base); |
|||
} |
|||
done(null, undefined); |
|||
}); |
|||
} |
|||
_handleError(error) { |
|||
if (this._isDestroyed || !common.isFatalError(this._settings, error)) { |
|||
return; |
|||
} |
|||
this._isFatalError = true; |
|||
this._isDestroyed = true; |
|||
this._emitter.emit('error', error); |
|||
} |
|||
_handleEntry(entry, base) { |
|||
if (this._isDestroyed || this._isFatalError) { |
|||
return; |
|||
} |
|||
const fullpath = entry.path; |
|||
if (base !== undefined) { |
|||
entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); |
|||
} |
|||
if (common.isAppliedFilter(this._settings.entryFilter, entry)) { |
|||
this._emitEntry(entry); |
|||
} |
|||
if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { |
|||
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); |
|||
} |
|||
} |
|||
_emitEntry(entry) { |
|||
this._emitter.emit('entry', entry); |
|||
} |
|||
} |
|||
exports.default = AsyncReader; |
@ -1,7 +0,0 @@ |
|||
import type { FilterFunction } from '../settings'; |
|||
import type Settings from '../settings'; |
|||
import type { Errno } from '../types'; |
|||
export declare function isFatalError(settings: Settings, error: Errno): boolean; |
|||
export declare function isAppliedFilter<T>(filter: FilterFunction<T> | null, value: T): boolean; |
|||
export declare function replacePathSegmentSeparator(filepath: string, separator: string): string; |
|||
export declare function joinPathSegments(a: string, b: string, separator: string): string; |
@ -1,31 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; |
|||
function isFatalError(settings, error) { |
|||
if (settings.errorFilter === null) { |
|||
return true; |
|||
} |
|||
return !settings.errorFilter(error); |
|||
} |
|||
exports.isFatalError = isFatalError; |
|||
function isAppliedFilter(filter, value) { |
|||
return filter === null || filter(value); |
|||
} |
|||
exports.isAppliedFilter = isAppliedFilter; |
|||
function replacePathSegmentSeparator(filepath, separator) { |
|||
return filepath.split(/[/\\]/).join(separator); |
|||
} |
|||
exports.replacePathSegmentSeparator = replacePathSegmentSeparator; |
|||
function joinPathSegments(a, b, separator) { |
|||
if (a === '') { |
|||
return b; |
|||
} |
|||
/** |
|||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). |
|||
*/ |
|||
if (a.endsWith(separator)) { |
|||
return a + b; |
|||
} |
|||
return a + separator + b; |
|||
} |
|||
exports.joinPathSegments = joinPathSegments; |
@ -1,6 +0,0 @@ |
|||
import type Settings from '../settings'; |
|||
export default class Reader { |
|||
protected readonly _root: string; |
|||
protected readonly _settings: Settings; |
|||
constructor(_root: string, _settings: Settings); |
|||
} |
@ -1,11 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
const common = require("./common"); |
|||
class Reader { |
|||
constructor(_root, _settings) { |
|||
this._root = _root; |
|||
this._settings = _settings; |
|||
this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); |
|||
} |
|||
} |
|||
exports.default = Reader; |
@ -1,15 +0,0 @@ |
|||
import * as fsScandir from '@nodelib/fs.scandir'; |
|||
import type { Entry } from '../types'; |
|||
import Reader from './reader'; |
|||
export default class SyncReader extends Reader { |
|||
protected readonly _scandir: typeof fsScandir.scandirSync; |
|||
private readonly _storage; |
|||
private readonly _queue; |
|||
read(): Entry[]; |
|||
private _pushToQueue; |
|||
private _handleQueue; |
|||
private _handleDirectory; |
|||
private _handleError; |
|||
private _handleEntry; |
|||
private _pushToStorage; |
|||
} |
@ -1,59 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
const fsScandir = require("@nodelib/fs.scandir"); |
|||
const common = require("./common"); |
|||
const reader_1 = require("./reader"); |
|||
class SyncReader extends reader_1.default { |
|||
constructor() { |
|||
super(...arguments); |
|||
this._scandir = fsScandir.scandirSync; |
|||
this._storage = []; |
|||
this._queue = new Set(); |
|||
} |
|||
read() { |
|||
this._pushToQueue(this._root, this._settings.basePath); |
|||
this._handleQueue(); |
|||
return this._storage; |
|||
} |
|||
_pushToQueue(directory, base) { |
|||
this._queue.add({ directory, base }); |
|||
} |
|||
_handleQueue() { |
|||
for (const item of this._queue.values()) { |
|||
this._handleDirectory(item.directory, item.base); |
|||
} |
|||
} |
|||
_handleDirectory(directory, base) { |
|||
try { |
|||
const entries = this._scandir(directory, this._settings.fsScandirSettings); |
|||
for (const entry of entries) { |
|||
this._handleEntry(entry, base); |
|||
} |
|||
} |
|||
catch (error) { |
|||
this._handleError(error); |
|||
} |
|||
} |
|||
_handleError(error) { |
|||
if (!common.isFatalError(this._settings, error)) { |
|||
return; |
|||
} |
|||
throw error; |
|||
} |
|||
_handleEntry(entry, base) { |
|||
const fullpath = entry.path; |
|||
if (base !== undefined) { |
|||
entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); |
|||
} |
|||
if (common.isAppliedFilter(this._settings.entryFilter, entry)) { |
|||
this._pushToStorage(entry); |
|||
} |
|||
if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { |
|||
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path); |
|||
} |
|||
} |
|||
_pushToStorage(entry) { |
|||
this._storage.push(entry); |
|||
} |
|||
} |
|||
exports.default = SyncReader; |
@ -1,30 +0,0 @@ |
|||
import * as fsScandir from '@nodelib/fs.scandir'; |
|||
import type { Entry, Errno } from './types'; |
|||
export declare type FilterFunction<T> = (value: T) => boolean; |
|||
export declare type DeepFilterFunction = FilterFunction<Entry>; |
|||
export declare type EntryFilterFunction = FilterFunction<Entry>; |
|||
export declare type ErrorFilterFunction = FilterFunction<Errno>; |
|||
export interface Options { |
|||
basePath?: string; |
|||
concurrency?: number; |
|||
deepFilter?: DeepFilterFunction; |
|||
entryFilter?: EntryFilterFunction; |
|||
errorFilter?: ErrorFilterFunction; |
|||
followSymbolicLinks?: boolean; |
|||
fs?: Partial<fsScandir.FileSystemAdapter>; |
|||
pathSegmentSeparator?: string; |
|||
stats?: boolean; |
|||
throwErrorOnBrokenSymbolicLink?: boolean; |
|||
} |
|||
export default class Settings { |
|||
private readonly _options; |
|||
readonly basePath?: string; |
|||
readonly concurrency: number; |
|||
readonly deepFilter: DeepFilterFunction | null; |
|||
readonly entryFilter: EntryFilterFunction | null; |
|||
readonly errorFilter: ErrorFilterFunction | null; |
|||
readonly pathSegmentSeparator: string; |
|||
readonly fsScandirSettings: fsScandir.Settings; |
|||
constructor(_options?: Options); |
|||
private _getValue; |
|||
} |
@ -1,26 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
|||
const path = require("path"); |
|||
const fsScandir = require("@nodelib/fs.scandir"); |
|||
class Settings { |
|||
constructor(_options = {}) { |
|||
this._options = _options; |
|||
this.basePath = this._getValue(this._options.basePath, undefined); |
|||
this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY); |
|||
this.deepFilter = this._getValue(this._options.deepFilter, null); |
|||
this.entryFilter = this._getValue(this._options.entryFilter, null); |
|||
this.errorFilter = this._getValue(this._options.errorFilter, null); |
|||
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); |
|||
this.fsScandirSettings = new fsScandir.Settings({ |
|||
followSymbolicLinks: this._options.followSymbolicLinks, |
|||
fs: this._options.fs, |
|||
pathSegmentSeparator: this._options.pathSegmentSeparator, |
|||
stats: this._options.stats, |
|||
throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink |
|||
}); |
|||
} |
|||
_getValue(option, value) { |
|||
return option !== null && option !== void 0 ? option : value; |
|||
} |
|||
} |
|||
exports.default = Settings; |
@ -1,8 +0,0 @@ |
|||
/// <reference types="node" />
|
|||
import type * as scandir from '@nodelib/fs.scandir'; |
|||
export declare type Entry = scandir.Entry; |
|||
export declare type Errno = NodeJS.ErrnoException; |
|||
export interface QueueItem { |
|||
directory: string; |
|||
base?: string; |
|||
} |
@ -1,2 +0,0 @@ |
|||
"use strict"; |
|||
Object.defineProperty(exports, "__esModule", { value: true }); |
@ -1,44 +0,0 @@ |
|||
{ |
|||
"name": "@nodelib/fs.walk", |
|||
"version": "1.2.8", |
|||
"description": "A library for efficiently walking a directory recursively", |
|||
"license": "MIT", |
|||
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk", |
|||
"keywords": [ |
|||
"NodeLib", |
|||
"fs", |
|||
"FileSystem", |
|||
"file system", |
|||
"walk", |
|||
"scanner", |
|||
"crawler" |
|||
], |
|||
"engines": { |
|||
"node": ">= 8" |
|||
}, |
|||
"files": [ |
|||
"out/**", |
|||
"!out/**/*.map", |
|||
"!out/**/*.spec.*", |
|||
"!out/**/tests/**" |
|||
], |
|||
"main": "out/index.js", |
|||
"typings": "out/index.d.ts", |
|||
"scripts": { |
|||
"clean": "rimraf {tsconfig.tsbuildinfo,out}", |
|||
"lint": "eslint \"src/**/*.ts\" --cache", |
|||
"compile": "tsc -b .", |
|||
"compile:watch": "tsc -p . --watch --sourceMap", |
|||
"test": "mocha \"out/**/*.spec.js\" -s 0", |
|||
"build": "npm run clean && npm run compile && npm run lint && npm test", |
|||
"watch": "npm run clean && npm run compile:watch" |
|||
}, |
|||
"dependencies": { |
|||
"@nodelib/fs.scandir": "2.1.5", |
|||
"fastq": "^1.6.0" |
|||
}, |
|||
"devDependencies": { |
|||
"@nodelib/fs.macchiato": "1.0.4" |
|||
}, |
|||
"gitHead": "1e5bad48565da2b06b8600e744324ea240bf49d8" |
|||
} |
@ -1,22 +0,0 @@ |
|||
language: node_js |
|||
node_js: |
|||
- '12' |
|||
- '11' |
|||
- '10' |
|||
- '9' |
|||
- '8' |
|||
- '6' |
|||
- '4' |
|||
- '0.12' |
|||
- '0.10' |
|||
- '0.8' |
|||
- '0.6' |
|||
before_install: |
|||
- 'nvm install-latest-npm' |
|||
install: |
|||
- 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' |
|||
sudo: false |
|||
matrix: |
|||
fast_finish: true |
|||
allow_failures: |
|||
- node_js: "0.6" |
@ -1,94 +0,0 @@ |
|||
# acorn-node change log |
|||
|
|||
All notable changes to this project will be documented in this file. |
|||
|
|||
This project adheres to [Semantic Versioning](http://semver.org/). |
|||
|
|||
## 1.8.2 |
|||
* Revert a breaking change in import.meta parsing. |
|||
|
|||
## 1.8.1 |
|||
* Fix crash in compiled private-class-elements code. |
|||
|
|||
## 1.8.0 |
|||
* Upgrade acorn to v7. |
|||
|
|||
For backwards compatibility, `acorn-node` still uses the `Import` node type for dynamic imports, _NOT_ `ImportExpression` like acorn v7 and estree. |
|||
* Add numeric separator support: |
|||
```js |
|||
var a = 10_000_000_000_000_000_000_000_000n; |
|||
``` |
|||
|
|||
## 1.7.0 |
|||
* Add class instance fields support: |
|||
```js |
|||
class X { |
|||
pub = 1; |
|||
#priv = 2; |
|||
} |
|||
``` |
|||
* Add class static fields support: |
|||
```js |
|||
class X { |
|||
static pub = 1; |
|||
static #priv = 2; |
|||
} |
|||
``` |
|||
* Add `export * as ns` support when `sourceType` is 'module': |
|||
```js |
|||
export * as ns from './ns.mjs'; |
|||
``` |
|||
|
|||
## 1.6.2 |
|||
|
|||
* Allow dynamic `import()` in scripts. |
|||
* Update minimum dependency versions, fixing a peerDependency warning. |
|||
* Add Node 10 and 11 to CI. |
|||
|
|||
## 1.6.1 |
|||
|
|||
* Update acorn-dynamic-import to v4. |
|||
|
|||
## 1.6.0 |
|||
|
|||
* Upgrade acorn to v6. |
|||
* Add bigint support. |
|||
|
|||
## 1.5.2 |
|||
|
|||
* Upgrade acorn to support optional catch binding in the AST walker. |
|||
|
|||
## 1.5.1 |
|||
|
|||
* Fix tests on Node <= 0.12. |
|||
|
|||
## 1.5.0 |
|||
|
|||
* Add tests for async iteration, optional catch binding, import.meta, |
|||
dynamic import, bigint (currently unsupported). |
|||
* Add import.meta support. (`sourceType: 'module'` only) |
|||
* Add dynamic import support. (`sourceType: 'module'` only) |
|||
* Fix optional catch binding support in the walker. |
|||
|
|||
## 1.4.0 |
|||
|
|||
* Upgrade acorn to 5.6, which supports optional catch bindings and other |
|||
new syntax features. |
|||
* Set ecmaVersion to 2019 to opt in to optional catch bindings etc. |
|||
|
|||
## 1.3.0 |
|||
|
|||
* Upgrade acorn to 5.4, which supports object spread and async iteration. |
|||
* Remove acorn5-object-spread plugin. |
|||
|
|||
## 1.2.0 |
|||
|
|||
* Expose `acorn/dist/walk` as `acorn-node/walk`. |
|||
|
|||
## 1.1.0 |
|||
|
|||
* Enable `allowHashBang` and `allowReturnOutsideFunction` by default. |
|||
|
|||
## 1.0.0 |
|||
|
|||
* Initial release. |
@ -1,95 +0,0 @@ |
|||
# [Apache License 2.0](https://spdx.org/licenses/Apache-2.0) |
|||
|
|||
Copyright 2018 Renée Kooi <renee@kooi.me> |
|||
|
|||
Licensed under the Apache License, Version 2.0 (the "License"); |
|||
you may not use this file except in compliance with the License. |
|||
You may obtain a copy of the License at |
|||
|
|||
> http://www.apache.org/licenses/LICENSE-2.0 |
|||
|
|||
Unless required by applicable law or agreed to in writing, software |
|||
distributed under the License is distributed on an "AS IS" BASIS, |
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
See the License for the specific language governing permissions and |
|||
limitations under the License. |
|||
|
|||
## acorn-bigint |
|||
|
|||
The code in the `lib/bigint` folder is compiled from code licensed as MIT: |
|||
|
|||
> Copyright (C) 2017-2018 by Adrian Heine |
|||
> |
|||
> 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. |
|||
|
|||
Find the source code at https://github.com/acornjs/acorn-bigint. |
|||
|
|||
## acorn-import-meta |
|||
|
|||
The code in the `lib/import-meta` folder is compiled from code licensed as MIT: |
|||
|
|||
> Copyright (C) 2017-2018 by Adrian Heine |
|||
> |
|||
> 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. |
|||
|
|||
Find the source code at https://github.com/acornjs/acorn-import-meta. |
|||
|
|||
## acorn-dynamic-import |
|||
|
|||
The code in the `lib/dynamic-import` folder is licensed as MIT: |
|||
|
|||
> MIT License |
|||
> |
|||
> Copyright (c) 2016 Jordan Gensler |
|||
> |
|||
> 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. |
|||
|
|||
Find the source code at https://github.com/kesne/acorn-dynamic-import. |
@ -1,65 +0,0 @@ |
|||
# acorn-node |
|||
|
|||
[Acorn](https://github.com/acornjs/acorn) preloaded with plugins for syntax parity with recent Node versions. |
|||
|
|||
It also includes versions of the plugins compiled with [Bublé](https://github.com/rich-harris/buble), so they can be run on old Node versions (0.6 and up). |
|||
|
|||
[![npm][npm-image]][npm-url] |
|||
[![travis][travis-image]][travis-url] |
|||
[![standard][standard-image]][standard-url] |
|||
|
|||
[npm-image]: https://img.shields.io/npm/v/acorn-node.svg?style=flat-square |
|||
[npm-url]: https://www.npmjs.com/package/acorn-node |
|||
[travis-image]: https://img.shields.io/travis/browserify/acorn-node/master.svg?style=flat-square |
|||
[travis-url]: https://travis-ci.org/browserify/acorn-node |
|||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square |
|||
[standard-url]: http://npm.im/standard |
|||
|
|||
## Install |
|||
|
|||
``` |
|||
npm install acorn-node |
|||
``` |
|||
|
|||
## Usage |
|||
|
|||
```js |
|||
var acorn = require('acorn-node') |
|||
``` |
|||
|
|||
The API is the same as [acorn](https://github.com/acornjs/acorn), but the following syntax features are enabled by default: |
|||
|
|||
- Bigint syntax `10n` |
|||
- Numeric separators syntax `10_000` |
|||
- Public and private class instance fields |
|||
- Public and private class static fields |
|||
- Dynamic `import()` |
|||
- The `import.meta` property |
|||
- `export * as ns from` syntax |
|||
|
|||
And the following options have different defaults from acorn, to match Node modules: |
|||
|
|||
- `ecmaVersion: 2019` |
|||
- `allowHashBang: true` |
|||
- `allowReturnOutsideFunction: true` |
|||
|
|||
```js |
|||
var walk = require('acorn-node/walk') |
|||
``` |
|||
|
|||
The Acorn syntax tree walker. Comes preconfigured for the syntax plugins if necessary. |
|||
See the [acorn documentation](https://github.com/acornjs/acorn#distwalkjs) for details. |
|||
|
|||
## License |
|||
|
|||
The files in the repo root and the ./test folder are licensed as [Apache-2.0](LICENSE.md). |
|||
|
|||
The files in lib/ are generated from other packages: |
|||
|
|||
- lib/bigint: [acorn-bigint](https://github.com/acornjs/acorn-bigint]), MIT |
|||
- lib/class-private-elements: [acorn-class-private-elements](https://github.com/acornjs/acorn-class-private-elements), MIT |
|||
- lib/dynamic-import: [acorn-dynamic-import](https://github.com/acornjs/acorn-dynamic-import), MIT |
|||
- lib/export-ns-from: [acorn-export-ns-from](https://github.com/acornjs/acorn-export-ns-from), MIT |
|||
- lib/import-meta: [acorn-import-meta](https://github.com/acornjs/acorn-import-meta), MIT |
|||
- lib/numeric-separator: [acorn-numeric-separator](https://github.com/acornjs/acorn-numeric-separator]), MIT |
|||
- lib/static-class-features: [acorn-static-class-features](https://github.com/acornjs/acorn-static-class-features), MIT |
@ -1,36 +0,0 @@ |
|||
var fs = require('fs') |
|||
var path = require('path') |
|||
var mkdirp = require('mkdirp') |
|||
var buble = require('buble') |
|||
|
|||
var HEADER = '/* Generated by `npm run build`, do not edit! */\n\n' |
|||
|
|||
function compile (name, output, fix) { |
|||
console.log(name, '→', output) |
|||
mkdirp.sync(path.dirname(path.join(__dirname, output))) |
|||
var source = fs.readFileSync(require.resolve(name), 'utf8') |
|||
if (fix) source = fix(source) |
|||
var result = buble.transform(source, { |
|||
transforms: { |
|||
dangerousForOf: true |
|||
} |
|||
}) |
|||
fs.writeFileSync(path.join(__dirname, output), HEADER + result.code, 'utf8') |
|||
} |
|||
|
|||
function privateClassElements (str) { |
|||
return str.replace('acorn-private-class-elements', '../private-class-elements') |
|||
} |
|||
|
|||
compile('acorn-bigint', './lib/bigint/index.js') |
|||
compile('acorn-numeric-separator', './lib/numeric-separator/index.js') |
|||
compile('acorn-dynamic-import', './lib/dynamic-import/index.js') |
|||
compile('acorn-import-meta', './lib/import-meta/index.js') |
|||
compile('acorn-export-ns-from', './lib/export-ns-from/index.js') |
|||
compile('acorn-class-fields', './lib/class-fields/index.js', privateClassElements) |
|||
compile('acorn-static-class-features', './lib/static-class-features/index.js', privateClassElements) |
|||
compile('acorn-private-class-elements', './lib/private-class-elements/index.js', function (str) { |
|||
return str.replace('class extends Parser', 'class Parser_ extends Parser') |
|||
// it also works with v7
|
|||
.replace('if (acorn.version.indexOf("6.") != 0 || acorn.version.indexOf("6.0.") == 0) {', 'if (false) {') |
|||
}) |
@ -1,38 +0,0 @@ |
|||
var acorn = require('acorn') |
|||
var xtend = require('xtend') |
|||
|
|||
var CJSParser = acorn.Parser |
|||
.extend(require('./lib/bigint')) |
|||
.extend(require('./lib/class-fields')) |
|||
.extend(require('./lib/static-class-features')) |
|||
.extend(require('./lib/numeric-separator')) |
|||
.extend(require('./lib/dynamic-import').default) |
|||
var ESModulesParser = CJSParser |
|||
.extend(require('./lib/export-ns-from')) |
|||
.extend(require('./lib/import-meta')) |
|||
|
|||
function mapOptions (opts) { |
|||
if (!opts) opts = {} |
|||
return xtend({ |
|||
ecmaVersion: 2020, |
|||
allowHashBang: true, |
|||
allowReturnOutsideFunction: true |
|||
}, opts) |
|||
} |
|||
|
|||
function getParser (opts) { |
|||
if (!opts) opts = {} |
|||
return opts.sourceType === 'module' ? ESModulesParser : CJSParser |
|||
} |
|||
|
|||
module.exports = exports = xtend(acorn, { |
|||
parse: function parse (src, opts) { |
|||
return getParser(opts).parse(src, mapOptions(opts)) |
|||
}, |
|||
parseExpressionAt: function parseExpressionAt (src, offset, opts) { |
|||
return getParser(opts).parseExpressionAt(src, offset, mapOptions(opts)) |
|||
}, |
|||
tokenizer: function tokenizer (src, opts) { |
|||
return getParser(opts).tokenizer(src, mapOptions(opts)) |
|||
} |
|||
}) |
@ -1,71 +0,0 @@ |
|||
/* Generated by `npm run build`, do not edit! */ |
|||
|
|||
"use strict" |
|||
|
|||
var acorn = require("acorn") |
|||
var tt = acorn.tokTypes |
|||
var isIdentifierStart = acorn.isIdentifierStart |
|||
|
|||
module.exports = function(Parser) { |
|||
return /*@__PURE__*/(function (Parser) { |
|||
function anonymous () { |
|||
Parser.apply(this, arguments); |
|||
} |
|||
|
|||
if ( Parser ) anonymous.__proto__ = Parser; |
|||
anonymous.prototype = Object.create( Parser && Parser.prototype ); |
|||
anonymous.prototype.constructor = anonymous; |
|||
|
|||
anonymous.prototype.parseLiteral = function parseLiteral (value) { |
|||
var node = Parser.prototype.parseLiteral.call(this, value) |
|||
if (node.raw.charCodeAt(node.raw.length - 1) == 110) { node.bigint = this.getNumberInput(node.start, node.end) } |
|||
return node |
|||
}; |
|||
|
|||
anonymous.prototype.readRadixNumber = function readRadixNumber (radix) { |
|||
var start = this.pos |
|||
this.pos += 2 // 0x
|
|||
var val = this.readInt(radix) |
|||
if (val === null) { this.raise(this.start + 2, ("Expected number in radix " + radix)) } |
|||
if (this.input.charCodeAt(this.pos) == 110) { |
|||
var str = this.getNumberInput(start, this.pos) |
|||
val = typeof BigInt !== "undefined" ? BigInt(str) : null |
|||
++this.pos |
|||
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number") } |
|||
return this.finishToken(tt.num, val) |
|||
}; |
|||
|
|||
anonymous.prototype.readNumber = function readNumber (startsWithDot) { |
|||
var start = this.pos |
|||
|
|||
// Not an int
|
|||
if (startsWithDot) { return Parser.prototype.readNumber.call(this, startsWithDot) } |
|||
|
|||
// Legacy octal
|
|||
if (this.input.charCodeAt(start) === 48 && this.input.charCodeAt(start + 1) !== 110) { |
|||
return Parser.prototype.readNumber.call(this, startsWithDot) |
|||
} |
|||
|
|||
if (this.readInt(10) === null) { this.raise(start, "Invalid number") } |
|||
|
|||
// Not a BigInt, reset and parse again
|
|||
if (this.input.charCodeAt(this.pos) != 110) { |
|||
this.pos = start |
|||
return Parser.prototype.readNumber.call(this, startsWithDot) |
|||
} |
|||
|
|||
var str = this.getNumberInput(start, this.pos) |
|||
var val = typeof BigInt !== "undefined" ? BigInt(str) : null |
|||
++this.pos |
|||
return this.finishToken(tt.num, val) |
|||
}; |
|||
|
|||
// This is basically a hook for acorn-numeric-separator
|
|||
anonymous.prototype.getNumberInput = function getNumberInput (start, end) { |
|||
if (Parser.prototype.getNumberInput) { return Parser.prototype.getNumberInput.call(this, start, end) } |
|||
return this.input.slice(start, end) |
|||
}; |
|||
|
|||
return anonymous; |
|||
}(Parser)) |
|||
} |
@ -1,70 +0,0 @@ |
|||
/* Generated by `npm run build`, do not edit! */ |
|||
|
|||
"use strict" |
|||
|
|||
var acorn = require("acorn") |
|||
var tt = acorn.tokTypes |
|||
var privateClassElements = require("../private-class-elements") |
|||
|
|||
function maybeParseFieldValue(field) { |
|||
if (this.eat(tt.eq)) { |
|||
var oldInFieldValue = this._inFieldValue |
|||
this._inFieldValue = true |
|||
field.value = this.parseExpression() |
|||
this._inFieldValue = oldInFieldValue |
|||
} else { field.value = null } |
|||
} |
|||
|
|||
module.exports = function(Parser) { |
|||
Parser = privateClassElements(Parser) |
|||
return /*@__PURE__*/(function (Parser) { |
|||
function anonymous () { |
|||
Parser.apply(this, arguments); |
|||
} |
|||
|
|||
if ( Parser ) anonymous.__proto__ = Parser; |
|||
anonymous.prototype = Object.create( Parser && Parser.prototype ); |
|||
anonymous.prototype.constructor = anonymous; |
|||
|
|||
anonymous.prototype.parseClassElement = function parseClassElement (_constructorAllowsSuper) { |
|||
if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type == this.privateNameToken || this.type == tt.bracketL || this.type == tt.string)) { |
|||
var branch = this._branch() |
|||
if (branch.type == tt.bracketL) { |
|||
var count = 0 |
|||
do { |
|||
if (branch.eat(tt.bracketL)) { ++count } |
|||
else if (branch.eat(tt.bracketR)) { --count } |
|||
else { branch.next() } |
|||
} while (count > 0) |
|||
} else { branch.next() } |
|||
if (branch.type == tt.eq || branch.canInsertSemicolon() || branch.type == tt.semi) { |
|||
var node = this.startNode() |
|||
if (this.type == this.privateNameToken) { |
|||
this.parsePrivateClassElementName(node) |
|||
} else { |
|||
this.parsePropertyName(node) |
|||
} |
|||
if ((node.key.type === "Identifier" && node.key.name === "constructor") || |
|||
(node.key.type === "Literal" && node.key.value === "constructor")) { |
|||
this.raise(node.key.start, "Classes may not have a field called constructor") |
|||
} |
|||
maybeParseFieldValue.call(this, node) |
|||
this.finishNode(node, "FieldDefinition") |
|||
this.semicolon() |
|||
return node |
|||
} |
|||
} |
|||
|
|||
return Parser.prototype.parseClassElement.apply(this, arguments) |
|||
}; |
|||
|
|||
// Prohibit arguments in class field initializers
|
|||
anonymous.prototype.parseIdent = function parseIdent (liberal, isBinding) { |
|||
var ident = Parser.prototype.parseIdent.call(this, liberal, isBinding) |
|||
if (this._inFieldValue && ident.name == "arguments") { this.raise(ident.start, "A class field initializer may not contain arguments") } |
|||
return ident |
|||
}; |
|||
|
|||
return anonymous; |
|||
}(Parser)) |
|||
} |
@ -1,86 +0,0 @@ |
|||
/* Generated by `npm run build`, do not edit! */ |
|||
|
|||
'use strict'; |
|||
|
|||
Object.defineProperty(exports, "__esModule", { |
|||
value: true |
|||
}); |
|||
exports.DynamicImportKey = undefined; |
|||
|
|||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); |
|||
|
|||
var _get = function () { |
|||
function get(object, property, receiver) { if (object === null) { object = Function.prototype; } var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } |
|||
|
|||
return get; |
|||
}(); |
|||
|
|||
exports['default'] = dynamicImport; |
|||
|
|||
var _acorn = require('acorn'); |
|||
|
|||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|||
|
|||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } |
|||
|
|||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) { Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } } /* eslint-disable no-underscore-dangle */ |
|||
|
|||
|
|||
var DynamicImportKey = exports.DynamicImportKey = 'Import'; |
|||
|
|||
// NOTE: This allows `yield import()` to parse correctly.
|
|||
_acorn.tokTypes._import.startsExpr = true; |
|||
|
|||
function parseDynamicImport() { |
|||
var node = this.startNode(); |
|||
this.next(); |
|||
if (this.type !== _acorn.tokTypes.parenL) { |
|||
this.unexpected(); |
|||
} |
|||
return this.finishNode(node, DynamicImportKey); |
|||
} |
|||
|
|||
function parenAfter() { |
|||
return (/^(\s|\/\/.*|\/\*[^]*?\*\/)*\(/.test(this.input.slice(this.pos)) |
|||
); |
|||
} |
|||
|
|||
function dynamicImport(Parser) { |
|||
return function (_Parser) { |
|||
_inherits(_class, _Parser); |
|||
|
|||
function _class() { |
|||
_classCallCheck(this, _class); |
|||
|
|||
return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments)); |
|||
} |
|||
|
|||
_createClass(_class, [{ |
|||
key: 'parseStatement', |
|||
value: function () { |
|||
function parseStatement(context, topLevel, exports) { |
|||
if (this.type === _acorn.tokTypes._import && parenAfter.call(this)) { |
|||
return this.parseExpressionStatement(this.startNode(), this.parseExpression()); |
|||
} |
|||
return _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'parseStatement', this).call(this, context, topLevel, exports); |
|||
} |
|||
|
|||
return parseStatement; |
|||
}() |
|||
}, { |
|||
key: 'parseExprAtom', |
|||
value: function () { |
|||
function parseExprAtom(refDestructuringErrors) { |
|||
if (this.type === _acorn.tokTypes._import) { |
|||
return parseDynamicImport.call(this); |
|||
} |
|||
return _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'parseExprAtom', this).call(this, refDestructuringErrors); |
|||
} |
|||
|
|||
return parseExprAtom; |
|||
}() |
|||
}]); |
|||
|
|||
return _class; |
|||
}(Parser); |
|||
} |
@ -1,43 +0,0 @@ |
|||
/* Generated by `npm run build`, do not edit! */ |
|||
|
|||
"use strict" |
|||
|
|||
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g |
|||
|
|||
var tt = require("acorn").tokTypes |
|||
|
|||
module.exports = function(Parser) { |
|||
return /*@__PURE__*/(function (Parser) { |
|||
function anonymous () { |
|||
Parser.apply(this, arguments); |
|||
} |
|||
|
|||
if ( Parser ) anonymous.__proto__ = Parser; |
|||
anonymous.prototype = Object.create( Parser && Parser.prototype ); |
|||
anonymous.prototype.constructor = anonymous; |
|||
|
|||
anonymous.prototype.parseExport = function parseExport (node, exports) { |
|||
skipWhiteSpace.lastIndex = this.pos |
|||
var skip = skipWhiteSpace.exec(this.input) |
|||
var next = this.input.charAt(this.pos + skip[0].length) |
|||
if (next !== "*") { return Parser.prototype.parseExport.call(this, node, exports) } |
|||
|
|||
this.next() |
|||
var specifier = this.startNode() |
|||
this.expect(tt.star) |
|||
if (this.eatContextual("as")) { |
|||
node.declaration = null |
|||
specifier.exported = this.parseIdent(true) |
|||
this.checkExport(exports, specifier.exported.name, this.lastTokStart) |
|||
node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")] |
|||
} |
|||
this.expectContextual("from") |
|||
if (this.type !== tt.string) { this.unexpected() } |
|||
node.source = this.parseExprAtom() |
|||
this.semicolon() |
|||
return this.finishNode(node, node.specifiers ? "ExportNamedDeclaration" : "ExportAllDeclaration") |
|||
}; |
|||
|
|||
return anonymous; |
|||
}(Parser)) |
|||
} |
@ -1,55 +0,0 @@ |
|||
/* Generated by `npm run build`, do not edit! */ |
|||
|
|||
"use strict" |
|||
|
|||
var tt = require("acorn").tokTypes |
|||
|
|||
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g |
|||
|
|||
var nextTokenIsDot = function (parser) { |
|||
skipWhiteSpace.lastIndex = parser.pos |
|||
var skip = skipWhiteSpace.exec(parser.input) |
|||
var next = parser.pos + skip[0].length |
|||
return parser.input.slice(next, next + 1) === "." |
|||
} |
|||
|
|||
module.exports = function(Parser) { |
|||
return /*@__PURE__*/(function (Parser) { |
|||
function anonymous () { |
|||
Parser.apply(this, arguments); |
|||
} |
|||
|
|||
if ( Parser ) anonymous.__proto__ = Parser; |
|||
anonymous.prototype = Object.create( Parser && Parser.prototype ); |
|||
anonymous.prototype.constructor = anonymous; |
|||
|
|||
anonymous.prototype.parseExprAtom = function parseExprAtom (refDestructuringErrors) { |
|||
if (this.type !== tt._import || !nextTokenIsDot(this)) { return Parser.prototype.parseExprAtom.call(this, refDestructuringErrors) } |
|||
|
|||
if (!this.options.allowImportExportEverywhere && !this.inModule) { |
|||
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'") |
|||
} |
|||
|
|||
var node = this.startNode() |
|||
node.meta = this.parseIdent(true) |
|||
this.expect(tt.dot) |
|||
node.property = this.parseIdent(true) |
|||
if (node.property.name !== "meta") { |
|||
this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta") |
|||
} |
|||
return this.finishNode(node, "MetaProperty") |
|||
}; |
|||
|
|||
anonymous.prototype.parseStatement = function parseStatement (context, topLevel, exports) { |
|||
if (this.type !== tt._import || !nextTokenIsDot(this)) { |
|||
return Parser.prototype.parseStatement.call(this, context, topLevel, exports) |
|||
} |
|||
|
|||
var node = this.startNode() |
|||
var expr = this.parseExpression() |
|||
return this.parseExpressionStatement(node, expr) |
|||
}; |
|||
|
|||
return anonymous; |
|||
}(Parser)) |
|||
} |
@ -1,61 +0,0 @@ |
|||
/* Generated by `npm run build`, do not edit! */ |
|||
|
|||
"use strict" |
|||
|
|||
module.exports = function(Parser) { |
|||
return /*@__PURE__*/(function (Parser) { |
|||
function anonymous () { |
|||
Parser.apply(this, arguments); |
|||
} |
|||
|
|||
if ( Parser ) anonymous.__proto__ = Parser; |
|||
anonymous.prototype = Object.create( Parser && Parser.prototype ); |
|||
anonymous.prototype.constructor = anonymous; |
|||
|
|||
anonymous.prototype.readInt = function readInt (radix, len) { |
|||
// Hack: len is only != null for unicode escape sequences,
|
|||
// where numeric separators are not allowed
|
|||
if (len != null) { return Parser.prototype.readInt.call(this, radix, len) } |
|||
|
|||
var start = this.pos, total = 0, acceptUnderscore = false |
|||
for (;;) { |
|||
var code = this.input.charCodeAt(this.pos), val = (void 0) |
|||
if (code >= 97) { val = code - 97 + 10 } // a
|
|||
else if (code == 95) { |
|||
if (!acceptUnderscore) { this.raise(this.pos, "Invalid numeric separator") } |
|||
++this.pos |
|||
acceptUnderscore = false |
|||
continue |
|||
} else if (code >= 65) { val = code - 65 + 10 } // A
|
|||
else if (code >= 48 && code <= 57) { val = code - 48 } // 0-9
|
|||
else { val = Infinity } |
|||
if (val >= radix) { break } |
|||
++this.pos |
|||
total = total * radix + val |
|||
acceptUnderscore = true |
|||
} |
|||
if (this.pos === start) { return null } |
|||
if (!acceptUnderscore) { this.raise(this.pos - 1, "Invalid numeric separator") } |
|||
|
|||
return total |
|||
}; |
|||
|
|||
anonymous.prototype.readNumber = function readNumber (startsWithDot) { |
|||
var token = Parser.prototype.readNumber.call(this, startsWithDot) |
|||
var octal = this.end - this.start >= 2 && this.input.charCodeAt(this.start) === 48 |
|||
var stripped = this.getNumberInput(this.start, this.end) |
|||
if (stripped.length < this.end - this.start) { |
|||
if (octal) { this.raise(this.start, "Invalid number") } |
|||
this.value = parseFloat(stripped) |
|||
} |
|||
return token |
|||
}; |
|||
|
|||
// This is used by acorn-bigint
|
|||
anonymous.prototype.getNumberInput = function getNumberInput (start, end) { |
|||
return this.input.slice(start, end).replace(/_/g, "") |
|||
}; |
|||
|
|||
return anonymous; |
|||
}(Parser)) |
|||
} |
@ -1,135 +0,0 @@ |
|||
/* Generated by `npm run build`, do not edit! */ |
|||
|
|||
"use strict" |
|||
|
|||
var acorn = require("acorn") |
|||
if (false) { |
|||
throw new Error(("acorn-private-class-elements requires acorn@^6.1.0, not " + (acorn.version))) |
|||
} |
|||
var tt = acorn.tokTypes |
|||
var TokenType = acorn.TokenType |
|||
|
|||
module.exports = function(Parser) { |
|||
// Only load this plugin once.
|
|||
if (Parser.prototype.parsePrivateName) { |
|||
return Parser |
|||
} |
|||
|
|||
// Make sure `Parser` comes from the same acorn as our `tt`,
|
|||
// otherwise the comparisons fail.
|
|||
var cur = Parser |
|||
while (cur && cur !== acorn.Parser) { |
|||
cur = cur.__proto__ |
|||
} |
|||
if (cur !== acorn.Parser) { |
|||
throw new Error("acorn-private-class-elements does not support mixing different acorn copies") |
|||
} |
|||
|
|||
Parser = /*@__PURE__*/(function (Parser) { |
|||
function Parser_ () { |
|||
Parser.apply(this, arguments); |
|||
} |
|||
|
|||
if ( Parser ) Parser_.__proto__ = Parser; |
|||
Parser_.prototype = Object.create( Parser && Parser.prototype ); |
|||
Parser_.prototype.constructor = Parser_; |
|||
|
|||
Parser_.prototype._branch = function _branch () { |
|||
this.__branch = this.__branch || new Parser({ecmaVersion: this.options.ecmaVersion}, this.input) |
|||
this.__branch.end = this.end |
|||
this.__branch.pos = this.pos |
|||
this.__branch.type = this.type |
|||
this.__branch.value = this.value |
|||
this.__branch.containsEsc = this.containsEsc |
|||
return this.__branch |
|||
}; |
|||
|
|||
Parser_.prototype.parsePrivateClassElementName = function parsePrivateClassElementName (element) { |
|||
element.computed = false |
|||
element.key = this.parsePrivateName() |
|||
if (element.key.name == "constructor") { this.raise(element.key.start, "Classes may not have a private element named constructor") } |
|||
var accept = {get: "set", set: "get"}[element.kind] |
|||
var privateBoundNames = this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1] |
|||
if (Object.prototype.hasOwnProperty.call(privateBoundNames, element.key.name) && privateBoundNames[element.key.name] !== accept) { |
|||
this.raise(element.start, "Duplicate private element") |
|||
} |
|||
privateBoundNames[element.key.name] = element.kind || true |
|||
delete this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1][element.key.name] |
|||
return element.key |
|||
}; |
|||
|
|||
Parser_.prototype.parsePrivateName = function parsePrivateName () { |
|||
var node = this.startNode() |
|||
node.name = this.value |
|||
this.next() |
|||
this.finishNode(node, "PrivateName") |
|||
if (this.options.allowReserved == "never") { this.checkUnreserved(node) } |
|||
return node |
|||
}; |
|||
|
|||
// Parse # token
|
|||
Parser_.prototype.getTokenFromCode = function getTokenFromCode (code) { |
|||
if (code === 35) { |
|||
++this.pos |
|||
var word = this.readWord1() |
|||
return this.finishToken(this.privateNameToken, word) |
|||
} |
|||
return Parser.prototype.getTokenFromCode.call(this, code) |
|||
}; |
|||
|
|||
// Manage stacks and check for undeclared private names
|
|||
Parser_.prototype.parseClass = function parseClass (node, isStatement) { |
|||
this._privateBoundNamesStack = this._privateBoundNamesStack || [] |
|||
var privateBoundNames = Object.create(this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1] || null) |
|||
this._privateBoundNamesStack.push(privateBoundNames) |
|||
this._unresolvedPrivateNamesStack = this._unresolvedPrivateNamesStack || [] |
|||
var unresolvedPrivateNames = Object.create(null) |
|||
this._unresolvedPrivateNamesStack.push(unresolvedPrivateNames) |
|||
var _return = Parser.prototype.parseClass.call(this, node, isStatement) |
|||
this._privateBoundNamesStack.pop() |
|||
this._unresolvedPrivateNamesStack.pop() |
|||
if (!this._unresolvedPrivateNamesStack.length) { |
|||
var names = Object.keys(unresolvedPrivateNames) |
|||
if (names.length) { |
|||
names.sort(function (n1, n2) { return unresolvedPrivateNames[n1] - unresolvedPrivateNames[n2]; }) |
|||
this.raise(unresolvedPrivateNames[names[0]], "Usage of undeclared private name") |
|||
} |
|||
} else { Object.assign(this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1], unresolvedPrivateNames) } |
|||
return _return |
|||
}; |
|||
|
|||
// Parse private element access
|
|||
Parser_.prototype.parseSubscript = function parseSubscript (base, startPos, startLoc, noCalls, maybeAsyncArrow) { |
|||
if (!this.eat(tt.dot)) { |
|||
return Parser.prototype.parseSubscript.call(this, base, startPos, startLoc, noCalls, maybeAsyncArrow) |
|||
} |
|||
var node = this.startNodeAt(startPos, startLoc) |
|||
node.object = base |
|||
node.computed = false |
|||
if (this.type == this.privateNameToken) { |
|||
node.property = this.parsePrivateName() |
|||
if (!this._privateBoundNamesStack.length || !this._privateBoundNamesStack[this._privateBoundNamesStack.length - 1][node.property.name]) { |
|||
this._unresolvedPrivateNamesStack[this._unresolvedPrivateNamesStack.length - 1][node.property.name] = node.property.start |
|||
} |
|||
} else { |
|||
node.property = this.parseIdent(true) |
|||
} |
|||
return this.finishNode(node, "MemberExpression") |
|||
}; |
|||
|
|||
// Prohibit delete of private class elements
|
|||
Parser_.prototype.parseMaybeUnary = function parseMaybeUnary (refDestructuringErrors, sawUnary) { |
|||
var _return = Parser.prototype.parseMaybeUnary.call(this, refDestructuringErrors, sawUnary) |
|||
if (_return.operator == "delete") { |
|||
if (_return.argument.type == "MemberExpression" && _return.argument.property.type == "PrivateName") { |
|||
this.raise(_return.start, "Private elements may not be deleted") |
|||
} |
|||
} |
|||
return _return |
|||
}; |
|||
|
|||
return Parser_; |
|||
}(Parser)) |
|||
Parser.prototype.privateNameToken = new TokenType("privateName") |
|||
return Parser |
|||
} |
@ -1,139 +0,0 @@ |
|||
/* Generated by `npm run build`, do not edit! */ |
|||
|
|||
"use strict" |
|||
|
|||
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g |
|||
|
|||
var acorn = require("acorn") |
|||
var tt = acorn.tokTypes |
|||
|
|||
function maybeParseFieldValue(field) { |
|||
if (this.eat(tt.eq)) { |
|||
var oldInFieldValue = this._inStaticFieldValue |
|||
this._inStaticFieldValue = true |
|||
field.value = this.parseExpression() |
|||
this._inStaticFieldValue = oldInFieldValue |
|||
} else { field.value = null } |
|||
} |
|||
|
|||
var privateClassElements = require("../private-class-elements") |
|||
|
|||
module.exports = function(Parser) { |
|||
var ExtendedParser = privateClassElements(Parser) |
|||
|
|||
return /*@__PURE__*/(function (ExtendedParser) { |
|||
function anonymous () { |
|||
ExtendedParser.apply(this, arguments); |
|||
} |
|||
|
|||
if ( ExtendedParser ) anonymous.__proto__ = ExtendedParser; |
|||
anonymous.prototype = Object.create( ExtendedParser && ExtendedParser.prototype ); |
|||
anonymous.prototype.constructor = anonymous; |
|||
|
|||
anonymous.prototype.parseClassElement = function parseClassElement (_constructorAllowsSuper) { |
|||
var this$1 = this; |
|||
|
|||
if (this.eat(tt.semi)) { return null } |
|||
|
|||
var node = this.startNode() |
|||
|
|||
var tryContextual = function (k, noLineBreak) { |
|||
if (typeof noLineBreak == "undefined") { noLineBreak = false } |
|||
var start = this$1.start, startLoc = this$1.startLoc |
|||
if (!this$1.eatContextual(k)) { return false } |
|||
if (this$1.type !== tt.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true } |
|||
if (node.key) { this$1.unexpected() } |
|||
node.computed = false |
|||
node.key = this$1.startNodeAt(start, startLoc) |
|||
node.key.name = k |
|||
this$1.finishNode(node.key, "Identifier") |
|||
return false |
|||
} |
|||
|
|||
node.static = tryContextual("static") |
|||
if (!node.static) { return ExtendedParser.prototype.parseClassElement.apply(this, arguments) } |
|||
|
|||
var isGenerator = this.eat(tt.star) |
|||
var isAsync = false |
|||
if (!isGenerator) { |
|||
// Special-case for `async`, since `parseClassMember` currently looks
|
|||
// for `(` to determine whether `async` is a method name
|
|||
if (this.options.ecmaVersion >= 8 && this.isContextual("async")) { |
|||
skipWhiteSpace.lastIndex = this.pos |
|||
var skip = skipWhiteSpace.exec(this.input) |
|||
var next = this.input.charAt(this.pos + skip[0].length) |
|||
if (next === ";" || next === "=") { |
|||
node.key = this.parseIdent(true) |
|||
node.computed = false |
|||
maybeParseFieldValue.call(this, node) |
|||
this.finishNode(node, "FieldDefinition") |
|||
this.semicolon() |
|||
return node |
|||
} else if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) { |
|||
isAsync = true |
|||
isGenerator = this.options.ecmaVersion >= 9 && this.eat(tt.star) |
|||
} |
|||
} else if (tryContextual("get")) { |
|||
node.kind = "get" |
|||
} else if (tryContextual("set")) { |
|||
node.kind = "set" |
|||
} |
|||
} |
|||
if (this.type === this.privateNameToken) { |
|||
this.parsePrivateClassElementName(node) |
|||
if (this.type !== tt.parenL) { |
|||
if (node.key.name === "prototype") { |
|||
this.raise(node.key.start, "Classes may not have a private static property named prototype") |
|||
} |
|||
maybeParseFieldValue.call(this, node) |
|||
this.finishNode(node, "FieldDefinition") |
|||
this.semicolon() |
|||
return node |
|||
} |
|||
} else if (!node.key) { |
|||
this.parsePropertyName(node) |
|||
if ((node.key.name || node.key.value) === "prototype" && !node.computed) { |
|||
this.raise(node.key.start, "Classes may not have a static property named prototype") |
|||
} |
|||
} |
|||
if (!node.kind) { node.kind = "method" } |
|||
this.parseClassMethod(node, isGenerator, isAsync) |
|||
if (!node.kind && (node.key.name || node.key.value) === "constructor" && !node.computed) { |
|||
this.raise(node.key.start, "Classes may not have a static field named constructor") |
|||
} |
|||
if (node.kind === "get" && node.value.params.length !== 0) { |
|||
this.raiseRecoverable(node.value.start, "getter should have no params") |
|||
} |
|||
if (node.kind === "set" && node.value.params.length !== 1) { |
|||
this.raiseRecoverable(node.value.start, "setter should have exactly one param") |
|||
} |
|||
if (node.kind === "set" && node.value.params[0].type === "RestElement") { |
|||
this.raiseRecoverable(node.value.params[0].start, "Setter cannot use rest params") |
|||
} |
|||
|
|||
return node |
|||
|
|||
}; |
|||
|
|||
// Parse public static fields
|
|||
anonymous.prototype.parseClassMethod = function parseClassMethod (method, isGenerator, isAsync, _allowsDirectSuper) { |
|||
if (isGenerator || isAsync || method.kind != "method" || !method.static || this.options.ecmaVersion < 8 || this.type == tt.parenL) { |
|||
return ExtendedParser.prototype.parseClassMethod.apply(this, arguments) |
|||
} |
|||
maybeParseFieldValue.call(this, method) |
|||
delete method.kind |
|||
method = this.finishNode(method, "FieldDefinition") |
|||
this.semicolon() |
|||
return method |
|||
}; |
|||
|
|||
// Prohibit arguments in class field initializers
|
|||
anonymous.prototype.parseIdent = function parseIdent (liberal, isBinding) { |
|||
var ident = ExtendedParser.prototype.parseIdent.call(this, liberal, isBinding) |
|||
if (this._inStaticFieldValue && ident.name == "arguments") { this.raise(ident.start, "A static class field initializer may not contain arguments") } |
|||
return ident |
|||
}; |
|||
|
|||
return anonymous; |
|||
}(ExtendedParser)) |
|||
} |
@ -1,51 +0,0 @@ |
|||
{ |
|||
"name": "acorn-node", |
|||
"description": "the acorn javascript parser, preloaded with plugins for syntax parity with recent node versions", |
|||
"version": "1.8.2", |
|||
"author": "Renée Kooi <renee@kooi.me>", |
|||
"bugs": { |
|||
"url": "https://github.com/browserify/acorn-node/issues" |
|||
}, |
|||
"dependencies": { |
|||
"acorn": "^7.0.0", |
|||
"acorn-walk": "^7.0.0", |
|||
"xtend": "^4.0.2" |
|||
}, |
|||
"devDependencies": { |
|||
"acorn-bigint": "^0.4.0", |
|||
"acorn-class-fields": "^0.3.1", |
|||
"acorn-dynamic-import": "^4.0.0", |
|||
"acorn-export-ns-from": "^0.1.0", |
|||
"acorn-import-meta": "^0.3.0", |
|||
"acorn-numeric-separator": "^0.3.0", |
|||
"acorn-private-class-elements": "^0.1.1", |
|||
"acorn-static-class-features": "^0.2.0", |
|||
"buble": "^0.19.8", |
|||
"mkdirp": "^0.5.1", |
|||
"standard": "^13.1.0", |
|||
"tape": "^4.11.0" |
|||
}, |
|||
"homepage": "https://github.com/browserify/acorn-node", |
|||
"keywords": [ |
|||
"acorn", |
|||
"browserify", |
|||
"javascript", |
|||
"parser" |
|||
], |
|||
"license": "Apache-2.0", |
|||
"main": "index.js", |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "https://github.com/browserify/acorn-node.git" |
|||
}, |
|||
"scripts": { |
|||
"test": "standard && node test/index.js", |
|||
"prepublishOnly": "npm run build", |
|||
"build": "node build.js" |
|||
}, |
|||
"standard": { |
|||
"ignore": [ |
|||
"lib/*/*.js" |
|||
] |
|||
} |
|||
} |
@ -1,154 +0,0 @@ |
|||
var test = require('tape') |
|||
var acorn = require('../') |
|||
var walk = require('../walk') |
|||
var baseAcorn = require('acorn') |
|||
|
|||
test('parses object spread syntax', function (t) { |
|||
var ast = acorn.parse('var a = { ...b }') |
|||
t.equal(ast.body[0].declarations[0].init.type, 'ObjectExpression') |
|||
t.equal(ast.body[0].declarations[0].init.properties[0].type, 'SpreadElement') |
|||
|
|||
ast = acorn.parse('function a ({ ...b }) {}') |
|||
t.equal(ast.body[0].params[0].type, 'ObjectPattern') |
|||
t.equal(ast.body[0].params[0].properties[0].type, 'RestElement') |
|||
|
|||
t.end() |
|||
}) |
|||
|
|||
test('does not change main acorn module', function (t) { |
|||
t.throws(function () { |
|||
baseAcorn.parse('var a = 10n') |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('tokenizes object spread syntax', function (t) { |
|||
var tokenizer = acorn.tokenizer('var a = { ...b }') |
|||
|
|||
t.doesNotThrow(function (t) { |
|||
while (tokenizer.getToken().type !== acorn.tokTypes.eof) {} |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('allows hashbangs by default', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('#!/usr/bin/env node\nconsole.log("ok")') |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('allows top level return by default', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('console.log("ok"); return; console.log("not ok")') |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports async generators', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('async function* a () { await x; yield 1 }') |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports async iteration', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('async function l (y) { for await (const x of y) {} }') |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports optional catch', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('try { throw null } catch {}') |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports bigint', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('50n ** 50n') |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports numeric separators', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('50_000_000n ** 1n') |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports import.meta with sourceType: module', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('console.log(import.meta.url)', { sourceType: 'module' }) |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports dynamic import() with sourceType: module', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('import("./whatever.mjs")', { sourceType: 'module' }) |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports dynamic import() with sourceType: script', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('import("./whatever.mjs")', { sourceType: 'script' }) |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports class instance properties', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('class X { x = y }', { sourceType: 'script' }) |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports private class instance properties', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('class X { #x = y }', { sourceType: 'script' }) |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports class static properties', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('class X { static x = y }', { sourceType: 'script' }) |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports private class static properties', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('class X { static #x = y }', { sourceType: 'script' }) |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('supports namespace export syntax with sourceType: module', function (t) { |
|||
t.doesNotThrow(function () { |
|||
acorn.parse('export * as x from "./x.mjs";', { sourceType: 'module' }) |
|||
}) |
|||
t.end() |
|||
}) |
|||
|
|||
test('walk supports plugin syntax', function (t) { |
|||
var ast = acorn.parse( |
|||
'async function* a() { try { await import(xyz); } catch { for await (x of null) {} } yield import.meta.url }', |
|||
{ sourceType: 'module' } |
|||
) |
|||
t.plan(2) |
|||
walk.simple(ast, { |
|||
Import: function () { |
|||
t.pass('import()') |
|||
}, |
|||
MetaProperty: function () { |
|||
t.pass('import.meta') |
|||
} |
|||
}) |
|||
t.end() |
|||
}) |
@ -1,57 +0,0 @@ |
|||
var xtend = require('xtend') |
|||
var walk = require('acorn-walk') |
|||
|
|||
var base = xtend(walk.base) |
|||
base.Import = function () {} |
|||
|
|||
function simple (node, visitors, baseVisitor, state, override) { |
|||
return walk.simple(node, visitors, baseVisitor || base, state, override) |
|||
} |
|||
|
|||
function ancestor (node, visitors, baseVisitor, state) { |
|||
return walk.ancestor(node, visitors, baseVisitor || base, state) |
|||
} |
|||
|
|||
function recursive (node, state, funcs, baseVisitor, override) { |
|||
return walk.recursive(node, state, funcs, baseVisitor || base, override) |
|||
} |
|||
|
|||
function full (node, callback, baseVisitor, state, override) { |
|||
return walk.full(node, callback, baseVisitor || base, state, override) |
|||
} |
|||
|
|||
function fullAncestor (node, callback, baseVisitor, state) { |
|||
return walk.fullAncestor(node, callback, baseVisitor || base, state) |
|||
} |
|||
|
|||
function findNodeAt (node, start, end, test, baseVisitor, state) { |
|||
return walk.findNodeAt(node, start, end, test, baseVisitor || base, state) |
|||
} |
|||
|
|||
function findNodeAround (node, pos, test, baseVisitor, state) { |
|||
return walk.findNodeAround(node, pos, test, baseVisitor || base, state) |
|||
} |
|||
|
|||
function findNodeAfter (node, pos, test, baseVisitor, state) { |
|||
return walk.findNodeAfter(node, pos, test, baseVisitor || base, state) |
|||
} |
|||
|
|||
function findNodeBefore (node, pos, test, baseVisitor, state) { |
|||
return walk.findNodeBefore(node, pos, test, baseVisitor || base, state) |
|||
} |
|||
|
|||
function make (funcs, baseVisitor) { |
|||
return walk.make(funcs, baseVisitor || base) |
|||
} |
|||
|
|||
exports.simple = simple |
|||
exports.ancestor = ancestor |
|||
exports.recursive = recursive |
|||
exports.full = full |
|||
exports.fullAncestor = fullAncestor |
|||
exports.findNodeAt = findNodeAt |
|||
exports.findNodeAround = findNodeAround |
|||
exports.findNodeAfter = findNodeAfter |
|||
exports.findNodeBefore = findNodeBefore |
|||
exports.make = make |
|||
exports.base = base |
@ -1,131 +0,0 @@ |
|||
## 7.2.0 (2020-06-17) |
|||
|
|||
### New features |
|||
|
|||
Support optional chaining and nullish coalescing. |
|||
|
|||
Support `import.meta`. |
|||
|
|||
Add support for `export * as ns from "source"`. |
|||
|
|||
## 7.1.1 (2020-02-13) |
|||
|
|||
### Bug fixes |
|||
|
|||
Clean up the type definitions to actually work well with the main parser. |
|||
|
|||
## 7.1.0 (2020-02-11) |
|||
|
|||
### New features |
|||
|
|||
Add a TypeScript definition file for the library. |
|||
|
|||
## 7.0.0 (2017-08-12) |
|||
|
|||
### New features |
|||
|
|||
Support walking `ImportExpression` nodes. |
|||
|
|||
## 6.2.0 (2017-07-04) |
|||
|
|||
### New features |
|||
|
|||
Add support for `Import` nodes. |
|||
|
|||
## 6.1.0 (2018-09-28) |
|||
|
|||
### New features |
|||
|
|||
The walker now walks `TemplateElement` nodes. |
|||
|
|||
## 6.0.1 (2018-09-14) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix bad "main" field in package.json. |
|||
|
|||
## 6.0.0 (2018-09-14) |
|||
|
|||
### Breaking changes |
|||
|
|||
This is now a separate package, `acorn-walk`, rather than part of the main `acorn` package. |
|||
|
|||
The `ScopeBody` and `ScopeExpression` meta-node-types are no longer supported. |
|||
|
|||
## 5.7.1 (2018-06-15) |
|||
|
|||
### Bug fixes |
|||
|
|||
Make sure the walker and bin files are rebuilt on release (the previous release didn't get the up-to-date versions). |
|||
|
|||
## 5.7.0 (2018-06-15) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix crash in walker when walking a binding-less catch node. |
|||
|
|||
## 5.6.2 (2018-06-05) |
|||
|
|||
### Bug fixes |
|||
|
|||
In the walker, go back to allowing the `baseVisitor` argument to be null to default to the default base everywhere. |
|||
|
|||
## 5.6.1 (2018-06-01) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix regression when passing `null` as fourth argument to `walk.recursive`. |
|||
|
|||
## 5.6.0 (2018-05-31) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix a bug in the walker that caused a crash when walking an object pattern spread. |
|||
|
|||
## 5.5.1 (2018-03-06) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix regression in walker causing property values in object patterns to be walked as expressions. |
|||
|
|||
## 5.5.0 (2018-02-27) |
|||
|
|||
### Bug fixes |
|||
|
|||
Support object spread in the AST walker. |
|||
|
|||
## 5.4.1 (2018-02-02) |
|||
|
|||
### Bug fixes |
|||
|
|||
5.4.0 somehow accidentally included an old version of walk.js. |
|||
|
|||
## 5.2.0 (2017-10-30) |
|||
|
|||
### Bug fixes |
|||
|
|||
The `full` and `fullAncestor` walkers no longer visit nodes multiple times. |
|||
|
|||
## 5.1.0 (2017-07-05) |
|||
|
|||
### New features |
|||
|
|||
New walker functions `full` and `fullAncestor`. |
|||
|
|||
## 3.2.0 (2016-06-07) |
|||
|
|||
### New features |
|||
|
|||
Make it possible to use `visit.ancestor` with a walk state. |
|||
|
|||
## 3.1.0 (2016-04-18) |
|||
|
|||
### New features |
|||
|
|||
The walker now allows defining handlers for `CatchClause` nodes. |
|||
|
|||
## 2.5.2 (2015-10-27) |
|||
|
|||
### Fixes |
|||
|
|||
Fix bug where the walker walked an exported `let` statement as an expression. |
@ -1,19 +0,0 @@ |
|||
Copyright (C) 2012-2018 by various contributors (see AUTHORS) |
|||
|
|||
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. |
@ -1,126 +0,0 @@ |
|||
# Acorn AST walker |
|||
|
|||
An abstract syntax tree walker for the |
|||
[ESTree](https://github.com/estree/estree) format. |
|||
|
|||
## Community |
|||
|
|||
Acorn is open source software released under an |
|||
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn-walk/LICENSE). |
|||
|
|||
You are welcome to |
|||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull |
|||
requests on [github](https://github.com/acornjs/acorn). For questions |
|||
and discussion, please use the |
|||
[Tern discussion forum](https://discuss.ternjs.net). |
|||
|
|||
## Installation |
|||
|
|||
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/): |
|||
|
|||
```sh |
|||
npm install acorn-walk |
|||
``` |
|||
|
|||
Alternately, you can download the source and build acorn yourself: |
|||
|
|||
```sh |
|||
git clone https://github.com/acornjs/acorn.git |
|||
cd acorn |
|||
npm install |
|||
``` |
|||
|
|||
## Interface |
|||
|
|||
An algorithm for recursing through a syntax tree is stored as an |
|||
object, with a property for each tree node type holding a function |
|||
that will recurse through such a node. There are several ways to run |
|||
such a walker. |
|||
|
|||
**simple**`(node, visitors, base, state)` does a 'simple' walk over a |
|||
tree. `node` should be the AST node to walk, and `visitors` an object |
|||
with properties whose names correspond to node types in the [ESTree |
|||
spec](https://github.com/estree/estree). The properties should contain |
|||
functions that will be called with the node object and, if applicable |
|||
the state at that point. The last two arguments are optional. `base` |
|||
is a walker algorithm, and `state` is a start state. The default |
|||
walker will simply visit all statements and expressions and not |
|||
produce a meaningful state. (An example of a use of state is to track |
|||
scope at each point in the tree.) |
|||
|
|||
```js |
|||
const acorn = require("acorn") |
|||
const walk = require("acorn-walk") |
|||
|
|||
walk.simple(acorn.parse("let x = 10"), { |
|||
Literal(node) { |
|||
console.log(`Found a literal: ${node.value}`) |
|||
} |
|||
}) |
|||
``` |
|||
|
|||
**ancestor**`(node, visitors, base, state)` does a 'simple' walk over |
|||
a tree, building up an array of ancestor nodes (including the current node) |
|||
and passing the array to the callbacks as a third parameter. |
|||
|
|||
```js |
|||
const acorn = require("acorn") |
|||
const walk = require("acorn-walk") |
|||
|
|||
walk.ancestor(acorn.parse("foo('hi')"), { |
|||
Literal(_, ancestors) { |
|||
console.log("This literal's ancestors are:", ancestors.map(n => n.type)) |
|||
} |
|||
}) |
|||
``` |
|||
|
|||
**recursive**`(node, state, functions, base)` does a 'recursive' |
|||
walk, where the walker functions are responsible for continuing the |
|||
walk on the child nodes of their target node. `state` is the start |
|||
state, and `functions` should contain an object that maps node types |
|||
to walker functions. Such functions are called with `(node, state, c)` |
|||
arguments, and can cause the walk to continue on a sub-node by calling |
|||
the `c` argument on it with `(node, state)` arguments. The optional |
|||
`base` argument provides the fallback walker functions for node types |
|||
that aren't handled in the `functions` object. If not given, the |
|||
default walkers will be used. |
|||
|
|||
**make**`(functions, base)` builds a new walker object by using the |
|||
walker functions in `functions` and filling in the missing ones by |
|||
taking defaults from `base`. |
|||
|
|||
**full**`(node, callback, base, state)` does a 'full' walk over a |
|||
tree, calling the callback with the arguments (node, state, type) for |
|||
each node |
|||
|
|||
**fullAncestor**`(node, callback, base, state)` does a 'full' walk |
|||
over a tree, building up an array of ancestor nodes (including the |
|||
current node) and passing the array to the callbacks as a third |
|||
parameter. |
|||
|
|||
```js |
|||
const acorn = require("acorn") |
|||
const walk = require("acorn-walk") |
|||
|
|||
walk.full(acorn.parse("1 + 1"), node => { |
|||
console.log(`There's a ${node.type} node at ${node.ch}`) |
|||
}) |
|||
``` |
|||
|
|||
**findNodeAt**`(node, start, end, test, base, state)` tries to locate |
|||
a node in a tree at the given start and/or end offsets, which |
|||
satisfies the predicate `test`. `start` and `end` can be either `null` |
|||
(as wildcard) or a number. `test` may be a string (indicating a node |
|||
type) or a function that takes `(nodeType, node)` arguments and |
|||
returns a boolean indicating whether this node is interesting. `base` |
|||
and `state` are optional, and can be used to specify a custom walker. |
|||
Nodes are tested from inner to outer, so if two nodes match the |
|||
boundaries, the inner one will be preferred. |
|||
|
|||
**findNodeAround**`(node, pos, test, base, state)` is a lot like |
|||
`findNodeAt`, but will match any node that exists 'around' (spanning) |
|||
the given position. |
|||
|
|||
**findNodeAfter**`(node, pos, test, base, state)` is similar to |
|||
`findNodeAround`, but will match all nodes *after* the given position |
|||
(testing outer nodes before inner nodes). |
@ -1,112 +0,0 @@ |
|||
import {Node} from 'acorn'; |
|||
|
|||
declare module "acorn-walk" { |
|||
type FullWalkerCallback<TState> = ( |
|||
node: Node, |
|||
state: TState, |
|||
type: string |
|||
) => void; |
|||
|
|||
type FullAncestorWalkerCallback<TState> = ( |
|||
node: Node, |
|||
state: TState | Node[], |
|||
ancestors: Node[], |
|||
type: string |
|||
) => void; |
|||
type WalkerCallback<TState> = (node: Node, state: TState) => void; |
|||
|
|||
type SimpleWalkerFn<TState> = ( |
|||
node: Node, |
|||
state: TState |
|||
) => void; |
|||
|
|||
type AncestorWalkerFn<TState> = ( |
|||
node: Node, |
|||
state: TState| Node[], |
|||
ancestors: Node[] |
|||
) => void; |
|||
|
|||
type RecursiveWalkerFn<TState> = ( |
|||
node: Node, |
|||
state: TState, |
|||
callback: WalkerCallback<TState> |
|||
) => void; |
|||
|
|||
type SimpleVisitors<TState> = { |
|||
[type: string]: SimpleWalkerFn<TState> |
|||
}; |
|||
|
|||
type AncestorVisitors<TState> = { |
|||
[type: string]: AncestorWalkerFn<TState> |
|||
}; |
|||
|
|||
type RecursiveVisitors<TState> = { |
|||
[type: string]: RecursiveWalkerFn<TState> |
|||
}; |
|||
|
|||
type FindPredicate = (type: string, node: Node) => boolean; |
|||
|
|||
interface Found<TState> { |
|||
node: Node, |
|||
state: TState |
|||
} |
|||
|
|||
export function simple<TState>( |
|||
node: Node, |
|||
visitors: SimpleVisitors<TState>, |
|||
base?: RecursiveVisitors<TState>, |
|||
state?: TState |
|||
): void; |
|||
|
|||
export function ancestor<TState>( |
|||
node: Node, |
|||
visitors: AncestorVisitors<TState>, |
|||
base?: RecursiveVisitors<TState>, |
|||
state?: TState |
|||
): void; |
|||
|
|||
export function recursive<TState>( |
|||
node: Node, |
|||
state: TState, |
|||
functions: RecursiveVisitors<TState>, |
|||
base?: RecursiveVisitors<TState> |
|||
): void; |
|||
|
|||
export function full<TState>( |
|||
node: Node, |
|||
callback: FullWalkerCallback<TState>, |
|||
base?: RecursiveVisitors<TState>, |
|||
state?: TState |
|||
): void; |
|||
|
|||
export function fullAncestor<TState>( |
|||
node: Node, |
|||
callback: FullAncestorWalkerCallback<TState>, |
|||
base?: RecursiveVisitors<TState>, |
|||
state?: TState |
|||
): void; |
|||
|
|||
export function make<TState>( |
|||
functions: RecursiveVisitors<TState>, |
|||
base?: RecursiveVisitors<TState> |
|||
): RecursiveVisitors<TState>; |
|||
|
|||
export function findNodeAt<TState>( |
|||
node: Node, |
|||
start: number | undefined, |
|||
end?: number | undefined, |
|||
type?: FindPredicate | string, |
|||
base?: RecursiveVisitors<TState>, |
|||
state?: TState |
|||
): Found<TState> | undefined; |
|||
|
|||
export function findNodeAround<TState>( |
|||
node: Node, |
|||
start: number | undefined, |
|||
type?: FindPredicate | string, |
|||
base?: RecursiveVisitors<TState>, |
|||
state?: TState |
|||
): Found<TState> | undefined; |
|||
|
|||
export const findNodeAfter: typeof findNodeAround; |
|||
} |
@ -1,463 +0,0 @@ |
|||
(function (global, factory) { |
|||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
|||
typeof define === 'function' && define.amd ? define(['exports'], factory) : |
|||
(global = global || self, factory((global.acorn = global.acorn || {}, global.acorn.walk = {}))); |
|||
}(this, (function (exports) { 'use strict'; |
|||
|
|||
// AST walker module for Mozilla Parser API compatible trees
|
|||
|
|||
// A simple walk is one where you simply specify callbacks to be
|
|||
// called on specific nodes. The last two arguments are optional. A
|
|||
// simple use would be
|
|||
//
|
|||
// walk.simple(myTree, {
|
|||
// Expression: function(node) { ... }
|
|||
// });
|
|||
//
|
|||
// to do something with all expressions. All Parser API node types
|
|||
// can be used to identify node types, as well as Expression and
|
|||
// Statement, which denote categories of nodes.
|
|||
//
|
|||
// The base argument can be used to pass a custom (recursive)
|
|||
// walker, and state can be used to give this walked an initial
|
|||
// state.
|
|||
|
|||
function simple(node, visitors, baseVisitor, state, override) { |
|||
if (!baseVisitor) { baseVisitor = base |
|||
; }(function c(node, st, override) { |
|||
var type = override || node.type, found = visitors[type]; |
|||
baseVisitor[type](node, st, c); |
|||
if (found) { found(node, st); } |
|||
})(node, state, override); |
|||
} |
|||
|
|||
// An ancestor walk keeps an array of ancestor nodes (including the
|
|||
// current node) and passes them to the callback as third parameter
|
|||
// (and also as state parameter when no other state is present).
|
|||
function ancestor(node, visitors, baseVisitor, state, override) { |
|||
var ancestors = []; |
|||
if (!baseVisitor) { baseVisitor = base |
|||
; }(function c(node, st, override) { |
|||
var type = override || node.type, found = visitors[type]; |
|||
var isNew = node !== ancestors[ancestors.length - 1]; |
|||
if (isNew) { ancestors.push(node); } |
|||
baseVisitor[type](node, st, c); |
|||
if (found) { found(node, st || ancestors, ancestors); } |
|||
if (isNew) { ancestors.pop(); } |
|||
})(node, state, override); |
|||
} |
|||
|
|||
// A recursive walk is one where your functions override the default
|
|||
// walkers. They can modify and replace the state parameter that's
|
|||
// threaded through the walk, and can opt how and whether to walk
|
|||
// their child nodes (by calling their third argument on these
|
|||
// nodes).
|
|||
function recursive(node, state, funcs, baseVisitor, override) { |
|||
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor |
|||
;(function c(node, st, override) { |
|||
visitor[override || node.type](node, st, c); |
|||
})(node, state, override); |
|||
} |
|||
|
|||
function makeTest(test) { |
|||
if (typeof test === "string") |
|||
{ return function (type) { return type === test; } } |
|||
else if (!test) |
|||
{ return function () { return true; } } |
|||
else |
|||
{ return test } |
|||
} |
|||
|
|||
var Found = function Found(node, state) { this.node = node; this.state = state; }; |
|||
|
|||
// A full walk triggers the callback on each node
|
|||
function full(node, callback, baseVisitor, state, override) { |
|||
if (!baseVisitor) { baseVisitor = base |
|||
; }(function c(node, st, override) { |
|||
var type = override || node.type; |
|||
baseVisitor[type](node, st, c); |
|||
if (!override) { callback(node, st, type); } |
|||
})(node, state, override); |
|||
} |
|||
|
|||
// An fullAncestor walk is like an ancestor walk, but triggers
|
|||
// the callback on each node
|
|||
function fullAncestor(node, callback, baseVisitor, state) { |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
var ancestors = [] |
|||
;(function c(node, st, override) { |
|||
var type = override || node.type; |
|||
var isNew = node !== ancestors[ancestors.length - 1]; |
|||
if (isNew) { ancestors.push(node); } |
|||
baseVisitor[type](node, st, c); |
|||
if (!override) { callback(node, st || ancestors, ancestors, type); } |
|||
if (isNew) { ancestors.pop(); } |
|||
})(node, state); |
|||
} |
|||
|
|||
// Find a node with a given start, end, and type (all are optional,
|
|||
// null can be used as wildcard). Returns a {node, state} object, or
|
|||
// undefined when it doesn't find a matching node.
|
|||
function findNodeAt(node, start, end, test, baseVisitor, state) { |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
test = makeTest(test); |
|||
try { |
|||
(function c(node, st, override) { |
|||
var type = override || node.type; |
|||
if ((start == null || node.start <= start) && |
|||
(end == null || node.end >= end)) |
|||
{ baseVisitor[type](node, st, c); } |
|||
if ((start == null || node.start === start) && |
|||
(end == null || node.end === end) && |
|||
test(type, node)) |
|||
{ throw new Found(node, st) } |
|||
})(node, state); |
|||
} catch (e) { |
|||
if (e instanceof Found) { return e } |
|||
throw e |
|||
} |
|||
} |
|||
|
|||
// Find the innermost node of a given type that contains the given
|
|||
// position. Interface similar to findNodeAt.
|
|||
function findNodeAround(node, pos, test, baseVisitor, state) { |
|||
test = makeTest(test); |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
try { |
|||
(function c(node, st, override) { |
|||
var type = override || node.type; |
|||
if (node.start > pos || node.end < pos) { return } |
|||
baseVisitor[type](node, st, c); |
|||
if (test(type, node)) { throw new Found(node, st) } |
|||
})(node, state); |
|||
} catch (e) { |
|||
if (e instanceof Found) { return e } |
|||
throw e |
|||
} |
|||
} |
|||
|
|||
// Find the outermost matching node after a given position.
|
|||
function findNodeAfter(node, pos, test, baseVisitor, state) { |
|||
test = makeTest(test); |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
try { |
|||
(function c(node, st, override) { |
|||
if (node.end < pos) { return } |
|||
var type = override || node.type; |
|||
if (node.start >= pos && test(type, node)) { throw new Found(node, st) } |
|||
baseVisitor[type](node, st, c); |
|||
})(node, state); |
|||
} catch (e) { |
|||
if (e instanceof Found) { return e } |
|||
throw e |
|||
} |
|||
} |
|||
|
|||
// Find the outermost matching node before a given position.
|
|||
function findNodeBefore(node, pos, test, baseVisitor, state) { |
|||
test = makeTest(test); |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
var max |
|||
;(function c(node, st, override) { |
|||
if (node.start > pos) { return } |
|||
var type = override || node.type; |
|||
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) |
|||
{ max = new Found(node, st); } |
|||
baseVisitor[type](node, st, c); |
|||
})(node, state); |
|||
return max |
|||
} |
|||
|
|||
// Fallback to an Object.create polyfill for older environments.
|
|||
var create = Object.create || function(proto) { |
|||
function Ctor() {} |
|||
Ctor.prototype = proto; |
|||
return new Ctor |
|||
}; |
|||
|
|||
// Used to create a custom walker. Will fill in all missing node
|
|||
// type properties with the defaults.
|
|||
function make(funcs, baseVisitor) { |
|||
var visitor = create(baseVisitor || base); |
|||
for (var type in funcs) { visitor[type] = funcs[type]; } |
|||
return visitor |
|||
} |
|||
|
|||
function skipThrough(node, st, c) { c(node, st); } |
|||
function ignore(_node, _st, _c) {} |
|||
|
|||
// Node walkers.
|
|||
|
|||
var base = {}; |
|||
|
|||
base.Program = base.BlockStatement = function (node, st, c) { |
|||
for (var i = 0, list = node.body; i < list.length; i += 1) |
|||
{ |
|||
var stmt = list[i]; |
|||
|
|||
c(stmt, st, "Statement"); |
|||
} |
|||
}; |
|||
base.Statement = skipThrough; |
|||
base.EmptyStatement = ignore; |
|||
base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression = |
|||
function (node, st, c) { return c(node.expression, st, "Expression"); }; |
|||
base.IfStatement = function (node, st, c) { |
|||
c(node.test, st, "Expression"); |
|||
c(node.consequent, st, "Statement"); |
|||
if (node.alternate) { c(node.alternate, st, "Statement"); } |
|||
}; |
|||
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); }; |
|||
base.BreakStatement = base.ContinueStatement = ignore; |
|||
base.WithStatement = function (node, st, c) { |
|||
c(node.object, st, "Expression"); |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.SwitchStatement = function (node, st, c) { |
|||
c(node.discriminant, st, "Expression"); |
|||
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) { |
|||
var cs = list$1[i$1]; |
|||
|
|||
if (cs.test) { c(cs.test, st, "Expression"); } |
|||
for (var i = 0, list = cs.consequent; i < list.length; i += 1) |
|||
{ |
|||
var cons = list[i]; |
|||
|
|||
c(cons, st, "Statement"); |
|||
} |
|||
} |
|||
}; |
|||
base.SwitchCase = function (node, st, c) { |
|||
if (node.test) { c(node.test, st, "Expression"); } |
|||
for (var i = 0, list = node.consequent; i < list.length; i += 1) |
|||
{ |
|||
var cons = list[i]; |
|||
|
|||
c(cons, st, "Statement"); |
|||
} |
|||
}; |
|||
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) { |
|||
if (node.argument) { c(node.argument, st, "Expression"); } |
|||
}; |
|||
base.ThrowStatement = base.SpreadElement = |
|||
function (node, st, c) { return c(node.argument, st, "Expression"); }; |
|||
base.TryStatement = function (node, st, c) { |
|||
c(node.block, st, "Statement"); |
|||
if (node.handler) { c(node.handler, st); } |
|||
if (node.finalizer) { c(node.finalizer, st, "Statement"); } |
|||
}; |
|||
base.CatchClause = function (node, st, c) { |
|||
if (node.param) { c(node.param, st, "Pattern"); } |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.WhileStatement = base.DoWhileStatement = function (node, st, c) { |
|||
c(node.test, st, "Expression"); |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.ForStatement = function (node, st, c) { |
|||
if (node.init) { c(node.init, st, "ForInit"); } |
|||
if (node.test) { c(node.test, st, "Expression"); } |
|||
if (node.update) { c(node.update, st, "Expression"); } |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.ForInStatement = base.ForOfStatement = function (node, st, c) { |
|||
c(node.left, st, "ForInit"); |
|||
c(node.right, st, "Expression"); |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.ForInit = function (node, st, c) { |
|||
if (node.type === "VariableDeclaration") { c(node, st); } |
|||
else { c(node, st, "Expression"); } |
|||
}; |
|||
base.DebuggerStatement = ignore; |
|||
|
|||
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); }; |
|||
base.VariableDeclaration = function (node, st, c) { |
|||
for (var i = 0, list = node.declarations; i < list.length; i += 1) |
|||
{ |
|||
var decl = list[i]; |
|||
|
|||
c(decl, st); |
|||
} |
|||
}; |
|||
base.VariableDeclarator = function (node, st, c) { |
|||
c(node.id, st, "Pattern"); |
|||
if (node.init) { c(node.init, st, "Expression"); } |
|||
}; |
|||
|
|||
base.Function = function (node, st, c) { |
|||
if (node.id) { c(node.id, st, "Pattern"); } |
|||
for (var i = 0, list = node.params; i < list.length; i += 1) |
|||
{ |
|||
var param = list[i]; |
|||
|
|||
c(param, st, "Pattern"); |
|||
} |
|||
c(node.body, st, node.expression ? "Expression" : "Statement"); |
|||
}; |
|||
|
|||
base.Pattern = function (node, st, c) { |
|||
if (node.type === "Identifier") |
|||
{ c(node, st, "VariablePattern"); } |
|||
else if (node.type === "MemberExpression") |
|||
{ c(node, st, "MemberPattern"); } |
|||
else |
|||
{ c(node, st); } |
|||
}; |
|||
base.VariablePattern = ignore; |
|||
base.MemberPattern = skipThrough; |
|||
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); }; |
|||
base.ArrayPattern = function (node, st, c) { |
|||
for (var i = 0, list = node.elements; i < list.length; i += 1) { |
|||
var elt = list[i]; |
|||
|
|||
if (elt) { c(elt, st, "Pattern"); } |
|||
} |
|||
}; |
|||
base.ObjectPattern = function (node, st, c) { |
|||
for (var i = 0, list = node.properties; i < list.length; i += 1) { |
|||
var prop = list[i]; |
|||
|
|||
if (prop.type === "Property") { |
|||
if (prop.computed) { c(prop.key, st, "Expression"); } |
|||
c(prop.value, st, "Pattern"); |
|||
} else if (prop.type === "RestElement") { |
|||
c(prop.argument, st, "Pattern"); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
base.Expression = skipThrough; |
|||
base.ThisExpression = base.Super = base.MetaProperty = ignore; |
|||
base.ArrayExpression = function (node, st, c) { |
|||
for (var i = 0, list = node.elements; i < list.length; i += 1) { |
|||
var elt = list[i]; |
|||
|
|||
if (elt) { c(elt, st, "Expression"); } |
|||
} |
|||
}; |
|||
base.ObjectExpression = function (node, st, c) { |
|||
for (var i = 0, list = node.properties; i < list.length; i += 1) |
|||
{ |
|||
var prop = list[i]; |
|||
|
|||
c(prop, st); |
|||
} |
|||
}; |
|||
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration; |
|||
base.SequenceExpression = function (node, st, c) { |
|||
for (var i = 0, list = node.expressions; i < list.length; i += 1) |
|||
{ |
|||
var expr = list[i]; |
|||
|
|||
c(expr, st, "Expression"); |
|||
} |
|||
}; |
|||
base.TemplateLiteral = function (node, st, c) { |
|||
for (var i = 0, list = node.quasis; i < list.length; i += 1) |
|||
{ |
|||
var quasi = list[i]; |
|||
|
|||
c(quasi, st); |
|||
} |
|||
|
|||
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1) |
|||
{ |
|||
var expr = list$1[i$1]; |
|||
|
|||
c(expr, st, "Expression"); |
|||
} |
|||
}; |
|||
base.TemplateElement = ignore; |
|||
base.UnaryExpression = base.UpdateExpression = function (node, st, c) { |
|||
c(node.argument, st, "Expression"); |
|||
}; |
|||
base.BinaryExpression = base.LogicalExpression = function (node, st, c) { |
|||
c(node.left, st, "Expression"); |
|||
c(node.right, st, "Expression"); |
|||
}; |
|||
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) { |
|||
c(node.left, st, "Pattern"); |
|||
c(node.right, st, "Expression"); |
|||
}; |
|||
base.ConditionalExpression = function (node, st, c) { |
|||
c(node.test, st, "Expression"); |
|||
c(node.consequent, st, "Expression"); |
|||
c(node.alternate, st, "Expression"); |
|||
}; |
|||
base.NewExpression = base.CallExpression = function (node, st, c) { |
|||
c(node.callee, st, "Expression"); |
|||
if (node.arguments) |
|||
{ for (var i = 0, list = node.arguments; i < list.length; i += 1) |
|||
{ |
|||
var arg = list[i]; |
|||
|
|||
c(arg, st, "Expression"); |
|||
} } |
|||
}; |
|||
base.MemberExpression = function (node, st, c) { |
|||
c(node.object, st, "Expression"); |
|||
if (node.computed) { c(node.property, st, "Expression"); } |
|||
}; |
|||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) { |
|||
if (node.declaration) |
|||
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); } |
|||
if (node.source) { c(node.source, st, "Expression"); } |
|||
}; |
|||
base.ExportAllDeclaration = function (node, st, c) { |
|||
if (node.exported) |
|||
{ c(node.exported, st); } |
|||
c(node.source, st, "Expression"); |
|||
}; |
|||
base.ImportDeclaration = function (node, st, c) { |
|||
for (var i = 0, list = node.specifiers; i < list.length; i += 1) |
|||
{ |
|||
var spec = list[i]; |
|||
|
|||
c(spec, st); |
|||
} |
|||
c(node.source, st, "Expression"); |
|||
}; |
|||
base.ImportExpression = function (node, st, c) { |
|||
c(node.source, st, "Expression"); |
|||
}; |
|||
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore; |
|||
|
|||
base.TaggedTemplateExpression = function (node, st, c) { |
|||
c(node.tag, st, "Expression"); |
|||
c(node.quasi, st, "Expression"); |
|||
}; |
|||
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); }; |
|||
base.Class = function (node, st, c) { |
|||
if (node.id) { c(node.id, st, "Pattern"); } |
|||
if (node.superClass) { c(node.superClass, st, "Expression"); } |
|||
c(node.body, st); |
|||
}; |
|||
base.ClassBody = function (node, st, c) { |
|||
for (var i = 0, list = node.body; i < list.length; i += 1) |
|||
{ |
|||
var elt = list[i]; |
|||
|
|||
c(elt, st); |
|||
} |
|||
}; |
|||
base.MethodDefinition = base.Property = function (node, st, c) { |
|||
if (node.computed) { c(node.key, st, "Expression"); } |
|||
c(node.value, st, "Expression"); |
|||
}; |
|||
|
|||
exports.ancestor = ancestor; |
|||
exports.base = base; |
|||
exports.findNodeAfter = findNodeAfter; |
|||
exports.findNodeAround = findNodeAround; |
|||
exports.findNodeAt = findNodeAt; |
|||
exports.findNodeBefore = findNodeBefore; |
|||
exports.full = full; |
|||
exports.fullAncestor = fullAncestor; |
|||
exports.make = make; |
|||
exports.recursive = recursive; |
|||
exports.simple = simple; |
|||
|
|||
Object.defineProperty(exports, '__esModule', { value: true }); |
|||
|
|||
}))); |
1
node_modules/acorn-walk/dist/walk.js.map
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,443 +0,0 @@ |
|||
// AST walker module for Mozilla Parser API compatible trees |
|||
|
|||
// A simple walk is one where you simply specify callbacks to be |
|||
// called on specific nodes. The last two arguments are optional. A |
|||
// simple use would be |
|||
// |
|||
// walk.simple(myTree, { |
|||
// Expression: function(node) { ... } |
|||
// }); |
|||
// |
|||
// to do something with all expressions. All Parser API node types |
|||
// can be used to identify node types, as well as Expression and |
|||
// Statement, which denote categories of nodes. |
|||
// |
|||
// The base argument can be used to pass a custom (recursive) |
|||
// walker, and state can be used to give this walked an initial |
|||
// state. |
|||
|
|||
function simple(node, visitors, baseVisitor, state, override) { |
|||
if (!baseVisitor) { baseVisitor = base |
|||
; }(function c(node, st, override) { |
|||
var type = override || node.type, found = visitors[type]; |
|||
baseVisitor[type](node, st, c); |
|||
if (found) { found(node, st); } |
|||
})(node, state, override); |
|||
} |
|||
|
|||
// An ancestor walk keeps an array of ancestor nodes (including the |
|||
// current node) and passes them to the callback as third parameter |
|||
// (and also as state parameter when no other state is present). |
|||
function ancestor(node, visitors, baseVisitor, state, override) { |
|||
var ancestors = []; |
|||
if (!baseVisitor) { baseVisitor = base |
|||
; }(function c(node, st, override) { |
|||
var type = override || node.type, found = visitors[type]; |
|||
var isNew = node !== ancestors[ancestors.length - 1]; |
|||
if (isNew) { ancestors.push(node); } |
|||
baseVisitor[type](node, st, c); |
|||
if (found) { found(node, st || ancestors, ancestors); } |
|||
if (isNew) { ancestors.pop(); } |
|||
})(node, state, override); |
|||
} |
|||
|
|||
// A recursive walk is one where your functions override the default |
|||
// walkers. They can modify and replace the state parameter that's |
|||
// threaded through the walk, and can opt how and whether to walk |
|||
// their child nodes (by calling their third argument on these |
|||
// nodes). |
|||
function recursive(node, state, funcs, baseVisitor, override) { |
|||
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor |
|||
;(function c(node, st, override) { |
|||
visitor[override || node.type](node, st, c); |
|||
})(node, state, override); |
|||
} |
|||
|
|||
function makeTest(test) { |
|||
if (typeof test === "string") |
|||
{ return function (type) { return type === test; } } |
|||
else if (!test) |
|||
{ return function () { return true; } } |
|||
else |
|||
{ return test } |
|||
} |
|||
|
|||
var Found = function Found(node, state) { this.node = node; this.state = state; }; |
|||
|
|||
// A full walk triggers the callback on each node |
|||
function full(node, callback, baseVisitor, state, override) { |
|||
if (!baseVisitor) { baseVisitor = base |
|||
; }(function c(node, st, override) { |
|||
var type = override || node.type; |
|||
baseVisitor[type](node, st, c); |
|||
if (!override) { callback(node, st, type); } |
|||
})(node, state, override); |
|||
} |
|||
|
|||
// An fullAncestor walk is like an ancestor walk, but triggers |
|||
// the callback on each node |
|||
function fullAncestor(node, callback, baseVisitor, state) { |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
var ancestors = [] |
|||
;(function c(node, st, override) { |
|||
var type = override || node.type; |
|||
var isNew = node !== ancestors[ancestors.length - 1]; |
|||
if (isNew) { ancestors.push(node); } |
|||
baseVisitor[type](node, st, c); |
|||
if (!override) { callback(node, st || ancestors, ancestors, type); } |
|||
if (isNew) { ancestors.pop(); } |
|||
})(node, state); |
|||
} |
|||
|
|||
// Find a node with a given start, end, and type (all are optional, |
|||
// null can be used as wildcard). Returns a {node, state} object, or |
|||
// undefined when it doesn't find a matching node. |
|||
function findNodeAt(node, start, end, test, baseVisitor, state) { |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
test = makeTest(test); |
|||
try { |
|||
(function c(node, st, override) { |
|||
var type = override || node.type; |
|||
if ((start == null || node.start <= start) && |
|||
(end == null || node.end >= end)) |
|||
{ baseVisitor[type](node, st, c); } |
|||
if ((start == null || node.start === start) && |
|||
(end == null || node.end === end) && |
|||
test(type, node)) |
|||
{ throw new Found(node, st) } |
|||
})(node, state); |
|||
} catch (e) { |
|||
if (e instanceof Found) { return e } |
|||
throw e |
|||
} |
|||
} |
|||
|
|||
// Find the innermost node of a given type that contains the given |
|||
// position. Interface similar to findNodeAt. |
|||
function findNodeAround(node, pos, test, baseVisitor, state) { |
|||
test = makeTest(test); |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
try { |
|||
(function c(node, st, override) { |
|||
var type = override || node.type; |
|||
if (node.start > pos || node.end < pos) { return } |
|||
baseVisitor[type](node, st, c); |
|||
if (test(type, node)) { throw new Found(node, st) } |
|||
})(node, state); |
|||
} catch (e) { |
|||
if (e instanceof Found) { return e } |
|||
throw e |
|||
} |
|||
} |
|||
|
|||
// Find the outermost matching node after a given position. |
|||
function findNodeAfter(node, pos, test, baseVisitor, state) { |
|||
test = makeTest(test); |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
try { |
|||
(function c(node, st, override) { |
|||
if (node.end < pos) { return } |
|||
var type = override || node.type; |
|||
if (node.start >= pos && test(type, node)) { throw new Found(node, st) } |
|||
baseVisitor[type](node, st, c); |
|||
})(node, state); |
|||
} catch (e) { |
|||
if (e instanceof Found) { return e } |
|||
throw e |
|||
} |
|||
} |
|||
|
|||
// Find the outermost matching node before a given position. |
|||
function findNodeBefore(node, pos, test, baseVisitor, state) { |
|||
test = makeTest(test); |
|||
if (!baseVisitor) { baseVisitor = base; } |
|||
var max |
|||
;(function c(node, st, override) { |
|||
if (node.start > pos) { return } |
|||
var type = override || node.type; |
|||
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node)) |
|||
{ max = new Found(node, st); } |
|||
baseVisitor[type](node, st, c); |
|||
})(node, state); |
|||
return max |
|||
} |
|||
|
|||
// Fallback to an Object.create polyfill for older environments. |
|||
var create = Object.create || function(proto) { |
|||
function Ctor() {} |
|||
Ctor.prototype = proto; |
|||
return new Ctor |
|||
}; |
|||
|
|||
// Used to create a custom walker. Will fill in all missing node |
|||
// type properties with the defaults. |
|||
function make(funcs, baseVisitor) { |
|||
var visitor = create(baseVisitor || base); |
|||
for (var type in funcs) { visitor[type] = funcs[type]; } |
|||
return visitor |
|||
} |
|||
|
|||
function skipThrough(node, st, c) { c(node, st); } |
|||
function ignore(_node, _st, _c) {} |
|||
|
|||
// Node walkers. |
|||
|
|||
var base = {}; |
|||
|
|||
base.Program = base.BlockStatement = function (node, st, c) { |
|||
for (var i = 0, list = node.body; i < list.length; i += 1) |
|||
{ |
|||
var stmt = list[i]; |
|||
|
|||
c(stmt, st, "Statement"); |
|||
} |
|||
}; |
|||
base.Statement = skipThrough; |
|||
base.EmptyStatement = ignore; |
|||
base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression = |
|||
function (node, st, c) { return c(node.expression, st, "Expression"); }; |
|||
base.IfStatement = function (node, st, c) { |
|||
c(node.test, st, "Expression"); |
|||
c(node.consequent, st, "Statement"); |
|||
if (node.alternate) { c(node.alternate, st, "Statement"); } |
|||
}; |
|||
base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); }; |
|||
base.BreakStatement = base.ContinueStatement = ignore; |
|||
base.WithStatement = function (node, st, c) { |
|||
c(node.object, st, "Expression"); |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.SwitchStatement = function (node, st, c) { |
|||
c(node.discriminant, st, "Expression"); |
|||
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) { |
|||
var cs = list$1[i$1]; |
|||
|
|||
if (cs.test) { c(cs.test, st, "Expression"); } |
|||
for (var i = 0, list = cs.consequent; i < list.length; i += 1) |
|||
{ |
|||
var cons = list[i]; |
|||
|
|||
c(cons, st, "Statement"); |
|||
} |
|||
} |
|||
}; |
|||
base.SwitchCase = function (node, st, c) { |
|||
if (node.test) { c(node.test, st, "Expression"); } |
|||
for (var i = 0, list = node.consequent; i < list.length; i += 1) |
|||
{ |
|||
var cons = list[i]; |
|||
|
|||
c(cons, st, "Statement"); |
|||
} |
|||
}; |
|||
base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) { |
|||
if (node.argument) { c(node.argument, st, "Expression"); } |
|||
}; |
|||
base.ThrowStatement = base.SpreadElement = |
|||
function (node, st, c) { return c(node.argument, st, "Expression"); }; |
|||
base.TryStatement = function (node, st, c) { |
|||
c(node.block, st, "Statement"); |
|||
if (node.handler) { c(node.handler, st); } |
|||
if (node.finalizer) { c(node.finalizer, st, "Statement"); } |
|||
}; |
|||
base.CatchClause = function (node, st, c) { |
|||
if (node.param) { c(node.param, st, "Pattern"); } |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.WhileStatement = base.DoWhileStatement = function (node, st, c) { |
|||
c(node.test, st, "Expression"); |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.ForStatement = function (node, st, c) { |
|||
if (node.init) { c(node.init, st, "ForInit"); } |
|||
if (node.test) { c(node.test, st, "Expression"); } |
|||
if (node.update) { c(node.update, st, "Expression"); } |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.ForInStatement = base.ForOfStatement = function (node, st, c) { |
|||
c(node.left, st, "ForInit"); |
|||
c(node.right, st, "Expression"); |
|||
c(node.body, st, "Statement"); |
|||
}; |
|||
base.ForInit = function (node, st, c) { |
|||
if (node.type === "VariableDeclaration") { c(node, st); } |
|||
else { c(node, st, "Expression"); } |
|||
}; |
|||
base.DebuggerStatement = ignore; |
|||
|
|||
base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); }; |
|||
base.VariableDeclaration = function (node, st, c) { |
|||
for (var i = 0, list = node.declarations; i < list.length; i += 1) |
|||
{ |
|||
var decl = list[i]; |
|||
|
|||
c(decl, st); |
|||
} |
|||
}; |
|||
base.VariableDeclarator = function (node, st, c) { |
|||
c(node.id, st, "Pattern"); |
|||
if (node.init) { c(node.init, st, "Expression"); } |
|||
}; |
|||
|
|||
base.Function = function (node, st, c) { |
|||
if (node.id) { c(node.id, st, "Pattern"); } |
|||
for (var i = 0, list = node.params; i < list.length; i += 1) |
|||
{ |
|||
var param = list[i]; |
|||
|
|||
c(param, st, "Pattern"); |
|||
} |
|||
c(node.body, st, node.expression ? "Expression" : "Statement"); |
|||
}; |
|||
|
|||
base.Pattern = function (node, st, c) { |
|||
if (node.type === "Identifier") |
|||
{ c(node, st, "VariablePattern"); } |
|||
else if (node.type === "MemberExpression") |
|||
{ c(node, st, "MemberPattern"); } |
|||
else |
|||
{ c(node, st); } |
|||
}; |
|||
base.VariablePattern = ignore; |
|||
base.MemberPattern = skipThrough; |
|||
base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); }; |
|||
base.ArrayPattern = function (node, st, c) { |
|||
for (var i = 0, list = node.elements; i < list.length; i += 1) { |
|||
var elt = list[i]; |
|||
|
|||
if (elt) { c(elt, st, "Pattern"); } |
|||
} |
|||
}; |
|||
base.ObjectPattern = function (node, st, c) { |
|||
for (var i = 0, list = node.properties; i < list.length; i += 1) { |
|||
var prop = list[i]; |
|||
|
|||
if (prop.type === "Property") { |
|||
if (prop.computed) { c(prop.key, st, "Expression"); } |
|||
c(prop.value, st, "Pattern"); |
|||
} else if (prop.type === "RestElement") { |
|||
c(prop.argument, st, "Pattern"); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
base.Expression = skipThrough; |
|||
base.ThisExpression = base.Super = base.MetaProperty = ignore; |
|||
base.ArrayExpression = function (node, st, c) { |
|||
for (var i = 0, list = node.elements; i < list.length; i += 1) { |
|||
var elt = list[i]; |
|||
|
|||
if (elt) { c(elt, st, "Expression"); } |
|||
} |
|||
}; |
|||
base.ObjectExpression = function (node, st, c) { |
|||
for (var i = 0, list = node.properties; i < list.length; i += 1) |
|||
{ |
|||
var prop = list[i]; |
|||
|
|||
c(prop, st); |
|||
} |
|||
}; |
|||
base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration; |
|||
base.SequenceExpression = function (node, st, c) { |
|||
for (var i = 0, list = node.expressions; i < list.length; i += 1) |
|||
{ |
|||
var expr = list[i]; |
|||
|
|||
c(expr, st, "Expression"); |
|||
} |
|||
}; |
|||
base.TemplateLiteral = function (node, st, c) { |
|||
for (var i = 0, list = node.quasis; i < list.length; i += 1) |
|||
{ |
|||
var quasi = list[i]; |
|||
|
|||
c(quasi, st); |
|||
} |
|||
|
|||
for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1) |
|||
{ |
|||
var expr = list$1[i$1]; |
|||
|
|||
c(expr, st, "Expression"); |
|||
} |
|||
}; |
|||
base.TemplateElement = ignore; |
|||
base.UnaryExpression = base.UpdateExpression = function (node, st, c) { |
|||
c(node.argument, st, "Expression"); |
|||
}; |
|||
base.BinaryExpression = base.LogicalExpression = function (node, st, c) { |
|||
c(node.left, st, "Expression"); |
|||
c(node.right, st, "Expression"); |
|||
}; |
|||
base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) { |
|||
c(node.left, st, "Pattern"); |
|||
c(node.right, st, "Expression"); |
|||
}; |
|||
base.ConditionalExpression = function (node, st, c) { |
|||
c(node.test, st, "Expression"); |
|||
c(node.consequent, st, "Expression"); |
|||
c(node.alternate, st, "Expression"); |
|||
}; |
|||
base.NewExpression = base.CallExpression = function (node, st, c) { |
|||
c(node.callee, st, "Expression"); |
|||
if (node.arguments) |
|||
{ for (var i = 0, list = node.arguments; i < list.length; i += 1) |
|||
{ |
|||
var arg = list[i]; |
|||
|
|||
c(arg, st, "Expression"); |
|||
} } |
|||
}; |
|||
base.MemberExpression = function (node, st, c) { |
|||
c(node.object, st, "Expression"); |
|||
if (node.computed) { c(node.property, st, "Expression"); } |
|||
}; |
|||
base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) { |
|||
if (node.declaration) |
|||
{ c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); } |
|||
if (node.source) { c(node.source, st, "Expression"); } |
|||
}; |
|||
base.ExportAllDeclaration = function (node, st, c) { |
|||
if (node.exported) |
|||
{ c(node.exported, st); } |
|||
c(node.source, st, "Expression"); |
|||
}; |
|||
base.ImportDeclaration = function (node, st, c) { |
|||
for (var i = 0, list = node.specifiers; i < list.length; i += 1) |
|||
{ |
|||
var spec = list[i]; |
|||
|
|||
c(spec, st); |
|||
} |
|||
c(node.source, st, "Expression"); |
|||
}; |
|||
base.ImportExpression = function (node, st, c) { |
|||
c(node.source, st, "Expression"); |
|||
}; |
|||
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore; |
|||
|
|||
base.TaggedTemplateExpression = function (node, st, c) { |
|||
c(node.tag, st, "Expression"); |
|||
c(node.quasi, st, "Expression"); |
|||
}; |
|||
base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); }; |
|||
base.Class = function (node, st, c) { |
|||
if (node.id) { c(node.id, st, "Pattern"); } |
|||
if (node.superClass) { c(node.superClass, st, "Expression"); } |
|||
c(node.body, st); |
|||
}; |
|||
base.ClassBody = function (node, st, c) { |
|||
for (var i = 0, list = node.body; i < list.length; i += 1) |
|||
{ |
|||
var elt = list[i]; |
|||
|
|||
c(elt, st); |
|||
} |
|||
}; |
|||
base.MethodDefinition = base.Property = function (node, st, c) { |
|||
if (node.computed) { c(node.key, st, "Expression"); } |
|||
c(node.value, st, "Expression"); |
|||
}; |
|||
|
|||
export { ancestor, base, findNodeAfter, findNodeAround, findNodeAt, findNodeBefore, full, fullAncestor, make, recursive, simple }; |
1
node_modules/acorn-walk/dist/walk.mjs.map
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,34 +0,0 @@ |
|||
{ |
|||
"name": "acorn-walk", |
|||
"description": "ECMAScript (ESTree) AST walker", |
|||
"homepage": "https://github.com/acornjs/acorn", |
|||
"main": "dist/walk.js", |
|||
"types": "dist/walk.d.ts", |
|||
"module": "dist/walk.mjs", |
|||
"version": "7.2.0", |
|||
"engines": {"node": ">=0.4.0"}, |
|||
"maintainers": [ |
|||
{ |
|||
"name": "Marijn Haverbeke", |
|||
"email": "marijnh@gmail.com", |
|||
"web": "https://marijnhaverbeke.nl" |
|||
}, |
|||
{ |
|||
"name": "Ingvar Stepanyan", |
|||
"email": "me@rreverser.com", |
|||
"web": "https://rreverser.com/" |
|||
}, |
|||
{ |
|||
"name": "Adrian Heine", |
|||
"web": "http://adrianheine.de" |
|||
} |
|||
], |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "https://github.com/acornjs/acorn.git" |
|||
}, |
|||
"scripts": { |
|||
"prepare": "cd ..; npm run build:walk" |
|||
}, |
|||
"license": "MIT" |
|||
} |
@ -1,620 +0,0 @@ |
|||
## 7.4.0 (2020-08-03) |
|||
|
|||
### New features |
|||
|
|||
Add support for logical assignment operators. |
|||
|
|||
Add support for numeric separators. |
|||
|
|||
## 7.3.1 (2020-06-11) |
|||
|
|||
### Bug fixes |
|||
|
|||
Make the string in the `version` export match the actual library version. |
|||
|
|||
## 7.3.0 (2020-06-11) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail. |
|||
|
|||
### New features |
|||
|
|||
Add support for optional chaining (`?.`). |
|||
|
|||
## 7.2.0 (2020-05-09) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix precedence issue in parsing of async arrow functions. |
|||
|
|||
### New features |
|||
|
|||
Add support for nullish coalescing. |
|||
|
|||
Add support for `import.meta`. |
|||
|
|||
Support `export * as ...` syntax. |
|||
|
|||
Upgrade to Unicode 13. |
|||
|
|||
## 6.4.1 (2020-03-09) |
|||
|
|||
### Bug fixes |
|||
|
|||
More carefully check for valid UTF16 surrogate pairs in regexp validator. |
|||
|
|||
## 7.1.1 (2020-03-01) |
|||
|
|||
### Bug fixes |
|||
|
|||
Treat `\8` and `\9` as invalid escapes in template strings. |
|||
|
|||
Allow unicode escapes in property names that are keywords. |
|||
|
|||
Don't error on an exponential operator expression as argument to `await`. |
|||
|
|||
More carefully check for valid UTF16 surrogate pairs in regexp validator. |
|||
|
|||
## 7.1.0 (2019-09-24) |
|||
|
|||
### Bug fixes |
|||
|
|||
Disallow trailing object literal commas when ecmaVersion is less than 5. |
|||
|
|||
### New features |
|||
|
|||
Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on. |
|||
|
|||
## 7.0.0 (2019-08-13) |
|||
|
|||
### Breaking changes |
|||
|
|||
Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression). |
|||
|
|||
Makes 10 (ES2019) the default value for the `ecmaVersion` option. |
|||
|
|||
## 6.3.0 (2019-08-12) |
|||
|
|||
### New features |
|||
|
|||
`sourceType: "module"` can now be used even when `ecmaVersion` is less than 6, to parse module-style code that otherwise conforms to an older standard. |
|||
|
|||
## 6.2.1 (2019-07-21) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such. |
|||
|
|||
Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances. |
|||
|
|||
## 6.2.0 (2019-07-04) |
|||
|
|||
### Bug fixes |
|||
|
|||
Improve valid assignment checking in `for`/`in` and `for`/`of` loops. |
|||
|
|||
Disallow binding `let` in patterns. |
|||
|
|||
### New features |
|||
|
|||
Support bigint syntax with `ecmaVersion` >= 11. |
|||
|
|||
Support dynamic `import` syntax with `ecmaVersion` >= 11. |
|||
|
|||
Upgrade to Unicode version 12. |
|||
|
|||
## 6.1.1 (2019-02-27) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix bug that caused parsing default exports of with names to fail. |
|||
|
|||
## 6.1.0 (2019-02-08) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix scope checking when redefining a `var` as a lexical binding. |
|||
|
|||
### New features |
|||
|
|||
Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins. |
|||
|
|||
## 6.0.7 (2019-02-04) |
|||
|
|||
### Bug fixes |
|||
|
|||
Check that exported bindings are defined. |
|||
|
|||
Don't treat `\u180e` as a whitespace character. |
|||
|
|||
Check for duplicate parameter names in methods. |
|||
|
|||
Don't allow shorthand properties when they are generators or async methods. |
|||
|
|||
Forbid binding `await` in async arrow function's parameter list. |
|||
|
|||
## 6.0.6 (2019-01-30) |
|||
|
|||
### Bug fixes |
|||
|
|||
The content of class declarations and expressions is now always parsed in strict mode. |
|||
|
|||
Don't allow `let` or `const` to bind the variable name `let`. |
|||
|
|||
Treat class declarations as lexical. |
|||
|
|||
Don't allow a generator function declaration as the sole body of an `if` or `else`. |
|||
|
|||
Ignore `"use strict"` when after an empty statement. |
|||
|
|||
Allow string line continuations with special line terminator characters. |
|||
|
|||
Treat `for` bodies as part of the `for` scope when checking for conflicting bindings. |
|||
|
|||
Fix bug with parsing `yield` in a `for` loop initializer. |
|||
|
|||
Implement special cases around scope checking for functions. |
|||
|
|||
## 6.0.5 (2019-01-02) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type. |
|||
|
|||
Don't treat `let` as a keyword when the next token is `{` on the next line. |
|||
|
|||
Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on. |
|||
|
|||
## 6.0.4 (2018-11-05) |
|||
|
|||
### Bug fixes |
|||
|
|||
Further improvements to tokenizing regular expressions in corner cases. |
|||
|
|||
## 6.0.3 (2018-11-04) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression. |
|||
|
|||
Remove stray symlink in the package tarball. |
|||
|
|||
## 6.0.2 (2018-09-26) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix bug where default expressions could fail to parse inside an object destructuring assignment expression. |
|||
|
|||
## 6.0.1 (2018-09-14) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix wrong value in `version` export. |
|||
|
|||
## 6.0.0 (2018-09-14) |
|||
|
|||
### Bug fixes |
|||
|
|||
Better handle variable-redefinition checks for catch bindings and functions directly under if statements. |
|||
|
|||
Forbid `new.target` in top-level arrow functions. |
|||
|
|||
Fix issue with parsing a regexp after `yield` in some contexts. |
|||
|
|||
### New features |
|||
|
|||
The package now comes with TypeScript definitions. |
|||
|
|||
### Breaking changes |
|||
|
|||
The default value of the `ecmaVersion` option is now 9 (2018). |
|||
|
|||
Plugins work differently, and will have to be rewritten to work with this version. |
|||
|
|||
The loose parser and walker have been moved into separate packages (`acorn-loose` and `acorn-walk`). |
|||
|
|||
## 5.7.3 (2018-09-10) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix failure to tokenize regexps after expressions like `x.of`. |
|||
|
|||
Better error message for unterminated template literals. |
|||
|
|||
## 5.7.2 (2018-08-24) |
|||
|
|||
### Bug fixes |
|||
|
|||
Properly handle `allowAwaitOutsideFunction` in for statements. |
|||
|
|||
Treat function declarations at the top level of modules like let bindings. |
|||
|
|||
Don't allow async function declarations as the only statement under a label. |
|||
|
|||
## 5.7.0 (2018-06-15) |
|||
|
|||
### New features |
|||
|
|||
Upgraded to Unicode 11. |
|||
|
|||
## 5.6.0 (2018-05-31) |
|||
|
|||
### New features |
|||
|
|||
Allow U+2028 and U+2029 in string when ECMAVersion >= 10. |
|||
|
|||
Allow binding-less catch statements when ECMAVersion >= 10. |
|||
|
|||
Add `allowAwaitOutsideFunction` option for parsing top-level `await`. |
|||
|
|||
## 5.5.3 (2018-03-08) |
|||
|
|||
### Bug fixes |
|||
|
|||
A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps. |
|||
|
|||
## 5.5.2 (2018-03-08) |
|||
|
|||
### Bug fixes |
|||
|
|||
A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0. |
|||
|
|||
## 5.5.1 (2018-03-06) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix misleading error message for octal escapes in template strings. |
|||
|
|||
## 5.5.0 (2018-02-27) |
|||
|
|||
### New features |
|||
|
|||
The identifier character categorization is now based on Unicode version 10. |
|||
|
|||
Acorn will now validate the content of regular expressions, including new ES9 features. |
|||
|
|||
## 5.4.0 (2018-02-01) |
|||
|
|||
### Bug fixes |
|||
|
|||
Disallow duplicate or escaped flags on regular expressions. |
|||
|
|||
Disallow octal escapes in strings in strict mode. |
|||
|
|||
### New features |
|||
|
|||
Add support for async iteration. |
|||
|
|||
Add support for object spread and rest. |
|||
|
|||
## 5.3.0 (2017-12-28) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix parsing of floating point literals with leading zeroes in loose mode. |
|||
|
|||
Allow duplicate property names in object patterns. |
|||
|
|||
Don't allow static class methods named `prototype`. |
|||
|
|||
Disallow async functions directly under `if` or `else`. |
|||
|
|||
Parse right-hand-side of `for`/`of` as an assignment expression. |
|||
|
|||
Stricter parsing of `for`/`in`. |
|||
|
|||
Don't allow unicode escapes in contextual keywords. |
|||
|
|||
### New features |
|||
|
|||
Parsing class members was factored into smaller methods to allow plugins to hook into it. |
|||
|
|||
## 5.2.1 (2017-10-30) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix a token context corruption bug. |
|||
|
|||
## 5.2.0 (2017-10-30) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix token context tracking for `class` and `function` in property-name position. |
|||
|
|||
Make sure `%*` isn't parsed as a valid operator. |
|||
|
|||
Allow shorthand properties `get` and `set` to be followed by default values. |
|||
|
|||
Disallow `super` when not in callee or object position. |
|||
|
|||
### New features |
|||
|
|||
Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements. |
|||
|
|||
## 5.1.2 (2017-09-04) |
|||
|
|||
### Bug fixes |
|||
|
|||
Disable parsing of legacy HTML-style comments in modules. |
|||
|
|||
Fix parsing of async methods whose names are keywords. |
|||
|
|||
## 5.1.1 (2017-07-06) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix problem with disambiguating regexp and division after a class. |
|||
|
|||
## 5.1.0 (2017-07-05) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`. |
|||
|
|||
Parse zero-prefixed numbers with non-octal digits as decimal. |
|||
|
|||
Allow object/array patterns in rest parameters. |
|||
|
|||
Don't error when `yield` is used as a property name. |
|||
|
|||
Allow `async` as a shorthand object property. |
|||
|
|||
### New features |
|||
|
|||
Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9. |
|||
|
|||
## 5.0.3 (2017-04-01) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix spurious duplicate variable definition errors for named functions. |
|||
|
|||
## 5.0.2 (2017-03-30) |
|||
|
|||
### Bug fixes |
|||
|
|||
A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error. |
|||
|
|||
## 5.0.0 (2017-03-28) |
|||
|
|||
### Bug fixes |
|||
|
|||
Raise an error for duplicated lexical bindings. |
|||
|
|||
Fix spurious error when an assignement expression occurred after a spread expression. |
|||
|
|||
Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions. |
|||
|
|||
Allow labels in front or `var` declarations, even in strict mode. |
|||
|
|||
### Breaking changes |
|||
|
|||
Parse declarations following `export default` as declaration nodes, not expressions. This means that class and function declarations nodes can now have `null` as their `id`. |
|||
|
|||
## 4.0.11 (2017-02-07) |
|||
|
|||
### Bug fixes |
|||
|
|||
Allow all forms of member expressions to be parenthesized as lvalue. |
|||
|
|||
## 4.0.10 (2017-02-07) |
|||
|
|||
### Bug fixes |
|||
|
|||
Don't expect semicolons after default-exported functions or classes, even when they are expressions. |
|||
|
|||
Check for use of `'use strict'` directives in non-simple parameter functions, even when already in strict mode. |
|||
|
|||
## 4.0.9 (2017-02-06) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix incorrect error raised for parenthesized simple assignment targets, so that `(x) = 1` parses again. |
|||
|
|||
## 4.0.8 (2017-02-03) |
|||
|
|||
### Bug fixes |
|||
|
|||
Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet. |
|||
|
|||
## 4.0.7 (2017-02-02) |
|||
|
|||
### Bug fixes |
|||
|
|||
Accept invalidly rejected code like `(x).y = 2` again. |
|||
|
|||
Don't raise an error when a function _inside_ strict code has a non-simple parameter list. |
|||
|
|||
## 4.0.6 (2017-02-02) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check. |
|||
|
|||
## 4.0.5 (2017-02-02) |
|||
|
|||
### Bug fixes |
|||
|
|||
Disallow parenthesized pattern expressions. |
|||
|
|||
Allow keywords as export names. |
|||
|
|||
Don't allow the `async` keyword to be parenthesized. |
|||
|
|||
Properly raise an error when a keyword contains a character escape. |
|||
|
|||
Allow `"use strict"` to appear after other string literal expressions. |
|||
|
|||
Disallow labeled declarations. |
|||
|
|||
## 4.0.4 (2016-12-19) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix crash when `export` was followed by a keyword that can't be |
|||
exported. |
|||
|
|||
## 4.0.3 (2016-08-16) |
|||
|
|||
### Bug fixes |
|||
|
|||
Allow regular function declarations inside single-statement `if` branches in loose mode. Forbid them entirely in strict mode. |
|||
|
|||
Properly parse properties named `async` in ES2017 mode. |
|||
|
|||
Fix bug where reserved words were broken in ES2017 mode. |
|||
|
|||
## 4.0.2 (2016-08-11) |
|||
|
|||
### Bug fixes |
|||
|
|||
Don't ignore period or 'e' characters after octal numbers. |
|||
|
|||
Fix broken parsing for call expressions in default parameter values of arrow functions. |
|||
|
|||
## 4.0.1 (2016-08-08) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix false positives in duplicated export name errors. |
|||
|
|||
## 4.0.0 (2016-08-07) |
|||
|
|||
### Breaking changes |
|||
|
|||
The default `ecmaVersion` option value is now 7. |
|||
|
|||
A number of internal method signatures changed, so plugins might need to be updated. |
|||
|
|||
### Bug fixes |
|||
|
|||
The parser now raises errors on duplicated export names. |
|||
|
|||
`arguments` and `eval` can now be used in shorthand properties. |
|||
|
|||
Duplicate parameter names in non-simple argument lists now always produce an error. |
|||
|
|||
### New features |
|||
|
|||
The `ecmaVersion` option now also accepts year-style version numbers |
|||
(2015, etc). |
|||
|
|||
Support for `async`/`await` syntax when `ecmaVersion` is >= 8. |
|||
|
|||
Support for trailing commas in call expressions when `ecmaVersion` is >= 8. |
|||
|
|||
## 3.3.0 (2016-07-25) |
|||
|
|||
### Bug fixes |
|||
|
|||
Fix bug in tokenizing of regexp operator after a function declaration. |
|||
|
|||
Fix parser crash when parsing an array pattern with a hole. |
|||
|
|||
### New features |
|||
|
|||
Implement check against complex argument lists in functions that enable strict mode in ES7. |
|||
|
|||
## 3.2.0 (2016-06-07) |
|||
|
|||
### Bug fixes |
|||
|
|||
Improve handling of lack of unicode regexp support in host |
|||
environment. |
|||
|
|||
Properly reject shorthand properties whose name is a keyword. |
|||
|
|||
### New features |
|||
|
|||
Visitors created with `visit.make` now have their base as _prototype_, rather than copying properties into a fresh object. |
|||
|
|||
## 3.1.0 (2016-04-18) |
|||
|
|||
### Bug fixes |
|||
|
|||
Properly tokenize the division operator directly after a function expression. |
|||
|
|||
Allow trailing comma in destructuring arrays. |
|||
|
|||
## 3.0.4 (2016-02-25) |
|||
|
|||
### Fixes |
|||
|
|||
Allow update expressions as left-hand-side of the ES7 exponential operator. |
|||
|
|||
## 3.0.2 (2016-02-10) |
|||
|
|||
### Fixes |
|||
|
|||
Fix bug that accidentally made `undefined` a reserved word when parsing ES7. |
|||
|
|||
## 3.0.0 (2016-02-10) |
|||
|
|||
### Breaking changes |
|||
|
|||
The default value of the `ecmaVersion` option is now 6 (used to be 5). |
|||
|
|||
Support for comprehension syntax (which was dropped from the draft spec) has been removed. |
|||
|
|||
### Fixes |
|||
|
|||
`let` and `yield` are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code. |
|||
|
|||
A parenthesized class or function expression after `export default` is now parsed correctly. |
|||
|
|||
### New features |
|||
|
|||
When `ecmaVersion` is set to 7, Acorn will parse the exponentiation operator (`**`). |
|||
|
|||
The identifier character ranges are now based on Unicode 8.0.0. |
|||
|
|||
Plugins can now override the `raiseRecoverable` method to override the way non-critical errors are handled. |
|||
|
|||
## 2.7.0 (2016-01-04) |
|||
|
|||
### Fixes |
|||
|
|||
Stop allowing rest parameters in setters. |
|||
|
|||
Disallow `y` rexexp flag in ES5. |
|||
|
|||
Disallow `\00` and `\000` escapes in strict mode. |
|||
|
|||
Raise an error when an import name is a reserved word. |
|||
|
|||
## 2.6.2 (2015-11-10) |
|||
|
|||
### Fixes |
|||
|
|||
Don't crash when no options object is passed. |
|||
|
|||
## 2.6.0 (2015-11-09) |
|||
|
|||
### Fixes |
|||
|
|||
Add `await` as a reserved word in module sources. |
|||
|
|||
Disallow `yield` in a parameter default value for a generator. |
|||
|
|||
Forbid using a comma after a rest pattern in an array destructuring. |
|||
|
|||
### New features |
|||
|
|||
Support parsing stdin in command-line tool. |
|||
|
|||
## 2.5.0 (2015-10-27) |
|||
|
|||
### Fixes |
|||
|
|||
Fix tokenizer support in the command-line tool. |
|||
|
|||
Stop allowing `new.target` outside of functions. |
|||
|
|||
Remove legacy `guard` and `guardedHandler` properties from try nodes. |
|||
|
|||
Stop allowing multiple `__proto__` properties on an object literal in strict mode. |
|||
|
|||
Don't allow rest parameters to be non-identifier patterns. |
|||
|
|||
Check for duplicate paramter names in arrow functions. |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue