@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.
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, relative, resolve } from "path";
126
+ import { basename, join, 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,42 +412,7 @@ var indexContentCache, resolveDevClientDir = () => {
412
412
  ` originalError.apply(console, args);`,
413
413
  ` };`,
414
414
  ` }`,
415
- `}`,
416
- ...isDev ? [
417
- `
418
- // HMR: re-import the page component and re-render the root.`,
419
- `// This is the Vite-style approach \u2014 the index file is the`,
420
- `// HMR boundary. Works for all patterns: dynamic imports,`,
421
- `// lazy loading, portals, data files.`,
422
- `if (window.__HMR_WS__ && window.__REACT_ROOT__ && !window.__HMR_ROOT_ACCEPT__) {`,
423
- ` window.__HMR_ROOT_ACCEPT__ = true;`,
424
- ` const origOnMessage = window.__HMR_WS__.onmessage;`,
425
- ` window.__HMR_WS__.onmessage = function(event) {`,
426
- ` if (origOnMessage) origOnMessage.call(this, event);`,
427
- ` try {`,
428
- ` const msg = JSON.parse(event.data);`,
429
- ` if (msg.type === 'react-update') {`,
430
- ` const url = "/@src/${relative(process.cwd(), resolve(reactPagesDirectory, componentName + ".tsx")).replace(/\\/g, "/")}";`,
431
- ` const start = performance.now();`,
432
- ` import(url + '?t=' + Date.now()).then(mod => {`,
433
- ` const Comp = mod.${componentName} || mod.default;`,
434
- ` if (Comp && window.__REACT_ROOT__) {`,
435
- ` const props = window.__INITIAL_PROPS__ || {};`,
436
- ` window.__REACT_ROOT__.render(`,
437
- ` ${isDev ? `createElement(ErrorBoundary, null, createElement(Comp, props))` : `createElement(Comp, props)`}`,
438
- ` );`,
439
- ` if (window.__HMR_WS__) {`,
440
- ` const ms = Math.round(performance.now() - start);`,
441
- ` const total = (msg.data.serverDuration || 0) + ms;`,
442
- ` window.__HMR_WS__.send(JSON.stringify({ type: 'hmr-timing', duration: total }));`,
443
- ` }`,
444
- ` }`,
445
- ` }).catch(() => {});`,
446
- ` }`,
447
- ` } catch {}`,
448
- ` };`,
449
- `}`
450
- ] : []
415
+ `}`
451
416
  ].join(`
452
417
  `);
453
418
  const indexPath = join(reactIndexesDirectory, `${componentName}.tsx`);
@@ -901,7 +866,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
901
866
 
902
867
  // src/build/angularLinkerPlugin.ts
903
868
  import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
904
- import { dirname as dirname2, join as join4, relative as relative2, resolve as resolve4 } from "path";
869
+ import { dirname as dirname2, join as join4, relative, resolve as resolve4 } from "path";
905
870
  import { createHash } from "crypto";
906
871
  var CACHE_DIR, angularLinkerPlugin;
907
872
  var init_angularLinkerPlugin = __esm(() => {
@@ -944,7 +909,7 @@ var init_angularLinkerPlugin = __esm(() => {
944
909
  dirname: dirname2,
945
910
  exists: existsSync7,
946
911
  readFile: readFileSync3,
947
- relative: relative2,
912
+ relative,
948
913
  resolve: resolve4
949
914
  },
950
915
  linkerJitMode: false,
@@ -985,11 +950,11 @@ var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPath
985
950
  const currentPaths = new Set(currentOutputPaths.map((path) => resolve5(path)));
986
951
  const glob = new Glob4("**/*");
987
952
  const removals = [];
988
- for (const relative3 of glob.scanSync({ cwd: buildPath })) {
989
- const absolute = resolve5(buildPath, relative3);
953
+ for (const relative2 of glob.scanSync({ cwd: buildPath })) {
954
+ const absolute = resolve5(buildPath, relative2);
990
955
  if (currentPaths.has(absolute))
991
956
  continue;
992
- if (!HASHED_FILE_PATTERN.test(relative3))
957
+ if (!HASHED_FILE_PATTERN.test(relative2))
993
958
  continue;
994
959
  removals.push(rm2(absolute, { force: true }));
995
960
  }
@@ -1143,12 +1108,12 @@ var init_startupBanner = __esm(() => {
1143
1108
  // src/utils/logger.ts
1144
1109
  var colors2, frameworkColors, formatPath = (filePath) => {
1145
1110
  const cwd = process.cwd();
1146
- let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
1147
- relative3 = relative3.replace(/\\/g, "/");
1148
- if (!relative3.startsWith("/")) {
1149
- relative3 = `/${relative3}`;
1111
+ let relative2 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
1112
+ relative2 = relative2.replace(/\\/g, "/");
1113
+ if (!relative2.startsWith("/")) {
1114
+ relative2 = `/${relative2}`;
1150
1115
  }
1151
- return relative3;
1116
+ return relative2;
1152
1117
  }, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
1153
1118
  const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
1154
1119
  const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
@@ -1207,11 +1172,11 @@ var init_logger = __esm(() => {
1207
1172
  });
1208
1173
 
1209
1174
  // src/utils/validateSafePath.ts
1210
- import { resolve as resolve6, relative as relative3 } from "path";
1175
+ import { resolve as resolve6, relative as relative2 } from "path";
1211
1176
  var validateSafePath = (targetPath, baseDirectory) => {
1212
1177
  const absoluteBase = resolve6(baseDirectory);
1213
1178
  const absoluteTarget = resolve6(baseDirectory, targetPath);
1214
- const relativePath = normalizePath(relative3(absoluteBase, absoluteTarget));
1179
+ const relativePath = normalizePath(relative2(absoluteBase, absoluteTarget));
1215
1180
  if (relativePath.startsWith("../") || relativePath === "..") {
1216
1181
  throw new Error(`Unsafe path: ${targetPath}`);
1217
1182
  }
@@ -1233,7 +1198,7 @@ import {
1233
1198
  basename as basename2,
1234
1199
  extname as extname2,
1235
1200
  resolve as resolve7,
1236
- relative as relative4,
1201
+ relative as relative3,
1237
1202
  sep
1238
1203
  } from "path";
1239
1204
  import { env } from "process";
@@ -1297,7 +1262,7 @@ var resolveDevClientDir2 = () => {
1297
1262
  const isModule = src.endsWith(".svelte.ts") || src.endsWith(".svelte.js");
1298
1263
  const preprocessed = isModule ? raw : (await preprocess(raw, {})).code;
1299
1264
  const transpiled = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed) : preprocessed;
1300
- const relDir = dirname3(relative4(svelteRoot, src)).replace(/\\/g, "/");
1265
+ const relDir = dirname3(relative3(svelteRoot, src)).replace(/\\/g, "/");
1301
1266
  const baseName = basename2(src).replace(/\.svelte(\.(ts|js))?$/, "");
1302
1267
  const importPaths = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
1303
1268
  const resolvedImports = await Promise.all(importPaths.map((importPath) => resolveSvelte(importPath, src)));
@@ -1316,7 +1281,7 @@ var resolveDevClientDir2 = () => {
1316
1281
  }).js.code;
1317
1282
  let code = raw2.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
1318
1283
  if (mode === "client" && isDev) {
1319
- const moduleKey = `/@src/${relative4(process.cwd(), src).replace(/\\/g, "/")}`;
1284
+ const moduleKey = `/@src/${relative3(process.cwd(), src).replace(/\\/g, "/")}`;
1320
1285
  code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
1321
1286
  if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
1322
1287
  var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
@@ -1351,10 +1316,10 @@ var resolveDevClientDir2 = () => {
1351
1316
  };
1352
1317
  const roots = await Promise.all(entryPoints.map(build));
1353
1318
  await Promise.all(roots.map(async ({ client }) => {
1354
- const relClientDir = dirname3(relative4(clientDir, client));
1319
+ const relClientDir = dirname3(relative3(clientDir, client));
1355
1320
  const name = basename2(client, extname2(client));
1356
1321
  const indexPath = join6(indexDir, relClientDir, `${name}.js`);
1357
- const importRaw = relative4(dirname3(indexPath), client).split(sep).join("/");
1322
+ const importRaw = relative3(dirname3(indexPath), client).split(sep).join("/");
1358
1323
  const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
1359
1324
  const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
1360
1325
  import "${hmrClientPath3}";
@@ -1394,7 +1359,7 @@ if (typeof window !== "undefined") {
1394
1359
  return {
1395
1360
  svelteClientPaths: roots.map(({ client }) => client),
1396
1361
  svelteIndexPaths: roots.map(({ client }) => {
1397
- const rel = dirname3(relative4(clientDir, client));
1362
+ const rel = dirname3(relative3(clientDir, client));
1398
1363
  return join6(indexDir, rel, basename2(client));
1399
1364
  }),
1400
1365
  svelteServerPaths: roots.map(({ ssr }) => ssr)
@@ -1419,7 +1384,7 @@ __export(exports_compileVue, {
1419
1384
  });
1420
1385
  import { existsSync as existsSync9 } from "fs";
1421
1386
  import { mkdir as mkdir2 } from "fs/promises";
1422
- import { basename as basename3, dirname as dirname4, join as join7, relative as relative5, resolve as resolve8 } from "path";
1387
+ import { basename as basename3, dirname as dirname4, join as join7, relative as relative4, resolve as resolve8 } from "path";
1423
1388
  var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
1424
1389
  var resolveDevClientDir3 = () => {
1425
1390
  const fromSource = resolve8(import.meta.dir, "../dev/client");
@@ -1464,7 +1429,7 @@ var resolveDevClientDir3 = () => {
1464
1429
  return "template-only";
1465
1430
  }
1466
1431
  return "full";
1467
- }, 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) => {
1432
+ }, 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) => {
1468
1433
  if (filePath.endsWith(".vue"))
1469
1434
  return filePath.replace(/\.vue$/, ".js");
1470
1435
  if (filePath.endsWith(".ts"))
@@ -1491,7 +1456,7 @@ var resolveDevClientDir3 = () => {
1491
1456
  const cachedResult = cacheMap.get(sourceFilePath);
1492
1457
  if (cachedResult)
1493
1458
  return cachedResult;
1494
- const relativeFilePath = relative5(vueRootDir, sourceFilePath).replace(/\\/g, "/");
1459
+ const relativeFilePath = relative4(vueRootDir, sourceFilePath).replace(/\\/g, "/");
1495
1460
  const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
1496
1461
  const fileBaseName = basename3(sourceFilePath, ".vue");
1497
1462
  const componentId = toKebab(fileBaseName);
@@ -1620,7 +1585,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1620
1585
  result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
1621
1586
  const entryBaseName = basename3(entryPath, ".vue");
1622
1587
  const indexOutputFile = join7(indexOutputDir, `${entryBaseName}.js`);
1623
- const clientOutputFile = join7(clientOutputDir, relative5(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
1588
+ const clientOutputFile = join7(clientOutputDir, relative4(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
1624
1589
  await mkdir2(dirname4(indexOutputFile), { recursive: true });
1625
1590
  const vueHmrImports = isDev ? [
1626
1591
  `window.__HMR_FRAMEWORK__ = "vue";`,
@@ -1628,7 +1593,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1628
1593
  ] : [];
1629
1594
  await write2(indexOutputFile, [
1630
1595
  ...vueHmrImports,
1631
- `import Comp from "${relative5(dirname4(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
1596
+ `import Comp from "${relative4(dirname4(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
1632
1597
  'import { createSSRApp, createApp } from "vue";',
1633
1598
  "",
1634
1599
  "// HMR State Preservation: Check for preserved state from HMR",
@@ -1728,7 +1693,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
1728
1693
  await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
1729
1694
  const sourceCode = await file2(tsPath).text();
1730
1695
  const transpiledCode = transpiler2.transformSync(sourceCode);
1731
- const relativeJsPath = relative5(vueRootDir, tsPath).replace(/\.ts$/, ".js");
1696
+ const relativeJsPath = relative4(vueRootDir, tsPath).replace(/\.ts$/, ".js");
1732
1697
  const outClientPath = join7(clientOutputDir, relativeJsPath);
1733
1698
  const outServerPath = join7(serverOutputDir, relativeJsPath);
1734
1699
  await mkdir2(dirname4(outClientPath), { recursive: true });
@@ -10618,11 +10583,11 @@ ${lanes.join(`
10618
10583
  return toComponents;
10619
10584
  }
10620
10585
  const components = toComponents.slice(start);
10621
- const relative6 = [];
10586
+ const relative5 = [];
10622
10587
  for (;start < fromComponents.length; start++) {
10623
- relative6.push("..");
10588
+ relative5.push("..");
10624
10589
  }
10625
- return ["", ...relative6, ...components];
10590
+ return ["", ...relative5, ...components];
10626
10591
  }
10627
10592
  function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
10628
10593
  Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
@@ -47918,9 +47883,9 @@ ${lanes.join(`
47918
47883
  if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
47919
47884
  return;
47920
47885
  }
47921
- const relative6 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
47886
+ const relative5 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
47922
47887
  for (const symlinkDirectory of symlinkDirectories) {
47923
- const option = resolvePath(symlinkDirectory, relative6);
47888
+ const option = resolvePath(symlinkDirectory, relative5);
47924
47889
  const result2 = cb(option, target === referenceRedirect);
47925
47890
  shouldFilterIgnoredPaths = true;
47926
47891
  if (result2)
@@ -170486,7 +170451,7 @@ __export(exports_compileAngular, {
170486
170451
  compileAngular: () => compileAngular
170487
170452
  });
170488
170453
  import { existsSync as existsSync10, readFileSync as readFileSync4, promises as fs } from "fs";
170489
- import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve9, relative as relative6 } from "path";
170454
+ import { join as join8, basename as basename4, sep as sep2, dirname as dirname5, resolve as resolve9, relative as relative5 } from "path";
170490
170455
  import { createHash as createHash2 } from "crypto";
170491
170456
  var import_typescript, computeConfigHash = () => {
170492
170457
  try {
@@ -170795,7 +170760,7 @@ export default ${componentClassName};
170795
170760
  await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
170796
170761
  }
170797
170762
  await fs.writeFile(rawServerFile, rewritten, "utf-8");
170798
- const relativePath = relative6(indexesDir, rawServerFile).replace(/\\/g, "/");
170763
+ const relativePath = relative5(indexesDir, rawServerFile).replace(/\\/g, "/");
170799
170764
  const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
170800
170765
  const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
170801
170766
  import "${hmrRuntimePath}";
@@ -171174,7 +171139,7 @@ import {
171174
171139
  rmSync,
171175
171140
  writeFileSync as writeFileSync3
171176
171141
  } from "fs";
171177
- import { basename as basename5, join as join13, relative as relative7, resolve as resolve10 } from "path";
171142
+ import { basename as basename5, join as join13, relative as relative6, resolve as resolve10 } from "path";
171178
171143
  import { cwd, env as env2, exit } from "process";
171179
171144
  var {build: bunBuild6, Glob: Glob5 } = globalThis.Bun;
171180
171145
  var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental, throwOnError) => {
@@ -171739,7 +171704,7 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171739
171704
  const devIndexDir = join13(buildPath, "_src_indexes");
171740
171705
  mkdirSync8(devIndexDir, { recursive: true });
171741
171706
  const indexFiles = readDir(reactIndexesPath).filter((f) => f.endsWith(".tsx"));
171742
- const pagesRel = relative7(process.cwd(), resolve10(reactPagesPath)).replace(/\\/g, "/");
171707
+ const pagesRel = relative6(process.cwd(), resolve10(reactPagesPath)).replace(/\\/g, "/");
171743
171708
  for (const file3 of indexFiles) {
171744
171709
  let content = readFileSync5(join13(reactIndexesPath, file3), "utf-8");
171745
171710
  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 resolve17, relative as relative8 } from "path";
202396
+ import { basename as basename7, dirname as dirname7, extname as extname3, resolve as resolve17, 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 = resolve17(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(resolve17(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 = resolve17(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 = resolve17(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 ? resolve17(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 resolve20 } from "path";
203059
+ import { basename as basename8, relative as relative8, resolve as resolve20 } 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 file3 of reactFiles) {
203521
203517
  invalidateModule2(file3);
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(resolve20(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));
@@ -204903,5 +204907,5 @@ export {
204903
204907
  build
204904
204908
  };
204905
204909
 
204906
- //# debugId=CC8984512E0AEA7A64756E2164756E21
204910
+ //# debugId=C820298FC4C29C7664756E2164756E21
204907
204911
  //# sourceMappingURL=build.js.map