vite-plugin-dynamic-import
Advanced tools
Comparing version 1.2.7 to 1.3.0
{ | ||
"name": "vite-plugin-dynamic-import", | ||
"version": "1.2.7", | ||
"version": "1.3.0", | ||
"description": "Enhance Vite builtin dynamic import", | ||
"type": "module", | ||
"main": "index.js", | ||
"types": "types", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./index.js", | ||
"require": "./index.cjs" | ||
} | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./*": "./*" | ||
}, | ||
@@ -23,3 +24,3 @@ "repository": { | ||
"build": "vite build", | ||
"test": "vite -c test/vite.config.ts", | ||
"test": "vitest run", | ||
"types": "tsc", | ||
@@ -29,9 +30,14 @@ "prepublishOnly": "npm run build" | ||
"dependencies": { | ||
"acorn": "^8.8.2", | ||
"es-module-lexer": "^1.2.1", | ||
"fast-glob": "^3.2.12" | ||
}, | ||
"devDependencies": { | ||
"@ant-design/icons-svg": "^4.2.1", | ||
"@types/node": "^18.11.18", | ||
"node-fetch": "^3.3.0", | ||
"typescript": "^4.9.4", | ||
"vite": "^4.0.4", | ||
"vite-plugin-utils": "^0.4.0" | ||
"vite": "^4.3.2", | ||
"vite-plugin-utils": "^0.4.2", | ||
"vitest": "^0.30.1" | ||
}, | ||
@@ -45,6 +51,4 @@ "keywords": [ | ||
"files": [ | ||
"types", | ||
"index.cjs", | ||
"index.js" | ||
"dist" | ||
] | ||
} |
@@ -36,2 +36,16 @@ # vite-plugin-dynamic-import | ||
#### node_modules | ||
```js | ||
dynamicImport({ | ||
filter(id) { | ||
// `node_modules` is exclude by default, so we need to include it explicitly | ||
// https://github.com/vite-plugin/vite-plugin-dynamic-import/blob/v1.3.0/src/index.ts#L133-L135 | ||
if (/node_modules\/(?!\.vite\/)/.test(id)) { | ||
return true | ||
} | ||
} | ||
}) | ||
``` | ||
## API | ||
@@ -43,3 +57,3 @@ | ||
export interface Options { | ||
filter?: (id: string) => false | void | ||
filter?: (id: string) => boolean | void | ||
/** | ||
@@ -52,5 +66,5 @@ * ``` | ||
* see https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#how-it-works | ||
* ``` | ||
* | ||
* default true | ||
* ``` | ||
* @defaultValue true | ||
*/ | ||
@@ -64,6 +78,7 @@ loose?: boolean | ||
/** | ||
* It will add `@vite-ignore` | ||
* `import(/*@vite-ignore* / 'import-path')` | ||
* Custom importee | ||
* | ||
* e.g. - append `\/*@vite-ignore*\/` in front of importee to bypass to Vite | ||
*/ | ||
viteIgnore?: (rawImportee: string, id: string) => true | void | ||
onResolve?: (rawImportee: string, id: string) => typeof rawImportee | void | ||
} | ||
@@ -70,0 +85,0 @@ ``` |
@@ -36,3 +36,16 @@ # vite-plugin-dynamic-import | ||
#### node_modules | ||
```js | ||
dynamicImport({ | ||
filter(id) { | ||
// 默认会排除 `node_modules`,所以必须显式的包含它 | ||
// https://github.com/vite-plugin/vite-plugin-dynamic-import/blob/v1.3.0/src/index.ts#L133-L135 | ||
if (/node_modules\/(?!\.vite\/)/.test(id)) { | ||
return true | ||
} | ||
} | ||
}) | ||
``` | ||
## API | ||
@@ -44,3 +57,3 @@ | ||
export interface Options { | ||
filter?: (id: string) => false | void | ||
filter?: (id: string) => boolean | void | ||
/** | ||
@@ -64,6 +77,7 @@ * ``` | ||
/** | ||
* 将会在 import 中添加 `@vite-ignore` | ||
* `import(/*@vite-ignore* / 'import-path')` | ||
* 自定义 importee | ||
* | ||
* e.g. - 在 importee 前面插入 `\/*@vite-ignore*\/` 绕过 Vite | ||
*/ | ||
viteIgnore?: (rawImportee: string, id: string) => true | void | ||
onResolve?: (rawImportee: string, id: string) => typeof rawImportee | void | ||
} | ||
@@ -70,0 +84,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46852
10
1195
166
3
7
1
No
+ Addedacorn@^8.8.2
+ Addedes-module-lexer@^1.2.1
+ Addedacorn@8.14.0(transitive)
+ Addedes-module-lexer@1.5.4(transitive)