@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/index.js
CHANGED
|
@@ -8573,6 +8573,8 @@ var colors2, frameworkColors, formatPath = (filePath) => {
|
|
|
8573
8573
|
console.error(`${timestamp} ${tag} ${fullMessage}`);
|
|
8574
8574
|
}, logHmrUpdate = (path, framework, duration) => {
|
|
8575
8575
|
log("hmr update", { duration, framework, path });
|
|
8576
|
+
}, logInfo = (message) => {
|
|
8577
|
+
log(message);
|
|
8576
8578
|
}, logScriptUpdate = (path, framework, duration) => {
|
|
8577
8579
|
log("script update", { duration, framework, path });
|
|
8578
8580
|
}, logServerReload = () => {
|
|
@@ -9823,19 +9825,87 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
9823
9825
|
angularLinkerPlugin = createAngularLinkerPlugin(false);
|
|
9824
9826
|
});
|
|
9825
9827
|
|
|
9828
|
+
// src/dev/angular/hmrInjectionPlugin.ts
|
|
9829
|
+
var exports_hmrInjectionPlugin = {};
|
|
9830
|
+
__export(exports_hmrInjectionPlugin, {
|
|
9831
|
+
createAngularHmrInjectionPlugin: () => createAngularHmrInjectionPlugin
|
|
9832
|
+
});
|
|
9833
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
9834
|
+
import { relative as relative6, resolve as resolve15 } from "path";
|
|
9835
|
+
var COMPONENT_DECORATOR_RE, buildHmrTail = (className, encodedIdLiteral) => `
|
|
9836
|
+
|
|
9837
|
+
// absolutejs HMR \u2014 auto-generated; mirrors compileHmrInitializer from
|
|
9838
|
+
// @angular/compiler with import.meta.hot adapted to globalThis.__angularHmr.
|
|
9839
|
+
{
|
|
9840
|
+
const __ng_hmr_id = ${encodedIdLiteral};
|
|
9841
|
+
const __ng_hmr_load = async (t) => {
|
|
9842
|
+
const [u, core] = await Promise.all([
|
|
9843
|
+
import('/@ng/component?c=' + encodeURIComponent(__ng_hmr_id) + '&t=' + t),
|
|
9844
|
+
import('@angular/core')
|
|
9845
|
+
]);
|
|
9846
|
+
if (u && typeof u.default === 'function') u.default(${className}, [core]);
|
|
9847
|
+
};
|
|
9848
|
+
if (typeof globalThis !== 'undefined' &&
|
|
9849
|
+
globalThis.__angularHmr &&
|
|
9850
|
+
typeof globalThis.__angularHmr.on === 'function') {
|
|
9851
|
+
globalThis.__angularHmr.on('angular:component-update', (d) => {
|
|
9852
|
+
if (d && d.id === __ng_hmr_id) __ng_hmr_load(d.timestamp);
|
|
9853
|
+
});
|
|
9854
|
+
}
|
|
9855
|
+
}
|
|
9856
|
+
`, createAngularHmrInjectionPlugin = (params) => {
|
|
9857
|
+
const { generatedAngularRoot, userAngularRoot, projectRoot } = params;
|
|
9858
|
+
const normalizedGenRoot = resolve15(generatedAngularRoot).replace(/\\/g, "/");
|
|
9859
|
+
return {
|
|
9860
|
+
name: "absolute-angular-hmr-injection",
|
|
9861
|
+
setup(build2) {
|
|
9862
|
+
build2.onLoad({ filter: /\.component\.js$/ }, async (args) => {
|
|
9863
|
+
const normalizedPath = args.path.replace(/\\/g, "/");
|
|
9864
|
+
if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
|
|
9865
|
+
return;
|
|
9866
|
+
const text = await readFile5(args.path, "utf8");
|
|
9867
|
+
const seen = new Set;
|
|
9868
|
+
const classNames = [];
|
|
9869
|
+
let match;
|
|
9870
|
+
const re2 = new RegExp(COMPONENT_DECORATOR_RE.source, COMPONENT_DECORATOR_RE.flags);
|
|
9871
|
+
while ((match = re2.exec(text)) !== null) {
|
|
9872
|
+
const className = match[1];
|
|
9873
|
+
if (className && !seen.has(className)) {
|
|
9874
|
+
seen.add(className);
|
|
9875
|
+
classNames.push(className);
|
|
9876
|
+
}
|
|
9877
|
+
}
|
|
9878
|
+
if (classNames.length === 0)
|
|
9879
|
+
return;
|
|
9880
|
+
const relFromGenRoot = relative6(generatedAngularRoot, args.path).replace(/\\/g, "/");
|
|
9881
|
+
const userTsPath = resolve15(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
|
|
9882
|
+
const projectRel = relative6(projectRoot, userTsPath).replace(/\\/g, "/");
|
|
9883
|
+
const tail = classNames.map((className) => {
|
|
9884
|
+
const id = `${projectRel}@${className}`;
|
|
9885
|
+
return buildHmrTail(className, JSON.stringify(id));
|
|
9886
|
+
}).join("");
|
|
9887
|
+
return { contents: text + tail, loader: "js" };
|
|
9888
|
+
});
|
|
9889
|
+
}
|
|
9890
|
+
};
|
|
9891
|
+
};
|
|
9892
|
+
var init_hmrInjectionPlugin = __esm(() => {
|
|
9893
|
+
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;
|
|
9894
|
+
});
|
|
9895
|
+
|
|
9826
9896
|
// src/utils/cleanStaleOutputs.ts
|
|
9827
9897
|
import { rm as rm2 } from "fs/promises";
|
|
9828
|
-
import { resolve as
|
|
9898
|
+
import { resolve as resolve16 } from "path";
|
|
9829
9899
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
9830
9900
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
9831
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
9901
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve16(path)));
|
|
9832
9902
|
const glob = new Glob5("**/*");
|
|
9833
9903
|
const removals = [];
|
|
9834
|
-
for (const
|
|
9835
|
-
const absolute =
|
|
9904
|
+
for (const relative7 of glob.scanSync({ cwd: buildPath })) {
|
|
9905
|
+
const absolute = resolve16(buildPath, relative7);
|
|
9836
9906
|
if (currentPaths.has(absolute))
|
|
9837
9907
|
continue;
|
|
9838
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
9908
|
+
if (!HASHED_FILE_PATTERN.test(relative7))
|
|
9839
9909
|
continue;
|
|
9840
9910
|
removals.push(rm2(absolute, { force: true }));
|
|
9841
9911
|
}
|
|
@@ -10064,11 +10134,11 @@ var init_buildDirectoryLock = __esm(() => {
|
|
|
10064
10134
|
});
|
|
10065
10135
|
|
|
10066
10136
|
// src/utils/validateSafePath.ts
|
|
10067
|
-
import { resolve as
|
|
10137
|
+
import { resolve as resolve17, relative as relative7 } from "path";
|
|
10068
10138
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
10069
|
-
const absoluteBase =
|
|
10070
|
-
const absoluteTarget =
|
|
10071
|
-
const relativePath = normalizePath(
|
|
10139
|
+
const absoluteBase = resolve17(baseDirectory);
|
|
10140
|
+
const absoluteTarget = resolve17(baseDirectory, targetPath);
|
|
10141
|
+
const relativePath = normalizePath(relative7(absoluteBase, absoluteTarget));
|
|
10072
10142
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
10073
10143
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
10074
10144
|
}
|
|
@@ -10145,22 +10215,22 @@ import {
|
|
|
10145
10215
|
join as join16,
|
|
10146
10216
|
basename as basename5,
|
|
10147
10217
|
extname as extname5,
|
|
10148
|
-
resolve as
|
|
10149
|
-
relative as
|
|
10218
|
+
resolve as resolve18,
|
|
10219
|
+
relative as relative8,
|
|
10150
10220
|
sep as sep2
|
|
10151
10221
|
} from "path";
|
|
10152
10222
|
import { env as env2 } from "process";
|
|
10153
10223
|
var {write, file: file2, Transpiler } = globalThis.Bun;
|
|
10154
10224
|
var resolveDevClientDir2 = () => {
|
|
10155
10225
|
const projectRoot = process.cwd();
|
|
10156
|
-
const fromSource =
|
|
10226
|
+
const fromSource = resolve18(import.meta.dir, "../dev/client");
|
|
10157
10227
|
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10158
10228
|
return fromSource;
|
|
10159
10229
|
}
|
|
10160
|
-
const fromNodeModules =
|
|
10230
|
+
const fromNodeModules = resolve18(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
10161
10231
|
if (existsSync15(fromNodeModules))
|
|
10162
10232
|
return fromNodeModules;
|
|
10163
|
-
return
|
|
10233
|
+
return resolve18(import.meta.dir, "./dev/client");
|
|
10164
10234
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
10165
10235
|
persistentCache.clear();
|
|
10166
10236
|
sourceHashCache.clear();
|
|
@@ -10190,7 +10260,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10190
10260
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
10191
10261
|
if (!spec.startsWith("."))
|
|
10192
10262
|
return null;
|
|
10193
|
-
const basePath =
|
|
10263
|
+
const basePath = resolve18(dirname11(from), spec);
|
|
10194
10264
|
const candidates = [
|
|
10195
10265
|
basePath,
|
|
10196
10266
|
`${basePath}.ts`,
|
|
@@ -10217,7 +10287,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10217
10287
|
const resolved = resolvePackageImport(spec);
|
|
10218
10288
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
10219
10289
|
}
|
|
10220
|
-
const basePath =
|
|
10290
|
+
const basePath = resolve18(dirname11(from), spec);
|
|
10221
10291
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
10222
10292
|
if (!explicit) {
|
|
10223
10293
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -10238,8 +10308,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10238
10308
|
return jsPath;
|
|
10239
10309
|
return null;
|
|
10240
10310
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
10241
|
-
const toServer =
|
|
10242
|
-
const toClient =
|
|
10311
|
+
const toServer = relative8(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
10312
|
+
const toClient = relative8(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
10243
10313
|
rewrites.set(rawSpec, {
|
|
10244
10314
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
10245
10315
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -10277,8 +10347,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10277
10347
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
10278
10348
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
10279
10349
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedClient) : preprocessedClient;
|
|
10280
|
-
const rawRel = dirname11(
|
|
10281
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
10350
|
+
const rawRel = dirname11(relative8(svelteRoot, src)).replace(/\\/g, "/");
|
|
10351
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative8(process.cwd(), dirname11(src)).replace(/\\/g, "/")}` : rawRel;
|
|
10282
10352
|
const baseName = basename5(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
10283
10353
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
10284
10354
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -10299,15 +10369,15 @@ var resolveDevClientDir2 = () => {
|
|
|
10299
10369
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
10300
10370
|
if (!resolved)
|
|
10301
10371
|
continue;
|
|
10302
|
-
const childRel =
|
|
10372
|
+
const childRel = relative8(svelteRoot, resolved).replace(/\\/g, "/");
|
|
10303
10373
|
if (!childRel.startsWith(".."))
|
|
10304
10374
|
continue;
|
|
10305
10375
|
const childBuilt2 = cache.get(resolved);
|
|
10306
10376
|
if (!childBuilt2)
|
|
10307
10377
|
continue;
|
|
10308
10378
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
10309
|
-
const toServer =
|
|
10310
|
-
const toClient =
|
|
10379
|
+
const toServer = relative8(ssrOutputDir, childBuilt2.ssr).replace(/\\/g, "/");
|
|
10380
|
+
const toClient = relative8(clientOutputDir, childBuilt2.client).replace(/\\/g, "/");
|
|
10311
10381
|
externalRewrites.set(origSpec, {
|
|
10312
10382
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
10313
10383
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -10341,7 +10411,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10341
10411
|
}).js.code;
|
|
10342
10412
|
let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
10343
10413
|
if (mode === "client" && isDev2) {
|
|
10344
|
-
const moduleKey = `/@src/${
|
|
10414
|
+
const moduleKey = `/@src/${relative8(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
10345
10415
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
10346
10416
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10347
10417
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -10384,10 +10454,10 @@ var resolveDevClientDir2 = () => {
|
|
|
10384
10454
|
};
|
|
10385
10455
|
const roots = await Promise.all(entryPoints.map(build2));
|
|
10386
10456
|
await Promise.all(roots.map(async ({ client: client2, hasAwaitSlot }) => {
|
|
10387
|
-
const relClientDir = dirname11(
|
|
10457
|
+
const relClientDir = dirname11(relative8(clientDir, client2));
|
|
10388
10458
|
const name = basename5(client2, extname5(client2));
|
|
10389
10459
|
const indexPath = join16(indexDir, relClientDir, `${name}.js`);
|
|
10390
|
-
const importRaw =
|
|
10460
|
+
const importRaw = relative8(dirname11(indexPath), client2).split(sep2).join("/");
|
|
10391
10461
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
10392
10462
|
const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
10393
10463
|
import "${hmrClientPath3}";
|
|
@@ -10464,7 +10534,7 @@ if (typeof window !== "undefined") {
|
|
|
10464
10534
|
return {
|
|
10465
10535
|
svelteClientPaths: roots.map(({ client: client2 }) => client2),
|
|
10466
10536
|
svelteIndexPaths: roots.map(({ client: client2 }) => {
|
|
10467
|
-
const rel = dirname11(
|
|
10537
|
+
const rel = dirname11(relative8(clientDir, client2));
|
|
10468
10538
|
return join16(indexDir, rel, basename5(client2));
|
|
10469
10539
|
}),
|
|
10470
10540
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -10553,20 +10623,20 @@ import {
|
|
|
10553
10623
|
dirname as dirname12,
|
|
10554
10624
|
isAbsolute as isAbsolute3,
|
|
10555
10625
|
join as join17,
|
|
10556
|
-
relative as
|
|
10557
|
-
resolve as
|
|
10626
|
+
relative as relative9,
|
|
10627
|
+
resolve as resolve19
|
|
10558
10628
|
} from "path";
|
|
10559
10629
|
var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
10560
10630
|
var resolveDevClientDir3 = () => {
|
|
10561
10631
|
const projectRoot = process.cwd();
|
|
10562
|
-
const fromSource =
|
|
10632
|
+
const fromSource = resolve19(import.meta.dir, "../dev/client");
|
|
10563
10633
|
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10564
10634
|
return fromSource;
|
|
10565
10635
|
}
|
|
10566
|
-
const fromNodeModules =
|
|
10636
|
+
const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
10567
10637
|
if (existsSync16(fromNodeModules))
|
|
10568
10638
|
return fromNodeModules;
|
|
10569
|
-
return
|
|
10639
|
+
return resolve19(import.meta.dir, "./dev/client");
|
|
10570
10640
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
10571
10641
|
scriptCache.clear();
|
|
10572
10642
|
scriptSetupCache.clear();
|
|
@@ -10605,14 +10675,14 @@ var resolveDevClientDir3 = () => {
|
|
|
10605
10675
|
return "template-only";
|
|
10606
10676
|
}
|
|
10607
10677
|
return "full";
|
|
10608
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
10678
|
+
}, 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) => {
|
|
10609
10679
|
if (filePath.endsWith(".vue"))
|
|
10610
10680
|
return filePath.replace(/\.vue$/, ".js");
|
|
10611
10681
|
if (filePath.endsWith(".ts"))
|
|
10612
10682
|
return filePath.replace(/\.ts$/, ".js");
|
|
10613
10683
|
if (isStylePath(filePath)) {
|
|
10614
10684
|
if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
|
|
10615
|
-
return
|
|
10685
|
+
return resolve19(sourceDir, filePath);
|
|
10616
10686
|
}
|
|
10617
10687
|
return filePath;
|
|
10618
10688
|
}
|
|
@@ -10638,7 +10708,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10638
10708
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
10639
10709
|
if (cachedResult)
|
|
10640
10710
|
return cachedResult;
|
|
10641
|
-
const relativeFilePath =
|
|
10711
|
+
const relativeFilePath = relative9(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
10642
10712
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
10643
10713
|
const fileBaseName = basename6(sourceFilePath, ".vue");
|
|
10644
10714
|
const componentId = toKebab(fileBaseName);
|
|
@@ -10676,12 +10746,12 @@ var resolveDevClientDir3 = () => {
|
|
|
10676
10746
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
10677
10747
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
10678
10748
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
10679
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path :
|
|
10749
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute3(path)) && isStylePath(path)).map((path) => isAbsolute3(path) ? path : resolve19(dirname12(sourceFilePath), path));
|
|
10680
10750
|
for (const stylePath of stylePathsImported) {
|
|
10681
10751
|
addStyleImporter(sourceFilePath, stylePath);
|
|
10682
10752
|
}
|
|
10683
10753
|
const childBuildResults = await Promise.all([
|
|
10684
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
10754
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve19(dirname12(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
10685
10755
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
10686
10756
|
]);
|
|
10687
10757
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -10772,7 +10842,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10772
10842
|
let result2 = code;
|
|
10773
10843
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
10774
10844
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
10775
|
-
let rel =
|
|
10845
|
+
let rel = relative9(dirname12(outputPath), targetPath).replace(/\\/g, "/");
|
|
10776
10846
|
if (!rel.startsWith("."))
|
|
10777
10847
|
rel = `./${rel}`;
|
|
10778
10848
|
result2 = result2.replaceAll(bareImport, rel);
|
|
@@ -10790,7 +10860,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10790
10860
|
hmrId,
|
|
10791
10861
|
serverPath: serverOutputPath,
|
|
10792
10862
|
tsHelperPaths: [
|
|
10793
|
-
...helperModulePaths.map((helper) =>
|
|
10863
|
+
...helperModulePaths.map((helper) => resolve19(dirname12(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
10794
10864
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
10795
10865
|
]
|
|
10796
10866
|
};
|
|
@@ -10813,7 +10883,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10813
10883
|
const buildCache = new Map;
|
|
10814
10884
|
const allTsHelperPaths = new Set;
|
|
10815
10885
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
10816
|
-
const result = await compileVueFile(
|
|
10886
|
+
const result = await compileVueFile(resolve19(entryPath), {
|
|
10817
10887
|
client: clientOutputDir,
|
|
10818
10888
|
css: cssOutputDir,
|
|
10819
10889
|
server: serverOutputDir
|
|
@@ -10821,7 +10891,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10821
10891
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
10822
10892
|
const entryBaseName = basename6(entryPath, ".vue");
|
|
10823
10893
|
const indexOutputFile = join17(indexOutputDir, `${entryBaseName}.js`);
|
|
10824
|
-
const clientOutputFile = join17(clientOutputDir,
|
|
10894
|
+
const clientOutputFile = join17(clientOutputDir, relative9(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
10825
10895
|
await mkdir4(dirname12(indexOutputFile), { recursive: true });
|
|
10826
10896
|
const vueHmrImports = isDev2 ? [
|
|
10827
10897
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -10829,7 +10899,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10829
10899
|
] : [];
|
|
10830
10900
|
await write2(indexOutputFile, [
|
|
10831
10901
|
...vueHmrImports,
|
|
10832
|
-
`import Comp, * as PageModule from "${
|
|
10902
|
+
`import Comp, * as PageModule from "${relative9(dirname12(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
10833
10903
|
'import { createSSRApp, createApp } from "vue";',
|
|
10834
10904
|
"",
|
|
10835
10905
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -10973,7 +11043,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10973
11043
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
10974
11044
|
const sourceCode = await file3(tsPath).text();
|
|
10975
11045
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
10976
|
-
const relativeJsPath =
|
|
11046
|
+
const relativeJsPath = relative9(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
10977
11047
|
const outClientPath = join17(clientOutputDir, relativeJsPath);
|
|
10978
11048
|
const outServerPath = join17(serverOutputDir, relativeJsPath);
|
|
10979
11049
|
await mkdir4(dirname12(outClientPath), { recursive: true });
|
|
@@ -11478,17 +11548,17 @@ __export(exports_compileAngular, {
|
|
|
11478
11548
|
compileAngular: () => compileAngular
|
|
11479
11549
|
});
|
|
11480
11550
|
import { existsSync as existsSync17, readFileSync as readFileSync13, promises as fs } from "fs";
|
|
11481
|
-
import { join as join18, basename as basename7, sep as sep3, dirname as dirname13, resolve as
|
|
11551
|
+
import { join as join18, basename as basename7, sep as sep3, dirname as dirname13, resolve as resolve20, relative as relative10 } from "path";
|
|
11482
11552
|
import ts2 from "typescript";
|
|
11483
11553
|
var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
11484
11554
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
11485
11555
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata2) : await fn2();
|
|
11486
11556
|
}, readTsconfigPathAliases = () => {
|
|
11487
11557
|
try {
|
|
11488
|
-
const configPath2 =
|
|
11558
|
+
const configPath2 = resolve20(process.cwd(), "tsconfig.json");
|
|
11489
11559
|
const config = ts2.readConfigFile(configPath2, ts2.sys.readFile).config;
|
|
11490
11560
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
11491
|
-
const baseUrl =
|
|
11561
|
+
const baseUrl = resolve20(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
11492
11562
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
11493
11563
|
return { aliases, baseUrl };
|
|
11494
11564
|
} catch {
|
|
@@ -11508,7 +11578,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11508
11578
|
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
11509
11579
|
for (const replacement of alias.replacements) {
|
|
11510
11580
|
const candidate = replacement.replace("*", wildcardValue);
|
|
11511
|
-
const resolved = resolveSourceFile(
|
|
11581
|
+
const resolved = resolveSourceFile(resolve20(baseUrl, candidate));
|
|
11512
11582
|
if (resolved)
|
|
11513
11583
|
return resolved;
|
|
11514
11584
|
}
|
|
@@ -11527,13 +11597,13 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11527
11597
|
];
|
|
11528
11598
|
return candidates.find((file4) => existsSync17(file4));
|
|
11529
11599
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
11530
|
-
const baseDir =
|
|
11600
|
+
const baseDir = resolve20(rootDir);
|
|
11531
11601
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
11532
11602
|
const transpiler4 = new Bun.Transpiler({ loader: "tsx" });
|
|
11533
11603
|
const scanCache = new Map;
|
|
11534
11604
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
11535
11605
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
11536
|
-
return resolveSourceFile(
|
|
11606
|
+
return resolveSourceFile(resolve20(fromDir, specifier));
|
|
11537
11607
|
}
|
|
11538
11608
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
11539
11609
|
if (aliased)
|
|
@@ -11542,7 +11612,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11542
11612
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
11543
11613
|
if (resolved.includes("/node_modules/"))
|
|
11544
11614
|
return;
|
|
11545
|
-
const absolute =
|
|
11615
|
+
const absolute = resolve20(resolved);
|
|
11546
11616
|
if (!absolute.startsWith(baseDir))
|
|
11547
11617
|
return;
|
|
11548
11618
|
return resolveSourceFile(absolute);
|
|
@@ -11558,7 +11628,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11558
11628
|
usesLegacyAnimations: false
|
|
11559
11629
|
});
|
|
11560
11630
|
}
|
|
11561
|
-
const resolved =
|
|
11631
|
+
const resolved = resolve20(actualPath);
|
|
11562
11632
|
const cached = scanCache.get(resolved);
|
|
11563
11633
|
if (cached)
|
|
11564
11634
|
return cached;
|
|
@@ -11587,7 +11657,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11587
11657
|
const actualPath = resolveSourceFile(filePath);
|
|
11588
11658
|
if (!actualPath)
|
|
11589
11659
|
return false;
|
|
11590
|
-
const resolved =
|
|
11660
|
+
const resolved = resolve20(actualPath);
|
|
11591
11661
|
if (visited.has(resolved))
|
|
11592
11662
|
return false;
|
|
11593
11663
|
visited.add(resolved);
|
|
@@ -11605,34 +11675,15 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11605
11675
|
return (entryPath) => visit(entryPath);
|
|
11606
11676
|
}, resolveDevClientDir4 = () => {
|
|
11607
11677
|
const projectRoot = process.cwd();
|
|
11608
|
-
const fromSource =
|
|
11678
|
+
const fromSource = resolve20(import.meta.dir, "../dev/client");
|
|
11609
11679
|
if (existsSync17(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
11610
11680
|
return fromSource;
|
|
11611
11681
|
}
|
|
11612
|
-
const fromNodeModules =
|
|
11682
|
+
const fromNodeModules = resolve20(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
11613
11683
|
if (existsSync17(fromNodeModules))
|
|
11614
11684
|
return fromNodeModules;
|
|
11615
|
-
return
|
|
11616
|
-
}, devClientDir4, hmrClientPath5,
|
|
11617
|
-
const entityClassRegex = /(?:export\s+)?class\s+(\w+(?:Component|Service|Directive|Pipe))\s/g;
|
|
11618
|
-
const entityNames = [];
|
|
11619
|
-
let match;
|
|
11620
|
-
while ((match = entityClassRegex.exec(content)) !== null) {
|
|
11621
|
-
if (match[1])
|
|
11622
|
-
entityNames.push(match[1]);
|
|
11623
|
-
}
|
|
11624
|
-
if (entityNames.length === 0)
|
|
11625
|
-
return content;
|
|
11626
|
-
const registrations = entityNames.map((name) => ` if (typeof ${name} === 'function') window.__ANGULAR_HMR__.register('${sourceId}#${name}', ${name});`).join(`
|
|
11627
|
-
`);
|
|
11628
|
-
const hmrBlock = `
|
|
11629
|
-
// Angular HMR Runtime Layer (Level 3) \u2014 Auto-registration
|
|
11630
|
-
if (typeof window !== 'undefined' && window.__ANGULAR_HMR__) {
|
|
11631
|
-
${registrations}
|
|
11632
|
-
}
|
|
11633
|
-
`;
|
|
11634
|
-
return content + hmrBlock;
|
|
11635
|
-
}, formatDiagnosticMessage = (diagnostic) => {
|
|
11685
|
+
return resolve20(import.meta.dir, "./dev/client");
|
|
11686
|
+
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
11636
11687
|
try {
|
|
11637
11688
|
return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
11638
11689
|
`);
|
|
@@ -11674,11 +11725,11 @@ ${registrations}
|
|
|
11674
11725
|
if (hasJsLikeExtension(path))
|
|
11675
11726
|
return `${path}${query}`;
|
|
11676
11727
|
const importerDir = dirname13(importerOutputPath);
|
|
11677
|
-
const fileCandidate =
|
|
11728
|
+
const fileCandidate = resolve20(importerDir, `${path}.js`);
|
|
11678
11729
|
if (outputFiles?.has(fileCandidate) || existsSync17(fileCandidate)) {
|
|
11679
11730
|
return `${path}.js${query}`;
|
|
11680
11731
|
}
|
|
11681
|
-
const indexCandidate =
|
|
11732
|
+
const indexCandidate = resolve20(importerDir, path, "index.js");
|
|
11682
11733
|
if (outputFiles?.has(indexCandidate) || existsSync17(indexCandidate)) {
|
|
11683
11734
|
return `${path}/index.js${query}`;
|
|
11684
11735
|
}
|
|
@@ -11706,7 +11757,7 @@ ${registrations}
|
|
|
11706
11757
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
11707
11758
|
if (!isRelativeModuleSpecifier(specifier))
|
|
11708
11759
|
return null;
|
|
11709
|
-
const basePath =
|
|
11760
|
+
const basePath = resolve20(dirname13(fromFile), specifier);
|
|
11710
11761
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
11711
11762
|
`${basePath}.ts`,
|
|
11712
11763
|
`${basePath}.tsx`,
|
|
@@ -11717,9 +11768,9 @@ ${registrations}
|
|
|
11717
11768
|
join18(basePath, "index.mts"),
|
|
11718
11769
|
join18(basePath, "index.cts")
|
|
11719
11770
|
];
|
|
11720
|
-
return candidates.map((candidate) =>
|
|
11721
|
-
}, readFileForAotTransform = async (fileName,
|
|
11722
|
-
const hostSource =
|
|
11771
|
+
return candidates.map((candidate) => resolve20(candidate)).find((candidate) => existsSync17(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
11772
|
+
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
11773
|
+
const hostSource = readFile6?.(fileName);
|
|
11723
11774
|
if (typeof hostSource === "string")
|
|
11724
11775
|
return hostSource;
|
|
11725
11776
|
return fs.readFile(fileName, "utf-8");
|
|
@@ -11752,7 +11803,7 @@ ${registrations}
|
|
|
11752
11803
|
paths.push(join18(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
11753
11804
|
}
|
|
11754
11805
|
}
|
|
11755
|
-
return paths.map((path) =>
|
|
11806
|
+
return paths.map((path) => resolve20(path));
|
|
11756
11807
|
}, readResourceCacheFile = async (cachePath) => {
|
|
11757
11808
|
try {
|
|
11758
11809
|
const entry = JSON.parse(await fs.readFile(cachePath, "utf-8"));
|
|
@@ -11784,7 +11835,7 @@ ${registrations}
|
|
|
11784
11835
|
].join("\x00");
|
|
11785
11836
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
11786
11837
|
return join18(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
11787
|
-
}, precomputeAotResourceTransforms = async (inputPaths,
|
|
11838
|
+
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
11788
11839
|
const transformedSources = new Map;
|
|
11789
11840
|
const visited = new Set;
|
|
11790
11841
|
const stats = {
|
|
@@ -11794,14 +11845,14 @@ ${registrations}
|
|
|
11794
11845
|
transformedFiles: 0
|
|
11795
11846
|
};
|
|
11796
11847
|
const transformFile = async (filePath) => {
|
|
11797
|
-
const resolvedPath =
|
|
11848
|
+
const resolvedPath = resolve20(filePath);
|
|
11798
11849
|
if (visited.has(resolvedPath))
|
|
11799
11850
|
return;
|
|
11800
11851
|
visited.add(resolvedPath);
|
|
11801
11852
|
if (!existsSync17(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
11802
11853
|
return;
|
|
11803
11854
|
stats.filesVisited += 1;
|
|
11804
|
-
const source = await readFileForAotTransform(resolvedPath,
|
|
11855
|
+
const source = await readFileForAotTransform(resolvedPath, readFile6);
|
|
11805
11856
|
const cachePath = await resolveResourceTransformCachePath(resolvedPath, source, stylePreprocessors);
|
|
11806
11857
|
const cached = await readResourceCacheFile(cachePath);
|
|
11807
11858
|
let transformedSource;
|
|
@@ -11829,7 +11880,7 @@ ${registrations}
|
|
|
11829
11880
|
return { stats, transformedSources };
|
|
11830
11881
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
11831
11882
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
11832
|
-
const outputPath =
|
|
11883
|
+
const outputPath = resolve20(join18(outDir, relative10(process.cwd(), resolve20(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
11833
11884
|
return [
|
|
11834
11885
|
outputPath,
|
|
11835
11886
|
buildIslandMetadataExports(readFileSync13(inputPath, "utf-8"))
|
|
@@ -11840,7 +11891,7 @@ ${registrations}
|
|
|
11840
11891
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
11841
11892
|
const tsPath = __require.resolve("typescript");
|
|
11842
11893
|
const tsRootDir = dirname13(tsPath);
|
|
11843
|
-
return tsRootDir.endsWith("lib") ? tsRootDir :
|
|
11894
|
+
return tsRootDir.endsWith("lib") ? tsRootDir : resolve20(tsRootDir, "lib");
|
|
11844
11895
|
});
|
|
11845
11896
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
11846
11897
|
const options = {
|
|
@@ -11882,7 +11933,7 @@ ${registrations}
|
|
|
11882
11933
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
11883
11934
|
};
|
|
11884
11935
|
const emitted = {};
|
|
11885
|
-
const resolvedOutDir =
|
|
11936
|
+
const resolvedOutDir = resolve20(outDir);
|
|
11886
11937
|
host.writeFile = (fileName, text) => {
|
|
11887
11938
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
11888
11939
|
emitted[relativePath] = text;
|
|
@@ -11904,12 +11955,12 @@ ${registrations}
|
|
|
11904
11955
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
11905
11956
|
return source;
|
|
11906
11957
|
}
|
|
11907
|
-
const resolvedPath =
|
|
11958
|
+
const resolvedPath = resolve20(fileName);
|
|
11908
11959
|
return transformedSources.get(resolvedPath) ?? source;
|
|
11909
11960
|
};
|
|
11910
11961
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
11911
11962
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
11912
|
-
const source = transformedSources.get(
|
|
11963
|
+
const source = transformedSources.get(resolve20(fileName));
|
|
11913
11964
|
if (source) {
|
|
11914
11965
|
return ts2.createSourceFile(fileName, source, languageVersion, true);
|
|
11915
11966
|
}
|
|
@@ -11933,7 +11984,7 @@ ${registrations}
|
|
|
11933
11984
|
content,
|
|
11934
11985
|
target: join18(outDir, fileName)
|
|
11935
11986
|
}));
|
|
11936
|
-
const outputFiles = new Set(rawEntries.map(({ target }) =>
|
|
11987
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve20(target)));
|
|
11937
11988
|
return rawEntries.map(({ content, target }) => {
|
|
11938
11989
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
11939
11990
|
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
@@ -11948,7 +11999,7 @@ ${registrations}
|
|
|
11948
11999
|
return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
|
|
11949
12000
|
});
|
|
11950
12001
|
processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
|
|
11951
|
-
processedContent += islandMetadataByOutputPath.get(
|
|
12002
|
+
processedContent += islandMetadataByOutputPath.get(resolve20(target)) ?? "";
|
|
11952
12003
|
return { content: processedContent, target };
|
|
11953
12004
|
});
|
|
11954
12005
|
});
|
|
@@ -11969,7 +12020,7 @@ ${registrations}
|
|
|
11969
12020
|
}
|
|
11970
12021
|
return null;
|
|
11971
12022
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
11972
|
-
const sourceEntry =
|
|
12023
|
+
const sourceEntry = resolve20(import.meta.dir, "../angular/components/index.ts");
|
|
11973
12024
|
if (existsSync17(sourceEntry)) {
|
|
11974
12025
|
return sourceEntry.replace(/\\/g, "/");
|
|
11975
12026
|
}
|
|
@@ -12199,10 +12250,10 @@ ${fields}
|
|
|
12199
12250
|
source: result
|
|
12200
12251
|
};
|
|
12201
12252
|
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
|
|
12202
|
-
const entryPath =
|
|
12253
|
+
const entryPath = resolve20(inputPath);
|
|
12203
12254
|
const allOutputs = [];
|
|
12204
12255
|
const visited = new Set;
|
|
12205
|
-
const baseDir =
|
|
12256
|
+
const baseDir = resolve20(rootDir ?? process.cwd());
|
|
12206
12257
|
let usesLegacyAnimations = false;
|
|
12207
12258
|
const angularTranspiler = new Bun.Transpiler({
|
|
12208
12259
|
loader: "ts",
|
|
@@ -12229,7 +12280,7 @@ ${fields}
|
|
|
12229
12280
|
};
|
|
12230
12281
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
12231
12282
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
12232
|
-
return resolveSourceFile2(
|
|
12283
|
+
return resolveSourceFile2(resolve20(fromDir, specifier));
|
|
12233
12284
|
}
|
|
12234
12285
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile2);
|
|
12235
12286
|
if (aliased)
|
|
@@ -12238,7 +12289,7 @@ ${fields}
|
|
|
12238
12289
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
12239
12290
|
if (resolved.includes("/node_modules/"))
|
|
12240
12291
|
return;
|
|
12241
|
-
const absolute =
|
|
12292
|
+
const absolute = resolve20(resolved);
|
|
12242
12293
|
if (!absolute.startsWith(baseDir))
|
|
12243
12294
|
return;
|
|
12244
12295
|
return resolveSourceFile2(absolute);
|
|
@@ -12287,13 +12338,13 @@ ${fields}
|
|
|
12287
12338
|
return `${prefix}${dots}`;
|
|
12288
12339
|
return `${prefix}../${dots}`;
|
|
12289
12340
|
});
|
|
12290
|
-
if (
|
|
12341
|
+
if (resolve20(actualPath) === entryPath) {
|
|
12291
12342
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
12292
12343
|
}
|
|
12293
12344
|
return processedContent;
|
|
12294
12345
|
};
|
|
12295
12346
|
const transpileFile = async (filePath) => {
|
|
12296
|
-
const resolved =
|
|
12347
|
+
const resolved = resolve20(filePath);
|
|
12297
12348
|
if (visited.has(resolved))
|
|
12298
12349
|
return;
|
|
12299
12350
|
visited.add(resolved);
|
|
@@ -12330,7 +12381,7 @@ ${fields}
|
|
|
12330
12381
|
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
12331
12382
|
if (!resolved2)
|
|
12332
12383
|
return null;
|
|
12333
|
-
const relativeImport =
|
|
12384
|
+
const relativeImport = relative10(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
12334
12385
|
const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
|
|
12335
12386
|
importRewrites.set(specifier, relativeRewrite);
|
|
12336
12387
|
return resolved2;
|
|
@@ -12370,11 +12421,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12370
12421
|
const compiledRoot = compiledParent;
|
|
12371
12422
|
const indexesDir = join18(compiledParent, "indexes");
|
|
12372
12423
|
await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
|
|
12373
|
-
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) =>
|
|
12424
|
+
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve20(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
12374
12425
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
12375
12426
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
12376
|
-
const resolvedEntry =
|
|
12377
|
-
const relativeEntry =
|
|
12427
|
+
const resolvedEntry = resolve20(entry);
|
|
12428
|
+
const relativeEntry = relative10(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
12378
12429
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
12379
12430
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
12380
12431
|
entry: resolvedEntry
|
|
@@ -12385,10 +12436,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
12385
12436
|
join18(compiledRoot, relativeEntry),
|
|
12386
12437
|
join18(compiledRoot, "pages", jsName),
|
|
12387
12438
|
join18(compiledRoot, jsName)
|
|
12388
|
-
].map((file4) =>
|
|
12439
|
+
].map((file4) => resolve20(file4));
|
|
12389
12440
|
const resolveRawServerFile = (candidatePaths) => {
|
|
12390
12441
|
const normalizedCandidates = [
|
|
12391
|
-
...candidatePaths.map((file4) =>
|
|
12442
|
+
...candidatePaths.map((file4) => resolve20(file4)),
|
|
12392
12443
|
...compiledFallbackPaths
|
|
12393
12444
|
];
|
|
12394
12445
|
let candidate = normalizedCandidates.find((file4) => existsSync17(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
@@ -12455,14 +12506,10 @@ export default ${componentClassName};
|
|
|
12455
12506
|
export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
12456
12507
|
`;
|
|
12457
12508
|
}
|
|
12458
|
-
if (hmr) {
|
|
12459
|
-
rewritten = injectHMRRegistration(rewritten, resolvedEntry);
|
|
12460
|
-
}
|
|
12461
12509
|
await traceAngularPhase("wrapper/write-server-output", () => fs.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
|
|
12462
|
-
const relativePath =
|
|
12510
|
+
const relativePath = relative10(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
12463
12511
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
12464
12512
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
12465
|
-
import "${hmrRuntimePath}";
|
|
12466
12513
|
import "${hmrClientPath5}";
|
|
12467
12514
|
` : "";
|
|
12468
12515
|
const hydration = hmr ? `${hmrPreamble}
|
|
@@ -12504,68 +12551,66 @@ var absoluteHttpTransferCacheOptions = {
|
|
|
12504
12551
|
}
|
|
12505
12552
|
};
|
|
12506
12553
|
|
|
12507
|
-
//
|
|
12508
|
-
//
|
|
12509
|
-
//
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
//
|
|
12513
|
-
//
|
|
12514
|
-
//
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
var
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
if (
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12554
|
+
// SURGICAL_HMR Tier 1 \u2014 Re-bootstrap hook. The dev client invokes
|
|
12555
|
+
// \`window.__ABS_ANGULAR_REBOOTSTRAP__()\` when it receives an
|
|
12556
|
+
// \`angular:rebootstrap\` WS message; the hook looks up this page's
|
|
12557
|
+
// freshly-built bundle URL (the rebuild already broadcast its
|
|
12558
|
+
// updated manifest, so window.__HMR_MANIFEST__ is current) and
|
|
12559
|
+
// dynamic-imports it. Re-importing the chunk re-runs the
|
|
12560
|
+
// destroy+bootstrap block below \u2014 no special path needed because
|
|
12561
|
+
// chunk eval is the bootstrap.
|
|
12562
|
+
window.__ABS_ANGULAR_PAGE_BUNDLE_ID__ = '${toPascal(fileBase)}Index';
|
|
12563
|
+
window.__ABS_ANGULAR_REBOOTSTRAP__ = async function() {
|
|
12564
|
+
var id = window.__ABS_ANGULAR_PAGE_BUNDLE_ID__;
|
|
12565
|
+
var manifest = window.__HMR_MANIFEST__ || {};
|
|
12566
|
+
var newUrl = manifest[id];
|
|
12567
|
+
if (!newUrl) {
|
|
12568
|
+
console.warn('[absolutejs] no bundle URL in manifest for', id, '\u2014 full reload');
|
|
12569
|
+
window.location.reload();
|
|
12570
|
+
return;
|
|
12571
|
+
}
|
|
12572
|
+
await import(newUrl + '?t=' + Date.now());
|
|
12573
|
+
};
|
|
12574
|
+
|
|
12575
|
+
if (window.__ANGULAR_APP__) {
|
|
12576
|
+
try { window.__ANGULAR_APP__.destroy(); } catch (_err) { /* ignore */ }
|
|
12577
|
+
window.__ANGULAR_APP__ = null;
|
|
12578
|
+
}
|
|
12579
|
+
|
|
12580
|
+
// Ensure root element exists after destroy (Angular removes it)
|
|
12581
|
+
var _sel = ${componentClassName}.\u0275cmp?.selectors?.[0]?.[0] || 'ng-app';
|
|
12582
|
+
if (!document.querySelector(_sel)) {
|
|
12583
|
+
(document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
|
|
12584
|
+
}
|
|
12585
|
+
|
|
12586
|
+
var providers = [provideZonelessChangeDetection()];
|
|
12587
|
+
if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
|
|
12588
|
+
providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
|
|
12589
|
+
}
|
|
12590
|
+
delete window.__HMR_SKIP_HYDRATION__;
|
|
12591
|
+
providers.push.apply(providers, pageProviders);
|
|
12592
|
+
providers.push.apply(providers, propProviders);
|
|
12593
|
+
window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
|
|
12594
|
+
|
|
12595
|
+
if (pageHasRawStreamingSlots) {
|
|
12596
|
+
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12597
|
+
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12598
|
+
requestAnimationFrame(function() {
|
|
12599
|
+
window.__ABS_SLOT_FLUSH__();
|
|
12600
|
+
});
|
|
12601
|
+
}
|
|
12602
|
+
} else {
|
|
12603
|
+
bootstrapApplication(${componentClassName}, {
|
|
12604
|
+
providers: providers
|
|
12605
|
+
}).then(function (appRef) {
|
|
12606
|
+
window.__ANGULAR_APP__ = appRef;
|
|
12550
12607
|
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12551
12608
|
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12552
12609
|
requestAnimationFrame(function() {
|
|
12553
12610
|
window.__ABS_SLOT_FLUSH__();
|
|
12554
12611
|
});
|
|
12555
12612
|
}
|
|
12556
|
-
}
|
|
12557
|
-
bootstrapApplication(${componentClassName}, {
|
|
12558
|
-
providers: providers
|
|
12559
|
-
}).then(function (appRef) {
|
|
12560
|
-
window.__ANGULAR_APP__ = appRef;
|
|
12561
|
-
window.__ABS_SLOT_HYDRATION_PENDING__ = false;
|
|
12562
|
-
if (typeof window.__ABS_SLOT_FLUSH__ === 'function') {
|
|
12563
|
-
requestAnimationFrame(function() {
|
|
12564
|
-
window.__ABS_SLOT_FLUSH__();
|
|
12565
|
-
});
|
|
12566
|
-
}
|
|
12567
|
-
});
|
|
12568
|
-
}
|
|
12613
|
+
});
|
|
12569
12614
|
}
|
|
12570
12615
|
`.trim() : `
|
|
12571
12616
|
import '@angular/compiler';
|
|
@@ -12667,7 +12712,6 @@ var init_compileAngular = __esm(() => {
|
|
|
12667
12712
|
init_generatedDir();
|
|
12668
12713
|
devClientDir4 = resolveDevClientDir4();
|
|
12669
12714
|
hmrClientPath5 = join18(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
12670
|
-
hmrRuntimePath = join18(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
|
|
12671
12715
|
jitContentCache = new Map;
|
|
12672
12716
|
wrapperOutputCache = new Map;
|
|
12673
12717
|
});
|
|
@@ -13121,7 +13165,7 @@ __export(exports_compileEmber, {
|
|
|
13121
13165
|
});
|
|
13122
13166
|
import { existsSync as existsSync18 } from "fs";
|
|
13123
13167
|
import { mkdir as mkdir5, rm as rm4 } from "fs/promises";
|
|
13124
|
-
import { basename as basename8, dirname as dirname14, extname as extname6, join as join19, resolve as
|
|
13168
|
+
import { basename as basename8, dirname as dirname14, extname as extname6, join as join19, resolve as resolve21 } from "path";
|
|
13125
13169
|
var {build: bunBuild2, Transpiler: Transpiler3, write: write3, file: file4 } = globalThis.Bun;
|
|
13126
13170
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
13127
13171
|
if (cachedPreprocessor)
|
|
@@ -13217,7 +13261,7 @@ export const importSync = (specifier) => {
|
|
|
13217
13261
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
13218
13262
|
if (!originalImporter)
|
|
13219
13263
|
return;
|
|
13220
|
-
const candidateBase =
|
|
13264
|
+
const candidateBase = resolve21(dirname14(originalImporter), args.path);
|
|
13221
13265
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
13222
13266
|
for (const ext of extensionsToTry) {
|
|
13223
13267
|
const candidate = candidateBase + ext;
|
|
@@ -13276,7 +13320,7 @@ export const renderToHTML = (props = {}) => {
|
|
|
13276
13320
|
export { PageComponent };
|
|
13277
13321
|
export default PageComponent;
|
|
13278
13322
|
`, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
|
|
13279
|
-
const resolvedEntry =
|
|
13323
|
+
const resolvedEntry = resolve21(entry);
|
|
13280
13324
|
const source = await file4(resolvedEntry).text();
|
|
13281
13325
|
let preprocessed = source;
|
|
13282
13326
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -13296,8 +13340,8 @@ export default PageComponent;
|
|
|
13296
13340
|
mkdir5(serverDir, { recursive: true }),
|
|
13297
13341
|
mkdir5(clientDir, { recursive: true })
|
|
13298
13342
|
]);
|
|
13299
|
-
const tmpPagePath =
|
|
13300
|
-
const tmpHarnessPath =
|
|
13343
|
+
const tmpPagePath = resolve21(join19(tmpDir, `${baseName}.module.js`));
|
|
13344
|
+
const tmpHarnessPath = resolve21(join19(tmpDir, `${baseName}.harness.js`));
|
|
13301
13345
|
await Promise.all([
|
|
13302
13346
|
write3(tmpPagePath, transpiled),
|
|
13303
13347
|
write3(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -13339,7 +13383,7 @@ export default PageComponent;
|
|
|
13339
13383
|
serverPaths: outputs.map((o) => o.serverPath)
|
|
13340
13384
|
};
|
|
13341
13385
|
}, compileEmberFileSource = async (entry) => {
|
|
13342
|
-
const resolvedEntry =
|
|
13386
|
+
const resolvedEntry = resolve21(entry);
|
|
13343
13387
|
const source = await file4(resolvedEntry).text();
|
|
13344
13388
|
let preprocessed = source;
|
|
13345
13389
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -13372,24 +13416,24 @@ __export(exports_buildReactVendor, {
|
|
|
13372
13416
|
buildReactVendor: () => buildReactVendor
|
|
13373
13417
|
});
|
|
13374
13418
|
import { existsSync as existsSync19, mkdirSync as mkdirSync7 } from "fs";
|
|
13375
|
-
import { join as join20, resolve as
|
|
13419
|
+
import { join as join20, resolve as resolve22 } from "path";
|
|
13376
13420
|
import { rm as rm5 } from "fs/promises";
|
|
13377
13421
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
13378
13422
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
13379
13423
|
const candidates = [
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13424
|
+
resolve22(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
13425
|
+
resolve22(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13426
|
+
resolve22(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
13427
|
+
resolve22(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
13428
|
+
resolve22(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
13429
|
+
resolve22(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
13386
13430
|
];
|
|
13387
13431
|
for (const candidate of candidates) {
|
|
13388
13432
|
if (existsSync19(candidate)) {
|
|
13389
13433
|
return candidate.replace(/\\/g, "/");
|
|
13390
13434
|
}
|
|
13391
13435
|
}
|
|
13392
|
-
return (candidates[0] ??
|
|
13436
|
+
return (candidates[0] ?? resolve22(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
13393
13437
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
13394
13438
|
try {
|
|
13395
13439
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -14039,7 +14083,7 @@ import {
|
|
|
14039
14083
|
statSync,
|
|
14040
14084
|
writeFileSync as writeFileSync8
|
|
14041
14085
|
} from "fs";
|
|
14042
|
-
import { basename as basename9, dirname as dirname15, extname as extname7, join as join25, relative as
|
|
14086
|
+
import { basename as basename9, dirname as dirname15, extname as extname7, join as join25, relative as relative11, resolve as resolve23 } from "path";
|
|
14043
14087
|
import { cwd, env as env3, exit } from "process";
|
|
14044
14088
|
var {build: bunBuild7, Glob: Glob7 } = globalThis.Bun;
|
|
14045
14089
|
var isDev2, isBuildTraceEnabled = () => {
|
|
@@ -14130,8 +14174,8 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14130
14174
|
}
|
|
14131
14175
|
}, resolveAbsoluteVersion = async () => {
|
|
14132
14176
|
const candidates = [
|
|
14133
|
-
|
|
14134
|
-
|
|
14177
|
+
resolve23(import.meta.dir, "..", "..", "package.json"),
|
|
14178
|
+
resolve23(import.meta.dir, "..", "package.json")
|
|
14135
14179
|
];
|
|
14136
14180
|
const resolveCandidate = async (remaining) => {
|
|
14137
14181
|
const [candidate, ...rest] = remaining;
|
|
@@ -14147,7 +14191,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14147
14191
|
};
|
|
14148
14192
|
await resolveCandidate(candidates);
|
|
14149
14193
|
}, SKIP_DIRS, addWorkerPathIfExists = (file5, relPath, workerPaths) => {
|
|
14150
|
-
const absPath =
|
|
14194
|
+
const absPath = resolve23(file5, "..", relPath);
|
|
14151
14195
|
try {
|
|
14152
14196
|
statSync(absPath);
|
|
14153
14197
|
workerPaths.add(absPath);
|
|
@@ -14209,7 +14253,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14209
14253
|
return;
|
|
14210
14254
|
}
|
|
14211
14255
|
const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
|
|
14212
|
-
const pagesRel =
|
|
14256
|
+
const pagesRel = relative11(process.cwd(), resolve23(reactPagesPath)).replace(/\\/g, "/");
|
|
14213
14257
|
for (const file5 of indexFiles) {
|
|
14214
14258
|
let content = readFileSync14(join25(reactIndexesPath, file5), "utf-8");
|
|
14215
14259
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
@@ -14217,27 +14261,27 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14217
14261
|
}
|
|
14218
14262
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
14219
14263
|
const svelteIndexDir = join25(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
14220
|
-
const sveltePageEntries = svelteEntries.filter((file5) =>
|
|
14264
|
+
const sveltePageEntries = svelteEntries.filter((file5) => resolve23(file5).startsWith(resolve23(sveltePagesPath)));
|
|
14221
14265
|
for (const entry of sveltePageEntries) {
|
|
14222
14266
|
const name = basename9(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
14223
14267
|
const indexFile = join25(svelteIndexDir, "pages", `${name}.js`);
|
|
14224
14268
|
if (!existsSync20(indexFile))
|
|
14225
14269
|
continue;
|
|
14226
14270
|
let content = readFileSync14(indexFile, "utf-8");
|
|
14227
|
-
const srcRel =
|
|
14271
|
+
const srcRel = relative11(process.cwd(), resolve23(entry)).replace(/\\/g, "/");
|
|
14228
14272
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
14229
14273
|
writeFileSync8(join25(devIndexDir, `${name}.svelte.js`), content);
|
|
14230
14274
|
}
|
|
14231
14275
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
14232
14276
|
const vueIndexDir = join25(getFrameworkGeneratedDir("vue"), "indexes");
|
|
14233
|
-
const vuePageEntries = vueEntries.filter((file5) =>
|
|
14277
|
+
const vuePageEntries = vueEntries.filter((file5) => resolve23(file5).startsWith(resolve23(vuePagesPath)));
|
|
14234
14278
|
for (const entry of vuePageEntries) {
|
|
14235
14279
|
const name = basename9(entry, ".vue");
|
|
14236
14280
|
const indexFile = join25(vueIndexDir, `${name}.js`);
|
|
14237
14281
|
if (!existsSync20(indexFile))
|
|
14238
14282
|
continue;
|
|
14239
14283
|
let content = readFileSync14(indexFile, "utf-8");
|
|
14240
|
-
const srcRel =
|
|
14284
|
+
const srcRel = relative11(process.cwd(), resolve23(entry)).replace(/\\/g, "/");
|
|
14241
14285
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
14242
14286
|
writeFileSync8(join25(devIndexDir, `${name}.vue.js`), content);
|
|
14243
14287
|
}
|
|
@@ -14250,7 +14294,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
14250
14294
|
const last = allComments[allComments.length - 1];
|
|
14251
14295
|
if (!last?.[1])
|
|
14252
14296
|
return JSON.stringify(outputPath);
|
|
14253
|
-
const srcPath =
|
|
14297
|
+
const srcPath = resolve23(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
14254
14298
|
return JSON.stringify(srcPath);
|
|
14255
14299
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
14256
14300
|
let depth = 0;
|
|
@@ -14312,7 +14356,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14312
14356
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
14313
14357
|
const urlFileMap = new Map;
|
|
14314
14358
|
for (const srcPath of urlReferencedFiles) {
|
|
14315
|
-
const rel =
|
|
14359
|
+
const rel = relative11(projectRoot, srcPath).replace(/\\/g, "/");
|
|
14316
14360
|
const name = basename9(srcPath);
|
|
14317
14361
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
14318
14362
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -14327,7 +14371,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14327
14371
|
const output = nonReactClientOutputs.find((artifact) => basename9(artifact.path).startsWith(`${srcBase}.`));
|
|
14328
14372
|
if (!output)
|
|
14329
14373
|
continue;
|
|
14330
|
-
urlFileMap.set(basename9(srcPath), `/${
|
|
14374
|
+
urlFileMap.set(basename9(srcPath), `/${relative11(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
14331
14375
|
}
|
|
14332
14376
|
return urlFileMap;
|
|
14333
14377
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -14575,13 +14619,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14575
14619
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
14576
14620
|
if (!isIncremental || !incrementalFiles)
|
|
14577
14621
|
return entryPoints;
|
|
14578
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f2) =>
|
|
14622
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f2) => resolve23(f2)));
|
|
14579
14623
|
const matchingEntries = [];
|
|
14580
14624
|
for (const entry of entryPoints) {
|
|
14581
14625
|
const sourceFile = mapToSource(entry);
|
|
14582
14626
|
if (!sourceFile)
|
|
14583
14627
|
continue;
|
|
14584
|
-
if (!normalizedIncremental.has(
|
|
14628
|
+
if (!normalizedIncremental.has(resolve23(sourceFile)))
|
|
14585
14629
|
continue;
|
|
14586
14630
|
matchingEntries.push(entry);
|
|
14587
14631
|
}
|
|
@@ -14643,7 +14687,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14643
14687
|
}
|
|
14644
14688
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
14645
14689
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
14646
|
-
if (entry.startsWith(
|
|
14690
|
+
if (entry.startsWith(resolve23(reactIndexesPath))) {
|
|
14647
14691
|
const pageName = basename9(entry, ".tsx");
|
|
14648
14692
|
return join25(reactPagesPath, `${pageName}.tsx`);
|
|
14649
14693
|
}
|
|
@@ -14722,7 +14766,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14722
14766
|
const clientPath = islandSvelteClientPaths[idx];
|
|
14723
14767
|
if (!sourcePath || !clientPath)
|
|
14724
14768
|
continue;
|
|
14725
|
-
islandSvelteClientPathMap.set(
|
|
14769
|
+
islandSvelteClientPathMap.set(resolve23(sourcePath), clientPath);
|
|
14726
14770
|
}
|
|
14727
14771
|
const islandVueClientPathMap = new Map;
|
|
14728
14772
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -14730,7 +14774,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14730
14774
|
const clientPath = islandVueClientPaths[idx];
|
|
14731
14775
|
if (!sourcePath || !clientPath)
|
|
14732
14776
|
continue;
|
|
14733
|
-
islandVueClientPathMap.set(
|
|
14777
|
+
islandVueClientPathMap.set(resolve23(sourcePath), clientPath);
|
|
14734
14778
|
}
|
|
14735
14779
|
const islandAngularClientPathMap = new Map;
|
|
14736
14780
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -14738,7 +14782,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
14738
14782
|
const clientPath = islandAngularClientPaths[idx];
|
|
14739
14783
|
if (!sourcePath || !clientPath)
|
|
14740
14784
|
continue;
|
|
14741
|
-
islandAngularClientPathMap.set(
|
|
14785
|
+
islandAngularClientPathMap.set(resolve23(sourcePath), clientPath);
|
|
14742
14786
|
}
|
|
14743
14787
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
14744
14788
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -15051,6 +15095,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15051
15095
|
outdir: buildPath,
|
|
15052
15096
|
plugins: [
|
|
15053
15097
|
stylePreprocessorPlugin2,
|
|
15098
|
+
...angularDir && hmr ? [
|
|
15099
|
+
createAngularHmrInjectionPlugin({
|
|
15100
|
+
generatedAngularRoot: getFrameworkGeneratedDir("angular", projectRoot),
|
|
15101
|
+
projectRoot,
|
|
15102
|
+
userAngularRoot: angularDir
|
|
15103
|
+
})
|
|
15104
|
+
] : [],
|
|
15054
15105
|
...angularDir ? [createAngularLinkerPlugin(hmr)] : [],
|
|
15055
15106
|
...htmlScriptPlugin ? [htmlScriptPlugin] : []
|
|
15056
15107
|
],
|
|
@@ -15071,6 +15122,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15071
15122
|
outdir: buildPath,
|
|
15072
15123
|
plugins: [
|
|
15073
15124
|
stylePreprocessorPlugin2,
|
|
15125
|
+
...angularDir && hmr ? [
|
|
15126
|
+
createAngularHmrInjectionPlugin({
|
|
15127
|
+
generatedAngularRoot: getFrameworkGeneratedDir("angular", projectRoot),
|
|
15128
|
+
projectRoot,
|
|
15129
|
+
userAngularRoot: angularDir
|
|
15130
|
+
})
|
|
15131
|
+
] : [],
|
|
15074
15132
|
...angularDir ? [createAngularLinkerPlugin(hmr)] : []
|
|
15075
15133
|
],
|
|
15076
15134
|
root: islandEntryResult.generatedRoot,
|
|
@@ -15161,7 +15219,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15161
15219
|
const fileDir = dirname15(artifact.path);
|
|
15162
15220
|
const relativePaths = {};
|
|
15163
15221
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
15164
|
-
const rel =
|
|
15222
|
+
const rel = relative11(fileDir, absolute);
|
|
15165
15223
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
15166
15224
|
}
|
|
15167
15225
|
return relativePaths;
|
|
@@ -15366,6 +15424,7 @@ var init_build = __esm(() => {
|
|
|
15366
15424
|
init_rewriteReactImports();
|
|
15367
15425
|
init_telemetryEvent();
|
|
15368
15426
|
init_angularLinkerPlugin();
|
|
15427
|
+
init_hmrInjectionPlugin();
|
|
15369
15428
|
init_cleanStaleOutputs();
|
|
15370
15429
|
init_cleanup();
|
|
15371
15430
|
init_commonAncestor();
|
|
@@ -15580,7 +15639,7 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
15580
15639
|
// src/dev/dependencyGraph.ts
|
|
15581
15640
|
import { existsSync as existsSync22, readFileSync as readFileSync15 } from "fs";
|
|
15582
15641
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
15583
|
-
import { resolve as
|
|
15642
|
+
import { resolve as resolve24 } from "path";
|
|
15584
15643
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
15585
15644
|
const lower = filePath.toLowerCase();
|
|
15586
15645
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -15594,8 +15653,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15594
15653
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
15595
15654
|
return null;
|
|
15596
15655
|
}
|
|
15597
|
-
const fromDir =
|
|
15598
|
-
const normalized =
|
|
15656
|
+
const fromDir = resolve24(fromFile, "..");
|
|
15657
|
+
const normalized = resolve24(fromDir, importPath);
|
|
15599
15658
|
const extensions = [
|
|
15600
15659
|
".ts",
|
|
15601
15660
|
".tsx",
|
|
@@ -15625,7 +15684,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15625
15684
|
dependents.delete(normalizedPath);
|
|
15626
15685
|
}
|
|
15627
15686
|
}, addFileToGraph = (graph, filePath) => {
|
|
15628
|
-
const normalizedPath =
|
|
15687
|
+
const normalizedPath = resolve24(filePath);
|
|
15629
15688
|
if (!existsSync22(normalizedPath))
|
|
15630
15689
|
return;
|
|
15631
15690
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -15642,10 +15701,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15642
15701
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
15643
15702
|
const processedFiles = new Set;
|
|
15644
15703
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
15645
|
-
const resolvedDirs = directories.map((dir) =>
|
|
15704
|
+
const resolvedDirs = directories.map((dir) => resolve24(dir)).filter((dir) => existsSync22(dir));
|
|
15646
15705
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
15647
15706
|
for (const file5 of allFiles) {
|
|
15648
|
-
const fullPath =
|
|
15707
|
+
const fullPath = resolve24(file5);
|
|
15649
15708
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
15650
15709
|
continue;
|
|
15651
15710
|
if (processedFiles.has(fullPath))
|
|
@@ -15758,7 +15817,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15758
15817
|
return [];
|
|
15759
15818
|
}
|
|
15760
15819
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
15761
|
-
const normalizedPath =
|
|
15820
|
+
const normalizedPath = resolve24(changedFile);
|
|
15762
15821
|
const affected = new Set;
|
|
15763
15822
|
const toProcess = [normalizedPath];
|
|
15764
15823
|
const processNode = (current) => {
|
|
@@ -15798,7 +15857,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
15798
15857
|
}
|
|
15799
15858
|
graph.dependents.delete(normalizedPath);
|
|
15800
15859
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
15801
|
-
const normalizedPath =
|
|
15860
|
+
const normalizedPath = resolve24(filePath);
|
|
15802
15861
|
removeDepsForFile(graph, normalizedPath);
|
|
15803
15862
|
removeDependentsForFile(graph, normalizedPath);
|
|
15804
15863
|
};
|
|
@@ -15841,12 +15900,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
15841
15900
|
};
|
|
15842
15901
|
|
|
15843
15902
|
// src/dev/configResolver.ts
|
|
15844
|
-
import { resolve as
|
|
15903
|
+
import { resolve as resolve25 } from "path";
|
|
15845
15904
|
var resolveBuildPaths = (config) => {
|
|
15846
15905
|
const cwd2 = process.cwd();
|
|
15847
15906
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
15848
|
-
const withDefault = (value, fallback) => normalize(
|
|
15849
|
-
const optional = (value) => value ? normalize(
|
|
15907
|
+
const withDefault = (value, fallback) => normalize(resolve25(cwd2, value ?? fallback));
|
|
15908
|
+
const optional = (value) => value ? normalize(resolve25(cwd2, value)) : undefined;
|
|
15850
15909
|
return {
|
|
15851
15910
|
angularDir: optional(config.angularDirectory),
|
|
15852
15911
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -15898,8 +15957,8 @@ var init_clientManager = __esm(() => {
|
|
|
15898
15957
|
});
|
|
15899
15958
|
|
|
15900
15959
|
// src/dev/pathUtils.ts
|
|
15901
|
-
import { existsSync as existsSync23 } from "fs";
|
|
15902
|
-
import { resolve as
|
|
15960
|
+
import { existsSync as existsSync23, readdirSync, readFileSync as readFileSync16 } from "fs";
|
|
15961
|
+
import { dirname as dirname16, resolve as resolve26 } from "path";
|
|
15903
15962
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
15904
15963
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
15905
15964
|
return "ignored";
|
|
@@ -15973,13 +16032,80 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
15973
16032
|
return "assets";
|
|
15974
16033
|
}
|
|
15975
16034
|
return "unknown";
|
|
16035
|
+
}, collectAngularResourceDirs = (angularDir) => {
|
|
16036
|
+
const out = new Set;
|
|
16037
|
+
const angularRoot = resolve26(angularDir);
|
|
16038
|
+
const angularRootNormalized = normalizePath(angularRoot);
|
|
16039
|
+
const walk = (dir) => {
|
|
16040
|
+
let entries;
|
|
16041
|
+
try {
|
|
16042
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
16043
|
+
} catch {
|
|
16044
|
+
return;
|
|
16045
|
+
}
|
|
16046
|
+
for (const entry of entries) {
|
|
16047
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
16048
|
+
continue;
|
|
16049
|
+
}
|
|
16050
|
+
const full = resolve26(dir, entry.name);
|
|
16051
|
+
if (entry.isDirectory()) {
|
|
16052
|
+
walk(full);
|
|
16053
|
+
continue;
|
|
16054
|
+
}
|
|
16055
|
+
if (!entry.isFile() || !entry.name.endsWith(".component.ts")) {
|
|
16056
|
+
continue;
|
|
16057
|
+
}
|
|
16058
|
+
let source;
|
|
16059
|
+
try {
|
|
16060
|
+
source = readFileSync16(full, "utf8");
|
|
16061
|
+
} catch {
|
|
16062
|
+
continue;
|
|
16063
|
+
}
|
|
16064
|
+
const refs = [];
|
|
16065
|
+
const tplRe = /templateUrl\s*:\s*['"]([^'"]+)['"]/g;
|
|
16066
|
+
const styleRe = /styleUrl\s*:\s*['"]([^'"]+)['"]/g;
|
|
16067
|
+
const stylesArrRe = /styleUrls\s*:\s*\[([^\]]*)\]/g;
|
|
16068
|
+
const literalRe = /['"]([^'"]+)['"]/g;
|
|
16069
|
+
let match;
|
|
16070
|
+
while ((match = tplRe.exec(source)) !== null) {
|
|
16071
|
+
if (match[1])
|
|
16072
|
+
refs.push(match[1]);
|
|
16073
|
+
}
|
|
16074
|
+
while ((match = styleRe.exec(source)) !== null) {
|
|
16075
|
+
if (match[1])
|
|
16076
|
+
refs.push(match[1]);
|
|
16077
|
+
}
|
|
16078
|
+
while ((match = stylesArrRe.exec(source)) !== null) {
|
|
16079
|
+
const inner = match[1];
|
|
16080
|
+
if (!inner)
|
|
16081
|
+
continue;
|
|
16082
|
+
let strMatch;
|
|
16083
|
+
const innerRe = new RegExp(literalRe.source, literalRe.flags);
|
|
16084
|
+
while ((strMatch = innerRe.exec(inner)) !== null) {
|
|
16085
|
+
if (strMatch[1])
|
|
16086
|
+
refs.push(strMatch[1]);
|
|
16087
|
+
}
|
|
16088
|
+
}
|
|
16089
|
+
const componentDir = dirname16(full);
|
|
16090
|
+
for (const ref of refs) {
|
|
16091
|
+
const refAbs = normalizePath(resolve26(componentDir, ref));
|
|
16092
|
+
const refDir = normalizePath(dirname16(refAbs));
|
|
16093
|
+
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
16094
|
+
continue;
|
|
16095
|
+
}
|
|
16096
|
+
out.add(refDir);
|
|
16097
|
+
}
|
|
16098
|
+
}
|
|
16099
|
+
};
|
|
16100
|
+
walk(angularRoot);
|
|
16101
|
+
return Array.from(out);
|
|
15976
16102
|
}, collectPositiveWatchRoots = (config, resolved) => {
|
|
15977
16103
|
const cwd2 = process.cwd();
|
|
15978
16104
|
const roots = [];
|
|
15979
16105
|
const push = (path) => {
|
|
15980
16106
|
if (!path)
|
|
15981
16107
|
return;
|
|
15982
|
-
const abs = normalizePath(
|
|
16108
|
+
const abs = normalizePath(resolve26(cwd2, path));
|
|
15983
16109
|
if (!roots.includes(abs))
|
|
15984
16110
|
roots.push(abs);
|
|
15985
16111
|
};
|
|
@@ -16004,13 +16130,20 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
16004
16130
|
push(cfg.assetsDir);
|
|
16005
16131
|
push(cfg.stylesDir);
|
|
16006
16132
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
16007
|
-
const abs = normalizePath(
|
|
16133
|
+
const abs = normalizePath(resolve26(cwd2, candidate));
|
|
16008
16134
|
if (existsSync23(abs) && !roots.includes(abs))
|
|
16009
16135
|
roots.push(abs);
|
|
16010
16136
|
}
|
|
16011
16137
|
const extraDirs = config.dev?.watchDirs ?? [];
|
|
16012
16138
|
for (const dir of extraDirs)
|
|
16013
16139
|
push(dir);
|
|
16140
|
+
if (cfg.angularDir) {
|
|
16141
|
+
const resourceDirs = collectAngularResourceDirs(cfg.angularDir);
|
|
16142
|
+
for (const dir of resourceDirs) {
|
|
16143
|
+
if (!roots.includes(dir))
|
|
16144
|
+
roots.push(dir);
|
|
16145
|
+
}
|
|
16146
|
+
}
|
|
16014
16147
|
return roots;
|
|
16015
16148
|
}, getWatchPaths = (config, resolved) => {
|
|
16016
16149
|
const roots = collectPositiveWatchRoots(config, resolved);
|
|
@@ -16068,7 +16201,7 @@ var init_pathUtils = __esm(() => {
|
|
|
16068
16201
|
// src/dev/fileWatcher.ts
|
|
16069
16202
|
import { watch } from "fs";
|
|
16070
16203
|
import { existsSync as existsSync24 } from "fs";
|
|
16071
|
-
import { join as join27, resolve as
|
|
16204
|
+
import { join as join27, resolve as resolve27 } from "path";
|
|
16072
16205
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
16073
16206
|
try {
|
|
16074
16207
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -16113,7 +16246,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16113
16246
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
16114
16247
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16115
16248
|
paths.forEach((path) => {
|
|
16116
|
-
const absolutePath =
|
|
16249
|
+
const absolutePath = resolve27(path).replace(/\\/g, "/");
|
|
16117
16250
|
if (!existsSync24(absolutePath)) {
|
|
16118
16251
|
return;
|
|
16119
16252
|
}
|
|
@@ -16124,7 +16257,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
16124
16257
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
16125
16258
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
16126
16259
|
watchPaths.forEach((path) => {
|
|
16127
|
-
const absolutePath =
|
|
16260
|
+
const absolutePath = resolve27(path).replace(/\\/g, "/");
|
|
16128
16261
|
if (!existsSync24(absolutePath)) {
|
|
16129
16262
|
return;
|
|
16130
16263
|
}
|
|
@@ -16139,13 +16272,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
16139
16272
|
});
|
|
16140
16273
|
|
|
16141
16274
|
// src/dev/assetStore.ts
|
|
16142
|
-
import { resolve as
|
|
16275
|
+
import { resolve as resolve28 } from "path";
|
|
16143
16276
|
import { readdir as readdir4, unlink } from "fs/promises";
|
|
16144
16277
|
var mimeTypes, getMimeType = (filePath) => {
|
|
16145
16278
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
16146
16279
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
16147
16280
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
16148
|
-
const fullPath =
|
|
16281
|
+
const fullPath = resolve28(dir, entry.name);
|
|
16149
16282
|
if (entry.isDirectory()) {
|
|
16150
16283
|
return walkAndClean(fullPath);
|
|
16151
16284
|
}
|
|
@@ -16161,10 +16294,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16161
16294
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
16162
16295
|
const liveByIdentity = new Map;
|
|
16163
16296
|
for (const webPath of store.keys()) {
|
|
16164
|
-
const diskPath =
|
|
16297
|
+
const diskPath = resolve28(buildDir, webPath.slice(1));
|
|
16165
16298
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
16166
16299
|
}
|
|
16167
|
-
const absBuildDir =
|
|
16300
|
+
const absBuildDir = resolve28(buildDir);
|
|
16168
16301
|
Object.values(manifest).forEach((val) => {
|
|
16169
16302
|
if (!HASHED_FILE_RE.test(val))
|
|
16170
16303
|
return;
|
|
@@ -16182,7 +16315,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16182
16315
|
} catch {}
|
|
16183
16316
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
16184
16317
|
if (entry.isDirectory()) {
|
|
16185
|
-
return scanDir(
|
|
16318
|
+
return scanDir(resolve28(dir, entry.name), `${prefix}${entry.name}/`);
|
|
16186
16319
|
}
|
|
16187
16320
|
if (!entry.name.startsWith("chunk-")) {
|
|
16188
16321
|
return null;
|
|
@@ -16191,7 +16324,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16191
16324
|
if (store.has(webPath)) {
|
|
16192
16325
|
return null;
|
|
16193
16326
|
}
|
|
16194
|
-
return Bun.file(
|
|
16327
|
+
return Bun.file(resolve28(dir, entry.name)).bytes().then((bytes) => {
|
|
16195
16328
|
store.set(webPath, bytes);
|
|
16196
16329
|
return;
|
|
16197
16330
|
}).catch(() => {});
|
|
@@ -16213,7 +16346,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
16213
16346
|
for (const webPath of newIdentities.values()) {
|
|
16214
16347
|
if (store.has(webPath))
|
|
16215
16348
|
continue;
|
|
16216
|
-
loadPromises.push(Bun.file(
|
|
16349
|
+
loadPromises.push(Bun.file(resolve28(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
16217
16350
|
store.set(webPath, bytes);
|
|
16218
16351
|
return;
|
|
16219
16352
|
}).catch(() => {}));
|
|
@@ -16243,10 +16376,10 @@ var init_assetStore = __esm(() => {
|
|
|
16243
16376
|
});
|
|
16244
16377
|
|
|
16245
16378
|
// src/dev/fileHashTracker.ts
|
|
16246
|
-
import { readFileSync as
|
|
16379
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
16247
16380
|
var computeFileHash = (filePath) => {
|
|
16248
16381
|
try {
|
|
16249
|
-
const fileContent =
|
|
16382
|
+
const fileContent = readFileSync17(filePath);
|
|
16250
16383
|
return Number(Bun.hash(fileContent));
|
|
16251
16384
|
} catch {
|
|
16252
16385
|
return UNFOUND_INDEX;
|
|
@@ -16326,9 +16459,9 @@ var init_transformCache = __esm(() => {
|
|
|
16326
16459
|
});
|
|
16327
16460
|
|
|
16328
16461
|
// src/dev/reactComponentClassifier.ts
|
|
16329
|
-
import { resolve as
|
|
16462
|
+
import { resolve as resolve29 } from "path";
|
|
16330
16463
|
var classifyComponent = (filePath) => {
|
|
16331
|
-
const normalizedPath =
|
|
16464
|
+
const normalizedPath = resolve29(filePath);
|
|
16332
16465
|
if (normalizedPath.includes("/react/pages/")) {
|
|
16333
16466
|
return "server";
|
|
16334
16467
|
}
|
|
@@ -16340,7 +16473,7 @@ var classifyComponent = (filePath) => {
|
|
|
16340
16473
|
var init_reactComponentClassifier = () => {};
|
|
16341
16474
|
|
|
16342
16475
|
// src/dev/moduleMapper.ts
|
|
16343
|
-
import { basename as basename10, resolve as
|
|
16476
|
+
import { basename as basename10, resolve as resolve30 } from "path";
|
|
16344
16477
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
16345
16478
|
const modulePaths = {};
|
|
16346
16479
|
moduleKeys.forEach((key) => {
|
|
@@ -16350,7 +16483,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16350
16483
|
});
|
|
16351
16484
|
return modulePaths;
|
|
16352
16485
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
16353
|
-
const normalizedFile =
|
|
16486
|
+
const normalizedFile = resolve30(sourceFile);
|
|
16354
16487
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
16355
16488
|
if (processedFiles.has(normalizedFile)) {
|
|
16356
16489
|
return null;
|
|
@@ -16386,7 +16519,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
16386
16519
|
});
|
|
16387
16520
|
return grouped;
|
|
16388
16521
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
16389
|
-
const normalizedFile =
|
|
16522
|
+
const normalizedFile = resolve30(sourceFile);
|
|
16390
16523
|
const fileName = basename10(normalizedFile);
|
|
16391
16524
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
16392
16525
|
const pascalName = toPascal(baseName);
|
|
@@ -16545,247 +16678,6 @@ var init_ssrCache = __esm(() => {
|
|
|
16545
16678
|
dirtyFrameworks = new Set;
|
|
16546
16679
|
});
|
|
16547
16680
|
|
|
16548
|
-
// src/dev/angular/editTypeDetection.ts
|
|
16549
|
-
import { readFileSync as readFileSync17 } from "fs";
|
|
16550
|
-
import { basename as basename11 } from "path";
|
|
16551
|
-
import * as ts3 from "typescript";
|
|
16552
|
-
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) => {
|
|
16553
|
-
const callee = node.expression;
|
|
16554
|
-
if (ts3.isIdentifier(callee))
|
|
16555
|
-
return callee.text;
|
|
16556
|
-
if (ts3.isPropertyAccessExpression(callee))
|
|
16557
|
-
return callee.name.text;
|
|
16558
|
-
return null;
|
|
16559
|
-
}, getNewExprName = (node) => {
|
|
16560
|
-
const callee = node.expression;
|
|
16561
|
-
if (ts3.isIdentifier(callee))
|
|
16562
|
-
return callee.text;
|
|
16563
|
-
if (ts3.isPropertyAccessExpression(callee))
|
|
16564
|
-
return callee.name.text;
|
|
16565
|
-
return null;
|
|
16566
|
-
}, collectMethodBodies = (cls) => {
|
|
16567
|
-
const methods = new Map;
|
|
16568
|
-
cls.members.forEach((member) => {
|
|
16569
|
-
if (!member.name || !ts3.isIdentifier(member.name))
|
|
16570
|
-
return;
|
|
16571
|
-
if (ts3.isMethodDeclaration(member) && member.body) {
|
|
16572
|
-
methods.set(member.name.text, member.body);
|
|
16573
|
-
return;
|
|
16574
|
-
}
|
|
16575
|
-
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16576
|
-
const init = member.initializer;
|
|
16577
|
-
if (ts3.isArrowFunction(init) || ts3.isFunctionExpression(init)) {
|
|
16578
|
-
methods.set(member.name.text, init.body);
|
|
16579
|
-
}
|
|
16580
|
-
}
|
|
16581
|
-
});
|
|
16582
|
-
return methods;
|
|
16583
|
-
}, findSideEffectInBody = (body, methods, visited) => {
|
|
16584
|
-
let hit = { found: false };
|
|
16585
|
-
const walk = (node) => {
|
|
16586
|
-
if (hit.found)
|
|
16587
|
-
return;
|
|
16588
|
-
if (ts3.isCallExpression(node)) {
|
|
16589
|
-
const name = getCalleeName(node);
|
|
16590
|
-
if (name && SIDE_EFFECT_CALL_NAMES.has(name)) {
|
|
16591
|
-
hit = {
|
|
16592
|
-
found: true,
|
|
16593
|
-
reason: `constructor invokes ${name}(...)`
|
|
16594
|
-
};
|
|
16595
|
-
return;
|
|
16596
|
-
}
|
|
16597
|
-
if (name && methods.has(name) && !visited.has(name)) {
|
|
16598
|
-
visited.add(name);
|
|
16599
|
-
const target = methods.get(name);
|
|
16600
|
-
if (target) {
|
|
16601
|
-
const inner = findSideEffectInBody(target, methods, visited);
|
|
16602
|
-
if (inner.found) {
|
|
16603
|
-
hit = {
|
|
16604
|
-
found: true,
|
|
16605
|
-
reason: `${inner.reason} (via this.${name}())`
|
|
16606
|
-
};
|
|
16607
|
-
return;
|
|
16608
|
-
}
|
|
16609
|
-
}
|
|
16610
|
-
}
|
|
16611
|
-
}
|
|
16612
|
-
if (ts3.isNewExpression(node)) {
|
|
16613
|
-
const name = getNewExprName(node);
|
|
16614
|
-
if (name && SIDE_EFFECT_NEW_NAMES.has(name)) {
|
|
16615
|
-
hit = {
|
|
16616
|
-
found: true,
|
|
16617
|
-
reason: `constructor instantiates new ${name}(...)`
|
|
16618
|
-
};
|
|
16619
|
-
return;
|
|
16620
|
-
}
|
|
16621
|
-
}
|
|
16622
|
-
ts3.forEachChild(node, walk);
|
|
16623
|
-
};
|
|
16624
|
-
walk(body);
|
|
16625
|
-
return hit;
|
|
16626
|
-
}, analyzeServiceFile = (file5) => {
|
|
16627
|
-
let source;
|
|
16628
|
-
try {
|
|
16629
|
-
source = readFileSync17(file5, "utf8");
|
|
16630
|
-
} catch {
|
|
16631
|
-
return {
|
|
16632
|
-
hasSideEffectCtor: true,
|
|
16633
|
-
reason: "service file unreadable \u2014 defaulting to reboot"
|
|
16634
|
-
};
|
|
16635
|
-
}
|
|
16636
|
-
const sf = ts3.createSourceFile(file5, source, ts3.ScriptTarget.Latest, true);
|
|
16637
|
-
let result = {
|
|
16638
|
-
hasSideEffectCtor: false,
|
|
16639
|
-
reason: "constructor has no side-effecting calls"
|
|
16640
|
-
};
|
|
16641
|
-
const visit = (node) => {
|
|
16642
|
-
if (result.hasSideEffectCtor)
|
|
16643
|
-
return;
|
|
16644
|
-
if (!ts3.isClassDeclaration(node)) {
|
|
16645
|
-
ts3.forEachChild(node, visit);
|
|
16646
|
-
return;
|
|
16647
|
-
}
|
|
16648
|
-
const methods = collectMethodBodies(node);
|
|
16649
|
-
const ctor = node.members.find(ts3.isConstructorDeclaration);
|
|
16650
|
-
const targets = [];
|
|
16651
|
-
if (ctor?.body)
|
|
16652
|
-
targets.push(ctor.body);
|
|
16653
|
-
node.members.forEach((member) => {
|
|
16654
|
-
if (ts3.isPropertyDeclaration(member) && member.initializer) {
|
|
16655
|
-
targets.push(member.initializer);
|
|
16656
|
-
}
|
|
16657
|
-
});
|
|
16658
|
-
for (const target of targets) {
|
|
16659
|
-
const r = findSideEffectInBody(target, methods, new Set);
|
|
16660
|
-
if (r.found) {
|
|
16661
|
-
result = { hasSideEffectCtor: true, reason: r.reason };
|
|
16662
|
-
break;
|
|
16663
|
-
}
|
|
16664
|
-
}
|
|
16665
|
-
if (!result.hasSideEffectCtor)
|
|
16666
|
-
ts3.forEachChild(node, visit);
|
|
16667
|
-
};
|
|
16668
|
-
visit(sf);
|
|
16669
|
-
return result;
|
|
16670
|
-
}, classifyAngularEdit = (file5) => {
|
|
16671
|
-
const base = basename11(file5);
|
|
16672
|
-
if (TEMPLATE_RE.test(file5)) {
|
|
16673
|
-
return {
|
|
16674
|
-
type: "template",
|
|
16675
|
-
reason: `${base} \u2014 template edit`,
|
|
16676
|
-
sourceFile: file5
|
|
16677
|
-
};
|
|
16678
|
-
}
|
|
16679
|
-
if (COMPONENT_STYLE_RE.test(file5)) {
|
|
16680
|
-
return {
|
|
16681
|
-
type: "style-component",
|
|
16682
|
-
reason: `${base} \u2014 component-scoped stylesheet edit`,
|
|
16683
|
-
sourceFile: file5
|
|
16684
|
-
};
|
|
16685
|
-
}
|
|
16686
|
-
if (STYLE_EXT_RE.test(file5)) {
|
|
16687
|
-
return {
|
|
16688
|
-
type: "reboot",
|
|
16689
|
-
reason: `${base} \u2014 non-component-named stylesheet, falling back to reboot until scoping is verified`,
|
|
16690
|
-
sourceFile: file5
|
|
16691
|
-
};
|
|
16692
|
-
}
|
|
16693
|
-
if (ROUTES_RE.test(file5)) {
|
|
16694
|
-
return {
|
|
16695
|
-
type: "route",
|
|
16696
|
-
reason: `${base} \u2014 router config, requires reboot`,
|
|
16697
|
-
sourceFile: file5
|
|
16698
|
-
};
|
|
16699
|
-
}
|
|
16700
|
-
if (SERVICE_RE.test(file5)) {
|
|
16701
|
-
const a = analyzeServiceFile(file5);
|
|
16702
|
-
if (a.hasSideEffectCtor) {
|
|
16703
|
-
return {
|
|
16704
|
-
type: "service-with-side-effects",
|
|
16705
|
-
reason: `${base} \u2014 ${a.reason}`,
|
|
16706
|
-
sourceFile: file5
|
|
16707
|
-
};
|
|
16708
|
-
}
|
|
16709
|
-
return {
|
|
16710
|
-
type: "service-method-only",
|
|
16711
|
-
reason: `${base} \u2014 ${a.reason}`,
|
|
16712
|
-
sourceFile: file5
|
|
16713
|
-
};
|
|
16714
|
-
}
|
|
16715
|
-
if (COMPONENT_CLASS_RE.test(file5)) {
|
|
16716
|
-
return {
|
|
16717
|
-
type: "class-component",
|
|
16718
|
-
reason: `${base} \u2014 component class edit`,
|
|
16719
|
-
sourceFile: file5
|
|
16720
|
-
};
|
|
16721
|
-
}
|
|
16722
|
-
if (PAGE_TS_RE.test(file5)) {
|
|
16723
|
-
return {
|
|
16724
|
-
type: "class-component",
|
|
16725
|
-
reason: `${base} \u2014 page component edit`,
|
|
16726
|
-
sourceFile: file5
|
|
16727
|
-
};
|
|
16728
|
-
}
|
|
16729
|
-
return {
|
|
16730
|
-
type: "reboot",
|
|
16731
|
-
reason: `${base} \u2014 unrecognized angular file type, falling back to reboot`,
|
|
16732
|
-
sourceFile: file5
|
|
16733
|
-
};
|
|
16734
|
-
}, collapseClassifications = (classifications) => {
|
|
16735
|
-
if (classifications.length === 0) {
|
|
16736
|
-
return {
|
|
16737
|
-
type: "reboot",
|
|
16738
|
-
reason: "no classifiable files in batch",
|
|
16739
|
-
sourceFile: ""
|
|
16740
|
-
};
|
|
16741
|
-
}
|
|
16742
|
-
let winner = classifications[0];
|
|
16743
|
-
for (let i = 1;i < classifications.length; i++) {
|
|
16744
|
-
const candidate = classifications[i];
|
|
16745
|
-
if (TYPE_PRIORITY[candidate.type] > TYPE_PRIORITY[winner.type]) {
|
|
16746
|
-
winner = candidate;
|
|
16747
|
-
}
|
|
16748
|
-
}
|
|
16749
|
-
return winner;
|
|
16750
|
-
};
|
|
16751
|
-
var init_editTypeDetection = __esm(() => {
|
|
16752
|
-
TYPE_PRIORITY = {
|
|
16753
|
-
template: 0,
|
|
16754
|
-
"style-component": 1,
|
|
16755
|
-
"service-method-only": 2,
|
|
16756
|
-
"class-component": 3,
|
|
16757
|
-
"service-with-side-effects": 4,
|
|
16758
|
-
route: 5,
|
|
16759
|
-
reboot: 6
|
|
16760
|
-
};
|
|
16761
|
-
STYLE_EXT_RE = /\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16762
|
-
COMPONENT_STYLE_RE = /\.component\.(css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
16763
|
-
TEMPLATE_RE = /\.html$/i;
|
|
16764
|
-
COMPONENT_CLASS_RE = /\.component\.ts$/i;
|
|
16765
|
-
SERVICE_RE = /\.service\.ts$/i;
|
|
16766
|
-
ROUTES_RE = /(?:^|[\\/])(?:app\.)?routes\.ts$/i;
|
|
16767
|
-
PAGE_TS_RE = /(?:^|[\\/])pages[\\/][^\\/]+\.ts$/i;
|
|
16768
|
-
SIDE_EFFECT_CALL_NAMES = new Set([
|
|
16769
|
-
"subscribe",
|
|
16770
|
-
"setInterval",
|
|
16771
|
-
"setTimeout",
|
|
16772
|
-
"addEventListener",
|
|
16773
|
-
"effect",
|
|
16774
|
-
"afterNextRender",
|
|
16775
|
-
"afterRender",
|
|
16776
|
-
"afterEveryRender",
|
|
16777
|
-
"requestAnimationFrame",
|
|
16778
|
-
"requestIdleCallback"
|
|
16779
|
-
]);
|
|
16780
|
-
SIDE_EFFECT_NEW_NAMES = new Set([
|
|
16781
|
-
"Worker",
|
|
16782
|
-
"SharedWorker",
|
|
16783
|
-
"EventSource",
|
|
16784
|
-
"WebSocket",
|
|
16785
|
-
"BroadcastChannel"
|
|
16786
|
-
]);
|
|
16787
|
-
});
|
|
16788
|
-
|
|
16789
16681
|
// src/dev/moduleServer.ts
|
|
16790
16682
|
var exports_moduleServer = {};
|
|
16791
16683
|
__export(exports_moduleServer, {
|
|
@@ -16798,7 +16690,7 @@ __export(exports_moduleServer, {
|
|
|
16798
16690
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
16799
16691
|
});
|
|
16800
16692
|
import { existsSync as existsSync25, readFileSync as readFileSync18, statSync as statSync2 } from "fs";
|
|
16801
|
-
import { basename as
|
|
16693
|
+
import { basename as basename11, dirname as dirname17, extname as extname8, join as join28, resolve as resolve31, relative as relative12 } from "path";
|
|
16802
16694
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
16803
16695
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
16804
16696
|
const allExports = [];
|
|
@@ -16818,7 +16710,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
16818
16710
|
${stubs}
|
|
16819
16711
|
`;
|
|
16820
16712
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
16821
|
-
const found = extensions.find((ext) => existsSync25(
|
|
16713
|
+
const found = extensions.find((ext) => existsSync25(resolve31(projectRoot, srcPath + ext)));
|
|
16822
16714
|
return found ? srcPath + found : srcPath;
|
|
16823
16715
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
16824
16716
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -16833,7 +16725,7 @@ ${stubs}
|
|
|
16833
16725
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
16834
16726
|
}, srcUrl = (relPath, projectRoot) => {
|
|
16835
16727
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
16836
|
-
const absPath =
|
|
16728
|
+
const absPath = resolve31(projectRoot, relPath);
|
|
16837
16729
|
const cached = mtimeCache.get(absPath);
|
|
16838
16730
|
if (cached !== undefined)
|
|
16839
16731
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -16845,12 +16737,12 @@ ${stubs}
|
|
|
16845
16737
|
return base;
|
|
16846
16738
|
}
|
|
16847
16739
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
16848
|
-
const absPath =
|
|
16849
|
-
const rel =
|
|
16740
|
+
const absPath = resolve31(fileDir, relPath);
|
|
16741
|
+
const rel = relative12(projectRoot, absPath);
|
|
16850
16742
|
const extension = extname8(rel);
|
|
16851
16743
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
16852
16744
|
if (extname8(srcPath) === ".svelte") {
|
|
16853
|
-
srcPath =
|
|
16745
|
+
srcPath = relative12(projectRoot, resolveSvelteModulePath(resolve31(projectRoot, srcPath)));
|
|
16854
16746
|
}
|
|
16855
16747
|
return srcUrl(srcPath, projectRoot);
|
|
16856
16748
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -16860,27 +16752,27 @@ ${stubs}
|
|
|
16860
16752
|
"import"
|
|
16861
16753
|
]);
|
|
16862
16754
|
if (fromExports)
|
|
16863
|
-
return
|
|
16755
|
+
return relative12(projectRoot, fromExports);
|
|
16864
16756
|
try {
|
|
16865
16757
|
const isScoped = specifier.startsWith("@");
|
|
16866
16758
|
const parts = specifier.split("/");
|
|
16867
16759
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
16868
16760
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
16869
16761
|
if (!subpath) {
|
|
16870
|
-
const pkgDir =
|
|
16762
|
+
const pkgDir = resolve31(projectRoot, "node_modules", packageName ?? "");
|
|
16871
16763
|
const pkgJsonPath = join28(pkgDir, "package.json");
|
|
16872
16764
|
if (existsSync25(pkgJsonPath)) {
|
|
16873
16765
|
const pkg = JSON.parse(readFileSync18(pkgJsonPath, "utf-8"));
|
|
16874
16766
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
16875
16767
|
if (esmEntry) {
|
|
16876
|
-
const resolved =
|
|
16768
|
+
const resolved = resolve31(pkgDir, esmEntry);
|
|
16877
16769
|
if (existsSync25(resolved))
|
|
16878
|
-
return
|
|
16770
|
+
return relative12(projectRoot, resolved);
|
|
16879
16771
|
}
|
|
16880
16772
|
}
|
|
16881
16773
|
}
|
|
16882
16774
|
} catch {}
|
|
16883
|
-
return
|
|
16775
|
+
return relative12(projectRoot, Bun.resolveSync(specifier, projectRoot));
|
|
16884
16776
|
} catch {
|
|
16885
16777
|
return;
|
|
16886
16778
|
}
|
|
@@ -16905,26 +16797,26 @@ ${stubs}
|
|
|
16905
16797
|
};
|
|
16906
16798
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
16907
16799
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
16908
|
-
const fileDir =
|
|
16800
|
+
const fileDir = dirname17(filePath);
|
|
16909
16801
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
16910
16802
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
16911
16803
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
16912
16804
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
16913
16805
|
if (absPath.startsWith(projectRoot)) {
|
|
16914
|
-
const rel2 =
|
|
16806
|
+
const rel2 = relative12(projectRoot, absPath).replace(/\\/g, "/");
|
|
16915
16807
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
16916
16808
|
}
|
|
16917
|
-
const rel =
|
|
16809
|
+
const rel = relative12(projectRoot, absPath).replace(/\\/g, "/");
|
|
16918
16810
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
16919
16811
|
});
|
|
16920
16812
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
16921
|
-
const absPath =
|
|
16922
|
-
const rel =
|
|
16813
|
+
const absPath = resolve31(fileDir, relPath);
|
|
16814
|
+
const rel = relative12(projectRoot, absPath);
|
|
16923
16815
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
16924
16816
|
});
|
|
16925
16817
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
16926
|
-
const absPath =
|
|
16927
|
-
const rel =
|
|
16818
|
+
const absPath = resolve31(fileDir, relPath);
|
|
16819
|
+
const rel = relative12(projectRoot, absPath);
|
|
16928
16820
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
16929
16821
|
});
|
|
16930
16822
|
return result;
|
|
@@ -16980,7 +16872,7 @@ ${code}`;
|
|
|
16980
16872
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
16981
16873
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
16982
16874
|
${transpiled}`;
|
|
16983
|
-
const relPath =
|
|
16875
|
+
const relPath = relative12(projectRoot, filePath).replace(/\\/g, "/");
|
|
16984
16876
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
16985
16877
|
transpiled += buildIslandMetadataExports(raw);
|
|
16986
16878
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
@@ -17141,11 +17033,11 @@ ${code}`;
|
|
|
17141
17033
|
if (compiled.css?.code) {
|
|
17142
17034
|
const cssPath = `${filePath}.css`;
|
|
17143
17035
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
17144
|
-
const cssUrl = srcUrl(
|
|
17036
|
+
const cssUrl = srcUrl(relative12(projectRoot, cssPath), projectRoot);
|
|
17145
17037
|
code = `import "${cssUrl}";
|
|
17146
17038
|
${code}`;
|
|
17147
17039
|
}
|
|
17148
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
17040
|
+
const moduleUrl = `${SRC_PREFIX}${relative12(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
17149
17041
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
17150
17042
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
17151
17043
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -17216,7 +17108,7 @@ ${code}`;
|
|
|
17216
17108
|
if (!vueCompiler) {
|
|
17217
17109
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
17218
17110
|
}
|
|
17219
|
-
const fileName =
|
|
17111
|
+
const fileName = basename11(filePath, ".vue");
|
|
17220
17112
|
const componentId = fileName.toLowerCase();
|
|
17221
17113
|
const { descriptor } = vueCompiler.parse(raw, { filename: filePath });
|
|
17222
17114
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -17234,8 +17126,8 @@ ${code}`;
|
|
|
17234
17126
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
17235
17127
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
17236
17128
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
17237
|
-
const hmrBase = vueDir ?
|
|
17238
|
-
const hmrId =
|
|
17129
|
+
const hmrBase = vueDir ? resolve31(vueDir) : projectRoot;
|
|
17130
|
+
const hmrId = relative12(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
17239
17131
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
17240
17132
|
result += [
|
|
17241
17133
|
"",
|
|
@@ -17393,7 +17285,7 @@ export default {};
|
|
|
17393
17285
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
17394
17286
|
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);`);
|
|
17395
17287
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
17396
|
-
const filePath =
|
|
17288
|
+
const filePath = resolve31(projectRoot, relPath);
|
|
17397
17289
|
const ext = extname8(filePath);
|
|
17398
17290
|
if (ext === ".svelte")
|
|
17399
17291
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -17420,7 +17312,7 @@ export default {};
|
|
|
17420
17312
|
if (!TRANSPILABLE.has(ext))
|
|
17421
17313
|
return;
|
|
17422
17314
|
const stat3 = statSync2(filePath);
|
|
17423
|
-
const resolvedVueDir = vueDir ?
|
|
17315
|
+
const resolvedVueDir = vueDir ? resolve31(vueDir) : undefined;
|
|
17424
17316
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
17425
17317
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
17426
17318
|
return jsResponse(content);
|
|
@@ -17451,7 +17343,7 @@ export default {};
|
|
|
17451
17343
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
17452
17344
|
return;
|
|
17453
17345
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
17454
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
17346
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve31(projectRoot, relPath));
|
|
17455
17347
|
if (virtualCssResponse)
|
|
17456
17348
|
return virtualCssResponse;
|
|
17457
17349
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
@@ -17467,11 +17359,11 @@ export default {};
|
|
|
17467
17359
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
17468
17360
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
17469
17361
|
if (match[1])
|
|
17470
|
-
files.push(
|
|
17362
|
+
files.push(resolve31(projectRoot, match[1]));
|
|
17471
17363
|
}
|
|
17472
17364
|
return files;
|
|
17473
17365
|
}, invalidateModule = (filePath) => {
|
|
17474
|
-
const resolved =
|
|
17366
|
+
const resolved = resolve31(filePath);
|
|
17475
17367
|
invalidate(filePath);
|
|
17476
17368
|
if (resolved !== filePath)
|
|
17477
17369
|
invalidate(resolved);
|
|
@@ -17586,70 +17478,1583 @@ var init_rewriteImports = __esm(() => {
|
|
|
17586
17478
|
rewriteVendorDirectories2 = rewriteVendorDirectories;
|
|
17587
17479
|
});
|
|
17588
17480
|
|
|
17589
|
-
// src/
|
|
17590
|
-
var
|
|
17591
|
-
|
|
17592
|
-
|
|
17593
|
-
|
|
17594
|
-
|
|
17595
|
-
|
|
17596
|
-
|
|
17597
|
-
|
|
17481
|
+
// src/dev/angular/resolveOwningComponents.ts
|
|
17482
|
+
var exports_resolveOwningComponents = {};
|
|
17483
|
+
__export(exports_resolveOwningComponents, {
|
|
17484
|
+
resolveOwningComponents: () => resolveOwningComponents
|
|
17485
|
+
});
|
|
17486
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync19, statSync as statSync3 } from "fs";
|
|
17487
|
+
import { dirname as dirname18, extname as extname9, join as join29, resolve as resolve32 } from "path";
|
|
17488
|
+
import ts3 from "typescript";
|
|
17489
|
+
var isComponentTsFile = (file5) => file5.endsWith(".component.ts") || file5.endsWith(".component.tsx"), walkComponentTsFiles = (root) => {
|
|
17490
|
+
const out = [];
|
|
17491
|
+
const visit = (dir) => {
|
|
17492
|
+
let entries;
|
|
17493
|
+
try {
|
|
17494
|
+
entries = readdirSync2(dir, { withFileTypes: true });
|
|
17495
|
+
} catch {
|
|
17496
|
+
return;
|
|
17497
|
+
}
|
|
17498
|
+
for (const entry of entries) {
|
|
17499
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
17500
|
+
continue;
|
|
17501
|
+
}
|
|
17502
|
+
const full = join29(dir, entry.name);
|
|
17503
|
+
if (entry.isDirectory()) {
|
|
17504
|
+
visit(full);
|
|
17505
|
+
} else if (entry.isFile() && isComponentTsFile(entry.name)) {
|
|
17506
|
+
out.push(full);
|
|
17507
|
+
}
|
|
17508
|
+
}
|
|
17598
17509
|
};
|
|
17599
|
-
|
|
17600
|
-
|
|
17601
|
-
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
17610
|
-
|
|
17611
|
-
|
|
17612
|
-
.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)}
|
|
17613
|
-
.brand{font-weight:700;font-size:20px;color:#fff;letter-spacing:-0.02em}
|
|
17614
|
-
.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)}
|
|
17615
|
-
.kind{color:#94a3b8;font-size:13px;font-weight:500}
|
|
17616
|
-
.content{padding:24px}
|
|
17617
|
-
.label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px}
|
|
17618
|
-
.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}
|
|
17619
|
-
.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}
|
|
17620
|
-
</style>
|
|
17621
|
-
</head>
|
|
17622
|
-
<body>
|
|
17623
|
-
<div class="card">
|
|
17624
|
-
<div class="header">
|
|
17625
|
-
<div style="display:flex;align-items:center;gap:12px">
|
|
17626
|
-
<span class="brand">AbsoluteJS</span>
|
|
17627
|
-
<span class="badge">${label}</span>
|
|
17628
|
-
</div>
|
|
17629
|
-
<span class="kind">Server Render Error</span>
|
|
17630
|
-
</div>
|
|
17631
|
-
<div class="content">
|
|
17632
|
-
<div class="label">What went wrong</div>
|
|
17633
|
-
<pre class="message">${message.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</pre>
|
|
17634
|
-
<div class="hint">A component threw during server-side rendering. Check the terminal for the full stack trace.</div>
|
|
17635
|
-
</div>
|
|
17636
|
-
</div>
|
|
17637
|
-
</body>
|
|
17638
|
-
</html>`;
|
|
17639
|
-
};
|
|
17640
|
-
|
|
17641
|
-
// src/ember/pageHandler.ts
|
|
17642
|
-
import { pathToFileURL } from "url";
|
|
17643
|
-
var resolveRequestPathname = (request) => {
|
|
17644
|
-
if (!request)
|
|
17645
|
-
return;
|
|
17646
|
-
try {
|
|
17647
|
-
const parsed = new URL(request.url);
|
|
17648
|
-
return `${parsed.pathname}${parsed.search}`;
|
|
17649
|
-
} catch {
|
|
17650
|
-
return;
|
|
17510
|
+
visit(root);
|
|
17511
|
+
return out;
|
|
17512
|
+
}, getStringPropertyValue = (obj, name) => {
|
|
17513
|
+
for (const prop of obj.properties) {
|
|
17514
|
+
if (!ts3.isPropertyAssignment(prop))
|
|
17515
|
+
continue;
|
|
17516
|
+
const propName = ts3.isIdentifier(prop.name) ? prop.name.text : ts3.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
17517
|
+
if (propName !== name)
|
|
17518
|
+
continue;
|
|
17519
|
+
const init = prop.initializer;
|
|
17520
|
+
if (ts3.isStringLiteral(init) || ts3.isNoSubstitutionTemplateLiteral(init)) {
|
|
17521
|
+
return init.text;
|
|
17522
|
+
}
|
|
17651
17523
|
}
|
|
17652
|
-
|
|
17524
|
+
return null;
|
|
17525
|
+
}, getStringArrayProperty = (obj, name) => {
|
|
17526
|
+
const out = [];
|
|
17527
|
+
for (const prop of obj.properties) {
|
|
17528
|
+
if (!ts3.isPropertyAssignment(prop))
|
|
17529
|
+
continue;
|
|
17530
|
+
const propName = ts3.isIdentifier(prop.name) ? prop.name.text : ts3.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
17531
|
+
if (propName !== name)
|
|
17532
|
+
continue;
|
|
17533
|
+
const init = prop.initializer;
|
|
17534
|
+
if (!ts3.isArrayLiteralExpression(init))
|
|
17535
|
+
continue;
|
|
17536
|
+
for (const element of init.elements) {
|
|
17537
|
+
if (ts3.isStringLiteral(element) || ts3.isNoSubstitutionTemplateLiteral(element)) {
|
|
17538
|
+
out.push(element.text);
|
|
17539
|
+
}
|
|
17540
|
+
}
|
|
17541
|
+
}
|
|
17542
|
+
return out;
|
|
17543
|
+
}, parseComponentRefs = (filePath) => {
|
|
17544
|
+
const refs = {
|
|
17545
|
+
classNames: [],
|
|
17546
|
+
templateUrls: [],
|
|
17547
|
+
styleUrls: []
|
|
17548
|
+
};
|
|
17549
|
+
let source;
|
|
17550
|
+
try {
|
|
17551
|
+
source = readFileSync19(filePath, "utf8");
|
|
17552
|
+
} catch {
|
|
17553
|
+
return refs;
|
|
17554
|
+
}
|
|
17555
|
+
const sourceFile = ts3.createSourceFile(filePath, source, ts3.ScriptTarget.ES2022, true, ts3.ScriptKind.TS);
|
|
17556
|
+
const visit = (node) => {
|
|
17557
|
+
if (ts3.isClassDeclaration(node) && node.name) {
|
|
17558
|
+
const decorators = ts3.getDecorators(node) ?? [];
|
|
17559
|
+
for (const decorator of decorators) {
|
|
17560
|
+
const expr = decorator.expression;
|
|
17561
|
+
if (!ts3.isCallExpression(expr))
|
|
17562
|
+
continue;
|
|
17563
|
+
const fn2 = expr.expression;
|
|
17564
|
+
if (!ts3.isIdentifier(fn2) || fn2.text !== "Component")
|
|
17565
|
+
continue;
|
|
17566
|
+
refs.classNames.push(node.name.text);
|
|
17567
|
+
const arg = expr.arguments[0];
|
|
17568
|
+
if (!arg || !ts3.isObjectLiteralExpression(arg))
|
|
17569
|
+
continue;
|
|
17570
|
+
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
17571
|
+
if (tplUrl)
|
|
17572
|
+
refs.templateUrls.push(tplUrl);
|
|
17573
|
+
const styleUrl = getStringPropertyValue(arg, "styleUrl");
|
|
17574
|
+
if (styleUrl)
|
|
17575
|
+
refs.styleUrls.push(styleUrl);
|
|
17576
|
+
refs.styleUrls.push(...getStringArrayProperty(arg, "styleUrls"));
|
|
17577
|
+
}
|
|
17578
|
+
}
|
|
17579
|
+
ts3.forEachChild(node, visit);
|
|
17580
|
+
};
|
|
17581
|
+
visit(sourceFile);
|
|
17582
|
+
return refs;
|
|
17583
|
+
}, safeNormalize = (path) => resolve32(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
17584
|
+
const { changedFilePath, userAngularRoot } = params;
|
|
17585
|
+
const changedAbs = safeNormalize(changedFilePath);
|
|
17586
|
+
const out = [];
|
|
17587
|
+
if (changedAbs.endsWith(".component.ts")) {
|
|
17588
|
+
const refs = parseComponentRefs(changedAbs);
|
|
17589
|
+
for (const className of refs.classNames) {
|
|
17590
|
+
out.push({ componentFilePath: changedAbs, className });
|
|
17591
|
+
}
|
|
17592
|
+
return out;
|
|
17593
|
+
}
|
|
17594
|
+
const ext = extname9(changedAbs).toLowerCase();
|
|
17595
|
+
if (ext !== ".html" && ext !== ".css" && ext !== ".scss" && ext !== ".sass") {
|
|
17596
|
+
return out;
|
|
17597
|
+
}
|
|
17598
|
+
let rootStat;
|
|
17599
|
+
try {
|
|
17600
|
+
rootStat = statSync3(userAngularRoot);
|
|
17601
|
+
} catch {
|
|
17602
|
+
return out;
|
|
17603
|
+
}
|
|
17604
|
+
if (!rootStat.isDirectory())
|
|
17605
|
+
return out;
|
|
17606
|
+
for (const componentTsPath of walkComponentTsFiles(userAngularRoot)) {
|
|
17607
|
+
const refs = parseComponentRefs(componentTsPath);
|
|
17608
|
+
const componentDir = dirname18(componentTsPath);
|
|
17609
|
+
const matchesResource = (relativeUrl) => {
|
|
17610
|
+
const abs = safeNormalize(resolve32(componentDir, relativeUrl));
|
|
17611
|
+
return abs === changedAbs;
|
|
17612
|
+
};
|
|
17613
|
+
const referencesChanged = refs.templateUrls.some(matchesResource) || refs.styleUrls.some(matchesResource);
|
|
17614
|
+
if (!referencesChanged)
|
|
17615
|
+
continue;
|
|
17616
|
+
for (const className of refs.classNames) {
|
|
17617
|
+
out.push({
|
|
17618
|
+
componentFilePath: componentTsPath,
|
|
17619
|
+
className
|
|
17620
|
+
});
|
|
17621
|
+
}
|
|
17622
|
+
}
|
|
17623
|
+
return out;
|
|
17624
|
+
};
|
|
17625
|
+
var init_resolveOwningComponents = () => {};
|
|
17626
|
+
|
|
17627
|
+
// src/dev/angular/hmrImportGenerator.ts
|
|
17628
|
+
import ts4 from "typescript";
|
|
17629
|
+
var createHmrImportGenerator = (namespaceMap) => ({
|
|
17630
|
+
addImport(request) {
|
|
17631
|
+
const ns = namespaceMap.get(request.exportModuleSpecifier);
|
|
17632
|
+
if (!ns) {
|
|
17633
|
+
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
17634
|
+
}
|
|
17635
|
+
const namespaceId = ts4.factory.createIdentifier(ns);
|
|
17636
|
+
if (request.exportSymbolName === null) {
|
|
17637
|
+
return namespaceId;
|
|
17638
|
+
}
|
|
17639
|
+
return ts4.factory.createPropertyAccessExpression(namespaceId, ts4.factory.createIdentifier(request.exportSymbolName));
|
|
17640
|
+
}
|
|
17641
|
+
});
|
|
17642
|
+
var init_hmrImportGenerator = () => {};
|
|
17643
|
+
|
|
17644
|
+
// src/dev/angular/vendor/translator/context.ts
|
|
17645
|
+
class Context {
|
|
17646
|
+
isStatement;
|
|
17647
|
+
constructor(isStatement) {
|
|
17648
|
+
this.isStatement = isStatement;
|
|
17649
|
+
}
|
|
17650
|
+
get withExpressionMode() {
|
|
17651
|
+
return this.isStatement ? new Context(false) : this;
|
|
17652
|
+
}
|
|
17653
|
+
get withStatementMode() {
|
|
17654
|
+
return !this.isStatement ? new Context(true) : this;
|
|
17655
|
+
}
|
|
17656
|
+
}
|
|
17657
|
+
|
|
17658
|
+
// src/dev/angular/vendor/translator/translator.ts
|
|
17659
|
+
import * as o from "@angular/compiler";
|
|
17660
|
+
|
|
17661
|
+
class ExpressionTranslatorVisitor {
|
|
17662
|
+
factory;
|
|
17663
|
+
imports;
|
|
17664
|
+
contextFile;
|
|
17665
|
+
downlevelTaggedTemplates;
|
|
17666
|
+
downlevelVariableDeclarations;
|
|
17667
|
+
recordWrappedNode;
|
|
17668
|
+
constructor(factory, imports, contextFile, options) {
|
|
17669
|
+
this.factory = factory;
|
|
17670
|
+
this.imports = imports;
|
|
17671
|
+
this.contextFile = contextFile;
|
|
17672
|
+
this.downlevelTaggedTemplates = options.downlevelTaggedTemplates === true;
|
|
17673
|
+
this.downlevelVariableDeclarations = options.downlevelVariableDeclarations === true;
|
|
17674
|
+
this.recordWrappedNode = options.recordWrappedNode || (() => {});
|
|
17675
|
+
}
|
|
17676
|
+
visitDeclareVarStmt(stmt, context) {
|
|
17677
|
+
const varType = this.downlevelVariableDeclarations ? "var" : stmt.hasModifier(o.StmtModifier.Final) ? "const" : "let";
|
|
17678
|
+
return this.attachComments(this.factory.createVariableDeclaration(stmt.name, stmt.value?.visitExpression(this, context.withExpressionMode), varType, stmt.type?.visitType(this, context)), stmt.leadingComments);
|
|
17679
|
+
}
|
|
17680
|
+
visitDeclareFunctionStmt(stmt, context) {
|
|
17681
|
+
return this.attachComments(this.factory.createFunctionDeclaration(stmt.name, this.translateParams(stmt.params, context), this.factory.createBlock(this.visitStatements(stmt.statements, context.withStatementMode))), stmt.leadingComments);
|
|
17682
|
+
}
|
|
17683
|
+
visitExpressionStmt(stmt, context) {
|
|
17684
|
+
return this.attachComments(this.factory.createExpressionStatement(stmt.expr.visitExpression(this, context.withStatementMode)), stmt.leadingComments);
|
|
17685
|
+
}
|
|
17686
|
+
visitReturnStmt(stmt, context) {
|
|
17687
|
+
return this.attachComments(this.factory.createReturnStatement(stmt.value.visitExpression(this, context.withExpressionMode)), stmt.leadingComments);
|
|
17688
|
+
}
|
|
17689
|
+
visitIfStmt(stmt, context) {
|
|
17690
|
+
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);
|
|
17691
|
+
}
|
|
17692
|
+
visitReadVarExpr(ast, _context) {
|
|
17693
|
+
const identifier = this.factory.createIdentifier(ast.name);
|
|
17694
|
+
this.setSourceMapRange(identifier, ast.sourceSpan);
|
|
17695
|
+
return identifier;
|
|
17696
|
+
}
|
|
17697
|
+
visitInvokeFunctionExpr(ast, context) {
|
|
17698
|
+
return this.setSourceMapRange(this.factory.createCallExpression(ast.fn.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)), ast.pure), ast.sourceSpan);
|
|
17699
|
+
}
|
|
17700
|
+
visitTaggedTemplateLiteralExpr(ast, context) {
|
|
17701
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(ast.tag.visitExpression(this, context), this.getTemplateLiteralFromAst(ast.template, context)), ast.sourceSpan);
|
|
17702
|
+
}
|
|
17703
|
+
visitTemplateLiteralExpr(ast, context) {
|
|
17704
|
+
return this.setSourceMapRange(this.factory.createTemplateLiteral(this.getTemplateLiteralFromAst(ast, context)), ast.sourceSpan);
|
|
17705
|
+
}
|
|
17706
|
+
visitInstantiateExpr(ast, context) {
|
|
17707
|
+
return this.factory.createNewExpression(ast.classExpr.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)));
|
|
17708
|
+
}
|
|
17709
|
+
visitLiteralExpr(ast, _context) {
|
|
17710
|
+
return this.setSourceMapRange(this.factory.createLiteral(ast.value), ast.sourceSpan);
|
|
17711
|
+
}
|
|
17712
|
+
visitRegularExpressionLiteral(ast, context) {
|
|
17713
|
+
return this.setSourceMapRange(this.factory.createRegularExpressionLiteral(ast.body, ast.flags), ast.sourceSpan);
|
|
17714
|
+
}
|
|
17715
|
+
visitLocalizedString(ast, context) {
|
|
17716
|
+
const elements = [createTemplateElement(ast.serializeI18nHead())];
|
|
17717
|
+
const expressions = [];
|
|
17718
|
+
for (let i = 0;i < ast.expressions.length; i++) {
|
|
17719
|
+
const placeholder = this.setSourceMapRange(ast.expressions[i].visitExpression(this, context), ast.getPlaceholderSourceSpan(i));
|
|
17720
|
+
expressions.push(placeholder);
|
|
17721
|
+
elements.push(createTemplateElement(ast.serializeI18nTemplatePart(i + 1)));
|
|
17722
|
+
}
|
|
17723
|
+
const localizeTag = this.factory.createIdentifier("$localize");
|
|
17724
|
+
return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, { elements, expressions }), ast.sourceSpan);
|
|
17725
|
+
}
|
|
17726
|
+
visitBuiltinType(ast) {
|
|
17727
|
+
let builtInType;
|
|
17728
|
+
switch (ast.name) {
|
|
17729
|
+
case o.BuiltinTypeName.Bool:
|
|
17730
|
+
builtInType = "boolean";
|
|
17731
|
+
break;
|
|
17732
|
+
case o.BuiltinTypeName.String:
|
|
17733
|
+
builtInType = "string";
|
|
17734
|
+
break;
|
|
17735
|
+
case o.BuiltinTypeName.Dynamic:
|
|
17736
|
+
builtInType = "any";
|
|
17737
|
+
break;
|
|
17738
|
+
case o.BuiltinTypeName.Number:
|
|
17739
|
+
case o.BuiltinTypeName.Int:
|
|
17740
|
+
builtInType = "number";
|
|
17741
|
+
break;
|
|
17742
|
+
case o.BuiltinTypeName.Function:
|
|
17743
|
+
builtInType = "function";
|
|
17744
|
+
break;
|
|
17745
|
+
case o.BuiltinTypeName.None:
|
|
17746
|
+
builtInType = "never";
|
|
17747
|
+
break;
|
|
17748
|
+
case o.BuiltinTypeName.Inferred:
|
|
17749
|
+
return null;
|
|
17750
|
+
}
|
|
17751
|
+
return this.factory.createBuiltInType(builtInType);
|
|
17752
|
+
}
|
|
17753
|
+
visitExpressionType(ast, context) {
|
|
17754
|
+
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)));
|
|
17755
|
+
}
|
|
17756
|
+
visitArrayType(ast, context) {
|
|
17757
|
+
return this.factory.createArrayType(ast.of.visitType(this, context));
|
|
17758
|
+
}
|
|
17759
|
+
visitMapType(ast, context) {
|
|
17760
|
+
const valueType = ast.valueType === null ? this.factory.createBuiltInType("unknown") : ast.valueType.visitType(this, context);
|
|
17761
|
+
return this.factory.createMapType(valueType);
|
|
17762
|
+
}
|
|
17763
|
+
visitTransplantedType(type) {
|
|
17764
|
+
return this.factory.transplantType(type.type);
|
|
17765
|
+
}
|
|
17766
|
+
createTaggedTemplateExpression(tag, template) {
|
|
17767
|
+
return this.downlevelTaggedTemplates ? this.createES5TaggedTemplateFunctionCall(tag, template) : this.factory.createTaggedTemplate(tag, template);
|
|
17768
|
+
}
|
|
17769
|
+
createES5TaggedTemplateFunctionCall(tagHandler, { elements, expressions }) {
|
|
17770
|
+
const __makeTemplateObjectHelper = this.imports.addImport({
|
|
17771
|
+
exportModuleSpecifier: "tslib",
|
|
17772
|
+
exportSymbolName: "__makeTemplateObject",
|
|
17773
|
+
requestedFile: this.contextFile
|
|
17774
|
+
});
|
|
17775
|
+
const cooked = [];
|
|
17776
|
+
const raw = [];
|
|
17777
|
+
for (const element of elements) {
|
|
17778
|
+
cooked.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.cooked), element.range));
|
|
17779
|
+
raw.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.raw), element.range));
|
|
17780
|
+
}
|
|
17781
|
+
const templateHelperCall = this.factory.createCallExpression(__makeTemplateObjectHelper, [this.factory.createArrayLiteral(cooked), this.factory.createArrayLiteral(raw)], false);
|
|
17782
|
+
return this.factory.createCallExpression(tagHandler, [templateHelperCall, ...expressions], false);
|
|
17783
|
+
}
|
|
17784
|
+
visitExternalExpr(ast, _context) {
|
|
17785
|
+
if (ast.value.name === null) {
|
|
17786
|
+
if (ast.value.moduleName === null) {
|
|
17787
|
+
throw new Error("Invalid import without name nor moduleName");
|
|
17788
|
+
}
|
|
17789
|
+
return this.imports.addImport({
|
|
17790
|
+
exportModuleSpecifier: ast.value.moduleName,
|
|
17791
|
+
exportSymbolName: null,
|
|
17792
|
+
requestedFile: this.contextFile
|
|
17793
|
+
});
|
|
17794
|
+
}
|
|
17795
|
+
if (ast.value.moduleName !== null) {
|
|
17796
|
+
return this.imports.addImport({
|
|
17797
|
+
exportModuleSpecifier: ast.value.moduleName,
|
|
17798
|
+
exportSymbolName: ast.value.name,
|
|
17799
|
+
requestedFile: this.contextFile
|
|
17800
|
+
});
|
|
17801
|
+
} else {
|
|
17802
|
+
return this.factory.createIdentifier(ast.value.name);
|
|
17803
|
+
}
|
|
17804
|
+
}
|
|
17805
|
+
visitConditionalExpr(ast, context) {
|
|
17806
|
+
return this.factory.createConditional(ast.condition.visitExpression(this, context), ast.trueCase.visitExpression(this, context), ast.falseCase.visitExpression(this, context));
|
|
17807
|
+
}
|
|
17808
|
+
visitDynamicImportExpr(ast, context) {
|
|
17809
|
+
const urlExpression = typeof ast.url === "string" ? this.factory.createLiteral(ast.url) : ast.url.visitExpression(this, context);
|
|
17810
|
+
if (ast.urlComment) {
|
|
17811
|
+
this.factory.attachComments(urlExpression, [o.leadingComment(ast.urlComment, true)]);
|
|
17812
|
+
}
|
|
17813
|
+
return this.factory.createDynamicImport(urlExpression);
|
|
17814
|
+
}
|
|
17815
|
+
visitNotExpr(ast, context) {
|
|
17816
|
+
return this.factory.createUnaryExpression("!", ast.condition.visitExpression(this, context));
|
|
17817
|
+
}
|
|
17818
|
+
visitFunctionExpr(ast, context) {
|
|
17819
|
+
return this.factory.createFunctionExpression(ast.name ?? null, this.translateParams(ast.params, context), this.factory.createBlock(this.visitStatements(ast.statements, context)));
|
|
17820
|
+
}
|
|
17821
|
+
visitArrowFunctionExpr(ast, context) {
|
|
17822
|
+
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));
|
|
17823
|
+
}
|
|
17824
|
+
visitBinaryOperatorExpr(ast, context) {
|
|
17825
|
+
if (!BINARY_OPERATORS.has(ast.operator)) {
|
|
17826
|
+
throw new Error(`Unknown binary operator: ${o.BinaryOperator[ast.operator]}`);
|
|
17827
|
+
}
|
|
17828
|
+
const operator = BINARY_OPERATORS.get(ast.operator);
|
|
17829
|
+
if (ast.isAssignment()) {
|
|
17830
|
+
return this.factory.createAssignment(ast.lhs.visitExpression(this, context), operator, ast.rhs.visitExpression(this, context));
|
|
17831
|
+
}
|
|
17832
|
+
return this.factory.createBinaryExpression(ast.lhs.visitExpression(this, context), operator, ast.rhs.visitExpression(this, context));
|
|
17833
|
+
}
|
|
17834
|
+
visitReadPropExpr(ast, context) {
|
|
17835
|
+
return this.factory.createPropertyAccess(ast.receiver.visitExpression(this, context), ast.name);
|
|
17836
|
+
}
|
|
17837
|
+
visitReadKeyExpr(ast, context) {
|
|
17838
|
+
return this.factory.createElementAccess(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context));
|
|
17839
|
+
}
|
|
17840
|
+
visitLiteralArrayExpr(ast, context) {
|
|
17841
|
+
return this.factory.createArrayLiteral(ast.entries.map((expr) => this.setSourceMapRange(expr.visitExpression(this, context), ast.sourceSpan)));
|
|
17842
|
+
}
|
|
17843
|
+
visitLiteralMapExpr(ast, context) {
|
|
17844
|
+
const properties = ast.entries.map((entry) => {
|
|
17845
|
+
return entry instanceof o.LiteralMapPropertyAssignment ? {
|
|
17846
|
+
kind: "property",
|
|
17847
|
+
propertyName: entry.key,
|
|
17848
|
+
quoted: entry.quoted,
|
|
17849
|
+
value: entry.value.visitExpression(this, context)
|
|
17850
|
+
} : {
|
|
17851
|
+
kind: "spread",
|
|
17852
|
+
expression: entry.expression.visitExpression(this, context)
|
|
17853
|
+
};
|
|
17854
|
+
});
|
|
17855
|
+
return this.setSourceMapRange(this.factory.createObjectLiteral(properties), ast.sourceSpan);
|
|
17856
|
+
}
|
|
17857
|
+
visitCommaExpr(ast, context) {
|
|
17858
|
+
throw new Error("Method not implemented.");
|
|
17859
|
+
}
|
|
17860
|
+
visitTemplateLiteralElementExpr(ast, context) {
|
|
17861
|
+
throw new Error("Method not implemented");
|
|
17862
|
+
}
|
|
17863
|
+
visitSpreadElementExpr(ast, context) {
|
|
17864
|
+
const expression = ast.expression.visitExpression(this, context);
|
|
17865
|
+
return this.setSourceMapRange(this.factory.createSpreadElement(expression), ast.sourceSpan);
|
|
17866
|
+
}
|
|
17867
|
+
visitWrappedNodeExpr(ast, _context) {
|
|
17868
|
+
this.recordWrappedNode(ast);
|
|
17869
|
+
return ast.node;
|
|
17870
|
+
}
|
|
17871
|
+
visitTypeofExpr(ast, context) {
|
|
17872
|
+
return this.factory.createTypeOfExpression(ast.expr.visitExpression(this, context));
|
|
17873
|
+
}
|
|
17874
|
+
visitVoidExpr(ast, context) {
|
|
17875
|
+
return this.factory.createVoidExpression(ast.expr.visitExpression(this, context));
|
|
17876
|
+
}
|
|
17877
|
+
visitUnaryOperatorExpr(ast, context) {
|
|
17878
|
+
if (!UNARY_OPERATORS.has(ast.operator)) {
|
|
17879
|
+
throw new Error(`Unknown unary operator: ${o.UnaryOperator[ast.operator]}`);
|
|
17880
|
+
}
|
|
17881
|
+
return this.factory.createUnaryExpression(UNARY_OPERATORS.get(ast.operator), ast.expr.visitExpression(this, context));
|
|
17882
|
+
}
|
|
17883
|
+
visitParenthesizedExpr(ast, context) {
|
|
17884
|
+
const result = ast.expr.visitExpression(this, context);
|
|
17885
|
+
return this.factory.createParenthesizedExpression(result);
|
|
17886
|
+
}
|
|
17887
|
+
visitStatements(statements, context) {
|
|
17888
|
+
return statements.map((stmt) => stmt.visitStatement(this, context)).filter((stmt) => stmt !== undefined);
|
|
17889
|
+
}
|
|
17890
|
+
setSourceMapRange(ast, span) {
|
|
17891
|
+
return this.factory.setSourceMapRange(ast, createRange(span));
|
|
17892
|
+
}
|
|
17893
|
+
attachComments(statement, leadingComments) {
|
|
17894
|
+
if (leadingComments !== undefined) {
|
|
17895
|
+
this.factory.attachComments(statement, leadingComments);
|
|
17896
|
+
}
|
|
17897
|
+
return statement;
|
|
17898
|
+
}
|
|
17899
|
+
getTemplateLiteralFromAst(ast, context) {
|
|
17900
|
+
return {
|
|
17901
|
+
elements: ast.elements.map((e) => createTemplateElement({
|
|
17902
|
+
cooked: e.text,
|
|
17903
|
+
raw: e.rawText,
|
|
17904
|
+
range: e.sourceSpan ?? ast.sourceSpan
|
|
17905
|
+
})),
|
|
17906
|
+
expressions: ast.expressions.map((e) => e.visitExpression(this, context))
|
|
17907
|
+
};
|
|
17908
|
+
}
|
|
17909
|
+
translateParams(params, context) {
|
|
17910
|
+
return params.map((param) => ({
|
|
17911
|
+
name: param.name,
|
|
17912
|
+
type: param.type?.visitType(this, context)
|
|
17913
|
+
}));
|
|
17914
|
+
}
|
|
17915
|
+
}
|
|
17916
|
+
function createTemplateElement({
|
|
17917
|
+
cooked,
|
|
17918
|
+
raw,
|
|
17919
|
+
range
|
|
17920
|
+
}) {
|
|
17921
|
+
return { cooked, raw, range: createRange(range) };
|
|
17922
|
+
}
|
|
17923
|
+
function createRange(span) {
|
|
17924
|
+
if (span === null) {
|
|
17925
|
+
return null;
|
|
17926
|
+
}
|
|
17927
|
+
const { start, end } = span;
|
|
17928
|
+
const { url, content } = start.file;
|
|
17929
|
+
if (!url) {
|
|
17930
|
+
return null;
|
|
17931
|
+
}
|
|
17932
|
+
return {
|
|
17933
|
+
url,
|
|
17934
|
+
content,
|
|
17935
|
+
start: { offset: start.offset, line: start.line, column: start.col },
|
|
17936
|
+
end: { offset: end.offset, line: end.line, column: end.col }
|
|
17937
|
+
};
|
|
17938
|
+
}
|
|
17939
|
+
var UNARY_OPERATORS, BINARY_OPERATORS;
|
|
17940
|
+
var init_translator = __esm(() => {
|
|
17941
|
+
UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
17942
|
+
[o.UnaryOperator.Minus, "-"],
|
|
17943
|
+
[o.UnaryOperator.Plus, "+"]
|
|
17944
|
+
]);
|
|
17945
|
+
BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
17946
|
+
[o.BinaryOperator.And, "&&"],
|
|
17947
|
+
[o.BinaryOperator.Bigger, ">"],
|
|
17948
|
+
[o.BinaryOperator.BiggerEquals, ">="],
|
|
17949
|
+
[o.BinaryOperator.BitwiseAnd, "&"],
|
|
17950
|
+
[o.BinaryOperator.BitwiseOr, "|"],
|
|
17951
|
+
[o.BinaryOperator.Divide, "/"],
|
|
17952
|
+
[o.BinaryOperator.Equals, "=="],
|
|
17953
|
+
[o.BinaryOperator.Identical, "==="],
|
|
17954
|
+
[o.BinaryOperator.Lower, "<"],
|
|
17955
|
+
[o.BinaryOperator.LowerEquals, "<="],
|
|
17956
|
+
[o.BinaryOperator.Minus, "-"],
|
|
17957
|
+
[o.BinaryOperator.Modulo, "%"],
|
|
17958
|
+
[o.BinaryOperator.Multiply, "*"],
|
|
17959
|
+
[o.BinaryOperator.NotEquals, "!="],
|
|
17960
|
+
[o.BinaryOperator.NotIdentical, "!=="],
|
|
17961
|
+
[o.BinaryOperator.Or, "||"],
|
|
17962
|
+
[o.BinaryOperator.Plus, "+"],
|
|
17963
|
+
[o.BinaryOperator.NullishCoalesce, "??"],
|
|
17964
|
+
[o.BinaryOperator.Exponentiation, "**"],
|
|
17965
|
+
[o.BinaryOperator.In, "in"],
|
|
17966
|
+
[o.BinaryOperator.InstanceOf, "instanceof"],
|
|
17967
|
+
[o.BinaryOperator.Assign, "="],
|
|
17968
|
+
[o.BinaryOperator.AdditionAssignment, "+="],
|
|
17969
|
+
[o.BinaryOperator.SubtractionAssignment, "-="],
|
|
17970
|
+
[o.BinaryOperator.MultiplicationAssignment, "*="],
|
|
17971
|
+
[o.BinaryOperator.DivisionAssignment, "/="],
|
|
17972
|
+
[o.BinaryOperator.RemainderAssignment, "%="],
|
|
17973
|
+
[o.BinaryOperator.ExponentiationAssignment, "**="],
|
|
17974
|
+
[o.BinaryOperator.AndAssignment, "&&="],
|
|
17975
|
+
[o.BinaryOperator.OrAssignment, "||="],
|
|
17976
|
+
[o.BinaryOperator.NullishCoalesceAssignment, "??="]
|
|
17977
|
+
]);
|
|
17978
|
+
});
|
|
17979
|
+
|
|
17980
|
+
// src/dev/angular/vendor/translator/ts_util.ts
|
|
17981
|
+
import ts5 from "typescript";
|
|
17982
|
+
function tsNumericExpression(value) {
|
|
17983
|
+
if (value < 0) {
|
|
17984
|
+
const operand = ts5.factory.createNumericLiteral(Math.abs(value));
|
|
17985
|
+
return ts5.factory.createPrefixUnaryExpression(ts5.SyntaxKind.MinusToken, operand);
|
|
17986
|
+
}
|
|
17987
|
+
return ts5.factory.createNumericLiteral(value);
|
|
17988
|
+
}
|
|
17989
|
+
var init_ts_util = __esm(() => {
|
|
17990
|
+
/*!
|
|
17991
|
+
* @license
|
|
17992
|
+
* Copyright Google LLC All Rights Reserved.
|
|
17993
|
+
*
|
|
17994
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
17995
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
17996
|
+
*/
|
|
17997
|
+
});
|
|
17998
|
+
|
|
17999
|
+
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
18000
|
+
import ts6 from "typescript";
|
|
18001
|
+
|
|
18002
|
+
class TypeScriptAstFactory {
|
|
18003
|
+
annotateForClosureCompiler;
|
|
18004
|
+
externalSourceFiles = new Map;
|
|
18005
|
+
UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
18006
|
+
"+": ts6.SyntaxKind.PlusToken,
|
|
18007
|
+
"-": ts6.SyntaxKind.MinusToken,
|
|
18008
|
+
"!": ts6.SyntaxKind.ExclamationToken
|
|
18009
|
+
}))();
|
|
18010
|
+
BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
18011
|
+
"&&": ts6.SyntaxKind.AmpersandAmpersandToken,
|
|
18012
|
+
">": ts6.SyntaxKind.GreaterThanToken,
|
|
18013
|
+
">=": ts6.SyntaxKind.GreaterThanEqualsToken,
|
|
18014
|
+
"&": ts6.SyntaxKind.AmpersandToken,
|
|
18015
|
+
"|": ts6.SyntaxKind.BarToken,
|
|
18016
|
+
"/": ts6.SyntaxKind.SlashToken,
|
|
18017
|
+
"==": ts6.SyntaxKind.EqualsEqualsToken,
|
|
18018
|
+
"===": ts6.SyntaxKind.EqualsEqualsEqualsToken,
|
|
18019
|
+
"<": ts6.SyntaxKind.LessThanToken,
|
|
18020
|
+
"<=": ts6.SyntaxKind.LessThanEqualsToken,
|
|
18021
|
+
"-": ts6.SyntaxKind.MinusToken,
|
|
18022
|
+
"%": ts6.SyntaxKind.PercentToken,
|
|
18023
|
+
"*": ts6.SyntaxKind.AsteriskToken,
|
|
18024
|
+
"**": ts6.SyntaxKind.AsteriskAsteriskToken,
|
|
18025
|
+
"!=": ts6.SyntaxKind.ExclamationEqualsToken,
|
|
18026
|
+
"!==": ts6.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
18027
|
+
"||": ts6.SyntaxKind.BarBarToken,
|
|
18028
|
+
"+": ts6.SyntaxKind.PlusToken,
|
|
18029
|
+
"??": ts6.SyntaxKind.QuestionQuestionToken,
|
|
18030
|
+
"=": ts6.SyntaxKind.EqualsToken,
|
|
18031
|
+
"+=": ts6.SyntaxKind.PlusEqualsToken,
|
|
18032
|
+
"-=": ts6.SyntaxKind.MinusEqualsToken,
|
|
18033
|
+
"*=": ts6.SyntaxKind.AsteriskEqualsToken,
|
|
18034
|
+
"/=": ts6.SyntaxKind.SlashEqualsToken,
|
|
18035
|
+
"%=": ts6.SyntaxKind.PercentEqualsToken,
|
|
18036
|
+
"**=": ts6.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
18037
|
+
"&&=": ts6.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
18038
|
+
"||=": ts6.SyntaxKind.BarBarEqualsToken,
|
|
18039
|
+
"??=": ts6.SyntaxKind.QuestionQuestionEqualsToken,
|
|
18040
|
+
in: ts6.SyntaxKind.InKeyword,
|
|
18041
|
+
instanceof: ts6.SyntaxKind.InstanceOfKeyword
|
|
18042
|
+
}))();
|
|
18043
|
+
VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
18044
|
+
const: ts6.NodeFlags.Const,
|
|
18045
|
+
let: ts6.NodeFlags.Let,
|
|
18046
|
+
var: ts6.NodeFlags.None
|
|
18047
|
+
}))();
|
|
18048
|
+
constructor(annotateForClosureCompiler) {
|
|
18049
|
+
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
18050
|
+
}
|
|
18051
|
+
attachComments = attachComments;
|
|
18052
|
+
createArrayLiteral = ts6.factory.createArrayLiteralExpression;
|
|
18053
|
+
createAssignment(target, operator, value) {
|
|
18054
|
+
return ts6.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
18055
|
+
}
|
|
18056
|
+
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
18057
|
+
return ts6.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
18058
|
+
}
|
|
18059
|
+
createBlock(body) {
|
|
18060
|
+
return ts6.factory.createBlock(body);
|
|
18061
|
+
}
|
|
18062
|
+
createCallExpression(callee, args, pure) {
|
|
18063
|
+
const call = ts6.factory.createCallExpression(callee, undefined, args);
|
|
18064
|
+
if (pure) {
|
|
18065
|
+
ts6.addSyntheticLeadingComment(call, ts6.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
18066
|
+
}
|
|
18067
|
+
return call;
|
|
18068
|
+
}
|
|
18069
|
+
createConditional(condition, whenTrue, whenFalse) {
|
|
18070
|
+
return ts6.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
18071
|
+
}
|
|
18072
|
+
createElementAccess = ts6.factory.createElementAccessExpression;
|
|
18073
|
+
createExpressionStatement = ts6.factory.createExpressionStatement;
|
|
18074
|
+
createDynamicImport(url) {
|
|
18075
|
+
return ts6.factory.createCallExpression(ts6.factory.createToken(ts6.SyntaxKind.ImportKeyword), undefined, [typeof url === "string" ? ts6.factory.createStringLiteral(url) : url]);
|
|
18076
|
+
}
|
|
18077
|
+
createFunctionDeclaration(functionName, parameters, body) {
|
|
18078
|
+
if (!ts6.isBlock(body)) {
|
|
18079
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
18080
|
+
}
|
|
18081
|
+
return ts6.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
18082
|
+
}
|
|
18083
|
+
createFunctionExpression(functionName, parameters, body) {
|
|
18084
|
+
if (!ts6.isBlock(body)) {
|
|
18085
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
18086
|
+
}
|
|
18087
|
+
return ts6.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
18088
|
+
}
|
|
18089
|
+
createArrowFunctionExpression(parameters, body) {
|
|
18090
|
+
if (ts6.isStatement(body) && !ts6.isBlock(body)) {
|
|
18091
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts6.SyntaxKind[body.kind]}.`);
|
|
18092
|
+
}
|
|
18093
|
+
return ts6.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
18094
|
+
}
|
|
18095
|
+
createParameter(param) {
|
|
18096
|
+
return ts6.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
18097
|
+
}
|
|
18098
|
+
createIdentifier = ts6.factory.createIdentifier;
|
|
18099
|
+
createIfStatement(condition, thenStatement, elseStatement) {
|
|
18100
|
+
return ts6.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
18101
|
+
}
|
|
18102
|
+
createLiteral(value) {
|
|
18103
|
+
if (value === undefined) {
|
|
18104
|
+
return ts6.factory.createIdentifier("undefined");
|
|
18105
|
+
} else if (value === null) {
|
|
18106
|
+
return ts6.factory.createNull();
|
|
18107
|
+
} else if (typeof value === "boolean") {
|
|
18108
|
+
return value ? ts6.factory.createTrue() : ts6.factory.createFalse();
|
|
18109
|
+
} else if (typeof value === "number") {
|
|
18110
|
+
return tsNumericExpression(value);
|
|
18111
|
+
} else {
|
|
18112
|
+
return ts6.factory.createStringLiteral(value);
|
|
18113
|
+
}
|
|
18114
|
+
}
|
|
18115
|
+
createNewExpression(expression, args) {
|
|
18116
|
+
return ts6.factory.createNewExpression(expression, undefined, args);
|
|
18117
|
+
}
|
|
18118
|
+
createObjectLiteral(properties) {
|
|
18119
|
+
return ts6.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
18120
|
+
if (prop.kind === "spread") {
|
|
18121
|
+
return ts6.factory.createSpreadAssignment(prop.expression);
|
|
18122
|
+
}
|
|
18123
|
+
return ts6.factory.createPropertyAssignment(prop.quoted ? ts6.factory.createStringLiteral(prop.propertyName) : ts6.factory.createIdentifier(prop.propertyName), prop.value);
|
|
18124
|
+
}));
|
|
18125
|
+
}
|
|
18126
|
+
createParenthesizedExpression = ts6.factory.createParenthesizedExpression;
|
|
18127
|
+
createPropertyAccess = ts6.factory.createPropertyAccessExpression;
|
|
18128
|
+
createSpreadElement = ts6.factory.createSpreadElement;
|
|
18129
|
+
createReturnStatement(expression) {
|
|
18130
|
+
return ts6.factory.createReturnStatement(expression ?? undefined);
|
|
18131
|
+
}
|
|
18132
|
+
createTaggedTemplate(tag, template) {
|
|
18133
|
+
return ts6.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
18134
|
+
}
|
|
18135
|
+
createTemplateLiteral(template) {
|
|
18136
|
+
let templateLiteral;
|
|
18137
|
+
const length = template.elements.length;
|
|
18138
|
+
const head = template.elements[0];
|
|
18139
|
+
if (length === 1) {
|
|
18140
|
+
templateLiteral = ts6.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
18141
|
+
} else {
|
|
18142
|
+
const spans = [];
|
|
18143
|
+
for (let i = 1;i < length - 1; i++) {
|
|
18144
|
+
const { cooked, raw, range } = template.elements[i];
|
|
18145
|
+
const middle = createTemplateMiddle(cooked, raw);
|
|
18146
|
+
if (range !== null) {
|
|
18147
|
+
this.setSourceMapRange(middle, range);
|
|
18148
|
+
}
|
|
18149
|
+
spans.push(ts6.factory.createTemplateSpan(template.expressions[i - 1], middle));
|
|
18150
|
+
}
|
|
18151
|
+
const resolvedExpression = template.expressions[length - 2];
|
|
18152
|
+
const templatePart = template.elements[length - 1];
|
|
18153
|
+
const templateTail = createTemplateTail(templatePart.cooked, templatePart.raw);
|
|
18154
|
+
if (templatePart.range !== null) {
|
|
18155
|
+
this.setSourceMapRange(templateTail, templatePart.range);
|
|
18156
|
+
}
|
|
18157
|
+
spans.push(ts6.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
18158
|
+
templateLiteral = ts6.factory.createTemplateExpression(ts6.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
18159
|
+
}
|
|
18160
|
+
if (head.range !== null) {
|
|
18161
|
+
this.setSourceMapRange(templateLiteral, head.range);
|
|
18162
|
+
}
|
|
18163
|
+
return templateLiteral;
|
|
18164
|
+
}
|
|
18165
|
+
createThrowStatement = ts6.factory.createThrowStatement;
|
|
18166
|
+
createTypeOfExpression = ts6.factory.createTypeOfExpression;
|
|
18167
|
+
createVoidExpression = ts6.factory.createVoidExpression;
|
|
18168
|
+
createUnaryExpression(operator, operand) {
|
|
18169
|
+
return ts6.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
18170
|
+
}
|
|
18171
|
+
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
18172
|
+
return ts6.factory.createVariableStatement(undefined, ts6.factory.createVariableDeclarationList([
|
|
18173
|
+
ts6.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
18174
|
+
], this.VAR_TYPES[variableType]));
|
|
18175
|
+
}
|
|
18176
|
+
createRegularExpressionLiteral(body, flags) {
|
|
18177
|
+
return ts6.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
18178
|
+
}
|
|
18179
|
+
setSourceMapRange(node, sourceMapRange) {
|
|
18180
|
+
if (sourceMapRange === null) {
|
|
18181
|
+
return node;
|
|
18182
|
+
}
|
|
18183
|
+
const url = sourceMapRange.url;
|
|
18184
|
+
if (!this.externalSourceFiles.has(url)) {
|
|
18185
|
+
this.externalSourceFiles.set(url, ts6.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
18186
|
+
}
|
|
18187
|
+
const source = this.externalSourceFiles.get(url);
|
|
18188
|
+
ts6.setSourceMapRange(node, {
|
|
18189
|
+
pos: sourceMapRange.start.offset,
|
|
18190
|
+
end: sourceMapRange.end.offset,
|
|
18191
|
+
source
|
|
18192
|
+
});
|
|
18193
|
+
return node;
|
|
18194
|
+
}
|
|
18195
|
+
createBuiltInType(type) {
|
|
18196
|
+
switch (type) {
|
|
18197
|
+
case "any":
|
|
18198
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.AnyKeyword);
|
|
18199
|
+
case "boolean":
|
|
18200
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.BooleanKeyword);
|
|
18201
|
+
case "number":
|
|
18202
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.NumberKeyword);
|
|
18203
|
+
case "string":
|
|
18204
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.StringKeyword);
|
|
18205
|
+
case "function":
|
|
18206
|
+
return ts6.factory.createTypeReferenceNode(ts6.factory.createIdentifier("Function"));
|
|
18207
|
+
case "never":
|
|
18208
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.NeverKeyword);
|
|
18209
|
+
case "unknown":
|
|
18210
|
+
return ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.UnknownKeyword);
|
|
18211
|
+
}
|
|
18212
|
+
}
|
|
18213
|
+
createExpressionType(expression, typeParams) {
|
|
18214
|
+
const typeName = getEntityTypeFromExpression(expression);
|
|
18215
|
+
return ts6.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
18216
|
+
}
|
|
18217
|
+
createArrayType(elementType) {
|
|
18218
|
+
return ts6.factory.createArrayTypeNode(elementType);
|
|
18219
|
+
}
|
|
18220
|
+
createMapType(valueType) {
|
|
18221
|
+
return ts6.factory.createTypeLiteralNode([
|
|
18222
|
+
ts6.factory.createIndexSignature(undefined, [
|
|
18223
|
+
ts6.factory.createParameterDeclaration(undefined, undefined, "key", undefined, ts6.factory.createKeywordTypeNode(ts6.SyntaxKind.StringKeyword))
|
|
18224
|
+
], valueType)
|
|
18225
|
+
]);
|
|
18226
|
+
}
|
|
18227
|
+
transplantType(type) {
|
|
18228
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts6.isTypeNode(type)) {
|
|
18229
|
+
return type;
|
|
18230
|
+
}
|
|
18231
|
+
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
18232
|
+
}
|
|
18233
|
+
}
|
|
18234
|
+
function createTemplateMiddle(cooked, raw) {
|
|
18235
|
+
const node = ts6.factory.createTemplateHead(cooked, raw);
|
|
18236
|
+
node.kind = ts6.SyntaxKind.TemplateMiddle;
|
|
18237
|
+
return node;
|
|
18238
|
+
}
|
|
18239
|
+
function createTemplateTail(cooked, raw) {
|
|
18240
|
+
const node = ts6.factory.createTemplateHead(cooked, raw);
|
|
18241
|
+
node.kind = ts6.SyntaxKind.TemplateTail;
|
|
18242
|
+
return node;
|
|
18243
|
+
}
|
|
18244
|
+
function attachComments(statement, leadingComments) {
|
|
18245
|
+
for (const comment of leadingComments) {
|
|
18246
|
+
const commentKind = comment.multiline ? ts6.SyntaxKind.MultiLineCommentTrivia : ts6.SyntaxKind.SingleLineCommentTrivia;
|
|
18247
|
+
if (comment.multiline) {
|
|
18248
|
+
ts6.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
18249
|
+
} else {
|
|
18250
|
+
for (const line of comment.toString().split(`
|
|
18251
|
+
`)) {
|
|
18252
|
+
ts6.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
18253
|
+
}
|
|
18254
|
+
}
|
|
18255
|
+
}
|
|
18256
|
+
}
|
|
18257
|
+
function getEntityTypeFromExpression(expression) {
|
|
18258
|
+
if (ts6.isIdentifier(expression)) {
|
|
18259
|
+
return expression;
|
|
18260
|
+
}
|
|
18261
|
+
if (ts6.isPropertyAccessExpression(expression)) {
|
|
18262
|
+
const left = getEntityTypeFromExpression(expression.expression);
|
|
18263
|
+
if (!ts6.isIdentifier(expression.name)) {
|
|
18264
|
+
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
18265
|
+
}
|
|
18266
|
+
return ts6.factory.createQualifiedName(left, expression.name);
|
|
18267
|
+
}
|
|
18268
|
+
throw new Error(`Unsupported expression for type reference: ${ts6.SyntaxKind[expression.kind]}`);
|
|
18269
|
+
}
|
|
18270
|
+
var init_typescript_ast_factory = __esm(() => {
|
|
18271
|
+
init_ts_util();
|
|
18272
|
+
});
|
|
18273
|
+
|
|
18274
|
+
// src/dev/angular/vendor/translator/typescript_translator.ts
|
|
18275
|
+
function translateStatement(contextFile, statement, imports, options = {}) {
|
|
18276
|
+
return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, contextFile, options), new Context(true));
|
|
18277
|
+
}
|
|
18278
|
+
var init_typescript_translator = __esm(() => {
|
|
18279
|
+
init_translator();
|
|
18280
|
+
init_typescript_ast_factory();
|
|
18281
|
+
});
|
|
18282
|
+
|
|
18283
|
+
// src/dev/angular/fastHmrCompiler.ts
|
|
18284
|
+
var exports_fastHmrCompiler = {};
|
|
18285
|
+
__export(exports_fastHmrCompiler, {
|
|
18286
|
+
tryFastHmr: () => tryFastHmr,
|
|
18287
|
+
recordFingerprint: () => recordFingerprint,
|
|
18288
|
+
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
18289
|
+
});
|
|
18290
|
+
import { existsSync as existsSync26, readFileSync as readFileSync20 } from "fs";
|
|
18291
|
+
import { dirname as dirname19, relative as relative13, resolve as resolve33 } from "path";
|
|
18292
|
+
import ts7 from "typescript";
|
|
18293
|
+
var fail = (reason, detail) => ({ ok: false, reason, detail }), fingerprintCache, fingerprintsEqual = (a, b2) => {
|
|
18294
|
+
if (a.className !== b2.className)
|
|
18295
|
+
return false;
|
|
18296
|
+
if (a.selector !== b2.selector)
|
|
18297
|
+
return false;
|
|
18298
|
+
if (a.standalone !== b2.standalone)
|
|
18299
|
+
return false;
|
|
18300
|
+
if (a.importsArity !== b2.importsArity)
|
|
18301
|
+
return false;
|
|
18302
|
+
if (a.hasProviders !== b2.hasProviders)
|
|
18303
|
+
return false;
|
|
18304
|
+
if (a.hasViewProviders !== b2.hasViewProviders)
|
|
18305
|
+
return false;
|
|
18306
|
+
if (a.ctorParamTypes.length !== b2.ctorParamTypes.length)
|
|
18307
|
+
return false;
|
|
18308
|
+
for (let i = 0;i < a.ctorParamTypes.length; i++) {
|
|
18309
|
+
if (a.ctorParamTypes[i] !== b2.ctorParamTypes[i])
|
|
18310
|
+
return false;
|
|
18311
|
+
}
|
|
18312
|
+
if (a.inputs.length !== b2.inputs.length)
|
|
18313
|
+
return false;
|
|
18314
|
+
for (let i = 0;i < a.inputs.length; i++) {
|
|
18315
|
+
if (a.inputs[i] !== b2.inputs[i])
|
|
18316
|
+
return false;
|
|
18317
|
+
}
|
|
18318
|
+
if (a.outputs.length !== b2.outputs.length)
|
|
18319
|
+
return false;
|
|
18320
|
+
for (let i = 0;i < a.outputs.length; i++) {
|
|
18321
|
+
if (a.outputs[i] !== b2.outputs[i])
|
|
18322
|
+
return false;
|
|
18323
|
+
}
|
|
18324
|
+
return true;
|
|
18325
|
+
}, recordFingerprint = (id, fp) => {
|
|
18326
|
+
fingerprintCache.set(id, fp);
|
|
18327
|
+
}, invalidateFingerprintCache = () => {
|
|
18328
|
+
fingerprintCache.clear();
|
|
18329
|
+
}, findClassDeclaration = (sourceFile, className) => {
|
|
18330
|
+
let found = null;
|
|
18331
|
+
const walk = (node) => {
|
|
18332
|
+
if (found)
|
|
18333
|
+
return;
|
|
18334
|
+
if (ts7.isClassDeclaration(node) && node.name?.text === className) {
|
|
18335
|
+
found = node;
|
|
18336
|
+
return;
|
|
18337
|
+
}
|
|
18338
|
+
ts7.forEachChild(node, walk);
|
|
18339
|
+
};
|
|
18340
|
+
walk(sourceFile);
|
|
18341
|
+
return found;
|
|
18342
|
+
}, getClassDecorators = (cls) => {
|
|
18343
|
+
const modifiers = ts7.getDecorators(cls) ?? [];
|
|
18344
|
+
return [...modifiers];
|
|
18345
|
+
}, findComponentDecorator = (cls) => {
|
|
18346
|
+
for (const decorator of getClassDecorators(cls)) {
|
|
18347
|
+
const expr = decorator.expression;
|
|
18348
|
+
if (ts7.isCallExpression(expr)) {
|
|
18349
|
+
const fn2 = expr.expression;
|
|
18350
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "Component") {
|
|
18351
|
+
return decorator;
|
|
18352
|
+
}
|
|
18353
|
+
}
|
|
18354
|
+
}
|
|
18355
|
+
return null;
|
|
18356
|
+
}, getDecoratorArgsObject = (decorator) => {
|
|
18357
|
+
const call = decorator.expression;
|
|
18358
|
+
if (!ts7.isCallExpression(call))
|
|
18359
|
+
return null;
|
|
18360
|
+
const arg = call.arguments[0];
|
|
18361
|
+
if (!arg || !ts7.isObjectLiteralExpression(arg))
|
|
18362
|
+
return null;
|
|
18363
|
+
return arg;
|
|
18364
|
+
}, getProperty = (obj, name) => {
|
|
18365
|
+
for (const prop of obj.properties) {
|
|
18366
|
+
if (ts7.isPropertyAssignment(prop) && (ts7.isIdentifier(prop.name) && prop.name.text === name || ts7.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
18367
|
+
return prop.initializer;
|
|
18368
|
+
}
|
|
18369
|
+
}
|
|
18370
|
+
return null;
|
|
18371
|
+
}, getStringProperty = (obj, name) => {
|
|
18372
|
+
const expr = getProperty(obj, name);
|
|
18373
|
+
if (!expr)
|
|
18374
|
+
return null;
|
|
18375
|
+
if (ts7.isStringLiteral(expr) || ts7.isNoSubstitutionTemplateLiteral(expr)) {
|
|
18376
|
+
return expr.text;
|
|
18377
|
+
}
|
|
18378
|
+
return null;
|
|
18379
|
+
}, getBooleanProperty = (obj, name) => {
|
|
18380
|
+
const expr = getProperty(obj, name);
|
|
18381
|
+
if (!expr)
|
|
18382
|
+
return null;
|
|
18383
|
+
if (expr.kind === ts7.SyntaxKind.TrueKeyword)
|
|
18384
|
+
return true;
|
|
18385
|
+
if (expr.kind === ts7.SyntaxKind.FalseKeyword)
|
|
18386
|
+
return false;
|
|
18387
|
+
return null;
|
|
18388
|
+
}, inheritsDecoratedClass = (cls) => {
|
|
18389
|
+
const heritage = cls.heritageClauses ?? [];
|
|
18390
|
+
for (const clause of heritage) {
|
|
18391
|
+
if (clause.token !== ts7.SyntaxKind.ExtendsKeyword)
|
|
18392
|
+
continue;
|
|
18393
|
+
if (clause.types.length > 0)
|
|
18394
|
+
return true;
|
|
18395
|
+
}
|
|
18396
|
+
return false;
|
|
18397
|
+
}, readDecoratorMeta = (args) => {
|
|
18398
|
+
const styleUrlsExpr = getProperty(args, "styleUrls");
|
|
18399
|
+
const stylesExpr = getProperty(args, "styles");
|
|
18400
|
+
const importsExpr = getProperty(args, "imports");
|
|
18401
|
+
const styleUrls = [];
|
|
18402
|
+
if (styleUrlsExpr && ts7.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
18403
|
+
for (const el of styleUrlsExpr.elements) {
|
|
18404
|
+
if (ts7.isStringLiteral(el))
|
|
18405
|
+
styleUrls.push(el.text);
|
|
18406
|
+
}
|
|
18407
|
+
}
|
|
18408
|
+
const styles = [];
|
|
18409
|
+
if (stylesExpr) {
|
|
18410
|
+
if (ts7.isArrayLiteralExpression(stylesExpr)) {
|
|
18411
|
+
for (const el of stylesExpr.elements) {
|
|
18412
|
+
if (ts7.isStringLiteral(el) || ts7.isNoSubstitutionTemplateLiteral(el)) {
|
|
18413
|
+
styles.push(el.text);
|
|
18414
|
+
}
|
|
18415
|
+
}
|
|
18416
|
+
} else if (ts7.isStringLiteral(stylesExpr) || ts7.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
18417
|
+
styles.push(stylesExpr.text);
|
|
18418
|
+
}
|
|
18419
|
+
}
|
|
18420
|
+
return {
|
|
18421
|
+
hasProviders: getProperty(args, "providers") !== null,
|
|
18422
|
+
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
18423
|
+
importsExpr: importsExpr && ts7.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
|
|
18424
|
+
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? false,
|
|
18425
|
+
selector: getStringProperty(args, "selector"),
|
|
18426
|
+
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
18427
|
+
styleUrl: getStringProperty(args, "styleUrl"),
|
|
18428
|
+
styleUrls,
|
|
18429
|
+
styles,
|
|
18430
|
+
template: getStringProperty(args, "template"),
|
|
18431
|
+
templateUrl: getStringProperty(args, "templateUrl")
|
|
18432
|
+
};
|
|
18433
|
+
}, extractDecoratorInput = (prop) => {
|
|
18434
|
+
const decorators = ts7.getDecorators(prop) ?? [];
|
|
18435
|
+
for (const decorator of decorators) {
|
|
18436
|
+
const expr = decorator.expression;
|
|
18437
|
+
if (!ts7.isCallExpression(expr))
|
|
18438
|
+
continue;
|
|
18439
|
+
const fn2 = expr.expression;
|
|
18440
|
+
if (!ts7.isIdentifier(fn2) || fn2.text !== "Input")
|
|
18441
|
+
continue;
|
|
18442
|
+
const classPropertyName = prop.name.getText();
|
|
18443
|
+
let bindingPropertyName = classPropertyName;
|
|
18444
|
+
let required = false;
|
|
18445
|
+
const arg = expr.arguments[0];
|
|
18446
|
+
if (arg) {
|
|
18447
|
+
if (ts7.isStringLiteral(arg)) {
|
|
18448
|
+
bindingPropertyName = arg.text;
|
|
18449
|
+
} else if (ts7.isObjectLiteralExpression(arg)) {
|
|
18450
|
+
const aliasNode = getStringProperty(arg, "alias");
|
|
18451
|
+
if (aliasNode !== null)
|
|
18452
|
+
bindingPropertyName = aliasNode;
|
|
18453
|
+
required = getBooleanProperty(arg, "required") ?? false;
|
|
18454
|
+
}
|
|
18455
|
+
}
|
|
18456
|
+
return {
|
|
18457
|
+
classPropertyName,
|
|
18458
|
+
meta: {
|
|
18459
|
+
classPropertyName,
|
|
18460
|
+
bindingPropertyName,
|
|
18461
|
+
required,
|
|
18462
|
+
isSignal: false,
|
|
18463
|
+
transformFunction: null
|
|
18464
|
+
}
|
|
18465
|
+
};
|
|
18466
|
+
}
|
|
18467
|
+
return null;
|
|
18468
|
+
}, isInputSignalCall = (init) => {
|
|
18469
|
+
if (ts7.isCallExpression(init)) {
|
|
18470
|
+
const fn2 = init.expression;
|
|
18471
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "input")
|
|
18472
|
+
return true;
|
|
18473
|
+
if (ts7.isPropertyAccessExpression(fn2) && ts7.isIdentifier(fn2.expression) && fn2.expression.text === "input") {
|
|
18474
|
+
return true;
|
|
18475
|
+
}
|
|
18476
|
+
}
|
|
18477
|
+
return false;
|
|
18478
|
+
}, extractSignalInput = (prop) => {
|
|
18479
|
+
if (!prop.initializer || !isInputSignalCall(prop.initializer))
|
|
18480
|
+
return null;
|
|
18481
|
+
const classPropertyName = prop.name.getText();
|
|
18482
|
+
const call = prop.initializer;
|
|
18483
|
+
let required = false;
|
|
18484
|
+
if (ts7.isPropertyAccessExpression(call.expression) && ts7.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
18485
|
+
required = true;
|
|
18486
|
+
}
|
|
18487
|
+
let bindingPropertyName = classPropertyName;
|
|
18488
|
+
const optsArg = call.arguments[required ? 0 : 1];
|
|
18489
|
+
if (optsArg && ts7.isObjectLiteralExpression(optsArg)) {
|
|
18490
|
+
const aliasNode = getStringProperty(optsArg, "alias");
|
|
18491
|
+
if (aliasNode !== null)
|
|
18492
|
+
bindingPropertyName = aliasNode;
|
|
18493
|
+
}
|
|
18494
|
+
return {
|
|
18495
|
+
classPropertyName,
|
|
18496
|
+
meta: {
|
|
18497
|
+
classPropertyName,
|
|
18498
|
+
bindingPropertyName,
|
|
18499
|
+
required,
|
|
18500
|
+
isSignal: true,
|
|
18501
|
+
transformFunction: null
|
|
18502
|
+
}
|
|
18503
|
+
};
|
|
18504
|
+
}, extractDecoratorOutput = (prop) => {
|
|
18505
|
+
const decorators = ts7.getDecorators(prop) ?? [];
|
|
18506
|
+
for (const decorator of decorators) {
|
|
18507
|
+
const expr = decorator.expression;
|
|
18508
|
+
if (!ts7.isCallExpression(expr))
|
|
18509
|
+
continue;
|
|
18510
|
+
const fn2 = expr.expression;
|
|
18511
|
+
if (!ts7.isIdentifier(fn2) || fn2.text !== "Output")
|
|
18512
|
+
continue;
|
|
18513
|
+
const classPropertyName = prop.name.getText();
|
|
18514
|
+
let bindingName = classPropertyName;
|
|
18515
|
+
const arg = expr.arguments[0];
|
|
18516
|
+
if (arg && ts7.isStringLiteral(arg))
|
|
18517
|
+
bindingName = arg.text;
|
|
18518
|
+
return { classPropertyName, bindingName };
|
|
18519
|
+
}
|
|
18520
|
+
return null;
|
|
18521
|
+
}, isOutputSignalCall = (init) => {
|
|
18522
|
+
if (ts7.isCallExpression(init)) {
|
|
18523
|
+
const fn2 = init.expression;
|
|
18524
|
+
if (ts7.isIdentifier(fn2) && fn2.text === "output")
|
|
18525
|
+
return true;
|
|
18526
|
+
if (ts7.isPropertyAccessExpression(fn2) && ts7.isIdentifier(fn2.expression) && fn2.expression.text === "output") {
|
|
18527
|
+
return true;
|
|
18528
|
+
}
|
|
18529
|
+
}
|
|
18530
|
+
return false;
|
|
18531
|
+
}, extractSignalOutput = (prop) => {
|
|
18532
|
+
if (!prop.initializer || !isOutputSignalCall(prop.initializer))
|
|
18533
|
+
return null;
|
|
18534
|
+
const classPropertyName = prop.name.getText();
|
|
18535
|
+
const call = prop.initializer;
|
|
18536
|
+
let bindingName = classPropertyName;
|
|
18537
|
+
const optsArg = call.arguments[0];
|
|
18538
|
+
if (optsArg && ts7.isObjectLiteralExpression(optsArg)) {
|
|
18539
|
+
const aliasNode = getStringProperty(optsArg, "alias");
|
|
18540
|
+
if (aliasNode !== null)
|
|
18541
|
+
bindingName = aliasNode;
|
|
18542
|
+
}
|
|
18543
|
+
return { classPropertyName, bindingName };
|
|
18544
|
+
}, extractInputsAndOutputs = (cls) => {
|
|
18545
|
+
const inputs = {};
|
|
18546
|
+
const outputs = {};
|
|
18547
|
+
for (const member of cls.members) {
|
|
18548
|
+
if (!ts7.isPropertyDeclaration(member))
|
|
18549
|
+
continue;
|
|
18550
|
+
const decoratorIn = extractDecoratorInput(member);
|
|
18551
|
+
if (decoratorIn) {
|
|
18552
|
+
inputs[decoratorIn.classPropertyName] = decoratorIn.meta;
|
|
18553
|
+
continue;
|
|
18554
|
+
}
|
|
18555
|
+
const signalIn = extractSignalInput(member);
|
|
18556
|
+
if (signalIn) {
|
|
18557
|
+
inputs[signalIn.classPropertyName] = signalIn.meta;
|
|
18558
|
+
continue;
|
|
18559
|
+
}
|
|
18560
|
+
const decoratorOut = extractDecoratorOutput(member);
|
|
18561
|
+
if (decoratorOut) {
|
|
18562
|
+
outputs[decoratorOut.classPropertyName] = decoratorOut.bindingName;
|
|
18563
|
+
continue;
|
|
18564
|
+
}
|
|
18565
|
+
const signalOut = extractSignalOutput(member);
|
|
18566
|
+
if (signalOut) {
|
|
18567
|
+
outputs[signalOut.classPropertyName] = signalOut.bindingName;
|
|
18568
|
+
}
|
|
18569
|
+
}
|
|
18570
|
+
return { inputs, outputs };
|
|
18571
|
+
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs) => {
|
|
18572
|
+
const ctorParamTypes = [];
|
|
18573
|
+
for (const member of cls.members) {
|
|
18574
|
+
if (!ts7.isConstructorDeclaration(member))
|
|
18575
|
+
continue;
|
|
18576
|
+
for (const param of member.parameters) {
|
|
18577
|
+
ctorParamTypes.push(param.type ? param.type.getText() : "");
|
|
18578
|
+
}
|
|
18579
|
+
break;
|
|
18580
|
+
}
|
|
18581
|
+
const inputNames = Object.keys(inputs).sort();
|
|
18582
|
+
const outputNames = Object.keys(outputs).sort();
|
|
18583
|
+
const importsArity = decoratorMeta.importsExpr ? decoratorMeta.importsExpr.elements.length : 0;
|
|
18584
|
+
const hasProviders = decoratorMeta.hasProviders;
|
|
18585
|
+
const hasViewProviders = decoratorMeta.hasViewProviders;
|
|
18586
|
+
return {
|
|
18587
|
+
className,
|
|
18588
|
+
ctorParamTypes,
|
|
18589
|
+
hasProviders,
|
|
18590
|
+
hasViewProviders,
|
|
18591
|
+
importsArity,
|
|
18592
|
+
inputs: inputNames,
|
|
18593
|
+
outputs: outputNames,
|
|
18594
|
+
selector: decoratorMeta.selector,
|
|
18595
|
+
standalone: decoratorMeta.standalone
|
|
18596
|
+
};
|
|
18597
|
+
}, resolveAndReadResource = (componentDir, url) => {
|
|
18598
|
+
const abs = resolve33(componentDir, url);
|
|
18599
|
+
if (!existsSync26(abs))
|
|
18600
|
+
return null;
|
|
18601
|
+
return readFileSync20(abs, "utf8");
|
|
18602
|
+
}, collectStyles = (decoratorMeta, componentDir) => {
|
|
18603
|
+
const styles = [...decoratorMeta.styles];
|
|
18604
|
+
const urls = [];
|
|
18605
|
+
if (decoratorMeta.styleUrl)
|
|
18606
|
+
urls.push(decoratorMeta.styleUrl);
|
|
18607
|
+
urls.push(...decoratorMeta.styleUrls);
|
|
18608
|
+
for (const url of urls) {
|
|
18609
|
+
const css = resolveAndReadResource(componentDir, url);
|
|
18610
|
+
if (css === null)
|
|
18611
|
+
return { styles, missing: url };
|
|
18612
|
+
styles.push(css);
|
|
18613
|
+
}
|
|
18614
|
+
return { styles, missing: null };
|
|
18615
|
+
}, tryFastHmr = async (params) => {
|
|
18616
|
+
const { componentFilePath, className } = params;
|
|
18617
|
+
const projectRoot = params.projectRoot ?? process.cwd();
|
|
18618
|
+
if (!existsSync26(componentFilePath)) {
|
|
18619
|
+
return fail("file-not-found", componentFilePath);
|
|
18620
|
+
}
|
|
18621
|
+
let compiler;
|
|
18622
|
+
try {
|
|
18623
|
+
compiler = await import("@angular/compiler");
|
|
18624
|
+
} catch (err) {
|
|
18625
|
+
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
18626
|
+
}
|
|
18627
|
+
const tsSource = readFileSync20(componentFilePath, "utf8");
|
|
18628
|
+
const sourceFile = ts7.createSourceFile(componentFilePath, tsSource, ts7.ScriptTarget.ES2022, true, ts7.ScriptKind.TS);
|
|
18629
|
+
const classNode = findClassDeclaration(sourceFile, className);
|
|
18630
|
+
if (!classNode) {
|
|
18631
|
+
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
18632
|
+
}
|
|
18633
|
+
if (inheritsDecoratedClass(classNode)) {
|
|
18634
|
+
return fail("inherits-decorated-class");
|
|
18635
|
+
}
|
|
18636
|
+
const decorator = findComponentDecorator(classNode);
|
|
18637
|
+
if (!decorator)
|
|
18638
|
+
return fail("no-component-decorator");
|
|
18639
|
+
const decoratorArgs = getDecoratorArgsObject(decorator);
|
|
18640
|
+
if (!decoratorArgs)
|
|
18641
|
+
return fail("unsupported-decorator-args");
|
|
18642
|
+
const decoratorMeta = readDecoratorMeta(decoratorArgs);
|
|
18643
|
+
if (!decoratorMeta.standalone)
|
|
18644
|
+
return fail("not-standalone");
|
|
18645
|
+
const componentDir = dirname19(componentFilePath);
|
|
18646
|
+
let templateText;
|
|
18647
|
+
let templatePath;
|
|
18648
|
+
if (decoratorMeta.template !== null) {
|
|
18649
|
+
templateText = decoratorMeta.template;
|
|
18650
|
+
templatePath = componentFilePath;
|
|
18651
|
+
} else if (decoratorMeta.templateUrl) {
|
|
18652
|
+
const tplAbs = resolve33(componentDir, decoratorMeta.templateUrl);
|
|
18653
|
+
if (!existsSync26(tplAbs)) {
|
|
18654
|
+
return fail("template-resource-not-found", tplAbs);
|
|
18655
|
+
}
|
|
18656
|
+
templateText = readFileSync20(tplAbs, "utf8");
|
|
18657
|
+
templatePath = tplAbs;
|
|
18658
|
+
} else {
|
|
18659
|
+
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
18660
|
+
}
|
|
18661
|
+
const { styles, missing: missingStyle } = collectStyles(decoratorMeta, componentDir);
|
|
18662
|
+
if (missingStyle) {
|
|
18663
|
+
return fail("style-resource-not-found", missingStyle);
|
|
18664
|
+
}
|
|
18665
|
+
let parsed;
|
|
18666
|
+
try {
|
|
18667
|
+
parsed = compiler.parseTemplate(templateText, templatePath, {
|
|
18668
|
+
preserveWhitespaces: decoratorMeta.preserveWhitespaces
|
|
18669
|
+
});
|
|
18670
|
+
} catch (err) {
|
|
18671
|
+
return fail("template-parse-error", String(err));
|
|
18672
|
+
}
|
|
18673
|
+
if (parsed.errors && parsed.errors.length > 0) {
|
|
18674
|
+
return fail("template-parse-error", parsed.errors.map((e) => e.toString()).join(`
|
|
18675
|
+
`));
|
|
18676
|
+
}
|
|
18677
|
+
const className_ = classNode.name;
|
|
18678
|
+
if (!className_)
|
|
18679
|
+
return fail("class-not-found", "anonymous class");
|
|
18680
|
+
const wrappedClass = new compiler.WrappedNodeExpr(className_);
|
|
18681
|
+
const { inputs, outputs } = extractInputsAndOutputs(classNode);
|
|
18682
|
+
const projectRelPath = relative13(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
18683
|
+
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
18684
|
+
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs);
|
|
18685
|
+
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
18686
|
+
if (cachedFingerprint && !fingerprintsEqual(cachedFingerprint, currentFingerprint)) {
|
|
18687
|
+
return fail("structural-change", `fingerprint changed for ${className}; escalate to Tier 1`);
|
|
18688
|
+
}
|
|
18689
|
+
const sourceFileObj = new compiler.ParseSourceFile(tsSource, componentFilePath);
|
|
18690
|
+
const zeroLoc = new compiler.ParseLocation(sourceFileObj, 0, 0, 0);
|
|
18691
|
+
const typeSourceSpan = new compiler.ParseSourceSpan(zeroLoc, zeroLoc);
|
|
18692
|
+
const importsArray = [];
|
|
18693
|
+
if (decoratorMeta.importsExpr) {
|
|
18694
|
+
for (const el of decoratorMeta.importsExpr.elements) {
|
|
18695
|
+
importsArray.push(new compiler.WrappedNodeExpr(el));
|
|
18696
|
+
}
|
|
18697
|
+
}
|
|
18698
|
+
const declarations = importsArray.map((expr) => ({
|
|
18699
|
+
kind: 0,
|
|
18700
|
+
type: expr,
|
|
18701
|
+
selector: "",
|
|
18702
|
+
inputs: [],
|
|
18703
|
+
outputs: [],
|
|
18704
|
+
exportAs: null,
|
|
18705
|
+
isComponent: false
|
|
18706
|
+
}));
|
|
18707
|
+
const meta = {
|
|
18708
|
+
name: className,
|
|
18709
|
+
type: { value: wrappedClass, type: wrappedClass },
|
|
18710
|
+
typeArgumentCount: 0,
|
|
18711
|
+
typeSourceSpan,
|
|
18712
|
+
deps: null,
|
|
18713
|
+
selector: decoratorMeta.selector,
|
|
18714
|
+
queries: [],
|
|
18715
|
+
viewQueries: [],
|
|
18716
|
+
host: {
|
|
18717
|
+
attributes: {},
|
|
18718
|
+
listeners: {},
|
|
18719
|
+
properties: {},
|
|
18720
|
+
specialAttributes: {}
|
|
18721
|
+
},
|
|
18722
|
+
lifecycle: { usesOnChanges: false },
|
|
18723
|
+
inputs,
|
|
18724
|
+
outputs,
|
|
18725
|
+
usesInheritance: false,
|
|
18726
|
+
controlCreate: null,
|
|
18727
|
+
exportAs: null,
|
|
18728
|
+
providers: null,
|
|
18729
|
+
isStandalone: true,
|
|
18730
|
+
isSignal: false,
|
|
18731
|
+
hostDirectives: null,
|
|
18732
|
+
template: {
|
|
18733
|
+
nodes: parsed.nodes,
|
|
18734
|
+
ngContentSelectors: parsed.ngContentSelectors ?? [],
|
|
18735
|
+
preserveWhitespaces: decoratorMeta.preserveWhitespaces
|
|
18736
|
+
},
|
|
18737
|
+
declarations,
|
|
18738
|
+
defer: { mode: 0, blocks: new Map },
|
|
18739
|
+
declarationListEmitMode: 0,
|
|
18740
|
+
styles,
|
|
18741
|
+
encapsulation: 0,
|
|
18742
|
+
animations: null,
|
|
18743
|
+
viewProviders: null,
|
|
18744
|
+
relativeContextFilePath: projectRelPath,
|
|
18745
|
+
i18nUseExternalIds: false,
|
|
18746
|
+
changeDetection: null,
|
|
18747
|
+
relativeTemplatePath: null,
|
|
18748
|
+
hasDirectiveDependencies: importsArray.length > 0
|
|
18749
|
+
};
|
|
18750
|
+
let compiled;
|
|
18751
|
+
try {
|
|
18752
|
+
const pool = new compiler.ConstantPool;
|
|
18753
|
+
const bindingParser = compiler.makeBindingParser();
|
|
18754
|
+
compiled = compiler.compileComponentFromMetadata(meta, pool, bindingParser);
|
|
18755
|
+
const namespaceDependencies = [
|
|
18756
|
+
{ moduleName: "@angular/core", assignedName: "\u0275hmr0" }
|
|
18757
|
+
];
|
|
18758
|
+
const callback = compiler.compileHmrUpdateCallback([
|
|
18759
|
+
{
|
|
18760
|
+
name: "\u0275cmp",
|
|
18761
|
+
initializer: compiled.expression,
|
|
18762
|
+
statements: compiled.statements ?? []
|
|
18763
|
+
}
|
|
18764
|
+
], pool.statements, {
|
|
18765
|
+
type: wrappedClass,
|
|
18766
|
+
className,
|
|
18767
|
+
filePath: projectRelPath,
|
|
18768
|
+
namespaceDependencies,
|
|
18769
|
+
localDependencies: []
|
|
18770
|
+
});
|
|
18771
|
+
const namespaceMap = new Map;
|
|
18772
|
+
for (const dep of namespaceDependencies) {
|
|
18773
|
+
namespaceMap.set(dep.moduleName, dep.assignedName);
|
|
18774
|
+
}
|
|
18775
|
+
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
18776
|
+
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
18777
|
+
const exportedDecl = ts7.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
18778
|
+
ts7.factory.createToken(ts7.SyntaxKind.ExportKeyword),
|
|
18779
|
+
ts7.factory.createToken(ts7.SyntaxKind.DefaultKeyword)
|
|
18780
|
+
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
18781
|
+
const printer = ts7.createPrinter({
|
|
18782
|
+
newLine: ts7.NewLineKind.LineFeed,
|
|
18783
|
+
removeComments: false
|
|
18784
|
+
});
|
|
18785
|
+
const tsSourceText = printer.printNode(ts7.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
18786
|
+
const moduleText = ts7.transpileModule(tsSourceText, {
|
|
18787
|
+
compilerOptions: {
|
|
18788
|
+
module: ts7.ModuleKind.ES2022,
|
|
18789
|
+
target: ts7.ScriptTarget.ES2022
|
|
18790
|
+
},
|
|
18791
|
+
fileName: componentFilePath,
|
|
18792
|
+
reportDiagnostics: false
|
|
18793
|
+
}).outputText;
|
|
18794
|
+
fingerprintCache.set(fingerprintId, currentFingerprint);
|
|
18795
|
+
return { ok: true, moduleText, componentSource: sourceFile };
|
|
18796
|
+
} catch (err) {
|
|
18797
|
+
return fail("unexpected-error", String(err));
|
|
18798
|
+
}
|
|
18799
|
+
};
|
|
18800
|
+
var init_fastHmrCompiler = __esm(() => {
|
|
18801
|
+
init_hmrImportGenerator();
|
|
18802
|
+
init_typescript_translator();
|
|
18803
|
+
fingerprintCache = new Map;
|
|
18804
|
+
});
|
|
18805
|
+
|
|
18806
|
+
// src/dev/angular/hmrCompiler.ts
|
|
18807
|
+
var exports_hmrCompiler = {};
|
|
18808
|
+
__export(exports_hmrCompiler, {
|
|
18809
|
+
getCachedHmrProgram: () => getCachedHmrProgram,
|
|
18810
|
+
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
18811
|
+
findClassNodeById: () => findClassNodeById,
|
|
18812
|
+
encodeHmrComponentId: () => encodeHmrComponentId,
|
|
18813
|
+
compileAngularForHmr: () => compileAngularForHmr
|
|
18814
|
+
});
|
|
18815
|
+
import { existsSync as existsSync27 } from "fs";
|
|
18816
|
+
import { basename as basename12, dirname as dirname20, join as join30, relative as relative14, resolve as resolve34 } from "path";
|
|
18817
|
+
import { performance as performance2 } from "perf_hooks";
|
|
18818
|
+
import ts8 from "typescript";
|
|
18819
|
+
var globalCache, getCachedHmrProgram = () => globalCache.__ABSOLUTE_ANGULAR_HMR_PROGRAM__ ?? null, setCachedHmrProgram = (program) => {
|
|
18820
|
+
globalCache.__ABSOLUTE_ANGULAR_HMR_PROGRAM__ = program;
|
|
18821
|
+
}, resolveTypescriptLibDirCached = null, resolveTypescriptLibDir = () => {
|
|
18822
|
+
if (resolveTypescriptLibDirCached)
|
|
18823
|
+
return resolveTypescriptLibDirCached;
|
|
18824
|
+
const tsPath = __require.resolve("typescript");
|
|
18825
|
+
const tsRootDir = dirname20(tsPath);
|
|
18826
|
+
resolveTypescriptLibDirCached = tsRootDir.endsWith("lib") ? tsRootDir : resolve34(tsRootDir, "lib");
|
|
18827
|
+
return resolveTypescriptLibDirCached;
|
|
18828
|
+
}, buildHmrCompilerOptions = (base) => ({
|
|
18829
|
+
...base,
|
|
18830
|
+
emitDecoratorMetadata: true,
|
|
18831
|
+
esModuleInterop: true,
|
|
18832
|
+
experimentalDecorators: true,
|
|
18833
|
+
module: ts8.ModuleKind.ESNext,
|
|
18834
|
+
moduleResolution: ts8.ModuleResolutionKind.Bundler,
|
|
18835
|
+
newLine: ts8.NewLineKind.LineFeed,
|
|
18836
|
+
noEmit: false,
|
|
18837
|
+
noLib: false,
|
|
18838
|
+
rootDir: process.cwd(),
|
|
18839
|
+
skipLibCheck: true,
|
|
18840
|
+
target: ts8.ScriptTarget.ES2022,
|
|
18841
|
+
_enableHmr: true,
|
|
18842
|
+
enableHmr: true
|
|
18843
|
+
}), ANGULAR_COMPILER_OPTIONS_CACHE, loadAngularCompilerOptions = async () => {
|
|
18844
|
+
if (ANGULAR_COMPILER_OPTIONS_CACHE.value) {
|
|
18845
|
+
return ANGULAR_COMPILER_OPTIONS_CACHE.value;
|
|
18846
|
+
}
|
|
18847
|
+
const { readConfiguration } = await import("@angular/compiler-cli");
|
|
18848
|
+
const config = readConfiguration("./tsconfig.json");
|
|
18849
|
+
ANGULAR_COMPILER_OPTIONS_CACHE.value = config.options;
|
|
18850
|
+
return config.options;
|
|
18851
|
+
}, cachedTsconfigMtime = 0, refreshAngularCompilerOptionsIfStale = async () => {
|
|
18852
|
+
const tsconfigPath = resolve34(process.cwd(), "tsconfig.json");
|
|
18853
|
+
if (!existsSync27(tsconfigPath))
|
|
18854
|
+
return;
|
|
18855
|
+
const stat3 = await import("fs/promises").then((m) => m.stat(tsconfigPath));
|
|
18856
|
+
if (stat3.mtimeMs > cachedTsconfigMtime) {
|
|
18857
|
+
ANGULAR_COMPILER_OPTIONS_CACHE.value = null;
|
|
18858
|
+
cachedTsconfigMtime = stat3.mtimeMs;
|
|
18859
|
+
}
|
|
18860
|
+
}, compileAngularForHmr = async (inputPaths, outDir, modifiedResourceFiles = null) => {
|
|
18861
|
+
await refreshAngularCompilerOptionsIfStale();
|
|
18862
|
+
await import("@angular/compiler");
|
|
18863
|
+
const { performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
18864
|
+
const baseOptions = await loadAngularCompilerOptions();
|
|
18865
|
+
const options = buildHmrCompilerOptions(baseOptions);
|
|
18866
|
+
options.outDir = outDir;
|
|
18867
|
+
options.target = ts8.ScriptTarget.ES2022;
|
|
18868
|
+
options.experimentalDecorators = true;
|
|
18869
|
+
options.emitDecoratorMetadata = true;
|
|
18870
|
+
options.newLine = ts8.NewLineKind.LineFeed;
|
|
18871
|
+
options.incremental = false;
|
|
18872
|
+
options.tsBuildInfoFile = undefined;
|
|
18873
|
+
const tsLibDir = resolveTypescriptLibDir();
|
|
18874
|
+
const host = ts8.createCompilerHost(options);
|
|
18875
|
+
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
18876
|
+
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
18877
|
+
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
18878
|
+
host.getDefaultLibFileName = (opts) => {
|
|
18879
|
+
const fileName = originalGetDefaultLibFileName ? originalGetDefaultLibFileName(opts) : "lib.d.ts";
|
|
18880
|
+
return basename12(fileName);
|
|
18881
|
+
};
|
|
18882
|
+
const originalGetSourceFile = host.getSourceFile;
|
|
18883
|
+
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
18884
|
+
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
18885
|
+
return originalGetSourceFile?.call(host, join30(tsLibDir, fileName), languageVersion, onError);
|
|
18886
|
+
}
|
|
18887
|
+
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
18888
|
+
};
|
|
18889
|
+
const emitted = {};
|
|
18890
|
+
const resolvedOutDir = resolve34(outDir);
|
|
18891
|
+
host.writeFile = (fileName, text) => {
|
|
18892
|
+
const normalized = fileName.replace(/\\/g, "/");
|
|
18893
|
+
const rel = normalized.startsWith(resolvedOutDir.replace(/\\/g, "/")) ? relative14(resolvedOutDir, normalized).replace(/\\/g, "/") : relative14(process.cwd(), normalized).replace(/\\/g, "/");
|
|
18894
|
+
emitted[rel] = text;
|
|
18895
|
+
};
|
|
18896
|
+
const oldProgram = getCachedHmrProgram();
|
|
18897
|
+
const performArgs = {
|
|
18898
|
+
emitFlags: EmitFlags.Default,
|
|
18899
|
+
forceEmit: true,
|
|
18900
|
+
host,
|
|
18901
|
+
options,
|
|
18902
|
+
rootNames: inputPaths
|
|
18903
|
+
};
|
|
18904
|
+
if (modifiedResourceFiles && modifiedResourceFiles.size > 0) {
|
|
18905
|
+
performArgs.modifiedResourceFiles = new Set(modifiedResourceFiles);
|
|
18906
|
+
}
|
|
18907
|
+
if (oldProgram) {
|
|
18908
|
+
performArgs.oldProgram = oldProgram;
|
|
18909
|
+
}
|
|
18910
|
+
const compileResult = performCompilation(performArgs);
|
|
18911
|
+
const program = compileResult.program;
|
|
18912
|
+
if (program)
|
|
18913
|
+
setCachedHmrProgram(program);
|
|
18914
|
+
return {
|
|
18915
|
+
program,
|
|
18916
|
+
emitted,
|
|
18917
|
+
diagnostics: compileResult.diagnostics ?? []
|
|
18918
|
+
};
|
|
18919
|
+
}, findClassNodeById = (program, encodedId) => {
|
|
18920
|
+
const decoded = decodeURIComponent(encodedId);
|
|
18921
|
+
const at2 = decoded.lastIndexOf("@");
|
|
18922
|
+
if (at2 === -1)
|
|
18923
|
+
return null;
|
|
18924
|
+
const filePath = decoded.slice(0, at2);
|
|
18925
|
+
const className = decoded.slice(at2 + 1);
|
|
18926
|
+
const tsProgram = program.compiler.getCurrentProgram();
|
|
18927
|
+
const absoluteCandidate = resolve34(process.cwd(), filePath).replace(/\\/g, "/");
|
|
18928
|
+
const matchesPath = (sourceFileName) => {
|
|
18929
|
+
const normalized = sourceFileName.replace(/\\/g, "/");
|
|
18930
|
+
if (normalized === absoluteCandidate)
|
|
18931
|
+
return true;
|
|
18932
|
+
if (normalized === filePath)
|
|
18933
|
+
return true;
|
|
18934
|
+
return normalized.endsWith("/" + filePath) || normalized.endsWith(filePath);
|
|
18935
|
+
};
|
|
18936
|
+
let sourceFile = tsProgram.getSourceFile(absoluteCandidate) ?? null;
|
|
18937
|
+
if (!sourceFile) {
|
|
18938
|
+
for (const candidate of tsProgram.getSourceFiles()) {
|
|
18939
|
+
if (matchesPath(candidate.fileName)) {
|
|
18940
|
+
sourceFile = candidate;
|
|
18941
|
+
break;
|
|
18942
|
+
}
|
|
18943
|
+
}
|
|
18944
|
+
}
|
|
18945
|
+
if (!sourceFile)
|
|
18946
|
+
return null;
|
|
18947
|
+
let found = null;
|
|
18948
|
+
const walk = (node) => {
|
|
18949
|
+
if (found)
|
|
18950
|
+
return;
|
|
18951
|
+
if (ts8.isClassDeclaration(node) && node.name?.text === className) {
|
|
18952
|
+
found = node;
|
|
18953
|
+
return;
|
|
18954
|
+
}
|
|
18955
|
+
ts8.forEachChild(node, walk);
|
|
18956
|
+
};
|
|
18957
|
+
walk(sourceFile);
|
|
18958
|
+
return found;
|
|
18959
|
+
}, getApplyMetadataModule = async (encodedId) => {
|
|
18960
|
+
const decoded = decodeURIComponent(encodedId);
|
|
18961
|
+
const at2 = decoded.lastIndexOf("@");
|
|
18962
|
+
if (at2 === -1)
|
|
18963
|
+
return null;
|
|
18964
|
+
const filePathRel = decoded.slice(0, at2);
|
|
18965
|
+
const className = decoded.slice(at2 + 1);
|
|
18966
|
+
const componentFilePath = resolve34(process.cwd(), filePathRel);
|
|
18967
|
+
const fastStart = performance2.now();
|
|
18968
|
+
const fast = await tryFastHmr({ componentFilePath, className });
|
|
18969
|
+
if (fast.ok) {
|
|
18970
|
+
logInfo(`[ng-hmr fast] ${className} ${(performance2.now() - fastStart).toFixed(1)}ms`);
|
|
18971
|
+
return fast.moduleText;
|
|
18972
|
+
}
|
|
18973
|
+
logWarn(`[ng-hmr slow] ${className} fast path bailed (${fast.reason}${fast.detail ? `: ${fast.detail}` : ""}), falling back to ngtsc`);
|
|
18974
|
+
const program = getCachedHmrProgram();
|
|
18975
|
+
if (!program)
|
|
18976
|
+
return null;
|
|
18977
|
+
const node = findClassNodeById(program, encodedId);
|
|
18978
|
+
if (!node)
|
|
18979
|
+
return null;
|
|
18980
|
+
return program.compiler.emitHmrUpdateModule(node);
|
|
18981
|
+
}, encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
18982
|
+
const projectRel = relative14(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
18983
|
+
return encodeURIComponent(`${projectRel}@${className}`);
|
|
18984
|
+
};
|
|
18985
|
+
var init_hmrCompiler = __esm(() => {
|
|
18986
|
+
init_logger();
|
|
18987
|
+
init_fastHmrCompiler();
|
|
18988
|
+
globalCache = globalThis;
|
|
18989
|
+
ANGULAR_COMPILER_OPTIONS_CACHE = {
|
|
18990
|
+
value: null
|
|
18991
|
+
};
|
|
18992
|
+
});
|
|
18993
|
+
|
|
18994
|
+
// src/utils/ssrErrorPage.ts
|
|
18995
|
+
var ssrErrorPage = (framework, error) => {
|
|
18996
|
+
const frameworkColors2 = {
|
|
18997
|
+
angular: "#dd0031",
|
|
18998
|
+
html: "#e34c26",
|
|
18999
|
+
htmx: "#1a365d",
|
|
19000
|
+
react: "#61dafb",
|
|
19001
|
+
svelte: "#ff3e00",
|
|
19002
|
+
vue: "#42b883"
|
|
19003
|
+
};
|
|
19004
|
+
const accent = frameworkColors2[framework] ?? "#94a3b8";
|
|
19005
|
+
const label = framework.charAt(0).toUpperCase() + framework.slice(1);
|
|
19006
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19007
|
+
return `<!DOCTYPE html>
|
|
19008
|
+
<html>
|
|
19009
|
+
<head>
|
|
19010
|
+
<meta charset="utf-8">
|
|
19011
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
19012
|
+
<title>SSR Error - AbsoluteJS</title>
|
|
19013
|
+
<style>
|
|
19014
|
+
*{margin:0;padding:0;box-sizing:border-box}
|
|
19015
|
+
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}
|
|
19016
|
+
.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}
|
|
19017
|
+
.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)}
|
|
19018
|
+
.brand{font-weight:700;font-size:20px;color:#fff;letter-spacing:-0.02em}
|
|
19019
|
+
.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)}
|
|
19020
|
+
.kind{color:#94a3b8;font-size:13px;font-weight:500}
|
|
19021
|
+
.content{padding:24px}
|
|
19022
|
+
.label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px}
|
|
19023
|
+
.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}
|
|
19024
|
+
.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}
|
|
19025
|
+
</style>
|
|
19026
|
+
</head>
|
|
19027
|
+
<body>
|
|
19028
|
+
<div class="card">
|
|
19029
|
+
<div class="header">
|
|
19030
|
+
<div style="display:flex;align-items:center;gap:12px">
|
|
19031
|
+
<span class="brand">AbsoluteJS</span>
|
|
19032
|
+
<span class="badge">${label}</span>
|
|
19033
|
+
</div>
|
|
19034
|
+
<span class="kind">Server Render Error</span>
|
|
19035
|
+
</div>
|
|
19036
|
+
<div class="content">
|
|
19037
|
+
<div class="label">What went wrong</div>
|
|
19038
|
+
<pre class="message">${message.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</pre>
|
|
19039
|
+
<div class="hint">A component threw during server-side rendering. Check the terminal for the full stack trace.</div>
|
|
19040
|
+
</div>
|
|
19041
|
+
</div>
|
|
19042
|
+
</body>
|
|
19043
|
+
</html>`;
|
|
19044
|
+
};
|
|
19045
|
+
|
|
19046
|
+
// src/ember/pageHandler.ts
|
|
19047
|
+
import { pathToFileURL } from "url";
|
|
19048
|
+
var resolveRequestPathname = (request) => {
|
|
19049
|
+
if (!request)
|
|
19050
|
+
return;
|
|
19051
|
+
try {
|
|
19052
|
+
const parsed = new URL(request.url);
|
|
19053
|
+
return `${parsed.pathname}${parsed.search}`;
|
|
19054
|
+
} catch {
|
|
19055
|
+
return;
|
|
19056
|
+
}
|
|
19057
|
+
}, installSimpleDomGlobals = () => {
|
|
17653
19058
|
const g2 = globalThis;
|
|
17654
19059
|
if (typeof g2.Element === "undefined") {
|
|
17655
19060
|
g2.Element = class Element {
|
|
@@ -17717,11 +19122,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
17717
19122
|
__export(exports_simpleHTMLHMR, {
|
|
17718
19123
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
17719
19124
|
});
|
|
17720
|
-
import { resolve as
|
|
19125
|
+
import { resolve as resolve35 } from "path";
|
|
17721
19126
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
17722
19127
|
let htmlContent;
|
|
17723
19128
|
try {
|
|
17724
|
-
const resolvedPath =
|
|
19129
|
+
const resolvedPath = resolve35(htmlFilePath);
|
|
17725
19130
|
const file5 = Bun.file(resolvedPath);
|
|
17726
19131
|
if (!await file5.exists()) {
|
|
17727
19132
|
return null;
|
|
@@ -17747,11 +19152,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
17747
19152
|
__export(exports_simpleHTMXHMR, {
|
|
17748
19153
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
17749
19154
|
});
|
|
17750
|
-
import { resolve as
|
|
19155
|
+
import { resolve as resolve36 } from "path";
|
|
17751
19156
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
17752
19157
|
let htmlContent;
|
|
17753
19158
|
try {
|
|
17754
|
-
const resolvedPath =
|
|
19159
|
+
const resolvedPath = resolve36(htmxFilePath);
|
|
17755
19160
|
const file5 = Bun.file(resolvedPath);
|
|
17756
19161
|
if (!await file5.exists()) {
|
|
17757
19162
|
return null;
|
|
@@ -17773,8 +19178,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
17773
19178
|
var init_simpleHTMXHMR = () => {};
|
|
17774
19179
|
|
|
17775
19180
|
// src/dev/rebuildTrigger.ts
|
|
17776
|
-
import { existsSync as
|
|
17777
|
-
import { basename as basename13, dirname as
|
|
19181
|
+
import { existsSync as existsSync28 } from "fs";
|
|
19182
|
+
import { basename as basename13, dirname as dirname21, relative as relative15, resolve as resolve37 } from "path";
|
|
17778
19183
|
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) => {
|
|
17779
19184
|
if (!config.tailwind)
|
|
17780
19185
|
return;
|
|
@@ -17862,11 +19267,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17862
19267
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
17863
19268
|
}
|
|
17864
19269
|
return { ...parsed, framework: detectedFw };
|
|
17865
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
19270
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync28(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
17866
19271
|
state.fileHashes.delete(filePathInSet);
|
|
17867
19272
|
try {
|
|
17868
19273
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
17869
|
-
const deletedPathResolved =
|
|
19274
|
+
const deletedPathResolved = resolve37(filePathInSet);
|
|
17870
19275
|
affectedFiles.forEach((affectedFile) => {
|
|
17871
19276
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
17872
19277
|
validFiles.push(affectedFile);
|
|
@@ -17880,7 +19285,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17880
19285
|
if (!dependents || dependents.size === 0) {
|
|
17881
19286
|
return;
|
|
17882
19287
|
}
|
|
17883
|
-
const dependentFiles = Array.from(dependents).filter((file5) =>
|
|
19288
|
+
const dependentFiles = Array.from(dependents).filter((file5) => existsSync28(file5));
|
|
17884
19289
|
if (dependentFiles.length === 0) {
|
|
17885
19290
|
return;
|
|
17886
19291
|
}
|
|
@@ -17896,7 +19301,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17896
19301
|
try {
|
|
17897
19302
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
17898
19303
|
affectedFiles.forEach((affectedFile) => {
|
|
17899
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
19304
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync28(affectedFile)) {
|
|
17900
19305
|
validFiles.push(affectedFile);
|
|
17901
19306
|
processedFiles.add(affectedFile);
|
|
17902
19307
|
}
|
|
@@ -17910,7 +19315,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17910
19315
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
17911
19316
|
return;
|
|
17912
19317
|
}
|
|
17913
|
-
const normalizedFilePath =
|
|
19318
|
+
const normalizedFilePath = resolve37(filePathInSet);
|
|
17914
19319
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
17915
19320
|
validFiles.push(normalizedFilePath);
|
|
17916
19321
|
processedFiles.add(normalizedFilePath);
|
|
@@ -17921,7 +19326,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
17921
19326
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
17922
19327
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
17923
19328
|
filePathSet.forEach((filePathInSet) => {
|
|
17924
|
-
if (!
|
|
19329
|
+
if (!existsSync28(filePathInSet)) {
|
|
17925
19330
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
17926
19331
|
return;
|
|
17927
19332
|
}
|
|
@@ -18014,8 +19419,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18014
19419
|
return;
|
|
18015
19420
|
}
|
|
18016
19421
|
if (framework === "unknown") {
|
|
18017
|
-
invalidate(
|
|
18018
|
-
const relPath =
|
|
19422
|
+
invalidate(resolve37(filePath));
|
|
19423
|
+
const relPath = relative15(process.cwd(), filePath);
|
|
18019
19424
|
logHmrUpdate(relPath);
|
|
18020
19425
|
return;
|
|
18021
19426
|
}
|
|
@@ -18041,7 +19446,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18041
19446
|
const userEditedFiles = new Set;
|
|
18042
19447
|
state.fileChangeQueue.forEach((filePaths) => {
|
|
18043
19448
|
for (const filePath2 of filePaths) {
|
|
18044
|
-
userEditedFiles.add(
|
|
19449
|
+
userEditedFiles.add(resolve37(filePath2));
|
|
18045
19450
|
}
|
|
18046
19451
|
});
|
|
18047
19452
|
state.lastUserEditedFiles = userEditedFiles;
|
|
@@ -18065,12 +19470,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18065
19470
|
return componentFile;
|
|
18066
19471
|
}
|
|
18067
19472
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
18068
|
-
if (
|
|
19473
|
+
if (existsSync28(tsCounterpart)) {
|
|
18069
19474
|
return tsCounterpart;
|
|
18070
19475
|
}
|
|
18071
19476
|
if (!graph)
|
|
18072
19477
|
return componentFile;
|
|
18073
|
-
const dependents = graph.dependents.get(
|
|
19478
|
+
const dependents = graph.dependents.get(resolve37(componentFile));
|
|
18074
19479
|
if (!dependents)
|
|
18075
19480
|
return componentFile;
|
|
18076
19481
|
for (const dep of dependents) {
|
|
@@ -18079,7 +19484,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18079
19484
|
}
|
|
18080
19485
|
return componentFile;
|
|
18081
19486
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
18082
|
-
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") &&
|
|
19487
|
+
const pageEntries = angularFiles.filter((file5) => file5.endsWith(".ts") && resolve37(file5).startsWith(angularPagesPath));
|
|
18083
19488
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
18084
19489
|
return pageEntries;
|
|
18085
19490
|
}
|
|
@@ -18088,7 +19493,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18088
19493
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
18089
19494
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
18090
19495
|
affected.forEach((file5) => {
|
|
18091
|
-
if (file5.endsWith(".ts") &&
|
|
19496
|
+
if (file5.endsWith(".ts") && resolve37(file5).startsWith(angularPagesPath)) {
|
|
18092
19497
|
resolvedPages.add(file5);
|
|
18093
19498
|
}
|
|
18094
19499
|
});
|
|
@@ -18113,12 +19518,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18113
19518
|
return;
|
|
18114
19519
|
}
|
|
18115
19520
|
state.manifest[toPascal(baseName)] = artifact.path;
|
|
18116
|
-
}, bundleAngularClient = async (state, clientPaths, buildDir) => {
|
|
19521
|
+
}, bundleAngularClient = async (state, clientPaths, buildDir, userAngularRoot) => {
|
|
18117
19522
|
const { build: bunBuild9 } = await Promise.resolve(globalThis.Bun);
|
|
18118
19523
|
const { generateManifest: generateManifest2 } = await Promise.resolve().then(() => (init_generateManifest(), exports_generateManifest));
|
|
18119
19524
|
const { getAngularVendorPaths: getAngularVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
19525
|
+
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
19526
|
+
const { createAngularHmrInjectionPlugin: createAngularHmrInjectionPlugin2 } = await Promise.resolve().then(() => (init_hmrInjectionPlugin(), exports_hmrInjectionPlugin));
|
|
18120
19527
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
18121
19528
|
const depVendorPaths = globalThis.__depVendorPaths ?? {};
|
|
19529
|
+
const generatedAngularRoot = getFrameworkGeneratedDir2("angular");
|
|
18122
19530
|
let angVendorPaths = getAngularVendorPaths2();
|
|
18123
19531
|
if (!angVendorPaths) {
|
|
18124
19532
|
const { computeAngularVendorPaths: computeAngularVendorPaths2 } = await Promise.resolve().then(() => (init_buildAngularVendor(), exports_buildAngularVendor));
|
|
@@ -18141,7 +19549,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18141
19549
|
naming: "[dir]/[name].[hash].[ext]",
|
|
18142
19550
|
outdir: buildDir,
|
|
18143
19551
|
plugins: [
|
|
18144
|
-
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
19552
|
+
createStylePreprocessorPlugin(getStyleTransformConfig(state.config)),
|
|
19553
|
+
createAngularHmrInjectionPlugin2({
|
|
19554
|
+
generatedAngularRoot,
|
|
19555
|
+
userAngularRoot,
|
|
19556
|
+
projectRoot: process.cwd()
|
|
19557
|
+
})
|
|
18145
19558
|
],
|
|
18146
19559
|
root: clientRoot,
|
|
18147
19560
|
target: "browser",
|
|
@@ -18160,37 +19573,72 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18160
19573
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
18161
19574
|
Object.assign(state.manifest, clientManifest);
|
|
18162
19575
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
18163
|
-
},
|
|
18164
|
-
|
|
18165
|
-
|
|
18166
|
-
|
|
18167
|
-
|
|
18168
|
-
|
|
18169
|
-
|
|
18170
|
-
|
|
18171
|
-
|
|
18172
|
-
|
|
18173
|
-
const
|
|
18174
|
-
|
|
18175
|
-
|
|
18176
|
-
|
|
19576
|
+
}, decideAngularTier = async (state, angularDir) => {
|
|
19577
|
+
const userEdited = state.lastUserEditedFiles ?? new Set;
|
|
19578
|
+
if (userEdited.size === 0)
|
|
19579
|
+
return { queue: [], tier: 0 };
|
|
19580
|
+
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
19581
|
+
const { encodeHmrComponentId: encodeHmrComponentId2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
|
|
19582
|
+
const { tryFastHmr: tryFastHmr2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
19583
|
+
const queue = [];
|
|
19584
|
+
const queueIds = new Set;
|
|
19585
|
+
for (const editedFile of userEdited) {
|
|
19586
|
+
const owners = resolveOwningComponents2({
|
|
19587
|
+
changedFilePath: editedFile,
|
|
19588
|
+
userAngularRoot: angularDir
|
|
19589
|
+
});
|
|
19590
|
+
if (owners.length === 0 && editedFile.endsWith(".component.ts")) {
|
|
19591
|
+
return {
|
|
19592
|
+
reason: `no @Component class found in ${editedFile}`,
|
|
19593
|
+
tier: 1
|
|
19594
|
+
};
|
|
19595
|
+
}
|
|
19596
|
+
for (const { componentFilePath, className } of owners) {
|
|
19597
|
+
const id = encodeHmrComponentId2(componentFilePath, className);
|
|
19598
|
+
if (queueIds.has(id))
|
|
19599
|
+
continue;
|
|
19600
|
+
const result = await tryFastHmr2({ className, componentFilePath });
|
|
19601
|
+
if (!result.ok) {
|
|
19602
|
+
return {
|
|
19603
|
+
reason: `${className}: ${result.reason}${result.detail ? ` (${result.detail})` : ""}`,
|
|
19604
|
+
tier: 1
|
|
19605
|
+
};
|
|
19606
|
+
}
|
|
19607
|
+
queueIds.add(id);
|
|
19608
|
+
queue.push({ className, id });
|
|
19609
|
+
}
|
|
19610
|
+
}
|
|
19611
|
+
return { queue, tier: 0 };
|
|
19612
|
+
}, broadcastSurgical = (state, queue) => {
|
|
19613
|
+
const timestamp = Date.now();
|
|
19614
|
+
for (const { id, className } of queue) {
|
|
18177
19615
|
broadcastToClients(state, {
|
|
18178
|
-
data: {
|
|
18179
|
-
|
|
18180
|
-
cssUrl,
|
|
18181
|
-
editSourceFile: classification.sourceFile,
|
|
18182
|
-
framework: "angular",
|
|
18183
|
-
manifest,
|
|
18184
|
-
reason: classification.reason,
|
|
18185
|
-
sourceFile: angularPagePath,
|
|
18186
|
-
updateType: classification.type
|
|
18187
|
-
},
|
|
18188
|
-
type: "angular-update"
|
|
19616
|
+
data: { id, timestamp },
|
|
19617
|
+
type: "angular:component-update"
|
|
18189
19618
|
});
|
|
19619
|
+
logInfo(`[ng-hmr broadcast] ${className}`);
|
|
19620
|
+
}
|
|
19621
|
+
}, broadcastRebootstrap = async (state, reason) => {
|
|
19622
|
+
logInfo(`[ng-hmr tier-1 rebootstrap] ${reason}`);
|
|
19623
|
+
broadcastToClients(state, {
|
|
19624
|
+
data: {
|
|
19625
|
+
manifest: state.manifest,
|
|
19626
|
+
reason,
|
|
19627
|
+
timestamp: Date.now()
|
|
19628
|
+
},
|
|
19629
|
+
type: "angular:rebootstrap"
|
|
18190
19630
|
});
|
|
19631
|
+
const { invalidateFingerprintCache: invalidateFingerprintCache2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
19632
|
+
invalidateFingerprintCache2();
|
|
18191
19633
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
18192
19634
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
18193
19635
|
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, getStyleTransformConfig(state.config));
|
|
19636
|
+
try {
|
|
19637
|
+
const { compileAngularForHmr: compileAngularForHmr2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
|
|
19638
|
+
await compileAngularForHmr2(pageEntries, state.resolvedPaths.buildDir, state.lastUserEditedFiles ?? null);
|
|
19639
|
+
} catch (err) {
|
|
19640
|
+
logWarn(`[hmr] surgical-HMR shadow compile skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
19641
|
+
}
|
|
18194
19642
|
const { getAngularServerVendorPaths: getAngularServerVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
18195
19643
|
const angServerVendorPaths = getAngularServerVendorPaths2();
|
|
18196
19644
|
const ssrPaths = angServerVendorPaths ? serverPaths.map((serverPath) => serverPath.replace(/\.js$/, ".ssr.js")) : serverPaths;
|
|
@@ -18208,36 +19656,42 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18208
19656
|
serverPaths.forEach((serverPath, idx) => {
|
|
18209
19657
|
const fileBase = basename13(serverPath, ".js");
|
|
18210
19658
|
const ssrPath = ssrPaths[idx] ?? serverPath;
|
|
18211
|
-
state.manifest[toPascal(fileBase)] =
|
|
19659
|
+
state.manifest[toPascal(fileBase)] = resolve37(ssrPath);
|
|
18212
19660
|
});
|
|
18213
19661
|
if (clientPaths.length > 0) {
|
|
18214
|
-
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
19662
|
+
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir, angularDir);
|
|
18215
19663
|
}
|
|
18216
19664
|
}, handleAngularFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
18217
19665
|
const angularDir = config.angularDirectory ?? "";
|
|
18218
19666
|
const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
|
|
18219
19667
|
for (const file5 of angularFiles) {
|
|
18220
|
-
state.fileHashes.set(
|
|
19668
|
+
state.fileHashes.set(resolve37(file5), computeFileHash(file5));
|
|
18221
19669
|
}
|
|
18222
|
-
const angularPagesPath =
|
|
19670
|
+
const angularPagesPath = resolve37(angularDir, "pages");
|
|
18223
19671
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
18224
|
-
|
|
19672
|
+
const verdict = await decideAngularTier(state, angularDir);
|
|
19673
|
+
const runBundle = async () => {
|
|
19674
|
+
if (pageEntries.length === 0)
|
|
19675
|
+
return;
|
|
18225
19676
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
18226
19677
|
markSsrCacheDirty("angular");
|
|
19678
|
+
};
|
|
19679
|
+
if (verdict.tier === 0) {
|
|
19680
|
+
broadcastSurgical(state, verdict.queue);
|
|
19681
|
+
runBundle().catch((err) => {
|
|
19682
|
+
logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
19683
|
+
});
|
|
19684
|
+
} else {
|
|
19685
|
+
await runBundle();
|
|
19686
|
+
await broadcastRebootstrap(state, verdict.reason);
|
|
18227
19687
|
}
|
|
18228
19688
|
const { manifest } = state;
|
|
18229
|
-
const angularHmrFiles = angularFiles.filter((file5) => file5.endsWith(".ts") || file5.endsWith(".html"));
|
|
18230
|
-
const angularPageFiles = angularHmrFiles.filter((file5) => file5.replace(/\\/g, "/").includes("/pages/"));
|
|
18231
|
-
const pagesToUpdate = angularPageFiles.length > 0 ? angularPageFiles : pageEntries;
|
|
18232
|
-
const filesToClassify = filterToUserEdits(angularFiles, state.lastUserEditedFiles);
|
|
18233
|
-
const classification = collapseClassifications(filesToClassify.map(classifyAngularEdit));
|
|
18234
|
-
broadcastAngularPageUpdates(state, pagesToUpdate, manifest, startTime, classification);
|
|
18235
19689
|
onRebuildComplete({ hmrState: state, manifest });
|
|
18236
19690
|
return manifest;
|
|
18237
19691
|
}, getModuleUrl = async (pageFile) => {
|
|
18238
19692
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
18239
19693
|
invalidateModule2(pageFile);
|
|
18240
|
-
const rel =
|
|
19694
|
+
const rel = relative15(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
18241
19695
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
18242
19696
|
warmCache2(url);
|
|
18243
19697
|
return url;
|
|
@@ -18246,11 +19700,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18246
19700
|
if (isComponentFile2)
|
|
18247
19701
|
return primaryFile;
|
|
18248
19702
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
18249
|
-
const nearest = findNearestComponent2(
|
|
19703
|
+
const nearest = findNearestComponent2(resolve37(primaryFile));
|
|
18250
19704
|
return nearest ?? primaryFile;
|
|
18251
19705
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
18252
19706
|
for (const file5 of reactFiles) {
|
|
18253
|
-
state.fileHashes.set(
|
|
19707
|
+
state.fileHashes.set(resolve37(file5), computeFileHash(file5));
|
|
18254
19708
|
}
|
|
18255
19709
|
markSsrCacheDirty("react");
|
|
18256
19710
|
const primaryFile = reactFiles.find((file5) => !file5.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -18269,7 +19723,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18269
19723
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
18270
19724
|
if (pageModuleUrl) {
|
|
18271
19725
|
const serverDuration = Date.now() - startTime;
|
|
18272
|
-
state.lastHmrPath =
|
|
19726
|
+
state.lastHmrPath = relative15(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
18273
19727
|
state.lastHmrFramework = "react";
|
|
18274
19728
|
broadcastToClients(state, {
|
|
18275
19729
|
data: {
|
|
@@ -18332,7 +19786,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18332
19786
|
});
|
|
18333
19787
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
18334
19788
|
for (const file5 of svelteFiles) {
|
|
18335
|
-
state.fileHashes.set(
|
|
19789
|
+
state.fileHashes.set(resolve37(file5), computeFileHash(file5));
|
|
18336
19790
|
}
|
|
18337
19791
|
markSsrCacheDirty("svelte");
|
|
18338
19792
|
const serverDuration = Date.now() - startTime;
|
|
@@ -18357,8 +19811,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18357
19811
|
const serverEntries = [...svelteServerPaths];
|
|
18358
19812
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
18359
19813
|
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
18360
|
-
const serverRoot =
|
|
18361
|
-
const serverOutDir =
|
|
19814
|
+
const serverRoot = resolve37(getFrameworkGeneratedDir2("svelte"), "server");
|
|
19815
|
+
const serverOutDir = resolve37(buildDir, basename13(svelteDir));
|
|
18362
19816
|
const [serverResult, clientResult] = await Promise.all([
|
|
18363
19817
|
serverEntries.length > 0 ? bunBuild9({
|
|
18364
19818
|
entrypoints: serverEntries,
|
|
@@ -18455,7 +19909,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18455
19909
|
});
|
|
18456
19910
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
18457
19911
|
for (const file5 of [...vueFiles, ...nonVueFiles]) {
|
|
18458
|
-
state.fileHashes.set(
|
|
19912
|
+
state.fileHashes.set(resolve37(file5), computeFileHash(file5));
|
|
18459
19913
|
}
|
|
18460
19914
|
markSsrCacheDirty("vue");
|
|
18461
19915
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -18483,7 +19937,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18483
19937
|
recursive: true,
|
|
18484
19938
|
withFileTypes: true
|
|
18485
19939
|
});
|
|
18486
|
-
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) =>
|
|
19940
|
+
return entries.filter((entry) => entry.isFile() && EMBER_PAGE_EXTENSIONS.some((ext) => entry.name.endsWith(ext))).map((entry) => resolve37(emberPagesPath, entry.name));
|
|
18487
19941
|
} catch {
|
|
18488
19942
|
return [];
|
|
18489
19943
|
}
|
|
@@ -18495,10 +19949,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18495
19949
|
return state.manifest;
|
|
18496
19950
|
}
|
|
18497
19951
|
for (const file5 of emberFiles) {
|
|
18498
|
-
state.fileHashes.set(
|
|
19952
|
+
state.fileHashes.set(resolve37(file5), computeFileHash(file5));
|
|
18499
19953
|
}
|
|
18500
|
-
const emberPagesPath =
|
|
18501
|
-
const directPageEntries = emberFiles.filter((file5) =>
|
|
19954
|
+
const emberPagesPath = resolve37(emberDir, "pages");
|
|
19955
|
+
const directPageEntries = emberFiles.filter((file5) => resolve37(file5).startsWith(emberPagesPath));
|
|
18502
19956
|
const allPageEntries = directPageEntries.length > 0 ? directPageEntries : await collectAllEmberPages(emberPagesPath);
|
|
18503
19957
|
if (allPageEntries.length === 0) {
|
|
18504
19958
|
onRebuildComplete({ hmrState: state, manifest: state.manifest });
|
|
@@ -18508,14 +19962,14 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18508
19962
|
const { serverPaths } = await compileEmber2(allPageEntries, emberDir, process.cwd(), true);
|
|
18509
19963
|
for (const serverPath of serverPaths) {
|
|
18510
19964
|
const fileBase = basename13(serverPath, ".js");
|
|
18511
|
-
state.manifest[toPascal(fileBase)] =
|
|
19965
|
+
state.manifest[toPascal(fileBase)] = resolve37(serverPath);
|
|
18512
19966
|
}
|
|
18513
19967
|
const { invalidateEmberSsrCache: invalidateEmberSsrCache2 } = await Promise.resolve().then(() => (init_ember(), exports_ember));
|
|
18514
19968
|
invalidateEmberSsrCache2();
|
|
18515
19969
|
const duration = Date.now() - startTime;
|
|
18516
19970
|
const [primary] = emberFiles;
|
|
18517
19971
|
if (primary) {
|
|
18518
|
-
state.lastHmrPath =
|
|
19972
|
+
state.lastHmrPath = relative15(process.cwd(), primary).replace(/\\/g, "/");
|
|
18519
19973
|
state.lastHmrFramework = "ember";
|
|
18520
19974
|
logHmrUpdate(primary, "ember", duration);
|
|
18521
19975
|
}
|
|
@@ -18600,8 +20054,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18600
20054
|
if (!buildReference?.source) {
|
|
18601
20055
|
return;
|
|
18602
20056
|
}
|
|
18603
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
18604
|
-
islandFiles.add(
|
|
20057
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve37(dirname21(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
20058
|
+
islandFiles.add(resolve37(sourcePath));
|
|
18605
20059
|
}, resolveIslandSourceFiles = async (config) => {
|
|
18606
20060
|
const registryPath = config.islands?.registry;
|
|
18607
20061
|
if (!registryPath) {
|
|
@@ -18609,7 +20063,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18609
20063
|
}
|
|
18610
20064
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
18611
20065
|
const islandFiles = new Set([
|
|
18612
|
-
|
|
20066
|
+
resolve37(buildInfo.resolvedRegistryPath)
|
|
18613
20067
|
]);
|
|
18614
20068
|
for (const definition of buildInfo.definitions) {
|
|
18615
20069
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -18620,7 +20074,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18620
20074
|
if (islandFiles.size === 0) {
|
|
18621
20075
|
return false;
|
|
18622
20076
|
}
|
|
18623
|
-
return filesToRebuild.some((file5) => islandFiles.has(
|
|
20077
|
+
return filesToRebuild.some((file5) => islandFiles.has(resolve37(file5)));
|
|
18624
20078
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
18625
20079
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
18626
20080
|
if (!shouldReload) {
|
|
@@ -18655,10 +20109,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18655
20109
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
18656
20110
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
18657
20111
|
if (isSingle) {
|
|
18658
|
-
return
|
|
20112
|
+
return resolve37(state.resolvedPaths.buildDir, "pages");
|
|
18659
20113
|
}
|
|
18660
20114
|
const dirName = framework === "html" ? basename13(config.htmlDirectory ?? "html") : basename13(config.htmxDirectory ?? "htmx");
|
|
18661
|
-
return
|
|
20115
|
+
return resolve37(state.resolvedPaths.buildDir, dirName, "pages");
|
|
18662
20116
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
18663
20117
|
try {
|
|
18664
20118
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -18697,7 +20151,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18697
20151
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
18698
20152
|
await runSequentially(pageFilesToUpdate, async (pageFile) => {
|
|
18699
20153
|
const htmlPageName = basename13(pageFile);
|
|
18700
|
-
const builtHtmlPagePath =
|
|
20154
|
+
const builtHtmlPagePath = resolve37(outputHtmlPages, htmlPageName);
|
|
18701
20155
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
18702
20156
|
});
|
|
18703
20157
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -18758,11 +20212,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18758
20212
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
18759
20213
|
const pascalName = toPascal(baseName);
|
|
18760
20214
|
const vueRoot = config.vueDirectory;
|
|
18761
|
-
const hmrId = vueRoot ?
|
|
20215
|
+
const hmrId = vueRoot ? relative15(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
18762
20216
|
const cssKey = `${pascalName}CSS`;
|
|
18763
20217
|
const cssUrl = manifest[cssKey] || null;
|
|
18764
20218
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
18765
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
20219
|
+
const hmrMeta = vueHmrMetadata2.get(resolve37(vuePagePath));
|
|
18766
20220
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
18767
20221
|
if (changeType === "style-only") {
|
|
18768
20222
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -18861,20 +20315,6 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18861
20315
|
pagesToUpdate.forEach((sveltePagePath) => {
|
|
18862
20316
|
broadcastSveltePageUpdate(state, sveltePagePath, manifest, duration);
|
|
18863
20317
|
});
|
|
18864
|
-
}, collectAngularAffectedPages = (affected, resolvedPages) => {
|
|
18865
|
-
affected.forEach((file5) => {
|
|
18866
|
-
if (file5.replace(/\\/g, "/").includes("/pages/") && file5.endsWith(".ts")) {
|
|
18867
|
-
resolvedPages.add(file5);
|
|
18868
|
-
}
|
|
18869
|
-
});
|
|
18870
|
-
}, resolveAngularPagesFromDependencyGraph = (state, angularFiles) => {
|
|
18871
|
-
const resolvedPages = new Set;
|
|
18872
|
-
angularFiles.forEach((componentFile) => {
|
|
18873
|
-
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
18874
|
-
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
18875
|
-
collectAngularAffectedPages(affected, resolvedPages);
|
|
18876
|
-
});
|
|
18877
|
-
return Array.from(resolvedPages);
|
|
18878
20318
|
}, handleAngularCssOnlyUpdate = (state, angularCssFiles, manifest, duration) => {
|
|
18879
20319
|
const [cssFile] = angularCssFiles;
|
|
18880
20320
|
if (!cssFile) {
|
|
@@ -18896,57 +20336,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
18896
20336
|
},
|
|
18897
20337
|
type: "angular-update"
|
|
18898
20338
|
});
|
|
18899
|
-
}, broadcastAngularPageHmrUpdate = (state, angularPagePath, manifest, duration, classification) => {
|
|
18900
|
-
try {
|
|
18901
|
-
const fileName = basename13(angularPagePath);
|
|
18902
|
-
const baseName = fileName.replace(/\.[tj]s$/, "");
|
|
18903
|
-
const pascalName = toPascal(baseName);
|
|
18904
|
-
const cssKey = `${pascalName}CSS`;
|
|
18905
|
-
const cssUrl = manifest[cssKey] || null;
|
|
18906
|
-
logHmrUpdate(angularPagePath, "angular", duration);
|
|
18907
|
-
broadcastToClients(state, {
|
|
18908
|
-
data: {
|
|
18909
|
-
cssBaseName: baseName,
|
|
18910
|
-
cssUrl,
|
|
18911
|
-
editSourceFile: classification.sourceFile,
|
|
18912
|
-
framework: "angular",
|
|
18913
|
-
manifest,
|
|
18914
|
-
reason: classification.reason,
|
|
18915
|
-
sourceFile: angularPagePath,
|
|
18916
|
-
updateType: classification.type
|
|
18917
|
-
},
|
|
18918
|
-
type: "angular-update"
|
|
18919
|
-
});
|
|
18920
|
-
} catch (err) {
|
|
18921
|
-
sendTelemetryEvent("hmr:error", {
|
|
18922
|
-
framework: "angular",
|
|
18923
|
-
message: err instanceof Error ? err.message : String(err)
|
|
18924
|
-
});
|
|
18925
|
-
}
|
|
18926
20339
|
}, handleAngularHMR = (state, config, filesToRebuild, manifest, duration) => {
|
|
18927
|
-
if (!config.angularDirectory)
|
|
20340
|
+
if (!config.angularDirectory)
|
|
18928
20341
|
return;
|
|
18929
|
-
}
|
|
18930
20342
|
const angularFiles = filesToRebuild.filter((file5) => detectFramework(file5, state.resolvedPaths) === "angular");
|
|
18931
|
-
if (angularFiles.length === 0)
|
|
20343
|
+
if (angularFiles.length === 0)
|
|
18932
20344
|
return;
|
|
18933
|
-
}
|
|
18934
20345
|
const angularCssFiles = angularFiles.filter(isStylePath);
|
|
18935
20346
|
const isCssOnlyChange = angularFiles.every(isStylePath) && angularCssFiles.length > 0;
|
|
18936
|
-
|
|
18937
|
-
let pagesToUpdate = angularPageFiles;
|
|
18938
|
-
if (pagesToUpdate.length === 0 && state.dependencyGraph) {
|
|
18939
|
-
pagesToUpdate = resolveAngularPagesFromDependencyGraph(state, angularFiles);
|
|
18940
|
-
}
|
|
18941
|
-
if (isCssOnlyChange && angularCssFiles.length > 0) {
|
|
20347
|
+
if (isCssOnlyChange) {
|
|
18942
20348
|
handleAngularCssOnlyUpdate(state, angularCssFiles, manifest, duration);
|
|
18943
|
-
return;
|
|
18944
20349
|
}
|
|
18945
|
-
const filesToClassifySlow = filterToUserEdits(angularFiles, state.lastUserEditedFiles);
|
|
18946
|
-
const classification = collapseClassifications(filesToClassifySlow.map(classifyAngularEdit));
|
|
18947
|
-
pagesToUpdate.forEach((angularPagePath) => {
|
|
18948
|
-
broadcastAngularPageHmrUpdate(state, angularPagePath, manifest, duration, classification);
|
|
18949
|
-
});
|
|
18950
20350
|
}, handleHTMXScriptHMR = (state, filesToRebuild, manifest, duration) => {
|
|
18951
20351
|
if (!state.resolvedPaths.htmxDir) {
|
|
18952
20352
|
return;
|
|
@@ -19001,7 +20401,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19001
20401
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
19002
20402
|
await runSequentially(pageFilesToUpdate, async (htmxPageFile) => {
|
|
19003
20403
|
const htmxPageName = basename13(htmxPageFile);
|
|
19004
|
-
const builtHtmxPagePath =
|
|
20404
|
+
const builtHtmxPagePath = resolve37(outputHtmxPages, htmxPageName);
|
|
19005
20405
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
19006
20406
|
});
|
|
19007
20407
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -19110,7 +20510,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
19110
20510
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
19111
20511
|
writeFs(destPath, html);
|
|
19112
20512
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
19113
|
-
const destPath =
|
|
20513
|
+
const destPath = resolve37(outputDir, basename13(sourceFile));
|
|
19114
20514
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
19115
20515
|
const source = await Bun.file(sourceFile).text();
|
|
19116
20516
|
await Bun.write(destPath, source);
|
|
@@ -19356,7 +20756,6 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
19356
20756
|
init_compileTailwind();
|
|
19357
20757
|
init_tailwindCompiler();
|
|
19358
20758
|
init_ssrCache();
|
|
19359
|
-
init_editTypeDetection();
|
|
19360
20759
|
moduleServerPromise = Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
19361
20760
|
getReactModuleUrl = getModuleUrl;
|
|
19362
20761
|
EMBER_PAGE_EXTENSIONS = [".gts", ".gjs", ".ts", ".js"];
|
|
@@ -19370,7 +20769,7 @@ __export(exports_buildDepVendor, {
|
|
|
19370
20769
|
buildDepVendor: () => buildDepVendor
|
|
19371
20770
|
});
|
|
19372
20771
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
19373
|
-
import { join as
|
|
20772
|
+
import { join as join31 } from "path";
|
|
19374
20773
|
import { rm as rm10 } from "fs/promises";
|
|
19375
20774
|
var {build: bunBuild9, Glob: Glob9 } = globalThis.Bun;
|
|
19376
20775
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -19424,7 +20823,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
19424
20823
|
framework: Array.from(framework).filter(isResolvable4)
|
|
19425
20824
|
};
|
|
19426
20825
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
19427
|
-
const { readFileSync:
|
|
20826
|
+
const { readFileSync: readFileSync21 } = await import("fs");
|
|
19428
20827
|
const transpiler5 = new Bun.Transpiler({ loader: "js" });
|
|
19429
20828
|
const newSpecs = new Set;
|
|
19430
20829
|
for (const spec of specs) {
|
|
@@ -19439,7 +20838,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
19439
20838
|
}
|
|
19440
20839
|
let content;
|
|
19441
20840
|
try {
|
|
19442
|
-
content =
|
|
20841
|
+
content = readFileSync21(resolved, "utf-8");
|
|
19443
20842
|
} catch {
|
|
19444
20843
|
continue;
|
|
19445
20844
|
}
|
|
@@ -19481,7 +20880,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
19481
20880
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
19482
20881
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
19483
20882
|
const safeName = toSafeFileName6(specifier);
|
|
19484
|
-
const entryPath =
|
|
20883
|
+
const entryPath = join31(tmpDir, `${safeName}.ts`);
|
|
19485
20884
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
19486
20885
|
return { entryPath, specifier };
|
|
19487
20886
|
}));
|
|
@@ -19542,9 +20941,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
19542
20941
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
19543
20942
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
19544
20943
|
return {};
|
|
19545
|
-
const vendorDir =
|
|
20944
|
+
const vendorDir = join31(buildDir, "vendor");
|
|
19546
20945
|
mkdirSync13(vendorDir, { recursive: true });
|
|
19547
|
-
const tmpDir =
|
|
20946
|
+
const tmpDir = join31(buildDir, "_dep_vendor_tmp");
|
|
19548
20947
|
mkdirSync13(tmpDir, { recursive: true });
|
|
19549
20948
|
const allSpecs = new Set(initialSpecs);
|
|
19550
20949
|
const alreadyScanned = new Set;
|
|
@@ -19626,8 +21025,8 @@ __export(exports_devBuild, {
|
|
|
19626
21025
|
devBuild: () => devBuild
|
|
19627
21026
|
});
|
|
19628
21027
|
import { readdir as readdir5 } from "fs/promises";
|
|
19629
|
-
import { statSync as
|
|
19630
|
-
import { resolve as
|
|
21028
|
+
import { statSync as statSync4 } from "fs";
|
|
21029
|
+
import { resolve as resolve38 } from "path";
|
|
19631
21030
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
19632
21031
|
const configuredDirs = [
|
|
19633
21032
|
config.reactDirectory,
|
|
@@ -19650,7 +21049,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19650
21049
|
return Object.keys(config).length > 0 ? config : null;
|
|
19651
21050
|
}, reloadConfig = async () => {
|
|
19652
21051
|
try {
|
|
19653
|
-
const configPath2 =
|
|
21052
|
+
const configPath2 = resolve38(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
19654
21053
|
const source = await Bun.file(configPath2).text();
|
|
19655
21054
|
return parseDirectoryConfig(source);
|
|
19656
21055
|
} catch {
|
|
@@ -19735,7 +21134,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19735
21134
|
state.fileChangeQueue.clear();
|
|
19736
21135
|
}
|
|
19737
21136
|
}, handleCachedReload = async () => {
|
|
19738
|
-
const serverMtime =
|
|
21137
|
+
const serverMtime = statSync4(resolve38(Bun.main)).mtimeMs;
|
|
19739
21138
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
19740
21139
|
globalThis.__hmrServerMtime = serverMtime;
|
|
19741
21140
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -19772,8 +21171,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19772
21171
|
return true;
|
|
19773
21172
|
}, resolveAbsoluteVersion2 = async () => {
|
|
19774
21173
|
const candidates = [
|
|
19775
|
-
|
|
19776
|
-
|
|
21174
|
+
resolve38(import.meta.dir, "..", "..", "package.json"),
|
|
21175
|
+
resolve38(import.meta.dir, "..", "package.json")
|
|
19777
21176
|
];
|
|
19778
21177
|
const [candidate, ...remaining] = candidates;
|
|
19779
21178
|
if (!candidate) {
|
|
@@ -19799,7 +21198,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19799
21198
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
19800
21199
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
19801
21200
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
19802
|
-
const bytes = await Bun.file(
|
|
21201
|
+
const bytes = await Bun.file(resolve38(vendorDir, entry)).bytes();
|
|
19803
21202
|
assetStore.set(webPath, bytes);
|
|
19804
21203
|
}));
|
|
19805
21204
|
}, devBuild = async (config) => {
|
|
@@ -19867,11 +21266,11 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19867
21266
|
cleanStaleAssets(state.assetStore, manifest, state.resolvedPaths.buildDir);
|
|
19868
21267
|
recordStep("populate asset store", stepStartedAt);
|
|
19869
21268
|
stepStartedAt = performance.now();
|
|
19870
|
-
const reactVendorDir =
|
|
19871
|
-
const angularVendorDir =
|
|
19872
|
-
const svelteVendorDir =
|
|
19873
|
-
const vueVendorDir =
|
|
19874
|
-
const depVendorDir =
|
|
21269
|
+
const reactVendorDir = resolve38(state.resolvedPaths.buildDir, "react", "vendor");
|
|
21270
|
+
const angularVendorDir = resolve38(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
21271
|
+
const svelteVendorDir = resolve38(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
21272
|
+
const vueVendorDir = resolve38(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
21273
|
+
const depVendorDir = resolve38(state.resolvedPaths.buildDir, "vendor");
|
|
19875
21274
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
19876
21275
|
const [, angularSpecs, , , , , depPaths] = await Promise.all([
|
|
19877
21276
|
config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir) : Promise.resolve(undefined),
|
|
@@ -19949,7 +21348,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
19949
21348
|
manifest
|
|
19950
21349
|
};
|
|
19951
21350
|
globalThis.__hmrDevResult = result;
|
|
19952
|
-
globalThis.__hmrServerMtime =
|
|
21351
|
+
globalThis.__hmrServerMtime = statSync4(resolve38(Bun.main)).mtimeMs;
|
|
19953
21352
|
return result;
|
|
19954
21353
|
};
|
|
19955
21354
|
var init_devBuild = __esm(() => {
|
|
@@ -20095,7 +21494,49 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
|
|
|
20095
21494
|
await bridgeReactInternals();
|
|
20096
21495
|
}
|
|
20097
21496
|
return resolveDevAssetResponse(request, hmrState2, moduleServerHandler);
|
|
20098
|
-
}).get("/@src/*", ({ request }) => resolveDevAssetResponse(request, hmrState2, moduleServerHandler)).get("/@stub/*", ({ request }) => resolveDevAssetResponse(request, hmrState2, moduleServerHandler)).get("/@hmr/*", ({ request }) => resolveDevAssetResponse(request, hmrState2, moduleServerHandler)).
|
|
21497
|
+
}).get("/@src/*", ({ request }) => resolveDevAssetResponse(request, hmrState2, moduleServerHandler)).get("/@stub/*", ({ request }) => resolveDevAssetResponse(request, hmrState2, moduleServerHandler)).get("/@hmr/*", ({ request }) => resolveDevAssetResponse(request, hmrState2, moduleServerHandler)).get("/@ng/*", async ({ request, query }) => {
|
|
21498
|
+
const url = new URL(request.url);
|
|
21499
|
+
const subPath = url.pathname.slice("/@ng/".length);
|
|
21500
|
+
if (subPath === "debug") {
|
|
21501
|
+
const { getCachedHmrProgram: getCachedHmrProgram2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
|
|
21502
|
+
const program = getCachedHmrProgram2();
|
|
21503
|
+
if (!program) {
|
|
21504
|
+
return new Response(JSON.stringify({ error: "No cached program" }), {
|
|
21505
|
+
headers: { "Content-Type": "application/json" },
|
|
21506
|
+
status: 404
|
|
21507
|
+
});
|
|
21508
|
+
}
|
|
21509
|
+
const tsProgram = program.compiler.getCurrentProgram();
|
|
21510
|
+
const sourceFiles = tsProgram.getSourceFiles().map((sf) => sf.fileName).filter((fn2) => !fn2.includes("node_modules") && !fn2.endsWith(".d.ts")).slice(0, 50);
|
|
21511
|
+
return new Response(JSON.stringify({
|
|
21512
|
+
hasProgram: true,
|
|
21513
|
+
sampleSourceFiles: sourceFiles,
|
|
21514
|
+
totalSourceFiles: tsProgram.getSourceFiles().length
|
|
21515
|
+
}, null, 2), {
|
|
21516
|
+
headers: {
|
|
21517
|
+
"Content-Type": "application/json"
|
|
21518
|
+
}
|
|
21519
|
+
});
|
|
21520
|
+
}
|
|
21521
|
+
if (subPath === "component") {
|
|
21522
|
+
const id = typeof query.c === "string" ? query.c : null;
|
|
21523
|
+
if (!id) {
|
|
21524
|
+
return new Response("Missing ?c=<id>", { status: 400 });
|
|
21525
|
+
}
|
|
21526
|
+
const { getApplyMetadataModule: getApplyMetadataModule2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
|
|
21527
|
+
const module = await getApplyMetadataModule2(id);
|
|
21528
|
+
if (module === null) {
|
|
21529
|
+
return new Response(`No HMR module for id=${id}. The component may not be in the current program, or the program isn't built yet (rebuild on first save).`, { status: 404 });
|
|
21530
|
+
}
|
|
21531
|
+
return new Response(module, {
|
|
21532
|
+
headers: {
|
|
21533
|
+
"Cache-Control": "no-store",
|
|
21534
|
+
"Content-Type": "text/javascript; charset=utf-8"
|
|
21535
|
+
}
|
|
21536
|
+
});
|
|
21537
|
+
}
|
|
21538
|
+
return new Response("Unknown @ng route", { status: 404 });
|
|
21539
|
+
}).ws("/hmr", {
|
|
20099
21540
|
close: (ws) => handleClientDisconnect(hmrState2, ws),
|
|
20100
21541
|
message: (ws, msg) => handleHMRMessage(hmrState2, ws, msg),
|
|
20101
21542
|
open: (ws) => handleClientConnect(hmrState2, ws, manifest)
|
|
@@ -20122,17 +21563,17 @@ __export(exports_devtoolsJson, {
|
|
|
20122
21563
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
20123
21564
|
devtoolsJson: () => devtoolsJson
|
|
20124
21565
|
});
|
|
20125
|
-
import { existsSync as
|
|
20126
|
-
import { dirname as
|
|
21566
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync14, readFileSync as readFileSync21, writeFileSync as writeFileSync9 } from "fs";
|
|
21567
|
+
import { dirname as dirname22, join as join32, resolve as resolve39 } from "path";
|
|
20127
21568
|
import { Elysia as Elysia3 } from "elysia";
|
|
20128
21569
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
20129
21570
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
20130
21571
|
return uuid;
|
|
20131
|
-
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) =>
|
|
20132
|
-
if (!
|
|
21572
|
+
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve39(uuidCachePath ?? join32(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
21573
|
+
if (!existsSync29(cachePath))
|
|
20133
21574
|
return null;
|
|
20134
21575
|
try {
|
|
20135
|
-
const value =
|
|
21576
|
+
const value = readFileSync21(cachePath, "utf-8").trim();
|
|
20136
21577
|
return isUuidV4(value) ? value : null;
|
|
20137
21578
|
} catch {
|
|
20138
21579
|
return null;
|
|
@@ -20150,11 +21591,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
20150
21591
|
if (cachedUuid)
|
|
20151
21592
|
return setGlobalUuid(cachedUuid);
|
|
20152
21593
|
const uuid = crypto.randomUUID();
|
|
20153
|
-
mkdirSync14(
|
|
21594
|
+
mkdirSync14(dirname22(cachePath), { recursive: true });
|
|
20154
21595
|
writeFileSync9(cachePath, uuid, "utf-8");
|
|
20155
21596
|
return setGlobalUuid(uuid);
|
|
20156
21597
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
20157
|
-
const rootPath =
|
|
21598
|
+
const rootPath = resolve39(options.projectRoot ?? process.cwd());
|
|
20158
21599
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
20159
21600
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
20160
21601
|
return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -20167,11 +21608,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
20167
21608
|
if (process.env.WSL_DISTRO_NAME) {
|
|
20168
21609
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
20169
21610
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
20170
|
-
return
|
|
21611
|
+
return join32("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
20171
21612
|
}
|
|
20172
21613
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
20173
21614
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
20174
|
-
return
|
|
21615
|
+
return join32("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
20175
21616
|
}
|
|
20176
21617
|
return root;
|
|
20177
21618
|
};
|
|
@@ -20182,13 +21623,13 @@ var exports_imageOptimizer = {};
|
|
|
20182
21623
|
__export(exports_imageOptimizer, {
|
|
20183
21624
|
imageOptimizer: () => imageOptimizer
|
|
20184
21625
|
});
|
|
20185
|
-
import { existsSync as
|
|
20186
|
-
import { resolve as
|
|
21626
|
+
import { existsSync as existsSync30 } from "fs";
|
|
21627
|
+
import { resolve as resolve40 } from "path";
|
|
20187
21628
|
import { Elysia as Elysia4 } from "elysia";
|
|
20188
21629
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
20189
21630
|
try {
|
|
20190
21631
|
const resolved = validateSafePath(path, baseDir);
|
|
20191
|
-
if (
|
|
21632
|
+
if (existsSync30(resolved))
|
|
20192
21633
|
return resolved;
|
|
20193
21634
|
return null;
|
|
20194
21635
|
} catch {
|
|
@@ -20196,7 +21637,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
20196
21637
|
}
|
|
20197
21638
|
}, resolveLocalImage = (url, buildDir) => {
|
|
20198
21639
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
20199
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
21640
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve40(process.cwd()));
|
|
20200
21641
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
20201
21642
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
20202
21643
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -20487,15 +21928,15 @@ __export(exports_prerender, {
|
|
|
20487
21928
|
prerender: () => prerender,
|
|
20488
21929
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
20489
21930
|
});
|
|
20490
|
-
import { mkdirSync as mkdirSync15, readFileSync as
|
|
20491
|
-
import { join as
|
|
21931
|
+
import { mkdirSync as mkdirSync15, readFileSync as readFileSync22 } from "fs";
|
|
21932
|
+
import { join as join33 } from "path";
|
|
20492
21933
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
20493
21934
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
20494
21935
|
await Bun.write(metaPath, String(Date.now()));
|
|
20495
21936
|
}, readTimestamp = (htmlPath) => {
|
|
20496
21937
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
20497
21938
|
try {
|
|
20498
|
-
const content =
|
|
21939
|
+
const content = readFileSync22(metaPath, "utf-8");
|
|
20499
21940
|
return Number(content) || 0;
|
|
20500
21941
|
} catch {
|
|
20501
21942
|
return 0;
|
|
@@ -20554,7 +21995,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
20554
21995
|
return false;
|
|
20555
21996
|
const html = await res.text();
|
|
20556
21997
|
const fileName = routeToFilename(route);
|
|
20557
|
-
const filePath =
|
|
21998
|
+
const filePath = join33(prerenderDir, fileName);
|
|
20558
21999
|
await Bun.write(filePath, html);
|
|
20559
22000
|
await writeTimestamp(filePath);
|
|
20560
22001
|
return true;
|
|
@@ -20580,13 +22021,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
20580
22021
|
}
|
|
20581
22022
|
const html = await res.text();
|
|
20582
22023
|
const fileName = routeToFilename(route);
|
|
20583
|
-
const filePath =
|
|
22024
|
+
const filePath = join33(prerenderDir, fileName);
|
|
20584
22025
|
await Bun.write(filePath, html);
|
|
20585
22026
|
await writeTimestamp(filePath);
|
|
20586
22027
|
result.routes.set(route, filePath);
|
|
20587
22028
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
20588
22029
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
20589
|
-
const prerenderDir =
|
|
22030
|
+
const prerenderDir = join33(outDir, "_prerendered");
|
|
20590
22031
|
mkdirSync15(prerenderDir, { recursive: true });
|
|
20591
22032
|
const baseUrl = `http://localhost:${port}`;
|
|
20592
22033
|
let routes;
|
|
@@ -21182,8 +22623,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
21182
22623
|
});
|
|
21183
22624
|
};
|
|
21184
22625
|
// src/core/prepare.ts
|
|
21185
|
-
import { existsSync as
|
|
21186
|
-
import { basename as basename14, join as
|
|
22626
|
+
import { existsSync as existsSync31, readdirSync as readdirSync3, readFileSync as readFileSync23 } from "fs";
|
|
22627
|
+
import { basename as basename14, join as join34, relative as relative16, resolve as resolve41 } from "path";
|
|
21187
22628
|
import { Elysia as Elysia5 } from "elysia";
|
|
21188
22629
|
|
|
21189
22630
|
// src/utils/loadConfig.ts
|
|
@@ -21606,7 +23047,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
21606
23047
|
for (const { dir, pattern } of prewarmDirs) {
|
|
21607
23048
|
const glob = new Glob10(pattern);
|
|
21608
23049
|
const matches = [
|
|
21609
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
23050
|
+
...glob.scanSync({ absolute: true, cwd: resolve41(dir) })
|
|
21610
23051
|
];
|
|
21611
23052
|
files.push(...matches);
|
|
21612
23053
|
}
|
|
@@ -21617,7 +23058,7 @@ var warmPrewarmDirs = async (prewarmDirs, warmCache2, SRC_URL_PREFIX2) => {
|
|
|
21617
23058
|
for (const file5 of files) {
|
|
21618
23059
|
if (file5.includes("/node_modules/"))
|
|
21619
23060
|
continue;
|
|
21620
|
-
const rel =
|
|
23061
|
+
const rel = relative16(process.cwd(), file5).replace(/\\/g, "/");
|
|
21621
23062
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
21622
23063
|
}
|
|
21623
23064
|
};
|
|
@@ -21642,10 +23083,10 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
21642
23083
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
21643
23084
|
if (!fileName)
|
|
21644
23085
|
continue;
|
|
21645
|
-
const srcPath =
|
|
21646
|
-
if (!
|
|
23086
|
+
const srcPath = resolve41(devIndexDir, fileName);
|
|
23087
|
+
if (!existsSync31(srcPath))
|
|
21647
23088
|
continue;
|
|
21648
|
-
const rel =
|
|
23089
|
+
const rel = relative16(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
21649
23090
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
21650
23091
|
}
|
|
21651
23092
|
};
|
|
@@ -21715,7 +23156,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
21715
23156
|
stepStartedAt = performance.now();
|
|
21716
23157
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
21717
23158
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
21718
|
-
const devIndexDir =
|
|
23159
|
+
const devIndexDir = resolve41(buildDir, "_src_indexes");
|
|
21719
23160
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
21720
23161
|
recordStep("configure dev plugins", stepStartedAt);
|
|
21721
23162
|
stepStartedAt = performance.now();
|
|
@@ -21751,11 +23192,11 @@ var prepareDev = async (config, buildDir) => {
|
|
|
21751
23192
|
};
|
|
21752
23193
|
var loadPrerenderMap = (prerenderDir) => {
|
|
21753
23194
|
const map = new Map;
|
|
21754
|
-
if (!
|
|
23195
|
+
if (!existsSync31(prerenderDir))
|
|
21755
23196
|
return map;
|
|
21756
23197
|
let entries;
|
|
21757
23198
|
try {
|
|
21758
|
-
entries =
|
|
23199
|
+
entries = readdirSync3(prerenderDir);
|
|
21759
23200
|
} catch {
|
|
21760
23201
|
return map;
|
|
21761
23202
|
}
|
|
@@ -21764,7 +23205,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
21764
23205
|
continue;
|
|
21765
23206
|
const name = basename14(entry, ".html");
|
|
21766
23207
|
const route = name === "index" ? "/" : `/${name}`;
|
|
21767
|
-
map.set(route,
|
|
23208
|
+
map.set(route, join34(prerenderDir, entry));
|
|
21768
23209
|
}
|
|
21769
23210
|
return map;
|
|
21770
23211
|
};
|
|
@@ -21796,7 +23237,7 @@ var prepare = async (configOrPath) => {
|
|
|
21796
23237
|
recordStep("load config", stepStartedAt);
|
|
21797
23238
|
const nodeEnv = process.env["NODE_ENV"];
|
|
21798
23239
|
const isDev3 = nodeEnv === "development";
|
|
21799
|
-
const buildDir =
|
|
23240
|
+
const buildDir = resolve41(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
21800
23241
|
if (isDev3) {
|
|
21801
23242
|
stepStartedAt = performance.now();
|
|
21802
23243
|
const result = await prepareDev(config, buildDir);
|
|
@@ -21805,7 +23246,7 @@ var prepare = async (configOrPath) => {
|
|
|
21805
23246
|
return result;
|
|
21806
23247
|
}
|
|
21807
23248
|
stepStartedAt = performance.now();
|
|
21808
|
-
const manifest = JSON.parse(
|
|
23249
|
+
const manifest = JSON.parse(readFileSync23(`${buildDir}/manifest.json`, "utf-8"));
|
|
21809
23250
|
setCurrentIslandManifest(manifest);
|
|
21810
23251
|
if (config.islands?.registry) {
|
|
21811
23252
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -21813,9 +23254,9 @@ var prepare = async (configOrPath) => {
|
|
|
21813
23254
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
21814
23255
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
21815
23256
|
stepStartedAt = performance.now();
|
|
21816
|
-
const conventionsPath =
|
|
21817
|
-
if (
|
|
21818
|
-
const conventions2 = JSON.parse(
|
|
23257
|
+
const conventionsPath = join34(buildDir, "conventions.json");
|
|
23258
|
+
if (existsSync31(conventionsPath)) {
|
|
23259
|
+
const conventions2 = JSON.parse(readFileSync23(conventionsPath, "utf-8"));
|
|
21819
23260
|
setConventions(conventions2);
|
|
21820
23261
|
}
|
|
21821
23262
|
recordStep("load production conventions", stepStartedAt);
|
|
@@ -21829,7 +23270,7 @@ var prepare = async (configOrPath) => {
|
|
|
21829
23270
|
});
|
|
21830
23271
|
recordStep("create static plugin", stepStartedAt);
|
|
21831
23272
|
stepStartedAt = performance.now();
|
|
21832
|
-
const prerenderDir =
|
|
23273
|
+
const prerenderDir = join34(buildDir, "_prerendered");
|
|
21833
23274
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
21834
23275
|
recordStep("load prerender map", stepStartedAt);
|
|
21835
23276
|
if (prerenderMap.size > 0) {
|
|
@@ -21887,18 +23328,18 @@ import { argv } from "process";
|
|
|
21887
23328
|
var {env: env4 } = globalThis.Bun;
|
|
21888
23329
|
|
|
21889
23330
|
// src/dev/devCert.ts
|
|
21890
|
-
import { existsSync as
|
|
21891
|
-
import { join as
|
|
21892
|
-
var CERT_DIR =
|
|
21893
|
-
var CERT_PATH =
|
|
21894
|
-
var KEY_PATH =
|
|
23331
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync16, readFileSync as readFileSync24, rmSync as rmSync3 } from "fs";
|
|
23332
|
+
import { join as join35 } from "path";
|
|
23333
|
+
var CERT_DIR = join35(process.cwd(), ".absolutejs");
|
|
23334
|
+
var CERT_PATH = join35(CERT_DIR, "cert.pem");
|
|
23335
|
+
var KEY_PATH = join35(CERT_DIR, "key.pem");
|
|
21895
23336
|
var CERT_VALIDITY_DAYS = 365;
|
|
21896
23337
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
21897
23338
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
21898
|
-
var certFilesExist = () =>
|
|
23339
|
+
var certFilesExist = () => existsSync32(CERT_PATH) && existsSync32(KEY_PATH);
|
|
21899
23340
|
var isCertExpired = () => {
|
|
21900
23341
|
try {
|
|
21901
|
-
const certPem =
|
|
23342
|
+
const certPem = readFileSync24(CERT_PATH, "utf-8");
|
|
21902
23343
|
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
21903
23344
|
stdin: new TextEncoder().encode(certPem)
|
|
21904
23345
|
});
|
|
@@ -21994,8 +23435,8 @@ var loadDevCert = () => {
|
|
|
21994
23435
|
return null;
|
|
21995
23436
|
try {
|
|
21996
23437
|
return {
|
|
21997
|
-
cert:
|
|
21998
|
-
key:
|
|
23438
|
+
cert: readFileSync24(paths.cert, "utf-8"),
|
|
23439
|
+
key: readFileSync24(paths.key, "utf-8")
|
|
21999
23440
|
};
|
|
22000
23441
|
} catch {
|
|
22001
23442
|
return null;
|
|
@@ -22223,8 +23664,8 @@ var jsonLd2 = (schema) => {
|
|
|
22223
23664
|
};
|
|
22224
23665
|
// src/utils/defineEnv.ts
|
|
22225
23666
|
var {env: bunEnv } = globalThis.Bun;
|
|
22226
|
-
import { existsSync as
|
|
22227
|
-
import { resolve as
|
|
23667
|
+
import { existsSync as existsSync33, readFileSync as readFileSync25 } from "fs";
|
|
23668
|
+
import { resolve as resolve42 } from "path";
|
|
22228
23669
|
|
|
22229
23670
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
22230
23671
|
var exports_value = {};
|
|
@@ -28259,19 +29700,19 @@ ${lines.join(`
|
|
|
28259
29700
|
};
|
|
28260
29701
|
var checkEnvFileSecurity = (properties) => {
|
|
28261
29702
|
const cwd2 = process.cwd();
|
|
28262
|
-
const envPath =
|
|
28263
|
-
if (!
|
|
29703
|
+
const envPath = resolve42(cwd2, ".env");
|
|
29704
|
+
if (!existsSync33(envPath))
|
|
28264
29705
|
return;
|
|
28265
29706
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
28266
29707
|
if (sensitiveKeys.length === 0)
|
|
28267
29708
|
return;
|
|
28268
|
-
const envContent =
|
|
29709
|
+
const envContent = readFileSync25(envPath, "utf-8");
|
|
28269
29710
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
28270
29711
|
if (presentKeys.length === 0)
|
|
28271
29712
|
return;
|
|
28272
|
-
const gitignorePath =
|
|
28273
|
-
if (
|
|
28274
|
-
const gitignore =
|
|
29713
|
+
const gitignorePath = resolve42(cwd2, ".gitignore");
|
|
29714
|
+
if (existsSync33(gitignorePath)) {
|
|
29715
|
+
const gitignore = readFileSync25(gitignorePath, "utf-8");
|
|
28275
29716
|
if (gitignore.split(`
|
|
28276
29717
|
`).some((line) => line.trim() === ".env"))
|
|
28277
29718
|
return;
|
|
@@ -28509,5 +29950,5 @@ export {
|
|
|
28509
29950
|
ANGULAR_INIT_TIMEOUT_MS
|
|
28510
29951
|
};
|
|
28511
29952
|
|
|
28512
|
-
//# debugId=
|
|
29953
|
+
//# debugId=1AAD42B006C96FC764756E2164756E21
|
|
28513
29954
|
//# sourceMappingURL=index.js.map
|