@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
package/dist/build.js
CHANGED
|
@@ -123,7 +123,7 @@ __export(exports_generateReactIndexes, {
|
|
|
123
123
|
});
|
|
124
124
|
import { existsSync, mkdirSync } from "fs";
|
|
125
125
|
import { readdir, rm, writeFile } from "fs/promises";
|
|
126
|
-
import { basename, join, resolve } from "path";
|
|
126
|
+
import { basename, join, relative, resolve } from "path";
|
|
127
127
|
var {Glob } = globalThis.Bun;
|
|
128
128
|
var indexContentCache, resolveDevClientDir = () => {
|
|
129
129
|
const fromSource = resolve(import.meta.dir, "../dev/client");
|
|
@@ -412,7 +412,23 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
412
412
|
` originalError.apply(console, args);`,
|
|
413
413
|
` };`,
|
|
414
414
|
` }`,
|
|
415
|
-
`}
|
|
415
|
+
`}`,
|
|
416
|
+
...isDev ? [
|
|
417
|
+
`
|
|
418
|
+
// Pre-warm the module server cache after hydration.`,
|
|
419
|
+
`// Silently imports the page module so the browser caches`,
|
|
420
|
+
`// all /@src/ URLs. First HMR edit hits warm cache (~20ms)`,
|
|
421
|
+
`// instead of cold fetches (~500ms).`,
|
|
422
|
+
`if (typeof requestIdleCallback !== 'undefined') {`,
|
|
423
|
+
` requestIdleCallback(() => {`,
|
|
424
|
+
` import('/@src/${relative(process.cwd(), resolve(reactPagesDirectory, componentName + ".tsx")).replace(/\\/g, "/")}').catch(() => {});`,
|
|
425
|
+
` });`,
|
|
426
|
+
`} else {`,
|
|
427
|
+
` setTimeout(() => {`,
|
|
428
|
+
` import('/@src/${relative(process.cwd(), resolve(reactPagesDirectory, componentName + ".tsx")).replace(/\\/g, "/")}').catch(() => {});`,
|
|
429
|
+
` }, 1000);`,
|
|
430
|
+
`}`
|
|
431
|
+
] : []
|
|
416
432
|
].join(`
|
|
417
433
|
`);
|
|
418
434
|
const indexPath = join(reactIndexesDirectory, `${componentName}.tsx`);
|
|
@@ -866,7 +882,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
866
882
|
|
|
867
883
|
// src/build/angularLinkerPlugin.ts
|
|
868
884
|
import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
869
|
-
import { dirname as dirname2, join as join4, relative, resolve as resolve4 } from "path";
|
|
885
|
+
import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve4 } from "path";
|
|
870
886
|
import { createHash } from "crypto";
|
|
871
887
|
var CACHE_DIR, angularLinkerPlugin;
|
|
872
888
|
var init_angularLinkerPlugin = __esm(() => {
|
|
@@ -909,7 +925,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
909
925
|
dirname: dirname2,
|
|
910
926
|
exists: existsSync7,
|
|
911
927
|
readFile: readFileSync3,
|
|
912
|
-
relative,
|
|
928
|
+
relative: relative2,
|
|
913
929
|
resolve: resolve4
|
|
914
930
|
},
|
|
915
931
|
linkerJitMode: false,
|
|
@@ -950,11 +966,11 @@ var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPath
|
|
|
950
966
|
const currentPaths = new Set(currentOutputPaths.map((path) => resolve5(path)));
|
|
951
967
|
const glob = new Glob4("**/*");
|
|
952
968
|
const removals = [];
|
|
953
|
-
for (const
|
|
954
|
-
const absolute = resolve5(buildPath,
|
|
969
|
+
for (const relative3 of glob.scanSync({ cwd: buildPath })) {
|
|
970
|
+
const absolute = resolve5(buildPath, relative3);
|
|
955
971
|
if (currentPaths.has(absolute))
|
|
956
972
|
continue;
|
|
957
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
973
|
+
if (!HASHED_FILE_PATTERN.test(relative3))
|
|
958
974
|
continue;
|
|
959
975
|
removals.push(rm2(absolute, { force: true }));
|
|
960
976
|
}
|
|
@@ -1108,12 +1124,12 @@ var init_startupBanner = __esm(() => {
|
|
|
1108
1124
|
// src/utils/logger.ts
|
|
1109
1125
|
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
1110
1126
|
const cwd = process.cwd();
|
|
1111
|
-
let
|
|
1112
|
-
|
|
1113
|
-
if (!
|
|
1114
|
-
|
|
1127
|
+
let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
1128
|
+
relative3 = relative3.replace(/\\/g, "/");
|
|
1129
|
+
if (!relative3.startsWith("/")) {
|
|
1130
|
+
relative3 = `/${relative3}`;
|
|
1115
1131
|
}
|
|
1116
|
-
return
|
|
1132
|
+
return relative3;
|
|
1117
1133
|
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
1118
1134
|
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1119
1135
|
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
@@ -1172,11 +1188,11 @@ var init_logger = __esm(() => {
|
|
|
1172
1188
|
});
|
|
1173
1189
|
|
|
1174
1190
|
// src/utils/validateSafePath.ts
|
|
1175
|
-
import { resolve as resolve6, relative as
|
|
1191
|
+
import { resolve as resolve6, relative as relative3 } from "path";
|
|
1176
1192
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
1177
1193
|
const absoluteBase = resolve6(baseDirectory);
|
|
1178
1194
|
const absoluteTarget = resolve6(baseDirectory, targetPath);
|
|
1179
|
-
const relativePath = normalizePath(
|
|
1195
|
+
const relativePath = normalizePath(relative3(absoluteBase, absoluteTarget));
|
|
1180
1196
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
1181
1197
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
1182
1198
|
}
|
|
@@ -1198,7 +1214,7 @@ import {
|
|
|
1198
1214
|
basename as basename2,
|
|
1199
1215
|
extname as extname2,
|
|
1200
1216
|
resolve as resolve7,
|
|
1201
|
-
relative as
|
|
1217
|
+
relative as relative4,
|
|
1202
1218
|
sep
|
|
1203
1219
|
} from "path";
|
|
1204
1220
|
import { env } from "process";
|
|
@@ -1262,7 +1278,7 @@ var resolveDevClientDir2 = () => {
|
|
|
1262
1278
|
const isModule = src.endsWith(".svelte.ts") || src.endsWith(".svelte.js");
|
|
1263
1279
|
const preprocessed = isModule ? raw : (await preprocess(raw, {})).code;
|
|
1264
1280
|
const transpiled = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed) : preprocessed;
|
|
1265
|
-
const relDir = dirname3(
|
|
1281
|
+
const relDir = dirname3(relative4(svelteRoot, src)).replace(/\\/g, "/");
|
|
1266
1282
|
const baseName = basename2(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
1267
1283
|
const importPaths = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
1268
1284
|
const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
|
|
@@ -1281,7 +1297,7 @@ var resolveDevClientDir2 = () => {
|
|
|
1281
1297
|
}).js.code;
|
|
1282
1298
|
let code = raw2.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
1283
1299
|
if (mode === "client" && isDev) {
|
|
1284
|
-
const moduleKey = `/@src/${
|
|
1300
|
+
const moduleKey = `/@src/${relative4(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
1285
1301
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
1286
1302
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
1287
1303
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -1316,10 +1332,10 @@ var resolveDevClientDir2 = () => {
|
|
|
1316
1332
|
};
|
|
1317
1333
|
const roots = await Promise.all(entryPoints.map(build));
|
|
1318
1334
|
await Promise.all(roots.map(async ({ client }) => {
|
|
1319
|
-
const relClientDir = dirname3(
|
|
1335
|
+
const relClientDir = dirname3(relative4(clientDir, client));
|
|
1320
1336
|
const name = basename2(client, extname2(client));
|
|
1321
1337
|
const indexPath = join6(indexDir, relClientDir, `${name}.js`);
|
|
1322
|
-
const importRaw =
|
|
1338
|
+
const importRaw = relative4(dirname3(indexPath), client).split(sep).join("/");
|
|
1323
1339
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
1324
1340
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
1325
1341
|
import "${hmrClientPath3}";
|
|
@@ -1359,7 +1375,7 @@ if (typeof window !== "undefined") {
|
|
|
1359
1375
|
return {
|
|
1360
1376
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
1361
1377
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
1362
|
-
const rel = dirname3(
|
|
1378
|
+
const rel = dirname3(relative4(clientDir, client));
|
|
1363
1379
|
return join6(indexDir, rel, basename2(client));
|
|
1364
1380
|
}),
|
|
1365
1381
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -1384,7 +1400,7 @@ __export(exports_compileVue, {
|
|
|
1384
1400
|
});
|
|
1385
1401
|
import { existsSync as existsSync9 } from "fs";
|
|
1386
1402
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
1387
|
-
import { basename as basename3, dirname as dirname4, join as join7, relative as
|
|
1403
|
+
import { basename as basename3, dirname as dirname4, join as join7, relative as relative5, resolve as resolve8 } from "path";
|
|
1388
1404
|
var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
1389
1405
|
var resolveDevClientDir3 = () => {
|
|
1390
1406
|
const fromSource = resolve8(import.meta.dir, "../dev/client");
|
|
@@ -1429,7 +1445,7 @@ var resolveDevClientDir3 = () => {
|
|
|
1429
1445
|
return "template-only";
|
|
1430
1446
|
}
|
|
1431
1447
|
return "full";
|
|
1432
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
1448
|
+
}, 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) => {
|
|
1433
1449
|
if (filePath.endsWith(".vue"))
|
|
1434
1450
|
return filePath.replace(/\.vue$/, ".js");
|
|
1435
1451
|
if (filePath.endsWith(".ts"))
|
|
@@ -1456,7 +1472,7 @@ var resolveDevClientDir3 = () => {
|
|
|
1456
1472
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
1457
1473
|
if (cachedResult)
|
|
1458
1474
|
return cachedResult;
|
|
1459
|
-
const relativeFilePath =
|
|
1475
|
+
const relativeFilePath = relative5(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
1460
1476
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
1461
1477
|
const fileBaseName = basename3(sourceFilePath, ".vue");
|
|
1462
1478
|
const componentId = toKebab(fileBaseName);
|
|
@@ -1585,7 +1601,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1585
1601
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
1586
1602
|
const entryBaseName = basename3(entryPath, ".vue");
|
|
1587
1603
|
const indexOutputFile = join7(indexOutputDir, `${entryBaseName}.js`);
|
|
1588
|
-
const clientOutputFile = join7(clientOutputDir,
|
|
1604
|
+
const clientOutputFile = join7(clientOutputDir, relative5(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
1589
1605
|
await mkdir2(dirname4(indexOutputFile), { recursive: true });
|
|
1590
1606
|
const vueHmrImports = isDev ? [
|
|
1591
1607
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -1593,7 +1609,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1593
1609
|
] : [];
|
|
1594
1610
|
await write2(indexOutputFile, [
|
|
1595
1611
|
...vueHmrImports,
|
|
1596
|
-
`import Comp from "${
|
|
1612
|
+
`import Comp from "${relative5(dirname4(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
1597
1613
|
'import { createSSRApp, createApp } from "vue";',
|
|
1598
1614
|
"",
|
|
1599
1615
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -1693,7 +1709,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
1693
1709
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
1694
1710
|
const sourceCode = await file2(tsPath).text();
|
|
1695
1711
|
const transpiledCode = transpiler2.transformSync(sourceCode);
|
|
1696
|
-
const relativeJsPath =
|
|
1712
|
+
const relativeJsPath = relative5(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
1697
1713
|
const outClientPath = join7(clientOutputDir, relativeJsPath);
|
|
1698
1714
|
const outServerPath = join7(serverOutputDir, relativeJsPath);
|
|
1699
1715
|
await mkdir2(dirname4(outClientPath), { recursive: true });
|
|
@@ -10583,11 +10599,11 @@ ${lanes.join(`
|
|
|
10583
10599
|
return toComponents;
|
|
10584
10600
|
}
|
|
10585
10601
|
const components = toComponents.slice(start);
|
|
10586
|
-
const
|
|
10602
|
+
const relative6 = [];
|
|
10587
10603
|
for (;start < fromComponents.length; start++) {
|
|
10588
|
-
|
|
10604
|
+
relative6.push("..");
|
|
10589
10605
|
}
|
|
10590
|
-
return ["", ...
|
|
10606
|
+
return ["", ...relative6, ...components];
|
|
10591
10607
|
}
|
|
10592
10608
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
10593
10609
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -47883,9 +47899,9 @@ ${lanes.join(`
|
|
|
47883
47899
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
47884
47900
|
return;
|
|
47885
47901
|
}
|
|
47886
|
-
const
|
|
47902
|
+
const relative6 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
47887
47903
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
47888
|
-
const option = resolvePath(symlinkDirectory,
|
|
47904
|
+
const option = resolvePath(symlinkDirectory, relative6);
|
|
47889
47905
|
const result2 = cb(option, target === referenceRedirect);
|
|
47890
47906
|
shouldFilterIgnoredPaths = true;
|
|
47891
47907
|
if (result2)
|
|
@@ -170451,7 +170467,7 @@ __export(exports_compileAngular, {
|
|
|
170451
170467
|
compileAngular: () => compileAngular
|
|
170452
170468
|
});
|
|
170453
170469
|
import { existsSync as existsSync10, readFileSync as readFileSync4, promises as fs } from "fs";
|
|
170454
|
-
import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve9, relative as
|
|
170470
|
+
import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve9, relative as relative6 } from "path";
|
|
170455
170471
|
import { createHash as createHash2 } from "crypto";
|
|
170456
170472
|
var import_typescript, computeConfigHash = () => {
|
|
170457
170473
|
try {
|
|
@@ -170760,7 +170776,7 @@ export default ${componentClassName};
|
|
|
170760
170776
|
await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
|
|
170761
170777
|
}
|
|
170762
170778
|
await fs.writeFile(rawServerFile, rewritten, "utf-8");
|
|
170763
|
-
const relativePath =
|
|
170779
|
+
const relativePath = relative6(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
170764
170780
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
170765
170781
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
170766
170782
|
import "${hmrRuntimePath}";
|
|
@@ -171139,7 +171155,7 @@ import {
|
|
|
171139
171155
|
rmSync,
|
|
171140
171156
|
writeFileSync as writeFileSync3
|
|
171141
171157
|
} from "fs";
|
|
171142
|
-
import { basename as basename5, join as join13, relative as
|
|
171158
|
+
import { basename as basename5, join as join13, relative as relative7, resolve as resolve10 } from "path";
|
|
171143
171159
|
import { cwd, env as env2, exit } from "process";
|
|
171144
171160
|
var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
|
|
171145
171161
|
var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
|
|
@@ -171561,20 +171577,6 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171561
171577
|
}
|
|
171562
171578
|
const reactClientLogs = reactClientResult?.logs ?? [];
|
|
171563
171579
|
const reactClientOutputs = reactClientResult?.outputs ?? [];
|
|
171564
|
-
if (hmr && reactClientOutputs.length > 0) {
|
|
171565
|
-
console.log(`[build] stripping refresh noop from ${reactClientOutputs.filter((o) => o.kind === "entry-point").length} entry points`);
|
|
171566
|
-
const REFRESH_NOOP = "window.$RefreshReg$||(window.$RefreshReg$=function(){});window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});";
|
|
171567
|
-
for (const output of reactClientOutputs) {
|
|
171568
|
-
if (output.kind !== "entry-point")
|
|
171569
|
-
continue;
|
|
171570
|
-
try {
|
|
171571
|
-
const content = await Bun.file(output.path).text();
|
|
171572
|
-
if (content.includes(REFRESH_NOOP)) {
|
|
171573
|
-
writeFileSync3(output.path, content.replace(REFRESH_NOOP, "").replace(/^\n/, ""));
|
|
171574
|
-
}
|
|
171575
|
-
} catch {}
|
|
171576
|
-
}
|
|
171577
|
-
}
|
|
171578
171580
|
if (reactClientResult && !reactClientResult.success && reactClientLogs.length > 0) {
|
|
171579
171581
|
extractBuildError(reactClientLogs, "react-client", "React client", frameworkNames, isIncremental, throwOnError);
|
|
171580
171582
|
}
|
|
@@ -171718,7 +171720,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171718
171720
|
const devIndexDir = join13(buildPath, "_src_indexes");
|
|
171719
171721
|
mkdirSync8(devIndexDir, { recursive: true });
|
|
171720
171722
|
const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
|
|
171721
|
-
const pagesRel =
|
|
171723
|
+
const pagesRel = relative7(process.cwd(), resolve10(reactPagesPath)).replace(/\\/g, "/");
|
|
171722
171724
|
for (const file3 of indexFiles) {
|
|
171723
171725
|
let content = readFileSync5(join13(reactIndexesPath, file3), "utf-8");
|
|
171724
171726
|
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 resolve17, relative as
|
|
202412
|
+
import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve17, 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 = resolve17(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(resolve17(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 = resolve17(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 = resolve17(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 ? resolve17(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 resolve20 } 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));
|
|
@@ -204933,5 +204923,5 @@ export {
|
|
|
204933
204923
|
build
|
|
204934
204924
|
};
|
|
204935
204925
|
|
|
204936
|
-
//# debugId=
|
|
204926
|
+
//# debugId=1C344ED8705E021964756E2164756E21
|
|
204937
204927
|
//# sourceMappingURL=build.js.map
|