@absolutejs/absolute 0.19.0-beta.75 → 0.19.0-beta.77

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/build.js CHANGED
@@ -47,26 +47,23 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
47
47
  var __require = import.meta.require;
48
48
 
49
49
  // src/build/freshReadPlugin.ts
50
+ import { readFileSync } from "fs";
50
51
  var createFreshReadPlugin = (changedFiles) => {
51
52
  const changed = new Set(changedFiles.map((f) => f.replace(/\\/g, "/")));
52
- const escaped = changedFiles.map((f) => f.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
53
- const pattern = escaped.length > 0 ? new RegExp(`(${escaped.join("|")})$`) : /(?!)/;
54
53
  return {
55
54
  name: "fresh-read",
56
55
  setup(build) {
57
- build.onLoad({ filter: pattern }, async (args) => {
58
- console.log(`[fresh-read] onLoad: ${args.path}`);
56
+ build.onLoad({ filter: /\.(tsx?|jsx?)$/ }, (args) => {
59
57
  const normalized = args.path.replace(/\\/g, "/");
60
58
  if (!changed.has(normalized))
61
59
  return;
62
- const contents = await Bun.file(args.path).text();
60
+ const contents = readFileSync(args.path, "utf-8");
63
61
  const ext = args.path.split(".").pop();
64
62
  const loaderMap = {
65
63
  ts: "ts",
66
64
  tsx: "tsx",
67
65
  js: "js",
68
- jsx: "jsx",
69
- css: "css"
66
+ jsx: "jsx"
70
67
  };
71
68
  return {
72
69
  contents,
@@ -76,6 +73,7 @@ var createFreshReadPlugin = (changedFiles) => {
76
73
  }
77
74
  };
78
75
  };
76
+ var init_freshReadPlugin = () => {};
79
77
 
80
78
  // src/constants.ts
81
79
  var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DOM_UPDATE_DELAY_MS = 50, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, HMR_UPDATE_TIMEOUT_MS = 2000, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000;
@@ -573,14 +571,14 @@ var scanCssEntryPoints = async (dir, ignore) => {
573
571
  var init_scanCssEntryPoints = () => {};
574
572
 
575
573
  // src/cli/scripts/telemetry.ts
576
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
574
+ import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
577
575
  import { homedir } from "os";
578
576
  import { join as join2 } from "path";
579
577
  var configDir, configPath, getTelemetryConfig = () => {
580
578
  try {
581
579
  if (!existsSync4(configPath))
582
580
  return null;
583
- const raw = readFileSync(configPath, "utf-8");
581
+ const raw = readFileSync2(configPath, "utf-8");
584
582
  const config = JSON.parse(raw);
585
583
  return config;
586
584
  } catch {
@@ -593,14 +591,14 @@ var init_telemetry = __esm(() => {
593
591
  });
594
592
 
595
593
  // src/cli/telemetryEvent.ts
596
- import { existsSync as existsSync5, readFileSync as readFileSync2 } from "fs";
594
+ import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
597
595
  import { arch, platform } from "os";
598
596
  import { dirname, join as join3, parse } from "path";
599
597
  var checkCandidate = (candidate) => {
600
598
  if (!existsSync5(candidate)) {
601
599
  return null;
602
600
  }
603
- const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
601
+ const pkg = JSON.parse(readFileSync3(candidate, "utf-8"));
604
602
  if (pkg.name === "@absolutejs/absolute") {
605
603
  const ver = pkg.version;
606
604
  return ver;
@@ -897,7 +895,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
897
895
  };
898
896
 
899
897
  // src/build/angularLinkerPlugin.ts
900
- import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
898
+ import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
901
899
  import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve4 } from "path";
902
900
  import { createHash } from "crypto";
903
901
  var CACHE_DIR, angularLinkerPlugin;
@@ -924,7 +922,7 @@ var init_angularLinkerPlugin = __esm(() => {
924
922
  const cachePath = join4(CACHE_DIR, `${hash}.js`);
925
923
  if (existsSync7(cachePath)) {
926
924
  return {
927
- contents: readFileSync3(cachePath, "utf-8"),
925
+ contents: readFileSync4(cachePath, "utf-8"),
928
926
  loader: "js"
929
927
  };
930
928
  }
@@ -940,7 +938,7 @@ var init_angularLinkerPlugin = __esm(() => {
940
938
  fileSystem: {
941
939
  dirname: dirname2,
942
940
  exists: existsSync7,
943
- readFile: readFileSync3,
941
+ readFile: readFileSync4,
944
942
  relative: relative2,
945
943
  resolve: resolve4
946
944
  },
@@ -170482,12 +170480,12 @@ __export(exports_compileAngular, {
170482
170480
  compileAngularFile: () => compileAngularFile,
170483
170481
  compileAngular: () => compileAngular
170484
170482
  });
170485
- import { existsSync as existsSync10, readFileSync as readFileSync4, promises as fs } from "fs";
170483
+ import { existsSync as existsSync10, readFileSync as readFileSync5, promises as fs } from "fs";
170486
170484
  import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve9, relative as relative6 } from "path";
170487
170485
  import { createHash as createHash2 } from "crypto";
170488
170486
  var import_typescript, computeConfigHash = () => {
170489
170487
  try {
170490
- const content = readFileSync4("./tsconfig.json", "utf-8");
170488
+ const content = readFileSync5("./tsconfig.json", "utf-8");
170491
170489
  return createHash2("md5").update(content).digest("hex");
170492
170490
  } catch {
170493
170491
  return "";
@@ -171041,11 +171039,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
171041
171039
  console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
171042
171040
  return;
171043
171041
  }
171044
- const { readFileSync: readFileSync5, writeFileSync: writeFileSync3, readdirSync } = await import("fs");
171042
+ const { readFileSync: readFileSync6, writeFileSync: writeFileSync3, readdirSync } = await import("fs");
171045
171043
  const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
171046
171044
  for (const file3 of files) {
171047
171045
  const filePath = join11(vendorDir, file3);
171048
- const content = readFileSync5(filePath, "utf-8");
171046
+ const content = readFileSync6(filePath, "utf-8");
171049
171047
  if (!content.includes("__VUE_HMR_RUNTIME__"))
171050
171048
  continue;
171051
171049
  const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
@@ -171167,7 +171165,7 @@ import {
171167
171165
  copyFileSync,
171168
171166
  cpSync,
171169
171167
  mkdirSync as mkdirSync8,
171170
- readFileSync as readFileSync5,
171168
+ readFileSync as readFileSync6,
171171
171169
  rmSync,
171172
171170
  writeFileSync as writeFileSync3
171173
171171
  } from "fs";
@@ -171243,6 +171241,9 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171243
171241
  const isIncremental = incrementalFiles && incrementalFiles.length > 0;
171244
171242
  const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
171245
171243
  const freshReadPlugins = isIncremental ? [createFreshReadPlugin(incrementalFiles)] : [];
171244
+ if (isIncremental) {
171245
+ console.log(`[build] incremental with ${incrementalFiles.length} changed files, fresh-read plugin active`);
171246
+ }
171246
171247
  const throwOnError = options?.throwOnError === true;
171247
171248
  const hmr = options?.injectHMR === true;
171248
171249
  const buildPath = validateSafePath(buildDirectory, projectRoot);
@@ -171670,7 +171671,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171670
171671
  const injectHMRIntoHTMLFile = (filePath, framework) => {
171671
171672
  if (!hmrClientBundle)
171672
171673
  return;
171673
- let html = readFileSync5(filePath, "utf-8");
171674
+ let html = readFileSync6(filePath, "utf-8");
171674
171675
  if (html.includes("data-hmr-client"))
171675
171676
  return;
171676
171677
  const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
@@ -171742,7 +171743,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171742
171743
  const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
171743
171744
  const pagesRel = relative7(process.cwd(), resolve10(reactPagesPath)).replace(/\\/g, "/");
171744
171745
  for (const file3 of indexFiles) {
171745
- let content = readFileSync5(join13(reactIndexesPath, file3), "utf-8");
171746
+ let content = readFileSync6(join13(reactIndexesPath, file3), "utf-8");
171746
171747
  content = content.replace(/from\s*['"]\.\.\/pages\/([^'"]+)['"]/g, `from '/@src/${pagesRel}/$1'`);
171747
171748
  writeFileSync3(join13(devIndexDir, file3), content);
171748
171749
  }
@@ -171768,6 +171769,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171768
171769
  return manifest;
171769
171770
  };
171770
171771
  var init_build = __esm(() => {
171772
+ init_freshReadPlugin();
171771
171773
  init_generateManifest();
171772
171774
  init_generateReactIndexes();
171773
171775
  init_htmlScriptHMRPlugin();
@@ -171793,7 +171795,7 @@ var init_build = __esm(() => {
171793
171795
  });
171794
171796
 
171795
171797
  // src/dev/dependencyGraph.ts
171796
- import { existsSync as existsSync11, readFileSync as readFileSync6 } from "fs";
171798
+ import { existsSync as existsSync11, readFileSync as readFileSync7 } from "fs";
171797
171799
  var {Glob: Glob6 } = globalThis.Bun;
171798
171800
  import { resolve as resolve11 } from "path";
171799
171801
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
@@ -171960,15 +171962,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
171960
171962
  const lowerPath = filePath.toLowerCase();
171961
171963
  const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
171962
171964
  if (loader === "html") {
171963
- const content = readFileSync6(filePath, "utf-8");
171965
+ const content = readFileSync7(filePath, "utf-8");
171964
171966
  return extractHtmlDependencies(filePath, content);
171965
171967
  }
171966
171968
  if (loader === "tsx" || loader === "js") {
171967
- const content = readFileSync6(filePath, "utf-8");
171969
+ const content = readFileSync7(filePath, "utf-8");
171968
171970
  return extractJsDependencies(filePath, content, loader);
171969
171971
  }
171970
171972
  if (isSvelteOrVue) {
171971
- const content = readFileSync6(filePath, "utf-8");
171973
+ const content = readFileSync7(filePath, "utf-8");
171972
171974
  return extractSvelteVueDependencies(filePath, content);
171973
171975
  }
171974
171976
  return [];
@@ -172403,10 +172405,10 @@ var init_assetStore = __esm(() => {
172403
172405
  });
172404
172406
 
172405
172407
  // src/dev/fileHashTracker.ts
172406
- import { readFileSync as readFileSync7 } from "fs";
172408
+ import { readFileSync as readFileSync8 } from "fs";
172407
172409
  var computeFileHash = (filePath) => {
172408
172410
  try {
172409
- const fileContent = readFileSync7(filePath);
172411
+ const fileContent = readFileSync8(filePath);
172410
172412
  return Number(Bun.hash(fileContent));
172411
172413
  } catch {
172412
172414
  return UNFOUND_INDEX;
@@ -172797,7 +172799,7 @@ var init_registerClientScript = __esm(() => {
172797
172799
  });
172798
172800
 
172799
172801
  // src/angular/injectorPatch.ts
172800
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
172802
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
172801
172803
  import { dirname as dirname6, join as join15 } from "path";
172802
172804
  var applyInjectorPatch = (chunkPath, content) => {
172803
172805
  if (content.includes('Symbol.for("angular.currentInjector")')) {
@@ -172837,7 +172839,7 @@ var applyInjectorPatch = (chunkPath, content) => {
172837
172839
  try {
172838
172840
  const coreDir = dirname6(__require.resolve("@angular/core/package.json"));
172839
172841
  const chunkPath = join15(coreDir, "fesm2022", "_not_found-chunk.mjs");
172840
- const content = readFileSync8(chunkPath, "utf-8");
172842
+ const content = readFileSync9(chunkPath, "utf-8");
172841
172843
  applyInjectorPatch(chunkPath, content);
172842
172844
  } catch {}
172843
172845
  };
@@ -202397,7 +202399,7 @@ __export(exports_moduleServer, {
202397
202399
  createModuleServer: () => createModuleServer,
202398
202400
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
202399
202401
  });
202400
- import { existsSync as existsSync13, readFileSync as readFileSync9, statSync } from "fs";
202402
+ import { existsSync as existsSync13, readFileSync as readFileSync10, statSync } from "fs";
202401
202403
  import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve17, relative as relative8 } from "path";
202402
202404
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
202403
202405
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
@@ -202552,7 +202554,7 @@ ${stubs}
202552
202554
  `) + `
202553
202555
  ` + code;
202554
202556
  }, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
202555
- const raw = readFileSync9(filePath, "utf-8");
202557
+ const raw = readFileSync10(filePath, "utf-8");
202556
202558
  const valueExports = tsxTranspiler.scan(raw).exports;
202557
202559
  let transpiled = reactTranspiler.transformSync(raw);
202558
202560
  transpiled = preserveTypeExports(raw, transpiled, valueExports);
@@ -202567,7 +202569,7 @@ ${stubs}
202567
202569
  transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
202568
202570
  return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
202569
202571
  }, transformPlainFile = (filePath, projectRoot, rewriter) => {
202570
- const raw = readFileSync9(filePath, "utf-8");
202572
+ const raw = readFileSync10(filePath, "utf-8");
202571
202573
  const ext = extname3(filePath);
202572
202574
  const isTS = ext === ".ts" || ext === ".tsx";
202573
202575
  const isTSX = ext === ".tsx" || ext === ".jsx";
@@ -202606,7 +202608,7 @@ ${stubs}
202606
202608
  }
202607
202609
  }
202608
202610
  }, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
202609
- const raw = readFileSync9(filePath, "utf-8");
202611
+ const raw = readFileSync10(filePath, "utf-8");
202610
202612
  if (!svelteCompiler) {
202611
202613
  svelteCompiler = await import("svelte/compiler");
202612
202614
  }
@@ -202642,7 +202644,7 @@ ${code}`;
202642
202644
  }
202643
202645
  return rewriteImports2(code, filePath, projectRoot, rewriter);
202644
202646
  }, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
202645
- const raw = readFileSync9(filePath, "utf-8");
202647
+ const raw = readFileSync10(filePath, "utf-8");
202646
202648
  if (!vueCompiler) {
202647
202649
  vueCompiler = await import("@vue/compiler-sfc");
202648
202650
  }
@@ -202725,7 +202727,7 @@ ${code}`;
202725
202727
  "Content-Type": "application/javascript"
202726
202728
  }
202727
202729
  }), handleCssRequest = (filePath) => {
202728
- const raw = readFileSync9(filePath, "utf-8");
202730
+ const raw = readFileSync10(filePath, "utf-8");
202729
202731
  const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
202730
202732
  return [
202731
202733
  `const style = document.createElement('style');`,
@@ -204557,13 +204559,13 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
204557
204559
  });
204558
204560
  await rm9(tmpDir, { force: true, recursive: true });
204559
204561
  if (result.success) {
204560
- const { readdirSync, readFileSync: readFileSync10, writeFileSync: writeFileSync5 } = await import("fs");
204562
+ const { readdirSync, readFileSync: readFileSync11, writeFileSync: writeFileSync5 } = await import("fs");
204561
204563
  const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
204562
204564
  const reactPaths = computeVendorPaths2();
204563
204565
  const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
204564
204566
  for (const file3 of files) {
204565
204567
  const filePath = join16(vendorDir, file3);
204566
- let content = readFileSync10(filePath, "utf-8");
204568
+ let content = readFileSync11(filePath, "utf-8");
204567
204569
  let changed = false;
204568
204570
  for (const [specifier, webPath] of Object.entries(reactPaths)) {
204569
204571
  const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -204900,5 +204902,5 @@ export {
204900
204902
  build
204901
204903
  };
204902
204904
 
204903
- //# debugId=03AC8745CF5CE5A764756E2164756E21
204905
+ //# debugId=E8E82C0333FF86BF64756E2164756E21
204904
204906
  //# sourceMappingURL=build.js.map