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.6.1 to 3.7.0

dist/chunks/detect-acorn.cjs

2

dist/addons.d.ts

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

import { p as Addon } from './shared/unimport.6f84d637.js';
import { p as Addon } from './shared/unimport.d0a971e7.js';
import 'magic-string';

@@ -3,0 +3,0 @@

@@ -1,6 +0,5 @@

import { P as Preset, I as Import, B as BuiltinPresetName, a as InlinePreset, T as TypeDeclarationOptions, M as MagicStringResult, S as ScanDirExportsOptions, U as UnimportOptions, b as Thenable, c as InjectImportsOptions, d as ImportInjectionResult, e as UnimportMeta, f as UnimportContext, g as InstallGlobalOptions } from './shared/unimport.6f84d637.js';
export { p as Addon, A as AddonsOptions, k as ImportCommon, j as ImportName, n as InjectionUsageRecord, i as ModuleId, m as PackagePreset, o as PathFromResolver, l as PresetImport, h as builtinPresets } from './shared/unimport.6f84d637.js';
import { P as Preset, I as Import, B as BuiltinPresetName, a as InlinePreset, T as TypeDeclarationOptions, M as MagicStringResult, U as UnimportOptions, b as Unimport, c as InstallGlobalOptions, S as ScanDirExportsOptions } from './shared/unimport.d0a971e7.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.d0a971e7.js';
import MagicString from 'magic-string';
import { StripLiteralOptions } from 'strip-literal';
import * as mlly from 'mlly';
export { vueTemplateAddon } from './addons.js';

@@ -11,14 +10,4 @@

declare const excludeRE: RegExp[];
declare const importAsRE: RegExp;
declare const separatorRE: RegExp;
/**
* | |
* destructing case&ternary non-call inheritance | id |
* ↓ ↓ ↓ ↓ | |
*/
declare const matchRE: RegExp;
declare function stripCommentsAndStrings(code: string, options?: StripLiteralOptions): string;
declare function defineUnimportPreset(preset: InlinePreset): InlinePreset;
declare function toImports(imports: Import[], isCJS?: boolean): string;
declare function stringifyImports(imports: Import[], isCJS?: boolean): string;
declare function dedupeImports(imports: Import[], warn: (msg: string) => void): Import[];

@@ -34,3 +23,22 @@ declare function toExports(imports: Import[], fileDir?: string, includeType?: boolean): string;

declare function resolveIdAbsolute(id: string, parentId?: string): Promise<string>;
/**
* @deprecated renamed to `stringifyImports`
*/
declare const toImports: typeof stringifyImports;
declare const excludeRE: RegExp[];
declare const importAsRE: RegExp;
declare const separatorRE: RegExp;
/**
* | |
* destructing case&ternary non-call inheritance | id |
* ↓ ↓ ↓ ↓ | |
*/
declare const matchRE: RegExp;
declare function stripCommentsAndStrings(code: string, options?: StripLiteralOptions): string;
declare function createUnimport(opts: Partial<UnimportOptions>): Unimport;
declare function installGlobalAutoImports(imports: Import[] | Unimport, options?: InstallGlobalOptions): Promise<any>;
declare function scanFilesFromDir(dir: string | string[], options?: ScanDirExportsOptions): Promise<string[]>;

@@ -41,30 +49,4 @@ declare function scanDirExports(dir: string | string[], options?: ScanDirExportsOptions): Promise<Import[]>;

type Unimport = ReturnType<typeof createUnimport>;
declare function createUnimport(opts: Partial<UnimportOptions>): {
init: () => Promise<void>;
clearDynamicImports: () => void;
modifyDynamicImports: (fn: (imports: Import[]) => Thenable<void | Import[]>) => Promise<void>;
scanImportsFromDir: (dirs?: string[], options?: ScanDirExportsOptions | undefined) => Promise<Import[]>;
scanImportsFromFile: (filepath: string, includeTypes?: boolean) => Promise<Import[]>;
getImports: () => Promise<Import[]>;
getImportMap: () => Promise<Map<string, Import>>;
detectImports: (code: string | MagicString) => Promise<{
s: MagicString;
strippedCode: string;
isCJSContext: boolean;
matchedImports: Import[];
firstOccurrence: number;
}>;
injectImports: (code: string | MagicString, id?: string, options?: InjectImportsOptions) => Promise<ImportInjectionResult>;
toExports: (filepath?: string, includeTypes?: boolean) => Promise<string>;
parseVirtualImports: (code: string) => mlly.ParsedStaticImport[];
generateTypeDeclarations: (options?: TypeDeclarationOptions) => Promise<string>;
getMetadata: () => UnimportMeta | undefined;
getInternalContext: () => UnimportContext;
};
const version = "3.7.0";
declare function installGlobalAutoImports(imports: Import[] | Unimport, options?: InstallGlobalOptions): Promise<any>;
const version = "3.6.1";
export { BuiltinPresetName, Import, ImportInjectionResult, InjectImportsOptions, InlinePreset, InstallGlobalOptions, MagicStringResult, Preset, ScanDirExportsOptions, Thenable, TypeDeclarationOptions, type Unimport, UnimportContext, UnimportMeta, UnimportOptions, addImportToCode, createUnimport, dedupeDtsExports, dedupeImports, defineUnimportPreset, excludeRE, getMagicString, getString, importAsRE, installGlobalAutoImports, matchRE, normalizeImports, resolveBuiltinPresets, resolveIdAbsolute, resolvePreset, scanDirExports, scanExports, scanFilesFromDir, separatorRE, stripCommentsAndStrings, toExports, toImports, toTypeDeclarationFile, toTypeDeclarationItems, toTypeReExports, version };
export { BuiltinPresetName, Import, InlinePreset, InstallGlobalOptions, MagicStringResult, Preset, ScanDirExportsOptions, TypeDeclarationOptions, Unimport, UnimportOptions, addImportToCode, createUnimport, dedupeDtsExports, dedupeImports, defineUnimportPreset, excludeRE, getMagicString, getString, importAsRE, installGlobalAutoImports, matchRE, normalizeImports, resolveBuiltinPresets, resolveIdAbsolute, resolvePreset, scanDirExports, scanExports, scanFilesFromDir, separatorRE, stringifyImports, stripCommentsAndStrings, toExports, toImports, toTypeDeclarationFile, toTypeDeclarationItems, toTypeReExports, version };
import * as unplugin from 'unplugin';
import { FilterPattern } from '@rollup/pluginutils';
import { U as UnimportOptions } from './shared/unimport.6f84d637.js';
import { U as UnimportOptions } from './shared/unimport.d0a971e7.js';
import 'magic-string';

@@ -5,0 +5,0 @@

{
"name": "unimport",
"type": "module",
"version": "3.6.1",
"packageManager": "pnpm@8.11.0",
"version": "3.7.0",
"packageManager": "pnpm@8.12.1",
"description": "Unified utils for auto importing APIs in modules",

@@ -49,3 +49,5 @@ "license": "MIT",

"@rollup/pluginutils": "^5.1.0",
"acorn": "^8.11.2",
"escape-string-regexp": "^5.0.0",
"estree-walker": "^3.0.3",
"fast-glob": "^3.3.2",

@@ -62,6 +64,7 @@ "local-pkg": "^0.5.0",

"devDependencies": {
"@antfu/eslint-config": "^2.3.4",
"@types/node": "^20.10.3",
"@vitest/coverage-v8": "^1.0.1",
"bumpp": "^9.2.0",
"@antfu/eslint-config": "^2.4.6",
"@types/estree": "^1.0.5",
"@types/node": "^20.10.5",
"@vitest/coverage-v8": "^1.1.0",
"bumpp": "^9.2.1",
"conventional-changelog-cli": "^4.1.0",

@@ -72,7 +75,7 @@ "eslint": "8.54.0",

"lit": "^3.1.0",
"typescript": "^5.3.2",
"typescript": "^5.3.3",
"unbuild": "^2.0.0",
"vitest": "^1.0.1",
"vue-tsc": "^1.8.25"
"vitest": "^1.1.0",
"vue-tsc": "^1.8.26"
}
}

@@ -230,2 +230,14 @@ # unimport

### Acorn Parser
By default, `unimport` uses RegExp to detect unimport entries. In some cases, RegExp might not be able to detect all the entries (false positive & false negative).
We introduced a new AST-based parser powered by [acorn](https://github.com/acornjs/acorn), providing a more accurate result. The limitation is when using Acorn, it assumes all input code are valid and vanilla JavaScript code.
```ts
Unimport.vite({
parser: 'acorn'
})
```
### Vue Template Auto Import

@@ -232,0 +244,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

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