@marko/vite 5.3.3 → 5.3.4

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 -7
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1005,6 +1005,8 @@ function markoPlugin(opts = {}) {
1005
1005
  test.deps.optimizer ??= {};
1006
1006
  test.deps.optimizer.web ??= {};
1007
1007
  test.deps.optimizer.web.enabled ??= true;
1008
+ test.deps.optimizer.client ??= {};
1009
+ test.deps.optimizer.client.enabled ??= true;
1008
1010
  }
1009
1011
  }
1010
1012
  if (!registeredTagLib) {
@@ -1134,7 +1136,9 @@ function markoPlugin(opts = {}) {
1134
1136
  }
1135
1137
  },
1136
1138
  configureServer(_server) {
1137
- ssrConfig.hot = ssrCjsConfig.hot = domConfig.hot = true;
1139
+ if (!isTest) {
1140
+ ssrConfig.hot = ssrCjsConfig.hot = domConfig.hot = true;
1141
+ }
1138
1142
  devServer = _server;
1139
1143
  devServer.watcher.on("all", (type, originalFileName) => {
1140
1144
  const fileName = normalizePath(originalFileName);
@@ -1363,7 +1367,7 @@ function markoPlugin(opts = {}) {
1363
1367
  }
1364
1368
  }
1365
1369
  if (!isMarkoFile(id)) {
1366
- if (!isBuild) {
1370
+ if (!isBuild && isSSR) {
1367
1371
  const ext = path6.extname(id);
1368
1372
  if (ext === ".cjs" || ext === ".js" && isCJSModule(id, rootResolveFile)) {
1369
1373
  if (cjsToEsm === void 0) {
@@ -1391,14 +1395,14 @@ function markoPlugin(opts = {}) {
1391
1395
  }
1392
1396
  if (!query && isCJSModule(id, rootResolveFile)) {
1393
1397
  if (isBuild) {
1394
- const { code: code2, map: map2, meta: meta2 } = await compiler2.compile(
1398
+ const { code: code2, map, meta: meta2 } = await compiler2.compile(
1395
1399
  source,
1396
1400
  id,
1397
1401
  getConfigForFileSystem(info, ssrCjsConfig)
1398
1402
  );
1399
1403
  return {
1400
1404
  code: code2,
1401
- map: map2,
1405
+ map: toSourceMap(map),
1402
1406
  meta: { arcSourceCode: source, arcScanIds: meta2.analyzedTags }
1403
1407
  };
1404
1408
  }
@@ -1412,9 +1416,9 @@ function markoPlugin(opts = {}) {
1412
1416
  isSSR ? isCJSModule(id, rootResolveFile) ? ssrCjsConfig : ssrConfig : query === browserEntryQuery ? hydrateConfig : domConfig
1413
1417
  )
1414
1418
  );
1415
- const { map, meta } = compiled;
1419
+ const { meta } = compiled;
1416
1420
  let { code } = compiled;
1417
- if (query !== browserEntryQuery && devServer && !isTagsApi()) {
1421
+ if (!isTest && query !== browserEntryQuery && devServer && !isTagsApi()) {
1418
1422
  code += `
1419
1423
  if (import.meta.hot) import.meta.hot.accept(() => {});`;
1420
1424
  }
@@ -1434,7 +1438,7 @@ if (import.meta.hot) import.meta.hot.accept(() => {});`;
1434
1438
  }
1435
1439
  return {
1436
1440
  code,
1437
- map,
1441
+ map: toSourceMap(compiled.map),
1438
1442
  meta: isBuild ? { arcSourceCode: source, arcScanIds: meta.analyzedTags } : void 0
1439
1443
  };
1440
1444
  }
@@ -1651,6 +1655,9 @@ function getKnownTemplates(cwd) {
1651
1655
  }
1652
1656
  return knownTemplates;
1653
1657
  }
1658
+ function toSourceMap(map) {
1659
+ return map ? { mappings: map.mappings } : null;
1660
+ }
1654
1661
  export {
1655
1662
  markoPlugin as default
1656
1663
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
- "version": "5.3.3",
3
+ "version": "5.3.4",
4
4
  "description": "A Marko plugin for Vite",
5
5
  "keywords": [
6
6
  "loader",