@absolutejs/absolute 0.19.0-beta.101 → 0.19.0-beta.103

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.
@@ -34,12 +34,6 @@ export const handleReactUpdate = (message: {
34
34
  const serverDuration = message.data.serverDuration;
35
35
  const pageModuleUrl = message.data.pageModuleUrl;
36
36
 
37
- // If the root accept handler is active (index file re-renders
38
- // the root), skip the Fast Refresh import — root.render() handles it.
39
- if ((window as unknown as Record<string, unknown>).__HMR_ROOT_ACCEPT__) {
40
- return;
41
- }
42
-
43
37
  if (pageModuleUrl && refreshRuntime) {
44
38
  applyRefreshImport(pageModuleUrl, refreshRuntime, serverDuration);
45
39
 
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, relative, resolve as resolve2 } from "path";
205
+ import { basename, join, 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,42 +491,7 @@ var indexContentCache, resolveDevClientDir = () => {
491
491
  ` originalError.apply(console, args);`,
492
492
  ` };`,
493
493
  ` }`,
494
- `}`,
495
- ...isDev ? [
496
- `
497
- // HMR: re-import the page component and re-render the root.`,
498
- `// This is the Vite-style approach \u2014 the index file is the`,
499
- `// HMR boundary. Works for all patterns: dynamic imports,`,
500
- `// lazy loading, portals, data files.`,
501
- `if (window.__HMR_WS__ && window.__REACT_ROOT__ && !window.__HMR_ROOT_ACCEPT__) {`,
502
- ` window.__HMR_ROOT_ACCEPT__ = true;`,
503
- ` const origOnMessage = window.__HMR_WS__.onmessage;`,
504
- ` window.__HMR_WS__.onmessage = function(event) {`,
505
- ` if (origOnMessage) origOnMessage.call(this, event);`,
506
- ` try {`,
507
- ` const msg = JSON.parse(event.data);`,
508
- ` if (msg.type === 'react-update') {`,
509
- ` const url = "/@src/${relative(process.cwd(), resolve2(reactPagesDirectory, componentName + ".tsx")).replace(/\\/g, "/")}";`,
510
- ` const start = performance.now();`,
511
- ` import(url + '?t=' + Date.now()).then(mod => {`,
512
- ` const Comp = mod.${componentName} || mod.default;`,
513
- ` if (Comp && window.__REACT_ROOT__) {`,
514
- ` const props = window.__INITIAL_PROPS__ || {};`,
515
- ` window.__REACT_ROOT__.render(`,
516
- ` ${isDev ? `createElement(ErrorBoundary, null, createElement(Comp, props))` : `createElement(Comp, props)`}`,
517
- ` );`,
518
- ` if (window.__HMR_WS__) {`,
519
- ` const ms = Math.round(performance.now() - start);`,
520
- ` const total = (msg.data.serverDuration || 0) + ms;`,
521
- ` window.__HMR_WS__.send(JSON.stringify({ type: 'hmr-timing', duration: total }));`,
522
- ` }`,
523
- ` }`,
524
- ` }).catch(() => {});`,
525
- ` }`,
526
- ` } catch {}`,
527
- ` };`,
528
- `}`
529
- ] : []
494
+ `}`
530
495
  ].join(`
531
496
  `);
532
497
  const indexPath = join(reactIndexesDirectory, `${componentName}.tsx`);
@@ -980,7 +945,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
980
945
 
981
946
  // src/build/angularLinkerPlugin.ts
982
947
  import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
983
- import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve5 } from "path";
948
+ import { dirname as dirname2, join as join4, relative, resolve as resolve5 } from "path";
984
949
  import { createHash } from "crypto";
985
950
  var CACHE_DIR, angularLinkerPlugin;
986
951
  var init_angularLinkerPlugin = __esm(() => {
@@ -1023,7 +988,7 @@ var init_angularLinkerPlugin = __esm(() => {
1023
988
  dirname: dirname2,
1024
989
  exists: existsSync7,
1025
990
  readFile: readFileSync3,
1026
- relative: relative2,
991
+ relative,
1027
992
  resolve: resolve5
1028
993
  },
1029
994
  linkerJitMode: false,
@@ -1064,11 +1029,11 @@ var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPath
1064
1029
  const currentPaths = new Set(currentOutputPaths.map((path) => resolve6(path)));
1065
1030
  const glob = new Glob4("**/*");
1066
1031
  const removals = [];
1067
- for (const relative3 of glob.scanSync({ cwd: buildPath })) {
1068
- const absolute = resolve6(buildPath, relative3);
1032
+ for (const relative2 of glob.scanSync({ cwd: buildPath })) {
1033
+ const absolute = resolve6(buildPath, relative2);
1069
1034
  if (currentPaths.has(absolute))
1070
1035
  continue;
1071
- if (!HASHED_FILE_PATTERN.test(relative3))
1036
+ if (!HASHED_FILE_PATTERN.test(relative2))
1072
1037
  continue;
1073
1038
  removals.push(rm2(absolute, { force: true }));
1074
1039
  }
@@ -1222,12 +1187,12 @@ var init_startupBanner = __esm(() => {
1222
1187
  // src/utils/logger.ts
1223
1188
  var colors2, frameworkColors, formatPath = (filePath) => {
1224
1189
  const cwd = process.cwd();
1225
- let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
1226
- relative3 = relative3.replace(/\\/g, "/");
1227
- if (!relative3.startsWith("/")) {
1228
- relative3 = `/${relative3}`;
1190
+ let relative2 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
1191
+ relative2 = relative2.replace(/\\/g, "/");
1192
+ if (!relative2.startsWith("/")) {
1193
+ relative2 = `/${relative2}`;
1229
1194
  }
1230
- return relative3;
1195
+ return relative2;
1231
1196
  }, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
1232
1197
  const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
1233
1198
  const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
@@ -1286,11 +1251,11 @@ var init_logger = __esm(() => {
1286
1251
  });
1287
1252
 
1288
1253
  // src/utils/validateSafePath.ts
1289
- import { resolve as resolve7, relative as relative3 } from "path";
1254
+ import { resolve as resolve7, relative as relative2 } from "path";
1290
1255
  var validateSafePath = (targetPath, baseDirectory) => {
1291
1256
  const absoluteBase = resolve7(baseDirectory);
1292
1257
  const absoluteTarget = resolve7(baseDirectory, targetPath);
1293
- const relativePath = normalizePath(relative3(absoluteBase, absoluteTarget));
1258
+ const relativePath = normalizePath(relative2(absoluteBase, absoluteTarget));
1294
1259
  if (relativePath.startsWith("../") || relativePath === "..") {
1295
1260
  throw new Error(`Unsafe path: ${targetPath}`);
1296
1261
  }
@@ -1312,7 +1277,7 @@ import {
1312
1277
  basename as basename2,
1313
1278
  extname as extname2,
1314
1279
  resolve as resolve8,
1315
- relative as relative4,
1280
+ relative as relative3,
1316
1281
  sep
1317
1282
  } from "path";
1318
1283
  import { env } from "process";
@@ -1376,7 +1341,7 @@ var resolveDevClientDir2 = () => {
1376
1341
  const isModule = src.endsWith(".svelte.ts") || src.endsWith(".svelte.js");
1377
1342
  const preprocessed = isModule ? raw : (await preprocess(raw, {})).code;
1378
1343
  const transpiled = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed) : preprocessed;
1379
- const relDir = dirname3(relative4(svelteRoot, src)).replace(/\\/g, "/");
1344
+ const relDir = dirname3(relative3(svelteRoot, src)).replace(/\\/g, "/");
1380
1345
  const baseName = basename2(src).replace(/\.svelte(\.(ts|js))?$/, "");
1381
1346
  const importPaths = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
1382
1347
  const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
@@ -1395,7 +1360,7 @@ var resolveDevClientDir2 = () => {
1395
1360
  }).js.code;
1396
1361
  let code = raw2.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
1397
1362
  if (mode === "client" && isDev) {
1398
- const moduleKey = `/@src/${relative4(process.cwd(), src).replace(/\\/g, "/")}`;
1363
+ const moduleKey = `/@src/${relative3(process.cwd(), src).replace(/\\/g, "/")}`;
1399
1364
  code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
1400
1365
  if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
1401
1366
  var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
@@ -1430,10 +1395,10 @@ var resolveDevClientDir2 = () => {
1430
1395
  };
1431
1396
  const roots = await Promise.all(entryPoints.map(build2));
1432
1397
  await Promise.all(roots.map(async ({ client: client2 }) => {
1433
- const relClientDir = dirname3(relative4(clientDir, client2));
1398
+ const relClientDir = dirname3(relative3(clientDir, client2));
1434
1399
  const name = basename2(client2, extname2(client2));
1435
1400
  const indexPath = join6(indexDir, relClientDir, `${name}.js`);
1436
- const importRaw = relative4(dirname3(indexPath), client2).split(sep).join("/");
1401
+ const importRaw = relative3(dirname3(indexPath), client2).split(sep).join("/");
1437
1402
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
1438
1403
  const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
1439
1404
  import "${hmrClientPath3}";
@@ -1473,7 +1438,7 @@ if (typeof window !== "undefined") {
1473
1438
  return {
1474
1439
  svelteClientPaths: roots.map(({ client: client2 }) => client2),
1475
1440
  svelteIndexPaths: roots.map(({ client: client2 }) => {
1476
- const rel = dirname3(relative4(clientDir, client2));
1441
+ const rel = dirname3(relative3(clientDir, client2));
1477
1442
  return join6(indexDir, rel, basename2(client2));
1478
1443
  }),
1479
1444
  svelteServerPaths: roots.map(({ ssr }) => ssr)
@@ -1498,7 +1463,7 @@ __export(exports_compileVue, {
1498
1463
  });
1499
1464
  import { existsSync as existsSync9 } from "fs";
1500
1465
  import { mkdir as mkdir2 } from "fs/promises";
1501
- import { basename as basename3, dirname as dirname4, join as join7, relative as relative5, resolve as resolve9 } from "path";
1466
+ import { basename as basename3, dirname as dirname4, join as join7, relative as relative4, resolve as resolve9 } from "path";
1502
1467
  var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
1503
1468
  var resolveDevClientDir3 = () => {
1504
1469
  const fromSource = resolve9(import.meta.dir, "../dev/client");
@@ -1543,7 +1508,7 @@ var resolveDevClientDir3 = () => {
1543
1508
  return "template-only";
1544
1509
  }
1545
1510
  return "full";
1546
- }, 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) => {
1511
+ }, generateVueHmrId = (sourceFilePath, vueRootDir) => relative4(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) => {
1547
1512
  if (filePath.endsWith(".vue"))
1548
1513
  return filePath.replace(/\.vue$/, ".js");
1549
1514
  if (filePath.endsWith(".ts"))
@@ -1570,7 +1535,7 @@ var resolveDevClientDir3 = () => {
1570
1535
  const cachedResult = cacheMap.get(sourceFilePath);
1571
1536
  if (cachedResult)
1572
1537
  return cachedResult;
1573
- const relativeFilePath = relative5(vueRootDir, sourceFilePath).replace(/\\/g, "/");
1538
+ const relativeFilePath = relative4(vueRootDir, sourceFilePath).replace(/\\/g, "/");
1574
1539
  const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
1575
1540
  const fileBaseName = basename3(sourceFilePath, ".vue");
1576
1541
  const componentId = toKebab(fileBaseName);
@@ -1699,7 +1664,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1699
1664
  result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
1700
1665
  const entryBaseName = basename3(entryPath, ".vue");
1701
1666
  const indexOutputFile = join7(indexOutputDir, `${entryBaseName}.js`);
1702
- const clientOutputFile = join7(clientOutputDir, relative5(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
1667
+ const clientOutputFile = join7(clientOutputDir, relative4(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
1703
1668
  await mkdir2(dirname4(indexOutputFile), { recursive: true });
1704
1669
  const vueHmrImports = isDev ? [
1705
1670
  `window.__HMR_FRAMEWORK__ = "vue";`,
@@ -1707,7 +1672,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1707
1672
  ] : [];
1708
1673
  await write2(indexOutputFile, [
1709
1674
  ...vueHmrImports,
1710
- `import Comp from "${relative5(dirname4(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
1675
+ `import Comp from "${relative4(dirname4(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
1711
1676
  'import { createSSRApp, createApp } from "vue";',
1712
1677
  "",
1713
1678
  "// HMR State Preservation: Check for preserved state from HMR",
@@ -1807,7 +1772,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1807
1772
  await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
1808
1773
  const sourceCode = await file3(tsPath).text();
1809
1774
  const transpiledCode = transpiler2.transformSync(sourceCode);
1810
- const relativeJsPath = relative5(vueRootDir, tsPath).replace(/\.ts$/, ".js");
1775
+ const relativeJsPath = relative4(vueRootDir, tsPath).replace(/\.ts$/, ".js");
1811
1776
  const outClientPath = join7(clientOutputDir, relativeJsPath);
1812
1777
  const outServerPath = join7(serverOutputDir, relativeJsPath);
1813
1778
  await mkdir2(dirname4(outClientPath), { recursive: true });
@@ -10697,11 +10662,11 @@ ${lanes.join(`
10697
10662
  return toComponents;
10698
10663
  }
10699
10664
  const components = toComponents.slice(start);
10700
- const relative6 = [];
10665
+ const relative5 = [];
10701
10666
  for (;start < fromComponents.length; start++) {
10702
- relative6.push("..");
10667
+ relative5.push("..");
10703
10668
  }
10704
- return ["", ...relative6, ...components];
10669
+ return ["", ...relative5, ...components];
10705
10670
  }
10706
10671
  function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
10707
10672
  Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
@@ -47997,9 +47962,9 @@ ${lanes.join(`
47997
47962
  if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
47998
47963
  return;
47999
47964
  }
48000
- const relative6 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
47965
+ const relative5 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
48001
47966
  for (const symlinkDirectory of symlinkDirectories) {
48002
- const option = resolvePath(symlinkDirectory, relative6);
47967
+ const option = resolvePath(symlinkDirectory, relative5);
48003
47968
  const result2 = cb(option, target === referenceRedirect);
48004
47969
  shouldFilterIgnoredPaths = true;
48005
47970
  if (result2)
@@ -170565,7 +170530,7 @@ __export(exports_compileAngular, {
170565
170530
  compileAngular: () => compileAngular
170566
170531
  });
170567
170532
  import { existsSync as existsSync10, readFileSync as readFileSync4, promises as fs } from "fs";
170568
- import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve10, relative as relative6 } from "path";
170533
+ import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve10, relative as relative5 } from "path";
170569
170534
  import { createHash as createHash2 } from "crypto";
170570
170535
  var import_typescript, computeConfigHash = () => {
170571
170536
  try {
@@ -170874,7 +170839,7 @@ export default ${componentClassName};
170874
170839
  await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
170875
170840
  }
170876
170841
  await fs.writeFile(rawServerFile, rewritten, "utf-8");
170877
- const relativePath = relative6(indexesDir, rawServerFile).replace(/\\/g, "/");
170842
+ const relativePath = relative5(indexesDir, rawServerFile).replace(/\\/g, "/");
170878
170843
  const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
170879
170844
  const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
170880
170845
  import "${hmrRuntimePath}";
@@ -171253,7 +171218,7 @@ import {
171253
171218
  rmSync,
171254
171219
  writeFileSync as writeFileSync3
171255
171220
  } from "fs";
171256
- import { basename as basename5, join as join13, relative as relative7, resolve as resolve11 } from "path";
171221
+ import { basename as basename5, join as join13, relative as relative6, resolve as resolve11 } from "path";
171257
171222
  import { cwd, env as env2, exit } from "process";
171258
171223
  var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
171259
171224
  var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
@@ -171818,7 +171783,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171818
171783
  const devIndexDir = join13(buildPath, "_src_indexes");
171819
171784
  mkdirSync8(devIndexDir, { recursive: true });
171820
171785
  const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
171821
- const pagesRel = relative7(process.cwd(), resolve11(reactPagesPath)).replace(/\\/g, "/");
171786
+ const pagesRel = relative6(process.cwd(), resolve11(reactPagesPath)).replace(/\\/g, "/");
171822
171787
  for (const file4 of indexFiles) {
171823
171788
  let content = readFileSync5(join13(reactIndexesPath, file4), "utf-8");
171824
171789
  content = content.replace(/from\s*['"]\.\.\/pages\/([^'"]+)['"]/g, `from '/@src/${pagesRel}/$1'`);
@@ -202357,6 +202322,15 @@ var init_pageHandler = __esm(() => {
202357
202322
  });
202358
202323
 
202359
202324
  // src/dev/transformCache.ts
202325
+ var exports_transformCache = {};
202326
+ __export(exports_transformCache, {
202327
+ setTransformed: () => setTransformed,
202328
+ invalidateAll: () => invalidateAll,
202329
+ invalidate: () => invalidate,
202330
+ getTransformed: () => getTransformed,
202331
+ getInvalidationVersion: () => getInvalidationVersion,
202332
+ findNearestComponent: () => findNearestComponent
202333
+ });
202360
202334
  var globalStore, cache, importers, getTransformed = (filePath) => cache.get(filePath)?.content, setTransformed = (filePath, content, mtime, imports) => {
202361
202335
  const resolvedImports = imports ?? [];
202362
202336
  cache.set(filePath, { content, imports: resolvedImports, mtime });
@@ -202375,6 +202349,28 @@ var globalStore, cache, importers, getTransformed = (filePath) => cache.get(file
202375
202349
  cache.delete(parent);
202376
202350
  }
202377
202351
  }
202352
+ }, invalidateAll = () => {
202353
+ cache.clear();
202354
+ importers.clear();
202355
+ }, findNearestComponent = (filePath) => {
202356
+ const visited = new Set;
202357
+ const queue = [filePath];
202358
+ while (queue.length > 0) {
202359
+ const current = queue.shift();
202360
+ if (visited.has(current))
202361
+ continue;
202362
+ visited.add(current);
202363
+ const parents = importers.get(current);
202364
+ if (!parents)
202365
+ continue;
202366
+ for (const parent of parents) {
202367
+ if (parent.endsWith(".tsx") || parent.endsWith(".jsx")) {
202368
+ return parent;
202369
+ }
202370
+ queue.push(parent);
202371
+ }
202372
+ }
202373
+ return;
202378
202374
  };
202379
202375
  var init_transformCache = __esm(() => {
202380
202376
  globalStore = globalThis;
@@ -202397,7 +202393,7 @@ __export(exports_moduleServer, {
202397
202393
  SRC_URL_PREFIX: () => SRC_URL_PREFIX
202398
202394
  });
202399
202395
  import { existsSync as existsSync13, readFileSync as readFileSync9, statSync } from "fs";
202400
- import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve18, relative as relative8 } from "path";
202396
+ import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve18, relative as relative7 } from "path";
202401
202397
  var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
202402
202398
  const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
202403
202399
  const allExports = [];
@@ -202460,7 +202456,7 @@ ${stubs}
202460
202456
  const fileDir = dirname7(filePath);
202461
202457
  result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => {
202462
202458
  const absPath = resolve18(fileDir, relPath);
202463
- const rel = relative8(projectRoot, absPath);
202459
+ const rel = relative7(projectRoot, absPath);
202464
202460
  let srcPath = rel;
202465
202461
  if (!extname3(srcPath)) {
202466
202462
  const extensions = [
@@ -202481,19 +202477,19 @@ ${stubs}
202481
202477
  }
202482
202478
  if (extname3(srcPath) === ".svelte") {
202483
202479
  const resolved = resolveSvelteModulePath(resolve18(projectRoot, srcPath));
202484
- const resolvedRel = relative8(projectRoot, resolved);
202480
+ const resolvedRel = relative7(projectRoot, resolved);
202485
202481
  srcPath = resolvedRel;
202486
202482
  }
202487
202483
  return `${prefix}${srcUrl(srcPath, projectRoot)}${suffix}`;
202488
202484
  });
202489
202485
  result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => {
202490
202486
  const absPath = resolve18(fileDir, relPath);
202491
- const rel = relative8(projectRoot, absPath);
202487
+ const rel = relative7(projectRoot, absPath);
202492
202488
  return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
202493
202489
  });
202494
202490
  result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => {
202495
202491
  const absPath = resolve18(fileDir, relPath);
202496
- const rel = relative8(projectRoot, absPath);
202492
+ const rel = relative7(projectRoot, absPath);
202497
202493
  let srcPath = rel;
202498
202494
  if (!extname3(srcPath)) {
202499
202495
  const extensions = [
@@ -202517,10 +202513,10 @@ ${stubs}
202517
202513
  });
202518
202514
  result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
202519
202515
  if (absPath.startsWith(projectRoot)) {
202520
- const rel2 = relative8(projectRoot, absPath).replace(/\\/g, "/");
202516
+ const rel2 = relative7(projectRoot, absPath).replace(/\\/g, "/");
202521
202517
  return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
202522
202518
  }
202523
- const rel = relative8(projectRoot, absPath).replace(/\\/g, "/");
202519
+ const rel = relative7(projectRoot, absPath).replace(/\\/g, "/");
202524
202520
  if (!rel.startsWith("..")) {
202525
202521
  return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
202526
202522
  }
@@ -202562,7 +202558,7 @@ ${stubs}
202562
202558
  transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
202563
202559
  ` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
202564
202560
  ` + transpiled;
202565
- const relPath = relative8(projectRoot, filePath).replace(/\\/g, "/");
202561
+ const relPath = relative7(projectRoot, filePath).replace(/\\/g, "/");
202566
202562
  transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
202567
202563
  return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
202568
202564
  }, transformPlainFile = (filePath, projectRoot, rewriter) => {
@@ -202629,11 +202625,11 @@ ${stubs}
202629
202625
  if (compiled.css?.code) {
202630
202626
  const cssPath = `${filePath}.css`;
202631
202627
  svelteExternalCss.set(cssPath, compiled.css.code);
202632
- const cssUrl = srcUrl(relative8(projectRoot, cssPath), projectRoot);
202628
+ const cssUrl = srcUrl(relative7(projectRoot, cssPath), projectRoot);
202633
202629
  code = `import "${cssUrl}";
202634
202630
  ${code}`;
202635
202631
  }
202636
- const moduleUrl = `${SRC_PREFIX}${relative8(projectRoot, filePath).replace(/\\/g, "/")}`;
202632
+ const moduleUrl = `${SRC_PREFIX}${relative7(projectRoot, filePath).replace(/\\/g, "/")}`;
202637
202633
  code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
202638
202634
  if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
202639
202635
  var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
@@ -202697,7 +202693,7 @@ ${code}`;
202697
202693
  }
202698
202694
  code = tsTranspiler2.transformSync(code);
202699
202695
  const hmrBase = vueDir ? resolve18(vueDir) : projectRoot;
202700
- const hmrId = relative8(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
202696
+ const hmrId = relative7(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
202701
202697
  code = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
202702
202698
  code += [
202703
202699
  "",
@@ -203060,7 +203056,7 @@ var init_simpleHTMXHMR = () => {};
203060
203056
  // src/dev/rebuildTrigger.ts
203061
203057
  import { existsSync as existsSync14 } from "fs";
203062
203058
  import { rm as rm8 } from "fs/promises";
203063
- import { basename as basename8, relative as relative9, resolve as resolve21 } from "path";
203059
+ import { basename as basename8, relative as relative8, resolve as resolve21 } from "path";
203064
203060
  var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
203065
203061
  const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
203066
203062
  if (pathLineCol) {
@@ -203494,7 +203490,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203494
203490
  }, getModuleUrl = async (pageFile) => {
203495
203491
  const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
203496
203492
  invalidateModule2(pageFile);
203497
- const rel = relative9(process.cwd(), pageFile).replace(/\\/g, "/");
203493
+ const rel = relative8(process.cwd(), pageFile).replace(/\\/g, "/");
203498
203494
  const url = `${SRC_URL_PREFIX2}${rel}`;
203499
203495
  warmCache2(url);
203500
203496
  return url;
@@ -203520,10 +203516,18 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203520
203516
  for (const file4 of reactFiles) {
203521
203517
  invalidateModule2(file4);
203522
203518
  }
203523
- const pageModuleUrl = await getReactModuleUrl(primaryFile);
203519
+ const isComponentFile = primaryFile.endsWith(".tsx") || primaryFile.endsWith(".jsx");
203520
+ let broadcastTarget = primaryFile;
203521
+ if (!isComponentFile) {
203522
+ const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
203523
+ const nearest = findNearestComponent2(resolve21(primaryFile));
203524
+ if (nearest)
203525
+ broadcastTarget = nearest;
203526
+ }
203527
+ const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
203524
203528
  if (pageModuleUrl) {
203525
203529
  const serverDuration = Date.now() - startTime;
203526
- state.lastHmrPath = relative9(process.cwd(), primaryFile).replace(/\\/g, "/");
203530
+ state.lastHmrPath = relative8(process.cwd(), primaryFile).replace(/\\/g, "/");
203527
203531
  state.lastHmrFramework = "react";
203528
203532
  broadcastToClients(state, {
203529
203533
  data: {
@@ -203909,7 +203913,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203909
203913
  const baseName = fileName.replace(/\.vue$/, "");
203910
203914
  const pascalName = toPascal(baseName);
203911
203915
  const vueRoot = config.vueDirectory;
203912
- const hmrId = vueRoot ? relative9(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
203916
+ const hmrId = vueRoot ? relative8(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
203913
203917
  const cssKey = `${pascalName}CSS`;
203914
203918
  const cssUrl = manifest[cssKey] || null;
203915
203919
  const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
@@ -205060,7 +205064,7 @@ var handleHTMLPageRequest = (pagePath) => file(pagePath);
205060
205064
  var handleHTMXPageRequest = (pagePath) => file(pagePath);
205061
205065
  // src/core/prepare.ts
205062
205066
  import { readFileSync as readFileSync10 } from "fs";
205063
- import { relative as relative11, resolve as resolve23 } from "path";
205067
+ import { relative as relative10, resolve as resolve23 } from "path";
205064
205068
 
205065
205069
  // src/utils/loadConfig.ts
205066
205070
  import { resolve } from "path";
@@ -205139,7 +205143,7 @@ var prepare = async (configOrPath) => {
205139
205143
  })) {
205140
205144
  if (file4.includes("/node_modules/"))
205141
205145
  continue;
205142
- const rel = relative11(process.cwd(), file4).replace(/\\/g, "/");
205146
+ const rel = relative10(process.cwd(), file4).replace(/\\/g, "/");
205143
205147
  warmCache2(`${SRC_URL_PREFIX2}${rel}`);
205144
205148
  }
205145
205149
  }
@@ -205149,7 +205153,7 @@ var prepare = async (configOrPath) => {
205149
205153
  if (key.endsWith("Index") && typeof result.manifest[key] === "string" && result.manifest[key].includes("/react/") && result.manifest[key].includes("/indexes/")) {
205150
205154
  const fileName = `${key.replace(/Index$/, "")}.tsx`;
205151
205155
  const srcPath = resolve23(devIndexDir, fileName);
205152
- const rel = relative11(process.cwd(), srcPath).replace(/\\/g, "/");
205156
+ const rel = relative10(process.cwd(), srcPath).replace(/\\/g, "/");
205153
205157
  result.manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
205154
205158
  }
205155
205159
  }
@@ -205319,5 +205323,5 @@ export {
205319
205323
  ANGULAR_INIT_TIMEOUT_MS
205320
205324
  };
205321
205325
 
205322
- //# debugId=24BFD70A245036F364756E2164756E21
205326
+ //# debugId=8B0D6BD8707201AE64756E2164756E21
205323
205327
  //# sourceMappingURL=index.js.map