vite-plugin-dynamic-import
Advanced tools
Comparing version 0.9.2 to 0.9.3
import type { Plugin } from 'vite'; | ||
import type { DynamicImportOptions } from './types'; | ||
export interface DynamicImportOptions { | ||
filter?: (id: string) => false | void; | ||
/** | ||
* This option will change `./*` to `./** /*` | ||
* @default true | ||
*/ | ||
depth?: boolean; | ||
/** | ||
* If you want to exclude some files | ||
* e.g `type.d.ts`, `interface.ts` | ||
*/ | ||
onFiles?: (files: string[], id: string) => typeof files | void; | ||
/** | ||
* It will add `@vite-ignore` | ||
* `import(/*@vite-ignore* / 'import-path')` | ||
*/ | ||
viteIgnore?: (rawImportee: string, id: string) => true | void; | ||
} | ||
export default function dynamicImport(options?: DynamicImportOptions): Plugin; |
@@ -131,3 +131,3 @@ "use strict"; | ||
if (dyImptRutimeBody) { | ||
code += '\n// --------- ${PLUGIN_NAME} ---------\n' + dyImptRutimeBody; | ||
code += `\n// --------- ${PLUGIN_NAME} ---------\n` + dyImptRutimeBody; | ||
} | ||
@@ -134,0 +134,0 @@ return { |
import type { AcornNode as AcornNode2 } from 'rollup'; | ||
export declare type AcornNode<T = any> = AcornNode2 & Record<string, T>; | ||
export interface DynamicImportOptions { | ||
filter?: (id: string) => false | void; | ||
/** | ||
* This option will change `./*` to `./** /*` | ||
* @default true | ||
*/ | ||
depth?: boolean; | ||
/** | ||
* If you want to exclude some files | ||
* e.g `type.d.ts`, `interface.ts` | ||
*/ | ||
onFiles?: (files: string[], id: string) => typeof files | void; | ||
/** | ||
* It will add `@vite-ignore` | ||
* `import(/*@vite-ignore* / 'import-path')` | ||
*/ | ||
viteIgnore?: (rawImportee: string, id: string) => true | void; | ||
} |
{ | ||
"name": "vite-plugin-dynamic-import", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "Enhance Vite builtin dynamic import", | ||
@@ -8,3 +8,4 @@ "main": "dist/index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/vite-plugin/vite-plugin-dynamic-import.git" | ||
"url": "git+https://github.com/caoxiemeihao/vite-plugins.git", | ||
"directory": "packages/dynamic-import" | ||
}, | ||
@@ -11,0 +12,0 @@ "author": "草鞋没号 <308487730@qq.com>", |
@@ -68,3 +68,3 @@ # vite-plugin-dynamic-import | ||
├── src | ||
| ├── views | ||
| └── views | ||
| | ├ foo | ||
@@ -71,0 +71,0 @@ | | | └── index.js |
@@ -18,3 +18,3 @@ import path from 'path' | ||
} from './utils' | ||
import type { AcornNode, DynamicImportOptions } from './types' | ||
import type { AcornNode } from './types' | ||
import { AliasContext, AliasReplaced } from './alias' | ||
@@ -29,2 +29,21 @@ import { | ||
export interface DynamicImportOptions { | ||
filter?: (id: string) => false | void | ||
/** | ||
* This option will change `./*` to `./** /*` | ||
* @default true | ||
*/ | ||
depth?: boolean | ||
/** | ||
* If you want to exclude some files | ||
* e.g `type.d.ts`, `interface.ts` | ||
*/ | ||
onFiles?: (files: string[], id: string) => typeof files | void | ||
/** | ||
* It will add `@vite-ignore` | ||
* `import(/*@vite-ignore* / 'import-path')` | ||
*/ | ||
viteIgnore?: (rawImportee: string, id: string) => true | void | ||
} | ||
const PLUGIN_NAME = 'vite-plugin-dynamic-import' | ||
@@ -171,3 +190,3 @@ | ||
if (dyImptRutimeBody) { | ||
code += '\n// --------- ${PLUGIN_NAME} ---------\n' + dyImptRutimeBody | ||
code += `\n// --------- ${PLUGIN_NAME} ---------\n` + dyImptRutimeBody | ||
} | ||
@@ -174,0 +193,0 @@ |
import type { AcornNode as AcornNode2 } from 'rollup' | ||
import type { Plugin } from 'vite' | ||
export type AcornNode<T = any> = AcornNode2 & Record<string, T> | ||
export interface DynamicImportOptions { | ||
filter?: (id: string) => false | void | ||
/** | ||
* This option will change `./*` to `./** /*` | ||
* @default true | ||
*/ | ||
depth?: boolean | ||
/** | ||
* If you want to exclude some files | ||
* e.g `type.d.ts`, `interface.ts` | ||
*/ | ||
onFiles?: (files: string[], id: string) => typeof files | void | ||
/** | ||
* It will add `@vite-ignore` | ||
* `import(/*@vite-ignore* / 'import-path')` | ||
*/ | ||
viteIgnore?: (rawImportee: string, id: string) => true | void | ||
} |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
53641
1221