@absolutejs/absolute 0.19.0-beta.840 → 0.19.0-beta.841
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/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +57 -54
- package/dist/angular/index.js.map +5 -5
- package/dist/angular/server.js +57 -54
- package/dist/angular/server.js.map +5 -5
- package/dist/build.js +1614 -427
- package/dist/build.js.map +23 -15
- package/dist/cli/index.js +1 -0
- package/dist/index.js +1667 -475
- package/dist/index.js.map +25 -17
- package/dist/react/index.js +57 -53
- package/dist/react/index.js.map +5 -5
- package/dist/react/server.js +57 -53
- package/dist/react/server.js.map +5 -5
- package/dist/src/build/buildEmberVendor.d.ts +24 -0
- package/dist/src/build/compileEmber.d.ts +43 -0
- package/dist/src/build/vendorEntrySource.d.ts +1 -26
- package/dist/src/build/vueAutoRouterTransform.d.ts +1 -0
- package/dist/src/core/devVendorPaths.d.ts +2 -0
- package/dist/src/dev/configResolver.d.ts +1 -0
- package/dist/src/dev/pathUtils.d.ts +1 -1
- package/dist/src/ember/browser.d.ts +24 -0
- package/dist/src/ember/index.d.ts +2 -0
- package/dist/src/ember/pageHandler.d.ts +35 -0
- package/dist/src/ember/server.d.ts +2 -0
- package/dist/src/utils/loadConfig.d.ts +1 -0
- package/dist/src/vue/browser.d.ts +2 -0
- package/dist/src/vue/defineVuePage.d.ts +5 -0
- package/dist/src/vue/index.d.ts +2 -0
- package/dist/svelte/index.js +57 -53
- package/dist/svelte/index.js.map +5 -5
- package/dist/svelte/server.js +57 -53
- package/dist/svelte/server.js.map +5 -5
- package/dist/types/build.d.ts +1 -0
- package/dist/types/conventions.d.ts +1 -0
- package/dist/types/ember.d.ts +41 -0
- package/dist/types/island.d.ts +3 -2
- package/dist/types/vue.d.ts +28 -1
- package/dist/vue/browser.js +4 -1
- package/dist/vue/browser.js.map +5 -4
- package/dist/vue/index.js +62 -53
- package/dist/vue/index.js.map +7 -6
- package/dist/vue/server.js +59 -53
- package/dist/vue/server.js.map +6 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8246,6 +8246,7 @@ import { readFileSync as readFileSync7 } from "fs";
|
|
|
8246
8246
|
import { dirname as dirname7, resolve as resolve9 } from "path";
|
|
8247
8247
|
var pagePatterns, getPageDirs = (config) => [
|
|
8248
8248
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
8249
|
+
{ dir: config.emberDirectory, framework: "ember" },
|
|
8249
8250
|
{ dir: config.reactDirectory, framework: "react" },
|
|
8250
8251
|
{ dir: config.svelteDirectory, framework: "svelte" },
|
|
8251
8252
|
{ dir: config.vueDirectory, framework: "vue" },
|
|
@@ -8305,6 +8306,7 @@ var init_pageMetadata = __esm(() => {
|
|
|
8305
8306
|
init_sourceMetadata();
|
|
8306
8307
|
pagePatterns = {
|
|
8307
8308
|
angular: "pages/**/*.{ts,js}",
|
|
8309
|
+
ember: "pages/**/*.{gjs,gts,ts,js}",
|
|
8308
8310
|
html: "pages/**/*.html",
|
|
8309
8311
|
htmx: "pages/**/*.html",
|
|
8310
8312
|
react: "pages/**/*.{ts,tsx,js,jsx}",
|
|
@@ -9666,11 +9668,13 @@ var exports_devVendorPaths = {};
|
|
|
9666
9668
|
__export(exports_devVendorPaths, {
|
|
9667
9669
|
setVueVendorPaths: () => setVueVendorPaths,
|
|
9668
9670
|
setSvelteVendorPaths: () => setSvelteVendorPaths,
|
|
9671
|
+
setEmberVendorPaths: () => setEmberVendorPaths,
|
|
9669
9672
|
setDevVendorPaths: () => setDevVendorPaths,
|
|
9670
9673
|
setAngularVendorPaths: () => setAngularVendorPaths,
|
|
9671
9674
|
setAngularServerVendorPaths: () => setAngularServerVendorPaths,
|
|
9672
9675
|
getVueVendorPaths: () => getVueVendorPaths,
|
|
9673
9676
|
getSvelteVendorPaths: () => getSvelteVendorPaths,
|
|
9677
|
+
getEmberVendorPaths: () => getEmberVendorPaths,
|
|
9674
9678
|
getDevVendorPaths: () => getDevVendorPaths,
|
|
9675
9679
|
getAngularVendorPaths: () => getAngularVendorPaths,
|
|
9676
9680
|
getAngularServerVendorPaths: () => getAngularServerVendorPaths
|
|
@@ -9685,6 +9689,8 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
9685
9689
|
svelteVendorPaths = paths;
|
|
9686
9690
|
}, vueVendorPaths = null, getVueVendorPaths = () => vueVendorPaths, setVueVendorPaths = (paths) => {
|
|
9687
9691
|
vueVendorPaths = paths;
|
|
9692
|
+
}, emberVendorPaths = null, getEmberVendorPaths = () => emberVendorPaths, setEmberVendorPaths = (paths) => {
|
|
9693
|
+
emberVendorPaths = paths;
|
|
9688
9694
|
};
|
|
9689
9695
|
|
|
9690
9696
|
// src/build/angularLinkerPlugin.ts
|
|
@@ -10349,6 +10355,57 @@ var init_compileSvelte = __esm(() => {
|
|
|
10349
10355
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
10350
10356
|
});
|
|
10351
10357
|
|
|
10358
|
+
// src/build/vueAutoRouterTransform.ts
|
|
10359
|
+
var SCRIPT_REGEX, ROUTES_EXPORT_REGEX, SENTINEL = "__ABSOLUTE_AUTO_ROUTER__", SETUP_APP_DECLARATION_REGEX, SETUP_APP_FUNCTION_REGEX, addAutoRouterSetupApp = (sourceContent) => {
|
|
10360
|
+
if (!ROUTES_EXPORT_REGEX.test(sourceContent))
|
|
10361
|
+
return sourceContent;
|
|
10362
|
+
const match = SCRIPT_REGEX.exec(sourceContent);
|
|
10363
|
+
if (!match)
|
|
10364
|
+
return sourceContent;
|
|
10365
|
+
const [, openTag, scriptBody, closeTag] = match;
|
|
10366
|
+
if (!openTag || scriptBody === undefined || !closeTag)
|
|
10367
|
+
return sourceContent;
|
|
10368
|
+
if (scriptBody.includes(SENTINEL))
|
|
10369
|
+
return sourceContent;
|
|
10370
|
+
let rewrittenScript = scriptBody.replace(SETUP_APP_DECLARATION_REGEX, "const __absoluteUserSetupApp__");
|
|
10371
|
+
rewrittenScript = rewrittenScript.replace(SETUP_APP_FUNCTION_REGEX, "$1 __absoluteUserSetupApp__");
|
|
10372
|
+
const userHadSetupApp = rewrittenScript !== scriptBody;
|
|
10373
|
+
const autoWrapper = `
|
|
10374
|
+
// ${SENTINEL} \u2014 generated by AbsoluteJS because this page exports
|
|
10375
|
+
// \`routes\`. Owns the vue-router lifecycle (history pick, app.use,
|
|
10376
|
+
// push, isReady) so user code stays declarative.
|
|
10377
|
+
import {
|
|
10378
|
+
createRouter as __absoluteCreateRouter__,
|
|
10379
|
+
createMemoryHistory as __absoluteCreateMemoryHistory__,
|
|
10380
|
+
createWebHistory as __absoluteCreateWebHistory__,
|
|
10381
|
+
} from 'vue-router';
|
|
10382
|
+
${userHadSetupApp ? "" : "const __absoluteUserSetupApp__ = null;"}
|
|
10383
|
+
export const setupApp = async (app, ctx) => {
|
|
10384
|
+
const router = __absoluteCreateRouter__({
|
|
10385
|
+
history: ctx.isServer
|
|
10386
|
+
? __absoluteCreateMemoryHistory__()
|
|
10387
|
+
: __absoluteCreateWebHistory__(),
|
|
10388
|
+
routes,
|
|
10389
|
+
});
|
|
10390
|
+
app.use(router);
|
|
10391
|
+
if (ctx.isServer) {
|
|
10392
|
+
await router.push(ctx.url);
|
|
10393
|
+
}
|
|
10394
|
+
await router.isReady();
|
|
10395
|
+
if (__absoluteUserSetupApp__) {
|
|
10396
|
+
await __absoluteUserSetupApp__(app, { ...ctx, router });
|
|
10397
|
+
}
|
|
10398
|
+
};
|
|
10399
|
+
`;
|
|
10400
|
+
return sourceContent.replace(SCRIPT_REGEX, `${openTag}${rewrittenScript}${autoWrapper}${closeTag}`);
|
|
10401
|
+
};
|
|
10402
|
+
var init_vueAutoRouterTransform = __esm(() => {
|
|
10403
|
+
SCRIPT_REGEX = /(<script\b(?![^>]*\bsetup\b)[^>]*>)([\s\S]*?)(<\/script>)/;
|
|
10404
|
+
ROUTES_EXPORT_REGEX = /\bexport\s+(?:const|let|var)\s+routes\b/;
|
|
10405
|
+
SETUP_APP_DECLARATION_REGEX = /\bexport\s+(const|let|var)\s+setupApp\b/;
|
|
10406
|
+
SETUP_APP_FUNCTION_REGEX = /\bexport\s+(async\s+function|function)\s+setupApp\b/;
|
|
10407
|
+
});
|
|
10408
|
+
|
|
10352
10409
|
// src/build/compileVue.ts
|
|
10353
10410
|
var exports_compileVue = {};
|
|
10354
10411
|
__export(exports_compileVue, {
|
|
@@ -10454,7 +10511,8 @@ var resolveDevClientDir3 = () => {
|
|
|
10454
10511
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
10455
10512
|
const fileBaseName = basename6(sourceFilePath, ".vue");
|
|
10456
10513
|
const componentId = toKebab(fileBaseName);
|
|
10457
|
-
const
|
|
10514
|
+
const rawSourceContent = await file3(sourceFilePath).text();
|
|
10515
|
+
const sourceContent = isEntryPoint ? addAutoRouterSetupApp(rawSourceContent) : rawSourceContent;
|
|
10458
10516
|
const islandMetadataExports = buildIslandMetadataExports(sourceContent);
|
|
10459
10517
|
const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
|
|
10460
10518
|
const prevHash = vueSourceHashCache.get(sourceFilePath);
|
|
@@ -10471,7 +10529,11 @@ var resolveDevClientDir3 = () => {
|
|
|
10471
10529
|
const changeType = detectVueChangeType(sourceFilePath, descriptor);
|
|
10472
10530
|
vueHmrMetadata.set(sourceFilePath, { changeType, hmrId });
|
|
10473
10531
|
const scriptSource = descriptor.scriptSetup?.content ?? descriptor.script?.content ?? "";
|
|
10474
|
-
const
|
|
10532
|
+
const moduleScriptSource = descriptor.script?.content && descriptor.scriptSetup ? descriptor.script.content : "";
|
|
10533
|
+
const importPaths = [
|
|
10534
|
+
...extractImports(scriptSource),
|
|
10535
|
+
...extractImports(moduleScriptSource)
|
|
10536
|
+
];
|
|
10475
10537
|
const resolvedPackageVueImports = new Map;
|
|
10476
10538
|
const bareImports = importPaths.filter((p2) => !p2.startsWith(".") && !p2.startsWith("/"));
|
|
10477
10539
|
for (const importPath of bareImports) {
|
|
@@ -10672,16 +10734,26 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10672
10734
|
'const shouldHydrate = typeof window === "undefined" ? false : !(isHMR || isSsrDirty);',
|
|
10673
10735
|
"const app = shouldHydrate ? createSSRApp(Comp, mergedProps) : createApp(Comp, mergedProps);",
|
|
10674
10736
|
"",
|
|
10675
|
-
"//
|
|
10676
|
-
"//
|
|
10677
|
-
|
|
10678
|
-
"//
|
|
10737
|
+
"// `setupApp` hook. Reflect.get hides the lookup from Bun's",
|
|
10738
|
+
"// static analyzer so non-SPA pages without it don't trigger",
|
|
10739
|
+
'// "always undefined" warnings. Pages that export `routes`',
|
|
10740
|
+
"// have their setupApp auto-synthesized at compile time by",
|
|
10741
|
+
"// compileVue (see addAutoRouterSetupApp below) \u2014 that wrapper",
|
|
10742
|
+
"// uses the page-bundle's own vue-router instance so",
|
|
10743
|
+
"// provide/inject symbols match between the router and the",
|
|
10744
|
+
"// page's `useRoute()` calls.",
|
|
10745
|
+
'const setupAppHook = Reflect.get(PageModule, "setupApp");',
|
|
10679
10746
|
"async function bootstrapApp() {",
|
|
10680
|
-
' if (typeof
|
|
10747
|
+
' if (typeof setupAppHook === "function") {',
|
|
10681
10748
|
' const clientUrl = typeof window !== "undefined"',
|
|
10682
10749
|
" ? window.location.pathname + window.location.search",
|
|
10683
10750
|
' : "/";',
|
|
10684
|
-
" await
|
|
10751
|
+
" await setupAppHook(app, {",
|
|
10752
|
+
" isServer: false,",
|
|
10753
|
+
" router: null,",
|
|
10754
|
+
" setRedirect: () => {},",
|
|
10755
|
+
" url: clientUrl",
|
|
10756
|
+
" });",
|
|
10685
10757
|
" }",
|
|
10686
10758
|
' app.mount("#root");',
|
|
10687
10759
|
"}",
|
|
@@ -10790,6 +10862,7 @@ var init_compileVue = __esm(() => {
|
|
|
10790
10862
|
init_constants();
|
|
10791
10863
|
init_resolvePackageImport();
|
|
10792
10864
|
init_sourceMetadata();
|
|
10865
|
+
init_vueAutoRouterTransform();
|
|
10793
10866
|
init_stylePreprocessor();
|
|
10794
10867
|
devClientDir3 = resolveDevClientDir3();
|
|
10795
10868
|
hmrClientPath4 = join16(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
@@ -12465,31 +12538,723 @@ var init_compileAngular = __esm(() => {
|
|
|
12465
12538
|
wrapperOutputCache = new Map;
|
|
12466
12539
|
});
|
|
12467
12540
|
|
|
12541
|
+
// node_modules/content-tag/pkg/node/content_tag.cjs
|
|
12542
|
+
var require_content_tag = __commonJS((exports, module) => {
|
|
12543
|
+
var __dirname = "/home/alexkahn/abs/absolutejs/node_modules/content-tag/pkg/node";
|
|
12544
|
+
var imports = {};
|
|
12545
|
+
imports["__wbindgen_placeholder__"] = exports;
|
|
12546
|
+
var wasm;
|
|
12547
|
+
var { TextDecoder: TextDecoder2, TextEncoder: TextEncoder2 } = __require("util");
|
|
12548
|
+
var cachedTextDecoder = new TextDecoder2("utf-8", { ignoreBOM: true, fatal: true });
|
|
12549
|
+
cachedTextDecoder.decode();
|
|
12550
|
+
var cachedUint8ArrayMemory0 = null;
|
|
12551
|
+
function getUint8ArrayMemory0() {
|
|
12552
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
12553
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
12554
|
+
}
|
|
12555
|
+
return cachedUint8ArrayMemory0;
|
|
12556
|
+
}
|
|
12557
|
+
function getStringFromWasm0(ptr2, len) {
|
|
12558
|
+
ptr2 = ptr2 >>> 0;
|
|
12559
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr2, ptr2 + len));
|
|
12560
|
+
}
|
|
12561
|
+
function debugString(val) {
|
|
12562
|
+
const type = typeof val;
|
|
12563
|
+
if (type == "number" || type == "boolean" || val == null) {
|
|
12564
|
+
return `${val}`;
|
|
12565
|
+
}
|
|
12566
|
+
if (type == "string") {
|
|
12567
|
+
return `"${val}"`;
|
|
12568
|
+
}
|
|
12569
|
+
if (type == "symbol") {
|
|
12570
|
+
const description = val.description;
|
|
12571
|
+
if (description == null) {
|
|
12572
|
+
return "Symbol";
|
|
12573
|
+
} else {
|
|
12574
|
+
return `Symbol(${description})`;
|
|
12575
|
+
}
|
|
12576
|
+
}
|
|
12577
|
+
if (type == "function") {
|
|
12578
|
+
const name = val.name;
|
|
12579
|
+
if (typeof name == "string" && name.length > 0) {
|
|
12580
|
+
return `Function(${name})`;
|
|
12581
|
+
} else {
|
|
12582
|
+
return "Function";
|
|
12583
|
+
}
|
|
12584
|
+
}
|
|
12585
|
+
if (Array.isArray(val)) {
|
|
12586
|
+
const length = val.length;
|
|
12587
|
+
let debug = "[";
|
|
12588
|
+
if (length > 0) {
|
|
12589
|
+
debug += debugString(val[0]);
|
|
12590
|
+
}
|
|
12591
|
+
for (let i = 1;i < length; i++) {
|
|
12592
|
+
debug += ", " + debugString(val[i]);
|
|
12593
|
+
}
|
|
12594
|
+
debug += "]";
|
|
12595
|
+
return debug;
|
|
12596
|
+
}
|
|
12597
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
12598
|
+
let className;
|
|
12599
|
+
if (builtInMatches.length > 1) {
|
|
12600
|
+
className = builtInMatches[1];
|
|
12601
|
+
} else {
|
|
12602
|
+
return toString.call(val);
|
|
12603
|
+
}
|
|
12604
|
+
if (className == "Object") {
|
|
12605
|
+
try {
|
|
12606
|
+
return "Object(" + JSON.stringify(val) + ")";
|
|
12607
|
+
} catch (_2) {
|
|
12608
|
+
return "Object";
|
|
12609
|
+
}
|
|
12610
|
+
}
|
|
12611
|
+
if (val instanceof Error) {
|
|
12612
|
+
return `${val.name}: ${val.message}
|
|
12613
|
+
${val.stack}`;
|
|
12614
|
+
}
|
|
12615
|
+
return className;
|
|
12616
|
+
}
|
|
12617
|
+
var WASM_VECTOR_LEN = 0;
|
|
12618
|
+
var cachedTextEncoder = new TextEncoder2("utf-8");
|
|
12619
|
+
var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
|
|
12620
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
12621
|
+
} : function(arg, view) {
|
|
12622
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
12623
|
+
view.set(buf);
|
|
12624
|
+
return {
|
|
12625
|
+
read: arg.length,
|
|
12626
|
+
written: buf.length
|
|
12627
|
+
};
|
|
12628
|
+
};
|
|
12629
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
12630
|
+
if (realloc === undefined) {
|
|
12631
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
12632
|
+
const ptr3 = malloc(buf.length, 1) >>> 0;
|
|
12633
|
+
getUint8ArrayMemory0().subarray(ptr3, ptr3 + buf.length).set(buf);
|
|
12634
|
+
WASM_VECTOR_LEN = buf.length;
|
|
12635
|
+
return ptr3;
|
|
12636
|
+
}
|
|
12637
|
+
let len = arg.length;
|
|
12638
|
+
let ptr2 = malloc(len, 1) >>> 0;
|
|
12639
|
+
const mem = getUint8ArrayMemory0();
|
|
12640
|
+
let offset = 0;
|
|
12641
|
+
for (;offset < len; offset++) {
|
|
12642
|
+
const code = arg.charCodeAt(offset);
|
|
12643
|
+
if (code > 127)
|
|
12644
|
+
break;
|
|
12645
|
+
mem[ptr2 + offset] = code;
|
|
12646
|
+
}
|
|
12647
|
+
if (offset !== len) {
|
|
12648
|
+
if (offset !== 0) {
|
|
12649
|
+
arg = arg.slice(offset);
|
|
12650
|
+
}
|
|
12651
|
+
ptr2 = realloc(ptr2, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
12652
|
+
const view = getUint8ArrayMemory0().subarray(ptr2 + offset, ptr2 + len);
|
|
12653
|
+
const ret = encodeString(arg, view);
|
|
12654
|
+
offset += ret.written;
|
|
12655
|
+
ptr2 = realloc(ptr2, len, offset, 1) >>> 0;
|
|
12656
|
+
}
|
|
12657
|
+
WASM_VECTOR_LEN = offset;
|
|
12658
|
+
return ptr2;
|
|
12659
|
+
}
|
|
12660
|
+
var cachedDataViewMemory0 = null;
|
|
12661
|
+
function getDataViewMemory0() {
|
|
12662
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
12663
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
12664
|
+
}
|
|
12665
|
+
return cachedDataViewMemory0;
|
|
12666
|
+
}
|
|
12667
|
+
function notDefined(what) {
|
|
12668
|
+
return () => {
|
|
12669
|
+
throw new Error(`${what} is not defined`);
|
|
12670
|
+
};
|
|
12671
|
+
}
|
|
12672
|
+
function takeFromExternrefTable0(idx) {
|
|
12673
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
12674
|
+
wasm.__externref_table_dealloc(idx);
|
|
12675
|
+
return value;
|
|
12676
|
+
}
|
|
12677
|
+
function addToExternrefTable0(obj) {
|
|
12678
|
+
const idx = wasm.__externref_table_alloc();
|
|
12679
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
12680
|
+
return idx;
|
|
12681
|
+
}
|
|
12682
|
+
function handleError(f2, args) {
|
|
12683
|
+
try {
|
|
12684
|
+
return f2.apply(this, args);
|
|
12685
|
+
} catch (e) {
|
|
12686
|
+
const idx = addToExternrefTable0(e);
|
|
12687
|
+
wasm.__wbindgen_exn_store(idx);
|
|
12688
|
+
}
|
|
12689
|
+
}
|
|
12690
|
+
var CodeMapPairFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((ptr2) => wasm.__wbg_codemappair_free(ptr2 >>> 0, 1));
|
|
12691
|
+
|
|
12692
|
+
class CodeMapPair {
|
|
12693
|
+
static __wrap(ptr2) {
|
|
12694
|
+
ptr2 = ptr2 >>> 0;
|
|
12695
|
+
const obj = Object.create(CodeMapPair.prototype);
|
|
12696
|
+
obj.__wbg_ptr = ptr2;
|
|
12697
|
+
CodeMapPairFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
12698
|
+
return obj;
|
|
12699
|
+
}
|
|
12700
|
+
__destroy_into_raw() {
|
|
12701
|
+
const ptr2 = this.__wbg_ptr;
|
|
12702
|
+
this.__wbg_ptr = 0;
|
|
12703
|
+
CodeMapPairFinalization.unregister(this);
|
|
12704
|
+
return ptr2;
|
|
12705
|
+
}
|
|
12706
|
+
free() {
|
|
12707
|
+
const ptr2 = this.__destroy_into_raw();
|
|
12708
|
+
wasm.__wbg_codemappair_free(ptr2, 0);
|
|
12709
|
+
}
|
|
12710
|
+
get code() {
|
|
12711
|
+
let deferred1_0;
|
|
12712
|
+
let deferred1_1;
|
|
12713
|
+
try {
|
|
12714
|
+
const ret = wasm.__wbg_get_codemappair_code(this.__wbg_ptr);
|
|
12715
|
+
deferred1_0 = ret[0];
|
|
12716
|
+
deferred1_1 = ret[1];
|
|
12717
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
12718
|
+
} finally {
|
|
12719
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
12720
|
+
}
|
|
12721
|
+
}
|
|
12722
|
+
set code(arg0) {
|
|
12723
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12724
|
+
const len0 = WASM_VECTOR_LEN;
|
|
12725
|
+
wasm.__wbg_set_codemappair_code(this.__wbg_ptr, ptr0, len0);
|
|
12726
|
+
}
|
|
12727
|
+
get map() {
|
|
12728
|
+
let deferred1_0;
|
|
12729
|
+
let deferred1_1;
|
|
12730
|
+
try {
|
|
12731
|
+
const ret = wasm.__wbg_get_codemappair_map(this.__wbg_ptr);
|
|
12732
|
+
deferred1_0 = ret[0];
|
|
12733
|
+
deferred1_1 = ret[1];
|
|
12734
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
12735
|
+
} finally {
|
|
12736
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
12737
|
+
}
|
|
12738
|
+
}
|
|
12739
|
+
set map(arg0) {
|
|
12740
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12741
|
+
const len0 = WASM_VECTOR_LEN;
|
|
12742
|
+
wasm.__wbg_set_codemappair_map(this.__wbg_ptr, ptr0, len0);
|
|
12743
|
+
}
|
|
12744
|
+
constructor(code, map) {
|
|
12745
|
+
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12746
|
+
const len0 = WASM_VECTOR_LEN;
|
|
12747
|
+
const ptr1 = passStringToWasm0(map, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12748
|
+
const len1 = WASM_VECTOR_LEN;
|
|
12749
|
+
const ret = wasm.codemappair_new(ptr0, len0, ptr1, len1);
|
|
12750
|
+
this.__wbg_ptr = ret >>> 0;
|
|
12751
|
+
CodeMapPairFinalization.register(this, this.__wbg_ptr, this);
|
|
12752
|
+
return this;
|
|
12753
|
+
}
|
|
12754
|
+
}
|
|
12755
|
+
exports.CodeMapPair = CodeMapPair;
|
|
12756
|
+
var PreprocessorFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((ptr2) => wasm.__wbg_preprocessor_free(ptr2 >>> 0, 1));
|
|
12757
|
+
|
|
12758
|
+
class Preprocessor {
|
|
12759
|
+
__destroy_into_raw() {
|
|
12760
|
+
const ptr2 = this.__wbg_ptr;
|
|
12761
|
+
this.__wbg_ptr = 0;
|
|
12762
|
+
PreprocessorFinalization.unregister(this);
|
|
12763
|
+
return ptr2;
|
|
12764
|
+
}
|
|
12765
|
+
free() {
|
|
12766
|
+
const ptr2 = this.__destroy_into_raw();
|
|
12767
|
+
wasm.__wbg_preprocessor_free(ptr2, 0);
|
|
12768
|
+
}
|
|
12769
|
+
constructor() {
|
|
12770
|
+
const ret = wasm.preprocessor_new();
|
|
12771
|
+
this.__wbg_ptr = ret >>> 0;
|
|
12772
|
+
PreprocessorFinalization.register(this, this.__wbg_ptr, this);
|
|
12773
|
+
return this;
|
|
12774
|
+
}
|
|
12775
|
+
process(src, options) {
|
|
12776
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12777
|
+
const len0 = WASM_VECTOR_LEN;
|
|
12778
|
+
const ret = wasm.preprocessor_process(this.__wbg_ptr, ptr0, len0, options);
|
|
12779
|
+
if (ret[2]) {
|
|
12780
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
12781
|
+
}
|
|
12782
|
+
return CodeMapPair.__wrap(ret[0]);
|
|
12783
|
+
}
|
|
12784
|
+
parse(src, options) {
|
|
12785
|
+
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12786
|
+
const len0 = WASM_VECTOR_LEN;
|
|
12787
|
+
const ret = wasm.preprocessor_parse(this.__wbg_ptr, ptr0, len0, options);
|
|
12788
|
+
if (ret[2]) {
|
|
12789
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
12790
|
+
}
|
|
12791
|
+
return takeFromExternrefTable0(ret[0]);
|
|
12792
|
+
}
|
|
12793
|
+
}
|
|
12794
|
+
exports.Preprocessor = Preprocessor;
|
|
12795
|
+
exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
12796
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
12797
|
+
return ret;
|
|
12798
|
+
};
|
|
12799
|
+
exports.__wbg_String_d7c955520b66a733 = function(arg0, arg1) {
|
|
12800
|
+
const ret = String(arg1);
|
|
12801
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12802
|
+
const len1 = WASM_VECTOR_LEN;
|
|
12803
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
12804
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
12805
|
+
};
|
|
12806
|
+
exports.__wbg_Error_58015c683709e145 = typeof Error == "function" ? Error : notDefined("Error");
|
|
12807
|
+
exports.__wbg_Boolean_ef3e29efb4629824 = typeof Boolean == "function" ? Boolean : notDefined("Boolean");
|
|
12808
|
+
exports.__wbg_parse_181a91d066d1f7fe = typeof JSON.parse == "function" ? JSON.parse : notDefined("JSON.parse");
|
|
12809
|
+
exports.__wbindgen_is_object = function(arg0) {
|
|
12810
|
+
const val = arg0;
|
|
12811
|
+
const ret = typeof val === "object" && val !== null;
|
|
12812
|
+
return ret;
|
|
12813
|
+
};
|
|
12814
|
+
exports.__wbg_crypto_c48a774b022d20ac = function(arg0) {
|
|
12815
|
+
const ret = arg0.crypto;
|
|
12816
|
+
return ret;
|
|
12817
|
+
};
|
|
12818
|
+
exports.__wbg_process_298734cf255a885d = function(arg0) {
|
|
12819
|
+
const ret = arg0.process;
|
|
12820
|
+
return ret;
|
|
12821
|
+
};
|
|
12822
|
+
exports.__wbg_versions_e2e78e134e3e5d01 = function(arg0) {
|
|
12823
|
+
const ret = arg0.versions;
|
|
12824
|
+
return ret;
|
|
12825
|
+
};
|
|
12826
|
+
exports.__wbg_node_1cd7a5d853dbea79 = function(arg0) {
|
|
12827
|
+
const ret = arg0.node;
|
|
12828
|
+
return ret;
|
|
12829
|
+
};
|
|
12830
|
+
exports.__wbindgen_is_string = function(arg0) {
|
|
12831
|
+
const ret = typeof arg0 === "string";
|
|
12832
|
+
return ret;
|
|
12833
|
+
};
|
|
12834
|
+
exports.__wbg_require_8f08ceecec0f4fee = function() {
|
|
12835
|
+
return handleError(function() {
|
|
12836
|
+
const ret = module.require;
|
|
12837
|
+
return ret;
|
|
12838
|
+
}, arguments);
|
|
12839
|
+
};
|
|
12840
|
+
exports.__wbg_msCrypto_bcb970640f50a1e8 = function(arg0) {
|
|
12841
|
+
const ret = arg0.msCrypto;
|
|
12842
|
+
return ret;
|
|
12843
|
+
};
|
|
12844
|
+
exports.__wbg_randomFillSync_dc1e9a60c158336d = function() {
|
|
12845
|
+
return handleError(function(arg0, arg1) {
|
|
12846
|
+
arg0.randomFillSync(arg1);
|
|
12847
|
+
}, arguments);
|
|
12848
|
+
};
|
|
12849
|
+
exports.__wbg_getRandomValues_37fa2ca9e4e07fab = function() {
|
|
12850
|
+
return handleError(function(arg0, arg1) {
|
|
12851
|
+
arg0.getRandomValues(arg1);
|
|
12852
|
+
}, arguments);
|
|
12853
|
+
};
|
|
12854
|
+
exports.__wbindgen_is_function = function(arg0) {
|
|
12855
|
+
const ret = typeof arg0 === "function";
|
|
12856
|
+
return ret;
|
|
12857
|
+
};
|
|
12858
|
+
exports.__wbg_self_1ff1d729e9aae938 = function() {
|
|
12859
|
+
return handleError(function() {
|
|
12860
|
+
const ret = self.self;
|
|
12861
|
+
return ret;
|
|
12862
|
+
}, arguments);
|
|
12863
|
+
};
|
|
12864
|
+
exports.__wbg_window_5f4faef6c12b79ec = function() {
|
|
12865
|
+
return handleError(function() {
|
|
12866
|
+
const ret = window.window;
|
|
12867
|
+
return ret;
|
|
12868
|
+
}, arguments);
|
|
12869
|
+
};
|
|
12870
|
+
exports.__wbg_globalThis_1d39714405582d3c = function() {
|
|
12871
|
+
return handleError(function() {
|
|
12872
|
+
const ret = globalThis.globalThis;
|
|
12873
|
+
return ret;
|
|
12874
|
+
}, arguments);
|
|
12875
|
+
};
|
|
12876
|
+
exports.__wbg_global_651f05c6a0944d1c = function() {
|
|
12877
|
+
return handleError(function() {
|
|
12878
|
+
const ret = global.global;
|
|
12879
|
+
return ret;
|
|
12880
|
+
}, arguments);
|
|
12881
|
+
};
|
|
12882
|
+
exports.__wbindgen_is_undefined = function(arg0) {
|
|
12883
|
+
const ret = arg0 === undefined;
|
|
12884
|
+
return ret;
|
|
12885
|
+
};
|
|
12886
|
+
exports.__wbg_newnoargs_581967eacc0e2604 = function(arg0, arg1) {
|
|
12887
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
12888
|
+
return ret;
|
|
12889
|
+
};
|
|
12890
|
+
exports.__wbg_call_cb65541d95d71282 = function() {
|
|
12891
|
+
return handleError(function(arg0, arg1) {
|
|
12892
|
+
const ret = arg0.call(arg1);
|
|
12893
|
+
return ret;
|
|
12894
|
+
}, arguments);
|
|
12895
|
+
};
|
|
12896
|
+
exports.__wbg_call_01734de55d61e11d = function() {
|
|
12897
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
12898
|
+
const ret = arg0.call(arg1, arg2);
|
|
12899
|
+
return ret;
|
|
12900
|
+
}, arguments);
|
|
12901
|
+
};
|
|
12902
|
+
exports.__wbg_get_97b561fb56f034b5 = function() {
|
|
12903
|
+
return handleError(function(arg0, arg1) {
|
|
12904
|
+
const ret = Reflect.get(arg0, arg1);
|
|
12905
|
+
return ret;
|
|
12906
|
+
}, arguments);
|
|
12907
|
+
};
|
|
12908
|
+
exports.__wbg_set_092e06b0f9d71865 = function() {
|
|
12909
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
12910
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
12911
|
+
return ret;
|
|
12912
|
+
}, arguments);
|
|
12913
|
+
};
|
|
12914
|
+
exports.__wbg_buffer_085ec1f694018c4f = function(arg0) {
|
|
12915
|
+
const ret = arg0.buffer;
|
|
12916
|
+
return ret;
|
|
12917
|
+
};
|
|
12918
|
+
exports.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa = function(arg0, arg1, arg2) {
|
|
12919
|
+
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
12920
|
+
return ret;
|
|
12921
|
+
};
|
|
12922
|
+
exports.__wbg_new_8125e318e6245eed = function(arg0) {
|
|
12923
|
+
const ret = new Uint8Array(arg0);
|
|
12924
|
+
return ret;
|
|
12925
|
+
};
|
|
12926
|
+
exports.__wbg_newwithlength_e5d69174d6984cd7 = function(arg0) {
|
|
12927
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
12928
|
+
return ret;
|
|
12929
|
+
};
|
|
12930
|
+
exports.__wbg_subarray_13db269f57aa838d = function(arg0, arg1, arg2) {
|
|
12931
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
12932
|
+
return ret;
|
|
12933
|
+
};
|
|
12934
|
+
exports.__wbg_set_5cf90238115182c3 = function(arg0, arg1, arg2) {
|
|
12935
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
12936
|
+
};
|
|
12937
|
+
exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
12938
|
+
const ret = debugString(arg1);
|
|
12939
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12940
|
+
const len1 = WASM_VECTOR_LEN;
|
|
12941
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
12942
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
12943
|
+
};
|
|
12944
|
+
exports.__wbindgen_throw = function(arg0, arg1) {
|
|
12945
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
12946
|
+
};
|
|
12947
|
+
exports.__wbindgen_memory = function() {
|
|
12948
|
+
const ret = wasm.memory;
|
|
12949
|
+
return ret;
|
|
12950
|
+
};
|
|
12951
|
+
exports.__wbindgen_init_externref_table = function() {
|
|
12952
|
+
const table = wasm.__wbindgen_export_2;
|
|
12953
|
+
const offset = table.grow(4);
|
|
12954
|
+
table.set(0, undefined);
|
|
12955
|
+
table.set(offset + 0, undefined);
|
|
12956
|
+
table.set(offset + 1, null);
|
|
12957
|
+
table.set(offset + 2, true);
|
|
12958
|
+
table.set(offset + 3, false);
|
|
12959
|
+
};
|
|
12960
|
+
var path = __require("path").join(__dirname, "content_tag_bg.wasm");
|
|
12961
|
+
var bytes = __require("fs").readFileSync(path);
|
|
12962
|
+
var wasmModule = new WebAssembly.Module(bytes);
|
|
12963
|
+
var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
12964
|
+
wasm = wasmInstance.exports;
|
|
12965
|
+
exports.__wasm = wasm;
|
|
12966
|
+
wasm.__wbindgen_start();
|
|
12967
|
+
});
|
|
12968
|
+
|
|
12969
|
+
// node_modules/content-tag/pkg/node.cjs
|
|
12970
|
+
var require_node = __commonJS((exports, module) => {
|
|
12971
|
+
var { Preprocessor } = require_content_tag();
|
|
12972
|
+
exports.Preprocessor = Preprocessor;
|
|
12973
|
+
});
|
|
12974
|
+
|
|
12975
|
+
// src/build/compileEmber.ts
|
|
12976
|
+
var exports_compileEmber = {};
|
|
12977
|
+
__export(exports_compileEmber, {
|
|
12978
|
+
getEmberServerCompiledDir: () => getEmberServerCompiledDir,
|
|
12979
|
+
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
12980
|
+
getEmberClientCompiledDir: () => getEmberClientCompiledDir,
|
|
12981
|
+
dirname: () => dirname14,
|
|
12982
|
+
compileEmberFileSource: () => compileEmberFileSource,
|
|
12983
|
+
compileEmberFile: () => compileEmberFile,
|
|
12984
|
+
compileEmber: () => compileEmber,
|
|
12985
|
+
clearEmberCompilerCache: () => clearEmberCompilerCache,
|
|
12986
|
+
basename: () => basename8
|
|
12987
|
+
});
|
|
12988
|
+
import { existsSync as existsSync18 } from "fs";
|
|
12989
|
+
import { mkdir as mkdir6, rm as rm5 } from "fs/promises";
|
|
12990
|
+
import { basename as basename8, dirname as dirname14, extname as extname6, join as join18, resolve as resolve20 } from "path";
|
|
12991
|
+
var {build: bunBuild2, Transpiler: Transpiler3, write: write3, file: file4 } = globalThis.Bun;
|
|
12992
|
+
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
12993
|
+
if (cachedPreprocessor)
|
|
12994
|
+
return cachedPreprocessor;
|
|
12995
|
+
const module = await Promise.resolve().then(() => __toESM(require_node(), 1));
|
|
12996
|
+
cachedPreprocessor = new module.Preprocessor;
|
|
12997
|
+
return cachedPreprocessor;
|
|
12998
|
+
}, transpiler4, isTemplateTagFile = (entry) => {
|
|
12999
|
+
const ext = extname6(entry);
|
|
13000
|
+
return ext === ".gjs" || ext === ".gts";
|
|
13001
|
+
}, rewriteTemplateEvalToScope = (source) => {
|
|
13002
|
+
const importedNames = new Set;
|
|
13003
|
+
const importRegex = /^\s*import\s+(?:type\s+)?(?:(\*\s+as\s+\w+)|(\w+)(?:\s*,\s*\{([^}]+)\})?|\{([^}]+)\})\s+from\s+['"][^'"]+['"]/gm;
|
|
13004
|
+
let match;
|
|
13005
|
+
while ((match = importRegex.exec(source)) !== null) {
|
|
13006
|
+
const [, namespaceImport, defaultImport, namedAfterDefault, named] = match;
|
|
13007
|
+
if (namespaceImport) {
|
|
13008
|
+
const aliasMatch = /\*\s+as\s+(\w+)/.exec(namespaceImport);
|
|
13009
|
+
if (aliasMatch?.[1])
|
|
13010
|
+
importedNames.add(aliasMatch[1]);
|
|
13011
|
+
}
|
|
13012
|
+
if (defaultImport)
|
|
13013
|
+
importedNames.add(defaultImport);
|
|
13014
|
+
const namedList = named ?? namedAfterDefault;
|
|
13015
|
+
if (namedList) {
|
|
13016
|
+
for (const part of namedList.split(",")) {
|
|
13017
|
+
const trimmed = part.trim();
|
|
13018
|
+
if (!trimmed)
|
|
13019
|
+
continue;
|
|
13020
|
+
const asMatch = /\bas\s+(\w+)$/.exec(trimmed);
|
|
13021
|
+
const localName = asMatch ? asMatch[1] : trimmed.replace(/^type\s+/, "");
|
|
13022
|
+
if (localName && /^\w+$/.test(localName)) {
|
|
13023
|
+
importedNames.add(localName);
|
|
13024
|
+
}
|
|
13025
|
+
}
|
|
13026
|
+
}
|
|
13027
|
+
}
|
|
13028
|
+
const scopeObject = importedNames.size === 0 ? "{}" : `{ ${Array.from(importedNames).join(", ")} }`;
|
|
13029
|
+
const evalShim = /eval\s*\(\)\s*\{\s*return\s+eval\(arguments\[0\]\);\s*\}/g;
|
|
13030
|
+
return source.replace(evalShim, `scope() { return ${scopeObject}; }`);
|
|
13031
|
+
}, EMBROIDER_MACROS_SHIM_SOURCE = `const isProd = () => {
|
|
13032
|
+
try {
|
|
13033
|
+
return globalThis.process?.env?.NODE_ENV === 'production';
|
|
13034
|
+
} catch {
|
|
13035
|
+
return false;
|
|
13036
|
+
}
|
|
13037
|
+
};
|
|
13038
|
+
|
|
13039
|
+
export const each = (arr) => {
|
|
13040
|
+
if (!Array.isArray(arr)) {
|
|
13041
|
+
throw new Error('the argument to each() must be an array');
|
|
13042
|
+
}
|
|
13043
|
+
return arr;
|
|
13044
|
+
};
|
|
13045
|
+
export const macroCondition = (predicate) => predicate;
|
|
13046
|
+
export const isDevelopingApp = () => !isProd();
|
|
13047
|
+
export const isTesting = () => false;
|
|
13048
|
+
export const setTesting = () => {};
|
|
13049
|
+
export const dependencySatisfies = () => false;
|
|
13050
|
+
export const appEmberSatisfies = () => false;
|
|
13051
|
+
export const getConfig = () => undefined;
|
|
13052
|
+
export const getOwnConfig = () => undefined;
|
|
13053
|
+
export const getGlobalConfig = () => ({});
|
|
13054
|
+
export const config = () => undefined;
|
|
13055
|
+
export const failBuild = (msg) => { throw new Error('failBuild: ' + msg); };
|
|
13056
|
+
export const moduleExists = () => false;
|
|
13057
|
+
export const importSync = (specifier) => {
|
|
13058
|
+
throw new Error('importSync(' + specifier + '): not supported by the AbsoluteJS Ember adapter \u2014 use dynamic import() instead');
|
|
13059
|
+
};
|
|
13060
|
+
`, createEmberServerResolverPlugin = (cwd, options = {}) => ({
|
|
13061
|
+
name: "absolutejs-ember-server-resolver",
|
|
13062
|
+
setup(build2) {
|
|
13063
|
+
const standalonePackages = new Set([
|
|
13064
|
+
"@glimmer/component",
|
|
13065
|
+
"@glimmer/tracking",
|
|
13066
|
+
"@glimmer/env",
|
|
13067
|
+
"@simple-dom/serializer"
|
|
13068
|
+
]);
|
|
13069
|
+
build2.onResolve({ filter: /^@embroider\/macros$/ }, () => ({
|
|
13070
|
+
namespace: "absolutejs-ember-virtual",
|
|
13071
|
+
path: "embroider-macros-shim"
|
|
13072
|
+
}));
|
|
13073
|
+
build2.onLoad({
|
|
13074
|
+
filter: /^embroider-macros-shim$/,
|
|
13075
|
+
namespace: "absolutejs-ember-virtual"
|
|
13076
|
+
}, () => ({
|
|
13077
|
+
contents: EMBROIDER_MACROS_SHIM_SOURCE,
|
|
13078
|
+
loader: "js"
|
|
13079
|
+
}));
|
|
13080
|
+
const stagedSourceMap = options.stagedSourceMap;
|
|
13081
|
+
if (stagedSourceMap && stagedSourceMap.size > 0) {
|
|
13082
|
+
build2.onResolve({ filter: /^\.{1,2}\// }, (args) => {
|
|
13083
|
+
const originalImporter = stagedSourceMap.get(args.importer);
|
|
13084
|
+
if (!originalImporter)
|
|
13085
|
+
return;
|
|
13086
|
+
const candidateBase = resolve20(dirname14(originalImporter), args.path);
|
|
13087
|
+
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
13088
|
+
for (const ext of extensionsToTry) {
|
|
13089
|
+
const candidate = candidateBase + ext;
|
|
13090
|
+
if (existsSync18(candidate))
|
|
13091
|
+
return { path: candidate };
|
|
13092
|
+
}
|
|
13093
|
+
return;
|
|
13094
|
+
});
|
|
13095
|
+
}
|
|
13096
|
+
build2.onLoad({ filter: /\.(gts|gjs)$/ }, async (args) => {
|
|
13097
|
+
const source = await file4(args.path).text();
|
|
13098
|
+
const preprocessor = await getPreprocessor();
|
|
13099
|
+
const result = preprocessor.process(source, {
|
|
13100
|
+
filename: args.path
|
|
13101
|
+
});
|
|
13102
|
+
const rewritten = rewriteTemplateEvalToScope(result.code);
|
|
13103
|
+
const transpiled = transpiler4.transformSync(rewritten);
|
|
13104
|
+
return { contents: transpiled, loader: "js" };
|
|
13105
|
+
});
|
|
13106
|
+
build2.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
13107
|
+
if (standalonePackages.has(args.path))
|
|
13108
|
+
return;
|
|
13109
|
+
const internal = join18(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
13110
|
+
if (existsSync18(internal))
|
|
13111
|
+
return { path: internal };
|
|
13112
|
+
return;
|
|
13113
|
+
});
|
|
13114
|
+
}
|
|
13115
|
+
}), generateServerHarness = (pageModulePath) => `import PageComponent from ${JSON.stringify(pageModulePath)};
|
|
13116
|
+
import { renderComponent } from '@ember/renderer';
|
|
13117
|
+
import Document from '@simple-dom/document';
|
|
13118
|
+
import Serializer from '@simple-dom/serializer';
|
|
13119
|
+
|
|
13120
|
+
const installSimpleDomGlobals = () => {
|
|
13121
|
+
const g = globalThis;
|
|
13122
|
+
if (typeof g.Element === 'undefined') g.Element = class Element {};
|
|
13123
|
+
if (typeof g.Node === 'undefined') g.Node = class Node {};
|
|
13124
|
+
};
|
|
13125
|
+
|
|
13126
|
+
export const renderToHTML = (props = {}) => {
|
|
13127
|
+
installSimpleDomGlobals();
|
|
13128
|
+
const doc = new Document();
|
|
13129
|
+
const root = doc.createElement('div');
|
|
13130
|
+
const result = renderComponent(PageComponent, {
|
|
13131
|
+
owner: {},
|
|
13132
|
+
env: { document: doc, hasDOM: true, isInteractive: false },
|
|
13133
|
+
into: root,
|
|
13134
|
+
args: props,
|
|
13135
|
+
});
|
|
13136
|
+
const serializer = new Serializer({});
|
|
13137
|
+
const html = serializer.serialize(root);
|
|
13138
|
+
result?.destroy?.();
|
|
13139
|
+
return html;
|
|
13140
|
+
};
|
|
13141
|
+
|
|
13142
|
+
export { PageComponent };
|
|
13143
|
+
export default PageComponent;
|
|
13144
|
+
`, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
|
|
13145
|
+
const resolvedEntry = resolve20(entry);
|
|
13146
|
+
const source = await file4(resolvedEntry).text();
|
|
13147
|
+
let preprocessed = source;
|
|
13148
|
+
if (isTemplateTagFile(resolvedEntry)) {
|
|
13149
|
+
const preprocessor = await getPreprocessor();
|
|
13150
|
+
const result = preprocessor.process(source, {
|
|
13151
|
+
filename: resolvedEntry
|
|
13152
|
+
});
|
|
13153
|
+
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
13154
|
+
}
|
|
13155
|
+
const transpiled = transpiler4.transformSync(preprocessed);
|
|
13156
|
+
const baseName = basename8(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
13157
|
+
const tmpDir = join18(compiledRoot, "_tmp");
|
|
13158
|
+
const serverDir = join18(compiledRoot, "server");
|
|
13159
|
+
const clientDir = join18(compiledRoot, "client");
|
|
13160
|
+
await Promise.all([
|
|
13161
|
+
mkdir6(tmpDir, { recursive: true }),
|
|
13162
|
+
mkdir6(serverDir, { recursive: true }),
|
|
13163
|
+
mkdir6(clientDir, { recursive: true })
|
|
13164
|
+
]);
|
|
13165
|
+
const tmpPagePath = resolve20(join18(tmpDir, `${baseName}.module.js`));
|
|
13166
|
+
const tmpHarnessPath = resolve20(join18(tmpDir, `${baseName}.harness.js`));
|
|
13167
|
+
await Promise.all([
|
|
13168
|
+
write3(tmpPagePath, transpiled),
|
|
13169
|
+
write3(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
13170
|
+
]);
|
|
13171
|
+
const stagedSourceMap = new Map([
|
|
13172
|
+
[tmpPagePath, resolvedEntry]
|
|
13173
|
+
]);
|
|
13174
|
+
const serverPath = join18(serverDir, `${baseName}.js`);
|
|
13175
|
+
const buildResult = await bunBuild2({
|
|
13176
|
+
entrypoints: [tmpHarnessPath],
|
|
13177
|
+
format: "esm",
|
|
13178
|
+
minify: false,
|
|
13179
|
+
naming: `${baseName}.js`,
|
|
13180
|
+
outdir: serverDir,
|
|
13181
|
+
plugins: [
|
|
13182
|
+
createEmberServerResolverPlugin(cwd, { stagedSourceMap })
|
|
13183
|
+
],
|
|
13184
|
+
target: "bun",
|
|
13185
|
+
throw: false
|
|
13186
|
+
});
|
|
13187
|
+
if (!buildResult.success) {
|
|
13188
|
+
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
13189
|
+
}
|
|
13190
|
+
await rm5(tmpDir, { force: true, recursive: true });
|
|
13191
|
+
const clientPath = join18(clientDir, `${baseName}.js`);
|
|
13192
|
+
await write3(clientPath, transpiled);
|
|
13193
|
+
return { clientPath, serverPath };
|
|
13194
|
+
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
13195
|
+
if (entries.length === 0) {
|
|
13196
|
+
return {
|
|
13197
|
+
clientPaths: [],
|
|
13198
|
+
serverPaths: []
|
|
13199
|
+
};
|
|
13200
|
+
}
|
|
13201
|
+
const compiledRoot = join18(emberDir, "generated");
|
|
13202
|
+
const outputs = await Promise.all(entries.map((entry) => compileEmberFile(entry, compiledRoot, cwd)));
|
|
13203
|
+
return {
|
|
13204
|
+
clientPaths: outputs.map((o) => o.clientPath),
|
|
13205
|
+
serverPaths: outputs.map((o) => o.serverPath)
|
|
13206
|
+
};
|
|
13207
|
+
}, compileEmberFileSource = async (entry) => {
|
|
13208
|
+
const resolvedEntry = resolve20(entry);
|
|
13209
|
+
const source = await file4(resolvedEntry).text();
|
|
13210
|
+
let preprocessed = source;
|
|
13211
|
+
if (isTemplateTagFile(resolvedEntry)) {
|
|
13212
|
+
const preprocessor = await getPreprocessor();
|
|
13213
|
+
const result = preprocessor.process(source, {
|
|
13214
|
+
filename: resolvedEntry
|
|
13215
|
+
});
|
|
13216
|
+
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
13217
|
+
}
|
|
13218
|
+
return transpiler4.transformSync(preprocessed);
|
|
13219
|
+
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (emberDir) => join18(emberDir, "generated"), getEmberServerCompiledDir = (emberDir) => join18(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join18(getEmberCompiledRoot(emberDir), "client");
|
|
13220
|
+
var init_compileEmber = __esm(() => {
|
|
13221
|
+
transpiler4 = new Transpiler3({
|
|
13222
|
+
loader: "ts",
|
|
13223
|
+
target: "browser",
|
|
13224
|
+
tsconfig: JSON.stringify({
|
|
13225
|
+
compilerOptions: {
|
|
13226
|
+
experimentalDecorators: true,
|
|
13227
|
+
useDefineForClassFields: false
|
|
13228
|
+
}
|
|
13229
|
+
})
|
|
13230
|
+
});
|
|
13231
|
+
});
|
|
13232
|
+
|
|
12468
13233
|
// src/build/buildReactVendor.ts
|
|
12469
13234
|
var exports_buildReactVendor = {};
|
|
12470
13235
|
__export(exports_buildReactVendor, {
|
|
12471
13236
|
computeVendorPaths: () => computeVendorPaths,
|
|
12472
13237
|
buildReactVendor: () => buildReactVendor
|
|
12473
13238
|
});
|
|
12474
|
-
import { existsSync as
|
|
12475
|
-
import { join as
|
|
12476
|
-
import { rm as
|
|
12477
|
-
var {build:
|
|
13239
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync6 } from "fs";
|
|
13240
|
+
import { join as join19, resolve as resolve21 } from "path";
|
|
13241
|
+
import { rm as rm6 } from "fs/promises";
|
|
13242
|
+
var {build: bunBuild3 } = globalThis.Bun;
|
|
12478
13243
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
12479
13244
|
const candidates = [
|
|
12480
|
-
|
|
12481
|
-
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
|
|
12485
|
-
|
|
13245
|
+
resolve21(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
13246
|
+
resolve21(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13247
|
+
resolve21(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
13248
|
+
resolve21(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13249
|
+
resolve21(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
13250
|
+
resolve21(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
12486
13251
|
];
|
|
12487
13252
|
for (const candidate of candidates) {
|
|
12488
|
-
if (
|
|
13253
|
+
if (existsSync19(candidate)) {
|
|
12489
13254
|
return candidate.replace(/\\/g, "/");
|
|
12490
13255
|
}
|
|
12491
13256
|
}
|
|
12492
|
-
return (candidates[0] ??
|
|
13257
|
+
return (candidates[0] ?? resolve21(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
12493
13258
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
12494
13259
|
try {
|
|
12495
13260
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -12526,19 +13291,19 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
12526
13291
|
`)}
|
|
12527
13292
|
`;
|
|
12528
13293
|
}, buildReactVendor = async (buildDir) => {
|
|
12529
|
-
const vendorDir =
|
|
13294
|
+
const vendorDir = join19(buildDir, "react", "vendor");
|
|
12530
13295
|
mkdirSync6(vendorDir, { recursive: true });
|
|
12531
|
-
const tmpDir =
|
|
13296
|
+
const tmpDir = join19(buildDir, "_vendor_tmp");
|
|
12532
13297
|
mkdirSync6(tmpDir, { recursive: true });
|
|
12533
13298
|
const specifiers = resolveVendorSpecifiers();
|
|
12534
13299
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12535
13300
|
const safeName = toSafeFileName(specifier);
|
|
12536
|
-
const entryPath =
|
|
13301
|
+
const entryPath = join19(tmpDir, `${safeName}.ts`);
|
|
12537
13302
|
const source = await generateEntrySource(specifier);
|
|
12538
13303
|
await Bun.write(entryPath, source);
|
|
12539
13304
|
return entryPath;
|
|
12540
13305
|
}));
|
|
12541
|
-
const result = await
|
|
13306
|
+
const result = await bunBuild3({
|
|
12542
13307
|
entrypoints,
|
|
12543
13308
|
format: "esm",
|
|
12544
13309
|
minify: false,
|
|
@@ -12548,7 +13313,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
12548
13313
|
target: "browser",
|
|
12549
13314
|
throw: false
|
|
12550
13315
|
});
|
|
12551
|
-
await
|
|
13316
|
+
await rm6(tmpDir, { force: true, recursive: true });
|
|
12552
13317
|
if (!result.success) {
|
|
12553
13318
|
console.warn("\u26A0\uFE0F React vendor build had errors:", result.logs);
|
|
12554
13319
|
}
|
|
@@ -12565,10 +13330,25 @@ var init_buildReactVendor = __esm(() => {
|
|
|
12565
13330
|
});
|
|
12566
13331
|
|
|
12567
13332
|
// src/build/vendorEntrySource.ts
|
|
12568
|
-
var generateVendorEntrySource = (specifier) =>
|
|
12569
|
-
|
|
12570
|
-
|
|
13333
|
+
var RESERVED_KEYS, VALID_IDENTIFIER, generateVendorEntrySource = async (specifier) => {
|
|
13334
|
+
const mod = await import(specifier);
|
|
13335
|
+
const exportKeys = Object.keys(mod).filter((key) => !RESERVED_KEYS.has(key) && VALID_IDENTIFIER.test(key));
|
|
13336
|
+
const explicitNamedExports = exportKeys.length > 0 ? `export { ${exportKeys.join(", ")} } from '${specifier}';
|
|
13337
|
+
` : "";
|
|
13338
|
+
return `import * as __abs_ns from '${specifier}';
|
|
13339
|
+
export * from '${specifier}';
|
|
13340
|
+
` + explicitNamedExports + `export default __abs_ns.default;
|
|
13341
|
+
export const __ABSOLUTE_VENDOR_NAMESPACE__ = __abs_ns;
|
|
12571
13342
|
`;
|
|
13343
|
+
};
|
|
13344
|
+
var init_vendorEntrySource = __esm(() => {
|
|
13345
|
+
RESERVED_KEYS = new Set([
|
|
13346
|
+
"default",
|
|
13347
|
+
"__esModule",
|
|
13348
|
+
"__ABSOLUTE_VENDOR_NAMESPACE__"
|
|
13349
|
+
]);
|
|
13350
|
+
VALID_IDENTIFIER = /^[$_a-zA-Z][$_a-zA-Z0-9]*$/;
|
|
13351
|
+
});
|
|
12572
13352
|
|
|
12573
13353
|
// src/build/buildAngularVendor.ts
|
|
12574
13354
|
var exports_buildAngularVendor = {};
|
|
@@ -12581,9 +13361,9 @@ __export(exports_buildAngularVendor, {
|
|
|
12581
13361
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
12582
13362
|
});
|
|
12583
13363
|
import { mkdirSync as mkdirSync7 } from "fs";
|
|
12584
|
-
import { join as
|
|
12585
|
-
import { rm as
|
|
12586
|
-
var {build:
|
|
13364
|
+
import { join as join20 } from "path";
|
|
13365
|
+
import { rm as rm7 } from "fs/promises";
|
|
13366
|
+
var {build: bunBuild4, Glob: Glob6 } = globalThis.Bun;
|
|
12587
13367
|
var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => jitMode ? [...REQUIRED_ANGULAR_SPECIFIERS_BASE, "@angular/compiler"] : REQUIRED_ANGULAR_SPECIFIERS_BASE, SERVER_ONLY_ANGULAR_SPECIFIERS, BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES, isBuildOnlyAngularSpecifier = (spec) => BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES.some((prefix) => spec === prefix || spec.startsWith(`${prefix}/`)), SCAN_SKIP_DIRS, isResolvable2 = (specifier) => {
|
|
12588
13368
|
try {
|
|
12589
13369
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -12594,18 +13374,18 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
12594
13374
|
}, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAngularBrowserSpecifier = (spec) => spec.startsWith("@angular/") && !SERVER_ONLY_ANGULAR_SPECIFIERS.has(spec) && !isBuildOnlyAngularSpecifier(spec), scanSourceImports = async (directories) => {
|
|
12595
13375
|
const angular = new Set;
|
|
12596
13376
|
const transitiveRoots = new Set;
|
|
12597
|
-
const
|
|
13377
|
+
const transpiler5 = new Bun.Transpiler({ loader: "tsx" });
|
|
12598
13378
|
const glob = new Glob6("**/*.{ts,tsx,js,jsx}");
|
|
12599
13379
|
for (const dir of directories) {
|
|
12600
13380
|
try {
|
|
12601
|
-
for await (const
|
|
12602
|
-
const rel =
|
|
13381
|
+
for await (const file5 of glob.scan({ absolute: true, cwd: dir })) {
|
|
13382
|
+
const rel = file5.slice(dir.length + 1);
|
|
12603
13383
|
const [first] = rel.split("/");
|
|
12604
13384
|
if (first && SCAN_SKIP_DIRS.has(first))
|
|
12605
13385
|
continue;
|
|
12606
13386
|
try {
|
|
12607
|
-
const content = await Bun.file(
|
|
12608
|
-
for (const imp of
|
|
13387
|
+
const content = await Bun.file(file5).text();
|
|
13388
|
+
for (const imp of transpiler5.scanImports(content)) {
|
|
12609
13389
|
if (isAngularBrowserSpecifier(imp.path)) {
|
|
12610
13390
|
angular.add(imp.path);
|
|
12611
13391
|
} else if (isBareSpecifier(imp.path)) {
|
|
@@ -12619,7 +13399,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
12619
13399
|
return { angular, transitiveRoots };
|
|
12620
13400
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
12621
13401
|
const { readFileSync: readFileSync13 } = await import("fs");
|
|
12622
|
-
const
|
|
13402
|
+
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
12623
13403
|
const visited = new Set;
|
|
12624
13404
|
const frontier = [];
|
|
12625
13405
|
for (const r of roots)
|
|
@@ -12648,7 +13428,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
12648
13428
|
}
|
|
12649
13429
|
let imports;
|
|
12650
13430
|
try {
|
|
12651
|
-
imports =
|
|
13431
|
+
imports = transpiler5.scanImports(content);
|
|
12652
13432
|
} catch {
|
|
12653
13433
|
continue;
|
|
12654
13434
|
}
|
|
@@ -12678,18 +13458,18 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
12678
13458
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
12679
13459
|
return Array.from(angular).filter(isResolvable2);
|
|
12680
13460
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
12681
|
-
const vendorDir =
|
|
13461
|
+
const vendorDir = join20(buildDir, "angular", "vendor");
|
|
12682
13462
|
mkdirSync7(vendorDir, { recursive: true });
|
|
12683
|
-
const tmpDir =
|
|
13463
|
+
const tmpDir = join20(buildDir, "_angular_vendor_tmp");
|
|
12684
13464
|
mkdirSync7(tmpDir, { recursive: true });
|
|
12685
13465
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
12686
13466
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12687
13467
|
const safeName = toSafeFileName2(specifier);
|
|
12688
|
-
const entryPath =
|
|
12689
|
-
await Bun.write(entryPath, generateVendorEntrySource(specifier));
|
|
13468
|
+
const entryPath = join20(tmpDir, `${safeName}.ts`);
|
|
13469
|
+
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
12690
13470
|
return entryPath;
|
|
12691
13471
|
}));
|
|
12692
|
-
const result = await
|
|
13472
|
+
const result = await bunBuild4({
|
|
12693
13473
|
entrypoints,
|
|
12694
13474
|
external: depVendorSpecifiers,
|
|
12695
13475
|
format: "esm",
|
|
@@ -12701,7 +13481,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
12701
13481
|
target: "browser",
|
|
12702
13482
|
throw: false
|
|
12703
13483
|
});
|
|
12704
|
-
await
|
|
13484
|
+
await rm7(tmpDir, { force: true, recursive: true });
|
|
12705
13485
|
if (!result.success) {
|
|
12706
13486
|
console.warn("\u26A0\uFE0F Angular vendor build had errors:", result.logs);
|
|
12707
13487
|
}
|
|
@@ -12716,9 +13496,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
12716
13496
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
12717
13497
|
return computeAngularVendorPaths(specifiers);
|
|
12718
13498
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
12719
|
-
const vendorDir =
|
|
13499
|
+
const vendorDir = join20(buildDir, "angular", "vendor", "server");
|
|
12720
13500
|
mkdirSync7(vendorDir, { recursive: true });
|
|
12721
|
-
const tmpDir =
|
|
13501
|
+
const tmpDir = join20(buildDir, "_angular_server_vendor_tmp");
|
|
12722
13502
|
mkdirSync7(tmpDir, { recursive: true });
|
|
12723
13503
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
12724
13504
|
const allSpecs = new Set(browserSpecs);
|
|
@@ -12729,11 +13509,11 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
12729
13509
|
const specifiers = Array.from(allSpecs);
|
|
12730
13510
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12731
13511
|
const safeName = toSafeFileName2(specifier);
|
|
12732
|
-
const entryPath =
|
|
12733
|
-
await Bun.write(entryPath, generateVendorEntrySource(specifier));
|
|
13512
|
+
const entryPath = join20(tmpDir, `${safeName}.ts`);
|
|
13513
|
+
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
12734
13514
|
return entryPath;
|
|
12735
13515
|
}));
|
|
12736
|
-
const result = await
|
|
13516
|
+
const result = await bunBuild4({
|
|
12737
13517
|
entrypoints,
|
|
12738
13518
|
format: "esm",
|
|
12739
13519
|
minify: false,
|
|
@@ -12744,16 +13524,16 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
12744
13524
|
target: "bun",
|
|
12745
13525
|
throw: false
|
|
12746
13526
|
});
|
|
12747
|
-
await
|
|
13527
|
+
await rm7(tmpDir, { force: true, recursive: true });
|
|
12748
13528
|
if (!result.success) {
|
|
12749
13529
|
console.warn("\u26A0\uFE0F Angular server vendor build had errors:", result.logs);
|
|
12750
13530
|
}
|
|
12751
13531
|
return specifiers;
|
|
12752
13532
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
12753
13533
|
const paths = {};
|
|
12754
|
-
const vendorDir =
|
|
13534
|
+
const vendorDir = join20(buildDir, "angular", "vendor", "server");
|
|
12755
13535
|
for (const specifier of specifiers) {
|
|
12756
|
-
paths[specifier] =
|
|
13536
|
+
paths[specifier] = join20(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
12757
13537
|
}
|
|
12758
13538
|
return paths;
|
|
12759
13539
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -12767,6 +13547,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
12767
13547
|
};
|
|
12768
13548
|
var init_buildAngularVendor = __esm(() => {
|
|
12769
13549
|
init_angularLinkerPlugin();
|
|
13550
|
+
init_vendorEntrySource();
|
|
12770
13551
|
REQUIRED_ANGULAR_SPECIFIERS_BASE = [
|
|
12771
13552
|
"@angular/core",
|
|
12772
13553
|
"@angular/common",
|
|
@@ -12808,22 +13589,22 @@ __export(exports_buildVueVendor, {
|
|
|
12808
13589
|
buildVueVendor: () => buildVueVendor
|
|
12809
13590
|
});
|
|
12810
13591
|
import { mkdirSync as mkdirSync8 } from "fs";
|
|
12811
|
-
import { join as
|
|
12812
|
-
import { rm as
|
|
12813
|
-
var {build:
|
|
13592
|
+
import { join as join21 } from "path";
|
|
13593
|
+
import { rm as rm8 } from "fs/promises";
|
|
13594
|
+
var {build: bunBuild5 } = globalThis.Bun;
|
|
12814
13595
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
12815
|
-
const vendorDir =
|
|
13596
|
+
const vendorDir = join21(buildDir, "vue", "vendor");
|
|
12816
13597
|
mkdirSync8(vendorDir, { recursive: true });
|
|
12817
|
-
const tmpDir =
|
|
13598
|
+
const tmpDir = join21(buildDir, "_vue_vendor_tmp");
|
|
12818
13599
|
mkdirSync8(tmpDir, { recursive: true });
|
|
12819
13600
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
12820
13601
|
const safeName = toSafeFileName3(specifier);
|
|
12821
|
-
const entryPath =
|
|
13602
|
+
const entryPath = join21(tmpDir, `${safeName}.ts`);
|
|
12822
13603
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
12823
13604
|
`);
|
|
12824
13605
|
return entryPath;
|
|
12825
13606
|
}));
|
|
12826
|
-
const result = await
|
|
13607
|
+
const result = await bunBuild5({
|
|
12827
13608
|
define: {
|
|
12828
13609
|
__VUE_OPTIONS_API__: "true",
|
|
12829
13610
|
__VUE_PROD_DEVTOOLS__: "true",
|
|
@@ -12838,15 +13619,15 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
12838
13619
|
target: "browser",
|
|
12839
13620
|
throw: false
|
|
12840
13621
|
});
|
|
12841
|
-
await
|
|
13622
|
+
await rm8(tmpDir, { force: true, recursive: true });
|
|
12842
13623
|
if (!result.success) {
|
|
12843
13624
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
12844
13625
|
return;
|
|
12845
13626
|
}
|
|
12846
13627
|
const { readFileSync: readFileSync13, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
12847
13628
|
const files = readdirSync(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
12848
|
-
for (const
|
|
12849
|
-
const filePath =
|
|
13629
|
+
for (const file5 of files) {
|
|
13630
|
+
const filePath = join21(vendorDir, file5);
|
|
12850
13631
|
const content = readFileSync13(filePath, "utf-8");
|
|
12851
13632
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
12852
13633
|
continue;
|
|
@@ -12873,9 +13654,9 @@ __export(exports_buildSvelteVendor, {
|
|
|
12873
13654
|
buildSvelteVendor: () => buildSvelteVendor
|
|
12874
13655
|
});
|
|
12875
13656
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
12876
|
-
import { join as
|
|
12877
|
-
import { rm as
|
|
12878
|
-
var {build:
|
|
13657
|
+
import { join as join22 } from "path";
|
|
13658
|
+
import { rm as rm9 } from "fs/promises";
|
|
13659
|
+
var {build: bunBuild6 } = globalThis.Bun;
|
|
12879
13660
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
12880
13661
|
try {
|
|
12881
13662
|
__require.resolve(specifier);
|
|
@@ -12887,18 +13668,18 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
12887
13668
|
const specifiers = resolveVendorSpecifiers2();
|
|
12888
13669
|
if (specifiers.length === 0)
|
|
12889
13670
|
return;
|
|
12890
|
-
const vendorDir =
|
|
13671
|
+
const vendorDir = join22(buildDir, "svelte", "vendor");
|
|
12891
13672
|
mkdirSync9(vendorDir, { recursive: true });
|
|
12892
|
-
const tmpDir =
|
|
13673
|
+
const tmpDir = join22(buildDir, "_svelte_vendor_tmp");
|
|
12893
13674
|
mkdirSync9(tmpDir, { recursive: true });
|
|
12894
13675
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12895
13676
|
const safeName = toSafeFileName4(specifier);
|
|
12896
|
-
const entryPath =
|
|
13677
|
+
const entryPath = join22(tmpDir, `${safeName}.ts`);
|
|
12897
13678
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
12898
13679
|
`);
|
|
12899
13680
|
return entryPath;
|
|
12900
13681
|
}));
|
|
12901
|
-
const result = await
|
|
13682
|
+
const result = await bunBuild6({
|
|
12902
13683
|
entrypoints,
|
|
12903
13684
|
format: "esm",
|
|
12904
13685
|
minify: false,
|
|
@@ -12908,7 +13689,7 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
12908
13689
|
target: "browser",
|
|
12909
13690
|
throw: false
|
|
12910
13691
|
});
|
|
12911
|
-
await
|
|
13692
|
+
await rm9(tmpDir, { force: true, recursive: true });
|
|
12912
13693
|
if (!result.success) {
|
|
12913
13694
|
console.warn("\u26A0\uFE0F Svelte vendor build had errors:", result.logs);
|
|
12914
13695
|
}
|
|
@@ -12966,11 +13747,11 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
|
|
|
12966
13747
|
if (Object.keys(vendorPaths).length === 0)
|
|
12967
13748
|
return;
|
|
12968
13749
|
const { readdirSync } = await import("fs");
|
|
12969
|
-
const { join:
|
|
13750
|
+
const { join: join23 } = await import("path");
|
|
12970
13751
|
const allFiles = [];
|
|
12971
13752
|
for (const dir of vendorDirs) {
|
|
12972
13753
|
try {
|
|
12973
|
-
const files = readdirSync(dir).filter((f2) => f2.endsWith(".js")).map((f2) =>
|
|
13754
|
+
const files = readdirSync(dir).filter((f2) => f2.endsWith(".js")).map((f2) => join23(dir, f2));
|
|
12974
13755
|
allFiles.push(...files);
|
|
12975
13756
|
} catch {}
|
|
12976
13757
|
}
|
|
@@ -13039,16 +13820,16 @@ var init_rewriteImports = __esm(() => {
|
|
|
13039
13820
|
import {
|
|
13040
13821
|
copyFileSync,
|
|
13041
13822
|
cpSync,
|
|
13042
|
-
existsSync as
|
|
13823
|
+
existsSync as existsSync20,
|
|
13043
13824
|
mkdirSync as mkdirSync10,
|
|
13044
13825
|
readFileSync as readFileSync13,
|
|
13045
13826
|
rmSync as rmSync2,
|
|
13046
13827
|
statSync,
|
|
13047
13828
|
writeFileSync as writeFileSync7
|
|
13048
13829
|
} from "fs";
|
|
13049
|
-
import { basename as
|
|
13830
|
+
import { basename as basename9, dirname as dirname15, extname as extname7, join as join23, relative as relative10, resolve as resolve22 } from "path";
|
|
13050
13831
|
import { cwd, env as env3, exit } from "process";
|
|
13051
|
-
var {build:
|
|
13832
|
+
var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
|
|
13052
13833
|
var isDev2, isBuildTraceEnabled = () => {
|
|
13053
13834
|
const value = env3.ABSOLUTE_BUILD_TRACE?.toLowerCase();
|
|
13054
13835
|
return value === "1" || value === "true" || value === "yes";
|
|
@@ -13124,8 +13905,8 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13124
13905
|
mkdirSync10(htmxDestDir, { recursive: true });
|
|
13125
13906
|
const glob = new Glob7("htmx*.min.js");
|
|
13126
13907
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
13127
|
-
const src =
|
|
13128
|
-
const dest =
|
|
13908
|
+
const src = join23(htmxDir, relPath);
|
|
13909
|
+
const dest = join23(htmxDestDir, "htmx.min.js");
|
|
13129
13910
|
copyFileSync(src, dest);
|
|
13130
13911
|
return;
|
|
13131
13912
|
}
|
|
@@ -13137,8 +13918,8 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13137
13918
|
}
|
|
13138
13919
|
}, resolveAbsoluteVersion = async () => {
|
|
13139
13920
|
const candidates = [
|
|
13140
|
-
|
|
13141
|
-
|
|
13921
|
+
resolve22(import.meta.dir, "..", "..", "package.json"),
|
|
13922
|
+
resolve22(import.meta.dir, "..", "package.json")
|
|
13142
13923
|
];
|
|
13143
13924
|
const resolveCandidate = async (remaining) => {
|
|
13144
13925
|
const [candidate, ...rest] = remaining;
|
|
@@ -13153,34 +13934,34 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13153
13934
|
globalThis.__absoluteVersion = pkg.version;
|
|
13154
13935
|
};
|
|
13155
13936
|
await resolveCandidate(candidates);
|
|
13156
|
-
}, SKIP_DIRS, addWorkerPathIfExists = (
|
|
13157
|
-
const absPath =
|
|
13937
|
+
}, SKIP_DIRS, addWorkerPathIfExists = (file5, relPath, workerPaths) => {
|
|
13938
|
+
const absPath = resolve22(file5, "..", relPath);
|
|
13158
13939
|
try {
|
|
13159
13940
|
statSync(absPath);
|
|
13160
13941
|
workerPaths.add(absPath);
|
|
13161
13942
|
} catch {}
|
|
13162
|
-
}, collectWorkerPathsFromContent = (content, pattern,
|
|
13943
|
+
}, collectWorkerPathsFromContent = (content, pattern, file5, workerPaths) => {
|
|
13163
13944
|
pattern.lastIndex = 0;
|
|
13164
13945
|
let match;
|
|
13165
13946
|
while ((match = pattern.exec(content)) !== null) {
|
|
13166
13947
|
const [, relPath] = match;
|
|
13167
13948
|
if (!relPath)
|
|
13168
13949
|
continue;
|
|
13169
|
-
addWorkerPathIfExists(
|
|
13950
|
+
addWorkerPathIfExists(file5, relPath, workerPaths);
|
|
13170
13951
|
}
|
|
13171
|
-
}, collectWorkerPathsFromFile = (
|
|
13172
|
-
const content = readFileSync13(
|
|
13952
|
+
}, collectWorkerPathsFromFile = (file5, patterns, workerPaths) => {
|
|
13953
|
+
const content = readFileSync13(file5, "utf-8");
|
|
13173
13954
|
for (const pattern of patterns) {
|
|
13174
|
-
collectWorkerPathsFromContent(content, pattern,
|
|
13955
|
+
collectWorkerPathsFromContent(content, pattern, file5, workerPaths);
|
|
13175
13956
|
}
|
|
13176
13957
|
}, scanWorkerReferencesInDir = async (dir, patterns, workerPaths) => {
|
|
13177
13958
|
const glob = new Glob7("**/*.{ts,tsx,js,jsx,svelte,vue}");
|
|
13178
|
-
for await (const
|
|
13179
|
-
const relToDir =
|
|
13959
|
+
for await (const file5 of glob.scan({ absolute: true, cwd: dir })) {
|
|
13960
|
+
const relToDir = file5.slice(dir.length + 1);
|
|
13180
13961
|
const [firstSegment] = relToDir.split("/");
|
|
13181
13962
|
if (firstSegment && SKIP_DIRS.has(firstSegment))
|
|
13182
13963
|
continue;
|
|
13183
|
-
collectWorkerPathsFromFile(
|
|
13964
|
+
collectWorkerPathsFromFile(file5, patterns, workerPaths);
|
|
13184
13965
|
}
|
|
13185
13966
|
}, scanWorkerReferences = async (dirs) => {
|
|
13186
13967
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
@@ -13200,7 +13981,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13200
13981
|
vuePagesPath
|
|
13201
13982
|
}) => {
|
|
13202
13983
|
const { readdirSync: readDir } = await import("fs");
|
|
13203
|
-
const devIndexDir =
|
|
13984
|
+
const devIndexDir = join23(buildPath, "_src_indexes");
|
|
13204
13985
|
mkdirSync10(devIndexDir, { recursive: true });
|
|
13205
13986
|
if (reactIndexesPath && reactPagesPath) {
|
|
13206
13987
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -13212,41 +13993,41 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13212
13993
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
13213
13994
|
}
|
|
13214
13995
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
13215
|
-
if (!
|
|
13996
|
+
if (!existsSync20(reactIndexesPath)) {
|
|
13216
13997
|
return;
|
|
13217
13998
|
}
|
|
13218
|
-
const indexFiles = readDir(reactIndexesPath).filter((
|
|
13219
|
-
const pagesRel = relative10(process.cwd(),
|
|
13220
|
-
for (const
|
|
13221
|
-
let content = readFileSync13(
|
|
13999
|
+
const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
|
|
14000
|
+
const pagesRel = relative10(process.cwd(), resolve22(reactPagesPath)).replace(/\\/g, "/");
|
|
14001
|
+
for (const file5 of indexFiles) {
|
|
14002
|
+
let content = readFileSync13(join23(reactIndexesPath, file5), "utf-8");
|
|
13222
14003
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
13223
|
-
writeFileSync7(
|
|
14004
|
+
writeFileSync7(join23(devIndexDir, file5), content);
|
|
13224
14005
|
}
|
|
13225
14006
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
13226
|
-
const svelteIndexDir =
|
|
13227
|
-
const sveltePageEntries = svelteEntries.filter((
|
|
14007
|
+
const svelteIndexDir = join23(svelteDir, "generated", "indexes");
|
|
14008
|
+
const sveltePageEntries = svelteEntries.filter((file5) => resolve22(file5).startsWith(resolve22(sveltePagesPath)));
|
|
13228
14009
|
for (const entry of sveltePageEntries) {
|
|
13229
|
-
const name =
|
|
13230
|
-
const indexFile =
|
|
13231
|
-
if (!
|
|
14010
|
+
const name = basename9(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
14011
|
+
const indexFile = join23(svelteIndexDir, "pages", `${name}.js`);
|
|
14012
|
+
if (!existsSync20(indexFile))
|
|
13232
14013
|
continue;
|
|
13233
14014
|
let content = readFileSync13(indexFile, "utf-8");
|
|
13234
|
-
const srcRel = relative10(process.cwd(),
|
|
14015
|
+
const srcRel = relative10(process.cwd(), resolve22(entry)).replace(/\\/g, "/");
|
|
13235
14016
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
13236
|
-
writeFileSync7(
|
|
14017
|
+
writeFileSync7(join23(devIndexDir, `${name}.svelte.js`), content);
|
|
13237
14018
|
}
|
|
13238
14019
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
13239
|
-
const vueIndexDir =
|
|
13240
|
-
const vuePageEntries = vueEntries.filter((
|
|
14020
|
+
const vueIndexDir = join23(vueDir, "generated", "indexes");
|
|
14021
|
+
const vuePageEntries = vueEntries.filter((file5) => resolve22(file5).startsWith(resolve22(vuePagesPath)));
|
|
13241
14022
|
for (const entry of vuePageEntries) {
|
|
13242
|
-
const name =
|
|
13243
|
-
const indexFile =
|
|
13244
|
-
if (!
|
|
14023
|
+
const name = basename9(entry, ".vue");
|
|
14024
|
+
const indexFile = join23(vueIndexDir, `${name}.js`);
|
|
14025
|
+
if (!existsSync20(indexFile))
|
|
13245
14026
|
continue;
|
|
13246
14027
|
let content = readFileSync13(indexFile, "utf-8");
|
|
13247
|
-
const srcRel = relative10(process.cwd(),
|
|
14028
|
+
const srcRel = relative10(process.cwd(), resolve22(entry)).replace(/\\/g, "/");
|
|
13248
14029
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
13249
|
-
writeFileSync7(
|
|
14030
|
+
writeFileSync7(join23(devIndexDir, `${name}.vue.js`), content);
|
|
13250
14031
|
}
|
|
13251
14032
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
13252
14033
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -13257,7 +14038,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13257
14038
|
const last = allComments[allComments.length - 1];
|
|
13258
14039
|
if (!last?.[1])
|
|
13259
14040
|
return JSON.stringify(outputPath);
|
|
13260
|
-
const srcPath =
|
|
14041
|
+
const srcPath = resolve22(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
13261
14042
|
return JSON.stringify(srcPath);
|
|
13262
14043
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
13263
14044
|
let depth = 0;
|
|
@@ -13320,7 +14101,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13320
14101
|
const urlFileMap = new Map;
|
|
13321
14102
|
for (const srcPath of urlReferencedFiles) {
|
|
13322
14103
|
const rel = relative10(projectRoot, srcPath).replace(/\\/g, "/");
|
|
13323
|
-
const name =
|
|
14104
|
+
const name = basename9(srcPath);
|
|
13324
14105
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
13325
14106
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
13326
14107
|
urlFileMap.set(name, url);
|
|
@@ -13330,11 +14111,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13330
14111
|
}, buildProdUrlFileMap = (urlReferencedFiles, buildPath, nonReactClientOutputs) => {
|
|
13331
14112
|
const urlFileMap = new Map;
|
|
13332
14113
|
for (const srcPath of urlReferencedFiles) {
|
|
13333
|
-
const srcBase =
|
|
13334
|
-
const output = nonReactClientOutputs.find((artifact) =>
|
|
14114
|
+
const srcBase = basename9(srcPath).replace(/\.[^.]+$/, "");
|
|
14115
|
+
const output = nonReactClientOutputs.find((artifact) => basename9(artifact.path).startsWith(`${srcBase}.`));
|
|
13335
14116
|
if (!output)
|
|
13336
14117
|
continue;
|
|
13337
|
-
urlFileMap.set(
|
|
14118
|
+
urlFileMap.set(basename9(srcPath), `/${relative10(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
13338
14119
|
}
|
|
13339
14120
|
return urlFileMap;
|
|
13340
14121
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -13347,7 +14128,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13347
14128
|
let content = readFileSync13(outputPath, "utf-8");
|
|
13348
14129
|
let changed = false;
|
|
13349
14130
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
13350
|
-
const targetName =
|
|
14131
|
+
const targetName = basename9(relPath);
|
|
13351
14132
|
const resolvedPath = urlFileMap.get(targetName);
|
|
13352
14133
|
if (!resolvedPath)
|
|
13353
14134
|
return _match;
|
|
@@ -13406,6 +14187,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13406
14187
|
htmlDirectory,
|
|
13407
14188
|
htmxDirectory,
|
|
13408
14189
|
angularDirectory,
|
|
14190
|
+
emberDirectory,
|
|
13409
14191
|
svelteDirectory,
|
|
13410
14192
|
vueDirectory,
|
|
13411
14193
|
stylesConfig,
|
|
@@ -13467,10 +14249,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13467
14249
|
restoreTracePhase();
|
|
13468
14250
|
return;
|
|
13469
14251
|
}
|
|
13470
|
-
const traceDir =
|
|
14252
|
+
const traceDir = join23(buildPath2, ".absolute-trace");
|
|
13471
14253
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
13472
14254
|
mkdirSync10(traceDir, { recursive: true });
|
|
13473
|
-
writeFileSync7(
|
|
14255
|
+
writeFileSync7(join23(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
13474
14256
|
events: traceEvents,
|
|
13475
14257
|
frameworks: traceFrameworkNames,
|
|
13476
14258
|
generatedAt: new Date().toISOString(),
|
|
@@ -13495,26 +14277,29 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13495
14277
|
const svelteDir = svelteDirectory && validateSafePath(svelteDirectory, projectRoot);
|
|
13496
14278
|
const vueDir = vueDirectory && validateSafePath(vueDirectory, projectRoot);
|
|
13497
14279
|
const angularDir = angularDirectory && validateSafePath(angularDirectory, projectRoot);
|
|
14280
|
+
const emberDir = emberDirectory && validateSafePath(emberDirectory, projectRoot);
|
|
13498
14281
|
const islandBootstrapPath = islands?.bootstrap && validateSafePath(islands.bootstrap, projectRoot);
|
|
13499
14282
|
const islandRegistryPath = islands?.registry && validateSafePath(islands.registry, projectRoot);
|
|
13500
14283
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
13501
14284
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
13502
14285
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
13503
|
-
const reactIndexesPath = reactDir &&
|
|
13504
|
-
const reactPagesPath = reactDir &&
|
|
13505
|
-
const htmlPagesPath = htmlDir &&
|
|
13506
|
-
const htmlScriptsPath = htmlDir &&
|
|
13507
|
-
const sveltePagesPath = svelteDir &&
|
|
13508
|
-
const vuePagesPath = vueDir &&
|
|
13509
|
-
const htmxPagesPath = htmxDir &&
|
|
13510
|
-
const angularPagesPath = angularDir &&
|
|
14286
|
+
const reactIndexesPath = reactDir && join23(reactDir, "generated", "indexes");
|
|
14287
|
+
const reactPagesPath = reactDir && join23(reactDir, "pages");
|
|
14288
|
+
const htmlPagesPath = htmlDir && join23(htmlDir, "pages");
|
|
14289
|
+
const htmlScriptsPath = htmlDir && join23(htmlDir, "scripts");
|
|
14290
|
+
const sveltePagesPath = svelteDir && join23(svelteDir, "pages");
|
|
14291
|
+
const vuePagesPath = vueDir && join23(vueDir, "pages");
|
|
14292
|
+
const htmxPagesPath = htmxDir && join23(htmxDir, "pages");
|
|
14293
|
+
const angularPagesPath = angularDir && join23(angularDir, "pages");
|
|
14294
|
+
const emberPagesPath = emberDir && join23(emberDir, "pages");
|
|
13511
14295
|
const frontends = [
|
|
13512
14296
|
reactDir,
|
|
13513
14297
|
htmlDir,
|
|
13514
14298
|
htmxDir,
|
|
13515
14299
|
svelteDir,
|
|
13516
14300
|
vueDir,
|
|
13517
|
-
angularDir
|
|
14301
|
+
angularDir,
|
|
14302
|
+
emberDir
|
|
13518
14303
|
].filter(Boolean);
|
|
13519
14304
|
const isSingle = frontends.length === 1;
|
|
13520
14305
|
const frameworkNames = [
|
|
@@ -13523,7 +14308,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13523
14308
|
htmxDir && "htmx",
|
|
13524
14309
|
svelteDir && "svelte",
|
|
13525
14310
|
vueDir && "vue",
|
|
13526
|
-
angularDir && "angular"
|
|
14311
|
+
angularDir && "angular",
|
|
14312
|
+
emberDir && "ember"
|
|
13527
14313
|
].filter((name) => Boolean(name));
|
|
13528
14314
|
traceFrameworkNames = frameworkNames;
|
|
13529
14315
|
sendTelemetryEvent("build:start", {
|
|
@@ -13538,19 +14324,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13538
14324
|
htmlDir,
|
|
13539
14325
|
vueDir,
|
|
13540
14326
|
angularDir,
|
|
13541
|
-
islandBootstrapPath &&
|
|
14327
|
+
islandBootstrapPath && dirname15(islandBootstrapPath)
|
|
13542
14328
|
].filter((dir) => Boolean(dir));
|
|
13543
14329
|
const clientRoot = isSingle ? sourceClientRoots[0] ?? projectRoot : commonAncestor(sourceClientRoots, projectRoot);
|
|
13544
14330
|
const serverDirMap = [];
|
|
13545
14331
|
if (svelteDir)
|
|
13546
14332
|
serverDirMap.push({
|
|
13547
14333
|
dir: svelteDir,
|
|
13548
|
-
subdir:
|
|
14334
|
+
subdir: join23("generated", "server")
|
|
13549
14335
|
});
|
|
13550
14336
|
if (vueDir)
|
|
13551
14337
|
serverDirMap.push({
|
|
13552
14338
|
dir: vueDir,
|
|
13553
|
-
subdir:
|
|
14339
|
+
subdir: join23("generated", "server")
|
|
13554
14340
|
});
|
|
13555
14341
|
if (angularDir)
|
|
13556
14342
|
serverDirMap.push({ dir: angularDir, subdir: "generated" });
|
|
@@ -13560,8 +14346,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13560
14346
|
const [firstEntry] = serverDirMap;
|
|
13561
14347
|
if (!firstEntry)
|
|
13562
14348
|
throw new Error("Expected at least one server directory entry");
|
|
13563
|
-
serverRoot =
|
|
13564
|
-
serverOutDir =
|
|
14349
|
+
serverRoot = join23(firstEntry.dir, firstEntry.subdir);
|
|
14350
|
+
serverOutDir = join23(buildPath, basename9(firstEntry.dir));
|
|
13565
14351
|
} else if (serverDirMap.length > 1) {
|
|
13566
14352
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
13567
14353
|
serverOutDir = buildPath;
|
|
@@ -13573,13 +14359,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13573
14359
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
13574
14360
|
if (!isIncremental || !incrementalFiles)
|
|
13575
14361
|
return entryPoints;
|
|
13576
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f2) =>
|
|
14362
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve22(f2)));
|
|
13577
14363
|
const matchingEntries = [];
|
|
13578
14364
|
for (const entry of entryPoints) {
|
|
13579
14365
|
const sourceFile = mapToSource(entry);
|
|
13580
14366
|
if (!sourceFile)
|
|
13581
14367
|
continue;
|
|
13582
|
-
if (!normalizedIncremental.has(
|
|
14368
|
+
if (!normalizedIncremental.has(resolve22(sourceFile)))
|
|
13583
14369
|
continue;
|
|
13584
14370
|
matchingEntries.push(entry);
|
|
13585
14371
|
}
|
|
@@ -13589,7 +14375,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13589
14375
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
13590
14376
|
}
|
|
13591
14377
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
13592
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
14378
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join23(buildPath, "assets"), {
|
|
13593
14379
|
force: true,
|
|
13594
14380
|
recursive: true
|
|
13595
14381
|
}));
|
|
@@ -13607,6 +14393,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13607
14393
|
svelteConventionResult,
|
|
13608
14394
|
vueConventionResult,
|
|
13609
14395
|
angularConventionResult,
|
|
14396
|
+
emberConventionResult,
|
|
13610
14397
|
allGlobalCssEntries
|
|
13611
14398
|
] = await Promise.all([
|
|
13612
14399
|
tailwindPromise,
|
|
@@ -13616,11 +14403,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13616
14403
|
sveltePagesPath ? tracePhase("scan/svelte-conventions", () => scanConventions(sveltePagesPath, "*.svelte")) : emptyConventionResult,
|
|
13617
14404
|
vuePagesPath ? tracePhase("scan/vue-conventions", () => scanConventions(vuePagesPath, "*.vue")) : emptyConventionResult,
|
|
13618
14405
|
angularPagesPath ? tracePhase("scan/angular-conventions", () => scanConventions(angularPagesPath, "*.ts")) : emptyConventionResult,
|
|
14406
|
+
emberPagesPath ? tracePhase("scan/ember-conventions", () => scanConventions(emberPagesPath, "*.{gjs,gts,ts}")) : emptyConventionResult,
|
|
13619
14407
|
stylesDir ? tracePhase("scan/css", () => scanCssEntryPoints(stylesDir, stylesIgnore)) : []
|
|
13620
14408
|
]);
|
|
13621
14409
|
const allSvelteEntries = svelteConventionResult.pageFiles;
|
|
13622
14410
|
const allVueEntries = vueConventionResult.pageFiles;
|
|
13623
14411
|
const allAngularEntries = angularConventionResult.pageFiles;
|
|
14412
|
+
const allEmberEntries = emberConventionResult.pageFiles;
|
|
13624
14413
|
const conventionsMap = {};
|
|
13625
14414
|
if (reactConventionResult.conventions)
|
|
13626
14415
|
conventionsMap.react = reactConventionResult.conventions;
|
|
@@ -13630,15 +14419,17 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13630
14419
|
conventionsMap.vue = vueConventionResult.conventions;
|
|
13631
14420
|
if (angularConventionResult.conventions)
|
|
13632
14421
|
conventionsMap.angular = angularConventionResult.conventions;
|
|
13633
|
-
|
|
14422
|
+
if (emberConventionResult.conventions)
|
|
14423
|
+
conventionsMap.ember = emberConventionResult.conventions;
|
|
14424
|
+
const notFoundFrameworks = ["react", "svelte", "vue", "angular", "ember"].filter((framework) => conventionsMap[framework]?.defaults?.notFound);
|
|
13634
14425
|
if (notFoundFrameworks.length > 1) {
|
|
13635
14426
|
logWarn(`Multiple frameworks define not-found convention files: ${notFoundFrameworks.join(", ")}. Only one will be used (priority: ${notFoundFrameworks[0]}). Remove not-found files from other frameworks to avoid ambiguity.`);
|
|
13636
14427
|
}
|
|
13637
14428
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
13638
14429
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
13639
|
-
if (entry.startsWith(
|
|
13640
|
-
const pageName =
|
|
13641
|
-
return
|
|
14430
|
+
if (entry.startsWith(resolve22(reactIndexesPath))) {
|
|
14431
|
+
const pageName = basename9(entry, ".tsx");
|
|
14432
|
+
return join23(reactPagesPath, `${pageName}.tsx`);
|
|
13642
14433
|
}
|
|
13643
14434
|
return null;
|
|
13644
14435
|
}) : allReactEntries;
|
|
@@ -13646,6 +14437,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13646
14437
|
const svelteEntries = isIncremental ? filterToIncrementalEntries(allSvelteEntries, (entry) => entry) : allSvelteEntries;
|
|
13647
14438
|
const vueEntries = isIncremental ? filterToIncrementalEntries(allVueEntries, (entry) => entry) : allVueEntries;
|
|
13648
14439
|
const angularEntries = isIncremental ? filterToIncrementalEntries(allAngularEntries, (entry) => entry) : allAngularEntries;
|
|
14440
|
+
const emberEntries = isIncremental ? filterToIncrementalEntries(allEmberEntries, (entry) => entry) : allEmberEntries;
|
|
13649
14441
|
const globalCssEntries = isIncremental ? filterToIncrementalEntries(allGlobalCssEntries, (entry) => entry) : allGlobalCssEntries;
|
|
13650
14442
|
const hmrClientBundlePromise = hmr && (htmlDir || htmxDir) ? buildHMRClient() : undefined;
|
|
13651
14443
|
const allFrameworkDirs = [
|
|
@@ -13660,6 +14452,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13660
14452
|
const shouldCompileSvelte = svelteDir && svelteEntries.length > 0;
|
|
13661
14453
|
const shouldCompileVue = vueDir && vueEntries.length > 0;
|
|
13662
14454
|
const shouldCompileAngular = angularDir && angularEntries.length > 0;
|
|
14455
|
+
const shouldCompileEmber = emberDir && emberEntries.length > 0;
|
|
13663
14456
|
const emptyStringArray = [];
|
|
13664
14457
|
const islandBuildInfo = islandRegistryPath ? await tracePhase("islands/registry", () => loadIslandRegistryBuildInfo(islandRegistryPath)) : null;
|
|
13665
14458
|
const islandFrameworkSources = islandBuildInfo ? collectIslandFrameworkSources(islandBuildInfo) : {};
|
|
@@ -13673,6 +14466,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13673
14466
|
{ svelteServerPaths, svelteIndexPaths, svelteClientPaths },
|
|
13674
14467
|
{ vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths },
|
|
13675
14468
|
{ clientPaths: angularClientPaths, serverPaths: angularServerPaths },
|
|
14469
|
+
{ clientPaths: emberClientPaths, serverPaths: emberServerPaths },
|
|
13676
14470
|
{ svelteClientPaths: islandSvelteClientPaths },
|
|
13677
14471
|
{ vueClientPaths: islandVueClientPaths },
|
|
13678
14472
|
{ clientPaths: islandAngularClientPaths }
|
|
@@ -13692,6 +14486,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13692
14486
|
clientPaths: [...emptyStringArray],
|
|
13693
14487
|
serverPaths: [...emptyStringArray]
|
|
13694
14488
|
},
|
|
14489
|
+
shouldCompileEmber ? tracePhase("compile/ember", () => Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber)).then((mod) => mod.compileEmber(emberEntries, emberDir, projectRoot, hmr))) : {
|
|
14490
|
+
clientPaths: [...emptyStringArray],
|
|
14491
|
+
serverPaths: [...emptyStringArray]
|
|
14492
|
+
},
|
|
13695
14493
|
shouldCompileIslandSvelte ? tracePhase("compile/island-svelte", () => Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr, styleTransformConfig))) : {
|
|
13696
14494
|
svelteClientPaths: [...emptyStringArray]
|
|
13697
14495
|
},
|
|
@@ -13708,7 +14506,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13708
14506
|
const clientPath = islandSvelteClientPaths[idx];
|
|
13709
14507
|
if (!sourcePath || !clientPath)
|
|
13710
14508
|
continue;
|
|
13711
|
-
islandSvelteClientPathMap.set(
|
|
14509
|
+
islandSvelteClientPathMap.set(resolve22(sourcePath), clientPath);
|
|
13712
14510
|
}
|
|
13713
14511
|
const islandVueClientPathMap = new Map;
|
|
13714
14512
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -13716,7 +14514,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13716
14514
|
const clientPath = islandVueClientPaths[idx];
|
|
13717
14515
|
if (!sourcePath || !clientPath)
|
|
13718
14516
|
continue;
|
|
13719
|
-
islandVueClientPathMap.set(
|
|
14517
|
+
islandVueClientPathMap.set(resolve22(sourcePath), clientPath);
|
|
13720
14518
|
}
|
|
13721
14519
|
const islandAngularClientPathMap = new Map;
|
|
13722
14520
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -13724,7 +14522,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13724
14522
|
const clientPath = islandAngularClientPaths[idx];
|
|
13725
14523
|
if (!sourcePath || !clientPath)
|
|
13726
14524
|
continue;
|
|
13727
|
-
islandAngularClientPathMap.set(
|
|
14525
|
+
islandAngularClientPathMap.set(resolve22(sourcePath), clientPath);
|
|
13728
14526
|
}
|
|
13729
14527
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
13730
14528
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -13735,7 +14533,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13735
14533
|
const compileReactConventions = async () => {
|
|
13736
14534
|
if (reactConventionSources.length === 0)
|
|
13737
14535
|
return emptyStringArray;
|
|
13738
|
-
const destDir =
|
|
14536
|
+
const destDir = join23(buildPath, "conventions", "react");
|
|
13739
14537
|
rmSync2(destDir, { force: true, recursive: true });
|
|
13740
14538
|
mkdirSync10(destDir, { recursive: true });
|
|
13741
14539
|
const destPaths = [];
|
|
@@ -13743,7 +14541,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13743
14541
|
const source = reactConventionSources[idx];
|
|
13744
14542
|
if (!source)
|
|
13745
14543
|
continue;
|
|
13746
|
-
const result = await
|
|
14544
|
+
const result = await bunBuild7({
|
|
13747
14545
|
entrypoints: [source],
|
|
13748
14546
|
format: "esm",
|
|
13749
14547
|
jsx: { development: false },
|
|
@@ -13751,7 +14549,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13751
14549
|
naming: `${idx}-[name].[ext]`,
|
|
13752
14550
|
outdir: destDir,
|
|
13753
14551
|
plugins: [stylePreprocessorPlugin2],
|
|
13754
|
-
root:
|
|
14552
|
+
root: dirname15(source),
|
|
13755
14553
|
target: "bun",
|
|
13756
14554
|
throw: false,
|
|
13757
14555
|
tsconfig: "./tsconfig.json"
|
|
@@ -13779,7 +14577,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13779
14577
|
angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
|
|
13780
14578
|
]);
|
|
13781
14579
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
13782
|
-
const destDir =
|
|
14580
|
+
const destDir = join23(buildPath, "conventions", framework);
|
|
13783
14581
|
rmSync2(destDir, { force: true, recursive: true });
|
|
13784
14582
|
mkdirSync10(destDir, { recursive: true });
|
|
13785
14583
|
const destPaths = [];
|
|
@@ -13787,8 +14585,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13787
14585
|
const compiledPath = compiledPaths[idx];
|
|
13788
14586
|
if (!compiledPath)
|
|
13789
14587
|
continue;
|
|
13790
|
-
const name =
|
|
13791
|
-
const result = await
|
|
14588
|
+
const name = basename9(compiledPath).replace(/\.[^.]+$/, "");
|
|
14589
|
+
const result = await bunBuild7({
|
|
13792
14590
|
entrypoints: [compiledPath],
|
|
13793
14591
|
format: "esm",
|
|
13794
14592
|
minify: !isDev2,
|
|
@@ -13852,7 +14650,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13852
14650
|
}
|
|
13853
14651
|
})) : {
|
|
13854
14652
|
entries: [],
|
|
13855
|
-
generatedRoot:
|
|
14653
|
+
generatedRoot: join23(buildPath, "_island_entries")
|
|
13856
14654
|
};
|
|
13857
14655
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
13858
14656
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -13888,7 +14686,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13888
14686
|
return {};
|
|
13889
14687
|
}
|
|
13890
14688
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
13891
|
-
const refreshEntry =
|
|
14689
|
+
const refreshEntry = join23(reactIndexesPath, "_refresh.tsx");
|
|
13892
14690
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
13893
14691
|
reactClientEntryPoints.push(refreshEntry);
|
|
13894
14692
|
}
|
|
@@ -13992,19 +14790,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13992
14790
|
throw: false
|
|
13993
14791
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
13994
14792
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
13995
|
-
rmSync2(
|
|
14793
|
+
rmSync2(join23(buildPath, "react", "generated", "indexes"), {
|
|
13996
14794
|
force: true,
|
|
13997
14795
|
recursive: true
|
|
13998
14796
|
});
|
|
13999
14797
|
}
|
|
14000
14798
|
if (angularDir && angularClientPaths.length > 0) {
|
|
14001
|
-
rmSync2(
|
|
14799
|
+
rmSync2(join23(buildPath, "angular", "indexes"), {
|
|
14002
14800
|
force: true,
|
|
14003
14801
|
recursive: true
|
|
14004
14802
|
});
|
|
14005
14803
|
}
|
|
14006
14804
|
if (islandClientEntryPoints.length > 0) {
|
|
14007
|
-
rmSync2(
|
|
14805
|
+
rmSync2(join23(buildPath, "islands"), {
|
|
14008
14806
|
force: true,
|
|
14009
14807
|
recursive: true
|
|
14010
14808
|
});
|
|
@@ -14017,7 +14815,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14017
14815
|
globalCssResult,
|
|
14018
14816
|
vueCssResult
|
|
14019
14817
|
] = await Promise.all([
|
|
14020
|
-
serverEntryPoints.length > 0 ? tracePhase("bun/server", () =>
|
|
14818
|
+
serverEntryPoints.length > 0 ? tracePhase("bun/server", () => bunBuild7(mergeBunBuildConfig({
|
|
14021
14819
|
conditions: svelteResolveConditions,
|
|
14022
14820
|
entrypoints: serverEntryPoints,
|
|
14023
14821
|
external: serverBuildExternals,
|
|
@@ -14030,8 +14828,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14030
14828
|
throw: false,
|
|
14031
14829
|
tsconfig: "./tsconfig.json"
|
|
14032
14830
|
}, resolveBunBuildOverride(bunBuildConfig, "server")))) : undefined,
|
|
14033
|
-
reactBuildConfig ? tracePhase("bun/react-client", () =>
|
|
14034
|
-
nonReactClientEntryPoints.length > 0 ? tracePhase("bun/non-react-client", () =>
|
|
14831
|
+
reactBuildConfig ? tracePhase("bun/react-client", () => bunBuild7(reactBuildConfig)) : undefined,
|
|
14832
|
+
nonReactClientEntryPoints.length > 0 ? tracePhase("bun/non-react-client", () => bunBuild7(mergeBunBuildConfig({
|
|
14035
14833
|
conditions: svelteResolveConditions,
|
|
14036
14834
|
define: vueDirectory ? vueFeatureFlags : undefined,
|
|
14037
14835
|
entrypoints: nonReactClientEntryPoints,
|
|
@@ -14051,7 +14849,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14051
14849
|
throw: false,
|
|
14052
14850
|
tsconfig: "./tsconfig.json"
|
|
14053
14851
|
}, resolveBunBuildOverride(bunBuildConfig, "nonReactClient")))) : undefined,
|
|
14054
|
-
islandClientEntryPoints.length > 0 ? tracePhase("bun/island-client", () =>
|
|
14852
|
+
islandClientEntryPoints.length > 0 ? tracePhase("bun/island-client", () => bunBuild7(mergeBunBuildConfig({
|
|
14055
14853
|
conditions: svelteResolveConditions,
|
|
14056
14854
|
define: vueDirectory ? vueFeatureFlags : undefined,
|
|
14057
14855
|
entrypoints: islandClientEntryPoints,
|
|
@@ -14070,19 +14868,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14070
14868
|
throw: false,
|
|
14071
14869
|
tsconfig: "./tsconfig.json"
|
|
14072
14870
|
}, resolveBunBuildOverride(bunBuildConfig, "islandClient")))) : undefined,
|
|
14073
|
-
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () =>
|
|
14871
|
+
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
14074
14872
|
entrypoints: globalCssEntries,
|
|
14075
14873
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
14076
|
-
outdir: stylesDir ?
|
|
14874
|
+
outdir: stylesDir ? join23(buildPath, basename9(stylesDir)) : buildPath,
|
|
14077
14875
|
plugins: [stylePreprocessorPlugin2],
|
|
14078
14876
|
root: stylesDir || clientRoot,
|
|
14079
14877
|
target: "browser",
|
|
14080
14878
|
throw: false
|
|
14081
14879
|
}, resolveBunBuildOverride(bunBuildConfig, "globalCss")))) : undefined,
|
|
14082
|
-
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () =>
|
|
14880
|
+
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
14083
14881
|
entrypoints: vueCssPaths,
|
|
14084
14882
|
naming: `[name].[hash].[ext]`,
|
|
14085
|
-
outdir:
|
|
14883
|
+
outdir: join23(buildPath, assetsPath ? basename9(assetsPath) : "assets", "css"),
|
|
14086
14884
|
target: "browser",
|
|
14087
14885
|
throw: false
|
|
14088
14886
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -14150,7 +14948,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14150
14948
|
const { rewriteImports: rewriteImports2 } = await Promise.resolve().then(() => (init_rewriteImports(), exports_rewriteImports));
|
|
14151
14949
|
const jsArtifacts = serverOutputs.filter((artifact) => artifact.path.endsWith(".js"));
|
|
14152
14950
|
await tracePhase("postprocess/server-angular-vendor-imports", () => Promise.all(jsArtifacts.map(async (artifact) => {
|
|
14153
|
-
const fileDir =
|
|
14951
|
+
const fileDir = dirname15(artifact.path);
|
|
14154
14952
|
const relativePaths = {};
|
|
14155
14953
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
14156
14954
|
const rel = relative10(fileDir, absolute);
|
|
@@ -14204,14 +15002,18 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14204
15002
|
], buildPath)
|
|
14205
15003
|
};
|
|
14206
15004
|
for (const artifact of serverOutputs) {
|
|
14207
|
-
if (
|
|
15005
|
+
if (extname7(artifact.path) !== ".js")
|
|
14208
15006
|
continue;
|
|
14209
|
-
const fileWithHash =
|
|
15007
|
+
const fileWithHash = basename9(artifact.path);
|
|
14210
15008
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
14211
15009
|
if (!baseName)
|
|
14212
15010
|
continue;
|
|
14213
15011
|
manifest[toPascal(baseName)] = artifact.path;
|
|
14214
15012
|
}
|
|
15013
|
+
for (const serverPath of emberServerPaths) {
|
|
15014
|
+
const fileBase = basename9(serverPath, ".js");
|
|
15015
|
+
manifest[toPascal(fileBase)] = serverPath;
|
|
15016
|
+
}
|
|
14215
15017
|
const shouldCopyHtmx = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/htmx/") && f2.endsWith(".html"));
|
|
14216
15018
|
const shouldUpdateHtmlAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
14217
15019
|
const shouldUpdateHtmxAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/htmx/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
@@ -14230,7 +15032,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14230
15032
|
const processHtmlPages = async () => {
|
|
14231
15033
|
if (!(htmlDir && htmlPagesPath))
|
|
14232
15034
|
return;
|
|
14233
|
-
const outputHtmlPages = isSingle ?
|
|
15035
|
+
const outputHtmlPages = isSingle ? join23(buildPath, "pages") : join23(buildPath, basename9(htmlDir), "pages");
|
|
14234
15036
|
mkdirSync10(outputHtmlPages, { recursive: true });
|
|
14235
15037
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
14236
15038
|
force: true,
|
|
@@ -14245,21 +15047,21 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14245
15047
|
for (const htmlFile of htmlPageFiles) {
|
|
14246
15048
|
if (hmr)
|
|
14247
15049
|
injectHMRIntoHTMLFile(htmlFile, "html");
|
|
14248
|
-
const fileName =
|
|
15050
|
+
const fileName = basename9(htmlFile, ".html");
|
|
14249
15051
|
manifest[fileName] = htmlFile;
|
|
14250
15052
|
}
|
|
14251
15053
|
};
|
|
14252
15054
|
const processHtmxPages = async () => {
|
|
14253
15055
|
if (!(htmxDir && htmxPagesPath))
|
|
14254
15056
|
return;
|
|
14255
|
-
const outputHtmxPages = isSingle ?
|
|
15057
|
+
const outputHtmxPages = isSingle ? join23(buildPath, "pages") : join23(buildPath, basename9(htmxDir), "pages");
|
|
14256
15058
|
mkdirSync10(outputHtmxPages, { recursive: true });
|
|
14257
15059
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
14258
15060
|
force: true,
|
|
14259
15061
|
recursive: true
|
|
14260
15062
|
});
|
|
14261
15063
|
if (shouldCopyHtmx) {
|
|
14262
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
15064
|
+
const htmxDestDir = isSingle ? buildPath : join23(buildPath, basename9(htmxDir));
|
|
14263
15065
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
14264
15066
|
}
|
|
14265
15067
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -14271,7 +15073,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14271
15073
|
for (const htmxFile of htmxPageFiles) {
|
|
14272
15074
|
if (hmr)
|
|
14273
15075
|
injectHMRIntoHTMLFile(htmxFile, "htmx");
|
|
14274
|
-
const fileName =
|
|
15076
|
+
const fileName = basename9(htmxFile, ".html");
|
|
14275
15077
|
manifest[fileName] = htmxFile;
|
|
14276
15078
|
}
|
|
14277
15079
|
};
|
|
@@ -14320,9 +15122,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14320
15122
|
writeBuildTrace(buildPath);
|
|
14321
15123
|
return { conventions: conventionsMap, manifest };
|
|
14322
15124
|
}
|
|
14323
|
-
writeFileSync7(
|
|
15125
|
+
writeFileSync7(join23(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
14324
15126
|
if (Object.keys(conventionsMap).length > 0) {
|
|
14325
|
-
writeFileSync7(
|
|
15127
|
+
writeFileSync7(join23(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
14326
15128
|
}
|
|
14327
15129
|
writeBuildTrace(buildPath);
|
|
14328
15130
|
if (tailwind && mode === "production") {
|
|
@@ -14418,10 +15220,156 @@ var init_build = __esm(() => {
|
|
|
14418
15220
|
};
|
|
14419
15221
|
});
|
|
14420
15222
|
|
|
15223
|
+
// src/build/buildEmberVendor.ts
|
|
15224
|
+
import { mkdirSync as mkdirSync11, existsSync as existsSync21 } from "fs";
|
|
15225
|
+
import { join as join24 } from "path";
|
|
15226
|
+
import { rm as rm10 } from "fs/promises";
|
|
15227
|
+
var {build: bunBuild8 } = globalThis.Bun;
|
|
15228
|
+
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
15229
|
+
// implementations for macros that would normally be replaced at
|
|
15230
|
+
// compile time by Embroider's babel plugin. AbsoluteJS doesn't run
|
|
15231
|
+
// babel, so working defaults are shipped instead.
|
|
15232
|
+
const isProd = () => {
|
|
15233
|
+
try {
|
|
15234
|
+
return globalThis.process?.env?.NODE_ENV === 'production';
|
|
15235
|
+
} catch {
|
|
15236
|
+
return false;
|
|
15237
|
+
}
|
|
15238
|
+
};
|
|
15239
|
+
|
|
15240
|
+
export const each = (arr) => {
|
|
15241
|
+
if (!Array.isArray(arr)) {
|
|
15242
|
+
throw new Error('the argument to each() must be an array');
|
|
15243
|
+
}
|
|
15244
|
+
return arr;
|
|
15245
|
+
};
|
|
15246
|
+
export const macroCondition = (predicate) => predicate;
|
|
15247
|
+
export const isDevelopingApp = () => !isProd();
|
|
15248
|
+
export const isTesting = () => false;
|
|
15249
|
+
export const setTesting = () => {};
|
|
15250
|
+
export const dependencySatisfies = () => false;
|
|
15251
|
+
export const appEmberSatisfies = () => false;
|
|
15252
|
+
export const getConfig = () => undefined;
|
|
15253
|
+
export const getOwnConfig = () => undefined;
|
|
15254
|
+
export const getGlobalConfig = () => ({});
|
|
15255
|
+
export const config = () => undefined;
|
|
15256
|
+
export const failBuild = (msg) => { throw new Error('failBuild: ' + msg); };
|
|
15257
|
+
export const moduleExists = () => false;
|
|
15258
|
+
export const importSync = (specifier) => {
|
|
15259
|
+
throw new Error('importSync(' + specifier + '): not supported by the AbsoluteJS Ember adapter \u2014 use dynamic import() instead');
|
|
15260
|
+
};
|
|
15261
|
+
`, resolveEmberSpecifier = (specifier, cwd2) => {
|
|
15262
|
+
if (specifier === "@embroider/macros") {
|
|
15263
|
+
return {
|
|
15264
|
+
inlineSource: generateMacrosShim(),
|
|
15265
|
+
resolveTo: "",
|
|
15266
|
+
specifier
|
|
15267
|
+
};
|
|
15268
|
+
}
|
|
15269
|
+
const standaloneSpecifiers = new Set([
|
|
15270
|
+
"@glimmer/component",
|
|
15271
|
+
"@glimmer/tracking",
|
|
15272
|
+
"@simple-dom/serializer"
|
|
15273
|
+
]);
|
|
15274
|
+
if (standaloneSpecifiers.has(specifier)) {
|
|
15275
|
+
return { resolveTo: specifier, specifier };
|
|
15276
|
+
}
|
|
15277
|
+
const emberInternalPath = join24(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
15278
|
+
if (!existsSync21(emberInternalPath)) {
|
|
15279
|
+
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
15280
|
+
}
|
|
15281
|
+
return { resolveTo: emberInternalPath, specifier };
|
|
15282
|
+
}, REQUIRED_EMBER_SPECIFIERS, SPECIFIERS_WITH_DEFAULT_EXPORT, generateVendorEntrySource2 = (resolution) => {
|
|
15283
|
+
if (resolution.inlineSource !== undefined) {
|
|
15284
|
+
return resolution.inlineSource;
|
|
15285
|
+
}
|
|
15286
|
+
const target = JSON.stringify(resolution.resolveTo);
|
|
15287
|
+
const lines = [`export * from ${target};`];
|
|
15288
|
+
if (SPECIFIERS_WITH_DEFAULT_EXPORT.has(resolution.specifier)) {
|
|
15289
|
+
lines.push(`import __default__ from ${target};`);
|
|
15290
|
+
lines.push(`export default __default__;`);
|
|
15291
|
+
}
|
|
15292
|
+
return lines.join(`
|
|
15293
|
+
`) + `
|
|
15294
|
+
`;
|
|
15295
|
+
}, createEmberResolverPlugin = (cwd2, macrosShimPath) => ({
|
|
15296
|
+
name: "absolutejs-ember-resolver",
|
|
15297
|
+
setup(build3) {
|
|
15298
|
+
const standalonePackages = new Set([
|
|
15299
|
+
"@glimmer/component",
|
|
15300
|
+
"@glimmer/tracking",
|
|
15301
|
+
"@glimmer/env",
|
|
15302
|
+
"@simple-dom/serializer"
|
|
15303
|
+
]);
|
|
15304
|
+
build3.onResolve({ filter: /^@embroider\/macros$/ }, () => ({ path: macrosShimPath }));
|
|
15305
|
+
build3.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
15306
|
+
if (standalonePackages.has(args.path)) {
|
|
15307
|
+
return;
|
|
15308
|
+
}
|
|
15309
|
+
const internal = join24(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
15310
|
+
if (existsSync21(internal)) {
|
|
15311
|
+
return { path: internal };
|
|
15312
|
+
}
|
|
15313
|
+
return;
|
|
15314
|
+
});
|
|
15315
|
+
}
|
|
15316
|
+
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
15317
|
+
const vendorDir = join24(buildDir, "ember", "vendor");
|
|
15318
|
+
mkdirSync11(vendorDir, { recursive: true });
|
|
15319
|
+
const tmpDir = join24(buildDir, "_ember_vendor_tmp");
|
|
15320
|
+
mkdirSync11(tmpDir, { recursive: true });
|
|
15321
|
+
const macrosShimPath = join24(tmpDir, "embroider_macros_shim.js");
|
|
15322
|
+
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
15323
|
+
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
15324
|
+
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
15325
|
+
const safeName = toSafeFileName5(resolution.specifier);
|
|
15326
|
+
const entryPath = join24(tmpDir, `${safeName}.js`);
|
|
15327
|
+
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
15328
|
+
` : generateVendorEntrySource2(resolution);
|
|
15329
|
+
await Bun.write(entryPath, source);
|
|
15330
|
+
return entryPath;
|
|
15331
|
+
}));
|
|
15332
|
+
const result = await bunBuild8({
|
|
15333
|
+
entrypoints,
|
|
15334
|
+
format: "esm",
|
|
15335
|
+
minify: false,
|
|
15336
|
+
naming: "[name].[ext]",
|
|
15337
|
+
outdir: vendorDir,
|
|
15338
|
+
plugins: [createEmberResolverPlugin(cwd2, macrosShimPath)],
|
|
15339
|
+
splitting: true,
|
|
15340
|
+
target: "browser",
|
|
15341
|
+
throw: false
|
|
15342
|
+
});
|
|
15343
|
+
await rm10(tmpDir, { force: true, recursive: true });
|
|
15344
|
+
if (!result.success) {
|
|
15345
|
+
console.warn("\u26A0\uFE0F Ember vendor build had errors:", result.logs);
|
|
15346
|
+
}
|
|
15347
|
+
return REQUIRED_EMBER_SPECIFIERS;
|
|
15348
|
+
}, computeEmberVendorPaths = () => {
|
|
15349
|
+
const paths = {};
|
|
15350
|
+
for (const specifier of REQUIRED_EMBER_SPECIFIERS) {
|
|
15351
|
+
paths[specifier] = `/ember/vendor/${toSafeFileName5(specifier)}.js`;
|
|
15352
|
+
}
|
|
15353
|
+
return paths;
|
|
15354
|
+
};
|
|
15355
|
+
var init_buildEmberVendor = __esm(() => {
|
|
15356
|
+
REQUIRED_EMBER_SPECIFIERS = [
|
|
15357
|
+
"@ember/template-compiler",
|
|
15358
|
+
"@ember/renderer",
|
|
15359
|
+
"@glimmer/component",
|
|
15360
|
+
"@glimmer/tracking",
|
|
15361
|
+
"@embroider/macros"
|
|
15362
|
+
];
|
|
15363
|
+
SPECIFIERS_WITH_DEFAULT_EXPORT = new Set([
|
|
15364
|
+
"@glimmer/component",
|
|
15365
|
+
"@simple-dom/serializer"
|
|
15366
|
+
]);
|
|
15367
|
+
});
|
|
15368
|
+
|
|
14421
15369
|
// src/dev/dependencyGraph.ts
|
|
14422
|
-
import { existsSync as
|
|
15370
|
+
import { existsSync as existsSync22, readFileSync as readFileSync14 } from "fs";
|
|
14423
15371
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
14424
|
-
import { resolve as
|
|
15372
|
+
import { resolve as resolve23 } from "path";
|
|
14425
15373
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
14426
15374
|
const lower = filePath.toLowerCase();
|
|
14427
15375
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -14435,8 +15383,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14435
15383
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
14436
15384
|
return null;
|
|
14437
15385
|
}
|
|
14438
|
-
const fromDir =
|
|
14439
|
-
const normalized =
|
|
15386
|
+
const fromDir = resolve23(fromFile, "..");
|
|
15387
|
+
const normalized = resolve23(fromDir, importPath);
|
|
14440
15388
|
const extensions = [
|
|
14441
15389
|
".ts",
|
|
14442
15390
|
".tsx",
|
|
@@ -14449,10 +15397,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14449
15397
|
];
|
|
14450
15398
|
for (const ext of extensions) {
|
|
14451
15399
|
const withExt = normalized + ext;
|
|
14452
|
-
if (
|
|
15400
|
+
if (existsSync22(withExt))
|
|
14453
15401
|
return withExt;
|
|
14454
15402
|
}
|
|
14455
|
-
if (
|
|
15403
|
+
if (existsSync22(normalized))
|
|
14456
15404
|
return normalized;
|
|
14457
15405
|
return null;
|
|
14458
15406
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -14466,8 +15414,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14466
15414
|
dependents.delete(normalizedPath);
|
|
14467
15415
|
}
|
|
14468
15416
|
}, addFileToGraph = (graph, filePath) => {
|
|
14469
|
-
const normalizedPath =
|
|
14470
|
-
if (!
|
|
15417
|
+
const normalizedPath = resolve23(filePath);
|
|
15418
|
+
if (!existsSync22(normalizedPath))
|
|
14471
15419
|
return;
|
|
14472
15420
|
const dependencies = extractDependencies(normalizedPath);
|
|
14473
15421
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -14483,10 +15431,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14483
15431
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
14484
15432
|
const processedFiles = new Set;
|
|
14485
15433
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
14486
|
-
const resolvedDirs = directories.map((dir) =>
|
|
15434
|
+
const resolvedDirs = directories.map((dir) => resolve23(dir)).filter((dir) => existsSync22(dir));
|
|
14487
15435
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
14488
|
-
for (const
|
|
14489
|
-
const fullPath =
|
|
15436
|
+
for (const file5 of allFiles) {
|
|
15437
|
+
const fullPath = resolve23(file5);
|
|
14490
15438
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
14491
15439
|
continue;
|
|
14492
15440
|
if (processedFiles.has(fullPath))
|
|
@@ -14541,8 +15489,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14541
15489
|
resolveRegexMatches(styleUrlSingularRegex, content, filePath, dependencies);
|
|
14542
15490
|
extractStyleUrlsDependencies(content, filePath, dependencies);
|
|
14543
15491
|
}, extractJsDependencies = (filePath, content, loader) => {
|
|
14544
|
-
const
|
|
14545
|
-
const imports =
|
|
15492
|
+
const transpiler5 = loader === "tsx" ? tsTranspiler : jsTranspiler;
|
|
15493
|
+
const imports = transpiler5.scanImports(content);
|
|
14546
15494
|
const dependencies = [];
|
|
14547
15495
|
for (const imp of imports) {
|
|
14548
15496
|
const resolved = resolveImportPath2(imp.path, filePath);
|
|
@@ -14599,7 +15547,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14599
15547
|
return [];
|
|
14600
15548
|
}
|
|
14601
15549
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
14602
|
-
const normalizedPath =
|
|
15550
|
+
const normalizedPath = resolve23(changedFile);
|
|
14603
15551
|
const affected = new Set;
|
|
14604
15552
|
const toProcess = [normalizedPath];
|
|
14605
15553
|
const processNode = (current) => {
|
|
@@ -14639,7 +15587,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14639
15587
|
}
|
|
14640
15588
|
graph.dependents.delete(normalizedPath);
|
|
14641
15589
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
14642
|
-
const normalizedPath =
|
|
15590
|
+
const normalizedPath = resolve23(filePath);
|
|
14643
15591
|
removeDepsForFile(graph, normalizedPath);
|
|
14644
15592
|
removeDependentsForFile(graph, normalizedPath);
|
|
14645
15593
|
};
|
|
@@ -14682,16 +15630,17 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
14682
15630
|
};
|
|
14683
15631
|
|
|
14684
15632
|
// src/dev/configResolver.ts
|
|
14685
|
-
import { resolve as
|
|
15633
|
+
import { resolve as resolve24 } from "path";
|
|
14686
15634
|
var resolveBuildPaths = (config) => {
|
|
14687
15635
|
const cwd2 = process.cwd();
|
|
14688
15636
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
14689
|
-
const withDefault = (value, fallback) => normalize(
|
|
14690
|
-
const optional = (value) => value ? normalize(
|
|
15637
|
+
const withDefault = (value, fallback) => normalize(resolve24(cwd2, value ?? fallback));
|
|
15638
|
+
const optional = (value) => value ? normalize(resolve24(cwd2, value)) : undefined;
|
|
14691
15639
|
return {
|
|
14692
15640
|
angularDir: optional(config.angularDirectory),
|
|
14693
15641
|
assetsDir: optional(config.assetsDirectory),
|
|
14694
15642
|
buildDir: withDefault(config.buildDirectory, "build"),
|
|
15643
|
+
emberDir: optional(config.emberDirectory),
|
|
14695
15644
|
htmlDir: optional(config.htmlDirectory),
|
|
14696
15645
|
htmxDir: optional(config.htmxDirectory),
|
|
14697
15646
|
reactDir: optional(config.reactDirectory),
|
|
@@ -14758,6 +15707,8 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
14758
15707
|
return "vue";
|
|
14759
15708
|
if (startsWithDir(resolved.angularDir))
|
|
14760
15709
|
return "angular";
|
|
15710
|
+
if (startsWithDir(resolved.emberDir))
|
|
15711
|
+
return "ember";
|
|
14761
15712
|
if (startsWithDir(resolved.htmlDir))
|
|
14762
15713
|
return "html";
|
|
14763
15714
|
if (startsWithDir(resolved.assetsDir))
|
|
@@ -14773,6 +15724,8 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
14773
15724
|
return "vue";
|
|
14774
15725
|
if (normalized.includes("/angular/"))
|
|
14775
15726
|
return "angular";
|
|
15727
|
+
if (normalized.includes("/ember/"))
|
|
15728
|
+
return "ember";
|
|
14776
15729
|
if (normalized.includes("/html/"))
|
|
14777
15730
|
return "html";
|
|
14778
15731
|
}
|
|
@@ -14782,10 +15735,14 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
14782
15735
|
return "svelte";
|
|
14783
15736
|
if (normalized.endsWith(".vue"))
|
|
14784
15737
|
return "vue";
|
|
15738
|
+
if (normalized.endsWith(".gjs") || normalized.endsWith(".gts"))
|
|
15739
|
+
return "ember";
|
|
14785
15740
|
if (normalized.endsWith(".html"))
|
|
14786
15741
|
return "html";
|
|
14787
15742
|
if (normalized.endsWith(".ts") && normalized.includes("angular"))
|
|
14788
15743
|
return "angular";
|
|
15744
|
+
if (normalized.endsWith(".ts") && normalized.includes("ember"))
|
|
15745
|
+
return "ember";
|
|
14789
15746
|
if (normalized.includes("/assets/"))
|
|
14790
15747
|
return "assets";
|
|
14791
15748
|
if (STYLE_EXTENSION_PATTERN2.test(normalized)) {
|
|
@@ -14830,6 +15787,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
14830
15787
|
const cfg = resolved ?? {
|
|
14831
15788
|
angularDir: config.angularDirectory,
|
|
14832
15789
|
assetsDir: config.assetsDirectory,
|
|
15790
|
+
emberDir: config.emberDirectory,
|
|
14833
15791
|
htmlDir: config.htmlDirectory,
|
|
14834
15792
|
htmxDir: config.htmxDirectory,
|
|
14835
15793
|
reactDir: config.reactDirectory,
|
|
@@ -14840,6 +15798,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
14840
15798
|
push(cfg.reactDir);
|
|
14841
15799
|
push(cfg.svelteDir);
|
|
14842
15800
|
push(cfg.vueDir);
|
|
15801
|
+
push(cfg.emberDir);
|
|
14843
15802
|
push(cfg.angularDir);
|
|
14844
15803
|
push(cfg.htmlDir, "pages");
|
|
14845
15804
|
push(cfg.htmlDir, "scripts");
|
|
@@ -14854,6 +15813,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
14854
15813
|
cfg.svelteDir,
|
|
14855
15814
|
cfg.vueDir,
|
|
14856
15815
|
cfg.angularDir,
|
|
15816
|
+
cfg.emberDir,
|
|
14857
15817
|
cfg.htmlDir,
|
|
14858
15818
|
cfg.htmxDir
|
|
14859
15819
|
].filter((dir) => Boolean(dir)).map(normalizePath);
|
|
@@ -14876,8 +15836,8 @@ var init_pathUtils = __esm(() => {
|
|
|
14876
15836
|
|
|
14877
15837
|
// src/dev/fileWatcher.ts
|
|
14878
15838
|
import { watch } from "fs";
|
|
14879
|
-
import { existsSync as
|
|
14880
|
-
import { join as
|
|
15839
|
+
import { existsSync as existsSync23 } from "fs";
|
|
15840
|
+
import { join as join25, resolve as resolve25 } from "path";
|
|
14881
15841
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
14882
15842
|
try {
|
|
14883
15843
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -14904,16 +15864,16 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
14904
15864
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
14905
15865
|
return;
|
|
14906
15866
|
}
|
|
14907
|
-
const fullPath =
|
|
15867
|
+
const fullPath = join25(absolutePath, filename).replace(/\\/g, "/");
|
|
14908
15868
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
14909
15869
|
return;
|
|
14910
15870
|
}
|
|
14911
|
-
if (event === "rename" && !
|
|
15871
|
+
if (event === "rename" && !existsSync23(fullPath)) {
|
|
14912
15872
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
14913
15873
|
onFileChange(fullPath);
|
|
14914
15874
|
return;
|
|
14915
15875
|
}
|
|
14916
|
-
if (
|
|
15876
|
+
if (existsSync23(fullPath)) {
|
|
14917
15877
|
onFileChange(fullPath);
|
|
14918
15878
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
14919
15879
|
}
|
|
@@ -14922,8 +15882,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
14922
15882
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
14923
15883
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
14924
15884
|
paths.forEach((path) => {
|
|
14925
|
-
const absolutePath =
|
|
14926
|
-
if (!
|
|
15885
|
+
const absolutePath = resolve25(path).replace(/\\/g, "/");
|
|
15886
|
+
if (!existsSync23(absolutePath)) {
|
|
14927
15887
|
return;
|
|
14928
15888
|
}
|
|
14929
15889
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -14933,8 +15893,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
14933
15893
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
14934
15894
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
14935
15895
|
watchPaths.forEach((path) => {
|
|
14936
|
-
const absolutePath =
|
|
14937
|
-
if (!
|
|
15896
|
+
const absolutePath = resolve25(path).replace(/\\/g, "/");
|
|
15897
|
+
if (!existsSync23(absolutePath)) {
|
|
14938
15898
|
return;
|
|
14939
15899
|
}
|
|
14940
15900
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -14948,13 +15908,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
14948
15908
|
});
|
|
14949
15909
|
|
|
14950
15910
|
// src/dev/assetStore.ts
|
|
14951
|
-
import { resolve as
|
|
15911
|
+
import { resolve as resolve26 } from "path";
|
|
14952
15912
|
import { readdir as readdir3, unlink } from "fs/promises";
|
|
14953
15913
|
var mimeTypes, getMimeType = (filePath) => {
|
|
14954
15914
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
14955
15915
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
14956
15916
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
14957
|
-
const fullPath =
|
|
15917
|
+
const fullPath = resolve26(dir, entry.name);
|
|
14958
15918
|
if (entry.isDirectory()) {
|
|
14959
15919
|
return walkAndClean(fullPath);
|
|
14960
15920
|
}
|
|
@@ -14970,10 +15930,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
14970
15930
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
14971
15931
|
const liveByIdentity = new Map;
|
|
14972
15932
|
for (const webPath of store.keys()) {
|
|
14973
|
-
const diskPath =
|
|
15933
|
+
const diskPath = resolve26(buildDir, webPath.slice(1));
|
|
14974
15934
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
14975
15935
|
}
|
|
14976
|
-
const absBuildDir =
|
|
15936
|
+
const absBuildDir = resolve26(buildDir);
|
|
14977
15937
|
Object.values(manifest).forEach((val) => {
|
|
14978
15938
|
if (!HASHED_FILE_RE.test(val))
|
|
14979
15939
|
return;
|
|
@@ -14991,7 +15951,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
14991
15951
|
} catch {}
|
|
14992
15952
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
14993
15953
|
if (entry.isDirectory()) {
|
|
14994
|
-
return scanDir(
|
|
15954
|
+
return scanDir(resolve26(dir, entry.name), `${prefix}${entry.name}/`);
|
|
14995
15955
|
}
|
|
14996
15956
|
if (!entry.name.startsWith("chunk-")) {
|
|
14997
15957
|
return null;
|
|
@@ -15000,7 +15960,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15000
15960
|
if (store.has(webPath)) {
|
|
15001
15961
|
return null;
|
|
15002
15962
|
}
|
|
15003
|
-
return Bun.file(
|
|
15963
|
+
return Bun.file(resolve26(dir, entry.name)).bytes().then((bytes) => {
|
|
15004
15964
|
store.set(webPath, bytes);
|
|
15005
15965
|
return;
|
|
15006
15966
|
}).catch(() => {});
|
|
@@ -15022,7 +15982,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15022
15982
|
for (const webPath of newIdentities.values()) {
|
|
15023
15983
|
if (store.has(webPath))
|
|
15024
15984
|
continue;
|
|
15025
|
-
loadPromises.push(Bun.file(
|
|
15985
|
+
loadPromises.push(Bun.file(resolve26(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
15026
15986
|
store.set(webPath, bytes);
|
|
15027
15987
|
return;
|
|
15028
15988
|
}).catch(() => {}));
|
|
@@ -15135,9 +16095,9 @@ var init_transformCache = __esm(() => {
|
|
|
15135
16095
|
});
|
|
15136
16096
|
|
|
15137
16097
|
// src/dev/reactComponentClassifier.ts
|
|
15138
|
-
import { resolve as
|
|
16098
|
+
import { resolve as resolve27 } from "path";
|
|
15139
16099
|
var classifyComponent = (filePath) => {
|
|
15140
|
-
const normalizedPath =
|
|
16100
|
+
const normalizedPath = resolve27(filePath);
|
|
15141
16101
|
if (normalizedPath.includes("/react/pages/")) {
|
|
15142
16102
|
return "server";
|
|
15143
16103
|
}
|
|
@@ -15149,7 +16109,7 @@ var classifyComponent = (filePath) => {
|
|
|
15149
16109
|
var init_reactComponentClassifier = () => {};
|
|
15150
16110
|
|
|
15151
16111
|
// src/dev/moduleMapper.ts
|
|
15152
|
-
import { basename as
|
|
16112
|
+
import { basename as basename10, resolve as resolve28 } from "path";
|
|
15153
16113
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
15154
16114
|
const modulePaths = {};
|
|
15155
16115
|
moduleKeys.forEach((key) => {
|
|
@@ -15159,7 +16119,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
15159
16119
|
});
|
|
15160
16120
|
return modulePaths;
|
|
15161
16121
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
15162
|
-
const normalizedFile =
|
|
16122
|
+
const normalizedFile = resolve28(sourceFile);
|
|
15163
16123
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
15164
16124
|
if (processedFiles.has(normalizedFile)) {
|
|
15165
16125
|
return null;
|
|
@@ -15195,8 +16155,8 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
15195
16155
|
});
|
|
15196
16156
|
return grouped;
|
|
15197
16157
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
15198
|
-
const normalizedFile =
|
|
15199
|
-
const fileName =
|
|
16158
|
+
const normalizedFile = resolve28(sourceFile);
|
|
16159
|
+
const fileName = basename10(normalizedFile);
|
|
15200
16160
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
15201
16161
|
const pascalName = toPascal(baseName);
|
|
15202
16162
|
const keys = [];
|
|
@@ -15365,8 +16325,8 @@ __export(exports_moduleServer, {
|
|
|
15365
16325
|
createModuleServer: () => createModuleServer,
|
|
15366
16326
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
15367
16327
|
});
|
|
15368
|
-
import { existsSync as
|
|
15369
|
-
import { basename as
|
|
16328
|
+
import { existsSync as existsSync24, readFileSync as readFileSync16, statSync as statSync2 } from "fs";
|
|
16329
|
+
import { basename as basename11, dirname as dirname16, extname as extname8, join as join26, resolve as resolve29, relative as relative11 } from "path";
|
|
15370
16330
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
15371
16331
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
15372
16332
|
const allExports = [];
|
|
@@ -15386,7 +16346,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
15386
16346
|
${stubs}
|
|
15387
16347
|
`;
|
|
15388
16348
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
15389
|
-
const found = extensions.find((ext) =>
|
|
16349
|
+
const found = extensions.find((ext) => existsSync24(resolve29(projectRoot, srcPath + ext)));
|
|
15390
16350
|
return found ? srcPath + found : srcPath;
|
|
15391
16351
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
15392
16352
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -15401,7 +16361,7 @@ ${stubs}
|
|
|
15401
16361
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
15402
16362
|
}, srcUrl = (relPath, projectRoot) => {
|
|
15403
16363
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
15404
|
-
const absPath =
|
|
16364
|
+
const absPath = resolve29(projectRoot, relPath);
|
|
15405
16365
|
const cached = mtimeCache.get(absPath);
|
|
15406
16366
|
if (cached !== undefined)
|
|
15407
16367
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -15413,12 +16373,12 @@ ${stubs}
|
|
|
15413
16373
|
return base;
|
|
15414
16374
|
}
|
|
15415
16375
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
15416
|
-
const absPath =
|
|
16376
|
+
const absPath = resolve29(fileDir, relPath);
|
|
15417
16377
|
const rel = relative11(projectRoot, absPath);
|
|
15418
|
-
const extension =
|
|
16378
|
+
const extension = extname8(rel);
|
|
15419
16379
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
15420
|
-
if (
|
|
15421
|
-
srcPath = relative11(projectRoot, resolveSvelteModulePath(
|
|
16380
|
+
if (extname8(srcPath) === ".svelte") {
|
|
16381
|
+
srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve29(projectRoot, srcPath)));
|
|
15422
16382
|
}
|
|
15423
16383
|
return srcUrl(srcPath, projectRoot);
|
|
15424
16384
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -15435,14 +16395,14 @@ ${stubs}
|
|
|
15435
16395
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
15436
16396
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
15437
16397
|
if (!subpath) {
|
|
15438
|
-
const pkgDir =
|
|
15439
|
-
const pkgJsonPath =
|
|
15440
|
-
if (
|
|
16398
|
+
const pkgDir = resolve29(projectRoot, "node_modules", packageName ?? "");
|
|
16399
|
+
const pkgJsonPath = join26(pkgDir, "package.json");
|
|
16400
|
+
if (existsSync24(pkgJsonPath)) {
|
|
15441
16401
|
const pkg = JSON.parse(readFileSync16(pkgJsonPath, "utf-8"));
|
|
15442
16402
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
15443
16403
|
if (esmEntry) {
|
|
15444
|
-
const resolved =
|
|
15445
|
-
if (
|
|
16404
|
+
const resolved = resolve29(pkgDir, esmEntry);
|
|
16405
|
+
if (existsSync24(resolved))
|
|
15446
16406
|
return relative11(projectRoot, resolved);
|
|
15447
16407
|
}
|
|
15448
16408
|
}
|
|
@@ -15473,7 +16433,7 @@ ${stubs}
|
|
|
15473
16433
|
};
|
|
15474
16434
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
15475
16435
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
15476
|
-
const fileDir =
|
|
16436
|
+
const fileDir = dirname16(filePath);
|
|
15477
16437
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
15478
16438
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
15479
16439
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
@@ -15486,12 +16446,12 @@ ${stubs}
|
|
|
15486
16446
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
15487
16447
|
});
|
|
15488
16448
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
15489
|
-
const absPath =
|
|
16449
|
+
const absPath = resolve29(fileDir, relPath);
|
|
15490
16450
|
const rel = relative11(projectRoot, absPath);
|
|
15491
16451
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
15492
16452
|
});
|
|
15493
16453
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
15494
|
-
const absPath =
|
|
16454
|
+
const absPath = resolve29(fileDir, relPath);
|
|
15495
16455
|
const rel = relative11(projectRoot, absPath);
|
|
15496
16456
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
15497
16457
|
});
|
|
@@ -15554,16 +16514,16 @@ ${transpiled}`;
|
|
|
15554
16514
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
15555
16515
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
15556
16516
|
const raw = readFileSync16(filePath, "utf-8");
|
|
15557
|
-
const ext =
|
|
16517
|
+
const ext = extname8(filePath);
|
|
15558
16518
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
15559
16519
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
15560
|
-
let
|
|
16520
|
+
let transpiler5 = jsTranspiler2;
|
|
15561
16521
|
if (isTSX)
|
|
15562
|
-
|
|
16522
|
+
transpiler5 = tsxTranspiler;
|
|
15563
16523
|
else if (isTS)
|
|
15564
|
-
|
|
15565
|
-
const valueExports = isTS ?
|
|
15566
|
-
let transpiled =
|
|
16524
|
+
transpiler5 = tsTranspiler2;
|
|
16525
|
+
const valueExports = isTS ? transpiler5.scan(raw).exports : [];
|
|
16526
|
+
let transpiled = transpiler5.transformSync(raw);
|
|
15567
16527
|
if (isTS) {
|
|
15568
16528
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
15569
16529
|
}
|
|
@@ -15779,17 +16739,19 @@ export default __script__;`;
|
|
|
15779
16739
|
return `${cssInjection}
|
|
15780
16740
|
${code}`;
|
|
15781
16741
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
15782
|
-
const
|
|
16742
|
+
const rawSource = readFileSync16(filePath, "utf-8");
|
|
16743
|
+
const raw = addAutoRouterSetupApp(rawSource);
|
|
15783
16744
|
if (!vueCompiler) {
|
|
15784
16745
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
15785
16746
|
}
|
|
15786
|
-
const fileName =
|
|
16747
|
+
const fileName = basename11(filePath, ".vue");
|
|
15787
16748
|
const componentId = fileName.toLowerCase();
|
|
15788
16749
|
const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
|
|
15789
|
-
const
|
|
16750
|
+
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
16751
|
+
const compiledScript = hasScript ? vueCompiler.compileScript(descriptor, {
|
|
15790
16752
|
id: componentId,
|
|
15791
16753
|
inlineTemplate: false
|
|
15792
|
-
});
|
|
16754
|
+
}) : { bindings: {}, content: "export default {};" };
|
|
15793
16755
|
const compiledSfcScript = {
|
|
15794
16756
|
bindings: compiledScript.bindings ?? {},
|
|
15795
16757
|
content: compiledScript.content
|
|
@@ -15800,7 +16762,7 @@ ${code}`;
|
|
|
15800
16762
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
15801
16763
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
15802
16764
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
15803
|
-
const hmrBase = vueDir ?
|
|
16765
|
+
const hmrBase = vueDir ? resolve29(vueDir) : projectRoot;
|
|
15804
16766
|
const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
15805
16767
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
15806
16768
|
result += [
|
|
@@ -15815,11 +16777,11 @@ ${code}`;
|
|
|
15815
16777
|
`);
|
|
15816
16778
|
return result;
|
|
15817
16779
|
}, resolveSvelteModulePath = (path) => {
|
|
15818
|
-
if (
|
|
16780
|
+
if (existsSync24(path))
|
|
15819
16781
|
return path;
|
|
15820
|
-
if (
|
|
16782
|
+
if (existsSync24(`${path}.ts`))
|
|
15821
16783
|
return `${path}.ts`;
|
|
15822
|
-
if (
|
|
16784
|
+
if (existsSync24(`${path}.js`))
|
|
15823
16785
|
return `${path}.js`;
|
|
15824
16786
|
return path;
|
|
15825
16787
|
}, jsResponse = (body) => {
|
|
@@ -15959,13 +16921,13 @@ export default {};
|
|
|
15959
16921
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
15960
16922
|
return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
|
|
15961
16923
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
15962
|
-
const filePath =
|
|
15963
|
-
const ext =
|
|
16924
|
+
const filePath = resolve29(projectRoot, relPath);
|
|
16925
|
+
const ext = extname8(filePath);
|
|
15964
16926
|
if (ext === ".svelte")
|
|
15965
16927
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
15966
16928
|
if (ext)
|
|
15967
16929
|
return { ext, filePath };
|
|
15968
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
16930
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync24(filePath + candidate));
|
|
15969
16931
|
if (!found)
|
|
15970
16932
|
return { ext, filePath };
|
|
15971
16933
|
const resolved = filePath + found;
|
|
@@ -15986,7 +16948,7 @@ export default {};
|
|
|
15986
16948
|
if (!TRANSPILABLE.has(ext))
|
|
15987
16949
|
return;
|
|
15988
16950
|
const stat4 = statSync2(filePath);
|
|
15989
|
-
const resolvedVueDir = vueDir ?
|
|
16951
|
+
const resolvedVueDir = vueDir ? resolve29(vueDir) : undefined;
|
|
15990
16952
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
15991
16953
|
setTransformed(filePath, content, stat4.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
15992
16954
|
return jsResponse(content);
|
|
@@ -16017,7 +16979,7 @@ export default {};
|
|
|
16017
16979
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
16018
16980
|
return;
|
|
16019
16981
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
16020
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
16982
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve29(projectRoot, relPath));
|
|
16021
16983
|
if (virtualCssResponse)
|
|
16022
16984
|
return virtualCssResponse;
|
|
16023
16985
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -16033,11 +16995,11 @@ export default {};
|
|
|
16033
16995
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
16034
16996
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
16035
16997
|
if (match[1])
|
|
16036
|
-
files.push(
|
|
16998
|
+
files.push(resolve29(projectRoot, match[1]));
|
|
16037
16999
|
}
|
|
16038
17000
|
return files;
|
|
16039
17001
|
}, invalidateModule = (filePath) => {
|
|
16040
|
-
const resolved =
|
|
17002
|
+
const resolved = resolve29(filePath);
|
|
16041
17003
|
invalidate(filePath);
|
|
16042
17004
|
if (resolved !== filePath)
|
|
16043
17005
|
invalidate(resolved);
|
|
@@ -16055,6 +17017,7 @@ export default {};
|
|
|
16055
17017
|
var init_moduleServer = __esm(() => {
|
|
16056
17018
|
init_constants();
|
|
16057
17019
|
init_resolvePackageImport();
|
|
17020
|
+
init_vueAutoRouterTransform();
|
|
16058
17021
|
init_sourceMetadata();
|
|
16059
17022
|
init_stylePreprocessor();
|
|
16060
17023
|
init_lowerAwaitSlotSyntax();
|
|
@@ -16111,21 +17074,147 @@ var init_moduleServer = __esm(() => {
|
|
|
16111
17074
|
SRC_URL_PREFIX = SRC_PREFIX;
|
|
16112
17075
|
});
|
|
16113
17076
|
|
|
17077
|
+
// src/utils/ssrErrorPage.ts
|
|
17078
|
+
var ssrErrorPage = (framework, error) => {
|
|
17079
|
+
const frameworkColors2 = {
|
|
17080
|
+
angular: "#dd0031",
|
|
17081
|
+
html: "#e34c26",
|
|
17082
|
+
htmx: "#1a365d",
|
|
17083
|
+
react: "#61dafb",
|
|
17084
|
+
svelte: "#ff3e00",
|
|
17085
|
+
vue: "#42b883"
|
|
17086
|
+
};
|
|
17087
|
+
const accent = frameworkColors2[framework] ?? "#94a3b8";
|
|
17088
|
+
const label = framework.charAt(0).toUpperCase() + framework.slice(1);
|
|
17089
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
17090
|
+
return `<!DOCTYPE html>
|
|
17091
|
+
<html>
|
|
17092
|
+
<head>
|
|
17093
|
+
<meta charset="utf-8">
|
|
17094
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
17095
|
+
<title>SSR Error - AbsoluteJS</title>
|
|
17096
|
+
<style>
|
|
17097
|
+
*{margin:0;padding:0;box-sizing:border-box}
|
|
17098
|
+
body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,rgba(30,41,59,0.98) 100%);color:#e2e8f0;font-family:"JetBrains Mono","Fira Code",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;line-height:1.6;display:flex;align-items:flex-start;justify-content:center;padding:32px}
|
|
17099
|
+
.card{max-width:720px;width:100%;background:rgba(30,41,59,0.6);border:1px solid rgba(71,85,105,0.5);border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,0.5),0 0 0 1px rgba(255,255,255,0.05);overflow:hidden}
|
|
17100
|
+
.header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;background:rgba(15,23,42,0.5);border-bottom:1px solid rgba(71,85,105,0.4)}
|
|
17101
|
+
.brand{font-weight:700;font-size:20px;color:#fff;letter-spacing:-0.02em}
|
|
17102
|
+
.badge{padding:5px 10px;border-radius:8px;font-size:12px;font-weight:600;background:${accent};color:#fff;opacity:0.95;box-shadow:0 2px 4px rgba(0,0,0,0.2)}
|
|
17103
|
+
.kind{color:#94a3b8;font-size:13px;font-weight:500}
|
|
17104
|
+
.content{padding:24px}
|
|
17105
|
+
.label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px}
|
|
17106
|
+
.message{margin:0;padding:16px 20px;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.25);border-radius:10px;overflow-x:auto;white-space:pre-wrap;word-break:break-word;color:#fca5a5;font-size:13px;line-height:1.5}
|
|
17107
|
+
.hint{margin-top:20px;padding:12px 20px;background:rgba(71,85,105,0.3);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#cbd5e1;font-size:13px}
|
|
17108
|
+
</style>
|
|
17109
|
+
</head>
|
|
17110
|
+
<body>
|
|
17111
|
+
<div class="card">
|
|
17112
|
+
<div class="header">
|
|
17113
|
+
<div style="display:flex;align-items:center;gap:12px">
|
|
17114
|
+
<span class="brand">AbsoluteJS</span>
|
|
17115
|
+
<span class="badge">${label}</span>
|
|
17116
|
+
</div>
|
|
17117
|
+
<span class="kind">Server Render Error</span>
|
|
17118
|
+
</div>
|
|
17119
|
+
<div class="content">
|
|
17120
|
+
<div class="label">What went wrong</div>
|
|
17121
|
+
<pre class="message">${message.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</pre>
|
|
17122
|
+
<div class="hint">A component threw during server-side rendering. Check the terminal for the full stack trace.</div>
|
|
17123
|
+
</div>
|
|
17124
|
+
</div>
|
|
17125
|
+
</body>
|
|
17126
|
+
</html>`;
|
|
17127
|
+
};
|
|
17128
|
+
|
|
17129
|
+
// src/ember/pageHandler.ts
|
|
17130
|
+
import { pathToFileURL } from "url";
|
|
17131
|
+
var resolveRequestPathname = (request) => {
|
|
17132
|
+
if (!request)
|
|
17133
|
+
return;
|
|
17134
|
+
try {
|
|
17135
|
+
const parsed = new URL(request.url);
|
|
17136
|
+
return `${parsed.pathname}${parsed.search}`;
|
|
17137
|
+
} catch {
|
|
17138
|
+
return;
|
|
17139
|
+
}
|
|
17140
|
+
}, installSimpleDomGlobals = () => {
|
|
17141
|
+
const g2 = globalThis;
|
|
17142
|
+
if (typeof g2.Element === "undefined") {
|
|
17143
|
+
g2.Element = class Element {
|
|
17144
|
+
};
|
|
17145
|
+
}
|
|
17146
|
+
if (typeof g2.Node === "undefined") {
|
|
17147
|
+
g2.Node = class Node {
|
|
17148
|
+
};
|
|
17149
|
+
}
|
|
17150
|
+
}, emberCacheBuster = 0, buildRuntimeModuleSpecifier = (modulePath) => {
|
|
17151
|
+
if (emberCacheBuster === 0)
|
|
17152
|
+
return modulePath;
|
|
17153
|
+
const moduleUrl = new URL(pathToFileURL(modulePath).href);
|
|
17154
|
+
moduleUrl.searchParams.set("t", String(emberCacheBuster));
|
|
17155
|
+
return moduleUrl.href;
|
|
17156
|
+
}, invalidateEmberSsrCache = () => {
|
|
17157
|
+
markSsrCacheDirty("ember");
|
|
17158
|
+
emberCacheBuster = Date.now();
|
|
17159
|
+
}, buildHtmlShell = (headTag, bodyContent, indexPath, props) => {
|
|
17160
|
+
const propsScript = `window.__INITIAL_PROPS__=${JSON.stringify(props ?? {})};`;
|
|
17161
|
+
const indexImport = indexPath ? `<script type="module" src="${indexPath}"></script>` : "";
|
|
17162
|
+
return `<!DOCTYPE html><html>${headTag}<body>` + `<div id="ember-root">${bodyContent}</div>` + `<script>${propsScript}</script>` + indexImport + `</body></html>`;
|
|
17163
|
+
}, handleEmberPageRequest = async (input) => {
|
|
17164
|
+
const { indexPath, pagePath, headTag } = input;
|
|
17165
|
+
const userProps = input.props;
|
|
17166
|
+
const requestPathname = resolveRequestPathname(input.request);
|
|
17167
|
+
const props = requestPathname !== undefined && (!userProps || !("url" in userProps)) ? { ...userProps ?? {}, url: requestPathname } : userProps;
|
|
17168
|
+
const resolvedHeadTag = headTag ?? "<head></head>";
|
|
17169
|
+
try {
|
|
17170
|
+
installSimpleDomGlobals();
|
|
17171
|
+
isSsrCacheDirty("ember");
|
|
17172
|
+
const bundle = await import(buildRuntimeModuleSpecifier(pagePath));
|
|
17173
|
+
if (typeof bundle.renderToHTML !== "function") {
|
|
17174
|
+
throw new Error(`Ember page bundle at ${pagePath} does not export renderToHTML(). Was it compiled by compileEmber()?`);
|
|
17175
|
+
}
|
|
17176
|
+
const innerHtml = bundle.renderToHTML(props ?? {});
|
|
17177
|
+
const html = buildHtmlShell(resolvedHeadTag, innerHtml.replace(/^<div>|<\/div>$/g, ""), indexPath, props);
|
|
17178
|
+
return new Response(html, {
|
|
17179
|
+
headers: { "Content-Type": "text/html" }
|
|
17180
|
+
});
|
|
17181
|
+
} catch (error) {
|
|
17182
|
+
console.error("[SSR] Ember render error:", error);
|
|
17183
|
+
return new Response(ssrErrorPage("ember", error), {
|
|
17184
|
+
headers: { "Content-Type": "text/html" },
|
|
17185
|
+
status: 500
|
|
17186
|
+
});
|
|
17187
|
+
}
|
|
17188
|
+
};
|
|
17189
|
+
var init_pageHandler = __esm(() => {
|
|
17190
|
+
init_ssrCache();
|
|
17191
|
+
});
|
|
17192
|
+
|
|
17193
|
+
// src/ember/index.ts
|
|
17194
|
+
var exports_ember = {};
|
|
17195
|
+
__export(exports_ember, {
|
|
17196
|
+
invalidateEmberSsrCache: () => invalidateEmberSsrCache,
|
|
17197
|
+
handleEmberPageRequest: () => handleEmberPageRequest
|
|
17198
|
+
});
|
|
17199
|
+
var init_ember = __esm(() => {
|
|
17200
|
+
init_pageHandler();
|
|
17201
|
+
});
|
|
17202
|
+
|
|
16114
17203
|
// src/dev/simpleHTMLHMR.ts
|
|
16115
17204
|
var exports_simpleHTMLHMR = {};
|
|
16116
17205
|
__export(exports_simpleHTMLHMR, {
|
|
16117
17206
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
16118
17207
|
});
|
|
16119
|
-
import { resolve as
|
|
17208
|
+
import { resolve as resolve30 } from "path";
|
|
16120
17209
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
16121
17210
|
let htmlContent;
|
|
16122
17211
|
try {
|
|
16123
|
-
const resolvedPath =
|
|
16124
|
-
const
|
|
16125
|
-
if (!await
|
|
17212
|
+
const resolvedPath = resolve30(htmlFilePath);
|
|
17213
|
+
const file5 = Bun.file(resolvedPath);
|
|
17214
|
+
if (!await file5.exists()) {
|
|
16126
17215
|
return null;
|
|
16127
17216
|
}
|
|
16128
|
-
htmlContent = await
|
|
17217
|
+
htmlContent = await file5.text();
|
|
16129
17218
|
} catch {
|
|
16130
17219
|
return null;
|
|
16131
17220
|
}
|
|
@@ -16146,16 +17235,16 @@ var exports_simpleHTMXHMR = {};
|
|
|
16146
17235
|
__export(exports_simpleHTMXHMR, {
|
|
16147
17236
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
16148
17237
|
});
|
|
16149
|
-
import { resolve as
|
|
17238
|
+
import { resolve as resolve31 } from "path";
|
|
16150
17239
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
16151
17240
|
let htmlContent;
|
|
16152
17241
|
try {
|
|
16153
|
-
const resolvedPath =
|
|
16154
|
-
const
|
|
16155
|
-
if (!await
|
|
17242
|
+
const resolvedPath = resolve31(htmxFilePath);
|
|
17243
|
+
const file5 = Bun.file(resolvedPath);
|
|
17244
|
+
if (!await file5.exists()) {
|
|
16156
17245
|
return null;
|
|
16157
17246
|
}
|
|
16158
|
-
htmlContent = await
|
|
17247
|
+
htmlContent = await file5.text();
|
|
16159
17248
|
} catch {
|
|
16160
17249
|
return null;
|
|
16161
17250
|
}
|
|
@@ -16172,8 +17261,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
16172
17261
|
var init_simpleHTMXHMR = () => {};
|
|
16173
17262
|
|
|
16174
17263
|
// src/dev/rebuildTrigger.ts
|
|
16175
|
-
import { existsSync as
|
|
16176
|
-
import { basename as
|
|
17264
|
+
import { existsSync as existsSync25 } from "fs";
|
|
17265
|
+
import { basename as basename12, dirname as dirname17, relative as relative12, resolve as resolve32 } from "path";
|
|
16177
17266
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
|
|
16178
17267
|
if (!config.tailwind)
|
|
16179
17268
|
return;
|
|
@@ -16197,16 +17286,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16197
17286
|
}, parseErrorLocationFromMessage = (msg) => {
|
|
16198
17287
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
16199
17288
|
if (pathLineCol) {
|
|
16200
|
-
const [,
|
|
17289
|
+
const [, file5, lineStr, colStr] = pathLineCol;
|
|
16201
17290
|
return {
|
|
16202
17291
|
column: colStr ? parseInt(colStr, 10) : undefined,
|
|
16203
|
-
file:
|
|
17292
|
+
file: file5,
|
|
16204
17293
|
line: lineStr ? parseInt(lineStr, 10) : undefined
|
|
16205
17294
|
};
|
|
16206
17295
|
}
|
|
16207
17296
|
const atMatch = msg.match(/(?:at|in)\s+([^(:\s]+)(?:\s*\([^)]*line\s*(\d+)[^)]*col(?:umn)?\s*(\d+)[^)]*\)|:(\d+):(\d+)?)/i);
|
|
16208
17297
|
if (atMatch) {
|
|
16209
|
-
const [,
|
|
17298
|
+
const [, file5, line1, col1, line2, col2] = atMatch;
|
|
16210
17299
|
let parsedCol;
|
|
16211
17300
|
if (col1)
|
|
16212
17301
|
parsedCol = parseInt(col1, 10);
|
|
@@ -16219,16 +17308,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16219
17308
|
parsedLine = parseInt(line2, 10);
|
|
16220
17309
|
return {
|
|
16221
17310
|
column: parsedCol,
|
|
16222
|
-
file:
|
|
17311
|
+
file: file5?.trim(),
|
|
16223
17312
|
line: parsedLine
|
|
16224
17313
|
};
|
|
16225
17314
|
}
|
|
16226
17315
|
const parenMatch = msg.match(/([^\s(]+)\s*\([^)]*line\s*(\d+)[^)]*col(?:umn)?\s*(\d+)/i);
|
|
16227
17316
|
if (parenMatch) {
|
|
16228
|
-
const [,
|
|
17317
|
+
const [, file5, lineStr, colStr] = parenMatch;
|
|
16229
17318
|
return {
|
|
16230
17319
|
column: colStr ? parseInt(colStr, 10) : undefined,
|
|
16231
|
-
file:
|
|
17320
|
+
file: file5 ?? undefined,
|
|
16232
17321
|
line: lineStr ? parseInt(lineStr, 10) : undefined
|
|
16233
17322
|
};
|
|
16234
17323
|
}
|
|
@@ -16240,14 +17329,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16240
17329
|
if (logs && Array.isArray(logs) && logs.length > 0) {
|
|
16241
17330
|
const errLog = logs.find((l4) => l4.level === "error") ?? logs[0];
|
|
16242
17331
|
const pos = errLog?.position;
|
|
16243
|
-
const
|
|
17332
|
+
const file5 = pos?.file;
|
|
16244
17333
|
const line = pos?.line;
|
|
16245
17334
|
const column = pos?.column;
|
|
16246
17335
|
const lineText = pos?.lineText;
|
|
16247
|
-
const framework =
|
|
17336
|
+
const framework = file5 && resolvedPaths ? detectFramework(file5, resolvedPaths) : affectedFrameworks[0] ?? "unknown";
|
|
16248
17337
|
return {
|
|
16249
17338
|
column,
|
|
16250
|
-
file:
|
|
17339
|
+
file: file5,
|
|
16251
17340
|
framework: framework !== "ignored" ? framework : affectedFrameworks[0],
|
|
16252
17341
|
line,
|
|
16253
17342
|
lineText
|
|
@@ -16261,11 +17350,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16261
17350
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
16262
17351
|
}
|
|
16263
17352
|
return { ...parsed, framework: detectedFw };
|
|
16264
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
17353
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync25(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
16265
17354
|
state.fileHashes.delete(filePathInSet);
|
|
16266
17355
|
try {
|
|
16267
17356
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
16268
|
-
const deletedPathResolved =
|
|
17357
|
+
const deletedPathResolved = resolve32(filePathInSet);
|
|
16269
17358
|
affectedFiles.forEach((affectedFile) => {
|
|
16270
17359
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
16271
17360
|
validFiles.push(affectedFile);
|
|
@@ -16279,7 +17368,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16279
17368
|
if (!dependents || dependents.size === 0) {
|
|
16280
17369
|
return;
|
|
16281
17370
|
}
|
|
16282
|
-
const dependentFiles = Array.from(dependents).filter((
|
|
17371
|
+
const dependentFiles = Array.from(dependents).filter((file5) => existsSync25(file5));
|
|
16283
17372
|
if (dependentFiles.length === 0) {
|
|
16284
17373
|
return;
|
|
16285
17374
|
}
|
|
@@ -16295,7 +17384,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16295
17384
|
try {
|
|
16296
17385
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
16297
17386
|
affectedFiles.forEach((affectedFile) => {
|
|
16298
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
17387
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync25(affectedFile)) {
|
|
16299
17388
|
validFiles.push(affectedFile);
|
|
16300
17389
|
processedFiles.add(affectedFile);
|
|
16301
17390
|
}
|
|
@@ -16309,7 +17398,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16309
17398
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
16310
17399
|
return;
|
|
16311
17400
|
}
|
|
16312
|
-
const normalizedFilePath =
|
|
17401
|
+
const normalizedFilePath = resolve32(filePathInSet);
|
|
16313
17402
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
16314
17403
|
validFiles.push(normalizedFilePath);
|
|
16315
17404
|
processedFiles.add(normalizedFilePath);
|
|
@@ -16320,7 +17409,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16320
17409
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
16321
17410
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
16322
17411
|
filePathSet.forEach((filePathInSet) => {
|
|
16323
|
-
if (!
|
|
17412
|
+
if (!existsSync25(filePathInSet)) {
|
|
16324
17413
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
16325
17414
|
return;
|
|
16326
17415
|
}
|
|
@@ -16351,10 +17440,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16351
17440
|
}
|
|
16352
17441
|
});
|
|
16353
17442
|
return filesToProcess;
|
|
16354
|
-
}, STABILITY_CHECK_ROUNDS = 5, STABILITY_CHECK_DELAY_MS = 10, isFileStable = async (
|
|
16355
|
-
const hash1 = computeFileHash(
|
|
17443
|
+
}, STABILITY_CHECK_ROUNDS = 5, STABILITY_CHECK_DELAY_MS = 10, isFileStable = async (file5) => {
|
|
17444
|
+
const hash1 = computeFileHash(file5);
|
|
16356
17445
|
await Bun.sleep(STABILITY_CHECK_DELAY_MS);
|
|
16357
|
-
const hash2 = computeFileHash(
|
|
17446
|
+
const hash2 = computeFileHash(file5);
|
|
16358
17447
|
return hash1 === hash2;
|
|
16359
17448
|
}, collectAllQueuedFiles = (fileChangeQueue) => {
|
|
16360
17449
|
const allFiles = [];
|
|
@@ -16365,11 +17454,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16365
17454
|
}, areAllQueuedFilesStable = async (fileChangeQueue) => {
|
|
16366
17455
|
const allFiles = collectAllQueuedFiles(fileChangeQueue);
|
|
16367
17456
|
const checkFile = async (files) => {
|
|
16368
|
-
const [
|
|
16369
|
-
if (!
|
|
17457
|
+
const [file5, ...remaining] = files;
|
|
17458
|
+
if (!file5) {
|
|
16370
17459
|
return true;
|
|
16371
17460
|
}
|
|
16372
|
-
const stable = await isFileStable(
|
|
17461
|
+
const stable = await isFileStable(file5);
|
|
16373
17462
|
if (!stable) {
|
|
16374
17463
|
return false;
|
|
16375
17464
|
}
|
|
@@ -16413,7 +17502,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16413
17502
|
return;
|
|
16414
17503
|
}
|
|
16415
17504
|
if (framework === "unknown") {
|
|
16416
|
-
invalidate(
|
|
17505
|
+
invalidate(resolve32(filePath));
|
|
16417
17506
|
const relPath = relative12(process.cwd(), filePath);
|
|
16418
17507
|
logHmrUpdate(relPath);
|
|
16419
17508
|
return;
|
|
@@ -16457,12 +17546,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16457
17546
|
return componentFile;
|
|
16458
17547
|
}
|
|
16459
17548
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
16460
|
-
if (
|
|
17549
|
+
if (existsSync25(tsCounterpart)) {
|
|
16461
17550
|
return tsCounterpart;
|
|
16462
17551
|
}
|
|
16463
17552
|
if (!graph)
|
|
16464
17553
|
return componentFile;
|
|
16465
|
-
const dependents = graph.dependents.get(
|
|
17554
|
+
const dependents = graph.dependents.get(resolve32(componentFile));
|
|
16466
17555
|
if (!dependents)
|
|
16467
17556
|
return componentFile;
|
|
16468
17557
|
for (const dep of dependents) {
|
|
@@ -16471,7 +17560,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16471
17560
|
}
|
|
16472
17561
|
return componentFile;
|
|
16473
17562
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
16474
|
-
const pageEntries = angularFiles.filter((
|
|
17563
|
+
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve32(file5).startsWith(angularPagesPath));
|
|
16475
17564
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
16476
17565
|
return pageEntries;
|
|
16477
17566
|
}
|
|
@@ -16479,9 +17568,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16479
17568
|
angularFiles.forEach((componentFile) => {
|
|
16480
17569
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
16481
17570
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
16482
|
-
affected.forEach((
|
|
16483
|
-
if (
|
|
16484
|
-
resolvedPages.add(
|
|
17571
|
+
affected.forEach((file5) => {
|
|
17572
|
+
if (file5.endsWith(".ts") && resolve32(file5).startsWith(angularPagesPath)) {
|
|
17573
|
+
resolvedPages.add(file5);
|
|
16485
17574
|
}
|
|
16486
17575
|
});
|
|
16487
17576
|
});
|
|
@@ -16497,14 +17586,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16497
17586
|
const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
|
|
16498
17587
|
return clientRoots.length === 1 ? clientRoots[0] ?? process.cwd() : commonAncestor2(clientRoots, process.cwd());
|
|
16499
17588
|
}, updateServerManifestEntry = (state, artifact) => {
|
|
16500
|
-
const fileWithHash =
|
|
17589
|
+
const fileWithHash = basename12(artifact.path);
|
|
16501
17590
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
16502
17591
|
if (!baseName) {
|
|
16503
17592
|
return;
|
|
16504
17593
|
}
|
|
16505
17594
|
state.manifest[toPascal(baseName)] = artifact.path;
|
|
16506
17595
|
}, bundleAngularClient = async (state, clientPaths, buildDir) => {
|
|
16507
|
-
const { build:
|
|
17596
|
+
const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
|
|
16508
17597
|
const { generateManifest: generateManifest2 } = await Promise.resolve().then(() => (init_generateManifest(), exports_generateManifest));
|
|
16509
17598
|
const { getAngularVendorPaths: getAngularVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
16510
17599
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
@@ -16516,7 +17605,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16516
17605
|
angVendorPaths = computeAngularVendorPaths2(globalThis.__angularVendorSpecifiers);
|
|
16517
17606
|
setAngularVendorPaths2(angVendorPaths);
|
|
16518
17607
|
}
|
|
16519
|
-
const clientResult = await
|
|
17608
|
+
const clientResult = await bunBuild9({
|
|
16520
17609
|
entrypoints: clientPaths,
|
|
16521
17610
|
...Object.keys({
|
|
16522
17611
|
...angVendorPaths ?? {},
|
|
@@ -16552,7 +17641,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16552
17641
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
16553
17642
|
}, broadcastAngularPageUpdates = (state, pagesToUpdate, manifest, startTime) => {
|
|
16554
17643
|
pagesToUpdate.forEach((angularPagePath) => {
|
|
16555
|
-
const fileName =
|
|
17644
|
+
const fileName = basename12(angularPagePath);
|
|
16556
17645
|
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
16557
17646
|
const pascalName = toPascal(baseName);
|
|
16558
17647
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -16589,28 +17678,28 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16589
17678
|
await rewriteImports3(ssrPaths, angServerVendorPaths);
|
|
16590
17679
|
}
|
|
16591
17680
|
serverPaths.forEach((serverPath, idx) => {
|
|
16592
|
-
const fileBase =
|
|
17681
|
+
const fileBase = basename12(serverPath, ".js");
|
|
16593
17682
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
16594
|
-
state.manifest[toPascal(fileBase)] =
|
|
17683
|
+
state.manifest[toPascal(fileBase)] = resolve32(ssrPath);
|
|
16595
17684
|
});
|
|
16596
17685
|
if (clientPaths.length > 0) {
|
|
16597
17686
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
16598
17687
|
}
|
|
16599
17688
|
}, handleAngularFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
16600
17689
|
const angularDir = config.angularDirectory ?? "";
|
|
16601
|
-
const angularFiles = filesToRebuild.filter((
|
|
16602
|
-
for (const
|
|
16603
|
-
state.fileHashes.set(
|
|
17690
|
+
const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
|
|
17691
|
+
for (const file5 of angularFiles) {
|
|
17692
|
+
state.fileHashes.set(resolve32(file5), computeFileHash(file5));
|
|
16604
17693
|
}
|
|
16605
|
-
const angularPagesPath =
|
|
17694
|
+
const angularPagesPath = resolve32(angularDir, "pages");
|
|
16606
17695
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
16607
17696
|
if (pageEntries.length > 0) {
|
|
16608
17697
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
16609
17698
|
markSsrCacheDirty("angular");
|
|
16610
17699
|
}
|
|
16611
17700
|
const { manifest } = state;
|
|
16612
|
-
const angularHmrFiles = angularFiles.filter((
|
|
16613
|
-
const angularPageFiles = angularHmrFiles.filter((
|
|
17701
|
+
const angularHmrFiles = angularFiles.filter((file5) => file5.endsWith(".ts") || file5.endsWith(".html"));
|
|
17702
|
+
const angularPageFiles = angularHmrFiles.filter((file5) => file5.replace(/\\/g, "/").includes("/pages/"));
|
|
16614
17703
|
const pagesToUpdate = angularPageFiles.length > 0 ? angularPageFiles : pageEntries;
|
|
16615
17704
|
broadcastAngularPageUpdates(state, pagesToUpdate, manifest, startTime);
|
|
16616
17705
|
onRebuildComplete({ hmrState: state, manifest });
|
|
@@ -16627,14 +17716,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16627
17716
|
if (isComponentFile2)
|
|
16628
17717
|
return primaryFile;
|
|
16629
17718
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
16630
|
-
const nearest = findNearestComponent2(
|
|
17719
|
+
const nearest = findNearestComponent2(resolve32(primaryFile));
|
|
16631
17720
|
return nearest ?? primaryFile;
|
|
16632
17721
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
16633
|
-
for (const
|
|
16634
|
-
state.fileHashes.set(
|
|
17722
|
+
for (const file5 of reactFiles) {
|
|
17723
|
+
state.fileHashes.set(resolve32(file5), computeFileHash(file5));
|
|
16635
17724
|
}
|
|
16636
17725
|
markSsrCacheDirty("react");
|
|
16637
|
-
const primaryFile = reactFiles.find((
|
|
17726
|
+
const primaryFile = reactFiles.find((file5) => !file5.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
16638
17727
|
if (!primaryFile) {
|
|
16639
17728
|
onRebuildComplete({
|
|
16640
17729
|
hmrState: state,
|
|
@@ -16643,8 +17732,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16643
17732
|
return state.manifest;
|
|
16644
17733
|
}
|
|
16645
17734
|
const { invalidateModule: invalidateModule2 } = await getModuleServer();
|
|
16646
|
-
for (const
|
|
16647
|
-
invalidateModule2(
|
|
17735
|
+
for (const file5 of reactFiles) {
|
|
17736
|
+
invalidateModule2(file5);
|
|
16648
17737
|
}
|
|
16649
17738
|
const broadcastTarget = await resolveBroadcastTarget(primaryFile);
|
|
16650
17739
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
@@ -16672,7 +17761,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16672
17761
|
});
|
|
16673
17762
|
return state.manifest;
|
|
16674
17763
|
}, handleReactFastPath = async (state, _config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
16675
|
-
const reactFiles = filesToRebuild.filter((
|
|
17764
|
+
const reactFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "react");
|
|
16676
17765
|
if (reactFiles.length === 0) {
|
|
16677
17766
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
16678
17767
|
return state.manifest;
|
|
@@ -16712,8 +17801,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16712
17801
|
type: "svelte-update"
|
|
16713
17802
|
});
|
|
16714
17803
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
16715
|
-
for (const
|
|
16716
|
-
state.fileHashes.set(
|
|
17804
|
+
for (const file5 of svelteFiles) {
|
|
17805
|
+
state.fileHashes.set(resolve32(file5), computeFileHash(file5));
|
|
16717
17806
|
}
|
|
16718
17807
|
markSsrCacheDirty("svelte");
|
|
16719
17808
|
const serverDuration = Date.now() - startTime;
|
|
@@ -16725,22 +17814,22 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16725
17814
|
return state.manifest;
|
|
16726
17815
|
}, handleSvelteFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
16727
17816
|
const svelteDir = config.svelteDirectory ?? "";
|
|
16728
|
-
const svelteFiles = filesToRebuild.filter((
|
|
17817
|
+
const svelteFiles = filesToRebuild.filter((file5) => (file5.endsWith(".svelte") || file5.includes(".svelte.")) && detectFramework(file5, state.resolvedPaths) === "svelte");
|
|
16729
17818
|
if (svelteFiles.length > 0) {
|
|
16730
17819
|
return handleSvelteModuleServerPath(state, svelteFiles, startTime, onRebuildComplete);
|
|
16731
17820
|
}
|
|
16732
17821
|
const { buildDir } = state.resolvedPaths;
|
|
16733
17822
|
if (svelteFiles.length > 0) {
|
|
16734
17823
|
const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
|
|
16735
|
-
const { build:
|
|
17824
|
+
const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
|
|
16736
17825
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
16737
17826
|
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
|
|
16738
17827
|
const serverEntries = [...svelteServerPaths];
|
|
16739
17828
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
16740
|
-
const serverRoot =
|
|
16741
|
-
const serverOutDir =
|
|
17829
|
+
const serverRoot = resolve32(svelteDir, "generated", "server");
|
|
17830
|
+
const serverOutDir = resolve32(buildDir, basename12(svelteDir));
|
|
16742
17831
|
const [serverResult, clientResult] = await Promise.all([
|
|
16743
|
-
serverEntries.length > 0 ?
|
|
17832
|
+
serverEntries.length > 0 ? bunBuild9({
|
|
16744
17833
|
entrypoints: serverEntries,
|
|
16745
17834
|
external: [
|
|
16746
17835
|
"react",
|
|
@@ -16760,7 +17849,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16760
17849
|
target: "bun",
|
|
16761
17850
|
throw: false
|
|
16762
17851
|
}) : undefined,
|
|
16763
|
-
clientEntries.length > 0 ?
|
|
17852
|
+
clientEntries.length > 0 ? bunBuild9({
|
|
16764
17853
|
entrypoints: clientEntries,
|
|
16765
17854
|
format: "esm",
|
|
16766
17855
|
naming: "[dir]/[name].[hash].[ext]",
|
|
@@ -16780,7 +17869,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16780
17869
|
const duration = Date.now() - startTime;
|
|
16781
17870
|
const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
|
|
16782
17871
|
broadcastFiles.forEach((sveltePagePath) => {
|
|
16783
|
-
const fileName =
|
|
17872
|
+
const fileName = basename12(sveltePagePath);
|
|
16784
17873
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
16785
17874
|
const pascalName = toPascal(baseName);
|
|
16786
17875
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -16811,8 +17900,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16811
17900
|
if (nonVueFiles.length === 0)
|
|
16812
17901
|
return;
|
|
16813
17902
|
const { invalidateModule: invalidateModule2 } = await getModuleServer();
|
|
16814
|
-
for (const
|
|
16815
|
-
invalidateModule2(
|
|
17903
|
+
for (const file5 of nonVueFiles) {
|
|
17904
|
+
invalidateModule2(file5);
|
|
16816
17905
|
}
|
|
16817
17906
|
}, broadcastVueModuleUpdate = async (state, changedFile, vueFiles, nonVueFiles, forceReload, serverDuration) => {
|
|
16818
17907
|
const pageModuleUrl = await getModuleUrl(changedFile);
|
|
@@ -16834,8 +17923,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16834
17923
|
type: "vue-update"
|
|
16835
17924
|
});
|
|
16836
17925
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
16837
|
-
for (const
|
|
16838
|
-
state.fileHashes.set(
|
|
17926
|
+
for (const file5 of [...vueFiles, ...nonVueFiles]) {
|
|
17927
|
+
state.fileHashes.set(resolve32(file5), computeFileHash(file5));
|
|
16839
17928
|
}
|
|
16840
17929
|
markSsrCacheDirty("vue");
|
|
16841
17930
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -16848,16 +17937,68 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16848
17937
|
});
|
|
16849
17938
|
return state.manifest;
|
|
16850
17939
|
}, handleVueFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
16851
|
-
const vueFiles = filesToRebuild.filter((
|
|
16852
|
-
const nonVueFiles = filesToRebuild.filter((
|
|
17940
|
+
const vueFiles = filesToRebuild.filter((file5) => file5.endsWith(".vue") && detectFramework(file5, state.resolvedPaths) === "vue");
|
|
17941
|
+
const nonVueFiles = filesToRebuild.filter((file5) => !file5.endsWith(".vue") && detectFramework(file5, state.resolvedPaths) === "vue");
|
|
16853
17942
|
collectAffectedVueFiles(state, nonVueFiles, vueFiles);
|
|
16854
17943
|
if (vueFiles.length > 0) {
|
|
16855
17944
|
return handleVueModuleServerPath(state, vueFiles, nonVueFiles, startTime, onRebuildComplete);
|
|
16856
17945
|
}
|
|
16857
17946
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
16858
17947
|
return state.manifest;
|
|
17948
|
+
}, EMBER_PAGE_EXTENSIONS, collectAllEmberPages = async (emberPagesPath) => {
|
|
17949
|
+
const { readdir: readdir4 } = await import("fs/promises");
|
|
17950
|
+
try {
|
|
17951
|
+
const entries = await readdir4(emberPagesPath, {
|
|
17952
|
+
recursive: true,
|
|
17953
|
+
withFileTypes: true
|
|
17954
|
+
});
|
|
17955
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve32(emberPagesPath, entry.name));
|
|
17956
|
+
} catch {
|
|
17957
|
+
return [];
|
|
17958
|
+
}
|
|
17959
|
+
}, handleEmberFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
17960
|
+
const emberDir = config.emberDirectory ?? "";
|
|
17961
|
+
const emberFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "ember");
|
|
17962
|
+
if (emberFiles.length === 0 || !emberDir) {
|
|
17963
|
+
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
17964
|
+
return state.manifest;
|
|
17965
|
+
}
|
|
17966
|
+
for (const file5 of emberFiles) {
|
|
17967
|
+
state.fileHashes.set(resolve32(file5), computeFileHash(file5));
|
|
17968
|
+
}
|
|
17969
|
+
const emberPagesPath = resolve32(emberDir, "pages");
|
|
17970
|
+
const directPageEntries = emberFiles.filter((file5) => resolve32(file5).startsWith(emberPagesPath));
|
|
17971
|
+
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
17972
|
+
if (allPageEntries.length === 0) {
|
|
17973
|
+
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
17974
|
+
return state.manifest;
|
|
17975
|
+
}
|
|
17976
|
+
const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
|
|
17977
|
+
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
17978
|
+
for (const serverPath of serverPaths) {
|
|
17979
|
+
const fileBase = basename12(serverPath, ".js");
|
|
17980
|
+
state.manifest[toPascal(fileBase)] = resolve32(serverPath);
|
|
17981
|
+
}
|
|
17982
|
+
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
17983
|
+
invalidateEmberSsrCache2();
|
|
17984
|
+
const duration = Date.now() - startTime;
|
|
17985
|
+
const [primary] = emberFiles;
|
|
17986
|
+
if (primary) {
|
|
17987
|
+
state.lastHmrPath = relative12(process.cwd(), primary).replace(/\\/g, "/");
|
|
17988
|
+
state.lastHmrFramework = "ember";
|
|
17989
|
+
logHmrUpdate(primary, "ember", duration);
|
|
17990
|
+
}
|
|
17991
|
+
broadcastToClients(state, {
|
|
17992
|
+
data: {
|
|
17993
|
+
affectedPages: allPageEntries,
|
|
17994
|
+
manifest: state.manifest
|
|
17995
|
+
},
|
|
17996
|
+
type: "full-reload"
|
|
17997
|
+
});
|
|
17998
|
+
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
17999
|
+
return state.manifest;
|
|
16859
18000
|
}, collectModuleUpdatesForFramework = (framework, filesToRebuild, manifest, state) => {
|
|
16860
|
-
const frameworkFiles = filesToRebuild.filter((
|
|
18001
|
+
const frameworkFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === framework);
|
|
16861
18002
|
if (frameworkFiles.length === 0) {
|
|
16862
18003
|
return [];
|
|
16863
18004
|
}
|
|
@@ -16877,15 +18018,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16877
18018
|
if (!affectedFrameworks.includes("react") || !state.resolvedPaths.reactDir) {
|
|
16878
18019
|
return;
|
|
16879
18020
|
}
|
|
16880
|
-
const reactFiles = filesToRebuild.filter((
|
|
18021
|
+
const reactFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "react");
|
|
16881
18022
|
if (reactFiles.length === 0) {
|
|
16882
18023
|
return;
|
|
16883
18024
|
}
|
|
16884
|
-
const reactPageFiles = reactFiles.filter((
|
|
18025
|
+
const reactPageFiles = reactFiles.filter((file5) => file5.replace(/\\/g, "/").includes("/pages/"));
|
|
16885
18026
|
const sourceFiles = reactPageFiles.length > 0 ? reactPageFiles : reactFiles;
|
|
16886
18027
|
const [primarySource] = sourceFiles;
|
|
16887
18028
|
try {
|
|
16888
|
-
const hasComponentChanges = reactFiles.some((
|
|
18029
|
+
const hasComponentChanges = reactFiles.some((file5) => file5.endsWith(".tsx") || file5.endsWith(".ts") || file5.endsWith(".jsx"));
|
|
16889
18030
|
const hasCSSChanges = reactFiles.some(isStylePath);
|
|
16890
18031
|
logHmrUpdate(primarySource ?? reactFiles[0] ?? "", "react", duration);
|
|
16891
18032
|
broadcastToClients(state, {
|
|
@@ -16906,7 +18047,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16906
18047
|
});
|
|
16907
18048
|
}
|
|
16908
18049
|
}, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
|
|
16909
|
-
const scriptBaseName =
|
|
18050
|
+
const scriptBaseName = basename12(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
|
|
16910
18051
|
const pascalName = toPascal(scriptBaseName);
|
|
16911
18052
|
const scriptPath = manifest[pascalName] || null;
|
|
16912
18053
|
if (!scriptPath) {
|
|
@@ -16923,13 +18064,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16923
18064
|
},
|
|
16924
18065
|
type: "script-update"
|
|
16925
18066
|
});
|
|
16926
|
-
}, isScriptFile = (
|
|
18067
|
+
}, isScriptFile = (file5) => (file5.endsWith(".ts") || file5.endsWith(".js") || file5.endsWith(".tsx") || file5.endsWith(".jsx")) && file5.replace(/\\/g, "/").includes("/scripts/"), resolveIslandDefinitionSource = (definition, buildInfo, islandFiles) => {
|
|
16927
18068
|
const { buildReference } = definition;
|
|
16928
18069
|
if (!buildReference?.source) {
|
|
16929
18070
|
return;
|
|
16930
18071
|
}
|
|
16931
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
16932
|
-
islandFiles.add(
|
|
18072
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve32(dirname17(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
18073
|
+
islandFiles.add(resolve32(sourcePath));
|
|
16933
18074
|
}, resolveIslandSourceFiles = async (config) => {
|
|
16934
18075
|
const registryPath = config.islands?.registry;
|
|
16935
18076
|
if (!registryPath) {
|
|
@@ -16937,7 +18078,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16937
18078
|
}
|
|
16938
18079
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
16939
18080
|
const islandFiles = new Set([
|
|
16940
|
-
|
|
18081
|
+
resolve32(buildInfo.resolvedRegistryPath)
|
|
16941
18082
|
]);
|
|
16942
18083
|
for (const definition of buildInfo.definitions) {
|
|
16943
18084
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -16948,14 +18089,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16948
18089
|
if (islandFiles.size === 0) {
|
|
16949
18090
|
return false;
|
|
16950
18091
|
}
|
|
16951
|
-
return filesToRebuild.some((
|
|
18092
|
+
return filesToRebuild.some((file5) => islandFiles.has(resolve32(file5)));
|
|
16952
18093
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
16953
18094
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
16954
18095
|
if (!shouldReload) {
|
|
16955
18096
|
return false;
|
|
16956
18097
|
}
|
|
16957
18098
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
16958
|
-
const affectedPages = filesToRebuild.flatMap((
|
|
18099
|
+
const affectedPages = filesToRebuild.flatMap((file5) => getPagesUsingIslandSource(file5));
|
|
16959
18100
|
broadcastToClients(state, {
|
|
16960
18101
|
data: {
|
|
16961
18102
|
affectedPages,
|
|
@@ -16968,12 +18109,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16968
18109
|
if (!state.resolvedPaths.htmlDir) {
|
|
16969
18110
|
return;
|
|
16970
18111
|
}
|
|
16971
|
-
const htmlFrameworkFiles = filesToRebuild.filter((
|
|
18112
|
+
const htmlFrameworkFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "html");
|
|
16972
18113
|
if (htmlFrameworkFiles.length === 0) {
|
|
16973
18114
|
return;
|
|
16974
18115
|
}
|
|
16975
18116
|
const scriptFiles = htmlFrameworkFiles.filter(isScriptFile);
|
|
16976
|
-
const htmlPageFiles = htmlFrameworkFiles.filter((
|
|
18117
|
+
const htmlPageFiles = htmlFrameworkFiles.filter((file5) => file5.endsWith(".html"));
|
|
16977
18118
|
if (scriptFiles.length === 0 || htmlPageFiles.length > 0) {
|
|
16978
18119
|
return;
|
|
16979
18120
|
}
|
|
@@ -16983,10 +18124,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16983
18124
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
16984
18125
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
16985
18126
|
if (isSingle) {
|
|
16986
|
-
return
|
|
18127
|
+
return resolve32(state.resolvedPaths.buildDir, "pages");
|
|
16987
18128
|
}
|
|
16988
|
-
const dirName = framework === "html" ?
|
|
16989
|
-
return
|
|
18129
|
+
const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
|
|
18130
|
+
return resolve32(state.resolvedPaths.buildDir, dirName, "pages");
|
|
16990
18131
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
16991
18132
|
try {
|
|
16992
18133
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -17015,17 +18156,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17015
18156
|
return;
|
|
17016
18157
|
}
|
|
17017
18158
|
const shouldRefreshFromIslandChange = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
17018
|
-
const htmlFrameworkFiles = filesToRebuild.filter((
|
|
18159
|
+
const htmlFrameworkFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "html");
|
|
17019
18160
|
if (htmlFrameworkFiles.length === 0 && !shouldRefreshFromIslandChange) {
|
|
17020
18161
|
return;
|
|
17021
18162
|
}
|
|
17022
|
-
const htmlPageFiles = htmlFrameworkFiles.filter((
|
|
18163
|
+
const htmlPageFiles = htmlFrameworkFiles.filter((file5) => file5.endsWith(".html"));
|
|
17023
18164
|
const outputHtmlPages = computeOutputPagesDir(state, config, "html");
|
|
17024
18165
|
const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
17025
18166
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
17026
18167
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
17027
|
-
const htmlPageName =
|
|
17028
|
-
const builtHtmlPagePath =
|
|
18168
|
+
const htmlPageName = basename12(pageFile);
|
|
18169
|
+
const builtHtmlPagePath = resolve32(outputHtmlPages, htmlPageName);
|
|
17029
18170
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
17030
18171
|
});
|
|
17031
18172
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -17033,7 +18174,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17033
18174
|
if (!cssFile) {
|
|
17034
18175
|
return;
|
|
17035
18176
|
}
|
|
17036
|
-
const cssBaseName =
|
|
18177
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
17037
18178
|
const cssPascalName = toPascal(cssBaseName);
|
|
17038
18179
|
const cssKey = `${cssPascalName}CSS`;
|
|
17039
18180
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -17082,7 +18223,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17082
18223
|
type: "vue-update"
|
|
17083
18224
|
});
|
|
17084
18225
|
}, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
|
|
17085
|
-
const fileName =
|
|
18226
|
+
const fileName = basename12(vuePagePath);
|
|
17086
18227
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
17087
18228
|
const pascalName = toPascal(baseName);
|
|
17088
18229
|
const vueRoot = config.vueDirectory;
|
|
@@ -17090,7 +18231,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17090
18231
|
const cssKey = `${pascalName}CSS`;
|
|
17091
18232
|
const cssUrl = manifest[cssKey] || null;
|
|
17092
18233
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
17093
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
18234
|
+
const hmrMeta = vueHmrMetadata2.get(resolve32(vuePagePath));
|
|
17094
18235
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
17095
18236
|
if (changeType === "style-only") {
|
|
17096
18237
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -17110,14 +18251,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17110
18251
|
if (!config.vueDirectory) {
|
|
17111
18252
|
return;
|
|
17112
18253
|
}
|
|
17113
|
-
const vueFiles = filesToRebuild.filter((
|
|
18254
|
+
const vueFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "vue");
|
|
17114
18255
|
if (vueFiles.length === 0) {
|
|
17115
18256
|
return;
|
|
17116
18257
|
}
|
|
17117
|
-
const vueComponentFiles = vueFiles.filter((
|
|
18258
|
+
const vueComponentFiles = vueFiles.filter((file5) => file5.endsWith(".vue"));
|
|
17118
18259
|
const vueCssFiles = vueFiles.filter(isStylePath);
|
|
17119
18260
|
const isCssOnlyChange = vueComponentFiles.length === 0 && vueCssFiles.length > 0;
|
|
17120
|
-
const vuePageFiles = vueFiles.filter((
|
|
18261
|
+
const vuePageFiles = vueFiles.filter((file5) => file5.replace(/\\/g, "/").includes("/pages/"));
|
|
17121
18262
|
const pagesToUpdate = vuePageFiles.length > 0 ? vuePageFiles : vueComponentFiles;
|
|
17122
18263
|
if (isCssOnlyChange && vueCssFiles.length > 0) {
|
|
17123
18264
|
handleVueCssOnlyUpdate(state, vueCssFiles, manifest, duration);
|
|
@@ -17128,7 +18269,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17128
18269
|
if (!cssFile) {
|
|
17129
18270
|
return;
|
|
17130
18271
|
}
|
|
17131
|
-
const cssBaseName =
|
|
18272
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
17132
18273
|
const cssPascalName = toPascal(cssBaseName);
|
|
17133
18274
|
const cssKey = `${cssPascalName}CSS`;
|
|
17134
18275
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -17146,7 +18287,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17146
18287
|
});
|
|
17147
18288
|
}, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
|
|
17148
18289
|
try {
|
|
17149
|
-
const fileName =
|
|
18290
|
+
const fileName = basename12(sveltePagePath);
|
|
17150
18291
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
17151
18292
|
const pascalName = toPascal(baseName);
|
|
17152
18293
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -17174,14 +18315,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17174
18315
|
if (!config.svelteDirectory) {
|
|
17175
18316
|
return;
|
|
17176
18317
|
}
|
|
17177
|
-
const svelteFiles = filesToRebuild.filter((
|
|
18318
|
+
const svelteFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "svelte");
|
|
17178
18319
|
if (svelteFiles.length === 0) {
|
|
17179
18320
|
return;
|
|
17180
18321
|
}
|
|
17181
|
-
const svelteComponentFiles = svelteFiles.filter((
|
|
18322
|
+
const svelteComponentFiles = svelteFiles.filter((file5) => file5.endsWith(".svelte"));
|
|
17182
18323
|
const svelteCssFiles = svelteFiles.filter(isStylePath);
|
|
17183
18324
|
const isCssOnlyChange = svelteComponentFiles.length === 0 && svelteCssFiles.length > 0;
|
|
17184
|
-
const sveltePageFiles = svelteFiles.filter((
|
|
18325
|
+
const sveltePageFiles = svelteFiles.filter((file5) => file5.replace(/\\/g, "/").includes("/pages/"));
|
|
17185
18326
|
const pagesToUpdate = sveltePageFiles.length > 0 ? sveltePageFiles : svelteComponentFiles;
|
|
17186
18327
|
if (isCssOnlyChange && svelteCssFiles.length > 0) {
|
|
17187
18328
|
handleSvelteCssOnlyUpdate(state, svelteCssFiles, manifest, duration);
|
|
@@ -17190,9 +18331,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17190
18331
|
broadcastSveltePageUpdate(state, sveltePagePath, manifest, duration);
|
|
17191
18332
|
});
|
|
17192
18333
|
}, collectAngularAffectedPages = (affected, resolvedPages) => {
|
|
17193
|
-
affected.forEach((
|
|
17194
|
-
if (
|
|
17195
|
-
resolvedPages.add(
|
|
18334
|
+
affected.forEach((file5) => {
|
|
18335
|
+
if (file5.replace(/\\/g, "/").includes("/pages/") && file5.endsWith(".ts")) {
|
|
18336
|
+
resolvedPages.add(file5);
|
|
17196
18337
|
}
|
|
17197
18338
|
});
|
|
17198
18339
|
}, resolveAngularPagesFromDependencyGraph = (state, angularFiles) => {
|
|
@@ -17208,7 +18349,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17208
18349
|
if (!cssFile) {
|
|
17209
18350
|
return;
|
|
17210
18351
|
}
|
|
17211
|
-
const cssBaseName =
|
|
18352
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
17212
18353
|
const cssPascalName = toPascal(cssBaseName);
|
|
17213
18354
|
const cssKey = `${cssPascalName}CSS`;
|
|
17214
18355
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -17226,7 +18367,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17226
18367
|
});
|
|
17227
18368
|
}, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration) => {
|
|
17228
18369
|
try {
|
|
17229
|
-
const fileName =
|
|
18370
|
+
const fileName = basename12(angularPagePath);
|
|
17230
18371
|
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
17231
18372
|
const pascalName = toPascal(baseName);
|
|
17232
18373
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -17253,13 +18394,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17253
18394
|
if (!config.angularDirectory) {
|
|
17254
18395
|
return;
|
|
17255
18396
|
}
|
|
17256
|
-
const angularFiles = filesToRebuild.filter((
|
|
18397
|
+
const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
|
|
17257
18398
|
if (angularFiles.length === 0) {
|
|
17258
18399
|
return;
|
|
17259
18400
|
}
|
|
17260
18401
|
const angularCssFiles = angularFiles.filter(isStylePath);
|
|
17261
18402
|
const isCssOnlyChange = angularFiles.every(isStylePath) && angularCssFiles.length > 0;
|
|
17262
|
-
const angularPageFiles = angularFiles.filter((
|
|
18403
|
+
const angularPageFiles = angularFiles.filter((file5) => file5.replace(/\\/g, "/").includes("/pages/"));
|
|
17263
18404
|
let pagesToUpdate = angularPageFiles;
|
|
17264
18405
|
if (pagesToUpdate.length === 0 && state.dependencyGraph) {
|
|
17265
18406
|
pagesToUpdate = resolveAngularPagesFromDependencyGraph(state, angularFiles);
|
|
@@ -17275,12 +18416,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17275
18416
|
if (!state.resolvedPaths.htmxDir) {
|
|
17276
18417
|
return;
|
|
17277
18418
|
}
|
|
17278
|
-
const htmxFrameworkFiles = filesToRebuild.filter((
|
|
18419
|
+
const htmxFrameworkFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "htmx");
|
|
17279
18420
|
if (htmxFrameworkFiles.length === 0) {
|
|
17280
18421
|
return;
|
|
17281
18422
|
}
|
|
17282
18423
|
const htmxScriptFiles = htmxFrameworkFiles.filter(isScriptFile);
|
|
17283
|
-
const htmxHtmlFiles = htmxFrameworkFiles.filter((
|
|
18424
|
+
const htmxHtmlFiles = htmxFrameworkFiles.filter((file5) => file5.endsWith(".html"));
|
|
17284
18425
|
if (htmxScriptFiles.length === 0 || htmxHtmlFiles.length > 0) {
|
|
17285
18426
|
return;
|
|
17286
18427
|
}
|
|
@@ -17315,17 +18456,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17315
18456
|
return;
|
|
17316
18457
|
}
|
|
17317
18458
|
const shouldRefreshFromIslandChange = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
17318
|
-
const htmxFrameworkFiles = filesToRebuild.filter((
|
|
18459
|
+
const htmxFrameworkFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "htmx");
|
|
17319
18460
|
if (htmxFrameworkFiles.length === 0 && !shouldRefreshFromIslandChange) {
|
|
17320
18461
|
return;
|
|
17321
18462
|
}
|
|
17322
|
-
const htmxPageFiles = htmxFrameworkFiles.filter((
|
|
18463
|
+
const htmxPageFiles = htmxFrameworkFiles.filter((file5) => file5.endsWith(".html"));
|
|
17323
18464
|
const outputHtmxPages = computeOutputPagesDir(state, config, "htmx");
|
|
17324
18465
|
const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
17325
18466
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
17326
18467
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
17327
|
-
const htmxPageName =
|
|
17328
|
-
const builtHtmxPagePath =
|
|
18468
|
+
const htmxPageName = basename12(htmxPageFile);
|
|
18469
|
+
const builtHtmxPagePath = resolve32(outputHtmxPages, htmxPageName);
|
|
17329
18470
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
17330
18471
|
});
|
|
17331
18472
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -17394,9 +18535,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17394
18535
|
handleModuleUpdates(state, allModuleUpdates, manifest);
|
|
17395
18536
|
}, logStyleUpdatesForFramework = (state, framework, filesToRebuild, startTime) => {
|
|
17396
18537
|
const dur = Date.now() - startTime;
|
|
17397
|
-
filesToRebuild.forEach((
|
|
17398
|
-
if (detectFramework(
|
|
17399
|
-
logCssUpdate(
|
|
18538
|
+
filesToRebuild.forEach((file5) => {
|
|
18539
|
+
if (detectFramework(file5, state.resolvedPaths) === framework) {
|
|
18540
|
+
logCssUpdate(file5, framework, dur);
|
|
17400
18541
|
}
|
|
17401
18542
|
});
|
|
17402
18543
|
}, broadcastSingleFrameworkUpdate = (state, framework, filesToRebuild, manifest, startTime) => {
|
|
@@ -17434,7 +18575,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17434
18575
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
17435
18576
|
writeFs(destPath, html);
|
|
17436
18577
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
17437
|
-
const destPath =
|
|
18578
|
+
const destPath = resolve32(outputDir, basename12(sourceFile));
|
|
17438
18579
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
17439
18580
|
const source = await Bun.file(sourceFile).text();
|
|
17440
18581
|
await Bun.write(destPath, source);
|
|
@@ -17464,7 +18605,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17464
18605
|
return false;
|
|
17465
18606
|
}
|
|
17466
18607
|
}, runMarkupFastPath = async (state, config, filesToRebuild, startTime, framework) => {
|
|
17467
|
-
const markupFiles = (filesToRebuild ?? []).filter((
|
|
18608
|
+
const markupFiles = (filesToRebuild ?? []).filter((file5) => file5.endsWith(".html"));
|
|
17468
18609
|
if (markupFiles.length === 0)
|
|
17469
18610
|
return;
|
|
17470
18611
|
const outputDir = computeOutputPagesDir(state, config, framework);
|
|
@@ -17493,6 +18634,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17493
18634
|
framework: "angular",
|
|
17494
18635
|
handler: handleAngularFastPath
|
|
17495
18636
|
},
|
|
18637
|
+
{
|
|
18638
|
+
directory: config.emberDirectory,
|
|
18639
|
+
framework: "ember",
|
|
18640
|
+
handler: handleEmberFastPath
|
|
18641
|
+
},
|
|
17496
18642
|
{
|
|
17497
18643
|
directory: config.reactDirectory,
|
|
17498
18644
|
framework: "react",
|
|
@@ -17610,7 +18756,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17610
18756
|
queuedFiles.push(...filePaths);
|
|
17611
18757
|
});
|
|
17612
18758
|
state.fileChangeQueue.clear();
|
|
17613
|
-
pending.forEach((
|
|
18759
|
+
pending.forEach((file5) => state.rebuildQueue.add(file5));
|
|
17614
18760
|
if (state.rebuildTimeout)
|
|
17615
18761
|
clearTimeout(state.rebuildTimeout);
|
|
17616
18762
|
state.rebuildTimeout = setTimeout(() => {
|
|
@@ -17677,6 +18823,7 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
17677
18823
|
init_ssrCache();
|
|
17678
18824
|
moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
17679
18825
|
getReactModuleUrl = getModuleUrl;
|
|
18826
|
+
EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
|
|
17680
18827
|
HMR_SCRIPT_PATTERN = /<script>window\.__HMR_FRAMEWORK__[\s\S]*?<\/script>\s*<script data-hmr-client>[\s\S]*?<\/script>/;
|
|
17681
18828
|
});
|
|
17682
18829
|
|
|
@@ -17686,23 +18833,26 @@ __export(exports_buildDepVendor, {
|
|
|
17686
18833
|
computeDepVendorPaths: () => computeDepVendorPaths,
|
|
17687
18834
|
buildDepVendor: () => buildDepVendor
|
|
17688
18835
|
});
|
|
17689
|
-
import { mkdirSync as
|
|
17690
|
-
import { join as
|
|
17691
|
-
import { rm as
|
|
17692
|
-
var {build:
|
|
17693
|
-
var
|
|
18836
|
+
import { mkdirSync as mkdirSync12 } from "fs";
|
|
18837
|
+
import { join as join27 } from "path";
|
|
18838
|
+
import { rm as rm11 } from "fs/promises";
|
|
18839
|
+
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
18840
|
+
var toSafeFileName6 = (specifier) => {
|
|
18841
|
+
const prefix = specifier.startsWith("@") ? "_" : "";
|
|
18842
|
+
return prefix + specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_");
|
|
18843
|
+
}, isResolvable4 = (specifier) => {
|
|
17694
18844
|
try {
|
|
17695
18845
|
Bun.resolveSync(specifier, process.cwd());
|
|
17696
18846
|
return true;
|
|
17697
18847
|
} catch {
|
|
17698
18848
|
return false;
|
|
17699
18849
|
}
|
|
17700
|
-
}, isBareSpecifier2 = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAbsolutePackageSpecifier = (spec) => spec === "@absolutejs/absolute" || spec.startsWith("@absolutejs/absolute/"), FRAMEWORK_SPECIFIERS, FRAMEWORK_NAMESPACE_PREFIXES, isFrameworkSpecifier = (spec) => FRAMEWORK_SPECIFIERS.has(spec) || FRAMEWORK_NAMESPACE_PREFIXES.some((prefix) => spec.startsWith(prefix)), FRAMEWORK_EXTERNALS, isSkippedFile = (
|
|
18850
|
+
}, isBareSpecifier2 = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAbsolutePackageSpecifier = (spec) => spec === "@absolutejs/absolute" || spec.startsWith("@absolutejs/absolute/"), FRAMEWORK_SPECIFIERS, FRAMEWORK_NAMESPACE_PREFIXES, isFrameworkSpecifier = (spec) => FRAMEWORK_SPECIFIERS.has(spec) || FRAMEWORK_NAMESPACE_PREFIXES.some((prefix) => spec.startsWith(prefix)), FRAMEWORK_EXTERNALS, isSkippedFile = (file5) => file5.includes("node_modules") || file5.includes("/build/") || file5.includes("/dist/") || file5.includes("/indexes/"), isDepSpecifier = (path) => isBareSpecifier2(path) && !isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), isFrameworkRootCandidate = (path) => isBareSpecifier2(path) && isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), readFileSpecifiers = async (file5, transpiler5) => {
|
|
17701
18851
|
const dep = [];
|
|
17702
18852
|
const framework = [];
|
|
17703
18853
|
try {
|
|
17704
|
-
const content = await Bun.file(
|
|
17705
|
-
for (const imp of
|
|
18854
|
+
const content = await Bun.file(file5).text();
|
|
18855
|
+
for (const imp of transpiler5.scanImports(content)) {
|
|
17706
18856
|
if (isDepSpecifier(imp.path))
|
|
17707
18857
|
dep.push(imp.path);
|
|
17708
18858
|
else if (isFrameworkRootCandidate(imp.path))
|
|
@@ -17715,13 +18865,13 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17715
18865
|
const glob = new Glob9("**/*.{ts,tsx,js,jsx}");
|
|
17716
18866
|
try {
|
|
17717
18867
|
const all = await Array.fromAsync(glob.scan({ absolute: true, cwd: dir }));
|
|
17718
|
-
return all.filter((
|
|
18868
|
+
return all.filter((file5) => !isSkippedFile(file5));
|
|
17719
18869
|
} catch {
|
|
17720
18870
|
return empty;
|
|
17721
18871
|
}
|
|
17722
|
-
}, collectDirSpecifiers = async (dir,
|
|
18872
|
+
}, collectDirSpecifiers = async (dir, transpiler5, dep, framework) => {
|
|
17723
18873
|
const files = await scanDirFiles(dir);
|
|
17724
|
-
const results = await Promise.all(files.map((
|
|
18874
|
+
const results = await Promise.all(files.map((file5) => readFileSpecifiers(file5, transpiler5)));
|
|
17725
18875
|
for (const result of results) {
|
|
17726
18876
|
for (const spec of result.dep)
|
|
17727
18877
|
dep.add(spec);
|
|
@@ -17731,15 +18881,15 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17731
18881
|
}, scanBareImports = async (directories) => {
|
|
17732
18882
|
const dep = new Set;
|
|
17733
18883
|
const framework = new Set;
|
|
17734
|
-
const
|
|
17735
|
-
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir,
|
|
18884
|
+
const transpiler5 = new Bun.Transpiler({ loader: "tsx" });
|
|
18885
|
+
await Promise.all(directories.map((dir) => collectDirSpecifiers(dir, transpiler5, dep, framework)));
|
|
17736
18886
|
return {
|
|
17737
18887
|
dep: Array.from(dep).filter(isResolvable4),
|
|
17738
18888
|
framework: Array.from(framework).filter(isResolvable4)
|
|
17739
18889
|
};
|
|
17740
18890
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
17741
18891
|
const { readFileSync: readFileSync17 } = await import("fs");
|
|
17742
|
-
const
|
|
18892
|
+
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
17743
18893
|
const newSpecs = new Set;
|
|
17744
18894
|
for (const spec of specs) {
|
|
17745
18895
|
if (alreadyScanned.has(spec))
|
|
@@ -17759,7 +18909,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17759
18909
|
}
|
|
17760
18910
|
let imports;
|
|
17761
18911
|
try {
|
|
17762
|
-
imports =
|
|
18912
|
+
imports = transpiler5.scanImports(content);
|
|
17763
18913
|
} catch {
|
|
17764
18914
|
continue;
|
|
17765
18915
|
}
|
|
@@ -17779,32 +18929,53 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17779
18929
|
}
|
|
17780
18930
|
}
|
|
17781
18931
|
return newSpecs;
|
|
17782
|
-
},
|
|
17783
|
-
|
|
17784
|
-
|
|
17785
|
-
|
|
17786
|
-
|
|
17787
|
-
|
|
18932
|
+
}, PURE_ANNOTATION, createStripPureAnnotationsPlugin = () => ({
|
|
18933
|
+
name: "absolute-dep-vendor-strip-pure",
|
|
18934
|
+
setup(bld) {
|
|
18935
|
+
bld.onLoad({ filter: /\.(?:m?js|cjs)$/ }, async (args) => {
|
|
18936
|
+
const source = await Bun.file(args.path).text();
|
|
18937
|
+
if (!source.includes("@__PURE__"))
|
|
18938
|
+
return null;
|
|
18939
|
+
return {
|
|
18940
|
+
contents: source.replace(PURE_ANNOTATION, ""),
|
|
18941
|
+
loader: args.path.endsWith(".cjs") ? "js" : "js"
|
|
18942
|
+
};
|
|
18943
|
+
});
|
|
18944
|
+
}
|
|
18945
|
+
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
18946
|
+
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
18947
|
+
const safeName = toSafeFileName6(specifier);
|
|
18948
|
+
const entryPath = join27(tmpDir, `${safeName}.ts`);
|
|
18949
|
+
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
18950
|
+
return { entryPath, specifier };
|
|
17788
18951
|
}));
|
|
17789
|
-
|
|
17790
|
-
|
|
17791
|
-
|
|
18952
|
+
const otherSpecsFor = (current) => specifiers.filter((spec) => spec !== current);
|
|
18953
|
+
const results = await Promise.all(entries.map(({ entryPath, specifier }) => bunBuild9({
|
|
18954
|
+
entrypoints: [entryPath],
|
|
18955
|
+
external: [...FRAMEWORK_EXTERNALS, ...otherSpecsFor(specifier)],
|
|
17792
18956
|
format: "esm",
|
|
17793
18957
|
minify: false,
|
|
17794
18958
|
naming: "[name].[ext]",
|
|
17795
18959
|
outdir: vendorDir,
|
|
18960
|
+
plugins: [createStripPureAnnotationsPlugin()],
|
|
17796
18961
|
splitting: false,
|
|
17797
18962
|
target: "browser",
|
|
17798
18963
|
throw: false
|
|
17799
|
-
});
|
|
18964
|
+
})));
|
|
18965
|
+
const aggregated = {
|
|
18966
|
+
success: results.every((result) => result.success),
|
|
18967
|
+
logs: results.flatMap((result) => result.logs),
|
|
18968
|
+
outputs: results.flatMap((result) => result.outputs)
|
|
18969
|
+
};
|
|
18970
|
+
return aggregated;
|
|
17800
18971
|
}, MAX_VENDOR_DISCOVERY_PASSES = 5, buildDepVendor = async (buildDir, directories) => {
|
|
17801
18972
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
17802
18973
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
17803
18974
|
return {};
|
|
17804
|
-
const vendorDir =
|
|
17805
|
-
|
|
17806
|
-
const tmpDir =
|
|
17807
|
-
|
|
18975
|
+
const vendorDir = join27(buildDir, "vendor");
|
|
18976
|
+
mkdirSync12(vendorDir, { recursive: true });
|
|
18977
|
+
const tmpDir = join27(buildDir, "_dep_vendor_tmp");
|
|
18978
|
+
mkdirSync12(tmpDir, { recursive: true });
|
|
17808
18979
|
const allSpecs = new Set(initialSpecs);
|
|
17809
18980
|
const alreadyScanned = new Set;
|
|
17810
18981
|
let frontier = [...allSpecs, ...frameworkRoots];
|
|
@@ -17823,10 +18994,10 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17823
18994
|
if (!success) {
|
|
17824
18995
|
console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
|
|
17825
18996
|
}
|
|
17826
|
-
await
|
|
18997
|
+
await rm11(tmpDir, { force: true, recursive: true });
|
|
17827
18998
|
const paths = {};
|
|
17828
18999
|
for (const specifier of allSpecs) {
|
|
17829
|
-
paths[specifier] = `/vendor/${
|
|
19000
|
+
paths[specifier] = `/vendor/${toSafeFileName6(specifier)}.js`;
|
|
17830
19001
|
}
|
|
17831
19002
|
return paths;
|
|
17832
19003
|
}, computeDepVendorPaths = async (directories) => {
|
|
@@ -17844,11 +19015,12 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17844
19015
|
}
|
|
17845
19016
|
const paths = {};
|
|
17846
19017
|
for (const specifier of allSpecs) {
|
|
17847
|
-
paths[specifier] = `/vendor/${
|
|
19018
|
+
paths[specifier] = `/vendor/${toSafeFileName6(specifier)}.js`;
|
|
17848
19019
|
}
|
|
17849
19020
|
return paths;
|
|
17850
19021
|
};
|
|
17851
19022
|
var init_buildDepVendor = __esm(() => {
|
|
19023
|
+
init_vendorEntrySource();
|
|
17852
19024
|
FRAMEWORK_SPECIFIERS = new Set([
|
|
17853
19025
|
"react",
|
|
17854
19026
|
"react-dom",
|
|
@@ -17875,6 +19047,7 @@ var init_buildDepVendor = __esm(() => {
|
|
|
17875
19047
|
...FRAMEWORK_SPECIFIERS,
|
|
17876
19048
|
...FRAMEWORK_NAMESPACE_PREFIXES.map((prefix) => `${prefix}*`)
|
|
17877
19049
|
];
|
|
19050
|
+
PURE_ANNOTATION = /\/\*\s*@__PURE__\s*\*\//g;
|
|
17878
19051
|
});
|
|
17879
19052
|
|
|
17880
19053
|
// src/core/devBuild.ts
|
|
@@ -17884,7 +19057,7 @@ __export(exports_devBuild, {
|
|
|
17884
19057
|
});
|
|
17885
19058
|
import { readdir as readdir4 } from "fs/promises";
|
|
17886
19059
|
import { statSync as statSync3 } from "fs";
|
|
17887
|
-
import { resolve as
|
|
19060
|
+
import { resolve as resolve33 } from "path";
|
|
17888
19061
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
17889
19062
|
const configuredDirs = [
|
|
17890
19063
|
config.reactDirectory,
|
|
@@ -17907,7 +19080,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
17907
19080
|
return Object.keys(config).length > 0 ? config : null;
|
|
17908
19081
|
}, reloadConfig = async () => {
|
|
17909
19082
|
try {
|
|
17910
|
-
const configPath2 =
|
|
19083
|
+
const configPath2 = resolve33(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
17911
19084
|
const source = await Bun.file(configPath2).text();
|
|
17912
19085
|
return parseDirectoryConfig(source);
|
|
17913
19086
|
} catch {
|
|
@@ -17939,6 +19112,9 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
17939
19112
|
if (!oldConfig.vueDirectory && Boolean(newConfig.vueDirectory)) {
|
|
17940
19113
|
setVueVendorPaths(computeVueVendorPaths());
|
|
17941
19114
|
}
|
|
19115
|
+
if (!oldConfig.emberDirectory && Boolean(newConfig.emberDirectory)) {
|
|
19116
|
+
setEmberVendorPaths(computeEmberVendorPaths());
|
|
19117
|
+
}
|
|
17942
19118
|
const newWatchPaths = getWatchPaths(state.config, state.resolvedPaths);
|
|
17943
19119
|
const addedPaths = newWatchPaths.filter((path) => !oldWatchPaths.has(path));
|
|
17944
19120
|
if (addedPaths.length > 0) {
|
|
@@ -17989,7 +19165,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
17989
19165
|
state.fileChangeQueue.clear();
|
|
17990
19166
|
}
|
|
17991
19167
|
}, handleCachedReload = async () => {
|
|
17992
|
-
const serverMtime = statSync3(
|
|
19168
|
+
const serverMtime = statSync3(resolve33(Bun.main)).mtimeMs;
|
|
17993
19169
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
17994
19170
|
globalThis.__hmrServerMtime = serverMtime;
|
|
17995
19171
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -18005,6 +19181,9 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
18005
19181
|
if (cached?.hmrState.config.vueDirectory) {
|
|
18006
19182
|
setVueVendorPaths(computeVueVendorPaths());
|
|
18007
19183
|
}
|
|
19184
|
+
if (cached?.hmrState.config.emberDirectory) {
|
|
19185
|
+
setEmberVendorPaths(computeEmberVendorPaths());
|
|
19186
|
+
}
|
|
18008
19187
|
if (serverMtime === lastMtime) {
|
|
18009
19188
|
globalThis.__hmrSkipServerRestart = true;
|
|
18010
19189
|
return;
|
|
@@ -18023,8 +19202,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
18023
19202
|
return true;
|
|
18024
19203
|
}, resolveAbsoluteVersion2 = async () => {
|
|
18025
19204
|
const candidates = [
|
|
18026
|
-
|
|
18027
|
-
|
|
19205
|
+
resolve33(import.meta.dir, "..", "..", "package.json"),
|
|
19206
|
+
resolve33(import.meta.dir, "..", "package.json")
|
|
18028
19207
|
];
|
|
18029
19208
|
const [candidate, ...remaining] = candidates;
|
|
18030
19209
|
if (!candidate) {
|
|
@@ -18050,7 +19229,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
18050
19229
|
const entries = await readdir4(vendorDir).catch(() => emptyStringArray);
|
|
18051
19230
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
18052
19231
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
18053
|
-
const bytes = await Bun.file(
|
|
19232
|
+
const bytes = await Bun.file(resolve33(vendorDir, entry)).bytes();
|
|
18054
19233
|
assetStore.set(webPath, bytes);
|
|
18055
19234
|
}));
|
|
18056
19235
|
}, devBuild = async (config) => {
|
|
@@ -18085,6 +19264,9 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
18085
19264
|
if (config.vueDirectory) {
|
|
18086
19265
|
setVueVendorPaths(computeVueVendorPaths());
|
|
18087
19266
|
}
|
|
19267
|
+
if (config.emberDirectory) {
|
|
19268
|
+
setEmberVendorPaths(computeEmberVendorPaths());
|
|
19269
|
+
}
|
|
18088
19270
|
const sourceDirs = collectDepVendorSourceDirs(config);
|
|
18089
19271
|
if (config.angularDirectory) {
|
|
18090
19272
|
setAngularVendorPaths(await computeAngularVendorPathsAsync(sourceDirs));
|
|
@@ -18116,18 +19298,19 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
18116
19298
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
18117
19299
|
recordStep("populate asset store", stepStartedAt);
|
|
18118
19300
|
stepStartedAt = performance.now();
|
|
18119
|
-
const reactVendorDir =
|
|
18120
|
-
const angularVendorDir =
|
|
18121
|
-
const svelteVendorDir =
|
|
18122
|
-
const vueVendorDir =
|
|
18123
|
-
const depVendorDir =
|
|
19301
|
+
const reactVendorDir = resolve33(state.resolvedPaths.buildDir, "react", "vendor");
|
|
19302
|
+
const angularVendorDir = resolve33(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
19303
|
+
const svelteVendorDir = resolve33(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
19304
|
+
const vueVendorDir = resolve33(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
19305
|
+
const depVendorDir = resolve33(state.resolvedPaths.buildDir, "vendor");
|
|
18124
19306
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
18125
|
-
const [, angularSpecs, angularServerSpecs, , , depPaths] = await Promise.all([
|
|
19307
|
+
const [, angularSpecs, angularServerSpecs, , , , depPaths] = await Promise.all([
|
|
18126
19308
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
18127
19309
|
config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs, true, Object.keys(globalThis.__depVendorPaths ?? {})) : Promise.resolve(undefined),
|
|
18128
19310
|
config.angularDirectory ? buildAngularServerVendor(state.resolvedPaths.buildDir, sourceDirs, true) : Promise.resolve(undefined),
|
|
18129
19311
|
config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
18130
19312
|
config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
19313
|
+
config.emberDirectory ? buildEmberVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
18131
19314
|
buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs)
|
|
18132
19315
|
]);
|
|
18133
19316
|
if (angularSpecs)
|
|
@@ -18135,6 +19318,9 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
18135
19318
|
if (angularServerSpecs) {
|
|
18136
19319
|
setAngularServerVendorPaths(computeAngularServerVendorPaths(state.resolvedPaths.buildDir, angularServerSpecs));
|
|
18137
19320
|
}
|
|
19321
|
+
if (config.emberDirectory) {
|
|
19322
|
+
setEmberVendorPaths(computeEmberVendorPaths());
|
|
19323
|
+
}
|
|
18138
19324
|
globalThis.__depVendorPaths = depPaths;
|
|
18139
19325
|
recordStep("build vendor bundles", stepStartedAt);
|
|
18140
19326
|
stepStartedAt = performance.now();
|
|
@@ -18197,7 +19383,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
18197
19383
|
manifest
|
|
18198
19384
|
};
|
|
18199
19385
|
globalThis.__hmrDevResult = result;
|
|
18200
|
-
globalThis.__hmrServerMtime = statSync3(
|
|
19386
|
+
globalThis.__hmrServerMtime = statSync3(resolve33(Bun.main)).mtimeMs;
|
|
18201
19387
|
return result;
|
|
18202
19388
|
};
|
|
18203
19389
|
var init_devBuild = __esm(() => {
|
|
@@ -18206,6 +19392,7 @@ var init_devBuild = __esm(() => {
|
|
|
18206
19392
|
init_buildAngularVendor();
|
|
18207
19393
|
init_buildSvelteVendor();
|
|
18208
19394
|
init_buildVueVendor();
|
|
19395
|
+
init_buildEmberVendor();
|
|
18209
19396
|
init_clientManager();
|
|
18210
19397
|
init_configResolver();
|
|
18211
19398
|
init_dependencyGraph();
|
|
@@ -18291,14 +19478,14 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
|
|
|
18291
19478
|
return new Response(null, { headers: { ETag: etag }, status: 304 });
|
|
18292
19479
|
}
|
|
18293
19480
|
return moduleResponse;
|
|
18294
|
-
},
|
|
19481
|
+
}, resolveRequestPathname2 = (request) => {
|
|
18295
19482
|
const rawUrl = request.url;
|
|
18296
19483
|
const qIdx = rawUrl.indexOf("?");
|
|
18297
19484
|
const pathEnd = qIdx === UNFOUND_INDEX ? rawUrl.length : qIdx;
|
|
18298
19485
|
const pathStart = rawUrl.indexOf("/", rawUrl.indexOf("//") + 2);
|
|
18299
19486
|
return rawUrl.slice(pathStart, pathEnd);
|
|
18300
19487
|
}, resolveDevAssetResponse = async (request, hmrState2, moduleServerHandler) => {
|
|
18301
|
-
const pathname =
|
|
19488
|
+
const pathname = resolveRequestPathname2(request);
|
|
18302
19489
|
if (moduleServerHandler) {
|
|
18303
19490
|
const moduleResponse = await moduleServerHandler(pathname);
|
|
18304
19491
|
if (moduleResponse) {
|
|
@@ -18369,14 +19556,14 @@ __export(exports_devtoolsJson, {
|
|
|
18369
19556
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
18370
19557
|
devtoolsJson: () => devtoolsJson
|
|
18371
19558
|
});
|
|
18372
|
-
import { existsSync as
|
|
18373
|
-
import { dirname as
|
|
19559
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync13, readFileSync as readFileSync17, writeFileSync as writeFileSync8 } from "fs";
|
|
19560
|
+
import { dirname as dirname18, join as join28, resolve as resolve34 } from "path";
|
|
18374
19561
|
import { Elysia as Elysia3 } from "elysia";
|
|
18375
19562
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
18376
19563
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
18377
19564
|
return uuid;
|
|
18378
|
-
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) =>
|
|
18379
|
-
if (!
|
|
19565
|
+
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve34(uuidCachePath ?? join28(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
19566
|
+
if (!existsSync26(cachePath))
|
|
18380
19567
|
return null;
|
|
18381
19568
|
try {
|
|
18382
19569
|
const value = readFileSync17(cachePath, "utf-8").trim();
|
|
@@ -18397,11 +19584,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
18397
19584
|
if (cachedUuid)
|
|
18398
19585
|
return setGlobalUuid(cachedUuid);
|
|
18399
19586
|
const uuid = crypto.randomUUID();
|
|
18400
|
-
|
|
19587
|
+
mkdirSync13(dirname18(cachePath), { recursive: true });
|
|
18401
19588
|
writeFileSync8(cachePath, uuid, "utf-8");
|
|
18402
19589
|
return setGlobalUuid(uuid);
|
|
18403
19590
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
18404
|
-
const rootPath =
|
|
19591
|
+
const rootPath = resolve34(options.projectRoot ?? process.cwd());
|
|
18405
19592
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
18406
19593
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
18407
19594
|
return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -18414,11 +19601,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
18414
19601
|
if (process.env.WSL_DISTRO_NAME) {
|
|
18415
19602
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
18416
19603
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
18417
|
-
return
|
|
19604
|
+
return join28("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
18418
19605
|
}
|
|
18419
19606
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
18420
19607
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
18421
|
-
return
|
|
19608
|
+
return join28("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
18422
19609
|
}
|
|
18423
19610
|
return root;
|
|
18424
19611
|
};
|
|
@@ -18429,13 +19616,13 @@ var exports_imageOptimizer = {};
|
|
|
18429
19616
|
__export(exports_imageOptimizer, {
|
|
18430
19617
|
imageOptimizer: () => imageOptimizer
|
|
18431
19618
|
});
|
|
18432
|
-
import { existsSync as
|
|
18433
|
-
import { resolve as
|
|
19619
|
+
import { existsSync as existsSync27 } from "fs";
|
|
19620
|
+
import { resolve as resolve35 } from "path";
|
|
18434
19621
|
import { Elysia as Elysia4 } from "elysia";
|
|
18435
19622
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
18436
19623
|
try {
|
|
18437
19624
|
const resolved = validateSafePath(path, baseDir);
|
|
18438
|
-
if (
|
|
19625
|
+
if (existsSync27(resolved))
|
|
18439
19626
|
return resolved;
|
|
18440
19627
|
return null;
|
|
18441
19628
|
} catch {
|
|
@@ -18443,7 +19630,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
18443
19630
|
}
|
|
18444
19631
|
}, resolveLocalImage = (url, buildDir) => {
|
|
18445
19632
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
18446
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
19633
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve35(process.cwd()));
|
|
18447
19634
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
18448
19635
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
18449
19636
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -18507,14 +19694,14 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
18507
19694
|
error: new Response(`Image not found: ${url}`, { status: 404 })
|
|
18508
19695
|
};
|
|
18509
19696
|
}
|
|
18510
|
-
const
|
|
18511
|
-
if (!await
|
|
19697
|
+
const file5 = Bun.file(resolvedPath);
|
|
19698
|
+
if (!await file5.exists()) {
|
|
18512
19699
|
return {
|
|
18513
19700
|
error: new Response(`Image not found: ${url}`, { status: 404 })
|
|
18514
19701
|
};
|
|
18515
19702
|
}
|
|
18516
19703
|
return {
|
|
18517
|
-
buffer: Buffer.from(await
|
|
19704
|
+
buffer: Buffer.from(await file5.arrayBuffer()),
|
|
18518
19705
|
upstreamEtag: undefined
|
|
18519
19706
|
};
|
|
18520
19707
|
}, scheduleAvifPregen = (url, width, quality, sourceBuffer, configuredFormats, format, cacheDir, minimumCacheTTL, upstreamEtag) => {
|
|
@@ -18644,7 +19831,7 @@ var exports_generateSitemap = {};
|
|
|
18644
19831
|
__export(exports_generateSitemap, {
|
|
18645
19832
|
generateSitemap: () => generateSitemap
|
|
18646
19833
|
});
|
|
18647
|
-
var {write:
|
|
19834
|
+
var {write: write4 } = globalThis.Bun;
|
|
18648
19835
|
var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), isExcluded = (path, patterns) => {
|
|
18649
19836
|
for (const pattern of patterns) {
|
|
18650
19837
|
if (typeof pattern === "string" && path === pattern)
|
|
@@ -18711,7 +19898,7 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
18711
19898
|
const allRoutes = [...discoveredRoutes, ...filteredDynamic];
|
|
18712
19899
|
const baseUrl = config.baseUrl ?? serverUrl;
|
|
18713
19900
|
const xml = buildSitemapXml(allRoutes, baseUrl, config);
|
|
18714
|
-
await
|
|
19901
|
+
await write4(`${outDir}/sitemap.xml`, xml);
|
|
18715
19902
|
};
|
|
18716
19903
|
var init_generateSitemap = __esm(() => {
|
|
18717
19904
|
PAGE_HANDLER_NAMES = [
|
|
@@ -18734,8 +19921,8 @@ __export(exports_prerender, {
|
|
|
18734
19921
|
prerender: () => prerender,
|
|
18735
19922
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
18736
19923
|
});
|
|
18737
|
-
import { mkdirSync as
|
|
18738
|
-
import { join as
|
|
19924
|
+
import { mkdirSync as mkdirSync14, readFileSync as readFileSync18 } from "fs";
|
|
19925
|
+
import { join as join29 } from "path";
|
|
18739
19926
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
18740
19927
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
18741
19928
|
await Bun.write(metaPath, String(Date.now()));
|
|
@@ -18801,7 +19988,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
18801
19988
|
return false;
|
|
18802
19989
|
const html = await res.text();
|
|
18803
19990
|
const fileName = routeToFilename(route);
|
|
18804
|
-
const filePath =
|
|
19991
|
+
const filePath = join29(prerenderDir, fileName);
|
|
18805
19992
|
await Bun.write(filePath, html);
|
|
18806
19993
|
await writeTimestamp(filePath);
|
|
18807
19994
|
return true;
|
|
@@ -18827,14 +20014,14 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
18827
20014
|
}
|
|
18828
20015
|
const html = await res.text();
|
|
18829
20016
|
const fileName = routeToFilename(route);
|
|
18830
|
-
const filePath =
|
|
20017
|
+
const filePath = join29(prerenderDir, fileName);
|
|
18831
20018
|
await Bun.write(filePath, html);
|
|
18832
20019
|
await writeTimestamp(filePath);
|
|
18833
20020
|
result.routes.set(route, filePath);
|
|
18834
20021
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
18835
20022
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
18836
|
-
const prerenderDir =
|
|
18837
|
-
|
|
20023
|
+
const prerenderDir = join29(outDir, "_prerendered");
|
|
20024
|
+
mkdirSync14(prerenderDir, { recursive: true });
|
|
18838
20025
|
const baseUrl = `http://localhost:${port}`;
|
|
18839
20026
|
let routes;
|
|
18840
20027
|
if (staticConfig.routes === "all") {
|
|
@@ -19429,8 +20616,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
19429
20616
|
});
|
|
19430
20617
|
};
|
|
19431
20618
|
// src/core/prepare.ts
|
|
19432
|
-
import { existsSync as
|
|
19433
|
-
import { basename as
|
|
20619
|
+
import { existsSync as existsSync28, readdirSync as readdirSync2, readFileSync as readFileSync19 } from "fs";
|
|
20620
|
+
import { basename as basename13, join as join30, relative as relative13, resolve as resolve36 } from "path";
|
|
19434
20621
|
import { Elysia as Elysia5 } from "elysia";
|
|
19435
20622
|
|
|
19436
20623
|
// src/utils/loadConfig.ts
|
|
@@ -19445,6 +20632,7 @@ var RESERVED_TOP_LEVEL_KEYS = new Set([
|
|
|
19445
20632
|
"cwd",
|
|
19446
20633
|
"dependsOn",
|
|
19447
20634
|
"dev",
|
|
20635
|
+
"emberDirectory",
|
|
19448
20636
|
"entry",
|
|
19449
20637
|
"env",
|
|
19450
20638
|
"htmlDirectory",
|
|
@@ -19692,8 +20880,11 @@ var logConventionRenderError = (framework, label, renderError) => {
|
|
|
19692
20880
|
}
|
|
19693
20881
|
console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
|
|
19694
20882
|
};
|
|
20883
|
+
var renderEmberError = async () => null;
|
|
20884
|
+
var renderEmberNotFound = async () => null;
|
|
19695
20885
|
var ERROR_RENDERERS = {
|
|
19696
20886
|
angular: renderAngularError,
|
|
20887
|
+
ember: renderEmberError,
|
|
19697
20888
|
react: renderReactError,
|
|
19698
20889
|
svelte: renderSvelteError,
|
|
19699
20890
|
vue: renderVueError
|
|
@@ -19776,6 +20967,7 @@ var renderAngularNotFound = async (conventionPath) => {
|
|
|
19776
20967
|
};
|
|
19777
20968
|
var NOT_FOUND_RENDERERS = {
|
|
19778
20969
|
angular: renderAngularNotFound,
|
|
20970
|
+
ember: renderEmberNotFound,
|
|
19779
20971
|
react: renderReactNotFound,
|
|
19780
20972
|
svelte: renderSvelteNotFound,
|
|
19781
20973
|
vue: renderVueNotFound
|
|
@@ -19848,7 +21040,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
19848
21040
|
for (const { dir, pattern } of prewarmDirs) {
|
|
19849
21041
|
const glob = new Glob10(pattern);
|
|
19850
21042
|
const matches = [
|
|
19851
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
21043
|
+
...glob.scanSync({ absolute: true, cwd: resolve36(dir) })
|
|
19852
21044
|
];
|
|
19853
21045
|
files.push(...matches);
|
|
19854
21046
|
}
|
|
@@ -19856,10 +21048,10 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
19856
21048
|
};
|
|
19857
21049
|
var warmPrewarmDirs = async (prewarmDirs, warmCache2, SRC_URL_PREFIX2) => {
|
|
19858
21050
|
const files = await collectPrewarmFiles(prewarmDirs);
|
|
19859
|
-
for (const
|
|
19860
|
-
if (
|
|
21051
|
+
for (const file5 of files) {
|
|
21052
|
+
if (file5.includes("/node_modules/"))
|
|
19861
21053
|
continue;
|
|
19862
|
-
const rel = relative13(process.cwd(),
|
|
21054
|
+
const rel = relative13(process.cwd(), file5).replace(/\\/g, "/");
|
|
19863
21055
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
19864
21056
|
}
|
|
19865
21057
|
};
|
|
@@ -19884,8 +21076,8 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
19884
21076
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
19885
21077
|
if (!fileName)
|
|
19886
21078
|
continue;
|
|
19887
|
-
const srcPath =
|
|
19888
|
-
if (!
|
|
21079
|
+
const srcPath = resolve36(devIndexDir, fileName);
|
|
21080
|
+
if (!existsSync28(srcPath))
|
|
19889
21081
|
continue;
|
|
19890
21082
|
const rel = relative13(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
19891
21083
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
@@ -19957,7 +21149,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
19957
21149
|
stepStartedAt = performance.now();
|
|
19958
21150
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
19959
21151
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
19960
|
-
const devIndexDir =
|
|
21152
|
+
const devIndexDir = resolve36(buildDir, "_src_indexes");
|
|
19961
21153
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
19962
21154
|
recordStep("configure dev plugins", stepStartedAt);
|
|
19963
21155
|
stepStartedAt = performance.now();
|
|
@@ -19993,7 +21185,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
19993
21185
|
};
|
|
19994
21186
|
var loadPrerenderMap = (prerenderDir) => {
|
|
19995
21187
|
const map = new Map;
|
|
19996
|
-
if (!
|
|
21188
|
+
if (!existsSync28(prerenderDir))
|
|
19997
21189
|
return map;
|
|
19998
21190
|
let entries;
|
|
19999
21191
|
try {
|
|
@@ -20004,9 +21196,9 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
20004
21196
|
for (const entry of entries) {
|
|
20005
21197
|
if (!entry.endsWith(".html"))
|
|
20006
21198
|
continue;
|
|
20007
|
-
const name =
|
|
21199
|
+
const name = basename13(entry, ".html");
|
|
20008
21200
|
const route = name === "index" ? "/" : `/${name}`;
|
|
20009
|
-
map.set(route,
|
|
21201
|
+
map.set(route, join30(prerenderDir, entry));
|
|
20010
21202
|
}
|
|
20011
21203
|
return map;
|
|
20012
21204
|
};
|
|
@@ -20038,7 +21230,7 @@ var prepare = async (configOrPath) => {
|
|
|
20038
21230
|
recordStep("load config", stepStartedAt);
|
|
20039
21231
|
const nodeEnv = process.env["NODE_ENV"];
|
|
20040
21232
|
const isDev3 = nodeEnv === "development";
|
|
20041
|
-
const buildDir =
|
|
21233
|
+
const buildDir = resolve36(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
20042
21234
|
if (isDev3) {
|
|
20043
21235
|
stepStartedAt = performance.now();
|
|
20044
21236
|
const result = await prepareDev(config, buildDir);
|
|
@@ -20055,8 +21247,8 @@ var prepare = async (configOrPath) => {
|
|
|
20055
21247
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
20056
21248
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
20057
21249
|
stepStartedAt = performance.now();
|
|
20058
|
-
const conventionsPath =
|
|
20059
|
-
if (
|
|
21250
|
+
const conventionsPath = join30(buildDir, "conventions.json");
|
|
21251
|
+
if (existsSync28(conventionsPath)) {
|
|
20060
21252
|
const conventions2 = JSON.parse(readFileSync19(conventionsPath, "utf-8"));
|
|
20061
21253
|
setConventions(conventions2);
|
|
20062
21254
|
}
|
|
@@ -20071,7 +21263,7 @@ var prepare = async (configOrPath) => {
|
|
|
20071
21263
|
});
|
|
20072
21264
|
recordStep("create static plugin", stepStartedAt);
|
|
20073
21265
|
stepStartedAt = performance.now();
|
|
20074
|
-
const prerenderDir =
|
|
21266
|
+
const prerenderDir = join30(buildDir, "_prerendered");
|
|
20075
21267
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
20076
21268
|
recordStep("load prerender map", stepStartedAt);
|
|
20077
21269
|
if (prerenderMap.size > 0) {
|
|
@@ -20129,15 +21321,15 @@ import { argv } from "process";
|
|
|
20129
21321
|
var {env: env4 } = globalThis.Bun;
|
|
20130
21322
|
|
|
20131
21323
|
// src/dev/devCert.ts
|
|
20132
|
-
import { existsSync as
|
|
20133
|
-
import { join as
|
|
20134
|
-
var CERT_DIR =
|
|
20135
|
-
var CERT_PATH =
|
|
20136
|
-
var KEY_PATH =
|
|
21324
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync15, readFileSync as readFileSync20, rmSync as rmSync3 } from "fs";
|
|
21325
|
+
import { join as join31 } from "path";
|
|
21326
|
+
var CERT_DIR = join31(process.cwd(), ".absolutejs");
|
|
21327
|
+
var CERT_PATH = join31(CERT_DIR, "cert.pem");
|
|
21328
|
+
var KEY_PATH = join31(CERT_DIR, "key.pem");
|
|
20137
21329
|
var CERT_VALIDITY_DAYS = 365;
|
|
20138
21330
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
20139
21331
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
20140
|
-
var certFilesExist = () =>
|
|
21332
|
+
var certFilesExist = () => existsSync29(CERT_PATH) && existsSync29(KEY_PATH);
|
|
20141
21333
|
var isCertExpired = () => {
|
|
20142
21334
|
try {
|
|
20143
21335
|
const certPem = readFileSync20(CERT_PATH, "utf-8");
|
|
@@ -20214,7 +21406,7 @@ var generateCert = () => {
|
|
|
20214
21406
|
}
|
|
20215
21407
|
};
|
|
20216
21408
|
var ensureDevCert = () => {
|
|
20217
|
-
|
|
21409
|
+
mkdirSync15(CERT_DIR, { recursive: true });
|
|
20218
21410
|
if (hasCert()) {
|
|
20219
21411
|
return { cert: CERT_PATH, key: KEY_PATH };
|
|
20220
21412
|
}
|
|
@@ -20465,8 +21657,8 @@ var jsonLd2 = (schema) => {
|
|
|
20465
21657
|
};
|
|
20466
21658
|
// src/utils/defineEnv.ts
|
|
20467
21659
|
var {env: bunEnv } = globalThis.Bun;
|
|
20468
|
-
import { existsSync as
|
|
20469
|
-
import { resolve as
|
|
21660
|
+
import { existsSync as existsSync30, readFileSync as readFileSync21 } from "fs";
|
|
21661
|
+
import { resolve as resolve37 } from "path";
|
|
20470
21662
|
|
|
20471
21663
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
20472
21664
|
var exports_value = {};
|
|
@@ -24595,8 +25787,8 @@ function FromConstructor6(schema, references) {
|
|
|
24595
25787
|
return class {
|
|
24596
25788
|
constructor() {
|
|
24597
25789
|
for (const [key, val] of Object.entries(value)) {
|
|
24598
|
-
const
|
|
24599
|
-
|
|
25790
|
+
const self2 = this;
|
|
25791
|
+
self2[key] = val;
|
|
24600
25792
|
}
|
|
24601
25793
|
}
|
|
24602
25794
|
};
|
|
@@ -26501,8 +27693,8 @@ ${lines.join(`
|
|
|
26501
27693
|
};
|
|
26502
27694
|
var checkEnvFileSecurity = (properties) => {
|
|
26503
27695
|
const cwd2 = process.cwd();
|
|
26504
|
-
const envPath =
|
|
26505
|
-
if (!
|
|
27696
|
+
const envPath = resolve37(cwd2, ".env");
|
|
27697
|
+
if (!existsSync30(envPath))
|
|
26506
27698
|
return;
|
|
26507
27699
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
26508
27700
|
if (sensitiveKeys.length === 0)
|
|
@@ -26511,8 +27703,8 @@ var checkEnvFileSecurity = (properties) => {
|
|
|
26511
27703
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
26512
27704
|
if (presentKeys.length === 0)
|
|
26513
27705
|
return;
|
|
26514
|
-
const gitignorePath =
|
|
26515
|
-
if (
|
|
27706
|
+
const gitignorePath = resolve37(cwd2, ".gitignore");
|
|
27707
|
+
if (existsSync30(gitignorePath)) {
|
|
26516
27708
|
const gitignore = readFileSync21(gitignorePath, "utf-8");
|
|
26517
27709
|
if (gitignore.split(`
|
|
26518
27710
|
`).some((line) => line.trim() === ".env"))
|
|
@@ -26751,5 +27943,5 @@ export {
|
|
|
26751
27943
|
ANGULAR_INIT_TIMEOUT_MS
|
|
26752
27944
|
};
|
|
26753
27945
|
|
|
26754
|
-
//# debugId=
|
|
27946
|
+
//# debugId=BBDA3F3D0AAAF6D064756E2164756E21
|
|
26755
27947
|
//# sourceMappingURL=index.js.map
|