vite-plugin-vue-type-imports
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -1,3 +0,13 @@ | ||
import VitePluginVueTypeImports from './vite'; | ||
export { default } from './vite'; | ||
import 'vite'; | ||
import { Plugin } from 'vite'; | ||
interface CleanOptions { | ||
newline?: boolean; | ||
interface?: boolean; | ||
} | ||
interface PluginOptions { | ||
clean?: CleanOptions; | ||
} | ||
declare function VitePluginVueTypeImports(options?: PluginOptions): Plugin; | ||
export { VitePluginVueTypeImports as default }; |
{ | ||
"name": "vite-plugin-vue-type-imports", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"types": "dist/index.d.ts", | ||
@@ -19,6 +19,2 @@ "license": "MIT", | ||
}, | ||
"./vite": { | ||
"require": "./dist/vite.js", | ||
"import": "./dist/vite.mjs" | ||
}, | ||
"./nuxt": { | ||
@@ -30,33 +26,32 @@ "require": "./dist/nuxt.js", | ||
"scripts": { | ||
"build": "tsup", | ||
"dev": "tsup --watch src", | ||
"build": "cross-env NODE_ENV=production tsup", | ||
"dev": "cross-env NODE_ENV=development tsup --watch src", | ||
"prepublishOnly": "nr build", | ||
"lint": "eslint \"**/*.{ts,vue,mjs}\"", | ||
"lint:fix": "nr lint -- --fix", | ||
"lint:fix": "nr lint --fix", | ||
"play": "npm -C playground run dev", | ||
"play:build": "pnpm run build && npm -C playground run build", | ||
"release": "git-ensure --no-behind -b main --clean && bumpp --commit --tag --push", | ||
"test": "jest", | ||
"test:update": "jest -u" | ||
"test": "vitest", | ||
"test:ui": "vitest --ui", | ||
"coverage": "vitest run --coverage" | ||
}, | ||
"keywords": [], | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^0.11.1", | ||
"@antfu/ni": "^0.11.0", | ||
"@babel/generator": "^7.16.0", | ||
"@types/jest": "^27.0.3", | ||
"@types/node": "^16.11.11", | ||
"@vue/compiler-sfc": "^3.2.24", | ||
"bumpp": "^7.1.1", | ||
"eslint": "^8.3.0", | ||
"eslint-plugin-jest": "^25.3.0", | ||
"esno": "^0.12.1", | ||
"fast-glob": "^3.2.7", | ||
"@antfu/eslint-config": "^0.25.2", | ||
"@antfu/ni": "^0.17.2", | ||
"@types/node": "^18.6.3", | ||
"@vitest/ui": "^0.20.3", | ||
"@vue/compiler-sfc": "^3.2.37", | ||
"bumpp": "^8.2.1", | ||
"c8": "^7.12.0", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.21.0", | ||
"esno": "^0.16.3", | ||
"git-ensure": "^0.1.0", | ||
"jest": "^27.4.3", | ||
"ts-jest": "^27.0.7", | ||
"tsup": "5.6.0", | ||
"typescript": "^4.5.2", | ||
"vite": "^2.6.14", | ||
"vue": "^3.2.24" | ||
"tsup": "6.2.1", | ||
"typescript": "^4.7.4", | ||
"vite": "^3.0.4", | ||
"vitest": "^0.20.3", | ||
"vue": "^3.2.37" | ||
}, | ||
@@ -66,3 +61,8 @@ "peerDependencies": { | ||
"vue": "^3.2.24" | ||
}, | ||
"dependencies": { | ||
"@babel/types": "^7.18.10", | ||
"fast-glob": "^3.2.11", | ||
"local-pkg": "^0.4.2" | ||
} | ||
} |
@@ -29,3 +29,3 @@ <h2 align="center">vite-plugin-vue-type-imports</h2> | ||
Vue(), | ||
VueTypeImports(), | ||
VueTypeImports({/* options */}), | ||
], | ||
@@ -68,5 +68,36 @@ }) | ||
## Options | ||
```typescript | ||
VueTypeImports({ | ||
// Non-practical function | ||
// Just for those who want to get a nice output | ||
clean: { | ||
// Clean redundant newlines ("\n") | ||
newline: false, | ||
// Clean isolated interfaces which are replaced by a new interface created by the plugin | ||
interface: false, | ||
} | ||
}) | ||
``` | ||
## Known limitations | ||
- The following syntaxes are not supported currently: | ||
- `import default` | ||
- `import { a as b }` | ||
- `export default` | ||
- `export * from` | ||
- nested type parameters (e.g. `defineProps<Props<T>>()`) are not supported. | ||
- ~~At this stage, the plugin only scans the imported interfaces and does not process the interfaces defined in the SFC~~ Supported in the next release. | ||
- ~~HMR is not fully supported right now.~~ Fixed in the next release. | ||
- Interface which extends Literal Type or Intersection Type is not supported. | ||
- Types imported from external packages are not fully supported right now. | ||
- When interfaces implicitly rely on interfaces with the same name but different structures, the results may be different from what is expected. | ||
- The plugin currently only scans the content of `<script setup>`. Types defined in `<script>` will be ignored. | ||
## Notes | ||
- `Enum` types will be converted to Union Types (e.g. `type [name] = number | string`) , since Vue can't handle them right now. | ||
- The plugin may be slow because it needs to traverse the AST (using @babel/parser). | ||
## License | ||
[MIT License](https://github.com/jacobclevenger/vite-plugin-vue-gql/blob/main/LICENSE) © 2021-PRESENT [Jacob Clevenger](https://github.com/jacobclevenger) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Found 1 instance in 1 package
16
102
7
28361
5
9
113
3
1
+ Added@babel/types@^7.18.10
+ Addedfast-glob@^3.2.11
+ Addedlocal-pkg@^0.4.2
+ Added@babel/helper-string-parser@7.24.6(transitive)
+ Added@babel/helper-validator-identifier@7.24.6(transitive)
+ Added@babel/types@7.24.6(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedfast-glob@3.3.2(transitive)
+ Addedfastq@1.17.1(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedlocal-pkg@0.4.3(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.7(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedto-fast-properties@2.0.0(transitive)
+ Addedto-regex-range@5.0.1(transitive)