@cnpmjs/packument
Advanced tools
| export type SetValue = string | number | boolean | Date | object; | ||
| export interface DeleteOptions { | ||
| /** | ||
| * If the parent property is empty after deleting the property, delete the parent property too | ||
| * @default false | ||
| */ | ||
| autoDeleteParentIfEmpty?: boolean; | ||
| } | ||
| export declare class JSONBuilder { | ||
| #private; | ||
| constructor(data: Buffer); | ||
| setIn(paths: string[], value: SetValue): this; | ||
| deleteIn(paths: string[], options?: DeleteOptions): this; | ||
| build(): Uint8Array; | ||
| } |
| import { detectDeletePropertyPosition, detectSetPropertyPosition, } from '../index.js'; | ||
| export class JSONBuilder { | ||
| #data; | ||
| constructor(data) { | ||
| this.#data = data; | ||
| } | ||
| setIn(paths, value) { | ||
| if (paths.length === 0) { | ||
| throw new TypeError('paths should not be empty array'); | ||
| } | ||
| const result = detectSetPropertyPosition(this.#data, paths); | ||
| if (result.kind === "ParentNotObject" /* SetPropertyKind.ParentNotObject */) { | ||
| throw new Error(`Parent property is not an object, can't add new property to it, need to remove it first: ${paths.slice(0, -1).join('.')}`); | ||
| } | ||
| if (result.kind === "ParentNotFound" /* SetPropertyKind.ParentNotFound */) { | ||
| // set parent property as an object | ||
| this.setIn(paths.slice(0, -1), {}); | ||
| // then set the new property | ||
| this.setIn(paths, value); | ||
| return this; | ||
| } | ||
| if (result.kind === "Update" /* SetPropertyKind.Update */) { | ||
| const updateBuffer = Buffer.from(JSON.stringify(value)); | ||
| this.#data = this.#concatBuffers([ | ||
| this.#data.subarray(0, result.start), | ||
| updateBuffer, | ||
| this.#data.subarray(result.end), | ||
| ]); | ||
| return this; | ||
| } | ||
| if (result.kind !== "Add" /* SetPropertyKind.Add */) { | ||
| throw new Error(`Unexpected set property kind: ${String(result.kind)}`); | ||
| } | ||
| // add new property | ||
| const property = paths[paths.length - 1]; | ||
| const addBuffer = Buffer.from(`${JSON.stringify(property)}:${JSON.stringify(value)}`); | ||
| if (result.previous) { | ||
| // has previous property, add the new property after the previous property | ||
| // add "," after the previous property | ||
| this.#data = this.#concatBuffers([ | ||
| this.#data.subarray(0, result.start), | ||
| Buffer.from(','), | ||
| addBuffer, | ||
| this.#data.subarray(result.start), | ||
| ]); | ||
| } | ||
| else { | ||
| // no previous property, add the new property to the end of the object | ||
| this.#data = this.#concatBuffers([ | ||
| this.#data.subarray(0, result.start), | ||
| addBuffer, | ||
| this.#data.subarray(result.start), | ||
| ]); | ||
| } | ||
| return this; | ||
| } | ||
| deleteIn(paths, options) { | ||
| if (paths.length === 0) { | ||
| throw new TypeError('paths should not be empty array'); | ||
| } | ||
| const result = detectDeletePropertyPosition(this.#data, paths); | ||
| if (result.kind === "NotFound" /* DeletePropertyKind.NotFound */) { | ||
| // do nothing | ||
| return this; | ||
| } | ||
| if (result.kind === "FoundAndOnlyOne" /* DeletePropertyKind.FoundAndOnlyOne */ && paths.length > 1 && options?.autoDeleteParentIfEmpty) { | ||
| // delete the parent property if it is empty | ||
| return this.deleteIn(paths.slice(0, -1), options); | ||
| } | ||
| // found, delete the property | ||
| this.#data = this.#concatBuffers([this.#data.subarray(0, result.start), this.#data.subarray(result.end)]); | ||
| return this; | ||
| } | ||
| build() { | ||
| return this.#data; | ||
| } | ||
| #concatBuffers(buffers) { | ||
| return Buffer.concat(buffers); | ||
| } | ||
| } |
+105
| import { | ||
| DeletePropertyKind, | ||
| detectDeletePropertyPosition, | ||
| detectSetPropertyPosition, | ||
| SetPropertyKind, | ||
| } from '../index.js' | ||
| export type SetValue = string | number | boolean | Date | object | ||
| export interface DeleteOptions { | ||
| /** | ||
| * If the parent property is empty after deleting the property, delete the parent property too | ||
| * @default false | ||
| */ | ||
| autoDeleteParentIfEmpty?: boolean | ||
| } | ||
| export class JSONBuilder { | ||
| #data: Buffer | ||
| constructor(data: Buffer) { | ||
| this.#data = data | ||
| } | ||
| setIn(paths: string[], value: SetValue): this { | ||
| if (paths.length === 0) { | ||
| throw new TypeError('paths should not be empty array') | ||
| } | ||
| const result = detectSetPropertyPosition(this.#data, paths) | ||
| if (result.kind === SetPropertyKind.ParentNotObject) { | ||
| throw new Error( | ||
| `Parent property is not an object, can't add new property to it, need to remove it first: ${paths.slice(0, -1).join('.')}`, | ||
| ) | ||
| } | ||
| if (result.kind === SetPropertyKind.ParentNotFound) { | ||
| // set parent property as an object | ||
| this.setIn(paths.slice(0, -1), {}) | ||
| // then set the new property | ||
| this.setIn(paths, value) | ||
| return this | ||
| } | ||
| if (result.kind === SetPropertyKind.Update) { | ||
| const updateBuffer = Buffer.from(JSON.stringify(value)) | ||
| this.#data = this.#concatBuffers([ | ||
| this.#data.subarray(0, result.start), | ||
| updateBuffer, | ||
| this.#data.subarray(result.end), | ||
| ]) | ||
| return this | ||
| } | ||
| if (result.kind !== SetPropertyKind.Add) { | ||
| throw new Error(`Unexpected set property kind: ${String(result.kind)}`) | ||
| } | ||
| // add new property | ||
| const property = paths[paths.length - 1] | ||
| const addBuffer = Buffer.from(`${JSON.stringify(property)}:${JSON.stringify(value)}`) | ||
| if (result.previous) { | ||
| // has previous property, add the new property after the previous property | ||
| // add "," after the previous property | ||
| this.#data = this.#concatBuffers([ | ||
| this.#data.subarray(0, result.start), | ||
| Buffer.from(','), | ||
| addBuffer, | ||
| this.#data.subarray(result.start), | ||
| ]) | ||
| } else { | ||
| // no previous property, add the new property to the end of the object | ||
| this.#data = this.#concatBuffers([ | ||
| this.#data.subarray(0, result.start), | ||
| addBuffer, | ||
| this.#data.subarray(result.start), | ||
| ]) | ||
| } | ||
| return this | ||
| } | ||
| deleteIn(paths: string[], options?: DeleteOptions): this { | ||
| if (paths.length === 0) { | ||
| throw new TypeError('paths should not be empty array') | ||
| } | ||
| const result = detectDeletePropertyPosition(this.#data, paths) | ||
| if (result.kind === DeletePropertyKind.NotFound) { | ||
| // do nothing | ||
| return this | ||
| } | ||
| if (result.kind === DeletePropertyKind.FoundAndOnlyOne && paths.length > 1 && options?.autoDeleteParentIfEmpty) { | ||
| // delete the parent property if it is empty | ||
| return this.deleteIn(paths.slice(0, -1), options) | ||
| } | ||
| // found, delete the property | ||
| this.#data = this.#concatBuffers([this.#data.subarray(0, result.start), this.#data.subarray(result.end)]) | ||
| return this | ||
| } | ||
| build(): Uint8Array { | ||
| return this.#data | ||
| } | ||
| #concatBuffers(buffers: Buffer[]): Buffer { | ||
| return Buffer.concat(buffers) | ||
| } | ||
| } |
| export * from '../index.js'; | ||
| export * from './builder.js'; |
| export * from '../index.js'; | ||
| export * from './builder.js'; |
| export * from '../index.js' | ||
| export * from './builder.js' |
+40
-0
@@ -68,2 +68,22 @@ /* auto-generated by NAPI-RS */ | ||
| export declare const enum DeletePropertyKind { | ||
| /** only one property in the object */ | ||
| FoundAndOnlyOne = 'FoundAndOnlyOne', | ||
| /** found at the start of the object */ | ||
| FoundAtStart = 'FoundAtStart', | ||
| /** found at the middle of the object */ | ||
| FoundAtMiddle = 'FoundAtMiddle', | ||
| NotFound = 'NotFound' | ||
| } | ||
| export interface DeletePropertyPositionResult { | ||
| kind: DeletePropertyKind | ||
| start: number | ||
| end: number | ||
| } | ||
| export declare function detectDeletePropertyPosition(data: Uint8Array, paths: Array<string>): DeletePropertyPositionResult | ||
| export declare function detectSetPropertyPosition(data: Uint8Array, paths: Array<string>): SetPropertyPositionResult | ||
| export interface DiffResult { | ||
@@ -136,2 +156,22 @@ addedVersions: Array<[string, [number, number]]> | ||
| export declare const enum SetPropertyKind { | ||
| Add = 'Add', | ||
| Update = 'Update', | ||
| /** the parent property is not found, should add the parent property first */ | ||
| ParentNotFound = 'ParentNotFound', | ||
| /** the parent property is not an object, can't add new property to it, need to remove it first */ | ||
| ParentNotObject = 'ParentNotObject' | ||
| } | ||
| export interface SetPropertyPositionResult { | ||
| kind: SetPropertyKind | ||
| /** | ||
| * the previous property name if the property is `Add` kind | ||
| * if the parent object doesn't have any property, the previous property name is `None` | ||
| */ | ||
| previous?: string | ||
| start: number | ||
| end: number | ||
| } | ||
| export interface Signature { | ||
@@ -138,0 +178,0 @@ sig?: string |
+54
-50
@@ -83,4 +83,4 @@ // prettier-ignore | ||
| const bindingPackageVersion = require('@cnpmjs/packument-android-arm64/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -100,4 +100,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-android-arm-eabi/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -121,4 +121,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-win32-x64-msvc/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -138,4 +138,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-win32-ia32-msvc/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -155,4 +155,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-win32-arm64-msvc/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -175,4 +175,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-darwin-universal/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -192,4 +192,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-darwin-x64/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -209,4 +209,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-darwin-arm64/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -230,4 +230,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-freebsd-x64/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -247,4 +247,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-freebsd-arm64/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -269,4 +269,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-x64-musl/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -286,4 +286,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-x64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -305,4 +305,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-arm64-musl/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -322,4 +322,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-arm64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -341,4 +341,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-arm-musleabihf/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -358,4 +358,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-arm-gnueabihf/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -377,4 +377,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-loong64-musl/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -394,4 +394,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-loong64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -413,4 +413,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-riscv64-musl/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -430,4 +430,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-riscv64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -448,4 +448,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-ppc64-gnu/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -465,4 +465,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-linux-s390x-gnu/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -486,4 +486,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-openharmony-arm64/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -503,4 +503,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-openharmony-x64/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -520,4 +520,4 @@ return binding | ||
| const bindingPackageVersion = require('@cnpmjs/packument-openharmony-arm/package.json').version | ||
| if (bindingPackageVersion !== '1.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| if (bindingPackageVersion !== '1.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { | ||
| throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) | ||
| } | ||
@@ -586,1 +586,5 @@ return binding | ||
| module.exports.Package = nativeBinding.Package | ||
| module.exports.DeletePropertyKind = nativeBinding.DeletePropertyKind | ||
| module.exports.detectDeletePropertyPosition = nativeBinding.detectDeletePropertyPosition | ||
| module.exports.detectSetPropertyPosition = nativeBinding.detectSetPropertyPosition | ||
| module.exports.SetPropertyKind = nativeBinding.SetPropertyKind |
+28
-19
| { | ||
| "name": "@cnpmjs/packument", | ||
| "version": "1.1.1", | ||
| "version": "1.2.0", | ||
| "description": "Packument helper", | ||
| "main": "index.js", | ||
| "repository": { | ||
@@ -19,5 +18,14 @@ "type": "git", | ||
| "node-addon-api", | ||
| "packument" | ||
| "packument", | ||
| "cnpm" | ||
| ], | ||
| "type": "module", | ||
| "exports": { | ||
| ".": { | ||
| "import": "./js/index.js", | ||
| "types": "./js/index.d.ts" | ||
| } | ||
| }, | ||
| "files": [ | ||
| "js", | ||
| "index.d.ts", | ||
@@ -50,5 +58,5 @@ "index.js", | ||
| "prebench": "yarn build", | ||
| "bench": "node benchmark/bench.ts", | ||
| "build": "napi build --platform --release", | ||
| "build:debug": "napi build --platform", | ||
| "bench": "node benchmark/bench.ts && node benchmark/bench_memory.ts", | ||
| "build": "tsc && napi build --platform --release --esm", | ||
| "build:debug": "tsc && napi build --platform --esm", | ||
| "format": "run-p format:prettier format:rs format:toml", | ||
@@ -58,4 +66,4 @@ "format:prettier": "prettier . -w", | ||
| "format:rs": "cargo fmt", | ||
| "lint": "oxlint .", | ||
| "prepublishOnly": "napi prepublish -t npm", | ||
| "lint": "oxlint --type-aware --type-check js", | ||
| "prepublishOnly": "tsc && napi prepublish -t npm", | ||
| "pretest": "yarn build", | ||
@@ -71,3 +79,3 @@ "test": "vitest run", | ||
| "@napi-rs/cli": "^3.2.0", | ||
| "@oxc-node/core": "^0.0.34", | ||
| "@oxc-node/core": "^0.0.35", | ||
| "@taplo/cli": "^0.7.0", | ||
@@ -80,5 +88,6 @@ "@tybys/wasm-util": "^0.10.0", | ||
| "npm-run-all2": "^8.0.4", | ||
| "oxlint": "^1.14.0", | ||
| "oxlint": "^1.31.0", | ||
| "oxlint-tsgolint": "^0.8.3", | ||
| "prettier": "^3.6.2", | ||
| "tinybench": "^5.0.1", | ||
| "tinybench": "^6.0.0", | ||
| "typescript": "^5.9.2", | ||
@@ -110,11 +119,11 @@ "vitest": "^4.0.10" | ||
| "optionalDependencies": { | ||
| "@cnpmjs/packument-win32-x64-msvc": "1.1.1", | ||
| "@cnpmjs/packument-darwin-x64": "1.1.1", | ||
| "@cnpmjs/packument-linux-x64-gnu": "1.1.1", | ||
| "@cnpmjs/packument-linux-x64-musl": "1.1.1", | ||
| "@cnpmjs/packument-linux-arm64-gnu": "1.1.1", | ||
| "@cnpmjs/packument-darwin-arm64": "1.1.1", | ||
| "@cnpmjs/packument-linux-arm64-musl": "1.1.1", | ||
| "@cnpmjs/packument-win32-arm64-msvc": "1.1.1" | ||
| "@cnpmjs/packument-win32-x64-msvc": "1.2.0", | ||
| "@cnpmjs/packument-darwin-x64": "1.2.0", | ||
| "@cnpmjs/packument-linux-x64-gnu": "1.2.0", | ||
| "@cnpmjs/packument-linux-x64-musl": "1.2.0", | ||
| "@cnpmjs/packument-linux-arm64-gnu": "1.2.0", | ||
| "@cnpmjs/packument-darwin-arm64": "1.2.0", | ||
| "@cnpmjs/packument-linux-arm64-musl": "1.2.0", | ||
| "@cnpmjs/packument-win32-arm64-msvc": "1.2.0" | ||
| } | ||
| } |
+95
-23
| # `@cnpmjs/packument` | ||
|  | ||
| [](https://github.com/cnpm/packument/actions/workflows/CI.yml) | ||
| [](https://nodejs.org/en/download/) | ||
@@ -11,2 +11,16 @@ [](https://makeapullrequest.com) | ||
| `@cnpmjs/packument` is a package metadata helper for Node.js. | ||
| It provides a way to parse package metadata from buffer and diff versions between local and remote. | ||
| Based on [sonic-rs](https://github.com/cloudwego/sonic-rs) to parse JSON efficiently. | ||
| ## Features | ||
| - [x] Parse package metadata from buffer | ||
| - [x] Diff versions between local and remote | ||
| - [x] Extract version metadata using position | ||
| - [x] Set property without parsing | ||
| - [x] Delete property without parsing | ||
| - [ ] Add value to Array property without parsing | ||
| ## Install | ||
@@ -27,3 +41,3 @@ | ||
| // Load package metadata from buffer | ||
| const buffer = readFileSync('path/to/package.json') | ||
| const buffer = readFileSync('path/to/packument.json') | ||
| const pkg = new Package(buffer) | ||
@@ -35,2 +49,7 @@ | ||
| console.log(pkg.readme) // Package readme | ||
| console.log(pkg.distTags) // { latest: '1.0.0', next: '2.0.0-beta.1' } | ||
| console.log(pkg.maintainers) // [{ name: 'foo', email: 'foo@example.com' }] | ||
| console.log(pkg.repository) // { type: 'git', url: 'https://github.com/...' } | ||
| console.log(pkg.time) // { created: '2020-01-01T00:00:00.000Z', modified: '2020-01-02T00:00:00.000Z', '1.0.0': '...' } | ||
| console.log(pkg.isUnpublished) // false | ||
@@ -56,3 +75,3 @@ // Get latest version | ||
| const localVersions = ['1.0.0', '1.0.1', '1.0.2'] | ||
| const remoteBuffer = readFileSync('path/to/remote-package.json') | ||
| const remoteBuffer = readFileSync('path/to/remote-packument.json') | ||
@@ -99,2 +118,45 @@ // Create remote package instance | ||
| ### Modify JSON Without Full Parsing (JSONBuilder) | ||
| The `JSONBuilder` class allows you to set or delete properties in a JSON buffer without parsing the entire document. This is useful for modifying large packument files efficiently. | ||
| ```javascript | ||
| import { JSONBuilder } from '@cnpmjs/packument' | ||
| import { readFileSync, writeFileSync } from 'fs' | ||
| const buffer = readFileSync('path/to/packument.json') | ||
| const builder = new JSONBuilder(buffer) | ||
| // Set a property using path array | ||
| builder.setIn(['dist-tags', 'latest'], '2.0.0') | ||
| // Add a new version | ||
| builder.setIn(['versions', '2.0.0'], { | ||
| name: 'my-package', | ||
| version: '2.0.0', | ||
| dist: { | ||
| shasum: 'abc123', | ||
| tarball: 'https://registry.npmjs.org/my-package/-/my-package-2.0.0.tgz', | ||
| }, | ||
| }) | ||
| // Delete a property | ||
| builder.deleteIn(['versions', '1.0.0-deprecated']) | ||
| // Delete with auto-cleanup of empty parent | ||
| builder.deleteIn(['versions', '0.0.1'], { autoDeleteParentIfEmpty: true }) | ||
| // Get the modified buffer | ||
| const modifiedBuffer = builder.build() | ||
| writeFileSync('path/to/packument.json', modifiedBuffer) | ||
| ``` | ||
| Supported value types for `setIn`: | ||
| - `string` | ||
| - `number` | ||
| - `boolean` | ||
| - `Date` (serialized to ISO string) | ||
| - `object` (serialized to JSON) | ||
| ## Benchmark | ||
@@ -143,25 +205,35 @@ | ||
| ├─────────┼──────────────────────────────────────────────────────────────────────┼─────────────────────┼────────────────────────┼────────────────────────┼────────────────────────┼─────────┤ | ||
| │ 0 │ 'JSONParse small data readme string (117KB)' │ '248949 ± 0.99%' │ '238125 ± 8542.0' │ '4146 ± 0.33%' │ '4199 ± 151' │ 4017 │ | ||
| │ 1 │ 'sonic-rs small data readme string (117KB)' │ '96073 ± 0.29%' │ '91542 ± 1167.0' │ '10498 ± 0.14%' │ '10924 ± 141' │ 10409 │ | ||
| │ 2 │ 'sonic-rs small data readme string with position (117KB)' │ '106362 ± 0.33%' │ '101667 ± 3125.0' │ '9514 ± 0.17%' │ '9836 ± 312' │ 9402 │ | ||
| │ 3 │ 'sonic-rs small data readme JSON buffer with position (117KB)' │ '80189 ± 0.11%' │ '77417 ± 500.00' │ '12514 ± 0.10%' │ '12917 ± 84' │ 12471 │ | ||
| │ 4 │ 'JSONParse large data readme string (22MB)' │ '74725439 ± 5.11%' │ '65167479 ± 2361458' │ '14 ± 4.53%' │ '15 ± 1' │ 64 │ | ||
| │ 5 │ 'sonic-rs large data readme string (22MB)' │ '14298166 ± 0.70%' │ '14189291 ± 172062' │ '70 ± 0.66%' │ '70 ± 1' │ 70 │ | ||
| │ 6 │ 'sonic-rs large data readme string with position (22MB)' │ '14494829 ± 1.09%' │ '14322083 ± 302250' │ '69 ± 1.01%' │ '70 ± 1' │ 70 │ | ||
| │ 7 │ 'sonic-rs large data readme JSON buffer with position (22MB)' │ '14345457 ± 0.73%' │ '14255708 ± 186354' │ '70 ± 0.70%' │ '70 ± 1' │ 70 │ | ||
| │ 8 │ 'JSONParse super large data readme string (89M)' │ '161558691 ± 2.89%' │ '168895375 ± 15843625' │ '6 ± 2.65%' │ '6 ± 1' │ 64 │ | ||
| │ 9 │ 'sonic-rs super large data readme string (89M)' │ '51225944 ± 0.52%' │ '51134480 ± 577354' │ '20 ± 0.50%' │ '20 ± 0' │ 64 │ | ||
| │ 10 │ 'sonic-rs super large data readme string with position (89M)' │ '50900172 ± 0.48%' │ '50671208 ± 589959' │ '20 ± 0.47%' │ '20 ± 0' │ 64 │ | ||
| │ 11 │ 'sonic-rs super large data readme JSON buffer with position (89M)' │ '51286851 ± 0.50%' │ '51228125 ± 562354' │ '20 ± 0.49%' │ '20 ± 0' │ 64 │ | ||
| │ 12 │ 'JSONParse big readme string (229KB, 64KB readme)' │ '320480 ± 0.93%' │ '308959 ± 9709.0' │ '3201 ± 0.36%' │ '3237 ± 102' │ 3121 │ | ||
| │ 13 │ 'sonic-rs big readme string (229KB, 64KB readme)' │ '147998 ± 0.26%' │ '148125 ± 5292.0' │ '6799 ± 0.15%' │ '6751 ± 244' │ 6757 │ | ||
| │ 14 │ 'sonic-rs big readme string with position (229KB, 64KB readme)' │ '172298 ± 0.29%' │ '169063 ± 8354.5' │ '5849 ± 0.19%' │ '5915 ± 294' │ 5804 │ | ||
| │ 15 │ 'sonic-rs big readme JSON buffer with position (229KB, 64KB readme)' │ '125021 ± 0.14%' │ '124000 ± 6459.0' │ '8027 ± 0.13%' │ '8065 ± 422' │ 7999 │ | ||
| │ 0 │ 'JSONParse small data readme string (117KB)' │ '259742 ± 0.52%' │ '247230 ± 8917.0' │ '3913 ± 0.34%' │ '4045 ± 149' │ 3850 │ | ||
| │ 1 │ 'sonic-rs small data readme string (117KB)' │ '98949 ± 0.29%' │ '98417 ± 4999.0' │ '10189 ± 0.14%' │ '10161 ± 515' │ 10107 │ | ||
| │ 2 │ 'sonic-rs small data readme string with position (117KB)' │ '107065 ± 0.22%' │ '105917 ± 5249.0' │ '9404 ± 0.14%' │ '9441 ± 456' │ 9341 │ | ||
| │ 3 │ 'sonic-rs small data readme JSON buffer with position (117KB)' │ '86159 ± 0.49%' │ '87666 ± 1084.0' │ '11706 ± 0.12%' │ '11407 ± 143' │ 11607 │ | ||
| │ 4 │ 'JSONParse large data readme string (22MB)' │ '76834607 ± 5.25%' │ '66358500 ± 2121250' │ '14 ± 4.62%' │ '15 ± 0' │ 64 │ | ||
| │ 5 │ 'sonic-rs large data readme string (22MB)' │ '14920809 ± 0.71%' │ '14854833 ± 258396' │ '67 ± 0.69%' │ '67 ± 1' │ 68 │ | ||
| │ 6 │ 'sonic-rs large data readme string with position (22MB)' │ '15473730 ± 0.91%' │ '15392875 ± 346958' │ '65 ± 0.83%' │ '65 ± 1' │ 65 │ | ||
| │ 7 │ 'sonic-rs large data readme JSON buffer with position (22MB)' │ '15280011 ± 0.88%' │ '15226563 ± 385272' │ '66 ± 0.88%' │ '66 ± 2' │ 66 │ | ||
| │ 8 │ 'JSONParse super large data readme string (89M)' │ '166472681 ± 2.56%' │ '159452958 ± 12719146' │ '6 ± 2.52%' │ '6 ± 1' │ 64 │ | ||
| │ 9 │ 'sonic-rs super large data readme string (89M)' │ '55477295 ± 0.58%' │ '55223313 ± 914063' │ '18 ± 0.57%' │ '18 ± 0' │ 64 │ | ||
| │ 10 │ 'sonic-rs super large data readme string with position (89M)' │ '54809802 ± 0.53%' │ '54409938 ± 633917' │ '18 ± 0.52%' │ '18 ± 0' │ 64 │ | ||
| │ 11 │ 'sonic-rs super large data readme JSON buffer with position (89M)' │ '54798735 ± 0.65%' │ '54398208 ± 554979' │ '18 ± 0.61%' │ '18 ± 0' │ 64 │ | ||
| │ 12 │ 'JSONParse big readme string (229KB, 64KB readme)' │ '332583 ± 1.01%' │ '318792 ± 6709.0' │ '3091 ± 0.36%' │ '3137 ± 67' │ 3007 │ | ||
| │ 13 │ 'sonic-rs big readme string (229KB, 64KB readme)' │ '154914 ± 0.66%' │ '152417 ± 2875.0' │ '6549 ± 0.20%' │ '6561 ± 123' │ 6456 │ | ||
| │ 14 │ 'sonic-rs big readme string with position (229KB, 64KB readme)' │ '185652 ± 0.74%' │ '180625 ± 5834.0' │ '5499 ± 0.27%' │ '5536 ± 179' │ 5387 │ | ||
| │ 15 │ 'sonic-rs big readme JSON buffer with position (229KB, 64KB readme)' │ '134273 ± 0.60%' │ '133083 ± 1666.0' │ '7521 ± 0.16%' │ '7514 ± 93' │ 7448 │ | ||
| │ 16 │ 'JSONParse large data add version (22MB)' │ '141596438 ± 3.18%' │ '130096250 ± 3036583' │ '7 ± 2.94%' │ '8 ± 0' │ 64 │ | ||
| │ 17 │ 'sonic-rs large data add version (22MB)' │ '47422600 ± 0.46%' │ '47358021 ± 578896' │ '21 ± 0.46%' │ '21 ± 0' │ 64 │ | ||
| │ 18 │ 'JSONParse super large data add version (89M)' │ '395517850 ± 0.63%' │ '393929666 ± 6207959' │ '3 ± 0.61%' │ '3 ± 0' │ 64 │ | ||
| │ 19 │ 'sonic-rs super large data add version (89M)' │ '170208911 ± 0.46%' │ '170423042 ± 2301708' │ '6 ± 0.46%' │ '6 ± 0' │ 64 │ | ||
| └─────────┴──────────────────────────────────────────────────────────────────────┴─────────────────────┴────────────────────────┴────────────────────────┴────────────────────────┴─────────┘ | ||
| Memory Usage: | ||
| JSONParse description (22M): 397.4 MB (min: 397.2 MB, max: 397.9 MB) | ||
| JSONParse description (89M): 583.3 MB (min: 582.6 MB, max: 584.2 MB) | ||
| SonicJSONParse description (22M): 88.4 MB (min: 88.2 MB, max: 88.9 MB) | ||
| SonicJSONParse description (89M): 155.4 MB (min: 155.2 MB, max: 155.5 MB) | ||
| JSONParse description (22M): 343.4 MB (min: 343.2 MB, max: 343.8 MB) | ||
| JSONParse description (89M): 577.1 MB (min: 576.5 MB, max: 577.7 MB) | ||
| SonicJSONParse description (22M): 81.3 MB (min: 81.1 MB, max: 81.8 MB) | ||
| SonicJSONParse description (89M): 148.8 MB (min: 148.5 MB, max: 149.2 MB) | ||
| Memory Usage: | ||
| JSONParse add version (22M): 463.9 MB (min: 462.3 MB, max: 466.6 MB) | ||
| JSONParse add version (89M): 726.5 MB (min: 723.6 MB, max: 730.4 MB) | ||
| SonicJSONParse add version (22M): 133.1 MB (min: 128.5 MB, max: 151.0 MB) | ||
| SonicJSONParse add version (89M): 417.8 MB (min: 417.8 MB, max: 417.9 MB) | ||
| ``` | ||
@@ -168,0 +240,0 @@ |
66605
22.73%11
120%928
33.53%329
28.02%Yes
NaN17
6.25%