Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

babel-plugin-zod-hoist

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-zod-hoist

Hoists Zod schema definitions to the top of the file.

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

Babel Plugin to Hoist Zod Schemas

Hoists Zod schema definitions to the top of the file.

This:

function getSchema() {
  return z.object({ name: z.string() });
}

Becomes this:

const _schema_94b7f = z.object({
  name: z.string(),
});
function getSchema() {
  return _schema_94b7f;
}

Motivation

Initializing Zod schemas is expensive.

By hoisting the schema to the top of the file, we can avoid re-initializing the schema every time we use it.

Why Use This?

  • Performance Boost: Prevents unnecessary re-initialization.
  • Zero Mental Overhead: Write normal Zod code - the hoisting happens automatically.
  • No Code Changes Required: Works with your existing codebase without modifications.

Installation

npm install --save-dev babel-plugin-zod-hoist

Usage

Add the plugin to your Babel configuration:

{
  "plugins": ["babel-plugin-zod-hoist"]
}

Keywords

duration

FAQs

Package last updated on 17 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts