@marko/vite 5.0.11 → 5.0.13

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 +28 -21
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -850,7 +850,6 @@ function markoPlugin(opts = {}) {
850
850
  let serverManifest;
851
851
  let basePath = "/";
852
852
  let getMarkoAssetFns;
853
- let tagsAPI;
854
853
  const entryIds = /* @__PURE__ */ new Set();
855
854
  const cachedSources = /* @__PURE__ */ new Map();
856
855
  const transformWatchFiles = /* @__PURE__ */ new Map();
@@ -858,6 +857,27 @@ function markoPlugin(opts = {}) {
858
857
  const store = new ReadOncePersistedStore(
859
858
  `vite-marko${runtimeId ? `-${runtimeId}` : ""}`
860
859
  );
860
+ const isTagsApi = /* @__PURE__ */ (() => {
861
+ let tagsAPI;
862
+ return () => {
863
+ if (tagsAPI === void 0) {
864
+ const translatorPackage = opts.translator || compiler2.globalConfig?.translator || "marko/translator";
865
+ if (/^@marko\/translator-(?:default|interop-class-tags)$/.test(
866
+ translatorPackage
867
+ )) {
868
+ tagsAPI = false;
869
+ } else {
870
+ try {
871
+ const require2 = createRequire(import.meta.url);
872
+ tagsAPI = require2(translatorPackage).preferAPI !== "class";
873
+ } catch {
874
+ tagsAPI = true;
875
+ }
876
+ }
877
+ }
878
+ return tagsAPI;
879
+ };
880
+ })();
861
881
  return [
862
882
  {
863
883
  name: "marko-vite:pre",
@@ -865,6 +885,11 @@ function markoPlugin(opts = {}) {
865
885
  // Must be pre to allow us to resolve assets before vite.
866
886
  async config(config, env) {
867
887
  let optimize = env.mode === "production";
888
+ isTest = env.mode === "test";
889
+ isBuild = env.command === "build";
890
+ if (isTest) {
891
+ linked = false;
892
+ }
868
893
  if ("MARKO_DEBUG" in process.env) {
869
894
  optimize = process.env.MARKO_DEBUG === "false" || process.env.MARKO_DEBUG === "0";
870
895
  } else {
@@ -921,8 +946,6 @@ function markoPlugin(opts = {}) {
921
946
  compiler2.configure(baseConfig);
922
947
  devEntryFile = path6.join(root, "index.html");
923
948
  devEntryFilePosix = normalizePath(devEntryFile);
924
- isTest = env.mode === "test";
925
- isBuild = env.command === "build";
926
949
  isSSRBuild = isBuild && linked && Boolean(config.build.ssr);
927
950
  renderAssetsRuntimeCode = getRenderAssetsRuntime({
928
951
  isBuild,
@@ -930,7 +953,6 @@ function markoPlugin(opts = {}) {
930
953
  runtimeId
931
954
  });
932
955
  if (isTest) {
933
- linked = false;
934
956
  const { test } = config;
935
957
  if (test.environment?.includes("dom")) {
936
958
  config.resolve ??= {};
@@ -1240,27 +1262,12 @@ function markoPlugin(opts = {}) {
1240
1262
  }
1241
1263
  }
1242
1264
  }
1243
- if (tagsAPI === void 0) {
1244
- const translatorPackage = opts.translator || compiler2.globalConfig?.translator || "marko/translator";
1245
- if (/^@marko\/translator-(?:default|interop-class-tags)$/.test(
1246
- translatorPackage
1247
- )) {
1248
- tagsAPI = false;
1249
- } else {
1250
- try {
1251
- const require2 = createRequire(import.meta.url);
1252
- tagsAPI = require2(translatorPackage).preferAPI !== "class";
1253
- } catch {
1254
- tagsAPI = true;
1255
- }
1256
- }
1257
- }
1258
1265
  source = await server_entry_template_default({
1259
1266
  fileName,
1260
1267
  entryData,
1261
1268
  runtimeId,
1262
1269
  basePathVar: isBuild ? basePathVar : void 0,
1263
- tagsAPI
1270
+ tagsAPI: isTagsApi()
1264
1271
  });
1265
1272
  }
1266
1273
  }
@@ -1316,7 +1323,7 @@ function markoPlugin(opts = {}) {
1316
1323
  );
1317
1324
  const { map, meta } = compiled;
1318
1325
  let { code } = compiled;
1319
- if (query !== browserEntryQuery && devServer) {
1326
+ if (query !== browserEntryQuery && devServer && !isTagsApi()) {
1320
1327
  code += `
1321
1328
  if (import.meta.hot) import.meta.hot.accept(() => {});`;
1322
1329
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
- "version": "5.0.11",
3
+ "version": "5.0.13",
4
4
  "description": "A Marko plugin for Vite",
5
5
  "keywords": [
6
6
  "loader",