New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@yume-chan/struct

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yume-chan/struct - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

6

CHANGELOG.json

@@ -5,2 +5,8 @@ {

{
"version": "0.0.19",
"tag": "@yume-chan/struct_v0.0.19",
"date": "Sun, 09 Apr 2023 05:55:33 GMT",
"comments": {}
},
{
"version": "0.0.18",

@@ -7,0 +13,0 @@ "tag": "@yume-chan/struct_v0.0.18",

7

CHANGELOG.md
# Change Log - @yume-chan/struct
This log was last generated on Wed, 25 Jan 2023 21:33:49 GMT and should not be manually modified.
This log was last generated on Sun, 09 Apr 2023 05:55:33 GMT and should not be manually modified.
## 0.0.19
Sun, 09 Apr 2023 05:55:33 GMT
_Version update only_
## 0.0.18

@@ -6,0 +11,0 @@ Wed, 25 Jan 2023 21:33:49 GMT

8

esm/basic/definition.d.ts

@@ -1,5 +0,5 @@

import { type StructFieldValue } from "./field-value.js";
import { type StructOptions } from "./options.js";
import { type StructAsyncDeserializeStream, type StructDeserializeStream } from "./stream.js";
import { type StructValue } from "./struct-value.js";
import type { StructFieldValue } from "./field-value.js";
import type { StructOptions } from "./options.js";
import type { StructAsyncDeserializeStream, StructDeserializeStream } from "./stream.js";
import type { StructValue } from "./struct-value.js";
/**

@@ -6,0 +6,0 @@ * A field definition defines how to deserialize a field.

@@ -0,0 +0,0 @@ /**

@@ -1,4 +0,4 @@

import { type StructFieldDefinition } from "./definition.js";
import { type StructOptions } from "./options.js";
import { type StructValue } from "./struct-value.js";
import type { StructFieldDefinition } from "./definition.js";
import type { StructOptions } from "./options.js";
import type { StructValue } from "./struct-value.js";
/**

@@ -5,0 +5,0 @@ * A field value defines how to serialize a field.

@@ -0,0 +0,0 @@ /**

@@ -1,6 +0,6 @@

export * from './definition.js';
export * from './field-value.js';
export * from './options.js';
export * from './stream.js';
export * from './struct-value.js';
export * from "./definition.js";
export * from "./field-value.js";
export * from "./options.js";
export * from "./stream.js";
export * from "./struct-value.js";
//# sourceMappingURL=index.d.ts.map

@@ -1,6 +0,6 @@

export * from './definition.js';
export * from './field-value.js';
export * from './options.js';
export * from './stream.js';
export * from './struct-value.js';
export * from "./definition.js";
export * from "./field-value.js";
export * from "./options.js";
export * from "./stream.js";
export * from "./struct-value.js";
//# sourceMappingURL=index.js.map

@@ -0,0 +0,0 @@ export interface StructOptions {

@@ -0,0 +0,0 @@ export const StructDefaultOptions = {

@@ -1,2 +0,2 @@

import { type ValueOrPromise } from "../utils.js";
import type { ValueOrPromise } from "../utils.js";
export interface StructDeserializeStream {

@@ -3,0 +3,0 @@ /**

export {};
//# sourceMappingURL=stream.js.map

@@ -1,2 +0,2 @@

import { type StructFieldValue } from "./field-value.js";
import type { StructFieldValue } from "./field-value.js";
export declare const STRUCT_VALUE_SYMBOL: unique symbol;

@@ -3,0 +3,0 @@ /**

@@ -0,0 +0,0 @@ export const STRUCT_VALUE_SYMBOL = Symbol("struct-value");

@@ -9,7 +9,7 @@ declare global {

}
export * from './basic/index.js';
export * from './struct.js';
export { Struct as default } from './struct.js';
export * from './types/index.js';
export * from './utils.js';
export * from "./basic/index.js";
export * from "./struct.js";
export { Struct as default } from "./struct.js";
export * from "./types/index.js";
export * from "./utils.js";
//# sourceMappingURL=index.d.ts.map

@@ -1,6 +0,6 @@

export * from './basic/index.js';
export * from './struct.js';
export { Struct as default } from './struct.js';
export * from './types/index.js';
export * from './utils.js';
export * from "./basic/index.js";
export * from "./struct.js";
export { Struct as default } from "./struct.js";
export * from "./types/index.js";
export * from "./utils.js";
//# sourceMappingURL=index.js.map

@@ -1,4 +0,5 @@

import { type StructAsyncDeserializeStream, type StructDeserializeStream, type StructFieldDefinition, type StructOptions } from "./basic/index.js";
import { BigIntFieldType, FixedLengthBufferLikeFieldDefinition, StringBufferFieldSubType, Uint8ArrayBufferFieldSubType, VariableLengthBufferLikeFieldDefinition, type BufferFieldSubType, type FixedLengthBufferLikeFieldOptions, type LengthField, type VariableLengthBufferLikeFieldOptions } from "./types/index.js";
import { type Evaluate, type Identity, type Overwrite } from "./utils.js";
import type { StructAsyncDeserializeStream, StructDeserializeStream, StructFieldDefinition, StructOptions } from "./basic/index.js";
import type { BufferFieldSubType, FixedLengthBufferLikeFieldOptions, LengthField, VariableLengthBufferLikeFieldOptions } from "./types/index.js";
import { BigIntFieldType, FixedLengthBufferLikeFieldDefinition, StringBufferFieldSubType, Uint8ArrayBufferFieldSubType, VariableLengthBufferLikeFieldDefinition } from "./types/index.js";
import type { Evaluate, Identity, Overwrite } from "./utils.js";
export interface StructLike<TValue> {

@@ -5,0 +6,0 @@ deserialize(stream: StructDeserializeStream | StructAsyncDeserializeStream): Promise<TValue>;

@@ -0,0 +0,0 @@ import { STRUCT_VALUE_SYMBOL, StructDefaultOptions, StructValue, } from "./basic/index.js";

@@ -0,0 +0,0 @@ export interface SyncPromise<T> {

@@ -0,0 +0,0 @@ export const SyncPromise = {

@@ -1,2 +0,3 @@

import { StructFieldDefinition, StructFieldValue, type StructAsyncDeserializeStream, type StructDeserializeStream, type StructOptions, type StructValue } from "../basic/index.js";
import type { StructAsyncDeserializeStream, StructDeserializeStream, StructOptions, StructValue } from "../basic/index.js";
import { StructFieldDefinition, StructFieldValue } from "../basic/index.js";
type DataViewBigInt64Getter = (dataView: DataView, byteOffset: number, littleEndian: boolean | undefined) => bigint;

@@ -3,0 +4,0 @@ type DataViewBigInt64Setter = (dataView: DataView, byteOffset: number, value: bigint, littleEndian: boolean | undefined) => void;

import { getBigInt64, getBigUint64, setBigInt64, setBigUint64, } from "@yume-chan/dataview-bigint-polyfill/esm/fallback.js";
import { StructFieldDefinition, StructFieldValue, } from "../basic/index.js";
import { StructFieldDefinition, StructFieldValue } from "../basic/index.js";
import { SyncPromise } from "../sync-promise.js";
export class BigIntFieldType {
class BigIntFieldType {
TTypeScriptType;

@@ -17,2 +17,3 @@ size;

}
export { BigIntFieldType };
export class BigIntFieldDefinition extends StructFieldDefinition {

@@ -19,0 +20,0 @@ type;

@@ -1,2 +0,3 @@

import { StructFieldDefinition, StructFieldValue, type StructAsyncDeserializeStream, type StructDeserializeStream, type StructOptions, type StructValue } from "../../basic/index.js";
import type { StructAsyncDeserializeStream, StructDeserializeStream, StructOptions, StructValue } from "../../basic/index.js";
import { StructFieldDefinition, StructFieldValue } from "../../basic/index.js";
/**

@@ -3,0 +4,0 @@ * Base class for all types that

@@ -1,2 +0,2 @@

import { StructFieldDefinition, StructFieldValue, } from "../../basic/index.js";
import { StructFieldDefinition, StructFieldValue } from "../../basic/index.js";
import { SyncPromise } from "../../sync-promise.js";

@@ -17,3 +17,3 @@ import { decodeUtf8, encodeUtf8 } from "../../utils.js";

/** An `BufferFieldSubType` that's actually an `Uint8Array` */
export class Uint8ArrayBufferFieldSubType extends BufferFieldSubType {
class Uint8ArrayBufferFieldSubType extends BufferFieldSubType {
static Instance = new Uint8ArrayBufferFieldSubType();

@@ -33,4 +33,5 @@ constructor() {

}
export { Uint8ArrayBufferFieldSubType };
/** An `BufferFieldSubType` that converts between `Uint8Array` and `string` */
export class StringBufferFieldSubType extends BufferFieldSubType {
class StringBufferFieldSubType extends BufferFieldSubType {
static Instance = new StringBufferFieldSubType();

@@ -50,2 +51,3 @@ toBuffer(value) {

}
export { StringBufferFieldSubType };
export const EMPTY_UINT8_ARRAY = new Uint8Array(0);

@@ -52,0 +54,0 @@ export class BufferLikeFieldDefinition extends StructFieldDefinition {

@@ -1,2 +0,3 @@

import { BufferLikeFieldDefinition, type BufferFieldSubType } from "./base.js";
import type { BufferFieldSubType } from "./base.js";
import { BufferLikeFieldDefinition } from "./base.js";
export interface FixedLengthBufferLikeFieldOptions {

@@ -3,0 +4,0 @@ length: number;

@@ -0,0 +0,0 @@ import { BufferLikeFieldDefinition } from "./base.js";

@@ -0,0 +0,0 @@ export * from "./base.js";

@@ -0,0 +0,0 @@ export * from "./base.js";

@@ -1,4 +0,6 @@

import { StructFieldValue, type StructFieldDefinition, type StructOptions, type StructValue } from "../../basic/index.js";
import { type KeysOfType } from "../../utils.js";
import { BufferLikeFieldDefinition, BufferLikeFieldValue, type BufferFieldSubType } from "./base.js";
import type { StructFieldDefinition, StructOptions, StructValue } from "../../basic/index.js";
import { StructFieldValue } from "../../basic/index.js";
import type { KeysOfType } from "../../utils.js";
import type { BufferFieldSubType } from "./base.js";
import { BufferLikeFieldDefinition, BufferLikeFieldValue } from "./base.js";
export type LengthField<TFields> = KeysOfType<TFields, number | string>;

@@ -5,0 +7,0 @@ export interface VariableLengthBufferLikeFieldOptions<TFields = object, TLengthField extends LengthField<TFields> = any> {

@@ -1,3 +0,3 @@

import { StructFieldValue, } from "../../basic/index.js";
import { BufferLikeFieldDefinition, BufferLikeFieldValue, } from "./base.js";
import { StructFieldValue } from "../../basic/index.js";
import { BufferLikeFieldDefinition, BufferLikeFieldValue } from "./base.js";
export class VariableLengthBufferLikeFieldDefinition extends BufferLikeFieldDefinition {

@@ -4,0 +4,0 @@ getSize() {

@@ -0,0 +0,0 @@ export * from "./bigint.js";

@@ -0,0 +0,0 @@ export * from "./bigint.js";

@@ -1,2 +0,3 @@

import { StructFieldDefinition, StructFieldValue, type StructAsyncDeserializeStream, type StructDeserializeStream, type StructOptions, type StructValue } from "../basic/index.js";
import type { StructAsyncDeserializeStream, StructDeserializeStream, StructOptions, StructValue } from "../basic/index.js";
import { StructFieldDefinition, StructFieldValue } from "../basic/index.js";
export interface NumberFieldType {

@@ -3,0 +4,0 @@ signed: boolean;

@@ -1,2 +0,2 @@

import { StructFieldDefinition, StructFieldValue, } from "../basic/index.js";
import { StructFieldDefinition, StructFieldValue } from "../basic/index.js";
import { SyncPromise } from "../sync-promise.js";

@@ -3,0 +3,0 @@ // eslint-disable-next-line @typescript-eslint/no-namespace

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /**

{
"name": "@yume-chan/struct",
"version": "0.0.18",
"version": "0.0.19",
"description": "C-style structure serializer and deserializer.",

@@ -30,12 +30,13 @@ "keywords": [

"dependencies": {
"@yume-chan/dataview-bigint-polyfill": "^0.0.18",
"@yume-chan/dataview-bigint-polyfill": "^0.0.19",
"tslib": "^2.4.1"
},
"devDependencies": {
"@jest/globals": "^29.3.1",
"@jest/globals": "^29.5.0",
"@yume-chan/eslint-config": "^1.0.0",
"@yume-chan/tsconfig": "^1.0.0",
"cross-env": "^7.0.3",
"eslint": "^8.31.0",
"jest": "^29.3.1",
"eslint": "^8.36.0",
"jest": "^29.5.0",
"prettier": "^2.8.4",
"ts-jest": "^29.0.4",

@@ -48,4 +49,4 @@ "typescript": "^4.9.4"

"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
"lint": "eslint src/**/*.ts --fix"
"lint": "eslint src/**/*.ts --fix && prettier src/**/*.ts --write --tab-width 4"
}
}

@@ -1,8 +0,8 @@

import { type StructFieldValue } from "./field-value.js";
import { type StructOptions } from "./options.js";
import {
type StructAsyncDeserializeStream,
type StructDeserializeStream,
import type { StructFieldValue } from "./field-value.js";
import type { StructOptions } from "./options.js";
import type {
StructAsyncDeserializeStream,
StructDeserializeStream,
} from "./stream.js";
import { type StructValue } from "./struct-value.js";
import type { StructValue } from "./struct-value.js";

@@ -9,0 +9,0 @@ /**

@@ -1,4 +0,4 @@

import { type StructFieldDefinition } from "./definition.js";
import { type StructOptions } from "./options.js";
import { type StructValue } from "./struct-value.js";
import type { StructFieldDefinition } from "./definition.js";
import type { StructOptions } from "./options.js";
import type { StructValue } from "./struct-value.js";

@@ -5,0 +5,0 @@ /**

@@ -1,5 +0,5 @@

export * from './definition.js';
export * from './field-value.js';
export * from './options.js';
export * from './stream.js';
export * from './struct-value.js';
export * from "./definition.js";
export * from "./field-value.js";
export * from "./options.js";
export * from "./stream.js";
export * from "./struct-value.js";

@@ -1,2 +0,2 @@

import { type ValueOrPromise } from "../utils.js";
import type { ValueOrPromise } from "../utils.js";

@@ -3,0 +3,0 @@ // TODO: allow over reading (returning a `Uint8Array`, an `offset` and a `length`) to avoid copying

@@ -1,2 +0,2 @@

import { type StructFieldValue } from "./field-value.js";
import type { StructFieldValue } from "./field-value.js";

@@ -3,0 +3,0 @@ export const STRUCT_VALUE_SYMBOL = Symbol("struct-value");

@@ -13,6 +13,6 @@ declare global {

export * from './basic/index.js';
export * from './struct.js';
export { Struct as default } from './struct.js';
export * from './types/index.js';
export * from './utils.js';
export * from "./basic/index.js";
export * from "./struct.js";
export { Struct as default } from "./struct.js";
export * from "./types/index.js";
export * from "./utils.js";

@@ -0,1 +1,8 @@

import type {
StructAsyncDeserializeStream,
StructDeserializeStream,
StructFieldDefinition,
StructFieldValue,
StructOptions,
} from "./basic/index.js";
import {

@@ -5,9 +12,10 @@ STRUCT_VALUE_SYMBOL,

StructValue,
type StructAsyncDeserializeStream,
type StructDeserializeStream,
type StructFieldDefinition,
type StructFieldValue,
type StructOptions,
} from "./basic/index.js";
import { SyncPromise } from "./sync-promise.js";
import type {
BufferFieldSubType,
FixedLengthBufferLikeFieldOptions,
LengthField,
VariableLengthBufferLikeFieldOptions,
} from "./types/index.js";
import {

@@ -22,13 +30,4 @@ BigIntFieldDefinition,

VariableLengthBufferLikeFieldDefinition,
type BufferFieldSubType,
type FixedLengthBufferLikeFieldOptions,
type LengthField,
type VariableLengthBufferLikeFieldOptions,
} from "./types/index.js";
import {
type Evaluate,
type Identity,
type Overwrite,
type ValueOrPromise,
} from "./utils.js";
import type { Evaluate, Identity, Overwrite, ValueOrPromise } from "./utils.js";

@@ -35,0 +34,0 @@ export interface StructLike<TValue> {

@@ -8,12 +8,11 @@ import {

import {
StructFieldDefinition,
StructFieldValue,
type StructAsyncDeserializeStream,
type StructDeserializeStream,
type StructOptions,
type StructValue,
import type {
StructAsyncDeserializeStream,
StructDeserializeStream,
StructOptions,
StructValue,
} from "../basic/index.js";
import { StructFieldDefinition, StructFieldValue } from "../basic/index.js";
import { SyncPromise } from "../sync-promise.js";
import { type ValueOrPromise } from "../utils.js";
import type { ValueOrPromise } from "../utils.js";

@@ -20,0 +19,0 @@ type DataViewBigInt64Getter = (

@@ -1,11 +0,11 @@

import {
StructFieldDefinition,
StructFieldValue,
type StructAsyncDeserializeStream,
type StructDeserializeStream,
type StructOptions,
type StructValue,
import type {
StructAsyncDeserializeStream,
StructDeserializeStream,
StructOptions,
StructValue,
} from "../../basic/index.js";
import { StructFieldDefinition, StructFieldValue } from "../../basic/index.js";
import { SyncPromise } from "../../sync-promise.js";
import { decodeUtf8, encodeUtf8, type ValueOrPromise } from "../../utils.js";
import type { ValueOrPromise } from "../../utils.js";
import { decodeUtf8, encodeUtf8 } from "../../utils.js";

@@ -12,0 +12,0 @@ /**

@@ -1,2 +0,3 @@

import { BufferLikeFieldDefinition, type BufferFieldSubType } from "./base.js";
import type { BufferFieldSubType } from "./base.js";
import { BufferLikeFieldDefinition } from "./base.js";

@@ -3,0 +4,0 @@ export interface FixedLengthBufferLikeFieldOptions {

@@ -1,14 +0,11 @@

import {
StructFieldValue,
type StructFieldDefinition,
type StructOptions,
type StructValue,
import type {
StructFieldDefinition,
StructOptions,
StructValue,
} from "../../basic/index.js";
import { type KeysOfType } from "../../utils.js";
import { StructFieldValue } from "../../basic/index.js";
import type { KeysOfType } from "../../utils.js";
import {
BufferLikeFieldDefinition,
BufferLikeFieldValue,
type BufferFieldSubType,
} from "./base.js";
import type { BufferFieldSubType } from "./base.js";
import { BufferLikeFieldDefinition, BufferLikeFieldValue } from "./base.js";

@@ -15,0 +12,0 @@ export type LengthField<TFields> = KeysOfType<TFields, number | string>;

@@ -1,11 +0,10 @@

import {
StructFieldDefinition,
StructFieldValue,
type StructAsyncDeserializeStream,
type StructDeserializeStream,
type StructOptions,
type StructValue,
import type {
StructAsyncDeserializeStream,
StructDeserializeStream,
StructOptions,
StructValue,
} from "../basic/index.js";
import { StructFieldDefinition, StructFieldValue } from "../basic/index.js";
import { SyncPromise } from "../sync-promise.js";
import { type ValueOrPromise } from "../utils.js";
import type { ValueOrPromise } from "../utils.js";

@@ -12,0 +11,0 @@ export interface NumberFieldType {

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

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

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

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