jass 0.9.1 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/jass.rb +5 -0
  4. data/lib/jass/compiler.rb +5 -0
  5. data/lib/jass/plugin.rb +2 -1
  6. data/lib/jass/version.rb +1 -1
  7. data/vendor/node_modules/@types/estree/index.d.ts +4 -2
  8. data/vendor/node_modules/@types/estree/package.json +2 -2
  9. data/vendor/node_modules/acorn/bin/_acorn.js +12 -12
  10. data/vendor/node_modules/acorn/bin/run_test262.js +2 -3
  11. data/vendor/node_modules/acorn/bin/test262.whitelist +0 -5
  12. data/vendor/node_modules/acorn/dist/acorn.es.js +76 -68
  13. data/vendor/node_modules/acorn/dist/acorn.js +76 -68
  14. data/vendor/node_modules/acorn/dist/acorn_loose.es.js +42 -30
  15. data/vendor/node_modules/acorn/dist/acorn_loose.js +42 -30
  16. data/vendor/node_modules/acorn/dist/walk.es.js +47 -43
  17. data/vendor/node_modules/acorn/dist/walk.js +47 -43
  18. data/vendor/node_modules/acorn/package.json +9 -5
  19. data/vendor/node_modules/chalk/index.js.flow +93 -0
  20. data/vendor/node_modules/chalk/package.json +8 -3
  21. data/vendor/node_modules/color-convert/conversions.js +36 -29
  22. data/vendor/node_modules/color-convert/package.json +4 -4
  23. data/vendor/node_modules/estree-walker/index.d.ts +17 -0
  24. data/vendor/node_modules/estree-walker/package.json +2 -1
  25. data/vendor/node_modules/fill-range/index.js +2 -2
  26. data/vendor/node_modules/fill-range/package.json +24 -7
  27. data/vendor/node_modules/is-reference/node_modules/@types/estree/index.d.ts +546 -0
  28. data/vendor/node_modules/is-reference/node_modules/@types/estree/package.json +22 -0
  29. data/vendor/node_modules/math-random/browser.js +17 -0
  30. data/vendor/node_modules/math-random/node.js +13 -0
  31. data/vendor/node_modules/math-random/package.json +31 -0
  32. data/vendor/node_modules/math-random/test.js +26 -0
  33. data/vendor/node_modules/nodent-compiler/compiler.js +115 -11
  34. data/vendor/node_modules/nodent-compiler/{lib/output.js → output.js} +0 -0
  35. data/vendor/node_modules/nodent-compiler/package.json +8 -4
  36. data/vendor/node_modules/{nodent-compiler/lib → nodent-transform}/arboriculture.js +1340 -1107
  37. data/vendor/node_modules/nodent-transform/package.json +19 -0
  38. data/vendor/node_modules/path-parse/package.json +1 -1
  39. data/vendor/node_modules/pretty-ms/index.js +2 -1
  40. data/vendor/node_modules/pretty-ms/package.json +2 -3
  41. data/vendor/node_modules/randomatic/index.js +12 -2
  42. data/vendor/node_modules/randomatic/node_modules/is-number/index.js +6 -7
  43. data/vendor/node_modules/randomatic/node_modules/is-number/package.json +9 -16
  44. data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +112 -102
  45. data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +18 -20
  46. data/vendor/node_modules/randomatic/package.json +15 -13
  47. data/vendor/node_modules/repeat-element/index.js +1 -1
  48. data/vendor/node_modules/repeat-element/package.json +27 -22
  49. data/vendor/node_modules/resolve/lib/async.js +20 -17
  50. data/vendor/node_modules/resolve/lib/core.js +2 -2
  51. data/vendor/node_modules/resolve/lib/core.json +4 -1
  52. data/vendor/node_modules/resolve/lib/sync.js +52 -13
  53. data/vendor/node_modules/resolve/package.json +3 -3
  54. data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +50 -12
  55. data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +50 -12
  56. data/vendor/node_modules/rollup-plugin-commonjs/package.json +2 -2
  57. data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +49 -11
  58. data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +1 -1
  59. data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +82 -85
  60. data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +82 -85
  61. data/vendor/node_modules/rollup-plugin-node-resolve/package.json +1 -1
  62. data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +81 -84
  63. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +81 -2
  64. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +81 -3
  65. data/vendor/node_modules/rollup-pluginutils/package.json +12 -6
  66. data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +10 -2
  67. data/vendor/node_modules/rollup-pluginutils/src/dataToEsm.js +69 -0
  68. data/vendor/node_modules/rollup-pluginutils/src/index.js +1 -0
  69. data/vendor/node_modules/supports-color/index.js +1 -5
  70. data/vendor/node_modules/supports-color/package.json +51 -51
  71. data/vendor/yarn.lock +65 -70
  72. metadata +16 -21
  73. data/vendor/node_modules/irregular-plurals/irregular-plurals.json +0 -146
  74. data/vendor/node_modules/irregular-plurals/package.json +0 -39
  75. data/vendor/node_modules/nodent-compiler/lib/parser.js +0 -291
  76. data/vendor/node_modules/path-parse/index.min.js +0 -1
  77. data/vendor/node_modules/path-parse/test.min.js +0 -1
  78. data/vendor/node_modules/plur/index.js +0 -20
  79. data/vendor/node_modules/plur/package.json +0 -42
  80. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +0 -116
  81. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +0 -90
  82. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +0 -217
  83. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +0 -55
  84. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +0 -59
  85. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +0 -65
  86. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +0 -33
  87. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +0 -49
@@ -11,7 +11,9 @@ var CONSOLE_WARN = function () {
11
11
 
12
12
  return console.warn.apply( console, args );
13
13
  }; // eslint-disable-line no-console
14
- var exts = [ '.js', '.json', '.node' ];
14
+ // It is important that .mjs occur before .js so that Rollup will interpret npm modules
15
+ // which deploy both ESM .mjs and CommonJS .js files as ESM.
16
+ var DEFAULT_EXTS = [ '.mjs', '.js', '.json', '.node' ];
15
17
 
16
18
  var readFileCache = {};
17
19
  var readFileAsync = function (file) { return new Promise(function (fulfil, reject) { return fs.readFile(file, function (err, contents) { return err ? reject(err) : fulfil(contents); }); }); };
@@ -41,6 +43,8 @@ function cachedIsFile (file, cb) {
41
43
  isFileCache[file].then(function (contents) { return cb(null, contents); }, cb);
42
44
  }
43
45
 
46
+ var resolveIdAsync = function (file, opts) { return new Promise(function (fulfil, reject) { return resolveId(file, opts, function (err, contents) { return err ? reject(err) : fulfil(contents); }); }); };
47
+
44
48
  function nodeResolve ( options ) {
45
49
  if ( options === void 0 ) options = {};
46
50
 
@@ -83,7 +87,7 @@ function nodeResolve ( options ) {
83
87
  readFileCache = {};
84
88
  },
85
89
 
86
- resolveId: function resolveId$1 ( importee, importer ) {
90
+ resolveId: function resolveId$$1 ( importee, importer ) {
87
91
  if ( /\0/.test( importee ) ) { return null; } // ignore IDs with null character, these belong to other plugins
88
92
 
89
93
  // disregard entry module
@@ -114,99 +118,92 @@ function nodeResolve ( options ) {
114
118
 
115
119
  if (only && !only.some(function (pattern) { return pattern.test(id); })) { return null; }
116
120
 
117
- return new Promise( function ( fulfil, reject ) {
118
- var disregardResult = false;
119
- var packageBrowserField = false;
120
-
121
- var resolveOptions = {
122
- basedir: dirname( importer ),
123
- packageFilter: function packageFilter ( pkg, pkgPath ) {
124
- var pkgRoot = dirname( pkgPath );
125
- if (options.browser && typeof pkg[ 'browser' ] === 'object') {
126
- packageBrowserField = Object.keys(pkg[ 'browser' ]).reduce(function (browser, key) {
127
- var resolved = pkg[ 'browser' ][ key ] === false ? false : resolve( pkgRoot, pkg[ 'browser' ][ key ] );
128
- browser[ key ] = resolved;
129
- if ( key[0] === '.' ) {
130
- var absoluteKey = resolve( pkgRoot, key );
131
- browser[ absoluteKey ] = resolved;
132
- if ( !extname(key) ) {
133
- exts.reduce( function ( browser, ext ) {
134
- browser[ absoluteKey + ext ] = browser[ key ];
135
- return browser;
136
- }, browser );
137
- }
121
+ var disregardResult = false;
122
+ var packageBrowserField = false;
123
+ var extensions = options.extensions || DEFAULT_EXTS;
124
+
125
+ var resolveOptions = {
126
+ basedir: dirname( importer ),
127
+ packageFilter: function packageFilter ( pkg, pkgPath ) {
128
+ var pkgRoot = dirname( pkgPath );
129
+ if (options.browser && typeof pkg[ 'browser' ] === 'object') {
130
+ packageBrowserField = Object.keys(pkg[ 'browser' ]).reduce(function (browser, key) {
131
+ var resolved = pkg[ 'browser' ][ key ] === false ? false : resolve( pkgRoot, pkg[ 'browser' ][ key ] );
132
+ browser[ key ] = resolved;
133
+ if ( key[0] === '.' ) {
134
+ var absoluteKey = resolve( pkgRoot, key );
135
+ browser[ absoluteKey ] = resolved;
136
+ if ( !extname(key) ) {
137
+ extensions.reduce( function ( browser, ext ) {
138
+ browser[ absoluteKey + ext ] = browser[ key ];
139
+ return browser;
140
+ }, browser );
138
141
  }
139
- return browser;
140
- }, {});
141
- }
142
+ }
143
+ return browser;
144
+ }, {});
145
+ }
142
146
 
143
- if (options.browser && typeof pkg[ 'browser' ] === 'string') {
144
- pkg[ 'main' ] = pkg[ 'browser' ];
145
- } else if ( useModule && pkg[ 'module' ] ) {
146
- pkg[ 'main' ] = pkg[ 'module' ];
147
- } else if ( useJsnext && pkg[ 'jsnext:main' ] ) {
148
- pkg[ 'main' ] = pkg[ 'jsnext:main' ];
149
- } else if ( ( useJsnext || useModule ) && !useMain ) {
150
- disregardResult = true;
151
- }
152
- return pkg;
153
- },
154
- readFile: cachedReadFile,
155
- isFile: cachedIsFile,
156
- extensions: options.extensions
157
- };
158
-
159
- if (preserveSymlinks !== undefined) {
160
- resolveOptions.preserveSymlinks = preserveSymlinks;
161
- }
147
+ if (options.browser && typeof pkg[ 'browser' ] === 'string') {
148
+ pkg[ 'main' ] = pkg[ 'browser' ];
149
+ } else if ( useModule && pkg[ 'module' ] ) {
150
+ pkg[ 'main' ] = pkg[ 'module' ];
151
+ } else if ( useJsnext && pkg[ 'jsnext:main' ] ) {
152
+ pkg[ 'main' ] = pkg[ 'jsnext:main' ];
153
+ } else if ( ( useJsnext || useModule ) && !useMain ) {
154
+ disregardResult = true;
155
+ }
156
+ return pkg;
157
+ },
158
+ readFile: cachedReadFile,
159
+ isFile: cachedIsFile,
160
+ extensions: extensions
161
+ };
162
+
163
+ if (preserveSymlinks !== undefined) {
164
+ resolveOptions.preserveSymlinks = preserveSymlinks;
165
+ }
162
166
 
163
- resolveId(
164
- importee,
165
- Object.assign( resolveOptions, customResolveOptions ),
166
- function ( err, resolved ) {
167
- if (options.browser && packageBrowserField) {
168
- if (packageBrowserField[ resolved ]) {
169
- resolved = packageBrowserField[ resolved ];
170
- }
171
- browserMapCache[resolved] = packageBrowserField;
167
+ return resolveIdAsync(
168
+ importee,
169
+ Object.assign( resolveOptions, customResolveOptions )
170
+ )
171
+ .catch(function () { return false; })
172
+ .then(function (resolved) {
173
+ if (options.browser && packageBrowserField) {
174
+ if (packageBrowserField[ resolved ]) {
175
+ resolved = packageBrowserField[ resolved ];
172
176
  }
177
+ browserMapCache[resolved] = packageBrowserField;
178
+ }
173
179
 
174
- if ( !disregardResult && !err ) {
175
- if ( !preserveSymlinks && resolved && fs.existsSync( resolved ) ) {
176
- resolved = fs.realpathSync( resolved );
177
- }
180
+ if ( !disregardResult && resolved !== false ) {
181
+ if ( !preserveSymlinks && resolved && fs.existsSync( resolved ) ) {
182
+ resolved = fs.realpathSync( resolved );
183
+ }
178
184
 
179
- if ( ~builtins.indexOf( resolved ) ) {
180
- fulfil( null );
181
- } else if ( ~builtins.indexOf( importee ) && preferBuiltins ) {
182
- if ( !isPreferBuiltinsSet ) {
183
- onwarn(
184
- "preferring built-in module '" + importee + "' over local alternative " +
185
- "at '" + resolved + "', pass 'preferBuiltins: false' to disable this " +
186
- "behavior or 'preferBuiltins: true' to disable this warning"
187
- );
188
- }
189
- fulfil( null );
190
- } else if ( jail && resolved.indexOf( normalize( jail.trim( sep ) ) ) !== 0 ) {
191
- fulfil( null );
185
+ if ( ~builtins.indexOf( resolved ) ) {
186
+ return null;
187
+ } else if ( ~builtins.indexOf( importee ) && preferBuiltins ) {
188
+ if ( !isPreferBuiltinsSet ) {
189
+ onwarn(
190
+ "preferring built-in module '" + importee + "' over local alternative " +
191
+ "at '" + resolved + "', pass 'preferBuiltins: false' to disable this " +
192
+ "behavior or 'preferBuiltins: true' to disable this warning"
193
+ );
192
194
  }
195
+ return null;
196
+ } else if ( jail && resolved.indexOf( normalize( jail.trim( sep ) ) ) !== 0 ) {
197
+ return null;
193
198
  }
199
+ }
194
200
 
195
- if ( resolved && options.modulesOnly ) {
196
- fs.readFile( resolved, 'utf-8', function ( err, code ) {
197
- if ( err ) {
198
- reject( err );
199
- } else {
200
- var valid = isModule( code );
201
- fulfil( valid ? resolved : null );
202
- }
203
- });
204
- } else {
205
- fulfil( resolved );
206
- }
201
+ if ( resolved && options.modulesOnly ) {
202
+ return readFileAsync( resolved, 'utf-8').then(function (code) { return isModule( code ) ? resolved : null; });
203
+ } else {
204
+ return resolved === false ? null : resolved;
207
205
  }
208
- );
209
- });
206
+ });
210
207
  }
211
208
  };
212
209
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rollup-plugin-node-resolve",
3
3
  "description": "Bundle third-party dependencies in node_modules",
4
- "version": "3.3.0",
4
+ "version": "3.4.0",
5
5
  "devDependencies": {
6
6
  "buble": "^0.19.3",
7
7
  "es5-ext": "^0.10.39",
@@ -6,7 +6,9 @@ import fs from 'fs';
6
6
 
7
7
  const ES6_BROWSER_EMPTY = resolve( __dirname, '../src/empty.js' );
8
8
  const CONSOLE_WARN = ( ...args ) => console.warn( ...args ); // eslint-disable-line no-console
9
- const exts = [ '.js', '.json', '.node' ];
9
+ // It is important that .mjs occur before .js so that Rollup will interpret npm modules
10
+ // which deploy both ESM .mjs and CommonJS .js files as ESM.
11
+ const DEFAULT_EXTS = [ '.mjs', '.js', '.json', '.node' ];
10
12
 
11
13
  let readFileCache = {};
12
14
  const readFileAsync = file => new Promise((fulfil, reject) => fs.readFile(file, (err, contents) => err ? reject(err) : fulfil(contents)));
@@ -36,6 +38,8 @@ function cachedIsFile (file, cb) {
36
38
  isFileCache[file].then(contents => cb(null, contents), cb);
37
39
  }
38
40
 
41
+ const resolveIdAsync = (file, opts) => new Promise((fulfil, reject) => resolveId(file, opts, (err, contents) => err ? reject(err) : fulfil(contents)));
42
+
39
43
  export default function nodeResolve ( options = {} ) {
40
44
  const useModule = options.module !== false;
41
45
  const useMain = options.main !== false;
@@ -107,99 +111,92 @@ export default function nodeResolve ( options = {} ) {
107
111
 
108
112
  if (only && !only.some(pattern => pattern.test(id))) return null;
109
113
 
110
- return new Promise( ( fulfil, reject ) => {
111
- let disregardResult = false;
112
- let packageBrowserField = false;
113
-
114
- const resolveOptions = {
115
- basedir: dirname( importer ),
116
- packageFilter ( pkg, pkgPath ) {
117
- const pkgRoot = dirname( pkgPath );
118
- if (options.browser && typeof pkg[ 'browser' ] === 'object') {
119
- packageBrowserField = Object.keys(pkg[ 'browser' ]).reduce((browser, key) => {
120
- const resolved = pkg[ 'browser' ][ key ] === false ? false : resolve( pkgRoot, pkg[ 'browser' ][ key ] );
121
- browser[ key ] = resolved;
122
- if ( key[0] === '.' ) {
123
- const absoluteKey = resolve( pkgRoot, key );
124
- browser[ absoluteKey ] = resolved;
125
- if ( !extname(key) ) {
126
- exts.reduce( ( browser, ext ) => {
127
- browser[ absoluteKey + ext ] = browser[ key ];
128
- return browser;
129
- }, browser );
130
- }
114
+ let disregardResult = false;
115
+ let packageBrowserField = false;
116
+ const extensions = options.extensions || DEFAULT_EXTS;
117
+
118
+ const resolveOptions = {
119
+ basedir: dirname( importer ),
120
+ packageFilter ( pkg, pkgPath ) {
121
+ const pkgRoot = dirname( pkgPath );
122
+ if (options.browser && typeof pkg[ 'browser' ] === 'object') {
123
+ packageBrowserField = Object.keys(pkg[ 'browser' ]).reduce((browser, key) => {
124
+ const resolved = pkg[ 'browser' ][ key ] === false ? false : resolve( pkgRoot, pkg[ 'browser' ][ key ] );
125
+ browser[ key ] = resolved;
126
+ if ( key[0] === '.' ) {
127
+ const absoluteKey = resolve( pkgRoot, key );
128
+ browser[ absoluteKey ] = resolved;
129
+ if ( !extname(key) ) {
130
+ extensions.reduce( ( browser, ext ) => {
131
+ browser[ absoluteKey + ext ] = browser[ key ];
132
+ return browser;
133
+ }, browser );
131
134
  }
132
- return browser;
133
- }, {});
134
- }
135
+ }
136
+ return browser;
137
+ }, {});
138
+ }
135
139
 
136
- if (options.browser && typeof pkg[ 'browser' ] === 'string') {
137
- pkg[ 'main' ] = pkg[ 'browser' ];
138
- } else if ( useModule && pkg[ 'module' ] ) {
139
- pkg[ 'main' ] = pkg[ 'module' ];
140
- } else if ( useJsnext && pkg[ 'jsnext:main' ] ) {
141
- pkg[ 'main' ] = pkg[ 'jsnext:main' ];
142
- } else if ( ( useJsnext || useModule ) && !useMain ) {
143
- disregardResult = true;
144
- }
145
- return pkg;
146
- },
147
- readFile: cachedReadFile,
148
- isFile: cachedIsFile,
149
- extensions: options.extensions
150
- };
151
-
152
- if (preserveSymlinks !== undefined) {
153
- resolveOptions.preserveSymlinks = preserveSymlinks;
154
- }
140
+ if (options.browser && typeof pkg[ 'browser' ] === 'string') {
141
+ pkg[ 'main' ] = pkg[ 'browser' ];
142
+ } else if ( useModule && pkg[ 'module' ] ) {
143
+ pkg[ 'main' ] = pkg[ 'module' ];
144
+ } else if ( useJsnext && pkg[ 'jsnext:main' ] ) {
145
+ pkg[ 'main' ] = pkg[ 'jsnext:main' ];
146
+ } else if ( ( useJsnext || useModule ) && !useMain ) {
147
+ disregardResult = true;
148
+ }
149
+ return pkg;
150
+ },
151
+ readFile: cachedReadFile,
152
+ isFile: cachedIsFile,
153
+ extensions: extensions
154
+ };
155
+
156
+ if (preserveSymlinks !== undefined) {
157
+ resolveOptions.preserveSymlinks = preserveSymlinks;
158
+ }
155
159
 
156
- resolveId(
157
- importee,
158
- Object.assign( resolveOptions, customResolveOptions ),
159
- ( err, resolved ) => {
160
- if (options.browser && packageBrowserField) {
161
- if (packageBrowserField[ resolved ]) {
162
- resolved = packageBrowserField[ resolved ];
163
- }
164
- browserMapCache[resolved] = packageBrowserField;
160
+ return resolveIdAsync(
161
+ importee,
162
+ Object.assign( resolveOptions, customResolveOptions )
163
+ )
164
+ .catch(() => false)
165
+ .then(resolved => {
166
+ if (options.browser && packageBrowserField) {
167
+ if (packageBrowserField[ resolved ]) {
168
+ resolved = packageBrowserField[ resolved ];
165
169
  }
170
+ browserMapCache[resolved] = packageBrowserField;
171
+ }
166
172
 
167
- if ( !disregardResult && !err ) {
168
- if ( !preserveSymlinks && resolved && fs.existsSync( resolved ) ) {
169
- resolved = fs.realpathSync( resolved );
170
- }
173
+ if ( !disregardResult && resolved !== false ) {
174
+ if ( !preserveSymlinks && resolved && fs.existsSync( resolved ) ) {
175
+ resolved = fs.realpathSync( resolved );
176
+ }
171
177
 
172
- if ( ~builtins.indexOf( resolved ) ) {
173
- fulfil( null );
174
- } else if ( ~builtins.indexOf( importee ) && preferBuiltins ) {
175
- if ( !isPreferBuiltinsSet ) {
176
- onwarn(
177
- `preferring built-in module '${importee}' over local alternative ` +
178
- `at '${resolved}', pass 'preferBuiltins: false' to disable this ` +
179
- `behavior or 'preferBuiltins: true' to disable this warning`
180
- );
181
- }
182
- fulfil( null );
183
- } else if ( jail && resolved.indexOf( normalize( jail.trim( sep ) ) ) !== 0 ) {
184
- fulfil( null );
178
+ if ( ~builtins.indexOf( resolved ) ) {
179
+ return null;
180
+ } else if ( ~builtins.indexOf( importee ) && preferBuiltins ) {
181
+ if ( !isPreferBuiltinsSet ) {
182
+ onwarn(
183
+ `preferring built-in module '${importee}' over local alternative ` +
184
+ `at '${resolved}', pass 'preferBuiltins: false' to disable this ` +
185
+ `behavior or 'preferBuiltins: true' to disable this warning`
186
+ );
185
187
  }
188
+ return null;
189
+ } else if ( jail && resolved.indexOf( normalize( jail.trim( sep ) ) ) !== 0 ) {
190
+ return null;
186
191
  }
192
+ }
187
193
 
188
- if ( resolved && options.modulesOnly ) {
189
- fs.readFile( resolved, 'utf-8', ( err, code ) => {
190
- if ( err ) {
191
- reject( err );
192
- } else {
193
- const valid = isModule( code );
194
- fulfil( valid ? resolved : null );
195
- }
196
- });
197
- } else {
198
- fulfil( resolved );
199
- }
194
+ if ( resolved && options.modulesOnly ) {
195
+ return readFileAsync( resolved, 'utf-8').then(code => isModule( code ) ? resolved : null);
196
+ } else {
197
+ return resolved === false ? null : resolved;
200
198
  }
201
- );
202
- });
199
+ });
203
200
  }
204
201
  };
205
202
  }
@@ -21,13 +21,21 @@ var blockDeclarations = {
21
21
  };
22
22
 
23
23
  var extractors = {
24
+ Literal: function Literal ( names, param ) {
25
+ names.push( param.value );
26
+ },
27
+
24
28
  Identifier: function Identifier ( names, param ) {
25
29
  names.push( param.name );
26
30
  },
27
31
 
28
32
  ObjectPattern: function ObjectPattern ( names, param ) {
29
33
  param.properties.forEach( function (prop) {
30
- extractors[ prop.key.type ]( names, prop.key );
34
+ if ( prop.type === 'RestElement' ) {
35
+ extractors.RestElement( names, prop );
36
+ } else {
37
+ extractors[ (prop.value || prop.key).type ]( names, prop.value || prop.key );
38
+ }
31
39
  });
32
40
  },
33
41
 
@@ -79,7 +87,7 @@ Scope.prototype.addDeclaration = function addDeclaration ( node, isBlockDeclarat
79
87
  // it's a `var` or function node, and this
80
88
  // is a block scope, so we need to go up
81
89
  this.parent.addDeclaration( node, isBlockDeclaration, isVar );
82
- } else {
90
+ } else if ( node.id ) {
83
91
  extractNames( node.id ).forEach( function (name) {
84
92
  this$1.declarations[ name ] = true;
85
93
  });
@@ -217,7 +225,78 @@ function makeLegalIdentifier ( str ) {
217
225
  return str;
218
226
  }
219
227
 
228
+ function serializeArray (arr, indent, baseIndent) {
229
+ var output = '[';
230
+ var separator = indent ? '\n' + baseIndent + indent : '';
231
+ for (var i = 0; i < arr.length; i++) {
232
+ var key = arr[i];
233
+ output += "" + (i > 0 ? ',' : '') + separator + (serialize(key, indent, baseIndent + indent));
234
+ }
235
+ return output + (indent ? '\n' + baseIndent : '') + "]";
236
+ }
237
+
238
+ function serializeObject (obj, indent, baseIndent) {
239
+ var output = '{';
240
+ var separator = indent ? '\n' + baseIndent + indent : '';
241
+ var keys = Object.keys(obj);
242
+ for (var i = 0; i < keys.length; i++) {
243
+ var key = keys[i];
244
+ var stringKey = makeLegalIdentifier(key) === key ? key : JSON.stringify(key);
245
+ output += "" + (i > 0 ? ',' : '') + separator + stringKey + ":" + (indent ? ' ' : '') + (serialize(obj[key], indent, baseIndent + indent));
246
+ }
247
+ return output + (indent ? '\n' + baseIndent : '') + "}";
248
+ }
249
+
250
+ function serialize (obj, indent, baseIndent) {
251
+ if (obj === Infinity)
252
+ { return 'Infinity'; }
253
+ if (obj instanceof Date)
254
+ { return 'new Date(' + obj.getTime() + ')'; }
255
+ if (obj instanceof RegExp)
256
+ { return obj.toString(); }
257
+ if (typeof obj === 'number' && isNaN(obj))
258
+ { return 'NaN'; }
259
+ if (Array.isArray(obj))
260
+ { return serializeArray(obj, indent, baseIndent); }
261
+ if (obj === null)
262
+ { return 'null'; }
263
+ if (typeof obj === 'object')
264
+ { return serializeObject(obj, indent, baseIndent); }
265
+ return JSON.stringify(obj);
266
+ }
267
+
268
+ // convert data object into separate named exports (and default)
269
+ function dataToNamedExports (data, options) {
270
+ if ( options === void 0 ) options = {};
271
+
272
+ var t = options.compact ? '' : 'indent' in options ? options.indent : '\t';
273
+ var _ = options.compact ? '' : ' ';
274
+ var n = options.compact ? '' : '\n';
275
+ var declarationType = options.preferConst ? 'const' : 'var';
276
+
277
+ if (options.namedExports === false || typeof data !== 'object' || Array.isArray(data) || data === null)
278
+ { return ("export default" + _ + (serialize( data, options.compact ? null : t, '' )) + ";"); }
279
+
280
+ var namedExportCode = '';
281
+ var defaultExportRows = [];
282
+ var dataKeys = Object.keys(data);
283
+ for (var i = 0; i < dataKeys.length; i++) {
284
+ var key = dataKeys[i];
285
+ if (key === makeLegalIdentifier(key)) {
286
+ if (options.objectShorthand)
287
+ { defaultExportRows.push(key); }
288
+ else
289
+ { defaultExportRows.push((key + ":" + _ + key)); }
290
+ namedExportCode += "export " + declarationType + " " + key + _ + "=" + _ + (serialize(data[key], options.compact ? null : t, '')) + ";" + n;
291
+ } else {
292
+ defaultExportRows.push(((JSON.stringify(key)) + ": " + (serialize(data[key], options.compact ? null : t, ''))));
293
+ }
294
+ }
295
+ return namedExportCode + "export default" + _ + "{" + n + t + (defaultExportRows.join(("," + n + t))) + n + "};" + n;
296
+ }
297
+
220
298
  exports.addExtension = addExtension;
221
299
  exports.attachScopes = attachScopes;
222
300
  exports.createFilter = createFilter;
223
301
  exports.makeLegalIdentifier = makeLegalIdentifier;
302
+ exports.dataToEsm = dataToNamedExports;