@absolutejs/absolute 0.19.0-beta.106 → 0.19.0-beta.108
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/dist/build.js +67 -77
- package/dist/build.js.map +5 -5
- package/dist/dev/client/reactRefreshSetup.ts +14 -0
- package/dist/index.js +73 -82
- package/dist/index.js.map +6 -6
- package/dist/react/index.js +4 -3
- package/dist/react/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -18,4 +18,18 @@ if (!window.$RefreshRuntime$) {
|
|
|
18
18
|
RefreshRuntime.register(type, id);
|
|
19
19
|
window.$RefreshSig$ = () =>
|
|
20
20
|
RefreshRuntime.createSignatureFunctionForTransform();
|
|
21
|
+
|
|
22
|
+
// Replay buffered registrations from the bootstrap script.
|
|
23
|
+
// The SSR HTML injects a buffering $RefreshReg$ that captures
|
|
24
|
+
// registrations before the runtime is ready.
|
|
25
|
+
const buffer = (window as unknown as Record<string, unknown>)
|
|
26
|
+
.__REFRESH_BUFFER__ as Array<[unknown, string]> | undefined;
|
|
27
|
+
if (buffer) {
|
|
28
|
+
for (const [type, id] of buffer) {
|
|
29
|
+
RefreshRuntime.register(type, id);
|
|
30
|
+
}
|
|
31
|
+
(
|
|
32
|
+
window as unknown as Record<string, unknown>
|
|
33
|
+
).__REFRESH_BUFFER__ = undefined;
|
|
34
|
+
}
|
|
21
35
|
}
|
package/dist/index.js
CHANGED
|
@@ -202,7 +202,7 @@ __export(exports_generateReactIndexes, {
|
|
|
202
202
|
});
|
|
203
203
|
import { existsSync, mkdirSync } from "fs";
|
|
204
204
|
import { readdir, rm, writeFile } from "fs/promises";
|
|
205
|
-
import { basename, join, resolve as resolve2 } from "path";
|
|
205
|
+
import { basename, join, relative, resolve as resolve2 } from "path";
|
|
206
206
|
var {Glob } = globalThis.Bun;
|
|
207
207
|
var indexContentCache, resolveDevClientDir = () => {
|
|
208
208
|
const fromSource = resolve2(import.meta.dir, "../dev/client");
|
|
@@ -491,7 +491,23 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
491
491
|
` originalError.apply(console, args);`,
|
|
492
492
|
` };`,
|
|
493
493
|
` }`,
|
|
494
|
-
`}
|
|
494
|
+
`}`,
|
|
495
|
+
...isDev ? [
|
|
496
|
+
`
|
|
497
|
+
// Pre-warm the module server cache after hydration.`,
|
|
498
|
+
`// Silently imports the page module so the browser caches`,
|
|
499
|
+
`// all /@src/ URLs. First HMR edit hits warm cache (~20ms)`,
|
|
500
|
+
`// instead of cold fetches (~500ms).`,
|
|
501
|
+
`if (typeof requestIdleCallback !== 'undefined') {`,
|
|
502
|
+
` requestIdleCallback(() => {`,
|
|
503
|
+
` import('/@src/${relative(process.cwd(), resolve2(reactPagesDirectory, componentName + ".tsx")).replace(/\\/g, "/")}').catch(() => {});`,
|
|
504
|
+
` });`,
|
|
505
|
+
`} else {`,
|
|
506
|
+
` setTimeout(() => {`,
|
|
507
|
+
` import('/@src/${relative(process.cwd(), resolve2(reactPagesDirectory, componentName + ".tsx")).replace(/\\/g, "/")}').catch(() => {});`,
|
|
508
|
+
` }, 1000);`,
|
|
509
|
+
`}`
|
|
510
|
+
] : []
|
|
495
511
|
].join(`
|
|
496
512
|
`);
|
|
497
513
|
const indexPath = join(reactIndexesDirectory, `${componentName}.tsx`);
|
|
@@ -945,7 +961,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
945
961
|
|
|
946
962
|
// src/build/angularLinkerPlugin.ts
|
|
947
963
|
import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
948
|
-
import { dirname as dirname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
964
|
+
import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve5 } from "path";
|
|
949
965
|
import { createHash } from "crypto";
|
|
950
966
|
var CACHE_DIR, angularLinkerPlugin;
|
|
951
967
|
var init_angularLinkerPlugin = __esm(() => {
|
|
@@ -988,7 +1004,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
988
1004
|
dirname: dirname2,
|
|
989
1005
|
exists: existsSync7,
|
|
990
1006
|
readFile: readFileSync3,
|
|
991
|
-
relative,
|
|
1007
|
+
relative: relative2,
|
|
992
1008
|
resolve: resolve5
|
|
993
1009
|
},
|
|
994
1010
|
linkerJitMode: false,
|
|
@@ -1029,11 +1045,11 @@ var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPath
|
|
|
1029
1045
|
const currentPaths = new Set(currentOutputPaths.map((path) => resolve6(path)));
|
|
1030
1046
|
const glob = new Glob4("**/*");
|
|
1031
1047
|
const removals = [];
|
|
1032
|
-
for (const
|
|
1033
|
-
const absolute = resolve6(buildPath,
|
|
1048
|
+
for (const relative3 of glob.scanSync({ cwd: buildPath })) {
|
|
1049
|
+
const absolute = resolve6(buildPath, relative3);
|
|
1034
1050
|
if (currentPaths.has(absolute))
|
|
1035
1051
|
continue;
|
|
1036
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
1052
|
+
if (!HASHED_FILE_PATTERN.test(relative3))
|
|
1037
1053
|
continue;
|
|
1038
1054
|
removals.push(rm2(absolute, { force: true }));
|
|
1039
1055
|
}
|
|
@@ -1187,12 +1203,12 @@ var init_startupBanner = __esm(() => {
|
|
|
1187
1203
|
// src/utils/logger.ts
|
|
1188
1204
|
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
1189
1205
|
const cwd = process.cwd();
|
|
1190
|
-
let
|
|
1191
|
-
|
|
1192
|
-
if (!
|
|
1193
|
-
|
|
1206
|
+
let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
1207
|
+
relative3 = relative3.replace(/\\/g, "/");
|
|
1208
|
+
if (!relative3.startsWith("/")) {
|
|
1209
|
+
relative3 = `/${relative3}`;
|
|
1194
1210
|
}
|
|
1195
|
-
return
|
|
1211
|
+
return relative3;
|
|
1196
1212
|
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
1197
1213
|
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1198
1214
|
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
@@ -1251,11 +1267,11 @@ var init_logger = __esm(() => {
|
|
|
1251
1267
|
});
|
|
1252
1268
|
|
|
1253
1269
|
// src/utils/validateSafePath.ts
|
|
1254
|
-
import { resolve as resolve7, relative as
|
|
1270
|
+
import { resolve as resolve7, relative as relative3 } from "path";
|
|
1255
1271
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
1256
1272
|
const absoluteBase = resolve7(baseDirectory);
|
|
1257
1273
|
const absoluteTarget = resolve7(baseDirectory, targetPath);
|
|
1258
|
-
const relativePath = normalizePath(
|
|
1274
|
+
const relativePath = normalizePath(relative3(absoluteBase, absoluteTarget));
|
|
1259
1275
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
1260
1276
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
1261
1277
|
}
|
|
@@ -1277,7 +1293,7 @@ import {
|
|
|
1277
1293
|
basename as basename2,
|
|
1278
1294
|
extname as extname2,
|
|
1279
1295
|
resolve as resolve8,
|
|
1280
|
-
relative as
|
|
1296
|
+
relative as relative4,
|
|
1281
1297
|
sep
|
|
1282
1298
|
} from "path";
|
|
1283
1299
|
import { env } from "process";
|
|
@@ -1341,7 +1357,7 @@ var resolveDevClientDir2 = () => {
|
|
|
1341
1357
|
const isModule = src.endsWith(".svelte.ts") || src.endsWith(".svelte.js");
|
|
1342
1358
|
const preprocessed = isModule ? raw : (await preprocess(raw, {})).code;
|
|
1343
1359
|
const transpiled = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed) : preprocessed;
|
|
1344
|
-
const relDir = dirname3(
|
|
1360
|
+
const relDir = dirname3(relative4(svelteRoot, src)).replace(/\\/g, "/");
|
|
1345
1361
|
const baseName = basename2(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
1346
1362
|
const importPaths = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
1347
1363
|
const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
|
|
@@ -1360,7 +1376,7 @@ var resolveDevClientDir2 = () => {
|
|
|
1360
1376
|
}).js.code;
|
|
1361
1377
|
let code = raw2.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
1362
1378
|
if (mode === "client" && isDev) {
|
|
1363
|
-
const moduleKey = `/@src/${
|
|
1379
|
+
const moduleKey = `/@src/${relative4(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
1364
1380
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
1365
1381
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
1366
1382
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -1395,10 +1411,10 @@ var resolveDevClientDir2 = () => {
|
|
|
1395
1411
|
};
|
|
1396
1412
|
const roots = await Promise.all(entryPoints.map(build2));
|
|
1397
1413
|
await Promise.all(roots.map(async ({ client: client2 }) => {
|
|
1398
|
-
const relClientDir = dirname3(
|
|
1414
|
+
const relClientDir = dirname3(relative4(clientDir, client2));
|
|
1399
1415
|
const name = basename2(client2, extname2(client2));
|
|
1400
1416
|
const indexPath = join6(indexDir, relClientDir, `${name}.js`);
|
|
1401
|
-
const importRaw =
|
|
1417
|
+
const importRaw = relative4(dirname3(indexPath), client2).split(sep).join("/");
|
|
1402
1418
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
1403
1419
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
1404
1420
|
import "${hmrClientPath3}";
|
|
@@ -1438,7 +1454,7 @@ if (typeof window !== "undefined") {
|
|
|
1438
1454
|
return {
|
|
1439
1455
|
svelteClientPaths: roots.map(({ client: client2 }) => client2),
|
|
1440
1456
|
svelteIndexPaths: roots.map(({ client: client2 }) => {
|
|
1441
|
-
const rel = dirname3(
|
|
1457
|
+
const rel = dirname3(relative4(clientDir, client2));
|
|
1442
1458
|
return join6(indexDir, rel, basename2(client2));
|
|
1443
1459
|
}),
|
|
1444
1460
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -1463,7 +1479,7 @@ __export(exports_compileVue, {
|
|
|
1463
1479
|
});
|
|
1464
1480
|
import { existsSync as existsSync9 } from "fs";
|
|
1465
1481
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
1466
|
-
import { basename as basename3, dirname as dirname4, join as join7, relative as
|
|
1482
|
+
import { basename as basename3, dirname as dirname4, join as join7, relative as relative5, resolve as resolve9 } from "path";
|
|
1467
1483
|
var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
1468
1484
|
var resolveDevClientDir3 = () => {
|
|
1469
1485
|
const fromSource = resolve9(import.meta.dir, "../dev/client");
|
|
@@ -1508,7 +1524,7 @@ var resolveDevClientDir3 = () => {
|
|
|
1508
1524
|
return "template-only";
|
|
1509
1525
|
}
|
|
1510
1526
|
return "full";
|
|
1511
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
1527
|
+
}, generateVueHmrId = (sourceFilePath, vueRootDir) => relative5(vueRootDir, sourceFilePath).replace(/\\/g, "/").replace(/\.vue$/, ""), extractImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => importPath !== undefined), toJs = (filePath) => {
|
|
1512
1528
|
if (filePath.endsWith(".vue"))
|
|
1513
1529
|
return filePath.replace(/\.vue$/, ".js");
|
|
1514
1530
|
if (filePath.endsWith(".ts"))
|
|
@@ -1535,7 +1551,7 @@ var resolveDevClientDir3 = () => {
|
|
|
1535
1551
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
1536
1552
|
if (cachedResult)
|
|
1537
1553
|
return cachedResult;
|
|
1538
|
-
const relativeFilePath =
|
|
1554
|
+
const relativeFilePath = relative5(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
1539
1555
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
1540
1556
|
const fileBaseName = basename3(sourceFilePath, ".vue");
|
|
1541
1557
|
const componentId = toKebab(fileBaseName);
|
|
@@ -1664,7 +1680,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1664
1680
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
1665
1681
|
const entryBaseName = basename3(entryPath, ".vue");
|
|
1666
1682
|
const indexOutputFile = join7(indexOutputDir, `${entryBaseName}.js`);
|
|
1667
|
-
const clientOutputFile = join7(clientOutputDir,
|
|
1683
|
+
const clientOutputFile = join7(clientOutputDir, relative5(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
1668
1684
|
await mkdir2(dirname4(indexOutputFile), { recursive: true });
|
|
1669
1685
|
const vueHmrImports = isDev ? [
|
|
1670
1686
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -1672,7 +1688,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1672
1688
|
] : [];
|
|
1673
1689
|
await write2(indexOutputFile, [
|
|
1674
1690
|
...vueHmrImports,
|
|
1675
|
-
`import Comp from "${
|
|
1691
|
+
`import Comp from "${relative5(dirname4(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
1676
1692
|
'import { createSSRApp, createApp } from "vue";',
|
|
1677
1693
|
"",
|
|
1678
1694
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -1772,7 +1788,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1772
1788
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
1773
1789
|
const sourceCode = await file3(tsPath).text();
|
|
1774
1790
|
const transpiledCode = transpiler2.transformSync(sourceCode);
|
|
1775
|
-
const relativeJsPath =
|
|
1791
|
+
const relativeJsPath = relative5(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
1776
1792
|
const outClientPath = join7(clientOutputDir, relativeJsPath);
|
|
1777
1793
|
const outServerPath = join7(serverOutputDir, relativeJsPath);
|
|
1778
1794
|
await mkdir2(dirname4(outClientPath), { recursive: true });
|
|
@@ -10662,11 +10678,11 @@ ${lanes.join(`
|
|
|
10662
10678
|
return toComponents;
|
|
10663
10679
|
}
|
|
10664
10680
|
const components = toComponents.slice(start);
|
|
10665
|
-
const
|
|
10681
|
+
const relative6 = [];
|
|
10666
10682
|
for (;start < fromComponents.length; start++) {
|
|
10667
|
-
|
|
10683
|
+
relative6.push("..");
|
|
10668
10684
|
}
|
|
10669
|
-
return ["", ...
|
|
10685
|
+
return ["", ...relative6, ...components];
|
|
10670
10686
|
}
|
|
10671
10687
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
10672
10688
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -47962,9 +47978,9 @@ ${lanes.join(`
|
|
|
47962
47978
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
47963
47979
|
return;
|
|
47964
47980
|
}
|
|
47965
|
-
const
|
|
47981
|
+
const relative6 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
47966
47982
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
47967
|
-
const option = resolvePath(symlinkDirectory,
|
|
47983
|
+
const option = resolvePath(symlinkDirectory, relative6);
|
|
47968
47984
|
const result2 = cb(option, target === referenceRedirect);
|
|
47969
47985
|
shouldFilterIgnoredPaths = true;
|
|
47970
47986
|
if (result2)
|
|
@@ -170530,7 +170546,7 @@ __export(exports_compileAngular, {
|
|
|
170530
170546
|
compileAngular: () => compileAngular
|
|
170531
170547
|
});
|
|
170532
170548
|
import { existsSync as existsSync10, readFileSync as readFileSync4, promises as fs } from "fs";
|
|
170533
|
-
import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve10, relative as
|
|
170549
|
+
import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve10, relative as relative6 } from "path";
|
|
170534
170550
|
import { createHash as createHash2 } from "crypto";
|
|
170535
170551
|
var import_typescript, computeConfigHash = () => {
|
|
170536
170552
|
try {
|
|
@@ -170839,7 +170855,7 @@ export default ${componentClassName};
|
|
|
170839
170855
|
await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
|
|
170840
170856
|
}
|
|
170841
170857
|
await fs.writeFile(rawServerFile, rewritten, "utf-8");
|
|
170842
|
-
const relativePath =
|
|
170858
|
+
const relativePath = relative6(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
170843
170859
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
170844
170860
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
170845
170861
|
import "${hmrRuntimePath}";
|
|
@@ -171218,7 +171234,7 @@ import {
|
|
|
171218
171234
|
rmSync,
|
|
171219
171235
|
writeFileSync as writeFileSync3
|
|
171220
171236
|
} from "fs";
|
|
171221
|
-
import { basename as basename5, join as join13, relative as
|
|
171237
|
+
import { basename as basename5, join as join13, relative as relative7, resolve as resolve11 } from "path";
|
|
171222
171238
|
import { cwd, env as env2, exit } from "process";
|
|
171223
171239
|
var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
|
|
171224
171240
|
var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
|
|
@@ -171640,20 +171656,6 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171640
171656
|
}
|
|
171641
171657
|
const reactClientLogs = reactClientResult?.logs ?? [];
|
|
171642
171658
|
const reactClientOutputs = reactClientResult?.outputs ?? [];
|
|
171643
|
-
if (hmr && reactClientOutputs.length > 0) {
|
|
171644
|
-
console.log(`[build] stripping refresh noop from ${reactClientOutputs.filter((o) => o.kind === "entry-point").length} entry points`);
|
|
171645
|
-
const REFRESH_NOOP = "window.$RefreshReg$||(window.$RefreshReg$=function(){});window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});";
|
|
171646
|
-
for (const output of reactClientOutputs) {
|
|
171647
|
-
if (output.kind !== "entry-point")
|
|
171648
|
-
continue;
|
|
171649
|
-
try {
|
|
171650
|
-
const content = await Bun.file(output.path).text();
|
|
171651
|
-
if (content.includes(REFRESH_NOOP)) {
|
|
171652
|
-
writeFileSync3(output.path, content.replace(REFRESH_NOOP, "").replace(/^\n/, ""));
|
|
171653
|
-
}
|
|
171654
|
-
} catch {}
|
|
171655
|
-
}
|
|
171656
|
-
}
|
|
171657
171659
|
if (reactClientResult && !reactClientResult.success && reactClientLogs.length > 0) {
|
|
171658
171660
|
extractBuildError(reactClientLogs, "react-client", "React client", frameworkNames, isIncremental, throwOnError);
|
|
171659
171661
|
}
|
|
@@ -171797,7 +171799,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171797
171799
|
const devIndexDir = join13(buildPath, "_src_indexes");
|
|
171798
171800
|
mkdirSync8(devIndexDir, { recursive: true });
|
|
171799
171801
|
const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
|
|
171800
|
-
const pagesRel =
|
|
171802
|
+
const pagesRel = relative7(process.cwd(), resolve11(reactPagesPath)).replace(/\\/g, "/");
|
|
171801
171803
|
for (const file4 of indexFiles) {
|
|
171802
171804
|
let content = readFileSync5(join13(reactIndexesPath, file4), "utf-8");
|
|
171803
171805
|
content = content.replace(/from\s*['"]\.\.\/pages\/([^'"]+)['"]/g, `from '/@src/${pagesRel}/$1'`);
|
|
@@ -202407,7 +202409,7 @@ __export(exports_moduleServer, {
|
|
|
202407
202409
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
202408
202410
|
});
|
|
202409
202411
|
import { existsSync as existsSync13, readFileSync as readFileSync9, statSync } from "fs";
|
|
202410
|
-
import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve18, relative as
|
|
202412
|
+
import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve18, relative as relative8 } from "path";
|
|
202411
202413
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
202412
202414
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
202413
202415
|
const allExports = [];
|
|
@@ -202470,7 +202472,7 @@ ${stubs}
|
|
|
202470
202472
|
const fileDir = dirname7(filePath);
|
|
202471
202473
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => {
|
|
202472
202474
|
const absPath = resolve18(fileDir, relPath);
|
|
202473
|
-
const rel =
|
|
202475
|
+
const rel = relative8(projectRoot, absPath);
|
|
202474
202476
|
let srcPath = rel;
|
|
202475
202477
|
if (!extname3(srcPath)) {
|
|
202476
202478
|
const extensions = [
|
|
@@ -202491,19 +202493,19 @@ ${stubs}
|
|
|
202491
202493
|
}
|
|
202492
202494
|
if (extname3(srcPath) === ".svelte") {
|
|
202493
202495
|
const resolved = resolveSvelteModulePath(resolve18(projectRoot, srcPath));
|
|
202494
|
-
const resolvedRel =
|
|
202496
|
+
const resolvedRel = relative8(projectRoot, resolved);
|
|
202495
202497
|
srcPath = resolvedRel;
|
|
202496
202498
|
}
|
|
202497
202499
|
return `${prefix}${srcUrl(srcPath, projectRoot)}${suffix}`;
|
|
202498
202500
|
});
|
|
202499
202501
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => {
|
|
202500
202502
|
const absPath = resolve18(fileDir, relPath);
|
|
202501
|
-
const rel =
|
|
202503
|
+
const rel = relative8(projectRoot, absPath);
|
|
202502
202504
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
202503
202505
|
});
|
|
202504
202506
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => {
|
|
202505
202507
|
const absPath = resolve18(fileDir, relPath);
|
|
202506
|
-
const rel =
|
|
202508
|
+
const rel = relative8(projectRoot, absPath);
|
|
202507
202509
|
let srcPath = rel;
|
|
202508
202510
|
if (!extname3(srcPath)) {
|
|
202509
202511
|
const extensions = [
|
|
@@ -202527,10 +202529,10 @@ ${stubs}
|
|
|
202527
202529
|
});
|
|
202528
202530
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
202529
202531
|
if (absPath.startsWith(projectRoot)) {
|
|
202530
|
-
const rel2 =
|
|
202532
|
+
const rel2 = relative8(projectRoot, absPath).replace(/\\/g, "/");
|
|
202531
202533
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
202532
202534
|
}
|
|
202533
|
-
const rel =
|
|
202535
|
+
const rel = relative8(projectRoot, absPath).replace(/\\/g, "/");
|
|
202534
202536
|
if (!rel.startsWith("..")) {
|
|
202535
202537
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
202536
202538
|
}
|
|
@@ -202572,7 +202574,7 @@ ${stubs}
|
|
|
202572
202574
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
202573
202575
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
202574
202576
|
` + transpiled;
|
|
202575
|
-
const relPath =
|
|
202577
|
+
const relPath = relative8(projectRoot, filePath).replace(/\\/g, "/");
|
|
202576
202578
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
202577
202579
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
202578
202580
|
}, transformPlainFile = (filePath, projectRoot, rewriter) => {
|
|
@@ -202639,11 +202641,11 @@ ${stubs}
|
|
|
202639
202641
|
if (compiled.css?.code) {
|
|
202640
202642
|
const cssPath = `${filePath}.css`;
|
|
202641
202643
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
202642
|
-
const cssUrl = srcUrl(
|
|
202644
|
+
const cssUrl = srcUrl(relative8(projectRoot, cssPath), projectRoot);
|
|
202643
202645
|
code = `import "${cssUrl}";
|
|
202644
202646
|
${code}`;
|
|
202645
202647
|
}
|
|
202646
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
202648
|
+
const moduleUrl = `${SRC_PREFIX}${relative8(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
202647
202649
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
202648
202650
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
202649
202651
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -202707,7 +202709,7 @@ ${code}`;
|
|
|
202707
202709
|
}
|
|
202708
202710
|
code = tsTranspiler2.transformSync(code);
|
|
202709
202711
|
const hmrBase = vueDir ? resolve18(vueDir) : projectRoot;
|
|
202710
|
-
const hmrId =
|
|
202712
|
+
const hmrId = relative8(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
202711
202713
|
code = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
202712
202714
|
code += [
|
|
202713
202715
|
"",
|
|
@@ -203070,7 +203072,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
203070
203072
|
// src/dev/rebuildTrigger.ts
|
|
203071
203073
|
import { existsSync as existsSync14 } from "fs";
|
|
203072
203074
|
import { rm as rm8 } from "fs/promises";
|
|
203073
|
-
import { basename as basename8, relative as
|
|
203075
|
+
import { basename as basename8, relative as relative9, resolve as resolve21 } from "path";
|
|
203074
203076
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
203075
203077
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
203076
203078
|
if (pathLineCol) {
|
|
@@ -203498,25 +203500,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203498
203500
|
if (vendorPaths) {
|
|
203499
203501
|
await rewriteReactImports2(clientResult.outputs.map((art) => art.path), vendorPaths);
|
|
203500
203502
|
}
|
|
203501
|
-
const { readFileSync: readFs, writeFileSync: writeFs } = await import("fs");
|
|
203502
|
-
const REFRESH_NOOP = "window.$RefreshReg$||(window.$RefreshReg$=function(){});window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});";
|
|
203503
|
-
for (const output of clientResult.outputs) {
|
|
203504
|
-
if (output.kind !== "entry-point")
|
|
203505
|
-
continue;
|
|
203506
|
-
try {
|
|
203507
|
-
const content = readFs(output.path, "utf-8");
|
|
203508
|
-
if (content.includes(REFRESH_NOOP)) {
|
|
203509
|
-
writeFs(output.path, content.replace(REFRESH_NOOP, "").replace(/^\n/, ""));
|
|
203510
|
-
}
|
|
203511
|
-
} catch {}
|
|
203512
|
-
}
|
|
203513
203503
|
const clientManifest = generateManifest2(clientResult.outputs, buildDir);
|
|
203514
203504
|
Object.assign(state.manifest, clientManifest);
|
|
203515
203505
|
await populateAssetStore(state.assetStore, clientManifest, buildDir);
|
|
203516
203506
|
}, getModuleUrl = async (pageFile) => {
|
|
203517
203507
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
203518
203508
|
invalidateModule2(pageFile);
|
|
203519
|
-
const rel =
|
|
203509
|
+
const rel = relative9(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
203520
203510
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
203521
203511
|
warmCache2(url);
|
|
203522
203512
|
return url;
|
|
@@ -203553,7 +203543,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203553
203543
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
203554
203544
|
if (pageModuleUrl) {
|
|
203555
203545
|
const serverDuration = Date.now() - startTime;
|
|
203556
|
-
state.lastHmrPath =
|
|
203546
|
+
state.lastHmrPath = relative9(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
203557
203547
|
state.lastHmrFramework = "react";
|
|
203558
203548
|
broadcastToClients(state, {
|
|
203559
203549
|
data: {
|
|
@@ -203939,7 +203929,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203939
203929
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
203940
203930
|
const pascalName = toPascal(baseName);
|
|
203941
203931
|
const vueRoot = config.vueDirectory;
|
|
203942
|
-
const hmrId = vueRoot ?
|
|
203932
|
+
const hmrId = vueRoot ? relative9(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
203943
203933
|
const cssKey = `${pascalName}CSS`;
|
|
203944
203934
|
const cssUrl = manifest[cssKey] || null;
|
|
203945
203935
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
@@ -205065,10 +205055,11 @@ var handleReactPageRequest = async (PageComponent, index, ...props) => {
|
|
|
205065
205055
|
const { createElement } = await import("react");
|
|
205066
205056
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
205067
205057
|
const element = maybeProps !== undefined ? createElement(PageComponent, maybeProps) : createElement(PageComponent);
|
|
205068
|
-
const propsScript = maybeProps ? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)}
|
|
205058
|
+
const propsScript = maybeProps ? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)};` : "";
|
|
205059
|
+
const refreshSetup = "window.__REFRESH_BUFFER__=[];window.$RefreshReg$=function(t,i){window.__REFRESH_BUFFER__.push([t,i])};window.$RefreshSig$=function(){return function(t){return t}};";
|
|
205069
205060
|
const stream = await renderToReadableStream(element, {
|
|
205070
205061
|
bootstrapModules: [index],
|
|
205071
|
-
bootstrapScriptContent: propsScript || undefined,
|
|
205062
|
+
bootstrapScriptContent: propsScript + refreshSetup || undefined,
|
|
205072
205063
|
onError(error) {
|
|
205073
205064
|
console.error("[SSR] React streaming error:", error);
|
|
205074
205065
|
}
|
|
@@ -205090,7 +205081,7 @@ var handleHTMLPageRequest = (pagePath) => file(pagePath);
|
|
|
205090
205081
|
var handleHTMXPageRequest = (pagePath) => file(pagePath);
|
|
205091
205082
|
// src/core/prepare.ts
|
|
205092
205083
|
import { readFileSync as readFileSync10 } from "fs";
|
|
205093
|
-
import { relative as
|
|
205084
|
+
import { relative as relative11, resolve as resolve23 } from "path";
|
|
205094
205085
|
|
|
205095
205086
|
// src/utils/loadConfig.ts
|
|
205096
205087
|
import { resolve } from "path";
|
|
@@ -205169,7 +205160,7 @@ var prepare = async (configOrPath) => {
|
|
|
205169
205160
|
})) {
|
|
205170
205161
|
if (file4.includes("/node_modules/"))
|
|
205171
205162
|
continue;
|
|
205172
|
-
const rel =
|
|
205163
|
+
const rel = relative11(process.cwd(), file4).replace(/\\/g, "/");
|
|
205173
205164
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
205174
205165
|
}
|
|
205175
205166
|
}
|
|
@@ -205179,7 +205170,7 @@ var prepare = async (configOrPath) => {
|
|
|
205179
205170
|
if (key.endsWith("Index") && typeof result.manifest[key] === "string" && result.manifest[key].includes("/react/") && result.manifest[key].includes("/indexes/")) {
|
|
205180
205171
|
const fileName = `${key.replace(/Index$/, "")}.tsx`;
|
|
205181
205172
|
const srcPath = resolve23(devIndexDir, fileName);
|
|
205182
|
-
const rel =
|
|
205173
|
+
const rel = relative11(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
205183
205174
|
result.manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
205184
205175
|
}
|
|
205185
205176
|
}
|
|
@@ -205349,5 +205340,5 @@ export {
|
|
|
205349
205340
|
ANGULAR_INIT_TIMEOUT_MS
|
|
205350
205341
|
};
|
|
205351
205342
|
|
|
205352
|
-
//# debugId=
|
|
205343
|
+
//# debugId=1E29419E90128A2F64756E2164756E21
|
|
205353
205344
|
//# sourceMappingURL=index.js.map
|