@rolldown/pluginutils 1.0.0-beta.9-commit.0ec9e7d → 1.0.0-rc.1

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/index.d.cts DELETED
@@ -1,116 +0,0 @@
1
- //#region src/composable-filters.d.ts
2
- type StringOrRegExp = string | RegExp;
3
- type PluginModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {});
4
- type FilterExpressionKind = FilterExpression["kind"];
5
- type FilterExpression = And | Or | Not | Id | ModuleType | Code | Query;
6
- type TopLevelFilterExpression = Include | Exclude;
7
- declare class And {
8
- kind: "and";
9
- args: FilterExpression[];
10
- constructor(...args: FilterExpression[]);
11
- }
12
- declare class Or {
13
- kind: "or";
14
- args: FilterExpression[];
15
- constructor(...args: FilterExpression[]);
16
- }
17
- declare class Not {
18
- kind: "not";
19
- expr: FilterExpression;
20
- constructor(expr: FilterExpression);
21
- }
22
- interface QueryFilterObject {
23
- [key: string]: StringOrRegExp | boolean;
24
- }
25
- interface IdParams {
26
- cleanUrl?: boolean;
27
- }
28
- declare class Id {
29
- kind: "id";
30
- pattern: StringOrRegExp;
31
- params: IdParams;
32
- constructor(pattern: StringOrRegExp, params?: IdParams);
33
- }
34
- declare class ModuleType {
35
- kind: "moduleType";
36
- pattern: PluginModuleType;
37
- constructor(pattern: PluginModuleType);
38
- }
39
- declare class Code {
40
- kind: "code";
41
- pattern: StringOrRegExp;
42
- constructor(expr: StringOrRegExp);
43
- }
44
- declare class Query {
45
- kind: "query";
46
- key: string;
47
- pattern: StringOrRegExp | boolean;
48
- constructor(key: string, pattern: StringOrRegExp | boolean);
49
- }
50
- declare class Include {
51
- kind: "include";
52
- expr: FilterExpression;
53
- constructor(expr: FilterExpression);
54
- }
55
- declare class Exclude {
56
- kind: "exclude";
57
- expr: FilterExpression;
58
- constructor(expr: FilterExpression);
59
- }
60
- declare function and(...args: FilterExpression[]): And;
61
- declare function or(...args: FilterExpression[]): Or;
62
- declare function not(expr: FilterExpression): Not;
63
- declare function id(pattern: StringOrRegExp, params?: IdParams): Id;
64
- declare function moduleType(pattern: PluginModuleType): ModuleType;
65
- declare function code(pattern: StringOrRegExp): Code;
66
- declare function query(key: string, pattern: StringOrRegExp | boolean): Query;
67
- declare function include(expr: FilterExpression): Include;
68
- declare function exclude(expr: FilterExpression): Exclude;
69
- /**
70
- * convert a queryObject to FilterExpression like
71
- * ```js
72
- * and(query(k1, v1), query(k2, v2))
73
- * ```
74
- * @param queryFilterObject The query filter object needs to be matched.
75
- * @returns a `And` FilterExpression
76
- */
77
- declare function queries(queryFilter: QueryFilterObject): And;
78
- declare function interpreter(exprs: TopLevelFilterExpression | TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType): boolean;
79
- interface InterpreterCtx {
80
- urlSearchParamsCache?: URLSearchParams;
81
- }
82
- declare function interpreterImpl(expr: TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, ctx?: InterpreterCtx): boolean;
83
- declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, ctx?: InterpreterCtx): boolean;
84
-
85
- //#endregion
86
- //#region src/simple-filters.d.ts
87
- /**
88
- * Constructs a RegExp that matches the exact string specified.
89
- *
90
- * This is useful for plugin hook filters.
91
- *
92
- * @param str the string to match.
93
- * @param flags flags for the RegExp.
94
- */
95
- declare function exactRegex(str: string, flags?: string): RegExp;
96
- /**
97
- * Constructs a RegExp that matches a value that has the specified prefix.
98
- *
99
- * This is useful for plugin hook filters.
100
- *
101
- * @param str the string to match.
102
- * @param flags flags for the RegExp.
103
- */
104
- declare function prefixRegex(str: string, flags?: string): RegExp;
105
- type WidenString<T> = T extends string ? string : T;
106
- /**
107
- * Converts a id filter to match with an id with a query.
108
- *
109
- * @param input the id filters to convert.
110
- */
111
- declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;
112
- declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
113
- declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[];
114
-
115
- //#endregion
116
- export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, id, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query };