jass 0.9.1 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jass.rb +5 -0
- data/lib/jass/compiler.rb +5 -0
- data/lib/jass/plugin.rb +2 -1
- data/lib/jass/version.rb +1 -1
- data/vendor/node_modules/@types/estree/index.d.ts +4 -2
- data/vendor/node_modules/@types/estree/package.json +2 -2
- data/vendor/node_modules/acorn/bin/_acorn.js +12 -12
- data/vendor/node_modules/acorn/bin/run_test262.js +2 -3
- data/vendor/node_modules/acorn/bin/test262.whitelist +0 -5
- data/vendor/node_modules/acorn/dist/acorn.es.js +76 -68
- data/vendor/node_modules/acorn/dist/acorn.js +76 -68
- data/vendor/node_modules/acorn/dist/acorn_loose.es.js +42 -30
- data/vendor/node_modules/acorn/dist/acorn_loose.js +42 -30
- data/vendor/node_modules/acorn/dist/walk.es.js +47 -43
- data/vendor/node_modules/acorn/dist/walk.js +47 -43
- data/vendor/node_modules/acorn/package.json +9 -5
- data/vendor/node_modules/chalk/index.js.flow +93 -0
- data/vendor/node_modules/chalk/package.json +8 -3
- data/vendor/node_modules/color-convert/conversions.js +36 -29
- data/vendor/node_modules/color-convert/package.json +4 -4
- data/vendor/node_modules/estree-walker/index.d.ts +17 -0
- data/vendor/node_modules/estree-walker/package.json +2 -1
- data/vendor/node_modules/fill-range/index.js +2 -2
- data/vendor/node_modules/fill-range/package.json +24 -7
- data/vendor/node_modules/is-reference/node_modules/@types/estree/index.d.ts +546 -0
- data/vendor/node_modules/is-reference/node_modules/@types/estree/package.json +22 -0
- data/vendor/node_modules/math-random/browser.js +17 -0
- data/vendor/node_modules/math-random/node.js +13 -0
- data/vendor/node_modules/math-random/package.json +31 -0
- data/vendor/node_modules/math-random/test.js +26 -0
- data/vendor/node_modules/nodent-compiler/compiler.js +115 -11
- data/vendor/node_modules/nodent-compiler/{lib/output.js → output.js} +0 -0
- data/vendor/node_modules/nodent-compiler/package.json +8 -4
- data/vendor/node_modules/{nodent-compiler/lib → nodent-transform}/arboriculture.js +1340 -1107
- data/vendor/node_modules/nodent-transform/package.json +19 -0
- data/vendor/node_modules/path-parse/package.json +1 -1
- data/vendor/node_modules/pretty-ms/index.js +2 -1
- data/vendor/node_modules/pretty-ms/package.json +2 -3
- data/vendor/node_modules/randomatic/index.js +12 -2
- data/vendor/node_modules/randomatic/node_modules/is-number/index.js +6 -7
- data/vendor/node_modules/randomatic/node_modules/is-number/package.json +9 -16
- data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +112 -102
- data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +18 -20
- data/vendor/node_modules/randomatic/package.json +15 -13
- data/vendor/node_modules/repeat-element/index.js +1 -1
- data/vendor/node_modules/repeat-element/package.json +27 -22
- data/vendor/node_modules/resolve/lib/async.js +20 -17
- data/vendor/node_modules/resolve/lib/core.js +2 -2
- data/vendor/node_modules/resolve/lib/core.json +4 -1
- data/vendor/node_modules/resolve/lib/sync.js +52 -13
- data/vendor/node_modules/resolve/package.json +3 -3
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +50 -12
- data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +50 -12
- data/vendor/node_modules/rollup-plugin-commonjs/package.json +2 -2
- data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +49 -11
- data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +1 -1
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +82 -85
- data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +82 -85
- data/vendor/node_modules/rollup-plugin-node-resolve/package.json +1 -1
- data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +81 -84
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +81 -2
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +81 -3
- data/vendor/node_modules/rollup-pluginutils/package.json +12 -6
- data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +10 -2
- data/vendor/node_modules/rollup-pluginutils/src/dataToEsm.js +69 -0
- data/vendor/node_modules/rollup-pluginutils/src/index.js +1 -0
- data/vendor/node_modules/supports-color/index.js +1 -5
- data/vendor/node_modules/supports-color/package.json +51 -51
- data/vendor/yarn.lock +65 -70
- metadata +16 -21
- data/vendor/node_modules/irregular-plurals/irregular-plurals.json +0 -146
- data/vendor/node_modules/irregular-plurals/package.json +0 -39
- data/vendor/node_modules/nodent-compiler/lib/parser.js +0 -291
- data/vendor/node_modules/path-parse/index.min.js +0 -1
- data/vendor/node_modules/path-parse/test.min.js +0 -1
- data/vendor/node_modules/plur/index.js +0 -20
- data/vendor/node_modules/plur/package.json +0 -42
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +0 -116
- data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +0 -90
- data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +0 -217
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +0 -55
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +0 -59
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +0 -65
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +0 -33
- data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +0 -49
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var isWindows=process.platform==="win32";var splitDeviceRe=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var splitTailRe=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;var win32={};function win32SplitPath(b){var a=splitDeviceRe.exec(b),g=(a[1]||"")+(a[2]||""),e=a[3]||"";var d=splitTailRe.exec(e),c=d[1],h=d[2],f=d[3];return[g,c,h,f]}win32.parse=function(b){if(typeof b!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof b)}var a=win32SplitPath(b);if(!a||a.length!==4){throw new TypeError("Invalid path '"+b+"'")}return{root:a[0],dir:a[0]+a[1].slice(0,-1),base:a[2],ext:a[3],name:a[2].slice(0,a[2].length-a[3].length)}};var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var posix={};function posixSplitPath(a){return splitPathRe.exec(a).slice(1)}posix.parse=function(b){if(typeof b!=="string"){throw new TypeError("Parameter 'pathString' must be a string, not "+typeof b)}var a=posixSplitPath(b);if(!a||a.length!==4){throw new TypeError("Invalid path '"+b+"'")}a[1]=a[1]||"";a[2]=a[2]||"";a[3]=a[3]||"";return{root:a[0],dir:a[0]+a[1].slice(0,-1),base:a[2],ext:a[3],name:a[2].slice(0,a[2].length-a[3].length)}};if(isWindows){module.exports=win32.parse}else{module.exports=posix.parse}module.exports.posix=posix.parse;module.exports.win32=win32.parse;
|
@@ -1 +0,0 @@
|
|
1
|
-
var assert=require("assert");var pathParse=require("./index");var winParseTests=[[{root:"C:\\",dir:"C:\\path\\dir",base:"index.html",ext:".html",name:"index"},"C:\\path\\dir\\index.html"],[{root:"C:\\",dir:"C:\\another_path\\DIR\\1\\2\\33",base:"index",ext:"",name:"index"},"C:\\another_path\\DIR\\1\\2\\33\\index"],[{root:"",dir:"another_path\\DIR with spaces\\1\\2\\33",base:"index",ext:"",name:"index"},"another_path\\DIR with spaces\\1\\2\\33\\index"],[{root:"\\",dir:"\\foo",base:"C:",ext:"",name:"C:"},"\\foo\\C:"],[{root:"",dir:"",base:"file",ext:"",name:"file"},"file"],[{root:"",dir:".",base:"file",ext:"",name:"file"},".\\file"],[{root:"\\\\server\\share\\",dir:"\\\\server\\share\\",base:"file_path",ext:"",name:"file_path"},"\\\\server\\share\\file_path"],[{root:"\\\\server two\\shared folder\\",dir:"\\\\server two\\shared folder\\",base:"file path.zip",ext:".zip",name:"file path"},"\\\\server two\\shared folder\\file path.zip"],[{root:"\\\\teela\\admin$\\",dir:"\\\\teela\\admin$\\",base:"system32",ext:"",name:"system32"},"\\\\teela\\admin$\\system32"],[{root:"\\\\?\\UNC\\",dir:"\\\\?\\UNC\\server",base:"share",ext:"",name:"share"},"\\\\?\\UNC\\server\\share"]];var winSpecialCaseFormatTests=[[{dir:"some\\dir"},"some\\dir\\"],[{base:"index.html"},"index.html"],[{},""]];var unixParseTests=[[{root:"/",dir:"/home/user/dir",base:"file.txt",ext:".txt",name:"file"},"/home/user/dir/file.txt"],[{root:"/",dir:"/home/user/a dir",base:"another File.zip",ext:".zip",name:"another File"},"/home/user/a dir/another File.zip"],[{root:"/",dir:"/home/user/a dir/",base:"another&File.",ext:".",name:"another&File"},"/home/user/a dir//another&File."],[{root:"/",dir:"/home/user/a$$$dir/",base:"another File.zip",ext:".zip",name:"another File"},"/home/user/a$$$dir//another File.zip"],[{root:"",dir:"user/dir",base:"another File.zip",ext:".zip",name:"another File"},"user/dir/another File.zip"],[{root:"",dir:"",base:"file",ext:"",name:"file"},"file"],[{root:"",dir:"",base:".\\file",ext:"",name:".\\file"},".\\file"],[{root:"",dir:".",base:"file",ext:"",name:"file"},"./file"],[{root:"",dir:"",base:"C:\\foo",ext:"",name:"C:\\foo"},"C:\\foo"]];var unixSpecialCaseFormatTests=[[{dir:"some/dir"},"some/dir/"],[{base:"index.html"},"index.html"],[{},""]];var errors=[{input:null,message:/Parameter 'pathString' must be a string, not/},{input:{},message:/Parameter 'pathString' must be a string, not object/},{input:true,message:/Parameter 'pathString' must be a string, not boolean/},{input:1,message:/Parameter 'pathString' must be a string, not number/},{input:undefined,message:/Parameter 'pathString' must be a string, not undefined/},];checkParseFormat(pathParse.win32,winParseTests);checkParseFormat(pathParse.posix,unixParseTests);checkErrors(pathParse.win32);checkErrors(pathParse.posix);function checkErrors(a){errors.forEach(function(c){try{a(c.input)}catch(b){assert.ok(b instanceof TypeError);assert.ok(c.message.test(b.message),"expected "+c.message+" to match "+b.message);return}assert.fail("should have thrown")})}function checkParseFormat(b,a){a.forEach(function(c){assert.deepEqual(b(c[1]),c[0])})};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
var irregularPlurals = require('irregular-plurals');
|
3
|
-
|
4
|
-
module.exports = function (str, plural, count) {
|
5
|
-
if (typeof plural === 'number') {
|
6
|
-
count = plural;
|
7
|
-
}
|
8
|
-
|
9
|
-
if (str in irregularPlurals) {
|
10
|
-
plural = irregularPlurals[str];
|
11
|
-
} else if (typeof plural !== 'string') {
|
12
|
-
plural = (str.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's')
|
13
|
-
.replace(/i?e?s$/i, function (m) {
|
14
|
-
var isTailLowerCase = str.slice(-1) === str.slice(-1).toLowerCase();
|
15
|
-
return isTailLowerCase ? m.toLowerCase() : m.toUpperCase();
|
16
|
-
});
|
17
|
-
}
|
18
|
-
|
19
|
-
return count === 1 ? str : plural;
|
20
|
-
};
|
@@ -1,42 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "plur",
|
3
|
-
"version": "2.1.2",
|
4
|
-
"description": "Pluralize a word",
|
5
|
-
"license": "MIT",
|
6
|
-
"repository": "sindresorhus/plur",
|
7
|
-
"author": {
|
8
|
-
"name": "Sindre Sorhus",
|
9
|
-
"email": "sindresorhus@gmail.com",
|
10
|
-
"url": "sindresorhus.com"
|
11
|
-
},
|
12
|
-
"engines": {
|
13
|
-
"node": ">=0.10.0"
|
14
|
-
},
|
15
|
-
"scripts": {
|
16
|
-
"test": "xo && ava"
|
17
|
-
},
|
18
|
-
"files": [
|
19
|
-
"index.js"
|
20
|
-
],
|
21
|
-
"keywords": [
|
22
|
-
"plur",
|
23
|
-
"plural",
|
24
|
-
"plurals",
|
25
|
-
"pluralize",
|
26
|
-
"singular",
|
27
|
-
"count",
|
28
|
-
"word",
|
29
|
-
"string",
|
30
|
-
"str",
|
31
|
-
"irregular",
|
32
|
-
"noun",
|
33
|
-
"nouns"
|
34
|
-
],
|
35
|
-
"dependencies": {
|
36
|
-
"irregular-plurals": "^1.0.0"
|
37
|
-
},
|
38
|
-
"devDependencies": {
|
39
|
-
"ava": "*",
|
40
|
-
"xo": "*"
|
41
|
-
}
|
42
|
-
}
|
@@ -1,116 +0,0 @@
|
|
1
|
-
var isBuffer = require('is-buffer');
|
2
|
-
var toString = Object.prototype.toString;
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Get the native `typeof` a value.
|
6
|
-
*
|
7
|
-
* @param {*} `val`
|
8
|
-
* @return {*} Native javascript type
|
9
|
-
*/
|
10
|
-
|
11
|
-
module.exports = function kindOf(val) {
|
12
|
-
// primitivies
|
13
|
-
if (typeof val === 'undefined') {
|
14
|
-
return 'undefined';
|
15
|
-
}
|
16
|
-
if (val === null) {
|
17
|
-
return 'null';
|
18
|
-
}
|
19
|
-
if (val === true || val === false || val instanceof Boolean) {
|
20
|
-
return 'boolean';
|
21
|
-
}
|
22
|
-
if (typeof val === 'string' || val instanceof String) {
|
23
|
-
return 'string';
|
24
|
-
}
|
25
|
-
if (typeof val === 'number' || val instanceof Number) {
|
26
|
-
return 'number';
|
27
|
-
}
|
28
|
-
|
29
|
-
// functions
|
30
|
-
if (typeof val === 'function' || val instanceof Function) {
|
31
|
-
return 'function';
|
32
|
-
}
|
33
|
-
|
34
|
-
// array
|
35
|
-
if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
|
36
|
-
return 'array';
|
37
|
-
}
|
38
|
-
|
39
|
-
// check for instances of RegExp and Date before calling `toString`
|
40
|
-
if (val instanceof RegExp) {
|
41
|
-
return 'regexp';
|
42
|
-
}
|
43
|
-
if (val instanceof Date) {
|
44
|
-
return 'date';
|
45
|
-
}
|
46
|
-
|
47
|
-
// other objects
|
48
|
-
var type = toString.call(val);
|
49
|
-
|
50
|
-
if (type === '[object RegExp]') {
|
51
|
-
return 'regexp';
|
52
|
-
}
|
53
|
-
if (type === '[object Date]') {
|
54
|
-
return 'date';
|
55
|
-
}
|
56
|
-
if (type === '[object Arguments]') {
|
57
|
-
return 'arguments';
|
58
|
-
}
|
59
|
-
if (type === '[object Error]') {
|
60
|
-
return 'error';
|
61
|
-
}
|
62
|
-
|
63
|
-
// buffer
|
64
|
-
if (isBuffer(val)) {
|
65
|
-
return 'buffer';
|
66
|
-
}
|
67
|
-
|
68
|
-
// es6: Map, WeakMap, Set, WeakSet
|
69
|
-
if (type === '[object Set]') {
|
70
|
-
return 'set';
|
71
|
-
}
|
72
|
-
if (type === '[object WeakSet]') {
|
73
|
-
return 'weakset';
|
74
|
-
}
|
75
|
-
if (type === '[object Map]') {
|
76
|
-
return 'map';
|
77
|
-
}
|
78
|
-
if (type === '[object WeakMap]') {
|
79
|
-
return 'weakmap';
|
80
|
-
}
|
81
|
-
if (type === '[object Symbol]') {
|
82
|
-
return 'symbol';
|
83
|
-
}
|
84
|
-
|
85
|
-
// typed arrays
|
86
|
-
if (type === '[object Int8Array]') {
|
87
|
-
return 'int8array';
|
88
|
-
}
|
89
|
-
if (type === '[object Uint8Array]') {
|
90
|
-
return 'uint8array';
|
91
|
-
}
|
92
|
-
if (type === '[object Uint8ClampedArray]') {
|
93
|
-
return 'uint8clampedarray';
|
94
|
-
}
|
95
|
-
if (type === '[object Int16Array]') {
|
96
|
-
return 'int16array';
|
97
|
-
}
|
98
|
-
if (type === '[object Uint16Array]') {
|
99
|
-
return 'uint16array';
|
100
|
-
}
|
101
|
-
if (type === '[object Int32Array]') {
|
102
|
-
return 'int32array';
|
103
|
-
}
|
104
|
-
if (type === '[object Uint32Array]') {
|
105
|
-
return 'uint32array';
|
106
|
-
}
|
107
|
-
if (type === '[object Float32Array]') {
|
108
|
-
return 'float32array';
|
109
|
-
}
|
110
|
-
if (type === '[object Float64Array]') {
|
111
|
-
return 'float64array';
|
112
|
-
}
|
113
|
-
|
114
|
-
// must be a plain object
|
115
|
-
return 'object';
|
116
|
-
};
|
data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "kind-of",
|
3
|
-
"description": "Get the native type of a value.",
|
4
|
-
"version": "3.2.2",
|
5
|
-
"homepage": "https://github.com/jonschlinkert/kind-of",
|
6
|
-
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
7
|
-
"contributors": [
|
8
|
-
"David Fox-Powell (https://dtothefp.github.io/me)",
|
9
|
-
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
|
10
|
-
"Ken Sheedlo (kensheedlo.com)",
|
11
|
-
"laggingreflex (https://github.com/laggingreflex)",
|
12
|
-
"Miguel Mota (https://miguelmota.com)",
|
13
|
-
"Peter deHaan (http://about.me/peterdehaan)"
|
14
|
-
],
|
15
|
-
"repository": "jonschlinkert/kind-of",
|
16
|
-
"bugs": {
|
17
|
-
"url": "https://github.com/jonschlinkert/kind-of/issues"
|
18
|
-
},
|
19
|
-
"license": "MIT",
|
20
|
-
"files": [
|
21
|
-
"index.js"
|
22
|
-
],
|
23
|
-
"main": "index.js",
|
24
|
-
"engines": {
|
25
|
-
"node": ">=0.10.0"
|
26
|
-
},
|
27
|
-
"scripts": {
|
28
|
-
"test": "mocha",
|
29
|
-
"prepublish": "browserify -o browser.js -e index.js -s index --bare"
|
30
|
-
},
|
31
|
-
"dependencies": {
|
32
|
-
"is-buffer": "^1.1.5"
|
33
|
-
},
|
34
|
-
"devDependencies": {
|
35
|
-
"ansi-bold": "^0.1.1",
|
36
|
-
"benchmarked": "^1.0.0",
|
37
|
-
"browserify": "^14.3.0",
|
38
|
-
"glob": "^7.1.1",
|
39
|
-
"gulp-format-md": "^0.1.12",
|
40
|
-
"mocha": "^3.3.0",
|
41
|
-
"type-of": "^2.0.1",
|
42
|
-
"typeof": "^1.0.0"
|
43
|
-
},
|
44
|
-
"keywords": [
|
45
|
-
"arguments",
|
46
|
-
"array",
|
47
|
-
"boolean",
|
48
|
-
"check",
|
49
|
-
"date",
|
50
|
-
"function",
|
51
|
-
"is",
|
52
|
-
"is-type",
|
53
|
-
"is-type-of",
|
54
|
-
"kind",
|
55
|
-
"kind-of",
|
56
|
-
"number",
|
57
|
-
"object",
|
58
|
-
"of",
|
59
|
-
"regexp",
|
60
|
-
"string",
|
61
|
-
"test",
|
62
|
-
"type",
|
63
|
-
"type-of",
|
64
|
-
"typeof",
|
65
|
-
"types"
|
66
|
-
],
|
67
|
-
"verb": {
|
68
|
-
"related": {
|
69
|
-
"list": [
|
70
|
-
"is-glob",
|
71
|
-
"is-number",
|
72
|
-
"is-primitive"
|
73
|
-
]
|
74
|
-
},
|
75
|
-
"toc": false,
|
76
|
-
"layout": "default",
|
77
|
-
"tasks": [
|
78
|
-
"readme"
|
79
|
-
],
|
80
|
-
"plugins": [
|
81
|
-
"gulp-format-md"
|
82
|
-
],
|
83
|
-
"lint": {
|
84
|
-
"reflinks": true
|
85
|
-
},
|
86
|
-
"reflinks": [
|
87
|
-
"verb"
|
88
|
-
]
|
89
|
-
}
|
90
|
-
}
|
@@ -1,217 +0,0 @@
|
|
1
|
-
import { walk } from 'estree-walker';
|
2
|
-
import { sep, resolve } from 'path';
|
3
|
-
import { Minimatch } from 'minimatch';
|
4
|
-
|
5
|
-
function basename ( path ) {
|
6
|
-
return path.split( /(\/|\\)/ ).pop();
|
7
|
-
}
|
8
|
-
|
9
|
-
function extname ( path ) {
|
10
|
-
var match = /\.[^\.]+$/.exec( basename( path ) );
|
11
|
-
if ( !match ) return '';
|
12
|
-
return match[0];
|
13
|
-
}
|
14
|
-
|
15
|
-
function addExtension ( filename, ext ) {
|
16
|
-
if ( ext === void 0 ) ext = '.js';
|
17
|
-
|
18
|
-
if ( !extname( filename ) ) filename += ext;
|
19
|
-
return filename;
|
20
|
-
}
|
21
|
-
|
22
|
-
var blockDeclarations = {
|
23
|
-
'const': true,
|
24
|
-
'let': true
|
25
|
-
};
|
26
|
-
|
27
|
-
var extractors = {
|
28
|
-
Identifier: function Identifier ( names, param ) {
|
29
|
-
names.push( param.name );
|
30
|
-
},
|
31
|
-
|
32
|
-
ObjectPattern: function ObjectPattern ( names, param ) {
|
33
|
-
param.properties.forEach( function (prop) {
|
34
|
-
extractors[ prop.key.type ]( names, prop.key );
|
35
|
-
});
|
36
|
-
},
|
37
|
-
|
38
|
-
ArrayPattern: function ArrayPattern ( names, param ) {
|
39
|
-
param.elements.forEach( function (element) {
|
40
|
-
if ( element ) extractors[ element.type ]( names, element );
|
41
|
-
});
|
42
|
-
},
|
43
|
-
|
44
|
-
RestElement: function RestElement ( names, param ) {
|
45
|
-
extractors[ param.argument.type ]( names, param.argument );
|
46
|
-
},
|
47
|
-
|
48
|
-
AssignmentPattern: function AssignmentPattern ( names, param ) {
|
49
|
-
return extractors[ param.left.type ]( names, param.left );
|
50
|
-
}
|
51
|
-
};
|
52
|
-
|
53
|
-
function extractNames ( param ) {
|
54
|
-
var names = [];
|
55
|
-
|
56
|
-
extractors[ param.type ]( names, param );
|
57
|
-
return names;
|
58
|
-
}
|
59
|
-
|
60
|
-
var Scope = function Scope ( options ) {
|
61
|
-
var this$1 = this;
|
62
|
-
|
63
|
-
options = options || {};
|
64
|
-
|
65
|
-
this.parent = options.parent;
|
66
|
-
this.isBlockScope = !!options.block;
|
67
|
-
|
68
|
-
this.declarations = Object.create( null );
|
69
|
-
|
70
|
-
if ( options.params ) {
|
71
|
-
options.params.forEach( function (param) {
|
72
|
-
extractNames( param ).forEach( function (name) {
|
73
|
-
this$1.declarations[ name ] = true;
|
74
|
-
});
|
75
|
-
});
|
76
|
-
}
|
77
|
-
};
|
78
|
-
|
79
|
-
Scope.prototype.addDeclaration = function addDeclaration ( node, isBlockDeclaration, isVar ) {
|
80
|
-
var this$1 = this;
|
81
|
-
|
82
|
-
if ( !isBlockDeclaration && this.isBlockScope ) {
|
83
|
-
// it's a `var` or function node, and this
|
84
|
-
// is a block scope, so we need to go up
|
85
|
-
this.parent.addDeclaration( node, isBlockDeclaration, isVar );
|
86
|
-
} else {
|
87
|
-
extractNames( node.id ).forEach( function (name) {
|
88
|
-
this$1.declarations[ name ] = true;
|
89
|
-
});
|
90
|
-
}
|
91
|
-
};
|
92
|
-
|
93
|
-
Scope.prototype.contains = function contains ( name ) {
|
94
|
-
return this.declarations[ name ] ||
|
95
|
-
( this.parent ? this.parent.contains( name ) : false );
|
96
|
-
};
|
97
|
-
|
98
|
-
|
99
|
-
function attachScopes ( ast, propertyName ) {
|
100
|
-
if ( propertyName === void 0 ) propertyName = 'scope';
|
101
|
-
|
102
|
-
var scope = new Scope();
|
103
|
-
|
104
|
-
walk( ast, {
|
105
|
-
enter: function enter ( node, parent ) {
|
106
|
-
// function foo () {...}
|
107
|
-
// class Foo {...}
|
108
|
-
if ( /(Function|Class)Declaration/.test( node.type ) ) {
|
109
|
-
scope.addDeclaration( node, false, false );
|
110
|
-
}
|
111
|
-
|
112
|
-
// var foo = 1
|
113
|
-
if ( node.type === 'VariableDeclaration' ) {
|
114
|
-
var isBlockDeclaration = blockDeclarations[ node.kind ];
|
115
|
-
|
116
|
-
node.declarations.forEach( function (declaration) {
|
117
|
-
scope.addDeclaration( declaration, isBlockDeclaration, true );
|
118
|
-
});
|
119
|
-
}
|
120
|
-
|
121
|
-
var newScope;
|
122
|
-
|
123
|
-
// create new function scope
|
124
|
-
if ( /Function/.test( node.type ) ) {
|
125
|
-
newScope = new Scope({
|
126
|
-
parent: scope,
|
127
|
-
block: false,
|
128
|
-
params: node.params
|
129
|
-
});
|
130
|
-
|
131
|
-
// named function expressions - the name is considered
|
132
|
-
// part of the function's scope
|
133
|
-
if ( node.type === 'FunctionExpression' && node.id ) {
|
134
|
-
newScope.addDeclaration( node, false, false );
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
// create new block scope
|
139
|
-
if ( node.type === 'BlockStatement' && !/Function/.test( parent.type ) ) {
|
140
|
-
newScope = new Scope({
|
141
|
-
parent: scope,
|
142
|
-
block: true
|
143
|
-
});
|
144
|
-
}
|
145
|
-
|
146
|
-
// catch clause has its own block scope
|
147
|
-
if ( node.type === 'CatchClause' ) {
|
148
|
-
newScope = new Scope({
|
149
|
-
parent: scope,
|
150
|
-
params: [ node.param ],
|
151
|
-
block: true
|
152
|
-
});
|
153
|
-
}
|
154
|
-
|
155
|
-
if ( newScope ) {
|
156
|
-
Object.defineProperty( node, propertyName, {
|
157
|
-
value: newScope,
|
158
|
-
configurable: true
|
159
|
-
});
|
160
|
-
|
161
|
-
scope = newScope;
|
162
|
-
}
|
163
|
-
},
|
164
|
-
leave: function leave ( node ) {
|
165
|
-
if ( node[ propertyName ] ) scope = scope.parent;
|
166
|
-
}
|
167
|
-
});
|
168
|
-
|
169
|
-
return scope;
|
170
|
-
}
|
171
|
-
|
172
|
-
function ensureArray ( thing ) {
|
173
|
-
if ( Array.isArray( thing ) ) return thing;
|
174
|
-
if ( thing == undefined ) return [];
|
175
|
-
return [ thing ];
|
176
|
-
}
|
177
|
-
|
178
|
-
function createFilter ( include, exclude ) {
|
179
|
-
include = ensureArray( include ).map( function (id) { return resolve( id ); } ).map( function (id) { return new Minimatch(id); } );
|
180
|
-
exclude = ensureArray( exclude ).map( function (id) { return resolve( id ); } ).map( function (id) { return new Minimatch(id); } );
|
181
|
-
|
182
|
-
return function ( id ) {
|
183
|
-
if ( typeof id !== 'string' ) return false;
|
184
|
-
if ( /\0/.test( id ) ) return false;
|
185
|
-
|
186
|
-
var included = !include.length;
|
187
|
-
id = id.split(sep).join('/');
|
188
|
-
|
189
|
-
include.forEach( function (minimatch) {
|
190
|
-
if ( minimatch.match( id ) ) included = true;
|
191
|
-
});
|
192
|
-
|
193
|
-
exclude.forEach( function (minimatch) {
|
194
|
-
if ( minimatch.match( id ) ) included = false;
|
195
|
-
});
|
196
|
-
|
197
|
-
return included;
|
198
|
-
};
|
199
|
-
}
|
200
|
-
|
201
|
-
var reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split( ' ' );
|
202
|
-
var builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split( ' ' );
|
203
|
-
|
204
|
-
var blacklisted = Object.create( null );
|
205
|
-
reservedWords.concat( builtins ).forEach( function (word) { return blacklisted[ word ] = true; } );
|
206
|
-
|
207
|
-
function makeLegalIdentifier ( str ) {
|
208
|
-
str = str
|
209
|
-
.replace( /-(\w)/g, function ( _, letter ) { return letter.toUpperCase(); } )
|
210
|
-
.replace( /[^$_a-zA-Z0-9]/g, '_' );
|
211
|
-
|
212
|
-
if ( /\d/.test( str[0] ) || blacklisted[ str ] ) str = "_" + str;
|
213
|
-
|
214
|
-
return str;
|
215
|
-
}
|
216
|
-
|
217
|
-
export { addExtension, attachScopes, createFilter, makeLegalIdentifier };
|