requirejs-esm 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ The official [RequireJS optimizer] (`r.js`) does not wire up source maps from th
10
10
 
11
11
  ## Installation
12
12
 
13
- This module can be installed in your project using [NPM], [PNPM] or [Yarn]. Make sure, that you use [Node.js] version 6 or newer.
13
+ This module can be installed in your project using [NPM], [PNPM] or [Yarn]. Make sure, that you use [Node.js] version 14 or newer.
14
14
 
15
15
  ```sh
16
16
  npm i -D requirejs-esm
@@ -48,11 +48,20 @@ pragmasOnSave: {
48
48
  }
49
49
  ```
50
50
 
51
- See also a [demo] project:
51
+ See also a [demo-local] project, which includes sources only from the local `src` directory:
52
52
 
53
53
  ```sh
54
54
  npm start
55
- open http://localhost:8967/demo/normal.html
55
+ open http://localhost:8967/demo-local/normal.html
56
+ open http://localhost:8967/demo-local/optimized.html
57
+ ```
58
+
59
+ See also a [demo-extern] project, which includes sources from the local `src` directory and from `node_modules` outside of it:
60
+
61
+ ```sh
62
+ npm run start
63
+ open http://localhost:8967/demo-extern/normal.html
64
+ open http://localhost:8967/demo-extern/optimized.html
56
65
  ```
57
66
 
58
67
  ## Advanced
@@ -179,7 +188,8 @@ Licensed under the MIT license.
179
188
  [NPM]: https://www.npmjs.com/
180
189
  [PNPM]: https://pnpm.io/
181
190
  [Yarn]: https://yarnpkg.com/
182
- [demo]: https://github.com/prantlf/requirejs-esm/tree/master/demo
191
+ [demo-local]: https://github.com/prantlf/requirejs-esm/tree/master/demo-local
192
+ [demo-extern]: https://github.com/prantlf/requirejs-esm/tree/master/demo-extern
183
193
  [default module name resolution]: https://github.com/prantlf/requirejs-esm/blob/master/src/resolve-path.js#L48
184
194
  [resolvePath]: https://github.com/tleunen/babel-plugin-module-resolver/blob/master/DOCS.md#resolvepath
185
195
  [a lot faster]: ./perf/README.md#readme
package/dist/api.js CHANGED
@@ -944,9 +944,9 @@
944
944
  mask |= 8;
945
945
  break;
946
946
  case 115:
947
- if (mask & 12)
947
+ if (mask & 32)
948
948
  report(parser, 34, 's');
949
- mask |= 12;
949
+ mask |= 32;
950
950
  break;
951
951
  default:
952
952
  report(parser, 33);
@@ -1859,7 +1859,7 @@
1859
1859
  }
1860
1860
  else if (ch === 61) {
1861
1861
  advanceChar(parser);
1862
- return 8456000;
1862
+ return 8456256;
1863
1863
  }
1864
1864
  if (ch === 33) {
1865
1865
  const index = parser.index + 1;
@@ -2042,7 +2042,7 @@
2042
2042
  const ch = parser.currentChar;
2043
2043
  if (ch === 61) {
2044
2044
  advanceChar(parser);
2045
- return 8456001;
2045
+ return 8456257;
2046
2046
  }
2047
2047
  if (ch !== 62)
2048
2048
  return 8456259;
@@ -5034,7 +5034,7 @@
5034
5034
  nextToken(parser, context | 32768);
5035
5035
  const argument = parser.flags & 1 || parser.token & 1048576
5036
5036
  ? null
5037
- : parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.line, parser.column);
5037
+ : parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos);
5038
5038
  matchOrInsertSemicolon(parser, context | 32768);
5039
5039
  return finishNode(parser, context, start, line, column, {
5040
5040
  type: 'ReturnStatement',
@@ -6150,7 +6150,7 @@
6150
6150
  if ((context & 524288) < 1)
6151
6151
  report(parser, 26);
6152
6152
  if (context & 16384)
6153
- report(parser, 143);
6153
+ report(parser, 27);
6154
6154
  parser.assignable = 2;
6155
6155
  break;
6156
6156
  }
@@ -6159,7 +6159,7 @@
6159
6159
  if ((context & 262144) < 1)
6160
6160
  report(parser, 27);
6161
6161
  if (context & 16384)
6162
- report(parser, 143);
6162
+ report(parser, 27);
6163
6163
  parser.assignable = 1;
6164
6164
  break;
6165
6165
  }
@@ -6190,10 +6190,10 @@
6190
6190
  expr = parseUpdateExpression(parser, context, expr, start, line, column);
6191
6191
  }
6192
6192
  else if ((parser.token & 67108864) === 67108864) {
6193
- context = (context | 134217728 | 8192) ^ (134217728 | 8192);
6193
+ context = (context | 134217728) ^ 134217728;
6194
6194
  switch (parser.token) {
6195
6195
  case 67108877: {
6196
- nextToken(parser, context | 1073741824);
6196
+ nextToken(parser, (context | 1073741824 | 8192) ^ 8192);
6197
6197
  parser.assignable = 1;
6198
6198
  const property = parsePropertyOrPrivatePropertyName(parser, context);
6199
6199
  expr = finishNode(parser, context, start, line, column, {
@@ -6249,7 +6249,7 @@
6249
6249
  break;
6250
6250
  }
6251
6251
  case 67108991: {
6252
- nextToken(parser, context);
6252
+ nextToken(parser, (context | 1073741824 | 8192) ^ 8192);
6253
6253
  parser.flags |= 2048;
6254
6254
  parser.assignable = 2;
6255
6255
  expr = parseOptionalChain(parser, context, expr, start, line, column);
@@ -8413,12 +8413,10 @@
8413
8413
  }
8414
8414
  else if (context & 1 && parser.token === 131) {
8415
8415
  kind |= 4096;
8416
- key = parsePrivateIdentifier(parser, context, tokenPos, linePos, colPos);
8417
- context = context | 16384;
8416
+ key = parsePrivateIdentifier(parser, context | 16384, tokenPos, linePos, colPos);
8418
8417
  }
8419
8418
  else if (context & 1 && (parser.token & 1073741824) === 1073741824) {
8420
8419
  kind |= 128;
8421
- context = context | 16384;
8422
8420
  }
8423
8421
  else if (token === 122) {
8424
8422
  key = parseIdentifier(parser, context, 0);
@@ -8784,7 +8782,7 @@
8784
8782
  });
8785
8783
  }
8786
8784
  function parseJSXExpressionContainer(parser, context, inJSXChild, isAttr, start, line, column) {
8787
- nextToken(parser, context);
8785
+ nextToken(parser, context | 32768);
8788
8786
  const { tokenPos, linePos, colPos } = parser;
8789
8787
  if (parser.token === 14)
8790
8788
  return parseJSXSpreadChild(parser, context, tokenPos, linePos, colPos);
@@ -81686,6 +81684,9 @@
81686
81684
  });
81687
81685
 
81688
81686
  obj[impl][utils$1.wrapperSymbol] = obj;
81687
+ if (Impl.init) {
81688
+ Impl.init(obj[impl], privateData);
81689
+ }
81689
81690
  return obj;
81690
81691
  },
81691
81692
  interface: URLSearchParams,
@@ -82237,6 +82238,9 @@
82237
82238
  });
82238
82239
 
82239
82240
  obj[impl][utils$1.wrapperSymbol] = obj;
82241
+ if (Impl.init) {
82242
+ Impl.init(obj[impl], privateData);
82243
+ }
82240
82244
  return obj;
82241
82245
  },
82242
82246
  interface: URL,