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

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";
@@ -171670,7 +171668,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171670
171668
  const injectHMRIntoHTMLFile = (filePath, framework) => {
171671
171669
  if (!hmrClientBundle)
171672
171670
  return;
171673
- let html = readFileSync5(filePath, "utf-8");
171671
+ let html = readFileSync6(filePath, "utf-8");
171674
171672
  if (html.includes("data-hmr-client"))
171675
171673
  return;
171676
171674
  const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
@@ -171742,7 +171740,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171742
171740
  const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
171743
171741
  const pagesRel = relative7(process.cwd(), resolve10(reactPagesPath)).replace(/\\/g, "/");
171744
171742
  for (const file3 of indexFiles) {
171745
- let content = readFileSync5(join13(reactIndexesPath, file3), "utf-8");
171743
+ let content = readFileSync6(join13(reactIndexesPath, file3), "utf-8");
171746
171744
  content = content.replace(/from\s*['"]\.\.\/pages\/([^'"]+)['"]/g, `from '/@src/${pagesRel}/$1'`);
171747
171745
  writeFileSync3(join13(devIndexDir, file3), content);
171748
171746
  }
@@ -171768,6 +171766,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171768
171766
  return manifest;
171769
171767
  };
171770
171768
  var init_build = __esm(() => {
171769
+ init_freshReadPlugin();
171771
171770
  init_generateManifest();
171772
171771
  init_generateReactIndexes();
171773
171772
  init_htmlScriptHMRPlugin();
@@ -171793,7 +171792,7 @@ var init_build = __esm(() => {
171793
171792
  });
171794
171793
 
171795
171794
  // src/dev/dependencyGraph.ts
171796
- import { existsSync as existsSync11, readFileSync as readFileSync6 } from "fs";
171795
+ import { existsSync as existsSync11, readFileSync as readFileSync7 } from "fs";
171797
171796
  var {Glob: Glob6 } = globalThis.Bun;
171798
171797
  import { resolve as resolve11 } from "path";
171799
171798
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
@@ -171960,15 +171959,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
171960
171959
  const lowerPath = filePath.toLowerCase();
171961
171960
  const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
171962
171961
  if (loader === "html") {
171963
- const content = readFileSync6(filePath, "utf-8");
171962
+ const content = readFileSync7(filePath, "utf-8");
171964
171963
  return extractHtmlDependencies(filePath, content);
171965
171964
  }
171966
171965
  if (loader === "tsx" || loader === "js") {
171967
- const content = readFileSync6(filePath, "utf-8");
171966
+ const content = readFileSync7(filePath, "utf-8");
171968
171967
  return extractJsDependencies(filePath, content, loader);
171969
171968
  }
171970
171969
  if (isSvelteOrVue) {
171971
- const content = readFileSync6(filePath, "utf-8");
171970
+ const content = readFileSync7(filePath, "utf-8");
171972
171971
  return extractSvelteVueDependencies(filePath, content);
171973
171972
  }
171974
171973
  return [];
@@ -172403,10 +172402,10 @@ var init_assetStore = __esm(() => {
172403
172402
  });
172404
172403
 
172405
172404
  // src/dev/fileHashTracker.ts
172406
- import { readFileSync as readFileSync7 } from "fs";
172405
+ import { readFileSync as readFileSync8 } from "fs";
172407
172406
  var computeFileHash = (filePath) => {
172408
172407
  try {
172409
- const fileContent = readFileSync7(filePath);
172408
+ const fileContent = readFileSync8(filePath);
172410
172409
  return Number(Bun.hash(fileContent));
172411
172410
  } catch {
172412
172411
  return UNFOUND_INDEX;
@@ -172797,7 +172796,7 @@ var init_registerClientScript = __esm(() => {
172797
172796
  });
172798
172797
 
172799
172798
  // src/angular/injectorPatch.ts
172800
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
172799
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
172801
172800
  import { dirname as dirname6, join as join15 } from "path";
172802
172801
  var applyInjectorPatch = (chunkPath, content) => {
172803
172802
  if (content.includes('Symbol.for("angular.currentInjector")')) {
@@ -172837,7 +172836,7 @@ var applyInjectorPatch = (chunkPath, content) => {
172837
172836
  try {
172838
172837
  const coreDir = dirname6(__require.resolve("@angular/core/package.json"));
172839
172838
  const chunkPath = join15(coreDir, "fesm2022", "_not_found-chunk.mjs");
172840
- const content = readFileSync8(chunkPath, "utf-8");
172839
+ const content = readFileSync9(chunkPath, "utf-8");
172841
172840
  applyInjectorPatch(chunkPath, content);
172842
172841
  } catch {}
172843
172842
  };
@@ -202397,7 +202396,7 @@ __export(exports_moduleServer, {
202397
202396
  createModuleServer: () => createModuleServer,
202398
202397
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
202399
202398
  });
202400
- import { existsSync as existsSync13, readFileSync as readFileSync9, statSync } from "fs";
202399
+ import { existsSync as existsSync13, readFileSync as readFileSync10, statSync } from "fs";
202401
202400
  import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve17, relative as relative8 } from "path";
202402
202401
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
202403
202402
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
@@ -202552,7 +202551,7 @@ ${stubs}
202552
202551
  `) + `
202553
202552
  ` + code;
202554
202553
  }, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
202555
- const raw = readFileSync9(filePath, "utf-8");
202554
+ const raw = readFileSync10(filePath, "utf-8");
202556
202555
  const valueExports = tsxTranspiler.scan(raw).exports;
202557
202556
  let transpiled = reactTranspiler.transformSync(raw);
202558
202557
  transpiled = preserveTypeExports(raw, transpiled, valueExports);
@@ -202567,7 +202566,7 @@ ${stubs}
202567
202566
  transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
202568
202567
  return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
202569
202568
  }, transformPlainFile = (filePath, projectRoot, rewriter) => {
202570
- const raw = readFileSync9(filePath, "utf-8");
202569
+ const raw = readFileSync10(filePath, "utf-8");
202571
202570
  const ext = extname3(filePath);
202572
202571
  const isTS = ext === ".ts" || ext === ".tsx";
202573
202572
  const isTSX = ext === ".tsx" || ext === ".jsx";
@@ -202606,7 +202605,7 @@ ${stubs}
202606
202605
  }
202607
202606
  }
202608
202607
  }, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
202609
- const raw = readFileSync9(filePath, "utf-8");
202608
+ const raw = readFileSync10(filePath, "utf-8");
202610
202609
  if (!svelteCompiler) {
202611
202610
  svelteCompiler = await import("svelte/compiler");
202612
202611
  }
@@ -202642,7 +202641,7 @@ ${code}`;
202642
202641
  }
202643
202642
  return rewriteImports2(code, filePath, projectRoot, rewriter);
202644
202643
  }, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
202645
- const raw = readFileSync9(filePath, "utf-8");
202644
+ const raw = readFileSync10(filePath, "utf-8");
202646
202645
  if (!vueCompiler) {
202647
202646
  vueCompiler = await import("@vue/compiler-sfc");
202648
202647
  }
@@ -202725,7 +202724,7 @@ ${code}`;
202725
202724
  "Content-Type": "application/javascript"
202726
202725
  }
202727
202726
  }), handleCssRequest = (filePath) => {
202728
- const raw = readFileSync9(filePath, "utf-8");
202727
+ const raw = readFileSync10(filePath, "utf-8");
202729
202728
  const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
202730
202729
  return [
202731
202730
  `const style = document.createElement('style');`,
@@ -204557,13 +204556,13 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
204557
204556
  });
204558
204557
  await rm9(tmpDir, { force: true, recursive: true });
204559
204558
  if (result.success) {
204560
- const { readdirSync, readFileSync: readFileSync10, writeFileSync: writeFileSync5 } = await import("fs");
204559
+ const { readdirSync, readFileSync: readFileSync11, writeFileSync: writeFileSync5 } = await import("fs");
204561
204560
  const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
204562
204561
  const reactPaths = computeVendorPaths2();
204563
204562
  const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
204564
204563
  for (const file3 of files) {
204565
204564
  const filePath = join16(vendorDir, file3);
204566
- let content = readFileSync10(filePath, "utf-8");
204565
+ let content = readFileSync11(filePath, "utf-8");
204567
204566
  let changed = false;
204568
204567
  for (const [specifier, webPath] of Object.entries(reactPaths)) {
204569
204568
  const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -204900,5 +204899,5 @@ export {
204900
204899
  build
204901
204900
  };
204902
204901
 
204903
- //# debugId=03AC8745CF5CE5A764756E2164756E21
204902
+ //# debugId=CF9E613AA58916E664756E2164756E21
204904
204903
  //# sourceMappingURL=build.js.map