@absolutejs/absolute 0.19.0-beta.74 → 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,25 +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) => {
56
+ build.onLoad({ filter: /\.(tsx?|jsx?)$/ }, (args) => {
58
57
  const normalized = args.path.replace(/\\/g, "/");
59
58
  if (!changed.has(normalized))
60
59
  return;
61
- const contents = await Bun.file(args.path).text();
60
+ const contents = readFileSync(args.path, "utf-8");
62
61
  const ext = args.path.split(".").pop();
63
62
  const loaderMap = {
64
63
  ts: "ts",
65
64
  tsx: "tsx",
66
65
  js: "js",
67
- jsx: "jsx",
68
- css: "css"
66
+ jsx: "jsx"
69
67
  };
70
68
  return {
71
69
  contents,
@@ -75,6 +73,7 @@ var createFreshReadPlugin = (changedFiles) => {
75
73
  }
76
74
  };
77
75
  };
76
+ var init_freshReadPlugin = () => {};
78
77
 
79
78
  // src/constants.ts
80
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;
@@ -572,14 +571,14 @@ var scanCssEntryPoints = async (dir, ignore) => {
572
571
  var init_scanCssEntryPoints = () => {};
573
572
 
574
573
  // src/cli/scripts/telemetry.ts
575
- 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";
576
575
  import { homedir } from "os";
577
576
  import { join as join2 } from "path";
578
577
  var configDir, configPath, getTelemetryConfig = () => {
579
578
  try {
580
579
  if (!existsSync4(configPath))
581
580
  return null;
582
- const raw = readFileSync(configPath, "utf-8");
581
+ const raw = readFileSync2(configPath, "utf-8");
583
582
  const config = JSON.parse(raw);
584
583
  return config;
585
584
  } catch {
@@ -592,14 +591,14 @@ var init_telemetry = __esm(() => {
592
591
  });
593
592
 
594
593
  // src/cli/telemetryEvent.ts
595
- import { existsSync as existsSync5, readFileSync as readFileSync2 } from "fs";
594
+ import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
596
595
  import { arch, platform } from "os";
597
596
  import { dirname, join as join3, parse } from "path";
598
597
  var checkCandidate = (candidate) => {
599
598
  if (!existsSync5(candidate)) {
600
599
  return null;
601
600
  }
602
- const pkg = JSON.parse(readFileSync2(candidate, "utf-8"));
601
+ const pkg = JSON.parse(readFileSync3(candidate, "utf-8"));
603
602
  if (pkg.name === "@absolutejs/absolute") {
604
603
  const ver = pkg.version;
605
604
  return ver;
@@ -896,7 +895,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
896
895
  };
897
896
 
898
897
  // src/build/angularLinkerPlugin.ts
899
- 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";
900
899
  import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve4 } from "path";
901
900
  import { createHash } from "crypto";
902
901
  var CACHE_DIR, angularLinkerPlugin;
@@ -923,7 +922,7 @@ var init_angularLinkerPlugin = __esm(() => {
923
922
  const cachePath = join4(CACHE_DIR, `${hash}.js`);
924
923
  if (existsSync7(cachePath)) {
925
924
  return {
926
- contents: readFileSync3(cachePath, "utf-8"),
925
+ contents: readFileSync4(cachePath, "utf-8"),
927
926
  loader: "js"
928
927
  };
929
928
  }
@@ -939,7 +938,7 @@ var init_angularLinkerPlugin = __esm(() => {
939
938
  fileSystem: {
940
939
  dirname: dirname2,
941
940
  exists: existsSync7,
942
- readFile: readFileSync3,
941
+ readFile: readFileSync4,
943
942
  relative: relative2,
944
943
  resolve: resolve4
945
944
  },
@@ -170481,12 +170480,12 @@ __export(exports_compileAngular, {
170481
170480
  compileAngularFile: () => compileAngularFile,
170482
170481
  compileAngular: () => compileAngular
170483
170482
  });
170484
- 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";
170485
170484
  import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve9, relative as relative6 } from "path";
170486
170485
  import { createHash as createHash2 } from "crypto";
170487
170486
  var import_typescript, computeConfigHash = () => {
170488
170487
  try {
170489
- const content = readFileSync4("./tsconfig.json", "utf-8");
170488
+ const content = readFileSync5("./tsconfig.json", "utf-8");
170490
170489
  return createHash2("md5").update(content).digest("hex");
170491
170490
  } catch {
170492
170491
  return "";
@@ -171040,11 +171039,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
171040
171039
  console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
171041
171040
  return;
171042
171041
  }
171043
- const { readFileSync: readFileSync5, writeFileSync: writeFileSync3, readdirSync } = await import("fs");
171042
+ const { readFileSync: readFileSync6, writeFileSync: writeFileSync3, readdirSync } = await import("fs");
171044
171043
  const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
171045
171044
  for (const file3 of files) {
171046
171045
  const filePath = join11(vendorDir, file3);
171047
- const content = readFileSync5(filePath, "utf-8");
171046
+ const content = readFileSync6(filePath, "utf-8");
171048
171047
  if (!content.includes("__VUE_HMR_RUNTIME__"))
171049
171048
  continue;
171050
171049
  const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
@@ -171166,7 +171165,7 @@ import {
171166
171165
  copyFileSync,
171167
171166
  cpSync,
171168
171167
  mkdirSync as mkdirSync8,
171169
- readFileSync as readFileSync5,
171168
+ readFileSync as readFileSync6,
171170
171169
  rmSync,
171171
171170
  writeFileSync as writeFileSync3
171172
171171
  } from "fs";
@@ -171669,7 +171668,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171669
171668
  const injectHMRIntoHTMLFile = (filePath, framework) => {
171670
171669
  if (!hmrClientBundle)
171671
171670
  return;
171672
- let html = readFileSync5(filePath, "utf-8");
171671
+ let html = readFileSync6(filePath, "utf-8");
171673
171672
  if (html.includes("data-hmr-client"))
171674
171673
  return;
171675
171674
  const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
@@ -171741,7 +171740,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171741
171740
  const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
171742
171741
  const pagesRel = relative7(process.cwd(), resolve10(reactPagesPath)).replace(/\\/g, "/");
171743
171742
  for (const file3 of indexFiles) {
171744
- let content = readFileSync5(join13(reactIndexesPath, file3), "utf-8");
171743
+ let content = readFileSync6(join13(reactIndexesPath, file3), "utf-8");
171745
171744
  content = content.replace(/from\s*['"]\.\.\/pages\/([^'"]+)['"]/g, `from '/@src/${pagesRel}/$1'`);
171746
171745
  writeFileSync3(join13(devIndexDir, file3), content);
171747
171746
  }
@@ -171767,6 +171766,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171767
171766
  return manifest;
171768
171767
  };
171769
171768
  var init_build = __esm(() => {
171769
+ init_freshReadPlugin();
171770
171770
  init_generateManifest();
171771
171771
  init_generateReactIndexes();
171772
171772
  init_htmlScriptHMRPlugin();
@@ -171792,7 +171792,7 @@ var init_build = __esm(() => {
171792
171792
  });
171793
171793
 
171794
171794
  // src/dev/dependencyGraph.ts
171795
- import { existsSync as existsSync11, readFileSync as readFileSync6 } from "fs";
171795
+ import { existsSync as existsSync11, readFileSync as readFileSync7 } from "fs";
171796
171796
  var {Glob: Glob6 } = globalThis.Bun;
171797
171797
  import { resolve as resolve11 } from "path";
171798
171798
  var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
@@ -171959,15 +171959,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
171959
171959
  const lowerPath = filePath.toLowerCase();
171960
171960
  const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
171961
171961
  if (loader === "html") {
171962
- const content = readFileSync6(filePath, "utf-8");
171962
+ const content = readFileSync7(filePath, "utf-8");
171963
171963
  return extractHtmlDependencies(filePath, content);
171964
171964
  }
171965
171965
  if (loader === "tsx" || loader === "js") {
171966
- const content = readFileSync6(filePath, "utf-8");
171966
+ const content = readFileSync7(filePath, "utf-8");
171967
171967
  return extractJsDependencies(filePath, content, loader);
171968
171968
  }
171969
171969
  if (isSvelteOrVue) {
171970
- const content = readFileSync6(filePath, "utf-8");
171970
+ const content = readFileSync7(filePath, "utf-8");
171971
171971
  return extractSvelteVueDependencies(filePath, content);
171972
171972
  }
171973
171973
  return [];
@@ -172402,10 +172402,10 @@ var init_assetStore = __esm(() => {
172402
172402
  });
172403
172403
 
172404
172404
  // src/dev/fileHashTracker.ts
172405
- import { readFileSync as readFileSync7 } from "fs";
172405
+ import { readFileSync as readFileSync8 } from "fs";
172406
172406
  var computeFileHash = (filePath) => {
172407
172407
  try {
172408
- const fileContent = readFileSync7(filePath);
172408
+ const fileContent = readFileSync8(filePath);
172409
172409
  return Number(Bun.hash(fileContent));
172410
172410
  } catch {
172411
172411
  return UNFOUND_INDEX;
@@ -172796,7 +172796,7 @@ var init_registerClientScript = __esm(() => {
172796
172796
  });
172797
172797
 
172798
172798
  // src/angular/injectorPatch.ts
172799
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
172799
+ import { readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
172800
172800
  import { dirname as dirname6, join as join15 } from "path";
172801
172801
  var applyInjectorPatch = (chunkPath, content) => {
172802
172802
  if (content.includes('Symbol.for("angular.currentInjector")')) {
@@ -172836,7 +172836,7 @@ var applyInjectorPatch = (chunkPath, content) => {
172836
172836
  try {
172837
172837
  const coreDir = dirname6(__require.resolve("@angular/core/package.json"));
172838
172838
  const chunkPath = join15(coreDir, "fesm2022", "_not_found-chunk.mjs");
172839
- const content = readFileSync8(chunkPath, "utf-8");
172839
+ const content = readFileSync9(chunkPath, "utf-8");
172840
172840
  applyInjectorPatch(chunkPath, content);
172841
172841
  } catch {}
172842
172842
  };
@@ -202396,7 +202396,7 @@ __export(exports_moduleServer, {
202396
202396
  createModuleServer: () => createModuleServer,
202397
202397
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
202398
202398
  });
202399
- import { existsSync as existsSync13, readFileSync as readFileSync9, statSync } from "fs";
202399
+ import { existsSync as existsSync13, readFileSync as readFileSync10, statSync } from "fs";
202400
202400
  import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve17, relative as relative8 } from "path";
202401
202401
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
202402
202402
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
@@ -202551,7 +202551,7 @@ ${stubs}
202551
202551
  `) + `
202552
202552
  ` + code;
202553
202553
  }, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
202554
- const raw = readFileSync9(filePath, "utf-8");
202554
+ const raw = readFileSync10(filePath, "utf-8");
202555
202555
  const valueExports = tsxTranspiler.scan(raw).exports;
202556
202556
  let transpiled = reactTranspiler.transformSync(raw);
202557
202557
  transpiled = preserveTypeExports(raw, transpiled, valueExports);
@@ -202566,7 +202566,7 @@ ${stubs}
202566
202566
  transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
202567
202567
  return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
202568
202568
  }, transformPlainFile = (filePath, projectRoot, rewriter) => {
202569
- const raw = readFileSync9(filePath, "utf-8");
202569
+ const raw = readFileSync10(filePath, "utf-8");
202570
202570
  const ext = extname3(filePath);
202571
202571
  const isTS = ext === ".ts" || ext === ".tsx";
202572
202572
  const isTSX = ext === ".tsx" || ext === ".jsx";
@@ -202605,7 +202605,7 @@ ${stubs}
202605
202605
  }
202606
202606
  }
202607
202607
  }, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
202608
- const raw = readFileSync9(filePath, "utf-8");
202608
+ const raw = readFileSync10(filePath, "utf-8");
202609
202609
  if (!svelteCompiler) {
202610
202610
  svelteCompiler = await import("svelte/compiler");
202611
202611
  }
@@ -202641,7 +202641,7 @@ ${code}`;
202641
202641
  }
202642
202642
  return rewriteImports2(code, filePath, projectRoot, rewriter);
202643
202643
  }, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
202644
- const raw = readFileSync9(filePath, "utf-8");
202644
+ const raw = readFileSync10(filePath, "utf-8");
202645
202645
  if (!vueCompiler) {
202646
202646
  vueCompiler = await import("@vue/compiler-sfc");
202647
202647
  }
@@ -202724,7 +202724,7 @@ ${code}`;
202724
202724
  "Content-Type": "application/javascript"
202725
202725
  }
202726
202726
  }), handleCssRequest = (filePath) => {
202727
- const raw = readFileSync9(filePath, "utf-8");
202727
+ const raw = readFileSync10(filePath, "utf-8");
202728
202728
  const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
202729
202729
  return [
202730
202730
  `const style = document.createElement('style');`,
@@ -204556,13 +204556,13 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
204556
204556
  });
204557
204557
  await rm9(tmpDir, { force: true, recursive: true });
204558
204558
  if (result.success) {
204559
- const { readdirSync, readFileSync: readFileSync10, writeFileSync: writeFileSync5 } = await import("fs");
204559
+ const { readdirSync, readFileSync: readFileSync11, writeFileSync: writeFileSync5 } = await import("fs");
204560
204560
  const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
204561
204561
  const reactPaths = computeVendorPaths2();
204562
204562
  const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
204563
204563
  for (const file3 of files) {
204564
204564
  const filePath = join16(vendorDir, file3);
204565
- let content = readFileSync10(filePath, "utf-8");
204565
+ let content = readFileSync11(filePath, "utf-8");
204566
204566
  let changed = false;
204567
204567
  for (const [specifier, webPath] of Object.entries(reactPaths)) {
204568
204568
  const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -204899,5 +204899,5 @@ export {
204899
204899
  build
204900
204900
  };
204901
204901
 
204902
- //# debugId=089B7D6D18958E0A64756E2164756E21
204902
+ //# debugId=CF9E613AA58916E664756E2164756E21
204903
204903
  //# sourceMappingURL=build.js.map