Socket
Socket
Sign inDemoInstall

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.6.3 to 0.6.4

dist/chunk-4567VK3M.js

6

dist/esbuild.js
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkSZLUP4Y3js = require('./chunk-SZLUP4Y3.js');
require('./chunk-OWBBNYAL.js');
var _chunk4567VK3Mjs = require('./chunk-4567VK3M.js');
require('./chunk-RIWX7NTA.js');
// src/esbuild.ts
var esbuild_default = _chunkSZLUP4Y3js.src_default.esbuild;
var esbuild_default = _chunk4567VK3Mjs.src_default.esbuild;

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

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkSZLUP4Y3js = require('./chunk-SZLUP4Y3.js');
require('./chunk-OWBBNYAL.js');
var _chunk4567VK3Mjs = require('./chunk-4567VK3M.js');
require('./chunk-RIWX7NTA.js');
exports.default = _chunkSZLUP4Y3js.src_default;
exports.default = _chunk4567VK3Mjs.src_default;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkSZLUP4Y3js = require('./chunk-SZLUP4Y3.js');
require('./chunk-OWBBNYAL.js');
var _chunk4567VK3Mjs = require('./chunk-4567VK3M.js');
require('./chunk-RIWX7NTA.js');

@@ -11,7 +11,7 @@ // src/nuxt.ts

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

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

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkSZLUP4Y3js = require('./chunk-SZLUP4Y3.js');
require('./chunk-OWBBNYAL.js');
var _chunk4567VK3Mjs = require('./chunk-4567VK3M.js');
require('./chunk-RIWX7NTA.js');
// src/rollup.ts
var rollup_default = _chunkSZLUP4Y3js.src_default.rollup;
var rollup_default = _chunk4567VK3Mjs.src_default.rollup;

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

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

vue: ImportsMap;
'vue/macros': ImportsMap;
vuex: ImportsMap;

@@ -29,0 +30,0 @@ vitest: ImportsMap;

@@ -1,2 +0,2 @@

"use strict";require('./chunk-OWBBNYAL.js');
"use strict";require('./chunk-RIWX7NTA.js');
exports.default = module.exports;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkSZLUP4Y3js = require('./chunk-SZLUP4Y3.js');
require('./chunk-OWBBNYAL.js');
var _chunk4567VK3Mjs = require('./chunk-4567VK3M.js');
require('./chunk-RIWX7NTA.js');
// src/vite.ts
var vite_default = _chunkSZLUP4Y3js.src_default.vite;
var vite_default = _chunk4567VK3Mjs.src_default.vite;

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

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkSZLUP4Y3js = require('./chunk-SZLUP4Y3.js');
require('./chunk-OWBBNYAL.js');
var _chunk4567VK3Mjs = require('./chunk-4567VK3M.js');
require('./chunk-RIWX7NTA.js');
// src/webpack.ts
var webpack_default = _chunkSZLUP4Y3js.src_default.webpack;
var webpack_default = _chunk4567VK3Mjs.src_default.webpack;

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

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

@@ -18,2 +18,3 @@ "keywords": [

"license": "MIT",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"repository": {

@@ -24,8 +25,5 @@ "type": "git",

"funding": "https://github.com/sponsors/antfu",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"sideEffects": false,
"files": [
"dist",
"*.d.ts"
],
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {

@@ -62,2 +60,7 @@ ".": {

},
"files": [
"dist",
"*.d.ts"
],
"sideEffects": false,
"typesVersions": {

@@ -70,5 +73,2 @@ "*": {

},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"peerDependencies": {

@@ -84,24 +84,24 @@ "@vueuse/core": "*"

"@antfu/utils": "^0.5.0",
"@rollup/pluginutils": "^4.1.2",
"@rollup/pluginutils": "^4.2.0",
"local-pkg": "^0.4.1",
"magic-string": "^0.25.7",
"magic-string": "^0.26.1",
"resolve": "^1.22.0",
"unplugin": "^0.3.2"
"unplugin": "^0.4.0"
},
"devDependencies": {
"@antfu/eslint-config": "^0.16.1",
"@antfu/ni": "^0.13.0",
"@types/node": "^17.0.18",
"@antfu/eslint-config": "^0.18.8",
"@antfu/ni": "^0.13.2",
"@types/node": "^17.0.21",
"@types/resolve": "^1.20.1",
"@vueuse/metadata": "^8.0.0",
"bumpp": "^7.1.1",
"eslint": "^8.9.0",
"eslint": "^8.10.0",
"esno": "^0.14.1",
"fast-glob": "^3.2.11",
"rollup": "^2.67.2",
"tsup": "^5.11.13",
"typescript": "^4.5.5",
"vite": "^2.8.3",
"vitest": "^0.3.6",
"webpack": "^5.69.0"
"rollup": "^2.70.0",
"tsup": "^5.12.1",
"typescript": "^4.6.2",
"vite": "^2.8.6",
"vitest": "^0.6.0",
"webpack": "^5.70.0"
},

@@ -114,4 +114,4 @@ "engines": {

"dev": "tsup src/*.ts --watch src",
"lint": "eslint \"{src,test}/**/*.ts\"",
"lint:fix": "nr lint -- --fix",
"lint": "eslint .",
"lint:fix": "nr lint --fix",
"play": "npm -C playground run dev",

@@ -122,3 +122,3 @@ "release": "bumpp --commit --push --tag && pnpm publish",

},
"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"
"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```\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## 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"
}

@@ -12,3 +12,3 @@ # unplugin-auto-import

```ts
import { ref, computed } from 'vue'
import { computed, ref } from 'vue'
const count = ref(0)

@@ -96,4 +96,4 @@ const doubled = computed(() => count.value * 2)

plugins: [
require('unplugin-auto-import/webpack')({ /* options */ })
]
require('unplugin-auto-import/webpack')({ /* options */ }),
],
}

@@ -145,8 +145,8 @@ ```

build: {
chainWebpack (chain) {
chainWebpack(chain) {
chain.plugin('unplugin-auto-import').use(
AutoImportPlugin({ /* options */ })
AutoImportPlugin({ /* options */ }),
)
}
}
},
},
}

@@ -185,3 +185,3 @@ ```

/\.vue$/, /\.vue\?vue/, // .vue
/\.md$/, // .md
/\.md$/, // .md
],

@@ -200,7 +200,7 @@

// alias
['useFetch', 'useMyFetch'] // import { useFetch as useMyFetch } from '@vueuse/core',
['useFetch', 'useMyFetch'], // import { useFetch as useMyFetch } from '@vueuse/core',
],
'axios': [
// default imports
['default', 'axios'] // import { default as axios } from 'axios',
['default', 'axios'], // import { default as axios } from 'axios',
],

@@ -210,5 +210,5 @@ '[package-name]': [

// alias
['[from]', '[alias]']
]
}
['[from]', '[alias]'],
],
},
],

@@ -221,3 +221,3 @@

filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
},

@@ -229,3 +229,3 @@

/* ... */
]
],
})

@@ -249,3 +249,3 @@ ```

module.exports = {
module.exports = {
/* ... */

@@ -257,3 +257,2 @@ extends: [

}
```

@@ -260,0 +259,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

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