@absolutejs/absolute 0.19.0-beta.4 → 0.19.0-beta.40
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/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/.claude/settings.local.json +23 -1
- package/dist/build.js +622 -59
- package/dist/build.js.map +13 -10
- package/dist/cli/index.js +29 -1
- package/dist/dev/client/frameworkDetect.ts +1 -2
- package/dist/dev/client/handlers/react.ts +96 -4
- package/dist/index.js +886 -209
- package/dist/index.js.map +17 -13
- package/dist/react/index.js +86 -1
- package/dist/react/index.js.map +5 -4
- package/dist/src/build/buildDepVendor.d.ts +2 -0
- package/dist/src/dev/clientManager.d.ts +2 -0
- package/dist/src/dev/moduleServer.d.ts +11 -0
- package/dist/src/dev/ssrRenderer.d.ts +7 -0
- package/dist/src/dev/ssrWorker.d.ts +0 -0
- package/dist/src/dev/transformCache.d.ts +4 -0
- package/dist/src/plugins/hmr.d.ts +1 -1
- package/dist/ssrWorker.ts +55 -0
- package/dist/types/messages.d.ts +5 -1
- package/native/packages/darwin-arm64/fast_ops.dylib +0 -0
- package/native/packages/darwin-arm64/package.json +1 -1
- package/native/packages/darwin-x64/fast_ops.dylib +0 -0
- package/native/packages/darwin-x64/package.json +1 -1
- package/native/packages/linux-arm64/package.json +1 -1
- package/native/packages/linux-x64/fast_ops.so +0 -0
- package/native/packages/linux-x64/package.json +1 -1
- package/package.json +6 -6
- package/types/globals.d.ts +1 -0
- package/types/messages.ts +7 -1
- package/types/typeGuards.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -63,6 +63,8 @@ var isValidHMRClientMessage = (data) => {
|
|
|
63
63
|
return true;
|
|
64
64
|
case "hydration-error":
|
|
65
65
|
return true;
|
|
66
|
+
case "hmr-timing":
|
|
67
|
+
return true;
|
|
66
68
|
default:
|
|
67
69
|
return false;
|
|
68
70
|
}
|
|
@@ -131,6 +133,56 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
|
|
|
131
133
|
</html>`;
|
|
132
134
|
};
|
|
133
135
|
|
|
136
|
+
// src/dev/ssrRenderer.ts
|
|
137
|
+
var exports_ssrRenderer = {};
|
|
138
|
+
__export(exports_ssrRenderer, {
|
|
139
|
+
renderInWorker: () => renderInWorker
|
|
140
|
+
});
|
|
141
|
+
import { resolve } from "path";
|
|
142
|
+
var worker = null, requestId = 0, pending, getWorker = () => {
|
|
143
|
+
if (worker)
|
|
144
|
+
return worker;
|
|
145
|
+
const workerPath = resolve(import.meta.dir, "ssrWorker.ts");
|
|
146
|
+
worker = new Worker(workerPath, { cwd: process.cwd() });
|
|
147
|
+
worker.onmessage = (event) => {
|
|
148
|
+
const { id, ok, html, error } = event.data;
|
|
149
|
+
const req = pending.get(id);
|
|
150
|
+
if (!req)
|
|
151
|
+
return;
|
|
152
|
+
pending.delete(id);
|
|
153
|
+
if (ok) {
|
|
154
|
+
req.resolve(html);
|
|
155
|
+
} else {
|
|
156
|
+
req.reject(new Error(error ?? "SSR render failed"));
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
worker.onerror = (event) => {
|
|
160
|
+
console.error("[SSR Worker] Error:", event);
|
|
161
|
+
for (const [id, req] of pending) {
|
|
162
|
+
req.reject(new Error("SSR worker crashed"));
|
|
163
|
+
pending.delete(id);
|
|
164
|
+
}
|
|
165
|
+
worker = null;
|
|
166
|
+
};
|
|
167
|
+
return worker;
|
|
168
|
+
}, renderInWorker = (request) => new Promise((resolvePromise, rejectPromise) => {
|
|
169
|
+
const id = ++requestId;
|
|
170
|
+
pending.set(id, {
|
|
171
|
+
reject: rejectPromise,
|
|
172
|
+
resolve: resolvePromise
|
|
173
|
+
});
|
|
174
|
+
const w = getWorker();
|
|
175
|
+
w.postMessage({
|
|
176
|
+
componentPath: resolve(request.componentPath),
|
|
177
|
+
id,
|
|
178
|
+
indexPath: request.indexPath,
|
|
179
|
+
props: request.props
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
var init_ssrRenderer = __esm(() => {
|
|
183
|
+
pending = new Map;
|
|
184
|
+
});
|
|
185
|
+
|
|
134
186
|
// src/utils/normalizePath.ts
|
|
135
187
|
var normalizePath = (path) => path.replace(/\\/g, "/");
|
|
136
188
|
|
|
@@ -200,14 +252,14 @@ __export(exports_generateReactIndexes, {
|
|
|
200
252
|
});
|
|
201
253
|
import { existsSync, mkdirSync } from "fs";
|
|
202
254
|
import { readdir, rm, writeFile } from "fs/promises";
|
|
203
|
-
import { basename, join, resolve as
|
|
255
|
+
import { basename, join, resolve as resolve3 } from "path";
|
|
204
256
|
var {Glob } = globalThis.Bun;
|
|
205
257
|
var indexContentCache, resolveDevClientDir = () => {
|
|
206
|
-
const fromSource =
|
|
258
|
+
const fromSource = resolve3(import.meta.dir, "../dev/client");
|
|
207
259
|
if (existsSync(fromSource))
|
|
208
260
|
return fromSource;
|
|
209
|
-
return
|
|
210
|
-
}, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory,
|
|
261
|
+
return resolve3(import.meta.dir, "./dev/client");
|
|
262
|
+
}, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
|
|
211
263
|
if (!existsSync(reactIndexesDirectory)) {
|
|
212
264
|
mkdirSync(reactIndexesDirectory, { recursive: true });
|
|
213
265
|
}
|
|
@@ -234,7 +286,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
234
286
|
const promises = files.map(async (file2) => {
|
|
235
287
|
const fileName = basename(file2);
|
|
236
288
|
const [componentName] = fileName.split(".");
|
|
237
|
-
const hmrPreamble =
|
|
289
|
+
const hmrPreamble = isDev2 ? [
|
|
238
290
|
`window.__HMR_FRAMEWORK__ = "react";`,
|
|
239
291
|
`window.__REACT_COMPONENT_KEY__ = "${componentName}Index";`,
|
|
240
292
|
`import '${refreshSetupPath}';`,
|
|
@@ -242,14 +294,14 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
242
294
|
`import { showErrorOverlay, hideErrorOverlay } from '${errorOverlayPath}';
|
|
243
295
|
`
|
|
244
296
|
] : [];
|
|
245
|
-
const reactImports =
|
|
297
|
+
const reactImports = isDev2 ? [
|
|
246
298
|
`import { hydrateRoot, createRoot } from 'react-dom/client';`,
|
|
247
299
|
`import { createElement, Component } from 'react';`
|
|
248
300
|
] : [
|
|
249
301
|
`import { hydrateRoot, createRoot } from 'react-dom/client';`,
|
|
250
302
|
`import { createElement } from 'react';`
|
|
251
303
|
];
|
|
252
|
-
const errorBoundaryDef =
|
|
304
|
+
const errorBoundaryDef = isDev2 ? [
|
|
253
305
|
`
|
|
254
306
|
// Dev-only Error Boundary to catch React render errors`,
|
|
255
307
|
`class ErrorBoundary extends Component {`,
|
|
@@ -302,7 +354,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
302
354
|
`,
|
|
303
355
|
...errorBoundaryDef,
|
|
304
356
|
`// Hydration with error handling and fallback`,
|
|
305
|
-
`const isDev = ${
|
|
357
|
+
`const isDev = ${isDev2};`,
|
|
306
358
|
`const componentPath = '../pages/${componentName}';
|
|
307
359
|
`,
|
|
308
360
|
`function isHydrationError(error) {`,
|
|
@@ -375,7 +427,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
375
427
|
`,
|
|
376
428
|
` // Render into the same root container when falling back to client-only`,
|
|
377
429
|
` const root = createRoot(container);`,
|
|
378
|
-
` root.render(${
|
|
430
|
+
` root.render(${isDev2 ? `createElement(ErrorBoundary, null, createElement(${componentName}, mergedProps))` : `createElement(${componentName}, mergedProps)`});`,
|
|
379
431
|
` window.__REACT_ROOT__ = root;`,
|
|
380
432
|
` window.__HMR_CLIENT_ONLY_MODE__ = true;`,
|
|
381
433
|
` } catch (fallbackError) {`,
|
|
@@ -421,7 +473,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
421
473
|
` // Use onRecoverableError to catch hydration errors (React 19)`,
|
|
422
474
|
` root = hydrateRoot(`,
|
|
423
475
|
` container,`,
|
|
424
|
-
` ${
|
|
476
|
+
` ${isDev2 ? `createElement(ErrorBoundary, null, createElement(${componentName}, mergedProps))` : `createElement(${componentName}, mergedProps)`},`,
|
|
425
477
|
` {`,
|
|
426
478
|
` onRecoverableError: (error) => {`,
|
|
427
479
|
` // Check if this is a hydration error (isHydrationError filters out whitespace-only head mismatches)`,
|
|
@@ -496,14 +548,14 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
496
548
|
const hasher = new Bun.CryptoHasher("md5");
|
|
497
549
|
hasher.update(content);
|
|
498
550
|
const contentHash = hasher.digest("hex");
|
|
499
|
-
if (indexContentCache.get(indexPath) === contentHash) {
|
|
551
|
+
if (indexContentCache.get(indexPath) === contentHash && existsSync(indexPath)) {
|
|
500
552
|
return;
|
|
501
553
|
}
|
|
502
554
|
indexContentCache.set(indexPath, contentHash);
|
|
503
555
|
await writeFile(indexPath, content);
|
|
504
556
|
});
|
|
505
557
|
await Promise.all(promises);
|
|
506
|
-
if (!
|
|
558
|
+
if (!isDev2) {
|
|
507
559
|
return;
|
|
508
560
|
}
|
|
509
561
|
const refreshPath = join(reactIndexesDirectory, "_refresh.tsx");
|
|
@@ -744,13 +796,13 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
744
796
|
|
|
745
797
|
// src/dev/buildHMRClient.ts
|
|
746
798
|
import { existsSync as existsSync6 } from "fs";
|
|
747
|
-
import { resolve as
|
|
799
|
+
import { resolve as resolve4 } from "path";
|
|
748
800
|
var {build: bunBuild } = globalThis.Bun;
|
|
749
801
|
var resolveHmrClientPath = () => {
|
|
750
|
-
const fromSource =
|
|
802
|
+
const fromSource = resolve4(import.meta.dir, "client/hmrClient.ts");
|
|
751
803
|
if (existsSync6(fromSource))
|
|
752
804
|
return fromSource;
|
|
753
|
-
return
|
|
805
|
+
return resolve4(import.meta.dir, "dev/client/hmrClient.ts");
|
|
754
806
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
755
807
|
const entryPoint = hmrClientPath2;
|
|
756
808
|
const result = await bunBuild({
|
|
@@ -869,11 +921,11 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
869
921
|
|
|
870
922
|
// src/build/angularLinkerPlugin.ts
|
|
871
923
|
import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
872
|
-
import { dirname as dirname2, join as join4, relative, resolve as
|
|
924
|
+
import { dirname as dirname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
873
925
|
import { createHash } from "crypto";
|
|
874
926
|
var CACHE_DIR, angularLinkerPlugin;
|
|
875
927
|
var init_angularLinkerPlugin = __esm(() => {
|
|
876
|
-
CACHE_DIR =
|
|
928
|
+
CACHE_DIR = resolve5(".absolutejs", "cache", "angular-linker");
|
|
877
929
|
angularLinkerPlugin = {
|
|
878
930
|
name: "angular-linker",
|
|
879
931
|
setup(bld) {
|
|
@@ -913,7 +965,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
913
965
|
exists: existsSync7,
|
|
914
966
|
readFile: readFileSync3,
|
|
915
967
|
relative,
|
|
916
|
-
resolve:
|
|
968
|
+
resolve: resolve5
|
|
917
969
|
},
|
|
918
970
|
linkerJitMode: false,
|
|
919
971
|
logger: {
|
|
@@ -947,14 +999,14 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
947
999
|
|
|
948
1000
|
// src/utils/cleanStaleOutputs.ts
|
|
949
1001
|
import { rm as rm2 } from "fs/promises";
|
|
950
|
-
import { resolve as
|
|
1002
|
+
import { resolve as resolve6 } from "path";
|
|
951
1003
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
952
1004
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
953
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
1005
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve6(path)));
|
|
954
1006
|
const glob = new Glob4("**/*");
|
|
955
1007
|
const removals = [];
|
|
956
1008
|
for (const relative2 of glob.scanSync({ cwd: buildPath })) {
|
|
957
|
-
const absolute =
|
|
1009
|
+
const absolute = resolve6(buildPath, relative2);
|
|
958
1010
|
if (currentPaths.has(absolute))
|
|
959
1011
|
continue;
|
|
960
1012
|
if (!HASHED_FILE_PATTERN.test(relative2))
|
|
@@ -1175,10 +1227,10 @@ var init_logger = __esm(() => {
|
|
|
1175
1227
|
});
|
|
1176
1228
|
|
|
1177
1229
|
// src/utils/validateSafePath.ts
|
|
1178
|
-
import { resolve as
|
|
1230
|
+
import { resolve as resolve7, relative as relative2 } from "path";
|
|
1179
1231
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
1180
|
-
const absoluteBase =
|
|
1181
|
-
const absoluteTarget =
|
|
1232
|
+
const absoluteBase = resolve7(baseDirectory);
|
|
1233
|
+
const absoluteTarget = resolve7(baseDirectory, targetPath);
|
|
1182
1234
|
const relativePath = normalizePath(relative2(absoluteBase, absoluteTarget));
|
|
1183
1235
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
1184
1236
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
@@ -1200,17 +1252,17 @@ import {
|
|
|
1200
1252
|
join as join6,
|
|
1201
1253
|
basename as basename2,
|
|
1202
1254
|
extname as extname2,
|
|
1203
|
-
resolve as
|
|
1255
|
+
resolve as resolve8,
|
|
1204
1256
|
relative as relative3,
|
|
1205
1257
|
sep
|
|
1206
1258
|
} from "path";
|
|
1207
1259
|
import { env } from "process";
|
|
1208
1260
|
var {write, file: file2, Transpiler } = globalThis.Bun;
|
|
1209
1261
|
var resolveDevClientDir2 = () => {
|
|
1210
|
-
const fromSource =
|
|
1262
|
+
const fromSource = resolve8(import.meta.dir, "../dev/client");
|
|
1211
1263
|
if (existsSync8(fromSource))
|
|
1212
1264
|
return fromSource;
|
|
1213
|
-
return
|
|
1265
|
+
return resolve8(import.meta.dir, "./dev/client");
|
|
1214
1266
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
1215
1267
|
persistentCache.clear();
|
|
1216
1268
|
sourceHashCache.clear();
|
|
@@ -1222,7 +1274,7 @@ var resolveDevClientDir2 = () => {
|
|
|
1222
1274
|
return false;
|
|
1223
1275
|
}
|
|
1224
1276
|
}, resolveSvelte = async (spec, from) => {
|
|
1225
|
-
const basePath =
|
|
1277
|
+
const basePath = resolve8(dirname3(from), spec);
|
|
1226
1278
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
1227
1279
|
if (!explicit) {
|
|
1228
1280
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -1242,7 +1294,7 @@ var resolveDevClientDir2 = () => {
|
|
|
1242
1294
|
if (await exists(jsPath))
|
|
1243
1295
|
return jsPath;
|
|
1244
1296
|
return null;
|
|
1245
|
-
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map,
|
|
1297
|
+
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false) => {
|
|
1246
1298
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
1247
1299
|
const clientDir = join6(svelteRoot, "client");
|
|
1248
1300
|
const indexDir = join6(svelteRoot, "indexes");
|
|
@@ -1312,7 +1364,7 @@ var resolveDevClientDir2 = () => {
|
|
|
1312
1364
|
const indexPath = join6(indexDir, relClientDir, `${name}.js`);
|
|
1313
1365
|
const importRaw = relative3(dirname3(indexPath), client2).split(sep).join("/");
|
|
1314
1366
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
1315
|
-
const hmrImports =
|
|
1367
|
+
const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
1316
1368
|
import "${hmrClientPath3}";
|
|
1317
1369
|
` : "";
|
|
1318
1370
|
const bootstrap = `${hmrImports}import Component from "${importPath}";
|
|
@@ -1375,13 +1427,13 @@ __export(exports_compileVue, {
|
|
|
1375
1427
|
});
|
|
1376
1428
|
import { existsSync as existsSync9 } from "fs";
|
|
1377
1429
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
1378
|
-
import { basename as basename3, dirname as dirname4, join as join7, relative as relative4, resolve as
|
|
1430
|
+
import { basename as basename3, dirname as dirname4, join as join7, relative as relative4, resolve as resolve9 } from "path";
|
|
1379
1431
|
var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
1380
1432
|
var resolveDevClientDir3 = () => {
|
|
1381
|
-
const fromSource =
|
|
1433
|
+
const fromSource = resolve9(import.meta.dir, "../dev/client");
|
|
1382
1434
|
if (existsSync9(fromSource))
|
|
1383
1435
|
return fromSource;
|
|
1384
|
-
return
|
|
1436
|
+
return resolve9(import.meta.dir, "./dev/client");
|
|
1385
1437
|
}, devClientDir3, hmrClientPath4, transpiler2, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
1386
1438
|
scriptCache.clear();
|
|
1387
1439
|
scriptSetupCache.clear();
|
|
@@ -1470,7 +1522,7 @@ var resolveDevClientDir3 = () => {
|
|
|
1470
1522
|
const importPaths = extractImports(scriptSource);
|
|
1471
1523
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
1472
1524
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue"));
|
|
1473
|
-
const childBuildResults = await Promise.all(childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
1525
|
+
const childBuildResults = await Promise.all(childComponentPaths.map((relativeChildPath) => compileVueFile(resolve9(dirname4(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler)));
|
|
1474
1526
|
const compiledScript = compiler.compileScript(descriptor, {
|
|
1475
1527
|
id: componentId,
|
|
1476
1528
|
inlineTemplate: false
|
|
@@ -1546,14 +1598,14 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1546
1598
|
hmrId,
|
|
1547
1599
|
serverPath: serverOutputPath,
|
|
1548
1600
|
tsHelperPaths: [
|
|
1549
|
-
...helperModulePaths.map((helper) =>
|
|
1601
|
+
...helperModulePaths.map((helper) => resolve9(dirname4(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
1550
1602
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
1551
1603
|
]
|
|
1552
1604
|
};
|
|
1553
1605
|
cacheMap.set(sourceFilePath, result);
|
|
1554
1606
|
persistentBuildCache.set(sourceFilePath, result);
|
|
1555
1607
|
return result;
|
|
1556
|
-
}, compileVue = async (entryPoints, vueRootDir,
|
|
1608
|
+
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false) => {
|
|
1557
1609
|
const compiler = await import("@vue/compiler-sfc");
|
|
1558
1610
|
const clientOutputDir = join7(vueRootDir, "client");
|
|
1559
1611
|
const indexOutputDir = join7(vueRootDir, "indexes");
|
|
@@ -1568,7 +1620,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1568
1620
|
const buildCache = new Map;
|
|
1569
1621
|
const allTsHelperPaths = new Set;
|
|
1570
1622
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
1571
|
-
const result = await compileVueFile(
|
|
1623
|
+
const result = await compileVueFile(resolve9(entryPath), {
|
|
1572
1624
|
client: clientOutputDir,
|
|
1573
1625
|
css: cssOutputDir,
|
|
1574
1626
|
server: serverOutputDir
|
|
@@ -1578,7 +1630,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1578
1630
|
const indexOutputFile = join7(indexOutputDir, `${entryBaseName}.js`);
|
|
1579
1631
|
const clientOutputFile = join7(clientOutputDir, relative4(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
1580
1632
|
await mkdir2(dirname4(indexOutputFile), { recursive: true });
|
|
1581
|
-
const vueHmrImports =
|
|
1633
|
+
const vueHmrImports = isDev2 ? [
|
|
1582
1634
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
1583
1635
|
`import "${hmrClientPath4}";`
|
|
1584
1636
|
] : [];
|
|
@@ -24858,8 +24910,8 @@ ${lanes.join(`
|
|
|
24858
24910
|
}
|
|
24859
24911
|
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
|
24860
24912
|
let seenResolvedRefs;
|
|
24861
|
-
return
|
|
24862
|
-
function
|
|
24913
|
+
return worker2(projectReferences, resolvedProjectReferences, undefined);
|
|
24914
|
+
function worker2(projectReferences2, resolvedProjectReferences2, parent2) {
|
|
24863
24915
|
if (cbRef) {
|
|
24864
24916
|
const result = cbRef(projectReferences2, parent2);
|
|
24865
24917
|
if (result)
|
|
@@ -24875,7 +24927,7 @@ ${lanes.join(`
|
|
|
24875
24927
|
if (result || !resolvedRef)
|
|
24876
24928
|
return result;
|
|
24877
24929
|
(seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set)).add(resolvedRef.sourceFile.path);
|
|
24878
|
-
}) || forEach(resolvedProjectReferences2, (resolvedRef) => resolvedRef && !(skipChildren == null ? undefined : skipChildren.has(resolvedRef)) ?
|
|
24930
|
+
}) || forEach(resolvedProjectReferences2, (resolvedRef) => resolvedRef && !(skipChildren == null ? undefined : skipChildren.has(resolvedRef)) ? worker2(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : undefined);
|
|
24879
24931
|
}
|
|
24880
24932
|
}
|
|
24881
24933
|
function getOptionsSyntaxByArrayElementValue(optionsObject, name, value) {
|
|
@@ -99992,14 +100044,14 @@ ${lanes.join(`
|
|
|
99992
100044
|
}
|
|
99993
100045
|
}
|
|
99994
100046
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
99995
|
-
const
|
|
100047
|
+
const resolve10 = factory2.createUniqueName("resolve");
|
|
99996
100048
|
const reject = factory2.createUniqueName("reject");
|
|
99997
100049
|
const parameters = [
|
|
99998
|
-
factory2.createParameterDeclaration(undefined, undefined,
|
|
100050
|
+
factory2.createParameterDeclaration(undefined, undefined, resolve10),
|
|
99999
100051
|
factory2.createParameterDeclaration(undefined, undefined, reject)
|
|
100000
100052
|
];
|
|
100001
100053
|
const body = factory2.createBlock([
|
|
100002
|
-
factory2.createExpressionStatement(factory2.createCallExpression(factory2.createIdentifier("require"), undefined, [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
100054
|
+
factory2.createExpressionStatement(factory2.createCallExpression(factory2.createIdentifier("require"), undefined, [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve10, reject]))
|
|
100003
100055
|
]);
|
|
100004
100056
|
let func;
|
|
100005
100057
|
if (languageVersion >= 2) {
|
|
@@ -112704,18 +112756,18 @@ ${lanes.join(`
|
|
|
112704
112756
|
state.programEmitPending = undefined;
|
|
112705
112757
|
}
|
|
112706
112758
|
(_b = state.affectedFilesPendingEmit) == null || _b.forEach((emitKind, path) => {
|
|
112707
|
-
const
|
|
112708
|
-
if (!
|
|
112759
|
+
const pending2 = !isForDtsErrors ? emitKind & 7 : emitKind & (7 | 48);
|
|
112760
|
+
if (!pending2)
|
|
112709
112761
|
state.affectedFilesPendingEmit.delete(path);
|
|
112710
112762
|
else
|
|
112711
|
-
state.affectedFilesPendingEmit.set(path,
|
|
112763
|
+
state.affectedFilesPendingEmit.set(path, pending2);
|
|
112712
112764
|
});
|
|
112713
112765
|
if (state.programEmitPending) {
|
|
112714
|
-
const
|
|
112715
|
-
if (!
|
|
112766
|
+
const pending2 = !isForDtsErrors ? state.programEmitPending & 7 : state.programEmitPending & (7 | 48);
|
|
112767
|
+
if (!pending2)
|
|
112716
112768
|
state.programEmitPending = undefined;
|
|
112717
112769
|
else
|
|
112718
|
-
state.programEmitPending =
|
|
112770
|
+
state.programEmitPending = pending2;
|
|
112719
112771
|
}
|
|
112720
112772
|
}
|
|
112721
112773
|
function getPendingEmitKindWithSeen(optionsOrEmitKind, seenOldOptionsOrEmitKind, emitOnlyDtsFiles, isForDtsErrors) {
|
|
@@ -115664,8 +115716,8 @@ ${lanes.join(`
|
|
|
115664
115716
|
if (!host.setTimeout || !host.clearTimeout) {
|
|
115665
115717
|
return resolutionCache.invalidateResolutionsOfFailedLookupLocations();
|
|
115666
115718
|
}
|
|
115667
|
-
const
|
|
115668
|
-
writeLog(`Scheduling invalidateFailedLookup${
|
|
115719
|
+
const pending2 = clearInvalidateResolutionsOfFailedLookupLocations();
|
|
115720
|
+
writeLog(`Scheduling invalidateFailedLookup${pending2 ? ", Cancelled earlier one" : ""}`);
|
|
115669
115721
|
timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250, "timerToInvalidateFailedLookupResolutions");
|
|
115670
115722
|
}
|
|
115671
115723
|
function invalidateResolutionsOfFailedLookup() {
|
|
@@ -160477,16 +160529,16 @@ ${options.prefix}` : `
|
|
|
160477
160529
|
return;
|
|
160478
160530
|
}
|
|
160479
160531
|
this.ensurePackageDirectoryExists(cachePath);
|
|
160480
|
-
const
|
|
160532
|
+
const requestId2 = this.installRunCount;
|
|
160481
160533
|
this.installRunCount++;
|
|
160482
160534
|
this.sendResponse({
|
|
160483
160535
|
kind: EventBeginInstallTypes,
|
|
160484
|
-
eventId:
|
|
160536
|
+
eventId: requestId2,
|
|
160485
160537
|
typingsInstallerVersion: version,
|
|
160486
160538
|
projectName: req.projectName
|
|
160487
160539
|
});
|
|
160488
160540
|
const scopedTypings = filteredTypings.map(typingsName);
|
|
160489
|
-
this.installTypingsAsync(
|
|
160541
|
+
this.installTypingsAsync(requestId2, scopedTypings, cachePath, (ok) => {
|
|
160490
160542
|
try {
|
|
160491
160543
|
if (!ok) {
|
|
160492
160544
|
if (this.log.isEnabled()) {
|
|
@@ -160520,7 +160572,7 @@ ${options.prefix}` : `
|
|
|
160520
160572
|
} finally {
|
|
160521
160573
|
const response = {
|
|
160522
160574
|
kind: EventEndInstallTypes,
|
|
160523
|
-
eventId:
|
|
160575
|
+
eventId: requestId2,
|
|
160524
160576
|
projectName: req.projectName,
|
|
160525
160577
|
packagesToInstall: scopedTypings,
|
|
160526
160578
|
installSuccess: ok,
|
|
@@ -160563,8 +160615,8 @@ ${options.prefix}` : `
|
|
|
160563
160615
|
kind: ActionSet
|
|
160564
160616
|
};
|
|
160565
160617
|
}
|
|
160566
|
-
installTypingsAsync(
|
|
160567
|
-
this.pendingRunRequests.unshift({ requestId, packageNames, cwd, onRequestCompleted });
|
|
160618
|
+
installTypingsAsync(requestId2, packageNames, cwd, onRequestCompleted) {
|
|
160619
|
+
this.pendingRunRequests.unshift({ requestId: requestId2, packageNames, cwd, onRequestCompleted });
|
|
160568
160620
|
this.executeWithThrottling();
|
|
160569
160621
|
}
|
|
160570
160622
|
executeWithThrottling() {
|
|
@@ -166660,19 +166712,19 @@ ${json}${newLine}`;
|
|
|
166660
166712
|
this.performanceData = undefined;
|
|
166661
166713
|
}
|
|
166662
166714
|
immediate(actionType, action) {
|
|
166663
|
-
const
|
|
166664
|
-
Debug.assert(
|
|
166715
|
+
const requestId2 = this.requestId;
|
|
166716
|
+
Debug.assert(requestId2 === this.operationHost.getCurrentRequestId(), "immediate: incorrect request id");
|
|
166665
166717
|
this.setImmediateId(this.operationHost.getServerHost().setImmediate(() => {
|
|
166666
166718
|
this.immediateId = undefined;
|
|
166667
|
-
this.operationHost.executeWithRequestId(
|
|
166719
|
+
this.operationHost.executeWithRequestId(requestId2, () => this.executeAction(action), this.performanceData);
|
|
166668
166720
|
}, actionType));
|
|
166669
166721
|
}
|
|
166670
166722
|
delay(actionType, ms, action) {
|
|
166671
|
-
const
|
|
166672
|
-
Debug.assert(
|
|
166723
|
+
const requestId2 = this.requestId;
|
|
166724
|
+
Debug.assert(requestId2 === this.operationHost.getCurrentRequestId(), "delay: incorrect request id");
|
|
166673
166725
|
this.setTimerHandle(this.operationHost.getServerHost().setTimeout(() => {
|
|
166674
166726
|
this.timerHandle = undefined;
|
|
166675
|
-
this.operationHost.executeWithRequestId(
|
|
166727
|
+
this.operationHost.executeWithRequestId(requestId2, () => this.executeAction(action), this.performanceData);
|
|
166676
166728
|
}, ms, actionType));
|
|
166677
166729
|
}
|
|
166678
166730
|
executeAction(action) {
|
|
@@ -167447,12 +167499,12 @@ ${json}${newLine}`;
|
|
|
167447
167499
|
const { throttleWaitMilliseconds } = opts;
|
|
167448
167500
|
this.eventHandler = this.canUseEvents ? opts.eventHandler || ((event) => this.defaultEventHandler(event)) : undefined;
|
|
167449
167501
|
const multistepOperationHost = {
|
|
167450
|
-
executeWithRequestId: (
|
|
167502
|
+
executeWithRequestId: (requestId2, action, performanceData) => this.executeWithRequestId(requestId2, action, performanceData),
|
|
167451
167503
|
getCurrentRequestId: () => this.currentRequestId,
|
|
167452
167504
|
getPerformanceData: () => this.performanceData,
|
|
167453
167505
|
getServerHost: () => this.host,
|
|
167454
167506
|
logError: (err, cmd) => this.logError(err, cmd),
|
|
167455
|
-
sendRequestCompletedEvent: (
|
|
167507
|
+
sendRequestCompletedEvent: (requestId2, performanceData) => this.sendRequestCompletedEvent(requestId2, performanceData),
|
|
167456
167508
|
isCancellationRequested: () => this.cancellationToken.isCancellationRequested()
|
|
167457
167509
|
};
|
|
167458
167510
|
this.errorCheck = new MultistepOperation(multistepOperationHost);
|
|
@@ -167495,9 +167547,9 @@ ${json}${newLine}`;
|
|
|
167495
167547
|
Debug.assertNever(this.projectService.serverMode);
|
|
167496
167548
|
}
|
|
167497
167549
|
}
|
|
167498
|
-
sendRequestCompletedEvent(
|
|
167550
|
+
sendRequestCompletedEvent(requestId2, performanceData) {
|
|
167499
167551
|
this.event({
|
|
167500
|
-
request_seq:
|
|
167552
|
+
request_seq: requestId2,
|
|
167501
167553
|
performanceData: performanceData && toProtocolPerformanceData(performanceData)
|
|
167502
167554
|
}, "requestCompleted");
|
|
167503
167555
|
}
|
|
@@ -169283,24 +169335,24 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
169283
169335
|
}
|
|
169284
169336
|
this.handlers.set(command, handler);
|
|
169285
169337
|
}
|
|
169286
|
-
setCurrentRequest(
|
|
169338
|
+
setCurrentRequest(requestId2) {
|
|
169287
169339
|
Debug.assert(this.currentRequestId === undefined);
|
|
169288
|
-
this.currentRequestId =
|
|
169289
|
-
this.cancellationToken.setRequest(
|
|
169340
|
+
this.currentRequestId = requestId2;
|
|
169341
|
+
this.cancellationToken.setRequest(requestId2);
|
|
169290
169342
|
}
|
|
169291
|
-
resetCurrentRequest(
|
|
169292
|
-
Debug.assert(this.currentRequestId ===
|
|
169343
|
+
resetCurrentRequest(requestId2) {
|
|
169344
|
+
Debug.assert(this.currentRequestId === requestId2);
|
|
169293
169345
|
this.currentRequestId = undefined;
|
|
169294
|
-
this.cancellationToken.resetRequest(
|
|
169346
|
+
this.cancellationToken.resetRequest(requestId2);
|
|
169295
169347
|
}
|
|
169296
|
-
executeWithRequestId(
|
|
169348
|
+
executeWithRequestId(requestId2, f, perfomanceData) {
|
|
169297
169349
|
const currentPerformanceData = this.performanceData;
|
|
169298
169350
|
try {
|
|
169299
169351
|
this.performanceData = perfomanceData;
|
|
169300
|
-
this.setCurrentRequest(
|
|
169352
|
+
this.setCurrentRequest(requestId2);
|
|
169301
169353
|
return f();
|
|
169302
169354
|
} finally {
|
|
169303
|
-
this.resetCurrentRequest(
|
|
169355
|
+
this.resetCurrentRequest(requestId2);
|
|
169304
169356
|
this.performanceData = currentPerformanceData;
|
|
169305
169357
|
}
|
|
169306
169358
|
}
|
|
@@ -170174,8 +170226,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
170174
170226
|
installPackage(options) {
|
|
170175
170227
|
this.packageInstallId++;
|
|
170176
170228
|
const request = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
170177
|
-
const promise = new Promise((
|
|
170178
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map)).set(this.packageInstallId, { resolve:
|
|
170229
|
+
const promise = new Promise((resolve10, reject) => {
|
|
170230
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map)).set(this.packageInstallId, { resolve: resolve10, reject });
|
|
170179
170231
|
});
|
|
170180
170232
|
this.installer.send(request);
|
|
170181
170233
|
return promise;
|
|
@@ -170442,7 +170494,7 @@ __export(exports_compileAngular, {
|
|
|
170442
170494
|
compileAngular: () => compileAngular
|
|
170443
170495
|
});
|
|
170444
170496
|
import { existsSync as existsSync10, readFileSync as readFileSync4, promises as fs } from "fs";
|
|
170445
|
-
import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as
|
|
170497
|
+
import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve10, relative as relative5 } from "path";
|
|
170446
170498
|
import { createHash as createHash2 } from "crypto";
|
|
170447
170499
|
var import_typescript, computeConfigHash = () => {
|
|
170448
170500
|
try {
|
|
@@ -170452,10 +170504,10 @@ var import_typescript, computeConfigHash = () => {
|
|
|
170452
170504
|
return "";
|
|
170453
170505
|
}
|
|
170454
170506
|
}, resolveDevClientDir4 = () => {
|
|
170455
|
-
const fromSource =
|
|
170507
|
+
const fromSource = resolve10(import.meta.dir, "../dev/client");
|
|
170456
170508
|
if (existsSync10(fromSource))
|
|
170457
170509
|
return fromSource;
|
|
170458
|
-
return
|
|
170510
|
+
return resolve10(import.meta.dir, "./dev/client");
|
|
170459
170511
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
170460
170512
|
const componentClassRegex = /(?:export\s+)?class\s+(\w+Component)\s/g;
|
|
170461
170513
|
const componentNames = [];
|
|
@@ -170517,7 +170569,7 @@ ${registrations}
|
|
|
170517
170569
|
} else {
|
|
170518
170570
|
const tsPath = __require.resolve("/home/alexkahn/abs/absolutejs/node_modules/.bun/typescript@5.9.3/node_modules/typescript/lib/typescript.js");
|
|
170519
170571
|
const tsRootDir = dirname5(tsPath);
|
|
170520
|
-
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir :
|
|
170572
|
+
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve10(tsRootDir, "lib");
|
|
170521
170573
|
const config = readConfiguration("./tsconfig.json");
|
|
170522
170574
|
options = {
|
|
170523
170575
|
emitDecoratorMetadata: true,
|
|
@@ -170563,7 +170615,7 @@ ${registrations}
|
|
|
170563
170615
|
};
|
|
170564
170616
|
}
|
|
170565
170617
|
const emitted = {};
|
|
170566
|
-
const resolvedOutDir =
|
|
170618
|
+
const resolvedOutDir = resolve10(outDir);
|
|
170567
170619
|
host.writeFile = (fileName, text) => {
|
|
170568
170620
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
170569
170621
|
emitted[relativePath] = text;
|
|
@@ -170650,9 +170702,9 @@ ${registrations}
|
|
|
170650
170702
|
sourceMap: false,
|
|
170651
170703
|
target: import_typescript.default.ScriptTarget.ES2022
|
|
170652
170704
|
};
|
|
170653
|
-
const baseDir =
|
|
170705
|
+
const baseDir = resolve10(rootDir ?? process.cwd());
|
|
170654
170706
|
const transpileFile = async (filePath) => {
|
|
170655
|
-
const resolved =
|
|
170707
|
+
const resolved = resolve10(filePath);
|
|
170656
170708
|
if (visited.has(resolved))
|
|
170657
170709
|
return;
|
|
170658
170710
|
visited.add(resolved);
|
|
@@ -170701,7 +170753,7 @@ ${registrations}
|
|
|
170701
170753
|
}
|
|
170702
170754
|
const inputDirForResolve = dirname5(actualPath);
|
|
170703
170755
|
await Promise.all(localImports.map((imp) => {
|
|
170704
|
-
const importPath =
|
|
170756
|
+
const importPath = resolve10(inputDirForResolve, imp);
|
|
170705
170757
|
return transpileFile(importPath);
|
|
170706
170758
|
}));
|
|
170707
170759
|
};
|
|
@@ -171004,10 +171056,10 @@ import {
|
|
|
171004
171056
|
rmSync,
|
|
171005
171057
|
writeFileSync as writeFileSync3
|
|
171006
171058
|
} from "fs";
|
|
171007
|
-
import { basename as basename5, join as join11, resolve as
|
|
171059
|
+
import { basename as basename5, join as join11, relative as relative6, resolve as resolve11 } from "path";
|
|
171008
171060
|
import { cwd, env as env2, exit } from "process";
|
|
171009
171061
|
var {build: bunBuild4, Glob: Glob5 } = globalThis.Bun;
|
|
171010
|
-
var
|
|
171062
|
+
var isDev2, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
|
|
171011
171063
|
const errLog = logs.find((log2) => log2.level === "error") ?? logs[0];
|
|
171012
171064
|
if (!errLog) {
|
|
171013
171065
|
exit(1);
|
|
@@ -171042,8 +171094,8 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171042
171094
|
}
|
|
171043
171095
|
}, resolveAbsoluteVersion = async () => {
|
|
171044
171096
|
const candidates = [
|
|
171045
|
-
|
|
171046
|
-
|
|
171097
|
+
resolve11(import.meta.dir, "..", "..", "package.json"),
|
|
171098
|
+
resolve11(import.meta.dir, "..", "package.json")
|
|
171047
171099
|
];
|
|
171048
171100
|
for (const candidate of candidates) {
|
|
171049
171101
|
const pkg = await tryReadPackageJson(candidate);
|
|
@@ -171116,7 +171168,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171116
171168
|
sendTelemetryEvent("build:start", {
|
|
171117
171169
|
framework: frameworkNames[0],
|
|
171118
171170
|
frameworks: frameworkNames,
|
|
171119
|
-
mode: mode ?? (
|
|
171171
|
+
mode: mode ?? (isDev2 ? "development" : "production"),
|
|
171120
171172
|
tailwind: Boolean(tailwind)
|
|
171121
171173
|
});
|
|
171122
171174
|
const clientRoots = [
|
|
@@ -171153,13 +171205,13 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171153
171205
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
171154
171206
|
if (!isIncremental || !incrementalFiles)
|
|
171155
171207
|
return entryPoints;
|
|
171156
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f) =>
|
|
171208
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f) => resolve11(f)));
|
|
171157
171209
|
const matchingEntries = [];
|
|
171158
171210
|
for (const entry of entryPoints) {
|
|
171159
171211
|
const sourceFile = mapToSource(entry);
|
|
171160
171212
|
if (!sourceFile)
|
|
171161
171213
|
continue;
|
|
171162
|
-
if (!normalizedIncremental.has(
|
|
171214
|
+
if (!normalizedIncremental.has(resolve11(sourceFile)))
|
|
171163
171215
|
continue;
|
|
171164
171216
|
matchingEntries.push(entry);
|
|
171165
171217
|
}
|
|
@@ -171212,7 +171264,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171212
171264
|
]);
|
|
171213
171265
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
|
|
171214
171266
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
171215
|
-
if (entry.startsWith(
|
|
171267
|
+
if (entry.startsWith(resolve11(reactIndexesPath))) {
|
|
171216
171268
|
const pageName = basename5(entry, ".tsx");
|
|
171217
171269
|
return join11(reactPagesPath, `${pageName}.tsx`);
|
|
171218
171270
|
}
|
|
@@ -171283,7 +171335,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171283
171335
|
},
|
|
171284
171336
|
frameworks: frameworkNames,
|
|
171285
171337
|
incremental: Boolean(isIncremental),
|
|
171286
|
-
mode: mode ?? (
|
|
171338
|
+
mode: mode ?? (isDev2 ? "development" : "production"),
|
|
171287
171339
|
scannedEntries: {
|
|
171288
171340
|
angular: allAngularEntries.length,
|
|
171289
171341
|
html: allHtmlEntries.length,
|
|
@@ -171316,7 +171368,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171316
171368
|
entrypoints: reactClientEntryPoints,
|
|
171317
171369
|
...vendorPaths ? { external: Object.keys(vendorPaths) } : {},
|
|
171318
171370
|
format: "esm",
|
|
171319
|
-
minify: !
|
|
171371
|
+
minify: !isDev2,
|
|
171320
171372
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
171321
171373
|
outdir: buildPath,
|
|
171322
171374
|
...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
|
|
@@ -171375,15 +171427,15 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171375
171427
|
entrypoints: nonReactClientEntryPoints,
|
|
171376
171428
|
...angularVendorPaths2 ? { external: Object.keys(angularVendorPaths2) } : {},
|
|
171377
171429
|
format: "esm",
|
|
171378
|
-
minify: !
|
|
171430
|
+
minify: !isDev2,
|
|
171379
171431
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
171380
171432
|
outdir: buildPath,
|
|
171381
171433
|
plugins: [
|
|
171382
|
-
...angularDir && !
|
|
171434
|
+
...angularDir && !isDev2 ? [angularLinkerPlugin] : [],
|
|
171383
171435
|
...htmlScriptPlugin ? [htmlScriptPlugin] : []
|
|
171384
171436
|
],
|
|
171385
171437
|
root: clientRoot,
|
|
171386
|
-
splitting: !
|
|
171438
|
+
splitting: !isDev2,
|
|
171387
171439
|
target: "browser",
|
|
171388
171440
|
throw: false
|
|
171389
171441
|
}) : undefined,
|
|
@@ -171541,6 +171593,18 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171541
171593
|
...cssOutputs.map((a) => a.path)
|
|
171542
171594
|
]);
|
|
171543
171595
|
}
|
|
171596
|
+
if (hmr && reactIndexesPath && reactPagesPath) {
|
|
171597
|
+
const { readdirSync: readDir } = await import("fs");
|
|
171598
|
+
const devIndexDir = join11(buildPath, "_src_indexes");
|
|
171599
|
+
mkdirSync6(devIndexDir, { recursive: true });
|
|
171600
|
+
const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
|
|
171601
|
+
const pagesRel = relative6(process.cwd(), resolve11(reactPagesPath)).replace(/\\/g, "/");
|
|
171602
|
+
for (const file4 of indexFiles) {
|
|
171603
|
+
let content = readFileSync5(join11(reactIndexesPath, file4), "utf-8");
|
|
171604
|
+
content = content.replace(/from\s*['"]\.\.\/pages\/([^'"]+)['"]/g, `from '/@src/${pagesRel}/$1'`);
|
|
171605
|
+
writeFileSync3(join11(devIndexDir, file4), content);
|
|
171606
|
+
}
|
|
171607
|
+
}
|
|
171544
171608
|
if (!options?.preserveIntermediateFiles)
|
|
171545
171609
|
await cleanup({
|
|
171546
171610
|
angularDir,
|
|
@@ -171554,7 +171618,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171554
171618
|
sendTelemetryEvent("build:complete", {
|
|
171555
171619
|
durationMs: Math.round(performance.now() - buildStart),
|
|
171556
171620
|
frameworks: frameworkNames,
|
|
171557
|
-
mode: mode ?? (
|
|
171621
|
+
mode: mode ?? (isDev2 ? "development" : "production")
|
|
171558
171622
|
});
|
|
171559
171623
|
if (!isIncremental) {
|
|
171560
171624
|
writeFileSync3(join11(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
@@ -171578,17 +171642,17 @@ var init_build = __esm(() => {
|
|
|
171578
171642
|
init_commonAncestor();
|
|
171579
171643
|
init_logger();
|
|
171580
171644
|
init_validateSafePath();
|
|
171581
|
-
|
|
171645
|
+
isDev2 = env2.NODE_ENV === "development";
|
|
171582
171646
|
vueFeatureFlags = {
|
|
171583
171647
|
__VUE_OPTIONS_API__: "true",
|
|
171584
|
-
__VUE_PROD_DEVTOOLS__:
|
|
171585
|
-
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__:
|
|
171648
|
+
__VUE_PROD_DEVTOOLS__: isDev2 ? "true" : "false",
|
|
171649
|
+
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isDev2 ? "true" : "false"
|
|
171586
171650
|
};
|
|
171587
171651
|
});
|
|
171588
171652
|
|
|
171589
171653
|
// src/dev/dependencyGraph.ts
|
|
171590
171654
|
import { existsSync as existsSync11, readFileSync as readFileSync6, readdirSync } from "fs";
|
|
171591
|
-
import { resolve as
|
|
171655
|
+
import { resolve as resolve12 } from "path";
|
|
171592
171656
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
171593
171657
|
const lower = filePath.toLowerCase();
|
|
171594
171658
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -171602,8 +171666,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
171602
171666
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
171603
171667
|
return null;
|
|
171604
171668
|
}
|
|
171605
|
-
const fromDir =
|
|
171606
|
-
const normalized =
|
|
171669
|
+
const fromDir = resolve12(fromFile, "..");
|
|
171670
|
+
const normalized = resolve12(fromDir, importPath);
|
|
171607
171671
|
const extensions = [
|
|
171608
171672
|
".ts",
|
|
171609
171673
|
".tsx",
|
|
@@ -171633,7 +171697,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
171633
171697
|
dependents.delete(normalizedPath);
|
|
171634
171698
|
}
|
|
171635
171699
|
}, addFileToGraph = (graph, filePath) => {
|
|
171636
|
-
const normalizedPath =
|
|
171700
|
+
const normalizedPath = resolve12(filePath);
|
|
171637
171701
|
if (!existsSync11(normalizedPath))
|
|
171638
171702
|
return;
|
|
171639
171703
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -171651,7 +171715,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
171651
171715
|
const ext = fileName.split(".").pop()?.toLowerCase() ?? "";
|
|
171652
171716
|
return SCANNABLE_EXTENSIONS.has(ext);
|
|
171653
171717
|
}, processEntry = (graph, processedFiles, scanDir, normalizedDir, entry) => {
|
|
171654
|
-
const fullPath =
|
|
171718
|
+
const fullPath = resolve12(normalizedDir, entry.name);
|
|
171655
171719
|
if (isIgnoredPath(fullPath, entry.name))
|
|
171656
171720
|
return;
|
|
171657
171721
|
if (entry.isDirectory()) {
|
|
@@ -171677,13 +171741,13 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
171677
171741
|
});
|
|
171678
171742
|
};
|
|
171679
171743
|
const scanDirectory = (dir) => {
|
|
171680
|
-
const normalizedDir =
|
|
171744
|
+
const normalizedDir = resolve12(dir);
|
|
171681
171745
|
try {
|
|
171682
171746
|
scanEntries(normalizedDir);
|
|
171683
171747
|
} catch {}
|
|
171684
171748
|
};
|
|
171685
171749
|
for (const dir of directories) {
|
|
171686
|
-
const resolvedDir =
|
|
171750
|
+
const resolvedDir = resolve12(dir);
|
|
171687
171751
|
if (!existsSync11(resolvedDir))
|
|
171688
171752
|
continue;
|
|
171689
171753
|
scanDirectory(resolvedDir);
|
|
@@ -171793,7 +171857,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
171793
171857
|
return [];
|
|
171794
171858
|
}
|
|
171795
171859
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
171796
|
-
const normalizedPath =
|
|
171860
|
+
const normalizedPath = resolve12(changedFile);
|
|
171797
171861
|
const affected = new Set;
|
|
171798
171862
|
const toProcess = [normalizedPath];
|
|
171799
171863
|
const processNode = (current) => {
|
|
@@ -171833,7 +171897,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
171833
171897
|
}
|
|
171834
171898
|
graph.dependents.delete(normalizedPath);
|
|
171835
171899
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
171836
|
-
const normalizedPath =
|
|
171900
|
+
const normalizedPath = resolve12(filePath);
|
|
171837
171901
|
removeDepsForFile(graph, normalizedPath);
|
|
171838
171902
|
removeDependentsForFile(graph, normalizedPath);
|
|
171839
171903
|
};
|
|
@@ -171886,12 +171950,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
171886
171950
|
};
|
|
171887
171951
|
|
|
171888
171952
|
// src/dev/configResolver.ts
|
|
171889
|
-
import { resolve as
|
|
171953
|
+
import { resolve as resolve13 } from "path";
|
|
171890
171954
|
var resolveBuildPaths = (config) => {
|
|
171891
171955
|
const cwd2 = process.cwd();
|
|
171892
171956
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
171893
|
-
const withDefault = (value, fallback) => normalize(
|
|
171894
|
-
const optional = (value) => value ? normalize(
|
|
171957
|
+
const withDefault = (value, fallback) => normalize(resolve13(cwd2, value ?? fallback));
|
|
171958
|
+
const optional = (value) => value ? normalize(resolve13(cwd2, value)) : undefined;
|
|
171895
171959
|
return {
|
|
171896
171960
|
angularDir: optional(config.angularDirectory),
|
|
171897
171961
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -172057,7 +172121,7 @@ var init_pathUtils = () => {};
|
|
|
172057
172121
|
// src/dev/fileWatcher.ts
|
|
172058
172122
|
import { watch } from "fs";
|
|
172059
172123
|
import { existsSync as existsSync12 } from "fs";
|
|
172060
|
-
import { join as join12, resolve as
|
|
172124
|
+
import { join as join12, resolve as resolve14 } from "path";
|
|
172061
172125
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
172062
172126
|
try {
|
|
172063
172127
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -172102,7 +172166,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
172102
172166
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
172103
172167
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
172104
172168
|
paths.forEach((path) => {
|
|
172105
|
-
const absolutePath =
|
|
172169
|
+
const absolutePath = resolve14(path).replace(/\\/g, "/");
|
|
172106
172170
|
if (!existsSync12(absolutePath)) {
|
|
172107
172171
|
return;
|
|
172108
172172
|
}
|
|
@@ -172113,7 +172177,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
172113
172177
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
172114
172178
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
172115
172179
|
watchPaths.forEach((path) => {
|
|
172116
|
-
const absolutePath =
|
|
172180
|
+
const absolutePath = resolve14(path).replace(/\\/g, "/");
|
|
172117
172181
|
if (!existsSync12(absolutePath)) {
|
|
172118
172182
|
return;
|
|
172119
172183
|
}
|
|
@@ -172128,13 +172192,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
172128
172192
|
});
|
|
172129
172193
|
|
|
172130
172194
|
// src/dev/assetStore.ts
|
|
172131
|
-
import { resolve as
|
|
172195
|
+
import { resolve as resolve15 } from "path";
|
|
172132
172196
|
import { readdir as readdir2, unlink } from "fs/promises";
|
|
172133
172197
|
var mimeTypes, getMimeType = (filePath) => {
|
|
172134
172198
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
172135
172199
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
172136
172200
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
172137
|
-
const fullPath =
|
|
172201
|
+
const fullPath = resolve15(dir, entry.name);
|
|
172138
172202
|
if (entry.isDirectory()) {
|
|
172139
172203
|
return walkAndClean(fullPath);
|
|
172140
172204
|
}
|
|
@@ -172150,10 +172214,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
172150
172214
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
172151
172215
|
const liveByIdentity = new Map;
|
|
172152
172216
|
for (const webPath of store.keys()) {
|
|
172153
|
-
const diskPath =
|
|
172217
|
+
const diskPath = resolve15(buildDir, webPath.slice(1));
|
|
172154
172218
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
172155
172219
|
}
|
|
172156
|
-
const absBuildDir =
|
|
172220
|
+
const absBuildDir = resolve15(buildDir);
|
|
172157
172221
|
Object.values(manifest).forEach((val) => {
|
|
172158
172222
|
if (!HASHED_FILE_RE.test(val))
|
|
172159
172223
|
return;
|
|
@@ -172171,7 +172235,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
172171
172235
|
} catch {}
|
|
172172
172236
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
172173
172237
|
if (entry.isDirectory()) {
|
|
172174
|
-
return scanDir(
|
|
172238
|
+
return scanDir(resolve15(dir, entry.name), `${prefix}${entry.name}/`);
|
|
172175
172239
|
}
|
|
172176
172240
|
if (!entry.name.startsWith("chunk-")) {
|
|
172177
172241
|
return null;
|
|
@@ -172180,7 +172244,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
172180
172244
|
if (store.has(webPath)) {
|
|
172181
172245
|
return null;
|
|
172182
172246
|
}
|
|
172183
|
-
return Bun.file(
|
|
172247
|
+
return Bun.file(resolve15(dir, entry.name)).bytes().then((bytes) => {
|
|
172184
172248
|
store.set(webPath, bytes);
|
|
172185
172249
|
return;
|
|
172186
172250
|
}).catch(() => {});
|
|
@@ -172205,7 +172269,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
172205
172269
|
for (const webPath of newIdentities.values()) {
|
|
172206
172270
|
if (store.has(webPath))
|
|
172207
172271
|
continue;
|
|
172208
|
-
loadPromises.push(Bun.file(
|
|
172272
|
+
loadPromises.push(Bun.file(resolve15(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
172209
172273
|
store.set(webPath, bytes);
|
|
172210
172274
|
return;
|
|
172211
172275
|
}).catch(() => {}));
|
|
@@ -172256,9 +172320,9 @@ var init_fileHashTracker = __esm(() => {
|
|
|
172256
172320
|
});
|
|
172257
172321
|
|
|
172258
172322
|
// src/dev/reactComponentClassifier.ts
|
|
172259
|
-
import { resolve as
|
|
172323
|
+
import { resolve as resolve16 } from "path";
|
|
172260
172324
|
var classifyComponent = (filePath) => {
|
|
172261
|
-
const normalizedPath =
|
|
172325
|
+
const normalizedPath = resolve16(filePath);
|
|
172262
172326
|
if (normalizedPath.includes("/react/pages/")) {
|
|
172263
172327
|
return "server";
|
|
172264
172328
|
}
|
|
@@ -172270,7 +172334,7 @@ var classifyComponent = (filePath) => {
|
|
|
172270
172334
|
var init_reactComponentClassifier = () => {};
|
|
172271
172335
|
|
|
172272
172336
|
// src/dev/moduleMapper.ts
|
|
172273
|
-
import { basename as basename6, resolve as
|
|
172337
|
+
import { basename as basename6, resolve as resolve17 } from "path";
|
|
172274
172338
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
172275
172339
|
const modulePaths = {};
|
|
172276
172340
|
moduleKeys.forEach((key) => {
|
|
@@ -172280,7 +172344,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
172280
172344
|
});
|
|
172281
172345
|
return modulePaths;
|
|
172282
172346
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
172283
|
-
const normalizedFile =
|
|
172347
|
+
const normalizedFile = resolve17(sourceFile);
|
|
172284
172348
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
172285
172349
|
if (processedFiles.has(normalizedFile)) {
|
|
172286
172350
|
return null;
|
|
@@ -172316,7 +172380,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
172316
172380
|
});
|
|
172317
172381
|
return grouped;
|
|
172318
172382
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
172319
|
-
const normalizedFile =
|
|
172383
|
+
const normalizedFile = resolve17(sourceFile);
|
|
172320
172384
|
const fileName = basename6(normalizedFile);
|
|
172321
172385
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
172322
172386
|
const pascalName = toPascal(baseName);
|
|
@@ -172446,6 +172510,18 @@ var trySendMessage = (client2, messageStr) => {
|
|
|
172446
172510
|
state.activeFrameworks.add(data.framework);
|
|
172447
172511
|
}
|
|
172448
172512
|
break;
|
|
172513
|
+
case "hmr-timing": {
|
|
172514
|
+
const timing = data;
|
|
172515
|
+
if (timing.duration !== undefined) {
|
|
172516
|
+
const lastPath = state.lastHmrPath ?? "";
|
|
172517
|
+
const breakdown = timing.serverMs !== undefined ? ` (server ${timing.serverMs}ms + fetch ${timing.fetchMs ?? 0}ms + refresh ${timing.refreshMs ?? 0}ms)` : "";
|
|
172518
|
+
logHmrUpdate(lastPath, state.lastHmrFramework, timing.duration);
|
|
172519
|
+
if (breakdown) {
|
|
172520
|
+
console.log(` ${breakdown}`);
|
|
172521
|
+
}
|
|
172522
|
+
}
|
|
172523
|
+
break;
|
|
172524
|
+
}
|
|
172449
172525
|
}
|
|
172450
172526
|
}, handleHMRMessage = (state, client2, message) => {
|
|
172451
172527
|
try {
|
|
@@ -172459,11 +172535,13 @@ var trySendMessage = (client2, messageStr) => {
|
|
|
172459
172535
|
handleParsedMessage(state, client2, parsedData);
|
|
172460
172536
|
} catch {}
|
|
172461
172537
|
};
|
|
172462
|
-
var init_webSocket = () => {
|
|
172538
|
+
var init_webSocket = __esm(() => {
|
|
172539
|
+
init_logger();
|
|
172540
|
+
});
|
|
172463
172541
|
|
|
172464
172542
|
// src/utils/registerClientScript.ts
|
|
172465
|
-
var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, registerClientScript = (script,
|
|
172466
|
-
const id =
|
|
172543
|
+
var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, registerClientScript = (script, requestId2) => {
|
|
172544
|
+
const id = requestId2 || ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value || getRequestId();
|
|
172467
172545
|
if (!scriptRegistry.has(id)) {
|
|
172468
172546
|
scriptRegistry.set(id, new Set);
|
|
172469
172547
|
}
|
|
@@ -172521,8 +172599,8 @@ var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_
|
|
|
172521
172599
|
${scriptCode}
|
|
172522
172600
|
})();
|
|
172523
172601
|
</script>`;
|
|
172524
|
-
}, getAndClearClientScripts = (
|
|
172525
|
-
const id =
|
|
172602
|
+
}, getAndClearClientScripts = (requestId2) => {
|
|
172603
|
+
const id = requestId2 || ssrContextGetter?.();
|
|
172526
172604
|
if (!id)
|
|
172527
172605
|
return [];
|
|
172528
172606
|
const scripts = scriptRegistry.get(id);
|
|
@@ -202012,9 +202090,9 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
|
|
|
202012
202090
|
return html.replace("</html>", `${snippet}</html>`);
|
|
202013
202091
|
}
|
|
202014
202092
|
return html + snippet;
|
|
202015
|
-
}, injectSsrScripts = (html,
|
|
202093
|
+
}, injectSsrScripts = (html, requestId2, indexPath) => {
|
|
202016
202094
|
let result = html;
|
|
202017
|
-
const registeredScripts = getAndClearClientScripts(
|
|
202095
|
+
const registeredScripts = getAndClearClientScripts(requestId2);
|
|
202018
202096
|
if (registeredScripts.length > 0) {
|
|
202019
202097
|
result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
|
|
202020
202098
|
}
|
|
@@ -202053,8 +202131,8 @@ var ssrDirty = false, lastSelector = "angular-page", invalidateAngularSsrCache =
|
|
|
202053
202131
|
ssrDirty = true;
|
|
202054
202132
|
clearSelectorCache();
|
|
202055
202133
|
}, angularSsrContext, handleAngularPageRequest = async (_importer, pagePath, indexPath, headTag = "<head></head>", ...props) => {
|
|
202056
|
-
const
|
|
202057
|
-
return angularSsrContext.run(
|
|
202134
|
+
const requestId2 = `angular_${Date.now()}_${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
|
|
202135
|
+
return angularSsrContext.run(requestId2, async () => {
|
|
202058
202136
|
const [maybeProps] = props;
|
|
202059
202137
|
cacheRouteData(pagePath, { headTag, props: maybeProps });
|
|
202060
202138
|
if (ssrDirty) {
|
|
@@ -202079,7 +202157,7 @@ var ssrDirty = false, lastSelector = "angular-page", invalidateAngularSsrCache =
|
|
|
202079
202157
|
const sanitizer = getSsrSanitizer(deps);
|
|
202080
202158
|
const providers = buildProviders(deps, sanitizer, maybeProps, tokenMap);
|
|
202081
202159
|
const rawHtml = await renderAngularApp(deps, PageComponent, providers, htmlString);
|
|
202082
|
-
const html = injectSsrScripts(rawHtml,
|
|
202160
|
+
const html = injectSsrScripts(rawHtml, requestId2, indexPath);
|
|
202083
202161
|
return new Response(html, {
|
|
202084
202162
|
headers: { "Content-Type": "text/html" }
|
|
202085
202163
|
});
|
|
@@ -202101,16 +202179,352 @@ var init_pageHandler = __esm(() => {
|
|
|
202101
202179
|
setSsrContextGetter(() => angularSsrContext.getStore());
|
|
202102
202180
|
});
|
|
202103
202181
|
|
|
202182
|
+
// src/dev/transformCache.ts
|
|
202183
|
+
var exports_transformCache = {};
|
|
202184
|
+
__export(exports_transformCache, {
|
|
202185
|
+
setTransformed: () => setTransformed,
|
|
202186
|
+
invalidateAll: () => invalidateAll,
|
|
202187
|
+
invalidate: () => invalidate,
|
|
202188
|
+
getTransformed: () => getTransformed
|
|
202189
|
+
});
|
|
202190
|
+
import { statSync } from "fs";
|
|
202191
|
+
var globalStore, cache, getTransformed = (filePath) => {
|
|
202192
|
+
const entry = cache.get(filePath);
|
|
202193
|
+
if (!entry)
|
|
202194
|
+
return;
|
|
202195
|
+
try {
|
|
202196
|
+
const stat2 = statSync(filePath);
|
|
202197
|
+
if (stat2.mtimeMs === entry.mtime)
|
|
202198
|
+
return entry.content;
|
|
202199
|
+
} catch {
|
|
202200
|
+
cache.delete(filePath);
|
|
202201
|
+
}
|
|
202202
|
+
return;
|
|
202203
|
+
}, setTransformed = (filePath, content, mtime) => {
|
|
202204
|
+
cache.set(filePath, { content, mtime });
|
|
202205
|
+
}, invalidate = (filePath) => {
|
|
202206
|
+
cache.delete(filePath);
|
|
202207
|
+
}, invalidateAll = () => {
|
|
202208
|
+
cache.clear();
|
|
202209
|
+
};
|
|
202210
|
+
var init_transformCache = __esm(() => {
|
|
202211
|
+
globalStore = globalThis;
|
|
202212
|
+
cache = globalStore.__transformCache ?? new Map;
|
|
202213
|
+
globalStore.__transformCache = cache;
|
|
202214
|
+
});
|
|
202215
|
+
|
|
202216
|
+
// src/dev/moduleServer.ts
|
|
202217
|
+
var exports_moduleServer = {};
|
|
202218
|
+
__export(exports_moduleServer, {
|
|
202219
|
+
warmCache: () => warmCache,
|
|
202220
|
+
setGlobalModuleServer: () => setGlobalModuleServer,
|
|
202221
|
+
invalidateModule: () => invalidateModule,
|
|
202222
|
+
createModuleServer: () => createModuleServer,
|
|
202223
|
+
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
202224
|
+
});
|
|
202225
|
+
import { readFileSync as readFileSync9, statSync as statSync2 } from "fs";
|
|
202226
|
+
import { dirname as dirname7, extname as extname3, resolve as resolve18, relative as relative7 } from "path";
|
|
202227
|
+
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, TRANSPILABLE, ALL_EXPORTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
202228
|
+
const allExports = [];
|
|
202229
|
+
let match;
|
|
202230
|
+
ALL_EXPORTS_RE.lastIndex = 0;
|
|
202231
|
+
while ((match = ALL_EXPORTS_RE.exec(originalSource)) !== null) {
|
|
202232
|
+
if (match[1])
|
|
202233
|
+
allExports.push(match[1]);
|
|
202234
|
+
}
|
|
202235
|
+
const valueSet = new Set(valueExports);
|
|
202236
|
+
const typeExports = allExports.filter((e) => !valueSet.has(e));
|
|
202237
|
+
if (typeExports.length === 0)
|
|
202238
|
+
return transpiled;
|
|
202239
|
+
const stubs = typeExports.map((name) => `export const ${name} = undefined;`).join(`
|
|
202240
|
+
`);
|
|
202241
|
+
return `${transpiled}
|
|
202242
|
+
${stubs}
|
|
202243
|
+
`;
|
|
202244
|
+
}, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
202245
|
+
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
202246
|
+
if (entries.length === 0)
|
|
202247
|
+
return null;
|
|
202248
|
+
const alt = entries.map(([spec]) => escapeRegex3(spec)).join("|");
|
|
202249
|
+
const lookup = new Map(entries);
|
|
202250
|
+
const fromRegex = new RegExp(`(from\\s*["'])(${alt})(["'])`, "g");
|
|
202251
|
+
const sideEffectRegex = new RegExp(`(import\\s*["'])(${alt})(["']\\s*;?)`, "g");
|
|
202252
|
+
const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])(${alt})(["']\\s*\\))`, "g");
|
|
202253
|
+
return { dynamicRegex, fromRegex, lookup, sideEffectRegex };
|
|
202254
|
+
}, rewriteImports2 = (code, filePath, projectRoot, rewriter) => {
|
|
202255
|
+
let result = code;
|
|
202256
|
+
const bareSpecifierRe = /((?:from|import)\s*["'])([^"'./][^"']*)(["'])/g;
|
|
202257
|
+
result = result.replace(bareSpecifierRe, (_match, prefix, specifier, suffix) => {
|
|
202258
|
+
const webPath = rewriter?.lookup.get(specifier);
|
|
202259
|
+
if (webPath)
|
|
202260
|
+
return `${prefix}${webPath}${suffix}`;
|
|
202261
|
+
return `${prefix}/@stub/${encodeURIComponent(specifier)}${suffix}`;
|
|
202262
|
+
});
|
|
202263
|
+
const fileDir = dirname7(filePath);
|
|
202264
|
+
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => {
|
|
202265
|
+
const absPath = resolve18(fileDir, relPath);
|
|
202266
|
+
const rel = relative7(projectRoot, absPath);
|
|
202267
|
+
let srcPath = rel;
|
|
202268
|
+
if (!extname3(srcPath)) {
|
|
202269
|
+
const extensions = [".tsx", ".ts", ".jsx", ".js"];
|
|
202270
|
+
for (const ext of extensions) {
|
|
202271
|
+
try {
|
|
202272
|
+
statSync2(resolve18(projectRoot, srcPath + ext));
|
|
202273
|
+
srcPath += ext;
|
|
202274
|
+
break;
|
|
202275
|
+
} catch {}
|
|
202276
|
+
}
|
|
202277
|
+
}
|
|
202278
|
+
return `${prefix}${SRC_PREFIX}${srcPath.replace(/\\/g, "/")}${suffix}`;
|
|
202279
|
+
});
|
|
202280
|
+
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => {
|
|
202281
|
+
const absPath = resolve18(fileDir, relPath);
|
|
202282
|
+
const rel = relative7(projectRoot, absPath);
|
|
202283
|
+
return `${prefix}${SRC_PREFIX}${rel.replace(/\\/g, "/")}${suffix}`;
|
|
202284
|
+
});
|
|
202285
|
+
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => {
|
|
202286
|
+
const absPath = resolve18(fileDir, relPath);
|
|
202287
|
+
const rel = relative7(projectRoot, absPath);
|
|
202288
|
+
let srcPath = rel;
|
|
202289
|
+
if (!extname3(srcPath)) {
|
|
202290
|
+
const extensions = [".tsx", ".ts", ".jsx", ".js", ".css"];
|
|
202291
|
+
for (const ext of extensions) {
|
|
202292
|
+
try {
|
|
202293
|
+
statSync2(resolve18(projectRoot, srcPath + ext));
|
|
202294
|
+
srcPath += ext;
|
|
202295
|
+
break;
|
|
202296
|
+
} catch {}
|
|
202297
|
+
}
|
|
202298
|
+
}
|
|
202299
|
+
return `${prefix}${SRC_PREFIX}${srcPath.replace(/\\/g, "/")}${suffix}`;
|
|
202300
|
+
});
|
|
202301
|
+
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
202302
|
+
if (absPath.startsWith(projectRoot)) {
|
|
202303
|
+
const rel2 = relative7(projectRoot, absPath).replace(/\\/g, "/");
|
|
202304
|
+
return `${prefix}${SRC_PREFIX}${rel2}${suffix}`;
|
|
202305
|
+
}
|
|
202306
|
+
const rel = relative7(projectRoot, absPath).replace(/\\/g, "/");
|
|
202307
|
+
if (!rel.startsWith("..")) {
|
|
202308
|
+
return `${prefix}${SRC_PREFIX}${rel}${suffix}`;
|
|
202309
|
+
}
|
|
202310
|
+
return _match;
|
|
202311
|
+
});
|
|
202312
|
+
return result;
|
|
202313
|
+
}, HOOK_NAMES, REFRESH_PREAMBLE, JSX_AUTO_RE, JSXS_AUTO_RE, JSX_PROD_RE, FRAGMENT_RE, addJsxImport = (code) => {
|
|
202314
|
+
const imports = [];
|
|
202315
|
+
const jsxDevMatch = JSX_AUTO_RE.exec(code);
|
|
202316
|
+
if (jsxDevMatch) {
|
|
202317
|
+
imports.push(`import { jsxDEV as ${jsxDevMatch[1]} } from "react/jsx-dev-runtime";`);
|
|
202318
|
+
}
|
|
202319
|
+
const jsxsMatch = JSXS_AUTO_RE.exec(code);
|
|
202320
|
+
if (jsxsMatch && (!jsxDevMatch || jsxsMatch[1] !== jsxDevMatch[1])) {
|
|
202321
|
+
imports.push(`import { jsxs as ${jsxsMatch[1]} } from "react/jsx-runtime";`);
|
|
202322
|
+
}
|
|
202323
|
+
const jsxProdMatch = JSX_PROD_RE.exec(code);
|
|
202324
|
+
if (jsxProdMatch) {
|
|
202325
|
+
imports.push(`import { jsx as ${jsxProdMatch[1]} } from "react/jsx-runtime";`);
|
|
202326
|
+
}
|
|
202327
|
+
const fragmentMatch = FRAGMENT_RE.exec(code);
|
|
202328
|
+
if (fragmentMatch) {
|
|
202329
|
+
imports.push(`import { Fragment as ${fragmentMatch[1]} } from "react";`);
|
|
202330
|
+
}
|
|
202331
|
+
if (imports.length === 0)
|
|
202332
|
+
return code;
|
|
202333
|
+
return imports.join(`
|
|
202334
|
+
`) + `
|
|
202335
|
+
` + code;
|
|
202336
|
+
}, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
202337
|
+
const raw = readFileSync9(filePath, "utf-8");
|
|
202338
|
+
const valueExports = tsTranspiler2.scan(raw).exports;
|
|
202339
|
+
let transpiled = reactTranspiler.transformSync(raw);
|
|
202340
|
+
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
202341
|
+
transpiled = addJsxImport(transpiled);
|
|
202342
|
+
transpiled = transpiled.replace(/import\s*\{[^}]*\}\s*from\s*["']react-refresh\/runtime["'];?\n?/, "");
|
|
202343
|
+
transpiled = transpiled.replace(/\$RefreshReg\$_[a-z0-9]+/g, "$RefreshReg$");
|
|
202344
|
+
transpiled = transpiled.replace(/\$RefreshSig\$_[a-z0-9]+/g, "$RefreshSig$");
|
|
202345
|
+
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
202346
|
+
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
202347
|
+
` + transpiled;
|
|
202348
|
+
const relPath = relative7(projectRoot, filePath).replace(/\\/g, "/");
|
|
202349
|
+
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
202350
|
+
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
202351
|
+
}, transformPlainFile = (filePath, projectRoot, rewriter) => {
|
|
202352
|
+
const raw = readFileSync9(filePath, "utf-8");
|
|
202353
|
+
const ext = extname3(filePath);
|
|
202354
|
+
const isTS = ext === ".ts" || ext === ".tsx";
|
|
202355
|
+
const transpiler3 = isTS ? tsTranspiler2 : jsTranspiler2;
|
|
202356
|
+
const valueExports = isTS ? transpiler3.scan(raw).exports : [];
|
|
202357
|
+
let transpiled = transpiler3.transformSync(raw);
|
|
202358
|
+
if (isTS) {
|
|
202359
|
+
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
202360
|
+
}
|
|
202361
|
+
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
202362
|
+
}, handleCssRequest = (filePath) => {
|
|
202363
|
+
const raw = readFileSync9(filePath, "utf-8");
|
|
202364
|
+
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
202365
|
+
return [
|
|
202366
|
+
`const style = document.createElement('style');`,
|
|
202367
|
+
`style.textContent = \`${escaped}\`;`,
|
|
202368
|
+
`style.dataset.hmrId = ${JSON.stringify(filePath)};`,
|
|
202369
|
+
`const existing = document.querySelector(\`style[data-hmr-id="${filePath}"]\`);`,
|
|
202370
|
+
`if (existing) existing.remove();`,
|
|
202371
|
+
`document.head.appendChild(style);`
|
|
202372
|
+
].join(`
|
|
202373
|
+
`);
|
|
202374
|
+
}, createModuleServer = (config) => {
|
|
202375
|
+
const { projectRoot, vendorPaths } = config;
|
|
202376
|
+
const rewriter = buildImportRewriter(vendorPaths);
|
|
202377
|
+
return async (pathname) => {
|
|
202378
|
+
if (pathname.startsWith("/@stub/")) {
|
|
202379
|
+
const specifier = decodeURIComponent(pathname.slice("/@stub/".length));
|
|
202380
|
+
let stubCode = `export default {};
|
|
202381
|
+
`;
|
|
202382
|
+
try {
|
|
202383
|
+
const mod = await import(specifier);
|
|
202384
|
+
const names = Object.keys(mod).filter((k) => k !== "default" && k !== "__esModule");
|
|
202385
|
+
if (names.length > 0) {
|
|
202386
|
+
const noops = names.map((n) => `export const ${n} = () => {};`).join(`
|
|
202387
|
+
`);
|
|
202388
|
+
stubCode = `${noops}
|
|
202389
|
+
export default {};
|
|
202390
|
+
`;
|
|
202391
|
+
}
|
|
202392
|
+
} catch {}
|
|
202393
|
+
return new Response(stubCode, {
|
|
202394
|
+
headers: {
|
|
202395
|
+
"Cache-Control": "public, max-age=31536000, immutable",
|
|
202396
|
+
"Content-Type": "application/javascript"
|
|
202397
|
+
}
|
|
202398
|
+
});
|
|
202399
|
+
}
|
|
202400
|
+
if (!pathname.startsWith(SRC_PREFIX))
|
|
202401
|
+
return;
|
|
202402
|
+
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
202403
|
+
let filePath = resolve18(projectRoot, relPath);
|
|
202404
|
+
let ext = extname3(filePath);
|
|
202405
|
+
if (!ext) {
|
|
202406
|
+
const tryExts = [".tsx", ".ts", ".jsx", ".js"];
|
|
202407
|
+
for (const tryExt of tryExts) {
|
|
202408
|
+
try {
|
|
202409
|
+
statSync2(filePath + tryExt);
|
|
202410
|
+
filePath += tryExt;
|
|
202411
|
+
ext = tryExt;
|
|
202412
|
+
break;
|
|
202413
|
+
} catch {}
|
|
202414
|
+
}
|
|
202415
|
+
}
|
|
202416
|
+
try {
|
|
202417
|
+
if (ext === ".css") {
|
|
202418
|
+
return new Response(handleCssRequest(filePath), {
|
|
202419
|
+
headers: {
|
|
202420
|
+
"Cache-Control": "no-cache",
|
|
202421
|
+
"Content-Type": "application/javascript"
|
|
202422
|
+
}
|
|
202423
|
+
});
|
|
202424
|
+
}
|
|
202425
|
+
if (!TRANSPILABLE.has(ext))
|
|
202426
|
+
return;
|
|
202427
|
+
const cached = getTransformed(filePath);
|
|
202428
|
+
if (cached) {
|
|
202429
|
+
return new Response(cached, {
|
|
202430
|
+
headers: {
|
|
202431
|
+
"Cache-Control": "no-cache",
|
|
202432
|
+
"Content-Type": "application/javascript"
|
|
202433
|
+
}
|
|
202434
|
+
});
|
|
202435
|
+
}
|
|
202436
|
+
const stat2 = statSync2(filePath);
|
|
202437
|
+
let content;
|
|
202438
|
+
if (REACT_EXTENSIONS.has(ext)) {
|
|
202439
|
+
content = transformReactFile(filePath, projectRoot, rewriter);
|
|
202440
|
+
} else {
|
|
202441
|
+
content = transformPlainFile(filePath, projectRoot, rewriter);
|
|
202442
|
+
}
|
|
202443
|
+
setTransformed(filePath, content, stat2.mtimeMs);
|
|
202444
|
+
return new Response(content, {
|
|
202445
|
+
headers: {
|
|
202446
|
+
"Cache-Control": "no-cache",
|
|
202447
|
+
"Content-Type": "application/javascript"
|
|
202448
|
+
}
|
|
202449
|
+
});
|
|
202450
|
+
} catch (err) {
|
|
202451
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
202452
|
+
return new Response(`console.error('[ModuleServer] Transform error:', ${JSON.stringify(message)});`, {
|
|
202453
|
+
headers: { "Content-Type": "application/javascript" },
|
|
202454
|
+
status: 500
|
|
202455
|
+
});
|
|
202456
|
+
}
|
|
202457
|
+
};
|
|
202458
|
+
}, invalidateModule, warmCache = (pathname) => {
|
|
202459
|
+
if (!pathname.startsWith(SRC_PREFIX))
|
|
202460
|
+
return;
|
|
202461
|
+
if (!globalModuleServer)
|
|
202462
|
+
return;
|
|
202463
|
+
globalModuleServer(pathname);
|
|
202464
|
+
}, globalModuleServer = null, setGlobalModuleServer = (handler) => {
|
|
202465
|
+
globalModuleServer = handler;
|
|
202466
|
+
}, SRC_URL_PREFIX;
|
|
202467
|
+
var init_moduleServer = __esm(() => {
|
|
202468
|
+
init_transformCache();
|
|
202469
|
+
jsTranspiler2 = new Bun.Transpiler({
|
|
202470
|
+
loader: "js",
|
|
202471
|
+
trimUnusedImports: true
|
|
202472
|
+
});
|
|
202473
|
+
tsTranspiler2 = new Bun.Transpiler({
|
|
202474
|
+
loader: "tsx",
|
|
202475
|
+
trimUnusedImports: true
|
|
202476
|
+
});
|
|
202477
|
+
TRANSPILABLE = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs"]);
|
|
202478
|
+
ALL_EXPORTS_RE = /export\s+(?:type|interface|const|let|var|function|class|enum|abstract\s+class)\s+(\w+)/g;
|
|
202479
|
+
REACT_EXTENSIONS = new Set([".tsx", ".jsx"]);
|
|
202480
|
+
HOOK_NAMES = new Set([
|
|
202481
|
+
"useState",
|
|
202482
|
+
"useReducer",
|
|
202483
|
+
"useEffect",
|
|
202484
|
+
"useLayoutEffect",
|
|
202485
|
+
"useMemo",
|
|
202486
|
+
"useCallback",
|
|
202487
|
+
"useRef",
|
|
202488
|
+
"useContext",
|
|
202489
|
+
"useImperativeHandle",
|
|
202490
|
+
"useDebugValue",
|
|
202491
|
+
"useDeferredValue",
|
|
202492
|
+
"useTransition",
|
|
202493
|
+
"useId",
|
|
202494
|
+
"useSyncExternalStore",
|
|
202495
|
+
"useInsertionEffect",
|
|
202496
|
+
"useOptimistic",
|
|
202497
|
+
"useFormStatus",
|
|
202498
|
+
"useActionState"
|
|
202499
|
+
]);
|
|
202500
|
+
REFRESH_PREAMBLE = [
|
|
202501
|
+
"var $RefreshReg$ = window.$RefreshReg$ || function(){};",
|
|
202502
|
+
"var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };"
|
|
202503
|
+
].join(`
|
|
202504
|
+
`);
|
|
202505
|
+
JSX_AUTO_RE = /\b(jsxDEV_[a-z0-9]+)\b/;
|
|
202506
|
+
JSXS_AUTO_RE = /\b(jsxs_[a-z0-9]+)\b/;
|
|
202507
|
+
JSX_PROD_RE = /\b(jsx_[a-z0-9]+)\b/;
|
|
202508
|
+
FRAGMENT_RE = /\b(Fragment_[a-z0-9]+)\b/;
|
|
202509
|
+
reactTranspiler = new Bun.Transpiler({
|
|
202510
|
+
loader: "tsx",
|
|
202511
|
+
reactFastRefresh: true,
|
|
202512
|
+
trimUnusedImports: true
|
|
202513
|
+
});
|
|
202514
|
+
invalidateModule = invalidate;
|
|
202515
|
+
SRC_URL_PREFIX = SRC_PREFIX;
|
|
202516
|
+
});
|
|
202517
|
+
|
|
202104
202518
|
// src/dev/simpleHTMLHMR.ts
|
|
202105
202519
|
var exports_simpleHTMLHMR = {};
|
|
202106
202520
|
__export(exports_simpleHTMLHMR, {
|
|
202107
202521
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
202108
202522
|
});
|
|
202109
|
-
import { resolve as
|
|
202523
|
+
import { resolve as resolve19 } from "path";
|
|
202110
202524
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
202111
202525
|
let htmlContent;
|
|
202112
202526
|
try {
|
|
202113
|
-
const resolvedPath =
|
|
202527
|
+
const resolvedPath = resolve19(htmlFilePath);
|
|
202114
202528
|
const file4 = Bun.file(resolvedPath);
|
|
202115
202529
|
if (!await file4.exists()) {
|
|
202116
202530
|
return null;
|
|
@@ -202136,11 +202550,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
202136
202550
|
__export(exports_simpleHTMXHMR, {
|
|
202137
202551
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
202138
202552
|
});
|
|
202139
|
-
import { resolve as
|
|
202553
|
+
import { resolve as resolve20 } from "path";
|
|
202140
202554
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
202141
202555
|
let htmlContent;
|
|
202142
202556
|
try {
|
|
202143
|
-
const resolvedPath =
|
|
202557
|
+
const resolvedPath = resolve20(htmxFilePath);
|
|
202144
202558
|
const file4 = Bun.file(resolvedPath);
|
|
202145
202559
|
if (!await file4.exists()) {
|
|
202146
202560
|
return null;
|
|
@@ -202164,7 +202578,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
202164
202578
|
// src/dev/rebuildTrigger.ts
|
|
202165
202579
|
import { existsSync as existsSync13 } from "fs";
|
|
202166
202580
|
import { rm as rm6 } from "fs/promises";
|
|
202167
|
-
import { basename as basename7, relative as
|
|
202581
|
+
import { basename as basename7, relative as relative8, resolve as resolve21 } from "path";
|
|
202168
202582
|
var parseErrorLocationFromMessage = (msg) => {
|
|
202169
202583
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
202170
202584
|
if (pathLineCol) {
|
|
@@ -202236,7 +202650,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202236
202650
|
state.fileHashes.delete(filePathInSet);
|
|
202237
202651
|
try {
|
|
202238
202652
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
202239
|
-
const deletedPathResolved =
|
|
202653
|
+
const deletedPathResolved = resolve21(filePathInSet);
|
|
202240
202654
|
affectedFiles.forEach((affectedFile) => {
|
|
202241
202655
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
202242
202656
|
validFiles.push(affectedFile);
|
|
@@ -202280,7 +202694,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202280
202694
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
202281
202695
|
return;
|
|
202282
202696
|
}
|
|
202283
|
-
const normalizedFilePath =
|
|
202697
|
+
const normalizedFilePath = resolve21(filePathInSet);
|
|
202284
202698
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
202285
202699
|
validFiles.push(normalizedFilePath);
|
|
202286
202700
|
processedFiles.add(normalizedFilePath);
|
|
@@ -202371,7 +202785,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202371
202785
|
}
|
|
202372
202786
|
if (!graph)
|
|
202373
202787
|
return componentFile;
|
|
202374
|
-
const dependents = graph.dependents.get(
|
|
202788
|
+
const dependents = graph.dependents.get(resolve21(componentFile));
|
|
202375
202789
|
if (!dependents)
|
|
202376
202790
|
return componentFile;
|
|
202377
202791
|
for (const dep of dependents) {
|
|
@@ -202380,7 +202794,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202380
202794
|
}
|
|
202381
202795
|
return componentFile;
|
|
202382
202796
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
202383
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
202797
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve21(file4).startsWith(angularPagesPath));
|
|
202384
202798
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
202385
202799
|
return pageEntries;
|
|
202386
202800
|
}
|
|
@@ -202389,7 +202803,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202389
202803
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
202390
202804
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
202391
202805
|
affected.forEach((file4) => {
|
|
202392
|
-
if (file4.endsWith(".ts") &&
|
|
202806
|
+
if (file4.endsWith(".ts") && resolve21(file4).startsWith(angularPagesPath)) {
|
|
202393
202807
|
resolvedPages.add(file4);
|
|
202394
202808
|
}
|
|
202395
202809
|
});
|
|
@@ -202438,8 +202852,8 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202438
202852
|
return;
|
|
202439
202853
|
}
|
|
202440
202854
|
if (angVendorPaths) {
|
|
202441
|
-
const { rewriteImports:
|
|
202442
|
-
await
|
|
202855
|
+
const { rewriteImports: rewriteImports3 } = await Promise.resolve().then(() => exports_rewriteImports);
|
|
202856
|
+
await rewriteImports3(clientResult.outputs.map((artifact) => artifact.path), angVendorPaths);
|
|
202443
202857
|
}
|
|
202444
202858
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
202445
202859
|
Object.assign(state.manifest, clientManifest);
|
|
@@ -202470,7 +202884,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202470
202884
|
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true);
|
|
202471
202885
|
serverPaths.forEach((serverPath) => {
|
|
202472
202886
|
const fileBase = basename7(serverPath, ".js");
|
|
202473
|
-
state.manifest[toPascal(fileBase)] =
|
|
202887
|
+
state.manifest[toPascal(fileBase)] = resolve21(serverPath);
|
|
202474
202888
|
});
|
|
202475
202889
|
if (clientPaths.length > 0) {
|
|
202476
202890
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
@@ -202478,14 +202892,14 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202478
202892
|
}, handleAngularFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
202479
202893
|
const angularDir = config.angularDirectory ?? "";
|
|
202480
202894
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
202481
|
-
const angularPagesPath =
|
|
202895
|
+
const angularPagesPath = resolve21(angularDir, "pages");
|
|
202482
202896
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
202483
202897
|
if (pageEntries.length > 0) {
|
|
202484
202898
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
202485
202899
|
invalidateAngularSsrCache();
|
|
202486
202900
|
}
|
|
202487
202901
|
if (pageEntries.length > 0 && !config.options?.preserveIntermediateFiles) {
|
|
202488
|
-
await rm6(
|
|
202902
|
+
await rm6(resolve21(angularDir, "compiled"), {
|
|
202489
202903
|
force: true,
|
|
202490
202904
|
recursive: true
|
|
202491
202905
|
});
|
|
@@ -202499,7 +202913,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202499
202913
|
return manifest;
|
|
202500
202914
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
202501
202915
|
const pageName = basename7(normalized, ".tsx");
|
|
202502
|
-
const indexPath =
|
|
202916
|
+
const indexPath = resolve21(reactIndexesPath, `${pageName}.tsx`);
|
|
202503
202917
|
if (!existsSync13(indexPath)) {
|
|
202504
202918
|
return;
|
|
202505
202919
|
}
|
|
@@ -202511,13 +202925,13 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202511
202925
|
return;
|
|
202512
202926
|
}
|
|
202513
202927
|
const pageName = basename7(dep, ".tsx");
|
|
202514
|
-
const indexPath =
|
|
202928
|
+
const indexPath = resolve21(reactIndexesPath, `${pageName}.tsx`);
|
|
202515
202929
|
if (existsSync13(indexPath) && !reactEntries.includes(indexPath)) {
|
|
202516
202930
|
reactEntries.push(indexPath);
|
|
202517
202931
|
}
|
|
202518
202932
|
});
|
|
202519
202933
|
}, resolveReactEntryForFile = (state, file4, pagesPathResolved, reactIndexesPath, reactEntries) => {
|
|
202520
|
-
const normalized =
|
|
202934
|
+
const normalized = resolve21(file4);
|
|
202521
202935
|
if (!normalized.startsWith(pagesPathResolved)) {
|
|
202522
202936
|
resolveReactEntriesFromDeps(state, normalized, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
202523
202937
|
return;
|
|
@@ -202528,7 +202942,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202528
202942
|
}
|
|
202529
202943
|
}, collectReactEntries = (state, filesToRebuild, reactPagesPath, reactIndexesPath) => {
|
|
202530
202944
|
const reactEntries = [];
|
|
202531
|
-
const pagesPathResolved =
|
|
202945
|
+
const pagesPathResolved = resolve21(reactPagesPath);
|
|
202532
202946
|
filesToRebuild.forEach((file4) => {
|
|
202533
202947
|
resolveReactEntryForFile(state, file4, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
202534
202948
|
});
|
|
@@ -202539,7 +202953,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202539
202953
|
const { getDevVendorPaths: getDevVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
202540
202954
|
const { rewriteReactImports: rewriteReactImports2 } = await Promise.resolve().then(() => (init_rewriteReactImports(), exports_rewriteReactImports));
|
|
202541
202955
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
202542
|
-
const refreshEntry =
|
|
202956
|
+
const refreshEntry = resolve21(reactIndexesPath, "_refresh.tsx");
|
|
202543
202957
|
if (!reactEntries.includes(refreshEntry)) {
|
|
202544
202958
|
reactEntries.push(refreshEntry);
|
|
202545
202959
|
}
|
|
@@ -202551,7 +202965,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202551
202965
|
setDevVendorPaths2(vendorPaths);
|
|
202552
202966
|
}
|
|
202553
202967
|
const { rmSync: rmSync2 } = await import("fs");
|
|
202554
|
-
rmSync2(
|
|
202968
|
+
rmSync2(resolve21(buildDir, "react", "indexes"), {
|
|
202555
202969
|
force: true,
|
|
202556
202970
|
recursive: true
|
|
202557
202971
|
});
|
|
@@ -202577,11 +202991,51 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202577
202991
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
202578
202992
|
Object.assign(state.manifest, clientManifest);
|
|
202579
202993
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
202994
|
+
}, getReactModule = async (pageFile) => {
|
|
202995
|
+
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
202996
|
+
const { getTransformed: getTransformed2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
202997
|
+
invalidateModule2(pageFile);
|
|
202998
|
+
const rel = relative8(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
202999
|
+
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
203000
|
+
warmCache2(url);
|
|
203001
|
+
const code = getTransformed2(resolve21(pageFile));
|
|
203002
|
+
return { code, url };
|
|
202580
203003
|
}, handleReactFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
202581
203004
|
const reactDir = config.reactDirectory ?? "";
|
|
202582
|
-
const reactPagesPath =
|
|
202583
|
-
const reactIndexesPath =
|
|
203005
|
+
const reactPagesPath = resolve21(reactDir, "pages");
|
|
203006
|
+
const reactIndexesPath = resolve21(reactDir, "indexes");
|
|
202584
203007
|
const { buildDir } = state.resolvedPaths;
|
|
203008
|
+
const reactFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "react");
|
|
203009
|
+
if (reactFiles.length > 0) {
|
|
203010
|
+
const [changedFile] = reactFiles;
|
|
203011
|
+
if (changedFile) {
|
|
203012
|
+
const { code, url } = await getReactModule(changedFile);
|
|
203013
|
+
if (url) {
|
|
203014
|
+
const serverDuration = Date.now() - startTime;
|
|
203015
|
+
state.lastHmrPath = changedFile;
|
|
203016
|
+
state.lastHmrFramework = "react";
|
|
203017
|
+
broadcastToClients(state, {
|
|
203018
|
+
data: {
|
|
203019
|
+
code,
|
|
203020
|
+
framework: "react",
|
|
203021
|
+
hasComponentChanges: true,
|
|
203022
|
+
hasCSSChanges: false,
|
|
203023
|
+
manifest: state.manifest,
|
|
203024
|
+
pageModuleUrl: url,
|
|
203025
|
+
primarySource: changedFile,
|
|
203026
|
+
serverDuration,
|
|
203027
|
+
sourceFiles: reactFiles
|
|
203028
|
+
},
|
|
203029
|
+
type: "react-update"
|
|
203030
|
+
});
|
|
203031
|
+
onRebuildComplete({
|
|
203032
|
+
hmrState: state,
|
|
203033
|
+
manifest: state.manifest
|
|
203034
|
+
});
|
|
203035
|
+
return state.manifest;
|
|
203036
|
+
}
|
|
203037
|
+
}
|
|
203038
|
+
}
|
|
202585
203039
|
const { generateReactIndexFiles: generateReactIndexFiles2 } = await Promise.resolve().then(() => (init_generateReactIndexes(), exports_generateReactIndexes));
|
|
202586
203040
|
await generateReactIndexFiles2(reactPagesPath, reactIndexesPath, true);
|
|
202587
203041
|
const reactEntries = collectReactEntries(state, filesToRebuild, reactPagesPath, reactIndexesPath);
|
|
@@ -202591,7 +203045,6 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202591
203045
|
await rm6(reactIndexesPath, { force: true, recursive: true });
|
|
202592
203046
|
const { manifest } = state;
|
|
202593
203047
|
const duration = Date.now() - startTime;
|
|
202594
|
-
const reactFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "react");
|
|
202595
203048
|
const reactPageFiles = reactFiles.filter((file4) => file4.replace(/\\/g, "/").includes("/pages/"));
|
|
202596
203049
|
const sourceFiles = reactPageFiles.length > 0 ? reactPageFiles : reactFiles;
|
|
202597
203050
|
logHmrUpdate(sourceFiles[0] ?? reactFiles[0] ?? "", "react", duration);
|
|
@@ -202626,7 +203079,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202626
203079
|
}, handleSvelteFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
202627
203080
|
const svelteDir = config.svelteDirectory ?? "";
|
|
202628
203081
|
const { buildDir } = state.resolvedPaths;
|
|
202629
|
-
const svelteFiles = filesToRebuild.filter((file4) => file4.endsWith(".svelte") &&
|
|
203082
|
+
const svelteFiles = filesToRebuild.filter((file4) => file4.endsWith(".svelte") && resolve21(file4).startsWith(resolve21(svelteDir, "pages")));
|
|
202630
203083
|
if (svelteFiles.length > 0) {
|
|
202631
203084
|
const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
|
|
202632
203085
|
const { build: bunBuild5 } = await Promise.resolve(globalThis.Bun);
|
|
@@ -202634,8 +203087,8 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202634
203087
|
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true);
|
|
202635
203088
|
const serverEntries = [...svelteServerPaths];
|
|
202636
203089
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
202637
|
-
const serverRoot =
|
|
202638
|
-
const serverOutDir =
|
|
203090
|
+
const serverRoot = resolve21(svelteDir, "server");
|
|
203091
|
+
const serverOutDir = resolve21(buildDir, basename7(svelteDir));
|
|
202639
203092
|
const [serverResult, clientResult] = await Promise.all([
|
|
202640
203093
|
serverEntries.length > 0 ? bunBuild5({
|
|
202641
203094
|
entrypoints: serverEntries,
|
|
@@ -202661,15 +203114,15 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202661
203114
|
await handleClientManifestUpdate(state, clientResult, buildDir);
|
|
202662
203115
|
}
|
|
202663
203116
|
await Promise.all([
|
|
202664
|
-
rm6(
|
|
203117
|
+
rm6(resolve21(svelteDir, "client"), {
|
|
202665
203118
|
force: true,
|
|
202666
203119
|
recursive: true
|
|
202667
203120
|
}),
|
|
202668
|
-
rm6(
|
|
203121
|
+
rm6(resolve21(svelteDir, "indexes"), {
|
|
202669
203122
|
force: true,
|
|
202670
203123
|
recursive: true
|
|
202671
203124
|
}),
|
|
202672
|
-
rm6(
|
|
203125
|
+
rm6(resolve21(svelteDir, "server"), {
|
|
202673
203126
|
force: true,
|
|
202674
203127
|
recursive: true
|
|
202675
203128
|
})
|
|
@@ -202702,7 +203155,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202702
203155
|
}, handleVueFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
202703
203156
|
const vueDir = config.vueDirectory ?? "";
|
|
202704
203157
|
const { buildDir } = state.resolvedPaths;
|
|
202705
|
-
const vueFiles = filesToRebuild.filter((file4) => file4.endsWith(".vue") &&
|
|
203158
|
+
const vueFiles = filesToRebuild.filter((file4) => file4.endsWith(".vue") && resolve21(file4).startsWith(resolve21(vueDir, "pages")));
|
|
202706
203159
|
if (vueFiles.length > 0) {
|
|
202707
203160
|
const { compileVue: compileVue2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
202708
203161
|
const { build: bunBuild5 } = await Promise.resolve(globalThis.Bun);
|
|
@@ -202710,8 +203163,8 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202710
203163
|
const { vueServerPaths, vueIndexPaths, vueClientPaths } = await compileVue2(vueFiles, vueDir, true);
|
|
202711
203164
|
const serverEntries = [...vueServerPaths];
|
|
202712
203165
|
const clientEntries = [...vueIndexPaths, ...vueClientPaths];
|
|
202713
|
-
const serverRoot =
|
|
202714
|
-
const serverOutDir =
|
|
203166
|
+
const serverRoot = resolve21(vueDir, "server");
|
|
203167
|
+
const serverOutDir = resolve21(buildDir, basename7(vueDir));
|
|
202715
203168
|
const vueFeatureFlags2 = {
|
|
202716
203169
|
__VUE_OPTIONS_API__: "true",
|
|
202717
203170
|
__VUE_PROD_DEVTOOLS__: "true",
|
|
@@ -202743,19 +203196,19 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202743
203196
|
await handleClientManifestUpdate(state, clientResult, buildDir);
|
|
202744
203197
|
}
|
|
202745
203198
|
await Promise.all([
|
|
202746
|
-
rm6(
|
|
203199
|
+
rm6(resolve21(vueDir, "client"), {
|
|
202747
203200
|
force: true,
|
|
202748
203201
|
recursive: true
|
|
202749
203202
|
}),
|
|
202750
|
-
rm6(
|
|
203203
|
+
rm6(resolve21(vueDir, "indexes"), {
|
|
202751
203204
|
force: true,
|
|
202752
203205
|
recursive: true
|
|
202753
203206
|
}),
|
|
202754
|
-
rm6(
|
|
203207
|
+
rm6(resolve21(vueDir, "server"), {
|
|
202755
203208
|
force: true,
|
|
202756
203209
|
recursive: true
|
|
202757
203210
|
}),
|
|
202758
|
-
rm6(
|
|
203211
|
+
rm6(resolve21(vueDir, "compiled"), {
|
|
202759
203212
|
force: true,
|
|
202760
203213
|
recursive: true
|
|
202761
203214
|
})
|
|
@@ -202770,7 +203223,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202770
203223
|
const cssKey = `${pascalName}CSS`;
|
|
202771
203224
|
const cssUrl = manifest[cssKey] || null;
|
|
202772
203225
|
const vueRoot = config.vueDirectory;
|
|
202773
|
-
const hmrId = vueRoot ?
|
|
203226
|
+
const hmrId = vueRoot ? relative8(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
202774
203227
|
logHmrUpdate(vuePagePath, "vue", duration);
|
|
202775
203228
|
broadcastToClients(state, {
|
|
202776
203229
|
data: {
|
|
@@ -202875,10 +203328,10 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202875
203328
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
202876
203329
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
202877
203330
|
if (isSingle) {
|
|
202878
|
-
return
|
|
203331
|
+
return resolve21(state.resolvedPaths.buildDir, "pages");
|
|
202879
203332
|
}
|
|
202880
203333
|
const dirName = framework === "html" ? basename7(config.htmlDirectory ?? "html") : basename7(config.htmxDirectory ?? "htmx");
|
|
202881
|
-
return
|
|
203334
|
+
return resolve21(state.resolvedPaths.buildDir, dirName, "pages");
|
|
202882
203335
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
202883
203336
|
try {
|
|
202884
203337
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -202914,7 +203367,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202914
203367
|
const outputHtmlPages = computeOutputPagesDir(state, config, "html");
|
|
202915
203368
|
for (const pageFile of htmlPageFiles) {
|
|
202916
203369
|
const htmlPageName = basename7(pageFile);
|
|
202917
|
-
const builtHtmlPagePath =
|
|
203370
|
+
const builtHtmlPagePath = resolve21(outputHtmlPages, htmlPageName);
|
|
202918
203371
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
202919
203372
|
}
|
|
202920
203373
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -202975,11 +203428,11 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
202975
203428
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
202976
203429
|
const pascalName = toPascal(baseName);
|
|
202977
203430
|
const vueRoot = config.vueDirectory;
|
|
202978
|
-
const hmrId = vueRoot ?
|
|
203431
|
+
const hmrId = vueRoot ? relative8(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
202979
203432
|
const cssKey = `${pascalName}CSS`;
|
|
202980
203433
|
const cssUrl = manifest[cssKey] || null;
|
|
202981
203434
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
202982
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
203435
|
+
const hmrMeta = vueHmrMetadata2.get(resolve21(vuePagePath));
|
|
202983
203436
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
202984
203437
|
if (changeType === "style-only") {
|
|
202985
203438
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -203213,7 +203666,7 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
203213
203666
|
const outputHtmxPages = computeOutputPagesDir(state, config, "htmx");
|
|
203214
203667
|
for (const htmxPageFile of htmxPageFiles) {
|
|
203215
203668
|
const htmxPageName = basename7(htmxPageFile);
|
|
203216
|
-
const builtHtmxPagePath =
|
|
203669
|
+
const builtHtmxPagePath = resolve21(outputHtmxPages, htmxPageName);
|
|
203217
203670
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
203218
203671
|
}
|
|
203219
203672
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -203359,13 +203812,13 @@ var parseErrorLocationFromMessage = (msg) => {
|
|
|
203359
203812
|
if (state.fileChangeQueue.size === 0) {
|
|
203360
203813
|
return;
|
|
203361
203814
|
}
|
|
203362
|
-
const
|
|
203815
|
+
const pending2 = Array.from(state.fileChangeQueue.keys());
|
|
203363
203816
|
const queuedFiles = [];
|
|
203364
203817
|
state.fileChangeQueue.forEach((filePaths) => {
|
|
203365
203818
|
queuedFiles.push(...filePaths);
|
|
203366
203819
|
});
|
|
203367
203820
|
state.fileChangeQueue.clear();
|
|
203368
|
-
|
|
203821
|
+
pending2.forEach((file4) => state.rebuildQueue.add(file4));
|
|
203369
203822
|
if (state.rebuildTimeout)
|
|
203370
203823
|
clearTimeout(state.rebuildTimeout);
|
|
203371
203824
|
state.rebuildTimeout = setTimeout(() => {
|
|
@@ -203425,14 +203878,155 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
203425
203878
|
init_pageHandler();
|
|
203426
203879
|
});
|
|
203427
203880
|
|
|
203881
|
+
// src/build/buildDepVendor.ts
|
|
203882
|
+
var exports_buildDepVendor = {};
|
|
203883
|
+
__export(exports_buildDepVendor, {
|
|
203884
|
+
computeDepVendorPaths: () => computeDepVendorPaths,
|
|
203885
|
+
buildDepVendor: () => buildDepVendor
|
|
203886
|
+
});
|
|
203887
|
+
import { mkdirSync as mkdirSync7 } from "fs";
|
|
203888
|
+
import { join as join14 } from "path";
|
|
203889
|
+
import { rm as rm7 } from "fs/promises";
|
|
203890
|
+
var {build: bunBuild5, Glob: Glob6 } = globalThis.Bun;
|
|
203891
|
+
var toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_"), isResolvable2 = (specifier) => {
|
|
203892
|
+
try {
|
|
203893
|
+
__require.resolve(specifier);
|
|
203894
|
+
return true;
|
|
203895
|
+
} catch {
|
|
203896
|
+
return false;
|
|
203897
|
+
}
|
|
203898
|
+
}, isBareSpecifier = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), FRAMEWORK_SPECIFIERS, scanBareImports = async (directories) => {
|
|
203899
|
+
const specifiers = new Set;
|
|
203900
|
+
const transpiler3 = new Bun.Transpiler({ loader: "tsx" });
|
|
203901
|
+
for (const dir of directories) {
|
|
203902
|
+
const glob = new Glob6("**/*.{ts,tsx,js,jsx}");
|
|
203903
|
+
try {
|
|
203904
|
+
for await (const file4 of glob.scan({
|
|
203905
|
+
absolute: true,
|
|
203906
|
+
cwd: dir
|
|
203907
|
+
})) {
|
|
203908
|
+
if (file4.includes("node_modules"))
|
|
203909
|
+
continue;
|
|
203910
|
+
if (file4.includes("/build/"))
|
|
203911
|
+
continue;
|
|
203912
|
+
if (file4.includes("/dist/"))
|
|
203913
|
+
continue;
|
|
203914
|
+
if (file4.includes("/indexes/"))
|
|
203915
|
+
continue;
|
|
203916
|
+
try {
|
|
203917
|
+
const content = await Bun.file(file4).text();
|
|
203918
|
+
const imports = transpiler3.scanImports(content);
|
|
203919
|
+
for (const imp of imports) {
|
|
203920
|
+
if (isBareSpecifier(imp.path) && !FRAMEWORK_SPECIFIERS.has(imp.path)) {
|
|
203921
|
+
specifiers.add(imp.path);
|
|
203922
|
+
}
|
|
203923
|
+
}
|
|
203924
|
+
} catch {}
|
|
203925
|
+
}
|
|
203926
|
+
} catch {}
|
|
203927
|
+
}
|
|
203928
|
+
return Array.from(specifiers).filter(isResolvable2);
|
|
203929
|
+
}, generateEntrySource2 = (specifier) => `export * from '${specifier}';
|
|
203930
|
+
`, computeDepVendorPaths = async (directories) => {
|
|
203931
|
+
const specifiers = await scanBareImports(directories);
|
|
203932
|
+
const paths = {};
|
|
203933
|
+
for (const specifier of specifiers) {
|
|
203934
|
+
paths[specifier] = `/vendor/${toSafeFileName3(specifier)}.js`;
|
|
203935
|
+
}
|
|
203936
|
+
return paths;
|
|
203937
|
+
}, buildDepVendor = async (buildDir, directories) => {
|
|
203938
|
+
const specifiers = await scanBareImports(directories);
|
|
203939
|
+
if (specifiers.length === 0)
|
|
203940
|
+
return {};
|
|
203941
|
+
const vendorDir = join14(buildDir, "vendor");
|
|
203942
|
+
mkdirSync7(vendorDir, { recursive: true });
|
|
203943
|
+
const tmpDir = join14(buildDir, "_dep_vendor_tmp");
|
|
203944
|
+
mkdirSync7(tmpDir, { recursive: true });
|
|
203945
|
+
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
203946
|
+
const safeName = toSafeFileName3(specifier);
|
|
203947
|
+
const entryPath = join14(tmpDir, `${safeName}.ts`);
|
|
203948
|
+
const source = await generateEntrySource2(specifier);
|
|
203949
|
+
await Bun.write(entryPath, source);
|
|
203950
|
+
return entryPath;
|
|
203951
|
+
}));
|
|
203952
|
+
const result = await bunBuild5({
|
|
203953
|
+
entrypoints,
|
|
203954
|
+
external: [...FRAMEWORK_SPECIFIERS],
|
|
203955
|
+
format: "esm",
|
|
203956
|
+
minify: false,
|
|
203957
|
+
naming: "[name].[ext]",
|
|
203958
|
+
outdir: vendorDir,
|
|
203959
|
+
splitting: true,
|
|
203960
|
+
target: "browser",
|
|
203961
|
+
throw: false
|
|
203962
|
+
});
|
|
203963
|
+
await rm7(tmpDir, { force: true, recursive: true });
|
|
203964
|
+
if (result.success) {
|
|
203965
|
+
const { readdirSync: readdirSync2, readFileSync: readFileSync10, writeFileSync: writeFileSync5 } = await import("fs");
|
|
203966
|
+
const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
|
|
203967
|
+
const reactPaths = computeVendorPaths2();
|
|
203968
|
+
const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
203969
|
+
for (const file4 of files) {
|
|
203970
|
+
const filePath = join14(vendorDir, file4);
|
|
203971
|
+
let content = readFileSync10(filePath, "utf-8");
|
|
203972
|
+
let changed = false;
|
|
203973
|
+
for (const [specifier, webPath] of Object.entries(reactPaths)) {
|
|
203974
|
+
const escaped = specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
203975
|
+
const re = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
|
|
203976
|
+
const newContent = content.replace(re, `$1${webPath}$2`);
|
|
203977
|
+
if (newContent !== content) {
|
|
203978
|
+
content = newContent;
|
|
203979
|
+
changed = true;
|
|
203980
|
+
}
|
|
203981
|
+
}
|
|
203982
|
+
if (changed) {
|
|
203983
|
+
writeFileSync5(filePath, content);
|
|
203984
|
+
}
|
|
203985
|
+
}
|
|
203986
|
+
}
|
|
203987
|
+
if (!result.success) {
|
|
203988
|
+
console.warn("\u26A0\uFE0F Dependency vendor build had errors:", result.logs);
|
|
203989
|
+
}
|
|
203990
|
+
const paths = {};
|
|
203991
|
+
for (const specifier of specifiers) {
|
|
203992
|
+
paths[specifier] = `/vendor/${toSafeFileName3(specifier)}.js`;
|
|
203993
|
+
}
|
|
203994
|
+
return paths;
|
|
203995
|
+
};
|
|
203996
|
+
var init_buildDepVendor = __esm(() => {
|
|
203997
|
+
FRAMEWORK_SPECIFIERS = new Set([
|
|
203998
|
+
"react",
|
|
203999
|
+
"react-dom",
|
|
204000
|
+
"react-dom/client",
|
|
204001
|
+
"react-dom/server",
|
|
204002
|
+
"react/jsx-runtime",
|
|
204003
|
+
"react/jsx-dev-runtime",
|
|
204004
|
+
"react-refresh/runtime",
|
|
204005
|
+
"svelte",
|
|
204006
|
+
"svelte/internal",
|
|
204007
|
+
"svelte/internal/client",
|
|
204008
|
+
"svelte/server",
|
|
204009
|
+
"svelte/compiler",
|
|
204010
|
+
"vue",
|
|
204011
|
+
"vue/server-renderer",
|
|
204012
|
+
"@vue/compiler-sfc",
|
|
204013
|
+
"@angular/core",
|
|
204014
|
+
"@angular/common",
|
|
204015
|
+
"@angular/compiler",
|
|
204016
|
+
"@angular/platform-browser",
|
|
204017
|
+
"@angular/platform-server",
|
|
204018
|
+
"@angular/ssr"
|
|
204019
|
+
]);
|
|
204020
|
+
});
|
|
204021
|
+
|
|
203428
204022
|
// src/core/devBuild.ts
|
|
203429
204023
|
var exports_devBuild = {};
|
|
203430
204024
|
__export(exports_devBuild, {
|
|
203431
204025
|
devBuild: () => devBuild
|
|
203432
204026
|
});
|
|
203433
204027
|
import { readdir as readdir3 } from "fs/promises";
|
|
203434
|
-
import { statSync } from "fs";
|
|
203435
|
-
import { resolve as
|
|
204028
|
+
import { statSync as statSync3 } from "fs";
|
|
204029
|
+
import { resolve as resolve22 } from "path";
|
|
203436
204030
|
var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
203437
204031
|
const config = {};
|
|
203438
204032
|
const dirPattern = /(\w+Directory)\s*:\s*['"]([^'"]+)['"]/g;
|
|
@@ -203445,7 +204039,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
203445
204039
|
return Object.keys(config).length > 0 ? config : null;
|
|
203446
204040
|
}, reloadConfig = async () => {
|
|
203447
204041
|
try {
|
|
203448
|
-
const configPath2 =
|
|
204042
|
+
const configPath2 = resolve22(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
203449
204043
|
const source = await Bun.file(configPath2).text();
|
|
203450
204044
|
return parseDirectoryConfig(source);
|
|
203451
204045
|
} catch {
|
|
@@ -203518,7 +204112,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
203518
204112
|
state.fileChangeQueue.clear();
|
|
203519
204113
|
}
|
|
203520
204114
|
}, handleCachedReload = async () => {
|
|
203521
|
-
const serverMtime =
|
|
204115
|
+
const serverMtime = statSync3(resolve22(Bun.main)).mtimeMs;
|
|
203522
204116
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
203523
204117
|
globalThis.__hmrServerMtime = serverMtime;
|
|
203524
204118
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -203546,8 +204140,8 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
203546
204140
|
return true;
|
|
203547
204141
|
}, resolveAbsoluteVersion2 = async () => {
|
|
203548
204142
|
const candidates = [
|
|
203549
|
-
|
|
203550
|
-
|
|
204143
|
+
resolve22(import.meta.dir, "..", "..", "package.json"),
|
|
204144
|
+
resolve22(import.meta.dir, "..", "package.json")
|
|
203551
204145
|
];
|
|
203552
204146
|
for (const candidate of candidates) {
|
|
203553
204147
|
const found = await tryReadPackageVersion(candidate);
|
|
@@ -203560,7 +204154,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
203560
204154
|
const entries = await readdir3(vendorDir).catch(() => emptyStringArray);
|
|
203561
204155
|
await Promise.all(entries.map(async (entry) => {
|
|
203562
204156
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
203563
|
-
const bytes = await Bun.file(
|
|
204157
|
+
const bytes = await Bun.file(resolve22(vendorDir, entry)).bytes();
|
|
203564
204158
|
assetStore.set(webPath, bytes);
|
|
203565
204159
|
}));
|
|
203566
204160
|
}, devBuild = async (config) => {
|
|
@@ -203594,7 +204188,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
203594
204188
|
await populateAssetStore(state.assetStore, manifest ?? {}, state.resolvedPaths.buildDir);
|
|
203595
204189
|
cleanStaleAssets(state.assetStore, manifest ?? {}, state.resolvedPaths.buildDir);
|
|
203596
204190
|
const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
203597
|
-
const vendorDir =
|
|
204191
|
+
const vendorDir = resolve22(state.resolvedPaths.buildDir, "react", "vendor");
|
|
203598
204192
|
await loadVendorFiles(state.assetStore, vendorDir, "react");
|
|
203599
204193
|
if (!globalThis.__reactModuleRef) {
|
|
203600
204194
|
globalThis.__reactModuleRef = await import("react");
|
|
@@ -203602,11 +204196,30 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
203602
204196
|
return true;
|
|
203603
204197
|
}) : undefined;
|
|
203604
204198
|
const buildAngularVendorTask = config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
203605
|
-
const vendorDir =
|
|
204199
|
+
const vendorDir = resolve22(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
203606
204200
|
await loadVendorFiles(state.assetStore, vendorDir, "angular");
|
|
203607
204201
|
return true;
|
|
203608
204202
|
}) : undefined;
|
|
203609
|
-
await Promise.
|
|
204203
|
+
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
204204
|
+
const sourceDirs = [
|
|
204205
|
+
config.reactDirectory,
|
|
204206
|
+
config.svelteDirectory,
|
|
204207
|
+
config.vueDirectory,
|
|
204208
|
+
config.angularDirectory,
|
|
204209
|
+
config.htmlDirectory,
|
|
204210
|
+
config.htmxDirectory
|
|
204211
|
+
].filter((dir) => Boolean(dir));
|
|
204212
|
+
const buildDepVendorTask = buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs).then(async (depPaths) => {
|
|
204213
|
+
const vendorDir = resolve22(state.resolvedPaths.buildDir, "vendor");
|
|
204214
|
+
await loadVendorFiles(state.assetStore, vendorDir, "vendor");
|
|
204215
|
+
globalThis.__depVendorPaths = depPaths;
|
|
204216
|
+
return true;
|
|
204217
|
+
});
|
|
204218
|
+
await Promise.all([
|
|
204219
|
+
buildReactVendorTask,
|
|
204220
|
+
buildAngularVendorTask,
|
|
204221
|
+
buildDepVendorTask
|
|
204222
|
+
]);
|
|
203610
204223
|
state.manifest = manifest;
|
|
203611
204224
|
startFileWatching(state, config, (filePath) => {
|
|
203612
204225
|
queueFileChange(state, filePath, config, (newBuildResult) => {
|
|
@@ -203620,7 +204233,7 @@ var FRAMEWORK_DIR_KEYS, parseDirectoryConfig = (source) => {
|
|
|
203620
204233
|
manifest
|
|
203621
204234
|
};
|
|
203622
204235
|
globalThis.__hmrDevResult = result;
|
|
203623
|
-
globalThis.__hmrServerMtime =
|
|
204236
|
+
globalThis.__hmrServerMtime = statSync3(resolve22(Bun.main)).mtimeMs;
|
|
203624
204237
|
return result;
|
|
203625
204238
|
};
|
|
203626
204239
|
var init_devBuild = __esm(() => {
|
|
@@ -203700,7 +204313,7 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
|
|
|
203700
204313
|
});
|
|
203701
204314
|
}
|
|
203702
204315
|
Reflect.set(globalThis, STORE_KEY, app.store);
|
|
203703
|
-
}, hmr = (hmrState2, manifest) => (app) => {
|
|
204316
|
+
}, hmr = (hmrState2, manifest, moduleServerHandler) => (app) => {
|
|
203704
204317
|
restoreStore(app);
|
|
203705
204318
|
return app.onBeforeHandle(async ({ request }) => {
|
|
203706
204319
|
if (globalThis.__reactModuleRef) {
|
|
@@ -203711,6 +204324,11 @@ var STORE_KEY = "__elysiaStore", getGlobalValue = (key) => Reflect.get(globalThi
|
|
|
203711
204324
|
const pathEnd = qIdx === UNFOUND_INDEX ? rawUrl.length : qIdx;
|
|
203712
204325
|
const pathStart = rawUrl.indexOf("/", rawUrl.indexOf("//") + 2);
|
|
203713
204326
|
const pathname = rawUrl.slice(pathStart, pathEnd);
|
|
204327
|
+
if (moduleServerHandler) {
|
|
204328
|
+
const moduleResponse = await moduleServerHandler(pathname);
|
|
204329
|
+
if (moduleResponse)
|
|
204330
|
+
return moduleResponse;
|
|
204331
|
+
}
|
|
203714
204332
|
const bytes = lookupAsset(hmrState2.assetStore, pathname);
|
|
203715
204333
|
if (!bytes) {
|
|
203716
204334
|
return;
|
|
@@ -203763,9 +204381,44 @@ var asset = (source, name) => {
|
|
|
203763
204381
|
var {file } = globalThis.Bun;
|
|
203764
204382
|
|
|
203765
204383
|
// src/react/pageHandler.ts
|
|
204384
|
+
var isDev = process.env["NODE_ENV"] === "development";
|
|
204385
|
+
var findComponentPath = (component) => {
|
|
204386
|
+
const name = component.displayName ?? component.name;
|
|
204387
|
+
if (!name)
|
|
204388
|
+
return null;
|
|
204389
|
+
const config = globalThis.__hmrDevResult?.hmrState?.config;
|
|
204390
|
+
const reactDir = config?.reactDirectory;
|
|
204391
|
+
if (!reactDir)
|
|
204392
|
+
return null;
|
|
204393
|
+
const { resolve: resolve2, join } = __require("path");
|
|
204394
|
+
const { existsSync } = __require("fs");
|
|
204395
|
+
const pagesDir = resolve2(reactDir, "pages");
|
|
204396
|
+
for (const ext of [".tsx", ".jsx", ".ts"]) {
|
|
204397
|
+
const candidate = join(pagesDir, `${name}${ext}`);
|
|
204398
|
+
if (existsSync(candidate))
|
|
204399
|
+
return candidate;
|
|
204400
|
+
}
|
|
204401
|
+
return null;
|
|
204402
|
+
};
|
|
203766
204403
|
var handleReactPageRequest = async (PageComponent, index, ...props) => {
|
|
203767
204404
|
try {
|
|
203768
204405
|
const [maybeProps] = props;
|
|
204406
|
+
if (isDev) {
|
|
204407
|
+
const componentPath = findComponentPath(PageComponent);
|
|
204408
|
+
if (componentPath) {
|
|
204409
|
+
try {
|
|
204410
|
+
const { renderInWorker: renderInWorker2 } = await Promise.resolve().then(() => (init_ssrRenderer(), exports_ssrRenderer));
|
|
204411
|
+
const html = await renderInWorker2({
|
|
204412
|
+
componentPath,
|
|
204413
|
+
indexPath: index,
|
|
204414
|
+
props: maybeProps
|
|
204415
|
+
});
|
|
204416
|
+
return new Response(html, {
|
|
204417
|
+
headers: { "Content-Type": "text/html" }
|
|
204418
|
+
});
|
|
204419
|
+
} catch {}
|
|
204420
|
+
}
|
|
204421
|
+
}
|
|
203769
204422
|
const { createElement } = await import("react");
|
|
203770
204423
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
203771
204424
|
const element = maybeProps !== undefined ? createElement(PageComponent, maybeProps) : createElement(PageComponent);
|
|
@@ -203793,13 +204446,13 @@ var handleReactPageRequest = async (PageComponent, index, ...props) => {
|
|
|
203793
204446
|
var handleHTMLPageRequest = (pagePath) => file(pagePath);
|
|
203794
204447
|
var handleHTMXPageRequest = (pagePath) => file(pagePath);
|
|
203795
204448
|
// src/core/prepare.ts
|
|
203796
|
-
import { readFileSync as
|
|
203797
|
-
import { resolve as
|
|
204449
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
204450
|
+
import { relative as relative9, resolve as resolve23 } from "path";
|
|
203798
204451
|
|
|
203799
204452
|
// src/utils/loadConfig.ts
|
|
203800
|
-
import { resolve } from "path";
|
|
204453
|
+
import { resolve as resolve2 } from "path";
|
|
203801
204454
|
var loadConfig = async (configPath) => {
|
|
203802
|
-
const resolved =
|
|
204455
|
+
const resolved = resolve2(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
203803
204456
|
const mod = await import(resolved);
|
|
203804
204457
|
const config = mod.default ?? mod.config;
|
|
203805
204458
|
if (!config) {
|
|
@@ -203813,20 +204466,44 @@ Expected: export default defineConfig({ ... })`);
|
|
|
203813
204466
|
var prepare = async (configOrPath) => {
|
|
203814
204467
|
const config = await loadConfig(configOrPath);
|
|
203815
204468
|
const nodeEnv = process.env["NODE_ENV"];
|
|
203816
|
-
const
|
|
203817
|
-
const buildDir =
|
|
203818
|
-
if (
|
|
204469
|
+
const isDev3 = nodeEnv === "development";
|
|
204470
|
+
const buildDir = resolve23(isDev3 ? config.buildDirectory ?? "build" : process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
204471
|
+
if (isDev3) {
|
|
203819
204472
|
const { devBuild: devBuild2 } = await Promise.resolve().then(() => (init_devBuild(), exports_devBuild));
|
|
203820
204473
|
const result = await devBuild2(config);
|
|
203821
204474
|
const { hmr: hmr2 } = await Promise.resolve().then(() => (init_hmr(), exports_hmr));
|
|
203822
204475
|
const { staticPlugin: staticPlugin2 } = await import("@elysiajs/static");
|
|
203823
|
-
const
|
|
204476
|
+
const { createModuleServer: createModuleServer2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
204477
|
+
const { getDevVendorPaths: getDevVendorPaths2, getAngularVendorPaths: getAngularVendorPaths2 } = await Promise.resolve().then(() => exports_devVendorPaths);
|
|
204478
|
+
const depVendorPaths = globalThis.__depVendorPaths ?? {};
|
|
204479
|
+
const allVendorPaths = {
|
|
204480
|
+
...getDevVendorPaths2() ?? {},
|
|
204481
|
+
...getAngularVendorPaths2() ?? {},
|
|
204482
|
+
...depVendorPaths
|
|
204483
|
+
};
|
|
204484
|
+
const { setGlobalModuleServer: setGlobalModuleServer2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
204485
|
+
const moduleHandler = createModuleServer2({
|
|
204486
|
+
projectRoot: process.cwd(),
|
|
204487
|
+
vendorPaths: allVendorPaths
|
|
204488
|
+
});
|
|
204489
|
+
setGlobalModuleServer2(moduleHandler);
|
|
204490
|
+
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
204491
|
+
const { SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
204492
|
+
const devIndexDir = resolve23(buildDir, "_src_indexes");
|
|
204493
|
+
for (const key of Object.keys(result.manifest)) {
|
|
204494
|
+
if (key.endsWith("Index") && typeof result.manifest[key] === "string" && result.manifest[key].includes("/indexes/")) {
|
|
204495
|
+
const fileName = key.replace(/Index$/, "") + ".tsx";
|
|
204496
|
+
const srcPath = resolve23(devIndexDir, fileName);
|
|
204497
|
+
const rel = relative9(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
204498
|
+
result.manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
204499
|
+
}
|
|
204500
|
+
}
|
|
203824
204501
|
return {
|
|
203825
204502
|
manifest: result.manifest,
|
|
203826
204503
|
absolutejs: (app) => hmrPlugin(app.use(staticPlugin2({ assets: buildDir, prefix: "" })))
|
|
203827
204504
|
};
|
|
203828
204505
|
}
|
|
203829
|
-
const manifest = JSON.parse(
|
|
204506
|
+
const manifest = JSON.parse(readFileSync10(`${buildDir}/manifest.json`, "utf-8"));
|
|
203830
204507
|
const { staticPlugin } = await import("@elysiajs/static");
|
|
203831
204508
|
const absolutejs = staticPlugin({ assets: buildDir, prefix: "" });
|
|
203832
204509
|
return { absolutejs, manifest };
|
|
@@ -203987,5 +204664,5 @@ export {
|
|
|
203987
204664
|
ANGULAR_INIT_TIMEOUT_MS
|
|
203988
204665
|
};
|
|
203989
204666
|
|
|
203990
|
-
//# debugId=
|
|
204667
|
+
//# debugId=2F1F7365135EB02E64756E2164756E21
|
|
203991
204668
|
//# sourceMappingURL=index.js.map
|