@marko/vite 2.2.8 → 2.2.11
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.js +26 -24
- package/dist/index.mjs +26 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -134,30 +134,28 @@ function markoPlugin(opts = {}) {
|
|
|
134
134
|
"<body>": { transformer }
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const entry = tag.template || tag.renderer;
|
|
148
|
-
if (entry) {
|
|
149
|
-
taglibDeps.push(entry.replace(/^.*?[\\/]node_modules[\\/]/, ""));
|
|
150
|
-
}
|
|
137
|
+
const lookup = compiler.taglib.buildLookup(root);
|
|
138
|
+
const taglibDeps = [];
|
|
139
|
+
for (const name in lookup.taglibsById) {
|
|
140
|
+
const taglib = lookup.taglibsById[name];
|
|
141
|
+
if (/[\\/]node_modules[\\/](?!@marko[\\/])/.test(taglib.dirname)) {
|
|
142
|
+
for (const tagName in taglib.tags) {
|
|
143
|
+
const tag = taglib.tags[tagName];
|
|
144
|
+
const entry = tag.template || tag.renderer;
|
|
145
|
+
if (entry) {
|
|
146
|
+
taglibDeps.push(entry.replace(/^.*?[\\/]node_modules[\\/]/, ""));
|
|
151
147
|
}
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
150
|
+
}
|
|
151
|
+
const domDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("dom", opts.translator).concat(taglibDeps)));
|
|
152
|
+
const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
|
|
153
|
+
optimizeDeps.include ?? (optimizeDeps.include = []);
|
|
154
|
+
optimizeDeps.include = optimizeDeps.include.concat(domDeps.filter((dep) => import_path.default.extname(dep) !== markoExt));
|
|
155
|
+
optimizeDeps.exclude ?? (optimizeDeps.exclude = []);
|
|
156
|
+
optimizeDeps.exclude = optimizeDeps.exclude.concat(domDeps.filter((dep) => import_path.default.extname(dep) === markoExt));
|
|
157
|
+
if (!isBuild) {
|
|
158
|
+
const serverDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("html", opts.translator).concat(taglibDeps)));
|
|
161
159
|
const ssr = config.ssr ?? (config.ssr = {});
|
|
162
160
|
ssr.external ?? (ssr.external = []);
|
|
163
161
|
ssr.external = ssr.external.concat(serverDeps);
|
|
@@ -261,7 +259,7 @@ function markoPlugin(opts = {}) {
|
|
|
261
259
|
if (isBuild) {
|
|
262
260
|
return html;
|
|
263
261
|
}
|
|
264
|
-
return html.replace(/src\s*=\s*(['"])(
|
|
262
|
+
return html.replace(/(src\s*=\s*(['"])(?:(?!\2).)*\.marko)(?:\?((?:(?!\2).)*))?\2/gim, (_, prefix, quote, query) => prefix + browserEntryQuery + (query ? "&" + query : "") + quote);
|
|
265
263
|
},
|
|
266
264
|
async transform(source, id, ssr) {
|
|
267
265
|
const query = getMarkoQuery(id);
|
|
@@ -330,8 +328,12 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
330
328
|
const browserManifest = {};
|
|
331
329
|
for (const entryId in serverManifest.entries) {
|
|
332
330
|
const fileName = serverManifest.entries[entryId];
|
|
333
|
-
|
|
334
|
-
|
|
331
|
+
let chunkId = fileName + htmlExt;
|
|
332
|
+
let chunk = bundle[chunkId];
|
|
333
|
+
if (!chunk) {
|
|
334
|
+
chunkId = chunkId.replace(/\//g, "\\");
|
|
335
|
+
chunk = bundle[chunkId];
|
|
336
|
+
}
|
|
335
337
|
if ((chunk == null ? void 0 : chunk.type) === "asset") {
|
|
336
338
|
browserManifest[entryId] = await (0, import_manifest_generator.generateDocManifest)(chunk.source.toString());
|
|
337
339
|
delete bundle[chunkId];
|
package/dist/index.mjs
CHANGED
|
@@ -97,30 +97,28 @@ function markoPlugin(opts = {}) {
|
|
|
97
97
|
"<body>": { transformer }
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const entry = tag.template || tag.renderer;
|
|
111
|
-
if (entry) {
|
|
112
|
-
taglibDeps.push(entry.replace(/^.*?[\\/]node_modules[\\/]/, ""));
|
|
113
|
-
}
|
|
100
|
+
const lookup = compiler.taglib.buildLookup(root);
|
|
101
|
+
const taglibDeps = [];
|
|
102
|
+
for (const name in lookup.taglibsById) {
|
|
103
|
+
const taglib = lookup.taglibsById[name];
|
|
104
|
+
if (/[\\/]node_modules[\\/](?!@marko[\\/])/.test(taglib.dirname)) {
|
|
105
|
+
for (const tagName in taglib.tags) {
|
|
106
|
+
const tag = taglib.tags[tagName];
|
|
107
|
+
const entry = tag.template || tag.renderer;
|
|
108
|
+
if (entry) {
|
|
109
|
+
taglibDeps.push(entry.replace(/^.*?[\\/]node_modules[\\/]/, ""));
|
|
114
110
|
}
|
|
115
111
|
}
|
|
116
112
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
113
|
+
}
|
|
114
|
+
const domDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("dom", opts.translator).concat(taglibDeps)));
|
|
115
|
+
const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
|
|
116
|
+
optimizeDeps.include ?? (optimizeDeps.include = []);
|
|
117
|
+
optimizeDeps.include = optimizeDeps.include.concat(domDeps.filter((dep) => path.extname(dep) !== markoExt));
|
|
118
|
+
optimizeDeps.exclude ?? (optimizeDeps.exclude = []);
|
|
119
|
+
optimizeDeps.exclude = optimizeDeps.exclude.concat(domDeps.filter((dep) => path.extname(dep) === markoExt));
|
|
120
|
+
if (!isBuild) {
|
|
121
|
+
const serverDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("html", opts.translator).concat(taglibDeps)));
|
|
124
122
|
const ssr = config.ssr ?? (config.ssr = {});
|
|
125
123
|
ssr.external ?? (ssr.external = []);
|
|
126
124
|
ssr.external = ssr.external.concat(serverDeps);
|
|
@@ -224,7 +222,7 @@ function markoPlugin(opts = {}) {
|
|
|
224
222
|
if (isBuild) {
|
|
225
223
|
return html;
|
|
226
224
|
}
|
|
227
|
-
return html.replace(/src\s*=\s*(['"])(
|
|
225
|
+
return html.replace(/(src\s*=\s*(['"])(?:(?!\2).)*\.marko)(?:\?((?:(?!\2).)*))?\2/gim, (_, prefix, quote, query) => prefix + browserEntryQuery + (query ? "&" + query : "") + quote);
|
|
228
226
|
},
|
|
229
227
|
async transform(source, id, ssr) {
|
|
230
228
|
const query = getMarkoQuery(id);
|
|
@@ -293,8 +291,12 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
293
291
|
const browserManifest = {};
|
|
294
292
|
for (const entryId in serverManifest.entries) {
|
|
295
293
|
const fileName = serverManifest.entries[entryId];
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
let chunkId = fileName + htmlExt;
|
|
295
|
+
let chunk = bundle[chunkId];
|
|
296
|
+
if (!chunk) {
|
|
297
|
+
chunkId = chunkId.replace(/\//g, "\\");
|
|
298
|
+
chunk = bundle[chunkId];
|
|
299
|
+
}
|
|
298
300
|
if ((chunk == null ? void 0 : chunk.type) === "asset") {
|
|
299
301
|
browserManifest[entryId] = await generateDocManifest(chunk.source.toString());
|
|
300
302
|
delete bundle[chunkId];
|
package/package.json
CHANGED