@rolldown/browser 1.0.0-beta.56 → 1.0.0-beta.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +8 -8
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +6 -6
- package/dist/{constructors-DMeuUDyD.js → constructors-BuqTjXTF.js} +1 -1
- package/dist/experimental-index.browser.mjs +3 -3
- package/dist/experimental-index.d.mts +4 -4
- package/dist/experimental-index.mjs +5 -5
- package/dist/experimental-runtime-types.d.ts +1 -1
- package/dist/filter-index.d.mts +3 -3
- package/dist/filter-index.mjs +123 -2
- package/dist/get-log-filter.d.mts +1 -1
- package/dist/index.browser.mjs +4 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +6 -6
- package/dist/{normalize-string-or-regex-B-Y4k0qo.js → normalize-string-or-regex-3ql5-z8-.js} +3 -2
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/plugins-index.browser.mjs +2 -2
- package/dist/plugins-index.d.mts +3 -3
- package/dist/plugins-index.mjs +2 -2
- package/dist/rolldown-binding.wasi.cjs +1 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/{rolldown-build-BEV6JVIl.js → rolldown-build-CRqas5jO.js} +14 -6
- package/dist/shared/{binding-CDyF6W3D.d.mts → binding-MAEzB4KA.d.mts} +10 -0
- package/dist/shared/{bindingify-input-options-kzSFdf_-.mjs → bindingify-input-options--qcSYuhh.mjs} +8 -4
- package/dist/shared/composable-filters-C5qA4jo-.mjs +206 -0
- package/dist/shared/{constructors-B0L_9ar3.d.mts → constructors-CQP6o3cR.d.mts} +2 -2
- package/dist/shared/{constructors-Dw9UOO6Z.mjs → constructors-kOch67Sb.mjs} +1 -1
- package/dist/shared/{define-config-CrCCK_Ci.d.mts → define-config-yInAJbA1.d.mts} +471 -125
- package/dist/shared/{load-config-vlnYfd7q.mjs → load-config-BZhApFJg.mjs} +1 -1
- package/dist/shared/{logging-BpAvp7KV.d.mts → logging-B4x9qar8.d.mts} +1 -0
- package/dist/shared/{normalize-string-or-regex-CwM9ci6w.mjs → normalize-string-or-regex-CIiT1lMg.mjs} +3 -2
- package/dist/shared/{parse-ast-index-DZPue_kI.mjs → parse-ast-index-CgzK6cxG.mjs} +1 -1
- package/dist/shared/{rolldown-DtiFL1Ph.mjs → rolldown-Vl5SnJ_J.mjs} +2 -1
- package/dist/shared/{rolldown-build-B3XDwemQ.mjs → rolldown-build-7kWB1jqY.mjs} +7 -3
- package/dist/shared/{utils-B3dcnHc8.d.mts → utils-BGxZdOXA.d.mts} +2 -2
- package/dist/shared/{watch-BHMj7YNj.mjs → watch-CGYro6go.mjs} +4 -3
- package/package.json +16 -16
- package/dist/shared/composable-filters-G1eqjHFo.mjs +0 -122
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
//#region ../pluginutils/dist/utils.js
|
|
2
|
+
const postfixRE = /[?#].*$/;
|
|
3
|
+
function cleanUrl(url) {
|
|
4
|
+
return url.replace(postfixRE, "");
|
|
5
|
+
}
|
|
6
|
+
function extractQueryWithoutFragment(url) {
|
|
7
|
+
const questionMarkIndex = url.indexOf("?");
|
|
8
|
+
if (questionMarkIndex === -1) return "";
|
|
9
|
+
const fragmentIndex = url.indexOf("#", questionMarkIndex);
|
|
10
|
+
if (fragmentIndex === -1) return url.substring(questionMarkIndex);
|
|
11
|
+
else return url.substring(questionMarkIndex, fragmentIndex);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region ../pluginutils/dist/filter/composable-filters.js
|
|
16
|
+
var And = class {
|
|
17
|
+
kind;
|
|
18
|
+
args;
|
|
19
|
+
constructor(...args) {
|
|
20
|
+
if (args.length === 0) throw new Error("`And` expects at least one operand");
|
|
21
|
+
this.args = args;
|
|
22
|
+
this.kind = "and";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var Or = class {
|
|
26
|
+
kind;
|
|
27
|
+
args;
|
|
28
|
+
constructor(...args) {
|
|
29
|
+
if (args.length === 0) throw new Error("`Or` expects at least one operand");
|
|
30
|
+
this.args = args;
|
|
31
|
+
this.kind = "or";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var Not = class {
|
|
35
|
+
kind;
|
|
36
|
+
expr;
|
|
37
|
+
constructor(expr) {
|
|
38
|
+
this.expr = expr;
|
|
39
|
+
this.kind = "not";
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var Id = class {
|
|
43
|
+
kind;
|
|
44
|
+
pattern;
|
|
45
|
+
params;
|
|
46
|
+
constructor(pattern, params) {
|
|
47
|
+
this.pattern = pattern;
|
|
48
|
+
this.kind = "id";
|
|
49
|
+
this.params = params ?? { cleanUrl: false };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var ImporterId = class {
|
|
53
|
+
kind;
|
|
54
|
+
pattern;
|
|
55
|
+
params;
|
|
56
|
+
constructor(pattern, params) {
|
|
57
|
+
this.pattern = pattern;
|
|
58
|
+
this.kind = "importerId";
|
|
59
|
+
this.params = params ?? { cleanUrl: false };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var ModuleType = class {
|
|
63
|
+
kind;
|
|
64
|
+
pattern;
|
|
65
|
+
constructor(pattern) {
|
|
66
|
+
this.pattern = pattern;
|
|
67
|
+
this.kind = "moduleType";
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var Code = class {
|
|
71
|
+
kind;
|
|
72
|
+
pattern;
|
|
73
|
+
constructor(expr) {
|
|
74
|
+
this.pattern = expr;
|
|
75
|
+
this.kind = "code";
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var Query = class {
|
|
79
|
+
kind;
|
|
80
|
+
key;
|
|
81
|
+
pattern;
|
|
82
|
+
constructor(key, pattern) {
|
|
83
|
+
this.pattern = pattern;
|
|
84
|
+
this.key = key;
|
|
85
|
+
this.kind = "query";
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var Include = class {
|
|
89
|
+
kind;
|
|
90
|
+
expr;
|
|
91
|
+
constructor(expr) {
|
|
92
|
+
this.expr = expr;
|
|
93
|
+
this.kind = "include";
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var Exclude = class {
|
|
97
|
+
kind;
|
|
98
|
+
expr;
|
|
99
|
+
constructor(expr) {
|
|
100
|
+
this.expr = expr;
|
|
101
|
+
this.kind = "exclude";
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
function and(...args) {
|
|
105
|
+
return new And(...args);
|
|
106
|
+
}
|
|
107
|
+
function or(...args) {
|
|
108
|
+
return new Or(...args);
|
|
109
|
+
}
|
|
110
|
+
function not(expr) {
|
|
111
|
+
return new Not(expr);
|
|
112
|
+
}
|
|
113
|
+
function id(pattern, params) {
|
|
114
|
+
return new Id(pattern, params);
|
|
115
|
+
}
|
|
116
|
+
function importerId(pattern, params) {
|
|
117
|
+
return new ImporterId(pattern, params);
|
|
118
|
+
}
|
|
119
|
+
function moduleType(pattern) {
|
|
120
|
+
return new ModuleType(pattern);
|
|
121
|
+
}
|
|
122
|
+
function code(pattern) {
|
|
123
|
+
return new Code(pattern);
|
|
124
|
+
}
|
|
125
|
+
function query(key, pattern) {
|
|
126
|
+
return new Query(key, pattern);
|
|
127
|
+
}
|
|
128
|
+
function include(expr) {
|
|
129
|
+
return new Include(expr);
|
|
130
|
+
}
|
|
131
|
+
function exclude(expr) {
|
|
132
|
+
return new Exclude(expr);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* convert a queryObject to FilterExpression like
|
|
136
|
+
* ```js
|
|
137
|
+
* and(query(k1, v1), query(k2, v2))
|
|
138
|
+
* ```
|
|
139
|
+
* @param queryFilterObject The query filter object needs to be matched.
|
|
140
|
+
* @returns a `And` FilterExpression
|
|
141
|
+
*/
|
|
142
|
+
function queries(queryFilter) {
|
|
143
|
+
return and(...Object.entries(queryFilter).map(([key, value]) => {
|
|
144
|
+
return new Query(key, value);
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
function interpreter(exprs, code$1, id$1, moduleType$1, importerId$1) {
|
|
148
|
+
let arr = [];
|
|
149
|
+
if (Array.isArray(exprs)) arr = exprs;
|
|
150
|
+
else arr = [exprs];
|
|
151
|
+
return interpreterImpl(arr, code$1, id$1, moduleType$1, importerId$1);
|
|
152
|
+
}
|
|
153
|
+
function interpreterImpl(expr, code$1, id$1, moduleType$1, importerId$1, ctx = {}) {
|
|
154
|
+
let hasInclude = false;
|
|
155
|
+
for (const e of expr) switch (e.kind) {
|
|
156
|
+
case "include":
|
|
157
|
+
hasInclude = true;
|
|
158
|
+
if (exprInterpreter(e.expr, code$1, id$1, moduleType$1, importerId$1, ctx)) return true;
|
|
159
|
+
break;
|
|
160
|
+
case "exclude":
|
|
161
|
+
if (exprInterpreter(e.expr, code$1, id$1, moduleType$1, importerId$1, ctx)) return false;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
return !hasInclude;
|
|
165
|
+
}
|
|
166
|
+
function exprInterpreter(expr, code$1, id$1, moduleType$1, importerId$1, ctx = {}) {
|
|
167
|
+
switch (expr.kind) {
|
|
168
|
+
case "and": return expr.args.every((e) => exprInterpreter(e, code$1, id$1, moduleType$1, importerId$1, ctx));
|
|
169
|
+
case "or": return expr.args.some((e) => exprInterpreter(e, code$1, id$1, moduleType$1, importerId$1, ctx));
|
|
170
|
+
case "not": return !exprInterpreter(expr.expr, code$1, id$1, moduleType$1, importerId$1, ctx);
|
|
171
|
+
case "id": {
|
|
172
|
+
if (id$1 === void 0) throw new Error("`id` is required for `id` expression");
|
|
173
|
+
let idToMatch = id$1;
|
|
174
|
+
if (expr.params.cleanUrl) idToMatch = cleanUrl(idToMatch);
|
|
175
|
+
return typeof expr.pattern === "string" ? idToMatch === expr.pattern : expr.pattern.test(idToMatch);
|
|
176
|
+
}
|
|
177
|
+
case "importerId": {
|
|
178
|
+
if (importerId$1 === void 0) return false;
|
|
179
|
+
let importerIdToMatch = importerId$1;
|
|
180
|
+
if (expr.params.cleanUrl) importerIdToMatch = cleanUrl(importerIdToMatch);
|
|
181
|
+
return typeof expr.pattern === "string" ? importerIdToMatch === expr.pattern : expr.pattern.test(importerIdToMatch);
|
|
182
|
+
}
|
|
183
|
+
case "moduleType":
|
|
184
|
+
if (moduleType$1 === void 0) throw new Error("`moduleType` is required for `moduleType` expression");
|
|
185
|
+
return moduleType$1 === expr.pattern;
|
|
186
|
+
case "code":
|
|
187
|
+
if (code$1 === void 0) throw new Error("`code` is required for `code` expression");
|
|
188
|
+
return typeof expr.pattern === "string" ? code$1.includes(expr.pattern) : expr.pattern.test(code$1);
|
|
189
|
+
case "query": {
|
|
190
|
+
if (id$1 === void 0) throw new Error("`id` is required for `Query` expression");
|
|
191
|
+
if (!ctx.urlSearchParamsCache) {
|
|
192
|
+
let queryString = extractQueryWithoutFragment(id$1);
|
|
193
|
+
ctx.urlSearchParamsCache = new URLSearchParams(queryString);
|
|
194
|
+
}
|
|
195
|
+
let urlParams = ctx.urlSearchParamsCache;
|
|
196
|
+
if (typeof expr.pattern === "boolean") if (expr.pattern) return urlParams.has(expr.key);
|
|
197
|
+
else return !urlParams.has(expr.key);
|
|
198
|
+
else if (typeof expr.pattern === "string") return urlParams.get(expr.key) === expr.pattern;
|
|
199
|
+
else return expr.pattern.test(urlParams.get(expr.key) ?? "");
|
|
200
|
+
}
|
|
201
|
+
default: throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
//#endregion
|
|
206
|
+
export { id as a, interpreter as c, not as d, or as f, exprInterpreter as i, interpreterImpl as l, query as m, code as n, importerId as o, queries as p, exclude as r, include as s, and as t, moduleType as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, h as BindingViteBuildImportAnalysisPluginConfig, i as BindingEsmExternalRequirePluginConfig, k as BindingViteWasmHelperPluginConfig, o as BindingIsolatedDeclarationPluginConfig, p as BindingViteAssetImportMetaUrlPluginConfig, v as BindingViteDynamicImportVarsPluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteHtmlInlineProxyPluginConfig } from "./binding-
|
|
2
|
-
import { t as BuiltinPlugin, u as StringOrRegExp } from "./utils-
|
|
1
|
+
import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, h as BindingViteBuildImportAnalysisPluginConfig, i as BindingEsmExternalRequirePluginConfig, k as BindingViteWasmHelperPluginConfig, o as BindingIsolatedDeclarationPluginConfig, p as BindingViteAssetImportMetaUrlPluginConfig, v as BindingViteDynamicImportVarsPluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteHtmlInlineProxyPluginConfig } from "./binding-MAEzB4KA.mjs";
|
|
2
|
+
import { t as BuiltinPlugin, u as StringOrRegExp } from "./utils-BGxZdOXA.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/builtin-plugin/constructors.d.ts
|
|
5
5
|
declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as BuiltinPlugin, s as makeBuiltinPluginCallable, t as normalizedStringOrRegex } from "./normalize-string-or-regex-
|
|
1
|
+
import { n as BuiltinPlugin, s as makeBuiltinPluginCallable, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CIiT1lMg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/builtin-plugin/constructors.ts
|
|
4
4
|
function viteModulePreloadPolyfillPlugin(config) {
|