@absolutejs/absolute 0.19.0-beta.62 → 0.19.0-beta.64
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 +5 -1
- package/dist/build.js +56 -50
- package/dist/build.js.map +4 -4
- package/dist/cli/index.js +2 -1
- package/dist/dev/client/handlers/react.ts +57 -15
- package/dist/index.js +59 -53
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/types/globals.d.ts +1 -0
package/dist/cli/index.js
CHANGED
|
@@ -1254,7 +1254,8 @@ var start = async (serverEntry, outdir, configPath2) => {
|
|
|
1254
1254
|
if (args.path.includes("node_modules"))
|
|
1255
1255
|
return;
|
|
1256
1256
|
const text = await Bun.file(args.path).text();
|
|
1257
|
-
|
|
1257
|
+
const stripped = text.replace(/`(?:[^`\\]|\\.)*`/gs, "").replace(/'(?:[^'\\]|\\.)*'/g, "").replace(/"(?:[^"\\]|\\.)*"/g, "");
|
|
1258
|
+
if (stripped.includes("@Component")) {
|
|
1258
1259
|
return {
|
|
1259
1260
|
contents: "export default {}",
|
|
1260
1261
|
loader: "js"
|
|
@@ -8,6 +8,7 @@ import { detectCurrentFramework } from '../frameworkDetect';
|
|
|
8
8
|
|
|
9
9
|
export const handleReactUpdate = (message: {
|
|
10
10
|
data: {
|
|
11
|
+
dataModuleUrl?: string;
|
|
11
12
|
hasCSSChanges?: boolean;
|
|
12
13
|
hasComponentChanges?: boolean;
|
|
13
14
|
manifest?: Record<string, string>;
|
|
@@ -32,9 +33,22 @@ export const handleReactUpdate = (message: {
|
|
|
32
33
|
|
|
33
34
|
const refreshRuntime = window.$RefreshRuntime$;
|
|
34
35
|
const serverDuration = message.data.serverDuration;
|
|
35
|
-
|
|
36
|
+
const dataModuleUrl = message.data.dataModuleUrl;
|
|
36
37
|
const pageModuleUrl = message.data.pageModuleUrl;
|
|
37
38
|
|
|
39
|
+
// Non-component file: import the data file first (cache bust),
|
|
40
|
+
// then re-import the page so the component re-renders.
|
|
41
|
+
if (dataModuleUrl && pageModuleUrl && refreshRuntime) {
|
|
42
|
+
applyDataThenPage(
|
|
43
|
+
dataModuleUrl,
|
|
44
|
+
pageModuleUrl,
|
|
45
|
+
refreshRuntime,
|
|
46
|
+
serverDuration
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
38
52
|
if (pageModuleUrl && refreshRuntime) {
|
|
39
53
|
applyRefreshImport(pageModuleUrl, refreshRuntime, serverDuration);
|
|
40
54
|
|
|
@@ -53,29 +67,57 @@ export const handleReactUpdate = (message: {
|
|
|
53
67
|
window.location.reload();
|
|
54
68
|
};
|
|
55
69
|
|
|
70
|
+
const sendTiming = (clientStart: number, serverDuration?: number) => {
|
|
71
|
+
if (window.__HMR_WS__) {
|
|
72
|
+
const clientMs = Math.round(performance.now() - clientStart);
|
|
73
|
+
const total = (serverDuration ?? 0) + clientMs;
|
|
74
|
+
window.__HMR_WS__.send(
|
|
75
|
+
JSON.stringify({ duration: total, type: 'hmr-timing' })
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
if (window.__ERROR_BOUNDARY__) {
|
|
79
|
+
window.__ERROR_BOUNDARY__.reset();
|
|
80
|
+
} else {
|
|
81
|
+
hideErrorOverlay();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
56
85
|
const applyRefreshImport = (
|
|
57
86
|
moduleUrl: string,
|
|
58
|
-
refreshRuntime: { performReactRefresh: () =>
|
|
87
|
+
refreshRuntime: { performReactRefresh: () => unknown },
|
|
59
88
|
serverDuration?: number
|
|
60
89
|
) => {
|
|
61
90
|
const clientStart = performance.now();
|
|
62
91
|
import(`${moduleUrl}?t=${Date.now()}`)
|
|
63
92
|
.then(() => {
|
|
64
93
|
refreshRuntime.performReactRefresh();
|
|
94
|
+
sendTiming(clientStart, serverDuration);
|
|
65
95
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
96
|
+
return undefined;
|
|
97
|
+
})
|
|
98
|
+
.catch((err) => {
|
|
99
|
+
console.warn(
|
|
100
|
+
'[HMR] React Fast Refresh failed, falling back to reload:',
|
|
101
|
+
err
|
|
102
|
+
);
|
|
103
|
+
window.location.reload();
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const applyDataThenPage = (
|
|
108
|
+
dataUrl: string,
|
|
109
|
+
pageUrl: string,
|
|
110
|
+
refreshRuntime: { performReactRefresh: () => unknown },
|
|
111
|
+
serverDuration?: number
|
|
112
|
+
) => {
|
|
113
|
+
const clientStart = performance.now();
|
|
114
|
+
// Import the changed data file first to bust the browser cache,
|
|
115
|
+
// then re-import the page so the component re-renders with new data.
|
|
116
|
+
import(`${dataUrl}?t=${Date.now()}`)
|
|
117
|
+
.then(() => import(`${pageUrl}?t=${Date.now()}`))
|
|
118
|
+
.then(() => {
|
|
119
|
+
refreshRuntime.performReactRefresh();
|
|
120
|
+
sendTiming(clientStart, serverDuration);
|
|
79
121
|
|
|
80
122
|
return undefined;
|
|
81
123
|
})
|
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");
|
|
@@ -239,6 +239,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
239
239
|
const hmrPreamble = isDev ? [
|
|
240
240
|
`window.__HMR_FRAMEWORK__ = "react";`,
|
|
241
241
|
`window.__REACT_COMPONENT_KEY__ = "${componentName}Index";`,
|
|
242
|
+
`window.__REACT_PAGE_MODULE__ = "/@src/${relative(process.cwd(), resolve2(reactPagesDirectory, componentName + ".tsx")).replace(/\\\\/g, "/")}";`,
|
|
242
243
|
`import '${refreshSetupPath}';`,
|
|
243
244
|
`import '${hmrClientPath}';`,
|
|
244
245
|
`import { showErrorOverlay, hideErrorOverlay } from '${errorOverlayPath}';
|
|
@@ -945,7 +946,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
945
946
|
|
|
946
947
|
// src/build/angularLinkerPlugin.ts
|
|
947
948
|
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";
|
|
949
|
+
import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve5 } from "path";
|
|
949
950
|
import { createHash } from "crypto";
|
|
950
951
|
var CACHE_DIR, angularLinkerPlugin;
|
|
951
952
|
var init_angularLinkerPlugin = __esm(() => {
|
|
@@ -988,7 +989,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
988
989
|
dirname: dirname2,
|
|
989
990
|
exists: existsSync7,
|
|
990
991
|
readFile: readFileSync3,
|
|
991
|
-
relative,
|
|
992
|
+
relative: relative2,
|
|
992
993
|
resolve: resolve5
|
|
993
994
|
},
|
|
994
995
|
linkerJitMode: false,
|
|
@@ -1029,11 +1030,11 @@ var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPath
|
|
|
1029
1030
|
const currentPaths = new Set(currentOutputPaths.map((path) => resolve6(path)));
|
|
1030
1031
|
const glob = new Glob4("**/*");
|
|
1031
1032
|
const removals = [];
|
|
1032
|
-
for (const
|
|
1033
|
-
const absolute = resolve6(buildPath,
|
|
1033
|
+
for (const relative3 of glob.scanSync({ cwd: buildPath })) {
|
|
1034
|
+
const absolute = resolve6(buildPath, relative3);
|
|
1034
1035
|
if (currentPaths.has(absolute))
|
|
1035
1036
|
continue;
|
|
1036
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
1037
|
+
if (!HASHED_FILE_PATTERN.test(relative3))
|
|
1037
1038
|
continue;
|
|
1038
1039
|
removals.push(rm2(absolute, { force: true }));
|
|
1039
1040
|
}
|
|
@@ -1187,12 +1188,12 @@ var init_startupBanner = __esm(() => {
|
|
|
1187
1188
|
// src/utils/logger.ts
|
|
1188
1189
|
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
1189
1190
|
const cwd = process.cwd();
|
|
1190
|
-
let
|
|
1191
|
-
|
|
1192
|
-
if (!
|
|
1193
|
-
|
|
1191
|
+
let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
1192
|
+
relative3 = relative3.replace(/\\/g, "/");
|
|
1193
|
+
if (!relative3.startsWith("/")) {
|
|
1194
|
+
relative3 = `/${relative3}`;
|
|
1194
1195
|
}
|
|
1195
|
-
return
|
|
1196
|
+
return relative3;
|
|
1196
1197
|
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
1197
1198
|
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1198
1199
|
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
@@ -1251,11 +1252,11 @@ var init_logger = __esm(() => {
|
|
|
1251
1252
|
});
|
|
1252
1253
|
|
|
1253
1254
|
// src/utils/validateSafePath.ts
|
|
1254
|
-
import { resolve as resolve7, relative as
|
|
1255
|
+
import { resolve as resolve7, relative as relative3 } from "path";
|
|
1255
1256
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
1256
1257
|
const absoluteBase = resolve7(baseDirectory);
|
|
1257
1258
|
const absoluteTarget = resolve7(baseDirectory, targetPath);
|
|
1258
|
-
const relativePath = normalizePath(
|
|
1259
|
+
const relativePath = normalizePath(relative3(absoluteBase, absoluteTarget));
|
|
1259
1260
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
1260
1261
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
1261
1262
|
}
|
|
@@ -1277,7 +1278,7 @@ import {
|
|
|
1277
1278
|
basename as basename2,
|
|
1278
1279
|
extname as extname2,
|
|
1279
1280
|
resolve as resolve8,
|
|
1280
|
-
relative as
|
|
1281
|
+
relative as relative4,
|
|
1281
1282
|
sep
|
|
1282
1283
|
} from "path";
|
|
1283
1284
|
import { env } from "process";
|
|
@@ -1341,7 +1342,7 @@ var resolveDevClientDir2 = () => {
|
|
|
1341
1342
|
const isModule = src.endsWith(".svelte.ts") || src.endsWith(".svelte.js");
|
|
1342
1343
|
const preprocessed = isModule ? raw : (await preprocess(raw, {})).code;
|
|
1343
1344
|
const transpiled = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed) : preprocessed;
|
|
1344
|
-
const relDir = dirname3(
|
|
1345
|
+
const relDir = dirname3(relative4(svelteRoot, src)).replace(/\\/g, "/");
|
|
1345
1346
|
const baseName = basename2(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
1346
1347
|
const importPaths = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
1347
1348
|
const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
|
|
@@ -1360,7 +1361,7 @@ var resolveDevClientDir2 = () => {
|
|
|
1360
1361
|
}).js.code;
|
|
1361
1362
|
let code = raw2.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
1362
1363
|
if (mode === "client" && isDev) {
|
|
1363
|
-
const moduleKey = `/@src/${
|
|
1364
|
+
const moduleKey = `/@src/${relative4(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
1364
1365
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
1365
1366
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
1366
1367
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -1395,10 +1396,10 @@ var resolveDevClientDir2 = () => {
|
|
|
1395
1396
|
};
|
|
1396
1397
|
const roots = await Promise.all(entryPoints.map(build2));
|
|
1397
1398
|
await Promise.all(roots.map(async ({ client: client2 }) => {
|
|
1398
|
-
const relClientDir = dirname3(
|
|
1399
|
+
const relClientDir = dirname3(relative4(clientDir, client2));
|
|
1399
1400
|
const name = basename2(client2, extname2(client2));
|
|
1400
1401
|
const indexPath = join6(indexDir, relClientDir, `${name}.js`);
|
|
1401
|
-
const importRaw =
|
|
1402
|
+
const importRaw = relative4(dirname3(indexPath), client2).split(sep).join("/");
|
|
1402
1403
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
1403
1404
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
1404
1405
|
import "${hmrClientPath3}";
|
|
@@ -1438,7 +1439,7 @@ if (typeof window !== "undefined") {
|
|
|
1438
1439
|
return {
|
|
1439
1440
|
svelteClientPaths: roots.map(({ client: client2 }) => client2),
|
|
1440
1441
|
svelteIndexPaths: roots.map(({ client: client2 }) => {
|
|
1441
|
-
const rel = dirname3(
|
|
1442
|
+
const rel = dirname3(relative4(clientDir, client2));
|
|
1442
1443
|
return join6(indexDir, rel, basename2(client2));
|
|
1443
1444
|
}),
|
|
1444
1445
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -1463,7 +1464,7 @@ __export(exports_compileVue, {
|
|
|
1463
1464
|
});
|
|
1464
1465
|
import { existsSync as existsSync9 } from "fs";
|
|
1465
1466
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
1466
|
-
import { basename as basename3, dirname as dirname4, join as join7, relative as
|
|
1467
|
+
import { basename as basename3, dirname as dirname4, join as join7, relative as relative5, resolve as resolve9 } from "path";
|
|
1467
1468
|
var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
1468
1469
|
var resolveDevClientDir3 = () => {
|
|
1469
1470
|
const fromSource = resolve9(import.meta.dir, "../dev/client");
|
|
@@ -1508,7 +1509,7 @@ var resolveDevClientDir3 = () => {
|
|
|
1508
1509
|
return "template-only";
|
|
1509
1510
|
}
|
|
1510
1511
|
return "full";
|
|
1511
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
1512
|
+
}, 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
1513
|
if (filePath.endsWith(".vue"))
|
|
1513
1514
|
return filePath.replace(/\.vue$/, ".js");
|
|
1514
1515
|
if (filePath.endsWith(".ts"))
|
|
@@ -1535,7 +1536,7 @@ var resolveDevClientDir3 = () => {
|
|
|
1535
1536
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
1536
1537
|
if (cachedResult)
|
|
1537
1538
|
return cachedResult;
|
|
1538
|
-
const relativeFilePath =
|
|
1539
|
+
const relativeFilePath = relative5(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
1539
1540
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
1540
1541
|
const fileBaseName = basename3(sourceFilePath, ".vue");
|
|
1541
1542
|
const componentId = toKebab(fileBaseName);
|
|
@@ -1664,7 +1665,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1664
1665
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
1665
1666
|
const entryBaseName = basename3(entryPath, ".vue");
|
|
1666
1667
|
const indexOutputFile = join7(indexOutputDir, `${entryBaseName}.js`);
|
|
1667
|
-
const clientOutputFile = join7(clientOutputDir,
|
|
1668
|
+
const clientOutputFile = join7(clientOutputDir, relative5(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
1668
1669
|
await mkdir2(dirname4(indexOutputFile), { recursive: true });
|
|
1669
1670
|
const vueHmrImports = isDev ? [
|
|
1670
1671
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -1672,7 +1673,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1672
1673
|
] : [];
|
|
1673
1674
|
await write2(indexOutputFile, [
|
|
1674
1675
|
...vueHmrImports,
|
|
1675
|
-
`import Comp from "${
|
|
1676
|
+
`import Comp from "${relative5(dirname4(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
1676
1677
|
'import { createSSRApp, createApp } from "vue";',
|
|
1677
1678
|
"",
|
|
1678
1679
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -1772,7 +1773,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1772
1773
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
1773
1774
|
const sourceCode = await file3(tsPath).text();
|
|
1774
1775
|
const transpiledCode = transpiler2.transformSync(sourceCode);
|
|
1775
|
-
const relativeJsPath =
|
|
1776
|
+
const relativeJsPath = relative5(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
1776
1777
|
const outClientPath = join7(clientOutputDir, relativeJsPath);
|
|
1777
1778
|
const outServerPath = join7(serverOutputDir, relativeJsPath);
|
|
1778
1779
|
await mkdir2(dirname4(outClientPath), { recursive: true });
|
|
@@ -10662,11 +10663,11 @@ ${lanes.join(`
|
|
|
10662
10663
|
return toComponents;
|
|
10663
10664
|
}
|
|
10664
10665
|
const components = toComponents.slice(start);
|
|
10665
|
-
const
|
|
10666
|
+
const relative6 = [];
|
|
10666
10667
|
for (;start < fromComponents.length; start++) {
|
|
10667
|
-
|
|
10668
|
+
relative6.push("..");
|
|
10668
10669
|
}
|
|
10669
|
-
return ["", ...
|
|
10670
|
+
return ["", ...relative6, ...components];
|
|
10670
10671
|
}
|
|
10671
10672
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
10672
10673
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -47962,9 +47963,9 @@ ${lanes.join(`
|
|
|
47962
47963
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
47963
47964
|
return;
|
|
47964
47965
|
}
|
|
47965
|
-
const
|
|
47966
|
+
const relative6 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
47966
47967
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
47967
|
-
const option = resolvePath(symlinkDirectory,
|
|
47968
|
+
const option = resolvePath(symlinkDirectory, relative6);
|
|
47968
47969
|
const result2 = cb(option, target === referenceRedirect);
|
|
47969
47970
|
shouldFilterIgnoredPaths = true;
|
|
47970
47971
|
if (result2)
|
|
@@ -170530,7 +170531,7 @@ __export(exports_compileAngular, {
|
|
|
170530
170531
|
compileAngular: () => compileAngular
|
|
170531
170532
|
});
|
|
170532
170533
|
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
|
|
170534
|
+
import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve10, relative as relative6 } from "path";
|
|
170534
170535
|
import { createHash as createHash2 } from "crypto";
|
|
170535
170536
|
var import_typescript, computeConfigHash = () => {
|
|
170536
170537
|
try {
|
|
@@ -170839,7 +170840,7 @@ export default ${componentClassName};
|
|
|
170839
170840
|
await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
|
|
170840
170841
|
}
|
|
170841
170842
|
await fs.writeFile(rawServerFile, rewritten, "utf-8");
|
|
170842
|
-
const relativePath =
|
|
170843
|
+
const relativePath = relative6(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
170843
170844
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
170844
170845
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
170845
170846
|
import "${hmrRuntimePath}";
|
|
@@ -171218,7 +171219,7 @@ import {
|
|
|
171218
171219
|
rmSync,
|
|
171219
171220
|
writeFileSync as writeFileSync3
|
|
171220
171221
|
} from "fs";
|
|
171221
|
-
import { basename as basename5, join as join13, relative as
|
|
171222
|
+
import { basename as basename5, join as join13, relative as relative7, resolve as resolve11 } from "path";
|
|
171222
171223
|
import { cwd, env as env2, exit } from "process";
|
|
171223
171224
|
var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
|
|
171224
171225
|
var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
|
|
@@ -171783,7 +171784,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171783
171784
|
const devIndexDir = join13(buildPath, "_src_indexes");
|
|
171784
171785
|
mkdirSync8(devIndexDir, { recursive: true });
|
|
171785
171786
|
const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
|
|
171786
|
-
const pagesRel =
|
|
171787
|
+
const pagesRel = relative7(process.cwd(), resolve11(reactPagesPath)).replace(/\\/g, "/");
|
|
171787
171788
|
for (const file4 of indexFiles) {
|
|
171788
171789
|
let content = readFileSync5(join13(reactIndexesPath, file4), "utf-8");
|
|
171789
171790
|
content = content.replace(/from\s*['"]\.\.\/pages\/([^'"]+)['"]/g, `from '/@src/${pagesRel}/$1'`);
|
|
@@ -202344,7 +202345,7 @@ __export(exports_moduleServer, {
|
|
|
202344
202345
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
202345
202346
|
});
|
|
202346
202347
|
import { existsSync as existsSync13, readFileSync as readFileSync9, statSync } from "fs";
|
|
202347
|
-
import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve18, relative as
|
|
202348
|
+
import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve18, relative as relative8 } from "path";
|
|
202348
202349
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
202349
202350
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
202350
202351
|
const allExports = [];
|
|
@@ -202405,7 +202406,7 @@ ${stubs}
|
|
|
202405
202406
|
const fileDir = dirname7(filePath);
|
|
202406
202407
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => {
|
|
202407
202408
|
const absPath = resolve18(fileDir, relPath);
|
|
202408
|
-
const rel =
|
|
202409
|
+
const rel = relative8(projectRoot, absPath);
|
|
202409
202410
|
let srcPath = rel;
|
|
202410
202411
|
if (!extname3(srcPath)) {
|
|
202411
202412
|
const extensions = [
|
|
@@ -202426,19 +202427,19 @@ ${stubs}
|
|
|
202426
202427
|
}
|
|
202427
202428
|
if (extname3(srcPath) === ".svelte") {
|
|
202428
202429
|
const resolved = resolveSvelteModulePath(resolve18(projectRoot, srcPath));
|
|
202429
|
-
const resolvedRel =
|
|
202430
|
+
const resolvedRel = relative8(projectRoot, resolved);
|
|
202430
202431
|
srcPath = resolvedRel;
|
|
202431
202432
|
}
|
|
202432
202433
|
return `${prefix}${srcUrl(srcPath, projectRoot)}${suffix}`;
|
|
202433
202434
|
});
|
|
202434
202435
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => {
|
|
202435
202436
|
const absPath = resolve18(fileDir, relPath);
|
|
202436
|
-
const rel =
|
|
202437
|
+
const rel = relative8(projectRoot, absPath);
|
|
202437
202438
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
202438
202439
|
});
|
|
202439
202440
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => {
|
|
202440
202441
|
const absPath = resolve18(fileDir, relPath);
|
|
202441
|
-
const rel =
|
|
202442
|
+
const rel = relative8(projectRoot, absPath);
|
|
202442
202443
|
let srcPath = rel;
|
|
202443
202444
|
if (!extname3(srcPath)) {
|
|
202444
202445
|
const extensions = [
|
|
@@ -202462,10 +202463,10 @@ ${stubs}
|
|
|
202462
202463
|
});
|
|
202463
202464
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
202464
202465
|
if (absPath.startsWith(projectRoot)) {
|
|
202465
|
-
const rel2 =
|
|
202466
|
+
const rel2 = relative8(projectRoot, absPath).replace(/\\/g, "/");
|
|
202466
202467
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
202467
202468
|
}
|
|
202468
|
-
const rel =
|
|
202469
|
+
const rel = relative8(projectRoot, absPath).replace(/\\/g, "/");
|
|
202469
202470
|
if (!rel.startsWith("..")) {
|
|
202470
202471
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
202471
202472
|
}
|
|
@@ -202507,7 +202508,7 @@ ${stubs}
|
|
|
202507
202508
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
202508
202509
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
202509
202510
|
` + transpiled;
|
|
202510
|
-
const relPath =
|
|
202511
|
+
const relPath = relative8(projectRoot, filePath).replace(/\\/g, "/");
|
|
202511
202512
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
202512
202513
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
202513
202514
|
}, transformPlainFile = (filePath, projectRoot, rewriter) => {
|
|
@@ -202574,11 +202575,11 @@ ${stubs}
|
|
|
202574
202575
|
if (compiled.css?.code) {
|
|
202575
202576
|
const cssPath = `${filePath}.css`;
|
|
202576
202577
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
202577
|
-
const cssUrl = srcUrl(
|
|
202578
|
+
const cssUrl = srcUrl(relative8(projectRoot, cssPath), projectRoot);
|
|
202578
202579
|
code = `import "${cssUrl}";
|
|
202579
202580
|
${code}`;
|
|
202580
202581
|
}
|
|
202581
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
202582
|
+
const moduleUrl = `${SRC_PREFIX}${relative8(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
202582
202583
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
202583
202584
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
202584
202585
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -202642,7 +202643,7 @@ ${code}`;
|
|
|
202642
202643
|
}
|
|
202643
202644
|
code = tsTranspiler2.transformSync(code);
|
|
202644
202645
|
const hmrBase = vueDir ? resolve18(vueDir) : projectRoot;
|
|
202645
|
-
const hmrId =
|
|
202646
|
+
const hmrId = relative8(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
202646
202647
|
code = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
202647
202648
|
code += [
|
|
202648
202649
|
"",
|
|
@@ -202988,7 +202989,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
202988
202989
|
// src/dev/rebuildTrigger.ts
|
|
202989
202990
|
import { existsSync as existsSync14 } from "fs";
|
|
202990
202991
|
import { rm as rm8 } from "fs/promises";
|
|
202991
|
-
import { basename as basename8, relative as
|
|
202992
|
+
import { basename as basename8, relative as relative9, resolve as resolve21 } from "path";
|
|
202992
202993
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
202993
202994
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
202994
202995
|
if (pathLineCol) {
|
|
@@ -203422,7 +203423,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203422
203423
|
}, getModuleUrl = async (pageFile) => {
|
|
203423
203424
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
203424
203425
|
invalidateModule2(pageFile);
|
|
203425
|
-
const rel =
|
|
203426
|
+
const rel = relative9(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
203426
203427
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
203427
203428
|
warmCache2(url);
|
|
203428
203429
|
return url;
|
|
@@ -203475,12 +203476,17 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203475
203476
|
}
|
|
203476
203477
|
}
|
|
203477
203478
|
const pageModuleUrl = await getReactModuleUrl(broadcastFile);
|
|
203479
|
+
let dataModuleUrl;
|
|
203480
|
+
if (!isComponentFile && broadcastFile !== primaryFile) {
|
|
203481
|
+
dataModuleUrl = await getReactModuleUrl(primaryFile);
|
|
203482
|
+
}
|
|
203478
203483
|
if (pageModuleUrl) {
|
|
203479
203484
|
const serverDuration = Date.now() - startTime;
|
|
203480
|
-
state.lastHmrPath =
|
|
203485
|
+
state.lastHmrPath = relative9(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
203481
203486
|
state.lastHmrFramework = "react";
|
|
203482
203487
|
broadcastToClients(state, {
|
|
203483
203488
|
data: {
|
|
203489
|
+
dataModuleUrl,
|
|
203484
203490
|
framework: "react",
|
|
203485
203491
|
hasComponentChanges: true,
|
|
203486
203492
|
hasCSSChanges: false,
|
|
@@ -203863,7 +203869,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203863
203869
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
203864
203870
|
const pascalName = toPascal(baseName);
|
|
203865
203871
|
const vueRoot = config.vueDirectory;
|
|
203866
|
-
const hmrId = vueRoot ?
|
|
203872
|
+
const hmrId = vueRoot ? relative9(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
203867
203873
|
const cssKey = `${pascalName}CSS`;
|
|
203868
203874
|
const cssUrl = manifest[cssKey] || null;
|
|
203869
203875
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
@@ -205002,7 +205008,7 @@ var handleHTMLPageRequest = (pagePath) => file(pagePath);
|
|
|
205002
205008
|
var handleHTMXPageRequest = (pagePath) => file(pagePath);
|
|
205003
205009
|
// src/core/prepare.ts
|
|
205004
205010
|
import { readFileSync as readFileSync10 } from "fs";
|
|
205005
|
-
import { relative as
|
|
205011
|
+
import { relative as relative11, resolve as resolve23 } from "path";
|
|
205006
205012
|
|
|
205007
205013
|
// src/utils/loadConfig.ts
|
|
205008
205014
|
import { resolve } from "path";
|
|
@@ -205064,7 +205070,7 @@ var prepare = async (configOrPath) => {
|
|
|
205064
205070
|
cwd: resolve23(dir),
|
|
205065
205071
|
absolute: true
|
|
205066
205072
|
})) {
|
|
205067
|
-
const rel =
|
|
205073
|
+
const rel = relative11(process.cwd(), file4).replace(/\\/g, "/");
|
|
205068
205074
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
205069
205075
|
}
|
|
205070
205076
|
}
|
|
@@ -205074,7 +205080,7 @@ var prepare = async (configOrPath) => {
|
|
|
205074
205080
|
if (key.endsWith("Index") && typeof result.manifest[key] === "string" && result.manifest[key].includes("/react/") && result.manifest[key].includes("/indexes/")) {
|
|
205075
205081
|
const fileName = `${key.replace(/Index$/, "")}.tsx`;
|
|
205076
205082
|
const srcPath = resolve23(devIndexDir, fileName);
|
|
205077
|
-
const rel =
|
|
205083
|
+
const rel = relative11(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
205078
205084
|
result.manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
205079
205085
|
}
|
|
205080
205086
|
}
|
|
@@ -205244,5 +205250,5 @@ export {
|
|
|
205244
205250
|
ANGULAR_INIT_TIMEOUT_MS
|
|
205245
205251
|
};
|
|
205246
205252
|
|
|
205247
|
-
//# debugId=
|
|
205253
|
+
//# debugId=B320936B9473DFEE64756E2164756E21
|
|
205248
205254
|
//# sourceMappingURL=index.js.map
|