@ohos-ports/rolldown 1.2.6-beta.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.
Files changed (54) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +11 -0
  3. package/THIRD-PARTY-LICENSE +33 -0
  4. package/bin/cli.mjs +11 -0
  5. package/dist/cli.d.mts +1 -0
  6. package/dist/cli.mjs +1208 -0
  7. package/dist/config.d.mts +26 -0
  8. package/dist/config.mjs +4 -0
  9. package/dist/experimental-default-runtime.mjs +116 -0
  10. package/dist/experimental-index.d.mts +324 -0
  11. package/dist/experimental-index.mjs +383 -0
  12. package/dist/experimental-runtime-base.mjs +95 -0
  13. package/dist/experimental-runtime-types.d.ts +177 -0
  14. package/dist/experimental-runtime.d.ts +177 -0
  15. package/dist/experimental-runtime.mjs +257 -0
  16. package/dist/filter-index.d.mts +196 -0
  17. package/dist/filter-index.mjs +376 -0
  18. package/dist/get-log-filter.d.mts +3 -0
  19. package/dist/get-log-filter.mjs +68 -0
  20. package/dist/index.d.mts +4 -0
  21. package/dist/index.mjs +56 -0
  22. package/dist/parallel-plugin-worker.d.mts +1 -0
  23. package/dist/parallel-plugin-worker.mjs +29 -0
  24. package/dist/parallel-plugin.d.mts +12 -0
  25. package/dist/parallel-plugin.mjs +6 -0
  26. package/dist/parse-ast-index.d.mts +30 -0
  27. package/dist/parse-ast-index.mjs +60 -0
  28. package/dist/plugins-index.d.mts +32 -0
  29. package/dist/plugins-index.mjs +40 -0
  30. package/dist/shared/binding-CtPG-2KR.mjs +675 -0
  31. package/dist/shared/binding-Og__jmUi.d.mts +2065 -0
  32. package/dist/shared/bindingify-input-options-4JJxbZl2.mjs +2416 -0
  33. package/dist/shared/constructors-Qrp2Xr6w.d.mts +35 -0
  34. package/dist/shared/constructors-ltBDfHX1.mjs +69 -0
  35. package/dist/shared/create-bundler-option-DSPiA5F7.mjs +3220 -0
  36. package/dist/shared/define-config-Demdg3_4.mjs +6 -0
  37. package/dist/shared/define-config-Nbz-lniw.d.mts +4101 -0
  38. package/dist/shared/dist-DKbukT1H.mjs +154 -0
  39. package/dist/shared/error-HDibX49O.mjs +85 -0
  40. package/dist/shared/get-log-filter-AjBknEEO.d.mts +34 -0
  41. package/dist/shared/load-config-BMUrE9HH.mjs +137 -0
  42. package/dist/shared/logging-xuHO4mAy.d.mts +50 -0
  43. package/dist/shared/logs-DmYCAKcW.mjs +192 -0
  44. package/dist/shared/misc-DOSKtd97.mjs +29 -0
  45. package/dist/shared/normalize-string-or-regex-DWz4it3p.mjs +68 -0
  46. package/dist/shared/parse-D0g29RgN.mjs +74 -0
  47. package/dist/shared/prompt-CH6TK0bC.mjs +885 -0
  48. package/dist/shared/resolve-tsconfig-CLYpUIZC.mjs +128 -0
  49. package/dist/shared/rolldown-C9Hfg50O.mjs +179 -0
  50. package/dist/shared/transform-DR4CXeQm.d.mts +152 -0
  51. package/dist/shared/watch-UbzgabQn.mjs +377 -0
  52. package/dist/utils-index.d.mts +375 -0
  53. package/dist/utils-index.mjs +2416 -0
  54. package/package.json +159 -0
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
3
+ * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
4
+ * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
5
+ * @typedef {{ ids: string[], localCount: number, edges: number[][], dynamicEdges?: number[][] }} ModuleGraphDelta
6
+ * @typedef {{ createModuleHotContext(moduleId: string): any, onModuleCacheRemoval(moduleId: string): void }} DevRuntimeHooks
7
+ */
8
+ export class MissingFactoryError {
9
+ /**
10
+ * @param {string} id
11
+ */
12
+ constructor(id: string);
13
+ id: string;
14
+ }
15
+ export class DevRuntime {
16
+ /**
17
+ * @param {string} clientId
18
+ */
19
+ constructor(clientId: string);
20
+ /**
21
+ * Client ID generated at runtime initialization, used for lazy compilation requests.
22
+ * @type {string}
23
+ */
24
+ clientId: string;
25
+ /**
26
+ * Static import edges from `registerGraph` — entries persist across `removeModuleCache`
27
+ * and change only by replacement from a newer payload (last write wins).
28
+ * @type {Map<string, { edges: string[] }>}
29
+ */
30
+ staticImports: Map<string, {
31
+ edges: string[];
32
+ }>;
33
+ /**
34
+ * Reverse index over the static imports.
35
+ * @type {Map<string, Set<string>>}
36
+ */
37
+ importers: Map<string, Set<string>>;
38
+ /**
39
+ * Dynamic `import()` edges from `registerGraph`, keyed by importer — mirror of
40
+ * `staticImports` for the dynamic reverse index.
41
+ * @type {Map<string, { edges: string[] }>}
42
+ */
43
+ dynamicImports: Map<string, {
44
+ edges: string[];
45
+ }>;
46
+ /**
47
+ * Reverse index over the dynamic imports.
48
+ * @type {Map<string, Set<string>>}
49
+ */
50
+ dynamicImporters: Map<string, Set<string>>;
51
+ /**
52
+ * The module cache. Membership means "this module's side effects ran in this tab" —
53
+ * registration is emitted ahead of every module body, and nothing un-registers on
54
+ * unwind, so a factory that throws mid-body stays registered. A `Map` rather than a
55
+ * plain object: HMR eviction deletes entries, and a `delete` on an object drops V8
56
+ * into dictionary mode, taxing every later lookup on the hottest read path.
57
+ * @type {Map<string, Module>}
58
+ */
59
+ moduleCache: Map<string, Module>;
60
+ /**
61
+ * Re-runnable factories from HMR patches and lazy chunks. The initial bundle stays
62
+ * scope-hoisted and contributes none.
63
+ * @type {Map<string, { kind: 'esm' | 'cjs', fn: (id: string) => void }>}
64
+ */
65
+ factories: Map<string, {
66
+ kind: "esm" | "cjs";
67
+ fn: (id: string) => void;
68
+ }>;
69
+ /**
70
+ * Installed by the dev client at boot. The runtime is a store + executor and makes
71
+ * no HMR decisions; accepting, disposing, and reloading live behind these hooks.
72
+ * @type {DevRuntimeHooks | null}
73
+ */
74
+ hooks: DevRuntimeHooks | null;
75
+ /**
76
+ * @param {ModuleGraphDelta} delta
77
+ */
78
+ registerGraph(delta: ModuleGraphDelta): void;
79
+ /**
80
+ * @param {string} id
81
+ * @param {'esm' | 'cjs'} kind
82
+ * @param {(id: string) => void} fn
83
+ */
84
+ registerFactory(id: string, kind: "esm" | "cjs", fn: (id: string) => void): void;
85
+ /**
86
+ * @param {string} id
87
+ * @param {{ exports: any }} [exportsHolder]
88
+ */
89
+ registerModule(id: string, exportsHolder?: {
90
+ exports: any;
91
+ }): void;
92
+ /**
93
+ * @param {string} id
94
+ * @returns {string[]}
95
+ */
96
+ getImporters(id: string): string[];
97
+ /**
98
+ * @param {string} id
99
+ */
100
+ isExecuted(id: string): any;
101
+ /**
102
+ * @param {string} id
103
+ */
104
+ hasFactory(id: string): any;
105
+ /**
106
+ * Module-cache delete only — static imports and factories persist. Removal is what
107
+ * re-arms a cache-gated factory for `initModule`.
108
+ * @param {string} id
109
+ */
110
+ removeModuleCache(id: string): void;
111
+ /**
112
+ * The one re-execution gate: registered → return the live exports; otherwise run the
113
+ * mapped factory (which registers itself first, then runs the body).
114
+ * @param {string} id
115
+ */
116
+ initModule(id: string): any;
117
+ /**
118
+ * @param {string} id
119
+ */
120
+ loadExports(id: string): any;
121
+ /**
122
+ * @param {string} moduleId
123
+ */
124
+ createModuleHotContext(moduleId: string): any;
125
+ /** @internal */
126
+ __toESM: any;
127
+ /** @internal */
128
+ __toCommonJS: any;
129
+ /** @internal */
130
+ __exportAll: any;
131
+ /**
132
+ * @param {boolean} [isNodeMode]
133
+ * @returns {(mod: any) => any}
134
+ * @internal
135
+ */
136
+ __toDynamicImportESM: (isNodeMode?: boolean) => (mod: any) => any;
137
+ /** @internal */
138
+ __reExport: any;
139
+ }
140
+ /**
141
+ * Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
142
+ * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
143
+ * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
144
+ */
145
+ export type ModuleGraphDelta = {
146
+ ids: string[];
147
+ localCount: number;
148
+ edges: number[][];
149
+ dynamicEdges?: number[][];
150
+ };
151
+ /**
152
+ * Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
153
+ * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
154
+ * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
155
+ */
156
+ export type DevRuntimeHooks = {
157
+ createModuleHotContext(moduleId: string): any;
158
+ onModuleCacheRemoval(moduleId: string): void;
159
+ };
160
+ declare class Module {
161
+ /**
162
+ * @param {string} id
163
+ */
164
+ constructor(id: string);
165
+ /**
166
+ * @type {{ exports: any }}
167
+ */
168
+ exportsHolder: {
169
+ exports: any;
170
+ };
171
+ /**
172
+ * @type {string}
173
+ */
174
+ id: string;
175
+ get exports(): any;
176
+ }
177
+ export {};
@@ -0,0 +1,257 @@
1
+ import { __exportAll, __reExport, __toCommonJS, __toESM } from './experimental-runtime-base.mjs';
2
+ // @ts-check
3
+
4
+ class Module {
5
+ /**
6
+ * @type {{ exports: any }}
7
+ */
8
+ exportsHolder = { exports: null };
9
+ /**
10
+ * @type {string}
11
+ */
12
+ id;
13
+
14
+ /**
15
+ * @param {string} id
16
+ */
17
+ constructor(id) {
18
+ this.id = id;
19
+ }
20
+
21
+ get exports() {
22
+ return this.exportsHolder.exports;
23
+ }
24
+ }
25
+
26
+ /**
27
+ * Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
28
+ * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
29
+ * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
30
+ * @typedef {{ ids: string[], localCount: number, edges: number[][], dynamicEdges?: number[][] }} ModuleGraphDelta
31
+ * @typedef {{ createModuleHotContext(moduleId: string): any, onModuleCacheRemoval(moduleId: string): void }} DevRuntimeHooks
32
+ */
33
+
34
+ export class MissingFactoryError extends Error {
35
+ /**
36
+ * @param {string} id
37
+ */
38
+ constructor(id) {
39
+ super(`No factory registered for module ${id}`);
40
+ this.id = id;
41
+ }
42
+ }
43
+
44
+ export class DevRuntime {
45
+ /**
46
+ * Client ID generated at runtime initialization, used for lazy compilation requests.
47
+ * @type {string}
48
+ */
49
+ clientId;
50
+
51
+ /**
52
+ * @param {string} clientId
53
+ */
54
+ constructor(clientId) {
55
+ this.clientId = clientId;
56
+ }
57
+
58
+ /**
59
+ * Static import edges from `registerGraph` — entries persist across `removeModuleCache`
60
+ * and change only by replacement from a newer payload (last write wins).
61
+ * @type {Map<string, { edges: string[] }>}
62
+ */
63
+ staticImports = new Map();
64
+ /**
65
+ * Reverse index over the static imports.
66
+ * @type {Map<string, Set<string>>}
67
+ */
68
+ importers = new Map();
69
+ /**
70
+ * Dynamic `import()` edges from `registerGraph`, keyed by importer — mirror of
71
+ * `staticImports` for the dynamic reverse index.
72
+ * @type {Map<string, { edges: string[] }>}
73
+ */
74
+ dynamicImports = new Map();
75
+ /**
76
+ * Reverse index over the dynamic imports.
77
+ * @type {Map<string, Set<string>>}
78
+ */
79
+ dynamicImporters = new Map();
80
+ /**
81
+ * The module cache. Membership means "this module's side effects ran in this tab" —
82
+ * registration is emitted ahead of every module body, and nothing un-registers on
83
+ * unwind, so a factory that throws mid-body stays registered. A `Map` rather than a
84
+ * plain object: HMR eviction deletes entries, and a `delete` on an object drops V8
85
+ * into dictionary mode, taxing every later lookup on the hottest read path.
86
+ * @type {Map<string, Module>}
87
+ */
88
+ moduleCache = new Map();
89
+ /**
90
+ * Re-runnable factories from HMR patches and lazy chunks. The initial bundle stays
91
+ * scope-hoisted and contributes none.
92
+ * @type {Map<string, { kind: 'esm' | 'cjs', fn: (id: string) => void }>}
93
+ */
94
+ factories = new Map();
95
+ /**
96
+ * Installed by the dev client at boot. The runtime is a store + executor and makes
97
+ * no HMR decisions; accepting, disposing, and reloading live behind these hooks.
98
+ * @type {DevRuntimeHooks | null}
99
+ */
100
+ hooks = null;
101
+
102
+ /**
103
+ * @param {ModuleGraphDelta} delta
104
+ */
105
+ registerGraph(delta) {
106
+ for (let i = 0; i < delta.localCount; i++) {
107
+ const id = delta.ids[i];
108
+ const edges = delta.edges[i].map((j) => delta.ids[j]);
109
+ for (const target of this.staticImports.get(id)?.edges ?? []) {
110
+ this.importers.get(target)?.delete(id);
111
+ }
112
+ for (const target of edges) {
113
+ let importerSet = this.importers.get(target);
114
+ if (!importerSet) {
115
+ importerSet = new Set();
116
+ this.importers.set(target, importerSet);
117
+ }
118
+ importerSet.add(id);
119
+ }
120
+ this.staticImports.set(id, { edges });
121
+
122
+ // Dynamic `import()` edges are maintained in a parallel reverse index with the same
123
+ // last-write-wins bookkeeping; `getImporters` unions the two.
124
+ const dynamicEdges = (delta.dynamicEdges?.[i] ?? []).map((j) => delta.ids[j]);
125
+ for (const target of this.dynamicImports.get(id)?.edges ?? []) {
126
+ this.dynamicImporters.get(target)?.delete(id);
127
+ }
128
+ for (const target of dynamicEdges) {
129
+ let importerSet = this.dynamicImporters.get(target);
130
+ if (!importerSet) {
131
+ importerSet = new Set();
132
+ this.dynamicImporters.set(target, importerSet);
133
+ }
134
+ importerSet.add(id);
135
+ }
136
+ this.dynamicImports.set(id, { edges: dynamicEdges });
137
+ }
138
+ }
139
+
140
+ /**
141
+ * @param {string} id
142
+ * @param {'esm' | 'cjs'} kind
143
+ * @param {(id: string) => void} fn
144
+ */
145
+ registerFactory(id, kind, fn) {
146
+ this.factories.set(id, { kind, fn });
147
+ }
148
+
149
+ /**
150
+ * @param {string} id
151
+ * @param {{ exports: any }} [exportsHolder]
152
+ */
153
+ registerModule(id, exportsHolder = { exports: {} }) {
154
+ const module = new Module(id);
155
+ module.exportsHolder = exportsHolder;
156
+ this.moduleCache.set(id, module);
157
+ }
158
+
159
+ /**
160
+ * @param {string} id
161
+ * @returns {string[]}
162
+ */
163
+ getImporters(id) {
164
+ // Static ∪ dynamic importers — the boundary walk treats both kinds the same (parity
165
+ // with Vite `node.importers` / webpack `module.parents`). Deduped so a module that
166
+ // imports `id` both statically and via `import()` appears once.
167
+ const dynamic = this.dynamicImporters.get(id);
168
+ if (!dynamic || dynamic.size === 0) {
169
+ return [...(this.importers.get(id) ?? [])];
170
+ }
171
+ return [...new Set([...(this.importers.get(id) ?? []), ...dynamic])];
172
+ }
173
+
174
+ /**
175
+ * @param {string} id
176
+ */
177
+ isExecuted(id) {
178
+ return this.moduleCache.has(id);
179
+ }
180
+
181
+ /**
182
+ * @param {string} id
183
+ */
184
+ hasFactory(id) {
185
+ return this.factories.has(id);
186
+ }
187
+
188
+ /**
189
+ * Module-cache delete only — static imports and factories persist. Removal is what
190
+ * re-arms a cache-gated factory for `initModule`.
191
+ * @param {string} id
192
+ */
193
+ removeModuleCache(id) {
194
+ this.moduleCache.delete(id);
195
+ this.hooks?.onModuleCacheRemoval(id);
196
+ }
197
+
198
+ /**
199
+ * The one re-execution gate: registered → return the live exports; otherwise run the
200
+ * mapped factory (which registers itself first, then runs the body).
201
+ * @param {string} id
202
+ */
203
+ initModule(id) {
204
+ if (this.moduleCache.has(id)) {
205
+ return this.loadExports(id);
206
+ }
207
+ const factory = this.factories.get(id);
208
+ if (!factory) {
209
+ throw new MissingFactoryError(id);
210
+ }
211
+ factory.fn(id);
212
+ return this.loadExports(id);
213
+ }
214
+
215
+ /**
216
+ * @param {string} id
217
+ */
218
+ loadExports(id) {
219
+ const module = this.moduleCache.get(id);
220
+ if (module) {
221
+ return module.exportsHolder.exports;
222
+ } else {
223
+ console.warn(`Module ${id} not found`);
224
+ return {};
225
+ }
226
+ }
227
+
228
+ /**
229
+ * @param {string} moduleId
230
+ */
231
+ createModuleHotContext(moduleId) {
232
+ if (this.hooks) {
233
+ return this.hooks.createModuleHotContext(moduleId);
234
+ }
235
+ throw new Error('createModuleHotContext requires installed hooks or an override');
236
+ }
237
+
238
+ /** @internal */
239
+ // @ts-expect-error The variable will be injected at build time.
240
+ __toESM = __toESM;
241
+ /** @internal */
242
+ // @ts-expect-error The variable will be injected at build time.
243
+ __toCommonJS = __toCommonJS;
244
+ /** @internal */
245
+ // @ts-expect-error The variable will be injected at build time.
246
+ __exportAll = __exportAll;
247
+ /**
248
+ * @param {boolean} [isNodeMode]
249
+ * @returns {(mod: any) => any}
250
+ * @internal
251
+ */
252
+ // @ts-expect-error The variable will be injected at build time.
253
+ __toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode);
254
+ /** @internal */
255
+ // @ts-expect-error The variable will be injected at build time.
256
+ __reExport = __reExport;
257
+ }
@@ -0,0 +1,196 @@
1
+ import { F as withFilter } from "./shared/define-config-Nbz-lniw.mjs";
2
+ //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter/index.d.mts
3
+ //#region src/filter/composable-filters.d.ts
4
+ type StringOrRegExp = string | RegExp;
5
+ type PluginModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
6
+ type FilterExpressionKind = FilterExpression['kind'];
7
+ type FilterExpression = And | Or | Not | Id | ImporterId | ModuleType | Code | Query;
8
+ type TopLevelFilterExpression = Include | Exclude;
9
+ declare class And {
10
+ kind: 'and';
11
+ args: FilterExpression[];
12
+ constructor(...args: FilterExpression[]);
13
+ }
14
+ declare class Or {
15
+ kind: 'or';
16
+ args: FilterExpression[];
17
+ constructor(...args: FilterExpression[]);
18
+ }
19
+ declare class Not {
20
+ kind: 'not';
21
+ expr: FilterExpression;
22
+ constructor(expr: FilterExpression);
23
+ }
24
+ interface QueryFilterObject {
25
+ [key: string]: StringOrRegExp | boolean;
26
+ }
27
+ interface IdParams {
28
+ cleanUrl?: boolean;
29
+ }
30
+ declare class Id {
31
+ kind: 'id';
32
+ pattern: StringOrRegExp;
33
+ params: IdParams;
34
+ constructor(pattern: StringOrRegExp, params?: IdParams);
35
+ }
36
+ declare class ImporterId {
37
+ kind: 'importerId';
38
+ pattern: StringOrRegExp;
39
+ params: IdParams;
40
+ constructor(pattern: StringOrRegExp, params?: IdParams);
41
+ }
42
+ declare class ModuleType {
43
+ kind: 'moduleType';
44
+ pattern: PluginModuleType;
45
+ constructor(pattern: PluginModuleType);
46
+ }
47
+ declare class Code {
48
+ kind: 'code';
49
+ pattern: StringOrRegExp;
50
+ constructor(expr: StringOrRegExp);
51
+ }
52
+ declare class Query {
53
+ kind: 'query';
54
+ key: string;
55
+ pattern: StringOrRegExp | boolean;
56
+ constructor(key: string, pattern: StringOrRegExp | boolean);
57
+ }
58
+ declare class Include {
59
+ kind: 'include';
60
+ expr: FilterExpression;
61
+ constructor(expr: FilterExpression);
62
+ }
63
+ declare class Exclude {
64
+ kind: 'exclude';
65
+ expr: FilterExpression;
66
+ constructor(expr: FilterExpression);
67
+ }
68
+ declare function and(...args: FilterExpression[]): And;
69
+ declare function or(...args: FilterExpression[]): Or;
70
+ declare function not(expr: FilterExpression): Not;
71
+ declare function id(pattern: StringOrRegExp, params?: IdParams): Id;
72
+ declare function importerId(pattern: StringOrRegExp, params?: IdParams): ImporterId;
73
+ declare function moduleType(pattern: PluginModuleType): ModuleType;
74
+ declare function code(pattern: StringOrRegExp): Code;
75
+ declare function query(key: string, pattern: StringOrRegExp | boolean): Query;
76
+ declare function include(expr: FilterExpression): Include;
77
+ declare function exclude(expr: FilterExpression): Exclude;
78
+ /**
79
+ * convert a queryObject to FilterExpression like
80
+ * ```js
81
+ * and(query(k1, v1), query(k2, v2))
82
+ * ```
83
+ * @param queryFilterObject The query filter object needs to be matched.
84
+ * @returns a `And` FilterExpression
85
+ */
86
+ declare function queries(queryFilter: QueryFilterObject): And;
87
+ declare function interpreter(exprs: TopLevelFilterExpression | TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string): boolean;
88
+ interface InterpreterCtx {
89
+ urlSearchParamsCache?: URLSearchParams;
90
+ }
91
+ declare function interpreterImpl(expr: TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
92
+ declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
93
+ //#endregion
94
+ //#region src/filter/filter-vite-plugins.d.ts
95
+ /**
96
+ * Filters out Vite plugins that have `apply: 'serve'` set.
97
+ *
98
+ * Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
99
+ * are intended only for Vite's dev server and should be excluded from the build process.
100
+ *
101
+ * @param plugins - Array of plugins (can include nested arrays)
102
+ * @returns Filtered array with serve-only plugins removed
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * import { defineConfig } from 'rolldown';
107
+ * import { filterVitePlugins } from '@rolldown/pluginutils';
108
+ * import viteReact from '@vitejs/plugin-react';
109
+ *
110
+ * export default defineConfig({
111
+ * plugins: filterVitePlugins([
112
+ * viteReact(),
113
+ * {
114
+ * name: 'dev-only',
115
+ * apply: 'serve', // This will be filtered out
116
+ * // ...
117
+ * }
118
+ * ])
119
+ * });
120
+ * ```
121
+ */
122
+ declare function filterVitePlugins<T = any>(plugins: T | T[] | null | undefined | false): T[];
123
+ //#endregion
124
+ //#region src/filter/simple-filters.d.ts
125
+ /**
126
+ * Constructs a RegExp that matches the exact string specified.
127
+ *
128
+ * This is useful for plugin hook filters.
129
+ *
130
+ * @param str the string to match.
131
+ * @param flags flags for the RegExp.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * import { exactRegex } from '@rolldown/pluginutils';
136
+ * const plugin = {
137
+ * name: 'plugin',
138
+ * resolveId: {
139
+ * filter: { id: exactRegex('foo') },
140
+ * handler(id) {} // will only be called for `foo`
141
+ * }
142
+ * }
143
+ * ```
144
+ */
145
+ declare function exactRegex(str: string, flags?: string): RegExp;
146
+ /**
147
+ * Constructs a RegExp that matches a value that has the specified prefix.
148
+ *
149
+ * This is useful for plugin hook filters.
150
+ *
151
+ * @param str the string to match.
152
+ * @param flags flags for the RegExp.
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * import { prefixRegex } from '@rolldown/pluginutils';
157
+ * const plugin = {
158
+ * name: 'plugin',
159
+ * resolveId: {
160
+ * filter: { id: prefixRegex('foo') },
161
+ * handler(id) {} // will only be called for IDs starting with `foo`
162
+ * }
163
+ * }
164
+ * ```
165
+ */
166
+ declare function prefixRegex(str: string, flags?: string): RegExp;
167
+ type WidenString<T> = T extends string ? string : T;
168
+ /**
169
+ * Converts a id filter to match with an id with a query.
170
+ *
171
+ * @param input the id filters to convert.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
176
+ * const plugin = {
177
+ * name: 'plugin',
178
+ * transform: {
179
+ * filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
180
+ * // The handler will be called for IDs like:
181
+ * // - foo.js
182
+ * // - foo.js?foo
183
+ * // - foo.txt?foo.js
184
+ * // - foo.ts
185
+ * // - foo.ts?foo
186
+ * // - foo.txt?foo.ts
187
+ * handler(code, id) {}
188
+ * }
189
+ * }
190
+ * ```
191
+ */
192
+ declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;
193
+ declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
194
+ declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[];
195
+ //#endregion
196
+ export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query, withFilter };