unplugin-auto-import
Advanced tools
Comparing version 0.6.9 to 0.7.0
@@ -1,2 +0,2 @@ | ||
import { Options } from './types'; | ||
import { Options } from './types.js'; | ||
import '@antfu/utils'; | ||
@@ -3,0 +3,0 @@ import '@rollup/pluginutils'; |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkKSE6FVK6js = require('./chunk-KSE6FVK6.js'); | ||
require('./chunk-26H2SXXW.js'); | ||
var _chunkOZ4EMZK6js = require('./chunk-OZ4EMZK6.js'); | ||
require('./chunk-YTHWPDQD.js'); | ||
// src/esbuild.ts | ||
var esbuild_default = _chunkKSE6FVK6js.src_default.esbuild; | ||
var esbuild_default = _chunkOZ4EMZK6js.src_default.esbuild; | ||
@@ -9,0 +9,0 @@ |
import * as unplugin from 'unplugin'; | ||
import { Options } from './types'; | ||
import { Options } from './types.js'; | ||
import '@antfu/utils'; | ||
@@ -4,0 +4,0 @@ import '@rollup/pluginutils'; |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkKSE6FVK6js = require('./chunk-KSE6FVK6.js'); | ||
require('./chunk-26H2SXXW.js'); | ||
var _chunkOZ4EMZK6js = require('./chunk-OZ4EMZK6.js'); | ||
require('./chunk-YTHWPDQD.js'); | ||
exports.default = _chunkKSE6FVK6js.src_default; | ||
exports.default = _chunkOZ4EMZK6js.src_default; |
@@ -1,2 +0,2 @@ | ||
import { Options } from './types'; | ||
import { Options } from './types.js'; | ||
import '@antfu/utils'; | ||
@@ -3,0 +3,0 @@ import '@rollup/pluginutils'; |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkKSE6FVK6js = require('./chunk-KSE6FVK6.js'); | ||
require('./chunk-26H2SXXW.js'); | ||
var _chunkOZ4EMZK6js = require('./chunk-OZ4EMZK6.js'); | ||
require('./chunk-YTHWPDQD.js'); | ||
@@ -11,7 +11,7 @@ // src/nuxt.ts | ||
config.plugins = config.plugins || []; | ||
config.plugins.unshift(_chunkKSE6FVK6js.src_default.webpack(options)); | ||
config.plugins.unshift(_chunkOZ4EMZK6js.src_default.webpack(options)); | ||
}); | ||
this.nuxt.hook("vite:extend", async (vite) => { | ||
vite.config.plugins = vite.config.plugins || []; | ||
vite.config.plugins.push(_chunkKSE6FVK6js.src_default.vite(options)); | ||
vite.config.plugins.push(_chunkOZ4EMZK6js.src_default.vite(options)); | ||
}); | ||
@@ -18,0 +18,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { Options } from './types'; | ||
import { Options } from './types.js'; | ||
import '@antfu/utils'; | ||
@@ -3,0 +3,0 @@ import '@rollup/pluginutils'; |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkKSE6FVK6js = require('./chunk-KSE6FVK6.js'); | ||
require('./chunk-26H2SXXW.js'); | ||
var _chunkOZ4EMZK6js = require('./chunk-OZ4EMZK6.js'); | ||
require('./chunk-YTHWPDQD.js'); | ||
// src/rollup.ts | ||
var rollup_default = _chunkKSE6FVK6js.src_default.rollup; | ||
var rollup_default = _chunkOZ4EMZK6js.src_default.rollup; | ||
@@ -9,0 +9,0 @@ |
@@ -39,12 +39,25 @@ import { Arrayable, Awaitable } from '@antfu/utils'; | ||
declare type ImportNameAlias = [string, string]; | ||
interface ImportInfo { | ||
path: string; | ||
interface ImportInfoLegacy { | ||
/** | ||
* @deprecated renamed to `as` | ||
*/ | ||
name?: string; | ||
/** | ||
* @deprecated renamed to `name` | ||
*/ | ||
importName?: string; | ||
/** | ||
* @deprecated renamed to `from` | ||
*/ | ||
path: string; | ||
sideEffects?: SideEffectsInfo; | ||
} | ||
interface ImportInfo { | ||
as?: string; | ||
name?: string; | ||
from: string; | ||
} | ||
declare type ImportNameAlias = [string, string]; | ||
declare type SideEffectsInfo = Arrayable<ImportInfo | string> | undefined; | ||
interface ResolvedResult { | ||
path: string; | ||
importName?: string; | ||
interface ResolvedResult extends ImportInfo { | ||
sideEffects?: SideEffectsInfo; | ||
@@ -167,2 +180,2 @@ } | ||
export { ESLintGlobalsPropValue, ESLintrc, ImportInfo, ImportNameAlias, ImportsFlatMap, ImportsMap, Options, PresetName, ResolvedOptions, ResolvedResult, Resolver, ResolverFunction, ResolverResultObject, SideEffectsInfo, TransformOptions }; | ||
export { ESLintGlobalsPropValue, ESLintrc, ImportInfo, ImportInfoLegacy, ImportNameAlias, ImportsFlatMap, ImportsMap, Options, PresetName, ResolvedOptions, ResolvedResult, Resolver, ResolverFunction, ResolverResultObject, SideEffectsInfo, TransformOptions }; |
@@ -1,2 +0,2 @@ | ||
"use strict";require('./chunk-26H2SXXW.js'); | ||
"use strict";require('./chunk-YTHWPDQD.js'); | ||
exports.default = module.exports; |
@@ -1,2 +0,2 @@ | ||
import { Options } from './types'; | ||
import { Options } from './types.js'; | ||
import '@antfu/utils'; | ||
@@ -3,0 +3,0 @@ import '@rollup/pluginutils'; |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkKSE6FVK6js = require('./chunk-KSE6FVK6.js'); | ||
require('./chunk-26H2SXXW.js'); | ||
var _chunkOZ4EMZK6js = require('./chunk-OZ4EMZK6.js'); | ||
require('./chunk-YTHWPDQD.js'); | ||
// src/vite.ts | ||
var vite_default = _chunkKSE6FVK6js.src_default.vite; | ||
var vite_default = _chunkOZ4EMZK6js.src_default.vite; | ||
@@ -9,0 +9,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Options } from './types'; | ||
import { Options } from './types.js'; | ||
import '@antfu/utils'; | ||
@@ -3,0 +3,0 @@ import '@rollup/pluginutils'; |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkKSE6FVK6js = require('./chunk-KSE6FVK6.js'); | ||
require('./chunk-26H2SXXW.js'); | ||
var _chunkOZ4EMZK6js = require('./chunk-OZ4EMZK6.js'); | ||
require('./chunk-YTHWPDQD.js'); | ||
// src/webpack.ts | ||
var webpack_default = _chunkKSE6FVK6js.src_default.webpack; | ||
var webpack_default = _chunkOZ4EMZK6js.src_default.webpack; | ||
@@ -9,0 +9,0 @@ |
{ | ||
"name": "unplugin-auto-import", | ||
"version": "0.6.9", | ||
"version": "0.7.0", | ||
"description": "Register global imports on demand for Vite and Webpack", | ||
@@ -84,20 +84,20 @@ "keywords": [ | ||
"resolve": "^1.22.0", | ||
"unplugin": "^0.4.0" | ||
"unplugin": "^0.6.1" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^0.18.8", | ||
"@antfu/ni": "^0.13.2", | ||
"@types/node": "^17.0.21", | ||
"@antfu/eslint-config": "^0.20.2", | ||
"@antfu/ni": "^0.14.0", | ||
"@types/node": "^17.0.23", | ||
"@types/resolve": "^1.20.1", | ||
"@vueuse/metadata": "^8.0.0", | ||
"@vueuse/metadata": "^8.2.5", | ||
"bumpp": "^7.1.1", | ||
"eslint": "^8.10.0", | ||
"eslint": "^8.13.0", | ||
"esno": "^0.14.1", | ||
"fast-glob": "^3.2.11", | ||
"rollup": "^2.70.0", | ||
"tsup": "^5.12.1", | ||
"typescript": "^4.6.2", | ||
"vite": "^2.8.6", | ||
"vitest": "^0.6.0", | ||
"webpack": "^5.70.0" | ||
"rollup": "^2.70.1", | ||
"tsup": "^5.12.4", | ||
"typescript": "^4.6.3", | ||
"vite": "^2.9.1", | ||
"vitest": "^0.9.2", | ||
"webpack": "^5.72.0" | ||
}, | ||
@@ -115,5 +115,6 @@ "engines": { | ||
"start": "esno src/index.ts", | ||
"test": "vitest" | ||
"test": "vitest", | ||
"test:run": "vitest run" | ||
}, | ||
"readme": "# unplugin-auto-import\n\n[![NPM version](https://img.shields.io/npm/v/unplugin-auto-import?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-auto-import)\n\nAuto import APIs on-demand for Vite, Webpack, Rollup and esbuild. With TypeScript support. Powered by [unplugin](https://github.com/unjs/unplugin).\n\n---\n\nwithout\n\n```ts\nimport { computed, ref } from 'vue'\nconst count = ref(0)\nconst doubled = computed(() => count.value * 2)\n```\n\nwith\n\n```ts\nconst count = ref(0)\nconst doubled = computed(() => count.value * 2)\n```\n\n---\n\nwithout\n\n```tsx\nimport { useState } from 'react'\nexport function Counter() {\n const [count, setCount] = useState(0)\n return <div>{ count }</div>\n}\n```\n\nwith\n\n```tsx\nexport function Counter() {\n const [count, setCount] = useState(0)\n return <div>{ count }</div>\n}\n```\n\n## Install\n\n```bash\nnpm i -D unplugin-auto-import\n```\n\n<details>\n<summary>Vite</summary><br>\n\n```ts\n// vite.config.ts\nimport AutoImport from 'unplugin-auto-import/vite'\n\nexport default defineConfig({\n plugins: [\n AutoImport({ /* options */ }),\n ],\n})\n```\n\nExample: [`playground/`](./playground/)\n\n<br></details>\n\n<details>\n<summary>Rollup</summary><br>\n\n```ts\n// rollup.config.js\nimport AutoImport from 'unplugin-auto-import/rollup'\n\nexport default {\n plugins: [\n AutoImport({ /* options */ }),\n // other plugins\n ],\n}\n```\n\n<br></details>\n\n\n<details>\n<summary>Webpack</summary><br>\n\n```ts\n// webpack.config.js\nmodule.exports = {\n /* ... */\n plugins: [\n require('unplugin-auto-import/webpack')({ /* options */ }),\n ],\n}\n```\n\n<br></details>\n\n<details>\n<summary>Nuxt</summary><br>\n\n```ts\n// nuxt.config.js\nexport default {\n buildModules: [\n ['unplugin-auto-import/nuxt', { /* options */ }],\n ],\n}\n```\n\n> This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)\n\n<br></details>\n\n<details>\n<summary>Vue CLI</summary><br>\n\n```ts\n// vue.config.js\nmodule.exports = {\n configureWebpack: {\n plugins: [\n require('unplugin-auto-import/webpack')({ /* options */ }),\n ],\n },\n}\n```\n\n<br></details>\n\n<details>\n<summary>Quasar</summary><br>\n\n```ts\n// quasar.conf.js\nconst AutoImportPlugin = require('unplugin-auto-import/webpack')\n\nmodule.exports = {\n build: {\n chainWebpack(chain) {\n chain.plugin('unplugin-auto-import').use(\n AutoImportPlugin({ /* options */ }),\n )\n },\n },\n}\n```\n\n<br></details>\n\n\n<details>\n<summary>esbuild</summary><br>\n\n```ts\n// esbuild.config.js\nimport { build } from 'esbuild'\n\nbuild({\n /* ... */\n plugins: [\n require('unplugin-auto-import/esbuild')({\n /* options */\n }),\n ],\n})\n```\n\n<br></details>\n\n## Configuration\n\n```ts\nAutoImport({\n // targets to transform\n include: [\n /\\.[tj]sx?$/, // .ts, .tsx, .js, .jsx\n /\\.vue$/, /\\.vue\\?vue/, // .vue\n /\\.md$/, // .md\n ],\n\n // global imports to register\n imports: [\n // presets\n 'vue',\n 'vue-router',\n // custom\n {\n '@vueuse/core': [\n // named imports\n 'useMouse', // import { useMouse } from '@vueuse/core',\n // alias\n ['useFetch', 'useMyFetch'], // import { useFetch as useMyFetch } from '@vueuse/core',\n ],\n 'axios': [\n // default imports\n ['default', 'axios'], // import { default as axios } from 'axios',\n ],\n '[package-name]': [\n '[import-names]',\n // alias\n ['[from]', '[alias]'],\n ],\n },\n ],\n\n // Generate corresponding .eslintrc-auto-import.json file.\n // eslint globals Docs - https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals\n eslintrc: {\n enabled: false, // Default `false`\n filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`\n globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')\n },\n\n // custom resolvers\n // see https://github.com/antfu/unplugin-auto-import/pull/23/\n resolvers: [\n /* ... */\n ],\n\n // Filepath to generate corresponding .d.ts file.\n // Defaults to './auto-imports.d.ts' when `typescript` is installed locally.\n // Set `false` to disable.\n dts: './auto-imports.d.ts',\n})\n```\n\nRefer to the [type definitions](./src/types.ts) for more options.\n\n## Presets\n\nSee [src/presets](./src/presets).\n\n## ESLint - eslint(no-undef)\n\nConfigure `options.eslintrc`, and modify your eslint configuration file.\n\nExample:\n\n```ts\n// .eslintrc.js\n\nmodule.exports = {\n /* ... */\n extends: [\n // ...\n './.eslintrc-auto-import.json',\n ],\n}\n```\n\nESLint Docs: [Extending Configuration Files](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files)\n\n> Note: `.eslintrc-auto-import.json` is generated automatically, If the configuration file changes do not take effect in time, please check the configuration file, restart eslint server or the editor\n\n## TypeScript\n\nIn order to properly hint types for auto-imported APIs, make sure:\n\n- to configure `options.dts` so that `auto-imports.d.ts` file is automatically generated\n- to include `auto-imports.d.ts` in `tsconfig.json`\n\n## FAQ\n\n### Compare to [`vue-global-api`](https://github.com/antfu/vue-global-api)\n\nYou can think of this plugin as a successor to `vue-global-api`, but offering much more flexibility and bindings with libraries other than Vue (e.g. React).\n\n###### Pros\n\n- Flexible and customizable\n- Tree-shakable (on-demand transforming)\n- No global population\n\n###### Cons\n\n- Relying on build tools integrations (while `vue-global-api` is pure runtime) - but hey, we have supported quite a few of them already!\n\n## Sponsors\n\n<p align=\"center\">\n <a href=\"https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg\">\n <img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>\n </a>\n</p>\n\n## License\n\n[MIT](./LICENSE) License © 2021 [Anthony Fu](https://github.com/antfu)\n" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
68451
2009
+ Addedunplugin@0.6.3(transitive)
+ Addedwebpack-sources@3.2.3(transitive)
- Removedunplugin@0.4.0(transitive)
Updatedunplugin@^0.6.1