@absolutejs/absolute 0.19.0-beta.852 → 0.19.0-beta.854
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 +52 -76
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +53 -77
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +2129 -730
- package/dist/build.js.map +17 -8
- package/dist/dev/client/handlers/angularHmrShim.ts +77 -0
- package/dist/dev/client/hmrClient.ts +55 -5
- package/dist/index.js +2219 -778
- package/dist/index.js.map +18 -9
- package/dist/react/index.js +3 -1
- package/dist/react/index.js.map +2 -2
- package/dist/react/server.js +3 -1
- package/dist/react/server.js.map +2 -2
- package/dist/src/core/prepare.d.ts +25 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +32 -0
- package/dist/src/dev/angular/hmrCompiler.d.ts +18 -0
- package/dist/src/dev/angular/hmrImportGenerator.d.ts +3 -0
- package/dist/src/dev/angular/hmrInjectionPlugin.d.ts +7 -0
- package/dist/src/dev/angular/resolveOwningComponents.d.ts +8 -0
- package/dist/src/dev/angular/vendor/translator/api/ast_factory.d.ts +363 -0
- package/dist/src/dev/angular/vendor/translator/api/import_generator.d.ts +49 -0
- package/dist/src/dev/angular/vendor/translator/context.d.ts +18 -0
- package/dist/src/dev/angular/vendor/translator/translator.d.ts +75 -0
- package/dist/src/dev/angular/vendor/translator/ts_util.d.ts +12 -0
- package/dist/src/dev/angular/vendor/translator/typescript_ast_factory.d.ts +66 -0
- package/dist/src/dev/angular/vendor/translator/typescript_translator.d.ts +13 -0
- package/dist/src/dev/rebuildTrigger.d.ts +1 -0
- package/dist/src/plugins/hmr.d.ts +25 -0
- package/dist/src/vue/components/Image.d.ts +1 -1
- package/dist/svelte/index.js +3 -1
- package/dist/svelte/index.js.map +2 -2
- package/dist/svelte/server.js +3 -1
- package/dist/svelte/server.js.map +2 -2
- package/dist/vue/index.js +3 -1
- package/dist/vue/index.js.map +2 -2
- package/dist/vue/server.js +3 -1
- package/dist/vue/server.js.map +2 -2
- package/package.json +1 -1
- package/dist/dev/client/handlers/angular.ts +0 -684
- package/dist/dev/client/handlers/angularRuntime.ts +0 -415
- package/dist/src/dev/angular/editTypeDetection.d.ts +0 -8
package/dist/build.js
CHANGED
|
@@ -215,6 +215,8 @@ var colors2, frameworkColors, formatPath = (filePath) => {
|
|
|
215
215
|
console.error(`${timestamp} ${tag} ${fullMessage}`);
|
|
216
216
|
}, logHmrUpdate = (path, framework, duration) => {
|
|
217
217
|
log("hmr update", { duration, framework, path });
|
|
218
|
+
}, logInfo = (message) => {
|
|
219
|
+
log(message);
|
|
218
220
|
}, logScriptUpdate = (path, framework, duration) => {
|
|
219
221
|
log("script update", { duration, framework, path });
|
|
220
222
|
}, logServerReload = () => {
|
|
@@ -9552,19 +9554,87 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
9552
9554
|
angularLinkerPlugin = createAngularLinkerPlugin(false);
|
|
9553
9555
|
});
|
|
9554
9556
|
|
|
9557
|
+
// src/dev/angular/hmrInjectionPlugin.ts
|
|
9558
|
+
var exports_hmrInjectionPlugin = {};
|
|
9559
|
+
__export(exports_hmrInjectionPlugin, {
|
|
9560
|
+
createAngularHmrInjectionPlugin: () => createAngularHmrInjectionPlugin
|
|
9561
|
+
});
|
|
9562
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
9563
|
+
import { relative as relative6, resolve as resolve12 } from "path";
|
|
9564
|
+
var COMPONENT_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
|
|
9565
|
+
|
|
9566
|
+
// absolutejs HMR \u2014 auto-generated; mirrors compileHmrInitializer from
|
|
9567
|
+
// @angular/compiler with import.meta.hot adapted to globalThis.__angularHmr.
|
|
9568
|
+
{
|
|
9569
|
+
const __ng_hmr_id = ${encodedIdLiteral};
|
|
9570
|
+
const __ng_hmr_load = async (t) => {
|
|
9571
|
+
const [u, core] = await Promise.all([
|
|
9572
|
+
import('/@ng/component?c=' + encodeURIComponent(__ng_hmr_id) + '&t=' + t),
|
|
9573
|
+
import('@angular/core')
|
|
9574
|
+
]);
|
|
9575
|
+
if (u && typeof u.default === 'function') u.default(${className}, [core]);
|
|
9576
|
+
};
|
|
9577
|
+
if (typeof globalThis !== 'undefined' &&
|
|
9578
|
+
globalThis.__angularHmr &&
|
|
9579
|
+
typeof globalThis.__angularHmr.on === 'function') {
|
|
9580
|
+
globalThis.__angularHmr.on('angular:component-update', (d) => {
|
|
9581
|
+
if (d && d.id === __ng_hmr_id) __ng_hmr_load(d.timestamp);
|
|
9582
|
+
});
|
|
9583
|
+
}
|
|
9584
|
+
}
|
|
9585
|
+
`, createAngularHmrInjectionPlugin = (params) => {
|
|
9586
|
+
const { generatedAngularRoot, userAngularRoot, projectRoot } = params;
|
|
9587
|
+
const normalizedGenRoot = resolve12(generatedAngularRoot).replace(/\\/g, "/");
|
|
9588
|
+
return {
|
|
9589
|
+
name: "absolute-angular-hmr-injection",
|
|
9590
|
+
setup(build) {
|
|
9591
|
+
build.onLoad({ filter: /\.component\.js$/ }, async (args) => {
|
|
9592
|
+
const normalizedPath = args.path.replace(/\\/g, "/");
|
|
9593
|
+
if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
|
|
9594
|
+
return;
|
|
9595
|
+
const text = await readFile5(args.path, "utf8");
|
|
9596
|
+
const seen = new Set;
|
|
9597
|
+
const classNames = [];
|
|
9598
|
+
let match;
|
|
9599
|
+
const re2 = new RegExp(COMPONENT_DECORATOR_RE.source, COMPONENT_DECORATOR_RE.flags);
|
|
9600
|
+
while ((match = re2.exec(text)) !== null) {
|
|
9601
|
+
const className = match[1];
|
|
9602
|
+
if (className && !seen.has(className)) {
|
|
9603
|
+
seen.add(className);
|
|
9604
|
+
classNames.push(className);
|
|
9605
|
+
}
|
|
9606
|
+
}
|
|
9607
|
+
if (classNames.length === 0)
|
|
9608
|
+
return;
|
|
9609
|
+
const relFromGenRoot = relative6(generatedAngularRoot, args.path).replace(/\\/g, "/");
|
|
9610
|
+
const userTsPath = resolve12(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
|
|
9611
|
+
const projectRel = relative6(projectRoot, userTsPath).replace(/\\/g, "/");
|
|
9612
|
+
const tail = classNames.map((className) => {
|
|
9613
|
+
const id = `${projectRel}@${className}`;
|
|
9614
|
+
return buildHmrTail(className, JSON.stringify(id));
|
|
9615
|
+
}).join("");
|
|
9616
|
+
return { contents: text + tail, loader: "js" };
|
|
9617
|
+
});
|
|
9618
|
+
}
|
|
9619
|
+
};
|
|
9620
|
+
};
|
|
9621
|
+
var init_hmrInjectionPlugin = __esm(() => {
|
|
9622
|
+
COMPONENT_DECORATOR_RE = /([A-Z][A-Za-z0-9_$]*)\s*=\s*__legacyDecorateClassTS[A-Za-z0-9_$]*\s*\(\s*\[[\s\S]*?\bComponent[A-Za-z0-9_$]*\s*\(/g;
|
|
9623
|
+
});
|
|
9624
|
+
|
|
9555
9625
|
// src/utils/cleanStaleOutputs.ts
|
|
9556
9626
|
import { rm as rm2 } from "fs/promises";
|
|
9557
|
-
import { resolve as
|
|
9627
|
+
import { resolve as resolve13 } from "path";
|
|
9558
9628
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
9559
9629
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
9560
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
9630
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve13(path)));
|
|
9561
9631
|
const glob = new Glob5("**/*");
|
|
9562
9632
|
const removals = [];
|
|
9563
|
-
for (const
|
|
9564
|
-
const absolute =
|
|
9633
|
+
for (const relative7 of glob.scanSync({ cwd: buildPath })) {
|
|
9634
|
+
const absolute = resolve13(buildPath, relative7);
|
|
9565
9635
|
if (currentPaths.has(absolute))
|
|
9566
9636
|
continue;
|
|
9567
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
9637
|
+
if (!HASHED_FILE_PATTERN.test(relative7))
|
|
9568
9638
|
continue;
|
|
9569
9639
|
removals.push(rm2(absolute, { force: true }));
|
|
9570
9640
|
}
|
|
@@ -9793,11 +9863,11 @@ var init_buildDirectoryLock = __esm(() => {
|
|
|
9793
9863
|
});
|
|
9794
9864
|
|
|
9795
9865
|
// src/utils/validateSafePath.ts
|
|
9796
|
-
import { resolve as
|
|
9866
|
+
import { resolve as resolve14, relative as relative7 } from "path";
|
|
9797
9867
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
9798
|
-
const absoluteBase =
|
|
9799
|
-
const absoluteTarget =
|
|
9800
|
-
const relativePath = normalizePath(
|
|
9868
|
+
const absoluteBase = resolve14(baseDirectory);
|
|
9869
|
+
const absoluteTarget = resolve14(baseDirectory, targetPath);
|
|
9870
|
+
const relativePath = normalizePath(relative7(absoluteBase, absoluteTarget));
|
|
9801
9871
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
9802
9872
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
9803
9873
|
}
|
|
@@ -9951,22 +10021,22 @@ import {
|
|
|
9951
10021
|
join as join15,
|
|
9952
10022
|
basename as basename4,
|
|
9953
10023
|
extname as extname5,
|
|
9954
|
-
resolve as
|
|
9955
|
-
relative as
|
|
10024
|
+
resolve as resolve15,
|
|
10025
|
+
relative as relative8,
|
|
9956
10026
|
sep as sep2
|
|
9957
10027
|
} from "path";
|
|
9958
10028
|
import { env } from "process";
|
|
9959
10029
|
var {write, file, Transpiler } = globalThis.Bun;
|
|
9960
10030
|
var resolveDevClientDir2 = () => {
|
|
9961
10031
|
const projectRoot = process.cwd();
|
|
9962
|
-
const fromSource =
|
|
10032
|
+
const fromSource = resolve15(import.meta.dir, "../dev/client");
|
|
9963
10033
|
if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
9964
10034
|
return fromSource;
|
|
9965
10035
|
}
|
|
9966
|
-
const fromNodeModules =
|
|
10036
|
+
const fromNodeModules = resolve15(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
9967
10037
|
if (existsSync14(fromNodeModules))
|
|
9968
10038
|
return fromNodeModules;
|
|
9969
|
-
return
|
|
10039
|
+
return resolve15(import.meta.dir, "./dev/client");
|
|
9970
10040
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
9971
10041
|
persistentCache.clear();
|
|
9972
10042
|
sourceHashCache.clear();
|
|
@@ -9996,7 +10066,7 @@ var resolveDevClientDir2 = () => {
|
|
|
9996
10066
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
9997
10067
|
if (!spec.startsWith("."))
|
|
9998
10068
|
return null;
|
|
9999
|
-
const basePath =
|
|
10069
|
+
const basePath = resolve15(dirname9(from), spec);
|
|
10000
10070
|
const candidates = [
|
|
10001
10071
|
basePath,
|
|
10002
10072
|
`${basePath}.ts`,
|
|
@@ -10023,7 +10093,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10023
10093
|
const resolved = resolvePackageImport(spec);
|
|
10024
10094
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
10025
10095
|
}
|
|
10026
|
-
const basePath =
|
|
10096
|
+
const basePath = resolve15(dirname9(from), spec);
|
|
10027
10097
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
10028
10098
|
if (!explicit) {
|
|
10029
10099
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -10044,8 +10114,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10044
10114
|
return jsPath;
|
|
10045
10115
|
return null;
|
|
10046
10116
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
10047
|
-
const toServer =
|
|
10048
|
-
const toClient =
|
|
10117
|
+
const toServer = relative8(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
10118
|
+
const toClient = relative8(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
10049
10119
|
rewrites.set(rawSpec, {
|
|
10050
10120
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
10051
10121
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -10083,8 +10153,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10083
10153
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
10084
10154
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
10085
10155
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedClient) : preprocessedClient;
|
|
10086
|
-
const rawRel = dirname9(
|
|
10087
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
10156
|
+
const rawRel = dirname9(relative8(svelteRoot, src)).replace(/\\/g, "/");
|
|
10157
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative8(process.cwd(), dirname9(src)).replace(/\\/g, "/")}` : rawRel;
|
|
10088
10158
|
const baseName = basename4(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
10089
10159
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
10090
10160
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -10105,15 +10175,15 @@ var resolveDevClientDir2 = () => {
|
|
|
10105
10175
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
10106
10176
|
if (!resolved)
|
|
10107
10177
|
continue;
|
|
10108
|
-
const childRel =
|
|
10178
|
+
const childRel = relative8(svelteRoot, resolved).replace(/\\/g, "/");
|
|
10109
10179
|
if (!childRel.startsWith(".."))
|
|
10110
10180
|
continue;
|
|
10111
10181
|
const childBuilt2 = cache.get(resolved);
|
|
10112
10182
|
if (!childBuilt2)
|
|
10113
10183
|
continue;
|
|
10114
10184
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
10115
|
-
const toServer =
|
|
10116
|
-
const toClient =
|
|
10185
|
+
const toServer = relative8(ssrOutputDir, childBuilt2.ssr).replace(/\\/g, "/");
|
|
10186
|
+
const toClient = relative8(clientOutputDir, childBuilt2.client).replace(/\\/g, "/");
|
|
10117
10187
|
externalRewrites.set(origSpec, {
|
|
10118
10188
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
10119
10189
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -10147,7 +10217,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10147
10217
|
}).js.code;
|
|
10148
10218
|
let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
10149
10219
|
if (mode === "client" && isDev) {
|
|
10150
|
-
const moduleKey = `/@src/${
|
|
10220
|
+
const moduleKey = `/@src/${relative8(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
10151
10221
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
10152
10222
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10153
10223
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -10190,10 +10260,10 @@ var resolveDevClientDir2 = () => {
|
|
|
10190
10260
|
};
|
|
10191
10261
|
const roots = await Promise.all(entryPoints.map(build));
|
|
10192
10262
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
10193
|
-
const relClientDir = dirname9(
|
|
10263
|
+
const relClientDir = dirname9(relative8(clientDir, client));
|
|
10194
10264
|
const name = basename4(client, extname5(client));
|
|
10195
10265
|
const indexPath = join15(indexDir, relClientDir, `${name}.js`);
|
|
10196
|
-
const importRaw =
|
|
10266
|
+
const importRaw = relative8(dirname9(indexPath), client).split(sep2).join("/");
|
|
10197
10267
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
10198
10268
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
10199
10269
|
import "${hmrClientPath3}";
|
|
@@ -10270,7 +10340,7 @@ if (typeof window !== "undefined") {
|
|
|
10270
10340
|
return {
|
|
10271
10341
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
10272
10342
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
10273
|
-
const rel = dirname9(
|
|
10343
|
+
const rel = dirname9(relative8(clientDir, client));
|
|
10274
10344
|
return join15(indexDir, rel, basename4(client));
|
|
10275
10345
|
}),
|
|
10276
10346
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -10359,20 +10429,20 @@ import {
|
|
|
10359
10429
|
dirname as dirname10,
|
|
10360
10430
|
isAbsolute as isAbsolute3,
|
|
10361
10431
|
join as join16,
|
|
10362
|
-
relative as
|
|
10363
|
-
resolve as
|
|
10432
|
+
relative as relative9,
|
|
10433
|
+
resolve as resolve16
|
|
10364
10434
|
} from "path";
|
|
10365
10435
|
var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
10366
10436
|
var resolveDevClientDir3 = () => {
|
|
10367
10437
|
const projectRoot = process.cwd();
|
|
10368
|
-
const fromSource =
|
|
10438
|
+
const fromSource = resolve16(import.meta.dir, "../dev/client");
|
|
10369
10439
|
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10370
10440
|
return fromSource;
|
|
10371
10441
|
}
|
|
10372
|
-
const fromNodeModules =
|
|
10442
|
+
const fromNodeModules = resolve16(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
10373
10443
|
if (existsSync15(fromNodeModules))
|
|
10374
10444
|
return fromNodeModules;
|
|
10375
|
-
return
|
|
10445
|
+
return resolve16(import.meta.dir, "./dev/client");
|
|
10376
10446
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
10377
10447
|
scriptCache.clear();
|
|
10378
10448
|
scriptSetupCache.clear();
|
|
@@ -10411,14 +10481,14 @@ var resolveDevClientDir3 = () => {
|
|
|
10411
10481
|
return "template-only";
|
|
10412
10482
|
}
|
|
10413
10483
|
return "full";
|
|
10414
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
10484
|
+
}, generateVueHmrId = (sourceFilePath, vueRootDir) => relative9(vueRootDir, sourceFilePath).replace(/\\/g, "/").replace(/\.vue$/, ""), extractImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => importPath !== undefined), toJs = (filePath, sourceDir) => {
|
|
10415
10485
|
if (filePath.endsWith(".vue"))
|
|
10416
10486
|
return filePath.replace(/\.vue$/, ".js");
|
|
10417
10487
|
if (filePath.endsWith(".ts"))
|
|
10418
10488
|
return filePath.replace(/\.ts$/, ".js");
|
|
10419
10489
|
if (isStylePath(filePath)) {
|
|
10420
10490
|
if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
|
|
10421
|
-
return
|
|
10491
|
+
return resolve16(sourceDir, filePath);
|
|
10422
10492
|
}
|
|
10423
10493
|
return filePath;
|
|
10424
10494
|
}
|
|
@@ -10444,7 +10514,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10444
10514
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
10445
10515
|
if (cachedResult)
|
|
10446
10516
|
return cachedResult;
|
|
10447
|
-
const relativeFilePath =
|
|
10517
|
+
const relativeFilePath = relative9(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
10448
10518
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
10449
10519
|
const fileBaseName = basename5(sourceFilePath, ".vue");
|
|
10450
10520
|
const componentId = toKebab(fileBaseName);
|
|
@@ -10482,12 +10552,12 @@ var resolveDevClientDir3 = () => {
|
|
|
10482
10552
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
10483
10553
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
10484
10554
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
10485
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path :
|
|
10555
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path : resolve16(dirname10(sourceFilePath), path));
|
|
10486
10556
|
for (const stylePath of stylePathsImported) {
|
|
10487
10557
|
addStyleImporter(sourceFilePath, stylePath);
|
|
10488
10558
|
}
|
|
10489
10559
|
const childBuildResults = await Promise.all([
|
|
10490
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
10560
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve16(dirname10(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
10491
10561
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
10492
10562
|
]);
|
|
10493
10563
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -10578,7 +10648,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10578
10648
|
let result2 = code;
|
|
10579
10649
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
10580
10650
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
10581
|
-
let rel =
|
|
10651
|
+
let rel = relative9(dirname10(outputPath), targetPath).replace(/\\/g, "/");
|
|
10582
10652
|
if (!rel.startsWith("."))
|
|
10583
10653
|
rel = `./${rel}`;
|
|
10584
10654
|
result2 = result2.replaceAll(bareImport, rel);
|
|
@@ -10596,7 +10666,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10596
10666
|
hmrId,
|
|
10597
10667
|
serverPath: serverOutputPath,
|
|
10598
10668
|
tsHelperPaths: [
|
|
10599
|
-
...helperModulePaths.map((helper) =>
|
|
10669
|
+
...helperModulePaths.map((helper) => resolve16(dirname10(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
10600
10670
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
10601
10671
|
]
|
|
10602
10672
|
};
|
|
@@ -10619,7 +10689,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10619
10689
|
const buildCache = new Map;
|
|
10620
10690
|
const allTsHelperPaths = new Set;
|
|
10621
10691
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
10622
|
-
const result = await compileVueFile(
|
|
10692
|
+
const result = await compileVueFile(resolve16(entryPath), {
|
|
10623
10693
|
client: clientOutputDir,
|
|
10624
10694
|
css: cssOutputDir,
|
|
10625
10695
|
server: serverOutputDir
|
|
@@ -10627,7 +10697,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10627
10697
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
10628
10698
|
const entryBaseName = basename5(entryPath, ".vue");
|
|
10629
10699
|
const indexOutputFile = join16(indexOutputDir, `${entryBaseName}.js`);
|
|
10630
|
-
const clientOutputFile = join16(clientOutputDir,
|
|
10700
|
+
const clientOutputFile = join16(clientOutputDir, relative9(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
10631
10701
|
await mkdir4(dirname10(indexOutputFile), { recursive: true });
|
|
10632
10702
|
const vueHmrImports = isDev ? [
|
|
10633
10703
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -10635,7 +10705,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10635
10705
|
] : [];
|
|
10636
10706
|
await write2(indexOutputFile, [
|
|
10637
10707
|
...vueHmrImports,
|
|
10638
|
-
`import Comp, * as PageModule from "${
|
|
10708
|
+
`import Comp, * as PageModule from "${relative9(dirname10(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
10639
10709
|
'import { createSSRApp, createApp } from "vue";',
|
|
10640
10710
|
"",
|
|
10641
10711
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -10779,7 +10849,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10779
10849
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
10780
10850
|
const sourceCode = await file2(tsPath).text();
|
|
10781
10851
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
10782
|
-
const relativeJsPath =
|
|
10852
|
+
const relativeJsPath = relative9(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
10783
10853
|
const outClientPath = join16(clientOutputDir, relativeJsPath);
|
|
10784
10854
|
const outServerPath = join16(serverOutputDir, relativeJsPath);
|
|
10785
10855
|
await mkdir4(dirname10(outClientPath), { recursive: true });
|
|
@@ -11284,17 +11354,17 @@ __export(exports_compileAngular, {
|
|
|
11284
11354
|
compileAngular: () => compileAngular
|
|
11285
11355
|
});
|
|
11286
11356
|
import { existsSync as existsSync16, readFileSync as readFileSync11, promises as fs } from "fs";
|
|
11287
|
-
import { join as join17, basename as basename6, sep as sep3, dirname as dirname11, resolve as
|
|
11357
|
+
import { join as join17, basename as basename6, sep as sep3, dirname as dirname11, resolve as resolve17, relative as relative10 } from "path";
|
|
11288
11358
|
import ts2 from "typescript";
|
|
11289
11359
|
var traceAngularPhase = async (name, fn2, metadata) => {
|
|
11290
11360
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
11291
11361
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata) : await fn2();
|
|
11292
11362
|
}, readTsconfigPathAliases = () => {
|
|
11293
11363
|
try {
|
|
11294
|
-
const configPath2 =
|
|
11364
|
+
const configPath2 = resolve17(process.cwd(), "tsconfig.json");
|
|
11295
11365
|
const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
|
|
11296
11366
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
11297
|
-
const baseUrl =
|
|
11367
|
+
const baseUrl = resolve17(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
11298
11368
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
11299
11369
|
return { aliases, baseUrl };
|
|
11300
11370
|
} catch {
|
|
@@ -11314,7 +11384,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11314
11384
|
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
11315
11385
|
for (const replacement of alias.replacements) {
|
|
11316
11386
|
const candidate = replacement.replace("*", wildcardValue);
|
|
11317
|
-
const resolved = resolveSourceFile(
|
|
11387
|
+
const resolved = resolveSourceFile(resolve17(baseUrl, candidate));
|
|
11318
11388
|
if (resolved)
|
|
11319
11389
|
return resolved;
|
|
11320
11390
|
}
|
|
@@ -11333,13 +11403,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11333
11403
|
];
|
|
11334
11404
|
return candidates.find((file3) => existsSync16(file3));
|
|
11335
11405
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
11336
|
-
const baseDir =
|
|
11406
|
+
const baseDir = resolve17(rootDir);
|
|
11337
11407
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
11338
11408
|
const transpiler4 = new Bun.Transpiler({ loader: "tsx" });
|
|
11339
11409
|
const scanCache = new Map;
|
|
11340
11410
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
11341
11411
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
11342
|
-
return resolveSourceFile(
|
|
11412
|
+
return resolveSourceFile(resolve17(fromDir, specifier));
|
|
11343
11413
|
}
|
|
11344
11414
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
11345
11415
|
if (aliased)
|
|
@@ -11348,7 +11418,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11348
11418
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
11349
11419
|
if (resolved.includes("/node_modules/"))
|
|
11350
11420
|
return;
|
|
11351
|
-
const absolute =
|
|
11421
|
+
const absolute = resolve17(resolved);
|
|
11352
11422
|
if (!absolute.startsWith(baseDir))
|
|
11353
11423
|
return;
|
|
11354
11424
|
return resolveSourceFile(absolute);
|
|
@@ -11364,7 +11434,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11364
11434
|
usesLegacyAnimations: false
|
|
11365
11435
|
});
|
|
11366
11436
|
}
|
|
11367
|
-
const resolved =
|
|
11437
|
+
const resolved = resolve17(actualPath);
|
|
11368
11438
|
const cached = scanCache.get(resolved);
|
|
11369
11439
|
if (cached)
|
|
11370
11440
|
return cached;
|
|
@@ -11393,7 +11463,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11393
11463
|
const actualPath = resolveSourceFile(filePath);
|
|
11394
11464
|
if (!actualPath)
|
|
11395
11465
|
return false;
|
|
11396
|
-
const resolved =
|
|
11466
|
+
const resolved = resolve17(actualPath);
|
|
11397
11467
|
if (visited.has(resolved))
|
|
11398
11468
|
return false;
|
|
11399
11469
|
visited.add(resolved);
|
|
@@ -11411,34 +11481,15 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
11411
11481
|
return (entryPath) => visit(entryPath);
|
|
11412
11482
|
}, resolveDevClientDir4 = () => {
|
|
11413
11483
|
const projectRoot = process.cwd();
|
|
11414
|
-
const fromSource =
|
|
11484
|
+
const fromSource = resolve17(import.meta.dir, "../dev/client");
|
|
11415
11485
|
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
11416
11486
|
return fromSource;
|
|
11417
11487
|
}
|
|
11418
|
-
const fromNodeModules =
|
|
11488
|
+
const fromNodeModules = resolve17(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
11419
11489
|
if (existsSync16(fromNodeModules))
|
|
11420
11490
|
return fromNodeModules;
|
|
11421
|
-
return
|
|
11422
|
-
}, devClientDir4, hmrClientPath5,
|
|
11423
|
-
const entityClassRegex = /(?:export\s+)?class\s+(\w+(?:Component|Service|Directive|Pipe))\s/g;
|
|
11424
|
-
const entityNames = [];
|
|
11425
|
-
let match;
|
|
11426
|
-
while ((match = entityClassRegex.exec(content)) !== null) {
|
|
11427
|
-
if (match[1])
|
|
11428
|
-
entityNames.push(match[1]);
|
|
11429
|
-
}
|
|
11430
|
-
if (entityNames.length === 0)
|
|
11431
|
-
return content;
|
|
11432
|
-
const registrations = entityNames.map((name) => ` if (typeof ${name} === 'function') window.__ANGULAR_HMR__.register('${sourceId}#${name}', ${name});`).join(`
|
|
11433
|
-
`);
|
|
11434
|
-
const hmrBlock = `
|
|
11435
|
-
// Angular HMR Runtime Layer (Level 3) \u2014 Auto-registration
|
|
11436
|
-
if (typeof window !== 'undefined' && window.__ANGULAR_HMR__) {
|
|
11437
|
-
${registrations}
|
|
11438
|
-
}
|
|
11439
|
-
`;
|
|
11440
|
-
return content + hmrBlock;
|
|
11441
|
-
}, formatDiagnosticMessage = (diagnostic) => {
|
|
11491
|
+
return resolve17(import.meta.dir, "./dev/client");
|
|
11492
|
+
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
11442
11493
|
try {
|
|
11443
11494
|
return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
11444
11495
|
`);
|
|
@@ -11480,11 +11531,11 @@ ${registrations}
|
|
|
11480
11531
|
if (hasJsLikeExtension(path))
|
|
11481
11532
|
return `${path}${query}`;
|
|
11482
11533
|
const importerDir = dirname11(importerOutputPath);
|
|
11483
|
-
const fileCandidate =
|
|
11534
|
+
const fileCandidate = resolve17(importerDir, `${path}.js`);
|
|
11484
11535
|
if (outputFiles?.has(fileCandidate) || existsSync16(fileCandidate)) {
|
|
11485
11536
|
return `${path}.js${query}`;
|
|
11486
11537
|
}
|
|
11487
|
-
const indexCandidate =
|
|
11538
|
+
const indexCandidate = resolve17(importerDir, path, "index.js");
|
|
11488
11539
|
if (outputFiles?.has(indexCandidate) || existsSync16(indexCandidate)) {
|
|
11489
11540
|
return `${path}/index.js${query}`;
|
|
11490
11541
|
}
|
|
@@ -11512,7 +11563,7 @@ ${registrations}
|
|
|
11512
11563
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
11513
11564
|
if (!isRelativeModuleSpecifier(specifier))
|
|
11514
11565
|
return null;
|
|
11515
|
-
const basePath =
|
|
11566
|
+
const basePath = resolve17(dirname11(fromFile), specifier);
|
|
11516
11567
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
11517
11568
|
`${basePath}.ts`,
|
|
11518
11569
|
`${basePath}.tsx`,
|
|
@@ -11523,9 +11574,9 @@ ${registrations}
|
|
|
11523
11574
|
join17(basePath, "index.mts"),
|
|
11524
11575
|
join17(basePath, "index.cts")
|
|
11525
11576
|
];
|
|
11526
|
-
return candidates.map((candidate) =>
|
|
11527
|
-
}, readFileForAotTransform = async (fileName,
|
|
11528
|
-
const hostSource =
|
|
11577
|
+
return candidates.map((candidate) => resolve17(candidate)).find((candidate) => existsSync16(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
11578
|
+
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
11579
|
+
const hostSource = readFile6?.(fileName);
|
|
11529
11580
|
if (typeof hostSource === "string")
|
|
11530
11581
|
return hostSource;
|
|
11531
11582
|
return fs.readFile(fileName, "utf-8");
|
|
@@ -11558,7 +11609,7 @@ ${registrations}
|
|
|
11558
11609
|
paths.push(join17(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
11559
11610
|
}
|
|
11560
11611
|
}
|
|
11561
|
-
return paths.map((path) =>
|
|
11612
|
+
return paths.map((path) => resolve17(path));
|
|
11562
11613
|
}, readResourceCacheFile = async (cachePath) => {
|
|
11563
11614
|
try {
|
|
11564
11615
|
const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
|
|
@@ -11590,7 +11641,7 @@ ${registrations}
|
|
|
11590
11641
|
].join("\x00");
|
|
11591
11642
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
11592
11643
|
return join17(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
11593
|
-
}, precomputeAotResourceTransforms = async (inputPaths,
|
|
11644
|
+
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
11594
11645
|
const transformedSources = new Map;
|
|
11595
11646
|
const visited = new Set;
|
|
11596
11647
|
const stats = {
|
|
@@ -11600,14 +11651,14 @@ ${registrations}
|
|
|
11600
11651
|
transformedFiles: 0
|
|
11601
11652
|
};
|
|
11602
11653
|
const transformFile = async (filePath) => {
|
|
11603
|
-
const resolvedPath =
|
|
11654
|
+
const resolvedPath = resolve17(filePath);
|
|
11604
11655
|
if (visited.has(resolvedPath))
|
|
11605
11656
|
return;
|
|
11606
11657
|
visited.add(resolvedPath);
|
|
11607
11658
|
if (!existsSync16(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
11608
11659
|
return;
|
|
11609
11660
|
stats.filesVisited += 1;
|
|
11610
|
-
const source = await readFileForAotTransform(resolvedPath,
|
|
11661
|
+
const source = await readFileForAotTransform(resolvedPath, readFile6);
|
|
11611
11662
|
const cachePath = await resolveResourceTransformCachePath(resolvedPath, source, stylePreprocessors);
|
|
11612
11663
|
const cached = await readResourceCacheFile(cachePath);
|
|
11613
11664
|
let transformedSource;
|
|
@@ -11635,7 +11686,7 @@ ${registrations}
|
|
|
11635
11686
|
return { stats, transformedSources };
|
|
11636
11687
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
11637
11688
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
11638
|
-
const outputPath =
|
|
11689
|
+
const outputPath = resolve17(join17(outDir, relative10(process.cwd(), resolve17(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
11639
11690
|
return [
|
|
11640
11691
|
outputPath,
|
|
11641
11692
|
buildIslandMetadataExports(readFileSync11(inputPath, "utf-8"))
|
|
@@ -11646,7 +11697,7 @@ ${registrations}
|
|
|
11646
11697
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
11647
11698
|
const tsPath = __require.resolve("typescript");
|
|
11648
11699
|
const tsRootDir = dirname11(tsPath);
|
|
11649
|
-
return tsRootDir.endsWith("lib") ? tsRootDir :
|
|
11700
|
+
return tsRootDir.endsWith("lib") ? tsRootDir : resolve17(tsRootDir, "lib");
|
|
11650
11701
|
});
|
|
11651
11702
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
11652
11703
|
const options = {
|
|
@@ -11688,7 +11739,7 @@ ${registrations}
|
|
|
11688
11739
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
11689
11740
|
};
|
|
11690
11741
|
const emitted = {};
|
|
11691
|
-
const resolvedOutDir =
|
|
11742
|
+
const resolvedOutDir = resolve17(outDir);
|
|
11692
11743
|
host.writeFile = (fileName, text) => {
|
|
11693
11744
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
11694
11745
|
emitted[relativePath] = text;
|
|
@@ -11710,12 +11761,12 @@ ${registrations}
|
|
|
11710
11761
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
11711
11762
|
return source;
|
|
11712
11763
|
}
|
|
11713
|
-
const resolvedPath =
|
|
11764
|
+
const resolvedPath = resolve17(fileName);
|
|
11714
11765
|
return transformedSources.get(resolvedPath) ?? source;
|
|
11715
11766
|
};
|
|
11716
11767
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
11717
11768
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
11718
|
-
const source = transformedSources.get(
|
|
11769
|
+
const source = transformedSources.get(resolve17(fileName));
|
|
11719
11770
|
if (source) {
|
|
11720
11771
|
return ts2.createSourceFile(fileName, source, languageVersion, true);
|
|
11721
11772
|
}
|
|
@@ -11739,7 +11790,7 @@ ${registrations}
|
|
|
11739
11790
|
content,
|
|
11740
11791
|
target: join17(outDir, fileName)
|
|
11741
11792
|
}));
|
|
11742
|
-
const outputFiles = new Set(rawEntries.map(({ target }) =>
|
|
11793
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve17(target)));
|
|
11743
11794
|
return rawEntries.map(({ content, target }) => {
|
|
11744
11795
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
11745
11796
|
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
@@ -11754,7 +11805,7 @@ ${registrations}
|
|
|
11754
11805
|
return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
|
|
11755
11806
|
});
|
|
11756
11807
|
processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
|
|
11757
|
-
processedContent += islandMetadataByOutputPath.get(
|
|
11808
|
+
processedContent += islandMetadataByOutputPath.get(resolve17(target)) ?? "";
|
|
11758
11809
|
return { content: processedContent, target };
|
|
11759
11810
|
});
|
|
11760
11811
|
});
|
|
@@ -11775,7 +11826,7 @@ ${registrations}
|
|
|
11775
11826
|
}
|
|
11776
11827
|
return null;
|
|
11777
11828
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
11778
|
-
const sourceEntry =
|
|
11829
|
+
const sourceEntry = resolve17(import.meta.dir, "../angular/components/index.ts");
|
|
11779
11830
|
if (existsSync16(sourceEntry)) {
|
|
11780
11831
|
return sourceEntry.replace(/\\/g, "/");
|
|
11781
11832
|
}
|
|
@@ -12005,10 +12056,10 @@ ${fields}
|
|
|
12005
12056
|
source: result
|
|
12006
12057
|
};
|
|
12007
12058
|
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
|
|
12008
|
-
const entryPath =
|
|
12059
|
+
const entryPath = resolve17(inputPath);
|
|
12009
12060
|
const allOutputs = [];
|
|
12010
12061
|
const visited = new Set;
|
|
12011
|
-
const baseDir =
|
|
12062
|
+
const baseDir = resolve17(rootDir ?? process.cwd());
|
|
12012
12063
|
let usesLegacyAnimations = false;
|
|
12013
12064
|
const angularTranspiler = new Bun.Transpiler({
|
|
12014
12065
|
loader: "ts",
|
|
@@ -12035,7 +12086,7 @@ ${fields}
|
|
|
12035
12086
|
};
|
|
12036
12087
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
12037
12088
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
12038
|
-
return resolveSourceFile2(
|
|
12089
|
+
return resolveSourceFile2(resolve17(fromDir, specifier));
|
|
12039
12090
|
}
|
|
12040
12091
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
|
|
12041
12092
|
if (aliased)
|
|
@@ -12044,7 +12095,7 @@ ${fields}
|
|
|
12044
12095
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
12045
12096
|
if (resolved.includes("/node_modules/"))
|
|
12046
12097
|
return;
|
|
12047
|
-
const absolute =
|
|
12098
|
+
const absolute = resolve17(resolved);
|
|
12048
12099
|
if (!absolute.startsWith(baseDir))
|
|
12049
12100
|
return;
|
|
12050
12101
|
return resolveSourceFile2(absolute);
|
|
@@ -12093,13 +12144,13 @@ ${fields}
|
|
|
12093
12144
|
return `${prefix}${dots}`;
|
|
12094
12145
|
return `${prefix}../${dots}`;
|
|
12095
12146
|
});
|
|
12096
|
-
if (
|
|
12147
|
+
if (resolve17(actualPath) === entryPath) {
|
|
12097
12148
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
12098
12149
|
}
|
|
12099
12150
|
return processedContent;
|
|
12100
12151
|
};
|
|
12101
12152
|
const transpileFile = async (filePath) => {
|
|
12102
|
-
const resolved =
|
|
12153
|
+
const resolved = resolve17(filePath);
|
|
12103
12154
|
if (visited.has(resolved))
|
|
12104
12155
|
return;
|
|
12105
12156
|
visited.add(resolved);
|
|
@@ -12136,7 +12187,7 @@ ${fields}
|
|
|
12136
12187
|
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
12137
12188
|
if (!resolved2)
|
|
12138
12189
|
return null;
|
|
12139
|
-
const relativeImport =
|
|
12190
|
+
const relativeImport = relative10(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
12140
12191
|
const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
|
|
12141
12192
|
importRewrites.set(specifier, relativeRewrite);
|
|
12142
12193
|
return resolved2;
|
|
@@ -12176,11 +12227,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12176
12227
|
const compiledRoot = compiledParent;
|
|
12177
12228
|
const indexesDir = join17(compiledParent, "indexes");
|
|
12178
12229
|
await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
|
|
12179
|
-
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) =>
|
|
12230
|
+
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve17(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
12180
12231
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
12181
12232
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
12182
|
-
const resolvedEntry =
|
|
12183
|
-
const relativeEntry =
|
|
12233
|
+
const resolvedEntry = resolve17(entry);
|
|
12234
|
+
const relativeEntry = relative10(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
12184
12235
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
12185
12236
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
12186
12237
|
entry: resolvedEntry
|
|
@@ -12191,10 +12242,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12191
12242
|
join17(compiledRoot, relativeEntry),
|
|
12192
12243
|
join17(compiledRoot, "pages", jsName),
|
|
12193
12244
|
join17(compiledRoot, jsName)
|
|
12194
|
-
].map((file3) =>
|
|
12245
|
+
].map((file3) => resolve17(file3));
|
|
12195
12246
|
const resolveRawServerFile = (candidatePaths) => {
|
|
12196
12247
|
const normalizedCandidates = [
|
|
12197
|
-
...candidatePaths.map((file3) =>
|
|
12248
|
+
...candidatePaths.map((file3) => resolve17(file3)),
|
|
12198
12249
|
...compiledFallbackPaths
|
|
12199
12250
|
];
|
|
12200
12251
|
let candidate = normalizedCandidates.find((file3) => existsSync16(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
@@ -12261,14 +12312,10 @@ export default ${componentClassName};
|
|
|
12261
12312
|
export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
12262
12313
|
`;
|
|
12263
12314
|
}
|
|
12264
|
-
if (hmr) {
|
|
12265
|
-
rewritten = injectHMRRegistration(rewritten, resolvedEntry);
|
|
12266
|
-
}
|
|
12267
12315
|
await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
|
|
12268
|
-
const relativePath =
|
|
12316
|
+
const relativePath = relative10(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
12269
12317
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
12270
12318
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
12271
|
-
import "${hmrRuntimePath}";
|
|
12272
12319
|
import "${hmrClientPath5}";
|
|
12273
12320
|
` : "";
|
|
12274
12321
|
const hydration = hmr ? `${hmrPreamble}
|
|
@@ -12310,68 +12357,66 @@ var absoluteHttpTransferCacheOptions = {
|
|
|
12310
12357
|
}
|
|
12311
12358
|
};
|
|
12312
12359
|
|
|
12313
|
-
//
|
|
12314
|
-
//
|
|
12315
|
-
//
|
|
12316
|
-
|
|
12360
|
+
// SURGICAL_HMR Tier 1 \u2014 Re-bootstrap hook. The dev client invokes
|
|
12361
|
+
// \`window.__ABS_ANGULAR_REBOOTSTRAP__()\` when it receives an
|
|
12362
|
+
// \`angular:rebootstrap\` WS message; the hook looks up this page's
|
|
12363
|
+
// freshly-built bundle URL (the rebuild already broadcast its
|
|
12364
|
+
// updated manifest, so window.__HMR_MANIFEST__ is current) and
|
|
12365
|
+
// dynamic-imports it. Re-importing the chunk re-runs the
|
|
12366
|
+
// destroy+bootstrap block below \u2014 no special path needed because
|
|
12367
|
+
// chunk eval is the bootstrap.
|
|
12368
|
+
window.__ABS_ANGULAR_PAGE_BUNDLE_ID__ = '${toPascal(fileBase)}Index';
|
|
12369
|
+
window.__ABS_ANGULAR_REBOOTSTRAP__ = async function() {
|
|
12370
|
+
var id = window.__ABS_ANGULAR_PAGE_BUNDLE_ID__;
|
|
12371
|
+
var manifest = window.__HMR_MANIFEST__ || {};
|
|
12372
|
+
var newUrl = manifest[id];
|
|
12373
|
+
if (!newUrl) {
|
|
12374
|
+
console.warn('[absolutejs] no bundle URL in manifest for', id, '\u2014 full reload');
|
|
12375
|
+
window.location.reload();
|
|
12376
|
+
return;
|
|
12377
|
+
}
|
|
12378
|
+
await import(newUrl + '?t=' + Date.now());
|
|
12379
|
+
};
|
|
12317
12380
|
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
// to a full re-bootstrap because those values are consumed once at
|
|
12322
|
-
// bootstrap and won't propagate to the running router/injector via an
|
|
12323
|
-
// in-place component patch.
|
|
12324
|
-
if (typeof window !== 'undefined' && window.__ANGULAR_HMR__ && typeof window.__ANGULAR_HMR__.recordPageExports === 'function') {
|
|
12325
|
-
var __abs_hmr_routes = Reflect.get(pageModule, 'routes');
|
|
12326
|
-
window.__ANGULAR_HMR__.recordPageExports('${resolvedEntry}', __abs_hmr_routes, maybePageProviders);
|
|
12381
|
+
if (window.__ANGULAR_APP__) {
|
|
12382
|
+
try { window.__ANGULAR_APP__.destroy(); } catch (_err) { /* ignore */ }
|
|
12383
|
+
window.__ANGULAR_APP__ = null;
|
|
12327
12384
|
}
|
|
12328
12385
|
|
|
12329
|
-
//
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
if (!window.__ANGULAR_HMR_FAST_PATCH__) {
|
|
12335
|
-
if (window.__ANGULAR_APP__) {
|
|
12336
|
-
try { window.__ANGULAR_APP__.destroy(); } catch (_err) { /* ignore */ }
|
|
12337
|
-
window.__ANGULAR_APP__ = null;
|
|
12338
|
-
}
|
|
12339
|
-
|
|
12340
|
-
// Ensure root element exists after destroy (Angular removes it)
|
|
12341
|
-
var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
|
|
12342
|
-
if (!document.querySelector(_sel)) {
|
|
12343
|
-
(document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
|
|
12344
|
-
}
|
|
12386
|
+
// Ensure root element exists after destroy (Angular removes it)
|
|
12387
|
+
var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
|
|
12388
|
+
if (!document.querySelector(_sel)) {
|
|
12389
|
+
(document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
|
|
12390
|
+
}
|
|
12345
12391
|
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12353
|
-
|
|
12392
|
+
var providers = [provideZonelessChangeDetection()];
|
|
12393
|
+
if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
|
|
12394
|
+
providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
|
|
12395
|
+
}
|
|
12396
|
+
delete window.__HMR_SKIP_HYDRATION__;
|
|
12397
|
+
providers.push.apply(providers, pageProviders);
|
|
12398
|
+
providers.push.apply(providers, propProviders);
|
|
12399
|
+
window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
|
|
12354
12400
|
|
|
12355
|
-
|
|
12401
|
+
if (pageHasRawStreamingSlots) {
|
|
12402
|
+
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12403
|
+
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12404
|
+
requestAnimationFrame(function() {
|
|
12405
|
+
window.__ABS_SLOT_FLUSH__();
|
|
12406
|
+
});
|
|
12407
|
+
}
|
|
12408
|
+
} else {
|
|
12409
|
+
bootstrapApplication(${componentClassName}, {
|
|
12410
|
+
providers: providers
|
|
12411
|
+
}).then(function (appRef) {
|
|
12412
|
+
window.__ANGULAR_APP__ = appRef;
|
|
12356
12413
|
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12357
12414
|
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12358
12415
|
requestAnimationFrame(function() {
|
|
12359
12416
|
window.__ABS_SLOT_FLUSH__();
|
|
12360
12417
|
});
|
|
12361
12418
|
}
|
|
12362
|
-
}
|
|
12363
|
-
bootstrapApplication(${componentClassName}, {
|
|
12364
|
-
providers: providers
|
|
12365
|
-
}).then(function (appRef) {
|
|
12366
|
-
window.__ANGULAR_APP__ = appRef;
|
|
12367
|
-
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12368
|
-
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12369
|
-
requestAnimationFrame(function() {
|
|
12370
|
-
window.__ABS_SLOT_FLUSH__();
|
|
12371
|
-
});
|
|
12372
|
-
}
|
|
12373
|
-
});
|
|
12374
|
-
}
|
|
12419
|
+
});
|
|
12375
12420
|
}
|
|
12376
12421
|
`.trim() : `
|
|
12377
12422
|
import '@angular/compiler';
|
|
@@ -12473,7 +12518,6 @@ var init_compileAngular = __esm(() => {
|
|
|
12473
12518
|
init_generatedDir();
|
|
12474
12519
|
devClientDir4 = resolveDevClientDir4();
|
|
12475
12520
|
hmrClientPath5 = join17(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
12476
|
-
hmrRuntimePath = join17(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
|
|
12477
12521
|
jitContentCache = new Map;
|
|
12478
12522
|
wrapperOutputCache = new Map;
|
|
12479
12523
|
});
|
|
@@ -12927,7 +12971,7 @@ __export(exports_compileEmber, {
|
|
|
12927
12971
|
});
|
|
12928
12972
|
import { existsSync as existsSync17 } from "fs";
|
|
12929
12973
|
import { mkdir as mkdir5, rm as rm4 } from "fs/promises";
|
|
12930
|
-
import { basename as basename7, dirname as dirname12, extname as extname6, join as join18, resolve as
|
|
12974
|
+
import { basename as basename7, dirname as dirname12, extname as extname6, join as join18, resolve as resolve18 } from "path";
|
|
12931
12975
|
var {build: bunBuild2, Transpiler: Transpiler3, write: write3, file: file3 } = globalThis.Bun;
|
|
12932
12976
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
12933
12977
|
if (cachedPreprocessor)
|
|
@@ -13023,7 +13067,7 @@ export const importSync = (specifier) => {
|
|
|
13023
13067
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
13024
13068
|
if (!originalImporter)
|
|
13025
13069
|
return;
|
|
13026
|
-
const candidateBase =
|
|
13070
|
+
const candidateBase = resolve18(dirname12(originalImporter), args.path);
|
|
13027
13071
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
13028
13072
|
for (const ext of extensionsToTry) {
|
|
13029
13073
|
const candidate = candidateBase + ext;
|
|
@@ -13082,7 +13126,7 @@ export const renderToHTML = (props = {}) => {
|
|
|
13082
13126
|
export { PageComponent };
|
|
13083
13127
|
export default PageComponent;
|
|
13084
13128
|
`, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
|
|
13085
|
-
const resolvedEntry =
|
|
13129
|
+
const resolvedEntry = resolve18(entry);
|
|
13086
13130
|
const source = await file3(resolvedEntry).text();
|
|
13087
13131
|
let preprocessed = source;
|
|
13088
13132
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -13102,8 +13146,8 @@ export default PageComponent;
|
|
|
13102
13146
|
mkdir5(serverDir, { recursive: true }),
|
|
13103
13147
|
mkdir5(clientDir, { recursive: true })
|
|
13104
13148
|
]);
|
|
13105
|
-
const tmpPagePath =
|
|
13106
|
-
const tmpHarnessPath =
|
|
13149
|
+
const tmpPagePath = resolve18(join18(tmpDir, `${baseName}.module.js`));
|
|
13150
|
+
const tmpHarnessPath = resolve18(join18(tmpDir, `${baseName}.harness.js`));
|
|
13107
13151
|
await Promise.all([
|
|
13108
13152
|
write3(tmpPagePath, transpiled),
|
|
13109
13153
|
write3(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -13145,7 +13189,7 @@ export default PageComponent;
|
|
|
13145
13189
|
serverPaths: outputs.map((o) => o.serverPath)
|
|
13146
13190
|
};
|
|
13147
13191
|
}, compileEmberFileSource = async (entry) => {
|
|
13148
|
-
const resolvedEntry =
|
|
13192
|
+
const resolvedEntry = resolve18(entry);
|
|
13149
13193
|
const source = await file3(resolvedEntry).text();
|
|
13150
13194
|
let preprocessed = source;
|
|
13151
13195
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -13178,24 +13222,24 @@ __export(exports_buildReactVendor, {
|
|
|
13178
13222
|
buildReactVendor: () => buildReactVendor
|
|
13179
13223
|
});
|
|
13180
13224
|
import { existsSync as existsSync18, mkdirSync as mkdirSync7 } from "fs";
|
|
13181
|
-
import { join as join19, resolve as
|
|
13225
|
+
import { join as join19, resolve as resolve19 } from "path";
|
|
13182
13226
|
import { rm as rm5 } from "fs/promises";
|
|
13183
13227
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
13184
13228
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
13185
13229
|
const candidates = [
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13230
|
+
resolve19(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
13231
|
+
resolve19(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13232
|
+
resolve19(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
13233
|
+
resolve19(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13234
|
+
resolve19(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
13235
|
+
resolve19(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
13192
13236
|
];
|
|
13193
13237
|
for (const candidate of candidates) {
|
|
13194
13238
|
if (existsSync18(candidate)) {
|
|
13195
13239
|
return candidate.replace(/\\/g, "/");
|
|
13196
13240
|
}
|
|
13197
13241
|
}
|
|
13198
|
-
return (candidates[0] ??
|
|
13242
|
+
return (candidates[0] ?? resolve19(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
13199
13243
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
13200
13244
|
try {
|
|
13201
13245
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -13845,7 +13889,7 @@ import {
|
|
|
13845
13889
|
statSync,
|
|
13846
13890
|
writeFileSync as writeFileSync7
|
|
13847
13891
|
} from "fs";
|
|
13848
|
-
import { basename as basename8, dirname as dirname13, extname as extname7, join as join24, relative as
|
|
13892
|
+
import { basename as basename8, dirname as dirname13, extname as extname7, join as join24, relative as relative11, resolve as resolve20 } from "path";
|
|
13849
13893
|
import { cwd, env as env2, exit } from "process";
|
|
13850
13894
|
var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
|
|
13851
13895
|
var isDev, isBuildTraceEnabled = () => {
|
|
@@ -13936,8 +13980,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
13936
13980
|
}
|
|
13937
13981
|
}, resolveAbsoluteVersion = async () => {
|
|
13938
13982
|
const candidates = [
|
|
13939
|
-
|
|
13940
|
-
|
|
13983
|
+
resolve20(import.meta.dir, "..", "..", "package.json"),
|
|
13984
|
+
resolve20(import.meta.dir, "..", "package.json")
|
|
13941
13985
|
];
|
|
13942
13986
|
const resolveCandidate = async (remaining) => {
|
|
13943
13987
|
const [candidate, ...rest] = remaining;
|
|
@@ -13953,7 +13997,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
13953
13997
|
};
|
|
13954
13998
|
await resolveCandidate(candidates);
|
|
13955
13999
|
}, SKIP_DIRS, addWorkerPathIfExists = (file4, relPath, workerPaths) => {
|
|
13956
|
-
const absPath =
|
|
14000
|
+
const absPath = resolve20(file4, "..", relPath);
|
|
13957
14001
|
try {
|
|
13958
14002
|
statSync(absPath);
|
|
13959
14003
|
workerPaths.add(absPath);
|
|
@@ -14015,7 +14059,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
14015
14059
|
return;
|
|
14016
14060
|
}
|
|
14017
14061
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
14018
|
-
const pagesRel =
|
|
14062
|
+
const pagesRel = relative11(process.cwd(), resolve20(reactPagesPath)).replace(/\\/g, "/");
|
|
14019
14063
|
for (const file4 of indexFiles) {
|
|
14020
14064
|
let content = readFileSync12(join24(reactIndexesPath, file4), "utf-8");
|
|
14021
14065
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
@@ -14023,27 +14067,27 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
14023
14067
|
}
|
|
14024
14068
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
14025
14069
|
const svelteIndexDir = join24(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
14026
|
-
const sveltePageEntries = svelteEntries.filter((file4) =>
|
|
14070
|
+
const sveltePageEntries = svelteEntries.filter((file4) => resolve20(file4).startsWith(resolve20(sveltePagesPath)));
|
|
14027
14071
|
for (const entry of sveltePageEntries) {
|
|
14028
14072
|
const name = basename8(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
14029
14073
|
const indexFile = join24(svelteIndexDir, "pages", `${name}.js`);
|
|
14030
14074
|
if (!existsSync19(indexFile))
|
|
14031
14075
|
continue;
|
|
14032
14076
|
let content = readFileSync12(indexFile, "utf-8");
|
|
14033
|
-
const srcRel =
|
|
14077
|
+
const srcRel = relative11(process.cwd(), resolve20(entry)).replace(/\\/g, "/");
|
|
14034
14078
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
14035
14079
|
writeFileSync7(join24(devIndexDir, `${name}.svelte.js`), content);
|
|
14036
14080
|
}
|
|
14037
14081
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
14038
14082
|
const vueIndexDir = join24(getFrameworkGeneratedDir("vue"), "indexes");
|
|
14039
|
-
const vuePageEntries = vueEntries.filter((file4) =>
|
|
14083
|
+
const vuePageEntries = vueEntries.filter((file4) => resolve20(file4).startsWith(resolve20(vuePagesPath)));
|
|
14040
14084
|
for (const entry of vuePageEntries) {
|
|
14041
14085
|
const name = basename8(entry, ".vue");
|
|
14042
14086
|
const indexFile = join24(vueIndexDir, `${name}.js`);
|
|
14043
14087
|
if (!existsSync19(indexFile))
|
|
14044
14088
|
continue;
|
|
14045
14089
|
let content = readFileSync12(indexFile, "utf-8");
|
|
14046
|
-
const srcRel =
|
|
14090
|
+
const srcRel = relative11(process.cwd(), resolve20(entry)).replace(/\\/g, "/");
|
|
14047
14091
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
14048
14092
|
writeFileSync7(join24(devIndexDir, `${name}.vue.js`), content);
|
|
14049
14093
|
}
|
|
@@ -14056,7 +14100,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
14056
14100
|
const last = allComments[allComments.length - 1];
|
|
14057
14101
|
if (!last?.[1])
|
|
14058
14102
|
return JSON.stringify(outputPath);
|
|
14059
|
-
const srcPath =
|
|
14103
|
+
const srcPath = resolve20(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
14060
14104
|
return JSON.stringify(srcPath);
|
|
14061
14105
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
14062
14106
|
let depth = 0;
|
|
@@ -14118,7 +14162,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14118
14162
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
14119
14163
|
const urlFileMap = new Map;
|
|
14120
14164
|
for (const srcPath of urlReferencedFiles) {
|
|
14121
|
-
const rel =
|
|
14165
|
+
const rel = relative11(projectRoot, srcPath).replace(/\\/g, "/");
|
|
14122
14166
|
const name = basename8(srcPath);
|
|
14123
14167
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
14124
14168
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -14133,7 +14177,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14133
14177
|
const output = nonReactClientOutputs.find((artifact) => basename8(artifact.path).startsWith(`${srcBase}.`));
|
|
14134
14178
|
if (!output)
|
|
14135
14179
|
continue;
|
|
14136
|
-
urlFileMap.set(basename8(srcPath), `/${
|
|
14180
|
+
urlFileMap.set(basename8(srcPath), `/${relative11(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
14137
14181
|
}
|
|
14138
14182
|
return urlFileMap;
|
|
14139
14183
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -14381,13 +14425,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14381
14425
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
14382
14426
|
if (!isIncremental || !incrementalFiles)
|
|
14383
14427
|
return entryPoints;
|
|
14384
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f2) =>
|
|
14428
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve20(f2)));
|
|
14385
14429
|
const matchingEntries = [];
|
|
14386
14430
|
for (const entry of entryPoints) {
|
|
14387
14431
|
const sourceFile = mapToSource(entry);
|
|
14388
14432
|
if (!sourceFile)
|
|
14389
14433
|
continue;
|
|
14390
|
-
if (!normalizedIncremental.has(
|
|
14434
|
+
if (!normalizedIncremental.has(resolve20(sourceFile)))
|
|
14391
14435
|
continue;
|
|
14392
14436
|
matchingEntries.push(entry);
|
|
14393
14437
|
}
|
|
@@ -14449,7 +14493,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14449
14493
|
}
|
|
14450
14494
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
14451
14495
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
14452
|
-
if (entry.startsWith(
|
|
14496
|
+
if (entry.startsWith(resolve20(reactIndexesPath))) {
|
|
14453
14497
|
const pageName = basename8(entry, ".tsx");
|
|
14454
14498
|
return join24(reactPagesPath, `${pageName}.tsx`);
|
|
14455
14499
|
}
|
|
@@ -14528,7 +14572,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14528
14572
|
const clientPath = islandSvelteClientPaths[idx];
|
|
14529
14573
|
if (!sourcePath || !clientPath)
|
|
14530
14574
|
continue;
|
|
14531
|
-
islandSvelteClientPathMap.set(
|
|
14575
|
+
islandSvelteClientPathMap.set(resolve20(sourcePath), clientPath);
|
|
14532
14576
|
}
|
|
14533
14577
|
const islandVueClientPathMap = new Map;
|
|
14534
14578
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -14536,7 +14580,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14536
14580
|
const clientPath = islandVueClientPaths[idx];
|
|
14537
14581
|
if (!sourcePath || !clientPath)
|
|
14538
14582
|
continue;
|
|
14539
|
-
islandVueClientPathMap.set(
|
|
14583
|
+
islandVueClientPathMap.set(resolve20(sourcePath), clientPath);
|
|
14540
14584
|
}
|
|
14541
14585
|
const islandAngularClientPathMap = new Map;
|
|
14542
14586
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -14544,7 +14588,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14544
14588
|
const clientPath = islandAngularClientPaths[idx];
|
|
14545
14589
|
if (!sourcePath || !clientPath)
|
|
14546
14590
|
continue;
|
|
14547
|
-
islandAngularClientPathMap.set(
|
|
14591
|
+
islandAngularClientPathMap.set(resolve20(sourcePath), clientPath);
|
|
14548
14592
|
}
|
|
14549
14593
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
14550
14594
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -14857,6 +14901,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14857
14901
|
outdir: buildPath,
|
|
14858
14902
|
plugins: [
|
|
14859
14903
|
stylePreprocessorPlugin2,
|
|
14904
|
+
...angularDir && hmr ? [
|
|
14905
|
+
createAngularHmrInjectionPlugin({
|
|
14906
|
+
generatedAngularRoot: getFrameworkGeneratedDir("angular", projectRoot),
|
|
14907
|
+
projectRoot,
|
|
14908
|
+
userAngularRoot: angularDir
|
|
14909
|
+
})
|
|
14910
|
+
] : [],
|
|
14860
14911
|
...angularDir ? [createAngularLinkerPlugin(hmr)] : [],
|
|
14861
14912
|
...htmlScriptPlugin ? [htmlScriptPlugin] : []
|
|
14862
14913
|
],
|
|
@@ -14877,6 +14928,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14877
14928
|
outdir: buildPath,
|
|
14878
14929
|
plugins: [
|
|
14879
14930
|
stylePreprocessorPlugin2,
|
|
14931
|
+
...angularDir && hmr ? [
|
|
14932
|
+
createAngularHmrInjectionPlugin({
|
|
14933
|
+
generatedAngularRoot: getFrameworkGeneratedDir("angular", projectRoot),
|
|
14934
|
+
projectRoot,
|
|
14935
|
+
userAngularRoot: angularDir
|
|
14936
|
+
})
|
|
14937
|
+
] : [],
|
|
14880
14938
|
...angularDir ? [createAngularLinkerPlugin(hmr)] : []
|
|
14881
14939
|
],
|
|
14882
14940
|
root: islandEntryResult.generatedRoot,
|
|
@@ -14967,7 +15025,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14967
15025
|
const fileDir = dirname13(artifact.path);
|
|
14968
15026
|
const relativePaths = {};
|
|
14969
15027
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
14970
|
-
const rel =
|
|
15028
|
+
const rel = relative11(fileDir, absolute);
|
|
14971
15029
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
14972
15030
|
}
|
|
14973
15031
|
return relativePaths;
|
|
@@ -15172,6 +15230,7 @@ var init_build = __esm(() => {
|
|
|
15172
15230
|
init_rewriteReactImports();
|
|
15173
15231
|
init_telemetryEvent();
|
|
15174
15232
|
init_angularLinkerPlugin();
|
|
15233
|
+
init_hmrInjectionPlugin();
|
|
15175
15234
|
init_cleanStaleOutputs();
|
|
15176
15235
|
init_cleanup();
|
|
15177
15236
|
init_commonAncestor();
|
|
@@ -15386,7 +15445,7 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
15386
15445
|
// src/dev/dependencyGraph.ts
|
|
15387
15446
|
import { existsSync as existsSync21, readFileSync as readFileSync13 } from "fs";
|
|
15388
15447
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15389
|
-
import { resolve as
|
|
15448
|
+
import { resolve as resolve21 } from "path";
|
|
15390
15449
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
15391
15450
|
const lower = filePath.toLowerCase();
|
|
15392
15451
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -15400,8 +15459,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15400
15459
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
15401
15460
|
return null;
|
|
15402
15461
|
}
|
|
15403
|
-
const fromDir =
|
|
15404
|
-
const normalized =
|
|
15462
|
+
const fromDir = resolve21(fromFile, "..");
|
|
15463
|
+
const normalized = resolve21(fromDir, importPath);
|
|
15405
15464
|
const extensions = [
|
|
15406
15465
|
".ts",
|
|
15407
15466
|
".tsx",
|
|
@@ -15431,7 +15490,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15431
15490
|
dependents.delete(normalizedPath);
|
|
15432
15491
|
}
|
|
15433
15492
|
}, addFileToGraph = (graph, filePath) => {
|
|
15434
|
-
const normalizedPath =
|
|
15493
|
+
const normalizedPath = resolve21(filePath);
|
|
15435
15494
|
if (!existsSync21(normalizedPath))
|
|
15436
15495
|
return;
|
|
15437
15496
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -15448,10 +15507,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15448
15507
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
15449
15508
|
const processedFiles = new Set;
|
|
15450
15509
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
15451
|
-
const resolvedDirs = directories.map((dir) =>
|
|
15510
|
+
const resolvedDirs = directories.map((dir) => resolve21(dir)).filter((dir) => existsSync21(dir));
|
|
15452
15511
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
15453
15512
|
for (const file4 of allFiles) {
|
|
15454
|
-
const fullPath =
|
|
15513
|
+
const fullPath = resolve21(file4);
|
|
15455
15514
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
15456
15515
|
continue;
|
|
15457
15516
|
if (processedFiles.has(fullPath))
|
|
@@ -15564,7 +15623,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15564
15623
|
return [];
|
|
15565
15624
|
}
|
|
15566
15625
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
15567
|
-
const normalizedPath =
|
|
15626
|
+
const normalizedPath = resolve21(changedFile);
|
|
15568
15627
|
const affected = new Set;
|
|
15569
15628
|
const toProcess = [normalizedPath];
|
|
15570
15629
|
const processNode = (current) => {
|
|
@@ -15604,7 +15663,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15604
15663
|
}
|
|
15605
15664
|
graph.dependents.delete(normalizedPath);
|
|
15606
15665
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
15607
|
-
const normalizedPath =
|
|
15666
|
+
const normalizedPath = resolve21(filePath);
|
|
15608
15667
|
removeDepsForFile(graph, normalizedPath);
|
|
15609
15668
|
removeDependentsForFile(graph, normalizedPath);
|
|
15610
15669
|
};
|
|
@@ -15647,12 +15706,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
15647
15706
|
};
|
|
15648
15707
|
|
|
15649
15708
|
// src/dev/configResolver.ts
|
|
15650
|
-
import { resolve as
|
|
15709
|
+
import { resolve as resolve22 } from "path";
|
|
15651
15710
|
var resolveBuildPaths = (config) => {
|
|
15652
15711
|
const cwd2 = process.cwd();
|
|
15653
15712
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
15654
|
-
const withDefault = (value, fallback) => normalize(
|
|
15655
|
-
const optional = (value) => value ? normalize(
|
|
15713
|
+
const withDefault = (value, fallback) => normalize(resolve22(cwd2, value ?? fallback));
|
|
15714
|
+
const optional = (value) => value ? normalize(resolve22(cwd2, value)) : undefined;
|
|
15656
15715
|
return {
|
|
15657
15716
|
angularDir: optional(config.angularDirectory),
|
|
15658
15717
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -15704,8 +15763,8 @@ var init_clientManager = __esm(() => {
|
|
|
15704
15763
|
});
|
|
15705
15764
|
|
|
15706
15765
|
// src/dev/pathUtils.ts
|
|
15707
|
-
import { existsSync as existsSync22 } from "fs";
|
|
15708
|
-
import { resolve as
|
|
15766
|
+
import { existsSync as existsSync22, readdirSync, readFileSync as readFileSync14 } from "fs";
|
|
15767
|
+
import { dirname as dirname14, resolve as resolve23 } from "path";
|
|
15709
15768
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
15710
15769
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
15711
15770
|
return "ignored";
|
|
@@ -15779,13 +15838,80 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
15779
15838
|
return "assets";
|
|
15780
15839
|
}
|
|
15781
15840
|
return "unknown";
|
|
15841
|
+
}, collectAngularResourceDirs = (angularDir) => {
|
|
15842
|
+
const out = new Set;
|
|
15843
|
+
const angularRoot = resolve23(angularDir);
|
|
15844
|
+
const angularRootNormalized = normalizePath(angularRoot);
|
|
15845
|
+
const walk = (dir) => {
|
|
15846
|
+
let entries;
|
|
15847
|
+
try {
|
|
15848
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
15849
|
+
} catch {
|
|
15850
|
+
return;
|
|
15851
|
+
}
|
|
15852
|
+
for (const entry of entries) {
|
|
15853
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
15854
|
+
continue;
|
|
15855
|
+
}
|
|
15856
|
+
const full = resolve23(dir, entry.name);
|
|
15857
|
+
if (entry.isDirectory()) {
|
|
15858
|
+
walk(full);
|
|
15859
|
+
continue;
|
|
15860
|
+
}
|
|
15861
|
+
if (!entry.isFile() || !entry.name.endsWith(".component.ts")) {
|
|
15862
|
+
continue;
|
|
15863
|
+
}
|
|
15864
|
+
let source;
|
|
15865
|
+
try {
|
|
15866
|
+
source = readFileSync14(full, "utf8");
|
|
15867
|
+
} catch {
|
|
15868
|
+
continue;
|
|
15869
|
+
}
|
|
15870
|
+
const refs = [];
|
|
15871
|
+
const tplRe = /templateUrl\s*:\s*['"]([^'"]+)['"]/g;
|
|
15872
|
+
const styleRe = /styleUrl\s*:\s*['"]([^'"]+)['"]/g;
|
|
15873
|
+
const stylesArrRe = /styleUrls\s*:\s*\[([^\]]*)\]/g;
|
|
15874
|
+
const literalRe = /['"]([^'"]+)['"]/g;
|
|
15875
|
+
let match;
|
|
15876
|
+
while ((match = tplRe.exec(source)) !== null) {
|
|
15877
|
+
if (match[1])
|
|
15878
|
+
refs.push(match[1]);
|
|
15879
|
+
}
|
|
15880
|
+
while ((match = styleRe.exec(source)) !== null) {
|
|
15881
|
+
if (match[1])
|
|
15882
|
+
refs.push(match[1]);
|
|
15883
|
+
}
|
|
15884
|
+
while ((match = stylesArrRe.exec(source)) !== null) {
|
|
15885
|
+
const inner = match[1];
|
|
15886
|
+
if (!inner)
|
|
15887
|
+
continue;
|
|
15888
|
+
let strMatch;
|
|
15889
|
+
const innerRe = new RegExp(literalRe.source, literalRe.flags);
|
|
15890
|
+
while ((strMatch = innerRe.exec(inner)) !== null) {
|
|
15891
|
+
if (strMatch[1])
|
|
15892
|
+
refs.push(strMatch[1]);
|
|
15893
|
+
}
|
|
15894
|
+
}
|
|
15895
|
+
const componentDir = dirname14(full);
|
|
15896
|
+
for (const ref of refs) {
|
|
15897
|
+
const refAbs = normalizePath(resolve23(componentDir, ref));
|
|
15898
|
+
const refDir = normalizePath(dirname14(refAbs));
|
|
15899
|
+
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
15900
|
+
continue;
|
|
15901
|
+
}
|
|
15902
|
+
out.add(refDir);
|
|
15903
|
+
}
|
|
15904
|
+
}
|
|
15905
|
+
};
|
|
15906
|
+
walk(angularRoot);
|
|
15907
|
+
return Array.from(out);
|
|
15782
15908
|
}, collectPositiveWatchRoots = (config, resolved) => {
|
|
15783
15909
|
const cwd2 = process.cwd();
|
|
15784
15910
|
const roots = [];
|
|
15785
15911
|
const push = (path) => {
|
|
15786
15912
|
if (!path)
|
|
15787
15913
|
return;
|
|
15788
|
-
const abs = normalizePath(
|
|
15914
|
+
const abs = normalizePath(resolve23(cwd2, path));
|
|
15789
15915
|
if (!roots.includes(abs))
|
|
15790
15916
|
roots.push(abs);
|
|
15791
15917
|
};
|
|
@@ -15810,13 +15936,20 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
15810
15936
|
push(cfg.assetsDir);
|
|
15811
15937
|
push(cfg.stylesDir);
|
|
15812
15938
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
15813
|
-
const abs = normalizePath(
|
|
15939
|
+
const abs = normalizePath(resolve23(cwd2, candidate));
|
|
15814
15940
|
if (existsSync22(abs) && !roots.includes(abs))
|
|
15815
15941
|
roots.push(abs);
|
|
15816
15942
|
}
|
|
15817
15943
|
const extraDirs = config.dev?.watchDirs ?? [];
|
|
15818
15944
|
for (const dir of extraDirs)
|
|
15819
15945
|
push(dir);
|
|
15946
|
+
if (cfg.angularDir) {
|
|
15947
|
+
const resourceDirs = collectAngularResourceDirs(cfg.angularDir);
|
|
15948
|
+
for (const dir of resourceDirs) {
|
|
15949
|
+
if (!roots.includes(dir))
|
|
15950
|
+
roots.push(dir);
|
|
15951
|
+
}
|
|
15952
|
+
}
|
|
15820
15953
|
return roots;
|
|
15821
15954
|
}, getWatchPaths = (config, resolved) => {
|
|
15822
15955
|
const roots = collectPositiveWatchRoots(config, resolved);
|
|
@@ -15874,7 +16007,7 @@ var init_pathUtils = __esm(() => {
|
|
|
15874
16007
|
// src/dev/fileWatcher.ts
|
|
15875
16008
|
import { watch } from "fs";
|
|
15876
16009
|
import { existsSync as existsSync23 } from "fs";
|
|
15877
|
-
import { join as join26, resolve as
|
|
16010
|
+
import { join as join26, resolve as resolve24 } from "path";
|
|
15878
16011
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
15879
16012
|
try {
|
|
15880
16013
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -15919,7 +16052,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
15919
16052
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
15920
16053
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
15921
16054
|
paths.forEach((path) => {
|
|
15922
|
-
const absolutePath =
|
|
16055
|
+
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
15923
16056
|
if (!existsSync23(absolutePath)) {
|
|
15924
16057
|
return;
|
|
15925
16058
|
}
|
|
@@ -15930,7 +16063,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
15930
16063
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
15931
16064
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
15932
16065
|
watchPaths.forEach((path) => {
|
|
15933
|
-
const absolutePath =
|
|
16066
|
+
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
15934
16067
|
if (!existsSync23(absolutePath)) {
|
|
15935
16068
|
return;
|
|
15936
16069
|
}
|
|
@@ -15945,13 +16078,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
15945
16078
|
});
|
|
15946
16079
|
|
|
15947
16080
|
// src/dev/assetStore.ts
|
|
15948
|
-
import { resolve as
|
|
16081
|
+
import { resolve as resolve25 } from "path";
|
|
15949
16082
|
import { readdir as readdir4, unlink } from "fs/promises";
|
|
15950
16083
|
var mimeTypes, getMimeType = (filePath) => {
|
|
15951
16084
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
15952
16085
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
15953
16086
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
15954
|
-
const fullPath =
|
|
16087
|
+
const fullPath = resolve25(dir, entry.name);
|
|
15955
16088
|
if (entry.isDirectory()) {
|
|
15956
16089
|
return walkAndClean(fullPath);
|
|
15957
16090
|
}
|
|
@@ -15967,10 +16100,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15967
16100
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
15968
16101
|
const liveByIdentity = new Map;
|
|
15969
16102
|
for (const webPath of store.keys()) {
|
|
15970
|
-
const diskPath =
|
|
16103
|
+
const diskPath = resolve25(buildDir, webPath.slice(1));
|
|
15971
16104
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
15972
16105
|
}
|
|
15973
|
-
const absBuildDir =
|
|
16106
|
+
const absBuildDir = resolve25(buildDir);
|
|
15974
16107
|
Object.values(manifest).forEach((val) => {
|
|
15975
16108
|
if (!HASHED_FILE_RE.test(val))
|
|
15976
16109
|
return;
|
|
@@ -15988,7 +16121,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15988
16121
|
} catch {}
|
|
15989
16122
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
15990
16123
|
if (entry.isDirectory()) {
|
|
15991
|
-
return scanDir(
|
|
16124
|
+
return scanDir(resolve25(dir, entry.name), `${prefix}${entry.name}/`);
|
|
15992
16125
|
}
|
|
15993
16126
|
if (!entry.name.startsWith("chunk-")) {
|
|
15994
16127
|
return null;
|
|
@@ -15997,7 +16130,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
15997
16130
|
if (store.has(webPath)) {
|
|
15998
16131
|
return null;
|
|
15999
16132
|
}
|
|
16000
|
-
return Bun.file(
|
|
16133
|
+
return Bun.file(resolve25(dir, entry.name)).bytes().then((bytes) => {
|
|
16001
16134
|
store.set(webPath, bytes);
|
|
16002
16135
|
return;
|
|
16003
16136
|
}).catch(() => {});
|
|
@@ -16019,7 +16152,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16019
16152
|
for (const webPath of newIdentities.values()) {
|
|
16020
16153
|
if (store.has(webPath))
|
|
16021
16154
|
continue;
|
|
16022
|
-
loadPromises.push(Bun.file(
|
|
16155
|
+
loadPromises.push(Bun.file(resolve25(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
16023
16156
|
store.set(webPath, bytes);
|
|
16024
16157
|
return;
|
|
16025
16158
|
}).catch(() => {}));
|
|
@@ -16049,8 +16182,8 @@ var init_assetStore = __esm(() => {
|
|
|
16049
16182
|
});
|
|
16050
16183
|
|
|
16051
16184
|
// src/islands/pageMetadata.ts
|
|
16052
|
-
import { readFileSync as
|
|
16053
|
-
import { dirname as
|
|
16185
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
16186
|
+
import { dirname as dirname15, resolve as resolve26 } from "path";
|
|
16054
16187
|
var pagePatterns, getPageDirs = (config) => [
|
|
16055
16188
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
16056
16189
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -16070,15 +16203,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
16070
16203
|
const source = definition.buildReference?.source;
|
|
16071
16204
|
if (!source)
|
|
16072
16205
|
continue;
|
|
16073
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
16074
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
16206
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve26(dirname15(buildInfo.resolvedRegistryPath), source);
|
|
16207
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve26(resolvedSource));
|
|
16075
16208
|
}
|
|
16076
16209
|
return lookup;
|
|
16077
16210
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
|
|
16078
16211
|
const candidate = usage.source;
|
|
16079
|
-
return candidate ?
|
|
16212
|
+
return candidate ? resolve26(candidate) === target : false;
|
|
16080
16213
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
16081
|
-
const target =
|
|
16214
|
+
const target = resolve26(sourcePath);
|
|
16082
16215
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
16083
16216
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
16084
16217
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -16090,13 +16223,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
16090
16223
|
const pattern = pagePatterns[entry.framework];
|
|
16091
16224
|
if (!pattern)
|
|
16092
16225
|
return;
|
|
16093
|
-
const files = await scanEntryPoints(
|
|
16226
|
+
const files = await scanEntryPoints(resolve26(entry.dir), pattern);
|
|
16094
16227
|
for (const filePath of files) {
|
|
16095
|
-
const source =
|
|
16228
|
+
const source = readFileSync15(filePath, "utf-8");
|
|
16096
16229
|
const islands = extractIslandUsagesFromSource(source);
|
|
16097
|
-
pageMetadata.set(
|
|
16230
|
+
pageMetadata.set(resolve26(filePath), {
|
|
16098
16231
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
16099
|
-
pagePath:
|
|
16232
|
+
pagePath: resolve26(filePath)
|
|
16100
16233
|
});
|
|
16101
16234
|
}
|
|
16102
16235
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -16123,10 +16256,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
16123
16256
|
});
|
|
16124
16257
|
|
|
16125
16258
|
// src/dev/fileHashTracker.ts
|
|
16126
|
-
import { readFileSync as
|
|
16259
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
16127
16260
|
var computeFileHash = (filePath) => {
|
|
16128
16261
|
try {
|
|
16129
|
-
const fileContent =
|
|
16262
|
+
const fileContent = readFileSync16(filePath);
|
|
16130
16263
|
return Number(Bun.hash(fileContent));
|
|
16131
16264
|
} catch {
|
|
16132
16265
|
return UNFOUND_INDEX;
|
|
@@ -16206,9 +16339,9 @@ var init_transformCache = __esm(() => {
|
|
|
16206
16339
|
});
|
|
16207
16340
|
|
|
16208
16341
|
// src/dev/reactComponentClassifier.ts
|
|
16209
|
-
import { resolve as
|
|
16342
|
+
import { resolve as resolve27 } from "path";
|
|
16210
16343
|
var classifyComponent = (filePath) => {
|
|
16211
|
-
const normalizedPath =
|
|
16344
|
+
const normalizedPath = resolve27(filePath);
|
|
16212
16345
|
if (normalizedPath.includes("/react/pages/")) {
|
|
16213
16346
|
return "server";
|
|
16214
16347
|
}
|
|
@@ -16220,7 +16353,7 @@ var classifyComponent = (filePath) => {
|
|
|
16220
16353
|
var init_reactComponentClassifier = () => {};
|
|
16221
16354
|
|
|
16222
16355
|
// src/dev/moduleMapper.ts
|
|
16223
|
-
import { basename as basename9, resolve as
|
|
16356
|
+
import { basename as basename9, resolve as resolve28 } from "path";
|
|
16224
16357
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
16225
16358
|
const modulePaths = {};
|
|
16226
16359
|
moduleKeys.forEach((key) => {
|
|
@@ -16230,7 +16363,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16230
16363
|
});
|
|
16231
16364
|
return modulePaths;
|
|
16232
16365
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
16233
|
-
const normalizedFile =
|
|
16366
|
+
const normalizedFile = resolve28(sourceFile);
|
|
16234
16367
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
16235
16368
|
if (processedFiles.has(normalizedFile)) {
|
|
16236
16369
|
return null;
|
|
@@ -16266,7 +16399,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16266
16399
|
});
|
|
16267
16400
|
return grouped;
|
|
16268
16401
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
16269
|
-
const normalizedFile =
|
|
16402
|
+
const normalizedFile = resolve28(sourceFile);
|
|
16270
16403
|
const fileName = basename9(normalizedFile);
|
|
16271
16404
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
16272
16405
|
const pascalName = toPascal(baseName);
|
|
@@ -16448,247 +16581,6 @@ var init_ssrCache = __esm(() => {
|
|
|
16448
16581
|
dirtyFrameworks = new Set;
|
|
16449
16582
|
});
|
|
16450
16583
|
|
|
16451
|
-
// src/dev/angular/editTypeDetection.ts
|
|
16452
|
-
import { readFileSync as readFileSync16 } from "fs";
|
|
16453
|
-
import { basename as basename10 } from "path";
|
|
16454
|
-
import * as ts3 from "typescript";
|
|
16455
|
-
var TYPE_PRIORITY, STYLE_EXT_RE, COMPONENT_STYLE_RE, TEMPLATE_RE, COMPONENT_CLASS_RE, SERVICE_RE, ROUTES_RE, PAGE_TS_RE, SIDE_EFFECT_CALL_NAMES, SIDE_EFFECT_NEW_NAMES, getCalleeName = (node) => {
|
|
16456
|
-
const callee = node.expression;
|
|
16457
|
-
if (ts3.isIdentifier(callee))
|
|
16458
|
-
return callee.text;
|
|
16459
|
-
if (ts3.isPropertyAccessExpression(callee))
|
|
16460
|
-
return callee.name.text;
|
|
16461
|
-
return null;
|
|
16462
|
-
}, getNewExprName = (node) => {
|
|
16463
|
-
const callee = node.expression;
|
|
16464
|
-
if (ts3.isIdentifier(callee))
|
|
16465
|
-
return callee.text;
|
|
16466
|
-
if (ts3.isPropertyAccessExpression(callee))
|
|
16467
|
-
return callee.name.text;
|
|
16468
|
-
return null;
|
|
16469
|
-
}, collectMethodBodies = (cls) => {
|
|
16470
|
-
const methods = new Map;
|
|
16471
|
-
cls.members.forEach((member) => {
|
|
16472
|
-
if (!member.name || !ts3.isIdentifier(member.name))
|
|
16473
|
-
return;
|
|
16474
|
-
if (ts3.isMethodDeclaration(member) && member.body) {
|
|
16475
|
-
methods.set(member.name.text, member.body);
|
|
16476
|
-
return;
|
|
16477
|
-
}
|
|
16478
|
-
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16479
|
-
const init = member.initializer;
|
|
16480
|
-
if (ts3.isArrowFunction(init) || ts3.isFunctionExpression(init)) {
|
|
16481
|
-
methods.set(member.name.text, init.body);
|
|
16482
|
-
}
|
|
16483
|
-
}
|
|
16484
|
-
});
|
|
16485
|
-
return methods;
|
|
16486
|
-
}, findSideEffectInBody = (body, methods, visited) => {
|
|
16487
|
-
let hit = { found: false };
|
|
16488
|
-
const walk = (node) => {
|
|
16489
|
-
if (hit.found)
|
|
16490
|
-
return;
|
|
16491
|
-
if (ts3.isCallExpression(node)) {
|
|
16492
|
-
const name = getCalleeName(node);
|
|
16493
|
-
if (name && SIDE_EFFECT_CALL_NAMES.has(name)) {
|
|
16494
|
-
hit = {
|
|
16495
|
-
found: true,
|
|
16496
|
-
reason: `constructor invokes ${name}(...)`
|
|
16497
|
-
};
|
|
16498
|
-
return;
|
|
16499
|
-
}
|
|
16500
|
-
if (name && methods.has(name) && !visited.has(name)) {
|
|
16501
|
-
visited.add(name);
|
|
16502
|
-
const target = methods.get(name);
|
|
16503
|
-
if (target) {
|
|
16504
|
-
const inner = findSideEffectInBody(target, methods, visited);
|
|
16505
|
-
if (inner.found) {
|
|
16506
|
-
hit = {
|
|
16507
|
-
found: true,
|
|
16508
|
-
reason: `${inner.reason} (via this.${name}())`
|
|
16509
|
-
};
|
|
16510
|
-
return;
|
|
16511
|
-
}
|
|
16512
|
-
}
|
|
16513
|
-
}
|
|
16514
|
-
}
|
|
16515
|
-
if (ts3.isNewExpression(node)) {
|
|
16516
|
-
const name = getNewExprName(node);
|
|
16517
|
-
if (name && SIDE_EFFECT_NEW_NAMES.has(name)) {
|
|
16518
|
-
hit = {
|
|
16519
|
-
found: true,
|
|
16520
|
-
reason: `constructor instantiates new ${name}(...)`
|
|
16521
|
-
};
|
|
16522
|
-
return;
|
|
16523
|
-
}
|
|
16524
|
-
}
|
|
16525
|
-
ts3.forEachChild(node, walk);
|
|
16526
|
-
};
|
|
16527
|
-
walk(body);
|
|
16528
|
-
return hit;
|
|
16529
|
-
}, analyzeServiceFile = (file4) => {
|
|
16530
|
-
let source;
|
|
16531
|
-
try {
|
|
16532
|
-
source = readFileSync16(file4, "utf8");
|
|
16533
|
-
} catch {
|
|
16534
|
-
return {
|
|
16535
|
-
hasSideEffectCtor: true,
|
|
16536
|
-
reason: "service file unreadable \u2014 defaulting to reboot"
|
|
16537
|
-
};
|
|
16538
|
-
}
|
|
16539
|
-
const sf = ts3.createSourceFile(file4, source, ts3.ScriptTarget.Latest, true);
|
|
16540
|
-
let result = {
|
|
16541
|
-
hasSideEffectCtor: false,
|
|
16542
|
-
reason: "constructor has no side-effecting calls"
|
|
16543
|
-
};
|
|
16544
|
-
const visit = (node) => {
|
|
16545
|
-
if (result.hasSideEffectCtor)
|
|
16546
|
-
return;
|
|
16547
|
-
if (!ts3.isClassDeclaration(node)) {
|
|
16548
|
-
ts3.forEachChild(node, visit);
|
|
16549
|
-
return;
|
|
16550
|
-
}
|
|
16551
|
-
const methods = collectMethodBodies(node);
|
|
16552
|
-
const ctor = node.members.find(ts3.isConstructorDeclaration);
|
|
16553
|
-
const targets = [];
|
|
16554
|
-
if (ctor?.body)
|
|
16555
|
-
targets.push(ctor.body);
|
|
16556
|
-
node.members.forEach((member) => {
|
|
16557
|
-
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16558
|
-
targets.push(member.initializer);
|
|
16559
|
-
}
|
|
16560
|
-
});
|
|
16561
|
-
for (const target of targets) {
|
|
16562
|
-
const r = findSideEffectInBody(target, methods, new Set);
|
|
16563
|
-
if (r.found) {
|
|
16564
|
-
result = { hasSideEffectCtor: true, reason: r.reason };
|
|
16565
|
-
break;
|
|
16566
|
-
}
|
|
16567
|
-
}
|
|
16568
|
-
if (!result.hasSideEffectCtor)
|
|
16569
|
-
ts3.forEachChild(node, visit);
|
|
16570
|
-
};
|
|
16571
|
-
visit(sf);
|
|
16572
|
-
return result;
|
|
16573
|
-
}, classifyAngularEdit = (file4) => {
|
|
16574
|
-
const base = basename10(file4);
|
|
16575
|
-
if (TEMPLATE_RE.test(file4)) {
|
|
16576
|
-
return {
|
|
16577
|
-
type: "template",
|
|
16578
|
-
reason: `${base} \u2014 template edit`,
|
|
16579
|
-
sourceFile: file4
|
|
16580
|
-
};
|
|
16581
|
-
}
|
|
16582
|
-
if (COMPONENT_STYLE_RE.test(file4)) {
|
|
16583
|
-
return {
|
|
16584
|
-
type: "style-component",
|
|
16585
|
-
reason: `${base} \u2014 component-scoped stylesheet edit`,
|
|
16586
|
-
sourceFile: file4
|
|
16587
|
-
};
|
|
16588
|
-
}
|
|
16589
|
-
if (STYLE_EXT_RE.test(file4)) {
|
|
16590
|
-
return {
|
|
16591
|
-
type: "reboot",
|
|
16592
|
-
reason: `${base} \u2014 non-component-named stylesheet, falling back to reboot until scoping is verified`,
|
|
16593
|
-
sourceFile: file4
|
|
16594
|
-
};
|
|
16595
|
-
}
|
|
16596
|
-
if (ROUTES_RE.test(file4)) {
|
|
16597
|
-
return {
|
|
16598
|
-
type: "route",
|
|
16599
|
-
reason: `${base} \u2014 router config, requires reboot`,
|
|
16600
|
-
sourceFile: file4
|
|
16601
|
-
};
|
|
16602
|
-
}
|
|
16603
|
-
if (SERVICE_RE.test(file4)) {
|
|
16604
|
-
const a = analyzeServiceFile(file4);
|
|
16605
|
-
if (a.hasSideEffectCtor) {
|
|
16606
|
-
return {
|
|
16607
|
-
type: "service-with-side-effects",
|
|
16608
|
-
reason: `${base} \u2014 ${a.reason}`,
|
|
16609
|
-
sourceFile: file4
|
|
16610
|
-
};
|
|
16611
|
-
}
|
|
16612
|
-
return {
|
|
16613
|
-
type: "service-method-only",
|
|
16614
|
-
reason: `${base} \u2014 ${a.reason}`,
|
|
16615
|
-
sourceFile: file4
|
|
16616
|
-
};
|
|
16617
|
-
}
|
|
16618
|
-
if (COMPONENT_CLASS_RE.test(file4)) {
|
|
16619
|
-
return {
|
|
16620
|
-
type: "class-component",
|
|
16621
|
-
reason: `${base} \u2014 component class edit`,
|
|
16622
|
-
sourceFile: file4
|
|
16623
|
-
};
|
|
16624
|
-
}
|
|
16625
|
-
if (PAGE_TS_RE.test(file4)) {
|
|
16626
|
-
return {
|
|
16627
|
-
type: "class-component",
|
|
16628
|
-
reason: `${base} \u2014 page component edit`,
|
|
16629
|
-
sourceFile: file4
|
|
16630
|
-
};
|
|
16631
|
-
}
|
|
16632
|
-
return {
|
|
16633
|
-
type: "reboot",
|
|
16634
|
-
reason: `${base} \u2014 unrecognized angular file type, falling back to reboot`,
|
|
16635
|
-
sourceFile: file4
|
|
16636
|
-
};
|
|
16637
|
-
}, collapseClassifications = (classifications) => {
|
|
16638
|
-
if (classifications.length === 0) {
|
|
16639
|
-
return {
|
|
16640
|
-
type: "reboot",
|
|
16641
|
-
reason: "no classifiable files in batch",
|
|
16642
|
-
sourceFile: ""
|
|
16643
|
-
};
|
|
16644
|
-
}
|
|
16645
|
-
let winner = classifications[0];
|
|
16646
|
-
for (let i = 1;i < classifications.length; i++) {
|
|
16647
|
-
const candidate = classifications[i];
|
|
16648
|
-
if (TYPE_PRIORITY[candidate.type] > TYPE_PRIORITY[winner.type]) {
|
|
16649
|
-
winner = candidate;
|
|
16650
|
-
}
|
|
16651
|
-
}
|
|
16652
|
-
return winner;
|
|
16653
|
-
};
|
|
16654
|
-
var init_editTypeDetection = __esm(() => {
|
|
16655
|
-
TYPE_PRIORITY = {
|
|
16656
|
-
template: 0,
|
|
16657
|
-
"style-component": 1,
|
|
16658
|
-
"service-method-only": 2,
|
|
16659
|
-
"class-component": 3,
|
|
16660
|
-
"service-with-side-effects": 4,
|
|
16661
|
-
route: 5,
|
|
16662
|
-
reboot: 6
|
|
16663
|
-
};
|
|
16664
|
-
STYLE_EXT_RE = /\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16665
|
-
COMPONENT_STYLE_RE = /\.component\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16666
|
-
TEMPLATE_RE = /\.html$/i;
|
|
16667
|
-
COMPONENT_CLASS_RE = /\.component\.ts$/i;
|
|
16668
|
-
SERVICE_RE = /\.service\.ts$/i;
|
|
16669
|
-
ROUTES_RE = /(?:^|[\\/])(?:app\.)?routes\.ts$/i;
|
|
16670
|
-
PAGE_TS_RE = /(?:^|[\\/])pages[\\/][^\\/]+\.ts$/i;
|
|
16671
|
-
SIDE_EFFECT_CALL_NAMES = new Set([
|
|
16672
|
-
"subscribe",
|
|
16673
|
-
"setInterval",
|
|
16674
|
-
"setTimeout",
|
|
16675
|
-
"addEventListener",
|
|
16676
|
-
"effect",
|
|
16677
|
-
"afterNextRender",
|
|
16678
|
-
"afterRender",
|
|
16679
|
-
"afterEveryRender",
|
|
16680
|
-
"requestAnimationFrame",
|
|
16681
|
-
"requestIdleCallback"
|
|
16682
|
-
]);
|
|
16683
|
-
SIDE_EFFECT_NEW_NAMES = new Set([
|
|
16684
|
-
"Worker",
|
|
16685
|
-
"SharedWorker",
|
|
16686
|
-
"EventSource",
|
|
16687
|
-
"WebSocket",
|
|
16688
|
-
"BroadcastChannel"
|
|
16689
|
-
]);
|
|
16690
|
-
});
|
|
16691
|
-
|
|
16692
16584
|
// src/dev/moduleServer.ts
|
|
16693
16585
|
var exports_moduleServer = {};
|
|
16694
16586
|
__export(exports_moduleServer, {
|
|
@@ -16701,7 +16593,7 @@ __export(exports_moduleServer, {
|
|
|
16701
16593
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16702
16594
|
});
|
|
16703
16595
|
import { existsSync as existsSync24, readFileSync as readFileSync17, statSync as statSync2 } from "fs";
|
|
16704
|
-
import { basename as
|
|
16596
|
+
import { basename as basename10, dirname as dirname16, extname as extname8, join as join27, resolve as resolve29, relative as relative12 } from "path";
|
|
16705
16597
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16706
16598
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16707
16599
|
const allExports = [];
|
|
@@ -16721,7 +16613,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
16721
16613
|
${stubs}
|
|
16722
16614
|
`;
|
|
16723
16615
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
16724
|
-
const found = extensions.find((ext) => existsSync24(
|
|
16616
|
+
const found = extensions.find((ext) => existsSync24(resolve29(projectRoot, srcPath + ext)));
|
|
16725
16617
|
return found ? srcPath + found : srcPath;
|
|
16726
16618
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
16727
16619
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -16736,7 +16628,7 @@ ${stubs}
|
|
|
16736
16628
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
16737
16629
|
}, srcUrl = (relPath, projectRoot) => {
|
|
16738
16630
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
16739
|
-
const absPath =
|
|
16631
|
+
const absPath = resolve29(projectRoot, relPath);
|
|
16740
16632
|
const cached = mtimeCache.get(absPath);
|
|
16741
16633
|
if (cached !== undefined)
|
|
16742
16634
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -16748,12 +16640,12 @@ ${stubs}
|
|
|
16748
16640
|
return base;
|
|
16749
16641
|
}
|
|
16750
16642
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
16751
|
-
const absPath =
|
|
16752
|
-
const rel =
|
|
16643
|
+
const absPath = resolve29(fileDir, relPath);
|
|
16644
|
+
const rel = relative12(projectRoot, absPath);
|
|
16753
16645
|
const extension = extname8(rel);
|
|
16754
16646
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
16755
16647
|
if (extname8(srcPath) === ".svelte") {
|
|
16756
|
-
srcPath =
|
|
16648
|
+
srcPath = relative12(projectRoot, resolveSvelteModulePath(resolve29(projectRoot, srcPath)));
|
|
16757
16649
|
}
|
|
16758
16650
|
return srcUrl(srcPath, projectRoot);
|
|
16759
16651
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -16763,27 +16655,27 @@ ${stubs}
|
|
|
16763
16655
|
"import"
|
|
16764
16656
|
]);
|
|
16765
16657
|
if (fromExports)
|
|
16766
|
-
return
|
|
16658
|
+
return relative12(projectRoot, fromExports);
|
|
16767
16659
|
try {
|
|
16768
16660
|
const isScoped = specifier.startsWith("@");
|
|
16769
16661
|
const parts = specifier.split("/");
|
|
16770
16662
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
16771
16663
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
16772
16664
|
if (!subpath) {
|
|
16773
|
-
const pkgDir =
|
|
16665
|
+
const pkgDir = resolve29(projectRoot, "node_modules", packageName ?? "");
|
|
16774
16666
|
const pkgJsonPath = join27(pkgDir, "package.json");
|
|
16775
16667
|
if (existsSync24(pkgJsonPath)) {
|
|
16776
16668
|
const pkg = JSON.parse(readFileSync17(pkgJsonPath, "utf-8"));
|
|
16777
16669
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
16778
16670
|
if (esmEntry) {
|
|
16779
|
-
const resolved =
|
|
16671
|
+
const resolved = resolve29(pkgDir, esmEntry);
|
|
16780
16672
|
if (existsSync24(resolved))
|
|
16781
|
-
return
|
|
16673
|
+
return relative12(projectRoot, resolved);
|
|
16782
16674
|
}
|
|
16783
16675
|
}
|
|
16784
16676
|
}
|
|
16785
16677
|
} catch {}
|
|
16786
|
-
return
|
|
16678
|
+
return relative12(projectRoot, Bun.resolveSync(specifier, projectRoot));
|
|
16787
16679
|
} catch {
|
|
16788
16680
|
return;
|
|
16789
16681
|
}
|
|
@@ -16808,26 +16700,26 @@ ${stubs}
|
|
|
16808
16700
|
};
|
|
16809
16701
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
16810
16702
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
16811
|
-
const fileDir =
|
|
16703
|
+
const fileDir = dirname16(filePath);
|
|
16812
16704
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
16813
16705
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
16814
16706
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
16815
16707
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
16816
16708
|
if (absPath.startsWith(projectRoot)) {
|
|
16817
|
-
const rel2 =
|
|
16709
|
+
const rel2 = relative12(projectRoot, absPath).replace(/\\/g, "/");
|
|
16818
16710
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
16819
16711
|
}
|
|
16820
|
-
const rel =
|
|
16712
|
+
const rel = relative12(projectRoot, absPath).replace(/\\/g, "/");
|
|
16821
16713
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
16822
16714
|
});
|
|
16823
16715
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
16824
|
-
const absPath =
|
|
16825
|
-
const rel =
|
|
16716
|
+
const absPath = resolve29(fileDir, relPath);
|
|
16717
|
+
const rel = relative12(projectRoot, absPath);
|
|
16826
16718
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
16827
16719
|
});
|
|
16828
16720
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
16829
|
-
const absPath =
|
|
16830
|
-
const rel =
|
|
16721
|
+
const absPath = resolve29(fileDir, relPath);
|
|
16722
|
+
const rel = relative12(projectRoot, absPath);
|
|
16831
16723
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
16832
16724
|
});
|
|
16833
16725
|
return result;
|
|
@@ -16883,7 +16775,7 @@ ${code}`;
|
|
|
16883
16775
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
16884
16776
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
16885
16777
|
${transpiled}`;
|
|
16886
|
-
const relPath =
|
|
16778
|
+
const relPath = relative12(projectRoot, filePath).replace(/\\/g, "/");
|
|
16887
16779
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
16888
16780
|
transpiled += buildIslandMetadataExports(raw);
|
|
16889
16781
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
@@ -17044,11 +16936,11 @@ ${code}`;
|
|
|
17044
16936
|
if (compiled.css?.code) {
|
|
17045
16937
|
const cssPath = `${filePath}.css`;
|
|
17046
16938
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
17047
|
-
const cssUrl = srcUrl(
|
|
16939
|
+
const cssUrl = srcUrl(relative12(projectRoot, cssPath), projectRoot);
|
|
17048
16940
|
code = `import "${cssUrl}";
|
|
17049
16941
|
${code}`;
|
|
17050
16942
|
}
|
|
17051
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
16943
|
+
const moduleUrl = `${SRC_PREFIX}${relative12(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
17052
16944
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
17053
16945
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
17054
16946
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -17119,7 +17011,7 @@ ${code}`;
|
|
|
17119
17011
|
if (!vueCompiler) {
|
|
17120
17012
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
17121
17013
|
}
|
|
17122
|
-
const fileName =
|
|
17014
|
+
const fileName = basename10(filePath, ".vue");
|
|
17123
17015
|
const componentId = fileName.toLowerCase();
|
|
17124
17016
|
const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
|
|
17125
17017
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -17137,8 +17029,8 @@ ${code}`;
|
|
|
17137
17029
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
17138
17030
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
17139
17031
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
17140
|
-
const hmrBase = vueDir ?
|
|
17141
|
-
const hmrId =
|
|
17032
|
+
const hmrBase = vueDir ? resolve29(vueDir) : projectRoot;
|
|
17033
|
+
const hmrId = relative12(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
17142
17034
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
17143
17035
|
result += [
|
|
17144
17036
|
"",
|
|
@@ -17296,7 +17188,7 @@ export default {};
|
|
|
17296
17188
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
17297
17189
|
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);`);
|
|
17298
17190
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
17299
|
-
const filePath =
|
|
17191
|
+
const filePath = resolve29(projectRoot, relPath);
|
|
17300
17192
|
const ext = extname8(filePath);
|
|
17301
17193
|
if (ext === ".svelte")
|
|
17302
17194
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -17323,7 +17215,7 @@ export default {};
|
|
|
17323
17215
|
if (!TRANSPILABLE.has(ext))
|
|
17324
17216
|
return;
|
|
17325
17217
|
const stat3 = statSync2(filePath);
|
|
17326
|
-
const resolvedVueDir = vueDir ?
|
|
17218
|
+
const resolvedVueDir = vueDir ? resolve29(vueDir) : undefined;
|
|
17327
17219
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
17328
17220
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
17329
17221
|
return jsResponse(content);
|
|
@@ -17354,7 +17246,7 @@ export default {};
|
|
|
17354
17246
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
17355
17247
|
return;
|
|
17356
17248
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
17357
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
17249
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve29(projectRoot, relPath));
|
|
17358
17250
|
if (virtualCssResponse)
|
|
17359
17251
|
return virtualCssResponse;
|
|
17360
17252
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -17370,11 +17262,11 @@ export default {};
|
|
|
17370
17262
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
17371
17263
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
17372
17264
|
if (match[1])
|
|
17373
|
-
files.push(
|
|
17265
|
+
files.push(resolve29(projectRoot, match[1]));
|
|
17374
17266
|
}
|
|
17375
17267
|
return files;
|
|
17376
17268
|
}, invalidateModule = (filePath) => {
|
|
17377
|
-
const resolved =
|
|
17269
|
+
const resolved = resolve29(filePath);
|
|
17378
17270
|
invalidate(filePath);
|
|
17379
17271
|
if (resolved !== filePath)
|
|
17380
17272
|
invalidate(resolved);
|
|
@@ -17489,71 +17381,1584 @@ var init_rewriteImports = __esm(() => {
|
|
|
17489
17381
|
rewriteVendorDirectories2 = rewriteVendorDirectories;
|
|
17490
17382
|
});
|
|
17491
17383
|
|
|
17492
|
-
// src/
|
|
17493
|
-
var
|
|
17494
|
-
|
|
17495
|
-
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17499
|
-
|
|
17500
|
-
|
|
17384
|
+
// src/dev/angular/resolveOwningComponents.ts
|
|
17385
|
+
var exports_resolveOwningComponents = {};
|
|
17386
|
+
__export(exports_resolveOwningComponents, {
|
|
17387
|
+
resolveOwningComponents: () => resolveOwningComponents
|
|
17388
|
+
});
|
|
17389
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync18, statSync as statSync3 } from "fs";
|
|
17390
|
+
import { dirname as dirname17, extname as extname9, join as join28, resolve as resolve30 } from "path";
|
|
17391
|
+
import ts3 from "typescript";
|
|
17392
|
+
var isComponentTsFile = (file4) => file4.endsWith(".component.ts") || file4.endsWith(".component.tsx"), walkComponentTsFiles = (root) => {
|
|
17393
|
+
const out = [];
|
|
17394
|
+
const visit = (dir) => {
|
|
17395
|
+
let entries;
|
|
17396
|
+
try {
|
|
17397
|
+
entries = readdirSync2(dir, { withFileTypes: true });
|
|
17398
|
+
} catch {
|
|
17399
|
+
return;
|
|
17400
|
+
}
|
|
17401
|
+
for (const entry of entries) {
|
|
17402
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
17403
|
+
continue;
|
|
17404
|
+
}
|
|
17405
|
+
const full = join28(dir, entry.name);
|
|
17406
|
+
if (entry.isDirectory()) {
|
|
17407
|
+
visit(full);
|
|
17408
|
+
} else if (entry.isFile() && isComponentTsFile(entry.name)) {
|
|
17409
|
+
out.push(full);
|
|
17410
|
+
}
|
|
17411
|
+
}
|
|
17501
17412
|
};
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
|
|
17506
|
-
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
|
|
17510
|
-
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
|
|
17514
|
-
|
|
17515
|
-
.header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;background:rgba(15,23,42,0.5);border-bottom:1px solid rgba(71,85,105,0.4)}
|
|
17516
|
-
.brand{font-weight:700;font-size:20px;color:#fff;letter-spacing:-0.02em}
|
|
17517
|
-
.badge{padding:5px 10px;border-radius:8px;font-size:12px;font-weight:600;background:${accent};color:#fff;opacity:0.95;box-shadow:0 2px 4px rgba(0,0,0,0.2)}
|
|
17518
|
-
.kind{color:#94a3b8;font-size:13px;font-weight:500}
|
|
17519
|
-
.content{padding:24px}
|
|
17520
|
-
.label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px}
|
|
17521
|
-
.message{margin:0;padding:16px 20px;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.25);border-radius:10px;overflow-x:auto;white-space:pre-wrap;word-break:break-word;color:#fca5a5;font-size:13px;line-height:1.5}
|
|
17522
|
-
.hint{margin-top:20px;padding:12px 20px;background:rgba(71,85,105,0.3);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#cbd5e1;font-size:13px}
|
|
17523
|
-
</style>
|
|
17524
|
-
</head>
|
|
17525
|
-
<body>
|
|
17526
|
-
<div class="card">
|
|
17527
|
-
<div class="header">
|
|
17528
|
-
<div style="display:flex;align-items:center;gap:12px">
|
|
17529
|
-
<span class="brand">AbsoluteJS</span>
|
|
17530
|
-
<span class="badge">${label}</span>
|
|
17531
|
-
</div>
|
|
17532
|
-
<span class="kind">Server Render Error</span>
|
|
17533
|
-
</div>
|
|
17534
|
-
<div class="content">
|
|
17535
|
-
<div class="label">What went wrong</div>
|
|
17536
|
-
<pre class="message">${message.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</pre>
|
|
17537
|
-
<div class="hint">A component threw during server-side rendering. Check the terminal for the full stack trace.</div>
|
|
17538
|
-
</div>
|
|
17539
|
-
</div>
|
|
17540
|
-
</body>
|
|
17541
|
-
</html>`;
|
|
17542
|
-
};
|
|
17543
|
-
|
|
17544
|
-
// src/ember/pageHandler.ts
|
|
17545
|
-
import { pathToFileURL } from "url";
|
|
17546
|
-
var resolveRequestPathname = (request) => {
|
|
17547
|
-
if (!request)
|
|
17548
|
-
return;
|
|
17549
|
-
try {
|
|
17550
|
-
const parsed = new URL(request.url);
|
|
17551
|
-
return `${parsed.pathname}${parsed.search}`;
|
|
17552
|
-
} catch {
|
|
17553
|
-
return;
|
|
17413
|
+
visit(root);
|
|
17414
|
+
return out;
|
|
17415
|
+
}, getStringPropertyValue = (obj, name) => {
|
|
17416
|
+
for (const prop of obj.properties) {
|
|
17417
|
+
if (!ts3.isPropertyAssignment(prop))
|
|
17418
|
+
continue;
|
|
17419
|
+
const propName = ts3.isIdentifier(prop.name) ? prop.name.text : ts3.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
17420
|
+
if (propName !== name)
|
|
17421
|
+
continue;
|
|
17422
|
+
const init = prop.initializer;
|
|
17423
|
+
if (ts3.isStringLiteral(init) || ts3.isNoSubstitutionTemplateLiteral(init)) {
|
|
17424
|
+
return init.text;
|
|
17425
|
+
}
|
|
17554
17426
|
}
|
|
17555
|
-
|
|
17556
|
-
|
|
17427
|
+
return null;
|
|
17428
|
+
}, getStringArrayProperty = (obj, name) => {
|
|
17429
|
+
const out = [];
|
|
17430
|
+
for (const prop of obj.properties) {
|
|
17431
|
+
if (!ts3.isPropertyAssignment(prop))
|
|
17432
|
+
continue;
|
|
17433
|
+
const propName = ts3.isIdentifier(prop.name) ? prop.name.text : ts3.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
17434
|
+
if (propName !== name)
|
|
17435
|
+
continue;
|
|
17436
|
+
const init = prop.initializer;
|
|
17437
|
+
if (!ts3.isArrayLiteralExpression(init))
|
|
17438
|
+
continue;
|
|
17439
|
+
for (const element of init.elements) {
|
|
17440
|
+
if (ts3.isStringLiteral(element) || ts3.isNoSubstitutionTemplateLiteral(element)) {
|
|
17441
|
+
out.push(element.text);
|
|
17442
|
+
}
|
|
17443
|
+
}
|
|
17444
|
+
}
|
|
17445
|
+
return out;
|
|
17446
|
+
}, parseComponentRefs = (filePath) => {
|
|
17447
|
+
const refs = {
|
|
17448
|
+
classNames: [],
|
|
17449
|
+
templateUrls: [],
|
|
17450
|
+
styleUrls: []
|
|
17451
|
+
};
|
|
17452
|
+
let source;
|
|
17453
|
+
try {
|
|
17454
|
+
source = readFileSync18(filePath, "utf8");
|
|
17455
|
+
} catch {
|
|
17456
|
+
return refs;
|
|
17457
|
+
}
|
|
17458
|
+
const sourceFile = ts3.createSourceFile(filePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17459
|
+
const visit = (node) => {
|
|
17460
|
+
if (ts3.isClassDeclaration(node) && node.name) {
|
|
17461
|
+
const decorators = ts3.getDecorators(node) ?? [];
|
|
17462
|
+
for (const decorator of decorators) {
|
|
17463
|
+
const expr = decorator.expression;
|
|
17464
|
+
if (!ts3.isCallExpression(expr))
|
|
17465
|
+
continue;
|
|
17466
|
+
const fn2 = expr.expression;
|
|
17467
|
+
if (!ts3.isIdentifier(fn2) || fn2.text !== "Component")
|
|
17468
|
+
continue;
|
|
17469
|
+
refs.classNames.push(node.name.text);
|
|
17470
|
+
const arg = expr.arguments[0];
|
|
17471
|
+
if (!arg || !ts3.isObjectLiteralExpression(arg))
|
|
17472
|
+
continue;
|
|
17473
|
+
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
17474
|
+
if (tplUrl)
|
|
17475
|
+
refs.templateUrls.push(tplUrl);
|
|
17476
|
+
const styleUrl = getStringPropertyValue(arg, "styleUrl");
|
|
17477
|
+
if (styleUrl)
|
|
17478
|
+
refs.styleUrls.push(styleUrl);
|
|
17479
|
+
refs.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
|
|
17480
|
+
}
|
|
17481
|
+
}
|
|
17482
|
+
ts3.forEachChild(node, visit);
|
|
17483
|
+
};
|
|
17484
|
+
visit(sourceFile);
|
|
17485
|
+
return refs;
|
|
17486
|
+
}, safeNormalize = (path) => resolve30(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
17487
|
+
const { changedFilePath, userAngularRoot } = params;
|
|
17488
|
+
const changedAbs = safeNormalize(changedFilePath);
|
|
17489
|
+
const out = [];
|
|
17490
|
+
if (changedAbs.endsWith(".component.ts")) {
|
|
17491
|
+
const refs = parseComponentRefs(changedAbs);
|
|
17492
|
+
for (const className of refs.classNames) {
|
|
17493
|
+
out.push({ componentFilePath: changedAbs, className });
|
|
17494
|
+
}
|
|
17495
|
+
return out;
|
|
17496
|
+
}
|
|
17497
|
+
const ext = extname9(changedAbs).toLowerCase();
|
|
17498
|
+
if (ext !== ".html" && ext !== ".css" && ext !== ".scss" && ext !== ".sass") {
|
|
17499
|
+
return out;
|
|
17500
|
+
}
|
|
17501
|
+
let rootStat;
|
|
17502
|
+
try {
|
|
17503
|
+
rootStat = statSync3(userAngularRoot);
|
|
17504
|
+
} catch {
|
|
17505
|
+
return out;
|
|
17506
|
+
}
|
|
17507
|
+
if (!rootStat.isDirectory())
|
|
17508
|
+
return out;
|
|
17509
|
+
for (const componentTsPath of walkComponentTsFiles(userAngularRoot)) {
|
|
17510
|
+
const refs = parseComponentRefs(componentTsPath);
|
|
17511
|
+
const componentDir = dirname17(componentTsPath);
|
|
17512
|
+
const matchesResource = (relativeUrl) => {
|
|
17513
|
+
const abs = safeNormalize(resolve30(componentDir, relativeUrl));
|
|
17514
|
+
return abs === changedAbs;
|
|
17515
|
+
};
|
|
17516
|
+
const referencesChanged = refs.templateUrls.some(matchesResource) || refs.styleUrls.some(matchesResource);
|
|
17517
|
+
if (!referencesChanged)
|
|
17518
|
+
continue;
|
|
17519
|
+
for (const className of refs.classNames) {
|
|
17520
|
+
out.push({
|
|
17521
|
+
componentFilePath: componentTsPath,
|
|
17522
|
+
className
|
|
17523
|
+
});
|
|
17524
|
+
}
|
|
17525
|
+
}
|
|
17526
|
+
return out;
|
|
17527
|
+
};
|
|
17528
|
+
var init_resolveOwningComponents = () => {};
|
|
17529
|
+
|
|
17530
|
+
// src/dev/angular/hmrImportGenerator.ts
|
|
17531
|
+
import ts4 from "typescript";
|
|
17532
|
+
var createHmrImportGenerator = (namespaceMap) => ({
|
|
17533
|
+
addImport(request) {
|
|
17534
|
+
const ns = namespaceMap.get(request.exportModuleSpecifier);
|
|
17535
|
+
if (!ns) {
|
|
17536
|
+
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
17537
|
+
}
|
|
17538
|
+
const namespaceId = ts4.factory.createIdentifier(ns);
|
|
17539
|
+
if (request.exportSymbolName === null) {
|
|
17540
|
+
return namespaceId;
|
|
17541
|
+
}
|
|
17542
|
+
return ts4.factory.createPropertyAccessExpression(namespaceId, ts4.factory.createIdentifier(request.exportSymbolName));
|
|
17543
|
+
}
|
|
17544
|
+
});
|
|
17545
|
+
var init_hmrImportGenerator = () => {};
|
|
17546
|
+
|
|
17547
|
+
// src/dev/angular/vendor/translator/context.ts
|
|
17548
|
+
class Context {
|
|
17549
|
+
isStatement;
|
|
17550
|
+
constructor(isStatement) {
|
|
17551
|
+
this.isStatement = isStatement;
|
|
17552
|
+
}
|
|
17553
|
+
get withExpressionMode() {
|
|
17554
|
+
return this.isStatement ? new Context(false) : this;
|
|
17555
|
+
}
|
|
17556
|
+
get withStatementMode() {
|
|
17557
|
+
return !this.isStatement ? new Context(true) : this;
|
|
17558
|
+
}
|
|
17559
|
+
}
|
|
17560
|
+
|
|
17561
|
+
// src/dev/angular/vendor/translator/translator.ts
|
|
17562
|
+
import * as o from "@angular/compiler";
|
|
17563
|
+
|
|
17564
|
+
class ExpressionTranslatorVisitor {
|
|
17565
|
+
factory;
|
|
17566
|
+
imports;
|
|
17567
|
+
contextFile;
|
|
17568
|
+
downlevelTaggedTemplates;
|
|
17569
|
+
downlevelVariableDeclarations;
|
|
17570
|
+
recordWrappedNode;
|
|
17571
|
+
constructor(factory, imports, contextFile, options) {
|
|
17572
|
+
this.factory = factory;
|
|
17573
|
+
this.imports = imports;
|
|
17574
|
+
this.contextFile = contextFile;
|
|
17575
|
+
this.downlevelTaggedTemplates = options.downlevelTaggedTemplates === true;
|
|
17576
|
+
this.downlevelVariableDeclarations = options.downlevelVariableDeclarations === true;
|
|
17577
|
+
this.recordWrappedNode = options.recordWrappedNode || (() => {});
|
|
17578
|
+
}
|
|
17579
|
+
visitDeclareVarStmt(stmt, context) {
|
|
17580
|
+
const varType = this.downlevelVariableDeclarations ? "var" : stmt.hasModifier(o.StmtModifier.Final) ? "const" : "let";
|
|
17581
|
+
return this.attachComments(this.factory.createVariableDeclaration(stmt.name, stmt.value?.visitExpression(this, context.withExpressionMode), varType, stmt.type?.visitType(this, context)), stmt.leadingComments);
|
|
17582
|
+
}
|
|
17583
|
+
visitDeclareFunctionStmt(stmt, context) {
|
|
17584
|
+
return this.attachComments(this.factory.createFunctionDeclaration(stmt.name, this.translateParams(stmt.params, context), this.factory.createBlock(this.visitStatements(stmt.statements, context.withStatementMode))), stmt.leadingComments);
|
|
17585
|
+
}
|
|
17586
|
+
visitExpressionStmt(stmt, context) {
|
|
17587
|
+
return this.attachComments(this.factory.createExpressionStatement(stmt.expr.visitExpression(this, context.withStatementMode)), stmt.leadingComments);
|
|
17588
|
+
}
|
|
17589
|
+
visitReturnStmt(stmt, context) {
|
|
17590
|
+
return this.attachComments(this.factory.createReturnStatement(stmt.value.visitExpression(this, context.withExpressionMode)), stmt.leadingComments);
|
|
17591
|
+
}
|
|
17592
|
+
visitIfStmt(stmt, context) {
|
|
17593
|
+
return this.attachComments(this.factory.createIfStatement(stmt.condition.visitExpression(this, context), this.factory.createBlock(this.visitStatements(stmt.trueCase, context.withStatementMode)), stmt.falseCase.length > 0 ? this.factory.createBlock(this.visitStatements(stmt.falseCase, context.withStatementMode)) : null), stmt.leadingComments);
|
|
17594
|
+
}
|
|
17595
|
+
visitReadVarExpr(ast, _context) {
|
|
17596
|
+
const identifier = this.factory.createIdentifier(ast.name);
|
|
17597
|
+
this.setSourceMapRange(identifier, ast.sourceSpan);
|
|
17598
|
+
return identifier;
|
|
17599
|
+
}
|
|
17600
|
+
visitInvokeFunctionExpr(ast, context) {
|
|
17601
|
+
return this.setSourceMapRange(this.factory.createCallExpression(ast.fn.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)), ast.pure), ast.sourceSpan);
|
|
17602
|
+
}
|
|
17603
|
+
visitTaggedTemplateLiteralExpr(ast, context) {
|
|
17604
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(ast.tag.visitExpression(this, context), this.getTemplateLiteralFromAst(ast.template, context)), ast.sourceSpan);
|
|
17605
|
+
}
|
|
17606
|
+
visitTemplateLiteralExpr(ast, context) {
|
|
17607
|
+
return this.setSourceMapRange(this.factory.createTemplateLiteral(this.getTemplateLiteralFromAst(ast, context)), ast.sourceSpan);
|
|
17608
|
+
}
|
|
17609
|
+
visitInstantiateExpr(ast, context) {
|
|
17610
|
+
return this.factory.createNewExpression(ast.classExpr.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)));
|
|
17611
|
+
}
|
|
17612
|
+
visitLiteralExpr(ast, _context) {
|
|
17613
|
+
return this.setSourceMapRange(this.factory.createLiteral(ast.value), ast.sourceSpan);
|
|
17614
|
+
}
|
|
17615
|
+
visitRegularExpressionLiteral(ast, context) {
|
|
17616
|
+
return this.setSourceMapRange(this.factory.createRegularExpressionLiteral(ast.body, ast.flags), ast.sourceSpan);
|
|
17617
|
+
}
|
|
17618
|
+
visitLocalizedString(ast, context) {
|
|
17619
|
+
const elements = [createTemplateElement(ast.serializeI18nHead())];
|
|
17620
|
+
const expressions = [];
|
|
17621
|
+
for (let i = 0;i < ast.expressions.length; i++) {
|
|
17622
|
+
const placeholder = this.setSourceMapRange(ast.expressions[i].visitExpression(this, context), ast.getPlaceholderSourceSpan(i));
|
|
17623
|
+
expressions.push(placeholder);
|
|
17624
|
+
elements.push(createTemplateElement(ast.serializeI18nTemplatePart(i + 1)));
|
|
17625
|
+
}
|
|
17626
|
+
const localizeTag = this.factory.createIdentifier("$localize");
|
|
17627
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, { elements, expressions }), ast.sourceSpan);
|
|
17628
|
+
}
|
|
17629
|
+
visitBuiltinType(ast) {
|
|
17630
|
+
let builtInType;
|
|
17631
|
+
switch (ast.name) {
|
|
17632
|
+
case o.BuiltinTypeName.Bool:
|
|
17633
|
+
builtInType = "boolean";
|
|
17634
|
+
break;
|
|
17635
|
+
case o.BuiltinTypeName.String:
|
|
17636
|
+
builtInType = "string";
|
|
17637
|
+
break;
|
|
17638
|
+
case o.BuiltinTypeName.Dynamic:
|
|
17639
|
+
builtInType = "any";
|
|
17640
|
+
break;
|
|
17641
|
+
case o.BuiltinTypeName.Number:
|
|
17642
|
+
case o.BuiltinTypeName.Int:
|
|
17643
|
+
builtInType = "number";
|
|
17644
|
+
break;
|
|
17645
|
+
case o.BuiltinTypeName.Function:
|
|
17646
|
+
builtInType = "function";
|
|
17647
|
+
break;
|
|
17648
|
+
case o.BuiltinTypeName.None:
|
|
17649
|
+
builtInType = "never";
|
|
17650
|
+
break;
|
|
17651
|
+
case o.BuiltinTypeName.Inferred:
|
|
17652
|
+
return null;
|
|
17653
|
+
}
|
|
17654
|
+
return this.factory.createBuiltInType(builtInType);
|
|
17655
|
+
}
|
|
17656
|
+
visitExpressionType(ast, context) {
|
|
17657
|
+
return this.factory.createExpressionType(ast.value.visitExpression(this, context), ast.typeParams === null || ast.typeParams.length === 0 ? null : ast.typeParams.map((param) => param.visitType(this, context)));
|
|
17658
|
+
}
|
|
17659
|
+
visitArrayType(ast, context) {
|
|
17660
|
+
return this.factory.createArrayType(ast.of.visitType(this, context));
|
|
17661
|
+
}
|
|
17662
|
+
visitMapType(ast, context) {
|
|
17663
|
+
const valueType = ast.valueType === null ? this.factory.createBuiltInType("unknown") : ast.valueType.visitType(this, context);
|
|
17664
|
+
return this.factory.createMapType(valueType);
|
|
17665
|
+
}
|
|
17666
|
+
visitTransplantedType(type) {
|
|
17667
|
+
return this.factory.transplantType(type.type);
|
|
17668
|
+
}
|
|
17669
|
+
createTaggedTemplateExpression(tag, template) {
|
|
17670
|
+
return this.downlevelTaggedTemplates ? this.createES5TaggedTemplateFunctionCall(tag, template) : this.factory.createTaggedTemplate(tag, template);
|
|
17671
|
+
}
|
|
17672
|
+
createES5TaggedTemplateFunctionCall(tagHandler, { elements, expressions }) {
|
|
17673
|
+
const __makeTemplateObjectHelper = this.imports.addImport({
|
|
17674
|
+
exportModuleSpecifier: "tslib",
|
|
17675
|
+
exportSymbolName: "__makeTemplateObject",
|
|
17676
|
+
requestedFile: this.contextFile
|
|
17677
|
+
});
|
|
17678
|
+
const cooked = [];
|
|
17679
|
+
const raw = [];
|
|
17680
|
+
for (const element of elements) {
|
|
17681
|
+
cooked.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.cooked), element.range));
|
|
17682
|
+
raw.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.raw), element.range));
|
|
17683
|
+
}
|
|
17684
|
+
const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [this.factory.createArrayLiteral(cooked), this.factory.createArrayLiteral(raw)], false);
|
|
17685
|
+
return this.factory.createCallExpression(tagHandler, [templateHelperCall, ...expressions], false);
|
|
17686
|
+
}
|
|
17687
|
+
visitExternalExpr(ast, _context) {
|
|
17688
|
+
if (ast.value.name === null) {
|
|
17689
|
+
if (ast.value.moduleName === null) {
|
|
17690
|
+
throw new Error("Invalid import without name nor moduleName");
|
|
17691
|
+
}
|
|
17692
|
+
return this.imports.addImport({
|
|
17693
|
+
exportModuleSpecifier: ast.value.moduleName,
|
|
17694
|
+
exportSymbolName: null,
|
|
17695
|
+
requestedFile: this.contextFile
|
|
17696
|
+
});
|
|
17697
|
+
}
|
|
17698
|
+
if (ast.value.moduleName !== null) {
|
|
17699
|
+
return this.imports.addImport({
|
|
17700
|
+
exportModuleSpecifier: ast.value.moduleName,
|
|
17701
|
+
exportSymbolName: ast.value.name,
|
|
17702
|
+
requestedFile: this.contextFile
|
|
17703
|
+
});
|
|
17704
|
+
} else {
|
|
17705
|
+
return this.factory.createIdentifier(ast.value.name);
|
|
17706
|
+
}
|
|
17707
|
+
}
|
|
17708
|
+
visitConditionalExpr(ast, context) {
|
|
17709
|
+
return this.factory.createConditional(ast.condition.visitExpression(this, context), ast.trueCase.visitExpression(this, context), ast.falseCase.visitExpression(this, context));
|
|
17710
|
+
}
|
|
17711
|
+
visitDynamicImportExpr(ast, context) {
|
|
17712
|
+
const urlExpression = typeof ast.url === "string" ? this.factory.createLiteral(ast.url) : ast.url.visitExpression(this, context);
|
|
17713
|
+
if (ast.urlComment) {
|
|
17714
|
+
this.factory.attachComments(urlExpression, [o.leadingComment(ast.urlComment, true)]);
|
|
17715
|
+
}
|
|
17716
|
+
return this.factory.createDynamicImport(urlExpression);
|
|
17717
|
+
}
|
|
17718
|
+
visitNotExpr(ast, context) {
|
|
17719
|
+
return this.factory.createUnaryExpression("!", ast.condition.visitExpression(this, context));
|
|
17720
|
+
}
|
|
17721
|
+
visitFunctionExpr(ast, context) {
|
|
17722
|
+
return this.factory.createFunctionExpression(ast.name ?? null, this.translateParams(ast.params, context), this.factory.createBlock(this.visitStatements(ast.statements, context)));
|
|
17723
|
+
}
|
|
17724
|
+
visitArrowFunctionExpr(ast, context) {
|
|
17725
|
+
return this.factory.createArrowFunctionExpression(this.translateParams(ast.params, context), Array.isArray(ast.body) ? this.factory.createBlock(this.visitStatements(ast.body, context)) : ast.body.visitExpression(this, context));
|
|
17726
|
+
}
|
|
17727
|
+
visitBinaryOperatorExpr(ast, context) {
|
|
17728
|
+
if (!BINARY_OPERATORS.has(ast.operator)) {
|
|
17729
|
+
throw new Error(`Unknown binary operator: ${o.BinaryOperator[ast.operator]}`);
|
|
17730
|
+
}
|
|
17731
|
+
const operator = BINARY_OPERATORS.get(ast.operator);
|
|
17732
|
+
if (ast.isAssignment()) {
|
|
17733
|
+
return this.factory.createAssignment(ast.lhs.visitExpression(this, context), operator, ast.rhs.visitExpression(this, context));
|
|
17734
|
+
}
|
|
17735
|
+
return this.factory.createBinaryExpression(ast.lhs.visitExpression(this, context), operator, ast.rhs.visitExpression(this, context));
|
|
17736
|
+
}
|
|
17737
|
+
visitReadPropExpr(ast, context) {
|
|
17738
|
+
return this.factory.createPropertyAccess(ast.receiver.visitExpression(this, context), ast.name);
|
|
17739
|
+
}
|
|
17740
|
+
visitReadKeyExpr(ast, context) {
|
|
17741
|
+
return this.factory.createElementAccess(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context));
|
|
17742
|
+
}
|
|
17743
|
+
visitLiteralArrayExpr(ast, context) {
|
|
17744
|
+
return this.factory.createArrayLiteral(ast.entries.map((expr) => this.setSourceMapRange(expr.visitExpression(this, context), ast.sourceSpan)));
|
|
17745
|
+
}
|
|
17746
|
+
visitLiteralMapExpr(ast, context) {
|
|
17747
|
+
const properties = ast.entries.map((entry) => {
|
|
17748
|
+
return entry instanceof o.LiteralMapPropertyAssignment ? {
|
|
17749
|
+
kind: "property",
|
|
17750
|
+
propertyName: entry.key,
|
|
17751
|
+
quoted: entry.quoted,
|
|
17752
|
+
value: entry.value.visitExpression(this, context)
|
|
17753
|
+
} : {
|
|
17754
|
+
kind: "spread",
|
|
17755
|
+
expression: entry.expression.visitExpression(this, context)
|
|
17756
|
+
};
|
|
17757
|
+
});
|
|
17758
|
+
return this.setSourceMapRange(this.factory.createObjectLiteral(properties), ast.sourceSpan);
|
|
17759
|
+
}
|
|
17760
|
+
visitCommaExpr(ast, context) {
|
|
17761
|
+
throw new Error("Method not implemented.");
|
|
17762
|
+
}
|
|
17763
|
+
visitTemplateLiteralElementExpr(ast, context) {
|
|
17764
|
+
throw new Error("Method not implemented");
|
|
17765
|
+
}
|
|
17766
|
+
visitSpreadElementExpr(ast, context) {
|
|
17767
|
+
const expression = ast.expression.visitExpression(this, context);
|
|
17768
|
+
return this.setSourceMapRange(this.factory.createSpreadElement(expression), ast.sourceSpan);
|
|
17769
|
+
}
|
|
17770
|
+
visitWrappedNodeExpr(ast, _context) {
|
|
17771
|
+
this.recordWrappedNode(ast);
|
|
17772
|
+
return ast.node;
|
|
17773
|
+
}
|
|
17774
|
+
visitTypeofExpr(ast, context) {
|
|
17775
|
+
return this.factory.createTypeOfExpression(ast.expr.visitExpression(this, context));
|
|
17776
|
+
}
|
|
17777
|
+
visitVoidExpr(ast, context) {
|
|
17778
|
+
return this.factory.createVoidExpression(ast.expr.visitExpression(this, context));
|
|
17779
|
+
}
|
|
17780
|
+
visitUnaryOperatorExpr(ast, context) {
|
|
17781
|
+
if (!UNARY_OPERATORS.has(ast.operator)) {
|
|
17782
|
+
throw new Error(`Unknown unary operator: ${o.UnaryOperator[ast.operator]}`);
|
|
17783
|
+
}
|
|
17784
|
+
return this.factory.createUnaryExpression(UNARY_OPERATORS.get(ast.operator), ast.expr.visitExpression(this, context));
|
|
17785
|
+
}
|
|
17786
|
+
visitParenthesizedExpr(ast, context) {
|
|
17787
|
+
const result = ast.expr.visitExpression(this, context);
|
|
17788
|
+
return this.factory.createParenthesizedExpression(result);
|
|
17789
|
+
}
|
|
17790
|
+
visitStatements(statements, context) {
|
|
17791
|
+
return statements.map((stmt) => stmt.visitStatement(this, context)).filter((stmt) => stmt !== undefined);
|
|
17792
|
+
}
|
|
17793
|
+
setSourceMapRange(ast, span) {
|
|
17794
|
+
return this.factory.setSourceMapRange(ast, createRange(span));
|
|
17795
|
+
}
|
|
17796
|
+
attachComments(statement, leadingComments) {
|
|
17797
|
+
if (leadingComments !== undefined) {
|
|
17798
|
+
this.factory.attachComments(statement, leadingComments);
|
|
17799
|
+
}
|
|
17800
|
+
return statement;
|
|
17801
|
+
}
|
|
17802
|
+
getTemplateLiteralFromAst(ast, context) {
|
|
17803
|
+
return {
|
|
17804
|
+
elements: ast.elements.map((e) => createTemplateElement({
|
|
17805
|
+
cooked: e.text,
|
|
17806
|
+
raw: e.rawText,
|
|
17807
|
+
range: e.sourceSpan ?? ast.sourceSpan
|
|
17808
|
+
})),
|
|
17809
|
+
expressions: ast.expressions.map((e) => e.visitExpression(this, context))
|
|
17810
|
+
};
|
|
17811
|
+
}
|
|
17812
|
+
translateParams(params, context) {
|
|
17813
|
+
return params.map((param) => ({
|
|
17814
|
+
name: param.name,
|
|
17815
|
+
type: param.type?.visitType(this, context)
|
|
17816
|
+
}));
|
|
17817
|
+
}
|
|
17818
|
+
}
|
|
17819
|
+
function createTemplateElement({
|
|
17820
|
+
cooked,
|
|
17821
|
+
raw,
|
|
17822
|
+
range
|
|
17823
|
+
}) {
|
|
17824
|
+
return { cooked, raw, range: createRange(range) };
|
|
17825
|
+
}
|
|
17826
|
+
function createRange(span) {
|
|
17827
|
+
if (span === null) {
|
|
17828
|
+
return null;
|
|
17829
|
+
}
|
|
17830
|
+
const { start, end } = span;
|
|
17831
|
+
const { url, content } = start.file;
|
|
17832
|
+
if (!url) {
|
|
17833
|
+
return null;
|
|
17834
|
+
}
|
|
17835
|
+
return {
|
|
17836
|
+
url,
|
|
17837
|
+
content,
|
|
17838
|
+
start: { offset: start.offset, line: start.line, column: start.col },
|
|
17839
|
+
end: { offset: end.offset, line: end.line, column: end.col }
|
|
17840
|
+
};
|
|
17841
|
+
}
|
|
17842
|
+
var UNARY_OPERATORS, BINARY_OPERATORS;
|
|
17843
|
+
var init_translator = __esm(() => {
|
|
17844
|
+
UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
17845
|
+
[o.UnaryOperator.Minus, "-"],
|
|
17846
|
+
[o.UnaryOperator.Plus, "+"]
|
|
17847
|
+
]);
|
|
17848
|
+
BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
17849
|
+
[o.BinaryOperator.And, "&&"],
|
|
17850
|
+
[o.BinaryOperator.Bigger, ">"],
|
|
17851
|
+
[o.BinaryOperator.BiggerEquals, ">="],
|
|
17852
|
+
[o.BinaryOperator.BitwiseAnd, "&"],
|
|
17853
|
+
[o.BinaryOperator.BitwiseOr, "|"],
|
|
17854
|
+
[o.BinaryOperator.Divide, "/"],
|
|
17855
|
+
[o.BinaryOperator.Equals, "=="],
|
|
17856
|
+
[o.BinaryOperator.Identical, "==="],
|
|
17857
|
+
[o.BinaryOperator.Lower, "<"],
|
|
17858
|
+
[o.BinaryOperator.LowerEquals, "<="],
|
|
17859
|
+
[o.BinaryOperator.Minus, "-"],
|
|
17860
|
+
[o.BinaryOperator.Modulo, "%"],
|
|
17861
|
+
[o.BinaryOperator.Multiply, "*"],
|
|
17862
|
+
[o.BinaryOperator.NotEquals, "!="],
|
|
17863
|
+
[o.BinaryOperator.NotIdentical, "!=="],
|
|
17864
|
+
[o.BinaryOperator.Or, "||"],
|
|
17865
|
+
[o.BinaryOperator.Plus, "+"],
|
|
17866
|
+
[o.BinaryOperator.NullishCoalesce, "??"],
|
|
17867
|
+
[o.BinaryOperator.Exponentiation, "**"],
|
|
17868
|
+
[o.BinaryOperator.In, "in"],
|
|
17869
|
+
[o.BinaryOperator.InstanceOf, "instanceof"],
|
|
17870
|
+
[o.BinaryOperator.Assign, "="],
|
|
17871
|
+
[o.BinaryOperator.AdditionAssignment, "+="],
|
|
17872
|
+
[o.BinaryOperator.SubtractionAssignment, "-="],
|
|
17873
|
+
[o.BinaryOperator.MultiplicationAssignment, "*="],
|
|
17874
|
+
[o.BinaryOperator.DivisionAssignment, "/="],
|
|
17875
|
+
[o.BinaryOperator.RemainderAssignment, "%="],
|
|
17876
|
+
[o.BinaryOperator.ExponentiationAssignment, "**="],
|
|
17877
|
+
[o.BinaryOperator.AndAssignment, "&&="],
|
|
17878
|
+
[o.BinaryOperator.OrAssignment, "||="],
|
|
17879
|
+
[o.BinaryOperator.NullishCoalesceAssignment, "??="]
|
|
17880
|
+
]);
|
|
17881
|
+
});
|
|
17882
|
+
|
|
17883
|
+
// src/dev/angular/vendor/translator/ts_util.ts
|
|
17884
|
+
import ts5 from "typescript";
|
|
17885
|
+
function tsNumericExpression(value) {
|
|
17886
|
+
if (value < 0) {
|
|
17887
|
+
const operand = ts5.factory.createNumericLiteral(Math.abs(value));
|
|
17888
|
+
return ts5.factory.createPrefixUnaryExpression(ts5.SyntaxKind.MinusToken, operand);
|
|
17889
|
+
}
|
|
17890
|
+
return ts5.factory.createNumericLiteral(value);
|
|
17891
|
+
}
|
|
17892
|
+
var init_ts_util = __esm(() => {
|
|
17893
|
+
/*!
|
|
17894
|
+
* @license
|
|
17895
|
+
* Copyright Google LLC All Rights Reserved.
|
|
17896
|
+
*
|
|
17897
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
17898
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
17899
|
+
*/
|
|
17900
|
+
});
|
|
17901
|
+
|
|
17902
|
+
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
17903
|
+
import ts6 from "typescript";
|
|
17904
|
+
|
|
17905
|
+
class TypeScriptAstFactory {
|
|
17906
|
+
annotateForClosureCompiler;
|
|
17907
|
+
externalSourceFiles = new Map;
|
|
17908
|
+
UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
17909
|
+
"+": ts6.SyntaxKind.PlusToken,
|
|
17910
|
+
"-": ts6.SyntaxKind.MinusToken,
|
|
17911
|
+
"!": ts6.SyntaxKind.ExclamationToken
|
|
17912
|
+
}))();
|
|
17913
|
+
BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
17914
|
+
"&&": ts6.SyntaxKind.AmpersandAmpersandToken,
|
|
17915
|
+
">": ts6.SyntaxKind.GreaterThanToken,
|
|
17916
|
+
">=": ts6.SyntaxKind.GreaterThanEqualsToken,
|
|
17917
|
+
"&": ts6.SyntaxKind.AmpersandToken,
|
|
17918
|
+
"|": ts6.SyntaxKind.BarToken,
|
|
17919
|
+
"/": ts6.SyntaxKind.SlashToken,
|
|
17920
|
+
"==": ts6.SyntaxKind.EqualsEqualsToken,
|
|
17921
|
+
"===": ts6.SyntaxKind.EqualsEqualsEqualsToken,
|
|
17922
|
+
"<": ts6.SyntaxKind.LessThanToken,
|
|
17923
|
+
"<=": ts6.SyntaxKind.LessThanEqualsToken,
|
|
17924
|
+
"-": ts6.SyntaxKind.MinusToken,
|
|
17925
|
+
"%": ts6.SyntaxKind.PercentToken,
|
|
17926
|
+
"*": ts6.SyntaxKind.AsteriskToken,
|
|
17927
|
+
"**": ts6.SyntaxKind.AsteriskAsteriskToken,
|
|
17928
|
+
"!=": ts6.SyntaxKind.ExclamationEqualsToken,
|
|
17929
|
+
"!==": ts6.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
17930
|
+
"||": ts6.SyntaxKind.BarBarToken,
|
|
17931
|
+
"+": ts6.SyntaxKind.PlusToken,
|
|
17932
|
+
"??": ts6.SyntaxKind.QuestionQuestionToken,
|
|
17933
|
+
"=": ts6.SyntaxKind.EqualsToken,
|
|
17934
|
+
"+=": ts6.SyntaxKind.PlusEqualsToken,
|
|
17935
|
+
"-=": ts6.SyntaxKind.MinusEqualsToken,
|
|
17936
|
+
"*=": ts6.SyntaxKind.AsteriskEqualsToken,
|
|
17937
|
+
"/=": ts6.SyntaxKind.SlashEqualsToken,
|
|
17938
|
+
"%=": ts6.SyntaxKind.PercentEqualsToken,
|
|
17939
|
+
"**=": ts6.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
17940
|
+
"&&=": ts6.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
17941
|
+
"||=": ts6.SyntaxKind.BarBarEqualsToken,
|
|
17942
|
+
"??=": ts6.SyntaxKind.QuestionQuestionEqualsToken,
|
|
17943
|
+
in: ts6.SyntaxKind.InKeyword,
|
|
17944
|
+
instanceof: ts6.SyntaxKind.InstanceOfKeyword
|
|
17945
|
+
}))();
|
|
17946
|
+
VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
17947
|
+
const: ts6.NodeFlags.Const,
|
|
17948
|
+
let: ts6.NodeFlags.Let,
|
|
17949
|
+
var: ts6.NodeFlags.None
|
|
17950
|
+
}))();
|
|
17951
|
+
constructor(annotateForClosureCompiler) {
|
|
17952
|
+
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
17953
|
+
}
|
|
17954
|
+
attachComments = attachComments;
|
|
17955
|
+
createArrayLiteral = ts6.factory.createArrayLiteralExpression;
|
|
17956
|
+
createAssignment(target, operator, value) {
|
|
17957
|
+
return ts6.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
17958
|
+
}
|
|
17959
|
+
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
17960
|
+
return ts6.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
17961
|
+
}
|
|
17962
|
+
createBlock(body) {
|
|
17963
|
+
return ts6.factory.createBlock(body);
|
|
17964
|
+
}
|
|
17965
|
+
createCallExpression(callee, args, pure) {
|
|
17966
|
+
const call = ts6.factory.createCallExpression(callee, undefined, args);
|
|
17967
|
+
if (pure) {
|
|
17968
|
+
ts6.addSyntheticLeadingComment(call, ts6.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
17969
|
+
}
|
|
17970
|
+
return call;
|
|
17971
|
+
}
|
|
17972
|
+
createConditional(condition, whenTrue, whenFalse) {
|
|
17973
|
+
return ts6.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
17974
|
+
}
|
|
17975
|
+
createElementAccess = ts6.factory.createElementAccessExpression;
|
|
17976
|
+
createExpressionStatement = ts6.factory.createExpressionStatement;
|
|
17977
|
+
createDynamicImport(url) {
|
|
17978
|
+
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [typeof url === "string" ? ts6.factory.createStringLiteral(url) : url]);
|
|
17979
|
+
}
|
|
17980
|
+
createFunctionDeclaration(functionName, parameters, body) {
|
|
17981
|
+
if (!ts6.isBlock(body)) {
|
|
17982
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
17983
|
+
}
|
|
17984
|
+
return ts6.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
17985
|
+
}
|
|
17986
|
+
createFunctionExpression(functionName, parameters, body) {
|
|
17987
|
+
if (!ts6.isBlock(body)) {
|
|
17988
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
17989
|
+
}
|
|
17990
|
+
return ts6.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
17991
|
+
}
|
|
17992
|
+
createArrowFunctionExpression(parameters, body) {
|
|
17993
|
+
if (ts6.isStatement(body) && !ts6.isBlock(body)) {
|
|
17994
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
17995
|
+
}
|
|
17996
|
+
return ts6.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
17997
|
+
}
|
|
17998
|
+
createParameter(param) {
|
|
17999
|
+
return ts6.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
18000
|
+
}
|
|
18001
|
+
createIdentifier = ts6.factory.createIdentifier;
|
|
18002
|
+
createIfStatement(condition, thenStatement, elseStatement) {
|
|
18003
|
+
return ts6.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
18004
|
+
}
|
|
18005
|
+
createLiteral(value) {
|
|
18006
|
+
if (value === undefined) {
|
|
18007
|
+
return ts6.factory.createIdentifier("undefined");
|
|
18008
|
+
} else if (value === null) {
|
|
18009
|
+
return ts6.factory.createNull();
|
|
18010
|
+
} else if (typeof value === "boolean") {
|
|
18011
|
+
return value ? ts6.factory.createTrue() : ts6.factory.createFalse();
|
|
18012
|
+
} else if (typeof value === "number") {
|
|
18013
|
+
return tsNumericExpression(value);
|
|
18014
|
+
} else {
|
|
18015
|
+
return ts6.factory.createStringLiteral(value);
|
|
18016
|
+
}
|
|
18017
|
+
}
|
|
18018
|
+
createNewExpression(expression, args) {
|
|
18019
|
+
return ts6.factory.createNewExpression(expression, undefined, args);
|
|
18020
|
+
}
|
|
18021
|
+
createObjectLiteral(properties) {
|
|
18022
|
+
return ts6.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
18023
|
+
if (prop.kind === "spread") {
|
|
18024
|
+
return ts6.factory.createSpreadAssignment(prop.expression);
|
|
18025
|
+
}
|
|
18026
|
+
return ts6.factory.createPropertyAssignment(prop.quoted ? ts6.factory.createStringLiteral(prop.propertyName) : ts6.factory.createIdentifier(prop.propertyName), prop.value);
|
|
18027
|
+
}));
|
|
18028
|
+
}
|
|
18029
|
+
createParenthesizedExpression = ts6.factory.createParenthesizedExpression;
|
|
18030
|
+
createPropertyAccess = ts6.factory.createPropertyAccessExpression;
|
|
18031
|
+
createSpreadElement = ts6.factory.createSpreadElement;
|
|
18032
|
+
createReturnStatement(expression) {
|
|
18033
|
+
return ts6.factory.createReturnStatement(expression ?? undefined);
|
|
18034
|
+
}
|
|
18035
|
+
createTaggedTemplate(tag, template) {
|
|
18036
|
+
return ts6.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
18037
|
+
}
|
|
18038
|
+
createTemplateLiteral(template) {
|
|
18039
|
+
let templateLiteral;
|
|
18040
|
+
const length = template.elements.length;
|
|
18041
|
+
const head = template.elements[0];
|
|
18042
|
+
if (length === 1) {
|
|
18043
|
+
templateLiteral = ts6.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
18044
|
+
} else {
|
|
18045
|
+
const spans = [];
|
|
18046
|
+
for (let i = 1;i < length - 1; i++) {
|
|
18047
|
+
const { cooked, raw, range } = template.elements[i];
|
|
18048
|
+
const middle = createTemplateMiddle(cooked, raw);
|
|
18049
|
+
if (range !== null) {
|
|
18050
|
+
this.setSourceMapRange(middle, range);
|
|
18051
|
+
}
|
|
18052
|
+
spans.push(ts6.factory.createTemplateSpan(template.expressions[i - 1], middle));
|
|
18053
|
+
}
|
|
18054
|
+
const resolvedExpression = template.expressions[length - 2];
|
|
18055
|
+
const templatePart = template.elements[length - 1];
|
|
18056
|
+
const templateTail = createTemplateTail(templatePart.cooked, templatePart.raw);
|
|
18057
|
+
if (templatePart.range !== null) {
|
|
18058
|
+
this.setSourceMapRange(templateTail, templatePart.range);
|
|
18059
|
+
}
|
|
18060
|
+
spans.push(ts6.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
18061
|
+
templateLiteral = ts6.factory.createTemplateExpression(ts6.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
18062
|
+
}
|
|
18063
|
+
if (head.range !== null) {
|
|
18064
|
+
this.setSourceMapRange(templateLiteral, head.range);
|
|
18065
|
+
}
|
|
18066
|
+
return templateLiteral;
|
|
18067
|
+
}
|
|
18068
|
+
createThrowStatement = ts6.factory.createThrowStatement;
|
|
18069
|
+
createTypeOfExpression = ts6.factory.createTypeOfExpression;
|
|
18070
|
+
createVoidExpression = ts6.factory.createVoidExpression;
|
|
18071
|
+
createUnaryExpression(operator, operand) {
|
|
18072
|
+
return ts6.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
18073
|
+
}
|
|
18074
|
+
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
18075
|
+
return ts6.factory.createVariableStatement(undefined, ts6.factory.createVariableDeclarationList([
|
|
18076
|
+
ts6.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
18077
|
+
], this.VAR_TYPES[variableType]));
|
|
18078
|
+
}
|
|
18079
|
+
createRegularExpressionLiteral(body, flags) {
|
|
18080
|
+
return ts6.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
18081
|
+
}
|
|
18082
|
+
setSourceMapRange(node, sourceMapRange) {
|
|
18083
|
+
if (sourceMapRange === null) {
|
|
18084
|
+
return node;
|
|
18085
|
+
}
|
|
18086
|
+
const url = sourceMapRange.url;
|
|
18087
|
+
if (!this.externalSourceFiles.has(url)) {
|
|
18088
|
+
this.externalSourceFiles.set(url, ts6.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
18089
|
+
}
|
|
18090
|
+
const source = this.externalSourceFiles.get(url);
|
|
18091
|
+
ts6.setSourceMapRange(node, {
|
|
18092
|
+
pos: sourceMapRange.start.offset,
|
|
18093
|
+
end: sourceMapRange.end.offset,
|
|
18094
|
+
source
|
|
18095
|
+
});
|
|
18096
|
+
return node;
|
|
18097
|
+
}
|
|
18098
|
+
createBuiltInType(type) {
|
|
18099
|
+
switch (type) {
|
|
18100
|
+
case "any":
|
|
18101
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.AnyKeyword);
|
|
18102
|
+
case "boolean":
|
|
18103
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.BooleanKeyword);
|
|
18104
|
+
case "number":
|
|
18105
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.NumberKeyword);
|
|
18106
|
+
case "string":
|
|
18107
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.StringKeyword);
|
|
18108
|
+
case "function":
|
|
18109
|
+
return ts6.factory.createTypeReferenceNode(ts6.factory.createIdentifier("Function"));
|
|
18110
|
+
case "never":
|
|
18111
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.NeverKeyword);
|
|
18112
|
+
case "unknown":
|
|
18113
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.UnknownKeyword);
|
|
18114
|
+
}
|
|
18115
|
+
}
|
|
18116
|
+
createExpressionType(expression, typeParams) {
|
|
18117
|
+
const typeName = getEntityTypeFromExpression(expression);
|
|
18118
|
+
return ts6.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
18119
|
+
}
|
|
18120
|
+
createArrayType(elementType) {
|
|
18121
|
+
return ts6.factory.createArrayTypeNode(elementType);
|
|
18122
|
+
}
|
|
18123
|
+
createMapType(valueType) {
|
|
18124
|
+
return ts6.factory.createTypeLiteralNode([
|
|
18125
|
+
ts6.factory.createIndexSignature(undefined, [
|
|
18126
|
+
ts6.factory.createParameterDeclaration(undefined, undefined, "key", undefined, ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.StringKeyword))
|
|
18127
|
+
], valueType)
|
|
18128
|
+
]);
|
|
18129
|
+
}
|
|
18130
|
+
transplantType(type) {
|
|
18131
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts6.isTypeNode(type)) {
|
|
18132
|
+
return type;
|
|
18133
|
+
}
|
|
18134
|
+
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
18135
|
+
}
|
|
18136
|
+
}
|
|
18137
|
+
function createTemplateMiddle(cooked, raw) {
|
|
18138
|
+
const node = ts6.factory.createTemplateHead(cooked, raw);
|
|
18139
|
+
node.kind = ts6.SyntaxKind.TemplateMiddle;
|
|
18140
|
+
return node;
|
|
18141
|
+
}
|
|
18142
|
+
function createTemplateTail(cooked, raw) {
|
|
18143
|
+
const node = ts6.factory.createTemplateHead(cooked, raw);
|
|
18144
|
+
node.kind = ts6.SyntaxKind.TemplateTail;
|
|
18145
|
+
return node;
|
|
18146
|
+
}
|
|
18147
|
+
function attachComments(statement, leadingComments) {
|
|
18148
|
+
for (const comment of leadingComments) {
|
|
18149
|
+
const commentKind = comment.multiline ? ts6.SyntaxKind.MultiLineCommentTrivia : ts6.SyntaxKind.SingleLineCommentTrivia;
|
|
18150
|
+
if (comment.multiline) {
|
|
18151
|
+
ts6.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
18152
|
+
} else {
|
|
18153
|
+
for (const line of comment.toString().split(`
|
|
18154
|
+
`)) {
|
|
18155
|
+
ts6.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
18156
|
+
}
|
|
18157
|
+
}
|
|
18158
|
+
}
|
|
18159
|
+
}
|
|
18160
|
+
function getEntityTypeFromExpression(expression) {
|
|
18161
|
+
if (ts6.isIdentifier(expression)) {
|
|
18162
|
+
return expression;
|
|
18163
|
+
}
|
|
18164
|
+
if (ts6.isPropertyAccessExpression(expression)) {
|
|
18165
|
+
const left = getEntityTypeFromExpression(expression.expression);
|
|
18166
|
+
if (!ts6.isIdentifier(expression.name)) {
|
|
18167
|
+
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
18168
|
+
}
|
|
18169
|
+
return ts6.factory.createQualifiedName(left, expression.name);
|
|
18170
|
+
}
|
|
18171
|
+
throw new Error(`Unsupported expression for type reference: ${ts6.SyntaxKind[expression.kind]}`);
|
|
18172
|
+
}
|
|
18173
|
+
var init_typescript_ast_factory = __esm(() => {
|
|
18174
|
+
init_ts_util();
|
|
18175
|
+
});
|
|
18176
|
+
|
|
18177
|
+
// src/dev/angular/vendor/translator/typescript_translator.ts
|
|
18178
|
+
function translateStatement(contextFile, statement, imports, options = {}) {
|
|
18179
|
+
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, contextFile, options), new Context(true));
|
|
18180
|
+
}
|
|
18181
|
+
var init_typescript_translator = __esm(() => {
|
|
18182
|
+
init_translator();
|
|
18183
|
+
init_typescript_ast_factory();
|
|
18184
|
+
});
|
|
18185
|
+
|
|
18186
|
+
// src/dev/angular/fastHmrCompiler.ts
|
|
18187
|
+
var exports_fastHmrCompiler = {};
|
|
18188
|
+
__export(exports_fastHmrCompiler, {
|
|
18189
|
+
tryFastHmr: () => tryFastHmr,
|
|
18190
|
+
recordFingerprint: () => recordFingerprint,
|
|
18191
|
+
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
18192
|
+
});
|
|
18193
|
+
import { existsSync as existsSync25, readFileSync as readFileSync19 } from "fs";
|
|
18194
|
+
import { dirname as dirname18, relative as relative13, resolve as resolve31 } from "path";
|
|
18195
|
+
import ts7 from "typescript";
|
|
18196
|
+
var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, fingerprintsEqual = (a, b2) => {
|
|
18197
|
+
if (a.className !== b2.className)
|
|
18198
|
+
return false;
|
|
18199
|
+
if (a.selector !== b2.selector)
|
|
18200
|
+
return false;
|
|
18201
|
+
if (a.standalone !== b2.standalone)
|
|
18202
|
+
return false;
|
|
18203
|
+
if (a.importsArity !== b2.importsArity)
|
|
18204
|
+
return false;
|
|
18205
|
+
if (a.hasProviders !== b2.hasProviders)
|
|
18206
|
+
return false;
|
|
18207
|
+
if (a.hasViewProviders !== b2.hasViewProviders)
|
|
18208
|
+
return false;
|
|
18209
|
+
if (a.ctorParamTypes.length !== b2.ctorParamTypes.length)
|
|
18210
|
+
return false;
|
|
18211
|
+
for (let i = 0;i < a.ctorParamTypes.length; i++) {
|
|
18212
|
+
if (a.ctorParamTypes[i] !== b2.ctorParamTypes[i])
|
|
18213
|
+
return false;
|
|
18214
|
+
}
|
|
18215
|
+
if (a.inputs.length !== b2.inputs.length)
|
|
18216
|
+
return false;
|
|
18217
|
+
for (let i = 0;i < a.inputs.length; i++) {
|
|
18218
|
+
if (a.inputs[i] !== b2.inputs[i])
|
|
18219
|
+
return false;
|
|
18220
|
+
}
|
|
18221
|
+
if (a.outputs.length !== b2.outputs.length)
|
|
18222
|
+
return false;
|
|
18223
|
+
for (let i = 0;i < a.outputs.length; i++) {
|
|
18224
|
+
if (a.outputs[i] !== b2.outputs[i])
|
|
18225
|
+
return false;
|
|
18226
|
+
}
|
|
18227
|
+
return true;
|
|
18228
|
+
}, recordFingerprint = (id, fp) => {
|
|
18229
|
+
fingerprintCache.set(id, fp);
|
|
18230
|
+
}, invalidateFingerprintCache = () => {
|
|
18231
|
+
fingerprintCache.clear();
|
|
18232
|
+
}, findClassDeclaration = (sourceFile, className) => {
|
|
18233
|
+
let found = null;
|
|
18234
|
+
const walk = (node) => {
|
|
18235
|
+
if (found)
|
|
18236
|
+
return;
|
|
18237
|
+
if (ts7.isClassDeclaration(node) && node.name?.text === className) {
|
|
18238
|
+
found = node;
|
|
18239
|
+
return;
|
|
18240
|
+
}
|
|
18241
|
+
ts7.forEachChild(node, walk);
|
|
18242
|
+
};
|
|
18243
|
+
walk(sourceFile);
|
|
18244
|
+
return found;
|
|
18245
|
+
}, getClassDecorators = (cls) => {
|
|
18246
|
+
const modifiers = ts7.getDecorators(cls) ?? [];
|
|
18247
|
+
return [...modifiers];
|
|
18248
|
+
}, findComponentDecorator = (cls) => {
|
|
18249
|
+
for (const decorator of getClassDecorators(cls)) {
|
|
18250
|
+
const expr = decorator.expression;
|
|
18251
|
+
if (ts7.isCallExpression(expr)) {
|
|
18252
|
+
const fn2 = expr.expression;
|
|
18253
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "Component") {
|
|
18254
|
+
return decorator;
|
|
18255
|
+
}
|
|
18256
|
+
}
|
|
18257
|
+
}
|
|
18258
|
+
return null;
|
|
18259
|
+
}, getDecoratorArgsObject = (decorator) => {
|
|
18260
|
+
const call = decorator.expression;
|
|
18261
|
+
if (!ts7.isCallExpression(call))
|
|
18262
|
+
return null;
|
|
18263
|
+
const arg = call.arguments[0];
|
|
18264
|
+
if (!arg || !ts7.isObjectLiteralExpression(arg))
|
|
18265
|
+
return null;
|
|
18266
|
+
return arg;
|
|
18267
|
+
}, getProperty = (obj, name) => {
|
|
18268
|
+
for (const prop of obj.properties) {
|
|
18269
|
+
if (ts7.isPropertyAssignment(prop) && (ts7.isIdentifier(prop.name) && prop.name.text === name || ts7.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
18270
|
+
return prop.initializer;
|
|
18271
|
+
}
|
|
18272
|
+
}
|
|
18273
|
+
return null;
|
|
18274
|
+
}, getStringProperty = (obj, name) => {
|
|
18275
|
+
const expr = getProperty(obj, name);
|
|
18276
|
+
if (!expr)
|
|
18277
|
+
return null;
|
|
18278
|
+
if (ts7.isStringLiteral(expr) || ts7.isNoSubstitutionTemplateLiteral(expr)) {
|
|
18279
|
+
return expr.text;
|
|
18280
|
+
}
|
|
18281
|
+
return null;
|
|
18282
|
+
}, getBooleanProperty = (obj, name) => {
|
|
18283
|
+
const expr = getProperty(obj, name);
|
|
18284
|
+
if (!expr)
|
|
18285
|
+
return null;
|
|
18286
|
+
if (expr.kind === ts7.SyntaxKind.TrueKeyword)
|
|
18287
|
+
return true;
|
|
18288
|
+
if (expr.kind === ts7.SyntaxKind.FalseKeyword)
|
|
18289
|
+
return false;
|
|
18290
|
+
return null;
|
|
18291
|
+
}, inheritsDecoratedClass = (cls) => {
|
|
18292
|
+
const heritage = cls.heritageClauses ?? [];
|
|
18293
|
+
for (const clause of heritage) {
|
|
18294
|
+
if (clause.token !== ts7.SyntaxKind.ExtendsKeyword)
|
|
18295
|
+
continue;
|
|
18296
|
+
if (clause.types.length > 0)
|
|
18297
|
+
return true;
|
|
18298
|
+
}
|
|
18299
|
+
return false;
|
|
18300
|
+
}, readDecoratorMeta = (args) => {
|
|
18301
|
+
const styleUrlsExpr = getProperty(args, "styleUrls");
|
|
18302
|
+
const stylesExpr = getProperty(args, "styles");
|
|
18303
|
+
const importsExpr = getProperty(args, "imports");
|
|
18304
|
+
const styleUrls = [];
|
|
18305
|
+
if (styleUrlsExpr && ts7.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
18306
|
+
for (const el of styleUrlsExpr.elements) {
|
|
18307
|
+
if (ts7.isStringLiteral(el))
|
|
18308
|
+
styleUrls.push(el.text);
|
|
18309
|
+
}
|
|
18310
|
+
}
|
|
18311
|
+
const styles = [];
|
|
18312
|
+
if (stylesExpr) {
|
|
18313
|
+
if (ts7.isArrayLiteralExpression(stylesExpr)) {
|
|
18314
|
+
for (const el of stylesExpr.elements) {
|
|
18315
|
+
if (ts7.isStringLiteral(el) || ts7.isNoSubstitutionTemplateLiteral(el)) {
|
|
18316
|
+
styles.push(el.text);
|
|
18317
|
+
}
|
|
18318
|
+
}
|
|
18319
|
+
} else if (ts7.isStringLiteral(stylesExpr) || ts7.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
18320
|
+
styles.push(stylesExpr.text);
|
|
18321
|
+
}
|
|
18322
|
+
}
|
|
18323
|
+
return {
|
|
18324
|
+
hasProviders: getProperty(args, "providers") !== null,
|
|
18325
|
+
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
18326
|
+
importsExpr: importsExpr && ts7.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
|
|
18327
|
+
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? false,
|
|
18328
|
+
selector: getStringProperty(args, "selector"),
|
|
18329
|
+
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
18330
|
+
styleUrl: getStringProperty(args, "styleUrl"),
|
|
18331
|
+
styleUrls,
|
|
18332
|
+
styles,
|
|
18333
|
+
template: getStringProperty(args, "template"),
|
|
18334
|
+
templateUrl: getStringProperty(args, "templateUrl")
|
|
18335
|
+
};
|
|
18336
|
+
}, extractDecoratorInput = (prop) => {
|
|
18337
|
+
const decorators = ts7.getDecorators(prop) ?? [];
|
|
18338
|
+
for (const decorator of decorators) {
|
|
18339
|
+
const expr = decorator.expression;
|
|
18340
|
+
if (!ts7.isCallExpression(expr))
|
|
18341
|
+
continue;
|
|
18342
|
+
const fn2 = expr.expression;
|
|
18343
|
+
if (!ts7.isIdentifier(fn2) || fn2.text !== "Input")
|
|
18344
|
+
continue;
|
|
18345
|
+
const classPropertyName = prop.name.getText();
|
|
18346
|
+
let bindingPropertyName = classPropertyName;
|
|
18347
|
+
let required = false;
|
|
18348
|
+
const arg = expr.arguments[0];
|
|
18349
|
+
if (arg) {
|
|
18350
|
+
if (ts7.isStringLiteral(arg)) {
|
|
18351
|
+
bindingPropertyName = arg.text;
|
|
18352
|
+
} else if (ts7.isObjectLiteralExpression(arg)) {
|
|
18353
|
+
const aliasNode = getStringProperty(arg, "alias");
|
|
18354
|
+
if (aliasNode !== null)
|
|
18355
|
+
bindingPropertyName = aliasNode;
|
|
18356
|
+
required = getBooleanProperty(arg, "required") ?? false;
|
|
18357
|
+
}
|
|
18358
|
+
}
|
|
18359
|
+
return {
|
|
18360
|
+
classPropertyName,
|
|
18361
|
+
meta: {
|
|
18362
|
+
classPropertyName,
|
|
18363
|
+
bindingPropertyName,
|
|
18364
|
+
required,
|
|
18365
|
+
isSignal: false,
|
|
18366
|
+
transformFunction: null
|
|
18367
|
+
}
|
|
18368
|
+
};
|
|
18369
|
+
}
|
|
18370
|
+
return null;
|
|
18371
|
+
}, isInputSignalCall = (init) => {
|
|
18372
|
+
if (ts7.isCallExpression(init)) {
|
|
18373
|
+
const fn2 = init.expression;
|
|
18374
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "input")
|
|
18375
|
+
return true;
|
|
18376
|
+
if (ts7.isPropertyAccessExpression(fn2) && ts7.isIdentifier(fn2.expression) && fn2.expression.text === "input") {
|
|
18377
|
+
return true;
|
|
18378
|
+
}
|
|
18379
|
+
}
|
|
18380
|
+
return false;
|
|
18381
|
+
}, extractSignalInput = (prop) => {
|
|
18382
|
+
if (!prop.initializer || !isInputSignalCall(prop.initializer))
|
|
18383
|
+
return null;
|
|
18384
|
+
const classPropertyName = prop.name.getText();
|
|
18385
|
+
const call = prop.initializer;
|
|
18386
|
+
let required = false;
|
|
18387
|
+
if (ts7.isPropertyAccessExpression(call.expression) && ts7.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
18388
|
+
required = true;
|
|
18389
|
+
}
|
|
18390
|
+
let bindingPropertyName = classPropertyName;
|
|
18391
|
+
const optsArg = call.arguments[required ? 0 : 1];
|
|
18392
|
+
if (optsArg && ts7.isObjectLiteralExpression(optsArg)) {
|
|
18393
|
+
const aliasNode = getStringProperty(optsArg, "alias");
|
|
18394
|
+
if (aliasNode !== null)
|
|
18395
|
+
bindingPropertyName = aliasNode;
|
|
18396
|
+
}
|
|
18397
|
+
return {
|
|
18398
|
+
classPropertyName,
|
|
18399
|
+
meta: {
|
|
18400
|
+
classPropertyName,
|
|
18401
|
+
bindingPropertyName,
|
|
18402
|
+
required,
|
|
18403
|
+
isSignal: true,
|
|
18404
|
+
transformFunction: null
|
|
18405
|
+
}
|
|
18406
|
+
};
|
|
18407
|
+
}, extractDecoratorOutput = (prop) => {
|
|
18408
|
+
const decorators = ts7.getDecorators(prop) ?? [];
|
|
18409
|
+
for (const decorator of decorators) {
|
|
18410
|
+
const expr = decorator.expression;
|
|
18411
|
+
if (!ts7.isCallExpression(expr))
|
|
18412
|
+
continue;
|
|
18413
|
+
const fn2 = expr.expression;
|
|
18414
|
+
if (!ts7.isIdentifier(fn2) || fn2.text !== "Output")
|
|
18415
|
+
continue;
|
|
18416
|
+
const classPropertyName = prop.name.getText();
|
|
18417
|
+
let bindingName = classPropertyName;
|
|
18418
|
+
const arg = expr.arguments[0];
|
|
18419
|
+
if (arg && ts7.isStringLiteral(arg))
|
|
18420
|
+
bindingName = arg.text;
|
|
18421
|
+
return { classPropertyName, bindingName };
|
|
18422
|
+
}
|
|
18423
|
+
return null;
|
|
18424
|
+
}, isOutputSignalCall = (init) => {
|
|
18425
|
+
if (ts7.isCallExpression(init)) {
|
|
18426
|
+
const fn2 = init.expression;
|
|
18427
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "output")
|
|
18428
|
+
return true;
|
|
18429
|
+
if (ts7.isPropertyAccessExpression(fn2) && ts7.isIdentifier(fn2.expression) && fn2.expression.text === "output") {
|
|
18430
|
+
return true;
|
|
18431
|
+
}
|
|
18432
|
+
}
|
|
18433
|
+
return false;
|
|
18434
|
+
}, extractSignalOutput = (prop) => {
|
|
18435
|
+
if (!prop.initializer || !isOutputSignalCall(prop.initializer))
|
|
18436
|
+
return null;
|
|
18437
|
+
const classPropertyName = prop.name.getText();
|
|
18438
|
+
const call = prop.initializer;
|
|
18439
|
+
let bindingName = classPropertyName;
|
|
18440
|
+
const optsArg = call.arguments[0];
|
|
18441
|
+
if (optsArg && ts7.isObjectLiteralExpression(optsArg)) {
|
|
18442
|
+
const aliasNode = getStringProperty(optsArg, "alias");
|
|
18443
|
+
if (aliasNode !== null)
|
|
18444
|
+
bindingName = aliasNode;
|
|
18445
|
+
}
|
|
18446
|
+
return { classPropertyName, bindingName };
|
|
18447
|
+
}, extractInputsAndOutputs = (cls) => {
|
|
18448
|
+
const inputs = {};
|
|
18449
|
+
const outputs = {};
|
|
18450
|
+
for (const member of cls.members) {
|
|
18451
|
+
if (!ts7.isPropertyDeclaration(member))
|
|
18452
|
+
continue;
|
|
18453
|
+
const decoratorIn = extractDecoratorInput(member);
|
|
18454
|
+
if (decoratorIn) {
|
|
18455
|
+
inputs[decoratorIn.classPropertyName] = decoratorIn.meta;
|
|
18456
|
+
continue;
|
|
18457
|
+
}
|
|
18458
|
+
const signalIn = extractSignalInput(member);
|
|
18459
|
+
if (signalIn) {
|
|
18460
|
+
inputs[signalIn.classPropertyName] = signalIn.meta;
|
|
18461
|
+
continue;
|
|
18462
|
+
}
|
|
18463
|
+
const decoratorOut = extractDecoratorOutput(member);
|
|
18464
|
+
if (decoratorOut) {
|
|
18465
|
+
outputs[decoratorOut.classPropertyName] = decoratorOut.bindingName;
|
|
18466
|
+
continue;
|
|
18467
|
+
}
|
|
18468
|
+
const signalOut = extractSignalOutput(member);
|
|
18469
|
+
if (signalOut) {
|
|
18470
|
+
outputs[signalOut.classPropertyName] = signalOut.bindingName;
|
|
18471
|
+
}
|
|
18472
|
+
}
|
|
18473
|
+
return { inputs, outputs };
|
|
18474
|
+
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs) => {
|
|
18475
|
+
const ctorParamTypes = [];
|
|
18476
|
+
for (const member of cls.members) {
|
|
18477
|
+
if (!ts7.isConstructorDeclaration(member))
|
|
18478
|
+
continue;
|
|
18479
|
+
for (const param of member.parameters) {
|
|
18480
|
+
ctorParamTypes.push(param.type ? param.type.getText() : "");
|
|
18481
|
+
}
|
|
18482
|
+
break;
|
|
18483
|
+
}
|
|
18484
|
+
const inputNames = Object.keys(inputs).sort();
|
|
18485
|
+
const outputNames = Object.keys(outputs).sort();
|
|
18486
|
+
const importsArity = decoratorMeta.importsExpr ? decoratorMeta.importsExpr.elements.length : 0;
|
|
18487
|
+
const hasProviders = decoratorMeta.hasProviders;
|
|
18488
|
+
const hasViewProviders = decoratorMeta.hasViewProviders;
|
|
18489
|
+
return {
|
|
18490
|
+
className,
|
|
18491
|
+
ctorParamTypes,
|
|
18492
|
+
hasProviders,
|
|
18493
|
+
hasViewProviders,
|
|
18494
|
+
importsArity,
|
|
18495
|
+
inputs: inputNames,
|
|
18496
|
+
outputs: outputNames,
|
|
18497
|
+
selector: decoratorMeta.selector,
|
|
18498
|
+
standalone: decoratorMeta.standalone
|
|
18499
|
+
};
|
|
18500
|
+
}, resolveAndReadResource = (componentDir, url) => {
|
|
18501
|
+
const abs = resolve31(componentDir, url);
|
|
18502
|
+
if (!existsSync25(abs))
|
|
18503
|
+
return null;
|
|
18504
|
+
return readFileSync19(abs, "utf8");
|
|
18505
|
+
}, collectStyles = (decoratorMeta, componentDir) => {
|
|
18506
|
+
const styles = [...decoratorMeta.styles];
|
|
18507
|
+
const urls = [];
|
|
18508
|
+
if (decoratorMeta.styleUrl)
|
|
18509
|
+
urls.push(decoratorMeta.styleUrl);
|
|
18510
|
+
urls.push(...decoratorMeta.styleUrls);
|
|
18511
|
+
for (const url of urls) {
|
|
18512
|
+
const css = resolveAndReadResource(componentDir, url);
|
|
18513
|
+
if (css === null)
|
|
18514
|
+
return { styles, missing: url };
|
|
18515
|
+
styles.push(css);
|
|
18516
|
+
}
|
|
18517
|
+
return { styles, missing: null };
|
|
18518
|
+
}, tryFastHmr = async (params) => {
|
|
18519
|
+
const { componentFilePath, className } = params;
|
|
18520
|
+
const projectRoot = params.projectRoot ?? process.cwd();
|
|
18521
|
+
if (!existsSync25(componentFilePath)) {
|
|
18522
|
+
return fail("file-not-found", componentFilePath);
|
|
18523
|
+
}
|
|
18524
|
+
let compiler;
|
|
18525
|
+
try {
|
|
18526
|
+
compiler = await import("@angular/compiler");
|
|
18527
|
+
} catch (err) {
|
|
18528
|
+
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
18529
|
+
}
|
|
18530
|
+
const tsSource = readFileSync19(componentFilePath, "utf8");
|
|
18531
|
+
const sourceFile = ts7.createSourceFile(componentFilePath, tsSource, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
18532
|
+
const classNode = findClassDeclaration(sourceFile, className);
|
|
18533
|
+
if (!classNode) {
|
|
18534
|
+
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
18535
|
+
}
|
|
18536
|
+
if (inheritsDecoratedClass(classNode)) {
|
|
18537
|
+
return fail("inherits-decorated-class");
|
|
18538
|
+
}
|
|
18539
|
+
const decorator = findComponentDecorator(classNode);
|
|
18540
|
+
if (!decorator)
|
|
18541
|
+
return fail("no-component-decorator");
|
|
18542
|
+
const decoratorArgs = getDecoratorArgsObject(decorator);
|
|
18543
|
+
if (!decoratorArgs)
|
|
18544
|
+
return fail("unsupported-decorator-args");
|
|
18545
|
+
const decoratorMeta = readDecoratorMeta(decoratorArgs);
|
|
18546
|
+
if (!decoratorMeta.standalone)
|
|
18547
|
+
return fail("not-standalone");
|
|
18548
|
+
const componentDir = dirname18(componentFilePath);
|
|
18549
|
+
let templateText;
|
|
18550
|
+
let templatePath;
|
|
18551
|
+
if (decoratorMeta.template !== null) {
|
|
18552
|
+
templateText = decoratorMeta.template;
|
|
18553
|
+
templatePath = componentFilePath;
|
|
18554
|
+
} else if (decoratorMeta.templateUrl) {
|
|
18555
|
+
const tplAbs = resolve31(componentDir, decoratorMeta.templateUrl);
|
|
18556
|
+
if (!existsSync25(tplAbs)) {
|
|
18557
|
+
return fail("template-resource-not-found", tplAbs);
|
|
18558
|
+
}
|
|
18559
|
+
templateText = readFileSync19(tplAbs, "utf8");
|
|
18560
|
+
templatePath = tplAbs;
|
|
18561
|
+
} else {
|
|
18562
|
+
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
18563
|
+
}
|
|
18564
|
+
const { styles, missing: missingStyle } = collectStyles(decoratorMeta, componentDir);
|
|
18565
|
+
if (missingStyle) {
|
|
18566
|
+
return fail("style-resource-not-found", missingStyle);
|
|
18567
|
+
}
|
|
18568
|
+
let parsed;
|
|
18569
|
+
try {
|
|
18570
|
+
parsed = compiler.parseTemplate(templateText, templatePath, {
|
|
18571
|
+
preserveWhitespaces: decoratorMeta.preserveWhitespaces
|
|
18572
|
+
});
|
|
18573
|
+
} catch (err) {
|
|
18574
|
+
return fail("template-parse-error", String(err));
|
|
18575
|
+
}
|
|
18576
|
+
if (parsed.errors && parsed.errors.length > 0) {
|
|
18577
|
+
return fail("template-parse-error", parsed.errors.map((e) => e.toString()).join(`
|
|
18578
|
+
`));
|
|
18579
|
+
}
|
|
18580
|
+
const className_ = classNode.name;
|
|
18581
|
+
if (!className_)
|
|
18582
|
+
return fail("class-not-found", "anonymous class");
|
|
18583
|
+
const wrappedClass = new compiler.WrappedNodeExpr(className_);
|
|
18584
|
+
const { inputs, outputs } = extractInputsAndOutputs(classNode);
|
|
18585
|
+
const projectRelPath = relative13(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
18586
|
+
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
18587
|
+
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs);
|
|
18588
|
+
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
18589
|
+
if (cachedFingerprint && !fingerprintsEqual(cachedFingerprint, currentFingerprint)) {
|
|
18590
|
+
return fail("structural-change", `fingerprint changed for ${className}; escalate to Tier 1`);
|
|
18591
|
+
}
|
|
18592
|
+
const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
|
|
18593
|
+
const zeroLoc = new compiler.ParseLocation(sourceFileObj, 0, 0, 0);
|
|
18594
|
+
const typeSourceSpan = new compiler.ParseSourceSpan(zeroLoc, zeroLoc);
|
|
18595
|
+
const importsArray = [];
|
|
18596
|
+
if (decoratorMeta.importsExpr) {
|
|
18597
|
+
for (const el of decoratorMeta.importsExpr.elements) {
|
|
18598
|
+
importsArray.push(new compiler.WrappedNodeExpr(el));
|
|
18599
|
+
}
|
|
18600
|
+
}
|
|
18601
|
+
const declarations = importsArray.map((expr) => ({
|
|
18602
|
+
kind: 0,
|
|
18603
|
+
type: expr,
|
|
18604
|
+
selector: "",
|
|
18605
|
+
inputs: [],
|
|
18606
|
+
outputs: [],
|
|
18607
|
+
exportAs: null,
|
|
18608
|
+
isComponent: false
|
|
18609
|
+
}));
|
|
18610
|
+
const meta = {
|
|
18611
|
+
name: className,
|
|
18612
|
+
type: { value: wrappedClass, type: wrappedClass },
|
|
18613
|
+
typeArgumentCount: 0,
|
|
18614
|
+
typeSourceSpan,
|
|
18615
|
+
deps: null,
|
|
18616
|
+
selector: decoratorMeta.selector,
|
|
18617
|
+
queries: [],
|
|
18618
|
+
viewQueries: [],
|
|
18619
|
+
host: {
|
|
18620
|
+
attributes: {},
|
|
18621
|
+
listeners: {},
|
|
18622
|
+
properties: {},
|
|
18623
|
+
specialAttributes: {}
|
|
18624
|
+
},
|
|
18625
|
+
lifecycle: { usesOnChanges: false },
|
|
18626
|
+
inputs,
|
|
18627
|
+
outputs,
|
|
18628
|
+
usesInheritance: false,
|
|
18629
|
+
controlCreate: null,
|
|
18630
|
+
exportAs: null,
|
|
18631
|
+
providers: null,
|
|
18632
|
+
isStandalone: true,
|
|
18633
|
+
isSignal: false,
|
|
18634
|
+
hostDirectives: null,
|
|
18635
|
+
template: {
|
|
18636
|
+
nodes: parsed.nodes,
|
|
18637
|
+
ngContentSelectors: parsed.ngContentSelectors ?? [],
|
|
18638
|
+
preserveWhitespaces: decoratorMeta.preserveWhitespaces
|
|
18639
|
+
},
|
|
18640
|
+
declarations,
|
|
18641
|
+
defer: { mode: 0, blocks: new Map },
|
|
18642
|
+
declarationListEmitMode: 0,
|
|
18643
|
+
styles,
|
|
18644
|
+
encapsulation: 0,
|
|
18645
|
+
animations: null,
|
|
18646
|
+
viewProviders: null,
|
|
18647
|
+
relativeContextFilePath: projectRelPath,
|
|
18648
|
+
i18nUseExternalIds: false,
|
|
18649
|
+
changeDetection: null,
|
|
18650
|
+
relativeTemplatePath: null,
|
|
18651
|
+
hasDirectiveDependencies: importsArray.length > 0
|
|
18652
|
+
};
|
|
18653
|
+
let compiled;
|
|
18654
|
+
try {
|
|
18655
|
+
const pool = new compiler.ConstantPool;
|
|
18656
|
+
const bindingParser = compiler.makeBindingParser();
|
|
18657
|
+
compiled = compiler.compileComponentFromMetadata(meta, pool, bindingParser);
|
|
18658
|
+
const namespaceDependencies = [
|
|
18659
|
+
{ moduleName: "@angular/core", assignedName: "\u0275hmr0" }
|
|
18660
|
+
];
|
|
18661
|
+
const callback = compiler.compileHmrUpdateCallback([
|
|
18662
|
+
{
|
|
18663
|
+
name: "\u0275cmp",
|
|
18664
|
+
initializer: compiled.expression,
|
|
18665
|
+
statements: compiled.statements ?? []
|
|
18666
|
+
}
|
|
18667
|
+
], pool.statements, {
|
|
18668
|
+
type: wrappedClass,
|
|
18669
|
+
className,
|
|
18670
|
+
filePath: projectRelPath,
|
|
18671
|
+
namespaceDependencies,
|
|
18672
|
+
localDependencies: []
|
|
18673
|
+
});
|
|
18674
|
+
const namespaceMap = new Map;
|
|
18675
|
+
for (const dep of namespaceDependencies) {
|
|
18676
|
+
namespaceMap.set(dep.moduleName, dep.assignedName);
|
|
18677
|
+
}
|
|
18678
|
+
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
18679
|
+
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
18680
|
+
const exportedDecl = ts7.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
18681
|
+
ts7.factory.createToken(ts7.SyntaxKind.ExportKeyword),
|
|
18682
|
+
ts7.factory.createToken(ts7.SyntaxKind.DefaultKeyword)
|
|
18683
|
+
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
18684
|
+
const printer = ts7.createPrinter({
|
|
18685
|
+
newLine: ts7.NewLineKind.LineFeed,
|
|
18686
|
+
removeComments: false
|
|
18687
|
+
});
|
|
18688
|
+
const tsSourceText = printer.printNode(ts7.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
18689
|
+
const moduleText = ts7.transpileModule(tsSourceText, {
|
|
18690
|
+
compilerOptions: {
|
|
18691
|
+
module: ts7.ModuleKind.ES2022,
|
|
18692
|
+
target: ts7.ScriptTarget.ES2022
|
|
18693
|
+
},
|
|
18694
|
+
fileName: componentFilePath,
|
|
18695
|
+
reportDiagnostics: false
|
|
18696
|
+
}).outputText;
|
|
18697
|
+
fingerprintCache.set(fingerprintId, currentFingerprint);
|
|
18698
|
+
return { ok: true, moduleText, componentSource: sourceFile };
|
|
18699
|
+
} catch (err) {
|
|
18700
|
+
return fail("unexpected-error", String(err));
|
|
18701
|
+
}
|
|
18702
|
+
};
|
|
18703
|
+
var init_fastHmrCompiler = __esm(() => {
|
|
18704
|
+
init_hmrImportGenerator();
|
|
18705
|
+
init_typescript_translator();
|
|
18706
|
+
fingerprintCache = new Map;
|
|
18707
|
+
});
|
|
18708
|
+
|
|
18709
|
+
// src/dev/angular/hmrCompiler.ts
|
|
18710
|
+
var exports_hmrCompiler = {};
|
|
18711
|
+
__export(exports_hmrCompiler, {
|
|
18712
|
+
getCachedHmrProgram: () => getCachedHmrProgram,
|
|
18713
|
+
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
18714
|
+
findClassNodeById: () => findClassNodeById,
|
|
18715
|
+
encodeHmrComponentId: () => encodeHmrComponentId,
|
|
18716
|
+
compileAngularForHmr: () => compileAngularForHmr
|
|
18717
|
+
});
|
|
18718
|
+
import { existsSync as existsSync26 } from "fs";
|
|
18719
|
+
import { basename as basename11, dirname as dirname19, join as join29, relative as relative14, resolve as resolve32 } from "path";
|
|
18720
|
+
import { performance as performance2 } from "perf_hooks";
|
|
18721
|
+
import ts8 from "typescript";
|
|
18722
|
+
var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_PROGRAM__ ?? null, setCachedHmrProgram = (program) => {
|
|
18723
|
+
globalCache.__ABSOLUTE_ANGULAR_HMR_PROGRAM__ = program;
|
|
18724
|
+
}, resolveTypescriptLibDirCached = null, resolveTypescriptLibDir = () => {
|
|
18725
|
+
if (resolveTypescriptLibDirCached)
|
|
18726
|
+
return resolveTypescriptLibDirCached;
|
|
18727
|
+
const tsPath = __require.resolve("typescript");
|
|
18728
|
+
const tsRootDir = dirname19(tsPath);
|
|
18729
|
+
resolveTypescriptLibDirCached = tsRootDir.endsWith("lib") ? tsRootDir : resolve32(tsRootDir, "lib");
|
|
18730
|
+
return resolveTypescriptLibDirCached;
|
|
18731
|
+
}, buildHmrCompilerOptions = (base) => ({
|
|
18732
|
+
...base,
|
|
18733
|
+
emitDecoratorMetadata: true,
|
|
18734
|
+
esModuleInterop: true,
|
|
18735
|
+
experimentalDecorators: true,
|
|
18736
|
+
module: ts8.ModuleKind.ESNext,
|
|
18737
|
+
moduleResolution: ts8.ModuleResolutionKind.Bundler,
|
|
18738
|
+
newLine: ts8.NewLineKind.LineFeed,
|
|
18739
|
+
noEmit: false,
|
|
18740
|
+
noLib: false,
|
|
18741
|
+
rootDir: process.cwd(),
|
|
18742
|
+
skipLibCheck: true,
|
|
18743
|
+
target: ts8.ScriptTarget.ES2022,
|
|
18744
|
+
_enableHmr: true,
|
|
18745
|
+
enableHmr: true
|
|
18746
|
+
}), ANGULAR_COMPILER_OPTIONS_CACHE, loadAngularCompilerOptions = async () => {
|
|
18747
|
+
if (ANGULAR_COMPILER_OPTIONS_CACHE.value) {
|
|
18748
|
+
return ANGULAR_COMPILER_OPTIONS_CACHE.value;
|
|
18749
|
+
}
|
|
18750
|
+
const { readConfiguration } = await import("@angular/compiler-cli");
|
|
18751
|
+
const config = readConfiguration("./tsconfig.json");
|
|
18752
|
+
ANGULAR_COMPILER_OPTIONS_CACHE.value = config.options;
|
|
18753
|
+
return config.options;
|
|
18754
|
+
}, cachedTsconfigMtime = 0, refreshAngularCompilerOptionsIfStale = async () => {
|
|
18755
|
+
const tsconfigPath = resolve32(process.cwd(), "tsconfig.json");
|
|
18756
|
+
if (!existsSync26(tsconfigPath))
|
|
18757
|
+
return;
|
|
18758
|
+
const stat3 = await import("fs/promises").then((m) => m.stat(tsconfigPath));
|
|
18759
|
+
if (stat3.mtimeMs > cachedTsconfigMtime) {
|
|
18760
|
+
ANGULAR_COMPILER_OPTIONS_CACHE.value = null;
|
|
18761
|
+
cachedTsconfigMtime = stat3.mtimeMs;
|
|
18762
|
+
}
|
|
18763
|
+
}, compileAngularForHmr = async (inputPaths, outDir, modifiedResourceFiles = null) => {
|
|
18764
|
+
await refreshAngularCompilerOptionsIfStale();
|
|
18765
|
+
await import("@angular/compiler");
|
|
18766
|
+
const { performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
18767
|
+
const baseOptions = await loadAngularCompilerOptions();
|
|
18768
|
+
const options = buildHmrCompilerOptions(baseOptions);
|
|
18769
|
+
options.outDir = outDir;
|
|
18770
|
+
options.target = ts8.ScriptTarget.ES2022;
|
|
18771
|
+
options.experimentalDecorators = true;
|
|
18772
|
+
options.emitDecoratorMetadata = true;
|
|
18773
|
+
options.newLine = ts8.NewLineKind.LineFeed;
|
|
18774
|
+
options.incremental = false;
|
|
18775
|
+
options.tsBuildInfoFile = undefined;
|
|
18776
|
+
const tsLibDir = resolveTypescriptLibDir();
|
|
18777
|
+
const host = ts8.createCompilerHost(options);
|
|
18778
|
+
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
18779
|
+
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
18780
|
+
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
18781
|
+
host.getDefaultLibFileName = (opts) => {
|
|
18782
|
+
const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
|
|
18783
|
+
return basename11(fileName);
|
|
18784
|
+
};
|
|
18785
|
+
const originalGetSourceFile = host.getSourceFile;
|
|
18786
|
+
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
18787
|
+
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
18788
|
+
return originalGetSourceFile?.call(host, join29(tsLibDir, fileName), languageVersion, onError);
|
|
18789
|
+
}
|
|
18790
|
+
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
18791
|
+
};
|
|
18792
|
+
const emitted = {};
|
|
18793
|
+
const resolvedOutDir = resolve32(outDir);
|
|
18794
|
+
host.writeFile = (fileName, text) => {
|
|
18795
|
+
const normalized = fileName.replace(/\\/g, "/");
|
|
18796
|
+
const rel = normalized.startsWith(resolvedOutDir.replace(/\\/g, "/")) ? relative14(resolvedOutDir, normalized).replace(/\\/g, "/") : relative14(process.cwd(), normalized).replace(/\\/g, "/");
|
|
18797
|
+
emitted[rel] = text;
|
|
18798
|
+
};
|
|
18799
|
+
const oldProgram = getCachedHmrProgram();
|
|
18800
|
+
const performArgs = {
|
|
18801
|
+
emitFlags: EmitFlags.Default,
|
|
18802
|
+
forceEmit: true,
|
|
18803
|
+
host,
|
|
18804
|
+
options,
|
|
18805
|
+
rootNames: inputPaths
|
|
18806
|
+
};
|
|
18807
|
+
if (modifiedResourceFiles && modifiedResourceFiles.size > 0) {
|
|
18808
|
+
performArgs.modifiedResourceFiles = new Set(modifiedResourceFiles);
|
|
18809
|
+
}
|
|
18810
|
+
if (oldProgram) {
|
|
18811
|
+
performArgs.oldProgram = oldProgram;
|
|
18812
|
+
}
|
|
18813
|
+
const compileResult = performCompilation(performArgs);
|
|
18814
|
+
const program = compileResult.program;
|
|
18815
|
+
if (program)
|
|
18816
|
+
setCachedHmrProgram(program);
|
|
18817
|
+
return {
|
|
18818
|
+
program,
|
|
18819
|
+
emitted,
|
|
18820
|
+
diagnostics: compileResult.diagnostics ?? []
|
|
18821
|
+
};
|
|
18822
|
+
}, findClassNodeById = (program, encodedId) => {
|
|
18823
|
+
const decoded = decodeURIComponent(encodedId);
|
|
18824
|
+
const at2 = decoded.lastIndexOf("@");
|
|
18825
|
+
if (at2 === -1)
|
|
18826
|
+
return null;
|
|
18827
|
+
const filePath = decoded.slice(0, at2);
|
|
18828
|
+
const className = decoded.slice(at2 + 1);
|
|
18829
|
+
const tsProgram = program.compiler.getCurrentProgram();
|
|
18830
|
+
const absoluteCandidate = resolve32(process.cwd(), filePath).replace(/\\/g, "/");
|
|
18831
|
+
const matchesPath = (sourceFileName) => {
|
|
18832
|
+
const normalized = sourceFileName.replace(/\\/g, "/");
|
|
18833
|
+
if (normalized === absoluteCandidate)
|
|
18834
|
+
return true;
|
|
18835
|
+
if (normalized === filePath)
|
|
18836
|
+
return true;
|
|
18837
|
+
return normalized.endsWith("/" + filePath) || normalized.endsWith(filePath);
|
|
18838
|
+
};
|
|
18839
|
+
let sourceFile = tsProgram.getSourceFile(absoluteCandidate) ?? null;
|
|
18840
|
+
if (!sourceFile) {
|
|
18841
|
+
for (const candidate of tsProgram.getSourceFiles()) {
|
|
18842
|
+
if (matchesPath(candidate.fileName)) {
|
|
18843
|
+
sourceFile = candidate;
|
|
18844
|
+
break;
|
|
18845
|
+
}
|
|
18846
|
+
}
|
|
18847
|
+
}
|
|
18848
|
+
if (!sourceFile)
|
|
18849
|
+
return null;
|
|
18850
|
+
let found = null;
|
|
18851
|
+
const walk = (node) => {
|
|
18852
|
+
if (found)
|
|
18853
|
+
return;
|
|
18854
|
+
if (ts8.isClassDeclaration(node) && node.name?.text === className) {
|
|
18855
|
+
found = node;
|
|
18856
|
+
return;
|
|
18857
|
+
}
|
|
18858
|
+
ts8.forEachChild(node, walk);
|
|
18859
|
+
};
|
|
18860
|
+
walk(sourceFile);
|
|
18861
|
+
return found;
|
|
18862
|
+
}, getApplyMetadataModule = async (encodedId) => {
|
|
18863
|
+
const decoded = decodeURIComponent(encodedId);
|
|
18864
|
+
const at2 = decoded.lastIndexOf("@");
|
|
18865
|
+
if (at2 === -1)
|
|
18866
|
+
return null;
|
|
18867
|
+
const filePathRel = decoded.slice(0, at2);
|
|
18868
|
+
const className = decoded.slice(at2 + 1);
|
|
18869
|
+
const componentFilePath = resolve32(process.cwd(), filePathRel);
|
|
18870
|
+
const fastStart = performance2.now();
|
|
18871
|
+
const fast = await tryFastHmr({ componentFilePath, className });
|
|
18872
|
+
if (fast.ok) {
|
|
18873
|
+
logInfo(`[ng-hmr fast] ${className} ${(performance2.now() - fastStart).toFixed(1)}ms`);
|
|
18874
|
+
return fast.moduleText;
|
|
18875
|
+
}
|
|
18876
|
+
logWarn(`[ng-hmr slow] ${className} fast path bailed (${fast.reason}${fast.detail ? `: ${fast.detail}` : ""}), falling back to ngtsc`);
|
|
18877
|
+
const program = getCachedHmrProgram();
|
|
18878
|
+
if (!program)
|
|
18879
|
+
return null;
|
|
18880
|
+
const node = findClassNodeById(program, encodedId);
|
|
18881
|
+
if (!node)
|
|
18882
|
+
return null;
|
|
18883
|
+
return program.compiler.emitHmrUpdateModule(node);
|
|
18884
|
+
}, encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
18885
|
+
const projectRel = relative14(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
18886
|
+
return encodeURIComponent(`${projectRel}@${className}`);
|
|
18887
|
+
};
|
|
18888
|
+
var init_hmrCompiler = __esm(() => {
|
|
18889
|
+
init_logger();
|
|
18890
|
+
init_fastHmrCompiler();
|
|
18891
|
+
globalCache = globalThis;
|
|
18892
|
+
ANGULAR_COMPILER_OPTIONS_CACHE = {
|
|
18893
|
+
value: null
|
|
18894
|
+
};
|
|
18895
|
+
});
|
|
18896
|
+
|
|
18897
|
+
// src/utils/ssrErrorPage.ts
|
|
18898
|
+
var ssrErrorPage = (framework, error) => {
|
|
18899
|
+
const frameworkColors2 = {
|
|
18900
|
+
angular: "#dd0031",
|
|
18901
|
+
html: "#e34c26",
|
|
18902
|
+
htmx: "#1a365d",
|
|
18903
|
+
react: "#61dafb",
|
|
18904
|
+
svelte: "#ff3e00",
|
|
18905
|
+
vue: "#42b883"
|
|
18906
|
+
};
|
|
18907
|
+
const accent = frameworkColors2[framework] ?? "#94a3b8";
|
|
18908
|
+
const label = framework.charAt(0).toUpperCase() + framework.slice(1);
|
|
18909
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
18910
|
+
return `<!DOCTYPE html>
|
|
18911
|
+
<html>
|
|
18912
|
+
<head>
|
|
18913
|
+
<meta charset="utf-8">
|
|
18914
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
18915
|
+
<title>SSR Error - AbsoluteJS</title>
|
|
18916
|
+
<style>
|
|
18917
|
+
*{margin:0;padding:0;box-sizing:border-box}
|
|
18918
|
+
body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,rgba(30,41,59,0.98) 100%);color:#e2e8f0;font-family:"JetBrains Mono","Fira Code",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;line-height:1.6;display:flex;align-items:flex-start;justify-content:center;padding:32px}
|
|
18919
|
+
.card{max-width:720px;width:100%;background:rgba(30,41,59,0.6);border:1px solid rgba(71,85,105,0.5);border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,0.5),0 0 0 1px rgba(255,255,255,0.05);overflow:hidden}
|
|
18920
|
+
.header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;background:rgba(15,23,42,0.5);border-bottom:1px solid rgba(71,85,105,0.4)}
|
|
18921
|
+
.brand{font-weight:700;font-size:20px;color:#fff;letter-spacing:-0.02em}
|
|
18922
|
+
.badge{padding:5px 10px;border-radius:8px;font-size:12px;font-weight:600;background:${accent};color:#fff;opacity:0.95;box-shadow:0 2px 4px rgba(0,0,0,0.2)}
|
|
18923
|
+
.kind{color:#94a3b8;font-size:13px;font-weight:500}
|
|
18924
|
+
.content{padding:24px}
|
|
18925
|
+
.label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px}
|
|
18926
|
+
.message{margin:0;padding:16px 20px;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.25);border-radius:10px;overflow-x:auto;white-space:pre-wrap;word-break:break-word;color:#fca5a5;font-size:13px;line-height:1.5}
|
|
18927
|
+
.hint{margin-top:20px;padding:12px 20px;background:rgba(71,85,105,0.3);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#cbd5e1;font-size:13px}
|
|
18928
|
+
</style>
|
|
18929
|
+
</head>
|
|
18930
|
+
<body>
|
|
18931
|
+
<div class="card">
|
|
18932
|
+
<div class="header">
|
|
18933
|
+
<div style="display:flex;align-items:center;gap:12px">
|
|
18934
|
+
<span class="brand">AbsoluteJS</span>
|
|
18935
|
+
<span class="badge">${label}</span>
|
|
18936
|
+
</div>
|
|
18937
|
+
<span class="kind">Server Render Error</span>
|
|
18938
|
+
</div>
|
|
18939
|
+
<div class="content">
|
|
18940
|
+
<div class="label">What went wrong</div>
|
|
18941
|
+
<pre class="message">${message.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</pre>
|
|
18942
|
+
<div class="hint">A component threw during server-side rendering. Check the terminal for the full stack trace.</div>
|
|
18943
|
+
</div>
|
|
18944
|
+
</div>
|
|
18945
|
+
</body>
|
|
18946
|
+
</html>`;
|
|
18947
|
+
};
|
|
18948
|
+
|
|
18949
|
+
// src/ember/pageHandler.ts
|
|
18950
|
+
import { pathToFileURL } from "url";
|
|
18951
|
+
var resolveRequestPathname = (request) => {
|
|
18952
|
+
if (!request)
|
|
18953
|
+
return;
|
|
18954
|
+
try {
|
|
18955
|
+
const parsed = new URL(request.url);
|
|
18956
|
+
return `${parsed.pathname}${parsed.search}`;
|
|
18957
|
+
} catch {
|
|
18958
|
+
return;
|
|
18959
|
+
}
|
|
18960
|
+
}, installSimpleDomGlobals = () => {
|
|
18961
|
+
const g2 = globalThis;
|
|
17557
18962
|
if (typeof g2.Element === "undefined") {
|
|
17558
18963
|
g2.Element = class Element {
|
|
17559
18964
|
};
|
|
@@ -17620,11 +19025,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
17620
19025
|
__export(exports_simpleHTMLHMR, {
|
|
17621
19026
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
17622
19027
|
});
|
|
17623
|
-
import { resolve as
|
|
19028
|
+
import { resolve as resolve33 } from "path";
|
|
17624
19029
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
17625
19030
|
let htmlContent;
|
|
17626
19031
|
try {
|
|
17627
|
-
const resolvedPath =
|
|
19032
|
+
const resolvedPath = resolve33(htmlFilePath);
|
|
17628
19033
|
const file4 = Bun.file(resolvedPath);
|
|
17629
19034
|
if (!await file4.exists()) {
|
|
17630
19035
|
return null;
|
|
@@ -17650,11 +19055,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
17650
19055
|
__export(exports_simpleHTMXHMR, {
|
|
17651
19056
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
17652
19057
|
});
|
|
17653
|
-
import { resolve as
|
|
19058
|
+
import { resolve as resolve34 } from "path";
|
|
17654
19059
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
17655
19060
|
let htmlContent;
|
|
17656
19061
|
try {
|
|
17657
|
-
const resolvedPath =
|
|
19062
|
+
const resolvedPath = resolve34(htmxFilePath);
|
|
17658
19063
|
const file4 = Bun.file(resolvedPath);
|
|
17659
19064
|
if (!await file4.exists()) {
|
|
17660
19065
|
return null;
|
|
@@ -17676,8 +19081,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
17676
19081
|
var init_simpleHTMXHMR = () => {};
|
|
17677
19082
|
|
|
17678
19083
|
// src/dev/rebuildTrigger.ts
|
|
17679
|
-
import { existsSync as
|
|
17680
|
-
import { basename as basename12, dirname as
|
|
19084
|
+
import { existsSync as existsSync27 } from "fs";
|
|
19085
|
+
import { basename as basename12, dirname as dirname20, relative as relative15, resolve as resolve35 } from "path";
|
|
17681
19086
|
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) => {
|
|
17682
19087
|
if (!config.tailwind)
|
|
17683
19088
|
return;
|
|
@@ -17765,11 +19170,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17765
19170
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
17766
19171
|
}
|
|
17767
19172
|
return { ...parsed, framework: detectedFw };
|
|
17768
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
19173
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync27(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
17769
19174
|
state.fileHashes.delete(filePathInSet);
|
|
17770
19175
|
try {
|
|
17771
19176
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
17772
|
-
const deletedPathResolved =
|
|
19177
|
+
const deletedPathResolved = resolve35(filePathInSet);
|
|
17773
19178
|
affectedFiles.forEach((affectedFile) => {
|
|
17774
19179
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
17775
19180
|
validFiles.push(affectedFile);
|
|
@@ -17783,7 +19188,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17783
19188
|
if (!dependents || dependents.size === 0) {
|
|
17784
19189
|
return;
|
|
17785
19190
|
}
|
|
17786
|
-
const dependentFiles = Array.from(dependents).filter((file4) =>
|
|
19191
|
+
const dependentFiles = Array.from(dependents).filter((file4) => existsSync27(file4));
|
|
17787
19192
|
if (dependentFiles.length === 0) {
|
|
17788
19193
|
return;
|
|
17789
19194
|
}
|
|
@@ -17799,7 +19204,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17799
19204
|
try {
|
|
17800
19205
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
17801
19206
|
affectedFiles.forEach((affectedFile) => {
|
|
17802
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
19207
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync27(affectedFile)) {
|
|
17803
19208
|
validFiles.push(affectedFile);
|
|
17804
19209
|
processedFiles.add(affectedFile);
|
|
17805
19210
|
}
|
|
@@ -17813,7 +19218,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17813
19218
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
17814
19219
|
return;
|
|
17815
19220
|
}
|
|
17816
|
-
const normalizedFilePath =
|
|
19221
|
+
const normalizedFilePath = resolve35(filePathInSet);
|
|
17817
19222
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
17818
19223
|
validFiles.push(normalizedFilePath);
|
|
17819
19224
|
processedFiles.add(normalizedFilePath);
|
|
@@ -17824,7 +19229,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17824
19229
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
17825
19230
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
17826
19231
|
filePathSet.forEach((filePathInSet) => {
|
|
17827
|
-
if (!
|
|
19232
|
+
if (!existsSync27(filePathInSet)) {
|
|
17828
19233
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
17829
19234
|
return;
|
|
17830
19235
|
}
|
|
@@ -17917,8 +19322,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17917
19322
|
return;
|
|
17918
19323
|
}
|
|
17919
19324
|
if (framework === "unknown") {
|
|
17920
|
-
invalidate(
|
|
17921
|
-
const relPath =
|
|
19325
|
+
invalidate(resolve35(filePath));
|
|
19326
|
+
const relPath = relative15(process.cwd(), filePath);
|
|
17922
19327
|
logHmrUpdate(relPath);
|
|
17923
19328
|
return;
|
|
17924
19329
|
}
|
|
@@ -17944,7 +19349,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17944
19349
|
const userEditedFiles = new Set;
|
|
17945
19350
|
state.fileChangeQueue.forEach((filePaths) => {
|
|
17946
19351
|
for (const filePath2 of filePaths) {
|
|
17947
|
-
userEditedFiles.add(
|
|
19352
|
+
userEditedFiles.add(resolve35(filePath2));
|
|
17948
19353
|
}
|
|
17949
19354
|
});
|
|
17950
19355
|
state.lastUserEditedFiles = userEditedFiles;
|
|
@@ -17968,12 +19373,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17968
19373
|
return componentFile;
|
|
17969
19374
|
}
|
|
17970
19375
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
17971
|
-
if (
|
|
19376
|
+
if (existsSync27(tsCounterpart)) {
|
|
17972
19377
|
return tsCounterpart;
|
|
17973
19378
|
}
|
|
17974
19379
|
if (!graph)
|
|
17975
19380
|
return componentFile;
|
|
17976
|
-
const dependents = graph.dependents.get(
|
|
19381
|
+
const dependents = graph.dependents.get(resolve35(componentFile));
|
|
17977
19382
|
if (!dependents)
|
|
17978
19383
|
return componentFile;
|
|
17979
19384
|
for (const dep of dependents) {
|
|
@@ -17982,7 +19387,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17982
19387
|
}
|
|
17983
19388
|
return componentFile;
|
|
17984
19389
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
17985
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
19390
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve35(file4).startsWith(angularPagesPath));
|
|
17986
19391
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
17987
19392
|
return pageEntries;
|
|
17988
19393
|
}
|
|
@@ -17991,7 +19396,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17991
19396
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
17992
19397
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
17993
19398
|
affected.forEach((file4) => {
|
|
17994
|
-
if (file4.endsWith(".ts") &&
|
|
19399
|
+
if (file4.endsWith(".ts") && resolve35(file4).startsWith(angularPagesPath)) {
|
|
17995
19400
|
resolvedPages.add(file4);
|
|
17996
19401
|
}
|
|
17997
19402
|
});
|
|
@@ -18016,12 +19421,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18016
19421
|
return;
|
|
18017
19422
|
}
|
|
18018
19423
|
state.manifest[toPascal(baseName)] = artifact.path;
|
|
18019
|
-
}, bundleAngularClient = async (state, clientPaths, buildDir) => {
|
|
19424
|
+
}, bundleAngularClient = async (state, clientPaths, buildDir, userAngularRoot) => {
|
|
18020
19425
|
const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
|
|
18021
19426
|
const { generateManifest: generateManifest2 } = await Promise.resolve().then(() => (init_generateManifest(), exports_generateManifest));
|
|
18022
19427
|
const { getAngularVendorPaths: getAngularVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
19428
|
+
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
19429
|
+
const { createAngularHmrInjectionPlugin: createAngularHmrInjectionPlugin2 } = await Promise.resolve().then(() => (init_hmrInjectionPlugin(), exports_hmrInjectionPlugin));
|
|
18023
19430
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
18024
19431
|
const depVendorPaths = globalThis.__depVendorPaths ?? {};
|
|
19432
|
+
const generatedAngularRoot = getFrameworkGeneratedDir2("angular");
|
|
18025
19433
|
let angVendorPaths = getAngularVendorPaths2();
|
|
18026
19434
|
if (!angVendorPaths) {
|
|
18027
19435
|
const { computeAngularVendorPaths: computeAngularVendorPaths2 } = await Promise.resolve().then(() => (init_buildAngularVendor(), exports_buildAngularVendor));
|
|
@@ -18044,7 +19452,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18044
19452
|
naming: "[dir]/[name].[hash].[ext]",
|
|
18045
19453
|
outdir: buildDir,
|
|
18046
19454
|
plugins: [
|
|
18047
|
-
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
19455
|
+
createStylePreprocessorPlugin(getStyleTransformConfig(state.config)),
|
|
19456
|
+
createAngularHmrInjectionPlugin2({
|
|
19457
|
+
generatedAngularRoot,
|
|
19458
|
+
userAngularRoot,
|
|
19459
|
+
projectRoot: process.cwd()
|
|
19460
|
+
})
|
|
18048
19461
|
],
|
|
18049
19462
|
root: clientRoot,
|
|
18050
19463
|
target: "browser",
|
|
@@ -18063,37 +19476,72 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18063
19476
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
18064
19477
|
Object.assign(state.manifest, clientManifest);
|
|
18065
19478
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
18066
|
-
},
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
const
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
|
|
19479
|
+
}, decideAngularTier = async (state, angularDir) => {
|
|
19480
|
+
const userEdited = state.lastUserEditedFiles ?? new Set;
|
|
19481
|
+
if (userEdited.size === 0)
|
|
19482
|
+
return { queue: [], tier: 0 };
|
|
19483
|
+
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
19484
|
+
const { encodeHmrComponentId: encodeHmrComponentId2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
|
|
19485
|
+
const { tryFastHmr: tryFastHmr2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
19486
|
+
const queue = [];
|
|
19487
|
+
const queueIds = new Set;
|
|
19488
|
+
for (const editedFile of userEdited) {
|
|
19489
|
+
const owners = resolveOwningComponents2({
|
|
19490
|
+
changedFilePath: editedFile,
|
|
19491
|
+
userAngularRoot: angularDir
|
|
19492
|
+
});
|
|
19493
|
+
if (owners.length === 0 && editedFile.endsWith(".component.ts")) {
|
|
19494
|
+
return {
|
|
19495
|
+
reason: `no @Component class found in ${editedFile}`,
|
|
19496
|
+
tier: 1
|
|
19497
|
+
};
|
|
19498
|
+
}
|
|
19499
|
+
for (const { componentFilePath, className } of owners) {
|
|
19500
|
+
const id = encodeHmrComponentId2(componentFilePath, className);
|
|
19501
|
+
if (queueIds.has(id))
|
|
19502
|
+
continue;
|
|
19503
|
+
const result = await tryFastHmr2({ className, componentFilePath });
|
|
19504
|
+
if (!result.ok) {
|
|
19505
|
+
return {
|
|
19506
|
+
reason: `${className}: ${result.reason}${result.detail ? ` (${result.detail})` : ""}`,
|
|
19507
|
+
tier: 1
|
|
19508
|
+
};
|
|
19509
|
+
}
|
|
19510
|
+
queueIds.add(id);
|
|
19511
|
+
queue.push({ className, id });
|
|
19512
|
+
}
|
|
19513
|
+
}
|
|
19514
|
+
return { queue, tier: 0 };
|
|
19515
|
+
}, broadcastSurgical = (state, queue) => {
|
|
19516
|
+
const timestamp = Date.now();
|
|
19517
|
+
for (const { id, className } of queue) {
|
|
18080
19518
|
broadcastToClients(state, {
|
|
18081
|
-
data: {
|
|
18082
|
-
|
|
18083
|
-
cssUrl,
|
|
18084
|
-
editSourceFile: classification.sourceFile,
|
|
18085
|
-
framework: "angular",
|
|
18086
|
-
manifest,
|
|
18087
|
-
reason: classification.reason,
|
|
18088
|
-
sourceFile: angularPagePath,
|
|
18089
|
-
updateType: classification.type
|
|
18090
|
-
},
|
|
18091
|
-
type: "angular-update"
|
|
19519
|
+
data: { id, timestamp },
|
|
19520
|
+
type: "angular:component-update"
|
|
18092
19521
|
});
|
|
19522
|
+
logInfo(`[ng-hmr broadcast] ${className}`);
|
|
19523
|
+
}
|
|
19524
|
+
}, broadcastRebootstrap = async (state, reason) => {
|
|
19525
|
+
logInfo(`[ng-hmr tier-1 rebootstrap] ${reason}`);
|
|
19526
|
+
broadcastToClients(state, {
|
|
19527
|
+
data: {
|
|
19528
|
+
manifest: state.manifest,
|
|
19529
|
+
reason,
|
|
19530
|
+
timestamp: Date.now()
|
|
19531
|
+
},
|
|
19532
|
+
type: "angular:rebootstrap"
|
|
18093
19533
|
});
|
|
19534
|
+
const { invalidateFingerprintCache: invalidateFingerprintCache2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
19535
|
+
invalidateFingerprintCache2();
|
|
18094
19536
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
18095
19537
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
18096
19538
|
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, getStyleTransformConfig(state.config));
|
|
19539
|
+
try {
|
|
19540
|
+
const { compileAngularForHmr: compileAngularForHmr2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
|
|
19541
|
+
await compileAngularForHmr2(pageEntries, state.resolvedPaths.buildDir, state.lastUserEditedFiles ?? null);
|
|
19542
|
+
} catch (err) {
|
|
19543
|
+
logWarn(`[hmr] surgical-HMR shadow compile skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
19544
|
+
}
|
|
18097
19545
|
const { getAngularServerVendorPaths: getAngularServerVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
18098
19546
|
const angServerVendorPaths = getAngularServerVendorPaths2();
|
|
18099
19547
|
const ssrPaths = angServerVendorPaths ? serverPaths.map((serverPath) => serverPath.replace(/\.js$/, ".ssr.js")) : serverPaths;
|
|
@@ -18111,36 +19559,42 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18111
19559
|
serverPaths.forEach((serverPath, idx) => {
|
|
18112
19560
|
const fileBase = basename12(serverPath, ".js");
|
|
18113
19561
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
18114
|
-
state.manifest[toPascal(fileBase)] =
|
|
19562
|
+
state.manifest[toPascal(fileBase)] = resolve35(ssrPath);
|
|
18115
19563
|
});
|
|
18116
19564
|
if (clientPaths.length > 0) {
|
|
18117
|
-
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
19565
|
+
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
|
|
18118
19566
|
}
|
|
18119
19567
|
}, handleAngularFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
18120
19568
|
const angularDir = config.angularDirectory ?? "";
|
|
18121
19569
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
18122
19570
|
for (const file4 of angularFiles) {
|
|
18123
|
-
state.fileHashes.set(
|
|
19571
|
+
state.fileHashes.set(resolve35(file4), computeFileHash(file4));
|
|
18124
19572
|
}
|
|
18125
|
-
const angularPagesPath =
|
|
19573
|
+
const angularPagesPath = resolve35(angularDir, "pages");
|
|
18126
19574
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
18127
|
-
|
|
19575
|
+
const verdict = await decideAngularTier(state, angularDir);
|
|
19576
|
+
const runBundle = async () => {
|
|
19577
|
+
if (pageEntries.length === 0)
|
|
19578
|
+
return;
|
|
18128
19579
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
18129
19580
|
markSsrCacheDirty("angular");
|
|
19581
|
+
};
|
|
19582
|
+
if (verdict.tier === 0) {
|
|
19583
|
+
broadcastSurgical(state, verdict.queue);
|
|
19584
|
+
runBundle().catch((err) => {
|
|
19585
|
+
logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
19586
|
+
});
|
|
19587
|
+
} else {
|
|
19588
|
+
await runBundle();
|
|
19589
|
+
await broadcastRebootstrap(state, verdict.reason);
|
|
18130
19590
|
}
|
|
18131
19591
|
const { manifest } = state;
|
|
18132
|
-
const angularHmrFiles = angularFiles.filter((file4) => file4.endsWith(".ts") || file4.endsWith(".html"));
|
|
18133
|
-
const angularPageFiles = angularHmrFiles.filter((file4) => file4.replace(/\\/g, "/").includes("/pages/"));
|
|
18134
|
-
const pagesToUpdate = angularPageFiles.length > 0 ? angularPageFiles : pageEntries;
|
|
18135
|
-
const filesToClassify = filterToUserEdits(angularFiles, state.lastUserEditedFiles);
|
|
18136
|
-
const classification = collapseClassifications(filesToClassify.map(classifyAngularEdit));
|
|
18137
|
-
broadcastAngularPageUpdates(state, pagesToUpdate, manifest, startTime, classification);
|
|
18138
19592
|
onRebuildComplete({ hmrState: state, manifest });
|
|
18139
19593
|
return manifest;
|
|
18140
19594
|
}, getModuleUrl = async (pageFile) => {
|
|
18141
19595
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
18142
19596
|
invalidateModule2(pageFile);
|
|
18143
|
-
const rel =
|
|
19597
|
+
const rel = relative15(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
18144
19598
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
18145
19599
|
warmCache2(url);
|
|
18146
19600
|
return url;
|
|
@@ -18149,11 +19603,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18149
19603
|
if (isComponentFile2)
|
|
18150
19604
|
return primaryFile;
|
|
18151
19605
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
18152
|
-
const nearest = findNearestComponent2(
|
|
19606
|
+
const nearest = findNearestComponent2(resolve35(primaryFile));
|
|
18153
19607
|
return nearest ?? primaryFile;
|
|
18154
19608
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
18155
19609
|
for (const file4 of reactFiles) {
|
|
18156
|
-
state.fileHashes.set(
|
|
19610
|
+
state.fileHashes.set(resolve35(file4), computeFileHash(file4));
|
|
18157
19611
|
}
|
|
18158
19612
|
markSsrCacheDirty("react");
|
|
18159
19613
|
const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -18172,7 +19626,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18172
19626
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
18173
19627
|
if (pageModuleUrl) {
|
|
18174
19628
|
const serverDuration = Date.now() - startTime;
|
|
18175
|
-
state.lastHmrPath =
|
|
19629
|
+
state.lastHmrPath = relative15(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
18176
19630
|
state.lastHmrFramework = "react";
|
|
18177
19631
|
broadcastToClients(state, {
|
|
18178
19632
|
data: {
|
|
@@ -18235,7 +19689,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18235
19689
|
});
|
|
18236
19690
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
18237
19691
|
for (const file4 of svelteFiles) {
|
|
18238
|
-
state.fileHashes.set(
|
|
19692
|
+
state.fileHashes.set(resolve35(file4), computeFileHash(file4));
|
|
18239
19693
|
}
|
|
18240
19694
|
markSsrCacheDirty("svelte");
|
|
18241
19695
|
const serverDuration = Date.now() - startTime;
|
|
@@ -18260,8 +19714,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18260
19714
|
const serverEntries = [...svelteServerPaths];
|
|
18261
19715
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
18262
19716
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
18263
|
-
const serverRoot =
|
|
18264
|
-
const serverOutDir =
|
|
19717
|
+
const serverRoot = resolve35(getFrameworkGeneratedDir2("svelte"), "server");
|
|
19718
|
+
const serverOutDir = resolve35(buildDir, basename12(svelteDir));
|
|
18265
19719
|
const [serverResult, clientResult] = await Promise.all([
|
|
18266
19720
|
serverEntries.length > 0 ? bunBuild9({
|
|
18267
19721
|
entrypoints: serverEntries,
|
|
@@ -18358,7 +19812,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18358
19812
|
});
|
|
18359
19813
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
18360
19814
|
for (const file4 of [...vueFiles, ...nonVueFiles]) {
|
|
18361
|
-
state.fileHashes.set(
|
|
19815
|
+
state.fileHashes.set(resolve35(file4), computeFileHash(file4));
|
|
18362
19816
|
}
|
|
18363
19817
|
markSsrCacheDirty("vue");
|
|
18364
19818
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -18386,7 +19840,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18386
19840
|
recursive: true,
|
|
18387
19841
|
withFileTypes: true
|
|
18388
19842
|
});
|
|
18389
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
19843
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve35(emberPagesPath, entry.name));
|
|
18390
19844
|
} catch {
|
|
18391
19845
|
return [];
|
|
18392
19846
|
}
|
|
@@ -18398,10 +19852,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18398
19852
|
return state.manifest;
|
|
18399
19853
|
}
|
|
18400
19854
|
for (const file4 of emberFiles) {
|
|
18401
|
-
state.fileHashes.set(
|
|
19855
|
+
state.fileHashes.set(resolve35(file4), computeFileHash(file4));
|
|
18402
19856
|
}
|
|
18403
|
-
const emberPagesPath =
|
|
18404
|
-
const directPageEntries = emberFiles.filter((file4) =>
|
|
19857
|
+
const emberPagesPath = resolve35(emberDir, "pages");
|
|
19858
|
+
const directPageEntries = emberFiles.filter((file4) => resolve35(file4).startsWith(emberPagesPath));
|
|
18405
19859
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
18406
19860
|
if (allPageEntries.length === 0) {
|
|
18407
19861
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -18411,14 +19865,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18411
19865
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
18412
19866
|
for (const serverPath of serverPaths) {
|
|
18413
19867
|
const fileBase = basename12(serverPath, ".js");
|
|
18414
|
-
state.manifest[toPascal(fileBase)] =
|
|
19868
|
+
state.manifest[toPascal(fileBase)] = resolve35(serverPath);
|
|
18415
19869
|
}
|
|
18416
19870
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
18417
19871
|
invalidateEmberSsrCache2();
|
|
18418
19872
|
const duration = Date.now() - startTime;
|
|
18419
19873
|
const [primary] = emberFiles;
|
|
18420
19874
|
if (primary) {
|
|
18421
|
-
state.lastHmrPath =
|
|
19875
|
+
state.lastHmrPath = relative15(process.cwd(), primary).replace(/\\/g, "/");
|
|
18422
19876
|
state.lastHmrFramework = "ember";
|
|
18423
19877
|
logHmrUpdate(primary, "ember", duration);
|
|
18424
19878
|
}
|
|
@@ -18503,8 +19957,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18503
19957
|
if (!buildReference?.source) {
|
|
18504
19958
|
return;
|
|
18505
19959
|
}
|
|
18506
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
18507
|
-
islandFiles.add(
|
|
19960
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve35(dirname20(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
19961
|
+
islandFiles.add(resolve35(sourcePath));
|
|
18508
19962
|
}, resolveIslandSourceFiles = async (config) => {
|
|
18509
19963
|
const registryPath = config.islands?.registry;
|
|
18510
19964
|
if (!registryPath) {
|
|
@@ -18512,7 +19966,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18512
19966
|
}
|
|
18513
19967
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
18514
19968
|
const islandFiles = new Set([
|
|
18515
|
-
|
|
19969
|
+
resolve35(buildInfo.resolvedRegistryPath)
|
|
18516
19970
|
]);
|
|
18517
19971
|
for (const definition of buildInfo.definitions) {
|
|
18518
19972
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -18523,7 +19977,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18523
19977
|
if (islandFiles.size === 0) {
|
|
18524
19978
|
return false;
|
|
18525
19979
|
}
|
|
18526
|
-
return filesToRebuild.some((file4) => islandFiles.has(
|
|
19980
|
+
return filesToRebuild.some((file4) => islandFiles.has(resolve35(file4)));
|
|
18527
19981
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
18528
19982
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
18529
19983
|
if (!shouldReload) {
|
|
@@ -18558,10 +20012,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18558
20012
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
18559
20013
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
18560
20014
|
if (isSingle) {
|
|
18561
|
-
return
|
|
20015
|
+
return resolve35(state.resolvedPaths.buildDir, "pages");
|
|
18562
20016
|
}
|
|
18563
20017
|
const dirName = framework === "html" ? basename12(config.htmlDirectory ?? "html") : basename12(config.htmxDirectory ?? "htmx");
|
|
18564
|
-
return
|
|
20018
|
+
return resolve35(state.resolvedPaths.buildDir, dirName, "pages");
|
|
18565
20019
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
18566
20020
|
try {
|
|
18567
20021
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -18600,7 +20054,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18600
20054
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
18601
20055
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
18602
20056
|
const htmlPageName = basename12(pageFile);
|
|
18603
|
-
const builtHtmlPagePath =
|
|
20057
|
+
const builtHtmlPagePath = resolve35(outputHtmlPages, htmlPageName);
|
|
18604
20058
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
18605
20059
|
});
|
|
18606
20060
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -18661,11 +20115,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18661
20115
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
18662
20116
|
const pascalName = toPascal(baseName);
|
|
18663
20117
|
const vueRoot = config.vueDirectory;
|
|
18664
|
-
const hmrId = vueRoot ?
|
|
20118
|
+
const hmrId = vueRoot ? relative15(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
18665
20119
|
const cssKey = `${pascalName}CSS`;
|
|
18666
20120
|
const cssUrl = manifest[cssKey] || null;
|
|
18667
20121
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
18668
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
20122
|
+
const hmrMeta = vueHmrMetadata2.get(resolve35(vuePagePath));
|
|
18669
20123
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
18670
20124
|
if (changeType === "style-only") {
|
|
18671
20125
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -18764,20 +20218,6 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18764
20218
|
pagesToUpdate.forEach((sveltePagePath) => {
|
|
18765
20219
|
broadcastSveltePageUpdate(state, sveltePagePath, manifest, duration);
|
|
18766
20220
|
});
|
|
18767
|
-
}, collectAngularAffectedPages = (affected, resolvedPages) => {
|
|
18768
|
-
affected.forEach((file4) => {
|
|
18769
|
-
if (file4.replace(/\\/g, "/").includes("/pages/") && file4.endsWith(".ts")) {
|
|
18770
|
-
resolvedPages.add(file4);
|
|
18771
|
-
}
|
|
18772
|
-
});
|
|
18773
|
-
}, resolveAngularPagesFromDependencyGraph = (state, angularFiles) => {
|
|
18774
|
-
const resolvedPages = new Set;
|
|
18775
|
-
angularFiles.forEach((componentFile) => {
|
|
18776
|
-
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
18777
|
-
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
18778
|
-
collectAngularAffectedPages(affected, resolvedPages);
|
|
18779
|
-
});
|
|
18780
|
-
return Array.from(resolvedPages);
|
|
18781
20221
|
}, handleAngularCssOnlyUpdate = (state, angularCssFiles, manifest, duration) => {
|
|
18782
20222
|
const [cssFile] = angularCssFiles;
|
|
18783
20223
|
if (!cssFile) {
|
|
@@ -18799,57 +20239,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18799
20239
|
},
|
|
18800
20240
|
type: "angular-update"
|
|
18801
20241
|
});
|
|
18802
|
-
}, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration, classification) => {
|
|
18803
|
-
try {
|
|
18804
|
-
const fileName = basename12(angularPagePath);
|
|
18805
|
-
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
18806
|
-
const pascalName = toPascal(baseName);
|
|
18807
|
-
const cssKey = `${pascalName}CSS`;
|
|
18808
|
-
const cssUrl = manifest[cssKey] || null;
|
|
18809
|
-
logHmrUpdate(angularPagePath, "angular", duration);
|
|
18810
|
-
broadcastToClients(state, {
|
|
18811
|
-
data: {
|
|
18812
|
-
cssBaseName: baseName,
|
|
18813
|
-
cssUrl,
|
|
18814
|
-
editSourceFile: classification.sourceFile,
|
|
18815
|
-
framework: "angular",
|
|
18816
|
-
manifest,
|
|
18817
|
-
reason: classification.reason,
|
|
18818
|
-
sourceFile: angularPagePath,
|
|
18819
|
-
updateType: classification.type
|
|
18820
|
-
},
|
|
18821
|
-
type: "angular-update"
|
|
18822
|
-
});
|
|
18823
|
-
} catch (err) {
|
|
18824
|
-
sendTelemetryEvent("hmr:error", {
|
|
18825
|
-
framework: "angular",
|
|
18826
|
-
message: err instanceof Error ? err.message : String(err)
|
|
18827
|
-
});
|
|
18828
|
-
}
|
|
18829
20242
|
}, handleAngularHMR = (state, config, filesToRebuild, manifest, duration) => {
|
|
18830
|
-
if (!config.angularDirectory)
|
|
20243
|
+
if (!config.angularDirectory)
|
|
18831
20244
|
return;
|
|
18832
|
-
}
|
|
18833
20245
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
18834
|
-
if (angularFiles.length === 0)
|
|
20246
|
+
if (angularFiles.length === 0)
|
|
18835
20247
|
return;
|
|
18836
|
-
}
|
|
18837
20248
|
const angularCssFiles = angularFiles.filter(isStylePath);
|
|
18838
20249
|
const isCssOnlyChange = angularFiles.every(isStylePath) && angularCssFiles.length > 0;
|
|
18839
|
-
|
|
18840
|
-
let pagesToUpdate = angularPageFiles;
|
|
18841
|
-
if (pagesToUpdate.length === 0 && state.dependencyGraph) {
|
|
18842
|
-
pagesToUpdate = resolveAngularPagesFromDependencyGraph(state, angularFiles);
|
|
18843
|
-
}
|
|
18844
|
-
if (isCssOnlyChange && angularCssFiles.length > 0) {
|
|
20250
|
+
if (isCssOnlyChange) {
|
|
18845
20251
|
handleAngularCssOnlyUpdate(state, angularCssFiles, manifest, duration);
|
|
18846
|
-
return;
|
|
18847
20252
|
}
|
|
18848
|
-
const filesToClassifySlow = filterToUserEdits(angularFiles, state.lastUserEditedFiles);
|
|
18849
|
-
const classification = collapseClassifications(filesToClassifySlow.map(classifyAngularEdit));
|
|
18850
|
-
pagesToUpdate.forEach((angularPagePath) => {
|
|
18851
|
-
broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration, classification);
|
|
18852
|
-
});
|
|
18853
20253
|
}, handleHTMXScriptHMR = (state, filesToRebuild, manifest, duration) => {
|
|
18854
20254
|
if (!state.resolvedPaths.htmxDir) {
|
|
18855
20255
|
return;
|
|
@@ -18904,7 +20304,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18904
20304
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
18905
20305
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
18906
20306
|
const htmxPageName = basename12(htmxPageFile);
|
|
18907
|
-
const builtHtmxPagePath =
|
|
20307
|
+
const builtHtmxPagePath = resolve35(outputHtmxPages, htmxPageName);
|
|
18908
20308
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
18909
20309
|
});
|
|
18910
20310
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -19013,7 +20413,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19013
20413
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
19014
20414
|
writeFs(destPath, html);
|
|
19015
20415
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
19016
|
-
const destPath =
|
|
20416
|
+
const destPath = resolve35(outputDir, basename12(sourceFile));
|
|
19017
20417
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
19018
20418
|
const source = await Bun.file(sourceFile).text();
|
|
19019
20419
|
await Bun.write(destPath, source);
|
|
@@ -19259,7 +20659,6 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
19259
20659
|
init_compileTailwind();
|
|
19260
20660
|
init_tailwindCompiler();
|
|
19261
20661
|
init_ssrCache();
|
|
19262
|
-
init_editTypeDetection();
|
|
19263
20662
|
moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
19264
20663
|
getReactModuleUrl = getModuleUrl;
|
|
19265
20664
|
EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
|
|
@@ -19293,7 +20692,7 @@ __export(exports_buildDepVendor, {
|
|
|
19293
20692
|
buildDepVendor: () => buildDepVendor
|
|
19294
20693
|
});
|
|
19295
20694
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
19296
|
-
import { join as
|
|
20695
|
+
import { join as join30 } from "path";
|
|
19297
20696
|
import { rm as rm10 } from "fs/promises";
|
|
19298
20697
|
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
19299
20698
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -19347,7 +20746,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
19347
20746
|
framework: Array.from(framework).filter(isResolvable4)
|
|
19348
20747
|
};
|
|
19349
20748
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
19350
|
-
const { readFileSync:
|
|
20749
|
+
const { readFileSync: readFileSync20 } = await import("fs");
|
|
19351
20750
|
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
19352
20751
|
const newSpecs = new Set;
|
|
19353
20752
|
for (const spec of specs) {
|
|
@@ -19362,7 +20761,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
19362
20761
|
}
|
|
19363
20762
|
let content;
|
|
19364
20763
|
try {
|
|
19365
|
-
content =
|
|
20764
|
+
content = readFileSync20(resolved, "utf-8");
|
|
19366
20765
|
} catch {
|
|
19367
20766
|
continue;
|
|
19368
20767
|
}
|
|
@@ -19404,7 +20803,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
19404
20803
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
19405
20804
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
19406
20805
|
const safeName = toSafeFileName6(specifier);
|
|
19407
|
-
const entryPath =
|
|
20806
|
+
const entryPath = join30(tmpDir, `${safeName}.ts`);
|
|
19408
20807
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
19409
20808
|
return { entryPath, specifier };
|
|
19410
20809
|
}));
|
|
@@ -19465,9 +20864,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
19465
20864
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
19466
20865
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
19467
20866
|
return {};
|
|
19468
|
-
const vendorDir =
|
|
20867
|
+
const vendorDir = join30(buildDir, "vendor");
|
|
19469
20868
|
mkdirSync13(vendorDir, { recursive: true });
|
|
19470
|
-
const tmpDir =
|
|
20869
|
+
const tmpDir = join30(buildDir, "_dep_vendor_tmp");
|
|
19471
20870
|
mkdirSync13(tmpDir, { recursive: true });
|
|
19472
20871
|
const allSpecs = new Set(initialSpecs);
|
|
19473
20872
|
const alreadyScanned = new Set;
|
|
@@ -19549,8 +20948,8 @@ __export(exports_devBuild, {
|
|
|
19549
20948
|
devBuild: () => devBuild
|
|
19550
20949
|
});
|
|
19551
20950
|
import { readdir as readdir5 } from "fs/promises";
|
|
19552
|
-
import { statSync as
|
|
19553
|
-
import { resolve as
|
|
20951
|
+
import { statSync as statSync4 } from "fs";
|
|
20952
|
+
import { resolve as resolve36 } from "path";
|
|
19554
20953
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
19555
20954
|
const configuredDirs = [
|
|
19556
20955
|
config.reactDirectory,
|
|
@@ -19573,7 +20972,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19573
20972
|
return Object.keys(config).length > 0 ? config : null;
|
|
19574
20973
|
}, reloadConfig = async () => {
|
|
19575
20974
|
try {
|
|
19576
|
-
const configPath2 =
|
|
20975
|
+
const configPath2 = resolve36(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
19577
20976
|
const source = await Bun.file(configPath2).text();
|
|
19578
20977
|
return parseDirectoryConfig(source);
|
|
19579
20978
|
} catch {
|
|
@@ -19658,7 +21057,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19658
21057
|
state.fileChangeQueue.clear();
|
|
19659
21058
|
}
|
|
19660
21059
|
}, handleCachedReload = async () => {
|
|
19661
|
-
const serverMtime =
|
|
21060
|
+
const serverMtime = statSync4(resolve36(Bun.main)).mtimeMs;
|
|
19662
21061
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
19663
21062
|
globalThis.__hmrServerMtime = serverMtime;
|
|
19664
21063
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -19695,8 +21094,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19695
21094
|
return true;
|
|
19696
21095
|
}, resolveAbsoluteVersion2 = async () => {
|
|
19697
21096
|
const candidates = [
|
|
19698
|
-
|
|
19699
|
-
|
|
21097
|
+
resolve36(import.meta.dir, "..", "..", "package.json"),
|
|
21098
|
+
resolve36(import.meta.dir, "..", "package.json")
|
|
19700
21099
|
];
|
|
19701
21100
|
const [candidate, ...remaining] = candidates;
|
|
19702
21101
|
if (!candidate) {
|
|
@@ -19722,7 +21121,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19722
21121
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
19723
21122
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
19724
21123
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
19725
|
-
const bytes = await Bun.file(
|
|
21124
|
+
const bytes = await Bun.file(resolve36(vendorDir, entry)).bytes();
|
|
19726
21125
|
assetStore.set(webPath, bytes);
|
|
19727
21126
|
}));
|
|
19728
21127
|
}, devBuild = async (config) => {
|
|
@@ -19790,11 +21189,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19790
21189
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
19791
21190
|
recordStep("populate asset store", stepStartedAt);
|
|
19792
21191
|
stepStartedAt = performance.now();
|
|
19793
|
-
const reactVendorDir =
|
|
19794
|
-
const angularVendorDir =
|
|
19795
|
-
const svelteVendorDir =
|
|
19796
|
-
const vueVendorDir =
|
|
19797
|
-
const depVendorDir =
|
|
21192
|
+
const reactVendorDir = resolve36(state.resolvedPaths.buildDir, "react", "vendor");
|
|
21193
|
+
const angularVendorDir = resolve36(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
21194
|
+
const svelteVendorDir = resolve36(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
21195
|
+
const vueVendorDir = resolve36(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
21196
|
+
const depVendorDir = resolve36(state.resolvedPaths.buildDir, "vendor");
|
|
19798
21197
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
19799
21198
|
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
19800
21199
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -19872,7 +21271,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19872
21271
|
manifest
|
|
19873
21272
|
};
|
|
19874
21273
|
globalThis.__hmrDevResult = result;
|
|
19875
|
-
globalThis.__hmrServerMtime =
|
|
21274
|
+
globalThis.__hmrServerMtime = statSync4(resolve36(Bun.main)).mtimeMs;
|
|
19876
21275
|
return result;
|
|
19877
21276
|
};
|
|
19878
21277
|
var init_devBuild = __esm(() => {
|
|
@@ -19909,5 +21308,5 @@ export {
|
|
|
19909
21308
|
build
|
|
19910
21309
|
};
|
|
19911
21310
|
|
|
19912
|
-
//# debugId=
|
|
21311
|
+
//# debugId=A6EDFBBC6FF9BB9264756E2164756E21
|
|
19913
21312
|
//# sourceMappingURL=build.js.map
|