@absolutejs/absolute 0.19.0-beta.845 → 0.19.0-beta.847
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 +45 -23
- package/dist/angular/index.js.map +11 -10
- package/dist/angular/server.js +45 -23
- package/dist/angular/server.js.map +11 -10
- package/dist/build.js +955 -498
- package/dist/build.js.map +16 -13
- package/dist/cli/index.js +547 -286
- package/dist/client/index.js +16 -9
- package/dist/client/index.js.map +6 -5
- package/dist/dev/client/handlers/angular.ts +309 -19
- package/dist/dev/client/handlers/angularRuntime.ts +468 -0
- package/dist/dev/client/hmrToast.ts +150 -0
- package/dist/index.js +1002 -545
- package/dist/index.js.map +17 -14
- package/dist/islands/index.js +32 -11
- package/dist/islands/index.js.map +7 -6
- package/dist/react/index.js +32 -11
- package/dist/react/index.js.map +7 -6
- package/dist/src/build/rewriteImports.d.ts +6 -14
- package/dist/src/build/rewriteImportsPlugin.d.ts +48 -0
- package/dist/src/dev/angular/editTypeDetection.d.ts +8 -0
- package/dist/src/dev/pathUtils.d.ts +3 -0
- package/dist/src/utils/buildDirectoryLock.d.ts +26 -3
- package/dist/src/utils/loadConfig.d.ts +5 -0
- package/dist/src/utils/resolveDevPort.d.ts +21 -0
- package/dist/src/utils/runtimeMode.d.ts +3 -0
- package/dist/svelte/index.js +32 -11
- package/dist/svelte/index.js.map +7 -6
- package/dist/svelte/server.js +17 -3
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +15 -0
- package/dist/types/globals.d.ts +12 -0
- package/dist/vue/index.js +32 -11
- package/dist/vue/index.js.map +7 -6
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -1770,6 +1770,9 @@ var resolveAngularPackageDir = (specifier) => {
|
|
|
1770
1770
|
};
|
|
1771
1771
|
var init_resolveAngularPackage = () => {};
|
|
1772
1772
|
|
|
1773
|
+
// src/utils/runtimeMode.ts
|
|
1774
|
+
var ENV_VAR = "NODE_ENV", isProductionRuntime = () => process.env[ENV_VAR] === "production", isDevelopmentRuntime = () => process.env[ENV_VAR] === "development";
|
|
1775
|
+
|
|
1773
1776
|
// src/angular/angularPatch.ts
|
|
1774
1777
|
var exports_angularPatch = {};
|
|
1775
1778
|
__export(exports_angularPatch, {
|
|
@@ -1852,7 +1855,8 @@ var ensureHead = (doc) => {
|
|
|
1852
1855
|
}
|
|
1853
1856
|
layoutPatchApplied = true;
|
|
1854
1857
|
}, applyPatches = async () => {
|
|
1855
|
-
const
|
|
1858
|
+
const spec = isProductionRuntime() ? resolveAngularRuntimePath("@angular/platform-server") : "@angular/platform-server";
|
|
1859
|
+
const { \u{275}DominoAdapter } = await import(spec);
|
|
1856
1860
|
if (!\u{275}DominoAdapter?.prototype) {
|
|
1857
1861
|
console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
|
|
1858
1862
|
return false;
|
|
@@ -1919,18 +1923,21 @@ var initDominoAdapter = (platformServer) => {
|
|
|
1919
1923
|
console.error("Failed to initialize DominoAdapter:", err);
|
|
1920
1924
|
}
|
|
1921
1925
|
}, loadAngularDeps = async () => {
|
|
1922
|
-
if (
|
|
1923
|
-
await import(
|
|
1926
|
+
if (!isProductionRuntime()) {
|
|
1927
|
+
await import("@angular/compiler");
|
|
1924
1928
|
}
|
|
1925
1929
|
const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
|
|
1926
1930
|
await applyPatches2();
|
|
1931
|
+
const useBareSpecifiers = !isProductionRuntime();
|
|
1927
1932
|
const [platformBrowser, platformServer, common, core] = await Promise.all([
|
|
1928
|
-
import(resolveAngularRuntimePath("@angular/platform-browser")),
|
|
1929
|
-
import(resolveAngularRuntimePath("@angular/platform-server")),
|
|
1930
|
-
import(resolveAngularRuntimePath("@angular/common")),
|
|
1931
|
-
import(resolveAngularRuntimePath("@angular/core"))
|
|
1933
|
+
useBareSpecifiers ? import("@angular/platform-browser") : import(resolveAngularRuntimePath("@angular/platform-browser")),
|
|
1934
|
+
useBareSpecifiers ? import("@angular/platform-server") : import(resolveAngularRuntimePath("@angular/platform-server")),
|
|
1935
|
+
useBareSpecifiers ? import("@angular/common") : import(resolveAngularRuntimePath("@angular/common")),
|
|
1936
|
+
useBareSpecifiers ? import("@angular/core") : import(resolveAngularRuntimePath("@angular/core"))
|
|
1932
1937
|
]);
|
|
1933
|
-
if (
|
|
1938
|
+
if (!isDevelopmentRuntime()) {
|
|
1939
|
+
core.enableProdMode();
|
|
1940
|
+
}
|
|
1934
1941
|
initDominoAdapter(platformServer);
|
|
1935
1942
|
return {
|
|
1936
1943
|
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
@@ -3007,6 +3014,18 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3007
3014
|
return runPostcss(await readFile(filePath, "utf-8"), filePath, config);
|
|
3008
3015
|
}
|
|
3009
3016
|
return compileStyleSource(filePath, undefined, undefined, config);
|
|
3017
|
+
}, CSS_IMPORT_PATTERN, resolveCssImportsSync = (content, baseDir, visited) => {
|
|
3018
|
+
return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
|
|
3019
|
+
const fullPath = isAbsolute(importPath) ? importPath : resolve5(baseDir, importPath);
|
|
3020
|
+
if (visited.has(fullPath))
|
|
3021
|
+
return "";
|
|
3022
|
+
if (!existsSync4(fullPath))
|
|
3023
|
+
return match;
|
|
3024
|
+
const nextVisited = new Set(visited);
|
|
3025
|
+
nextVisited.add(fullPath);
|
|
3026
|
+
const imported = readFileSync3(fullPath, "utf-8");
|
|
3027
|
+
return resolveCssImportsSync(imported, dirname2(fullPath), nextVisited);
|
|
3028
|
+
});
|
|
3010
3029
|
}, compileStyleFileIfNeededSync = (filePath, config) => {
|
|
3011
3030
|
const rawContents = readFileSync3(filePath, "utf-8");
|
|
3012
3031
|
const language = getStyleLanguage(filePath);
|
|
@@ -3024,7 +3043,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3024
3043
|
}
|
|
3025
3044
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
3026
3045
|
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
3027
|
-
|
|
3046
|
+
const compiled = sass.compileString(contents, {
|
|
3028
3047
|
importers: [
|
|
3029
3048
|
createSassImporter(filePath, loadPaths, language, config)
|
|
3030
3049
|
],
|
|
@@ -3033,6 +3052,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3033
3052
|
syntax: language === "sass" ? "indented" : "scss",
|
|
3034
3053
|
url: new URL(`file://${filePath}`)
|
|
3035
3054
|
}).css;
|
|
3055
|
+
return resolveCssImportsSync(compiled, dirname2(filePath), new Set([filePath]));
|
|
3036
3056
|
}
|
|
3037
3057
|
if (language === "less") {
|
|
3038
3058
|
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
@@ -3040,7 +3060,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3040
3060
|
if (language === "stylus") {
|
|
3041
3061
|
throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
3042
3062
|
}
|
|
3043
|
-
return rawContents;
|
|
3063
|
+
return resolveCssImportsSync(rawContents, dirname2(filePath), new Set([filePath]));
|
|
3044
3064
|
}, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname3(filePath);
|
|
3045
3065
|
var init_stylePreprocessor = __esm(() => {
|
|
3046
3066
|
CSS_EXTENSION_PATTERN = /\.css$/i;
|
|
@@ -3053,6 +3073,7 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
3053
3073
|
styleDependencyGraph = new Map;
|
|
3054
3074
|
styleOutputHashes = new Map;
|
|
3055
3075
|
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
3076
|
+
CSS_IMPORT_PATTERN = /@import\s+["']([^"']+)["']\s*;?/g;
|
|
3056
3077
|
});
|
|
3057
3078
|
|
|
3058
3079
|
// src/core/svelteServerModule.ts
|
|
@@ -9571,9 +9592,34 @@ var commonAncestor = (paths, fallback) => {
|
|
|
9571
9592
|
var init_commonAncestor = () => {};
|
|
9572
9593
|
|
|
9573
9594
|
// src/utils/buildDirectoryLock.ts
|
|
9574
|
-
import {
|
|
9595
|
+
import { mkdirSync as mkdirSync6, unlinkSync, writeFileSync as writeFileSync6, readFileSync as readFileSync10 } from "fs";
|
|
9575
9596
|
import { dirname as dirname8, join as join13 } from "path";
|
|
9576
|
-
var
|
|
9597
|
+
var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandlersRegistered = false, registerExitHandlersOnce = () => {
|
|
9598
|
+
if (exitHandlersRegistered)
|
|
9599
|
+
return;
|
|
9600
|
+
exitHandlersRegistered = true;
|
|
9601
|
+
const releaseAllSync = () => {
|
|
9602
|
+
for (const lock of heldLocks.values()) {
|
|
9603
|
+
try {
|
|
9604
|
+
lock.releaseSync();
|
|
9605
|
+
} catch {}
|
|
9606
|
+
}
|
|
9607
|
+
heldLocks.clear();
|
|
9608
|
+
};
|
|
9609
|
+
process.on("exit", releaseAllSync);
|
|
9610
|
+
process.on("SIGINT", () => {
|
|
9611
|
+
releaseAllSync();
|
|
9612
|
+
process.exit(130);
|
|
9613
|
+
});
|
|
9614
|
+
process.on("SIGTERM", () => {
|
|
9615
|
+
releaseAllSync();
|
|
9616
|
+
process.exit(143);
|
|
9617
|
+
});
|
|
9618
|
+
process.on("uncaughtException", (err) => {
|
|
9619
|
+
releaseAllSync();
|
|
9620
|
+
throw err;
|
|
9621
|
+
});
|
|
9622
|
+
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join13(dirname8(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
|
|
9577
9623
|
`).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
|
|
9578
9624
|
if (locks.size === 0) {
|
|
9579
9625
|
delete process.env[HELD_LOCKS_ENV];
|
|
@@ -9589,7 +9635,41 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
|
|
|
9589
9635
|
const locks = readHeldLockEnv();
|
|
9590
9636
|
locks.delete(buildDirectory);
|
|
9591
9637
|
writeHeldLockEnv(locks);
|
|
9592
|
-
},
|
|
9638
|
+
}, writeLockFileSync = (lockPath, metadata) => {
|
|
9639
|
+
mkdirSync6(dirname8(lockPath), { recursive: true });
|
|
9640
|
+
writeFileSync6(lockPath, JSON.stringify(metadata, null, 2), { flag: "wx" });
|
|
9641
|
+
}, readLockMetadata = (lockPath) => {
|
|
9642
|
+
try {
|
|
9643
|
+
const raw = readFileSync10(lockPath, "utf-8");
|
|
9644
|
+
const parsed = JSON.parse(raw);
|
|
9645
|
+
if (typeof parsed === "object" && parsed !== null && typeof parsed.pid === "number") {
|
|
9646
|
+
return {
|
|
9647
|
+
pid: parsed.pid,
|
|
9648
|
+
port: typeof parsed.port === "number" ? parsed.port : null,
|
|
9649
|
+
startedAt: typeof parsed.startedAt === "string" ? parsed.startedAt : new Date().toISOString()
|
|
9650
|
+
};
|
|
9651
|
+
}
|
|
9652
|
+
} catch {}
|
|
9653
|
+
return null;
|
|
9654
|
+
}, isProcessAlive = (pid) => {
|
|
9655
|
+
try {
|
|
9656
|
+
process.kill(pid, 0);
|
|
9657
|
+
return true;
|
|
9658
|
+
} catch (err) {
|
|
9659
|
+
const code = err.code;
|
|
9660
|
+
if (code === "ESRCH")
|
|
9661
|
+
return false;
|
|
9662
|
+
if (code === "EPERM")
|
|
9663
|
+
return true;
|
|
9664
|
+
return true;
|
|
9665
|
+
}
|
|
9666
|
+
}, removeStaleLockSync = (lockPath, pid) => {
|
|
9667
|
+
try {
|
|
9668
|
+
unlinkSync(lockPath);
|
|
9669
|
+
console.warn(`[absolutejs] removed stale lock from PID ${pid}`);
|
|
9670
|
+
} catch {}
|
|
9671
|
+
}, LOCK_POLL_MS = 250, DEFAULT_WAIT_TIMEOUT_MS = 120000, acquireBuildDirectoryLock = async (buildDirectory, options = {}) => {
|
|
9672
|
+
registerExitHandlersOnce();
|
|
9593
9673
|
if (readHeldLockEnv().has(buildDirectory)) {
|
|
9594
9674
|
return async () => {};
|
|
9595
9675
|
}
|
|
@@ -9605,52 +9685,66 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
|
|
|
9605
9685
|
};
|
|
9606
9686
|
}
|
|
9607
9687
|
const lockPath = lockPathForBuildDirectory(buildDirectory);
|
|
9608
|
-
const
|
|
9609
|
-
const
|
|
9688
|
+
const wait = options.wait !== false;
|
|
9689
|
+
const waitTimeoutMs = options.waitTimeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
|
|
9610
9690
|
const start = Date.now();
|
|
9691
|
+
const tryCreate = () => {
|
|
9692
|
+
writeLockFileSync(lockPath, {
|
|
9693
|
+
pid: process.pid,
|
|
9694
|
+
port: options.port ?? null,
|
|
9695
|
+
startedAt: new Date().toISOString()
|
|
9696
|
+
});
|
|
9697
|
+
};
|
|
9611
9698
|
while (true) {
|
|
9612
9699
|
try {
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
await writeFile4(join13(lockPath, "owner"), JSON.stringify({
|
|
9616
|
-
buildDirectory,
|
|
9617
|
-
createdAt: new Date().toISOString(),
|
|
9618
|
-
pid: process.pid
|
|
9619
|
-
}, null, 2));
|
|
9620
|
-
const release = async () => {
|
|
9621
|
-
await rm4(lockPath, { force: true, recursive: true }).catch(() => {});
|
|
9622
|
-
};
|
|
9623
|
-
heldLocks.set(buildDirectory, { count: 1, release });
|
|
9624
|
-
markHeldLock(buildDirectory);
|
|
9625
|
-
return async () => {
|
|
9626
|
-
const current = heldLocks.get(buildDirectory);
|
|
9627
|
-
if (!current)
|
|
9628
|
-
return;
|
|
9629
|
-
current.count -= 1;
|
|
9630
|
-
if (current.count > 0)
|
|
9631
|
-
return;
|
|
9632
|
-
heldLocks.delete(buildDirectory);
|
|
9633
|
-
unmarkHeldLock(buildDirectory);
|
|
9634
|
-
await current.release();
|
|
9635
|
-
};
|
|
9700
|
+
tryCreate();
|
|
9701
|
+
break;
|
|
9636
9702
|
} catch (error) {
|
|
9637
9703
|
if (!isAlreadyExistsError(error))
|
|
9638
9704
|
throw error;
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
}
|
|
9646
|
-
if (
|
|
9647
|
-
|
|
9705
|
+
const existing = readLockMetadata(lockPath);
|
|
9706
|
+
if (!existing) {
|
|
9707
|
+
try {
|
|
9708
|
+
unlinkSync(lockPath);
|
|
9709
|
+
} catch {}
|
|
9710
|
+
continue;
|
|
9711
|
+
}
|
|
9712
|
+
if (!isProcessAlive(existing.pid)) {
|
|
9713
|
+
removeStaleLockSync(lockPath, existing.pid);
|
|
9714
|
+
continue;
|
|
9715
|
+
}
|
|
9716
|
+
if (wait && Date.now() - start < waitTimeoutMs) {
|
|
9717
|
+
await Bun.sleep(LOCK_POLL_MS);
|
|
9718
|
+
continue;
|
|
9648
9719
|
}
|
|
9649
|
-
|
|
9720
|
+
const portInfo = existing.port ? ` on port ${existing.port}` : "";
|
|
9721
|
+
const elapsedNote = wait ? ` Waited ${Math.round((Date.now() - start) / 1000)}s.` : "";
|
|
9722
|
+
throw new Error(`AbsoluteJS build lock is held by PID ${existing.pid}${portInfo} (started ${existing.startedAt}).${elapsedNote} ` + `Another process owns ${buildDirectory}. ` + `Run \`kill ${existing.pid}\` (or wait for it to finish) and try again.`);
|
|
9650
9723
|
}
|
|
9651
9724
|
}
|
|
9652
|
-
|
|
9653
|
-
|
|
9725
|
+
const releaseSync = () => {
|
|
9726
|
+
try {
|
|
9727
|
+
unlinkSync(lockPath);
|
|
9728
|
+
} catch {}
|
|
9729
|
+
};
|
|
9730
|
+
const release = async () => {
|
|
9731
|
+
releaseSync();
|
|
9732
|
+
};
|
|
9733
|
+
heldLocks.set(buildDirectory, { count: 1, release, releaseSync });
|
|
9734
|
+
markHeldLock(buildDirectory);
|
|
9735
|
+
return async () => {
|
|
9736
|
+
const current = heldLocks.get(buildDirectory);
|
|
9737
|
+
if (!current)
|
|
9738
|
+
return;
|
|
9739
|
+
current.count -= 1;
|
|
9740
|
+
if (current.count > 0)
|
|
9741
|
+
return;
|
|
9742
|
+
heldLocks.delete(buildDirectory);
|
|
9743
|
+
unmarkHeldLock(buildDirectory);
|
|
9744
|
+
await current.release();
|
|
9745
|
+
};
|
|
9746
|
+
}, withBuildDirectoryLock = async (buildDirectory, action, options = {}) => {
|
|
9747
|
+
const release = await acquireBuildDirectoryLock(buildDirectory, options);
|
|
9654
9748
|
try {
|
|
9655
9749
|
return await action();
|
|
9656
9750
|
} finally {
|
|
@@ -9658,7 +9752,6 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
|
|
|
9658
9752
|
}
|
|
9659
9753
|
};
|
|
9660
9754
|
var init_buildDirectoryLock = __esm(() => {
|
|
9661
|
-
DEFAULT_STALE_LOCK_MS = 10 * 60000;
|
|
9662
9755
|
heldLocks = new Map;
|
|
9663
9756
|
});
|
|
9664
9757
|
|
|
@@ -9815,7 +9908,7 @@ __export(exports_compileSvelte, {
|
|
|
9815
9908
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
9816
9909
|
});
|
|
9817
9910
|
import { existsSync as existsSync14 } from "fs";
|
|
9818
|
-
import { mkdir as
|
|
9911
|
+
import { mkdir as mkdir3, stat as stat2 } from "fs/promises";
|
|
9819
9912
|
import {
|
|
9820
9913
|
dirname as dirname9,
|
|
9821
9914
|
join as join14,
|
|
@@ -9858,7 +9951,7 @@ var resolveDevClientDir2 = () => {
|
|
|
9858
9951
|
return /\b__require\b/.test(stripped) ? code : stripped;
|
|
9859
9952
|
}, exists = async (path) => {
|
|
9860
9953
|
try {
|
|
9861
|
-
await
|
|
9954
|
+
await stat2(path);
|
|
9862
9955
|
return true;
|
|
9863
9956
|
} catch {
|
|
9864
9957
|
return false;
|
|
@@ -9926,7 +10019,7 @@ var resolveDevClientDir2 = () => {
|
|
|
9926
10019
|
const clientDir = join14(generatedDir, "client");
|
|
9927
10020
|
const indexDir = join14(generatedDir, "indexes");
|
|
9928
10021
|
const serverDir = join14(generatedDir, "server");
|
|
9929
|
-
await Promise.all([clientDir, indexDir, serverDir].map((dir) =>
|
|
10022
|
+
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir3(dir, { recursive: true })));
|
|
9930
10023
|
const dev = env.NODE_ENV !== "production";
|
|
9931
10024
|
const build = async (src) => {
|
|
9932
10025
|
const memoized = cache.get(src);
|
|
@@ -10032,8 +10125,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10032
10125
|
const ssrPath = join14(serverDir, relDir, `${baseName}.js`);
|
|
10033
10126
|
const clientPath = join14(clientDir, relDir, `${baseName}.js`);
|
|
10034
10127
|
await Promise.all([
|
|
10035
|
-
|
|
10036
|
-
|
|
10128
|
+
mkdir3(dirname9(ssrPath), { recursive: true }),
|
|
10129
|
+
mkdir3(dirname9(clientPath), { recursive: true })
|
|
10037
10130
|
]);
|
|
10038
10131
|
if (isModule) {
|
|
10039
10132
|
const bundle = rewriteExternalImports(generate("client"), "client");
|
|
@@ -10134,7 +10227,7 @@ if (typeof window !== "undefined") {
|
|
|
10134
10227
|
setTimeout(releaseStreamingSlots, 0);
|
|
10135
10228
|
}
|
|
10136
10229
|
}`;
|
|
10137
|
-
await
|
|
10230
|
+
await mkdir3(dirname9(indexPath), { recursive: true });
|
|
10138
10231
|
return write(indexPath, bootstrap);
|
|
10139
10232
|
}));
|
|
10140
10233
|
return {
|
|
@@ -10222,7 +10315,7 @@ __export(exports_compileVue, {
|
|
|
10222
10315
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
10223
10316
|
});
|
|
10224
10317
|
import { existsSync as existsSync15 } from "fs";
|
|
10225
|
-
import { mkdir as
|
|
10318
|
+
import { mkdir as mkdir4 } from "fs/promises";
|
|
10226
10319
|
import {
|
|
10227
10320
|
basename as basename5,
|
|
10228
10321
|
dirname as dirname10,
|
|
@@ -10403,7 +10496,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10403
10496
|
let cssOutputPaths = [];
|
|
10404
10497
|
if (isEntryPoint && allCss.length) {
|
|
10405
10498
|
const cssOutputFile = join15(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
10406
|
-
await
|
|
10499
|
+
await mkdir4(dirname10(cssOutputFile), { recursive: true });
|
|
10407
10500
|
await write2(cssOutputFile, allCss.join(`
|
|
10408
10501
|
`));
|
|
10409
10502
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -10454,8 +10547,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10454
10547
|
}
|
|
10455
10548
|
return result2;
|
|
10456
10549
|
};
|
|
10457
|
-
await
|
|
10458
|
-
await
|
|
10550
|
+
await mkdir4(dirname10(clientOutputPath), { recursive: true });
|
|
10551
|
+
await mkdir4(dirname10(serverOutputPath), { recursive: true });
|
|
10459
10552
|
await write2(clientOutputPath, rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client"));
|
|
10460
10553
|
await write2(serverOutputPath, rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server"));
|
|
10461
10554
|
const result = {
|
|
@@ -10480,10 +10573,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10480
10573
|
const serverOutputDir = join15(generatedDir, "server");
|
|
10481
10574
|
const cssOutputDir = join15(generatedDir, "compiled");
|
|
10482
10575
|
await Promise.all([
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10576
|
+
mkdir4(clientOutputDir, { recursive: true }),
|
|
10577
|
+
mkdir4(indexOutputDir, { recursive: true }),
|
|
10578
|
+
mkdir4(serverOutputDir, { recursive: true }),
|
|
10579
|
+
mkdir4(cssOutputDir, { recursive: true })
|
|
10487
10580
|
]);
|
|
10488
10581
|
const buildCache = new Map;
|
|
10489
10582
|
const allTsHelperPaths = new Set;
|
|
@@ -10497,7 +10590,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10497
10590
|
const entryBaseName = basename5(entryPath, ".vue");
|
|
10498
10591
|
const indexOutputFile = join15(indexOutputDir, `${entryBaseName}.js`);
|
|
10499
10592
|
const clientOutputFile = join15(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
10500
|
-
await
|
|
10593
|
+
await mkdir4(dirname10(indexOutputFile), { recursive: true });
|
|
10501
10594
|
const vueHmrImports = isDev ? [
|
|
10502
10595
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
10503
10596
|
`import "${hmrClientPath4}";`
|
|
@@ -10651,8 +10744,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10651
10744
|
const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
10652
10745
|
const outClientPath = join15(clientOutputDir, relativeJsPath);
|
|
10653
10746
|
const outServerPath = join15(serverOutputDir, relativeJsPath);
|
|
10654
|
-
await
|
|
10655
|
-
await
|
|
10747
|
+
await mkdir4(dirname10(outClientPath), { recursive: true });
|
|
10748
|
+
await mkdir4(dirname10(outServerPath), { recursive: true });
|
|
10656
10749
|
await write2(outClientPath, transpiledCode);
|
|
10657
10750
|
await write2(outServerPath, transpiledCode);
|
|
10658
10751
|
}));
|
|
@@ -11151,7 +11244,7 @@ __export(exports_compileAngular, {
|
|
|
11151
11244
|
compileAngularFile: () => compileAngularFile,
|
|
11152
11245
|
compileAngular: () => compileAngular
|
|
11153
11246
|
});
|
|
11154
|
-
import { existsSync as existsSync16, readFileSync as
|
|
11247
|
+
import { existsSync as existsSync16, readFileSync as readFileSync11, promises as fs } from "fs";
|
|
11155
11248
|
import { join as join16, basename as basename6, sep as sep3, dirname as dirname11, resolve as resolve16, relative as relative9 } from "path";
|
|
11156
11249
|
import ts2 from "typescript";
|
|
11157
11250
|
var traceAngularPhase = async (name, fn2, metadata) => {
|
|
@@ -11288,16 +11381,16 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11288
11381
|
return fromNodeModules;
|
|
11289
11382
|
return resolve16(import.meta.dir, "./dev/client");
|
|
11290
11383
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
11291
|
-
const
|
|
11292
|
-
const
|
|
11384
|
+
const entityClassRegex = /(?:export\s+)?class\s+(\w+(?:Component|Service|Directive|Pipe))\s/g;
|
|
11385
|
+
const entityNames = [];
|
|
11293
11386
|
let match;
|
|
11294
|
-
while ((match =
|
|
11387
|
+
while ((match = entityClassRegex.exec(content)) !== null) {
|
|
11295
11388
|
if (match[1])
|
|
11296
|
-
|
|
11389
|
+
entityNames.push(match[1]);
|
|
11297
11390
|
}
|
|
11298
|
-
if (
|
|
11391
|
+
if (entityNames.length === 0)
|
|
11299
11392
|
return content;
|
|
11300
|
-
const registrations =
|
|
11393
|
+
const registrations = entityNames.map((name) => ` if (typeof ${name} === 'function') window.__ANGULAR_HMR__.register('${sourceId}#${name}', ${name});`).join(`
|
|
11301
11394
|
`);
|
|
11302
11395
|
const hmrBlock = `
|
|
11303
11396
|
// Angular HMR Runtime Layer (Level 3) \u2014 Auto-registration
|
|
@@ -11506,7 +11599,7 @@ ${registrations}
|
|
|
11506
11599
|
const outputPath = resolve16(join16(outDir, relative9(process.cwd(), resolve16(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
11507
11600
|
return [
|
|
11508
11601
|
outputPath,
|
|
11509
|
-
buildIslandMetadataExports(
|
|
11602
|
+
buildIslandMetadataExports(readFileSync11(inputPath, "utf-8"))
|
|
11510
11603
|
];
|
|
11511
11604
|
})), { entries: inputPaths.length });
|
|
11512
11605
|
await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
|
|
@@ -11815,7 +11908,7 @@ ${fields}
|
|
|
11815
11908
|
if (!existsSync16(templatePath)) {
|
|
11816
11909
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
11817
11910
|
}
|
|
11818
|
-
const templateRaw2 =
|
|
11911
|
+
const templateRaw2 = readFileSync11(templatePath, "utf-8");
|
|
11819
11912
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
11820
11913
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
11821
11914
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -12793,7 +12886,7 @@ __export(exports_compileEmber, {
|
|
|
12793
12886
|
basename: () => basename7
|
|
12794
12887
|
});
|
|
12795
12888
|
import { existsSync as existsSync17 } from "fs";
|
|
12796
|
-
import { mkdir as
|
|
12889
|
+
import { mkdir as mkdir5, rm as rm4 } from "fs/promises";
|
|
12797
12890
|
import { basename as basename7, dirname as dirname12, extname as extname6, join as join17, resolve as resolve17 } from "path";
|
|
12798
12891
|
var {build: bunBuild2, Transpiler: Transpiler3, write: write3, file: file3 } = globalThis.Bun;
|
|
12799
12892
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
@@ -12965,9 +13058,9 @@ export default PageComponent;
|
|
|
12965
13058
|
const serverDir = join17(compiledRoot, "server");
|
|
12966
13059
|
const clientDir = join17(compiledRoot, "client");
|
|
12967
13060
|
await Promise.all([
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
13061
|
+
mkdir5(tmpDir, { recursive: true }),
|
|
13062
|
+
mkdir5(serverDir, { recursive: true }),
|
|
13063
|
+
mkdir5(clientDir, { recursive: true })
|
|
12971
13064
|
]);
|
|
12972
13065
|
const tmpPagePath = resolve17(join17(tmpDir, `${baseName}.module.js`));
|
|
12973
13066
|
const tmpHarnessPath = resolve17(join17(tmpDir, `${baseName}.harness.js`));
|
|
@@ -12994,7 +13087,7 @@ export default PageComponent;
|
|
|
12994
13087
|
if (!buildResult.success) {
|
|
12995
13088
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
12996
13089
|
}
|
|
12997
|
-
await
|
|
13090
|
+
await rm4(tmpDir, { force: true, recursive: true });
|
|
12998
13091
|
const clientPath = join17(clientDir, `${baseName}.js`);
|
|
12999
13092
|
await write3(clientPath, transpiled);
|
|
13000
13093
|
return { clientPath, serverPath };
|
|
@@ -13043,9 +13136,9 @@ __export(exports_buildReactVendor, {
|
|
|
13043
13136
|
computeVendorPaths: () => computeVendorPaths,
|
|
13044
13137
|
buildReactVendor: () => buildReactVendor
|
|
13045
13138
|
});
|
|
13046
|
-
import { existsSync as existsSync18, mkdirSync as
|
|
13139
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync7 } from "fs";
|
|
13047
13140
|
import { join as join18, resolve as resolve18 } from "path";
|
|
13048
|
-
import { rm as
|
|
13141
|
+
import { rm as rm5 } from "fs/promises";
|
|
13049
13142
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
13050
13143
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
13051
13144
|
const candidates = [
|
|
@@ -13099,9 +13192,9 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
13099
13192
|
`;
|
|
13100
13193
|
}, buildReactVendor = async (buildDir) => {
|
|
13101
13194
|
const vendorDir = join18(buildDir, "react", "vendor");
|
|
13102
|
-
|
|
13195
|
+
mkdirSync7(vendorDir, { recursive: true });
|
|
13103
13196
|
const tmpDir = join18(buildDir, "_vendor_tmp");
|
|
13104
|
-
|
|
13197
|
+
mkdirSync7(tmpDir, { recursive: true });
|
|
13105
13198
|
const specifiers = resolveVendorSpecifiers();
|
|
13106
13199
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13107
13200
|
const safeName = toSafeFileName(specifier);
|
|
@@ -13120,7 +13213,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
13120
13213
|
target: "browser",
|
|
13121
13214
|
throw: false
|
|
13122
13215
|
});
|
|
13123
|
-
await
|
|
13216
|
+
await rm5(tmpDir, { force: true, recursive: true });
|
|
13124
13217
|
if (!result.success) {
|
|
13125
13218
|
console.warn("\u26A0\uFE0F React vendor build had errors:", result.logs);
|
|
13126
13219
|
}
|
|
@@ -13169,9 +13262,9 @@ __export(exports_buildAngularVendor, {
|
|
|
13169
13262
|
buildAngularVendor: () => buildAngularVendor,
|
|
13170
13263
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
13171
13264
|
});
|
|
13172
|
-
import { mkdirSync as
|
|
13265
|
+
import { mkdirSync as mkdirSync8 } from "fs";
|
|
13173
13266
|
import { join as join19 } from "path";
|
|
13174
|
-
import { rm as
|
|
13267
|
+
import { rm as rm6 } from "fs/promises";
|
|
13175
13268
|
var {build: bunBuild4, Glob: Glob6 } = globalThis.Bun;
|
|
13176
13269
|
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) => {
|
|
13177
13270
|
try {
|
|
@@ -13207,7 +13300,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13207
13300
|
}
|
|
13208
13301
|
return { angular, transitiveRoots };
|
|
13209
13302
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
13210
|
-
const { readFileSync:
|
|
13303
|
+
const { readFileSync: readFileSync12 } = await import("fs");
|
|
13211
13304
|
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
13212
13305
|
const visited = new Set;
|
|
13213
13306
|
const frontier = [];
|
|
@@ -13228,7 +13321,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13228
13321
|
}
|
|
13229
13322
|
let content;
|
|
13230
13323
|
try {
|
|
13231
|
-
content =
|
|
13324
|
+
content = readFileSync12(resolved, "utf-8");
|
|
13232
13325
|
} catch {
|
|
13233
13326
|
continue;
|
|
13234
13327
|
}
|
|
@@ -13268,9 +13361,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13268
13361
|
return Array.from(angular).filter(isResolvable2);
|
|
13269
13362
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
13270
13363
|
const vendorDir = join19(buildDir, "angular", "vendor");
|
|
13271
|
-
|
|
13364
|
+
mkdirSync8(vendorDir, { recursive: true });
|
|
13272
13365
|
const tmpDir = join19(buildDir, "_angular_vendor_tmp");
|
|
13273
|
-
|
|
13366
|
+
mkdirSync8(tmpDir, { recursive: true });
|
|
13274
13367
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13275
13368
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13276
13369
|
const safeName = toSafeFileName2(specifier);
|
|
@@ -13290,7 +13383,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13290
13383
|
target: "browser",
|
|
13291
13384
|
throw: false
|
|
13292
13385
|
});
|
|
13293
|
-
await
|
|
13386
|
+
await rm6(tmpDir, { force: true, recursive: true });
|
|
13294
13387
|
if (!result.success) {
|
|
13295
13388
|
console.warn("\u26A0\uFE0F Angular vendor build had errors:", result.logs);
|
|
13296
13389
|
}
|
|
@@ -13306,9 +13399,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13306
13399
|
return computeAngularVendorPaths(specifiers);
|
|
13307
13400
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
13308
13401
|
const vendorDir = join19(buildDir, "angular", "vendor", "server");
|
|
13309
|
-
|
|
13402
|
+
mkdirSync8(vendorDir, { recursive: true });
|
|
13310
13403
|
const tmpDir = join19(buildDir, "_angular_server_vendor_tmp");
|
|
13311
|
-
|
|
13404
|
+
mkdirSync8(tmpDir, { recursive: true });
|
|
13312
13405
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13313
13406
|
const allSpecs = new Set(browserSpecs);
|
|
13314
13407
|
for (const spec of SERVER_ONLY_ANGULAR_SPECIFIERS) {
|
|
@@ -13333,7 +13426,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13333
13426
|
target: "bun",
|
|
13334
13427
|
throw: false
|
|
13335
13428
|
});
|
|
13336
|
-
await
|
|
13429
|
+
await rm6(tmpDir, { force: true, recursive: true });
|
|
13337
13430
|
if (!result.success) {
|
|
13338
13431
|
console.warn("\u26A0\uFE0F Angular server vendor build had errors:", result.logs);
|
|
13339
13432
|
}
|
|
@@ -13397,15 +13490,15 @@ __export(exports_buildVueVendor, {
|
|
|
13397
13490
|
computeVueVendorPaths: () => computeVueVendorPaths,
|
|
13398
13491
|
buildVueVendor: () => buildVueVendor
|
|
13399
13492
|
});
|
|
13400
|
-
import { mkdirSync as
|
|
13493
|
+
import { mkdirSync as mkdirSync9 } from "fs";
|
|
13401
13494
|
import { join as join20 } from "path";
|
|
13402
|
-
import { rm as
|
|
13495
|
+
import { rm as rm7 } from "fs/promises";
|
|
13403
13496
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
13404
13497
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
13405
13498
|
const vendorDir = join20(buildDir, "vue", "vendor");
|
|
13406
|
-
|
|
13499
|
+
mkdirSync9(vendorDir, { recursive: true });
|
|
13407
13500
|
const tmpDir = join20(buildDir, "_vue_vendor_tmp");
|
|
13408
|
-
|
|
13501
|
+
mkdirSync9(tmpDir, { recursive: true });
|
|
13409
13502
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
13410
13503
|
const safeName = toSafeFileName3(specifier);
|
|
13411
13504
|
const entryPath = join20(tmpDir, `${safeName}.ts`);
|
|
@@ -13428,22 +13521,22 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
13428
13521
|
target: "browser",
|
|
13429
13522
|
throw: false
|
|
13430
13523
|
});
|
|
13431
|
-
await
|
|
13524
|
+
await rm7(tmpDir, { force: true, recursive: true });
|
|
13432
13525
|
if (!result.success) {
|
|
13433
13526
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
13434
13527
|
return;
|
|
13435
13528
|
}
|
|
13436
|
-
const { readFileSync:
|
|
13529
|
+
const { readFileSync: readFileSync12, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
13437
13530
|
const files = readdirSync(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
13438
13531
|
for (const file4 of files) {
|
|
13439
13532
|
const filePath = join20(vendorDir, file4);
|
|
13440
|
-
const content =
|
|
13533
|
+
const content = readFileSync12(filePath, "utf-8");
|
|
13441
13534
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
13442
13535
|
continue;
|
|
13443
13536
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
13444
13537
|
if (patched === content)
|
|
13445
13538
|
continue;
|
|
13446
|
-
|
|
13539
|
+
writeFileSync7(filePath, patched);
|
|
13447
13540
|
}
|
|
13448
13541
|
}, computeVueVendorPaths = () => {
|
|
13449
13542
|
const paths = {};
|
|
@@ -13462,9 +13555,9 @@ __export(exports_buildSvelteVendor, {
|
|
|
13462
13555
|
computeSvelteVendorPaths: () => computeSvelteVendorPaths,
|
|
13463
13556
|
buildSvelteVendor: () => buildSvelteVendor
|
|
13464
13557
|
});
|
|
13465
|
-
import { mkdirSync as
|
|
13558
|
+
import { mkdirSync as mkdirSync10 } from "fs";
|
|
13466
13559
|
import { join as join21 } from "path";
|
|
13467
|
-
import { rm as
|
|
13560
|
+
import { rm as rm8 } from "fs/promises";
|
|
13468
13561
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
13469
13562
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
13470
13563
|
try {
|
|
@@ -13478,9 +13571,9 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
13478
13571
|
if (specifiers.length === 0)
|
|
13479
13572
|
return;
|
|
13480
13573
|
const vendorDir = join21(buildDir, "svelte", "vendor");
|
|
13481
|
-
|
|
13574
|
+
mkdirSync10(vendorDir, { recursive: true });
|
|
13482
13575
|
const tmpDir = join21(buildDir, "_svelte_vendor_tmp");
|
|
13483
|
-
|
|
13576
|
+
mkdirSync10(tmpDir, { recursive: true });
|
|
13484
13577
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13485
13578
|
const safeName = toSafeFileName4(specifier);
|
|
13486
13579
|
const entryPath = join21(tmpDir, `${safeName}.ts`);
|
|
@@ -13498,7 +13591,7 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
13498
13591
|
target: "browser",
|
|
13499
13592
|
throw: false
|
|
13500
13593
|
});
|
|
13501
|
-
await
|
|
13594
|
+
await rm8(tmpDir, { force: true, recursive: true });
|
|
13502
13595
|
if (!result.success) {
|
|
13503
13596
|
console.warn("\u26A0\uFE0F Svelte vendor build had errors:", result.logs);
|
|
13504
13597
|
}
|
|
@@ -13521,12 +13614,19 @@ var init_buildSvelteVendor = __esm(() => {
|
|
|
13521
13614
|
];
|
|
13522
13615
|
});
|
|
13523
13616
|
|
|
13524
|
-
// src/build/
|
|
13525
|
-
var
|
|
13526
|
-
__export(
|
|
13617
|
+
// src/build/rewriteImportsPlugin.ts
|
|
13618
|
+
var exports_rewriteImportsPlugin = {};
|
|
13619
|
+
__export(exports_rewriteImportsPlugin, {
|
|
13527
13620
|
rewriteVendorDirectories: () => rewriteVendorDirectories,
|
|
13528
|
-
|
|
13621
|
+
rewriteImportsInContent: () => rewriteImportsInContent,
|
|
13622
|
+
rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
|
|
13623
|
+
rewriteBuildOutputs: () => rewriteBuildOutputs,
|
|
13624
|
+
jsRewriteImports: () => jsRewriteImports,
|
|
13625
|
+
fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
|
|
13626
|
+
buildWithImportRewrite: () => buildWithImportRewrite
|
|
13529
13627
|
});
|
|
13628
|
+
import { readdir as readdir3 } from "fs/promises";
|
|
13629
|
+
import { join as join22 } from "path";
|
|
13530
13630
|
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
13531
13631
|
let result = content;
|
|
13532
13632
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -13539,90 +13639,157 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
|
|
|
13539
13639
|
result = result.replace(dynamicRegex, `$1${webPath}$2`);
|
|
13540
13640
|
}
|
|
13541
13641
|
return result;
|
|
13542
|
-
},
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
return;
|
|
13642
|
+
}, rewriteImportsInContent = (content, vendorPaths) => {
|
|
13643
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
13644
|
+
return content;
|
|
13546
13645
|
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
13547
|
-
|
|
13548
|
-
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13646
|
+
const native = nativeRewriteImports(content, replacements);
|
|
13647
|
+
return native ?? jsRewriteImports(content, replacements);
|
|
13648
|
+
}, fixMissingReExportNamespacesInContent = (content) => {
|
|
13649
|
+
const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
|
|
13650
|
+
REEXPORT_PATTERN.lastIndex = 0;
|
|
13651
|
+
const missing = [];
|
|
13652
|
+
let match;
|
|
13653
|
+
while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
|
|
13654
|
+
const ident = match[1];
|
|
13655
|
+
if (!ident)
|
|
13656
|
+
continue;
|
|
13657
|
+
const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
|
|
13658
|
+
if (nsImportRe.test(content))
|
|
13659
|
+
continue;
|
|
13660
|
+
const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
|
|
13661
|
+
if (declRe.test(content))
|
|
13662
|
+
continue;
|
|
13663
|
+
const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
|
|
13664
|
+
if (namedImportRe.test(content))
|
|
13665
|
+
continue;
|
|
13666
|
+
const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
|
|
13667
|
+
let pathMatch;
|
|
13668
|
+
let sourcePath;
|
|
13669
|
+
while ((pathMatch = importPathRe.exec(content)) !== null) {
|
|
13670
|
+
const p2 = pathMatch[1];
|
|
13671
|
+
if (!p2)
|
|
13672
|
+
continue;
|
|
13673
|
+
const base = p2.split("/").pop()?.replace(/\.[mc]?js$/, "");
|
|
13674
|
+
if (!base)
|
|
13675
|
+
continue;
|
|
13676
|
+
const normalized = base.startsWith("_") ? base.slice(1) : base;
|
|
13677
|
+
if (normalized === ident || normalized.endsWith(`_${ident}`)) {
|
|
13678
|
+
sourcePath = p2;
|
|
13679
|
+
break;
|
|
13680
|
+
}
|
|
13681
|
+
}
|
|
13682
|
+
if (sourcePath)
|
|
13683
|
+
missing.push({ ident, path: sourcePath });
|
|
13684
|
+
}
|
|
13685
|
+
if (missing.length === 0)
|
|
13686
|
+
return content;
|
|
13687
|
+
const seen = new Set;
|
|
13688
|
+
const unique = missing.filter((entry) => {
|
|
13689
|
+
if (seen.has(entry.ident))
|
|
13690
|
+
return false;
|
|
13691
|
+
seen.add(entry.ident);
|
|
13692
|
+
return true;
|
|
13693
|
+
});
|
|
13694
|
+
const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
|
|
13695
|
+
`);
|
|
13696
|
+
return `${inserts}
|
|
13697
|
+
${content}`;
|
|
13698
|
+
}, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
|
|
13699
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
13700
|
+
return;
|
|
13701
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
13702
|
+
let original;
|
|
13703
|
+
try {
|
|
13704
|
+
original = await artifact.text();
|
|
13705
|
+
} catch (err) {
|
|
13706
|
+
const code = err.code;
|
|
13707
|
+
if (code === "ENOENT")
|
|
13708
|
+
return;
|
|
13709
|
+
throw err;
|
|
13710
|
+
}
|
|
13711
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
13712
|
+
if (rewritten === original)
|
|
13713
|
+
return;
|
|
13714
|
+
try {
|
|
13715
|
+
await Bun.write(artifact.path, rewritten);
|
|
13716
|
+
} catch (err) {
|
|
13717
|
+
const code = err.code;
|
|
13718
|
+
if (code === "ENOENT")
|
|
13719
|
+
return;
|
|
13720
|
+
throw err;
|
|
13721
|
+
}
|
|
13722
|
+
}));
|
|
13723
|
+
}, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
|
|
13724
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
13725
|
+
const vendorPaths = resolveVendorPaths(artifact);
|
|
13726
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
13727
|
+
return;
|
|
13728
|
+
let original;
|
|
13729
|
+
try {
|
|
13730
|
+
original = await artifact.text();
|
|
13731
|
+
} catch (err) {
|
|
13732
|
+
const code = err.code;
|
|
13733
|
+
if (code === "ENOENT")
|
|
13734
|
+
return;
|
|
13735
|
+
throw err;
|
|
13736
|
+
}
|
|
13737
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
13738
|
+
if (rewritten === original)
|
|
13739
|
+
return;
|
|
13740
|
+
try {
|
|
13741
|
+
await Bun.write(artifact.path, rewritten);
|
|
13742
|
+
} catch (err) {
|
|
13743
|
+
const code = err.code;
|
|
13744
|
+
if (code === "ENOENT")
|
|
13745
|
+
return;
|
|
13746
|
+
throw err;
|
|
13553
13747
|
}
|
|
13554
13748
|
}));
|
|
13555
13749
|
}, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
|
|
13556
13750
|
if (Object.keys(vendorPaths).length === 0)
|
|
13557
13751
|
return;
|
|
13558
|
-
const { readdirSync } = await import("fs");
|
|
13559
|
-
const { join: join22 } = await import("path");
|
|
13560
13752
|
const allFiles = [];
|
|
13561
13753
|
for (const dir of vendorDirs) {
|
|
13562
13754
|
try {
|
|
13563
|
-
const
|
|
13564
|
-
|
|
13755
|
+
const entries = await readdir3(dir);
|
|
13756
|
+
for (const entry of entries) {
|
|
13757
|
+
if (entry.endsWith(".js"))
|
|
13758
|
+
allFiles.push(join22(dir, entry));
|
|
13759
|
+
}
|
|
13565
13760
|
} catch {}
|
|
13566
13761
|
}
|
|
13567
|
-
await
|
|
13568
|
-
|
|
13569
|
-
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
|
|
13577
|
-
const ident = match[1];
|
|
13578
|
-
if (!ident)
|
|
13579
|
-
continue;
|
|
13580
|
-
const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
|
|
13581
|
-
if (nsImportRe.test(content))
|
|
13582
|
-
continue;
|
|
13583
|
-
const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
|
|
13584
|
-
if (declRe.test(content))
|
|
13585
|
-
continue;
|
|
13586
|
-
const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
|
|
13587
|
-
if (namedImportRe.test(content))
|
|
13588
|
-
continue;
|
|
13589
|
-
const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
|
|
13590
|
-
let pathMatch;
|
|
13591
|
-
let sourcePath;
|
|
13592
|
-
while ((pathMatch = importPathRe.exec(content)) !== null) {
|
|
13593
|
-
const p2 = pathMatch[1];
|
|
13594
|
-
if (!p2)
|
|
13595
|
-
continue;
|
|
13596
|
-
const base = p2.split("/").pop()?.replace(/\.[mc]?js$/, "");
|
|
13597
|
-
if (!base)
|
|
13598
|
-
continue;
|
|
13599
|
-
const normalized = base.startsWith("_") ? base.slice(1) : base;
|
|
13600
|
-
if (normalized === ident || normalized.endsWith(`_${ident}`)) {
|
|
13601
|
-
sourcePath = p2;
|
|
13602
|
-
break;
|
|
13603
|
-
}
|
|
13604
|
-
}
|
|
13605
|
-
if (sourcePath) {
|
|
13606
|
-
missing.push({ ident, path: sourcePath });
|
|
13607
|
-
}
|
|
13762
|
+
await Promise.all(allFiles.map(async (filePath) => {
|
|
13763
|
+
let original;
|
|
13764
|
+
try {
|
|
13765
|
+
original = await Bun.file(filePath).text();
|
|
13766
|
+
} catch (err) {
|
|
13767
|
+
const code = err.code;
|
|
13768
|
+
if (code === "ENOENT")
|
|
13769
|
+
return;
|
|
13770
|
+
throw err;
|
|
13608
13771
|
}
|
|
13609
|
-
|
|
13772
|
+
let next = rewriteImportsInContent(original, vendorPaths);
|
|
13773
|
+
next = fixMissingReExportNamespacesInContent(next);
|
|
13774
|
+
if (next === original)
|
|
13610
13775
|
return;
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
`);
|
|
13620
|
-
const patched = `${inserts}
|
|
13621
|
-
${content}`;
|
|
13622
|
-
await Bun.write(filePath, patched);
|
|
13776
|
+
try {
|
|
13777
|
+
await Bun.write(filePath, next);
|
|
13778
|
+
} catch (err) {
|
|
13779
|
+
const code = err.code;
|
|
13780
|
+
if (code === "ENOENT")
|
|
13781
|
+
return;
|
|
13782
|
+
throw err;
|
|
13783
|
+
}
|
|
13623
13784
|
}));
|
|
13785
|
+
}, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
|
|
13786
|
+
const result = await pendingBuild;
|
|
13787
|
+
if (result.outputs.length > 0) {
|
|
13788
|
+
await rewriteBuildOutputs(result.outputs, vendorPaths);
|
|
13789
|
+
}
|
|
13790
|
+
return result;
|
|
13624
13791
|
};
|
|
13625
|
-
var
|
|
13792
|
+
var init_rewriteImportsPlugin = __esm(() => {
|
|
13626
13793
|
init_nativeRewrite();
|
|
13627
13794
|
});
|
|
13628
13795
|
|
|
@@ -13631,13 +13798,13 @@ import {
|
|
|
13631
13798
|
copyFileSync,
|
|
13632
13799
|
cpSync,
|
|
13633
13800
|
existsSync as existsSync19,
|
|
13634
|
-
mkdirSync as
|
|
13635
|
-
readFileSync as
|
|
13801
|
+
mkdirSync as mkdirSync11,
|
|
13802
|
+
readFileSync as readFileSync12,
|
|
13636
13803
|
rmSync as rmSync2,
|
|
13637
13804
|
statSync,
|
|
13638
|
-
writeFileSync as
|
|
13805
|
+
writeFileSync as writeFileSync7
|
|
13639
13806
|
} from "fs";
|
|
13640
|
-
import { basename as basename8, dirname as dirname13, extname as extname7, join as
|
|
13807
|
+
import { basename as basename8, dirname as dirname13, extname as extname7, join as join23, relative as relative10, resolve as resolve19 } from "path";
|
|
13641
13808
|
import { cwd, env as env2, exit } from "process";
|
|
13642
13809
|
var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
|
|
13643
13810
|
var isDev, isBuildTraceEnabled = () => {
|
|
@@ -13712,11 +13879,11 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
13712
13879
|
throw err;
|
|
13713
13880
|
exit(1);
|
|
13714
13881
|
}, copyHtmxVendor = (htmxDir, htmxDestDir) => {
|
|
13715
|
-
|
|
13882
|
+
mkdirSync11(htmxDestDir, { recursive: true });
|
|
13716
13883
|
const glob = new Glob7("htmx*.min.js");
|
|
13717
13884
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
13718
|
-
const src =
|
|
13719
|
-
const dest =
|
|
13885
|
+
const src = join23(htmxDir, relPath);
|
|
13886
|
+
const dest = join23(htmxDestDir, "htmx.min.js");
|
|
13720
13887
|
copyFileSync(src, dest);
|
|
13721
13888
|
return;
|
|
13722
13889
|
}
|
|
@@ -13760,7 +13927,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
13760
13927
|
addWorkerPathIfExists(file4, relPath, workerPaths);
|
|
13761
13928
|
}
|
|
13762
13929
|
}, collectWorkerPathsFromFile = (file4, patterns, workerPaths) => {
|
|
13763
|
-
const content =
|
|
13930
|
+
const content = readFileSync12(file4, "utf-8");
|
|
13764
13931
|
for (const pattern of patterns) {
|
|
13765
13932
|
collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
|
|
13766
13933
|
}
|
|
@@ -13791,8 +13958,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
13791
13958
|
vuePagesPath
|
|
13792
13959
|
}) => {
|
|
13793
13960
|
const { readdirSync: readDir } = await import("fs");
|
|
13794
|
-
const devIndexDir =
|
|
13795
|
-
|
|
13961
|
+
const devIndexDir = join23(buildPath, "_src_indexes");
|
|
13962
|
+
mkdirSync11(devIndexDir, { recursive: true });
|
|
13796
13963
|
if (reactIndexesPath && reactPagesPath) {
|
|
13797
13964
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
13798
13965
|
}
|
|
@@ -13809,35 +13976,35 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
13809
13976
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
13810
13977
|
const pagesRel = relative10(process.cwd(), resolve19(reactPagesPath)).replace(/\\/g, "/");
|
|
13811
13978
|
for (const file4 of indexFiles) {
|
|
13812
|
-
let content =
|
|
13979
|
+
let content = readFileSync12(join23(reactIndexesPath, file4), "utf-8");
|
|
13813
13980
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
13814
|
-
|
|
13981
|
+
writeFileSync7(join23(devIndexDir, file4), content);
|
|
13815
13982
|
}
|
|
13816
13983
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
13817
|
-
const svelteIndexDir =
|
|
13984
|
+
const svelteIndexDir = join23(svelteDir, "generated", "indexes");
|
|
13818
13985
|
const sveltePageEntries = svelteEntries.filter((file4) => resolve19(file4).startsWith(resolve19(sveltePagesPath)));
|
|
13819
13986
|
for (const entry of sveltePageEntries) {
|
|
13820
13987
|
const name = basename8(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
13821
|
-
const indexFile =
|
|
13988
|
+
const indexFile = join23(svelteIndexDir, "pages", `${name}.js`);
|
|
13822
13989
|
if (!existsSync19(indexFile))
|
|
13823
13990
|
continue;
|
|
13824
|
-
let content =
|
|
13991
|
+
let content = readFileSync12(indexFile, "utf-8");
|
|
13825
13992
|
const srcRel = relative10(process.cwd(), resolve19(entry)).replace(/\\/g, "/");
|
|
13826
13993
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
13827
|
-
|
|
13994
|
+
writeFileSync7(join23(devIndexDir, `${name}.svelte.js`), content);
|
|
13828
13995
|
}
|
|
13829
13996
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
13830
|
-
const vueIndexDir =
|
|
13997
|
+
const vueIndexDir = join23(vueDir, "generated", "indexes");
|
|
13831
13998
|
const vuePageEntries = vueEntries.filter((file4) => resolve19(file4).startsWith(resolve19(vuePagesPath)));
|
|
13832
13999
|
for (const entry of vuePageEntries) {
|
|
13833
14000
|
const name = basename8(entry, ".vue");
|
|
13834
|
-
const indexFile =
|
|
14001
|
+
const indexFile = join23(vueIndexDir, `${name}.js`);
|
|
13835
14002
|
if (!existsSync19(indexFile))
|
|
13836
14003
|
continue;
|
|
13837
|
-
let content =
|
|
14004
|
+
let content = readFileSync12(indexFile, "utf-8");
|
|
13838
14005
|
const srcRel = relative10(process.cwd(), resolve19(entry)).replace(/\\/g, "/");
|
|
13839
14006
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
13840
|
-
|
|
14007
|
+
writeFileSync7(join23(devIndexDir, `${name}.vue.js`), content);
|
|
13841
14008
|
}
|
|
13842
14009
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
13843
14010
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -13885,7 +14052,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
13885
14052
|
}
|
|
13886
14053
|
return result;
|
|
13887
14054
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
13888
|
-
let content =
|
|
14055
|
+
let content = readFileSync12(outputPath, "utf-8");
|
|
13889
14056
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
13890
14057
|
const useNames = [];
|
|
13891
14058
|
let match;
|
|
@@ -13906,7 +14073,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
13906
14073
|
content = `${content.slice(0, firstUseIdx) + runtime}
|
|
13907
14074
|
${content.slice(firstUseIdx)}`;
|
|
13908
14075
|
content = wrapUseFunctions(content, useNames);
|
|
13909
|
-
|
|
14076
|
+
writeFileSync7(outputPath, content);
|
|
13910
14077
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
13911
14078
|
const urlFileMap = new Map;
|
|
13912
14079
|
for (const srcPath of urlReferencedFiles) {
|
|
@@ -13935,7 +14102,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13935
14102
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
13936
14103
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
13937
14104
|
for (const outputPath of outputPaths) {
|
|
13938
|
-
let content =
|
|
14105
|
+
let content = readFileSync12(outputPath, "utf-8");
|
|
13939
14106
|
let changed = false;
|
|
13940
14107
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
13941
14108
|
const targetName = basename8(relPath);
|
|
@@ -13946,7 +14113,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13946
14113
|
return `new URL('${resolvedPath}', import.meta.url)`;
|
|
13947
14114
|
});
|
|
13948
14115
|
if (changed)
|
|
13949
|
-
|
|
14116
|
+
writeFileSync7(outputPath, content);
|
|
13950
14117
|
}
|
|
13951
14118
|
}, vueFeatureFlags, bunBuildPassKeys, bunBuildPassKeySet, reservedBunBuildConfigKeys, passLockedKeys, isObject = (value) => typeof value === "object" && value !== null, isBunBuildPassConfig = (config) => isObject(config) && Object.keys(config).some((key) => bunBuildPassKeySet.has(key)), sanitizeBunBuildOverride = (override, extraReservedKeys = new Set) => {
|
|
13952
14119
|
if (!override)
|
|
@@ -14059,10 +14226,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14059
14226
|
restoreTracePhase();
|
|
14060
14227
|
return;
|
|
14061
14228
|
}
|
|
14062
|
-
const traceDir =
|
|
14229
|
+
const traceDir = join23(buildPath2, ".absolute-trace");
|
|
14063
14230
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
14064
|
-
|
|
14065
|
-
|
|
14231
|
+
mkdirSync11(traceDir, { recursive: true });
|
|
14232
|
+
writeFileSync7(join23(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
14066
14233
|
events: traceEvents,
|
|
14067
14234
|
frameworks: traceFrameworkNames,
|
|
14068
14235
|
generatedAt: new Date().toISOString(),
|
|
@@ -14093,15 +14260,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14093
14260
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
14094
14261
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
14095
14262
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
14096
|
-
const reactIndexesPath = reactDir &&
|
|
14097
|
-
const reactPagesPath = reactDir &&
|
|
14098
|
-
const htmlPagesPath = htmlDir &&
|
|
14099
|
-
const htmlScriptsPath = htmlDir &&
|
|
14100
|
-
const sveltePagesPath = svelteDir &&
|
|
14101
|
-
const vuePagesPath = vueDir &&
|
|
14102
|
-
const htmxPagesPath = htmxDir &&
|
|
14103
|
-
const angularPagesPath = angularDir &&
|
|
14104
|
-
const emberPagesPath = emberDir &&
|
|
14263
|
+
const reactIndexesPath = reactDir && join23(reactDir, "generated", "indexes");
|
|
14264
|
+
const reactPagesPath = reactDir && join23(reactDir, "pages");
|
|
14265
|
+
const htmlPagesPath = htmlDir && join23(htmlDir, "pages");
|
|
14266
|
+
const htmlScriptsPath = htmlDir && join23(htmlDir, "scripts");
|
|
14267
|
+
const sveltePagesPath = svelteDir && join23(svelteDir, "pages");
|
|
14268
|
+
const vuePagesPath = vueDir && join23(vueDir, "pages");
|
|
14269
|
+
const htmxPagesPath = htmxDir && join23(htmxDir, "pages");
|
|
14270
|
+
const angularPagesPath = angularDir && join23(angularDir, "pages");
|
|
14271
|
+
const emberPagesPath = emberDir && join23(emberDir, "pages");
|
|
14105
14272
|
const frontends = [
|
|
14106
14273
|
reactDir,
|
|
14107
14274
|
htmlDir,
|
|
@@ -14141,12 +14308,12 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14141
14308
|
if (svelteDir)
|
|
14142
14309
|
serverDirMap.push({
|
|
14143
14310
|
dir: svelteDir,
|
|
14144
|
-
subdir:
|
|
14311
|
+
subdir: join23("generated", "server")
|
|
14145
14312
|
});
|
|
14146
14313
|
if (vueDir)
|
|
14147
14314
|
serverDirMap.push({
|
|
14148
14315
|
dir: vueDir,
|
|
14149
|
-
subdir:
|
|
14316
|
+
subdir: join23("generated", "server")
|
|
14150
14317
|
});
|
|
14151
14318
|
if (angularDir)
|
|
14152
14319
|
serverDirMap.push({ dir: angularDir, subdir: "generated" });
|
|
@@ -14156,14 +14323,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14156
14323
|
const [firstEntry] = serverDirMap;
|
|
14157
14324
|
if (!firstEntry)
|
|
14158
14325
|
throw new Error("Expected at least one server directory entry");
|
|
14159
|
-
serverRoot =
|
|
14160
|
-
serverOutDir =
|
|
14326
|
+
serverRoot = join23(firstEntry.dir, firstEntry.subdir);
|
|
14327
|
+
serverOutDir = join23(buildPath, basename8(firstEntry.dir));
|
|
14161
14328
|
} else if (serverDirMap.length > 1) {
|
|
14162
14329
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
14163
14330
|
serverOutDir = buildPath;
|
|
14164
14331
|
}
|
|
14165
14332
|
const publicPath = publicDirectory && validateSafePath(publicDirectory, projectRoot);
|
|
14166
|
-
await tracePhase("build-dir/create", () =>
|
|
14333
|
+
await tracePhase("build-dir/create", () => mkdirSync11(buildPath, { recursive: true }));
|
|
14167
14334
|
if (publicPath)
|
|
14168
14335
|
await tracePhase("public/copy", () => cpSync(publicPath, buildPath, { force: true, recursive: true }));
|
|
14169
14336
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
@@ -14185,7 +14352,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14185
14352
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
14186
14353
|
}
|
|
14187
14354
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
14188
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
14355
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join23(buildPath, "assets"), {
|
|
14189
14356
|
force: true,
|
|
14190
14357
|
recursive: true
|
|
14191
14358
|
}));
|
|
@@ -14239,7 +14406,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14239
14406
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
14240
14407
|
if (entry.startsWith(resolve19(reactIndexesPath))) {
|
|
14241
14408
|
const pageName = basename8(entry, ".tsx");
|
|
14242
|
-
return
|
|
14409
|
+
return join23(reactPagesPath, `${pageName}.tsx`);
|
|
14243
14410
|
}
|
|
14244
14411
|
return null;
|
|
14245
14412
|
}) : allReactEntries;
|
|
@@ -14343,9 +14510,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14343
14510
|
const compileReactConventions = async () => {
|
|
14344
14511
|
if (reactConventionSources.length === 0)
|
|
14345
14512
|
return emptyStringArray;
|
|
14346
|
-
const destDir =
|
|
14513
|
+
const destDir = join23(buildPath, "conventions", "react");
|
|
14347
14514
|
rmSync2(destDir, { force: true, recursive: true });
|
|
14348
|
-
|
|
14515
|
+
mkdirSync11(destDir, { recursive: true });
|
|
14349
14516
|
const destPaths = [];
|
|
14350
14517
|
for (let idx = 0;idx < reactConventionSources.length; idx++) {
|
|
14351
14518
|
const source = reactConventionSources[idx];
|
|
@@ -14387,9 +14554,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14387
14554
|
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 }
|
|
14388
14555
|
]);
|
|
14389
14556
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
14390
|
-
const destDir =
|
|
14557
|
+
const destDir = join23(buildPath, "conventions", framework);
|
|
14391
14558
|
rmSync2(destDir, { force: true, recursive: true });
|
|
14392
|
-
|
|
14559
|
+
mkdirSync11(destDir, { recursive: true });
|
|
14393
14560
|
const destPaths = [];
|
|
14394
14561
|
for (let idx = 0;idx < compiledPaths.length; idx++) {
|
|
14395
14562
|
const compiledPath = compiledPaths[idx];
|
|
@@ -14460,7 +14627,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14460
14627
|
}
|
|
14461
14628
|
})) : {
|
|
14462
14629
|
entries: [],
|
|
14463
|
-
generatedRoot:
|
|
14630
|
+
generatedRoot: join23(buildPath, "_island_entries")
|
|
14464
14631
|
};
|
|
14465
14632
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
14466
14633
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -14496,7 +14663,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14496
14663
|
return {};
|
|
14497
14664
|
}
|
|
14498
14665
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
14499
|
-
const refreshEntry =
|
|
14666
|
+
const refreshEntry = join23(reactIndexesPath, "_refresh.tsx");
|
|
14500
14667
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
14501
14668
|
reactClientEntryPoints.push(refreshEntry);
|
|
14502
14669
|
}
|
|
@@ -14512,12 +14679,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14512
14679
|
angularVendorPaths2 = computeAngularVendorPaths2(globalThis.__angularVendorSpecifiers);
|
|
14513
14680
|
setAngularVendorPaths(angularVendorPaths2);
|
|
14514
14681
|
}
|
|
14515
|
-
let angularServerVendorPaths2 = getAngularServerVendorPaths();
|
|
14516
|
-
if (!angularServerVendorPaths2 && hmr && angularDir) {
|
|
14517
|
-
const { computeAngularServerVendorPaths: computeAngularServerVendorPaths2 } = await Promise.resolve().then(() => (init_buildAngularVendor(), exports_buildAngularVendor));
|
|
14518
|
-
angularServerVendorPaths2 = computeAngularServerVendorPaths2(buildPath, globalThis.__angularVendorSpecifiers ?? []);
|
|
14519
|
-
setAngularServerVendorPaths(angularServerVendorPaths2);
|
|
14520
|
-
}
|
|
14682
|
+
let angularServerVendorPaths2 = hmr ? undefined : getAngularServerVendorPaths();
|
|
14521
14683
|
if (!hmr && angularDir) {
|
|
14522
14684
|
const angularSourceDirs = [
|
|
14523
14685
|
angularDir,
|
|
@@ -14600,19 +14762,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14600
14762
|
throw: false
|
|
14601
14763
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
14602
14764
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
14603
|
-
rmSync2(
|
|
14765
|
+
rmSync2(join23(buildPath, "react", "generated", "indexes"), {
|
|
14604
14766
|
force: true,
|
|
14605
14767
|
recursive: true
|
|
14606
14768
|
});
|
|
14607
14769
|
}
|
|
14608
14770
|
if (angularDir && angularClientPaths.length > 0) {
|
|
14609
|
-
rmSync2(
|
|
14771
|
+
rmSync2(join23(buildPath, "angular", "indexes"), {
|
|
14610
14772
|
force: true,
|
|
14611
14773
|
recursive: true
|
|
14612
14774
|
});
|
|
14613
14775
|
}
|
|
14614
14776
|
if (islandClientEntryPoints.length > 0) {
|
|
14615
|
-
rmSync2(
|
|
14777
|
+
rmSync2(join23(buildPath, "islands"), {
|
|
14616
14778
|
force: true,
|
|
14617
14779
|
recursive: true
|
|
14618
14780
|
});
|
|
@@ -14681,7 +14843,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14681
14843
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
14682
14844
|
entrypoints: globalCssEntries,
|
|
14683
14845
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
14684
|
-
outdir: stylesDir ?
|
|
14846
|
+
outdir: stylesDir ? join23(buildPath, basename8(stylesDir)) : buildPath,
|
|
14685
14847
|
plugins: [stylePreprocessorPlugin2],
|
|
14686
14848
|
root: stylesDir || clientRoot,
|
|
14687
14849
|
target: "browser",
|
|
@@ -14690,7 +14852,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14690
14852
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
14691
14853
|
entrypoints: vueCssPaths,
|
|
14692
14854
|
naming: `[name].[hash].[ext]`,
|
|
14693
|
-
outdir:
|
|
14855
|
+
outdir: join23(buildPath, assetsPath ? basename8(assetsPath) : "assets", "css"),
|
|
14694
14856
|
target: "browser",
|
|
14695
14857
|
throw: false
|
|
14696
14858
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -14747,25 +14909,24 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14747
14909
|
...allNonReactVendorPaths
|
|
14748
14910
|
};
|
|
14749
14911
|
if (nonReactClientOutputs.length > 0 && Object.keys(allNonReactVendorPaths).length > 0) {
|
|
14750
|
-
const {
|
|
14751
|
-
await tracePhase("postprocess/non-react-vendor-imports", () =>
|
|
14912
|
+
const { rewriteBuildOutputs: rewriteBuildOutputs2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
14913
|
+
await tracePhase("postprocess/non-react-vendor-imports", () => rewriteBuildOutputs2(nonReactClientOutputs, allNonReactVendorPaths));
|
|
14752
14914
|
}
|
|
14753
14915
|
if (islandClientOutputs.length > 0 && Object.keys(allIslandVendorPaths).length > 0) {
|
|
14754
|
-
const {
|
|
14755
|
-
await tracePhase("postprocess/island-vendor-imports", () =>
|
|
14916
|
+
const { rewriteBuildOutputs: rewriteBuildOutputs2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
14917
|
+
await tracePhase("postprocess/island-vendor-imports", () => rewriteBuildOutputs2(islandClientOutputs, allIslandVendorPaths));
|
|
14756
14918
|
}
|
|
14757
14919
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
14758
|
-
const {
|
|
14759
|
-
|
|
14760
|
-
await tracePhase("postprocess/server-angular-vendor-imports", () => Promise.all(jsArtifacts.map(async (artifact) => {
|
|
14920
|
+
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
14921
|
+
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
14761
14922
|
const fileDir = dirname13(artifact.path);
|
|
14762
14923
|
const relativePaths = {};
|
|
14763
14924
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
14764
14925
|
const rel = relative10(fileDir, absolute);
|
|
14765
14926
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
14766
14927
|
}
|
|
14767
|
-
return
|
|
14768
|
-
}))
|
|
14928
|
+
return relativePaths;
|
|
14929
|
+
}));
|
|
14769
14930
|
}
|
|
14770
14931
|
const cssLogs = [
|
|
14771
14932
|
...globalCssResult?.logs ?? [],
|
|
@@ -14831,19 +14992,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14831
14992
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
14832
14993
|
if (!hmrClientBundle)
|
|
14833
14994
|
return;
|
|
14834
|
-
let html =
|
|
14995
|
+
let html = readFileSync12(filePath, "utf-8");
|
|
14835
14996
|
if (html.includes("data-hmr-client"))
|
|
14836
14997
|
return;
|
|
14837
14998
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
14838
14999
|
const bodyClose = /<\/body\s*>/i.exec(html);
|
|
14839
15000
|
html = bodyClose ? html.slice(0, bodyClose.index) + tag + html.slice(bodyClose.index) : html + tag;
|
|
14840
|
-
|
|
15001
|
+
writeFileSync7(filePath, html);
|
|
14841
15002
|
};
|
|
14842
15003
|
const processHtmlPages = async () => {
|
|
14843
15004
|
if (!(htmlDir && htmlPagesPath))
|
|
14844
15005
|
return;
|
|
14845
|
-
const outputHtmlPages = isSingle ?
|
|
14846
|
-
|
|
15006
|
+
const outputHtmlPages = isSingle ? join23(buildPath, "pages") : join23(buildPath, basename8(htmlDir), "pages");
|
|
15007
|
+
mkdirSync11(outputHtmlPages, { recursive: true });
|
|
14847
15008
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
14848
15009
|
force: true,
|
|
14849
15010
|
recursive: true
|
|
@@ -14864,14 +15025,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14864
15025
|
const processHtmxPages = async () => {
|
|
14865
15026
|
if (!(htmxDir && htmxPagesPath))
|
|
14866
15027
|
return;
|
|
14867
|
-
const outputHtmxPages = isSingle ?
|
|
14868
|
-
|
|
15028
|
+
const outputHtmxPages = isSingle ? join23(buildPath, "pages") : join23(buildPath, basename8(htmxDir), "pages");
|
|
15029
|
+
mkdirSync11(outputHtmxPages, { recursive: true });
|
|
14869
15030
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
14870
15031
|
force: true,
|
|
14871
15032
|
recursive: true
|
|
14872
15033
|
});
|
|
14873
15034
|
if (shouldCopyHtmx) {
|
|
14874
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
15035
|
+
const htmxDestDir = isSingle ? buildPath : join23(buildPath, basename8(htmxDir));
|
|
14875
15036
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
14876
15037
|
}
|
|
14877
15038
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -14932,9 +15093,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14932
15093
|
writeBuildTrace(buildPath);
|
|
14933
15094
|
return { conventions: conventionsMap, manifest };
|
|
14934
15095
|
}
|
|
14935
|
-
|
|
15096
|
+
writeFileSync7(join23(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
14936
15097
|
if (Object.keys(conventionsMap).length > 0) {
|
|
14937
|
-
|
|
15098
|
+
writeFileSync7(join23(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
14938
15099
|
}
|
|
14939
15100
|
writeBuildTrace(buildPath);
|
|
14940
15101
|
if (tailwind && mode === "production") {
|
|
@@ -15031,9 +15192,9 @@ var init_build = __esm(() => {
|
|
|
15031
15192
|
});
|
|
15032
15193
|
|
|
15033
15194
|
// src/build/buildEmberVendor.ts
|
|
15034
|
-
import { mkdirSync as
|
|
15035
|
-
import { join as
|
|
15036
|
-
import { rm as
|
|
15195
|
+
import { mkdirSync as mkdirSync12, existsSync as existsSync20 } from "fs";
|
|
15196
|
+
import { join as join24 } from "path";
|
|
15197
|
+
import { rm as rm9 } from "fs/promises";
|
|
15037
15198
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
15038
15199
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
15039
15200
|
// implementations for macros that would normally be replaced at
|
|
@@ -15084,7 +15245,7 @@ export const importSync = (specifier) => {
|
|
|
15084
15245
|
if (standaloneSpecifiers.has(specifier)) {
|
|
15085
15246
|
return { resolveTo: specifier, specifier };
|
|
15086
15247
|
}
|
|
15087
|
-
const emberInternalPath =
|
|
15248
|
+
const emberInternalPath = join24(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
15088
15249
|
if (!existsSync20(emberInternalPath)) {
|
|
15089
15250
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
15090
15251
|
}
|
|
@@ -15116,7 +15277,7 @@ export const importSync = (specifier) => {
|
|
|
15116
15277
|
if (standalonePackages.has(args.path)) {
|
|
15117
15278
|
return;
|
|
15118
15279
|
}
|
|
15119
|
-
const internal =
|
|
15280
|
+
const internal = join24(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
15120
15281
|
if (existsSync20(internal)) {
|
|
15121
15282
|
return { path: internal };
|
|
15122
15283
|
}
|
|
@@ -15124,16 +15285,16 @@ export const importSync = (specifier) => {
|
|
|
15124
15285
|
});
|
|
15125
15286
|
}
|
|
15126
15287
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
15127
|
-
const vendorDir =
|
|
15128
|
-
|
|
15129
|
-
const tmpDir =
|
|
15130
|
-
|
|
15131
|
-
const macrosShimPath =
|
|
15288
|
+
const vendorDir = join24(buildDir, "ember", "vendor");
|
|
15289
|
+
mkdirSync12(vendorDir, { recursive: true });
|
|
15290
|
+
const tmpDir = join24(buildDir, "_ember_vendor_tmp");
|
|
15291
|
+
mkdirSync12(tmpDir, { recursive: true });
|
|
15292
|
+
const macrosShimPath = join24(tmpDir, "embroider_macros_shim.js");
|
|
15132
15293
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
15133
15294
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
15134
15295
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
15135
15296
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
15136
|
-
const entryPath =
|
|
15297
|
+
const entryPath = join24(tmpDir, `${safeName}.js`);
|
|
15137
15298
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
15138
15299
|
` : generateVendorEntrySource2(resolution);
|
|
15139
15300
|
await Bun.write(entryPath, source);
|
|
@@ -15150,7 +15311,7 @@ export const importSync = (specifier) => {
|
|
|
15150
15311
|
target: "browser",
|
|
15151
15312
|
throw: false
|
|
15152
15313
|
});
|
|
15153
|
-
await
|
|
15314
|
+
await rm9(tmpDir, { force: true, recursive: true });
|
|
15154
15315
|
if (!result.success) {
|
|
15155
15316
|
console.warn("\u26A0\uFE0F Ember vendor build had errors:", result.logs);
|
|
15156
15317
|
}
|
|
@@ -15177,7 +15338,7 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
15177
15338
|
});
|
|
15178
15339
|
|
|
15179
15340
|
// src/dev/dependencyGraph.ts
|
|
15180
|
-
import { existsSync as existsSync21, readFileSync as
|
|
15341
|
+
import { existsSync as existsSync21, readFileSync as readFileSync13 } from "fs";
|
|
15181
15342
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15182
15343
|
import { resolve as resolve20 } from "path";
|
|
15183
15344
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -15338,15 +15499,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15338
15499
|
const lowerPath = filePath.toLowerCase();
|
|
15339
15500
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
15340
15501
|
if (loader === "html") {
|
|
15341
|
-
const content =
|
|
15502
|
+
const content = readFileSync13(filePath, "utf-8");
|
|
15342
15503
|
return extractHtmlDependencies(filePath, content);
|
|
15343
15504
|
}
|
|
15344
15505
|
if (loader === "tsx" || loader === "js") {
|
|
15345
|
-
const content =
|
|
15506
|
+
const content = readFileSync13(filePath, "utf-8");
|
|
15346
15507
|
return extractJsDependencies(filePath, content, loader);
|
|
15347
15508
|
}
|
|
15348
15509
|
if (isSvelteOrVue) {
|
|
15349
|
-
const content =
|
|
15510
|
+
const content = readFileSync13(filePath, "utf-8");
|
|
15350
15511
|
return extractSvelteVueDependencies(filePath, content);
|
|
15351
15512
|
}
|
|
15352
15513
|
return [];
|
|
@@ -15497,7 +15658,8 @@ var init_clientManager = __esm(() => {
|
|
|
15497
15658
|
});
|
|
15498
15659
|
|
|
15499
15660
|
// src/dev/pathUtils.ts
|
|
15500
|
-
import {
|
|
15661
|
+
import { existsSync as existsSync22 } from "fs";
|
|
15662
|
+
import { resolve as resolve22 } from "path";
|
|
15501
15663
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
15502
15664
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
15503
15665
|
return "ignored";
|
|
@@ -15571,28 +15733,15 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
15571
15733
|
return "assets";
|
|
15572
15734
|
}
|
|
15573
15735
|
return "unknown";
|
|
15574
|
-
},
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
const
|
|
15578
|
-
|
|
15579
|
-
return [];
|
|
15580
|
-
const knownNames = new Set([...frameworkDirs, cfg.assetsDir, cfg.stylesDir].filter((dir) => Boolean(dir)).map((dir) => normalizePath(dir).split("/").pop()));
|
|
15581
|
-
knownNames.add("build");
|
|
15582
|
-
knownNames.add("node_modules");
|
|
15583
|
-
knownNames.add(".absolutejs");
|
|
15584
|
-
try {
|
|
15585
|
-
return readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !knownNames.has(entry.name)).map((entry) => `${root}/${entry.name}`);
|
|
15586
|
-
} catch {
|
|
15587
|
-
return [];
|
|
15588
|
-
}
|
|
15589
|
-
}, getWatchPaths = (config, resolved) => {
|
|
15590
|
-
const paths = [];
|
|
15591
|
-
const push = (base, sub) => {
|
|
15592
|
-
if (!base)
|
|
15736
|
+
}, collectPositiveWatchRoots = (config, resolved) => {
|
|
15737
|
+
const cwd2 = process.cwd();
|
|
15738
|
+
const roots = [];
|
|
15739
|
+
const push = (path) => {
|
|
15740
|
+
if (!path)
|
|
15593
15741
|
return;
|
|
15594
|
-
const
|
|
15595
|
-
|
|
15742
|
+
const abs = normalizePath(resolve22(cwd2, path));
|
|
15743
|
+
if (!roots.includes(abs))
|
|
15744
|
+
roots.push(abs);
|
|
15596
15745
|
};
|
|
15597
15746
|
const cfg = resolved ?? {
|
|
15598
15747
|
angularDir: config.angularDirectory,
|
|
@@ -15610,44 +15759,76 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
15610
15759
|
push(cfg.vueDir);
|
|
15611
15760
|
push(cfg.emberDir);
|
|
15612
15761
|
push(cfg.angularDir);
|
|
15613
|
-
push(cfg.htmlDir
|
|
15614
|
-
push(cfg.
|
|
15615
|
-
push(cfg.htmlDir, "styles");
|
|
15616
|
-
push(cfg.htmxDir, "pages");
|
|
15617
|
-
push(cfg.htmxDir, "scripts");
|
|
15618
|
-
push(cfg.htmxDir, "styles");
|
|
15762
|
+
push(cfg.htmlDir);
|
|
15763
|
+
push(cfg.htmxDir);
|
|
15619
15764
|
push(cfg.assetsDir);
|
|
15620
15765
|
push(cfg.stylesDir);
|
|
15621
|
-
const
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15766
|
+
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
15767
|
+
const abs = normalizePath(resolve22(cwd2, candidate));
|
|
15768
|
+
if (existsSync22(abs) && !roots.includes(abs))
|
|
15769
|
+
roots.push(abs);
|
|
15770
|
+
}
|
|
15771
|
+
const extraDirs = config.dev?.watchDirs ?? [];
|
|
15772
|
+
for (const dir of extraDirs)
|
|
15773
|
+
push(dir);
|
|
15774
|
+
return roots;
|
|
15775
|
+
}, getWatchPaths = (config, resolved) => {
|
|
15776
|
+
const roots = collectPositiveWatchRoots(config, resolved);
|
|
15777
|
+
const paths = [];
|
|
15778
|
+
const push = (base, sub) => {
|
|
15779
|
+
if (!base)
|
|
15780
|
+
return;
|
|
15781
|
+
const normalizedBase = normalizePath(base);
|
|
15782
|
+
paths.push(sub ? `${normalizedBase}/${sub}` : normalizedBase);
|
|
15783
|
+
};
|
|
15784
|
+
const cfg = resolved ?? {
|
|
15785
|
+
htmlDir: config.htmlDirectory,
|
|
15786
|
+
htmxDir: config.htmxDirectory
|
|
15787
|
+
};
|
|
15788
|
+
if (cfg.htmlDir) {
|
|
15789
|
+
push(cfg.htmlDir, "pages");
|
|
15790
|
+
push(cfg.htmlDir, "scripts");
|
|
15791
|
+
push(cfg.htmlDir, "styles");
|
|
15792
|
+
}
|
|
15793
|
+
if (cfg.htmxDir) {
|
|
15794
|
+
push(cfg.htmxDir, "pages");
|
|
15795
|
+
push(cfg.htmxDir, "scripts");
|
|
15796
|
+
push(cfg.htmxDir, "styles");
|
|
15797
|
+
}
|
|
15798
|
+
for (const root of roots) {
|
|
15799
|
+
if (root === normalizePath(cfg.htmlDir ?? ""))
|
|
15800
|
+
continue;
|
|
15801
|
+
if (root === normalizePath(cfg.htmxDir ?? ""))
|
|
15802
|
+
continue;
|
|
15803
|
+
paths.push(root);
|
|
15632
15804
|
}
|
|
15633
15805
|
return paths;
|
|
15634
|
-
}, shouldIgnorePath = (path, resolved) => {
|
|
15635
|
-
const
|
|
15636
|
-
if (resolved?.stylesDir
|
|
15637
|
-
|
|
15806
|
+
}, HARD_DENY_PATTERN, shouldIgnorePath = (path, resolved) => {
|
|
15807
|
+
const normalized = path.replace(/\\/g, "/");
|
|
15808
|
+
if (resolved?.stylesDir) {
|
|
15809
|
+
const styles = normalized.startsWith(resolved.stylesDir.replace(/\\/g, "/"));
|
|
15810
|
+
if (styles)
|
|
15811
|
+
return false;
|
|
15638
15812
|
}
|
|
15639
|
-
|
|
15640
|
-
|
|
15813
|
+
if (HARD_DENY_PATTERN.test(normalized))
|
|
15814
|
+
return true;
|
|
15815
|
+
if (normalized.endsWith(".log"))
|
|
15816
|
+
return true;
|
|
15817
|
+
if (normalized.endsWith(".tmp"))
|
|
15818
|
+
return true;
|
|
15819
|
+
if (normalized.endsWith("~"))
|
|
15820
|
+
return true;
|
|
15821
|
+
return false;
|
|
15641
15822
|
};
|
|
15642
15823
|
var init_pathUtils = __esm(() => {
|
|
15643
|
-
init_commonAncestor();
|
|
15644
15824
|
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less|styl(?:us)?)$/i;
|
|
15825
|
+
HARD_DENY_PATTERN = /(^|\/)(build|generated|compiled|indexes|\.absolutejs|node_modules|\.git|\.test-builds|dist)(\/|$)/;
|
|
15645
15826
|
});
|
|
15646
15827
|
|
|
15647
15828
|
// src/dev/fileWatcher.ts
|
|
15648
15829
|
import { watch } from "fs";
|
|
15649
|
-
import { existsSync as
|
|
15650
|
-
import { join as
|
|
15830
|
+
import { existsSync as existsSync23 } from "fs";
|
|
15831
|
+
import { join as join25, resolve as resolve23 } from "path";
|
|
15651
15832
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
15652
15833
|
try {
|
|
15653
15834
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -15674,16 +15855,16 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
15674
15855
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
15675
15856
|
return;
|
|
15676
15857
|
}
|
|
15677
|
-
const fullPath =
|
|
15858
|
+
const fullPath = join25(absolutePath, filename).replace(/\\/g, "/");
|
|
15678
15859
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
15679
15860
|
return;
|
|
15680
15861
|
}
|
|
15681
|
-
if (event === "rename" && !
|
|
15862
|
+
if (event === "rename" && !existsSync23(fullPath)) {
|
|
15682
15863
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
15683
15864
|
onFileChange(fullPath);
|
|
15684
15865
|
return;
|
|
15685
15866
|
}
|
|
15686
|
-
if (
|
|
15867
|
+
if (existsSync23(fullPath)) {
|
|
15687
15868
|
onFileChange(fullPath);
|
|
15688
15869
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
15689
15870
|
}
|
|
@@ -15692,8 +15873,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
15692
15873
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
15693
15874
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
15694
15875
|
paths.forEach((path) => {
|
|
15695
|
-
const absolutePath =
|
|
15696
|
-
if (!
|
|
15876
|
+
const absolutePath = resolve23(path).replace(/\\/g, "/");
|
|
15877
|
+
if (!existsSync23(absolutePath)) {
|
|
15697
15878
|
return;
|
|
15698
15879
|
}
|
|
15699
15880
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -15703,8 +15884,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
15703
15884
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
15704
15885
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
15705
15886
|
watchPaths.forEach((path) => {
|
|
15706
|
-
const absolutePath =
|
|
15707
|
-
if (!
|
|
15887
|
+
const absolutePath = resolve23(path).replace(/\\/g, "/");
|
|
15888
|
+
if (!existsSync23(absolutePath)) {
|
|
15708
15889
|
return;
|
|
15709
15890
|
}
|
|
15710
15891
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -15718,13 +15899,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
15718
15899
|
});
|
|
15719
15900
|
|
|
15720
15901
|
// src/dev/assetStore.ts
|
|
15721
|
-
import { resolve as
|
|
15722
|
-
import { readdir as
|
|
15902
|
+
import { resolve as resolve24 } from "path";
|
|
15903
|
+
import { readdir as readdir4, unlink } from "fs/promises";
|
|
15723
15904
|
var mimeTypes, getMimeType = (filePath) => {
|
|
15724
15905
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
15725
15906
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
15726
15907
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
15727
|
-
const fullPath =
|
|
15908
|
+
const fullPath = resolve24(dir, entry.name);
|
|
15728
15909
|
if (entry.isDirectory()) {
|
|
15729
15910
|
return walkAndClean(fullPath);
|
|
15730
15911
|
}
|
|
@@ -15740,10 +15921,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15740
15921
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
15741
15922
|
const liveByIdentity = new Map;
|
|
15742
15923
|
for (const webPath of store.keys()) {
|
|
15743
|
-
const diskPath =
|
|
15924
|
+
const diskPath = resolve24(buildDir, webPath.slice(1));
|
|
15744
15925
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
15745
15926
|
}
|
|
15746
|
-
const absBuildDir =
|
|
15927
|
+
const absBuildDir = resolve24(buildDir);
|
|
15747
15928
|
Object.values(manifest).forEach((val) => {
|
|
15748
15929
|
if (!HASHED_FILE_RE.test(val))
|
|
15749
15930
|
return;
|
|
@@ -15753,7 +15934,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15753
15934
|
});
|
|
15754
15935
|
try {
|
|
15755
15936
|
const walkAndClean = async (dir) => {
|
|
15756
|
-
const entries = await
|
|
15937
|
+
const entries = await readdir4(dir, { withFileTypes: true });
|
|
15757
15938
|
const tasks = entries.map((entry) => processWalkEntry(entry, dir, liveByIdentity, walkAndClean)).filter((task) => task !== null);
|
|
15758
15939
|
await Promise.all(tasks);
|
|
15759
15940
|
};
|
|
@@ -15761,7 +15942,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15761
15942
|
} catch {}
|
|
15762
15943
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
15763
15944
|
if (entry.isDirectory()) {
|
|
15764
|
-
return scanDir(
|
|
15945
|
+
return scanDir(resolve24(dir, entry.name), `${prefix}${entry.name}/`);
|
|
15765
15946
|
}
|
|
15766
15947
|
if (!entry.name.startsWith("chunk-")) {
|
|
15767
15948
|
return null;
|
|
@@ -15770,7 +15951,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15770
15951
|
if (store.has(webPath)) {
|
|
15771
15952
|
return null;
|
|
15772
15953
|
}
|
|
15773
|
-
return Bun.file(
|
|
15954
|
+
return Bun.file(resolve24(dir, entry.name)).bytes().then((bytes) => {
|
|
15774
15955
|
store.set(webPath, bytes);
|
|
15775
15956
|
return;
|
|
15776
15957
|
}).catch(() => {});
|
|
@@ -15792,14 +15973,14 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15792
15973
|
for (const webPath of newIdentities.values()) {
|
|
15793
15974
|
if (store.has(webPath))
|
|
15794
15975
|
continue;
|
|
15795
|
-
loadPromises.push(Bun.file(
|
|
15976
|
+
loadPromises.push(Bun.file(resolve24(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
15796
15977
|
store.set(webPath, bytes);
|
|
15797
15978
|
return;
|
|
15798
15979
|
}).catch(() => {}));
|
|
15799
15980
|
}
|
|
15800
15981
|
try {
|
|
15801
15982
|
const scanDir = async (dir, prefix) => {
|
|
15802
|
-
const entries = await
|
|
15983
|
+
const entries = await readdir4(dir, { withFileTypes: true });
|
|
15803
15984
|
const subTasks = entries.map((entry) => processScanEntry(entry, dir, prefix, store, scanDir)).filter((task) => task !== null);
|
|
15804
15985
|
await Promise.all(subTasks);
|
|
15805
15986
|
};
|
|
@@ -15822,8 +16003,8 @@ var init_assetStore = __esm(() => {
|
|
|
15822
16003
|
});
|
|
15823
16004
|
|
|
15824
16005
|
// src/islands/pageMetadata.ts
|
|
15825
|
-
import { readFileSync as
|
|
15826
|
-
import { dirname as dirname14, resolve as
|
|
16006
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
16007
|
+
import { dirname as dirname14, resolve as resolve25 } from "path";
|
|
15827
16008
|
var pagePatterns, getPageDirs = (config) => [
|
|
15828
16009
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
15829
16010
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -15843,15 +16024,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
15843
16024
|
const source = definition.buildReference?.source;
|
|
15844
16025
|
if (!source)
|
|
15845
16026
|
continue;
|
|
15846
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
15847
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
16027
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve25(dirname14(buildInfo.resolvedRegistryPath), source);
|
|
16028
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve25(resolvedSource));
|
|
15848
16029
|
}
|
|
15849
16030
|
return lookup;
|
|
15850
16031
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
|
|
15851
16032
|
const candidate = usage.source;
|
|
15852
|
-
return candidate ?
|
|
16033
|
+
return candidate ? resolve25(candidate) === target : false;
|
|
15853
16034
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
15854
|
-
const target =
|
|
16035
|
+
const target = resolve25(sourcePath);
|
|
15855
16036
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
15856
16037
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
15857
16038
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -15863,13 +16044,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
15863
16044
|
const pattern = pagePatterns[entry.framework];
|
|
15864
16045
|
if (!pattern)
|
|
15865
16046
|
return;
|
|
15866
|
-
const files = await scanEntryPoints(
|
|
16047
|
+
const files = await scanEntryPoints(resolve25(entry.dir), pattern);
|
|
15867
16048
|
for (const filePath of files) {
|
|
15868
|
-
const source =
|
|
16049
|
+
const source = readFileSync14(filePath, "utf-8");
|
|
15869
16050
|
const islands = extractIslandUsagesFromSource(source);
|
|
15870
|
-
pageMetadata.set(
|
|
16051
|
+
pageMetadata.set(resolve25(filePath), {
|
|
15871
16052
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
15872
|
-
pagePath:
|
|
16053
|
+
pagePath: resolve25(filePath)
|
|
15873
16054
|
});
|
|
15874
16055
|
}
|
|
15875
16056
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -15896,10 +16077,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
15896
16077
|
});
|
|
15897
16078
|
|
|
15898
16079
|
// src/dev/fileHashTracker.ts
|
|
15899
|
-
import { readFileSync as
|
|
16080
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
15900
16081
|
var computeFileHash = (filePath) => {
|
|
15901
16082
|
try {
|
|
15902
|
-
const fileContent =
|
|
16083
|
+
const fileContent = readFileSync15(filePath);
|
|
15903
16084
|
return Number(Bun.hash(fileContent));
|
|
15904
16085
|
} catch {
|
|
15905
16086
|
return UNFOUND_INDEX;
|
|
@@ -15979,9 +16160,9 @@ var init_transformCache = __esm(() => {
|
|
|
15979
16160
|
});
|
|
15980
16161
|
|
|
15981
16162
|
// src/dev/reactComponentClassifier.ts
|
|
15982
|
-
import { resolve as
|
|
16163
|
+
import { resolve as resolve26 } from "path";
|
|
15983
16164
|
var classifyComponent = (filePath) => {
|
|
15984
|
-
const normalizedPath =
|
|
16165
|
+
const normalizedPath = resolve26(filePath);
|
|
15985
16166
|
if (normalizedPath.includes("/react/pages/")) {
|
|
15986
16167
|
return "server";
|
|
15987
16168
|
}
|
|
@@ -15993,7 +16174,7 @@ var classifyComponent = (filePath) => {
|
|
|
15993
16174
|
var init_reactComponentClassifier = () => {};
|
|
15994
16175
|
|
|
15995
16176
|
// src/dev/moduleMapper.ts
|
|
15996
|
-
import { basename as basename9, resolve as
|
|
16177
|
+
import { basename as basename9, resolve as resolve27 } from "path";
|
|
15997
16178
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
15998
16179
|
const modulePaths = {};
|
|
15999
16180
|
moduleKeys.forEach((key) => {
|
|
@@ -16003,7 +16184,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16003
16184
|
});
|
|
16004
16185
|
return modulePaths;
|
|
16005
16186
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
16006
|
-
const normalizedFile =
|
|
16187
|
+
const normalizedFile = resolve27(sourceFile);
|
|
16007
16188
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
16008
16189
|
if (processedFiles.has(normalizedFile)) {
|
|
16009
16190
|
return null;
|
|
@@ -16039,7 +16220,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16039
16220
|
});
|
|
16040
16221
|
return grouped;
|
|
16041
16222
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
16042
|
-
const normalizedFile =
|
|
16223
|
+
const normalizedFile = resolve27(sourceFile);
|
|
16043
16224
|
const fileName = basename9(normalizedFile);
|
|
16044
16225
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
16045
16226
|
const pascalName = toPascal(baseName);
|
|
@@ -16221,6 +16402,239 @@ var init_ssrCache = __esm(() => {
|
|
|
16221
16402
|
dirtyFrameworks = new Set;
|
|
16222
16403
|
});
|
|
16223
16404
|
|
|
16405
|
+
// src/dev/angular/editTypeDetection.ts
|
|
16406
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
16407
|
+
import { basename as basename10 } from "path";
|
|
16408
|
+
import * as ts3 from "typescript";
|
|
16409
|
+
var TYPE_PRIORITY, STYLE_EXT_RE, COMPONENT_STYLE_RE, TEMPLATE_RE, COMPONENT_CLASS_RE, SERVICE_RE, ROUTES_RE, SIDE_EFFECT_CALL_NAMES, SIDE_EFFECT_NEW_NAMES, getCalleeName = (node) => {
|
|
16410
|
+
const callee = node.expression;
|
|
16411
|
+
if (ts3.isIdentifier(callee))
|
|
16412
|
+
return callee.text;
|
|
16413
|
+
if (ts3.isPropertyAccessExpression(callee))
|
|
16414
|
+
return callee.name.text;
|
|
16415
|
+
return null;
|
|
16416
|
+
}, getNewExprName = (node) => {
|
|
16417
|
+
const callee = node.expression;
|
|
16418
|
+
if (ts3.isIdentifier(callee))
|
|
16419
|
+
return callee.text;
|
|
16420
|
+
if (ts3.isPropertyAccessExpression(callee))
|
|
16421
|
+
return callee.name.text;
|
|
16422
|
+
return null;
|
|
16423
|
+
}, collectMethodBodies = (cls) => {
|
|
16424
|
+
const methods = new Map;
|
|
16425
|
+
cls.members.forEach((member) => {
|
|
16426
|
+
if (!member.name || !ts3.isIdentifier(member.name))
|
|
16427
|
+
return;
|
|
16428
|
+
if (ts3.isMethodDeclaration(member) && member.body) {
|
|
16429
|
+
methods.set(member.name.text, member.body);
|
|
16430
|
+
return;
|
|
16431
|
+
}
|
|
16432
|
+
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16433
|
+
const init = member.initializer;
|
|
16434
|
+
if (ts3.isArrowFunction(init) || ts3.isFunctionExpression(init)) {
|
|
16435
|
+
methods.set(member.name.text, init.body);
|
|
16436
|
+
}
|
|
16437
|
+
}
|
|
16438
|
+
});
|
|
16439
|
+
return methods;
|
|
16440
|
+
}, findSideEffectInBody = (body, methods, visited) => {
|
|
16441
|
+
let hit = { found: false };
|
|
16442
|
+
const walk = (node) => {
|
|
16443
|
+
if (hit.found)
|
|
16444
|
+
return;
|
|
16445
|
+
if (ts3.isCallExpression(node)) {
|
|
16446
|
+
const name = getCalleeName(node);
|
|
16447
|
+
if (name && SIDE_EFFECT_CALL_NAMES.has(name)) {
|
|
16448
|
+
hit = {
|
|
16449
|
+
found: true,
|
|
16450
|
+
reason: `constructor invokes ${name}(...)`
|
|
16451
|
+
};
|
|
16452
|
+
return;
|
|
16453
|
+
}
|
|
16454
|
+
if (name && methods.has(name) && !visited.has(name)) {
|
|
16455
|
+
visited.add(name);
|
|
16456
|
+
const target = methods.get(name);
|
|
16457
|
+
if (target) {
|
|
16458
|
+
const inner = findSideEffectInBody(target, methods, visited);
|
|
16459
|
+
if (inner.found) {
|
|
16460
|
+
hit = {
|
|
16461
|
+
found: true,
|
|
16462
|
+
reason: `${inner.reason} (via this.${name}())`
|
|
16463
|
+
};
|
|
16464
|
+
return;
|
|
16465
|
+
}
|
|
16466
|
+
}
|
|
16467
|
+
}
|
|
16468
|
+
}
|
|
16469
|
+
if (ts3.isNewExpression(node)) {
|
|
16470
|
+
const name = getNewExprName(node);
|
|
16471
|
+
if (name && SIDE_EFFECT_NEW_NAMES.has(name)) {
|
|
16472
|
+
hit = {
|
|
16473
|
+
found: true,
|
|
16474
|
+
reason: `constructor instantiates new ${name}(...)`
|
|
16475
|
+
};
|
|
16476
|
+
return;
|
|
16477
|
+
}
|
|
16478
|
+
}
|
|
16479
|
+
ts3.forEachChild(node, walk);
|
|
16480
|
+
};
|
|
16481
|
+
walk(body);
|
|
16482
|
+
return hit;
|
|
16483
|
+
}, analyzeServiceFile = (file4) => {
|
|
16484
|
+
let source;
|
|
16485
|
+
try {
|
|
16486
|
+
source = readFileSync16(file4, "utf8");
|
|
16487
|
+
} catch {
|
|
16488
|
+
return {
|
|
16489
|
+
hasSideEffectCtor: true,
|
|
16490
|
+
reason: "service file unreadable \u2014 defaulting to reboot"
|
|
16491
|
+
};
|
|
16492
|
+
}
|
|
16493
|
+
const sf = ts3.createSourceFile(file4, source, ts3.ScriptTarget.Latest, true);
|
|
16494
|
+
let result = {
|
|
16495
|
+
hasSideEffectCtor: false,
|
|
16496
|
+
reason: "constructor has no side-effecting calls"
|
|
16497
|
+
};
|
|
16498
|
+
const visit = (node) => {
|
|
16499
|
+
if (result.hasSideEffectCtor)
|
|
16500
|
+
return;
|
|
16501
|
+
if (!ts3.isClassDeclaration(node)) {
|
|
16502
|
+
ts3.forEachChild(node, visit);
|
|
16503
|
+
return;
|
|
16504
|
+
}
|
|
16505
|
+
const methods = collectMethodBodies(node);
|
|
16506
|
+
const ctor = node.members.find(ts3.isConstructorDeclaration);
|
|
16507
|
+
const targets = [];
|
|
16508
|
+
if (ctor?.body)
|
|
16509
|
+
targets.push(ctor.body);
|
|
16510
|
+
node.members.forEach((member) => {
|
|
16511
|
+
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16512
|
+
targets.push(member.initializer);
|
|
16513
|
+
}
|
|
16514
|
+
});
|
|
16515
|
+
for (const target of targets) {
|
|
16516
|
+
const r = findSideEffectInBody(target, methods, new Set);
|
|
16517
|
+
if (r.found) {
|
|
16518
|
+
result = { hasSideEffectCtor: true, reason: r.reason };
|
|
16519
|
+
break;
|
|
16520
|
+
}
|
|
16521
|
+
}
|
|
16522
|
+
if (!result.hasSideEffectCtor)
|
|
16523
|
+
ts3.forEachChild(node, visit);
|
|
16524
|
+
};
|
|
16525
|
+
visit(sf);
|
|
16526
|
+
return result;
|
|
16527
|
+
}, classifyAngularEdit = (file4) => {
|
|
16528
|
+
const base = basename10(file4);
|
|
16529
|
+
if (TEMPLATE_RE.test(file4)) {
|
|
16530
|
+
return {
|
|
16531
|
+
type: "template",
|
|
16532
|
+
reason: `${base} \u2014 template edit`,
|
|
16533
|
+
sourceFile: file4
|
|
16534
|
+
};
|
|
16535
|
+
}
|
|
16536
|
+
if (COMPONENT_STYLE_RE.test(file4)) {
|
|
16537
|
+
return {
|
|
16538
|
+
type: "style-component",
|
|
16539
|
+
reason: `${base} \u2014 component-scoped stylesheet edit`,
|
|
16540
|
+
sourceFile: file4
|
|
16541
|
+
};
|
|
16542
|
+
}
|
|
16543
|
+
if (STYLE_EXT_RE.test(file4)) {
|
|
16544
|
+
return {
|
|
16545
|
+
type: "reboot",
|
|
16546
|
+
reason: `${base} \u2014 non-component-named stylesheet, falling back to reboot until scoping is verified`,
|
|
16547
|
+
sourceFile: file4
|
|
16548
|
+
};
|
|
16549
|
+
}
|
|
16550
|
+
if (ROUTES_RE.test(file4)) {
|
|
16551
|
+
return {
|
|
16552
|
+
type: "route",
|
|
16553
|
+
reason: `${base} \u2014 router config, requires reboot`,
|
|
16554
|
+
sourceFile: file4
|
|
16555
|
+
};
|
|
16556
|
+
}
|
|
16557
|
+
if (SERVICE_RE.test(file4)) {
|
|
16558
|
+
const a = analyzeServiceFile(file4);
|
|
16559
|
+
if (a.hasSideEffectCtor) {
|
|
16560
|
+
return {
|
|
16561
|
+
type: "service-with-side-effects",
|
|
16562
|
+
reason: `${base} \u2014 ${a.reason}`,
|
|
16563
|
+
sourceFile: file4
|
|
16564
|
+
};
|
|
16565
|
+
}
|
|
16566
|
+
return {
|
|
16567
|
+
type: "service-method-only",
|
|
16568
|
+
reason: `${base} \u2014 ${a.reason}`,
|
|
16569
|
+
sourceFile: file4
|
|
16570
|
+
};
|
|
16571
|
+
}
|
|
16572
|
+
if (COMPONENT_CLASS_RE.test(file4)) {
|
|
16573
|
+
return {
|
|
16574
|
+
type: "class-component",
|
|
16575
|
+
reason: `${base} \u2014 component class edit`,
|
|
16576
|
+
sourceFile: file4
|
|
16577
|
+
};
|
|
16578
|
+
}
|
|
16579
|
+
return {
|
|
16580
|
+
type: "reboot",
|
|
16581
|
+
reason: `${base} \u2014 unrecognized angular file type, falling back to reboot`,
|
|
16582
|
+
sourceFile: file4
|
|
16583
|
+
};
|
|
16584
|
+
}, collapseClassifications = (classifications) => {
|
|
16585
|
+
if (classifications.length === 0) {
|
|
16586
|
+
return {
|
|
16587
|
+
type: "reboot",
|
|
16588
|
+
reason: "no classifiable files in batch",
|
|
16589
|
+
sourceFile: ""
|
|
16590
|
+
};
|
|
16591
|
+
}
|
|
16592
|
+
let winner = classifications[0];
|
|
16593
|
+
for (let i = 1;i < classifications.length; i++) {
|
|
16594
|
+
const candidate = classifications[i];
|
|
16595
|
+
if (TYPE_PRIORITY[candidate.type] > TYPE_PRIORITY[winner.type]) {
|
|
16596
|
+
winner = candidate;
|
|
16597
|
+
}
|
|
16598
|
+
}
|
|
16599
|
+
return winner;
|
|
16600
|
+
};
|
|
16601
|
+
var init_editTypeDetection = __esm(() => {
|
|
16602
|
+
TYPE_PRIORITY = {
|
|
16603
|
+
template: 0,
|
|
16604
|
+
"style-component": 1,
|
|
16605
|
+
"service-method-only": 2,
|
|
16606
|
+
"class-component": 3,
|
|
16607
|
+
"service-with-side-effects": 4,
|
|
16608
|
+
route: 5,
|
|
16609
|
+
reboot: 6
|
|
16610
|
+
};
|
|
16611
|
+
STYLE_EXT_RE = /\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16612
|
+
COMPONENT_STYLE_RE = /\.component\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16613
|
+
TEMPLATE_RE = /\.html$/i;
|
|
16614
|
+
COMPONENT_CLASS_RE = /\.component\.ts$/i;
|
|
16615
|
+
SERVICE_RE = /\.service\.ts$/i;
|
|
16616
|
+
ROUTES_RE = /(?:^|[\\/])(?:app\.)?routes\.ts$/i;
|
|
16617
|
+
SIDE_EFFECT_CALL_NAMES = new Set([
|
|
16618
|
+
"subscribe",
|
|
16619
|
+
"setInterval",
|
|
16620
|
+
"setTimeout",
|
|
16621
|
+
"addEventListener",
|
|
16622
|
+
"effect",
|
|
16623
|
+
"afterNextRender",
|
|
16624
|
+
"afterRender",
|
|
16625
|
+
"afterEveryRender",
|
|
16626
|
+
"requestAnimationFrame",
|
|
16627
|
+
"requestIdleCallback"
|
|
16628
|
+
]);
|
|
16629
|
+
SIDE_EFFECT_NEW_NAMES = new Set([
|
|
16630
|
+
"Worker",
|
|
16631
|
+
"SharedWorker",
|
|
16632
|
+
"EventSource",
|
|
16633
|
+
"WebSocket",
|
|
16634
|
+
"BroadcastChannel"
|
|
16635
|
+
]);
|
|
16636
|
+
});
|
|
16637
|
+
|
|
16224
16638
|
// src/dev/moduleServer.ts
|
|
16225
16639
|
var exports_moduleServer = {};
|
|
16226
16640
|
__export(exports_moduleServer, {
|
|
@@ -16232,8 +16646,8 @@ __export(exports_moduleServer, {
|
|
|
16232
16646
|
createModuleServer: () => createModuleServer,
|
|
16233
16647
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16234
16648
|
});
|
|
16235
|
-
import { existsSync as
|
|
16236
|
-
import { basename as
|
|
16649
|
+
import { existsSync as existsSync24, readFileSync as readFileSync17, statSync as statSync2 } from "fs";
|
|
16650
|
+
import { basename as basename11, dirname as dirname15, extname as extname8, join as join26, resolve as resolve28, relative as relative11 } from "path";
|
|
16237
16651
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16238
16652
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16239
16653
|
const allExports = [];
|
|
@@ -16253,7 +16667,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
16253
16667
|
${stubs}
|
|
16254
16668
|
`;
|
|
16255
16669
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
16256
|
-
const found = extensions.find((ext) =>
|
|
16670
|
+
const found = extensions.find((ext) => existsSync24(resolve28(projectRoot, srcPath + ext)));
|
|
16257
16671
|
return found ? srcPath + found : srcPath;
|
|
16258
16672
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
16259
16673
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -16268,7 +16682,7 @@ ${stubs}
|
|
|
16268
16682
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
16269
16683
|
}, srcUrl = (relPath, projectRoot) => {
|
|
16270
16684
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
16271
|
-
const absPath =
|
|
16685
|
+
const absPath = resolve28(projectRoot, relPath);
|
|
16272
16686
|
const cached = mtimeCache.get(absPath);
|
|
16273
16687
|
if (cached !== undefined)
|
|
16274
16688
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -16280,12 +16694,12 @@ ${stubs}
|
|
|
16280
16694
|
return base;
|
|
16281
16695
|
}
|
|
16282
16696
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
16283
|
-
const absPath =
|
|
16697
|
+
const absPath = resolve28(fileDir, relPath);
|
|
16284
16698
|
const rel = relative11(projectRoot, absPath);
|
|
16285
16699
|
const extension = extname8(rel);
|
|
16286
16700
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
16287
16701
|
if (extname8(srcPath) === ".svelte") {
|
|
16288
|
-
srcPath = relative11(projectRoot, resolveSvelteModulePath(
|
|
16702
|
+
srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve28(projectRoot, srcPath)));
|
|
16289
16703
|
}
|
|
16290
16704
|
return srcUrl(srcPath, projectRoot);
|
|
16291
16705
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -16302,14 +16716,14 @@ ${stubs}
|
|
|
16302
16716
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
16303
16717
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
16304
16718
|
if (!subpath) {
|
|
16305
|
-
const pkgDir =
|
|
16306
|
-
const pkgJsonPath =
|
|
16307
|
-
if (
|
|
16308
|
-
const pkg = JSON.parse(
|
|
16719
|
+
const pkgDir = resolve28(projectRoot, "node_modules", packageName ?? "");
|
|
16720
|
+
const pkgJsonPath = join26(pkgDir, "package.json");
|
|
16721
|
+
if (existsSync24(pkgJsonPath)) {
|
|
16722
|
+
const pkg = JSON.parse(readFileSync17(pkgJsonPath, "utf-8"));
|
|
16309
16723
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
16310
16724
|
if (esmEntry) {
|
|
16311
|
-
const resolved =
|
|
16312
|
-
if (
|
|
16725
|
+
const resolved = resolve28(pkgDir, esmEntry);
|
|
16726
|
+
if (existsSync24(resolved))
|
|
16313
16727
|
return relative11(projectRoot, resolved);
|
|
16314
16728
|
}
|
|
16315
16729
|
}
|
|
@@ -16319,7 +16733,7 @@ ${stubs}
|
|
|
16319
16733
|
} catch {
|
|
16320
16734
|
return;
|
|
16321
16735
|
}
|
|
16322
|
-
},
|
|
16736
|
+
}, rewriteImports = (code, filePath, projectRoot, rewriter) => {
|
|
16323
16737
|
let result = code;
|
|
16324
16738
|
const vendorReplace = (_match, prefix, specifier, suffix) => {
|
|
16325
16739
|
const webPath = rewriter?.lookup.get(specifier);
|
|
@@ -16353,12 +16767,12 @@ ${stubs}
|
|
|
16353
16767
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
16354
16768
|
});
|
|
16355
16769
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
16356
|
-
const absPath =
|
|
16770
|
+
const absPath = resolve28(fileDir, relPath);
|
|
16357
16771
|
const rel = relative11(projectRoot, absPath);
|
|
16358
16772
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
16359
16773
|
});
|
|
16360
16774
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
16361
|
-
const absPath =
|
|
16775
|
+
const absPath = resolve28(fileDir, relPath);
|
|
16362
16776
|
const rel = relative11(projectRoot, absPath);
|
|
16363
16777
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
16364
16778
|
});
|
|
@@ -16404,7 +16818,7 @@ ${code}`;
|
|
|
16404
16818
|
reactFastRefreshWarningEmitted = true;
|
|
16405
16819
|
logWarn("React HMR is blocked: this Bun build ignores " + "`reactFastRefresh` on Bun.Transpiler, so component state " + "cannot be preserved across edits. Tracking " + "https://github.com/oven-sh/bun/pull/28312 \u2014 if it still has " + "not merged, leave a \uD83D\uDC4D on the PR so the Bun team knows it " + "is blocking you. Until then, React edits trigger a full " + "reload instead of a fast refresh.");
|
|
16406
16820
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
16407
|
-
const raw =
|
|
16821
|
+
const raw = readFileSync17(filePath, "utf-8");
|
|
16408
16822
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
16409
16823
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
16410
16824
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -16418,9 +16832,9 @@ ${transpiled}`;
|
|
|
16418
16832
|
const relPath = relative11(projectRoot, filePath).replace(/\\/g, "/");
|
|
16419
16833
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
16420
16834
|
transpiled += buildIslandMetadataExports(raw);
|
|
16421
|
-
return
|
|
16835
|
+
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
16422
16836
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
16423
|
-
const raw =
|
|
16837
|
+
const raw = readFileSync17(filePath, "utf-8");
|
|
16424
16838
|
const ext = extname8(filePath);
|
|
16425
16839
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
16426
16840
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -16434,7 +16848,7 @@ ${transpiled}`;
|
|
|
16434
16848
|
if (isTS) {
|
|
16435
16849
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
16436
16850
|
}
|
|
16437
|
-
transpiled =
|
|
16851
|
+
transpiled = rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
16438
16852
|
if (!vueDir || !filePath.startsWith(vueDir) || !isTS)
|
|
16439
16853
|
return transpiled;
|
|
16440
16854
|
const useExports = valueExports.filter((e) => e.startsWith("use"));
|
|
@@ -16586,7 +17000,7 @@ ${code}`;
|
|
|
16586
17000
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
16587
17001
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
16588
17002
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
16589
|
-
const raw =
|
|
17003
|
+
const raw = readFileSync17(filePath, "utf-8");
|
|
16590
17004
|
if (!svelteCompiler) {
|
|
16591
17005
|
svelteCompiler = await import("svelte/compiler");
|
|
16592
17006
|
}
|
|
@@ -16596,7 +17010,7 @@ ${code}`;
|
|
|
16596
17010
|
const source = isModule ? loweredSource.code : (await svelteCompiler.preprocess(loweredSource.code, createSvelteStylePreprocessor(stylePreprocessors))).code;
|
|
16597
17011
|
const enableAsync = loweredAwaitSource.transformed || loweredSource.transformed;
|
|
16598
17012
|
const code = isModule ? compileSvelteModule(source, filePath) : compileSvelteComponent(source, filePath, projectRoot, enableAsync);
|
|
16599
|
-
return
|
|
17013
|
+
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
16600
17014
|
}, compileVueTemplate = (descriptor, compiledScript, filePath, componentId) => {
|
|
16601
17015
|
const compiler = getLoadedVueCompiler();
|
|
16602
17016
|
const scriptContent = compiledScript.content;
|
|
@@ -16646,12 +17060,12 @@ export default __script__;`;
|
|
|
16646
17060
|
return `${cssInjection}
|
|
16647
17061
|
${code}`;
|
|
16648
17062
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
16649
|
-
const rawSource =
|
|
17063
|
+
const rawSource = readFileSync17(filePath, "utf-8");
|
|
16650
17064
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
16651
17065
|
if (!vueCompiler) {
|
|
16652
17066
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
16653
17067
|
}
|
|
16654
|
-
const fileName =
|
|
17068
|
+
const fileName = basename11(filePath, ".vue");
|
|
16655
17069
|
const componentId = fileName.toLowerCase();
|
|
16656
17070
|
const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
|
|
16657
17071
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -16667,9 +17081,9 @@ ${code}`;
|
|
|
16667
17081
|
code = await compileVueStyles(descriptor, filePath, componentId, code, stylePreprocessors);
|
|
16668
17082
|
code = tsTranspiler2.transformSync(code);
|
|
16669
17083
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
16670
|
-
return
|
|
17084
|
+
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
16671
17085
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
16672
|
-
const hmrBase = vueDir ?
|
|
17086
|
+
const hmrBase = vueDir ? resolve28(vueDir) : projectRoot;
|
|
16673
17087
|
const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
16674
17088
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
16675
17089
|
result += [
|
|
@@ -16684,11 +17098,11 @@ ${code}`;
|
|
|
16684
17098
|
`);
|
|
16685
17099
|
return result;
|
|
16686
17100
|
}, resolveSvelteModulePath = (path) => {
|
|
16687
|
-
if (
|
|
17101
|
+
if (existsSync24(path))
|
|
16688
17102
|
return path;
|
|
16689
|
-
if (
|
|
17103
|
+
if (existsSync24(`${path}.ts`))
|
|
16690
17104
|
return `${path}.ts`;
|
|
16691
|
-
if (
|
|
17105
|
+
if (existsSync24(`${path}.js`))
|
|
16692
17106
|
return `${path}.js`;
|
|
16693
17107
|
return path;
|
|
16694
17108
|
}, jsResponse = (body) => {
|
|
@@ -16701,7 +17115,7 @@ ${code}`;
|
|
|
16701
17115
|
}
|
|
16702
17116
|
});
|
|
16703
17117
|
}, handleCssRequest = (filePath) => {
|
|
16704
|
-
const raw =
|
|
17118
|
+
const raw = readFileSync17(filePath, "utf-8");
|
|
16705
17119
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
16706
17120
|
return [
|
|
16707
17121
|
`const style = document.createElement('style');`,
|
|
@@ -16828,13 +17242,13 @@ export default {};
|
|
|
16828
17242
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
16829
17243
|
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);`);
|
|
16830
17244
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
16831
|
-
const filePath =
|
|
17245
|
+
const filePath = resolve28(projectRoot, relPath);
|
|
16832
17246
|
const ext = extname8(filePath);
|
|
16833
17247
|
if (ext === ".svelte")
|
|
16834
17248
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
16835
17249
|
if (ext)
|
|
16836
17250
|
return { ext, filePath };
|
|
16837
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
17251
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync24(filePath + candidate));
|
|
16838
17252
|
if (!found)
|
|
16839
17253
|
return { ext, filePath };
|
|
16840
17254
|
const resolved = filePath + found;
|
|
@@ -16854,20 +17268,20 @@ export default {};
|
|
|
16854
17268
|
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
16855
17269
|
if (!TRANSPILABLE.has(ext))
|
|
16856
17270
|
return;
|
|
16857
|
-
const
|
|
16858
|
-
const resolvedVueDir = vueDir ?
|
|
17271
|
+
const stat3 = statSync2(filePath);
|
|
17272
|
+
const resolvedVueDir = vueDir ? resolve28(vueDir) : undefined;
|
|
16859
17273
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
16860
|
-
setTransformed(filePath, content,
|
|
17274
|
+
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
16861
17275
|
return jsResponse(content);
|
|
16862
17276
|
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
16863
|
-
const
|
|
17277
|
+
const stat3 = statSync2(filePath);
|
|
16864
17278
|
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
16865
|
-
setTransformed(filePath, content,
|
|
17279
|
+
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
16866
17280
|
return jsResponse(content);
|
|
16867
17281
|
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
16868
|
-
const
|
|
17282
|
+
const stat3 = statSync2(filePath);
|
|
16869
17283
|
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
16870
|
-
setTransformed(filePath, content,
|
|
17284
|
+
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
16871
17285
|
return jsResponse(content);
|
|
16872
17286
|
}, transformErrorResponse = (err) => {
|
|
16873
17287
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
@@ -16886,7 +17300,7 @@ export default {};
|
|
|
16886
17300
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
16887
17301
|
return;
|
|
16888
17302
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
16889
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
17303
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve28(projectRoot, relPath));
|
|
16890
17304
|
if (virtualCssResponse)
|
|
16891
17305
|
return virtualCssResponse;
|
|
16892
17306
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -16902,11 +17316,11 @@ export default {};
|
|
|
16902
17316
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
16903
17317
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
16904
17318
|
if (match[1])
|
|
16905
|
-
files.push(
|
|
17319
|
+
files.push(resolve28(projectRoot, match[1]));
|
|
16906
17320
|
}
|
|
16907
17321
|
return files;
|
|
16908
17322
|
}, invalidateModule = (filePath) => {
|
|
16909
|
-
const resolved =
|
|
17323
|
+
const resolved = resolve28(filePath);
|
|
16910
17324
|
invalidate(filePath);
|
|
16911
17325
|
if (resolved !== filePath)
|
|
16912
17326
|
invalidate(resolved);
|
|
@@ -16981,6 +17395,46 @@ var init_moduleServer = __esm(() => {
|
|
|
16981
17395
|
SRC_URL_PREFIX = SRC_PREFIX;
|
|
16982
17396
|
});
|
|
16983
17397
|
|
|
17398
|
+
// src/build/rewriteImports.ts
|
|
17399
|
+
var exports_rewriteImports = {};
|
|
17400
|
+
__export(exports_rewriteImports, {
|
|
17401
|
+
rewriteVendorDirectories: () => rewriteVendorDirectories2,
|
|
17402
|
+
rewriteImports: () => rewriteImports2
|
|
17403
|
+
});
|
|
17404
|
+
var rewriteImports2 = async (outputPaths, vendorPaths) => {
|
|
17405
|
+
const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
|
|
17406
|
+
if (jsFiles.length === 0)
|
|
17407
|
+
return;
|
|
17408
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
17409
|
+
return;
|
|
17410
|
+
await Promise.all(jsFiles.map(async (filePath) => {
|
|
17411
|
+
let original;
|
|
17412
|
+
try {
|
|
17413
|
+
original = await Bun.file(filePath).text();
|
|
17414
|
+
} catch (err) {
|
|
17415
|
+
const code = err.code;
|
|
17416
|
+
if (code === "ENOENT")
|
|
17417
|
+
return;
|
|
17418
|
+
throw err;
|
|
17419
|
+
}
|
|
17420
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
17421
|
+
if (rewritten === original)
|
|
17422
|
+
return;
|
|
17423
|
+
try {
|
|
17424
|
+
await Bun.write(filePath, rewritten);
|
|
17425
|
+
} catch (err) {
|
|
17426
|
+
const code = err.code;
|
|
17427
|
+
if (code === "ENOENT")
|
|
17428
|
+
return;
|
|
17429
|
+
throw err;
|
|
17430
|
+
}
|
|
17431
|
+
}));
|
|
17432
|
+
}, rewriteVendorDirectories2;
|
|
17433
|
+
var init_rewriteImports = __esm(() => {
|
|
17434
|
+
init_rewriteImportsPlugin();
|
|
17435
|
+
rewriteVendorDirectories2 = rewriteVendorDirectories;
|
|
17436
|
+
});
|
|
17437
|
+
|
|
16984
17438
|
// src/utils/ssrErrorPage.ts
|
|
16985
17439
|
var ssrErrorPage = (framework, error) => {
|
|
16986
17440
|
const frameworkColors2 = {
|
|
@@ -17112,11 +17566,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
17112
17566
|
__export(exports_simpleHTMLHMR, {
|
|
17113
17567
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
17114
17568
|
});
|
|
17115
|
-
import { resolve as
|
|
17569
|
+
import { resolve as resolve29 } from "path";
|
|
17116
17570
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
17117
17571
|
let htmlContent;
|
|
17118
17572
|
try {
|
|
17119
|
-
const resolvedPath =
|
|
17573
|
+
const resolvedPath = resolve29(htmlFilePath);
|
|
17120
17574
|
const file4 = Bun.file(resolvedPath);
|
|
17121
17575
|
if (!await file4.exists()) {
|
|
17122
17576
|
return null;
|
|
@@ -17142,11 +17596,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
17142
17596
|
__export(exports_simpleHTMXHMR, {
|
|
17143
17597
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
17144
17598
|
});
|
|
17145
|
-
import { resolve as
|
|
17599
|
+
import { resolve as resolve30 } from "path";
|
|
17146
17600
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
17147
17601
|
let htmlContent;
|
|
17148
17602
|
try {
|
|
17149
|
-
const resolvedPath =
|
|
17603
|
+
const resolvedPath = resolve30(htmxFilePath);
|
|
17150
17604
|
const file4 = Bun.file(resolvedPath);
|
|
17151
17605
|
if (!await file4.exists()) {
|
|
17152
17606
|
return null;
|
|
@@ -17168,8 +17622,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
17168
17622
|
var init_simpleHTMXHMR = () => {};
|
|
17169
17623
|
|
|
17170
17624
|
// src/dev/rebuildTrigger.ts
|
|
17171
|
-
import { existsSync as
|
|
17172
|
-
import { basename as
|
|
17625
|
+
import { existsSync as existsSync25 } from "fs";
|
|
17626
|
+
import { basename as basename12, dirname as dirname16, relative as relative12, resolve as resolve31 } from "path";
|
|
17173
17627
|
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) => {
|
|
17174
17628
|
if (!config.tailwind)
|
|
17175
17629
|
return;
|
|
@@ -17257,11 +17711,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17257
17711
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
17258
17712
|
}
|
|
17259
17713
|
return { ...parsed, framework: detectedFw };
|
|
17260
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
17714
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync25(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
17261
17715
|
state.fileHashes.delete(filePathInSet);
|
|
17262
17716
|
try {
|
|
17263
17717
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
17264
|
-
const deletedPathResolved =
|
|
17718
|
+
const deletedPathResolved = resolve31(filePathInSet);
|
|
17265
17719
|
affectedFiles.forEach((affectedFile) => {
|
|
17266
17720
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
17267
17721
|
validFiles.push(affectedFile);
|
|
@@ -17275,7 +17729,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17275
17729
|
if (!dependents || dependents.size === 0) {
|
|
17276
17730
|
return;
|
|
17277
17731
|
}
|
|
17278
|
-
const dependentFiles = Array.from(dependents).filter((file4) =>
|
|
17732
|
+
const dependentFiles = Array.from(dependents).filter((file4) => existsSync25(file4));
|
|
17279
17733
|
if (dependentFiles.length === 0) {
|
|
17280
17734
|
return;
|
|
17281
17735
|
}
|
|
@@ -17291,7 +17745,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17291
17745
|
try {
|
|
17292
17746
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
17293
17747
|
affectedFiles.forEach((affectedFile) => {
|
|
17294
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
17748
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync25(affectedFile)) {
|
|
17295
17749
|
validFiles.push(affectedFile);
|
|
17296
17750
|
processedFiles.add(affectedFile);
|
|
17297
17751
|
}
|
|
@@ -17305,7 +17759,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17305
17759
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
17306
17760
|
return;
|
|
17307
17761
|
}
|
|
17308
|
-
const normalizedFilePath =
|
|
17762
|
+
const normalizedFilePath = resolve31(filePathInSet);
|
|
17309
17763
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
17310
17764
|
validFiles.push(normalizedFilePath);
|
|
17311
17765
|
processedFiles.add(normalizedFilePath);
|
|
@@ -17316,7 +17770,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17316
17770
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
17317
17771
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
17318
17772
|
filePathSet.forEach((filePathInSet) => {
|
|
17319
|
-
if (!
|
|
17773
|
+
if (!existsSync25(filePathInSet)) {
|
|
17320
17774
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
17321
17775
|
return;
|
|
17322
17776
|
}
|
|
@@ -17409,7 +17863,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17409
17863
|
return;
|
|
17410
17864
|
}
|
|
17411
17865
|
if (framework === "unknown") {
|
|
17412
|
-
invalidate(
|
|
17866
|
+
invalidate(resolve31(filePath));
|
|
17413
17867
|
const relPath = relative12(process.cwd(), filePath);
|
|
17414
17868
|
logHmrUpdate(relPath);
|
|
17415
17869
|
return;
|
|
@@ -17453,12 +17907,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17453
17907
|
return componentFile;
|
|
17454
17908
|
}
|
|
17455
17909
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
17456
|
-
if (
|
|
17910
|
+
if (existsSync25(tsCounterpart)) {
|
|
17457
17911
|
return tsCounterpart;
|
|
17458
17912
|
}
|
|
17459
17913
|
if (!graph)
|
|
17460
17914
|
return componentFile;
|
|
17461
|
-
const dependents = graph.dependents.get(
|
|
17915
|
+
const dependents = graph.dependents.get(resolve31(componentFile));
|
|
17462
17916
|
if (!dependents)
|
|
17463
17917
|
return componentFile;
|
|
17464
17918
|
for (const dep of dependents) {
|
|
@@ -17467,7 +17921,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17467
17921
|
}
|
|
17468
17922
|
return componentFile;
|
|
17469
17923
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
17470
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
17924
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve31(file4).startsWith(angularPagesPath));
|
|
17471
17925
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
17472
17926
|
return pageEntries;
|
|
17473
17927
|
}
|
|
@@ -17476,7 +17930,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17476
17930
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
17477
17931
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
17478
17932
|
affected.forEach((file4) => {
|
|
17479
|
-
if (file4.endsWith(".ts") &&
|
|
17933
|
+
if (file4.endsWith(".ts") && resolve31(file4).startsWith(angularPagesPath)) {
|
|
17480
17934
|
resolvedPages.add(file4);
|
|
17481
17935
|
}
|
|
17482
17936
|
});
|
|
@@ -17493,7 +17947,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17493
17947
|
const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
|
|
17494
17948
|
return clientRoots.length === 1 ? clientRoots[0] ?? process.cwd() : commonAncestor2(clientRoots, process.cwd());
|
|
17495
17949
|
}, updateServerManifestEntry = (state, artifact) => {
|
|
17496
|
-
const fileWithHash =
|
|
17950
|
+
const fileWithHash = basename12(artifact.path);
|
|
17497
17951
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
17498
17952
|
if (!baseName) {
|
|
17499
17953
|
return;
|
|
@@ -17546,9 +18000,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17546
18000
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
17547
18001
|
Object.assign(state.manifest, clientManifest);
|
|
17548
18002
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
17549
|
-
}, broadcastAngularPageUpdates = (state, pagesToUpdate, manifest, startTime) => {
|
|
18003
|
+
}, broadcastAngularPageUpdates = (state, pagesToUpdate, manifest, startTime, classification) => {
|
|
17550
18004
|
pagesToUpdate.forEach((angularPagePath) => {
|
|
17551
|
-
const fileName =
|
|
18005
|
+
const fileName = basename12(angularPagePath);
|
|
17552
18006
|
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
17553
18007
|
const pascalName = toPascal(baseName);
|
|
17554
18008
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -17559,10 +18013,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17559
18013
|
data: {
|
|
17560
18014
|
cssBaseName: baseName,
|
|
17561
18015
|
cssUrl,
|
|
18016
|
+
editSourceFile: classification.sourceFile,
|
|
17562
18017
|
framework: "angular",
|
|
17563
18018
|
manifest,
|
|
18019
|
+
reason: classification.reason,
|
|
17564
18020
|
sourceFile: angularPagePath,
|
|
17565
|
-
updateType:
|
|
18021
|
+
updateType: classification.type
|
|
17566
18022
|
},
|
|
17567
18023
|
type: "angular-update"
|
|
17568
18024
|
});
|
|
@@ -17585,9 +18041,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17585
18041
|
await rewriteImports3(ssrPaths, angServerVendorPaths);
|
|
17586
18042
|
}
|
|
17587
18043
|
serverPaths.forEach((serverPath, idx) => {
|
|
17588
|
-
const fileBase =
|
|
18044
|
+
const fileBase = basename12(serverPath, ".js");
|
|
17589
18045
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
17590
|
-
state.manifest[toPascal(fileBase)] =
|
|
18046
|
+
state.manifest[toPascal(fileBase)] = resolve31(ssrPath);
|
|
17591
18047
|
});
|
|
17592
18048
|
if (clientPaths.length > 0) {
|
|
17593
18049
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
@@ -17596,9 +18052,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17596
18052
|
const angularDir = config.angularDirectory ?? "";
|
|
17597
18053
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
17598
18054
|
for (const file4 of angularFiles) {
|
|
17599
|
-
state.fileHashes.set(
|
|
18055
|
+
state.fileHashes.set(resolve31(file4), computeFileHash(file4));
|
|
17600
18056
|
}
|
|
17601
|
-
const angularPagesPath =
|
|
18057
|
+
const angularPagesPath = resolve31(angularDir, "pages");
|
|
17602
18058
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
17603
18059
|
if (pageEntries.length > 0) {
|
|
17604
18060
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
@@ -17608,7 +18064,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17608
18064
|
const angularHmrFiles = angularFiles.filter((file4) => file4.endsWith(".ts") || file4.endsWith(".html"));
|
|
17609
18065
|
const angularPageFiles = angularHmrFiles.filter((file4) => file4.replace(/\\/g, "/").includes("/pages/"));
|
|
17610
18066
|
const pagesToUpdate = angularPageFiles.length > 0 ? angularPageFiles : pageEntries;
|
|
17611
|
-
|
|
18067
|
+
const classification = collapseClassifications(angularFiles.map(classifyAngularEdit));
|
|
18068
|
+
broadcastAngularPageUpdates(state, pagesToUpdate, manifest, startTime, classification);
|
|
17612
18069
|
onRebuildComplete({ hmrState: state, manifest });
|
|
17613
18070
|
return manifest;
|
|
17614
18071
|
}, getModuleUrl = async (pageFile) => {
|
|
@@ -17623,11 +18080,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17623
18080
|
if (isComponentFile2)
|
|
17624
18081
|
return primaryFile;
|
|
17625
18082
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
17626
|
-
const nearest = findNearestComponent2(
|
|
18083
|
+
const nearest = findNearestComponent2(resolve31(primaryFile));
|
|
17627
18084
|
return nearest ?? primaryFile;
|
|
17628
18085
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
17629
18086
|
for (const file4 of reactFiles) {
|
|
17630
|
-
state.fileHashes.set(
|
|
18087
|
+
state.fileHashes.set(resolve31(file4), computeFileHash(file4));
|
|
17631
18088
|
}
|
|
17632
18089
|
markSsrCacheDirty("react");
|
|
17633
18090
|
const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -17709,7 +18166,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17709
18166
|
});
|
|
17710
18167
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
17711
18168
|
for (const file4 of svelteFiles) {
|
|
17712
|
-
state.fileHashes.set(
|
|
18169
|
+
state.fileHashes.set(resolve31(file4), computeFileHash(file4));
|
|
17713
18170
|
}
|
|
17714
18171
|
markSsrCacheDirty("svelte");
|
|
17715
18172
|
const serverDuration = Date.now() - startTime;
|
|
@@ -17733,8 +18190,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17733
18190
|
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
|
|
17734
18191
|
const serverEntries = [...svelteServerPaths];
|
|
17735
18192
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
17736
|
-
const serverRoot =
|
|
17737
|
-
const serverOutDir =
|
|
18193
|
+
const serverRoot = resolve31(svelteDir, "generated", "server");
|
|
18194
|
+
const serverOutDir = resolve31(buildDir, basename12(svelteDir));
|
|
17738
18195
|
const [serverResult, clientResult] = await Promise.all([
|
|
17739
18196
|
serverEntries.length > 0 ? bunBuild9({
|
|
17740
18197
|
entrypoints: serverEntries,
|
|
@@ -17776,7 +18233,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17776
18233
|
const duration = Date.now() - startTime;
|
|
17777
18234
|
const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
|
|
17778
18235
|
broadcastFiles.forEach((sveltePagePath) => {
|
|
17779
|
-
const fileName =
|
|
18236
|
+
const fileName = basename12(sveltePagePath);
|
|
17780
18237
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
17781
18238
|
const pascalName = toPascal(baseName);
|
|
17782
18239
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -17831,7 +18288,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17831
18288
|
});
|
|
17832
18289
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
17833
18290
|
for (const file4 of [...vueFiles, ...nonVueFiles]) {
|
|
17834
|
-
state.fileHashes.set(
|
|
18291
|
+
state.fileHashes.set(resolve31(file4), computeFileHash(file4));
|
|
17835
18292
|
}
|
|
17836
18293
|
markSsrCacheDirty("vue");
|
|
17837
18294
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -17853,13 +18310,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17853
18310
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
17854
18311
|
return state.manifest;
|
|
17855
18312
|
}, EMBER_PAGE_EXTENSIONS, collectAllEmberPages = async (emberPagesPath) => {
|
|
17856
|
-
const { readdir:
|
|
18313
|
+
const { readdir: readdir5 } = await import("fs/promises");
|
|
17857
18314
|
try {
|
|
17858
|
-
const entries = await
|
|
18315
|
+
const entries = await readdir5(emberPagesPath, {
|
|
17859
18316
|
recursive: true,
|
|
17860
18317
|
withFileTypes: true
|
|
17861
18318
|
});
|
|
17862
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
18319
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve31(emberPagesPath, entry.name));
|
|
17863
18320
|
} catch {
|
|
17864
18321
|
return [];
|
|
17865
18322
|
}
|
|
@@ -17871,10 +18328,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17871
18328
|
return state.manifest;
|
|
17872
18329
|
}
|
|
17873
18330
|
for (const file4 of emberFiles) {
|
|
17874
|
-
state.fileHashes.set(
|
|
18331
|
+
state.fileHashes.set(resolve31(file4), computeFileHash(file4));
|
|
17875
18332
|
}
|
|
17876
|
-
const emberPagesPath =
|
|
17877
|
-
const directPageEntries = emberFiles.filter((file4) =>
|
|
18333
|
+
const emberPagesPath = resolve31(emberDir, "pages");
|
|
18334
|
+
const directPageEntries = emberFiles.filter((file4) => resolve31(file4).startsWith(emberPagesPath));
|
|
17878
18335
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
17879
18336
|
if (allPageEntries.length === 0) {
|
|
17880
18337
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -17883,8 +18340,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17883
18340
|
const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
|
|
17884
18341
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
17885
18342
|
for (const serverPath of serverPaths) {
|
|
17886
|
-
const fileBase =
|
|
17887
|
-
state.manifest[toPascal(fileBase)] =
|
|
18343
|
+
const fileBase = basename12(serverPath, ".js");
|
|
18344
|
+
state.manifest[toPascal(fileBase)] = resolve31(serverPath);
|
|
17888
18345
|
}
|
|
17889
18346
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
17890
18347
|
invalidateEmberSsrCache2();
|
|
@@ -17954,7 +18411,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17954
18411
|
});
|
|
17955
18412
|
}
|
|
17956
18413
|
}, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
|
|
17957
|
-
const scriptBaseName =
|
|
18414
|
+
const scriptBaseName = basename12(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
|
|
17958
18415
|
const pascalName = toPascal(scriptBaseName);
|
|
17959
18416
|
const scriptPath = manifest[pascalName] || null;
|
|
17960
18417
|
if (!scriptPath) {
|
|
@@ -17976,8 +18433,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17976
18433
|
if (!buildReference?.source) {
|
|
17977
18434
|
return;
|
|
17978
18435
|
}
|
|
17979
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
17980
|
-
islandFiles.add(
|
|
18436
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve31(dirname16(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
18437
|
+
islandFiles.add(resolve31(sourcePath));
|
|
17981
18438
|
}, resolveIslandSourceFiles = async (config) => {
|
|
17982
18439
|
const registryPath = config.islands?.registry;
|
|
17983
18440
|
if (!registryPath) {
|
|
@@ -17985,7 +18442,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17985
18442
|
}
|
|
17986
18443
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
17987
18444
|
const islandFiles = new Set([
|
|
17988
|
-
|
|
18445
|
+
resolve31(buildInfo.resolvedRegistryPath)
|
|
17989
18446
|
]);
|
|
17990
18447
|
for (const definition of buildInfo.definitions) {
|
|
17991
18448
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -17996,7 +18453,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17996
18453
|
if (islandFiles.size === 0) {
|
|
17997
18454
|
return false;
|
|
17998
18455
|
}
|
|
17999
|
-
return filesToRebuild.some((file4) => islandFiles.has(
|
|
18456
|
+
return filesToRebuild.some((file4) => islandFiles.has(resolve31(file4)));
|
|
18000
18457
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
18001
18458
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
18002
18459
|
if (!shouldReload) {
|
|
@@ -18031,10 +18488,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18031
18488
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
18032
18489
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
18033
18490
|
if (isSingle) {
|
|
18034
|
-
return
|
|
18491
|
+
return resolve31(state.resolvedPaths.buildDir, "pages");
|
|
18035
18492
|
}
|
|
18036
|
-
const dirName = framework === "html" ?
|
|
18037
|
-
return
|
|
18493
|
+
const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
|
|
18494
|
+
return resolve31(state.resolvedPaths.buildDir, dirName, "pages");
|
|
18038
18495
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
18039
18496
|
try {
|
|
18040
18497
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -18072,8 +18529,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18072
18529
|
const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
18073
18530
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
18074
18531
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
18075
|
-
const htmlPageName =
|
|
18076
|
-
const builtHtmlPagePath =
|
|
18532
|
+
const htmlPageName = basename12(pageFile);
|
|
18533
|
+
const builtHtmlPagePath = resolve31(outputHtmlPages, htmlPageName);
|
|
18077
18534
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
18078
18535
|
});
|
|
18079
18536
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -18081,7 +18538,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18081
18538
|
if (!cssFile) {
|
|
18082
18539
|
return;
|
|
18083
18540
|
}
|
|
18084
|
-
const cssBaseName =
|
|
18541
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
18085
18542
|
const cssPascalName = toPascal(cssBaseName);
|
|
18086
18543
|
const cssKey = `${cssPascalName}CSS`;
|
|
18087
18544
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -18130,7 +18587,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18130
18587
|
type: "vue-update"
|
|
18131
18588
|
});
|
|
18132
18589
|
}, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
|
|
18133
|
-
const fileName =
|
|
18590
|
+
const fileName = basename12(vuePagePath);
|
|
18134
18591
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
18135
18592
|
const pascalName = toPascal(baseName);
|
|
18136
18593
|
const vueRoot = config.vueDirectory;
|
|
@@ -18138,7 +18595,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18138
18595
|
const cssKey = `${pascalName}CSS`;
|
|
18139
18596
|
const cssUrl = manifest[cssKey] || null;
|
|
18140
18597
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
18141
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
18598
|
+
const hmrMeta = vueHmrMetadata2.get(resolve31(vuePagePath));
|
|
18142
18599
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
18143
18600
|
if (changeType === "style-only") {
|
|
18144
18601
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -18176,7 +18633,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18176
18633
|
if (!cssFile) {
|
|
18177
18634
|
return;
|
|
18178
18635
|
}
|
|
18179
|
-
const cssBaseName =
|
|
18636
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
18180
18637
|
const cssPascalName = toPascal(cssBaseName);
|
|
18181
18638
|
const cssKey = `${cssPascalName}CSS`;
|
|
18182
18639
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -18194,7 +18651,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18194
18651
|
});
|
|
18195
18652
|
}, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
|
|
18196
18653
|
try {
|
|
18197
|
-
const fileName =
|
|
18654
|
+
const fileName = basename12(sveltePagePath);
|
|
18198
18655
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
18199
18656
|
const pascalName = toPascal(baseName);
|
|
18200
18657
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -18256,7 +18713,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18256
18713
|
if (!cssFile) {
|
|
18257
18714
|
return;
|
|
18258
18715
|
}
|
|
18259
|
-
const cssBaseName =
|
|
18716
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
18260
18717
|
const cssPascalName = toPascal(cssBaseName);
|
|
18261
18718
|
const cssKey = `${cssPascalName}CSS`;
|
|
18262
18719
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -18272,9 +18729,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18272
18729
|
},
|
|
18273
18730
|
type: "angular-update"
|
|
18274
18731
|
});
|
|
18275
|
-
}, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration) => {
|
|
18732
|
+
}, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration, classification) => {
|
|
18276
18733
|
try {
|
|
18277
|
-
const fileName =
|
|
18734
|
+
const fileName = basename12(angularPagePath);
|
|
18278
18735
|
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
18279
18736
|
const pascalName = toPascal(baseName);
|
|
18280
18737
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -18284,10 +18741,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18284
18741
|
data: {
|
|
18285
18742
|
cssBaseName: baseName,
|
|
18286
18743
|
cssUrl,
|
|
18744
|
+
editSourceFile: classification.sourceFile,
|
|
18287
18745
|
framework: "angular",
|
|
18288
18746
|
manifest,
|
|
18747
|
+
reason: classification.reason,
|
|
18289
18748
|
sourceFile: angularPagePath,
|
|
18290
|
-
updateType:
|
|
18749
|
+
updateType: classification.type
|
|
18291
18750
|
},
|
|
18292
18751
|
type: "angular-update"
|
|
18293
18752
|
});
|
|
@@ -18316,8 +18775,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18316
18775
|
handleAngularCssOnlyUpdate(state, angularCssFiles, manifest, duration);
|
|
18317
18776
|
return;
|
|
18318
18777
|
}
|
|
18778
|
+
const classification = collapseClassifications(angularFiles.map(classifyAngularEdit));
|
|
18319
18779
|
pagesToUpdate.forEach((angularPagePath) => {
|
|
18320
|
-
broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration);
|
|
18780
|
+
broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration, classification);
|
|
18321
18781
|
});
|
|
18322
18782
|
}, handleHTMXScriptHMR = (state, filesToRebuild, manifest, duration) => {
|
|
18323
18783
|
if (!state.resolvedPaths.htmxDir) {
|
|
@@ -18372,8 +18832,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18372
18832
|
const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
18373
18833
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
18374
18834
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
18375
|
-
const htmxPageName =
|
|
18376
|
-
const builtHtmxPagePath =
|
|
18835
|
+
const htmxPageName = basename12(htmxPageFile);
|
|
18836
|
+
const builtHtmxPagePath = resolve31(outputHtmxPages, htmxPageName);
|
|
18377
18837
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
18378
18838
|
});
|
|
18379
18839
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -18482,7 +18942,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18482
18942
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
18483
18943
|
writeFs(destPath, html);
|
|
18484
18944
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
18485
|
-
const destPath =
|
|
18945
|
+
const destPath = resolve31(outputDir, basename12(sourceFile));
|
|
18486
18946
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
18487
18947
|
const source = await Bun.file(sourceFile).text();
|
|
18488
18948
|
await Bun.write(destPath, source);
|
|
@@ -18728,6 +19188,7 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
18728
19188
|
init_compileTailwind();
|
|
18729
19189
|
init_tailwindCompiler();
|
|
18730
19190
|
init_ssrCache();
|
|
19191
|
+
init_editTypeDetection();
|
|
18731
19192
|
moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
18732
19193
|
getReactModuleUrl = getModuleUrl;
|
|
18733
19194
|
EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
|
|
@@ -18760,9 +19221,9 @@ __export(exports_buildDepVendor, {
|
|
|
18760
19221
|
computeDepVendorPaths: () => computeDepVendorPaths,
|
|
18761
19222
|
buildDepVendor: () => buildDepVendor
|
|
18762
19223
|
});
|
|
18763
|
-
import { mkdirSync as
|
|
18764
|
-
import { join as
|
|
18765
|
-
import { rm as
|
|
19224
|
+
import { mkdirSync as mkdirSync13 } from "fs";
|
|
19225
|
+
import { join as join27 } from "path";
|
|
19226
|
+
import { rm as rm10 } from "fs/promises";
|
|
18766
19227
|
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
18767
19228
|
var toSafeFileName6 = (specifier) => {
|
|
18768
19229
|
const prefix = specifier.startsWith("@") ? "_" : "";
|
|
@@ -18815,7 +19276,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18815
19276
|
framework: Array.from(framework).filter(isResolvable4)
|
|
18816
19277
|
};
|
|
18817
19278
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
18818
|
-
const { readFileSync:
|
|
19279
|
+
const { readFileSync: readFileSync18 } = await import("fs");
|
|
18819
19280
|
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
18820
19281
|
const newSpecs = new Set;
|
|
18821
19282
|
for (const spec of specs) {
|
|
@@ -18830,7 +19291,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18830
19291
|
}
|
|
18831
19292
|
let content;
|
|
18832
19293
|
try {
|
|
18833
|
-
content =
|
|
19294
|
+
content = readFileSync18(resolved, "utf-8");
|
|
18834
19295
|
} catch {
|
|
18835
19296
|
continue;
|
|
18836
19297
|
}
|
|
@@ -18872,7 +19333,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18872
19333
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
18873
19334
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
18874
19335
|
const safeName = toSafeFileName6(specifier);
|
|
18875
|
-
const entryPath =
|
|
19336
|
+
const entryPath = join27(tmpDir, `${safeName}.ts`);
|
|
18876
19337
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
18877
19338
|
return { entryPath, specifier };
|
|
18878
19339
|
}));
|
|
@@ -18933,10 +19394,10 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18933
19394
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
18934
19395
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
18935
19396
|
return {};
|
|
18936
|
-
const vendorDir =
|
|
18937
|
-
|
|
18938
|
-
const tmpDir =
|
|
18939
|
-
|
|
19397
|
+
const vendorDir = join27(buildDir, "vendor");
|
|
19398
|
+
mkdirSync13(vendorDir, { recursive: true });
|
|
19399
|
+
const tmpDir = join27(buildDir, "_dep_vendor_tmp");
|
|
19400
|
+
mkdirSync13(tmpDir, { recursive: true });
|
|
18940
19401
|
const allSpecs = new Set(initialSpecs);
|
|
18941
19402
|
const alreadyScanned = new Set;
|
|
18942
19403
|
let frontier = [...allSpecs, ...frameworkRoots];
|
|
@@ -18955,7 +19416,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18955
19416
|
if (!success) {
|
|
18956
19417
|
console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
|
|
18957
19418
|
}
|
|
18958
|
-
await
|
|
19419
|
+
await rm10(tmpDir, { force: true, recursive: true });
|
|
18959
19420
|
const paths = {};
|
|
18960
19421
|
for (const specifier of allSpecs) {
|
|
18961
19422
|
paths[specifier] = `/vendor/${toSafeFileName6(specifier)}.js`;
|
|
@@ -19016,9 +19477,9 @@ var exports_devBuild = {};
|
|
|
19016
19477
|
__export(exports_devBuild, {
|
|
19017
19478
|
devBuild: () => devBuild
|
|
19018
19479
|
});
|
|
19019
|
-
import { readdir as
|
|
19480
|
+
import { readdir as readdir5 } from "fs/promises";
|
|
19020
19481
|
import { statSync as statSync3 } from "fs";
|
|
19021
|
-
import { resolve as
|
|
19482
|
+
import { resolve as resolve32 } from "path";
|
|
19022
19483
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
19023
19484
|
const configuredDirs = [
|
|
19024
19485
|
config.reactDirectory,
|
|
@@ -19041,7 +19502,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19041
19502
|
return Object.keys(config).length > 0 ? config : null;
|
|
19042
19503
|
}, reloadConfig = async () => {
|
|
19043
19504
|
try {
|
|
19044
|
-
const configPath2 =
|
|
19505
|
+
const configPath2 = resolve32(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
19045
19506
|
const source = await Bun.file(configPath2).text();
|
|
19046
19507
|
return parseDirectoryConfig(source);
|
|
19047
19508
|
} catch {
|
|
@@ -19126,7 +19587,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19126
19587
|
state.fileChangeQueue.clear();
|
|
19127
19588
|
}
|
|
19128
19589
|
}, handleCachedReload = async () => {
|
|
19129
|
-
const serverMtime = statSync3(
|
|
19590
|
+
const serverMtime = statSync3(resolve32(Bun.main)).mtimeMs;
|
|
19130
19591
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
19131
19592
|
globalThis.__hmrServerMtime = serverMtime;
|
|
19132
19593
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -19163,8 +19624,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19163
19624
|
return true;
|
|
19164
19625
|
}, resolveAbsoluteVersion2 = async () => {
|
|
19165
19626
|
const candidates = [
|
|
19166
|
-
|
|
19167
|
-
|
|
19627
|
+
resolve32(import.meta.dir, "..", "..", "package.json"),
|
|
19628
|
+
resolve32(import.meta.dir, "..", "package.json")
|
|
19168
19629
|
];
|
|
19169
19630
|
const [candidate, ...remaining] = candidates;
|
|
19170
19631
|
if (!candidate) {
|
|
@@ -19187,10 +19648,10 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19187
19648
|
await resolveAbsoluteVersionFromCandidates(remaining);
|
|
19188
19649
|
}, loadVendorFiles = async (assetStore, vendorDir, framework) => {
|
|
19189
19650
|
const emptyStringArray = [];
|
|
19190
|
-
const entries = await
|
|
19651
|
+
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
19191
19652
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
19192
19653
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
19193
|
-
const bytes = await Bun.file(
|
|
19654
|
+
const bytes = await Bun.file(resolve32(vendorDir, entry)).bytes();
|
|
19194
19655
|
assetStore.set(webPath, bytes);
|
|
19195
19656
|
}));
|
|
19196
19657
|
}, devBuild = async (config) => {
|
|
@@ -19231,7 +19692,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19231
19692
|
const sourceDirs = collectDepVendorSourceDirs(config);
|
|
19232
19693
|
if (config.angularDirectory) {
|
|
19233
19694
|
setAngularVendorPaths(await computeAngularVendorPathsAsync(sourceDirs));
|
|
19234
|
-
setAngularServerVendorPaths(await computeAngularServerVendorPathsAsync(state.resolvedPaths.buildDir, sourceDirs));
|
|
19235
19695
|
}
|
|
19236
19696
|
const { computeDepVendorPaths: computeDepVendorPaths2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
19237
19697
|
globalThis.__depVendorPaths = await computeDepVendorPaths2(sourceDirs);
|
|
@@ -19259,16 +19719,16 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19259
19719
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
19260
19720
|
recordStep("populate asset store", stepStartedAt);
|
|
19261
19721
|
stepStartedAt = performance.now();
|
|
19262
|
-
const reactVendorDir =
|
|
19263
|
-
const angularVendorDir =
|
|
19264
|
-
const svelteVendorDir =
|
|
19265
|
-
const vueVendorDir =
|
|
19266
|
-
const depVendorDir =
|
|
19722
|
+
const reactVendorDir = resolve32(state.resolvedPaths.buildDir, "react", "vendor");
|
|
19723
|
+
const angularVendorDir = resolve32(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
19724
|
+
const svelteVendorDir = resolve32(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
19725
|
+
const vueVendorDir = resolve32(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
19726
|
+
const depVendorDir = resolve32(state.resolvedPaths.buildDir, "vendor");
|
|
19267
19727
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
19268
|
-
const [, angularSpecs,
|
|
19728
|
+
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
19269
19729
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
19270
19730
|
config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs, true, Object.keys(globalThis.__depVendorPaths ?? {})) : Promise.resolve(undefined),
|
|
19271
|
-
|
|
19731
|
+
Promise.resolve(undefined),
|
|
19272
19732
|
config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
19273
19733
|
config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
19274
19734
|
config.emberDirectory ? buildEmberVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -19276,9 +19736,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19276
19736
|
]);
|
|
19277
19737
|
if (angularSpecs)
|
|
19278
19738
|
globalThis.__angularVendorSpecifiers = angularSpecs;
|
|
19279
|
-
if (angularServerSpecs) {
|
|
19280
|
-
setAngularServerVendorPaths(computeAngularServerVendorPaths(state.resolvedPaths.buildDir, angularServerSpecs));
|
|
19281
|
-
}
|
|
19282
19739
|
if (config.emberDirectory) {
|
|
19283
19740
|
setEmberVendorPaths(computeEmberVendorPaths());
|
|
19284
19741
|
}
|
|
@@ -19299,8 +19756,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19299
19756
|
config.vueDirectory ? vueVendorDir : null,
|
|
19300
19757
|
depVendorDir
|
|
19301
19758
|
].filter((d2) => d2 !== null);
|
|
19302
|
-
const { rewriteVendorDirectories:
|
|
19303
|
-
await
|
|
19759
|
+
const { rewriteVendorDirectories: rewriteVendorDirectories3 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
19760
|
+
await rewriteVendorDirectories3(activeVendorDirs, combinedVendorPaths);
|
|
19304
19761
|
recordStep("rewrite vendor cross-references", stepStartedAt);
|
|
19305
19762
|
stepStartedAt = performance.now();
|
|
19306
19763
|
await Promise.all([
|
|
@@ -19344,7 +19801,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19344
19801
|
manifest
|
|
19345
19802
|
};
|
|
19346
19803
|
globalThis.__hmrDevResult = result;
|
|
19347
|
-
globalThis.__hmrServerMtime = statSync3(
|
|
19804
|
+
globalThis.__hmrServerMtime = statSync3(resolve32(Bun.main)).mtimeMs;
|
|
19348
19805
|
return result;
|
|
19349
19806
|
};
|
|
19350
19807
|
var init_devBuild = __esm(() => {
|
|
@@ -19381,5 +19838,5 @@ export {
|
|
|
19381
19838
|
build
|
|
19382
19839
|
};
|
|
19383
19840
|
|
|
19384
|
-
//# debugId=
|
|
19841
|
+
//# debugId=9A6C38A07D4967CB64756E2164756E21
|
|
19385
19842
|
//# sourceMappingURL=build.js.map
|