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
124
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.5 to 0.5.7

dist/chunk-2ZU7S4GE.js

6

dist/index.js
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkPTRUE6MPjs = require('./chunk-PTRUE6MP.js');
require('./chunk-K6SIUQH2.js');
var _chunk65NJXJN6js = require('./chunk-65NJXJN6.js');
require('./chunk-2ZU7S4GE.js');
exports.default = _chunkPTRUE6MPjs.src_default;
exports.default = _chunk65NJXJN6js.src_default;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkPTRUE6MPjs = require('./chunk-PTRUE6MP.js');
require('./chunk-K6SIUQH2.js');
var _chunk65NJXJN6js = require('./chunk-65NJXJN6.js');
require('./chunk-2ZU7S4GE.js');

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

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

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

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkPTRUE6MPjs = require('./chunk-PTRUE6MP.js');
require('./chunk-K6SIUQH2.js');
var _chunk65NJXJN6js = require('./chunk-65NJXJN6.js');
require('./chunk-2ZU7S4GE.js');
// src/rollup.ts
var rollup_default = _chunkPTRUE6MPjs.src_default.rollup;
var rollup_default = _chunk65NJXJN6js.src_default.rollup;

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

@@ -31,18 +31,18 @@ import { Arrayable, Awaitable } from '@antfu/utils';

declare type ImportNameAlias = [string, string];
declare type ImportInfo = {
interface ImportInfo {
path: string;
name?: string;
importName?: string;
};
}
declare type SideEffectsInfo = Arrayable<ImportInfo | string> | undefined;
declare type ResolvedResult = {
interface ResolvedResult {
path: string;
importName?: string;
sideEffects?: SideEffectsInfo;
};
}
declare type ResolverFunction = (name: string) => Awaitable<string | ResolvedResult | null | undefined | void>;
declare type ResolverResultObject = {
interface ResolverResultObject {
type: 'component' | 'directive';
resolve: ResolverFunction;
};
}
/**

@@ -49,0 +49,0 @@ * Given a identifier name, returns the import path or an importInfo object

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

"use strict";require('./chunk-K6SIUQH2.js');
"use strict";require('./chunk-2ZU7S4GE.js');
exports.default = module.exports;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkPTRUE6MPjs = require('./chunk-PTRUE6MP.js');
require('./chunk-K6SIUQH2.js');
var _chunk65NJXJN6js = require('./chunk-65NJXJN6.js');
require('./chunk-2ZU7S4GE.js');
// src/vite.ts
var vite_default = _chunkPTRUE6MPjs.src_default.vite;
var vite_default = _chunk65NJXJN6js.src_default.vite;

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

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkPTRUE6MPjs = require('./chunk-PTRUE6MP.js');
require('./chunk-K6SIUQH2.js');
var _chunk65NJXJN6js = require('./chunk-65NJXJN6.js');
require('./chunk-2ZU7S4GE.js');
// src/webpack.ts
var webpack_default = _chunkPTRUE6MPjs.src_default.webpack;
var webpack_default = _chunk65NJXJN6js.src_default.webpack;

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

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

@@ -54,2 +54,6 @@ "keywords": [

"import": "./dist/webpack.mjs"
},
"./esbuild": {
"require": "./dist/esbuild.js",
"import": "./dist/esbuild.mjs"
}

@@ -69,23 +73,23 @@ },

"dependencies": {
"@antfu/utils": "^0.3.0",
"@antfu/utils": "^0.4.0",
"@rollup/pluginutils": "^4.1.2",
"local-pkg": "^0.4.0",
"local-pkg": "^0.4.1",
"magic-string": "^0.25.7",
"resolve": "^1.20.0",
"unplugin": "^0.2.21"
"resolve": "^1.21.0",
"unplugin": "^0.3.0"
},
"devDependencies": {
"@antfu/eslint-config": "^0.14.0",
"@antfu/eslint-config": "^0.15.0",
"@antfu/ni": "^0.12.0",
"@types/node": "^17.0.2",
"@types/node": "^17.0.8",
"@types/resolve": "^1.20.1",
"bumpp": "^7.1.1",
"eslint": "^8.5.0",
"eslint": "^8.6.0",
"esno": "^0.13.0",
"fast-glob": "^3.2.7",
"rollup": "^2.61.1",
"tsup": "^5.11.7",
"fast-glob": "^3.2.10",
"rollup": "^2.63.0",
"tsup": "^5.11.11",
"typescript": "^4.5.4",
"vite": "^2.7.4",
"vitest": "^0.0.105",
"vite": "^2.7.10",
"vitest": "^0.0.140",
"webpack": "^5.65.0"

@@ -105,3 +109,4 @@ },

"test": "vitest"
}
},
"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"
}

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

Auto import APIs on-demand for Vite, Webpack and Rollup. With TypeScript support. Powered by [unplugin](https://github.com/unjs/unplugin).
Auto import APIs on-demand for Vite, Webpack, Rollup and esbuild. With TypeScript support. Powered by [unplugin](https://github.com/unjs/unplugin).

@@ -155,2 +155,22 @@ ---

<details>
<summary>esbuild</summary><br>
```ts
// esbuild.config.js
import { build } from 'esbuild'
build({
/* ... */
plugins: [
require('unplugin-auto-import/esbuild')({
/* options */
}),
],
})
```
<br></details>
## Configuration

@@ -157,0 +177,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