@marko/vite 2.3.8 → 2.3.10
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/{chunk-MPTD6LHF.mjs → chunk-DSFBTWOA.mjs} +35 -19
- package/dist/{chunk-Z64RCGRQ.mjs → chunk-KRSZ5IRT.mjs} +14 -6
- package/dist/esbuild-plugin.js +22 -7
- package/dist/esbuild-plugin.mjs +1 -1
- package/dist/index.js +107 -44
- package/dist/index.mjs +101 -45
- package/dist/manifest-generator.d.ts +1 -1
- package/dist/manifest-generator.js +43 -20
- package/dist/manifest-generator.mjs +1 -1
- package/dist/render-assets-transform.js +10 -1
- package/dist/render-assets-transform.mjs +10 -1
- package/dist/server-entry-template.js +8 -1
- package/package.json +26 -26
|
@@ -9,30 +9,46 @@ import { DomHandler } from "domhandler";
|
|
|
9
9
|
var MARKER_COMMENT = "MARKO_VITE";
|
|
10
10
|
function generateDocManifest(rawHtml) {
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
12
|
-
const parser = new Parser(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
const parser = new Parser(
|
|
13
|
+
new DomHandler(function(err, dom) {
|
|
14
|
+
if (err) {
|
|
15
|
+
return reject(err);
|
|
16
|
+
}
|
|
17
|
+
const htmlChildren = dom.find(isElement).childNodes;
|
|
18
|
+
const headPrepend = [];
|
|
19
|
+
const head = [];
|
|
20
|
+
const bodyPrepend = [];
|
|
21
|
+
const body = [];
|
|
22
|
+
splitNodesByMarker(
|
|
23
|
+
htmlChildren.find(
|
|
24
|
+
(node) => isElement(node) && node.tagName === "head"
|
|
25
|
+
).childNodes,
|
|
26
|
+
headPrepend,
|
|
27
|
+
head
|
|
28
|
+
);
|
|
29
|
+
splitNodesByMarker(
|
|
30
|
+
htmlChildren.find(
|
|
31
|
+
(node) => isElement(node) && node.tagName === "body"
|
|
32
|
+
).childNodes,
|
|
33
|
+
bodyPrepend,
|
|
34
|
+
body
|
|
35
|
+
);
|
|
36
|
+
resolve({
|
|
37
|
+
"head-prepend": serializeOrNull(headPrepend),
|
|
38
|
+
head: serializeOrNull(head),
|
|
39
|
+
"body-prepend": serializeOrNull(bodyPrepend),
|
|
40
|
+
body: serializeOrNull(body)
|
|
41
|
+
});
|
|
42
|
+
})
|
|
43
|
+
);
|
|
30
44
|
parser.write(rawHtml);
|
|
31
45
|
parser.end();
|
|
32
46
|
});
|
|
33
47
|
}
|
|
34
48
|
function generateInputDoc(entry) {
|
|
35
|
-
return `<!DOCTYPE html><html><head><!--${MARKER_COMMENT}--></head><body><!--${MARKER_COMMENT}--><script async type="module" src=${JSON.stringify(
|
|
49
|
+
return `<!DOCTYPE html><html><head><!--${MARKER_COMMENT}--></head><body><!--${MARKER_COMMENT}--><script async type="module" src=${JSON.stringify(
|
|
50
|
+
entry
|
|
51
|
+
)}></script></body></html>`;
|
|
36
52
|
}
|
|
37
53
|
function serializeOrNull(nodes) {
|
|
38
54
|
const result = serialize(nodes);
|
|
@@ -23,14 +23,20 @@ function esbuildPlugin(compiler, config) {
|
|
|
23
23
|
path: path.resolve(args.resolveDir, args.path)
|
|
24
24
|
};
|
|
25
25
|
});
|
|
26
|
-
build.onLoad(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
build.onLoad(
|
|
27
|
+
{ filter: /\.marko\./, namespace: "marko:virtual" },
|
|
28
|
+
(args) => ({
|
|
29
|
+
contents: virtualFiles.get(args.path).code,
|
|
30
|
+
loader: path.extname(args.path).slice(1)
|
|
31
|
+
})
|
|
32
|
+
);
|
|
30
33
|
}
|
|
31
34
|
build.onLoad({ filter: /\.marko$/ }, async (args) => {
|
|
32
35
|
try {
|
|
33
|
-
const { code, meta } = await compiler.compileFile(
|
|
36
|
+
const { code, meta } = await compiler.compileFile(
|
|
37
|
+
args.path,
|
|
38
|
+
finalConfig
|
|
39
|
+
);
|
|
34
40
|
return {
|
|
35
41
|
loader: "js",
|
|
36
42
|
contents: code,
|
|
@@ -46,7 +52,9 @@ function esbuildPlugin(compiler, config) {
|
|
|
46
52
|
const [, file, rawLine, rawCol, text2] = match;
|
|
47
53
|
const line = parseInt(rawLine, 10) || 1;
|
|
48
54
|
const column = parseInt(rawCol, 10) || 1;
|
|
49
|
-
lines || (lines = (await fs.promises.readFile(args.path, "utf-8")).split(
|
|
55
|
+
lines || (lines = (await fs.promises.readFile(args.path, "utf-8")).split(
|
|
56
|
+
/\n/g
|
|
57
|
+
));
|
|
50
58
|
errors.push({
|
|
51
59
|
text: text2,
|
|
52
60
|
location: {
|
package/dist/esbuild-plugin.js
CHANGED
|
@@ -17,7 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
21
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
29
|
var esbuild_plugin_exports = {};
|
|
23
30
|
__export(esbuild_plugin_exports, {
|
|
@@ -48,14 +55,20 @@ function esbuildPlugin(compiler, config) {
|
|
|
48
55
|
path: import_path.default.resolve(args.resolveDir, args.path)
|
|
49
56
|
};
|
|
50
57
|
});
|
|
51
|
-
build.onLoad(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
build.onLoad(
|
|
59
|
+
{ filter: /\.marko\./, namespace: "marko:virtual" },
|
|
60
|
+
(args) => ({
|
|
61
|
+
contents: virtualFiles.get(args.path).code,
|
|
62
|
+
loader: import_path.default.extname(args.path).slice(1)
|
|
63
|
+
})
|
|
64
|
+
);
|
|
55
65
|
}
|
|
56
66
|
build.onLoad({ filter: /\.marko$/ }, async (args) => {
|
|
57
67
|
try {
|
|
58
|
-
const { code, meta } = await compiler.compileFile(
|
|
68
|
+
const { code, meta } = await compiler.compileFile(
|
|
69
|
+
args.path,
|
|
70
|
+
finalConfig
|
|
71
|
+
);
|
|
59
72
|
return {
|
|
60
73
|
loader: "js",
|
|
61
74
|
contents: code,
|
|
@@ -71,7 +84,9 @@ function esbuildPlugin(compiler, config) {
|
|
|
71
84
|
const [, file, rawLine, rawCol, text2] = match;
|
|
72
85
|
const line = parseInt(rawLine, 10) || 1;
|
|
73
86
|
const column = parseInt(rawCol, 10) || 1;
|
|
74
|
-
lines || (lines = (await import_fs.default.promises.readFile(args.path, "utf-8")).split(
|
|
87
|
+
lines || (lines = (await import_fs.default.promises.readFile(args.path, "utf-8")).split(
|
|
88
|
+
/\n/g
|
|
89
|
+
));
|
|
75
90
|
errors.push({
|
|
76
91
|
text: text2,
|
|
77
92
|
location: {
|
package/dist/esbuild-plugin.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -17,7 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
21
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
29
|
var src_exports = {};
|
|
23
30
|
__export(src_exports, {
|
|
@@ -74,7 +81,9 @@ function markoPlugin(opts = {}) {
|
|
|
74
81
|
if (devServer) {
|
|
75
82
|
const prev = virtualFiles.get(id);
|
|
76
83
|
if (prev && prev.code !== dep.code) {
|
|
77
|
-
devServer.moduleGraph.invalidateModule(
|
|
84
|
+
devServer.moduleGraph.invalidateModule(
|
|
85
|
+
devServer.moduleGraph.getModuleById(id)
|
|
86
|
+
);
|
|
78
87
|
}
|
|
79
88
|
}
|
|
80
89
|
virtualFiles.set(id, dep);
|
|
@@ -109,16 +118,21 @@ function markoPlugin(opts = {}) {
|
|
|
109
118
|
{
|
|
110
119
|
name: "marko-vite:pre",
|
|
111
120
|
enforce: "pre",
|
|
121
|
+
// Must be pre to allow us to resolve assets before vite.
|
|
112
122
|
async config(config, env) {
|
|
113
|
-
var _a2, _b, _c;
|
|
114
123
|
compiler ?? (compiler = await import(opts.compiler || "@marko/compiler"));
|
|
115
124
|
root = normalizePath(config.root || process.cwd());
|
|
116
125
|
devEntryFile = import_path.default.join(root, "index.html");
|
|
117
126
|
isBuild = env.command === "build";
|
|
118
127
|
isSSRBuild = isBuild && linked && Boolean(config.build.ssr);
|
|
119
128
|
if (linked && !registeredTag) {
|
|
120
|
-
const transformer = import_path.default.resolve(
|
|
121
|
-
|
|
129
|
+
const transformer = import_path.default.resolve(
|
|
130
|
+
thisFile,
|
|
131
|
+
"../render-assets-transform"
|
|
132
|
+
);
|
|
133
|
+
registeredTag = normalizePath(
|
|
134
|
+
import_path.default.resolve(thisFile, "../components", "vite.marko")
|
|
135
|
+
);
|
|
122
136
|
compiler.taglib.register("@marko/vite", {
|
|
123
137
|
"<_vite>": { template: registeredTag },
|
|
124
138
|
"<head>": { transformer },
|
|
@@ -140,29 +154,27 @@ function markoPlugin(opts = {}) {
|
|
|
140
154
|
}
|
|
141
155
|
}
|
|
142
156
|
const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
|
|
143
|
-
optimizeDeps.include = Array.from(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
optimizeDeps.include = Array.from(
|
|
158
|
+
/* @__PURE__ */ new Set([
|
|
159
|
+
...optimizeDeps.include || [],
|
|
160
|
+
...compiler.getRuntimeEntryFiles("dom", opts.translator),
|
|
161
|
+
...compiler.getRuntimeEntryFiles("html", opts.translator),
|
|
162
|
+
...taglibDeps
|
|
163
|
+
])
|
|
164
|
+
);
|
|
165
|
+
const optimizeExtensions = optimizeDeps.extensions ?? (optimizeDeps.extensions = []);
|
|
166
|
+
optimizeExtensions.push(".marko");
|
|
167
|
+
const esbuildOptions = optimizeDeps.esbuildOptions ?? (optimizeDeps.esbuildOptions = {});
|
|
168
|
+
const esbuildPlugins = esbuildOptions.plugins ?? (esbuildOptions.plugins = []);
|
|
169
|
+
esbuildPlugins.push((0, import_esbuild_plugin.default)(compiler, baseConfig));
|
|
149
170
|
const ssr = config.ssr ?? (config.ssr = {});
|
|
150
171
|
if (ssr.noExternal !== true) {
|
|
151
|
-
ssr.noExternal = Array.from(
|
|
172
|
+
ssr.noExternal = Array.from(
|
|
173
|
+
new Set(
|
|
174
|
+
taglibDeps.concat(ssr.noExternal || [])
|
|
175
|
+
)
|
|
176
|
+
);
|
|
152
177
|
}
|
|
153
|
-
return {
|
|
154
|
-
...config,
|
|
155
|
-
optimizeDeps: {
|
|
156
|
-
...config.optimizeDeps,
|
|
157
|
-
extensions: [".marko", ...((_a2 = config.optimizeDeps) == null ? void 0 : _a2.extensions) || []],
|
|
158
|
-
esbuildOptions: {
|
|
159
|
-
plugins: [
|
|
160
|
-
(0, import_esbuild_plugin.default)(compiler, baseConfig),
|
|
161
|
-
...((_c = (_b = config.optimizeDeps) == null ? void 0 : _b.esbuildOptions) == null ? void 0 : _c.plugins) || []
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
178
|
},
|
|
167
179
|
configureServer(_server) {
|
|
168
180
|
ssrConfig.hot = domConfig.hot = true;
|
|
@@ -195,13 +207,20 @@ function markoPlugin(opts = {}) {
|
|
|
195
207
|
const serverMetaFile = await getServerManifestFile(root);
|
|
196
208
|
this.addWatchFile(serverMetaFile);
|
|
197
209
|
try {
|
|
198
|
-
serverManifest = JSON.parse(
|
|
210
|
+
serverManifest = JSON.parse(
|
|
211
|
+
await import_fs.default.promises.readFile(serverMetaFile, "utf-8")
|
|
212
|
+
);
|
|
199
213
|
inputOptions.input = toHTMLEntries(root, serverManifest.entries);
|
|
200
214
|
for (const entry in serverManifest.entrySources) {
|
|
201
|
-
entrySources.set(
|
|
215
|
+
entrySources.set(
|
|
216
|
+
import_path.default.resolve(root, entry),
|
|
217
|
+
serverManifest.entrySources[entry]
|
|
218
|
+
);
|
|
202
219
|
}
|
|
203
220
|
} catch (err) {
|
|
204
|
-
this.error(
|
|
221
|
+
this.error(
|
|
222
|
+
`You must run the "ssr" build before the "browser" build.`
|
|
223
|
+
);
|
|
205
224
|
}
|
|
206
225
|
if (isEmpty(inputOptions.input)) {
|
|
207
226
|
this.error("No Marko files were found when compiling the server.");
|
|
@@ -216,14 +235,17 @@ function markoPlugin(opts = {}) {
|
|
|
216
235
|
let importeeQuery = getMarkoQuery(importee);
|
|
217
236
|
if (importeeQuery) {
|
|
218
237
|
importee = importee.slice(0, -importeeQuery.length);
|
|
219
|
-
} else if (ssr && linked && importer && importer !== devEntryFile &&
|
|
238
|
+
} else if (ssr && linked && importer && importer !== devEntryFile && // Vite tries to resolve against an `index.html` in some cases, we ignore it here.
|
|
239
|
+
isMarkoFile(importee) && !isMarkoFile(importer.replace(queryReg, ""))) {
|
|
220
240
|
importeeQuery = serverEntryQuery;
|
|
221
241
|
} else if (!ssr && isBuild && importer && isMarkoFile(importee) && ((_a2 = this.getModuleInfo(importer)) == null ? void 0 : _a2.isEntry)) {
|
|
222
242
|
importeeQuery = browserEntryQuery;
|
|
223
243
|
}
|
|
224
244
|
if (importeeQuery) {
|
|
225
245
|
const resolved = importee[0] === "." ? {
|
|
226
|
-
id: normalizePath(
|
|
246
|
+
id: normalizePath(
|
|
247
|
+
importer ? import_path.default.resolve(importer, "..", importee) : import_path.default.resolve(root, importee)
|
|
248
|
+
)
|
|
227
249
|
} : await this.resolve(importee, importer, resolveOpts);
|
|
228
250
|
if (resolved) {
|
|
229
251
|
resolved.id += importeeQuery;
|
|
@@ -261,7 +283,14 @@ function markoPlugin(opts = {}) {
|
|
|
261
283
|
serverManifest.entries[entryId] = relativeFileName;
|
|
262
284
|
entryData = JSON.stringify(entryId);
|
|
263
285
|
} else {
|
|
264
|
-
entryData = JSON.stringify(
|
|
286
|
+
entryData = JSON.stringify(
|
|
287
|
+
await (0, import_manifest_generator.generateDocManifest)(
|
|
288
|
+
await devServer.transformIndexHtml(
|
|
289
|
+
"/",
|
|
290
|
+
(0, import_manifest_generator.generateInputDoc)(fileNameToURL(fileName, root))
|
|
291
|
+
)
|
|
292
|
+
)
|
|
293
|
+
);
|
|
265
294
|
}
|
|
266
295
|
return (0, import_server_entry_template.default)({
|
|
267
296
|
fileName,
|
|
@@ -279,7 +308,10 @@ function markoPlugin(opts = {}) {
|
|
|
279
308
|
if (isBuild) {
|
|
280
309
|
return html;
|
|
281
310
|
}
|
|
282
|
-
return html.replace(
|
|
311
|
+
return html.replace(
|
|
312
|
+
/(src\s*=\s*(['"])(?:(?!\2).)*\.marko)(?:\?((?:(?!\2).)*))?\2/gim,
|
|
313
|
+
(_, prefix, quote, query) => prefix + browserEntryQuery + (query ? "&" + query : "") + quote
|
|
314
|
+
);
|
|
283
315
|
},
|
|
284
316
|
async transform(source, id, ssr) {
|
|
285
317
|
const query = getMarkoQuery(id);
|
|
@@ -298,7 +330,11 @@ function markoPlugin(opts = {}) {
|
|
|
298
330
|
serverManifest.entrySources[import_path.default.relative(root, id)] = source;
|
|
299
331
|
}
|
|
300
332
|
}
|
|
301
|
-
const compiled = await compiler.compile(
|
|
333
|
+
const compiled = await compiler.compile(
|
|
334
|
+
source,
|
|
335
|
+
id,
|
|
336
|
+
(typeof ssr === "object" ? ssr.ssr : ssr) ? ssrConfig : query === browserEntryQuery ? hydrateConfig : domConfig
|
|
337
|
+
);
|
|
302
338
|
const { map, meta } = compiled;
|
|
303
339
|
let { code } = compiled;
|
|
304
340
|
if (query !== browserEntryQuery && devServer) {
|
|
@@ -326,15 +362,20 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
326
362
|
name: "marko-vite:post",
|
|
327
363
|
apply: "build",
|
|
328
364
|
enforce: "post",
|
|
365
|
+
// We use a "post" plugin to allow us to read the final generated `.html` from vite.
|
|
329
366
|
async generateBundle(outputOptions, bundle, isWrite) {
|
|
330
367
|
if (!linked) {
|
|
331
368
|
return;
|
|
332
369
|
}
|
|
333
370
|
if (!isWrite) {
|
|
334
|
-
this.error(
|
|
371
|
+
this.error(
|
|
372
|
+
`Linked builds are currently only supported when in "write" mode.`
|
|
373
|
+
);
|
|
335
374
|
}
|
|
336
375
|
if (!serverManifest) {
|
|
337
|
-
this.error(
|
|
376
|
+
this.error(
|
|
377
|
+
"No Marko files were found when bundling the server in linked mode."
|
|
378
|
+
);
|
|
338
379
|
}
|
|
339
380
|
if (isSSRBuild) {
|
|
340
381
|
const dir = outputOptions.dir ? import_path.default.resolve(outputOptions.dir) : import_path.default.resolve(outputOptions.file, "..");
|
|
@@ -343,13 +384,18 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
343
384
|
if (chunk.type === "chunk") {
|
|
344
385
|
for (const id in chunk.modules) {
|
|
345
386
|
if (id === registeredTag) {
|
|
346
|
-
serverManifest.chunksNeedingAssets.push(
|
|
387
|
+
serverManifest.chunksNeedingAssets.push(
|
|
388
|
+
import_path.default.resolve(dir, fileName)
|
|
389
|
+
);
|
|
347
390
|
break;
|
|
348
391
|
}
|
|
349
392
|
}
|
|
350
393
|
}
|
|
351
394
|
}
|
|
352
|
-
await import_fs.default.promises.writeFile(
|
|
395
|
+
await import_fs.default.promises.writeFile(
|
|
396
|
+
await getServerManifestFile(root),
|
|
397
|
+
JSON.stringify(serverManifest)
|
|
398
|
+
);
|
|
353
399
|
} else {
|
|
354
400
|
const browserManifest = {};
|
|
355
401
|
for (const entryId in serverManifest.entries) {
|
|
@@ -361,13 +407,19 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
361
407
|
chunk = bundle[chunkId];
|
|
362
408
|
}
|
|
363
409
|
if ((chunk == null ? void 0 : chunk.type) === "asset") {
|
|
364
|
-
browserManifest[entryId] = await (0, import_manifest_generator.generateDocManifest)(
|
|
410
|
+
browserManifest[entryId] = await (0, import_manifest_generator.generateDocManifest)(
|
|
411
|
+
chunk.source.toString()
|
|
412
|
+
);
|
|
365
413
|
delete bundle[chunkId];
|
|
366
414
|
} else {
|
|
367
|
-
this.error(
|
|
415
|
+
this.error(
|
|
416
|
+
`Marko template had unexpected output from vite, ${fileName}`
|
|
417
|
+
);
|
|
368
418
|
}
|
|
369
419
|
}
|
|
370
|
-
const manifestStr = `;var __MARKO_MANIFEST__=${JSON.stringify(
|
|
420
|
+
const manifestStr = `;var __MARKO_MANIFEST__=${JSON.stringify(
|
|
421
|
+
browserManifest
|
|
422
|
+
)};
|
|
371
423
|
`;
|
|
372
424
|
for (const fileName of serverManifest.chunksNeedingAssets) {
|
|
373
425
|
await import_fs.default.promises.appendFile(fileName, manifestStr);
|
|
@@ -401,7 +453,10 @@ async function getServerManifestFile(root) {
|
|
|
401
453
|
}
|
|
402
454
|
function getTempDir(root) {
|
|
403
455
|
return tempDir || (tempDir = (async () => {
|
|
404
|
-
const dir = import_path.default.join(
|
|
456
|
+
const dir = import_path.default.join(
|
|
457
|
+
import_os.default.tmpdir(),
|
|
458
|
+
`marko-vite-${import_crypto.default.createHash("SHA1").update(root).digest("hex")}`
|
|
459
|
+
);
|
|
405
460
|
try {
|
|
406
461
|
const stat = await import_fs.default.promises.stat(dir);
|
|
407
462
|
if (stat.isDirectory()) {
|
|
@@ -418,14 +473,22 @@ function toEntryId(id) {
|
|
|
418
473
|
const lastSepIndex = id.lastIndexOf(import_path.default.sep);
|
|
419
474
|
let name = id.slice(lastSepIndex + 1, id.indexOf(".", lastSepIndex));
|
|
420
475
|
if (name === "index" || name === "template") {
|
|
421
|
-
name = id.slice(
|
|
476
|
+
name = id.slice(
|
|
477
|
+
id.lastIndexOf(import_path.default.sep, lastSepIndex - 1) + 1,
|
|
478
|
+
lastSepIndex
|
|
479
|
+
);
|
|
422
480
|
}
|
|
423
481
|
return `${name}_${import_crypto.default.createHash("SHA1").update(id).digest("base64").replace(/[/+]/g, "-").slice(0, 4)}`;
|
|
424
482
|
}
|
|
425
483
|
function fileNameToURL(fileName, root) {
|
|
426
|
-
const relativeURL = import_path.default.posix.relative(
|
|
484
|
+
const relativeURL = import_path.default.posix.relative(
|
|
485
|
+
(0, import_url.pathToFileURL)(root).pathname,
|
|
486
|
+
(0, import_url.pathToFileURL)(fileName).pathname
|
|
487
|
+
);
|
|
427
488
|
if (relativeURL[0] === ".") {
|
|
428
|
-
throw new Error(
|
|
489
|
+
throw new Error(
|
|
490
|
+
"@marko/vite: Entry templates must exist under the current root directory."
|
|
491
|
+
);
|
|
429
492
|
}
|
|
430
493
|
return `/${relativeURL}`;
|
|
431
494
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
esbuildPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KRSZ5IRT.mjs";
|
|
4
4
|
import {
|
|
5
5
|
generateDocManifest,
|
|
6
6
|
generateInputDoc
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DSFBTWOA.mjs";
|
|
8
8
|
import "./chunk-VL2HLMVE.mjs";
|
|
9
9
|
import {
|
|
10
10
|
server_entry_template_default
|
|
@@ -57,7 +57,9 @@ function markoPlugin(opts = {}) {
|
|
|
57
57
|
if (devServer) {
|
|
58
58
|
const prev = virtualFiles.get(id);
|
|
59
59
|
if (prev && prev.code !== dep.code) {
|
|
60
|
-
devServer.moduleGraph.invalidateModule(
|
|
60
|
+
devServer.moduleGraph.invalidateModule(
|
|
61
|
+
devServer.moduleGraph.getModuleById(id)
|
|
62
|
+
);
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
virtualFiles.set(id, dep);
|
|
@@ -92,16 +94,21 @@ function markoPlugin(opts = {}) {
|
|
|
92
94
|
{
|
|
93
95
|
name: "marko-vite:pre",
|
|
94
96
|
enforce: "pre",
|
|
97
|
+
// Must be pre to allow us to resolve assets before vite.
|
|
95
98
|
async config(config, env) {
|
|
96
|
-
var _a2, _b, _c;
|
|
97
99
|
compiler ?? (compiler = await import(opts.compiler || "@marko/compiler"));
|
|
98
100
|
root = normalizePath(config.root || process.cwd());
|
|
99
101
|
devEntryFile = path.join(root, "index.html");
|
|
100
102
|
isBuild = env.command === "build";
|
|
101
103
|
isSSRBuild = isBuild && linked && Boolean(config.build.ssr);
|
|
102
104
|
if (linked && !registeredTag) {
|
|
103
|
-
const transformer = path.resolve(
|
|
104
|
-
|
|
105
|
+
const transformer = path.resolve(
|
|
106
|
+
thisFile,
|
|
107
|
+
"../render-assets-transform"
|
|
108
|
+
);
|
|
109
|
+
registeredTag = normalizePath(
|
|
110
|
+
path.resolve(thisFile, "../components", "vite.marko")
|
|
111
|
+
);
|
|
105
112
|
compiler.taglib.register("@marko/vite", {
|
|
106
113
|
"<_vite>": { template: registeredTag },
|
|
107
114
|
"<head>": { transformer },
|
|
@@ -123,29 +130,27 @@ function markoPlugin(opts = {}) {
|
|
|
123
130
|
}
|
|
124
131
|
}
|
|
125
132
|
const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
|
|
126
|
-
optimizeDeps.include = Array.from(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
optimizeDeps.include = Array.from(
|
|
134
|
+
/* @__PURE__ */ new Set([
|
|
135
|
+
...optimizeDeps.include || [],
|
|
136
|
+
...compiler.getRuntimeEntryFiles("dom", opts.translator),
|
|
137
|
+
...compiler.getRuntimeEntryFiles("html", opts.translator),
|
|
138
|
+
...taglibDeps
|
|
139
|
+
])
|
|
140
|
+
);
|
|
141
|
+
const optimizeExtensions = optimizeDeps.extensions ?? (optimizeDeps.extensions = []);
|
|
142
|
+
optimizeExtensions.push(".marko");
|
|
143
|
+
const esbuildOptions = optimizeDeps.esbuildOptions ?? (optimizeDeps.esbuildOptions = {});
|
|
144
|
+
const esbuildPlugins = esbuildOptions.plugins ?? (esbuildOptions.plugins = []);
|
|
145
|
+
esbuildPlugins.push(esbuildPlugin(compiler, baseConfig));
|
|
132
146
|
const ssr = config.ssr ?? (config.ssr = {});
|
|
133
147
|
if (ssr.noExternal !== true) {
|
|
134
|
-
ssr.noExternal = Array.from(
|
|
148
|
+
ssr.noExternal = Array.from(
|
|
149
|
+
new Set(
|
|
150
|
+
taglibDeps.concat(ssr.noExternal || [])
|
|
151
|
+
)
|
|
152
|
+
);
|
|
135
153
|
}
|
|
136
|
-
return {
|
|
137
|
-
...config,
|
|
138
|
-
optimizeDeps: {
|
|
139
|
-
...config.optimizeDeps,
|
|
140
|
-
extensions: [".marko", ...((_a2 = config.optimizeDeps) == null ? void 0 : _a2.extensions) || []],
|
|
141
|
-
esbuildOptions: {
|
|
142
|
-
plugins: [
|
|
143
|
-
esbuildPlugin(compiler, baseConfig),
|
|
144
|
-
...((_c = (_b = config.optimizeDeps) == null ? void 0 : _b.esbuildOptions) == null ? void 0 : _c.plugins) || []
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
154
|
},
|
|
150
155
|
configureServer(_server) {
|
|
151
156
|
ssrConfig.hot = domConfig.hot = true;
|
|
@@ -178,13 +183,20 @@ function markoPlugin(opts = {}) {
|
|
|
178
183
|
const serverMetaFile = await getServerManifestFile(root);
|
|
179
184
|
this.addWatchFile(serverMetaFile);
|
|
180
185
|
try {
|
|
181
|
-
serverManifest = JSON.parse(
|
|
186
|
+
serverManifest = JSON.parse(
|
|
187
|
+
await fs.promises.readFile(serverMetaFile, "utf-8")
|
|
188
|
+
);
|
|
182
189
|
inputOptions.input = toHTMLEntries(root, serverManifest.entries);
|
|
183
190
|
for (const entry in serverManifest.entrySources) {
|
|
184
|
-
entrySources.set(
|
|
191
|
+
entrySources.set(
|
|
192
|
+
path.resolve(root, entry),
|
|
193
|
+
serverManifest.entrySources[entry]
|
|
194
|
+
);
|
|
185
195
|
}
|
|
186
196
|
} catch (err) {
|
|
187
|
-
this.error(
|
|
197
|
+
this.error(
|
|
198
|
+
`You must run the "ssr" build before the "browser" build.`
|
|
199
|
+
);
|
|
188
200
|
}
|
|
189
201
|
if (isEmpty(inputOptions.input)) {
|
|
190
202
|
this.error("No Marko files were found when compiling the server.");
|
|
@@ -199,14 +211,17 @@ function markoPlugin(opts = {}) {
|
|
|
199
211
|
let importeeQuery = getMarkoQuery(importee);
|
|
200
212
|
if (importeeQuery) {
|
|
201
213
|
importee = importee.slice(0, -importeeQuery.length);
|
|
202
|
-
} else if (ssr && linked && importer && importer !== devEntryFile &&
|
|
214
|
+
} else if (ssr && linked && importer && importer !== devEntryFile && // Vite tries to resolve against an `index.html` in some cases, we ignore it here.
|
|
215
|
+
isMarkoFile(importee) && !isMarkoFile(importer.replace(queryReg, ""))) {
|
|
203
216
|
importeeQuery = serverEntryQuery;
|
|
204
217
|
} else if (!ssr && isBuild && importer && isMarkoFile(importee) && ((_a2 = this.getModuleInfo(importer)) == null ? void 0 : _a2.isEntry)) {
|
|
205
218
|
importeeQuery = browserEntryQuery;
|
|
206
219
|
}
|
|
207
220
|
if (importeeQuery) {
|
|
208
221
|
const resolved = importee[0] === "." ? {
|
|
209
|
-
id: normalizePath(
|
|
222
|
+
id: normalizePath(
|
|
223
|
+
importer ? path.resolve(importer, "..", importee) : path.resolve(root, importee)
|
|
224
|
+
)
|
|
210
225
|
} : await this.resolve(importee, importer, resolveOpts);
|
|
211
226
|
if (resolved) {
|
|
212
227
|
resolved.id += importeeQuery;
|
|
@@ -244,7 +259,14 @@ function markoPlugin(opts = {}) {
|
|
|
244
259
|
serverManifest.entries[entryId] = relativeFileName;
|
|
245
260
|
entryData = JSON.stringify(entryId);
|
|
246
261
|
} else {
|
|
247
|
-
entryData = JSON.stringify(
|
|
262
|
+
entryData = JSON.stringify(
|
|
263
|
+
await generateDocManifest(
|
|
264
|
+
await devServer.transformIndexHtml(
|
|
265
|
+
"/",
|
|
266
|
+
generateInputDoc(fileNameToURL(fileName, root))
|
|
267
|
+
)
|
|
268
|
+
)
|
|
269
|
+
);
|
|
248
270
|
}
|
|
249
271
|
return server_entry_template_default({
|
|
250
272
|
fileName,
|
|
@@ -262,7 +284,10 @@ function markoPlugin(opts = {}) {
|
|
|
262
284
|
if (isBuild) {
|
|
263
285
|
return html;
|
|
264
286
|
}
|
|
265
|
-
return html.replace(
|
|
287
|
+
return html.replace(
|
|
288
|
+
/(src\s*=\s*(['"])(?:(?!\2).)*\.marko)(?:\?((?:(?!\2).)*))?\2/gim,
|
|
289
|
+
(_, prefix, quote, query) => prefix + browserEntryQuery + (query ? "&" + query : "") + quote
|
|
290
|
+
);
|
|
266
291
|
},
|
|
267
292
|
async transform(source, id, ssr) {
|
|
268
293
|
const query = getMarkoQuery(id);
|
|
@@ -281,7 +306,11 @@ function markoPlugin(opts = {}) {
|
|
|
281
306
|
serverManifest.entrySources[path.relative(root, id)] = source;
|
|
282
307
|
}
|
|
283
308
|
}
|
|
284
|
-
const compiled = await compiler.compile(
|
|
309
|
+
const compiled = await compiler.compile(
|
|
310
|
+
source,
|
|
311
|
+
id,
|
|
312
|
+
(typeof ssr === "object" ? ssr.ssr : ssr) ? ssrConfig : query === browserEntryQuery ? hydrateConfig : domConfig
|
|
313
|
+
);
|
|
285
314
|
const { map, meta } = compiled;
|
|
286
315
|
let { code } = compiled;
|
|
287
316
|
if (query !== browserEntryQuery && devServer) {
|
|
@@ -309,15 +338,20 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
309
338
|
name: "marko-vite:post",
|
|
310
339
|
apply: "build",
|
|
311
340
|
enforce: "post",
|
|
341
|
+
// We use a "post" plugin to allow us to read the final generated `.html` from vite.
|
|
312
342
|
async generateBundle(outputOptions, bundle, isWrite) {
|
|
313
343
|
if (!linked) {
|
|
314
344
|
return;
|
|
315
345
|
}
|
|
316
346
|
if (!isWrite) {
|
|
317
|
-
this.error(
|
|
347
|
+
this.error(
|
|
348
|
+
`Linked builds are currently only supported when in "write" mode.`
|
|
349
|
+
);
|
|
318
350
|
}
|
|
319
351
|
if (!serverManifest) {
|
|
320
|
-
this.error(
|
|
352
|
+
this.error(
|
|
353
|
+
"No Marko files were found when bundling the server in linked mode."
|
|
354
|
+
);
|
|
321
355
|
}
|
|
322
356
|
if (isSSRBuild) {
|
|
323
357
|
const dir = outputOptions.dir ? path.resolve(outputOptions.dir) : path.resolve(outputOptions.file, "..");
|
|
@@ -326,13 +360,18 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
326
360
|
if (chunk.type === "chunk") {
|
|
327
361
|
for (const id in chunk.modules) {
|
|
328
362
|
if (id === registeredTag) {
|
|
329
|
-
serverManifest.chunksNeedingAssets.push(
|
|
363
|
+
serverManifest.chunksNeedingAssets.push(
|
|
364
|
+
path.resolve(dir, fileName)
|
|
365
|
+
);
|
|
330
366
|
break;
|
|
331
367
|
}
|
|
332
368
|
}
|
|
333
369
|
}
|
|
334
370
|
}
|
|
335
|
-
await fs.promises.writeFile(
|
|
371
|
+
await fs.promises.writeFile(
|
|
372
|
+
await getServerManifestFile(root),
|
|
373
|
+
JSON.stringify(serverManifest)
|
|
374
|
+
);
|
|
336
375
|
} else {
|
|
337
376
|
const browserManifest = {};
|
|
338
377
|
for (const entryId in serverManifest.entries) {
|
|
@@ -344,13 +383,19 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
344
383
|
chunk = bundle[chunkId];
|
|
345
384
|
}
|
|
346
385
|
if ((chunk == null ? void 0 : chunk.type) === "asset") {
|
|
347
|
-
browserManifest[entryId] = await generateDocManifest(
|
|
386
|
+
browserManifest[entryId] = await generateDocManifest(
|
|
387
|
+
chunk.source.toString()
|
|
388
|
+
);
|
|
348
389
|
delete bundle[chunkId];
|
|
349
390
|
} else {
|
|
350
|
-
this.error(
|
|
391
|
+
this.error(
|
|
392
|
+
`Marko template had unexpected output from vite, ${fileName}`
|
|
393
|
+
);
|
|
351
394
|
}
|
|
352
395
|
}
|
|
353
|
-
const manifestStr = `;var __MARKO_MANIFEST__=${JSON.stringify(
|
|
396
|
+
const manifestStr = `;var __MARKO_MANIFEST__=${JSON.stringify(
|
|
397
|
+
browserManifest
|
|
398
|
+
)};
|
|
354
399
|
`;
|
|
355
400
|
for (const fileName of serverManifest.chunksNeedingAssets) {
|
|
356
401
|
await fs.promises.appendFile(fileName, manifestStr);
|
|
@@ -384,7 +429,10 @@ async function getServerManifestFile(root) {
|
|
|
384
429
|
}
|
|
385
430
|
function getTempDir(root) {
|
|
386
431
|
return tempDir || (tempDir = (async () => {
|
|
387
|
-
const dir = path.join(
|
|
432
|
+
const dir = path.join(
|
|
433
|
+
os.tmpdir(),
|
|
434
|
+
`marko-vite-${crypto.createHash("SHA1").update(root).digest("hex")}`
|
|
435
|
+
);
|
|
388
436
|
try {
|
|
389
437
|
const stat = await fs.promises.stat(dir);
|
|
390
438
|
if (stat.isDirectory()) {
|
|
@@ -401,14 +449,22 @@ function toEntryId(id) {
|
|
|
401
449
|
const lastSepIndex = id.lastIndexOf(path.sep);
|
|
402
450
|
let name = id.slice(lastSepIndex + 1, id.indexOf(".", lastSepIndex));
|
|
403
451
|
if (name === "index" || name === "template") {
|
|
404
|
-
name = id.slice(
|
|
452
|
+
name = id.slice(
|
|
453
|
+
id.lastIndexOf(path.sep, lastSepIndex - 1) + 1,
|
|
454
|
+
lastSepIndex
|
|
455
|
+
);
|
|
405
456
|
}
|
|
406
457
|
return `${name}_${crypto.createHash("SHA1").update(id).digest("base64").replace(/[/+]/g, "-").slice(0, 4)}`;
|
|
407
458
|
}
|
|
408
459
|
function fileNameToURL(fileName, root) {
|
|
409
|
-
const relativeURL = path.posix.relative(
|
|
460
|
+
const relativeURL = path.posix.relative(
|
|
461
|
+
pathToFileURL(root).pathname,
|
|
462
|
+
pathToFileURL(fileName).pathname
|
|
463
|
+
);
|
|
410
464
|
if (relativeURL[0] === ".") {
|
|
411
|
-
throw new Error(
|
|
465
|
+
throw new Error(
|
|
466
|
+
"@marko/vite: Entry templates must exist under the current root directory."
|
|
467
|
+
);
|
|
412
468
|
}
|
|
413
469
|
return `/${relativeURL}`;
|
|
414
470
|
}
|
|
@@ -17,7 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
21
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
29
|
var manifest_generator_exports = {};
|
|
23
30
|
__export(manifest_generator_exports, {
|
|
@@ -32,30 +39,46 @@ var import_serializer = __toESM(require("./serializer"));
|
|
|
32
39
|
const MARKER_COMMENT = "MARKO_VITE";
|
|
33
40
|
function generateDocManifest(rawHtml) {
|
|
34
41
|
return new Promise((resolve, reject) => {
|
|
35
|
-
const parser = new import_htmlparser2.Parser(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
const parser = new import_htmlparser2.Parser(
|
|
43
|
+
new import_domhandler.DomHandler(function(err, dom) {
|
|
44
|
+
if (err) {
|
|
45
|
+
return reject(err);
|
|
46
|
+
}
|
|
47
|
+
const htmlChildren = dom.find(isElement).childNodes;
|
|
48
|
+
const headPrepend = [];
|
|
49
|
+
const head = [];
|
|
50
|
+
const bodyPrepend = [];
|
|
51
|
+
const body = [];
|
|
52
|
+
splitNodesByMarker(
|
|
53
|
+
htmlChildren.find(
|
|
54
|
+
(node) => isElement(node) && node.tagName === "head"
|
|
55
|
+
).childNodes,
|
|
56
|
+
headPrepend,
|
|
57
|
+
head
|
|
58
|
+
);
|
|
59
|
+
splitNodesByMarker(
|
|
60
|
+
htmlChildren.find(
|
|
61
|
+
(node) => isElement(node) && node.tagName === "body"
|
|
62
|
+
).childNodes,
|
|
63
|
+
bodyPrepend,
|
|
64
|
+
body
|
|
65
|
+
);
|
|
66
|
+
resolve({
|
|
67
|
+
"head-prepend": serializeOrNull(headPrepend),
|
|
68
|
+
head: serializeOrNull(head),
|
|
69
|
+
"body-prepend": serializeOrNull(bodyPrepend),
|
|
70
|
+
body: serializeOrNull(body)
|
|
71
|
+
});
|
|
72
|
+
})
|
|
73
|
+
);
|
|
53
74
|
parser.write(rawHtml);
|
|
54
75
|
parser.end();
|
|
55
76
|
});
|
|
56
77
|
}
|
|
57
78
|
function generateInputDoc(entry) {
|
|
58
|
-
return `<!DOCTYPE html><html><head><!--${MARKER_COMMENT}--></head><body><!--${MARKER_COMMENT}--><script async type="module" src=${JSON.stringify(
|
|
79
|
+
return `<!DOCTYPE html><html><head><!--${MARKER_COMMENT}--></head><body><!--${MARKER_COMMENT}--><script async type="module" src=${JSON.stringify(
|
|
80
|
+
entry
|
|
81
|
+
)}></script></body></html>`;
|
|
59
82
|
}
|
|
60
83
|
function serializeOrNull(nodes) {
|
|
61
84
|
const result = (0, import_serializer.default)(nodes);
|
|
@@ -28,7 +28,16 @@ var render_assets_transform_default = (tag, t) => {
|
|
|
28
28
|
body.pushContainer("body", renderAssetsCall(t, tagName));
|
|
29
29
|
};
|
|
30
30
|
function renderAssetsCall(t, slot) {
|
|
31
|
-
return t.markoPlaceholder(
|
|
31
|
+
return t.markoPlaceholder(
|
|
32
|
+
t.callExpression(
|
|
33
|
+
t.memberExpression(
|
|
34
|
+
t.memberExpression(t.identifier("out"), t.identifier("global")),
|
|
35
|
+
t.identifier("___viteRenderAssets")
|
|
36
|
+
),
|
|
37
|
+
[t.stringLiteral(slot)]
|
|
38
|
+
),
|
|
39
|
+
false
|
|
40
|
+
);
|
|
32
41
|
}
|
|
33
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
43
|
0 && (module.exports = {});
|
|
@@ -6,7 +6,16 @@ var render_assets_transform_default = (tag, t) => {
|
|
|
6
6
|
body.pushContainer("body", renderAssetsCall(t, tagName));
|
|
7
7
|
};
|
|
8
8
|
function renderAssetsCall(t, slot) {
|
|
9
|
-
return t.markoPlaceholder(
|
|
9
|
+
return t.markoPlaceholder(
|
|
10
|
+
t.callExpression(
|
|
11
|
+
t.memberExpression(
|
|
12
|
+
t.memberExpression(t.identifier("out"), t.identifier("global")),
|
|
13
|
+
t.identifier("___viteRenderAssets")
|
|
14
|
+
),
|
|
15
|
+
[t.stringLiteral(slot)]
|
|
16
|
+
),
|
|
17
|
+
false
|
|
18
|
+
);
|
|
10
19
|
}
|
|
11
20
|
export {
|
|
12
21
|
render_assets_transform_default as default
|
|
@@ -17,7 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
21
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
29
|
var server_entry_template_exports = {};
|
|
23
30
|
__export(server_entry_template_exports, {
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/vite",
|
|
3
3
|
"description": "A Marko plugin for Vite",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.10",
|
|
5
5
|
"author": "Dylan Piercey <dpiercey@ebay.com>",
|
|
6
6
|
"bugs": "https://github.com/marko-js/vite/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"anymatch": "^3.1.
|
|
8
|
+
"anymatch": "^3.1.3",
|
|
9
9
|
"domelementtype": "^2.3.0",
|
|
10
10
|
"domhandler": "^5.0.3",
|
|
11
11
|
"htmlparser2": "^8.0.1",
|
|
12
12
|
"relative-import-path": "^1.0.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@changesets/changelog-github": "^0.4.
|
|
16
|
-
"@changesets/cli": "^2.
|
|
17
|
-
"@marko/compiler": "^5.
|
|
15
|
+
"@changesets/changelog-github": "^0.4.8",
|
|
16
|
+
"@changesets/cli": "^2.26.0",
|
|
17
|
+
"@marko/compiler": "^5.23.0",
|
|
18
18
|
"@marko/fixture-snapshots": "^2.1.7",
|
|
19
19
|
"@marko/testing-library": "^6.1.2",
|
|
20
|
-
"@types/jsdom": "^
|
|
21
|
-
"@types/mocha": "^
|
|
22
|
-
"@types/node": "^18.
|
|
20
|
+
"@types/jsdom": "^20.0.1",
|
|
21
|
+
"@types/mocha": "^10.0.1",
|
|
22
|
+
"@types/node": "^18.11.18",
|
|
23
23
|
"@types/serve-handler": "^6.1.1",
|
|
24
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
25
|
-
"@typescript-eslint/parser": "^5.
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
|
25
|
+
"@typescript-eslint/parser": "^5.48.0",
|
|
26
26
|
"cross-env": "^7.0.3",
|
|
27
|
-
"esbuild": "^0.14
|
|
28
|
-
"eslint": "^8.
|
|
29
|
-
"eslint-config-prettier": "^8.
|
|
30
|
-
"fast-glob": "^3.2.
|
|
27
|
+
"esbuild": "^0.16.14",
|
|
28
|
+
"eslint": "^8.31.0",
|
|
29
|
+
"eslint-config-prettier": "^8.6.0",
|
|
30
|
+
"fast-glob": "^3.2.12",
|
|
31
31
|
"fixpack": "^4.0.0",
|
|
32
|
-
"husky": "^8.0.
|
|
33
|
-
"jsdom": "^
|
|
34
|
-
"lint-staged": "^13.0
|
|
35
|
-
"marko": "^5.
|
|
36
|
-
"mocha": "^10.
|
|
32
|
+
"husky": "^8.0.3",
|
|
33
|
+
"jsdom": "^20.0.3",
|
|
34
|
+
"lint-staged": "^13.1.0",
|
|
35
|
+
"marko": "^5.22.0",
|
|
36
|
+
"mocha": "^10.2.0",
|
|
37
37
|
"mocha-snap": "^4.3.0",
|
|
38
38
|
"nyc": "^15.1.0",
|
|
39
|
-
"playwright": "^1.
|
|
40
|
-
"prettier": "^2.
|
|
41
|
-
"serve-handler": "^6.1.
|
|
42
|
-
"tsx": "^3.
|
|
43
|
-
"typescript": "^4.
|
|
44
|
-
"vite": "
|
|
39
|
+
"playwright": "^1.29.1",
|
|
40
|
+
"prettier": "^2.8.1",
|
|
41
|
+
"serve-handler": "^6.1.5",
|
|
42
|
+
"tsx": "^3.12.1",
|
|
43
|
+
"typescript": "^4.9.4",
|
|
44
|
+
"vite": "^4.0.4"
|
|
45
45
|
},
|
|
46
46
|
"exports": {
|
|
47
47
|
".": {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"module": "./dist/index.mjs",
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@marko/compiler": "^5",
|
|
72
|
-
"vite": "^2 || ^3"
|
|
72
|
+
"vite": "^2 || ^3 || ^4"
|
|
73
73
|
},
|
|
74
74
|
"repository": {
|
|
75
75
|
"type": "git",
|