Socket
Socket
Sign inDemoInstall

vite-plugin-utils

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-utils - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

12

function/index.d.ts

@@ -24,10 +24,10 @@ export declare function cleanUrl(url: string): string;

*/
export declare function walk(ast: Record<string, any>, visitors: {
[type: string]: (node: Record<string, any>) => void | Promise<void>;
}): Promise<void>;
export declare function walk<T = Record<string, any>>(ast: T, visitors: {
[type: string]: (node: T, ancestors: T[]) => void | Promise<void>;
}, ancestors?: T[]): Promise<void>;
export declare namespace walk {
var sync: (ast: Record<string, any>, visitors: {
[type: string]: (node: Record<string, any>) => void | Promise<void>;
}) => void;
var sync: <T = Record<string, any>>(ast: T, visitors: {
[type: string]: (node: T, ancestors: T[]) => void;
}, ancestors?: T[]) => void;
}
export declare function normalizePath(id: string): string;

@@ -63,3 +63,3 @@ import path from 'node:path';

*/
export async function walk(ast, visitors) {
export async function walk(ast, visitors, ancestors = []) {
var _a;

@@ -70,13 +70,14 @@ if (!ast)

for (const element of ast) {
await walk(element, visitors);
await walk(element, visitors, ancestors);
}
}
else {
ancestors = ancestors.concat(ast);
for (const key of Object.keys(ast)) {
await (typeof ast[key] === 'object' && walk(ast[key], visitors));
await (typeof ast[key] === 'object' && walk(ast[key], visitors, ancestors));
}
}
await ((_a = visitors[ast.type]) === null || _a === void 0 ? void 0 : _a.call(visitors, ast));
await ((_a = visitors[ast.type]) === null || _a === void 0 ? void 0 : _a.call(visitors, ast, ancestors));
}
walk.sync = function walkSync(ast, visitors) {
walk.sync = function walkSync(ast, visitors, ancestors = []) {
var _a;

@@ -87,11 +88,12 @@ if (!ast)

for (const element of ast) {
walk.sync(element, visitors);
walkSync(element, visitors, ancestors);
}
}
else {
ancestors = ancestors.concat(ast);
for (const key of Object.keys(ast)) {
typeof ast[key] === 'object' && walk.sync(ast[key], visitors);
typeof ast[key] === 'object' && walkSync(ast[key], visitors, ancestors);
}
}
(_a = visitors[ast.type]) === null || _a === void 0 ? void 0 : _a.call(visitors, ast);
(_a = visitors[ast.type]) === null || _a === void 0 ? void 0 : _a.call(visitors, ast, ancestors);
};

@@ -98,0 +100,0 @@ const isWindows = os.platform() === 'win32';

{
"name": "vite-plugin-utils",
"description": "A collection of opinionated Vite plugin utils",
"version": "0.3.2",
"version": "0.3.3",
"type": "module",

@@ -6,0 +6,0 @@ "main": "",

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