@absolutejs/absolute 0.20.0-beta.65 → 0.20.0-beta.67
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/build.js +768 -544
- package/dist/build.js.map +10 -8
- package/dist/cli/index.js +148 -5
- package/dist/dev/serverBootstrap.js +544 -6
- package/dist/index.js +905 -619
- package/dist/index.js.map +14 -11
- package/dist/mobile/index.js +5430 -5
- package/dist/mobile/index.js.map +11 -8
- package/dist/mobile/mobilePreviewClient.ts +246 -0
- package/dist/mobile/remoteMacAgentEntry.js +241 -180
- package/dist/mobile/shellAuth.js +16 -0
- package/dist/mobile/shellBootstrap.js +5427 -117
- package/dist/mobile/shellExpoAuth.js +16 -0
- package/dist/mobile/shellExpoDevices.js +16 -0
- package/dist/mobile/shellExpoSync.js +16 -0
- package/dist/mobile/shellSync.js +16 -0
- package/dist/mobile/shellUpdate.js +16 -0
- package/dist/mobile/uiPrimitives.js +16 -0
- package/dist/src/build/chainInlineSourcemaps.d.ts +2 -0
- package/dist/src/build/vueCompileCache.d.ts +43 -0
- package/dist/src/cli/config/server.d.ts +1 -1
- package/dist/src/dev/bootLifecycle.d.ts +11 -0
- package/dist/src/dev/earlyListener.d.ts +41 -0
- package/dist/src/mobile/capacitorBundle.d.ts +8 -1
- package/dist/src/mobile/config.d.ts +6 -0
- package/dist/src/mobile/index.d.ts +1 -0
- package/dist/src/mobile/mobileInspect.d.ts +14 -0
- package/dist/src/mobile/mobilePreview.d.ts +1 -1
- package/dist/src/mobile/shellBootstrap.d.ts +2 -0
- package/dist/src/mobile/shellObservability.d.ts +11 -0
- package/dist/src/mobile/transport.d.ts +6 -0
- package/dist/src/plugins/imageOptimizer.d.ts +1 -1
- package/dist/src/utils/startupTimings.d.ts +4 -0
- package/dist/types/build.d.ts +12 -0
- package/dist/types/globals.d.ts +15 -0
- package/package.json +9 -7
package/dist/index.js
CHANGED
|
@@ -9117,6 +9117,30 @@ var APP_ID_PATTERN, SCHEME_PATTERN, APPLE_APP_ID_PREFIX_PATTERN, CERTIFICATE_FIN
|
|
|
9117
9117
|
throw new TypeError("mobile.ios.version must contain one to three dot-separated integer components, for example 1.4.0.");
|
|
9118
9118
|
}
|
|
9119
9119
|
return normalized;
|
|
9120
|
+
}, normalizeObservability = (config, productionOrigin) => {
|
|
9121
|
+
if (!config.observability)
|
|
9122
|
+
return;
|
|
9123
|
+
const project = requireText(config.observability.project, "mobile.observability.project");
|
|
9124
|
+
if (project.length > 255)
|
|
9125
|
+
throw new TypeError("mobile.observability.project must not exceed 255 characters.");
|
|
9126
|
+
const environment = config.observability.environment?.trim();
|
|
9127
|
+
if (environment !== undefined && (!environment || environment.length > 64))
|
|
9128
|
+
throw new TypeError("mobile.observability.environment must contain 1 through 64 characters.");
|
|
9129
|
+
const sampleRate = config.observability.sampleRate ?? 1;
|
|
9130
|
+
if (!Number.isFinite(sampleRate) || sampleRate < 0 || sampleRate > 1)
|
|
9131
|
+
throw new TypeError("mobile.observability.sampleRate must be between 0 and 1.");
|
|
9132
|
+
const route = config.observability.route ?? "/api/observability/errors";
|
|
9133
|
+
if (!route.startsWith("/") || route.startsWith("//"))
|
|
9134
|
+
throw new TypeError("mobile.observability.route must be a root-relative trusted-server path.");
|
|
9135
|
+
const endpoint = new URL(route, `${productionOrigin}/`);
|
|
9136
|
+
if (endpoint.origin !== productionOrigin || endpoint.username || endpoint.password || endpoint.hash || endpoint.search)
|
|
9137
|
+
throw new TypeError("mobile.observability.route must remain on productionOrigin and cannot contain credentials, a query, or a fragment.");
|
|
9138
|
+
return {
|
|
9139
|
+
endpoint: endpoint.href,
|
|
9140
|
+
...environment ? { environment } : {},
|
|
9141
|
+
project,
|
|
9142
|
+
sampleRate
|
|
9143
|
+
};
|
|
9120
9144
|
}, normalizeCertificateFingerprints = (values) => [
|
|
9121
9145
|
...new Set((values ?? []).map((value) => requireText(value, "mobile.deepLinks.android.sha256CertificateFingerprints").replaceAll(":", "").toUpperCase()).map((value) => {
|
|
9122
9146
|
if (!CERTIFICATE_FINGERPRINT_PATTERN.test(value)) {
|
|
@@ -9271,6 +9295,7 @@ var APP_ID_PATTERN, SCHEME_PATTERN, APPLE_APP_ID_PREFIX_PATTERN, CERTIFICATE_FIN
|
|
|
9271
9295
|
throw new TypeError("mobile.deepLinks.scheme is not a valid URL scheme.");
|
|
9272
9296
|
}
|
|
9273
9297
|
const updates = normalizeUpdates(config, productionOrigin, projectRoot);
|
|
9298
|
+
const observability = normalizeObservability(config, productionOrigin);
|
|
9274
9299
|
return {
|
|
9275
9300
|
androidCertificateFingerprints: normalizeCertificateFingerprints(config.deepLinks?.android?.sha256CertificateFingerprints),
|
|
9276
9301
|
appId,
|
|
@@ -9285,6 +9310,7 @@ var APP_ID_PATTERN, SCHEME_PATTERN, APPLE_APP_ID_PREFIX_PATTERN, CERTIFICATE_FIN
|
|
|
9285
9310
|
...config.engine === "expo" ? { expoSdkVersion: config.expo?.sdkVersion ?? 57 } : {},
|
|
9286
9311
|
iosVersion: normalizeIosVersion(config.ios?.version),
|
|
9287
9312
|
nativeProjectDirectory: resolveProjectPath(projectRoot, config.nativeProject?.directory ?? (config.engine === "expo" ? ".absolutejs/mobile/expo" : "mobile"), "mobile.nativeProject.directory"),
|
|
9313
|
+
...observability ? { observability } : {},
|
|
9288
9314
|
platforms: normalizePlatforms(config.platforms),
|
|
9289
9315
|
productionOrigin,
|
|
9290
9316
|
pushAndroidGoogleServicesFile: resolveProjectPath(projectRoot, config.pushNotifications?.android?.googleServicesFile ?? "google-services.json", "mobile.pushNotifications.android.googleServicesFile"),
|
|
@@ -9923,7 +9949,7 @@ var init_getDurationString = __esm(() => {
|
|
|
9923
9949
|
});
|
|
9924
9950
|
|
|
9925
9951
|
// src/utils/startupTimings.ts
|
|
9926
|
-
var startupTimingsEnabled, formatStartupTimingBlock = (title, steps) => {
|
|
9952
|
+
var isTruthyFlag = (value) => value === "1" || value === "true", devProfileEnabled, startupTimingsEnabled, formatStartupTimingBlock = (title, steps) => {
|
|
9927
9953
|
const totalDuration = steps.reduce((sum, step) => sum + step.durationMs, 0);
|
|
9928
9954
|
return [
|
|
9929
9955
|
title,
|
|
@@ -9935,11 +9961,12 @@ var startupTimingsEnabled, formatStartupTimingBlock = (title, steps) => {
|
|
|
9935
9961
|
if (!startupTimingsEnabled || steps.length === 0) {
|
|
9936
9962
|
return;
|
|
9937
9963
|
}
|
|
9938
|
-
console.
|
|
9964
|
+
console.error(formatStartupTimingBlock(title, steps));
|
|
9939
9965
|
};
|
|
9940
9966
|
var init_startupTimings = __esm(() => {
|
|
9941
9967
|
init_getDurationString();
|
|
9942
|
-
|
|
9968
|
+
devProfileEnabled = isTruthyFlag(process.env.ABSOLUTE_DEV_PROFILE);
|
|
9969
|
+
startupTimingsEnabled = devProfileEnabled || isTruthyFlag(process.env.ABSOLUTE_STARTUP_TIMINGS);
|
|
9943
9970
|
});
|
|
9944
9971
|
|
|
9945
9972
|
// src/utils/startupBanner.ts
|
|
@@ -10087,6 +10114,37 @@ var init_logger = __esm(() => {
|
|
|
10087
10114
|
};
|
|
10088
10115
|
});
|
|
10089
10116
|
|
|
10117
|
+
// src/dev/bootLifecycle.ts
|
|
10118
|
+
var DEFERRED_TASK_FALLBACK_SECONDS = 15, setBootPhase = (phase) => {
|
|
10119
|
+
globalThis.__absoluteBootPhase = phase;
|
|
10120
|
+
}, runTask = async (task) => {
|
|
10121
|
+
try {
|
|
10122
|
+
await task();
|
|
10123
|
+
} catch (error) {
|
|
10124
|
+
console.error(`[dev] deferred boot task failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
10125
|
+
}
|
|
10126
|
+
}, deferUntilServing = (task) => {
|
|
10127
|
+
if (globalThis.__absoluteDeferredBootTasksRan) {
|
|
10128
|
+
runTask(task);
|
|
10129
|
+
return;
|
|
10130
|
+
}
|
|
10131
|
+
const queue = globalThis.__absoluteDeferredBootTasks ?? [];
|
|
10132
|
+
globalThis.__absoluteDeferredBootTasks = queue;
|
|
10133
|
+
queue.push(task);
|
|
10134
|
+
const timer = setTimeout(runDeferredBootTasks, DEFERRED_TASK_FALLBACK_SECONDS * MILLISECONDS_IN_A_SECOND);
|
|
10135
|
+
if (typeof timer === "object" && "unref" in timer)
|
|
10136
|
+
timer.unref();
|
|
10137
|
+
}, runDeferredBootTasks = () => {
|
|
10138
|
+
const tasks = globalThis.__absoluteDeferredBootTasks ?? [];
|
|
10139
|
+
globalThis.__absoluteDeferredBootTasks = [];
|
|
10140
|
+
globalThis.__absoluteDeferredBootTasksRan = true;
|
|
10141
|
+
for (const task of tasks)
|
|
10142
|
+
runTask(task);
|
|
10143
|
+
};
|
|
10144
|
+
var init_bootLifecycle = __esm(() => {
|
|
10145
|
+
init_constants();
|
|
10146
|
+
});
|
|
10147
|
+
|
|
10090
10148
|
// src/core/devRouteRegistrationCallsite.ts
|
|
10091
10149
|
var exports_devRouteRegistrationCallsite = {};
|
|
10092
10150
|
__export(exports_devRouteRegistrationCallsite, {
|
|
@@ -15403,6 +15461,7 @@ var exports_chainInlineSourcemaps = {};
|
|
|
15403
15461
|
__export(exports_chainInlineSourcemaps, {
|
|
15404
15462
|
buildLineRemap: () => buildLineRemap,
|
|
15405
15463
|
chainBundleInlineSourcemap: () => chainBundleInlineSourcemap,
|
|
15464
|
+
chainBundleInlineSourcemaps: () => chainBundleInlineSourcemaps,
|
|
15406
15465
|
chainExternalSourcemap: () => chainExternalSourcemap,
|
|
15407
15466
|
chainSourcemap: () => chainSourcemap,
|
|
15408
15467
|
inlineLineMapComment: () => inlineLineMapComment,
|
|
@@ -15716,6 +15775,10 @@ var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567
|
|
|
15716
15775
|
const inline = `
|
|
15717
15776
|
//# sourceMappingURL=data:application/json;base64,` + Buffer.from(JSON.stringify(chained)).toString("base64");
|
|
15718
15777
|
writeFileSync8(bundleFilePath, stripped + inline);
|
|
15778
|
+
}, chainBundleInlineSourcemaps = async (bundlePaths) => {
|
|
15779
|
+
for (const bundlePath of bundlePaths) {
|
|
15780
|
+
chainBundleInlineSourcemap(bundlePath);
|
|
15781
|
+
}
|
|
15719
15782
|
}, chainExternalSourcemap = (mapFilePath) => {
|
|
15720
15783
|
let outerMap;
|
|
15721
15784
|
try {
|
|
@@ -15809,6 +15872,98 @@ var init_vueAutoRouterTransform = __esm(() => {
|
|
|
15809
15872
|
SETUP_APP_FUNCTION_REGEX = /\bexport\s+(async\s+function|function)\s+setupApp\b/;
|
|
15810
15873
|
});
|
|
15811
15874
|
|
|
15875
|
+
// src/build/vueCompileCache.ts
|
|
15876
|
+
import { createHash as createHash9 } from "crypto";
|
|
15877
|
+
import {
|
|
15878
|
+
existsSync as existsSync26,
|
|
15879
|
+
mkdirSync as mkdirSync8,
|
|
15880
|
+
readFileSync as readFileSync25,
|
|
15881
|
+
renameSync,
|
|
15882
|
+
writeFileSync as writeFileSync9
|
|
15883
|
+
} from "fs";
|
|
15884
|
+
import { join as join37, resolve as resolve28 } from "path";
|
|
15885
|
+
var CACHE_DIR_NAME = "compile-cache", ABSOLUTE_CACHE_DIR_NAME2 = ".absolutejs", CACHE_FORMAT_VERSION = 1, FILE_NAME_HASH_LENGTH = 32, vueCompileCacheEnabled = () => process.env.ABSOLUTE_COMPILE_CACHE !== "0", hashContent = (content) => createHash9("sha256").update(content).digest("hex"), hashParts = (parts) => {
|
|
15886
|
+
const hash = createHash9("sha256");
|
|
15887
|
+
for (const part of parts) {
|
|
15888
|
+
hash.update(part);
|
|
15889
|
+
hash.update("\x00");
|
|
15890
|
+
}
|
|
15891
|
+
return hash.digest("hex");
|
|
15892
|
+
}, readOwnPackageVersion = () => {
|
|
15893
|
+
const candidates = [
|
|
15894
|
+
resolve28(import.meta.dir, "..", "..", "package.json"),
|
|
15895
|
+
resolve28(import.meta.dir, "..", "package.json")
|
|
15896
|
+
];
|
|
15897
|
+
for (const candidate of candidates) {
|
|
15898
|
+
try {
|
|
15899
|
+
const pkg = JSON.parse(readFileSync25(candidate, "utf-8"));
|
|
15900
|
+
if (pkg.name === "@absolutejs/absolute" && pkg.version) {
|
|
15901
|
+
return pkg.version;
|
|
15902
|
+
}
|
|
15903
|
+
} catch {}
|
|
15904
|
+
}
|
|
15905
|
+
return globalThis.__absoluteVersion ?? null;
|
|
15906
|
+
}, cachedFrameworkVersion, frameworkVersionForCache = () => {
|
|
15907
|
+
cachedFrameworkVersion ??= readOwnPackageVersion();
|
|
15908
|
+
return cachedFrameworkVersion;
|
|
15909
|
+
}, vueCompileCacheDir = (projectRoot = process.cwd()) => join37(projectRoot, ABSOLUTE_CACHE_DIR_NAME2, CACHE_DIR_NAME, "vue"), entryFileFor = (sourceFilePath, projectRoot) => join37(vueCompileCacheDir(projectRoot), `${hashContent(sourceFilePath).slice(0, FILE_NAME_HASH_LENGTH)}.json`), vueCompileCacheFingerprint = (parts) => {
|
|
15910
|
+
const frameworkVersion = frameworkVersionForCache();
|
|
15911
|
+
if (!frameworkVersion)
|
|
15912
|
+
return null;
|
|
15913
|
+
return hashParts([
|
|
15914
|
+
String(CACHE_FORMAT_VERSION),
|
|
15915
|
+
frameworkVersion,
|
|
15916
|
+
parts.compilerVersion ?? "unknown-vue-compiler",
|
|
15917
|
+
JSON.stringify(parts.stylePreprocessors ?? null),
|
|
15918
|
+
parts.vueRootDir,
|
|
15919
|
+
parts.outputDirs.client,
|
|
15920
|
+
parts.outputDirs.server,
|
|
15921
|
+
parts.outputDirs.css
|
|
15922
|
+
]);
|
|
15923
|
+
}, typeDepsUnchanged = (typeDeps) => {
|
|
15924
|
+
for (const [path, hash] of Object.entries(typeDeps)) {
|
|
15925
|
+
try {
|
|
15926
|
+
if (hashContent(readFileSync25(path, "utf-8")) !== hash)
|
|
15927
|
+
return false;
|
|
15928
|
+
} catch {
|
|
15929
|
+
return false;
|
|
15930
|
+
}
|
|
15931
|
+
}
|
|
15932
|
+
return true;
|
|
15933
|
+
}, isEntryShape = (value) => {
|
|
15934
|
+
if (!value || typeof value !== "object")
|
|
15935
|
+
return false;
|
|
15936
|
+
const entry = value;
|
|
15937
|
+
return typeof entry.key === "string" && typeof entry.clientCode === "string" && typeof entry.serverCode === "string" && typeof entry.result === "object" && entry.result !== null && typeof entry.typeDeps === "object" && entry.typeDeps !== null;
|
|
15938
|
+
}, readVueCompileCacheEntry = (sourceFilePath, key, projectRoot) => {
|
|
15939
|
+
if (!vueCompileCacheEnabled())
|
|
15940
|
+
return null;
|
|
15941
|
+
const entryFile = entryFileFor(sourceFilePath, projectRoot);
|
|
15942
|
+
if (!existsSync26(entryFile))
|
|
15943
|
+
return null;
|
|
15944
|
+
try {
|
|
15945
|
+
const parsed = JSON.parse(readFileSync25(entryFile, "utf-8"));
|
|
15946
|
+
if (!isEntryShape(parsed) || parsed.key !== key)
|
|
15947
|
+
return null;
|
|
15948
|
+
if (!typeDepsUnchanged(parsed.typeDeps))
|
|
15949
|
+
return null;
|
|
15950
|
+
return parsed;
|
|
15951
|
+
} catch {
|
|
15952
|
+
return null;
|
|
15953
|
+
}
|
|
15954
|
+
}, writeVueCompileCacheEntry = (sourceFilePath, entry, projectRoot) => {
|
|
15955
|
+
if (!vueCompileCacheEnabled())
|
|
15956
|
+
return;
|
|
15957
|
+
const entryFile = entryFileFor(sourceFilePath, projectRoot);
|
|
15958
|
+
try {
|
|
15959
|
+
mkdirSync8(vueCompileCacheDir(projectRoot), { recursive: true });
|
|
15960
|
+
const tempFile = `${entryFile}.${process.pid}.tmp`;
|
|
15961
|
+
writeFileSync9(tempFile, JSON.stringify(entry));
|
|
15962
|
+
renameSync(tempFile, entryFile);
|
|
15963
|
+
} catch {}
|
|
15964
|
+
};
|
|
15965
|
+
var init_vueCompileCache = () => {};
|
|
15966
|
+
|
|
15812
15967
|
// src/build/compileVue.ts
|
|
15813
15968
|
var exports_compileVue = {};
|
|
15814
15969
|
__export(exports_compileVue, {
|
|
@@ -15818,27 +15973,27 @@ __export(exports_compileVue, {
|
|
|
15818
15973
|
generateVueHmrId: () => generateVueHmrId,
|
|
15819
15974
|
vueHmrMetadata: () => vueHmrMetadata
|
|
15820
15975
|
});
|
|
15821
|
-
import { existsSync as
|
|
15976
|
+
import { existsSync as existsSync27, readFileSync as readFileSync26, realpathSync as realpathSync2 } from "fs";
|
|
15822
15977
|
import { mkdir as mkdir10 } from "fs/promises";
|
|
15823
15978
|
import {
|
|
15824
15979
|
basename as basename11,
|
|
15825
15980
|
dirname as dirname20,
|
|
15826
15981
|
isAbsolute as isAbsolute4,
|
|
15827
|
-
join as
|
|
15982
|
+
join as join38,
|
|
15828
15983
|
relative as relative13,
|
|
15829
|
-
resolve as
|
|
15984
|
+
resolve as resolve29
|
|
15830
15985
|
} from "path";
|
|
15831
15986
|
var {file: file3, write: write3, Transpiler: Transpiler3 } = globalThis.Bun;
|
|
15832
15987
|
var resolveDevClientDir3 = () => {
|
|
15833
15988
|
const projectRoot = process.cwd();
|
|
15834
|
-
const fromSource =
|
|
15835
|
-
if (
|
|
15989
|
+
const fromSource = resolve29(import.meta.dir, "../dev/client");
|
|
15990
|
+
if (existsSync27(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
15836
15991
|
return fromSource;
|
|
15837
15992
|
}
|
|
15838
|
-
const fromNodeModules =
|
|
15839
|
-
if (
|
|
15993
|
+
const fromNodeModules = resolve29(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
15994
|
+
if (existsSync27(fromNodeModules))
|
|
15840
15995
|
return fromNodeModules;
|
|
15841
|
-
return
|
|
15996
|
+
return resolve29(import.meta.dir, "./dev/client");
|
|
15842
15997
|
}, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
15843
15998
|
scriptCache.clear();
|
|
15844
15999
|
scriptSetupCache.clear();
|
|
@@ -15888,20 +16043,20 @@ var resolveDevClientDir3 = () => {
|
|
|
15888
16043
|
visited.add(resolved);
|
|
15889
16044
|
const importRegex = /@import\s+(?:url\(\s*)?(['"])(\.{1,2}\/[^'"]+)\1\s*\)?\s*;?/g;
|
|
15890
16045
|
return cssContent.replace(importRegex, (match, _quote, relPath) => {
|
|
15891
|
-
const importedPath =
|
|
15892
|
-
if (!
|
|
16046
|
+
const importedPath = resolve29(dirname20(cssFilePath), relPath);
|
|
16047
|
+
if (!existsSync27(importedPath))
|
|
15893
16048
|
return match;
|
|
15894
|
-
const importedContent =
|
|
16049
|
+
const importedContent = readFileSync26(importedPath, "utf-8");
|
|
15895
16050
|
return inlineCssImports(importedContent, importedPath, visited);
|
|
15896
16051
|
});
|
|
15897
16052
|
}, resolveHelperTsPath = (sourceDir, helper) => {
|
|
15898
16053
|
if (helper.endsWith(".ts"))
|
|
15899
|
-
return
|
|
15900
|
-
const direct =
|
|
15901
|
-
if (
|
|
16054
|
+
return resolve29(sourceDir, helper);
|
|
16055
|
+
const direct = resolve29(sourceDir, `${helper}.ts`);
|
|
16056
|
+
if (existsSync27(direct))
|
|
15902
16057
|
return direct;
|
|
15903
|
-
const indexed =
|
|
15904
|
-
if (
|
|
16058
|
+
const indexed = resolve29(sourceDir, helper, "index.ts");
|
|
16059
|
+
if (existsSync27(indexed))
|
|
15905
16060
|
return indexed;
|
|
15906
16061
|
return direct;
|
|
15907
16062
|
}, toJs = (filePath, sourceDir) => {
|
|
@@ -15911,16 +16066,16 @@ var resolveDevClientDir3 = () => {
|
|
|
15911
16066
|
return filePath.replace(/\.ts$/, ".js");
|
|
15912
16067
|
if (isStylePath(filePath)) {
|
|
15913
16068
|
if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
|
|
15914
|
-
return
|
|
16069
|
+
return resolve29(sourceDir, filePath);
|
|
15915
16070
|
}
|
|
15916
16071
|
return filePath;
|
|
15917
16072
|
}
|
|
15918
16073
|
if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
|
|
15919
|
-
const directTs =
|
|
15920
|
-
if (
|
|
16074
|
+
const directTs = resolve29(sourceDir, `${filePath}.ts`);
|
|
16075
|
+
if (existsSync27(directTs))
|
|
15921
16076
|
return `${filePath}.js`;
|
|
15922
|
-
const indexedTs =
|
|
15923
|
-
if (
|
|
16077
|
+
const indexedTs = resolve29(sourceDir, filePath, "index.ts");
|
|
16078
|
+
if (existsSync27(indexedTs))
|
|
15924
16079
|
return `${filePath}/index.js`;
|
|
15925
16080
|
}
|
|
15926
16081
|
return `${filePath}.js`;
|
|
@@ -15967,6 +16122,50 @@ const ${localName} = (source) => ${importedName}(
|
|
|
15967
16122
|
: { ...source, loader: () => __absoluteResolveAsyncVueComponent(source.loader) },
|
|
15968
16123
|
);`;
|
|
15969
16124
|
return code.replace(vueImportRegex, `import { ${specifiers.join(", ")} } from 'vue';${wrapper}`);
|
|
16125
|
+
}, EXTERNAL_STYLE_DEPENDENCY, hasExternalStyleDependency = (descriptor) => descriptor.styles.some((styleBlock) => Boolean(styleBlock.lang) || EXTERNAL_STYLE_DEPENDENCY.test(styleBlock.content)), fingerprintCache, currentVueCompileFingerprint = (compiler, outputDirs, vueRootDir, stylePreprocessors) => {
|
|
16126
|
+
const memoKey = JSON.stringify([outputDirs, vueRootDir, stylePreprocessors]);
|
|
16127
|
+
const memoised = fingerprintCache.get(memoKey);
|
|
16128
|
+
if (memoised !== undefined)
|
|
16129
|
+
return memoised;
|
|
16130
|
+
const fingerprint = vueCompileCacheFingerprint({
|
|
16131
|
+
compilerVersion: compiler.version,
|
|
16132
|
+
outputDirs,
|
|
16133
|
+
stylePreprocessors,
|
|
16134
|
+
vueRootDir
|
|
16135
|
+
});
|
|
16136
|
+
fingerprintCache.set(memoKey, fingerprint);
|
|
16137
|
+
return fingerprint;
|
|
16138
|
+
}, computeVueCompileCacheKey = (parts) => {
|
|
16139
|
+
if (!parts.fingerprint || !vueCompileCacheEnabled())
|
|
16140
|
+
return;
|
|
16141
|
+
if (hasExternalStyleDependency(parts.descriptor))
|
|
16142
|
+
return;
|
|
16143
|
+
const childKeys = [];
|
|
16144
|
+
for (const child of parts.childResults) {
|
|
16145
|
+
if (!child.cacheKey)
|
|
16146
|
+
return;
|
|
16147
|
+
childKeys.push(child.cacheKey);
|
|
16148
|
+
}
|
|
16149
|
+
return hashParts([
|
|
16150
|
+
parts.fingerprint,
|
|
16151
|
+
parts.relativeWithoutExtension,
|
|
16152
|
+
parts.isEntryPoint ? "entry" : "child",
|
|
16153
|
+
parts.contentHash,
|
|
16154
|
+
...childKeys
|
|
16155
|
+
]);
|
|
16156
|
+
}, materialiseVueCompileCacheEntry = async (entry, cacheKey2, isEntryPoint, outputDirs, fileBaseName) => {
|
|
16157
|
+
const { result } = entry;
|
|
16158
|
+
await mkdir10(dirname20(result.clientPath), { recursive: true });
|
|
16159
|
+
await mkdir10(dirname20(result.serverPath), { recursive: true });
|
|
16160
|
+
await write3(result.clientPath, entry.clientCode);
|
|
16161
|
+
await write3(result.serverPath, entry.serverCode);
|
|
16162
|
+
if (isEntryPoint && result.cssCodes.length > 0) {
|
|
16163
|
+
const cssOutputFile = join38(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
16164
|
+
await mkdir10(dirname20(cssOutputFile), { recursive: true });
|
|
16165
|
+
await write3(cssOutputFile, result.cssCodes.join(`
|
|
16166
|
+
`));
|
|
16167
|
+
}
|
|
16168
|
+
return { ...result, cacheKey: cacheKey2 };
|
|
15970
16169
|
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler, stylePreprocessors) => {
|
|
15971
16170
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
15972
16171
|
if (cachedResult)
|
|
@@ -15981,7 +16180,7 @@ const ${localName} = (source) => ${importedName}(
|
|
|
15981
16180
|
const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
|
|
15982
16181
|
const prevHash = vueSourceHashCache.get(sourceFilePath);
|
|
15983
16182
|
const persistent = persistentBuildCache.get(sourceFilePath);
|
|
15984
|
-
if (prevHash === contentHash && persistent &&
|
|
16183
|
+
if (prevHash === contentHash && persistent && existsSync27(persistent.clientPath) && existsSync27(persistent.serverPath)) {
|
|
15985
16184
|
cacheMap.set(sourceFilePath, persistent);
|
|
15986
16185
|
return persistent;
|
|
15987
16186
|
}
|
|
@@ -16010,25 +16209,55 @@ const ${localName} = (source) => ${importedName}(
|
|
|
16010
16209
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
16011
16210
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
16012
16211
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
16013
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute4(path)) && isStylePath(path)).map((path) => isAbsolute4(path) ? path :
|
|
16212
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute4(path)) && isStylePath(path)).map((path) => isAbsolute4(path) ? path : resolve29(dirname20(sourceFilePath), path));
|
|
16014
16213
|
for (const stylePath of stylePathsImported) {
|
|
16015
16214
|
addStyleImporter(sourceFilePath, stylePath);
|
|
16016
16215
|
}
|
|
16017
16216
|
const childBuildResults = await Promise.all([
|
|
16018
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
16217
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve29(dirname20(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
16019
16218
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
16020
16219
|
]);
|
|
16220
|
+
const cacheKey2 = computeVueCompileCacheKey({
|
|
16221
|
+
childResults: childBuildResults,
|
|
16222
|
+
contentHash,
|
|
16223
|
+
descriptor,
|
|
16224
|
+
fingerprint: currentVueCompileFingerprint(compiler, outputDirs, vueRootDir, stylePreprocessors),
|
|
16225
|
+
isEntryPoint,
|
|
16226
|
+
relativeWithoutExtension
|
|
16227
|
+
});
|
|
16228
|
+
const typeDepHashes = {};
|
|
16229
|
+
if (cacheKey2) {
|
|
16230
|
+
const restored = readVueCompileCacheEntry(sourceFilePath, cacheKey2);
|
|
16231
|
+
if (restored) {
|
|
16232
|
+
const result2 = await materialiseVueCompileCacheEntry(restored, cacheKey2, isEntryPoint, outputDirs, fileBaseName);
|
|
16233
|
+
cacheMap.set(sourceFilePath, result2);
|
|
16234
|
+
persistentBuildCache.set(sourceFilePath, result2);
|
|
16235
|
+
return result2;
|
|
16236
|
+
}
|
|
16237
|
+
}
|
|
16021
16238
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
16022
16239
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
16023
16240
|
fs: {
|
|
16024
|
-
fileExists:
|
|
16025
|
-
readFile: (file4) =>
|
|
16241
|
+
fileExists: existsSync27,
|
|
16242
|
+
readFile: (file4) => {
|
|
16243
|
+
if (!existsSync27(file4))
|
|
16244
|
+
return;
|
|
16245
|
+
const content = readFileSync26(file4, "utf-8");
|
|
16246
|
+
typeDepHashes[file4] = hashContent(content);
|
|
16247
|
+
return content;
|
|
16248
|
+
},
|
|
16026
16249
|
realpath: realpathSync2
|
|
16027
16250
|
},
|
|
16028
16251
|
id: componentId,
|
|
16029
16252
|
inlineTemplate: false,
|
|
16030
16253
|
sourceMap: true
|
|
16031
16254
|
}) : { bindings: {}, content: "export default {};", map: undefined };
|
|
16255
|
+
const typeDependencies = "deps" in compiledScript ? compiledScript.deps ?? [] : [];
|
|
16256
|
+
for (const dep of typeDependencies) {
|
|
16257
|
+
if (dep in typeDepHashes || !existsSync27(dep))
|
|
16258
|
+
continue;
|
|
16259
|
+
typeDepHashes[dep] = hashContent(readFileSync26(dep, "utf-8"));
|
|
16260
|
+
}
|
|
16032
16261
|
const strippedScript = stripExports2(compiledScript.content);
|
|
16033
16262
|
const sourceDir = dirname20(sourceFilePath);
|
|
16034
16263
|
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
|
|
@@ -16075,7 +16304,7 @@ const ${localName} = (source) => ${importedName}(
|
|
|
16075
16304
|
];
|
|
16076
16305
|
let cssOutputPaths = [];
|
|
16077
16306
|
if (isEntryPoint && allCss.length) {
|
|
16078
|
-
const cssOutputFile =
|
|
16307
|
+
const cssOutputFile = join38(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
16079
16308
|
await mkdir10(dirname20(cssOutputFile), { recursive: true });
|
|
16080
16309
|
await write3(cssOutputFile, allCss.join(`
|
|
16081
16310
|
`));
|
|
@@ -16106,8 +16335,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
16106
16335
|
};
|
|
16107
16336
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
16108
16337
|
const serverCode = wrapServerAsyncComponentLoader(assembleModule(generateRenderFunction(true), "ssrRender", false)) + islandMetadataExports;
|
|
16109
|
-
const clientOutputPath =
|
|
16110
|
-
const serverOutputPath =
|
|
16338
|
+
const clientOutputPath = join38(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
16339
|
+
const serverOutputPath = join38(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
16111
16340
|
const rewritePackageImports = (code, outputPath, mode) => {
|
|
16112
16341
|
let result2 = code;
|
|
16113
16342
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
@@ -16133,9 +16362,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
16133
16362
|
//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
|
|
16134
16363
|
`;
|
|
16135
16364
|
};
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16365
|
+
const clientOutput = clientFinal + inlineSourceMapFor(clientFinal);
|
|
16366
|
+
const serverOutput = serverFinal + inlineSourceMapFor(serverFinal);
|
|
16367
|
+
await write3(clientOutputPath, clientOutput);
|
|
16368
|
+
await write3(serverOutputPath, serverOutput);
|
|
16369
|
+
const cacheableResult = {
|
|
16139
16370
|
clientPath: clientOutputPath,
|
|
16140
16371
|
cssCodes: allCss,
|
|
16141
16372
|
cssPaths: cssOutputPaths,
|
|
@@ -16147,16 +16378,26 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
16147
16378
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
16148
16379
|
]
|
|
16149
16380
|
};
|
|
16381
|
+
const result = { ...cacheableResult, cacheKey: cacheKey2 };
|
|
16150
16382
|
cacheMap.set(sourceFilePath, result);
|
|
16151
16383
|
persistentBuildCache.set(sourceFilePath, result);
|
|
16384
|
+
if (cacheKey2) {
|
|
16385
|
+
writeVueCompileCacheEntry(sourceFilePath, {
|
|
16386
|
+
clientCode: clientOutput,
|
|
16387
|
+
key: cacheKey2,
|
|
16388
|
+
result: cacheableResult,
|
|
16389
|
+
serverCode: serverOutput,
|
|
16390
|
+
typeDeps: typeDepHashes
|
|
16391
|
+
});
|
|
16392
|
+
}
|
|
16152
16393
|
return result;
|
|
16153
16394
|
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors, ssrOnlyEntries) => {
|
|
16154
16395
|
const compiler = await loadVueCompiler();
|
|
16155
16396
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
16156
|
-
const clientOutputDir =
|
|
16157
|
-
const indexOutputDir =
|
|
16158
|
-
const serverOutputDir =
|
|
16159
|
-
const cssOutputDir =
|
|
16397
|
+
const clientOutputDir = join38(generatedDir, "client");
|
|
16398
|
+
const indexOutputDir = join38(generatedDir, "indexes");
|
|
16399
|
+
const serverOutputDir = join38(generatedDir, "server");
|
|
16400
|
+
const cssOutputDir = join38(generatedDir, "compiled");
|
|
16160
16401
|
await Promise.all([
|
|
16161
16402
|
mkdir10(clientOutputDir, { recursive: true }),
|
|
16162
16403
|
mkdir10(indexOutputDir, { recursive: true }),
|
|
@@ -16166,7 +16407,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
16166
16407
|
const buildCache = new Map;
|
|
16167
16408
|
const allTsHelperPaths = new Set;
|
|
16168
16409
|
const expandSpaRouteChildren = async (entries) => {
|
|
16169
|
-
const expanded = new Set(entries.map((entry) =>
|
|
16410
|
+
const expanded = new Set(entries.map((entry) => resolve29(entry)));
|
|
16170
16411
|
const queue2 = [...expanded];
|
|
16171
16412
|
while (queue2.length > 0) {
|
|
16172
16413
|
const entryPath = queue2.pop();
|
|
@@ -16183,8 +16424,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
16183
16424
|
});
|
|
16184
16425
|
const routes = parseVueSpaRoutes(descriptor.script?.content ?? "");
|
|
16185
16426
|
for (const { importPath } of routes) {
|
|
16186
|
-
const childPath =
|
|
16187
|
-
if (expanded.has(childPath) || !
|
|
16427
|
+
const childPath = resolve29(dirname20(entryPath), importPath);
|
|
16428
|
+
if (expanded.has(childPath) || !existsSync27(childPath)) {
|
|
16188
16429
|
continue;
|
|
16189
16430
|
}
|
|
16190
16431
|
expanded.add(childPath);
|
|
@@ -16195,7 +16436,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
16195
16436
|
};
|
|
16196
16437
|
const expandedEntryPoints = await expandSpaRouteChildren(entryPoints);
|
|
16197
16438
|
const compiledPages = await Promise.all(expandedEntryPoints.map(async (entryPath) => {
|
|
16198
|
-
const resolvedEntryPath =
|
|
16439
|
+
const resolvedEntryPath = resolve29(entryPath);
|
|
16199
16440
|
const result = await compileVueFile(resolvedEntryPath, {
|
|
16200
16441
|
client: clientOutputDir,
|
|
16201
16442
|
css: cssOutputDir,
|
|
@@ -16213,8 +16454,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
16213
16454
|
};
|
|
16214
16455
|
}
|
|
16215
16456
|
const entryBaseName = basename11(entryPath, ".vue");
|
|
16216
|
-
const indexOutputFile =
|
|
16217
|
-
const clientOutputFile =
|
|
16457
|
+
const indexOutputFile = join38(indexOutputDir, `${entryBaseName}.js`);
|
|
16458
|
+
const clientOutputFile = join38(clientOutputDir, relative13(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
16218
16459
|
await mkdir10(dirname20(indexOutputFile), { recursive: true });
|
|
16219
16460
|
const vueHmrImports = isDev2 ? [
|
|
16220
16461
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -16398,7 +16639,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
16398
16639
|
continue;
|
|
16399
16640
|
}
|
|
16400
16641
|
const resolved = resolveHelperTsPath(helperDir, dep);
|
|
16401
|
-
if (!
|
|
16642
|
+
if (!existsSync27(resolved))
|
|
16402
16643
|
continue;
|
|
16403
16644
|
if (allTsHelperPaths.has(resolved))
|
|
16404
16645
|
continue;
|
|
@@ -16411,8 +16652,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
16411
16652
|
const transpiledCode = transpiler4.transformSync(sourceCode);
|
|
16412
16653
|
const withMap = transpiledCode + inlineLineMapComment(tsPath, sourceCode, transpiledCode);
|
|
16413
16654
|
const relativeJsPath = relative13(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
16414
|
-
const outClientPath =
|
|
16415
|
-
const outServerPath =
|
|
16655
|
+
const outClientPath = join38(clientOutputDir, relativeJsPath);
|
|
16656
|
+
const outServerPath = join38(serverOutputDir, relativeJsPath);
|
|
16416
16657
|
await mkdir10(dirname20(outClientPath), { recursive: true });
|
|
16417
16658
|
await mkdir10(dirname20(outServerPath), { recursive: true });
|
|
16418
16659
|
await write3(outClientPath, withMap);
|
|
@@ -16443,8 +16684,9 @@ var init_compileVue = __esm(() => {
|
|
|
16443
16684
|
init_chainInlineSourcemaps();
|
|
16444
16685
|
init_vueAutoRouterTransform();
|
|
16445
16686
|
init_stylePreprocessor();
|
|
16687
|
+
init_vueCompileCache();
|
|
16446
16688
|
devClientDir3 = resolveDevClientDir3();
|
|
16447
|
-
hmrClientPath4 =
|
|
16689
|
+
hmrClientPath4 = join38(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
16448
16690
|
transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
|
|
16449
16691
|
scriptCache = new Map;
|
|
16450
16692
|
scriptSetupCache = new Map;
|
|
@@ -16453,6 +16695,8 @@ var init_compileVue = __esm(() => {
|
|
|
16453
16695
|
persistentBuildCache = new Map;
|
|
16454
16696
|
vueSourceHashCache = new Map;
|
|
16455
16697
|
vueHmrMetadata = new Map;
|
|
16698
|
+
EXTERNAL_STYLE_DEPENDENCY = /@(?:import|use|forward)\b/;
|
|
16699
|
+
fingerprintCache = new Map;
|
|
16456
16700
|
});
|
|
16457
16701
|
|
|
16458
16702
|
// src/angular/lowerDeferSyntax.ts
|
|
@@ -16925,8 +17169,8 @@ __export(exports_compileAngular, {
|
|
|
16925
17169
|
compileAngularFiles: () => compileAngularFiles,
|
|
16926
17170
|
invalidateAngularJitCache: () => invalidateAngularJitCache
|
|
16927
17171
|
});
|
|
16928
|
-
import { existsSync as
|
|
16929
|
-
import { join as
|
|
17172
|
+
import { existsSync as existsSync28, readFileSync as readFileSync27, promises as fs5 } from "fs";
|
|
17173
|
+
import { join as join39, basename as basename12, sep as sep3, dirname as dirname21, resolve as resolve30, relative as relative14 } from "path";
|
|
16930
17174
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
16931
17175
|
import ts14 from "typescript";
|
|
16932
17176
|
var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) => {
|
|
@@ -16942,10 +17186,10 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
16942
17186
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata2) : await fn2();
|
|
16943
17187
|
}, readTsconfigPathAliases = () => {
|
|
16944
17188
|
try {
|
|
16945
|
-
const configPath2 =
|
|
17189
|
+
const configPath2 = resolve30(process.cwd(), "tsconfig.json");
|
|
16946
17190
|
const config = ts14.readConfigFile(configPath2, ts14.sys.readFile).config;
|
|
16947
17191
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
16948
|
-
const baseUrl =
|
|
17192
|
+
const baseUrl = resolve30(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
16949
17193
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
16950
17194
|
return { aliases, baseUrl };
|
|
16951
17195
|
} catch {
|
|
@@ -16965,7 +17209,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
16965
17209
|
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
16966
17210
|
for (const replacement of alias.replacements) {
|
|
16967
17211
|
const candidate = replacement.replace("*", wildcardValue);
|
|
16968
|
-
const resolved = resolveSourceFile(
|
|
17212
|
+
const resolved = resolveSourceFile(resolve30(baseUrl, candidate));
|
|
16969
17213
|
if (resolved)
|
|
16970
17214
|
return resolved;
|
|
16971
17215
|
}
|
|
@@ -16977,20 +17221,20 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
16977
17221
|
`${candidate}.tsx`,
|
|
16978
17222
|
`${candidate}.js`,
|
|
16979
17223
|
`${candidate}.jsx`,
|
|
16980
|
-
|
|
16981
|
-
|
|
16982
|
-
|
|
16983
|
-
|
|
17224
|
+
join39(candidate, "index.ts"),
|
|
17225
|
+
join39(candidate, "index.tsx"),
|
|
17226
|
+
join39(candidate, "index.js"),
|
|
17227
|
+
join39(candidate, "index.jsx")
|
|
16984
17228
|
];
|
|
16985
|
-
return candidates.find((file4) =>
|
|
17229
|
+
return candidates.find((file4) => existsSync28(file4));
|
|
16986
17230
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
16987
|
-
const baseDir =
|
|
17231
|
+
const baseDir = resolve30(rootDir);
|
|
16988
17232
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
16989
17233
|
const transpiler5 = new Bun.Transpiler({ loader: "tsx" });
|
|
16990
17234
|
const scanCache = new Map;
|
|
16991
17235
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
16992
17236
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
16993
|
-
return resolveSourceFile(
|
|
17237
|
+
return resolveSourceFile(resolve30(fromDir, specifier));
|
|
16994
17238
|
}
|
|
16995
17239
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
16996
17240
|
if (aliased)
|
|
@@ -16999,7 +17243,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
16999
17243
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
17000
17244
|
if (resolved.includes("/node_modules/"))
|
|
17001
17245
|
return;
|
|
17002
|
-
const absolute =
|
|
17246
|
+
const absolute = resolve30(resolved);
|
|
17003
17247
|
if (!absolute.startsWith(baseDir))
|
|
17004
17248
|
return;
|
|
17005
17249
|
return resolveSourceFile(absolute);
|
|
@@ -17015,7 +17259,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17015
17259
|
usesLegacyAnimations: false
|
|
17016
17260
|
});
|
|
17017
17261
|
}
|
|
17018
|
-
const resolved =
|
|
17262
|
+
const resolved = resolve30(actualPath);
|
|
17019
17263
|
const cached = scanCache.get(resolved);
|
|
17020
17264
|
if (cached)
|
|
17021
17265
|
return cached;
|
|
@@ -17044,7 +17288,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17044
17288
|
const actualPath = resolveSourceFile(filePath);
|
|
17045
17289
|
if (!actualPath)
|
|
17046
17290
|
return false;
|
|
17047
|
-
const resolved =
|
|
17291
|
+
const resolved = resolve30(actualPath);
|
|
17048
17292
|
if (visited.has(resolved))
|
|
17049
17293
|
return false;
|
|
17050
17294
|
visited.add(resolved);
|
|
@@ -17062,14 +17306,14 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17062
17306
|
return (entryPath) => visit(entryPath);
|
|
17063
17307
|
}, resolveDevClientDir4 = () => {
|
|
17064
17308
|
const projectRoot = process.cwd();
|
|
17065
|
-
const fromSource =
|
|
17066
|
-
if (
|
|
17309
|
+
const fromSource = resolve30(import.meta.dir, "../dev/client");
|
|
17310
|
+
if (existsSync28(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
17067
17311
|
return fromSource;
|
|
17068
17312
|
}
|
|
17069
|
-
const fromNodeModules =
|
|
17070
|
-
if (
|
|
17313
|
+
const fromNodeModules = resolve30(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
17314
|
+
if (existsSync28(fromNodeModules))
|
|
17071
17315
|
return fromNodeModules;
|
|
17072
|
-
return
|
|
17316
|
+
return resolve30(import.meta.dir, "./dev/client");
|
|
17073
17317
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
17074
17318
|
try {
|
|
17075
17319
|
return ts14.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
@@ -17112,12 +17356,12 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17112
17356
|
if (hasJsLikeExtension(path))
|
|
17113
17357
|
return `${path}${query}`;
|
|
17114
17358
|
const importerDir = dirname21(importerOutputPath);
|
|
17115
|
-
const fileCandidate =
|
|
17116
|
-
if (outputFiles?.has(fileCandidate) ||
|
|
17359
|
+
const fileCandidate = resolve30(importerDir, `${path}.js`);
|
|
17360
|
+
if (outputFiles?.has(fileCandidate) || existsSync28(fileCandidate)) {
|
|
17117
17361
|
return `${path}.js${query}`;
|
|
17118
17362
|
}
|
|
17119
|
-
const indexCandidate =
|
|
17120
|
-
if (outputFiles?.has(indexCandidate) ||
|
|
17363
|
+
const indexCandidate = resolve30(importerDir, path, "index.js");
|
|
17364
|
+
if (outputFiles?.has(indexCandidate) || existsSync28(indexCandidate)) {
|
|
17121
17365
|
return `${path}/index.js${query}`;
|
|
17122
17366
|
}
|
|
17123
17367
|
return `${path}.js${query}`;
|
|
@@ -17144,18 +17388,18 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17144
17388
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
17145
17389
|
if (!isRelativeModuleSpecifier(specifier))
|
|
17146
17390
|
return null;
|
|
17147
|
-
const basePath =
|
|
17391
|
+
const basePath = resolve30(dirname21(fromFile), specifier);
|
|
17148
17392
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
17149
17393
|
`${basePath}.ts`,
|
|
17150
17394
|
`${basePath}.tsx`,
|
|
17151
17395
|
`${basePath}.mts`,
|
|
17152
17396
|
`${basePath}.cts`,
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
|
|
17156
|
-
|
|
17397
|
+
join39(basePath, "index.ts"),
|
|
17398
|
+
join39(basePath, "index.tsx"),
|
|
17399
|
+
join39(basePath, "index.mts"),
|
|
17400
|
+
join39(basePath, "index.cts")
|
|
17157
17401
|
];
|
|
17158
|
-
return candidates.map((candidate) =>
|
|
17402
|
+
return candidates.map((candidate) => resolve30(candidate)).find((candidate) => existsSync28(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
17159
17403
|
}, readFileForAotTransform = async (fileName, readFile9) => {
|
|
17160
17404
|
const hostSource = readFile9?.(fileName);
|
|
17161
17405
|
if (typeof hostSource === "string")
|
|
@@ -17179,18 +17423,18 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17179
17423
|
const paths = [];
|
|
17180
17424
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
17181
17425
|
if (templateUrlMatch?.[1])
|
|
17182
|
-
paths.push(
|
|
17426
|
+
paths.push(join39(fileDir, templateUrlMatch[1]));
|
|
17183
17427
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
17184
17428
|
if (styleUrlMatch?.[1])
|
|
17185
|
-
paths.push(
|
|
17429
|
+
paths.push(join39(fileDir, styleUrlMatch[1]));
|
|
17186
17430
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
17187
17431
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
17188
17432
|
if (urlMatches) {
|
|
17189
17433
|
for (const urlMatch of urlMatches) {
|
|
17190
|
-
paths.push(
|
|
17434
|
+
paths.push(join39(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
17191
17435
|
}
|
|
17192
17436
|
}
|
|
17193
|
-
return paths.map((path) =>
|
|
17437
|
+
return paths.map((path) => resolve30(path));
|
|
17194
17438
|
}, readResourceCacheFile = async (cachePath) => {
|
|
17195
17439
|
try {
|
|
17196
17440
|
const entry = JSON.parse(await fs5.readFile(cachePath, "utf-8"));
|
|
@@ -17221,7 +17465,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17221
17465
|
safeStableStringify(stylePreprocessors ?? null)
|
|
17222
17466
|
].join("\x00");
|
|
17223
17467
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
17224
|
-
return
|
|
17468
|
+
return join39(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
17225
17469
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile9, stylePreprocessors) => {
|
|
17226
17470
|
const transformedSources = new Map;
|
|
17227
17471
|
const visited = new Set;
|
|
@@ -17232,11 +17476,11 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17232
17476
|
transformedFiles: 0
|
|
17233
17477
|
};
|
|
17234
17478
|
const transformFile = async (filePath) => {
|
|
17235
|
-
const resolvedPath =
|
|
17479
|
+
const resolvedPath = resolve30(filePath);
|
|
17236
17480
|
if (visited.has(resolvedPath))
|
|
17237
17481
|
return;
|
|
17238
17482
|
visited.add(resolvedPath);
|
|
17239
|
-
if (!
|
|
17483
|
+
if (!existsSync28(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
17240
17484
|
return;
|
|
17241
17485
|
stats.filesVisited += 1;
|
|
17242
17486
|
const source = await readFileForAotTransform(resolvedPath, readFile9);
|
|
@@ -17267,10 +17511,10 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17267
17511
|
return { stats, transformedSources };
|
|
17268
17512
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
17269
17513
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
17270
|
-
const outputPath =
|
|
17514
|
+
const outputPath = resolve30(join39(outDir, relative14(process.cwd(), resolve30(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
17271
17515
|
return [
|
|
17272
17516
|
outputPath,
|
|
17273
|
-
buildIslandMetadataExports(
|
|
17517
|
+
buildIslandMetadataExports(readFileSync27(inputPath, "utf-8"))
|
|
17274
17518
|
];
|
|
17275
17519
|
})), { entries: inputPaths.length });
|
|
17276
17520
|
await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
|
|
@@ -17278,7 +17522,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17278
17522
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
17279
17523
|
const tsPath = __require.resolve("typescript");
|
|
17280
17524
|
const tsRootDir = dirname21(tsPath);
|
|
17281
|
-
return tsRootDir.endsWith("lib") ? tsRootDir :
|
|
17525
|
+
return tsRootDir.endsWith("lib") ? tsRootDir : resolve30(tsRootDir, "lib");
|
|
17282
17526
|
});
|
|
17283
17527
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
17284
17528
|
const options = {
|
|
@@ -17314,13 +17558,13 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17314
17558
|
const originalGetSourceFile = host2.getSourceFile;
|
|
17315
17559
|
host2.getSourceFile = (fileName, languageVersion, onError) => {
|
|
17316
17560
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
17317
|
-
const resolvedPath =
|
|
17561
|
+
const resolvedPath = join39(tsLibDir, fileName);
|
|
17318
17562
|
return originalGetSourceFile?.call(host2, resolvedPath, languageVersion, onError);
|
|
17319
17563
|
}
|
|
17320
17564
|
return originalGetSourceFile?.call(host2, fileName, languageVersion, onError);
|
|
17321
17565
|
};
|
|
17322
17566
|
const emitted = {};
|
|
17323
|
-
const resolvedOutDir =
|
|
17567
|
+
const resolvedOutDir = resolve30(outDir);
|
|
17324
17568
|
host2.writeFile = (fileName, text2) => {
|
|
17325
17569
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
17326
17570
|
emitted[relativePath] = text2;
|
|
@@ -17342,12 +17586,12 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17342
17586
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
17343
17587
|
return source;
|
|
17344
17588
|
}
|
|
17345
|
-
const resolvedPath =
|
|
17589
|
+
const resolvedPath = resolve30(fileName);
|
|
17346
17590
|
return transformedSources.get(resolvedPath) ?? source;
|
|
17347
17591
|
};
|
|
17348
17592
|
const originalGetSourceFileForCompile = host2.getSourceFile;
|
|
17349
17593
|
host2.getSourceFile = (fileName, languageVersion, onError) => {
|
|
17350
|
-
const source = transformedSources.get(
|
|
17594
|
+
const source = transformedSources.get(resolve30(fileName));
|
|
17351
17595
|
if (source) {
|
|
17352
17596
|
return ts14.createSourceFile(fileName, source, languageVersion, true);
|
|
17353
17597
|
}
|
|
@@ -17369,9 +17613,9 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17369
17613
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
17370
17614
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
17371
17615
|
content,
|
|
17372
|
-
target:
|
|
17616
|
+
target: join39(outDir, fileName)
|
|
17373
17617
|
}));
|
|
17374
|
-
const outputFiles = new Set(rawEntries.map(({ target }) =>
|
|
17618
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve30(target)));
|
|
17375
17619
|
return rawEntries.map(({ content, target }) => {
|
|
17376
17620
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
17377
17621
|
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
@@ -17386,7 +17630,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17386
17630
|
return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
|
|
17387
17631
|
});
|
|
17388
17632
|
processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
|
|
17389
|
-
processedContent += islandMetadataByOutputPath.get(
|
|
17633
|
+
processedContent += islandMetadataByOutputPath.get(resolve30(target)) ?? "";
|
|
17390
17634
|
return { content: processedContent, target };
|
|
17391
17635
|
});
|
|
17392
17636
|
});
|
|
@@ -17396,7 +17640,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17396
17640
|
})), { outputs: entries.length });
|
|
17397
17641
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
17398
17642
|
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, invalidateAngularJitCache = (filePath) => {
|
|
17399
|
-
jitContentCache.delete(
|
|
17643
|
+
jitContentCache.delete(resolve30(filePath));
|
|
17400
17644
|
}, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
|
|
17401
17645
|
const re2 = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
|
|
17402
17646
|
let match;
|
|
@@ -17409,8 +17653,8 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
17409
17653
|
}
|
|
17410
17654
|
return null;
|
|
17411
17655
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
17412
|
-
const sourceEntry =
|
|
17413
|
-
if (
|
|
17656
|
+
const sourceEntry = resolve30(import.meta.dir, "../angular/components/index.ts");
|
|
17657
|
+
if (existsSync28(sourceEntry)) {
|
|
17414
17658
|
return sourceEntry.replace(/\\/g, "/");
|
|
17415
17659
|
}
|
|
17416
17660
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -17538,7 +17782,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
17538
17782
|
${fields}
|
|
17539
17783
|
`);
|
|
17540
17784
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
17541
|
-
if (!
|
|
17785
|
+
if (!existsSync28(filePath)) {
|
|
17542
17786
|
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
17543
17787
|
}
|
|
17544
17788
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
@@ -17546,8 +17790,8 @@ ${fields}
|
|
|
17546
17790
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
17547
17791
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
17548
17792
|
if (templateUrlMatch?.[1]) {
|
|
17549
|
-
const templatePath =
|
|
17550
|
-
if (!
|
|
17793
|
+
const templatePath = join39(fileDir, templateUrlMatch[1]);
|
|
17794
|
+
if (!existsSync28(templatePath)) {
|
|
17551
17795
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
17552
17796
|
}
|
|
17553
17797
|
const templateRaw2 = await fs5.readFile(templatePath, "utf-8");
|
|
@@ -17577,11 +17821,11 @@ ${fields}
|
|
|
17577
17821
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
17578
17822
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
17579
17823
|
if (templateUrlMatch?.[1]) {
|
|
17580
|
-
const templatePath =
|
|
17581
|
-
if (!
|
|
17824
|
+
const templatePath = join39(fileDir, templateUrlMatch[1]);
|
|
17825
|
+
if (!existsSync28(templatePath)) {
|
|
17582
17826
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
17583
17827
|
}
|
|
17584
|
-
const templateRaw2 =
|
|
17828
|
+
const templateRaw2 = readFileSync27(templatePath, "utf-8");
|
|
17585
17829
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
17586
17830
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
17587
17831
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -17614,7 +17858,7 @@ ${fields}
|
|
|
17614
17858
|
return source;
|
|
17615
17859
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
17616
17860
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
17617
|
-
return readAndEscapeFile(
|
|
17861
|
+
return readAndEscapeFile(join39(fileDir, styleUrl), stylePreprocessors);
|
|
17618
17862
|
});
|
|
17619
17863
|
const results = await Promise.all(stylePromises);
|
|
17620
17864
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -17625,7 +17869,7 @@ ${fields}
|
|
|
17625
17869
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
17626
17870
|
if (!styleUrlMatch?.[1])
|
|
17627
17871
|
return source;
|
|
17628
|
-
const escaped = await readAndEscapeFile(
|
|
17872
|
+
const escaped = await readAndEscapeFile(join39(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
17629
17873
|
if (!escaped)
|
|
17630
17874
|
return source;
|
|
17631
17875
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -17699,10 +17943,10 @@ ${fields}
|
|
|
17699
17943
|
return "";
|
|
17700
17944
|
}
|
|
17701
17945
|
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
|
|
17702
|
-
const entryPath =
|
|
17946
|
+
const entryPath = resolve30(inputPath);
|
|
17703
17947
|
const allOutputs = [];
|
|
17704
17948
|
const visited = new Set;
|
|
17705
|
-
const baseDir =
|
|
17949
|
+
const baseDir = resolve30(rootDir ?? process.cwd());
|
|
17706
17950
|
let usesLegacyAnimations = false;
|
|
17707
17951
|
const angularTranspiler = new Bun.Transpiler({
|
|
17708
17952
|
loader: "ts",
|
|
@@ -17721,16 +17965,16 @@ ${fields}
|
|
|
17721
17965
|
`${candidate}.js`,
|
|
17722
17966
|
`${candidate}.jsx`,
|
|
17723
17967
|
`${candidate}.json`,
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17968
|
+
join39(candidate, "index.ts"),
|
|
17969
|
+
join39(candidate, "index.tsx"),
|
|
17970
|
+
join39(candidate, "index.js"),
|
|
17971
|
+
join39(candidate, "index.jsx")
|
|
17728
17972
|
];
|
|
17729
|
-
return candidates.find((file4) =>
|
|
17973
|
+
return candidates.find((file4) => existsSync28(file4));
|
|
17730
17974
|
};
|
|
17731
17975
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
17732
17976
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
17733
|
-
return resolveSourceFile2(
|
|
17977
|
+
return resolveSourceFile2(resolve30(fromDir, specifier));
|
|
17734
17978
|
}
|
|
17735
17979
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
|
|
17736
17980
|
if (aliased)
|
|
@@ -17739,7 +17983,7 @@ ${fields}
|
|
|
17739
17983
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
17740
17984
|
if (resolved.includes("/node_modules/"))
|
|
17741
17985
|
return;
|
|
17742
|
-
const absolute =
|
|
17986
|
+
const absolute = resolve30(resolved);
|
|
17743
17987
|
if (!absolute.startsWith(baseDir))
|
|
17744
17988
|
return;
|
|
17745
17989
|
return resolveSourceFile2(absolute);
|
|
@@ -17751,10 +17995,10 @@ ${fields}
|
|
|
17751
17995
|
const inputDir = dirname21(sourcePath);
|
|
17752
17996
|
const fileBase = basename12(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
17753
17997
|
if (inputDir === outDir || inputDir.startsWith(`${outDir}${sep3}`)) {
|
|
17754
|
-
return
|
|
17998
|
+
return join39(inputDir, fileBase);
|
|
17755
17999
|
}
|
|
17756
18000
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
17757
|
-
return
|
|
18001
|
+
return join39(outDir, relativeDir, fileBase);
|
|
17758
18002
|
};
|
|
17759
18003
|
const withCacheBuster = (specifier) => {
|
|
17760
18004
|
if (!cacheBuster)
|
|
@@ -17791,21 +18035,21 @@ ${fields}
|
|
|
17791
18035
|
return `${prefix}${dots}`;
|
|
17792
18036
|
return `${prefix}../${dots}`;
|
|
17793
18037
|
});
|
|
17794
|
-
if (
|
|
18038
|
+
if (resolve30(actualPath) === entryPath) {
|
|
17795
18039
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
17796
18040
|
}
|
|
17797
18041
|
return processedContent;
|
|
17798
18042
|
};
|
|
17799
18043
|
const transpileFile = async (filePath) => {
|
|
17800
|
-
const resolved =
|
|
18044
|
+
const resolved = resolve30(filePath);
|
|
17801
18045
|
if (visited.has(resolved))
|
|
17802
18046
|
return;
|
|
17803
18047
|
visited.add(resolved);
|
|
17804
|
-
if (resolved.endsWith(".json") &&
|
|
18048
|
+
if (resolved.endsWith(".json") && existsSync28(resolved)) {
|
|
17805
18049
|
const inputDir2 = dirname21(resolved);
|
|
17806
18050
|
const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
|
|
17807
|
-
const targetDir2 =
|
|
17808
|
-
const targetPath2 =
|
|
18051
|
+
const targetDir2 = join39(outDir, relativeDir2);
|
|
18052
|
+
const targetPath2 = join39(targetDir2, basename12(resolved));
|
|
17809
18053
|
await fs5.mkdir(targetDir2, { recursive: true });
|
|
17810
18054
|
await fs5.copyFile(resolved, targetPath2);
|
|
17811
18055
|
allOutputs.push(targetPath2);
|
|
@@ -17814,7 +18058,7 @@ ${fields}
|
|
|
17814
18058
|
let actualPath = resolved;
|
|
17815
18059
|
if (!actualPath.endsWith(".ts"))
|
|
17816
18060
|
actualPath += ".ts";
|
|
17817
|
-
if (!
|
|
18061
|
+
if (!existsSync28(actualPath))
|
|
17818
18062
|
return;
|
|
17819
18063
|
let sourceCode = await fs5.readFile(actualPath, "utf-8");
|
|
17820
18064
|
const inlined = await inlineResources(sourceCode, dirname21(actualPath), stylePreprocessors);
|
|
@@ -17849,10 +18093,10 @@ ${fields}
|
|
|
17849
18093
|
importRewrites.set(specifier, relativeRewrite);
|
|
17850
18094
|
return resolved2;
|
|
17851
18095
|
}).filter((path) => Boolean(path));
|
|
17852
|
-
const isEntry =
|
|
18096
|
+
const isEntry = resolve30(actualPath) === resolve30(entryPath);
|
|
17853
18097
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
17854
18098
|
const cacheKey2 = actualPath;
|
|
17855
|
-
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !
|
|
18099
|
+
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync28(targetPath);
|
|
17856
18100
|
if (shouldWriteFile) {
|
|
17857
18101
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
17858
18102
|
const preservedInjection = await readPreservedInjection(targetPath);
|
|
@@ -17865,7 +18109,7 @@ ${fields}
|
|
|
17865
18109
|
};
|
|
17866
18110
|
await transpileFile(inputPath);
|
|
17867
18111
|
const entryOutputPath = toOutputPath(entryPath);
|
|
17868
|
-
if (
|
|
18112
|
+
if (existsSync28(entryOutputPath)) {
|
|
17869
18113
|
const entryOutput = await fs5.readFile(entryOutputPath, "utf-8");
|
|
17870
18114
|
const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
|
|
17871
18115
|
`);
|
|
@@ -17884,23 +18128,23 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
17884
18128
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
17885
18129
|
}
|
|
17886
18130
|
const compiledRoot = compiledParent;
|
|
17887
|
-
const indexesDir =
|
|
18131
|
+
const indexesDir = join39(compiledParent, "indexes");
|
|
17888
18132
|
await traceAngularPhase("setup/create-indexes-dir", () => fs5.mkdir(indexesDir, { recursive: true }));
|
|
17889
|
-
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) =>
|
|
18133
|
+
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve30(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
17890
18134
|
if (!hmr) {
|
|
17891
18135
|
await traceAngularPhase("aot/copy-json-resources", async () => {
|
|
17892
18136
|
const cwd = process.cwd();
|
|
17893
|
-
const angularSrcDir =
|
|
17894
|
-
if (!
|
|
18137
|
+
const angularSrcDir = resolve30(outRoot);
|
|
18138
|
+
if (!existsSync28(angularSrcDir))
|
|
17895
18139
|
return;
|
|
17896
18140
|
const jsonGlob = new Glob6("**/*.json");
|
|
17897
18141
|
for (const rel of jsonGlob.scanSync({
|
|
17898
18142
|
absolute: false,
|
|
17899
18143
|
cwd: angularSrcDir
|
|
17900
18144
|
})) {
|
|
17901
|
-
const sourcePath =
|
|
18145
|
+
const sourcePath = join39(angularSrcDir, rel);
|
|
17902
18146
|
const cwdRel = relative14(cwd, sourcePath);
|
|
17903
|
-
const targetPath =
|
|
18147
|
+
const targetPath = join39(compiledRoot, cwdRel);
|
|
17904
18148
|
await fs5.mkdir(dirname21(targetPath), { recursive: true });
|
|
17905
18149
|
await fs5.copyFile(sourcePath, targetPath);
|
|
17906
18150
|
}
|
|
@@ -17908,7 +18152,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
17908
18152
|
}
|
|
17909
18153
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
17910
18154
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
17911
|
-
const resolvedEntry =
|
|
18155
|
+
const resolvedEntry = resolve30(entry);
|
|
17912
18156
|
const relativeEntry = relative14(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
17913
18157
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
17914
18158
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
@@ -17917,24 +18161,24 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
17917
18161
|
const fileBase = basename12(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
17918
18162
|
const jsName = `${fileBase}.js`;
|
|
17919
18163
|
const compiledFallbackPaths = [
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
|
|
17923
|
-
].map((file4) =>
|
|
18164
|
+
join39(compiledRoot, relativeEntry),
|
|
18165
|
+
join39(compiledRoot, "pages", jsName),
|
|
18166
|
+
join39(compiledRoot, jsName)
|
|
18167
|
+
].map((file4) => resolve30(file4));
|
|
17924
18168
|
const resolveRawServerFile = (candidatePaths) => {
|
|
17925
18169
|
const normalizedCandidates = [
|
|
17926
|
-
...candidatePaths.map((file4) =>
|
|
18170
|
+
...candidatePaths.map((file4) => resolve30(file4)),
|
|
17927
18171
|
...compiledFallbackPaths
|
|
17928
18172
|
];
|
|
17929
|
-
let candidate = normalizedCandidates.find((file4) =>
|
|
18173
|
+
let candidate = normalizedCandidates.find((file4) => existsSync28(file4) && file4.endsWith(`${sep3}${relativeEntry}`));
|
|
17930
18174
|
if (!candidate) {
|
|
17931
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
18175
|
+
candidate = normalizedCandidates.find((file4) => existsSync28(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
17932
18176
|
}
|
|
17933
18177
|
if (!candidate) {
|
|
17934
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
18178
|
+
candidate = normalizedCandidates.find((file4) => existsSync28(file4) && file4.endsWith(`${sep3}${jsName}`));
|
|
17935
18179
|
}
|
|
17936
18180
|
if (!candidate) {
|
|
17937
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
18181
|
+
candidate = normalizedCandidates.find((file4) => existsSync28(file4));
|
|
17938
18182
|
}
|
|
17939
18183
|
return candidate;
|
|
17940
18184
|
};
|
|
@@ -17942,11 +18186,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
17942
18186
|
if (!rawServerFile) {
|
|
17943
18187
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
|
|
17944
18188
|
}
|
|
17945
|
-
if (rawServerFile && !
|
|
18189
|
+
if (rawServerFile && !existsSync28(rawServerFile)) {
|
|
17946
18190
|
outputs = hmr ? await compileEntry() : aotOutputs;
|
|
17947
18191
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
|
|
17948
18192
|
}
|
|
17949
|
-
if (!rawServerFile || !
|
|
18193
|
+
if (!rawServerFile || !existsSync28(rawServerFile)) {
|
|
17950
18194
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
17951
18195
|
...outputs,
|
|
17952
18196
|
...compiledFallbackPaths
|
|
@@ -17970,7 +18214,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
17970
18214
|
let providersSourceContent = "";
|
|
17971
18215
|
if (providersInjection.appProvidersSource) {
|
|
17972
18216
|
try {
|
|
17973
|
-
providersSourceContent =
|
|
18217
|
+
providersSourceContent = readFileSync27(providersInjection.appProvidersSource, "utf-8");
|
|
17974
18218
|
} catch {}
|
|
17975
18219
|
}
|
|
17976
18220
|
return JSON.stringify({
|
|
@@ -17981,8 +18225,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
17981
18225
|
})() : "no-providers";
|
|
17982
18226
|
const serverContentHash = `${Bun.hash(original).toString(BASE_36_RADIX)}.${Bun.hash(providersHashInput).toString(BASE_36_RADIX)}`;
|
|
17983
18227
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
17984
|
-
const clientFile =
|
|
17985
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
18228
|
+
const clientFile = join39(indexesDir, jsName);
|
|
18229
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync28(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
17986
18230
|
return {
|
|
17987
18231
|
clientPath: clientFile,
|
|
17988
18232
|
indexUnchanged: true,
|
|
@@ -18013,10 +18257,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
18013
18257
|
const fragments = [];
|
|
18014
18258
|
if (providersInjection.appProvidersSource) {
|
|
18015
18259
|
const compiledAppProvidersPath = (() => {
|
|
18016
|
-
const angularDirAbs =
|
|
18017
|
-
const appSourceAbs =
|
|
18260
|
+
const angularDirAbs = resolve30(outRoot);
|
|
18261
|
+
const appSourceAbs = resolve30(providersInjection.appProvidersSource);
|
|
18018
18262
|
const rel = relative14(angularDirAbs, appSourceAbs).replace(/\\/g, "/");
|
|
18019
|
-
return
|
|
18263
|
+
return join39(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
18020
18264
|
})();
|
|
18021
18265
|
const appProvidersSpec = (() => {
|
|
18022
18266
|
const rel = relative14(dirname21(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
|
|
@@ -18277,7 +18521,7 @@ var init_compileAngular = __esm(() => {
|
|
|
18277
18521
|
init_stylePreprocessor();
|
|
18278
18522
|
init_generatedDir();
|
|
18279
18523
|
devClientDir4 = resolveDevClientDir4();
|
|
18280
|
-
hmrClientPath5 =
|
|
18524
|
+
hmrClientPath5 = join39(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
18281
18525
|
jitContentCache = new Map;
|
|
18282
18526
|
wrapperOutputCache = new Map;
|
|
18283
18527
|
PROVIDERS_INJECTION_BLOCK_RE = /\n\/\* __ABS_PROVIDERS_INJECTION_START \*\/[\s\S]*?\/\* __ABS_PROVIDERS_INJECTION_END \*\/\n?/;
|
|
@@ -18993,15 +19237,15 @@ __export(exports_fastHmrCompiler, {
|
|
|
18993
19237
|
takePendingModule: () => takePendingModule,
|
|
18994
19238
|
tryFastHmr: () => tryFastHmr
|
|
18995
19239
|
});
|
|
18996
|
-
import { existsSync as
|
|
18997
|
-
import { dirname as dirname22, extname as extname9, relative as relative15, resolve as
|
|
19240
|
+
import { existsSync as existsSync29, readFileSync as readFileSync28, statSync as statSync2 } from "fs";
|
|
19241
|
+
import { dirname as dirname22, extname as extname9, relative as relative15, resolve as resolve31 } from "path";
|
|
18998
19242
|
import ts18 from "typescript";
|
|
18999
19243
|
var fail = (reason, detail, location) => ({
|
|
19000
19244
|
detail,
|
|
19001
19245
|
ok: false,
|
|
19002
19246
|
reason,
|
|
19003
19247
|
...location ?? {}
|
|
19004
|
-
}),
|
|
19248
|
+
}), fingerprintCache2, pendingModuleCache, ANGULAR_DECORATOR_NAMES, findAngularDecoratorName = (decorators) => {
|
|
19005
19249
|
for (const decorator of decorators) {
|
|
19006
19250
|
if (!ts18.isCallExpression(decorator.expression))
|
|
19007
19251
|
continue;
|
|
@@ -19081,7 +19325,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19081
19325
|
return false;
|
|
19082
19326
|
return true;
|
|
19083
19327
|
}, invalidateFingerprintCache = () => {
|
|
19084
|
-
|
|
19328
|
+
fingerprintCache2.clear();
|
|
19085
19329
|
entityFingerprintCache.clear();
|
|
19086
19330
|
}, primeComponentFingerprint = async (componentFilePath) => {
|
|
19087
19331
|
let source;
|
|
@@ -19126,7 +19370,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19126
19370
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
19127
19371
|
const componentDir = dirname22(componentFilePath);
|
|
19128
19372
|
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
19129
|
-
|
|
19373
|
+
fingerprintCache2.set(id, fingerprint);
|
|
19130
19374
|
} else {
|
|
19131
19375
|
try {
|
|
19132
19376
|
const entityFingerprint = extractEntityFingerprint(stmt, className, sourceFile);
|
|
@@ -19135,7 +19379,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19135
19379
|
}
|
|
19136
19380
|
}
|
|
19137
19381
|
}, recordFingerprint = (id, fingerprint) => {
|
|
19138
|
-
|
|
19382
|
+
fingerprintCache2.set(id, fingerprint);
|
|
19139
19383
|
}, entityFingerprintCache, entityFingerprintsEqual = (leftValue, rightValue) => {
|
|
19140
19384
|
if (leftValue.className !== rightValue.className)
|
|
19141
19385
|
return false;
|
|
@@ -19309,7 +19553,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19309
19553
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
19310
19554
|
return true;
|
|
19311
19555
|
}
|
|
19312
|
-
const base =
|
|
19556
|
+
const base = resolve31(componentDir, spec);
|
|
19313
19557
|
const candidates = [
|
|
19314
19558
|
`${base}.ts`,
|
|
19315
19559
|
`${base}.tsx`,
|
|
@@ -19317,11 +19561,11 @@ var fail = (reason, detail, location) => ({
|
|
|
19317
19561
|
`${base}/index.tsx`
|
|
19318
19562
|
];
|
|
19319
19563
|
for (const candidate of candidates) {
|
|
19320
|
-
if (!
|
|
19564
|
+
if (!existsSync29(candidate))
|
|
19321
19565
|
continue;
|
|
19322
19566
|
let content;
|
|
19323
19567
|
try {
|
|
19324
|
-
content =
|
|
19568
|
+
content = readFileSync28(candidate, "utf-8");
|
|
19325
19569
|
} catch {
|
|
19326
19570
|
continue;
|
|
19327
19571
|
}
|
|
@@ -19909,7 +20153,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19909
20153
|
return cached.info;
|
|
19910
20154
|
let source;
|
|
19911
20155
|
try {
|
|
19912
|
-
source =
|
|
20156
|
+
source = readFileSync28(filePath, "utf-8");
|
|
19913
20157
|
} catch {
|
|
19914
20158
|
childComponentInfoCache.set(cacheKey2, {
|
|
19915
20159
|
info: null,
|
|
@@ -19963,7 +20207,7 @@ var fail = (reason, detail, location) => ({
|
|
|
19963
20207
|
return cached.info;
|
|
19964
20208
|
let content;
|
|
19965
20209
|
try {
|
|
19966
|
-
content =
|
|
20210
|
+
content = readFileSync28(dtsPath, "utf-8");
|
|
19967
20211
|
} catch {
|
|
19968
20212
|
childComponentInfoCache.set(cacheKey2, {
|
|
19969
20213
|
info: null,
|
|
@@ -20082,11 +20326,11 @@ var fail = (reason, detail, location) => ({
|
|
|
20082
20326
|
if (visited.has(startDtsPath))
|
|
20083
20327
|
return null;
|
|
20084
20328
|
visited.add(startDtsPath);
|
|
20085
|
-
if (!
|
|
20329
|
+
if (!existsSync29(startDtsPath))
|
|
20086
20330
|
return null;
|
|
20087
20331
|
let content;
|
|
20088
20332
|
try {
|
|
20089
|
-
content =
|
|
20333
|
+
content = readFileSync28(startDtsPath, "utf-8");
|
|
20090
20334
|
} catch {
|
|
20091
20335
|
return null;
|
|
20092
20336
|
}
|
|
@@ -20125,7 +20369,7 @@ var fail = (reason, detail, location) => ({
|
|
|
20125
20369
|
return null;
|
|
20126
20370
|
}, resolveDtsFromSpec = (spec, fromDir) => {
|
|
20127
20371
|
const stripped = spec.replace(/\.[mc]?js$/, "");
|
|
20128
|
-
const base =
|
|
20372
|
+
const base = resolve31(fromDir, stripped);
|
|
20129
20373
|
const candidates = [
|
|
20130
20374
|
`${base}.d.ts`,
|
|
20131
20375
|
`${base}.d.mts`,
|
|
@@ -20135,21 +20379,21 @@ var fail = (reason, detail, location) => ({
|
|
|
20135
20379
|
`${base}/index.d.cts`
|
|
20136
20380
|
];
|
|
20137
20381
|
for (const c of candidates) {
|
|
20138
|
-
if (
|
|
20382
|
+
if (existsSync29(c))
|
|
20139
20383
|
return c;
|
|
20140
20384
|
}
|
|
20141
20385
|
return null;
|
|
20142
20386
|
}, findPackageDtsForJs = (jsPath) => {
|
|
20143
20387
|
const sibling = jsPath.replace(/\.[mc]?js$/, ".d.ts");
|
|
20144
|
-
if (
|
|
20388
|
+
if (existsSync29(sibling))
|
|
20145
20389
|
return sibling;
|
|
20146
20390
|
const mirror = jsPath.replace(/\/dist\//, "/dist/src/").replace(/\.[mc]?js$/, ".d.ts");
|
|
20147
|
-
if (
|
|
20391
|
+
if (existsSync29(mirror))
|
|
20148
20392
|
return mirror;
|
|
20149
20393
|
return null;
|
|
20150
20394
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
20151
20395
|
if (spec.startsWith(".") || spec.startsWith("/")) {
|
|
20152
|
-
const base =
|
|
20396
|
+
const base = resolve31(componentDir, spec);
|
|
20153
20397
|
const candidates = [
|
|
20154
20398
|
`${base}.ts`,
|
|
20155
20399
|
`${base}.tsx`,
|
|
@@ -20157,7 +20401,7 @@ var fail = (reason, detail, location) => ({
|
|
|
20157
20401
|
`${base}/index.tsx`
|
|
20158
20402
|
];
|
|
20159
20403
|
for (const candidate of candidates) {
|
|
20160
|
-
if (!
|
|
20404
|
+
if (!existsSync29(candidate))
|
|
20161
20405
|
continue;
|
|
20162
20406
|
const info = getChildComponentInfoFromTsSource(candidate, className);
|
|
20163
20407
|
if (info)
|
|
@@ -20304,7 +20548,7 @@ var fail = (reason, detail, location) => ({
|
|
|
20304
20548
|
return cached.hasProviders;
|
|
20305
20549
|
let source;
|
|
20306
20550
|
try {
|
|
20307
|
-
source =
|
|
20551
|
+
source = readFileSync28(filePath, "utf8");
|
|
20308
20552
|
} catch {
|
|
20309
20553
|
return true;
|
|
20310
20554
|
}
|
|
@@ -20368,14 +20612,14 @@ var fail = (reason, detail, location) => ({
|
|
|
20368
20612
|
}
|
|
20369
20613
|
if (!matches)
|
|
20370
20614
|
continue;
|
|
20371
|
-
const resolved =
|
|
20615
|
+
const resolved = resolve31(componentDir, spec);
|
|
20372
20616
|
for (const ext of TS_EXTENSIONS) {
|
|
20373
20617
|
const candidate = resolved + ext;
|
|
20374
|
-
if (
|
|
20618
|
+
if (existsSync29(candidate))
|
|
20375
20619
|
return candidate;
|
|
20376
20620
|
}
|
|
20377
|
-
const indexCandidate =
|
|
20378
|
-
if (
|
|
20621
|
+
const indexCandidate = resolve31(resolved, "index.ts");
|
|
20622
|
+
if (existsSync29(indexCandidate))
|
|
20379
20623
|
return indexCandidate;
|
|
20380
20624
|
}
|
|
20381
20625
|
return null;
|
|
@@ -20612,12 +20856,12 @@ ${transpiled}
|
|
|
20612
20856
|
}
|
|
20613
20857
|
}${staticPatch}`;
|
|
20614
20858
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
20615
|
-
const abs =
|
|
20616
|
-
if (!
|
|
20859
|
+
const abs = resolve31(componentDir, url);
|
|
20860
|
+
if (!existsSync29(abs))
|
|
20617
20861
|
return null;
|
|
20618
20862
|
const ext = extname9(abs).toLowerCase();
|
|
20619
20863
|
if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
|
|
20620
|
-
return
|
|
20864
|
+
return readFileSync28(abs, "utf8");
|
|
20621
20865
|
}
|
|
20622
20866
|
try {
|
|
20623
20867
|
return compileStyleFileIfNeededSync(abs);
|
|
@@ -20651,11 +20895,11 @@ ${block}
|
|
|
20651
20895
|
const cached = projectOptionsCache.get(projectRoot);
|
|
20652
20896
|
if (cached !== undefined)
|
|
20653
20897
|
return cached;
|
|
20654
|
-
const tsconfigPath =
|
|
20898
|
+
const tsconfigPath = resolve31(projectRoot, "tsconfig.json");
|
|
20655
20899
|
const opts = {};
|
|
20656
|
-
if (
|
|
20900
|
+
if (existsSync29(tsconfigPath)) {
|
|
20657
20901
|
try {
|
|
20658
|
-
const text2 =
|
|
20902
|
+
const text2 = readFileSync28(tsconfigPath, "utf8");
|
|
20659
20903
|
const parsed = ts18.parseConfigFileTextToJson(tsconfigPath, text2);
|
|
20660
20904
|
if (!parsed.error && parsed.config) {
|
|
20661
20905
|
const cfg = parsed.config;
|
|
@@ -20680,7 +20924,7 @@ ${block}
|
|
|
20680
20924
|
}, tryFastHmr = async (params) => {
|
|
20681
20925
|
const { componentFilePath, className } = params;
|
|
20682
20926
|
const projectRoot = params.projectRoot ?? process.cwd();
|
|
20683
|
-
if (!
|
|
20927
|
+
if (!existsSync29(componentFilePath)) {
|
|
20684
20928
|
return fail("file-not-found", componentFilePath);
|
|
20685
20929
|
}
|
|
20686
20930
|
let compiler;
|
|
@@ -20689,7 +20933,7 @@ ${block}
|
|
|
20689
20933
|
} catch (err) {
|
|
20690
20934
|
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
20691
20935
|
}
|
|
20692
|
-
const tsSource =
|
|
20936
|
+
const tsSource = readFileSync28(componentFilePath, "utf8");
|
|
20693
20937
|
const sourceFile = ts18.createSourceFile(componentFilePath, tsSource, ts18.ScriptTarget.ES2022, true, ts18.ScriptKind.TS);
|
|
20694
20938
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
20695
20939
|
if (!classNode) {
|
|
@@ -20735,11 +20979,11 @@ ${block}
|
|
|
20735
20979
|
templateText = decoratorMeta.template;
|
|
20736
20980
|
templatePath = componentFilePath;
|
|
20737
20981
|
} else if (decoratorMeta.templateUrl) {
|
|
20738
|
-
const tplAbs =
|
|
20739
|
-
if (!
|
|
20982
|
+
const tplAbs = resolve31(componentDir, decoratorMeta.templateUrl);
|
|
20983
|
+
if (!existsSync29(tplAbs)) {
|
|
20740
20984
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
20741
20985
|
}
|
|
20742
|
-
templateText =
|
|
20986
|
+
templateText = readFileSync28(tplAbs, "utf8");
|
|
20743
20987
|
templatePath = tplAbs;
|
|
20744
20988
|
} else {
|
|
20745
20989
|
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
@@ -20784,7 +21028,7 @@ ${block}
|
|
|
20784
21028
|
const projectRelPath = relative15(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
20785
21029
|
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
20786
21030
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
20787
|
-
const cachedFingerprint =
|
|
21031
|
+
const cachedFingerprint = fingerprintCache2.get(fingerprintId);
|
|
20788
21032
|
const fingerprintChanged = cachedFingerprint !== undefined && !fingerprintsEqual(cachedFingerprint, currentFingerprint);
|
|
20789
21033
|
const rebootstrapRequired = !currentFingerprint.standalone || cachedFingerprint !== undefined && (cachedFingerprint.importsArraySig !== currentFingerprint.importsArraySig || cachedFingerprint.hostDirectivesSig !== currentFingerprint.hostDirectivesSig || cachedFingerprint.providersArraySig !== currentFingerprint.providersArraySig || cachedFingerprint.viewProvidersArraySig !== currentFingerprint.viewProvidersArraySig || cachedFingerprint.selector !== currentFingerprint.selector || cachedFingerprint.pageExportsSig !== currentFingerprint.pageExportsSig || cachedFingerprint.standalone !== currentFingerprint.standalone);
|
|
20790
21034
|
const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
|
|
@@ -20991,7 +21235,7 @@ ${methodsBlock}
|
|
|
20991
21235
|
moduleText = moduleText.slice(0, lastBrace) + tail + moduleText.slice(lastBrace);
|
|
20992
21236
|
}
|
|
20993
21237
|
}
|
|
20994
|
-
|
|
21238
|
+
fingerprintCache2.set(fingerprintId, currentFingerprint);
|
|
20995
21239
|
setPendingModule(fingerprintId, moduleText);
|
|
20996
21240
|
return {
|
|
20997
21241
|
componentSource: sourceFile,
|
|
@@ -21008,7 +21252,7 @@ var init_fastHmrCompiler = __esm(() => {
|
|
|
21008
21252
|
init_stylePreprocessor();
|
|
21009
21253
|
init_hmrImportGenerator();
|
|
21010
21254
|
init_typescript_translator();
|
|
21011
|
-
|
|
21255
|
+
fingerprintCache2 = new Map;
|
|
21012
21256
|
pendingModuleCache = new Map;
|
|
21013
21257
|
ANGULAR_DECORATOR_NAMES = new Set([
|
|
21014
21258
|
"Component",
|
|
@@ -21505,9 +21749,9 @@ __export(exports_compileEmber, {
|
|
|
21505
21749
|
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
21506
21750
|
getEmberServerCompiledDir: () => getEmberServerCompiledDir
|
|
21507
21751
|
});
|
|
21508
|
-
import { existsSync as
|
|
21752
|
+
import { existsSync as existsSync30 } from "fs";
|
|
21509
21753
|
import { mkdir as mkdir11, rm as rm8 } from "fs/promises";
|
|
21510
|
-
import { basename as basename13, dirname as dirname23, extname as extname10, join as
|
|
21754
|
+
import { basename as basename13, dirname as dirname23, extname as extname10, join as join40, resolve as resolve32 } from "path";
|
|
21511
21755
|
var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file4 } = globalThis.Bun;
|
|
21512
21756
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
21513
21757
|
if (cachedPreprocessor)
|
|
@@ -21603,11 +21847,11 @@ export const importSync = (specifier) => {
|
|
|
21603
21847
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
21604
21848
|
if (!originalImporter)
|
|
21605
21849
|
return;
|
|
21606
|
-
const candidateBase =
|
|
21850
|
+
const candidateBase = resolve32(dirname23(originalImporter), args.path);
|
|
21607
21851
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
21608
21852
|
for (const ext of extensionsToTry) {
|
|
21609
21853
|
const candidate = candidateBase + ext;
|
|
21610
|
-
if (
|
|
21854
|
+
if (existsSync30(candidate))
|
|
21611
21855
|
return { path: candidate };
|
|
21612
21856
|
}
|
|
21613
21857
|
return;
|
|
@@ -21626,8 +21870,8 @@ export const importSync = (specifier) => {
|
|
|
21626
21870
|
build2.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
21627
21871
|
if (standalonePackages.has(args.path))
|
|
21628
21872
|
return;
|
|
21629
|
-
const internal =
|
|
21630
|
-
if (
|
|
21873
|
+
const internal = join40(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
21874
|
+
if (existsSync30(internal))
|
|
21631
21875
|
return { path: internal };
|
|
21632
21876
|
return;
|
|
21633
21877
|
});
|
|
@@ -21662,7 +21906,7 @@ export const renderToHTML = (props = {}) => {
|
|
|
21662
21906
|
export { PageComponent };
|
|
21663
21907
|
export default PageComponent;
|
|
21664
21908
|
`, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
|
|
21665
|
-
const resolvedEntry =
|
|
21909
|
+
const resolvedEntry = resolve32(entry);
|
|
21666
21910
|
const source = await file4(resolvedEntry).text();
|
|
21667
21911
|
let preprocessed = source;
|
|
21668
21912
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -21674,16 +21918,16 @@ export default PageComponent;
|
|
|
21674
21918
|
}
|
|
21675
21919
|
const transpiled = transpiler5.transformSync(preprocessed);
|
|
21676
21920
|
const baseName = basename13(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
21677
|
-
const tmpDir =
|
|
21678
|
-
const serverDir =
|
|
21679
|
-
const clientDir =
|
|
21921
|
+
const tmpDir = join40(compiledRoot, "_tmp");
|
|
21922
|
+
const serverDir = join40(compiledRoot, "server");
|
|
21923
|
+
const clientDir = join40(compiledRoot, "client");
|
|
21680
21924
|
await Promise.all([
|
|
21681
21925
|
mkdir11(tmpDir, { recursive: true }),
|
|
21682
21926
|
mkdir11(serverDir, { recursive: true }),
|
|
21683
21927
|
mkdir11(clientDir, { recursive: true })
|
|
21684
21928
|
]);
|
|
21685
|
-
const tmpPagePath =
|
|
21686
|
-
const tmpHarnessPath =
|
|
21929
|
+
const tmpPagePath = resolve32(join40(tmpDir, `${baseName}.module.js`));
|
|
21930
|
+
const tmpHarnessPath = resolve32(join40(tmpDir, `${baseName}.harness.js`));
|
|
21687
21931
|
await Promise.all([
|
|
21688
21932
|
write4(tmpPagePath, transpiled),
|
|
21689
21933
|
write4(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -21691,7 +21935,7 @@ export default PageComponent;
|
|
|
21691
21935
|
const stagedSourceMap = new Map([
|
|
21692
21936
|
[tmpPagePath, resolvedEntry]
|
|
21693
21937
|
]);
|
|
21694
|
-
const serverPath =
|
|
21938
|
+
const serverPath = join40(serverDir, `${baseName}.js`);
|
|
21695
21939
|
const buildResult = await bunBuild2({
|
|
21696
21940
|
entrypoints: [tmpHarnessPath],
|
|
21697
21941
|
format: "esm",
|
|
@@ -21708,7 +21952,7 @@ export default PageComponent;
|
|
|
21708
21952
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
21709
21953
|
}
|
|
21710
21954
|
await rm8(tmpDir, { force: true, recursive: true });
|
|
21711
|
-
const clientPath =
|
|
21955
|
+
const clientPath = join40(clientDir, `${baseName}.js`);
|
|
21712
21956
|
await write4(clientPath, transpiled);
|
|
21713
21957
|
return { clientPath, serverPath };
|
|
21714
21958
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -21725,7 +21969,7 @@ export default PageComponent;
|
|
|
21725
21969
|
serverPaths: outputs.map((o3) => o3.serverPath)
|
|
21726
21970
|
};
|
|
21727
21971
|
}, compileEmberFileSource = async (entry) => {
|
|
21728
|
-
const resolvedEntry =
|
|
21972
|
+
const resolvedEntry = resolve32(entry);
|
|
21729
21973
|
const source = await file4(resolvedEntry).text();
|
|
21730
21974
|
let preprocessed = source;
|
|
21731
21975
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -21736,7 +21980,7 @@ export default PageComponent;
|
|
|
21736
21980
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
21737
21981
|
}
|
|
21738
21982
|
return transpiler5.transformSync(preprocessed);
|
|
21739
|
-
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) =>
|
|
21983
|
+
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join40(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join40(getEmberCompiledRoot(emberDir), "client");
|
|
21740
21984
|
var init_compileEmber = __esm(() => {
|
|
21741
21985
|
init_generatedDir();
|
|
21742
21986
|
transpiler5 = new Transpiler4({
|
|
@@ -21757,25 +22001,25 @@ __export(exports_buildReactVendor, {
|
|
|
21757
22001
|
buildReactVendor: () => buildReactVendor,
|
|
21758
22002
|
computeVendorPaths: () => computeVendorPaths
|
|
21759
22003
|
});
|
|
21760
|
-
import { existsSync as
|
|
21761
|
-
import { join as
|
|
22004
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync9 } from "fs";
|
|
22005
|
+
import { join as join41, resolve as resolve33 } from "path";
|
|
21762
22006
|
import { rm as rm9 } from "fs/promises";
|
|
21763
22007
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
21764
22008
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
21765
22009
|
const candidates = [
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
|
|
22010
|
+
resolve33(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
22011
|
+
resolve33(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
22012
|
+
resolve33(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
22013
|
+
resolve33(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
22014
|
+
resolve33(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
22015
|
+
resolve33(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
21772
22016
|
];
|
|
21773
22017
|
for (const candidate of candidates) {
|
|
21774
|
-
if (
|
|
22018
|
+
if (existsSync31(candidate)) {
|
|
21775
22019
|
return candidate.replace(/\\/g, "/");
|
|
21776
22020
|
}
|
|
21777
22021
|
}
|
|
21778
|
-
return (candidates[0] ??
|
|
22022
|
+
return (candidates[0] ?? resolve33(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
21779
22023
|
}, jsxDevRuntimeCompatPath, jsxRuntimeCompatPath, reactSpecifiers, toSafeFileName = (specifier) => specifier.replace(/\//g, "_"), computeVendorPaths = () => {
|
|
21780
22024
|
const paths = {};
|
|
21781
22025
|
for (const specifier of reactSpecifiers) {
|
|
@@ -21808,14 +22052,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
21808
22052
|
`)}
|
|
21809
22053
|
`;
|
|
21810
22054
|
}, buildReactVendor = async (buildDir) => {
|
|
21811
|
-
const vendorDir =
|
|
21812
|
-
|
|
21813
|
-
const tmpDir =
|
|
21814
|
-
|
|
22055
|
+
const vendorDir = join41(buildDir, "react", "vendor");
|
|
22056
|
+
mkdirSync9(vendorDir, { recursive: true });
|
|
22057
|
+
const tmpDir = join41(buildDir, "_vendor_tmp");
|
|
22058
|
+
mkdirSync9(tmpDir, { recursive: true });
|
|
21815
22059
|
const specifiers = reactSpecifiers;
|
|
21816
22060
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
21817
22061
|
const safeName = toSafeFileName(specifier);
|
|
21818
|
-
const entryPath =
|
|
22062
|
+
const entryPath = join41(tmpDir, `${safeName}.ts`);
|
|
21819
22063
|
const source = await generateEntrySource(specifier);
|
|
21820
22064
|
await Bun.write(entryPath, source);
|
|
21821
22065
|
return entryPath;
|
|
@@ -21882,8 +22126,8 @@ __export(exports_buildAngularVendor, {
|
|
|
21882
22126
|
computeAngularVendorPaths: () => computeAngularVendorPaths,
|
|
21883
22127
|
computeAngularVendorPathsAsync: () => computeAngularVendorPathsAsync
|
|
21884
22128
|
});
|
|
21885
|
-
import { mkdirSync as
|
|
21886
|
-
import { join as
|
|
22129
|
+
import { mkdirSync as mkdirSync10 } from "fs";
|
|
22130
|
+
import { join as join42 } from "path";
|
|
21887
22131
|
import { rm as rm10 } from "fs/promises";
|
|
21888
22132
|
var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
|
|
21889
22133
|
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, isResolvable = (specifier) => {
|
|
@@ -21920,7 +22164,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
21920
22164
|
}
|
|
21921
22165
|
return { angular, transitiveRoots };
|
|
21922
22166
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
21923
|
-
const { readFileSync:
|
|
22167
|
+
const { readFileSync: readFileSync29 } = await import("fs");
|
|
21924
22168
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
21925
22169
|
const visited = new Set;
|
|
21926
22170
|
const frontier = [];
|
|
@@ -21941,7 +22185,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
21941
22185
|
}
|
|
21942
22186
|
let content;
|
|
21943
22187
|
try {
|
|
21944
|
-
content =
|
|
22188
|
+
content = readFileSync29(resolved, "utf-8");
|
|
21945
22189
|
} catch {
|
|
21946
22190
|
continue;
|
|
21947
22191
|
}
|
|
@@ -21980,14 +22224,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
21980
22224
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
21981
22225
|
return Array.from(angular).filter(isResolvable);
|
|
21982
22226
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
21983
|
-
const vendorDir =
|
|
21984
|
-
|
|
21985
|
-
const tmpDir =
|
|
21986
|
-
|
|
22227
|
+
const vendorDir = join42(buildDir, "angular", "vendor");
|
|
22228
|
+
mkdirSync10(vendorDir, { recursive: true });
|
|
22229
|
+
const tmpDir = join42(buildDir, "_angular_vendor_tmp");
|
|
22230
|
+
mkdirSync10(tmpDir, { recursive: true });
|
|
21987
22231
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
21988
22232
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
21989
22233
|
const safeName = toSafeFileName2(specifier);
|
|
21990
|
-
const entryPath =
|
|
22234
|
+
const entryPath = join42(tmpDir, `${safeName}.ts`);
|
|
21991
22235
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
21992
22236
|
return entryPath;
|
|
21993
22237
|
}));
|
|
@@ -22018,10 +22262,10 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
22018
22262
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
22019
22263
|
return computeAngularVendorPaths(specifiers);
|
|
22020
22264
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
22021
|
-
const vendorDir =
|
|
22022
|
-
|
|
22023
|
-
const tmpDir =
|
|
22024
|
-
|
|
22265
|
+
const vendorDir = join42(buildDir, "angular", "vendor", "server");
|
|
22266
|
+
mkdirSync10(vendorDir, { recursive: true });
|
|
22267
|
+
const tmpDir = join42(buildDir, "_angular_server_vendor_tmp");
|
|
22268
|
+
mkdirSync10(tmpDir, { recursive: true });
|
|
22025
22269
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
22026
22270
|
const allSpecs = new Set(browserSpecs);
|
|
22027
22271
|
for (const spec of SERVER_ONLY_ANGULAR_SPECIFIERS) {
|
|
@@ -22031,7 +22275,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
22031
22275
|
const specifiers = Array.from(allSpecs);
|
|
22032
22276
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
22033
22277
|
const safeName = toSafeFileName2(specifier);
|
|
22034
|
-
const entryPath =
|
|
22278
|
+
const entryPath = join42(tmpDir, `${safeName}.ts`);
|
|
22035
22279
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
22036
22280
|
return entryPath;
|
|
22037
22281
|
}));
|
|
@@ -22053,9 +22297,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
22053
22297
|
return specifiers;
|
|
22054
22298
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
22055
22299
|
const paths = {};
|
|
22056
|
-
const vendorDir =
|
|
22300
|
+
const vendorDir = join42(buildDir, "angular", "vendor", "server");
|
|
22057
22301
|
for (const specifier of specifiers) {
|
|
22058
|
-
paths[specifier] =
|
|
22302
|
+
paths[specifier] = join42(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
22059
22303
|
}
|
|
22060
22304
|
return paths;
|
|
22061
22305
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -22110,18 +22354,18 @@ __export(exports_buildVueVendor, {
|
|
|
22110
22354
|
buildVueVendor: () => buildVueVendor,
|
|
22111
22355
|
computeVueVendorPaths: () => computeVueVendorPaths
|
|
22112
22356
|
});
|
|
22113
|
-
import { mkdirSync as
|
|
22114
|
-
import { join as
|
|
22357
|
+
import { mkdirSync as mkdirSync11 } from "fs";
|
|
22358
|
+
import { join as join43 } from "path";
|
|
22115
22359
|
import { rm as rm11 } from "fs/promises";
|
|
22116
22360
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
22117
22361
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
22118
|
-
const vendorDir =
|
|
22119
|
-
|
|
22120
|
-
const tmpDir =
|
|
22121
|
-
|
|
22362
|
+
const vendorDir = join43(buildDir, "vue", "vendor");
|
|
22363
|
+
mkdirSync11(vendorDir, { recursive: true });
|
|
22364
|
+
const tmpDir = join43(buildDir, "_vue_vendor_tmp");
|
|
22365
|
+
mkdirSync11(tmpDir, { recursive: true });
|
|
22122
22366
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
22123
22367
|
const safeName = toSafeFileName3(specifier);
|
|
22124
|
-
const entryPath =
|
|
22368
|
+
const entryPath = join43(tmpDir, `${safeName}.ts`);
|
|
22125
22369
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
22126
22370
|
`);
|
|
22127
22371
|
return entryPath;
|
|
@@ -22146,17 +22390,17 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
22146
22390
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
22147
22391
|
return;
|
|
22148
22392
|
}
|
|
22149
|
-
const { readFileSync:
|
|
22393
|
+
const { readFileSync: readFileSync29, writeFileSync: writeFileSync10, readdirSync: readdirSync5 } = await import("fs");
|
|
22150
22394
|
const files = readdirSync5(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
22151
22395
|
for (const file5 of files) {
|
|
22152
|
-
const filePath =
|
|
22153
|
-
const content =
|
|
22396
|
+
const filePath = join43(vendorDir, file5);
|
|
22397
|
+
const content = readFileSync29(filePath, "utf-8");
|
|
22154
22398
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
22155
22399
|
continue;
|
|
22156
22400
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
22157
22401
|
if (patched === content)
|
|
22158
22402
|
continue;
|
|
22159
|
-
|
|
22403
|
+
writeFileSync10(filePath, patched);
|
|
22160
22404
|
}
|
|
22161
22405
|
}, computeVueVendorPaths = () => {
|
|
22162
22406
|
const paths = {};
|
|
@@ -22175,8 +22419,8 @@ __export(exports_buildSvelteVendor, {
|
|
|
22175
22419
|
buildSvelteVendor: () => buildSvelteVendor,
|
|
22176
22420
|
computeSvelteVendorPaths: () => computeSvelteVendorPaths
|
|
22177
22421
|
});
|
|
22178
|
-
import { mkdirSync as
|
|
22179
|
-
import { join as
|
|
22422
|
+
import { mkdirSync as mkdirSync12 } from "fs";
|
|
22423
|
+
import { join as join44 } from "path";
|
|
22180
22424
|
import { rm as rm12 } from "fs/promises";
|
|
22181
22425
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
22182
22426
|
var svelteSpecifiers, isResolvable2 = (specifier) => {
|
|
@@ -22190,13 +22434,13 @@ var svelteSpecifiers, isResolvable2 = (specifier) => {
|
|
|
22190
22434
|
const specifiers = resolveVendorSpecifiers();
|
|
22191
22435
|
if (specifiers.length === 0)
|
|
22192
22436
|
return;
|
|
22193
|
-
const vendorDir =
|
|
22194
|
-
|
|
22195
|
-
const tmpDir =
|
|
22196
|
-
|
|
22437
|
+
const vendorDir = join44(buildDir, "svelte", "vendor");
|
|
22438
|
+
mkdirSync12(vendorDir, { recursive: true });
|
|
22439
|
+
const tmpDir = join44(buildDir, "_svelte_vendor_tmp");
|
|
22440
|
+
mkdirSync12(tmpDir, { recursive: true });
|
|
22197
22441
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
22198
22442
|
const safeName = toSafeFileName4(specifier);
|
|
22199
|
-
const entryPath =
|
|
22443
|
+
const entryPath = join44(tmpDir, `${safeName}.ts`);
|
|
22200
22444
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
22201
22445
|
`);
|
|
22202
22446
|
return entryPath;
|
|
@@ -22238,21 +22482,21 @@ var init_buildSvelteVendor = __esm(() => {
|
|
|
22238
22482
|
import {
|
|
22239
22483
|
copyFileSync as copyFileSync2,
|
|
22240
22484
|
cpSync,
|
|
22241
|
-
existsSync as
|
|
22242
|
-
mkdirSync as
|
|
22485
|
+
existsSync as existsSync32,
|
|
22486
|
+
mkdirSync as mkdirSync13,
|
|
22243
22487
|
readdirSync as readdirSync5,
|
|
22244
|
-
readFileSync as
|
|
22245
|
-
renameSync,
|
|
22488
|
+
readFileSync as readFileSync29,
|
|
22489
|
+
renameSync as renameSync2,
|
|
22246
22490
|
rmSync as rmSync2,
|
|
22247
22491
|
statSync as statSync3,
|
|
22248
|
-
writeFileSync as
|
|
22492
|
+
writeFileSync as writeFileSync10
|
|
22249
22493
|
} from "fs";
|
|
22250
|
-
import { basename as basename14, dirname as dirname24, extname as extname11, join as
|
|
22494
|
+
import { basename as basename14, dirname as dirname24, extname as extname11, join as join45, relative as relative16, resolve as resolve34 } from "path";
|
|
22251
22495
|
import { cwd, env as env3, exit } from "process";
|
|
22252
22496
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
22253
22497
|
var isBuildTraceEnabled = () => {
|
|
22254
22498
|
const value = env3.ABSOLUTE_BUILD_TRACE?.toLowerCase();
|
|
22255
|
-
return value === "1" || value === "true" || value === "yes";
|
|
22499
|
+
return devProfileEnabled || value === "1" || value === "true" || value === "yes";
|
|
22256
22500
|
}, collectConventionSourceFiles = (entry) => {
|
|
22257
22501
|
if (!entry)
|
|
22258
22502
|
return [];
|
|
@@ -22330,7 +22574,7 @@ var isBuildTraceEnabled = () => {
|
|
|
22330
22574
|
}, REACT_VENDOR_SPECIFIERS, findBareReactImports = (path, importRegex) => {
|
|
22331
22575
|
let content;
|
|
22332
22576
|
try {
|
|
22333
|
-
content =
|
|
22577
|
+
content = readFileSync29(path, "utf-8");
|
|
22334
22578
|
} catch {
|
|
22335
22579
|
return [];
|
|
22336
22580
|
}
|
|
@@ -22378,11 +22622,11 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
|
|
|
22378
22622
|
}
|
|
22379
22623
|
exit(1);
|
|
22380
22624
|
}, copyHtmxVendor = (htmxDir, htmxDestDir) => {
|
|
22381
|
-
|
|
22625
|
+
mkdirSync13(htmxDestDir, { recursive: true });
|
|
22382
22626
|
const glob = new Glob8("htmx*.min.js");
|
|
22383
22627
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
22384
|
-
const src =
|
|
22385
|
-
const dest =
|
|
22628
|
+
const src = join45(htmxDir, relPath);
|
|
22629
|
+
const dest = join45(htmxDestDir, "htmx.min.js");
|
|
22386
22630
|
copyFileSync2(src, dest);
|
|
22387
22631
|
return;
|
|
22388
22632
|
}
|
|
@@ -22394,8 +22638,8 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
|
|
|
22394
22638
|
}
|
|
22395
22639
|
}, resolveAbsoluteVersion = async () => {
|
|
22396
22640
|
const candidates = [
|
|
22397
|
-
|
|
22398
|
-
|
|
22641
|
+
resolve34(import.meta.dir, "..", "..", "package.json"),
|
|
22642
|
+
resolve34(import.meta.dir, "..", "package.json")
|
|
22399
22643
|
];
|
|
22400
22644
|
const resolveCandidate = async (remaining) => {
|
|
22401
22645
|
const [candidate, ...rest] = remaining;
|
|
@@ -22411,7 +22655,7 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
|
|
|
22411
22655
|
};
|
|
22412
22656
|
await resolveCandidate(candidates);
|
|
22413
22657
|
}, SKIP_DIRS5, addWorkerPathIfExists = (file5, relPath, workerPaths) => {
|
|
22414
|
-
const absPath =
|
|
22658
|
+
const absPath = resolve34(file5, "..", relPath);
|
|
22415
22659
|
try {
|
|
22416
22660
|
statSync3(absPath);
|
|
22417
22661
|
workerPaths.add(absPath);
|
|
@@ -22426,7 +22670,7 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
|
|
|
22426
22670
|
addWorkerPathIfExists(file5, relPath, workerPaths);
|
|
22427
22671
|
}
|
|
22428
22672
|
}, collectWorkerPathsFromFile = (file5, patterns, workerPaths) => {
|
|
22429
|
-
const content =
|
|
22673
|
+
const content = readFileSync29(file5, "utf-8");
|
|
22430
22674
|
for (const pattern of patterns) {
|
|
22431
22675
|
collectWorkerPathsFromContent(content, pattern, file5, workerPaths);
|
|
22432
22676
|
}
|
|
@@ -22459,8 +22703,8 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
|
|
|
22459
22703
|
vuePagesPath
|
|
22460
22704
|
}) => {
|
|
22461
22705
|
const { readdirSync: readDir } = await import("fs");
|
|
22462
|
-
const devIndexDir =
|
|
22463
|
-
|
|
22706
|
+
const devIndexDir = join45(buildPath, "_src_indexes");
|
|
22707
|
+
mkdirSync13(devIndexDir, { recursive: true });
|
|
22464
22708
|
if (reactIndexesPath && reactPagesPath) {
|
|
22465
22709
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
22466
22710
|
}
|
|
@@ -22471,41 +22715,41 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
|
|
|
22471
22715
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
22472
22716
|
}
|
|
22473
22717
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
22474
|
-
if (!
|
|
22718
|
+
if (!existsSync32(reactIndexesPath)) {
|
|
22475
22719
|
return;
|
|
22476
22720
|
}
|
|
22477
22721
|
const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
|
|
22478
|
-
const pagesRel = relative16(process.cwd(),
|
|
22722
|
+
const pagesRel = relative16(process.cwd(), resolve34(reactPagesPath)).replace(/\\/g, "/");
|
|
22479
22723
|
for (const file5 of indexFiles) {
|
|
22480
|
-
let content =
|
|
22724
|
+
let content = readFileSync29(join45(reactIndexesPath, file5), "utf-8");
|
|
22481
22725
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
22482
|
-
|
|
22726
|
+
writeFileSync10(join45(devIndexDir, file5), content);
|
|
22483
22727
|
}
|
|
22484
22728
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
22485
|
-
const svelteIndexDir =
|
|
22486
|
-
const sveltePageEntries = svelteEntries.filter((file5) =>
|
|
22729
|
+
const svelteIndexDir = join45(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
22730
|
+
const sveltePageEntries = svelteEntries.filter((file5) => resolve34(file5).startsWith(resolve34(sveltePagesPath)));
|
|
22487
22731
|
for (const entry of sveltePageEntries) {
|
|
22488
22732
|
const name = basename14(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
22489
|
-
const indexFile =
|
|
22490
|
-
if (!
|
|
22733
|
+
const indexFile = join45(svelteIndexDir, "pages", `${name}.js`);
|
|
22734
|
+
if (!existsSync32(indexFile))
|
|
22491
22735
|
continue;
|
|
22492
|
-
let content =
|
|
22493
|
-
const srcRel = relative16(process.cwd(),
|
|
22736
|
+
let content = readFileSync29(indexFile, "utf-8");
|
|
22737
|
+
const srcRel = relative16(process.cwd(), resolve34(entry)).replace(/\\/g, "/");
|
|
22494
22738
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
22495
|
-
|
|
22739
|
+
writeFileSync10(join45(devIndexDir, `${name}.svelte.js`), content);
|
|
22496
22740
|
}
|
|
22497
22741
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
22498
|
-
const vueIndexDir =
|
|
22499
|
-
const vuePageEntries = vueEntries.filter((file5) =>
|
|
22742
|
+
const vueIndexDir = join45(getFrameworkGeneratedDir("vue"), "indexes");
|
|
22743
|
+
const vuePageEntries = vueEntries.filter((file5) => resolve34(file5).startsWith(resolve34(vuePagesPath)));
|
|
22500
22744
|
for (const entry of vuePageEntries) {
|
|
22501
22745
|
const name = basename14(entry, ".vue");
|
|
22502
|
-
const indexFile =
|
|
22503
|
-
if (!
|
|
22746
|
+
const indexFile = join45(vueIndexDir, `${name}.js`);
|
|
22747
|
+
if (!existsSync32(indexFile))
|
|
22504
22748
|
continue;
|
|
22505
|
-
let content =
|
|
22506
|
-
const srcRel = relative16(process.cwd(),
|
|
22749
|
+
let content = readFileSync29(indexFile, "utf-8");
|
|
22750
|
+
const srcRel = relative16(process.cwd(), resolve34(entry)).replace(/\\/g, "/");
|
|
22507
22751
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
22508
|
-
|
|
22752
|
+
writeFileSync10(join45(devIndexDir, `${name}.vue.js`), content);
|
|
22509
22753
|
}
|
|
22510
22754
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
22511
22755
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -22516,7 +22760,7 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
|
|
|
22516
22760
|
const last = allComments[allComments.length - 1];
|
|
22517
22761
|
if (!last?.[1])
|
|
22518
22762
|
return JSON.stringify(outputPath);
|
|
22519
|
-
const srcPath =
|
|
22763
|
+
const srcPath = resolve34(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
22520
22764
|
return JSON.stringify(srcPath);
|
|
22521
22765
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
22522
22766
|
let depth = 0;
|
|
@@ -22553,7 +22797,7 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
|
|
|
22553
22797
|
}
|
|
22554
22798
|
return result;
|
|
22555
22799
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
22556
|
-
let content =
|
|
22800
|
+
let content = readFileSync29(outputPath, "utf-8");
|
|
22557
22801
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
22558
22802
|
const useNames = [];
|
|
22559
22803
|
let match;
|
|
@@ -22574,7 +22818,7 @@ ${offenders.map((o3) => ` \u2022 ${o3}`).join(`
|
|
|
22574
22818
|
content = `${content.slice(0, firstUseIdx) + runtime}
|
|
22575
22819
|
${content.slice(firstUseIdx)}`;
|
|
22576
22820
|
content = wrapUseFunctions(content, useNames);
|
|
22577
|
-
|
|
22821
|
+
writeFileSync10(outputPath, content);
|
|
22578
22822
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
22579
22823
|
const urlFileMap = new Map;
|
|
22580
22824
|
for (const srcPath of urlReferencedFiles) {
|
|
@@ -22603,7 +22847,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22603
22847
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
22604
22848
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
22605
22849
|
for (const outputPath of outputPaths) {
|
|
22606
|
-
let content =
|
|
22850
|
+
let content = readFileSync29(outputPath, "utf-8");
|
|
22607
22851
|
let changed = false;
|
|
22608
22852
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
22609
22853
|
const targetName = basename14(relPath);
|
|
@@ -22614,7 +22858,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22614
22858
|
return `new URL('${resolvedPath}', import.meta.url)`;
|
|
22615
22859
|
});
|
|
22616
22860
|
if (changed)
|
|
22617
|
-
|
|
22861
|
+
writeFileSync10(outputPath, content);
|
|
22618
22862
|
}
|
|
22619
22863
|
}, 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) => {
|
|
22620
22864
|
if (!override)
|
|
@@ -22743,10 +22987,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22743
22987
|
restoreTracePhase();
|
|
22744
22988
|
return;
|
|
22745
22989
|
}
|
|
22746
|
-
const traceDir =
|
|
22990
|
+
const traceDir = join45(buildPath2, ".absolute-trace");
|
|
22747
22991
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
22748
|
-
|
|
22749
|
-
|
|
22992
|
+
mkdirSync13(traceDir, { recursive: true });
|
|
22993
|
+
writeFileSync10(join45(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
22750
22994
|
events: traceEvents,
|
|
22751
22995
|
frameworks: traceFrameworkNames,
|
|
22752
22996
|
generatedAt: new Date().toISOString(),
|
|
@@ -22777,16 +23021,16 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22777
23021
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
22778
23022
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
22779
23023
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
22780
|
-
const reactIndexesPath = reactDir &&
|
|
22781
|
-
const reactPagesPath = reactDir &&
|
|
22782
|
-
const htmlPagesPath = htmlDir &&
|
|
22783
|
-
const htmlScriptsPath = htmlDir &&
|
|
22784
|
-
const sveltePagesPath = svelteDir &&
|
|
22785
|
-
const vuePagesPath = vueDir &&
|
|
22786
|
-
const htmxPagesPath = htmxDir &&
|
|
22787
|
-
const htmxScriptsPath = htmxDir &&
|
|
22788
|
-
const angularPagesPath = angularDir &&
|
|
22789
|
-
const emberPagesPath = emberDir &&
|
|
23024
|
+
const reactIndexesPath = reactDir && join45(getFrameworkGeneratedDir("react"), "indexes");
|
|
23025
|
+
const reactPagesPath = reactDir && join45(reactDir, "pages");
|
|
23026
|
+
const htmlPagesPath = htmlDir && join45(htmlDir, "pages");
|
|
23027
|
+
const htmlScriptsPath = htmlDir && join45(htmlDir, "scripts");
|
|
23028
|
+
const sveltePagesPath = svelteDir && join45(svelteDir, "pages");
|
|
23029
|
+
const vuePagesPath = vueDir && join45(vueDir, "pages");
|
|
23030
|
+
const htmxPagesPath = htmxDir && join45(htmxDir, "pages");
|
|
23031
|
+
const htmxScriptsPath = htmxDir && join45(htmxDir, "scripts");
|
|
23032
|
+
const angularPagesPath = angularDir && join45(angularDir, "pages");
|
|
23033
|
+
const emberPagesPath = emberDir && join45(emberDir, "pages");
|
|
22790
23034
|
const frontends = [
|
|
22791
23035
|
reactDir,
|
|
22792
23036
|
htmlDir,
|
|
@@ -22847,14 +23091,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22847
23091
|
const [firstEntry] = serverDirMap;
|
|
22848
23092
|
if (!firstEntry)
|
|
22849
23093
|
throw new Error("Expected at least one server directory entry");
|
|
22850
|
-
serverRoot =
|
|
22851
|
-
serverOutDir =
|
|
23094
|
+
serverRoot = join45(firstEntry.dir, firstEntry.subdir);
|
|
23095
|
+
serverOutDir = join45(buildPath, basename14(firstEntry.dir));
|
|
22852
23096
|
} else if (serverDirMap.length > 1) {
|
|
22853
23097
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
22854
23098
|
serverOutDir = buildPath;
|
|
22855
23099
|
}
|
|
22856
23100
|
const publicPath = publicDirectory && validateSafePath(publicDirectory, projectRoot);
|
|
22857
|
-
await tracePhase("build-dir/create", () =>
|
|
23101
|
+
await tracePhase("build-dir/create", () => mkdirSync13(buildPath, { recursive: true }));
|
|
22858
23102
|
if (publicPath)
|
|
22859
23103
|
await tracePhase("public/copy", () => cpSync(publicPath, buildPath, { force: true, recursive: true }));
|
|
22860
23104
|
const pwaArtifacts = pwa ? await tracePhase("pwa/materialize", () => materializeAbsolutePwa({
|
|
@@ -22867,13 +23111,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22867
23111
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
22868
23112
|
if (!isIncremental || !incrementalFiles)
|
|
22869
23113
|
return entryPoints;
|
|
22870
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f2) =>
|
|
23114
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve34(f2)));
|
|
22871
23115
|
const matchingEntries = [];
|
|
22872
23116
|
for (const entry of entryPoints) {
|
|
22873
23117
|
const sourceFile = mapToSource(entry);
|
|
22874
23118
|
if (!sourceFile)
|
|
22875
23119
|
continue;
|
|
22876
|
-
if (!normalizedIncremental.has(
|
|
23120
|
+
if (!normalizedIncremental.has(resolve34(sourceFile)))
|
|
22877
23121
|
continue;
|
|
22878
23122
|
matchingEntries.push(entry);
|
|
22879
23123
|
}
|
|
@@ -22883,7 +23127,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22883
23127
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
22884
23128
|
}
|
|
22885
23129
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
22886
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
23130
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join45(buildPath, "assets"), {
|
|
22887
23131
|
force: true,
|
|
22888
23132
|
recursive: true
|
|
22889
23133
|
}));
|
|
@@ -22997,11 +23241,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
22997
23241
|
}
|
|
22998
23242
|
}
|
|
22999
23243
|
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
23000
|
-
const htmlConventionsOutDir =
|
|
23001
|
-
|
|
23244
|
+
const htmlConventionsOutDir = join45(buildPath, "conventions", "html");
|
|
23245
|
+
mkdirSync13(htmlConventionsOutDir, { recursive: true });
|
|
23002
23246
|
const htmlPathRemap = new Map;
|
|
23003
23247
|
for (const sourcePath of htmlConventionSources) {
|
|
23004
|
-
const dest =
|
|
23248
|
+
const dest = join45(htmlConventionsOutDir, basename14(sourcePath));
|
|
23005
23249
|
cpSync(sourcePath, dest, { force: true });
|
|
23006
23250
|
htmlPathRemap.set(sourcePath, dest);
|
|
23007
23251
|
}
|
|
@@ -23042,9 +23286,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23042
23286
|
}
|
|
23043
23287
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
23044
23288
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
23045
|
-
if (entry.startsWith(
|
|
23289
|
+
if (entry.startsWith(resolve34(reactIndexesPath))) {
|
|
23046
23290
|
const pageName = basename14(entry, ".tsx");
|
|
23047
|
-
return
|
|
23291
|
+
return join45(reactPagesPath, `${pageName}.tsx`);
|
|
23048
23292
|
}
|
|
23049
23293
|
return null;
|
|
23050
23294
|
}) : allReactEntries;
|
|
@@ -23076,7 +23320,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23076
23320
|
for (const entry of vueEntries) {
|
|
23077
23321
|
const name = basename14(entry, ".vue");
|
|
23078
23322
|
if (ssrOnlyPageNames.has(name)) {
|
|
23079
|
-
resolved.add(
|
|
23323
|
+
resolved.add(resolve34(entry));
|
|
23080
23324
|
}
|
|
23081
23325
|
}
|
|
23082
23326
|
return resolved;
|
|
@@ -23213,7 +23457,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23213
23457
|
const clientPath = islandSvelteClientPaths[idx];
|
|
23214
23458
|
if (!sourcePath || !clientPath)
|
|
23215
23459
|
continue;
|
|
23216
|
-
islandSvelteClientPathMap.set(
|
|
23460
|
+
islandSvelteClientPathMap.set(resolve34(sourcePath), clientPath);
|
|
23217
23461
|
}
|
|
23218
23462
|
const islandVueClientPathMap = new Map;
|
|
23219
23463
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -23221,7 +23465,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23221
23465
|
const clientPath = islandVueClientPaths[idx];
|
|
23222
23466
|
if (!sourcePath || !clientPath)
|
|
23223
23467
|
continue;
|
|
23224
|
-
islandVueClientPathMap.set(
|
|
23468
|
+
islandVueClientPathMap.set(resolve34(sourcePath), clientPath);
|
|
23225
23469
|
}
|
|
23226
23470
|
const islandAngularClientPathMap = new Map;
|
|
23227
23471
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -23229,7 +23473,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23229
23473
|
const clientPath = islandAngularClientPaths[idx];
|
|
23230
23474
|
if (!sourcePath || !clientPath)
|
|
23231
23475
|
continue;
|
|
23232
|
-
islandAngularClientPathMap.set(
|
|
23476
|
+
islandAngularClientPathMap.set(resolve34(sourcePath), clientPath);
|
|
23233
23477
|
}
|
|
23234
23478
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
23235
23479
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -23240,9 +23484,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23240
23484
|
const compileReactConventions = async () => {
|
|
23241
23485
|
if (reactConventionSources.length === 0)
|
|
23242
23486
|
return emptyStringArray;
|
|
23243
|
-
const destDir =
|
|
23487
|
+
const destDir = join45(buildPath, "conventions", "react");
|
|
23244
23488
|
rmSync2(destDir, { force: true, recursive: true });
|
|
23245
|
-
|
|
23489
|
+
mkdirSync13(destDir, { recursive: true });
|
|
23246
23490
|
const destPaths = await Promise.all(reactConventionSources.map(async (source, idx) => {
|
|
23247
23491
|
const result = await bunBuild7({
|
|
23248
23492
|
entrypoints: [source],
|
|
@@ -23283,9 +23527,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23283
23527
|
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 }
|
|
23284
23528
|
]);
|
|
23285
23529
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
23286
|
-
const destDir =
|
|
23530
|
+
const destDir = join45(buildPath, "conventions", framework);
|
|
23287
23531
|
rmSync2(destDir, { force: true, recursive: true });
|
|
23288
|
-
|
|
23532
|
+
mkdirSync13(destDir, { recursive: true });
|
|
23289
23533
|
const destPaths = await Promise.all(compiledPaths.map(async (compiledPath, idx) => {
|
|
23290
23534
|
const name = basename14(compiledPath).replace(/\.[^.]+$/, "");
|
|
23291
23535
|
const result = await bunBuild7({
|
|
@@ -23355,7 +23599,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23355
23599
|
}
|
|
23356
23600
|
})) : {
|
|
23357
23601
|
entries: [],
|
|
23358
|
-
generatedRoot:
|
|
23602
|
+
generatedRoot: join45(buildPath, "_island_entries")
|
|
23359
23603
|
};
|
|
23360
23604
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
23361
23605
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && urlReferencedFiles.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -23391,7 +23635,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23391
23635
|
return {};
|
|
23392
23636
|
}
|
|
23393
23637
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
23394
|
-
const refreshEntry =
|
|
23638
|
+
const refreshEntry = join45(reactIndexesPath, "_refresh.tsx");
|
|
23395
23639
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
23396
23640
|
reactClientEntryPoints.push(refreshEntry);
|
|
23397
23641
|
}
|
|
@@ -23508,19 +23752,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23508
23752
|
throw: false
|
|
23509
23753
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
23510
23754
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
23511
|
-
rmSync2(
|
|
23755
|
+
rmSync2(join45(buildPath, "react", "generated", "indexes"), {
|
|
23512
23756
|
force: true,
|
|
23513
23757
|
recursive: true
|
|
23514
23758
|
});
|
|
23515
23759
|
}
|
|
23516
23760
|
if (angularDir && angularClientPaths.length > 0) {
|
|
23517
|
-
rmSync2(
|
|
23761
|
+
rmSync2(join45(buildPath, "angular", "indexes"), {
|
|
23518
23762
|
force: true,
|
|
23519
23763
|
recursive: true
|
|
23520
23764
|
});
|
|
23521
23765
|
}
|
|
23522
23766
|
if (islandClientEntryPoints.length > 0) {
|
|
23523
|
-
rmSync2(
|
|
23767
|
+
rmSync2(join45(buildPath, "islands"), {
|
|
23524
23768
|
force: true,
|
|
23525
23769
|
recursive: true
|
|
23526
23770
|
});
|
|
@@ -23634,7 +23878,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23634
23878
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
23635
23879
|
entrypoints: globalCssEntries,
|
|
23636
23880
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
23637
|
-
outdir: stylesDir ?
|
|
23881
|
+
outdir: stylesDir ? join45(buildPath, basename14(stylesDir)) : buildPath,
|
|
23638
23882
|
plugins: [stylePreprocessorPlugin2],
|
|
23639
23883
|
root: stylesDir || clientRoot,
|
|
23640
23884
|
target: "browser",
|
|
@@ -23643,7 +23887,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23643
23887
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
23644
23888
|
entrypoints: vueCssPaths,
|
|
23645
23889
|
naming: `[name].[hash].[ext]`,
|
|
23646
|
-
outdir:
|
|
23890
|
+
outdir: join45(buildPath, assetsPath ? basename14(assetsPath) : "assets", "css"),
|
|
23647
23891
|
target: "browser",
|
|
23648
23892
|
throw: false
|
|
23649
23893
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -23659,28 +23903,26 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23659
23903
|
extractBuildError(logs, pass, label, frameworkNames, isIncremental, throwOnError);
|
|
23660
23904
|
};
|
|
23661
23905
|
if (isDev2 && serverResult?.success) {
|
|
23662
|
-
const {
|
|
23663
|
-
|
|
23664
|
-
|
|
23665
|
-
chainBundleInlineSourcemap2(out.path);
|
|
23666
|
-
}
|
|
23906
|
+
const { chainBundleInlineSourcemaps: chainBundleInlineSourcemaps2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
|
|
23907
|
+
const serverBundlePaths = serverOutputs.map((out) => out.path).filter((path) => path.endsWith(".js"));
|
|
23908
|
+
await tracePhase("postprocess/server-sourcemap-chain", () => chainBundleInlineSourcemaps2(serverBundlePaths), { bundles: serverBundlePaths.length });
|
|
23667
23909
|
}
|
|
23668
23910
|
if (!isDev2 && resolveClientSourcemap(sourcemaps, isDev2) === "external") {
|
|
23669
23911
|
const { chainExternalSourcemap: chainExternalSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
|
|
23670
|
-
const sourcemapDir =
|
|
23671
|
-
|
|
23912
|
+
const sourcemapDir = join45(projectRoot, "sourcemaps");
|
|
23913
|
+
mkdirSync13(sourcemapDir, { recursive: true });
|
|
23672
23914
|
const mapFiles = readdirSync5(buildPath, {
|
|
23673
23915
|
encoding: "utf8",
|
|
23674
23916
|
recursive: true
|
|
23675
|
-
}).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) =>
|
|
23917
|
+
}).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) => join45(buildPath, entry));
|
|
23676
23918
|
for (const mapPath of mapFiles) {
|
|
23677
23919
|
chainExternalSourcemap2(mapPath);
|
|
23678
|
-
|
|
23920
|
+
renameSync2(mapPath, join45(sourcemapDir, basename14(mapPath)));
|
|
23679
23921
|
const jsPath = mapPath.slice(0, -4);
|
|
23680
23922
|
try {
|
|
23681
|
-
const javascript =
|
|
23923
|
+
const javascript = readFileSync29(jsPath, "utf-8").replace(/\n?\/\/# sourceMappingURL=[^\n]*\s*$/, `
|
|
23682
23924
|
`);
|
|
23683
|
-
|
|
23925
|
+
writeFileSync10(jsPath, javascript);
|
|
23684
23926
|
} catch {}
|
|
23685
23927
|
}
|
|
23686
23928
|
console.info(`[absolute] sourcemaps: chained + privatized ${mapFiles.length} client maps \u2192 ${relative16(projectRoot, sourcemapDir)}/`);
|
|
@@ -23749,8 +23991,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23749
23991
|
await tracePhase("postprocess/island-vendor-imports", () => rewriteBuildOutputs2(islandClientOutputs, allIslandVendorPaths));
|
|
23750
23992
|
}
|
|
23751
23993
|
if (!hmr) {
|
|
23752
|
-
const reactVendorDir =
|
|
23753
|
-
const vendorChunkPaths =
|
|
23994
|
+
const reactVendorDir = join45(buildPath, "react", "vendor");
|
|
23995
|
+
const vendorChunkPaths = existsSync32(reactVendorDir) ? [
|
|
23754
23996
|
...new Glob8("**/*.js").scanSync({
|
|
23755
23997
|
absolute: true,
|
|
23756
23998
|
cwd: reactVendorDir
|
|
@@ -23894,19 +24136,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23894
24136
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
23895
24137
|
if (!hmrClientBundle)
|
|
23896
24138
|
return;
|
|
23897
|
-
let html =
|
|
24139
|
+
let html = readFileSync29(filePath, "utf-8");
|
|
23898
24140
|
if (html.includes("data-hmr-client"))
|
|
23899
24141
|
return;
|
|
23900
24142
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
23901
24143
|
const bodyClose = /<\/body\s*>/i.exec(html);
|
|
23902
24144
|
html = bodyClose ? html.slice(0, bodyClose.index) + tag + html.slice(bodyClose.index) : html + tag;
|
|
23903
|
-
|
|
24145
|
+
writeFileSync10(filePath, html);
|
|
23904
24146
|
};
|
|
23905
24147
|
const processHtmlPages = async () => {
|
|
23906
24148
|
if (!(htmlDir && htmlPagesPath))
|
|
23907
24149
|
return;
|
|
23908
|
-
const outputHtmlPages = isSingle ?
|
|
23909
|
-
|
|
24150
|
+
const outputHtmlPages = isSingle ? join45(buildPath, "pages") : join45(buildPath, basename14(htmlDir), "pages");
|
|
24151
|
+
mkdirSync13(outputHtmlPages, { recursive: true });
|
|
23910
24152
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
23911
24153
|
force: true,
|
|
23912
24154
|
recursive: true
|
|
@@ -23921,8 +24163,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23921
24163
|
if (hmr)
|
|
23922
24164
|
injectHMRIntoHTMLFile(htmlFile, "html");
|
|
23923
24165
|
if (pwaArtifacts) {
|
|
23924
|
-
const source =
|
|
23925
|
-
|
|
24166
|
+
const source = readFileSync29(htmlFile, "utf8");
|
|
24167
|
+
writeFileSync10(htmlFile, injectPwaBootstrapHtml(source));
|
|
23926
24168
|
}
|
|
23927
24169
|
const fileName = basename14(htmlFile, ".html");
|
|
23928
24170
|
if (manifest[fileName] && manifest[fileName] !== htmlFile) {
|
|
@@ -23934,14 +24176,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23934
24176
|
const processHtmxPages = async () => {
|
|
23935
24177
|
if (!(htmxDir && htmxPagesPath))
|
|
23936
24178
|
return;
|
|
23937
|
-
const outputHtmxPages = isSingle ?
|
|
23938
|
-
|
|
24179
|
+
const outputHtmxPages = isSingle ? join45(buildPath, "pages") : join45(buildPath, basename14(htmxDir), "pages");
|
|
24180
|
+
mkdirSync13(outputHtmxPages, { recursive: true });
|
|
23939
24181
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
23940
24182
|
force: true,
|
|
23941
24183
|
recursive: true
|
|
23942
24184
|
});
|
|
23943
24185
|
if (shouldCopyHtmx) {
|
|
23944
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
24186
|
+
const htmxDestDir = isSingle ? buildPath : join45(buildPath, basename14(htmxDir));
|
|
23945
24187
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
23946
24188
|
}
|
|
23947
24189
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -23954,8 +24196,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
23954
24196
|
if (hmr)
|
|
23955
24197
|
injectHMRIntoHTMLFile(htmxFile, "htmx");
|
|
23956
24198
|
if (pwaArtifacts) {
|
|
23957
|
-
const source =
|
|
23958
|
-
|
|
24199
|
+
const source = readFileSync29(htmxFile, "utf8");
|
|
24200
|
+
writeFileSync10(htmxFile, injectPwaBootstrapHtml(source));
|
|
23959
24201
|
}
|
|
23960
24202
|
const fileName = basename14(htmxFile, ".html");
|
|
23961
24203
|
if (manifest[fileName] && manifest[fileName] !== htmxFile) {
|
|
@@ -24032,7 +24274,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
24032
24274
|
}))
|
|
24033
24275
|
];
|
|
24034
24276
|
setSpaRouteManifest(spaRouteHosts);
|
|
24035
|
-
|
|
24277
|
+
writeFileSync10(join45(buildPath, "spa-routes.json"), JSON.stringify(spaRouteHosts, null, "\t"));
|
|
24036
24278
|
if (isIncremental) {
|
|
24037
24279
|
writeBuildTrace(buildPath);
|
|
24038
24280
|
return {
|
|
@@ -24041,9 +24283,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
24041
24283
|
manifest
|
|
24042
24284
|
};
|
|
24043
24285
|
}
|
|
24044
|
-
|
|
24286
|
+
writeFileSync10(join45(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
24045
24287
|
if (Object.keys(conventionsMap).length > 0) {
|
|
24046
|
-
|
|
24288
|
+
writeFileSync10(join45(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
24047
24289
|
}
|
|
24048
24290
|
writeBuildTrace(buildPath);
|
|
24049
24291
|
if (mode === "production") {
|
|
@@ -24108,6 +24350,7 @@ var init_build = __esm(() => {
|
|
|
24108
24350
|
init_hmrInjectionPlugin();
|
|
24109
24351
|
init_cleanStaleOutputs();
|
|
24110
24352
|
init_cleanup();
|
|
24353
|
+
init_startupTimings();
|
|
24111
24354
|
init_commonAncestor();
|
|
24112
24355
|
init_generatedDir();
|
|
24113
24356
|
init_buildDirectoryLock();
|
|
@@ -24176,8 +24419,8 @@ var init_build = __esm(() => {
|
|
|
24176
24419
|
});
|
|
24177
24420
|
|
|
24178
24421
|
// src/build/buildEmberVendor.ts
|
|
24179
|
-
import { mkdirSync as
|
|
24180
|
-
import { join as
|
|
24422
|
+
import { mkdirSync as mkdirSync14, existsSync as existsSync33 } from "fs";
|
|
24423
|
+
import { join as join46 } from "path";
|
|
24181
24424
|
import { rm as rm13 } from "fs/promises";
|
|
24182
24425
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
24183
24426
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -24229,8 +24472,8 @@ export const importSync = (specifier) => {
|
|
|
24229
24472
|
if (standaloneSpecifiers.has(specifier)) {
|
|
24230
24473
|
return { resolveTo: specifier, specifier };
|
|
24231
24474
|
}
|
|
24232
|
-
const emberInternalPath =
|
|
24233
|
-
if (!
|
|
24475
|
+
const emberInternalPath = join46(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
24476
|
+
if (!existsSync33(emberInternalPath)) {
|
|
24234
24477
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
24235
24478
|
}
|
|
24236
24479
|
return { resolveTo: emberInternalPath, specifier };
|
|
@@ -24261,24 +24504,24 @@ export const importSync = (specifier) => {
|
|
|
24261
24504
|
if (standalonePackages.has(args.path)) {
|
|
24262
24505
|
return;
|
|
24263
24506
|
}
|
|
24264
|
-
const internal =
|
|
24265
|
-
if (
|
|
24507
|
+
const internal = join46(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
24508
|
+
if (existsSync33(internal)) {
|
|
24266
24509
|
return { path: internal };
|
|
24267
24510
|
}
|
|
24268
24511
|
return;
|
|
24269
24512
|
});
|
|
24270
24513
|
}
|
|
24271
24514
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
24272
|
-
const vendorDir =
|
|
24273
|
-
|
|
24274
|
-
const tmpDir =
|
|
24275
|
-
|
|
24276
|
-
const macrosShimPath =
|
|
24515
|
+
const vendorDir = join46(buildDir, "ember", "vendor");
|
|
24516
|
+
mkdirSync14(vendorDir, { recursive: true });
|
|
24517
|
+
const tmpDir = join46(buildDir, "_ember_vendor_tmp");
|
|
24518
|
+
mkdirSync14(tmpDir, { recursive: true });
|
|
24519
|
+
const macrosShimPath = join46(tmpDir, "embroider_macros_shim.js");
|
|
24277
24520
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
24278
24521
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
24279
24522
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
24280
24523
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
24281
|
-
const entryPath =
|
|
24524
|
+
const entryPath = join46(tmpDir, `${safeName}.js`);
|
|
24282
24525
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
24283
24526
|
` : generateVendorEntrySource2(resolution);
|
|
24284
24527
|
await Bun.write(entryPath, source);
|
|
@@ -24434,9 +24677,9 @@ __export(exports_dependencyGraph, {
|
|
|
24434
24677
|
getAffectedFiles: () => getAffectedFiles,
|
|
24435
24678
|
removeFileFromGraph: () => removeFileFromGraph
|
|
24436
24679
|
});
|
|
24437
|
-
import { existsSync as
|
|
24680
|
+
import { existsSync as existsSync34, readFileSync as readFileSync30 } from "fs";
|
|
24438
24681
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
24439
|
-
import { resolve as
|
|
24682
|
+
import { resolve as resolve35 } from "path";
|
|
24440
24683
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
24441
24684
|
const lower = filePath.toLowerCase();
|
|
24442
24685
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -24450,8 +24693,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24450
24693
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
24451
24694
|
return null;
|
|
24452
24695
|
}
|
|
24453
|
-
const fromDir =
|
|
24454
|
-
const normalized =
|
|
24696
|
+
const fromDir = resolve35(fromFile, "..");
|
|
24697
|
+
const normalized = resolve35(fromDir, importPath);
|
|
24455
24698
|
const extensions = [
|
|
24456
24699
|
".ts",
|
|
24457
24700
|
".tsx",
|
|
@@ -24464,10 +24707,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24464
24707
|
];
|
|
24465
24708
|
for (const ext of extensions) {
|
|
24466
24709
|
const withExt = normalized + ext;
|
|
24467
|
-
if (
|
|
24710
|
+
if (existsSync34(withExt))
|
|
24468
24711
|
return withExt;
|
|
24469
24712
|
}
|
|
24470
|
-
if (
|
|
24713
|
+
if (existsSync34(normalized))
|
|
24471
24714
|
return normalized;
|
|
24472
24715
|
return null;
|
|
24473
24716
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -24481,8 +24724,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24481
24724
|
dependents.delete(normalizedPath);
|
|
24482
24725
|
}
|
|
24483
24726
|
}, addFileToGraph = (graph, filePath) => {
|
|
24484
|
-
const normalizedPath =
|
|
24485
|
-
if (!
|
|
24727
|
+
const normalizedPath = resolve35(filePath);
|
|
24728
|
+
if (!existsSync34(normalizedPath))
|
|
24486
24729
|
return;
|
|
24487
24730
|
const dependencies = extractDependencies(normalizedPath);
|
|
24488
24731
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -24508,10 +24751,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24508
24751
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
24509
24752
|
const processedFiles = new Set;
|
|
24510
24753
|
const glob = new Glob9("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
24511
|
-
const resolvedDirs = directories.map((dir) =>
|
|
24754
|
+
const resolvedDirs = directories.map((dir) => resolve35(dir)).filter((dir) => existsSync34(dir));
|
|
24512
24755
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
24513
24756
|
for (const file5 of allFiles) {
|
|
24514
|
-
const fullPath =
|
|
24757
|
+
const fullPath = resolve35(file5);
|
|
24515
24758
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
24516
24759
|
continue;
|
|
24517
24760
|
if (processedFiles.has(fullPath))
|
|
@@ -24605,15 +24848,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24605
24848
|
const lowerPath = filePath.toLowerCase();
|
|
24606
24849
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
24607
24850
|
if (loader === "html") {
|
|
24608
|
-
const content =
|
|
24851
|
+
const content = readFileSync30(filePath, "utf-8");
|
|
24609
24852
|
return extractHtmlDependencies(filePath, content);
|
|
24610
24853
|
}
|
|
24611
24854
|
if (loader === "tsx" || loader === "js") {
|
|
24612
|
-
const content =
|
|
24855
|
+
const content = readFileSync30(filePath, "utf-8");
|
|
24613
24856
|
return extractJsDependencies(filePath, content, loader);
|
|
24614
24857
|
}
|
|
24615
24858
|
if (isSvelteOrVue) {
|
|
24616
|
-
const content =
|
|
24859
|
+
const content = readFileSync30(filePath, "utf-8");
|
|
24617
24860
|
return extractSvelteVueDependencies(filePath, content);
|
|
24618
24861
|
}
|
|
24619
24862
|
return [];
|
|
@@ -24624,7 +24867,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24624
24867
|
return [];
|
|
24625
24868
|
}
|
|
24626
24869
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
24627
|
-
const normalizedPath =
|
|
24870
|
+
const normalizedPath = resolve35(changedFile);
|
|
24628
24871
|
const affected = new Set;
|
|
24629
24872
|
const toProcess = [normalizedPath];
|
|
24630
24873
|
const processNode = (current) => {
|
|
@@ -24655,7 +24898,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24655
24898
|
}, removeDependentsForFile = (graph, normalizedPath) => {
|
|
24656
24899
|
graph.dependents.delete(normalizedPath);
|
|
24657
24900
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
24658
|
-
const normalizedPath =
|
|
24901
|
+
const normalizedPath = resolve35(filePath);
|
|
24659
24902
|
removeDepsForFile(graph, normalizedPath);
|
|
24660
24903
|
removeDependentsForFile(graph, normalizedPath);
|
|
24661
24904
|
};
|
|
@@ -24698,12 +24941,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
24698
24941
|
};
|
|
24699
24942
|
|
|
24700
24943
|
// src/dev/configResolver.ts
|
|
24701
|
-
import { resolve as
|
|
24944
|
+
import { resolve as resolve36 } from "path";
|
|
24702
24945
|
var resolveBuildPaths = (config) => {
|
|
24703
24946
|
const cwd2 = process.cwd();
|
|
24704
24947
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
24705
|
-
const withDefault = (value, fallback) => normalize(
|
|
24706
|
-
const optional = (value) => value ? normalize(
|
|
24948
|
+
const withDefault = (value, fallback) => normalize(resolve36(cwd2, value ?? fallback));
|
|
24949
|
+
const optional = (value) => value ? normalize(resolve36(cwd2, value)) : undefined;
|
|
24707
24950
|
return {
|
|
24708
24951
|
angularDir: optional(config.angularDirectory),
|
|
24709
24952
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -24762,8 +25005,8 @@ var init_clientManager = __esm(() => {
|
|
|
24762
25005
|
});
|
|
24763
25006
|
|
|
24764
25007
|
// src/dev/pathUtils.ts
|
|
24765
|
-
import { existsSync as
|
|
24766
|
-
import { dirname as dirname25, resolve as
|
|
25008
|
+
import { existsSync as existsSync35, readdirSync as readdirSync6, readFileSync as readFileSync31 } from "fs";
|
|
25009
|
+
import { dirname as dirname25, resolve as resolve37 } from "path";
|
|
24767
25010
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
24768
25011
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
24769
25012
|
return "ignored";
|
|
@@ -24839,7 +25082,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
24839
25082
|
return "unknown";
|
|
24840
25083
|
}, collectAngularResourceDirs = (angularDir) => {
|
|
24841
25084
|
const out = new Set;
|
|
24842
|
-
const angularRoot =
|
|
25085
|
+
const angularRoot = resolve37(angularDir);
|
|
24843
25086
|
const angularRootNormalized = normalizePath2(angularRoot);
|
|
24844
25087
|
const walk = (dir) => {
|
|
24845
25088
|
let entries;
|
|
@@ -24852,7 +25095,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
24852
25095
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
24853
25096
|
continue;
|
|
24854
25097
|
}
|
|
24855
|
-
const full =
|
|
25098
|
+
const full = resolve37(dir, entry.name);
|
|
24856
25099
|
if (entry.isDirectory()) {
|
|
24857
25100
|
walk(full);
|
|
24858
25101
|
continue;
|
|
@@ -24862,7 +25105,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
24862
25105
|
}
|
|
24863
25106
|
let source;
|
|
24864
25107
|
try {
|
|
24865
|
-
source =
|
|
25108
|
+
source = readFileSync31(full, "utf8");
|
|
24866
25109
|
} catch {
|
|
24867
25110
|
continue;
|
|
24868
25111
|
}
|
|
@@ -24893,7 +25136,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
24893
25136
|
}
|
|
24894
25137
|
const componentDir = dirname25(full);
|
|
24895
25138
|
for (const ref of refs) {
|
|
24896
|
-
const refAbs = normalizePath2(
|
|
25139
|
+
const refAbs = normalizePath2(resolve37(componentDir, ref));
|
|
24897
25140
|
const refDir = normalizePath2(dirname25(refAbs));
|
|
24898
25141
|
if (refDir === angularRootNormalized || refDir.startsWith(`${angularRootNormalized}/`)) {
|
|
24899
25142
|
continue;
|
|
@@ -24910,7 +25153,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
24910
25153
|
const push = (path) => {
|
|
24911
25154
|
if (!path)
|
|
24912
25155
|
return;
|
|
24913
|
-
const abs = normalizePath2(
|
|
25156
|
+
const abs = normalizePath2(resolve37(cwd2, path));
|
|
24914
25157
|
if (!roots.includes(abs))
|
|
24915
25158
|
roots.push(abs);
|
|
24916
25159
|
};
|
|
@@ -24935,8 +25178,8 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
24935
25178
|
push(cfg.assetsDir);
|
|
24936
25179
|
push(cfg.stylesDir);
|
|
24937
25180
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
24938
|
-
const abs = normalizePath2(
|
|
24939
|
-
if (
|
|
25181
|
+
const abs = normalizePath2(resolve37(cwd2, candidate));
|
|
25182
|
+
if (existsSync35(abs) && !roots.includes(abs))
|
|
24940
25183
|
roots.push(abs);
|
|
24941
25184
|
}
|
|
24942
25185
|
try {
|
|
@@ -24946,7 +25189,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
24946
25189
|
continue;
|
|
24947
25190
|
if (entry.name.startsWith("."))
|
|
24948
25191
|
continue;
|
|
24949
|
-
const abs = normalizePath2(
|
|
25192
|
+
const abs = normalizePath2(resolve37(cwd2, entry.name));
|
|
24950
25193
|
if (roots.includes(abs))
|
|
24951
25194
|
continue;
|
|
24952
25195
|
if (shouldIgnorePath(abs, resolved))
|
|
@@ -25029,8 +25272,8 @@ var init_pathUtils = __esm(() => {
|
|
|
25029
25272
|
|
|
25030
25273
|
// src/dev/fileWatcher.ts
|
|
25031
25274
|
import { watch } from "fs";
|
|
25032
|
-
import { existsSync as
|
|
25033
|
-
import { dirname as dirname26, join as
|
|
25275
|
+
import { existsSync as existsSync36, readdirSync as readdirSync7, statSync as statSync4 } from "fs";
|
|
25276
|
+
import { dirname as dirname26, join as join47, resolve as resolve38 } from "path";
|
|
25034
25277
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
25035
25278
|
try {
|
|
25036
25279
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -25062,7 +25305,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25062
25305
|
for (const name of entries) {
|
|
25063
25306
|
if (shouldSkipFilename(name, isStylesDir))
|
|
25064
25307
|
continue;
|
|
25065
|
-
const child =
|
|
25308
|
+
const child = join47(eventDir, name).replace(/\\/g, "/");
|
|
25066
25309
|
let st2;
|
|
25067
25310
|
try {
|
|
25068
25311
|
st2 = statSync4(child);
|
|
@@ -25083,7 +25326,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25083
25326
|
return;
|
|
25084
25327
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
25085
25328
|
if (event === "rename") {
|
|
25086
|
-
const eventDir = dirname26(
|
|
25329
|
+
const eventDir = dirname26(join47(absolutePath, filename)).replace(/\\/g, "/");
|
|
25087
25330
|
atomicRecoveryScan(eventDir);
|
|
25088
25331
|
for (const delay of [25, 100]) {
|
|
25089
25332
|
const timer = setTimeout(() => atomicRecoveryScan(eventDir), delay);
|
|
@@ -25092,16 +25335,16 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25092
25335
|
}
|
|
25093
25336
|
return;
|
|
25094
25337
|
}
|
|
25095
|
-
const fullPath =
|
|
25338
|
+
const fullPath = join47(absolutePath, filename).replace(/\\/g, "/");
|
|
25096
25339
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
25097
25340
|
return;
|
|
25098
25341
|
}
|
|
25099
|
-
if (event === "rename" && !
|
|
25342
|
+
if (event === "rename" && !existsSync36(fullPath)) {
|
|
25100
25343
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
25101
25344
|
onFileChange(fullPath);
|
|
25102
25345
|
return;
|
|
25103
25346
|
}
|
|
25104
|
-
if (
|
|
25347
|
+
if (existsSync36(fullPath)) {
|
|
25105
25348
|
onFileChange(fullPath);
|
|
25106
25349
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
25107
25350
|
}
|
|
@@ -25110,8 +25353,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25110
25353
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
25111
25354
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
25112
25355
|
paths.forEach((path) => {
|
|
25113
|
-
const absolutePath =
|
|
25114
|
-
if (!
|
|
25356
|
+
const absolutePath = resolve38(path).replace(/\\/g, "/");
|
|
25357
|
+
if (!existsSync36(absolutePath)) {
|
|
25115
25358
|
return;
|
|
25116
25359
|
}
|
|
25117
25360
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -25121,8 +25364,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25121
25364
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
25122
25365
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
25123
25366
|
watchPaths.forEach((path) => {
|
|
25124
|
-
const absolutePath =
|
|
25125
|
-
if (!
|
|
25367
|
+
const absolutePath = resolve38(path).replace(/\\/g, "/");
|
|
25368
|
+
if (!existsSync36(absolutePath)) {
|
|
25126
25369
|
return;
|
|
25127
25370
|
}
|
|
25128
25371
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -25140,13 +25383,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
25140
25383
|
});
|
|
25141
25384
|
|
|
25142
25385
|
// src/dev/assetStore.ts
|
|
25143
|
-
import { resolve as
|
|
25386
|
+
import { resolve as resolve39 } from "path";
|
|
25144
25387
|
import { readdir as readdir5, unlink } from "fs/promises";
|
|
25145
25388
|
var mimeTypes, getMimeType = (filePath) => {
|
|
25146
25389
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
25147
25390
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
25148
25391
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
25149
|
-
const fullPath =
|
|
25392
|
+
const fullPath = resolve39(dir, entry.name);
|
|
25150
25393
|
if (entry.isDirectory()) {
|
|
25151
25394
|
return walkAndClean(fullPath);
|
|
25152
25395
|
}
|
|
@@ -25162,10 +25405,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
25162
25405
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
25163
25406
|
const liveByIdentity = new Map;
|
|
25164
25407
|
for (const webPath of store.keys()) {
|
|
25165
|
-
const diskPath =
|
|
25408
|
+
const diskPath = resolve39(buildDir, webPath.slice(1));
|
|
25166
25409
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
25167
25410
|
}
|
|
25168
|
-
const absBuildDir =
|
|
25411
|
+
const absBuildDir = resolve39(buildDir);
|
|
25169
25412
|
Object.values(manifest).forEach((val) => {
|
|
25170
25413
|
if (!HASHED_FILE_RE.test(val))
|
|
25171
25414
|
return;
|
|
@@ -25183,7 +25426,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
25183
25426
|
} catch {}
|
|
25184
25427
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
25185
25428
|
if (entry.isDirectory()) {
|
|
25186
|
-
return scanDir(
|
|
25429
|
+
return scanDir(resolve39(dir, entry.name), `${prefix}${entry.name}/`);
|
|
25187
25430
|
}
|
|
25188
25431
|
if (!entry.name.startsWith("chunk-")) {
|
|
25189
25432
|
return null;
|
|
@@ -25192,7 +25435,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
25192
25435
|
if (store.has(webPath)) {
|
|
25193
25436
|
return null;
|
|
25194
25437
|
}
|
|
25195
|
-
return Bun.file(
|
|
25438
|
+
return Bun.file(resolve39(dir, entry.name)).bytes().then((bytes) => {
|
|
25196
25439
|
store.set(webPath, bytes);
|
|
25197
25440
|
return;
|
|
25198
25441
|
}).catch(() => {});
|
|
@@ -25214,7 +25457,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
25214
25457
|
for (const webPath of newIdentities.values()) {
|
|
25215
25458
|
if (store.has(webPath))
|
|
25216
25459
|
continue;
|
|
25217
|
-
loadPromises.push(Bun.file(
|
|
25460
|
+
loadPromises.push(Bun.file(resolve39(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
25218
25461
|
store.set(webPath, bytes);
|
|
25219
25462
|
return;
|
|
25220
25463
|
}).catch(() => {}));
|
|
@@ -25259,10 +25502,10 @@ var init_assetStore = __esm(() => {
|
|
|
25259
25502
|
});
|
|
25260
25503
|
|
|
25261
25504
|
// src/dev/fileHashTracker.ts
|
|
25262
|
-
import { readFileSync as
|
|
25505
|
+
import { readFileSync as readFileSync32 } from "fs";
|
|
25263
25506
|
var computeFileHash = (filePath) => {
|
|
25264
25507
|
try {
|
|
25265
|
-
const fileContent =
|
|
25508
|
+
const fileContent = readFileSync32(filePath);
|
|
25266
25509
|
return Number(Bun.hash(fileContent));
|
|
25267
25510
|
} catch {
|
|
25268
25511
|
return UNFOUND_INDEX;
|
|
@@ -25355,9 +25598,9 @@ var init_transformCache = __esm(() => {
|
|
|
25355
25598
|
});
|
|
25356
25599
|
|
|
25357
25600
|
// src/dev/reactComponentClassifier.ts
|
|
25358
|
-
import { resolve as
|
|
25601
|
+
import { resolve as resolve40 } from "path";
|
|
25359
25602
|
var classifyComponent = (filePath) => {
|
|
25360
|
-
const normalizedPath =
|
|
25603
|
+
const normalizedPath = resolve40(filePath);
|
|
25361
25604
|
if (normalizedPath.includes("/react/pages/")) {
|
|
25362
25605
|
return "server";
|
|
25363
25606
|
}
|
|
@@ -25369,7 +25612,7 @@ var classifyComponent = (filePath) => {
|
|
|
25369
25612
|
var init_reactComponentClassifier = () => {};
|
|
25370
25613
|
|
|
25371
25614
|
// src/dev/moduleMapper.ts
|
|
25372
|
-
import { basename as basename15, resolve as
|
|
25615
|
+
import { basename as basename15, resolve as resolve41 } from "path";
|
|
25373
25616
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
25374
25617
|
const modulePaths = {};
|
|
25375
25618
|
moduleKeys.forEach((key) => {
|
|
@@ -25379,7 +25622,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
25379
25622
|
});
|
|
25380
25623
|
return modulePaths;
|
|
25381
25624
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
25382
|
-
const normalizedFile =
|
|
25625
|
+
const normalizedFile = resolve41(sourceFile);
|
|
25383
25626
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
25384
25627
|
if (processedFiles.has(normalizedFile)) {
|
|
25385
25628
|
return null;
|
|
@@ -25415,7 +25658,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
25415
25658
|
});
|
|
25416
25659
|
return grouped;
|
|
25417
25660
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
25418
|
-
const normalizedFile =
|
|
25661
|
+
const normalizedFile = resolve41(sourceFile);
|
|
25419
25662
|
const fileName = basename15(normalizedFile);
|
|
25420
25663
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
25421
25664
|
const pascalName = toPascal(baseName);
|
|
@@ -25471,7 +25714,7 @@ var init_moduleMapper = __esm(() => {
|
|
|
25471
25714
|
|
|
25472
25715
|
// src/utils/spaRouteCss.ts
|
|
25473
25716
|
import { readFile as readFile9 } from "fs/promises";
|
|
25474
|
-
import { dirname as dirname27, isAbsolute as isAbsolute5, resolve as
|
|
25717
|
+
import { dirname as dirname27, isAbsolute as isAbsolute5, resolve as resolve42 } from "path";
|
|
25475
25718
|
var sideManifestCache, readSideManifest = async (sideManifestPath) => {
|
|
25476
25719
|
const cached = sideManifestCache.get(sideManifestPath);
|
|
25477
25720
|
if (cached !== undefined)
|
|
@@ -25509,7 +25752,7 @@ var sideManifestCache, readSideManifest = async (sideManifestPath) => {
|
|
|
25509
25752
|
}, readChildCss = async (cssPath, sideManifestPath) => {
|
|
25510
25753
|
if (!cssPath)
|
|
25511
25754
|
return "";
|
|
25512
|
-
const resolvedCssPath = isAbsolute5(cssPath) ? cssPath :
|
|
25755
|
+
const resolvedCssPath = isAbsolute5(cssPath) ? cssPath : resolve42(dirname27(sideManifestPath), cssPath);
|
|
25513
25756
|
const cached = childCssCache.get(resolvedCssPath);
|
|
25514
25757
|
if (cached !== undefined)
|
|
25515
25758
|
return cached;
|
|
@@ -25592,8 +25835,8 @@ __export(exports_resolveOwningComponents, {
|
|
|
25592
25835
|
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
25593
25836
|
resolveOwningComponents: () => resolveOwningComponents
|
|
25594
25837
|
});
|
|
25595
|
-
import { readdirSync as readdirSync8, readFileSync as
|
|
25596
|
-
import { dirname as dirname28, extname as extname12, join as
|
|
25838
|
+
import { readdirSync as readdirSync8, readFileSync as readFileSync33, statSync as statSync5 } from "fs";
|
|
25839
|
+
import { dirname as dirname28, extname as extname12, join as join48, resolve as resolve43 } from "path";
|
|
25597
25840
|
import ts19 from "typescript";
|
|
25598
25841
|
var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
25599
25842
|
const out = [];
|
|
@@ -25608,7 +25851,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
25608
25851
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
25609
25852
|
continue;
|
|
25610
25853
|
}
|
|
25611
|
-
const full =
|
|
25854
|
+
const full = join48(dir, entry.name);
|
|
25612
25855
|
if (entry.isDirectory()) {
|
|
25613
25856
|
visit(full);
|
|
25614
25857
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -25652,7 +25895,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
25652
25895
|
}, parseDecoratedClasses = (filePath) => {
|
|
25653
25896
|
let source;
|
|
25654
25897
|
try {
|
|
25655
|
-
source =
|
|
25898
|
+
source = readFileSync33(filePath, "utf8");
|
|
25656
25899
|
} catch {
|
|
25657
25900
|
return [];
|
|
25658
25901
|
}
|
|
@@ -25706,7 +25949,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
25706
25949
|
};
|
|
25707
25950
|
visit(sourceFile);
|
|
25708
25951
|
return out;
|
|
25709
|
-
}, safeNormalize = (path) =>
|
|
25952
|
+
}, safeNormalize = (path) => resolve43(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
25710
25953
|
const { changedFilePath, userAngularRoot } = params;
|
|
25711
25954
|
const changedAbs = safeNormalize(changedFilePath);
|
|
25712
25955
|
const out = [];
|
|
@@ -25742,7 +25985,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
25742
25985
|
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
25743
25986
|
let source;
|
|
25744
25987
|
try {
|
|
25745
|
-
source =
|
|
25988
|
+
source = readFileSync33(childFilePath, "utf8");
|
|
25746
25989
|
} catch {
|
|
25747
25990
|
return null;
|
|
25748
25991
|
}
|
|
@@ -25775,7 +26018,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
25775
26018
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
25776
26019
|
return null;
|
|
25777
26020
|
}
|
|
25778
|
-
const base =
|
|
26021
|
+
const base = resolve43(childDir, spec);
|
|
25779
26022
|
const candidates = [
|
|
25780
26023
|
`${base}.ts`,
|
|
25781
26024
|
`${base}.tsx`,
|
|
@@ -25813,7 +26056,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
25813
26056
|
};
|
|
25814
26057
|
if (cls.kind === "component") {
|
|
25815
26058
|
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
25816
|
-
const abs = safeNormalize(
|
|
26059
|
+
const abs = safeNormalize(resolve43(componentDir, url));
|
|
25817
26060
|
const existing = resource.get(abs);
|
|
25818
26061
|
if (existing)
|
|
25819
26062
|
existing.push(entity);
|
|
@@ -26061,8 +26304,8 @@ __export(exports_moduleServer, {
|
|
|
26061
26304
|
warmCompilers: () => warmCompilers,
|
|
26062
26305
|
warnIfReactFastRefreshUnsupported: () => warnIfReactFastRefreshUnsupported
|
|
26063
26306
|
});
|
|
26064
|
-
import { existsSync as
|
|
26065
|
-
import { basename as basename16, dirname as dirname29, extname as extname13, join as
|
|
26307
|
+
import { existsSync as existsSync37, readFileSync as readFileSync34, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
|
|
26308
|
+
import { basename as basename16, dirname as dirname29, extname as extname13, join as join49, resolve as resolve44, relative as relative17 } from "path";
|
|
26066
26309
|
var SRC_PREFIX = "/@src/", BROWSER_DEFINE, jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
26067
26310
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
26068
26311
|
const allExports = [];
|
|
@@ -26082,10 +26325,10 @@ var SRC_PREFIX = "/@src/", BROWSER_DEFINE, jsTranspiler2, legacyDecoratorTsconfi
|
|
|
26082
26325
|
${stubs}
|
|
26083
26326
|
`;
|
|
26084
26327
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
26085
|
-
const directHit = extensions.find((ext) =>
|
|
26328
|
+
const directHit = extensions.find((ext) => existsSync37(resolve44(projectRoot, srcPath + ext)));
|
|
26086
26329
|
if (directHit)
|
|
26087
26330
|
return srcPath + directHit;
|
|
26088
|
-
const indexHit = extensions.find((ext) =>
|
|
26331
|
+
const indexHit = extensions.find((ext) => existsSync37(resolve44(projectRoot, srcPath, `index${ext}`)));
|
|
26089
26332
|
if (indexHit)
|
|
26090
26333
|
return `${srcPath}/index${indexHit}`;
|
|
26091
26334
|
return srcPath;
|
|
@@ -26108,7 +26351,7 @@ ${stubs}
|
|
|
26108
26351
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
26109
26352
|
}, srcUrl = (relPath, projectRoot) => {
|
|
26110
26353
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
26111
|
-
const absPath =
|
|
26354
|
+
const absPath = resolve44(projectRoot, relPath);
|
|
26112
26355
|
const cached = mtimeCache.get(absPath);
|
|
26113
26356
|
if (cached !== undefined)
|
|
26114
26357
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -26120,12 +26363,12 @@ ${stubs}
|
|
|
26120
26363
|
return base;
|
|
26121
26364
|
}
|
|
26122
26365
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
26123
|
-
const absPath =
|
|
26366
|
+
const absPath = resolve44(fileDir, relPath);
|
|
26124
26367
|
const rel = relative17(projectRoot, absPath);
|
|
26125
26368
|
const extension = extname13(rel);
|
|
26126
26369
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
26127
26370
|
if (extname13(srcPath) === ".svelte") {
|
|
26128
|
-
srcPath = relative17(projectRoot, resolveSvelteModulePath(
|
|
26371
|
+
srcPath = relative17(projectRoot, resolveSvelteModulePath(resolve44(projectRoot, srcPath)));
|
|
26129
26372
|
}
|
|
26130
26373
|
return srcUrl(srcPath, projectRoot);
|
|
26131
26374
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -26144,14 +26387,14 @@ ${stubs}
|
|
|
26144
26387
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
26145
26388
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
26146
26389
|
if (!subpath) {
|
|
26147
|
-
const pkgDir =
|
|
26148
|
-
const pkgJsonPath =
|
|
26149
|
-
if (
|
|
26150
|
-
const pkg = JSON.parse(
|
|
26390
|
+
const pkgDir = resolve44(projectRoot, "node_modules", packageName ?? "");
|
|
26391
|
+
const pkgJsonPath = join49(pkgDir, "package.json");
|
|
26392
|
+
if (existsSync37(pkgJsonPath)) {
|
|
26393
|
+
const pkg = JSON.parse(readFileSync34(pkgJsonPath, "utf-8"));
|
|
26151
26394
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
26152
26395
|
if (esmEntry) {
|
|
26153
|
-
const resolved =
|
|
26154
|
-
if (
|
|
26396
|
+
const resolved = resolve44(pkgDir, esmEntry);
|
|
26397
|
+
if (existsSync37(resolved))
|
|
26155
26398
|
return relative17(projectRoot, resolved);
|
|
26156
26399
|
}
|
|
26157
26400
|
}
|
|
@@ -26203,12 +26446,12 @@ ${stubs}
|
|
|
26203
26446
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
26204
26447
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
26205
26448
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
26206
|
-
const absPath =
|
|
26449
|
+
const absPath = resolve44(fileDir, relPath);
|
|
26207
26450
|
const rel = relative17(projectRoot, absPath);
|
|
26208
26451
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
26209
26452
|
});
|
|
26210
26453
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
26211
|
-
const absPath =
|
|
26454
|
+
const absPath = resolve44(fileDir, relPath);
|
|
26212
26455
|
const rel = relative17(projectRoot, absPath);
|
|
26213
26456
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
26214
26457
|
});
|
|
@@ -26254,7 +26497,7 @@ ${code}`;
|
|
|
26254
26497
|
reactFastRefreshWarningEmitted = true;
|
|
26255
26498
|
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 targeted " + "page remount instead of a state-preserving fast refresh.");
|
|
26256
26499
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
26257
|
-
const raw =
|
|
26500
|
+
const raw = readFileSync34(filePath, "utf-8");
|
|
26258
26501
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
26259
26502
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
26260
26503
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -26270,7 +26513,7 @@ ${transpiled}`;
|
|
|
26270
26513
|
transpiled += buildIslandMetadataExports(raw);
|
|
26271
26514
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
26272
26515
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
26273
|
-
const raw =
|
|
26516
|
+
const raw = readFileSync34(filePath, "utf-8");
|
|
26274
26517
|
const ext = extname13(filePath);
|
|
26275
26518
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
26276
26519
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -26436,7 +26679,7 @@ ${code}`;
|
|
|
26436
26679
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
26437
26680
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
26438
26681
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
26439
|
-
const raw =
|
|
26682
|
+
const raw = readFileSync34(filePath, "utf-8");
|
|
26440
26683
|
if (!svelteCompiler) {
|
|
26441
26684
|
svelteCompiler = await import("svelte/compiler");
|
|
26442
26685
|
}
|
|
@@ -26502,7 +26745,7 @@ export default __script__;`;
|
|
|
26502
26745
|
return `${cssInjection}
|
|
26503
26746
|
${code}`;
|
|
26504
26747
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
26505
|
-
const rawSource =
|
|
26748
|
+
const rawSource = readFileSync34(filePath, "utf-8");
|
|
26506
26749
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
26507
26750
|
if (!vueCompiler) {
|
|
26508
26751
|
vueCompiler = await loadVueCompiler();
|
|
@@ -26513,9 +26756,9 @@ ${code}`;
|
|
|
26513
26756
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
26514
26757
|
const compiledScript = hasScript ? vueCompiler.compileScript(descriptor, {
|
|
26515
26758
|
fs: {
|
|
26516
|
-
fileExists:
|
|
26759
|
+
fileExists: existsSync37,
|
|
26517
26760
|
realpath: realpathSync3,
|
|
26518
|
-
readFile: (file5) =>
|
|
26761
|
+
readFile: (file5) => existsSync37(file5) ? readFileSync34(file5, "utf-8") : undefined
|
|
26519
26762
|
},
|
|
26520
26763
|
id: componentId,
|
|
26521
26764
|
inlineTemplate: false
|
|
@@ -26530,7 +26773,7 @@ ${code}`;
|
|
|
26530
26773
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
26531
26774
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
26532
26775
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
26533
|
-
const hmrBase = vueDir ?
|
|
26776
|
+
const hmrBase = vueDir ? resolve44(vueDir) : projectRoot;
|
|
26534
26777
|
const hmrId = relative17(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
26535
26778
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
26536
26779
|
result += [
|
|
@@ -26545,11 +26788,11 @@ ${code}`;
|
|
|
26545
26788
|
`);
|
|
26546
26789
|
return result;
|
|
26547
26790
|
}, resolveSvelteModulePath = (path) => {
|
|
26548
|
-
if (
|
|
26791
|
+
if (existsSync37(path))
|
|
26549
26792
|
return path;
|
|
26550
|
-
if (
|
|
26793
|
+
if (existsSync37(`${path}.ts`))
|
|
26551
26794
|
return `${path}.ts`;
|
|
26552
|
-
if (
|
|
26795
|
+
if (existsSync37(`${path}.js`))
|
|
26553
26796
|
return `${path}.js`;
|
|
26554
26797
|
return path;
|
|
26555
26798
|
}, jsResponse = (body) => {
|
|
@@ -26562,7 +26805,7 @@ ${code}`;
|
|
|
26562
26805
|
}
|
|
26563
26806
|
});
|
|
26564
26807
|
}, handleCssRequest = (filePath) => {
|
|
26565
|
-
const raw =
|
|
26808
|
+
const raw = readFileSync34(filePath, "utf-8");
|
|
26566
26809
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
26567
26810
|
return [
|
|
26568
26811
|
`const style = document.createElement('style');`,
|
|
@@ -26694,13 +26937,13 @@ export default {};
|
|
|
26694
26937
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
26695
26938
|
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);`);
|
|
26696
26939
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
26697
|
-
const filePath =
|
|
26940
|
+
const filePath = resolve44(projectRoot, relPath);
|
|
26698
26941
|
const ext = extname13(filePath);
|
|
26699
26942
|
if (ext === ".svelte")
|
|
26700
26943
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
26701
26944
|
if (ext)
|
|
26702
26945
|
return { ext, filePath };
|
|
26703
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
26946
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync37(filePath + candidate));
|
|
26704
26947
|
if (!found)
|
|
26705
26948
|
return { ext, filePath };
|
|
26706
26949
|
const resolved = filePath + found;
|
|
@@ -26731,14 +26974,14 @@ export default {};
|
|
|
26731
26974
|
const absoluteCandidate = `/${tail.replace(/^\/+/, "")}`;
|
|
26732
26975
|
const candidates = [
|
|
26733
26976
|
absoluteCandidate,
|
|
26734
|
-
|
|
26977
|
+
resolve44(projectRoot, tail)
|
|
26735
26978
|
];
|
|
26736
26979
|
try {
|
|
26737
26980
|
const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_loadConfig(), exports_loadConfig));
|
|
26738
26981
|
const cfg = await loadConfig2();
|
|
26739
|
-
const angularDir = cfg.angularDirectory &&
|
|
26982
|
+
const angularDir = cfg.angularDirectory && resolve44(projectRoot, cfg.angularDirectory);
|
|
26740
26983
|
if (angularDir)
|
|
26741
|
-
candidates.push(
|
|
26984
|
+
candidates.push(resolve44(angularDir, tail));
|
|
26742
26985
|
} catch {}
|
|
26743
26986
|
for (const candidate of candidates) {
|
|
26744
26987
|
if (await fileExists(candidate)) {
|
|
@@ -26769,7 +27012,7 @@ export default {};
|
|
|
26769
27012
|
if (!TRANSPILABLE.has(ext))
|
|
26770
27013
|
return;
|
|
26771
27014
|
const stat3 = statSync6(filePath);
|
|
26772
|
-
const resolvedVueDir = vueDir ?
|
|
27015
|
+
const resolvedVueDir = vueDir ? resolve44(vueDir) : undefined;
|
|
26773
27016
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
26774
27017
|
const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
26775
27018
|
if (isAngularGeneratedJs) {
|
|
@@ -26828,7 +27071,7 @@ export default {};
|
|
|
26828
27071
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
26829
27072
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
26830
27073
|
return handleBunWrapRequest();
|
|
26831
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
27074
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve44(projectRoot, relPath));
|
|
26832
27075
|
if (virtualCssResponse)
|
|
26833
27076
|
return virtualCssResponse;
|
|
26834
27077
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -26844,11 +27087,11 @@ export default {};
|
|
|
26844
27087
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
26845
27088
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
26846
27089
|
if (match[1])
|
|
26847
|
-
files.push(
|
|
27090
|
+
files.push(resolve44(projectRoot, match[1]));
|
|
26848
27091
|
}
|
|
26849
27092
|
return files;
|
|
26850
27093
|
}, invalidateModule = (filePath) => {
|
|
26851
|
-
const resolved =
|
|
27094
|
+
const resolved = resolve44(filePath);
|
|
26852
27095
|
invalidate(filePath);
|
|
26853
27096
|
if (resolved !== filePath)
|
|
26854
27097
|
invalidate(resolved);
|
|
@@ -27011,7 +27254,7 @@ __export(exports_hmrCompiler, {
|
|
|
27011
27254
|
encodeHmrComponentId: () => encodeHmrComponentId,
|
|
27012
27255
|
getApplyMetadataModule: () => getApplyMetadataModule
|
|
27013
27256
|
});
|
|
27014
|
-
import { dirname as dirname30, relative as relative18, resolve as
|
|
27257
|
+
import { dirname as dirname30, relative as relative18, resolve as resolve45 } from "path";
|
|
27015
27258
|
import { performance as performance2 } from "perf_hooks";
|
|
27016
27259
|
var encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
27017
27260
|
const projectRel = relative18(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
@@ -27023,7 +27266,7 @@ var encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
|
27023
27266
|
return null;
|
|
27024
27267
|
const filePathRel = decoded.slice(0, separatorIndex);
|
|
27025
27268
|
const className = decoded.slice(separatorIndex + 1);
|
|
27026
|
-
const componentFilePath =
|
|
27269
|
+
const componentFilePath = resolve45(process.cwd(), filePathRel);
|
|
27027
27270
|
const projectRelPath = relative18(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
27028
27271
|
const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
27029
27272
|
const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
@@ -27193,11 +27436,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
27193
27436
|
__export(exports_simpleHTMLHMR, {
|
|
27194
27437
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
27195
27438
|
});
|
|
27196
|
-
import { resolve as
|
|
27439
|
+
import { resolve as resolve46 } from "path";
|
|
27197
27440
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
27198
27441
|
let htmlContent;
|
|
27199
27442
|
try {
|
|
27200
|
-
const resolvedPath =
|
|
27443
|
+
const resolvedPath = resolve46(htmlFilePath);
|
|
27201
27444
|
const file5 = Bun.file(resolvedPath);
|
|
27202
27445
|
if (!await file5.exists()) {
|
|
27203
27446
|
return null;
|
|
@@ -27223,11 +27466,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
27223
27466
|
__export(exports_simpleHTMXHMR, {
|
|
27224
27467
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
27225
27468
|
});
|
|
27226
|
-
import { resolve as
|
|
27469
|
+
import { resolve as resolve47 } from "path";
|
|
27227
27470
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
27228
27471
|
let htmlContent;
|
|
27229
27472
|
try {
|
|
27230
|
-
const resolvedPath =
|
|
27473
|
+
const resolvedPath = resolve47(htmxFilePath);
|
|
27231
27474
|
const file5 = Bun.file(resolvedPath);
|
|
27232
27475
|
if (!await file5.exists()) {
|
|
27233
27476
|
return null;
|
|
@@ -27249,12 +27492,12 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
27249
27492
|
var init_simpleHTMXHMR = () => {};
|
|
27250
27493
|
|
|
27251
27494
|
// src/dev/rebuildTrigger.ts
|
|
27252
|
-
import { existsSync as
|
|
27495
|
+
import { existsSync as existsSync38, readdirSync as readdirSync9, rmSync as rmSync3 } from "fs";
|
|
27253
27496
|
import {
|
|
27254
27497
|
basename as basename17,
|
|
27255
27498
|
dirname as dirname31,
|
|
27256
27499
|
isAbsolute as isAbsolute6,
|
|
27257
|
-
join as
|
|
27500
|
+
join as join50,
|
|
27258
27501
|
relative as relative19,
|
|
27259
27502
|
resolve as resolvePath3,
|
|
27260
27503
|
sep as sep4
|
|
@@ -27363,7 +27606,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
27363
27606
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
27364
27607
|
}
|
|
27365
27608
|
return { ...parsed, framework: detectedFw };
|
|
27366
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
27609
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync38(affectedFile), FRAMEWORK_DIR_KEYS_FOR_CLEANUP, removeStaleGenerated = (state, deletedFile) => {
|
|
27367
27610
|
const { config } = state;
|
|
27368
27611
|
const cwd2 = process.cwd();
|
|
27369
27612
|
const absDeleted = resolvePath3(deletedFile).replace(/\\/g, "/");
|
|
@@ -27381,8 +27624,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
27381
27624
|
const relJs = `${rel.slice(0, -ext[0].length)}.js`;
|
|
27382
27625
|
const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
|
|
27383
27626
|
for (const candidate of [
|
|
27384
|
-
|
|
27385
|
-
`${
|
|
27627
|
+
join50(generatedDir, relJs),
|
|
27628
|
+
`${join50(generatedDir, relJs)}.map`
|
|
27386
27629
|
]) {
|
|
27387
27630
|
try {
|
|
27388
27631
|
rmSync3(candidate, { force: true });
|
|
@@ -27409,7 +27652,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
27409
27652
|
if (!dependents || dependents.size === 0) {
|
|
27410
27653
|
return;
|
|
27411
27654
|
}
|
|
27412
|
-
const dependentFiles = Array.from(dependents).filter((file5) =>
|
|
27655
|
+
const dependentFiles = Array.from(dependents).filter((file5) => existsSync38(file5));
|
|
27413
27656
|
if (dependentFiles.length === 0) {
|
|
27414
27657
|
return;
|
|
27415
27658
|
}
|
|
@@ -27425,7 +27668,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
27425
27668
|
try {
|
|
27426
27669
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
27427
27670
|
affectedFiles.forEach((affectedFile) => {
|
|
27428
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
27671
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync38(affectedFile)) {
|
|
27429
27672
|
validFiles.push(affectedFile);
|
|
27430
27673
|
processedFiles.add(affectedFile);
|
|
27431
27674
|
}
|
|
@@ -27450,7 +27693,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
27450
27693
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
27451
27694
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
27452
27695
|
filePathSet.forEach((filePathInSet) => {
|
|
27453
|
-
if (!
|
|
27696
|
+
if (!existsSync38(filePathInSet)) {
|
|
27454
27697
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
27455
27698
|
return;
|
|
27456
27699
|
}
|
|
@@ -27715,7 +27958,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
27715
27958
|
return componentFile;
|
|
27716
27959
|
}
|
|
27717
27960
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
27718
|
-
if (
|
|
27961
|
+
if (existsSync38(tsCounterpart)) {
|
|
27719
27962
|
return tsCounterpart;
|
|
27720
27963
|
}
|
|
27721
27964
|
if (!graph)
|
|
@@ -28165,8 +28408,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
28165
28408
|
};
|
|
28166
28409
|
return ({ immediate = false } = {}) => {
|
|
28167
28410
|
if (!ctx.debouncedPromise) {
|
|
28168
|
-
ctx.debouncedPromise = new Promise((
|
|
28169
|
-
ctx.debouncedResolve =
|
|
28411
|
+
ctx.debouncedPromise = new Promise((resolve48) => {
|
|
28412
|
+
ctx.debouncedResolve = resolve48;
|
|
28170
28413
|
});
|
|
28171
28414
|
}
|
|
28172
28415
|
const scheduled = ctx.debouncedPromise;
|
|
@@ -28288,7 +28531,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
28288
28531
|
const entries = await readdir6(dir, { withFileTypes: true });
|
|
28289
28532
|
const files = [];
|
|
28290
28533
|
for (const entry of entries) {
|
|
28291
|
-
const full =
|
|
28534
|
+
const full = join50(dir, entry.name);
|
|
28292
28535
|
if (entry.isDirectory()) {
|
|
28293
28536
|
files.push(...await walk(full));
|
|
28294
28537
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -28585,7 +28828,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
28585
28828
|
}
|
|
28586
28829
|
return ctx;
|
|
28587
28830
|
}, runSvelteBundleRebuild = async (state, svelteFiles, config) => {
|
|
28588
|
-
const existingSvelteFiles = svelteFiles.filter((file5) =>
|
|
28831
|
+
const existingSvelteFiles = svelteFiles.filter((file5) => existsSync38(file5));
|
|
28589
28832
|
if (existingSvelteFiles.length === 0)
|
|
28590
28833
|
return;
|
|
28591
28834
|
const svelteDir = config.svelteDirectory ?? "";
|
|
@@ -28701,8 +28944,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
28701
28944
|
};
|
|
28702
28945
|
return () => {
|
|
28703
28946
|
if (!ctx.debouncedPromise) {
|
|
28704
|
-
ctx.debouncedPromise = new Promise((
|
|
28705
|
-
ctx.debouncedResolve =
|
|
28947
|
+
ctx.debouncedPromise = new Promise((resolve48) => {
|
|
28948
|
+
ctx.debouncedResolve = resolve48;
|
|
28706
28949
|
});
|
|
28707
28950
|
}
|
|
28708
28951
|
if (ctx.debounceTimer)
|
|
@@ -28851,7 +29094,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
28851
29094
|
} = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
|
|
28852
29095
|
const serverEntries = [...vueServerPaths];
|
|
28853
29096
|
const clientEntries = [...vueIndexPaths, ...vueClientPaths];
|
|
28854
|
-
const cssOutDir =
|
|
29097
|
+
const cssOutDir = join50(buildDir, state.resolvedPaths.assetsDir ? basename17(state.resolvedPaths.assetsDir) : "assets", "css");
|
|
28855
29098
|
const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
|
|
28856
29099
|
const serverExternals = await getServerBundleExternals();
|
|
28857
29100
|
const clientVendorPaths = await getClientVendorPaths();
|
|
@@ -28979,8 +29222,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
28979
29222
|
};
|
|
28980
29223
|
return () => {
|
|
28981
29224
|
if (!ctx.debouncedPromise) {
|
|
28982
|
-
ctx.debouncedPromise = new Promise((
|
|
28983
|
-
ctx.debouncedResolve =
|
|
29225
|
+
ctx.debouncedPromise = new Promise((resolve48) => {
|
|
29226
|
+
ctx.debouncedResolve = resolve48;
|
|
28984
29227
|
});
|
|
28985
29228
|
}
|
|
28986
29229
|
if (ctx.debounceTimer)
|
|
@@ -29942,9 +30185,9 @@ __export(exports_buildDepVendor, {
|
|
|
29942
30185
|
buildDepVendor: () => buildDepVendor,
|
|
29943
30186
|
computeDepVendorPaths: () => computeDepVendorPaths
|
|
29944
30187
|
});
|
|
29945
|
-
import { mkdirSync as
|
|
30188
|
+
import { mkdirSync as mkdirSync15 } from "fs";
|
|
29946
30189
|
import { isBuiltin } from "module";
|
|
29947
|
-
import { join as
|
|
30190
|
+
import { join as join51 } from "path";
|
|
29948
30191
|
import { rm as rm14 } from "fs/promises";
|
|
29949
30192
|
var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
|
|
29950
30193
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -30003,7 +30246,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
30003
30246
|
framework: Array.from(framework).filter(isResolvable3)
|
|
30004
30247
|
};
|
|
30005
30248
|
}, collectBareImportsFromFile = async (entryPath, transpiler6, maxDepth = 8) => {
|
|
30006
|
-
const { readFileSync:
|
|
30249
|
+
const { readFileSync: readFileSync35 } = await import("fs");
|
|
30007
30250
|
const { dirname: dirname32 } = await import("path");
|
|
30008
30251
|
const seenFiles = new Set;
|
|
30009
30252
|
const bareOut = new Set;
|
|
@@ -30019,7 +30262,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
30019
30262
|
continue;
|
|
30020
30263
|
let content;
|
|
30021
30264
|
try {
|
|
30022
|
-
content =
|
|
30265
|
+
content = readFileSync35(path, "utf-8");
|
|
30023
30266
|
} catch {
|
|
30024
30267
|
continue;
|
|
30025
30268
|
}
|
|
@@ -30093,7 +30336,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
30093
30336
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
30094
30337
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
30095
30338
|
const safeName = toSafeFileName6(specifier);
|
|
30096
|
-
const entryPath =
|
|
30339
|
+
const entryPath = join51(tmpDir, `${safeName}.ts`);
|
|
30097
30340
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
30098
30341
|
return { entryPath, specifier };
|
|
30099
30342
|
}));
|
|
@@ -30184,10 +30427,10 @@ var toSafeFileName6 = (specifier) => {
|
|
|
30184
30427
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
30185
30428
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
30186
30429
|
return {};
|
|
30187
|
-
const vendorDir =
|
|
30188
|
-
|
|
30189
|
-
const tmpDir =
|
|
30190
|
-
|
|
30430
|
+
const vendorDir = join51(buildDir, "vendor");
|
|
30431
|
+
mkdirSync15(vendorDir, { recursive: true });
|
|
30432
|
+
const tmpDir = join51(buildDir, "_dep_vendor_tmp");
|
|
30433
|
+
mkdirSync15(tmpDir, { recursive: true });
|
|
30191
30434
|
const allSpecs = new Set(initialSpecs);
|
|
30192
30435
|
const alreadyScanned = new Set;
|
|
30193
30436
|
let frontier = [...allSpecs, ...frameworkRoots];
|
|
@@ -30270,7 +30513,7 @@ __export(exports_devBuild, {
|
|
|
30270
30513
|
});
|
|
30271
30514
|
import { readdir as readdir6 } from "fs/promises";
|
|
30272
30515
|
import { statSync as statSync7 } from "fs";
|
|
30273
|
-
import { resolve as
|
|
30516
|
+
import { resolve as resolve48 } from "path";
|
|
30274
30517
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
30275
30518
|
const configuredDirs = [
|
|
30276
30519
|
config.reactDirectory,
|
|
@@ -30279,7 +30522,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30279
30522
|
config.angularDirectory,
|
|
30280
30523
|
config.htmlDirectory,
|
|
30281
30524
|
config.htmxDirectory,
|
|
30282
|
-
|
|
30525
|
+
resolve48(import.meta.dir, "../dev/client")
|
|
30283
30526
|
].filter((dir) => Boolean(dir));
|
|
30284
30527
|
return Array.from(new Set(configuredDirs));
|
|
30285
30528
|
}, parseDirectoryConfig = (source) => {
|
|
@@ -30294,7 +30537,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30294
30537
|
return Object.keys(config).length > 0 ? config : null;
|
|
30295
30538
|
}, reloadConfig = async () => {
|
|
30296
30539
|
try {
|
|
30297
|
-
const configPath2 =
|
|
30540
|
+
const configPath2 = resolve48(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
30298
30541
|
const source = await Bun.file(configPath2).text();
|
|
30299
30542
|
return parseDirectoryConfig(source);
|
|
30300
30543
|
} catch {
|
|
@@ -30406,7 +30649,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30406
30649
|
});
|
|
30407
30650
|
}
|
|
30408
30651
|
}, handleCachedReload = async () => {
|
|
30409
|
-
const serverMtime = statSync7(
|
|
30652
|
+
const serverMtime = statSync7(resolve48(Bun.main)).mtimeMs;
|
|
30410
30653
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
30411
30654
|
globalThis.__hmrServerMtime = serverMtime;
|
|
30412
30655
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -30443,8 +30686,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30443
30686
|
return true;
|
|
30444
30687
|
}, resolveAbsoluteVersion2 = async () => {
|
|
30445
30688
|
const candidates = [
|
|
30446
|
-
|
|
30447
|
-
|
|
30689
|
+
resolve48(import.meta.dir, "..", "..", "package.json"),
|
|
30690
|
+
resolve48(import.meta.dir, "..", "package.json")
|
|
30448
30691
|
];
|
|
30449
30692
|
const [candidate, ...remaining] = candidates;
|
|
30450
30693
|
if (!candidate) {
|
|
@@ -30470,7 +30713,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30470
30713
|
const entries = await readdir6(vendorDir).catch(() => emptyStringArray);
|
|
30471
30714
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
30472
30715
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
30473
|
-
const bytes = await Bun.file(
|
|
30716
|
+
const bytes = await Bun.file(resolve48(vendorDir, entry)).bytes();
|
|
30474
30717
|
assetStore.set(webPath, bytes);
|
|
30475
30718
|
}));
|
|
30476
30719
|
}, devBuild = async (config) => {
|
|
@@ -30495,6 +30738,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30495
30738
|
process.env.ABSOLUTE_BUILD_DIR ??= state.resolvedPaths.buildDir;
|
|
30496
30739
|
recordStep("create HMR state", stepStartedAt);
|
|
30497
30740
|
stepStartedAt = performance.now();
|
|
30741
|
+
setBootPhase("scan source tree");
|
|
30498
30742
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
30499
30743
|
buildInitialDependencyGraph(state.dependencyGraph, watchPaths);
|
|
30500
30744
|
recordStep("initialize dependency graph", stepStartedAt);
|
|
@@ -30573,6 +30817,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30573
30817
|
recordStep("start file watching", stepStartedAt);
|
|
30574
30818
|
const buildStart = performance.now();
|
|
30575
30819
|
let buildResult = null;
|
|
30820
|
+
setBootPhase("initial build");
|
|
30576
30821
|
try {
|
|
30577
30822
|
buildResult = await build2({
|
|
30578
30823
|
...config,
|
|
@@ -30605,15 +30850,17 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30605
30850
|
console.log("\u26A0\uFE0F Manifest is empty - this is OK for HTML/HTMX-only projects");
|
|
30606
30851
|
}
|
|
30607
30852
|
stepStartedAt = performance.now();
|
|
30853
|
+
setBootPhase("populate asset store");
|
|
30608
30854
|
await populateAssetStore(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
30609
30855
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
30610
30856
|
recordStep("populate asset store", stepStartedAt);
|
|
30611
30857
|
stepStartedAt = performance.now();
|
|
30612
|
-
|
|
30613
|
-
const
|
|
30614
|
-
const
|
|
30615
|
-
const
|
|
30616
|
-
const
|
|
30858
|
+
setBootPhase("build vendor bundles");
|
|
30859
|
+
const reactVendorDir = resolve48(state.resolvedPaths.buildDir, "react", "vendor");
|
|
30860
|
+
const angularVendorDir = resolve48(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
30861
|
+
const svelteVendorDir = resolve48(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
30862
|
+
const vueVendorDir = resolve48(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
30863
|
+
const depVendorDir = resolve48(state.resolvedPaths.buildDir, "vendor");
|
|
30617
30864
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
30618
30865
|
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
30619
30866
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -30632,6 +30879,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30632
30879
|
globalThis.__depVendorPaths = depPaths;
|
|
30633
30880
|
recordStep("build vendor bundles", stepStartedAt);
|
|
30634
30881
|
stepStartedAt = performance.now();
|
|
30882
|
+
setBootPhase("rewrite vendor cross-references");
|
|
30635
30883
|
const combinedVendorPaths = {
|
|
30636
30884
|
...getDevVendorPaths() ?? {},
|
|
30637
30885
|
...getAngularVendorPaths() ?? {},
|
|
@@ -30659,6 +30907,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30659
30907
|
]);
|
|
30660
30908
|
recordStep("load vendor files", stepStartedAt);
|
|
30661
30909
|
stepStartedAt = performance.now();
|
|
30910
|
+
setBootPhase("warm compilers");
|
|
30662
30911
|
const { warmCompilers: warmCompilers2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
30663
30912
|
await warmCompilers2({
|
|
30664
30913
|
svelte: Boolean(config.svelteDirectory),
|
|
@@ -30691,7 +30940,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
30691
30940
|
manifest
|
|
30692
30941
|
};
|
|
30693
30942
|
globalThis.__hmrDevResult = result;
|
|
30694
|
-
globalThis.__hmrServerMtime = statSync7(
|
|
30943
|
+
globalThis.__hmrServerMtime = statSync7(resolve48(Bun.main)).mtimeMs;
|
|
30695
30944
|
return result;
|
|
30696
30945
|
};
|
|
30697
30946
|
var init_devBuild = __esm(() => {
|
|
@@ -30710,6 +30959,7 @@ var init_devBuild = __esm(() => {
|
|
|
30710
30959
|
init_rebuildTrigger();
|
|
30711
30960
|
init_logger();
|
|
30712
30961
|
init_startupTimings();
|
|
30962
|
+
init_bootLifecycle();
|
|
30713
30963
|
FRAMEWORK_DIR_KEYS = [
|
|
30714
30964
|
"reactDirectory",
|
|
30715
30965
|
"svelteDirectory",
|
|
@@ -30840,8 +31090,8 @@ var STORE_KEY = "__elysiaStore", restoredStores, getGlobalValue = (key) => Refle
|
|
|
30840
31090
|
return null;
|
|
30841
31091
|
if (!pathname.startsWith("/"))
|
|
30842
31092
|
return null;
|
|
30843
|
-
const { resolve:
|
|
30844
|
-
const candidate =
|
|
31093
|
+
const { resolve: resolve49, normalize } = await import("path");
|
|
31094
|
+
const candidate = resolve49(buildDir, pathname.slice(1));
|
|
30845
31095
|
const normalizedBuild = normalize(buildDir);
|
|
30846
31096
|
if (!candidate.startsWith(normalizedBuild))
|
|
30847
31097
|
return null;
|
|
@@ -30940,17 +31190,17 @@ __export(exports_devtoolsJson, {
|
|
|
30940
31190
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
30941
31191
|
resolveDevtoolsUuidCachePath: () => resolveDevtoolsUuidCachePath
|
|
30942
31192
|
});
|
|
30943
|
-
import { existsSync as
|
|
30944
|
-
import { dirname as dirname32, join as
|
|
31193
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync16, readFileSync as readFileSync35, writeFileSync as writeFileSync11 } from "fs";
|
|
31194
|
+
import { dirname as dirname32, join as join52, resolve as resolve49 } from "path";
|
|
30945
31195
|
import { Elysia as Elysia7 } from "elysia";
|
|
30946
31196
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
30947
31197
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
30948
31198
|
return uuid;
|
|
30949
|
-
}, 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) =>
|
|
30950
|
-
if (!
|
|
31199
|
+
}, 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) => resolve49(uuidCachePath ?? join52(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
31200
|
+
if (!existsSync39(cachePath))
|
|
30951
31201
|
return null;
|
|
30952
31202
|
try {
|
|
30953
|
-
const value =
|
|
31203
|
+
const value = readFileSync35(cachePath, "utf-8").trim();
|
|
30954
31204
|
return isUuidV4(value) ? value : null;
|
|
30955
31205
|
} catch {
|
|
30956
31206
|
return null;
|
|
@@ -30968,11 +31218,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
30968
31218
|
if (cachedUuid)
|
|
30969
31219
|
return setGlobalUuid(cachedUuid);
|
|
30970
31220
|
const uuid = crypto.randomUUID();
|
|
30971
|
-
|
|
30972
|
-
|
|
31221
|
+
mkdirSync16(dirname32(cachePath), { recursive: true });
|
|
31222
|
+
writeFileSync11(cachePath, uuid, "utf-8");
|
|
30973
31223
|
return setGlobalUuid(uuid);
|
|
30974
31224
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
30975
|
-
const rootPath =
|
|
31225
|
+
const rootPath = resolve49(options.projectRoot ?? process.cwd());
|
|
30976
31226
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
30977
31227
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
30978
31228
|
return new Elysia7({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -30985,11 +31235,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
30985
31235
|
if (process.env.WSL_DISTRO_NAME) {
|
|
30986
31236
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
30987
31237
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
30988
|
-
return
|
|
31238
|
+
return join52("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
30989
31239
|
}
|
|
30990
31240
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
30991
31241
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
30992
|
-
return
|
|
31242
|
+
return join52("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
30993
31243
|
}
|
|
30994
31244
|
return root;
|
|
30995
31245
|
};
|
|
@@ -31000,13 +31250,13 @@ var exports_imageOptimizer = {};
|
|
|
31000
31250
|
__export(exports_imageOptimizer, {
|
|
31001
31251
|
imageOptimizer: () => imageOptimizer
|
|
31002
31252
|
});
|
|
31003
|
-
import { existsSync as
|
|
31004
|
-
import { resolve as
|
|
31253
|
+
import { existsSync as existsSync40 } from "fs";
|
|
31254
|
+
import { resolve as resolve50 } from "path";
|
|
31005
31255
|
import { Elysia as Elysia8 } from "elysia";
|
|
31006
31256
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
31007
31257
|
try {
|
|
31008
31258
|
const resolved = validateSafePath(path, baseDir);
|
|
31009
|
-
if (
|
|
31259
|
+
if (existsSync40(resolved))
|
|
31010
31260
|
return resolved;
|
|
31011
31261
|
return null;
|
|
31012
31262
|
} catch {
|
|
@@ -31014,7 +31264,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
31014
31264
|
}
|
|
31015
31265
|
}, resolveLocalImage = (url, buildDir) => {
|
|
31016
31266
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
31017
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
31267
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve50(process.cwd()));
|
|
31018
31268
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
31019
31269
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
31020
31270
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -31283,11 +31533,11 @@ var init_requestInspector = __esm(() => {
|
|
|
31283
31533
|
});
|
|
31284
31534
|
|
|
31285
31535
|
// src/mobile/nativeAuth.ts
|
|
31286
|
-
import { readFileSync as
|
|
31287
|
-
import { join as
|
|
31536
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
31537
|
+
import { join as join53 } from "path";
|
|
31288
31538
|
var ABSOLUTE_AUTH_PACKAGE = "@absolutejs/auth", ABSOLUTE_EXPO_AUTH_CORE_VERSION = "0.75.6", ABSOLUTE_EXPO_AUTH_PACKAGE = "@absolutejs/auth-expo", ABSOLUTE_EXPO_AUTH_VERSION = "0.0.2", ABSOLUTE_EXPO_SYNC_CORE_VERSION = "2.31.0", ABSOLUTE_EXPO_SYNC_PACKAGE = "@absolutejs/sync-expo", ABSOLUTE_EXPO_SYNC_VERSION = "0.0.2", ABSOLUTE_NATIVE_AUTH_CLIENTS_ENV = "ABSOLUTE_AUTH_NATIVE_CLIENTS", ABSOLUTE_NATIVE_AUTH_SCOPES, ABSOLUTE_SYNC_PACKAGE = "@absolutejs/sync", readPackageManifest = (projectRoot) => {
|
|
31289
31539
|
try {
|
|
31290
|
-
return JSON.parse(
|
|
31540
|
+
return JSON.parse(readFileSync36(join53(projectRoot, "package.json"), "utf8"));
|
|
31291
31541
|
} catch {
|
|
31292
31542
|
return;
|
|
31293
31543
|
}
|
|
@@ -31333,7 +31583,7 @@ __export(exports_devDeviceAdapter, {
|
|
|
31333
31583
|
buildAbsoluteNativeDevAdapter: () => buildAbsoluteNativeDevAdapter
|
|
31334
31584
|
});
|
|
31335
31585
|
import { access as access3, mkdtemp as mkdtemp3, rm as rm15, writeFile as writeFile9 } from "fs/promises";
|
|
31336
|
-
import { join as
|
|
31586
|
+
import { join as join54 } from "path";
|
|
31337
31587
|
import { tmpdir } from "os";
|
|
31338
31588
|
var absoluteNativeDevAdapterSource = (projectRoot, mobile, resolveModule = (specifier) => specifier, expoAdapterModule = "@absolutejs/absolute/mobile/expo-devices", expoAuthModule = "@absolutejs/absolute/mobile/expo-auth", expoSyncModule = "@absolutejs/absolute/mobile/expo-sync") => {
|
|
31339
31589
|
if ((mobile.engine ?? "capacitor") === "expo") {
|
|
@@ -31371,7 +31621,7 @@ ${auth ? `void createAbsoluteExpoShellAuth(${JSON.stringify(auth)}).then(auth =>
|
|
|
31371
31621
|
`);
|
|
31372
31622
|
}, expoAdapterPath = async () => {
|
|
31373
31623
|
const candidates = await Promise.all(["ts", "js"].map(async (extension) => {
|
|
31374
|
-
const path2 =
|
|
31624
|
+
const path2 = join54(import.meta.dir, `shellExpoDevices.${extension}`);
|
|
31375
31625
|
try {
|
|
31376
31626
|
await access3(path2);
|
|
31377
31627
|
return path2;
|
|
@@ -31385,7 +31635,7 @@ ${auth ? `void createAbsoluteExpoShellAuth(${JSON.stringify(auth)}).then(auth =>
|
|
|
31385
31635
|
throw new TypeError("The AbsoluteJS Expo development adapter is missing.");
|
|
31386
31636
|
}, expoAuthPath = async () => {
|
|
31387
31637
|
const candidates = await Promise.all(["ts", "js"].map(async (extension) => {
|
|
31388
|
-
const path2 =
|
|
31638
|
+
const path2 = join54(import.meta.dir, `shellExpoAuth.${extension}`);
|
|
31389
31639
|
try {
|
|
31390
31640
|
await access3(path2);
|
|
31391
31641
|
return path2;
|
|
@@ -31399,7 +31649,7 @@ ${auth ? `void createAbsoluteExpoShellAuth(${JSON.stringify(auth)}).then(auth =>
|
|
|
31399
31649
|
throw new TypeError("The AbsoluteJS Expo Auth development adapter is missing.");
|
|
31400
31650
|
}, expoSyncPath = async () => {
|
|
31401
31651
|
const candidates = await Promise.all(["ts", "js"].map(async (extension) => {
|
|
31402
|
-
const path2 =
|
|
31652
|
+
const path2 = join54(import.meta.dir, `shellExpoSync.${extension}`);
|
|
31403
31653
|
try {
|
|
31404
31654
|
await access3(path2);
|
|
31405
31655
|
return path2;
|
|
@@ -31412,8 +31662,8 @@ ${auth ? `void createAbsoluteExpoShellAuth(${JSON.stringify(auth)}).then(auth =>
|
|
|
31412
31662
|
return path;
|
|
31413
31663
|
throw new TypeError("The AbsoluteJS Expo Sync development adapter is missing.");
|
|
31414
31664
|
}, buildAbsoluteNativeDevAdapter = async (projectRoot, mobile) => {
|
|
31415
|
-
const temporaryDirectory = await mkdtemp3(
|
|
31416
|
-
const entry =
|
|
31665
|
+
const temporaryDirectory = await mkdtemp3(join54(tmpdir(), "absolutejs-native-dev-adapter-"));
|
|
31666
|
+
const entry = join54(temporaryDirectory, "entry.ts");
|
|
31417
31667
|
try {
|
|
31418
31668
|
await writeFile9(entry, absoluteNativeDevAdapterSource(projectRoot, mobile, (specifier) => Bun.resolveSync(specifier, projectRoot), await expoAdapterPath(), await expoAuthPath(), await expoSyncPath()));
|
|
31419
31669
|
const result = await Bun.build({
|
|
@@ -31447,15 +31697,15 @@ __export(exports_prerender, {
|
|
|
31447
31697
|
rerenderRoute: () => rerenderRoute,
|
|
31448
31698
|
routeToFilename: () => routeToFilename
|
|
31449
31699
|
});
|
|
31450
|
-
import { mkdirSync as
|
|
31451
|
-
import { join as
|
|
31700
|
+
import { mkdirSync as mkdirSync17, readFileSync as readFileSync37 } from "fs";
|
|
31701
|
+
import { join as join55 } from "path";
|
|
31452
31702
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, DEFAULT_FETCH_TIMEOUT_MS = 1e4, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
31453
31703
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
31454
31704
|
await Bun.write(metaPath, String(Date.now()));
|
|
31455
31705
|
}, readTimestamp = (htmlPath) => {
|
|
31456
31706
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
31457
31707
|
try {
|
|
31458
|
-
const content =
|
|
31708
|
+
const content = readFileSync37(metaPath, "utf-8");
|
|
31459
31709
|
return Number(content) || 0;
|
|
31460
31710
|
} catch {
|
|
31461
31711
|
return 0;
|
|
@@ -31518,7 +31768,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
31518
31768
|
if (!isCompleteHtml(html))
|
|
31519
31769
|
return false;
|
|
31520
31770
|
const fileName = routeToFilename(route);
|
|
31521
|
-
const filePath =
|
|
31771
|
+
const filePath = join55(prerenderDir, fileName);
|
|
31522
31772
|
await Bun.write(filePath, html);
|
|
31523
31773
|
await writeTimestamp(filePath);
|
|
31524
31774
|
return true;
|
|
@@ -31548,14 +31798,14 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
31548
31798
|
return;
|
|
31549
31799
|
}
|
|
31550
31800
|
const fileName = routeToFilename(route);
|
|
31551
|
-
const filePath =
|
|
31801
|
+
const filePath = join55(prerenderDir, fileName);
|
|
31552
31802
|
await Bun.write(filePath, html);
|
|
31553
31803
|
await writeTimestamp(filePath);
|
|
31554
31804
|
result.routes.set(route, filePath);
|
|
31555
31805
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
31556
31806
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
31557
|
-
const prerenderDir =
|
|
31558
|
-
|
|
31807
|
+
const prerenderDir = join55(outDir, "_prerendered");
|
|
31808
|
+
mkdirSync17(prerenderDir, { recursive: true });
|
|
31559
31809
|
const baseUrl = `http://localhost:${port}`;
|
|
31560
31810
|
let routes;
|
|
31561
31811
|
if (staticConfig.routes === "all") {
|
|
@@ -31673,17 +31923,17 @@ __export(exports_serverEntryWatcher, {
|
|
|
31673
31923
|
});
|
|
31674
31924
|
import {
|
|
31675
31925
|
copyFileSync as copyFileSync4,
|
|
31676
|
-
existsSync as
|
|
31926
|
+
existsSync as existsSync43,
|
|
31677
31927
|
readdirSync as readdirSync12,
|
|
31678
|
-
readFileSync as
|
|
31928
|
+
readFileSync as readFileSync41,
|
|
31679
31929
|
statSync as statSync8,
|
|
31680
31930
|
watch as watch2
|
|
31681
31931
|
} from "fs";
|
|
31682
|
-
import { createHash as
|
|
31683
|
-
import { dirname as dirname33, join as
|
|
31932
|
+
import { createHash as createHash11 } from "crypto";
|
|
31933
|
+
import { dirname as dirname33, join as join59, resolve as resolve51 } from "path";
|
|
31684
31934
|
var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ENTRY_IMPORT_RETRY_DELAY_MS = 250, MAX_ENTRY_IMPORT_ATTEMPTS = 3, WATCH_FALLBACK_INTERVAL_MS = 250, ATOMIC_WRITE_TEMP_PATTERNS2, isAtomicWriteTemp = (filename) => filename.endsWith(".tmp") || filename.includes(".tmp.") || filename.endsWith("~") || filename.startsWith(".#") || filename.startsWith(".absolutejs-hmr-") || ATOMIC_WRITE_TEMP_PATTERNS2.some((pattern) => pattern.test(filename)), fileHash = (path) => {
|
|
31685
31935
|
try {
|
|
31686
|
-
return
|
|
31936
|
+
return createHash11("sha256").update(readFileSync41(path)).digest("hex");
|
|
31687
31937
|
} catch {
|
|
31688
31938
|
return null;
|
|
31689
31939
|
}
|
|
@@ -31704,14 +31954,14 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ENTRY_IMPORT_RETR
|
|
|
31704
31954
|
if (globalThis.__absoluteEntryWatcherStarted)
|
|
31705
31955
|
return;
|
|
31706
31956
|
const originalEntry = process.env.ABSOLUTE_SERVER_ENTRY ?? Bun.main;
|
|
31707
|
-
if (!originalEntry || !
|
|
31957
|
+
if (!originalEntry || !existsSync43(originalEntry))
|
|
31708
31958
|
return;
|
|
31709
31959
|
globalThis.__absoluteEntryWatcherStarted = true;
|
|
31710
31960
|
globalThis.__absoluteEntryWatcherReady = false;
|
|
31711
|
-
const entryPath =
|
|
31961
|
+
const entryPath = resolve51(originalEntry);
|
|
31712
31962
|
const entryDir = dirname33(entryPath);
|
|
31713
31963
|
const entryBase = entryPath.slice(entryDir.length + 1);
|
|
31714
|
-
const configPath2 =
|
|
31964
|
+
const configPath2 = resolve51(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
31715
31965
|
const configDir2 = dirname33(configPath2);
|
|
31716
31966
|
const configBase = configPath2.slice(configDir2.length + 1);
|
|
31717
31967
|
const recentlyHandled = new Map;
|
|
@@ -31722,7 +31972,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ENTRY_IMPORT_RETR
|
|
|
31722
31972
|
let pendingEntryCause = null;
|
|
31723
31973
|
let siblingSequence = 0;
|
|
31724
31974
|
const importFreshEntry = async (attempt = 1) => {
|
|
31725
|
-
const siblingPath =
|
|
31975
|
+
const siblingPath = join59(entryDir, `.absolutejs-hmr-${process.pid}-${siblingSequence++}.ts`);
|
|
31726
31976
|
let failure;
|
|
31727
31977
|
try {
|
|
31728
31978
|
copyFileSync4(entryPath, siblingPath);
|
|
@@ -31835,7 +32085,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ENTRY_IMPORT_RETR
|
|
|
31835
32085
|
continue;
|
|
31836
32086
|
let st2;
|
|
31837
32087
|
try {
|
|
31838
|
-
st2 = statSync8(
|
|
32088
|
+
st2 = statSync8(join59(dir, entry.name));
|
|
31839
32089
|
} catch {
|
|
31840
32090
|
continue;
|
|
31841
32091
|
}
|
|
@@ -32737,9 +32987,9 @@ var handleHTMXPageRequest = async (pagePath, options = {}) => {
|
|
|
32737
32987
|
});
|
|
32738
32988
|
};
|
|
32739
32989
|
// src/core/prepare.ts
|
|
32740
|
-
import { createHash as
|
|
32741
|
-
import { existsSync as
|
|
32742
|
-
import { basename as basename18, join as
|
|
32990
|
+
import { createHash as createHash10 } from "crypto";
|
|
32991
|
+
import { existsSync as existsSync41, readdirSync as readdirSync10, readFileSync as readFileSync38 } from "fs";
|
|
32992
|
+
import { basename as basename18, join as join56, relative as relative20, resolve as resolvePath4 } from "path";
|
|
32743
32993
|
import { Elysia as Elysia10, NotFound } from "elysia";
|
|
32744
32994
|
|
|
32745
32995
|
// src/plugins/openApiPlugin.ts
|
|
@@ -33999,12 +34249,13 @@ init_resolveConvention();
|
|
|
33999
34249
|
init_spaRouteManifest();
|
|
34000
34250
|
init_startupTimings();
|
|
34001
34251
|
init_logger();
|
|
34252
|
+
init_bootLifecycle();
|
|
34002
34253
|
var MS_PER_SECOND2 = 1000;
|
|
34003
34254
|
var DEFAULT_PORT2 = 3000;
|
|
34004
34255
|
var MAX_STATIC_ROUTE_COUNT = Number.MAX_SAFE_INTEGER;
|
|
34005
34256
|
var STATIC_PLUGIN_RETRY_DELAY_MS = 50;
|
|
34006
|
-
var waitForStaticPluginRetry = () => new Promise((
|
|
34007
|
-
setTimeout(
|
|
34257
|
+
var waitForStaticPluginRetry = () => new Promise((resolve51) => {
|
|
34258
|
+
setTimeout(resolve51, STATIC_PLUGIN_RETRY_DELAY_MS);
|
|
34008
34259
|
});
|
|
34009
34260
|
var retryStaticPlugin = async (createStaticPlugin, options) => {
|
|
34010
34261
|
try {
|
|
@@ -34084,7 +34335,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
34084
34335
|
if (!fileName)
|
|
34085
34336
|
continue;
|
|
34086
34337
|
const srcPath = resolvePath4(devIndexDir, fileName);
|
|
34087
|
-
if (!
|
|
34338
|
+
if (!existsSync41(srcPath))
|
|
34088
34339
|
continue;
|
|
34089
34340
|
const rel = relative20(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
34090
34341
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
@@ -34100,10 +34351,10 @@ var registerIconVersioning = (buildDir) => {
|
|
|
34100
34351
|
if (cached !== undefined)
|
|
34101
34352
|
return cached;
|
|
34102
34353
|
const path = href.split("?")[0] ?? href;
|
|
34103
|
-
const filePath =
|
|
34354
|
+
const filePath = join56(buildDir, path);
|
|
34104
34355
|
let versioned = href;
|
|
34105
|
-
if (
|
|
34106
|
-
const hash =
|
|
34356
|
+
if (existsSync41(filePath)) {
|
|
34357
|
+
const hash = createHash10("sha256").update(readFileSync38(filePath)).digest("hex").slice(0, ICON_HASH_LENGTH);
|
|
34107
34358
|
versioned = href.includes("?") ? `${href}&v=${hash}` : `${href}?v=${hash}`;
|
|
34108
34359
|
}
|
|
34109
34360
|
cache2.set(href, versioned);
|
|
@@ -34120,14 +34371,17 @@ var prepareDev = async (config, buildDir) => {
|
|
|
34120
34371
|
});
|
|
34121
34372
|
};
|
|
34122
34373
|
let stepStartedAt = performance.now();
|
|
34374
|
+
setBootPhase("patch route registration");
|
|
34123
34375
|
const { patchElysiaRouteRegistrationCallsites: patchElysiaRouteRegistrationCallsites2 } = await Promise.resolve().then(() => (init_devRouteRegistrationCallsite(), exports_devRouteRegistrationCallsite));
|
|
34124
34376
|
patchElysiaRouteRegistrationCallsites2();
|
|
34125
34377
|
recordStep("patch route registration", stepStartedAt);
|
|
34126
34378
|
stepStartedAt = performance.now();
|
|
34379
|
+
setBootPhase("build");
|
|
34127
34380
|
const { devBuild: devBuild2 } = await Promise.resolve().then(() => (init_devBuild(), exports_devBuild));
|
|
34128
34381
|
const result = await devBuild2(config);
|
|
34129
34382
|
recordStep("devBuild", stepStartedAt);
|
|
34130
34383
|
stepStartedAt = performance.now();
|
|
34384
|
+
setBootPhase("load dev runtime");
|
|
34131
34385
|
const { hmr: hmr2 } = await Promise.resolve().then(() => (init_hmr(), exports_hmr));
|
|
34132
34386
|
const { staticPlugin } = await import("@elysia/static");
|
|
34133
34387
|
const { createModuleServer: createModuleServer2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
@@ -34165,8 +34419,17 @@ var prepareDev = async (config, buildDir) => {
|
|
|
34165
34419
|
const { warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
34166
34420
|
const prewarmDirs = buildPrewarmDirs(config);
|
|
34167
34421
|
stepStartedAt = performance.now();
|
|
34168
|
-
|
|
34169
|
-
|
|
34422
|
+
deferUntilServing(async () => {
|
|
34423
|
+
const prewarmStartedAt = performance.now();
|
|
34424
|
+
await warmPrewarmDirs(prewarmDirs, warmCache2, SRC_URL_PREFIX2);
|
|
34425
|
+
logStartupTimingBlock("AbsoluteJS deferred boot timing", [
|
|
34426
|
+
{
|
|
34427
|
+
durationMs: performance.now() - prewarmStartedAt,
|
|
34428
|
+
label: "prewarm source modules (after listen)"
|
|
34429
|
+
}
|
|
34430
|
+
]);
|
|
34431
|
+
});
|
|
34432
|
+
recordStep("schedule source module prewarm", stepStartedAt);
|
|
34170
34433
|
if (config.dev?.https) {
|
|
34171
34434
|
globalThis.__http2Config = {
|
|
34172
34435
|
hmrState: result.hmrState,
|
|
@@ -34174,12 +34437,14 @@ var prepareDev = async (config, buildDir) => {
|
|
|
34174
34437
|
};
|
|
34175
34438
|
}
|
|
34176
34439
|
stepStartedAt = performance.now();
|
|
34440
|
+
setBootPhase("configure dev plugins");
|
|
34177
34441
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
34178
34442
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
34179
34443
|
const devIndexDir = resolvePath4(buildDir, "_src_indexes");
|
|
34180
34444
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
34181
34445
|
recordStep("configure dev plugins", stepStartedAt);
|
|
34182
34446
|
stepStartedAt = performance.now();
|
|
34447
|
+
setBootPhase("load runtime metadata");
|
|
34183
34448
|
if (result.conventions)
|
|
34184
34449
|
setConventions(result.conventions);
|
|
34185
34450
|
setCurrentIslandManifest(result.manifest);
|
|
@@ -34189,6 +34454,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
34189
34454
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
34190
34455
|
recordStep("load runtime metadata", stepStartedAt);
|
|
34191
34456
|
stepStartedAt = performance.now();
|
|
34457
|
+
setBootPhase("assemble dev runtime");
|
|
34192
34458
|
const { imageOptimizer: imageOptimizer2 } = await Promise.resolve().then(() => (init_imageOptimizer(), exports_imageOptimizer));
|
|
34193
34459
|
const { requestInspector: requestInspector2 } = await Promise.resolve().then(() => (init_requestInspector(), exports_requestInspector));
|
|
34194
34460
|
const { serverTiming } = await import("@elysia/server-timing");
|
|
@@ -34218,6 +34484,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
34218
34484
|
await withOpenApi(absolutejs, config, process.cwd(), true);
|
|
34219
34485
|
await withTelemetry(absolutejs, config, process.cwd());
|
|
34220
34486
|
recordStep("assemble dev runtime", stepStartedAt);
|
|
34487
|
+
setBootPhase("starting server");
|
|
34221
34488
|
logStartupTimingBlock("AbsoluteJS prepareDev timing", startupSteps);
|
|
34222
34489
|
return {
|
|
34223
34490
|
absolutejs,
|
|
@@ -34226,7 +34493,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
34226
34493
|
};
|
|
34227
34494
|
var loadPrerenderMap = (prerenderDir) => {
|
|
34228
34495
|
const map = new Map;
|
|
34229
|
-
if (!
|
|
34496
|
+
if (!existsSync41(prerenderDir))
|
|
34230
34497
|
return map;
|
|
34231
34498
|
let entries;
|
|
34232
34499
|
try {
|
|
@@ -34239,13 +34506,13 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
34239
34506
|
continue;
|
|
34240
34507
|
const name = basename18(entry, ".html");
|
|
34241
34508
|
const route = name === "index" ? "/" : `/${name}`;
|
|
34242
|
-
map.set(route,
|
|
34509
|
+
map.set(route, join56(prerenderDir, entry));
|
|
34243
34510
|
}
|
|
34244
34511
|
return map;
|
|
34245
34512
|
};
|
|
34246
34513
|
var loadMobileCompatibilityPlugin = async (buildDir) => {
|
|
34247
|
-
const root =
|
|
34248
|
-
if (!
|
|
34514
|
+
const root = join56(buildDir, ".absolutejs", "mobile-compatibility");
|
|
34515
|
+
if (!existsSync41(join56(root, "current.json"))) {
|
|
34249
34516
|
return new Elysia10({ name: "absolutejs-mobile-compatibility-empty" });
|
|
34250
34517
|
}
|
|
34251
34518
|
const options = await loadAbsoluteMobileMaterializedBundle(root);
|
|
@@ -34298,7 +34565,7 @@ var prepare = async (configOrPath) => {
|
|
|
34298
34565
|
return result;
|
|
34299
34566
|
}
|
|
34300
34567
|
stepStartedAt = performance.now();
|
|
34301
|
-
const manifest = JSON.parse(
|
|
34568
|
+
const manifest = JSON.parse(readFileSync38(`${buildDir}/manifest.json`, "utf-8"));
|
|
34302
34569
|
setCurrentIslandManifest(manifest);
|
|
34303
34570
|
if (config.islands?.registry) {
|
|
34304
34571
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -34306,14 +34573,14 @@ var prepare = async (configOrPath) => {
|
|
|
34306
34573
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
34307
34574
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
34308
34575
|
stepStartedAt = performance.now();
|
|
34309
|
-
const conventionsPath =
|
|
34310
|
-
if (
|
|
34311
|
-
const conventions2 = JSON.parse(
|
|
34576
|
+
const conventionsPath = join56(buildDir, "conventions.json");
|
|
34577
|
+
if (existsSync41(conventionsPath)) {
|
|
34578
|
+
const conventions2 = JSON.parse(readFileSync38(conventionsPath, "utf-8"));
|
|
34312
34579
|
setConventions(conventions2);
|
|
34313
34580
|
}
|
|
34314
|
-
const spaRoutesPath =
|
|
34315
|
-
if (
|
|
34316
|
-
setSpaRouteManifest(JSON.parse(
|
|
34581
|
+
const spaRoutesPath = join56(buildDir, "spa-routes.json");
|
|
34582
|
+
if (existsSync41(spaRoutesPath)) {
|
|
34583
|
+
setSpaRouteManifest(JSON.parse(readFileSync38(spaRoutesPath, "utf-8")));
|
|
34317
34584
|
}
|
|
34318
34585
|
recordStep("load production conventions", stepStartedAt);
|
|
34319
34586
|
stepStartedAt = performance.now();
|
|
@@ -34324,7 +34591,7 @@ var prepare = async (configOrPath) => {
|
|
|
34324
34591
|
prefix: "",
|
|
34325
34592
|
staticLimit: MAX_STATIC_ROUTE_COUNT
|
|
34326
34593
|
});
|
|
34327
|
-
const generatedAssetsRoot =
|
|
34594
|
+
const generatedAssetsRoot = join56(buildDir, ".absolutejs");
|
|
34328
34595
|
const generatedAssetsPlugin = new Elysia10({
|
|
34329
34596
|
name: "absolutejs-generated-assets"
|
|
34330
34597
|
}).get("/.absolutejs/*", async ({ params, set }) => {
|
|
@@ -34362,7 +34629,7 @@ var prepare = async (configOrPath) => {
|
|
|
34362
34629
|
responseValue.headers.set("cache-control", isFingerprintedAsset(pathname) ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate");
|
|
34363
34630
|
});
|
|
34364
34631
|
stepStartedAt = performance.now();
|
|
34365
|
-
const prerenderDir =
|
|
34632
|
+
const prerenderDir = join56(buildDir, "_prerendered");
|
|
34366
34633
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
34367
34634
|
const mobileCompatibilityPlugin = await loadMobileCompatibilityPlugin(buildDir);
|
|
34368
34635
|
const mobileAssociationPlugin = createAbsoluteMobileAssociationPlugin(config.mobile, process.cwd(), { requireAll: true });
|
|
@@ -34422,6 +34689,7 @@ var wrapPageHandlerWithStreamingSlots = (handler, options) => {
|
|
|
34422
34689
|
};
|
|
34423
34690
|
// src/plugins/networking.ts
|
|
34424
34691
|
init_constants();
|
|
34692
|
+
init_bootLifecycle();
|
|
34425
34693
|
import { argv } from "process";
|
|
34426
34694
|
var {env: env4 } = globalThis.Bun;
|
|
34427
34695
|
import { websocket as websocket3 } from "elysia/websocket";
|
|
@@ -34430,23 +34698,23 @@ import { buildGlobalWSHandler } from "elysia/ws";
|
|
|
34430
34698
|
// src/dev/devCert.ts
|
|
34431
34699
|
import {
|
|
34432
34700
|
copyFileSync as copyFileSync3,
|
|
34433
|
-
existsSync as
|
|
34434
|
-
mkdirSync as
|
|
34435
|
-
readFileSync as
|
|
34701
|
+
existsSync as existsSync42,
|
|
34702
|
+
mkdirSync as mkdirSync18,
|
|
34703
|
+
readFileSync as readFileSync39,
|
|
34436
34704
|
rmSync as rmSync4
|
|
34437
34705
|
} from "fs";
|
|
34438
34706
|
import { X509Certificate as X509Certificate2 } from "crypto";
|
|
34439
34707
|
import { isIP } from "net";
|
|
34440
|
-
import { join as
|
|
34441
|
-
var CERT_DIR =
|
|
34442
|
-
var CERT_PATH =
|
|
34443
|
-
var KEY_PATH =
|
|
34708
|
+
import { join as join57 } from "path";
|
|
34709
|
+
var CERT_DIR = join57(process.cwd(), ".absolutejs");
|
|
34710
|
+
var CERT_PATH = join57(CERT_DIR, "cert.pem");
|
|
34711
|
+
var KEY_PATH = join57(CERT_DIR, "key.pem");
|
|
34444
34712
|
var CERT_VALIDITY_DAYS = 365;
|
|
34445
34713
|
var DEFAULT_CERTIFICATE_HOSTS = ["localhost", "127.0.0.1", "::1"];
|
|
34446
34714
|
var CERTIFICATE_HOSTNAME_PATTERN = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?))*$/u;
|
|
34447
34715
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
34448
34716
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
34449
|
-
var certFilesExist = () =>
|
|
34717
|
+
var certFilesExist = () => existsSync42(CERT_PATH) && existsSync42(KEY_PATH);
|
|
34450
34718
|
var normalizeDevCertificateHosts = (hosts = []) => {
|
|
34451
34719
|
const normalized = new Set(DEFAULT_CERTIFICATE_HOSTS);
|
|
34452
34720
|
for (const host2 of hosts) {
|
|
@@ -34462,7 +34730,7 @@ var normalizeDevCertificateHosts = (hosts = []) => {
|
|
|
34462
34730
|
};
|
|
34463
34731
|
var certificateIsUsable = (hosts) => {
|
|
34464
34732
|
try {
|
|
34465
|
-
const certPem =
|
|
34733
|
+
const certPem = readFileSync39(CERT_PATH, "utf-8");
|
|
34466
34734
|
const certificate = new X509Certificate2(certPem);
|
|
34467
34735
|
if (new Date(certificate.validTo).getTime() <= Date.now())
|
|
34468
34736
|
return false;
|
|
@@ -34532,7 +34800,7 @@ var generateCert = (hosts = []) => {
|
|
|
34532
34800
|
}
|
|
34533
34801
|
};
|
|
34534
34802
|
var ensureDevCert = (hosts = []) => {
|
|
34535
|
-
|
|
34803
|
+
mkdirSync18(CERT_DIR, { recursive: true });
|
|
34536
34804
|
if (hasCert(hosts)) {
|
|
34537
34805
|
return { cert: CERT_PATH, key: KEY_PATH };
|
|
34538
34806
|
}
|
|
@@ -34554,29 +34822,44 @@ var loadDevCert = (hosts = []) => {
|
|
|
34554
34822
|
return null;
|
|
34555
34823
|
try {
|
|
34556
34824
|
return {
|
|
34557
|
-
cert:
|
|
34558
|
-
key:
|
|
34825
|
+
cert: readFileSync39(paths.cert, "utf-8"),
|
|
34826
|
+
key: readFileSync39(paths.key, "utf-8")
|
|
34559
34827
|
};
|
|
34560
34828
|
} catch {
|
|
34561
34829
|
return null;
|
|
34562
34830
|
}
|
|
34563
34831
|
};
|
|
34564
34832
|
|
|
34833
|
+
// src/dev/earlyListener.ts
|
|
34834
|
+
init_constants();
|
|
34835
|
+
init_bootLifecycle();
|
|
34836
|
+
var RETRY_AFTER_SECONDS = 2;
|
|
34837
|
+
var POLL_INTERVAL_MS = RETRY_AFTER_SECONDS * MILLISECONDS_IN_A_SECOND;
|
|
34838
|
+
var releaseEarlyListener = () => {
|
|
34839
|
+
const listener = globalThis.__absoluteEarlyListener;
|
|
34840
|
+
if (!listener)
|
|
34841
|
+
return false;
|
|
34842
|
+
const hadServer = listener.server !== null;
|
|
34843
|
+
listener.release();
|
|
34844
|
+
globalThis.__absoluteEarlyListener = undefined;
|
|
34845
|
+
return hadServer;
|
|
34846
|
+
};
|
|
34847
|
+
|
|
34565
34848
|
// src/utils/instanceRegistry.ts
|
|
34566
34849
|
import {
|
|
34567
|
-
mkdirSync as
|
|
34568
|
-
readFileSync as
|
|
34850
|
+
mkdirSync as mkdirSync19,
|
|
34851
|
+
readFileSync as readFileSync40,
|
|
34569
34852
|
readdirSync as readdirSync11,
|
|
34570
34853
|
unlinkSync as unlinkSync2,
|
|
34571
|
-
writeFileSync as
|
|
34854
|
+
writeFileSync as writeFileSync12
|
|
34572
34855
|
} from "fs";
|
|
34573
34856
|
import { homedir as homedir2 } from "os";
|
|
34574
|
-
import { basename as basename19, join as
|
|
34857
|
+
import { basename as basename19, join as join58 } from "path";
|
|
34575
34858
|
var registeredPids = new Set;
|
|
34576
34859
|
var exitHandlerRegistered = false;
|
|
34577
|
-
var instanceFilePath = (pid) =>
|
|
34578
|
-
var instanceLogPath = (pid) =>
|
|
34579
|
-
var instanceRegistryDir = () =>
|
|
34860
|
+
var instanceFilePath = (pid) => join58(instanceRegistryDir(), `${pid}.json`);
|
|
34861
|
+
var instanceLogPath = (pid) => join58(instanceRegistryDir(), `${pid}.log`);
|
|
34862
|
+
var instanceRegistryDir = () => join58(homedir2(), ".absolutejs", "instances");
|
|
34580
34863
|
var removeInstanceFilesSync = (pid) => {
|
|
34581
34864
|
try {
|
|
34582
34865
|
unlinkSync2(instanceFilePath(pid));
|
|
@@ -34598,20 +34881,20 @@ var registerExitHandlerOnce = () => {
|
|
|
34598
34881
|
};
|
|
34599
34882
|
var readJsonFile = (path) => {
|
|
34600
34883
|
try {
|
|
34601
|
-
return JSON.parse(
|
|
34884
|
+
return JSON.parse(readFileSync40(path, "utf-8"));
|
|
34602
34885
|
} catch {
|
|
34603
34886
|
return null;
|
|
34604
34887
|
}
|
|
34605
34888
|
};
|
|
34606
34889
|
var registerInstance = (record) => {
|
|
34607
|
-
|
|
34608
|
-
|
|
34890
|
+
mkdirSync19(instanceRegistryDir(), { recursive: true });
|
|
34891
|
+
writeFileSync12(instanceFilePath(record.pid), JSON.stringify(record, null, 2));
|
|
34609
34892
|
registeredPids.add(record.pid);
|
|
34610
34893
|
registerExitHandlerOnce();
|
|
34611
34894
|
return record;
|
|
34612
34895
|
};
|
|
34613
34896
|
var resolveProjectName = (cwd2) => {
|
|
34614
|
-
const parsed = readJsonFile(
|
|
34897
|
+
const parsed = readJsonFile(join58(cwd2, "package.json"));
|
|
34615
34898
|
if (parsed !== null && typeof parsed === "object" && typeof parsed.name === "string" && parsed.name.trim().length > 0) {
|
|
34616
34899
|
return parsed.name;
|
|
34617
34900
|
}
|
|
@@ -34725,8 +35008,10 @@ var networking = (app) => {
|
|
|
34725
35008
|
},
|
|
34726
35009
|
fetch: (request) => app.fetch(request)
|
|
34727
35010
|
});
|
|
35011
|
+
runDeferredBootTasks();
|
|
34728
35012
|
return app;
|
|
34729
35013
|
}
|
|
35014
|
+
releaseEarlyListener();
|
|
34730
35015
|
const listened = app.listen({
|
|
34731
35016
|
hostname: host2,
|
|
34732
35017
|
idleTimeout: httpIdleTimeout,
|
|
@@ -34739,6 +35024,7 @@ var networking = (app) => {
|
|
|
34739
35024
|
} : {}
|
|
34740
35025
|
}, () => {
|
|
34741
35026
|
selfRegisterInstance();
|
|
35027
|
+
runDeferredBootTasks();
|
|
34742
35028
|
if (visibility === "internal" || managedByWorkspace) {
|
|
34743
35029
|
return;
|
|
34744
35030
|
}
|
|
@@ -34923,8 +35209,8 @@ var generateHeadElement = ({
|
|
|
34923
35209
|
};
|
|
34924
35210
|
// src/utils/defineEnv.ts
|
|
34925
35211
|
var {env: bunEnv } = globalThis.Bun;
|
|
34926
|
-
import { existsSync as
|
|
34927
|
-
import { resolve as
|
|
35212
|
+
import { existsSync as existsSync44, readFileSync as readFileSync42 } from "fs";
|
|
35213
|
+
import { resolve as resolve52 } from "path";
|
|
34928
35214
|
|
|
34929
35215
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
34930
35216
|
var exports_value = {};
|
|
@@ -40959,19 +41245,19 @@ ${lines.join(`
|
|
|
40959
41245
|
};
|
|
40960
41246
|
var checkEnvFileSecurity = (properties) => {
|
|
40961
41247
|
const cwd2 = process.cwd();
|
|
40962
|
-
const envPath =
|
|
40963
|
-
if (!
|
|
41248
|
+
const envPath = resolve52(cwd2, ".env");
|
|
41249
|
+
if (!existsSync44(envPath))
|
|
40964
41250
|
return;
|
|
40965
41251
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
40966
41252
|
if (sensitiveKeys.length === 0)
|
|
40967
41253
|
return;
|
|
40968
|
-
const envContent =
|
|
41254
|
+
const envContent = readFileSync42(envPath, "utf-8");
|
|
40969
41255
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
40970
41256
|
if (presentKeys.length === 0)
|
|
40971
41257
|
return;
|
|
40972
|
-
const gitignorePath =
|
|
40973
|
-
if (
|
|
40974
|
-
const gitignore =
|
|
41258
|
+
const gitignorePath = resolve52(cwd2, ".gitignore");
|
|
41259
|
+
if (existsSync44(gitignorePath)) {
|
|
41260
|
+
const gitignore = readFileSync42(gitignorePath, "utf-8");
|
|
40975
41261
|
if (gitignore.split(`
|
|
40976
41262
|
`).some((line) => line.trim() === ".env"))
|
|
40977
41263
|
return;
|
|
@@ -41003,8 +41289,8 @@ var getEnv = (key) => {
|
|
|
41003
41289
|
return environmentVariable;
|
|
41004
41290
|
};
|
|
41005
41291
|
// src/utils/projectRoot.ts
|
|
41006
|
-
import { existsSync as
|
|
41007
|
-
import { dirname as dirname34, resolve as
|
|
41292
|
+
import { existsSync as existsSync45 } from "fs";
|
|
41293
|
+
import { dirname as dirname34, resolve as resolve53 } from "path";
|
|
41008
41294
|
var CONFIG_CANDIDATES = [
|
|
41009
41295
|
"absolute.config.ts",
|
|
41010
41296
|
"absolute.config.js",
|
|
@@ -41013,7 +41299,7 @@ var CONFIG_CANDIDATES = [
|
|
|
41013
41299
|
"absolute.config.mts",
|
|
41014
41300
|
"absolute.config.cts"
|
|
41015
41301
|
];
|
|
41016
|
-
var hasAbsoluteConfig = (directory) => CONFIG_CANDIDATES.some((name) =>
|
|
41302
|
+
var hasAbsoluteConfig = (directory) => CONFIG_CANDIDATES.some((name) => existsSync45(resolve53(directory, name)));
|
|
41017
41303
|
var findProjectRoot = () => {
|
|
41018
41304
|
const start = process.cwd();
|
|
41019
41305
|
let packageRoot = null;
|
|
@@ -41022,7 +41308,7 @@ var findProjectRoot = () => {
|
|
|
41022
41308
|
if (hasAbsoluteConfig(directory)) {
|
|
41023
41309
|
return directory;
|
|
41024
41310
|
}
|
|
41025
|
-
if (packageRoot === null &&
|
|
41311
|
+
if (packageRoot === null && existsSync45(resolve53(directory, "package.json"))) {
|
|
41026
41312
|
packageRoot = directory;
|
|
41027
41313
|
}
|
|
41028
41314
|
const parent = dirname34(directory);
|
|
@@ -41271,5 +41557,5 @@ export {
|
|
|
41271
41557
|
wrapPageHandlerWithStreamingSlots
|
|
41272
41558
|
};
|
|
41273
41559
|
|
|
41274
|
-
//# debugId=
|
|
41560
|
+
//# debugId=C2C6E94A66DDD23764756E2164756E21
|
|
41275
41561
|
//# sourceMappingURL=index.js.map
|