@stryke/path 0.21.6 → 0.22.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +735 -0
- package/README.md +28 -22
- package/dist/append-BWRdnlxE.cjs +1 -0
- package/dist/{append.d.ts → append-DfRQvWY6.d.cts} +7 -3
- package/dist/append-DfRQvWY6.d.cts.map +1 -0
- package/dist/append-tFFvRN-V.d.mts +38 -0
- package/dist/append-tFFvRN-V.d.mts.map +1 -0
- package/dist/append-xQ5toDGS.mjs +2 -0
- package/dist/append-xQ5toDGS.mjs.map +1 -0
- package/dist/append.cjs +1 -19
- package/dist/append.d.cts +2 -0
- package/dist/append.d.mts +2 -0
- package/dist/append.mjs +1 -1
- package/dist/asset-extensions-BFW_s97B.mjs +2 -0
- package/dist/asset-extensions-BFW_s97B.mjs.map +1 -0
- package/dist/{asset-extensions.d.ts → asset-extensions-D-_39huh.d.cts} +5 -1
- package/dist/asset-extensions-D-_39huh.d.cts.map +1 -0
- package/dist/asset-extensions-DNMkK37t.cjs +1 -0
- package/dist/asset-extensions-DlN384ac.d.mts +11 -0
- package/dist/asset-extensions-DlN384ac.d.mts.map +1 -0
- package/dist/asset-extensions.cjs +1 -7
- package/dist/asset-extensions.d.cts +2 -0
- package/dist/asset-extensions.d.mts +2 -0
- package/dist/asset-extensions.mjs +1 -1
- package/dist/correct-path-B0Y_kOkW.cjs +1 -0
- package/dist/{correct-path.d.ts → correct-path-CwHhpk6I.d.cts} +11 -7
- package/dist/correct-path-CwHhpk6I.d.cts.map +1 -0
- package/dist/correct-path-DmaZHNUF.mjs +2 -0
- package/dist/correct-path-DmaZHNUF.mjs.map +1 -0
- package/dist/correct-path-LC5QqYV-.d.mts +59 -0
- package/dist/correct-path-LC5QqYV-.d.mts.map +1 -0
- package/dist/correct-path.cjs +1 -75
- package/dist/correct-path.d.cts +2 -0
- package/dist/correct-path.d.mts +2 -0
- package/dist/correct-path.mjs +1 -1
- package/dist/{cwd.d.ts → cwd-Bt4NcS-v.d.cts} +5 -1
- package/dist/cwd-Bt4NcS-v.d.cts.map +1 -0
- package/dist/cwd-D66SsPHE.cjs +1 -0
- package/dist/cwd-Dx53cgUn.d.mts +13 -0
- package/dist/cwd-Dx53cgUn.d.mts.map +1 -0
- package/dist/cwd-DxrPG9WB.mjs +2 -0
- package/dist/cwd-DxrPG9WB.mjs.map +1 -0
- package/dist/cwd.cjs +1 -9
- package/dist/cwd.d.cts +2 -0
- package/dist/cwd.d.mts +2 -0
- package/dist/cwd.mjs +1 -1
- package/dist/delimiter-B3nWo9Xn.mjs +2 -0
- package/dist/delimiter-B3nWo9Xn.mjs.map +1 -0
- package/dist/delimiter-BwyCEwu9.d.cts +22 -0
- package/dist/delimiter-BwyCEwu9.d.cts.map +1 -0
- package/dist/delimiter-DuDX7fvN.d.mts +22 -0
- package/dist/delimiter-DuDX7fvN.d.mts.map +1 -0
- package/dist/delimiter-IA9U4fxC.cjs +1 -0
- package/dist/delimiter.cjs +1 -18
- package/dist/delimiter.d.cts +2 -0
- package/dist/delimiter.d.mts +2 -0
- package/dist/delimiter.mjs +1 -1
- package/dist/file-path-fns-B9hKjfA-.cjs +1 -0
- package/dist/{file-path-fns.d.ts → file-path-fns-BKbfZRTB.d.mts} +46 -40
- package/dist/file-path-fns-BKbfZRTB.d.mts.map +1 -0
- package/dist/file-path-fns-CTLJP4j9.d.cts +218 -0
- package/dist/file-path-fns-CTLJP4j9.d.cts.map +1 -0
- package/dist/file-path-fns-MRI3PV8K.mjs +2 -0
- package/dist/file-path-fns-MRI3PV8K.mjs.map +1 -0
- package/dist/file-path-fns.cjs +1 -150
- package/dist/file-path-fns.d.cts +2 -0
- package/dist/file-path-fns.d.mts +2 -0
- package/dist/file-path-fns.mjs +1 -1
- package/dist/find.cjs +1 -16
- package/dist/find.d.cts +2 -0
- package/dist/find.d.mts +2 -0
- package/dist/find.mjs +1 -1
- package/dist/index.cjs +1 -148
- package/dist/index.d.cts +14 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.mjs +1 -1
- package/dist/{is-parent-path.d.ts → is-parent-path-B1EPPZ08.d.cts} +5 -1
- package/dist/is-parent-path-B1EPPZ08.d.cts.map +1 -0
- package/dist/is-parent-path-BW6CsB2o.d.mts +26 -0
- package/dist/is-parent-path-BW6CsB2o.d.mts.map +1 -0
- package/dist/is-parent-path-C0Azmjnd.mjs +2 -0
- package/dist/is-parent-path-C0Azmjnd.mjs.map +1 -0
- package/dist/is-parent-path-ChIi6oAO.cjs +1 -0
- package/dist/is-parent-path.cjs +1 -12
- package/dist/is-parent-path.d.cts +2 -0
- package/dist/is-parent-path.d.mts +2 -0
- package/dist/is-parent-path.mjs +1 -1
- package/dist/is-root-dir-BzQKuwi2.cjs +1 -0
- package/dist/{is-root-dir.d.ts → is-root-dir-CQA1qNI-.d.mts} +5 -1
- package/dist/is-root-dir-CQA1qNI-.d.mts.map +1 -0
- package/dist/is-root-dir-DI5qcnLw.mjs +2 -0
- package/dist/is-root-dir-DI5qcnLw.mjs.map +1 -0
- package/dist/is-root-dir-DnWZlIgB.d.cts +11 -0
- package/dist/is-root-dir-DnWZlIgB.d.cts.map +1 -0
- package/dist/is-root-dir.cjs +1 -9
- package/dist/is-root-dir.d.cts +2 -0
- package/dist/is-root-dir.d.mts +2 -0
- package/dist/is-root-dir.mjs +1 -1
- package/dist/is-type.cjs +1 -31
- package/dist/{is-type.d.ts → is-type.d.cts} +10 -6
- package/dist/is-type.d.cts.map +1 -0
- package/dist/is-type.d.mts +72 -0
- package/dist/is-type.d.mts.map +1 -0
- package/dist/is-type.mjs +1 -1
- package/dist/join-paths-BLjJ0GmK.mjs +2 -0
- package/dist/join-paths-BLjJ0GmK.mjs.map +1 -0
- package/dist/{join-paths.d.ts → join-paths-Bklwf_Bh.d.mts} +6 -2
- package/dist/join-paths-Bklwf_Bh.d.mts.map +1 -0
- package/dist/join-paths-DBTcCEw0.d.cts +13 -0
- package/dist/join-paths-DBTcCEw0.d.cts.map +1 -0
- package/dist/join-paths-hCBPtGlC.cjs +1 -0
- package/dist/join-paths.cjs +1 -60
- package/dist/join-paths.d.cts +2 -0
- package/dist/join-paths.d.mts +2 -0
- package/dist/join-paths.mjs +1 -1
- package/dist/join.cjs +1 -16
- package/dist/join.d.cts +2 -0
- package/dist/join.d.mts +2 -0
- package/dist/join.mjs +1 -1
- package/dist/normalize.cjs +1 -16
- package/dist/normalize.d.cts +2 -0
- package/dist/normalize.d.mts +2 -0
- package/dist/normalize.mjs +1 -1
- package/dist/regex-BEjSq2wo.cjs +1 -0
- package/dist/regex-DHvK8l1E.d.cts +12 -0
- package/dist/regex-DHvK8l1E.d.cts.map +1 -0
- package/dist/regex-fq9t8ABF.d.mts +12 -0
- package/dist/regex-fq9t8ABF.d.mts.map +1 -0
- package/dist/regex-hMUNHeGK.mjs +2 -0
- package/dist/regex-hMUNHeGK.mjs.map +1 -0
- package/dist/regex.cjs +1 -14
- package/dist/regex.d.cts +2 -0
- package/dist/regex.d.mts +2 -0
- package/dist/regex.mjs +1 -1
- package/dist/{replace.d.ts → replace-0nP9MPWp.d.cts} +6 -2
- package/dist/replace-0nP9MPWp.d.cts.map +1 -0
- package/dist/replace-C570sho0.cjs +1 -0
- package/dist/replace-C9dh7bEG.mjs +2 -0
- package/dist/replace-C9dh7bEG.mjs.map +1 -0
- package/dist/replace-fEEM12P3.d.mts +34 -0
- package/dist/replace-fEEM12P3.d.mts.map +1 -0
- package/dist/replace.cjs +1 -17
- package/dist/replace.d.cts +2 -0
- package/dist/replace.d.mts +2 -0
- package/dist/replace.mjs +1 -1
- package/dist/resolve-parent-path-5B4YvR_k.mjs +2 -0
- package/dist/resolve-parent-path-5B4YvR_k.mjs.map +1 -0
- package/dist/resolve-parent-path-D5uwbjqj.d.mts +12 -0
- package/dist/resolve-parent-path-D5uwbjqj.d.mts.map +1 -0
- package/dist/resolve-parent-path-DIrSH2oN.cjs +1 -0
- package/dist/resolve-parent-path-oZQZf2nw.d.cts +12 -0
- package/dist/resolve-parent-path-oZQZf2nw.d.cts.map +1 -0
- package/dist/resolve-parent-path.cjs +1 -13
- package/dist/resolve-parent-path.d.cts +2 -0
- package/dist/resolve-parent-path.d.mts +2 -0
- package/dist/resolve-parent-path.mjs +1 -1
- package/dist/slash-C7xRDucF.mjs +2 -0
- package/dist/slash-C7xRDucF.mjs.map +1 -0
- package/dist/{slash.d.ts → slash-CuA7ERRf.d.mts} +6 -2
- package/dist/slash-CuA7ERRf.d.mts.map +1 -0
- package/dist/slash-DPd6cWOz.d.cts +18 -0
- package/dist/slash-DPd6cWOz.d.cts.map +1 -0
- package/dist/slash-DhzW1Om-.cjs +1 -0
- package/dist/slash.cjs +1 -15
- package/dist/slash.d.cts +2 -0
- package/dist/slash.d.mts +2 -0
- package/dist/slash.mjs +1 -1
- package/package.json +55 -258
- package/dist/delimiter.d.ts +0 -18
- package/dist/find.d.ts +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/join.d.ts +0 -1
- package/dist/normalize.d.ts +0 -1
- package/dist/regex.d.ts +0 -8
- package/dist/resolve-parent-path.d.ts +0 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-path-fns-MRI3PV8K.mjs","names":["currentDir","path","cwd"],"sources":["../../type-checks/src/is-null.ts","../../type-checks/src/is-undefined.ts","../../type-checks/src/is-empty.ts","../../type-checks/src/is-set.ts","../../type-checks/src/is-string.ts","../../type-checks/src/is-set-string.ts","../../types/src/base.ts","../src/file-path-fns.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const isNull = (value: unknown): value is null => {\n try {\n return value === null;\n } catch {\n return false;\n }\n};\n","/* -------------------------------------------------------------------\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 { 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\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 { 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 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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { EMPTY_STRING } from \"@stryke/types/base\";\nimport { normalizeString, normalizeWindowsPath } from \"./correct-path\";\nimport { cwd as currentDir } from \"./cwd\";\nimport { isAbsolute, isAbsolutePath } from \"./is-type\";\nimport { joinPaths } from \"./join-paths\";\nimport { FILE_EXTENSION_REGEX, ROOT_FOLDER_REGEX } from \"./regex\";\n\nexport interface FindFileNameOptions {\n /**\n * Require the file extension to be present in the file name.\n *\n * @defaultValue false\n */\n requireExtension?: boolean;\n\n /**\n * Return the file extension as part of the full file name result.\n *\n * @defaultValue true\n */\n withExtension?: boolean;\n}\n\n/**\n * Find the file name from a file path.\n *\n * @example\n * ```ts\n * const fileName = findFileName(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // fileName = \"file.txt\"\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file name\n */\nexport function findFileName(\n filePath: string,\n options: FindFileNameOptions = {}\n): string {\n const { requireExtension = false, withExtension = true } = options;\n const result =\n normalizeWindowsPath(filePath)\n ?.split(filePath?.includes(\"\\\\\") ? \"\\\\\" : \"/\")\n ?.pop() ?? \"\";\n\n if (requireExtension === true && !result.includes(\".\")) {\n return EMPTY_STRING;\n }\n\n if (withExtension === false && result.includes(\".\")) {\n return (\n result.replace(`.${findFileExtension(result) ?? \"\"}`, \"\") || EMPTY_STRING\n );\n }\n\n return result;\n}\n\n/**\n * Find the full file path's directories from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link path.dirname} function in Node's path module.\n *\n * @example\n * ```ts\n * const folderPath = findFilePath(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // folderPath = \"C:\\\\Users\\\\user\\\\Documents\"\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The full file path's directories\n */\nexport function findFilePath(\n filePath: string,\n options: FindFileNameOptions = {}\n): string {\n const normalizedPath = normalizeWindowsPath(filePath);\n\n const result = normalizedPath.replace(\n findFileName(normalizedPath, { requireExtension: false, ...options }),\n \"\"\n );\n\n return result === \"/\" ? result : result.replace(/\\/$/, \"\");\n}\n\nexport const dirname = findFilePath;\n\n/**\n * Find the top most folder containing the file from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link path.basename} function in Node's path module.\n * If you're looking for the full path of the folder (for example: `C:\\\\Users\\\\user\\\\Documents` instead of just `Documents`) containing the file, use {@link findFilePath} instead.\n *\n * @example\n * const folderPath = findFolderName(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // folderPath = \"Documents\"\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The folder containing the file\n */\nexport function findFolderName(\n filePath: string,\n options?: FindFileNameOptions\n): string {\n const segments = findFilePath(filePath, options).split(\"/\");\n\n let lastSegment = \"\";\n for (let i = segments.length - 1; i >= 0; i--) {\n const val = segments[i];\n if (val) {\n lastSegment = val;\n break;\n }\n }\n\n // if (\n // folderPath.lastIndexOf(\"\\\\\") === folderPath.length - 1 ||\n // folderPath.lastIndexOf(\"/\") === folderPath.length - 1\n // ) {\n // folderPath = folderPath.slice(0, Math.max(0, folderPath.length - 1));\n // }\n\n return lastSegment ?? EMPTY_STRING;\n}\n\nexport const basename = findFolderName;\n\n/**\n * Find the file extension from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link path.extname} function in Node's path module.\n * The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.\n *\n * @example\n * ```ts\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.config.ts\");\n * // Returns \"ts\"\n * ```\n *\n * @param filePath - The file path to process\n * @returns The file extension or undefined if no extension is found\n */\nexport function findFileExtension(filePath: string): string | undefined {\n if (filePath.endsWith(\".\") || filePath.endsWith(\"/\")) {\n return undefined;\n }\n\n const match = FILE_EXTENSION_REGEX.exec(normalizeWindowsPath(filePath));\n\n return match && match.length > 0 && isSetString(match[0])\n ? match[0].replace(\".\", \"\")\n : undefined;\n}\n\nexport const extname = findFileExtension;\n\n/**\n * Find the file extension including the `\".\"` character prefix from a file path.\n *\n * @remarks\n * The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.\n *\n * @param filePath - The file path to process\n * @returns The file extension (including the `\".\"` prefix) or undefined if no extension is found\n */\nexport function findFileDotExtension(filePath: string): string | undefined {\n const ext = findFileExtension(filePath);\n\n return ext ? `.${ext}` : undefined;\n}\n\n/**\n * Find the file extension from a file path or an empty string.\n *\n * @remarks\n * The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.\n *\n * @param filePath - The file path to process\n * @returns The file extension or an empty string if no extension is found\n */\nexport function findFileExtensionSafe(filePath: string): string {\n return findFileExtension(filePath) ?? EMPTY_STRING;\n}\n\n/**\n * Find the file extension including the `\".\"` character prefix from a file path or an empty string.\n *\n * @remarks\n * The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.\n *\n * @param filePath - The file path to process\n * @returns The file extension (including the `\".\"` prefix) or an empty string if no extension is found\n */\nexport function findFileDotExtensionSafe(filePath: string): string {\n const ext = findFileExtension(filePath);\n\n return ext ? `.${ext}` : \"\";\n}\n\n/**\n * Check if a file path has a file name.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file name\n */\nexport function hasFileName(filePath: string): boolean {\n return Boolean(findFileName(filePath));\n}\n\n/**\n * Check if a file path has a file path.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file path\n */\nexport function hasFilePath(filePath: string): boolean {\n return Boolean(findFilePath(filePath));\n}\n\n/**\n * Check if a file path has a folder name.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a folder name\n */\nexport function hasFolderName(filePath: string): boolean {\n return Boolean(findFolderName(filePath));\n}\n\n/**\n * Check if a file path has a file extension.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file extension\n */\nexport function hasFileExtension(filePath: string): boolean {\n return Boolean(findFileExtension(filePath));\n}\n\n/**\n * Resolve the file path to an absolute path.\n *\n * @param path - The path to resolve\n * @param cwd - The current working directory\n * @returns The resolved path\n */\nexport function resolvePath(path: string, cwd = currentDir()) {\n // Normalize windows arguments\n const paths = normalizeWindowsPath(path).split(\"/\");\n\n let resolvedPath = \"\";\n let resolvedAbsolute = false;\n\n for (\n let index = paths.length - 1;\n index >= -1 && !resolvedAbsolute;\n index--\n ) {\n const path = index >= 0 ? paths[index] : cwd;\n\n // Skip empty entries\n if (!path || path.length === 0) {\n continue;\n }\n\n resolvedPath = joinPaths(path, resolvedPath);\n resolvedAbsolute = isAbsolutePath(path);\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {\n return `/${resolvedPath}`;\n }\n\n return resolvedPath.length > 0 ? resolvedPath : \".\";\n}\n\nexport function resolve(...paths: string[]) {\n // Normalize windows arguments\n paths = paths.map(argument => normalizeWindowsPath(argument));\n\n let resolvedPath = \"\";\n let resolvedAbsolute = false;\n\n for (\n let index = paths.length - 1;\n index >= -1 && !resolvedAbsolute;\n index--\n ) {\n const path = index >= 0 ? paths[index] : currentDir();\n\n // Skip empty entries\n if (!path || path.length === 0) {\n continue;\n }\n\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = isAbsolute(path);\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute && !isAbsolute(resolvedPath)) {\n return `/${resolvedPath}`;\n }\n\n return resolvedPath.length > 0 ? resolvedPath : \".\";\n}\n\n/**\n * Resolve the file path to an absolute path.\n *\n * @param paths - The paths to resolve\n * @returns The resolved path\n */\nexport function resolvePaths(...paths: string[]) {\n return resolvePath(\n joinPaths(...paths.map(path => normalizeWindowsPath(path)))\n );\n}\n\n/**\n * Get the relative path from one file to another.\n *\n * @remarks\n * This function is similar to the `path.relative` function in Node's path module.\n *\n * @param from - The base path to start from\n * @param to - The target path to resolve relative to the base path\n * @returns The relative path from the base path to the target path\n */\nexport function relative(from: string, to: string) {\n // we cast these because `split` will always be at least one string\n const _from = resolve(from).replace(ROOT_FOLDER_REGEX, \"$1\").split(\"/\") as [\n string,\n ...string[]\n ];\n const _to = resolve(to).replace(ROOT_FOLDER_REGEX, \"$1\").split(\"/\") as [\n string,\n ...string[]\n ];\n\n // Different windows drive letters\n if (_to[0][1] === \":\" && _from[0][1] === \":\" && _from[0] !== _to[0]) {\n return _to.join(\"/\");\n }\n\n const _fromCopy = [..._from];\n for (const segment of _fromCopy) {\n if (_to[0] !== segment) {\n break;\n }\n _from.shift();\n _to.shift();\n }\n return [..._from.map(() => \"..\"), ..._to].join(\"/\");\n}\n\n/**\n * Get the relative path from one file to another.\n *\n * @remarks\n * This function wraps the `path.relative` function in Node's path module.\n *\n * @param from - The base path to start from\n * @param to - The target path to resolve relative to the base path\n * @param withEndSlash - Whether to include a trailing slash at the end of the path\n * @returns The relative path from the base path to the target path\n */\nexport function relativePath(from: string, to: string, withEndSlash = false) {\n return relative(\n withEndSlash !== true ? from.replace(/\\/$/, \"\") : from,\n withEndSlash !== true ? to.replace(/\\/$/, \"\") : to\n );\n}\n\n/**\n * Find the file path relative to the workspace root path.\n *\n * @param filePath - The file path to process\n * @returns The resolved file path\n */\nexport function relativeToCurrentDir(filePath: string) {\n return relativePath(filePath, currentDir());\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 parsePath(path: string) {\n // The root of the path such as '/' or 'c:\\'\n const root =\n /^[/\\\\]|^[a-z]:[/\\\\]/i.exec(path)?.[0]?.replace(/\\\\/g, \"/\") || \"\";\n\n const normalizedPath = normalizeWindowsPath(path);\n\n const segments = normalizedPath.replace(/\\/$/, \"\").split(\"/\").slice(0, -1);\n if (segments.length === 1 && /^[A-Z]:$/i.test(segments[0] as string)) {\n segments[0] += \"/\";\n }\n\n const base = findFolderName(normalizedPath);\n const dir = segments.join(\"/\") || (isAbsolutePath(path) ? \"/\" : \".\");\n const ext = findFileExtensionSafe(path);\n\n return {\n root,\n dir,\n base,\n ext,\n name: base.slice(0, base.length - ext.length)\n };\n}\n\n/**\n * Rename the file name with a new name.\n *\n * @param filePath - The current file path being processed\n * @param newFileName - The updated file name being processed\n * @returns The modified or unmodified file path.\n */\nexport function renameFile(filePath: string, newFileName: string): string {\n const file = parsePath(filePath);\n\n return joinPaths(\n file.dir,\n newFileName.includes(\".\") ? newFileName : newFileName + file.ext\n );\n}\n"],"mappings":"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"}
|
package/dist/file-path-fns.cjs
CHANGED
|
@@ -1,150 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.extname = exports.dirname = exports.basename = void 0;
|
|
7
|
-
exports.findFileDotExtension = findFileDotExtension;
|
|
8
|
-
exports.findFileDotExtensionSafe = findFileDotExtensionSafe;
|
|
9
|
-
exports.findFileExtension = findFileExtension;
|
|
10
|
-
exports.findFileExtensionSafe = findFileExtensionSafe;
|
|
11
|
-
exports.findFileName = findFileName;
|
|
12
|
-
exports.findFilePath = findFilePath;
|
|
13
|
-
exports.findFolderName = findFolderName;
|
|
14
|
-
exports.hasFileExtension = hasFileExtension;
|
|
15
|
-
exports.hasFileName = hasFileName;
|
|
16
|
-
exports.hasFilePath = hasFilePath;
|
|
17
|
-
exports.hasFolderName = hasFolderName;
|
|
18
|
-
exports.parsePath = parsePath;
|
|
19
|
-
exports.relative = relative;
|
|
20
|
-
exports.relativePath = relativePath;
|
|
21
|
-
exports.relativeToCurrentDir = relativeToCurrentDir;
|
|
22
|
-
exports.renameFile = renameFile;
|
|
23
|
-
exports.resolve = resolve;
|
|
24
|
-
exports.resolvePath = resolvePath;
|
|
25
|
-
exports.resolvePaths = resolvePaths;
|
|
26
|
-
var _isSetString = require("@stryke/type-checks/is-set-string");
|
|
27
|
-
var _base = require("@stryke/types/base");
|
|
28
|
-
var _correctPath = require("./correct-path.cjs");
|
|
29
|
-
var _cwd = require("./cwd.cjs");
|
|
30
|
-
var _isType = require("./is-type.cjs");
|
|
31
|
-
var _joinPaths = require("./join-paths.cjs");
|
|
32
|
-
var _regex = require("./regex.cjs");
|
|
33
|
-
function findFileName(e, t = {}) {
|
|
34
|
-
const {
|
|
35
|
-
requireExtension: r = !1,
|
|
36
|
-
withExtension: n = !0
|
|
37
|
-
} = t,
|
|
38
|
-
i = (0, _correctPath.normalizeWindowsPath)(e)?.split(e?.includes("\\") ? "\\" : "/")?.pop() ?? "";
|
|
39
|
-
return r === !0 && !i.includes(".") ? _base.EMPTY_STRING : n === !1 && i.includes(".") ? i.replace(`.${findFileExtension(i) ?? ""}`, "") || _base.EMPTY_STRING : i;
|
|
40
|
-
}
|
|
41
|
-
function findFilePath(e) {
|
|
42
|
-
const t = (0, _correctPath.normalizeWindowsPath)(e),
|
|
43
|
-
r = t.replace(findFileName(t, {
|
|
44
|
-
requireExtension: !0
|
|
45
|
-
}), "");
|
|
46
|
-
return r === "/" ? r : r.replace(/\/$/, "");
|
|
47
|
-
}
|
|
48
|
-
const dirname = exports.dirname = findFilePath;
|
|
49
|
-
function findFolderName(e) {
|
|
50
|
-
const t = findFilePath(e).split("/");
|
|
51
|
-
let r = "";
|
|
52
|
-
for (let n = t.length - 1; n >= 0; n--) {
|
|
53
|
-
const i = t[n];
|
|
54
|
-
if (i) {
|
|
55
|
-
r = i;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return r ?? _base.EMPTY_STRING;
|
|
60
|
-
}
|
|
61
|
-
const basename = exports.basename = findFolderName;
|
|
62
|
-
function findFileExtension(e) {
|
|
63
|
-
if (e.endsWith(".") || e.endsWith("/")) return;
|
|
64
|
-
const t = _regex.FILE_EXTENSION_REGEX.exec((0, _correctPath.normalizeWindowsPath)(e));
|
|
65
|
-
return t && t.length > 0 && (0, _isSetString.isSetString)(t[0]) ? t[0].replace(".", "") : void 0;
|
|
66
|
-
}
|
|
67
|
-
const extname = exports.extname = findFileExtension;
|
|
68
|
-
function findFileDotExtension(e) {
|
|
69
|
-
const t = findFileExtension(e);
|
|
70
|
-
return t ? `.${t}` : void 0;
|
|
71
|
-
}
|
|
72
|
-
function findFileExtensionSafe(e) {
|
|
73
|
-
return findFileExtension(e) ?? _base.EMPTY_STRING;
|
|
74
|
-
}
|
|
75
|
-
function findFileDotExtensionSafe(e) {
|
|
76
|
-
const t = findFileExtension(e);
|
|
77
|
-
return t ? `.${t}` : "";
|
|
78
|
-
}
|
|
79
|
-
function hasFileName(e) {
|
|
80
|
-
return !!findFileName(e);
|
|
81
|
-
}
|
|
82
|
-
function hasFilePath(e) {
|
|
83
|
-
return !!findFilePath(e);
|
|
84
|
-
}
|
|
85
|
-
function hasFolderName(e) {
|
|
86
|
-
return !!findFolderName(e);
|
|
87
|
-
}
|
|
88
|
-
function hasFileExtension(e) {
|
|
89
|
-
return !!findFileExtension(e);
|
|
90
|
-
}
|
|
91
|
-
function resolvePath(e, t = (0, _cwd.cwd)()) {
|
|
92
|
-
const r = (0, _correctPath.normalizeWindowsPath)(e).split("/");
|
|
93
|
-
let n = "",
|
|
94
|
-
i = !1;
|
|
95
|
-
for (let o = r.length - 1; o >= -1 && !i; o--) {
|
|
96
|
-
const s = o >= 0 ? r[o] : t;
|
|
97
|
-
!s || s.length === 0 || (n = (0, _joinPaths.joinPaths)(s, n), i = (0, _isType.isAbsolutePath)(s));
|
|
98
|
-
}
|
|
99
|
-
return n = (0, _correctPath.normalizeString)(n, !i), i && !(0, _isType.isAbsolutePath)(n) ? `/${n}` : n.length > 0 ? n : ".";
|
|
100
|
-
}
|
|
101
|
-
function resolve(...e) {
|
|
102
|
-
e = e.map(n => (0, _correctPath.normalizeWindowsPath)(n));
|
|
103
|
-
let t = "",
|
|
104
|
-
r = !1;
|
|
105
|
-
for (let n = e.length - 1; n >= -1 && !r; n--) {
|
|
106
|
-
const i = n >= 0 ? e[n] : (0, _cwd.cwd)();
|
|
107
|
-
!i || i.length === 0 || (t = `${i}/${t}`, r = (0, _isType.isAbsolute)(i));
|
|
108
|
-
}
|
|
109
|
-
return t = (0, _correctPath.normalizeString)(t, !r), r && !(0, _isType.isAbsolute)(t) ? `/${t}` : t.length > 0 ? t : ".";
|
|
110
|
-
}
|
|
111
|
-
function resolvePaths(...e) {
|
|
112
|
-
return resolvePath((0, _joinPaths.joinPaths)(...e.map(t => (0, _correctPath.normalizeWindowsPath)(t))));
|
|
113
|
-
}
|
|
114
|
-
function relative(e, t) {
|
|
115
|
-
const r = resolve(e).replace(_regex.ROOT_FOLDER_REGEX, "$1").split("/"),
|
|
116
|
-
n = resolve(t).replace(_regex.ROOT_FOLDER_REGEX, "$1").split("/");
|
|
117
|
-
if (n[0][1] === ":" && r[0][1] === ":" && r[0] !== n[0]) return n.join("/");
|
|
118
|
-
const i = [...r];
|
|
119
|
-
for (const o of i) {
|
|
120
|
-
if (n[0] !== o) break;
|
|
121
|
-
r.shift(), n.shift();
|
|
122
|
-
}
|
|
123
|
-
return [...r.map(() => ".."), ...n].join("/");
|
|
124
|
-
}
|
|
125
|
-
function relativePath(e, t, r = !1) {
|
|
126
|
-
return relative(r !== !0 ? e.replace(/\/$/, "") : e, r !== !0 ? t.replace(/\/$/, "") : t);
|
|
127
|
-
}
|
|
128
|
-
function relativeToCurrentDir(e) {
|
|
129
|
-
return relativePath(e, (0, _cwd.cwd)());
|
|
130
|
-
}
|
|
131
|
-
function parsePath(e) {
|
|
132
|
-
const t = /^[/\\]|^[a-z]:[/\\]/i.exec(e)?.[0]?.replace(/\\/g, "/") || "",
|
|
133
|
-
r = (0, _correctPath.normalizeWindowsPath)(e),
|
|
134
|
-
n = r.replace(/\/$/, "").split("/").slice(0, -1);
|
|
135
|
-
n.length === 1 && /^[A-Z]:$/i.test(n[0]) && (n[0] += "/");
|
|
136
|
-
const i = findFolderName(r),
|
|
137
|
-
o = n.join("/") || ((0, _isType.isAbsolutePath)(e) ? "/" : "."),
|
|
138
|
-
s = findFileExtensionSafe(e);
|
|
139
|
-
return {
|
|
140
|
-
root: t,
|
|
141
|
-
dir: o,
|
|
142
|
-
base: i,
|
|
143
|
-
ext: s,
|
|
144
|
-
name: i.slice(0, i.length - s.length)
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function renameFile(e, t) {
|
|
148
|
-
const r = parsePath(e);
|
|
149
|
-
return (0, _joinPaths.joinPaths)(r.dir, t.includes(".") ? t : t + r.ext);
|
|
150
|
-
}
|
|
1
|
+
const e=require(`./file-path-fns-B9hKjfA-.cjs`);exports.basename=e.t,exports.dirname=e.n,exports.extname=e.r,exports.findFileDotExtension=e.i,exports.findFileDotExtensionSafe=e.a,exports.findFileExtension=e.o,exports.findFileExtensionSafe=e.s,exports.findFileName=e.c,exports.findFilePath=e.l,exports.findFolderName=e.u,exports.hasFileExtension=e.d,exports.hasFileName=e.f,exports.hasFilePath=e.p,exports.hasFolderName=e.m,exports.parsePath=e.h,exports.relative=e.g,exports.relativePath=e._,exports.relativeToCurrentDir=e.v,exports.renameFile=e.y,exports.resolve=e.b,exports.resolvePath=e.x,exports.resolvePaths=e.S;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as resolvePaths, S as resolvePath, _ as relative, a as findFileDotExtension, b as renameFile, c as findFileExtensionSafe, d as findFolderName, f as hasFileExtension, g as parsePath, h as hasFolderName, i as extname, l as findFileName, m as hasFilePath, n as basename, o as findFileDotExtensionSafe, p as hasFileName, r as dirname, s as findFileExtension, t as FindFileNameOptions, u as findFilePath, v as relativePath, x as resolve, y as relativeToCurrentDir } from "./file-path-fns-CTLJP4j9.cjs";
|
|
2
|
+
export { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as resolvePaths, S as resolvePath, _ as relative, a as findFileDotExtension, b as renameFile, c as findFileExtensionSafe, d as findFolderName, f as hasFileExtension, g as parsePath, h as hasFolderName, i as extname, l as findFileName, m as hasFilePath, n as basename, o as findFileDotExtensionSafe, p as hasFileName, r as dirname, s as findFileExtension, t as FindFileNameOptions, u as findFilePath, v as relativePath, x as resolve, y as relativeToCurrentDir } from "./file-path-fns-BKbfZRTB.mjs";
|
|
2
|
+
export { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths };
|
package/dist/file-path-fns.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{S as e,_ as t,a as n,b as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y,x as b,y as x}from"./file-path-fns-MRI3PV8K.mjs";export{_ as basename,f as dirname,h as extname,l as findFileDotExtension,n as findFileDotExtensionSafe,p as findFileExtension,g as findFileExtensionSafe,i as findFileName,u as findFilePath,v as findFolderName,a as hasFileExtension,o as hasFileName,m as hasFilePath,d as hasFolderName,c as parsePath,s as relative,t as relativePath,y as relativeToCurrentDir,x as renameFile,r as resolve,b as resolvePath,e as resolvePaths};
|
package/dist/find.cjs
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _filePathFns = require("./file-path-fns.cjs");
|
|
7
|
-
Object.keys(_filePathFns).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _filePathFns[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _filePathFns[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
1
|
+
const e=require(`./file-path-fns-B9hKjfA-.cjs`);exports.basename=e.t,exports.dirname=e.n,exports.extname=e.r,exports.findFileDotExtension=e.i,exports.findFileDotExtensionSafe=e.a,exports.findFileExtension=e.o,exports.findFileExtensionSafe=e.s,exports.findFileName=e.c,exports.findFilePath=e.l,exports.findFolderName=e.u,exports.hasFileExtension=e.d,exports.hasFileName=e.f,exports.hasFilePath=e.p,exports.hasFolderName=e.m,exports.parsePath=e.h,exports.relative=e.g,exports.relativePath=e._,exports.relativeToCurrentDir=e.v,exports.renameFile=e.y,exports.resolve=e.b,exports.resolvePath=e.x,exports.resolvePaths=e.S;
|
package/dist/find.d.cts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as resolvePaths, S as resolvePath, _ as relative, a as findFileDotExtension, b as renameFile, c as findFileExtensionSafe, d as findFolderName, f as hasFileExtension, g as parsePath, h as hasFolderName, i as extname, l as findFileName, m as hasFilePath, n as basename, o as findFileDotExtensionSafe, p as hasFileName, r as dirname, s as findFileExtension, t as FindFileNameOptions, u as findFilePath, v as relativePath, x as resolve, y as relativeToCurrentDir } from "./file-path-fns-CTLJP4j9.cjs";
|
|
2
|
+
export { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths };
|
package/dist/find.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as resolvePaths, S as resolvePath, _ as relative, a as findFileDotExtension, b as renameFile, c as findFileExtensionSafe, d as findFolderName, f as hasFileExtension, g as parsePath, h as hasFolderName, i as extname, l as findFileName, m as hasFilePath, n as basename, o as findFileDotExtensionSafe, p as hasFileName, r as dirname, s as findFileExtension, t as FindFileNameOptions, u as findFilePath, v as relativePath, x as resolve, y as relativeToCurrentDir } from "./file-path-fns-BKbfZRTB.mjs";
|
|
2
|
+
export { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths };
|
package/dist/find.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{S as e,_ as t,a as n,b as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y,x as b,y as x}from"./file-path-fns-MRI3PV8K.mjs";export{_ as basename,f as dirname,h as extname,l as findFileDotExtension,n as findFileDotExtensionSafe,p as findFileExtension,g as findFileExtensionSafe,i as findFileName,u as findFilePath,v as findFolderName,a as hasFileExtension,o as hasFileName,m as hasFilePath,d as hasFolderName,c as parsePath,s as relative,t as relativePath,y as relativeToCurrentDir,x as renameFile,r as resolve,b as resolvePath,e as resolvePaths};
|
package/dist/index.cjs
CHANGED
|
@@ -1,148 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _append = require("./append.cjs");
|
|
7
|
-
Object.keys(_append).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _append[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _append[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _assetExtensions = require("./asset-extensions.cjs");
|
|
18
|
-
Object.keys(_assetExtensions).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _assetExtensions[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _assetExtensions[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _correctPath = require("./correct-path.cjs");
|
|
29
|
-
Object.keys(_correctPath).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _correctPath[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _correctPath[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _cwd = require("./cwd.cjs");
|
|
40
|
-
Object.keys(_cwd).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _cwd[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _cwd[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var _delimiter = require("./delimiter.cjs");
|
|
51
|
-
Object.keys(_delimiter).forEach(function (key) {
|
|
52
|
-
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] === _delimiter[key]) return;
|
|
54
|
-
Object.defineProperty(exports, key, {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _delimiter[key];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
var _filePathFns = require("./file-path-fns.cjs");
|
|
62
|
-
Object.keys(_filePathFns).forEach(function (key) {
|
|
63
|
-
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] === _filePathFns[key]) return;
|
|
65
|
-
Object.defineProperty(exports, key, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return _filePathFns[key];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
var _isParentPath = require("./is-parent-path.cjs");
|
|
73
|
-
Object.keys(_isParentPath).forEach(function (key) {
|
|
74
|
-
if (key === "default" || key === "__esModule") return;
|
|
75
|
-
if (key in exports && exports[key] === _isParentPath[key]) return;
|
|
76
|
-
Object.defineProperty(exports, key, {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
get: function () {
|
|
79
|
-
return _isParentPath[key];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
var _isRootDir = require("./is-root-dir.cjs");
|
|
84
|
-
Object.keys(_isRootDir).forEach(function (key) {
|
|
85
|
-
if (key === "default" || key === "__esModule") return;
|
|
86
|
-
if (key in exports && exports[key] === _isRootDir[key]) return;
|
|
87
|
-
Object.defineProperty(exports, key, {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function () {
|
|
90
|
-
return _isRootDir[key];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
var _joinPaths = require("./join-paths.cjs");
|
|
95
|
-
Object.keys(_joinPaths).forEach(function (key) {
|
|
96
|
-
if (key === "default" || key === "__esModule") return;
|
|
97
|
-
if (key in exports && exports[key] === _joinPaths[key]) return;
|
|
98
|
-
Object.defineProperty(exports, key, {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function () {
|
|
101
|
-
return _joinPaths[key];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
var _regex = require("./regex.cjs");
|
|
106
|
-
Object.keys(_regex).forEach(function (key) {
|
|
107
|
-
if (key === "default" || key === "__esModule") return;
|
|
108
|
-
if (key in exports && exports[key] === _regex[key]) return;
|
|
109
|
-
Object.defineProperty(exports, key, {
|
|
110
|
-
enumerable: true,
|
|
111
|
-
get: function () {
|
|
112
|
-
return _regex[key];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
var _replace = require("./replace.cjs");
|
|
117
|
-
Object.keys(_replace).forEach(function (key) {
|
|
118
|
-
if (key === "default" || key === "__esModule") return;
|
|
119
|
-
if (key in exports && exports[key] === _replace[key]) return;
|
|
120
|
-
Object.defineProperty(exports, key, {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () {
|
|
123
|
-
return _replace[key];
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
var _resolveParentPath = require("./resolve-parent-path.cjs");
|
|
128
|
-
Object.keys(_resolveParentPath).forEach(function (key) {
|
|
129
|
-
if (key === "default" || key === "__esModule") return;
|
|
130
|
-
if (key in exports && exports[key] === _resolveParentPath[key]) return;
|
|
131
|
-
Object.defineProperty(exports, key, {
|
|
132
|
-
enumerable: true,
|
|
133
|
-
get: function () {
|
|
134
|
-
return _resolveParentPath[key];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
var _slash = require("./slash.cjs");
|
|
139
|
-
Object.keys(_slash).forEach(function (key) {
|
|
140
|
-
if (key === "default" || key === "__esModule") return;
|
|
141
|
-
if (key in exports && exports[key] === _slash[key]) return;
|
|
142
|
-
Object.defineProperty(exports, key, {
|
|
143
|
-
enumerable: true,
|
|
144
|
-
get: function () {
|
|
145
|
-
return _slash[key];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
});
|
|
1
|
+
const e=require(`./cwd-D66SsPHE.cjs`),t=require(`./regex-BEjSq2wo.cjs`),n=require(`./slash-DhzW1Om-.cjs`),r=require(`./is-parent-path-ChIi6oAO.cjs`),i=require(`./join-paths-hCBPtGlC.cjs`),a=require(`./append-BWRdnlxE.cjs`),o=require(`./asset-extensions-DNMkK37t.cjs`),s=require(`./correct-path-B0Y_kOkW.cjs`),c=require(`./delimiter-IA9U4fxC.cjs`),l=require(`./file-path-fns-B9hKjfA-.cjs`),u=require(`./is-root-dir-BzQKuwi2.cjs`),d=require(`./replace-C570sho0.cjs`),f=require(`./resolve-parent-path-DIrSH2oN.cjs`);exports.ABSOLUTE_PATH_REGEX=t.t,exports.DEFAULT_ASSET_EXTS=o.t,exports.DRIVE_LETTER_REGEX=t.n,exports.DRIVE_LETTER_START_REGEX=t.r,exports.FILE_EXTENSION_REGEX=t.i,exports.NPM_SCOPED_PACKAGE_REGEX=t.a,exports.PACKAGE_PATH_REGEX=t.o,exports.ROOT_FOLDER_REGEX=t.s,exports.UNC_REGEX=t.c,exports.append=a.t,exports.appendExtension=a.n,exports.appendPath=a.r,exports.basename=l.t,exports.correctPath=s.t,exports.cwd=e.t,exports.delimiter=c.t,exports.dirname=l.n,exports.extname=l.r,exports.findFileDotExtension=l.i,exports.findFileDotExtensionSafe=l.a,exports.findFileExtension=l.o,exports.findFileExtensionSafe=l.s,exports.findFileName=l.c,exports.findFilePath=l.l,exports.findFolderName=l.u,exports.formatSlash=n.t,exports.hasFileExtension=l.d,exports.hasFileName=l.f,exports.hasFilePath=l.p,exports.hasFolderName=l.m,exports.isParentPath=r.t,exports.isSystemRoot=u.t,exports.join=i.t,exports.joinPaths=i.n,exports.normalizeString=s.n,exports.normalizeWindowsPath=s.r,exports.parsePath=l.h,exports.posix=c.n,exports.relative=l.g,exports.relativePath=l._,exports.relativeToCurrentDir=l.v,exports.renameFile=l.y,exports.replaceExtension=d.t,exports.replacePath=d.n,exports.resolve=l.b,exports.resolveParentPath=f.t,exports.resolvePath=l.x,exports.resolvePaths=l.S,exports.slash=n.n,exports.stripStars=s.i,exports.toAbsolutePath=s.a,exports.toRelativePath=s.o,exports.win32=c.r,exports.withTrailingSlash=s.s;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { n as appendExtension, r as appendPath, t as append } from "./append-DfRQvWY6.cjs";
|
|
2
|
+
import { t as DEFAULT_ASSET_EXTS } from "./asset-extensions-D-_39huh.cjs";
|
|
3
|
+
import { a as toAbsolutePath, i as stripStars, n as normalizeString, o as toRelativePath, r as normalizeWindowsPath, s as withTrailingSlash, t as correctPath } from "./correct-path-CwHhpk6I.cjs";
|
|
4
|
+
import { t as cwd } from "./cwd-Bt4NcS-v.cjs";
|
|
5
|
+
import { n as posix, r as win32, t as delimiter } from "./delimiter-BwyCEwu9.cjs";
|
|
6
|
+
import { C as resolvePaths, S as resolvePath, _ as relative, a as findFileDotExtension, b as renameFile, c as findFileExtensionSafe, d as findFolderName, f as hasFileExtension, g as parsePath, h as hasFolderName, i as extname, l as findFileName, m as hasFilePath, n as basename, o as findFileDotExtensionSafe, p as hasFileName, r as dirname, s as findFileExtension, t as FindFileNameOptions, u as findFilePath, v as relativePath, x as resolve, y as relativeToCurrentDir } from "./file-path-fns-CTLJP4j9.cjs";
|
|
7
|
+
import { t as isParentPath } from "./is-parent-path-B1EPPZ08.cjs";
|
|
8
|
+
import { t as isSystemRoot } from "./is-root-dir-DnWZlIgB.cjs";
|
|
9
|
+
import { n as joinPaths, t as join } from "./join-paths-DBTcCEw0.cjs";
|
|
10
|
+
import { a as NPM_SCOPED_PACKAGE_REGEX, c as UNC_REGEX, i as FILE_EXTENSION_REGEX, n as DRIVE_LETTER_REGEX, o as PACKAGE_PATH_REGEX, r as DRIVE_LETTER_START_REGEX, s as ROOT_FOLDER_REGEX, t as ABSOLUTE_PATH_REGEX } from "./regex-DHvK8l1E.cjs";
|
|
11
|
+
import { n as replacePath, t as replaceExtension } from "./replace-0nP9MPWp.cjs";
|
|
12
|
+
import { t as resolveParentPath } from "./resolve-parent-path-oZQZf2nw.cjs";
|
|
13
|
+
import { n as slash, t as formatSlash } from "./slash-DPd6cWOz.cjs";
|
|
14
|
+
export { ABSOLUTE_PATH_REGEX, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX, append, appendExtension, appendPath, basename, correctPath, cwd, delimiter, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, formatSlash, hasFileExtension, hasFileName, hasFilePath, hasFolderName, isParentPath, isSystemRoot, join, joinPaths, normalizeString, normalizeWindowsPath, parsePath, posix, relative, relativePath, relativeToCurrentDir, renameFile, replaceExtension, replacePath, resolve, resolveParentPath, resolvePath, resolvePaths, slash, stripStars, toAbsolutePath, toRelativePath, win32, withTrailingSlash };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { n as appendExtension, r as appendPath, t as append } from "./append-tFFvRN-V.mjs";
|
|
2
|
+
import { t as DEFAULT_ASSET_EXTS } from "./asset-extensions-DlN384ac.mjs";
|
|
3
|
+
import { a as toAbsolutePath, i as stripStars, n as normalizeString, o as toRelativePath, r as normalizeWindowsPath, s as withTrailingSlash, t as correctPath } from "./correct-path-LC5QqYV-.mjs";
|
|
4
|
+
import { t as cwd } from "./cwd-Dx53cgUn.mjs";
|
|
5
|
+
import { n as posix, r as win32, t as delimiter } from "./delimiter-DuDX7fvN.mjs";
|
|
6
|
+
import { C as resolvePaths, S as resolvePath, _ as relative, a as findFileDotExtension, b as renameFile, c as findFileExtensionSafe, d as findFolderName, f as hasFileExtension, g as parsePath, h as hasFolderName, i as extname, l as findFileName, m as hasFilePath, n as basename, o as findFileDotExtensionSafe, p as hasFileName, r as dirname, s as findFileExtension, t as FindFileNameOptions, u as findFilePath, v as relativePath, x as resolve, y as relativeToCurrentDir } from "./file-path-fns-BKbfZRTB.mjs";
|
|
7
|
+
import { t as isParentPath } from "./is-parent-path-BW6CsB2o.mjs";
|
|
8
|
+
import { t as isSystemRoot } from "./is-root-dir-CQA1qNI-.mjs";
|
|
9
|
+
import { n as joinPaths, t as join } from "./join-paths-Bklwf_Bh.mjs";
|
|
10
|
+
import { a as NPM_SCOPED_PACKAGE_REGEX, c as UNC_REGEX, i as FILE_EXTENSION_REGEX, n as DRIVE_LETTER_REGEX, o as PACKAGE_PATH_REGEX, r as DRIVE_LETTER_START_REGEX, s as ROOT_FOLDER_REGEX, t as ABSOLUTE_PATH_REGEX } from "./regex-fq9t8ABF.mjs";
|
|
11
|
+
import { n as replacePath, t as replaceExtension } from "./replace-fEEM12P3.mjs";
|
|
12
|
+
import { t as resolveParentPath } from "./resolve-parent-path-D5uwbjqj.mjs";
|
|
13
|
+
import { n as slash, t as formatSlash } from "./slash-CuA7ERRf.mjs";
|
|
14
|
+
export { ABSOLUTE_PATH_REGEX, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX, append, appendExtension, appendPath, basename, correctPath, cwd, delimiter, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, formatSlash, hasFileExtension, hasFileName, hasFilePath, hasFolderName, isParentPath, isSystemRoot, join, joinPaths, normalizeString, normalizeWindowsPath, parsePath, posix, relative, relativePath, relativeToCurrentDir, renameFile, replaceExtension, replacePath, resolve, resolveParentPath, resolvePath, resolvePaths, slash, stripStars, toAbsolutePath, toRelativePath, win32, withTrailingSlash };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{t as e}from"./cwd-DxrPG9WB.mjs";import{a as t,c as n,i as r,n as i,o as a,r as o,s,t as c}from"./regex-hMUNHeGK.mjs";import{n as l,t as u}from"./slash-C7xRDucF.mjs";import{t as d}from"./is-parent-path-C0Azmjnd.mjs";import{n as f,t as p}from"./join-paths-BLjJ0GmK.mjs";import{n as m,r as h,t as g}from"./append-xQ5toDGS.mjs";import{t as _}from"./asset-extensions-BFW_s97B.mjs";import{a as v,i as y,n as b,o as x,r as S,s as C,t as w}from"./correct-path-DmaZHNUF.mjs";import{n as T,r as E,t as D}from"./delimiter-B3nWo9Xn.mjs";import{S as O,_ as k,a as A,b as j,c as M,d as N,f as P,g as F,h as I,i as L,l as R,m as z,n as B,o as V,p as H,r as U,s as W,t as G,u as K,v as q,x as J,y as Y}from"./file-path-fns-MRI3PV8K.mjs";import{t as X}from"./is-root-dir-DI5qcnLw.mjs";import{n as Z,t as Q}from"./replace-C9dh7bEG.mjs";import{t as $}from"./resolve-parent-path-5B4YvR_k.mjs";export{c as ABSOLUTE_PATH_REGEX,_ as DEFAULT_ASSET_EXTS,i as DRIVE_LETTER_REGEX,o as DRIVE_LETTER_START_REGEX,r as FILE_EXTENSION_REGEX,t as NPM_SCOPED_PACKAGE_REGEX,a as PACKAGE_PATH_REGEX,s as ROOT_FOLDER_REGEX,n as UNC_REGEX,g as append,m as appendExtension,h as appendPath,G as basename,w as correctPath,e as cwd,D as delimiter,B as dirname,U as extname,L as findFileDotExtension,A as findFileDotExtensionSafe,V as findFileExtension,W as findFileExtensionSafe,M as findFileName,R as findFilePath,K as findFolderName,u as formatSlash,N as hasFileExtension,P as hasFileName,H as hasFilePath,z as hasFolderName,d as isParentPath,X as isSystemRoot,p as join,f as joinPaths,b as normalizeString,S as normalizeWindowsPath,I as parsePath,T as posix,F as relative,k as relativePath,q as relativeToCurrentDir,Y as renameFile,Q as replaceExtension,Z as replacePath,j as resolve,$ as resolveParentPath,J as resolvePath,O as resolvePaths,l as slash,y as stripStars,v as toAbsolutePath,x as toRelativePath,E as win32,C as withTrailingSlash};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/is-parent-path.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Check if a given path is a parent of another path.
|
|
3
4
|
*
|
|
@@ -19,4 +20,7 @@
|
|
|
19
20
|
* @param parentPath - The path to check if it is a parent of the child path.
|
|
20
21
|
* @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
+
declare function isParentPath(childPath: string, parentPath: string): boolean;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { isParentPath as t };
|
|
26
|
+
//# sourceMappingURL=is-parent-path-B1EPPZ08.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-parent-path-B1EPPZ08.d.cts","names":[],"sources":["../src/is-parent-path.ts"],"sourcesContent":[],"mappings":";;AAyCA;;;;;;;;;;;;;;;;;;;;iBAAgB,YAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/is-parent-path.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if a given path is a parent of another path.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src");
|
|
8
|
+
* // returns true
|
|
9
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project");
|
|
10
|
+
* // returns true
|
|
11
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/other");
|
|
12
|
+
* // returns false
|
|
13
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/other");
|
|
14
|
+
* // returns false
|
|
15
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/index.ts");
|
|
16
|
+
* // returns false
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param childPath - The path to check if it is a child of the parent path.
|
|
20
|
+
* @param parentPath - The path to check if it is a parent of the child path.
|
|
21
|
+
* @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
|
|
22
|
+
*/
|
|
23
|
+
declare function isParentPath(childPath: string, parentPath: string): boolean;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { isParentPath as t };
|
|
26
|
+
//# sourceMappingURL=is-parent-path-BW6CsB2o.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-parent-path-BW6CsB2o.d.mts","names":[],"sources":["../src/is-parent-path.ts"],"sourcesContent":[],"mappings":";;AAyCA;;;;;;;;;;;;;;;;;;;;iBAAgB,YAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-parent-path-C0Azmjnd.mjs","names":[],"sources":["../src/is-parent-path.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { slash } from \"./slash\";\n\n/**\n * Check if a given path is a parent of another path.\n *\n * @example\n * ```ts\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src\");\n * // returns true\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project\");\n * // returns true\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/other\");\n * // returns false\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/other\");\n * // returns false\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/index.ts\");\n * // returns false\n * ```\n *\n * @param childPath - The path to check if it is a child of the parent path.\n * @param parentPath - The path to check if it is a parent of the child path.\n * @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.\n */\nexport function isParentPath(childPath: string, parentPath: string): boolean {\n const normalizedChild = slash(\n childPath.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\")\n );\n const normalizedParent = slash(\n parentPath.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\")\n );\n\n return (\n normalizedChild !== normalizedParent &&\n normalizedChild.startsWith(`${normalizedParent}/`)\n );\n}\n"],"mappings":"yCAyCA,SAAgB,EAAa,EAAmB,EAA6B,CAC3E,IAAM,EAAkB,EACtB,EAAU,QAAQ,MAAO,IAAI,CAAC,QAAQ,MAAO,GAAG,CACjD,CACK,EAAmB,EACvB,EAAW,QAAQ,MAAO,IAAI,CAAC,QAAQ,MAAO,GAAG,CAClD,CAED,OACE,IAAoB,GACpB,EAAgB,WAAW,GAAG,EAAiB,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./slash-DhzW1Om-.cjs`);function t(t,n){let r=e.n(t.replace(/\\/g,`/`).replace(/\/$/,``)),i=e.n(n.replace(/\\/g,`/`).replace(/\/$/,``));return r!==i&&r.startsWith(`${i}/`)}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
package/dist/is-parent-path.cjs
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isParentPath = isParentPath;
|
|
7
|
-
var _slash = require("./slash.cjs");
|
|
8
|
-
function isParentPath(a, n) {
|
|
9
|
-
const r = (0, _slash.slash)(a.replace(/\\/g, "/").replace(/\/$/, "")),
|
|
10
|
-
e = (0, _slash.slash)(n.replace(/\\/g, "/").replace(/\/$/, ""));
|
|
11
|
-
return r !== e && r.startsWith(`${e}/`);
|
|
12
|
-
}
|
|
1
|
+
const e=require(`./is-parent-path-ChIi6oAO.cjs`);exports.isParentPath=e.t;
|
package/dist/is-parent-path.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as e}from"./is-parent-path-C0Azmjnd.mjs";export{e as isParentPath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e===`/`||e===`c:\\`||e===`C:\\`}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
|