@absolutejs/absolute 0.19.0-beta.844 → 0.19.0-beta.846
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 +29 -21
- package/dist/angular/index.js.map +10 -9
- package/dist/angular/server.js +29 -21
- package/dist/angular/server.js.map +10 -9
- package/dist/build.js +984 -508
- 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 +1031 -555
- package/dist/index.js.map +17 -14
- package/dist/islands/index.js +16 -9
- package/dist/islands/index.js.map +6 -5
- package/dist/react/index.js +16 -9
- package/dist/react/index.js.map +6 -5
- 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 +16 -9
- package/dist/svelte/index.js.map +6 -5
- package/dist/types/build.d.ts +15 -0
- package/dist/types/globals.d.ts +12 -0
- package/dist/vue/index.js +16 -9
- package/dist/vue/index.js.map +6 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6557,6 +6557,9 @@ var init_streamingSlots = __esm(() => {
|
|
|
6557
6557
|
};
|
|
6558
6558
|
});
|
|
6559
6559
|
|
|
6560
|
+
// src/utils/runtimeMode.ts
|
|
6561
|
+
var ENV_VAR = "NODE_ENV", isProductionRuntime = () => process.env[ENV_VAR] === "production", isDevelopmentRuntime = () => process.env[ENV_VAR] === "development";
|
|
6562
|
+
|
|
6560
6563
|
// src/angular/angularPatch.ts
|
|
6561
6564
|
var exports_angularPatch = {};
|
|
6562
6565
|
__export(exports_angularPatch, {
|
|
@@ -6639,7 +6642,8 @@ var ensureHead = (doc) => {
|
|
|
6639
6642
|
}
|
|
6640
6643
|
layoutPatchApplied = true;
|
|
6641
6644
|
}, applyPatches = async () => {
|
|
6642
|
-
const
|
|
6645
|
+
const spec = isProductionRuntime() ? resolveAngularRuntimePath("@angular/platform-server") : "@angular/platform-server";
|
|
6646
|
+
const { \u{275}DominoAdapter } = await import(spec);
|
|
6643
6647
|
if (!\u{275}DominoAdapter?.prototype) {
|
|
6644
6648
|
console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
|
|
6645
6649
|
return false;
|
|
@@ -6706,18 +6710,21 @@ var initDominoAdapter = (platformServer) => {
|
|
|
6706
6710
|
console.error("Failed to initialize DominoAdapter:", err);
|
|
6707
6711
|
}
|
|
6708
6712
|
}, loadAngularDeps = async () => {
|
|
6709
|
-
if (
|
|
6710
|
-
await import(
|
|
6713
|
+
if (!isProductionRuntime()) {
|
|
6714
|
+
await import("@angular/compiler");
|
|
6711
6715
|
}
|
|
6712
6716
|
const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
|
|
6713
6717
|
await applyPatches2();
|
|
6718
|
+
const useBareSpecifiers = !isProductionRuntime();
|
|
6714
6719
|
const [platformBrowser, platformServer, common, core] = await Promise.all([
|
|
6715
|
-
import(resolveAngularRuntimePath("@angular/platform-browser")),
|
|
6716
|
-
import(resolveAngularRuntimePath("@angular/platform-server")),
|
|
6717
|
-
import(resolveAngularRuntimePath("@angular/common")),
|
|
6718
|
-
import(resolveAngularRuntimePath("@angular/core"))
|
|
6720
|
+
useBareSpecifiers ? import("@angular/platform-browser") : import(resolveAngularRuntimePath("@angular/platform-browser")),
|
|
6721
|
+
useBareSpecifiers ? import("@angular/platform-server") : import(resolveAngularRuntimePath("@angular/platform-server")),
|
|
6722
|
+
useBareSpecifiers ? import("@angular/common") : import(resolveAngularRuntimePath("@angular/common")),
|
|
6723
|
+
useBareSpecifiers ? import("@angular/core") : import(resolveAngularRuntimePath("@angular/core"))
|
|
6719
6724
|
]);
|
|
6720
|
-
if (
|
|
6725
|
+
if (!isDevelopmentRuntime()) {
|
|
6726
|
+
core.enableProdMode();
|
|
6727
|
+
}
|
|
6721
6728
|
initDominoAdapter(platformServer);
|
|
6722
6729
|
return {
|
|
6723
6730
|
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
@@ -9842,9 +9849,34 @@ var commonAncestor = (paths, fallback) => {
|
|
|
9842
9849
|
var init_commonAncestor = () => {};
|
|
9843
9850
|
|
|
9844
9851
|
// src/utils/buildDirectoryLock.ts
|
|
9845
|
-
import {
|
|
9852
|
+
import { mkdirSync as mkdirSync6, unlinkSync, writeFileSync as writeFileSync7, readFileSync as readFileSync12 } from "fs";
|
|
9846
9853
|
import { dirname as dirname10, join as join14 } from "path";
|
|
9847
|
-
var
|
|
9854
|
+
var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandlersRegistered = false, registerExitHandlersOnce = () => {
|
|
9855
|
+
if (exitHandlersRegistered)
|
|
9856
|
+
return;
|
|
9857
|
+
exitHandlersRegistered = true;
|
|
9858
|
+
const releaseAllSync = () => {
|
|
9859
|
+
for (const lock of heldLocks.values()) {
|
|
9860
|
+
try {
|
|
9861
|
+
lock.releaseSync();
|
|
9862
|
+
} catch {}
|
|
9863
|
+
}
|
|
9864
|
+
heldLocks.clear();
|
|
9865
|
+
};
|
|
9866
|
+
process.on("exit", releaseAllSync);
|
|
9867
|
+
process.on("SIGINT", () => {
|
|
9868
|
+
releaseAllSync();
|
|
9869
|
+
process.exit(130);
|
|
9870
|
+
});
|
|
9871
|
+
process.on("SIGTERM", () => {
|
|
9872
|
+
releaseAllSync();
|
|
9873
|
+
process.exit(143);
|
|
9874
|
+
});
|
|
9875
|
+
process.on("uncaughtException", (err) => {
|
|
9876
|
+
releaseAllSync();
|
|
9877
|
+
throw err;
|
|
9878
|
+
});
|
|
9879
|
+
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join14(dirname10(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
|
|
9848
9880
|
`).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
|
|
9849
9881
|
if (locks.size === 0) {
|
|
9850
9882
|
delete process.env[HELD_LOCKS_ENV];
|
|
@@ -9860,7 +9892,41 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
|
|
|
9860
9892
|
const locks = readHeldLockEnv();
|
|
9861
9893
|
locks.delete(buildDirectory);
|
|
9862
9894
|
writeHeldLockEnv(locks);
|
|
9863
|
-
},
|
|
9895
|
+
}, writeLockFileSync = (lockPath, metadata2) => {
|
|
9896
|
+
mkdirSync6(dirname10(lockPath), { recursive: true });
|
|
9897
|
+
writeFileSync7(lockPath, JSON.stringify(metadata2, null, 2), { flag: "wx" });
|
|
9898
|
+
}, readLockMetadata = (lockPath) => {
|
|
9899
|
+
try {
|
|
9900
|
+
const raw = readFileSync12(lockPath, "utf-8");
|
|
9901
|
+
const parsed = JSON.parse(raw);
|
|
9902
|
+
if (typeof parsed === "object" && parsed !== null && typeof parsed.pid === "number") {
|
|
9903
|
+
return {
|
|
9904
|
+
pid: parsed.pid,
|
|
9905
|
+
port: typeof parsed.port === "number" ? parsed.port : null,
|
|
9906
|
+
startedAt: typeof parsed.startedAt === "string" ? parsed.startedAt : new Date().toISOString()
|
|
9907
|
+
};
|
|
9908
|
+
}
|
|
9909
|
+
} catch {}
|
|
9910
|
+
return null;
|
|
9911
|
+
}, isProcessAlive = (pid) => {
|
|
9912
|
+
try {
|
|
9913
|
+
process.kill(pid, 0);
|
|
9914
|
+
return true;
|
|
9915
|
+
} catch (err) {
|
|
9916
|
+
const code = err.code;
|
|
9917
|
+
if (code === "ESRCH")
|
|
9918
|
+
return false;
|
|
9919
|
+
if (code === "EPERM")
|
|
9920
|
+
return true;
|
|
9921
|
+
return true;
|
|
9922
|
+
}
|
|
9923
|
+
}, removeStaleLockSync = (lockPath, pid) => {
|
|
9924
|
+
try {
|
|
9925
|
+
unlinkSync(lockPath);
|
|
9926
|
+
console.warn(`[absolutejs] removed stale lock from PID ${pid}`);
|
|
9927
|
+
} catch {}
|
|
9928
|
+
}, LOCK_POLL_MS = 250, DEFAULT_WAIT_TIMEOUT_MS = 120000, acquireBuildDirectoryLock = async (buildDirectory, options = {}) => {
|
|
9929
|
+
registerExitHandlersOnce();
|
|
9864
9930
|
if (readHeldLockEnv().has(buildDirectory)) {
|
|
9865
9931
|
return async () => {};
|
|
9866
9932
|
}
|
|
@@ -9876,52 +9942,66 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
|
|
|
9876
9942
|
};
|
|
9877
9943
|
}
|
|
9878
9944
|
const lockPath = lockPathForBuildDirectory(buildDirectory);
|
|
9879
|
-
const
|
|
9880
|
-
const
|
|
9945
|
+
const wait = options.wait !== false;
|
|
9946
|
+
const waitTimeoutMs = options.waitTimeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
|
|
9881
9947
|
const start = Date.now();
|
|
9948
|
+
const tryCreate = () => {
|
|
9949
|
+
writeLockFileSync(lockPath, {
|
|
9950
|
+
pid: process.pid,
|
|
9951
|
+
port: options.port ?? null,
|
|
9952
|
+
startedAt: new Date().toISOString()
|
|
9953
|
+
});
|
|
9954
|
+
};
|
|
9882
9955
|
while (true) {
|
|
9883
9956
|
try {
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
await writeFile4(join14(lockPath, "owner"), JSON.stringify({
|
|
9887
|
-
buildDirectory,
|
|
9888
|
-
createdAt: new Date().toISOString(),
|
|
9889
|
-
pid: process.pid
|
|
9890
|
-
}, null, 2));
|
|
9891
|
-
const release = async () => {
|
|
9892
|
-
await rm4(lockPath, { force: true, recursive: true }).catch(() => {});
|
|
9893
|
-
};
|
|
9894
|
-
heldLocks.set(buildDirectory, { count: 1, release });
|
|
9895
|
-
markHeldLock(buildDirectory);
|
|
9896
|
-
return async () => {
|
|
9897
|
-
const current = heldLocks.get(buildDirectory);
|
|
9898
|
-
if (!current)
|
|
9899
|
-
return;
|
|
9900
|
-
current.count -= 1;
|
|
9901
|
-
if (current.count > 0)
|
|
9902
|
-
return;
|
|
9903
|
-
heldLocks.delete(buildDirectory);
|
|
9904
|
-
unmarkHeldLock(buildDirectory);
|
|
9905
|
-
await current.release();
|
|
9906
|
-
};
|
|
9957
|
+
tryCreate();
|
|
9958
|
+
break;
|
|
9907
9959
|
} catch (error) {
|
|
9908
9960
|
if (!isAlreadyExistsError(error))
|
|
9909
9961
|
throw error;
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
}
|
|
9917
|
-
if (
|
|
9918
|
-
|
|
9962
|
+
const existing = readLockMetadata(lockPath);
|
|
9963
|
+
if (!existing) {
|
|
9964
|
+
try {
|
|
9965
|
+
unlinkSync(lockPath);
|
|
9966
|
+
} catch {}
|
|
9967
|
+
continue;
|
|
9968
|
+
}
|
|
9969
|
+
if (!isProcessAlive(existing.pid)) {
|
|
9970
|
+
removeStaleLockSync(lockPath, existing.pid);
|
|
9971
|
+
continue;
|
|
9972
|
+
}
|
|
9973
|
+
if (wait && Date.now() - start < waitTimeoutMs) {
|
|
9974
|
+
await Bun.sleep(LOCK_POLL_MS);
|
|
9975
|
+
continue;
|
|
9919
9976
|
}
|
|
9920
|
-
|
|
9977
|
+
const portInfo = existing.port ? ` on port ${existing.port}` : "";
|
|
9978
|
+
const elapsedNote = wait ? ` Waited ${Math.round((Date.now() - start) / 1000)}s.` : "";
|
|
9979
|
+
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.`);
|
|
9921
9980
|
}
|
|
9922
9981
|
}
|
|
9923
|
-
|
|
9924
|
-
|
|
9982
|
+
const releaseSync = () => {
|
|
9983
|
+
try {
|
|
9984
|
+
unlinkSync(lockPath);
|
|
9985
|
+
} catch {}
|
|
9986
|
+
};
|
|
9987
|
+
const release = async () => {
|
|
9988
|
+
releaseSync();
|
|
9989
|
+
};
|
|
9990
|
+
heldLocks.set(buildDirectory, { count: 1, release, releaseSync });
|
|
9991
|
+
markHeldLock(buildDirectory);
|
|
9992
|
+
return async () => {
|
|
9993
|
+
const current = heldLocks.get(buildDirectory);
|
|
9994
|
+
if (!current)
|
|
9995
|
+
return;
|
|
9996
|
+
current.count -= 1;
|
|
9997
|
+
if (current.count > 0)
|
|
9998
|
+
return;
|
|
9999
|
+
heldLocks.delete(buildDirectory);
|
|
10000
|
+
unmarkHeldLock(buildDirectory);
|
|
10001
|
+
await current.release();
|
|
10002
|
+
};
|
|
10003
|
+
}, withBuildDirectoryLock = async (buildDirectory, action, options = {}) => {
|
|
10004
|
+
const release = await acquireBuildDirectoryLock(buildDirectory, options);
|
|
9925
10005
|
try {
|
|
9926
10006
|
return await action();
|
|
9927
10007
|
} finally {
|
|
@@ -9929,7 +10009,6 @@ var DEFAULT_LOCK_TIMEOUT_MS = 120000, DEFAULT_STALE_LOCK_MS, LOCK_POLL_MS = 250,
|
|
|
9929
10009
|
}
|
|
9930
10010
|
};
|
|
9931
10011
|
var init_buildDirectoryLock = __esm(() => {
|
|
9932
|
-
DEFAULT_STALE_LOCK_MS = 10 * 60000;
|
|
9933
10012
|
heldLocks = new Map;
|
|
9934
10013
|
});
|
|
9935
10014
|
|
|
@@ -10009,7 +10088,7 @@ __export(exports_compileSvelte, {
|
|
|
10009
10088
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
10010
10089
|
});
|
|
10011
10090
|
import { existsSync as existsSync15 } from "fs";
|
|
10012
|
-
import { mkdir as
|
|
10091
|
+
import { mkdir as mkdir3, stat as stat2 } from "fs/promises";
|
|
10013
10092
|
import {
|
|
10014
10093
|
dirname as dirname11,
|
|
10015
10094
|
join as join15,
|
|
@@ -10052,7 +10131,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10052
10131
|
return /\b__require\b/.test(stripped) ? code : stripped;
|
|
10053
10132
|
}, exists = async (path) => {
|
|
10054
10133
|
try {
|
|
10055
|
-
await
|
|
10134
|
+
await stat2(path);
|
|
10056
10135
|
return true;
|
|
10057
10136
|
} catch {
|
|
10058
10137
|
return false;
|
|
@@ -10120,7 +10199,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10120
10199
|
const clientDir = join15(generatedDir, "client");
|
|
10121
10200
|
const indexDir = join15(generatedDir, "indexes");
|
|
10122
10201
|
const serverDir = join15(generatedDir, "server");
|
|
10123
|
-
await Promise.all([clientDir, indexDir, serverDir].map((dir) =>
|
|
10202
|
+
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir3(dir, { recursive: true })));
|
|
10124
10203
|
const dev = env2.NODE_ENV !== "production";
|
|
10125
10204
|
const build2 = async (src) => {
|
|
10126
10205
|
const memoized = cache.get(src);
|
|
@@ -10226,8 +10305,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10226
10305
|
const ssrPath = join15(serverDir, relDir, `${baseName}.js`);
|
|
10227
10306
|
const clientPath = join15(clientDir, relDir, `${baseName}.js`);
|
|
10228
10307
|
await Promise.all([
|
|
10229
|
-
|
|
10230
|
-
|
|
10308
|
+
mkdir3(dirname11(ssrPath), { recursive: true }),
|
|
10309
|
+
mkdir3(dirname11(clientPath), { recursive: true })
|
|
10231
10310
|
]);
|
|
10232
10311
|
if (isModule) {
|
|
10233
10312
|
const bundle = rewriteExternalImports(generate("client"), "client");
|
|
@@ -10328,7 +10407,7 @@ if (typeof window !== "undefined") {
|
|
|
10328
10407
|
setTimeout(releaseStreamingSlots, 0);
|
|
10329
10408
|
}
|
|
10330
10409
|
}`;
|
|
10331
|
-
await
|
|
10410
|
+
await mkdir3(dirname11(indexPath), { recursive: true });
|
|
10332
10411
|
return write(indexPath, bootstrap);
|
|
10333
10412
|
}));
|
|
10334
10413
|
return {
|
|
@@ -10416,7 +10495,7 @@ __export(exports_compileVue, {
|
|
|
10416
10495
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
10417
10496
|
});
|
|
10418
10497
|
import { existsSync as existsSync16 } from "fs";
|
|
10419
|
-
import { mkdir as
|
|
10498
|
+
import { mkdir as mkdir4 } from "fs/promises";
|
|
10420
10499
|
import {
|
|
10421
10500
|
basename as basename6,
|
|
10422
10501
|
dirname as dirname12,
|
|
@@ -10597,7 +10676,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10597
10676
|
let cssOutputPaths = [];
|
|
10598
10677
|
if (isEntryPoint && allCss.length) {
|
|
10599
10678
|
const cssOutputFile = join16(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
10600
|
-
await
|
|
10679
|
+
await mkdir4(dirname12(cssOutputFile), { recursive: true });
|
|
10601
10680
|
await write2(cssOutputFile, allCss.join(`
|
|
10602
10681
|
`));
|
|
10603
10682
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -10648,8 +10727,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10648
10727
|
}
|
|
10649
10728
|
return result2;
|
|
10650
10729
|
};
|
|
10651
|
-
await
|
|
10652
|
-
await
|
|
10730
|
+
await mkdir4(dirname12(clientOutputPath), { recursive: true });
|
|
10731
|
+
await mkdir4(dirname12(serverOutputPath), { recursive: true });
|
|
10653
10732
|
await write2(clientOutputPath, rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client"));
|
|
10654
10733
|
await write2(serverOutputPath, rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server"));
|
|
10655
10734
|
const result = {
|
|
@@ -10674,10 +10753,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10674
10753
|
const serverOutputDir = join16(generatedDir, "server");
|
|
10675
10754
|
const cssOutputDir = join16(generatedDir, "compiled");
|
|
10676
10755
|
await Promise.all([
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10756
|
+
mkdir4(clientOutputDir, { recursive: true }),
|
|
10757
|
+
mkdir4(indexOutputDir, { recursive: true }),
|
|
10758
|
+
mkdir4(serverOutputDir, { recursive: true }),
|
|
10759
|
+
mkdir4(cssOutputDir, { recursive: true })
|
|
10681
10760
|
]);
|
|
10682
10761
|
const buildCache = new Map;
|
|
10683
10762
|
const allTsHelperPaths = new Set;
|
|
@@ -10691,7 +10770,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10691
10770
|
const entryBaseName = basename6(entryPath, ".vue");
|
|
10692
10771
|
const indexOutputFile = join16(indexOutputDir, `${entryBaseName}.js`);
|
|
10693
10772
|
const clientOutputFile = join16(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
10694
|
-
await
|
|
10773
|
+
await mkdir4(dirname12(indexOutputFile), { recursive: true });
|
|
10695
10774
|
const vueHmrImports = isDev2 ? [
|
|
10696
10775
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
10697
10776
|
`import "${hmrClientPath4}";`
|
|
@@ -10845,8 +10924,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10845
10924
|
const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
10846
10925
|
const outClientPath = join16(clientOutputDir, relativeJsPath);
|
|
10847
10926
|
const outServerPath = join16(serverOutputDir, relativeJsPath);
|
|
10848
|
-
await
|
|
10849
|
-
await
|
|
10927
|
+
await mkdir4(dirname12(outClientPath), { recursive: true });
|
|
10928
|
+
await mkdir4(dirname12(outServerPath), { recursive: true });
|
|
10850
10929
|
await write2(outClientPath, transpiledCode);
|
|
10851
10930
|
await write2(outServerPath, transpiledCode);
|
|
10852
10931
|
}));
|
|
@@ -11345,7 +11424,7 @@ __export(exports_compileAngular, {
|
|
|
11345
11424
|
compileAngularFile: () => compileAngularFile,
|
|
11346
11425
|
compileAngular: () => compileAngular
|
|
11347
11426
|
});
|
|
11348
|
-
import { existsSync as existsSync17, readFileSync as
|
|
11427
|
+
import { existsSync as existsSync17, readFileSync as readFileSync13, promises as fs } from "fs";
|
|
11349
11428
|
import { join as join17, basename as basename7, sep as sep3, dirname as dirname13, resolve as resolve19, relative as relative9 } from "path";
|
|
11350
11429
|
import ts2 from "typescript";
|
|
11351
11430
|
var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
@@ -11482,16 +11561,16 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11482
11561
|
return fromNodeModules;
|
|
11483
11562
|
return resolve19(import.meta.dir, "./dev/client");
|
|
11484
11563
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
11485
|
-
const
|
|
11486
|
-
const
|
|
11564
|
+
const entityClassRegex = /(?:export\s+)?class\s+(\w+(?:Component|Service|Directive|Pipe))\s/g;
|
|
11565
|
+
const entityNames = [];
|
|
11487
11566
|
let match;
|
|
11488
|
-
while ((match =
|
|
11567
|
+
while ((match = entityClassRegex.exec(content)) !== null) {
|
|
11489
11568
|
if (match[1])
|
|
11490
|
-
|
|
11569
|
+
entityNames.push(match[1]);
|
|
11491
11570
|
}
|
|
11492
|
-
if (
|
|
11571
|
+
if (entityNames.length === 0)
|
|
11493
11572
|
return content;
|
|
11494
|
-
const registrations =
|
|
11573
|
+
const registrations = entityNames.map((name) => ` if (typeof ${name} === 'function') window.__ANGULAR_HMR__.register('${sourceId}#${name}', ${name});`).join(`
|
|
11495
11574
|
`);
|
|
11496
11575
|
const hmrBlock = `
|
|
11497
11576
|
// Angular HMR Runtime Layer (Level 3) \u2014 Auto-registration
|
|
@@ -11700,7 +11779,7 @@ ${registrations}
|
|
|
11700
11779
|
const outputPath = resolve19(join17(outDir, relative9(process.cwd(), resolve19(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
11701
11780
|
return [
|
|
11702
11781
|
outputPath,
|
|
11703
|
-
buildIslandMetadataExports(
|
|
11782
|
+
buildIslandMetadataExports(readFileSync13(inputPath, "utf-8"))
|
|
11704
11783
|
];
|
|
11705
11784
|
})), { entries: inputPaths.length });
|
|
11706
11785
|
await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
|
|
@@ -12009,7 +12088,7 @@ ${fields}
|
|
|
12009
12088
|
if (!existsSync17(templatePath)) {
|
|
12010
12089
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
12011
12090
|
}
|
|
12012
|
-
const templateRaw2 =
|
|
12091
|
+
const templateRaw2 = readFileSync13(templatePath, "utf-8");
|
|
12013
12092
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
12014
12093
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
12015
12094
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -12987,7 +13066,7 @@ __export(exports_compileEmber, {
|
|
|
12987
13066
|
basename: () => basename8
|
|
12988
13067
|
});
|
|
12989
13068
|
import { existsSync as existsSync18 } from "fs";
|
|
12990
|
-
import { mkdir as
|
|
13069
|
+
import { mkdir as mkdir5, rm as rm4 } from "fs/promises";
|
|
12991
13070
|
import { basename as basename8, dirname as dirname14, extname as extname6, join as join18, resolve as resolve20 } from "path";
|
|
12992
13071
|
var {build: bunBuild2, Transpiler: Transpiler3, write: write3, file: file4 } = globalThis.Bun;
|
|
12993
13072
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
@@ -13159,9 +13238,9 @@ export default PageComponent;
|
|
|
13159
13238
|
const serverDir = join18(compiledRoot, "server");
|
|
13160
13239
|
const clientDir = join18(compiledRoot, "client");
|
|
13161
13240
|
await Promise.all([
|
|
13162
|
-
|
|
13163
|
-
|
|
13164
|
-
|
|
13241
|
+
mkdir5(tmpDir, { recursive: true }),
|
|
13242
|
+
mkdir5(serverDir, { recursive: true }),
|
|
13243
|
+
mkdir5(clientDir, { recursive: true })
|
|
13165
13244
|
]);
|
|
13166
13245
|
const tmpPagePath = resolve20(join18(tmpDir, `${baseName}.module.js`));
|
|
13167
13246
|
const tmpHarnessPath = resolve20(join18(tmpDir, `${baseName}.harness.js`));
|
|
@@ -13188,7 +13267,7 @@ export default PageComponent;
|
|
|
13188
13267
|
if (!buildResult.success) {
|
|
13189
13268
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
13190
13269
|
}
|
|
13191
|
-
await
|
|
13270
|
+
await rm4(tmpDir, { force: true, recursive: true });
|
|
13192
13271
|
const clientPath = join18(clientDir, `${baseName}.js`);
|
|
13193
13272
|
await write3(clientPath, transpiled);
|
|
13194
13273
|
return { clientPath, serverPath };
|
|
@@ -13237,9 +13316,9 @@ __export(exports_buildReactVendor, {
|
|
|
13237
13316
|
computeVendorPaths: () => computeVendorPaths,
|
|
13238
13317
|
buildReactVendor: () => buildReactVendor
|
|
13239
13318
|
});
|
|
13240
|
-
import { existsSync as existsSync19, mkdirSync as
|
|
13319
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync7 } from "fs";
|
|
13241
13320
|
import { join as join19, resolve as resolve21 } from "path";
|
|
13242
|
-
import { rm as
|
|
13321
|
+
import { rm as rm5 } from "fs/promises";
|
|
13243
13322
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
13244
13323
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
13245
13324
|
const candidates = [
|
|
@@ -13293,9 +13372,9 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
13293
13372
|
`;
|
|
13294
13373
|
}, buildReactVendor = async (buildDir) => {
|
|
13295
13374
|
const vendorDir = join19(buildDir, "react", "vendor");
|
|
13296
|
-
|
|
13375
|
+
mkdirSync7(vendorDir, { recursive: true });
|
|
13297
13376
|
const tmpDir = join19(buildDir, "_vendor_tmp");
|
|
13298
|
-
|
|
13377
|
+
mkdirSync7(tmpDir, { recursive: true });
|
|
13299
13378
|
const specifiers = resolveVendorSpecifiers();
|
|
13300
13379
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13301
13380
|
const safeName = toSafeFileName(specifier);
|
|
@@ -13314,7 +13393,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
13314
13393
|
target: "browser",
|
|
13315
13394
|
throw: false
|
|
13316
13395
|
});
|
|
13317
|
-
await
|
|
13396
|
+
await rm5(tmpDir, { force: true, recursive: true });
|
|
13318
13397
|
if (!result.success) {
|
|
13319
13398
|
console.warn("\u26A0\uFE0F React vendor build had errors:", result.logs);
|
|
13320
13399
|
}
|
|
@@ -13363,9 +13442,9 @@ __export(exports_buildAngularVendor, {
|
|
|
13363
13442
|
buildAngularVendor: () => buildAngularVendor,
|
|
13364
13443
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
13365
13444
|
});
|
|
13366
|
-
import { mkdirSync as
|
|
13445
|
+
import { mkdirSync as mkdirSync8 } from "fs";
|
|
13367
13446
|
import { join as join20 } from "path";
|
|
13368
|
-
import { rm as
|
|
13447
|
+
import { rm as rm6 } from "fs/promises";
|
|
13369
13448
|
var {build: bunBuild4, Glob: Glob6 } = globalThis.Bun;
|
|
13370
13449
|
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) => {
|
|
13371
13450
|
try {
|
|
@@ -13401,7 +13480,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13401
13480
|
}
|
|
13402
13481
|
return { angular, transitiveRoots };
|
|
13403
13482
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
13404
|
-
const { readFileSync:
|
|
13483
|
+
const { readFileSync: readFileSync14 } = await import("fs");
|
|
13405
13484
|
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
13406
13485
|
const visited = new Set;
|
|
13407
13486
|
const frontier = [];
|
|
@@ -13422,7 +13501,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13422
13501
|
}
|
|
13423
13502
|
let content;
|
|
13424
13503
|
try {
|
|
13425
|
-
content =
|
|
13504
|
+
content = readFileSync14(resolved, "utf-8");
|
|
13426
13505
|
} catch {
|
|
13427
13506
|
continue;
|
|
13428
13507
|
}
|
|
@@ -13462,9 +13541,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13462
13541
|
return Array.from(angular).filter(isResolvable2);
|
|
13463
13542
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
13464
13543
|
const vendorDir = join20(buildDir, "angular", "vendor");
|
|
13465
|
-
|
|
13544
|
+
mkdirSync8(vendorDir, { recursive: true });
|
|
13466
13545
|
const tmpDir = join20(buildDir, "_angular_vendor_tmp");
|
|
13467
|
-
|
|
13546
|
+
mkdirSync8(tmpDir, { recursive: true });
|
|
13468
13547
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13469
13548
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13470
13549
|
const safeName = toSafeFileName2(specifier);
|
|
@@ -13484,7 +13563,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13484
13563
|
target: "browser",
|
|
13485
13564
|
throw: false
|
|
13486
13565
|
});
|
|
13487
|
-
await
|
|
13566
|
+
await rm6(tmpDir, { force: true, recursive: true });
|
|
13488
13567
|
if (!result.success) {
|
|
13489
13568
|
console.warn("\u26A0\uFE0F Angular vendor build had errors:", result.logs);
|
|
13490
13569
|
}
|
|
@@ -13500,9 +13579,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13500
13579
|
return computeAngularVendorPaths(specifiers);
|
|
13501
13580
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
13502
13581
|
const vendorDir = join20(buildDir, "angular", "vendor", "server");
|
|
13503
|
-
|
|
13582
|
+
mkdirSync8(vendorDir, { recursive: true });
|
|
13504
13583
|
const tmpDir = join20(buildDir, "_angular_server_vendor_tmp");
|
|
13505
|
-
|
|
13584
|
+
mkdirSync8(tmpDir, { recursive: true });
|
|
13506
13585
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
13507
13586
|
const allSpecs = new Set(browserSpecs);
|
|
13508
13587
|
for (const spec of SERVER_ONLY_ANGULAR_SPECIFIERS) {
|
|
@@ -13527,7 +13606,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
13527
13606
|
target: "bun",
|
|
13528
13607
|
throw: false
|
|
13529
13608
|
});
|
|
13530
|
-
await
|
|
13609
|
+
await rm6(tmpDir, { force: true, recursive: true });
|
|
13531
13610
|
if (!result.success) {
|
|
13532
13611
|
console.warn("\u26A0\uFE0F Angular server vendor build had errors:", result.logs);
|
|
13533
13612
|
}
|
|
@@ -13591,15 +13670,15 @@ __export(exports_buildVueVendor, {
|
|
|
13591
13670
|
computeVueVendorPaths: () => computeVueVendorPaths,
|
|
13592
13671
|
buildVueVendor: () => buildVueVendor
|
|
13593
13672
|
});
|
|
13594
|
-
import { mkdirSync as
|
|
13673
|
+
import { mkdirSync as mkdirSync9 } from "fs";
|
|
13595
13674
|
import { join as join21 } from "path";
|
|
13596
|
-
import { rm as
|
|
13675
|
+
import { rm as rm7 } from "fs/promises";
|
|
13597
13676
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
13598
13677
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
13599
13678
|
const vendorDir = join21(buildDir, "vue", "vendor");
|
|
13600
|
-
|
|
13679
|
+
mkdirSync9(vendorDir, { recursive: true });
|
|
13601
13680
|
const tmpDir = join21(buildDir, "_vue_vendor_tmp");
|
|
13602
|
-
|
|
13681
|
+
mkdirSync9(tmpDir, { recursive: true });
|
|
13603
13682
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
13604
13683
|
const safeName = toSafeFileName3(specifier);
|
|
13605
13684
|
const entryPath = join21(tmpDir, `${safeName}.ts`);
|
|
@@ -13622,22 +13701,22 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
13622
13701
|
target: "browser",
|
|
13623
13702
|
throw: false
|
|
13624
13703
|
});
|
|
13625
|
-
await
|
|
13704
|
+
await rm7(tmpDir, { force: true, recursive: true });
|
|
13626
13705
|
if (!result.success) {
|
|
13627
13706
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
13628
13707
|
return;
|
|
13629
13708
|
}
|
|
13630
|
-
const { readFileSync:
|
|
13709
|
+
const { readFileSync: readFileSync14, writeFileSync: writeFileSync8, readdirSync } = await import("fs");
|
|
13631
13710
|
const files = readdirSync(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
13632
13711
|
for (const file5 of files) {
|
|
13633
13712
|
const filePath = join21(vendorDir, file5);
|
|
13634
|
-
const content =
|
|
13713
|
+
const content = readFileSync14(filePath, "utf-8");
|
|
13635
13714
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
13636
13715
|
continue;
|
|
13637
13716
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
13638
13717
|
if (patched === content)
|
|
13639
13718
|
continue;
|
|
13640
|
-
|
|
13719
|
+
writeFileSync8(filePath, patched);
|
|
13641
13720
|
}
|
|
13642
13721
|
}, computeVueVendorPaths = () => {
|
|
13643
13722
|
const paths = {};
|
|
@@ -13656,9 +13735,9 @@ __export(exports_buildSvelteVendor, {
|
|
|
13656
13735
|
computeSvelteVendorPaths: () => computeSvelteVendorPaths,
|
|
13657
13736
|
buildSvelteVendor: () => buildSvelteVendor
|
|
13658
13737
|
});
|
|
13659
|
-
import { mkdirSync as
|
|
13738
|
+
import { mkdirSync as mkdirSync10 } from "fs";
|
|
13660
13739
|
import { join as join22 } from "path";
|
|
13661
|
-
import { rm as
|
|
13740
|
+
import { rm as rm8 } from "fs/promises";
|
|
13662
13741
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
13663
13742
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
13664
13743
|
try {
|
|
@@ -13672,9 +13751,9 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
13672
13751
|
if (specifiers.length === 0)
|
|
13673
13752
|
return;
|
|
13674
13753
|
const vendorDir = join22(buildDir, "svelte", "vendor");
|
|
13675
|
-
|
|
13754
|
+
mkdirSync10(vendorDir, { recursive: true });
|
|
13676
13755
|
const tmpDir = join22(buildDir, "_svelte_vendor_tmp");
|
|
13677
|
-
|
|
13756
|
+
mkdirSync10(tmpDir, { recursive: true });
|
|
13678
13757
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
13679
13758
|
const safeName = toSafeFileName4(specifier);
|
|
13680
13759
|
const entryPath = join22(tmpDir, `${safeName}.ts`);
|
|
@@ -13692,7 +13771,7 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
13692
13771
|
target: "browser",
|
|
13693
13772
|
throw: false
|
|
13694
13773
|
});
|
|
13695
|
-
await
|
|
13774
|
+
await rm8(tmpDir, { force: true, recursive: true });
|
|
13696
13775
|
if (!result.success) {
|
|
13697
13776
|
console.warn("\u26A0\uFE0F Svelte vendor build had errors:", result.logs);
|
|
13698
13777
|
}
|
|
@@ -13715,12 +13794,19 @@ var init_buildSvelteVendor = __esm(() => {
|
|
|
13715
13794
|
];
|
|
13716
13795
|
});
|
|
13717
13796
|
|
|
13718
|
-
// src/build/
|
|
13719
|
-
var
|
|
13720
|
-
__export(
|
|
13797
|
+
// src/build/rewriteImportsPlugin.ts
|
|
13798
|
+
var exports_rewriteImportsPlugin = {};
|
|
13799
|
+
__export(exports_rewriteImportsPlugin, {
|
|
13721
13800
|
rewriteVendorDirectories: () => rewriteVendorDirectories,
|
|
13722
|
-
|
|
13801
|
+
rewriteImportsInContent: () => rewriteImportsInContent,
|
|
13802
|
+
rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
|
|
13803
|
+
rewriteBuildOutputs: () => rewriteBuildOutputs,
|
|
13804
|
+
jsRewriteImports: () => jsRewriteImports,
|
|
13805
|
+
fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
|
|
13806
|
+
buildWithImportRewrite: () => buildWithImportRewrite
|
|
13723
13807
|
});
|
|
13808
|
+
import { readdir as readdir3 } from "fs/promises";
|
|
13809
|
+
import { join as join23 } from "path";
|
|
13724
13810
|
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
13725
13811
|
let result = content;
|
|
13726
13812
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -13733,90 +13819,157 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
|
|
|
13733
13819
|
result = result.replace(dynamicRegex, `$1${webPath}$2`);
|
|
13734
13820
|
}
|
|
13735
13821
|
return result;
|
|
13736
|
-
},
|
|
13737
|
-
|
|
13738
|
-
|
|
13739
|
-
return;
|
|
13822
|
+
}, rewriteImportsInContent = (content, vendorPaths) => {
|
|
13823
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
13824
|
+
return content;
|
|
13740
13825
|
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
|
|
13745
|
-
|
|
13746
|
-
|
|
13826
|
+
const native = nativeRewriteImports(content, replacements);
|
|
13827
|
+
return native ?? jsRewriteImports(content, replacements);
|
|
13828
|
+
}, fixMissingReExportNamespacesInContent = (content) => {
|
|
13829
|
+
const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
|
|
13830
|
+
REEXPORT_PATTERN.lastIndex = 0;
|
|
13831
|
+
const missing = [];
|
|
13832
|
+
let match;
|
|
13833
|
+
while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
|
|
13834
|
+
const ident = match[1];
|
|
13835
|
+
if (!ident)
|
|
13836
|
+
continue;
|
|
13837
|
+
const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
|
|
13838
|
+
if (nsImportRe.test(content))
|
|
13839
|
+
continue;
|
|
13840
|
+
const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
|
|
13841
|
+
if (declRe.test(content))
|
|
13842
|
+
continue;
|
|
13843
|
+
const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
|
|
13844
|
+
if (namedImportRe.test(content))
|
|
13845
|
+
continue;
|
|
13846
|
+
const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
|
|
13847
|
+
let pathMatch;
|
|
13848
|
+
let sourcePath;
|
|
13849
|
+
while ((pathMatch = importPathRe.exec(content)) !== null) {
|
|
13850
|
+
const p2 = pathMatch[1];
|
|
13851
|
+
if (!p2)
|
|
13852
|
+
continue;
|
|
13853
|
+
const base = p2.split("/").pop()?.replace(/\.[mc]?js$/, "");
|
|
13854
|
+
if (!base)
|
|
13855
|
+
continue;
|
|
13856
|
+
const normalized = base.startsWith("_") ? base.slice(1) : base;
|
|
13857
|
+
if (normalized === ident || normalized.endsWith(`_${ident}`)) {
|
|
13858
|
+
sourcePath = p2;
|
|
13859
|
+
break;
|
|
13860
|
+
}
|
|
13861
|
+
}
|
|
13862
|
+
if (sourcePath)
|
|
13863
|
+
missing.push({ ident, path: sourcePath });
|
|
13864
|
+
}
|
|
13865
|
+
if (missing.length === 0)
|
|
13866
|
+
return content;
|
|
13867
|
+
const seen = new Set;
|
|
13868
|
+
const unique = missing.filter((entry) => {
|
|
13869
|
+
if (seen.has(entry.ident))
|
|
13870
|
+
return false;
|
|
13871
|
+
seen.add(entry.ident);
|
|
13872
|
+
return true;
|
|
13873
|
+
});
|
|
13874
|
+
const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
|
|
13875
|
+
`);
|
|
13876
|
+
return `${inserts}
|
|
13877
|
+
${content}`;
|
|
13878
|
+
}, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
|
|
13879
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
13880
|
+
return;
|
|
13881
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
13882
|
+
let original;
|
|
13883
|
+
try {
|
|
13884
|
+
original = await artifact.text();
|
|
13885
|
+
} catch (err) {
|
|
13886
|
+
const code = err.code;
|
|
13887
|
+
if (code === "ENOENT")
|
|
13888
|
+
return;
|
|
13889
|
+
throw err;
|
|
13890
|
+
}
|
|
13891
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
13892
|
+
if (rewritten === original)
|
|
13893
|
+
return;
|
|
13894
|
+
try {
|
|
13895
|
+
await Bun.write(artifact.path, rewritten);
|
|
13896
|
+
} catch (err) {
|
|
13897
|
+
const code = err.code;
|
|
13898
|
+
if (code === "ENOENT")
|
|
13899
|
+
return;
|
|
13900
|
+
throw err;
|
|
13901
|
+
}
|
|
13902
|
+
}));
|
|
13903
|
+
}, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
|
|
13904
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
13905
|
+
const vendorPaths = resolveVendorPaths(artifact);
|
|
13906
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
13907
|
+
return;
|
|
13908
|
+
let original;
|
|
13909
|
+
try {
|
|
13910
|
+
original = await artifact.text();
|
|
13911
|
+
} catch (err) {
|
|
13912
|
+
const code = err.code;
|
|
13913
|
+
if (code === "ENOENT")
|
|
13914
|
+
return;
|
|
13915
|
+
throw err;
|
|
13916
|
+
}
|
|
13917
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
13918
|
+
if (rewritten === original)
|
|
13919
|
+
return;
|
|
13920
|
+
try {
|
|
13921
|
+
await Bun.write(artifact.path, rewritten);
|
|
13922
|
+
} catch (err) {
|
|
13923
|
+
const code = err.code;
|
|
13924
|
+
if (code === "ENOENT")
|
|
13925
|
+
return;
|
|
13926
|
+
throw err;
|
|
13747
13927
|
}
|
|
13748
13928
|
}));
|
|
13749
13929
|
}, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
|
|
13750
13930
|
if (Object.keys(vendorPaths).length === 0)
|
|
13751
13931
|
return;
|
|
13752
|
-
const { readdirSync } = await import("fs");
|
|
13753
|
-
const { join: join23 } = await import("path");
|
|
13754
13932
|
const allFiles = [];
|
|
13755
13933
|
for (const dir of vendorDirs) {
|
|
13756
13934
|
try {
|
|
13757
|
-
const
|
|
13758
|
-
|
|
13935
|
+
const entries = await readdir3(dir);
|
|
13936
|
+
for (const entry of entries) {
|
|
13937
|
+
if (entry.endsWith(".js"))
|
|
13938
|
+
allFiles.push(join23(dir, entry));
|
|
13939
|
+
}
|
|
13759
13940
|
} catch {}
|
|
13760
13941
|
}
|
|
13761
|
-
await
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
|
|
13771
|
-
const ident = match[1];
|
|
13772
|
-
if (!ident)
|
|
13773
|
-
continue;
|
|
13774
|
-
const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
|
|
13775
|
-
if (nsImportRe.test(content))
|
|
13776
|
-
continue;
|
|
13777
|
-
const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
|
|
13778
|
-
if (declRe.test(content))
|
|
13779
|
-
continue;
|
|
13780
|
-
const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
|
|
13781
|
-
if (namedImportRe.test(content))
|
|
13782
|
-
continue;
|
|
13783
|
-
const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
|
|
13784
|
-
let pathMatch;
|
|
13785
|
-
let sourcePath;
|
|
13786
|
-
while ((pathMatch = importPathRe.exec(content)) !== null) {
|
|
13787
|
-
const p2 = pathMatch[1];
|
|
13788
|
-
if (!p2)
|
|
13789
|
-
continue;
|
|
13790
|
-
const base = p2.split("/").pop()?.replace(/\.[mc]?js$/, "");
|
|
13791
|
-
if (!base)
|
|
13792
|
-
continue;
|
|
13793
|
-
const normalized = base.startsWith("_") ? base.slice(1) : base;
|
|
13794
|
-
if (normalized === ident || normalized.endsWith(`_${ident}`)) {
|
|
13795
|
-
sourcePath = p2;
|
|
13796
|
-
break;
|
|
13797
|
-
}
|
|
13798
|
-
}
|
|
13799
|
-
if (sourcePath) {
|
|
13800
|
-
missing.push({ ident, path: sourcePath });
|
|
13801
|
-
}
|
|
13942
|
+
await Promise.all(allFiles.map(async (filePath) => {
|
|
13943
|
+
let original;
|
|
13944
|
+
try {
|
|
13945
|
+
original = await Bun.file(filePath).text();
|
|
13946
|
+
} catch (err) {
|
|
13947
|
+
const code = err.code;
|
|
13948
|
+
if (code === "ENOENT")
|
|
13949
|
+
return;
|
|
13950
|
+
throw err;
|
|
13802
13951
|
}
|
|
13803
|
-
|
|
13952
|
+
let next = rewriteImportsInContent(original, vendorPaths);
|
|
13953
|
+
next = fixMissingReExportNamespacesInContent(next);
|
|
13954
|
+
if (next === original)
|
|
13804
13955
|
return;
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
`);
|
|
13814
|
-
const patched = `${inserts}
|
|
13815
|
-
${content}`;
|
|
13816
|
-
await Bun.write(filePath, patched);
|
|
13956
|
+
try {
|
|
13957
|
+
await Bun.write(filePath, next);
|
|
13958
|
+
} catch (err) {
|
|
13959
|
+
const code = err.code;
|
|
13960
|
+
if (code === "ENOENT")
|
|
13961
|
+
return;
|
|
13962
|
+
throw err;
|
|
13963
|
+
}
|
|
13817
13964
|
}));
|
|
13965
|
+
}, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
|
|
13966
|
+
const result = await pendingBuild;
|
|
13967
|
+
if (result.outputs.length > 0) {
|
|
13968
|
+
await rewriteBuildOutputs(result.outputs, vendorPaths);
|
|
13969
|
+
}
|
|
13970
|
+
return result;
|
|
13818
13971
|
};
|
|
13819
|
-
var
|
|
13972
|
+
var init_rewriteImportsPlugin = __esm(() => {
|
|
13820
13973
|
init_nativeRewrite();
|
|
13821
13974
|
});
|
|
13822
13975
|
|
|
@@ -13825,13 +13978,13 @@ import {
|
|
|
13825
13978
|
copyFileSync,
|
|
13826
13979
|
cpSync,
|
|
13827
13980
|
existsSync as existsSync20,
|
|
13828
|
-
mkdirSync as
|
|
13829
|
-
readFileSync as
|
|
13981
|
+
mkdirSync as mkdirSync11,
|
|
13982
|
+
readFileSync as readFileSync14,
|
|
13830
13983
|
rmSync as rmSync2,
|
|
13831
13984
|
statSync,
|
|
13832
|
-
writeFileSync as
|
|
13985
|
+
writeFileSync as writeFileSync8
|
|
13833
13986
|
} from "fs";
|
|
13834
|
-
import { basename as basename9, dirname as dirname15, extname as extname7, join as
|
|
13987
|
+
import { basename as basename9, dirname as dirname15, extname as extname7, join as join24, relative as relative10, resolve as resolve22 } from "path";
|
|
13835
13988
|
import { cwd, env as env3, exit } from "process";
|
|
13836
13989
|
var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
|
|
13837
13990
|
var isDev2, isBuildTraceEnabled = () => {
|
|
@@ -13906,11 +14059,11 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13906
14059
|
throw err;
|
|
13907
14060
|
exit(1);
|
|
13908
14061
|
}, copyHtmxVendor = (htmxDir, htmxDestDir) => {
|
|
13909
|
-
|
|
14062
|
+
mkdirSync11(htmxDestDir, { recursive: true });
|
|
13910
14063
|
const glob = new Glob7("htmx*.min.js");
|
|
13911
14064
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
13912
|
-
const src =
|
|
13913
|
-
const dest =
|
|
14065
|
+
const src = join24(htmxDir, relPath);
|
|
14066
|
+
const dest = join24(htmxDestDir, "htmx.min.js");
|
|
13914
14067
|
copyFileSync(src, dest);
|
|
13915
14068
|
return;
|
|
13916
14069
|
}
|
|
@@ -13954,7 +14107,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13954
14107
|
addWorkerPathIfExists(file5, relPath, workerPaths);
|
|
13955
14108
|
}
|
|
13956
14109
|
}, collectWorkerPathsFromFile = (file5, patterns, workerPaths) => {
|
|
13957
|
-
const content =
|
|
14110
|
+
const content = readFileSync14(file5, "utf-8");
|
|
13958
14111
|
for (const pattern of patterns) {
|
|
13959
14112
|
collectWorkerPathsFromContent(content, pattern, file5, workerPaths);
|
|
13960
14113
|
}
|
|
@@ -13985,8 +14138,8 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13985
14138
|
vuePagesPath
|
|
13986
14139
|
}) => {
|
|
13987
14140
|
const { readdirSync: readDir } = await import("fs");
|
|
13988
|
-
const devIndexDir =
|
|
13989
|
-
|
|
14141
|
+
const devIndexDir = join24(buildPath, "_src_indexes");
|
|
14142
|
+
mkdirSync11(devIndexDir, { recursive: true });
|
|
13990
14143
|
if (reactIndexesPath && reactPagesPath) {
|
|
13991
14144
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
13992
14145
|
}
|
|
@@ -14003,35 +14156,35 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14003
14156
|
const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
|
|
14004
14157
|
const pagesRel = relative10(process.cwd(), resolve22(reactPagesPath)).replace(/\\/g, "/");
|
|
14005
14158
|
for (const file5 of indexFiles) {
|
|
14006
|
-
let content =
|
|
14159
|
+
let content = readFileSync14(join24(reactIndexesPath, file5), "utf-8");
|
|
14007
14160
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
14008
|
-
|
|
14161
|
+
writeFileSync8(join24(devIndexDir, file5), content);
|
|
14009
14162
|
}
|
|
14010
14163
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
14011
|
-
const svelteIndexDir =
|
|
14164
|
+
const svelteIndexDir = join24(svelteDir, "generated", "indexes");
|
|
14012
14165
|
const sveltePageEntries = svelteEntries.filter((file5) => resolve22(file5).startsWith(resolve22(sveltePagesPath)));
|
|
14013
14166
|
for (const entry of sveltePageEntries) {
|
|
14014
14167
|
const name = basename9(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
14015
|
-
const indexFile =
|
|
14168
|
+
const indexFile = join24(svelteIndexDir, "pages", `${name}.js`);
|
|
14016
14169
|
if (!existsSync20(indexFile))
|
|
14017
14170
|
continue;
|
|
14018
|
-
let content =
|
|
14171
|
+
let content = readFileSync14(indexFile, "utf-8");
|
|
14019
14172
|
const srcRel = relative10(process.cwd(), resolve22(entry)).replace(/\\/g, "/");
|
|
14020
14173
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
14021
|
-
|
|
14174
|
+
writeFileSync8(join24(devIndexDir, `${name}.svelte.js`), content);
|
|
14022
14175
|
}
|
|
14023
14176
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
14024
|
-
const vueIndexDir =
|
|
14177
|
+
const vueIndexDir = join24(vueDir, "generated", "indexes");
|
|
14025
14178
|
const vuePageEntries = vueEntries.filter((file5) => resolve22(file5).startsWith(resolve22(vuePagesPath)));
|
|
14026
14179
|
for (const entry of vuePageEntries) {
|
|
14027
14180
|
const name = basename9(entry, ".vue");
|
|
14028
|
-
const indexFile =
|
|
14181
|
+
const indexFile = join24(vueIndexDir, `${name}.js`);
|
|
14029
14182
|
if (!existsSync20(indexFile))
|
|
14030
14183
|
continue;
|
|
14031
|
-
let content =
|
|
14184
|
+
let content = readFileSync14(indexFile, "utf-8");
|
|
14032
14185
|
const srcRel = relative10(process.cwd(), resolve22(entry)).replace(/\\/g, "/");
|
|
14033
14186
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
14034
|
-
|
|
14187
|
+
writeFileSync8(join24(devIndexDir, `${name}.vue.js`), content);
|
|
14035
14188
|
}
|
|
14036
14189
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
14037
14190
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -14079,7 +14232,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14079
14232
|
}
|
|
14080
14233
|
return result;
|
|
14081
14234
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
14082
|
-
let content =
|
|
14235
|
+
let content = readFileSync14(outputPath, "utf-8");
|
|
14083
14236
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
14084
14237
|
const useNames = [];
|
|
14085
14238
|
let match;
|
|
@@ -14100,7 +14253,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14100
14253
|
content = `${content.slice(0, firstUseIdx) + runtime}
|
|
14101
14254
|
${content.slice(firstUseIdx)}`;
|
|
14102
14255
|
content = wrapUseFunctions(content, useNames);
|
|
14103
|
-
|
|
14256
|
+
writeFileSync8(outputPath, content);
|
|
14104
14257
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
14105
14258
|
const urlFileMap = new Map;
|
|
14106
14259
|
for (const srcPath of urlReferencedFiles) {
|
|
@@ -14129,7 +14282,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14129
14282
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
14130
14283
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
14131
14284
|
for (const outputPath of outputPaths) {
|
|
14132
|
-
let content =
|
|
14285
|
+
let content = readFileSync14(outputPath, "utf-8");
|
|
14133
14286
|
let changed = false;
|
|
14134
14287
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
14135
14288
|
const targetName = basename9(relPath);
|
|
@@ -14140,7 +14293,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14140
14293
|
return `new URL('${resolvedPath}', import.meta.url)`;
|
|
14141
14294
|
});
|
|
14142
14295
|
if (changed)
|
|
14143
|
-
|
|
14296
|
+
writeFileSync8(outputPath, content);
|
|
14144
14297
|
}
|
|
14145
14298
|
}, vueFeatureFlags, bunBuildPassKeys, bunBuildPassKeySet, reservedBunBuildConfigKeys, passLockedKeys, isObject2 = (value) => typeof value === "object" && value !== null, isBunBuildPassConfig = (config) => isObject2(config) && Object.keys(config).some((key) => bunBuildPassKeySet.has(key)), sanitizeBunBuildOverride = (override, extraReservedKeys = new Set) => {
|
|
14146
14299
|
if (!override)
|
|
@@ -14253,10 +14406,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14253
14406
|
restoreTracePhase();
|
|
14254
14407
|
return;
|
|
14255
14408
|
}
|
|
14256
|
-
const traceDir =
|
|
14409
|
+
const traceDir = join24(buildPath2, ".absolute-trace");
|
|
14257
14410
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
14258
|
-
|
|
14259
|
-
|
|
14411
|
+
mkdirSync11(traceDir, { recursive: true });
|
|
14412
|
+
writeFileSync8(join24(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
14260
14413
|
events: traceEvents,
|
|
14261
14414
|
frameworks: traceFrameworkNames,
|
|
14262
14415
|
generatedAt: new Date().toISOString(),
|
|
@@ -14287,15 +14440,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14287
14440
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
14288
14441
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
14289
14442
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
14290
|
-
const reactIndexesPath = reactDir &&
|
|
14291
|
-
const reactPagesPath = reactDir &&
|
|
14292
|
-
const htmlPagesPath = htmlDir &&
|
|
14293
|
-
const htmlScriptsPath = htmlDir &&
|
|
14294
|
-
const sveltePagesPath = svelteDir &&
|
|
14295
|
-
const vuePagesPath = vueDir &&
|
|
14296
|
-
const htmxPagesPath = htmxDir &&
|
|
14297
|
-
const angularPagesPath = angularDir &&
|
|
14298
|
-
const emberPagesPath = emberDir &&
|
|
14443
|
+
const reactIndexesPath = reactDir && join24(reactDir, "generated", "indexes");
|
|
14444
|
+
const reactPagesPath = reactDir && join24(reactDir, "pages");
|
|
14445
|
+
const htmlPagesPath = htmlDir && join24(htmlDir, "pages");
|
|
14446
|
+
const htmlScriptsPath = htmlDir && join24(htmlDir, "scripts");
|
|
14447
|
+
const sveltePagesPath = svelteDir && join24(svelteDir, "pages");
|
|
14448
|
+
const vuePagesPath = vueDir && join24(vueDir, "pages");
|
|
14449
|
+
const htmxPagesPath = htmxDir && join24(htmxDir, "pages");
|
|
14450
|
+
const angularPagesPath = angularDir && join24(angularDir, "pages");
|
|
14451
|
+
const emberPagesPath = emberDir && join24(emberDir, "pages");
|
|
14299
14452
|
const frontends = [
|
|
14300
14453
|
reactDir,
|
|
14301
14454
|
htmlDir,
|
|
@@ -14335,12 +14488,12 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14335
14488
|
if (svelteDir)
|
|
14336
14489
|
serverDirMap.push({
|
|
14337
14490
|
dir: svelteDir,
|
|
14338
|
-
subdir:
|
|
14491
|
+
subdir: join24("generated", "server")
|
|
14339
14492
|
});
|
|
14340
14493
|
if (vueDir)
|
|
14341
14494
|
serverDirMap.push({
|
|
14342
14495
|
dir: vueDir,
|
|
14343
|
-
subdir:
|
|
14496
|
+
subdir: join24("generated", "server")
|
|
14344
14497
|
});
|
|
14345
14498
|
if (angularDir)
|
|
14346
14499
|
serverDirMap.push({ dir: angularDir, subdir: "generated" });
|
|
@@ -14350,14 +14503,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14350
14503
|
const [firstEntry] = serverDirMap;
|
|
14351
14504
|
if (!firstEntry)
|
|
14352
14505
|
throw new Error("Expected at least one server directory entry");
|
|
14353
|
-
serverRoot =
|
|
14354
|
-
serverOutDir =
|
|
14506
|
+
serverRoot = join24(firstEntry.dir, firstEntry.subdir);
|
|
14507
|
+
serverOutDir = join24(buildPath, basename9(firstEntry.dir));
|
|
14355
14508
|
} else if (serverDirMap.length > 1) {
|
|
14356
14509
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
14357
14510
|
serverOutDir = buildPath;
|
|
14358
14511
|
}
|
|
14359
14512
|
const publicPath = publicDirectory && validateSafePath(publicDirectory, projectRoot);
|
|
14360
|
-
await tracePhase("build-dir/create", () =>
|
|
14513
|
+
await tracePhase("build-dir/create", () => mkdirSync11(buildPath, { recursive: true }));
|
|
14361
14514
|
if (publicPath)
|
|
14362
14515
|
await tracePhase("public/copy", () => cpSync(publicPath, buildPath, { force: true, recursive: true }));
|
|
14363
14516
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
@@ -14379,7 +14532,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14379
14532
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
14380
14533
|
}
|
|
14381
14534
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
14382
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
14535
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join24(buildPath, "assets"), {
|
|
14383
14536
|
force: true,
|
|
14384
14537
|
recursive: true
|
|
14385
14538
|
}));
|
|
@@ -14433,7 +14586,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14433
14586
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
14434
14587
|
if (entry.startsWith(resolve22(reactIndexesPath))) {
|
|
14435
14588
|
const pageName = basename9(entry, ".tsx");
|
|
14436
|
-
return
|
|
14589
|
+
return join24(reactPagesPath, `${pageName}.tsx`);
|
|
14437
14590
|
}
|
|
14438
14591
|
return null;
|
|
14439
14592
|
}) : allReactEntries;
|
|
@@ -14537,9 +14690,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14537
14690
|
const compileReactConventions = async () => {
|
|
14538
14691
|
if (reactConventionSources.length === 0)
|
|
14539
14692
|
return emptyStringArray;
|
|
14540
|
-
const destDir =
|
|
14693
|
+
const destDir = join24(buildPath, "conventions", "react");
|
|
14541
14694
|
rmSync2(destDir, { force: true, recursive: true });
|
|
14542
|
-
|
|
14695
|
+
mkdirSync11(destDir, { recursive: true });
|
|
14543
14696
|
const destPaths = [];
|
|
14544
14697
|
for (let idx = 0;idx < reactConventionSources.length; idx++) {
|
|
14545
14698
|
const source = reactConventionSources[idx];
|
|
@@ -14581,9 +14734,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14581
14734
|
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 }
|
|
14582
14735
|
]);
|
|
14583
14736
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
14584
|
-
const destDir =
|
|
14737
|
+
const destDir = join24(buildPath, "conventions", framework);
|
|
14585
14738
|
rmSync2(destDir, { force: true, recursive: true });
|
|
14586
|
-
|
|
14739
|
+
mkdirSync11(destDir, { recursive: true });
|
|
14587
14740
|
const destPaths = [];
|
|
14588
14741
|
for (let idx = 0;idx < compiledPaths.length; idx++) {
|
|
14589
14742
|
const compiledPath = compiledPaths[idx];
|
|
@@ -14654,7 +14807,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14654
14807
|
}
|
|
14655
14808
|
})) : {
|
|
14656
14809
|
entries: [],
|
|
14657
|
-
generatedRoot:
|
|
14810
|
+
generatedRoot: join24(buildPath, "_island_entries")
|
|
14658
14811
|
};
|
|
14659
14812
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
14660
14813
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -14690,7 +14843,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14690
14843
|
return {};
|
|
14691
14844
|
}
|
|
14692
14845
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
14693
|
-
const refreshEntry =
|
|
14846
|
+
const refreshEntry = join24(reactIndexesPath, "_refresh.tsx");
|
|
14694
14847
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
14695
14848
|
reactClientEntryPoints.push(refreshEntry);
|
|
14696
14849
|
}
|
|
@@ -14706,12 +14859,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14706
14859
|
angularVendorPaths2 = computeAngularVendorPaths2(globalThis.__angularVendorSpecifiers);
|
|
14707
14860
|
setAngularVendorPaths(angularVendorPaths2);
|
|
14708
14861
|
}
|
|
14709
|
-
let angularServerVendorPaths2 = getAngularServerVendorPaths();
|
|
14710
|
-
if (!angularServerVendorPaths2 && hmr && angularDir) {
|
|
14711
|
-
const { computeAngularServerVendorPaths: computeAngularServerVendorPaths2 } = await Promise.resolve().then(() => (init_buildAngularVendor(), exports_buildAngularVendor));
|
|
14712
|
-
angularServerVendorPaths2 = computeAngularServerVendorPaths2(buildPath, globalThis.__angularVendorSpecifiers ?? []);
|
|
14713
|
-
setAngularServerVendorPaths(angularServerVendorPaths2);
|
|
14714
|
-
}
|
|
14862
|
+
let angularServerVendorPaths2 = hmr ? undefined : getAngularServerVendorPaths();
|
|
14715
14863
|
if (!hmr && angularDir) {
|
|
14716
14864
|
const angularSourceDirs = [
|
|
14717
14865
|
angularDir,
|
|
@@ -14794,19 +14942,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14794
14942
|
throw: false
|
|
14795
14943
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
14796
14944
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
14797
|
-
rmSync2(
|
|
14945
|
+
rmSync2(join24(buildPath, "react", "generated", "indexes"), {
|
|
14798
14946
|
force: true,
|
|
14799
14947
|
recursive: true
|
|
14800
14948
|
});
|
|
14801
14949
|
}
|
|
14802
14950
|
if (angularDir && angularClientPaths.length > 0) {
|
|
14803
|
-
rmSync2(
|
|
14951
|
+
rmSync2(join24(buildPath, "angular", "indexes"), {
|
|
14804
14952
|
force: true,
|
|
14805
14953
|
recursive: true
|
|
14806
14954
|
});
|
|
14807
14955
|
}
|
|
14808
14956
|
if (islandClientEntryPoints.length > 0) {
|
|
14809
|
-
rmSync2(
|
|
14957
|
+
rmSync2(join24(buildPath, "islands"), {
|
|
14810
14958
|
force: true,
|
|
14811
14959
|
recursive: true
|
|
14812
14960
|
});
|
|
@@ -14875,7 +15023,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14875
15023
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
14876
15024
|
entrypoints: globalCssEntries,
|
|
14877
15025
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
14878
|
-
outdir: stylesDir ?
|
|
15026
|
+
outdir: stylesDir ? join24(buildPath, basename9(stylesDir)) : buildPath,
|
|
14879
15027
|
plugins: [stylePreprocessorPlugin2],
|
|
14880
15028
|
root: stylesDir || clientRoot,
|
|
14881
15029
|
target: "browser",
|
|
@@ -14884,7 +15032,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14884
15032
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
14885
15033
|
entrypoints: vueCssPaths,
|
|
14886
15034
|
naming: `[name].[hash].[ext]`,
|
|
14887
|
-
outdir:
|
|
15035
|
+
outdir: join24(buildPath, assetsPath ? basename9(assetsPath) : "assets", "css"),
|
|
14888
15036
|
target: "browser",
|
|
14889
15037
|
throw: false
|
|
14890
15038
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -14941,25 +15089,24 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14941
15089
|
...allNonReactVendorPaths
|
|
14942
15090
|
};
|
|
14943
15091
|
if (nonReactClientOutputs.length > 0 && Object.keys(allNonReactVendorPaths).length > 0) {
|
|
14944
|
-
const {
|
|
14945
|
-
await tracePhase("postprocess/non-react-vendor-imports", () =>
|
|
15092
|
+
const { rewriteBuildOutputs: rewriteBuildOutputs2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
15093
|
+
await tracePhase("postprocess/non-react-vendor-imports", () => rewriteBuildOutputs2(nonReactClientOutputs, allNonReactVendorPaths));
|
|
14946
15094
|
}
|
|
14947
15095
|
if (islandClientOutputs.length > 0 && Object.keys(allIslandVendorPaths).length > 0) {
|
|
14948
|
-
const {
|
|
14949
|
-
await tracePhase("postprocess/island-vendor-imports", () =>
|
|
15096
|
+
const { rewriteBuildOutputs: rewriteBuildOutputs2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
15097
|
+
await tracePhase("postprocess/island-vendor-imports", () => rewriteBuildOutputs2(islandClientOutputs, allIslandVendorPaths));
|
|
14950
15098
|
}
|
|
14951
15099
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
14952
|
-
const {
|
|
14953
|
-
|
|
14954
|
-
await tracePhase("postprocess/server-angular-vendor-imports", () => Promise.all(jsArtifacts.map(async (artifact) => {
|
|
15100
|
+
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
15101
|
+
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
14955
15102
|
const fileDir = dirname15(artifact.path);
|
|
14956
15103
|
const relativePaths = {};
|
|
14957
15104
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
14958
15105
|
const rel = relative10(fileDir, absolute);
|
|
14959
15106
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
14960
15107
|
}
|
|
14961
|
-
return
|
|
14962
|
-
}))
|
|
15108
|
+
return relativePaths;
|
|
15109
|
+
}));
|
|
14963
15110
|
}
|
|
14964
15111
|
const cssLogs = [
|
|
14965
15112
|
...globalCssResult?.logs ?? [],
|
|
@@ -15025,19 +15172,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15025
15172
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
15026
15173
|
if (!hmrClientBundle)
|
|
15027
15174
|
return;
|
|
15028
|
-
let html =
|
|
15175
|
+
let html = readFileSync14(filePath, "utf-8");
|
|
15029
15176
|
if (html.includes("data-hmr-client"))
|
|
15030
15177
|
return;
|
|
15031
15178
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
15032
15179
|
const bodyClose = /<\/body\s*>/i.exec(html);
|
|
15033
15180
|
html = bodyClose ? html.slice(0, bodyClose.index) + tag + html.slice(bodyClose.index) : html + tag;
|
|
15034
|
-
|
|
15181
|
+
writeFileSync8(filePath, html);
|
|
15035
15182
|
};
|
|
15036
15183
|
const processHtmlPages = async () => {
|
|
15037
15184
|
if (!(htmlDir && htmlPagesPath))
|
|
15038
15185
|
return;
|
|
15039
|
-
const outputHtmlPages = isSingle ?
|
|
15040
|
-
|
|
15186
|
+
const outputHtmlPages = isSingle ? join24(buildPath, "pages") : join24(buildPath, basename9(htmlDir), "pages");
|
|
15187
|
+
mkdirSync11(outputHtmlPages, { recursive: true });
|
|
15041
15188
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
15042
15189
|
force: true,
|
|
15043
15190
|
recursive: true
|
|
@@ -15058,14 +15205,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15058
15205
|
const processHtmxPages = async () => {
|
|
15059
15206
|
if (!(htmxDir && htmxPagesPath))
|
|
15060
15207
|
return;
|
|
15061
|
-
const outputHtmxPages = isSingle ?
|
|
15062
|
-
|
|
15208
|
+
const outputHtmxPages = isSingle ? join24(buildPath, "pages") : join24(buildPath, basename9(htmxDir), "pages");
|
|
15209
|
+
mkdirSync11(outputHtmxPages, { recursive: true });
|
|
15063
15210
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
15064
15211
|
force: true,
|
|
15065
15212
|
recursive: true
|
|
15066
15213
|
});
|
|
15067
15214
|
if (shouldCopyHtmx) {
|
|
15068
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
15215
|
+
const htmxDestDir = isSingle ? buildPath : join24(buildPath, basename9(htmxDir));
|
|
15069
15216
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
15070
15217
|
}
|
|
15071
15218
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -15126,9 +15273,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15126
15273
|
writeBuildTrace(buildPath);
|
|
15127
15274
|
return { conventions: conventionsMap, manifest };
|
|
15128
15275
|
}
|
|
15129
|
-
|
|
15276
|
+
writeFileSync8(join24(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
15130
15277
|
if (Object.keys(conventionsMap).length > 0) {
|
|
15131
|
-
|
|
15278
|
+
writeFileSync8(join24(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
15132
15279
|
}
|
|
15133
15280
|
writeBuildTrace(buildPath);
|
|
15134
15281
|
if (tailwind && mode === "production") {
|
|
@@ -15225,9 +15372,9 @@ var init_build = __esm(() => {
|
|
|
15225
15372
|
});
|
|
15226
15373
|
|
|
15227
15374
|
// src/build/buildEmberVendor.ts
|
|
15228
|
-
import { mkdirSync as
|
|
15229
|
-
import { join as
|
|
15230
|
-
import { rm as
|
|
15375
|
+
import { mkdirSync as mkdirSync12, existsSync as existsSync21 } from "fs";
|
|
15376
|
+
import { join as join25 } from "path";
|
|
15377
|
+
import { rm as rm9 } from "fs/promises";
|
|
15231
15378
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
15232
15379
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
15233
15380
|
// implementations for macros that would normally be replaced at
|
|
@@ -15278,7 +15425,7 @@ export const importSync = (specifier) => {
|
|
|
15278
15425
|
if (standaloneSpecifiers.has(specifier)) {
|
|
15279
15426
|
return { resolveTo: specifier, specifier };
|
|
15280
15427
|
}
|
|
15281
|
-
const emberInternalPath =
|
|
15428
|
+
const emberInternalPath = join25(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
15282
15429
|
if (!existsSync21(emberInternalPath)) {
|
|
15283
15430
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
15284
15431
|
}
|
|
@@ -15310,7 +15457,7 @@ export const importSync = (specifier) => {
|
|
|
15310
15457
|
if (standalonePackages.has(args.path)) {
|
|
15311
15458
|
return;
|
|
15312
15459
|
}
|
|
15313
|
-
const internal =
|
|
15460
|
+
const internal = join25(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
15314
15461
|
if (existsSync21(internal)) {
|
|
15315
15462
|
return { path: internal };
|
|
15316
15463
|
}
|
|
@@ -15318,16 +15465,16 @@ export const importSync = (specifier) => {
|
|
|
15318
15465
|
});
|
|
15319
15466
|
}
|
|
15320
15467
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
15321
|
-
const vendorDir =
|
|
15322
|
-
|
|
15323
|
-
const tmpDir =
|
|
15324
|
-
|
|
15325
|
-
const macrosShimPath =
|
|
15468
|
+
const vendorDir = join25(buildDir, "ember", "vendor");
|
|
15469
|
+
mkdirSync12(vendorDir, { recursive: true });
|
|
15470
|
+
const tmpDir = join25(buildDir, "_ember_vendor_tmp");
|
|
15471
|
+
mkdirSync12(tmpDir, { recursive: true });
|
|
15472
|
+
const macrosShimPath = join25(tmpDir, "embroider_macros_shim.js");
|
|
15326
15473
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
15327
15474
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
15328
15475
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
15329
15476
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
15330
|
-
const entryPath =
|
|
15477
|
+
const entryPath = join25(tmpDir, `${safeName}.js`);
|
|
15331
15478
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
15332
15479
|
` : generateVendorEntrySource2(resolution);
|
|
15333
15480
|
await Bun.write(entryPath, source);
|
|
@@ -15344,7 +15491,7 @@ export const importSync = (specifier) => {
|
|
|
15344
15491
|
target: "browser",
|
|
15345
15492
|
throw: false
|
|
15346
15493
|
});
|
|
15347
|
-
await
|
|
15494
|
+
await rm9(tmpDir, { force: true, recursive: true });
|
|
15348
15495
|
if (!result.success) {
|
|
15349
15496
|
console.warn("\u26A0\uFE0F Ember vendor build had errors:", result.logs);
|
|
15350
15497
|
}
|
|
@@ -15371,7 +15518,7 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
15371
15518
|
});
|
|
15372
15519
|
|
|
15373
15520
|
// src/dev/dependencyGraph.ts
|
|
15374
|
-
import { existsSync as existsSync22, readFileSync as
|
|
15521
|
+
import { existsSync as existsSync22, readFileSync as readFileSync15 } from "fs";
|
|
15375
15522
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15376
15523
|
import { resolve as resolve23 } from "path";
|
|
15377
15524
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -15532,15 +15679,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15532
15679
|
const lowerPath = filePath.toLowerCase();
|
|
15533
15680
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
15534
15681
|
if (loader === "html") {
|
|
15535
|
-
const content =
|
|
15682
|
+
const content = readFileSync15(filePath, "utf-8");
|
|
15536
15683
|
return extractHtmlDependencies(filePath, content);
|
|
15537
15684
|
}
|
|
15538
15685
|
if (loader === "tsx" || loader === "js") {
|
|
15539
|
-
const content =
|
|
15686
|
+
const content = readFileSync15(filePath, "utf-8");
|
|
15540
15687
|
return extractJsDependencies(filePath, content, loader);
|
|
15541
15688
|
}
|
|
15542
15689
|
if (isSvelteOrVue) {
|
|
15543
|
-
const content =
|
|
15690
|
+
const content = readFileSync15(filePath, "utf-8");
|
|
15544
15691
|
return extractSvelteVueDependencies(filePath, content);
|
|
15545
15692
|
}
|
|
15546
15693
|
return [];
|
|
@@ -15691,7 +15838,8 @@ var init_clientManager = __esm(() => {
|
|
|
15691
15838
|
});
|
|
15692
15839
|
|
|
15693
15840
|
// src/dev/pathUtils.ts
|
|
15694
|
-
import {
|
|
15841
|
+
import { existsSync as existsSync23 } from "fs";
|
|
15842
|
+
import { resolve as resolve25 } from "path";
|
|
15695
15843
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
15696
15844
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
15697
15845
|
return "ignored";
|
|
@@ -15765,28 +15913,15 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
15765
15913
|
return "assets";
|
|
15766
15914
|
}
|
|
15767
15915
|
return "unknown";
|
|
15768
|
-
},
|
|
15769
|
-
|
|
15770
|
-
|
|
15771
|
-
const
|
|
15772
|
-
|
|
15773
|
-
return [];
|
|
15774
|
-
const knownNames = new Set([...frameworkDirs, cfg.assetsDir, cfg.stylesDir].filter((dir) => Boolean(dir)).map((dir) => normalizePath(dir).split("/").pop()));
|
|
15775
|
-
knownNames.add("build");
|
|
15776
|
-
knownNames.add("node_modules");
|
|
15777
|
-
knownNames.add(".absolutejs");
|
|
15778
|
-
try {
|
|
15779
|
-
return readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !knownNames.has(entry.name)).map((entry) => `${root}/${entry.name}`);
|
|
15780
|
-
} catch {
|
|
15781
|
-
return [];
|
|
15782
|
-
}
|
|
15783
|
-
}, getWatchPaths = (config, resolved) => {
|
|
15784
|
-
const paths = [];
|
|
15785
|
-
const push = (base, sub) => {
|
|
15786
|
-
if (!base)
|
|
15916
|
+
}, collectPositiveWatchRoots = (config, resolved) => {
|
|
15917
|
+
const cwd2 = process.cwd();
|
|
15918
|
+
const roots = [];
|
|
15919
|
+
const push = (path) => {
|
|
15920
|
+
if (!path)
|
|
15787
15921
|
return;
|
|
15788
|
-
const
|
|
15789
|
-
|
|
15922
|
+
const abs = normalizePath(resolve25(cwd2, path));
|
|
15923
|
+
if (!roots.includes(abs))
|
|
15924
|
+
roots.push(abs);
|
|
15790
15925
|
};
|
|
15791
15926
|
const cfg = resolved ?? {
|
|
15792
15927
|
angularDir: config.angularDirectory,
|
|
@@ -15804,44 +15939,76 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
15804
15939
|
push(cfg.vueDir);
|
|
15805
15940
|
push(cfg.emberDir);
|
|
15806
15941
|
push(cfg.angularDir);
|
|
15807
|
-
push(cfg.htmlDir
|
|
15808
|
-
push(cfg.
|
|
15809
|
-
push(cfg.htmlDir, "styles");
|
|
15810
|
-
push(cfg.htmxDir, "pages");
|
|
15811
|
-
push(cfg.htmxDir, "scripts");
|
|
15812
|
-
push(cfg.htmxDir, "styles");
|
|
15942
|
+
push(cfg.htmlDir);
|
|
15943
|
+
push(cfg.htmxDir);
|
|
15813
15944
|
push(cfg.assetsDir);
|
|
15814
15945
|
push(cfg.stylesDir);
|
|
15815
|
-
const
|
|
15816
|
-
|
|
15817
|
-
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
|
|
15823
|
-
|
|
15824
|
-
|
|
15825
|
-
|
|
15946
|
+
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
15947
|
+
const abs = normalizePath(resolve25(cwd2, candidate));
|
|
15948
|
+
if (existsSync23(abs) && !roots.includes(abs))
|
|
15949
|
+
roots.push(abs);
|
|
15950
|
+
}
|
|
15951
|
+
const extraDirs = config.dev?.watchDirs ?? [];
|
|
15952
|
+
for (const dir of extraDirs)
|
|
15953
|
+
push(dir);
|
|
15954
|
+
return roots;
|
|
15955
|
+
}, getWatchPaths = (config, resolved) => {
|
|
15956
|
+
const roots = collectPositiveWatchRoots(config, resolved);
|
|
15957
|
+
const paths = [];
|
|
15958
|
+
const push = (base, sub) => {
|
|
15959
|
+
if (!base)
|
|
15960
|
+
return;
|
|
15961
|
+
const normalizedBase = normalizePath(base);
|
|
15962
|
+
paths.push(sub ? `${normalizedBase}/${sub}` : normalizedBase);
|
|
15963
|
+
};
|
|
15964
|
+
const cfg = resolved ?? {
|
|
15965
|
+
htmlDir: config.htmlDirectory,
|
|
15966
|
+
htmxDir: config.htmxDirectory
|
|
15967
|
+
};
|
|
15968
|
+
if (cfg.htmlDir) {
|
|
15969
|
+
push(cfg.htmlDir, "pages");
|
|
15970
|
+
push(cfg.htmlDir, "scripts");
|
|
15971
|
+
push(cfg.htmlDir, "styles");
|
|
15972
|
+
}
|
|
15973
|
+
if (cfg.htmxDir) {
|
|
15974
|
+
push(cfg.htmxDir, "pages");
|
|
15975
|
+
push(cfg.htmxDir, "scripts");
|
|
15976
|
+
push(cfg.htmxDir, "styles");
|
|
15977
|
+
}
|
|
15978
|
+
for (const root of roots) {
|
|
15979
|
+
if (root === normalizePath(cfg.htmlDir ?? ""))
|
|
15980
|
+
continue;
|
|
15981
|
+
if (root === normalizePath(cfg.htmxDir ?? ""))
|
|
15982
|
+
continue;
|
|
15983
|
+
paths.push(root);
|
|
15826
15984
|
}
|
|
15827
15985
|
return paths;
|
|
15828
|
-
}, shouldIgnorePath = (path, resolved) => {
|
|
15829
|
-
const
|
|
15830
|
-
if (resolved?.stylesDir
|
|
15831
|
-
|
|
15986
|
+
}, HARD_DENY_PATTERN, shouldIgnorePath = (path, resolved) => {
|
|
15987
|
+
const normalized = path.replace(/\\/g, "/");
|
|
15988
|
+
if (resolved?.stylesDir) {
|
|
15989
|
+
const styles = normalized.startsWith(resolved.stylesDir.replace(/\\/g, "/"));
|
|
15990
|
+
if (styles)
|
|
15991
|
+
return false;
|
|
15832
15992
|
}
|
|
15833
|
-
|
|
15834
|
-
|
|
15993
|
+
if (HARD_DENY_PATTERN.test(normalized))
|
|
15994
|
+
return true;
|
|
15995
|
+
if (normalized.endsWith(".log"))
|
|
15996
|
+
return true;
|
|
15997
|
+
if (normalized.endsWith(".tmp"))
|
|
15998
|
+
return true;
|
|
15999
|
+
if (normalized.endsWith("~"))
|
|
16000
|
+
return true;
|
|
16001
|
+
return false;
|
|
15835
16002
|
};
|
|
15836
16003
|
var init_pathUtils = __esm(() => {
|
|
15837
|
-
init_commonAncestor();
|
|
15838
16004
|
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less|styl(?:us)?)$/i;
|
|
16005
|
+
HARD_DENY_PATTERN = /(^|\/)(build|generated|compiled|indexes|\.absolutejs|node_modules|\.git|\.test-builds|dist)(\/|$)/;
|
|
15839
16006
|
});
|
|
15840
16007
|
|
|
15841
16008
|
// src/dev/fileWatcher.ts
|
|
15842
16009
|
import { watch } from "fs";
|
|
15843
|
-
import { existsSync as
|
|
15844
|
-
import { join as
|
|
16010
|
+
import { existsSync as existsSync24 } from "fs";
|
|
16011
|
+
import { join as join26, resolve as resolve26 } from "path";
|
|
15845
16012
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
15846
16013
|
try {
|
|
15847
16014
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -15868,16 +16035,16 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
15868
16035
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
15869
16036
|
return;
|
|
15870
16037
|
}
|
|
15871
|
-
const fullPath =
|
|
16038
|
+
const fullPath = join26(absolutePath, filename).replace(/\\/g, "/");
|
|
15872
16039
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
15873
16040
|
return;
|
|
15874
16041
|
}
|
|
15875
|
-
if (event === "rename" && !
|
|
16042
|
+
if (event === "rename" && !existsSync24(fullPath)) {
|
|
15876
16043
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
15877
16044
|
onFileChange(fullPath);
|
|
15878
16045
|
return;
|
|
15879
16046
|
}
|
|
15880
|
-
if (
|
|
16047
|
+
if (existsSync24(fullPath)) {
|
|
15881
16048
|
onFileChange(fullPath);
|
|
15882
16049
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
15883
16050
|
}
|
|
@@ -15886,8 +16053,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
15886
16053
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
15887
16054
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
15888
16055
|
paths.forEach((path) => {
|
|
15889
|
-
const absolutePath =
|
|
15890
|
-
if (!
|
|
16056
|
+
const absolutePath = resolve26(path).replace(/\\/g, "/");
|
|
16057
|
+
if (!existsSync24(absolutePath)) {
|
|
15891
16058
|
return;
|
|
15892
16059
|
}
|
|
15893
16060
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -15897,8 +16064,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
15897
16064
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
15898
16065
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
15899
16066
|
watchPaths.forEach((path) => {
|
|
15900
|
-
const absolutePath =
|
|
15901
|
-
if (!
|
|
16067
|
+
const absolutePath = resolve26(path).replace(/\\/g, "/");
|
|
16068
|
+
if (!existsSync24(absolutePath)) {
|
|
15902
16069
|
return;
|
|
15903
16070
|
}
|
|
15904
16071
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -15912,13 +16079,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
15912
16079
|
});
|
|
15913
16080
|
|
|
15914
16081
|
// src/dev/assetStore.ts
|
|
15915
|
-
import { resolve as
|
|
15916
|
-
import { readdir as
|
|
16082
|
+
import { resolve as resolve27 } from "path";
|
|
16083
|
+
import { readdir as readdir4, unlink } from "fs/promises";
|
|
15917
16084
|
var mimeTypes, getMimeType = (filePath) => {
|
|
15918
16085
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
15919
16086
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
15920
16087
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
15921
|
-
const fullPath =
|
|
16088
|
+
const fullPath = resolve27(dir, entry.name);
|
|
15922
16089
|
if (entry.isDirectory()) {
|
|
15923
16090
|
return walkAndClean(fullPath);
|
|
15924
16091
|
}
|
|
@@ -15934,10 +16101,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15934
16101
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
15935
16102
|
const liveByIdentity = new Map;
|
|
15936
16103
|
for (const webPath of store.keys()) {
|
|
15937
|
-
const diskPath =
|
|
16104
|
+
const diskPath = resolve27(buildDir, webPath.slice(1));
|
|
15938
16105
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
15939
16106
|
}
|
|
15940
|
-
const absBuildDir =
|
|
16107
|
+
const absBuildDir = resolve27(buildDir);
|
|
15941
16108
|
Object.values(manifest).forEach((val) => {
|
|
15942
16109
|
if (!HASHED_FILE_RE.test(val))
|
|
15943
16110
|
return;
|
|
@@ -15947,7 +16114,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15947
16114
|
});
|
|
15948
16115
|
try {
|
|
15949
16116
|
const walkAndClean = async (dir) => {
|
|
15950
|
-
const entries = await
|
|
16117
|
+
const entries = await readdir4(dir, { withFileTypes: true });
|
|
15951
16118
|
const tasks = entries.map((entry) => processWalkEntry(entry, dir, liveByIdentity, walkAndClean)).filter((task) => task !== null);
|
|
15952
16119
|
await Promise.all(tasks);
|
|
15953
16120
|
};
|
|
@@ -15955,7 +16122,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15955
16122
|
} catch {}
|
|
15956
16123
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
15957
16124
|
if (entry.isDirectory()) {
|
|
15958
|
-
return scanDir(
|
|
16125
|
+
return scanDir(resolve27(dir, entry.name), `${prefix}${entry.name}/`);
|
|
15959
16126
|
}
|
|
15960
16127
|
if (!entry.name.startsWith("chunk-")) {
|
|
15961
16128
|
return null;
|
|
@@ -15964,7 +16131,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15964
16131
|
if (store.has(webPath)) {
|
|
15965
16132
|
return null;
|
|
15966
16133
|
}
|
|
15967
|
-
return Bun.file(
|
|
16134
|
+
return Bun.file(resolve27(dir, entry.name)).bytes().then((bytes) => {
|
|
15968
16135
|
store.set(webPath, bytes);
|
|
15969
16136
|
return;
|
|
15970
16137
|
}).catch(() => {});
|
|
@@ -15986,14 +16153,14 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15986
16153
|
for (const webPath of newIdentities.values()) {
|
|
15987
16154
|
if (store.has(webPath))
|
|
15988
16155
|
continue;
|
|
15989
|
-
loadPromises.push(Bun.file(
|
|
16156
|
+
loadPromises.push(Bun.file(resolve27(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
15990
16157
|
store.set(webPath, bytes);
|
|
15991
16158
|
return;
|
|
15992
16159
|
}).catch(() => {}));
|
|
15993
16160
|
}
|
|
15994
16161
|
try {
|
|
15995
16162
|
const scanDir = async (dir, prefix) => {
|
|
15996
|
-
const entries = await
|
|
16163
|
+
const entries = await readdir4(dir, { withFileTypes: true });
|
|
15997
16164
|
const subTasks = entries.map((entry) => processScanEntry(entry, dir, prefix, store, scanDir)).filter((task) => task !== null);
|
|
15998
16165
|
await Promise.all(subTasks);
|
|
15999
16166
|
};
|
|
@@ -16016,10 +16183,10 @@ var init_assetStore = __esm(() => {
|
|
|
16016
16183
|
});
|
|
16017
16184
|
|
|
16018
16185
|
// src/dev/fileHashTracker.ts
|
|
16019
|
-
import { readFileSync as
|
|
16186
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
16020
16187
|
var computeFileHash = (filePath) => {
|
|
16021
16188
|
try {
|
|
16022
|
-
const fileContent =
|
|
16189
|
+
const fileContent = readFileSync16(filePath);
|
|
16023
16190
|
return Number(Bun.hash(fileContent));
|
|
16024
16191
|
} catch {
|
|
16025
16192
|
return UNFOUND_INDEX;
|
|
@@ -16099,9 +16266,9 @@ var init_transformCache = __esm(() => {
|
|
|
16099
16266
|
});
|
|
16100
16267
|
|
|
16101
16268
|
// src/dev/reactComponentClassifier.ts
|
|
16102
|
-
import { resolve as
|
|
16269
|
+
import { resolve as resolve28 } from "path";
|
|
16103
16270
|
var classifyComponent = (filePath) => {
|
|
16104
|
-
const normalizedPath =
|
|
16271
|
+
const normalizedPath = resolve28(filePath);
|
|
16105
16272
|
if (normalizedPath.includes("/react/pages/")) {
|
|
16106
16273
|
return "server";
|
|
16107
16274
|
}
|
|
@@ -16113,7 +16280,7 @@ var classifyComponent = (filePath) => {
|
|
|
16113
16280
|
var init_reactComponentClassifier = () => {};
|
|
16114
16281
|
|
|
16115
16282
|
// src/dev/moduleMapper.ts
|
|
16116
|
-
import { basename as basename10, resolve as
|
|
16283
|
+
import { basename as basename10, resolve as resolve29 } from "path";
|
|
16117
16284
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
16118
16285
|
const modulePaths = {};
|
|
16119
16286
|
moduleKeys.forEach((key) => {
|
|
@@ -16123,7 +16290,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16123
16290
|
});
|
|
16124
16291
|
return modulePaths;
|
|
16125
16292
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
16126
|
-
const normalizedFile =
|
|
16293
|
+
const normalizedFile = resolve29(sourceFile);
|
|
16127
16294
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
16128
16295
|
if (processedFiles.has(normalizedFile)) {
|
|
16129
16296
|
return null;
|
|
@@ -16159,7 +16326,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16159
16326
|
});
|
|
16160
16327
|
return grouped;
|
|
16161
16328
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
16162
|
-
const normalizedFile =
|
|
16329
|
+
const normalizedFile = resolve29(sourceFile);
|
|
16163
16330
|
const fileName = basename10(normalizedFile);
|
|
16164
16331
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
16165
16332
|
const pascalName = toPascal(baseName);
|
|
@@ -16318,6 +16485,239 @@ var init_ssrCache = __esm(() => {
|
|
|
16318
16485
|
dirtyFrameworks = new Set;
|
|
16319
16486
|
});
|
|
16320
16487
|
|
|
16488
|
+
// src/dev/angular/editTypeDetection.ts
|
|
16489
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
16490
|
+
import { basename as basename11 } from "path";
|
|
16491
|
+
import * as ts3 from "typescript";
|
|
16492
|
+
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) => {
|
|
16493
|
+
const callee = node.expression;
|
|
16494
|
+
if (ts3.isIdentifier(callee))
|
|
16495
|
+
return callee.text;
|
|
16496
|
+
if (ts3.isPropertyAccessExpression(callee))
|
|
16497
|
+
return callee.name.text;
|
|
16498
|
+
return null;
|
|
16499
|
+
}, getNewExprName = (node) => {
|
|
16500
|
+
const callee = node.expression;
|
|
16501
|
+
if (ts3.isIdentifier(callee))
|
|
16502
|
+
return callee.text;
|
|
16503
|
+
if (ts3.isPropertyAccessExpression(callee))
|
|
16504
|
+
return callee.name.text;
|
|
16505
|
+
return null;
|
|
16506
|
+
}, collectMethodBodies = (cls) => {
|
|
16507
|
+
const methods = new Map;
|
|
16508
|
+
cls.members.forEach((member) => {
|
|
16509
|
+
if (!member.name || !ts3.isIdentifier(member.name))
|
|
16510
|
+
return;
|
|
16511
|
+
if (ts3.isMethodDeclaration(member) && member.body) {
|
|
16512
|
+
methods.set(member.name.text, member.body);
|
|
16513
|
+
return;
|
|
16514
|
+
}
|
|
16515
|
+
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16516
|
+
const init = member.initializer;
|
|
16517
|
+
if (ts3.isArrowFunction(init) || ts3.isFunctionExpression(init)) {
|
|
16518
|
+
methods.set(member.name.text, init.body);
|
|
16519
|
+
}
|
|
16520
|
+
}
|
|
16521
|
+
});
|
|
16522
|
+
return methods;
|
|
16523
|
+
}, findSideEffectInBody = (body, methods, visited) => {
|
|
16524
|
+
let hit = { found: false };
|
|
16525
|
+
const walk = (node) => {
|
|
16526
|
+
if (hit.found)
|
|
16527
|
+
return;
|
|
16528
|
+
if (ts3.isCallExpression(node)) {
|
|
16529
|
+
const name = getCalleeName(node);
|
|
16530
|
+
if (name && SIDE_EFFECT_CALL_NAMES.has(name)) {
|
|
16531
|
+
hit = {
|
|
16532
|
+
found: true,
|
|
16533
|
+
reason: `constructor invokes ${name}(...)`
|
|
16534
|
+
};
|
|
16535
|
+
return;
|
|
16536
|
+
}
|
|
16537
|
+
if (name && methods.has(name) && !visited.has(name)) {
|
|
16538
|
+
visited.add(name);
|
|
16539
|
+
const target = methods.get(name);
|
|
16540
|
+
if (target) {
|
|
16541
|
+
const inner = findSideEffectInBody(target, methods, visited);
|
|
16542
|
+
if (inner.found) {
|
|
16543
|
+
hit = {
|
|
16544
|
+
found: true,
|
|
16545
|
+
reason: `${inner.reason} (via this.${name}())`
|
|
16546
|
+
};
|
|
16547
|
+
return;
|
|
16548
|
+
}
|
|
16549
|
+
}
|
|
16550
|
+
}
|
|
16551
|
+
}
|
|
16552
|
+
if (ts3.isNewExpression(node)) {
|
|
16553
|
+
const name = getNewExprName(node);
|
|
16554
|
+
if (name && SIDE_EFFECT_NEW_NAMES.has(name)) {
|
|
16555
|
+
hit = {
|
|
16556
|
+
found: true,
|
|
16557
|
+
reason: `constructor instantiates new ${name}(...)`
|
|
16558
|
+
};
|
|
16559
|
+
return;
|
|
16560
|
+
}
|
|
16561
|
+
}
|
|
16562
|
+
ts3.forEachChild(node, walk);
|
|
16563
|
+
};
|
|
16564
|
+
walk(body);
|
|
16565
|
+
return hit;
|
|
16566
|
+
}, analyzeServiceFile = (file5) => {
|
|
16567
|
+
let source;
|
|
16568
|
+
try {
|
|
16569
|
+
source = readFileSync17(file5, "utf8");
|
|
16570
|
+
} catch {
|
|
16571
|
+
return {
|
|
16572
|
+
hasSideEffectCtor: true,
|
|
16573
|
+
reason: "service file unreadable \u2014 defaulting to reboot"
|
|
16574
|
+
};
|
|
16575
|
+
}
|
|
16576
|
+
const sf = ts3.createSourceFile(file5, source, ts3.ScriptTarget.Latest, true);
|
|
16577
|
+
let result = {
|
|
16578
|
+
hasSideEffectCtor: false,
|
|
16579
|
+
reason: "constructor has no side-effecting calls"
|
|
16580
|
+
};
|
|
16581
|
+
const visit = (node) => {
|
|
16582
|
+
if (result.hasSideEffectCtor)
|
|
16583
|
+
return;
|
|
16584
|
+
if (!ts3.isClassDeclaration(node)) {
|
|
16585
|
+
ts3.forEachChild(node, visit);
|
|
16586
|
+
return;
|
|
16587
|
+
}
|
|
16588
|
+
const methods = collectMethodBodies(node);
|
|
16589
|
+
const ctor = node.members.find(ts3.isConstructorDeclaration);
|
|
16590
|
+
const targets = [];
|
|
16591
|
+
if (ctor?.body)
|
|
16592
|
+
targets.push(ctor.body);
|
|
16593
|
+
node.members.forEach((member) => {
|
|
16594
|
+
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16595
|
+
targets.push(member.initializer);
|
|
16596
|
+
}
|
|
16597
|
+
});
|
|
16598
|
+
for (const target of targets) {
|
|
16599
|
+
const r = findSideEffectInBody(target, methods, new Set);
|
|
16600
|
+
if (r.found) {
|
|
16601
|
+
result = { hasSideEffectCtor: true, reason: r.reason };
|
|
16602
|
+
break;
|
|
16603
|
+
}
|
|
16604
|
+
}
|
|
16605
|
+
if (!result.hasSideEffectCtor)
|
|
16606
|
+
ts3.forEachChild(node, visit);
|
|
16607
|
+
};
|
|
16608
|
+
visit(sf);
|
|
16609
|
+
return result;
|
|
16610
|
+
}, classifyAngularEdit = (file5) => {
|
|
16611
|
+
const base = basename11(file5);
|
|
16612
|
+
if (TEMPLATE_RE.test(file5)) {
|
|
16613
|
+
return {
|
|
16614
|
+
type: "template",
|
|
16615
|
+
reason: `${base} \u2014 template edit`,
|
|
16616
|
+
sourceFile: file5
|
|
16617
|
+
};
|
|
16618
|
+
}
|
|
16619
|
+
if (COMPONENT_STYLE_RE.test(file5)) {
|
|
16620
|
+
return {
|
|
16621
|
+
type: "style-component",
|
|
16622
|
+
reason: `${base} \u2014 component-scoped stylesheet edit`,
|
|
16623
|
+
sourceFile: file5
|
|
16624
|
+
};
|
|
16625
|
+
}
|
|
16626
|
+
if (STYLE_EXT_RE.test(file5)) {
|
|
16627
|
+
return {
|
|
16628
|
+
type: "reboot",
|
|
16629
|
+
reason: `${base} \u2014 non-component-named stylesheet, falling back to reboot until scoping is verified`,
|
|
16630
|
+
sourceFile: file5
|
|
16631
|
+
};
|
|
16632
|
+
}
|
|
16633
|
+
if (ROUTES_RE.test(file5)) {
|
|
16634
|
+
return {
|
|
16635
|
+
type: "route",
|
|
16636
|
+
reason: `${base} \u2014 router config, requires reboot`,
|
|
16637
|
+
sourceFile: file5
|
|
16638
|
+
};
|
|
16639
|
+
}
|
|
16640
|
+
if (SERVICE_RE.test(file5)) {
|
|
16641
|
+
const a = analyzeServiceFile(file5);
|
|
16642
|
+
if (a.hasSideEffectCtor) {
|
|
16643
|
+
return {
|
|
16644
|
+
type: "service-with-side-effects",
|
|
16645
|
+
reason: `${base} \u2014 ${a.reason}`,
|
|
16646
|
+
sourceFile: file5
|
|
16647
|
+
};
|
|
16648
|
+
}
|
|
16649
|
+
return {
|
|
16650
|
+
type: "service-method-only",
|
|
16651
|
+
reason: `${base} \u2014 ${a.reason}`,
|
|
16652
|
+
sourceFile: file5
|
|
16653
|
+
};
|
|
16654
|
+
}
|
|
16655
|
+
if (COMPONENT_CLASS_RE.test(file5)) {
|
|
16656
|
+
return {
|
|
16657
|
+
type: "class-component",
|
|
16658
|
+
reason: `${base} \u2014 component class edit`,
|
|
16659
|
+
sourceFile: file5
|
|
16660
|
+
};
|
|
16661
|
+
}
|
|
16662
|
+
return {
|
|
16663
|
+
type: "reboot",
|
|
16664
|
+
reason: `${base} \u2014 unrecognized angular file type, falling back to reboot`,
|
|
16665
|
+
sourceFile: file5
|
|
16666
|
+
};
|
|
16667
|
+
}, collapseClassifications = (classifications) => {
|
|
16668
|
+
if (classifications.length === 0) {
|
|
16669
|
+
return {
|
|
16670
|
+
type: "reboot",
|
|
16671
|
+
reason: "no classifiable files in batch",
|
|
16672
|
+
sourceFile: ""
|
|
16673
|
+
};
|
|
16674
|
+
}
|
|
16675
|
+
let winner = classifications[0];
|
|
16676
|
+
for (let i = 1;i < classifications.length; i++) {
|
|
16677
|
+
const candidate = classifications[i];
|
|
16678
|
+
if (TYPE_PRIORITY[candidate.type] > TYPE_PRIORITY[winner.type]) {
|
|
16679
|
+
winner = candidate;
|
|
16680
|
+
}
|
|
16681
|
+
}
|
|
16682
|
+
return winner;
|
|
16683
|
+
};
|
|
16684
|
+
var init_editTypeDetection = __esm(() => {
|
|
16685
|
+
TYPE_PRIORITY = {
|
|
16686
|
+
template: 0,
|
|
16687
|
+
"style-component": 1,
|
|
16688
|
+
"service-method-only": 2,
|
|
16689
|
+
"class-component": 3,
|
|
16690
|
+
"service-with-side-effects": 4,
|
|
16691
|
+
route: 5,
|
|
16692
|
+
reboot: 6
|
|
16693
|
+
};
|
|
16694
|
+
STYLE_EXT_RE = /\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16695
|
+
COMPONENT_STYLE_RE = /\.component\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16696
|
+
TEMPLATE_RE = /\.html$/i;
|
|
16697
|
+
COMPONENT_CLASS_RE = /\.component\.ts$/i;
|
|
16698
|
+
SERVICE_RE = /\.service\.ts$/i;
|
|
16699
|
+
ROUTES_RE = /(?:^|[\\/])(?:app\.)?routes\.ts$/i;
|
|
16700
|
+
SIDE_EFFECT_CALL_NAMES = new Set([
|
|
16701
|
+
"subscribe",
|
|
16702
|
+
"setInterval",
|
|
16703
|
+
"setTimeout",
|
|
16704
|
+
"addEventListener",
|
|
16705
|
+
"effect",
|
|
16706
|
+
"afterNextRender",
|
|
16707
|
+
"afterRender",
|
|
16708
|
+
"afterEveryRender",
|
|
16709
|
+
"requestAnimationFrame",
|
|
16710
|
+
"requestIdleCallback"
|
|
16711
|
+
]);
|
|
16712
|
+
SIDE_EFFECT_NEW_NAMES = new Set([
|
|
16713
|
+
"Worker",
|
|
16714
|
+
"SharedWorker",
|
|
16715
|
+
"EventSource",
|
|
16716
|
+
"WebSocket",
|
|
16717
|
+
"BroadcastChannel"
|
|
16718
|
+
]);
|
|
16719
|
+
});
|
|
16720
|
+
|
|
16321
16721
|
// src/dev/moduleServer.ts
|
|
16322
16722
|
var exports_moduleServer = {};
|
|
16323
16723
|
__export(exports_moduleServer, {
|
|
@@ -16329,8 +16729,8 @@ __export(exports_moduleServer, {
|
|
|
16329
16729
|
createModuleServer: () => createModuleServer,
|
|
16330
16730
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16331
16731
|
});
|
|
16332
|
-
import { existsSync as
|
|
16333
|
-
import { basename as
|
|
16732
|
+
import { existsSync as existsSync25, readFileSync as readFileSync18, statSync as statSync2 } from "fs";
|
|
16733
|
+
import { basename as basename12, dirname as dirname16, extname as extname8, join as join27, resolve as resolve30, relative as relative11 } from "path";
|
|
16334
16734
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16335
16735
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16336
16736
|
const allExports = [];
|
|
@@ -16350,7 +16750,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
16350
16750
|
${stubs}
|
|
16351
16751
|
`;
|
|
16352
16752
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
16353
|
-
const found = extensions.find((ext) =>
|
|
16753
|
+
const found = extensions.find((ext) => existsSync25(resolve30(projectRoot, srcPath + ext)));
|
|
16354
16754
|
return found ? srcPath + found : srcPath;
|
|
16355
16755
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
16356
16756
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -16365,7 +16765,7 @@ ${stubs}
|
|
|
16365
16765
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
16366
16766
|
}, srcUrl = (relPath, projectRoot) => {
|
|
16367
16767
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
16368
|
-
const absPath =
|
|
16768
|
+
const absPath = resolve30(projectRoot, relPath);
|
|
16369
16769
|
const cached = mtimeCache.get(absPath);
|
|
16370
16770
|
if (cached !== undefined)
|
|
16371
16771
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -16377,12 +16777,12 @@ ${stubs}
|
|
|
16377
16777
|
return base;
|
|
16378
16778
|
}
|
|
16379
16779
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
16380
|
-
const absPath =
|
|
16780
|
+
const absPath = resolve30(fileDir, relPath);
|
|
16381
16781
|
const rel = relative11(projectRoot, absPath);
|
|
16382
16782
|
const extension = extname8(rel);
|
|
16383
16783
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
16384
16784
|
if (extname8(srcPath) === ".svelte") {
|
|
16385
|
-
srcPath = relative11(projectRoot, resolveSvelteModulePath(
|
|
16785
|
+
srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve30(projectRoot, srcPath)));
|
|
16386
16786
|
}
|
|
16387
16787
|
return srcUrl(srcPath, projectRoot);
|
|
16388
16788
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -16399,14 +16799,14 @@ ${stubs}
|
|
|
16399
16799
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
16400
16800
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
16401
16801
|
if (!subpath) {
|
|
16402
|
-
const pkgDir =
|
|
16403
|
-
const pkgJsonPath =
|
|
16404
|
-
if (
|
|
16405
|
-
const pkg = JSON.parse(
|
|
16802
|
+
const pkgDir = resolve30(projectRoot, "node_modules", packageName ?? "");
|
|
16803
|
+
const pkgJsonPath = join27(pkgDir, "package.json");
|
|
16804
|
+
if (existsSync25(pkgJsonPath)) {
|
|
16805
|
+
const pkg = JSON.parse(readFileSync18(pkgJsonPath, "utf-8"));
|
|
16406
16806
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
16407
16807
|
if (esmEntry) {
|
|
16408
|
-
const resolved =
|
|
16409
|
-
if (
|
|
16808
|
+
const resolved = resolve30(pkgDir, esmEntry);
|
|
16809
|
+
if (existsSync25(resolved))
|
|
16410
16810
|
return relative11(projectRoot, resolved);
|
|
16411
16811
|
}
|
|
16412
16812
|
}
|
|
@@ -16416,7 +16816,7 @@ ${stubs}
|
|
|
16416
16816
|
} catch {
|
|
16417
16817
|
return;
|
|
16418
16818
|
}
|
|
16419
|
-
},
|
|
16819
|
+
}, rewriteImports = (code, filePath, projectRoot, rewriter) => {
|
|
16420
16820
|
let result = code;
|
|
16421
16821
|
const vendorReplace = (_match, prefix, specifier, suffix) => {
|
|
16422
16822
|
const webPath = rewriter?.lookup.get(specifier);
|
|
@@ -16450,12 +16850,12 @@ ${stubs}
|
|
|
16450
16850
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
16451
16851
|
});
|
|
16452
16852
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
16453
|
-
const absPath =
|
|
16853
|
+
const absPath = resolve30(fileDir, relPath);
|
|
16454
16854
|
const rel = relative11(projectRoot, absPath);
|
|
16455
16855
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
16456
16856
|
});
|
|
16457
16857
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
16458
|
-
const absPath =
|
|
16858
|
+
const absPath = resolve30(fileDir, relPath);
|
|
16459
16859
|
const rel = relative11(projectRoot, absPath);
|
|
16460
16860
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
16461
16861
|
});
|
|
@@ -16501,7 +16901,7 @@ ${code}`;
|
|
|
16501
16901
|
reactFastRefreshWarningEmitted = true;
|
|
16502
16902
|
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.");
|
|
16503
16903
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
16504
|
-
const raw =
|
|
16904
|
+
const raw = readFileSync18(filePath, "utf-8");
|
|
16505
16905
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
16506
16906
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
16507
16907
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -16515,9 +16915,9 @@ ${transpiled}`;
|
|
|
16515
16915
|
const relPath = relative11(projectRoot, filePath).replace(/\\/g, "/");
|
|
16516
16916
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
16517
16917
|
transpiled += buildIslandMetadataExports(raw);
|
|
16518
|
-
return
|
|
16918
|
+
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
16519
16919
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
16520
|
-
const raw =
|
|
16920
|
+
const raw = readFileSync18(filePath, "utf-8");
|
|
16521
16921
|
const ext = extname8(filePath);
|
|
16522
16922
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
16523
16923
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -16531,7 +16931,7 @@ ${transpiled}`;
|
|
|
16531
16931
|
if (isTS) {
|
|
16532
16932
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
16533
16933
|
}
|
|
16534
|
-
transpiled =
|
|
16934
|
+
transpiled = rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
16535
16935
|
if (!vueDir || !filePath.startsWith(vueDir) || !isTS)
|
|
16536
16936
|
return transpiled;
|
|
16537
16937
|
const useExports = valueExports.filter((e) => e.startsWith("use"));
|
|
@@ -16683,7 +17083,7 @@ ${code}`;
|
|
|
16683
17083
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
16684
17084
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
16685
17085
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
16686
|
-
const raw =
|
|
17086
|
+
const raw = readFileSync18(filePath, "utf-8");
|
|
16687
17087
|
if (!svelteCompiler) {
|
|
16688
17088
|
svelteCompiler = await import("svelte/compiler");
|
|
16689
17089
|
}
|
|
@@ -16693,7 +17093,7 @@ ${code}`;
|
|
|
16693
17093
|
const source = isModule ? loweredSource.code : (await svelteCompiler.preprocess(loweredSource.code, createSvelteStylePreprocessor(stylePreprocessors))).code;
|
|
16694
17094
|
const enableAsync = loweredAwaitSource.transformed || loweredSource.transformed;
|
|
16695
17095
|
const code = isModule ? compileSvelteModule(source, filePath) : compileSvelteComponent(source, filePath, projectRoot, enableAsync);
|
|
16696
|
-
return
|
|
17096
|
+
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
16697
17097
|
}, compileVueTemplate = (descriptor, compiledScript, filePath, componentId) => {
|
|
16698
17098
|
const compiler = getLoadedVueCompiler();
|
|
16699
17099
|
const scriptContent = compiledScript.content;
|
|
@@ -16743,12 +17143,12 @@ export default __script__;`;
|
|
|
16743
17143
|
return `${cssInjection}
|
|
16744
17144
|
${code}`;
|
|
16745
17145
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
16746
|
-
const rawSource =
|
|
17146
|
+
const rawSource = readFileSync18(filePath, "utf-8");
|
|
16747
17147
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
16748
17148
|
if (!vueCompiler) {
|
|
16749
17149
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
16750
17150
|
}
|
|
16751
|
-
const fileName =
|
|
17151
|
+
const fileName = basename12(filePath, ".vue");
|
|
16752
17152
|
const componentId = fileName.toLowerCase();
|
|
16753
17153
|
const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
|
|
16754
17154
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -16764,9 +17164,9 @@ ${code}`;
|
|
|
16764
17164
|
code = await compileVueStyles(descriptor, filePath, componentId, code, stylePreprocessors);
|
|
16765
17165
|
code = tsTranspiler2.transformSync(code);
|
|
16766
17166
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
16767
|
-
return
|
|
17167
|
+
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
16768
17168
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
16769
|
-
const hmrBase = vueDir ?
|
|
17169
|
+
const hmrBase = vueDir ? resolve30(vueDir) : projectRoot;
|
|
16770
17170
|
const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
16771
17171
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
16772
17172
|
result += [
|
|
@@ -16781,11 +17181,11 @@ ${code}`;
|
|
|
16781
17181
|
`);
|
|
16782
17182
|
return result;
|
|
16783
17183
|
}, resolveSvelteModulePath = (path) => {
|
|
16784
|
-
if (
|
|
17184
|
+
if (existsSync25(path))
|
|
16785
17185
|
return path;
|
|
16786
|
-
if (
|
|
17186
|
+
if (existsSync25(`${path}.ts`))
|
|
16787
17187
|
return `${path}.ts`;
|
|
16788
|
-
if (
|
|
17188
|
+
if (existsSync25(`${path}.js`))
|
|
16789
17189
|
return `${path}.js`;
|
|
16790
17190
|
return path;
|
|
16791
17191
|
}, jsResponse = (body) => {
|
|
@@ -16798,7 +17198,7 @@ ${code}`;
|
|
|
16798
17198
|
}
|
|
16799
17199
|
});
|
|
16800
17200
|
}, handleCssRequest = (filePath) => {
|
|
16801
|
-
const raw =
|
|
17201
|
+
const raw = readFileSync18(filePath, "utf-8");
|
|
16802
17202
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
16803
17203
|
return [
|
|
16804
17204
|
`const style = document.createElement('style');`,
|
|
@@ -16925,13 +17325,13 @@ export default {};
|
|
|
16925
17325
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
16926
17326
|
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);`);
|
|
16927
17327
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
16928
|
-
const filePath =
|
|
17328
|
+
const filePath = resolve30(projectRoot, relPath);
|
|
16929
17329
|
const ext = extname8(filePath);
|
|
16930
17330
|
if (ext === ".svelte")
|
|
16931
17331
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
16932
17332
|
if (ext)
|
|
16933
17333
|
return { ext, filePath };
|
|
16934
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
17334
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync25(filePath + candidate));
|
|
16935
17335
|
if (!found)
|
|
16936
17336
|
return { ext, filePath };
|
|
16937
17337
|
const resolved = filePath + found;
|
|
@@ -16951,20 +17351,20 @@ export default {};
|
|
|
16951
17351
|
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
16952
17352
|
if (!TRANSPILABLE.has(ext))
|
|
16953
17353
|
return;
|
|
16954
|
-
const
|
|
16955
|
-
const resolvedVueDir = vueDir ?
|
|
17354
|
+
const stat3 = statSync2(filePath);
|
|
17355
|
+
const resolvedVueDir = vueDir ? resolve30(vueDir) : undefined;
|
|
16956
17356
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
16957
|
-
setTransformed(filePath, content,
|
|
17357
|
+
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
16958
17358
|
return jsResponse(content);
|
|
16959
17359
|
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
16960
|
-
const
|
|
17360
|
+
const stat3 = statSync2(filePath);
|
|
16961
17361
|
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
16962
|
-
setTransformed(filePath, content,
|
|
17362
|
+
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
16963
17363
|
return jsResponse(content);
|
|
16964
17364
|
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
16965
|
-
const
|
|
17365
|
+
const stat3 = statSync2(filePath);
|
|
16966
17366
|
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
16967
|
-
setTransformed(filePath, content,
|
|
17367
|
+
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
16968
17368
|
return jsResponse(content);
|
|
16969
17369
|
}, transformErrorResponse = (err) => {
|
|
16970
17370
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
@@ -16983,7 +17383,7 @@ export default {};
|
|
|
16983
17383
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
16984
17384
|
return;
|
|
16985
17385
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
16986
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
17386
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve30(projectRoot, relPath));
|
|
16987
17387
|
if (virtualCssResponse)
|
|
16988
17388
|
return virtualCssResponse;
|
|
16989
17389
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -16999,11 +17399,11 @@ export default {};
|
|
|
16999
17399
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
17000
17400
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
17001
17401
|
if (match[1])
|
|
17002
|
-
files.push(
|
|
17402
|
+
files.push(resolve30(projectRoot, match[1]));
|
|
17003
17403
|
}
|
|
17004
17404
|
return files;
|
|
17005
17405
|
}, invalidateModule = (filePath) => {
|
|
17006
|
-
const resolved =
|
|
17406
|
+
const resolved = resolve30(filePath);
|
|
17007
17407
|
invalidate(filePath);
|
|
17008
17408
|
if (resolved !== filePath)
|
|
17009
17409
|
invalidate(resolved);
|
|
@@ -17078,6 +17478,46 @@ var init_moduleServer = __esm(() => {
|
|
|
17078
17478
|
SRC_URL_PREFIX = SRC_PREFIX;
|
|
17079
17479
|
});
|
|
17080
17480
|
|
|
17481
|
+
// src/build/rewriteImports.ts
|
|
17482
|
+
var exports_rewriteImports = {};
|
|
17483
|
+
__export(exports_rewriteImports, {
|
|
17484
|
+
rewriteVendorDirectories: () => rewriteVendorDirectories2,
|
|
17485
|
+
rewriteImports: () => rewriteImports2
|
|
17486
|
+
});
|
|
17487
|
+
var rewriteImports2 = async (outputPaths, vendorPaths) => {
|
|
17488
|
+
const jsFiles = outputPaths.filter((path) => path.endsWith(".js"));
|
|
17489
|
+
if (jsFiles.length === 0)
|
|
17490
|
+
return;
|
|
17491
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
17492
|
+
return;
|
|
17493
|
+
await Promise.all(jsFiles.map(async (filePath) => {
|
|
17494
|
+
let original;
|
|
17495
|
+
try {
|
|
17496
|
+
original = await Bun.file(filePath).text();
|
|
17497
|
+
} catch (err) {
|
|
17498
|
+
const code = err.code;
|
|
17499
|
+
if (code === "ENOENT")
|
|
17500
|
+
return;
|
|
17501
|
+
throw err;
|
|
17502
|
+
}
|
|
17503
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
17504
|
+
if (rewritten === original)
|
|
17505
|
+
return;
|
|
17506
|
+
try {
|
|
17507
|
+
await Bun.write(filePath, rewritten);
|
|
17508
|
+
} catch (err) {
|
|
17509
|
+
const code = err.code;
|
|
17510
|
+
if (code === "ENOENT")
|
|
17511
|
+
return;
|
|
17512
|
+
throw err;
|
|
17513
|
+
}
|
|
17514
|
+
}));
|
|
17515
|
+
}, rewriteVendorDirectories2;
|
|
17516
|
+
var init_rewriteImports = __esm(() => {
|
|
17517
|
+
init_rewriteImportsPlugin();
|
|
17518
|
+
rewriteVendorDirectories2 = rewriteVendorDirectories;
|
|
17519
|
+
});
|
|
17520
|
+
|
|
17081
17521
|
// src/utils/ssrErrorPage.ts
|
|
17082
17522
|
var ssrErrorPage = (framework, error) => {
|
|
17083
17523
|
const frameworkColors2 = {
|
|
@@ -17209,11 +17649,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
17209
17649
|
__export(exports_simpleHTMLHMR, {
|
|
17210
17650
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
17211
17651
|
});
|
|
17212
|
-
import { resolve as
|
|
17652
|
+
import { resolve as resolve31 } from "path";
|
|
17213
17653
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
17214
17654
|
let htmlContent;
|
|
17215
17655
|
try {
|
|
17216
|
-
const resolvedPath =
|
|
17656
|
+
const resolvedPath = resolve31(htmlFilePath);
|
|
17217
17657
|
const file5 = Bun.file(resolvedPath);
|
|
17218
17658
|
if (!await file5.exists()) {
|
|
17219
17659
|
return null;
|
|
@@ -17239,11 +17679,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
17239
17679
|
__export(exports_simpleHTMXHMR, {
|
|
17240
17680
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
17241
17681
|
});
|
|
17242
|
-
import { resolve as
|
|
17682
|
+
import { resolve as resolve32 } from "path";
|
|
17243
17683
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
17244
17684
|
let htmlContent;
|
|
17245
17685
|
try {
|
|
17246
|
-
const resolvedPath =
|
|
17686
|
+
const resolvedPath = resolve32(htmxFilePath);
|
|
17247
17687
|
const file5 = Bun.file(resolvedPath);
|
|
17248
17688
|
if (!await file5.exists()) {
|
|
17249
17689
|
return null;
|
|
@@ -17265,8 +17705,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
17265
17705
|
var init_simpleHTMXHMR = () => {};
|
|
17266
17706
|
|
|
17267
17707
|
// src/dev/rebuildTrigger.ts
|
|
17268
|
-
import { existsSync as
|
|
17269
|
-
import { basename as
|
|
17708
|
+
import { existsSync as existsSync26 } from "fs";
|
|
17709
|
+
import { basename as basename13, dirname as dirname17, relative as relative12, resolve as resolve33 } from "path";
|
|
17270
17710
|
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) => {
|
|
17271
17711
|
if (!config.tailwind)
|
|
17272
17712
|
return;
|
|
@@ -17354,11 +17794,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17354
17794
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
17355
17795
|
}
|
|
17356
17796
|
return { ...parsed, framework: detectedFw };
|
|
17357
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
17797
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync26(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
17358
17798
|
state.fileHashes.delete(filePathInSet);
|
|
17359
17799
|
try {
|
|
17360
17800
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
17361
|
-
const deletedPathResolved =
|
|
17801
|
+
const deletedPathResolved = resolve33(filePathInSet);
|
|
17362
17802
|
affectedFiles.forEach((affectedFile) => {
|
|
17363
17803
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
17364
17804
|
validFiles.push(affectedFile);
|
|
@@ -17372,7 +17812,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17372
17812
|
if (!dependents || dependents.size === 0) {
|
|
17373
17813
|
return;
|
|
17374
17814
|
}
|
|
17375
|
-
const dependentFiles = Array.from(dependents).filter((file5) =>
|
|
17815
|
+
const dependentFiles = Array.from(dependents).filter((file5) => existsSync26(file5));
|
|
17376
17816
|
if (dependentFiles.length === 0) {
|
|
17377
17817
|
return;
|
|
17378
17818
|
}
|
|
@@ -17388,7 +17828,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17388
17828
|
try {
|
|
17389
17829
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
17390
17830
|
affectedFiles.forEach((affectedFile) => {
|
|
17391
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
17831
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync26(affectedFile)) {
|
|
17392
17832
|
validFiles.push(affectedFile);
|
|
17393
17833
|
processedFiles.add(affectedFile);
|
|
17394
17834
|
}
|
|
@@ -17402,7 +17842,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17402
17842
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
17403
17843
|
return;
|
|
17404
17844
|
}
|
|
17405
|
-
const normalizedFilePath =
|
|
17845
|
+
const normalizedFilePath = resolve33(filePathInSet);
|
|
17406
17846
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
17407
17847
|
validFiles.push(normalizedFilePath);
|
|
17408
17848
|
processedFiles.add(normalizedFilePath);
|
|
@@ -17413,7 +17853,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17413
17853
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
17414
17854
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
17415
17855
|
filePathSet.forEach((filePathInSet) => {
|
|
17416
|
-
if (!
|
|
17856
|
+
if (!existsSync26(filePathInSet)) {
|
|
17417
17857
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
17418
17858
|
return;
|
|
17419
17859
|
}
|
|
@@ -17506,7 +17946,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17506
17946
|
return;
|
|
17507
17947
|
}
|
|
17508
17948
|
if (framework === "unknown") {
|
|
17509
|
-
invalidate(
|
|
17949
|
+
invalidate(resolve33(filePath));
|
|
17510
17950
|
const relPath = relative12(process.cwd(), filePath);
|
|
17511
17951
|
logHmrUpdate(relPath);
|
|
17512
17952
|
return;
|
|
@@ -17550,12 +17990,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17550
17990
|
return componentFile;
|
|
17551
17991
|
}
|
|
17552
17992
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
17553
|
-
if (
|
|
17993
|
+
if (existsSync26(tsCounterpart)) {
|
|
17554
17994
|
return tsCounterpart;
|
|
17555
17995
|
}
|
|
17556
17996
|
if (!graph)
|
|
17557
17997
|
return componentFile;
|
|
17558
|
-
const dependents = graph.dependents.get(
|
|
17998
|
+
const dependents = graph.dependents.get(resolve33(componentFile));
|
|
17559
17999
|
if (!dependents)
|
|
17560
18000
|
return componentFile;
|
|
17561
18001
|
for (const dep of dependents) {
|
|
@@ -17564,7 +18004,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17564
18004
|
}
|
|
17565
18005
|
return componentFile;
|
|
17566
18006
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
17567
|
-
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") &&
|
|
18007
|
+
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve33(file5).startsWith(angularPagesPath));
|
|
17568
18008
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
17569
18009
|
return pageEntries;
|
|
17570
18010
|
}
|
|
@@ -17573,7 +18013,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17573
18013
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
17574
18014
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
17575
18015
|
affected.forEach((file5) => {
|
|
17576
|
-
if (file5.endsWith(".ts") &&
|
|
18016
|
+
if (file5.endsWith(".ts") && resolve33(file5).startsWith(angularPagesPath)) {
|
|
17577
18017
|
resolvedPages.add(file5);
|
|
17578
18018
|
}
|
|
17579
18019
|
});
|
|
@@ -17590,7 +18030,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17590
18030
|
const { commonAncestor: commonAncestor2 } = await Promise.resolve().then(() => (init_commonAncestor(), exports_commonAncestor));
|
|
17591
18031
|
return clientRoots.length === 1 ? clientRoots[0] ?? process.cwd() : commonAncestor2(clientRoots, process.cwd());
|
|
17592
18032
|
}, updateServerManifestEntry = (state, artifact) => {
|
|
17593
|
-
const fileWithHash =
|
|
18033
|
+
const fileWithHash = basename13(artifact.path);
|
|
17594
18034
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
17595
18035
|
if (!baseName) {
|
|
17596
18036
|
return;
|
|
@@ -17643,9 +18083,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17643
18083
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
17644
18084
|
Object.assign(state.manifest, clientManifest);
|
|
17645
18085
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
17646
|
-
}, broadcastAngularPageUpdates = (state, pagesToUpdate, manifest, startTime) => {
|
|
18086
|
+
}, broadcastAngularPageUpdates = (state, pagesToUpdate, manifest, startTime, classification) => {
|
|
17647
18087
|
pagesToUpdate.forEach((angularPagePath) => {
|
|
17648
|
-
const fileName =
|
|
18088
|
+
const fileName = basename13(angularPagePath);
|
|
17649
18089
|
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
17650
18090
|
const pascalName = toPascal(baseName);
|
|
17651
18091
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -17656,10 +18096,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17656
18096
|
data: {
|
|
17657
18097
|
cssBaseName: baseName,
|
|
17658
18098
|
cssUrl,
|
|
18099
|
+
editSourceFile: classification.sourceFile,
|
|
17659
18100
|
framework: "angular",
|
|
17660
18101
|
manifest,
|
|
18102
|
+
reason: classification.reason,
|
|
17661
18103
|
sourceFile: angularPagePath,
|
|
17662
|
-
updateType:
|
|
18104
|
+
updateType: classification.type
|
|
17663
18105
|
},
|
|
17664
18106
|
type: "angular-update"
|
|
17665
18107
|
});
|
|
@@ -17682,9 +18124,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17682
18124
|
await rewriteImports3(ssrPaths, angServerVendorPaths);
|
|
17683
18125
|
}
|
|
17684
18126
|
serverPaths.forEach((serverPath, idx) => {
|
|
17685
|
-
const fileBase =
|
|
18127
|
+
const fileBase = basename13(serverPath, ".js");
|
|
17686
18128
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
17687
|
-
state.manifest[toPascal(fileBase)] =
|
|
18129
|
+
state.manifest[toPascal(fileBase)] = resolve33(ssrPath);
|
|
17688
18130
|
});
|
|
17689
18131
|
if (clientPaths.length > 0) {
|
|
17690
18132
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
@@ -17693,9 +18135,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17693
18135
|
const angularDir = config.angularDirectory ?? "";
|
|
17694
18136
|
const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
|
|
17695
18137
|
for (const file5 of angularFiles) {
|
|
17696
|
-
state.fileHashes.set(
|
|
18138
|
+
state.fileHashes.set(resolve33(file5), computeFileHash(file5));
|
|
17697
18139
|
}
|
|
17698
|
-
const angularPagesPath =
|
|
18140
|
+
const angularPagesPath = resolve33(angularDir, "pages");
|
|
17699
18141
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
17700
18142
|
if (pageEntries.length > 0) {
|
|
17701
18143
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
@@ -17705,7 +18147,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17705
18147
|
const angularHmrFiles = angularFiles.filter((file5) => file5.endsWith(".ts") || file5.endsWith(".html"));
|
|
17706
18148
|
const angularPageFiles = angularHmrFiles.filter((file5) => file5.replace(/\\/g, "/").includes("/pages/"));
|
|
17707
18149
|
const pagesToUpdate = angularPageFiles.length > 0 ? angularPageFiles : pageEntries;
|
|
17708
|
-
|
|
18150
|
+
const classification = collapseClassifications(angularFiles.map(classifyAngularEdit));
|
|
18151
|
+
broadcastAngularPageUpdates(state, pagesToUpdate, manifest, startTime, classification);
|
|
17709
18152
|
onRebuildComplete({ hmrState: state, manifest });
|
|
17710
18153
|
return manifest;
|
|
17711
18154
|
}, getModuleUrl = async (pageFile) => {
|
|
@@ -17720,11 +18163,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17720
18163
|
if (isComponentFile2)
|
|
17721
18164
|
return primaryFile;
|
|
17722
18165
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
17723
|
-
const nearest = findNearestComponent2(
|
|
18166
|
+
const nearest = findNearestComponent2(resolve33(primaryFile));
|
|
17724
18167
|
return nearest ?? primaryFile;
|
|
17725
18168
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
17726
18169
|
for (const file5 of reactFiles) {
|
|
17727
|
-
state.fileHashes.set(
|
|
18170
|
+
state.fileHashes.set(resolve33(file5), computeFileHash(file5));
|
|
17728
18171
|
}
|
|
17729
18172
|
markSsrCacheDirty("react");
|
|
17730
18173
|
const primaryFile = reactFiles.find((file5) => !file5.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -17806,7 +18249,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17806
18249
|
});
|
|
17807
18250
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
17808
18251
|
for (const file5 of svelteFiles) {
|
|
17809
|
-
state.fileHashes.set(
|
|
18252
|
+
state.fileHashes.set(resolve33(file5), computeFileHash(file5));
|
|
17810
18253
|
}
|
|
17811
18254
|
markSsrCacheDirty("svelte");
|
|
17812
18255
|
const serverDuration = Date.now() - startTime;
|
|
@@ -17830,8 +18273,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17830
18273
|
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
|
|
17831
18274
|
const serverEntries = [...svelteServerPaths];
|
|
17832
18275
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
17833
|
-
const serverRoot =
|
|
17834
|
-
const serverOutDir =
|
|
18276
|
+
const serverRoot = resolve33(svelteDir, "generated", "server");
|
|
18277
|
+
const serverOutDir = resolve33(buildDir, basename13(svelteDir));
|
|
17835
18278
|
const [serverResult, clientResult] = await Promise.all([
|
|
17836
18279
|
serverEntries.length > 0 ? bunBuild9({
|
|
17837
18280
|
entrypoints: serverEntries,
|
|
@@ -17873,7 +18316,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17873
18316
|
const duration = Date.now() - startTime;
|
|
17874
18317
|
const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
|
|
17875
18318
|
broadcastFiles.forEach((sveltePagePath) => {
|
|
17876
|
-
const fileName =
|
|
18319
|
+
const fileName = basename13(sveltePagePath);
|
|
17877
18320
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
17878
18321
|
const pascalName = toPascal(baseName);
|
|
17879
18322
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -17928,7 +18371,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17928
18371
|
});
|
|
17929
18372
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
17930
18373
|
for (const file5 of [...vueFiles, ...nonVueFiles]) {
|
|
17931
|
-
state.fileHashes.set(
|
|
18374
|
+
state.fileHashes.set(resolve33(file5), computeFileHash(file5));
|
|
17932
18375
|
}
|
|
17933
18376
|
markSsrCacheDirty("vue");
|
|
17934
18377
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -17950,13 +18393,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17950
18393
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
17951
18394
|
return state.manifest;
|
|
17952
18395
|
}, EMBER_PAGE_EXTENSIONS, collectAllEmberPages = async (emberPagesPath) => {
|
|
17953
|
-
const { readdir:
|
|
18396
|
+
const { readdir: readdir5 } = await import("fs/promises");
|
|
17954
18397
|
try {
|
|
17955
|
-
const entries = await
|
|
18398
|
+
const entries = await readdir5(emberPagesPath, {
|
|
17956
18399
|
recursive: true,
|
|
17957
18400
|
withFileTypes: true
|
|
17958
18401
|
});
|
|
17959
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
18402
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve33(emberPagesPath, entry.name));
|
|
17960
18403
|
} catch {
|
|
17961
18404
|
return [];
|
|
17962
18405
|
}
|
|
@@ -17968,10 +18411,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17968
18411
|
return state.manifest;
|
|
17969
18412
|
}
|
|
17970
18413
|
for (const file5 of emberFiles) {
|
|
17971
|
-
state.fileHashes.set(
|
|
18414
|
+
state.fileHashes.set(resolve33(file5), computeFileHash(file5));
|
|
17972
18415
|
}
|
|
17973
|
-
const emberPagesPath =
|
|
17974
|
-
const directPageEntries = emberFiles.filter((file5) =>
|
|
18416
|
+
const emberPagesPath = resolve33(emberDir, "pages");
|
|
18417
|
+
const directPageEntries = emberFiles.filter((file5) => resolve33(file5).startsWith(emberPagesPath));
|
|
17975
18418
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
17976
18419
|
if (allPageEntries.length === 0) {
|
|
17977
18420
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -17980,8 +18423,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17980
18423
|
const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
|
|
17981
18424
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
17982
18425
|
for (const serverPath of serverPaths) {
|
|
17983
|
-
const fileBase =
|
|
17984
|
-
state.manifest[toPascal(fileBase)] =
|
|
18426
|
+
const fileBase = basename13(serverPath, ".js");
|
|
18427
|
+
state.manifest[toPascal(fileBase)] = resolve33(serverPath);
|
|
17985
18428
|
}
|
|
17986
18429
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
17987
18430
|
invalidateEmberSsrCache2();
|
|
@@ -18051,7 +18494,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18051
18494
|
});
|
|
18052
18495
|
}
|
|
18053
18496
|
}, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
|
|
18054
|
-
const scriptBaseName =
|
|
18497
|
+
const scriptBaseName = basename13(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
|
|
18055
18498
|
const pascalName = toPascal(scriptBaseName);
|
|
18056
18499
|
const scriptPath = manifest[pascalName] || null;
|
|
18057
18500
|
if (!scriptPath) {
|
|
@@ -18073,8 +18516,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18073
18516
|
if (!buildReference?.source) {
|
|
18074
18517
|
return;
|
|
18075
18518
|
}
|
|
18076
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
18077
|
-
islandFiles.add(
|
|
18519
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve33(dirname17(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
18520
|
+
islandFiles.add(resolve33(sourcePath));
|
|
18078
18521
|
}, resolveIslandSourceFiles = async (config) => {
|
|
18079
18522
|
const registryPath = config.islands?.registry;
|
|
18080
18523
|
if (!registryPath) {
|
|
@@ -18082,7 +18525,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18082
18525
|
}
|
|
18083
18526
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
18084
18527
|
const islandFiles = new Set([
|
|
18085
|
-
|
|
18528
|
+
resolve33(buildInfo.resolvedRegistryPath)
|
|
18086
18529
|
]);
|
|
18087
18530
|
for (const definition of buildInfo.definitions) {
|
|
18088
18531
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -18093,7 +18536,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18093
18536
|
if (islandFiles.size === 0) {
|
|
18094
18537
|
return false;
|
|
18095
18538
|
}
|
|
18096
|
-
return filesToRebuild.some((file5) => islandFiles.has(
|
|
18539
|
+
return filesToRebuild.some((file5) => islandFiles.has(resolve33(file5)));
|
|
18097
18540
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
18098
18541
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
18099
18542
|
if (!shouldReload) {
|
|
@@ -18128,10 +18571,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18128
18571
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
18129
18572
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
18130
18573
|
if (isSingle) {
|
|
18131
|
-
return
|
|
18574
|
+
return resolve33(state.resolvedPaths.buildDir, "pages");
|
|
18132
18575
|
}
|
|
18133
|
-
const dirName = framework === "html" ?
|
|
18134
|
-
return
|
|
18576
|
+
const dirName = framework === "html" ? basename13(config.htmlDirectory ?? "html") : basename13(config.htmxDirectory ?? "htmx");
|
|
18577
|
+
return resolve33(state.resolvedPaths.buildDir, dirName, "pages");
|
|
18135
18578
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
18136
18579
|
try {
|
|
18137
18580
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -18169,8 +18612,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18169
18612
|
const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
18170
18613
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
18171
18614
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
18172
|
-
const htmlPageName =
|
|
18173
|
-
const builtHtmlPagePath =
|
|
18615
|
+
const htmlPageName = basename13(pageFile);
|
|
18616
|
+
const builtHtmlPagePath = resolve33(outputHtmlPages, htmlPageName);
|
|
18174
18617
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
18175
18618
|
});
|
|
18176
18619
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -18178,7 +18621,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18178
18621
|
if (!cssFile) {
|
|
18179
18622
|
return;
|
|
18180
18623
|
}
|
|
18181
|
-
const cssBaseName =
|
|
18624
|
+
const cssBaseName = basename13(getStyleBaseName(cssFile));
|
|
18182
18625
|
const cssPascalName = toPascal(cssBaseName);
|
|
18183
18626
|
const cssKey = `${cssPascalName}CSS`;
|
|
18184
18627
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -18227,7 +18670,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18227
18670
|
type: "vue-update"
|
|
18228
18671
|
});
|
|
18229
18672
|
}, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
|
|
18230
|
-
const fileName =
|
|
18673
|
+
const fileName = basename13(vuePagePath);
|
|
18231
18674
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
18232
18675
|
const pascalName = toPascal(baseName);
|
|
18233
18676
|
const vueRoot = config.vueDirectory;
|
|
@@ -18235,7 +18678,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18235
18678
|
const cssKey = `${pascalName}CSS`;
|
|
18236
18679
|
const cssUrl = manifest[cssKey] || null;
|
|
18237
18680
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
18238
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
18681
|
+
const hmrMeta = vueHmrMetadata2.get(resolve33(vuePagePath));
|
|
18239
18682
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
18240
18683
|
if (changeType === "style-only") {
|
|
18241
18684
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -18273,7 +18716,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18273
18716
|
if (!cssFile) {
|
|
18274
18717
|
return;
|
|
18275
18718
|
}
|
|
18276
|
-
const cssBaseName =
|
|
18719
|
+
const cssBaseName = basename13(getStyleBaseName(cssFile));
|
|
18277
18720
|
const cssPascalName = toPascal(cssBaseName);
|
|
18278
18721
|
const cssKey = `${cssPascalName}CSS`;
|
|
18279
18722
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -18291,7 +18734,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18291
18734
|
});
|
|
18292
18735
|
}, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
|
|
18293
18736
|
try {
|
|
18294
|
-
const fileName =
|
|
18737
|
+
const fileName = basename13(sveltePagePath);
|
|
18295
18738
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
18296
18739
|
const pascalName = toPascal(baseName);
|
|
18297
18740
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -18353,7 +18796,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18353
18796
|
if (!cssFile) {
|
|
18354
18797
|
return;
|
|
18355
18798
|
}
|
|
18356
|
-
const cssBaseName =
|
|
18799
|
+
const cssBaseName = basename13(getStyleBaseName(cssFile));
|
|
18357
18800
|
const cssPascalName = toPascal(cssBaseName);
|
|
18358
18801
|
const cssKey = `${cssPascalName}CSS`;
|
|
18359
18802
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -18369,9 +18812,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18369
18812
|
},
|
|
18370
18813
|
type: "angular-update"
|
|
18371
18814
|
});
|
|
18372
|
-
}, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration) => {
|
|
18815
|
+
}, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration, classification) => {
|
|
18373
18816
|
try {
|
|
18374
|
-
const fileName =
|
|
18817
|
+
const fileName = basename13(angularPagePath);
|
|
18375
18818
|
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
18376
18819
|
const pascalName = toPascal(baseName);
|
|
18377
18820
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -18381,10 +18824,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18381
18824
|
data: {
|
|
18382
18825
|
cssBaseName: baseName,
|
|
18383
18826
|
cssUrl,
|
|
18827
|
+
editSourceFile: classification.sourceFile,
|
|
18384
18828
|
framework: "angular",
|
|
18385
18829
|
manifest,
|
|
18830
|
+
reason: classification.reason,
|
|
18386
18831
|
sourceFile: angularPagePath,
|
|
18387
|
-
updateType:
|
|
18832
|
+
updateType: classification.type
|
|
18388
18833
|
},
|
|
18389
18834
|
type: "angular-update"
|
|
18390
18835
|
});
|
|
@@ -18413,8 +18858,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18413
18858
|
handleAngularCssOnlyUpdate(state, angularCssFiles, manifest, duration);
|
|
18414
18859
|
return;
|
|
18415
18860
|
}
|
|
18861
|
+
const classification = collapseClassifications(angularFiles.map(classifyAngularEdit));
|
|
18416
18862
|
pagesToUpdate.forEach((angularPagePath) => {
|
|
18417
|
-
broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration);
|
|
18863
|
+
broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration, classification);
|
|
18418
18864
|
});
|
|
18419
18865
|
}, handleHTMXScriptHMR = (state, filesToRebuild, manifest, duration) => {
|
|
18420
18866
|
if (!state.resolvedPaths.htmxDir) {
|
|
@@ -18469,8 +18915,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18469
18915
|
const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
18470
18916
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
18471
18917
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
18472
|
-
const htmxPageName =
|
|
18473
|
-
const builtHtmxPagePath =
|
|
18918
|
+
const htmxPageName = basename13(htmxPageFile);
|
|
18919
|
+
const builtHtmxPagePath = resolve33(outputHtmxPages, htmxPageName);
|
|
18474
18920
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
18475
18921
|
});
|
|
18476
18922
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -18579,7 +19025,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18579
19025
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
18580
19026
|
writeFs(destPath, html);
|
|
18581
19027
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
18582
|
-
const destPath =
|
|
19028
|
+
const destPath = resolve33(outputDir, basename13(sourceFile));
|
|
18583
19029
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
18584
19030
|
const source = await Bun.file(sourceFile).text();
|
|
18585
19031
|
await Bun.write(destPath, source);
|
|
@@ -18825,6 +19271,7 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
18825
19271
|
init_compileTailwind();
|
|
18826
19272
|
init_tailwindCompiler();
|
|
18827
19273
|
init_ssrCache();
|
|
19274
|
+
init_editTypeDetection();
|
|
18828
19275
|
moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
18829
19276
|
getReactModuleUrl = getModuleUrl;
|
|
18830
19277
|
EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
|
|
@@ -18837,9 +19284,9 @@ __export(exports_buildDepVendor, {
|
|
|
18837
19284
|
computeDepVendorPaths: () => computeDepVendorPaths,
|
|
18838
19285
|
buildDepVendor: () => buildDepVendor
|
|
18839
19286
|
});
|
|
18840
|
-
import { mkdirSync as
|
|
18841
|
-
import { join as
|
|
18842
|
-
import { rm as
|
|
19287
|
+
import { mkdirSync as mkdirSync13 } from "fs";
|
|
19288
|
+
import { join as join28 } from "path";
|
|
19289
|
+
import { rm as rm10 } from "fs/promises";
|
|
18843
19290
|
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
18844
19291
|
var toSafeFileName6 = (specifier) => {
|
|
18845
19292
|
const prefix = specifier.startsWith("@") ? "_" : "";
|
|
@@ -18892,7 +19339,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18892
19339
|
framework: Array.from(framework).filter(isResolvable4)
|
|
18893
19340
|
};
|
|
18894
19341
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
18895
|
-
const { readFileSync:
|
|
19342
|
+
const { readFileSync: readFileSync19 } = await import("fs");
|
|
18896
19343
|
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
18897
19344
|
const newSpecs = new Set;
|
|
18898
19345
|
for (const spec of specs) {
|
|
@@ -18907,7 +19354,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18907
19354
|
}
|
|
18908
19355
|
let content;
|
|
18909
19356
|
try {
|
|
18910
|
-
content =
|
|
19357
|
+
content = readFileSync19(resolved, "utf-8");
|
|
18911
19358
|
} catch {
|
|
18912
19359
|
continue;
|
|
18913
19360
|
}
|
|
@@ -18949,24 +19396,57 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18949
19396
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
18950
19397
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
18951
19398
|
const safeName = toSafeFileName6(specifier);
|
|
18952
|
-
const entryPath =
|
|
19399
|
+
const entryPath = join28(tmpDir, `${safeName}.ts`);
|
|
18953
19400
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
18954
19401
|
return { entryPath, specifier };
|
|
18955
19402
|
}));
|
|
18956
19403
|
const isPrefixOrEqual = (candidate, current) => current === candidate || current.startsWith(`${candidate}/`);
|
|
18957
19404
|
const otherSpecsFor = (current) => specifiers.filter((spec) => !isPrefixOrEqual(spec, current));
|
|
18958
|
-
const
|
|
18959
|
-
|
|
18960
|
-
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
|
|
18968
|
-
|
|
18969
|
-
|
|
19405
|
+
const REQUIRE_CALL_RE = /__require\(\s*["']([^"']+)["']\s*\)/g;
|
|
19406
|
+
const MAX_INLINE_PASSES = 4;
|
|
19407
|
+
const buildEntryWithCjsRequireResolution = async (entryPath, specifier) => {
|
|
19408
|
+
const baseExternals = [
|
|
19409
|
+
...FRAMEWORK_EXTERNALS,
|
|
19410
|
+
...otherSpecsFor(specifier)
|
|
19411
|
+
];
|
|
19412
|
+
const externalsSet = new Set(baseExternals);
|
|
19413
|
+
let lastResult = null;
|
|
19414
|
+
for (let pass = 0;pass < MAX_INLINE_PASSES; pass++) {
|
|
19415
|
+
lastResult = await bunBuild9({
|
|
19416
|
+
entrypoints: [entryPath],
|
|
19417
|
+
external: [...externalsSet],
|
|
19418
|
+
format: "esm",
|
|
19419
|
+
minify: false,
|
|
19420
|
+
naming: "[name].[ext]",
|
|
19421
|
+
outdir: vendorDir,
|
|
19422
|
+
plugins: [createStripPureAnnotationsPlugin()],
|
|
19423
|
+
splitting: false,
|
|
19424
|
+
target: "browser",
|
|
19425
|
+
throw: false
|
|
19426
|
+
});
|
|
19427
|
+
if (!lastResult.success)
|
|
19428
|
+
return lastResult;
|
|
19429
|
+
const output = lastResult.outputs[0];
|
|
19430
|
+
if (!output)
|
|
19431
|
+
return lastResult;
|
|
19432
|
+
const text = await output.text();
|
|
19433
|
+
REQUIRE_CALL_RE.lastIndex = 0;
|
|
19434
|
+
const requiredSpecs = new Set;
|
|
19435
|
+
let match;
|
|
19436
|
+
while ((match = REQUIRE_CALL_RE.exec(text)) !== null) {
|
|
19437
|
+
const requiredSpec = match[1];
|
|
19438
|
+
if (requiredSpec && externalsSet.has(requiredSpec)) {
|
|
19439
|
+
requiredSpecs.add(requiredSpec);
|
|
19440
|
+
}
|
|
19441
|
+
}
|
|
19442
|
+
if (requiredSpecs.size === 0)
|
|
19443
|
+
return lastResult;
|
|
19444
|
+
for (const spec of requiredSpecs)
|
|
19445
|
+
externalsSet.delete(spec);
|
|
19446
|
+
}
|
|
19447
|
+
return lastResult;
|
|
19448
|
+
};
|
|
19449
|
+
const results = await Promise.all(entries.map(({ entryPath, specifier }) => buildEntryWithCjsRequireResolution(entryPath, specifier)));
|
|
18970
19450
|
const aggregated = {
|
|
18971
19451
|
success: results.every((result) => result.success),
|
|
18972
19452
|
logs: results.flatMap((result) => result.logs),
|
|
@@ -18977,10 +19457,10 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18977
19457
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
18978
19458
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
18979
19459
|
return {};
|
|
18980
|
-
const vendorDir =
|
|
18981
|
-
|
|
18982
|
-
const tmpDir =
|
|
18983
|
-
|
|
19460
|
+
const vendorDir = join28(buildDir, "vendor");
|
|
19461
|
+
mkdirSync13(vendorDir, { recursive: true });
|
|
19462
|
+
const tmpDir = join28(buildDir, "_dep_vendor_tmp");
|
|
19463
|
+
mkdirSync13(tmpDir, { recursive: true });
|
|
18984
19464
|
const allSpecs = new Set(initialSpecs);
|
|
18985
19465
|
const alreadyScanned = new Set;
|
|
18986
19466
|
let frontier = [...allSpecs, ...frameworkRoots];
|
|
@@ -18999,7 +19479,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
18999
19479
|
if (!success) {
|
|
19000
19480
|
console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
|
|
19001
19481
|
}
|
|
19002
|
-
await
|
|
19482
|
+
await rm10(tmpDir, { force: true, recursive: true });
|
|
19003
19483
|
const paths = {};
|
|
19004
19484
|
for (const specifier of allSpecs) {
|
|
19005
19485
|
paths[specifier] = `/vendor/${toSafeFileName6(specifier)}.js`;
|
|
@@ -19060,9 +19540,9 @@ var exports_devBuild = {};
|
|
|
19060
19540
|
__export(exports_devBuild, {
|
|
19061
19541
|
devBuild: () => devBuild
|
|
19062
19542
|
});
|
|
19063
|
-
import { readdir as
|
|
19543
|
+
import { readdir as readdir5 } from "fs/promises";
|
|
19064
19544
|
import { statSync as statSync3 } from "fs";
|
|
19065
|
-
import { resolve as
|
|
19545
|
+
import { resolve as resolve34 } from "path";
|
|
19066
19546
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
19067
19547
|
const configuredDirs = [
|
|
19068
19548
|
config.reactDirectory,
|
|
@@ -19085,7 +19565,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19085
19565
|
return Object.keys(config).length > 0 ? config : null;
|
|
19086
19566
|
}, reloadConfig = async () => {
|
|
19087
19567
|
try {
|
|
19088
|
-
const configPath2 =
|
|
19568
|
+
const configPath2 = resolve34(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
19089
19569
|
const source = await Bun.file(configPath2).text();
|
|
19090
19570
|
return parseDirectoryConfig(source);
|
|
19091
19571
|
} catch {
|
|
@@ -19170,7 +19650,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19170
19650
|
state.fileChangeQueue.clear();
|
|
19171
19651
|
}
|
|
19172
19652
|
}, handleCachedReload = async () => {
|
|
19173
|
-
const serverMtime = statSync3(
|
|
19653
|
+
const serverMtime = statSync3(resolve34(Bun.main)).mtimeMs;
|
|
19174
19654
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
19175
19655
|
globalThis.__hmrServerMtime = serverMtime;
|
|
19176
19656
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -19207,8 +19687,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19207
19687
|
return true;
|
|
19208
19688
|
}, resolveAbsoluteVersion2 = async () => {
|
|
19209
19689
|
const candidates = [
|
|
19210
|
-
|
|
19211
|
-
|
|
19690
|
+
resolve34(import.meta.dir, "..", "..", "package.json"),
|
|
19691
|
+
resolve34(import.meta.dir, "..", "package.json")
|
|
19212
19692
|
];
|
|
19213
19693
|
const [candidate, ...remaining] = candidates;
|
|
19214
19694
|
if (!candidate) {
|
|
@@ -19231,10 +19711,10 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19231
19711
|
await resolveAbsoluteVersionFromCandidates(remaining);
|
|
19232
19712
|
}, loadVendorFiles = async (assetStore, vendorDir, framework) => {
|
|
19233
19713
|
const emptyStringArray = [];
|
|
19234
|
-
const entries = await
|
|
19714
|
+
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
19235
19715
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
19236
19716
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
19237
|
-
const bytes = await Bun.file(
|
|
19717
|
+
const bytes = await Bun.file(resolve34(vendorDir, entry)).bytes();
|
|
19238
19718
|
assetStore.set(webPath, bytes);
|
|
19239
19719
|
}));
|
|
19240
19720
|
}, devBuild = async (config) => {
|
|
@@ -19275,7 +19755,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19275
19755
|
const sourceDirs = collectDepVendorSourceDirs(config);
|
|
19276
19756
|
if (config.angularDirectory) {
|
|
19277
19757
|
setAngularVendorPaths(await computeAngularVendorPathsAsync(sourceDirs));
|
|
19278
|
-
setAngularServerVendorPaths(await computeAngularServerVendorPathsAsync(state.resolvedPaths.buildDir, sourceDirs));
|
|
19279
19758
|
}
|
|
19280
19759
|
const { computeDepVendorPaths: computeDepVendorPaths2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
19281
19760
|
globalThis.__depVendorPaths = await computeDepVendorPaths2(sourceDirs);
|
|
@@ -19303,16 +19782,16 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19303
19782
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
19304
19783
|
recordStep("populate asset store", stepStartedAt);
|
|
19305
19784
|
stepStartedAt = performance.now();
|
|
19306
|
-
const reactVendorDir =
|
|
19307
|
-
const angularVendorDir =
|
|
19308
|
-
const svelteVendorDir =
|
|
19309
|
-
const vueVendorDir =
|
|
19310
|
-
const depVendorDir =
|
|
19785
|
+
const reactVendorDir = resolve34(state.resolvedPaths.buildDir, "react", "vendor");
|
|
19786
|
+
const angularVendorDir = resolve34(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
19787
|
+
const svelteVendorDir = resolve34(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
19788
|
+
const vueVendorDir = resolve34(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
19789
|
+
const depVendorDir = resolve34(state.resolvedPaths.buildDir, "vendor");
|
|
19311
19790
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
19312
|
-
const [, angularSpecs,
|
|
19791
|
+
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
19313
19792
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
19314
19793
|
config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir, sourceDirs, true, Object.keys(globalThis.__depVendorPaths ?? {})) : Promise.resolve(undefined),
|
|
19315
|
-
|
|
19794
|
+
Promise.resolve(undefined),
|
|
19316
19795
|
config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
19317
19796
|
config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
19318
19797
|
config.emberDirectory ? buildEmberVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -19320,9 +19799,6 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19320
19799
|
]);
|
|
19321
19800
|
if (angularSpecs)
|
|
19322
19801
|
globalThis.__angularVendorSpecifiers = angularSpecs;
|
|
19323
|
-
if (angularServerSpecs) {
|
|
19324
|
-
setAngularServerVendorPaths(computeAngularServerVendorPaths(state.resolvedPaths.buildDir, angularServerSpecs));
|
|
19325
|
-
}
|
|
19326
19802
|
if (config.emberDirectory) {
|
|
19327
19803
|
setEmberVendorPaths(computeEmberVendorPaths());
|
|
19328
19804
|
}
|
|
@@ -19343,8 +19819,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19343
19819
|
config.vueDirectory ? vueVendorDir : null,
|
|
19344
19820
|
depVendorDir
|
|
19345
19821
|
].filter((d2) => d2 !== null);
|
|
19346
|
-
const { rewriteVendorDirectories:
|
|
19347
|
-
await
|
|
19822
|
+
const { rewriteVendorDirectories: rewriteVendorDirectories3 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
19823
|
+
await rewriteVendorDirectories3(activeVendorDirs, combinedVendorPaths);
|
|
19348
19824
|
recordStep("rewrite vendor cross-references", stepStartedAt);
|
|
19349
19825
|
stepStartedAt = performance.now();
|
|
19350
19826
|
await Promise.all([
|
|
@@ -19388,7 +19864,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19388
19864
|
manifest
|
|
19389
19865
|
};
|
|
19390
19866
|
globalThis.__hmrDevResult = result;
|
|
19391
|
-
globalThis.__hmrServerMtime = statSync3(
|
|
19867
|
+
globalThis.__hmrServerMtime = statSync3(resolve34(Bun.main)).mtimeMs;
|
|
19392
19868
|
return result;
|
|
19393
19869
|
};
|
|
19394
19870
|
var init_devBuild = __esm(() => {
|
|
@@ -19561,17 +20037,17 @@ __export(exports_devtoolsJson, {
|
|
|
19561
20037
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
19562
20038
|
devtoolsJson: () => devtoolsJson
|
|
19563
20039
|
});
|
|
19564
|
-
import { existsSync as
|
|
19565
|
-
import { dirname as dirname18, join as
|
|
20040
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync14, readFileSync as readFileSync19, writeFileSync as writeFileSync9 } from "fs";
|
|
20041
|
+
import { dirname as dirname18, join as join29, resolve as resolve35 } from "path";
|
|
19566
20042
|
import { Elysia as Elysia3 } from "elysia";
|
|
19567
20043
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
19568
20044
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
19569
20045
|
return uuid;
|
|
19570
|
-
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) =>
|
|
19571
|
-
if (!
|
|
20046
|
+
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve35(uuidCachePath ?? join29(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
20047
|
+
if (!existsSync27(cachePath))
|
|
19572
20048
|
return null;
|
|
19573
20049
|
try {
|
|
19574
|
-
const value =
|
|
20050
|
+
const value = readFileSync19(cachePath, "utf-8").trim();
|
|
19575
20051
|
return isUuidV4(value) ? value : null;
|
|
19576
20052
|
} catch {
|
|
19577
20053
|
return null;
|
|
@@ -19589,11 +20065,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
19589
20065
|
if (cachedUuid)
|
|
19590
20066
|
return setGlobalUuid(cachedUuid);
|
|
19591
20067
|
const uuid = crypto.randomUUID();
|
|
19592
|
-
|
|
19593
|
-
|
|
20068
|
+
mkdirSync14(dirname18(cachePath), { recursive: true });
|
|
20069
|
+
writeFileSync9(cachePath, uuid, "utf-8");
|
|
19594
20070
|
return setGlobalUuid(uuid);
|
|
19595
20071
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
19596
|
-
const rootPath =
|
|
20072
|
+
const rootPath = resolve35(options.projectRoot ?? process.cwd());
|
|
19597
20073
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
19598
20074
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
19599
20075
|
return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -19606,11 +20082,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
19606
20082
|
if (process.env.WSL_DISTRO_NAME) {
|
|
19607
20083
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
19608
20084
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
19609
|
-
return
|
|
20085
|
+
return join29("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
19610
20086
|
}
|
|
19611
20087
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
19612
20088
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
19613
|
-
return
|
|
20089
|
+
return join29("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
19614
20090
|
}
|
|
19615
20091
|
return root;
|
|
19616
20092
|
};
|
|
@@ -19621,13 +20097,13 @@ var exports_imageOptimizer = {};
|
|
|
19621
20097
|
__export(exports_imageOptimizer, {
|
|
19622
20098
|
imageOptimizer: () => imageOptimizer
|
|
19623
20099
|
});
|
|
19624
|
-
import { existsSync as
|
|
19625
|
-
import { resolve as
|
|
20100
|
+
import { existsSync as existsSync28 } from "fs";
|
|
20101
|
+
import { resolve as resolve36 } from "path";
|
|
19626
20102
|
import { Elysia as Elysia4 } from "elysia";
|
|
19627
20103
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
19628
20104
|
try {
|
|
19629
20105
|
const resolved = validateSafePath(path, baseDir);
|
|
19630
|
-
if (
|
|
20106
|
+
if (existsSync28(resolved))
|
|
19631
20107
|
return resolved;
|
|
19632
20108
|
return null;
|
|
19633
20109
|
} catch {
|
|
@@ -19635,7 +20111,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
19635
20111
|
}
|
|
19636
20112
|
}, resolveLocalImage = (url, buildDir) => {
|
|
19637
20113
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
19638
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
20114
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve36(process.cwd()));
|
|
19639
20115
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
19640
20116
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
19641
20117
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -19926,15 +20402,15 @@ __export(exports_prerender, {
|
|
|
19926
20402
|
prerender: () => prerender,
|
|
19927
20403
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
19928
20404
|
});
|
|
19929
|
-
import { mkdirSync as
|
|
19930
|
-
import { join as
|
|
20405
|
+
import { mkdirSync as mkdirSync15, readFileSync as readFileSync20 } from "fs";
|
|
20406
|
+
import { join as join30 } from "path";
|
|
19931
20407
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
19932
20408
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
19933
20409
|
await Bun.write(metaPath, String(Date.now()));
|
|
19934
20410
|
}, readTimestamp = (htmlPath) => {
|
|
19935
20411
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
19936
20412
|
try {
|
|
19937
|
-
const content =
|
|
20413
|
+
const content = readFileSync20(metaPath, "utf-8");
|
|
19938
20414
|
return Number(content) || 0;
|
|
19939
20415
|
} catch {
|
|
19940
20416
|
return 0;
|
|
@@ -19993,7 +20469,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
19993
20469
|
return false;
|
|
19994
20470
|
const html = await res.text();
|
|
19995
20471
|
const fileName = routeToFilename(route);
|
|
19996
|
-
const filePath =
|
|
20472
|
+
const filePath = join30(prerenderDir, fileName);
|
|
19997
20473
|
await Bun.write(filePath, html);
|
|
19998
20474
|
await writeTimestamp(filePath);
|
|
19999
20475
|
return true;
|
|
@@ -20019,14 +20495,14 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
20019
20495
|
}
|
|
20020
20496
|
const html = await res.text();
|
|
20021
20497
|
const fileName = routeToFilename(route);
|
|
20022
|
-
const filePath =
|
|
20498
|
+
const filePath = join30(prerenderDir, fileName);
|
|
20023
20499
|
await Bun.write(filePath, html);
|
|
20024
20500
|
await writeTimestamp(filePath);
|
|
20025
20501
|
result.routes.set(route, filePath);
|
|
20026
20502
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
20027
20503
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
20028
|
-
const prerenderDir =
|
|
20029
|
-
|
|
20504
|
+
const prerenderDir = join30(outDir, "_prerendered");
|
|
20505
|
+
mkdirSync15(prerenderDir, { recursive: true });
|
|
20030
20506
|
const baseUrl = `http://localhost:${port}`;
|
|
20031
20507
|
let routes;
|
|
20032
20508
|
if (staticConfig.routes === "all") {
|
|
@@ -20621,8 +21097,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
20621
21097
|
});
|
|
20622
21098
|
};
|
|
20623
21099
|
// src/core/prepare.ts
|
|
20624
|
-
import { existsSync as
|
|
20625
|
-
import { basename as
|
|
21100
|
+
import { existsSync as existsSync29, readdirSync, readFileSync as readFileSync21 } from "fs";
|
|
21101
|
+
import { basename as basename14, join as join31, relative as relative13, resolve as resolve37 } from "path";
|
|
20626
21102
|
import { Elysia as Elysia5 } from "elysia";
|
|
20627
21103
|
|
|
20628
21104
|
// src/utils/loadConfig.ts
|
|
@@ -21045,7 +21521,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
21045
21521
|
for (const { dir, pattern } of prewarmDirs) {
|
|
21046
21522
|
const glob = new Glob10(pattern);
|
|
21047
21523
|
const matches = [
|
|
21048
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
21524
|
+
...glob.scanSync({ absolute: true, cwd: resolve37(dir) })
|
|
21049
21525
|
];
|
|
21050
21526
|
files.push(...matches);
|
|
21051
21527
|
}
|
|
@@ -21081,8 +21557,8 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
21081
21557
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
21082
21558
|
if (!fileName)
|
|
21083
21559
|
continue;
|
|
21084
|
-
const srcPath =
|
|
21085
|
-
if (!
|
|
21560
|
+
const srcPath = resolve37(devIndexDir, fileName);
|
|
21561
|
+
if (!existsSync29(srcPath))
|
|
21086
21562
|
continue;
|
|
21087
21563
|
const rel = relative13(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
21088
21564
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
@@ -21154,7 +21630,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
21154
21630
|
stepStartedAt = performance.now();
|
|
21155
21631
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
21156
21632
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
21157
|
-
const devIndexDir =
|
|
21633
|
+
const devIndexDir = resolve37(buildDir, "_src_indexes");
|
|
21158
21634
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
21159
21635
|
recordStep("configure dev plugins", stepStartedAt);
|
|
21160
21636
|
stepStartedAt = performance.now();
|
|
@@ -21190,20 +21666,20 @@ var prepareDev = async (config, buildDir) => {
|
|
|
21190
21666
|
};
|
|
21191
21667
|
var loadPrerenderMap = (prerenderDir) => {
|
|
21192
21668
|
const map = new Map;
|
|
21193
|
-
if (!
|
|
21669
|
+
if (!existsSync29(prerenderDir))
|
|
21194
21670
|
return map;
|
|
21195
21671
|
let entries;
|
|
21196
21672
|
try {
|
|
21197
|
-
entries =
|
|
21673
|
+
entries = readdirSync(prerenderDir);
|
|
21198
21674
|
} catch {
|
|
21199
21675
|
return map;
|
|
21200
21676
|
}
|
|
21201
21677
|
for (const entry of entries) {
|
|
21202
21678
|
if (!entry.endsWith(".html"))
|
|
21203
21679
|
continue;
|
|
21204
|
-
const name =
|
|
21680
|
+
const name = basename14(entry, ".html");
|
|
21205
21681
|
const route = name === "index" ? "/" : `/${name}`;
|
|
21206
|
-
map.set(route,
|
|
21682
|
+
map.set(route, join31(prerenderDir, entry));
|
|
21207
21683
|
}
|
|
21208
21684
|
return map;
|
|
21209
21685
|
};
|
|
@@ -21235,7 +21711,7 @@ var prepare = async (configOrPath) => {
|
|
|
21235
21711
|
recordStep("load config", stepStartedAt);
|
|
21236
21712
|
const nodeEnv = process.env["NODE_ENV"];
|
|
21237
21713
|
const isDev3 = nodeEnv === "development";
|
|
21238
|
-
const buildDir =
|
|
21714
|
+
const buildDir = resolve37(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
21239
21715
|
if (isDev3) {
|
|
21240
21716
|
stepStartedAt = performance.now();
|
|
21241
21717
|
const result = await prepareDev(config, buildDir);
|
|
@@ -21244,7 +21720,7 @@ var prepare = async (configOrPath) => {
|
|
|
21244
21720
|
return result;
|
|
21245
21721
|
}
|
|
21246
21722
|
stepStartedAt = performance.now();
|
|
21247
|
-
const manifest = JSON.parse(
|
|
21723
|
+
const manifest = JSON.parse(readFileSync21(`${buildDir}/manifest.json`, "utf-8"));
|
|
21248
21724
|
setCurrentIslandManifest(manifest);
|
|
21249
21725
|
if (config.islands?.registry) {
|
|
21250
21726
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -21252,9 +21728,9 @@ var prepare = async (configOrPath) => {
|
|
|
21252
21728
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
21253
21729
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
21254
21730
|
stepStartedAt = performance.now();
|
|
21255
|
-
const conventionsPath =
|
|
21256
|
-
if (
|
|
21257
|
-
const conventions2 = JSON.parse(
|
|
21731
|
+
const conventionsPath = join31(buildDir, "conventions.json");
|
|
21732
|
+
if (existsSync29(conventionsPath)) {
|
|
21733
|
+
const conventions2 = JSON.parse(readFileSync21(conventionsPath, "utf-8"));
|
|
21258
21734
|
setConventions(conventions2);
|
|
21259
21735
|
}
|
|
21260
21736
|
recordStep("load production conventions", stepStartedAt);
|
|
@@ -21268,7 +21744,7 @@ var prepare = async (configOrPath) => {
|
|
|
21268
21744
|
});
|
|
21269
21745
|
recordStep("create static plugin", stepStartedAt);
|
|
21270
21746
|
stepStartedAt = performance.now();
|
|
21271
|
-
const prerenderDir =
|
|
21747
|
+
const prerenderDir = join31(buildDir, "_prerendered");
|
|
21272
21748
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
21273
21749
|
recordStep("load prerender map", stepStartedAt);
|
|
21274
21750
|
if (prerenderMap.size > 0) {
|
|
@@ -21326,18 +21802,18 @@ import { argv } from "process";
|
|
|
21326
21802
|
var {env: env4 } = globalThis.Bun;
|
|
21327
21803
|
|
|
21328
21804
|
// src/dev/devCert.ts
|
|
21329
|
-
import { existsSync as
|
|
21330
|
-
import { join as
|
|
21331
|
-
var CERT_DIR =
|
|
21332
|
-
var CERT_PATH =
|
|
21333
|
-
var KEY_PATH =
|
|
21805
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync16, readFileSync as readFileSync22, rmSync as rmSync3 } from "fs";
|
|
21806
|
+
import { join as join32 } from "path";
|
|
21807
|
+
var CERT_DIR = join32(process.cwd(), ".absolutejs");
|
|
21808
|
+
var CERT_PATH = join32(CERT_DIR, "cert.pem");
|
|
21809
|
+
var KEY_PATH = join32(CERT_DIR, "key.pem");
|
|
21334
21810
|
var CERT_VALIDITY_DAYS = 365;
|
|
21335
21811
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
21336
21812
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
21337
|
-
var certFilesExist = () =>
|
|
21813
|
+
var certFilesExist = () => existsSync30(CERT_PATH) && existsSync30(KEY_PATH);
|
|
21338
21814
|
var isCertExpired = () => {
|
|
21339
21815
|
try {
|
|
21340
|
-
const certPem =
|
|
21816
|
+
const certPem = readFileSync22(CERT_PATH, "utf-8");
|
|
21341
21817
|
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
21342
21818
|
stdin: new TextEncoder().encode(certPem)
|
|
21343
21819
|
});
|
|
@@ -21411,7 +21887,7 @@ var generateCert = () => {
|
|
|
21411
21887
|
}
|
|
21412
21888
|
};
|
|
21413
21889
|
var ensureDevCert = () => {
|
|
21414
|
-
|
|
21890
|
+
mkdirSync16(CERT_DIR, { recursive: true });
|
|
21415
21891
|
if (hasCert()) {
|
|
21416
21892
|
return { cert: CERT_PATH, key: KEY_PATH };
|
|
21417
21893
|
}
|
|
@@ -21433,8 +21909,8 @@ var loadDevCert = () => {
|
|
|
21433
21909
|
return null;
|
|
21434
21910
|
try {
|
|
21435
21911
|
return {
|
|
21436
|
-
cert:
|
|
21437
|
-
key:
|
|
21912
|
+
cert: readFileSync22(paths.cert, "utf-8"),
|
|
21913
|
+
key: readFileSync22(paths.key, "utf-8")
|
|
21438
21914
|
};
|
|
21439
21915
|
} catch {
|
|
21440
21916
|
return null;
|
|
@@ -21461,8 +21937,8 @@ var getLocalIPAddress = () => {
|
|
|
21461
21937
|
|
|
21462
21938
|
// src/plugins/networking.ts
|
|
21463
21939
|
init_startupBanner();
|
|
21464
|
-
var host = env4.HOST ?? "localhost";
|
|
21465
|
-
var port = env4.PORT ?? DEFAULT_PORT;
|
|
21940
|
+
var host = env4.ABSOLUTE_HOST ?? env4.HOST ?? "localhost";
|
|
21941
|
+
var port = env4.ABSOLUTE_PORT ?? env4.PORT ?? DEFAULT_PORT;
|
|
21466
21942
|
var visibility = env4.ABSOLUTE_WORKSPACE_SERVICE_VISIBILITY ?? "public";
|
|
21467
21943
|
var managedByWorkspace = env4.ABSOLUTE_WORKSPACE_MANAGED === "1";
|
|
21468
21944
|
var localIP;
|
|
@@ -21662,8 +22138,8 @@ var jsonLd2 = (schema) => {
|
|
|
21662
22138
|
};
|
|
21663
22139
|
// src/utils/defineEnv.ts
|
|
21664
22140
|
var {env: bunEnv } = globalThis.Bun;
|
|
21665
|
-
import { existsSync as
|
|
21666
|
-
import { resolve as
|
|
22141
|
+
import { existsSync as existsSync31, readFileSync as readFileSync23 } from "fs";
|
|
22142
|
+
import { resolve as resolve38 } from "path";
|
|
21667
22143
|
|
|
21668
22144
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
21669
22145
|
var exports_value = {};
|
|
@@ -27698,19 +28174,19 @@ ${lines.join(`
|
|
|
27698
28174
|
};
|
|
27699
28175
|
var checkEnvFileSecurity = (properties) => {
|
|
27700
28176
|
const cwd2 = process.cwd();
|
|
27701
|
-
const envPath =
|
|
27702
|
-
if (!
|
|
28177
|
+
const envPath = resolve38(cwd2, ".env");
|
|
28178
|
+
if (!existsSync31(envPath))
|
|
27703
28179
|
return;
|
|
27704
28180
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
27705
28181
|
if (sensitiveKeys.length === 0)
|
|
27706
28182
|
return;
|
|
27707
|
-
const envContent =
|
|
28183
|
+
const envContent = readFileSync23(envPath, "utf-8");
|
|
27708
28184
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
27709
28185
|
if (presentKeys.length === 0)
|
|
27710
28186
|
return;
|
|
27711
|
-
const gitignorePath =
|
|
27712
|
-
if (
|
|
27713
|
-
const gitignore =
|
|
28187
|
+
const gitignorePath = resolve38(cwd2, ".gitignore");
|
|
28188
|
+
if (existsSync31(gitignorePath)) {
|
|
28189
|
+
const gitignore = readFileSync23(gitignorePath, "utf-8");
|
|
27714
28190
|
if (gitignore.split(`
|
|
27715
28191
|
`).some((line) => line.trim() === ".env"))
|
|
27716
28192
|
return;
|
|
@@ -27948,5 +28424,5 @@ export {
|
|
|
27948
28424
|
ANGULAR_INIT_TIMEOUT_MS
|
|
27949
28425
|
};
|
|
27950
28426
|
|
|
27951
|
-
//# debugId=
|
|
28427
|
+
//# debugId=2CFFDB2D0DFF83A964756E2164756E21
|
|
27952
28428
|
//# sourceMappingURL=index.js.map
|