@qds.dev/code 0.9.1 → 0.10.0
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/README.md +7 -5
- package/lib/preview/bundler/repl-bundler-worker.qwik.mjs +6307 -5686
- package/lib/preview/bundler/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/lib/preview/bundler/wasi-worker-browser.mjs +3051 -3051
- package/lib-types/src/debug.d.ts +1 -0
- package/lib-types/src/index.d.ts +2 -0
- package/lib-types/src/preview/bundler/bundled-config.d.ts +33 -0
- package/lib-types/src/preview/bundler/bundled.d.ts +3 -0
- package/lib-types/src/preview/bundler/bundled.unit.d.ts +1 -0
- package/lib-types/src/preview/bundler/client-events-listener.d.ts +1 -0
- package/lib-types/src/preview/bundler/index.d.ts +34 -0
- package/lib-types/src/preview/bundler/repl-bundler-worker.d.ts +30 -0
- package/lib-types/src/preview/bundler/repl-ssr-worker.d.ts +27 -0
- package/lib-types/src/preview/bundler/rollup-plugins.d.ts +5 -0
- package/lib-types/src/preview/bundler/rollup-plugins.unit.d.ts +1 -0
- package/lib-types/src/preview/constants.d.ts +5 -0
- package/lib-types/src/preview/index.d.ts +19 -0
- package/lib-types/src/preview/mocks/browser.d.ts +2 -0
- package/lib-types/src/preview/preview-sw.d.ts +20 -0
- package/lib-types/src/preview/preview-sw.unit.d.ts +1 -0
- package/lib-types/src/preview/register-preview-sw.d.ts +2 -0
- package/lib-types/src/preview/register-preview-sw.unit.d.ts +1 -0
- package/lib-types/src/preview/repl-editor.d.ts +1 -0
- package/lib-types/src/preview/repl-helpers-node.d.ts +4 -0
- package/lib-types/src/preview/repl-helpers.unit.d.ts +1 -0
- package/lib-types/src/preview/test-extend.d.ts +9 -0
- package/lib-types/src/preview/types.d.ts +70 -0
- package/lib-types/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -25
- package/LICENSE +0 -21
- package/lib/node_modules/.pnpm/@emnapi_core@1.7.1/node_modules/@emnapi/core/dist/emnapi-core.esm-bundler.qwik.mjs +0 -5533
- package/lib/node_modules/.pnpm/@emnapi_runtime@1.8.1/node_modules/@emnapi/runtime/dist/emnapi.esm-bundler.qwik.mjs +0 -1225
- package/lib/node_modules/.pnpm/@emnapi_wasi-threads@1.1.0/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.qwik.mjs +0 -619
- package/lib/node_modules/.pnpm/@napi-rs_wasm-runtime@1.1.1/node_modules/@napi-rs/wasm-runtime/dist/fs.qwik.mjs +0 -14854
- package/lib/node_modules/.pnpm/@napi-rs_wasm-runtime@1.1.1/node_modules/@napi-rs/wasm-runtime/fs-proxy.qwik.mjs +0 -109
- package/lib/node_modules/.pnpm/@napi-rs_wasm-runtime@1.1.1/node_modules/@napi-rs/wasm-runtime/runtime.qwik.mjs +0 -4
- package/lib/node_modules/.pnpm/@qwik.dev_core@2.0.0-beta.15_vite@7.1.5_@types_node@24.9.0_jiti@2.6.1_lightningcss@1.30.1_ter_sl453hnfnrysgqsj6ikt4cdmnq/node_modules/@qwik.dev/core/dist/qwikloader.qwik.mjs +0 -152
- package/lib/node_modules/.pnpm/@rolldown_browser@1.0.0-beta.59/node_modules/@rolldown/browser/dist/index.browser.qwik.mjs +0 -13
- package/lib/node_modules/.pnpm/@rolldown_browser@1.0.0-beta.59/node_modules/@rolldown/browser/dist/normalize-string-or-regex-BB1FWNyl.qwik.mjs +0 -789
- package/lib/node_modules/.pnpm/@rolldown_browser@1.0.0-beta.59/node_modules/@rolldown/browser/dist/rolldown-binding.wasi-browser.qwik.mjs +0 -107
- package/lib/node_modules/.pnpm/@rolldown_browser@1.0.0-beta.59/node_modules/@rolldown/browser/dist/rolldown-build-Bfw5c2c3.qwik.mjs +0 -4157
- package/lib/node_modules/.pnpm/@tybys_wasm-util@0.10.1/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.qwik.mjs +0 -1968
- package/lib/node_modules/.pnpm/magic-regexp@0.10.0/node_modules/magic-regexp/dist/index.qwik.mjs +0 -10
- package/lib/node_modules/.pnpm/magic-regexp@0.10.0/node_modules/magic-regexp/dist/shared/magic-regexp.DKp_q_HX.qwik.mjs +0 -95
- package/lib/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.qwik.mjs +0 -34
- package/lib/vite/repl-plugin.qwik.mjs +0 -31
- package/lib-types/src/vite/repl-plugin.d.ts +0 -7
|
@@ -1,4157 +0,0 @@
|
|
|
1
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.qwik.mjs";
|
|
2
|
-
import { BuiltinPlugin, LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARN, MinimalPluginContextImpl, PlainObjectLike, VERSION, __decorate, arraify, augmentCodeLocation, bindingAssetSource, bindingifyBuiltInPlugin, bindingifyCSSPostPlugin, bindingifyManifestPlugin, bindingifySourcemap as bindingifySourcemap$1, bindingifyViteHtmlPlugin, collectChangedBundle, error, getCodeFrame, lazyProp, locate, logCycleLoading, logInputHookInOutputPlugin, logLevelPriority, logNoFileSystemInBrowser, logParseError, logPluginError, normalizeLog, normalizedStringOrRegex, transformAssetSource, transformRenderedChunk, transformToOutputBundle, transformToRollupOutput, unimplemented, unreachable, unsupported } from "./normalize-string-or-regex-BB1FWNyl.qwik.mjs";
|
|
3
|
-
|
|
4
|
-
//#region ../../node_modules/.pnpm/@rolldown+browser@1.0.0-beta.59/node_modules/@rolldown/browser/dist/rolldown-build-Bfw5c2c3.js
|
|
5
|
-
let _lazyMatch = () => {
|
|
6
|
-
var __lib__ = (() => {
|
|
7
|
-
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e$1) => {
|
|
8
|
-
for (var n$1 in e$1) m(r, n$1, {
|
|
9
|
-
get: e$1[n$1],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
}, H = (r, e$1, n$1, a) => {
|
|
13
|
-
if (e$1 && typeof e$1 == "object" || typeof e$1 == "function") for (let t$2 of G(e$1)) !T.call(r, t$2) && t$2 !== n$1 && m(r, t$2, {
|
|
14
|
-
get: () => e$1[t$2],
|
|
15
|
-
enumerable: !(a = V(e$1, t$2)) || a.enumerable
|
|
16
|
-
});
|
|
17
|
-
return r;
|
|
18
|
-
}, J = (r) => H(m({}, "__esModule", { value: true }), r), w = {};
|
|
19
|
-
q(w, { default: () => re });
|
|
20
|
-
var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
|
|
21
|
-
const e$1 = /* @__PURE__ */ new Map();
|
|
22
|
-
return (n$1) => {
|
|
23
|
-
const a = e$1.get(n$1);
|
|
24
|
-
if (a) return a;
|
|
25
|
-
const t$2 = r(n$1);
|
|
26
|
-
return e$1.set(n$1, t$2), t$2;
|
|
27
|
-
};
|
|
28
|
-
}, rr = (r, e$1, n$1 = {}) => {
|
|
29
|
-
const a = {
|
|
30
|
-
cache: {},
|
|
31
|
-
input: r,
|
|
32
|
-
index: 0,
|
|
33
|
-
indexMax: 0,
|
|
34
|
-
options: n$1,
|
|
35
|
-
output: []
|
|
36
|
-
};
|
|
37
|
-
if (v(e$1)(a) && a.index === r.length) return a.output;
|
|
38
|
-
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
39
|
-
}, i = (r, e$1) => A(r) ? er(r, e$1) : b(r) ? ar(r, e$1) : nr(r, e$1), er = (r, e$1) => {
|
|
40
|
-
const n$1 = {};
|
|
41
|
-
for (const a of r) {
|
|
42
|
-
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
43
|
-
const t$2 = a.charCodeAt(0);
|
|
44
|
-
n$1[t$2] = true;
|
|
45
|
-
}
|
|
46
|
-
return (a) => {
|
|
47
|
-
const t$2 = a.index, o = a.input;
|
|
48
|
-
for (; a.index < o.length && o.charCodeAt(a.index) in n$1;) a.index += 1;
|
|
49
|
-
const u = a.index;
|
|
50
|
-
if (u > t$2) {
|
|
51
|
-
if (!h(e$1) && !a.options.silent) {
|
|
52
|
-
const s = a.input.slice(t$2, u), c = d(e$1) ? e$1(s, o, String(t$2)) : e$1;
|
|
53
|
-
h(c) || a.output.push(c);
|
|
54
|
-
}
|
|
55
|
-
a.indexMax = Math.max(a.indexMax, a.index);
|
|
56
|
-
}
|
|
57
|
-
return true;
|
|
58
|
-
};
|
|
59
|
-
}, nr = (r, e$1) => {
|
|
60
|
-
const n$1 = r.source, a = r.flags.replace(/y|$/, "y"), t$2 = new RegExp(n$1, a);
|
|
61
|
-
return g((o) => {
|
|
62
|
-
t$2.lastIndex = o.index;
|
|
63
|
-
const u = t$2.exec(o.input);
|
|
64
|
-
if (u) {
|
|
65
|
-
if (!h(e$1) && !o.options.silent) {
|
|
66
|
-
const s = d(e$1) ? e$1(...u, o.input, String(o.index)) : e$1;
|
|
67
|
-
h(s) || o.output.push(s);
|
|
68
|
-
}
|
|
69
|
-
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
|
|
70
|
-
} else return false;
|
|
71
|
-
});
|
|
72
|
-
}, ar = (r, e$1) => (n$1) => {
|
|
73
|
-
if (n$1.input.startsWith(r, n$1.index)) {
|
|
74
|
-
if (!h(e$1) && !n$1.options.silent) {
|
|
75
|
-
const t$2 = d(e$1) ? e$1(r, n$1.input, String(n$1.index)) : e$1;
|
|
76
|
-
h(t$2) || n$1.output.push(t$2);
|
|
77
|
-
}
|
|
78
|
-
return n$1.index += r.length, n$1.indexMax = Math.max(n$1.indexMax, n$1.index), true;
|
|
79
|
-
} else return false;
|
|
80
|
-
}, C = (r, e$1, n$1, a) => {
|
|
81
|
-
const t$2 = v(r);
|
|
82
|
-
return g(_(M((o) => {
|
|
83
|
-
let u = 0;
|
|
84
|
-
for (; u < n$1;) {
|
|
85
|
-
const s = o.index;
|
|
86
|
-
if (!t$2(o) || (u += 1, o.index === s)) break;
|
|
87
|
-
}
|
|
88
|
-
return u >= e$1;
|
|
89
|
-
})));
|
|
90
|
-
}, tr = (r, e$1) => C(r, 0, 1), f = (r, e$1) => C(r, 0, Infinity), x = (r, e$1) => {
|
|
91
|
-
const n$1 = r.map(v);
|
|
92
|
-
return g(_(M((a) => {
|
|
93
|
-
for (let t$2 = 0, o = n$1.length; t$2 < o; t$2++) if (!n$1[t$2](a)) return false;
|
|
94
|
-
return true;
|
|
95
|
-
})));
|
|
96
|
-
}, l = (r, e$1) => {
|
|
97
|
-
const n$1 = r.map(v);
|
|
98
|
-
return g(_((a) => {
|
|
99
|
-
for (let t$2 = 0, o = n$1.length; t$2 < o; t$2++) if (n$1[t$2](a)) return true;
|
|
100
|
-
return false;
|
|
101
|
-
}));
|
|
102
|
-
}, M = (r, e$1 = false) => {
|
|
103
|
-
const n$1 = v(r);
|
|
104
|
-
return (a) => {
|
|
105
|
-
const t$2 = a.index, o = a.output.length, u = n$1(a);
|
|
106
|
-
return (!u || e$1) && (a.index = t$2, a.output.length !== o && (a.output.length = o)), u;
|
|
107
|
-
};
|
|
108
|
-
}, _ = (r, e$1) => {
|
|
109
|
-
return v(r);
|
|
110
|
-
}, g = (() => {
|
|
111
|
-
let r = 0;
|
|
112
|
-
return (e$1) => {
|
|
113
|
-
const n$1 = v(e$1), a = r += 1;
|
|
114
|
-
return (t$2) => {
|
|
115
|
-
var o;
|
|
116
|
-
if (t$2.options.memoization === false) return n$1(t$2);
|
|
117
|
-
const u = t$2.index, s = (o = t$2.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
118
|
-
if (c === false) return false;
|
|
119
|
-
if (W(c)) return t$2.index = c, true;
|
|
120
|
-
if (c) return t$2.index = c.index, c.output?.length && t$2.output.push(...c.output), true;
|
|
121
|
-
{
|
|
122
|
-
const Z = t$2.output.length;
|
|
123
|
-
if (n$1(t$2)) {
|
|
124
|
-
const D = t$2.index, U = t$2.output.length;
|
|
125
|
-
if (U > Z) {
|
|
126
|
-
const ee = t$2.output.slice(Z, U);
|
|
127
|
-
s.set(u, {
|
|
128
|
-
index: D,
|
|
129
|
-
output: ee
|
|
130
|
-
});
|
|
131
|
-
} else s.set(u, D);
|
|
132
|
-
return true;
|
|
133
|
-
} else return s.set(u, false), false;
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
})(), E = (r) => {
|
|
138
|
-
let e$1;
|
|
139
|
-
return (n$1) => (e$1 || (e$1 = v(r())), e$1(n$1));
|
|
140
|
-
}, v = Y((r) => {
|
|
141
|
-
if (d(r)) return Q(r) ? E(r) : r;
|
|
142
|
-
if (b(r) || X(r)) return i(r);
|
|
143
|
-
if (A(r)) return x(r);
|
|
144
|
-
if (K(r)) return l(Object.values(r));
|
|
145
|
-
throw new Error("Invalid rule");
|
|
146
|
-
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
147
|
-
let e$1 = "";
|
|
148
|
-
for (; r > 0;) e$1 = P[(r - 1) % 26] + e$1, r = Math.floor((r - 1) / 26);
|
|
149
|
-
return e$1;
|
|
150
|
-
}, O = (r) => {
|
|
151
|
-
let e$1 = 0;
|
|
152
|
-
for (let n$1 = 0, a = r.length; n$1 < a; n$1++) e$1 = e$1 * 26 + P.indexOf(r[n$1]) + 1;
|
|
153
|
-
return e$1;
|
|
154
|
-
}, S = (r, e$1) => {
|
|
155
|
-
if (e$1 < r) return S(e$1, r);
|
|
156
|
-
const n$1 = [];
|
|
157
|
-
for (; r <= e$1;) n$1.push(r++);
|
|
158
|
-
return n$1;
|
|
159
|
-
}, or$1 = (r, e$1, n$1) => S(r, e$1).map((a) => String(a).padStart(n$1, "0")), R = (r, e$1) => S(O(r), O(e$1)).map(ir), p = (r) => r, z = (r) => ur((e$1) => rr(e$1, r, { memoization: false }).join("")), ur = (r) => {
|
|
160
|
-
const e$1 = {};
|
|
161
|
-
return (n$1) => e$1[n$1] ?? (e$1[n$1] = r(n$1));
|
|
162
|
-
}, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e$1, n$1) => `.*${e$1 ? "" : "(?:^|/)"}${n$1.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e$1, n$1, a) => `.*${e$1 ? "" : "(?:^|/)"}${n$1.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i(/./, p), fr = l([i(/^(?:!!)*!(.*)$/, (r, e$1) => `(?!^${L(e$1)}$).*?`), i(/^(!!)+/, "")]), j = l([
|
|
163
|
-
i(/\/(\*\*\/)+/, "(?:/.+/|/)"),
|
|
164
|
-
i(/^(\*\*\/)+/, "(?:^|.*/)"),
|
|
165
|
-
i(/\/(\*\*)$/, "(?:/.*|$)"),
|
|
166
|
-
i(/\*\*/, ".*")
|
|
167
|
-
]), N = l([i(/\*\/(?!\*\*\/)/, "[^/]*/"), i(/\*/, "[^/]*")]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Er = l([
|
|
168
|
-
y,
|
|
169
|
-
i(/[$.*+?^(){}[\|]/, (r) => `\\${r}`),
|
|
170
|
-
br,
|
|
171
|
-
i(/[^\]]/, p)
|
|
172
|
-
]), B = x([
|
|
173
|
-
$r,
|
|
174
|
-
tr(Ar),
|
|
175
|
-
f(Er),
|
|
176
|
-
wr
|
|
177
|
-
]), Pr = i("{", "(?:"), Or$1 = i("}", ")"), I = x([
|
|
178
|
-
Pr,
|
|
179
|
-
l([
|
|
180
|
-
i(/(\d+)\.\.(\d+)/, (r, e$1, n$1) => or$1(+e$1, +n$1, Math.min(e$1.length, n$1.length)).join("|")),
|
|
181
|
-
i(/([a-z]+)\.\.([a-z]+)/, (r, e$1, n$1) => R(e$1, n$1).join("|")),
|
|
182
|
-
i(/([A-Z]+)\.\.([A-Z]+)/, (r, e$1, n$1) => R(e$1.toLowerCase(), n$1.toLowerCase()).join("|").toUpperCase())
|
|
183
|
-
]),
|
|
184
|
-
Or$1
|
|
185
|
-
]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i(/[^}]/, p), F = x([
|
|
186
|
-
kr,
|
|
187
|
-
f(l([
|
|
188
|
-
j,
|
|
189
|
-
N,
|
|
190
|
-
k,
|
|
191
|
-
B,
|
|
192
|
-
I,
|
|
193
|
-
E(() => F),
|
|
194
|
-
y,
|
|
195
|
-
Fr,
|
|
196
|
-
Ir,
|
|
197
|
-
Lr
|
|
198
|
-
])),
|
|
199
|
-
Br
|
|
200
|
-
]), L = z(f(l([
|
|
201
|
-
sr,
|
|
202
|
-
cr,
|
|
203
|
-
lr,
|
|
204
|
-
fr,
|
|
205
|
-
j,
|
|
206
|
-
N,
|
|
207
|
-
k,
|
|
208
|
-
B,
|
|
209
|
-
I,
|
|
210
|
-
F,
|
|
211
|
-
y,
|
|
212
|
-
pr,
|
|
213
|
-
vr
|
|
214
|
-
]))), Tr = i(/\\./, p), qr = i(/./, p), Yr = z(f(l([
|
|
215
|
-
Tr,
|
|
216
|
-
i(/\*\*\*+/, "*"),
|
|
217
|
-
i(/([^/{[(!])\*\*/, (r, e$1) => `${e$1}*`),
|
|
218
|
-
i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e$1) => `${e$1}*`),
|
|
219
|
-
qr
|
|
220
|
-
]))), $ = (r, e$1) => {
|
|
221
|
-
const n$1 = Array.isArray(r) ? r : [r];
|
|
222
|
-
if (!n$1.length) return false;
|
|
223
|
-
const a = n$1.map($.compile), t$2 = n$1.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e$1.replace(/[\\\/]+/g, "/").replace(/\/$/, t$2 ? "/" : "");
|
|
224
|
-
return a.some((s) => s.test(o));
|
|
225
|
-
};
|
|
226
|
-
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
227
|
-
var re = $;
|
|
228
|
-
return J(w);
|
|
229
|
-
})();
|
|
230
|
-
return __lib__.default || __lib__;
|
|
231
|
-
};
|
|
232
|
-
let _match;
|
|
233
|
-
const zeptomatch = (path, pattern) => {
|
|
234
|
-
if (!_match) {
|
|
235
|
-
_match = _lazyMatch();
|
|
236
|
-
_lazyMatch = null;
|
|
237
|
-
}
|
|
238
|
-
return _match(path, pattern);
|
|
239
|
-
};
|
|
240
|
-
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
241
|
-
function normalizeWindowsPath(input = "") {
|
|
242
|
-
if (!input) return input;
|
|
243
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
244
|
-
}
|
|
245
|
-
const _UNC_REGEX = /^[/\\]{2}/;
|
|
246
|
-
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
247
|
-
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
248
|
-
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
249
|
-
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
250
|
-
const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
251
|
-
const sep = "/";
|
|
252
|
-
const normalize = function(path) {
|
|
253
|
-
if (path.length === 0) return ".";
|
|
254
|
-
path = normalizeWindowsPath(path);
|
|
255
|
-
const isUNCPath = path.match(_UNC_REGEX);
|
|
256
|
-
const isPathAbsolute = isAbsolute(path);
|
|
257
|
-
const trailingSeparator = path[path.length - 1] === "/";
|
|
258
|
-
path = normalizeString(path, !isPathAbsolute);
|
|
259
|
-
if (path.length === 0) {
|
|
260
|
-
if (isPathAbsolute) return "/";
|
|
261
|
-
return trailingSeparator ? "./" : ".";
|
|
262
|
-
}
|
|
263
|
-
if (trailingSeparator) path += "/";
|
|
264
|
-
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
265
|
-
if (isUNCPath) {
|
|
266
|
-
if (!isPathAbsolute) return `//./${path}`;
|
|
267
|
-
return `//${path}`;
|
|
268
|
-
}
|
|
269
|
-
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
270
|
-
};
|
|
271
|
-
const join = function(...segments) {
|
|
272
|
-
let path = "";
|
|
273
|
-
for (const seg of segments) {
|
|
274
|
-
if (!seg) continue;
|
|
275
|
-
if (path.length > 0) {
|
|
276
|
-
const pathTrailing = path[path.length - 1] === "/";
|
|
277
|
-
const segLeading = seg[0] === "/";
|
|
278
|
-
if (pathTrailing && segLeading) path += seg.slice(1);
|
|
279
|
-
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
280
|
-
} else path += seg;
|
|
281
|
-
}
|
|
282
|
-
return normalize(path);
|
|
283
|
-
};
|
|
284
|
-
function cwd() {
|
|
285
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
286
|
-
return "/";
|
|
287
|
-
}
|
|
288
|
-
const resolve = function(...arguments_) {
|
|
289
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
290
|
-
let resolvedPath = "";
|
|
291
|
-
let resolvedAbsolute = false;
|
|
292
|
-
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
293
|
-
const path = index >= 0 ? arguments_[index] : cwd();
|
|
294
|
-
if (!path || path.length === 0) continue;
|
|
295
|
-
resolvedPath = `${path}/${resolvedPath}`;
|
|
296
|
-
resolvedAbsolute = isAbsolute(path);
|
|
297
|
-
}
|
|
298
|
-
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
299
|
-
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
300
|
-
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
301
|
-
};
|
|
302
|
-
function normalizeString(path, allowAboveRoot) {
|
|
303
|
-
let res = "";
|
|
304
|
-
let lastSegmentLength = 0;
|
|
305
|
-
let lastSlash = -1;
|
|
306
|
-
let dots = 0;
|
|
307
|
-
let char = null;
|
|
308
|
-
for (let index = 0; index <= path.length; ++index) {
|
|
309
|
-
if (index < path.length) char = path[index];
|
|
310
|
-
else if (char === "/") break;
|
|
311
|
-
else char = "/";
|
|
312
|
-
if (char === "/") {
|
|
313
|
-
if (lastSlash === index - 1 || dots === 1);
|
|
314
|
-
else if (dots === 2) {
|
|
315
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
316
|
-
if (res.length > 2) {
|
|
317
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
318
|
-
if (lastSlashIndex === -1) {
|
|
319
|
-
res = "";
|
|
320
|
-
lastSegmentLength = 0;
|
|
321
|
-
} else {
|
|
322
|
-
res = res.slice(0, lastSlashIndex);
|
|
323
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
324
|
-
}
|
|
325
|
-
lastSlash = index;
|
|
326
|
-
dots = 0;
|
|
327
|
-
continue;
|
|
328
|
-
} else if (res.length > 0) {
|
|
329
|
-
res = "";
|
|
330
|
-
lastSegmentLength = 0;
|
|
331
|
-
lastSlash = index;
|
|
332
|
-
dots = 0;
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
if (allowAboveRoot) {
|
|
337
|
-
res += res.length > 0 ? "/.." : "..";
|
|
338
|
-
lastSegmentLength = 2;
|
|
339
|
-
}
|
|
340
|
-
} else {
|
|
341
|
-
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
342
|
-
else res = path.slice(lastSlash + 1, index);
|
|
343
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
344
|
-
}
|
|
345
|
-
lastSlash = index;
|
|
346
|
-
dots = 0;
|
|
347
|
-
} else if (char === "." && dots !== -1) ++dots;
|
|
348
|
-
else dots = -1;
|
|
349
|
-
}
|
|
350
|
-
return res;
|
|
351
|
-
}
|
|
352
|
-
const isAbsolute = function(p) {
|
|
353
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
354
|
-
};
|
|
355
|
-
const toNamespacedPath = function(p) {
|
|
356
|
-
return normalizeWindowsPath(p);
|
|
357
|
-
};
|
|
358
|
-
const extname = function(p) {
|
|
359
|
-
if (p === "..") return "";
|
|
360
|
-
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
361
|
-
return match && match[1] || "";
|
|
362
|
-
};
|
|
363
|
-
const relative = function(from, to) {
|
|
364
|
-
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
365
|
-
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
366
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
|
|
367
|
-
const _fromCopy = [..._from];
|
|
368
|
-
for (const segment of _fromCopy) {
|
|
369
|
-
if (_to[0] !== segment) break;
|
|
370
|
-
_from.shift();
|
|
371
|
-
_to.shift();
|
|
372
|
-
}
|
|
373
|
-
return [..._from.map(() => ".."), ..._to].join("/");
|
|
374
|
-
};
|
|
375
|
-
const dirname = function(p) {
|
|
376
|
-
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
377
|
-
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
378
|
-
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
379
|
-
};
|
|
380
|
-
const format = function(p) {
|
|
381
|
-
const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
|
|
382
|
-
const segments = [
|
|
383
|
-
p.root,
|
|
384
|
-
p.dir,
|
|
385
|
-
p.base ?? (p.name ?? "") + ext
|
|
386
|
-
].filter(Boolean);
|
|
387
|
-
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
|
|
388
|
-
};
|
|
389
|
-
const basename = function(p, extension) {
|
|
390
|
-
const segments = normalizeWindowsPath(p).split("/");
|
|
391
|
-
let lastSegment = "";
|
|
392
|
-
for (let i = segments.length - 1; i >= 0; i--) {
|
|
393
|
-
const val = segments[i];
|
|
394
|
-
if (val) {
|
|
395
|
-
lastSegment = val;
|
|
396
|
-
break;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
400
|
-
};
|
|
401
|
-
const parse$2 = function(p) {
|
|
402
|
-
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
403
|
-
const base = basename(p);
|
|
404
|
-
const extension = extname(base);
|
|
405
|
-
return {
|
|
406
|
-
root,
|
|
407
|
-
dir: dirname(p),
|
|
408
|
-
base,
|
|
409
|
-
ext: extension,
|
|
410
|
-
name: base.slice(0, base.length - extension.length)
|
|
411
|
-
};
|
|
412
|
-
};
|
|
413
|
-
const matchesGlob = (path, pattern) => {
|
|
414
|
-
return zeptomatch(pattern, normalize(path));
|
|
415
|
-
};
|
|
416
|
-
const _path = {
|
|
417
|
-
__proto__: null,
|
|
418
|
-
basename,
|
|
419
|
-
dirname,
|
|
420
|
-
extname,
|
|
421
|
-
format,
|
|
422
|
-
isAbsolute,
|
|
423
|
-
join,
|
|
424
|
-
matchesGlob,
|
|
425
|
-
normalize,
|
|
426
|
-
normalizeString,
|
|
427
|
-
parse: parse$2,
|
|
428
|
-
relative,
|
|
429
|
-
resolve,
|
|
430
|
-
sep,
|
|
431
|
-
toNamespacedPath
|
|
432
|
-
};
|
|
433
|
-
const delimiter = globalThis.process?.platform === "win32" ? ";" : ":";
|
|
434
|
-
const _platforms = {
|
|
435
|
-
posix: void 0,
|
|
436
|
-
win32: void 0
|
|
437
|
-
};
|
|
438
|
-
const mix = (del = delimiter) => {
|
|
439
|
-
return new Proxy(_path, { get(_, prop) {
|
|
440
|
-
if (prop === "delimiter") return del;
|
|
441
|
-
if (prop === "posix") return posix;
|
|
442
|
-
if (prop === "win32") return win32;
|
|
443
|
-
return _platforms[prop] || _path[prop];
|
|
444
|
-
} });
|
|
445
|
-
};
|
|
446
|
-
const posix = /* @__PURE__ */ mix(":");
|
|
447
|
-
const win32 = /* @__PURE__ */ mix(";");
|
|
448
|
-
function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
449
|
-
const minimalPriority = logLevelPriority[logLevel];
|
|
450
|
-
const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
|
|
451
|
-
if (logLevelPriority[level] < minimalPriority) return;
|
|
452
|
-
for (const plugin of getSortedPlugins("onLog", plugins)) {
|
|
453
|
-
if (skipped.has(plugin)) continue;
|
|
454
|
-
const { onLog: pluginOnLog } = plugin;
|
|
455
|
-
if (pluginOnLog) {
|
|
456
|
-
const getLogHandler = (level$1) => {
|
|
457
|
-
if (logLevelPriority[level$1] < minimalPriority) return () => {};
|
|
458
|
-
return (log$1) => logger(level$1, normalizeLog(log$1), new Set(skipped).add(plugin));
|
|
459
|
-
};
|
|
460
|
-
if (("handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog).call({
|
|
461
|
-
debug: getLogHandler(LOG_LEVEL_DEBUG),
|
|
462
|
-
error: (log$1) => error(normalizeLog(log$1)),
|
|
463
|
-
info: getLogHandler(LOG_LEVEL_INFO),
|
|
464
|
-
meta: {
|
|
465
|
-
rollupVersion: "4.23.0",
|
|
466
|
-
rolldownVersion: VERSION,
|
|
467
|
-
watchMode
|
|
468
|
-
},
|
|
469
|
-
warn: getLogHandler(LOG_LEVEL_WARN),
|
|
470
|
-
pluginName: plugin.name || "unknown"
|
|
471
|
-
}, level, log) === false) return;
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
onLog(level, log);
|
|
475
|
-
};
|
|
476
|
-
return logger;
|
|
477
|
-
}
|
|
478
|
-
const getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
|
|
479
|
-
const { onwarn, onLog } = config;
|
|
480
|
-
const defaultOnLog = getDefaultOnLog(printLog, onwarn);
|
|
481
|
-
if (onLog) {
|
|
482
|
-
const minimalPriority = logLevelPriority[logLevel];
|
|
483
|
-
return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
|
|
484
|
-
if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
|
|
485
|
-
if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
return defaultOnLog;
|
|
489
|
-
};
|
|
490
|
-
const getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
|
|
491
|
-
if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
|
|
492
|
-
else printLog(level, log);
|
|
493
|
-
} : printLog;
|
|
494
|
-
const addLogToString = (log) => {
|
|
495
|
-
Object.defineProperty(log, "toString", {
|
|
496
|
-
value: () => getExtendedLogMessage(log),
|
|
497
|
-
writable: true
|
|
498
|
-
});
|
|
499
|
-
return log;
|
|
500
|
-
};
|
|
501
|
-
const defaultPrintLog = (level, log) => {
|
|
502
|
-
const message = getExtendedLogMessage(log);
|
|
503
|
-
switch (level) {
|
|
504
|
-
case LOG_LEVEL_WARN: return console.warn(message);
|
|
505
|
-
case LOG_LEVEL_DEBUG: return console.debug(message);
|
|
506
|
-
default: return console.info(message);
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
const getExtendedLogMessage = (log) => {
|
|
510
|
-
let prefix = "";
|
|
511
|
-
if (log.plugin) prefix += `(${log.plugin} plugin) `;
|
|
512
|
-
if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
513
|
-
return prefix + log.message;
|
|
514
|
-
};
|
|
515
|
-
function relativeId(id$1) {
|
|
516
|
-
if (!posix.isAbsolute(id$1)) return id$1;
|
|
517
|
-
return posix.relative(posix.resolve(), id$1);
|
|
518
|
-
}
|
|
519
|
-
function normalizeHook(hook) {
|
|
520
|
-
if (typeof hook === "function" || typeof hook === "string") return {
|
|
521
|
-
handler: hook,
|
|
522
|
-
options: {},
|
|
523
|
-
meta: {}
|
|
524
|
-
};
|
|
525
|
-
if (typeof hook === "object" && hook !== null) {
|
|
526
|
-
const { handler, order, ...options } = hook;
|
|
527
|
-
return {
|
|
528
|
-
handler,
|
|
529
|
-
options,
|
|
530
|
-
meta: { order }
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
unreachable("Invalid hook type");
|
|
534
|
-
}
|
|
535
|
-
const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
536
|
-
"options",
|
|
537
|
-
"buildStart",
|
|
538
|
-
"resolveId",
|
|
539
|
-
"load",
|
|
540
|
-
"transform",
|
|
541
|
-
"moduleParsed",
|
|
542
|
-
"buildEnd",
|
|
543
|
-
"onLog",
|
|
544
|
-
"resolveDynamicImport",
|
|
545
|
-
"closeBundle",
|
|
546
|
-
"closeWatcher",
|
|
547
|
-
"watchChange"
|
|
548
|
-
];
|
|
549
|
-
const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
|
|
550
|
-
"augmentChunkHash",
|
|
551
|
-
"outputOptions",
|
|
552
|
-
"renderChunk",
|
|
553
|
-
"renderStart",
|
|
554
|
-
"renderError",
|
|
555
|
-
"writeBundle",
|
|
556
|
-
"generateBundle"
|
|
557
|
-
];
|
|
558
|
-
const ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
559
|
-
...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
|
|
560
|
-
...ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES,
|
|
561
|
-
"footer",
|
|
562
|
-
"banner",
|
|
563
|
-
"intro",
|
|
564
|
-
"outro"
|
|
565
|
-
];
|
|
566
|
-
ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[22];
|
|
567
|
-
async function asyncFlatten(array$1) {
|
|
568
|
-
do
|
|
569
|
-
array$1 = (await Promise.all(array$1)).flat(Infinity);
|
|
570
|
-
while (array$1.some((v) => v?.then));
|
|
571
|
-
return array$1;
|
|
572
|
-
}
|
|
573
|
-
const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
574
|
-
function checkOutputPluginOption(plugins, onLog) {
|
|
575
|
-
for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
|
|
576
|
-
delete plugin[hook];
|
|
577
|
-
onLog(LOG_LEVEL_WARN, logInputHookInOutputPlugin(plugin.name, hook));
|
|
578
|
-
}
|
|
579
|
-
return plugins;
|
|
580
|
-
}
|
|
581
|
-
function normalizePlugins(plugins, anonymousPrefix) {
|
|
582
|
-
for (const [index, plugin] of plugins.entries()) {
|
|
583
|
-
if ("_parallel" in plugin) continue;
|
|
584
|
-
if (plugin instanceof BuiltinPlugin) continue;
|
|
585
|
-
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
586
|
-
}
|
|
587
|
-
return plugins;
|
|
588
|
-
}
|
|
589
|
-
const ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
590
|
-
const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
591
|
-
var PluginDriver = class {
|
|
592
|
-
static async callOptionsHook(inputOptions, watchMode = false) {
|
|
593
|
-
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
594
|
-
const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
|
|
595
|
-
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
596
|
-
for (const plugin of plugins) {
|
|
597
|
-
const name = plugin.name || "unknown";
|
|
598
|
-
const options = plugin.options;
|
|
599
|
-
if (options) {
|
|
600
|
-
const { handler } = normalizeHook(options);
|
|
601
|
-
const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
|
|
602
|
-
if (result) inputOptions = result;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
return inputOptions;
|
|
606
|
-
}
|
|
607
|
-
static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
|
|
608
|
-
const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
|
|
609
|
-
for (const plugin of sortedPlugins) {
|
|
610
|
-
const name = plugin.name || "unknown";
|
|
611
|
-
const options = plugin.outputOptions;
|
|
612
|
-
if (options) {
|
|
613
|
-
const { handler } = normalizeHook(options);
|
|
614
|
-
const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
|
|
615
|
-
if (result) outputOptions = result;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
return outputOptions;
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
function getObjectPlugins(plugins) {
|
|
622
|
-
return plugins.filter((plugin) => {
|
|
623
|
-
if (!plugin) return;
|
|
624
|
-
if ("_parallel" in plugin) return;
|
|
625
|
-
if (plugin instanceof BuiltinPlugin) return;
|
|
626
|
-
return plugin;
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
function getSortedPlugins(hookName, plugins) {
|
|
630
|
-
const pre = [];
|
|
631
|
-
const normal = [];
|
|
632
|
-
const post = [];
|
|
633
|
-
for (const plugin of plugins) {
|
|
634
|
-
const hook = plugin[hookName];
|
|
635
|
-
if (hook) {
|
|
636
|
-
if (typeof hook === "object") {
|
|
637
|
-
if (hook.order === "pre") {
|
|
638
|
-
pre.push(plugin);
|
|
639
|
-
continue;
|
|
640
|
-
}
|
|
641
|
-
if (hook.order === "post") {
|
|
642
|
-
post.push(plugin);
|
|
643
|
-
continue;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
normal.push(plugin);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
return [
|
|
650
|
-
...pre,
|
|
651
|
-
...normal,
|
|
652
|
-
...post
|
|
653
|
-
];
|
|
654
|
-
}
|
|
655
|
-
let store$4;
|
|
656
|
-
/**
|
|
657
|
-
* Returns the global configuration.
|
|
658
|
-
*
|
|
659
|
-
* @param config The config to merge.
|
|
660
|
-
*
|
|
661
|
-
* @returns The configuration.
|
|
662
|
-
*/
|
|
663
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
664
|
-
function getGlobalConfig(config$1) {
|
|
665
|
-
return {
|
|
666
|
-
lang: config$1?.lang ?? store$4?.lang,
|
|
667
|
-
message: config$1?.message,
|
|
668
|
-
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
669
|
-
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
let store$3;
|
|
673
|
-
/**
|
|
674
|
-
* Returns a global error message.
|
|
675
|
-
*
|
|
676
|
-
* @param lang The language of the message.
|
|
677
|
-
*
|
|
678
|
-
* @returns The error message.
|
|
679
|
-
*/
|
|
680
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
681
|
-
function getGlobalMessage(lang) {
|
|
682
|
-
return store$3?.get(lang);
|
|
683
|
-
}
|
|
684
|
-
let store$2;
|
|
685
|
-
/**
|
|
686
|
-
* Returns a schema error message.
|
|
687
|
-
*
|
|
688
|
-
* @param lang The language of the message.
|
|
689
|
-
*
|
|
690
|
-
* @returns The error message.
|
|
691
|
-
*/
|
|
692
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
693
|
-
function getSchemaMessage(lang) {
|
|
694
|
-
return store$2?.get(lang);
|
|
695
|
-
}
|
|
696
|
-
let store$1;
|
|
697
|
-
/**
|
|
698
|
-
* Returns a specific error message.
|
|
699
|
-
*
|
|
700
|
-
* @param reference The identifier reference.
|
|
701
|
-
* @param lang The language of the message.
|
|
702
|
-
*
|
|
703
|
-
* @returns The error message.
|
|
704
|
-
*/
|
|
705
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
706
|
-
function getSpecificMessage(reference, lang) {
|
|
707
|
-
return store$1?.get(reference)?.get(lang);
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Stringifies an unknown input to a literal or type string.
|
|
711
|
-
*
|
|
712
|
-
* @param input The unknown input.
|
|
713
|
-
*
|
|
714
|
-
* @returns A literal or type string.
|
|
715
|
-
*
|
|
716
|
-
* @internal
|
|
717
|
-
*/
|
|
718
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
719
|
-
function _stringify(input) {
|
|
720
|
-
const type = typeof input;
|
|
721
|
-
if (type === "string") return `"${input}"`;
|
|
722
|
-
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
723
|
-
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
724
|
-
return type;
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
* Adds an issue to the dataset.
|
|
728
|
-
*
|
|
729
|
-
* @param context The issue context.
|
|
730
|
-
* @param label The issue label.
|
|
731
|
-
* @param dataset The input dataset.
|
|
732
|
-
* @param config The configuration.
|
|
733
|
-
* @param other The optional props.
|
|
734
|
-
*
|
|
735
|
-
* @internal
|
|
736
|
-
*/
|
|
737
|
-
function _addIssue(context, label, dataset, config$1, other) {
|
|
738
|
-
const input = other && "input" in other ? other.input : dataset.value;
|
|
739
|
-
const expected = other?.expected ?? context.expects ?? null;
|
|
740
|
-
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
741
|
-
const issue = {
|
|
742
|
-
kind: context.kind,
|
|
743
|
-
type: context.type,
|
|
744
|
-
input,
|
|
745
|
-
expected,
|
|
746
|
-
received,
|
|
747
|
-
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
748
|
-
requirement: context.requirement,
|
|
749
|
-
path: other?.path,
|
|
750
|
-
issues: other?.issues,
|
|
751
|
-
lang: config$1.lang,
|
|
752
|
-
abortEarly: config$1.abortEarly,
|
|
753
|
-
abortPipeEarly: config$1.abortPipeEarly
|
|
754
|
-
};
|
|
755
|
-
const isSchema = context.kind === "schema";
|
|
756
|
-
const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
757
|
-
if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
|
|
758
|
-
if (isSchema) dataset.typed = false;
|
|
759
|
-
if (dataset.issues) dataset.issues.push(issue);
|
|
760
|
-
else dataset.issues = [issue];
|
|
761
|
-
}
|
|
762
|
-
/**
|
|
763
|
-
* Returns the Standard Schema properties.
|
|
764
|
-
*
|
|
765
|
-
* @param context The schema context.
|
|
766
|
-
*
|
|
767
|
-
* @returns The Standard Schema properties.
|
|
768
|
-
*/
|
|
769
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
770
|
-
function _getStandardProps(context) {
|
|
771
|
-
return {
|
|
772
|
-
version: 1,
|
|
773
|
-
vendor: "valibot",
|
|
774
|
-
validate(value$1) {
|
|
775
|
-
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
776
|
-
}
|
|
777
|
-
};
|
|
778
|
-
}
|
|
779
|
-
/**
|
|
780
|
-
* Disallows inherited object properties and prevents object prototype
|
|
781
|
-
* pollution by disallowing certain keys.
|
|
782
|
-
*
|
|
783
|
-
* @param object The object to check.
|
|
784
|
-
* @param key The key to check.
|
|
785
|
-
*
|
|
786
|
-
* @returns Whether the key is allowed.
|
|
787
|
-
*
|
|
788
|
-
* @internal
|
|
789
|
-
*/
|
|
790
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
791
|
-
function _isValidObjectKey(object$1, key) {
|
|
792
|
-
return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
793
|
-
}
|
|
794
|
-
/**
|
|
795
|
-
* Joins multiple `expects` values with the given separator.
|
|
796
|
-
*
|
|
797
|
-
* @param values The `expects` values.
|
|
798
|
-
* @param separator The separator.
|
|
799
|
-
*
|
|
800
|
-
* @returns The joined `expects` property.
|
|
801
|
-
*
|
|
802
|
-
* @internal
|
|
803
|
-
*/
|
|
804
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
805
|
-
function _joinExpects(values$1, separator) {
|
|
806
|
-
const list = [...new Set(values$1)];
|
|
807
|
-
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
808
|
-
return list[0] ?? "never";
|
|
809
|
-
}
|
|
810
|
-
/**
|
|
811
|
-
* A Valibot error with useful information.
|
|
812
|
-
*/
|
|
813
|
-
var ValiError = class extends Error {
|
|
814
|
-
/**
|
|
815
|
-
* Creates a Valibot error with useful information.
|
|
816
|
-
*
|
|
817
|
-
* @param issues The error issues.
|
|
818
|
-
*/
|
|
819
|
-
constructor(issues) {
|
|
820
|
-
super(issues[0].message);
|
|
821
|
-
this.name = "ValiError";
|
|
822
|
-
this.issues = issues;
|
|
823
|
-
}
|
|
824
|
-
};
|
|
825
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
826
|
-
function args(schema) {
|
|
827
|
-
return {
|
|
828
|
-
kind: "transformation",
|
|
829
|
-
type: "args",
|
|
830
|
-
reference: args,
|
|
831
|
-
async: false,
|
|
832
|
-
schema,
|
|
833
|
-
"~run"(dataset, config$1) {
|
|
834
|
-
const func = dataset.value;
|
|
835
|
-
dataset.value = (...args_) => {
|
|
836
|
-
const argsDataset = this.schema["~run"]({ value: args_ }, config$1);
|
|
837
|
-
if (argsDataset.issues) throw new ValiError(argsDataset.issues);
|
|
838
|
-
return func(...argsDataset.value);
|
|
839
|
-
};
|
|
840
|
-
return dataset;
|
|
841
|
-
}
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* Creates an await transformation action.
|
|
846
|
-
*
|
|
847
|
-
* @returns An await action.
|
|
848
|
-
*/
|
|
849
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
850
|
-
function awaitAsync() {
|
|
851
|
-
return {
|
|
852
|
-
kind: "transformation",
|
|
853
|
-
type: "await",
|
|
854
|
-
reference: awaitAsync,
|
|
855
|
-
async: true,
|
|
856
|
-
async "~run"(dataset) {
|
|
857
|
-
dataset.value = await dataset.value;
|
|
858
|
-
return dataset;
|
|
859
|
-
}
|
|
860
|
-
};
|
|
861
|
-
}
|
|
862
|
-
/**
|
|
863
|
-
* Creates a description metadata action.
|
|
864
|
-
*
|
|
865
|
-
* @param description_ The description text.
|
|
866
|
-
*
|
|
867
|
-
* @returns A description action.
|
|
868
|
-
*/
|
|
869
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
870
|
-
function description(description_) {
|
|
871
|
-
return {
|
|
872
|
-
kind: "metadata",
|
|
873
|
-
type: "description",
|
|
874
|
-
reference: description,
|
|
875
|
-
description: description_
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
879
|
-
function returns(schema) {
|
|
880
|
-
return {
|
|
881
|
-
kind: "transformation",
|
|
882
|
-
type: "returns",
|
|
883
|
-
reference: returns,
|
|
884
|
-
async: false,
|
|
885
|
-
schema,
|
|
886
|
-
"~run"(dataset, config$1) {
|
|
887
|
-
const func = dataset.value;
|
|
888
|
-
dataset.value = (...args_) => {
|
|
889
|
-
const returnsDataset = this.schema["~run"]({ value: func(...args_) }, config$1);
|
|
890
|
-
if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
|
|
891
|
-
return returnsDataset.value;
|
|
892
|
-
};
|
|
893
|
-
return dataset;
|
|
894
|
-
}
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
898
|
-
function returnsAsync(schema) {
|
|
899
|
-
return {
|
|
900
|
-
kind: "transformation",
|
|
901
|
-
type: "returns",
|
|
902
|
-
reference: returnsAsync,
|
|
903
|
-
async: false,
|
|
904
|
-
schema,
|
|
905
|
-
"~run"(dataset, config$1) {
|
|
906
|
-
const func = dataset.value;
|
|
907
|
-
dataset.value = async (...args_) => {
|
|
908
|
-
const returnsDataset = await this.schema["~run"]({ value: await func(...args_) }, config$1);
|
|
909
|
-
if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
|
|
910
|
-
return returnsDataset.value;
|
|
911
|
-
};
|
|
912
|
-
return dataset;
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
}
|
|
916
|
-
/**
|
|
917
|
-
* Returns the fallback value of the schema.
|
|
918
|
-
*
|
|
919
|
-
* @param schema The schema to get it from.
|
|
920
|
-
* @param dataset The output dataset if available.
|
|
921
|
-
* @param config The config if available.
|
|
922
|
-
*
|
|
923
|
-
* @returns The fallback value.
|
|
924
|
-
*/
|
|
925
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
926
|
-
function getFallback(schema, dataset, config$1) {
|
|
927
|
-
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
928
|
-
}
|
|
929
|
-
/**
|
|
930
|
-
* Returns the default value of the schema.
|
|
931
|
-
*
|
|
932
|
-
* @param schema The schema to get it from.
|
|
933
|
-
* @param dataset The input dataset if available.
|
|
934
|
-
* @param config The config if available.
|
|
935
|
-
*
|
|
936
|
-
* @returns The default value.
|
|
937
|
-
*/
|
|
938
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
939
|
-
function getDefault(schema, dataset, config$1) {
|
|
940
|
-
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Creates an any schema.
|
|
944
|
-
*
|
|
945
|
-
* Hint: This schema function exists only for completeness and is not
|
|
946
|
-
* recommended in practice. Instead, `unknown` should be used to accept
|
|
947
|
-
* unknown data.
|
|
948
|
-
*
|
|
949
|
-
* @returns An any schema.
|
|
950
|
-
*/
|
|
951
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
952
|
-
function any() {
|
|
953
|
-
return {
|
|
954
|
-
kind: "schema",
|
|
955
|
-
type: "any",
|
|
956
|
-
reference: any,
|
|
957
|
-
expects: "any",
|
|
958
|
-
async: false,
|
|
959
|
-
get "~standard"() {
|
|
960
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
961
|
-
},
|
|
962
|
-
"~run"(dataset) {
|
|
963
|
-
dataset.typed = true;
|
|
964
|
-
return dataset;
|
|
965
|
-
}
|
|
966
|
-
};
|
|
967
|
-
}
|
|
968
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
969
|
-
function array(item, message$1) {
|
|
970
|
-
return {
|
|
971
|
-
kind: "schema",
|
|
972
|
-
type: "array",
|
|
973
|
-
reference: array,
|
|
974
|
-
expects: "Array",
|
|
975
|
-
async: false,
|
|
976
|
-
item,
|
|
977
|
-
message: message$1,
|
|
978
|
-
get "~standard"() {
|
|
979
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
980
|
-
},
|
|
981
|
-
"~run"(dataset, config$1) {
|
|
982
|
-
const input = dataset.value;
|
|
983
|
-
if (Array.isArray(input)) {
|
|
984
|
-
dataset.typed = true;
|
|
985
|
-
dataset.value = [];
|
|
986
|
-
for (let key = 0; key < input.length; key++) {
|
|
987
|
-
const value$1 = input[key];
|
|
988
|
-
const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
|
|
989
|
-
if (itemDataset.issues) {
|
|
990
|
-
const pathItem = {
|
|
991
|
-
type: "array",
|
|
992
|
-
origin: "value",
|
|
993
|
-
input,
|
|
994
|
-
key,
|
|
995
|
-
value: value$1
|
|
996
|
-
};
|
|
997
|
-
for (const issue of itemDataset.issues) {
|
|
998
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
999
|
-
else issue.path = [pathItem];
|
|
1000
|
-
dataset.issues?.push(issue);
|
|
1001
|
-
}
|
|
1002
|
-
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
1003
|
-
if (config$1.abortEarly) {
|
|
1004
|
-
dataset.typed = false;
|
|
1005
|
-
break;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
if (!itemDataset.typed) dataset.typed = false;
|
|
1009
|
-
dataset.value.push(itemDataset.value);
|
|
1010
|
-
}
|
|
1011
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
1012
|
-
return dataset;
|
|
1013
|
-
}
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1017
|
-
function boolean(message$1) {
|
|
1018
|
-
return {
|
|
1019
|
-
kind: "schema",
|
|
1020
|
-
type: "boolean",
|
|
1021
|
-
reference: boolean,
|
|
1022
|
-
expects: "boolean",
|
|
1023
|
-
async: false,
|
|
1024
|
-
message: message$1,
|
|
1025
|
-
get "~standard"() {
|
|
1026
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1027
|
-
},
|
|
1028
|
-
"~run"(dataset, config$1) {
|
|
1029
|
-
if (typeof dataset.value === "boolean") dataset.typed = true;
|
|
1030
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1031
|
-
return dataset;
|
|
1032
|
-
}
|
|
1033
|
-
};
|
|
1034
|
-
}
|
|
1035
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1036
|
-
function custom(check$1, message$1) {
|
|
1037
|
-
return {
|
|
1038
|
-
kind: "schema",
|
|
1039
|
-
type: "custom",
|
|
1040
|
-
reference: custom,
|
|
1041
|
-
expects: "unknown",
|
|
1042
|
-
async: false,
|
|
1043
|
-
check: check$1,
|
|
1044
|
-
message: message$1,
|
|
1045
|
-
get "~standard"() {
|
|
1046
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1047
|
-
},
|
|
1048
|
-
"~run"(dataset, config$1) {
|
|
1049
|
-
if (this.check(dataset.value)) dataset.typed = true;
|
|
1050
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1051
|
-
return dataset;
|
|
1052
|
-
}
|
|
1053
|
-
};
|
|
1054
|
-
}
|
|
1055
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1056
|
-
function function_(message$1) {
|
|
1057
|
-
return {
|
|
1058
|
-
kind: "schema",
|
|
1059
|
-
type: "function",
|
|
1060
|
-
reference: function_,
|
|
1061
|
-
expects: "Function",
|
|
1062
|
-
async: false,
|
|
1063
|
-
message: message$1,
|
|
1064
|
-
get "~standard"() {
|
|
1065
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1066
|
-
},
|
|
1067
|
-
"~run"(dataset, config$1) {
|
|
1068
|
-
if (typeof dataset.value === "function") dataset.typed = true;
|
|
1069
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1070
|
-
return dataset;
|
|
1071
|
-
}
|
|
1072
|
-
};
|
|
1073
|
-
}
|
|
1074
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1075
|
-
function instance(class_, message$1) {
|
|
1076
|
-
return {
|
|
1077
|
-
kind: "schema",
|
|
1078
|
-
type: "instance",
|
|
1079
|
-
reference: instance,
|
|
1080
|
-
expects: class_.name,
|
|
1081
|
-
async: false,
|
|
1082
|
-
class: class_,
|
|
1083
|
-
message: message$1,
|
|
1084
|
-
get "~standard"() {
|
|
1085
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1086
|
-
},
|
|
1087
|
-
"~run"(dataset, config$1) {
|
|
1088
|
-
if (dataset.value instanceof this.class) dataset.typed = true;
|
|
1089
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1090
|
-
return dataset;
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1093
|
-
}
|
|
1094
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1095
|
-
function literal(literal_, message$1) {
|
|
1096
|
-
return {
|
|
1097
|
-
kind: "schema",
|
|
1098
|
-
type: "literal",
|
|
1099
|
-
reference: literal,
|
|
1100
|
-
expects: /* @__PURE__ */ _stringify(literal_),
|
|
1101
|
-
async: false,
|
|
1102
|
-
literal: literal_,
|
|
1103
|
-
message: message$1,
|
|
1104
|
-
get "~standard"() {
|
|
1105
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1106
|
-
},
|
|
1107
|
-
"~run"(dataset, config$1) {
|
|
1108
|
-
if (dataset.value === this.literal) dataset.typed = true;
|
|
1109
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1110
|
-
return dataset;
|
|
1111
|
-
}
|
|
1112
|
-
};
|
|
1113
|
-
}
|
|
1114
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1115
|
-
function looseObject(entries$1, message$1) {
|
|
1116
|
-
return {
|
|
1117
|
-
kind: "schema",
|
|
1118
|
-
type: "loose_object",
|
|
1119
|
-
reference: looseObject,
|
|
1120
|
-
expects: "Object",
|
|
1121
|
-
async: false,
|
|
1122
|
-
entries: entries$1,
|
|
1123
|
-
message: message$1,
|
|
1124
|
-
get "~standard"() {
|
|
1125
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1126
|
-
},
|
|
1127
|
-
"~run"(dataset, config$1) {
|
|
1128
|
-
const input = dataset.value;
|
|
1129
|
-
if (input && typeof input === "object") {
|
|
1130
|
-
dataset.typed = true;
|
|
1131
|
-
dataset.value = {};
|
|
1132
|
-
for (const key in this.entries) {
|
|
1133
|
-
const valueSchema = this.entries[key];
|
|
1134
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
1135
|
-
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
1136
|
-
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
1137
|
-
if (valueDataset.issues) {
|
|
1138
|
-
const pathItem = {
|
|
1139
|
-
type: "object",
|
|
1140
|
-
origin: "value",
|
|
1141
|
-
input,
|
|
1142
|
-
key,
|
|
1143
|
-
value: value$1
|
|
1144
|
-
};
|
|
1145
|
-
for (const issue of valueDataset.issues) {
|
|
1146
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
1147
|
-
else issue.path = [pathItem];
|
|
1148
|
-
dataset.issues?.push(issue);
|
|
1149
|
-
}
|
|
1150
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1151
|
-
if (config$1.abortEarly) {
|
|
1152
|
-
dataset.typed = false;
|
|
1153
|
-
break;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
1157
|
-
dataset.value[key] = valueDataset.value;
|
|
1158
|
-
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
1159
|
-
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
1160
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
1161
|
-
input: void 0,
|
|
1162
|
-
expected: `"${key}"`,
|
|
1163
|
-
path: [{
|
|
1164
|
-
type: "object",
|
|
1165
|
-
origin: "key",
|
|
1166
|
-
input,
|
|
1167
|
-
key,
|
|
1168
|
-
value: input[key]
|
|
1169
|
-
}]
|
|
1170
|
-
});
|
|
1171
|
-
if (config$1.abortEarly) break;
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
if (!dataset.issues || !config$1.abortEarly) {
|
|
1175
|
-
for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
|
|
1176
|
-
}
|
|
1177
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
1178
|
-
return dataset;
|
|
1179
|
-
}
|
|
1180
|
-
};
|
|
1181
|
-
}
|
|
1182
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1183
|
-
function never(message$1) {
|
|
1184
|
-
return {
|
|
1185
|
-
kind: "schema",
|
|
1186
|
-
type: "never",
|
|
1187
|
-
reference: never,
|
|
1188
|
-
expects: "never",
|
|
1189
|
-
async: false,
|
|
1190
|
-
message: message$1,
|
|
1191
|
-
get "~standard"() {
|
|
1192
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1193
|
-
},
|
|
1194
|
-
"~run"(dataset, config$1) {
|
|
1195
|
-
_addIssue(this, "type", dataset, config$1);
|
|
1196
|
-
return dataset;
|
|
1197
|
-
}
|
|
1198
|
-
};
|
|
1199
|
-
}
|
|
1200
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1201
|
-
function nullish(wrapped, default_) {
|
|
1202
|
-
return {
|
|
1203
|
-
kind: "schema",
|
|
1204
|
-
type: "nullish",
|
|
1205
|
-
reference: nullish,
|
|
1206
|
-
expects: `(${wrapped.expects} | null | undefined)`,
|
|
1207
|
-
async: false,
|
|
1208
|
-
wrapped,
|
|
1209
|
-
default: default_,
|
|
1210
|
-
get "~standard"() {
|
|
1211
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1212
|
-
},
|
|
1213
|
-
"~run"(dataset, config$1) {
|
|
1214
|
-
if (dataset.value === null || dataset.value === void 0) {
|
|
1215
|
-
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
1216
|
-
if (dataset.value === null || dataset.value === void 0) {
|
|
1217
|
-
dataset.typed = true;
|
|
1218
|
-
return dataset;
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
return this.wrapped["~run"](dataset, config$1);
|
|
1222
|
-
}
|
|
1223
|
-
};
|
|
1224
|
-
}
|
|
1225
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1226
|
-
function number(message$1) {
|
|
1227
|
-
return {
|
|
1228
|
-
kind: "schema",
|
|
1229
|
-
type: "number",
|
|
1230
|
-
reference: number,
|
|
1231
|
-
expects: "number",
|
|
1232
|
-
async: false,
|
|
1233
|
-
message: message$1,
|
|
1234
|
-
get "~standard"() {
|
|
1235
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1236
|
-
},
|
|
1237
|
-
"~run"(dataset, config$1) {
|
|
1238
|
-
if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
|
|
1239
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1240
|
-
return dataset;
|
|
1241
|
-
}
|
|
1242
|
-
};
|
|
1243
|
-
}
|
|
1244
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1245
|
-
function object(entries$1, message$1) {
|
|
1246
|
-
return {
|
|
1247
|
-
kind: "schema",
|
|
1248
|
-
type: "object",
|
|
1249
|
-
reference: object,
|
|
1250
|
-
expects: "Object",
|
|
1251
|
-
async: false,
|
|
1252
|
-
entries: entries$1,
|
|
1253
|
-
message: message$1,
|
|
1254
|
-
get "~standard"() {
|
|
1255
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1256
|
-
},
|
|
1257
|
-
"~run"(dataset, config$1) {
|
|
1258
|
-
const input = dataset.value;
|
|
1259
|
-
if (input && typeof input === "object") {
|
|
1260
|
-
dataset.typed = true;
|
|
1261
|
-
dataset.value = {};
|
|
1262
|
-
for (const key in this.entries) {
|
|
1263
|
-
const valueSchema = this.entries[key];
|
|
1264
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
1265
|
-
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
1266
|
-
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
1267
|
-
if (valueDataset.issues) {
|
|
1268
|
-
const pathItem = {
|
|
1269
|
-
type: "object",
|
|
1270
|
-
origin: "value",
|
|
1271
|
-
input,
|
|
1272
|
-
key,
|
|
1273
|
-
value: value$1
|
|
1274
|
-
};
|
|
1275
|
-
for (const issue of valueDataset.issues) {
|
|
1276
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
1277
|
-
else issue.path = [pathItem];
|
|
1278
|
-
dataset.issues?.push(issue);
|
|
1279
|
-
}
|
|
1280
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1281
|
-
if (config$1.abortEarly) {
|
|
1282
|
-
dataset.typed = false;
|
|
1283
|
-
break;
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
1287
|
-
dataset.value[key] = valueDataset.value;
|
|
1288
|
-
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
1289
|
-
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
1290
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
1291
|
-
input: void 0,
|
|
1292
|
-
expected: `"${key}"`,
|
|
1293
|
-
path: [{
|
|
1294
|
-
type: "object",
|
|
1295
|
-
origin: "key",
|
|
1296
|
-
input,
|
|
1297
|
-
key,
|
|
1298
|
-
value: input[key]
|
|
1299
|
-
}]
|
|
1300
|
-
});
|
|
1301
|
-
if (config$1.abortEarly) break;
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
1305
|
-
return dataset;
|
|
1306
|
-
}
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1310
|
-
function optional(wrapped, default_) {
|
|
1311
|
-
return {
|
|
1312
|
-
kind: "schema",
|
|
1313
|
-
type: "optional",
|
|
1314
|
-
reference: optional,
|
|
1315
|
-
expects: `(${wrapped.expects} | undefined)`,
|
|
1316
|
-
async: false,
|
|
1317
|
-
wrapped,
|
|
1318
|
-
default: default_,
|
|
1319
|
-
get "~standard"() {
|
|
1320
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1321
|
-
},
|
|
1322
|
-
"~run"(dataset, config$1) {
|
|
1323
|
-
if (dataset.value === void 0) {
|
|
1324
|
-
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
1325
|
-
if (dataset.value === void 0) {
|
|
1326
|
-
dataset.typed = true;
|
|
1327
|
-
return dataset;
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
return this.wrapped["~run"](dataset, config$1);
|
|
1331
|
-
}
|
|
1332
|
-
};
|
|
1333
|
-
}
|
|
1334
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1335
|
-
function promise(message$1) {
|
|
1336
|
-
return {
|
|
1337
|
-
kind: "schema",
|
|
1338
|
-
type: "promise",
|
|
1339
|
-
reference: promise,
|
|
1340
|
-
expects: "Promise",
|
|
1341
|
-
async: false,
|
|
1342
|
-
message: message$1,
|
|
1343
|
-
get "~standard"() {
|
|
1344
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1345
|
-
},
|
|
1346
|
-
"~run"(dataset, config$1) {
|
|
1347
|
-
if (dataset.value instanceof Promise) dataset.typed = true;
|
|
1348
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1349
|
-
return dataset;
|
|
1350
|
-
}
|
|
1351
|
-
};
|
|
1352
|
-
}
|
|
1353
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1354
|
-
function record(key, value$1, message$1) {
|
|
1355
|
-
return {
|
|
1356
|
-
kind: "schema",
|
|
1357
|
-
type: "record",
|
|
1358
|
-
reference: record,
|
|
1359
|
-
expects: "Object",
|
|
1360
|
-
async: false,
|
|
1361
|
-
key,
|
|
1362
|
-
value: value$1,
|
|
1363
|
-
message: message$1,
|
|
1364
|
-
get "~standard"() {
|
|
1365
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1366
|
-
},
|
|
1367
|
-
"~run"(dataset, config$1) {
|
|
1368
|
-
const input = dataset.value;
|
|
1369
|
-
if (input && typeof input === "object") {
|
|
1370
|
-
dataset.typed = true;
|
|
1371
|
-
dataset.value = {};
|
|
1372
|
-
for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
|
|
1373
|
-
const entryValue = input[entryKey];
|
|
1374
|
-
const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
|
|
1375
|
-
if (keyDataset.issues) {
|
|
1376
|
-
const pathItem = {
|
|
1377
|
-
type: "object",
|
|
1378
|
-
origin: "key",
|
|
1379
|
-
input,
|
|
1380
|
-
key: entryKey,
|
|
1381
|
-
value: entryValue
|
|
1382
|
-
};
|
|
1383
|
-
for (const issue of keyDataset.issues) {
|
|
1384
|
-
issue.path = [pathItem];
|
|
1385
|
-
dataset.issues?.push(issue);
|
|
1386
|
-
}
|
|
1387
|
-
if (!dataset.issues) dataset.issues = keyDataset.issues;
|
|
1388
|
-
if (config$1.abortEarly) {
|
|
1389
|
-
dataset.typed = false;
|
|
1390
|
-
break;
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
|
|
1394
|
-
if (valueDataset.issues) {
|
|
1395
|
-
const pathItem = {
|
|
1396
|
-
type: "object",
|
|
1397
|
-
origin: "value",
|
|
1398
|
-
input,
|
|
1399
|
-
key: entryKey,
|
|
1400
|
-
value: entryValue
|
|
1401
|
-
};
|
|
1402
|
-
for (const issue of valueDataset.issues) {
|
|
1403
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
1404
|
-
else issue.path = [pathItem];
|
|
1405
|
-
dataset.issues?.push(issue);
|
|
1406
|
-
}
|
|
1407
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1408
|
-
if (config$1.abortEarly) {
|
|
1409
|
-
dataset.typed = false;
|
|
1410
|
-
break;
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
|
|
1414
|
-
if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
|
|
1415
|
-
}
|
|
1416
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
1417
|
-
return dataset;
|
|
1418
|
-
}
|
|
1419
|
-
};
|
|
1420
|
-
}
|
|
1421
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1422
|
-
function strictObject(entries$1, message$1) {
|
|
1423
|
-
return {
|
|
1424
|
-
kind: "schema",
|
|
1425
|
-
type: "strict_object",
|
|
1426
|
-
reference: strictObject,
|
|
1427
|
-
expects: "Object",
|
|
1428
|
-
async: false,
|
|
1429
|
-
entries: entries$1,
|
|
1430
|
-
message: message$1,
|
|
1431
|
-
get "~standard"() {
|
|
1432
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1433
|
-
},
|
|
1434
|
-
"~run"(dataset, config$1) {
|
|
1435
|
-
const input = dataset.value;
|
|
1436
|
-
if (input && typeof input === "object") {
|
|
1437
|
-
dataset.typed = true;
|
|
1438
|
-
dataset.value = {};
|
|
1439
|
-
for (const key in this.entries) {
|
|
1440
|
-
const valueSchema = this.entries[key];
|
|
1441
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
1442
|
-
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
1443
|
-
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
1444
|
-
if (valueDataset.issues) {
|
|
1445
|
-
const pathItem = {
|
|
1446
|
-
type: "object",
|
|
1447
|
-
origin: "value",
|
|
1448
|
-
input,
|
|
1449
|
-
key,
|
|
1450
|
-
value: value$1
|
|
1451
|
-
};
|
|
1452
|
-
for (const issue of valueDataset.issues) {
|
|
1453
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
1454
|
-
else issue.path = [pathItem];
|
|
1455
|
-
dataset.issues?.push(issue);
|
|
1456
|
-
}
|
|
1457
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1458
|
-
if (config$1.abortEarly) {
|
|
1459
|
-
dataset.typed = false;
|
|
1460
|
-
break;
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
1464
|
-
dataset.value[key] = valueDataset.value;
|
|
1465
|
-
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
1466
|
-
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
1467
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
1468
|
-
input: void 0,
|
|
1469
|
-
expected: `"${key}"`,
|
|
1470
|
-
path: [{
|
|
1471
|
-
type: "object",
|
|
1472
|
-
origin: "key",
|
|
1473
|
-
input,
|
|
1474
|
-
key,
|
|
1475
|
-
value: input[key]
|
|
1476
|
-
}]
|
|
1477
|
-
});
|
|
1478
|
-
if (config$1.abortEarly) break;
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
if (!dataset.issues || !config$1.abortEarly) {
|
|
1482
|
-
for (const key in input) if (!(key in this.entries)) {
|
|
1483
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
1484
|
-
input: key,
|
|
1485
|
-
expected: "never",
|
|
1486
|
-
path: [{
|
|
1487
|
-
type: "object",
|
|
1488
|
-
origin: "key",
|
|
1489
|
-
input,
|
|
1490
|
-
key,
|
|
1491
|
-
value: input[key]
|
|
1492
|
-
}]
|
|
1493
|
-
});
|
|
1494
|
-
break;
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
1498
|
-
return dataset;
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
}
|
|
1502
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1503
|
-
function string(message$1) {
|
|
1504
|
-
return {
|
|
1505
|
-
kind: "schema",
|
|
1506
|
-
type: "string",
|
|
1507
|
-
reference: string,
|
|
1508
|
-
expects: "string",
|
|
1509
|
-
async: false,
|
|
1510
|
-
message: message$1,
|
|
1511
|
-
get "~standard"() {
|
|
1512
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1513
|
-
},
|
|
1514
|
-
"~run"(dataset, config$1) {
|
|
1515
|
-
if (typeof dataset.value === "string") dataset.typed = true;
|
|
1516
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1517
|
-
return dataset;
|
|
1518
|
-
}
|
|
1519
|
-
};
|
|
1520
|
-
}
|
|
1521
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1522
|
-
function tuple(items, message$1) {
|
|
1523
|
-
return {
|
|
1524
|
-
kind: "schema",
|
|
1525
|
-
type: "tuple",
|
|
1526
|
-
reference: tuple,
|
|
1527
|
-
expects: "Array",
|
|
1528
|
-
async: false,
|
|
1529
|
-
items,
|
|
1530
|
-
message: message$1,
|
|
1531
|
-
get "~standard"() {
|
|
1532
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1533
|
-
},
|
|
1534
|
-
"~run"(dataset, config$1) {
|
|
1535
|
-
const input = dataset.value;
|
|
1536
|
-
if (Array.isArray(input)) {
|
|
1537
|
-
dataset.typed = true;
|
|
1538
|
-
dataset.value = [];
|
|
1539
|
-
for (let key = 0; key < this.items.length; key++) {
|
|
1540
|
-
const value$1 = input[key];
|
|
1541
|
-
const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
|
|
1542
|
-
if (itemDataset.issues) {
|
|
1543
|
-
const pathItem = {
|
|
1544
|
-
type: "array",
|
|
1545
|
-
origin: "value",
|
|
1546
|
-
input,
|
|
1547
|
-
key,
|
|
1548
|
-
value: value$1
|
|
1549
|
-
};
|
|
1550
|
-
for (const issue of itemDataset.issues) {
|
|
1551
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
1552
|
-
else issue.path = [pathItem];
|
|
1553
|
-
dataset.issues?.push(issue);
|
|
1554
|
-
}
|
|
1555
|
-
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
1556
|
-
if (config$1.abortEarly) {
|
|
1557
|
-
dataset.typed = false;
|
|
1558
|
-
break;
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
if (!itemDataset.typed) dataset.typed = false;
|
|
1562
|
-
dataset.value.push(itemDataset.value);
|
|
1563
|
-
}
|
|
1564
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
1565
|
-
return dataset;
|
|
1566
|
-
}
|
|
1567
|
-
};
|
|
1568
|
-
}
|
|
1569
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1570
|
-
function undefined_(message$1) {
|
|
1571
|
-
return {
|
|
1572
|
-
kind: "schema",
|
|
1573
|
-
type: "undefined",
|
|
1574
|
-
reference: undefined_,
|
|
1575
|
-
expects: "undefined",
|
|
1576
|
-
async: false,
|
|
1577
|
-
message: message$1,
|
|
1578
|
-
get "~standard"() {
|
|
1579
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1580
|
-
},
|
|
1581
|
-
"~run"(dataset, config$1) {
|
|
1582
|
-
if (dataset.value === void 0) dataset.typed = true;
|
|
1583
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1584
|
-
return dataset;
|
|
1585
|
-
}
|
|
1586
|
-
};
|
|
1587
|
-
}
|
|
1588
|
-
/**
|
|
1589
|
-
* Returns the sub issues of the provided datasets for the union issue.
|
|
1590
|
-
*
|
|
1591
|
-
* @param datasets The datasets.
|
|
1592
|
-
*
|
|
1593
|
-
* @returns The sub issues.
|
|
1594
|
-
*
|
|
1595
|
-
* @internal
|
|
1596
|
-
*/
|
|
1597
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1598
|
-
function _subIssues(datasets) {
|
|
1599
|
-
let issues;
|
|
1600
|
-
if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
|
|
1601
|
-
else issues = dataset.issues;
|
|
1602
|
-
return issues;
|
|
1603
|
-
}
|
|
1604
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1605
|
-
function union(options, message$1) {
|
|
1606
|
-
return {
|
|
1607
|
-
kind: "schema",
|
|
1608
|
-
type: "union",
|
|
1609
|
-
reference: union,
|
|
1610
|
-
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
1611
|
-
async: false,
|
|
1612
|
-
options,
|
|
1613
|
-
message: message$1,
|
|
1614
|
-
get "~standard"() {
|
|
1615
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1616
|
-
},
|
|
1617
|
-
"~run"(dataset, config$1) {
|
|
1618
|
-
let validDataset;
|
|
1619
|
-
let typedDatasets;
|
|
1620
|
-
let untypedDatasets;
|
|
1621
|
-
for (const schema of this.options) {
|
|
1622
|
-
const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
|
|
1623
|
-
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
1624
|
-
else typedDatasets = [optionDataset];
|
|
1625
|
-
else {
|
|
1626
|
-
validDataset = optionDataset;
|
|
1627
|
-
break;
|
|
1628
|
-
}
|
|
1629
|
-
else if (untypedDatasets) untypedDatasets.push(optionDataset);
|
|
1630
|
-
else untypedDatasets = [optionDataset];
|
|
1631
|
-
}
|
|
1632
|
-
if (validDataset) return validDataset;
|
|
1633
|
-
if (typedDatasets) {
|
|
1634
|
-
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
1635
|
-
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
1636
|
-
dataset.typed = true;
|
|
1637
|
-
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
1638
|
-
else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
1639
|
-
return dataset;
|
|
1640
|
-
}
|
|
1641
|
-
};
|
|
1642
|
-
}
|
|
1643
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1644
|
-
function unionAsync(options, message$1) {
|
|
1645
|
-
return {
|
|
1646
|
-
kind: "schema",
|
|
1647
|
-
type: "union",
|
|
1648
|
-
reference: unionAsync,
|
|
1649
|
-
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
1650
|
-
async: true,
|
|
1651
|
-
options,
|
|
1652
|
-
message: message$1,
|
|
1653
|
-
get "~standard"() {
|
|
1654
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1655
|
-
},
|
|
1656
|
-
async "~run"(dataset, config$1) {
|
|
1657
|
-
let validDataset;
|
|
1658
|
-
let typedDatasets;
|
|
1659
|
-
let untypedDatasets;
|
|
1660
|
-
for (const schema of this.options) {
|
|
1661
|
-
const optionDataset = await schema["~run"]({ value: dataset.value }, config$1);
|
|
1662
|
-
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
1663
|
-
else typedDatasets = [optionDataset];
|
|
1664
|
-
else {
|
|
1665
|
-
validDataset = optionDataset;
|
|
1666
|
-
break;
|
|
1667
|
-
}
|
|
1668
|
-
else if (untypedDatasets) untypedDatasets.push(optionDataset);
|
|
1669
|
-
else untypedDatasets = [optionDataset];
|
|
1670
|
-
}
|
|
1671
|
-
if (validDataset) return validDataset;
|
|
1672
|
-
if (typedDatasets) {
|
|
1673
|
-
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
1674
|
-
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
1675
|
-
dataset.typed = true;
|
|
1676
|
-
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
1677
|
-
else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
1678
|
-
return dataset;
|
|
1679
|
-
}
|
|
1680
|
-
};
|
|
1681
|
-
}
|
|
1682
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1683
|
-
function void_(message$1) {
|
|
1684
|
-
return {
|
|
1685
|
-
kind: "schema",
|
|
1686
|
-
type: "void",
|
|
1687
|
-
reference: void_,
|
|
1688
|
-
expects: "void",
|
|
1689
|
-
async: false,
|
|
1690
|
-
message: message$1,
|
|
1691
|
-
get "~standard"() {
|
|
1692
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1693
|
-
},
|
|
1694
|
-
"~run"(dataset, config$1) {
|
|
1695
|
-
if (dataset.value === void 0) dataset.typed = true;
|
|
1696
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
1697
|
-
return dataset;
|
|
1698
|
-
}
|
|
1699
|
-
};
|
|
1700
|
-
}
|
|
1701
|
-
/**
|
|
1702
|
-
* Creates a modified copy of an object schema that does not contain the
|
|
1703
|
-
* selected entries.
|
|
1704
|
-
*
|
|
1705
|
-
* @param schema The schema to omit from.
|
|
1706
|
-
* @param keys The selected entries.
|
|
1707
|
-
*
|
|
1708
|
-
* @returns An object schema.
|
|
1709
|
-
*/
|
|
1710
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1711
|
-
function omit(schema, keys) {
|
|
1712
|
-
const entries$1 = { ...schema.entries };
|
|
1713
|
-
for (const key of keys) delete entries$1[key];
|
|
1714
|
-
return {
|
|
1715
|
-
...schema,
|
|
1716
|
-
entries: entries$1,
|
|
1717
|
-
get "~standard"() {
|
|
1718
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1719
|
-
}
|
|
1720
|
-
};
|
|
1721
|
-
}
|
|
1722
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1723
|
-
function partial(schema, keys) {
|
|
1724
|
-
const entries$1 = {};
|
|
1725
|
-
for (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];
|
|
1726
|
-
return {
|
|
1727
|
-
...schema,
|
|
1728
|
-
entries: entries$1,
|
|
1729
|
-
get "~standard"() {
|
|
1730
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1731
|
-
}
|
|
1732
|
-
};
|
|
1733
|
-
}
|
|
1734
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1735
|
-
function pipe(...pipe$1) {
|
|
1736
|
-
return {
|
|
1737
|
-
...pipe$1[0],
|
|
1738
|
-
pipe: pipe$1,
|
|
1739
|
-
get "~standard"() {
|
|
1740
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1741
|
-
},
|
|
1742
|
-
"~run"(dataset, config$1) {
|
|
1743
|
-
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
1744
|
-
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
1745
|
-
dataset.typed = false;
|
|
1746
|
-
break;
|
|
1747
|
-
}
|
|
1748
|
-
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
1749
|
-
}
|
|
1750
|
-
return dataset;
|
|
1751
|
-
}
|
|
1752
|
-
};
|
|
1753
|
-
}
|
|
1754
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1755
|
-
function pipeAsync(...pipe$1) {
|
|
1756
|
-
return {
|
|
1757
|
-
...pipe$1[0],
|
|
1758
|
-
pipe: pipe$1,
|
|
1759
|
-
async: true,
|
|
1760
|
-
get "~standard"() {
|
|
1761
|
-
return /* @__PURE__ */ _getStandardProps(this);
|
|
1762
|
-
},
|
|
1763
|
-
async "~run"(dataset, config$1) {
|
|
1764
|
-
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
1765
|
-
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
1766
|
-
dataset.typed = false;
|
|
1767
|
-
break;
|
|
1768
|
-
}
|
|
1769
|
-
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = await item["~run"](dataset, config$1);
|
|
1770
|
-
}
|
|
1771
|
-
return dataset;
|
|
1772
|
-
}
|
|
1773
|
-
};
|
|
1774
|
-
}
|
|
1775
|
-
/**
|
|
1776
|
-
* Parses an unknown input based on a schema.
|
|
1777
|
-
*
|
|
1778
|
-
* @param schema The schema to be used.
|
|
1779
|
-
* @param input The input to be parsed.
|
|
1780
|
-
* @param config The parse configuration.
|
|
1781
|
-
*
|
|
1782
|
-
* @returns The parse result.
|
|
1783
|
-
*/
|
|
1784
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
1785
|
-
function safeParse(schema, input, config$1) {
|
|
1786
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
1787
|
-
return {
|
|
1788
|
-
typed: dataset.typed,
|
|
1789
|
-
success: !dataset.issues,
|
|
1790
|
-
output: dataset.value,
|
|
1791
|
-
issues: dataset.issues
|
|
1792
|
-
};
|
|
1793
|
-
}
|
|
1794
|
-
function styleText(...args$1) {
|
|
1795
|
-
return args$1[1];
|
|
1796
|
-
}
|
|
1797
|
-
const StringOrRegExpSchema = /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ instance(RegExp)]);
|
|
1798
|
-
function vFunction() {
|
|
1799
|
-
return /* @__PURE__ */ function_();
|
|
1800
|
-
}
|
|
1801
|
-
const LogLevelSchema = /* @__PURE__ */ union([
|
|
1802
|
-
/* @__PURE__ */ literal("debug"),
|
|
1803
|
-
/* @__PURE__ */ literal("info"),
|
|
1804
|
-
/* @__PURE__ */ literal("warn")
|
|
1805
|
-
]);
|
|
1806
|
-
const LogLevelOptionSchema = /* @__PURE__ */ union([LogLevelSchema, /* @__PURE__ */ literal("silent")]);
|
|
1807
|
-
const LogLevelWithErrorSchema = /* @__PURE__ */ union([LogLevelSchema, /* @__PURE__ */ literal("error")]);
|
|
1808
|
-
const RollupLogSchema = /* @__PURE__ */ any();
|
|
1809
|
-
const RollupLogWithStringSchema = /* @__PURE__ */ union([RollupLogSchema, /* @__PURE__ */ string()]);
|
|
1810
|
-
const InputOptionSchema = /* @__PURE__ */ union([
|
|
1811
|
-
/* @__PURE__ */ string(),
|
|
1812
|
-
/* @__PURE__ */ array(/* @__PURE__ */ string()),
|
|
1813
|
-
/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string())
|
|
1814
|
-
]);
|
|
1815
|
-
const ExternalOptionFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([
|
|
1816
|
-
/* @__PURE__ */ string(),
|
|
1817
|
-
/* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1818
|
-
/* @__PURE__ */ boolean()
|
|
1819
|
-
])), /* @__PURE__ */ returns(/* @__PURE__ */ nullish(/* @__PURE__ */ boolean())));
|
|
1820
|
-
const ExternalOptionSchema = /* @__PURE__ */ union([
|
|
1821
|
-
StringOrRegExpSchema,
|
|
1822
|
-
/* @__PURE__ */ array(StringOrRegExpSchema),
|
|
1823
|
-
ExternalOptionFunctionSchema
|
|
1824
|
-
]);
|
|
1825
|
-
const ModuleTypesSchema = /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([
|
|
1826
|
-
/* @__PURE__ */ literal("asset"),
|
|
1827
|
-
/* @__PURE__ */ literal("base64"),
|
|
1828
|
-
/* @__PURE__ */ literal("binary"),
|
|
1829
|
-
/* @__PURE__ */ literal("css"),
|
|
1830
|
-
/* @__PURE__ */ literal("dataurl"),
|
|
1831
|
-
/* @__PURE__ */ literal("empty"),
|
|
1832
|
-
/* @__PURE__ */ literal("js"),
|
|
1833
|
-
/* @__PURE__ */ literal("json"),
|
|
1834
|
-
/* @__PURE__ */ literal("jsx"),
|
|
1835
|
-
/* @__PURE__ */ literal("text"),
|
|
1836
|
-
/* @__PURE__ */ literal("ts"),
|
|
1837
|
-
/* @__PURE__ */ literal("tsx")
|
|
1838
|
-
]));
|
|
1839
|
-
const TransformOptionsSchema = /* @__PURE__ */ object({
|
|
1840
|
-
assumptions: /* @__PURE__ */ optional(/* @__PURE__ */ object({
|
|
1841
|
-
ignoreFunctionLength: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1842
|
-
noDocumentAll: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1843
|
-
objectRestNoSymbols: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1844
|
-
pureGetters: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1845
|
-
setPublicClassFields: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
1846
|
-
})),
|
|
1847
|
-
typescript: /* @__PURE__ */ optional(/* @__PURE__ */ object({
|
|
1848
|
-
jsxPragma: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1849
|
-
jsxPragmaFrag: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1850
|
-
onlyRemoveTypeImports: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1851
|
-
allowNamespaces: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1852
|
-
allowDeclareFields: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1853
|
-
declaration: /* @__PURE__ */ optional(/* @__PURE__ */ object({
|
|
1854
|
-
stripInternal: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1855
|
-
sourcemap: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
1856
|
-
})),
|
|
1857
|
-
rewriteImportExtensions: /* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
1858
|
-
/* @__PURE__ */ literal("rewrite"),
|
|
1859
|
-
/* @__PURE__ */ literal("remove"),
|
|
1860
|
-
/* @__PURE__ */ boolean()
|
|
1861
|
-
]))
|
|
1862
|
-
})),
|
|
1863
|
-
helpers: /* @__PURE__ */ optional(/* @__PURE__ */ object({ mode: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("Runtime"), /* @__PURE__ */ literal("External")])) })),
|
|
1864
|
-
decorators: /* @__PURE__ */ optional(/* @__PURE__ */ object({
|
|
1865
|
-
legacy: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1866
|
-
emitDecoratorMetadata: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
1867
|
-
})),
|
|
1868
|
-
jsx: /* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
1869
|
-
/* @__PURE__ */ literal(false),
|
|
1870
|
-
/* @__PURE__ */ literal("preserve"),
|
|
1871
|
-
/* @__PURE__ */ literal("react"),
|
|
1872
|
-
/* @__PURE__ */ literal("react-jsx"),
|
|
1873
|
-
/* @__PURE__ */ strictObject({
|
|
1874
|
-
runtime: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("classic"), /* @__PURE__ */ literal("automatic")])), /* @__PURE__ */ description("Which runtime to use")),
|
|
1875
|
-
development: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Development specific information")),
|
|
1876
|
-
throwIfNamespace: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
1877
|
-
importSource: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Import the factory of element and fragment if mode is classic")),
|
|
1878
|
-
pragma: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Jsx element transformation")),
|
|
1879
|
-
pragmaFrag: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Jsx fragment transformation")),
|
|
1880
|
-
refresh: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Enable react fast refresh"))
|
|
1881
|
-
})
|
|
1882
|
-
])),
|
|
1883
|
-
target: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string())])), /* @__PURE__ */ description("The JavaScript target environment")),
|
|
1884
|
-
define: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string())), /* @__PURE__ */ description("Define global variables (syntax: key=value,key2=value2)")),
|
|
1885
|
-
inject: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ tuple([/* @__PURE__ */ string(), /* @__PURE__ */ string()])]))), /* @__PURE__ */ description("Inject import statements on demand")),
|
|
1886
|
-
dropLabels: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())), /* @__PURE__ */ description("Remove labeled statements with these label names"))
|
|
1887
|
-
});
|
|
1888
|
-
const WatchOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1889
|
-
chokidar: /* @__PURE__ */ optional(/* @__PURE__ */ never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
1890
|
-
exclude: /* @__PURE__ */ optional(/* @__PURE__ */ union([StringOrRegExpSchema, /* @__PURE__ */ array(StringOrRegExpSchema)])),
|
|
1891
|
-
include: /* @__PURE__ */ optional(/* @__PURE__ */ union([StringOrRegExpSchema, /* @__PURE__ */ array(StringOrRegExpSchema)])),
|
|
1892
|
-
notify: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
|
|
1893
|
-
compareContents: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1894
|
-
pollInterval: /* @__PURE__ */ optional(/* @__PURE__ */ number())
|
|
1895
|
-
})), /* @__PURE__ */ description("Notify options")),
|
|
1896
|
-
skipWrite: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Skip the bundle.write() step")),
|
|
1897
|
-
buildDelay: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Throttle watch rebuilds")),
|
|
1898
|
-
clearScreen: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to clear the screen when a rebuild is triggered")),
|
|
1899
|
-
onInvalidate: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ pipe(/* @__PURE__ */ function_(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string()])))), /* @__PURE__ */ description("An optional function that will be called immediately every time a module changes that is part of the build."))
|
|
1900
|
-
});
|
|
1901
|
-
const ChecksOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1902
|
-
circularDependency: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting circular dependency")),
|
|
1903
|
-
eval: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting eval")),
|
|
1904
|
-
missingGlobalName: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting missing global name")),
|
|
1905
|
-
missingNameOptionForIifeExport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting missing name option for iife export")),
|
|
1906
|
-
mixedExports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting mixed exports")),
|
|
1907
|
-
unresolvedEntry: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting unresolved entry")),
|
|
1908
|
-
unresolvedImport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting unresolved import")),
|
|
1909
|
-
filenameConflict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting filename conflict")),
|
|
1910
|
-
commonJsVariableInEsm: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting common js variable in esm")),
|
|
1911
|
-
importIsUndefined: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting import is undefined")),
|
|
1912
|
-
emptyImportMeta: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting empty import meta")),
|
|
1913
|
-
cannotCallNamespace: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting cannot call namespace")),
|
|
1914
|
-
configurationFieldConflict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting configuration field conflict")),
|
|
1915
|
-
preferBuiltinFeature: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting prefer builtin feature")),
|
|
1916
|
-
couldNotCleanDirectory: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting could not clean directory")),
|
|
1917
|
-
pluginTimings: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warning when detecting plugin timings"))
|
|
1918
|
-
});
|
|
1919
|
-
const MinifyOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1920
|
-
compress: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
|
|
1921
|
-
target: /* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
1922
|
-
/* @__PURE__ */ literal("esnext"),
|
|
1923
|
-
/* @__PURE__ */ literal("es2015"),
|
|
1924
|
-
/* @__PURE__ */ literal("es2016"),
|
|
1925
|
-
/* @__PURE__ */ literal("es2017"),
|
|
1926
|
-
/* @__PURE__ */ literal("es2018"),
|
|
1927
|
-
/* @__PURE__ */ literal("es2019"),
|
|
1928
|
-
/* @__PURE__ */ literal("es2020"),
|
|
1929
|
-
/* @__PURE__ */ literal("es2021"),
|
|
1930
|
-
/* @__PURE__ */ literal("es2022"),
|
|
1931
|
-
/* @__PURE__ */ literal("es2023"),
|
|
1932
|
-
/* @__PURE__ */ literal("es2024")
|
|
1933
|
-
])),
|
|
1934
|
-
dropConsole: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1935
|
-
dropDebugger: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1936
|
-
keepNames: /* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
|
|
1937
|
-
function: /* @__PURE__ */ boolean(),
|
|
1938
|
-
class: /* @__PURE__ */ boolean()
|
|
1939
|
-
})),
|
|
1940
|
-
unused: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("keep_assign")]))
|
|
1941
|
-
})])),
|
|
1942
|
-
mangle: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
|
|
1943
|
-
toplevel: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1944
|
-
keepNames: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
|
|
1945
|
-
function: /* @__PURE__ */ boolean(),
|
|
1946
|
-
class: /* @__PURE__ */ boolean()
|
|
1947
|
-
})])),
|
|
1948
|
-
debug: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
1949
|
-
})])),
|
|
1950
|
-
codegen: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({ removeWhitespace: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()) })]))
|
|
1951
|
-
});
|
|
1952
|
-
const ResolveOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1953
|
-
alias: /* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([
|
|
1954
|
-
/* @__PURE__ */ literal(false),
|
|
1955
|
-
/* @__PURE__ */ string(),
|
|
1956
|
-
/* @__PURE__ */ array(/* @__PURE__ */ string())
|
|
1957
|
-
]))),
|
|
1958
|
-
aliasFields: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ array(/* @__PURE__ */ string()))),
|
|
1959
|
-
conditionNames: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
|
|
1960
|
-
extensionAlias: /* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string()))),
|
|
1961
|
-
exportsFields: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ array(/* @__PURE__ */ string()))),
|
|
1962
|
-
extensions: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
|
|
1963
|
-
mainFields: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
|
|
1964
|
-
mainFiles: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
|
|
1965
|
-
modules: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
|
|
1966
|
-
symlinks: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1967
|
-
yarnPnp: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
1968
|
-
});
|
|
1969
|
-
const TreeshakingOptionsSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ looseObject({
|
|
1970
|
-
annotations: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1971
|
-
manualPureFunctions: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
|
|
1972
|
-
unknownGlobalSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1973
|
-
commonjs: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
1974
|
-
propertyReadSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal(false), /* @__PURE__ */ literal("always")])),
|
|
1975
|
-
propertyWriteSideEffects: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal(false), /* @__PURE__ */ literal("always")]))
|
|
1976
|
-
})]);
|
|
1977
|
-
const OptimizationOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1978
|
-
inlineConst: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
|
|
1979
|
-
mode: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("all"), /* @__PURE__ */ literal("smart")])),
|
|
1980
|
-
pass: /* @__PURE__ */ optional(/* @__PURE__ */ number())
|
|
1981
|
-
})])), /* @__PURE__ */ description("Enable crossmodule constant inlining")),
|
|
1982
|
-
pifeForModuleWrappers: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Use PIFE pattern for module wrappers"))
|
|
1983
|
-
});
|
|
1984
|
-
const LogOrStringHandlerSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])));
|
|
1985
|
-
const OnLogSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([
|
|
1986
|
-
LogLevelSchema,
|
|
1987
|
-
RollupLogSchema,
|
|
1988
|
-
LogOrStringHandlerSchema
|
|
1989
|
-
])));
|
|
1990
|
-
const OnwarnSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([RollupLogSchema, /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ union([RollupLogWithStringSchema, /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ returns(RollupLogWithStringSchema))])])))])));
|
|
1991
|
-
const DevModeSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
|
|
1992
|
-
port: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
1993
|
-
host: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1994
|
-
implement: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
1995
|
-
lazy: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
1996
|
-
})]);
|
|
1997
|
-
const InputOptionsSchema = /* @__PURE__ */ strictObject({
|
|
1998
|
-
input: /* @__PURE__ */ optional(InputOptionSchema),
|
|
1999
|
-
plugins: /* @__PURE__ */ optional(/* @__PURE__ */ custom(() => true)),
|
|
2000
|
-
external: /* @__PURE__ */ optional(ExternalOptionSchema),
|
|
2001
|
-
makeAbsoluteExternalsRelative: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("ifRelativeSource")])),
|
|
2002
|
-
resolve: /* @__PURE__ */ optional(ResolveOptionsSchema),
|
|
2003
|
-
cwd: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Current working directory")),
|
|
2004
|
-
platform: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
2005
|
-
/* @__PURE__ */ literal("browser"),
|
|
2006
|
-
/* @__PURE__ */ literal("neutral"),
|
|
2007
|
-
/* @__PURE__ */ literal("node")
|
|
2008
|
-
])), /* @__PURE__ */ description(`Platform for which the code should be generated (node, ${styleText("underline", "browser")}, neutral)`)),
|
|
2009
|
-
shimMissingExports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Create shim variables for missing exports")),
|
|
2010
|
-
treeshake: /* @__PURE__ */ optional(TreeshakingOptionsSchema),
|
|
2011
|
-
optimization: /* @__PURE__ */ optional(OptimizationOptionsSchema),
|
|
2012
|
-
logLevel: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(LogLevelOptionSchema), /* @__PURE__ */ description(`Log level (${styleText("dim", "silent")}, ${styleText(["underline", "gray"], "info")}, debug, ${styleText("yellow", "warn")})`)),
|
|
2013
|
-
onLog: /* @__PURE__ */ optional(OnLogSchema),
|
|
2014
|
-
onwarn: /* @__PURE__ */ optional(OnwarnSchema),
|
|
2015
|
-
moduleTypes: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ModuleTypesSchema), /* @__PURE__ */ description("Module types for customized extensions")),
|
|
2016
|
-
experimental: /* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
|
|
2017
|
-
disableLiveBindings: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
2018
|
-
enableComposingJsPlugins: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
2019
|
-
viteMode: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
2020
|
-
resolveNewUrlToAsset: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
2021
|
-
strictExecutionOrder: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
2022
|
-
onDemandWrapping: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
2023
|
-
incrementalBuild: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
2024
|
-
devMode: /* @__PURE__ */ optional(DevModeSchema),
|
|
2025
|
-
attachDebugInfo: /* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
2026
|
-
/* @__PURE__ */ literal("none"),
|
|
2027
|
-
/* @__PURE__ */ literal("simple"),
|
|
2028
|
-
/* @__PURE__ */ literal("full")
|
|
2029
|
-
])),
|
|
2030
|
-
chunkModulesOrder: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("module-id"), /* @__PURE__ */ literal("exec-order")])),
|
|
2031
|
-
chunkImportMap: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ object({
|
|
2032
|
-
baseUrl: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
2033
|
-
fileName: /* @__PURE__ */ optional(/* @__PURE__ */ string())
|
|
2034
|
-
})])),
|
|
2035
|
-
nativeMagicString: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
2036
|
-
chunkOptimization: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
2037
|
-
})),
|
|
2038
|
-
transform: /* @__PURE__ */ optional(TransformOptionsSchema),
|
|
2039
|
-
watch: /* @__PURE__ */ optional(/* @__PURE__ */ union([WatchOptionsSchema, /* @__PURE__ */ literal(false)])),
|
|
2040
|
-
checks: /* @__PURE__ */ optional(ChecksOptionsSchema),
|
|
2041
|
-
devtools: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ object({ sessionId: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Used to name the build.")) })), /* @__PURE__ */ description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.")),
|
|
2042
|
-
preserveEntrySignatures: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
2043
|
-
/* @__PURE__ */ literal("strict"),
|
|
2044
|
-
/* @__PURE__ */ literal("allow-extension"),
|
|
2045
|
-
/* @__PURE__ */ literal("exports-only"),
|
|
2046
|
-
/* @__PURE__ */ literal(false)
|
|
2047
|
-
]))),
|
|
2048
|
-
tsconfig: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal(true), /* @__PURE__ */ string()])), /* @__PURE__ */ description("Path to the tsconfig.json file."))
|
|
2049
|
-
});
|
|
2050
|
-
const InputCliOverrideSchema = /* @__PURE__ */ strictObject({
|
|
2051
|
-
input: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())), /* @__PURE__ */ description("Entry file")),
|
|
2052
|
-
external: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())), /* @__PURE__ */ description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2053
|
-
treeshake: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("enable treeshaking")),
|
|
2054
|
-
makeAbsoluteExternalsRelative: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Prevent normalization of external imports")),
|
|
2055
|
-
preserveEntrySignatures: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ literal(false)), /* @__PURE__ */ description("Avoid facade chunks for entry points")),
|
|
2056
|
-
context: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("The entity top-level `this` represents."))
|
|
2057
|
-
});
|
|
2058
|
-
const InputCliOptionsSchema = /* @__PURE__ */ omit(/* @__PURE__ */ strictObject({
|
|
2059
|
-
...InputOptionsSchema.entries,
|
|
2060
|
-
...InputCliOverrideSchema.entries
|
|
2061
|
-
}), [
|
|
2062
|
-
"plugins",
|
|
2063
|
-
"onwarn",
|
|
2064
|
-
"onLog",
|
|
2065
|
-
"resolve",
|
|
2066
|
-
"experimental",
|
|
2067
|
-
"watch"
|
|
2068
|
-
]);
|
|
2069
|
-
const ModuleFormatSchema = /* @__PURE__ */ union([
|
|
2070
|
-
/* @__PURE__ */ literal("es"),
|
|
2071
|
-
/* @__PURE__ */ literal("cjs"),
|
|
2072
|
-
/* @__PURE__ */ literal("esm"),
|
|
2073
|
-
/* @__PURE__ */ literal("module"),
|
|
2074
|
-
/* @__PURE__ */ literal("commonjs"),
|
|
2075
|
-
/* @__PURE__ */ literal("iife"),
|
|
2076
|
-
/* @__PURE__ */ literal("umd")
|
|
2077
|
-
]);
|
|
2078
|
-
const AddonFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ custom(() => true)])), /* @__PURE__ */ returnsAsync(/* @__PURE__ */ unionAsync([/* @__PURE__ */ string(), /* @__PURE__ */ pipeAsync(/* @__PURE__ */ promise(), /* @__PURE__ */ awaitAsync(), /* @__PURE__ */ string())])));
|
|
2079
|
-
const ChunkFileNamesFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ custom(() => true)])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
|
|
2080
|
-
const ChunkFileNamesSchema = /* @__PURE__ */ union([/* @__PURE__ */ string(), ChunkFileNamesFunctionSchema]);
|
|
2081
|
-
const AssetFileNamesFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ custom(() => true)])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
|
|
2082
|
-
const AssetFileNamesSchema = /* @__PURE__ */ union([/* @__PURE__ */ string(), AssetFileNamesFunctionSchema]);
|
|
2083
|
-
const SanitizeFileNameFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string()])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
|
|
2084
|
-
const SanitizeFileNameSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), SanitizeFileNameFunctionSchema]);
|
|
2085
|
-
const GlobalsFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string()])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
|
|
2086
|
-
const PathsFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string()])), /* @__PURE__ */ returns(/* @__PURE__ */ string()));
|
|
2087
|
-
const ManualChunksFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string(), /* @__PURE__ */ object({})])), /* @__PURE__ */ returns(/* @__PURE__ */ nullish(/* @__PURE__ */ string())));
|
|
2088
|
-
const AdvancedChunksNameFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string(), /* @__PURE__ */ object({})])), /* @__PURE__ */ returns(/* @__PURE__ */ nullish(/* @__PURE__ */ string())));
|
|
2089
|
-
const AdvancedChunksTestFunctionSchema = /* @__PURE__ */ pipe(vFunction(), /* @__PURE__ */ args(/* @__PURE__ */ tuple([/* @__PURE__ */ string()])), /* @__PURE__ */ returns(/* @__PURE__ */ union([
|
|
2090
|
-
/* @__PURE__ */ boolean(),
|
|
2091
|
-
/* @__PURE__ */ void_(),
|
|
2092
|
-
/* @__PURE__ */ undefined_()
|
|
2093
|
-
])));
|
|
2094
|
-
const AdvancedChunksSchema = /* @__PURE__ */ strictObject({
|
|
2095
|
-
includeDependenciesRecursively: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
2096
|
-
minSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2097
|
-
maxSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2098
|
-
minModuleSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2099
|
-
maxModuleSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2100
|
-
minShareCount: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2101
|
-
groups: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ strictObject({
|
|
2102
|
-
name: /* @__PURE__ */ union([/* @__PURE__ */ string(), AdvancedChunksNameFunctionSchema]),
|
|
2103
|
-
test: /* @__PURE__ */ optional(/* @__PURE__ */ union([StringOrRegExpSchema, AdvancedChunksTestFunctionSchema])),
|
|
2104
|
-
priority: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2105
|
-
minSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2106
|
-
minShareCount: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2107
|
-
maxSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2108
|
-
minModuleSize: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
2109
|
-
maxModuleSize: /* @__PURE__ */ optional(/* @__PURE__ */ number())
|
|
2110
|
-
})))
|
|
2111
|
-
});
|
|
2112
|
-
const GeneratedCodeOptionsSchema = /* @__PURE__ */ strictObject({
|
|
2113
|
-
symbols: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to use Symbol.toStringTag for namespace objects")),
|
|
2114
|
-
preset: /* @__PURE__ */ union([/* @__PURE__ */ literal("es5"), /* @__PURE__ */ literal("es2015")]),
|
|
2115
|
-
profilerNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to add readable names to internal variables for profiling purposes"))
|
|
2116
|
-
});
|
|
2117
|
-
const OutputOptionsSchema = /* @__PURE__ */ strictObject({
|
|
2118
|
-
dir: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2119
|
-
file: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Single output file")),
|
|
2120
|
-
exports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
2121
|
-
/* @__PURE__ */ literal("auto"),
|
|
2122
|
-
/* @__PURE__ */ literal("named"),
|
|
2123
|
-
/* @__PURE__ */ literal("default"),
|
|
2124
|
-
/* @__PURE__ */ literal("none")
|
|
2125
|
-
])), /* @__PURE__ */ description(`Specify a export mode (${styleText("underline", "auto")}, named, default, none)`)),
|
|
2126
|
-
hashCharacters: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
2127
|
-
/* @__PURE__ */ literal("base64"),
|
|
2128
|
-
/* @__PURE__ */ literal("base36"),
|
|
2129
|
-
/* @__PURE__ */ literal("hex")
|
|
2130
|
-
])), /* @__PURE__ */ description("Use the specified character set for file hashes")),
|
|
2131
|
-
format: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ModuleFormatSchema), /* @__PURE__ */ description(`Output format of the generated bundle (supports ${styleText("underline", "esm")}, cjs, and iife)`)),
|
|
2132
|
-
sourcemap: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
2133
|
-
/* @__PURE__ */ boolean(),
|
|
2134
|
-
/* @__PURE__ */ literal("inline"),
|
|
2135
|
-
/* @__PURE__ */ literal("hidden")
|
|
2136
|
-
])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or ${styleText("bold", "pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2137
|
-
sourcemapBaseUrl: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Base URL used to prefix sourcemap paths")),
|
|
2138
|
-
sourcemapDebugIds: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inject sourcemap debug IDs")),
|
|
2139
|
-
sourcemapIgnoreList: /* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
2140
|
-
/* @__PURE__ */ boolean(),
|
|
2141
|
-
/* @__PURE__ */ custom(() => true),
|
|
2142
|
-
StringOrRegExpSchema
|
|
2143
|
-
])),
|
|
2144
|
-
sourcemapPathTransform: /* @__PURE__ */ optional(/* @__PURE__ */ custom(() => true)),
|
|
2145
|
-
banner: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
|
|
2146
|
-
footer: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
|
|
2147
|
-
postBanner: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
|
|
2148
|
-
postFooter: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
|
|
2149
|
-
intro: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
|
|
2150
|
-
outro: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), AddonFunctionSchema])),
|
|
2151
|
-
extend: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2152
|
-
esModule: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("if-default-prop")])),
|
|
2153
|
-
assetFileNames: /* @__PURE__ */ optional(AssetFileNamesSchema),
|
|
2154
|
-
entryFileNames: /* @__PURE__ */ optional(ChunkFileNamesSchema),
|
|
2155
|
-
chunkFileNames: /* @__PURE__ */ optional(ChunkFileNamesSchema),
|
|
2156
|
-
cssEntryFileNames: /* @__PURE__ */ optional(ChunkFileNamesSchema),
|
|
2157
|
-
cssChunkFileNames: /* @__PURE__ */ optional(ChunkFileNamesSchema),
|
|
2158
|
-
sanitizeFileName: /* @__PURE__ */ optional(SanitizeFileNameSchema),
|
|
2159
|
-
minify: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
2160
|
-
/* @__PURE__ */ boolean(),
|
|
2161
|
-
/* @__PURE__ */ literal("dce-only"),
|
|
2162
|
-
MinifyOptionsSchema
|
|
2163
|
-
])), /* @__PURE__ */ description("Minify the bundled file")),
|
|
2164
|
-
name: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name for UMD / IIFE format outputs")),
|
|
2165
|
-
globals: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string()), GlobalsFunctionSchema])), /* @__PURE__ */ description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2166
|
-
paths: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string()), PathsFunctionSchema])), /* @__PURE__ */ description("Maps external module IDs to paths")),
|
|
2167
|
-
generatedCode: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ partial(GeneratedCodeOptionsSchema)), /* @__PURE__ */ description("Generated code options")),
|
|
2168
|
-
externalLiveBindings: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("external live bindings")),
|
|
2169
|
-
inlineDynamicImports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inline dynamic imports")),
|
|
2170
|
-
dynamicImportInCjs: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Dynamic import in CJS output")),
|
|
2171
|
-
manualChunks: /* @__PURE__ */ optional(ManualChunksFunctionSchema),
|
|
2172
|
-
advancedChunks: /* @__PURE__ */ optional(AdvancedChunksSchema),
|
|
2173
|
-
legalComments: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("none"), /* @__PURE__ */ literal("inline")])), /* @__PURE__ */ description("Control comments in the output")),
|
|
2174
|
-
plugins: /* @__PURE__ */ optional(/* @__PURE__ */ custom(() => true)),
|
|
2175
|
-
polyfillRequire: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Disable require polyfill injection")),
|
|
2176
|
-
hoistTransitiveImports: /* @__PURE__ */ optional(/* @__PURE__ */ literal(false)),
|
|
2177
|
-
preserveModules: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Preserve module structure")),
|
|
2178
|
-
preserveModulesRoot: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Put preserved modules under this path at root level")),
|
|
2179
|
-
virtualDirname: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
2180
|
-
minifyInternalExports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Minify internal exports")),
|
|
2181
|
-
topLevelVar: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Rewrite top-level declarations to use `var`.")),
|
|
2182
|
-
cleanDir: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Clean output directory before emitting output")),
|
|
2183
|
-
keepNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Keep function and class names after bundling"))
|
|
2184
|
-
});
|
|
2185
|
-
const getAddonDescription = (placement, wrapper) => {
|
|
2186
|
-
return `Code to insert the ${styleText("bold", placement)} of the bundled file (${styleText("bold", wrapper)} the wrapper function)`;
|
|
2187
|
-
};
|
|
2188
|
-
const OutputCliOverrideSchema = /* @__PURE__ */ strictObject({
|
|
2189
|
-
assetFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name pattern for asset files")),
|
|
2190
|
-
entryFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name pattern for emitted entry chunks")),
|
|
2191
|
-
chunkFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name pattern for emitted secondary chunks")),
|
|
2192
|
-
cssEntryFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name pattern for emitted css entry chunks")),
|
|
2193
|
-
cssChunkFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name pattern for emitted css secondary chunks")),
|
|
2194
|
-
sanitizeFileName: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Sanitize file name")),
|
|
2195
|
-
banner: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description(getAddonDescription("top", "outside"))),
|
|
2196
|
-
footer: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description(getAddonDescription("bottom", "outside"))),
|
|
2197
|
-
postBanner: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("A string to prepend to the top of each chunk. Applied after the `renderChunk` hook and minification")),
|
|
2198
|
-
postFooter: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("A string to append to the bottom of each chunk. Applied after the `renderChunk` hook and minification")),
|
|
2199
|
-
intro: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description(getAddonDescription("top", "inside"))),
|
|
2200
|
-
outro: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description(getAddonDescription("bottom", "inside"))),
|
|
2201
|
-
esModule: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2202
|
-
globals: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ string())), /* @__PURE__ */ description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2203
|
-
advancedChunks: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
|
|
2204
|
-
minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
|
|
2205
|
-
minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
|
|
2206
|
-
})), /* @__PURE__ */ description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2207
|
-
minify: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Minify the bundled file"))
|
|
2208
|
-
});
|
|
2209
|
-
const OutputCliOptionsSchema = /* @__PURE__ */ omit(/* @__PURE__ */ strictObject({
|
|
2210
|
-
...OutputOptionsSchema.entries,
|
|
2211
|
-
...OutputCliOverrideSchema.entries
|
|
2212
|
-
}), [
|
|
2213
|
-
"sourcemapIgnoreList",
|
|
2214
|
-
"sourcemapPathTransform",
|
|
2215
|
-
"plugins",
|
|
2216
|
-
"hoistTransitiveImports"
|
|
2217
|
-
]);
|
|
2218
|
-
({
|
|
2219
|
-
...InputCliOptionsSchema.entries,
|
|
2220
|
-
...OutputCliOptionsSchema.entries
|
|
2221
|
-
});
|
|
2222
|
-
const inputHelperMsgRecord = {
|
|
2223
|
-
output: { ignored: true },
|
|
2224
|
-
"resolve.tsconfigFilename": { issueMsg: "It is deprecated. Please use the top-level `tsconfig` option instead." }
|
|
2225
|
-
};
|
|
2226
|
-
const outputHelperMsgRecord = {};
|
|
2227
|
-
function validateOption(key, options) {
|
|
2228
|
-
if (typeof options !== "object") throw new Error(`Invalid ${key} options. Expected an Object but received ${JSON.stringify(options)}.`);
|
|
2229
|
-
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2230
|
-
let parsed = /* @__PURE__ */ safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
2231
|
-
if (!parsed.success) {
|
|
2232
|
-
const errors = parsed.issues.map((issue) => {
|
|
2233
|
-
let issueMsg = issue.message;
|
|
2234
|
-
const issuePaths = issue.path.map((path) => path.key);
|
|
2235
|
-
if (issue.type === "union") {
|
|
2236
|
-
const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
|
|
2237
|
-
if (subIssue) {
|
|
2238
|
-
if (subIssue.path) issuePaths.push(subIssue.path.map((path) => path.key));
|
|
2239
|
-
issueMsg = subIssue.message;
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
|
-
const stringPath = issuePaths.join(".");
|
|
2243
|
-
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
2244
|
-
if (helper && helper.ignored) return "";
|
|
2245
|
-
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
2246
|
-
}).filter(Boolean);
|
|
2247
|
-
if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
var RolldownOutputImpl = class extends PlainObjectLike {
|
|
2251
|
-
constructor(bindingOutputs) {
|
|
2252
|
-
super();
|
|
2253
|
-
this.bindingOutputs = bindingOutputs;
|
|
2254
|
-
}
|
|
2255
|
-
get output() {
|
|
2256
|
-
return transformToRollupOutput(this.bindingOutputs).output;
|
|
2257
|
-
}
|
|
2258
|
-
__rolldown_external_memory_handle__(keepDataAlive) {
|
|
2259
|
-
const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
|
|
2260
|
-
if (!results.every((r) => r.freed)) {
|
|
2261
|
-
const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
|
|
2262
|
-
return {
|
|
2263
|
-
freed: false,
|
|
2264
|
-
reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
|
|
2265
|
-
};
|
|
2266
|
-
}
|
|
2267
|
-
return { freed: true };
|
|
2268
|
-
}
|
|
2269
|
-
};
|
|
2270
|
-
__decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
|
|
2271
|
-
function wrap$1(result) {
|
|
2272
|
-
let program, module, comments, errors;
|
|
2273
|
-
return {
|
|
2274
|
-
get program() {
|
|
2275
|
-
if (!program) program = jsonParseAst(result.program);
|
|
2276
|
-
return program;
|
|
2277
|
-
},
|
|
2278
|
-
get module() {
|
|
2279
|
-
if (!module) module = result.module;
|
|
2280
|
-
return module;
|
|
2281
|
-
},
|
|
2282
|
-
get comments() {
|
|
2283
|
-
if (!comments) comments = result.comments;
|
|
2284
|
-
return comments;
|
|
2285
|
-
},
|
|
2286
|
-
get errors() {
|
|
2287
|
-
if (!errors) errors = result.errors;
|
|
2288
|
-
return errors;
|
|
2289
|
-
}
|
|
2290
|
-
};
|
|
2291
|
-
}
|
|
2292
|
-
function jsonParseAst(programJson) {
|
|
2293
|
-
const { node: program, fixes } = JSON.parse(programJson);
|
|
2294
|
-
for (const fixPath of fixes) applyFix(program, fixPath);
|
|
2295
|
-
return program;
|
|
2296
|
-
}
|
|
2297
|
-
function applyFix(program, fixPath) {
|
|
2298
|
-
let node = program;
|
|
2299
|
-
for (const key of fixPath) node = node[key];
|
|
2300
|
-
if (node.bigint) node.value = BigInt(node.bigint);
|
|
2301
|
-
else try {
|
|
2302
|
-
node.value = RegExp(node.regex.pattern, node.regex.flags);
|
|
2303
|
-
} catch {}
|
|
2304
|
-
}
|
|
2305
|
-
/** Parse synchronously. */
|
|
2306
|
-
function parseSync$1(filename, sourceText, options) {
|
|
2307
|
-
return wrap$1(parseSync(filename, sourceText, options));
|
|
2308
|
-
}
|
|
2309
|
-
function wrap(result, filename, sourceText) {
|
|
2310
|
-
if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
|
|
2311
|
-
return result.program;
|
|
2312
|
-
}
|
|
2313
|
-
function normalizeParseError(filename, sourceText, errors) {
|
|
2314
|
-
let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2315
|
-
const pos = errors[0]?.labels?.[0]?.start;
|
|
2316
|
-
for (let i = 0; i < errors.length; i++) {
|
|
2317
|
-
if (i >= 5) {
|
|
2318
|
-
message += "\n...";
|
|
2319
|
-
break;
|
|
2320
|
-
}
|
|
2321
|
-
const e$1 = errors[i];
|
|
2322
|
-
message += e$1.message + "\n" + e$1.labels.map((label) => {
|
|
2323
|
-
const location = locate(sourceText, label.start, { offsetLine: 1 });
|
|
2324
|
-
if (!location) return;
|
|
2325
|
-
return getCodeFrame(sourceText, location.line, location.column);
|
|
2326
|
-
}).filter(Boolean).join("\n");
|
|
2327
|
-
}
|
|
2328
|
-
const log = logParseError(message, filename, pos);
|
|
2329
|
-
if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
|
|
2330
|
-
return error(log);
|
|
2331
|
-
}
|
|
2332
|
-
const defaultParserOptions = {
|
|
2333
|
-
lang: "js",
|
|
2334
|
-
preserveParens: false
|
|
2335
|
-
};
|
|
2336
|
-
function parseAst(sourceText, options, filename) {
|
|
2337
|
-
return wrap(parseSync$1(filename ?? "file.js", sourceText, {
|
|
2338
|
-
...defaultParserOptions,
|
|
2339
|
-
...options
|
|
2340
|
-
}), filename, sourceText);
|
|
2341
|
-
}
|
|
2342
|
-
function unwrapBindingResult(container) {
|
|
2343
|
-
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
2344
|
-
return container;
|
|
2345
|
-
}
|
|
2346
|
-
function normalizeBindingError(e$1) {
|
|
2347
|
-
return e$1.type === "JsError" ? e$1.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2348
|
-
code: e$1.field0.kind,
|
|
2349
|
-
kind: e$1.field0.kind,
|
|
2350
|
-
message: e$1.field0.message,
|
|
2351
|
-
id: e$1.field0.id,
|
|
2352
|
-
exporter: e$1.field0.exporter,
|
|
2353
|
-
loc: e$1.field0.loc,
|
|
2354
|
-
pos: e$1.field0.pos,
|
|
2355
|
-
stack: void 0
|
|
2356
|
-
});
|
|
2357
|
-
}
|
|
2358
|
-
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2359
|
-
const errors = rawErrors.map(normalizeBindingError);
|
|
2360
|
-
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2361
|
-
for (let i = 0; i < errors.length; i++) {
|
|
2362
|
-
summary += "\n";
|
|
2363
|
-
if (i >= 5) {
|
|
2364
|
-
summary += "...";
|
|
2365
|
-
break;
|
|
2366
|
-
}
|
|
2367
|
-
summary += getErrorMessage(errors[i]);
|
|
2368
|
-
}
|
|
2369
|
-
const wrapper = new Error(summary);
|
|
2370
|
-
Object.defineProperty(wrapper, "errors", {
|
|
2371
|
-
configurable: true,
|
|
2372
|
-
enumerable: true,
|
|
2373
|
-
get: () => errors,
|
|
2374
|
-
set: (value) => Object.defineProperty(wrapper, "errors", {
|
|
2375
|
-
configurable: true,
|
|
2376
|
-
enumerable: true,
|
|
2377
|
-
value
|
|
2378
|
-
})
|
|
2379
|
-
});
|
|
2380
|
-
return wrapper;
|
|
2381
|
-
}
|
|
2382
|
-
function getErrorMessage(e$1) {
|
|
2383
|
-
if (Object.hasOwn(e$1, "kind")) return e$1.message;
|
|
2384
|
-
let s = "";
|
|
2385
|
-
if (e$1.plugin) s += `[plugin ${e$1.plugin}]`;
|
|
2386
|
-
const id$1 = e$1.id ?? e$1.loc?.file;
|
|
2387
|
-
if (id$1) {
|
|
2388
|
-
s += " " + id$1;
|
|
2389
|
-
if (e$1.loc) s += `:${e$1.loc.line}:${e$1.loc.column}`;
|
|
2390
|
-
}
|
|
2391
|
-
if (s) s += "\n";
|
|
2392
|
-
const message = `${e$1.name ?? "Error"}: ${e$1.message}`;
|
|
2393
|
-
s += message;
|
|
2394
|
-
if (e$1.frame) s = joinNewLine(s, e$1.frame);
|
|
2395
|
-
if (e$1.stack) s = joinNewLine(s, e$1.stack.replace(message, ""));
|
|
2396
|
-
if (e$1.cause) {
|
|
2397
|
-
s = joinNewLine(s, "Caused by:");
|
|
2398
|
-
s = joinNewLine(s, getErrorMessage(e$1.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2399
|
-
}
|
|
2400
|
-
return s;
|
|
2401
|
-
}
|
|
2402
|
-
function joinNewLine(s1, s2) {
|
|
2403
|
-
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
2404
|
-
}
|
|
2405
|
-
function transformModuleInfo(info, option) {
|
|
2406
|
-
return {
|
|
2407
|
-
get ast() {
|
|
2408
|
-
return unsupported("ModuleInfo#ast");
|
|
2409
|
-
},
|
|
2410
|
-
get code() {
|
|
2411
|
-
return info.code;
|
|
2412
|
-
},
|
|
2413
|
-
id: info.id,
|
|
2414
|
-
importers: info.importers,
|
|
2415
|
-
dynamicImporters: info.dynamicImporters,
|
|
2416
|
-
importedIds: info.importedIds,
|
|
2417
|
-
dynamicallyImportedIds: info.dynamicallyImportedIds,
|
|
2418
|
-
exports: info.exports,
|
|
2419
|
-
isEntry: info.isEntry,
|
|
2420
|
-
...option
|
|
2421
|
-
};
|
|
2422
|
-
}
|
|
2423
|
-
function isEmptySourcemapFiled(array$1) {
|
|
2424
|
-
if (!array$1) return true;
|
|
2425
|
-
if (array$1.length === 0 || !array$1[0]) return true;
|
|
2426
|
-
return false;
|
|
2427
|
-
}
|
|
2428
|
-
function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
2429
|
-
if (!rawMap) return;
|
|
2430
|
-
let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
|
|
2431
|
-
if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
|
|
2432
|
-
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
|
|
2433
|
-
return map;
|
|
2434
|
-
}
|
|
2435
|
-
var And = class {
|
|
2436
|
-
kind;
|
|
2437
|
-
args;
|
|
2438
|
-
constructor(...args$1) {
|
|
2439
|
-
if (args$1.length === 0) throw new Error("`And` expects at least one operand");
|
|
2440
|
-
this.args = args$1;
|
|
2441
|
-
this.kind = "and";
|
|
2442
|
-
}
|
|
2443
|
-
};
|
|
2444
|
-
var Or = class {
|
|
2445
|
-
kind;
|
|
2446
|
-
args;
|
|
2447
|
-
constructor(...args$1) {
|
|
2448
|
-
if (args$1.length === 0) throw new Error("`Or` expects at least one operand");
|
|
2449
|
-
this.args = args$1;
|
|
2450
|
-
this.kind = "or";
|
|
2451
|
-
}
|
|
2452
|
-
};
|
|
2453
|
-
var Id = class {
|
|
2454
|
-
kind;
|
|
2455
|
-
pattern;
|
|
2456
|
-
params;
|
|
2457
|
-
constructor(pattern, params) {
|
|
2458
|
-
this.pattern = pattern;
|
|
2459
|
-
this.kind = "id";
|
|
2460
|
-
this.params = params ?? { cleanUrl: false };
|
|
2461
|
-
}
|
|
2462
|
-
};
|
|
2463
|
-
var ModuleType = class {
|
|
2464
|
-
kind;
|
|
2465
|
-
pattern;
|
|
2466
|
-
constructor(pattern) {
|
|
2467
|
-
this.pattern = pattern;
|
|
2468
|
-
this.kind = "moduleType";
|
|
2469
|
-
}
|
|
2470
|
-
};
|
|
2471
|
-
var Code = class {
|
|
2472
|
-
kind;
|
|
2473
|
-
pattern;
|
|
2474
|
-
constructor(expr) {
|
|
2475
|
-
this.pattern = expr;
|
|
2476
|
-
this.kind = "code";
|
|
2477
|
-
}
|
|
2478
|
-
};
|
|
2479
|
-
var Include = class {
|
|
2480
|
-
kind;
|
|
2481
|
-
expr;
|
|
2482
|
-
constructor(expr) {
|
|
2483
|
-
this.expr = expr;
|
|
2484
|
-
this.kind = "include";
|
|
2485
|
-
}
|
|
2486
|
-
};
|
|
2487
|
-
var Exclude = class {
|
|
2488
|
-
kind;
|
|
2489
|
-
expr;
|
|
2490
|
-
constructor(expr) {
|
|
2491
|
-
this.expr = expr;
|
|
2492
|
-
this.kind = "exclude";
|
|
2493
|
-
}
|
|
2494
|
-
};
|
|
2495
|
-
function and(...args$1) {
|
|
2496
|
-
return new And(...args$1);
|
|
2497
|
-
}
|
|
2498
|
-
function or(...args$1) {
|
|
2499
|
-
return new Or(...args$1);
|
|
2500
|
-
}
|
|
2501
|
-
function id(pattern, params) {
|
|
2502
|
-
return new Id(pattern, params);
|
|
2503
|
-
}
|
|
2504
|
-
function moduleType(pattern) {
|
|
2505
|
-
return new ModuleType(pattern);
|
|
2506
|
-
}
|
|
2507
|
-
function code(pattern) {
|
|
2508
|
-
return new Code(pattern);
|
|
2509
|
-
}
|
|
2510
|
-
function include(expr) {
|
|
2511
|
-
return new Include(expr);
|
|
2512
|
-
}
|
|
2513
|
-
function exclude(expr) {
|
|
2514
|
-
return new Exclude(expr);
|
|
2515
|
-
}
|
|
2516
|
-
function e(e$1, t$2, n$1) {
|
|
2517
|
-
let r = (n$2) => e$1(n$2, ...t$2);
|
|
2518
|
-
return n$1 === void 0 ? r : Object.assign(r, {
|
|
2519
|
-
lazy: n$1,
|
|
2520
|
-
lazyArgs: t$2
|
|
2521
|
-
});
|
|
2522
|
-
}
|
|
2523
|
-
function t$1(t$2, n$1, r) {
|
|
2524
|
-
let i = t$2.length - n$1.length;
|
|
2525
|
-
if (i === 0) return t$2(...n$1);
|
|
2526
|
-
if (i === 1) return e(t$2, n$1, r);
|
|
2527
|
-
throw Error(`Wrong number of arguments`);
|
|
2528
|
-
}
|
|
2529
|
-
function t(...t$2) {
|
|
2530
|
-
return t$1(n, t$2);
|
|
2531
|
-
}
|
|
2532
|
-
const n = (e$1, t$2) => {
|
|
2533
|
-
let n$1 = [[], []];
|
|
2534
|
-
for (let [r, i] of e$1.entries()) t$2(i, r, e$1) ? n$1[0].push(i) : n$1[1].push(i);
|
|
2535
|
-
return n$1;
|
|
2536
|
-
};
|
|
2537
|
-
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
2538
|
-
if (typeof matcher === "string" || matcher instanceof RegExp) return [include(generateAtomMatcher(stringKind, matcher))];
|
|
2539
|
-
if (Array.isArray(matcher)) return matcher.map((m) => include(generateAtomMatcher(stringKind, m)));
|
|
2540
|
-
let ret = [];
|
|
2541
|
-
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => exclude(generateAtomMatcher(stringKind, m))));
|
|
2542
|
-
if (matcher.include) ret.push(...arraify(matcher.include).map((m) => include(generateAtomMatcher(stringKind, m))));
|
|
2543
|
-
return ret;
|
|
2544
|
-
}
|
|
2545
|
-
function generateAtomMatcher(kind, matcher) {
|
|
2546
|
-
return kind === "code" ? code(matcher) : id(matcher);
|
|
2547
|
-
}
|
|
2548
|
-
function transformFilterMatcherToFilterExprs(filterOption) {
|
|
2549
|
-
if (!filterOption) return;
|
|
2550
|
-
if (Array.isArray(filterOption)) return filterOption;
|
|
2551
|
-
const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
|
|
2552
|
-
let ret = [];
|
|
2553
|
-
let idIncludes = [];
|
|
2554
|
-
let idExcludes = [];
|
|
2555
|
-
let codeIncludes = [];
|
|
2556
|
-
let codeExcludes = [];
|
|
2557
|
-
if (id$1) [idIncludes, idExcludes] = t(generalHookFilterMatcherToFilterExprs(id$1, "id") ?? [], (m) => m.kind === "include");
|
|
2558
|
-
if (code$1) [codeIncludes, codeExcludes] = t(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m) => m.kind === "include");
|
|
2559
|
-
ret.push(...idExcludes);
|
|
2560
|
-
ret.push(...codeExcludes);
|
|
2561
|
-
let andExprList = [];
|
|
2562
|
-
if (moduleType$1) {
|
|
2563
|
-
let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
|
|
2564
|
-
andExprList.push(or(...moduleTypes.map((m) => moduleType(m))));
|
|
2565
|
-
}
|
|
2566
|
-
if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
|
|
2567
|
-
if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
|
|
2568
|
-
if (andExprList.length) ret.push(include(and(...andExprList)));
|
|
2569
|
-
return ret;
|
|
2570
|
-
}
|
|
2571
|
-
function bindingifyGeneralHookFilter(stringKind, pattern) {
|
|
2572
|
-
let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
|
|
2573
|
-
let ret = [];
|
|
2574
|
-
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
2575
|
-
return ret.length > 0 ? { value: ret } : void 0;
|
|
2576
|
-
}
|
|
2577
|
-
function bindingifyFilterExpr(expr) {
|
|
2578
|
-
let list = [];
|
|
2579
|
-
bindingifyFilterExprImpl(expr, list);
|
|
2580
|
-
return list;
|
|
2581
|
-
}
|
|
2582
|
-
function containsImporterId(expr) {
|
|
2583
|
-
switch (expr.kind) {
|
|
2584
|
-
case "and":
|
|
2585
|
-
case "or": return expr.args.some(containsImporterId);
|
|
2586
|
-
case "not":
|
|
2587
|
-
case "include":
|
|
2588
|
-
case "exclude": return containsImporterId(expr.expr);
|
|
2589
|
-
case "importerId": return true;
|
|
2590
|
-
default: return false;
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
function assertNoImporterId(filterExprs, hookName) {
|
|
2594
|
-
if (filterExprs?.some(containsImporterId)) throw new Error(`The \`importerId\` filter can only be used with the \`resolveId\` hook, but it was used with the \`${hookName}\` hook.`);
|
|
2595
|
-
}
|
|
2596
|
-
function bindingifyFilterExprImpl(expr, list) {
|
|
2597
|
-
switch (expr.kind) {
|
|
2598
|
-
case "and": {
|
|
2599
|
-
let args$1 = expr.args;
|
|
2600
|
-
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2601
|
-
list.push({
|
|
2602
|
-
kind: "And",
|
|
2603
|
-
payload: args$1.length
|
|
2604
|
-
});
|
|
2605
|
-
break;
|
|
2606
|
-
}
|
|
2607
|
-
case "or": {
|
|
2608
|
-
let args$1 = expr.args;
|
|
2609
|
-
for (let i = args$1.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args$1[i], list);
|
|
2610
|
-
list.push({
|
|
2611
|
-
kind: "Or",
|
|
2612
|
-
payload: args$1.length
|
|
2613
|
-
});
|
|
2614
|
-
break;
|
|
2615
|
-
}
|
|
2616
|
-
case "not":
|
|
2617
|
-
bindingifyFilterExprImpl(expr.expr, list);
|
|
2618
|
-
list.push({ kind: "Not" });
|
|
2619
|
-
break;
|
|
2620
|
-
case "id":
|
|
2621
|
-
list.push({
|
|
2622
|
-
kind: "Id",
|
|
2623
|
-
payload: expr.pattern
|
|
2624
|
-
});
|
|
2625
|
-
if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
|
|
2626
|
-
break;
|
|
2627
|
-
case "importerId":
|
|
2628
|
-
list.push({
|
|
2629
|
-
kind: "ImporterId",
|
|
2630
|
-
payload: expr.pattern
|
|
2631
|
-
});
|
|
2632
|
-
if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
|
|
2633
|
-
break;
|
|
2634
|
-
case "moduleType":
|
|
2635
|
-
list.push({
|
|
2636
|
-
kind: "ModuleType",
|
|
2637
|
-
payload: expr.pattern
|
|
2638
|
-
});
|
|
2639
|
-
break;
|
|
2640
|
-
case "code":
|
|
2641
|
-
list.push({
|
|
2642
|
-
kind: "Code",
|
|
2643
|
-
payload: expr.pattern
|
|
2644
|
-
});
|
|
2645
|
-
break;
|
|
2646
|
-
case "include":
|
|
2647
|
-
bindingifyFilterExprImpl(expr.expr, list);
|
|
2648
|
-
list.push({ kind: "Include" });
|
|
2649
|
-
break;
|
|
2650
|
-
case "exclude":
|
|
2651
|
-
bindingifyFilterExprImpl(expr.expr, list);
|
|
2652
|
-
list.push({ kind: "Exclude" });
|
|
2653
|
-
break;
|
|
2654
|
-
case "query":
|
|
2655
|
-
list.push({
|
|
2656
|
-
kind: "QueryKey",
|
|
2657
|
-
payload: expr.key
|
|
2658
|
-
});
|
|
2659
|
-
list.push({
|
|
2660
|
-
kind: "QueryValue",
|
|
2661
|
-
payload: expr.pattern
|
|
2662
|
-
});
|
|
2663
|
-
break;
|
|
2664
|
-
default: throw new Error(`Unknown filter expression: ${expr}`);
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
function bindingifyResolveIdFilter(filterOption) {
|
|
2668
|
-
if (!filterOption) return;
|
|
2669
|
-
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2670
|
-
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2671
|
-
}
|
|
2672
|
-
function bindingifyLoadFilter(filterOption) {
|
|
2673
|
-
if (!filterOption) return;
|
|
2674
|
-
if (Array.isArray(filterOption)) {
|
|
2675
|
-
assertNoImporterId(filterOption, "load");
|
|
2676
|
-
return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2677
|
-
}
|
|
2678
|
-
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2679
|
-
}
|
|
2680
|
-
function bindingifyTransformFilter(filterOption) {
|
|
2681
|
-
if (!filterOption) return;
|
|
2682
|
-
let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
|
|
2683
|
-
assertNoImporterId(filterExprs, "transform");
|
|
2684
|
-
let ret = [];
|
|
2685
|
-
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
2686
|
-
return { value: ret.length > 0 ? ret : void 0 };
|
|
2687
|
-
}
|
|
2688
|
-
function bindingifyRenderChunkFilter(filterOption) {
|
|
2689
|
-
if (!filterOption) return;
|
|
2690
|
-
if (Array.isArray(filterOption)) {
|
|
2691
|
-
assertNoImporterId(filterOption, "renderChunk");
|
|
2692
|
-
return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2693
|
-
}
|
|
2694
|
-
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
2695
|
-
}
|
|
2696
|
-
function bindingifyPluginHookMeta(options) {
|
|
2697
|
-
return { order: bindingPluginOrder(options.order) };
|
|
2698
|
-
}
|
|
2699
|
-
function bindingPluginOrder(order) {
|
|
2700
|
-
switch (order) {
|
|
2701
|
-
case "post": return BindingPluginOrder.Post;
|
|
2702
|
-
case "pre": return BindingPluginOrder.Pre;
|
|
2703
|
-
case null:
|
|
2704
|
-
case void 0: return;
|
|
2705
|
-
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
2706
|
-
}
|
|
2707
|
-
}
|
|
2708
|
-
const fsModule = {
|
|
2709
|
-
appendFile: throwNoFileSystemError("fs.appendFile"),
|
|
2710
|
-
copyFile: throwNoFileSystemError("fs.copyFile"),
|
|
2711
|
-
mkdir: throwNoFileSystemError("fs.mkdir"),
|
|
2712
|
-
mkdtemp: throwNoFileSystemError("fs.mkdtemp"),
|
|
2713
|
-
readdir: throwNoFileSystemError("fs.readdir"),
|
|
2714
|
-
readFile: throwNoFileSystemError("fs.readFile"),
|
|
2715
|
-
realpath: throwNoFileSystemError("fs.realpath"),
|
|
2716
|
-
rename: throwNoFileSystemError("fs.rename"),
|
|
2717
|
-
rmdir: throwNoFileSystemError("fs.rmdir"),
|
|
2718
|
-
stat: throwNoFileSystemError("fs.stat"),
|
|
2719
|
-
lstat: throwNoFileSystemError("fs.lstat"),
|
|
2720
|
-
unlink: throwNoFileSystemError("fs.unlink"),
|
|
2721
|
-
writeFile: throwNoFileSystemError("fs.writeFile")
|
|
2722
|
-
};
|
|
2723
|
-
function throwNoFileSystemError(method) {
|
|
2724
|
-
return () => {
|
|
2725
|
-
error(logNoFileSystemInBrowser(method));
|
|
2726
|
-
};
|
|
2727
|
-
}
|
|
2728
|
-
var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
2729
|
-
fs = fsModule;
|
|
2730
|
-
getModuleInfo;
|
|
2731
|
-
constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
|
|
2732
|
-
super(onLog, logLevel, plugin.name, watchMode);
|
|
2733
|
-
this.outputOptions = outputOptions;
|
|
2734
|
-
this.context = context;
|
|
2735
|
-
this.data = data;
|
|
2736
|
-
this.onLog = onLog;
|
|
2737
|
-
this.currentLoadingModule = currentLoadingModule;
|
|
2738
|
-
this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
|
|
2739
|
-
}
|
|
2740
|
-
async load(options) {
|
|
2741
|
-
const id$1 = options.id;
|
|
2742
|
-
if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
2743
|
-
const moduleInfo = this.data.getModuleInfo(id$1, this.context);
|
|
2744
|
-
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
2745
|
-
const rawOptions = {
|
|
2746
|
-
meta: options.meta || {},
|
|
2747
|
-
moduleSideEffects: options.moduleSideEffects || null,
|
|
2748
|
-
invalidate: false
|
|
2749
|
-
};
|
|
2750
|
-
this.data.updateModuleOption(id$1, rawOptions);
|
|
2751
|
-
let loadPromise = this.data.loadModulePromiseMap.get(id$1);
|
|
2752
|
-
if (!loadPromise) {
|
|
2753
|
-
loadPromise = this.context.load(id$1, options.moduleSideEffects ?? void 0, options.packageJsonPath ?? void 0).catch(() => {
|
|
2754
|
-
this.data.loadModulePromiseMap.delete(id$1);
|
|
2755
|
-
});
|
|
2756
|
-
this.data.loadModulePromiseMap.set(id$1, loadPromise);
|
|
2757
|
-
}
|
|
2758
|
-
await loadPromise;
|
|
2759
|
-
return this.data.getModuleInfo(id$1, this.context);
|
|
2760
|
-
}
|
|
2761
|
-
async resolve(source, importer, options) {
|
|
2762
|
-
let receipt = void 0;
|
|
2763
|
-
if (options != null) receipt = this.data.saveResolveOptions(options);
|
|
2764
|
-
const vitePluginCustom = Object.entries(options?.custom ?? {}).reduce((acc, [key, value]) => {
|
|
2765
|
-
if (key.startsWith("vite:")) (acc ??= {})[key] = value;
|
|
2766
|
-
return acc;
|
|
2767
|
-
}, void 0);
|
|
2768
|
-
const res = await this.context.resolve(source, importer, {
|
|
2769
|
-
custom: receipt,
|
|
2770
|
-
isEntry: options?.isEntry,
|
|
2771
|
-
skipSelf: options?.skipSelf,
|
|
2772
|
-
vitePluginCustom
|
|
2773
|
-
});
|
|
2774
|
-
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
|
2775
|
-
if (res == null) return null;
|
|
2776
|
-
const info = this.data.getModuleOption(res.id) || {};
|
|
2777
|
-
return {
|
|
2778
|
-
...res,
|
|
2779
|
-
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2780
|
-
...info,
|
|
2781
|
-
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null,
|
|
2782
|
-
packageJsonPath: res.packageJsonPath
|
|
2783
|
-
};
|
|
2784
|
-
}
|
|
2785
|
-
emitFile = (file) => {
|
|
2786
|
-
if (file.type === "prebuilt-chunk") return this.context.emitPrebuiltChunk({
|
|
2787
|
-
fileName: file.fileName,
|
|
2788
|
-
code: file.code,
|
|
2789
|
-
exports: file.exports,
|
|
2790
|
-
map: bindingifySourcemap$1(file.map),
|
|
2791
|
-
sourcemapFileName: file.sourcemapFileName
|
|
2792
|
-
});
|
|
2793
|
-
if (file.type === "chunk") return this.context.emitChunk({
|
|
2794
|
-
preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
|
|
2795
|
-
...file
|
|
2796
|
-
});
|
|
2797
|
-
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
|
2798
|
-
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
|
2799
|
-
return this.context.emitFile({
|
|
2800
|
-
...file,
|
|
2801
|
-
originalFileName: file.originalFileName || void 0,
|
|
2802
|
-
source: bindingAssetSource(file.source)
|
|
2803
|
-
}, filename, fnSanitizedFileName);
|
|
2804
|
-
};
|
|
2805
|
-
getAssetFileNames(file) {
|
|
2806
|
-
if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
|
|
2807
|
-
type: "asset",
|
|
2808
|
-
name: file.name,
|
|
2809
|
-
names: file.name ? [file.name] : [],
|
|
2810
|
-
originalFileName: file.originalFileName,
|
|
2811
|
-
originalFileNames: file.originalFileName ? [file.originalFileName] : [],
|
|
2812
|
-
source: file.source
|
|
2813
|
-
});
|
|
2814
|
-
}
|
|
2815
|
-
getFileName(referenceId) {
|
|
2816
|
-
return this.context.getFileName(referenceId);
|
|
2817
|
-
}
|
|
2818
|
-
getModuleIds() {
|
|
2819
|
-
return this.data.getModuleIds(this.context);
|
|
2820
|
-
}
|
|
2821
|
-
addWatchFile(id$1) {
|
|
2822
|
-
this.context.addWatchFile(id$1);
|
|
2823
|
-
}
|
|
2824
|
-
parse(input, options) {
|
|
2825
|
-
return parseAst(input, options);
|
|
2826
|
-
}
|
|
2827
|
-
};
|
|
2828
|
-
var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
2829
|
-
constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
|
|
2830
|
-
super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
|
|
2831
|
-
this.inner = inner;
|
|
2832
|
-
this.moduleId = moduleId;
|
|
2833
|
-
this.moduleSource = moduleSource;
|
|
2834
|
-
const getLogHandler = (handler) => (log, pos) => {
|
|
2835
|
-
log = normalizeLog(log);
|
|
2836
|
-
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
2837
|
-
log.id = moduleId;
|
|
2838
|
-
log.hook = "transform";
|
|
2839
|
-
handler(log);
|
|
2840
|
-
};
|
|
2841
|
-
this.debug = getLogHandler(this.debug);
|
|
2842
|
-
this.warn = getLogHandler(this.warn);
|
|
2843
|
-
this.info = getLogHandler(this.info);
|
|
2844
|
-
}
|
|
2845
|
-
error(e$1, pos) {
|
|
2846
|
-
if (typeof e$1 === "string") e$1 = { message: e$1 };
|
|
2847
|
-
if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
|
|
2848
|
-
e$1.id = this.moduleId;
|
|
2849
|
-
e$1.hook = "transform";
|
|
2850
|
-
return error(logPluginError(normalizeLog(e$1), this.pluginName));
|
|
2851
|
-
}
|
|
2852
|
-
getCombinedSourcemap() {
|
|
2853
|
-
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
2854
|
-
}
|
|
2855
|
-
addWatchFile(id$1) {
|
|
2856
|
-
this.inner.addWatchFile(id$1);
|
|
2857
|
-
}
|
|
2858
|
-
sendMagicString(s) {
|
|
2859
|
-
this.inner.sendMagicString(s);
|
|
2860
|
-
}
|
|
2861
|
-
};
|
|
2862
|
-
function bindingifyBuildStart(args$1) {
|
|
2863
|
-
const hook = args$1.plugin.buildStart;
|
|
2864
|
-
if (!hook) return {};
|
|
2865
|
-
const { handler, meta } = normalizeHook(hook);
|
|
2866
|
-
return {
|
|
2867
|
-
plugin: async (ctx, opts) => {
|
|
2868
|
-
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), args$1.pluginContextData.getInputOptions(opts));
|
|
2869
|
-
},
|
|
2870
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2871
|
-
};
|
|
2872
|
-
}
|
|
2873
|
-
function bindingifyBuildEnd(args$1) {
|
|
2874
|
-
const hook = args$1.plugin.buildEnd;
|
|
2875
|
-
if (!hook) return {};
|
|
2876
|
-
const { handler, meta } = normalizeHook(hook);
|
|
2877
|
-
return {
|
|
2878
|
-
plugin: async (ctx, err) => {
|
|
2879
|
-
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
|
|
2880
|
-
},
|
|
2881
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2882
|
-
};
|
|
2883
|
-
}
|
|
2884
|
-
function bindingifyResolveId(args$1) {
|
|
2885
|
-
const hook = args$1.plugin.resolveId;
|
|
2886
|
-
if (!hook) return {};
|
|
2887
|
-
const { handler, meta, options } = normalizeHook(hook);
|
|
2888
|
-
return {
|
|
2889
|
-
plugin: async (ctx, specifier, importer, extraOptions) => {
|
|
2890
|
-
const contextResolveOptions = extraOptions.custom != null ? args$1.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
|
|
2891
|
-
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), specifier, importer ?? void 0, {
|
|
2892
|
-
...extraOptions,
|
|
2893
|
-
custom: contextResolveOptions?.custom
|
|
2894
|
-
});
|
|
2895
|
-
if (ret == null) return;
|
|
2896
|
-
if (ret === false) return {
|
|
2897
|
-
id: specifier,
|
|
2898
|
-
external: true,
|
|
2899
|
-
normalizeExternalId: true
|
|
2900
|
-
};
|
|
2901
|
-
if (typeof ret === "string") return {
|
|
2902
|
-
id: ret,
|
|
2903
|
-
normalizeExternalId: false
|
|
2904
|
-
};
|
|
2905
|
-
let exist = args$1.pluginContextData.updateModuleOption(ret.id, {
|
|
2906
|
-
meta: ret.meta || {},
|
|
2907
|
-
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
2908
|
-
invalidate: false
|
|
2909
|
-
});
|
|
2910
|
-
return {
|
|
2911
|
-
id: ret.id,
|
|
2912
|
-
external: ret.external,
|
|
2913
|
-
normalizeExternalId: false,
|
|
2914
|
-
moduleSideEffects: exist.moduleSideEffects ?? void 0,
|
|
2915
|
-
packageJsonPath: ret.packageJsonPath
|
|
2916
|
-
};
|
|
2917
|
-
},
|
|
2918
|
-
meta: bindingifyPluginHookMeta(meta),
|
|
2919
|
-
filter: bindingifyResolveIdFilter(options.filter)
|
|
2920
|
-
};
|
|
2921
|
-
}
|
|
2922
|
-
function bindingifyResolveDynamicImport(args$1) {
|
|
2923
|
-
const hook = args$1.plugin.resolveDynamicImport;
|
|
2924
|
-
if (!hook) return {};
|
|
2925
|
-
const { handler, meta } = normalizeHook(hook);
|
|
2926
|
-
return {
|
|
2927
|
-
plugin: async (ctx, specifier, importer) => {
|
|
2928
|
-
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), specifier, importer ?? void 0);
|
|
2929
|
-
if (ret == null) return;
|
|
2930
|
-
if (ret === false) return {
|
|
2931
|
-
id: specifier,
|
|
2932
|
-
external: true
|
|
2933
|
-
};
|
|
2934
|
-
if (typeof ret === "string") return { id: ret };
|
|
2935
|
-
const result = {
|
|
2936
|
-
id: ret.id,
|
|
2937
|
-
external: ret.external,
|
|
2938
|
-
packageJsonPath: ret.packageJsonPath
|
|
2939
|
-
};
|
|
2940
|
-
if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
|
|
2941
|
-
args$1.pluginContextData.updateModuleOption(ret.id, {
|
|
2942
|
-
meta: ret.meta || {},
|
|
2943
|
-
moduleSideEffects: ret.moduleSideEffects || null,
|
|
2944
|
-
invalidate: false
|
|
2945
|
-
});
|
|
2946
|
-
return result;
|
|
2947
|
-
},
|
|
2948
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2949
|
-
};
|
|
2950
|
-
}
|
|
2951
|
-
function bindingifyTransform(args$1) {
|
|
2952
|
-
const hook = args$1.plugin.transform;
|
|
2953
|
-
if (!hook) return {};
|
|
2954
|
-
const { handler, meta, options } = normalizeHook(hook);
|
|
2955
|
-
return {
|
|
2956
|
-
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
2957
|
-
let magicStringInstance, astInstance;
|
|
2958
|
-
Object.defineProperties(meta$1, {
|
|
2959
|
-
magicString: { get() {
|
|
2960
|
-
if (magicStringInstance) return magicStringInstance;
|
|
2961
|
-
magicStringInstance = new BindingMagicString(code$1);
|
|
2962
|
-
return magicStringInstance;
|
|
2963
|
-
} },
|
|
2964
|
-
ast: { get() {
|
|
2965
|
-
if (astInstance) return astInstance;
|
|
2966
|
-
let lang = "js";
|
|
2967
|
-
switch (meta$1.moduleType) {
|
|
2968
|
-
case "js":
|
|
2969
|
-
case "jsx":
|
|
2970
|
-
case "ts":
|
|
2971
|
-
case "tsx":
|
|
2972
|
-
lang = meta$1.moduleType;
|
|
2973
|
-
break;
|
|
2974
|
-
default: break;
|
|
2975
|
-
}
|
|
2976
|
-
astInstance = parseAst(code$1, {
|
|
2977
|
-
astType: meta$1.moduleType.includes("ts") ? "ts" : "js",
|
|
2978
|
-
lang
|
|
2979
|
-
});
|
|
2980
|
-
return astInstance;
|
|
2981
|
-
} }
|
|
2982
|
-
});
|
|
2983
|
-
const transformCtx = new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
2984
|
-
const ret = await handler.call(transformCtx, code$1, id$1, meta$1);
|
|
2985
|
-
if (ret == null) return;
|
|
2986
|
-
if (typeof ret === "string") return { code: ret };
|
|
2987
|
-
let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
|
|
2988
|
-
meta: ret.meta ?? {},
|
|
2989
|
-
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
2990
|
-
invalidate: false
|
|
2991
|
-
});
|
|
2992
|
-
let normalizedCode = void 0;
|
|
2993
|
-
let map = ret.map;
|
|
2994
|
-
if (typeof ret.code === "string") normalizedCode = ret.code;
|
|
2995
|
-
else if (ret.code instanceof BindingMagicString) {
|
|
2996
|
-
let magicString = ret.code;
|
|
2997
|
-
normalizedCode = magicString.toString();
|
|
2998
|
-
let fallbackSourcemap = ctx.sendMagicString(magicString);
|
|
2999
|
-
if (fallbackSourcemap != void 0) map = fallbackSourcemap;
|
|
3000
|
-
}
|
|
3001
|
-
return {
|
|
3002
|
-
code: normalizedCode,
|
|
3003
|
-
map: bindingifySourcemap$1(normalizeTransformHookSourcemap(id$1, code$1, map)),
|
|
3004
|
-
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
|
|
3005
|
-
moduleType: ret.moduleType
|
|
3006
|
-
};
|
|
3007
|
-
},
|
|
3008
|
-
meta: bindingifyPluginHookMeta(meta),
|
|
3009
|
-
filter: bindingifyTransformFilter(options.filter)
|
|
3010
|
-
};
|
|
3011
|
-
}
|
|
3012
|
-
function bindingifyLoad(args$1) {
|
|
3013
|
-
const hook = args$1.plugin.load;
|
|
3014
|
-
if (!hook) return {};
|
|
3015
|
-
const { handler, meta, options } = normalizeHook(hook);
|
|
3016
|
-
return {
|
|
3017
|
-
plugin: async (ctx, id$1) => {
|
|
3018
|
-
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode, id$1), id$1);
|
|
3019
|
-
if (ret == null) return;
|
|
3020
|
-
if (typeof ret === "string") return { code: ret };
|
|
3021
|
-
let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
|
|
3022
|
-
meta: ret.meta || {},
|
|
3023
|
-
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
3024
|
-
invalidate: false
|
|
3025
|
-
});
|
|
3026
|
-
let map = preProcessSourceMap(ret, id$1);
|
|
3027
|
-
return {
|
|
3028
|
-
code: ret.code,
|
|
3029
|
-
map: bindingifySourcemap$1(map),
|
|
3030
|
-
moduleType: ret.moduleType,
|
|
3031
|
-
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0
|
|
3032
|
-
};
|
|
3033
|
-
},
|
|
3034
|
-
meta: bindingifyPluginHookMeta(meta),
|
|
3035
|
-
filter: bindingifyLoadFilter(options.filter)
|
|
3036
|
-
};
|
|
3037
|
-
}
|
|
3038
|
-
function preProcessSourceMap(ret, id$1) {
|
|
3039
|
-
if (!ret.map) return;
|
|
3040
|
-
let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
|
|
3041
|
-
if (!isEmptySourcemapFiled(map.sources)) {
|
|
3042
|
-
const directory = posix.dirname(id$1) || ".";
|
|
3043
|
-
const sourceRoot = map.sourceRoot || ".";
|
|
3044
|
-
map.sources = map.sources.map((source) => posix.resolve(directory, sourceRoot, source));
|
|
3045
|
-
}
|
|
3046
|
-
return map;
|
|
3047
|
-
}
|
|
3048
|
-
function bindingifyModuleParsed(args$1) {
|
|
3049
|
-
const hook = args$1.plugin.moduleParsed;
|
|
3050
|
-
if (!hook) return {};
|
|
3051
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3052
|
-
return {
|
|
3053
|
-
plugin: async (ctx, moduleInfo) => {
|
|
3054
|
-
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformModuleInfo(moduleInfo, args$1.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
3055
|
-
},
|
|
3056
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3057
|
-
};
|
|
3058
|
-
}
|
|
3059
|
-
function bindingifyRenderStart(args$1) {
|
|
3060
|
-
const hook = args$1.plugin.renderStart;
|
|
3061
|
-
if (!hook) return {};
|
|
3062
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3063
|
-
return {
|
|
3064
|
-
plugin: async (ctx, opts) => {
|
|
3065
|
-
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), args$1.pluginContextData.getOutputOptions(opts), args$1.pluginContextData.getInputOptions(opts));
|
|
3066
|
-
},
|
|
3067
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3068
|
-
};
|
|
3069
|
-
}
|
|
3070
|
-
function bindingifyRenderChunk(args$1) {
|
|
3071
|
-
const hook = args$1.plugin.renderChunk;
|
|
3072
|
-
if (!hook) return {};
|
|
3073
|
-
const { handler, meta, options } = normalizeHook(hook);
|
|
3074
|
-
return {
|
|
3075
|
-
plugin: async (ctx, code$1, chunk, opts, meta$1) => {
|
|
3076
|
-
if (args$1.pluginContextData.getRenderChunkMeta() == null) args$1.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
|
3077
|
-
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, transformRenderedChunk(chunk), args$1.pluginContextData.getOutputOptions(opts), args$1.pluginContextData.getRenderChunkMeta());
|
|
3078
|
-
if (ret == null) return;
|
|
3079
|
-
if (typeof ret === "string") return { code: ret };
|
|
3080
|
-
if (!ret.map) return { code: ret.code };
|
|
3081
|
-
return {
|
|
3082
|
-
code: ret.code,
|
|
3083
|
-
map: bindingifySourcemap$1(ret.map)
|
|
3084
|
-
};
|
|
3085
|
-
},
|
|
3086
|
-
meta: bindingifyPluginHookMeta(meta),
|
|
3087
|
-
filter: bindingifyRenderChunkFilter(options.filter)
|
|
3088
|
-
};
|
|
3089
|
-
}
|
|
3090
|
-
function bindingifyAugmentChunkHash(args$1) {
|
|
3091
|
-
const hook = args$1.plugin.augmentChunkHash;
|
|
3092
|
-
if (!hook) return {};
|
|
3093
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3094
|
-
return {
|
|
3095
|
-
plugin: async (ctx, chunk) => {
|
|
3096
|
-
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3097
|
-
},
|
|
3098
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3099
|
-
};
|
|
3100
|
-
}
|
|
3101
|
-
function bindingifyRenderError(args$1) {
|
|
3102
|
-
const hook = args$1.plugin.renderError;
|
|
3103
|
-
if (!hook) return {};
|
|
3104
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3105
|
-
return {
|
|
3106
|
-
plugin: async (ctx, err) => {
|
|
3107
|
-
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), aggregateBindingErrorsIntoJsError(err));
|
|
3108
|
-
},
|
|
3109
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3110
|
-
};
|
|
3111
|
-
}
|
|
3112
|
-
function bindingifyGenerateBundle(args$1) {
|
|
3113
|
-
const hook = args$1.plugin.generateBundle;
|
|
3114
|
-
if (!hook) return {};
|
|
3115
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3116
|
-
return {
|
|
3117
|
-
plugin: async (ctx, bundle, isWrite, opts) => {
|
|
3118
|
-
const changed = {
|
|
3119
|
-
updated: /* @__PURE__ */ new Set(),
|
|
3120
|
-
deleted: /* @__PURE__ */ new Set()
|
|
3121
|
-
};
|
|
3122
|
-
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3123
|
-
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
3124
|
-
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output, isWrite);
|
|
3125
|
-
return collectChangedBundle(changed, output);
|
|
3126
|
-
},
|
|
3127
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3128
|
-
};
|
|
3129
|
-
}
|
|
3130
|
-
function bindingifyWriteBundle(args$1) {
|
|
3131
|
-
const hook = args$1.plugin.writeBundle;
|
|
3132
|
-
if (!hook) return {};
|
|
3133
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3134
|
-
return {
|
|
3135
|
-
plugin: async (ctx, bundle, opts) => {
|
|
3136
|
-
const changed = {
|
|
3137
|
-
updated: /* @__PURE__ */ new Set(),
|
|
3138
|
-
deleted: /* @__PURE__ */ new Set()
|
|
3139
|
-
};
|
|
3140
|
-
const context = new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
3141
|
-
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
3142
|
-
await handler.call(context, args$1.pluginContextData.getOutputOptions(opts), output);
|
|
3143
|
-
return collectChangedBundle(changed, output);
|
|
3144
|
-
},
|
|
3145
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3146
|
-
};
|
|
3147
|
-
}
|
|
3148
|
-
function bindingifyCloseBundle(args$1) {
|
|
3149
|
-
const hook = args$1.plugin.closeBundle;
|
|
3150
|
-
if (!hook) return {};
|
|
3151
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3152
|
-
return {
|
|
3153
|
-
plugin: async (ctx) => {
|
|
3154
|
-
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
|
|
3155
|
-
},
|
|
3156
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3157
|
-
};
|
|
3158
|
-
}
|
|
3159
|
-
function bindingifyBanner(args$1) {
|
|
3160
|
-
const hook = args$1.plugin.banner;
|
|
3161
|
-
if (!hook) return {};
|
|
3162
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3163
|
-
return {
|
|
3164
|
-
plugin: async (ctx, chunk) => {
|
|
3165
|
-
if (typeof handler === "string") return handler;
|
|
3166
|
-
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3167
|
-
},
|
|
3168
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3169
|
-
};
|
|
3170
|
-
}
|
|
3171
|
-
function bindingifyFooter(args$1) {
|
|
3172
|
-
const hook = args$1.plugin.footer;
|
|
3173
|
-
if (!hook) return {};
|
|
3174
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3175
|
-
return {
|
|
3176
|
-
plugin: async (ctx, chunk) => {
|
|
3177
|
-
if (typeof handler === "string") return handler;
|
|
3178
|
-
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3179
|
-
},
|
|
3180
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3181
|
-
};
|
|
3182
|
-
}
|
|
3183
|
-
function bindingifyIntro(args$1) {
|
|
3184
|
-
const hook = args$1.plugin.intro;
|
|
3185
|
-
if (!hook) return {};
|
|
3186
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3187
|
-
return {
|
|
3188
|
-
plugin: async (ctx, chunk) => {
|
|
3189
|
-
if (typeof handler === "string") return handler;
|
|
3190
|
-
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3191
|
-
},
|
|
3192
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3193
|
-
};
|
|
3194
|
-
}
|
|
3195
|
-
function bindingifyOutro(args$1) {
|
|
3196
|
-
const hook = args$1.plugin.outro;
|
|
3197
|
-
if (!hook) return {};
|
|
3198
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3199
|
-
return {
|
|
3200
|
-
plugin: async (ctx, chunk) => {
|
|
3201
|
-
if (typeof handler === "string") return handler;
|
|
3202
|
-
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3203
|
-
},
|
|
3204
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3205
|
-
};
|
|
3206
|
-
}
|
|
3207
|
-
function bindingifyWatchChange(args$1) {
|
|
3208
|
-
const hook = args$1.plugin.watchChange;
|
|
3209
|
-
if (!hook) return {};
|
|
3210
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3211
|
-
return {
|
|
3212
|
-
plugin: async (ctx, id$1, event) => {
|
|
3213
|
-
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), id$1, { event });
|
|
3214
|
-
},
|
|
3215
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3216
|
-
};
|
|
3217
|
-
}
|
|
3218
|
-
function bindingifyCloseWatcher(args$1) {
|
|
3219
|
-
const hook = args$1.plugin.closeWatcher;
|
|
3220
|
-
if (!hook) return {};
|
|
3221
|
-
const { handler, meta } = normalizeHook(hook);
|
|
3222
|
-
return {
|
|
3223
|
-
plugin: async (ctx) => {
|
|
3224
|
-
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
|
|
3225
|
-
},
|
|
3226
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
3227
|
-
};
|
|
3228
|
-
}
|
|
3229
|
-
let HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
3230
|
-
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
3231
|
-
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
3232
|
-
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
3233
|
-
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
3234
|
-
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
3235
|
-
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
3236
|
-
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
3237
|
-
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
3238
|
-
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
3239
|
-
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
3240
|
-
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
3241
|
-
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
3242
|
-
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
3243
|
-
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
3244
|
-
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
3245
|
-
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
3246
|
-
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
3247
|
-
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
3248
|
-
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
3249
|
-
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
3250
|
-
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
3251
|
-
return HookUsageKind$1;
|
|
3252
|
-
}({});
|
|
3253
|
-
var HookUsage = class {
|
|
3254
|
-
bitflag = BigInt(0);
|
|
3255
|
-
constructor() {}
|
|
3256
|
-
union(kind) {
|
|
3257
|
-
this.bitflag |= BigInt(kind);
|
|
3258
|
-
}
|
|
3259
|
-
inner() {
|
|
3260
|
-
return Number(this.bitflag);
|
|
3261
|
-
}
|
|
3262
|
-
};
|
|
3263
|
-
function extractHookUsage(plugin) {
|
|
3264
|
-
let hookUsage = new HookUsage();
|
|
3265
|
-
if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
|
|
3266
|
-
if (plugin.resolveId) hookUsage.union(HookUsageKind.resolveId);
|
|
3267
|
-
if (plugin.resolveDynamicImport) hookUsage.union(HookUsageKind.resolveDynamicImport);
|
|
3268
|
-
if (plugin.load) hookUsage.union(HookUsageKind.load);
|
|
3269
|
-
if (plugin.transform) hookUsage.union(HookUsageKind.transform);
|
|
3270
|
-
if (plugin.moduleParsed) hookUsage.union(HookUsageKind.moduleParsed);
|
|
3271
|
-
if (plugin.buildEnd) hookUsage.union(HookUsageKind.buildEnd);
|
|
3272
|
-
if (plugin.renderStart) hookUsage.union(HookUsageKind.renderStart);
|
|
3273
|
-
if (plugin.renderError) hookUsage.union(HookUsageKind.renderError);
|
|
3274
|
-
if (plugin.renderChunk) hookUsage.union(HookUsageKind.renderChunk);
|
|
3275
|
-
if (plugin.augmentChunkHash) hookUsage.union(HookUsageKind.augmentChunkHash);
|
|
3276
|
-
if (plugin.generateBundle) hookUsage.union(HookUsageKind.generateBundle);
|
|
3277
|
-
if (plugin.writeBundle) hookUsage.union(HookUsageKind.writeBundle);
|
|
3278
|
-
if (plugin.closeBundle) hookUsage.union(HookUsageKind.closeBundle);
|
|
3279
|
-
if (plugin.watchChange) hookUsage.union(HookUsageKind.watchChange);
|
|
3280
|
-
if (plugin.closeWatcher) hookUsage.union(HookUsageKind.closeWatcher);
|
|
3281
|
-
if (plugin.banner) hookUsage.union(HookUsageKind.banner);
|
|
3282
|
-
if (plugin.footer) hookUsage.union(HookUsageKind.footer);
|
|
3283
|
-
if (plugin.intro) hookUsage.union(HookUsageKind.intro);
|
|
3284
|
-
if (plugin.outro) hookUsage.union(HookUsageKind.outro);
|
|
3285
|
-
return hookUsage;
|
|
3286
|
-
}
|
|
3287
|
-
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
3288
|
-
const args$1 = {
|
|
3289
|
-
plugin,
|
|
3290
|
-
options,
|
|
3291
|
-
outputOptions,
|
|
3292
|
-
pluginContextData,
|
|
3293
|
-
onLog,
|
|
3294
|
-
logLevel,
|
|
3295
|
-
watchMode,
|
|
3296
|
-
normalizedOutputPlugins
|
|
3297
|
-
};
|
|
3298
|
-
const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args$1);
|
|
3299
|
-
const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args$1);
|
|
3300
|
-
const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args$1);
|
|
3301
|
-
const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args$1);
|
|
3302
|
-
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args$1);
|
|
3303
|
-
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args$1);
|
|
3304
|
-
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args$1);
|
|
3305
|
-
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args$1);
|
|
3306
|
-
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args$1);
|
|
3307
|
-
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args$1);
|
|
3308
|
-
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args$1);
|
|
3309
|
-
const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args$1);
|
|
3310
|
-
const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args$1);
|
|
3311
|
-
const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args$1);
|
|
3312
|
-
const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args$1);
|
|
3313
|
-
const { plugin: footer, meta: footerMeta } = bindingifyFooter(args$1);
|
|
3314
|
-
const { plugin: intro, meta: introMeta } = bindingifyIntro(args$1);
|
|
3315
|
-
const { plugin: outro, meta: outroMeta } = bindingifyOutro(args$1);
|
|
3316
|
-
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
|
|
3317
|
-
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
|
|
3318
|
-
let hookUsage = extractHookUsage(plugin).inner();
|
|
3319
|
-
return wrapHandlers({
|
|
3320
|
-
name: plugin.name,
|
|
3321
|
-
buildStart,
|
|
3322
|
-
buildStartMeta,
|
|
3323
|
-
resolveId,
|
|
3324
|
-
resolveIdMeta,
|
|
3325
|
-
resolveIdFilter,
|
|
3326
|
-
resolveDynamicImport,
|
|
3327
|
-
resolveDynamicImportMeta,
|
|
3328
|
-
buildEnd,
|
|
3329
|
-
buildEndMeta,
|
|
3330
|
-
transform,
|
|
3331
|
-
transformMeta,
|
|
3332
|
-
transformFilter,
|
|
3333
|
-
moduleParsed,
|
|
3334
|
-
moduleParsedMeta,
|
|
3335
|
-
load,
|
|
3336
|
-
loadMeta,
|
|
3337
|
-
loadFilter,
|
|
3338
|
-
renderChunk,
|
|
3339
|
-
renderChunkMeta,
|
|
3340
|
-
renderChunkFilter,
|
|
3341
|
-
augmentChunkHash,
|
|
3342
|
-
augmentChunkHashMeta,
|
|
3343
|
-
renderStart,
|
|
3344
|
-
renderStartMeta,
|
|
3345
|
-
renderError,
|
|
3346
|
-
renderErrorMeta,
|
|
3347
|
-
generateBundle,
|
|
3348
|
-
generateBundleMeta,
|
|
3349
|
-
writeBundle,
|
|
3350
|
-
writeBundleMeta,
|
|
3351
|
-
closeBundle,
|
|
3352
|
-
closeBundleMeta,
|
|
3353
|
-
banner,
|
|
3354
|
-
bannerMeta,
|
|
3355
|
-
footer,
|
|
3356
|
-
footerMeta,
|
|
3357
|
-
intro,
|
|
3358
|
-
introMeta,
|
|
3359
|
-
outro,
|
|
3360
|
-
outroMeta,
|
|
3361
|
-
watchChange,
|
|
3362
|
-
watchChangeMeta,
|
|
3363
|
-
closeWatcher,
|
|
3364
|
-
closeWatcherMeta,
|
|
3365
|
-
hookUsage
|
|
3366
|
-
});
|
|
3367
|
-
}
|
|
3368
|
-
function wrapHandlers(plugin) {
|
|
3369
|
-
for (const hookName of [
|
|
3370
|
-
"buildStart",
|
|
3371
|
-
"resolveId",
|
|
3372
|
-
"resolveDynamicImport",
|
|
3373
|
-
"buildEnd",
|
|
3374
|
-
"transform",
|
|
3375
|
-
"moduleParsed",
|
|
3376
|
-
"load",
|
|
3377
|
-
"renderChunk",
|
|
3378
|
-
"augmentChunkHash",
|
|
3379
|
-
"renderStart",
|
|
3380
|
-
"renderError",
|
|
3381
|
-
"generateBundle",
|
|
3382
|
-
"writeBundle",
|
|
3383
|
-
"closeBundle",
|
|
3384
|
-
"banner",
|
|
3385
|
-
"footer",
|
|
3386
|
-
"intro",
|
|
3387
|
-
"outro",
|
|
3388
|
-
"watchChange",
|
|
3389
|
-
"closeWatcher"
|
|
3390
|
-
]) {
|
|
3391
|
-
const handler = plugin[hookName];
|
|
3392
|
-
if (handler) plugin[hookName] = async (...args$1) => {
|
|
3393
|
-
try {
|
|
3394
|
-
return await handler(...args$1);
|
|
3395
|
-
} catch (e$1) {
|
|
3396
|
-
return error(logPluginError(e$1, plugin.name, {
|
|
3397
|
-
hook: hookName,
|
|
3398
|
-
id: hookName === "transform" ? args$1[2] : void 0
|
|
3399
|
-
}));
|
|
3400
|
-
}
|
|
3401
|
-
};
|
|
3402
|
-
}
|
|
3403
|
-
return plugin;
|
|
3404
|
-
}
|
|
3405
|
-
var NormalizedInputOptionsImpl = class extends PlainObjectLike {
|
|
3406
|
-
inner;
|
|
3407
|
-
constructor(inner, onLog) {
|
|
3408
|
-
super();
|
|
3409
|
-
this.onLog = onLog;
|
|
3410
|
-
this.inner = inner;
|
|
3411
|
-
}
|
|
3412
|
-
get shimMissingExports() {
|
|
3413
|
-
return this.inner.shimMissingExports;
|
|
3414
|
-
}
|
|
3415
|
-
get input() {
|
|
3416
|
-
return this.inner.input;
|
|
3417
|
-
}
|
|
3418
|
-
get cwd() {
|
|
3419
|
-
return this.inner.cwd;
|
|
3420
|
-
}
|
|
3421
|
-
get platform() {
|
|
3422
|
-
return this.inner.platform;
|
|
3423
|
-
}
|
|
3424
|
-
get context() {
|
|
3425
|
-
return this.inner.context;
|
|
3426
|
-
}
|
|
3427
|
-
};
|
|
3428
|
-
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "shimMissingExports", null);
|
|
3429
|
-
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "input", null);
|
|
3430
|
-
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "cwd", null);
|
|
3431
|
-
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "platform", null);
|
|
3432
|
-
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "context", null);
|
|
3433
|
-
var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
|
|
3434
|
-
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3435
|
-
super();
|
|
3436
|
-
this.inner = inner;
|
|
3437
|
-
this.outputOptions = outputOptions;
|
|
3438
|
-
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3439
|
-
}
|
|
3440
|
-
get dir() {
|
|
3441
|
-
return this.inner.dir ?? void 0;
|
|
3442
|
-
}
|
|
3443
|
-
get entryFileNames() {
|
|
3444
|
-
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
3445
|
-
}
|
|
3446
|
-
get chunkFileNames() {
|
|
3447
|
-
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
3448
|
-
}
|
|
3449
|
-
get assetFileNames() {
|
|
3450
|
-
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
3451
|
-
}
|
|
3452
|
-
get format() {
|
|
3453
|
-
return this.inner.format;
|
|
3454
|
-
}
|
|
3455
|
-
get exports() {
|
|
3456
|
-
return this.inner.exports;
|
|
3457
|
-
}
|
|
3458
|
-
get sourcemap() {
|
|
3459
|
-
return this.inner.sourcemap;
|
|
3460
|
-
}
|
|
3461
|
-
get sourcemapBaseUrl() {
|
|
3462
|
-
return this.inner.sourcemapBaseUrl ?? void 0;
|
|
3463
|
-
}
|
|
3464
|
-
get cssEntryFileNames() {
|
|
3465
|
-
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
3466
|
-
}
|
|
3467
|
-
get cssChunkFileNames() {
|
|
3468
|
-
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
3469
|
-
}
|
|
3470
|
-
get shimMissingExports() {
|
|
3471
|
-
return this.inner.shimMissingExports;
|
|
3472
|
-
}
|
|
3473
|
-
get name() {
|
|
3474
|
-
return this.inner.name ?? void 0;
|
|
3475
|
-
}
|
|
3476
|
-
get file() {
|
|
3477
|
-
return this.inner.file ?? void 0;
|
|
3478
|
-
}
|
|
3479
|
-
get inlineDynamicImports() {
|
|
3480
|
-
return this.inner.inlineDynamicImports;
|
|
3481
|
-
}
|
|
3482
|
-
get dynamicImportInCjs() {
|
|
3483
|
-
return this.inner.dynamicImportInCjs;
|
|
3484
|
-
}
|
|
3485
|
-
get externalLiveBindings() {
|
|
3486
|
-
return this.inner.externalLiveBindings;
|
|
3487
|
-
}
|
|
3488
|
-
get banner() {
|
|
3489
|
-
return normalizeAddon(this.outputOptions.banner);
|
|
3490
|
-
}
|
|
3491
|
-
get footer() {
|
|
3492
|
-
return normalizeAddon(this.outputOptions.footer);
|
|
3493
|
-
}
|
|
3494
|
-
get postBanner() {
|
|
3495
|
-
return normalizeAddon(this.outputOptions.postBanner);
|
|
3496
|
-
}
|
|
3497
|
-
get postFooter() {
|
|
3498
|
-
return normalizeAddon(this.outputOptions.postFooter);
|
|
3499
|
-
}
|
|
3500
|
-
get intro() {
|
|
3501
|
-
return normalizeAddon(this.outputOptions.intro);
|
|
3502
|
-
}
|
|
3503
|
-
get outro() {
|
|
3504
|
-
return normalizeAddon(this.outputOptions.outro);
|
|
3505
|
-
}
|
|
3506
|
-
get esModule() {
|
|
3507
|
-
return this.inner.esModule;
|
|
3508
|
-
}
|
|
3509
|
-
get extend() {
|
|
3510
|
-
return this.inner.extend;
|
|
3511
|
-
}
|
|
3512
|
-
get globals() {
|
|
3513
|
-
return this.inner.globals || this.outputOptions.globals;
|
|
3514
|
-
}
|
|
3515
|
-
get paths() {
|
|
3516
|
-
return this.outputOptions.paths;
|
|
3517
|
-
}
|
|
3518
|
-
get hashCharacters() {
|
|
3519
|
-
return this.inner.hashCharacters;
|
|
3520
|
-
}
|
|
3521
|
-
get sourcemapDebugIds() {
|
|
3522
|
-
return this.inner.sourcemapDebugIds;
|
|
3523
|
-
}
|
|
3524
|
-
get sourcemapIgnoreList() {
|
|
3525
|
-
return this.outputOptions.sourcemapIgnoreList;
|
|
3526
|
-
}
|
|
3527
|
-
get sourcemapPathTransform() {
|
|
3528
|
-
return this.outputOptions.sourcemapPathTransform;
|
|
3529
|
-
}
|
|
3530
|
-
get minify() {
|
|
3531
|
-
let ret = this.inner.minify;
|
|
3532
|
-
if (typeof ret === "object" && ret !== null) {
|
|
3533
|
-
delete ret["codegen"];
|
|
3534
|
-
delete ret["module"];
|
|
3535
|
-
delete ret["sourcemap"];
|
|
3536
|
-
}
|
|
3537
|
-
return ret;
|
|
3538
|
-
}
|
|
3539
|
-
get legalComments() {
|
|
3540
|
-
return this.inner.legalComments;
|
|
3541
|
-
}
|
|
3542
|
-
get polyfillRequire() {
|
|
3543
|
-
return this.inner.polyfillRequire;
|
|
3544
|
-
}
|
|
3545
|
-
get plugins() {
|
|
3546
|
-
return this.normalizedOutputPlugins;
|
|
3547
|
-
}
|
|
3548
|
-
get preserveModules() {
|
|
3549
|
-
return this.inner.preserveModules;
|
|
3550
|
-
}
|
|
3551
|
-
get preserveModulesRoot() {
|
|
3552
|
-
return this.inner.preserveModulesRoot;
|
|
3553
|
-
}
|
|
3554
|
-
get virtualDirname() {
|
|
3555
|
-
return this.inner.virtualDirname;
|
|
3556
|
-
}
|
|
3557
|
-
get topLevelVar() {
|
|
3558
|
-
return this.inner.topLevelVar ?? false;
|
|
3559
|
-
}
|
|
3560
|
-
get minifyInternalExports() {
|
|
3561
|
-
return this.inner.minifyInternalExports ?? false;
|
|
3562
|
-
}
|
|
3563
|
-
};
|
|
3564
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "dir", null);
|
|
3565
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "entryFileNames", null);
|
|
3566
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "chunkFileNames", null);
|
|
3567
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "assetFileNames", null);
|
|
3568
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
|
|
3569
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
|
|
3570
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
|
|
3571
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
|
|
3572
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssEntryFileNames", null);
|
|
3573
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssChunkFileNames", null);
|
|
3574
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
|
|
3575
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
|
|
3576
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "file", null);
|
|
3577
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "inlineDynamicImports", null);
|
|
3578
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "dynamicImportInCjs", null);
|
|
3579
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "externalLiveBindings", null);
|
|
3580
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "banner", null);
|
|
3581
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "footer", null);
|
|
3582
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "postBanner", null);
|
|
3583
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "postFooter", null);
|
|
3584
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "intro", null);
|
|
3585
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "outro", null);
|
|
3586
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "esModule", null);
|
|
3587
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "extend", null);
|
|
3588
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "globals", null);
|
|
3589
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "paths", null);
|
|
3590
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "hashCharacters", null);
|
|
3591
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapDebugIds", null);
|
|
3592
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapIgnoreList", null);
|
|
3593
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapPathTransform", null);
|
|
3594
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minify", null);
|
|
3595
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "legalComments", null);
|
|
3596
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "polyfillRequire", null);
|
|
3597
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "plugins", null);
|
|
3598
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModules", null);
|
|
3599
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModulesRoot", null);
|
|
3600
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "virtualDirname", null);
|
|
3601
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "topLevelVar", null);
|
|
3602
|
-
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minifyInternalExports", null);
|
|
3603
|
-
function normalizeAddon(value) {
|
|
3604
|
-
if (typeof value === "function") return value;
|
|
3605
|
-
return () => value || "";
|
|
3606
|
-
}
|
|
3607
|
-
var PluginContextData = class {
|
|
3608
|
-
moduleOptionMap = /* @__PURE__ */ new Map();
|
|
3609
|
-
resolveOptionsMap = /* @__PURE__ */ new Map();
|
|
3610
|
-
loadModulePromiseMap = /* @__PURE__ */ new Map();
|
|
3611
|
-
renderedChunkMeta = null;
|
|
3612
|
-
normalizedInputOptions = null;
|
|
3613
|
-
normalizedOutputOptions = null;
|
|
3614
|
-
constructor(onLog, outputOptions, normalizedOutputPlugins) {
|
|
3615
|
-
this.onLog = onLog;
|
|
3616
|
-
this.outputOptions = outputOptions;
|
|
3617
|
-
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3618
|
-
}
|
|
3619
|
-
updateModuleOption(id$1, option) {
|
|
3620
|
-
const existing = this.moduleOptionMap.get(id$1);
|
|
3621
|
-
if (existing) {
|
|
3622
|
-
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
3623
|
-
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
3624
|
-
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
3625
|
-
} else {
|
|
3626
|
-
this.moduleOptionMap.set(id$1, option);
|
|
3627
|
-
return option;
|
|
3628
|
-
}
|
|
3629
|
-
return existing;
|
|
3630
|
-
}
|
|
3631
|
-
getModuleOption(id$1) {
|
|
3632
|
-
const option = this.moduleOptionMap.get(id$1);
|
|
3633
|
-
if (!option) {
|
|
3634
|
-
const raw = {
|
|
3635
|
-
moduleSideEffects: null,
|
|
3636
|
-
meta: {}
|
|
3637
|
-
};
|
|
3638
|
-
this.moduleOptionMap.set(id$1, raw);
|
|
3639
|
-
return raw;
|
|
3640
|
-
}
|
|
3641
|
-
return option;
|
|
3642
|
-
}
|
|
3643
|
-
getModuleInfo(id$1, context) {
|
|
3644
|
-
const bindingInfo = context.getModuleInfo(id$1);
|
|
3645
|
-
if (bindingInfo) {
|
|
3646
|
-
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
|
|
3647
|
-
return this.proxyModuleInfo(id$1, info);
|
|
3648
|
-
}
|
|
3649
|
-
return null;
|
|
3650
|
-
}
|
|
3651
|
-
proxyModuleInfo(id$1, info) {
|
|
3652
|
-
let moduleSideEffects = info.moduleSideEffects;
|
|
3653
|
-
Object.defineProperty(info, "moduleSideEffects", {
|
|
3654
|
-
get() {
|
|
3655
|
-
return moduleSideEffects;
|
|
3656
|
-
},
|
|
3657
|
-
set: (v) => {
|
|
3658
|
-
this.updateModuleOption(id$1, {
|
|
3659
|
-
moduleSideEffects: v,
|
|
3660
|
-
meta: info.meta,
|
|
3661
|
-
invalidate: true
|
|
3662
|
-
});
|
|
3663
|
-
moduleSideEffects = v;
|
|
3664
|
-
}
|
|
3665
|
-
});
|
|
3666
|
-
return info;
|
|
3667
|
-
}
|
|
3668
|
-
getModuleIds(context) {
|
|
3669
|
-
return context.getModuleIds().values();
|
|
3670
|
-
}
|
|
3671
|
-
saveResolveOptions(options) {
|
|
3672
|
-
const index = this.resolveOptionsMap.size;
|
|
3673
|
-
this.resolveOptionsMap.set(index, options);
|
|
3674
|
-
return index;
|
|
3675
|
-
}
|
|
3676
|
-
getSavedResolveOptions(receipt) {
|
|
3677
|
-
return this.resolveOptionsMap.get(receipt);
|
|
3678
|
-
}
|
|
3679
|
-
removeSavedResolveOptions(receipt) {
|
|
3680
|
-
this.resolveOptionsMap.delete(receipt);
|
|
3681
|
-
}
|
|
3682
|
-
setRenderChunkMeta(meta) {
|
|
3683
|
-
this.renderedChunkMeta = meta;
|
|
3684
|
-
}
|
|
3685
|
-
getRenderChunkMeta() {
|
|
3686
|
-
return this.renderedChunkMeta;
|
|
3687
|
-
}
|
|
3688
|
-
getInputOptions(opts) {
|
|
3689
|
-
this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog);
|
|
3690
|
-
return this.normalizedInputOptions;
|
|
3691
|
-
}
|
|
3692
|
-
getOutputOptions(opts) {
|
|
3693
|
-
this.normalizedOutputOptions ??= new NormalizedOutputOptionsImpl(opts, this.outputOptions, this.normalizedOutputPlugins);
|
|
3694
|
-
return this.normalizedOutputOptions;
|
|
3695
|
-
}
|
|
3696
|
-
clear() {
|
|
3697
|
-
this.renderedChunkMeta = null;
|
|
3698
|
-
this.loadModulePromiseMap.clear();
|
|
3699
|
-
}
|
|
3700
|
-
};
|
|
3701
|
-
/**
|
|
3702
|
-
* Normalizes transform options by extracting `define`, `inject`, and `dropLabels` separately from OXC transform options.
|
|
3703
|
-
*
|
|
3704
|
-
* Prioritizes values from `transform.define`, `transform.inject`, and `transform.dropLabels` over deprecated top-level options.
|
|
3705
|
-
*/
|
|
3706
|
-
function normalizeTransformOptions(inputOptions) {
|
|
3707
|
-
const transform = inputOptions.transform;
|
|
3708
|
-
const define = transform?.define ? Object.entries(transform.define) : void 0;
|
|
3709
|
-
const inject = transform?.inject;
|
|
3710
|
-
const dropLabels = transform?.dropLabels;
|
|
3711
|
-
let oxcTransformOptions;
|
|
3712
|
-
if (transform) {
|
|
3713
|
-
const { define: _define, inject: _inject, dropLabels: _dropLabels, ...rest } = transform;
|
|
3714
|
-
if (Object.keys(rest).length > 0) {
|
|
3715
|
-
if (rest.jsx === false) rest.jsx = "disable";
|
|
3716
|
-
oxcTransformOptions = rest;
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
return {
|
|
3720
|
-
define,
|
|
3721
|
-
inject,
|
|
3722
|
-
dropLabels,
|
|
3723
|
-
oxcTransformOptions
|
|
3724
|
-
};
|
|
3725
|
-
}
|
|
3726
|
-
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
3727
|
-
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
3728
|
-
const plugins = rawPlugins.map((plugin) => {
|
|
3729
|
-
if ("_parallel" in plugin) return;
|
|
3730
|
-
if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
|
|
3731
|
-
case "builtin:vite-css-post": return bindingifyCSSPostPlugin(plugin, pluginContextData);
|
|
3732
|
-
case "builtin:vite-html": return bindingifyViteHtmlPlugin(plugin, onLog, logLevel, watchMode, pluginContextData);
|
|
3733
|
-
case "builtin:vite-manifest": return bindingifyManifestPlugin(plugin, pluginContextData);
|
|
3734
|
-
default: return bindingifyBuiltInPlugin(plugin);
|
|
3735
|
-
}
|
|
3736
|
-
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3737
|
-
});
|
|
3738
|
-
const normalizedTransform = normalizeTransformOptions(inputOptions);
|
|
3739
|
-
return {
|
|
3740
|
-
input: bindingifyInput(inputOptions.input),
|
|
3741
|
-
plugins,
|
|
3742
|
-
cwd: inputOptions.cwd ?? process.cwd(),
|
|
3743
|
-
external: bindingifyExternal(inputOptions.external),
|
|
3744
|
-
resolve: bindingifyResolve(inputOptions.resolve),
|
|
3745
|
-
platform: inputOptions.platform,
|
|
3746
|
-
shimMissingExports: inputOptions.shimMissingExports,
|
|
3747
|
-
logLevel: bindingifyLogLevel(logLevel),
|
|
3748
|
-
onLog: async (level, log) => onLog(level, log),
|
|
3749
|
-
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
3750
|
-
moduleTypes: inputOptions.moduleTypes,
|
|
3751
|
-
define: normalizedTransform.define,
|
|
3752
|
-
inject: bindingifyInject(normalizedTransform.inject),
|
|
3753
|
-
experimental: bindingifyExperimental(inputOptions.experimental),
|
|
3754
|
-
profilerNames: outputOptions.generatedCode?.profilerNames,
|
|
3755
|
-
transform: normalizedTransform.oxcTransformOptions,
|
|
3756
|
-
watch: bindingifyWatch(inputOptions.watch),
|
|
3757
|
-
dropLabels: normalizedTransform.dropLabels,
|
|
3758
|
-
keepNames: outputOptions.keepNames,
|
|
3759
|
-
checks: inputOptions.checks,
|
|
3760
|
-
deferSyncScanData: () => {
|
|
3761
|
-
let ret = [];
|
|
3762
|
-
pluginContextData.moduleOptionMap.forEach((value, key) => {
|
|
3763
|
-
if (value.invalidate) ret.push({
|
|
3764
|
-
id: key,
|
|
3765
|
-
sideEffects: value.moduleSideEffects ?? void 0
|
|
3766
|
-
});
|
|
3767
|
-
});
|
|
3768
|
-
return ret;
|
|
3769
|
-
},
|
|
3770
|
-
makeAbsoluteExternalsRelative: bindingifyMakeAbsoluteExternalsRelative(inputOptions.makeAbsoluteExternalsRelative),
|
|
3771
|
-
devtools: inputOptions.devtools,
|
|
3772
|
-
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
|
|
3773
|
-
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
|
3774
|
-
optimization: inputOptions.optimization,
|
|
3775
|
-
context: inputOptions.context,
|
|
3776
|
-
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
|
3777
|
-
};
|
|
3778
|
-
}
|
|
3779
|
-
function bindingifyDevMode(devMode) {
|
|
3780
|
-
if (devMode) {
|
|
3781
|
-
if (typeof devMode === "boolean") return devMode ? {} : void 0;
|
|
3782
|
-
return devMode;
|
|
3783
|
-
}
|
|
3784
|
-
}
|
|
3785
|
-
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
|
3786
|
-
switch (attachDebugInfo) {
|
|
3787
|
-
case void 0: return;
|
|
3788
|
-
case "full": return BindingAttachDebugInfo.Full;
|
|
3789
|
-
case "simple": return BindingAttachDebugInfo.Simple;
|
|
3790
|
-
case "none": return BindingAttachDebugInfo.None;
|
|
3791
|
-
}
|
|
3792
|
-
}
|
|
3793
|
-
function bindingifyExternal(external) {
|
|
3794
|
-
if (external) {
|
|
3795
|
-
if (typeof external === "function") return (id$1, importer, isResolved) => {
|
|
3796
|
-
if (id$1.startsWith("\0")) return false;
|
|
3797
|
-
return external(id$1, importer, isResolved) ?? false;
|
|
3798
|
-
};
|
|
3799
|
-
return arraify(external);
|
|
3800
|
-
}
|
|
3801
|
-
}
|
|
3802
|
-
function bindingifyExperimental(experimental) {
|
|
3803
|
-
let chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
|
|
3804
|
-
if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
|
|
3805
|
-
case "exec-order":
|
|
3806
|
-
chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
|
|
3807
|
-
break;
|
|
3808
|
-
case "module-id":
|
|
3809
|
-
chunkModulesOrder = BindingChunkModuleOrderBy.ModuleId;
|
|
3810
|
-
break;
|
|
3811
|
-
default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
|
|
3812
|
-
}
|
|
3813
|
-
return {
|
|
3814
|
-
strictExecutionOrder: experimental?.strictExecutionOrder,
|
|
3815
|
-
disableLiveBindings: experimental?.disableLiveBindings,
|
|
3816
|
-
viteMode: experimental?.viteMode,
|
|
3817
|
-
resolveNewUrlToAsset: experimental?.resolveNewUrlToAsset,
|
|
3818
|
-
devMode: bindingifyDevMode(experimental?.devMode),
|
|
3819
|
-
attachDebugInfo: bindingifyAttachDebugInfo(experimental?.attachDebugInfo),
|
|
3820
|
-
chunkModulesOrder,
|
|
3821
|
-
chunkImportMap: experimental?.chunkImportMap,
|
|
3822
|
-
onDemandWrapping: experimental?.onDemandWrapping,
|
|
3823
|
-
incrementalBuild: experimental?.incrementalBuild,
|
|
3824
|
-
nativeMagicString: experimental?.nativeMagicString,
|
|
3825
|
-
chunkOptimization: experimental?.chunkOptimization
|
|
3826
|
-
};
|
|
3827
|
-
}
|
|
3828
|
-
function bindingifyResolve(resolve$1) {
|
|
3829
|
-
const yarnPnp = typeof process === "object" && !!process.versions?.pnp;
|
|
3830
|
-
if (resolve$1) {
|
|
3831
|
-
const { alias, extensionAlias, ...rest } = resolve$1;
|
|
3832
|
-
return {
|
|
3833
|
-
alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
|
|
3834
|
-
find: name,
|
|
3835
|
-
replacements: replacement === false ? [void 0] : arraify(replacement)
|
|
3836
|
-
})) : void 0,
|
|
3837
|
-
extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
|
|
3838
|
-
target: name,
|
|
3839
|
-
replacements: value
|
|
3840
|
-
})) : void 0,
|
|
3841
|
-
yarnPnp,
|
|
3842
|
-
...rest
|
|
3843
|
-
};
|
|
3844
|
-
} else return { yarnPnp };
|
|
3845
|
-
}
|
|
3846
|
-
function bindingifyInject(inject) {
|
|
3847
|
-
if (inject) return Object.entries(inject).map(([alias, item]) => {
|
|
3848
|
-
if (Array.isArray(item)) {
|
|
3849
|
-
if (item[1] === "*") return {
|
|
3850
|
-
tagNamespace: true,
|
|
3851
|
-
alias,
|
|
3852
|
-
from: item[0]
|
|
3853
|
-
};
|
|
3854
|
-
return {
|
|
3855
|
-
tagNamed: true,
|
|
3856
|
-
alias,
|
|
3857
|
-
from: item[0],
|
|
3858
|
-
imported: item[1]
|
|
3859
|
-
};
|
|
3860
|
-
} else return {
|
|
3861
|
-
tagNamed: true,
|
|
3862
|
-
imported: "default",
|
|
3863
|
-
alias,
|
|
3864
|
-
from: item
|
|
3865
|
-
};
|
|
3866
|
-
});
|
|
3867
|
-
}
|
|
3868
|
-
function bindingifyLogLevel(logLevel) {
|
|
3869
|
-
switch (logLevel) {
|
|
3870
|
-
case "silent": return BindingLogLevel.Silent;
|
|
3871
|
-
case "debug": return BindingLogLevel.Debug;
|
|
3872
|
-
case "warn": return BindingLogLevel.Warn;
|
|
3873
|
-
case "info": return BindingLogLevel.Info;
|
|
3874
|
-
default: throw new Error(`Unexpected log level: ${logLevel}`);
|
|
3875
|
-
}
|
|
3876
|
-
}
|
|
3877
|
-
function bindingifyInput(input) {
|
|
3878
|
-
if (input === void 0) return [];
|
|
3879
|
-
if (typeof input === "string") return [{ import: input }];
|
|
3880
|
-
if (Array.isArray(input)) return input.map((src) => ({ import: src }));
|
|
3881
|
-
return Object.entries(input).map(([name, import_path]) => {
|
|
3882
|
-
return {
|
|
3883
|
-
name,
|
|
3884
|
-
import: import_path
|
|
3885
|
-
};
|
|
3886
|
-
});
|
|
3887
|
-
}
|
|
3888
|
-
function bindingifyWatch(watch) {
|
|
3889
|
-
if (watch) return {
|
|
3890
|
-
buildDelay: watch.buildDelay,
|
|
3891
|
-
skipWrite: watch.skipWrite,
|
|
3892
|
-
include: normalizedStringOrRegex(watch.include),
|
|
3893
|
-
exclude: normalizedStringOrRegex(watch.exclude),
|
|
3894
|
-
onInvalidate: (...args$1) => watch.onInvalidate?.(...args$1)
|
|
3895
|
-
};
|
|
3896
|
-
}
|
|
3897
|
-
function bindingifyTreeshakeOptions(config) {
|
|
3898
|
-
if (config === false) return;
|
|
3899
|
-
if (config === true || config === void 0) return { moduleSideEffects: true };
|
|
3900
|
-
let normalizedConfig = {
|
|
3901
|
-
moduleSideEffects: true,
|
|
3902
|
-
annotations: config.annotations,
|
|
3903
|
-
manualPureFunctions: config.manualPureFunctions,
|
|
3904
|
-
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
|
3905
|
-
commonjs: config.commonjs
|
|
3906
|
-
};
|
|
3907
|
-
switch (config.propertyReadSideEffects) {
|
|
3908
|
-
case "always":
|
|
3909
|
-
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
|
|
3910
|
-
break;
|
|
3911
|
-
case false:
|
|
3912
|
-
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
|
|
3913
|
-
break;
|
|
3914
|
-
default:
|
|
3915
|
-
}
|
|
3916
|
-
switch (config.propertyWriteSideEffects) {
|
|
3917
|
-
case "always":
|
|
3918
|
-
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
|
|
3919
|
-
break;
|
|
3920
|
-
case false:
|
|
3921
|
-
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
|
|
3922
|
-
break;
|
|
3923
|
-
default:
|
|
3924
|
-
}
|
|
3925
|
-
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
3926
|
-
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
3927
|
-
external: true,
|
|
3928
|
-
sideEffects: false
|
|
3929
|
-
}, {
|
|
3930
|
-
external: false,
|
|
3931
|
-
sideEffects: true
|
|
3932
|
-
}];
|
|
3933
|
-
else normalizedConfig.moduleSideEffects = config.moduleSideEffects;
|
|
3934
|
-
return normalizedConfig;
|
|
3935
|
-
}
|
|
3936
|
-
function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative) {
|
|
3937
|
-
if (makeAbsoluteExternalsRelative === "ifRelativeSource") return { type: "IfRelativeSource" };
|
|
3938
|
-
if (typeof makeAbsoluteExternalsRelative === "boolean") return {
|
|
3939
|
-
type: "Bool",
|
|
3940
|
-
field0: makeAbsoluteExternalsRelative
|
|
3941
|
-
};
|
|
3942
|
-
}
|
|
3943
|
-
function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
3944
|
-
if (preserveEntrySignatures == void 0) return;
|
|
3945
|
-
else if (typeof preserveEntrySignatures === "string") return {
|
|
3946
|
-
type: "String",
|
|
3947
|
-
field0: preserveEntrySignatures
|
|
3948
|
-
};
|
|
3949
|
-
else return {
|
|
3950
|
-
type: "Bool",
|
|
3951
|
-
field0: preserveEntrySignatures
|
|
3952
|
-
};
|
|
3953
|
-
}
|
|
3954
|
-
var ChunkingContextImpl = class {
|
|
3955
|
-
constructor(context) {
|
|
3956
|
-
this.context = context;
|
|
3957
|
-
}
|
|
3958
|
-
getModuleInfo(moduleId) {
|
|
3959
|
-
const bindingInfo = this.context.getModuleInfo(moduleId);
|
|
3960
|
-
if (bindingInfo) return transformModuleInfo(bindingInfo, {
|
|
3961
|
-
moduleSideEffects: null,
|
|
3962
|
-
meta: {}
|
|
3963
|
-
});
|
|
3964
|
-
return null;
|
|
3965
|
-
}
|
|
3966
|
-
};
|
|
3967
|
-
function bindingifyOutputOptions(outputOptions) {
|
|
3968
|
-
const { dir, format: format$1, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, cssEntryFileNames, cssChunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir } = outputOptions;
|
|
3969
|
-
if (outputOptions.inlineDynamicImports === true) {
|
|
3970
|
-
if (manualChunks != null) throw new Error("Invalid value \"true\" for option \"output.inlineDynamicImports\" - this option is not supported for \"output.manualChunks\".");
|
|
3971
|
-
}
|
|
3972
|
-
const advancedChunks = bindingifyAdvancedChunks(outputOptions.advancedChunks, manualChunks);
|
|
3973
|
-
return {
|
|
3974
|
-
dir,
|
|
3975
|
-
file: file == null ? void 0 : file,
|
|
3976
|
-
format: bindingifyFormat(format$1),
|
|
3977
|
-
exports,
|
|
3978
|
-
hashCharacters,
|
|
3979
|
-
sourcemap: bindingifySourcemap(sourcemap),
|
|
3980
|
-
sourcemapBaseUrl,
|
|
3981
|
-
sourcemapDebugIds,
|
|
3982
|
-
sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules/,
|
|
3983
|
-
sourcemapPathTransform,
|
|
3984
|
-
banner: bindingifyAddon(banner),
|
|
3985
|
-
footer: bindingifyAddon(footer),
|
|
3986
|
-
postBanner: bindingifyAddon(postBanner),
|
|
3987
|
-
postFooter: bindingifyAddon(postFooter),
|
|
3988
|
-
intro: bindingifyAddon(intro),
|
|
3989
|
-
outro: bindingifyAddon(outro),
|
|
3990
|
-
extend: outputOptions.extend,
|
|
3991
|
-
globals,
|
|
3992
|
-
paths,
|
|
3993
|
-
generatedCode,
|
|
3994
|
-
esModule,
|
|
3995
|
-
name,
|
|
3996
|
-
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
3997
|
-
entryFileNames,
|
|
3998
|
-
chunkFileNames,
|
|
3999
|
-
cssEntryFileNames,
|
|
4000
|
-
cssChunkFileNames,
|
|
4001
|
-
plugins: [],
|
|
4002
|
-
minify: outputOptions.minify,
|
|
4003
|
-
externalLiveBindings: outputOptions.externalLiveBindings,
|
|
4004
|
-
inlineDynamicImports: outputOptions.inlineDynamicImports,
|
|
4005
|
-
dynamicImportInCjs: outputOptions.dynamicImportInCjs,
|
|
4006
|
-
advancedChunks,
|
|
4007
|
-
polyfillRequire: outputOptions.polyfillRequire,
|
|
4008
|
-
sanitizeFileName,
|
|
4009
|
-
preserveModules,
|
|
4010
|
-
virtualDirname,
|
|
4011
|
-
legalComments,
|
|
4012
|
-
preserveModulesRoot,
|
|
4013
|
-
topLevelVar,
|
|
4014
|
-
minifyInternalExports: outputOptions.minifyInternalExports,
|
|
4015
|
-
cleanDir
|
|
4016
|
-
};
|
|
4017
|
-
}
|
|
4018
|
-
function bindingifyAddon(configAddon) {
|
|
4019
|
-
if (configAddon == null || configAddon === "") return;
|
|
4020
|
-
if (typeof configAddon === "function") return async (chunk) => configAddon(transformRenderedChunk(chunk));
|
|
4021
|
-
return configAddon;
|
|
4022
|
-
}
|
|
4023
|
-
function bindingifyFormat(format$1) {
|
|
4024
|
-
switch (format$1) {
|
|
4025
|
-
case void 0:
|
|
4026
|
-
case "es":
|
|
4027
|
-
case "esm":
|
|
4028
|
-
case "module": return "es";
|
|
4029
|
-
case "cjs":
|
|
4030
|
-
case "commonjs": return "cjs";
|
|
4031
|
-
case "iife": return "iife";
|
|
4032
|
-
case "umd": return "umd";
|
|
4033
|
-
default: unimplemented(`output.format: ${format$1}`);
|
|
4034
|
-
}
|
|
4035
|
-
}
|
|
4036
|
-
function bindingifySourcemap(sourcemap) {
|
|
4037
|
-
switch (sourcemap) {
|
|
4038
|
-
case true: return "file";
|
|
4039
|
-
case "inline": return "inline";
|
|
4040
|
-
case false:
|
|
4041
|
-
case void 0: return;
|
|
4042
|
-
case "hidden": return "hidden";
|
|
4043
|
-
default: throw new Error(`unknown sourcemap: ${sourcemap}`);
|
|
4044
|
-
}
|
|
4045
|
-
}
|
|
4046
|
-
function bindingifyAssetFilenames(assetFileNames) {
|
|
4047
|
-
if (typeof assetFileNames === "function") return (asset) => {
|
|
4048
|
-
return assetFileNames({
|
|
4049
|
-
name: asset.name,
|
|
4050
|
-
names: asset.names,
|
|
4051
|
-
originalFileName: asset.originalFileName,
|
|
4052
|
-
originalFileNames: asset.originalFileNames,
|
|
4053
|
-
source: transformAssetSource(asset.source),
|
|
4054
|
-
type: "asset"
|
|
4055
|
-
});
|
|
4056
|
-
};
|
|
4057
|
-
return assetFileNames;
|
|
4058
|
-
}
|
|
4059
|
-
function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
|
|
4060
|
-
if (manualChunks != null && advancedChunks != null) console.warn("`manualChunks` option is ignored due to `advancedChunks` option is specified.");
|
|
4061
|
-
else if (manualChunks != null) advancedChunks = { groups: [{ name(moduleId, ctx) {
|
|
4062
|
-
return manualChunks(moduleId, { getModuleInfo: (id$1) => ctx.getModuleInfo(id$1) });
|
|
4063
|
-
} }] };
|
|
4064
|
-
if (advancedChunks == null) return;
|
|
4065
|
-
const { groups, ...restAdvancedChunks } = advancedChunks;
|
|
4066
|
-
return {
|
|
4067
|
-
...restAdvancedChunks,
|
|
4068
|
-
groups: groups?.map((group) => {
|
|
4069
|
-
const { name, ...restGroup } = group;
|
|
4070
|
-
return {
|
|
4071
|
-
...restGroup,
|
|
4072
|
-
name: typeof name === "function" ? (id$1, ctx) => name(id$1, new ChunkingContextImpl(ctx)) : name
|
|
4073
|
-
};
|
|
4074
|
-
})
|
|
4075
|
-
};
|
|
4076
|
-
}
|
|
4077
|
-
async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
4078
|
-
const inputPlugins = await normalizePluginOption(inputOptions.plugins);
|
|
4079
|
-
const outputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
4080
|
-
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
4081
|
-
const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
4082
|
-
outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions, onLog, logLevel, watchMode);
|
|
4083
|
-
const normalizedOutputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
4084
|
-
let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
|
|
4085
|
-
const parallelPluginInitResult = void 0;
|
|
4086
|
-
try {
|
|
4087
|
-
return {
|
|
4088
|
-
bundlerOptions: {
|
|
4089
|
-
inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode),
|
|
4090
|
-
outputOptions: bindingifyOutputOptions(outputOptions),
|
|
4091
|
-
parallelPluginsRegistry: parallelPluginInitResult?.registry
|
|
4092
|
-
},
|
|
4093
|
-
inputOptions,
|
|
4094
|
-
onLog,
|
|
4095
|
-
stopWorkers: parallelPluginInitResult?.stopWorkers
|
|
4096
|
-
};
|
|
4097
|
-
} catch (e$1) {
|
|
4098
|
-
await parallelPluginInitResult?.stopWorkers();
|
|
4099
|
-
throw e$1;
|
|
4100
|
-
}
|
|
4101
|
-
}
|
|
4102
|
-
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
4103
|
-
/** @category Programmatic APIs */
|
|
4104
|
-
var RolldownBuild = class RolldownBuild$1 {
|
|
4105
|
-
#inputOptions;
|
|
4106
|
-
#bundler;
|
|
4107
|
-
#stopWorkers;
|
|
4108
|
-
static asyncRuntimeShutdown = false;
|
|
4109
|
-
constructor(inputOptions) {
|
|
4110
|
-
this.#inputOptions = inputOptions;
|
|
4111
|
-
this.#bundler = new BindingBundler();
|
|
4112
|
-
}
|
|
4113
|
-
get closed() {
|
|
4114
|
-
return this.#bundler.closed;
|
|
4115
|
-
}
|
|
4116
|
-
async generate(outputOptions = {}) {
|
|
4117
|
-
return this.#build(false, outputOptions);
|
|
4118
|
-
}
|
|
4119
|
-
async write(outputOptions = {}) {
|
|
4120
|
-
return this.#build(true, outputOptions);
|
|
4121
|
-
}
|
|
4122
|
-
/**
|
|
4123
|
-
* Close the build and free resources.
|
|
4124
|
-
*/
|
|
4125
|
-
async close() {
|
|
4126
|
-
await this.#stopWorkers?.();
|
|
4127
|
-
await this.#bundler.close();
|
|
4128
|
-
shutdownAsyncRuntime();
|
|
4129
|
-
RolldownBuild$1.asyncRuntimeShutdown = true;
|
|
4130
|
-
this.#stopWorkers = void 0;
|
|
4131
|
-
}
|
|
4132
|
-
async [Symbol.asyncDispose]() {
|
|
4133
|
-
await this.close();
|
|
4134
|
-
}
|
|
4135
|
-
get watchFiles() {
|
|
4136
|
-
return Promise.resolve(this.#bundler.getWatchFiles());
|
|
4137
|
-
}
|
|
4138
|
-
async #build(isWrite, outputOptions) {
|
|
4139
|
-
validateOption("output", outputOptions);
|
|
4140
|
-
await this.#stopWorkers?.();
|
|
4141
|
-
const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
|
|
4142
|
-
if (RolldownBuild$1.asyncRuntimeShutdown) startAsyncRuntime();
|
|
4143
|
-
try {
|
|
4144
|
-
this.#stopWorkers = option.stopWorkers;
|
|
4145
|
-
let output;
|
|
4146
|
-
if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
|
|
4147
|
-
else output = await this.#bundler.generate(option.bundlerOptions);
|
|
4148
|
-
return new RolldownOutputImpl(unwrapBindingResult(output));
|
|
4149
|
-
} catch (e$1) {
|
|
4150
|
-
await option.stopWorkers?.();
|
|
4151
|
-
throw e$1;
|
|
4152
|
-
}
|
|
4153
|
-
}
|
|
4154
|
-
};
|
|
4155
|
-
|
|
4156
|
-
//#endregion
|
|
4157
|
-
export { PluginDriver, RolldownBuild, validateOption };
|