piral-core 1.3.1-beta.6128 → 1.3.1-beta.6135

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/dist/codegen.js CHANGED
@@ -99,7 +99,7 @@ var require_polyfills = __commonJS({
99
99
  var start = Date.now();
100
100
  var backoff = 0;
101
101
  fs$rename(from, to, function CB(er) {
102
- if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
102
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
103
103
  setTimeout(function() {
104
104
  fs2.stat(to, function(stater, st) {
105
105
  if (stater && stater.code === "ENOENT")
@@ -974,14 +974,16 @@ var require_CachedInputFileSystem = __commonJS({
974
974
  } catch (err) {
975
975
  this._storeResult(path, err, void 0);
976
976
  this._enterSyncModeWhenIdle();
977
- if (callbacks)
977
+ if (callbacks) {
978
978
  runCallbacks(callbacks, err, void 0);
979
+ }
979
980
  throw err;
980
981
  }
981
982
  this._storeResult(path, void 0, result);
982
983
  this._enterSyncModeWhenIdle();
983
- if (callbacks)
984
+ if (callbacks) {
984
985
  runCallbacks(callbacks, void 0, result);
986
+ }
985
987
  return result;
986
988
  }
987
989
  purge(what) {
@@ -2339,7 +2341,7 @@ var require_lib = __commonJS({
2339
2341
  var require_createInnerContext = __commonJS({
2340
2342
  "../../../node_modules/enhanced-resolve/lib/createInnerContext.js"(exports, module2) {
2341
2343
  "use strict";
2342
- module2.exports = function createInnerContext(options, message, messageOptional) {
2344
+ module2.exports = function createInnerContext(options, message) {
2343
2345
  let messageReported = false;
2344
2346
  let innerLog = void 0;
2345
2347
  if (options.log) {
@@ -2355,7 +2357,7 @@ var require_createInnerContext = __commonJS({
2355
2357
  innerLog = options.log;
2356
2358
  }
2357
2359
  }
2358
- const childContext = {
2360
+ return {
2359
2361
  log: innerLog,
2360
2362
  yield: options.yield,
2361
2363
  fileDependencies: options.fileDependencies,
@@ -2363,7 +2365,6 @@ var require_createInnerContext = __commonJS({
2363
2365
  missingDependencies: options.missingDependencies,
2364
2366
  stack: options.stack
2365
2367
  };
2366
- return childContext;
2367
2368
  };
2368
2369
  }
2369
2370
  });
@@ -2585,7 +2586,7 @@ var require_Resolver = __commonJS({
2585
2586
  PathType
2586
2587
  } = require_path();
2587
2588
  function toCamelCase(str) {
2588
- return str.replace(/-([a-z])/g, (str2) => str2.substr(1).toUpperCase());
2589
+ return str.replace(/-([a-z])/g, (str2) => str2.slice(1).toUpperCase());
2589
2590
  }
2590
2591
  var Resolver = class {
2591
2592
  static createStackEntry(hook, request) {
@@ -2607,18 +2608,19 @@ var require_Resolver = __commonJS({
2607
2608
  }
2608
2609
  name = toCamelCase(name);
2609
2610
  if (/^before/.test(name)) {
2610
- return this.ensureHook(name[6].toLowerCase() + name.substr(7)).withOptions({
2611
+ return this.ensureHook(name[6].toLowerCase() + name.slice(7)).withOptions({
2611
2612
  stage: -10
2612
2613
  });
2613
2614
  }
2614
2615
  if (/^after/.test(name)) {
2615
- return this.ensureHook(name[5].toLowerCase() + name.substr(6)).withOptions({
2616
+ return this.ensureHook(name[5].toLowerCase() + name.slice(6)).withOptions({
2616
2617
  stage: 10
2617
2618
  });
2618
2619
  }
2619
2620
  const hook = this.hooks[name];
2620
2621
  if (!hook) {
2621
- return this.hooks[name] = new AsyncSeriesBailHook(["request", "resolveContext"], name);
2622
+ this.hooks[name] = new AsyncSeriesBailHook(["request", "resolveContext"], name);
2623
+ return this.hooks[name];
2622
2624
  }
2623
2625
  return hook;
2624
2626
  }
@@ -2628,12 +2630,12 @@ var require_Resolver = __commonJS({
2628
2630
  }
2629
2631
  name = toCamelCase(name);
2630
2632
  if (/^before/.test(name)) {
2631
- return this.getHook(name[6].toLowerCase() + name.substr(7)).withOptions({
2633
+ return this.getHook(name[6].toLowerCase() + name.slice(7)).withOptions({
2632
2634
  stage: -10
2633
2635
  });
2634
2636
  }
2635
2637
  if (/^after/.test(name)) {
2636
- return this.getHook(name[5].toLowerCase() + name.substr(6)).withOptions({
2638
+ return this.getHook(name[5].toLowerCase() + name.slice(6)).withOptions({
2637
2639
  stage: 10
2638
2640
  });
2639
2641
  }
@@ -2685,8 +2687,9 @@ var require_Resolver = __commonJS({
2685
2687
  yieldCalled = true;
2686
2688
  };
2687
2689
  finishYield = (result) => {
2688
- if (result)
2690
+ if (result) {
2689
2691
  yield_(result);
2692
+ }
2690
2693
  callback(null);
2691
2694
  };
2692
2695
  }
@@ -2716,8 +2719,9 @@ var require_Resolver = __commonJS({
2716
2719
  }, (err, result) => {
2717
2720
  if (err)
2718
2721
  return callback(err);
2719
- if (yieldCalled || result && yield_)
2722
+ if (yieldCalled || result && yield_) {
2720
2723
  return finishYield(result);
2724
+ }
2721
2725
  if (result)
2722
2726
  return finishResolved(result);
2723
2727
  return finishWithoutResolve(log);
@@ -2733,8 +2737,9 @@ var require_Resolver = __commonJS({
2733
2737
  }, (err, result) => {
2734
2738
  if (err)
2735
2739
  return callback(err);
2736
- if (yieldCalled || result && yield_)
2740
+ if (yieldCalled || result && yield_) {
2737
2741
  return finishYield(result);
2742
+ }
2738
2743
  if (result)
2739
2744
  return finishResolved(result);
2740
2745
  const log = [];
@@ -2745,8 +2750,9 @@ var require_Resolver = __commonJS({
2745
2750
  }, (err2, result2) => {
2746
2751
  if (err2)
2747
2752
  return callback(err2);
2748
- if (yieldCalled || result2 && yield_)
2753
+ if (yieldCalled || result2 && yield_) {
2749
2754
  return finishYield(result2);
2755
+ }
2750
2756
  return finishWithoutResolve(log);
2751
2757
  });
2752
2758
  });
@@ -2808,7 +2814,7 @@ var require_Resolver = __commonJS({
2808
2814
  part.module = this.isModule(part.request);
2809
2815
  part.directory = this.isDirectory(part.request);
2810
2816
  if (part.directory) {
2811
- part.request = part.request.substr(0, part.request.length - 1);
2817
+ part.request = part.request.slice(0, -1);
2812
2818
  }
2813
2819
  }
2814
2820
  return part;
@@ -2932,7 +2938,7 @@ var require_forEachBail = __commonJS({
2932
2938
  while (next())
2933
2939
  ;
2934
2940
  loop = true;
2935
- });
2941
+ }, i);
2936
2942
  if (!loop)
2937
2943
  loop = false;
2938
2944
  return loop;
@@ -3053,7 +3059,7 @@ var require_DescriptionFileUtils = __commonJS({
3053
3059
  const p = i < 0 ? j : j < 0 ? i : i < j ? j : i;
3054
3060
  if (p < 0)
3055
3061
  return null;
3056
- return directory.substr(0, p || 1);
3062
+ return directory.slice(0, p || 1);
3057
3063
  }
3058
3064
  exports.loadDescriptionFile = loadDescriptionFile;
3059
3065
  exports.getField = getField;
@@ -3179,7 +3185,7 @@ var require_AliasPlugin = __commonJS({
3179
3185
  forEachBail(this.options, (item, callback2) => {
3180
3186
  let shouldStop = false;
3181
3187
  if (innerRequest === item.name || !item.onlyModule && (request.request ? innerRequest.startsWith(`${item.name}/`) : isSubPath(innerRequest, item.name))) {
3182
- const remainingRequest = innerRequest.substr(item.name.length);
3188
+ const remainingRequest = innerRequest.slice(item.name.length);
3183
3189
  const resolveWithAlias = (alias, callback3) => {
3184
3190
  if (alias === false) {
3185
3191
  const ignoreObj = {
@@ -3325,7 +3331,7 @@ var require_DescriptionFilePlugin = __commonJS({
3325
3331
  resolveContext.log(`No description file found in ${directory} or above`);
3326
3332
  return callback();
3327
3333
  }
3328
- const relativePath = "." + path.substr(result.directory.length).replace(/\\/g, "/");
3334
+ const relativePath = "." + path.slice(result.directory.length).replace(/\\/g, "/");
3329
3335
  const obj = {
3330
3336
  ...request,
3331
3337
  descriptionFilePath: result.path,
@@ -3395,19 +3401,20 @@ var require_entrypoints = __commonJS({
3395
3401
  var slashCode = "/".charCodeAt(0);
3396
3402
  var dotCode = ".".charCodeAt(0);
3397
3403
  var hashCode = "#".charCodeAt(0);
3404
+ var patternRegEx = /\*/g;
3398
3405
  module2.exports.processExportsField = function processExportsField(exportsField) {
3399
- return createFieldProcessor(buildExportsFieldPathTree(exportsField), assertExportsFieldRequest, assertExportTarget);
3406
+ return createFieldProcessor(buildExportsField(exportsField), (request) => request.length === 0 ? "." : "./" + request, assertExportsFieldRequest, assertExportTarget);
3400
3407
  };
3401
3408
  module2.exports.processImportsField = function processImportsField(importsField) {
3402
- return createFieldProcessor(buildImportsFieldPathTree(importsField), assertImportsFieldRequest, assertImportTarget);
3409
+ return createFieldProcessor(buildImportsField(importsField), (request) => "#" + request, assertImportsFieldRequest, assertImportTarget);
3403
3410
  };
3404
- function createFieldProcessor(treeRoot, assertRequest, assertTarget) {
3411
+ function createFieldProcessor(field, normalizeRequest, assertRequest, assertTarget) {
3405
3412
  return function fieldProcessor(request, conditionNames) {
3406
3413
  request = assertRequest(request);
3407
- const match = findMatch(request, treeRoot);
3414
+ const match = findMatch(normalizeRequest(request), field);
3408
3415
  if (match === null)
3409
3416
  return [];
3410
- const [mapping, remainRequestIndex] = match;
3417
+ const [mapping, remainingRequest, isSubpathMapping, isPattern] = match;
3411
3418
  let direct = null;
3412
3419
  if (isConditionalMapping(mapping)) {
3413
3420
  direct = conditionalMapping(mapping, conditionNames);
@@ -3416,8 +3423,7 @@ var require_entrypoints = __commonJS({
3416
3423
  } else {
3417
3424
  direct = mapping;
3418
3425
  }
3419
- const remainingRequest = remainRequestIndex === request.length + 1 ? void 0 : remainRequestIndex < 0 ? request.slice(-remainRequestIndex - 1) : request.slice(remainRequestIndex);
3420
- return directMapping(remainingRequest, remainRequestIndex < 0, direct, conditionNames, assertTarget);
3426
+ return directMapping(remainingRequest, isPattern, isSubpathMapping, direct, conditionNames, assertTarget);
3421
3427
  };
3422
3428
  }
3423
3429
  function assertExportsFieldRequest(request) {
@@ -3464,108 +3470,101 @@ var require_entrypoints = __commonJS({
3464
3470
  throw new Error(expectFolder ? `Expecting folder to folder mapping. ${JSON.stringify(imp)} should end with "/"` : `Expecting file to file mapping. ${JSON.stringify(imp)} should not end with "/"`);
3465
3471
  }
3466
3472
  }
3467
- function findMatch(request, treeRoot) {
3468
- if (request.length === 0) {
3469
- const value2 = treeRoot.files.get("");
3470
- return value2 ? [value2, 1] : null;
3471
- }
3472
- if (treeRoot.children === null && treeRoot.folder === null && treeRoot.wildcards === null) {
3473
- const value2 = treeRoot.files.get(request);
3474
- return value2 ? [value2, request.length + 1] : null;
3475
- }
3476
- let node = treeRoot;
3477
- let lastNonSlashIndex = 0;
3478
- let slashIndex = request.indexOf("/", 0);
3479
- let lastFolderMatch = null;
3480
- const applyFolderMapping = () => {
3481
- const folderMapping = node.folder;
3482
- if (folderMapping) {
3483
- if (lastFolderMatch) {
3484
- lastFolderMatch[0] = folderMapping;
3485
- lastFolderMatch[1] = -lastNonSlashIndex - 1;
3486
- } else {
3487
- lastFolderMatch = [folderMapping, -lastNonSlashIndex - 1];
3488
- }
3489
- }
3490
- };
3491
- const applyWildcardMappings = (wildcardMappings, remainingRequest2) => {
3492
- if (wildcardMappings) {
3493
- for (const [key, target] of wildcardMappings) {
3494
- if (remainingRequest2.startsWith(key)) {
3495
- if (!lastFolderMatch) {
3496
- lastFolderMatch = [target, lastNonSlashIndex + key.length];
3497
- } else if (lastFolderMatch[1] < lastNonSlashIndex + key.length) {
3498
- lastFolderMatch[0] = target;
3499
- lastFolderMatch[1] = lastNonSlashIndex + key.length;
3500
- }
3501
- }
3473
+ function patternKeyCompare(a, b) {
3474
+ const aPatternIndex = a.indexOf("*");
3475
+ const bPatternIndex = b.indexOf("*");
3476
+ const baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
3477
+ const baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
3478
+ if (baseLenA > baseLenB)
3479
+ return -1;
3480
+ if (baseLenB > baseLenA)
3481
+ return 1;
3482
+ if (aPatternIndex === -1)
3483
+ return 1;
3484
+ if (bPatternIndex === -1)
3485
+ return -1;
3486
+ if (a.length > b.length)
3487
+ return -1;
3488
+ if (b.length > a.length)
3489
+ return 1;
3490
+ return 0;
3491
+ }
3492
+ function findMatch(request, field) {
3493
+ if (Object.prototype.hasOwnProperty.call(field, request) && !request.includes("*") && !request.endsWith("/")) {
3494
+ const target2 = field[request];
3495
+ return [target2, "", false, false];
3496
+ }
3497
+ let bestMatch = "";
3498
+ let bestMatchSubpath;
3499
+ const keys = Object.getOwnPropertyNames(field);
3500
+ for (let i = 0; i < keys.length; i++) {
3501
+ const key = keys[i];
3502
+ const patternIndex = key.indexOf("*");
3503
+ if (patternIndex !== -1 && request.startsWith(key.slice(0, patternIndex))) {
3504
+ const patternTrailer = key.slice(patternIndex + 1);
3505
+ if (request.length >= key.length && request.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
3506
+ bestMatch = key;
3507
+ bestMatchSubpath = request.slice(patternIndex, request.length - patternTrailer.length);
3502
3508
  }
3509
+ } else if (key[key.length - 1] === "/" && request.startsWith(key) && patternKeyCompare(bestMatch, key) === 1) {
3510
+ bestMatch = key;
3511
+ bestMatchSubpath = request.slice(key.length);
3503
3512
  }
3504
- };
3505
- while (slashIndex !== -1) {
3506
- applyFolderMapping();
3507
- const wildcardMappings = node.wildcards;
3508
- if (!wildcardMappings && node.children === null)
3509
- return lastFolderMatch;
3510
- const folder = request.slice(lastNonSlashIndex, slashIndex);
3511
- applyWildcardMappings(wildcardMappings, folder);
3512
- if (node.children === null)
3513
- return lastFolderMatch;
3514
- const newNode = node.children.get(folder);
3515
- if (!newNode) {
3516
- return lastFolderMatch;
3517
- }
3518
- node = newNode;
3519
- lastNonSlashIndex = slashIndex + 1;
3520
- slashIndex = request.indexOf("/", lastNonSlashIndex);
3521
- }
3522
- const remainingRequest = lastNonSlashIndex > 0 ? request.slice(lastNonSlashIndex) : request;
3523
- const value = node.files.get(remainingRequest);
3524
- if (value) {
3525
- return [value, request.length + 1];
3526
3513
  }
3527
- applyFolderMapping();
3528
- applyWildcardMappings(node.wildcards, remainingRequest);
3529
- return lastFolderMatch;
3514
+ if (bestMatch === "")
3515
+ return null;
3516
+ const target = field[bestMatch];
3517
+ const isSubpathMapping = bestMatch.endsWith("/");
3518
+ const isPattern = bestMatch.includes("*");
3519
+ return [
3520
+ target,
3521
+ bestMatchSubpath,
3522
+ isSubpathMapping,
3523
+ isPattern
3524
+ ];
3530
3525
  }
3531
3526
  function isConditionalMapping(mapping) {
3532
3527
  return mapping !== null && typeof mapping === "object" && !Array.isArray(mapping);
3533
3528
  }
3534
- function directMapping(remainingRequest, subpathMapping, mappingTarget, conditionNames, assert) {
3529
+ function directMapping(remainingRequest, isPattern, isSubpathMapping, mappingTarget, conditionNames, assert) {
3535
3530
  if (mappingTarget === null)
3536
3531
  return [];
3537
3532
  if (typeof mappingTarget === "string") {
3538
3533
  return [
3539
- targetMapping(remainingRequest, subpathMapping, mappingTarget, assert)
3534
+ targetMapping(remainingRequest, isPattern, isSubpathMapping, mappingTarget, assert)
3540
3535
  ];
3541
3536
  }
3542
3537
  const targets = [];
3543
3538
  for (const exp of mappingTarget) {
3544
3539
  if (typeof exp === "string") {
3545
- targets.push(targetMapping(remainingRequest, subpathMapping, exp, assert));
3540
+ targets.push(targetMapping(remainingRequest, isPattern, isSubpathMapping, exp, assert));
3546
3541
  continue;
3547
3542
  }
3548
3543
  const mapping = conditionalMapping(exp, conditionNames);
3549
3544
  if (!mapping)
3550
3545
  continue;
3551
- const innerExports = directMapping(remainingRequest, subpathMapping, mapping, conditionNames, assert);
3546
+ const innerExports = directMapping(remainingRequest, isPattern, isSubpathMapping, mapping, conditionNames, assert);
3552
3547
  for (const innerExport of innerExports) {
3553
3548
  targets.push(innerExport);
3554
3549
  }
3555
3550
  }
3556
3551
  return targets;
3557
3552
  }
3558
- function targetMapping(remainingRequest, subpathMapping, mappingTarget, assert) {
3553
+ function targetMapping(remainingRequest, isPattern, isSubpathMapping, mappingTarget, assert) {
3559
3554
  if (remainingRequest === void 0) {
3560
3555
  assert(mappingTarget, false);
3561
3556
  return mappingTarget;
3562
3557
  }
3563
- if (subpathMapping) {
3558
+ if (isSubpathMapping) {
3564
3559
  assert(mappingTarget, true);
3565
3560
  return mappingTarget + remainingRequest;
3566
3561
  }
3567
3562
  assert(mappingTarget, false);
3568
- return mappingTarget.replace(/\*/g, remainingRequest.replace(/\$/g, "$$"));
3563
+ let result = mappingTarget;
3564
+ if (isPattern) {
3565
+ result = result.replace(patternRegEx, remainingRequest.replace(/\$/g, "$$"));
3566
+ }
3567
+ return result;
3569
3568
  }
3570
3569
  function conditionalMapping(conditionalMapping_, conditionNames) {
3571
3570
  let lookup = [[conditionalMapping_, Object.keys(conditionalMapping_), 0]];
@@ -3604,61 +3603,9 @@ var require_entrypoints = __commonJS({
3604
3603
  }
3605
3604
  return null;
3606
3605
  }
3607
- function createNode() {
3608
- return {
3609
- children: null,
3610
- folder: null,
3611
- wildcards: null,
3612
- files: new Map()
3613
- };
3614
- }
3615
- function walkPath(root, path, target) {
3616
- if (path.length === 0) {
3617
- root.folder = target;
3618
- return;
3619
- }
3620
- let node = root;
3621
- let lastNonSlashIndex = 0;
3622
- let slashIndex = path.indexOf("/", 0);
3623
- while (slashIndex !== -1) {
3624
- const folder = path.slice(lastNonSlashIndex, slashIndex);
3625
- let newNode;
3626
- if (node.children === null) {
3627
- newNode = createNode();
3628
- node.children = new Map();
3629
- node.children.set(folder, newNode);
3630
- } else {
3631
- newNode = node.children.get(folder);
3632
- if (!newNode) {
3633
- newNode = createNode();
3634
- node.children.set(folder, newNode);
3635
- }
3636
- }
3637
- node = newNode;
3638
- lastNonSlashIndex = slashIndex + 1;
3639
- slashIndex = path.indexOf("/", lastNonSlashIndex);
3640
- }
3641
- if (lastNonSlashIndex >= path.length) {
3642
- node.folder = target;
3643
- } else {
3644
- const file = lastNonSlashIndex > 0 ? path.slice(lastNonSlashIndex) : path;
3645
- if (file.endsWith("*")) {
3646
- if (node.wildcards === null)
3647
- node.wildcards = new Map();
3648
- node.wildcards.set(file.slice(0, -1), target);
3649
- } else {
3650
- node.files.set(file, target);
3651
- }
3652
- }
3653
- }
3654
- function buildExportsFieldPathTree(field) {
3655
- const root = createNode();
3656
- if (typeof field === "string") {
3657
- root.files.set("", field);
3658
- return root;
3659
- } else if (Array.isArray(field)) {
3660
- root.files.set("", field.slice());
3661
- return root;
3606
+ function buildExportsField(field) {
3607
+ if (typeof field === "string" || Array.isArray(field)) {
3608
+ return { ".": field };
3662
3609
  }
3663
3610
  const keys = Object.keys(field);
3664
3611
  for (let i = 0; i < keys.length; i++) {
@@ -3672,24 +3619,20 @@ var require_entrypoints = __commonJS({
3672
3619
  }
3673
3620
  i++;
3674
3621
  }
3675
- root.files.set("", field);
3676
- return root;
3622
+ return { ".": field };
3677
3623
  }
3678
3624
  throw new Error(`Exports field key should be relative path and start with "." (key: ${JSON.stringify(key)})`);
3679
3625
  }
3680
3626
  if (key.length === 1) {
3681
- root.files.set("", field[key]);
3682
3627
  continue;
3683
3628
  }
3684
3629
  if (key.charCodeAt(1) !== slashCode) {
3685
3630
  throw new Error(`Exports field key should be relative path and start with "./" (key: ${JSON.stringify(key)})`);
3686
3631
  }
3687
- walkPath(root, key.slice(2), field[key]);
3688
3632
  }
3689
- return root;
3633
+ return field;
3690
3634
  }
3691
- function buildImportsFieldPathTree(field) {
3692
- const root = createNode();
3635
+ function buildImportsField(field) {
3693
3636
  const keys = Object.keys(field);
3694
3637
  for (let i = 0; i < keys.length; i++) {
3695
3638
  const key = keys[i];
@@ -3702,9 +3645,8 @@ var require_entrypoints = __commonJS({
3702
3645
  if (key.charCodeAt(1) === slashCode) {
3703
3646
  throw new Error(`Imports field key should not start with "#/" (key: ${JSON.stringify(key)})`);
3704
3647
  }
3705
- walkPath(root, key.slice(1), field[key]);
3706
3648
  }
3707
- return root;
3649
+ return field;
3708
3650
  }
3709
3651
  }
3710
3652
  });
@@ -3801,12 +3743,26 @@ var require_ExtensionAliasPlugin = __commonJS({
3801
3743
  const requestPath = request.request;
3802
3744
  if (!requestPath || !requestPath.endsWith(extension))
3803
3745
  return callback();
3804
- const resolve2 = (alias2, callback2) => {
3805
- resolver.doResolve(target, {
3746
+ const isAliasString = typeof alias === "string";
3747
+ const resolve2 = (alias2, callback2, index) => {
3748
+ const newRequest = `${requestPath.slice(0, -extension.length)}${alias2}`;
3749
+ return resolver.doResolve(target, {
3806
3750
  ...request,
3807
- request: `${requestPath.slice(0, -extension.length)}${alias2}`,
3751
+ request: newRequest,
3808
3752
  fullySpecified: true
3809
- }, `aliased from extension alias with mapping '${extension}' to '${alias2}'`, resolveContext, callback2);
3753
+ }, `aliased from extension alias with mapping '${extension}' to '${alias2}'`, resolveContext, (err, result) => {
3754
+ if (!isAliasString && index) {
3755
+ if (index !== this.options.alias.length) {
3756
+ if (resolveContext.log) {
3757
+ resolveContext.log(`Failed to alias from extension alias with mapping '${extension}' to '${alias2}' for '${newRequest}': ${err}`);
3758
+ }
3759
+ return callback2(null, result);
3760
+ }
3761
+ return callback2(err, result);
3762
+ } else {
3763
+ callback2(err, result);
3764
+ }
3765
+ });
3810
3766
  };
3811
3767
  const stoppingCallback = (err, result) => {
3812
3768
  if (err)
@@ -3815,7 +3771,7 @@ var require_ExtensionAliasPlugin = __commonJS({
3815
3771
  return callback(null, result);
3816
3772
  return callback(null, null);
3817
3773
  };
3818
- if (typeof alias === "string") {
3774
+ if (isAliasString) {
3819
3775
  resolve2(alias, stoppingCallback);
3820
3776
  } else if (alias.length > 1) {
3821
3777
  forEachBail(alias, resolve2, stoppingCallback);
@@ -3979,7 +3935,9 @@ var require_JoinRequestPartPlugin = __commonJS({
3979
3935
  if (i >= 0 && req.charCodeAt(2) === namespaceStartCharCode) {
3980
3936
  i = req.indexOf("/", i + 1);
3981
3937
  }
3982
- let moduleName, remainingRequest, fullySpecified;
3938
+ let moduleName;
3939
+ let remainingRequest;
3940
+ let fullySpecified;
3983
3941
  if (i < 0) {
3984
3942
  moduleName = req;
3985
3943
  remainingRequest = ".";
@@ -4015,10 +3973,12 @@ var require_JoinRequestPlugin = __commonJS({
4015
3973
  apply(resolver) {
4016
3974
  const target = resolver.ensureHook(this.target);
4017
3975
  resolver.getHook(this.source).tapAsync("JoinRequestPlugin", (request, resolveContext, callback) => {
3976
+ const requestPath = request.path;
3977
+ const requestRequest = request.request;
4018
3978
  const obj = {
4019
3979
  ...request,
4020
- path: resolver.join(request.path, request.request),
4021
- relativePath: request.relativePath && resolver.join(request.relativePath, request.request),
3980
+ path: resolver.join(requestPath, requestRequest),
3981
+ relativePath: request.relativePath && resolver.join(request.relativePath, requestRequest),
4022
3982
  request: void 0
4023
3983
  };
4024
3984
  resolver.doResolve(target, obj, null, resolveContext, callback);
@@ -4078,12 +4038,12 @@ var require_getPaths = __commonJS({
4078
4038
  const paths = [path];
4079
4039
  const segments = [parts[parts.length - 1]];
4080
4040
  let part = parts[parts.length - 1];
4081
- path = path.substr(0, path.length - part.length - 1);
4041
+ path = path.substring(0, path.length - part.length - 1);
4082
4042
  for (let i = parts.length - 2; i > 2; i -= 2) {
4083
4043
  paths.push(path);
4084
4044
  part = parts[i];
4085
- path = path.substr(0, path.length - part.length) || "/";
4086
- segments.push(part.substr(0, part.length - 1));
4045
+ path = path.substring(0, path.length - part.length) || "/";
4046
+ segments.push(part.slice(0, -1));
4087
4047
  }
4088
4048
  part = parts[1];
4089
4049
  segments.push(part);
@@ -4098,7 +4058,7 @@ var require_getPaths = __commonJS({
4098
4058
  const p = i < 0 ? j : j < 0 ? i : i < j ? j : i;
4099
4059
  if (p < 0)
4100
4060
  return null;
4101
- const s = path.substr(p + 1);
4061
+ const s = path.slice(p + 1);
4102
4062
  return s;
4103
4063
  };
4104
4064
  }
@@ -4605,8 +4565,9 @@ var require_UnsafeCachePlugin = __commonJS({
4605
4565
  if (isYield) {
4606
4566
  if (result)
4607
4567
  yieldResult.push(result);
4608
- for (const result2 of yieldResult)
4568
+ for (const result2 of yieldResult) {
4609
4569
  yieldFn(result2);
4570
+ }
4610
4571
  this.cache[cacheId] = yieldResult;
4611
4572
  return callback(null, null);
4612
4573
  }
@@ -4691,7 +4652,7 @@ var require_ResolverFactory = __commonJS({
4691
4652
  const obj = { name: key, onlyModule: false, alias: alias[key] };
4692
4653
  if (/\$$/.test(key)) {
4693
4654
  obj.onlyModule = true;
4694
- obj.name = key.substr(0, key.length - 1);
4655
+ obj.name = key.slice(0, -1);
4695
4656
  }
4696
4657
  return obj;
4697
4658
  }) : alias || [];
@@ -4925,14 +4886,15 @@ var require_ResolverFactory = __commonJS({
4925
4886
  plugins.push(new SymlinkPlugin("existing-file", "existing-file"));
4926
4887
  plugins.push(new NextPlugin("existing-file", "resolved"));
4927
4888
  }
4889
+ const resolved = resolver.hooks.resolved;
4928
4890
  if (restrictions.size > 0) {
4929
- plugins.push(new RestrictionsPlugin(resolver.hooks.resolved, restrictions));
4891
+ plugins.push(new RestrictionsPlugin(resolved, restrictions));
4930
4892
  }
4931
- plugins.push(new ResultPlugin(resolver.hooks.resolved));
4893
+ plugins.push(new ResultPlugin(resolved));
4932
4894
  for (const plugin of plugins) {
4933
4895
  if (typeof plugin === "function") {
4934
4896
  plugin.call(resolver, resolver);
4935
- } else {
4897
+ } else if (plugin) {
4936
4898
  plugin.apply(resolver);
4937
4899
  }
4938
4900
  }
@@ -4971,8 +4933,9 @@ var require_CloneBasenamePlugin = __commonJS({
4971
4933
  apply(resolver) {
4972
4934
  const target = resolver.ensureHook(this.target);
4973
4935
  resolver.getHook(this.source).tapAsync("CloneBasenamePlugin", (request, resolveContext, callback) => {
4974
- const filename = basename(request.path);
4975
- const filePath = resolver.join(request.path, filename);
4936
+ const requestPath = request.path;
4937
+ const filename = basename(requestPath);
4938
+ const filePath = resolver.join(requestPath, filename);
4976
4939
  const obj = {
4977
4940
  ...request,
4978
4941
  path: filePath,
@@ -5039,7 +5002,7 @@ var require_lib2 = __commonJS({
5039
5002
  extensions: [".js", ".json", ".node"],
5040
5003
  fileSystem: nodeFileSystem2
5041
5004
  });
5042
- function resolve2(context, path, request, resolveContext, callback) {
5005
+ var resolve2 = (context, path, request, resolveContext, callback) => {
5043
5006
  if (typeof context === "string") {
5044
5007
  callback = resolveContext;
5045
5008
  resolveContext = request;
@@ -5051,27 +5014,26 @@ var require_lib2 = __commonJS({
5051
5014
  callback = resolveContext;
5052
5015
  }
5053
5016
  asyncResolver.resolve(context, path, request, resolveContext, callback);
5054
- }
5017
+ };
5055
5018
  var syncResolver = ResolverFactory2.createResolver({
5056
5019
  conditionNames: ["node"],
5057
5020
  extensions: [".js", ".json", ".node"],
5058
5021
  useSyncFileSystemCalls: true,
5059
5022
  fileSystem: nodeFileSystem2
5060
5023
  });
5061
- function resolveSync(context, path, request) {
5024
+ var resolveSync = (context, path, request) => {
5062
5025
  if (typeof context === "string") {
5063
5026
  request = path;
5064
5027
  path = context;
5065
5028
  context = nodeContext2;
5066
5029
  }
5067
5030
  return syncResolver.resolveSync(context, path, request);
5068
- }
5031
+ };
5069
5032
  function create(options) {
5070
- options = {
5033
+ const resolver = ResolverFactory2.createResolver({
5071
5034
  fileSystem: nodeFileSystem2,
5072
5035
  ...options
5073
- };
5074
- const resolver = ResolverFactory2.createResolver(options);
5036
+ });
5075
5037
  return function(context, path, request, resolveContext, callback) {
5076
5038
  if (typeof context === "string") {
5077
5039
  callback = resolveContext;
@@ -5087,12 +5049,11 @@ var require_lib2 = __commonJS({
5087
5049
  };
5088
5050
  }
5089
5051
  function createSync(options) {
5090
- options = {
5052
+ const resolver = ResolverFactory2.createResolver({
5091
5053
  useSyncFileSystemCalls: true,
5092
5054
  fileSystem: nodeFileSystem2,
5093
5055
  ...options
5094
- };
5095
- const resolver = ResolverFactory2.createResolver(options);
5056
+ });
5096
5057
  return function(context, path, request) {
5097
5058
  if (typeof context === "string") {
5098
5059
  request = path;
@@ -28,5 +28,5 @@ export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, E
28
28
  error: any;
29
29
  };
30
30
  componentDidCatch(error: Error): void;
31
- render(): JSX.Element;
31
+ render(): React.JSX.Element;
32
32
  }
@@ -1,11 +1,11 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { ExtensionSlotProps } from '../types';
3
3
  /**
4
4
  * The extension slot component to be used when the available
5
5
  * extensions of a given name should be rendered at a specific
6
6
  * location.
7
7
  */
8
- export declare function ExtensionSlot<T extends string>(props: ExtensionSlotProps<T>): JSX.Element;
8
+ export declare function ExtensionSlot<T extends string>(props: ExtensionSlotProps<T>): React.JSX.Element;
9
9
  export declare namespace ExtensionSlot {
10
10
  var displayName: string;
11
11
  }
@@ -14,6 +14,6 @@ export declare class ForeignComponentContainer<T> extends React.Component<Foreig
14
14
  componentDidMount(): void;
15
15
  componentDidUpdate(): void;
16
16
  componentWillUnmount(): void;
17
- render(): JSX.Element;
17
+ render(): React.JSX.Element;
18
18
  }
19
19
  export {};
@@ -3,5 +3,5 @@ import type { AnyComponent, ComponentConverters, PiletApi, BaseComponentProps }
3
3
  interface CapturedProps {
4
4
  piral: PiletApi;
5
5
  }
6
- export declare function wrapComponent<T>(converters: ComponentConverters<T & BaseComponentProps>, component: AnyComponent<T & BaseComponentProps>, captured: CapturedProps, Wrapper: React.FC<T>): React.MemoExoticComponent<(props: T) => JSX.Element> | React.ComponentType<T>;
6
+ export declare function wrapComponent<T>(converters: ComponentConverters<T & BaseComponentProps>, component: AnyComponent<T & BaseComponentProps>, captured: CapturedProps, Wrapper: React.FC<T>): React.MemoExoticComponent<(props: T) => React.JSX.Element> | React.ComponentType<T>;
7
7
  export {};
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { NavigationApi } from '../types';
3
3
  export declare function useRouterContext(): import("react-router").RouteComponentProps<{}, import("react-router").StaticContext, unknown>;
4
4
  export declare function useCurrentNavigation(): void;
5
- export declare function createRedirect(to: string): () => JSX.Element;
5
+ export declare function createRedirect(to: string): () => React.JSX.Element;
6
6
  export declare function createNavigation(publicPath: string): NavigationApi;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { NavigationApi } from '../types';
3
3
  export declare function useRouterContext(): unknown;
4
4
  export declare function useCurrentNavigation(): void;
5
- export declare function createRedirect(to: string): () => JSX.Element;
5
+ export declare function createRedirect(to: string): () => React.JSX.Element;
6
6
  export declare function createNavigation(publicPath: string): NavigationApi;
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  import { AnyComponent, Errors, PiletApi, BaseComponentProps, GlobalStateContext } from '../types';
3
- export declare function withApi<TProps>(context: GlobalStateContext, component: AnyComponent<TProps & BaseComponentProps>, piral: PiletApi, errorType: keyof Errors, wrapperType?: string, captured?: {}): React.MemoExoticComponent<(props: TProps) => JSX.Element> | React.ComponentType<TProps>;
3
+ export declare function withApi<TProps>(context: GlobalStateContext, component: AnyComponent<TProps & BaseComponentProps>, piral: PiletApi, errorType: keyof Errors, wrapperType?: string, captured?: {}): React.MemoExoticComponent<(props: TProps) => React.JSX.Element> | React.ComponentType<TProps>;
@@ -1,2 +1,2 @@
1
1
  import * as React from 'react';
2
- export declare function defaultRender(children: React.ReactNode, key?: string): JSX.Element;
2
+ export declare function defaultRender(children: React.ReactNode, key?: string): React.JSX.Element;
@@ -28,5 +28,5 @@ export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, E
28
28
  error: any;
29
29
  };
30
30
  componentDidCatch(error: Error): void;
31
- render(): JSX.Element;
31
+ render(): React.JSX.Element;
32
32
  }
@@ -1,11 +1,11 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { ExtensionSlotProps } from '../types';
3
3
  /**
4
4
  * The extension slot component to be used when the available
5
5
  * extensions of a given name should be rendered at a specific
6
6
  * location.
7
7
  */
8
- export declare function ExtensionSlot<T extends string>(props: ExtensionSlotProps<T>): JSX.Element;
8
+ export declare function ExtensionSlot<T extends string>(props: ExtensionSlotProps<T>): React.JSX.Element;
9
9
  export declare namespace ExtensionSlot {
10
10
  var displayName: string;
11
11
  }
@@ -14,6 +14,6 @@ export declare class ForeignComponentContainer<T> extends React.Component<Foreig
14
14
  componentDidMount(): void;
15
15
  componentDidUpdate(): void;
16
16
  componentWillUnmount(): void;
17
- render(): JSX.Element;
17
+ render(): React.JSX.Element;
18
18
  }
19
19
  export {};
@@ -3,5 +3,5 @@ import type { AnyComponent, ComponentConverters, PiletApi, BaseComponentProps }
3
3
  interface CapturedProps {
4
4
  piral: PiletApi;
5
5
  }
6
- export declare function wrapComponent<T>(converters: ComponentConverters<T & BaseComponentProps>, component: AnyComponent<T & BaseComponentProps>, captured: CapturedProps, Wrapper: React.FC<T>): React.MemoExoticComponent<(props: T) => JSX.Element> | React.ComponentType<T>;
6
+ export declare function wrapComponent<T>(converters: ComponentConverters<T & BaseComponentProps>, component: AnyComponent<T & BaseComponentProps>, captured: CapturedProps, Wrapper: React.FC<T>): React.MemoExoticComponent<(props: T) => React.JSX.Element> | React.ComponentType<T>;
7
7
  export {};
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { NavigationApi } from '../types';
3
3
  export declare function useRouterContext(): import("react-router").RouteComponentProps<{}, import("react-router").StaticContext, unknown>;
4
4
  export declare function useCurrentNavigation(): void;
5
- export declare function createRedirect(to: string): () => JSX.Element;
5
+ export declare function createRedirect(to: string): () => React.JSX.Element;
6
6
  export declare function createNavigation(publicPath: string): NavigationApi;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { NavigationApi } from '../types';
3
3
  export declare function useRouterContext(): unknown;
4
4
  export declare function useCurrentNavigation(): void;
5
- export declare function createRedirect(to: string): () => JSX.Element;
5
+ export declare function createRedirect(to: string): () => React.JSX.Element;
6
6
  export declare function createNavigation(publicPath: string): NavigationApi;
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  import { AnyComponent, Errors, PiletApi, BaseComponentProps, GlobalStateContext } from '../types';
3
- export declare function withApi<TProps>(context: GlobalStateContext, component: AnyComponent<TProps & BaseComponentProps>, piral: PiletApi, errorType: keyof Errors, wrapperType?: string, captured?: {}): React.MemoExoticComponent<(props: TProps) => JSX.Element> | React.ComponentType<TProps>;
3
+ export declare function withApi<TProps>(context: GlobalStateContext, component: AnyComponent<TProps & BaseComponentProps>, piral: PiletApi, errorType: keyof Errors, wrapperType?: string, captured?: {}): React.MemoExoticComponent<(props: TProps) => React.JSX.Element> | React.ComponentType<TProps>;
@@ -1,2 +1,2 @@
1
1
  import * as React from 'react';
2
- export declare function defaultRender(children: React.ReactNode, key?: string): JSX.Element;
2
+ export declare function defaultRender(children: React.ReactNode, key?: string): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-core",
3
- "version": "1.3.1-beta.6128",
3
+ "version": "1.3.1-beta.6135",
4
4
  "description": "The core library for creating a Piral instance.",
5
5
  "keywords": [
6
6
  "portal",
@@ -73,8 +73,8 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "path-to-regexp": "^1.8.0",
76
- "piral-base": "1.3.1-beta.6128",
77
- "piral-debug-utils": "1.3.1-beta.6128",
76
+ "piral-base": "1.3.1-beta.6135",
77
+ "piral-debug-utils": "1.3.1-beta.6135",
78
78
  "zustand": "^3.0.0"
79
79
  },
80
80
  "devDependencies": {
@@ -94,5 +94,5 @@
94
94
  "react-router-dom",
95
95
  "tslib"
96
96
  ],
97
- "gitHead": "0a7041321aa3b3c86371377f74094df506ec3bae"
97
+ "gitHead": "553fea569c05719bdd52e2d0f4e141f165721243"
98
98
  }