mirror of
https://github.com/JonasunderscoreJones/aka-worker.git
synced 2025-10-23 09:59:19 +02:00
Initial commit (by create-cloudflare CLI)
This commit is contained in:
parent
8cb86120f1
commit
fff961078a
1777 changed files with 1011798 additions and 0 deletions
55
cool-dawn-3d3b/node_modules/estree-walker/CHANGELOG.md
generated
vendored
Normal file
55
cool-dawn-3d3b/node_modules/estree-walker/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
# changelog
|
||||
|
||||
## 0.6.1
|
||||
|
||||
* Only traverse nodes that exist and have a type ([#9](https://github.com/Rich-Harris/estree-walker/pull/9))
|
||||
* Only cache keys for nodes with a type ([#8](https://github.com/Rich-Harris/estree-walker/pull/8))
|
||||
|
||||
## 0.6.0
|
||||
|
||||
* Fix walker context type
|
||||
* Update deps, remove unncessary Bublé transformation
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* Add types to package
|
||||
|
||||
## 0.5.1
|
||||
|
||||
* Prevent context corruption when `walk()` is called during a walk
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Export `childKeys`, for manually fixing in case of malformed ASTs
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* Add TypeScript typings ([#3](https://github.com/Rich-Harris/estree-walker/pull/3))
|
||||
|
||||
## 0.3.1
|
||||
|
||||
* Include `pkg.repository` ([#2](https://github.com/Rich-Harris/estree-walker/pull/2))
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* More predictable ordering
|
||||
|
||||
## 0.2.1
|
||||
|
||||
* Keep `context` shape
|
||||
|
||||
## 0.2.0
|
||||
|
||||
* Add ES6 build
|
||||
|
||||
## 0.1.3
|
||||
|
||||
* npm snafu
|
||||
|
||||
## 0.1.2
|
||||
|
||||
* Pass current prop and index to `enter`/`leave` callbacks
|
||||
|
||||
## 0.1.1
|
||||
|
||||
* First release
|
45
cool-dawn-3d3b/node_modules/estree-walker/README.md
generated
vendored
Normal file
45
cool-dawn-3d3b/node_modules/estree-walker/README.md
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
# estree-walker
|
||||
|
||||
Simple utility for walking an [ESTree](https://github.com/estree/estree)-compliant AST, such as one generated by [acorn](https://github.com/marijnh/acorn).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm i estree-walker
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var walk = require( 'estree-walker' ).walk;
|
||||
var acorn = require( 'acorn' );
|
||||
|
||||
ast = acorn.parse( sourceCode, options ); // https://github.com/acornjs/acorn
|
||||
|
||||
walk( ast, {
|
||||
enter: function ( node, parent, prop, index ) {
|
||||
// some code happens
|
||||
},
|
||||
leave: function ( node, parent, prop, index ) {
|
||||
// some code happens
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Inside the `enter` function, calling `this.skip()` will prevent the node's children being walked, or the `leave` function (which is optional) being called.
|
||||
|
||||
|
||||
## Why not use estraverse?
|
||||
|
||||
The ESTree spec is evolving to accommodate ES6/7. I've had a couple of experiences where [estraverse](https://github.com/estools/estraverse) was unable to handle an AST generated by recent versions of acorn, because it hard-codes visitor keys.
|
||||
|
||||
estree-walker, by contrast, simply enumerates a node's properties to find child nodes (and child lists of nodes), and is therefore resistant to spec changes. It's also much smaller. (The performance, if you're wondering, is basically identical.)
|
||||
|
||||
None of which should be taken as criticism of estraverse, which has more features and has been battle-tested in many more situations, and for which I'm very grateful.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
65
cool-dawn-3d3b/node_modules/estree-walker/dist/estree-walker.umd.js
generated
vendored
Normal file
65
cool-dawn-3d3b/node_modules/estree-walker/dist/estree-walker.umd.js
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.estreeWalker = {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
function walk(ast, { enter, leave }) {
|
||||
visit(ast, null, enter, leave);
|
||||
}
|
||||
|
||||
let shouldSkip = false;
|
||||
const context = { skip: () => shouldSkip = true };
|
||||
|
||||
const childKeys = {};
|
||||
|
||||
const toString = Object.prototype.toString;
|
||||
|
||||
function isArray(thing) {
|
||||
return toString.call(thing) === '[object Array]';
|
||||
}
|
||||
|
||||
function visit(node, parent, enter, leave, prop, index) {
|
||||
if (!node) return;
|
||||
|
||||
if (enter) {
|
||||
const _shouldSkip = shouldSkip;
|
||||
shouldSkip = false;
|
||||
enter.call(context, node, parent, prop, index);
|
||||
const skipped = shouldSkip;
|
||||
shouldSkip = _shouldSkip;
|
||||
|
||||
if (skipped) return;
|
||||
}
|
||||
|
||||
const keys = node.type && childKeys[node.type] || (
|
||||
childKeys[node.type] = Object.keys(node).filter(key => typeof node[key] === 'object')
|
||||
);
|
||||
|
||||
for (let i = 0; i < keys.length; i += 1) {
|
||||
const key = keys[i];
|
||||
const value = node[key];
|
||||
|
||||
if (isArray(value)) {
|
||||
for (let j = 0; j < value.length; j += 1) {
|
||||
value[j] && value[j].type && visit(value[j], node, enter, leave, key, j);
|
||||
}
|
||||
}
|
||||
|
||||
else if (value && value.type) {
|
||||
visit(value, node, enter, leave, key, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (leave) {
|
||||
leave(node, parent, prop, index);
|
||||
}
|
||||
}
|
||||
|
||||
exports.walk = walk;
|
||||
exports.childKeys = childKeys;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
//# sourceMappingURL=estree-walker.umd.js.map
|
1
cool-dawn-3d3b/node_modules/estree-walker/dist/estree-walker.umd.js.map
generated
vendored
Normal file
1
cool-dawn-3d3b/node_modules/estree-walker/dist/estree-walker.umd.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"estree-walker.umd.js","sources":["../src/estree-walker.js"],"sourcesContent":["export function walk(ast, { enter, leave }) {\n\tvisit(ast, null, enter, leave);\n}\n\nlet shouldSkip = false;\nconst context = { skip: () => shouldSkip = true };\n\nexport const childKeys = {};\n\nconst toString = Object.prototype.toString;\n\nfunction isArray(thing) {\n\treturn toString.call(thing) === '[object Array]';\n}\n\nfunction visit(node, parent, enter, leave, prop, index) {\n\tif (!node) return;\n\n\tif (enter) {\n\t\tconst _shouldSkip = shouldSkip;\n\t\tshouldSkip = false;\n\t\tenter.call(context, node, parent, prop, index);\n\t\tconst skipped = shouldSkip;\n\t\tshouldSkip = _shouldSkip;\n\n\t\tif (skipped) return;\n\t}\n\n\tconst keys = node.type && childKeys[node.type] || (\n\t\tchildKeys[node.type] = Object.keys(node).filter(key => typeof node[key] === 'object')\n\t);\n\n\tfor (let i = 0; i < keys.length; i += 1) {\n\t\tconst key = keys[i];\n\t\tconst value = node[key];\n\n\t\tif (isArray(value)) {\n\t\t\tfor (let j = 0; j < value.length; j += 1) {\n\t\t\t\tvalue[j] && value[j].type && visit(value[j], node, enter, leave, key, j);\n\t\t\t}\n\t\t}\n\n\t\telse if (value && value.type) {\n\t\t\tvisit(value, node, enter, leave, key, null);\n\t\t}\n\t}\n\n\tif (leave) {\n\t\tleave(node, parent, prop, index);\n\t}\n}\n"],"names":[],"mappings":";;;;;;CAAO,SAAS,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;CAC5C,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;CAChC,CAAC;;CAED,IAAI,UAAU,GAAG,KAAK,CAAC;CACvB,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,UAAU,GAAG,IAAI,EAAE,CAAC;;AAElD,AAAY,OAAC,SAAS,GAAG,EAAE,CAAC;;CAE5B,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;;CAE3C,SAAS,OAAO,CAAC,KAAK,EAAE;CACxB,CAAC,OAAO,QAAQ,CAAC,IAAI,C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CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;CAC7E,IAAI;CACJ,GAAG;;CAEH,OAAO,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE;CAChC,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;CAC/C,GAAG;CACH,EAAE;;CAEF,CAAC,IAAI,KAAK,EAAE;CACZ,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;CACnC,EAAE;CACF,CAAC;;;;;;;;;;;;;"}
|
27
cool-dawn-3d3b/node_modules/estree-walker/index.d.ts
generated
vendored
Normal file
27
cool-dawn-3d3b/node_modules/estree-walker/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
declare module "estree-walker" {
|
||||
export interface Node {
|
||||
start: number;
|
||||
end: number;
|
||||
type: string;
|
||||
[propName: string]: any;
|
||||
}
|
||||
|
||||
export type WalkerContext = {
|
||||
skip: () => void;
|
||||
};
|
||||
|
||||
export type WalkerListener = (
|
||||
this: WalkerContext,
|
||||
node: Node,
|
||||
parent?: Node,
|
||||
prop?: string,
|
||||
index?: number
|
||||
) => void;
|
||||
|
||||
export interface WalkerOptions {
|
||||
enter?: WalkerListener;
|
||||
leave?: WalkerListener;
|
||||
}
|
||||
|
||||
export function walk(ast: Node, options: WalkerOptions): void;
|
||||
}
|
30
cool-dawn-3d3b/node_modules/estree-walker/package.json
generated
vendored
Normal file
30
cool-dawn-3d3b/node_modules/estree-walker/package.json
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "estree-walker",
|
||||
"description": "Traverse an ESTree-compliant AST",
|
||||
"version": "0.6.1",
|
||||
"author": "Rich Harris",
|
||||
"license": "MIT",
|
||||
"typings": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Rich-Harris/estree-walker"
|
||||
},
|
||||
"main": "dist/estree-walker.umd.js",
|
||||
"module": "src/estree-walker.js",
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm test",
|
||||
"build": "rollup -c",
|
||||
"test": "mocha test/test.js",
|
||||
"pretest": "npm run build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^5.2.0",
|
||||
"rollup": "^0.67.3"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"dist",
|
||||
"index.d.ts",
|
||||
"README.md"
|
||||
]
|
||||
}
|
51
cool-dawn-3d3b/node_modules/estree-walker/src/estree-walker.js
generated
vendored
Normal file
51
cool-dawn-3d3b/node_modules/estree-walker/src/estree-walker.js
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
export function walk(ast, { enter, leave }) {
|
||||
visit(ast, null, enter, leave);
|
||||
}
|
||||
|
||||
let shouldSkip = false;
|
||||
const context = { skip: () => shouldSkip = true };
|
||||
|
||||
export const childKeys = {};
|
||||
|
||||
const toString = Object.prototype.toString;
|
||||
|
||||
function isArray(thing) {
|
||||
return toString.call(thing) === '[object Array]';
|
||||
}
|
||||
|
||||
function visit(node, parent, enter, leave, prop, index) {
|
||||
if (!node) return;
|
||||
|
||||
if (enter) {
|
||||
const _shouldSkip = shouldSkip;
|
||||
shouldSkip = false;
|
||||
enter.call(context, node, parent, prop, index);
|
||||
const skipped = shouldSkip;
|
||||
shouldSkip = _shouldSkip;
|
||||
|
||||
if (skipped) return;
|
||||
}
|
||||
|
||||
const keys = node.type && childKeys[node.type] || (
|
||||
childKeys[node.type] = Object.keys(node).filter(key => typeof node[key] === 'object')
|
||||
);
|
||||
|
||||
for (let i = 0; i < keys.length; i += 1) {
|
||||
const key = keys[i];
|
||||
const value = node[key];
|
||||
|
||||
if (isArray(value)) {
|
||||
for (let j = 0; j < value.length; j += 1) {
|
||||
value[j] && value[j].type && visit(value[j], node, enter, leave, key, j);
|
||||
}
|
||||
}
|
||||
|
||||
else if (value && value.type) {
|
||||
visit(value, node, enter, leave, key, null);
|
||||
}
|
||||
}
|
||||
|
||||
if (leave) {
|
||||
leave(node, parent, prop, index);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue