@rolldown/browser 1.0.0-beta.8-commit.852c603 → 1.0.0-beta.8-commit.baf6ca1
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/browser.mjs +113 -119
- package/dist/cli.cjs +7 -7
- package/dist/cli.mjs +3 -3
- package/dist/experimental-index.cjs +3 -3
- package/dist/experimental-index.d.cts +1 -1
- package/dist/experimental-index.d.mts +1 -1
- package/dist/experimental-index.mjs +3 -3
- package/dist/filter-index.cjs +12 -0
- package/dist/{filter-expression-index.d.cts → filter-index.d.cts} +2 -2
- package/dist/{filter-expression-index.d.mts → filter-index.d.mts} +2 -2
- package/dist/filter-index.mjs +4 -0
- package/dist/index.cjs +4 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -4
- package/dist/parallel-plugin-worker.cjs +3 -3
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.cts +1 -1
- package/dist/parallel-plugin.d.mts +1 -1
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/filter-index-ChddWdsi.cjs +255 -0
- package/dist/shared/filter-index-DmisSKZF.mjs +174 -0
- package/dist/shared/{input-options.d-D_2wMOSn.d.mts → input-options.d-9IzFBPMw.d.mts} +13 -16
- package/dist/shared/{input-options.d-C0G2toUx.d.cts → input-options.d-BFt2wKBM.d.cts} +13 -16
- package/dist/shared/{src-RM00Zc4c.mjs → src-DN1_B1_m.mjs} +53 -126
- package/dist/shared/{src-DbbYa-_8.cjs → src-glXqJCVJ.cjs} +64 -138
- package/package.json +1 -1
- package/dist/filter-expression-index.cjs +0 -11
- package/dist/filter-expression-index.mjs +0 -4
- package/dist/shared/filter-expression-index-CIS7Rrin.mjs +0 -69
- package/dist/shared/filter-expression-index-CRtoeipP.cjs +0 -119
- /package/dist/shared/{parse-ast-index-DWHg_E7J.mjs → parse-ast-index-B5wGnMSg.mjs} +0 -0
- /package/dist/shared/{parse-ast-index-B9pj8J1q.cjs → parse-ast-index-DTWvag1h.cjs} +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/misc.ts
|
|
4
|
+
function arraify(value) {
|
|
5
|
+
return Array.isArray(value) ? value : [value];
|
|
6
|
+
}
|
|
7
|
+
function isNullish(value) {
|
|
8
|
+
return value === null || value === void 0;
|
|
9
|
+
}
|
|
10
|
+
function isPromiseLike(value) {
|
|
11
|
+
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
12
|
+
}
|
|
13
|
+
function unimplemented(info) {
|
|
14
|
+
if (info) throw new Error(`unimplemented: ${info}`);
|
|
15
|
+
throw new Error("unimplemented");
|
|
16
|
+
}
|
|
17
|
+
function unreachable(info) {
|
|
18
|
+
if (info) throw new Error(`unreachable: ${info}`);
|
|
19
|
+
throw new Error("unreachable");
|
|
20
|
+
}
|
|
21
|
+
function unsupported(info) {
|
|
22
|
+
throw new Error(`UNSUPPORTED: ${info}`);
|
|
23
|
+
}
|
|
24
|
+
function noop(..._args) {}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/plugin/with-filter.ts
|
|
28
|
+
function withFilterImpl(pluginOption, filterObjectList) {
|
|
29
|
+
if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
|
|
30
|
+
if (pluginOption == false || pluginOption == null) return pluginOption;
|
|
31
|
+
if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
|
|
32
|
+
let plugin = pluginOption;
|
|
33
|
+
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
|
34
|
+
if (filterObjectIndex === -1) return plugin;
|
|
35
|
+
let filterObject = filterObjectList[filterObjectIndex];
|
|
36
|
+
Object.keys(plugin).forEach((key) => {
|
|
37
|
+
switch (key) {
|
|
38
|
+
case "transform":
|
|
39
|
+
case "resolveId":
|
|
40
|
+
case "load":
|
|
41
|
+
if (!plugin[key]) return;
|
|
42
|
+
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
|
43
|
+
else plugin[key] = {
|
|
44
|
+
handler: plugin[key],
|
|
45
|
+
filter: filterObject[key]
|
|
46
|
+
};
|
|
47
|
+
break;
|
|
48
|
+
default: break;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return plugin;
|
|
52
|
+
}
|
|
53
|
+
function withFilter(pluginOption, filterObject) {
|
|
54
|
+
return withFilterImpl(pluginOption, arraify(filterObject));
|
|
55
|
+
}
|
|
56
|
+
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
57
|
+
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
58
|
+
for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
|
|
59
|
+
let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
|
|
60
|
+
if (typeof pattern === "string" && pattern === pluginName) return i;
|
|
61
|
+
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
|
|
62
|
+
}
|
|
63
|
+
return -1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/filter-index.ts
|
|
68
|
+
var And = class {
|
|
69
|
+
kind;
|
|
70
|
+
args;
|
|
71
|
+
constructor(...args) {
|
|
72
|
+
if (args.length === 0) throw new Error("`And` expects at least one operand");
|
|
73
|
+
this.args = args;
|
|
74
|
+
this.kind = "and";
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var Or = class {
|
|
78
|
+
kind;
|
|
79
|
+
args;
|
|
80
|
+
constructor(...args) {
|
|
81
|
+
if (args.length === 0) throw new Error("`Or` expects at least one operand");
|
|
82
|
+
this.args = args;
|
|
83
|
+
this.kind = "or";
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var Not = class {
|
|
87
|
+
kind;
|
|
88
|
+
expr;
|
|
89
|
+
constructor(expr) {
|
|
90
|
+
this.expr = expr;
|
|
91
|
+
this.kind = "not";
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var Id = class {
|
|
95
|
+
kind;
|
|
96
|
+
pattern;
|
|
97
|
+
constructor(pattern) {
|
|
98
|
+
this.pattern = pattern;
|
|
99
|
+
this.kind = "id";
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var ModuleType = class {
|
|
103
|
+
kind;
|
|
104
|
+
pattern;
|
|
105
|
+
constructor(pattern) {
|
|
106
|
+
this.pattern = pattern;
|
|
107
|
+
this.kind = "moduleType";
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var Code = class {
|
|
111
|
+
kind;
|
|
112
|
+
pattern;
|
|
113
|
+
constructor(expr) {
|
|
114
|
+
this.pattern = expr;
|
|
115
|
+
this.kind = "code";
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var Include = class {
|
|
119
|
+
kind;
|
|
120
|
+
expr;
|
|
121
|
+
constructor(expr) {
|
|
122
|
+
this.expr = expr;
|
|
123
|
+
this.kind = "include";
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var Exclude = class {
|
|
127
|
+
kind;
|
|
128
|
+
expr;
|
|
129
|
+
constructor(expr) {
|
|
130
|
+
this.expr = expr;
|
|
131
|
+
this.kind = "exclude";
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
function and(...args) {
|
|
135
|
+
return new And(...args);
|
|
136
|
+
}
|
|
137
|
+
function or(...args) {
|
|
138
|
+
return new Or(...args);
|
|
139
|
+
}
|
|
140
|
+
function not(expr) {
|
|
141
|
+
return new Not(expr);
|
|
142
|
+
}
|
|
143
|
+
function id(pattern) {
|
|
144
|
+
return new Id(pattern);
|
|
145
|
+
}
|
|
146
|
+
function moduleType(pattern) {
|
|
147
|
+
return new ModuleType(pattern);
|
|
148
|
+
}
|
|
149
|
+
function code(pattern) {
|
|
150
|
+
return new Code(pattern);
|
|
151
|
+
}
|
|
152
|
+
function include(expr) {
|
|
153
|
+
return new Include(expr);
|
|
154
|
+
}
|
|
155
|
+
function exclude(expr) {
|
|
156
|
+
return new Exclude(expr);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
//#endregion
|
|
160
|
+
Object.defineProperty(exports, 'And', {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
get: function () {
|
|
163
|
+
return And;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
Object.defineProperty(exports, 'and', {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: function () {
|
|
169
|
+
return and;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
Object.defineProperty(exports, 'arraify', {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
get: function () {
|
|
175
|
+
return arraify;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
Object.defineProperty(exports, 'code', {
|
|
179
|
+
enumerable: true,
|
|
180
|
+
get: function () {
|
|
181
|
+
return code;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
Object.defineProperty(exports, 'exclude', {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
get: function () {
|
|
187
|
+
return exclude;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(exports, 'id', {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
get: function () {
|
|
193
|
+
return id;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
Object.defineProperty(exports, 'include', {
|
|
197
|
+
enumerable: true,
|
|
198
|
+
get: function () {
|
|
199
|
+
return include;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
Object.defineProperty(exports, 'isNullish', {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
get: function () {
|
|
205
|
+
return isNullish;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
Object.defineProperty(exports, 'moduleType', {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
get: function () {
|
|
211
|
+
return moduleType;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
Object.defineProperty(exports, 'noop', {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
get: function () {
|
|
217
|
+
return noop;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
Object.defineProperty(exports, 'not', {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
get: function () {
|
|
223
|
+
return not;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(exports, 'or', {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
get: function () {
|
|
229
|
+
return or;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
Object.defineProperty(exports, 'unimplemented', {
|
|
233
|
+
enumerable: true,
|
|
234
|
+
get: function () {
|
|
235
|
+
return unimplemented;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
Object.defineProperty(exports, 'unreachable', {
|
|
239
|
+
enumerable: true,
|
|
240
|
+
get: function () {
|
|
241
|
+
return unreachable;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
Object.defineProperty(exports, 'unsupported', {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
get: function () {
|
|
247
|
+
return unsupported;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
Object.defineProperty(exports, 'withFilter', {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
get: function () {
|
|
253
|
+
return withFilter;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { __esm } from "./chunk-DSsiIF1Z.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/misc.ts
|
|
4
|
+
function arraify(value) {
|
|
5
|
+
return Array.isArray(value) ? value : [value];
|
|
6
|
+
}
|
|
7
|
+
function isNullish(value) {
|
|
8
|
+
return value === null || value === void 0;
|
|
9
|
+
}
|
|
10
|
+
function isPromiseLike(value) {
|
|
11
|
+
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
12
|
+
}
|
|
13
|
+
function unimplemented(info) {
|
|
14
|
+
if (info) throw new Error(`unimplemented: ${info}`);
|
|
15
|
+
throw new Error("unimplemented");
|
|
16
|
+
}
|
|
17
|
+
function unreachable(info) {
|
|
18
|
+
if (info) throw new Error(`unreachable: ${info}`);
|
|
19
|
+
throw new Error("unreachable");
|
|
20
|
+
}
|
|
21
|
+
function unsupported(info) {
|
|
22
|
+
throw new Error(`UNSUPPORTED: ${info}`);
|
|
23
|
+
}
|
|
24
|
+
function noop(..._args) {}
|
|
25
|
+
var init_misc = __esm({ "src/utils/misc.ts"() {} });
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/plugin/with-filter.ts
|
|
29
|
+
function withFilterImpl(pluginOption, filterObjectList) {
|
|
30
|
+
if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
|
|
31
|
+
if (pluginOption == false || pluginOption == null) return pluginOption;
|
|
32
|
+
if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
|
|
33
|
+
let plugin = pluginOption;
|
|
34
|
+
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
|
35
|
+
if (filterObjectIndex === -1) return plugin;
|
|
36
|
+
let filterObject = filterObjectList[filterObjectIndex];
|
|
37
|
+
Object.keys(plugin).forEach((key) => {
|
|
38
|
+
switch (key) {
|
|
39
|
+
case "transform":
|
|
40
|
+
case "resolveId":
|
|
41
|
+
case "load":
|
|
42
|
+
if (!plugin[key]) return;
|
|
43
|
+
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
|
44
|
+
else plugin[key] = {
|
|
45
|
+
handler: plugin[key],
|
|
46
|
+
filter: filterObject[key]
|
|
47
|
+
};
|
|
48
|
+
break;
|
|
49
|
+
default: break;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return plugin;
|
|
53
|
+
}
|
|
54
|
+
function withFilter(pluginOption, filterObject) {
|
|
55
|
+
return withFilterImpl(pluginOption, arraify(filterObject));
|
|
56
|
+
}
|
|
57
|
+
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
58
|
+
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
59
|
+
for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
|
|
60
|
+
let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
|
|
61
|
+
if (typeof pattern === "string" && pattern === pluginName) return i;
|
|
62
|
+
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
|
|
63
|
+
}
|
|
64
|
+
return -1;
|
|
65
|
+
}
|
|
66
|
+
var init_with_filter = __esm({ "src/plugin/with-filter.ts"() {
|
|
67
|
+
init_misc();
|
|
68
|
+
} });
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/plugin/index.ts
|
|
72
|
+
var init_plugin = __esm({ "src/plugin/index.ts"() {
|
|
73
|
+
init_with_filter();
|
|
74
|
+
} });
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/filter-index.ts
|
|
78
|
+
function and(...args) {
|
|
79
|
+
return new And(...args);
|
|
80
|
+
}
|
|
81
|
+
function or(...args) {
|
|
82
|
+
return new Or(...args);
|
|
83
|
+
}
|
|
84
|
+
function not(expr) {
|
|
85
|
+
return new Not(expr);
|
|
86
|
+
}
|
|
87
|
+
function id(pattern) {
|
|
88
|
+
return new Id(pattern);
|
|
89
|
+
}
|
|
90
|
+
function moduleType(pattern) {
|
|
91
|
+
return new ModuleType(pattern);
|
|
92
|
+
}
|
|
93
|
+
function code(pattern) {
|
|
94
|
+
return new Code(pattern);
|
|
95
|
+
}
|
|
96
|
+
function include(expr) {
|
|
97
|
+
return new Include(expr);
|
|
98
|
+
}
|
|
99
|
+
function exclude(expr) {
|
|
100
|
+
return new Exclude(expr);
|
|
101
|
+
}
|
|
102
|
+
var And, Or, Not, Id, ModuleType, Code, Include, Exclude;
|
|
103
|
+
var init_filter_index = __esm({ "src/filter-index.ts"() {
|
|
104
|
+
init_plugin();
|
|
105
|
+
And = class {
|
|
106
|
+
kind;
|
|
107
|
+
args;
|
|
108
|
+
constructor(...args) {
|
|
109
|
+
if (args.length === 0) throw new Error("`And` expects at least one operand");
|
|
110
|
+
this.args = args;
|
|
111
|
+
this.kind = "and";
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
Or = class {
|
|
115
|
+
kind;
|
|
116
|
+
args;
|
|
117
|
+
constructor(...args) {
|
|
118
|
+
if (args.length === 0) throw new Error("`Or` expects at least one operand");
|
|
119
|
+
this.args = args;
|
|
120
|
+
this.kind = "or";
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
Not = class {
|
|
124
|
+
kind;
|
|
125
|
+
expr;
|
|
126
|
+
constructor(expr) {
|
|
127
|
+
this.expr = expr;
|
|
128
|
+
this.kind = "not";
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
Id = class {
|
|
132
|
+
kind;
|
|
133
|
+
pattern;
|
|
134
|
+
constructor(pattern) {
|
|
135
|
+
this.pattern = pattern;
|
|
136
|
+
this.kind = "id";
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
ModuleType = class {
|
|
140
|
+
kind;
|
|
141
|
+
pattern;
|
|
142
|
+
constructor(pattern) {
|
|
143
|
+
this.pattern = pattern;
|
|
144
|
+
this.kind = "moduleType";
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
Code = class {
|
|
148
|
+
kind;
|
|
149
|
+
pattern;
|
|
150
|
+
constructor(expr) {
|
|
151
|
+
this.pattern = expr;
|
|
152
|
+
this.kind = "code";
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
Include = class {
|
|
156
|
+
kind;
|
|
157
|
+
expr;
|
|
158
|
+
constructor(expr) {
|
|
159
|
+
this.expr = expr;
|
|
160
|
+
this.kind = "include";
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
Exclude = class {
|
|
164
|
+
kind;
|
|
165
|
+
expr;
|
|
166
|
+
constructor(expr) {
|
|
167
|
+
this.expr = expr;
|
|
168
|
+
this.kind = "exclude";
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
} });
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
export { And, and, arraify, code, exclude, id, include, init_filter_index, init_misc, isNullish, moduleType, noop, not, or, unimplemented, unreachable, unsupported, withFilter };
|
|
@@ -418,21 +418,19 @@ interface NormalizedOutputOptions {
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
//#endregion
|
|
421
|
-
//#region src/filter-
|
|
421
|
+
//#region src/filter-index.d.ts
|
|
422
422
|
type FilterExpressionKind = FilterExpression["kind"];
|
|
423
423
|
type FilterExpression = And | Or | Not | Id | ModuleType$1 | Code | Include | Exclude$1;
|
|
424
424
|
type TopLevelFilterExpression = Include | Exclude$1;
|
|
425
425
|
declare class And {
|
|
426
426
|
kind: "and";
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
constructor(left: FilterExpression, right: FilterExpression);
|
|
427
|
+
args: FilterExpression[];
|
|
428
|
+
constructor(...args: FilterExpression[]);
|
|
430
429
|
}
|
|
431
430
|
declare class Or {
|
|
432
431
|
kind: "or";
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
constructor(left: FilterExpression, right: FilterExpression);
|
|
432
|
+
args: FilterExpression[];
|
|
433
|
+
constructor(...args: FilterExpression[]);
|
|
436
434
|
}
|
|
437
435
|
declare class Not {
|
|
438
436
|
kind: "not";
|
|
@@ -464,8 +462,8 @@ declare class Exclude$1 {
|
|
|
464
462
|
expr: FilterExpression;
|
|
465
463
|
constructor(expr: FilterExpression);
|
|
466
464
|
}
|
|
467
|
-
declare function and(
|
|
468
|
-
declare function or(
|
|
465
|
+
declare function and(...args: FilterExpression[]): And;
|
|
466
|
+
declare function or(...args: FilterExpression[]): Or;
|
|
469
467
|
declare function not(expr: FilterExpression): Not;
|
|
470
468
|
declare function id(pattern: StringOrRegExp): Id;
|
|
471
469
|
declare function moduleType(pattern: ModuleType): ModuleType$1;
|
|
@@ -478,7 +476,6 @@ declare function exclude(expr: FilterExpression): Exclude$1;
|
|
|
478
476
|
type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
|
|
479
477
|
include?: MaybeArray<Value>
|
|
480
478
|
exclude?: MaybeArray<Value>
|
|
481
|
-
custom?: TopLevelFilterExpression[]
|
|
482
479
|
};
|
|
483
480
|
interface FormalModuleTypeFilter {
|
|
484
481
|
include?: ModuleType[];
|
|
@@ -520,8 +517,8 @@ interface HookFilter {
|
|
|
520
517
|
id?: GeneralHookFilter;
|
|
521
518
|
moduleType?: ModuleTypeFilter;
|
|
522
519
|
code?: GeneralHookFilter;
|
|
523
|
-
custom?: TopLevelFilterExpression[];
|
|
524
520
|
}
|
|
521
|
+
type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
|
|
525
522
|
|
|
526
523
|
//#endregion
|
|
527
524
|
//#region src/plugin/minimal-plugin-context.d.ts
|
|
@@ -860,15 +857,15 @@ type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
|
|
|
860
857
|
type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
|
|
861
858
|
type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
862
859
|
type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
|
|
863
|
-
filter?: HookFilter
|
|
860
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>
|
|
864
861
|
} : K extends "load" ? {
|
|
865
|
-
filter?: Pick<HookFilter, "id"
|
|
862
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>
|
|
866
863
|
} : K extends "resolveId" ? {
|
|
867
|
-
filter?: {
|
|
864
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<{
|
|
868
865
|
id?: GeneralHookFilter<RegExp>
|
|
869
|
-
}
|
|
866
|
+
}>
|
|
870
867
|
} : K extends "renderChunk" ? {
|
|
871
|
-
filter?: Pick<HookFilter, "code"
|
|
868
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>
|
|
872
869
|
} : {};
|
|
873
870
|
type PluginHooks = { [K in keyof FunctionPluginHooks] : ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
|
|
874
871
|
/**
|
|
@@ -418,21 +418,19 @@ interface NormalizedOutputOptions {
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
//#endregion
|
|
421
|
-
//#region src/filter-
|
|
421
|
+
//#region src/filter-index.d.ts
|
|
422
422
|
type FilterExpressionKind = FilterExpression["kind"];
|
|
423
423
|
type FilterExpression = And | Or | Not | Id | ModuleType$1 | Code | Include | Exclude$1;
|
|
424
424
|
type TopLevelFilterExpression = Include | Exclude$1;
|
|
425
425
|
declare class And {
|
|
426
426
|
kind: "and";
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
constructor(left: FilterExpression, right: FilterExpression);
|
|
427
|
+
args: FilterExpression[];
|
|
428
|
+
constructor(...args: FilterExpression[]);
|
|
430
429
|
}
|
|
431
430
|
declare class Or {
|
|
432
431
|
kind: "or";
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
constructor(left: FilterExpression, right: FilterExpression);
|
|
432
|
+
args: FilterExpression[];
|
|
433
|
+
constructor(...args: FilterExpression[]);
|
|
436
434
|
}
|
|
437
435
|
declare class Not {
|
|
438
436
|
kind: "not";
|
|
@@ -464,8 +462,8 @@ declare class Exclude$1 {
|
|
|
464
462
|
expr: FilterExpression;
|
|
465
463
|
constructor(expr: FilterExpression);
|
|
466
464
|
}
|
|
467
|
-
declare function and(
|
|
468
|
-
declare function or(
|
|
465
|
+
declare function and(...args: FilterExpression[]): And;
|
|
466
|
+
declare function or(...args: FilterExpression[]): Or;
|
|
469
467
|
declare function not(expr: FilterExpression): Not;
|
|
470
468
|
declare function id(pattern: StringOrRegExp): Id;
|
|
471
469
|
declare function moduleType(pattern: ModuleType): ModuleType$1;
|
|
@@ -478,7 +476,6 @@ declare function exclude(expr: FilterExpression): Exclude$1;
|
|
|
478
476
|
type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
|
|
479
477
|
include?: MaybeArray<Value>
|
|
480
478
|
exclude?: MaybeArray<Value>
|
|
481
|
-
custom?: TopLevelFilterExpression[]
|
|
482
479
|
};
|
|
483
480
|
interface FormalModuleTypeFilter {
|
|
484
481
|
include?: ModuleType[];
|
|
@@ -520,8 +517,8 @@ interface HookFilter {
|
|
|
520
517
|
id?: GeneralHookFilter;
|
|
521
518
|
moduleType?: ModuleTypeFilter;
|
|
522
519
|
code?: GeneralHookFilter;
|
|
523
|
-
custom?: TopLevelFilterExpression[];
|
|
524
520
|
}
|
|
521
|
+
type TUnionWithTopLevelFilterExpressionArray<T> = T | TopLevelFilterExpression[];
|
|
525
522
|
|
|
526
523
|
//#endregion
|
|
527
524
|
//#region src/plugin/minimal-plugin-context.d.ts
|
|
@@ -860,15 +857,15 @@ type AddonHooks = DefinedHookNames["banner" | "footer" | "intro" | "outro"];
|
|
|
860
857
|
type OutputPluginHooks = DefinedHookNames["augmentChunkHash" | "generateBundle" | "outputOptions" | "renderChunk" | "renderError" | "renderStart" | "writeBundle"];
|
|
861
858
|
type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
|
|
862
859
|
type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
|
|
863
|
-
filter?: HookFilter
|
|
860
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<HookFilter>
|
|
864
861
|
} : K extends "load" ? {
|
|
865
|
-
filter?: Pick<HookFilter, "id"
|
|
862
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "id">>
|
|
866
863
|
} : K extends "resolveId" ? {
|
|
867
|
-
filter?: {
|
|
864
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<{
|
|
868
865
|
id?: GeneralHookFilter<RegExp>
|
|
869
|
-
}
|
|
866
|
+
}>
|
|
870
867
|
} : K extends "renderChunk" ? {
|
|
871
|
-
filter?: Pick<HookFilter, "code"
|
|
868
|
+
filter?: TUnionWithTopLevelFilterExpressionArray<Pick<HookFilter, "code">>
|
|
872
869
|
} : {};
|
|
873
870
|
type PluginHooks = { [K in keyof FunctionPluginHooks] : ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
|
|
874
871
|
/**
|