@rolldown/pluginutils
Advanced tools
+2
-11
@@ -1,2 +0,1 @@ | ||
| "use strict"; | ||
@@ -221,7 +220,3 @@ //#region src/utils.ts | ||
| function makeIdFiltersToMatchWithQuery(input) { | ||
| if (!Array.isArray(input)) return makeIdFilterToMatchWithQuery( | ||
| // Array.isArray cannot narrow the type | ||
| // https://github.com/microsoft/TypeScript/issues/17002 | ||
| input | ||
| ); | ||
| if (!Array.isArray(input)) return makeIdFilterToMatchWithQuery(input); | ||
| return input.map((i) => makeIdFilterToMatchWithQuery(i)); | ||
@@ -234,7 +229,3 @@ } | ||
| function makeRegexIdFilterToMatchWithQuery(input) { | ||
| return new RegExp( | ||
| // replace `$` with `(?:\?.*)?$` (ignore `\$`) | ||
| input.source.replace(/(?<!\\)\$/g, "(?:\\?.*)?$"), | ||
| input.flags | ||
| ); | ||
| return new RegExp(input.source.replace(/(?<!\\)\$/g, "(?:\\?.*)?$"), input.flags); | ||
| } | ||
@@ -241,0 +232,0 @@ |
+9
-2
| //#region src/composable-filters.d.ts | ||
| type StringOrRegExp = string | RegExp; | ||
| // Inline this type to avoid import it from `rolldown`. | ||
| // The only downside is we need to keep it in sync with `rolldown` manually, | ||
| // it is alright since it is pretty stable now. | ||
| type PluginModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {}); | ||
@@ -66,2 +69,8 @@ type FilterExpressionKind = FilterExpression["kind"]; | ||
| declare function code(pattern: StringOrRegExp): Code; | ||
| /* | ||
| * There are three kinds of conditions are supported: | ||
| * 1. `boolean`: if the value is `true`, the key must exist and be truthy. if the value is `false`, the key must not exist or be falsy. | ||
| * 2. `string`: the key must exist and be equal to the value. | ||
| * 3. `RegExp`: the key must exist and match the value. | ||
| */ | ||
| declare function query(key: string, pattern: StringOrRegExp | boolean): Query; | ||
@@ -85,3 +94,2 @@ declare function include(expr: FilterExpression): Include; | ||
| declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, ctx?: InterpreterCtx): boolean; | ||
| //#endregion | ||
@@ -116,4 +124,3 @@ //#region src/simple-filters.d.ts | ||
| declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[]; | ||
| //#endregion | ||
| export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, id, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query }; |
+9
-2
| //#region src/composable-filters.d.ts | ||
| type StringOrRegExp = string | RegExp; | ||
| // Inline this type to avoid import it from `rolldown`. | ||
| // The only downside is we need to keep it in sync with `rolldown` manually, | ||
| // it is alright since it is pretty stable now. | ||
| type PluginModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {}); | ||
@@ -66,2 +69,8 @@ type FilterExpressionKind = FilterExpression["kind"]; | ||
| declare function code(pattern: StringOrRegExp): Code; | ||
| /* | ||
| * There are three kinds of conditions are supported: | ||
| * 1. `boolean`: if the value is `true`, the key must exist and be truthy. if the value is `false`, the key must not exist or be falsy. | ||
| * 2. `string`: the key must exist and be equal to the value. | ||
| * 3. `RegExp`: the key must exist and match the value. | ||
| */ | ||
| declare function query(key: string, pattern: StringOrRegExp | boolean): Query; | ||
@@ -85,3 +94,2 @@ declare function include(expr: FilterExpression): Include; | ||
| declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, ctx?: InterpreterCtx): boolean; | ||
| //#endregion | ||
@@ -116,4 +124,3 @@ //#region src/simple-filters.d.ts | ||
| declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[]; | ||
| //#endregion | ||
| export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, id, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query }; |
+2
-10
@@ -219,7 +219,3 @@ //#region src/utils.ts | ||
| function makeIdFiltersToMatchWithQuery(input) { | ||
| if (!Array.isArray(input)) return makeIdFilterToMatchWithQuery( | ||
| // Array.isArray cannot narrow the type | ||
| // https://github.com/microsoft/TypeScript/issues/17002 | ||
| input | ||
| ); | ||
| if (!Array.isArray(input)) return makeIdFilterToMatchWithQuery(input); | ||
| return input.map((i) => makeIdFilterToMatchWithQuery(i)); | ||
@@ -232,7 +228,3 @@ } | ||
| function makeRegexIdFilterToMatchWithQuery(input) { | ||
| return new RegExp( | ||
| // replace `$` with `(?:\?.*)?$` (ignore `\$`) | ||
| input.source.replace(/(?<!\\)\$/g, "(?:\\?.*)?$"), | ||
| input.flags | ||
| ); | ||
| return new RegExp(input.source.replace(/(?<!\\)\$/g, "(?:\\?.*)?$"), input.flags); | ||
| } | ||
@@ -239,0 +231,0 @@ |
+2
-2
| { | ||
| "name": "@rolldown/pluginutils", | ||
| "version": "1.0.0-beta.10-commit.ac4e5db", | ||
| "version": "1.0.0-beta.10-commit.bf212da", | ||
| "license": "MIT", | ||
@@ -29,3 +29,3 @@ "type": "module", | ||
| "picomatch": "^4.0.2", | ||
| "tsdown": "0.11.11", | ||
| "tsdown": "0.12.6", | ||
| "vitest": "^3.0.1" | ||
@@ -32,0 +32,0 @@ }, |
24521
2.7%591
-1.34%