From 7898236dded305d4ecbdc792eea9f40713ccb00d Mon Sep 17 00:00:00 2001 From: chouchouji <1305974212@qq.com> Date: Thu, 14 Nov 2024 11:15:40 +0800 Subject: [PATCH] types: update include and exclude type --- README.md | 8 ++++---- index.d.ts | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9bda947..8441645 100644 --- a/README.md +++ b/README.md @@ -80,8 +80,8 @@ This module exports a single function. const plugin = createPlugin( globals: Object | Function, { - include?: Array, - exclude?: Array, + include?: ReadonlyArray | string | RegExp | null, + exclude?: ReadonlyArray | string | RegExp | null, dynamicWrapper?: Function, constBindings?: Boolean } = {} @@ -106,9 +106,9 @@ const globals = (id) => { } ``` -`include` is an array of glob patterns. If defined, only matched files would be transformed. +`include` is a valid `picomatch` glob pattern, or array of patterns. If defined, only matched files would be transformed. -`exclude` is an array of glob patterns. Matched files would not be transformed. +`exclude` is a valid `picomatch` glob pattern, or array of patterns. Matched files would not be transformed. `dynamicWrapper` is used to specify dynamic imports. Below is the default. diff --git a/index.d.ts b/index.d.ts index 5b852f9..5a38956 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,5 @@ -import type { Plugin } from "rollup"; +import type { Plugin } from 'rollup'; +import type { FilterPattern } from '@rollup/pluginutils'; export type VariableName = string; /** @@ -11,13 +12,13 @@ export type ModuleNameMap = export type ExternalGlobalsOptions = { /** - * [include] is an array of glob patterns. If defined, only matched files would be transformed. + * [include] is a valid `picomatch` glob pattern, or array of patterns. If defined, only matched files would be transformed. */ - include?: Array; + include?: FilterPattern; /** - * [exclude] is an array of glob patterns. Matched files would not be transformed. + * [exclude] is a valid `picomatch` glob pattern, or array of patterns. Matched files would not be transformed. */ - exclude?: Array; + exclude?: FilterPattern; /** * [dynamicWrapper] is used to specify dynamic imports. It accepts a variable name and returns an expression */