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

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
@@ -46,6 +46,37 @@ 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
+ console.log(`[fresh-read] onLoad: ${args.path}`);
59
+ const normalized = args.path.replace(/\\/g, "/");
60
+ if (!changed.has(normalized))
61
+ return;
62
+ const contents = await Bun.file(args.path).text();
63
+ const ext = args.path.split(".").pop();
64
+ const loaderMap = {
65
+ ts: "ts",
66
+ tsx: "tsx",
67
+ js: "js",
68
+ jsx: "jsx",
69
+ css: "css"
70
+ };
71
+ return {
72
+ contents,
73
+ loader: loaderMap[ext ?? ""] ?? "ts"
74
+ };
75
+ });
76
+ }
77
+ };
78
+ };
79
+
49
80
  // src/constants.ts
50
81
  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
82
  var init_constants = __esm(() => {
@@ -171211,6 +171242,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171211
171242
  await resolveAbsoluteVersion();
171212
171243
  const isIncremental = incrementalFiles && incrementalFiles.length > 0;
171213
171244
  const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
171245
+ const freshReadPlugins = isIncremental ? [createFreshReadPlugin(incrementalFiles)] : [];
171214
171246
  const throwOnError = options?.throwOnError === true;
171215
171247
  const hmr = options?.injectHMR === true;
171216
171248
  const buildPath = validateSafePath(buildDirectory, projectRoot);
@@ -171468,6 +171500,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171468
171500
  naming: `[dir]/[name].[hash].[ext]`,
171469
171501
  outdir: buildPath,
171470
171502
  ...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
171503
+ plugins: [...freshReadPlugins],
171471
171504
  root: clientRoot,
171472
171505
  splitting: true,
171473
171506
  target: "browser",
@@ -171513,6 +171546,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171513
171546
  format: "esm",
171514
171547
  naming: `[dir]/[name].[hash].[ext]`,
171515
171548
  outdir: serverOutDir,
171549
+ plugins: [...freshReadPlugins],
171516
171550
  root: serverRoot,
171517
171551
  target: "bun",
171518
171552
  throw: false
@@ -171531,6 +171565,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171531
171565
  naming: `[dir]/[name].[hash].[ext]`,
171532
171566
  outdir: buildPath,
171533
171567
  plugins: [
171568
+ ...freshReadPlugins,
171534
171569
  ...angularDir && !isDev ? [angularLinkerPlugin] : [],
171535
171570
  ...htmlScriptPlugin ? [htmlScriptPlugin] : []
171536
171571
  ],
@@ -204865,5 +204900,5 @@ export {
204865
204900
  build
204866
204901
  };
204867
204902
 
204868
- //# debugId=61FBA4F3A9C4EF4164756E2164756E21
204903
+ //# debugId=03AC8745CF5CE5A764756E2164756E21
204869
204904
  //# sourceMappingURL=build.js.map