vite-plugin-generate-file
Advanced tools
Comparing version 0.0.4 to 0.1.0
import { Plugin } from 'vite'; | ||
/** | ||
* 文件输出配置 | ||
*/ | ||
export interface GenerateFile { | ||
interface GenerateFile { | ||
/** | ||
@@ -28,3 +29,3 @@ * 文件输出位置,相对于输出目录,默认 ./output.txt | ||
} | ||
export declare type Options = GenerateFile | GenerateFile[]; | ||
type Options = GenerateFile | GenerateFile[]; | ||
/** | ||
@@ -34,2 +35,3 @@ * 插件入口 | ||
declare function PluginGenerateFile(options: Options): Plugin; | ||
export default PluginGenerateFile; | ||
export { type GenerateFile, type Options, PluginGenerateFile as default }; |
{ | ||
"name": "vite-plugin-generate-file", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"license": "MIT", | ||
@@ -22,4 +22,11 @@ "description": "Generate extra file to dist folder.", | ||
}, | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.es.js", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
@@ -29,14 +36,5 @@ "files": [ | ||
], | ||
"scripts": { | ||
"build": "rollup -c", | ||
"lint": "run-p lint:*", | ||
"lint:eslint": "eslint \"{src,test}/**/*.ts\"", | ||
"lint:prettier": "prettier \"{src,test}/**/*.ts\" --check", | ||
"fix": "run-s fix:*", | ||
"fix:eslint": "yarn lint:eslint --fix", | ||
"fix:prettier": "yarn lint:prettier --write" | ||
}, | ||
"dependencies": { | ||
"chalk": "^4.1.2", | ||
"ejs": "^3.1.6", | ||
"ejs": "^3.1.9", | ||
"js-yaml": "^4.1.0", | ||
@@ -59,10 +57,16 @@ "mime-types": "^2.1.35" | ||
"prettier": "^2.4.1", | ||
"rollup": "^2.56.3", | ||
"rollup-plugin-string": "^3.0.0", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"tsup": "^5.1.0", | ||
"typescript": "^4.4.3", | ||
"vite": "^2.5.8" | ||
"typescript": "^5.2.2", | ||
"unbuild": "^2.0.0", | ||
"vite": "^4.5.0" | ||
}, | ||
"scripts": { | ||
"build": "unbuild", | ||
"lint": "run-p lint:*", | ||
"lint:eslint": "eslint \"{src,test}/**/*.ts\"", | ||
"lint:prettier": "prettier \"{src,test}/**/*.ts\" --check", | ||
"fix": "run-s fix:*", | ||
"fix:eslint": "yarn lint:eslint --fix", | ||
"fix:prettier": "yarn lint:prettier --write" | ||
} | ||
} | ||
} |
@@ -14,2 +14,4 @@ # vite-plugin-generate-file | ||
> Since vite-plugin-generate-file@v0.1.0, Vite v3.1 or above is required. | ||
Add plugin to your `vite.config.ts` : | ||
@@ -34,13 +36,14 @@ | ||
Available options: | ||
Here are the available options for configuration: | ||
| Name | Description | Options | Defaults | | ||
|---------------|-------------------------------------------------------------------------------------------------------------|---------------------------|----------------| | ||
| `type` | Generate file format type. | `json` `yaml` `template` | `json` | | ||
| `output` | Path to the output file the plugin will generate. It relative to `dist` folder. | - | `./output.txt` | | ||
| `template` | Path to the template file. Support `ejs` format template. Available while `type` is `template`. | - | - | | ||
| `data` | Data to use in generated file or be passed in to the template. | - | - | | ||
| `contentType` | Response Content-Type return from dev server. If empty it will be guessed from the `output` path extension. | - | - | | ||
| Name | Description | Options | Defaults | | ||
|---------------|--------------------------------------------------------------------------------------------------------------------------------------|---------------------------|----------------| | ||
| `type` | Specifies the format type of the generated file. | `json` `yaml` `template` | `json` | | ||
| `output` | Defines the path to the output file that the plugin will generate. This path is relative to the `dist` folder. | - | `./output.txt` | | ||
| `template` | Specifies the path to the template file. Supports `ejs` format template. This option is available when `type` is set to `template`. | - | - | | ||
| `data` | Specifies the data to be used in the generated file or to be passed into the template. | - | - | | ||
| `contentType` | Defines the Content-Type response returned from the dev server. If left empty, it will be inferred from the `output` path extension. | - | - | | ||
In dev mode, plugin will mock file by dev server. See [localhost:3000/__generate_file_list/](http://localhost:3000/__generate_file_list/) for more detail. | ||
In dev mode, plugin will mock file by dev server. | ||
See [localhost:5173/__generate_file_list/](http://localhost:5173/__generate_file_list/) for more detail. | ||
@@ -47,0 +50,0 @@ ## Credits |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
17103
17
7
341
1
57
1
Updatedejs@^3.1.9