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.2.0 to 0.2.1

11

dist/function/index.d.ts

@@ -21,1 +21,12 @@ export declare function cleanUrl(url: string): string;

export declare function relativeify(relative: string): string;
/**
* Ast tree walk
*/
export declare function walk(ast: Record<string, any>, visitors: {
[type: string]: (node: Record<string, any>) => void | Promise<void>;
}): Promise<void>;
export declare namespace walk {
var sync: (ast: Record<string, any>, visitors: {
[type: string]: (node: Record<string, any>) => void | Promise<void>;
}) => void;
}

38

dist/function/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.relativeify = exports.MagicString = exports.cleanUrl = void 0;
exports.walk = exports.relativeify = exports.MagicString = exports.cleanUrl = void 0;
function cleanUrl(url) {

@@ -64,1 +64,37 @@ const queryRE = /\?.*$/s;

exports.relativeify = relativeify;
/**
* Ast tree walk
*/
async function walk(ast, visitors) {
var _a;
if (!ast)
return;
if (Array.isArray(ast)) {
for (const element of ast) {
await walk(element, visitors);
}
}
else {
for (const key of Object.keys(ast)) {
await (typeof ast[key] === 'object' && walk(ast[key], visitors));
}
}
await ((_a = visitors[ast.type]) === null || _a === void 0 ? void 0 : _a.call(visitors, ast));
}
exports.walk = walk;
walk.sync = function walkSync(ast, visitors) {
var _a;
if (!ast)
return;
if (Array.isArray(ast)) {
for (const element of ast) {
walk.sync(element, visitors);
}
}
else {
for (const key of Object.keys(ast)) {
typeof ast[key] === 'object' && walk.sync(ast[key], visitors);
}
}
(_a = visitors[ast.type]) === null || _a === void 0 ? void 0 : _a.call(visitors, ast);
};

2

package.json
{
"name": "vite-plugin-utils",
"description": "A collection of opinionated Vite plugin utils",
"version": "0.2.0",
"version": "0.2.1",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "repository": {

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