Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unplugin-auto-import

Package Overview
Dependencies
Maintainers
2
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unplugin-auto-import - npm Package Compare versions

Comparing version 0.5.9 to 0.5.10

dist/chunk-FP2O3BOJ.js

2

dist/esbuild.d.ts

@@ -5,4 +5,4 @@ import { Options } from './types';

declare const _default: (options?: Options | undefined) => Plugin$2;
declare const _default: (options?: Options | undefined) => any;
export { _default as default };
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkGJTC3XR2js = require('./chunk-GJTC3XR2.js');
var _chunkFP2O3BOJjs = require('./chunk-FP2O3BOJ.js');
require('./chunk-2ZU7S4GE.js');
// src/esbuild.ts
var esbuild_default = _chunkGJTC3XR2js.src_default.esbuild;
var esbuild_default = _chunkFP2O3BOJjs.src_default.esbuild;

@@ -9,0 +9,0 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkGJTC3XR2js = require('./chunk-GJTC3XR2.js');
var _chunkFP2O3BOJjs = require('./chunk-FP2O3BOJ.js');
require('./chunk-2ZU7S4GE.js');
exports.default = _chunkGJTC3XR2js.src_default;
exports.default = _chunkFP2O3BOJjs.src_default;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkGJTC3XR2js = require('./chunk-GJTC3XR2.js');
var _chunkFP2O3BOJjs = require('./chunk-FP2O3BOJ.js');
require('./chunk-2ZU7S4GE.js');

@@ -11,7 +11,7 @@

config.plugins = config.plugins || [];
config.plugins.unshift(_chunkGJTC3XR2js.src_default.webpack(options));
config.plugins.unshift(_chunkFP2O3BOJjs.src_default.webpack(options));
});
this.nuxt.hook("vite:extend", async (vite) => {
vite.config.plugins = vite.config.plugins || [];
vite.config.plugins.push(_chunkGJTC3XR2js.src_default.vite(options));
vite.config.plugins.push(_chunkFP2O3BOJjs.src_default.vite(options));
});

@@ -18,0 +18,0 @@ }

@@ -5,4 +5,4 @@ import { Options } from './types';

declare const _default: (options?: Options | undefined) => Plugin;
declare const _default: (options?: Options | undefined) => any;
export { _default as default };
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkGJTC3XR2js = require('./chunk-GJTC3XR2.js');
var _chunkFP2O3BOJjs = require('./chunk-FP2O3BOJ.js');
require('./chunk-2ZU7S4GE.js');
// src/rollup.ts
var rollup_default = _chunkGJTC3XR2js.src_default.rollup;
var rollup_default = _chunkFP2O3BOJjs.src_default.rollup;

@@ -9,0 +9,0 @@

@@ -59,2 +59,19 @@ import { Arrayable, Awaitable } from '@antfu/utils';

declare type ImportsFlatMap = Record<string, ResolvedResult>;
declare type ESLintGlobalsPropValue = boolean | 'readonly' | 'readable' | 'writable' | 'writeable';
interface ESLintrc {
/**
* @default false
*/
enabled?: boolean;
/**
* Filepath to save the generated eslint config
*
* @default './.eslintrc-auto-import.json'
*/
filepath?: string;
/**
* @default true
*/
globalsPropValue?: ESLintGlobalsPropValue;
}
interface Options {

@@ -109,2 +126,6 @@ /**

sourceMap?: boolean;
/**
* Generate corresponding .eslintrc-auto-import.json file.
*/
eslintrc?: ESLintrc;
}

@@ -132,7 +153,8 @@ interface TransformOptions {

}
interface ResolvedOptions extends Omit<Required<Options>, 'imports' | 'resolvers' | 'dts' | 'include' | 'exclude'>, Required<TransformOptions> {
interface ResolvedOptions extends Omit<Required<Options>, 'imports' | 'resolvers' | 'dts' | 'include' | 'exclude' | 'eslintrc'>, Required<TransformOptions> {
idFilter: (id: string) => boolean;
dts: string | false;
eslintrc: ESLintrc;
}
export { ImportInfo, ImportNameAlias, ImportsFlatMap, ImportsMap, Options, PresetName, ResolvedOptions, ResolvedResult, Resolver, ResolverFunction, ResolverResultObject, SideEffectsInfo, TransformOptions };
export { ESLintGlobalsPropValue, ESLintrc, ImportInfo, ImportNameAlias, ImportsFlatMap, ImportsMap, Options, PresetName, ResolvedOptions, ResolvedResult, Resolver, ResolverFunction, ResolverResultObject, SideEffectsInfo, TransformOptions };

@@ -5,4 +5,4 @@ import { Options } from './types';

declare const _default: (options?: Options | undefined) => Plugin$1;
declare const _default: (options?: Options | undefined) => any;
export { _default as default };
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkGJTC3XR2js = require('./chunk-GJTC3XR2.js');
var _chunkFP2O3BOJjs = require('./chunk-FP2O3BOJ.js');
require('./chunk-2ZU7S4GE.js');
// src/vite.ts
var vite_default = _chunkGJTC3XR2js.src_default.vite;
var vite_default = _chunkFP2O3BOJjs.src_default.vite;

@@ -9,0 +9,0 @@

@@ -5,4 +5,4 @@ import { Options } from './types';

declare const _default: (options?: Options | undefined) => WebpackPluginInstance;
declare const _default: (options?: Options | undefined) => any;
export { _default as default };
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkGJTC3XR2js = require('./chunk-GJTC3XR2.js');
var _chunkFP2O3BOJjs = require('./chunk-FP2O3BOJ.js');
require('./chunk-2ZU7S4GE.js');
// src/webpack.ts
var webpack_default = _chunkGJTC3XR2js.src_default.webpack;
var webpack_default = _chunkFP2O3BOJjs.src_default.webpack;

@@ -9,0 +9,0 @@

{
"name": "unplugin-auto-import",
"version": "0.5.9",
"version": "0.5.10",
"description": "Register global imports on demand for Vite and Webpack",

@@ -89,7 +89,7 @@ "keywords": [

"rollup": "^2.63.0",
"tsup": "^5.11.11",
"tsup": "^5.11.1",
"typescript": "^4.5.4",
"vite": "^2.7.10",
"vitest": "^0.0.140",
"webpack": "^5.65.0"
"vitest": "^0.0.141",
"webpack": "^5.66.0"
},

@@ -109,3 +109,3 @@ "engines": {

},
"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 { ref, computed } 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 // custom resolvers\n // see https://github.com/antfu/unplugin-auto-import/pull/23/\n resolvers: [\n /* ... */\n ]\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## 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"
"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 { ref, computed } 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```\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```\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## 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"
}

@@ -210,2 +210,10 @@ # unplugin-auto-import

// Generate corresponding .eslintrc-auto-import.json file.
// eslint globals Docs - https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals
eslintrc: {
enabled: false, // Default `false`
filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
},
// custom resolvers

@@ -225,2 +233,25 @@ // see https://github.com/antfu/unplugin-auto-import/pull/23/

## ESLint - eslint(no-undef)
Configure `options.eslintrc`, and modify your eslint configuration file.
Example:
```ts
// .eslintrc.js
module.exports = {
/* ... */
extends: [
// ...
'./.eslintrc-auto-import.json',
],
}
```
ESLint Docs: [Extending Configuration Files](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files)
> 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
## FAQ

@@ -227,0 +258,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc