@absolutejs/absolute 0.19.0-beta.1104 → 0.19.0-beta.1106

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
@@ -169997,7 +169997,7 @@ var isRecord = (value) => typeof value === "object" && value !== null, getIsland
169997
169997
  var init_islands = () => {};
169998
169998
 
169999
169999
  // src/build/islandEntries.ts
170000
- import { dirname as dirname3, extname, join as join8, relative, resolve as resolve6 } from "path";
170000
+ import { dirname as dirname4, extname, join as join8, relative, resolve as resolve6 } from "path";
170001
170001
  var import_typescript, frameworks, isRecord2 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
170002
170002
  if (isRecord2(mod.islandRegistry))
170003
170003
  return mod.islandRegistry;
@@ -170008,7 +170008,7 @@ var import_typescript, frameworks, isRecord2 = (value) => typeof value === "obje
170008
170008
  if (sourcePath.startsWith("file://")) {
170009
170009
  return new URL(sourcePath).pathname;
170010
170010
  }
170011
- return resolve6(dirname3(registryPath), sourcePath);
170011
+ return resolve6(dirname4(registryPath), sourcePath);
170012
170012
  }, getObjectPropertyName = (name) => {
170013
170013
  if (import_typescript.default.isIdentifier(name) || import_typescript.default.isStringLiteral(name)) {
170014
170014
  return name.text;
@@ -170396,7 +170396,7 @@ __export(exports_prerender, {
170396
170396
  prerender: () => prerender,
170397
170397
  PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
170398
170398
  });
170399
- import { mkdirSync as mkdirSync5, readFileSync as readFileSync10 } from "fs";
170399
+ import { mkdirSync as mkdirSync6, readFileSync as readFileSync10 } from "fs";
170400
170400
  import { join as join9 } from "path";
170401
170401
  var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, DEFAULT_FETCH_TIMEOUT_MS = 1e4, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
170402
170402
  const metaPath = htmlPath.replace(/\.html$/, ".meta");
@@ -170498,7 +170498,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
170498
170498
  log?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
170499
170499
  }, prerender = async (port, outDir, staticConfig, log) => {
170500
170500
  const prerenderDir = join9(outDir, "_prerendered");
170501
- mkdirSync5(prerenderDir, { recursive: true });
170501
+ mkdirSync6(prerenderDir, { recursive: true });
170502
170502
  const baseUrl = `http://localhost:${port}`;
170503
170503
  let routes;
170504
170504
  if (staticConfig.routes === "all") {
@@ -170608,7 +170608,7 @@ ${serverOutput}` : "Server failed to start for pre-rendering";
170608
170608
  var init_prerender = () => {};
170609
170609
 
170610
170610
  // src/build/maskLiterals.ts
170611
- var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
170611
+ var SENTINEL, RISKY_STRING_CONTENT, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR, REGEX_OK_AFTER_WORD, maskLiterals = (src) => {
170612
170612
  const n = src.length;
170613
170613
  const pieces = [];
170614
170614
  let out = "";
@@ -170616,7 +170616,6 @@ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR,
170616
170616
  let prevChar = "";
170617
170617
  let prevWord = "";
170618
170618
  let prevWasSpace = false;
170619
- let wordBeforeParen = "";
170620
170619
  const mask = (text) => {
170621
170620
  out += SENTINEL + pieces.length + SENTINEL;
170622
170621
  pieces.push(text);
@@ -170754,14 +170753,14 @@ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR,
170754
170753
  }
170755
170754
  if (c === '"' || c === "'") {
170756
170755
  const end = endOfString(i);
170757
- const isSpecifier = prevWord === "from" || prevWord === "import" || prevChar === "(" && (wordBeforeParen === "import" || wordBeforeParen === "require");
170758
- if (isSpecifier) {
170759
- out += src.slice(i, end);
170756
+ const text = src.slice(i, end);
170757
+ if (RISKY_STRING_CONTENT.test(text)) {
170758
+ mask(text);
170759
+ } else {
170760
+ out += text;
170760
170761
  prevChar = '"';
170761
170762
  prevWord = "";
170762
170763
  prevWasSpace = false;
170763
- } else {
170764
- mask(src.slice(i, end));
170765
170764
  }
170766
170765
  i = end;
170767
170766
  continue;
@@ -170788,8 +170787,6 @@ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR,
170788
170787
  const contiguous = isIdentChar(prevChar) && !prevWasSpace;
170789
170788
  prevWord = contiguous ? prevWord + c : c;
170790
170789
  } else {
170791
- if (c === "(")
170792
- wordBeforeParen = prevWord;
170793
170790
  prevWord = "";
170794
170791
  }
170795
170792
  prevChar = c;
@@ -170801,6 +170798,7 @@ var SENTINEL, isIdentChar = (c) => /[A-Za-z0-9_$]/.test(c), REGEX_OK_AFTER_CHAR,
170801
170798
  };
170802
170799
  var init_maskLiterals = __esm(() => {
170803
170800
  SENTINEL = String.fromCharCode(57344);
170801
+ RISKY_STRING_CONTENT = /\b(?:from|import|require)\s*\(?\s*["'`]/;
170804
170802
  REGEX_OK_AFTER_CHAR = new Set([
170805
170803
  "(",
170806
170804
  ",",
@@ -172504,10 +172502,10 @@ var init_mem = __esm(() => {
172504
172502
  // src/cli/config/schema/fromType.ts
172505
172503
  import {
172506
172504
  existsSync as existsSync14,
172507
- mkdirSync as mkdirSync7,
172505
+ mkdirSync as mkdirSync8,
172508
172506
  readFileSync as readFileSync16,
172509
172507
  statSync as statSync2,
172510
- writeFileSync as writeFileSync6
172508
+ writeFileSync as writeFileSync7
172511
172509
  } from "fs";
172512
172510
  import { resolve as resolve11 } from "path";
172513
172511
  var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DEPTH = 6, isFrameworkRepo = (cwd) => {
@@ -172567,10 +172565,10 @@ var import_typescript3, VIRTUAL_NAME = "__absolute_type_introspect__.ts", MAX_DE
172567
172565
  return null;
172568
172566
  }, writeDiskCache = (cwd, typeName, signature, fields, specifier) => {
172569
172567
  try {
172570
- mkdirSync7(resolve11(cwd, ".absolutejs", "config-schema"), {
172568
+ mkdirSync8(resolve11(cwd, ".absolutejs", "config-schema"), {
172571
172569
  recursive: true
172572
172570
  });
172573
- writeFileSync6(cacheFile(cwd, typeName, specifier), JSON.stringify({ fields, signature }));
172571
+ writeFileSync7(cacheFile(cwd, typeName, specifier), JSON.stringify({ fields, signature }));
172574
172572
  } catch {}
172575
172573
  }, docOf = (symbol, checker) => import_typescript3.default.displayPartsToString(symbol.getDocumentationComment(checker)).trim(), typeOfSymbol = (symbol, checker) => {
172576
172574
  const declaration = symbol.valueDeclaration ?? symbol.declarations?.[0];
@@ -172968,7 +172966,7 @@ var init_frameworks = __esm(() => {
172968
172966
  });
172969
172967
 
172970
172968
  // src/cli/generate/context.ts
172971
- import { dirname as dirname4, isAbsolute, join as join14, relative as relative3, resolve as resolve13 } from "path";
172969
+ import { dirname as dirname5, isAbsolute, join as join14, relative as relative3, resolve as resolve13 } from "path";
172972
172970
  var asString = (value) => typeof value === "string" ? value : undefined, isRecord3 = (value) => typeof value === "object" && value !== null, resolveDir = (cwd, value) => isAbsolute(value) ? value : resolve13(cwd, value), resolveStylesDir = (cwd, config) => {
172973
172971
  const styles = config.stylesConfig;
172974
172972
  if (typeof styles === "string")
@@ -172981,7 +172979,7 @@ var asString = (value) => typeof value === "string" ? value : undefined, isRecor
172981
172979
  return resolve13(cwd, "src/frontend/styles/indexes");
172982
172980
  }, configuredFrameworks = (project) => FRAMEWORK_KEYS2.filter((key) => project.frameworkDirs[key] !== undefined), frontendRootFor = (project, framework) => {
172983
172981
  const dir = project.frameworkDirs[framework];
172984
- return dir ? dirname4(dir) : resolve13(project.cwd, "src/frontend");
172982
+ return dir ? dirname5(dir) : resolve13(project.cwd, "src/frontend");
172985
172983
  }, resolveProject = async (cwd, configOverride) => {
172986
172984
  const loaded = await loadConfig(configOverride);
172987
172985
  const config = isRecord3(loaded) ? loaded : {};
@@ -173059,8 +173057,8 @@ var emptyOutcome = () => ({
173059
173057
  });
173060
173058
 
173061
173059
  // src/cli/generate/routeWiring.ts
173062
- import { existsSync as existsSync16, readFileSync as readFileSync18, readdirSync as readdirSync4, writeFileSync as writeFileSync7 } from "fs";
173063
- import { dirname as dirname5, join as join15 } from "path";
173060
+ import { existsSync as existsSync16, readFileSync as readFileSync18, readdirSync as readdirSync4, writeFileSync as writeFileSync8 } from "fs";
173061
+ import { dirname as dirname6, join as join15 } from "path";
173064
173062
  var import_typescript5, DEFAULT_SEPARATOR = `
173065
173063
  `, BOUNDARY_USE, applyEdits = (text, edits) => {
173066
173064
  const ordered = [...edits].sort((first, second) => second.start - first.start);
@@ -173225,7 +173223,7 @@ ${newLines.join(`
173225
173223
  }
173226
173224
  return null;
173227
173225
  }, findRoutingFile = (serverEntry) => {
173228
- const pluginsDir = join15(dirname5(serverEntry), "plugins");
173226
+ const pluginsDir = join15(dirname6(serverEntry), "plugins");
173229
173227
  const preferred = join15(pluginsDir, "pagesPlugin.ts");
173230
173228
  if (hasChain(preferred))
173231
173229
  return preferred;
@@ -173236,7 +173234,7 @@ ${newLines.join(`
173236
173234
  return serverEntry;
173237
173235
  return null;
173238
173236
  }, buildRouteContext = (input, routingFile) => {
173239
- const specifier = `${toModuleSpecifier(dirname5(routingFile), stripExtension(input.pageFileAbs))}${input.def.pageImportExtension ?? ""}`;
173237
+ const specifier = `${toModuleSpecifier(dirname6(routingFile), stripExtension(input.pageFileAbs))}${input.def.pageImportExtension ?? ""}`;
173240
173238
  return {
173241
173239
  cssAssetKey: input.cssAssetKey,
173242
173240
  indexKey: input.indexKey,
@@ -173272,7 +173270,7 @@ ${newLines.join(`
173272
173270
  start: offset,
173273
173271
  text: `${separator}.use(${pluginName})`
173274
173272
  });
173275
- writeFileSync7(serverEntry, applyEdits(text, edits), "utf-8");
173273
+ writeFileSync8(serverEntry, applyEdits(text, edits), "utf-8");
173276
173274
  return { kind: "edited", routingFile: serverEntry };
173277
173275
  }, wireRoute = (input) => {
173278
173276
  const routingFile = findRoutingFile(input.serverEntry);
@@ -173308,7 +173306,7 @@ ${routeExpr}`
173308
173306
  start: offset,
173309
173307
  text: `${separator}${routeExpr}`
173310
173308
  });
173311
- writeFileSync7(routingFile, applyEdits(text, edits), "utf-8");
173309
+ writeFileSync8(routingFile, applyEdits(text, edits), "utf-8");
173312
173310
  return { kind: "edited", routingFile };
173313
173311
  };
173314
173312
  var init_routeWiring = __esm(() => {
@@ -173318,8 +173316,8 @@ var init_routeWiring = __esm(() => {
173318
173316
  });
173319
173317
 
173320
173318
  // src/cli/generate/generateApi.ts
173321
- import { existsSync as existsSync17, mkdirSync as mkdirSync8, writeFileSync as writeFileSync8 } from "fs";
173322
- import { dirname as dirname6, join as join16 } from "path";
173319
+ import { existsSync as existsSync17, mkdirSync as mkdirSync9, writeFileSync as writeFileSync9 } from "fs";
173320
+ import { dirname as dirname7, join as join16 } from "path";
173323
173321
  var apiPluginTemplate = (pluginName, base) => `import { Elysia } from 'elysia';
173324
173322
 
173325
173323
  export const ${pluginName} = new Elysia()
@@ -173331,16 +173329,16 @@ export const ${pluginName} = new Elysia()
173331
173329
  const pluginName = `${camel}Plugin`;
173332
173330
  const base = `/api/${kebab}`;
173333
173331
  const outcome = { ...emptyOutcome(), route: base };
173334
- const pluginsDir = join16(dirname6(project.serverEntry), "plugins");
173332
+ const pluginsDir = join16(dirname7(project.serverEntry), "plugins");
173335
173333
  const fileAbs = join16(pluginsDir, `${pluginName}.ts`);
173336
173334
  if (existsSync17(fileAbs)) {
173337
173335
  outcome.notes.push(`${pluginName} already exists at ${fileAbs} \u2014 skipped.`);
173338
173336
  return outcome;
173339
173337
  }
173340
- mkdirSync8(pluginsDir, { recursive: true });
173341
- writeFileSync8(fileAbs, apiPluginTemplate(pluginName, base), "utf-8");
173338
+ mkdirSync9(pluginsDir, { recursive: true });
173339
+ writeFileSync9(fileAbs, apiPluginTemplate(pluginName, base), "utf-8");
173342
173340
  outcome.created.push(fileAbs);
173343
- const specifier = toModuleSpecifier(dirname6(project.serverEntry), fileAbs.replace(/\.ts$/, ""));
173341
+ const specifier = toModuleSpecifier(dirname7(project.serverEntry), fileAbs.replace(/\.ts$/, ""));
173344
173342
  const wired = wirePluginUse(project.serverEntry, pluginName, specifier);
173345
173343
  if (wired.kind === "edited")
173346
173344
  outcome.updated.push(wired.routingFile);
@@ -173406,8 +173404,8 @@ var init_componentTemplates = __esm(() => {
173406
173404
  });
173407
173405
 
173408
173406
  // src/cli/generate/generateComponent.ts
173409
- import { existsSync as existsSync18, mkdirSync as mkdirSync9, writeFileSync as writeFileSync9 } from "fs";
173410
- import { dirname as dirname7, join as join17 } from "path";
173407
+ import { existsSync as existsSync18, mkdirSync as mkdirSync10, writeFileSync as writeFileSync10 } from "fs";
173408
+ import { dirname as dirname8, join as join17 } from "path";
173411
173409
  var generateComponent = (project, framework, rawName) => {
173412
173410
  const def = frameworks2[framework];
173413
173411
  const pascal = toPascalCase(rawName);
@@ -173423,8 +173421,8 @@ var generateComponent = (project, framework, rawName) => {
173423
173421
  outcome.notes.push(`${pascal} already exists at ${fileAbs} \u2014 skipped.`);
173424
173422
  return outcome;
173425
173423
  }
173426
- mkdirSync9(dirname7(fileAbs), { recursive: true });
173427
- writeFileSync9(fileAbs, componentTemplates[framework]({
173424
+ mkdirSync10(dirname8(fileAbs), { recursive: true });
173425
+ writeFileSync10(fileAbs, componentTemplates[framework]({
173428
173426
  kebab,
173429
173427
  pascal,
173430
173428
  title: toTitleCase(rawName)
@@ -173505,8 +173503,8 @@ var init_cssStrategy = __esm(() => {
173505
173503
  });
173506
173504
 
173507
173505
  // src/cli/generate/navData.ts
173508
- import { existsSync as existsSync20, mkdirSync as mkdirSync10, readFileSync as readFileSync19, writeFileSync as writeFileSync10 } from "fs";
173509
- import { dirname as dirname8 } from "path";
173506
+ import { existsSync as existsSync20, mkdirSync as mkdirSync11, readFileSync as readFileSync19, writeFileSync as writeFileSync11 } from "fs";
173507
+ import { dirname as dirname9 } from "path";
173510
173508
  var import_typescript7, NAV_DATA_TEMPLATE = `type NavItem = {
173511
173509
  href: string;
173512
173510
  label: string;
@@ -173583,8 +173581,8 @@ ${indent}${entry}`;
173583
173581
  }, upsertNavItem = (navDataPath, item) => {
173584
173582
  const created = !existsSync20(navDataPath);
173585
173583
  if (created) {
173586
- mkdirSync10(dirname8(navDataPath), { recursive: true });
173587
- writeFileSync10(navDataPath, NAV_DATA_TEMPLATE, "utf-8");
173584
+ mkdirSync11(dirname9(navDataPath), { recursive: true });
173585
+ writeFileSync11(navDataPath, NAV_DATA_TEMPLATE, "utf-8");
173588
173586
  }
173589
173587
  const existing = readNavItems(navDataPath);
173590
173588
  if (existing.some((candidate) => candidate.href === item.href)) {
@@ -173596,7 +173594,7 @@ ${indent}${entry}`;
173596
173594
  if (!array)
173597
173595
  return { changed: created, created, items: existing };
173598
173596
  const entry = `{ href: '${item.href}', label: '${item.label}' }`;
173599
- writeFileSync10(navDataPath, insertElement(text, array, sourceFile, entry), "utf-8");
173597
+ writeFileSync11(navDataPath, insertElement(text, array, sourceFile, entry), "utf-8");
173600
173598
  return { changed: true, created, items: [...existing, item] };
173601
173599
  };
173602
173600
  var init_navData = __esm(() => {
@@ -173750,15 +173748,15 @@ var init_pageTemplates = __esm(() => {
173750
173748
  // src/cli/generate/generatePage.ts
173751
173749
  import {
173752
173750
  existsSync as existsSync21,
173753
- mkdirSync as mkdirSync11,
173751
+ mkdirSync as mkdirSync12,
173754
173752
  readFileSync as readFileSync20,
173755
173753
  readdirSync as readdirSync5,
173756
- writeFileSync as writeFileSync11
173754
+ writeFileSync as writeFileSync12
173757
173755
  } from "fs";
173758
- import { dirname as dirname9, join as join19, relative as relative4 } from "path";
173756
+ import { dirname as dirname10, join as join19, relative as relative4 } from "path";
173759
173757
  var writeNew = (path, contents) => {
173760
- mkdirSync11(dirname9(path), { recursive: true });
173761
- writeFileSync11(path, contents, "utf-8");
173758
+ mkdirSync12(dirname10(path), { recursive: true });
173759
+ writeFileSync12(path, contents, "utf-8");
173762
173760
  }, toHref = (fromDir, toFile) => {
173763
173761
  const rel = relative4(fromDir, toFile).split("\\").join("/");
173764
173762
  return rel.startsWith(".") ? rel : `./${rel}`;
@@ -173767,7 +173765,7 @@ var writeNew = (path, contents) => {
173767
173765
  const synced = syncStaticNav(html, items);
173768
173766
  if (synced === null || synced === html)
173769
173767
  return false;
173770
- writeFileSync11(file, synced, "utf-8");
173768
+ writeFileSync12(file, synced, "utf-8");
173771
173769
  return true;
173772
173770
  }, resyncStaticPages = (project, items, skipFile) => {
173773
173771
  const updated = [];
@@ -173800,9 +173798,9 @@ var writeNew = (path, contents) => {
173800
173798
  const css = planCss(routingText, project.stylesDir, pascal, kebab);
173801
173799
  const navDataPath = join19(sharedDirFor(project, framework), "navData.ts");
173802
173800
  const nav = upsertNavItem(navDataPath, { href: route, label: title });
173803
- const navImportPath = toModuleSpecifier(dirname9(pageFileAbs), navDataPath.replace(/\.ts$/, ""));
173801
+ const navImportPath = toModuleSpecifier(dirname10(pageFileAbs), navDataPath.replace(/\.ts$/, ""));
173804
173802
  writeNew(pageFileAbs, pageTemplates[framework]({
173805
- cssHref: toHref(dirname9(pageFileAbs), css.cssFileAbs),
173803
+ cssHref: toHref(dirname10(pageFileAbs), css.cssFileAbs),
173806
173804
  kebab,
173807
173805
  navImportPath,
173808
173806
  navItems: nav.items,
@@ -173869,13 +173867,13 @@ var SUBCOMMANDS, write = (text) => process.stdout.write(`${text}
173869
173867
  consumed.add(idx + 1);
173870
173868
  }
173871
173869
  const positionals = args.filter((value, idx) => !consumed.has(idx) && !value.startsWith("--"));
173872
- const flagValue = (flag) => {
173870
+ const flagValue2 = (flag) => {
173873
173871
  const idx = args.indexOf(flag);
173874
173872
  return idx >= 0 ? args[idx + 1] : undefined;
173875
173873
  };
173876
173874
  return {
173877
- config: flagValue("--config"),
173878
- framework: flagValue("--framework"),
173875
+ config: flagValue2("--config"),
173876
+ framework: flagValue2("--framework"),
173879
173877
  name: positionals[1],
173880
173878
  subcommand: positionals[0]
173881
173879
  };
@@ -173987,7 +173985,7 @@ ${indent.repeat(level)}}`;
173987
173985
  var init_serialize = () => {};
173988
173986
 
173989
173987
  // src/cli/config/absolute/editAbsoluteConfig.ts
173990
- import { readFileSync as readFileSync21, writeFileSync as writeFileSync12 } from "fs";
173988
+ import { readFileSync as readFileSync21, writeFileSync as writeFileSync13 } from "fs";
173991
173989
  var import_typescript8, lineStartOffset = (text, position) => {
173992
173990
  let index = position;
173993
173991
  while (index > 0 && text[index - 1] !== `
@@ -174016,14 +174014,14 @@ var import_typescript8, lineStartOffset = (text, position) => {
174016
174014
  if (text[end] === `
174017
174015
  `)
174018
174016
  end += 1;
174019
- writeFileSync12(configPath2, text.slice(0, start2) + text.slice(end), "utf-8");
174017
+ writeFileSync13(configPath2, text.slice(0, start2) + text.slice(end), "utf-8");
174020
174018
  return { message: `Removed ${request.name}`, ok: true };
174021
174019
  }
174022
174020
  const valueText = serializeValue(request.value);
174023
174021
  if (existing) {
174024
174022
  const start2 = existing.initializer.getStart(sourceFile);
174025
174023
  const end = existing.initializer.getEnd();
174026
- writeFileSync12(configPath2, text.slice(0, start2) + valueText + text.slice(end), "utf-8");
174024
+ writeFileSync13(configPath2, text.slice(0, start2) + valueText + text.slice(end), "utf-8");
174027
174025
  return { message: `Updated ${request.name}`, ok: true };
174028
174026
  }
174029
174027
  const { properties } = object;
@@ -174043,14 +174041,14 @@ var import_typescript8, lineStartOffset = (text, position) => {
174043
174041
  at += 1;
174044
174042
  const insertion = `${hasComma ? "" : ","}
174045
174043
  ${indent}${entry}`;
174046
- writeFileSync12(configPath2, text.slice(0, at) + insertion + text.slice(at), "utf-8");
174044
+ writeFileSync13(configPath2, text.slice(0, at) + insertion + text.slice(at), "utf-8");
174047
174045
  } else {
174048
174046
  const at = object.getStart(sourceFile) + 1;
174049
174047
  const indent = `${indentBefore2(text, object.getStart(sourceFile))} `;
174050
174048
  const insertion = `
174051
174049
  ${indent}${entry}
174052
174050
  ${indentBefore2(text, object.getStart(sourceFile))}`;
174053
- writeFileSync12(configPath2, text.slice(0, at) + insertion + text.slice(at), "utf-8");
174051
+ writeFileSync13(configPath2, text.slice(0, at) + insertion + text.slice(at), "utf-8");
174054
174052
  }
174055
174053
  return { message: `Updated ${request.name}`, ok: true };
174056
174054
  } catch (error) {
@@ -174964,8 +174962,8 @@ var init_resolveAuthState = __esm(() => {
174964
174962
  });
174965
174963
 
174966
174964
  // src/cli/config/auth/scaffoldAuthFeature.ts
174967
- import { existsSync as existsSync25, writeFileSync as writeFileSync13 } from "fs";
174968
- import { dirname as dirname10, join as join22, relative as relative7, resolve as resolve16 } from "path";
174965
+ import { existsSync as existsSync25, writeFileSync as writeFileSync14 } from "fs";
174966
+ import { dirname as dirname11, join as join22, relative as relative7, resolve as resolve16 } from "path";
174969
174967
  var renderScaffold = (scaffold) => {
174970
174968
  const importNames = [...scaffold.imports, `type ${scaffold.typeName}`];
174971
174969
  const importLine = `import { ${importNames.join(", ")} } from '@absolutejs/auth';`;
@@ -174990,7 +174988,7 @@ ${body}
174990
174988
  }, targetDir = (cwd) => {
174991
174989
  const { setupPath } = resolveAuthState(cwd);
174992
174990
  if (setupPath)
174993
- return dirname10(resolve16(cwd, setupPath));
174991
+ return dirname11(resolve16(cwd, setupPath));
174994
174992
  const src = join22(cwd, "src");
174995
174993
  return existsSync25(src) ? src : cwd;
174996
174994
  }, spreadFor = (scaffold) => `import { ${scaffold.exportName} } from './${scaffold.exportName}';
@@ -175018,7 +175016,7 @@ ${scaffold.configKey}: ${scaffold.exportName}`, failure2 = (message) => ({
175018
175016
  }
175019
175017
  const install = options.install ?? true;
175020
175018
  const installOk = install && scaffold.packages.length > 0 ? installPackages(cwd, scaffold.packages) : true;
175021
- writeFileSync13(filePath, renderScaffold(scaffold));
175019
+ writeFileSync14(filePath, renderScaffold(scaffold));
175022
175020
  return {
175023
175021
  created: relPath,
175024
175022
  installed: installOk,
@@ -175034,7 +175032,7 @@ var init_scaffoldAuthFeature = __esm(() => {
175034
175032
  });
175035
175033
 
175036
175034
  // src/cli/htmx/install.ts
175037
- import { existsSync as existsSync26, mkdirSync as mkdirSync12, readFileSync as readFileSync25, writeFileSync as writeFileSync14 } from "fs";
175035
+ import { existsSync as existsSync26, mkdirSync as mkdirSync13, readFileSync as readFileSync25, writeFileSync as writeFileSync15 } from "fs";
175038
175036
  import { join as join23 } from "path";
175039
175037
  var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
175040
175038
  join23(import.meta.dir, "htmx.min.js"),
@@ -175059,9 +175057,9 @@ var VENDORED_HTMX_VERSION = "2.0.6", vendoredHtmxFile = () => [
175059
175057
  const file = vendoredHtmxFile();
175060
175058
  return file ? readFileSync25(file, "utf-8") : null;
175061
175059
  }, writeHtmx = (htmxDir, content) => {
175062
- mkdirSync12(htmxDir, { recursive: true });
175060
+ mkdirSync13(htmxDir, { recursive: true });
175063
175061
  const file = join23(htmxDir, "htmx.min.js");
175064
- writeFileSync14(file, content, "utf-8");
175062
+ writeFileSync15(file, content, "utf-8");
175065
175063
  return file;
175066
175064
  };
175067
175065
  var init_install = () => {};
@@ -175071,7 +175069,7 @@ var exports_add = {};
175071
175069
  __export(exports_add, {
175072
175070
  runAdd: () => runAdd
175073
175071
  });
175074
- import { dirname as dirname11, join as join24, relative as relative8 } from "path";
175072
+ import { dirname as dirname12, join as join24, relative as relative8 } from "path";
175075
175073
  var write2 = (text) => process.stdout.write(`${text}
175076
175074
  `), fail2 = (message) => {
175077
175075
  process.stdout.write(`${colors.red}${message}${colors.reset}
@@ -175086,7 +175084,7 @@ var write2 = (text) => process.stdout.write(`${text}
175086
175084
  }, frontendRoot = (project, cwd) => {
175087
175085
  const [firstKey] = configuredFrameworks(project);
175088
175086
  const firstDir = firstKey ? project.frameworkDirs[firstKey] : undefined;
175089
- return firstDir ? dirname11(firstDir) : join24(cwd, "src", "frontend");
175087
+ return firstDir ? dirname12(firstDir) : join24(cwd, "src", "frontend");
175090
175088
  }, addIntegrationCli = (id, install) => {
175091
175089
  const result = addIntegration(process.cwd(), id, { install });
175092
175090
  if (!result.ok) {
@@ -175220,7 +175218,7 @@ var exports_analyze = {};
175220
175218
  __export(exports_analyze, {
175221
175219
  runAnalyze: () => runAnalyze
175222
175220
  });
175223
- import { existsSync as existsSync27, readFileSync as readFileSync26, statSync as statSync3, writeFileSync as writeFileSync15 } from "fs";
175221
+ import { existsSync as existsSync27, readFileSync as readFileSync26, statSync as statSync3, writeFileSync as writeFileSync16 } from "fs";
175224
175222
  import { join as join25, resolve as resolve17 } from "path";
175225
175223
  var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_WIDTH = 16, SIZE_WIDTH = 12, CHANGE_WIDTH = 10, CATEGORY_ORDER, categoryOf = (key) => {
175226
175224
  if (key.startsWith("Island"))
@@ -175340,7 +175338,7 @@ var BASELINE_FILE = ".absolute-size-baseline.json", TOP_CHANGES = 12, CATEGORY_W
175340
175338
  return;
175341
175339
  }
175342
175340
  if (args.includes("--save")) {
175343
- writeFileSync15(join25(cwd, BASELINE_FILE), `${JSON.stringify(sizes, null, 2)}
175341
+ writeFileSync16(join25(cwd, BASELINE_FILE), `${JSON.stringify(sizes, null, 2)}
175344
175342
  `);
175345
175343
  process.stdout.write(`${colors.green}\u2713${colors.reset} Saved size baseline (${Object.keys(sizes).length} entries) to ${BASELINE_FILE}
175346
175344
  `);
@@ -175796,7 +175794,7 @@ __export(exports_db, {
175796
175794
  conflictClause: () => conflictClause,
175797
175795
  chunkRows: () => chunkRows
175798
175796
  });
175799
- import { existsSync as existsSync30, mkdirSync as mkdirSync13, readFileSync as readFileSync29, writeFileSync as writeFileSync16 } from "fs";
175797
+ import { existsSync as existsSync30, mkdirSync as mkdirSync14, readFileSync as readFileSync29, writeFileSync as writeFileSync17 } from "fs";
175800
175798
  import { join as join27 } from "path";
175801
175799
  var {env: env4, spawn: spawn2, SQL } = globalThis.Bun;
175802
175800
  var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA_TYPES, SEED_CANDIDATES, VALUE_FLAGS, paint = (text, color) => `${color}${text}${colors.reset}`, chunkRows = (items, size) => Array.from({ length: Math.ceil(items.length / size) }, (_, idx) => items.slice(idx * size, idx * size + size)), quoteIdent = (name) => `"${name.replace(/"/g, '""')}"`, resolveUrl = (explicit) => {
@@ -175908,11 +175906,11 @@ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA
175908
175906
  v: BACKUP_FORMAT_VERSION
175909
175907
  };
175910
175908
  const dir = options.out ?? join27(process.cwd(), "backups");
175911
- mkdirSync13(dir, { recursive: true });
175909
+ mkdirSync14(dir, { recursive: true });
175912
175910
  const json = JSON.stringify(payload, (_, value) => typeof value === "bigint" ? value.toString() : value);
175913
175911
  const file = join27(dir, `backup-${payload.at.replace(/[:.]/g, "-")}.json`);
175914
- writeFileSync16(file, json);
175915
- writeFileSync16(join27(dir, "latest.json"), json);
175912
+ writeFileSync17(file, json);
175913
+ writeFileSync17(join27(dir, "latest.json"), json);
175916
175914
  const total = chosen.reduce((sum, name) => sum + (tables[name]?.length ?? 0), 0);
175917
175915
  console.log(paint(`\u2713 backup \u2192 ${file}`, colors.green));
175918
175916
  console.log(paint(` ${chosen.length} tables, ${total} rows`, colors.dim));
@@ -175953,15 +175951,15 @@ var BACKUP_FORMAT_VERSION = 1, RESTORE_CHUNK_ROWS = 500, URL_ENV_KEYS, JSON_DATA
175953
175951
  const code = await proc.exited;
175954
175952
  if (code !== 0)
175955
175953
  throw new Error(`Seed failed (exit ${code}).`);
175956
- }, flagValue = (rest, flag) => {
175954
+ }, flagValue2 = (rest, flag) => {
175957
175955
  const idx = rest.indexOf(flag);
175958
175956
  return idx === UNFOUND_INDEX ? undefined : rest[idx + 1];
175959
- }, listValue = (rest, flag) => (flagValue(rest, flag) ?? "").split(",").map((part) => part.trim()).filter((part) => part !== ""), parseOptions = (rest) => ({
175957
+ }, listValue = (rest, flag) => (flagValue2(rest, flag) ?? "").split(",").map((part) => part.trim()).filter((part) => part !== ""), parseOptions = (rest) => ({
175960
175958
  exclude: listValue(rest, "--exclude"),
175961
175959
  only: listValue(rest, "--only"),
175962
- out: flagValue(rest, "--out"),
175960
+ out: flagValue2(rest, "--out"),
175963
175961
  truncate: rest.includes("--truncate"),
175964
- url: resolveUrl(flagValue(rest, "--url")),
175962
+ url: resolveUrl(flagValue2(rest, "--url")),
175965
175963
  yes: rest.includes("--yes") || rest.includes("-y")
175966
175964
  }), positionalArgs = (rest) => rest.filter((arg, idx) => !arg.startsWith("-") && !VALUE_FLAGS.includes(rest[idx - 1] ?? "")), usage = () => {
175967
175965
  console.error("Usage: absolute db <backup|restore|seed> [options]");
@@ -176092,7 +176090,7 @@ var exports_doctor = {};
176092
176090
  __export(exports_doctor, {
176093
176091
  runDoctor: () => runDoctor
176094
176092
  });
176095
- import { existsSync as existsSync32, mkdirSync as mkdirSync14, readFileSync as readFileSync30, writeFileSync as writeFileSync17 } from "fs";
176093
+ import { existsSync as existsSync32, mkdirSync as mkdirSync15, readFileSync as readFileSync30, writeFileSync as writeFileSync18 } from "fs";
176096
176094
  import { createRequire } from "module";
176097
176095
  import { arch as arch4, platform as platform5 } from "os";
176098
176096
  import { join as join28 } from "path";
@@ -176182,7 +176180,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
176182
176180
  const dir = readString(config, field);
176183
176181
  if (dir === undefined || existsSync32(join28(cwd, dir)))
176184
176182
  continue;
176185
- mkdirSync14(join28(cwd, dir, "pages"), { recursive: true });
176183
+ mkdirSync15(join28(cwd, dir, "pages"), { recursive: true });
176186
176184
  fixes.push(`created ${dir}/pages`);
176187
176185
  }
176188
176186
  return fixes;
@@ -176200,7 +176198,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
176200
176198
  const prefix = existing === "" || existing.endsWith(`
176201
176199
  `) ? existing : `${existing}
176202
176200
  `;
176203
- writeFileSync17(envExample, `${prefix}${toAdd.map((entry) => `${entry.key}=`).join(`
176201
+ writeFileSync18(envExample, `${prefix}${toAdd.map((entry) => `${entry.key}=`).join(`
176204
176202
  `)}
176205
176203
  `);
176206
176204
  return `added ${toAdd.length} key(s) to .env.example`;
@@ -176636,7 +176634,7 @@ var init_sourceMetadata = __esm(() => {
176636
176634
 
176637
176635
  // src/islands/pageMetadata.ts
176638
176636
  import { readFileSync as readFileSync31 } from "fs";
176639
- import { dirname as dirname12, resolve as resolve18 } from "path";
176637
+ import { dirname as dirname13, resolve as resolve18 } from "path";
176640
176638
  var pagePatterns, getPageDirs = (config) => [
176641
176639
  { dir: config.angularDirectory, framework: "angular" },
176642
176640
  { dir: config.emberDirectory, framework: "ember" },
@@ -176656,7 +176654,7 @@ var pagePatterns, getPageDirs = (config) => [
176656
176654
  const source = definition.buildReference?.source;
176657
176655
  if (!source)
176658
176656
  continue;
176659
- const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve18(dirname12(buildInfo.resolvedRegistryPath), source);
176657
+ const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve18(dirname13(buildInfo.resolvedRegistryPath), source);
176660
176658
  lookup.set(`${definition.framework}:${definition.component}`, resolve18(resolvedSource));
176661
176659
  }
176662
176660
  return lookup;
@@ -176865,8 +176863,8 @@ var init_islands2 = __esm(() => {
176865
176863
  });
176866
176864
 
176867
176865
  // src/build/externalAssetPlugin.ts
176868
- import { copyFileSync as copyFileSync2, existsSync as existsSync35, mkdirSync as mkdirSync15, statSync as statSync6 } from "fs";
176869
- import { basename as basename6, dirname as dirname13, join as join30, resolve as resolve20 } from "path";
176866
+ import { copyFileSync as copyFileSync2, existsSync as existsSync35, mkdirSync as mkdirSync16, statSync as statSync6 } from "fs";
176867
+ import { basename as basename6, dirname as dirname14, join as join30, resolve as resolve20 } from "path";
176870
176868
  var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
176871
176869
  name: "absolute-external-asset",
176872
176870
  setup(bld) {
@@ -176881,7 +176879,7 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
176881
176879
  return;
176882
176880
  urlPattern.lastIndex = 0;
176883
176881
  let match;
176884
- const sourceDir = dirname13(args.path);
176882
+ const sourceDir = dirname14(args.path);
176885
176883
  while ((match = urlPattern.exec(source)) !== null) {
176886
176884
  const relPath = match[1];
176887
176885
  if (!relPath)
@@ -176894,7 +176892,7 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
176894
176892
  const targetPath = join30(outDir, basename6(assetPath));
176895
176893
  if (existsSync35(targetPath))
176896
176894
  continue;
176897
- mkdirSync15(dirname13(targetPath), { recursive: true });
176895
+ mkdirSync16(dirname14(targetPath), { recursive: true });
176898
176896
  copyFileSync2(assetPath, targetPath);
176899
176897
  }
176900
176898
  return;
@@ -176913,16 +176911,16 @@ var {env: env5 } = globalThis.Bun;
176913
176911
  import {
176914
176912
  cpSync,
176915
176913
  existsSync as existsSync36,
176916
- mkdirSync as mkdirSync16,
176914
+ mkdirSync as mkdirSync17,
176917
176915
  readdirSync as readdirSync7,
176918
176916
  readFileSync as readFileSync33,
176919
176917
  rmSync as rmSync5,
176920
176918
  statSync as statSync7,
176921
176919
  unlinkSync as unlinkSync4,
176922
- writeFileSync as writeFileSync18
176920
+ writeFileSync as writeFileSync19
176923
176921
  } from "fs";
176924
176922
  import { createRequire as createRequire2 } from "module";
176925
- import { basename as basename7, dirname as dirname14, join as join31, relative as relative11, resolve as resolve21 } from "path";
176923
+ import { basename as basename7, dirname as dirname15, join as join31, relative as relative11, resolve as resolve21 } from "path";
176926
176924
  var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
176927
176925
  const resolvedVersion = version2 || "unknown";
176928
176926
  console.log("");
@@ -176969,7 +176967,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176969
176967
  const copied = new Set;
176970
176968
  const normalizedOutdir = resolve21(outdir);
176971
176969
  const copyReference = (filePath, relPath) => {
176972
- const assetSource = resolve21(dirname14(filePath), relPath);
176970
+ const assetSource = resolve21(dirname15(filePath), relPath);
176973
176971
  if (!existsSync36(assetSource) || !statSync7(assetSource).isFile())
176974
176972
  return;
176975
176973
  const assetTarget = resolve21(normalizedOutdir, relPath.replace(/^\.\//, ""));
@@ -176978,7 +176976,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
176978
176976
  if (copied.has(assetTarget))
176979
176977
  return;
176980
176978
  copied.add(assetTarget);
176981
- mkdirSync16(dirname14(assetTarget), { recursive: true });
176979
+ mkdirSync17(dirname15(assetTarget), { recursive: true });
176982
176980
  cpSync(assetSource, assetTarget, { force: true });
176983
176981
  };
176984
176982
  for (const filePath of collectProjectSourceFiles(process.cwd())) {
@@ -177169,7 +177167,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
177169
177167
  }
177170
177168
  return specifiers.sort((a, b) => b.length - a.length);
177171
177169
  }, ensureRelativeModuleSpecifier = (fromFile, toFile) => {
177172
- const rel = relative11(dirname14(fromFile), toFile).replace(/\\/g, "/");
177170
+ const rel = relative11(dirname15(fromFile), toFile).replace(/\\/g, "/");
177173
177171
  return rel.startsWith(".") ? rel : `./${rel}`;
177174
177172
  }, pickExportEntry = (value) => {
177175
177173
  if (typeof value === "string")
@@ -177215,12 +177213,12 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
177215
177213
  ];
177216
177214
  return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
177217
177215
  }, findContainingRuntimePackageDir = (filePath) => {
177218
- let dir = dirname14(filePath);
177219
- while (dir !== dirname14(dir)) {
177216
+ let dir = dirname15(filePath);
177217
+ while (dir !== dirname15(dir)) {
177220
177218
  if (isNodeModulesPath(dir) && existsSync36(join31(dir, "package.json"))) {
177221
177219
  return dir;
177222
177220
  }
177223
- dir = dirname14(dir);
177221
+ dir = dirname15(dir);
177224
177222
  }
177225
177223
  return null;
177226
177224
  }, resolvePackageImportEntryFile = (fromFile, specifier) => {
@@ -177237,7 +177235,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
177237
177235
  }, collectRuntimeRewriteRoots = (distDir) => collectFiles2(distDir).filter((filePath) => isRuntimeJsFile(filePath) && !isNodeModulesPath(filePath)), toTopLevelPackage = (specifier) => specifier.split("/").slice(0, specifier.startsWith("@") ? 2 : 1).join("/"), FRAMEWORK_PACKAGE_NAME = "@absolutejs/absolute", copyChunkReferencedPackages = (distDir, seen) => {
177238
177236
  const distRoot = resolve21(distDir);
177239
177237
  for (const filePath of collectRuntimeRewriteRoots(distDir)) {
177240
- if (resolve21(dirname14(filePath)) === distRoot)
177238
+ if (resolve21(dirname15(filePath)) === distRoot)
177241
177239
  continue;
177242
177240
  const source = readFileSync33(filePath, "utf-8");
177243
177241
  for (const match of source.matchAll(MODULE_SPECIFIER_RE)) {
@@ -177273,7 +177271,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
177273
177271
  const { masked, restore } = maskLiterals(source);
177274
177272
  const rewrittenMasked = masked.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
177275
177273
  if (typeof specifier === "string" && specifier.startsWith(".")) {
177276
- enqueue(resolveRuntimeJsFile(resolve21(dirname14(filePath), specifier)));
177274
+ enqueue(resolveRuntimeJsFile(resolve21(dirname15(filePath), specifier)));
177277
177275
  return match;
177278
177276
  }
177279
177277
  const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
@@ -177289,7 +177287,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
177289
177287
  });
177290
177288
  const rewritten = restore(rewrittenMasked);
177291
177289
  if (rewritten !== source) {
177292
- writeFileSync18(filePath, rewritten);
177290
+ writeFileSync19(filePath, rewritten);
177293
177291
  }
177294
177292
  }
177295
177293
  }, generateEntrypoint = (distDir, serverEntry, prerenderMap, version2, buildConfig) => {
@@ -177890,7 +177888,7 @@ console.log(\`
177890
177888
  if (scope !== "angular" || rest.length === 0)
177891
177889
  continue;
177892
177890
  const specifier = `@angular/${rest.join("/")}`;
177893
- const relPath = relative11(dirname14(outputPath), resolve21(vendorDir, file));
177891
+ const relPath = relative11(dirname15(outputPath), resolve21(vendorDir, file));
177894
177892
  angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
177895
177893
  }
177896
177894
  if (Object.keys(angularServerVendorPaths).length > 0) {
@@ -177924,7 +177922,7 @@ console.log(\`
177924
177922
  const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
177925
177923
  const entrypointPath = join31(resolvedOutdir, "_compile_entrypoint.ts");
177926
177924
  await Bun.write(entrypointPath, entrypointCode);
177927
- mkdirSync16(dirname14(resolvedOutfile), { recursive: true });
177925
+ mkdirSync17(dirname15(resolvedOutfile), { recursive: true });
177928
177926
  const result = await Bun.build({
177929
177927
  compile: { outfile: resolvedOutfile },
177930
177928
  define: { "process.env.NODE_ENV": '"production"' },
@@ -179691,10 +179689,27 @@ var dev = async (serverEntry, configPath2) => {
179691
179689
  };
179692
179690
 
179693
179691
  // src/cli/scripts/eslint.ts
179694
- import { existsSync as existsSync6, readFileSync as readFileSync8, rmSync as rmSync3 } from "fs";
179695
- import { resolve as resolve4 } from "path";
179692
+ import { createHash } from "crypto";
179693
+ import {
179694
+ existsSync as existsSync6,
179695
+ mkdirSync as mkdirSync5,
179696
+ readFileSync as readFileSync8,
179697
+ renameSync,
179698
+ rmSync as rmSync3,
179699
+ writeFileSync as writeFileSync5
179700
+ } from "fs";
179701
+ import { dirname as dirname3, resolve as resolve4 } from "path";
179696
179702
  var DEFAULT_CACHE_LOCATION = ".absolutejs/eslint-cache";
179697
- var getCacheLocation = () => process.env.ABSOLUTE_ESLINT_CACHE?.trim() || DEFAULT_CACHE_LOCATION;
179703
+ var CACHE_CONTRACT_VERSION = "1";
179704
+ var CACHE_FINGERPRINT_SUFFIX = ".fingerprint";
179705
+ var flagValue = (args, flag) => {
179706
+ const assignment = args.find((arg) => arg.startsWith(`${flag}=`));
179707
+ if (assignment)
179708
+ return assignment.slice(flag.length + 1);
179709
+ const index = args.indexOf(flag);
179710
+ return index < 0 ? undefined : args[index + 1];
179711
+ };
179712
+ var getCacheLocation = (args) => flagValue(args, "--cache-location")?.trim() || process.env.ABSOLUTE_ESLINT_CACHE?.trim() || DEFAULT_CACHE_LOCATION;
179698
179713
  var CONFIG_CANDIDATES = [
179699
179714
  "eslint.config.js",
179700
179715
  "eslint.config.mjs",
@@ -179746,8 +179761,7 @@ var hasUserPositional = (args) => {
179746
179761
  }
179747
179762
  return false;
179748
179763
  };
179749
- var findConfigPath = () => {
179750
- const cwd = process.cwd();
179764
+ var findConfigPath = (cwd = process.cwd()) => {
179751
179765
  for (const name of CONFIG_CANDIDATES) {
179752
179766
  const candidate = resolve4(cwd, name);
179753
179767
  if (existsSync6(candidate))
@@ -179755,6 +179769,107 @@ var findConfigPath = () => {
179755
179769
  }
179756
179770
  return null;
179757
179771
  };
179772
+ var fingerprintLocation = (cacheLocation, cwd) => {
179773
+ const absolute = resolve4(cwd, cacheLocation);
179774
+ return /[\\/]$/.test(cacheLocation) ? resolve4(absolute, CACHE_FINGERPRINT_SUFFIX.slice(1)) : `${absolute}${CACHE_FINGERPRINT_SUFFIX}`;
179775
+ };
179776
+ var addFileToFingerprint = (hash, path, label) => {
179777
+ if (!existsSync6(path))
179778
+ return;
179779
+ hash.update(label);
179780
+ hash.update("\x00");
179781
+ hash.update(readFileSync8(path));
179782
+ hash.update("\x00");
179783
+ };
179784
+ var packageNameFor = (specifier) => {
179785
+ if (specifier.startsWith("@"))
179786
+ return specifier.split("/").slice(0, 2).join("/");
179787
+ const [name = specifier] = specifier.split("/");
179788
+ return name;
179789
+ };
179790
+ var configPackageNames = (configPath2) => {
179791
+ if (!configPath2)
179792
+ return [];
179793
+ const source = readFileSync8(configPath2, "utf-8");
179794
+ const names = new Set;
179795
+ for (const match of source.matchAll(/(?:from\s+|import\s*(?:\(\s*)?|require\s*\(\s*)(['"])([^'".][^'"]*)\1/g)) {
179796
+ const [, , specifier] = match;
179797
+ if (specifier)
179798
+ names.add(packageNameFor(specifier));
179799
+ }
179800
+ return [...names];
179801
+ };
179802
+ var manifestDependencyNames = (manifest) => {
179803
+ if (manifest === null || typeof manifest !== "object")
179804
+ return [];
179805
+ return Object.entries(manifest).flatMap(([key, value]) => {
179806
+ if (key !== "dependencies" && key !== "devDependencies")
179807
+ return [];
179808
+ if (value === null || typeof value !== "object" || Array.isArray(value))
179809
+ return [];
179810
+ return Object.keys(value);
179811
+ });
179812
+ };
179813
+ var lintDependencyNames = (cwd, configPath2) => {
179814
+ const manifestPath = resolve4(cwd, "package.json");
179815
+ if (!existsSync6(manifestPath))
179816
+ return configPackageNames(configPath2);
179817
+ try {
179818
+ const manifest = JSON.parse(readFileSync8(manifestPath, "utf-8"));
179819
+ const lintPackages = manifestDependencyNames(manifest).filter((name) => /eslint|typescript/.test(name));
179820
+ return [
179821
+ ...new Set([...lintPackages, ...configPackageNames(configPath2)])
179822
+ ];
179823
+ } catch {
179824
+ return configPackageNames(configPath2);
179825
+ }
179826
+ };
179827
+ var findInstalledManifest = (cwd, dependency) => {
179828
+ let directory = cwd;
179829
+ while (true) {
179830
+ const candidate = resolve4(directory, "node_modules", dependency, "package.json");
179831
+ if (existsSync6(candidate))
179832
+ return candidate;
179833
+ const parent = dirname3(directory);
179834
+ if (parent === directory)
179835
+ return null;
179836
+ directory = parent;
179837
+ }
179838
+ };
179839
+ var createEslintCacheFingerprint = (cwd = process.cwd()) => {
179840
+ const hash = createHash("sha256");
179841
+ hash.update(`absolute-eslint-cache:${CACHE_CONTRACT_VERSION}\x00`);
179842
+ const configPath2 = findConfigPath(cwd);
179843
+ if (configPath2)
179844
+ addFileToFingerprint(hash, configPath2, configPath2);
179845
+ for (const dependency of lintDependencyNames(cwd, configPath2).sort()) {
179846
+ const manifestPath = findInstalledManifest(cwd, dependency);
179847
+ if (manifestPath)
179848
+ addFileToFingerprint(hash, manifestPath, dependency);
179849
+ }
179850
+ return hash.digest("hex");
179851
+ };
179852
+ var writeFingerprint = (path, fingerprint) => {
179853
+ mkdirSync5(dirname3(path), { recursive: true });
179854
+ const temporary = `${path}.${process.pid}.tmp`;
179855
+ writeFileSync5(temporary, `${fingerprint}
179856
+ `);
179857
+ renameSync(temporary, path);
179858
+ };
179859
+ var prepareEslintCache = (options) => {
179860
+ const cwd = options.cwd ?? process.cwd();
179861
+ const cachePath = resolve4(cwd, options.cacheLocation);
179862
+ const metadataPath = fingerprintLocation(options.cacheLocation, cwd);
179863
+ const fingerprint = options.fingerprint ?? createEslintCacheFingerprint(cwd);
179864
+ const prior = existsSync6(metadataPath) ? readFileSync8(metadataPath, "utf-8").trim() : null;
179865
+ if (prior === fingerprint)
179866
+ return false;
179867
+ rmSync3(cachePath, { force: true, recursive: true });
179868
+ if (metadataPath !== cachePath)
179869
+ rmSync3(metadataPath, { force: true, recursive: true });
179870
+ writeFingerprint(metadataPath, fingerprint);
179871
+ return true;
179872
+ };
179758
179873
  var hasKey = (objectLiteralSource, key) => {
179759
179874
  const pattern = new RegExp(`(^|[\\s,{])${key}\\s*:`, "m");
179760
179875
  return pattern.test(objectLiteralSource);
@@ -179887,17 +180002,34 @@ var formatDuration = (ms) => {
179887
180002
  const seconds = Math.round(ms % 60000 / 1000);
179888
180003
  return `${minutes}m ${seconds}s`;
179889
180004
  };
179890
- var handleClearCache = (cacheLocation) => {
180005
+ var handleClearCache = (cacheLocation, cwd = process.cwd()) => {
179891
180006
  try {
179892
- rmSync3(cacheLocation, { force: true });
180007
+ const cachePath = resolve4(cwd, cacheLocation);
180008
+ const metadataPath = fingerprintLocation(cacheLocation, cwd);
180009
+ rmSync3(cachePath, { force: true, recursive: true });
180010
+ rmSync3(metadataPath, { force: true, recursive: true });
179893
180011
  console.log(`\x1B[32m\u2713\x1B[0m Cleared cache: ${cacheLocation}`);
179894
180012
  } catch (err) {
179895
180013
  console.error(`\x1B[31m\u2717\x1B[0m Failed to clear cache at ${cacheLocation}:`, err);
179896
180014
  process.exit(1);
179897
180015
  }
179898
180016
  };
180017
+ var buildEslintCommand = (args, cacheLocation) => {
180018
+ const cacheEnabled = !args.includes("--no-cache");
180019
+ const hasCacheLocation = args.some((arg) => arg === "--cache-location" || arg.startsWith("--cache-location="));
180020
+ const hasCacheStrategy = args.some((arg) => arg === "--cache-strategy" || arg.startsWith("--cache-strategy="));
180021
+ return [
180022
+ "bun",
180023
+ "eslint",
180024
+ ...cacheEnabled ? ["--cache"] : [],
180025
+ ...cacheEnabled && !hasCacheLocation ? ["--cache-location", cacheLocation] : [],
180026
+ ...cacheEnabled && !hasCacheStrategy ? ["--cache-strategy", "content"] : [],
180027
+ ...args,
180028
+ ...hasUserPositional(args) ? [] : ["."]
180029
+ ];
180030
+ };
179899
180031
  var eslint = async (args) => {
179900
- const cacheLocation = getCacheLocation();
180032
+ const cacheLocation = getCacheLocation(args);
179901
180033
  if (args.includes("--clear-cache")) {
179902
180034
  handleClearCache(cacheLocation);
179903
180035
  return;
@@ -179907,18 +180039,13 @@ var eslint = async (args) => {
179907
180039
  process.exit(1);
179908
180040
  }
179909
180041
  checkForMisplacedIgnores();
179910
- const command = [
179911
- "bun",
179912
- "eslint",
179913
- "--cache",
179914
- "--cache-location",
179915
- cacheLocation,
179916
- ...args,
179917
- ...hasUserPositional(args) ? [] : ["."]
179918
- ];
180042
+ const cacheEnabled = !args.includes("--no-cache");
180043
+ if (cacheEnabled)
180044
+ prepareEslintCache({ cacheLocation });
180045
+ const command = buildEslintCommand(args, cacheLocation);
179919
180046
  const dim = "\x1B[2m";
179920
180047
  const reset = "\x1B[0m";
179921
- console.log(`${dim}cache: ${cacheLocation} (subsequent runs only re-lint changed files)${reset}`);
180048
+ console.log(cacheEnabled ? `${dim}cache: ${cacheLocation} (content-aware; lint-tool changes invalidate automatically)${reset}` : `${dim}cache: disabled${reset}`);
179922
180049
  const startedAt = Date.now();
179923
180050
  const proc = Bun.spawn(command, {
179924
180051
  stderr: "inherit",
@@ -180586,11 +180713,11 @@ init_instanceRegistry();
180586
180713
  import {
180587
180714
  appendFileSync,
180588
180715
  existsSync as existsSync9,
180589
- mkdirSync as mkdirSync6,
180716
+ mkdirSync as mkdirSync7,
180590
180717
  readdirSync as readdirSync2,
180591
180718
  readFileSync as readFileSync12,
180592
180719
  unlinkSync as unlinkSync3,
180593
- writeFileSync as writeFileSync5
180720
+ writeFileSync as writeFileSync6
180594
180721
  } from "fs";
180595
180722
  import { createConnection } from "net";
180596
180723
  import { resolve as resolve9 } from "path";
@@ -181155,10 +181282,10 @@ var stripAnsi2 = (value) => value.replace(ANSI_REGEX2, "");
181155
181282
  var sanitizeLogFileName = (value) => value.replace(/[^a-zA-Z0-9._-]/g, "_") || "unknown";
181156
181283
  var createWorkspaceLogSink = (appendLog) => {
181157
181284
  const logDirectory = resolve9(".absolutejs", "workspace", "logs");
181158
- mkdirSync6(logDirectory, { recursive: true });
181285
+ mkdirSync7(logDirectory, { recursive: true });
181159
181286
  readdirSync2(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync3(resolve9(logDirectory, file)));
181160
- writeFileSync5(resolve9(logDirectory, "all.log"), "");
181161
- writeFileSync5(resolve9(logDirectory, "workspace.log"), "");
181287
+ writeFileSync6(resolve9(logDirectory, "all.log"), "");
181288
+ writeFileSync6(resolve9(logDirectory, "workspace.log"), "");
181162
181289
  const initializedSources = new Set(["workspace"]);
181163
181290
  const writeLog = (source, message, level) => {
181164
181291
  const cleanMessage = stripAnsi2(message).trimEnd();
@@ -181170,7 +181297,7 @@ var createWorkspaceLogSink = (appendLog) => {
181170
181297
  `;
181171
181298
  const sourceFile = resolve9(logDirectory, `${sanitizeLogFileName(source)}.log`);
181172
181299
  if (!initializedSources.has(source)) {
181173
- writeFileSync5(sourceFile, "");
181300
+ writeFileSync6(sourceFile, "");
181174
181301
  initializedSources.add(source);
181175
181302
  }
181176
181303
  appendFileSync(sourceFile, line);