You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@rolldown/pluginutils

Package Overview
Dependencies
Maintainers
3
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rolldown/pluginutils - npm Package Compare versions

Comparing version
1.0.0-beta.14-commit.12b8061
to
1.0.0-beta.26-commit.d3c250b
+24
-0
dist/index.cjs

@@ -200,2 +200,14 @@

* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { exactRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: exactRegex('foo') },
* handler(id) {} // will only be called for `foo`
* }
* }
* ```
*/

@@ -212,2 +224,14 @@ function exactRegex(str, flags) {

* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { prefixRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: prefixRegex('foo') },
* handler(id) {} // will only be called for IDs starting with `foo`
* }
* }
* ```
*/

@@ -214,0 +238,0 @@ function prefixRegex(str, flags) {

+43
-9
//#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 & {});

@@ -69,8 +66,2 @@ 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;

@@ -103,2 +94,14 @@ declare function include(expr: FilterExpression): Include;

* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { exactRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: exactRegex('foo') },
* handler(id) {} // will only be called for `foo`
* }
* }
* ```
*/

@@ -113,2 +116,14 @@ declare function exactRegex(str: string, flags?: string): RegExp;

* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { prefixRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: prefixRegex('foo') },
* handler(id) {} // will only be called for IDs starting with `foo`
* }
* }
* ```
*/

@@ -121,2 +136,21 @@ declare function prefixRegex(str: string, flags?: string): RegExp;

* @param input the id filters to convert.
*
* @example
* ```ts
* import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* transform: {
* filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
* // The handler will be called for IDs like:
* // - foo.js
* // - foo.js?foo
* // - foo.txt?foo.js
* // - foo.ts
* // - foo.ts?foo
* // - foo.txt?foo.ts
* handler(code, id) {}
* }
* }
* ```
*/

@@ -123,0 +157,0 @@ declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;

//#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 & {});

@@ -69,8 +66,2 @@ 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;

@@ -103,2 +94,14 @@ declare function include(expr: FilterExpression): Include;

* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { exactRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: exactRegex('foo') },
* handler(id) {} // will only be called for `foo`
* }
* }
* ```
*/

@@ -113,2 +116,14 @@ declare function exactRegex(str: string, flags?: string): RegExp;

* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { prefixRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: prefixRegex('foo') },
* handler(id) {} // will only be called for IDs starting with `foo`
* }
* }
* ```
*/

@@ -121,2 +136,21 @@ declare function prefixRegex(str: string, flags?: string): RegExp;

* @param input the id filters to convert.
*
* @example
* ```ts
* import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* transform: {
* filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
* // The handler will be called for IDs like:
* // - foo.js
* // - foo.js?foo
* // - foo.txt?foo.js
* // - foo.ts
* // - foo.ts?foo
* // - foo.txt?foo.ts
* handler(code, id) {}
* }
* }
* ```
*/

@@ -123,0 +157,0 @@ declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;

@@ -199,2 +199,14 @@ //#region src/utils.ts

* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { exactRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: exactRegex('foo') },
* handler(id) {} // will only be called for `foo`
* }
* }
* ```
*/

@@ -211,2 +223,14 @@ function exactRegex(str, flags) {

* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { prefixRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: prefixRegex('foo') },
* handler(id) {} // will only be called for IDs starting with `foo`
* }
* }
* ```
*/

@@ -213,0 +237,0 @@ function prefixRegex(str, flags) {

+2
-2
{
"name": "@rolldown/pluginutils",
"version": "1.0.0-beta.14-commit.12b8061",
"version": "1.0.0-beta.26-commit.d3c250b",
"license": "MIT",

@@ -29,3 +29,3 @@ "type": "module",

"picomatch": "^4.0.2",
"tsdown": "0.12.7",
"tsdown": "0.12.9",
"vitest": "^3.0.1"

@@ -32,0 +32,0 @@ },