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

unimport

Package Overview
Dependencies
Maintainers
3
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unimport - npm Package Compare versions

Comparing version 3.12.0 to 3.13.0

addons.d.ts

7

dist/addons.d.ts

@@ -1,7 +0,8 @@

import { p as Addon } from './shared/unimport.ead2fc37.js';
import { m as AddonVueDirectivesOptions, q as Addon } from './shared/unimport.c45f29b8.js';
export { v as vueTemplateAddon } from './shared/unimport.ba4d9d9c.js';
import 'magic-string';
import 'mlly';
declare function vueTemplateAddon(): Addon;
declare function vueDirectivesAddon(options?: AddonVueDirectivesOptions): Addon;
export { vueTemplateAddon };
export { vueDirectivesAddon };

@@ -1,4 +0,4 @@

export { vueTemplateAddon } from './addons.js';
import { U as UnimportOptions, a as Unimport, I as Import, b as InstallGlobalOptions, S as ScanDirExportsOptions, P as Preset, B as BuiltinPresetName, c as InlinePreset, T as TypeDeclarationOptions, M as MagicStringResult } from './shared/unimport.ead2fc37.js';
export { p as Addon, A as AddonsOptions, D as DetectImportResult, g as ImportCommon, q as ImportInjectionResult, f as ImportName, n as InjectImportsOptions, k as InjectionUsageRecord, e as ModuleId, i as PackagePreset, m as PathFromResolver, h as PresetImport, o as Thenable, j as UnimportContext, l as UnimportMeta, d as builtinPresets } from './shared/unimport.ead2fc37.js';
export { v as vueTemplateAddon } from './shared/unimport.ba4d9d9c.js';
import { U as UnimportOptions, a as Unimport, I as Import, b as InstallGlobalOptions, S as ScanDirExportsOptions, P as Preset, B as BuiltinPresetName, c as InlinePreset, T as TypeDeclarationOptions, M as MagicStringResult } from './shared/unimport.c45f29b8.js';
export { q as Addon, m as AddonVueDirectivesOptions, A as AddonsOptions, D as DetectImportResult, g as ImportCommon, r as ImportInjectionResult, f as ImportName, o as InjectImportsOptions, k as InjectionUsageRecord, e as ModuleId, i as PackagePreset, n as PathFromResolver, h as PresetImport, p as Thenable, j as UnimportContext, l as UnimportMeta, d as builtinPresets } from './shared/unimport.c45f29b8.js';
import { StripLiteralOptions } from 'strip-literal';

@@ -8,3 +8,3 @@ import MagicString from 'magic-string';

const version = "3.12.0";
const version = "3.13.0";

@@ -11,0 +11,0 @@ declare function createUnimport(opts: Partial<UnimportOptions>): Unimport;

import * as unplugin from 'unplugin';
import { FilterPattern } from '@rollup/pluginutils';
import { U as UnimportOptions } from './shared/unimport.ead2fc37.js';
import { U as UnimportOptions } from './shared/unimport.c45f29b8.js';
import 'magic-string';

@@ -5,0 +5,0 @@ import 'mlly';

{
"name": "unimport",
"type": "module",
"version": "3.12.0",
"packageManager": "pnpm@9.10.0",
"version": "3.13.0",
"description": "Unified utils for auto importing APIs in modules",

@@ -35,16 +34,4 @@ "license": "MIT",

],
"scripts": {
"build": "unbuild",
"dev": "vitest dev",
"lint": "eslint .",
"prepack": "unbuild",
"play": "pnpm -C playground run dev",
"play:build": "pnpm -C playground run build",
"typecheck": "vue-tsc --noEmit",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"release": "pnpm run test --run && bumpp -x \"pnpm run changelog\" --all && npm publish",
"test": "vitest --coverage"
},
"dependencies": {
"@rollup/pluginutils": "^5.1.0",
"@rollup/pluginutils": "^5.1.2",
"acorn": "^8.12.1",

@@ -64,9 +51,9 @@ "escape-string-regexp": "^5.0.0",

"devDependencies": {
"@antfu/eslint-config": "^3.6.0",
"@types/estree": "^1.0.5",
"@types/node": "^22.5.4",
"@vitest/coverage-v8": "^2.0.5",
"@antfu/eslint-config": "^3.7.2",
"@types/estree": "^1.0.6",
"@types/node": "^22.5.5",
"@vitest/coverage-v8": "^2.1.1",
"bumpp": "^9.5.2",
"conventional-changelog-cli": "^5.0.0",
"eslint": "^9.10.0",
"eslint": "^9.11.1",
"h3": "^1.12.0",

@@ -77,5 +64,16 @@ "jquery": "^3.7.1",

"unbuild": "^2.0.0",
"vitest": "^2.0.5",
"vitest": "^2.1.1",
"vue-tsc": "^2.1.6"
},
"scripts": {
"build": "unbuild",
"dev": "vitest dev",
"lint": "eslint .",
"play": "pnpm -C playground run dev",
"play:build": "pnpm -C playground run build",
"typecheck": "vue-tsc --noEmit",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"release": "pnpm run test --run && bumpp -x \"pnpm run changelog\" --all && npm publish",
"test": "vitest --coverage"
}
}
}

@@ -315,2 +315,73 @@ # unimport

### Vue Directives Auto Import and TypeScript Declaration Generation
In Vue's template, the usage of directives is in a different context than plain modules. Thus some custom transformations are required. To enable it, set `addons.vueDirectives` to `true`:
```ts
Unimport.vite({
addons: {
vueDirectives: true
}
})
```
#### Library Authors
When including directives in your presets, you should:
- provide the corresponding imports with `meta.vueDirective` set to `true`, otherwise, `unimport` will not be able to detect your directives.
- use named exports for your directives, or use default export and use `as` in the Import.
- set `dtsDisabled` to `true` if you provide a type declaration for your directives.
```ts
import type { InlinePreset } from 'unimport'
import { defineUnimportPreset } from 'unimport'
export const composables = defineUnimportPreset({
from: 'my-unimport-library/composables',
/* imports and other options */
})
export const directives = defineUnimportPreset({
from: 'my-unimport-library/directives',
// disable dts generation globally
dtsEnabled: false,
// you can declare the vue directive globally
meta: {
vueDirective: true
},
imports: [{
name: 'ClickOutside',
// disable dts generation per import
dtsEnabled: false,
// you can declare the vue directive per import
meta: {
vueDirective: true
}
}, {
name: 'default',
// you should declare `as` for default exports
as: 'Focus'
}]
})
```
#### Using Directory Scan and Local Directives
If you add a directory scan for your local directives in the project, you need to:
- provide `isDirective` in the `vueDirectives`: `unimport` will use it to detect them (will never be called for imports with `meta.vueDirective` set to `true`).
- use always named exports for your directives.
```ts
Unimport.vite({
dirs: ['./directives/**'],
addons: {
vueDirectives: {
isDirective: (normalizedImportFrom, _importEntry) => {
return normalizedImportFrom.includes('/directives/')
}
}
}
})
```
## 💻 Development

@@ -317,0 +388,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

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