fix(build,json): replace lodash.clonedeep with structuredClone and migrate package metadata to smartconfig
This commit is contained in:
@@ -1,8 +1,5 @@
|
|||||||
{
|
{
|
||||||
"npmci": {
|
"@git.zone/cli": {
|
||||||
"npmAccessLevel": "public"
|
|
||||||
},
|
|
||||||
"gitzone": {
|
|
||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
@@ -24,9 +21,19 @@
|
|||||||
"data encoding",
|
"data encoding",
|
||||||
"data decoding"
|
"data decoding"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"release": {
|
||||||
|
"registries": [
|
||||||
|
"https://verdaccio.lossless.digital",
|
||||||
|
"https://registry.npmjs.org"
|
||||||
|
],
|
||||||
|
"accessLevel": "public"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tsdoc": {
|
"@git.zone/tsdoc": {
|
||||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
|
},
|
||||||
|
"@ship.zone/szci": {
|
||||||
|
"npmGlobalTools": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-04-30 - 6.0.1 - fix(build,json)
|
||||||
|
replace lodash.clonedeep with structuredClone and migrate package metadata to smartconfig
|
||||||
|
|
||||||
|
- removes the lodash.clonedeep dependency by using structuredClone when folding saveable properties
|
||||||
|
- improves cross-platform buffer handling by resolving Buffer from globalThis instead of relying on ts-ignore checks
|
||||||
|
- migrates project metadata from npmextra.json to .smartconfig.json and updates packaged files accordingly
|
||||||
|
- updates build tooling versions and drops the allowimplicitany build flag
|
||||||
|
|
||||||
## 2025-12-10 - 6.0.0 - BREAKING CHANGE(Smartjson)
|
## 2025-12-10 - 6.0.0 - BREAKING CHANGE(Smartjson)
|
||||||
Require TC39 Stage 3 decorators for @foldDec (use accessor), switch foldDec to initializer-based implementation, improve buffer encode/decode handling, bump dependencies and update docs/tests.
|
Require TC39 Stage 3 decorators for @foldDec (use accessor), switch foldDec to initializer-based implementation, improve buffer encode/decode handling, bump dependencies and update docs/tests.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2026 Task Venture Capital GmbH
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
+10
-11
@@ -7,30 +7,29 @@
|
|||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)",
|
"build": "(tsbuild --web)",
|
||||||
"buildDocs": "tsdoc"
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://code.foss.global/push.rocks/smartjson.git"
|
"url": "https://code.foss.global/push.rocks/smartjson.git"
|
||||||
},
|
},
|
||||||
"author": "Lossless GmbH",
|
"author": "Task Venture Capital GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/pushrocks/smartjson/issues"
|
"url": "https://code.foss.global/push.rocks/smartjson/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://code.foss.global/push.rocks/smartjson",
|
"homepage": "https://code.foss.global/push.rocks/smartjson",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbuild": "^3.1.2",
|
"@git.zone/tsbuild": "^4.4.0",
|
||||||
"@git.zone/tsrun": "^2.0.0",
|
"@git.zone/tsrun": "^2.0.2",
|
||||||
"@git.zone/tstest": "^3.1.3",
|
"@git.zone/tstest": "^3.6.3",
|
||||||
"@types/node": "^24.0.0"
|
"@types/node": "^25.6.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@push.rocks/smartenv": "^6.0.0",
|
"@push.rocks/smartenv": "^6.0.0",
|
||||||
"@push.rocks/smartstring": "^4.1.0",
|
"@push.rocks/smartstring": "^4.1.0",
|
||||||
"fast-json-stable-stringify": "^2.1.0",
|
"fast-json-stable-stringify": "^2.1.0"
|
||||||
"lodash.clonedeep": "^4.5.0"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
@@ -41,7 +40,7 @@
|
|||||||
"dist_ts_web/**/*",
|
"dist_ts_web/**/*",
|
||||||
"assets/**/*",
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
".smartconfig.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
],
|
],
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
@@ -61,5 +60,5 @@
|
|||||||
"data encoding",
|
"data encoding",
|
||||||
"data decoding"
|
"data decoding"
|
||||||
],
|
],
|
||||||
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"
|
"packageManager": "pnpm@10.28.2"
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+2168
-2955
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartjson',
|
name: '@push.rocks/smartjson',
|
||||||
version: '6.0.0',
|
version: '6.0.1',
|
||||||
description: 'A library for handling typed JSON data, providing functionalities for parsing, stringifying, and working with JSON objects, including support for encoding and decoding buffers.'
|
description: 'A library for handling typed JSON data, providing functionalities for parsing, stringifying, and working with JSON objects, including support for encoding and decoding buffers.'
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-8
@@ -14,22 +14,34 @@ interface IEncodedBuffer {
|
|||||||
type TParseReviver = (this: any, key: string, value: any) => any;
|
type TParseReviver = (this: any, key: string, value: any) => any;
|
||||||
type TParseReplacer = (this: any, key: string, value: any) => any;
|
type TParseReplacer = (this: any, key: string, value: any) => any;
|
||||||
|
|
||||||
|
interface INodeBufferLike extends Uint8Array {
|
||||||
|
toString(): string;
|
||||||
|
toString(encoding: 'base64'): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface INodeBufferConstructor {
|
||||||
|
from(data: Uint8Array): INodeBufferLike;
|
||||||
|
from(data: string, encoding: 'base64'): INodeBufferLike;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getNodeBuffer = (): INodeBufferConstructor | undefined => {
|
||||||
|
return (globalThis as typeof globalThis & { Buffer?: INodeBufferConstructor }).Buffer;
|
||||||
|
};
|
||||||
|
|
||||||
// Utility functions to handle base64 encoding/decoding in a cross-platform way
|
// Utility functions to handle base64 encoding/decoding in a cross-platform way
|
||||||
function base64Encode(data: Uint8Array): string {
|
function base64Encode(data: Uint8Array): string {
|
||||||
// Prefer Node's Buffer when available
|
const NodeBuffer = getNodeBuffer();
|
||||||
if (typeof Buffer !== 'undefined') {
|
if (NodeBuffer) {
|
||||||
// @ts-ignore Buffer might not exist in browser builds
|
return NodeBuffer.from(data).toString('base64');
|
||||||
return Buffer.from(data).toString('base64');
|
|
||||||
}
|
}
|
||||||
// Fallback for browsers
|
// Fallback for browsers
|
||||||
return btoa(String.fromCharCode(...data));
|
return btoa(String.fromCharCode(...data));
|
||||||
}
|
}
|
||||||
|
|
||||||
function base64Decode(str: string): Uint8Array {
|
function base64Decode(str: string): Uint8Array {
|
||||||
// Prefer Node's Buffer when available
|
const NodeBuffer = getNodeBuffer();
|
||||||
if (typeof Buffer !== 'undefined') {
|
if (NodeBuffer) {
|
||||||
// @ts-ignore Buffer might not exist in browser builds
|
const buf = NodeBuffer.from(str, 'base64');
|
||||||
const buf = Buffer.from(str, 'base64');
|
|
||||||
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||||
}
|
}
|
||||||
// Fallback for browsers
|
// Fallback for browsers
|
||||||
|
|||||||
+3
-3
@@ -163,7 +163,7 @@ export class Smartjson {
|
|||||||
// INSTANCE
|
// INSTANCE
|
||||||
// ========
|
// ========
|
||||||
|
|
||||||
public saveableProperties: string[];
|
public saveableProperties: string[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* folds a class into an object
|
* folds a class into an object
|
||||||
@@ -187,11 +187,11 @@ export class Smartjson {
|
|||||||
if (Array.isArray(val)) {
|
if (Array.isArray(val)) {
|
||||||
return val.map((item) => foldValue(item));
|
return val.map((item) => foldValue(item));
|
||||||
}
|
}
|
||||||
return plugins.lodashCloneDeep(val);
|
return structuredClone(val);
|
||||||
};
|
};
|
||||||
const props: string[] = (this as any).saveableProperties || [];
|
const props: string[] = (this as any).saveableProperties || [];
|
||||||
for (const keyName of props) {
|
for (const keyName of props) {
|
||||||
const value = this[keyName];
|
const value = (this as unknown as Record<string, unknown>)[keyName];
|
||||||
result[keyName] = foldValue(value);
|
result[keyName] = foldValue(value);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -5,12 +5,11 @@ import * as smartstring from '@push.rocks/smartstring';
|
|||||||
export { smartenv, smartstring };
|
export { smartenv, smartstring };
|
||||||
|
|
||||||
// third party scope
|
// third party scope
|
||||||
import lodashCloneDeep from 'lodash.clonedeep';
|
|
||||||
import stableJson2 from 'fast-json-stable-stringify';
|
import stableJson2 from 'fast-json-stable-stringify';
|
||||||
|
|
||||||
const stableJson = stableJson2 as any;
|
const stableJson = stableJson2 as any;
|
||||||
|
|
||||||
export { lodashCloneDeep, stableJson };
|
export { stableJson };
|
||||||
|
|
||||||
export interface IStableJsonTypes {
|
export interface IStableJsonTypes {
|
||||||
Comparator: (
|
Comparator: (
|
||||||
|
|||||||
Reference in New Issue
Block a user