@absolutejs/absolute 0.19.0-beta.72 → 0.19.0-beta.74

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.
@@ -233,7 +233,8 @@
233
233
  "Bash(sed -i 's/\"\"\"\"@absolutejs\\\\/absolute\"\"\"\": \"\"\"\"0.19.0-beta.67\"\"\"\"/\"\"\"\"@absolutejs\\\\/absolute\"\"\"\": \"\"\"\"0.19.0-beta.68\"\"\"\"/' package.json)",
234
234
  "Bash(./scripts/use-patched-bun.sh echo:*)",
235
235
  "Read(//home/alexkahn/alex/bun-transpiler-patch/build/release/**)",
236
- "Bash(~/alex/bun-transpiler-patch/build/release/bun --version)"
236
+ "Bash(~/alex/bun-transpiler-patch/build/release/bun --version)",
237
+ "Bash(lsof -ti:3000)"
237
238
  ]
238
239
  }
239
240
  }
package/dist/build.js CHANGED
@@ -46,6 +46,36 @@ var __export = (target, all) => {
46
46
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
47
47
  var __require = import.meta.require;
48
48
 
49
+ // src/build/freshReadPlugin.ts
50
+ var createFreshReadPlugin = (changedFiles) => {
51
+ 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
+ return {
55
+ name: "fresh-read",
56
+ setup(build) {
57
+ build.onLoad({ filter: pattern }, async (args) => {
58
+ const normalized = args.path.replace(/\\/g, "/");
59
+ if (!changed.has(normalized))
60
+ return;
61
+ const contents = await Bun.file(args.path).text();
62
+ const ext = args.path.split(".").pop();
63
+ const loaderMap = {
64
+ ts: "ts",
65
+ tsx: "tsx",
66
+ js: "js",
67
+ jsx: "jsx",
68
+ css: "css"
69
+ };
70
+ return {
71
+ contents,
72
+ loader: loaderMap[ext ?? ""] ?? "ts"
73
+ };
74
+ });
75
+ }
76
+ };
77
+ };
78
+
49
79
  // src/constants.ts
50
80
  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;
51
81
  var init_constants = __esm(() => {
@@ -171211,6 +171241,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171211
171241
  await resolveAbsoluteVersion();
171212
171242
  const isIncremental = incrementalFiles && incrementalFiles.length > 0;
171213
171243
  const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
171244
+ const freshReadPlugins = isIncremental ? [createFreshReadPlugin(incrementalFiles)] : [];
171214
171245
  const throwOnError = options?.throwOnError === true;
171215
171246
  const hmr = options?.injectHMR === true;
171216
171247
  const buildPath = validateSafePath(buildDirectory, projectRoot);
@@ -171468,6 +171499,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171468
171499
  naming: `[dir]/[name].[hash].[ext]`,
171469
171500
  outdir: buildPath,
171470
171501
  ...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
171502
+ plugins: [...freshReadPlugins],
171471
171503
  root: clientRoot,
171472
171504
  splitting: true,
171473
171505
  target: "browser",
@@ -171513,6 +171545,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171513
171545
  format: "esm",
171514
171546
  naming: `[dir]/[name].[hash].[ext]`,
171515
171547
  outdir: serverOutDir,
171548
+ plugins: [...freshReadPlugins],
171516
171549
  root: serverRoot,
171517
171550
  target: "bun",
171518
171551
  throw: false
@@ -171531,6 +171564,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171531
171564
  naming: `[dir]/[name].[hash].[ext]`,
171532
171565
  outdir: buildPath,
171533
171566
  plugins: [
171567
+ ...freshReadPlugins,
171534
171568
  ...angularDir && !isDev ? [angularLinkerPlugin] : [],
171535
171569
  ...htmlScriptPlugin ? [htmlScriptPlugin] : []
171536
171570
  ],
@@ -202323,15 +202357,6 @@ var init_pageHandler = __esm(() => {
202323
202357
  });
202324
202358
 
202325
202359
  // src/dev/transformCache.ts
202326
- var exports_transformCache = {};
202327
- __export(exports_transformCache, {
202328
- setTransformed: () => setTransformed,
202329
- invalidateAll: () => invalidateAll,
202330
- invalidate: () => invalidate,
202331
- getTransformed: () => getTransformed,
202332
- getInvalidationVersion: () => getInvalidationVersion,
202333
- findNearestComponent: () => findNearestComponent
202334
- });
202335
202360
  var globalStore, cache, importers, getTransformed = (filePath) => cache.get(filePath)?.content, setTransformed = (filePath, content, mtime, imports) => {
202336
202361
  const resolvedImports = imports ?? [];
202337
202362
  cache.set(filePath, { content, imports: resolvedImports, mtime });
@@ -202350,28 +202375,6 @@ var globalStore, cache, importers, getTransformed = (filePath) => cache.get(file
202350
202375
  cache.delete(parent);
202351
202376
  }
202352
202377
  }
202353
- }, invalidateAll = () => {
202354
- cache.clear();
202355
- importers.clear();
202356
- }, findNearestComponent = (filePath) => {
202357
- const visited = new Set;
202358
- const queue = [filePath];
202359
- while (queue.length > 0) {
202360
- const current = queue.shift();
202361
- if (visited.has(current))
202362
- continue;
202363
- visited.add(current);
202364
- const parents = importers.get(current);
202365
- if (!parents)
202366
- continue;
202367
- for (const parent of parents) {
202368
- if (parent.endsWith(".tsx") || parent.endsWith(".jsx")) {
202369
- return parent;
202370
- }
202371
- queue.push(parent);
202372
- }
202373
- }
202374
- return;
202375
202378
  };
202376
202379
  var init_transformCache = __esm(() => {
202377
202380
  globalStore = globalThis;
@@ -203497,11 +203500,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203497
203500
  const reactIndexesPath = resolve20(reactDir, "indexes");
203498
203501
  const { buildDir } = state.resolvedPaths;
203499
203502
  const reactFiles = filesToRebuild.filter((file3) => detectFramework(file3, state.resolvedPaths) === "react");
203500
- if (reactFiles.length > 0) {
203503
+ const componentFiles = reactFiles.filter((f) => f.endsWith(".tsx") || f.endsWith(".jsx"));
203504
+ if (componentFiles.length > 0 && componentFiles.length === reactFiles.length) {
203501
203505
  for (const file3 of reactFiles) {
203502
203506
  state.fileHashes.set(resolve20(file3), computeFileHash(file3));
203503
203507
  }
203504
- const primaryFile = reactFiles.find((f) => !f.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
203508
+ const primaryFile = componentFiles.find((f) => !f.replace(/\\/g, "/").includes("/pages/")) ?? componentFiles[0];
203505
203509
  if (!primaryFile) {
203506
203510
  onRebuildComplete({
203507
203511
  hmrState: state,
@@ -203513,15 +203517,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203513
203517
  for (const file3 of reactFiles) {
203514
203518
  invalidateModule2(file3);
203515
203519
  }
203516
- const isComponentFile = primaryFile.endsWith(".tsx") || primaryFile.endsWith(".jsx");
203517
- let broadcastTarget = primaryFile;
203518
- if (!isComponentFile) {
203519
- const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
203520
- const nearest = findNearestComponent2(resolve20(primaryFile));
203521
- if (nearest)
203522
- broadcastTarget = nearest;
203523
- }
203524
- const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
203520
+ const pageModuleUrl = await getReactModuleUrl(primaryFile);
203525
203521
  if (pageModuleUrl) {
203526
203522
  const serverDuration = Date.now() - startTime;
203527
203523
  state.lastHmrPath = relative9(process.cwd(), primaryFile).replace(/\\/g, "/");
@@ -204903,5 +204899,5 @@ export {
204903
204899
  build
204904
204900
  };
204905
204901
 
204906
- //# debugId=C76781E040DC65C064756E2164756E21
204902
+ //# debugId=089B7D6D18958E0A64756E2164756E21
204907
204903
  //# sourceMappingURL=build.js.map