@marko/vite 5.3.6 → 5.3.7

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.
Files changed (2) hide show
  1. package/dist/index.mjs +14 -10
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -851,15 +851,19 @@ function markoPlugin(opts = {}) {
851
851
  let hydrateConfig;
852
852
  const resolveVirtualDependency = (from, dep) => {
853
853
  const normalizedFrom = normalizePath(from);
854
- const query = `${virtualFileQuery}&id=${encodeURIComponent(dep.virtualPath)}`;
854
+ const query = `${virtualFileQuery}&id=${dep.virtualPath.replace(/^\.\//, "").replace(/[^a-z0-9_.-]+/gi, "_")}`;
855
855
  const id = normalizedFrom + query;
856
+ const virtualFile = {
857
+ code: dep.code,
858
+ map: stripSourceRoot(dep.map)
859
+ };
856
860
  if (devServer) {
857
861
  const prev = virtualFiles.get(id);
858
862
  if (isDeferredPromise(prev)) {
859
- prev.resolve(dep);
863
+ prev.resolve(virtualFile);
860
864
  }
861
865
  }
862
- virtualFiles.set(id, dep);
866
+ virtualFiles.set(id, virtualFile);
863
867
  return `./${path6.posix.basename(normalizedFrom) + query}`;
864
868
  };
865
869
  let root;
@@ -1401,7 +1405,7 @@ function markoPlugin(opts = {}) {
1401
1405
  );
1402
1406
  return {
1403
1407
  code: code2,
1404
- map: toSourceMap(map),
1408
+ map: stripSourceRoot(map),
1405
1409
  meta: { arcSourceCode: source, arcScanIds: meta2.analyzedTags }
1406
1410
  };
1407
1411
  }
@@ -1437,7 +1441,7 @@ if (import.meta.hot) import.meta.hot.accept(() => {});`;
1437
1441
  }
1438
1442
  return {
1439
1443
  code,
1440
- map: toSourceMap(compiled.map),
1444
+ map: stripSourceRoot(compiled.map),
1441
1445
  meta: isBuild ? { arcSourceCode: source, arcScanIds: meta.analyzedTags } : void 0
1442
1446
  };
1443
1447
  }
@@ -1654,11 +1658,11 @@ function getKnownTemplates(cwd) {
1654
1658
  }
1655
1659
  return knownTemplates;
1656
1660
  }
1657
- function toSourceMap(map) {
1658
- return map ? {
1659
- names: map.names,
1660
- mappings: map.mappings
1661
- } : null;
1661
+ function stripSourceRoot(map) {
1662
+ if (map && map.sourceRoot) {
1663
+ map.sourceRoot = void 0;
1664
+ }
1665
+ return map;
1662
1666
  }
1663
1667
  export {
1664
1668
  markoPlugin as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
- "version": "5.3.6",
3
+ "version": "5.3.7",
4
4
  "description": "A Marko plugin for Vite",
5
5
  "keywords": [
6
6
  "loader",