@marko/vite 2.3.2 → 2.3.5
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/LICENSE +1 -1
- package/dist/{chunk-LBJFIET7.mjs → chunk-Z64RCGRQ.mjs} +3 -7
- package/dist/components/vite.marko +12 -9
- package/dist/esbuild-plugin.js +13 -35
- package/dist/esbuild-plugin.mjs +1 -2
- package/dist/index.js +66 -67
- package/dist/index.mjs +57 -39
- package/dist/manifest-generator.js +10 -16
- package/dist/manifest-generator.mjs +0 -1
- package/dist/render-assets-transform.js +10 -14
- package/dist/render-assets-transform.mjs +1 -3
- package/dist/serializer.js +9 -13
- package/dist/serializer.mjs +0 -1
- package/dist/server-entry-template.js +10 -16
- package/dist/server-entry-template.mjs +0 -1
- package/package.json +33 -33
- package/dist/chunk-SOEV5HRE.mjs +0 -24
- package/dist/components/vite-watch.marko +0 -31
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2022 eBay Inc. and contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__spreadProps,
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "./chunk-SOEV5HRE.mjs";
|
|
5
|
-
|
|
6
1
|
// src/esbuild-plugin.ts
|
|
7
2
|
import fs from "fs";
|
|
8
3
|
import path from "path";
|
|
@@ -13,13 +8,14 @@ function esbuildPlugin(compiler, config) {
|
|
|
13
8
|
async setup(build) {
|
|
14
9
|
const { platform = "browser" } = build.initialOptions;
|
|
15
10
|
const virtualFiles = /* @__PURE__ */ new Map();
|
|
16
|
-
const finalConfig =
|
|
11
|
+
const finalConfig = {
|
|
12
|
+
...config,
|
|
17
13
|
output: platform === "browser" ? "dom" : "html",
|
|
18
14
|
resolveVirtualDependency(from, dep) {
|
|
19
15
|
virtualFiles.set(path.join(from, "..", dep.virtualPath), dep);
|
|
20
16
|
return dep.virtualPath;
|
|
21
17
|
}
|
|
22
|
-
}
|
|
18
|
+
};
|
|
23
19
|
if (platform === "browser") {
|
|
24
20
|
build.onResolve({ filter: /\.marko\./ }, (args) => {
|
|
25
21
|
return {
|
|
@@ -5,27 +5,30 @@ static function renderAssets(slot) {
|
|
|
5
5
|
if (entries) {
|
|
6
6
|
const slotWrittenEntriesKey = `___viteWrittenEntries-${slot}`;
|
|
7
7
|
const lastWrittenEntry = this[slotWrittenEntriesKey] || 0;
|
|
8
|
-
const writtenEntries = this[slotWrittenEntriesKey] = entries.length;
|
|
9
|
-
|
|
8
|
+
const writtenEntries = (this[slotWrittenEntriesKey] = entries.length);
|
|
9
|
+
|
|
10
10
|
for (let i = lastWrittenEntry; i < writtenEntries; i++) {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const entry = entries[i];
|
|
12
|
+
const parts = typeof __MARKO_MANIFEST__ === "object"
|
|
13
|
+
? __MARKO_MANIFEST__[entry]?.[slot]
|
|
14
|
+
: entry[slot];
|
|
13
15
|
|
|
14
|
-
if (
|
|
15
|
-
html +=
|
|
16
|
+
if (parts) {
|
|
17
|
+
html += parts.join(this.___viteInjectAttrs);
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
return html;
|
|
21
23
|
}
|
|
22
|
-
|
|
23
24
|
$ const $global = out.global;
|
|
24
25
|
$ if (!$global.___viteRenderAssets) {
|
|
25
|
-
$global.___viteInjectAttrs = $global.cspNonce
|
|
26
|
+
$global.___viteInjectAttrs = $global.cspNonce
|
|
27
|
+
? ` nonce="${$global.cspNonce.replace(/"/g, "'")}"`
|
|
28
|
+
: "";
|
|
26
29
|
$global.___viteRenderAssets = renderAssets;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
<__flush_here_and_after__>
|
|
30
33
|
$!{$global.___viteRenderAssets(input.slot)}
|
|
31
|
-
|
|
34
|
+
</__flush_here_and_after__>
|
package/dist/esbuild-plugin.js
CHANGED
|
@@ -1,51 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
11
|
};
|
|
29
|
-
var
|
|
30
|
-
if (
|
|
31
|
-
for (let key of __getOwnPropNames(
|
|
32
|
-
if (!__hasOwnProp.call(
|
|
33
|
-
__defProp(
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
17
|
}
|
|
35
|
-
return
|
|
18
|
+
return to;
|
|
36
19
|
};
|
|
37
|
-
var __toESM = (
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
41
|
-
return (module2, temp) => {
|
|
42
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
43
|
-
};
|
|
44
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
22
|
var esbuild_plugin_exports = {};
|
|
46
23
|
__export(esbuild_plugin_exports, {
|
|
47
24
|
default: () => esbuildPlugin
|
|
48
25
|
});
|
|
26
|
+
module.exports = __toCommonJS(esbuild_plugin_exports);
|
|
49
27
|
var import_fs = __toESM(require("fs"));
|
|
50
28
|
var import_path = __toESM(require("path"));
|
|
51
29
|
const markoErrorRegExp = /^(.+?)(?:\((\d+)(?:\s*,\s*(\d+))?\))?: (.*)$/gm;
|
|
@@ -55,13 +33,14 @@ function esbuildPlugin(compiler, config) {
|
|
|
55
33
|
async setup(build) {
|
|
56
34
|
const { platform = "browser" } = build.initialOptions;
|
|
57
35
|
const virtualFiles = /* @__PURE__ */ new Map();
|
|
58
|
-
const finalConfig =
|
|
36
|
+
const finalConfig = {
|
|
37
|
+
...config,
|
|
59
38
|
output: platform === "browser" ? "dom" : "html",
|
|
60
39
|
resolveVirtualDependency(from, dep) {
|
|
61
40
|
virtualFiles.set(import_path.default.join(from, "..", dep.virtualPath), dep);
|
|
62
41
|
return dep.virtualPath;
|
|
63
42
|
}
|
|
64
|
-
}
|
|
43
|
+
};
|
|
65
44
|
if (platform === "browser") {
|
|
66
45
|
build.onResolve({ filter: /\.marko\./ }, (args) => {
|
|
67
46
|
return {
|
|
@@ -114,6 +93,5 @@ function esbuildPlugin(compiler, config) {
|
|
|
114
93
|
}
|
|
115
94
|
};
|
|
116
95
|
}
|
|
117
|
-
module.exports = __toCommonJS(esbuild_plugin_exports);
|
|
118
96
|
// Annotate the CommonJS export names for ESM import in node:
|
|
119
97
|
0 && (module.exports = {});
|
package/dist/esbuild-plugin.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,57 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
-
var __spreadValues = (a, b) => {
|
|
13
|
-
for (var prop in b || (b = {}))
|
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
if (__getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
-
if (__propIsEnum.call(b, prop))
|
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
};
|
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
11
|
};
|
|
29
|
-
var
|
|
30
|
-
if (
|
|
31
|
-
for (let key of __getOwnPropNames(
|
|
32
|
-
if (!__hasOwnProp.call(
|
|
33
|
-
__defProp(
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
17
|
}
|
|
35
|
-
return
|
|
36
|
-
};
|
|
37
|
-
var __toESM = (module2, isNodeMode) => {
|
|
38
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
+
return to;
|
|
39
19
|
};
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
return cache2 && cache2.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache2 && cache2.set(module2, temp), temp);
|
|
43
|
-
};
|
|
44
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
22
|
var src_exports = {};
|
|
46
23
|
__export(src_exports, {
|
|
47
24
|
default: () => markoPlugin
|
|
48
25
|
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
49
27
|
var import_os = __toESM(require("os"));
|
|
50
28
|
var import_fs = __toESM(require("fs"));
|
|
51
29
|
var import_path = __toESM(require("path"));
|
|
52
30
|
var import_crypto = __toESM(require("crypto"));
|
|
53
31
|
var import_anymatch = __toESM(require("anymatch"));
|
|
54
32
|
var import_url = require("url");
|
|
33
|
+
var import_relative_import_path = require("relative-import-path");
|
|
55
34
|
var import_server_entry_template = __toESM(require("./server-entry-template"));
|
|
56
35
|
var import_manifest_generator = require("./manifest-generator");
|
|
57
36
|
var import_esbuild_plugin = __toESM(require("./esbuild-plugin"));
|
|
@@ -77,15 +56,17 @@ function markoPlugin(opts = {}) {
|
|
|
77
56
|
runtimeId,
|
|
78
57
|
sourceMaps: true,
|
|
79
58
|
writeVersionComment: false,
|
|
80
|
-
babelConfig:
|
|
81
|
-
|
|
59
|
+
babelConfig: {
|
|
60
|
+
...opts.babelConfig,
|
|
61
|
+
caller: {
|
|
82
62
|
name: "@marko/vite",
|
|
83
63
|
supportsStaticESM: true,
|
|
84
64
|
supportsDynamicImport: true,
|
|
85
65
|
supportsTopLevelAwait: true,
|
|
86
|
-
supportsExportNamespaceFrom: true
|
|
87
|
-
|
|
88
|
-
|
|
66
|
+
supportsExportNamespaceFrom: true,
|
|
67
|
+
...(_a = opts.babelConfig) == null ? void 0 : _a.caller
|
|
68
|
+
}
|
|
69
|
+
}
|
|
89
70
|
};
|
|
90
71
|
const resolveViteVirtualDep = (from, dep) => {
|
|
91
72
|
const query = `${virtualFileQuery}&id=${normalizePath(dep.virtualPath)}`;
|
|
@@ -99,18 +80,21 @@ function markoPlugin(opts = {}) {
|
|
|
99
80
|
virtualFiles.set(id, dep);
|
|
100
81
|
return `./${import_path.default.basename(from) + query}`;
|
|
101
82
|
};
|
|
102
|
-
const ssrConfig =
|
|
83
|
+
const ssrConfig = {
|
|
84
|
+
...baseConfig,
|
|
103
85
|
resolveVirtualDependency: resolveViteVirtualDep,
|
|
104
86
|
output: "html"
|
|
105
|
-
}
|
|
106
|
-
const domConfig =
|
|
87
|
+
};
|
|
88
|
+
const domConfig = {
|
|
89
|
+
...baseConfig,
|
|
107
90
|
resolveVirtualDependency: resolveViteVirtualDep,
|
|
108
91
|
output: "dom"
|
|
109
|
-
}
|
|
110
|
-
const hydrateConfig =
|
|
92
|
+
};
|
|
93
|
+
const hydrateConfig = {
|
|
94
|
+
...baseConfig,
|
|
111
95
|
resolveVirtualDependency: resolveViteVirtualDep,
|
|
112
96
|
output: "hydrate"
|
|
113
|
-
}
|
|
97
|
+
};
|
|
114
98
|
let root;
|
|
115
99
|
let devEntryFile;
|
|
116
100
|
let isBuild = false;
|
|
@@ -118,6 +102,7 @@ function markoPlugin(opts = {}) {
|
|
|
118
102
|
let devServer;
|
|
119
103
|
let registeredTag = false;
|
|
120
104
|
let serverManifest;
|
|
105
|
+
const devEntryFileSources = /* @__PURE__ */ new Map();
|
|
121
106
|
const transformWatchFiles = /* @__PURE__ */ new Map();
|
|
122
107
|
const transformOptionalFiles = /* @__PURE__ */ new Map();
|
|
123
108
|
return [
|
|
@@ -131,9 +116,9 @@ function markoPlugin(opts = {}) {
|
|
|
131
116
|
devEntryFile = import_path.default.join(root, "index.html");
|
|
132
117
|
isBuild = env.command === "build";
|
|
133
118
|
isSSRBuild = isBuild && linked && Boolean(config.build.ssr);
|
|
134
|
-
if (!registeredTag) {
|
|
119
|
+
if (linked && !registeredTag) {
|
|
135
120
|
const transformer = import_path.default.resolve(thisFile, "../render-assets-transform");
|
|
136
|
-
registeredTag = normalizePath(import_path.default.resolve(thisFile, "../components",
|
|
121
|
+
registeredTag = normalizePath(import_path.default.resolve(thisFile, "../components", "vite.marko"));
|
|
137
122
|
compiler.taglib.register("@marko/vite", {
|
|
138
123
|
"<_vite>": { template: registeredTag },
|
|
139
124
|
"<head>": { transformer },
|
|
@@ -144,45 +129,48 @@ function markoPlugin(opts = {}) {
|
|
|
144
129
|
const taglibDeps = [];
|
|
145
130
|
for (const name in lookup.taglibsById) {
|
|
146
131
|
const taglib = lookup.taglibsById[name];
|
|
147
|
-
if (/[\\/]node_modules[\\/]
|
|
132
|
+
if (!/^marko-(.+-)?core$/.test(taglib.id) && /[\\/]node_modules[\\/]/.test(taglib.dirname)) {
|
|
148
133
|
for (const tagName in taglib.tags) {
|
|
149
134
|
const tag = taglib.tags[tagName];
|
|
150
135
|
const entry = tag.template || tag.renderer;
|
|
151
136
|
if (entry) {
|
|
152
|
-
taglibDeps.push(
|
|
137
|
+
taglibDeps.push((0, import_relative_import_path.relativeImportPath)(devEntryFile, entry));
|
|
153
138
|
}
|
|
154
139
|
}
|
|
155
140
|
}
|
|
156
141
|
}
|
|
157
|
-
const domDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("dom", opts.translator).concat(taglibDeps)));
|
|
158
142
|
const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
|
|
159
|
-
optimizeDeps.include
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
143
|
+
optimizeDeps.include = Array.from(/* @__PURE__ */ new Set([
|
|
144
|
+
...optimizeDeps.include || [],
|
|
145
|
+
...compiler.getRuntimeEntryFiles("dom", opts.translator),
|
|
146
|
+
...compiler.getRuntimeEntryFiles("html", opts.translator),
|
|
147
|
+
...taglibDeps
|
|
148
|
+
]));
|
|
149
|
+
const ssr = config.ssr ?? (config.ssr = {});
|
|
150
|
+
if (ssr.noExternal !== true) {
|
|
151
|
+
ssr.noExternal = Array.from(new Set(taglibDeps.concat(ssr.noExternal || [])));
|
|
166
152
|
}
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
],
|
|
153
|
+
return {
|
|
154
|
+
...config,
|
|
155
|
+
optimizeDeps: {
|
|
156
|
+
...config.optimizeDeps,
|
|
157
|
+
extensions: [".marko", ...((_a2 = config.optimizeDeps) == null ? void 0 : _a2.extensions) || []],
|
|
173
158
|
esbuildOptions: {
|
|
174
159
|
plugins: [
|
|
175
160
|
(0, import_esbuild_plugin.default)(compiler, baseConfig),
|
|
176
161
|
...((_c = (_b = config.optimizeDeps) == null ? void 0 : _b.esbuildOptions) == null ? void 0 : _c.plugins) || []
|
|
177
162
|
]
|
|
178
163
|
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
181
166
|
},
|
|
182
167
|
configureServer(_server) {
|
|
183
168
|
ssrConfig.hot = domConfig.hot = true;
|
|
184
169
|
devServer = _server;
|
|
185
170
|
devServer.watcher.on("all", (type, filename) => {
|
|
171
|
+
if (type === "unlink") {
|
|
172
|
+
devEntryFileSources.delete(filename);
|
|
173
|
+
}
|
|
186
174
|
for (const [id, files] of transformWatchFiles) {
|
|
187
175
|
if ((0, import_anymatch.default)(files, filename)) {
|
|
188
176
|
devServer.watcher.emit("change", id);
|
|
@@ -264,8 +252,19 @@ function markoPlugin(opts = {}) {
|
|
|
264
252
|
runtimeId
|
|
265
253
|
});
|
|
266
254
|
}
|
|
267
|
-
case browserEntryQuery:
|
|
268
|
-
|
|
255
|
+
case browserEntryQuery: {
|
|
256
|
+
const realId = id.slice(0, -browserEntryQuery.length);
|
|
257
|
+
if (isBuild) {
|
|
258
|
+
const {
|
|
259
|
+
meta: { source }
|
|
260
|
+
} = await this.load({
|
|
261
|
+
id: realId,
|
|
262
|
+
resolveDependencies: false
|
|
263
|
+
});
|
|
264
|
+
return source;
|
|
265
|
+
}
|
|
266
|
+
return devEntryFileSources.get(realId);
|
|
267
|
+
}
|
|
269
268
|
}
|
|
270
269
|
return virtualFiles.get(id) || null;
|
|
271
270
|
},
|
|
@@ -280,6 +279,7 @@ function markoPlugin(opts = {}) {
|
|
|
280
279
|
if (query && !query.startsWith(virtualFileQuery)) {
|
|
281
280
|
id = id.slice(0, -query.length);
|
|
282
281
|
if (query === serverEntryQuery) {
|
|
282
|
+
devEntryFileSources.set(id, source);
|
|
283
283
|
id = `${id.slice(0, -markoExt.length)}.entry.marko`;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
@@ -307,7 +307,7 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
307
307
|
]);
|
|
308
308
|
transformWatchFiles.set(id, meta.watchFiles);
|
|
309
309
|
}
|
|
310
|
-
return { code, map };
|
|
310
|
+
return { code, map, meta: isBuild ? { source } : void 0 };
|
|
311
311
|
}
|
|
312
312
|
},
|
|
313
313
|
{
|
|
@@ -428,6 +428,5 @@ function isEmpty(obj) {
|
|
|
428
428
|
}
|
|
429
429
|
return true;
|
|
430
430
|
}
|
|
431
|
-
module.exports = __toCommonJS(src_exports);
|
|
432
431
|
// Annotate the CommonJS export names for ESM import in node:
|
|
433
432
|
0 && (module.exports = {});
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
esbuildPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Z64RCGRQ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
generateDocManifest,
|
|
6
6
|
generateInputDoc
|
|
@@ -9,10 +9,6 @@ import "./chunk-VL2HLMVE.mjs";
|
|
|
9
9
|
import {
|
|
10
10
|
server_entry_template_default
|
|
11
11
|
} from "./chunk-HWRQJHCN.mjs";
|
|
12
|
-
import {
|
|
13
|
-
__spreadProps,
|
|
14
|
-
__spreadValues
|
|
15
|
-
} from "./chunk-SOEV5HRE.mjs";
|
|
16
12
|
|
|
17
13
|
// src/index.ts
|
|
18
14
|
import os from "os";
|
|
@@ -21,6 +17,7 @@ import path from "path";
|
|
|
21
17
|
import crypto from "crypto";
|
|
22
18
|
import anyMatch from "anymatch";
|
|
23
19
|
import { pathToFileURL, fileURLToPath } from "url";
|
|
20
|
+
import { relativeImportPath } from "relative-import-path";
|
|
24
21
|
var normalizePath = path.sep === "\\" ? (id) => id.replace(/\\/g, "/") : (id) => id;
|
|
25
22
|
var virtualFiles = /* @__PURE__ */ new Map();
|
|
26
23
|
var queryReg = /\?marko-.+$/;
|
|
@@ -42,15 +39,17 @@ function markoPlugin(opts = {}) {
|
|
|
42
39
|
runtimeId,
|
|
43
40
|
sourceMaps: true,
|
|
44
41
|
writeVersionComment: false,
|
|
45
|
-
babelConfig:
|
|
46
|
-
|
|
42
|
+
babelConfig: {
|
|
43
|
+
...opts.babelConfig,
|
|
44
|
+
caller: {
|
|
47
45
|
name: "@marko/vite",
|
|
48
46
|
supportsStaticESM: true,
|
|
49
47
|
supportsDynamicImport: true,
|
|
50
48
|
supportsTopLevelAwait: true,
|
|
51
|
-
supportsExportNamespaceFrom: true
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
supportsExportNamespaceFrom: true,
|
|
50
|
+
...(_a = opts.babelConfig) == null ? void 0 : _a.caller
|
|
51
|
+
}
|
|
52
|
+
}
|
|
54
53
|
};
|
|
55
54
|
const resolveViteVirtualDep = (from, dep) => {
|
|
56
55
|
const query = `${virtualFileQuery}&id=${normalizePath(dep.virtualPath)}`;
|
|
@@ -64,18 +63,21 @@ function markoPlugin(opts = {}) {
|
|
|
64
63
|
virtualFiles.set(id, dep);
|
|
65
64
|
return `./${path.basename(from) + query}`;
|
|
66
65
|
};
|
|
67
|
-
const ssrConfig =
|
|
66
|
+
const ssrConfig = {
|
|
67
|
+
...baseConfig,
|
|
68
68
|
resolveVirtualDependency: resolveViteVirtualDep,
|
|
69
69
|
output: "html"
|
|
70
|
-
}
|
|
71
|
-
const domConfig =
|
|
70
|
+
};
|
|
71
|
+
const domConfig = {
|
|
72
|
+
...baseConfig,
|
|
72
73
|
resolveVirtualDependency: resolveViteVirtualDep,
|
|
73
74
|
output: "dom"
|
|
74
|
-
}
|
|
75
|
-
const hydrateConfig =
|
|
75
|
+
};
|
|
76
|
+
const hydrateConfig = {
|
|
77
|
+
...baseConfig,
|
|
76
78
|
resolveVirtualDependency: resolveViteVirtualDep,
|
|
77
79
|
output: "hydrate"
|
|
78
|
-
}
|
|
80
|
+
};
|
|
79
81
|
let root;
|
|
80
82
|
let devEntryFile;
|
|
81
83
|
let isBuild = false;
|
|
@@ -83,6 +85,7 @@ function markoPlugin(opts = {}) {
|
|
|
83
85
|
let devServer;
|
|
84
86
|
let registeredTag = false;
|
|
85
87
|
let serverManifest;
|
|
88
|
+
const devEntryFileSources = /* @__PURE__ */ new Map();
|
|
86
89
|
const transformWatchFiles = /* @__PURE__ */ new Map();
|
|
87
90
|
const transformOptionalFiles = /* @__PURE__ */ new Map();
|
|
88
91
|
return [
|
|
@@ -96,9 +99,9 @@ function markoPlugin(opts = {}) {
|
|
|
96
99
|
devEntryFile = path.join(root, "index.html");
|
|
97
100
|
isBuild = env.command === "build";
|
|
98
101
|
isSSRBuild = isBuild && linked && Boolean(config.build.ssr);
|
|
99
|
-
if (!registeredTag) {
|
|
102
|
+
if (linked && !registeredTag) {
|
|
100
103
|
const transformer = path.resolve(thisFile, "../render-assets-transform");
|
|
101
|
-
registeredTag = normalizePath(path.resolve(thisFile, "../components",
|
|
104
|
+
registeredTag = normalizePath(path.resolve(thisFile, "../components", "vite.marko"));
|
|
102
105
|
compiler.taglib.register("@marko/vite", {
|
|
103
106
|
"<_vite>": { template: registeredTag },
|
|
104
107
|
"<head>": { transformer },
|
|
@@ -109,45 +112,48 @@ function markoPlugin(opts = {}) {
|
|
|
109
112
|
const taglibDeps = [];
|
|
110
113
|
for (const name in lookup.taglibsById) {
|
|
111
114
|
const taglib = lookup.taglibsById[name];
|
|
112
|
-
if (/[\\/]node_modules[\\/]
|
|
115
|
+
if (!/^marko-(.+-)?core$/.test(taglib.id) && /[\\/]node_modules[\\/]/.test(taglib.dirname)) {
|
|
113
116
|
for (const tagName in taglib.tags) {
|
|
114
117
|
const tag = taglib.tags[tagName];
|
|
115
118
|
const entry = tag.template || tag.renderer;
|
|
116
119
|
if (entry) {
|
|
117
|
-
taglibDeps.push(
|
|
120
|
+
taglibDeps.push(relativeImportPath(devEntryFile, entry));
|
|
118
121
|
}
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
|
-
const domDeps = Array.from(new Set(compiler.getRuntimeEntryFiles("dom", opts.translator).concat(taglibDeps)));
|
|
123
125
|
const optimizeDeps = config.optimizeDeps ?? (config.optimizeDeps = {});
|
|
124
|
-
optimizeDeps.include
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
optimizeDeps.include = Array.from(/* @__PURE__ */ new Set([
|
|
127
|
+
...optimizeDeps.include || [],
|
|
128
|
+
...compiler.getRuntimeEntryFiles("dom", opts.translator),
|
|
129
|
+
...compiler.getRuntimeEntryFiles("html", opts.translator),
|
|
130
|
+
...taglibDeps
|
|
131
|
+
]));
|
|
132
|
+
const ssr = config.ssr ?? (config.ssr = {});
|
|
133
|
+
if (ssr.noExternal !== true) {
|
|
134
|
+
ssr.noExternal = Array.from(new Set(taglibDeps.concat(ssr.noExternal || [])));
|
|
131
135
|
}
|
|
132
|
-
return
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
],
|
|
136
|
+
return {
|
|
137
|
+
...config,
|
|
138
|
+
optimizeDeps: {
|
|
139
|
+
...config.optimizeDeps,
|
|
140
|
+
extensions: [".marko", ...((_a2 = config.optimizeDeps) == null ? void 0 : _a2.extensions) || []],
|
|
138
141
|
esbuildOptions: {
|
|
139
142
|
plugins: [
|
|
140
143
|
esbuildPlugin(compiler, baseConfig),
|
|
141
144
|
...((_c = (_b = config.optimizeDeps) == null ? void 0 : _b.esbuildOptions) == null ? void 0 : _c.plugins) || []
|
|
142
145
|
]
|
|
143
146
|
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
146
149
|
},
|
|
147
150
|
configureServer(_server) {
|
|
148
151
|
ssrConfig.hot = domConfig.hot = true;
|
|
149
152
|
devServer = _server;
|
|
150
153
|
devServer.watcher.on("all", (type, filename) => {
|
|
154
|
+
if (type === "unlink") {
|
|
155
|
+
devEntryFileSources.delete(filename);
|
|
156
|
+
}
|
|
151
157
|
for (const [id, files] of transformWatchFiles) {
|
|
152
158
|
if (anyMatch(files, filename)) {
|
|
153
159
|
devServer.watcher.emit("change", id);
|
|
@@ -229,8 +235,19 @@ function markoPlugin(opts = {}) {
|
|
|
229
235
|
runtimeId
|
|
230
236
|
});
|
|
231
237
|
}
|
|
232
|
-
case browserEntryQuery:
|
|
233
|
-
|
|
238
|
+
case browserEntryQuery: {
|
|
239
|
+
const realId = id.slice(0, -browserEntryQuery.length);
|
|
240
|
+
if (isBuild) {
|
|
241
|
+
const {
|
|
242
|
+
meta: { source }
|
|
243
|
+
} = await this.load({
|
|
244
|
+
id: realId,
|
|
245
|
+
resolveDependencies: false
|
|
246
|
+
});
|
|
247
|
+
return source;
|
|
248
|
+
}
|
|
249
|
+
return devEntryFileSources.get(realId);
|
|
250
|
+
}
|
|
234
251
|
}
|
|
235
252
|
return virtualFiles.get(id) || null;
|
|
236
253
|
},
|
|
@@ -245,6 +262,7 @@ function markoPlugin(opts = {}) {
|
|
|
245
262
|
if (query && !query.startsWith(virtualFileQuery)) {
|
|
246
263
|
id = id.slice(0, -query.length);
|
|
247
264
|
if (query === serverEntryQuery) {
|
|
265
|
+
devEntryFileSources.set(id, source);
|
|
248
266
|
id = `${id.slice(0, -markoExt.length)}.entry.marko`;
|
|
249
267
|
}
|
|
250
268
|
}
|
|
@@ -272,7 +290,7 @@ if (import.meta.hot) import.meta.hot.accept();`;
|
|
|
272
290
|
]);
|
|
273
291
|
transformWatchFiles.set(id, meta.watchFiles);
|
|
274
292
|
}
|
|
275
|
-
return { code, map };
|
|
293
|
+
return { code, map, meta: isBuild ? { source } : void 0 };
|
|
276
294
|
}
|
|
277
295
|
},
|
|
278
296
|
{
|
|
@@ -1,35 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
8
|
var __export = (target, all) => {
|
|
9
9
|
for (var name in all)
|
|
10
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
22
|
var manifest_generator_exports = {};
|
|
29
23
|
__export(manifest_generator_exports, {
|
|
30
24
|
generateDocManifest: () => generateDocManifest,
|
|
31
25
|
generateInputDoc: () => generateInputDoc
|
|
32
26
|
});
|
|
27
|
+
module.exports = __toCommonJS(manifest_generator_exports);
|
|
33
28
|
var import_htmlparser2 = require("htmlparser2");
|
|
34
29
|
var import_domelementtype = require("domelementtype");
|
|
35
30
|
var import_domhandler = require("domhandler");
|
|
@@ -86,7 +81,6 @@ function splitNodesByMarker(nodes, before, after) {
|
|
|
86
81
|
function isElement(node) {
|
|
87
82
|
return node.type === import_domelementtype.ElementType.Tag;
|
|
88
83
|
}
|
|
89
|
-
module.exports = __toCommonJS(manifest_generator_exports);
|
|
90
84
|
// Annotate the CommonJS export names for ESM import in node:
|
|
91
85
|
0 && (module.exports = {
|
|
92
86
|
generateDocManifest,
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
6
|
var __export = (target, all) => {
|
|
7
7
|
for (var name in all)
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
for (let key of __getOwnPropNames(
|
|
13
|
-
if (!__hasOwnProp.call(
|
|
14
|
-
__defProp(
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return to;
|
|
17
17
|
};
|
|
18
|
-
var __toCommonJS =
|
|
19
|
-
return (module2, temp) => {
|
|
20
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
21
|
-
};
|
|
22
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var render_assets_transform_exports = {};
|
|
24
20
|
__export(render_assets_transform_exports, {
|
|
25
21
|
default: () => render_assets_transform_default
|
|
26
22
|
});
|
|
23
|
+
module.exports = __toCommonJS(render_assets_transform_exports);
|
|
27
24
|
var render_assets_transform_default = (tag, t) => {
|
|
28
25
|
const body = tag.get("body");
|
|
29
26
|
const tagName = tag.get("name").node.value;
|
|
@@ -31,8 +28,7 @@ var render_assets_transform_default = (tag, t) => {
|
|
|
31
28
|
body.pushContainer("body", renderAssetsCall(t, tagName));
|
|
32
29
|
};
|
|
33
30
|
function renderAssetsCall(t, slot) {
|
|
34
|
-
return t.
|
|
31
|
+
return t.markoPlaceholder(t.callExpression(t.memberExpression(t.memberExpression(t.identifier("out"), t.identifier("global")), t.identifier("___viteRenderAssets")), [t.stringLiteral(slot)]), false);
|
|
35
32
|
}
|
|
36
|
-
module.exports = __toCommonJS(render_assets_transform_exports);
|
|
37
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
34
|
0 && (module.exports = {});
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import "./chunk-SOEV5HRE.mjs";
|
|
2
|
-
|
|
3
1
|
// src/render-assets-transform.ts
|
|
4
2
|
var render_assets_transform_default = (tag, t) => {
|
|
5
3
|
const body = tag.get("body");
|
|
@@ -8,7 +6,7 @@ var render_assets_transform_default = (tag, t) => {
|
|
|
8
6
|
body.pushContainer("body", renderAssetsCall(t, tagName));
|
|
9
7
|
};
|
|
10
8
|
function renderAssetsCall(t, slot) {
|
|
11
|
-
return t.
|
|
9
|
+
return t.markoPlaceholder(t.callExpression(t.memberExpression(t.memberExpression(t.identifier("out"), t.identifier("global")), t.identifier("___viteRenderAssets")), [t.stringLiteral(slot)]), false);
|
|
12
10
|
}
|
|
13
11
|
export {
|
|
14
12
|
render_assets_transform_default as default
|
package/dist/serializer.js
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
6
|
var __export = (target, all) => {
|
|
7
7
|
for (var name in all)
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
for (let key of __getOwnPropNames(
|
|
13
|
-
if (!__hasOwnProp.call(
|
|
14
|
-
__defProp(
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return to;
|
|
17
17
|
};
|
|
18
|
-
var __toCommonJS =
|
|
19
|
-
return (module2, temp) => {
|
|
20
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
21
|
-
};
|
|
22
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
19
|
var serializer_exports = {};
|
|
24
20
|
__export(serializer_exports, {
|
|
25
21
|
default: () => serialize
|
|
26
22
|
});
|
|
23
|
+
module.exports = __toCommonJS(serializer_exports);
|
|
27
24
|
var import_domelementtype = require("domelementtype");
|
|
28
25
|
const voidElements = /* @__PURE__ */ new Set([
|
|
29
26
|
"area",
|
|
@@ -99,6 +96,5 @@ function serialize(nodes, parts) {
|
|
|
99
96
|
}
|
|
100
97
|
return parts;
|
|
101
98
|
}
|
|
102
|
-
module.exports = __toCommonJS(serializer_exports);
|
|
103
99
|
// Annotate the CommonJS export names for ESM import in node:
|
|
104
100
|
0 && (module.exports = {});
|
package/dist/serializer.mjs
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
8
|
var __export = (target, all) => {
|
|
9
9
|
for (var name in all)
|
|
10
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
11
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
22
|
var server_entry_template_exports = {};
|
|
29
23
|
__export(server_entry_template_exports, {
|
|
30
24
|
default: () => server_entry_template_default
|
|
31
25
|
});
|
|
26
|
+
module.exports = __toCommonJS(server_entry_template_exports);
|
|
32
27
|
var import_path = __toESM(require("path"));
|
|
33
28
|
var server_entry_template_default = async (opts) => {
|
|
34
29
|
const fileNameStr = JSON.stringify(`./${import_path.default.basename(opts.fileName)}`);
|
|
@@ -46,6 +41,5 @@ ${opts.runtimeId ? `$ $global.runtimeId = ${JSON.stringify(opts.runtimeId)};
|
|
|
46
41
|
<_vite slot="body"/>
|
|
47
42
|
`;
|
|
48
43
|
};
|
|
49
|
-
module.exports = __toCommonJS(server_entry_template_exports);
|
|
50
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
45
|
0 && (module.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.5",
|
|
5
5
|
"author": "Dylan Piercey <dpiercey@ebay.com>",
|
|
6
6
|
"bugs": "https://github.com/marko-js/vite/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"anymatch": "^3.1.2",
|
|
9
|
-
"domelementtype": "^2.
|
|
10
|
-
"domhandler": "^
|
|
11
|
-
"htmlparser2": "^
|
|
9
|
+
"domelementtype": "^2.3.0",
|
|
10
|
+
"domhandler": "^5.0.3",
|
|
11
|
+
"htmlparser2": "^8.0.1",
|
|
12
|
+
"relative-import-path": "^1.0.0"
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"@
|
|
16
|
-
"@marko/compiler": "^5.
|
|
17
|
-
"@marko/fixture-snapshots": "^2.1.
|
|
18
|
-
"@marko/testing-library": "^6.
|
|
15
|
+
"@changesets/changelog-github": "^0.4.5",
|
|
16
|
+
"@changesets/cli": "^2.23.1",
|
|
17
|
+
"@marko/compiler": "^5.21.6",
|
|
18
|
+
"@marko/fixture-snapshots": "^2.1.7",
|
|
19
|
+
"@marko/testing-library": "^6.1.2",
|
|
19
20
|
"@types/jsdom": "^16.2.14",
|
|
20
|
-
"@types/mocha": "^9.1.
|
|
21
|
-
"@types/node": "^
|
|
21
|
+
"@types/mocha": "^9.1.1",
|
|
22
|
+
"@types/node": "^18.0.3",
|
|
22
23
|
"@types/serve-handler": "^6.1.1",
|
|
23
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
24
|
-
"@typescript-eslint/parser": "^5.
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
|
25
|
+
"@typescript-eslint/parser": "^5.30.6",
|
|
25
26
|
"cross-env": "^7.0.3",
|
|
26
|
-
"esbuild": "^0.14.
|
|
27
|
-
"
|
|
28
|
-
"eslint": "^8.10.0",
|
|
27
|
+
"esbuild": "^0.14.49",
|
|
28
|
+
"eslint": "^8.19.0",
|
|
29
29
|
"eslint-config-prettier": "^8.5.0",
|
|
30
30
|
"fast-glob": "^3.2.11",
|
|
31
31
|
"fixpack": "^4.0.0",
|
|
32
|
-
"husky": "^
|
|
32
|
+
"husky": "^8.0.1",
|
|
33
33
|
"jsdom": "^19.0.0",
|
|
34
|
-
"lint-staged": "^
|
|
35
|
-
"marko": "^5.
|
|
36
|
-
"mocha": "^
|
|
34
|
+
"lint-staged": "^13.0.3",
|
|
35
|
+
"marko": "^5.21.2",
|
|
36
|
+
"mocha": "^10.0.0",
|
|
37
37
|
"mocha-snap": "^4.3.0",
|
|
38
38
|
"nyc": "^15.1.0",
|
|
39
|
-
"playwright": "^1.
|
|
40
|
-
"prettier": "^2.
|
|
41
|
-
"semantic-release": "^19.0.2",
|
|
39
|
+
"playwright": "^1.23.2",
|
|
40
|
+
"prettier": "^2.7.1",
|
|
42
41
|
"serve-handler": "^6.1.3",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
42
|
+
"tsx": "^3.7.1",
|
|
43
|
+
"typescript": "^4.7.4",
|
|
44
|
+
"vite": "3.0.0-beta.10"
|
|
45
45
|
},
|
|
46
46
|
"exports": {
|
|
47
47
|
".": {
|
|
@@ -69,27 +69,27 @@
|
|
|
69
69
|
"module": "./dist/index.mjs",
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@marko/compiler": "^5",
|
|
72
|
-
"vite": "^2"
|
|
72
|
+
"vite": "^2 || ^3"
|
|
73
73
|
},
|
|
74
74
|
"repository": {
|
|
75
75
|
"type": "git",
|
|
76
76
|
"url": "https://github.com/marko-js/vite"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
|
-
"build": "tsc -b &&
|
|
80
|
-
"
|
|
79
|
+
"build": "tsc -b && tsx build.mts",
|
|
80
|
+
"change": "changeset add",
|
|
81
|
+
"ci:test": "nyc npm test -- --forbid-only",
|
|
81
82
|
"format": "npm run lint:eslint -- --fix && npm run lint:prettier -- --write && (fixpack || true)",
|
|
82
83
|
"lint": "tsc -b && npm run lint:eslint && npm run lint:prettier -- -l && fixpack",
|
|
83
84
|
"lint:eslint": "eslint -f visualstudio .",
|
|
84
85
|
"lint:prettier": "prettier \"./**/*{.ts,.js,.json,.md,.yml,rc}\"",
|
|
85
|
-
"mocha": "cross-env NODE_ENV=test mocha \"./src/**/__tests__/*.test.ts\"",
|
|
86
86
|
"prepare": "husky install",
|
|
87
|
-
"
|
|
88
|
-
"release": "semantic-release",
|
|
87
|
+
"release": "npm run build && changeset publish",
|
|
89
88
|
"report": "open ./coverage/lcov-report/index.html",
|
|
90
|
-
"test": "
|
|
89
|
+
"test": "cross-env NODE_ENV=test mocha \"./src/**/__tests__/*.test.ts\"",
|
|
91
90
|
"test:inspect": "npm test -- --inspect",
|
|
92
|
-
"test:update": "npm
|
|
91
|
+
"test:update": "npm test -- --update",
|
|
92
|
+
"version": "changeset version && npm i --package-lock-only"
|
|
93
93
|
},
|
|
94
94
|
"types": "dist/index.d.ts"
|
|
95
95
|
}
|
package/dist/chunk-SOEV5HRE.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
__spreadValues,
|
|
23
|
-
__spreadProps
|
|
24
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
static function renderAssets(slot) {
|
|
2
|
-
const entries = this.___viteEntries;
|
|
3
|
-
let html = "";
|
|
4
|
-
|
|
5
|
-
if (entries) {
|
|
6
|
-
const slotWrittenEntriesKey = `___viteWrittenEntries-${slot}`;
|
|
7
|
-
const lastWrittenEntry = this[slotWrittenEntriesKey] || 0;
|
|
8
|
-
const writtenEntries = this[slotWrittenEntriesKey] = entries.length;
|
|
9
|
-
|
|
10
|
-
for (let i = lastWrittenEntry; i < writtenEntries; i++) {
|
|
11
|
-
const slotParts = entries[i][slot];
|
|
12
|
-
const slotHtml = slotParts && slotParts.join(this.___viteInjectAttrs);
|
|
13
|
-
|
|
14
|
-
if (slotHtml) {
|
|
15
|
-
html += slotHtml;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return html;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
$ const $global = out.global;
|
|
24
|
-
$ if (!$global.___viteRenderAssets) {
|
|
25
|
-
$global.___viteInjectAttrs = $global.cspNonce ? ` nonce="${$global.cspNonce.replace(/"/g, "'")}"` : "";
|
|
26
|
-
$global.___viteRenderAssets = renderAssets;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
<__flush_here_and_after__>
|
|
30
|
-
$!{$global.___viteRenderAssets(input.slot)}
|
|
31
|
-
</>
|