@jsenv/core 29.1.19 → 29.2.0

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.
Files changed (73) hide show
  1. package/dist/babel_helpers/AsyncGenerator/AsyncGenerator.js +3 -16
  2. package/dist/babel_helpers/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -5
  3. package/dist/babel_helpers/applyDecs/applyDecs.js +54 -241
  4. package/dist/babel_helpers/applyDecs2023/applyDecs2023.js +47 -195
  5. package/dist/babel_helpers/arrayLikeToArray/arrayLikeToArray.js +0 -2
  6. package/dist/babel_helpers/arrayWithoutHoles/arrayWithoutHoles.js +2 -1
  7. package/dist/babel_helpers/assertThisInitialized/assertThisInitialized.js +0 -1
  8. package/dist/babel_helpers/asyncGeneratorDelegate/asyncGeneratorDelegate.js +4 -14
  9. package/dist/babel_helpers/asyncIterator/asyncIterator.js +5 -20
  10. package/dist/babel_helpers/asyncToGenerator/asyncToGenerator.js +2 -8
  11. package/dist/babel_helpers/awaitAsyncGenerator/awaitAsyncGenerator.js +1 -3
  12. package/dist/babel_helpers/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -4
  13. package/dist/babel_helpers/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -1
  14. package/dist/babel_helpers/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -1
  15. package/dist/babel_helpers/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -1
  16. package/dist/babel_helpers/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -1
  17. package/dist/babel_helpers/classPrivateMethodGet/classPrivateMethodGet.js +0 -1
  18. package/dist/babel_helpers/construct/construct.js +5 -5
  19. package/dist/babel_helpers/createClass/createClass.js +0 -1
  20. package/dist/babel_helpers/createForOfIteratorHelper/createForOfIteratorHelper.js +5 -9
  21. package/dist/babel_helpers/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +2 -3
  22. package/dist/babel_helpers/createRawReactElement/createRawReactElement.js +2 -8
  23. package/dist/babel_helpers/createSuper/createSuper.js +2 -4
  24. package/dist/babel_helpers/decorate/decorate.js +60 -311
  25. package/dist/babel_helpers/defaults/defaults.js +0 -3
  26. package/dist/babel_helpers/defineEnumerableProperties/defineEnumerableProperties.js +2 -5
  27. package/dist/babel_helpers/defineProperty/defineProperty.js +0 -1
  28. package/dist/babel_helpers/extends/extends.js +0 -3
  29. package/dist/babel_helpers/get/get.js +0 -3
  30. package/dist/babel_helpers/getPrototypeOf/getPrototypeOf.js +2 -1
  31. package/dist/babel_helpers/inherits/inherits.js +2 -3
  32. package/dist/babel_helpers/instanceof/instanceof.js +0 -1
  33. package/dist/babel_helpers/interopRequireWildcard/interopRequireWildcard.js +0 -10
  34. package/dist/babel_helpers/isNativeReflectConstruct/isNativeReflectConstruct.js +6 -6
  35. package/dist/babel_helpers/iterableToArrayLimit/iterableToArrayLimit.js +0 -5
  36. package/dist/babel_helpers/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +2 -5
  37. package/dist/babel_helpers/jsx/jsx.js +2 -8
  38. package/dist/babel_helpers/maybeArrayLike/maybeArrayLike.js +2 -3
  39. package/dist/babel_helpers/objectSpread/objectSpread.js +4 -6
  40. package/dist/babel_helpers/objectSpread2/objectSpread2.js +3 -8
  41. package/dist/babel_helpers/objectWithoutProperties/objectWithoutProperties.js +0 -3
  42. package/dist/babel_helpers/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -2
  43. package/dist/babel_helpers/possibleConstructorReturn/possibleConstructorReturn.js +0 -1
  44. package/dist/babel_helpers/set/set.js +2 -12
  45. package/dist/babel_helpers/superPropBase/superPropBase.js +0 -1
  46. package/dist/babel_helpers/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -1
  47. package/dist/babel_helpers/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -1
  48. package/dist/babel_helpers/toPrimitive/toPrimitive.js +1 -5
  49. package/dist/babel_helpers/typeof/typeof.js +0 -2
  50. package/dist/babel_helpers/wrapNativeSuper/wrapNativeSuper.js +0 -7
  51. package/dist/babel_helpers/wrapRegExp/wrapRegExp.js +5 -19
  52. package/dist/controllable_child_process.mjs +17 -27
  53. package/dist/controllable_worker_thread.mjs +4 -16
  54. package/dist/js/autoreload.js +13 -56
  55. package/dist/js/execute_using_dynamic_import.js +40 -164
  56. package/dist/js/global_this.js +2 -10
  57. package/dist/js/import_meta_hot.js +3 -9
  58. package/dist/js/new_stylesheet.js +0 -59
  59. package/dist/js/regenerator_runtime.js +80 -156
  60. package/dist/js/s.js +25 -113
  61. package/dist/js/s.js.map +10 -10
  62. package/dist/js/script_type_module_supervisor.js +4 -13
  63. package/dist/js/server_events_client.js +10 -38
  64. package/dist/js/supervisor.js +25 -167
  65. package/dist/js/v8_coverage.js +29 -92
  66. package/dist/js/ws.js +226 -704
  67. package/dist/main.js +761 -4155
  68. package/package.json +2 -2
  69. package/src/plugins/import_meta_url/client/import_meta_url_browser.js +1 -2
  70. package/src/plugins/import_meta_url/client/import_meta_url_commonjs.mjs +1 -1
  71. package/src/plugins/plugins.js +1 -1
  72. package/src/plugins/transpilation/as_js_classic/helpers-string.js +1 -0
  73. package/src/plugins/transpilation/babel/global_this/client/global_this.js +0 -2
@@ -2,11 +2,9 @@ const assertUrlLike = (value, name = "url") => {
2
2
  if (typeof value !== "string") {
3
3
  throw new TypeError(`${name} must be a url string, got ${value}`);
4
4
  }
5
-
6
5
  if (isWindowsPathnameSpecifier(value)) {
7
6
  throw new TypeError(`${name} must be a url but looks like a windows pathname, got ${value}`);
8
7
  }
9
-
10
8
  if (!hasScheme(value)) {
11
9
  throw new TypeError(`${name} must be a url and no scheme found, got ${value}`);
12
10
  }
@@ -15,18 +13,14 @@ const isPlainObject = value => {
15
13
  if (value === null) {
16
14
  return false;
17
15
  }
18
-
19
16
  if (typeof value === "object") {
20
17
  if (Array.isArray(value)) {
21
18
  return false;
22
19
  }
23
-
24
20
  return true;
25
21
  }
26
-
27
22
  return false;
28
23
  };
29
-
30
24
  const isWindowsPathnameSpecifier = specifier => {
31
25
  const firstChar = specifier[0];
32
26
  if (!/[a-zA-Z]/.test(firstChar)) return false;
@@ -35,7 +29,6 @@ const isWindowsPathnameSpecifier = specifier => {
35
29
  const thirdChar = specifier[2];
36
30
  return thirdChar === "/" || thirdChar === "\\";
37
31
  };
38
-
39
32
  const hasScheme = specifier => /^[a-zA-Z]+:/.test(specifier);
40
33
 
41
34
  const resolveAssociations = (associations, baseUrl) => {
@@ -53,13 +46,11 @@ const resolveAssociations = (associations, baseUrl) => {
53
46
  });
54
47
  return associationsResolved;
55
48
  };
56
-
57
49
  const normalizeUrlPattern = (urlPattern, baseUrl) => {
58
50
  // starts with a scheme
59
51
  if (/^[a-zA-Z]{2,}:/.test(urlPattern)) {
60
52
  return urlPattern;
61
53
  }
62
-
63
54
  return String(new URL(urlPattern, baseUrl));
64
55
  };
65
56
 
@@ -67,19 +58,17 @@ const asFlatAssociations = associations => {
67
58
  if (!isPlainObject(associations)) {
68
59
  throw new TypeError(`associations must be a plain object, got ${associations}`);
69
60
  }
70
-
71
61
  const flatAssociations = {};
72
62
  Object.keys(associations).forEach(key => {
73
63
  const valueMap = associations[key];
74
-
75
64
  if (!isPlainObject(valueMap)) {
76
65
  throw new TypeError(`all associations value must be objects, found "${key}": ${valueMap}`);
77
66
  }
78
-
79
67
  Object.keys(valueMap).forEach(pattern => {
80
68
  const value = valueMap[pattern];
81
69
  const previousValue = flatAssociations[pattern];
82
- flatAssociations[pattern] = previousValue ? { ...previousValue,
70
+ flatAssociations[pattern] = previousValue ? {
71
+ ...previousValue,
83
72
  [key]: value
84
73
  } : {
85
74
  [key]: value
@@ -94,8 +83,8 @@ const asFlatAssociations = associations => {
94
83
  * https://git-scm.com/docs/gitignore
95
84
  * https://github.com/kaelzhang/node-ignore
96
85
  */
97
- /** @module jsenv_url_meta **/
98
86
 
87
+ /** @module jsenv_url_meta **/
99
88
  /**
100
89
  * An object representing the result of applying a pattern to an url
101
90
  * @typedef {Object} MatchResult
@@ -112,7 +101,6 @@ const asFlatAssociations = associations => {
112
101
  * @param {string} applyPatternMatchingParams.url a string representing an url
113
102
  * @return {MatchResult}
114
103
  */
115
-
116
104
  const applyPatternMatching = ({
117
105
  url,
118
106
  pattern
@@ -142,7 +130,6 @@ const applyPatternMatching = ({
142
130
  matchGroups
143
131
  };
144
132
  };
145
-
146
133
  const applyMatching = (pattern, string) => {
147
134
  const groups = [];
148
135
  let patternIndex = 0;
@@ -150,76 +137,63 @@ const applyMatching = (pattern, string) => {
150
137
  let remainingPattern = pattern;
151
138
  let remainingString = string;
152
139
  let restoreIndexes = true;
153
-
154
140
  const consumePattern = count => {
155
141
  const subpattern = remainingPattern.slice(0, count);
156
142
  remainingPattern = remainingPattern.slice(count);
157
143
  patternIndex += count;
158
144
  return subpattern;
159
145
  };
160
-
161
146
  const consumeString = count => {
162
147
  const substring = remainingString.slice(0, count);
163
148
  remainingString = remainingString.slice(count);
164
149
  index += count;
165
150
  return substring;
166
151
  };
167
-
168
152
  const consumeRemainingString = () => {
169
153
  return consumeString(remainingString.length);
170
154
  };
171
-
172
155
  let matched;
173
-
174
156
  const iterate = () => {
175
157
  const patternIndexBefore = patternIndex;
176
158
  const indexBefore = index;
177
159
  matched = matchOne();
178
-
179
160
  if (matched === undefined) {
180
161
  consumePattern(1);
181
162
  consumeString(1);
182
163
  iterate();
183
164
  return;
184
165
  }
185
-
186
166
  if (matched === false && restoreIndexes) {
187
167
  patternIndex = patternIndexBefore;
188
168
  index = indexBefore;
189
169
  }
190
170
  };
191
-
192
171
  const matchOne = () => {
193
172
  // pattern consumed and string consumed
194
173
  if (remainingPattern === "" && remainingString === "") {
195
174
  return true; // string fully matched pattern
196
- } // pattern consumed, string not consumed
197
-
198
-
175
+ }
176
+ // pattern consumed, string not consumed
199
177
  if (remainingPattern === "" && remainingString !== "") {
200
178
  return false; // fails because string longer than expected
201
- } // -- from this point pattern is not consumed --
179
+ }
180
+ // -- from this point pattern is not consumed --
202
181
  // string consumed, pattern not consumed
203
-
204
-
205
182
  if (remainingString === "") {
206
183
  if (remainingPattern === "**") {
207
184
  // trailing "**" is optional
208
185
  consumePattern(2);
209
186
  return true;
210
187
  }
211
-
212
188
  if (remainingPattern === "*") {
213
189
  groups.push({
214
190
  string: ""
215
191
  });
216
192
  }
217
-
218
193
  return false; // fail because string shorter than expected
219
- } // -- from this point pattern and string are not consumed --
194
+ }
195
+ // -- from this point pattern and string are not consumed --
220
196
  // fast path trailing slash
221
-
222
-
223
197
  if (remainingPattern === "/") {
224
198
  if (remainingString[0] === "/") {
225
199
  // trailing slash match remaining
@@ -229,31 +203,25 @@ const applyMatching = (pattern, string) => {
229
203
  });
230
204
  return true;
231
205
  }
232
-
233
206
  return false;
234
- } // fast path trailing '**'
235
-
236
-
207
+ }
208
+ // fast path trailing '**'
237
209
  if (remainingPattern === "**") {
238
210
  consumePattern(2);
239
211
  consumeRemainingString();
240
212
  return true;
241
- } // pattern leading **
242
-
243
-
213
+ }
214
+ // pattern leading **
244
215
  if (remainingPattern.slice(0, 2) === "**") {
245
216
  consumePattern(2); // consumes "**"
246
-
247
217
  if (remainingPattern[0] === "/") {
248
218
  consumePattern(1); // consumes "/"
249
- } // pattern ending with ** always match remaining string
250
-
251
-
219
+ }
220
+ // pattern ending with ** always match remaining string
252
221
  if (remainingPattern === "") {
253
222
  consumeRemainingString();
254
223
  return true;
255
224
  }
256
-
257
225
  const skipResult = skipUntilMatch({
258
226
  pattern: remainingPattern,
259
227
  string: remainingString,
@@ -265,29 +233,24 @@ const applyMatching = (pattern, string) => {
265
233
  restoreIndexes = false;
266
234
  return skipResult.matched;
267
235
  }
268
-
269
236
  if (remainingPattern[0] === "*") {
270
237
  consumePattern(1); // consumes "*"
271
-
272
238
  if (remainingPattern === "") {
273
239
  // matches everything except '/'
274
240
  const slashIndex = remainingString.indexOf("/");
275
-
276
241
  if (slashIndex === -1) {
277
242
  groups.push({
278
243
  string: consumeRemainingString()
279
244
  });
280
245
  return true;
281
246
  }
282
-
283
247
  groups.push({
284
248
  string: consumeString(slashIndex)
285
249
  });
286
250
  return false;
287
- } // the next char must not the one expected by remainingPattern[0]
251
+ }
252
+ // the next char must not the one expected by remainingPattern[0]
288
253
  // because * is greedy and expect to skip at least one char
289
-
290
-
291
254
  if (remainingPattern[0] === remainingString[0]) {
292
255
  groups.push({
293
256
  string: ""
@@ -295,7 +258,6 @@ const applyMatching = (pattern, string) => {
295
258
  patternIndex = patternIndex - 1;
296
259
  return false;
297
260
  }
298
-
299
261
  const skipResult = skipUntilMatch({
300
262
  pattern: remainingPattern,
301
263
  string: remainingString,
@@ -307,14 +269,11 @@ const applyMatching = (pattern, string) => {
307
269
  restoreIndexes = false;
308
270
  return skipResult.matched;
309
271
  }
310
-
311
272
  if (remainingPattern[0] !== remainingString[0]) {
312
273
  return false;
313
274
  }
314
-
315
275
  return undefined;
316
276
  };
317
-
318
277
  iterate();
319
278
  return {
320
279
  matched,
@@ -323,7 +282,6 @@ const applyMatching = (pattern, string) => {
323
282
  groups
324
283
  };
325
284
  };
326
-
327
285
  const skipUntilMatch = ({
328
286
  pattern,
329
287
  string,
@@ -332,10 +290,8 @@ const skipUntilMatch = ({
332
290
  let index = 0;
333
291
  let remainingString = string;
334
292
  let longestMatchRange = null;
335
-
336
293
  const tryToMatch = () => {
337
294
  const matchAttempt = applyMatching(pattern, remainingString);
338
-
339
295
  if (matchAttempt.matched) {
340
296
  return {
341
297
  matched: true,
@@ -347,7 +303,6 @@ const skipUntilMatch = ({
347
303
  }
348
304
  };
349
305
  }
350
-
351
306
  const matchAttemptIndex = matchAttempt.index;
352
307
  const matchRange = {
353
308
  patternIndex: matchAttempt.patternIndex,
@@ -355,21 +310,17 @@ const skipUntilMatch = ({
355
310
  length: matchAttemptIndex,
356
311
  groups: matchAttempt.groups
357
312
  };
358
-
359
313
  if (!longestMatchRange || longestMatchRange.length < matchRange.length) {
360
314
  longestMatchRange = matchRange;
361
315
  }
362
-
363
316
  const nextIndex = matchAttemptIndex + 1;
364
317
  const canSkip = nextIndex < remainingString.length && (canSkipSlash || remainingString[0] !== "/");
365
-
366
318
  if (canSkip) {
367
319
  // search against the next unattempted string
368
320
  index += nextIndex;
369
321
  remainingString = remainingString.slice(nextIndex);
370
322
  return tryToMatch();
371
323
  }
372
-
373
324
  return {
374
325
  matched: false,
375
326
  patternIndex: longestMatchRange.patternIndex,
@@ -380,7 +331,6 @@ const skipUntilMatch = ({
380
331
  }
381
332
  };
382
333
  };
383
-
384
334
  return tryToMatch();
385
335
  };
386
336
 
@@ -397,19 +347,16 @@ const applyAssociations = ({
397
347
  pattern,
398
348
  url
399
349
  });
400
-
401
350
  if (matched) {
402
351
  const value = flatAssociations[pattern];
403
-
404
352
  if (isPlainObject(previousValue) && isPlainObject(value)) {
405
- return { ...previousValue,
353
+ return {
354
+ ...previousValue,
406
355
  ...value
407
356
  };
408
357
  }
409
-
410
358
  return value;
411
359
  }
412
-
413
360
  return previousValue;
414
361
  }, {});
415
362
  };
@@ -424,19 +371,15 @@ const applyAliases = ({
424
371
  pattern: key,
425
372
  url
426
373
  });
427
-
428
374
  if (aliasMatchResult.matched) {
429
375
  aliasFullMatchResult = aliasMatchResult;
430
376
  return true;
431
377
  }
432
-
433
378
  return false;
434
379
  });
435
-
436
380
  if (!aliasMatchingKey) {
437
381
  return url;
438
382
  }
439
-
440
383
  const {
441
384
  matchGroups
442
385
  } = aliasFullMatchResult;
@@ -453,22 +396,20 @@ const urlChildMayMatch = ({
453
396
  associations,
454
397
  predicate
455
398
  }) => {
456
- assertUrlLike(url, "url"); // the function was meants to be used on url ending with '/'
457
-
399
+ assertUrlLike(url, "url");
400
+ // the function was meants to be used on url ending with '/'
458
401
  if (!url.endsWith("/")) {
459
402
  throw new Error(`url should end with /, got ${url}`);
460
403
  }
461
-
462
404
  if (typeof predicate !== "function") {
463
405
  throw new TypeError(`predicate must be a function, got ${predicate}`);
464
406
  }
465
-
466
- const flatAssociations = asFlatAssociations(associations); // for full match we must create an object to allow pattern to override previous ones
467
-
407
+ const flatAssociations = asFlatAssociations(associations);
408
+ // for full match we must create an object to allow pattern to override previous ones
468
409
  let fullMatchMeta = {};
469
- let someFullMatch = false; // for partial match, any meta satisfying predicate will be valid because
410
+ let someFullMatch = false;
411
+ // for partial match, any meta satisfying predicate will be valid because
470
412
  // we don't know for sure if pattern will still match for a file inside pathname
471
-
472
413
  const partialMatchMetaArray = [];
473
414
  Object.keys(flatAssociations).forEach(pattern => {
474
415
  const value = flatAssociations[pattern];
@@ -476,12 +417,11 @@ const urlChildMayMatch = ({
476
417
  pattern,
477
418
  url
478
419
  });
479
-
480
420
  if (matchResult.matched) {
481
421
  someFullMatch = true;
482
-
483
422
  if (isPlainObject(fullMatchMeta) && isPlainObject(value)) {
484
- fullMatchMeta = { ...fullMatchMeta,
423
+ fullMatchMeta = {
424
+ ...fullMatchMeta,
485
425
  ...value
486
426
  };
487
427
  } else {
@@ -491,11 +431,9 @@ const urlChildMayMatch = ({
491
431
  partialMatchMetaArray.push(value);
492
432
  }
493
433
  });
494
-
495
434
  if (someFullMatch) {
496
435
  return Boolean(predicate(fullMatchMeta));
497
436
  }
498
-
499
437
  return partialMatchMetaArray.some(partialMatchMeta => predicate(partialMatchMeta));
500
438
  };
501
439
 
@@ -514,7 +452,6 @@ const filterV8Coverage = async (v8Coverage, {
514
452
  const associations = URL_META.resolveAssociations({
515
453
  cover: coverageConfig
516
454
  }, rootDirectoryUrl);
517
-
518
455
  const urlShouldBeCovered = url => {
519
456
  const {
520
457
  cover
@@ -524,8 +461,8 @@ const filterV8Coverage = async (v8Coverage, {
524
461
  });
525
462
  return cover;
526
463
  };
527
-
528
- const v8CoverageFiltered = { ...v8Coverage,
464
+ const v8CoverageFiltered = {
465
+ ...v8Coverage,
529
466
  result: v8Coverage.result.filter(fileReport => urlShouldBeCovered(fileReport.url))
530
467
  };
531
468
  return v8CoverageFiltered;