@marko/vite 5.0.12 → 5.0.14
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/index.mjs +28 -18
- 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",
|
|
@@ -990,6 +1010,11 @@ function markoPlugin(opts = {}) {
|
|
|
990
1010
|
chunkFileNames: `[name]-[hash].js`
|
|
991
1011
|
};
|
|
992
1012
|
}
|
|
1013
|
+
if (isSSRBuild && !config.build?.commonjsOptions?.esmExternals) {
|
|
1014
|
+
config.build ??= {};
|
|
1015
|
+
config.build.commonjsOptions ??= {};
|
|
1016
|
+
config.build.commonjsOptions.esmExternals = (id) => !isCJSModule(id);
|
|
1017
|
+
}
|
|
993
1018
|
if (basePathVar) {
|
|
994
1019
|
config.experimental ??= {};
|
|
995
1020
|
if (config.experimental.renderBuiltUrl) {
|
|
@@ -1242,27 +1267,12 @@ function markoPlugin(opts = {}) {
|
|
|
1242
1267
|
}
|
|
1243
1268
|
}
|
|
1244
1269
|
}
|
|
1245
|
-
if (tagsAPI === void 0) {
|
|
1246
|
-
const translatorPackage = opts.translator || compiler2.globalConfig?.translator || "marko/translator";
|
|
1247
|
-
if (/^@marko\/translator-(?:default|interop-class-tags)$/.test(
|
|
1248
|
-
translatorPackage
|
|
1249
|
-
)) {
|
|
1250
|
-
tagsAPI = false;
|
|
1251
|
-
} else {
|
|
1252
|
-
try {
|
|
1253
|
-
const require2 = createRequire(import.meta.url);
|
|
1254
|
-
tagsAPI = require2(translatorPackage).preferAPI !== "class";
|
|
1255
|
-
} catch {
|
|
1256
|
-
tagsAPI = true;
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
1270
|
source = await server_entry_template_default({
|
|
1261
1271
|
fileName,
|
|
1262
1272
|
entryData,
|
|
1263
1273
|
runtimeId,
|
|
1264
1274
|
basePathVar: isBuild ? basePathVar : void 0,
|
|
1265
|
-
tagsAPI
|
|
1275
|
+
tagsAPI: isTagsApi()
|
|
1266
1276
|
});
|
|
1267
1277
|
}
|
|
1268
1278
|
}
|
|
@@ -1318,7 +1328,7 @@ function markoPlugin(opts = {}) {
|
|
|
1318
1328
|
);
|
|
1319
1329
|
const { map, meta } = compiled;
|
|
1320
1330
|
let { code } = compiled;
|
|
1321
|
-
if (query !== browserEntryQuery && devServer) {
|
|
1331
|
+
if (query !== browserEntryQuery && devServer && !isTagsApi()) {
|
|
1322
1332
|
code += `
|
|
1323
1333
|
if (import.meta.hot) import.meta.hot.accept(() => {});`;
|
|
1324
1334
|
}
|