jass-vue 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jass/vue/version.rb +1 -1
- data/lib/jass/vue.rb +1 -0
- data/vendor/node_modules/balanced-match/index.js +59 -0
- data/vendor/node_modules/balanced-match/package.json +49 -0
- data/vendor/node_modules/brace-expansion/index.js +201 -0
- data/vendor/node_modules/brace-expansion/package.json +47 -0
- data/vendor/node_modules/concat-map/index.js +13 -0
- data/vendor/node_modules/concat-map/package.json +43 -0
- data/vendor/node_modules/minimatch/minimatch.js +923 -0
- data/vendor/node_modules/minimatch/package.json +30 -0
- data/vendor/node_modules/rollup-plugin-replace/dist/rollup-plugin-replace.cjs.js +88 -0
- data/vendor/node_modules/rollup-plugin-replace/dist/rollup-plugin-replace.es.js +84 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/dist/estree-walker.es.js +57 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/dist/estree-walker.umd.js +68 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/index.d.ts +17 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/package.json +35 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/estree-walker/src/estree-walker.js +51 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/dist/magic-string.cjs.js +1300 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/dist/magic-string.es.js +1296 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/dist/magic-string.umd.js +1352 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/index.d.ts +83 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/magic-string/package.json +55 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +302 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/dist/pluginutils.es.js +292 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/package.json +46 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/addExtension.js +6 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/attachScopes.js +155 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/createFilter.js +33 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/dataToEsm.js +69 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/index.js +5 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/makeLegalIdentifier.js +15 -0
- data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/utils/ensureArray.js +5 -0
- data/vendor/node_modules/rollup-plugin-replace/package.json +43 -0
- data/vendor/node_modules/rollup-plugin-replace/src/index.js +80 -0
- data/vendor/package.json +1 -0
- data/vendor/yarn.lock +47 -1
- metadata +36 -4
@@ -0,0 +1,292 @@
|
|
1
|
+
import { extname, resolve, sep } from 'path';
|
2
|
+
import { walk } from 'estree-walker';
|
3
|
+
import mm from 'micromatch';
|
4
|
+
|
5
|
+
function addExtension ( filename, ext ) {
|
6
|
+
if ( ext === void 0 ) ext = '.js';
|
7
|
+
|
8
|
+
if ( !extname( filename ) ) { filename += ext; }
|
9
|
+
return filename;
|
10
|
+
}
|
11
|
+
|
12
|
+
var blockDeclarations = {
|
13
|
+
'const': true,
|
14
|
+
'let': true
|
15
|
+
};
|
16
|
+
|
17
|
+
var extractors = {
|
18
|
+
Literal: function Literal ( names, param ) {
|
19
|
+
names.push( param.value );
|
20
|
+
},
|
21
|
+
|
22
|
+
Identifier: function Identifier ( names, param ) {
|
23
|
+
names.push( param.name );
|
24
|
+
},
|
25
|
+
|
26
|
+
ObjectPattern: function ObjectPattern ( names, param ) {
|
27
|
+
param.properties.forEach( function (prop) {
|
28
|
+
if ( prop.type === 'RestElement' ) {
|
29
|
+
extractors.RestElement( names, prop );
|
30
|
+
} else {
|
31
|
+
extractors[ (prop.value || prop.key).type ]( names, prop.value || prop.key );
|
32
|
+
}
|
33
|
+
});
|
34
|
+
},
|
35
|
+
|
36
|
+
ArrayPattern: function ArrayPattern ( names, param ) {
|
37
|
+
param.elements.forEach( function (element) {
|
38
|
+
if ( element ) { extractors[ element.type ]( names, element ); }
|
39
|
+
});
|
40
|
+
},
|
41
|
+
|
42
|
+
RestElement: function RestElement ( names, param ) {
|
43
|
+
extractors[ param.argument.type ]( names, param.argument );
|
44
|
+
},
|
45
|
+
|
46
|
+
AssignmentPattern: function AssignmentPattern ( names, param ) {
|
47
|
+
return extractors[ param.left.type ]( names, param.left );
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
function extractNames ( param ) {
|
52
|
+
var names = [];
|
53
|
+
|
54
|
+
extractors[ param.type ]( names, param );
|
55
|
+
return names;
|
56
|
+
}
|
57
|
+
|
58
|
+
var Scope = function Scope ( options ) {
|
59
|
+
var this$1 = this;
|
60
|
+
|
61
|
+
options = options || {};
|
62
|
+
|
63
|
+
this.parent = options.parent;
|
64
|
+
this.isBlockScope = !!options.block;
|
65
|
+
|
66
|
+
this.declarations = Object.create( null );
|
67
|
+
|
68
|
+
if ( options.params ) {
|
69
|
+
options.params.forEach( function (param) {
|
70
|
+
extractNames( param ).forEach( function (name) {
|
71
|
+
this$1.declarations[ name ] = true;
|
72
|
+
});
|
73
|
+
});
|
74
|
+
}
|
75
|
+
};
|
76
|
+
|
77
|
+
Scope.prototype.addDeclaration = function addDeclaration ( node, isBlockDeclaration, isVar ) {
|
78
|
+
var this$1 = this;
|
79
|
+
|
80
|
+
if ( !isBlockDeclaration && this.isBlockScope ) {
|
81
|
+
// it's a `var` or function node, and this
|
82
|
+
// is a block scope, so we need to go up
|
83
|
+
this.parent.addDeclaration( node, isBlockDeclaration, isVar );
|
84
|
+
} else if ( node.id ) {
|
85
|
+
extractNames( node.id ).forEach( function (name) {
|
86
|
+
this$1.declarations[ name ] = true;
|
87
|
+
});
|
88
|
+
}
|
89
|
+
};
|
90
|
+
|
91
|
+
Scope.prototype.contains = function contains ( name ) {
|
92
|
+
return this.declarations[ name ] ||
|
93
|
+
( this.parent ? this.parent.contains( name ) : false );
|
94
|
+
};
|
95
|
+
|
96
|
+
|
97
|
+
function attachScopes ( ast, propertyName ) {
|
98
|
+
if ( propertyName === void 0 ) propertyName = 'scope';
|
99
|
+
|
100
|
+
var scope = new Scope();
|
101
|
+
|
102
|
+
walk( ast, {
|
103
|
+
enter: function enter ( node, parent ) {
|
104
|
+
// function foo () {...}
|
105
|
+
// class Foo {...}
|
106
|
+
if ( /(Function|Class)Declaration/.test( node.type ) ) {
|
107
|
+
scope.addDeclaration( node, false, false );
|
108
|
+
}
|
109
|
+
|
110
|
+
// var foo = 1
|
111
|
+
if ( node.type === 'VariableDeclaration' ) {
|
112
|
+
var isBlockDeclaration = blockDeclarations[ node.kind ];
|
113
|
+
|
114
|
+
node.declarations.forEach( function (declaration) {
|
115
|
+
scope.addDeclaration( declaration, isBlockDeclaration, true );
|
116
|
+
});
|
117
|
+
}
|
118
|
+
|
119
|
+
var newScope;
|
120
|
+
|
121
|
+
// create new function scope
|
122
|
+
if ( /Function/.test( node.type ) ) {
|
123
|
+
newScope = new Scope({
|
124
|
+
parent: scope,
|
125
|
+
block: false,
|
126
|
+
params: node.params
|
127
|
+
});
|
128
|
+
|
129
|
+
// named function expressions - the name is considered
|
130
|
+
// part of the function's scope
|
131
|
+
if ( node.type === 'FunctionExpression' && node.id ) {
|
132
|
+
newScope.addDeclaration( node, false, false );
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
// create new block scope
|
137
|
+
if ( node.type === 'BlockStatement' && !/Function/.test( parent.type ) ) {
|
138
|
+
newScope = new Scope({
|
139
|
+
parent: scope,
|
140
|
+
block: true
|
141
|
+
});
|
142
|
+
}
|
143
|
+
|
144
|
+
// catch clause has its own block scope
|
145
|
+
if ( node.type === 'CatchClause' ) {
|
146
|
+
newScope = new Scope({
|
147
|
+
parent: scope,
|
148
|
+
params: [ node.param ],
|
149
|
+
block: true
|
150
|
+
});
|
151
|
+
}
|
152
|
+
|
153
|
+
if ( newScope ) {
|
154
|
+
Object.defineProperty( node, propertyName, {
|
155
|
+
value: newScope,
|
156
|
+
configurable: true
|
157
|
+
});
|
158
|
+
|
159
|
+
scope = newScope;
|
160
|
+
}
|
161
|
+
},
|
162
|
+
leave: function leave ( node ) {
|
163
|
+
if ( node[ propertyName ] ) { scope = scope.parent; }
|
164
|
+
}
|
165
|
+
});
|
166
|
+
|
167
|
+
return scope;
|
168
|
+
}
|
169
|
+
|
170
|
+
function ensureArray ( thing ) {
|
171
|
+
if ( Array.isArray( thing ) ) { return thing; }
|
172
|
+
if ( thing == undefined ) { return []; }
|
173
|
+
return [ thing ];
|
174
|
+
}
|
175
|
+
|
176
|
+
function createFilter ( include, exclude ) {
|
177
|
+
var getMatcher = function (id) { return ( isRegexp( id ) ? id : { test: mm.matcher( resolve( id ) ) } ); };
|
178
|
+
include = ensureArray( include ).map( getMatcher );
|
179
|
+
exclude = ensureArray( exclude ).map( getMatcher );
|
180
|
+
|
181
|
+
return function ( id ) {
|
182
|
+
|
183
|
+
if ( typeof id !== 'string' ) { return false; }
|
184
|
+
if ( /\0/.test( id ) ) { return false; }
|
185
|
+
|
186
|
+
id = id.split( sep ).join( '/' );
|
187
|
+
|
188
|
+
for ( var i = 0; i < exclude.length; ++i ) {
|
189
|
+
var matcher = exclude[i];
|
190
|
+
if ( matcher.test( id ) ) { return false; }
|
191
|
+
}
|
192
|
+
|
193
|
+
for ( var i$1 = 0; i$1 < include.length; ++i$1 ) {
|
194
|
+
var matcher$1 = include[i$1];
|
195
|
+
if ( matcher$1.test( id ) ) { return true; }
|
196
|
+
}
|
197
|
+
|
198
|
+
return !include.length;
|
199
|
+
};
|
200
|
+
}
|
201
|
+
|
202
|
+
function isRegexp ( val ) {
|
203
|
+
return val instanceof RegExp;
|
204
|
+
}
|
205
|
+
|
206
|
+
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( ' ' );
|
207
|
+
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( ' ' );
|
208
|
+
|
209
|
+
var blacklisted = Object.create( null );
|
210
|
+
reservedWords.concat( builtins ).forEach( function (word) { return blacklisted[ word ] = true; } );
|
211
|
+
|
212
|
+
function makeLegalIdentifier ( str ) {
|
213
|
+
str = str
|
214
|
+
.replace( /-(\w)/g, function ( _, letter ) { return letter.toUpperCase(); } )
|
215
|
+
.replace( /[^$_a-zA-Z0-9]/g, '_' );
|
216
|
+
|
217
|
+
if ( /\d/.test( str[0] ) || blacklisted[ str ] ) { str = "_" + str; }
|
218
|
+
|
219
|
+
return str;
|
220
|
+
}
|
221
|
+
|
222
|
+
function serializeArray (arr, indent, baseIndent) {
|
223
|
+
var output = '[';
|
224
|
+
var separator = indent ? '\n' + baseIndent + indent : '';
|
225
|
+
for (var i = 0; i < arr.length; i++) {
|
226
|
+
var key = arr[i];
|
227
|
+
output += "" + (i > 0 ? ',' : '') + separator + (serialize(key, indent, baseIndent + indent));
|
228
|
+
}
|
229
|
+
return output + (indent ? '\n' + baseIndent : '') + "]";
|
230
|
+
}
|
231
|
+
|
232
|
+
function serializeObject (obj, indent, baseIndent) {
|
233
|
+
var output = '{';
|
234
|
+
var separator = indent ? '\n' + baseIndent + indent : '';
|
235
|
+
var keys = Object.keys(obj);
|
236
|
+
for (var i = 0; i < keys.length; i++) {
|
237
|
+
var key = keys[i];
|
238
|
+
var stringKey = makeLegalIdentifier(key) === key ? key : JSON.stringify(key);
|
239
|
+
output += "" + (i > 0 ? ',' : '') + separator + stringKey + ":" + (indent ? ' ' : '') + (serialize(obj[key], indent, baseIndent + indent));
|
240
|
+
}
|
241
|
+
return output + (indent ? '\n' + baseIndent : '') + "}";
|
242
|
+
}
|
243
|
+
|
244
|
+
function serialize (obj, indent, baseIndent) {
|
245
|
+
if (obj === Infinity)
|
246
|
+
{ return 'Infinity'; }
|
247
|
+
if (obj instanceof Date)
|
248
|
+
{ return 'new Date(' + obj.getTime() + ')'; }
|
249
|
+
if (obj instanceof RegExp)
|
250
|
+
{ return obj.toString(); }
|
251
|
+
if (typeof obj === 'number' && isNaN(obj))
|
252
|
+
{ return 'NaN'; }
|
253
|
+
if (Array.isArray(obj))
|
254
|
+
{ return serializeArray(obj, indent, baseIndent); }
|
255
|
+
if (obj === null)
|
256
|
+
{ return 'null'; }
|
257
|
+
if (typeof obj === 'object')
|
258
|
+
{ return serializeObject(obj, indent, baseIndent); }
|
259
|
+
return JSON.stringify(obj);
|
260
|
+
}
|
261
|
+
|
262
|
+
// convert data object into separate named exports (and default)
|
263
|
+
function dataToNamedExports (data, options) {
|
264
|
+
if ( options === void 0 ) options = {};
|
265
|
+
|
266
|
+
var t = options.compact ? '' : 'indent' in options ? options.indent : '\t';
|
267
|
+
var _ = options.compact ? '' : ' ';
|
268
|
+
var n = options.compact ? '' : '\n';
|
269
|
+
var declarationType = options.preferConst ? 'const' : 'var';
|
270
|
+
|
271
|
+
if (options.namedExports === false || typeof data !== 'object' || Array.isArray(data) || data === null)
|
272
|
+
{ return ("export default" + _ + (serialize( data, options.compact ? null : t, '' )) + ";"); }
|
273
|
+
|
274
|
+
var namedExportCode = '';
|
275
|
+
var defaultExportRows = [];
|
276
|
+
var dataKeys = Object.keys(data);
|
277
|
+
for (var i = 0; i < dataKeys.length; i++) {
|
278
|
+
var key = dataKeys[i];
|
279
|
+
if (key === makeLegalIdentifier(key)) {
|
280
|
+
if (options.objectShorthand)
|
281
|
+
{ defaultExportRows.push(key); }
|
282
|
+
else
|
283
|
+
{ defaultExportRows.push((key + ":" + _ + key)); }
|
284
|
+
namedExportCode += "export " + declarationType + " " + key + _ + "=" + _ + (serialize(data[key], options.compact ? null : t, '')) + ";" + n;
|
285
|
+
} else {
|
286
|
+
defaultExportRows.push(((JSON.stringify(key)) + ": " + (serialize(data[key], options.compact ? null : t, ''))));
|
287
|
+
}
|
288
|
+
}
|
289
|
+
return namedExportCode + "export default" + _ + "{" + n + t + (defaultExportRows.join(("," + n + t))) + n + "};" + n;
|
290
|
+
}
|
291
|
+
|
292
|
+
export { addExtension, attachScopes, createFilter, makeLegalIdentifier, dataToNamedExports as dataToEsm };
|
@@ -0,0 +1,46 @@
|
|
1
|
+
{
|
2
|
+
"name": "rollup-pluginutils",
|
3
|
+
"description": "Functionality commonly needed by Rollup plugins",
|
4
|
+
"version": "2.3.1",
|
5
|
+
"main": "dist/pluginutils.cjs.js",
|
6
|
+
"module": "dist/pluginutils.es.js",
|
7
|
+
"jsnext:main": "dist/pluginutils.es.js",
|
8
|
+
"files": [
|
9
|
+
"src",
|
10
|
+
"dist",
|
11
|
+
"README.md"
|
12
|
+
],
|
13
|
+
"devDependencies": {
|
14
|
+
"eslint": "^4.19.1",
|
15
|
+
"husky": "^0.14.3",
|
16
|
+
"lint-staged": "^7.1.0",
|
17
|
+
"mocha": "^5.1.1",
|
18
|
+
"rollup": "^0.58.2",
|
19
|
+
"rollup-plugin-buble": "^0.15.0"
|
20
|
+
},
|
21
|
+
"scripts": {
|
22
|
+
"test": "mocha",
|
23
|
+
"build": "rollup -c",
|
24
|
+
"lint": "eslint --fix src test",
|
25
|
+
"pretest": "npm run build",
|
26
|
+
"prepublishOnly": "npm test",
|
27
|
+
"prepare": "npm run build",
|
28
|
+
"precommit": "lint-staged",
|
29
|
+
"postcommit": "git reset"
|
30
|
+
},
|
31
|
+
"dependencies": {
|
32
|
+
"estree-walker": "^0.5.2",
|
33
|
+
"micromatch": "^2.3.11"
|
34
|
+
},
|
35
|
+
"repository": "rollup/rollup-pluginutils",
|
36
|
+
"keywords": [
|
37
|
+
"rollup",
|
38
|
+
"utils"
|
39
|
+
],
|
40
|
+
"author": "Rich Harris <richard.a.harris@gmail.com>",
|
41
|
+
"license": "MIT",
|
42
|
+
"bugs": {
|
43
|
+
"url": "https://github.com/rollup/rollup-pluginutils/issues"
|
44
|
+
},
|
45
|
+
"homepage": "https://github.com/rollup/rollup-pluginutils#readme"
|
46
|
+
}
|
data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/attachScopes.js
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
import { walk } from 'estree-walker';
|
2
|
+
|
3
|
+
const blockDeclarations = {
|
4
|
+
'const': true,
|
5
|
+
'let': true
|
6
|
+
};
|
7
|
+
|
8
|
+
const extractors = {
|
9
|
+
Literal ( names, param ) {
|
10
|
+
names.push( param.value );
|
11
|
+
},
|
12
|
+
|
13
|
+
Identifier ( names, param ) {
|
14
|
+
names.push( param.name );
|
15
|
+
},
|
16
|
+
|
17
|
+
ObjectPattern ( names, param ) {
|
18
|
+
param.properties.forEach( prop => {
|
19
|
+
if ( prop.type === 'RestElement' ) {
|
20
|
+
extractors.RestElement( names, prop );
|
21
|
+
} else {
|
22
|
+
extractors[ (prop.value || prop.key).type ]( names, prop.value || prop.key );
|
23
|
+
}
|
24
|
+
});
|
25
|
+
},
|
26
|
+
|
27
|
+
ArrayPattern ( names, param ) {
|
28
|
+
param.elements.forEach( element => {
|
29
|
+
if ( element ) extractors[ element.type ]( names, element );
|
30
|
+
});
|
31
|
+
},
|
32
|
+
|
33
|
+
RestElement ( names, param ) {
|
34
|
+
extractors[ param.argument.type ]( names, param.argument );
|
35
|
+
},
|
36
|
+
|
37
|
+
AssignmentPattern ( names, param ) {
|
38
|
+
return extractors[ param.left.type ]( names, param.left );
|
39
|
+
}
|
40
|
+
};
|
41
|
+
|
42
|
+
function extractNames ( param ) {
|
43
|
+
let names = [];
|
44
|
+
|
45
|
+
extractors[ param.type ]( names, param );
|
46
|
+
return names;
|
47
|
+
}
|
48
|
+
|
49
|
+
class Scope {
|
50
|
+
constructor ( options ) {
|
51
|
+
options = options || {};
|
52
|
+
|
53
|
+
this.parent = options.parent;
|
54
|
+
this.isBlockScope = !!options.block;
|
55
|
+
|
56
|
+
this.declarations = Object.create( null );
|
57
|
+
|
58
|
+
if ( options.params ) {
|
59
|
+
options.params.forEach( param => {
|
60
|
+
extractNames( param ).forEach( name => {
|
61
|
+
this.declarations[ name ] = true;
|
62
|
+
});
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
addDeclaration ( node, isBlockDeclaration, isVar ) {
|
68
|
+
if ( !isBlockDeclaration && this.isBlockScope ) {
|
69
|
+
// it's a `var` or function node, and this
|
70
|
+
// is a block scope, so we need to go up
|
71
|
+
this.parent.addDeclaration( node, isBlockDeclaration, isVar );
|
72
|
+
} else if ( node.id ) {
|
73
|
+
extractNames( node.id ).forEach( name => {
|
74
|
+
this.declarations[ name ] = true;
|
75
|
+
});
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
contains ( name ) {
|
80
|
+
return this.declarations[ name ] ||
|
81
|
+
( this.parent ? this.parent.contains( name ) : false );
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
export default function attachScopes ( ast, propertyName = 'scope' ) {
|
87
|
+
let scope = new Scope();
|
88
|
+
|
89
|
+
walk( ast, {
|
90
|
+
enter ( node, parent ) {
|
91
|
+
// function foo () {...}
|
92
|
+
// class Foo {...}
|
93
|
+
if ( /(Function|Class)Declaration/.test( node.type ) ) {
|
94
|
+
scope.addDeclaration( node, false, false );
|
95
|
+
}
|
96
|
+
|
97
|
+
// var foo = 1
|
98
|
+
if ( node.type === 'VariableDeclaration' ) {
|
99
|
+
const isBlockDeclaration = blockDeclarations[ node.kind ];
|
100
|
+
|
101
|
+
node.declarations.forEach( declaration => {
|
102
|
+
scope.addDeclaration( declaration, isBlockDeclaration, true );
|
103
|
+
});
|
104
|
+
}
|
105
|
+
|
106
|
+
let newScope;
|
107
|
+
|
108
|
+
// create new function scope
|
109
|
+
if ( /Function/.test( node.type ) ) {
|
110
|
+
newScope = new Scope({
|
111
|
+
parent: scope,
|
112
|
+
block: false,
|
113
|
+
params: node.params
|
114
|
+
});
|
115
|
+
|
116
|
+
// named function expressions - the name is considered
|
117
|
+
// part of the function's scope
|
118
|
+
if ( node.type === 'FunctionExpression' && node.id ) {
|
119
|
+
newScope.addDeclaration( node, false, false );
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
// create new block scope
|
124
|
+
if ( node.type === 'BlockStatement' && !/Function/.test( parent.type ) ) {
|
125
|
+
newScope = new Scope({
|
126
|
+
parent: scope,
|
127
|
+
block: true
|
128
|
+
});
|
129
|
+
}
|
130
|
+
|
131
|
+
// catch clause has its own block scope
|
132
|
+
if ( node.type === 'CatchClause' ) {
|
133
|
+
newScope = new Scope({
|
134
|
+
parent: scope,
|
135
|
+
params: [ node.param ],
|
136
|
+
block: true
|
137
|
+
});
|
138
|
+
}
|
139
|
+
|
140
|
+
if ( newScope ) {
|
141
|
+
Object.defineProperty( node, propertyName, {
|
142
|
+
value: newScope,
|
143
|
+
configurable: true
|
144
|
+
});
|
145
|
+
|
146
|
+
scope = newScope;
|
147
|
+
}
|
148
|
+
},
|
149
|
+
leave ( node ) {
|
150
|
+
if ( node[ propertyName ] ) scope = scope.parent;
|
151
|
+
}
|
152
|
+
});
|
153
|
+
|
154
|
+
return scope;
|
155
|
+
}
|
data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/createFilter.js
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
import { resolve, sep } from 'path';
|
2
|
+
import mm from 'micromatch';
|
3
|
+
import ensureArray from './utils/ensureArray';
|
4
|
+
|
5
|
+
export default function createFilter ( include, exclude ) {
|
6
|
+
const getMatcher = id => ( isRegexp( id ) ? id : { test: mm.matcher( resolve( id ) ) } );
|
7
|
+
include = ensureArray( include ).map( getMatcher );
|
8
|
+
exclude = ensureArray( exclude ).map( getMatcher );
|
9
|
+
|
10
|
+
return function ( id ) {
|
11
|
+
|
12
|
+
if ( typeof id !== 'string' ) return false;
|
13
|
+
if ( /\0/.test( id ) ) return false;
|
14
|
+
|
15
|
+
id = id.split( sep ).join( '/' );
|
16
|
+
|
17
|
+
for ( let i = 0; i < exclude.length; ++i ) {
|
18
|
+
const matcher = exclude[i];
|
19
|
+
if ( matcher.test( id ) ) return false;
|
20
|
+
}
|
21
|
+
|
22
|
+
for ( let i = 0; i < include.length; ++i ) {
|
23
|
+
const matcher = include[i];
|
24
|
+
if ( matcher.test( id ) ) return true;
|
25
|
+
}
|
26
|
+
|
27
|
+
return !include.length;
|
28
|
+
};
|
29
|
+
}
|
30
|
+
|
31
|
+
function isRegexp ( val ) {
|
32
|
+
return val instanceof RegExp;
|
33
|
+
}
|
data/vendor/node_modules/rollup-plugin-replace/node_modules/rollup-pluginutils/src/dataToEsm.js
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
import makeLegalIdentifier from './makeLegalIdentifier';
|
2
|
+
|
3
|
+
function serializeArray (arr, indent, baseIndent) {
|
4
|
+
let output = '[';
|
5
|
+
const separator = indent ? '\n' + baseIndent + indent : '';
|
6
|
+
for (let i = 0; i < arr.length; i++) {
|
7
|
+
const key = arr[i];
|
8
|
+
output += `${ i > 0 ? ',' : '' }${ separator }${ serialize(key, indent, baseIndent + indent) }`;
|
9
|
+
}
|
10
|
+
return output + `${ indent ? '\n' + baseIndent : '' }]`;
|
11
|
+
}
|
12
|
+
|
13
|
+
function serializeObject (obj, indent, baseIndent) {
|
14
|
+
let output = '{';
|
15
|
+
const separator = indent ? '\n' + baseIndent + indent : '';
|
16
|
+
const keys = Object.keys(obj);
|
17
|
+
for (let i = 0; i < keys.length; i++) {
|
18
|
+
const key = keys[i];
|
19
|
+
const stringKey = makeLegalIdentifier(key) === key ? key : JSON.stringify(key);
|
20
|
+
output += `${ i > 0 ? ',' : '' }${ separator }${ stringKey }:${ indent ? ' ' : '' }${ serialize(obj[key], indent, baseIndent + indent) }`;
|
21
|
+
}
|
22
|
+
return output + `${ indent ? '\n' + baseIndent : '' }}`;
|
23
|
+
}
|
24
|
+
|
25
|
+
function serialize (obj, indent, baseIndent) {
|
26
|
+
if (obj === Infinity)
|
27
|
+
return 'Infinity';
|
28
|
+
if (obj instanceof Date)
|
29
|
+
return 'new Date(' + obj.getTime() + ')';
|
30
|
+
if (obj instanceof RegExp)
|
31
|
+
return obj.toString();
|
32
|
+
if (typeof obj === 'number' && isNaN(obj))
|
33
|
+
return 'NaN';
|
34
|
+
if (Array.isArray(obj))
|
35
|
+
return serializeArray(obj, indent, baseIndent);
|
36
|
+
if (obj === null)
|
37
|
+
return 'null';
|
38
|
+
if (typeof obj === 'object')
|
39
|
+
return serializeObject(obj, indent, baseIndent);
|
40
|
+
return JSON.stringify(obj);
|
41
|
+
}
|
42
|
+
|
43
|
+
// convert data object into separate named exports (and default)
|
44
|
+
export default function dataToNamedExports (data, options = {}) {
|
45
|
+
const t = options.compact ? '' : 'indent' in options ? options.indent : '\t';
|
46
|
+
const _ = options.compact ? '' : ' ';
|
47
|
+
const n = options.compact ? '' : '\n';
|
48
|
+
const declarationType = options.preferConst ? 'const' : 'var';
|
49
|
+
|
50
|
+
if (options.namedExports === false || typeof data !== 'object' || Array.isArray(data) || data === null)
|
51
|
+
return `export default${ _ }${ serialize( data, options.compact ? null : t, '' ) };`;
|
52
|
+
|
53
|
+
let namedExportCode = '';
|
54
|
+
const defaultExportRows = [];
|
55
|
+
const dataKeys = Object.keys(data);
|
56
|
+
for (let i = 0; i < dataKeys.length; i++) {
|
57
|
+
const key = dataKeys[i];
|
58
|
+
if (key === makeLegalIdentifier(key)) {
|
59
|
+
if (options.objectShorthand)
|
60
|
+
defaultExportRows.push(key);
|
61
|
+
else
|
62
|
+
defaultExportRows.push(`${ key }:${ _ }${ key }`);
|
63
|
+
namedExportCode += `export ${declarationType} ${key}${ _ }=${ _ }${ serialize(data[key], options.compact ? null : t, '') };${ n }`;
|
64
|
+
} else {
|
65
|
+
defaultExportRows.push(`${ JSON.stringify(key) }: ${ serialize(data[key], options.compact ? null : t, '')}`);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
return namedExportCode + `export default${ _ }{${ n }${ t }${ defaultExportRows.join(`,${ n }${ t }`) }${ n }};${ n }`;
|
69
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export { default as addExtension } from './addExtension';
|
2
|
+
export { default as attachScopes } from './attachScopes';
|
3
|
+
export { default as createFilter } from './createFilter';
|
4
|
+
export { default as makeLegalIdentifier } from './makeLegalIdentifier';
|
5
|
+
export { default as dataToEsm } from './dataToEsm';
|
@@ -0,0 +1,15 @@
|
|
1
|
+
const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split( ' ' );
|
2
|
+
const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split( ' ' );
|
3
|
+
|
4
|
+
let blacklisted = Object.create( null );
|
5
|
+
reservedWords.concat( builtins ).forEach( word => blacklisted[ word ] = true );
|
6
|
+
|
7
|
+
export default function makeLegalIdentifier ( str ) {
|
8
|
+
str = str
|
9
|
+
.replace( /-(\w)/g, ( _, letter ) => letter.toUpperCase() )
|
10
|
+
.replace( /[^$_a-zA-Z0-9]/g, '_' );
|
11
|
+
|
12
|
+
if ( /\d/.test( str[0] ) || blacklisted[ str ] ) str = `_${str}`;
|
13
|
+
|
14
|
+
return str;
|
15
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"name": "rollup-plugin-replace",
|
3
|
+
"version": "2.0.0",
|
4
|
+
"devDependencies": {
|
5
|
+
"eslint": "^4.6.1",
|
6
|
+
"mocha": "^3.5.0",
|
7
|
+
"rollup": "^0.49.2",
|
8
|
+
"rollup-plugin-buble": "^0.15.0"
|
9
|
+
},
|
10
|
+
"main": "dist/rollup-plugin-replace.cjs.js",
|
11
|
+
"module": "dist/rollup-plugin-replace.es.js",
|
12
|
+
"dependencies": {
|
13
|
+
"magic-string": "^0.22.4",
|
14
|
+
"minimatch": "^3.0.2",
|
15
|
+
"rollup-pluginutils": "^2.0.1"
|
16
|
+
},
|
17
|
+
"scripts": {
|
18
|
+
"test": "mocha",
|
19
|
+
"pretest": "npm run build",
|
20
|
+
"build": "rollup -c",
|
21
|
+
"prebuild": "rm -rf dist/*",
|
22
|
+
"prepublish": "npm test"
|
23
|
+
},
|
24
|
+
"files": [
|
25
|
+
"src",
|
26
|
+
"dist",
|
27
|
+
"README.md"
|
28
|
+
],
|
29
|
+
"repository": "rollup/rollup-plugin-replace",
|
30
|
+
"keywords": [
|
31
|
+
"rollup",
|
32
|
+
"rollup-plugin",
|
33
|
+
"es2015",
|
34
|
+
"npm",
|
35
|
+
"modules"
|
36
|
+
],
|
37
|
+
"author": "Rich Harris <richard.a.harris@gmail.com>",
|
38
|
+
"license": "MIT",
|
39
|
+
"bugs": {
|
40
|
+
"url": "https://github.com/rollup/rollup-plugin-replace/issues"
|
41
|
+
},
|
42
|
+
"homepage": "https://github.com/rollup/rollup-plugin-replace#readme"
|
43
|
+
}
|