@absolutejs/absolute 0.19.0-beta.808 → 0.19.0-beta.809
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/angular/browser.js +9801 -57
- package/dist/angular/browser.js.map +246 -4
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +14877 -60
- package/dist/angular/index.js.map +281 -4
- package/dist/angular/server.js +5610 -45
- package/dist/angular/server.js.map +51 -3
- package/dist/build.js +18092 -45
- package/dist/build.js.map +99 -3
- package/dist/cli/index.js +317 -86
- package/dist/client/index.js +1100 -40
- package/dist/client/index.js.map +24 -4
- package/dist/core/streamingSlotRegistrar.js +108 -11
- package/dist/core/streamingSlotRegistrar.js.map +4 -3
- package/dist/core/streamingSlotRegistry.js +169 -7
- package/dist/core/streamingSlotRegistry.js.map +5 -3
- package/dist/index.js +19957 -547
- package/dist/index.js.map +116 -3
- package/dist/islands/browser.js +228 -9
- package/dist/islands/browser.js.map +9 -4
- package/dist/islands/index.js +1908 -17
- package/dist/islands/index.js.map +27 -3
- package/dist/react/browser.js +328 -12
- package/dist/react/browser.js.map +12 -4
- package/dist/react/components/index.js +167 -16
- package/dist/react/components/index.js.map +6 -3
- package/dist/react/hooks/index.js +183 -8
- package/dist/react/hooks/index.js.map +7 -3
- package/dist/react/index.js +3627 -36
- package/dist/react/index.js.map +45 -4
- package/dist/react/jsxDevRuntimeCompat.js +61 -2
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/server.js +1789 -18
- package/dist/react/server.js.map +21 -3
- package/dist/src/angular/injectorPatch.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/svelte/browser.js +247 -12
- package/dist/svelte/browser.js.map +10 -3
- package/dist/svelte/index.js +3732 -37
- package/dist/svelte/index.js.map +47 -4
- package/dist/svelte/server.js +2794 -21
- package/dist/svelte/server.js.map +27 -3
- package/dist/vue/browser.js +348 -12
- package/dist/vue/browser.js.map +12 -4
- package/dist/vue/components/Image.js +240 -7
- package/dist/vue/components/Image.js.map +6 -3
- package/dist/vue/components/index.js +544 -11
- package/dist/vue/components/index.js.map +9 -3
- package/dist/vue/index.js +4212 -52
- package/dist/vue/index.js.map +50 -4
- package/dist/vue/server.js +1849 -18
- package/dist/vue/server.js.map +21 -3
- package/package.json +1 -1
- package/dist/chunk-0867j0r0.js +0 -136
- package/dist/chunk-0867j0r0.js.map +0 -10
- package/dist/chunk-0kdc6r16.js +0 -20
- package/dist/chunk-0kdc6r16.js.map +0 -10
- package/dist/chunk-102fp7xe.js +0 -63
- package/dist/chunk-102fp7xe.js.map +0 -10
- package/dist/chunk-11zpfqz6.js +0 -19
- package/dist/chunk-11zpfqz6.js.map +0 -10
- package/dist/chunk-1rfh7hw9.js +0 -319
- package/dist/chunk-1rfh7hw9.js.map +0 -11
- package/dist/chunk-25v9t56f.js +0 -29
- package/dist/chunk-25v9t56f.js.map +0 -11
- package/dist/chunk-2f21eenc.js +0 -21
- package/dist/chunk-2f21eenc.js.map +0 -10
- package/dist/chunk-2ga2znex.js +0 -13
- package/dist/chunk-2ga2znex.js.map +0 -9
- package/dist/chunk-30yrw0f6.js +0 -33
- package/dist/chunk-30yrw0f6.js.map +0 -10
- package/dist/chunk-38jwhqcw.js +0 -4410
- package/dist/chunk-38jwhqcw.js.map +0 -28
- package/dist/chunk-3g91wb4f.js +0 -358
- package/dist/chunk-3g91wb4f.js.map +0 -10
- package/dist/chunk-3yjzpcne.js +0 -34
- package/dist/chunk-3yjzpcne.js.map +0 -10
- package/dist/chunk-41bf6aqt.js +0 -17
- package/dist/chunk-41bf6aqt.js.map +0 -9
- package/dist/chunk-4d39r92n.js +0 -81
- package/dist/chunk-4d39r92n.js.map +0 -10
- package/dist/chunk-5003emhv.js +0 -17
- package/dist/chunk-5003emhv.js.map +0 -10
- package/dist/chunk-5f67rsed.js +0 -466
- package/dist/chunk-5f67rsed.js.map +0 -10
- package/dist/chunk-5fhp1jap.js +0 -9169
- package/dist/chunk-5fhp1jap.js.map +0 -236
- package/dist/chunk-6pdj08z3.js +0 -73
- package/dist/chunk-6pdj08z3.js.map +0 -12
- package/dist/chunk-6qjbrt0k.js +0 -13
- package/dist/chunk-6qjbrt0k.js.map +0 -9
- package/dist/chunk-6sccb4jr.js +0 -14
- package/dist/chunk-6sccb4jr.js.map +0 -9
- package/dist/chunk-798spvzv.js +0 -50
- package/dist/chunk-798spvzv.js.map +0 -10
- package/dist/chunk-7fw6x3js.js +0 -131
- package/dist/chunk-7fw6x3js.js.map +0 -11
- package/dist/chunk-7kjj42xm.js +0 -11
- package/dist/chunk-7kjj42xm.js.map +0 -10
- package/dist/chunk-7mtstdqn.js +0 -90
- package/dist/chunk-7mtstdqn.js.map +0 -10
- package/dist/chunk-851whwc7.js +0 -17
- package/dist/chunk-851whwc7.js.map +0 -10
- package/dist/chunk-85n68sy6.js +0 -103
- package/dist/chunk-85n68sy6.js.map +0 -10
- package/dist/chunk-8kcfffry.js +0 -35
- package/dist/chunk-8kcfffry.js.map +0 -10
- package/dist/chunk-8qqxc1h2.js +0 -426
- package/dist/chunk-8qqxc1h2.js.map +0 -14
- package/dist/chunk-92fsjfpp.js +0 -1731
- package/dist/chunk-92fsjfpp.js.map +0 -11
- package/dist/chunk-93sqk7be.js +0 -139
- package/dist/chunk-93sqk7be.js.map +0 -12
- package/dist/chunk-94gvx0hg.js +0 -28
- package/dist/chunk-94gvx0hg.js.map +0 -10
- package/dist/chunk-9c5tj4k3.js +0 -130
- package/dist/chunk-9c5tj4k3.js.map +0 -10
- package/dist/chunk-9ve9jq72.js +0 -203
- package/dist/chunk-9ve9jq72.js.map +0 -10
- package/dist/chunk-9xrsjeem.js +0 -12
- package/dist/chunk-9xrsjeem.js.map +0 -9
- package/dist/chunk-a9mvyp04.js +0 -87
- package/dist/chunk-a9mvyp04.js.map +0 -10
- package/dist/chunk-b3gbnrwe.js +0 -21
- package/dist/chunk-b3gbnrwe.js.map +0 -10
- package/dist/chunk-bmgqm774.js +0 -65
- package/dist/chunk-bmgqm774.js.map +0 -9
- package/dist/chunk-bxfghpma.js +0 -69
- package/dist/chunk-bxfghpma.js.map +0 -10
- package/dist/chunk-c1jfjnka.js +0 -74
- package/dist/chunk-c1jfjnka.js.map +0 -10
- package/dist/chunk-cbkrwmvh.js +0 -80
- package/dist/chunk-cbkrwmvh.js.map +0 -10
- package/dist/chunk-cdxd7sy2.js +0 -71
- package/dist/chunk-cdxd7sy2.js.map +0 -10
- package/dist/chunk-cg95827x.js +0 -21
- package/dist/chunk-cg95827x.js.map +0 -10
- package/dist/chunk-cm0g4q6w.js +0 -149
- package/dist/chunk-cm0g4q6w.js.map +0 -10
- package/dist/chunk-cwfy538a.js +0 -51
- package/dist/chunk-cwfy538a.js.map +0 -9
- package/dist/chunk-d7mwkzry.js +0 -261
- package/dist/chunk-d7mwkzry.js.map +0 -10
- package/dist/chunk-d8w0qm28.js +0 -184
- package/dist/chunk-d8w0qm28.js.map +0 -11
- package/dist/chunk-d9c0am65.js +0 -12
- package/dist/chunk-d9c0am65.js.map +0 -10
- package/dist/chunk-daqghmg8.js +0 -12
- package/dist/chunk-daqghmg8.js.map +0 -9
- package/dist/chunk-e3r9fxaa.js +0 -149
- package/dist/chunk-e3r9fxaa.js.map +0 -10
- package/dist/chunk-e8eecyrq.js +0 -244
- package/dist/chunk-e8eecyrq.js.map +0 -10
- package/dist/chunk-ex2hxe0v.js +0 -160
- package/dist/chunk-ex2hxe0v.js.map +0 -11
- package/dist/chunk-fak944et.js +0 -91
- package/dist/chunk-fak944et.js.map +0 -10
- package/dist/chunk-ff70rnhd.js +0 -672
- package/dist/chunk-ff70rnhd.js.map +0 -15
- package/dist/chunk-fygx2ymm.js +0 -118
- package/dist/chunk-fygx2ymm.js.map +0 -12
- package/dist/chunk-g15qj669.js +0 -271
- package/dist/chunk-g15qj669.js.map +0 -11
- package/dist/chunk-gd6wmknh.js +0 -121
- package/dist/chunk-gd6wmknh.js.map +0 -11
- package/dist/chunk-gf0ygptk.js +0 -85
- package/dist/chunk-gf0ygptk.js.map +0 -11
- package/dist/chunk-gytkmthr.js +0 -220
- package/dist/chunk-gytkmthr.js.map +0 -10
- package/dist/chunk-h5bbfn3n.js +0 -28
- package/dist/chunk-h5bbfn3n.js.map +0 -11
- package/dist/chunk-h6mye9r3.js +0 -93
- package/dist/chunk-h6mye9r3.js.map +0 -10
- package/dist/chunk-hcsmxw1v.js +0 -85
- package/dist/chunk-hcsmxw1v.js.map +0 -10
- package/dist/chunk-hyjs4bqs.js +0 -8
- package/dist/chunk-hyjs4bqs.js.map +0 -10
- package/dist/chunk-j88z31ep.js +0 -25
- package/dist/chunk-j88z31ep.js.map +0 -10
- package/dist/chunk-jn91vzkh.js +0 -66
- package/dist/chunk-jn91vzkh.js.map +0 -10
- package/dist/chunk-jpkjdgsk.js +0 -167
- package/dist/chunk-jpkjdgsk.js.map +0 -11
- package/dist/chunk-jwxt8gnp.js +0 -13
- package/dist/chunk-jwxt8gnp.js.map +0 -9
- package/dist/chunk-kk8w9rh5.js +0 -195
- package/dist/chunk-kk8w9rh5.js.map +0 -10
- package/dist/chunk-m97ze5hz.js +0 -46
- package/dist/chunk-m97ze5hz.js.map +0 -10
- package/dist/chunk-mbazhahf.js +0 -60
- package/dist/chunk-mbazhahf.js.map +0 -10
- package/dist/chunk-mgfwq18r.js +0 -15
- package/dist/chunk-mgfwq18r.js.map +0 -9
- package/dist/chunk-mtgf69xn.js +0 -88
- package/dist/chunk-mtgf69xn.js.map +0 -10
- package/dist/chunk-mtxzyxpg.js +0 -102
- package/dist/chunk-mtxzyxpg.js.map +0 -10
- package/dist/chunk-nehhtthw.js +0 -225
- package/dist/chunk-nehhtthw.js.map +0 -10
- package/dist/chunk-p5504p14.js +0 -16
- package/dist/chunk-p5504p14.js.map +0 -10
- package/dist/chunk-pnscgw95.js +0 -90
- package/dist/chunk-pnscgw95.js.map +0 -10
- package/dist/chunk-pvpp4pvs.js +0 -17
- package/dist/chunk-pvpp4pvs.js.map +0 -10
- package/dist/chunk-qh75agse.js +0 -95
- package/dist/chunk-qh75agse.js.map +0 -10
- package/dist/chunk-qxq2zcty.js +0 -52
- package/dist/chunk-qxq2zcty.js.map +0 -10
- package/dist/chunk-r6e8pytx.js +0 -22
- package/dist/chunk-r6e8pytx.js.map +0 -9
- package/dist/chunk-r7jmgqnw.js +0 -114
- package/dist/chunk-r7jmgqnw.js.map +0 -10
- package/dist/chunk-s6defjk2.js +0 -116
- package/dist/chunk-s6defjk2.js.map +0 -10
- package/dist/chunk-sd39p726.js +0 -619
- package/dist/chunk-sd39p726.js.map +0 -10
- package/dist/chunk-swrnzs4c.js +0 -63
- package/dist/chunk-swrnzs4c.js.map +0 -10
- package/dist/chunk-tfe3sb44.js +0 -33
- package/dist/chunk-tfe3sb44.js.map +0 -10
- package/dist/chunk-tjr0kcev.js +0 -41
- package/dist/chunk-tjr0kcev.js.map +0 -9
- package/dist/chunk-tx9edm1x.js +0 -34
- package/dist/chunk-tx9edm1x.js.map +0 -10
- package/dist/chunk-txhm2vb5.js +0 -18
- package/dist/chunk-txhm2vb5.js.map +0 -9
- package/dist/chunk-v5vmsxmy.js +0 -526
- package/dist/chunk-v5vmsxmy.js.map +0 -12
- package/dist/chunk-vjhxm8n2.js +0 -29
- package/dist/chunk-vjhxm8n2.js.map +0 -9
- package/dist/chunk-vkrpm7kc.js +0 -247
- package/dist/chunk-vkrpm7kc.js.map +0 -12
- package/dist/chunk-w3m4m5we.js +0 -4925
- package/dist/chunk-w3m4m5we.js.map +0 -12
- package/dist/chunk-wrxtn9ve.js +0 -18
- package/dist/chunk-wrxtn9ve.js.map +0 -10
- package/dist/chunk-wwzvp0zn.js +0 -192
- package/dist/chunk-wwzvp0zn.js.map +0 -10
- package/dist/chunk-x09cskqd.js +0 -377
- package/dist/chunk-x09cskqd.js.map +0 -10
- package/dist/chunk-xnt8c6h2.js +0 -576
- package/dist/chunk-xnt8c6h2.js.map +0 -10
- package/dist/chunk-xw0tx842.js +0 -13
- package/dist/chunk-xw0tx842.js.map +0 -9
- package/dist/chunk-xx5b6b9m.js +0 -69
- package/dist/chunk-xx5b6b9m.js.map +0 -10
- package/dist/chunk-xz1kdswj.js +0 -21
- package/dist/chunk-xz1kdswj.js.map +0 -9
- package/dist/chunk-y84qnsd3.js +0 -32
- package/dist/chunk-y84qnsd3.js.map +0 -10
- package/dist/chunk-ywjn0rad.js +0 -14
- package/dist/chunk-ywjn0rad.js.map +0 -9
- package/dist/chunk-z9nvhm6r.js +0 -13
- package/dist/chunk-z9nvhm6r.js.map +0 -9
- package/dist/chunk-zhmvdpk6.js +0 -15
- package/dist/chunk-zhmvdpk6.js.map +0 -9
- package/dist/chunk-zrg9d4zw.js +0 -784
- package/dist/chunk-zrg9d4zw.js.map +0 -10
package/dist/cli/index.js
CHANGED
|
@@ -824,12 +824,177 @@ ${serverOutput}` : "Server failed to start for pre-rendering";
|
|
|
824
824
|
};
|
|
825
825
|
var init_prerender = () => {};
|
|
826
826
|
|
|
827
|
+
// src/build/nativeRewrite.ts
|
|
828
|
+
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
829
|
+
import { platform as platform4, arch as arch3 } from "os";
|
|
830
|
+
import { resolve as resolve5 } from "path";
|
|
831
|
+
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
832
|
+
if (nativeLib !== null)
|
|
833
|
+
return nativeLib;
|
|
834
|
+
const osPlatform = platform4();
|
|
835
|
+
const cpu = arch3();
|
|
836
|
+
const platformMap = {
|
|
837
|
+
"darwin-arm64": "darwin-arm64/fast_ops.dylib",
|
|
838
|
+
"darwin-x64": "darwin-x64/fast_ops.dylib",
|
|
839
|
+
"linux-arm64": "linux-arm64/fast_ops.so",
|
|
840
|
+
"linux-x64": "linux-x64/fast_ops.so",
|
|
841
|
+
"win32-arm64": "windows-arm64/fast_ops.dll",
|
|
842
|
+
"win32-x64": "windows-x64/fast_ops.dll"
|
|
843
|
+
};
|
|
844
|
+
const libPath = platformMap[`${osPlatform}-${cpu}`];
|
|
845
|
+
if (!libPath)
|
|
846
|
+
return null;
|
|
847
|
+
try {
|
|
848
|
+
const fullPath = resolve5(import.meta.dir, "../../native/packages", libPath);
|
|
849
|
+
const lib = dlopen(fullPath, ffiDefinition);
|
|
850
|
+
nativeLib = lib.symbols;
|
|
851
|
+
return nativeLib;
|
|
852
|
+
} catch {
|
|
853
|
+
return null;
|
|
854
|
+
}
|
|
855
|
+
}, nativeRewriteImports = (content, replacements) => {
|
|
856
|
+
const lib = loadNative();
|
|
857
|
+
if (!lib)
|
|
858
|
+
return null;
|
|
859
|
+
const jsonStr = JSON.stringify(replacements);
|
|
860
|
+
const contentBuf = Buffer.from(content);
|
|
861
|
+
const jsonBuf = Buffer.from(jsonStr);
|
|
862
|
+
const outBuf = Buffer.alloc(content.length * 2);
|
|
863
|
+
const outLenBuf = new BigUint64Array([BigInt(outBuf.length)]);
|
|
864
|
+
const result = lib.rewrite_imports(ptr(contentBuf), contentBuf.length, ptr(jsonBuf), jsonBuf.length, ptr(outBuf), ptr(new Uint8Array(outLenBuf.buffer)));
|
|
865
|
+
if (result < 0)
|
|
866
|
+
return null;
|
|
867
|
+
if (result === 0)
|
|
868
|
+
return content;
|
|
869
|
+
const outLen = Number(outLenBuf[0]);
|
|
870
|
+
return outBuf.subarray(0, outLen).toString("utf-8");
|
|
871
|
+
};
|
|
872
|
+
var init_nativeRewrite = __esm(() => {
|
|
873
|
+
ffiDefinition = {
|
|
874
|
+
rewrite_imports: {
|
|
875
|
+
args: [
|
|
876
|
+
FFIType.ptr,
|
|
877
|
+
FFIType.u64,
|
|
878
|
+
FFIType.ptr,
|
|
879
|
+
FFIType.u64,
|
|
880
|
+
FFIType.ptr,
|
|
881
|
+
FFIType.ptr
|
|
882
|
+
],
|
|
883
|
+
returns: FFIType.i32
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
// src/build/rewriteImports.ts
|
|
889
|
+
var exports_rewriteImports = {};
|
|
890
|
+
__export(exports_rewriteImports, {
|
|
891
|
+
rewriteVendorDirectories: () => rewriteVendorDirectories,
|
|
892
|
+
rewriteImports: () => rewriteImports
|
|
893
|
+
});
|
|
894
|
+
var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
895
|
+
let result = content;
|
|
896
|
+
for (const [specifier, webPath] of replacements) {
|
|
897
|
+
const escaped = escapeRegex(specifier);
|
|
898
|
+
const fromRegex = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
|
|
899
|
+
const sideEffectRegex = new RegExp(`(import\\s*["'])${escaped}(["'])`, "g");
|
|
900
|
+
const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])${escaped}(["']\\s*\\))`, "g");
|
|
901
|
+
result = result.replace(fromRegex, `$1${webPath}$2`);
|
|
902
|
+
result = result.replace(sideEffectRegex, `$1${webPath}$2`);
|
|
903
|
+
result = result.replace(dynamicRegex, `$1${webPath}$2`);
|
|
904
|
+
}
|
|
905
|
+
return result;
|
|
906
|
+
}, rewriteImports = async (outputPaths, vendorPaths) => {
|
|
907
|
+
const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
|
|
908
|
+
if (jsFiles.length === 0)
|
|
909
|
+
return;
|
|
910
|
+
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
911
|
+
await Promise.all(jsFiles.map(async (filePath) => {
|
|
912
|
+
const original = await Bun.file(filePath).text();
|
|
913
|
+
const native = nativeRewriteImports(original, replacements);
|
|
914
|
+
const content = native ?? jsRewriteImports(original, replacements);
|
|
915
|
+
if (content !== original) {
|
|
916
|
+
await Bun.write(filePath, content);
|
|
917
|
+
}
|
|
918
|
+
}));
|
|
919
|
+
}, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
|
|
920
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
921
|
+
return;
|
|
922
|
+
const { readdirSync } = await import("fs");
|
|
923
|
+
const { join: join6 } = await import("path");
|
|
924
|
+
const allFiles = [];
|
|
925
|
+
for (const dir of vendorDirs) {
|
|
926
|
+
try {
|
|
927
|
+
const files = readdirSync(dir).filter((f) => f.endsWith(".js")).map((f) => join6(dir, f));
|
|
928
|
+
allFiles.push(...files);
|
|
929
|
+
} catch {}
|
|
930
|
+
}
|
|
931
|
+
await rewriteImports(allFiles, vendorPaths);
|
|
932
|
+
await fixMissingReExportNamespaces(allFiles);
|
|
933
|
+
}, fixMissingReExportNamespaces = async (files) => {
|
|
934
|
+
const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
|
|
935
|
+
await Promise.all(files.map(async (filePath) => {
|
|
936
|
+
const content = await Bun.file(filePath).text();
|
|
937
|
+
REEXPORT_PATTERN.lastIndex = 0;
|
|
938
|
+
const missing = [];
|
|
939
|
+
let match;
|
|
940
|
+
while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
|
|
941
|
+
const ident = match[1];
|
|
942
|
+
if (!ident)
|
|
943
|
+
continue;
|
|
944
|
+
const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
|
|
945
|
+
if (nsImportRe.test(content))
|
|
946
|
+
continue;
|
|
947
|
+
const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
|
|
948
|
+
if (declRe.test(content))
|
|
949
|
+
continue;
|
|
950
|
+
const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
|
|
951
|
+
if (namedImportRe.test(content))
|
|
952
|
+
continue;
|
|
953
|
+
const importPathRe = /from\s+["']([^"']+)["']/g;
|
|
954
|
+
let pathMatch;
|
|
955
|
+
let sourcePath;
|
|
956
|
+
while ((pathMatch = importPathRe.exec(content)) !== null) {
|
|
957
|
+
const p = pathMatch[1];
|
|
958
|
+
if (!p)
|
|
959
|
+
continue;
|
|
960
|
+
const base = p.split("/").pop()?.replace(/\.[mc]?js$/, "");
|
|
961
|
+
if (!base)
|
|
962
|
+
continue;
|
|
963
|
+
if (base === ident || base.endsWith(`_${ident}`)) {
|
|
964
|
+
sourcePath = p;
|
|
965
|
+
break;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
if (sourcePath) {
|
|
969
|
+
missing.push({ ident, path: sourcePath });
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
if (missing.length === 0)
|
|
973
|
+
return;
|
|
974
|
+
const seen = new Set;
|
|
975
|
+
const unique = missing.filter((entry) => {
|
|
976
|
+
if (seen.has(entry.ident))
|
|
977
|
+
return false;
|
|
978
|
+
seen.add(entry.ident);
|
|
979
|
+
return true;
|
|
980
|
+
});
|
|
981
|
+
const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
|
|
982
|
+
`);
|
|
983
|
+
const patched = `${inserts}
|
|
984
|
+
${content}`;
|
|
985
|
+
await Bun.write(filePath, patched);
|
|
986
|
+
}));
|
|
987
|
+
};
|
|
988
|
+
var init_rewriteImports = __esm(() => {
|
|
989
|
+
init_nativeRewrite();
|
|
990
|
+
});
|
|
991
|
+
|
|
827
992
|
// src/cli/scripts/build.ts
|
|
828
993
|
var exports_build = {};
|
|
829
994
|
__export(exports_build, {
|
|
830
995
|
build: () => build
|
|
831
996
|
});
|
|
832
|
-
import { resolve as
|
|
997
|
+
import { resolve as resolve8 } from "path";
|
|
833
998
|
var cliTag3 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, tryImportBuild2 = async (candidate) => {
|
|
834
999
|
try {
|
|
835
1000
|
const mod = await import(candidate);
|
|
@@ -849,7 +1014,7 @@ var cliTag3 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
849
1014
|
}
|
|
850
1015
|
return resolveBuildModule2(remaining);
|
|
851
1016
|
}, build = async (outdir, configPath2) => {
|
|
852
|
-
const resolvedOutdir =
|
|
1017
|
+
const resolvedOutdir = resolve8(outdir ?? "build");
|
|
853
1018
|
const buildStart = performance.now();
|
|
854
1019
|
process.stdout.write(cliTag3("\x1B[36m", "Building assets"));
|
|
855
1020
|
const buildConfig = await loadConfig(configPath2);
|
|
@@ -857,8 +1022,8 @@ var cliTag3 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
857
1022
|
buildConfig.mode = "production";
|
|
858
1023
|
try {
|
|
859
1024
|
const buildApp = await resolveBuildModule2([
|
|
860
|
-
|
|
861
|
-
|
|
1025
|
+
resolve8(import.meta.dir, "..", "..", "core", "build"),
|
|
1026
|
+
resolve8(import.meta.dir, "..", "build")
|
|
862
1027
|
]);
|
|
863
1028
|
if (!buildApp)
|
|
864
1029
|
throw new Error("Could not locate build module");
|
|
@@ -901,7 +1066,7 @@ import {
|
|
|
901
1066
|
unlinkSync as unlinkSync2,
|
|
902
1067
|
writeFileSync as writeFileSync3
|
|
903
1068
|
} from "fs";
|
|
904
|
-
import { basename as basename2, dirname as dirname2, join as join6, relative, resolve as
|
|
1069
|
+
import { basename as basename2, dirname as dirname2, join as join6, relative, resolve as resolve9 } from "path";
|
|
905
1070
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
906
1071
|
const resolvedVersion = version2 || "unknown";
|
|
907
1072
|
console.log("");
|
|
@@ -921,7 +1086,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
921
1086
|
result.push(fullPath);
|
|
922
1087
|
}
|
|
923
1088
|
return result;
|
|
924
|
-
}, SERVER_RUNTIME_ASSET_RE, SERVER_RUNTIME_SOURCE_EXTENSIONS, SERVER_RUNTIME_SCAN_SKIP_DIRS, hasSourceExtension = (filePath) => SERVER_RUNTIME_SOURCE_EXTENSIONS.has(filePath.slice(filePath.lastIndexOf("."))),
|
|
1089
|
+
}, SERVER_RUNTIME_ASSET_RE, SERVER_RUNTIME_IMPORT_META_DIR_JOIN_RE, SERVER_RUNTIME_STRING_ARG_RE, SERVER_RUNTIME_SOURCE_EXTENSIONS, SERVER_RUNTIME_SCAN_SKIP_DIRS, hasSourceExtension = (filePath) => SERVER_RUNTIME_SOURCE_EXTENSIONS.has(filePath.slice(filePath.lastIndexOf("."))), normalizeServerRuntimeAssetPath = (parts) => {
|
|
1090
|
+
if (parts.length === 0)
|
|
1091
|
+
return null;
|
|
1092
|
+
if (parts.some((part) => part === ".." || part.includes("/") || part.includes("\\")))
|
|
1093
|
+
return null;
|
|
1094
|
+
return `./${parts.join("/")}`;
|
|
1095
|
+
}, collectProjectSourceFiles = (dir) => {
|
|
925
1096
|
const result = [];
|
|
926
1097
|
let pending = readdirSync2(dir, { withFileTypes: true });
|
|
927
1098
|
while (pending.length > 0) {
|
|
@@ -940,7 +1111,20 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
940
1111
|
return result;
|
|
941
1112
|
}, copyServerRuntimeAssetReferences = (outdir) => {
|
|
942
1113
|
const copied = new Set;
|
|
943
|
-
const normalizedOutdir =
|
|
1114
|
+
const normalizedOutdir = resolve9(outdir);
|
|
1115
|
+
const copyReference = (filePath, relPath) => {
|
|
1116
|
+
const assetSource = resolve9(dirname2(filePath), relPath);
|
|
1117
|
+
if (!existsSync9(assetSource) || !statSync(assetSource).isFile())
|
|
1118
|
+
return;
|
|
1119
|
+
const assetTarget = resolve9(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
1120
|
+
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
1121
|
+
return;
|
|
1122
|
+
if (copied.has(assetTarget))
|
|
1123
|
+
return;
|
|
1124
|
+
copied.add(assetTarget);
|
|
1125
|
+
mkdirSync5(dirname2(assetTarget), { recursive: true });
|
|
1126
|
+
cpSync(assetSource, assetTarget, { force: true });
|
|
1127
|
+
};
|
|
944
1128
|
for (const filePath of collectProjectSourceFiles(process.cwd())) {
|
|
945
1129
|
const source = readFileSync9(filePath, "utf-8");
|
|
946
1130
|
SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
|
|
@@ -949,17 +1133,24 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
949
1133
|
const relPath = match[1];
|
|
950
1134
|
if (!relPath)
|
|
951
1135
|
continue;
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1136
|
+
copyReference(filePath, relPath);
|
|
1137
|
+
}
|
|
1138
|
+
SERVER_RUNTIME_IMPORT_META_DIR_JOIN_RE.lastIndex = 0;
|
|
1139
|
+
while ((match = SERVER_RUNTIME_IMPORT_META_DIR_JOIN_RE.exec(source)) !== null) {
|
|
1140
|
+
const args = match[1];
|
|
1141
|
+
if (!args)
|
|
957
1142
|
continue;
|
|
958
|
-
|
|
1143
|
+
SERVER_RUNTIME_STRING_ARG_RE.lastIndex = 0;
|
|
1144
|
+
const parts = [];
|
|
1145
|
+
for (const partMatch of args.matchAll(SERVER_RUNTIME_STRING_ARG_RE)) {
|
|
1146
|
+
const part = partMatch[1];
|
|
1147
|
+
if (part)
|
|
1148
|
+
parts.push(part);
|
|
1149
|
+
}
|
|
1150
|
+
const relPath = normalizeServerRuntimeAssetPath(parts);
|
|
1151
|
+
if (!relPath)
|
|
959
1152
|
continue;
|
|
960
|
-
|
|
961
|
-
mkdirSync5(dirname2(assetTarget), { recursive: true });
|
|
962
|
-
cpSync(assetSource, assetTarget, { force: true });
|
|
1153
|
+
copyReference(filePath, relPath);
|
|
963
1154
|
}
|
|
964
1155
|
}
|
|
965
1156
|
}, readPackageVersion4 = (candidate) => {
|
|
@@ -999,18 +1190,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
999
1190
|
return resolveBuildModule3(remaining);
|
|
1000
1191
|
}, resolveJsxDevRuntimeCompatPath2 = () => {
|
|
1001
1192
|
const candidates = [
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1193
|
+
resolve9(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
1194
|
+
resolve9(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
1195
|
+
resolve9(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
1196
|
+
resolve9(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
1197
|
+
resolve9(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
1198
|
+
resolve9(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
1008
1199
|
];
|
|
1009
1200
|
for (const candidate of candidates) {
|
|
1010
1201
|
if (existsSync9(candidate))
|
|
1011
1202
|
return candidate;
|
|
1012
1203
|
}
|
|
1013
|
-
return
|
|
1204
|
+
return resolve9(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
1014
1205
|
}, jsxDevRuntimeCompatPath2, shouldEmbedCompiledAsset = (relativePath, skip = new Set) => {
|
|
1015
1206
|
if (skip.has(relativePath))
|
|
1016
1207
|
return false;
|
|
@@ -1027,7 +1218,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1027
1218
|
} catch {
|
|
1028
1219
|
return null;
|
|
1029
1220
|
}
|
|
1030
|
-
}, resolveProjectPackageDir = (specifier) =>
|
|
1221
|
+
}, resolveProjectPackageDir = (specifier) => resolve9(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
|
|
1031
1222
|
if (seen.has(specifier))
|
|
1032
1223
|
return;
|
|
1033
1224
|
const srcDir = resolveProjectPackageDir(specifier);
|
|
@@ -1057,7 +1248,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1057
1248
|
}, copyAngularRuntimePackages = (buildConfig, outdir) => {
|
|
1058
1249
|
if (!buildConfig.angularDirectory)
|
|
1059
1250
|
return;
|
|
1060
|
-
const angularScopeDir =
|
|
1251
|
+
const angularScopeDir = resolve9(process.cwd(), "node_modules", "@angular");
|
|
1061
1252
|
const angularPackages = existsSync9(angularScopeDir) ? readdirSync2(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
|
|
1062
1253
|
const roots = new Set([
|
|
1063
1254
|
...angularPackages,
|
|
@@ -1189,7 +1380,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
1189
1380
|
const source = readFileSync9(filePath, "utf-8");
|
|
1190
1381
|
const rewritten = source.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
|
|
1191
1382
|
if (typeof specifier === "string" && specifier.startsWith(".")) {
|
|
1192
|
-
enqueue(resolveRuntimeJsFile(
|
|
1383
|
+
enqueue(resolveRuntimeJsFile(resolve9(dirname2(filePath), specifier)));
|
|
1193
1384
|
return match;
|
|
1194
1385
|
}
|
|
1195
1386
|
const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
|
|
@@ -1274,7 +1465,7 @@ import { pathToFileURL } from "node:url";
|
|
|
1274
1465
|
const SERVER_MODULE = (runtimeDir: string) => import(pathToFileURL(join(runtimeDir, ${JSON.stringify(serverBundleName)})).href);
|
|
1275
1466
|
const RUNTIME_BUILD_ID = ${JSON.stringify(runtimeBuildId)};
|
|
1276
1467
|
const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
|
|
1277
|
-
const ORIGINAL_BUILD_DIR = ${JSON.stringify(
|
|
1468
|
+
const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve9(distDir))};
|
|
1278
1469
|
const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
|
|
1279
1470
|
|
|
1280
1471
|
// \u2500\u2500 Asset URL \u2192 embedded path map \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
@@ -1463,7 +1654,7 @@ console.log(\`
|
|
|
1463
1654
|
}, createStubPlugin = (options = {}) => ({
|
|
1464
1655
|
name: "stub-framework-sources",
|
|
1465
1656
|
setup(bld) {
|
|
1466
|
-
const
|
|
1657
|
+
const escapeRegex2 = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1467
1658
|
const runtimeStubs = new Map;
|
|
1468
1659
|
if (options.stubReact) {
|
|
1469
1660
|
runtimeStubs.set("react", "export const createElement = () => null; export default { createElement };");
|
|
@@ -1491,7 +1682,7 @@ console.log(\`
|
|
|
1491
1682
|
}
|
|
1492
1683
|
runtimeStubs.set("@vue/compiler-sfc", 'const unavailable = () => { throw new Error("Vue source compiler is unavailable in compiled production runtime. Use built manifest page paths."); }; export const compileScript = unavailable; export const compileStyle = unavailable; export const compileTemplate = unavailable; export const parse = unavailable;');
|
|
1493
1684
|
runtimeStubs.set("typescript", 'const unavailable = () => { throw new Error("TypeScript compiler APIs are unavailable in compiled production runtime. Use built manifest page paths."); }; export const transpileModule = unavailable; export const createProgram = unavailable; export default {};');
|
|
1494
|
-
const runtimeStubFilter = new RegExp(`^(${Array.from(runtimeStubs.keys()).map(
|
|
1685
|
+
const runtimeStubFilter = new RegExp(`^(${Array.from(runtimeStubs.keys()).map(escapeRegex2).join("|")})$`);
|
|
1495
1686
|
bld.onResolve({ filter: runtimeStubFilter }, (args) => ({
|
|
1496
1687
|
namespace: "absolute-compile-stub",
|
|
1497
1688
|
path: args.path
|
|
@@ -1574,11 +1765,11 @@ console.log(\`
|
|
|
1574
1765
|
const prerenderPort = Number(env3.COMPILE_PORT) || Number(env3.PORT) || DEFAULT_PORT + 1;
|
|
1575
1766
|
killStaleProcesses(prerenderPort);
|
|
1576
1767
|
const entryName = basename2(serverEntry).replace(/\.[^.]+$/, "");
|
|
1577
|
-
const resolvedOutdir =
|
|
1578
|
-
const resolvedOutfile =
|
|
1768
|
+
const resolvedOutdir = resolve9(outdir ?? "dist");
|
|
1769
|
+
const resolvedOutfile = resolve9(outfile ?? "compiled-server");
|
|
1579
1770
|
const absoluteVersion = resolvePackageVersion3([
|
|
1580
|
-
|
|
1581
|
-
|
|
1771
|
+
resolve9(import.meta.dir, "..", "..", "..", "package.json"),
|
|
1772
|
+
resolve9(import.meta.dir, "..", "..", "package.json")
|
|
1582
1773
|
]);
|
|
1583
1774
|
compileBanner(absoluteVersion);
|
|
1584
1775
|
const totalStart = performance.now();
|
|
@@ -1589,8 +1780,8 @@ console.log(\`
|
|
|
1589
1780
|
buildConfig.mode = "production";
|
|
1590
1781
|
try {
|
|
1591
1782
|
const build2 = await resolveBuildModule3([
|
|
1592
|
-
|
|
1593
|
-
|
|
1783
|
+
resolve9(import.meta.dir, "..", "..", "core", "build"),
|
|
1784
|
+
resolve9(import.meta.dir, "..", "build")
|
|
1594
1785
|
]);
|
|
1595
1786
|
if (!build2)
|
|
1596
1787
|
throw new Error("Could not locate build module");
|
|
@@ -1605,7 +1796,7 @@ console.log(\`
|
|
|
1605
1796
|
process.stdout.write(cliTag4("\x1B[36m", "Bundling production server"));
|
|
1606
1797
|
const serverBundle = await Bun.build({
|
|
1607
1798
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
1608
|
-
entrypoints: [
|
|
1799
|
+
entrypoints: [resolve9(serverEntry)],
|
|
1609
1800
|
external: resolveServerBundleExternals(buildConfig),
|
|
1610
1801
|
outdir: resolvedOutdir,
|
|
1611
1802
|
plugins: [
|
|
@@ -1623,11 +1814,29 @@ console.log(\`
|
|
|
1623
1814
|
console.error(cliTag4("\x1B[31m", "Server bundle failed."));
|
|
1624
1815
|
process.exit(1);
|
|
1625
1816
|
}
|
|
1626
|
-
const outputPath =
|
|
1817
|
+
const outputPath = resolve9(resolvedOutdir, `${entryName}.js`);
|
|
1627
1818
|
if (!existsSync9(outputPath)) {
|
|
1628
1819
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
1629
1820
|
process.exit(1);
|
|
1630
1821
|
}
|
|
1822
|
+
if (existsSync9(resolve9(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
1823
|
+
const vendorDir = resolve9(resolvedOutdir, "angular", "vendor", "server");
|
|
1824
|
+
const vendorEntries = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
1825
|
+
const angularServerVendorPaths = {};
|
|
1826
|
+
for (const file of vendorEntries) {
|
|
1827
|
+
const stem = file.replace(/\.js$/, "");
|
|
1828
|
+
const [scope, ...rest] = stem.split("_");
|
|
1829
|
+
if (scope !== "angular" || rest.length === 0)
|
|
1830
|
+
continue;
|
|
1831
|
+
const specifier = `@angular/${rest.join("/")}`;
|
|
1832
|
+
const relPath = relative(dirname2(outputPath), resolve9(vendorDir, file));
|
|
1833
|
+
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
1834
|
+
}
|
|
1835
|
+
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
1836
|
+
const { rewriteImports: rewriteImports2 } = await Promise.resolve().then(() => (init_rewriteImports(), exports_rewriteImports));
|
|
1837
|
+
await rewriteImports2([outputPath], angularServerVendorPaths);
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1631
1840
|
console.log(` \x1B[2m(${getDurationString(performance.now() - bundleStart)})\x1B[0m`);
|
|
1632
1841
|
copyServerRuntimeAssetReferences(resolvedOutdir);
|
|
1633
1842
|
const prerenderStart = performance.now();
|
|
@@ -1696,6 +1905,8 @@ var init_compile = __esm(() => {
|
|
|
1696
1905
|
init_telemetryEvent();
|
|
1697
1906
|
init_utils();
|
|
1698
1907
|
SERVER_RUNTIME_ASSET_RE = /new\s+URL\(\s*["'](\.\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
1908
|
+
SERVER_RUNTIME_IMPORT_META_DIR_JOIN_RE = /(?:join|resolve)\(\s*import\.meta\.dir\s*,\s*((?:(?:"[^"]+"|'[^']+')\s*,?\s*)+)\)/g;
|
|
1909
|
+
SERVER_RUNTIME_STRING_ARG_RE = /["']([^"']+)["']/g;
|
|
1699
1910
|
SERVER_RUNTIME_SOURCE_EXTENSIONS = new Set([
|
|
1700
1911
|
".cjs",
|
|
1701
1912
|
".js",
|
|
@@ -1740,7 +1951,7 @@ var exports_typecheck = {};
|
|
|
1740
1951
|
__export(exports_typecheck, {
|
|
1741
1952
|
typecheck: () => typecheck
|
|
1742
1953
|
});
|
|
1743
|
-
import { resolve as
|
|
1954
|
+
import { resolve as resolve10, join as join7 } from "path";
|
|
1744
1955
|
import { existsSync as existsSync10, readFileSync as readFileSync10 } from "fs";
|
|
1745
1956
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
1746
1957
|
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), getTypecheckTargets = async (configPath2) => {
|
|
@@ -1761,7 +1972,7 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
1761
1972
|
const exitCode = await proc.exited;
|
|
1762
1973
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
1763
1974
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
1764
|
-
const local =
|
|
1975
|
+
const local = resolve10("node_modules", ".bin", name);
|
|
1765
1976
|
return existsSync10(local) ? local : null;
|
|
1766
1977
|
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
1767
1978
|
const cwd = `${process.cwd()}/`;
|
|
@@ -1809,15 +2020,15 @@ Found ${errorCount} error${suffix}.`;
|
|
|
1809
2020
|
return formatted;
|
|
1810
2021
|
}, TYPECHECK_EXCLUDE, TYPECHECK_INCLUDE, resolveAbsoluteTypeFile = (fileName) => {
|
|
1811
2022
|
const candidates = [
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
2023
|
+
resolve10("node_modules/@absolutejs/absolute/dist/types", fileName),
|
|
2024
|
+
resolve10(import.meta.dir, "../types", fileName),
|
|
2025
|
+
resolve10(import.meta.dir, "../../types", fileName),
|
|
2026
|
+
resolve10(import.meta.dir, "../../../types", fileName)
|
|
1816
2027
|
];
|
|
1817
2028
|
return candidates.find((candidate) => existsSync10(candidate)) ?? candidates[0];
|
|
1818
2029
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
1819
2030
|
try {
|
|
1820
|
-
return JSON.parse(readFileSync10(
|
|
2031
|
+
return JSON.parse(readFileSync10(resolve10("tsconfig.json"), "utf-8"));
|
|
1821
2032
|
} catch {
|
|
1822
2033
|
return {};
|
|
1823
2034
|
}
|
|
@@ -1851,13 +2062,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
1851
2062
|
rootDir: ".."
|
|
1852
2063
|
},
|
|
1853
2064
|
exclude: getProjectTypecheckExcludes(),
|
|
1854
|
-
extends:
|
|
2065
|
+
extends: resolve10("tsconfig.json"),
|
|
1855
2066
|
include: getProjectTypecheckIncludes()
|
|
1856
2067
|
}, null, "\t")).then(() => run("vue-tsc", [
|
|
1857
2068
|
vueTscBin,
|
|
1858
2069
|
"--noEmit",
|
|
1859
2070
|
"--project",
|
|
1860
|
-
|
|
2071
|
+
resolve10(vueTsconfigPath),
|
|
1861
2072
|
"--incremental",
|
|
1862
2073
|
"--tsBuildInfoFile",
|
|
1863
2074
|
join7(cacheDir, "vue-tsc.tsbuildinfo"),
|
|
@@ -1879,10 +2090,10 @@ Found ${errorCount} error${suffix}.`;
|
|
|
1879
2090
|
rootDir: ".."
|
|
1880
2091
|
},
|
|
1881
2092
|
exclude: TYPECHECK_EXCLUDE,
|
|
1882
|
-
extends:
|
|
2093
|
+
extends: resolve10("tsconfig.json"),
|
|
1883
2094
|
include: [`../${angularDir}/**/*`]
|
|
1884
2095
|
}, null, "\t"));
|
|
1885
|
-
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(
|
|
2096
|
+
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve10(angularTsconfigPath))}`);
|
|
1886
2097
|
}, buildTscCheck = (cacheDir) => {
|
|
1887
2098
|
const tscBin = findBin("tsc");
|
|
1888
2099
|
if (!tscBin) {
|
|
@@ -1895,13 +2106,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
1895
2106
|
rootDir: ".."
|
|
1896
2107
|
},
|
|
1897
2108
|
exclude: getProjectTypecheckExcludes(),
|
|
1898
|
-
extends:
|
|
2109
|
+
extends: resolve10("tsconfig.json"),
|
|
1899
2110
|
include: getProjectTypecheckIncludes()
|
|
1900
2111
|
}, null, "\t")).then(() => run("tsc", [
|
|
1901
2112
|
tscBin,
|
|
1902
2113
|
"--noEmit",
|
|
1903
2114
|
"--project",
|
|
1904
|
-
|
|
2115
|
+
resolve10(tscConfigPath),
|
|
1905
2116
|
"--incremental",
|
|
1906
2117
|
"--tsBuildInfoFile",
|
|
1907
2118
|
join7(cacheDir, "tsc.tsbuildinfo"),
|
|
@@ -1915,14 +2126,14 @@ Found ${errorCount} error${suffix}.`;
|
|
|
1915
2126
|
}
|
|
1916
2127
|
const svelteTsconfigPath = join7(cacheDir, "tsconfig.svelte-check.json");
|
|
1917
2128
|
await writeFile(svelteTsconfigPath, JSON.stringify({
|
|
1918
|
-
extends:
|
|
2129
|
+
extends: resolve10("tsconfig.json"),
|
|
1919
2130
|
files: ABSOLUTE_TYPECHECK_FILES,
|
|
1920
2131
|
include: [`../${svelteDir}/**/*`]
|
|
1921
2132
|
}, null, "\t"));
|
|
1922
2133
|
return run("svelte-check", [
|
|
1923
2134
|
svelteBin,
|
|
1924
2135
|
"--tsconfig",
|
|
1925
|
-
|
|
2136
|
+
resolve10(svelteTsconfigPath),
|
|
1926
2137
|
"--threshold",
|
|
1927
2138
|
"error",
|
|
1928
2139
|
"--compiler-warnings",
|
|
@@ -2867,7 +3078,7 @@ init_telemetryEvent();
|
|
|
2867
3078
|
init_utils();
|
|
2868
3079
|
var {env: env2 } = globalThis.Bun;
|
|
2869
3080
|
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "fs";
|
|
2870
|
-
import { basename, resolve as
|
|
3081
|
+
import { basename, resolve as resolve6 } from "path";
|
|
2871
3082
|
var cliTag2 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`;
|
|
2872
3083
|
var resolvePackageVersion = (candidates) => {
|
|
2873
3084
|
for (const candidate of candidates) {
|
|
@@ -2922,18 +3133,18 @@ var handleBundleFailure = (serverBundle, bundleStart, serverEntry) => {
|
|
|
2922
3133
|
};
|
|
2923
3134
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
2924
3135
|
const candidates = [
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
3136
|
+
resolve6(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
3137
|
+
resolve6(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
3138
|
+
resolve6(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
3139
|
+
resolve6(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
3140
|
+
resolve6(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
3141
|
+
resolve6(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
2931
3142
|
];
|
|
2932
3143
|
for (const candidate of candidates) {
|
|
2933
3144
|
if (existsSync7(candidate))
|
|
2934
3145
|
return candidate;
|
|
2935
3146
|
}
|
|
2936
|
-
return
|
|
3147
|
+
return resolve6(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
2937
3148
|
};
|
|
2938
3149
|
var jsxDevRuntimeCompatPath = resolveJsxDevRuntimeCompatPath();
|
|
2939
3150
|
var prerenderStaticPages = async (outputPath, prerenderPort, resolvedOutdir, staticConfig, absoluteVersion, configPath2) => {
|
|
@@ -2960,10 +3171,10 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
2960
3171
|
const port = Number(env2.PORT) || DEFAULT_PORT;
|
|
2961
3172
|
killStaleProcesses(port);
|
|
2962
3173
|
const entryName = basename(serverEntry).replace(/\.[^.]+$/, "");
|
|
2963
|
-
const resolvedOutdir =
|
|
3174
|
+
const resolvedOutdir = resolve6(outdir ?? "dist");
|
|
2964
3175
|
const absoluteVersion = resolvePackageVersion([
|
|
2965
|
-
|
|
2966
|
-
|
|
3176
|
+
resolve6(import.meta.dir, "..", "..", "..", "package.json"),
|
|
3177
|
+
resolve6(import.meta.dir, "..", "..", "package.json")
|
|
2967
3178
|
]);
|
|
2968
3179
|
const buildStepStart = performance.now();
|
|
2969
3180
|
process.stdout.write(cliTag2("\x1B[36m", `Building assets`));
|
|
@@ -2980,8 +3191,8 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
2980
3191
|
].filter((val) => Boolean(val));
|
|
2981
3192
|
try {
|
|
2982
3193
|
const build = await resolveBuildModule([
|
|
2983
|
-
|
|
2984
|
-
|
|
3194
|
+
resolve6(import.meta.dir, "..", "..", "core", "build"),
|
|
3195
|
+
resolve6(import.meta.dir, "..", "build")
|
|
2985
3196
|
]);
|
|
2986
3197
|
if (!build)
|
|
2987
3198
|
throw new Error("Could not locate build module");
|
|
@@ -3061,7 +3272,7 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
3061
3272
|
};
|
|
3062
3273
|
const serverBundle = await Bun.build({
|
|
3063
3274
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
3064
|
-
entrypoints: [
|
|
3275
|
+
entrypoints: [resolve6(serverEntry)],
|
|
3065
3276
|
external: [
|
|
3066
3277
|
"react",
|
|
3067
3278
|
"react/jsx-runtime",
|
|
@@ -3088,11 +3299,31 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
3088
3299
|
if (!serverBundle.success) {
|
|
3089
3300
|
handleBundleFailure(serverBundle, bundleStart, serverEntry);
|
|
3090
3301
|
}
|
|
3091
|
-
const outputPath =
|
|
3302
|
+
const outputPath = resolve6(resolvedOutdir, `${entryName}.js`);
|
|
3092
3303
|
if (!existsSync7(outputPath)) {
|
|
3093
3304
|
console.error(cliTag2("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
3094
3305
|
process.exit(1);
|
|
3095
3306
|
}
|
|
3307
|
+
if (existsSync7(resolve6(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
3308
|
+
const { readdirSync } = await import("fs");
|
|
3309
|
+
const vendorDir = resolve6(resolvedOutdir, "angular", "vendor", "server");
|
|
3310
|
+
const vendorEntries = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
3311
|
+
const angularServerVendorPaths = {};
|
|
3312
|
+
const { relative: pathRelative, dirname: pathDirname } = await import("path");
|
|
3313
|
+
for (const file of vendorEntries) {
|
|
3314
|
+
const stem = file.replace(/\.js$/, "");
|
|
3315
|
+
const [scope, ...rest] = stem.split("_");
|
|
3316
|
+
if (scope !== "angular" || rest.length === 0)
|
|
3317
|
+
continue;
|
|
3318
|
+
const specifier = `@angular/${rest.join("/")}`;
|
|
3319
|
+
const relPath = pathRelative(pathDirname(outputPath), resolve6(vendorDir, file));
|
|
3320
|
+
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
3321
|
+
}
|
|
3322
|
+
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
3323
|
+
const { rewriteImports: rewriteImports2 } = await Promise.resolve().then(() => (init_rewriteImports(), exports_rewriteImports));
|
|
3324
|
+
await rewriteImports2([outputPath], angularServerVendorPaths);
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3096
3327
|
const bundleDurationMs = Math.round(performance.now() - bundleStart);
|
|
3097
3328
|
const bundleDuration = getDurationString(performance.now() - bundleStart);
|
|
3098
3329
|
console.log(` \x1B[2m(${bundleDuration})\x1B[0m`);
|
|
@@ -3103,7 +3334,7 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
3103
3334
|
if (buildConfig.static) {
|
|
3104
3335
|
await prerenderStaticPages(outputPath, port + 1, resolvedOutdir, buildConfig.static, absoluteVersion, configPath2);
|
|
3105
3336
|
}
|
|
3106
|
-
const usesDocker = existsSync7(
|
|
3337
|
+
const usesDocker = existsSync7(resolve6(COMPOSE_PATH));
|
|
3107
3338
|
const scripts = usesDocker ? await readDbScripts() : null;
|
|
3108
3339
|
if (scripts)
|
|
3109
3340
|
await startDatabase(scripts);
|
|
@@ -3178,7 +3409,7 @@ import {
|
|
|
3178
3409
|
writeFileSync as writeFileSync2
|
|
3179
3410
|
} from "fs";
|
|
3180
3411
|
import { createConnection } from "net";
|
|
3181
|
-
import { resolve as
|
|
3412
|
+
import { resolve as resolve7 } from "path";
|
|
3182
3413
|
|
|
3183
3414
|
// src/cli/workspaceTui.ts
|
|
3184
3415
|
init_constants();
|
|
@@ -3840,11 +4071,11 @@ var sleep = (durationMs) => Bun.sleep(durationMs);
|
|
|
3840
4071
|
var stripAnsi2 = (value) => value.replace(ANSI_REGEX2, "");
|
|
3841
4072
|
var sanitizeLogFileName = (value) => value.replace(/[^a-zA-Z0-9._-]/g, "_") || "unknown";
|
|
3842
4073
|
var createWorkspaceLogSink = (appendLog) => {
|
|
3843
|
-
const logDirectory =
|
|
4074
|
+
const logDirectory = resolve7(".absolutejs", "workspace", "logs");
|
|
3844
4075
|
mkdirSync4(logDirectory, { recursive: true });
|
|
3845
|
-
readdirSync(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync(
|
|
3846
|
-
writeFileSync2(
|
|
3847
|
-
writeFileSync2(
|
|
4076
|
+
readdirSync(logDirectory).filter((file) => file.endsWith(".log")).forEach((file) => unlinkSync(resolve7(logDirectory, file)));
|
|
4077
|
+
writeFileSync2(resolve7(logDirectory, "all.log"), "");
|
|
4078
|
+
writeFileSync2(resolve7(logDirectory, "workspace.log"), "");
|
|
3848
4079
|
const initializedSources = new Set(["workspace"]);
|
|
3849
4080
|
const writeLog = (source, message, level) => {
|
|
3850
4081
|
const cleanMessage = stripAnsi2(message).trimEnd();
|
|
@@ -3854,13 +4085,13 @@ var createWorkspaceLogSink = (appendLog) => {
|
|
|
3854
4085
|
const timestamp = new Date().toISOString();
|
|
3855
4086
|
const line = `[${timestamp}] [${level}] [${source}] ${cleanMessage}
|
|
3856
4087
|
`;
|
|
3857
|
-
const sourceFile =
|
|
4088
|
+
const sourceFile = resolve7(logDirectory, `${sanitizeLogFileName(source)}.log`);
|
|
3858
4089
|
if (!initializedSources.has(source)) {
|
|
3859
4090
|
writeFileSync2(sourceFile, "");
|
|
3860
4091
|
initializedSources.add(source);
|
|
3861
4092
|
}
|
|
3862
4093
|
appendFileSync(sourceFile, line);
|
|
3863
|
-
appendFileSync(
|
|
4094
|
+
appendFileSync(resolve7(logDirectory, "all.log"), line);
|
|
3864
4095
|
};
|
|
3865
4096
|
return {
|
|
3866
4097
|
appendLog: (source, message, level = "info") => {
|
|
@@ -3884,9 +4115,9 @@ var readPackageVersion3 = (candidate) => {
|
|
|
3884
4115
|
};
|
|
3885
4116
|
var resolvePackageVersion2 = () => {
|
|
3886
4117
|
const candidates = [
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
4118
|
+
resolve7(import.meta.dir, "..", "..", "package.json"),
|
|
4119
|
+
resolve7(import.meta.dir, "..", "..", "..", "package.json"),
|
|
4120
|
+
resolve7(import.meta.dir, "..", "..", "..", "..", "package.json")
|
|
3890
4121
|
];
|
|
3891
4122
|
for (const candidate of candidates) {
|
|
3892
4123
|
const version2 = readPackageVersion3(candidate);
|
|
@@ -4234,15 +4465,15 @@ var createWorkspaceServiceEnv = (services) => {
|
|
|
4234
4465
|
var getDefinedProcessEnv = () => Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string"));
|
|
4235
4466
|
var resolveAbsoluteServiceConfigPath = (service, cwd, options) => {
|
|
4236
4467
|
if (service.config)
|
|
4237
|
-
return
|
|
4468
|
+
return resolve7(cwd, service.config);
|
|
4238
4469
|
if (options.configPath)
|
|
4239
|
-
return
|
|
4470
|
+
return resolve7(options.configPath);
|
|
4240
4471
|
if (process.env.ABSOLUTE_CONFIG)
|
|
4241
|
-
return
|
|
4472
|
+
return resolve7(process.env.ABSOLUTE_CONFIG);
|
|
4242
4473
|
return;
|
|
4243
4474
|
};
|
|
4244
4475
|
var resolveService = (name, service, workspaceEnv, options) => {
|
|
4245
|
-
const cwd =
|
|
4476
|
+
const cwd = resolve7(service.cwd ?? ".");
|
|
4246
4477
|
const envVars = Object.assign(getDefinedProcessEnv(), workspaceEnv, service.env, {
|
|
4247
4478
|
ABSOLUTE_WORKSPACE_MANAGED: "1",
|
|
4248
4479
|
ABSOLUTE_WORKSPACE_SERVICE_NAME: name,
|
|
@@ -4530,14 +4761,14 @@ var workspace = async (subcommand, options) => {
|
|
|
4530
4761
|
addLog("workspace", "No ready public service to open yet.", "warn");
|
|
4531
4762
|
return;
|
|
4532
4763
|
}
|
|
4533
|
-
const { platform:
|
|
4534
|
-
const isWSL =
|
|
4764
|
+
const { platform: platform5 } = process;
|
|
4765
|
+
const isWSL = platform5 === "linux" && isWSLEnvironment();
|
|
4535
4766
|
let cmd;
|
|
4536
4767
|
if (isWSL) {
|
|
4537
4768
|
cmd = "cmd.exe";
|
|
4538
|
-
} else if (
|
|
4769
|
+
} else if (platform5 === "darwin") {
|
|
4539
4770
|
cmd = "open";
|
|
4540
|
-
} else if (
|
|
4771
|
+
} else if (platform5 === "win32") {
|
|
4541
4772
|
cmd = "start";
|
|
4542
4773
|
} else {
|
|
4543
4774
|
cmd = "xdg-open";
|