
Security News
npm v12 Ships With Install Scripts Off by Default, Begins Deprecating 2FA-Bypass Tokens
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.
@kubb/ast
Advanced tools
Spec-agnostic AST layer for Kubb. Defines nodes, visitor pattern, and factory functions used across codegen plugins.
Spec-agnostic AST layer for Kubb. Defines nodes, visitor pattern, factory functions, and type guards used across codegen plugins.
| Path | Contents |
|---|---|
@kubb/ast | Runtime: factory functions, guards, visitor, ref helpers, constants |
@kubb/ast/types | Types only: all node interfaces, type aliases, visitor types |
RootNode
├── schemas: SchemaNode[]
└── operations: OperationNode[]
├── parameters: ParameterNode[] → SchemaNode
├── requestBody?: SchemaNode
└── responses: ResponseNode[] → SchemaNode?
SchemaNode (discriminated union)
object → properties: PropertyNode[] → SchemaNode
array | tuple → items: SchemaNode[]
union | intersection → members: SchemaNode[]
enum | ref | string | number | integer | bigint
boolean | null | any | unknown | void
date | datetime | time | uuid | email | url | blob
import { createRoot, createOperation, createSchema, createProperty } from '@kubb/ast'
const root = createRoot({
schemas: [
createSchema({
name: 'Pet',
type: 'object',
properties: [
createProperty({ name: 'id', schema: createSchema({ type: 'integer' }), required: true }),
createProperty({ name: 'name', schema: createSchema({ type: 'string' }), required: true }),
],
}),
],
})
import { walk, transform, collect } from '@kubb/ast'
// Side effects
await walk(root, {
schema(node) { console.log(node.type) },
})
// Immutable transformation
const updated = transform(root, {
schema(node) { return { ...node, description: 'generated' } },
})
// Extraction
const types = collect<string>(root, {
schema(node) { return node.type },
})
import { isSchemaNode, narrowSchema } from '@kubb/ast'
import type { Node } from '@kubb/ast/types'
function process(node: Node) {
if (isSchemaNode(node)) {
const obj = narrowSchema(node, 'object')
obj?.properties?.forEach(p => console.log(p.name))
}
}
import { buildRefMap, resolveRef } from '@kubb/ast'
const refMap = buildRefMap(root)
const pet = resolveRef(refMap, 'Pet')
Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
FAQs
Spec-agnostic AST layer for Kubb. Defines nodes, visitor pattern, and factory functions used across codegen plugins.
The npm package @kubb/ast receives a total of 44,663 weekly downloads. As such, @kubb/ast popularity was classified as popular.
We found that @kubb/ast demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.

Research
/Security News
Socket tracks the activity as Operation “Muck and Load”: a threat actor uses commit-farming workflows, public dead drops, and protected archives to stage Windows RAT and infostealer malware.

Security News
pnpm 11.10 hardens registry auth to block token redirection, tightens pack-app and deploy, and makes the Rust port (v12) installable.