Comparing version 0.11.0 to 0.11.1
import type { WellKnownSymbols } from './constants'; | ||
import type { BaseParserContext } from './context'; | ||
import type { SerovalArrayBufferNode, SerovalBigIntNode, SerovalConstantNode, SerovalDateNode, SerovalIndexedValueNode, SerovalNumberNode, SerovalReferenceNode, SerovalRegExpNode, SerovalStringNode, SerovalWKSymbolNode } from './types'; | ||
export declare function createNumberNode(value: number): SerovalConstantNode | SerovalNumberNode; | ||
export declare function createStringNode(value: string): SerovalStringNode; | ||
export declare function createBigIntNode(ctx: BaseParserContext, current: bigint): SerovalBigIntNode; | ||
export declare function createBigIntNode(current: bigint): SerovalBigIntNode; | ||
export declare function createIndexedValueNode(id: number): SerovalIndexedValueNode; | ||
@@ -11,3 +10,3 @@ export declare function createDateNode(id: number, current: Date): SerovalDateNode; | ||
export declare function createArrayBufferNode(id: number, current: ArrayBuffer): SerovalArrayBufferNode; | ||
export declare function createWKSymbolNode(ctx: BaseParserContext, id: number, current: WellKnownSymbols): SerovalWKSymbolNode; | ||
export declare function createWKSymbolNode(id: number, current: WellKnownSymbols): SerovalWKSymbolNode; | ||
export declare function createReferenceNode<T>(id: number, ref: T): SerovalReferenceNode; |
{ | ||
"name": "seroval", | ||
"type": "module", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"files": [ | ||
@@ -21,3 +21,3 @@ "dist", | ||
"eslint-config-lxsmnsyc": "^0.6.5", | ||
"pridepack": "2.5.0", | ||
"pridepack": "2.5.1", | ||
"tslib": "^2.6.2", | ||
@@ -70,3 +70,3 @@ "typescript": "^5.2.2", | ||
}, | ||
"gitHead": "1104f3349a30b4bcd51cf67f6dff49d3e7e52dce" | ||
"gitHead": "745467fa453ee90169f50bf543f5a8649699982e" | ||
} |
@@ -1,7 +0,4 @@ | ||
import UnsupportedTypeError from './UnsupportedTypeError'; | ||
import assert from './assert'; | ||
import { Feature } from './compat'; | ||
import type { WellKnownSymbols } from './constants'; | ||
import { INV_SYMBOL_REF, SerovalNodeType } from './constants'; | ||
import type { BaseParserContext } from './context'; | ||
import { | ||
@@ -77,6 +74,4 @@ INFINITY_NODE, | ||
export function createBigIntNode( | ||
ctx: BaseParserContext, | ||
current: bigint, | ||
): SerovalBigIntNode { | ||
assert(ctx.features & Feature.BigInt, new UnsupportedTypeError(current)); | ||
return { | ||
@@ -176,7 +171,5 @@ t: SerovalNodeType.BigInt, | ||
export function createWKSymbolNode( | ||
ctx: BaseParserContext, | ||
id: number, | ||
current: WellKnownSymbols, | ||
): SerovalWKSymbolNode { | ||
assert(ctx.features & Feature.Symbol, new UnsupportedTypeError(current)); | ||
assert(current in INV_SYMBOL_REF, new Error('Only well-known symbols are supported.')); | ||
@@ -183,0 +176,0 @@ return { |
@@ -725,3 +725,3 @@ /* eslint-disable no-await-in-loop */ | ||
if (ctx.features & Feature.BigInt && t === 'bigint') { | ||
return createBigIntNode(ctx, current as bigint); | ||
return createBigIntNode(current as bigint); | ||
} | ||
@@ -728,0 +728,0 @@ switch (t) { |
@@ -43,3 +43,2 @@ import assert from '../assert'; | ||
): SerovalTypedArrayNode { | ||
assert(ctx.features & Feature.TypedArray, new UnsupportedTypeError(current)); | ||
return { | ||
@@ -122,3 +121,3 @@ t: SerovalNodeType.TypedArray, | ||
} | ||
return createWKSymbolNode(ctx, newID, current as WellKnownSymbols); | ||
return createWKSymbolNode(newID, current as WellKnownSymbols); | ||
} | ||
@@ -125,0 +124,0 @@ |
@@ -848,3 +848,3 @@ /* eslint-disable no-await-in-loop */ | ||
if (ctx.features & Feature.BigInt && t === 'bigint') { | ||
return createBigIntNode(ctx, current as bigint); | ||
return createBigIntNode(current as bigint); | ||
} | ||
@@ -851,0 +851,0 @@ switch (t) { |
@@ -605,3 +605,3 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ | ||
if (ctx.features & Feature.BigInt && t === 'bigint') { | ||
return createBigIntNode(ctx, current as bigint); | ||
return createBigIntNode(current as bigint); | ||
} | ||
@@ -608,0 +608,0 @@ switch (t) { |
@@ -1,6 +0,3 @@ | ||
import assert from '../assert'; | ||
import { Feature } from '../compat'; | ||
import type { CrossParserContext } from './context'; | ||
import { serializeString } from '../string'; | ||
import UnsupportedTypeError from '../UnsupportedTypeError'; | ||
import { serializeArrayBuffer } from './primitives'; | ||
@@ -18,3 +15,2 @@ import type { | ||
): Promise<SerovalBlobNode> { | ||
assert(ctx.features & Feature.WebAPI, new UnsupportedTypeError(current)); | ||
return { | ||
@@ -41,3 +37,2 @@ t: SerovalNodeType.Blob, | ||
): Promise<SerovalFileNode> { | ||
assert(ctx.features & Feature.WebAPI, new UnsupportedTypeError(current)); | ||
return { | ||
@@ -44,0 +39,0 @@ t: SerovalNodeType.File, |
@@ -724,3 +724,3 @@ /* eslint-disable no-await-in-loop */ | ||
if (ctx.features & Feature.BigInt && t === 'bigint') { | ||
return createBigIntNode(ctx, current as bigint); | ||
return createBigIntNode(current as bigint); | ||
} | ||
@@ -727,0 +727,0 @@ switch (t) { |
@@ -109,3 +109,3 @@ import assert from '../assert'; | ||
} | ||
return createWKSymbolNode(ctx, id, current as WellKnownSymbols); | ||
return createWKSymbolNode(id, current as WellKnownSymbols); | ||
} | ||
@@ -112,0 +112,0 @@ |
@@ -605,3 +605,3 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ | ||
if (ctx.features & Feature.BigInt && t === 'bigint') { | ||
return createBigIntNode(ctx, current as bigint); | ||
return createBigIntNode(current as bigint); | ||
} | ||
@@ -608,0 +608,0 @@ switch (t) { |
@@ -1,6 +0,3 @@ | ||
import assert from '../assert'; | ||
import { Feature } from '../compat'; | ||
import type { ParserContext } from './context'; | ||
import { serializeString } from '../string'; | ||
import UnsupportedTypeError from '../UnsupportedTypeError'; | ||
import { serializeArrayBuffer } from './primitives'; | ||
@@ -18,3 +15,2 @@ import type { | ||
): Promise<SerovalBlobNode> { | ||
assert(ctx.features & Feature.WebAPI, new UnsupportedTypeError(current)); | ||
return { | ||
@@ -41,3 +37,2 @@ t: SerovalNodeType.Blob, | ||
): Promise<SerovalFileNode> { | ||
assert(ctx.features & Feature.WebAPI, new UnsupportedTypeError(current)); | ||
return { | ||
@@ -44,0 +39,0 @@ t: SerovalNodeType.File, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1374598
82
20472