@absolutejs/absolute 0.19.0-beta.763 → 0.19.0-beta.765

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
@@ -280,6 +280,7 @@ var init_loadConfig = __esm(() => {
280
280
  "assetsDirectory",
281
281
  "astroDirectory",
282
282
  "buildDirectory",
283
+ "bunBuild",
283
284
  "command",
284
285
  "config",
285
286
  "cwd",
package/dist/index.js CHANGED
@@ -3416,6 +3416,15 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
3416
3416
  if (isFromReact || isFromVue || isFromSvelte || isFromAngular)
3417
3417
  return `${pascalName}BundledCSS`;
3418
3418
  return `${pascalName}CSS`;
3419
+ }, getArtifactBaseName = (fileName, hash) => {
3420
+ const ext = extname4(fileName);
3421
+ const stem = ext ? fileName.slice(0, -ext.length) : fileName;
3422
+ if (!hash)
3423
+ return stem;
3424
+ const hashSuffix = `.${hash}`;
3425
+ if (stem.endsWith(hashSuffix))
3426
+ return stem.slice(0, -hashSuffix.length);
3427
+ return stem;
3419
3428
  }, generateManifest = (outputs, buildPath) => outputs.reduce((manifest, artifact) => {
3420
3429
  const normalizedArtifactPath = normalizePath(artifact.path);
3421
3430
  const normalizedBuildPath = normalizePath(buildPath);
@@ -3425,7 +3434,7 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
3425
3434
  const fileWithHash = segments.pop();
3426
3435
  if (!fileWithHash)
3427
3436
  return manifest;
3428
- const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
3437
+ const baseName = getArtifactBaseName(fileWithHash, artifact.hash);
3429
3438
  if (!baseName)
3430
3439
  return manifest;
3431
3440
  const pascalName = toPascal(baseName);
@@ -43931,9 +43940,76 @@ ${registrations}
43931
43940
  if (typeof hostSource === "string")
43932
43941
  return hostSource;
43933
43942
  return fs2.readFile(fileName, "utf-8");
43943
+ }, safeStableStringify = (value2) => {
43944
+ const seen = new WeakSet;
43945
+ return JSON.stringify(value2, (_key, entry) => {
43946
+ if (typeof entry === "function")
43947
+ return `[Function:${entry.name}]`;
43948
+ if (!entry || typeof entry !== "object")
43949
+ return entry;
43950
+ if (seen.has(entry))
43951
+ return "[Circular]";
43952
+ seen.add(entry);
43953
+ if (Array.isArray(entry))
43954
+ return entry;
43955
+ return Object.fromEntries(Object.entries(entry).sort(([left], [right]) => left.localeCompare(right)));
43956
+ });
43957
+ }, collectAngularResourcePaths = (source, fileDir) => {
43958
+ const paths = [];
43959
+ const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
43960
+ if (templateUrlMatch?.[1])
43961
+ paths.push(join15(fileDir, templateUrlMatch[1]));
43962
+ const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
43963
+ if (styleUrlMatch?.[1])
43964
+ paths.push(join15(fileDir, styleUrlMatch[1]));
43965
+ const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
43966
+ const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
43967
+ if (urlMatches) {
43968
+ for (const urlMatch of urlMatches) {
43969
+ paths.push(join15(fileDir, urlMatch.replace(/['"]/g, "")));
43970
+ }
43971
+ }
43972
+ return paths.map((path2) => resolve19(path2));
43973
+ }, readResourceCacheFile = async (cachePath) => {
43974
+ try {
43975
+ const entry = JSON.parse(await fs2.readFile(cachePath, "utf-8"));
43976
+ if (entry.version !== 1 || typeof entry.source !== "string") {
43977
+ return null;
43978
+ }
43979
+ return entry;
43980
+ } catch {
43981
+ return null;
43982
+ }
43983
+ }, writeResourceCacheFile = async (cachePath, source) => {
43984
+ await fs2.mkdir(dirname11(cachePath), { recursive: true });
43985
+ await fs2.writeFile(cachePath, JSON.stringify({
43986
+ source,
43987
+ version: 1
43988
+ }), "utf-8");
43989
+ }, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
43990
+ const resourcePaths = collectAngularResourcePaths(source, dirname11(filePath));
43991
+ const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
43992
+ const content = await fs2.readFile(resourcePath, "utf-8");
43993
+ return `${resourcePath}\x00${content}`;
43994
+ }));
43995
+ const cacheInput = [
43996
+ "v1",
43997
+ filePath,
43998
+ source,
43999
+ ...resourceContents,
44000
+ safeStableStringify(stylePreprocessors ?? null)
44001
+ ].join("\x00");
44002
+ const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
44003
+ return join15(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
43934
44004
  }, precomputeAotResourceTransforms = async (inputPaths, readFile4, stylePreprocessors) => {
43935
44005
  const transformedSources = new Map;
43936
44006
  const visited = new Set;
44007
+ const stats = {
44008
+ cacheHits: 0,
44009
+ cacheMisses: 0,
44010
+ filesVisited: 0,
44011
+ transformedFiles: 0
44012
+ };
43937
44013
  const transformFile = async (filePath) => {
43938
44014
  const resolvedPath = resolve19(filePath);
43939
44015
  if (visited.has(resolvedPath))
@@ -43941,10 +44017,23 @@ ${registrations}
43941
44017
  visited.add(resolvedPath);
43942
44018
  if (!existsSync16(resolvedPath) || resolvedPath.endsWith(".d.ts"))
43943
44019
  return;
44020
+ stats.filesVisited += 1;
43944
44021
  const source = await readFileForAotTransform(resolvedPath, readFile4);
43945
- const transformed = await inlineResources(source, dirname11(resolvedPath), stylePreprocessors);
43946
- if (transformed.source !== source) {
43947
- transformedSources.set(resolvedPath, transformed.source);
44022
+ const cachePath = await resolveResourceTransformCachePath(resolvedPath, source, stylePreprocessors);
44023
+ const cached = await readResourceCacheFile(cachePath);
44024
+ let transformedSource;
44025
+ if (cached) {
44026
+ stats.cacheHits += 1;
44027
+ transformedSource = cached.source;
44028
+ } else {
44029
+ stats.cacheMisses += 1;
44030
+ const transformed = await inlineResources(source, dirname11(resolvedPath), stylePreprocessors);
44031
+ transformedSource = transformed.source;
44032
+ await writeResourceCacheFile(cachePath, transformedSource);
44033
+ }
44034
+ if (transformedSource !== source) {
44035
+ stats.transformedFiles += 1;
44036
+ transformedSources.set(resolvedPath, transformedSource);
43948
44037
  }
43949
44038
  const imports = extractLocalImportSpecifiers(source, resolvedPath);
43950
44039
  await Promise.all(imports.map(async (specifier) => {
@@ -43954,7 +44043,7 @@ ${registrations}
43954
44043
  }));
43955
44044
  };
43956
44045
  await Promise.all(inputPaths.map((inputPath) => transformFile(inputPath)));
43957
- return transformedSources;
44046
+ return { stats, transformedSources };
43958
44047
  }, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
43959
44048
  const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
43960
44049
  const outputPath = resolve19(join15(outDir, relative9(process.cwd(), resolve19(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
@@ -44015,7 +44104,15 @@ ${registrations}
44015
44104
  emitted[relativePath] = text;
44016
44105
  };
44017
44106
  const originalReadFile = host.readFile;
44018
- const aotTransformedSources = await traceAngularPhase("aot/precompute-resources", () => precomputeAotResourceTransforms(inputPaths, originalReadFile?.bind(host), stylePreprocessors), { entries: inputPaths.length });
44107
+ const { stats: aotResourceTransformStats, transformedSources } = await traceAngularPhase("aot/precompute-resources", () => precomputeAotResourceTransforms(inputPaths, originalReadFile?.bind(host), stylePreprocessors), { entries: inputPaths.length });
44108
+ await traceAngularPhase("aot/resource-cache-summary", () => {
44109
+ return;
44110
+ }, {
44111
+ cacheHits: aotResourceTransformStats.cacheHits,
44112
+ cacheMisses: aotResourceTransformStats.cacheMisses,
44113
+ filesVisited: aotResourceTransformStats.filesVisited,
44114
+ transformedFiles: aotResourceTransformStats.transformedFiles
44115
+ });
44019
44116
  host.readFile = (fileName) => {
44020
44117
  const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
44021
44118
  if (typeof source !== "string")
@@ -44024,11 +44121,11 @@ ${registrations}
44024
44121
  return source;
44025
44122
  }
44026
44123
  const resolvedPath = resolve19(fileName);
44027
- return aotTransformedSources.get(resolvedPath) ?? source;
44124
+ return transformedSources.get(resolvedPath) ?? source;
44028
44125
  };
44029
44126
  const originalGetSourceFileForCompile = host.getSourceFile;
44030
44127
  host.getSourceFile = (fileName, languageVersion, onError2) => {
44031
- const source = aotTransformedSources.get(resolve19(fileName));
44128
+ const source = transformedSources.get(resolve19(fileName));
44032
44129
  if (source) {
44033
44130
  return ts2.createSourceFile(fileName, source, languageVersion, true);
44034
44131
  }
@@ -45619,7 +45716,43 @@ ${content.slice(firstUseIdx)}`;
45619
45716
  if (changed)
45620
45717
  writeFileSync7(outputPath, content);
45621
45718
  }
45622
- }, vueFeatureFlags, build2 = async ({
45719
+ }, vueFeatureFlags, bunBuildPassKeys, bunBuildPassKeySet, reservedBunBuildConfigKeys, isObject2 = (value2) => typeof value2 === "object" && value2 !== null, isBunBuildPassConfig = (config) => isObject2(config) && Object.keys(config).some((key) => bunBuildPassKeySet.has(key)), sanitizeBunBuildOverride = (override) => {
45720
+ if (!override)
45721
+ return {};
45722
+ const sanitized = { ...override };
45723
+ for (const key of reservedBunBuildConfigKeys) {
45724
+ delete sanitized[key];
45725
+ }
45726
+ return sanitized;
45727
+ }, resolveBunBuildOverride = (config, pass) => {
45728
+ if (!config)
45729
+ return {};
45730
+ if (!isBunBuildPassConfig(config)) {
45731
+ return sanitizeBunBuildOverride(config);
45732
+ }
45733
+ return sanitizeBunBuildOverride({
45734
+ ...config.default ?? {},
45735
+ ...config[pass] ?? {}
45736
+ });
45737
+ }, dedupe = (values) => [...new Set(values)], mergeBunBuildConfig = (base, override) => {
45738
+ const sanitized = sanitizeBunBuildOverride(override);
45739
+ const merged = {
45740
+ ...base,
45741
+ ...sanitized
45742
+ };
45743
+ return {
45744
+ ...merged,
45745
+ define: base.define || sanitized.define ? {
45746
+ ...sanitized.define ?? {},
45747
+ ...base.define ?? {}
45748
+ } : undefined,
45749
+ external: dedupe([
45750
+ ...base.external ?? [],
45751
+ ...sanitized.external ?? []
45752
+ ]),
45753
+ plugins: [...base.plugins ?? [], ...sanitized.plugins ?? []]
45754
+ };
45755
+ }, build2 = async ({
45623
45756
  buildDirectory = "build",
45624
45757
  assetsDirectory,
45625
45758
  publicDirectory,
@@ -45634,6 +45767,7 @@ ${content.slice(firstUseIdx)}`;
45634
45767
  stylePreprocessors,
45635
45768
  postcss,
45636
45769
  tailwind,
45770
+ bunBuild: bunBuildConfig,
45637
45771
  options,
45638
45772
  incrementalFiles,
45639
45773
  mode
@@ -46073,20 +46207,23 @@ ${content.slice(firstUseIdx)}`;
46073
46207
  ...svelteVendorPaths2 ?? {}
46074
46208
  };
46075
46209
  const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
46076
- const reactBuildConfig = reactClientEntryPoints.length > 0 ? {
46210
+ const reactBuildConfig = reactClientEntryPoints.length > 0 ? mergeBunBuildConfig({
46077
46211
  entrypoints: reactClientEntryPoints,
46078
46212
  ...Object.keys(reactExternalPaths).length > 0 ? { external: Object.keys(reactExternalPaths) } : {},
46079
46213
  format: "esm",
46080
46214
  minify: !isDev2,
46081
46215
  naming: `[dir]/[name].[hash].[ext]`,
46082
46216
  outdir: buildPath,
46083
- ...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
46217
+ ...hmr ? {
46218
+ jsx: { development: true },
46219
+ reactFastRefresh: true
46220
+ } : {},
46084
46221
  plugins: [stylePreprocessorPlugin2],
46085
46222
  root: clientRoot,
46086
46223
  splitting: true,
46087
46224
  target: "browser",
46088
46225
  throw: false
46089
- } : undefined;
46226
+ }, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
46090
46227
  if (reactDir && reactClientEntryPoints.length > 0) {
46091
46228
  rmSync2(join20(buildPath, "react", "generated", "indexes"), {
46092
46229
  force: true,
@@ -46113,7 +46250,7 @@ ${content.slice(firstUseIdx)}`;
46113
46250
  globalCssResult,
46114
46251
  vueCssResult
46115
46252
  ] = await Promise.all([
46116
- serverEntryPoints.length > 0 ? tracePhase("bun/server", () => bunBuild7({
46253
+ serverEntryPoints.length > 0 ? tracePhase("bun/server", () => bunBuild7(mergeBunBuildConfig({
46117
46254
  entrypoints: serverEntryPoints,
46118
46255
  external: [
46119
46256
  "react",
@@ -46135,9 +46272,9 @@ ${content.slice(firstUseIdx)}`;
46135
46272
  target: "bun",
46136
46273
  throw: false,
46137
46274
  tsconfig: "./tsconfig.json"
46138
- })) : undefined,
46275
+ }, resolveBunBuildOverride(bunBuildConfig, "server")))) : undefined,
46139
46276
  reactBuildConfig ? tracePhase("bun/react-client", () => bunBuild7(reactBuildConfig)) : undefined,
46140
- nonReactClientEntryPoints.length > 0 ? tracePhase("bun/non-react-client", () => bunBuild7({
46277
+ nonReactClientEntryPoints.length > 0 ? tracePhase("bun/non-react-client", () => bunBuild7(mergeBunBuildConfig({
46141
46278
  define: vueDirectory ? vueFeatureFlags : undefined,
46142
46279
  entrypoints: nonReactClientEntryPoints,
46143
46280
  external: Object.keys(nonReactExternalPaths),
@@ -46155,8 +46292,8 @@ ${content.slice(firstUseIdx)}`;
46155
46292
  target: "browser",
46156
46293
  throw: false,
46157
46294
  tsconfig: "./tsconfig.json"
46158
- })) : undefined,
46159
- islandClientEntryPoints.length > 0 ? tracePhase("bun/island-client", () => bunBuild7({
46295
+ }, resolveBunBuildOverride(bunBuildConfig, "nonReactClient")))) : undefined,
46296
+ islandClientEntryPoints.length > 0 ? tracePhase("bun/island-client", () => bunBuild7(mergeBunBuildConfig({
46160
46297
  define: vueDirectory ? vueFeatureFlags : undefined,
46161
46298
  entrypoints: islandClientEntryPoints,
46162
46299
  external: Object.keys(nonReactExternalPaths),
@@ -46173,8 +46310,8 @@ ${content.slice(firstUseIdx)}`;
46173
46310
  target: "browser",
46174
46311
  throw: false,
46175
46312
  tsconfig: "./tsconfig.json"
46176
- })) : undefined,
46177
- globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7({
46313
+ }, resolveBunBuildOverride(bunBuildConfig, "islandClient")))) : undefined,
46314
+ globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
46178
46315
  entrypoints: globalCssEntries,
46179
46316
  naming: `[dir]/[name].[hash].[ext]`,
46180
46317
  outdir: stylesDir ? join20(buildPath, basename8(stylesDir)) : buildPath,
@@ -46182,14 +46319,14 @@ ${content.slice(firstUseIdx)}`;
46182
46319
  root: stylesDir || clientRoot,
46183
46320
  target: "browser",
46184
46321
  throw: false
46185
- })) : undefined,
46186
- vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7({
46322
+ }, resolveBunBuildOverride(bunBuildConfig, "globalCss")))) : undefined,
46323
+ vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
46187
46324
  entrypoints: vueCssPaths,
46188
46325
  naming: `[name].[hash].[ext]`,
46189
46326
  outdir: join20(buildPath, assetsPath ? basename8(assetsPath) : "assets", "css"),
46190
46327
  target: "browser",
46191
46328
  throw: false
46192
- })) : undefined
46329
+ }, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
46193
46330
  ]);
46194
46331
  const serverLogs = serverResult?.logs ?? [];
46195
46332
  const serverOutputs = serverResult?.outputs ?? [];
@@ -46473,6 +46610,25 @@ var init_build = __esm(() => {
46473
46610
  __VUE_PROD_DEVTOOLS__: isDev2 ? "true" : "false",
46474
46611
  __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isDev2 ? "true" : "false"
46475
46612
  };
46613
+ bunBuildPassKeys = [
46614
+ "server",
46615
+ "reactClient",
46616
+ "nonReactClient",
46617
+ "islandClient",
46618
+ "globalCss",
46619
+ "vueCss"
46620
+ ];
46621
+ bunBuildPassKeySet = new Set(["default", ...bunBuildPassKeys]);
46622
+ reservedBunBuildConfigKeys = new Set([
46623
+ "entrypoints",
46624
+ "outdir",
46625
+ "outfile",
46626
+ "root",
46627
+ "target",
46628
+ "format",
46629
+ "throw",
46630
+ "compile"
46631
+ ]);
46476
46632
  });
46477
46633
 
46478
46634
  // src/dev/dependencyGraph.ts
@@ -51398,6 +51554,7 @@ var RESERVED_TOP_LEVEL_KEYS = new Set([
51398
51554
  "assetsDirectory",
51399
51555
  "astroDirectory",
51400
51556
  "buildDirectory",
51557
+ "bunBuild",
51401
51558
  "command",
51402
51559
  "config",
51403
51560
  "cwd",
@@ -52583,8 +52740,8 @@ var TypeSystemPolicy;
52583
52740
  }
52584
52741
  TypeSystemPolicy2.IsExactOptionalProperty = IsExactOptionalProperty;
52585
52742
  function IsObjectLike(value2) {
52586
- const isObject2 = IsObject2(value2);
52587
- return TypeSystemPolicy2.AllowArrayObject ? isObject2 : isObject2 && !IsArray2(value2);
52743
+ const isObject3 = IsObject2(value2);
52744
+ return TypeSystemPolicy2.AllowArrayObject ? isObject3 : isObject3 && !IsArray2(value2);
52588
52745
  }
52589
52746
  TypeSystemPolicy2.IsObjectLike = IsObjectLike;
52590
52747
  function IsRecordLike(value2) {
@@ -58675,5 +58832,5 @@ export {
58675
58832
  ANGULAR_INIT_TIMEOUT_MS
58676
58833
  };
58677
58834
 
58678
- //# debugId=2F07E1892FE8624964756E2164756E21
58835
+ //# debugId=5BEDAE621CA2EF3664756E2164756E21
58679
58836
  //# sourceMappingURL=index.js.map