@absolutejs/absolute 0.19.0-beta.107 → 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 -51
- package/dist/build.js.map +3 -3
- package/dist/index.js +70 -54
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
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) => {
|
|
@@ -171783,7 +171799,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
|
|
|
171783
171799
|
const devIndexDir = join13(buildPath, "_src_indexes");
|
|
171784
171800
|
mkdirSync8(devIndexDir, { recursive: true });
|
|
171785
171801
|
const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
|
|
171786
|
-
const pagesRel =
|
|
171802
|
+
const pagesRel = relative7(process.cwd(), resolve11(reactPagesPath)).replace(/\\/g, "/");
|
|
171787
171803
|
for (const file4 of indexFiles) {
|
|
171788
171804
|
let content = readFileSync5(join13(reactIndexesPath, file4), "utf-8");
|
|
171789
171805
|
content = content.replace(/from\s*['"]\.\.\/pages\/([^'"]+)['"]/g, `from '/@src/${pagesRel}/$1'`);
|
|
@@ -202393,7 +202409,7 @@ __export(exports_moduleServer, {
|
|
|
202393
202409
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
202394
202410
|
});
|
|
202395
202411
|
import { existsSync as existsSync13, readFileSync as readFileSync9, statSync } from "fs";
|
|
202396
|
-
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";
|
|
202397
202413
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
202398
202414
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
202399
202415
|
const allExports = [];
|
|
@@ -202456,7 +202472,7 @@ ${stubs}
|
|
|
202456
202472
|
const fileDir = dirname7(filePath);
|
|
202457
202473
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => {
|
|
202458
202474
|
const absPath = resolve18(fileDir, relPath);
|
|
202459
|
-
const rel =
|
|
202475
|
+
const rel = relative8(projectRoot, absPath);
|
|
202460
202476
|
let srcPath = rel;
|
|
202461
202477
|
if (!extname3(srcPath)) {
|
|
202462
202478
|
const extensions = [
|
|
@@ -202477,19 +202493,19 @@ ${stubs}
|
|
|
202477
202493
|
}
|
|
202478
202494
|
if (extname3(srcPath) === ".svelte") {
|
|
202479
202495
|
const resolved = resolveSvelteModulePath(resolve18(projectRoot, srcPath));
|
|
202480
|
-
const resolvedRel =
|
|
202496
|
+
const resolvedRel = relative8(projectRoot, resolved);
|
|
202481
202497
|
srcPath = resolvedRel;
|
|
202482
202498
|
}
|
|
202483
202499
|
return `${prefix}${srcUrl(srcPath, projectRoot)}${suffix}`;
|
|
202484
202500
|
});
|
|
202485
202501
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => {
|
|
202486
202502
|
const absPath = resolve18(fileDir, relPath);
|
|
202487
|
-
const rel =
|
|
202503
|
+
const rel = relative8(projectRoot, absPath);
|
|
202488
202504
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
202489
202505
|
});
|
|
202490
202506
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => {
|
|
202491
202507
|
const absPath = resolve18(fileDir, relPath);
|
|
202492
|
-
const rel =
|
|
202508
|
+
const rel = relative8(projectRoot, absPath);
|
|
202493
202509
|
let srcPath = rel;
|
|
202494
202510
|
if (!extname3(srcPath)) {
|
|
202495
202511
|
const extensions = [
|
|
@@ -202513,10 +202529,10 @@ ${stubs}
|
|
|
202513
202529
|
});
|
|
202514
202530
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
202515
202531
|
if (absPath.startsWith(projectRoot)) {
|
|
202516
|
-
const rel2 =
|
|
202532
|
+
const rel2 = relative8(projectRoot, absPath).replace(/\\/g, "/");
|
|
202517
202533
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
202518
202534
|
}
|
|
202519
|
-
const rel =
|
|
202535
|
+
const rel = relative8(projectRoot, absPath).replace(/\\/g, "/");
|
|
202520
202536
|
if (!rel.startsWith("..")) {
|
|
202521
202537
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
202522
202538
|
}
|
|
@@ -202558,7 +202574,7 @@ ${stubs}
|
|
|
202558
202574
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
202559
202575
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
202560
202576
|
` + transpiled;
|
|
202561
|
-
const relPath =
|
|
202577
|
+
const relPath = relative8(projectRoot, filePath).replace(/\\/g, "/");
|
|
202562
202578
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
202563
202579
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
202564
202580
|
}, transformPlainFile = (filePath, projectRoot, rewriter) => {
|
|
@@ -202625,11 +202641,11 @@ ${stubs}
|
|
|
202625
202641
|
if (compiled.css?.code) {
|
|
202626
202642
|
const cssPath = `${filePath}.css`;
|
|
202627
202643
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
202628
|
-
const cssUrl = srcUrl(
|
|
202644
|
+
const cssUrl = srcUrl(relative8(projectRoot, cssPath), projectRoot);
|
|
202629
202645
|
code = `import "${cssUrl}";
|
|
202630
202646
|
${code}`;
|
|
202631
202647
|
}
|
|
202632
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
202648
|
+
const moduleUrl = `${SRC_PREFIX}${relative8(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
202633
202649
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
202634
202650
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
202635
202651
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -202693,7 +202709,7 @@ ${code}`;
|
|
|
202693
202709
|
}
|
|
202694
202710
|
code = tsTranspiler2.transformSync(code);
|
|
202695
202711
|
const hmrBase = vueDir ? resolve18(vueDir) : projectRoot;
|
|
202696
|
-
const hmrId =
|
|
202712
|
+
const hmrId = relative8(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
202697
202713
|
code = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
202698
202714
|
code += [
|
|
202699
202715
|
"",
|
|
@@ -203056,7 +203072,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
203056
203072
|
// src/dev/rebuildTrigger.ts
|
|
203057
203073
|
import { existsSync as existsSync14 } from "fs";
|
|
203058
203074
|
import { rm as rm8 } from "fs/promises";
|
|
203059
|
-
import { basename as basename8, relative as
|
|
203075
|
+
import { basename as basename8, relative as relative9, resolve as resolve21 } from "path";
|
|
203060
203076
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
203061
203077
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
203062
203078
|
if (pathLineCol) {
|
|
@@ -203490,7 +203506,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203490
203506
|
}, getModuleUrl = async (pageFile) => {
|
|
203491
203507
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
203492
203508
|
invalidateModule2(pageFile);
|
|
203493
|
-
const rel =
|
|
203509
|
+
const rel = relative9(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
203494
203510
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
203495
203511
|
warmCache2(url);
|
|
203496
203512
|
return url;
|
|
@@ -203527,7 +203543,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203527
203543
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
203528
203544
|
if (pageModuleUrl) {
|
|
203529
203545
|
const serverDuration = Date.now() - startTime;
|
|
203530
|
-
state.lastHmrPath =
|
|
203546
|
+
state.lastHmrPath = relative9(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
203531
203547
|
state.lastHmrFramework = "react";
|
|
203532
203548
|
broadcastToClients(state, {
|
|
203533
203549
|
data: {
|
|
@@ -203913,7 +203929,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
203913
203929
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
203914
203930
|
const pascalName = toPascal(baseName);
|
|
203915
203931
|
const vueRoot = config.vueDirectory;
|
|
203916
|
-
const hmrId = vueRoot ?
|
|
203932
|
+
const hmrId = vueRoot ? relative9(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
203917
203933
|
const cssKey = `${pascalName}CSS`;
|
|
203918
203934
|
const cssUrl = manifest[cssKey] || null;
|
|
203919
203935
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
@@ -205065,7 +205081,7 @@ var handleHTMLPageRequest = (pagePath) => file(pagePath);
|
|
|
205065
205081
|
var handleHTMXPageRequest = (pagePath) => file(pagePath);
|
|
205066
205082
|
// src/core/prepare.ts
|
|
205067
205083
|
import { readFileSync as readFileSync10 } from "fs";
|
|
205068
|
-
import { relative as
|
|
205084
|
+
import { relative as relative11, resolve as resolve23 } from "path";
|
|
205069
205085
|
|
|
205070
205086
|
// src/utils/loadConfig.ts
|
|
205071
205087
|
import { resolve } from "path";
|
|
@@ -205144,7 +205160,7 @@ var prepare = async (configOrPath) => {
|
|
|
205144
205160
|
})) {
|
|
205145
205161
|
if (file4.includes("/node_modules/"))
|
|
205146
205162
|
continue;
|
|
205147
|
-
const rel =
|
|
205163
|
+
const rel = relative11(process.cwd(), file4).replace(/\\/g, "/");
|
|
205148
205164
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
205149
205165
|
}
|
|
205150
205166
|
}
|
|
@@ -205154,7 +205170,7 @@ var prepare = async (configOrPath) => {
|
|
|
205154
205170
|
if (key.endsWith("Index") && typeof result.manifest[key] === "string" && result.manifest[key].includes("/react/") && result.manifest[key].includes("/indexes/")) {
|
|
205155
205171
|
const fileName = `${key.replace(/Index$/, "")}.tsx`;
|
|
205156
205172
|
const srcPath = resolve23(devIndexDir, fileName);
|
|
205157
|
-
const rel =
|
|
205173
|
+
const rel = relative11(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
205158
205174
|
result.manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
205159
205175
|
}
|
|
205160
205176
|
}
|
|
@@ -205324,5 +205340,5 @@ export {
|
|
|
205324
205340
|
ANGULAR_INIT_TIMEOUT_MS
|
|
205325
205341
|
};
|
|
205326
205342
|
|
|
205327
|
-
//# debugId=
|
|
205343
|
+
//# debugId=1E29419E90128A2F64756E2164756E21
|
|
205328
205344
|
//# sourceMappingURL=index.js.map
|