@marko/vite 5.3.5 → 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 +15 -12
  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;
@@ -1005,8 +1009,7 @@ function markoPlugin(opts = {}) {
1005
1009
  test.deps.optimizer ??= {};
1006
1010
  test.deps.optimizer.web ??= {};
1007
1011
  test.deps.optimizer.web.enabled ??= true;
1008
- test.deps.optimizer.client ??= {};
1009
- test.deps.optimizer.client.enabled ??= true;
1012
+ (test.execArgv ||= []).push("-C", "browser");
1010
1013
  }
1011
1014
  }
1012
1015
  if (!registeredTagLib) {
@@ -1402,7 +1405,7 @@ function markoPlugin(opts = {}) {
1402
1405
  );
1403
1406
  return {
1404
1407
  code: code2,
1405
- map: toSourceMap(map),
1408
+ map: stripSourceRoot(map),
1406
1409
  meta: { arcSourceCode: source, arcScanIds: meta2.analyzedTags }
1407
1410
  };
1408
1411
  }
@@ -1438,7 +1441,7 @@ if (import.meta.hot) import.meta.hot.accept(() => {});`;
1438
1441
  }
1439
1442
  return {
1440
1443
  code,
1441
- map: toSourceMap(compiled.map),
1444
+ map: stripSourceRoot(compiled.map),
1442
1445
  meta: isBuild ? { arcSourceCode: source, arcScanIds: meta.analyzedTags } : void 0
1443
1446
  };
1444
1447
  }
@@ -1655,11 +1658,11 @@ function getKnownTemplates(cwd) {
1655
1658
  }
1656
1659
  return knownTemplates;
1657
1660
  }
1658
- function toSourceMap(map) {
1659
- return map ? {
1660
- names: map.names,
1661
- mappings: map.mappings
1662
- } : null;
1661
+ function stripSourceRoot(map) {
1662
+ if (map && map.sourceRoot) {
1663
+ map.sourceRoot = void 0;
1664
+ }
1665
+ return map;
1663
1666
  }
1664
1667
  export {
1665
1668
  markoPlugin as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
- "version": "5.3.5",
3
+ "version": "5.3.7",
4
4
  "description": "A Marko plugin for Vite",
5
5
  "keywords": [
6
6
  "loader",