@absolutejs/absolute 0.19.0-beta.1130 → 0.19.0-beta.1132

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
@@ -34462,7 +34462,13 @@ ${stubs}
34462
34462
  if (indexHit)
34463
34463
  return `${srcPath}/index${indexHit}`;
34464
34464
  return srcPath;
34465
- }, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex4 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
34465
+ }, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex4 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), importScanTranspiler, scanRealImportSpecifiers = (code) => {
34466
+ try {
34467
+ return new Set(importScanTranspiler.scanImports(code).map((entry) => entry.path));
34468
+ } catch {
34469
+ return null;
34470
+ }
34471
+ }, buildImportRewriter = (vendorPaths) => {
34466
34472
  const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
34467
34473
  if (entries.length === 0)
34468
34474
  return null;
@@ -34530,7 +34536,11 @@ ${stubs}
34530
34536
  }
34531
34537
  }, rewriteImports = (code, filePath, projectRoot, rewriter) => {
34532
34538
  let result = code;
34539
+ const realSpecifiers = scanRealImportSpecifiers(code);
34540
+ const isRealImport = (specifier) => realSpecifiers === null || realSpecifiers.has(specifier);
34533
34541
  const vendorReplace = (_match, prefix, specifier, suffix) => {
34542
+ if (!isRealImport(specifier))
34543
+ return _match;
34534
34544
  const webPath = rewriter?.lookup.get(specifier);
34535
34545
  return webPath ? `${prefix}${webPath}${suffix}` : _match;
34536
34546
  };
@@ -34541,6 +34551,8 @@ ${stubs}
34541
34551
  const stubReplace = (_match, prefix, specifier, suffix) => {
34542
34552
  if (specifier.startsWith("/") || specifier.startsWith("."))
34543
34553
  return _match;
34554
+ if (!isRealImport(specifier))
34555
+ return _match;
34544
34556
  const resolved = resolveAbsoluteSpecifier(specifier, projectRoot);
34545
34557
  if (resolved) {
34546
34558
  return `${prefix}${srcUrl(resolved, projectRoot)}${suffix}`;
@@ -34550,9 +34562,9 @@ ${stubs}
34550
34562
  result = result.replace(/^((?:import\s+[^"'`;]+?\s+from|export\s+[^"'`;]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
34551
34563
  result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
34552
34564
  const fileDir = dirname26(filePath);
34553
- result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
34554
- result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
34555
- result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
34565
+ result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
34566
+ result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}` : _match);
34567
+ result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}` : _match);
34556
34568
  const rewriteAbsoluteToSrc = (_match, prefix, absPath, _ext, suffix) => {
34557
34569
  if (absPath.startsWith(projectRoot)) {
34558
34570
  const rel2 = relative16(projectRoot, absPath).replace(/\\/g, "/");
@@ -35275,6 +35287,7 @@ var init_moduleServer = __esm(() => {
35275
35287
  ".css"
35276
35288
  ]);
35277
35289
  REACT_EXTENSIONS = new Set([".tsx", ".jsx"]);
35290
+ importScanTranspiler = new Bun.Transpiler({ loader: "tsx" });
35278
35291
  mtimeCache = new Map;
35279
35292
  NODE_BUILTIN_RE = /^(?:node:|(?:assert|async_hooks|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|http2|https|inspector|module|net|os|path|perf_hooks|process|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|trace_events|tty|url|util|v8|vm|wasi|worker_threads|zlib)(?:\/|$))/;
35280
35293
  JSX_AUTO_RE = /\b(jsxDEV_[a-z0-9]+)\b/;
@@ -48040,5 +48053,5 @@ export {
48040
48053
  ANGULAR_INIT_TIMEOUT_MS
48041
48054
  };
48042
48055
 
48043
- //# debugId=E12DF3B1C7D1CA0064756E2164756E21
48056
+ //# debugId=82221892868C9F1E64756E2164756E21
48044
48057
  //# sourceMappingURL=index.js.map