@stryke/json 0.9.27 → 0.9.28
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/CHANGELOG.md +7 -0
- package/dist/_virtual/rolldown_runtime.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +1 -1
- package/dist/pointer/find-reference.cjs +1 -1
- package/dist/pointer/find-reference.d.cts +52 -2
- package/dist/pointer/find-reference.d.cts.map +1 -0
- package/dist/pointer/find-reference.d.mts +52 -2
- package/dist/pointer/find-reference.d.mts.map +1 -0
- package/dist/pointer/find-reference.mjs +2 -1
- package/dist/pointer/find-reference.mjs.map +1 -0
- package/dist/pointer/index.cjs +1 -1
- package/dist/pointer/index.d.cts +2 -2
- package/dist/pointer/index.d.mts +2 -2
- package/dist/pointer/index.mjs +1 -1
- package/dist/pointer/parse.cjs +1 -1
- package/dist/pointer/parse.d.cts +44 -2
- package/dist/pointer/parse.d.cts.map +1 -0
- package/dist/pointer/parse.d.mts +44 -2
- package/dist/pointer/parse.d.mts.map +1 -0
- package/dist/pointer/parse.mjs +2 -1
- package/dist/pointer/parse.mjs.map +1 -0
- package/dist/storm-json.cjs +1 -1
- package/dist/storm-json.d.cts +70 -2
- package/dist/storm-json.d.cts.map +1 -0
- package/dist/storm-json.d.mts +70 -3
- package/dist/storm-json.d.mts.map +1 -0
- package/dist/storm-json.mjs +2 -1
- package/dist/storm-json.mjs.map +1 -0
- package/dist/type-checks/src/get-object-tag.cjs +1 -0
- package/dist/type-checks/src/get-object-tag.mjs +2 -0
- package/dist/type-checks/src/get-object-tag.mjs.map +1 -0
- package/dist/type-checks/src/is-empty.cjs +1 -0
- package/dist/type-checks/src/is-empty.mjs +2 -0
- package/dist/type-checks/src/is-empty.mjs.map +1 -0
- package/dist/type-checks/src/is-non-null-object.cjs +1 -0
- package/dist/type-checks/src/is-non-null-object.mjs +2 -0
- package/dist/type-checks/src/is-non-null-object.mjs.map +1 -0
- package/dist/type-checks/src/is-null.cjs +1 -0
- package/dist/type-checks/src/is-null.mjs +2 -0
- package/dist/type-checks/src/is-null.mjs.map +1 -0
- package/dist/type-checks/src/is-number.cjs +1 -0
- package/dist/type-checks/src/is-number.mjs +2 -0
- package/dist/type-checks/src/is-number.mjs.map +1 -0
- package/dist/type-checks/src/is-object.cjs +1 -0
- package/dist/type-checks/src/is-object.mjs +2 -0
- package/dist/type-checks/src/is-object.mjs.map +1 -0
- package/dist/type-checks/src/is-plain-object.cjs +1 -0
- package/dist/type-checks/src/is-plain-object.mjs +2 -0
- package/dist/type-checks/src/is-plain-object.mjs.map +1 -0
- package/dist/type-checks/src/is-set-object.cjs +1 -0
- package/dist/type-checks/src/is-set-object.mjs +2 -0
- package/dist/type-checks/src/is-set-object.mjs.map +1 -0
- package/dist/type-checks/src/is-set.cjs +1 -0
- package/dist/type-checks/src/is-set.mjs +2 -0
- package/dist/type-checks/src/is-set.mjs.map +1 -0
- package/dist/{is-string-VB7nGKjX.mjs → type-checks/src/is-string.cjs} +1 -2
- package/dist/type-checks/src/is-string.mjs +2 -0
- package/dist/type-checks/src/is-string.mjs.map +1 -0
- package/dist/type-checks/src/is-undefined.cjs +1 -0
- package/dist/type-checks/src/is-undefined.mjs +2 -0
- package/dist/type-checks/src/is-undefined.mjs.map +1 -0
- package/dist/types/src/base.cjs +1 -0
- package/dist/types/src/base.mjs +2 -0
- package/dist/types/src/base.mjs.map +1 -0
- package/dist/types/src/json.d.cts +12 -0
- package/dist/types/src/json.d.cts.map +1 -0
- package/dist/types/src/json.d.mts +12 -0
- package/dist/types/src/json.d.mts.map +1 -0
- package/dist/types.d.cts +69 -2
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +69 -2
- package/dist/types.d.mts.map +1 -0
- package/dist/utils/code-frames.cjs +3 -1
- package/dist/utils/code-frames.d.cts +17 -2
- package/dist/utils/code-frames.d.cts.map +1 -0
- package/dist/utils/code-frames.d.mts +17 -2
- package/dist/utils/code-frames.d.mts.map +1 -0
- package/dist/utils/code-frames.mjs +4 -1
- package/dist/utils/code-frames.mjs.map +1 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +5 -5
- package/dist/utils/index.d.mts +5 -6
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/parse-error.cjs +1 -1
- package/dist/utils/parse-error.d.cts +15 -2
- package/dist/utils/parse-error.d.cts.map +1 -0
- package/dist/utils/parse-error.d.mts +15 -2
- package/dist/utils/parse-error.d.mts.map +1 -0
- package/dist/utils/parse-error.mjs +2 -1
- package/dist/utils/parse-error.mjs.map +1 -0
- package/dist/utils/parse.cjs +1 -1
- package/dist/utils/parse.d.cts +9 -2
- package/dist/utils/parse.d.cts.map +1 -0
- package/dist/utils/parse.d.mts +9 -2
- package/dist/utils/parse.d.mts.map +1 -0
- package/dist/utils/parse.mjs +2 -1
- package/dist/utils/parse.mjs.map +1 -0
- package/dist/utils/stringify.cjs +1 -1
- package/dist/utils/stringify.d.cts +13 -2
- package/dist/utils/stringify.d.cts.map +1 -0
- package/dist/utils/stringify.d.mts +13 -2
- package/dist/utils/stringify.d.mts.map +1 -0
- package/dist/utils/stringify.mjs +2 -1
- package/dist/utils/stringify.mjs.map +1 -0
- package/dist/utils/strip-comments.cjs +4 -1
- package/dist/utils/strip-comments.d.cts +11 -2
- package/dist/utils/strip-comments.d.cts.map +1 -0
- package/dist/utils/strip-comments.d.mts +11 -2
- package/dist/utils/strip-comments.d.mts.map +1 -0
- package/dist/utils/strip-comments.mjs +5 -1
- package/dist/utils/strip-comments.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/code-frames-BQI7PKd_.mjs +0 -4
- package/dist/code-frames-BQI7PKd_.mjs.map +0 -1
- package/dist/code-frames-CXX37tnR.d.mts +0 -17
- package/dist/code-frames-CXX37tnR.d.mts.map +0 -1
- package/dist/code-frames-DEWi5iIn.cjs +0 -3
- package/dist/code-frames-DViwqU8S.d.cts +0 -17
- package/dist/code-frames-DViwqU8S.d.cts.map +0 -1
- package/dist/find-reference-AvNORSzC.d.mts +0 -52
- package/dist/find-reference-AvNORSzC.d.mts.map +0 -1
- package/dist/find-reference-BUIYIOS4.mjs +0 -2
- package/dist/find-reference-BUIYIOS4.mjs.map +0 -1
- package/dist/find-reference-ChoPoDcB.d.cts +0 -52
- package/dist/find-reference-ChoPoDcB.d.cts.map +0 -1
- package/dist/find-reference-DQJK1LbJ.cjs +0 -1
- package/dist/index-CMuRFTR3.d.mts +0 -1
- package/dist/index-uTS5iDq_.d.cts +0 -1
- package/dist/is-number-CebQk_B0.mjs +0 -2
- package/dist/is-number-CebQk_B0.mjs.map +0 -1
- package/dist/is-number-wfNPC3Mj.cjs +0 -1
- package/dist/is-object-CGB7EeiA.cjs +0 -1
- package/dist/is-object-DDPbtSWR.mjs +0 -2
- package/dist/is-object-DDPbtSWR.mjs.map +0 -1
- package/dist/is-string-D5yKZC0U.cjs +0 -1
- package/dist/is-string-VB7nGKjX.mjs.map +0 -1
- package/dist/is-undefined-D6sfLkFq.mjs +0 -2
- package/dist/is-undefined-D6sfLkFq.mjs.map +0 -1
- package/dist/is-undefined-Pevixi0g.cjs +0 -1
- package/dist/parse-BYhuR8fo.mjs +0 -2
- package/dist/parse-BYhuR8fo.mjs.map +0 -1
- package/dist/parse-BpylFCf0.mjs +0 -2
- package/dist/parse-BpylFCf0.mjs.map +0 -1
- package/dist/parse-BwhwGAkA.cjs +0 -1
- package/dist/parse-D-7TqXVh.d.mts +0 -51
- package/dist/parse-D-7TqXVh.d.mts.map +0 -1
- package/dist/parse-DU-kIQN6.d.cts +0 -51
- package/dist/parse-DU-kIQN6.d.cts.map +0 -1
- package/dist/parse-DmriuGKI.cjs +0 -1
- package/dist/parse-error-0BAtatMf.cjs +0 -1
- package/dist/parse-error-CJTV0jdn.d.mts +0 -15
- package/dist/parse-error-CJTV0jdn.d.mts.map +0 -1
- package/dist/parse-error-DLuqEXmf.d.cts +0 -15
- package/dist/parse-error-DLuqEXmf.d.cts.map +0 -1
- package/dist/parse-error-DrJJkemH.mjs +0 -2
- package/dist/parse-error-DrJJkemH.mjs.map +0 -1
- package/dist/parse-fX7NFKdt.d.cts +0 -9
- package/dist/parse-fX7NFKdt.d.cts.map +0 -1
- package/dist/parse-xFkFesIF.d.mts +0 -9
- package/dist/parse-xFkFesIF.d.mts.map +0 -1
- package/dist/storm-json-BsdLpzM_.mjs +0 -2
- package/dist/storm-json-BsdLpzM_.mjs.map +0 -1
- package/dist/storm-json-CfqJ0KzG.d.mts +0 -70
- package/dist/storm-json-CfqJ0KzG.d.mts.map +0 -1
- package/dist/storm-json-DBxiMujR.cjs +0 -1
- package/dist/storm-json-Q1bOIv3-.d.cts +0 -70
- package/dist/storm-json-Q1bOIv3-.d.cts.map +0 -1
- package/dist/stringify-BpBMOhle.d.cts +0 -13
- package/dist/stringify-BpBMOhle.d.cts.map +0 -1
- package/dist/stringify-DjBDt8SC.mjs +0 -2
- package/dist/stringify-DjBDt8SC.mjs.map +0 -1
- package/dist/stringify-Dp0lF-wN.cjs +0 -1
- package/dist/stringify-ln223ZC9.d.mts +0 -13
- package/dist/stringify-ln223ZC9.d.mts.map +0 -1
- package/dist/strip-comments-BhdK_E8s.cjs +0 -4
- package/dist/strip-comments-CKLSXchM.d.cts +0 -11
- package/dist/strip-comments-CKLSXchM.d.cts.map +0 -1
- package/dist/strip-comments-DdsCzji6.d.mts +0 -11
- package/dist/strip-comments-DdsCzji6.d.mts.map +0 -1
- package/dist/strip-comments-LcqiBhvo.mjs +0 -5
- package/dist/strip-comments-LcqiBhvo.mjs.map +0 -1
- package/dist/types-CEiKQHlk.d.cts +0 -69
- package/dist/types-CEiKQHlk.d.cts.map +0 -1
- package/dist/types-CQHq94S4.d.mts +0 -69
- package/dist/types-CQHq94S4.d.mts.map +0 -1
- package/dist/utils-BkLHzBxb.mjs +0 -1
- package/dist/utils-DFU9Wltn.cjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-non-null-object.mjs","names":[],"sources":["../../../../type-checks/src/is-non-null-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isObject } from \"./is-object\";\nimport { isSet } from \"./is-set\";\n\n/**\n * Check if the provided value's type is `Object` and is not `null` or `undefined`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`\n */\nexport const isNonNullObject = (value: any): value is NonNullable<object> => {\n return isSet(value) && isObject(value);\n};\n"],"mappings":"gFA2BA,MAAa,EAAmB,GACvB,EAAM,EAAM,EAAI,EAAS,EAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>{try{return e===null}catch{return!1}};exports.isNull=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-null.mjs","names":[],"sources":["../../../../type-checks/src/is-null.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isNull = (value: unknown): value is null => {\n try {\n return value === null;\n } catch {\n return false;\n }\n};\n"],"mappings":"AAkBA,MAAa,EAAU,GAAkC,CACvD,GAAI,CACF,OAAO,IAAU,UACX,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>{try{return e instanceof Number||typeof e==`number`||Number(e)===e}catch{return!1}};exports.isNumber=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-number.mjs","names":[],"sources":["../../../../type-checks/src/is-number.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { AnyNumber } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Check if the provided value's type is `number`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number`\n */\nexport const isNumber = (value: unknown): value is number => {\n try {\n return (\n value instanceof Number ||\n typeof value === \"number\" ||\n Number(value) === value\n );\n } catch {\n return false;\n }\n};\n\n/**\n * Check if the provided value's type is `AnyNumber`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `AnyNumber`\n */\nexport function isAnyNumber(value?: any): value is AnyNumber {\n return isNumber(value) || getObjectTag(value) === \"[object Number]\";\n}\n"],"mappings":"AA2BA,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OACE,aAAiB,QACjB,OAAO,GAAU,UACjB,OAAO,EAAM,GAAK,OAEd,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-plain-object.cjs`),t=t=>{try{return typeof t==`object`||!!t&&t?.constructor===Object||e.isPlainObject(t)}catch{return!1}};exports.isObject=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-object.mjs","names":[],"sources":["../../../../type-checks/src/is-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/* eslint-disable ts/no-unsafe-function-type */\n/* eslint-disable ts/no-unsafe-call */\n\nimport type { NativeClass } from \"@stryke/types/base\";\nimport { isPlainObject } from \"./is-plain-object\";\n\n// Prepare\nconst isClassRegex = /^class\\s|^function\\s+[A-Z]/;\nconst isConventionalClassRegex = /^function\\s+[A-Z]/;\nconst isNativeClassRegex = /^class\\s/;\n\n/** Is ES6+ class */\nexport function isNativeClass(value?: any): value is NativeClass {\n // NOTE TO DEVELOPER: If any of this changes, isClass must also be updated\n return (\n typeof value === \"function\" && isNativeClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is a conventional class\n *\n * @remarks\n * Is Conventional Class\n * Looks for function with capital first letter MyClass\n * First letter is the 9th character\n * If changed, isClass must also be updated\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is a conventional class\n */\nexport function isConventionalClass(value?: any): value is Function {\n return (\n typeof value === \"function\" &&\n isConventionalClassRegex.test(value.toString())\n );\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport function isClass(value?: any): value is Function | NativeClass; // only guarantee of truth type, not of validity\nexport function isClass(value?: any): boolean {\n return typeof value === \"function\" && isClassRegex.test(value.toString());\n}\n\n/**\n * Check if the provided value's type is `Object`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `Object`\n */\nexport const isObject = (value: unknown): value is object => {\n try {\n return (\n typeof value === \"object\" ||\n (Boolean(value) && value?.constructor === Object) ||\n isPlainObject(value)\n );\n } catch {\n return false;\n }\n};\n"],"mappings":"sDAyEA,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OACE,OAAO,GAAU,UAChB,EAAQ,GAAU,GAAO,cAAgB,QAC1C,EAAc,EAAM,MAEhB,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./get-object-tag.cjs`),t=e=>typeof e==`object`&&!!e,n=n=>{if(!t(n)||e.getObjectTag(n)!==`[object Object]`)return!1;if(Object.getPrototypeOf(n)===null)return!0;let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r};exports.isPlainObject=n;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getObjectTag as e}from"./get-object-tag.mjs";const t=e=>typeof e==`object`&&!!e,n=n=>{if(!t(n)||e(n)!==`[object Object]`)return!1;if(Object.getPrototypeOf(n)===null)return!0;let r=n;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(n)===r};export{n as isPlainObject};
|
|
2
|
+
//# sourceMappingURL=is-plain-object.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-plain-object.mjs","names":[],"sources":["../../../../type-checks/src/is-plain-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { PlainObject } from \"@stryke/types/base\";\nimport { getObjectTag } from \"./get-object-tag\";\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @example\n * ```typescript\n * isObjectLike({})\n * // => true\n *\n * isObjectLike([1, 2, 3])\n * // => true\n *\n * isObjectLike(Function)\n * // => false\n *\n * isObjectLike(null)\n * // => false\n * ```\n *\n * @param value - The value to check.\n * @returns Returns `true` if `value` is object-like, else `false`.\n */\nexport const isObjectLike = (obj: unknown) => {\n return typeof obj === \"object\" && obj !== null;\n};\n\n/**\n * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @example\n * ```typescript\n * function Foo() {\n * this.a = 1\n * }\n *\n * isPlainObject(new Foo)\n * // => false\n *\n * isPlainObject([1, 2, 3])\n * // => false\n *\n * isPlainObject({ 'x': 0, 'y': 0 })\n * // => true\n *\n * isPlainObject(Object.create(null))\n * // => true\n * ```\n *\n * @param obj - The value to check.\n * @returns Returns `true` if `obj` is a plain object, else `false`.\n */\nexport const isPlainObject = (obj: unknown): obj is PlainObject => {\n if (!isObjectLike(obj) || getObjectTag(obj) !== \"[object Object]\") {\n return false;\n }\n if (Object.getPrototypeOf(obj) === null) {\n return true;\n }\n let proto = obj;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(obj) === proto;\n};\n"],"mappings":"oDA2CA,MAAa,EAAgB,GACpB,OAAO,GAAQ,YAAY,EA4BvB,EAAiB,GAAqC,CACjE,GAAI,CAAC,EAAa,EAAI,EAAI,EAAa,EAAI,GAAK,kBAC9C,MAAO,GAET,GAAI,OAAO,eAAe,EAAI,GAAK,KACjC,MAAO,GAET,IAAI,EAAQ,EACZ,KAAO,OAAO,eAAe,EAAM,GAAK,MACtC,EAAQ,OAAO,eAAe,EAAM,CAEtC,OAAO,OAAO,eAAe,EAAI,GAAK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-non-null-object.cjs`),t=t=>{try{return e.isNonNullObject(t)&&Object.keys(t).length>0}catch{return!1}};exports.isSetObject=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-set-object.mjs","names":[],"sources":["../../../../type-checks/src/is-set-object.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isNonNullObject } from \"./is-non-null-object\";\n\n/**\n * Check if the provided value's type is an object with some fields set\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is an object with some fields se\n */\nexport const isSetObject = (value: unknown): value is NonNullable<object> => {\n try {\n return isNonNullObject(value) && Object.keys(value).length > 0;\n } catch {\n return false;\n }\n};\n"],"mappings":"2DA0BA,MAAa,EAAe,GAAiD,CAC3E,GAAI,CACF,OAAO,EAAgB,EAAM,EAAI,OAAO,KAAK,EAAM,CAAC,OAAS,OACvD,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-empty.cjs`),t=t=>{try{return!e.isEmpty(t)}catch{return!1}};exports.isSet=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-set.mjs","names":[],"sources":["../../../../type-checks/src/is-set.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isEmpty } from \"./is-empty\";\n\n/**\n * The inverse of the `isEmpty` function\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`\n */\nexport const isSet = (value: unknown): value is NonNullable<unknown> => {\n try {\n return !isEmpty(value);\n } catch {\n return false;\n }\n};\n"],"mappings":"yCA0BA,MAAa,EAAS,GAAkD,CACtE,GAAI,CACF,MAAO,CAAC,EAAQ,EAAM,MAChB,CACN,MAAO"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
const e=e=>{try{return typeof e==`string`}catch{return!1}};
|
|
2
|
-
//# sourceMappingURL=is-string-VB7nGKjX.mjs.map
|
|
1
|
+
const e=e=>{try{return typeof e==`string`}catch{return!1}};exports.isString=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-string.mjs","names":[],"sources":["../../../../type-checks/src/is-string.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isString = (value: unknown): value is string => {\n try {\n return typeof value === \"string\";\n } catch {\n return false;\n }\n};\n"],"mappings":"AAkBA,MAAa,EAAY,GAAoC,CAC3D,GAAI,CACF,OAAO,OAAO,GAAU,cAClB,CACN,MAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>e===void 0;exports.isUndefined=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-undefined.mjs","names":[],"sources":["../../../../type-checks/src/is-undefined.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isUndefined = (value: unknown): value is undefined => {\n return value === undefined;\n};\n"],"mappings":"AAkBA,MAAa,EAAe,GACnB,IAAU,IAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=``;exports.EMPTY_STRING=``;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.mjs","names":[],"sources":["../../../../types/src/base.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { TypedArray } from \"./array\";\n\nexport type SerializablePrimitive =\n | null\n | undefined\n | string\n | number\n | boolean\n | bigint;\nexport type Primitive = SerializablePrimitive | symbol;\n\n/**\n * Matches any primitive, `void`, `Date`, or `RegExp` value.\n */\nexport type BuiltIns = Primitive | void | Date | RegExp;\n\n/**\n * Matches any non-primitive object\n */\n// eslint-disable-next-line ts/no-unsafe-function-type\nexport type AtomicObject = Function | Promise<any> | Date | RegExp;\n\n/** Determines if the passed value is of a specific type */\nexport type TypeTester = (value: any) => boolean;\n\n/**\n * The interface for a type mapping (key =\\> function) to use for {@link getType}.\n * export * The key represents the name of the type. The function represents the {@link TypeTester | test method}.\n * The map should be ordered by testing preference, with more specific tests first.\n * If a test returns true, it is selected, and the key is returned as the type.\n */\nexport type TypeMap = Record<string, TypeTester>;\n\ndeclare const emptyObjectSymbol: unique symbol;\n\nexport type FunctionOrValue<Value> = Value extends () => infer X ? X : Value;\n\n/**\n * A [[List]]\n *\n * @example\n * ```ts\n * type list0 = [1, 2, 3]\n * type list1 = number[]\n * ```\n *\n * @param A - its type\n * @returns [[List]]\n */\nexport type List<A = any> = ReadonlyArray<A>;\n\n/**\n * Alias to create a [[Function]]\n *\n * @example\n * ```ts\n * import { FunctionLike } from '@stryke/types'\n *\n * type test0 = FunctionLike<[string, number], boolean>\n * /// (args_0: string, args_1: number) => boolean\n * ```\n *\n * @param P - parameters\n * @param R - return type\n * @returns [[Function]]\n */\nexport type FunctionLike<P extends List = any, R = any> = (...args: P) => R;\n\nexport type AnyFunction = FunctionLike<any, any>;\nexport type Nullish = undefined | null;\nexport type Nullishable<T> = T | Nullish;\nexport type NonNullishObject = object; // not null/undefined which are Object\nexport type NativeClass = abstract new (...args: any) => any;\nexport type AnyNumber = number | number;\nexport type AnyString = string | string;\nexport type AnyBoolean = boolean | boolean;\nexport type AnyArray = any[];\nexport type PlainObject = Record<any, object>; // https://stackoverflow.com/a/75052315/130638\nexport type AnyMap = Map<any, any>;\nexport type AnyWeakMap = WeakMap<WeakKey, any>;\nexport type EmptyArray = [];\nexport interface EmptyObject {\n [emptyObjectSymbol]?: never;\n}\n\nexport type Any =\n | boolean\n | number\n | bigint\n | string\n | null\n | undefined\n | void\n | symbol\n | object\n | PlainObject\n | AnyArray\n | AnyMap\n | AnyWeakMap;\n\n/**\n * The valid types of the index for an `Indexable` type object\n */\nexport type IndexType = string | number | symbol;\n\n/**\n * The declaration of a ***dictionary-type*** object with a specific type\n *\n * @see {@link Indexable}\n * @see {@link IndexType}\n * @see {@link Dictionary}\n */\nexport type TypedIndexable<T> = Record<IndexType, T>;\n\n/**\n * The declaration of a ***dictionary-type*** object\n *\n * @see {@link TypedIndexable}\n * @see {@link IndexType}\n * @see {@link Dictionary}\n */\nexport type Indexable = TypedIndexable<any>;\n\n/**\n * The declaration of a ***dictionary-type*** object with a specific type\n *\n * @see {@link Indexable}\n * @see {@link IndexType}\n * @see {@link TypedIndexable}\n */\nexport type Dictionary<T> = Record<string, T>;\n\nexport const EMPTY_STRING = \"\";\nexport const NEWLINE_STRING = \"\\r\\n\";\nexport const EMPTY_OBJECT = {};\n\nexport type AnyCase<T extends IndexType> = string extends T\n ? string\n : T extends `${infer F1}${infer F2}${infer R}`\n ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${AnyCase<R>}`\n : T extends `${infer F}${infer R}`\n ? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}`\n : typeof EMPTY_STRING;\n\nexport type Newable<T> = new (..._args: never[]) => T;\n\nexport interface Abstract<T> {\n prototype: T;\n}\n\nexport interface Clonable<T> {\n clone: () => T;\n}\n\nexport type MaybePromise<T> = T | Promise<T>;\n\nexport type ReducerFunction<TState, TAction> = (\n state: TState,\n action: TAction\n) => TState;\n\n// NOTE: for the file size optimization\nexport const TYPE_ARGUMENTS = \"Arguments\";\nexport const TYPE_ARRAY = \"Array\";\nexport const TYPE_OBJECT = \"Object\";\nexport const TYPE_MAP = \"Map\";\nexport const TYPE_SET = \"Set\";\n\nexport type Collection =\n | IArguments\n | unknown[]\n | Map<unknown, unknown>\n | Record<string | number | symbol, unknown>\n | Set<unknown>;\n\nexport type NonUndefined<T> = T extends undefined ? never : T;\n\nexport type BrowserNativeObject = Date | File;\n\nexport type DeepPartial<T> = T extends BrowserNativeObject | NestedValue\n ? T\n : {\n [K in keyof T]?: DeepPartial<T[K]>;\n };\n\nexport type Rollback = Record<\n string,\n (initialValue: any, currentValue: any) => any\n>;\n\n/**\n * Extract all required keys from the given type.\n *\n * @remarks\n * This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...\n */\nexport type RequiredKeysOf<BaseType extends object> = Exclude<\n {\n [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]>\n ? Key\n : never;\n }[keyof BaseType],\n undefined\n>;\n\n/**\n * Returns a boolean for whether the two given types are equal.\n *\n * @remarks\n * Use-cases: If you want to make a conditional branch based on the result of a comparison of two types.\n *\n * @see https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650\n * @see https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796\n */\nexport type IsEqual<A, B> =\n (<G>() => G extends A ? 1 : 2) extends <G>() => G extends B ? 1 : 2\n ? true\n : false;\n\nexport type Filter<KeyType, ExcludeType> =\n IsEqual<KeyType, ExcludeType> extends true\n ? never\n : KeyType extends ExcludeType\n ? never\n : KeyType;\n\ninterface ExceptOptions {\n /**\n Disallow assigning non-specified properties.\n\n Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.\n\n @defaultValue false\n */\n requireExactProps?: boolean;\n}\n\n/**\n * Create a type from an object type without certain keys.\n *\n * @remarks\n * We recommend setting the `requireExactProps` option to `true`.\n *\n * This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.\n *\n * This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).\n */\nexport type Except<\n ObjectType,\n KeysType extends keyof ObjectType,\n Options extends ExceptOptions = { requireExactProps: false }\n> = {\n [KeyType in keyof ObjectType as Filter<\n KeyType,\n KeysType\n >]: ObjectType[KeyType];\n} & (Options[\"requireExactProps\"] extends true\n ? Partial<Record<KeysType, never>>\n : Record<string, never>);\n\n/**\n * Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.\n *\n * @remarks\n * Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.\n *\n * If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.\n *\n * @see https://github.com/microsoft/TypeScript/issues/15300\n */\nexport type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};\n\n/**\n * Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.\n *\n * @remarks\n * Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.\n */\nexport type SetRequired<\n BaseType,\n Keys extends keyof BaseType\n> = BaseType extends unknown // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types). // union into a [distributive conditional // `extends unknown` is always going to be the case and is used to convert any\n ? Simplify<\n // Pick just the keys that are optional from the base type.\n Except<BaseType, Keys> &\n // Pick the keys that should be required from the base type and make them required.\n Required<Pick<BaseType, Keys>>\n >\n : never;\n\nexport const $NestedValue: unique symbol = Symbol(\"NestedValue\");\n\nexport type NestedValue<TValue extends object = object> = {\n [$NestedValue]: never;\n} & TValue;\n\nexport interface RefObject<T> {\n current: T;\n}\n\nexport interface Identity<T = string> {\n id: T;\n}\n\nexport interface Versioned {\n version: number;\n}\n\nexport interface Sequenced {\n /**\n * The sequence number (version, or event counter, etc.) of the record\n */\n sequence: number;\n}\n\nexport interface Typed {\n /**\n * The type of the record\n */\n __type: string;\n}\n\nexport interface ClassTypeCheckable<T> extends Typed {\n /**\n * Run type check on the given value\n * @param value - The value to check\n * @returns True if the value is of the type of the class\n */\n isTypeOf: (value: unknown) => value is T;\n}\n\n/**\n * Matches non-recursive types.\n */\nexport type NonRecursiveType =\n | BuiltIns\n // eslint-disable-next-line ts/no-unsafe-function-type\n | Function\n | (new (...arguments_: any[]) => unknown);\n\nexport type IsPrimitive<T> = [T] extends [Primitive] ? true : false;\nexport type IsNever<T> = [T] extends [never] ? true : false;\nexport type IsAny<T> = 0 extends 1 & T ? true : false;\nexport type IsNull<T> = [T] extends [null] ? true : false;\nexport type IsUndefined<T> = T extends undefined ? true : false;\nexport type IsUnknown<T> = unknown extends T // `T` can be `unknown` or `any`\n ? IsNull<T> extends false // `any` can be `null`, but `unknown` can't be\n ? true\n : false\n : false;\nexport type IsNullish<T> = IsNull<T> & IsUndefined<T>;\nexport type IsFunction<T> = T extends AnyFunction ? true : false;\n\n/**\n * Declare locally scoped properties on `globalThis`.\n *\n * When defining a global variable in a declaration file is inappropriate, it can be helpful to define a `type` or `interface` (say `ExtraGlobals`) with the global variable and then cast `globalThis` via code like `globalThis as unknown as ExtraGlobals`.\n *\n * Instead of casting through `unknown`, you can update your `type` or `interface` to extend `GlobalThis` and then directly cast `globalThis`.\n *\n * @example\n * ```\n * import type { GlobalThis } from '@stryke/types';\n *\n * type ExtraGlobals = GlobalThis & {\n * readonly GLOBAL_TOKEN: string;\n * };\n *\n * (globalThis as ExtraGlobals).GLOBAL_TOKEN;\n * ```\n */\nexport type GlobalThis = typeof globalThis;\n\n/**\n * Matches a [`class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n */\nexport interface Class<T, Arguments extends unknown[] = any[]> {\n prototype: Pick<T, keyof T>;\n new (...arguments_: Arguments): T;\n}\n\n/**\n * Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).\n */\nexport type Constructor<T, Arguments extends unknown[] = any[]> = new (\n ...arguments_: Arguments\n) => T;\n\n/**\n * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes).\n *\n * @privateRemarks\n * We cannot use a `type` here because TypeScript throws: 'abstract' modifier cannot appear on a type member. (1070)\n */\n\nexport interface AbstractClass<\n T,\n Arguments extends unknown[] = any[]\n> extends AbstractConstructor<T, Arguments> {\n prototype: Pick<T, keyof T>;\n}\n\n/**\n * Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.\n */\nexport type AbstractConstructor<\n T,\n Arguments extends unknown[] = any[]\n> = abstract new (...arguments_: Arguments) => T;\n\n/**\n * Create a tuple type of the given length `<L>` and fill it with the given type `<Fill>`.\n *\n * If `<Fill>` is not provided, it will default to `unknown`.\n *\n * @see https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f\n */\nexport type BuildTuple<\n L extends number,\n Fill = unknown,\n T extends readonly unknown[] = []\n> = T[\"length\"] extends L ? T : BuildTuple<L, Fill, [...T, Fill]>;\n\n/**\n * Test if the given function has multiple call signatures.\n *\n * Needed to handle the case of a single call signature with properties.\n *\n * Multiple call signatures cannot currently be supported due to a TypeScript limitation.\n * @see https://github.com/microsoft/TypeScript/issues/29732\n */\nexport type HasMultipleCallSignatures<\n T extends (...arguments_: any[]) => unknown\n> = T extends {\n (...arguments_: infer A): unknown;\n (...arguments_: infer B): unknown;\n}\n ? B extends A\n ? A extends B\n ? false\n : true\n : true\n : false;\n\ntype StructuredCloneablePrimitive =\n | string\n | number\n | bigint\n | boolean\n | null\n | undefined\n | boolean\n | number\n | string;\n\ntype StructuredCloneableData =\n | ArrayBuffer\n | DataView\n | Date\n | Error\n | RegExp\n | TypedArray\n | Blob\n | File;\n\n// DOM exclusive types\n// | AudioData\n// | CropTarget\n// | CryptoKey\n// | DOMException\n// | DOMMatrix\n// | DOMMatrixReadOnly\n// | DOMPoint\n// | DOMPointReadOnly\n// | DOMQuad\n// | DOMRect\n// | DOMRectReadOnly\n// | FileList\n// | FileSystemDirectoryHandle\n// | FileSystemFileHandle\n// | FileSystemHandle\n// | GPUCompilationInfo\n// | GPUCompilationMessage\n// | ImageBitmap\n// | ImageData\n// | RTCCertificate\n// | VideoFrame\n\ntype StructuredCloneableCollection =\n | readonly StructuredCloneable[]\n | {\n readonly [key: string]: StructuredCloneable;\n readonly [key: number]: StructuredCloneable;\n }\n | ReadonlyMap<StructuredCloneable, StructuredCloneable>\n | ReadonlySet<StructuredCloneable>;\n\n/**\n * Matches a value that can be losslessly cloned using `structuredClone`.\n *\n * Note:\n * - Custom error types will be cloned as the base `Error` type\n * - This type doesn't include types exclusive to the TypeScript DOM library (e.g. `DOMRect` and `VideoFrame`)\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n *\n * @example\n * ```\n * import type { StructuredCloneable } from '@stryke/types';\n *\n * class CustomClass {}\n *\n * // @ts-expect-error\n * const error: StructuredCloneable = {\n * custom: new CustomClass(),\n * };\n *\n * structuredClone(error);\n * //=> {custom: {}}\n *\n * const good: StructuredCloneable = {\n * number: 3,\n * date: new Date(),\n * map: new Map<string, number>(),\n * }\n *\n * good.map.set('key', 1);\n *\n * structuredClone(good);\n * //=> {number: 3, date: Date(2022-10-17 22:22:35.920), map: Map {'key' -> 1}}\n * ```\n */\nexport type StructuredCloneable =\n | StructuredCloneablePrimitive\n | StructuredCloneableData\n | StructuredCloneableCollection;\n"],"mappings":"AAsJA,MAAa,EAAe"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region ../types/src/json.d.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Matches a JSON pointer's path segments.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* These segments are used to navigate through the JSON object structure and point to a specific, referenced value.
|
|
8
|
+
*/
|
|
9
|
+
type JsonPointerPath = (string | number)[];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { JsonPointerPath };
|
|
12
|
+
//# sourceMappingURL=json.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.cts","names":[],"sources":["../../../../types/src/json.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA6CY,eAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region ../types/src/json.d.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Matches a JSON pointer's path segments.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* These segments are used to navigate through the JSON object structure and point to a specific, referenced value.
|
|
8
|
+
*/
|
|
9
|
+
type JsonPointerPath = (string | number)[];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { JsonPointerPath };
|
|
12
|
+
//# sourceMappingURL=json.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.mts","names":[],"sources":["../../../../types/src/json.ts"],"sourcesContent":[],"mappings":";;;;;;;;KA6CY,eAAA"}
|
package/dist/types.d.cts
CHANGED
|
@@ -1,2 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ParseOptions } from "jsonc-parser";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
type PrimitiveJsonValue = string | number | boolean | undefined | null;
|
|
5
|
+
interface Class {
|
|
6
|
+
new (...args: any[]): any;
|
|
7
|
+
}
|
|
8
|
+
type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
|
|
9
|
+
type JsonArray = Array<JsonValue>;
|
|
10
|
+
interface JsonObject {
|
|
11
|
+
[key: string]: JsonValue;
|
|
12
|
+
}
|
|
13
|
+
type ClassInstance = any;
|
|
14
|
+
type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
|
|
15
|
+
type Tree<T> = InnerNode<T> | Leaf<T>;
|
|
16
|
+
type Leaf<T> = [T];
|
|
17
|
+
type InnerNode<T> = [T, Record<string, Tree<T>>];
|
|
18
|
+
type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
|
|
19
|
+
type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
|
|
20
|
+
type TypedArrayAnnotation = ["typed-array", string];
|
|
21
|
+
type ClassTypeAnnotation = ["class", string];
|
|
22
|
+
type SymbolTypeAnnotation = ["symbol", string];
|
|
23
|
+
type CustomTypeAnnotation = ["custom", string];
|
|
24
|
+
type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
|
|
25
|
+
type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
|
|
26
|
+
type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
|
|
27
|
+
interface JsonParseOptions extends ParseOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Expect JSON with javascript-style
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue false
|
|
32
|
+
*/
|
|
33
|
+
expectComments?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Disallow javascript-style
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue false
|
|
38
|
+
*/
|
|
39
|
+
disallowComments?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Allow trailing commas in the JSON content
|
|
42
|
+
*/
|
|
43
|
+
allowTrailingComma?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface JsonSerializeOptions {
|
|
46
|
+
/**
|
|
47
|
+
* the whitespaces to add as indentation to make the output more readable.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue 2
|
|
50
|
+
*/
|
|
51
|
+
spaces?: number;
|
|
52
|
+
}
|
|
53
|
+
interface JsonParserResult {
|
|
54
|
+
json: JsonValue;
|
|
55
|
+
meta?: {
|
|
56
|
+
values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
|
|
57
|
+
referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
interface JsonParserInterface {
|
|
61
|
+
parse: <TData = any>(strData: string) => TData;
|
|
62
|
+
stringify: <TData = any>(data: TData) => string;
|
|
63
|
+
serialize: (object: JsonValue) => JsonParserResult;
|
|
64
|
+
deserialize: <TData = any>(payload: JsonParserResult) => TData;
|
|
65
|
+
register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
|
|
69
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAoBY,kBAAA;UAEK,KAAA;EAFL,KAAA,GAAA,IAAA,EAAA,GAAA,EAAA,CAAA,EAAkB,GAAA;AAE9B;AAIY,KAAA,SAAA,GAAY,kBAAH,GAAwB,SAAxB,GAAoC,UAApC;AAAG,KAEZ,SAAA,GAAY,KAFA,CAEM,SAFN,CAAA;AAAqB,UAI5B,UAAA,CAJ4B;EAAY,CAAA,GAAA,EAAA,MAAA,CAAA,EAKxC,SALwC;;AAE7C,KAMA,aAAA,GANkB,GAAA;AAEb,KAML,qBAAA,GALK,MAAS,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veJsonValue = string | number | boolean | undefined | null;
|
|
5
|
+
interface Class {
|
|
6
|
+
new (...args: any[]): any;
|
|
7
|
+
}
|
|
8
|
+
type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
|
|
9
|
+
type JsonArray = Array<JsonValue>;
|
|
10
|
+
interface JsonObject {
|
|
11
|
+
[key: string]: JsonValue;
|
|
12
|
+
}
|
|
13
|
+
type ClassInstance = any;
|
|
14
|
+
type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
|
|
15
|
+
type Tree<T> = InnerNode<T> | Leaf<T>;
|
|
16
|
+
type Leaf<T> = [T];
|
|
17
|
+
type InnerNode<T> = [T, Record<string, Tree<T>>];
|
|
18
|
+
type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
|
|
19
|
+
type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
|
|
20
|
+
type TypedArrayAnnotation = ["typed-array", string];
|
|
21
|
+
type ClassTypeAnnotation = ["class", string];
|
|
22
|
+
type SymbolTypeAnnotation = ["symbol", string];
|
|
23
|
+
type CustomTypeAnnotation = ["custom", string];
|
|
24
|
+
type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
|
|
25
|
+
type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
|
|
26
|
+
type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
|
|
27
|
+
interface JsonParseOptions extends ParseOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Expect JSON with javascript-style
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue false
|
|
32
|
+
*/
|
|
33
|
+
expectComments?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Disallow javascript-style
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue false
|
|
38
|
+
*/
|
|
39
|
+
disallowComments?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Allow trailing commas in the JSON content
|
|
42
|
+
*/
|
|
43
|
+
allowTrailingComma?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface JsonSerializeOptions {
|
|
46
|
+
/**
|
|
47
|
+
* the whitespaces to add as indentation to make the output more readable.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue 2
|
|
50
|
+
*/
|
|
51
|
+
spaces?: number;
|
|
52
|
+
}
|
|
53
|
+
interface JsonParserResult {
|
|
54
|
+
json: JsonValue;
|
|
55
|
+
meta?: {
|
|
56
|
+
values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
|
|
57
|
+
referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
interface JsonParserInterface {
|
|
61
|
+
parse: <TData = any>(strData: string) => TData;
|
|
62
|
+
stringify: <TData = any>(data: TData) => string;
|
|
63
|
+
serialize: (object: JsonValue) => JsonParserResult;
|
|
64
|
+
deserialize: <TData = any>(payload: JsonParserResult) => TData;
|
|
65
|
+
register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
|
|
69
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mapp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A,EAQZ,SARY,EAAA,GAQE,UARF,EAAA,WAAA,EAAA,CAAA,OAAA,EAST,UATS,EAAA,GASM,KATN,EAAA,YAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,GAAA,IAAA,IAUK,KAVL,EAAA,GAAA,IAAA"}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
const e=
|
|
1
|
+
const e=/\r\n|[\n\r\u2028\u2029]/;function t(e,t,n={}){let r={column:0,line:-1,...e.start},i={...r,...e.end},{linesAbove:a=2,linesBelow:o=3}=n||{},s=r.line,c=r.column,l=i.line,u=i.column,d=Math.max(s-(a+1),0),f=Math.min(t.length,l+o);s===-1&&(d=0),l===-1&&(f=t.length);let p=l-s,m={};if(p)for(let e=0;e<=p;e++){let n=e+s;c?e===0?m[n]=[c,(t[n-1]?.length??0)-c+1]:e===p?m[n]=[0,u]:m[n]=[0,t[n-e]?.length??0]:m[n]=!0}else c===u?m[s]=c?[c,0]:!0:m[s]=[c,u-c];return{start:d,end:f,markerLines:m}}function n(n,r,i={}){let{start:a,end:o,markerLines:s}=t(r,n.split(e),i),c=String(o).length;return(i.highlight?i.highlight(n):n).split(e).slice(a,o).map((e,t)=>{let n=a+1+t,r=` ${` ${n}`.slice(-c)} | `,i=!!(s[n]??!1);if(i){let t=``;if(Array.isArray(i)){let n=e.slice(0,Math.max(i[0]-1,0)).replace(/[^\t]/g,` `),a=i[1]||1;t=[`
|
|
2
|
+
`,r.replace(/\d/g,` `),n,`^`.repeat(a)].join(``)}return[`>`,r,e,t].join(``)}return` ${r}${e}`}).join(`
|
|
3
|
+
`)}exports.codeFrameColumns=n;
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils/code-frames.d.ts
|
|
2
|
+
interface Location {
|
|
3
|
+
column: number;
|
|
4
|
+
line: number;
|
|
5
|
+
}
|
|
6
|
+
interface NodeLocation {
|
|
7
|
+
end?: Location;
|
|
8
|
+
start?: Location;
|
|
9
|
+
}
|
|
10
|
+
declare function codeFrameColumns(rawLines: string, loc: NodeLocation, opts?: {
|
|
11
|
+
linesAbove?: number;
|
|
12
|
+
linesBelow?: number;
|
|
13
|
+
highlight?: (rawLines: string) => string;
|
|
14
|
+
}): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { codeFrameColumns };
|
|
17
|
+
//# sourceMappingURL=code-frames.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-frames.d.cts","names":[],"sources":["../../src/utils/code-frames.ts"],"sourcesContent":[],"mappings":";UAkBU,QAAA;EAAA,MAAA,EAAA,MAAQ;EAKR,IAAA,EAAA,MAAA;AAoFV;UApFU,YAAA;QACF;UACE;;iBAkFM,gBAAA,wBAET"}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils/code-frames.d.ts
|
|
2
|
+
interface Location {
|
|
3
|
+
column: number;
|
|
4
|
+
line: number;
|
|
5
|
+
}
|
|
6
|
+
interface NodeLocation {
|
|
7
|
+
end?: Location;
|
|
8
|
+
start?: Location;
|
|
9
|
+
}
|
|
10
|
+
declare function codeFrameColumns(rawLines: string, loc: NodeLocation, opts?: {
|
|
11
|
+
linesAbove?: number;
|
|
12
|
+
linesBelow?: number;
|
|
13
|
+
highlight?: (rawLines: string) => string;
|
|
14
|
+
}): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { codeFrameColumns };
|
|
17
|
+
//# sourceMappingURL=code-frames.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-frames.d.mts","names":[],"sources":["../../src/utils/code-frames.ts"],"sourcesContent":[],"mappings":";UAkBU,QAAA;EAAA,MAAA,EAAA,MAAQ;EAKR,IAAA,EAAA,MAAA;AAoFV;UApFU,YAAA;QACF;UACE;;iBAkFM,gBAAA,wBAET"}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const e=/\r\n|[\n\r\u2028\u2029]/;function t(e,t,n={}){let r={column:0,line:-1,...e.start},i={...r,...e.end},{linesAbove:a=2,linesBelow:o=3}=n||{},s=r.line,c=r.column,l=i.line,u=i.column,d=Math.max(s-(a+1),0),f=Math.min(t.length,l+o);s===-1&&(d=0),l===-1&&(f=t.length);let p=l-s,m={};if(p)for(let e=0;e<=p;e++){let n=e+s;c?e===0?m[n]=[c,(t[n-1]?.length??0)-c+1]:e===p?m[n]=[0,u]:m[n]=[0,t[n-e]?.length??0]:m[n]=!0}else c===u?m[s]=c?[c,0]:!0:m[s]=[c,u-c];return{start:d,end:f,markerLines:m}}function n(n,r,i={}){let{start:a,end:o,markerLines:s}=t(r,n.split(e),i),c=String(o).length;return(i.highlight?i.highlight(n):n).split(e).slice(a,o).map((e,t)=>{let n=a+1+t,r=` ${` ${n}`.slice(-c)} | `,i=!!(s[n]??!1);if(i){let t=``;if(Array.isArray(i)){let n=e.slice(0,Math.max(i[0]-1,0)).replace(/[^\t]/g,` `),a=i[1]||1;t=[`
|
|
2
|
+
`,r.replace(/\d/g,` `),n,`^`.repeat(a)].join(``)}return[`>`,r,e,t].join(``)}return` ${r}${e}`}).join(`
|
|
3
|
+
`)}export{n as codeFrameColumns};
|
|
4
|
+
//# sourceMappingURL=code-frames.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-frames.mjs","names":["startLoc: Location","endLoc: Location"],"sources":["../../src/utils/code-frames.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\ninterface Location {\n column: number;\n line: number;\n}\n\ninterface NodeLocation {\n end?: Location;\n start?: Location;\n}\n\n// Adapted from https://raw.githubusercontent.com/babel/babel/4108524/packages/babel-code-frame/src/index.js\n\n/**\n * RegExp to test for newlines in terminal.\n */\nconst NEWLINE = /\\r\\n|[\\n\\r\\u2028\\u2029]/;\n\n/**\n * Extract what lines should be marked and highlighted.\n */\nfunction getMarkerLines(\n loc: NodeLocation,\n source: string[],\n opts: { linesAbove?: number; linesBelow?: number } = {}\n): {\n start: number;\n end: number;\n markerLines: Record<number, boolean | [number, number]>;\n} {\n const startLoc: Location = {\n column: 0,\n line: -1,\n ...loc.start\n };\n const endLoc: Location = {\n ...startLoc,\n ...loc.end\n };\n const { linesAbove = 2, linesBelow = 3 } = opts || {};\n const startLine = startLoc.line;\n const startColumn = startLoc.column;\n const endLine = endLoc.line;\n const endColumn = endLoc.column;\n\n let start = Math.max(startLine - (linesAbove + 1), 0);\n let end = Math.min(source.length, endLine + linesBelow);\n\n if (startLine === -1) {\n start = 0;\n }\n\n if (endLine === -1) {\n end = source.length;\n }\n\n const lineDiff = endLine - startLine;\n const markerLines = {} as Record<number, boolean | [number, number]>;\n\n if (lineDiff) {\n for (let i = 0; i <= lineDiff; i++) {\n const lineNumber = i + startLine;\n\n if (!startColumn) {\n markerLines[lineNumber] = true;\n } else if (i === 0) {\n const sourceLength = source[lineNumber - 1]?.length ?? 0;\n\n markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];\n } else if (i === lineDiff) {\n markerLines[lineNumber] = [0, endColumn];\n } else {\n const sourceLength = source[lineNumber - i]?.length ?? 0;\n\n markerLines[lineNumber] = [0, sourceLength];\n }\n }\n } else if (startColumn === endColumn) {\n markerLines[startLine] = startColumn ? [startColumn, 0] : true;\n } else {\n markerLines[startLine] = [startColumn, endColumn - startColumn];\n }\n\n return {\n start,\n end,\n markerLines\n };\n}\n\nexport function codeFrameColumns(\n rawLines: string,\n loc: NodeLocation,\n opts: {\n linesAbove?: number;\n linesBelow?: number;\n highlight?: (rawLines: string) => string;\n } = {}\n): string {\n const lines = rawLines.split(NEWLINE);\n const { start, end, markerLines } = getMarkerLines(loc, lines, opts);\n\n const numberMaxWidth = String(end).length;\n const highlightedLines = opts.highlight ? opts.highlight(rawLines) : rawLines;\n\n const frame = highlightedLines\n .split(NEWLINE)\n .slice(start, end)\n .map((line, index) => {\n const number = start + 1 + index;\n const paddedNumber = ` ${number}`.slice(-numberMaxWidth);\n const gutter = ` ${paddedNumber} | `;\n const hasMarker = Boolean(markerLines[number] ?? false);\n if (hasMarker) {\n let markerLine = \"\";\n if (Array.isArray(hasMarker)) {\n const markerSpacing = line\n .slice(0, Math.max(hasMarker[0] - 1, 0))\n .replace(/[^\\t]/g, \" \");\n const numberOfMarkers = hasMarker[1] || 1;\n\n markerLine = [\n \"\\n \",\n gutter.replace(/\\d/g, \" \"),\n markerSpacing,\n \"^\".repeat(numberOfMarkers)\n ].join(\"\");\n }\n return [\">\", gutter, line, markerLine].join(\"\");\n }\n return ` ${gutter}${line}`;\n })\n .join(\"\\n\");\n\n return frame;\n}\n"],"mappings":"AAiCA,MAAM,EAAU,0BAKhB,SAAS,EACP,EACA,EACA,EAAqD,EAAE,CAKvD,CACA,IAAMA,EAAqB,CACzB,OAAQ,EACR,KAAM,GACN,GAAG,EAAI,MACR,CACKC,EAAmB,CACvB,GAAG,EACH,GAAG,EAAI,IACR,CACK,CAAE,aAAa,EAAG,aAAa,GAAM,GAAQ,EAAE,CAC/C,EAAY,EAAS,KACrB,EAAc,EAAS,OACvB,EAAU,EAAO,KACjB,EAAY,EAAO,OAErB,EAAQ,KAAK,IAAI,GAAa,EAAa,GAAI,EAAE,CACjD,EAAM,KAAK,IAAI,EAAO,OAAQ,EAAU,EAAW,CAEnD,IAAc,KAChB,EAAQ,GAGN,IAAY,KACd,EAAM,EAAO,QAGf,IAAM,EAAW,EAAU,EACrB,EAAc,EAAE,CAEtB,GAAI,EACF,IAAK,IAAI,EAAI,EAAG,GAAK,EAA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@@ -1 +1 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require(`./strip-comments.cjs`),t=require(`./parse.cjs`),n=require(`./code-frames.cjs`),r=require(`./parse-error.cjs`),i=require(`./stringify.cjs`);exports.codeFrameColumns=n.codeFrameColumns,exports.formatParseError=r.formatParseError,exports.invalidKeyChars=i.invalidKeyChars,exports.parse=t.parse,exports.safeParse=t.safeParse,exports.stringify=i.stringify,exports.stripComments=e.stripComments;
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { codeFrameColumns } from "./code-frames.cjs";
|
|
2
|
+
import { Options, parse, safeParse } from "./parse.cjs";
|
|
3
|
+
import { formatParseError } from "./parse-error.cjs";
|
|
4
|
+
import { invalidKeyChars, stringify } from "./stringify.cjs";
|
|
5
|
+
import { stripComments } from "./strip-comments.cjs";
|
|
6
6
|
export { Options, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import "../index-CMuRFTR3.mjs";
|
|
1
|
+
import { codeFrameColumns } from "./code-frames.mjs";
|
|
2
|
+
import { Options, parse, safeParse } from "./parse.mjs";
|
|
3
|
+
import { formatParseError } from "./parse-error.mjs";
|
|
4
|
+
import { invalidKeyChars, stringify } from "./stringify.mjs";
|
|
5
|
+
import { stripComments } from "./strip-comments.mjs";
|
|
7
6
|
export { Options, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{stripComments as e}from"./strip-comments.mjs";import{parse as t,safeParse as n}from"./parse.mjs";import{codeFrameColumns as r}from"./code-frames.mjs";import{formatParseError as i}from"./parse-error.mjs";import{invalidKeyChars as a,stringify as o}from"./stringify.mjs";export{r as codeFrameColumns,i as formatParseError,a as invalidKeyChars,t as parse,n as safeParse,o as stringify,e as stripComments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./code-frames.cjs`);let n=require(`jsonc-parser`),r=require(`lines-and-columns`);function i(e,i){let{error:a,offset:o,length:s}=i,c=new r.LinesAndColumns(e).locationForIndex(o),l=c?.line??0,u=c?.column??0;return l++,u++,`${(0,n.printParseErrorCode)(a)} in JSON at ${l}:${u}\n${t.codeFrameColumns(e,{start:{line:l,column:u},end:{line:l,column:u+s}})}\n`}exports.formatParseError=i;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ParseError } from "jsonc-parser";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/parse-error.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Nicely formats a JSON error with context
|
|
7
|
+
*
|
|
8
|
+
* @param input - JSON content as string
|
|
9
|
+
* @param parseError - jsonc ParseError
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
declare function formatParseError(input: string, parseError: ParseError): string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { formatParseError };
|
|
15
|
+
//# sourceMappingURL=parse-error.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-error.d.cts","names":[],"sources":["../../src/utils/parse-error.ts"],"sourcesContent":[],"mappings":";;;;;;AA8BA;;;;;iBAAgB,gBAAA,4BAA4C"}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ParseError } from "jsonc-parser";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/parse-error.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Nicely formats a JSON error with context
|
|
7
|
+
*
|
|
8
|
+
* @param input - JSON content as string
|
|
9
|
+
* @param parseError - jsonc ParseError
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
declare function formatParseError(input: string, parseError: ParseError): string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { formatParseError };
|
|
15
|
+
//# sourceMappingURL=parse-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-error.d.mts","names":[],"sources":["../../src/utils/parse-error.ts"],"sourcesContent":[],"mappings":";;;;;;AA8BA;;;;;iBAAgB,gBAAA,4BAA4C"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{codeFrameColumns as e}from"./code-frames.mjs";import{printParseErrorCode as t}from"jsonc-parser";import{LinesAndColumns as n}from"lines-and-columns";function r(r,i){let{error:a,offset:o,length:s}=i,c=new n(r).locationForIndex(o),l=c?.line??0,u=c?.column??0;return l++,u++,`${t(a)} in JSON at ${l}:${u}\n${e(r,{start:{line:l,column:u},end:{line:l,column:u+s}})}\n`}export{r as formatParseError};
|
|
2
|
+
//# sourceMappingURL=parse-error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-error.mjs","names":[],"sources":["../../src/utils/parse-error.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ParseError } from \"jsonc-parser\";\nimport { printParseErrorCode } from \"jsonc-parser\";\nimport { LinesAndColumns } from \"lines-and-columns\";\nimport { codeFrameColumns } from \"./code-frames\";\n\n/**\n * Nicely formats a JSON error with context\n *\n * @param input - JSON content as string\n * @param parseError - jsonc ParseError\n * @returns\n */\nexport function formatParseError(input: string, parseError: ParseError) {\n const { error, offset, length } = parseError;\n const result = new LinesAndColumns(input).locationForIndex(offset);\n let line = result?.line ?? 0;\n let column = result?.column ?? 0;\n\n line++;\n column++;\n\n return `${printParseErrorCode(error)} in JSON at ${line}:${column}\\n${codeFrameColumns(\n input,\n {\n start: {\n line,\n column\n },\n end: {\n line,\n column: column + length\n }\n }\n )}\\n`;\n}\n"],"mappings":"4JA8BA,SAAgB,EAAiB,EAAe,EAAwB,CACtE,GAAM,CAAE,QAAO,SAAQ,UAAW,EAC5B,EAAS,IAAI,EAAgB,EAAM,CAAC,iBAAiB,EAAO,CAC9D,EAAO,GAAQ,MAAQ,EACvB,EAAS,GAAQ,QAAU,EAK/B,MAHA,KACA,IAEO,GAAG,EAAoB,EAAM,CAAC,cAAc,EAAK,GAAG,EAAO,IAAI,EACpE,EACA,CACE,MAAO,CACL,OACA,SACD,CACD,IAAK,CACH,OACA,OAAQ,EAAS,EAClB,CACF,CACF,CAAC"}
|
package/dist/utils/parse.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require(`./strip-comments.cjs`),t=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,n=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,r=/^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;function i(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){console.warn(`Dropping "${e}" key to prevent prototype pollution.`);return}return t}function a(a,o={}){if(typeof a!=`string`)return a;let s=e.stripComments(a);if(s[0]===`"`&&s[s.length-1]===`"`&&!s.includes(`\\`))return s.slice(1,-1);if(s=s.trim(),s.length<=9)switch(s.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!r.test(s)){if(o.strict)throw Error(`Invalid JSON`);return s}try{if(t.test(s)||n.test(s)){if(o.strict)throw Error(`Possible prototype pollution`);return JSON.parse(s,i)}return JSON.parse(s)}catch(e){if(o.strict)throw e;return a}}function o(e,t={}){return a(e,{...t,strict:!0})}exports.parse=a,exports.safeParse=o;
|
package/dist/utils/parse.d.cts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils/parse.d.ts
|
|
2
|
+
interface Options {
|
|
3
|
+
strict?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare function parse<T = unknown>(value: any, options?: Options): T;
|
|
6
|
+
declare function safeParse<T = unknown>(value: any, options?: Options): T;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Options, parse, safeParse };
|
|
9
|
+
//# sourceMappingURL=parse.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.cts","names":[],"sources":["../../src/utils/parse.ts"],"sourcesContent":[],"mappings":";UA4CiB,OAAA;EAAA,MAAA,CAAA,EAAA,OAAO;AAIxB;AAmEgB,iBAnEA,KAmE4C,CAAA,IAAA,OAAgB,CAAA,CAAA,KAAA,EAAA,GAAA,EAAA,OAAA,CAAA,EAnEpB,OAmEoB,CAAA,EAnEL,CAmEK;iBAA5D,6CAA4C,UAAe"}
|