@absolutejs/absolute 0.18.9-beta.1 → 0.18.9-beta.2
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/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/dist/build.js +23 -3
- package/dist/build.js.map +4 -4
- package/dist/index.js +25 -6
- package/dist/index.js.map +5 -5
- package/dist/react/index.js +3 -4
- package/dist/react/index.js.map +3 -3
- package/dist/src/build/rewriteReactImports.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -782,6 +782,16 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), applyAllR
|
|
|
782
782
|
result = result.replace(dynamicRegex, `$1${webPath}$2`);
|
|
783
783
|
}
|
|
784
784
|
return result;
|
|
785
|
+
}, REFRESH_STUBS, patchRefreshGlobals = async (outputPaths) => {
|
|
786
|
+
const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
|
|
787
|
+
await Promise.all(jsFiles.map(async (filePath) => {
|
|
788
|
+
const content = await Bun.file(filePath).text();
|
|
789
|
+
if (!content.includes("$RefreshReg$(") && !content.includes("$RefreshSig$("))
|
|
790
|
+
return;
|
|
791
|
+
if (content.startsWith("window.$RefreshReg$"))
|
|
792
|
+
return;
|
|
793
|
+
await Bun.write(filePath, REFRESH_STUBS + content);
|
|
794
|
+
}));
|
|
785
795
|
}, rewriteReactImports = async (outputPaths, vendorPaths) => {
|
|
786
796
|
const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
|
|
787
797
|
if (jsFiles.length === 0)
|
|
@@ -795,6 +805,10 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), applyAllR
|
|
|
795
805
|
}
|
|
796
806
|
}));
|
|
797
807
|
};
|
|
808
|
+
var init_rewriteReactImports = __esm(() => {
|
|
809
|
+
REFRESH_STUBS = "window.$RefreshReg$||(window.$RefreshReg$=function(){});" + `window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});
|
|
810
|
+
`;
|
|
811
|
+
});
|
|
798
812
|
|
|
799
813
|
// src/core/devVendorPaths.ts
|
|
800
814
|
var exports_devVendorPaths = {};
|
|
@@ -171487,6 +171501,7 @@ var init_build = __esm(() => {
|
|
|
171487
171501
|
init_scanCssEntryPoints();
|
|
171488
171502
|
init_updateAssetPaths();
|
|
171489
171503
|
init_buildHMRClient();
|
|
171504
|
+
init_rewriteReactImports();
|
|
171490
171505
|
init_telemetryEvent();
|
|
171491
171506
|
init_angularLinkerPlugin();
|
|
171492
171507
|
init_cleanStaleOutputs();
|
|
@@ -202478,9 +202493,11 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202478
202493
|
if (!clientResult.success) {
|
|
202479
202494
|
return;
|
|
202480
202495
|
}
|
|
202496
|
+
const clientOutputPaths = clientResult.outputs.map((art) => art.path);
|
|
202481
202497
|
if (vendorPaths) {
|
|
202482
|
-
await rewriteReactImports(
|
|
202498
|
+
await rewriteReactImports(clientOutputPaths, vendorPaths);
|
|
202483
202499
|
}
|
|
202500
|
+
await patchRefreshGlobals(clientOutputPaths);
|
|
202484
202501
|
const clientManifest = generateManifest(clientResult.outputs, buildDir);
|
|
202485
202502
|
Object.assign(state.manifest, clientManifest);
|
|
202486
202503
|
populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
@@ -202509,9 +202526,11 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202509
202526
|
if (!result.success) {
|
|
202510
202527
|
return;
|
|
202511
202528
|
}
|
|
202529
|
+
const pageOutputPaths = result.outputs.map((artifact) => artifact.path);
|
|
202512
202530
|
if (vendorPaths) {
|
|
202513
|
-
await rewriteReactImports(
|
|
202531
|
+
await rewriteReactImports(pageOutputPaths, vendorPaths);
|
|
202514
202532
|
}
|
|
202533
|
+
await patchRefreshGlobals(pageOutputPaths);
|
|
202515
202534
|
const pageManifest = generateManifest(result.outputs, buildDir);
|
|
202516
202535
|
Object.assign(state.manifest, pageManifest);
|
|
202517
202536
|
populateAssetStore(state.assetStore, pageManifest, buildDir);
|
|
@@ -203424,6 +203443,7 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
203424
203443
|
init_compileVue();
|
|
203425
203444
|
init_compileAngular();
|
|
203426
203445
|
init_commonAncestor();
|
|
203446
|
+
init_rewriteReactImports();
|
|
203427
203447
|
});
|
|
203428
203448
|
|
|
203429
203449
|
// src/core/devBuild.ts
|
|
@@ -203770,11 +203790,10 @@ var handleReactPageRequest = async (PageComponent, index, ...props) => {
|
|
|
203770
203790
|
const { createElement } = await import("react");
|
|
203771
203791
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
203772
203792
|
const element = maybeProps !== undefined ? createElement(PageComponent, maybeProps) : createElement(PageComponent);
|
|
203773
|
-
const
|
|
203774
|
-
const propsScript = maybeProps ? `${refreshPreamble}window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)}` : refreshPreamble;
|
|
203793
|
+
const propsScript = maybeProps ? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)}` : "";
|
|
203775
203794
|
const stream = await renderToReadableStream(element, {
|
|
203776
203795
|
bootstrapModules: [index],
|
|
203777
|
-
bootstrapScriptContent: propsScript,
|
|
203796
|
+
bootstrapScriptContent: propsScript || undefined,
|
|
203778
203797
|
onError(error) {
|
|
203779
203798
|
console.error("[SSR] React streaming error:", error);
|
|
203780
203799
|
}
|
|
@@ -203989,5 +204008,5 @@ export {
|
|
|
203989
204008
|
ANGULAR_INIT_TIMEOUT_MS
|
|
203990
204009
|
};
|
|
203991
204010
|
|
|
203992
|
-
//# debugId=
|
|
204011
|
+
//# debugId=ACA94E93892A48A264756E2164756E21
|
|
203993
204012
|
//# sourceMappingURL=index.js.map
|