@absolutejs/absolute 0.19.0-beta.831 → 0.19.0-beta.833

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.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-i8QkP0/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-8xqDy1/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  var __require = import.meta.require;
3
3
 
4
- // .angular-partial-tmp-i8QkP0/src/core/streamingSlotRegistrar.ts
4
+ // .angular-partial-tmp-8xqDy1/src/core/streamingSlotRegistrar.ts
5
5
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
6
6
  var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
7
7
  var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
48
48
  getWarningController()?.maybeWarn(primitiveName);
49
49
  };
50
50
 
51
- // .angular-partial-tmp-i8QkP0/src/core/streamingSlotRegistry.ts
51
+ // .angular-partial-tmp-8xqDy1/src/core/streamingSlotRegistry.ts
52
52
  var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
53
53
  var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
54
54
  var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
@@ -3433,21 +3433,34 @@ ${registrations}
3433
3433
  if (fileName.startsWith(outDir))
3434
3434
  return fileName.substring(outDir.length + 1);
3435
3435
  return fileName;
3436
- }, hasJsLikeExtension = (path) => /\.(js|ts|mjs|cjs)$/.test(path), rewriteRelativeJsSpecifier = (importerOutputPath, specifier, outputFiles) => {
3437
- if (specifier.endsWith(".ts"))
3438
- return specifier.replace(/\.ts$/, ".js");
3439
- if (hasJsLikeExtension(specifier))
3440
- return specifier;
3436
+ }, hasJsLikeExtension = (path) => /\.(js|ts|mjs|cjs)$/.test(path), splitSpecifierAndQuery = (specifier) => {
3437
+ const separator = specifier.indexOf("?");
3438
+ if (separator === -1) {
3439
+ return {
3440
+ path: specifier,
3441
+ query: ""
3442
+ };
3443
+ }
3444
+ return {
3445
+ path: specifier.substring(0, separator),
3446
+ query: specifier.substring(separator)
3447
+ };
3448
+ }, rewriteRelativeJsSpecifier = (importerOutputPath, specifier, outputFiles) => {
3449
+ const { path, query } = splitSpecifierAndQuery(specifier);
3450
+ if (path.endsWith(".ts"))
3451
+ return `${path.replace(/\.ts$/, ".js")}${query}`;
3452
+ if (hasJsLikeExtension(path))
3453
+ return `${path}${query}`;
3441
3454
  const importerDir = dirname3(importerOutputPath);
3442
- const fileCandidate = resolve5(importerDir, `${specifier}.js`);
3455
+ const fileCandidate = resolve5(importerDir, `${path}.js`);
3443
3456
  if (outputFiles?.has(fileCandidate) || existsSync4(fileCandidate)) {
3444
- return `${specifier}.js`;
3457
+ return `${path}.js${query}`;
3445
3458
  }
3446
- const indexCandidate = resolve5(importerDir, specifier, "index.js");
3459
+ const indexCandidate = resolve5(importerDir, path, "index.js");
3447
3460
  if (outputFiles?.has(indexCandidate) || existsSync4(indexCandidate)) {
3448
- return `${specifier}/index.js`;
3461
+ return `${path}/index.js${query}`;
3449
3462
  }
3450
- return `${specifier}.js`;
3463
+ return `${path}.js${query}`;
3451
3464
  }, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
3452
3465
  const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
3453
3466
  const specifiers = [];
@@ -3963,7 +3976,7 @@ ${fields}
3963
3976
  deferSlots: inlinedTemplate.deferSlots,
3964
3977
  source: result
3965
3978
  };
3966
- }, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors) => {
3979
+ }, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
3967
3980
  const entryPath = resolve5(inputPath);
3968
3981
  const allOutputs = [];
3969
3982
  const visited = new Set;
@@ -4017,13 +4030,18 @@ ${fields}
4017
4030
  const fileBase = basename3(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
4018
4031
  return join5(outDir, relativeDir, fileBase);
4019
4032
  };
4033
+ const withCacheBuster = (specifier) => {
4034
+ if (!cacheBuster)
4035
+ return specifier;
4036
+ return specifier.includes("?") ? `${specifier}&t=${cacheBuster}` : `${specifier}?t=${cacheBuster}`;
4037
+ };
4020
4038
  const transpileAndRewrite = (sourceCode, relativeDir, actualPath, importRewrites) => {
4021
4039
  let processedContent = angularTranspiler.transformSync(sourceCode);
4022
4040
  const outputPath = toOutputPath(actualPath);
4023
4041
  const rewriteBareImport = (prefix, specifier, suffix) => {
4024
4042
  const rewritten = importRewrites.get(specifier);
4025
4043
  if (rewritten) {
4026
- return `${prefix}${rewritten}${suffix}`;
4044
+ return `${prefix}${withCacheBuster(rewritten)}${suffix}`;
4027
4045
  }
4028
4046
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
4029
4047
  return `${prefix}${specifier}${suffix}`;
@@ -4091,20 +4109,20 @@ ${fields}
4091
4109
  if (!resolved2)
4092
4110
  return null;
4093
4111
  const relativeImport = relative3(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
4094
- importRewrites.set(specifier, relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`);
4112
+ const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
4113
+ importRewrites.set(specifier, relativeRewrite);
4095
4114
  return resolved2;
4096
4115
  }).filter((path) => Boolean(path));
4097
4116
  const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
4098
4117
  const cacheKey = actualPath;
4099
- if (jitContentCache.get(cacheKey) === contentHash && existsSync4(targetPath)) {
4100
- allOutputs.push(targetPath);
4101
- } else {
4118
+ const shouldWriteFile = cacheBuster ? true : jitContentCache.get(cacheKey) !== contentHash || !existsSync4(targetPath);
4119
+ if (shouldWriteFile) {
4102
4120
  const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
4103
4121
  await fs.mkdir(targetDir, { recursive: true });
4104
4122
  await fs.writeFile(targetPath, processedContent, "utf-8");
4105
- allOutputs.push(targetPath);
4106
4123
  jitContentCache.set(cacheKey, contentHash);
4107
4124
  }
4125
+ allOutputs.push(targetPath);
4108
4126
  await Promise.all(localImportPaths.map((importPath) => transpileFile(importPath)));
4109
4127
  };
4110
4128
  await transpileFile(inputPath);
@@ -13537,6 +13555,7 @@ import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
13537
13555
  import { mkdir as mkdir2, symlink } from "fs/promises";
13538
13556
  import { tmpdir } from "os";
13539
13557
  import { basename as basename4, dirname as dirname4, join as join6, resolve as resolve6 } from "path";
13558
+ import { pathToFileURL } from "url";
13540
13559
 
13541
13560
  // src/core/islandPageContext.ts
13542
13561
  init_constants();
@@ -14404,6 +14423,7 @@ var ensureAngularCompiler = () => {
14404
14423
  };
14405
14424
  var readAngularPageModule = (value) => isRecord5(value) ? value : null;
14406
14425
  var resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join6(tmpdir(), "absolutejs", "generated", "angular-ssr");
14426
+ var createAngularRuntimeCacheBuster = () => `${Date.now().toString(BASE_36_RADIX)}.${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
14407
14427
  var ensureAngularSsrNodeModules = async (outDir) => {
14408
14428
  const outRoot = resolve6(dirname4(dirname4(outDir)));
14409
14429
  const nodeModulesLink = join6(outRoot, "node_modules");
@@ -14427,14 +14447,30 @@ var ensureAngularSsrNodeModules = async (outDir) => {
14427
14447
  };
14428
14448
  var resolveRuntimeAngularModulePath = async (pagePath) => {
14429
14449
  if (!pagePath.endsWith(".ts")) {
14430
- return pagePath;
14450
+ return {
14451
+ path: pagePath,
14452
+ cacheBuster: undefined
14453
+ };
14431
14454
  }
14432
14455
  const outDir = resolveAngularSsrOutDir();
14433
14456
  await ensureAngularSsrNodeModules(outDir);
14434
14457
  const { compileAngularFileJIT: compileAngularFileJIT2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
14435
- const outputs = await compileAngularFileJIT2(pagePath, outDir, process.cwd());
14458
+ const cacheBuster = createAngularRuntimeCacheBuster();
14459
+ const outputs = await compileAngularFileJIT2(pagePath, outDir, process.cwd(), undefined, cacheBuster);
14436
14460
  const expectedFileName = basename4(pagePath).replace(/\.ts$/, ".js");
14437
- return outputs.find((output) => output.endsWith(`/${expectedFileName}`)) ?? outputs.find((output) => output.endsWith(`\\${expectedFileName}`)) ?? outputs[0] ?? pagePath;
14461
+ const runtimePagePath = outputs.find((output) => output.endsWith(`/${expectedFileName}`)) ?? outputs.find((output) => output.endsWith(`\\${expectedFileName}`)) ?? outputs[0] ?? pagePath;
14462
+ return {
14463
+ path: runtimePagePath,
14464
+ cacheBuster
14465
+ };
14466
+ };
14467
+ var buildRuntimeModuleSpecifier = (modulePath, cacheBuster) => {
14468
+ if (!cacheBuster) {
14469
+ return modulePath;
14470
+ }
14471
+ const moduleUrl = new URL(pathToFileURL(modulePath).href);
14472
+ moduleUrl.searchParams.set("t", cacheBuster);
14473
+ return moduleUrl.href;
14438
14474
  };
14439
14475
  var withHtmlContentType = (responseInit = {}) => {
14440
14476
  const headers = new Headers(responseInit.headers);
@@ -14489,7 +14525,7 @@ var handleAngularPageRequest = async (input) => {
14489
14525
  const renderPageResponse = async () => {
14490
14526
  const baseDeps = await getAngularDeps();
14491
14527
  const runtimePagePath = await resolveRuntimeAngularModulePath(resolvedPagePath);
14492
- const importedPageModule = await import(runtimePagePath);
14528
+ const importedPageModule = await import(buildRuntimeModuleSpecifier(runtimePagePath.path, runtimePagePath.cacheBuster));
14493
14529
  const pageModule = readAngularPageModule(importedPageModule);
14494
14530
  if (!pageModule) {
14495
14531
  throw new Error(`Invalid Angular page module: ${resolvedPagePath}`);
@@ -14942,5 +14978,5 @@ export {
14942
14978
  ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
14943
14979
  };
14944
14980
 
14945
- //# debugId=C0D6D696ED53789664756E2164756E21
14981
+ //# debugId=2B91141D8B8BC0BC64756E2164756E21
14946
14982
  //# sourceMappingURL=index.js.map