@stryke/url 0.3.4 → 0.3.12

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +249 -0
  2. package/README.md +18 -9
  3. package/dist/helpers-C8s0XHG1.cjs +1 -0
  4. package/dist/helpers-CcGiwVAN.mjs +2 -0
  5. package/dist/helpers-CcGiwVAN.mjs.map +1 -0
  6. package/dist/helpers.cjs +1 -22
  7. package/dist/helpers.d.cts +12 -0
  8. package/dist/helpers.d.cts.map +1 -0
  9. package/dist/helpers.d.mts +12 -0
  10. package/dist/helpers.d.mts.map +1 -0
  11. package/dist/helpers.mjs +1 -1
  12. package/dist/index.cjs +1 -27
  13. package/dist/index.d.cts +3 -0
  14. package/dist/index.d.mts +3 -0
  15. package/dist/index.mjs +1 -1
  16. package/dist/storm-url-BeaSjjni.d.cts +61 -0
  17. package/dist/storm-url-BeaSjjni.d.cts.map +1 -0
  18. package/dist/storm-url-C44M08EF.d.mts +61 -0
  19. package/dist/storm-url-C44M08EF.d.mts.map +1 -0
  20. package/dist/storm-url-DQn2usO1.mjs +7 -0
  21. package/dist/storm-url-DQn2usO1.mjs.map +1 -0
  22. package/dist/storm-url-t7pdfQNU.cjs +6 -0
  23. package/dist/storm-url.cjs +1 -184
  24. package/dist/storm-url.d.cts +2 -0
  25. package/dist/storm-url.d.mts +2 -0
  26. package/dist/storm-url.mjs +1 -1
  27. package/dist/types-CHTfZzkO.d.cts +94 -0
  28. package/dist/types-CHTfZzkO.d.cts.map +1 -0
  29. package/dist/types-CxnefvtE.cjs +1 -0
  30. package/dist/types-DL1n5nYV.mjs +2 -0
  31. package/dist/types-DL1n5nYV.mjs.map +1 -0
  32. package/dist/types-wUi0ilxL.d.mts +94 -0
  33. package/dist/types-wUi0ilxL.d.mts.map +1 -0
  34. package/dist/types.cjs +1 -7
  35. package/dist/types.d.cts +2 -0
  36. package/dist/types.d.mts +2 -0
  37. package/dist/types.mjs +1 -1
  38. package/package.json +16 -105
  39. package/dist/helpers.d.ts +0 -8
  40. package/dist/index.d.ts +0 -2
  41. package/dist/storm-url.d.ts +0 -55
  42. package/dist/types.d.ts +0 -90
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storm-url-DQn2usO1.mjs","names":["isInsideString: boolean | symbol","isInsideComment: boolean | symbol","parse","startLoc: Location","endLoc: Location","#instance","parseValue","stringifyValue","errors: ParseError[]","char: string | null","#options","decodeURL","#username","#password","#hostname","#port","#protocol","#hash","#params","#paths"],"sources":["../../type-checks/src/get-object-tag.ts","../../type-checks/src/is-plain-object.ts","../../type-checks/src/is-object.ts","../../type-checks/src/is-string.ts","../../types/src/base.ts","../../json/src/utils/strip-comments.ts","../../json/src/utils/parse.ts","../../json/src/utils/code-frames.ts","../../json/src/utils/parse-error.ts","../../type-checks/src/is-number.ts","../../type-checks/src/is-undefined.ts","../../json/src/utils/stringify.ts","../../json/src/storm-json.ts","../../path/src/regex.ts","../../path/src/slash.ts","../../path/src/is-type.ts","../../path/src/join-paths.ts","../../type-checks/src/is-integer.ts","../../type-checks/src/is-null.ts","../../type-checks/src/is-empty.ts","../../type-checks/src/is-set.ts","../../type-checks/src/is-set-string.ts","../src/storm-url.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/**\n * Gets the `toStringTag` of `obj`.\n *\n * @param value - The obj to query.\n * @returns Returns the `toStringTag`.\n */\nexport const getObjectTag = (value: unknown): string => {\n if (value == null) {\n return value === undefined ? \"[object Undefined]\" : \"[object Null]\";\n }\n return Object.prototype.toString.call(value);\n};\n","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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 { EMPTY_STRING } from \"@stryke/types/base\";\n\nconst singleComment = Symbol(\"singleComment\");\nconst multiComment = Symbol(\"multiComment\");\n\nfunction stripWithoutWhitespace() {\n return \"\";\n}\nfunction stripWithWhitespace(value: string, start?: number, end?: number) {\n return value.slice(start, end).replace(/\\S/g, \" \");\n}\n\nfunction isEscaped(value: string, quotePosition: number) {\n let index = quotePosition - 1;\n let backslashCount = 0;\n while (value[index] === \"\\\\\") {\n index -= 1;\n backslashCount += 1;\n }\n\n return Boolean(backslashCount % 2);\n}\n\nexport function stripComments(\n value: string,\n { whitespace = true, trailingCommas = false } = {}\n) {\n if (typeof value !== \"string\") {\n throw new TypeError(\n `Expected argument \\`jsonString\\` to be a \\`string\\`, got \\`${typeof value}\\``\n );\n }\n\n const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;\n let isInsideString: boolean | symbol = false;\n let isInsideComment: boolean | symbol = false;\n let offset = 0;\n let buffer = \"\";\n let result = \"\";\n let commaIndex = -1;\n for (let index = 0; index < value.length; index++) {\n const currentCharacter = value[index];\n const nextCharacter = value[index + 1];\n if (!isInsideComment && currentCharacter === '\"') {\n const escaped = isEscaped(value, index);\n if (!escaped) {\n isInsideString = !isInsideString;\n }\n }\n if (isInsideString) {\n continue;\n }\n if (\n !isInsideComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"//\"\n ) {\n buffer += value.slice(offset, index);\n offset = index;\n isInsideComment = singleComment;\n index++;\n } else if (\n isInsideComment === singleComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"\\r\\n\"\n ) {\n index++;\n isInsideComment = false;\n buffer += strip(value, offset, index);\n offset = index;\n } else if (isInsideComment === singleComment && currentCharacter === \"\\n\") {\n isInsideComment = false;\n buffer += strip(value, offset, index);\n offset = index;\n } else if (\n !isInsideComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"/*\"\n ) {\n buffer += value.slice(offset, index);\n offset = index;\n isInsideComment = multiComment;\n index++;\n } else if (\n isInsideComment === multiComment &&\n currentCharacter + (nextCharacter ?? EMPTY_STRING) === \"*/\"\n ) {\n index++;\n isInsideComment = false;\n buffer += strip(value, offset, index + 1);\n offset = index + 1;\n } else if (trailingCommas && !isInsideComment) {\n if (commaIndex !== -1) {\n if (currentCharacter === \"}\" || currentCharacter === \"]\") {\n buffer += value.slice(offset, index);\n result += strip(buffer, 0, 1) + buffer.slice(1);\n buffer = \"\";\n offset = index;\n commaIndex = -1;\n } else if (\n currentCharacter !== \" \" &&\n currentCharacter !== \"\t\" &&\n currentCharacter !== \"\\r\" &&\n currentCharacter !== \"\\n\"\n ) {\n buffer += value.slice(offset, index);\n offset = index;\n commaIndex = -1;\n }\n } else if (currentCharacter === \",\") {\n result += buffer + value.slice(offset, index);\n buffer = \"\";\n offset = index;\n commaIndex = index;\n }\n }\n }\n\n return (\n result +\n buffer +\n (isInsideComment ? strip(value.slice(offset)) : value.slice(offset))\n );\n}\n","/* -------------------------------------------------------------------\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 { stripComments } from \"./strip-comments\";\n\n// https://github.com/fastify/secure-json-parse\n// https://github.com/hapijs/bourne\nconst suspectProtoRx =\n /\"(?:_|\\\\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*:/;\nconst suspectConstructorRx =\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*:/;\n\nconst JsonSigRx = /^\\s*[\"[{]|^\\s*-?\\d{1,16}(?:\\.\\d{1,17})?(?:E[+-]?\\d+)?\\s*$/i;\n\nfunction jsonParseTransform(key: string, value: any): any {\n if (\n key === \"__proto__\" ||\n (key === \"constructor\" &&\n value &&\n typeof value === \"object\" &&\n \"prototype\" in value)\n ) {\n // eslint-disable-next-line no-console\n console.warn(`Dropping \"${key}\" key to prevent prototype pollution.`);\n return;\n }\n return value;\n}\n\nexport interface Options {\n strict?: boolean;\n}\n\nexport function parse<T = unknown>(value: any, options: Options = {}): T {\n if (typeof value !== \"string\") {\n return value;\n }\n\n let stripped = stripComments(value);\n\n if (\n stripped[0] === '\"' &&\n stripped[stripped.length - 1] === '\"' &&\n !stripped.includes(\"\\\\\")\n ) {\n return stripped.slice(1, -1) as T;\n }\n\n stripped = stripped.trim();\n\n if (stripped.length <= 9) {\n switch (stripped.toLowerCase()) {\n case \"true\": {\n return true as T;\n }\n case \"false\": {\n return false as T;\n }\n case \"undefined\": {\n return undefined as T;\n }\n case \"null\": {\n return null as T;\n }\n case \"nan\": {\n return Number.NaN as T;\n }\n case \"infinity\": {\n return Number.POSITIVE_INFINITY as T;\n }\n case \"-infinity\": {\n return Number.NEGATIVE_INFINITY as T;\n }\n }\n }\n\n if (!JsonSigRx.test(stripped)) {\n if (options.strict) {\n throw new Error(\"Invalid JSON\");\n }\n return stripped as T;\n }\n\n try {\n if (suspectProtoRx.test(stripped) || suspectConstructorRx.test(stripped)) {\n if (options.strict) {\n throw new Error(\"Possible prototype pollution\");\n }\n return JSON.parse(stripped, jsonParseTransform);\n }\n\n return JSON.parse(stripped);\n } catch (error) {\n if (options.strict) {\n throw error;\n }\n return value as T;\n }\n}\n\nexport function safeParse<T = unknown>(value: any, options: Options = {}): T {\n return parse<T>(value, { ...options, strict: true });\n}\n","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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 { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport const invalidKeyChars = [\n \"@\",\n \"/\",\n \"#\",\n \"$\",\n \" \",\n \":\",\n \";\",\n \",\",\n \".\",\n \"!\",\n \"?\",\n \"&\",\n \"=\",\n \"+\",\n \"-\",\n \"*\",\n \"%\",\n \"^\",\n \"~\",\n \"|\",\n \"\\\\\",\n '\"',\n \"'\",\n \"`\",\n \"{\",\n \"}\",\n \"[\",\n \"]\",\n \"(\",\n \")\",\n \"<\",\n \">\"\n] as const;\n\n/**\n * Stringify a value to a JSON-like string.\n *\n * @param value - The value to stringify\n * @param spacing - The spacing to use for the stringification\n * @returns The stringified value\n */\nexport const stringify = (\n value: unknown,\n spacing: string | number = 2\n): string => {\n const space = isNumber(spacing) ? \" \".repeat(spacing) : spacing;\n\n switch (value) {\n case null: {\n return \"null\";\n }\n case undefined: {\n return '\"undefined\"';\n }\n case true: {\n return \"true\";\n }\n case false: {\n return \"false\";\n }\n case Number.POSITIVE_INFINITY: {\n return \"infinity\";\n }\n case Number.NEGATIVE_INFINITY: {\n return \"-infinity\";\n }\n }\n\n if (Array.isArray(value)) {\n return `[${space}${value.map(v => stringify(v, space)).join(`,${space}`)}${space}]`;\n }\n if (value instanceof Uint8Array) {\n return value.toString();\n }\n\n // eslint-disable-next-line ts/switch-exhaustiveness-check\n switch (typeof value) {\n case \"number\": {\n return `${value}`;\n }\n case \"string\": {\n return JSON.stringify(value);\n }\n case \"object\": {\n const keys = Object.keys(value as object).filter(\n key => !isUndefined((value as any)[key])\n );\n\n return `{${space}${keys\n .map(\n key =>\n `${invalidKeyChars.some(invalidKeyChar => key.includes(invalidKeyChar)) ? `\"${key}\"` : key}: ${space}${stringify((value as any)[key], space)}`\n )\n .join(`,${space}`)}${space}}`;\n }\n default:\n return \"null\";\n }\n};\n","/* -------------------------------------------------------------------\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 type {\n Class,\n JsonParseOptions,\n JsonParserResult,\n JsonSerializeOptions,\n JsonValue\n} from \"./types\";\n// import { Decimal } from \"decimal.js\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { parse } from \"jsonc-parser\";\nimport { Buffer } from \"node:buffer\";\nimport SuperJSON from \"superjson\";\nimport { parse as parseValue } from \"./utils/parse\";\nimport { formatParseError } from \"./utils/parse-error\";\nimport { stringify as stringifyValue } from \"./utils/stringify\";\n\n/**\n * A static JSON parser class used by Storm Software to serialize and deserialize JSON data\n *\n * @remarks\n * This class uses the [SuperJSON](https://github.com/blitz-js/superjson) library under the hood.\n */\nexport class StormJSON extends SuperJSON {\n static #instance: StormJSON;\n\n public static get instance(): StormJSON {\n if (!StormJSON.#instance) {\n StormJSON.#instance = new StormJSON();\n }\n\n return StormJSON.#instance;\n }\n\n /**\n * Deserialize the given value with superjson using the given metadata\n */\n public static override deserialize<TData = unknown>(\n payload: JsonParserResult\n ): TData {\n return StormJSON.instance.deserialize(payload);\n }\n\n /**\n * Serialize the given value with superjson\n */\n public static override serialize(object: JsonValue): JsonParserResult {\n return StormJSON.instance.serialize(object);\n }\n\n /**\n * Parse the given string value with superjson using the given metadata\n *\n * @param value - The string value to parse\n * @returns The parsed data\n */\n public static override parse<TData = unknown>(value: string): TData {\n return parseValue(value);\n }\n\n /**\n * Serializes the given data to a JSON string.\n * By default the JSON string is formatted with a 2 space indentation to be easy readable.\n *\n * @param value - Object which should be serialized to JSON\n * @param _options - JSON serialize options\n * @returns the formatted JSON representation of the object\n */\n public static override stringify<T>(\n value: T,\n _options?: JsonSerializeOptions\n ): string {\n const customTransformer =\n StormJSON.instance.customTransformerRegistry.findApplicable(value);\n\n let result = value;\n if (customTransformer && customTransformer.isApplicable(value)) {\n result = customTransformer.serialize(result) as T;\n }\n\n return stringifyValue(result);\n }\n\n /**\n * Parses the given JSON string and returns the object the JSON content represents.\n * By default javascript-style comments and trailing commas are allowed.\n *\n * @param strData - JSON content as string\n * @param options - JSON parse options\n * @returns Object the JSON content represents\n */\n public static parseJson<TData = unknown>(\n strData: string,\n options?: JsonParseOptions\n ): TData {\n try {\n if (options?.expectComments === false) {\n return StormJSON.instance.parse(strData);\n }\n } catch {\n // Do nothing\n }\n\n const errors: ParseError[] = [];\n const opts = {\n allowTrailingComma: true,\n ...options\n };\n const result = parse(strData, errors, opts) as TData;\n\n if (errors.length > 0 && errors[0]) {\n throw new Error(formatParseError(strData, errors[0]));\n }\n\n return result;\n }\n\n /**\n * Register a custom schema with superjson\n *\n * @param name - The name of the schema\n * @param serialize - The function to serialize the schema\n * @param deserialize - The function to deserialize the schema\n * @param isApplicable - The function to check if the schema is applicable\n */\n public static register<\n TData = any,\n TJsonObject extends JsonValue = JsonValue\n >(\n name: string,\n serialize: (data: TData) => TJsonObject,\n deserialize: (json: TJsonObject) => TData,\n isApplicable: (data: any) => data is TData\n ) {\n StormJSON.instance.registerCustom<TData, TJsonObject>(\n {\n isApplicable,\n serialize,\n deserialize\n },\n name\n );\n }\n\n /**\n * Register a class with superjson\n *\n * @param classConstructor - The class constructor to register\n */\n public static override registerClass(\n classConstructor: Class,\n options?: { identifier?: string; allowProps?: string[] } | string\n ) {\n StormJSON.instance.registerClass(classConstructor, {\n identifier: isString(options)\n ? options\n : options?.identifier || classConstructor.name,\n allowProps:\n options &&\n isObject(options) &&\n options?.allowProps &&\n Array.isArray(options.allowProps)\n ? options.allowProps\n : [\"__typename\"]\n });\n }\n\n private constructor() {\n super({ dedupe: true });\n }\n}\n\nStormJSON.instance.registerCustom<Buffer, string>(\n {\n isApplicable: (v): v is Buffer => Buffer.isBuffer(v),\n serialize: v => v.toString(\"base64\"),\n deserialize: v => Buffer.from(v, \"base64\")\n },\n \"Bytes\"\n);\n","/* -------------------------------------------------------------------\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 DRIVE_LETTER_START_REGEX = /^[A-Z]:\\//i;\nexport const DRIVE_LETTER_REGEX = /^[A-Z]:$/i;\n\nexport const UNC_REGEX = /^[/\\\\]{2}/;\n\nexport const ABSOLUTE_PATH_REGEX =\n /^[/\\\\](?![/\\\\])|^[/\\\\]{2}(?!\\.)|^~[/\\\\]|^[A-Z]:[/\\\\]/i;\n\nexport const ROOT_FOLDER_REGEX = /^\\/([A-Z]:)?$/i;\n\nexport const FILE_EXTENSION_REGEX = /\\.[0-9a-z]+$/i;\n\nexport const PACKAGE_PATH_REGEX = /^@\\w+\\/.*$/;\nexport const NPM_SCOPED_PACKAGE_REGEX = /^(?:@[\\w-]+\\/)?[\\w-]+$/;\n","/* -------------------------------------------------------------------\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 { isAbsolutePath } from \"./is-type\";\n\n/**\n * Replace backslash to slash\n *\n * @param path - The string to replace\n * @returns The string with replaced backslashes\n */\nexport function slash(path: string) {\n if (path.startsWith(\"\\\\\\\\?\\\\\")) {\n return path;\n }\n\n return path.replace(/\\\\/g, \"/\");\n}\n\n/**\n * Replace backslash to slash and remove unneeded leading and trailing slashes\n *\n * @param path - The string to replace\n * @returns The string with replaced backslashes\n */\nexport function formatSlash(path: string) {\n const formatted = slash(path);\n\n return isAbsolutePath(formatted)\n ? formatted.replace(/\\/+$/g, \"\")\n : formatted.replace(/^\\.\\//g, \"\").replace(/\\/+$/g, \"\");\n}\n","/* -------------------------------------------------------------------\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 { ABSOLUTE_PATH_REGEX, NPM_SCOPED_PACKAGE_REGEX } from \"./regex\";\nimport { slash } from \"./slash\";\n\n/**\n * Check if the path is an absolute path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolutePath(path: string): boolean {\n return ABSOLUTE_PATH_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is an absolute path.\n *\n * @remarks\n * This is an alias for {@link isAbsolutePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolute(path: string): boolean {\n return isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelativePath(path: string): boolean {\n return !isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @remarks\n * This is an alias for {@link isRelativePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelative(path: string): boolean {\n return isRelativePath(path);\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackage}.\n *\n * @example\n * ```ts\n * isNpmScopedPackage(\"@stryke/path\"); // returns true\n * isNpmScopedPackage(\"lodash\"); // returns false\n * isNpmNamespacePackage(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackagePath(path: string): boolean {\n return NPM_SCOPED_PACKAGE_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackagePath}.\n *\n * @example\n * ```ts\n * isNpmScopedPackagePath(\"@stryke/path\"); // returns true\n * isNpmScopedPackagePath(\"lodash\"); // returns false\n * isNpmScopedPackagePath(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackage(path: string): boolean {\n return isNpmScopedPackagePath(path);\n}\n","/* -------------------------------------------------------------------\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 { isAbsolute } from \"./is-type\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\n\n// Util to normalize windows paths to posix\nfunction normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n return input\n .replace(/\\\\/g, \"/\")\n .replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\nfunction correctPaths(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n // Normalize windows argument\n path = normalizeWindowsPath(path);\n\n const isUNCPath = path.match(UNC_REGEX);\n const isPathAbsolute = isAbsolute(path);\n const trailingSeparator = path[path.length - 1] === \"/\";\n\n // Normalize the path\n path = normalizeString(path, !isPathAbsolute);\n\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n if (trailingSeparator) {\n path += \"/\";\n }\n if (DRIVE_LETTER_REGEX.test(path)) {\n path += \"/\";\n }\n\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n\n return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n}\n\n/**\n * Joins all given path segments together using the platform-specific separator as a delimiter.\n * The resulting path is normalized to remove any redundant or unnecessary segments.\n *\n * @param segments - The path segments to join.\n * @returns The joined and normalized path string.\n */\nexport function joinPaths(...segments: string[]): string {\n let path = \"\";\n\n for (const seg of segments) {\n if (!seg) {\n continue;\n }\n if (path.length > 0) {\n const pathTrailing = path[path.length - 1] === \"/\";\n const segLeading = seg[0] === \"/\";\n const both = pathTrailing && segLeading;\n if (both) {\n path += seg.slice(1);\n } else {\n path += pathTrailing || segLeading ? seg : `/${seg}`;\n }\n } else {\n path += seg;\n }\n }\n\n return correctPaths(path);\n}\n\nexport const join = joinPaths;\n\n/**\n * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n *\n * @param path - The path to normalize.\n * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n * @returns the normalized path string.\n */\nfunction normalizeString(path: string, allowAboveRoot: boolean) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char: string | null = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n // casted because we know it exists thanks to the length check\n char = path[index] as string;\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) {\n // NOOP\n } else if (dots === 2) {\n if (\n res.length < 2 ||\n lastSegmentLength !== 2 ||\n res[res.length - 1] !== \".\" ||\n res[res.length - 2] !== \".\"\n ) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n","/* -------------------------------------------------------------------\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 { isNumber } from \"./is-number\";\nimport { isString } from \"./is-string\";\n\n/**\n * Check if the provided value's type is an integer\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `number` and is an integer\n */\nexport const isInteger = (value: unknown): boolean =>\n !isString(value) && isNumber(value) && value % 1 === 0;\n","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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 { isDate } from \"./is-date\";\nimport { isFunction } from \"./is-function\";\nimport { isNull } from \"./is-null\";\nimport { isNumber } from \"./is-number\";\nimport { isSymbol } from \"./is-symbol\";\nimport { isUndefined } from \"./is-undefined\";\n\n/**\n * Check if the provided value's type is `null` or `undefined`\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `null` or `undefined`\n */\nexport const isEmpty = (value: unknown) => {\n try {\n return isUndefined(value) || isNull(value);\n } catch {\n return false;\n }\n};\n\nexport const isEmptyAnything = (value: any) => {\n if (value === true || value === false) return true;\n if (value === null || value === undefined) return true;\n if (isNumber(value)) return value === 0;\n if (isDate(value)) return Number.isNaN(value.getTime());\n if (isFunction(value)) return false;\n if (isSymbol(value)) return false;\n const { length } = value;\n if (isNumber(length)) return length === 0;\n const { size } = value;\n if (isNumber(size)) return size === 0;\n const keys = Object.keys(value).length;\n\n return keys === 0;\n};\n","/* -------------------------------------------------------------------\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","/* -------------------------------------------------------------------\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 { isSet } from \"./is-set\";\nimport { isString } from \"./is-string\";\n\n/**\n * Determine if the type is string and is not empty (length greater than zero)\n *\n * @param value - The value to type check\n * @returns An indicator specifying if the value provided is of type `string` and length greater than zero\n */\nexport const isSetString = (value: unknown): value is NonNullable<string> => {\n try {\n return isSet(value) && isString(value) && value.length > 0;\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\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 { StormJSON } from \"@stryke/json/storm-json\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isInteger } from \"@stryke/type-checks/is-integer\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport type { ParsedURL } from \"ufo\";\nimport {\n cleanDoubleSlashes,\n decode as decodeURL,\n isEqual,\n isNonEmptyURL,\n isRelative,\n isSamePath,\n isScriptProtocol,\n normalizeURL,\n parseAuth,\n parseHost,\n parsePath,\n parseQuery,\n parseURL,\n stringifyParsedURL,\n stringifyQuery\n} from \"ufo\";\nimport { formatLocalePath, isValidURL } from \"./helpers\";\nimport type { StormURLInterface, StormURLOptions } from \"./types\";\n\n/**\n * A class used to build URLs\n *\n * @remarks\n * This class is used to build URLs with a fluent API.\n *\n * The [UFO](https://github.com/unjs/ufo) library is used under the hood to parse and stringify URLs.\n */\nexport class StormURL implements StormURLInterface, URL {\n #options: StormURLOptions;\n\n /**\n * A string containing the username specified before the domain name.\n */\n #username?: string;\n\n /**\n * A string containing the password specified before the domain name.\n */\n #password?: string;\n\n /**\n * A string containing the domain of the URL.\n */\n #hostname: string;\n\n /**\n * A string containing the port number of the URL.\n */\n #port?: string;\n\n /**\n * A string containing the protocol scheme of the URL, including the final `:`.\n */\n #protocol?: string;\n\n /**\n * The paths of the URL\n */\n #paths: string[] = [];\n\n /**\n * A string containing a `#` followed by the fragment identifier of the URL.\n */\n #hash: string;\n\n /**\n * The search parameters of the URL\n */\n #params: Record<string, any>;\n\n constructor(initialURL: string, options: StormURLOptions = { decode: true }) {\n if (initialURL && !isValidURL(initialURL)) {\n throw new TypeError(`Invalid URL: ${initialURL}`);\n }\n\n this.#options = options;\n\n const parsedURL = parseURL(\n this.#options.decode ? decodeURL(initialURL) : initialURL\n );\n\n const parsedAuth = parseAuth(parsedURL.auth);\n this.#username = parsedAuth.username;\n this.#password = parsedAuth.password;\n\n const parsedHost = parseHost(parsedURL.host);\n this.#hostname = parsedHost.hostname;\n this.#port = parsedHost.port;\n\n this.#protocol = parsedURL.protocol;\n this.#hash = parsedURL.hash || \"\";\n this.#params = parseQuery(parsedURL.search);\n\n this.#paths = parsedURL.pathname\n ? parsedURL.pathname.split(\"/\").filter(Boolean)\n : [];\n if (options.locale) {\n this.#paths.unshift(\n formatLocalePath(\n (isSetString(options.locale)\n ? options.locale\n : process.env.DEFAULT_LOCALE) || \"en-us\"\n )\n );\n }\n }\n\n public set params(value: Record<string, any>) {\n this.#params = value;\n }\n\n public get params(): Record<string, any> {\n return this.#params;\n }\n\n public get searchParams(): URLSearchParams {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(this.params)) {\n params.append(key, value);\n }\n return params;\n }\n\n public set searchParams(value: URLSearchParams) {\n this.params = Object.fromEntries(value.entries());\n }\n\n public set search(value: string) {\n this.params = parseQuery(value);\n }\n\n public get search(): string {\n const search = stringifyQuery(this.params);\n\n return search ? (search.startsWith(\"?\") ? search : `?${search}`) : \"\";\n }\n\n public set hash(value: string) {\n this.#hash = value.startsWith(\"#\") ? value : `#${value}`;\n }\n\n public get hash(): string {\n return this.#hash;\n }\n\n public set port(value: string | number) {\n this.#port = !isUndefined(value) && isInteger(value) ? `${value}` : \"\";\n }\n\n public get port(): string {\n return this.#port || \"\";\n }\n\n public set username(value: string) {\n this.auth = `${value}:${this.#password}`;\n }\n\n public get username(): string {\n return this.#username || \"\";\n }\n\n public set password(value: string) {\n this.auth = `${this.#username}:${value}`;\n }\n\n public get password(): string {\n return this.#password || \"\";\n }\n\n public set auth(value: string | undefined) {\n const parsedAuth = parseAuth(value);\n\n this.#username = parsedAuth.username;\n this.#password = parsedAuth.password;\n }\n\n public get auth(): string {\n return this.#username && this.#password\n ? `${this.#username}:${this.#password}`\n : this.#username\n ? this.#username\n : this.#password\n ? this.#password\n : \"\";\n }\n\n public set protocol(value: string) {\n this.#protocol = value.endsWith(\":\")\n ? value\n : value.endsWith(\"://\")\n ? value.slice(0, -2)\n : `${value}:`;\n }\n\n public get protocol(): string {\n return this.#protocol || this.#options.defaultProtocol || \"https:\";\n }\n\n public set hostname(value: string) {\n this.#hostname = value;\n }\n\n public get hostname(): string {\n return this.#hostname;\n }\n\n public set host(value: string | undefined) {\n const parsedHost = parseHost(value);\n this.#hostname = parsedHost.hostname;\n this.#port = parsedHost.port;\n }\n\n public get host(): string {\n return this.#hostname && this.#port\n ? `${this.#hostname}:${this.#port}`\n : this.#hostname\n ? this.#hostname\n : this.#port\n ? this.#port\n : \"\";\n }\n\n public set paths(value: any[]) {\n this.#paths = value.filter(Boolean);\n }\n\n public get paths(): any[] {\n return this.#paths;\n }\n\n public set pathname(value: string) {\n this.paths = cleanDoubleSlashes(value).split(\"/\");\n }\n\n public get pathname(): string {\n return `/${this.paths ? joinPaths(...this.paths.map(path => StormJSON.stringify(path))) : \"\"}`;\n }\n\n public set path(value: string) {\n const parsedPath = parsePath(value);\n this.pathname = parsedPath.pathname;\n this.search = parsedPath.search;\n this.#hash = parsedPath.hash;\n }\n\n public get path(): string {\n return stringifyParsedURL({\n pathname: this.pathname,\n search: this.search,\n hash: this.hash\n });\n }\n\n public get href(): string {\n return this.toString();\n }\n\n public set href(value: string) {\n const parsedURL = parseURL(value);\n this.protocol = parsedURL.protocol || this.protocol;\n this.auth = parsedURL.auth || this.auth;\n this.host = parsedURL.host || this.host;\n this.pathname = parsedURL.pathname || this.pathname;\n this.search = parsedURL.search || this.search;\n this.hash = parsedURL.hash || this.hash;\n }\n\n public get origin(): string {\n return `${this.protocol}//${this.host}`;\n }\n\n public get isScriptProtocol(): boolean {\n return isScriptProtocol(this.protocol);\n }\n\n public get isRelative(): boolean {\n return isRelative(this.toString());\n }\n\n public get isNonEmptyURL(): boolean {\n return isNonEmptyURL(this.toString());\n }\n\n // eslint-disable-next-line ts/naming-convention\n public get __typename() {\n return \"StormURL\";\n }\n\n public isSamePath(path: string): boolean {\n return isSamePath(this.path, path);\n }\n\n public isEqual(url: string | ParsedURL | StormURL): boolean {\n return isEqual(\n this.toString(),\n typeof url === \"string\"\n ? url\n : url instanceof StormURL\n ? url.toString()\n : stringifyParsedURL(url)\n );\n }\n\n public toParsed(): ParsedURL {\n return {\n protocol: this.protocol,\n auth: this.auth,\n host: this.host,\n pathname: this.pathname,\n search: this.search,\n hash: this.hash\n };\n }\n\n public toString(): string {\n return stringifyParsedURL(this.toParsed());\n }\n\n public toEncoded(): string {\n return normalizeURL(this.toString());\n }\n\n public toJSON(): string {\n return StormJSON.stringify(this.toParsed());\n }\n}\n\nStormJSON.instance.registerCustom<StormURL, string>(\n {\n isApplicable: (v): v is StormURL => v.__typename === \"StormURL\",\n serialize: v => v.toEncoded(),\n deserialize: v => new StormURL(v, { decode: true })\n },\n \"StormURL\"\n);\n"],"mappings":"ifAwBA,MAAa,EAAgB,GACvB,GAAS,KACJ,IAAU,IAAA,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Q,KAAK,KACnC,KAAK,SAAW,EAAU,UAAY,KAAK,SAC3C,KAAK,OAAS,EAAU,QAAU,KAAK,OACvC,KAAK,KAAO,EAAU,MAAQ,KAAK,KAGrC,IAAW,QAAiB,CAC1B,MAAO,GAAG,KAAK,SAAS,IAAI,KAAK,OAGnC,IAAW,kBAA4B,CACrC,OAAO,EAAiB,KAAK,SAAS,CAGxC,IAAW,YAAsB,CAC/B,OAAO,EAAW,KAAK,UAAU,CAAC,CAGpC,IAAW,eAAyB,CAClC,OAAO,EAAc,KAAK,UAAU,CAAC,CAIvC,IAAW,YAAa,CACtB,MAAO,WAGT,WAAkB,EAAuB,CACvC,OAAO,EAAW,KAAK,KAAM,EAAK,CAGpC,QAAe,EAA6C,CAC1D,OAAO,EACL,KAAK,UAAU,CACf,OAAO,GAAQ,SACX,EACA,aAAe,EACb,EAAI,UAAU,CACd,EAAmB,EAAI,CAC9B,CAGH,UAA6B,CAC3B,MAAO,CACL,SAAU,KAAK,SACf,KAAM,KAAK,KACX,KAAM,KAAK,KACX,SAAU,KAAK,SACf,OAAQ,KAAK,OACb,KAAM,KAAK,KACZ,CAGH,UAA0B,CACxB,OAAO,EAAmB,KAAK,UAAU,CAAC,CAG5C,WAA2B,CACzB,OAAO,EAAa,KAAK,UAAU,CAAC,CAGtC,QAAwB,CACtB,OAAO,EAAU,UAAU,KAAK,UAAU,CAAC,GAI/C,EAAU,SAAS,eACjB,CACE,aAAe,GAAqB,EAAE,aAAe,WACrD,UAAW,GAAK,EAAE,WAAW,CAC7B,YAAa,GAAK,IAAI,EAAS,EAAG,CAAE,OAAQ,GAAM,CAAC,CACpD,CACD,WACD"}
@@ -0,0 +1,6 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./helpers-C8s0XHG1.cjs`);let l=require(`jsonc-parser`),u=require(`node:buffer`),d=require(`superjson`);d=s(d);let f=require(`lines-and-columns`),p=require(`ufo`);const m=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e),h=e=>typeof e==`object`&&!!e,g=e=>{if(!h(e)||m(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},_=e=>{try{return typeof e==`object`||!!e&&e?.constructor===Object||g(e)}catch{return!1}},v=e=>{try{return typeof e==`string`}catch{return!1}},ee=``,y=Symbol(`singleComment`),b=Symbol(`multiComment`);function x(){return``}function S(e,t,n){return e.slice(t,n).replace(/\S/g,` `)}function C(e,t){let n=t-1,r=0;for(;e[n]===`\\`;)--n,r+=1;return!!(r%2)}function te(e,{whitespace:t=!0,trailingCommas:n=!1}={}){if(typeof e!=`string`)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof e}\``);let r=t?S:x,i=!1,a=!1,o=0,s=``,c=``,l=-1;for(let t=0;t<e.length;t++){let u=e[t],d=e[t+1];!a&&u===`"`&&(C(e,t)||(i=!i)),!i&&(!a&&u+(d??``)===`//`?(s+=e.slice(o,t),o=t,a=y,t++):a===y&&u+(d??``)===`\r
2
+ `?(t++,a=!1,s+=r(e,o,t),o=t):a===y&&u===`
3
+ `?(a=!1,s+=r(e,o,t),o=t):!a&&u+(d??``)===`/*`?(s+=e.slice(o,t),o=t,a=b,t++):a===b&&u+(d??``)===`*/`?(t++,a=!1,s+=r(e,o,t+1),o=t+1):n&&!a&&(l===-1?u===`,`&&(c+=s+e.slice(o,t),s=``,o=t,l=t):u===`}`||u===`]`?(s+=e.slice(o,t),c+=r(s,0,1)+s.slice(1),s=``,o=t,l=-1):u!==` `&&u!==` `&&u!==`\r`&&u!==`
4
+ `&&(s+=e.slice(o,t),o=t,l=-1)))}return c+s+(a?r(e.slice(o)):e.slice(o))}const w=/"(?:_|\\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*:/,T=/"(?: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*:/,E=/^\s*["[{]|^\s*-?\d{1,16}(?:\.\d{1,17})?(?:E[+-]?\d+)?\s*$/i;function D(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 O(e,t={}){if(typeof e!=`string`)return e;let n=te(e);if(n[0]===`"`&&n[n.length-1]===`"`&&!n.includes(`\\`))return n.slice(1,-1);if(n=n.trim(),n.length<=9)switch(n.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(!E.test(n)){if(t.strict)throw Error(`Invalid JSON`);return n}try{if(w.test(n)||T.test(n)){if(t.strict)throw Error(`Possible prototype pollution`);return JSON.parse(n,D)}return JSON.parse(n)}catch(n){if(t.strict)throw n;return e}}const k=/\r\n|[\n\r\u2028\u2029]/;function A(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 j(e,t,n={}){let{start:r,end:i,markerLines:a}=A(t,e.split(k),n),o=String(i).length;return(n.highlight?n.highlight(e):e).split(k).slice(r,i).map((e,t)=>{let n=r+1+t,i=` ${` ${n}`.slice(-o)} | `,s=!!(a[n]??!1);if(s){let t=``;if(Array.isArray(s)){let n=e.slice(0,Math.max(s[0]-1,0)).replace(/[^\t]/g,` `),r=s[1]||1;t=[`
5
+ `,i.replace(/\d/g,` `),n,`^`.repeat(r)].join(``)}return[`>`,i,e,t].join(``)}return` ${i}${e}`}).join(`
6
+ `)}function M(e,t){let{error:n,offset:r,length:i}=t,a=new f.LinesAndColumns(e).locationForIndex(r),o=a?.line??0,s=a?.column??0;return o++,s++,`${(0,l.printParseErrorCode)(n)} in JSON at ${o}:${s}\n${j(e,{start:{line:o,column:s},end:{line:o,column:s+i}})}\n`}const N=e=>{try{return e instanceof Number||typeof e==`number`||Number(e)===e}catch{return!1}},P=e=>e===void 0,F=`@/#$ :;,.!?&=+-*%^~|\\"'\`{}[]()<>`.split(``),I=(e,t=2)=>{let n=N(t)?` `.repeat(t):t;switch(e){case null:return`null`;case void 0:return`"undefined"`;case!0:return`true`;case!1:return`false`;case 1/0:return`infinity`;case-1/0:return`-infinity`}if(Array.isArray(e))return`[${n}${e.map(e=>I(e,n)).join(`,${n}`)}${n}]`;if(e instanceof Uint8Array)return e.toString();switch(typeof e){case`number`:return`${e}`;case`string`:return JSON.stringify(e);case`object`:return`{${n}${Object.keys(e).filter(t=>!P(e[t])).map(t=>`${F.some(e=>t.includes(e))?`"${t}"`:t}: ${n}${I(e[t],n)}`).join(`,${n}`)}${n}}`;default:return`null`}};var L=class e extends d.default{static#e;static get instance(){return e.#e||=new e,e.#e}static deserialize(t){return e.instance.deserialize(t)}static serialize(t){return e.instance.serialize(t)}static parse(e){return O(e)}static stringify(t,n){let r=e.instance.customTransformerRegistry.findApplicable(t),i=t;return r&&r.isApplicable(t)&&(i=r.serialize(i)),I(i)}static parseJson(t,n){try{if(n?.expectComments===!1)return e.instance.parse(t)}catch{}let r=[],i=(0,l.parse)(t,r,{allowTrailingComma:!0,...n});if(r.length>0&&r[0])throw Error(M(t,r[0]));return i}static register(t,n,r,i){e.instance.registerCustom({isApplicable:i,serialize:n,deserialize:r},t)}static registerClass(t,n){e.instance.registerClass(t,{identifier:v(n)?n:n?.identifier||t.name,allowProps:n&&_(n)&&n?.allowProps&&Array.isArray(n.allowProps)?n.allowProps:[`__typename`]})}constructor(){super({dedupe:!0})}};L.instance.registerCustom({isApplicable:e=>u.Buffer.isBuffer(e),serialize:e=>e.toString(`base64`),deserialize:e=>u.Buffer.from(e,`base64`)},`Bytes`);const R=/^[A-Z]:\//i,z=/^[A-Z]:$/i,B=/^[/\\]{2}/,V=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;function H(e){return e.startsWith(`\\\\?\\`)?e:e.replace(/\\/g,`/`)}function U(e){return V.test(H(e))}function W(e){return U(e)}function G(e=``){return e&&e.replace(/\\/g,`/`).replace(R,e=>e.toUpperCase())}function K(e){if(!e||e.length===0)return`.`;e=G(e);let t=e.match(B),n=W(e),r=e[e.length-1]===`/`;return e=J(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),z.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!W(e)?`/${e}`:e)}function q(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return K(t)}function J(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const Y=e=>!v(e)&&N(e)&&e%1==0,X=e=>{try{return e===null}catch{return!1}},Z=e=>{try{return P(e)||X(e)}catch{return!1}},Q=e=>{try{return!Z(e)}catch{return!1}},ne=e=>{try{return Q(e)&&v(e)&&e.length>0}catch{return!1}};var $=class e{#e;#t;#n;#r;#i;#a;#o=[];#s;#c;constructor(e,t={decode:!0}){if(e&&!c.n(e))throw TypeError(`Invalid URL: ${e}`);this.#e=t;let n=(0,p.parseURL)(this.#e.decode?(0,p.decode)(e):e),r=(0,p.parseAuth)(n.auth);this.#t=r.username,this.#n=r.password;let i=(0,p.parseHost)(n.host);this.#r=i.hostname,this.#i=i.port,this.#a=n.protocol,this.#s=n.hash||``,this.#c=(0,p.parseQuery)(n.search),this.#o=n.pathname?n.pathname.split(`/`).filter(Boolean):[],t.locale&&this.#o.unshift(c.t((ne(t.locale)?t.locale:process.env.DEFAULT_LOCALE)||`en-us`))}set params(e){this.#c=e}get params(){return this.#c}get searchParams(){let e=new URLSearchParams;for(let[t,n]of Object.entries(this.params))e.append(t,n);return e}set searchParams(e){this.params=Object.fromEntries(e.entries())}set search(e){this.params=(0,p.parseQuery)(e)}get search(){let e=(0,p.stringifyQuery)(this.params);return e?e.startsWith(`?`)?e:`?${e}`:``}set hash(e){this.#s=e.startsWith(`#`)?e:`#${e}`}get hash(){return this.#s}set port(e){this.#i=!P(e)&&Y(e)?`${e}`:``}get port(){return this.#i||``}set username(e){this.auth=`${e}:${this.#n}`}get username(){return this.#t||``}set password(e){this.auth=`${this.#t}:${e}`}get password(){return this.#n||``}set auth(e){let t=(0,p.parseAuth)(e);this.#t=t.username,this.#n=t.password}get auth(){return this.#t&&this.#n?`${this.#t}:${this.#n}`:this.#t?this.#t:this.#n?this.#n:``}set protocol(e){this.#a=e.endsWith(`:`)?e:e.endsWith(`://`)?e.slice(0,-2):`${e}:`}get protocol(){return this.#a||this.#e.defaultProtocol||`https:`}set hostname(e){this.#r=e}get hostname(){return this.#r}set host(e){let t=(0,p.parseHost)(e);this.#r=t.hostname,this.#i=t.port}get host(){return this.#r&&this.#i?`${this.#r}:${this.#i}`:this.#r?this.#r:this.#i?this.#i:``}set paths(e){this.#o=e.filter(Boolean)}get paths(){return this.#o}set pathname(e){this.paths=(0,p.cleanDoubleSlashes)(e).split(`/`)}get pathname(){return`/${this.paths?q(...this.paths.map(e=>L.stringify(e))):``}`}set path(e){let t=(0,p.parsePath)(e);this.pathname=t.pathname,this.search=t.search,this.#s=t.hash}get path(){return(0,p.stringifyParsedURL)({pathname:this.pathname,search:this.search,hash:this.hash})}get href(){return this.toString()}set href(e){let t=(0,p.parseURL)(e);this.protocol=t.protocol||this.protocol,this.auth=t.auth||this.auth,this.host=t.host||this.host,this.pathname=t.pathname||this.pathname,this.search=t.search||this.search,this.hash=t.hash||this.hash}get origin(){return`${this.protocol}//${this.host}`}get isScriptProtocol(){return(0,p.isScriptProtocol)(this.protocol)}get isRelative(){return(0,p.isRelative)(this.toString())}get isNonEmptyURL(){return(0,p.isNonEmptyURL)(this.toString())}get __typename(){return`StormURL`}isSamePath(e){return(0,p.isSamePath)(this.path,e)}isEqual(t){return(0,p.isEqual)(this.toString(),typeof t==`string`?t:t instanceof e?t.toString():(0,p.stringifyParsedURL)(t))}toParsed(){return{protocol:this.protocol,auth:this.auth,host:this.host,pathname:this.pathname,search:this.search,hash:this.hash}}toString(){return(0,p.stringifyParsedURL)(this.toParsed())}toEncoded(){return(0,p.normalizeURL)(this.toString())}toJSON(){return L.stringify(this.toParsed())}};L.instance.registerCustom({isApplicable:e=>e.__typename===`StormURL`,serialize:e=>e.toEncoded(),deserialize:e=>new $(e,{decode:!0})},`StormURL`),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return $}});
@@ -1,184 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.StormURL = void 0;
7
- var _stormJson = require("@stryke/json/storm-json");
8
- var _joinPaths = require("@stryke/path/join-paths");
9
- var _isInteger = require("@stryke/type-checks/is-integer");
10
- var _isSetString = require("@stryke/type-checks/is-set-string");
11
- var _isUndefined = require("@stryke/type-checks/is-undefined");
12
- var _ufo = require("ufo");
13
- var _helpers = require("./helpers.cjs");
14
- class StormURL {
15
- #a;
16
- #t;
17
- #s;
18
- #r;
19
- #i;
20
- #o;
21
- #e = [];
22
- #h;
23
- #n;
24
- constructor(t, s = {
25
- decode: !0
26
- }) {
27
- if (t && !(0, _helpers.isValidURL)(t)) throw new TypeError(`Invalid URL: ${t}`);
28
- this.#a = s;
29
- const r = (0, _ufo.parseURL)(this.#a.decode ? (0, _ufo.decode)(t) : t),
30
- a = (0, _ufo.parseAuth)(r.auth);
31
- this.#t = a.username, this.#s = a.password;
32
- const o = (0, _ufo.parseHost)(r.host);
33
- this.#r = o.hostname, this.#i = o.port, this.#o = r.protocol, this.#h = r.hash || "", this.#n = (0, _ufo.parseQuery)(r.search), this.#e = r.pathname ? r.pathname.split("/").filter(Boolean) : [], s.locale && this.#e.unshift((0, _helpers.formatLocalePath)(((0, _isSetString.isSetString)(s.locale) ? s.locale : process.env.DEFAULT_LOCALE) || "en-us"));
34
- }
35
- set params(t) {
36
- this.#n = t;
37
- }
38
- get params() {
39
- return this.#n;
40
- }
41
- get searchParams() {
42
- const t = new URLSearchParams();
43
- for (const [s, r] of Object.entries(this.params)) t.append(s, r);
44
- return t;
45
- }
46
- set searchParams(t) {
47
- this.params = Object.fromEntries(t.entries());
48
- }
49
- set search(t) {
50
- this.params = (0, _ufo.parseQuery)(t);
51
- }
52
- get search() {
53
- const t = (0, _ufo.stringifyQuery)(this.params);
54
- return t ? t.startsWith("?") ? t : `?${t}` : "";
55
- }
56
- set hash(t) {
57
- this.#h = t.startsWith("#") ? t : `#${t}`;
58
- }
59
- get hash() {
60
- return this.#h;
61
- }
62
- set port(t) {
63
- this.#i = !(0, _isUndefined.isUndefined)(t) && (0, _isInteger.isInteger)(t) ? `${t}` : "";
64
- }
65
- get port() {
66
- return this.#i || "";
67
- }
68
- set username(t) {
69
- this.auth = `${t}:${this.#s}`;
70
- }
71
- get username() {
72
- return this.#t || "";
73
- }
74
- set password(t) {
75
- this.auth = `${this.#t}:${t}`;
76
- }
77
- get password() {
78
- return this.#s || "";
79
- }
80
- set auth(t) {
81
- const s = (0, _ufo.parseAuth)(t);
82
- this.#t = s.username, this.#s = s.password;
83
- }
84
- get auth() {
85
- return this.#t && this.#s ? `${this.#t}:${this.#s}` : this.#t ? this.#t : this.#s ? this.#s : "";
86
- }
87
- set protocol(t) {
88
- this.#o = t.endsWith(":") ? t : t.endsWith("://") ? t.slice(0, -2) : `${t}:`;
89
- }
90
- get protocol() {
91
- return this.#o || this.#a.defaultProtocol || "https:";
92
- }
93
- set hostname(t) {
94
- this.#r = t;
95
- }
96
- get hostname() {
97
- return this.#r;
98
- }
99
- set host(t) {
100
- const s = (0, _ufo.parseHost)(t);
101
- this.#r = s.hostname, this.#i = s.port;
102
- }
103
- get host() {
104
- return this.#r && this.#i ? `${this.#r}:${this.#i}` : this.#r ? this.#r : this.#i ? this.#i : "";
105
- }
106
- set paths(t) {
107
- this.#e = t.filter(Boolean);
108
- }
109
- get paths() {
110
- return this.#e;
111
- }
112
- set pathname(t) {
113
- this.paths = (0, _ufo.cleanDoubleSlashes)(t).split("/");
114
- }
115
- get pathname() {
116
- return `/${this.paths ? (0, _joinPaths.joinPaths)(...this.paths.map(t => _stormJson.StormJSON.stringify(t))) : ""}`;
117
- }
118
- set path(t) {
119
- const s = (0, _ufo.parsePath)(t);
120
- this.pathname = s.pathname, this.search = s.search, this.#h = s.hash;
121
- }
122
- get path() {
123
- return (0, _ufo.stringifyParsedURL)({
124
- pathname: this.pathname,
125
- search: this.search,
126
- hash: this.hash
127
- });
128
- }
129
- get href() {
130
- return this.toString();
131
- }
132
- set href(t) {
133
- const s = (0, _ufo.parseURL)(t);
134
- this.protocol = s.protocol || this.protocol, this.auth = s.auth || this.auth, this.host = s.host || this.host, this.pathname = s.pathname || this.pathname, this.search = s.search || this.search, this.hash = s.hash || this.hash;
135
- }
136
- get origin() {
137
- return `${this.protocol}//${this.host}`;
138
- }
139
- get isScriptProtocol() {
140
- return (0, _ufo.isScriptProtocol)(this.protocol);
141
- }
142
- get isRelative() {
143
- return (0, _ufo.isRelative)(this.toString());
144
- }
145
- get isNonEmptyURL() {
146
- return (0, _ufo.isNonEmptyURL)(this.toString());
147
- }
148
- get __typename() {
149
- return "StormURL";
150
- }
151
- isSamePath(t) {
152
- return (0, _ufo.isSamePath)(this.path, t);
153
- }
154
- isEqual(t) {
155
- return (0, _ufo.isEqual)(this.toString(), typeof t == "string" ? t : t instanceof StormURL ? t.toString() : (0, _ufo.stringifyParsedURL)(t));
156
- }
157
- toParsed() {
158
- return {
159
- protocol: this.protocol,
160
- auth: this.auth,
161
- host: this.host,
162
- pathname: this.pathname,
163
- search: this.search,
164
- hash: this.hash
165
- };
166
- }
167
- toString() {
168
- return (0, _ufo.stringifyParsedURL)(this.toParsed());
169
- }
170
- toEncoded() {
171
- return (0, _ufo.normalizeURL)(this.toString());
172
- }
173
- toJSON() {
174
- return _stormJson.StormJSON.stringify(this.toParsed());
175
- }
176
- }
177
- exports.StormURL = StormURL;
178
- _stormJson.StormJSON.instance.registerCustom({
179
- isApplicable: i => i.__typename === "StormURL",
180
- serialize: i => i.toEncoded(),
181
- deserialize: i => new StormURL(i, {
182
- decode: !0
183
- })
184
- }, "StormURL");
1
+ const e=require(`./storm-url-t7pdfQNU.cjs`);exports.StormURL=e.t;
@@ -0,0 +1,2 @@
1
+ import { t as StormURL } from "./storm-url-BeaSjjni.cjs";
2
+ export { StormURL };
@@ -0,0 +1,2 @@
1
+ import { t as StormURL } from "./storm-url-C44M08EF.mjs";
2
+ export { StormURL };
@@ -1 +1 @@
1
- import{StormJSON as e}from"@stryke/json/storm-json";import{joinPaths as m}from"@stryke/path/join-paths";import{isInteger as g}from"@stryke/type-checks/is-integer";import{isSetString as l}from"@stryke/type-checks/is-set-string";import{isUndefined as b}from"@stryke/type-checks/is-undefined";import{cleanDoubleSlashes as d,decode as f,isEqual as S,isNonEmptyURL as R,isRelative as L,isSamePath as U,isScriptProtocol as y,normalizeURL as P,parseAuth as n,parseHost as p,parsePath as $,parseQuery as c,parseURL as u,stringifyParsedURL as h,stringifyQuery as E}from"ufo";import{formatLocalePath as w,isValidURL as O}from"./helpers";export class StormURL{#a;#t;#s;#r;#i;#o;#e=[];#h;#n;constructor(t,s={decode:!0}){if(t&&!O(t))throw new TypeError(`Invalid URL: ${t}`);this.#a=s;const r=u(this.#a.decode?f(t):t),a=n(r.auth);this.#t=a.username,this.#s=a.password;const o=p(r.host);this.#r=o.hostname,this.#i=o.port,this.#o=r.protocol,this.#h=r.hash||"",this.#n=c(r.search),this.#e=r.pathname?r.pathname.split("/").filter(Boolean):[],s.locale&&this.#e.unshift(w((l(s.locale)?s.locale:process.env.DEFAULT_LOCALE)||"en-us"))}set params(t){this.#n=t}get params(){return this.#n}get searchParams(){const t=new URLSearchParams;for(const[s,r]of Object.entries(this.params))t.append(s,r);return t}set searchParams(t){this.params=Object.fromEntries(t.entries())}set search(t){this.params=c(t)}get search(){const t=E(this.params);return t?t.startsWith("?")?t:`?${t}`:""}set hash(t){this.#h=t.startsWith("#")?t:`#${t}`}get hash(){return this.#h}set port(t){this.#i=!b(t)&&g(t)?`${t}`:""}get port(){return this.#i||""}set username(t){this.auth=`${t}:${this.#s}`}get username(){return this.#t||""}set password(t){this.auth=`${this.#t}:${t}`}get password(){return this.#s||""}set auth(t){const s=n(t);this.#t=s.username,this.#s=s.password}get auth(){return this.#t&&this.#s?`${this.#t}:${this.#s}`:this.#t?this.#t:this.#s?this.#s:""}set protocol(t){this.#o=t.endsWith(":")?t:t.endsWith("://")?t.slice(0,-2):`${t}:`}get protocol(){return this.#o||this.#a.defaultProtocol||"https:"}set hostname(t){this.#r=t}get hostname(){return this.#r}set host(t){const s=p(t);this.#r=s.hostname,this.#i=s.port}get host(){return this.#r&&this.#i?`${this.#r}:${this.#i}`:this.#r?this.#r:this.#i?this.#i:""}set paths(t){this.#e=t.filter(Boolean)}get paths(){return this.#e}set pathname(t){this.paths=d(t).split("/")}get pathname(){return`/${this.paths?m(...this.paths.map(t=>e.stringify(t))):""}`}set path(t){const s=$(t);this.pathname=s.pathname,this.search=s.search,this.#h=s.hash}get path(){return h({pathname:this.pathname,search:this.search,hash:this.hash})}get href(){return this.toString()}set href(t){const s=u(t);this.protocol=s.protocol||this.protocol,this.auth=s.auth||this.auth,this.host=s.host||this.host,this.pathname=s.pathname||this.pathname,this.search=s.search||this.search,this.hash=s.hash||this.hash}get origin(){return`${this.protocol}//${this.host}`}get isScriptProtocol(){return y(this.protocol)}get isRelative(){return L(this.toString())}get isNonEmptyURL(){return R(this.toString())}get __typename(){return"StormURL"}isSamePath(t){return U(this.path,t)}isEqual(t){return S(this.toString(),typeof t=="string"?t:t instanceof StormURL?t.toString():h(t))}toParsed(){return{protocol:this.protocol,auth:this.auth,host:this.host,pathname:this.pathname,search:this.search,hash:this.hash}}toString(){return h(this.toParsed())}toEncoded(){return P(this.toString())}toJSON(){return e.stringify(this.toParsed())}}e.instance.registerCustom({isApplicable:i=>i.__typename==="StormURL",serialize:i=>i.toEncoded(),deserialize:i=>new StormURL(i,{decode:!0})},"StormURL");
1
+ import{t as e}from"./storm-url-DQn2usO1.mjs";export{e as StormURL};
@@ -0,0 +1,94 @@
1
+ //#region src/types.d.ts
2
+ interface StormURLOptions {
3
+ /**
4
+ * Should the URL be decoded
5
+ *
6
+ * @defaultValue `true`
7
+ */
8
+ decode?: boolean;
9
+ /**
10
+ * Should the URL include a locale path segment
11
+ */
12
+ locale?: string | true;
13
+ /**
14
+ * The default protocol to use
15
+ *
16
+ * @defaultValue "https"
17
+ */
18
+ defaultProtocol?: string;
19
+ }
20
+ declare const PROTOCOL_RELATIVE_SYMBOL: unique symbol;
21
+ interface StormURLInterface extends URL {
22
+ /**
23
+ * A string containing the username and password specified before the domain name.
24
+ */
25
+ auth: string;
26
+ /**
27
+ * A string containing the username specified before the domain name.
28
+ */
29
+ username: string;
30
+ /**
31
+ * A string containing the password specified before the domain name.
32
+ */
33
+ password: string;
34
+ /**
35
+ * A string containing the domain (that is the hostname) followed by (if a port was specified) a `:` and the port of the URL.
36
+ */
37
+ host: string;
38
+ /**
39
+ * A string containing the domain of the URL.
40
+ */
41
+ hostname: string;
42
+ /**
43
+ * A string containing the port number of the URL.
44
+ */
45
+ port: string;
46
+ /**
47
+ * A string containing the protocol scheme of the URL, including the final `:`.
48
+ */
49
+ protocol: string;
50
+ /**
51
+ * A stringified value that returns the whole URL.
52
+ */
53
+ href: string;
54
+ /**
55
+ * A string containing an initial `/` followed by the path of the URL, not including the query string or fragment.
56
+ */
57
+ pathname: string;
58
+ /**
59
+ * The paths of the URL
60
+ */
61
+ paths: any[];
62
+ /**
63
+ * A string containing a `#` followed by the fragment identifier of the URL.
64
+ */
65
+ hash: string;
66
+ /**
67
+ * A string indicating the URL's parameter string; if any parameters are provided, this string includes all of them, beginning with the leading `?` character.
68
+ */
69
+ search: string;
70
+ /**
71
+ * The search parameters of the URL
72
+ *
73
+ * @remarks
74
+ * This is a `URLSearchParams` object that contains the search parameters of the URL.
75
+ */
76
+ searchParams: URLSearchParams;
77
+ /**
78
+ * The search parameters of the URL
79
+ *
80
+ * @remarks
81
+ * This is a Record\<string, any\> object that contains the search parameters of the URL.
82
+ */
83
+ params: Record<string, any>;
84
+ /**
85
+ * An optional symbol to indicate that the URL is protocol-relative
86
+ *
87
+ * @remarks
88
+ * This is used when the URL is protocol-relative (e.g. //example.com)
89
+ */
90
+ [PROTOCOL_RELATIVE_SYMBOL]?: boolean;
91
+ }
92
+ //#endregion
93
+ export { StormURLInterface as n, StormURLOptions as r, PROTOCOL_RELATIVE_SYMBOL as t };
94
+ //# sourceMappingURL=types-CHTfZzkO.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-CHTfZzkO.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";UAkBiB,eAAA;EAAA;AAqBjB;AAGA;;;EAmFG,MAAA,CAAA,EAAA,OAAA;EAnFwC;;;;;;;;;;;cAH9B;UAGI,iBAAA,SAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAmE3B;;;;;;;UAQN;;;;;;;GAQP,wBAAA"}
@@ -0,0 +1 @@
1
+ const e=Symbol(`protocol-relative`);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
@@ -0,0 +1,2 @@
1
+ const e=Symbol(`protocol-relative`);export{e as t};
2
+ //# sourceMappingURL=types-DL1n5nYV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DL1n5nYV.mjs","names":["PROTOCOL_RELATIVE_SYMBOL: unique symbol"],"sources":["../src/types.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 interface StormURLOptions {\n /**\n * Should the URL be decoded\n *\n * @defaultValue `true`\n */\n decode?: boolean;\n\n /**\n * Should the URL include a locale path segment\n */\n locale?: string | true;\n\n /**\n * The default protocol to use\n *\n * @defaultValue \"https\"\n */\n defaultProtocol?: string;\n}\n\nexport const PROTOCOL_RELATIVE_SYMBOL: unique symbol =\n Symbol(\"protocol-relative\");\n\nexport interface StormURLInterface extends URL {\n /**\n * A string containing the username and password specified before the domain name.\n */\n auth: string;\n\n /**\n * A string containing the username specified before the domain name.\n */\n username: string;\n\n /**\n * A string containing the password specified before the domain name.\n */\n password: string;\n\n /**\n * A string containing the domain (that is the hostname) followed by (if a port was specified) a `:` and the port of the URL.\n */\n host: string;\n\n /**\n * A string containing the domain of the URL.\n */\n hostname: string;\n\n /**\n * A string containing the port number of the URL.\n */\n port: string;\n\n /**\n * A string containing the protocol scheme of the URL, including the final `:`.\n */\n protocol: string;\n\n /**\n * A stringified value that returns the whole URL.\n */\n href: string;\n\n /**\n * A string containing an initial `/` followed by the path of the URL, not including the query string or fragment.\n */\n pathname: string;\n\n /**\n * The paths of the URL\n */\n paths: any[];\n\n /**\n * A string containing a `#` followed by the fragment identifier of the URL.\n */\n hash: string;\n\n /**\n * A string indicating the URL's parameter string; if any parameters are provided, this string includes all of them, beginning with the leading `?` character.\n */\n search: string;\n\n /**\n * The search parameters of the URL\n *\n * @remarks\n * This is a `URLSearchParams` object that contains the search parameters of the URL.\n */\n searchParams: URLSearchParams;\n\n /**\n * The search parameters of the URL\n *\n * @remarks\n * This is a Record\\<string, any\\> object that contains the search parameters of the URL.\n */\n params: Record<string, any>;\n\n /**\n * An optional symbol to indicate that the URL is protocol-relative\n *\n * @remarks\n * This is used when the URL is protocol-relative (e.g. //example.com)\n */\n [PROTOCOL_RELATIVE_SYMBOL]?: boolean;\n}\n"],"mappings":"AAuCA,MAAaA,EACX,OAAO,oBAAoB"}