@absolutejs/absolute 0.19.0-beta.1137 → 0.19.0-beta.1139

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
@@ -1163,6 +1163,7 @@ var exports_eslintChunked = {};
1163
1163
  __export(exports_eslintChunked, {
1164
1164
  upstreamRef: () => upstreamRef,
1165
1165
  ruleSummary: () => ruleSummary,
1166
+ resolveLintTargets: () => resolveLintTargets,
1166
1167
  parseChunkedArgs: () => parseChunkedArgs,
1167
1168
  gitVisibleFiles: () => gitVisibleFiles,
1168
1169
  gitChangedFiles: () => gitChangedFiles,
@@ -1182,7 +1183,7 @@ var DEFAULT_CHUNK_SIZE = 20, DEFAULT_SHARDS = 4, DEFAULT_CONCURRENCY = 2, DEFAUL
1182
1183
  const visible = gitVisibleFiles(cwd);
1183
1184
  const matched = parsed.globs.length === 0 ? visible.filter((file) => LINTABLE_EXTENSIONS.test(file)) : visible.filter((file) => matchesAnyGlob(file, parsed.globs));
1184
1185
  return matched.filter((file) => existsSync6(resolve4(cwd, file))).sort();
1185
- }, buildShardChunks = (files, shards, chunkSize) => {
1186
+ }, resolveLintTargets = (args, cwd = process.cwd()) => resolveLintSet(parseChunkedArgs(args), cwd), buildShardChunks = (files, shards, chunkSize) => {
1186
1187
  const shardFiles = Array.from({ length: shards }, () => []);
1187
1188
  for (const file of files)
1188
1189
  shardFiles[shardOf(file, shards)]?.push(file);
@@ -1407,7 +1408,7 @@ var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION
1407
1408
  return true;
1408
1409
  }
1409
1410
  return false;
1410
- }, findConfigPath = (cwd = process.cwd()) => {
1411
+ }, findEslintConfigPath = (cwd = process.cwd()) => {
1411
1412
  for (const name of CONFIG_CANDIDATES) {
1412
1413
  const candidate = resolve5(cwd, name);
1413
1414
  if (existsSync7(candidate))
@@ -1477,15 +1478,20 @@ var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION
1477
1478
  }, createEslintCacheFingerprint = (cwd = process.cwd()) => {
1478
1479
  const hash = createHash("sha256");
1479
1480
  hash.update(`absolute-eslint-cache:${CACHE_CONTRACT_VERSION}\x00`);
1480
- const configPath2 = findConfigPath(cwd);
1481
- if (configPath2)
1482
- addFileToFingerprint(hash, configPath2, relative2(cwd, configPath2));
1481
+ const configPath2 = findEslintConfigPath(cwd);
1483
1482
  for (const dependency of lintDependencyNames(cwd, configPath2).sort()) {
1484
1483
  const manifestPath = findInstalledManifest(cwd, dependency);
1485
1484
  if (manifestPath)
1486
1485
  addFileToFingerprint(hash, manifestPath, dependency);
1487
1486
  }
1488
1487
  return hash.digest("hex");
1488
+ }, createEslintConfigDigest = (cwd = process.cwd()) => {
1489
+ const hash = createHash("sha256");
1490
+ hash.update(`absolute-eslint-config:${CACHE_CONTRACT_VERSION}\x00`);
1491
+ const configPath2 = findEslintConfigPath(cwd);
1492
+ if (configPath2)
1493
+ addFileToFingerprint(hash, configPath2, relative2(cwd, configPath2));
1494
+ return hash.digest("hex");
1489
1495
  }, writeFingerprint = (path, fingerprint) => {
1490
1496
  mkdirSync5(dirname3(path), { recursive: true });
1491
1497
  const temporary = `${path}.${process.pid}.tmp`;
@@ -1580,7 +1586,7 @@ var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache", CACHE_CONTRACT_VERSION
1580
1586
  }
1581
1587
  return blocks;
1582
1588
  }, checkForMisplacedIgnores = () => {
1583
- const configPath2 = findConfigPath();
1589
+ const configPath2 = findEslintConfigPath();
1584
1590
  if (!configPath2)
1585
1591
  return;
1586
1592
  let source;
@@ -171158,6 +171164,8 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
171158
171164
  if (!res.ok)
171159
171165
  return false;
171160
171166
  const html = await res.text();
171167
+ if (!isCompleteHtml(html))
171168
+ return false;
171161
171169
  const fileName = routeToFilename(route);
171162
171170
  const filePath = join9(prerenderDir, fileName);
171163
171171
  await Bun.write(filePath, html);
@@ -171184,6 +171192,10 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
171184
171192
  return;
171185
171193
  }
171186
171194
  const html = await res.text();
171195
+ if (!isCompleteHtml(html)) {
171196
+ log?.(` Failed to pre-render ${route} (incomplete HTML document)`);
171197
+ return;
171198
+ }
171187
171199
  const fileName = routeToFilename(route);
171188
171200
  const filePath = join9(prerenderDir, fileName);
171189
171201
  await Bun.write(filePath, html);
@@ -171218,7 +171230,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
171218
171230
  }, fetchWithTimeout = (url, init = {}) => fetch(url, {
171219
171231
  ...init,
171220
171232
  signal: init.signal ?? AbortSignal.timeout(getFetchTimeoutMs())
171221
- }), waitForServerReady = async (port) => {
171233
+ }), isCompleteHtml = (html) => !/^(?:\uFEFF)?\s*<!doctype\s+html\b/i.test(html) || /<\/html>\s*$/i.test(html), waitForServerReady = async (port) => {
171222
171234
  const deadline = performance.now() + getStartupTimeoutMs();
171223
171235
  const pollServer = async () => {
171224
171236
  if (performance.now() >= deadline) {
@@ -172012,7 +172024,7 @@ import {
172012
172024
  } from "fs";
172013
172025
  import { tmpdir as tmpdir2 } from "os";
172014
172026
  import { delimiter, dirname as dirname5, relative as relative4, resolve as resolve12 } from "path";
172015
- var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSION = 1, FLAG_NOT_FOUND = -1, runGit = (args, options) => {
172027
+ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSION = 2, FLAG_NOT_FOUND = -1, CHUNKED_FLAG = "--chunked", TSCONFIG_PATTERN, ABSOLUTE_BINARY, runGit = (args, options) => {
172016
172028
  const proc = Bun.spawnSync(["git", ...args], {
172017
172029
  cwd: options.cwd,
172018
172030
  env: { ...process.env, ...options.env },
@@ -172060,7 +172072,30 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
172060
172072
  env: env3
172061
172073
  });
172062
172074
  }
172063
- }, createLintSourceTree = (cwd = process.cwd(), proofLocation = DEFAULT_PROOF_LOCATION) => {
172075
+ }, eslintChunkedArgs = (command) => {
172076
+ const index = command.indexOf("eslint");
172077
+ if (index <= 0)
172078
+ return null;
172079
+ const binary = command[index - 1];
172080
+ if (binary === undefined || !ABSOLUTE_BINARY.test(binary))
172081
+ return null;
172082
+ const args = command.slice(index + 1);
172083
+ return args.includes(CHUNKED_FLAG) ? args : null;
172084
+ }, lintScopedFiles = (command, root) => {
172085
+ const args = eslintChunkedArgs(command);
172086
+ if (args === null)
172087
+ return null;
172088
+ const auxiliary = gitVisibleFiles(root).filter((file) => TSCONFIG_PATTERN.test(file));
172089
+ const configPath2 = findEslintConfigPath(root);
172090
+ const configRelative = configPath2 === null ? null : relative4(root, configPath2).replaceAll("\\", "/");
172091
+ return [
172092
+ ...new Set([
172093
+ ...resolveLintTargets(args, root),
172094
+ ...auxiliary,
172095
+ ...configRelative === null || configRelative.startsWith("../") ? [] : [configRelative]
172096
+ ])
172097
+ ].sort();
172098
+ }, createLintSourceTree = (cwd = process.cwd(), proofLocation = DEFAULT_PROOF_LOCATION, command = []) => {
172064
172099
  const root = gitRoot(cwd);
172065
172100
  const proofPath = resolve12(cwd, proofLocation);
172066
172101
  const proofRelative = relative4(root, proofPath).replaceAll("\\", "/");
@@ -172084,7 +172119,15 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
172084
172119
  };
172085
172120
  try {
172086
172121
  runGit(["read-tree", "--empty"], { cwd: root, env: env3 });
172087
- const files = runGit(["ls-files", "--cached", "--others", "--exclude-standard", "-z"], { cwd: root }).split("\x00").filter((path) => {
172122
+ const scoped = lintScopedFiles(command, root);
172123
+ const visible = scoped ?? runGit([
172124
+ "ls-files",
172125
+ "--cached",
172126
+ "--others",
172127
+ "--exclude-standard",
172128
+ "-z"
172129
+ ], { cwd: root }).split("\x00");
172130
+ const files = visible.filter((path) => {
172088
172131
  if (!path || path === proofRelative)
172089
172132
  return false;
172090
172133
  try {
@@ -172099,7 +172142,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
172099
172142
  } finally {
172100
172143
  rmSync5(temporaryDirectory, { force: true, recursive: true });
172101
172144
  }
172102
- }, proofFingerprint = (cwd) => createHash2("sha256").update(`absolute-lint-proof:${PROOF_CONTRACT_VERSION}\x00`).update(createEslintCacheFingerprint(cwd)).digest("hex"), createLintProof = (command, options = {}) => {
172145
+ }, proofFingerprint = (cwd) => createHash2("sha256").update(`absolute-lint-proof:${PROOF_CONTRACT_VERSION}\x00`).update(createEslintCacheFingerprint(cwd)).update("\x00").update(createEslintConfigDigest(cwd)).digest("hex"), createLintProof = (command, options = {}) => {
172103
172146
  const cwd = options.cwd ?? process.cwd();
172104
172147
  const proofLocation = options.proofLocation ?? DEFAULT_PROOF_LOCATION;
172105
172148
  return {
@@ -172107,7 +172150,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
172107
172150
  contractVersion: PROOF_CONTRACT_VERSION,
172108
172151
  createdAt: new Date().toISOString(),
172109
172152
  lintFingerprint: proofFingerprint(cwd),
172110
- sourceTree: createLintSourceTree(cwd, proofLocation)
172153
+ sourceTree: createLintSourceTree(cwd, proofLocation, command)
172111
172154
  };
172112
172155
  }, writeLintProof = (command, options = {}) => {
172113
172156
  const cwd = options.cwd ?? process.cwd();
@@ -172189,7 +172232,7 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
172189
172232
  reason: "ESLint configuration or toolchain changed",
172190
172233
  valid: false
172191
172234
  };
172192
- if (proof.sourceTree !== createLintSourceTree(cwd, proofLocation))
172235
+ if (proof.sourceTree !== createLintSourceTree(cwd, proofLocation, command))
172193
172236
  return {
172194
172237
  reason: "source tree changed since lint passed",
172195
172238
  valid: false
@@ -172278,6 +172321,9 @@ var DEFAULT_PROOF_LOCATION = ".absolutejs/lint-proof.json", PROOF_CONTRACT_VERSI
172278
172321
  };
172279
172322
  var init_lintProof = __esm(() => {
172280
172323
  init_eslint();
172324
+ init_eslintChunked();
172325
+ TSCONFIG_PATTERN = /(?:^|\/)tsconfig[^/]*\.json$/;
172326
+ ABSOLUTE_BINARY = /(?:^|[\\/])absolute(?:\.[cm]?[jt]s|\.exe)?$/;
172281
172327
  });
172282
172328
 
172283
172329
  // src/build/scanConventions.ts
@@ -173751,7 +173797,7 @@ var init_fromType = __esm(() => {
173751
173797
  // src/cli/config/absolute/resolveAbsoluteConfig.ts
173752
173798
  import { existsSync as existsSync17, readFileSync as readFileSync18 } from "fs";
173753
173799
  import { resolve as resolve14 } from "path";
173754
- var import_typescript5, CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath2 = (cwd, override) => {
173800
+ var import_typescript5, CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath = (cwd, override) => {
173755
173801
  if (override) {
173756
173802
  const resolved = resolve14(cwd, override);
173757
173803
  return existsSync17(resolved) ? resolved : null;
@@ -173843,7 +173889,7 @@ var import_typescript5, CONFIG_CANDIDATES2, RUNTIME_FIELDS, findConfigPath2 = (c
173843
173889
  }
173844
173890
  return { current, opaqueKeys };
173845
173891
  }, readAbsoluteConfigValues = (cwd, override) => {
173846
- const configPath2 = findConfigPath2(cwd, override);
173892
+ const configPath2 = findConfigPath(cwd, override);
173847
173893
  const { current, opaqueKeys } = configPath2 ? readCurrent(configPath2) : { current: {}, opaqueKeys: [] };
173848
173894
  return { configPath: configPath2, current, opaqueKeys };
173849
173895
  };
@@ -174017,7 +174063,7 @@ var asString = (value) => typeof value === "string" ? value : undefined, isRecor
174017
174063
  const entry = asString(config.entry) ?? DEFAULT_SERVER_ENTRY;
174018
174064
  return {
174019
174065
  config,
174020
- configPath: findConfigPath2(cwd, configOverride),
174066
+ configPath: findConfigPath(cwd, configOverride),
174021
174067
  cwd,
174022
174068
  frameworkDirs,
174023
174069
  serverEntry: resolveDir(cwd, entry),
package/dist/index.js CHANGED
@@ -24506,6 +24506,32 @@ var resolveDevClientDir3 = () => {
24506
24506
  ].join(`
24507
24507
  `) : nonVueLines.join(`
24508
24508
  `);
24509
+ }, wrapServerAsyncComponentLoader = (code) => {
24510
+ const vueImportRegex = /import\s+\{([^}]+)\}\s+from\s+['"]vue['"];?/;
24511
+ const match = code.match(vueImportRegex);
24512
+ if (!match?.[1])
24513
+ return code;
24514
+ const specifiers = match[1].split(",").map((specifier) => specifier.trim());
24515
+ const asyncComponentIndex = specifiers.findIndex((specifier) => /^defineAsyncComponent(?:\s+as\s+[A-Za-z_$][\w$]*)?$/.test(specifier));
24516
+ if (asyncComponentIndex === -1)
24517
+ return code;
24518
+ const asyncComponentSpecifier = specifiers[asyncComponentIndex] ?? "";
24519
+ const localName = asyncComponentSpecifier.match(/\s+as\s+([A-Za-z_$][\w$]*)$/)?.[1] ?? "defineAsyncComponent";
24520
+ const importedName = "__absoluteDefineAsyncComponent";
24521
+ specifiers[asyncComponentIndex] = `defineAsyncComponent as ${importedName}`;
24522
+ const wrapper = `
24523
+ const __absoluteResolveAsyncVueComponent = async (loader) => {
24524
+ const loaded = await loader();
24525
+ return loaded && typeof loaded === "object" && "default" in loaded
24526
+ ? loaded.default
24527
+ : loaded;
24528
+ };
24529
+ const ${localName} = (source) => ${importedName}(
24530
+ typeof source === "function"
24531
+ ? () => __absoluteResolveAsyncVueComponent(source)
24532
+ : { ...source, loader: () => __absoluteResolveAsyncVueComponent(source.loader) },
24533
+ );`;
24534
+ return code.replace(vueImportRegex, `import { ${specifiers.join(", ")} } from 'vue';${wrapper}`);
24509
24535
  }, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler, stylePreprocessors) => {
24510
24536
  const cachedResult = cacheMap.get(sourceFilePath);
24511
24537
  if (cachedResult)
@@ -24644,7 +24670,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
24644
24670
  `));
24645
24671
  };
24646
24672
  const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
24647
- const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
24673
+ const serverCode = wrapServerAsyncComponentLoader(assembleModule(generateRenderFunction(true), "ssrRender", false)) + islandMetadataExports;
24648
24674
  const clientOutputPath = join33(outputDirs.client, `${relativeWithoutExtension}.js`);
24649
24675
  const serverOutputPath = join33(outputDirs.server, `${relativeWithoutExtension}.js`);
24650
24676
  const rewritePackageImports = (code, outputPath, mode) => {
@@ -39767,6 +39793,8 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
39767
39793
  if (!res.ok)
39768
39794
  return false;
39769
39795
  const html = await res.text();
39796
+ if (!isCompleteHtml(html))
39797
+ return false;
39770
39798
  const fileName = routeToFilename(route);
39771
39799
  const filePath = join48(prerenderDir, fileName);
39772
39800
  await Bun.write(filePath, html);
@@ -39793,6 +39821,10 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
39793
39821
  return;
39794
39822
  }
39795
39823
  const html = await res.text();
39824
+ if (!isCompleteHtml(html)) {
39825
+ log2?.(` Failed to pre-render ${route} (incomplete HTML document)`);
39826
+ return;
39827
+ }
39796
39828
  const fileName = routeToFilename(route);
39797
39829
  const filePath = join48(prerenderDir, fileName);
39798
39830
  await Bun.write(filePath, html);
@@ -39827,7 +39859,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
39827
39859
  }, fetchWithTimeout = (url2, init = {}) => fetch(url2, {
39828
39860
  ...init,
39829
39861
  signal: init.signal ?? AbortSignal.timeout(getFetchTimeoutMs())
39830
- }), waitForServerReady = async (port) => {
39862
+ }), isCompleteHtml = (html) => !/^(?:\uFEFF)?\s*<!doctype\s+html\b/i.test(html) || /<\/html>\s*$/i.test(html), waitForServerReady = async (port) => {
39831
39863
  const deadline = performance.now() + getStartupTimeoutMs();
39832
39864
  const pollServer = async () => {
39833
39865
  if (performance.now() >= deadline) {
@@ -48062,5 +48094,5 @@ export {
48062
48094
  ANGULAR_INIT_TIMEOUT_MS
48063
48095
  };
48064
48096
 
48065
- //# debugId=2428F637392E781D64756E2164756E21
48097
+ //# debugId=77CD9846833A953D64756E2164756E21
48066
48098
  //# sourceMappingURL=index.js.map