@kubb/ast 5.0.0-beta.41 → 5.0.0-beta.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/factory.ts +2 -2
- package/src/signature.ts +2 -2
- package/src/utils.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/ast",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.42",
|
|
4
4
|
"description": "Spec-agnostic AST layer for Kubb. Defines the node tree, visitor pattern, factory functions, and type guards used across all code generation plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ast",
|
package/src/factory.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash } from 'node:crypto'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import { trimExtName } from '@internals/utils'
|
|
4
4
|
import type { InferSchemaNode } from './infer.ts'
|
|
@@ -673,7 +673,7 @@ export function createFile<TMeta extends object = object>(input: UserFileNode<TM
|
|
|
673
673
|
return {
|
|
674
674
|
kind: 'File',
|
|
675
675
|
...input,
|
|
676
|
-
id:
|
|
676
|
+
id: hash('sha256', input.path, 'hex'),
|
|
677
677
|
name: trimExtName(input.baseName),
|
|
678
678
|
extname,
|
|
679
679
|
imports: resolvedImports,
|
package/src/signature.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash } from 'node:crypto'
|
|
2
2
|
import type { SchemaNode } from './nodes/index.ts'
|
|
3
3
|
import { extractRefName } from './refs.ts'
|
|
4
4
|
|
|
@@ -195,7 +195,7 @@ const signatureCache = new WeakMap<SchemaNode, string>()
|
|
|
195
195
|
export function signatureOf(node: SchemaNode): string {
|
|
196
196
|
const cached = signatureCache.get(node)
|
|
197
197
|
if (cached !== undefined) return cached
|
|
198
|
-
const signature =
|
|
198
|
+
const signature = hash('sha256', describeShape(node), 'hex')
|
|
199
199
|
signatureCache.set(node, signature)
|
|
200
200
|
return signature
|
|
201
201
|
}
|
package/src/utils.ts
CHANGED
|
@@ -576,7 +576,7 @@ function sortKey(node: { name?: string | Array<unknown> | null; isTypeOnly?: boo
|
|
|
576
576
|
const isArray = Array.isArray(node.name) ? '1' : '0'
|
|
577
577
|
const typeOnly = node.isTypeOnly ? '0' : '1'
|
|
578
578
|
const hasName = node.name != null ? '1' : '0'
|
|
579
|
-
const name = Array.isArray(node.name) ?
|
|
579
|
+
const name = Array.isArray(node.name) ? node.name.toSorted().join('\0') : (node.name ?? '')
|
|
580
580
|
return `${isArray}:${typeOnly}:${node.path}:${hasName}:${name}`
|
|
581
581
|
}
|
|
582
582
|
|