@absolutejs/absolute 0.19.0-beta.42 → 0.19.0-beta.44

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/index.js CHANGED
@@ -202253,24 +202253,29 @@ ${stubs}
202253
202253
  return { dynamicRegex, fromRegex, lookup, sideEffectRegex };
202254
202254
  }, rewriteImports2 = (code, filePath, projectRoot, rewriter) => {
202255
202255
  let result = code;
202256
- result = result.replace(/^(import\s+.+?\s+from\s*["'])([^"'./][^"']*)(["'])/gm, (_match, prefix, specifier, suffix) => {
202257
- const webPath = rewriter?.lookup.get(specifier);
202258
- if (webPath)
202259
- return `${prefix}${webPath}${suffix}`;
202260
- return `${prefix}/@stub/${encodeURIComponent(specifier)}${suffix}`;
202261
- });
202262
- result = result.replace(/^(import\s*["'])([^"'./][^"']*)(["'])/gm, (_match, prefix, specifier, suffix) => {
202263
- const webPath = rewriter?.lookup.get(specifier);
202264
- if (webPath)
202265
- return `${prefix}${webPath}${suffix}`;
202266
- return `${prefix}/@stub/${encodeURIComponent(specifier)}${suffix}`;
202267
- });
202268
- result = result.replace(/^(export\s+.+?\s+from\s*["'])([^"'./][^"']*)(["'])/gm, (_match, prefix, specifier, suffix) => {
202269
- const webPath = rewriter?.lookup.get(specifier);
202270
- if (webPath)
202256
+ if (rewriter) {
202257
+ const replacer = (_match, prefix, specifier, suffix) => {
202258
+ const webPath = rewriter.lookup.get(specifier);
202259
+ if (!webPath)
202260
+ return _match;
202271
202261
  return `${prefix}${webPath}${suffix}`;
202262
+ };
202263
+ rewriter.fromRegex.lastIndex = 0;
202264
+ rewriter.sideEffectRegex.lastIndex = 0;
202265
+ rewriter.dynamicRegex.lastIndex = 0;
202266
+ result = result.replace(rewriter.fromRegex, replacer);
202267
+ result = result.replace(rewriter.sideEffectRegex, replacer);
202268
+ result = result.replace(rewriter.dynamicRegex, replacer);
202269
+ }
202270
+ const stubReplace = (_match, prefix, specifier, suffix) => {
202271
+ if (specifier.startsWith("/") || specifier.startsWith("."))
202272
+ return _match;
202272
202273
  return `${prefix}/@stub/${encodeURIComponent(specifier)}${suffix}`;
202273
- });
202274
+ };
202275
+ result = result.replace(/^(import\s+.+?\s+from\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
202276
+ result = result.replace(/^(import\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
202277
+ result = result.replace(/^(export\s+.+?\s+from\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
202278
+ result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
202274
202279
  const fileDir = dirname7(filePath);
202275
202280
  result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => {
202276
202281
  const absPath = resolve18(fileDir, relPath);
@@ -204675,5 +204680,5 @@ export {
204675
204680
  ANGULAR_INIT_TIMEOUT_MS
204676
204681
  };
204677
204682
 
204678
- //# debugId=2350BCD37BC3493864756E2164756E21
204683
+ //# debugId=353A4DB53F40B1B164756E2164756E21
204679
204684
  //# sourceMappingURL=index.js.map