@absolutejs/absolute 0.19.0-beta.780 → 0.19.0-beta.782

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/cli/index.js CHANGED
@@ -890,6 +890,7 @@ var {env: env3 } = globalThis.Bun;
890
890
  import {
891
891
  cpSync,
892
892
  existsSync as existsSync9,
893
+ mkdirSync as mkdirSync5,
893
894
  readdirSync as readdirSync2,
894
895
  readFileSync as readFileSync9,
895
896
  rmSync as rmSync2,
@@ -917,6 +918,47 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
917
918
  result.push(fullPath);
918
919
  }
919
920
  return result;
921
+ }, SERVER_RUNTIME_ASSET_RE, SERVER_RUNTIME_SOURCE_EXTENSIONS, SERVER_RUNTIME_SCAN_SKIP_DIRS, hasSourceExtension = (filePath) => SERVER_RUNTIME_SOURCE_EXTENSIONS.has(filePath.slice(filePath.lastIndexOf("."))), collectProjectSourceFiles = (dir) => {
922
+ const result = [];
923
+ let pending = readdirSync2(dir, { withFileTypes: true });
924
+ while (pending.length > 0) {
925
+ const entry = pending.pop();
926
+ if (!entry)
927
+ continue;
928
+ const fullPath = join6(entry.parentPath, entry.name);
929
+ if (entry.isDirectory()) {
930
+ if (SERVER_RUNTIME_SCAN_SKIP_DIRS.has(entry.name))
931
+ continue;
932
+ pending = pending.concat(readdirSync2(fullPath, { withFileTypes: true }));
933
+ } else if (hasSourceExtension(fullPath)) {
934
+ result.push(fullPath);
935
+ }
936
+ }
937
+ return result;
938
+ }, copyServerRuntimeAssetReferences = (outdir) => {
939
+ const copied = new Set;
940
+ const normalizedOutdir = resolve8(outdir);
941
+ for (const filePath of collectProjectSourceFiles(process.cwd())) {
942
+ const source = readFileSync9(filePath, "utf-8");
943
+ SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
944
+ let match;
945
+ while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
946
+ const relPath = match[1];
947
+ if (!relPath)
948
+ continue;
949
+ const assetSource = resolve8(dirname2(filePath), relPath);
950
+ if (!existsSync9(assetSource) || !statSync(assetSource).isFile())
951
+ continue;
952
+ const assetTarget = resolve8(normalizedOutdir, relPath.replace(/^\.\//, ""));
953
+ if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
954
+ continue;
955
+ if (copied.has(assetTarget))
956
+ continue;
957
+ copied.add(assetTarget);
958
+ mkdirSync5(dirname2(assetTarget), { recursive: true });
959
+ cpSync(assetSource, assetTarget, { force: true });
960
+ }
961
+ }
920
962
  }, readPackageVersion4 = (candidate) => {
921
963
  try {
922
964
  const pkg = JSON.parse(readFileSync9(candidate, "utf-8"));
@@ -1584,6 +1626,7 @@ console.log(\`
1584
1626
  process.exit(1);
1585
1627
  }
1586
1628
  console.log(` \x1B[2m(${getDurationString(performance.now() - bundleStart)})\x1B[0m`);
1629
+ copyServerRuntimeAssetReferences(resolvedOutdir);
1587
1630
  const prerenderStart = performance.now();
1588
1631
  process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
1589
1632
  rmSync2(join6(resolvedOutdir, "_prerendered"), {
@@ -1649,6 +1692,22 @@ var init_compile = __esm(() => {
1649
1692
  init_startupBanner();
1650
1693
  init_telemetryEvent();
1651
1694
  init_utils();
1695
+ SERVER_RUNTIME_ASSET_RE = /new\s+URL\(\s*["'](\.\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
1696
+ SERVER_RUNTIME_SOURCE_EXTENSIONS = new Set([
1697
+ ".cjs",
1698
+ ".js",
1699
+ ".jsx",
1700
+ ".mjs",
1701
+ ".ts",
1702
+ ".tsx"
1703
+ ]);
1704
+ SERVER_RUNTIME_SCAN_SKIP_DIRS = new Set([
1705
+ ".absolutejs",
1706
+ ".git",
1707
+ "build",
1708
+ "dist",
1709
+ "node_modules"
1710
+ ]);
1652
1711
  jsxDevRuntimeCompatPath2 = resolveJsxDevRuntimeCompatPath2();
1653
1712
  RUNTIME_JS_EXTENSIONS = [".js", ".mjs", ".cjs"];
1654
1713
  MODULE_SPECIFIER_RE = /(from\s*|import\s*|import\(\s*|require\(\s*)(["'])([^"']+)\2/g;
package/dist/index.js CHANGED
@@ -10287,11 +10287,17 @@ var resolveDevClientDir3 = () => {
10287
10287
  return "template-only";
10288
10288
  }
10289
10289
  return "full";
10290
- }, generateVueHmrId = (sourceFilePath, vueRootDir) => relative8(vueRootDir, sourceFilePath).replace(/\\/g, "/").replace(/\.vue$/, ""), extractImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => importPath !== undefined), toJs = (filePath) => {
10290
+ }, generateVueHmrId = (sourceFilePath, vueRootDir) => relative8(vueRootDir, sourceFilePath).replace(/\\/g, "/").replace(/\.vue$/, ""), extractImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => importPath !== undefined), toJs = (filePath, sourceDir) => {
10291
10291
  if (filePath.endsWith(".vue"))
10292
10292
  return filePath.replace(/\.vue$/, ".js");
10293
10293
  if (filePath.endsWith(".ts"))
10294
10294
  return filePath.replace(/\.ts$/, ".js");
10295
+ if (isStylePath(filePath)) {
10296
+ if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
10297
+ return resolve18(sourceDir, filePath);
10298
+ }
10299
+ return filePath;
10300
+ }
10295
10301
  return `${filePath}.js`;
10296
10302
  }, stripExports = (code) => code.replace(/export\s+default/, "const script =").replace(/^export\s+/gm, ""), mergeVueImports = (code) => {
10297
10303
  const lines = code.split(`
@@ -10357,7 +10363,8 @@ var resolveDevClientDir3 = () => {
10357
10363
  inlineTemplate: false
10358
10364
  }) : { bindings: {}, content: "export default {};" };
10359
10365
  const strippedScript = stripExports(compiledScript.content);
10360
- const transpiledScript = transpiler3.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport)}${quoteEnd}`);
10366
+ const sourceDir = dirname11(sourceFilePath);
10367
+ const transpiledScript = transpiler3.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
10361
10368
  const packageImportRewrites = new Map;
10362
10369
  for (const [bareImport, absolutePath] of packageComponentPaths) {
10363
10370
  const childResult = cacheMap.get(absolutePath);
@@ -10379,7 +10386,7 @@ var resolveDevClientDir3 = () => {
10379
10386
  source: descriptor.template?.content ?? "",
10380
10387
  ssr,
10381
10388
  ssrCssVars: descriptor.cssVars
10382
- }).code.replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport)}${quoteEnd}`);
10389
+ }).code.replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
10383
10390
  const localCss = await Promise.all(descriptor.styles.map(async (styleBlock) => compiler.compileStyle({
10384
10391
  filename: sourceFilePath,
10385
10392
  id: componentId,
@@ -26403,5 +26410,5 @@ export {
26403
26410
  ANGULAR_INIT_TIMEOUT_MS
26404
26411
  };
26405
26412
 
26406
- //# debugId=93A53B1896D6824A64756E2164756E21
26413
+ //# debugId=2FCAF657E39AC98C64756E2164756E21
26407
26414
  //# sourceMappingURL=index.js.map