@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/index.js CHANGED
@@ -133,6 +133,37 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
133
133
  </html>`;
134
134
  };
135
135
 
136
+ // src/build/freshReadPlugin.ts
137
+ var createFreshReadPlugin = (changedFiles) => {
138
+ const changed = new Set(changedFiles.map((f) => f.replace(/\\/g, "/")));
139
+ const escaped = changedFiles.map((f) => f.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
140
+ const pattern = escaped.length > 0 ? new RegExp(`(${escaped.join("|")})$`) : /(?!)/;
141
+ return {
142
+ name: "fresh-read",
143
+ setup(build2) {
144
+ build2.onLoad({ filter: pattern }, async (args) => {
145
+ console.log(`[fresh-read] onLoad: ${args.path}`);
146
+ const normalized = args.path.replace(/\\/g, "/");
147
+ if (!changed.has(normalized))
148
+ return;
149
+ const contents = await Bun.file(args.path).text();
150
+ const ext = args.path.split(".").pop();
151
+ const loaderMap = {
152
+ ts: "ts",
153
+ tsx: "tsx",
154
+ js: "js",
155
+ jsx: "jsx",
156
+ css: "css"
157
+ };
158
+ return {
159
+ contents,
160
+ loader: loaderMap[ext ?? ""] ?? "ts"
161
+ };
162
+ });
163
+ }
164
+ };
165
+ };
166
+
136
167
  // src/utils/normalizePath.ts
137
168
  var normalizePath = (path) => path.replace(/\\/g, "/");
138
169
 
@@ -171290,6 +171321,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171290
171321
  await resolveAbsoluteVersion();
171291
171322
  const isIncremental = incrementalFiles && incrementalFiles.length > 0;
171292
171323
  const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
171324
+ const freshReadPlugins = isIncremental ? [createFreshReadPlugin(incrementalFiles)] : [];
171293
171325
  const throwOnError = options?.throwOnError === true;
171294
171326
  const hmr = options?.injectHMR === true;
171295
171327
  const buildPath = validateSafePath(buildDirectory, projectRoot);
@@ -171547,6 +171579,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171547
171579
  naming: `[dir]/[name].[hash].[ext]`,
171548
171580
  outdir: buildPath,
171549
171581
  ...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
171582
+ plugins: [...freshReadPlugins],
171550
171583
  root: clientRoot,
171551
171584
  splitting: true,
171552
171585
  target: "browser",
@@ -171592,6 +171625,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171592
171625
  format: "esm",
171593
171626
  naming: `[dir]/[name].[hash].[ext]`,
171594
171627
  outdir: serverOutDir,
171628
+ plugins: [...freshReadPlugins],
171595
171629
  root: serverRoot,
171596
171630
  target: "bun",
171597
171631
  throw: false
@@ -171610,6 +171644,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171610
171644
  naming: `[dir]/[name].[hash].[ext]`,
171611
171645
  outdir: buildPath,
171612
171646
  plugins: [
171647
+ ...freshReadPlugins,
171613
171648
  ...angularDir && !isDev ? [angularLinkerPlugin] : [],
171614
171649
  ...htmlScriptPlugin ? [htmlScriptPlugin] : []
171615
171650
  ],
@@ -205270,5 +205305,5 @@ export {
205270
205305
  ANGULAR_INIT_TIMEOUT_MS
205271
205306
  };
205272
205307
 
205273
- //# debugId=FFF411E23F884D9A64756E2164756E21
205308
+ //# debugId=6029E224354C289564756E2164756E21
205274
205309
  //# sourceMappingURL=index.js.map