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
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -84,14 +84,14 @@ dependencies:
|
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
87
|
+
version: 10.0.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
94
|
+
version: 10.0.0
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: minitest
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -253,6 +253,7 @@ files:
|
|
253
253
|
- vendor/node_modules/builtin-modules/package.json
|
254
254
|
- vendor/node_modules/builtin-modules/static.js
|
255
255
|
- vendor/node_modules/chalk/index.js
|
256
|
+
- vendor/node_modules/chalk/index.js.flow
|
256
257
|
- vendor/node_modules/chalk/package.json
|
257
258
|
- vendor/node_modules/chalk/templates.js
|
258
259
|
- vendor/node_modules/chalk/types/index.d.ts
|
@@ -269,6 +270,7 @@ files:
|
|
269
270
|
- vendor/node_modules/escape-string-regexp/package.json
|
270
271
|
- vendor/node_modules/estree-walker/dist/estree-walker.es.js
|
271
272
|
- vendor/node_modules/estree-walker/dist/estree-walker.umd.js
|
273
|
+
- vendor/node_modules/estree-walker/index.d.ts
|
272
274
|
- vendor/node_modules/estree-walker/package.json
|
273
275
|
- vendor/node_modules/estree-walker/src/estree-walker.js
|
274
276
|
- vendor/node_modules/expand-brackets/index.js
|
@@ -292,8 +294,6 @@ files:
|
|
292
294
|
- vendor/node_modules/glob-parent/test.js
|
293
295
|
- vendor/node_modules/has-flag/index.js
|
294
296
|
- vendor/node_modules/has-flag/package.json
|
295
|
-
- vendor/node_modules/irregular-plurals/irregular-plurals.json
|
296
|
-
- vendor/node_modules/irregular-plurals/package.json
|
297
297
|
- vendor/node_modules/is-buffer/index.js
|
298
298
|
- vendor/node_modules/is-buffer/package.json
|
299
299
|
- vendor/node_modules/is-dotfile/index.js
|
@@ -317,6 +317,8 @@ files:
|
|
317
317
|
- vendor/node_modules/is-reference/dist/is-reference.es.js
|
318
318
|
- vendor/node_modules/is-reference/dist/is-reference.js
|
319
319
|
- vendor/node_modules/is-reference/dist/types/index.d.ts
|
320
|
+
- vendor/node_modules/is-reference/node_modules/@types/estree/index.d.ts
|
321
|
+
- vendor/node_modules/is-reference/node_modules/@types/estree/package.json
|
320
322
|
- vendor/node_modules/is-reference/package.json
|
321
323
|
- vendor/node_modules/isarray/index.js
|
322
324
|
- vendor/node_modules/isarray/package.json
|
@@ -337,6 +339,10 @@ files:
|
|
337
339
|
- vendor/node_modules/magic-string/node_modules/vlq/package.json
|
338
340
|
- vendor/node_modules/magic-string/node_modules/vlq/src/vlq.js
|
339
341
|
- vendor/node_modules/magic-string/package.json
|
342
|
+
- vendor/node_modules/math-random/browser.js
|
343
|
+
- vendor/node_modules/math-random/node.js
|
344
|
+
- vendor/node_modules/math-random/package.json
|
345
|
+
- vendor/node_modules/math-random/test.js
|
340
346
|
- vendor/node_modules/micromatch/index.js
|
341
347
|
- vendor/node_modules/micromatch/lib/chars.js
|
342
348
|
- vendor/node_modules/micromatch/lib/expand.js
|
@@ -346,10 +352,10 @@ files:
|
|
346
352
|
- vendor/node_modules/minimist/index.js
|
347
353
|
- vendor/node_modules/minimist/package.json
|
348
354
|
- vendor/node_modules/nodent-compiler/compiler.js
|
349
|
-
- vendor/node_modules/nodent-compiler/
|
350
|
-
- vendor/node_modules/nodent-compiler/lib/output.js
|
351
|
-
- vendor/node_modules/nodent-compiler/lib/parser.js
|
355
|
+
- vendor/node_modules/nodent-compiler/output.js
|
352
356
|
- vendor/node_modules/nodent-compiler/package.json
|
357
|
+
- vendor/node_modules/nodent-transform/arboriculture.js
|
358
|
+
- vendor/node_modules/nodent-transform/package.json
|
353
359
|
- vendor/node_modules/normalize-path/index.js
|
354
360
|
- vendor/node_modules/normalize-path/package.json
|
355
361
|
- vendor/node_modules/object.omit/index.js
|
@@ -361,12 +367,8 @@ files:
|
|
361
367
|
- vendor/node_modules/parse-ms/index.js
|
362
368
|
- vendor/node_modules/parse-ms/package.json
|
363
369
|
- vendor/node_modules/path-parse/index.js
|
364
|
-
- vendor/node_modules/path-parse/index.min.js
|
365
370
|
- vendor/node_modules/path-parse/package.json
|
366
371
|
- vendor/node_modules/path-parse/test.js
|
367
|
-
- vendor/node_modules/path-parse/test.min.js
|
368
|
-
- vendor/node_modules/plur/index.js
|
369
|
-
- vendor/node_modules/plur/package.json
|
370
372
|
- vendor/node_modules/preserve/index.js
|
371
373
|
- vendor/node_modules/preserve/package.json
|
372
374
|
- vendor/node_modules/preserve/test.js
|
@@ -374,8 +376,6 @@ files:
|
|
374
376
|
- vendor/node_modules/pretty-ms/package.json
|
375
377
|
- vendor/node_modules/randomatic/index.js
|
376
378
|
- vendor/node_modules/randomatic/node_modules/is-number/index.js
|
377
|
-
- vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js
|
378
|
-
- vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json
|
379
379
|
- vendor/node_modules/randomatic/node_modules/is-number/package.json
|
380
380
|
- vendor/node_modules/randomatic/node_modules/kind-of/index.js
|
381
381
|
- vendor/node_modules/randomatic/node_modules/kind-of/package.json
|
@@ -414,16 +414,11 @@ files:
|
|
414
414
|
- vendor/node_modules/rollup-plugin-node-resolve/src/index.js
|
415
415
|
- vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js
|
416
416
|
- vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js
|
417
|
-
- vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js
|
418
|
-
- vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js
|
419
|
-
- vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js
|
420
|
-
- vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js
|
421
|
-
- vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json
|
422
|
-
- vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js
|
423
417
|
- vendor/node_modules/rollup-pluginutils/package.json
|
424
418
|
- vendor/node_modules/rollup-pluginutils/src/addExtension.js
|
425
419
|
- vendor/node_modules/rollup-pluginutils/src/attachScopes.js
|
426
420
|
- vendor/node_modules/rollup-pluginutils/src/createFilter.js
|
421
|
+
- vendor/node_modules/rollup-pluginutils/src/dataToEsm.js
|
427
422
|
- vendor/node_modules/rollup-pluginutils/src/index.js
|
428
423
|
- vendor/node_modules/rollup-pluginutils/src/makeLegalIdentifier.js
|
429
424
|
- vendor/node_modules/rollup-pluginutils/src/utils/ensureArray.js
|
@@ -1,146 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"addendum": "addenda",
|
3
|
-
"aircraft": "aircraft",
|
4
|
-
"alga": "algae",
|
5
|
-
"alumna": "alumnae",
|
6
|
-
"alumnus": "alumni",
|
7
|
-
"amoeba": "amoebae",
|
8
|
-
"analysis": "analyses",
|
9
|
-
"antenna": "antennae",
|
10
|
-
"antithesis": "antitheses",
|
11
|
-
"apex": "apices",
|
12
|
-
"appendix": "appendices",
|
13
|
-
"automaton": "automata",
|
14
|
-
"axis": "axes",
|
15
|
-
"bacillus": "bacilli",
|
16
|
-
"bacterium": "bacteria",
|
17
|
-
"barracks": "barracks",
|
18
|
-
"basis": "bases",
|
19
|
-
"beau": "beaux",
|
20
|
-
"bison": "bison",
|
21
|
-
"buffalo": "buffalo",
|
22
|
-
"bureau": "bureaus",
|
23
|
-
"cactus": "cacti",
|
24
|
-
"calf": "calves",
|
25
|
-
"carp": "carp",
|
26
|
-
"census": "censuses",
|
27
|
-
"chassis": "chassis",
|
28
|
-
"cherub": "cherubim",
|
29
|
-
"child": "children",
|
30
|
-
"château": "châteaus",
|
31
|
-
"cod": "cod",
|
32
|
-
"codex": "codices",
|
33
|
-
"concerto": "concerti",
|
34
|
-
"corpus": "corpora",
|
35
|
-
"crisis": "crises",
|
36
|
-
"criterion": "criteria",
|
37
|
-
"curriculum": "curricula",
|
38
|
-
"datum": "data",
|
39
|
-
"deer": "deer",
|
40
|
-
"diagnosis": "diagnoses",
|
41
|
-
"die": "dice",
|
42
|
-
"dwarf": "dwarfs",
|
43
|
-
"echo": "echoes",
|
44
|
-
"elf": "elves",
|
45
|
-
"elk": "elk",
|
46
|
-
"ellipsis": "ellipses",
|
47
|
-
"embargo": "embargoes",
|
48
|
-
"emphasis": "emphases",
|
49
|
-
"erratum": "errata",
|
50
|
-
"faux pas": "faux pas",
|
51
|
-
"fez": "fezes",
|
52
|
-
"firmware": "firmware",
|
53
|
-
"fish": "fish",
|
54
|
-
"focus": "foci",
|
55
|
-
"foot": "feet",
|
56
|
-
"formula": "formulae",
|
57
|
-
"fungus": "fungi",
|
58
|
-
"gallows": "gallows",
|
59
|
-
"genus": "genera",
|
60
|
-
"goose": "geese",
|
61
|
-
"graffito": "graffiti",
|
62
|
-
"grouse": "grouse",
|
63
|
-
"half": "halves",
|
64
|
-
"hero": "heroes",
|
65
|
-
"hoof": "hooves",
|
66
|
-
"hovercraft": "hovercraft",
|
67
|
-
"hypothesis": "hypotheses",
|
68
|
-
"index": "indices",
|
69
|
-
"kakapo": "kakapo",
|
70
|
-
"knife": "knives",
|
71
|
-
"larva": "larvae",
|
72
|
-
"leaf": "leaves",
|
73
|
-
"libretto": "libretti",
|
74
|
-
"life": "lives",
|
75
|
-
"loaf": "loaves",
|
76
|
-
"locus": "loci",
|
77
|
-
"louse": "lice",
|
78
|
-
"man": "men",
|
79
|
-
"matrix": "matrices",
|
80
|
-
"means": "means",
|
81
|
-
"medium": "media",
|
82
|
-
"memorandum": "memoranda",
|
83
|
-
"millennium": "millennia",
|
84
|
-
"minutia": "minutiae",
|
85
|
-
"moose": "moose",
|
86
|
-
"mouse": "mice",
|
87
|
-
"nebula": "nebulae",
|
88
|
-
"nemesis": "nemeses",
|
89
|
-
"neurosis": "neuroses",
|
90
|
-
"news": "news",
|
91
|
-
"nucleus": "nuclei",
|
92
|
-
"oasis": "oases",
|
93
|
-
"offspring": "offspring",
|
94
|
-
"opus": "opera",
|
95
|
-
"ovum": "ova",
|
96
|
-
"ox": "oxen",
|
97
|
-
"paralysis": "paralyses",
|
98
|
-
"parenthesis": "parentheses",
|
99
|
-
"person": "people",
|
100
|
-
"phenomenon": "phenomena",
|
101
|
-
"phylum": "phyla",
|
102
|
-
"pike": "pike",
|
103
|
-
"polyhedron": "polyhedra",
|
104
|
-
"potato": "potatoes",
|
105
|
-
"prognosis": "prognoses",
|
106
|
-
"quiz": "quizzes",
|
107
|
-
"radius": "radii",
|
108
|
-
"referendum": "referenda",
|
109
|
-
"salmon": "salmon",
|
110
|
-
"scarf": "scarves",
|
111
|
-
"self": "selves",
|
112
|
-
"series": "series",
|
113
|
-
"sheep": "sheep",
|
114
|
-
"shelf": "shelves",
|
115
|
-
"shrimp": "shrimp",
|
116
|
-
"spacecraft": "spacecraft",
|
117
|
-
"species": "species",
|
118
|
-
"spectrum": "spectra",
|
119
|
-
"squid": "squid",
|
120
|
-
"stimulus": "stimuli",
|
121
|
-
"stratum": "strata",
|
122
|
-
"swine": "swine",
|
123
|
-
"syllabus": "syllabi",
|
124
|
-
"symposium": "symposia",
|
125
|
-
"synopsis": "synopses",
|
126
|
-
"synthesis": "syntheses",
|
127
|
-
"tableau": "tableaus",
|
128
|
-
"that": "those",
|
129
|
-
"thesis": "theses",
|
130
|
-
"thief": "thieves",
|
131
|
-
"this": "these",
|
132
|
-
"tomato": "tomatoes",
|
133
|
-
"tooth": "teeth",
|
134
|
-
"trout": "trout",
|
135
|
-
"tuna": "tuna",
|
136
|
-
"vertebra": "vertebrae",
|
137
|
-
"vertex": "vertices",
|
138
|
-
"veto": "vetoes",
|
139
|
-
"vita": "vitae",
|
140
|
-
"vortex": "vortices",
|
141
|
-
"watercraft": "watercraft",
|
142
|
-
"wharf": "wharves",
|
143
|
-
"wife": "wives",
|
144
|
-
"wolf": "wolves",
|
145
|
-
"woman": "women"
|
146
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "irregular-plurals",
|
3
|
-
"version": "1.4.0",
|
4
|
-
"description": "Map of nouns to their irregular plural form",
|
5
|
-
"license": "MIT",
|
6
|
-
"repository": "sindresorhus/irregular-plurals",
|
7
|
-
"author": {
|
8
|
-
"name": "Sindre Sorhus",
|
9
|
-
"email": "sindresorhus@gmail.com",
|
10
|
-
"url": "sindresorhus.com"
|
11
|
-
},
|
12
|
-
"main": "irregular-plurals.json",
|
13
|
-
"engines": {
|
14
|
-
"node": ">=0.10.0"
|
15
|
-
},
|
16
|
-
"scripts": {
|
17
|
-
"test": "xo && ava"
|
18
|
-
},
|
19
|
-
"files": [
|
20
|
-
"irregular-plurals.json"
|
21
|
-
],
|
22
|
-
"keywords": [
|
23
|
-
"word",
|
24
|
-
"words",
|
25
|
-
"list",
|
26
|
-
"map",
|
27
|
-
"hash",
|
28
|
-
"json",
|
29
|
-
"irregular",
|
30
|
-
"plural",
|
31
|
-
"plurals",
|
32
|
-
"noun",
|
33
|
-
"nouns"
|
34
|
-
],
|
35
|
-
"devDependencies": {
|
36
|
-
"ava": "*",
|
37
|
-
"xo": "*"
|
38
|
-
}
|
39
|
-
}
|
@@ -1,291 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var acorn = require("acorn");
|
4
|
-
var acornWalk = require("acorn/dist/walk");
|
5
|
-
|
6
|
-
var walkers = {
|
7
|
-
AwaitExpression: function (node, st, c) {
|
8
|
-
c(node.argument, st, "Expression");
|
9
|
-
},
|
10
|
-
SwitchStatement: function (node, st, c) {
|
11
|
-
c(node.discriminant, st, "Expression");
|
12
|
-
for (var i = 0; i < node.cases.length; ++i) {
|
13
|
-
c(node.cases[i],st) ;
|
14
|
-
}
|
15
|
-
},
|
16
|
-
SwitchCase: function (node, st, c) {
|
17
|
-
if (node.test) c(node.test, st, "Expression");
|
18
|
-
for (var i = 0; i < node.consequent.length; ++i) {
|
19
|
-
c(node.consequent[i], st, "Statement");
|
20
|
-
}
|
21
|
-
},
|
22
|
-
TryStatement: function (node, st, c) {
|
23
|
-
c(node.block, st, "Statement");
|
24
|
-
if (node.handler) c(node.handler, st, "Statement");
|
25
|
-
if (node.finalizer) c(node.finalizer, st, "Statement");
|
26
|
-
},
|
27
|
-
CatchClause: function (node, st, c) {
|
28
|
-
c(node.param, st, "Pattern");
|
29
|
-
c(node.body, st, "ScopeBody");
|
30
|
-
},
|
31
|
-
Class: function (node, st, c) {
|
32
|
-
if (node.id) c(node.id, st, "Pattern");
|
33
|
-
if (node.superClass) c(node.superClass, st, "Expression");
|
34
|
-
c(node.body, st);
|
35
|
-
},
|
36
|
-
ClassBody: function(node, st, c){
|
37
|
-
for (var i = 0; i < node.body.length; i++) {
|
38
|
-
c(node.body[i], st);
|
39
|
-
}
|
40
|
-
},
|
41
|
-
ObjectPattern: function (node, st, c) {
|
42
|
-
for (var i = 0, list = node.properties; i < list.length; i += 1)
|
43
|
-
c(list[i], st, "Property");
|
44
|
-
},
|
45
|
-
/* Babel extensions */
|
46
|
-
ClassProperty: function(node,st,c){
|
47
|
-
if (node.key) c(node.key, st, "Expression");
|
48
|
-
if (node.value) c(node.value, st, "Expression");
|
49
|
-
},
|
50
|
-
ClassMethod: function(node,st,c){
|
51
|
-
if (node.key) c(node.key, st, "Expression");
|
52
|
-
c(node, st, "Function");
|
53
|
-
},
|
54
|
-
ObjectProperty: function(node,st,c){
|
55
|
-
if (node.key) c(node.key, st, "Expression");
|
56
|
-
if (node.value) c(node.value, st, "Expression");
|
57
|
-
},
|
58
|
-
ObjectMethod: function(node,st,c){
|
59
|
-
if (node.key) c(node.key, st, "Expression");
|
60
|
-
c(node, st, "Function");
|
61
|
-
}
|
62
|
-
} ;
|
63
|
-
|
64
|
-
var acornBase = acornWalk.make(walkers) ;
|
65
|
-
|
66
|
-
function loc(old,repl){
|
67
|
-
['start','end','loc','range'].forEach(function(k){
|
68
|
-
if (k in old && !(k in repl))
|
69
|
-
repl[k] = old[k] ;
|
70
|
-
}) ;
|
71
|
-
}
|
72
|
-
|
73
|
-
var referencePrototypes = {
|
74
|
-
replace: function(newNode) {
|
75
|
-
if (Array.isArray(newNode) && newNode.length===1) newNode = newNode[0] ;
|
76
|
-
if ('index' in this) {
|
77
|
-
loc(this.parent[this.field][this.index], newNode);
|
78
|
-
if (Array.isArray(newNode)) {
|
79
|
-
[].splice.apply(this.parent[this.field],[this.index,1].concat(newNode)) ;
|
80
|
-
} else {
|
81
|
-
this.parent[this.field][this.index] = newNode ;
|
82
|
-
}
|
83
|
-
} else {
|
84
|
-
loc(this.parent[this.field], newNode);
|
85
|
-
if (Array.isArray(newNode)) {
|
86
|
-
this.parent[this.field] = {type:'BlockStatement',body:newNode} ;
|
87
|
-
} else {
|
88
|
-
this.parent[this.field] = newNode ;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
return this.self ;
|
92
|
-
},
|
93
|
-
append: function(newNode) {
|
94
|
-
if (Array.isArray(newNode) && newNode.length===1) newNode = newNode[0] ;
|
95
|
-
if ('index' in this) {
|
96
|
-
if (Array.isArray(newNode)) {
|
97
|
-
[].splice.apply(this.parent[this.field],[this.index+1,0].concat(newNode)) ;
|
98
|
-
} else {
|
99
|
-
this.parent[this.field].splice(this.index+1,0,newNode) ;
|
100
|
-
}
|
101
|
-
} else {
|
102
|
-
throw new Error("Cannot append Element node to non-array") ;
|
103
|
-
}
|
104
|
-
return this.self ;
|
105
|
-
},
|
106
|
-
index: function(){
|
107
|
-
return this.parent[this.field].indexOf(this.self) ;
|
108
|
-
},
|
109
|
-
removeElement: function() {
|
110
|
-
return this.parent[this.field].splice(this.index,1)[0] ;
|
111
|
-
},
|
112
|
-
removeNode: function() {
|
113
|
-
var r = this.parent[this.field] ;
|
114
|
-
delete this.parent[this.field] ;
|
115
|
-
return r ;
|
116
|
-
}
|
117
|
-
};
|
118
|
-
|
119
|
-
function treeWalker(n,walker,state){
|
120
|
-
if (!state) {
|
121
|
-
state = [{self:n}] ;
|
122
|
-
state.replace = function(pos,newNode) {
|
123
|
-
state[pos].replace(newNode) ;
|
124
|
-
}
|
125
|
-
}
|
126
|
-
|
127
|
-
function goDown(ref) {
|
128
|
-
ref.replace = referencePrototypes.replace ;
|
129
|
-
ref.append = referencePrototypes.append ;
|
130
|
-
if (ref.index) {
|
131
|
-
Object.defineProperties(ref, {index:{enumerable:true,get:referencePrototypes.index}}) ;
|
132
|
-
ref.remove = referencePrototypes.removeElement ;
|
133
|
-
} else {
|
134
|
-
ref.remove = referencePrototypes.removeNode ;
|
135
|
-
}
|
136
|
-
state.unshift(ref) ;
|
137
|
-
treeWalker(ref.self,walker,state) ;
|
138
|
-
state.shift() ;
|
139
|
-
}
|
140
|
-
|
141
|
-
function descend() {
|
142
|
-
if (!(n.type in acornBase)) {
|
143
|
-
// We don't know what type of node this is - it's not in the ESTree spec,
|
144
|
-
// (maybe a 'react' extension?), so just ignore it
|
145
|
-
} else {
|
146
|
-
acornBase[n.type](n,state,function down(sub,_,derivedFrom){
|
147
|
-
if (sub===n)
|
148
|
-
return acornBase[derivedFrom || n.type](n,state,down) ;
|
149
|
-
|
150
|
-
var keys = Object.keys(n) ;
|
151
|
-
for (var i=0; i<keys.length; i++){
|
152
|
-
var v = n[keys[i]] ;
|
153
|
-
if (Array.isArray(v)) {
|
154
|
-
if (v.indexOf(sub)>=0) {
|
155
|
-
goDown({
|
156
|
-
self:sub,
|
157
|
-
parent:n,
|
158
|
-
field:keys[i],
|
159
|
-
index:true
|
160
|
-
}) ;
|
161
|
-
}
|
162
|
-
} else if (v instanceof Object && sub===v) {
|
163
|
-
goDown({
|
164
|
-
self:sub,
|
165
|
-
parent:n,
|
166
|
-
field:keys[i]
|
167
|
-
}) ;
|
168
|
-
}
|
169
|
-
}
|
170
|
-
}) ;
|
171
|
-
}
|
172
|
-
} ;
|
173
|
-
walker(n,descend,state) ;
|
174
|
-
return n ;
|
175
|
-
}
|
176
|
-
|
177
|
-
var alreadyInstalledPlugin = false ;
|
178
|
-
|
179
|
-
function acornParse(code,config) {
|
180
|
-
var comments = [] ;
|
181
|
-
var options = {
|
182
|
-
ecmaVersion:8,
|
183
|
-
allowHashBang:true,
|
184
|
-
allowReturnOutsideFunction:true,
|
185
|
-
allowImportExportEverywhere:true,
|
186
|
-
locations:true,
|
187
|
-
onComment:comments
|
188
|
-
} ;
|
189
|
-
|
190
|
-
if (config)
|
191
|
-
for (var k in config)
|
192
|
-
if (k !== 'noNodentExtensions' && k != 'onParserInstallation')
|
193
|
-
options[k] = config[k] ;
|
194
|
-
|
195
|
-
if (!(config && config.noNodentExtensions) || parseInt(acorn.version) < 4) {
|
196
|
-
if (!alreadyInstalledPlugin) {
|
197
|
-
if (parseInt(acorn.version) < 4)
|
198
|
-
console.warn("Nodent: Warning - noNodentExtensions option requires acorn >=v4.x. Extensions installed.") ;
|
199
|
-
require('acorn-es7-plugin')(acorn) ;
|
200
|
-
if (config && config.onParserInstallation) config.onParserInstallation(acorn) ;
|
201
|
-
alreadyInstalledPlugin = true ;
|
202
|
-
}
|
203
|
-
options.plugins = options.plugins || {} ;
|
204
|
-
options.plugins.asyncawait = {asyncExits:true, awaitAnywhere:true} ;
|
205
|
-
}
|
206
|
-
|
207
|
-
var ast = acorn.parse(code,options) ;
|
208
|
-
|
209
|
-
// attach comments to the most tightly containing node
|
210
|
-
treeWalker(ast,function(node,descend,path){
|
211
|
-
descend() ;
|
212
|
-
while (comments.length && node.loc &&
|
213
|
-
(node.loc.start.line >= comments[0].loc.start.line && node.loc.end.line>=comments[0].loc.end.line)) {
|
214
|
-
node.$comments = node.$comments||[] ;
|
215
|
-
node.$comments.push(comments.shift()) ;
|
216
|
-
}
|
217
|
-
}) ;
|
218
|
-
return ast ;
|
219
|
-
}
|
220
|
-
|
221
|
-
var parseCache = {} ;
|
222
|
-
function partialParse(code,args) {
|
223
|
-
if (!parseCache[code]) {
|
224
|
-
parseCache[code] = acornParse(code,{
|
225
|
-
noNodentExtensions:true, // The partial parser only ever parses ES5
|
226
|
-
locations:false,
|
227
|
-
ranges:false,
|
228
|
-
onComment:null
|
229
|
-
}) ;
|
230
|
-
}
|
231
|
-
|
232
|
-
var result = substitute(parseCache[code]) ;
|
233
|
-
return {body:result.body, expr:result.body[0].type==='ExpressionStatement' ? result.body[0].expression : null} ;
|
234
|
-
|
235
|
-
/* parse and substitute:
|
236
|
-
*
|
237
|
-
* $1 Substitute the specified expression. If $1 occupies a slot which is an array of expressions (e.g arguments, params)
|
238
|
-
* and the passed argument is an array, subtitute the whole set
|
239
|
-
* {$:1} Substitute a single statement
|
240
|
-
*
|
241
|
-
*/
|
242
|
-
function substitute(src,dest) {
|
243
|
-
if (Array.isArray(dest) && !Array.isArray(src))
|
244
|
-
throw new Error("Can't substitute an array for a node") ;
|
245
|
-
|
246
|
-
dest = dest || {} ;
|
247
|
-
Object.keys(src).forEach(function(k){
|
248
|
-
if (!(src[k] instanceof Object))
|
249
|
-
return dest[k] = src[k] ;
|
250
|
-
|
251
|
-
function moreNodes(v){ if (typeof v==="function") v = v() ; dest = dest.concat(v) ; return dest };
|
252
|
-
function copyNode(v){ if (typeof v==="function") v = v() ; dest[k] = v ; return dest };
|
253
|
-
|
254
|
-
// The src is an array, so create/grow the destination
|
255
|
-
// It could an an array of expressions $1,$2,$3 or statements $:1;$:2;$:3;
|
256
|
-
if (Array.isArray(src[k]))
|
257
|
-
return dest[k] = substitute(src[k],[]) ;
|
258
|
-
|
259
|
-
var p ;
|
260
|
-
if (Array.isArray(dest))
|
261
|
-
p = moreNodes ;
|
262
|
-
else
|
263
|
-
p = copyNode ;
|
264
|
-
|
265
|
-
// Substitute a single identifier $.. with an expression (TODO: test provided arg is an expression node)
|
266
|
-
if (src[k].type==='Identifier' && src[k].name[0]==='$')
|
267
|
-
return p(args[src[k].name.slice(1)]) ;
|
268
|
-
|
269
|
-
// Substitute a single labeled statement $:.. with a statement (TODO: test provided arg is a statement node)
|
270
|
-
if (src[k].type === 'LabeledStatement' && src[k].label.name==='$') {
|
271
|
-
var spec = src[k].body.expression ;
|
272
|
-
return p(args[spec.name || spec.value]) ;
|
273
|
-
}
|
274
|
-
|
275
|
-
// Magic label to set call a function to modify a statement node $$method: <statement>
|
276
|
-
// The newNode = args.method(oldNode)
|
277
|
-
if (src[k].type === 'LabeledStatement' && src[k].label.name.slice(0,2)==='$$') {
|
278
|
-
return p(args[src[k].label.name.slice(2)](substitute(src[k]).body)) ;
|
279
|
-
}
|
280
|
-
|
281
|
-
return p(substitute(src[k])) ;
|
282
|
-
}) ;
|
283
|
-
return dest ;
|
284
|
-
}
|
285
|
-
}
|
286
|
-
|
287
|
-
module.exports = {
|
288
|
-
part:partialParse,
|
289
|
-
parse: acornParse,
|
290
|
-
treeWalker:treeWalker
|
291
|
-
} ;
|