@absolutejs/absolute 0.19.0-beta.756 → 0.19.0-beta.758

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
@@ -33,7 +33,10 @@ var getDurationString = (duration) => {
33
33
  } else if (duration < MILLISECONDS_IN_A_MINUTE) {
34
34
  durationString = `${(duration / MILLISECONDS_IN_A_SECOND).toFixed(TIME_PRECISION)}s`;
35
35
  } else {
36
- durationString = `${(duration / MILLISECONDS_IN_A_MINUTE).toFixed(TIME_PRECISION)}m`;
36
+ const totalSeconds = Math.round(duration / MILLISECONDS_IN_A_SECOND);
37
+ const minutes = Math.floor(totalSeconds / 60);
38
+ const seconds = totalSeconds % 60;
39
+ durationString = seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`;
37
40
  }
38
41
  return durationString;
39
42
  };
package/dist/index.js CHANGED
@@ -3151,7 +3151,10 @@ var getDurationString = (duration) => {
3151
3151
  } else if (duration < MILLISECONDS_IN_A_MINUTE) {
3152
3152
  durationString = `${(duration / MILLISECONDS_IN_A_SECOND).toFixed(TIME_PRECISION)}s`;
3153
3153
  } else {
3154
- durationString = `${(duration / MILLISECONDS_IN_A_MINUTE).toFixed(TIME_PRECISION)}m`;
3154
+ const totalSeconds = Math.round(duration / MILLISECONDS_IN_A_SECOND);
3155
+ const minutes = Math.floor(totalSeconds / 60);
3156
+ const seconds = totalSeconds % 60;
3157
+ durationString = seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`;
3155
3158
  }
3156
3159
  return durationString;
3157
3160
  };
@@ -43690,6 +43693,7 @@ var init_lowerDeferSyntax = __esm(() => {
43690
43693
  // src/build/compileAngular.ts
43691
43694
  var exports_compileAngular = {};
43692
43695
  __export(exports_compileAngular, {
43696
+ compileAngularFiles: () => compileAngularFiles,
43693
43697
  compileAngularFileJIT: () => compileAngularFileJIT,
43694
43698
  compileAngularFile: () => compileAngularFile,
43695
43699
  compileAngular: () => compileAngular
@@ -43697,15 +43701,7 @@ __export(exports_compileAngular, {
43697
43701
  import { existsSync as existsSync16, readFileSync as readFileSync10, promises as fs2 } from "fs";
43698
43702
  import { join as join15, basename as basename7, sep as sep3, dirname as dirname11, resolve as resolve19, relative as relative9 } from "path";
43699
43703
  import ts2 from "typescript";
43700
- import { createHash as createHash2 } from "crypto";
43701
- var computeConfigHash = () => {
43702
- try {
43703
- const content = readFileSync10("./tsconfig.json", "utf-8");
43704
- return createHash2("md5").update(content).digest("hex");
43705
- } catch {
43706
- return "";
43707
- }
43708
- }, readTsconfigPathAliases = () => {
43704
+ var readTsconfigPathAliases = () => {
43709
43705
  try {
43710
43706
  const configPath2 = resolve19(process.cwd(), "tsconfig.json");
43711
43707
  const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
@@ -43856,6 +43852,21 @@ ${registrations}
43856
43852
  if (fileName.startsWith(outDir))
43857
43853
  return fileName.substring(outDir.length + 1);
43858
43854
  return fileName;
43855
+ }, hasJsLikeExtension = (path2) => /\.(js|ts|mjs|cjs)$/.test(path2), rewriteRelativeJsSpecifier = (importerOutputPath, specifier, outputFiles) => {
43856
+ if (specifier.endsWith(".ts"))
43857
+ return specifier.replace(/\.ts$/, ".js");
43858
+ if (hasJsLikeExtension(specifier))
43859
+ return specifier;
43860
+ const importerDir = dirname11(importerOutputPath);
43861
+ const fileCandidate = resolve19(importerDir, `${specifier}.js`);
43862
+ if (outputFiles?.has(fileCandidate) || existsSync16(fileCandidate)) {
43863
+ return `${specifier}.js`;
43864
+ }
43865
+ const indexCandidate = resolve19(importerDir, specifier, "index.js");
43866
+ if (outputFiles?.has(indexCandidate) || existsSync16(indexCandidate)) {
43867
+ return `${specifier}/index.js`;
43868
+ }
43869
+ return `${specifier}.js`;
43859
43870
  }, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
43860
43871
  const sourceFile = ts2.createSourceFile(fileName, source, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TS);
43861
43872
  const specifiers = [];
@@ -43896,7 +43907,7 @@ ${registrations}
43896
43907
  if (typeof hostSource === "string")
43897
43908
  return hostSource;
43898
43909
  return fs2.readFile(fileName, "utf-8");
43899
- }, precomputeAotResourceTransforms = async (inputPath, readFile4, stylePreprocessors) => {
43910
+ }, precomputeAotResourceTransforms = async (inputPaths, readFile4, stylePreprocessors) => {
43900
43911
  const transformedSources = new Map;
43901
43912
  const visited = new Set;
43902
43913
  const transformFile = async (filePath) => {
@@ -43916,70 +43927,59 @@ ${registrations}
43916
43927
  await transformFile(resolvedImport);
43917
43928
  }));
43918
43929
  };
43919
- await transformFile(inputPath);
43930
+ await Promise.all(inputPaths.map((inputPath) => transformFile(inputPath)));
43920
43931
  return transformedSources;
43921
- }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
43922
- const islandMetadataExports = buildIslandMetadataExports(readFileSync10(inputPath, "utf-8"));
43932
+ }, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
43933
+ const islandMetadataByOutputPath = new Map(inputPaths.map((inputPath) => {
43934
+ const outputPath = resolve19(join15(outDir, relative9(process.cwd(), resolve19(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
43935
+ return [
43936
+ outputPath,
43937
+ buildIslandMetadataExports(readFileSync10(inputPath, "utf-8"))
43938
+ ];
43939
+ }));
43923
43940
  const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
43924
- const configHash = computeConfigHash();
43925
- const cached = globalThis.__angularCompilerCache;
43926
- let host;
43927
- let options;
43928
- let tsLibDir;
43929
- if (cached && cached.configHash === configHash) {
43930
- ({ host } = cached);
43931
- options = { ...cached.options, outDir, rootDir: process.cwd() };
43932
- ({ tsLibDir } = cached);
43933
- cached.lastUsed = Date.now();
43934
- } else {
43935
- const tsPath = __require.resolve("typescript");
43936
- const tsRootDir = dirname11(tsPath);
43937
- tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve19(tsRootDir, "lib");
43938
- const config = readConfiguration("./tsconfig.json");
43939
- options = {
43940
- emitDecoratorMetadata: true,
43941
- esModuleInterop: true,
43942
- experimentalDecorators: true,
43943
- module: ts2.ModuleKind.ESNext,
43944
- moduleResolution: ts2.ModuleResolutionKind.Bundler,
43945
- newLine: ts2.NewLineKind.LineFeed,
43946
- noLib: false,
43947
- outDir,
43948
- skipLibCheck: true,
43949
- target: ts2.ScriptTarget.ES2022,
43950
- ...config.options
43951
- };
43952
- options.target = ts2.ScriptTarget.ES2022;
43953
- options.experimentalDecorators = true;
43954
- options.emitDecoratorMetadata = true;
43955
- options.newLine = ts2.NewLineKind.LineFeed;
43956
- options.outDir = outDir;
43957
- options.noEmit = false;
43958
- options.rootDir = process.cwd();
43959
- host = ts2.createCompilerHost(options);
43960
- const originalGetDefaultLibLocation = host.getDefaultLibLocation;
43961
- host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
43962
- const originalGetDefaultLibFileName = host.getDefaultLibFileName;
43963
- host.getDefaultLibFileName = (opts) => {
43964
- const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
43965
- return basename7(fileName);
43966
- };
43967
- const originalGetSourceFile = host.getSourceFile;
43968
- host.getSourceFile = (fileName, languageVersion, onError2) => {
43969
- if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
43970
- const resolvedPath = join15(tsLibDir, fileName);
43971
- return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError2);
43972
- }
43973
- return originalGetSourceFile?.call(host, fileName, languageVersion, onError2);
43974
- };
43975
- globalThis.__angularCompilerCache = {
43976
- configHash,
43977
- host,
43978
- lastUsed: Date.now(),
43979
- options: { ...options },
43980
- tsLibDir
43981
- };
43982
- }
43941
+ const tsPath = __require.resolve("typescript");
43942
+ const tsRootDir = dirname11(tsPath);
43943
+ const tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve19(tsRootDir, "lib");
43944
+ const config = readConfiguration("./tsconfig.json");
43945
+ const options = {
43946
+ emitDecoratorMetadata: true,
43947
+ esModuleInterop: true,
43948
+ experimentalDecorators: true,
43949
+ module: ts2.ModuleKind.ESNext,
43950
+ moduleResolution: ts2.ModuleResolutionKind.Bundler,
43951
+ newLine: ts2.NewLineKind.LineFeed,
43952
+ noLib: false,
43953
+ outDir,
43954
+ skipLibCheck: true,
43955
+ target: ts2.ScriptTarget.ES2022,
43956
+ ...config.options
43957
+ };
43958
+ options.target = ts2.ScriptTarget.ES2022;
43959
+ options.experimentalDecorators = true;
43960
+ options.emitDecoratorMetadata = true;
43961
+ options.newLine = ts2.NewLineKind.LineFeed;
43962
+ options.outDir = outDir;
43963
+ options.noEmit = false;
43964
+ options.incremental = false;
43965
+ options.tsBuildInfoFile = undefined;
43966
+ options.rootDir = process.cwd();
43967
+ const host = ts2.createCompilerHost(options);
43968
+ const originalGetDefaultLibLocation = host.getDefaultLibLocation;
43969
+ host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
43970
+ const originalGetDefaultLibFileName = host.getDefaultLibFileName;
43971
+ host.getDefaultLibFileName = (opts) => {
43972
+ const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
43973
+ return basename7(fileName);
43974
+ };
43975
+ const originalGetSourceFile = host.getSourceFile;
43976
+ host.getSourceFile = (fileName, languageVersion, onError2) => {
43977
+ if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
43978
+ const resolvedPath = join15(tsLibDir, fileName);
43979
+ return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError2);
43980
+ }
43981
+ return originalGetSourceFile?.call(host, fileName, languageVersion, onError2);
43982
+ };
43983
43983
  const emitted = {};
43984
43984
  const resolvedOutDir = resolve19(outDir);
43985
43985
  host.writeFile = (fileName, text) => {
@@ -43987,7 +43987,7 @@ ${registrations}
43987
43987
  emitted[relativePath] = text;
43988
43988
  };
43989
43989
  const originalReadFile = host.readFile;
43990
- const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host), stylePreprocessors);
43990
+ const aotTransformedSources = await precomputeAotResourceTransforms(inputPaths, originalReadFile?.bind(host), stylePreprocessors);
43991
43991
  host.readFile = (fileName) => {
43992
43992
  const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
43993
43993
  if (typeof source !== "string")
@@ -44012,18 +44012,23 @@ ${registrations}
44012
44012
  emitFlags: EmitFlags.Default,
44013
44013
  host,
44014
44014
  options,
44015
- rootNames: [inputPath]
44015
+ rootNames: inputPaths
44016
44016
  }));
44017
44017
  } finally {
44018
44018
  host.readFile = originalReadFile;
44019
44019
  host.getSourceFile = originalGetSourceFileForCompile;
44020
44020
  }
44021
44021
  throwOnCompilationErrors(diagnostics);
44022
- const entries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => {
44023
- const target = join15(outDir, fileName);
44022
+ const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
44023
+ content,
44024
+ target: join15(outDir, fileName)
44025
+ }));
44026
+ const outputFiles = new Set(rawEntries.map(({ target }) => resolve19(target)));
44027
+ const entries = rawEntries.map(({ content, target }) => {
44024
44028
  let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path2) => {
44025
- if (!path2.match(/\.(js|ts|mjs|cjs)$/)) {
44026
- return `from ${quote}${path2}.js${quote}`;
44029
+ const rewritten = rewriteRelativeJsSpecifier(target, path2, outputFiles);
44030
+ if (rewritten !== path2) {
44031
+ return `from ${quote}${rewritten}${quote}`;
44027
44032
  }
44028
44033
  return match;
44029
44034
  });
@@ -44033,13 +44038,13 @@ ${registrations}
44033
44038
  return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
44034
44039
  });
44035
44040
  processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
44036
- processedContent += islandMetadataExports;
44041
+ processedContent += islandMetadataByOutputPath.get(resolve19(target)) ?? "";
44037
44042
  return { content: processedContent, target };
44038
44043
  });
44039
44044
  await Promise.all(entries.map(({ target }) => fs2.mkdir(dirname11(target), { recursive: true })));
44040
44045
  await Promise.all(entries.map(({ target, content }) => fs2.writeFile(target, content, "utf-8")));
44041
44046
  return entries.map(({ target }) => target);
44042
- }, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
44047
+ }, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
44043
44048
  const re2 = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
44044
44049
  let match;
44045
44050
  while ((match = re2.exec(source)) !== null) {
@@ -44336,6 +44341,7 @@ ${fields}
44336
44341
  };
44337
44342
  const transpileAndRewrite = (sourceCode, relativeDir, actualPath, importRewrites) => {
44338
44343
  let processedContent = angularTranspiler.transformSync(sourceCode);
44344
+ const outputPath = toOutputPath(actualPath);
44339
44345
  const rewriteBareImport = (prefix, specifier, suffix) => {
44340
44346
  const rewritten = importRewrites.get(specifier);
44341
44347
  if (rewritten) {
@@ -44350,11 +44356,9 @@ ${fields}
44350
44356
  processedContent = processedContent.replace(/(import\s+['"])([^'"]+)(['"])/g, (_, prefix, specifier, suffix) => rewriteBareImport(prefix, specifier, suffix));
44351
44357
  processedContent = processedContent.replace(/(import\(\s*['"])([^'"]+)(['"]\s*\))/g, (_, prefix, specifier, suffix) => rewriteBareImport(prefix, specifier, suffix));
44352
44358
  processedContent = processedContent.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path2) => {
44353
- if (!path2.match(/\.(js|ts|mjs|cjs)$/)) {
44354
- return `from ${quote}${path2}.js${quote}`;
44355
- }
44356
- if (path2.endsWith(".ts")) {
44357
- return `from ${quote}${path2.replace(/\.ts$/, ".js")}${quote}`;
44359
+ const rewritten = rewriteRelativeJsSpecifier(outputPath, path2);
44360
+ if (rewritten !== path2) {
44361
+ return `from ${quote}${rewritten}${quote}`;
44358
44362
  }
44359
44363
  return match;
44360
44364
  });
@@ -44448,11 +44452,12 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
44448
44452
  const compiledRoot = compiledParent;
44449
44453
  const indexesDir = join15(compiledParent, "indexes");
44450
44454
  await fs2.mkdir(indexesDir, { recursive: true });
44455
+ const aotOutputs = hmr ? [] : await compileAngularFiles(entryPoints.map((entry) => resolve19(entry)), compiledRoot, stylePreprocessors);
44451
44456
  const compileTasks = entryPoints.map(async (entry) => {
44452
44457
  const resolvedEntry = resolve19(entry);
44453
44458
  const relativeEntry = relative9(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
44454
- const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
44455
- let outputs = await compileEntry();
44459
+ const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
44460
+ let outputs = hmr ? await compileEntry() : aotOutputs;
44456
44461
  const fileBase = basename7(resolvedEntry).replace(/\.[tj]s$/, "");
44457
44462
  const jsName = `${fileBase}.js`;
44458
44463
  const compiledFallbackPaths = [
@@ -44479,7 +44484,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
44479
44484
  rawServerFile = resolveRawServerFile([]);
44480
44485
  }
44481
44486
  if (rawServerFile && !existsSync16(rawServerFile)) {
44482
- outputs = await compileEntry();
44487
+ outputs = hmr ? await compileEntry() : aotOutputs;
44483
44488
  rawServerFile = resolveRawServerFile(outputs);
44484
44489
  }
44485
44490
  if (!rawServerFile || !existsSync16(rawServerFile)) {
@@ -58560,5 +58565,5 @@ export {
58560
58565
  ANGULAR_INIT_TIMEOUT_MS
58561
58566
  };
58562
58567
 
58563
- //# debugId=101D5DB96668BF8564756E2164756E21
58568
+ //# debugId=6AC746B610DD2DD564756E2164756E21
58564
58569
  //# sourceMappingURL=index.js.map