@absolutejs/absolute 0.19.0-beta.950 → 0.19.0-beta.951
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +11 -7
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +11 -7
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +1235 -717
- package/dist/build.js.map +21 -19
- package/dist/cli/index.js +159 -92
- package/dist/index.js +1330 -794
- package/dist/index.js.map +26 -24
- package/dist/islands/index.js +5 -5
- package/dist/islands/index.js.map +3 -3
- package/dist/react/components/browser/index.js +17 -2
- package/dist/react/components/index.js +19 -3
- package/dist/react/components/index.js.map +5 -4
- package/dist/react/index.js +9 -5
- package/dist/react/index.js.map +3 -3
- package/dist/react/server.js +5 -1
- package/dist/react/server.js.map +2 -2
- package/dist/src/build/chainInlineSourcemaps.d.ts +13 -0
- package/dist/src/build/externalAssetPlugin.d.ts +2 -0
- package/dist/src/core/prepare.d.ts +11 -2
- package/dist/src/dev/clientManager.d.ts +1 -0
- package/dist/src/dev/serverEntryWatcher.d.ts +1 -0
- package/dist/src/react/components/Head.d.ts +1 -1
- package/dist/src/utils/generateHeadElement.d.ts +1 -1
- package/dist/src/utils/jsonLd.d.ts +1 -0
- package/dist/svelte/index.js +9 -5
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +9 -5
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/globals.d.ts +1 -4
- package/dist/types/metadata.d.ts +2 -0
- package/dist/vue/index.js +9 -5
- package/dist/vue/index.js.map +4 -4
- package/dist/vue/server.js +5 -1
- package/dist/vue/server.js.map +3 -3
- package/package.json +17 -1
package/dist/build.js
CHANGED
|
@@ -2645,7 +2645,7 @@ import {
|
|
|
2645
2645
|
relative as relative3,
|
|
2646
2646
|
resolve as resolve6
|
|
2647
2647
|
} from "path";
|
|
2648
|
-
import { fileURLToPath } from "url";
|
|
2648
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
2649
2649
|
var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
2650
2650
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2651
2651
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -2879,7 +2879,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2879
2879
|
canonicalize(specifier, options) {
|
|
2880
2880
|
const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
|
|
2881
2881
|
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
2882
|
-
return resolved ? new URL(
|
|
2882
|
+
return resolved ? new URL(pathToFileURL(resolve6(resolved)).href) : null;
|
|
2883
2883
|
},
|
|
2884
2884
|
load(canonicalUrl) {
|
|
2885
2885
|
const filePath = fileURLToPath(canonicalUrl);
|
|
@@ -2997,7 +2997,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2997
2997
|
loadPaths,
|
|
2998
2998
|
style: "expanded",
|
|
2999
2999
|
syntax: language === "sass" ? "indented" : "scss",
|
|
3000
|
-
url: new URL(
|
|
3000
|
+
url: new URL(pathToFileURL(resolve6(filePath)).href)
|
|
3001
3001
|
});
|
|
3002
3002
|
const css = await runPostcss(result.css, filePath, config);
|
|
3003
3003
|
const loadedUrls = result.loadedUrls ?? [];
|
|
@@ -3184,7 +3184,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3184
3184
|
loadPaths,
|
|
3185
3185
|
style: "expanded",
|
|
3186
3186
|
syntax: language === "sass" ? "indented" : "scss",
|
|
3187
|
-
url: new URL(
|
|
3187
|
+
url: new URL(pathToFileURL(resolve6(filePath)).href)
|
|
3188
3188
|
});
|
|
3189
3189
|
const loadedUrls = result.loadedUrls ?? [];
|
|
3190
3190
|
for (const url of loadedUrls) {
|
|
@@ -9801,6 +9801,45 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
9801
9801
|
angularLinkerPlugin = createAngularLinkerPlugin(false);
|
|
9802
9802
|
});
|
|
9803
9803
|
|
|
9804
|
+
// src/build/externalAssetPlugin.ts
|
|
9805
|
+
import { copyFileSync, existsSync as existsSync14, mkdirSync as mkdirSync6, statSync } from "fs";
|
|
9806
|
+
import { basename as basename4, dirname as dirname9, join as join13, resolve as resolve15 } from "path";
|
|
9807
|
+
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
9808
|
+
name: "absolute-external-asset",
|
|
9809
|
+
setup(bld) {
|
|
9810
|
+
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
9811
|
+
const skipRoots = userSourceRoots.map((root) => resolve15(root));
|
|
9812
|
+
const isUserSource = (path) => skipRoots.some((root) => path.startsWith(`${root}/`));
|
|
9813
|
+
bld.onLoad({ filter: /\.[mc]?[jt]sx?$/ }, async (args) => {
|
|
9814
|
+
if (isUserSource(args.path))
|
|
9815
|
+
return;
|
|
9816
|
+
const source = await Bun.file(args.path).text();
|
|
9817
|
+
if (!source.includes("import.meta.url"))
|
|
9818
|
+
return;
|
|
9819
|
+
urlPattern.lastIndex = 0;
|
|
9820
|
+
let match;
|
|
9821
|
+
const sourceDir = dirname9(args.path);
|
|
9822
|
+
while ((match = urlPattern.exec(source)) !== null) {
|
|
9823
|
+
const relPath = match[1];
|
|
9824
|
+
if (!relPath)
|
|
9825
|
+
continue;
|
|
9826
|
+
const assetPath = resolve15(sourceDir, relPath);
|
|
9827
|
+
if (!existsSync14(assetPath))
|
|
9828
|
+
continue;
|
|
9829
|
+
if (!statSync(assetPath).isFile())
|
|
9830
|
+
continue;
|
|
9831
|
+
const targetPath = join13(outDir, basename4(assetPath));
|
|
9832
|
+
if (existsSync14(targetPath))
|
|
9833
|
+
continue;
|
|
9834
|
+
mkdirSync6(dirname9(targetPath), { recursive: true });
|
|
9835
|
+
copyFileSync(assetPath, targetPath);
|
|
9836
|
+
}
|
|
9837
|
+
return;
|
|
9838
|
+
});
|
|
9839
|
+
}
|
|
9840
|
+
});
|
|
9841
|
+
var init_externalAssetPlugin = () => {};
|
|
9842
|
+
|
|
9804
9843
|
// src/dev/angular/hmrInjectionPlugin.ts
|
|
9805
9844
|
var exports_hmrInjectionPlugin = {};
|
|
9806
9845
|
__export(exports_hmrInjectionPlugin, {
|
|
@@ -9808,7 +9847,7 @@ __export(exports_hmrInjectionPlugin, {
|
|
|
9808
9847
|
applyAngularHmrInjection: () => applyAngularHmrInjection
|
|
9809
9848
|
});
|
|
9810
9849
|
import { readFile as readFile5 } from "fs/promises";
|
|
9811
|
-
import { relative as relative7, resolve as
|
|
9850
|
+
import { relative as relative7, resolve as resolve16 } from "path";
|
|
9812
9851
|
var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames = (jsSource) => {
|
|
9813
9852
|
const names = new Set;
|
|
9814
9853
|
IMPORT_RE.lastIndex = 0;
|
|
@@ -9971,7 +10010,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
|
|
|
9971
10010
|
}
|
|
9972
10011
|
`, applyAngularHmrInjection = (jsSource, componentJsAbsPath, params) => {
|
|
9973
10012
|
const { generatedAngularRoot, userAngularRoot, projectRoot } = params;
|
|
9974
|
-
const normalizedGenRoot =
|
|
10013
|
+
const normalizedGenRoot = resolve16(generatedAngularRoot).replace(/\\/g, "/");
|
|
9975
10014
|
const normalizedPath = componentJsAbsPath.replace(/\\/g, "/");
|
|
9976
10015
|
if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
|
|
9977
10016
|
return;
|
|
@@ -9989,7 +10028,7 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
|
|
|
9989
10028
|
if (classNames.length === 0)
|
|
9990
10029
|
return;
|
|
9991
10030
|
const relFromGenRoot = relative7(generatedAngularRoot, componentJsAbsPath).replace(/\\/g, "/");
|
|
9992
|
-
const userTsPath =
|
|
10031
|
+
const userTsPath = resolve16(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
|
|
9993
10032
|
const projectRel = relative7(projectRoot, userTsPath).replace(/\\/g, "/");
|
|
9994
10033
|
const tail = classNames.map((className) => {
|
|
9995
10034
|
const id = `${projectRel}@${className}`;
|
|
@@ -10024,14 +10063,14 @@ var init_hmrInjectionPlugin = __esm(() => {
|
|
|
10024
10063
|
|
|
10025
10064
|
// src/utils/cleanStaleOutputs.ts
|
|
10026
10065
|
import { rm as rm2 } from "fs/promises";
|
|
10027
|
-
import { resolve as
|
|
10066
|
+
import { resolve as resolve17 } from "path";
|
|
10028
10067
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
10029
10068
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
10030
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
10069
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve17(path)));
|
|
10031
10070
|
const glob = new Glob5("**/*");
|
|
10032
10071
|
const removals = [];
|
|
10033
10072
|
for (const relative8 of glob.scanSync({ cwd: buildPath })) {
|
|
10034
|
-
const absolute =
|
|
10073
|
+
const absolute = resolve17(buildPath, relative8);
|
|
10035
10074
|
if (currentPaths.has(absolute))
|
|
10036
10075
|
continue;
|
|
10037
10076
|
if (!HASHED_FILE_PATTERN.test(relative8))
|
|
@@ -10050,20 +10089,20 @@ __export(exports_generatedDir, {
|
|
|
10050
10089
|
getGeneratedRoot: () => getGeneratedRoot,
|
|
10051
10090
|
getFrameworkGeneratedDir: () => getFrameworkGeneratedDir
|
|
10052
10091
|
});
|
|
10053
|
-
import { join as
|
|
10054
|
-
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) =>
|
|
10092
|
+
import { join as join14 } from "path";
|
|
10093
|
+
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) => join14(projectRoot, ABSOLUTE_CACHE_DIR_NAME, GENERATED_DIR_NAME), getFrameworkGeneratedDir = (framework, projectRoot = process.cwd()) => join14(getGeneratedRoot(projectRoot), framework);
|
|
10055
10094
|
var init_generatedDir = () => {};
|
|
10056
10095
|
|
|
10057
10096
|
// src/utils/cleanup.ts
|
|
10058
10097
|
import { rm as rm3 } from "fs/promises";
|
|
10059
|
-
import { join as
|
|
10098
|
+
import { join as join15 } from "path";
|
|
10060
10099
|
var removeIfExists = (path) => rm3(path, { force: true, recursive: true }), cleanFramework = (framework, frameworkDir, skipGenerated = false) => {
|
|
10061
10100
|
const tasks = [];
|
|
10062
10101
|
if (!skipGenerated) {
|
|
10063
10102
|
tasks.push(removeIfExists(getFrameworkGeneratedDir(framework)));
|
|
10064
10103
|
}
|
|
10065
10104
|
if (frameworkDir)
|
|
10066
|
-
tasks.push(removeIfExists(
|
|
10105
|
+
tasks.push(removeIfExists(join15(frameworkDir, "generated")));
|
|
10067
10106
|
return Promise.all(tasks);
|
|
10068
10107
|
}, cleanup = async ({
|
|
10069
10108
|
angularDir,
|
|
@@ -10101,8 +10140,8 @@ var commonAncestor = (paths, fallback) => {
|
|
|
10101
10140
|
var init_commonAncestor = () => {};
|
|
10102
10141
|
|
|
10103
10142
|
// src/utils/buildDirectoryLock.ts
|
|
10104
|
-
import { mkdirSync as
|
|
10105
|
-
import { dirname as
|
|
10143
|
+
import { mkdirSync as mkdirSync7, unlinkSync, writeFileSync as writeFileSync6, readFileSync as readFileSync10 } from "fs";
|
|
10144
|
+
import { dirname as dirname10, join as join16 } from "path";
|
|
10106
10145
|
var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandlersRegistered = false, registerExitHandlersOnce = () => {
|
|
10107
10146
|
if (exitHandlersRegistered)
|
|
10108
10147
|
return;
|
|
@@ -10128,7 +10167,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
10128
10167
|
releaseAllSync();
|
|
10129
10168
|
throw err;
|
|
10130
10169
|
});
|
|
10131
|
-
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) =>
|
|
10170
|
+
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join16(dirname10(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
|
|
10132
10171
|
`).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
|
|
10133
10172
|
if (locks.size === 0) {
|
|
10134
10173
|
delete process.env[HELD_LOCKS_ENV];
|
|
@@ -10145,7 +10184,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
10145
10184
|
locks.delete(buildDirectory);
|
|
10146
10185
|
writeHeldLockEnv(locks);
|
|
10147
10186
|
}, writeLockFileSync = (lockPath, metadata) => {
|
|
10148
|
-
|
|
10187
|
+
mkdirSync7(dirname10(lockPath), { recursive: true });
|
|
10149
10188
|
writeFileSync6(lockPath, JSON.stringify(metadata, null, 2), { flag: "wx" });
|
|
10150
10189
|
}, readLockMetadata = (lockPath) => {
|
|
10151
10190
|
try {
|
|
@@ -10265,10 +10304,10 @@ var init_buildDirectoryLock = __esm(() => {
|
|
|
10265
10304
|
});
|
|
10266
10305
|
|
|
10267
10306
|
// src/utils/validateSafePath.ts
|
|
10268
|
-
import { resolve as
|
|
10307
|
+
import { resolve as resolve18, relative as relative8 } from "path";
|
|
10269
10308
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
10270
|
-
const absoluteBase =
|
|
10271
|
-
const absoluteTarget =
|
|
10309
|
+
const absoluteBase = resolve18(baseDirectory);
|
|
10310
|
+
const absoluteTarget = resolve18(baseDirectory, targetPath);
|
|
10272
10311
|
const relativePath = normalizePath(relative8(absoluteBase, absoluteTarget));
|
|
10273
10312
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
10274
10313
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
@@ -10416,14 +10455,14 @@ __export(exports_compileSvelte, {
|
|
|
10416
10455
|
compileSvelte: () => compileSvelte,
|
|
10417
10456
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
10418
10457
|
});
|
|
10419
|
-
import { existsSync as
|
|
10458
|
+
import { existsSync as existsSync15 } from "fs";
|
|
10420
10459
|
import { mkdir as mkdir4, stat as stat2 } from "fs/promises";
|
|
10421
10460
|
import {
|
|
10422
|
-
dirname as
|
|
10423
|
-
join as
|
|
10424
|
-
basename as
|
|
10461
|
+
dirname as dirname11,
|
|
10462
|
+
join as join17,
|
|
10463
|
+
basename as basename5,
|
|
10425
10464
|
extname as extname5,
|
|
10426
|
-
resolve as
|
|
10465
|
+
resolve as resolve19,
|
|
10427
10466
|
relative as relative9,
|
|
10428
10467
|
sep as sep2
|
|
10429
10468
|
} from "path";
|
|
@@ -10431,14 +10470,14 @@ import { env } from "process";
|
|
|
10431
10470
|
var {write, file, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
10432
10471
|
var resolveDevClientDir2 = () => {
|
|
10433
10472
|
const projectRoot = process.cwd();
|
|
10434
|
-
const fromSource =
|
|
10435
|
-
if (
|
|
10473
|
+
const fromSource = resolve19(import.meta.dir, "../dev/client");
|
|
10474
|
+
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10436
10475
|
return fromSource;
|
|
10437
10476
|
}
|
|
10438
|
-
const fromNodeModules =
|
|
10439
|
-
if (
|
|
10477
|
+
const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
10478
|
+
if (existsSync15(fromNodeModules))
|
|
10440
10479
|
return fromNodeModules;
|
|
10441
|
-
return
|
|
10480
|
+
return resolve19(import.meta.dir, "./dev/client");
|
|
10442
10481
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
10443
10482
|
persistentCache.clear();
|
|
10444
10483
|
sourceHashCache.clear();
|
|
@@ -10468,7 +10507,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10468
10507
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
10469
10508
|
if (!spec.startsWith("."))
|
|
10470
10509
|
return null;
|
|
10471
|
-
const basePath =
|
|
10510
|
+
const basePath = resolve19(dirname11(from), spec);
|
|
10472
10511
|
const candidates = [
|
|
10473
10512
|
basePath,
|
|
10474
10513
|
`${basePath}.ts`,
|
|
@@ -10479,14 +10518,14 @@ var resolveDevClientDir2 = () => {
|
|
|
10479
10518
|
`${basePath}.svelte`,
|
|
10480
10519
|
`${basePath}.svelte.ts`,
|
|
10481
10520
|
`${basePath}.svelte.js`,
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10521
|
+
join17(basePath, "index.ts"),
|
|
10522
|
+
join17(basePath, "index.js"),
|
|
10523
|
+
join17(basePath, "index.mjs"),
|
|
10524
|
+
join17(basePath, "index.cjs"),
|
|
10525
|
+
join17(basePath, "index.json"),
|
|
10526
|
+
join17(basePath, "index.svelte"),
|
|
10527
|
+
join17(basePath, "index.svelte.ts"),
|
|
10528
|
+
join17(basePath, "index.svelte.js")
|
|
10490
10529
|
];
|
|
10491
10530
|
const checks = await Promise.all(candidates.map(exists));
|
|
10492
10531
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -10495,7 +10534,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10495
10534
|
const resolved = resolvePackageImport(spec);
|
|
10496
10535
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
10497
10536
|
}
|
|
10498
|
-
const basePath =
|
|
10537
|
+
const basePath = resolve19(dirname11(from), spec);
|
|
10499
10538
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
10500
10539
|
if (!explicit) {
|
|
10501
10540
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -10525,9 +10564,9 @@ var resolveDevClientDir2 = () => {
|
|
|
10525
10564
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
|
|
10526
10565
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
10527
10566
|
const generatedDir = getFrameworkGeneratedDir("svelte");
|
|
10528
|
-
const clientDir =
|
|
10529
|
-
const indexDir =
|
|
10530
|
-
const serverDir =
|
|
10567
|
+
const clientDir = join17(generatedDir, "client");
|
|
10568
|
+
const indexDir = join17(generatedDir, "indexes");
|
|
10569
|
+
const serverDir = join17(generatedDir, "server");
|
|
10531
10570
|
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir4(dir, { recursive: true })));
|
|
10532
10571
|
const dev = env.NODE_ENV !== "production";
|
|
10533
10572
|
const build = async (src) => {
|
|
@@ -10539,7 +10578,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10539
10578
|
const contentHash = Bun.hash(raw).toString(BASE_36_RADIX);
|
|
10540
10579
|
const prevHash = sourceHashCache.get(src);
|
|
10541
10580
|
const persistent = persistentCache.get(src);
|
|
10542
|
-
if (prevHash === contentHash && persistent &&
|
|
10581
|
+
if (prevHash === contentHash && persistent && existsSync15(persistent.ssr) && existsSync15(persistent.client)) {
|
|
10543
10582
|
cache.set(src, persistent);
|
|
10544
10583
|
return persistent;
|
|
10545
10584
|
}
|
|
@@ -10555,9 +10594,9 @@ var resolveDevClientDir2 = () => {
|
|
|
10555
10594
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
10556
10595
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
|
|
10557
10596
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
|
|
10558
|
-
const rawRel =
|
|
10559
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${relative9(process.cwd(),
|
|
10560
|
-
const baseName =
|
|
10597
|
+
const rawRel = dirname11(relative9(svelteRoot, src)).replace(/\\/g, "/");
|
|
10598
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative9(process.cwd(), dirname11(src)).replace(/\\/g, "/")}` : rawRel;
|
|
10599
|
+
const baseName = basename5(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
10561
10600
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
10562
10601
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
10563
10602
|
const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
|
|
@@ -10565,8 +10604,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10565
10604
|
const childBuilt = await Promise.all(childSources.map((child) => build(child)));
|
|
10566
10605
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
10567
10606
|
const externalRewrites = new Map;
|
|
10568
|
-
const ssrOutputDir =
|
|
10569
|
-
const clientOutputDir =
|
|
10607
|
+
const ssrOutputDir = dirname11(join17(serverDir, relDir, `${baseName}.js`));
|
|
10608
|
+
const clientOutputDir = dirname11(join17(clientDir, relDir, `${baseName}.js`));
|
|
10570
10609
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
10571
10610
|
const rawSpec = importPaths[idx];
|
|
10572
10611
|
if (!rawSpec)
|
|
@@ -10601,13 +10640,13 @@ var resolveDevClientDir2 = () => {
|
|
|
10601
10640
|
};
|
|
10602
10641
|
const generate = (mode) => {
|
|
10603
10642
|
const transpiled = mode === "server" ? transpiledServer : transpiledClient;
|
|
10604
|
-
const
|
|
10643
|
+
const compiledJs = isModule ? compileModule(transpiled, {
|
|
10605
10644
|
dev: mode === "client" && dev,
|
|
10606
10645
|
experimental: {
|
|
10607
10646
|
async: transformedByLowering
|
|
10608
10647
|
},
|
|
10609
10648
|
filename: src
|
|
10610
|
-
}).js
|
|
10649
|
+
}).js : compile(transpiled, {
|
|
10611
10650
|
css: "injected",
|
|
10612
10651
|
dev: mode === "client" && dev,
|
|
10613
10652
|
experimental: {
|
|
@@ -10616,8 +10655,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10616
10655
|
filename: src,
|
|
10617
10656
|
generate: mode,
|
|
10618
10657
|
hmr: mode === "client" && isDev
|
|
10619
|
-
}).js
|
|
10620
|
-
let code =
|
|
10658
|
+
}).js;
|
|
10659
|
+
let code = compiledJs.code.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
10621
10660
|
if (mode === "client" && isDev) {
|
|
10622
10661
|
const moduleKey = `/@src/${relative9(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
10623
10662
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
@@ -10629,23 +10668,29 @@ var resolveDevClientDir2 = () => {
|
|
|
10629
10668
|
code = removeUnusedRequireHelper(code);
|
|
10630
10669
|
}
|
|
10631
10670
|
code += islandMetadataExports;
|
|
10632
|
-
return code;
|
|
10671
|
+
return { code, map: compiledJs.map };
|
|
10633
10672
|
};
|
|
10634
|
-
const ssrPath =
|
|
10635
|
-
const clientPath =
|
|
10673
|
+
const ssrPath = join17(serverDir, relDir, `${baseName}.js`);
|
|
10674
|
+
const clientPath = join17(clientDir, relDir, `${baseName}.js`);
|
|
10636
10675
|
await Promise.all([
|
|
10637
|
-
mkdir4(
|
|
10638
|
-
mkdir4(
|
|
10676
|
+
mkdir4(dirname11(ssrPath), { recursive: true }),
|
|
10677
|
+
mkdir4(dirname11(clientPath), { recursive: true })
|
|
10639
10678
|
]);
|
|
10679
|
+
const inlineMap = (map) => map ? `
|
|
10680
|
+
//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
|
|
10681
|
+
` : "";
|
|
10640
10682
|
if (isModule) {
|
|
10641
|
-
const
|
|
10683
|
+
const generated = generate("client");
|
|
10684
|
+
const bundle = rewriteExternalImports(generated.code, "client") + inlineMap(generated.map);
|
|
10642
10685
|
await Promise.all([
|
|
10643
10686
|
write(ssrPath, bundle),
|
|
10644
10687
|
write(clientPath, bundle)
|
|
10645
10688
|
]);
|
|
10646
10689
|
} else {
|
|
10647
|
-
const
|
|
10648
|
-
const
|
|
10690
|
+
const serverGen = generate("server");
|
|
10691
|
+
const clientGen = generate("client");
|
|
10692
|
+
const serverBundle = rewriteExternalImports(serverGen.code, "server") + inlineMap(serverGen.map);
|
|
10693
|
+
const clientBundle = rewriteExternalImports(clientGen.code, "client") + inlineMap(clientGen.map);
|
|
10649
10694
|
await Promise.all([
|
|
10650
10695
|
write(ssrPath, serverBundle),
|
|
10651
10696
|
write(clientPath, clientBundle)
|
|
@@ -10662,10 +10707,10 @@ var resolveDevClientDir2 = () => {
|
|
|
10662
10707
|
};
|
|
10663
10708
|
const roots = await Promise.all(entryPoints.map(build));
|
|
10664
10709
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
10665
|
-
const relClientDir =
|
|
10666
|
-
const name =
|
|
10667
|
-
const indexPath =
|
|
10668
|
-
const importRaw = relative9(
|
|
10710
|
+
const relClientDir = dirname11(relative9(clientDir, client));
|
|
10711
|
+
const name = basename5(client, extname5(client));
|
|
10712
|
+
const indexPath = join17(indexDir, relClientDir, `${name}.js`);
|
|
10713
|
+
const importRaw = relative9(dirname11(indexPath), client).split(sep2).join("/");
|
|
10669
10714
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
10670
10715
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
10671
10716
|
import "${hmrClientPath3}";
|
|
@@ -10736,14 +10781,14 @@ if (typeof window !== "undefined") {
|
|
|
10736
10781
|
setTimeout(releaseStreamingSlots, 0);
|
|
10737
10782
|
}
|
|
10738
10783
|
}`;
|
|
10739
|
-
await mkdir4(
|
|
10784
|
+
await mkdir4(dirname11(indexPath), { recursive: true });
|
|
10740
10785
|
return write(indexPath, bootstrap);
|
|
10741
10786
|
}));
|
|
10742
10787
|
return {
|
|
10743
10788
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
10744
10789
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
10745
|
-
const rel =
|
|
10746
|
-
return
|
|
10790
|
+
const rel = dirname11(relative9(clientDir, client));
|
|
10791
|
+
return join17(indexDir, rel, basename5(client));
|
|
10747
10792
|
}),
|
|
10748
10793
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
10749
10794
|
};
|
|
@@ -10758,12 +10803,338 @@ var init_compileSvelte = __esm(() => {
|
|
|
10758
10803
|
init_lowerAwaitSlotSyntax();
|
|
10759
10804
|
init_renderToReadableStream();
|
|
10760
10805
|
devClientDir2 = resolveDevClientDir2();
|
|
10761
|
-
hmrClientPath3 =
|
|
10806
|
+
hmrClientPath3 = join17(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
10762
10807
|
persistentCache = new Map;
|
|
10763
10808
|
sourceHashCache = new Map;
|
|
10764
10809
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
10765
10810
|
});
|
|
10766
10811
|
|
|
10812
|
+
// src/build/chainInlineSourcemaps.ts
|
|
10813
|
+
var exports_chainInlineSourcemaps = {};
|
|
10814
|
+
__export(exports_chainInlineSourcemaps, {
|
|
10815
|
+
remapGeneratedLines: () => remapGeneratedLines,
|
|
10816
|
+
inlineLineMapComment: () => inlineLineMapComment,
|
|
10817
|
+
chainSourcemap: () => chainSourcemap,
|
|
10818
|
+
chainBundleInlineSourcemap: () => chainBundleInlineSourcemap,
|
|
10819
|
+
buildLineRemap: () => buildLineRemap
|
|
10820
|
+
});
|
|
10821
|
+
import { readFileSync as readFileSync11, writeFileSync as writeFileSync7 } from "fs";
|
|
10822
|
+
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", BASE64_TO_INT, decodeVlq = (str, startPos) => {
|
|
10823
|
+
let result = 0;
|
|
10824
|
+
let shift = 0;
|
|
10825
|
+
let pos = startPos;
|
|
10826
|
+
while (true) {
|
|
10827
|
+
const digit = BASE64_TO_INT[str.charCodeAt(pos++)];
|
|
10828
|
+
if (digit === undefined || digit < 0) {
|
|
10829
|
+
throw new Error(`chainInlineSourcemaps: invalid base64 char at ${pos - 1}`);
|
|
10830
|
+
}
|
|
10831
|
+
result |= (digit & 31) << shift;
|
|
10832
|
+
shift += 5;
|
|
10833
|
+
if (!(digit & 32))
|
|
10834
|
+
break;
|
|
10835
|
+
}
|
|
10836
|
+
const negative = result & 1;
|
|
10837
|
+
const value = result >>> 1;
|
|
10838
|
+
return { pos, value: negative ? -value : value };
|
|
10839
|
+
}, encodeVlq = (value) => {
|
|
10840
|
+
let v2 = value < 0 ? -value << 1 | 1 : value << 1;
|
|
10841
|
+
let result = "";
|
|
10842
|
+
do {
|
|
10843
|
+
let digit = v2 & 31;
|
|
10844
|
+
v2 >>>= 5;
|
|
10845
|
+
if (v2)
|
|
10846
|
+
digit |= 32;
|
|
10847
|
+
result += BASE64_CHARS[digit];
|
|
10848
|
+
} while (v2);
|
|
10849
|
+
return result;
|
|
10850
|
+
}, decodeMappings = (mappings) => {
|
|
10851
|
+
const lines = [];
|
|
10852
|
+
let current = [];
|
|
10853
|
+
let lastGenCol = 0;
|
|
10854
|
+
let lastSourceIdx = 0;
|
|
10855
|
+
let lastSourceLine = 0;
|
|
10856
|
+
let lastSourceCol = 0;
|
|
10857
|
+
let pos = 0;
|
|
10858
|
+
const len = mappings.length;
|
|
10859
|
+
while (pos < len) {
|
|
10860
|
+
const ch = mappings[pos];
|
|
10861
|
+
if (ch === ";") {
|
|
10862
|
+
lines.push(current);
|
|
10863
|
+
current = [];
|
|
10864
|
+
lastGenCol = 0;
|
|
10865
|
+
pos++;
|
|
10866
|
+
continue;
|
|
10867
|
+
}
|
|
10868
|
+
if (ch === ",") {
|
|
10869
|
+
pos++;
|
|
10870
|
+
continue;
|
|
10871
|
+
}
|
|
10872
|
+
const d1 = decodeVlq(mappings, pos);
|
|
10873
|
+
pos = d1.pos;
|
|
10874
|
+
lastGenCol += d1.value;
|
|
10875
|
+
const segment = { genCol: lastGenCol };
|
|
10876
|
+
if (pos < len && mappings[pos] !== "," && mappings[pos] !== ";") {
|
|
10877
|
+
const d2 = decodeVlq(mappings, pos);
|
|
10878
|
+
pos = d2.pos;
|
|
10879
|
+
const d3 = decodeVlq(mappings, pos);
|
|
10880
|
+
pos = d3.pos;
|
|
10881
|
+
const d4 = decodeVlq(mappings, pos);
|
|
10882
|
+
pos = d4.pos;
|
|
10883
|
+
lastSourceIdx += d2.value;
|
|
10884
|
+
lastSourceLine += d3.value;
|
|
10885
|
+
lastSourceCol += d4.value;
|
|
10886
|
+
segment.sourceIdx = lastSourceIdx;
|
|
10887
|
+
segment.sourceLine = lastSourceLine;
|
|
10888
|
+
segment.sourceCol = lastSourceCol;
|
|
10889
|
+
while (pos < len && mappings[pos] !== "," && mappings[pos] !== ";") {
|
|
10890
|
+
pos = decodeVlq(mappings, pos).pos;
|
|
10891
|
+
}
|
|
10892
|
+
}
|
|
10893
|
+
current.push(segment);
|
|
10894
|
+
}
|
|
10895
|
+
lines.push(current);
|
|
10896
|
+
return lines;
|
|
10897
|
+
}, encodeMappings = (lines) => {
|
|
10898
|
+
let lastSourceIdx = 0;
|
|
10899
|
+
let lastSourceLine = 0;
|
|
10900
|
+
let lastSourceCol = 0;
|
|
10901
|
+
const parts = [];
|
|
10902
|
+
for (const line of lines) {
|
|
10903
|
+
let lastGenCol = 0;
|
|
10904
|
+
const segs = [];
|
|
10905
|
+
for (const seg of line) {
|
|
10906
|
+
let s2 = encodeVlq(seg.genCol - lastGenCol);
|
|
10907
|
+
lastGenCol = seg.genCol;
|
|
10908
|
+
if (seg.sourceIdx !== undefined) {
|
|
10909
|
+
s2 += encodeVlq(seg.sourceIdx - lastSourceIdx);
|
|
10910
|
+
s2 += encodeVlq(seg.sourceLine - lastSourceLine);
|
|
10911
|
+
s2 += encodeVlq(seg.sourceCol - lastSourceCol);
|
|
10912
|
+
lastSourceIdx = seg.sourceIdx;
|
|
10913
|
+
lastSourceLine = seg.sourceLine;
|
|
10914
|
+
lastSourceCol = seg.sourceCol;
|
|
10915
|
+
}
|
|
10916
|
+
segs.push(s2);
|
|
10917
|
+
}
|
|
10918
|
+
parts.push(segs.join(","));
|
|
10919
|
+
}
|
|
10920
|
+
return parts.join(";");
|
|
10921
|
+
}, traceInner = (innerLines, targetLine, targetCol) => {
|
|
10922
|
+
if (targetLine < 0 || targetLine >= innerLines.length)
|
|
10923
|
+
return null;
|
|
10924
|
+
const targetLineSegs = innerLines[targetLine];
|
|
10925
|
+
if (!targetLineSegs)
|
|
10926
|
+
return null;
|
|
10927
|
+
for (let i = targetLineSegs.length - 1;i >= 0; i--) {
|
|
10928
|
+
const seg = targetLineSegs[i];
|
|
10929
|
+
if (seg && seg.genCol <= targetCol && seg.sourceIdx !== undefined) {
|
|
10930
|
+
return {
|
|
10931
|
+
col: seg.sourceCol,
|
|
10932
|
+
line: seg.sourceLine,
|
|
10933
|
+
sourceIdx: seg.sourceIdx
|
|
10934
|
+
};
|
|
10935
|
+
}
|
|
10936
|
+
}
|
|
10937
|
+
for (const seg of targetLineSegs) {
|
|
10938
|
+
if (seg.sourceIdx !== undefined) {
|
|
10939
|
+
return {
|
|
10940
|
+
col: seg.sourceCol,
|
|
10941
|
+
line: seg.sourceLine,
|
|
10942
|
+
sourceIdx: seg.sourceIdx
|
|
10943
|
+
};
|
|
10944
|
+
}
|
|
10945
|
+
}
|
|
10946
|
+
for (let li2 = targetLine - 1;li2 >= 0; li2--) {
|
|
10947
|
+
const line = innerLines[li2];
|
|
10948
|
+
if (!line)
|
|
10949
|
+
continue;
|
|
10950
|
+
for (let i = line.length - 1;i >= 0; i--) {
|
|
10951
|
+
const seg = line[i];
|
|
10952
|
+
if (seg && seg.sourceIdx !== undefined) {
|
|
10953
|
+
return {
|
|
10954
|
+
col: seg.sourceCol,
|
|
10955
|
+
line: seg.sourceLine,
|
|
10956
|
+
sourceIdx: seg.sourceIdx
|
|
10957
|
+
};
|
|
10958
|
+
}
|
|
10959
|
+
}
|
|
10960
|
+
}
|
|
10961
|
+
return null;
|
|
10962
|
+
}, SOURCEMAP_INLINE_RE, extractInlineMap = (text) => {
|
|
10963
|
+
const match = text.match(SOURCEMAP_INLINE_RE);
|
|
10964
|
+
if (!match)
|
|
10965
|
+
return null;
|
|
10966
|
+
const encoded = match[1];
|
|
10967
|
+
if (!encoded)
|
|
10968
|
+
return null;
|
|
10969
|
+
try {
|
|
10970
|
+
return JSON.parse(Buffer.from(encoded, "base64").toString("utf-8"));
|
|
10971
|
+
} catch {
|
|
10972
|
+
return null;
|
|
10973
|
+
}
|
|
10974
|
+
}, buildLineRemap = (before, after) => {
|
|
10975
|
+
const bLines = before.split(`
|
|
10976
|
+
`);
|
|
10977
|
+
const aLines = after.split(`
|
|
10978
|
+
`);
|
|
10979
|
+
const norm = (s2) => s2.trim().replace(/["']/g, "`").replace(/;\s*$/, "");
|
|
10980
|
+
const isVueImport = (s2) => /^\s*import\s+.*\bfrom\s+["']vue["']\s*;?\s*$/.test(s2);
|
|
10981
|
+
const mergedVueImportLine = aLines.findIndex(isVueImport);
|
|
10982
|
+
const remap = new Array(bLines.length).fill(-1);
|
|
10983
|
+
let ai2 = 0;
|
|
10984
|
+
for (let bi2 = 0;bi2 < bLines.length; bi2++) {
|
|
10985
|
+
const bLine = bLines[bi2];
|
|
10986
|
+
if (bLine === undefined || bLine.trim() === "")
|
|
10987
|
+
continue;
|
|
10988
|
+
if (isVueImport(bLine)) {
|
|
10989
|
+
remap[bi2] = mergedVueImportLine;
|
|
10990
|
+
continue;
|
|
10991
|
+
}
|
|
10992
|
+
const bNorm = norm(bLine);
|
|
10993
|
+
const horizon = Math.min(aLines.length, ai2 + 30);
|
|
10994
|
+
for (let probe = ai2;probe < horizon; probe++) {
|
|
10995
|
+
const aLine = aLines[probe];
|
|
10996
|
+
if (aLine !== undefined && norm(aLine) === bNorm) {
|
|
10997
|
+
remap[bi2] = probe;
|
|
10998
|
+
ai2 = probe + 1;
|
|
10999
|
+
break;
|
|
11000
|
+
}
|
|
11001
|
+
}
|
|
11002
|
+
}
|
|
11003
|
+
return remap;
|
|
11004
|
+
}, inlineLineMapComment = (sourcePath, sourceContent, generatedContent) => {
|
|
11005
|
+
const remap = buildLineRemap(sourceContent, generatedContent);
|
|
11006
|
+
const generatedLineCount = generatedContent.split(`
|
|
11007
|
+
`).length;
|
|
11008
|
+
const segs = Array.from({ length: generatedLineCount }, () => []);
|
|
11009
|
+
for (let srcLine = 0;srcLine < remap.length; srcLine++) {
|
|
11010
|
+
const genLine = remap[srcLine];
|
|
11011
|
+
if (genLine === undefined || genLine < 0 || genLine >= generatedLineCount)
|
|
11012
|
+
continue;
|
|
11013
|
+
const segLine = segs[genLine];
|
|
11014
|
+
if (!segLine)
|
|
11015
|
+
continue;
|
|
11016
|
+
segLine.push({
|
|
11017
|
+
genCol: 0,
|
|
11018
|
+
sourceCol: 0,
|
|
11019
|
+
sourceIdx: 0,
|
|
11020
|
+
sourceLine: srcLine
|
|
11021
|
+
});
|
|
11022
|
+
}
|
|
11023
|
+
const map = {
|
|
11024
|
+
mappings: encodeMappings(segs),
|
|
11025
|
+
names: [],
|
|
11026
|
+
sources: [sourcePath],
|
|
11027
|
+
sourcesContent: [sourceContent],
|
|
11028
|
+
version: 3
|
|
11029
|
+
};
|
|
11030
|
+
return `
|
|
11031
|
+
//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
|
|
11032
|
+
`;
|
|
11033
|
+
}, remapGeneratedLines = (mappings, lineRemap) => {
|
|
11034
|
+
const decoded = decodeMappings(mappings);
|
|
11035
|
+
const remapped = [];
|
|
11036
|
+
for (let origLine = 0;origLine < decoded.length; origLine++) {
|
|
11037
|
+
const newLine = lineRemap[origLine];
|
|
11038
|
+
if (newLine === undefined || newLine < 0)
|
|
11039
|
+
continue;
|
|
11040
|
+
const origSegs = decoded[origLine];
|
|
11041
|
+
if (!origSegs)
|
|
11042
|
+
continue;
|
|
11043
|
+
while (remapped.length < newLine)
|
|
11044
|
+
remapped.push([]);
|
|
11045
|
+
remapped[newLine] = origSegs;
|
|
11046
|
+
}
|
|
11047
|
+
return encodeMappings(remapped);
|
|
11048
|
+
}, chainSourcemap = (outer, fetchInner) => {
|
|
11049
|
+
const outerSegs = decodeMappings(outer.mappings);
|
|
11050
|
+
const innerMaps = outer.sources.map((s2) => s2 ? fetchInner(s2) : null);
|
|
11051
|
+
const innerDecoded = innerMaps.map((m) => m ? decodeMappings(m.mappings) : null);
|
|
11052
|
+
const newSources = [];
|
|
11053
|
+
const newSourcesContent = [];
|
|
11054
|
+
const addSource = (src, content) => {
|
|
11055
|
+
const existing = newSources.indexOf(src);
|
|
11056
|
+
if (existing >= 0)
|
|
11057
|
+
return existing;
|
|
11058
|
+
newSources.push(src);
|
|
11059
|
+
newSourcesContent.push(content);
|
|
11060
|
+
return newSources.length - 1;
|
|
11061
|
+
};
|
|
11062
|
+
const innerSrcRemap = [];
|
|
11063
|
+
const outerFallbackIdx = [];
|
|
11064
|
+
outer.sources.forEach((src, i) => {
|
|
11065
|
+
const inner = innerMaps[i];
|
|
11066
|
+
if (inner) {
|
|
11067
|
+
innerSrcRemap[i] = inner.sources.map((innerSrc, j2) => innerSrc === null ? -1 : addSource(innerSrc, inner.sourcesContent?.[j2] ?? null));
|
|
11068
|
+
} else {
|
|
11069
|
+
innerSrcRemap[i] = [];
|
|
11070
|
+
}
|
|
11071
|
+
outerFallbackIdx[i] = src === null ? -1 : addSource(src, outer.sourcesContent?.[i] ?? null);
|
|
11072
|
+
});
|
|
11073
|
+
const chained = outerSegs.map((line) => line.map((seg) => {
|
|
11074
|
+
if (seg.sourceIdx === undefined)
|
|
11075
|
+
return { genCol: seg.genCol };
|
|
11076
|
+
const fallbackIdx = outerFallbackIdx[seg.sourceIdx] ?? -1;
|
|
11077
|
+
const innerLines = innerDecoded[seg.sourceIdx];
|
|
11078
|
+
if (innerLines) {
|
|
11079
|
+
const t = traceInner(innerLines, seg.sourceLine, seg.sourceCol);
|
|
11080
|
+
if (t) {
|
|
11081
|
+
const innerRemap = innerSrcRemap[seg.sourceIdx];
|
|
11082
|
+
const remappedIdx = innerRemap?.[t.sourceIdx] ?? -1;
|
|
11083
|
+
return {
|
|
11084
|
+
genCol: seg.genCol,
|
|
11085
|
+
sourceCol: t.col,
|
|
11086
|
+
sourceIdx: remappedIdx,
|
|
11087
|
+
sourceLine: t.line
|
|
11088
|
+
};
|
|
11089
|
+
}
|
|
11090
|
+
return {
|
|
11091
|
+
genCol: seg.genCol,
|
|
11092
|
+
sourceCol: seg.sourceCol,
|
|
11093
|
+
sourceIdx: fallbackIdx,
|
|
11094
|
+
sourceLine: seg.sourceLine
|
|
11095
|
+
};
|
|
11096
|
+
}
|
|
11097
|
+
return {
|
|
11098
|
+
genCol: seg.genCol,
|
|
11099
|
+
sourceCol: seg.sourceCol,
|
|
11100
|
+
sourceIdx: fallbackIdx,
|
|
11101
|
+
sourceLine: seg.sourceLine
|
|
11102
|
+
};
|
|
11103
|
+
}));
|
|
11104
|
+
return {
|
|
11105
|
+
mappings: encodeMappings(chained),
|
|
11106
|
+
names: outer.names,
|
|
11107
|
+
sources: newSources,
|
|
11108
|
+
sourcesContent: newSourcesContent,
|
|
11109
|
+
version: 3
|
|
11110
|
+
};
|
|
11111
|
+
}, chainBundleInlineSourcemap = (bundleFilePath) => {
|
|
11112
|
+
const text = readFileSync11(bundleFilePath, "utf-8");
|
|
11113
|
+
const outerMap = extractInlineMap(text);
|
|
11114
|
+
if (!outerMap)
|
|
11115
|
+
return;
|
|
11116
|
+
const chained = chainSourcemap(outerMap, (src) => {
|
|
11117
|
+
const idx = outerMap.sources.indexOf(src);
|
|
11118
|
+
if (idx < 0)
|
|
11119
|
+
return null;
|
|
11120
|
+
const content = outerMap.sourcesContent?.[idx];
|
|
11121
|
+
if (!content)
|
|
11122
|
+
return null;
|
|
11123
|
+
return extractInlineMap(content);
|
|
11124
|
+
});
|
|
11125
|
+
const stripped = text.replace(SOURCEMAP_INLINE_RE, "");
|
|
11126
|
+
const inline = `
|
|
11127
|
+
//# sourceMappingURL=data:application/json;base64,` + Buffer.from(JSON.stringify(chained)).toString("base64");
|
|
11128
|
+
writeFileSync7(bundleFilePath, stripped + inline);
|
|
11129
|
+
};
|
|
11130
|
+
var init_chainInlineSourcemaps = __esm(() => {
|
|
11131
|
+
BASE64_TO_INT = new Int8Array(128).fill(-1);
|
|
11132
|
+
for (let i = 0;i < BASE64_CHARS.length; i++) {
|
|
11133
|
+
BASE64_TO_INT[BASE64_CHARS.charCodeAt(i)] = i;
|
|
11134
|
+
}
|
|
11135
|
+
SOURCEMAP_INLINE_RE = /\n?\/\/# sourceMappingURL=data:application\/json(?:;[^,]+)?;base64,([A-Za-z0-9+/=]+)\s*$/;
|
|
11136
|
+
});
|
|
11137
|
+
|
|
10767
11138
|
// src/build/vueAutoRouterTransform.ts
|
|
10768
11139
|
var SCRIPT_REGEX, ROUTES_EXPORT_REGEX, SENTINEL = "__ABSOLUTE_AUTO_ROUTER__", SETUP_APP_DECLARATION_REGEX, SETUP_APP_FUNCTION_REGEX, addAutoRouterSetupApp = (sourceContent) => {
|
|
10769
11140
|
if (!ROUTES_EXPORT_REGEX.test(sourceContent))
|
|
@@ -10824,27 +11195,27 @@ __export(exports_compileVue, {
|
|
|
10824
11195
|
compileVue: () => compileVue,
|
|
10825
11196
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
10826
11197
|
});
|
|
10827
|
-
import { existsSync as
|
|
11198
|
+
import { existsSync as existsSync16 } from "fs";
|
|
10828
11199
|
import { mkdir as mkdir5 } from "fs/promises";
|
|
10829
11200
|
import {
|
|
10830
|
-
basename as
|
|
10831
|
-
dirname as
|
|
11201
|
+
basename as basename6,
|
|
11202
|
+
dirname as dirname12,
|
|
10832
11203
|
isAbsolute as isAbsolute3,
|
|
10833
|
-
join as
|
|
11204
|
+
join as join18,
|
|
10834
11205
|
relative as relative10,
|
|
10835
|
-
resolve as
|
|
11206
|
+
resolve as resolve20
|
|
10836
11207
|
} from "path";
|
|
10837
11208
|
var {file: file2, write: write2, Transpiler: Transpiler3 } = globalThis.Bun;
|
|
10838
11209
|
var resolveDevClientDir3 = () => {
|
|
10839
11210
|
const projectRoot = process.cwd();
|
|
10840
|
-
const fromSource =
|
|
10841
|
-
if (
|
|
11211
|
+
const fromSource = resolve20(import.meta.dir, "../dev/client");
|
|
11212
|
+
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10842
11213
|
return fromSource;
|
|
10843
11214
|
}
|
|
10844
|
-
const fromNodeModules =
|
|
10845
|
-
if (
|
|
11215
|
+
const fromNodeModules = resolve20(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
11216
|
+
if (existsSync16(fromNodeModules))
|
|
10846
11217
|
return fromNodeModules;
|
|
10847
|
-
return
|
|
11218
|
+
return resolve20(import.meta.dir, "./dev/client");
|
|
10848
11219
|
}, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
10849
11220
|
scriptCache.clear();
|
|
10850
11221
|
scriptSetupCache.clear();
|
|
@@ -10890,7 +11261,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10890
11261
|
return filePath.replace(/\.ts$/, ".js");
|
|
10891
11262
|
if (isStylePath(filePath)) {
|
|
10892
11263
|
if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
|
|
10893
|
-
return
|
|
11264
|
+
return resolve20(sourceDir, filePath);
|
|
10894
11265
|
}
|
|
10895
11266
|
return filePath;
|
|
10896
11267
|
}
|
|
@@ -10918,7 +11289,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10918
11289
|
return cachedResult;
|
|
10919
11290
|
const relativeFilePath = relative10(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
10920
11291
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
10921
|
-
const fileBaseName =
|
|
11292
|
+
const fileBaseName = basename6(sourceFilePath, ".vue");
|
|
10922
11293
|
const componentId = toKebab(fileBaseName);
|
|
10923
11294
|
const rawSourceContent = await file2(sourceFilePath).text();
|
|
10924
11295
|
const sourceContent = isEntryPoint ? addAutoRouterSetupApp(rawSourceContent) : rawSourceContent;
|
|
@@ -10926,7 +11297,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10926
11297
|
const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
|
|
10927
11298
|
const prevHash = vueSourceHashCache.get(sourceFilePath);
|
|
10928
11299
|
const persistent = persistentBuildCache.get(sourceFilePath);
|
|
10929
|
-
if (prevHash === contentHash && persistent &&
|
|
11300
|
+
if (prevHash === contentHash && persistent && existsSync16(persistent.clientPath) && existsSync16(persistent.serverPath)) {
|
|
10930
11301
|
cacheMap.set(sourceFilePath, persistent);
|
|
10931
11302
|
return persistent;
|
|
10932
11303
|
}
|
|
@@ -10954,21 +11325,22 @@ var resolveDevClientDir3 = () => {
|
|
|
10954
11325
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
10955
11326
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
10956
11327
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
10957
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path :
|
|
11328
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path : resolve20(dirname12(sourceFilePath), path));
|
|
10958
11329
|
for (const stylePath of stylePathsImported) {
|
|
10959
11330
|
addStyleImporter(sourceFilePath, stylePath);
|
|
10960
11331
|
}
|
|
10961
11332
|
const childBuildResults = await Promise.all([
|
|
10962
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
11333
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve20(dirname12(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
10963
11334
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
10964
11335
|
]);
|
|
10965
11336
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
10966
11337
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
10967
11338
|
id: componentId,
|
|
10968
|
-
inlineTemplate: false
|
|
10969
|
-
|
|
11339
|
+
inlineTemplate: false,
|
|
11340
|
+
sourceMap: true
|
|
11341
|
+
}) : { bindings: {}, content: "export default {};", map: undefined };
|
|
10970
11342
|
const strippedScript = stripExports2(compiledScript.content);
|
|
10971
|
-
const sourceDir =
|
|
11343
|
+
const sourceDir = dirname12(sourceFilePath);
|
|
10972
11344
|
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
|
|
10973
11345
|
const packageImportRewrites = new Map;
|
|
10974
11346
|
for (const [bareImport, absolutePath] of packageComponentPaths) {
|
|
@@ -11007,8 +11379,8 @@ var resolveDevClientDir3 = () => {
|
|
|
11007
11379
|
];
|
|
11008
11380
|
let cssOutputPaths = [];
|
|
11009
11381
|
if (isEntryPoint && allCss.length) {
|
|
11010
|
-
const cssOutputFile =
|
|
11011
|
-
await mkdir5(
|
|
11382
|
+
const cssOutputFile = join18(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
11383
|
+
await mkdir5(dirname12(cssOutputFile), { recursive: true });
|
|
11012
11384
|
await write2(cssOutputFile, allCss.join(`
|
|
11013
11385
|
`));
|
|
11014
11386
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -11038,9 +11410,9 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11038
11410
|
};
|
|
11039
11411
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
11040
11412
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
11041
|
-
const clientOutputPath =
|
|
11042
|
-
const serverOutputPath =
|
|
11043
|
-
const relDir =
|
|
11413
|
+
const clientOutputPath = join18(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
11414
|
+
const serverOutputPath = join18(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
11415
|
+
const relDir = dirname12(relativeFilePath);
|
|
11044
11416
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
11045
11417
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_2, prefix, dots) => {
|
|
11046
11418
|
const upCount = dots.split("/").length - 1;
|
|
@@ -11052,17 +11424,29 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11052
11424
|
let result2 = code;
|
|
11053
11425
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
11054
11426
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
11055
|
-
let rel = relative10(
|
|
11427
|
+
let rel = relative10(dirname12(outputPath), targetPath).replace(/\\/g, "/");
|
|
11056
11428
|
if (!rel.startsWith("."))
|
|
11057
11429
|
rel = `./${rel}`;
|
|
11058
11430
|
result2 = result2.replaceAll(bareImport, rel);
|
|
11059
11431
|
}
|
|
11060
11432
|
return result2;
|
|
11061
11433
|
};
|
|
11062
|
-
await mkdir5(
|
|
11063
|
-
await mkdir5(
|
|
11064
|
-
|
|
11065
|
-
|
|
11434
|
+
await mkdir5(dirname12(clientOutputPath), { recursive: true });
|
|
11435
|
+
await mkdir5(dirname12(serverOutputPath), { recursive: true });
|
|
11436
|
+
const clientFinal = rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client");
|
|
11437
|
+
const serverFinal = rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server");
|
|
11438
|
+
const inlineSourceMapFor = (finalContent) => {
|
|
11439
|
+
if (!compiledScript.map || !hasScript)
|
|
11440
|
+
return "";
|
|
11441
|
+
const remap = buildLineRemap(strippedScript, finalContent);
|
|
11442
|
+
const mappings = remapGeneratedLines(compiledScript.map.mappings, remap);
|
|
11443
|
+
const map = { ...compiledScript.map, mappings };
|
|
11444
|
+
return `
|
|
11445
|
+
//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
|
|
11446
|
+
`;
|
|
11447
|
+
};
|
|
11448
|
+
await write2(clientOutputPath, clientFinal + inlineSourceMapFor(clientFinal));
|
|
11449
|
+
await write2(serverOutputPath, serverFinal + inlineSourceMapFor(serverFinal));
|
|
11066
11450
|
const result = {
|
|
11067
11451
|
clientPath: clientOutputPath,
|
|
11068
11452
|
cssCodes: allCss,
|
|
@@ -11070,7 +11454,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11070
11454
|
hmrId,
|
|
11071
11455
|
serverPath: serverOutputPath,
|
|
11072
11456
|
tsHelperPaths: [
|
|
11073
|
-
...helperModulePaths.map((helper) =>
|
|
11457
|
+
...helperModulePaths.map((helper) => resolve20(dirname12(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
11074
11458
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
11075
11459
|
]
|
|
11076
11460
|
};
|
|
@@ -11080,10 +11464,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11080
11464
|
}, compileVue = async (entryPoints, vueRootDir, isDev = false, stylePreprocessors) => {
|
|
11081
11465
|
const compiler = await import("@vue/compiler-sfc");
|
|
11082
11466
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
11083
|
-
const clientOutputDir =
|
|
11084
|
-
const indexOutputDir =
|
|
11085
|
-
const serverOutputDir =
|
|
11086
|
-
const cssOutputDir =
|
|
11467
|
+
const clientOutputDir = join18(generatedDir, "client");
|
|
11468
|
+
const indexOutputDir = join18(generatedDir, "indexes");
|
|
11469
|
+
const serverOutputDir = join18(generatedDir, "server");
|
|
11470
|
+
const cssOutputDir = join18(generatedDir, "compiled");
|
|
11087
11471
|
await Promise.all([
|
|
11088
11472
|
mkdir5(clientOutputDir, { recursive: true }),
|
|
11089
11473
|
mkdir5(indexOutputDir, { recursive: true }),
|
|
@@ -11093,23 +11477,23 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11093
11477
|
const buildCache = new Map;
|
|
11094
11478
|
const allTsHelperPaths = new Set;
|
|
11095
11479
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
11096
|
-
const result = await compileVueFile(
|
|
11480
|
+
const result = await compileVueFile(resolve20(entryPath), {
|
|
11097
11481
|
client: clientOutputDir,
|
|
11098
11482
|
css: cssOutputDir,
|
|
11099
11483
|
server: serverOutputDir
|
|
11100
11484
|
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
11101
11485
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
11102
|
-
const entryBaseName =
|
|
11103
|
-
const indexOutputFile =
|
|
11104
|
-
const clientOutputFile =
|
|
11105
|
-
await mkdir5(
|
|
11486
|
+
const entryBaseName = basename6(entryPath, ".vue");
|
|
11487
|
+
const indexOutputFile = join18(indexOutputDir, `${entryBaseName}.js`);
|
|
11488
|
+
const clientOutputFile = join18(clientOutputDir, relative10(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
11489
|
+
await mkdir5(dirname12(indexOutputFile), { recursive: true });
|
|
11106
11490
|
const vueHmrImports = isDev ? [
|
|
11107
11491
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
11108
11492
|
`import "${hmrClientPath4}";`
|
|
11109
11493
|
] : [];
|
|
11110
11494
|
await write2(indexOutputFile, [
|
|
11111
11495
|
...vueHmrImports,
|
|
11112
|
-
`import Comp, * as PageModule from "${relative10(
|
|
11496
|
+
`import Comp, * as PageModule from "${relative10(dirname12(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
11113
11497
|
'import { createSSRApp, createApp } from "vue";',
|
|
11114
11498
|
"",
|
|
11115
11499
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -11254,10 +11638,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
11254
11638
|
const sourceCode = await file2(tsPath).text();
|
|
11255
11639
|
const transpiledCode = transpiler4.transformSync(sourceCode);
|
|
11256
11640
|
const relativeJsPath = relative10(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
11257
|
-
const outClientPath =
|
|
11258
|
-
const outServerPath =
|
|
11259
|
-
await mkdir5(
|
|
11260
|
-
await mkdir5(
|
|
11641
|
+
const outClientPath = join18(clientOutputDir, relativeJsPath);
|
|
11642
|
+
const outServerPath = join18(serverOutputDir, relativeJsPath);
|
|
11643
|
+
await mkdir5(dirname12(outClientPath), { recursive: true });
|
|
11644
|
+
await mkdir5(dirname12(outServerPath), { recursive: true });
|
|
11261
11645
|
await write2(outClientPath, transpiledCode);
|
|
11262
11646
|
await write2(outServerPath, transpiledCode);
|
|
11263
11647
|
}));
|
|
@@ -11274,10 +11658,11 @@ var init_compileVue = __esm(() => {
|
|
|
11274
11658
|
init_generatedDir();
|
|
11275
11659
|
init_resolvePackageImport();
|
|
11276
11660
|
init_sourceMetadata();
|
|
11661
|
+
init_chainInlineSourcemaps();
|
|
11277
11662
|
init_vueAutoRouterTransform();
|
|
11278
11663
|
init_stylePreprocessor();
|
|
11279
11664
|
devClientDir3 = resolveDevClientDir3();
|
|
11280
|
-
hmrClientPath4 =
|
|
11665
|
+
hmrClientPath4 = join18(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
11281
11666
|
transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
|
|
11282
11667
|
scriptCache = new Map;
|
|
11283
11668
|
scriptSetupCache = new Map;
|
|
@@ -11758,8 +12143,8 @@ __export(exports_compileAngular, {
|
|
|
11758
12143
|
compileAngularFile: () => compileAngularFile,
|
|
11759
12144
|
compileAngular: () => compileAngular
|
|
11760
12145
|
});
|
|
11761
|
-
import { existsSync as
|
|
11762
|
-
import { join as
|
|
12146
|
+
import { existsSync as existsSync17, readFileSync as readFileSync12, promises as fs } from "fs";
|
|
12147
|
+
import { join as join19, basename as basename7, sep as sep3, dirname as dirname13, resolve as resolve21, relative as relative11 } from "path";
|
|
11763
12148
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
11764
12149
|
import ts2 from "typescript";
|
|
11765
12150
|
var traceAngularPhase = async (name, fn2, metadata) => {
|
|
@@ -11767,10 +12152,10 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11767
12152
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata) : await fn2();
|
|
11768
12153
|
}, readTsconfigPathAliases = () => {
|
|
11769
12154
|
try {
|
|
11770
|
-
const configPath2 =
|
|
12155
|
+
const configPath2 = resolve21(process.cwd(), "tsconfig.json");
|
|
11771
12156
|
const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
|
|
11772
12157
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
11773
|
-
const baseUrl =
|
|
12158
|
+
const baseUrl = resolve21(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
11774
12159
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
11775
12160
|
return { aliases, baseUrl };
|
|
11776
12161
|
} catch {
|
|
@@ -11790,7 +12175,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11790
12175
|
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
11791
12176
|
for (const replacement of alias.replacements) {
|
|
11792
12177
|
const candidate = replacement.replace("*", wildcardValue);
|
|
11793
|
-
const resolved = resolveSourceFile(
|
|
12178
|
+
const resolved = resolveSourceFile(resolve21(baseUrl, candidate));
|
|
11794
12179
|
if (resolved)
|
|
11795
12180
|
return resolved;
|
|
11796
12181
|
}
|
|
@@ -11802,20 +12187,20 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11802
12187
|
`${candidate}.tsx`,
|
|
11803
12188
|
`${candidate}.js`,
|
|
11804
12189
|
`${candidate}.jsx`,
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
12190
|
+
join19(candidate, "index.ts"),
|
|
12191
|
+
join19(candidate, "index.tsx"),
|
|
12192
|
+
join19(candidate, "index.js"),
|
|
12193
|
+
join19(candidate, "index.jsx")
|
|
11809
12194
|
];
|
|
11810
|
-
return candidates.find((file3) =>
|
|
12195
|
+
return candidates.find((file3) => existsSync17(file3));
|
|
11811
12196
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
11812
|
-
const baseDir =
|
|
12197
|
+
const baseDir = resolve21(rootDir);
|
|
11813
12198
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
11814
12199
|
const transpiler5 = new Bun.Transpiler({ loader: "tsx" });
|
|
11815
12200
|
const scanCache = new Map;
|
|
11816
12201
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
11817
12202
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
11818
|
-
return resolveSourceFile(
|
|
12203
|
+
return resolveSourceFile(resolve21(fromDir, specifier));
|
|
11819
12204
|
}
|
|
11820
12205
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
11821
12206
|
if (aliased)
|
|
@@ -11824,7 +12209,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11824
12209
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
11825
12210
|
if (resolved.includes("/node_modules/"))
|
|
11826
12211
|
return;
|
|
11827
|
-
const absolute =
|
|
12212
|
+
const absolute = resolve21(resolved);
|
|
11828
12213
|
if (!absolute.startsWith(baseDir))
|
|
11829
12214
|
return;
|
|
11830
12215
|
return resolveSourceFile(absolute);
|
|
@@ -11840,7 +12225,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11840
12225
|
usesLegacyAnimations: false
|
|
11841
12226
|
});
|
|
11842
12227
|
}
|
|
11843
|
-
const resolved =
|
|
12228
|
+
const resolved = resolve21(actualPath);
|
|
11844
12229
|
const cached = scanCache.get(resolved);
|
|
11845
12230
|
if (cached)
|
|
11846
12231
|
return cached;
|
|
@@ -11869,7 +12254,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11869
12254
|
const actualPath = resolveSourceFile(filePath);
|
|
11870
12255
|
if (!actualPath)
|
|
11871
12256
|
return false;
|
|
11872
|
-
const resolved =
|
|
12257
|
+
const resolved = resolve21(actualPath);
|
|
11873
12258
|
if (visited.has(resolved))
|
|
11874
12259
|
return false;
|
|
11875
12260
|
visited.add(resolved);
|
|
@@ -11877,7 +12262,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11877
12262
|
if (scan.usesLegacyAnimations)
|
|
11878
12263
|
return true;
|
|
11879
12264
|
for (const specifier of scan.imports) {
|
|
11880
|
-
const importedPath = resolveLocalImport(specifier,
|
|
12265
|
+
const importedPath = resolveLocalImport(specifier, dirname13(resolved));
|
|
11881
12266
|
if (importedPath && await visit(importedPath, visited)) {
|
|
11882
12267
|
return true;
|
|
11883
12268
|
}
|
|
@@ -11887,14 +12272,14 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11887
12272
|
return (entryPath) => visit(entryPath);
|
|
11888
12273
|
}, resolveDevClientDir4 = () => {
|
|
11889
12274
|
const projectRoot = process.cwd();
|
|
11890
|
-
const fromSource =
|
|
11891
|
-
if (
|
|
12275
|
+
const fromSource = resolve21(import.meta.dir, "../dev/client");
|
|
12276
|
+
if (existsSync17(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
11892
12277
|
return fromSource;
|
|
11893
12278
|
}
|
|
11894
|
-
const fromNodeModules =
|
|
11895
|
-
if (
|
|
12279
|
+
const fromNodeModules = resolve21(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
12280
|
+
if (existsSync17(fromNodeModules))
|
|
11896
12281
|
return fromNodeModules;
|
|
11897
|
-
return
|
|
12282
|
+
return resolve21(import.meta.dir, "./dev/client");
|
|
11898
12283
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
11899
12284
|
try {
|
|
11900
12285
|
return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
@@ -11936,13 +12321,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11936
12321
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
11937
12322
|
if (hasJsLikeExtension(path))
|
|
11938
12323
|
return `${path}${query}`;
|
|
11939
|
-
const importerDir =
|
|
11940
|
-
const fileCandidate =
|
|
11941
|
-
if (outputFiles?.has(fileCandidate) ||
|
|
12324
|
+
const importerDir = dirname13(importerOutputPath);
|
|
12325
|
+
const fileCandidate = resolve21(importerDir, `${path}.js`);
|
|
12326
|
+
if (outputFiles?.has(fileCandidate) || existsSync17(fileCandidate)) {
|
|
11942
12327
|
return `${path}.js${query}`;
|
|
11943
12328
|
}
|
|
11944
|
-
const indexCandidate =
|
|
11945
|
-
if (outputFiles?.has(indexCandidate) ||
|
|
12329
|
+
const indexCandidate = resolve21(importerDir, path, "index.js");
|
|
12330
|
+
if (outputFiles?.has(indexCandidate) || existsSync17(indexCandidate)) {
|
|
11946
12331
|
return `${path}/index.js${query}`;
|
|
11947
12332
|
}
|
|
11948
12333
|
return `${path}.js${query}`;
|
|
@@ -11969,18 +12354,18 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11969
12354
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
11970
12355
|
if (!isRelativeModuleSpecifier(specifier))
|
|
11971
12356
|
return null;
|
|
11972
|
-
const basePath =
|
|
12357
|
+
const basePath = resolve21(dirname13(fromFile), specifier);
|
|
11973
12358
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
11974
12359
|
`${basePath}.ts`,
|
|
11975
12360
|
`${basePath}.tsx`,
|
|
11976
12361
|
`${basePath}.mts`,
|
|
11977
12362
|
`${basePath}.cts`,
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
|
|
11981
|
-
|
|
12363
|
+
join19(basePath, "index.ts"),
|
|
12364
|
+
join19(basePath, "index.tsx"),
|
|
12365
|
+
join19(basePath, "index.mts"),
|
|
12366
|
+
join19(basePath, "index.cts")
|
|
11982
12367
|
];
|
|
11983
|
-
return candidates.map((candidate) =>
|
|
12368
|
+
return candidates.map((candidate) => resolve21(candidate)).find((candidate) => existsSync17(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
11984
12369
|
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
11985
12370
|
const hostSource = readFile6?.(fileName);
|
|
11986
12371
|
if (typeof hostSource === "string")
|
|
@@ -12004,18 +12389,18 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12004
12389
|
const paths = [];
|
|
12005
12390
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12006
12391
|
if (templateUrlMatch?.[1])
|
|
12007
|
-
paths.push(
|
|
12392
|
+
paths.push(join19(fileDir, templateUrlMatch[1]));
|
|
12008
12393
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12009
12394
|
if (styleUrlMatch?.[1])
|
|
12010
|
-
paths.push(
|
|
12395
|
+
paths.push(join19(fileDir, styleUrlMatch[1]));
|
|
12011
12396
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
12012
12397
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
12013
12398
|
if (urlMatches) {
|
|
12014
12399
|
for (const urlMatch of urlMatches) {
|
|
12015
|
-
paths.push(
|
|
12400
|
+
paths.push(join19(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
12016
12401
|
}
|
|
12017
12402
|
}
|
|
12018
|
-
return paths.map((path) =>
|
|
12403
|
+
return paths.map((path) => resolve21(path));
|
|
12019
12404
|
}, readResourceCacheFile = async (cachePath) => {
|
|
12020
12405
|
try {
|
|
12021
12406
|
const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
|
|
@@ -12027,13 +12412,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12027
12412
|
return null;
|
|
12028
12413
|
}
|
|
12029
12414
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
12030
|
-
await fs.mkdir(
|
|
12415
|
+
await fs.mkdir(dirname13(cachePath), { recursive: true });
|
|
12031
12416
|
await fs.writeFile(cachePath, JSON.stringify({
|
|
12032
12417
|
source,
|
|
12033
12418
|
version: 1
|
|
12034
12419
|
}), "utf-8");
|
|
12035
12420
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
12036
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
12421
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname13(filePath));
|
|
12037
12422
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
12038
12423
|
const content = await fs.readFile(resourcePath, "utf-8");
|
|
12039
12424
|
return `${resourcePath}\x00${content}`;
|
|
@@ -12046,7 +12431,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12046
12431
|
safeStableStringify(stylePreprocessors ?? null)
|
|
12047
12432
|
].join("\x00");
|
|
12048
12433
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
12049
|
-
return
|
|
12434
|
+
return join19(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
12050
12435
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
12051
12436
|
const transformedSources = new Map;
|
|
12052
12437
|
const visited = new Set;
|
|
@@ -12057,11 +12442,11 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12057
12442
|
transformedFiles: 0
|
|
12058
12443
|
};
|
|
12059
12444
|
const transformFile = async (filePath) => {
|
|
12060
|
-
const resolvedPath =
|
|
12445
|
+
const resolvedPath = resolve21(filePath);
|
|
12061
12446
|
if (visited.has(resolvedPath))
|
|
12062
12447
|
return;
|
|
12063
12448
|
visited.add(resolvedPath);
|
|
12064
|
-
if (!
|
|
12449
|
+
if (!existsSync17(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
12065
12450
|
return;
|
|
12066
12451
|
stats.filesVisited += 1;
|
|
12067
12452
|
const source = await readFileForAotTransform(resolvedPath, readFile6);
|
|
@@ -12073,7 +12458,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12073
12458
|
transformedSource = cached.source;
|
|
12074
12459
|
} else {
|
|
12075
12460
|
stats.cacheMisses += 1;
|
|
12076
|
-
const transformed = await inlineResources(source,
|
|
12461
|
+
const transformed = await inlineResources(source, dirname13(resolvedPath), stylePreprocessors);
|
|
12077
12462
|
transformedSource = transformed.source;
|
|
12078
12463
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
12079
12464
|
}
|
|
@@ -12092,18 +12477,18 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12092
12477
|
return { stats, transformedSources };
|
|
12093
12478
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
12094
12479
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
12095
|
-
const outputPath =
|
|
12480
|
+
const outputPath = resolve21(join19(outDir, relative11(process.cwd(), resolve21(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
12096
12481
|
return [
|
|
12097
12482
|
outputPath,
|
|
12098
|
-
buildIslandMetadataExports(
|
|
12483
|
+
buildIslandMetadataExports(readFileSync12(inputPath, "utf-8"))
|
|
12099
12484
|
];
|
|
12100
12485
|
})), { entries: inputPaths.length });
|
|
12101
12486
|
await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
|
|
12102
12487
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
12103
12488
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
12104
12489
|
const tsPath = __require.resolve("typescript");
|
|
12105
|
-
const tsRootDir =
|
|
12106
|
-
return tsRootDir.endsWith("lib") ? tsRootDir :
|
|
12490
|
+
const tsRootDir = dirname13(tsPath);
|
|
12491
|
+
return tsRootDir.endsWith("lib") ? tsRootDir : resolve21(tsRootDir, "lib");
|
|
12107
12492
|
});
|
|
12108
12493
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
12109
12494
|
const options = {
|
|
@@ -12134,18 +12519,18 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12134
12519
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
12135
12520
|
host.getDefaultLibFileName = (opts) => {
|
|
12136
12521
|
const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
|
|
12137
|
-
return
|
|
12522
|
+
return basename7(fileName);
|
|
12138
12523
|
};
|
|
12139
12524
|
const originalGetSourceFile = host.getSourceFile;
|
|
12140
12525
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
12141
12526
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
12142
|
-
const resolvedPath =
|
|
12527
|
+
const resolvedPath = join19(tsLibDir, fileName);
|
|
12143
12528
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
12144
12529
|
}
|
|
12145
12530
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
12146
12531
|
};
|
|
12147
12532
|
const emitted = {};
|
|
12148
|
-
const resolvedOutDir =
|
|
12533
|
+
const resolvedOutDir = resolve21(outDir);
|
|
12149
12534
|
host.writeFile = (fileName, text) => {
|
|
12150
12535
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
12151
12536
|
emitted[relativePath] = text;
|
|
@@ -12167,12 +12552,12 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12167
12552
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
12168
12553
|
return source;
|
|
12169
12554
|
}
|
|
12170
|
-
const resolvedPath =
|
|
12555
|
+
const resolvedPath = resolve21(fileName);
|
|
12171
12556
|
return transformedSources.get(resolvedPath) ?? source;
|
|
12172
12557
|
};
|
|
12173
12558
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
12174
12559
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
12175
|
-
const source = transformedSources.get(
|
|
12560
|
+
const source = transformedSources.get(resolve21(fileName));
|
|
12176
12561
|
if (source) {
|
|
12177
12562
|
return ts2.createSourceFile(fileName, source, languageVersion, true);
|
|
12178
12563
|
}
|
|
@@ -12194,9 +12579,9 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12194
12579
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
12195
12580
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
12196
12581
|
content,
|
|
12197
|
-
target:
|
|
12582
|
+
target: join19(outDir, fileName)
|
|
12198
12583
|
}));
|
|
12199
|
-
const outputFiles = new Set(rawEntries.map(({ target }) =>
|
|
12584
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve21(target)));
|
|
12200
12585
|
return rawEntries.map(({ content, target }) => {
|
|
12201
12586
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
12202
12587
|
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
@@ -12211,17 +12596,17 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12211
12596
|
return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
|
|
12212
12597
|
});
|
|
12213
12598
|
processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
|
|
12214
|
-
processedContent += islandMetadataByOutputPath.get(
|
|
12599
|
+
processedContent += islandMetadataByOutputPath.get(resolve21(target)) ?? "";
|
|
12215
12600
|
return { content: processedContent, target };
|
|
12216
12601
|
});
|
|
12217
12602
|
});
|
|
12218
12603
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
12219
|
-
await fs.mkdir(
|
|
12604
|
+
await fs.mkdir(dirname13(target), { recursive: true });
|
|
12220
12605
|
await fs.writeFile(target, content, "utf-8");
|
|
12221
12606
|
})), { outputs: entries.length });
|
|
12222
12607
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
12223
12608
|
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => compileAngularFiles([inputPath], outDir, stylePreprocessors), jitContentCache, invalidateAngularJitCache = (filePath) => {
|
|
12224
|
-
jitContentCache.delete(
|
|
12609
|
+
jitContentCache.delete(resolve21(filePath));
|
|
12225
12610
|
}, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
|
|
12226
12611
|
const re2 = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
|
|
12227
12612
|
let match;
|
|
@@ -12234,8 +12619,8 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
12234
12619
|
}
|
|
12235
12620
|
return null;
|
|
12236
12621
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
12237
|
-
const sourceEntry =
|
|
12238
|
-
if (
|
|
12622
|
+
const sourceEntry = resolve21(import.meta.dir, "../angular/components/index.ts");
|
|
12623
|
+
if (existsSync17(sourceEntry)) {
|
|
12239
12624
|
return sourceEntry.replace(/\\/g, "/");
|
|
12240
12625
|
}
|
|
12241
12626
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -12363,7 +12748,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
12363
12748
|
${fields}
|
|
12364
12749
|
`);
|
|
12365
12750
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
12366
|
-
if (!
|
|
12751
|
+
if (!existsSync17(filePath)) {
|
|
12367
12752
|
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
12368
12753
|
}
|
|
12369
12754
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
@@ -12371,8 +12756,8 @@ ${fields}
|
|
|
12371
12756
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
12372
12757
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12373
12758
|
if (templateUrlMatch?.[1]) {
|
|
12374
|
-
const templatePath =
|
|
12375
|
-
if (!
|
|
12759
|
+
const templatePath = join19(fileDir, templateUrlMatch[1]);
|
|
12760
|
+
if (!existsSync17(templatePath)) {
|
|
12376
12761
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
12377
12762
|
}
|
|
12378
12763
|
const templateRaw2 = await fs.readFile(templatePath, "utf-8");
|
|
@@ -12402,11 +12787,11 @@ ${fields}
|
|
|
12402
12787
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
12403
12788
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12404
12789
|
if (templateUrlMatch?.[1]) {
|
|
12405
|
-
const templatePath =
|
|
12406
|
-
if (!
|
|
12790
|
+
const templatePath = join19(fileDir, templateUrlMatch[1]);
|
|
12791
|
+
if (!existsSync17(templatePath)) {
|
|
12407
12792
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
12408
12793
|
}
|
|
12409
|
-
const templateRaw2 =
|
|
12794
|
+
const templateRaw2 = readFileSync12(templatePath, "utf-8");
|
|
12410
12795
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
12411
12796
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
12412
12797
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -12439,7 +12824,7 @@ ${fields}
|
|
|
12439
12824
|
return source;
|
|
12440
12825
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
12441
12826
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
12442
|
-
return readAndEscapeFile(
|
|
12827
|
+
return readAndEscapeFile(join19(fileDir, styleUrl), stylePreprocessors);
|
|
12443
12828
|
});
|
|
12444
12829
|
const results = await Promise.all(stylePromises);
|
|
12445
12830
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -12450,7 +12835,7 @@ ${fields}
|
|
|
12450
12835
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
12451
12836
|
if (!styleUrlMatch?.[1])
|
|
12452
12837
|
return source;
|
|
12453
|
-
const escaped = await readAndEscapeFile(
|
|
12838
|
+
const escaped = await readAndEscapeFile(join19(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
12454
12839
|
if (!escaped)
|
|
12455
12840
|
return source;
|
|
12456
12841
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -12464,10 +12849,10 @@ ${fields}
|
|
|
12464
12849
|
source: result
|
|
12465
12850
|
};
|
|
12466
12851
|
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
|
|
12467
|
-
const entryPath =
|
|
12852
|
+
const entryPath = resolve21(inputPath);
|
|
12468
12853
|
const allOutputs = [];
|
|
12469
12854
|
const visited = new Set;
|
|
12470
|
-
const baseDir =
|
|
12855
|
+
const baseDir = resolve21(rootDir ?? process.cwd());
|
|
12471
12856
|
let usesLegacyAnimations = false;
|
|
12472
12857
|
const angularTranspiler = new Bun.Transpiler({
|
|
12473
12858
|
loader: "ts",
|
|
@@ -12486,16 +12871,16 @@ ${fields}
|
|
|
12486
12871
|
`${candidate}.js`,
|
|
12487
12872
|
`${candidate}.jsx`,
|
|
12488
12873
|
`${candidate}.json`,
|
|
12489
|
-
|
|
12490
|
-
|
|
12491
|
-
|
|
12492
|
-
|
|
12874
|
+
join19(candidate, "index.ts"),
|
|
12875
|
+
join19(candidate, "index.tsx"),
|
|
12876
|
+
join19(candidate, "index.js"),
|
|
12877
|
+
join19(candidate, "index.jsx")
|
|
12493
12878
|
];
|
|
12494
|
-
return candidates.find((file3) =>
|
|
12879
|
+
return candidates.find((file3) => existsSync17(file3));
|
|
12495
12880
|
};
|
|
12496
12881
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
12497
12882
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
12498
|
-
return resolveSourceFile2(
|
|
12883
|
+
return resolveSourceFile2(resolve21(fromDir, specifier));
|
|
12499
12884
|
}
|
|
12500
12885
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
|
|
12501
12886
|
if (aliased)
|
|
@@ -12504,7 +12889,7 @@ ${fields}
|
|
|
12504
12889
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
12505
12890
|
if (resolved.includes("/node_modules/"))
|
|
12506
12891
|
return;
|
|
12507
|
-
const absolute =
|
|
12892
|
+
const absolute = resolve21(resolved);
|
|
12508
12893
|
if (!absolute.startsWith(baseDir))
|
|
12509
12894
|
return;
|
|
12510
12895
|
return resolveSourceFile2(absolute);
|
|
@@ -12513,10 +12898,10 @@ ${fields}
|
|
|
12513
12898
|
}
|
|
12514
12899
|
};
|
|
12515
12900
|
const toOutputPath = (sourcePath) => {
|
|
12516
|
-
const inputDir =
|
|
12901
|
+
const inputDir = dirname13(sourcePath);
|
|
12517
12902
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
12518
|
-
const fileBase =
|
|
12519
|
-
return
|
|
12903
|
+
const fileBase = basename7(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
12904
|
+
return join19(outDir, relativeDir, fileBase);
|
|
12520
12905
|
};
|
|
12521
12906
|
const withCacheBuster = (specifier) => {
|
|
12522
12907
|
if (!cacheBuster)
|
|
@@ -12553,21 +12938,21 @@ ${fields}
|
|
|
12553
12938
|
return `${prefix}${dots}`;
|
|
12554
12939
|
return `${prefix}../${dots}`;
|
|
12555
12940
|
});
|
|
12556
|
-
if (
|
|
12941
|
+
if (resolve21(actualPath) === entryPath) {
|
|
12557
12942
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
12558
12943
|
}
|
|
12559
12944
|
return processedContent;
|
|
12560
12945
|
};
|
|
12561
12946
|
const transpileFile = async (filePath) => {
|
|
12562
|
-
const resolved =
|
|
12947
|
+
const resolved = resolve21(filePath);
|
|
12563
12948
|
if (visited.has(resolved))
|
|
12564
12949
|
return;
|
|
12565
12950
|
visited.add(resolved);
|
|
12566
|
-
if (resolved.endsWith(".json") &&
|
|
12567
|
-
const inputDir2 =
|
|
12951
|
+
if (resolved.endsWith(".json") && existsSync17(resolved)) {
|
|
12952
|
+
const inputDir2 = dirname13(resolved);
|
|
12568
12953
|
const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
|
|
12569
|
-
const targetDir2 =
|
|
12570
|
-
const targetPath2 =
|
|
12954
|
+
const targetDir2 = join19(outDir, relativeDir2);
|
|
12955
|
+
const targetPath2 = join19(targetDir2, basename7(resolved));
|
|
12571
12956
|
await fs.mkdir(targetDir2, { recursive: true });
|
|
12572
12957
|
await fs.copyFile(resolved, targetPath2);
|
|
12573
12958
|
allOutputs.push(targetPath2);
|
|
@@ -12576,15 +12961,15 @@ ${fields}
|
|
|
12576
12961
|
let actualPath = resolved;
|
|
12577
12962
|
if (!actualPath.endsWith(".ts"))
|
|
12578
12963
|
actualPath += ".ts";
|
|
12579
|
-
if (!
|
|
12964
|
+
if (!existsSync17(actualPath))
|
|
12580
12965
|
return;
|
|
12581
12966
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
12582
|
-
const inlined = await inlineResources(sourceCode,
|
|
12583
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
12584
|
-
const inputDir =
|
|
12967
|
+
const inlined = await inlineResources(sourceCode, dirname13(actualPath), stylePreprocessors);
|
|
12968
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname13(actualPath)).source;
|
|
12969
|
+
const inputDir = dirname13(actualPath);
|
|
12585
12970
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
12586
|
-
const fileBase =
|
|
12587
|
-
const targetDir =
|
|
12971
|
+
const fileBase = basename7(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
12972
|
+
const targetDir = join19(outDir, relativeDir);
|
|
12588
12973
|
const targetPath = toOutputPath(actualPath);
|
|
12589
12974
|
const localImports = [];
|
|
12590
12975
|
const importRewrites = new Map;
|
|
@@ -12611,10 +12996,10 @@ ${fields}
|
|
|
12611
12996
|
importRewrites.set(specifier, relativeRewrite);
|
|
12612
12997
|
return resolved2;
|
|
12613
12998
|
}).filter((path) => Boolean(path));
|
|
12614
|
-
const isEntry =
|
|
12999
|
+
const isEntry = resolve21(actualPath) === resolve21(entryPath);
|
|
12615
13000
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
12616
13001
|
const cacheKey2 = actualPath;
|
|
12617
|
-
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !
|
|
13002
|
+
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync17(targetPath);
|
|
12618
13003
|
if (shouldWriteFile) {
|
|
12619
13004
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
12620
13005
|
await fs.mkdir(targetDir, { recursive: true });
|
|
@@ -12626,7 +13011,7 @@ ${fields}
|
|
|
12626
13011
|
};
|
|
12627
13012
|
await transpileFile(inputPath);
|
|
12628
13013
|
const entryOutputPath = toOutputPath(entryPath);
|
|
12629
|
-
if (
|
|
13014
|
+
if (existsSync17(entryOutputPath)) {
|
|
12630
13015
|
const entryOutput = await fs.readFile(entryOutputPath, "utf-8");
|
|
12631
13016
|
const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
|
|
12632
13017
|
`);
|
|
@@ -12645,57 +13030,57 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12645
13030
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
12646
13031
|
}
|
|
12647
13032
|
const compiledRoot = compiledParent;
|
|
12648
|
-
const indexesDir =
|
|
13033
|
+
const indexesDir = join19(compiledParent, "indexes");
|
|
12649
13034
|
await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
|
|
12650
|
-
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) =>
|
|
13035
|
+
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve21(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
12651
13036
|
if (!hmr) {
|
|
12652
13037
|
await traceAngularPhase("aot/copy-json-resources", async () => {
|
|
12653
13038
|
const cwd = process.cwd();
|
|
12654
|
-
const angularSrcDir =
|
|
12655
|
-
if (!
|
|
13039
|
+
const angularSrcDir = resolve21(outRoot);
|
|
13040
|
+
if (!existsSync17(angularSrcDir))
|
|
12656
13041
|
return;
|
|
12657
13042
|
const jsonGlob = new Glob6("**/*.json");
|
|
12658
13043
|
for (const rel of jsonGlob.scanSync({
|
|
12659
13044
|
absolute: false,
|
|
12660
13045
|
cwd: angularSrcDir
|
|
12661
13046
|
})) {
|
|
12662
|
-
const sourcePath =
|
|
13047
|
+
const sourcePath = join19(angularSrcDir, rel);
|
|
12663
13048
|
const cwdRel = relative11(cwd, sourcePath);
|
|
12664
|
-
const targetPath =
|
|
12665
|
-
await fs.mkdir(
|
|
13049
|
+
const targetPath = join19(compiledRoot, cwdRel);
|
|
13050
|
+
await fs.mkdir(dirname13(targetPath), { recursive: true });
|
|
12666
13051
|
await fs.copyFile(sourcePath, targetPath);
|
|
12667
13052
|
}
|
|
12668
13053
|
});
|
|
12669
13054
|
}
|
|
12670
13055
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
12671
13056
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
12672
|
-
const resolvedEntry =
|
|
13057
|
+
const resolvedEntry = resolve21(entry);
|
|
12673
13058
|
const relativeEntry = relative11(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
12674
13059
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
12675
13060
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
12676
13061
|
entry: resolvedEntry
|
|
12677
13062
|
}) : aotOutputs;
|
|
12678
|
-
const fileBase =
|
|
13063
|
+
const fileBase = basename7(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
12679
13064
|
const jsName = `${fileBase}.js`;
|
|
12680
13065
|
const compiledFallbackPaths = [
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12684
|
-
].map((file3) =>
|
|
13066
|
+
join19(compiledRoot, relativeEntry),
|
|
13067
|
+
join19(compiledRoot, "pages", jsName),
|
|
13068
|
+
join19(compiledRoot, jsName)
|
|
13069
|
+
].map((file3) => resolve21(file3));
|
|
12685
13070
|
const resolveRawServerFile = (candidatePaths) => {
|
|
12686
13071
|
const normalizedCandidates = [
|
|
12687
|
-
...candidatePaths.map((file3) =>
|
|
13072
|
+
...candidatePaths.map((file3) => resolve21(file3)),
|
|
12688
13073
|
...compiledFallbackPaths
|
|
12689
13074
|
];
|
|
12690
|
-
let candidate = normalizedCandidates.find((file3) =>
|
|
13075
|
+
let candidate = normalizedCandidates.find((file3) => existsSync17(file3) && file3.endsWith(`${sep3}${relativeEntry}`));
|
|
12691
13076
|
if (!candidate) {
|
|
12692
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
13077
|
+
candidate = normalizedCandidates.find((file3) => existsSync17(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
12693
13078
|
}
|
|
12694
13079
|
if (!candidate) {
|
|
12695
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
13080
|
+
candidate = normalizedCandidates.find((file3) => existsSync17(file3) && file3.endsWith(`${sep3}${jsName}`));
|
|
12696
13081
|
}
|
|
12697
13082
|
if (!candidate) {
|
|
12698
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
13083
|
+
candidate = normalizedCandidates.find((file3) => existsSync17(file3));
|
|
12699
13084
|
}
|
|
12700
13085
|
return candidate;
|
|
12701
13086
|
};
|
|
@@ -12703,11 +13088,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12703
13088
|
if (!rawServerFile) {
|
|
12704
13089
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
|
|
12705
13090
|
}
|
|
12706
|
-
if (rawServerFile && !
|
|
13091
|
+
if (rawServerFile && !existsSync17(rawServerFile)) {
|
|
12707
13092
|
outputs = hmr ? await compileEntry() : aotOutputs;
|
|
12708
13093
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
|
|
12709
13094
|
}
|
|
12710
|
-
if (!rawServerFile || !
|
|
13095
|
+
if (!rawServerFile || !existsSync17(rawServerFile)) {
|
|
12711
13096
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
12712
13097
|
...outputs,
|
|
12713
13098
|
...compiledFallbackPaths
|
|
@@ -12728,8 +13113,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12728
13113
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
12729
13114
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
12730
13115
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
12731
|
-
const clientFile =
|
|
12732
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
13116
|
+
const clientFile = join19(indexesDir, jsName);
|
|
13117
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync17(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
12733
13118
|
return {
|
|
12734
13119
|
clientPath: clientFile,
|
|
12735
13120
|
indexUnchanged: true,
|
|
@@ -12958,7 +13343,7 @@ var init_compileAngular = __esm(() => {
|
|
|
12958
13343
|
init_stylePreprocessor();
|
|
12959
13344
|
init_generatedDir();
|
|
12960
13345
|
devClientDir4 = resolveDevClientDir4();
|
|
12961
|
-
hmrClientPath5 =
|
|
13346
|
+
hmrClientPath5 = join19(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
12962
13347
|
jitContentCache = new Map;
|
|
12963
13348
|
wrapperOutputCache = new Map;
|
|
12964
13349
|
});
|
|
@@ -13055,7 +13440,10 @@ class ExpressionTranslatorVisitor {
|
|
|
13055
13440
|
];
|
|
13056
13441
|
const expressions = [];
|
|
13057
13442
|
for (let i = 0;i < ast.expressions.length; i++) {
|
|
13058
|
-
const
|
|
13443
|
+
const expression = ast.expressions[i];
|
|
13444
|
+
if (expression === undefined)
|
|
13445
|
+
continue;
|
|
13446
|
+
const placeholder = this.setSourceMapRange(expression.visitExpression(this, context), ast.getPlaceholderSourceSpan(i));
|
|
13059
13447
|
expressions.push(placeholder);
|
|
13060
13448
|
elements.push(createTemplateElement(ast.serializeI18nTemplatePart(i + 1)));
|
|
13061
13449
|
}
|
|
@@ -13505,20 +13893,31 @@ class TypeScriptAstFactory {
|
|
|
13505
13893
|
let templateLiteral;
|
|
13506
13894
|
const length = template.elements.length;
|
|
13507
13895
|
const head = template.elements[0];
|
|
13896
|
+
if (head === undefined) {
|
|
13897
|
+
throw new Error("createTemplateLiteral: template has no elements");
|
|
13898
|
+
}
|
|
13508
13899
|
if (length === 1) {
|
|
13509
13900
|
templateLiteral = ts5.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
13510
13901
|
} else {
|
|
13511
13902
|
const spans = [];
|
|
13512
13903
|
for (let i = 1;i < length - 1; i++) {
|
|
13513
|
-
const
|
|
13904
|
+
const element = template.elements[i];
|
|
13905
|
+
const expression = template.expressions[i - 1];
|
|
13906
|
+
if (element === undefined || expression === undefined) {
|
|
13907
|
+
throw new Error(`createTemplateLiteral: missing element/expression at index ${i}`);
|
|
13908
|
+
}
|
|
13909
|
+
const { cooked, raw, range } = element;
|
|
13514
13910
|
const middle = createTemplateMiddle(cooked, raw);
|
|
13515
13911
|
if (range !== null) {
|
|
13516
13912
|
this.setSourceMapRange(middle, range);
|
|
13517
13913
|
}
|
|
13518
|
-
spans.push(ts5.factory.createTemplateSpan(
|
|
13914
|
+
spans.push(ts5.factory.createTemplateSpan(expression, middle));
|
|
13519
13915
|
}
|
|
13520
13916
|
const resolvedExpression = template.expressions[length - 2];
|
|
13521
13917
|
const templatePart = template.elements[length - 1];
|
|
13918
|
+
if (resolvedExpression === undefined || templatePart === undefined) {
|
|
13919
|
+
throw new Error("createTemplateLiteral: missing tail element/expression");
|
|
13920
|
+
}
|
|
13522
13921
|
const templateTail = createTemplateTail(templatePart.cooked, templatePart.raw);
|
|
13523
13922
|
if (templatePart.range !== null) {
|
|
13524
13923
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
@@ -13667,8 +14066,8 @@ __export(exports_fastHmrCompiler, {
|
|
|
13667
14066
|
primeComponentFingerprint: () => primeComponentFingerprint,
|
|
13668
14067
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
13669
14068
|
});
|
|
13670
|
-
import { existsSync as
|
|
13671
|
-
import { dirname as
|
|
14069
|
+
import { existsSync as existsSync18, readFileSync as readFileSync13, statSync as statSync2 } from "fs";
|
|
14070
|
+
import { dirname as dirname14, extname as extname6, relative as relative12, resolve as resolve22 } from "path";
|
|
13672
14071
|
import ts6 from "typescript";
|
|
13673
14072
|
var fail = (reason, detail, location) => ({
|
|
13674
14073
|
ok: false,
|
|
@@ -13796,7 +14195,7 @@ var fail = (reason, detail, location) => ({
|
|
|
13796
14195
|
continue;
|
|
13797
14196
|
const decoratorMeta = readDecoratorMeta(args);
|
|
13798
14197
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
13799
|
-
const componentDir =
|
|
14198
|
+
const componentDir = dirname14(componentFilePath);
|
|
13800
14199
|
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
13801
14200
|
fingerprintCache.set(id, fingerprint);
|
|
13802
14201
|
} else {
|
|
@@ -13972,7 +14371,7 @@ var fail = (reason, detail, location) => ({
|
|
|
13972
14371
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
13973
14372
|
return true;
|
|
13974
14373
|
}
|
|
13975
|
-
const base =
|
|
14374
|
+
const base = resolve22(componentDir, spec);
|
|
13976
14375
|
const candidates = [
|
|
13977
14376
|
`${base}.ts`,
|
|
13978
14377
|
`${base}.tsx`,
|
|
@@ -13980,11 +14379,11 @@ var fail = (reason, detail, location) => ({
|
|
|
13980
14379
|
`${base}/index.tsx`
|
|
13981
14380
|
];
|
|
13982
14381
|
for (const candidate of candidates) {
|
|
13983
|
-
if (!
|
|
14382
|
+
if (!existsSync18(candidate))
|
|
13984
14383
|
continue;
|
|
13985
14384
|
let content;
|
|
13986
14385
|
try {
|
|
13987
|
-
content =
|
|
14386
|
+
content = readFileSync13(candidate, "utf-8");
|
|
13988
14387
|
} catch {
|
|
13989
14388
|
continue;
|
|
13990
14389
|
}
|
|
@@ -14299,6 +14698,8 @@ var fail = (reason, detail, location) => ({
|
|
|
14299
14698
|
}
|
|
14300
14699
|
}, mergeMemberHostDecorators = (host, cls) => {
|
|
14301
14700
|
for (const member of cls.members) {
|
|
14701
|
+
if (!ts6.canHaveDecorators(member))
|
|
14702
|
+
continue;
|
|
14302
14703
|
const decorators = ts6.getDecorators(member) ?? [];
|
|
14303
14704
|
for (const dec of decorators) {
|
|
14304
14705
|
const expr = dec.expression;
|
|
@@ -14552,7 +14953,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14552
14953
|
const cacheKey2 = `ts:${filePath}:${className}`;
|
|
14553
14954
|
let stat3;
|
|
14554
14955
|
try {
|
|
14555
|
-
stat3 =
|
|
14956
|
+
stat3 = statSync2(filePath);
|
|
14556
14957
|
} catch {
|
|
14557
14958
|
return null;
|
|
14558
14959
|
}
|
|
@@ -14561,7 +14962,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14561
14962
|
return cached.info;
|
|
14562
14963
|
let source;
|
|
14563
14964
|
try {
|
|
14564
|
-
source =
|
|
14965
|
+
source = readFileSync13(filePath, "utf-8");
|
|
14565
14966
|
} catch {
|
|
14566
14967
|
childComponentInfoCache.set(cacheKey2, {
|
|
14567
14968
|
info: null,
|
|
@@ -14606,7 +15007,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14606
15007
|
const cacheKey2 = `dts:${dtsPath}:${className}`;
|
|
14607
15008
|
let stat3;
|
|
14608
15009
|
try {
|
|
14609
|
-
stat3 =
|
|
15010
|
+
stat3 = statSync2(dtsPath);
|
|
14610
15011
|
} catch {
|
|
14611
15012
|
return null;
|
|
14612
15013
|
}
|
|
@@ -14615,7 +15016,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14615
15016
|
return cached.info;
|
|
14616
15017
|
let content;
|
|
14617
15018
|
try {
|
|
14618
|
-
content =
|
|
15019
|
+
content = readFileSync13(dtsPath, "utf-8");
|
|
14619
15020
|
} catch {
|
|
14620
15021
|
childComponentInfoCache.set(cacheKey2, {
|
|
14621
15022
|
info: null,
|
|
@@ -14731,11 +15132,11 @@ var fail = (reason, detail, location) => ({
|
|
|
14731
15132
|
if (visited.has(startDtsPath))
|
|
14732
15133
|
return null;
|
|
14733
15134
|
visited.add(startDtsPath);
|
|
14734
|
-
if (!
|
|
15135
|
+
if (!existsSync18(startDtsPath))
|
|
14735
15136
|
return null;
|
|
14736
15137
|
let content;
|
|
14737
15138
|
try {
|
|
14738
|
-
content =
|
|
15139
|
+
content = readFileSync13(startDtsPath, "utf-8");
|
|
14739
15140
|
} catch {
|
|
14740
15141
|
return null;
|
|
14741
15142
|
}
|
|
@@ -14754,7 +15155,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14754
15155
|
});
|
|
14755
15156
|
if (!names.includes(className))
|
|
14756
15157
|
continue;
|
|
14757
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
15158
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname14(startDtsPath));
|
|
14758
15159
|
if (!nextDts)
|
|
14759
15160
|
continue;
|
|
14760
15161
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -14764,7 +15165,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14764
15165
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
14765
15166
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
14766
15167
|
const fromPath = m[1] || "";
|
|
14767
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
15168
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname14(startDtsPath));
|
|
14768
15169
|
if (!nextDts)
|
|
14769
15170
|
continue;
|
|
14770
15171
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -14774,7 +15175,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14774
15175
|
return null;
|
|
14775
15176
|
}, resolveDtsFromSpec = (spec, fromDir) => {
|
|
14776
15177
|
const stripped = spec.replace(/\.[mc]?js$/, "");
|
|
14777
|
-
const base =
|
|
15178
|
+
const base = resolve22(fromDir, stripped);
|
|
14778
15179
|
const candidates = [
|
|
14779
15180
|
`${base}.d.ts`,
|
|
14780
15181
|
`${base}.d.mts`,
|
|
@@ -14784,21 +15185,21 @@ var fail = (reason, detail, location) => ({
|
|
|
14784
15185
|
`${base}/index.d.cts`
|
|
14785
15186
|
];
|
|
14786
15187
|
for (const c of candidates) {
|
|
14787
|
-
if (
|
|
15188
|
+
if (existsSync18(c))
|
|
14788
15189
|
return c;
|
|
14789
15190
|
}
|
|
14790
15191
|
return null;
|
|
14791
15192
|
}, findPackageDtsForJs = (jsPath) => {
|
|
14792
15193
|
const sibling = jsPath.replace(/\.[mc]?js$/, ".d.ts");
|
|
14793
|
-
if (
|
|
15194
|
+
if (existsSync18(sibling))
|
|
14794
15195
|
return sibling;
|
|
14795
15196
|
const mirror = jsPath.replace(/\/dist\//, "/dist/src/").replace(/\.[mc]?js$/, ".d.ts");
|
|
14796
|
-
if (
|
|
15197
|
+
if (existsSync18(mirror))
|
|
14797
15198
|
return mirror;
|
|
14798
15199
|
return null;
|
|
14799
15200
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
14800
15201
|
if (spec.startsWith(".") || spec.startsWith("/")) {
|
|
14801
|
-
const base =
|
|
15202
|
+
const base = resolve22(componentDir, spec);
|
|
14802
15203
|
const candidates = [
|
|
14803
15204
|
`${base}.ts`,
|
|
14804
15205
|
`${base}.tsx`,
|
|
@@ -14806,7 +15207,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14806
15207
|
`${base}/index.tsx`
|
|
14807
15208
|
];
|
|
14808
15209
|
for (const candidate of candidates) {
|
|
14809
|
-
if (!
|
|
15210
|
+
if (!existsSync18(candidate))
|
|
14810
15211
|
continue;
|
|
14811
15212
|
const info = getChildComponentInfoFromTsSource(candidate, className);
|
|
14812
15213
|
if (info)
|
|
@@ -14915,6 +15316,8 @@ var fail = (reason, detail, location) => ({
|
|
|
14915
15316
|
}, INPUT_OUTPUT_DECORATORS, extractMemberDecoratorSig = (cls) => {
|
|
14916
15317
|
const entries = [];
|
|
14917
15318
|
for (const member of cls.members) {
|
|
15319
|
+
if (!ts6.canHaveDecorators(member))
|
|
15320
|
+
continue;
|
|
14918
15321
|
const decorators = ts6.getDecorators(member) ?? [];
|
|
14919
15322
|
if (decorators.length === 0)
|
|
14920
15323
|
continue;
|
|
@@ -14942,7 +15345,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14942
15345
|
}, providerProbeCache, fileHasModuleProviders = (filePath) => {
|
|
14943
15346
|
let stat3;
|
|
14944
15347
|
try {
|
|
14945
|
-
stat3 =
|
|
15348
|
+
stat3 = statSync2(filePath);
|
|
14946
15349
|
} catch {
|
|
14947
15350
|
return true;
|
|
14948
15351
|
}
|
|
@@ -14951,7 +15354,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14951
15354
|
return cached.hasProviders;
|
|
14952
15355
|
let source;
|
|
14953
15356
|
try {
|
|
14954
|
-
source =
|
|
15357
|
+
source = readFileSync13(filePath, "utf8");
|
|
14955
15358
|
} catch {
|
|
14956
15359
|
return true;
|
|
14957
15360
|
}
|
|
@@ -15015,14 +15418,14 @@ var fail = (reason, detail, location) => ({
|
|
|
15015
15418
|
}
|
|
15016
15419
|
if (!matches)
|
|
15017
15420
|
continue;
|
|
15018
|
-
const resolved =
|
|
15421
|
+
const resolved = resolve22(componentDir, spec);
|
|
15019
15422
|
for (const ext of TS_EXTENSIONS) {
|
|
15020
15423
|
const candidate = resolved + ext;
|
|
15021
|
-
if (
|
|
15424
|
+
if (existsSync18(candidate))
|
|
15022
15425
|
return candidate;
|
|
15023
15426
|
}
|
|
15024
|
-
const indexCandidate =
|
|
15025
|
-
if (
|
|
15427
|
+
const indexCandidate = resolve22(resolved, "index.ts");
|
|
15428
|
+
if (existsSync18(indexCandidate))
|
|
15026
15429
|
return indexCandidate;
|
|
15027
15430
|
}
|
|
15028
15431
|
return null;
|
|
@@ -15185,13 +15588,13 @@ var fail = (reason, detail, location) => ({
|
|
|
15185
15588
|
const printer = ts6.createPrinter({ removeComments: true });
|
|
15186
15589
|
for (const member of classNode.members) {
|
|
15187
15590
|
if (ts6.isPropertyDeclaration(member)) {
|
|
15188
|
-
const modifiers = (ts6.getModifiers(member) ?? []).filter((m) => m.kind !== ts6.SyntaxKind.
|
|
15591
|
+
const modifiers = (ts6.getModifiers(member) ?? []).filter((m) => m.kind !== ts6.SyntaxKind.PrivateKeyword && m.kind !== ts6.SyntaxKind.PublicKeyword && m.kind !== ts6.SyntaxKind.ProtectedKeyword && m.kind !== ts6.SyntaxKind.ReadonlyKeyword && m.kind !== ts6.SyntaxKind.OverrideKeyword);
|
|
15189
15592
|
const cleaned = ts6.factory.createPropertyDeclaration(modifiers, member.name, undefined, undefined, member.initializer);
|
|
15190
15593
|
memberSources.push(printer.printNode(ts6.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
15191
15594
|
continue;
|
|
15192
15595
|
}
|
|
15193
15596
|
if (ts6.isConstructorDeclaration(member)) {
|
|
15194
|
-
const cleanedParams = member.parameters.map((param) => ts6.factory.updateParameterDeclaration(param, (ts6.getModifiers(param) ?? []).filter((m) => m.kind !== ts6.SyntaxKind.
|
|
15597
|
+
const cleanedParams = member.parameters.map((param) => ts6.factory.updateParameterDeclaration(param, (ts6.getModifiers(param) ?? []).filter((m) => m.kind !== ts6.SyntaxKind.PrivateKeyword && m.kind !== ts6.SyntaxKind.PublicKeyword && m.kind !== ts6.SyntaxKind.ProtectedKeyword && m.kind !== ts6.SyntaxKind.ReadonlyKeyword && m.kind !== ts6.SyntaxKind.OverrideKeyword), param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
15195
15598
|
const cleaned = ts6.factory.createConstructorDeclaration([], cleanedParams, member.body);
|
|
15196
15599
|
memberSources.push(printer.printNode(ts6.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
15197
15600
|
continue;
|
|
@@ -15201,14 +15604,14 @@ var fail = (reason, detail, location) => ({
|
|
|
15201
15604
|
const isStatic = modifiers.some((m) => m.kind === ts6.SyntaxKind.StaticKeyword);
|
|
15202
15605
|
if (isStatic)
|
|
15203
15606
|
hasStatic = true;
|
|
15204
|
-
const cleanedParams = member.parameters.map((param) => ts6.factory.updateParameterDeclaration(param,
|
|
15607
|
+
const cleanedParams = member.parameters.map((param) => ts6.factory.updateParameterDeclaration(param, ts6.getModifiers(param) ?? [], param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
15205
15608
|
let cleaned;
|
|
15206
15609
|
if (ts6.isMethodDeclaration(member)) {
|
|
15207
|
-
cleaned = ts6.factory.createMethodDeclaration(modifiers
|
|
15610
|
+
cleaned = ts6.factory.createMethodDeclaration(modifiers, member.asteriskToken, member.name, member.questionToken, member.typeParameters, cleanedParams, member.type, member.body);
|
|
15208
15611
|
} else if (ts6.isGetAccessorDeclaration(member)) {
|
|
15209
|
-
cleaned = ts6.factory.createGetAccessorDeclaration(modifiers
|
|
15612
|
+
cleaned = ts6.factory.createGetAccessorDeclaration(modifiers, member.name, cleanedParams, member.type, member.body);
|
|
15210
15613
|
} else {
|
|
15211
|
-
cleaned = ts6.factory.createSetAccessorDeclaration(modifiers
|
|
15614
|
+
cleaned = ts6.factory.createSetAccessorDeclaration(modifiers, member.name, cleanedParams, member.body);
|
|
15212
15615
|
}
|
|
15213
15616
|
const printed = printer.printNode(ts6.EmitHint.Unspecified, cleaned, classNode.getSourceFile());
|
|
15214
15617
|
memberSources.push(printed);
|
|
@@ -15254,12 +15657,12 @@ ${transpiled}
|
|
|
15254
15657
|
}
|
|
15255
15658
|
}${staticPatch}`;
|
|
15256
15659
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
15257
|
-
const abs =
|
|
15258
|
-
if (!
|
|
15660
|
+
const abs = resolve22(componentDir, url);
|
|
15661
|
+
if (!existsSync18(abs))
|
|
15259
15662
|
return null;
|
|
15260
15663
|
const ext = extname6(abs).toLowerCase();
|
|
15261
15664
|
if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
|
|
15262
|
-
return
|
|
15665
|
+
return readFileSync13(abs, "utf8");
|
|
15263
15666
|
}
|
|
15264
15667
|
try {
|
|
15265
15668
|
const { compileStyleFileIfNeededSync: compileStyleFileIfNeededSync2 } = (init_stylePreprocessor(), __toCommonJS(exports_stylePreprocessor));
|
|
@@ -15294,11 +15697,11 @@ ${block}
|
|
|
15294
15697
|
const cached = projectOptionsCache.get(projectRoot);
|
|
15295
15698
|
if (cached !== undefined)
|
|
15296
15699
|
return cached;
|
|
15297
|
-
const tsconfigPath =
|
|
15700
|
+
const tsconfigPath = resolve22(projectRoot, "tsconfig.json");
|
|
15298
15701
|
const opts = {};
|
|
15299
|
-
if (
|
|
15702
|
+
if (existsSync18(tsconfigPath)) {
|
|
15300
15703
|
try {
|
|
15301
|
-
const text =
|
|
15704
|
+
const text = readFileSync13(tsconfigPath, "utf8");
|
|
15302
15705
|
const parsed = ts6.parseConfigFileTextToJson(tsconfigPath, text);
|
|
15303
15706
|
if (!parsed.error && parsed.config) {
|
|
15304
15707
|
const cfg = parsed.config;
|
|
@@ -15323,7 +15726,7 @@ ${block}
|
|
|
15323
15726
|
}, tryFastHmr = async (params) => {
|
|
15324
15727
|
const { componentFilePath, className } = params;
|
|
15325
15728
|
const projectRoot = params.projectRoot ?? process.cwd();
|
|
15326
|
-
if (!
|
|
15729
|
+
if (!existsSync18(componentFilePath)) {
|
|
15327
15730
|
return fail("file-not-found", componentFilePath);
|
|
15328
15731
|
}
|
|
15329
15732
|
let compiler;
|
|
@@ -15332,7 +15735,7 @@ ${block}
|
|
|
15332
15735
|
} catch (err) {
|
|
15333
15736
|
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
15334
15737
|
}
|
|
15335
|
-
const tsSource =
|
|
15738
|
+
const tsSource = readFileSync13(componentFilePath, "utf8");
|
|
15336
15739
|
const sourceFile = ts6.createSourceFile(componentFilePath, tsSource, ts6.ScriptTarget.ES2022, true, ts6.ScriptKind.TS);
|
|
15337
15740
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
15338
15741
|
if (!classNode) {
|
|
@@ -15359,7 +15762,7 @@ ${block}
|
|
|
15359
15762
|
rebootstrapRequired: false
|
|
15360
15763
|
};
|
|
15361
15764
|
}
|
|
15362
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
15765
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname14(componentFilePath), projectRoot)) {
|
|
15363
15766
|
return fail("inherits-decorated-class");
|
|
15364
15767
|
}
|
|
15365
15768
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -15371,18 +15774,18 @@ ${block}
|
|
|
15371
15774
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
15372
15775
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
15373
15776
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
15374
|
-
const componentDir =
|
|
15777
|
+
const componentDir = dirname14(componentFilePath);
|
|
15375
15778
|
let templateText;
|
|
15376
15779
|
let templatePath;
|
|
15377
15780
|
if (decoratorMeta.template !== null) {
|
|
15378
15781
|
templateText = decoratorMeta.template;
|
|
15379
15782
|
templatePath = componentFilePath;
|
|
15380
15783
|
} else if (decoratorMeta.templateUrl) {
|
|
15381
|
-
const tplAbs =
|
|
15382
|
-
if (!
|
|
15784
|
+
const tplAbs = resolve22(componentDir, decoratorMeta.templateUrl);
|
|
15785
|
+
if (!existsSync18(tplAbs)) {
|
|
15383
15786
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
15384
15787
|
}
|
|
15385
|
-
templateText =
|
|
15788
|
+
templateText = readFileSync13(tplAbs, "utf8");
|
|
15386
15789
|
templatePath = tplAbs;
|
|
15387
15790
|
} else {
|
|
15388
15791
|
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
@@ -16132,16 +16535,16 @@ __export(exports_compileEmber, {
|
|
|
16132
16535
|
getEmberServerCompiledDir: () => getEmberServerCompiledDir,
|
|
16133
16536
|
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
16134
16537
|
getEmberClientCompiledDir: () => getEmberClientCompiledDir,
|
|
16135
|
-
dirname: () =>
|
|
16538
|
+
dirname: () => dirname15,
|
|
16136
16539
|
compileEmberFileSource: () => compileEmberFileSource,
|
|
16137
16540
|
compileEmberFile: () => compileEmberFile,
|
|
16138
16541
|
compileEmber: () => compileEmber,
|
|
16139
16542
|
clearEmberCompilerCache: () => clearEmberCompilerCache,
|
|
16140
|
-
basename: () =>
|
|
16543
|
+
basename: () => basename8
|
|
16141
16544
|
});
|
|
16142
|
-
import { existsSync as
|
|
16545
|
+
import { existsSync as existsSync19 } from "fs";
|
|
16143
16546
|
import { mkdir as mkdir6, rm as rm4 } from "fs/promises";
|
|
16144
|
-
import { basename as
|
|
16547
|
+
import { basename as basename8, dirname as dirname15, extname as extname7, join as join20, resolve as resolve23 } from "path";
|
|
16145
16548
|
var {build: bunBuild2, Transpiler: Transpiler4, write: write3, file: file3 } = globalThis.Bun;
|
|
16146
16549
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
16147
16550
|
if (cachedPreprocessor)
|
|
@@ -16237,11 +16640,11 @@ export const importSync = (specifier) => {
|
|
|
16237
16640
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
16238
16641
|
if (!originalImporter)
|
|
16239
16642
|
return;
|
|
16240
|
-
const candidateBase =
|
|
16643
|
+
const candidateBase = resolve23(dirname15(originalImporter), args.path);
|
|
16241
16644
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
16242
16645
|
for (const ext of extensionsToTry) {
|
|
16243
16646
|
const candidate = candidateBase + ext;
|
|
16244
|
-
if (
|
|
16647
|
+
if (existsSync19(candidate))
|
|
16245
16648
|
return { path: candidate };
|
|
16246
16649
|
}
|
|
16247
16650
|
return;
|
|
@@ -16260,8 +16663,8 @@ export const importSync = (specifier) => {
|
|
|
16260
16663
|
build.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
16261
16664
|
if (standalonePackages.has(args.path))
|
|
16262
16665
|
return;
|
|
16263
|
-
const internal =
|
|
16264
|
-
if (
|
|
16666
|
+
const internal = join20(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
16667
|
+
if (existsSync19(internal))
|
|
16265
16668
|
return { path: internal };
|
|
16266
16669
|
return;
|
|
16267
16670
|
});
|
|
@@ -16296,7 +16699,7 @@ export const renderToHTML = (props = {}) => {
|
|
|
16296
16699
|
export { PageComponent };
|
|
16297
16700
|
export default PageComponent;
|
|
16298
16701
|
`, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
|
|
16299
|
-
const resolvedEntry =
|
|
16702
|
+
const resolvedEntry = resolve23(entry);
|
|
16300
16703
|
const source = await file3(resolvedEntry).text();
|
|
16301
16704
|
let preprocessed = source;
|
|
16302
16705
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -16307,17 +16710,17 @@ export default PageComponent;
|
|
|
16307
16710
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
16308
16711
|
}
|
|
16309
16712
|
const transpiled = transpiler5.transformSync(preprocessed);
|
|
16310
|
-
const baseName =
|
|
16311
|
-
const tmpDir =
|
|
16312
|
-
const serverDir =
|
|
16313
|
-
const clientDir =
|
|
16713
|
+
const baseName = basename8(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
16714
|
+
const tmpDir = join20(compiledRoot, "_tmp");
|
|
16715
|
+
const serverDir = join20(compiledRoot, "server");
|
|
16716
|
+
const clientDir = join20(compiledRoot, "client");
|
|
16314
16717
|
await Promise.all([
|
|
16315
16718
|
mkdir6(tmpDir, { recursive: true }),
|
|
16316
16719
|
mkdir6(serverDir, { recursive: true }),
|
|
16317
16720
|
mkdir6(clientDir, { recursive: true })
|
|
16318
16721
|
]);
|
|
16319
|
-
const tmpPagePath =
|
|
16320
|
-
const tmpHarnessPath =
|
|
16722
|
+
const tmpPagePath = resolve23(join20(tmpDir, `${baseName}.module.js`));
|
|
16723
|
+
const tmpHarnessPath = resolve23(join20(tmpDir, `${baseName}.harness.js`));
|
|
16321
16724
|
await Promise.all([
|
|
16322
16725
|
write3(tmpPagePath, transpiled),
|
|
16323
16726
|
write3(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -16325,7 +16728,7 @@ export default PageComponent;
|
|
|
16325
16728
|
const stagedSourceMap = new Map([
|
|
16326
16729
|
[tmpPagePath, resolvedEntry]
|
|
16327
16730
|
]);
|
|
16328
|
-
const serverPath =
|
|
16731
|
+
const serverPath = join20(serverDir, `${baseName}.js`);
|
|
16329
16732
|
const buildResult = await bunBuild2({
|
|
16330
16733
|
entrypoints: [tmpHarnessPath],
|
|
16331
16734
|
format: "esm",
|
|
@@ -16342,7 +16745,7 @@ export default PageComponent;
|
|
|
16342
16745
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
16343
16746
|
}
|
|
16344
16747
|
await rm4(tmpDir, { force: true, recursive: true });
|
|
16345
|
-
const clientPath =
|
|
16748
|
+
const clientPath = join20(clientDir, `${baseName}.js`);
|
|
16346
16749
|
await write3(clientPath, transpiled);
|
|
16347
16750
|
return { clientPath, serverPath };
|
|
16348
16751
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -16359,7 +16762,7 @@ export default PageComponent;
|
|
|
16359
16762
|
serverPaths: outputs.map((o3) => o3.serverPath)
|
|
16360
16763
|
};
|
|
16361
16764
|
}, compileEmberFileSource = async (entry) => {
|
|
16362
|
-
const resolvedEntry =
|
|
16765
|
+
const resolvedEntry = resolve23(entry);
|
|
16363
16766
|
const source = await file3(resolvedEntry).text();
|
|
16364
16767
|
let preprocessed = source;
|
|
16365
16768
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -16370,7 +16773,7 @@ export default PageComponent;
|
|
|
16370
16773
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
16371
16774
|
}
|
|
16372
16775
|
return transpiler5.transformSync(preprocessed);
|
|
16373
|
-
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) =>
|
|
16776
|
+
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join20(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join20(getEmberCompiledRoot(emberDir), "client");
|
|
16374
16777
|
var init_compileEmber = __esm(() => {
|
|
16375
16778
|
init_generatedDir();
|
|
16376
16779
|
transpiler5 = new Transpiler4({
|
|
@@ -16391,25 +16794,25 @@ __export(exports_buildReactVendor, {
|
|
|
16391
16794
|
computeVendorPaths: () => computeVendorPaths,
|
|
16392
16795
|
buildReactVendor: () => buildReactVendor
|
|
16393
16796
|
});
|
|
16394
|
-
import { existsSync as
|
|
16395
|
-
import { join as
|
|
16797
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync8 } from "fs";
|
|
16798
|
+
import { join as join21, resolve as resolve24 } from "path";
|
|
16396
16799
|
import { rm as rm5 } from "fs/promises";
|
|
16397
16800
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
16398
16801
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
16399
16802
|
const candidates = [
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
|
|
16405
|
-
|
|
16803
|
+
resolve24(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
16804
|
+
resolve24(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
16805
|
+
resolve24(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
16806
|
+
resolve24(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
16807
|
+
resolve24(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
16808
|
+
resolve24(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
16406
16809
|
];
|
|
16407
16810
|
for (const candidate of candidates) {
|
|
16408
|
-
if (
|
|
16811
|
+
if (existsSync20(candidate)) {
|
|
16409
16812
|
return candidate.replace(/\\/g, "/");
|
|
16410
16813
|
}
|
|
16411
16814
|
}
|
|
16412
|
-
return (candidates[0] ??
|
|
16815
|
+
return (candidates[0] ?? resolve24(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
16413
16816
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
16414
16817
|
try {
|
|
16415
16818
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -16446,14 +16849,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
16446
16849
|
`)}
|
|
16447
16850
|
`;
|
|
16448
16851
|
}, buildReactVendor = async (buildDir) => {
|
|
16449
|
-
const vendorDir =
|
|
16450
|
-
|
|
16451
|
-
const tmpDir =
|
|
16452
|
-
|
|
16852
|
+
const vendorDir = join21(buildDir, "react", "vendor");
|
|
16853
|
+
mkdirSync8(vendorDir, { recursive: true });
|
|
16854
|
+
const tmpDir = join21(buildDir, "_vendor_tmp");
|
|
16855
|
+
mkdirSync8(tmpDir, { recursive: true });
|
|
16453
16856
|
const specifiers = resolveVendorSpecifiers();
|
|
16454
16857
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
16455
16858
|
const safeName = toSafeFileName(specifier);
|
|
16456
|
-
const entryPath =
|
|
16859
|
+
const entryPath = join21(tmpDir, `${safeName}.ts`);
|
|
16457
16860
|
const source = await generateEntrySource(specifier);
|
|
16458
16861
|
await Bun.write(entryPath, source);
|
|
16459
16862
|
return entryPath;
|
|
@@ -16517,8 +16920,8 @@ __export(exports_buildAngularVendor, {
|
|
|
16517
16920
|
buildAngularVendor: () => buildAngularVendor,
|
|
16518
16921
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
16519
16922
|
});
|
|
16520
|
-
import { mkdirSync as
|
|
16521
|
-
import { join as
|
|
16923
|
+
import { mkdirSync as mkdirSync9 } from "fs";
|
|
16924
|
+
import { join as join22 } from "path";
|
|
16522
16925
|
import { rm as rm6 } from "fs/promises";
|
|
16523
16926
|
var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
|
|
16524
16927
|
var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => jitMode ? [...REQUIRED_ANGULAR_SPECIFIERS_BASE, "@angular/compiler"] : REQUIRED_ANGULAR_SPECIFIERS_BASE, SERVER_ONLY_ANGULAR_SPECIFIERS, BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES, isBuildOnlyAngularSpecifier = (spec) => BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES.some((prefix) => spec === prefix || spec.startsWith(`${prefix}/`)), SCAN_SKIP_DIRS, isResolvable2 = (specifier) => {
|
|
@@ -16555,7 +16958,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
16555
16958
|
}
|
|
16556
16959
|
return { angular, transitiveRoots };
|
|
16557
16960
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
16558
|
-
const { readFileSync:
|
|
16961
|
+
const { readFileSync: readFileSync14 } = await import("fs");
|
|
16559
16962
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
16560
16963
|
const visited = new Set;
|
|
16561
16964
|
const frontier = [];
|
|
@@ -16576,7 +16979,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
16576
16979
|
}
|
|
16577
16980
|
let content;
|
|
16578
16981
|
try {
|
|
16579
|
-
content =
|
|
16982
|
+
content = readFileSync14(resolved, "utf-8");
|
|
16580
16983
|
} catch {
|
|
16581
16984
|
continue;
|
|
16582
16985
|
}
|
|
@@ -16615,14 +17018,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
16615
17018
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
16616
17019
|
return Array.from(angular).filter(isResolvable2);
|
|
16617
17020
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
16618
|
-
const vendorDir =
|
|
16619
|
-
|
|
16620
|
-
const tmpDir =
|
|
16621
|
-
|
|
17021
|
+
const vendorDir = join22(buildDir, "angular", "vendor");
|
|
17022
|
+
mkdirSync9(vendorDir, { recursive: true });
|
|
17023
|
+
const tmpDir = join22(buildDir, "_angular_vendor_tmp");
|
|
17024
|
+
mkdirSync9(tmpDir, { recursive: true });
|
|
16622
17025
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
16623
17026
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
16624
17027
|
const safeName = toSafeFileName2(specifier);
|
|
16625
|
-
const entryPath =
|
|
17028
|
+
const entryPath = join22(tmpDir, `${safeName}.ts`);
|
|
16626
17029
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
16627
17030
|
return entryPath;
|
|
16628
17031
|
}));
|
|
@@ -16653,10 +17056,10 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
16653
17056
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
16654
17057
|
return computeAngularVendorPaths(specifiers);
|
|
16655
17058
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
16656
|
-
const vendorDir =
|
|
16657
|
-
|
|
16658
|
-
const tmpDir =
|
|
16659
|
-
|
|
17059
|
+
const vendorDir = join22(buildDir, "angular", "vendor", "server");
|
|
17060
|
+
mkdirSync9(vendorDir, { recursive: true });
|
|
17061
|
+
const tmpDir = join22(buildDir, "_angular_server_vendor_tmp");
|
|
17062
|
+
mkdirSync9(tmpDir, { recursive: true });
|
|
16660
17063
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
16661
17064
|
const allSpecs = new Set(browserSpecs);
|
|
16662
17065
|
for (const spec of SERVER_ONLY_ANGULAR_SPECIFIERS) {
|
|
@@ -16666,7 +17069,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
16666
17069
|
const specifiers = Array.from(allSpecs);
|
|
16667
17070
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
16668
17071
|
const safeName = toSafeFileName2(specifier);
|
|
16669
|
-
const entryPath =
|
|
17072
|
+
const entryPath = join22(tmpDir, `${safeName}.ts`);
|
|
16670
17073
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
16671
17074
|
return entryPath;
|
|
16672
17075
|
}));
|
|
@@ -16688,9 +17091,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
16688
17091
|
return specifiers;
|
|
16689
17092
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
16690
17093
|
const paths = {};
|
|
16691
|
-
const vendorDir =
|
|
17094
|
+
const vendorDir = join22(buildDir, "angular", "vendor", "server");
|
|
16692
17095
|
for (const specifier of specifiers) {
|
|
16693
|
-
paths[specifier] =
|
|
17096
|
+
paths[specifier] = join22(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
16694
17097
|
}
|
|
16695
17098
|
return paths;
|
|
16696
17099
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -16745,18 +17148,18 @@ __export(exports_buildVueVendor, {
|
|
|
16745
17148
|
computeVueVendorPaths: () => computeVueVendorPaths,
|
|
16746
17149
|
buildVueVendor: () => buildVueVendor
|
|
16747
17150
|
});
|
|
16748
|
-
import { mkdirSync as
|
|
16749
|
-
import { join as
|
|
17151
|
+
import { mkdirSync as mkdirSync10 } from "fs";
|
|
17152
|
+
import { join as join23 } from "path";
|
|
16750
17153
|
import { rm as rm7 } from "fs/promises";
|
|
16751
17154
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
16752
17155
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
16753
|
-
const vendorDir =
|
|
16754
|
-
|
|
16755
|
-
const tmpDir =
|
|
16756
|
-
|
|
17156
|
+
const vendorDir = join23(buildDir, "vue", "vendor");
|
|
17157
|
+
mkdirSync10(vendorDir, { recursive: true });
|
|
17158
|
+
const tmpDir = join23(buildDir, "_vue_vendor_tmp");
|
|
17159
|
+
mkdirSync10(tmpDir, { recursive: true });
|
|
16757
17160
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
16758
17161
|
const safeName = toSafeFileName3(specifier);
|
|
16759
|
-
const entryPath =
|
|
17162
|
+
const entryPath = join23(tmpDir, `${safeName}.ts`);
|
|
16760
17163
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
16761
17164
|
`);
|
|
16762
17165
|
return entryPath;
|
|
@@ -16781,17 +17184,17 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
16781
17184
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
16782
17185
|
return;
|
|
16783
17186
|
}
|
|
16784
|
-
const { readFileSync:
|
|
17187
|
+
const { readFileSync: readFileSync14, writeFileSync: writeFileSync8, readdirSync } = await import("fs");
|
|
16785
17188
|
const files = readdirSync(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
16786
17189
|
for (const file4 of files) {
|
|
16787
|
-
const filePath =
|
|
16788
|
-
const content =
|
|
17190
|
+
const filePath = join23(vendorDir, file4);
|
|
17191
|
+
const content = readFileSync14(filePath, "utf-8");
|
|
16789
17192
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
16790
17193
|
continue;
|
|
16791
17194
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
16792
17195
|
if (patched === content)
|
|
16793
17196
|
continue;
|
|
16794
|
-
|
|
17197
|
+
writeFileSync8(filePath, patched);
|
|
16795
17198
|
}
|
|
16796
17199
|
}, computeVueVendorPaths = () => {
|
|
16797
17200
|
const paths = {};
|
|
@@ -16810,8 +17213,8 @@ __export(exports_buildSvelteVendor, {
|
|
|
16810
17213
|
computeSvelteVendorPaths: () => computeSvelteVendorPaths,
|
|
16811
17214
|
buildSvelteVendor: () => buildSvelteVendor
|
|
16812
17215
|
});
|
|
16813
|
-
import { mkdirSync as
|
|
16814
|
-
import { join as
|
|
17216
|
+
import { mkdirSync as mkdirSync11 } from "fs";
|
|
17217
|
+
import { join as join24 } from "path";
|
|
16815
17218
|
import { rm as rm8 } from "fs/promises";
|
|
16816
17219
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
16817
17220
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
@@ -16825,13 +17228,13 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
16825
17228
|
const specifiers = resolveVendorSpecifiers2();
|
|
16826
17229
|
if (specifiers.length === 0)
|
|
16827
17230
|
return;
|
|
16828
|
-
const vendorDir =
|
|
16829
|
-
|
|
16830
|
-
const tmpDir =
|
|
16831
|
-
|
|
17231
|
+
const vendorDir = join24(buildDir, "svelte", "vendor");
|
|
17232
|
+
mkdirSync11(vendorDir, { recursive: true });
|
|
17233
|
+
const tmpDir = join24(buildDir, "_svelte_vendor_tmp");
|
|
17234
|
+
mkdirSync11(tmpDir, { recursive: true });
|
|
16832
17235
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
16833
17236
|
const safeName = toSafeFileName4(specifier);
|
|
16834
|
-
const entryPath =
|
|
17237
|
+
const entryPath = join24(tmpDir, `${safeName}.ts`);
|
|
16835
17238
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
16836
17239
|
`);
|
|
16837
17240
|
return entryPath;
|
|
@@ -16881,7 +17284,7 @@ __export(exports_rewriteImportsPlugin, {
|
|
|
16881
17284
|
buildWithImportRewrite: () => buildWithImportRewrite
|
|
16882
17285
|
});
|
|
16883
17286
|
import { readdir as readdir3 } from "fs/promises";
|
|
16884
|
-
import { join as
|
|
17287
|
+
import { join as join25 } from "path";
|
|
16885
17288
|
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
16886
17289
|
let result = content;
|
|
16887
17290
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -17010,7 +17413,7 @@ ${content}`;
|
|
|
17010
17413
|
const entries = await readdir3(dir);
|
|
17011
17414
|
for (const entry of entries) {
|
|
17012
17415
|
if (entry.endsWith(".js"))
|
|
17013
|
-
allFiles.push(
|
|
17416
|
+
allFiles.push(join25(dir, entry));
|
|
17014
17417
|
}
|
|
17015
17418
|
} catch {}
|
|
17016
17419
|
}
|
|
@@ -17050,16 +17453,16 @@ var init_rewriteImportsPlugin = __esm(() => {
|
|
|
17050
17453
|
|
|
17051
17454
|
// src/core/build.ts
|
|
17052
17455
|
import {
|
|
17053
|
-
copyFileSync,
|
|
17456
|
+
copyFileSync as copyFileSync2,
|
|
17054
17457
|
cpSync,
|
|
17055
|
-
existsSync as
|
|
17056
|
-
mkdirSync as
|
|
17057
|
-
readFileSync as
|
|
17458
|
+
existsSync as existsSync21,
|
|
17459
|
+
mkdirSync as mkdirSync12,
|
|
17460
|
+
readFileSync as readFileSync14,
|
|
17058
17461
|
rmSync as rmSync2,
|
|
17059
|
-
statSync as
|
|
17060
|
-
writeFileSync as
|
|
17462
|
+
statSync as statSync3,
|
|
17463
|
+
writeFileSync as writeFileSync8
|
|
17061
17464
|
} from "fs";
|
|
17062
|
-
import { basename as
|
|
17465
|
+
import { basename as basename9, dirname as dirname16, extname as extname8, join as join26, relative as relative13, resolve as resolve25 } from "path";
|
|
17063
17466
|
import { cwd, env as env2, exit } from "process";
|
|
17064
17467
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
17065
17468
|
var isDev, isBuildTraceEnabled = () => {
|
|
@@ -17134,12 +17537,12 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
17134
17537
|
throw err;
|
|
17135
17538
|
exit(1);
|
|
17136
17539
|
}, copyHtmxVendor = (htmxDir, htmxDestDir) => {
|
|
17137
|
-
|
|
17540
|
+
mkdirSync12(htmxDestDir, { recursive: true });
|
|
17138
17541
|
const glob = new Glob8("htmx*.min.js");
|
|
17139
17542
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
17140
|
-
const src =
|
|
17141
|
-
const dest =
|
|
17142
|
-
|
|
17543
|
+
const src = join26(htmxDir, relPath);
|
|
17544
|
+
const dest = join26(htmxDestDir, "htmx.min.js");
|
|
17545
|
+
copyFileSync2(src, dest);
|
|
17143
17546
|
return;
|
|
17144
17547
|
}
|
|
17145
17548
|
}, tryReadPackageJson = async (path) => {
|
|
@@ -17150,8 +17553,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
17150
17553
|
}
|
|
17151
17554
|
}, resolveAbsoluteVersion = async () => {
|
|
17152
17555
|
const candidates = [
|
|
17153
|
-
|
|
17154
|
-
|
|
17556
|
+
resolve25(import.meta.dir, "..", "..", "package.json"),
|
|
17557
|
+
resolve25(import.meta.dir, "..", "package.json")
|
|
17155
17558
|
];
|
|
17156
17559
|
const resolveCandidate = async (remaining) => {
|
|
17157
17560
|
const [candidate, ...rest] = remaining;
|
|
@@ -17167,9 +17570,9 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
17167
17570
|
};
|
|
17168
17571
|
await resolveCandidate(candidates);
|
|
17169
17572
|
}, SKIP_DIRS, addWorkerPathIfExists = (file4, relPath, workerPaths) => {
|
|
17170
|
-
const absPath =
|
|
17573
|
+
const absPath = resolve25(file4, "..", relPath);
|
|
17171
17574
|
try {
|
|
17172
|
-
|
|
17575
|
+
statSync3(absPath);
|
|
17173
17576
|
workerPaths.add(absPath);
|
|
17174
17577
|
} catch {}
|
|
17175
17578
|
}, collectWorkerPathsFromContent = (content, pattern, file4, workerPaths) => {
|
|
@@ -17182,7 +17585,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
17182
17585
|
addWorkerPathIfExists(file4, relPath, workerPaths);
|
|
17183
17586
|
}
|
|
17184
17587
|
}, collectWorkerPathsFromFile = (file4, patterns, workerPaths) => {
|
|
17185
|
-
const content =
|
|
17588
|
+
const content = readFileSync14(file4, "utf-8");
|
|
17186
17589
|
for (const pattern of patterns) {
|
|
17187
17590
|
collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
|
|
17188
17591
|
}
|
|
@@ -17213,8 +17616,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
17213
17616
|
vuePagesPath
|
|
17214
17617
|
}) => {
|
|
17215
17618
|
const { readdirSync: readDir } = await import("fs");
|
|
17216
|
-
const devIndexDir =
|
|
17217
|
-
|
|
17619
|
+
const devIndexDir = join26(buildPath, "_src_indexes");
|
|
17620
|
+
mkdirSync12(devIndexDir, { recursive: true });
|
|
17218
17621
|
if (reactIndexesPath && reactPagesPath) {
|
|
17219
17622
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
17220
17623
|
}
|
|
@@ -17225,41 +17628,41 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
17225
17628
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
17226
17629
|
}
|
|
17227
17630
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
17228
|
-
if (!
|
|
17631
|
+
if (!existsSync21(reactIndexesPath)) {
|
|
17229
17632
|
return;
|
|
17230
17633
|
}
|
|
17231
17634
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
17232
|
-
const pagesRel = relative13(process.cwd(),
|
|
17635
|
+
const pagesRel = relative13(process.cwd(), resolve25(reactPagesPath)).replace(/\\/g, "/");
|
|
17233
17636
|
for (const file4 of indexFiles) {
|
|
17234
|
-
let content =
|
|
17637
|
+
let content = readFileSync14(join26(reactIndexesPath, file4), "utf-8");
|
|
17235
17638
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
17236
|
-
|
|
17639
|
+
writeFileSync8(join26(devIndexDir, file4), content);
|
|
17237
17640
|
}
|
|
17238
17641
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
17239
|
-
const svelteIndexDir =
|
|
17240
|
-
const sveltePageEntries = svelteEntries.filter((file4) =>
|
|
17642
|
+
const svelteIndexDir = join26(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
17643
|
+
const sveltePageEntries = svelteEntries.filter((file4) => resolve25(file4).startsWith(resolve25(sveltePagesPath)));
|
|
17241
17644
|
for (const entry of sveltePageEntries) {
|
|
17242
|
-
const name =
|
|
17243
|
-
const indexFile =
|
|
17244
|
-
if (!
|
|
17645
|
+
const name = basename9(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
17646
|
+
const indexFile = join26(svelteIndexDir, "pages", `${name}.js`);
|
|
17647
|
+
if (!existsSync21(indexFile))
|
|
17245
17648
|
continue;
|
|
17246
|
-
let content =
|
|
17247
|
-
const srcRel = relative13(process.cwd(),
|
|
17649
|
+
let content = readFileSync14(indexFile, "utf-8");
|
|
17650
|
+
const srcRel = relative13(process.cwd(), resolve25(entry)).replace(/\\/g, "/");
|
|
17248
17651
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
17249
|
-
|
|
17652
|
+
writeFileSync8(join26(devIndexDir, `${name}.svelte.js`), content);
|
|
17250
17653
|
}
|
|
17251
17654
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
17252
|
-
const vueIndexDir =
|
|
17253
|
-
const vuePageEntries = vueEntries.filter((file4) =>
|
|
17655
|
+
const vueIndexDir = join26(getFrameworkGeneratedDir("vue"), "indexes");
|
|
17656
|
+
const vuePageEntries = vueEntries.filter((file4) => resolve25(file4).startsWith(resolve25(vuePagesPath)));
|
|
17254
17657
|
for (const entry of vuePageEntries) {
|
|
17255
|
-
const name =
|
|
17256
|
-
const indexFile =
|
|
17257
|
-
if (!
|
|
17658
|
+
const name = basename9(entry, ".vue");
|
|
17659
|
+
const indexFile = join26(vueIndexDir, `${name}.js`);
|
|
17660
|
+
if (!existsSync21(indexFile))
|
|
17258
17661
|
continue;
|
|
17259
|
-
let content =
|
|
17260
|
-
const srcRel = relative13(process.cwd(),
|
|
17662
|
+
let content = readFileSync14(indexFile, "utf-8");
|
|
17663
|
+
const srcRel = relative13(process.cwd(), resolve25(entry)).replace(/\\/g, "/");
|
|
17261
17664
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
17262
|
-
|
|
17665
|
+
writeFileSync8(join26(devIndexDir, `${name}.vue.js`), content);
|
|
17263
17666
|
}
|
|
17264
17667
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
17265
17668
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -17270,7 +17673,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
17270
17673
|
const last = allComments[allComments.length - 1];
|
|
17271
17674
|
if (!last?.[1])
|
|
17272
17675
|
return JSON.stringify(outputPath);
|
|
17273
|
-
const srcPath =
|
|
17676
|
+
const srcPath = resolve25(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
17274
17677
|
return JSON.stringify(srcPath);
|
|
17275
17678
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
17276
17679
|
let depth = 0;
|
|
@@ -17307,7 +17710,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
17307
17710
|
}
|
|
17308
17711
|
return result;
|
|
17309
17712
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
17310
|
-
let content =
|
|
17713
|
+
let content = readFileSync14(outputPath, "utf-8");
|
|
17311
17714
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
17312
17715
|
const useNames = [];
|
|
17313
17716
|
let match;
|
|
@@ -17328,13 +17731,13 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
17328
17731
|
content = `${content.slice(0, firstUseIdx) + runtime}
|
|
17329
17732
|
${content.slice(firstUseIdx)}`;
|
|
17330
17733
|
content = wrapUseFunctions(content, useNames);
|
|
17331
|
-
|
|
17734
|
+
writeFileSync8(outputPath, content);
|
|
17332
17735
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
17333
17736
|
const urlFileMap = new Map;
|
|
17334
17737
|
for (const srcPath of urlReferencedFiles) {
|
|
17335
17738
|
const rel = relative13(projectRoot, srcPath).replace(/\\/g, "/");
|
|
17336
|
-
const name =
|
|
17337
|
-
const mtime = Math.round(
|
|
17739
|
+
const name = basename9(srcPath);
|
|
17740
|
+
const mtime = Math.round(statSync3(srcPath).mtimeMs);
|
|
17338
17741
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
17339
17742
|
urlFileMap.set(name, url);
|
|
17340
17743
|
urlFileMap.set(name.replace(/\.tsx?$/, ".js"), url);
|
|
@@ -17343,11 +17746,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17343
17746
|
}, buildProdUrlFileMap = (urlReferencedFiles, buildPath, nonReactClientOutputs) => {
|
|
17344
17747
|
const urlFileMap = new Map;
|
|
17345
17748
|
for (const srcPath of urlReferencedFiles) {
|
|
17346
|
-
const srcBase =
|
|
17347
|
-
const output = nonReactClientOutputs.find((artifact) =>
|
|
17749
|
+
const srcBase = basename9(srcPath).replace(/\.[^.]+$/, "");
|
|
17750
|
+
const output = nonReactClientOutputs.find((artifact) => basename9(artifact.path).startsWith(`${srcBase}.`));
|
|
17348
17751
|
if (!output)
|
|
17349
17752
|
continue;
|
|
17350
|
-
urlFileMap.set(
|
|
17753
|
+
urlFileMap.set(basename9(srcPath), `/${relative13(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
17351
17754
|
}
|
|
17352
17755
|
return urlFileMap;
|
|
17353
17756
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -17357,10 +17760,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17357
17760
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
17358
17761
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
17359
17762
|
for (const outputPath of outputPaths) {
|
|
17360
|
-
let content =
|
|
17763
|
+
let content = readFileSync14(outputPath, "utf-8");
|
|
17361
17764
|
let changed = false;
|
|
17362
17765
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
17363
|
-
const targetName =
|
|
17766
|
+
const targetName = basename9(relPath);
|
|
17364
17767
|
const resolvedPath = urlFileMap.get(targetName);
|
|
17365
17768
|
if (!resolvedPath)
|
|
17366
17769
|
return _match;
|
|
@@ -17368,7 +17771,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17368
17771
|
return `new URL('${resolvedPath}', import.meta.url)`;
|
|
17369
17772
|
});
|
|
17370
17773
|
if (changed)
|
|
17371
|
-
|
|
17774
|
+
writeFileSync8(outputPath, content);
|
|
17372
17775
|
}
|
|
17373
17776
|
}, vueFeatureFlags, bunBuildPassKeys, bunBuildPassKeySet, reservedBunBuildConfigKeys, passLockedKeys, isObject = (value) => typeof value === "object" && value !== null, isBunBuildPassConfig = (config) => isObject(config) && Object.keys(config).some((key) => bunBuildPassKeySet.has(key)), sanitizeBunBuildOverride = (override, extraReservedKeys = new Set) => {
|
|
17374
17777
|
if (!override)
|
|
@@ -17481,10 +17884,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17481
17884
|
restoreTracePhase();
|
|
17482
17885
|
return;
|
|
17483
17886
|
}
|
|
17484
|
-
const traceDir =
|
|
17887
|
+
const traceDir = join26(buildPath2, ".absolute-trace");
|
|
17485
17888
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
17486
|
-
|
|
17487
|
-
|
|
17889
|
+
mkdirSync12(traceDir, { recursive: true });
|
|
17890
|
+
writeFileSync8(join26(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
17488
17891
|
events: traceEvents,
|
|
17489
17892
|
frameworks: traceFrameworkNames,
|
|
17490
17893
|
generatedAt: new Date().toISOString(),
|
|
@@ -17515,15 +17918,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17515
17918
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
17516
17919
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
17517
17920
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
17518
|
-
const reactIndexesPath = reactDir &&
|
|
17519
|
-
const reactPagesPath = reactDir &&
|
|
17520
|
-
const htmlPagesPath = htmlDir &&
|
|
17521
|
-
const htmlScriptsPath = htmlDir &&
|
|
17522
|
-
const sveltePagesPath = svelteDir &&
|
|
17523
|
-
const vuePagesPath = vueDir &&
|
|
17524
|
-
const htmxPagesPath = htmxDir &&
|
|
17525
|
-
const angularPagesPath = angularDir &&
|
|
17526
|
-
const emberPagesPath = emberDir &&
|
|
17921
|
+
const reactIndexesPath = reactDir && join26(getFrameworkGeneratedDir("react"), "indexes");
|
|
17922
|
+
const reactPagesPath = reactDir && join26(reactDir, "pages");
|
|
17923
|
+
const htmlPagesPath = htmlDir && join26(htmlDir, "pages");
|
|
17924
|
+
const htmlScriptsPath = htmlDir && join26(htmlDir, "scripts");
|
|
17925
|
+
const sveltePagesPath = svelteDir && join26(svelteDir, "pages");
|
|
17926
|
+
const vuePagesPath = vueDir && join26(vueDir, "pages");
|
|
17927
|
+
const htmxPagesPath = htmxDir && join26(htmxDir, "pages");
|
|
17928
|
+
const angularPagesPath = angularDir && join26(angularDir, "pages");
|
|
17929
|
+
const emberPagesPath = emberDir && join26(emberDir, "pages");
|
|
17527
17930
|
const frontends = [
|
|
17528
17931
|
reactDir,
|
|
17529
17932
|
htmlDir,
|
|
@@ -17554,7 +17957,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17554
17957
|
const sourceClientRoots = [
|
|
17555
17958
|
htmlDir,
|
|
17556
17959
|
htmxDir,
|
|
17557
|
-
islandBootstrapPath &&
|
|
17960
|
+
islandBootstrapPath && dirname16(islandBootstrapPath)
|
|
17558
17961
|
].filter((dir) => Boolean(dir));
|
|
17559
17962
|
const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
|
|
17560
17963
|
if (usesGenerated)
|
|
@@ -17582,26 +17985,26 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17582
17985
|
const [firstEntry] = serverDirMap;
|
|
17583
17986
|
if (!firstEntry)
|
|
17584
17987
|
throw new Error("Expected at least one server directory entry");
|
|
17585
|
-
serverRoot =
|
|
17586
|
-
serverOutDir =
|
|
17988
|
+
serverRoot = join26(firstEntry.dir, firstEntry.subdir);
|
|
17989
|
+
serverOutDir = join26(buildPath, basename9(firstEntry.dir));
|
|
17587
17990
|
} else if (serverDirMap.length > 1) {
|
|
17588
17991
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
17589
17992
|
serverOutDir = buildPath;
|
|
17590
17993
|
}
|
|
17591
17994
|
const publicPath = publicDirectory && validateSafePath(publicDirectory, projectRoot);
|
|
17592
|
-
await tracePhase("build-dir/create", () =>
|
|
17995
|
+
await tracePhase("build-dir/create", () => mkdirSync12(buildPath, { recursive: true }));
|
|
17593
17996
|
if (publicPath)
|
|
17594
17997
|
await tracePhase("public/copy", () => cpSync(publicPath, buildPath, { force: true, recursive: true }));
|
|
17595
17998
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
17596
17999
|
if (!isIncremental || !incrementalFiles)
|
|
17597
18000
|
return entryPoints;
|
|
17598
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f2) =>
|
|
18001
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve25(f2)));
|
|
17599
18002
|
const matchingEntries = [];
|
|
17600
18003
|
for (const entry of entryPoints) {
|
|
17601
18004
|
const sourceFile = mapToSource(entry);
|
|
17602
18005
|
if (!sourceFile)
|
|
17603
18006
|
continue;
|
|
17604
|
-
if (!normalizedIncremental.has(
|
|
18007
|
+
if (!normalizedIncremental.has(resolve25(sourceFile)))
|
|
17605
18008
|
continue;
|
|
17606
18009
|
matchingEntries.push(entry);
|
|
17607
18010
|
}
|
|
@@ -17611,7 +18014,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17611
18014
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
17612
18015
|
}
|
|
17613
18016
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
17614
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
18017
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join26(buildPath, "assets"), {
|
|
17615
18018
|
force: true,
|
|
17616
18019
|
recursive: true
|
|
17617
18020
|
}));
|
|
@@ -17721,11 +18124,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17721
18124
|
}
|
|
17722
18125
|
}
|
|
17723
18126
|
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
17724
|
-
const htmlConventionsOutDir =
|
|
17725
|
-
|
|
18127
|
+
const htmlConventionsOutDir = join26(buildPath, "conventions", "html");
|
|
18128
|
+
mkdirSync12(htmlConventionsOutDir, { recursive: true });
|
|
17726
18129
|
const htmlPathRemap = new Map;
|
|
17727
18130
|
for (const sourcePath of htmlConventionSources) {
|
|
17728
|
-
const dest =
|
|
18131
|
+
const dest = join26(htmlConventionsOutDir, basename9(sourcePath));
|
|
17729
18132
|
cpSync(sourcePath, dest, { force: true });
|
|
17730
18133
|
htmlPathRemap.set(sourcePath, dest);
|
|
17731
18134
|
}
|
|
@@ -17766,9 +18169,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17766
18169
|
}
|
|
17767
18170
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
17768
18171
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
17769
|
-
if (entry.startsWith(
|
|
17770
|
-
const pageName =
|
|
17771
|
-
return
|
|
18172
|
+
if (entry.startsWith(resolve25(reactIndexesPath))) {
|
|
18173
|
+
const pageName = basename9(entry, ".tsx");
|
|
18174
|
+
return join26(reactPagesPath, `${pageName}.tsx`);
|
|
17772
18175
|
}
|
|
17773
18176
|
return null;
|
|
17774
18177
|
}) : allReactEntries;
|
|
@@ -17828,14 +18231,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17828
18231
|
try {
|
|
17829
18232
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
17830
18233
|
const { readdir: readdir4 } = await import("fs/promises");
|
|
17831
|
-
const { join:
|
|
18234
|
+
const { join: join27 } = await import("path");
|
|
17832
18235
|
const walk = async (dir) => {
|
|
17833
18236
|
const entries = await readdir4(dir, {
|
|
17834
18237
|
withFileTypes: true
|
|
17835
18238
|
});
|
|
17836
18239
|
const out = [];
|
|
17837
18240
|
for (const entry of entries) {
|
|
17838
|
-
const full =
|
|
18241
|
+
const full = join27(dir, entry.name);
|
|
17839
18242
|
if (entry.isDirectory()) {
|
|
17840
18243
|
out.push(...await walk(full));
|
|
17841
18244
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -17873,7 +18276,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17873
18276
|
const clientPath = islandSvelteClientPaths[idx];
|
|
17874
18277
|
if (!sourcePath || !clientPath)
|
|
17875
18278
|
continue;
|
|
17876
|
-
islandSvelteClientPathMap.set(
|
|
18279
|
+
islandSvelteClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
17877
18280
|
}
|
|
17878
18281
|
const islandVueClientPathMap = new Map;
|
|
17879
18282
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -17881,7 +18284,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17881
18284
|
const clientPath = islandVueClientPaths[idx];
|
|
17882
18285
|
if (!sourcePath || !clientPath)
|
|
17883
18286
|
continue;
|
|
17884
|
-
islandVueClientPathMap.set(
|
|
18287
|
+
islandVueClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
17885
18288
|
}
|
|
17886
18289
|
const islandAngularClientPathMap = new Map;
|
|
17887
18290
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -17889,7 +18292,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17889
18292
|
const clientPath = islandAngularClientPaths[idx];
|
|
17890
18293
|
if (!sourcePath || !clientPath)
|
|
17891
18294
|
continue;
|
|
17892
|
-
islandAngularClientPathMap.set(
|
|
18295
|
+
islandAngularClientPathMap.set(resolve25(sourcePath), clientPath);
|
|
17893
18296
|
}
|
|
17894
18297
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
17895
18298
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -17900,9 +18303,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17900
18303
|
const compileReactConventions = async () => {
|
|
17901
18304
|
if (reactConventionSources.length === 0)
|
|
17902
18305
|
return emptyStringArray;
|
|
17903
|
-
const destDir =
|
|
18306
|
+
const destDir = join26(buildPath, "conventions", "react");
|
|
17904
18307
|
rmSync2(destDir, { force: true, recursive: true });
|
|
17905
|
-
|
|
18308
|
+
mkdirSync12(destDir, { recursive: true });
|
|
17906
18309
|
const destPaths = [];
|
|
17907
18310
|
for (let idx = 0;idx < reactConventionSources.length; idx++) {
|
|
17908
18311
|
const source = reactConventionSources[idx];
|
|
@@ -17916,7 +18319,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17916
18319
|
naming: `${idx}-[name].[ext]`,
|
|
17917
18320
|
outdir: destDir,
|
|
17918
18321
|
plugins: [stylePreprocessorPlugin2],
|
|
17919
|
-
root:
|
|
18322
|
+
root: dirname16(source),
|
|
17920
18323
|
target: "bun",
|
|
17921
18324
|
throw: false,
|
|
17922
18325
|
tsconfig: "./tsconfig.json"
|
|
@@ -17944,15 +18347,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
17944
18347
|
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 }
|
|
17945
18348
|
]);
|
|
17946
18349
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
17947
|
-
const destDir =
|
|
18350
|
+
const destDir = join26(buildPath, "conventions", framework);
|
|
17948
18351
|
rmSync2(destDir, { force: true, recursive: true });
|
|
17949
|
-
|
|
18352
|
+
mkdirSync12(destDir, { recursive: true });
|
|
17950
18353
|
const destPaths = [];
|
|
17951
18354
|
for (let idx = 0;idx < compiledPaths.length; idx++) {
|
|
17952
18355
|
const compiledPath = compiledPaths[idx];
|
|
17953
18356
|
if (!compiledPath)
|
|
17954
18357
|
continue;
|
|
17955
|
-
const name =
|
|
18358
|
+
const name = basename9(compiledPath).replace(/\.[^.]+$/, "");
|
|
17956
18359
|
const result = await bunBuild7({
|
|
17957
18360
|
entrypoints: [compiledPath],
|
|
17958
18361
|
format: "esm",
|
|
@@ -18018,7 +18421,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18018
18421
|
}
|
|
18019
18422
|
})) : {
|
|
18020
18423
|
entries: [],
|
|
18021
|
-
generatedRoot:
|
|
18424
|
+
generatedRoot: join26(buildPath, "_island_entries")
|
|
18022
18425
|
};
|
|
18023
18426
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
18024
18427
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -18054,7 +18457,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18054
18457
|
return {};
|
|
18055
18458
|
}
|
|
18056
18459
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
18057
|
-
const refreshEntry =
|
|
18460
|
+
const refreshEntry = join26(reactIndexesPath, "_refresh.tsx");
|
|
18058
18461
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
18059
18462
|
reactClientEntryPoints.push(refreshEntry);
|
|
18060
18463
|
}
|
|
@@ -18156,19 +18559,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18156
18559
|
throw: false
|
|
18157
18560
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
18158
18561
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
18159
|
-
rmSync2(
|
|
18562
|
+
rmSync2(join26(buildPath, "react", "generated", "indexes"), {
|
|
18160
18563
|
force: true,
|
|
18161
18564
|
recursive: true
|
|
18162
18565
|
});
|
|
18163
18566
|
}
|
|
18164
18567
|
if (angularDir && angularClientPaths.length > 0) {
|
|
18165
|
-
rmSync2(
|
|
18568
|
+
rmSync2(join26(buildPath, "angular", "indexes"), {
|
|
18166
18569
|
force: true,
|
|
18167
18570
|
recursive: true
|
|
18168
18571
|
});
|
|
18169
18572
|
}
|
|
18170
18573
|
if (islandClientEntryPoints.length > 0) {
|
|
18171
|
-
rmSync2(
|
|
18574
|
+
rmSync2(join26(buildPath, "islands"), {
|
|
18172
18575
|
force: true,
|
|
18173
18576
|
recursive: true
|
|
18174
18577
|
});
|
|
@@ -18188,8 +18591,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18188
18591
|
format: "esm",
|
|
18189
18592
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
18190
18593
|
outdir: serverOutDir,
|
|
18191
|
-
plugins: [
|
|
18594
|
+
plugins: [
|
|
18595
|
+
stylePreprocessorPlugin2,
|
|
18596
|
+
...serverOutDir ? [
|
|
18597
|
+
createExternalAssetPlugin(serverOutDir, allFrameworkDirs)
|
|
18598
|
+
] : []
|
|
18599
|
+
],
|
|
18192
18600
|
root: serverRoot,
|
|
18601
|
+
sourcemap: isDev ? "inline" : "none",
|
|
18193
18602
|
target: "bun",
|
|
18194
18603
|
throw: false,
|
|
18195
18604
|
tsconfig: "./tsconfig.json"
|
|
@@ -18251,7 +18660,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18251
18660
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
18252
18661
|
entrypoints: globalCssEntries,
|
|
18253
18662
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
18254
|
-
outdir: stylesDir ?
|
|
18663
|
+
outdir: stylesDir ? join26(buildPath, basename9(stylesDir)) : buildPath,
|
|
18255
18664
|
plugins: [stylePreprocessorPlugin2],
|
|
18256
18665
|
root: stylesDir || clientRoot,
|
|
18257
18666
|
target: "browser",
|
|
@@ -18260,13 +18669,20 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18260
18669
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
18261
18670
|
entrypoints: vueCssPaths,
|
|
18262
18671
|
naming: `[name].[hash].[ext]`,
|
|
18263
|
-
outdir:
|
|
18672
|
+
outdir: join26(buildPath, assetsPath ? basename9(assetsPath) : "assets", "css"),
|
|
18264
18673
|
target: "browser",
|
|
18265
18674
|
throw: false
|
|
18266
18675
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
18267
18676
|
]);
|
|
18268
18677
|
const serverLogs = serverResult?.logs ?? [];
|
|
18269
18678
|
const serverOutputs = serverResult?.outputs ?? [];
|
|
18679
|
+
if (isDev && serverResult?.success) {
|
|
18680
|
+
const { chainBundleInlineSourcemap: chainBundleInlineSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
|
|
18681
|
+
for (const out of serverOutputs) {
|
|
18682
|
+
if (out.path.endsWith(".js"))
|
|
18683
|
+
chainBundleInlineSourcemap2(out.path);
|
|
18684
|
+
}
|
|
18685
|
+
}
|
|
18270
18686
|
if (serverResult && !serverResult.success && serverLogs.length > 0) {
|
|
18271
18687
|
extractBuildError(serverLogs, "server", "Server", frameworkNames, isIncremental, throwOnError);
|
|
18272
18688
|
}
|
|
@@ -18327,7 +18743,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18327
18743
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
18328
18744
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
18329
18745
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
18330
|
-
const fileDir =
|
|
18746
|
+
const fileDir = dirname16(artifact.path);
|
|
18331
18747
|
const relativePaths = {};
|
|
18332
18748
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
18333
18749
|
const rel = relative13(fileDir, absolute);
|
|
@@ -18386,23 +18802,26 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18386
18802
|
for (const artifact of serverOutputs) {
|
|
18387
18803
|
if (extname8(artifact.path) !== ".js")
|
|
18388
18804
|
continue;
|
|
18389
|
-
const fileWithHash =
|
|
18805
|
+
const fileWithHash = basename9(artifact.path);
|
|
18390
18806
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
18391
18807
|
if (!baseName)
|
|
18392
18808
|
continue;
|
|
18393
18809
|
manifest[toPascal(baseName)] = artifact.path;
|
|
18394
18810
|
}
|
|
18395
18811
|
for (const serverPath of emberServerPaths) {
|
|
18396
|
-
const fileBase =
|
|
18812
|
+
const fileBase = basename9(serverPath, ".js");
|
|
18397
18813
|
manifest[toPascal(fileBase)] = serverPath;
|
|
18398
18814
|
}
|
|
18399
18815
|
if (skipAngularClientBundle) {
|
|
18400
18816
|
for (const clientPath of angularClientPaths) {
|
|
18401
|
-
const fileBase =
|
|
18817
|
+
const fileBase = basename9(clientPath, ".js");
|
|
18402
18818
|
const relFromCwd = relative13(projectRoot, clientPath).replace(/\\/g, "/");
|
|
18403
18819
|
manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
|
|
18404
18820
|
}
|
|
18405
18821
|
}
|
|
18822
|
+
const warnManifestKeyCollision = (key, previousPath, nextPath) => {
|
|
18823
|
+
logWarn(`Manifest key collision: "${key}" was "${previousPath}" and will be overwritten by "${nextPath}". Rename one of the conflicting pages so each manifest key is unique across html/htmx (and other framework) directories.`);
|
|
18824
|
+
};
|
|
18406
18825
|
const shouldCopyHtmx = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/htmx/") && f2.endsWith(".html"));
|
|
18407
18826
|
const shouldUpdateHtmlAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
18408
18827
|
const shouldUpdateHtmxAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/htmx/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
@@ -18410,19 +18829,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18410
18829
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
18411
18830
|
if (!hmrClientBundle)
|
|
18412
18831
|
return;
|
|
18413
|
-
let html =
|
|
18832
|
+
let html = readFileSync14(filePath, "utf-8");
|
|
18414
18833
|
if (html.includes("data-hmr-client"))
|
|
18415
18834
|
return;
|
|
18416
18835
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
18417
18836
|
const bodyClose = /<\/body\s*>/i.exec(html);
|
|
18418
18837
|
html = bodyClose ? html.slice(0, bodyClose.index) + tag + html.slice(bodyClose.index) : html + tag;
|
|
18419
|
-
|
|
18838
|
+
writeFileSync8(filePath, html);
|
|
18420
18839
|
};
|
|
18421
18840
|
const processHtmlPages = async () => {
|
|
18422
18841
|
if (!(htmlDir && htmlPagesPath))
|
|
18423
18842
|
return;
|
|
18424
|
-
const outputHtmlPages = isSingle ?
|
|
18425
|
-
|
|
18843
|
+
const outputHtmlPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmlDir), "pages");
|
|
18844
|
+
mkdirSync12(outputHtmlPages, { recursive: true });
|
|
18426
18845
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
18427
18846
|
force: true,
|
|
18428
18847
|
recursive: true
|
|
@@ -18436,21 +18855,24 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18436
18855
|
for (const htmlFile of htmlPageFiles) {
|
|
18437
18856
|
if (hmr)
|
|
18438
18857
|
injectHMRIntoHTMLFile(htmlFile, "html");
|
|
18439
|
-
const fileName =
|
|
18858
|
+
const fileName = basename9(htmlFile, ".html");
|
|
18859
|
+
if (manifest[fileName] && manifest[fileName] !== htmlFile) {
|
|
18860
|
+
warnManifestKeyCollision(fileName, manifest[fileName], htmlFile);
|
|
18861
|
+
}
|
|
18440
18862
|
manifest[fileName] = htmlFile;
|
|
18441
18863
|
}
|
|
18442
18864
|
};
|
|
18443
18865
|
const processHtmxPages = async () => {
|
|
18444
18866
|
if (!(htmxDir && htmxPagesPath))
|
|
18445
18867
|
return;
|
|
18446
|
-
const outputHtmxPages = isSingle ?
|
|
18447
|
-
|
|
18868
|
+
const outputHtmxPages = isSingle ? join26(buildPath, "pages") : join26(buildPath, basename9(htmxDir), "pages");
|
|
18869
|
+
mkdirSync12(outputHtmxPages, { recursive: true });
|
|
18448
18870
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
18449
18871
|
force: true,
|
|
18450
18872
|
recursive: true
|
|
18451
18873
|
});
|
|
18452
18874
|
if (shouldCopyHtmx) {
|
|
18453
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
18875
|
+
const htmxDestDir = isSingle ? buildPath : join26(buildPath, basename9(htmxDir));
|
|
18454
18876
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
18455
18877
|
}
|
|
18456
18878
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -18462,7 +18884,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18462
18884
|
for (const htmxFile of htmxPageFiles) {
|
|
18463
18885
|
if (hmr)
|
|
18464
18886
|
injectHMRIntoHTMLFile(htmxFile, "htmx");
|
|
18465
|
-
const fileName =
|
|
18887
|
+
const fileName = basename9(htmxFile, ".html");
|
|
18888
|
+
if (manifest[fileName] && manifest[fileName] !== htmxFile) {
|
|
18889
|
+
warnManifestKeyCollision(fileName, manifest[fileName], htmxFile);
|
|
18890
|
+
}
|
|
18466
18891
|
manifest[fileName] = htmxFile;
|
|
18467
18892
|
}
|
|
18468
18893
|
};
|
|
@@ -18512,9 +18937,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
18512
18937
|
writeBuildTrace(buildPath);
|
|
18513
18938
|
return { conventions: conventionsMap, manifest };
|
|
18514
18939
|
}
|
|
18515
|
-
|
|
18940
|
+
writeFileSync8(join26(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
18516
18941
|
if (Object.keys(conventionsMap).length > 0) {
|
|
18517
|
-
|
|
18942
|
+
writeFileSync8(join26(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
18518
18943
|
}
|
|
18519
18944
|
writeBuildTrace(buildPath);
|
|
18520
18945
|
if (tailwind && mode === "production") {
|
|
@@ -18547,6 +18972,7 @@ var init_build = __esm(() => {
|
|
|
18547
18972
|
init_rewriteReactImports();
|
|
18548
18973
|
init_telemetryEvent();
|
|
18549
18974
|
init_angularLinkerPlugin();
|
|
18975
|
+
init_externalAssetPlugin();
|
|
18550
18976
|
init_hmrInjectionPlugin();
|
|
18551
18977
|
init_cleanStaleOutputs();
|
|
18552
18978
|
init_cleanup();
|
|
@@ -18614,8 +19040,8 @@ var init_build = __esm(() => {
|
|
|
18614
19040
|
});
|
|
18615
19041
|
|
|
18616
19042
|
// src/build/buildEmberVendor.ts
|
|
18617
|
-
import { mkdirSync as
|
|
18618
|
-
import { join as
|
|
19043
|
+
import { mkdirSync as mkdirSync13, existsSync as existsSync22 } from "fs";
|
|
19044
|
+
import { join as join27 } from "path";
|
|
18619
19045
|
import { rm as rm9 } from "fs/promises";
|
|
18620
19046
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
18621
19047
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -18667,8 +19093,8 @@ export const importSync = (specifier) => {
|
|
|
18667
19093
|
if (standaloneSpecifiers.has(specifier)) {
|
|
18668
19094
|
return { resolveTo: specifier, specifier };
|
|
18669
19095
|
}
|
|
18670
|
-
const emberInternalPath =
|
|
18671
|
-
if (!
|
|
19096
|
+
const emberInternalPath = join27(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
19097
|
+
if (!existsSync22(emberInternalPath)) {
|
|
18672
19098
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
18673
19099
|
}
|
|
18674
19100
|
return { resolveTo: emberInternalPath, specifier };
|
|
@@ -18699,24 +19125,24 @@ export const importSync = (specifier) => {
|
|
|
18699
19125
|
if (standalonePackages.has(args.path)) {
|
|
18700
19126
|
return;
|
|
18701
19127
|
}
|
|
18702
|
-
const internal =
|
|
18703
|
-
if (
|
|
19128
|
+
const internal = join27(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
19129
|
+
if (existsSync22(internal)) {
|
|
18704
19130
|
return { path: internal };
|
|
18705
19131
|
}
|
|
18706
19132
|
return;
|
|
18707
19133
|
});
|
|
18708
19134
|
}
|
|
18709
19135
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
18710
|
-
const vendorDir =
|
|
18711
|
-
|
|
18712
|
-
const tmpDir =
|
|
18713
|
-
|
|
18714
|
-
const macrosShimPath =
|
|
19136
|
+
const vendorDir = join27(buildDir, "ember", "vendor");
|
|
19137
|
+
mkdirSync13(vendorDir, { recursive: true });
|
|
19138
|
+
const tmpDir = join27(buildDir, "_ember_vendor_tmp");
|
|
19139
|
+
mkdirSync13(tmpDir, { recursive: true });
|
|
19140
|
+
const macrosShimPath = join27(tmpDir, "embroider_macros_shim.js");
|
|
18715
19141
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
18716
19142
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
18717
19143
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
18718
19144
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
18719
|
-
const entryPath =
|
|
19145
|
+
const entryPath = join27(tmpDir, `${safeName}.js`);
|
|
18720
19146
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
18721
19147
|
` : generateVendorEntrySource2(resolution);
|
|
18722
19148
|
await Bun.write(entryPath, source);
|
|
@@ -18769,9 +19195,9 @@ __export(exports_dependencyGraph, {
|
|
|
18769
19195
|
buildInitialDependencyGraph: () => buildInitialDependencyGraph,
|
|
18770
19196
|
addFileToGraph: () => addFileToGraph
|
|
18771
19197
|
});
|
|
18772
|
-
import { existsSync as
|
|
19198
|
+
import { existsSync as existsSync23, readFileSync as readFileSync15 } from "fs";
|
|
18773
19199
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
18774
|
-
import { resolve as
|
|
19200
|
+
import { resolve as resolve26 } from "path";
|
|
18775
19201
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
18776
19202
|
const lower = filePath.toLowerCase();
|
|
18777
19203
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -18785,8 +19211,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
18785
19211
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
18786
19212
|
return null;
|
|
18787
19213
|
}
|
|
18788
|
-
const fromDir =
|
|
18789
|
-
const normalized =
|
|
19214
|
+
const fromDir = resolve26(fromFile, "..");
|
|
19215
|
+
const normalized = resolve26(fromDir, importPath);
|
|
18790
19216
|
const extensions = [
|
|
18791
19217
|
".ts",
|
|
18792
19218
|
".tsx",
|
|
@@ -18799,10 +19225,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
18799
19225
|
];
|
|
18800
19226
|
for (const ext of extensions) {
|
|
18801
19227
|
const withExt = normalized + ext;
|
|
18802
|
-
if (
|
|
19228
|
+
if (existsSync23(withExt))
|
|
18803
19229
|
return withExt;
|
|
18804
19230
|
}
|
|
18805
|
-
if (
|
|
19231
|
+
if (existsSync23(normalized))
|
|
18806
19232
|
return normalized;
|
|
18807
19233
|
return null;
|
|
18808
19234
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -18816,8 +19242,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
18816
19242
|
dependents.delete(normalizedPath);
|
|
18817
19243
|
}
|
|
18818
19244
|
}, addFileToGraph = (graph, filePath) => {
|
|
18819
|
-
const normalizedPath =
|
|
18820
|
-
if (!
|
|
19245
|
+
const normalizedPath = resolve26(filePath);
|
|
19246
|
+
if (!existsSync23(normalizedPath))
|
|
18821
19247
|
return;
|
|
18822
19248
|
const dependencies = extractDependencies(normalizedPath);
|
|
18823
19249
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -18843,10 +19269,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
18843
19269
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
18844
19270
|
const processedFiles = new Set;
|
|
18845
19271
|
const glob = new Glob9("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
18846
|
-
const resolvedDirs = directories.map((dir) =>
|
|
19272
|
+
const resolvedDirs = directories.map((dir) => resolve26(dir)).filter((dir) => existsSync23(dir));
|
|
18847
19273
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
18848
19274
|
for (const file4 of allFiles) {
|
|
18849
|
-
const fullPath =
|
|
19275
|
+
const fullPath = resolve26(file4);
|
|
18850
19276
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
18851
19277
|
continue;
|
|
18852
19278
|
if (processedFiles.has(fullPath))
|
|
@@ -18940,15 +19366,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
18940
19366
|
const lowerPath = filePath.toLowerCase();
|
|
18941
19367
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
18942
19368
|
if (loader === "html") {
|
|
18943
|
-
const content =
|
|
19369
|
+
const content = readFileSync15(filePath, "utf-8");
|
|
18944
19370
|
return extractHtmlDependencies(filePath, content);
|
|
18945
19371
|
}
|
|
18946
19372
|
if (loader === "tsx" || loader === "js") {
|
|
18947
|
-
const content =
|
|
19373
|
+
const content = readFileSync15(filePath, "utf-8");
|
|
18948
19374
|
return extractJsDependencies(filePath, content, loader);
|
|
18949
19375
|
}
|
|
18950
19376
|
if (isSvelteOrVue) {
|
|
18951
|
-
const content =
|
|
19377
|
+
const content = readFileSync15(filePath, "utf-8");
|
|
18952
19378
|
return extractSvelteVueDependencies(filePath, content);
|
|
18953
19379
|
}
|
|
18954
19380
|
return [];
|
|
@@ -18959,7 +19385,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
18959
19385
|
return [];
|
|
18960
19386
|
}
|
|
18961
19387
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
18962
|
-
const normalizedPath =
|
|
19388
|
+
const normalizedPath = resolve26(changedFile);
|
|
18963
19389
|
const affected = new Set;
|
|
18964
19390
|
const toProcess = [normalizedPath];
|
|
18965
19391
|
const processNode = (current) => {
|
|
@@ -18990,7 +19416,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
18990
19416
|
}, removeDependentsForFile = (graph, normalizedPath) => {
|
|
18991
19417
|
graph.dependents.delete(normalizedPath);
|
|
18992
19418
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
18993
|
-
const normalizedPath =
|
|
19419
|
+
const normalizedPath = resolve26(filePath);
|
|
18994
19420
|
removeDepsForFile(graph, normalizedPath);
|
|
18995
19421
|
removeDependentsForFile(graph, normalizedPath);
|
|
18996
19422
|
};
|
|
@@ -19033,12 +19459,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
19033
19459
|
};
|
|
19034
19460
|
|
|
19035
19461
|
// src/dev/configResolver.ts
|
|
19036
|
-
import { resolve as
|
|
19462
|
+
import { resolve as resolve27 } from "path";
|
|
19037
19463
|
var resolveBuildPaths = (config) => {
|
|
19038
19464
|
const cwd2 = process.cwd();
|
|
19039
19465
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
19040
|
-
const withDefault = (value, fallback) => normalize(
|
|
19041
|
-
const optional = (value) => value ? normalize(
|
|
19466
|
+
const withDefault = (value, fallback) => normalize(resolve27(cwd2, value ?? fallback));
|
|
19467
|
+
const optional = (value) => value ? normalize(resolve27(cwd2, value)) : undefined;
|
|
19042
19468
|
return {
|
|
19043
19469
|
angularDir: optional(config.angularDirectory),
|
|
19044
19470
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -19091,8 +19517,8 @@ var init_clientManager = __esm(() => {
|
|
|
19091
19517
|
});
|
|
19092
19518
|
|
|
19093
19519
|
// src/dev/pathUtils.ts
|
|
19094
|
-
import { existsSync as
|
|
19095
|
-
import { dirname as
|
|
19520
|
+
import { existsSync as existsSync24, readdirSync, readFileSync as readFileSync16 } from "fs";
|
|
19521
|
+
import { dirname as dirname17, resolve as resolve28 } from "path";
|
|
19096
19522
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
19097
19523
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
19098
19524
|
return "ignored";
|
|
@@ -19168,7 +19594,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
19168
19594
|
return "unknown";
|
|
19169
19595
|
}, collectAngularResourceDirs = (angularDir) => {
|
|
19170
19596
|
const out = new Set;
|
|
19171
|
-
const angularRoot =
|
|
19597
|
+
const angularRoot = resolve28(angularDir);
|
|
19172
19598
|
const angularRootNormalized = normalizePath(angularRoot);
|
|
19173
19599
|
const walk = (dir) => {
|
|
19174
19600
|
let entries;
|
|
@@ -19181,7 +19607,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
19181
19607
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
19182
19608
|
continue;
|
|
19183
19609
|
}
|
|
19184
|
-
const full =
|
|
19610
|
+
const full = resolve28(dir, entry.name);
|
|
19185
19611
|
if (entry.isDirectory()) {
|
|
19186
19612
|
walk(full);
|
|
19187
19613
|
continue;
|
|
@@ -19191,7 +19617,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
19191
19617
|
}
|
|
19192
19618
|
let source;
|
|
19193
19619
|
try {
|
|
19194
|
-
source =
|
|
19620
|
+
source = readFileSync16(full, "utf8");
|
|
19195
19621
|
} catch {
|
|
19196
19622
|
continue;
|
|
19197
19623
|
}
|
|
@@ -19220,10 +19646,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
19220
19646
|
refs.push(strMatch[1]);
|
|
19221
19647
|
}
|
|
19222
19648
|
}
|
|
19223
|
-
const componentDir =
|
|
19649
|
+
const componentDir = dirname17(full);
|
|
19224
19650
|
for (const ref of refs) {
|
|
19225
|
-
const refAbs = normalizePath(
|
|
19226
|
-
const refDir = normalizePath(
|
|
19651
|
+
const refAbs = normalizePath(resolve28(componentDir, ref));
|
|
19652
|
+
const refDir = normalizePath(dirname17(refAbs));
|
|
19227
19653
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
19228
19654
|
continue;
|
|
19229
19655
|
}
|
|
@@ -19239,7 +19665,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
19239
19665
|
const push = (path) => {
|
|
19240
19666
|
if (!path)
|
|
19241
19667
|
return;
|
|
19242
|
-
const abs = normalizePath(
|
|
19668
|
+
const abs = normalizePath(resolve28(cwd2, path));
|
|
19243
19669
|
if (!roots.includes(abs))
|
|
19244
19670
|
roots.push(abs);
|
|
19245
19671
|
};
|
|
@@ -19264,8 +19690,8 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
19264
19690
|
push(cfg.assetsDir);
|
|
19265
19691
|
push(cfg.stylesDir);
|
|
19266
19692
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
19267
|
-
const abs = normalizePath(
|
|
19268
|
-
if (
|
|
19693
|
+
const abs = normalizePath(resolve28(cwd2, candidate));
|
|
19694
|
+
if (existsSync24(abs) && !roots.includes(abs))
|
|
19269
19695
|
roots.push(abs);
|
|
19270
19696
|
}
|
|
19271
19697
|
try {
|
|
@@ -19276,7 +19702,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
19276
19702
|
continue;
|
|
19277
19703
|
if (entry.name.startsWith("."))
|
|
19278
19704
|
continue;
|
|
19279
|
-
const abs = normalizePath(
|
|
19705
|
+
const abs = normalizePath(resolve28(cwd2, entry.name));
|
|
19280
19706
|
if (roots.includes(abs))
|
|
19281
19707
|
continue;
|
|
19282
19708
|
if (shouldIgnorePath(abs, resolved))
|
|
@@ -19350,8 +19776,8 @@ var init_pathUtils = __esm(() => {
|
|
|
19350
19776
|
|
|
19351
19777
|
// src/dev/fileWatcher.ts
|
|
19352
19778
|
import { watch } from "fs";
|
|
19353
|
-
import { existsSync as
|
|
19354
|
-
import { dirname as
|
|
19779
|
+
import { existsSync as existsSync25, readdirSync as readdirSync2, statSync as statSync4 } from "fs";
|
|
19780
|
+
import { dirname as dirname18, join as join28, resolve as resolve29 } from "path";
|
|
19355
19781
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
19356
19782
|
try {
|
|
19357
19783
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -19384,10 +19810,10 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
19384
19810
|
for (const name of entries) {
|
|
19385
19811
|
if (shouldSkipFilename(name, isStylesDir))
|
|
19386
19812
|
continue;
|
|
19387
|
-
const child =
|
|
19813
|
+
const child = join28(eventDir, name).replace(/\\/g, "/");
|
|
19388
19814
|
let st2;
|
|
19389
19815
|
try {
|
|
19390
|
-
st2 =
|
|
19816
|
+
st2 = statSync4(child);
|
|
19391
19817
|
} catch {
|
|
19392
19818
|
continue;
|
|
19393
19819
|
}
|
|
@@ -19409,21 +19835,21 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
19409
19835
|
return;
|
|
19410
19836
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
19411
19837
|
if (event === "rename") {
|
|
19412
|
-
const eventDir =
|
|
19838
|
+
const eventDir = dirname18(join28(absolutePath, filename)).replace(/\\/g, "/");
|
|
19413
19839
|
atomicRecoveryScan(eventDir);
|
|
19414
19840
|
}
|
|
19415
19841
|
return;
|
|
19416
19842
|
}
|
|
19417
|
-
const fullPath =
|
|
19843
|
+
const fullPath = join28(absolutePath, filename).replace(/\\/g, "/");
|
|
19418
19844
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
19419
19845
|
return;
|
|
19420
19846
|
}
|
|
19421
|
-
if (event === "rename" && !
|
|
19847
|
+
if (event === "rename" && !existsSync25(fullPath)) {
|
|
19422
19848
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
19423
19849
|
onFileChange(fullPath);
|
|
19424
19850
|
return;
|
|
19425
19851
|
}
|
|
19426
|
-
if (
|
|
19852
|
+
if (existsSync25(fullPath)) {
|
|
19427
19853
|
onFileChange(fullPath);
|
|
19428
19854
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
19429
19855
|
}
|
|
@@ -19432,8 +19858,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
19432
19858
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
19433
19859
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
19434
19860
|
paths.forEach((path) => {
|
|
19435
|
-
const absolutePath =
|
|
19436
|
-
if (!
|
|
19861
|
+
const absolutePath = resolve29(path).replace(/\\/g, "/");
|
|
19862
|
+
if (!existsSync25(absolutePath)) {
|
|
19437
19863
|
return;
|
|
19438
19864
|
}
|
|
19439
19865
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -19443,8 +19869,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
19443
19869
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
19444
19870
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
19445
19871
|
watchPaths.forEach((path) => {
|
|
19446
|
-
const absolutePath =
|
|
19447
|
-
if (!
|
|
19872
|
+
const absolutePath = resolve29(path).replace(/\\/g, "/");
|
|
19873
|
+
if (!existsSync25(absolutePath)) {
|
|
19448
19874
|
return;
|
|
19449
19875
|
}
|
|
19450
19876
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -19457,19 +19883,18 @@ var init_fileWatcher = __esm(() => {
|
|
|
19457
19883
|
init_pathUtils();
|
|
19458
19884
|
ATOMIC_WRITE_TEMP_PATTERNS = [
|
|
19459
19885
|
/(^|\/)sed[A-Za-z0-9]{6,}$/,
|
|
19460
|
-
/(^|\/)4913
|
|
19461
|
-
/(^|\/)\.absolutejs-hmr-/
|
|
19886
|
+
/(^|\/)4913$/
|
|
19462
19887
|
];
|
|
19463
19888
|
});
|
|
19464
19889
|
|
|
19465
19890
|
// src/dev/assetStore.ts
|
|
19466
|
-
import { resolve as
|
|
19891
|
+
import { resolve as resolve30 } from "path";
|
|
19467
19892
|
import { readdir as readdir4, unlink } from "fs/promises";
|
|
19468
19893
|
var mimeTypes, getMimeType = (filePath) => {
|
|
19469
19894
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
19470
19895
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
19471
19896
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
19472
|
-
const fullPath =
|
|
19897
|
+
const fullPath = resolve30(dir, entry.name);
|
|
19473
19898
|
if (entry.isDirectory()) {
|
|
19474
19899
|
return walkAndClean(fullPath);
|
|
19475
19900
|
}
|
|
@@ -19485,10 +19910,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
19485
19910
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
19486
19911
|
const liveByIdentity = new Map;
|
|
19487
19912
|
for (const webPath of store.keys()) {
|
|
19488
|
-
const diskPath =
|
|
19913
|
+
const diskPath = resolve30(buildDir, webPath.slice(1));
|
|
19489
19914
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
19490
19915
|
}
|
|
19491
|
-
const absBuildDir =
|
|
19916
|
+
const absBuildDir = resolve30(buildDir);
|
|
19492
19917
|
Object.values(manifest).forEach((val) => {
|
|
19493
19918
|
if (!HASHED_FILE_RE.test(val))
|
|
19494
19919
|
return;
|
|
@@ -19506,7 +19931,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
19506
19931
|
} catch {}
|
|
19507
19932
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
19508
19933
|
if (entry.isDirectory()) {
|
|
19509
|
-
return scanDir(
|
|
19934
|
+
return scanDir(resolve30(dir, entry.name), `${prefix}${entry.name}/`);
|
|
19510
19935
|
}
|
|
19511
19936
|
if (!entry.name.startsWith("chunk-")) {
|
|
19512
19937
|
return null;
|
|
@@ -19515,7 +19940,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
19515
19940
|
if (store.has(webPath)) {
|
|
19516
19941
|
return null;
|
|
19517
19942
|
}
|
|
19518
|
-
return Bun.file(
|
|
19943
|
+
return Bun.file(resolve30(dir, entry.name)).bytes().then((bytes) => {
|
|
19519
19944
|
store.set(webPath, bytes);
|
|
19520
19945
|
return;
|
|
19521
19946
|
}).catch(() => {});
|
|
@@ -19537,7 +19962,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
19537
19962
|
for (const webPath of newIdentities.values()) {
|
|
19538
19963
|
if (store.has(webPath))
|
|
19539
19964
|
continue;
|
|
19540
|
-
loadPromises.push(Bun.file(
|
|
19965
|
+
loadPromises.push(Bun.file(resolve30(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
19541
19966
|
store.set(webPath, bytes);
|
|
19542
19967
|
return;
|
|
19543
19968
|
}).catch(() => {}));
|
|
@@ -19567,8 +19992,8 @@ var init_assetStore = __esm(() => {
|
|
|
19567
19992
|
});
|
|
19568
19993
|
|
|
19569
19994
|
// src/islands/pageMetadata.ts
|
|
19570
|
-
import { readFileSync as
|
|
19571
|
-
import { dirname as
|
|
19995
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
19996
|
+
import { dirname as dirname19, resolve as resolve31 } from "path";
|
|
19572
19997
|
var pagePatterns, getPageDirs = (config) => [
|
|
19573
19998
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
19574
19999
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -19588,15 +20013,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
19588
20013
|
const source = definition.buildReference?.source;
|
|
19589
20014
|
if (!source)
|
|
19590
20015
|
continue;
|
|
19591
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
19592
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
20016
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve31(dirname19(buildInfo.resolvedRegistryPath), source);
|
|
20017
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve31(resolvedSource));
|
|
19593
20018
|
}
|
|
19594
20019
|
return lookup;
|
|
19595
20020
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
|
|
19596
20021
|
const candidate = usage.source;
|
|
19597
|
-
return candidate ?
|
|
20022
|
+
return candidate ? resolve31(candidate) === target : false;
|
|
19598
20023
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
19599
|
-
const target =
|
|
20024
|
+
const target = resolve31(sourcePath);
|
|
19600
20025
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
19601
20026
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
19602
20027
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -19608,13 +20033,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
19608
20033
|
const pattern = pagePatterns[entry.framework];
|
|
19609
20034
|
if (!pattern)
|
|
19610
20035
|
return;
|
|
19611
|
-
const files = await scanEntryPoints(
|
|
20036
|
+
const files = await scanEntryPoints(resolve31(entry.dir), pattern);
|
|
19612
20037
|
for (const filePath of files) {
|
|
19613
|
-
const source =
|
|
20038
|
+
const source = readFileSync17(filePath, "utf-8");
|
|
19614
20039
|
const islands = extractIslandUsagesFromSource(source);
|
|
19615
|
-
pageMetadata.set(
|
|
20040
|
+
pageMetadata.set(resolve31(filePath), {
|
|
19616
20041
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
19617
|
-
pagePath:
|
|
20042
|
+
pagePath: resolve31(filePath)
|
|
19618
20043
|
});
|
|
19619
20044
|
}
|
|
19620
20045
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -19641,10 +20066,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
19641
20066
|
});
|
|
19642
20067
|
|
|
19643
20068
|
// src/dev/fileHashTracker.ts
|
|
19644
|
-
import { readFileSync as
|
|
20069
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
19645
20070
|
var computeFileHash = (filePath) => {
|
|
19646
20071
|
try {
|
|
19647
|
-
const fileContent =
|
|
20072
|
+
const fileContent = readFileSync18(filePath);
|
|
19648
20073
|
return Number(Bun.hash(fileContent));
|
|
19649
20074
|
} catch {
|
|
19650
20075
|
return UNFOUND_INDEX;
|
|
@@ -19737,9 +20162,9 @@ var init_transformCache = __esm(() => {
|
|
|
19737
20162
|
});
|
|
19738
20163
|
|
|
19739
20164
|
// src/dev/reactComponentClassifier.ts
|
|
19740
|
-
import { resolve as
|
|
20165
|
+
import { resolve as resolve32 } from "path";
|
|
19741
20166
|
var classifyComponent = (filePath) => {
|
|
19742
|
-
const normalizedPath =
|
|
20167
|
+
const normalizedPath = resolve32(filePath);
|
|
19743
20168
|
if (normalizedPath.includes("/react/pages/")) {
|
|
19744
20169
|
return "server";
|
|
19745
20170
|
}
|
|
@@ -19751,7 +20176,7 @@ var classifyComponent = (filePath) => {
|
|
|
19751
20176
|
var init_reactComponentClassifier = () => {};
|
|
19752
20177
|
|
|
19753
20178
|
// src/dev/moduleMapper.ts
|
|
19754
|
-
import { basename as
|
|
20179
|
+
import { basename as basename10, resolve as resolve33 } from "path";
|
|
19755
20180
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
19756
20181
|
const modulePaths = {};
|
|
19757
20182
|
moduleKeys.forEach((key) => {
|
|
@@ -19761,7 +20186,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
19761
20186
|
});
|
|
19762
20187
|
return modulePaths;
|
|
19763
20188
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
19764
|
-
const normalizedFile =
|
|
20189
|
+
const normalizedFile = resolve33(sourceFile);
|
|
19765
20190
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
19766
20191
|
if (processedFiles.has(normalizedFile)) {
|
|
19767
20192
|
return null;
|
|
@@ -19797,8 +20222,8 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
19797
20222
|
});
|
|
19798
20223
|
return grouped;
|
|
19799
20224
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
19800
|
-
const normalizedFile =
|
|
19801
|
-
const fileName =
|
|
20225
|
+
const normalizedFile = resolve33(sourceFile);
|
|
20226
|
+
const fileName = basename10(normalizedFile);
|
|
19802
20227
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
19803
20228
|
const pascalName = toPascal(baseName);
|
|
19804
20229
|
const keys = [];
|
|
@@ -19858,8 +20283,8 @@ __export(exports_resolveOwningComponents, {
|
|
|
19858
20283
|
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
19859
20284
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
19860
20285
|
});
|
|
19861
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
19862
|
-
import { dirname as
|
|
20286
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync19, statSync as statSync5 } from "fs";
|
|
20287
|
+
import { dirname as dirname20, extname as extname9, join as join29, resolve as resolve34 } from "path";
|
|
19863
20288
|
import ts7 from "typescript";
|
|
19864
20289
|
var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
19865
20290
|
const out = [];
|
|
@@ -19874,7 +20299,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
19874
20299
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
19875
20300
|
continue;
|
|
19876
20301
|
}
|
|
19877
|
-
const full =
|
|
20302
|
+
const full = join29(dir, entry.name);
|
|
19878
20303
|
if (entry.isDirectory()) {
|
|
19879
20304
|
visit(full);
|
|
19880
20305
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -19918,7 +20343,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
19918
20343
|
}, parseDecoratedClasses = (filePath) => {
|
|
19919
20344
|
let source;
|
|
19920
20345
|
try {
|
|
19921
|
-
source =
|
|
20346
|
+
source = readFileSync19(filePath, "utf8");
|
|
19922
20347
|
} catch {
|
|
19923
20348
|
return [];
|
|
19924
20349
|
}
|
|
@@ -19972,7 +20397,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
19972
20397
|
};
|
|
19973
20398
|
visit(sourceFile);
|
|
19974
20399
|
return out;
|
|
19975
|
-
}, safeNormalize = (path) =>
|
|
20400
|
+
}, safeNormalize = (path) => resolve34(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
19976
20401
|
const { changedFilePath, userAngularRoot } = params;
|
|
19977
20402
|
const changedAbs = safeNormalize(changedFilePath);
|
|
19978
20403
|
const out = [];
|
|
@@ -19993,7 +20418,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
19993
20418
|
}
|
|
19994
20419
|
let rootStat;
|
|
19995
20420
|
try {
|
|
19996
|
-
rootStat =
|
|
20421
|
+
rootStat = statSync5(userAngularRoot);
|
|
19997
20422
|
} catch {
|
|
19998
20423
|
return out;
|
|
19999
20424
|
}
|
|
@@ -20008,12 +20433,12 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
20008
20433
|
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
20009
20434
|
let source;
|
|
20010
20435
|
try {
|
|
20011
|
-
source =
|
|
20436
|
+
source = readFileSync19(childFilePath, "utf8");
|
|
20012
20437
|
} catch {
|
|
20013
20438
|
return null;
|
|
20014
20439
|
}
|
|
20015
20440
|
const sf = ts7.createSourceFile(childFilePath, source, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
20016
|
-
const childDir =
|
|
20441
|
+
const childDir = dirname20(childFilePath);
|
|
20017
20442
|
for (const stmt of sf.statements) {
|
|
20018
20443
|
if (!ts7.isImportDeclaration(stmt))
|
|
20019
20444
|
continue;
|
|
@@ -20041,7 +20466,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
20041
20466
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
20042
20467
|
return null;
|
|
20043
20468
|
}
|
|
20044
|
-
const base =
|
|
20469
|
+
const base = resolve34(childDir, spec);
|
|
20045
20470
|
const candidates = [
|
|
20046
20471
|
`${base}.ts`,
|
|
20047
20472
|
`${base}.tsx`,
|
|
@@ -20051,7 +20476,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
20051
20476
|
const angularRootNorm = safeNormalize(angularRoot);
|
|
20052
20477
|
for (const candidate of candidates) {
|
|
20053
20478
|
try {
|
|
20054
|
-
if (
|
|
20479
|
+
if (statSync5(candidate).isFile()) {
|
|
20055
20480
|
const norm = safeNormalize(candidate);
|
|
20056
20481
|
if (!norm.startsWith(angularRootNorm))
|
|
20057
20482
|
return null;
|
|
@@ -20070,7 +20495,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
20070
20495
|
const parentFile = new Map;
|
|
20071
20496
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
20072
20497
|
const classes = parseDecoratedClasses(tsPath);
|
|
20073
|
-
const componentDir =
|
|
20498
|
+
const componentDir = dirname20(tsPath);
|
|
20074
20499
|
for (const cls of classes) {
|
|
20075
20500
|
const entity = {
|
|
20076
20501
|
className: cls.className,
|
|
@@ -20079,7 +20504,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
20079
20504
|
};
|
|
20080
20505
|
if (cls.kind === "component") {
|
|
20081
20506
|
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
20082
|
-
const abs = safeNormalize(
|
|
20507
|
+
const abs = safeNormalize(resolve34(componentDir, url));
|
|
20083
20508
|
const existing = resource.get(abs);
|
|
20084
20509
|
if (existing)
|
|
20085
20510
|
existing.push(entity);
|
|
@@ -20106,7 +20531,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
20106
20531
|
const norm = safeNormalize(params.changedFilePath);
|
|
20107
20532
|
let rootStat;
|
|
20108
20533
|
try {
|
|
20109
|
-
rootStat =
|
|
20534
|
+
rootStat = statSync5(params.userAngularRoot);
|
|
20110
20535
|
} catch {
|
|
20111
20536
|
return [];
|
|
20112
20537
|
}
|
|
@@ -20264,7 +20689,7 @@ __export(exports_loadConfig, {
|
|
|
20264
20689
|
isWorkspaceConfig: () => isWorkspaceConfig,
|
|
20265
20690
|
getWorkspaceServices: () => getWorkspaceServices
|
|
20266
20691
|
});
|
|
20267
|
-
import { resolve as
|
|
20692
|
+
import { resolve as resolve35 } from "path";
|
|
20268
20693
|
var RESERVED_TOP_LEVEL_KEYS, isObject2 = (value) => typeof value === "object" && value !== null, isCommandService = (service) => service.kind === "command" || Array.isArray(service.command), isServiceCandidate = (value) => isObject2(value) && (typeof value.entry === "string" || Array.isArray(value.command)), isWorkspaceConfig = (config) => {
|
|
20269
20694
|
if (!isObject2(config)) {
|
|
20270
20695
|
return false;
|
|
@@ -20315,7 +20740,7 @@ var RESERVED_TOP_LEVEL_KEYS, isObject2 = (value) => typeof value === "object" &&
|
|
|
20315
20740
|
}
|
|
20316
20741
|
return config;
|
|
20317
20742
|
}, loadRawConfig = async (configPath2) => {
|
|
20318
|
-
const resolved =
|
|
20743
|
+
const resolved = resolve35(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
20319
20744
|
const mod = await import(resolved);
|
|
20320
20745
|
const config = mod.default ?? mod.config;
|
|
20321
20746
|
if (!config) {
|
|
@@ -20375,8 +20800,8 @@ __export(exports_moduleServer, {
|
|
|
20375
20800
|
createModuleServer: () => createModuleServer,
|
|
20376
20801
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
20377
20802
|
});
|
|
20378
|
-
import { existsSync as
|
|
20379
|
-
import { basename as
|
|
20803
|
+
import { existsSync as existsSync26, readFileSync as readFileSync20, statSync as statSync6 } from "fs";
|
|
20804
|
+
import { basename as basename11, dirname as dirname21, extname as extname10, join as join30, resolve as resolve36, relative as relative14 } from "path";
|
|
20380
20805
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
20381
20806
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
20382
20807
|
const allExports = [];
|
|
@@ -20396,7 +20821,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
20396
20821
|
${stubs}
|
|
20397
20822
|
`;
|
|
20398
20823
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
20399
|
-
const found = extensions.find((ext) =>
|
|
20824
|
+
const found = extensions.find((ext) => existsSync26(resolve36(projectRoot, srcPath + ext)));
|
|
20400
20825
|
return found ? srcPath + found : srcPath;
|
|
20401
20826
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
20402
20827
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -20411,24 +20836,24 @@ ${stubs}
|
|
|
20411
20836
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
20412
20837
|
}, srcUrl = (relPath, projectRoot) => {
|
|
20413
20838
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
20414
|
-
const absPath =
|
|
20839
|
+
const absPath = resolve36(projectRoot, relPath);
|
|
20415
20840
|
const cached = mtimeCache.get(absPath);
|
|
20416
20841
|
if (cached !== undefined)
|
|
20417
20842
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
20418
20843
|
try {
|
|
20419
|
-
const mtime = Math.round(
|
|
20844
|
+
const mtime = Math.round(statSync6(absPath).mtimeMs);
|
|
20420
20845
|
mtimeCache.set(absPath, mtime);
|
|
20421
20846
|
return `${base}?v=${buildVersion(mtime, absPath)}`;
|
|
20422
20847
|
} catch {
|
|
20423
20848
|
return base;
|
|
20424
20849
|
}
|
|
20425
20850
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
20426
|
-
const absPath =
|
|
20851
|
+
const absPath = resolve36(fileDir, relPath);
|
|
20427
20852
|
const rel = relative14(projectRoot, absPath);
|
|
20428
20853
|
const extension = extname10(rel);
|
|
20429
20854
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
20430
20855
|
if (extname10(srcPath) === ".svelte") {
|
|
20431
|
-
srcPath = relative14(projectRoot, resolveSvelteModulePath(
|
|
20856
|
+
srcPath = relative14(projectRoot, resolveSvelteModulePath(resolve36(projectRoot, srcPath)));
|
|
20432
20857
|
}
|
|
20433
20858
|
return srcUrl(srcPath, projectRoot);
|
|
20434
20859
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -20447,14 +20872,14 @@ ${stubs}
|
|
|
20447
20872
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
20448
20873
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
20449
20874
|
if (!subpath) {
|
|
20450
|
-
const pkgDir =
|
|
20451
|
-
const pkgJsonPath =
|
|
20452
|
-
if (
|
|
20453
|
-
const pkg = JSON.parse(
|
|
20875
|
+
const pkgDir = resolve36(projectRoot, "node_modules", packageName ?? "");
|
|
20876
|
+
const pkgJsonPath = join30(pkgDir, "package.json");
|
|
20877
|
+
if (existsSync26(pkgJsonPath)) {
|
|
20878
|
+
const pkg = JSON.parse(readFileSync20(pkgJsonPath, "utf-8"));
|
|
20454
20879
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
20455
20880
|
if (esmEntry) {
|
|
20456
|
-
const resolved =
|
|
20457
|
-
if (
|
|
20881
|
+
const resolved = resolve36(pkgDir, esmEntry);
|
|
20882
|
+
if (existsSync26(resolved))
|
|
20458
20883
|
return relative14(projectRoot, resolved);
|
|
20459
20884
|
}
|
|
20460
20885
|
}
|
|
@@ -20485,7 +20910,7 @@ ${stubs}
|
|
|
20485
20910
|
};
|
|
20486
20911
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
20487
20912
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
20488
|
-
const fileDir =
|
|
20913
|
+
const fileDir = dirname21(filePath);
|
|
20489
20914
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
20490
20915
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
20491
20916
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
@@ -20500,12 +20925,12 @@ ${stubs}
|
|
|
20500
20925
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
20501
20926
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
20502
20927
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
20503
|
-
const absPath =
|
|
20928
|
+
const absPath = resolve36(fileDir, relPath);
|
|
20504
20929
|
const rel = relative14(projectRoot, absPath);
|
|
20505
20930
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
20506
20931
|
});
|
|
20507
20932
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
20508
|
-
const absPath =
|
|
20933
|
+
const absPath = resolve36(fileDir, relPath);
|
|
20509
20934
|
const rel = relative14(projectRoot, absPath);
|
|
20510
20935
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
20511
20936
|
});
|
|
@@ -20551,7 +20976,7 @@ ${code}`;
|
|
|
20551
20976
|
reactFastRefreshWarningEmitted = true;
|
|
20552
20977
|
logWarn("React HMR is blocked: this Bun build ignores " + "`reactFastRefresh` on Bun.Transpiler, so component state " + "cannot be preserved across edits. Tracking " + "https://github.com/oven-sh/bun/pull/28312 \u2014 if it still has " + "not merged, leave a \uD83D\uDC4D on the PR so the Bun team knows it " + "is blocking you. Until then, React edits trigger a full " + "reload instead of a fast refresh.");
|
|
20553
20978
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
20554
|
-
const raw =
|
|
20979
|
+
const raw = readFileSync20(filePath, "utf-8");
|
|
20555
20980
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
20556
20981
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
20557
20982
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -20567,7 +20992,7 @@ ${transpiled}`;
|
|
|
20567
20992
|
transpiled += buildIslandMetadataExports(raw);
|
|
20568
20993
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
20569
20994
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
20570
|
-
const raw =
|
|
20995
|
+
const raw = readFileSync20(filePath, "utf-8");
|
|
20571
20996
|
const ext = extname10(filePath);
|
|
20572
20997
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
20573
20998
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -20733,7 +21158,7 @@ ${code}`;
|
|
|
20733
21158
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
20734
21159
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
20735
21160
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
20736
|
-
const raw =
|
|
21161
|
+
const raw = readFileSync20(filePath, "utf-8");
|
|
20737
21162
|
if (!svelteCompiler) {
|
|
20738
21163
|
svelteCompiler = await import("svelte/compiler");
|
|
20739
21164
|
}
|
|
@@ -20795,12 +21220,12 @@ export default __script__;`;
|
|
|
20795
21220
|
return `${cssInjection}
|
|
20796
21221
|
${code}`;
|
|
20797
21222
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
20798
|
-
const rawSource =
|
|
21223
|
+
const rawSource = readFileSync20(filePath, "utf-8");
|
|
20799
21224
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
20800
21225
|
if (!vueCompiler) {
|
|
20801
21226
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
20802
21227
|
}
|
|
20803
|
-
const fileName =
|
|
21228
|
+
const fileName = basename11(filePath, ".vue");
|
|
20804
21229
|
const componentId = fileName.toLowerCase();
|
|
20805
21230
|
const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
|
|
20806
21231
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -20818,7 +21243,7 @@ ${code}`;
|
|
|
20818
21243
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
20819
21244
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
20820
21245
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
20821
|
-
const hmrBase = vueDir ?
|
|
21246
|
+
const hmrBase = vueDir ? resolve36(vueDir) : projectRoot;
|
|
20822
21247
|
const hmrId = relative14(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
20823
21248
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
20824
21249
|
result += [
|
|
@@ -20833,11 +21258,11 @@ ${code}`;
|
|
|
20833
21258
|
`);
|
|
20834
21259
|
return result;
|
|
20835
21260
|
}, resolveSvelteModulePath = (path) => {
|
|
20836
|
-
if (
|
|
21261
|
+
if (existsSync26(path))
|
|
20837
21262
|
return path;
|
|
20838
|
-
if (
|
|
21263
|
+
if (existsSync26(`${path}.ts`))
|
|
20839
21264
|
return `${path}.ts`;
|
|
20840
|
-
if (
|
|
21265
|
+
if (existsSync26(`${path}.js`))
|
|
20841
21266
|
return `${path}.js`;
|
|
20842
21267
|
return path;
|
|
20843
21268
|
}, jsResponse = (body) => {
|
|
@@ -20850,7 +21275,7 @@ ${code}`;
|
|
|
20850
21275
|
}
|
|
20851
21276
|
});
|
|
20852
21277
|
}, handleCssRequest = (filePath) => {
|
|
20853
|
-
const raw =
|
|
21278
|
+
const raw = readFileSync20(filePath, "utf-8");
|
|
20854
21279
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
20855
21280
|
return [
|
|
20856
21281
|
`const style = document.createElement('style');`,
|
|
@@ -20982,13 +21407,13 @@ export default {};
|
|
|
20982
21407
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
20983
21408
|
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);`);
|
|
20984
21409
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
20985
|
-
const filePath =
|
|
21410
|
+
const filePath = resolve36(projectRoot, relPath);
|
|
20986
21411
|
const ext = extname10(filePath);
|
|
20987
21412
|
if (ext === ".svelte")
|
|
20988
21413
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
20989
21414
|
if (ext)
|
|
20990
21415
|
return { ext, filePath };
|
|
20991
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
21416
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync26(filePath + candidate));
|
|
20992
21417
|
if (!found)
|
|
20993
21418
|
return { ext, filePath };
|
|
20994
21419
|
const resolved = filePath + found;
|
|
@@ -21019,14 +21444,14 @@ export default {};
|
|
|
21019
21444
|
const absoluteCandidate = "/" + tail.replace(/^\/+/, "");
|
|
21020
21445
|
const candidates = [
|
|
21021
21446
|
absoluteCandidate,
|
|
21022
|
-
|
|
21447
|
+
resolve36(projectRoot, tail)
|
|
21023
21448
|
];
|
|
21024
21449
|
try {
|
|
21025
21450
|
const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_loadConfig(), exports_loadConfig));
|
|
21026
21451
|
const cfg = await loadConfig2();
|
|
21027
|
-
const angularDir = cfg.angularDirectory &&
|
|
21452
|
+
const angularDir = cfg.angularDirectory && resolve36(projectRoot, cfg.angularDirectory);
|
|
21028
21453
|
if (angularDir)
|
|
21029
|
-
candidates.push(
|
|
21454
|
+
candidates.push(resolve36(angularDir, tail));
|
|
21030
21455
|
} catch {}
|
|
21031
21456
|
for (const candidate of candidates) {
|
|
21032
21457
|
if (await fileExists(candidate)) {
|
|
@@ -21056,8 +21481,8 @@ export default {};
|
|
|
21056
21481
|
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
21057
21482
|
if (!TRANSPILABLE.has(ext))
|
|
21058
21483
|
return;
|
|
21059
|
-
const stat3 =
|
|
21060
|
-
const resolvedVueDir = vueDir ?
|
|
21484
|
+
const stat3 = statSync6(filePath);
|
|
21485
|
+
const resolvedVueDir = vueDir ? resolve36(vueDir) : undefined;
|
|
21061
21486
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
21062
21487
|
const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
21063
21488
|
if (isAngularGeneratedJs) {
|
|
@@ -21084,12 +21509,12 @@ export default {};
|
|
|
21084
21509
|
cachedAngularUserRoot = configuredAngularUserRoot ?? null;
|
|
21085
21510
|
return cachedAngularUserRoot;
|
|
21086
21511
|
}, configuredAngularUserRoot, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
21087
|
-
const stat3 =
|
|
21512
|
+
const stat3 = statSync6(filePath);
|
|
21088
21513
|
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
21089
21514
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
21090
21515
|
return jsResponse(content);
|
|
21091
21516
|
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
21092
|
-
const stat3 =
|
|
21517
|
+
const stat3 = statSync6(filePath);
|
|
21093
21518
|
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
21094
21519
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
21095
21520
|
return jsResponse(content);
|
|
@@ -21116,7 +21541,7 @@ export default {};
|
|
|
21116
21541
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
21117
21542
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
21118
21543
|
return handleBunWrapRequest();
|
|
21119
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
21544
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve36(projectRoot, relPath));
|
|
21120
21545
|
if (virtualCssResponse)
|
|
21121
21546
|
return virtualCssResponse;
|
|
21122
21547
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -21132,11 +21557,11 @@ export default {};
|
|
|
21132
21557
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
21133
21558
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
21134
21559
|
if (match[1])
|
|
21135
|
-
files.push(
|
|
21560
|
+
files.push(resolve36(projectRoot, match[1]));
|
|
21136
21561
|
}
|
|
21137
21562
|
return files;
|
|
21138
21563
|
}, invalidateModule = (filePath) => {
|
|
21139
|
-
const resolved =
|
|
21564
|
+
const resolved = resolve36(filePath);
|
|
21140
21565
|
invalidate(filePath);
|
|
21141
21566
|
if (resolved !== filePath)
|
|
21142
21567
|
invalidate(resolved);
|
|
@@ -21281,7 +21706,7 @@ __export(exports_hmrCompiler, {
|
|
|
21281
21706
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
21282
21707
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
21283
21708
|
});
|
|
21284
|
-
import { dirname as
|
|
21709
|
+
import { dirname as dirname22, relative as relative15, resolve as resolve37 } from "path";
|
|
21285
21710
|
import { performance as performance2 } from "perf_hooks";
|
|
21286
21711
|
var getApplyMetadataModule = async (encodedId) => {
|
|
21287
21712
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -21290,7 +21715,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
21290
21715
|
return null;
|
|
21291
21716
|
const filePathRel = decoded.slice(0, at2);
|
|
21292
21717
|
const className = decoded.slice(at2 + 1);
|
|
21293
|
-
const componentFilePath =
|
|
21718
|
+
const componentFilePath = resolve37(process.cwd(), filePathRel);
|
|
21294
21719
|
const projectRelPath = relative15(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
21295
21720
|
const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
21296
21721
|
const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
@@ -21301,7 +21726,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
21301
21726
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
21302
21727
|
const owners = resolveOwningComponents2({
|
|
21303
21728
|
changedFilePath: componentFilePath,
|
|
21304
|
-
userAngularRoot:
|
|
21729
|
+
userAngularRoot: dirname22(componentFilePath)
|
|
21305
21730
|
});
|
|
21306
21731
|
const owner = owners.find((o3) => o3.className === className);
|
|
21307
21732
|
const kind = owner?.kind ?? "component";
|
|
@@ -21322,6 +21747,10 @@ var init_hmrCompiler = __esm(() => {
|
|
|
21322
21747
|
});
|
|
21323
21748
|
|
|
21324
21749
|
// src/utils/ssrErrorPage.ts
|
|
21750
|
+
var exports_ssrErrorPage = {};
|
|
21751
|
+
__export(exports_ssrErrorPage, {
|
|
21752
|
+
ssrErrorPage: () => ssrErrorPage
|
|
21753
|
+
});
|
|
21325
21754
|
var ssrErrorPage = (framework, error) => {
|
|
21326
21755
|
const frameworkColors2 = {
|
|
21327
21756
|
angular: "#dd0031",
|
|
@@ -21374,7 +21803,7 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
|
|
|
21374
21803
|
};
|
|
21375
21804
|
|
|
21376
21805
|
// src/ember/pageHandler.ts
|
|
21377
|
-
import { pathToFileURL } from "url";
|
|
21806
|
+
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
21378
21807
|
var resolveRequestPathname = (request) => {
|
|
21379
21808
|
if (!request)
|
|
21380
21809
|
return;
|
|
@@ -21397,7 +21826,7 @@ var resolveRequestPathname = (request) => {
|
|
|
21397
21826
|
}, emberCacheBuster = 0, buildRuntimeModuleSpecifier = (modulePath) => {
|
|
21398
21827
|
if (emberCacheBuster === 0)
|
|
21399
21828
|
return modulePath;
|
|
21400
|
-
const moduleUrl = new URL(
|
|
21829
|
+
const moduleUrl = new URL(pathToFileURL2(modulePath).href);
|
|
21401
21830
|
moduleUrl.searchParams.set("t", String(emberCacheBuster));
|
|
21402
21831
|
return moduleUrl.href;
|
|
21403
21832
|
}, invalidateEmberSsrCache = () => {
|
|
@@ -21448,11 +21877,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
21448
21877
|
__export(exports_simpleHTMLHMR, {
|
|
21449
21878
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
21450
21879
|
});
|
|
21451
|
-
import { resolve as
|
|
21880
|
+
import { resolve as resolve38 } from "path";
|
|
21452
21881
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
21453
21882
|
let htmlContent;
|
|
21454
21883
|
try {
|
|
21455
|
-
const resolvedPath =
|
|
21884
|
+
const resolvedPath = resolve38(htmlFilePath);
|
|
21456
21885
|
const file4 = Bun.file(resolvedPath);
|
|
21457
21886
|
if (!await file4.exists()) {
|
|
21458
21887
|
return null;
|
|
@@ -21478,11 +21907,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
21478
21907
|
__export(exports_simpleHTMXHMR, {
|
|
21479
21908
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
21480
21909
|
});
|
|
21481
|
-
import { resolve as
|
|
21910
|
+
import { resolve as resolve39 } from "path";
|
|
21482
21911
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
21483
21912
|
let htmlContent;
|
|
21484
21913
|
try {
|
|
21485
|
-
const resolvedPath =
|
|
21914
|
+
const resolvedPath = resolve39(htmxFilePath);
|
|
21486
21915
|
const file4 = Bun.file(resolvedPath);
|
|
21487
21916
|
if (!await file4.exists()) {
|
|
21488
21917
|
return null;
|
|
@@ -21504,8 +21933,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
21504
21933
|
var init_simpleHTMXHMR = () => {};
|
|
21505
21934
|
|
|
21506
21935
|
// src/dev/rebuildTrigger.ts
|
|
21507
|
-
import { existsSync as
|
|
21508
|
-
import { basename as
|
|
21936
|
+
import { existsSync as existsSync27, rmSync as rmSync3 } from "fs";
|
|
21937
|
+
import { basename as basename12, dirname as dirname23, join as join31, relative as relative16, resolve as resolve40, sep as sep4 } from "path";
|
|
21509
21938
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
|
|
21510
21939
|
if (!config.tailwind)
|
|
21511
21940
|
return;
|
|
@@ -21517,13 +21946,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21517
21946
|
if (!cssChanged)
|
|
21518
21947
|
return;
|
|
21519
21948
|
try {
|
|
21520
|
-
const outputPath =
|
|
21949
|
+
const outputPath = resolve40(state.resolvedPaths.buildDir, config.tailwind.output);
|
|
21521
21950
|
const bytes = await Bun.file(outputPath).bytes();
|
|
21522
21951
|
const webPath = `/${config.tailwind.output.replace(/^\/+/, "")}`;
|
|
21523
21952
|
state.assetStore.set(webPath, bytes);
|
|
21524
21953
|
} catch {}
|
|
21525
21954
|
broadcastToClients(state, {
|
|
21526
|
-
data: {
|
|
21955
|
+
data: {
|
|
21956
|
+
cause: files.filter(isTailwindCandidate),
|
|
21957
|
+
framework: "tailwind",
|
|
21958
|
+
manifest: state.manifest
|
|
21959
|
+
},
|
|
21527
21960
|
message: "Tailwind utilities recompiled",
|
|
21528
21961
|
type: "style-update"
|
|
21529
21962
|
});
|
|
@@ -21600,15 +22033,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21600
22033
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
21601
22034
|
}
|
|
21602
22035
|
return { ...parsed, framework: detectedFw };
|
|
21603
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
22036
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync27(affectedFile), FRAMEWORK_DIR_KEYS_FOR_CLEANUP, removeStaleGenerated = (state, deletedFile) => {
|
|
21604
22037
|
const config = state.config;
|
|
21605
22038
|
const cwd2 = process.cwd();
|
|
21606
|
-
const absDeleted =
|
|
22039
|
+
const absDeleted = resolve40(deletedFile).replace(/\\/g, "/");
|
|
21607
22040
|
for (const { configKey, framework } of FRAMEWORK_DIR_KEYS_FOR_CLEANUP) {
|
|
21608
22041
|
const dir = config[configKey];
|
|
21609
22042
|
if (!dir)
|
|
21610
22043
|
continue;
|
|
21611
|
-
const absDir =
|
|
22044
|
+
const absDir = resolve40(cwd2, dir).replace(/\\/g, "/");
|
|
21612
22045
|
if (!absDeleted.startsWith(`${absDir}/`))
|
|
21613
22046
|
continue;
|
|
21614
22047
|
const rel = absDeleted.slice(absDir.length + 1);
|
|
@@ -21618,8 +22051,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21618
22051
|
const relJs = `${rel.slice(0, -ext[0].length)}.js`;
|
|
21619
22052
|
const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
|
|
21620
22053
|
for (const candidate of [
|
|
21621
|
-
|
|
21622
|
-
`${
|
|
22054
|
+
join31(generatedDir, relJs),
|
|
22055
|
+
`${join31(generatedDir, relJs)}.map`
|
|
21623
22056
|
]) {
|
|
21624
22057
|
try {
|
|
21625
22058
|
rmSync3(candidate, { force: true });
|
|
@@ -21632,7 +22065,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21632
22065
|
removeStaleGenerated(state, filePathInSet);
|
|
21633
22066
|
try {
|
|
21634
22067
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
21635
|
-
const deletedPathResolved =
|
|
22068
|
+
const deletedPathResolved = resolve40(filePathInSet);
|
|
21636
22069
|
affectedFiles.forEach((affectedFile) => {
|
|
21637
22070
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
21638
22071
|
validFiles.push(affectedFile);
|
|
@@ -21646,7 +22079,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21646
22079
|
if (!dependents || dependents.size === 0) {
|
|
21647
22080
|
return;
|
|
21648
22081
|
}
|
|
21649
|
-
const dependentFiles = Array.from(dependents).filter((file4) =>
|
|
22082
|
+
const dependentFiles = Array.from(dependents).filter((file4) => existsSync27(file4));
|
|
21650
22083
|
if (dependentFiles.length === 0) {
|
|
21651
22084
|
return;
|
|
21652
22085
|
}
|
|
@@ -21662,7 +22095,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21662
22095
|
try {
|
|
21663
22096
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
21664
22097
|
affectedFiles.forEach((affectedFile) => {
|
|
21665
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
22098
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync27(affectedFile)) {
|
|
21666
22099
|
validFiles.push(affectedFile);
|
|
21667
22100
|
processedFiles.add(affectedFile);
|
|
21668
22101
|
}
|
|
@@ -21676,7 +22109,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21676
22109
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
21677
22110
|
return;
|
|
21678
22111
|
}
|
|
21679
|
-
const normalizedFilePath =
|
|
22112
|
+
const normalizedFilePath = resolve40(filePathInSet);
|
|
21680
22113
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
21681
22114
|
validFiles.push(normalizedFilePath);
|
|
21682
22115
|
processedFiles.add(normalizedFilePath);
|
|
@@ -21687,7 +22120,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21687
22120
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
21688
22121
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
21689
22122
|
filePathSet.forEach((filePathInSet) => {
|
|
21690
|
-
if (!
|
|
22123
|
+
if (!existsSync27(filePathInSet)) {
|
|
21691
22124
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
21692
22125
|
return;
|
|
21693
22126
|
}
|
|
@@ -21814,7 +22247,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21814
22247
|
const publicDir = state.resolvedPaths.publicDir;
|
|
21815
22248
|
const assetsDir = state.resolvedPaths.assetsDir;
|
|
21816
22249
|
const handleStaticMirror = async (sourceDir, urlPrefix) => {
|
|
21817
|
-
const absSource =
|
|
22250
|
+
const absSource = resolve40(filePath);
|
|
21818
22251
|
const normalizedSource = absSource.replace(/\\/g, "/");
|
|
21819
22252
|
const normalizedDir = sourceDir.replace(/\\/g, "/");
|
|
21820
22253
|
if (!normalizedSource.startsWith(normalizedDir + "/"))
|
|
@@ -21822,10 +22255,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21822
22255
|
try {
|
|
21823
22256
|
const relFromDir = normalizedSource.slice(normalizedDir.length + 1);
|
|
21824
22257
|
const buildDir = state.resolvedPaths.buildDir;
|
|
21825
|
-
const destPath =
|
|
22258
|
+
const destPath = resolve40(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
|
|
21826
22259
|
const { mkdir: mkdir7, copyFile, readFile: readFile6 } = await import("fs/promises");
|
|
21827
|
-
const { dirname:
|
|
21828
|
-
await mkdir7(
|
|
22260
|
+
const { dirname: dirname24 } = await import("path");
|
|
22261
|
+
await mkdir7(dirname24(destPath), { recursive: true });
|
|
21829
22262
|
await copyFile(absSource, destPath);
|
|
21830
22263
|
const bytes = await readFile6(destPath);
|
|
21831
22264
|
const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
|
|
@@ -21848,7 +22281,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21848
22281
|
if (assetsDir && await handleStaticMirror(assetsDir, "assets"))
|
|
21849
22282
|
return;
|
|
21850
22283
|
if (framework === "unknown") {
|
|
21851
|
-
invalidate(
|
|
22284
|
+
invalidate(resolve40(filePath));
|
|
21852
22285
|
const relPath = relative16(process.cwd(), filePath);
|
|
21853
22286
|
logHmrUpdate(relPath);
|
|
21854
22287
|
const angularDir = state.resolvedPaths.angularDir;
|
|
@@ -21856,10 +22289,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21856
22289
|
if (angularDir && state.dependencyGraph) {
|
|
21857
22290
|
try {
|
|
21858
22291
|
const { addFileToGraph: addFileToGraph2 } = await Promise.resolve().then(() => (init_dependencyGraph(), exports_dependencyGraph));
|
|
21859
|
-
addFileToGraph2(state.dependencyGraph,
|
|
21860
|
-
const affected = getAffectedFiles(state.dependencyGraph,
|
|
22292
|
+
addFileToGraph2(state.dependencyGraph, resolve40(filePath));
|
|
22293
|
+
const affected = getAffectedFiles(state.dependencyGraph, resolve40(filePath));
|
|
21861
22294
|
for (const dependent of affected) {
|
|
21862
|
-
if (dependent ===
|
|
22295
|
+
if (dependent === resolve40(filePath))
|
|
21863
22296
|
continue;
|
|
21864
22297
|
const dependentFramework = detectFramework(dependent, state.resolvedPaths);
|
|
21865
22298
|
if (dependentFramework !== "angular")
|
|
@@ -21876,14 +22309,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21876
22309
|
} catch {}
|
|
21877
22310
|
}
|
|
21878
22311
|
if (!hasAngularDependent) {
|
|
21879
|
-
console.log(`[abs:restart] ${
|
|
22312
|
+
console.log(`[abs:restart] ${resolve40(filePath)}`);
|
|
21880
22313
|
return;
|
|
21881
22314
|
}
|
|
21882
22315
|
try {
|
|
21883
22316
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
21884
22317
|
const { invalidateModule: invalidateModuleServer } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
21885
22318
|
const generatedAngularRoot = getFrameworkGeneratedDir2("angular");
|
|
21886
|
-
const sourceAbs =
|
|
22319
|
+
const sourceAbs = resolve40(filePath).replace(/\\/g, "/");
|
|
21887
22320
|
const generatedTwin = `${generatedAngularRoot.replace(/\\/g, "/")}${sourceAbs.replace(/\.ts$/, ".js")}`;
|
|
21888
22321
|
invalidateModuleServer(generatedTwin);
|
|
21889
22322
|
} catch {}
|
|
@@ -21917,7 +22350,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21917
22350
|
const userEditedFiles = new Set;
|
|
21918
22351
|
state.fileChangeQueue.forEach((filePaths) => {
|
|
21919
22352
|
for (const filePath2 of filePaths) {
|
|
21920
|
-
userEditedFiles.add(
|
|
22353
|
+
userEditedFiles.add(resolve40(filePath2));
|
|
21921
22354
|
}
|
|
21922
22355
|
});
|
|
21923
22356
|
state.lastUserEditedFiles = userEditedFiles;
|
|
@@ -21941,12 +22374,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21941
22374
|
return componentFile;
|
|
21942
22375
|
}
|
|
21943
22376
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
21944
|
-
if (
|
|
22377
|
+
if (existsSync27(tsCounterpart)) {
|
|
21945
22378
|
return tsCounterpart;
|
|
21946
22379
|
}
|
|
21947
22380
|
if (!graph)
|
|
21948
22381
|
return componentFile;
|
|
21949
|
-
const dependents = graph.dependents.get(
|
|
22382
|
+
const dependents = graph.dependents.get(resolve40(componentFile));
|
|
21950
22383
|
if (!dependents)
|
|
21951
22384
|
return componentFile;
|
|
21952
22385
|
for (const dep of dependents) {
|
|
@@ -21955,7 +22388,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21955
22388
|
}
|
|
21956
22389
|
return componentFile;
|
|
21957
22390
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
21958
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
22391
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve40(file4).startsWith(angularPagesPath));
|
|
21959
22392
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
21960
22393
|
return pageEntries;
|
|
21961
22394
|
}
|
|
@@ -21964,7 +22397,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
21964
22397
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
21965
22398
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
21966
22399
|
affected.forEach((file4) => {
|
|
21967
|
-
if (file4.endsWith(".ts") &&
|
|
22400
|
+
if (file4.endsWith(".ts") && resolve40(file4).startsWith(angularPagesPath)) {
|
|
21968
22401
|
resolvedPages.add(file4);
|
|
21969
22402
|
}
|
|
21970
22403
|
});
|
|
@@ -22005,8 +22438,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22005
22438
|
if (serverDirs.length <= 1) {
|
|
22006
22439
|
const dir = getFrameworkGeneratedDir2(framework, projectRoot);
|
|
22007
22440
|
return {
|
|
22008
|
-
serverOutDir:
|
|
22009
|
-
serverRoot:
|
|
22441
|
+
serverOutDir: resolve40(resolvedPaths.buildDir, basename12(dir)),
|
|
22442
|
+
serverRoot: resolve40(dir, "server")
|
|
22010
22443
|
};
|
|
22011
22444
|
}
|
|
22012
22445
|
return {
|
|
@@ -22014,7 +22447,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22014
22447
|
serverRoot: commonAncestor2(serverDirs.map((entry) => entry.dir), projectRoot)
|
|
22015
22448
|
};
|
|
22016
22449
|
}, updateServerManifestEntry = (state, artifact) => {
|
|
22017
|
-
const fileWithHash =
|
|
22450
|
+
const fileWithHash = basename12(artifact.path);
|
|
22018
22451
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
22019
22452
|
if (!baseName) {
|
|
22020
22453
|
return;
|
|
@@ -22027,8 +22460,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22027
22460
|
const keepByDir = new Map;
|
|
22028
22461
|
const prefixByDir = new Map;
|
|
22029
22462
|
for (const artifact of freshOutputs) {
|
|
22030
|
-
const dir =
|
|
22031
|
-
const name =
|
|
22463
|
+
const dir = dirname23(artifact.path);
|
|
22464
|
+
const name = basename12(artifact.path);
|
|
22032
22465
|
const [prefix] = name.split(".");
|
|
22033
22466
|
if (!prefix)
|
|
22034
22467
|
continue;
|
|
@@ -22099,6 +22532,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22099
22532
|
})
|
|
22100
22533
|
],
|
|
22101
22534
|
root: clientRoot,
|
|
22535
|
+
sourcemap: "inline",
|
|
22102
22536
|
target: "browser",
|
|
22103
22537
|
throw: false
|
|
22104
22538
|
});
|
|
@@ -22112,6 +22546,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22112
22546
|
...depVendorPaths
|
|
22113
22547
|
});
|
|
22114
22548
|
}
|
|
22549
|
+
const { chainBundleInlineSourcemap: chainBundleInlineSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
|
|
22550
|
+
for (const out of clientResult.outputs) {
|
|
22551
|
+
if (out.path.endsWith(".js"))
|
|
22552
|
+
chainBundleInlineSourcemap2(out.path);
|
|
22553
|
+
}
|
|
22115
22554
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
22116
22555
|
Object.assign(state.manifest, clientManifest);
|
|
22117
22556
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
@@ -22133,7 +22572,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22133
22572
|
}, decideAngularTier = async (state, angularDir) => {
|
|
22134
22573
|
const userEdited = state.lastUserEditedFiles ?? new Set;
|
|
22135
22574
|
if (userEdited.size === 0)
|
|
22136
|
-
return {
|
|
22575
|
+
return {
|
|
22576
|
+
breakdown: { compileMs: 0, importsMs: 0, resolveMs: 0 },
|
|
22577
|
+
queue: [],
|
|
22578
|
+
tier: 0
|
|
22579
|
+
};
|
|
22137
22580
|
const importsStart = performance.now();
|
|
22138
22581
|
const {
|
|
22139
22582
|
resolveOwningComponents: resolveOwningComponents2,
|
|
@@ -22157,8 +22600,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22157
22600
|
if (detected !== "unknown")
|
|
22158
22601
|
continue;
|
|
22159
22602
|
try {
|
|
22160
|
-
const affected = getAffectedFiles(state.dependencyGraph,
|
|
22161
|
-
const hasAngularConsumer = affected.some((dep) => dep !==
|
|
22603
|
+
const affected = getAffectedFiles(state.dependencyGraph, resolve40(editedFile));
|
|
22604
|
+
const hasAngularConsumer = affected.some((dep) => dep !== resolve40(editedFile) && detectFramework(dep, state.resolvedPaths) === "angular");
|
|
22162
22605
|
if (hasAngularConsumer) {
|
|
22163
22606
|
return {
|
|
22164
22607
|
kind: "rebootstrap",
|
|
@@ -22205,7 +22648,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22205
22648
|
}
|
|
22206
22649
|
if (owners.length === 0 && (editedFile.endsWith(".ts") || editedFile.endsWith(".json")) && !editedFile.endsWith(".d.ts")) {
|
|
22207
22650
|
const normalized = editedFile.replace(/\\/g, "/");
|
|
22208
|
-
const angularDirAbs =
|
|
22651
|
+
const angularDirAbs = resolve40(angularDir).replace(/\\/g, "/");
|
|
22209
22652
|
if (normalized.startsWith(angularDirAbs + "/")) {
|
|
22210
22653
|
return {
|
|
22211
22654
|
kind: "rebootstrap",
|
|
@@ -22348,16 +22791,16 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22348
22791
|
};
|
|
22349
22792
|
const fire = () => {
|
|
22350
22793
|
ctx.debounceTimer = null;
|
|
22351
|
-
const
|
|
22794
|
+
const resolve41 = ctx.debouncedResolve;
|
|
22352
22795
|
ctx.debouncedResolve = null;
|
|
22353
22796
|
ctx.debouncedPromise = null;
|
|
22354
22797
|
if (ctx.inFlight) {
|
|
22355
22798
|
ctx.pending = true;
|
|
22356
|
-
ctx.inFlight.finally(() =>
|
|
22799
|
+
ctx.inFlight.finally(() => resolve41?.());
|
|
22357
22800
|
return;
|
|
22358
22801
|
}
|
|
22359
22802
|
ctx.inFlight = drive();
|
|
22360
|
-
ctx.inFlight.finally(() =>
|
|
22803
|
+
ctx.inFlight.finally(() => resolve41?.());
|
|
22361
22804
|
};
|
|
22362
22805
|
return ({ immediate = false } = {}) => {
|
|
22363
22806
|
if (!ctx.debouncedPromise) {
|
|
@@ -22384,9 +22827,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22384
22827
|
const diskRefreshPromise = (async () => {
|
|
22385
22828
|
if (!angularDir || editedFiles.size === 0)
|
|
22386
22829
|
return;
|
|
22387
|
-
const angularDirAbs =
|
|
22830
|
+
const angularDirAbs = resolve40(angularDir);
|
|
22388
22831
|
const filesUnderAngular = Array.from(editedFiles).filter((file4) => {
|
|
22389
|
-
const abs =
|
|
22832
|
+
const abs = resolve40(file4);
|
|
22390
22833
|
return abs === angularDirAbs || abs.startsWith(angularDirAbs + sep4);
|
|
22391
22834
|
});
|
|
22392
22835
|
if (filesUnderAngular.length === 0)
|
|
@@ -22408,7 +22851,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22408
22851
|
if (!ext)
|
|
22409
22852
|
continue;
|
|
22410
22853
|
if (ext === ".ts" || ext === ".tsx") {
|
|
22411
|
-
tsFilesToRefresh.add(
|
|
22854
|
+
tsFilesToRefresh.add(resolve40(file4));
|
|
22412
22855
|
continue;
|
|
22413
22856
|
}
|
|
22414
22857
|
const owners = resolveOwningComponents2({
|
|
@@ -22416,7 +22859,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22416
22859
|
userAngularRoot: angularDirAbs
|
|
22417
22860
|
});
|
|
22418
22861
|
for (const owner of owners) {
|
|
22419
|
-
tsFilesToRefresh.add(
|
|
22862
|
+
tsFilesToRefresh.add(resolve40(owner.componentFilePath));
|
|
22420
22863
|
}
|
|
22421
22864
|
}
|
|
22422
22865
|
if (tsFilesToRefresh.size === 0)
|
|
@@ -22431,7 +22874,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22431
22874
|
const { invalidateModule: invalidateModule2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
22432
22875
|
for (const tsFile of tsFilesToRefresh) {
|
|
22433
22876
|
const rel = relative16(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
|
|
22434
|
-
const compiledFile =
|
|
22877
|
+
const compiledFile = resolve40(compiledRoot, rel);
|
|
22435
22878
|
invalidateModule2(compiledFile);
|
|
22436
22879
|
}
|
|
22437
22880
|
} catch {}
|
|
@@ -22447,12 +22890,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22447
22890
|
try {
|
|
22448
22891
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
22449
22892
|
const { readdir: readdir5 } = await import("fs/promises");
|
|
22450
|
-
const { join:
|
|
22893
|
+
const { join: join32 } = await import("path");
|
|
22451
22894
|
const walk = async (dir) => {
|
|
22452
22895
|
const entries = await readdir5(dir, { withFileTypes: true });
|
|
22453
22896
|
const files = [];
|
|
22454
22897
|
for (const entry of entries) {
|
|
22455
|
-
const full =
|
|
22898
|
+
const full = join32(dir, entry.name);
|
|
22456
22899
|
if (entry.isDirectory()) {
|
|
22457
22900
|
files.push(...await walk(full));
|
|
22458
22901
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -22480,9 +22923,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22480
22923
|
await rewriteImports3(ssrPaths, angServerVendorPaths);
|
|
22481
22924
|
}
|
|
22482
22925
|
serverPaths.forEach((serverPath, idx) => {
|
|
22483
|
-
const fileBase =
|
|
22926
|
+
const fileBase = basename12(serverPath, ".js");
|
|
22484
22927
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
22485
|
-
state.manifest[toPascal(fileBase)] =
|
|
22928
|
+
state.manifest[toPascal(fileBase)] = resolve40(ssrPath);
|
|
22486
22929
|
});
|
|
22487
22930
|
if (clientPaths.length > 0) {
|
|
22488
22931
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
|
|
@@ -22495,9 +22938,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22495
22938
|
const angularDir = config.angularDirectory ?? "";
|
|
22496
22939
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
22497
22940
|
for (const file4 of angularFiles) {
|
|
22498
|
-
state.fileHashes.set(
|
|
22941
|
+
state.fileHashes.set(resolve40(file4), computeFileHash(file4));
|
|
22499
22942
|
}
|
|
22500
|
-
const angularPagesPath =
|
|
22943
|
+
const angularPagesPath = resolve40(angularDir, "pages");
|
|
22501
22944
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
22502
22945
|
const tierStart = performance.now();
|
|
22503
22946
|
const verdict = await decideAngularTier(state, angularDir);
|
|
@@ -22515,6 +22958,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22515
22958
|
broadcastRemount(state, verdict.queue);
|
|
22516
22959
|
const b2 = verdict.breakdown;
|
|
22517
22960
|
logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
|
|
22961
|
+
runBundle();
|
|
22518
22962
|
} else if (verdict.tier === 1 && verdict.kind === "rebootstrap") {
|
|
22519
22963
|
await runBundle({ immediate: true });
|
|
22520
22964
|
await broadcastRebootstrap(state, verdict.reason);
|
|
@@ -22537,11 +22981,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22537
22981
|
if (isComponentFile2)
|
|
22538
22982
|
return primaryFile;
|
|
22539
22983
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
22540
|
-
const nearest = findNearestComponent2(
|
|
22984
|
+
const nearest = findNearestComponent2(resolve40(primaryFile));
|
|
22541
22985
|
return nearest ?? primaryFile;
|
|
22542
22986
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
22543
22987
|
for (const file4 of reactFiles) {
|
|
22544
|
-
state.fileHashes.set(
|
|
22988
|
+
state.fileHashes.set(resolve40(file4), computeFileHash(file4));
|
|
22545
22989
|
}
|
|
22546
22990
|
const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
22547
22991
|
if (!primaryFile) {
|
|
@@ -22622,7 +23066,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22622
23066
|
});
|
|
22623
23067
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, config, startTime, onRebuildComplete) => {
|
|
22624
23068
|
for (const file4 of svelteFiles) {
|
|
22625
|
-
state.fileHashes.set(
|
|
23069
|
+
state.fileHashes.set(resolve40(file4), computeFileHash(file4));
|
|
22626
23070
|
}
|
|
22627
23071
|
const serverDuration = Date.now() - startTime;
|
|
22628
23072
|
await runSequentially(svelteFiles, (changedFile) => broadcastSvelteModuleUpdate(state, changedFile, svelteFiles, serverDuration));
|
|
@@ -22678,6 +23122,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22678
23122
|
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
22679
23123
|
],
|
|
22680
23124
|
root: serverRoot,
|
|
23125
|
+
sourcemap: "inline",
|
|
22681
23126
|
target: "bun",
|
|
22682
23127
|
throw: false
|
|
22683
23128
|
}) : undefined,
|
|
@@ -22690,6 +23135,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22690
23135
|
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
22691
23136
|
],
|
|
22692
23137
|
root: clientRoot,
|
|
23138
|
+
sourcemap: "inline",
|
|
22693
23139
|
target: "browser",
|
|
22694
23140
|
throw: false
|
|
22695
23141
|
}) : undefined
|
|
@@ -22697,6 +23143,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22697
23143
|
handleServerManifestUpdate(state, serverResult);
|
|
22698
23144
|
await handleClientManifestUpdate(state, clientResult, buildDir);
|
|
22699
23145
|
await pruneStaleHashedSiblings(serverResult?.outputs);
|
|
23146
|
+
if (serverResult?.success || clientResult?.success) {
|
|
23147
|
+
const { chainBundleInlineSourcemap: chainBundleInlineSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
|
|
23148
|
+
for (const out of serverResult?.outputs ?? []) {
|
|
23149
|
+
if (out.path.endsWith(".js"))
|
|
23150
|
+
chainBundleInlineSourcemap2(out.path);
|
|
23151
|
+
}
|
|
23152
|
+
for (const out of clientResult?.outputs ?? []) {
|
|
23153
|
+
if (out.path.endsWith(".js"))
|
|
23154
|
+
chainBundleInlineSourcemap2(out.path);
|
|
23155
|
+
}
|
|
23156
|
+
}
|
|
22700
23157
|
broadcastToClients(state, {
|
|
22701
23158
|
data: { manifest: state.manifest },
|
|
22702
23159
|
type: "svelte-tier-zero-ssr-rebuild-complete"
|
|
@@ -22801,7 +23258,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22801
23258
|
const duration = Date.now() - startTime;
|
|
22802
23259
|
const broadcastFiles = svelteFiles.length > 0 ? svelteFiles : filesToRebuild;
|
|
22803
23260
|
broadcastFiles.forEach((sveltePagePath) => {
|
|
22804
|
-
const fileName =
|
|
23261
|
+
const fileName = basename12(sveltePagePath);
|
|
22805
23262
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
22806
23263
|
const pascalName = toPascal(baseName);
|
|
22807
23264
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -22856,7 +23313,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22856
23313
|
});
|
|
22857
23314
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, config, startTime, onRebuildComplete) => {
|
|
22858
23315
|
for (const file4 of [...vueFiles, ...nonVueFiles]) {
|
|
22859
|
-
state.fileHashes.set(
|
|
23316
|
+
state.fileHashes.set(resolve40(file4), computeFileHash(file4));
|
|
22860
23317
|
}
|
|
22861
23318
|
await invalidateNonVueModules(nonVueFiles);
|
|
22862
23319
|
const serverDuration = Date.now() - startTime;
|
|
@@ -22881,7 +23338,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22881
23338
|
const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
|
|
22882
23339
|
const serverEntries = [...vueServerPaths];
|
|
22883
23340
|
const clientEntries = [...vueIndexPaths, ...vueClientPaths];
|
|
22884
|
-
const cssOutDir =
|
|
23341
|
+
const cssOutDir = join31(buildDir, state.resolvedPaths.assetsDir ? basename12(state.resolvedPaths.assetsDir) : "assets", "css");
|
|
22885
23342
|
const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
|
|
22886
23343
|
const [serverResult, clientResult, cssResult] = await Promise.all([
|
|
22887
23344
|
serverEntries.length > 0 ? bunBuild9({
|
|
@@ -22894,6 +23351,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22894
23351
|
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
22895
23352
|
],
|
|
22896
23353
|
root: serverRoot,
|
|
23354
|
+
sourcemap: "inline",
|
|
22897
23355
|
target: "bun",
|
|
22898
23356
|
throw: false
|
|
22899
23357
|
}) : undefined,
|
|
@@ -22906,6 +23364,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22906
23364
|
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
22907
23365
|
],
|
|
22908
23366
|
root: clientRoot,
|
|
23367
|
+
sourcemap: "inline",
|
|
22909
23368
|
target: "browser",
|
|
22910
23369
|
throw: false
|
|
22911
23370
|
}) : undefined,
|
|
@@ -22925,6 +23384,20 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22925
23384
|
await handleClientManifestUpdate(state, cssResult, buildDir);
|
|
22926
23385
|
await pruneStaleHashedSiblings(serverResult?.outputs);
|
|
22927
23386
|
await pruneStaleHashedSiblings(cssResult?.outputs);
|
|
23387
|
+
if (serverResult?.success) {
|
|
23388
|
+
const { chainBundleInlineSourcemap: chainBundleInlineSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
|
|
23389
|
+
for (const out of serverResult.outputs) {
|
|
23390
|
+
if (out.path.endsWith(".js"))
|
|
23391
|
+
chainBundleInlineSourcemap2(out.path);
|
|
23392
|
+
}
|
|
23393
|
+
}
|
|
23394
|
+
if (clientResult?.success) {
|
|
23395
|
+
const { chainBundleInlineSourcemap: chainBundleInlineSourcemap2 } = await Promise.resolve().then(() => (init_chainInlineSourcemaps(), exports_chainInlineSourcemaps));
|
|
23396
|
+
for (const out of clientResult.outputs) {
|
|
23397
|
+
if (out.path.endsWith(".js"))
|
|
23398
|
+
chainBundleInlineSourcemap2(out.path);
|
|
23399
|
+
}
|
|
23400
|
+
}
|
|
22928
23401
|
broadcastToClients(state, {
|
|
22929
23402
|
data: { manifest: state.manifest },
|
|
22930
23403
|
type: "vue-tier-zero-ssr-rebuild-complete"
|
|
@@ -22989,7 +23462,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
22989
23462
|
recursive: true,
|
|
22990
23463
|
withFileTypes: true
|
|
22991
23464
|
});
|
|
22992
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
23465
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve40(emberPagesPath, entry.name));
|
|
22993
23466
|
} catch {
|
|
22994
23467
|
return [];
|
|
22995
23468
|
}
|
|
@@ -23001,10 +23474,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23001
23474
|
return state.manifest;
|
|
23002
23475
|
}
|
|
23003
23476
|
for (const file4 of emberFiles) {
|
|
23004
|
-
state.fileHashes.set(
|
|
23477
|
+
state.fileHashes.set(resolve40(file4), computeFileHash(file4));
|
|
23005
23478
|
}
|
|
23006
|
-
const emberPagesPath =
|
|
23007
|
-
const directPageEntries = emberFiles.filter((file4) =>
|
|
23479
|
+
const emberPagesPath = resolve40(emberDir, "pages");
|
|
23480
|
+
const directPageEntries = emberFiles.filter((file4) => resolve40(file4).startsWith(emberPagesPath));
|
|
23008
23481
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
23009
23482
|
if (allPageEntries.length === 0) {
|
|
23010
23483
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -23013,8 +23486,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23013
23486
|
const { compileEmber: compileEmber2 } = await Promise.resolve().then(() => (init_compileEmber(), exports_compileEmber));
|
|
23014
23487
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
23015
23488
|
for (const serverPath of serverPaths) {
|
|
23016
|
-
const fileBase =
|
|
23017
|
-
state.manifest[toPascal(fileBase)] =
|
|
23489
|
+
const fileBase = basename12(serverPath, ".js");
|
|
23490
|
+
state.manifest[toPascal(fileBase)] = resolve40(serverPath);
|
|
23018
23491
|
}
|
|
23019
23492
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
23020
23493
|
invalidateEmberSsrCache2();
|
|
@@ -23084,7 +23557,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23084
23557
|
});
|
|
23085
23558
|
}
|
|
23086
23559
|
}, handleScriptUpdate = (state, scriptFile, manifest, framework, duration) => {
|
|
23087
|
-
const scriptBaseName =
|
|
23560
|
+
const scriptBaseName = basename12(scriptFile).replace(/\.(ts|js|tsx|jsx)$/, "");
|
|
23088
23561
|
const pascalName = toPascal(scriptBaseName);
|
|
23089
23562
|
const scriptPath = manifest[pascalName] || null;
|
|
23090
23563
|
if (!scriptPath) {
|
|
@@ -23106,8 +23579,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23106
23579
|
if (!buildReference?.source) {
|
|
23107
23580
|
return;
|
|
23108
23581
|
}
|
|
23109
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
23110
|
-
islandFiles.add(
|
|
23582
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve40(dirname23(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
23583
|
+
islandFiles.add(resolve40(sourcePath));
|
|
23111
23584
|
}, resolveIslandSourceFiles = async (config) => {
|
|
23112
23585
|
const registryPath = config.islands?.registry;
|
|
23113
23586
|
if (!registryPath) {
|
|
@@ -23115,7 +23588,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23115
23588
|
}
|
|
23116
23589
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
23117
23590
|
const islandFiles = new Set([
|
|
23118
|
-
|
|
23591
|
+
resolve40(buildInfo.resolvedRegistryPath)
|
|
23119
23592
|
]);
|
|
23120
23593
|
for (const definition of buildInfo.definitions) {
|
|
23121
23594
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -23126,7 +23599,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23126
23599
|
if (islandFiles.size === 0) {
|
|
23127
23600
|
return false;
|
|
23128
23601
|
}
|
|
23129
|
-
return filesToRebuild.some((file4) => islandFiles.has(
|
|
23602
|
+
return filesToRebuild.some((file4) => islandFiles.has(resolve40(file4)));
|
|
23130
23603
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
23131
23604
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
23132
23605
|
if (!shouldReload) {
|
|
@@ -23161,10 +23634,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23161
23634
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
23162
23635
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
23163
23636
|
if (isSingle) {
|
|
23164
|
-
return
|
|
23637
|
+
return resolve40(state.resolvedPaths.buildDir, "pages");
|
|
23165
23638
|
}
|
|
23166
|
-
const dirName = framework === "html" ?
|
|
23167
|
-
return
|
|
23639
|
+
const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
|
|
23640
|
+
return resolve40(state.resolvedPaths.buildDir, dirName, "pages");
|
|
23168
23641
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
23169
23642
|
try {
|
|
23170
23643
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -23202,8 +23675,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23202
23675
|
const shouldRefreshAllPages = htmlPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
23203
23676
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
23204
23677
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
23205
|
-
const htmlPageName =
|
|
23206
|
-
const builtHtmlPagePath =
|
|
23678
|
+
const htmlPageName = basename12(pageFile);
|
|
23679
|
+
const builtHtmlPagePath = resolve40(outputHtmlPages, htmlPageName);
|
|
23207
23680
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
23208
23681
|
});
|
|
23209
23682
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -23211,7 +23684,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23211
23684
|
if (!cssFile) {
|
|
23212
23685
|
return;
|
|
23213
23686
|
}
|
|
23214
|
-
const cssBaseName =
|
|
23687
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
23215
23688
|
const cssPascalName = toPascal(cssBaseName);
|
|
23216
23689
|
const cssKey = `${cssPascalName}CSS`;
|
|
23217
23690
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -23260,7 +23733,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23260
23733
|
type: "vue-update"
|
|
23261
23734
|
});
|
|
23262
23735
|
}, broadcastVuePageChange = async (state, config, vuePagePath, manifest, duration) => {
|
|
23263
|
-
const fileName =
|
|
23736
|
+
const fileName = basename12(vuePagePath);
|
|
23264
23737
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
23265
23738
|
const pascalName = toPascal(baseName);
|
|
23266
23739
|
const vueRoot = config.vueDirectory;
|
|
@@ -23268,7 +23741,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23268
23741
|
const cssKey = `${pascalName}CSS`;
|
|
23269
23742
|
const cssUrl = manifest[cssKey] || null;
|
|
23270
23743
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
23271
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
23744
|
+
const hmrMeta = vueHmrMetadata2.get(resolve40(vuePagePath));
|
|
23272
23745
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
23273
23746
|
if (changeType === "style-only") {
|
|
23274
23747
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -23306,7 +23779,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23306
23779
|
if (!cssFile) {
|
|
23307
23780
|
return;
|
|
23308
23781
|
}
|
|
23309
|
-
const cssBaseName =
|
|
23782
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
23310
23783
|
const cssPascalName = toPascal(cssBaseName);
|
|
23311
23784
|
const cssKey = `${cssPascalName}CSS`;
|
|
23312
23785
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -23324,7 +23797,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23324
23797
|
});
|
|
23325
23798
|
}, broadcastSveltePageUpdate = (state, sveltePagePath, manifest, duration) => {
|
|
23326
23799
|
try {
|
|
23327
|
-
const fileName =
|
|
23800
|
+
const fileName = basename12(sveltePagePath);
|
|
23328
23801
|
const baseName = fileName.replace(/\.svelte$/, "");
|
|
23329
23802
|
const pascalName = toPascal(baseName);
|
|
23330
23803
|
const cssKey = `${pascalName}CSS`;
|
|
@@ -23372,7 +23845,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23372
23845
|
if (!cssFile) {
|
|
23373
23846
|
return;
|
|
23374
23847
|
}
|
|
23375
|
-
const cssBaseName =
|
|
23848
|
+
const cssBaseName = basename12(getStyleBaseName(cssFile));
|
|
23376
23849
|
const cssPascalName = toPascal(cssBaseName);
|
|
23377
23850
|
const cssKey = `${cssPascalName}CSS`;
|
|
23378
23851
|
const cssUrl = manifest[cssKey] || null;
|
|
@@ -23452,8 +23925,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23452
23925
|
const shouldRefreshAllPages = htmxPageFiles.length === 0 && shouldRefreshFromIslandChange;
|
|
23453
23926
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
23454
23927
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
23455
|
-
const htmxPageName =
|
|
23456
|
-
const builtHtmxPagePath =
|
|
23928
|
+
const htmxPageName = basename12(htmxPageFile);
|
|
23929
|
+
const builtHtmxPagePath = resolve40(outputHtmxPages, htmxPageName);
|
|
23457
23930
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
23458
23931
|
});
|
|
23459
23932
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -23562,7 +24035,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23562
24035
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
23563
24036
|
writeFs(destPath, html);
|
|
23564
24037
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
23565
|
-
const destPath =
|
|
24038
|
+
const destPath = resolve40(outputDir, basename12(sourceFile));
|
|
23566
24039
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
23567
24040
|
const source = await Bun.file(sourceFile).text();
|
|
23568
24041
|
await Bun.write(destPath, source);
|
|
@@ -23704,13 +24177,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23704
24177
|
});
|
|
23705
24178
|
if (config.tailwind && filesToRebuild && filesToRebuild.some(isTailwindCandidate)) {
|
|
23706
24179
|
try {
|
|
23707
|
-
const outputPath =
|
|
24180
|
+
const outputPath = resolve40(state.resolvedPaths.buildDir, config.tailwind.output);
|
|
23708
24181
|
const bytes = await Bun.file(outputPath).bytes();
|
|
23709
24182
|
const webPath = `/${config.tailwind.output.replace(/^\/+/, "")}`;
|
|
23710
24183
|
state.assetStore.set(webPath, bytes);
|
|
23711
24184
|
} catch {}
|
|
23712
24185
|
broadcastToClients(state, {
|
|
23713
|
-
data: {
|
|
24186
|
+
data: {
|
|
24187
|
+
cause: filesToRebuild?.filter(isTailwindCandidate) ?? [],
|
|
24188
|
+
framework: "tailwind",
|
|
24189
|
+
manifest
|
|
24190
|
+
},
|
|
23714
24191
|
message: "Tailwind utilities recompiled",
|
|
23715
24192
|
type: "style-update"
|
|
23716
24193
|
});
|
|
@@ -23875,8 +24352,8 @@ __export(exports_buildDepVendor, {
|
|
|
23875
24352
|
computeDepVendorPaths: () => computeDepVendorPaths,
|
|
23876
24353
|
buildDepVendor: () => buildDepVendor
|
|
23877
24354
|
});
|
|
23878
|
-
import { mkdirSync as
|
|
23879
|
-
import { join as
|
|
24355
|
+
import { mkdirSync as mkdirSync14 } from "fs";
|
|
24356
|
+
import { join as join32 } from "path";
|
|
23880
24357
|
import { rm as rm10 } from "fs/promises";
|
|
23881
24358
|
var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
|
|
23882
24359
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -23930,7 +24407,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
23930
24407
|
framework: Array.from(framework).filter(isResolvable4)
|
|
23931
24408
|
};
|
|
23932
24409
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
23933
|
-
const { readFileSync:
|
|
24410
|
+
const { readFileSync: readFileSync21 } = await import("fs");
|
|
23934
24411
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
23935
24412
|
const newSpecs = new Set;
|
|
23936
24413
|
for (const spec of specs) {
|
|
@@ -23945,7 +24422,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
23945
24422
|
}
|
|
23946
24423
|
let content;
|
|
23947
24424
|
try {
|
|
23948
|
-
content =
|
|
24425
|
+
content = readFileSync21(resolved, "utf-8");
|
|
23949
24426
|
} catch {
|
|
23950
24427
|
continue;
|
|
23951
24428
|
}
|
|
@@ -23977,7 +24454,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
23977
24454
|
bld.onLoad({ filter: /\.(?:m?js|cjs)$/ }, async (args) => {
|
|
23978
24455
|
const source = await Bun.file(args.path).text();
|
|
23979
24456
|
if (!source.includes("@__PURE__"))
|
|
23980
|
-
return
|
|
24457
|
+
return;
|
|
23981
24458
|
return {
|
|
23982
24459
|
contents: source.replace(PURE_ANNOTATION, ""),
|
|
23983
24460
|
loader: args.path.endsWith(".cjs") ? "js" : "js"
|
|
@@ -23987,7 +24464,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
23987
24464
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
23988
24465
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
23989
24466
|
const safeName = toSafeFileName6(specifier);
|
|
23990
|
-
const entryPath =
|
|
24467
|
+
const entryPath = join32(tmpDir, `${safeName}.ts`);
|
|
23991
24468
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
23992
24469
|
return { entryPath, specifier };
|
|
23993
24470
|
}));
|
|
@@ -24048,10 +24525,10 @@ var toSafeFileName6 = (specifier) => {
|
|
|
24048
24525
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
24049
24526
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
24050
24527
|
return {};
|
|
24051
|
-
const vendorDir =
|
|
24052
|
-
|
|
24053
|
-
const tmpDir =
|
|
24054
|
-
|
|
24528
|
+
const vendorDir = join32(buildDir, "vendor");
|
|
24529
|
+
mkdirSync14(vendorDir, { recursive: true });
|
|
24530
|
+
const tmpDir = join32(buildDir, "_dep_vendor_tmp");
|
|
24531
|
+
mkdirSync14(tmpDir, { recursive: true });
|
|
24055
24532
|
const allSpecs = new Set(initialSpecs);
|
|
24056
24533
|
const alreadyScanned = new Set;
|
|
24057
24534
|
let frontier = [...allSpecs, ...frameworkRoots];
|
|
@@ -24133,8 +24610,8 @@ __export(exports_devBuild, {
|
|
|
24133
24610
|
applyConfigChanges: () => applyConfigChanges
|
|
24134
24611
|
});
|
|
24135
24612
|
import { readdir as readdir5 } from "fs/promises";
|
|
24136
|
-
import { statSync as
|
|
24137
|
-
import { resolve as
|
|
24613
|
+
import { statSync as statSync7 } from "fs";
|
|
24614
|
+
import { resolve as resolve41 } from "path";
|
|
24138
24615
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
24139
24616
|
const configuredDirs = [
|
|
24140
24617
|
config.reactDirectory,
|
|
@@ -24157,7 +24634,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
24157
24634
|
return Object.keys(config).length > 0 ? config : null;
|
|
24158
24635
|
}, reloadConfig = async () => {
|
|
24159
24636
|
try {
|
|
24160
|
-
const configPath2 =
|
|
24637
|
+
const configPath2 = resolve41(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
24161
24638
|
const source = await Bun.file(configPath2).text();
|
|
24162
24639
|
return parseDirectoryConfig(source);
|
|
24163
24640
|
} catch {
|
|
@@ -24264,7 +24741,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
24264
24741
|
state.fileChangeQueue.clear();
|
|
24265
24742
|
}
|
|
24266
24743
|
}, handleCachedReload = async () => {
|
|
24267
|
-
const serverMtime =
|
|
24744
|
+
const serverMtime = statSync7(resolve41(Bun.main)).mtimeMs;
|
|
24268
24745
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
24269
24746
|
globalThis.__hmrServerMtime = serverMtime;
|
|
24270
24747
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -24301,8 +24778,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
24301
24778
|
return true;
|
|
24302
24779
|
}, resolveAbsoluteVersion2 = async () => {
|
|
24303
24780
|
const candidates = [
|
|
24304
|
-
|
|
24305
|
-
|
|
24781
|
+
resolve41(import.meta.dir, "..", "..", "package.json"),
|
|
24782
|
+
resolve41(import.meta.dir, "..", "package.json")
|
|
24306
24783
|
];
|
|
24307
24784
|
const [candidate, ...remaining] = candidates;
|
|
24308
24785
|
if (!candidate) {
|
|
@@ -24328,7 +24805,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
24328
24805
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
24329
24806
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
24330
24807
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
24331
|
-
const bytes = await Bun.file(
|
|
24808
|
+
const bytes = await Bun.file(resolve41(vendorDir, entry)).bytes();
|
|
24332
24809
|
assetStore.set(webPath, bytes);
|
|
24333
24810
|
}));
|
|
24334
24811
|
}, devBuild = async (config) => {
|
|
@@ -24377,16 +24854,27 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
24377
24854
|
await resolveAbsoluteVersion2();
|
|
24378
24855
|
recordStep("resolve version", stepStartedAt);
|
|
24379
24856
|
const buildStart = performance.now();
|
|
24380
|
-
|
|
24381
|
-
|
|
24382
|
-
|
|
24383
|
-
|
|
24384
|
-
|
|
24385
|
-
|
|
24857
|
+
let buildResult = null;
|
|
24858
|
+
try {
|
|
24859
|
+
buildResult = await build({
|
|
24860
|
+
...config,
|
|
24861
|
+
mode: "development",
|
|
24862
|
+
options: {
|
|
24863
|
+
...config.options,
|
|
24864
|
+
injectHMR: true,
|
|
24865
|
+
throwOnError: true
|
|
24866
|
+
}
|
|
24867
|
+
});
|
|
24868
|
+
} catch (err) {
|
|
24869
|
+
console.error(`[hmr] initial build failed \u2014 starting dev server with an empty manifest.
|
|
24870
|
+
` + " Fix the error above and save the file to trigger a recovery rebuild.");
|
|
24871
|
+
if (err instanceof Error && err.stack) {
|
|
24872
|
+
console.error(err.stack);
|
|
24386
24873
|
}
|
|
24387
|
-
|
|
24388
|
-
|
|
24389
|
-
const
|
|
24874
|
+
state.initialBuildFailed = true;
|
|
24875
|
+
}
|
|
24876
|
+
const manifest = buildResult?.manifest ?? {};
|
|
24877
|
+
const conventions = buildResult?.conventions ?? {};
|
|
24390
24878
|
recordStep("initial build", buildStart);
|
|
24391
24879
|
if (Object.keys(manifest).length === 0) {
|
|
24392
24880
|
console.log("\u26A0\uFE0F Manifest is empty - this is OK for HTML/HTMX-only projects");
|
|
@@ -24396,11 +24884,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
24396
24884
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
24397
24885
|
recordStep("populate asset store", stepStartedAt);
|
|
24398
24886
|
stepStartedAt = performance.now();
|
|
24399
|
-
const reactVendorDir =
|
|
24400
|
-
const angularVendorDir =
|
|
24401
|
-
const svelteVendorDir =
|
|
24402
|
-
const vueVendorDir =
|
|
24403
|
-
const depVendorDir =
|
|
24887
|
+
const reactVendorDir = resolve41(state.resolvedPaths.buildDir, "react", "vendor");
|
|
24888
|
+
const angularVendorDir = resolve41(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
24889
|
+
const svelteVendorDir = resolve41(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
24890
|
+
const vueVendorDir = resolve41(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
24891
|
+
const depVendorDir = resolve41(state.resolvedPaths.buildDir, "vendor");
|
|
24404
24892
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
24405
24893
|
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
24406
24894
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -24466,7 +24954,37 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
24466
24954
|
}
|
|
24467
24955
|
state.manifest = manifest;
|
|
24468
24956
|
stepStartedAt = performance.now();
|
|
24957
|
+
const recoverFromColdStartFailure = async () => {
|
|
24958
|
+
await waitForRebuild(state);
|
|
24959
|
+
state.isRebuilding = true;
|
|
24960
|
+
try {
|
|
24961
|
+
const recoveryResult = await build({
|
|
24962
|
+
...config,
|
|
24963
|
+
mode: "development",
|
|
24964
|
+
options: {
|
|
24965
|
+
...config.options,
|
|
24966
|
+
injectHMR: true,
|
|
24967
|
+
throwOnError: true
|
|
24968
|
+
}
|
|
24969
|
+
});
|
|
24970
|
+
if (recoveryResult?.manifest) {
|
|
24971
|
+
Object.assign(manifest, recoveryResult.manifest);
|
|
24972
|
+
state.manifest = manifest;
|
|
24973
|
+
await populateAssetStore(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
24974
|
+
state.initialBuildFailed = false;
|
|
24975
|
+
console.log("[hmr] cold-start recovery rebuild succeeded \u2014 manifest populated.");
|
|
24976
|
+
}
|
|
24977
|
+
} catch {} finally {
|
|
24978
|
+
state.rebuildCount++;
|
|
24979
|
+
state.isRebuilding = false;
|
|
24980
|
+
state.fileChangeQueue.clear();
|
|
24981
|
+
}
|
|
24982
|
+
};
|
|
24469
24983
|
startFileWatching(state, config, (filePath) => {
|
|
24984
|
+
if (state.initialBuildFailed) {
|
|
24985
|
+
recoverFromColdStartFailure();
|
|
24986
|
+
return;
|
|
24987
|
+
}
|
|
24470
24988
|
queueFileChange(state, filePath, config, (newBuildResult) => {
|
|
24471
24989
|
Object.assign(manifest, newBuildResult.manifest);
|
|
24472
24990
|
state.manifest = manifest;
|
|
@@ -24481,7 +24999,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
24481
24999
|
manifest
|
|
24482
25000
|
};
|
|
24483
25001
|
globalThis.__hmrDevResult = result;
|
|
24484
|
-
globalThis.__hmrServerMtime =
|
|
25002
|
+
globalThis.__hmrServerMtime = statSync7(resolve41(Bun.main)).mtimeMs;
|
|
24485
25003
|
return result;
|
|
24486
25004
|
};
|
|
24487
25005
|
var init_devBuild = __esm(() => {
|
|
@@ -24521,5 +25039,5 @@ export {
|
|
|
24521
25039
|
build
|
|
24522
25040
|
};
|
|
24523
25041
|
|
|
24524
|
-
//# debugId=
|
|
25042
|
+
//# debugId=5DF1E4572046015A64756E2164756E21
|
|
24525
25043
|
//# sourceMappingURL=build.js.map
|