@stryke/fs 0.33.20 → 0.33.21
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 +12 -0
- package/dist/{chunk-Bmb41Sf3.cjs → _virtual/rolldown_runtime.cjs} +1 -1
- package/dist/buffer.cjs +1 -1
- package/dist/buffer.d.cts +32 -2
- package/dist/buffer.d.cts.map +1 -0
- package/dist/buffer.d.mts +32 -2
- package/dist/buffer.d.mts.map +1 -0
- package/dist/buffer.mjs +2 -1
- package/dist/buffer.mjs.map +1 -0
- package/dist/chmod-x.cjs +1 -1
- package/dist/chmod-x.d.cts +44 -2
- package/dist/chmod-x.d.cts.map +1 -0
- package/dist/chmod-x.d.mts +44 -2
- package/dist/chmod-x.d.mts.map +1 -0
- package/dist/chmod-x.mjs +2 -1
- package/dist/chmod-x.mjs.map +1 -0
- package/dist/command-exists.cjs +1 -1
- package/dist/command-exists.d.cts +22 -2
- package/dist/command-exists.d.cts.map +1 -0
- package/dist/command-exists.d.mts +22 -2
- package/dist/command-exists.d.mts.map +1 -0
- package/dist/command-exists.mjs +2 -1
- package/dist/command-exists.mjs.map +1 -0
- package/dist/compress.cjs +1 -1
- package/dist/compress.d.cts +16 -2
- package/dist/compress.d.cts.map +1 -0
- package/dist/compress.d.mts +16 -2
- package/dist/compress.d.mts.map +1 -0
- package/dist/compress.mjs +2 -1
- package/dist/compress.mjs.map +1 -0
- package/dist/constants.d.cts +5 -2
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +5 -2
- package/dist/constants.d.mts.map +1 -0
- package/dist/convert/src/array-buffer-to-string.cjs +1 -0
- package/dist/convert/src/array-buffer-to-string.mjs +2 -0
- package/dist/convert/src/array-buffer-to-string.mjs.map +1 -0
- package/dist/convert/src/to-array.cjs +1 -0
- package/dist/convert/src/to-array.mjs +2 -0
- package/dist/convert/src/to-array.mjs.map +1 -0
- package/dist/convert/src/uint8-array-to-string.cjs +1 -0
- package/dist/convert/src/uint8-array-to-string.mjs +2 -0
- package/dist/convert/src/uint8-array-to-string.mjs.map +1 -0
- package/dist/copy-file.cjs +1 -1
- package/dist/copy-file.d.cts +39 -2
- package/dist/copy-file.d.cts.map +1 -0
- package/dist/copy-file.d.mts +39 -2
- package/dist/copy-file.d.mts.map +1 -0
- package/dist/copy-file.mjs +2 -1
- package/dist/copy-file.mjs.map +1 -0
- package/dist/exists.cjs +1 -1
- package/dist/exists.d.cts +18 -2
- package/dist/exists.d.cts.map +1 -0
- package/dist/exists.d.mts +18 -2
- package/dist/exists.d.mts.map +1 -0
- package/dist/exists.mjs +2 -1
- package/dist/exists.mjs.map +1 -0
- package/dist/get-parent-path.cjs +1 -1
- package/dist/get-parent-path.d.cts +32 -2
- package/dist/get-parent-path.d.cts.map +1 -0
- package/dist/get-parent-path.d.mts +32 -2
- package/dist/get-parent-path.d.mts.map +1 -0
- package/dist/get-parent-path.mjs +2 -1
- package/dist/get-parent-path.mjs.map +1 -0
- package/dist/get-workspace-root.cjs +1 -1
- package/dist/get-workspace-root.d.cts +48 -2
- package/dist/get-workspace-root.d.cts.map +1 -0
- package/dist/get-workspace-root.d.mts +48 -2
- package/dist/get-workspace-root.d.mts.map +1 -0
- package/dist/get-workspace-root.mjs +2 -1
- package/dist/get-workspace-root.mjs.map +1 -0
- package/dist/helpers/src/get-unique.cjs +1 -0
- package/dist/helpers/src/get-unique.mjs +2 -0
- package/dist/helpers/src/get-unique.mjs.map +1 -0
- package/dist/helpers.cjs +1 -1
- package/dist/helpers.d.cts +50 -2
- package/dist/helpers.d.cts.map +1 -0
- package/dist/helpers.d.mts +50 -2
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +2 -1
- package/dist/helpers.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +24 -24
- package/dist/index.d.mts +24 -24
- package/dist/index.mjs +1 -1
- package/dist/install.cjs +1 -1
- package/dist/install.d.cts +28 -2
- package/dist/install.d.cts.map +1 -0
- package/dist/install.d.mts +29 -2
- package/dist/install.d.mts.map +1 -0
- package/dist/install.mjs +2 -1
- package/dist/install.mjs.map +1 -0
- package/dist/is-file.cjs +1 -1
- package/dist/is-file.d.cts +36 -2
- package/dist/is-file.d.cts.map +1 -0
- package/dist/is-file.d.mts +36 -2
- package/dist/is-file.d.mts.map +1 -0
- package/dist/is-file.mjs +2 -1
- package/dist/is-file.mjs.map +1 -0
- package/dist/json/src/storm-json.cjs +1 -0
- package/dist/json/src/storm-json.mjs +2 -0
- package/dist/json/src/storm-json.mjs.map +1 -0
- package/dist/json/src/types.d.cts +33 -0
- package/dist/json/src/types.d.cts.map +1 -0
- package/dist/json/src/types.d.mts +33 -0
- package/dist/json/src/types.d.mts.map +1 -0
- package/dist/json/src/utils/code-frames.cjs +3 -0
- package/dist/json/src/utils/code-frames.mjs +4 -0
- package/dist/json/src/utils/code-frames.mjs.map +1 -0
- package/dist/json/src/utils/parse-error.cjs +1 -0
- package/dist/json/src/utils/parse-error.mjs +2 -0
- package/dist/json/src/utils/parse-error.mjs.map +1 -0
- package/dist/json/src/utils/parse.cjs +1 -0
- package/dist/json/src/utils/parse.mjs +2 -0
- package/dist/json/src/utils/parse.mjs.map +1 -0
- package/dist/json/src/utils/stringify.cjs +1 -0
- package/dist/json/src/utils/stringify.mjs +2 -0
- package/dist/json/src/utils/stringify.mjs.map +1 -0
- package/dist/json/src/utils/strip-comments.cjs +4 -0
- package/dist/json/src/utils/strip-comments.mjs +5 -0
- package/dist/json/src/utils/strip-comments.mjs.map +1 -0
- package/dist/json.cjs +1 -1
- package/dist/json.d.cts +54 -2
- package/dist/json.d.cts.map +1 -0
- package/dist/json.d.mts +54 -2
- package/dist/json.d.mts.map +1 -0
- package/dist/json.mjs +2 -1
- package/dist/json.mjs.map +1 -0
- package/dist/list-files.cjs +1 -1
- package/dist/list-files.d.cts +51 -2
- package/dist/list-files.d.cts.map +1 -0
- package/dist/list-files.d.mts +51 -2
- package/dist/list-files.d.mts.map +1 -0
- package/dist/list-files.mjs +2 -1
- package/dist/list-files.mjs.map +1 -0
- package/dist/package-fns.cjs +1 -1
- package/dist/package-fns.d.cts +95 -2
- package/dist/package-fns.d.cts.map +1 -0
- package/dist/package-fns.d.mts +95 -2
- package/dist/package-fns.d.mts.map +1 -0
- package/dist/package-fns.mjs +2 -1
- package/dist/package-fns.mjs.map +1 -0
- package/dist/path/src/append.cjs +1 -0
- package/dist/path/src/append.mjs +2 -0
- package/dist/path/src/append.mjs.map +1 -0
- package/dist/path/src/correct-path.cjs +1 -0
- package/dist/path/src/correct-path.mjs +2 -0
- package/dist/path/src/correct-path.mjs.map +1 -0
- package/dist/path/src/cwd.cjs +1 -0
- package/dist/path/src/cwd.mjs +2 -0
- package/dist/path/src/cwd.mjs.map +1 -0
- package/dist/path/src/file-path-fns.cjs +1 -0
- package/dist/path/src/file-path-fns.mjs +2 -0
- package/dist/path/src/file-path-fns.mjs.map +1 -0
- package/dist/path/src/is-parent-path.cjs +1 -0
- package/dist/path/src/is-parent-path.mjs +2 -0
- package/dist/path/src/is-parent-path.mjs.map +1 -0
- package/dist/path/src/is-root-dir.cjs +1 -0
- package/dist/path/src/is-root-dir.mjs +2 -0
- package/dist/path/src/is-root-dir.mjs.map +1 -0
- package/dist/path/src/is-type.cjs +1 -0
- package/dist/path/src/is-type.mjs +2 -0
- package/dist/path/src/is-type.mjs.map +1 -0
- package/dist/path/src/join-paths.cjs +1 -0
- package/dist/path/src/join-paths.mjs +2 -0
- package/dist/path/src/join-paths.mjs.map +1 -0
- package/dist/path/src/regex.cjs +1 -0
- package/dist/path/src/regex.mjs +2 -0
- package/dist/path/src/regex.mjs.map +1 -0
- package/dist/path/src/replace.cjs +1 -0
- package/dist/path/src/replace.mjs +2 -0
- package/dist/path/src/replace.mjs.map +1 -0
- package/dist/path/src/resolve-parent-path.cjs +1 -0
- package/dist/path/src/resolve-parent-path.mjs +2 -0
- package/dist/path/src/resolve-parent-path.mjs.map +1 -0
- package/dist/path/src/slash.cjs +1 -0
- package/dist/path/src/slash.mjs +2 -0
- package/dist/path/src/slash.mjs.map +1 -0
- package/dist/read-file.cjs +1 -1
- package/dist/read-file.d.cts +30 -2
- package/dist/read-file.d.cts.map +1 -0
- package/dist/read-file.d.mts +30 -2
- package/dist/read-file.d.mts.map +1 -0
- package/dist/read-file.mjs +2 -1
- package/dist/read-file.mjs.map +1 -0
- package/dist/registry.cjs +1 -1
- package/dist/registry.d.cts +53 -2
- package/dist/registry.d.cts.map +1 -0
- package/dist/registry.d.mts +53 -2
- package/dist/registry.d.mts.map +1 -0
- package/dist/registry.mjs +2 -1
- package/dist/registry.mjs.map +1 -0
- package/dist/remove-file.cjs +1 -1
- package/dist/remove-file.d.cts +16 -2
- package/dist/remove-file.d.cts.map +1 -0
- package/dist/remove-file.d.mts +16 -2
- package/dist/remove-file.d.mts.map +1 -0
- package/dist/remove-file.mjs +2 -1
- package/dist/remove-file.mjs.map +1 -0
- package/dist/resolve.cjs +3 -1
- package/dist/resolve.d.cts +106 -2
- package/dist/resolve.d.cts.map +1 -0
- package/dist/resolve.d.mts +106 -2
- package/dist/resolve.d.mts.map +1 -0
- package/dist/resolve.mjs +4 -1
- package/dist/resolve.mjs.map +1 -0
- package/dist/semver-fns.cjs +1 -1
- package/dist/semver-fns.d.cts +92 -2
- package/dist/semver-fns.d.cts.map +1 -0
- package/dist/semver-fns.d.mts +92 -2
- package/dist/semver-fns.d.mts.map +1 -0
- package/dist/semver-fns.mjs +2 -1
- package/dist/semver-fns.mjs.map +1 -0
- package/dist/string-format/src/package.cjs +1 -0
- package/dist/string-format/src/package.mjs +2 -0
- package/dist/string-format/src/package.mjs.map +1 -0
- package/dist/toml.cjs +3 -1
- package/dist/toml.d.cts +81 -2
- package/dist/toml.d.cts.map +1 -0
- package/dist/toml.d.mts +81 -2
- package/dist/toml.d.mts.map +1 -0
- package/dist/toml.mjs +4 -1
- package/dist/toml.mjs.map +1 -0
- package/dist/tsconfig.cjs +1 -1
- package/dist/tsconfig.d.cts +14 -2
- package/dist/tsconfig.d.cts.map +1 -0
- package/dist/tsconfig.d.mts +14 -2
- package/dist/tsconfig.d.mts.map +1 -0
- package/dist/tsconfig.mjs +2 -1
- package/dist/tsconfig.mjs.map +1 -0
- package/dist/type-checks/src/get-object-tag.cjs +1 -0
- package/dist/type-checks/src/get-object-tag.mjs +2 -0
- package/dist/type-checks/src/get-object-tag.mjs.map +1 -0
- package/dist/type-checks/src/index.cjs +1 -0
- package/dist/type-checks/src/index.mjs +1 -0
- package/dist/type-checks/src/is-buffer.cjs +1 -0
- package/dist/type-checks/src/is-buffer.mjs +2 -0
- package/dist/type-checks/src/is-buffer.mjs.map +1 -0
- package/dist/type-checks/src/is-collection.cjs +1 -0
- package/dist/type-checks/src/is-collection.mjs +1 -0
- package/dist/type-checks/src/is-empty.cjs +1 -0
- package/dist/type-checks/src/is-empty.mjs +2 -0
- package/dist/type-checks/src/is-empty.mjs.map +1 -0
- package/dist/type-checks/src/is-error.cjs +1 -0
- package/dist/type-checks/src/is-error.mjs +2 -0
- package/dist/type-checks/src/is-error.mjs.map +1 -0
- package/dist/type-checks/src/is-null.cjs +1 -0
- package/dist/type-checks/src/is-null.mjs +2 -0
- package/dist/type-checks/src/is-null.mjs.map +1 -0
- package/dist/type-checks/src/is-number.cjs +1 -0
- package/dist/type-checks/src/is-number.mjs +2 -0
- package/dist/type-checks/src/is-number.mjs.map +1 -0
- package/dist/type-checks/src/is-object.cjs +1 -0
- package/dist/type-checks/src/is-object.mjs +2 -0
- package/dist/type-checks/src/is-object.mjs.map +1 -0
- package/dist/type-checks/src/is-plain-object.cjs +1 -0
- package/dist/type-checks/src/is-plain-object.mjs +2 -0
- package/dist/type-checks/src/is-plain-object.mjs.map +1 -0
- package/dist/type-checks/src/is-set-string.cjs +1 -0
- package/dist/type-checks/src/is-set-string.mjs +2 -0
- package/dist/type-checks/src/is-set-string.mjs.map +1 -0
- package/dist/type-checks/src/is-set.cjs +1 -0
- package/dist/type-checks/src/is-set.mjs +2 -0
- package/dist/type-checks/src/is-set.mjs.map +1 -0
- package/dist/type-checks/src/is-string.cjs +1 -0
- package/dist/type-checks/src/is-string.mjs +2 -0
- package/dist/type-checks/src/is-string.mjs.map +1 -0
- package/dist/type-checks/src/is-undefined.cjs +1 -0
- package/dist/type-checks/src/is-undefined.mjs +2 -0
- package/dist/type-checks/src/is-undefined.mjs.map +1 -0
- package/dist/type-checks/src/type-detect.cjs +1 -0
- package/dist/type-checks/src/type-detect.mjs +2 -0
- package/dist/type-checks/src/type-detect.mjs.map +1 -0
- package/dist/types/src/base.cjs +1 -0
- package/dist/types/src/base.mjs +2 -0
- package/dist/types/src/base.mjs.map +1 -0
- package/dist/{file-D1uBqkpP.d.cts → types/src/file.d.cts} +2 -2
- package/dist/types/src/file.d.cts.map +1 -0
- package/dist/{file-DauFFmfh.d.mts → types/src/file.d.mts} +2 -2
- package/dist/types/src/file.d.mts.map +1 -0
- package/dist/{package-fns-CxokaGDY.d.mts → types/src/package-json.d.cts} +2 -95
- package/dist/types/src/package-json.d.cts.map +1 -0
- package/dist/{package-fns-BNRi_Rpc.d.cts → types/src/package-json.d.mts} +2 -95
- package/dist/types/src/package-json.d.mts.map +1 -0
- package/dist/types/src/package-manager.d.cts +5 -0
- package/dist/types/src/package-manager.d.cts.map +1 -0
- package/dist/types/src/package-manager.d.mts +5 -0
- package/dist/types/src/package-manager.d.mts.map +1 -0
- package/dist/{tsconfig-B13IMV_0.d.mts → types/src/tsconfig.d.cts} +3 -12
- package/dist/types/src/tsconfig.d.cts.map +1 -0
- package/dist/{tsconfig-C8ecu1-0.d.cts → types/src/tsconfig.d.mts} +3 -12
- package/dist/types/src/tsconfig.d.mts.map +1 -0
- package/dist/write-file.cjs +1 -1
- package/dist/write-file.d.cts +35 -2
- package/dist/write-file.d.cts.map +1 -0
- package/dist/write-file.d.mts +35 -2
- package/dist/write-file.d.mts.map +1 -0
- package/dist/write-file.mjs +2 -1
- package/dist/write-file.mjs.map +1 -0
- package/dist/yaml.cjs +1 -1
- package/dist/yaml.d.cts +23 -2
- package/dist/yaml.d.cts.map +1 -0
- package/dist/yaml.d.mts +23 -2
- package/dist/yaml.d.mts.map +1 -0
- package/dist/yaml.mjs +2 -1
- package/dist/yaml.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/buffer-Ch164vki.cjs +0 -1
- package/dist/buffer-DDq-CW4J.mjs +0 -2
- package/dist/buffer-DDq-CW4J.mjs.map +0 -1
- package/dist/buffer-DgfUmhrc.d.mts +0 -32
- package/dist/buffer-DgfUmhrc.d.mts.map +0 -1
- package/dist/buffer-DvCjrjQH.d.cts +0 -32
- package/dist/buffer-DvCjrjQH.d.cts.map +0 -1
- package/dist/chmod-x-BPr4tt2-.d.cts +0 -44
- package/dist/chmod-x-BPr4tt2-.d.cts.map +0 -1
- package/dist/chmod-x-FOy3sak8.cjs +0 -1
- package/dist/chmod-x-QCk1GmQJ.d.mts +0 -44
- package/dist/chmod-x-QCk1GmQJ.d.mts.map +0 -1
- package/dist/chmod-x-q-TWdus7.mjs +0 -2
- package/dist/chmod-x-q-TWdus7.mjs.map +0 -1
- package/dist/command-exists-CuieR7rx.d.cts +0 -22
- package/dist/command-exists-CuieR7rx.d.cts.map +0 -1
- package/dist/command-exists-D1bV-wSk.cjs +0 -1
- package/dist/command-exists-Dzb2kKT4.mjs +0 -2
- package/dist/command-exists-Dzb2kKT4.mjs.map +0 -1
- package/dist/command-exists-dBdtR0xj.d.mts +0 -22
- package/dist/command-exists-dBdtR0xj.d.mts.map +0 -1
- package/dist/compress-BiTxso15.mjs +0 -2
- package/dist/compress-BiTxso15.mjs.map +0 -1
- package/dist/compress-BjGbQqs_.cjs +0 -1
- package/dist/compress-CLAaOwH3.d.mts +0 -16
- package/dist/compress-CLAaOwH3.d.mts.map +0 -1
- package/dist/compress-CQve2a6h.d.cts +0 -16
- package/dist/compress-CQve2a6h.d.cts.map +0 -1
- package/dist/constants-D58o2CiO.d.cts +0 -5
- package/dist/constants-D58o2CiO.d.cts.map +0 -1
- package/dist/constants-DZz9LJgo.d.mts +0 -5
- package/dist/constants-DZz9LJgo.d.mts.map +0 -1
- package/dist/copy-file-B5FJHiIK.d.mts +0 -39
- package/dist/copy-file-B5FJHiIK.d.mts.map +0 -1
- package/dist/copy-file-Bot2YNtT.mjs +0 -2
- package/dist/copy-file-Bot2YNtT.mjs.map +0 -1
- package/dist/copy-file-DjH2Ho5e.d.cts +0 -39
- package/dist/copy-file-DjH2Ho5e.d.cts.map +0 -1
- package/dist/copy-file-Y1ilzocZ.cjs +0 -1
- package/dist/cwd-YTg9Cx6C.mjs +0 -2
- package/dist/cwd-YTg9Cx6C.mjs.map +0 -1
- package/dist/cwd-o2vq8Tk9.cjs +0 -1
- package/dist/exists-175EN367.d.mts +0 -18
- package/dist/exists-175EN367.d.mts.map +0 -1
- package/dist/exists-B31lSRFp.cjs +0 -1
- package/dist/exists-CVlDImzc.d.cts +0 -18
- package/dist/exists-CVlDImzc.d.cts.map +0 -1
- package/dist/exists-Ci-9lYmi.mjs +0 -2
- package/dist/exists-Ci-9lYmi.mjs.map +0 -1
- package/dist/file-D1uBqkpP.d.cts.map +0 -1
- package/dist/file-DauFFmfh.d.mts.map +0 -1
- package/dist/file-path-fns-7aKacdLg.cjs +0 -1
- package/dist/file-path-fns-BDzC2SIV.mjs +0 -2
- package/dist/file-path-fns-BDzC2SIV.mjs.map +0 -1
- package/dist/get-parent-path-COkh6Pvl.d.mts +0 -32
- package/dist/get-parent-path-COkh6Pvl.d.mts.map +0 -1
- package/dist/get-parent-path-Cbqs2km7.d.cts +0 -32
- package/dist/get-parent-path-Cbqs2km7.d.cts.map +0 -1
- package/dist/get-parent-path-CfRkaB4R.cjs +0 -1
- package/dist/get-parent-path-DLFSyxSW.mjs +0 -2
- package/dist/get-parent-path-DLFSyxSW.mjs.map +0 -1
- package/dist/get-workspace-root-CCNjjZGY.cjs +0 -1
- package/dist/get-workspace-root-DQBvBd8X.d.mts +0 -48
- package/dist/get-workspace-root-DQBvBd8X.d.mts.map +0 -1
- package/dist/get-workspace-root-eTfm1jII.d.cts +0 -48
- package/dist/get-workspace-root-eTfm1jII.d.cts.map +0 -1
- package/dist/get-workspace-root-k66w-wLW.mjs +0 -2
- package/dist/get-workspace-root-k66w-wLW.mjs.map +0 -1
- package/dist/helpers-BSEQb1fp.mjs +0 -2
- package/dist/helpers-BSEQb1fp.mjs.map +0 -1
- package/dist/helpers-CYWFZ-Uv.d.mts +0 -50
- package/dist/helpers-CYWFZ-Uv.d.mts.map +0 -1
- package/dist/helpers-CgMOExPa.d.cts +0 -50
- package/dist/helpers-CgMOExPa.d.cts.map +0 -1
- package/dist/helpers-_MJ6PR-g.cjs +0 -1
- package/dist/install-B3bIjHoU.mjs +0 -2
- package/dist/install-B3bIjHoU.mjs.map +0 -1
- package/dist/install-CZ_S7NHm.cjs +0 -1
- package/dist/install-CxPsLO2t.d.cts +0 -28
- package/dist/install-CxPsLO2t.d.cts.map +0 -1
- package/dist/install-dYt7hlQn.d.mts +0 -29
- package/dist/install-dYt7hlQn.d.mts.map +0 -1
- package/dist/is-error-CjEyTRps.cjs +0 -1
- package/dist/is-error-CjVXmD_8.mjs +0 -2
- package/dist/is-error-CjVXmD_8.mjs.map +0 -1
- package/dist/is-file-BkFQev3M.cjs +0 -1
- package/dist/is-file-CNooe8Wz.mjs +0 -2
- package/dist/is-file-CNooe8Wz.mjs.map +0 -1
- package/dist/is-file-DjqOQrqY.d.mts +0 -36
- package/dist/is-file-DjqOQrqY.d.mts.map +0 -1
- package/dist/is-file-DoBi2FN9.d.cts +0 -36
- package/dist/is-file-DoBi2FN9.d.cts.map +0 -1
- package/dist/is-object-FBXmvehR.cjs +0 -1
- package/dist/is-object-UsKYhyC5.mjs +0 -2
- package/dist/is-object-UsKYhyC5.mjs.map +0 -1
- package/dist/is-set-string-CLeu8BKX.cjs +0 -1
- package/dist/is-set-string-Cj0g4gsG.mjs +0 -2
- package/dist/is-set-string-Cj0g4gsG.mjs.map +0 -1
- package/dist/is-string-91Z3dOKQ.mjs +0 -2
- package/dist/is-string-91Z3dOKQ.mjs.map +0 -1
- package/dist/is-string-DKgNS0jA.cjs +0 -1
- package/dist/join-paths-BHepkhAj.mjs +0 -2
- package/dist/join-paths-BHepkhAj.mjs.map +0 -1
- package/dist/join-paths-DUdaieID.cjs +0 -1
- package/dist/json-CYenVxvr.d.cts +0 -83
- package/dist/json-CYenVxvr.d.cts.map +0 -1
- package/dist/json-DH7Q6Ftp.d.mts +0 -83
- package/dist/json-DH7Q6Ftp.d.mts.map +0 -1
- package/dist/json-DKhqPjHB.cjs +0 -6
- package/dist/json-Dp4PSH2i.mjs +0 -7
- package/dist/json-Dp4PSH2i.mjs.map +0 -1
- package/dist/list-files-Cn_UVruo.cjs +0 -1
- package/dist/list-files-D3dQOljX.d.cts +0 -51
- package/dist/list-files-D3dQOljX.d.cts.map +0 -1
- package/dist/list-files-D3iJzEQw.d.mts +0 -51
- package/dist/list-files-D3iJzEQw.d.mts.map +0 -1
- package/dist/list-files-D__uh3tQ.mjs +0 -2
- package/dist/list-files-D__uh3tQ.mjs.map +0 -1
- package/dist/package-fns-BNRi_Rpc.d.cts.map +0 -1
- package/dist/package-fns-C7-MKgBR.mjs +0 -2
- package/dist/package-fns-C7-MKgBR.mjs.map +0 -1
- package/dist/package-fns-CxokaGDY.d.mts.map +0 -1
- package/dist/package-fns-YTCdMAXr.cjs +0 -1
- package/dist/read-file-B091zB64.mjs +0 -2
- package/dist/read-file-B091zB64.mjs.map +0 -1
- package/dist/read-file-BB2WzW-N.cjs +0 -1
- package/dist/read-file-Bxn1VHKv.d.cts +0 -30
- package/dist/read-file-Bxn1VHKv.d.cts.map +0 -1
- package/dist/read-file-CRVW-wcE.d.mts +0 -30
- package/dist/read-file-CRVW-wcE.d.mts.map +0 -1
- package/dist/registry-B1taIPKm.mjs +0 -2
- package/dist/registry-B1taIPKm.mjs.map +0 -1
- package/dist/registry-BQ3JXRFA.d.mts +0 -53
- package/dist/registry-BQ3JXRFA.d.mts.map +0 -1
- package/dist/registry-BYwvM92u.cjs +0 -1
- package/dist/registry-C2A0Kau7.d.cts +0 -53
- package/dist/registry-C2A0Kau7.d.cts.map +0 -1
- package/dist/remove-file-BM64Brdf.mjs +0 -2
- package/dist/remove-file-BM64Brdf.mjs.map +0 -1
- package/dist/remove-file-BqlkL_Df.d.mts +0 -16
- package/dist/remove-file-BqlkL_Df.d.mts.map +0 -1
- package/dist/remove-file-XHFKELQN.cjs +0 -1
- package/dist/remove-file-lQOlxDwr.d.cts +0 -16
- package/dist/remove-file-lQOlxDwr.d.cts.map +0 -1
- package/dist/resolve-C_YsCFne.mjs +0 -4
- package/dist/resolve-C_YsCFne.mjs.map +0 -1
- package/dist/resolve-D66oIwjf.d.mts +0 -106
- package/dist/resolve-D66oIwjf.d.mts.map +0 -1
- package/dist/resolve-DTkLQekH.cjs +0 -3
- package/dist/resolve-DubH-8qd.d.cts +0 -106
- package/dist/resolve-DubH-8qd.d.cts.map +0 -1
- package/dist/resolve-parent-path-CR8av8WP.mjs +0 -2
- package/dist/resolve-parent-path-CR8av8WP.mjs.map +0 -1
- package/dist/resolve-parent-path-D0AaW2PB.cjs +0 -1
- package/dist/semver-fns-B0e5zB6C.d.mts +0 -92
- package/dist/semver-fns-B0e5zB6C.d.mts.map +0 -1
- package/dist/semver-fns-Btrm1dIF.cjs +0 -1
- package/dist/semver-fns-DjhZXnUw.d.cts +0 -92
- package/dist/semver-fns-DjhZXnUw.d.cts.map +0 -1
- package/dist/semver-fns-F_rYnwDq.mjs +0 -2
- package/dist/semver-fns-F_rYnwDq.mjs.map +0 -1
- package/dist/toml-CIgLQmP3.mjs +0 -4
- package/dist/toml-CIgLQmP3.mjs.map +0 -1
- package/dist/toml-D3X2QoaL.d.cts +0 -81
- package/dist/toml-D3X2QoaL.d.cts.map +0 -1
- package/dist/toml-DgVyNp_y.cjs +0 -3
- package/dist/toml-Djau1M6n.d.mts +0 -81
- package/dist/toml-Djau1M6n.d.mts.map +0 -1
- package/dist/tsconfig-B13IMV_0.d.mts.map +0 -1
- package/dist/tsconfig-B6WtgD1c.cjs +0 -1
- package/dist/tsconfig-C8ecu1-0.d.cts.map +0 -1
- package/dist/tsconfig-CqvvSVuX.mjs +0 -2
- package/dist/tsconfig-CqvvSVuX.mjs.map +0 -1
- package/dist/write-file-BmvbsmMj.d.cts +0 -35
- package/dist/write-file-BmvbsmMj.d.cts.map +0 -1
- package/dist/write-file-CFByoJkN.mjs +0 -2
- package/dist/write-file-CFByoJkN.mjs.map +0 -1
- package/dist/write-file-CWTzQpb2.d.mts +0 -35
- package/dist/write-file-CWTzQpb2.d.mts.map +0 -1
- package/dist/write-file-CqokudVp.cjs +0 -1
- package/dist/yaml-6uuLoSfT.d.cts +0 -23
- package/dist/yaml-6uuLoSfT.d.cts.map +0 -1
- package/dist/yaml-CLMo56UG.mjs +0 -2
- package/dist/yaml-CLMo56UG.mjs.map +0 -1
- package/dist/yaml-Ddslc5NK.d.mts +0 -23
- package/dist/yaml-Ddslc5NK.d.mts.map +0 -1
- package/dist/yaml-q2k-BjIM.cjs +0 -1
package/dist/resolve.d.cts
CHANGED
|
@@ -1,2 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/resolve.d.ts
|
|
2
|
+
declare const DEFAULT_EXTENSIONS: string[];
|
|
3
|
+
interface ResolveOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Paths to resolve the package from
|
|
6
|
+
*/
|
|
7
|
+
paths?: string[];
|
|
8
|
+
/**
|
|
9
|
+
* File extensions to consider when resolving the module
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Extensions can be provided with or without the leading dot. The resolver utilities will handle both cases.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue ["js", "jsx", "mjs", "cjs", "ts", "tsx", "mts", "cts", "json", "jsonc", "json5", "node", "wasm"]
|
|
15
|
+
*/
|
|
16
|
+
extensions?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Conditions to consider when resolving package exports.
|
|
19
|
+
*/
|
|
20
|
+
conditions?: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the resolution paths based on the provided paths, current working directory, and workspace root.
|
|
24
|
+
*
|
|
25
|
+
* @param paths - An array of paths to include in the resolution.
|
|
26
|
+
* @returns An array of unique, corrected resolution paths.
|
|
27
|
+
*/
|
|
28
|
+
declare function getResolutionPaths(paths?: string[]): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Get the node_modules resolution paths based on the provided paths.
|
|
31
|
+
*
|
|
32
|
+
* @param paths - An array of paths to include in the resolution.
|
|
33
|
+
* @returns An array of unique, corrected node_modules resolution paths.
|
|
34
|
+
*/
|
|
35
|
+
declare function getNodeModulesPaths(paths?: string[]): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Get all combinations of resolution paths for a given path and options.
|
|
38
|
+
*
|
|
39
|
+
* @param path - The base path to combine with resolution paths.
|
|
40
|
+
* @param options - The options containing resolution paths.
|
|
41
|
+
* @returns An array of unique, corrected resolution paths.
|
|
42
|
+
*/
|
|
43
|
+
declare function getResolutionCombinations(path: string, options?: ResolveOptions): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Resolve the path to a specified module
|
|
46
|
+
*
|
|
47
|
+
* @param path - The path to the module
|
|
48
|
+
* @param options - The options to use when resolving the module
|
|
49
|
+
* @returns A promise for the path to the module
|
|
50
|
+
*/
|
|
51
|
+
declare function resolve(path: string, options?: ResolveOptions): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve the path to a specified module
|
|
54
|
+
*
|
|
55
|
+
* @param path - The path to the module
|
|
56
|
+
* @param options - The options to use when resolving the module
|
|
57
|
+
* @returns The path to the module or undefined
|
|
58
|
+
*/
|
|
59
|
+
declare function resolveSync(path: string, options?: ResolveOptions): string;
|
|
60
|
+
/**
|
|
61
|
+
* Resolve the path to a specified module with error handling
|
|
62
|
+
*
|
|
63
|
+
* @param name - The name of the module
|
|
64
|
+
* @param options - The options to use when resolving the module
|
|
65
|
+
* @returns A promise for the path to the module
|
|
66
|
+
*/
|
|
67
|
+
declare function resolveSafe(name: string, options?: ResolveOptions): Promise<string | undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve the path to a specified module with error handling
|
|
70
|
+
*
|
|
71
|
+
* @param name - The name of the module
|
|
72
|
+
* @param options - The options to use when resolving the module
|
|
73
|
+
* @returns The path to the module or undefined
|
|
74
|
+
*/
|
|
75
|
+
declare function resolveSafeSync(name: string, options?: ResolveOptions): string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Import a module from a specified path
|
|
78
|
+
*
|
|
79
|
+
* @param path - The path to the module
|
|
80
|
+
* @returns The module
|
|
81
|
+
*/
|
|
82
|
+
declare function importModule<T = any>(path: string): Promise<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Resolve the path to a specified package asynchronously
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.
|
|
88
|
+
*
|
|
89
|
+
* @param name - The name of the module
|
|
90
|
+
* @returns A promise for the module or undefined
|
|
91
|
+
*/
|
|
92
|
+
declare function resolvePackage(name: string, options?: ResolveOptions): Promise<string | undefined>;
|
|
93
|
+
/**
|
|
94
|
+
* Resolve the path to a specified package synchronously
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.
|
|
98
|
+
*
|
|
99
|
+
* @param name - The name of the module
|
|
100
|
+
* @param options - The options to use when resolving the module
|
|
101
|
+
* @returns The module or undefined
|
|
102
|
+
*/
|
|
103
|
+
declare function resolvePackageSync(name: string, options?: ResolveOptions): string | undefined;
|
|
104
|
+
//#endregion
|
|
105
|
+
export { DEFAULT_EXTENSIONS, ResolveOptions, getNodeModulesPaths, getResolutionCombinations, getResolutionPaths, importModule, resolve, resolvePackage, resolvePackageSync, resolveSafe, resolveSafeSync, resolveSync };
|
|
106
|
+
//# sourceMappingURL=resolve.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.cts","names":[],"sources":["../src/resolve.ts"],"sourcesContent":[],"mappings":";cAkCa;AAAA,UAeI,cAAA,CAFhB;EAEgB;AA4BjB;AAuCA;EAuBgB,KAAA,CAAA,EAAA,MAAA,EAAA;EA4CM;AA2DtB;AAuEA;AAeA;AAcA;AAmBA;AAyBA;;;;;;;;;;;;;;iBArTgB,kBAAA;;;;;;;iBAuCA,mBAAA;;;;;;;;iBAuBA,yBAAA,yBAEL;;;;;;;;iBA0CW,OAAA,yBAEX,iBACR;;;;;;;;iBAwDa,WAAA,yBAAmC;;;;;;;;iBAuE7B,WAAA,yBAAmC,iBAAmB;;;;;;;;iBAe5D,eAAA,yBAAuC;;;;;;;iBAcjC,qCAAqC,QAAQ;;;;;;;;;;iBAmB7C,cAAA,yBAEX,iBAAmB;;;;;;;;;;;iBAuBd,kBAAA,yBAA0C"}
|
package/dist/resolve.d.mts
CHANGED
|
@@ -1,2 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/resolve.d.ts
|
|
2
|
+
declare const DEFAULT_EXTENSIONS: string[];
|
|
3
|
+
interface ResolveOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Paths to resolve the package from
|
|
6
|
+
*/
|
|
7
|
+
paths?: string[];
|
|
8
|
+
/**
|
|
9
|
+
* File extensions to consider when resolving the module
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Extensions can be provided with or without the leading dot. The resolver utilities will handle both cases.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue ["js", "jsx", "mjs", "cjs", "ts", "tsx", "mts", "cts", "json", "jsonc", "json5", "node", "wasm"]
|
|
15
|
+
*/
|
|
16
|
+
extensions?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Conditions to consider when resolving package exports.
|
|
19
|
+
*/
|
|
20
|
+
conditions?: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the resolution paths based on the provided paths, current working directory, and workspace root.
|
|
24
|
+
*
|
|
25
|
+
* @param paths - An array of paths to include in the resolution.
|
|
26
|
+
* @returns An array of unique, corrected resolution paths.
|
|
27
|
+
*/
|
|
28
|
+
declare function getResolutionPaths(paths?: string[]): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Get the node_modules resolution paths based on the provided paths.
|
|
31
|
+
*
|
|
32
|
+
* @param paths - An array of paths to include in the resolution.
|
|
33
|
+
* @returns An array of unique, corrected node_modules resolution paths.
|
|
34
|
+
*/
|
|
35
|
+
declare function getNodeModulesPaths(paths?: string[]): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Get all combinations of resolution paths for a given path and options.
|
|
38
|
+
*
|
|
39
|
+
* @param path - The base path to combine with resolution paths.
|
|
40
|
+
* @param options - The options containing resolution paths.
|
|
41
|
+
* @returns An array of unique, corrected resolution paths.
|
|
42
|
+
*/
|
|
43
|
+
declare function getResolutionCombinations(path: string, options?: ResolveOptions): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Resolve the path to a specified module
|
|
46
|
+
*
|
|
47
|
+
* @param path - The path to the module
|
|
48
|
+
* @param options - The options to use when resolving the module
|
|
49
|
+
* @returns A promise for the path to the module
|
|
50
|
+
*/
|
|
51
|
+
declare function resolve(path: string, options?: ResolveOptions): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve the path to a specified module
|
|
54
|
+
*
|
|
55
|
+
* @param path - The path to the module
|
|
56
|
+
* @param options - The options to use when resolving the module
|
|
57
|
+
* @returns The path to the module or undefined
|
|
58
|
+
*/
|
|
59
|
+
declare function resolveSync(path: string, options?: ResolveOptions): string;
|
|
60
|
+
/**
|
|
61
|
+
* Resolve the path to a specified module with error handling
|
|
62
|
+
*
|
|
63
|
+
* @param name - The name of the module
|
|
64
|
+
* @param options - The options to use when resolving the module
|
|
65
|
+
* @returns A promise for the path to the module
|
|
66
|
+
*/
|
|
67
|
+
declare function resolveSafe(name: string, options?: ResolveOptions): Promise<string | undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve the path to a specified module with error handling
|
|
70
|
+
*
|
|
71
|
+
* @param name - The name of the module
|
|
72
|
+
* @param options - The options to use when resolving the module
|
|
73
|
+
* @returns The path to the module or undefined
|
|
74
|
+
*/
|
|
75
|
+
declare function resolveSafeSync(name: string, options?: ResolveOptions): string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Import a module from a specified path
|
|
78
|
+
*
|
|
79
|
+
* @param path - The path to the module
|
|
80
|
+
* @returns The module
|
|
81
|
+
*/
|
|
82
|
+
declare function importModule<T = any>(path: string): Promise<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Resolve the path to a specified package asynchronously
|
|
85
|
+
*
|
|
86
|
+
* @remarks
|
|
87
|
+
* This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.
|
|
88
|
+
*
|
|
89
|
+
* @param name - The name of the module
|
|
90
|
+
* @returns A promise for the module or undefined
|
|
91
|
+
*/
|
|
92
|
+
declare function resolvePackage(name: string, options?: ResolveOptions): Promise<string | undefined>;
|
|
93
|
+
/**
|
|
94
|
+
* Resolve the path to a specified package synchronously
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.
|
|
98
|
+
*
|
|
99
|
+
* @param name - The name of the module
|
|
100
|
+
* @param options - The options to use when resolving the module
|
|
101
|
+
* @returns The module or undefined
|
|
102
|
+
*/
|
|
103
|
+
declare function resolvePackageSync(name: string, options?: ResolveOptions): string | undefined;
|
|
104
|
+
//#endregion
|
|
105
|
+
export { DEFAULT_EXTENSIONS, ResolveOptions, getNodeModulesPaths, getResolutionCombinations, getResolutionPaths, importModule, resolve, resolvePackage, resolvePackageSync, resolveSafe, resolveSafeSync, resolveSync };
|
|
106
|
+
//# sourceMappingURL=resolve.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.mts","names":[],"sources":["../src/resolve.ts"],"sourcesContent":[],"mappings":";cAkCa;AAAA,UAeI,cAAA,CAFhB;EAEgB;AA4BjB;AAuCA;EAuBgB,KAAA,CAAA,EAAA,MAAA,EAAA;EA4CM;AA2DtB;AAuEA;AAeA;AAcA;AAmBA;AAyBA;;;;;;;;;;;;;;iBArTgB,kBAAA;;;;;;;iBAuCA,mBAAA;;;;;;;;iBAuBA,yBAAA,yBAEL;;;;;;;;iBA0CW,OAAA,yBAEX,iBACR;;;;;;;;iBAwDa,WAAA,yBAAmC;;;;;;;;iBAuE7B,WAAA,yBAAmC,iBAAmB;;;;;;;;iBAe5D,eAAA,yBAAuC;;;;;;;iBAcjC,qCAAqC,QAAQ;;;;;;;;;;iBAmB7C,cAAA,yBAEX,iBAAmB;;;;;;;;;;;iBAuBd,kBAAA,yBAA0C"}
|
package/dist/resolve.mjs
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import"./
|
|
1
|
+
import{cwd as e}from"./path/src/cwd.mjs";import{isAbsolutePath as t,isNpmScopedPackage as n}from"./path/src/is-type.mjs";import{joinPaths as r}from"./path/src/join-paths.mjs";import{appendExtension as i}from"./path/src/append.mjs";import{correctPath as a,toAbsolutePath as o}from"./path/src/correct-path.mjs";import{findFileExtension as s,findFileName as c,findFilePath as l,findFolderName as u}from"./path/src/file-path-fns.mjs";import{existsSync as d}from"./exists.mjs";import{getWorkspaceRoot as f}from"./get-workspace-root.mjs";import{getUnique as p}from"./helpers/src/get-unique.mjs";import{interopDefault as m,resolvePath as h,resolvePathSync as g}from"mlly";const _=[`js`,`jsx`,`mjs`,`cjs`,`ts`,`tsx`,`mts`,`cts`,`json`,`jsonc`,`json5`,`node`];function v(n=[]){let r=n;r.includes(e())||r.push(e());let i=f();return r.includes(i)||r.push(i),r=p(r.filter(Boolean).map(e=>a(e)).reduce((n,r,a,s)=>(n.push(r),t(r)||(n.push(o(r,e())),n.push(o(r,i)),s.forEach(e=>{n.push(o(r,e))})),n),[])),r}function y(e=[]){return p(e.reduce((e,t)=>(u(t)===`node_modules`&&e.push(a(t)),d(r(t,`node_modules`))&&e.push(a(r(t,`node_modules`))),e),[]))}function b(e,t={}){let o=v(t.paths);n(e)?o=y(o):o.push(...y(o));let l=t.extensions??_,u=o.map(t=>r(t,e));return c(e,{withExtension:!1})!==`index`&&(u=u.reduce((e,t)=>(e.push(t),e.push(r(t,`index`)),e),[])),s(e)||(u=u.reduce((e,t)=>(e.push(t),l.forEach(n=>{e.push(i(t,n))}),e),[])),p(u.filter(Boolean)).map(e=>a(e))}async function x(e,t={}){let r=v(t.paths);n(e)?r=y(r):r.push(...y(r));let i,o;try{i=await h(e,{url:r,extensions:t.extensions??_,conditions:t.conditions})}catch(e){o=e}if(!i)throw Error(`Unable to resolve module "${e}". The following import paths were tried: \n${r.join(`
|
|
2
|
+
`)}`,{cause:o});return a(i)}function S(e,t={}){let r=v(t.paths);n(e)?r=y(r):r.push(...y(r));let i,o;try{i=g(e,{url:r,extensions:t.extensions??_,conditions:t.conditions})}catch(e){o=e}if(!i)throw Error(`Unable to resolve module "${e}". The following import paths were tried: \n${r.join(`
|
|
3
|
+
`)}`,{cause:o});return a(i)}async function C(e,t={}){try{return await x(e,t)}catch{return}}function w(e,t={}){try{return S(e,t)}catch{return}}async function T(e){let t=await import(e);return t&&m(t)}async function E(e,t={}){let n=await C(r(e,`package.json`),t);return n||(n=await C(r(e,`index.js`),t),n||=await C(e,t)),n?l(n):void 0}function D(e,t={}){let n=w(r(e,`package.json`),t);return n||(n=w(r(e,`index.js`),t),n||=w(e,t)),n?l(n):void 0}export{_ as DEFAULT_EXTENSIONS,y as getNodeModulesPaths,b as getResolutionCombinations,v as getResolutionPaths,T as importModule,x as resolve,E as resolvePackage,D as resolvePackageSync,C as resolveSafe,w as resolveSafeSync,S as resolveSync};
|
|
4
|
+
//# sourceMappingURL=resolve.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.mjs","names":["result: string | undefined","error: Error | undefined","result!: string"],"sources":["../src/resolve.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 { getUnique } from \"@stryke/helpers/get-unique\";\nimport { appendExtension } from \"@stryke/path\";\nimport { correctPath, toAbsolutePath } from \"@stryke/path/correct-path\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport {\n findFileExtension,\n findFileName,\n findFilePath,\n findFolderName\n} from \"@stryke/path/file-path-fns\";\nimport { isAbsolutePath, isNpmScopedPackage } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { interopDefault, resolvePath, resolvePathSync } from \"mlly\";\nimport { existsSync } from \"./exists\";\nimport { getWorkspaceRoot } from \"./get-workspace-root\";\n\nexport const DEFAULT_EXTENSIONS = [\n \"js\",\n \"jsx\",\n \"mjs\",\n \"cjs\",\n \"ts\",\n \"tsx\",\n \"mts\",\n \"cts\",\n \"json\",\n \"jsonc\",\n \"json5\",\n \"node\"\n];\n\nexport interface ResolveOptions {\n /**\n * Paths to resolve the package from\n */\n paths?: string[];\n\n /**\n * File extensions to consider when resolving the module\n *\n * @remarks\n * Extensions can be provided with or without the leading dot. The resolver utilities will handle both cases.\n *\n * @defaultValue [\"js\", \"jsx\", \"mjs\", \"cjs\", \"ts\", \"tsx\", \"mts\", \"cts\", \"json\", \"jsonc\", \"json5\", \"node\", \"wasm\"]\n */\n extensions?: string[];\n\n /**\n * Conditions to consider when resolving package exports.\n */\n conditions?: string[];\n}\n\n/**\n * Get the resolution paths based on the provided paths, current working directory, and workspace root.\n *\n * @param paths - An array of paths to include in the resolution.\n * @returns An array of unique, corrected resolution paths.\n */\nexport function getResolutionPaths(paths: string[] = []) {\n let resolutionPaths = paths;\n if (!resolutionPaths.includes(cwd())) {\n resolutionPaths.push(cwd());\n }\n\n const workspaceRoot = getWorkspaceRoot();\n if (!resolutionPaths.includes(workspaceRoot)) {\n resolutionPaths.push(workspaceRoot);\n }\n\n resolutionPaths = getUnique(\n resolutionPaths\n .filter(Boolean)\n .map(path => correctPath(path))\n .reduce((ret, path, _, arr) => {\n ret.push(path);\n if (!isAbsolutePath(path)) {\n ret.push(toAbsolutePath(path, cwd()));\n ret.push(toAbsolutePath(path, workspaceRoot));\n\n arr.forEach(existing => {\n ret.push(toAbsolutePath(path, existing));\n });\n }\n\n return ret;\n }, [] as string[])\n );\n\n return resolutionPaths;\n}\n\n/**\n * Get the node_modules resolution paths based on the provided paths.\n *\n * @param paths - An array of paths to include in the resolution.\n * @returns An array of unique, corrected node_modules resolution paths.\n */\nexport function getNodeModulesPaths(paths: string[] = []) {\n return getUnique(\n paths.reduce((ret, path) => {\n if (findFolderName(path) === \"node_modules\") {\n ret.push(correctPath(path));\n }\n\n if (existsSync(joinPaths(path, \"node_modules\"))) {\n ret.push(correctPath(joinPaths(path, \"node_modules\")));\n }\n\n return ret;\n }, [] as string[])\n );\n}\n\n/**\n * Get all combinations of resolution paths for a given path and options.\n *\n * @param path - The base path to combine with resolution paths.\n * @param options - The options containing resolution paths.\n * @returns An array of unique, corrected resolution paths.\n */\nexport function getResolutionCombinations(\n path: string,\n options: ResolveOptions = {}\n) {\n let paths = getResolutionPaths(options.paths);\n if (isNpmScopedPackage(path)) {\n paths = getNodeModulesPaths(paths);\n } else {\n paths.push(...getNodeModulesPaths(paths));\n }\n\n const extensions = options.extensions ?? DEFAULT_EXTENSIONS;\n\n let combinations = paths.map(base => joinPaths(base, path));\n if (findFileName(path, { withExtension: false }) !== \"index\") {\n combinations = combinations.reduce((ret, combination) => {\n ret.push(combination);\n ret.push(joinPaths(combination, \"index\"));\n\n return ret;\n }, [] as string[]);\n }\n\n if (!findFileExtension(path)) {\n combinations = combinations.reduce((ret, combination) => {\n ret.push(combination);\n extensions.forEach(ext => {\n ret.push(appendExtension(combination, ext));\n });\n\n return ret;\n }, [] as string[]);\n }\n\n return getUnique(combinations.filter(Boolean)).map(p => correctPath(p));\n}\n\n/**\n * Resolve the path to a specified module\n *\n * @param path - The path to the module\n * @param options - The options to use when resolving the module\n * @returns A promise for the path to the module\n */\nexport async function resolve(\n path: string,\n options: ResolveOptions = {}\n): Promise<string> {\n let paths = getResolutionPaths(options.paths);\n if (isNpmScopedPackage(path)) {\n paths = getNodeModulesPaths(paths);\n } else {\n paths.push(...getNodeModulesPaths(paths));\n }\n\n let result: string | undefined;\n let error: Error | undefined;\n\n try {\n result = await resolvePath(path, {\n url: paths,\n extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n conditions: options.conditions\n });\n } catch (err) {\n error = err as Error;\n }\n\n // if (!result) {\n // for (let i = 0; i < paths.length && !result; i++) {\n // try {\n // result = await resolvePath(replacePath(path, paths[i]), {\n // url: paths,\n // extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n // conditions: options.conditions\n // });\n // } catch (err) {\n // error = err as Error;\n // }\n // }\n // }\n\n if (!result) {\n throw new Error(\n `Unable to resolve module \"${\n path\n }\". The following import paths were tried: \\n${paths.join(\"\\n\")}`,\n {\n cause: error\n }\n );\n }\n\n return correctPath(result);\n}\n\n/**\n * Resolve the path to a specified module\n *\n * @param path - The path to the module\n * @param options - The options to use when resolving the module\n * @returns The path to the module or undefined\n */\nexport function resolveSync(path: string, options: ResolveOptions = {}) {\n let paths = getResolutionPaths(options.paths);\n if (isNpmScopedPackage(path)) {\n paths = getNodeModulesPaths(paths);\n } else {\n paths.push(...getNodeModulesPaths(paths));\n }\n\n let result!: string;\n let error: Error | undefined;\n\n try {\n result = resolvePathSync(path, {\n url: paths,\n extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n conditions: options.conditions\n });\n } catch (err) {\n error = err as Error;\n }\n\n // if (!result) {\n // for (let i = 0; i < paths.length && !result; i++) {\n // try {\n // result = resolvePathSync(replacePath(path, paths[i]), {\n // url: paths,\n // extensions: options.extensions ?? DEFAULT_EXTENSIONS,\n // conditions: options.conditions\n // });\n // } catch (err) {\n // error = err as Error;\n // }\n // }\n // }\n\n // if (!result && findFileName(path, { withExtension: false }) !== \"index\") {\n // try {\n // result = resolveSync(joinPaths(path, \"index\"), {\n // ...options,\n // paths\n // });\n // if (result) {\n // // Remove the previously added index file from the path\n // result = findFilePath(result);\n // }\n // } catch (err) {\n // error = err as Error;\n // }\n // }\n\n if (!result) {\n throw new Error(\n `Unable to resolve module \"${\n path\n }\". The following import paths were tried: \\n${paths.join(\"\\n\")}`,\n {\n cause: error\n }\n );\n }\n\n return correctPath(result);\n}\n\n/**\n * Resolve the path to a specified module with error handling\n *\n * @param name - The name of the module\n * @param options - The options to use when resolving the module\n * @returns A promise for the path to the module\n */\nexport async function resolveSafe(name: string, options: ResolveOptions = {}) {\n try {\n return await resolve(name, options);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Resolve the path to a specified module with error handling\n *\n * @param name - The name of the module\n * @param options - The options to use when resolving the module\n * @returns The path to the module or undefined\n */\nexport function resolveSafeSync(name: string, options: ResolveOptions = {}) {\n try {\n return resolveSync(name, options);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Import a module from a specified path\n *\n * @param path - The path to the module\n * @returns The module\n */\nexport async function importModule<T = any>(path: string): Promise<T> {\n const i = await import(path);\n\n if (i) {\n return interopDefault(i);\n }\n\n return i;\n}\n\n/**\n * Resolve the path to a specified package asynchronously\n *\n * @remarks\n * This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.\n *\n * @param name - The name of the module\n * @returns A promise for the module or undefined\n */\nexport async function resolvePackage(\n name: string,\n options: ResolveOptions = {}\n) {\n let result = await resolveSafe(joinPaths(name, \"package.json\"), options);\n if (!result) {\n result = await resolveSafe(joinPaths(name, \"index.js\"), options);\n if (!result) {\n result = await resolveSafe(name, options);\n }\n }\n\n return result ? findFilePath(result) : undefined;\n}\n\n/**\n * Resolve the path to a specified package synchronously\n *\n * @remarks\n * This path points to the root of the package, which is usually the directory containing the `package.json` file. Please note: this path does not include the `package.json` file itself.\n *\n * @param name - The name of the module\n * @param options - The options to use when resolving the module\n * @returns The module or undefined\n */\nexport function resolvePackageSync(name: string, options: ResolveOptions = {}) {\n let result = resolveSafeSync(joinPaths(name, \"package.json\"), options);\n if (!result) {\n result = resolveSafeSync(joinPaths(name, \"index.js\"), options);\n if (!result) {\n result = resolveSafeSync(name, options);\n }\n }\n\n return result ? findFilePath(result) : undefined;\n}\n"],"mappings":"ypBAkCA,MAAa,EAAqB,CAChC,KACA,MACA,MACA,MACA,KACA,MACA,MACA,MACA,OACA,QACA,QACA,OACD,CA8BD,SAAgB,EAAmB,EAAkB,EAAE,CAAE,CACvD,IAAI,EAAkB,EACjB,EAAgB,SAAS,GAAK,CAAC,EAClC,EAAgB,KAAK,GAAK,CAAC,CAG7B,IAAM,EAAgB,GAAkB,CAwBxC,OAvBK,EAAgB,SAAS,EAAc,EAC1C,EAAgB,KAAK,EAAc,CAGrC,EAAkB,EAChB,EACG,OAAO,QAAQ,CACf,IAAI,GAAQ,EAAY,EAAK,CAAC,CAC9B,QAAQ,EAAK,EAAM,EAAG,KACrB,EAAI,KAAK,EAAK,CACT,EAAe,EAAK,GACvB,EAAI,KAAK,EAAe,EAAM,GAAK,CAAC,CAAC,CACrC,EAAI,KAAK,EAAe,EAAM,EAAc,CAAC,CAE7C,EAAI,QAAQ,GAAY,CACtB,EAAI,KAAK,EAAe,EAAM,EAAS,CAAC,EACxC,EAGG,GACN,EAAE,CAAa,CACrB,CAEM,EAST,SAAgB,EAAoB,EAAkB,EAAE,CAAE,CACxD,OAAO,EACL,EAAM,QAAQ,EAAK,KACb,EAAe,EAAK,GAAK,gBAC3B,EAAI,KAAK,EAAY,EAAK,CAAC,CAGzB,EAAW,EAAU,EAAM,eAAe,CAAC,EAC7C,EAAI,KAAK,EAAY,EAAU,EAAM,eAAe,CAAC,CAAC,CAGjD,GACN,EAAE,CAAa,CACnB,CAUH,SAAgB,EACd,EACA,EAA0B,EAAE,CAC5B,CACA,IAAI,EAAQ,EAAmB,EAAQ,MAAM,CACzC,EAAmB,EAAK,CAC1B,EAAQ,EAAoB,EAAM,CAElC,EAAM,KAAK,GAAG,EAAoB,EAAM,CAAC,CAG3C,IAAM,EAAa,EAAQ,YAAc,EAErC,EAAe,EAAM,IAAI,GAAQ,EAAU,EAAM,EAAK,CAAC,CAqB3D,OApBI,EAAa,EAAM,CAAE,cAAe,GAAO,CAAC,GAAK,UACnD,EAAe,EAAa,QAAQ,EAAK,KACvC,EAAI,KAAK,EAAY,CACrB,EAAI,KAAK,EAAU,EAAa,QAAQ,CAAC,CAElC,GACN,EAAE,CAAa,EAGf,EAAkB,EAAK,GAC1B,EAAe,EAAa,QAAQ,EAAK,KACvC,EAAI,KAAK,EAAY,CACrB,EAAW,QAAQ,GAAO,CACxB,EAAI,KAAK,EAAgB,EAAa,EAAI,CAAC,EAC3C,CAEK,GACN,EAAE,CAAa,EAGb,EAAU,EAAa,OAAO,QAAQ,CAAC,CAAC,IAAI,GAAK,EAAY,EAAE,CAAC,CAUzE,eAAsB,EACpB,EACA,EAA0B,EAAE,CACX,CACjB,IAAI,EAAQ,EAAmB,EAAQ,MAAM,CACzC,EAAmB,EAAK,CAC1B,EAAQ,EAAoB,EAAM,CAElC,EAAM,KAAK,GAAG,EAAoB,EAAM,CAAC,CAG3C,IAAIA,EACAC,EAEJ,GAAI,CACF,EAAS,MAAM,EAAY,EAAM,CAC/B,IAAK,EACL,WAAY,EAAQ,YAAc,EAClC,WAAY,EAAQ,WACrB,CAAC,OACK,EAAK,CACZ,EAAQ,EAiBV,GAAI,CAAC,EACH,MAAU,MACR,6BACE,EACD,8CAA8C,EAAM,KAAK;EAAK,GAC/D,CACE,MAAO,EACR,CACF,CAGH,OAAO,EAAY,EAAO,CAU5B,SAAgB,EAAY,EAAc,EAA0B,EAAE,CAAE,CACtE,IAAI,EAAQ,EAAmB,EAAQ,MAAM,CACzC,EAAmB,EAAK,CAC1B,EAAQ,EAAoB,EAAM,CAElC,EAAM,KAAK,GAAG,EAAoB,EAAM,CAAC,CAG3C,IAAIC,EACAD,EAEJ,GAAI,CACF,EAAS,EAAgB,EAAM,CAC7B,IAAK,EACL,WAAY,EAAQ,YAAc,EAClC,WAAY,EAAQ,WACrB,CAAC,OACK,EAAK,CACZ,EAAQ,EAgCV,GAAI,CAAC,EACH,MAAU,MACR,6BACE,EACD,8CAA8C,EAAM,KAAK;EAAK,GAC/D,CACE,MAAO,EACR,CACF,CAGH,OAAO,EAAY,EAAO,CAU5B,eAAsB,EAAY,EAAc,EAA0B,EAAE,CAAE,CAC5E,GAAI,CACF,OAAO,MAAM,EAAQ,EAAM,EAAQ,MAC7B,CACN,QAWJ,SAAgB,EAAgB,EAAc,EAA0B,EAAE,CAAE,CAC1E,GAAI,CACF,OAAO,EAAY,EAAM,EAAQ,MAC3B,CACN,QAUJ,eAAsB,EAAsB,EAA0B,CACpE,IAAM,EAAI,MAAM,OAAO,GAMvB,OAJI,GACK,EAAe,EAAE,CAe5B,eAAsB,EACpB,EACA,EAA0B,EAAE,CAC5B,CACA,IAAI,EAAS,MAAM,EAAY,EAAU,EAAM,eAAe,CAAE,EAAQ,CAQxE,OAPK,IACH,EAAS,MAAM,EAAY,EAAU,EAAM,WAAW,CAAE,EAAQ,CAChE,AACE,IAAS,MAAM,EAAY,EAAM,EAAQ,EAItC,EAAS,EAAa,EAAO,CAAG,IAAA,GAazC,SAAgB,EAAmB,EAAc,EAA0B,EAAE,CAAE,CAC7E,IAAI,EAAS,EAAgB,EAAU,EAAM,eAAe,CAAE,EAAQ,CAQtE,OAPK,IACH,EAAS,EAAgB,EAAU,EAAM,WAAW,CAAE,EAAQ,CAC9D,AACE,IAAS,EAAgB,EAAM,EAAQ,EAIpC,EAAS,EAAa,EAAO,CAAG,IAAA"}
|
package/dist/semver-fns.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./type-checks/src/is-string.cjs`),n=require(`./type-checks/src/is-object.cjs`);let r=require(`semver`);const i=(e,t=!0)=>(0,r.parse)(e,t),a=(e,t)=>(0,r.coerce)(e,t),o=e=>n.isObject(e)&&`version`in e,s=e=>n.isObject(e)&&`range`in e,c=(e,n=!0)=>(t.isString(e)||o(e))&&(0,r.valid)(e,n)!==null,l=(e,n=!0)=>(t.isString(e)||s(e))&&(0,r.validRange)(e,n)!==null,u=(e,t=!0)=>c(e,t)||l(e,t),d=(e,t,n=!0)=>!e||!t||!c(e,n)||!l(t,n)?!1:(0,r.satisfies)(e,t,{loose:n}),f=e=>r.RELEASE_TYPES.includes(e),p=(e,t,n)=>{if(!(0,r.valid)(e))throw Error(`Invalid semver version "${e}" provided.`);let i=t;if(f(t)){let a=(0,r.inc)(e,t,n);if(!a)throw Error(`Unable to derive new version from current version "${e}" and version specifier "${t}"`);i=a}else if(!(0,r.valid)(t))throw Error(`Invalid semver version specifier "${t}" provided. Please provide either a valid semver version or a valid semver version keyword.`);return i};exports.coerceVersion=a,exports.deriveNewSemverVersion=p,exports.isRange=s,exports.isRelativeVersionKeyword=f,exports.isSemver=o,exports.isValidRange=l,exports.isValidSemver=c,exports.isValidVersion=u,exports.parseVersion=i,exports.satisfiesVersion=d;
|
package/dist/semver-fns.d.cts
CHANGED
|
@@ -1,2 +1,92 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { CoerceOptions, Range, ReleaseType, SemVer } from "semver";
|
|
2
|
+
|
|
3
|
+
//#region src/semver-fns.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parse a semver string into a SemVer object
|
|
7
|
+
*
|
|
8
|
+
* @param semver - The semver string to parse
|
|
9
|
+
* @param loose - Whether to use loose parsing
|
|
10
|
+
* @returns The parsed SemVer object
|
|
11
|
+
*/
|
|
12
|
+
declare const parseVersion: (semver: string, loose?: boolean) => SemVer | null;
|
|
13
|
+
/**
|
|
14
|
+
* Coerce a version string into a valid SemVer string
|
|
15
|
+
*
|
|
16
|
+
* @param version - The version string or number or {@link SemVer} to coerce
|
|
17
|
+
* @param options - Options to use when coercing the version
|
|
18
|
+
* @returns The coerced SemVer string or null if invalid
|
|
19
|
+
*/
|
|
20
|
+
declare const coerceVersion: (version: string | number | SemVer | null | undefined, options?: CoerceOptions) => SemVer | null;
|
|
21
|
+
/**
|
|
22
|
+
* Type check for {@link SemVer}
|
|
23
|
+
*
|
|
24
|
+
* @param val - The value to check
|
|
25
|
+
* @returns Whether the value is a valid {@link SemVer}
|
|
26
|
+
*/
|
|
27
|
+
declare const isSemver: (val: any) => val is SemVer;
|
|
28
|
+
/**
|
|
29
|
+
* Type check for {@link Range}
|
|
30
|
+
*
|
|
31
|
+
* @param val - The value to check
|
|
32
|
+
* @returns Whether the value is a valid {@link Range}
|
|
33
|
+
*/
|
|
34
|
+
declare const isRange: (val: any) => val is Range;
|
|
35
|
+
/**
|
|
36
|
+
* Check if a {@link SemVer} string is valid
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* If you're looking for type checking, please use the {@link isSemver} function.
|
|
40
|
+
*
|
|
41
|
+
* @param semver - The semver string to check
|
|
42
|
+
* @param loose - Whether to use loose parsing
|
|
43
|
+
* @returns Whether the semver string is valid
|
|
44
|
+
*/
|
|
45
|
+
declare const isValidSemver: (semver: any, loose?: boolean) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a {@link Range} string is valid
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* If you're looking for type checking, please use the {@link isRange} function.
|
|
51
|
+
*
|
|
52
|
+
* @param range - The range string to check
|
|
53
|
+
* @param loose - Whether to use loose parsing
|
|
54
|
+
* @returns Whether the range string is valid
|
|
55
|
+
*/
|
|
56
|
+
declare const isValidRange: (range: any, loose?: boolean) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a {@link SemVer} or {@link Range} string is valid
|
|
59
|
+
*
|
|
60
|
+
* @param version - The semver string to check
|
|
61
|
+
* @param loose - Whether to use loose parsing
|
|
62
|
+
* @returns Whether the semver string is valid
|
|
63
|
+
*/
|
|
64
|
+
declare const isValidVersion: (version: string | SemVer | Range | null | undefined, loose?: boolean) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Check if a semver string satisfies a range
|
|
67
|
+
*
|
|
68
|
+
* @param version - The semver string to check
|
|
69
|
+
* @param range - The range to check against
|
|
70
|
+
* @param loose - Whether to use loose parsing
|
|
71
|
+
* @returns Whether the semver string satisfies the range
|
|
72
|
+
*/
|
|
73
|
+
declare const satisfiesVersion: (version: string | SemVer | null | undefined, range: string | Range | null | undefined, loose?: boolean) => boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Check if a string is a valid relative version keyword
|
|
76
|
+
*
|
|
77
|
+
* @param val - The string to check
|
|
78
|
+
* @returns Whether the string is a valid relative version keyword
|
|
79
|
+
*/
|
|
80
|
+
declare const isRelativeVersionKeyword: (val: string) => val is ReleaseType;
|
|
81
|
+
/**
|
|
82
|
+
* Derive a new semver version from the current version and a version specifier
|
|
83
|
+
*
|
|
84
|
+
* @param currentSemverVersion - The current semver version
|
|
85
|
+
* @param semverSpecifier - The semver specifier to use
|
|
86
|
+
* @param preid - The pre-release identifier to use
|
|
87
|
+
* @returns The derived new semver version
|
|
88
|
+
*/
|
|
89
|
+
declare const deriveNewSemverVersion: (currentSemverVersion: string, semverSpecifier: string, preid?: string) => string;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { coerceVersion, deriveNewSemverVersion, isRange, isRelativeVersionKeyword, isSemver, isValidRange, isValidSemver, isValidVersion, parseVersion, satisfiesVersion };
|
|
92
|
+
//# sourceMappingURL=semver-fns.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semver-fns.d.cts","names":[],"sources":["../src/semver-fns.ts"],"sourcesContent":[],"mappings":";;;;;;AAsCA;AAUA;;;;AAGS,cAbI,YAaJ,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,KAAA,CAAA,EAAA,OAAA,EAAA,GAbgD,MAahD,GAAA,IAAA;AAUT;AAUA;AAcA;AAgBA;AAaA;AAeA;AAuBA;AAYa,cApHA,aAmJZ,EAAA,CAAA,OAAA,EAAA,MAAA,GAAA,MAAA,GAlJ4B,MAkJ5B,GAAA,IAAA,GAAA,SAAA,EAAA,OAAA,CAAA,EAjJW,aAiJX,EAAA,GAhJE,MAgJF,GAAA,IAAA;;;;;;;cAtIY,+BAA8B;;;;;;;cAU9B,8BAA6B;;;;;;;;;;;cAc7B;;;;;;;;;;;cAgBA;;;;;;;;cAaA,mCACO,SAAS;;;;;;;;;cAchB,qCACO,2CACF;;;;;;;cAqBL,kDAAiD;;;;;;;;;cAYjD"}
|
package/dist/semver-fns.d.mts
CHANGED
|
@@ -1,2 +1,92 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { CoerceOptions, Range, ReleaseType, SemVer } from "semver";
|
|
2
|
+
|
|
3
|
+
//#region src/semver-fns.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parse a semver string into a SemVer object
|
|
7
|
+
*
|
|
8
|
+
* @param semver - The semver string to parse
|
|
9
|
+
* @param loose - Whether to use loose parsing
|
|
10
|
+
* @returns The parsed SemVer object
|
|
11
|
+
*/
|
|
12
|
+
declare const parseVersion: (semver: string, loose?: boolean) => SemVer | null;
|
|
13
|
+
/**
|
|
14
|
+
* Coerce a version string into a valid SemVer string
|
|
15
|
+
*
|
|
16
|
+
* @param version - The version string or number or {@link SemVer} to coerce
|
|
17
|
+
* @param options - Options to use when coercing the version
|
|
18
|
+
* @returns The coerced SemVer string or null if invalid
|
|
19
|
+
*/
|
|
20
|
+
declare const coerceVersion: (version: string | number | SemVer | null | undefined, options?: CoerceOptions) => SemVer | null;
|
|
21
|
+
/**
|
|
22
|
+
* Type check for {@link SemVer}
|
|
23
|
+
*
|
|
24
|
+
* @param val - The value to check
|
|
25
|
+
* @returns Whether the value is a valid {@link SemVer}
|
|
26
|
+
*/
|
|
27
|
+
declare const isSemver: (val: any) => val is SemVer;
|
|
28
|
+
/**
|
|
29
|
+
* Type check for {@link Range}
|
|
30
|
+
*
|
|
31
|
+
* @param val - The value to check
|
|
32
|
+
* @returns Whether the value is a valid {@link Range}
|
|
33
|
+
*/
|
|
34
|
+
declare const isRange: (val: any) => val is Range;
|
|
35
|
+
/**
|
|
36
|
+
* Check if a {@link SemVer} string is valid
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* If you're looking for type checking, please use the {@link isSemver} function.
|
|
40
|
+
*
|
|
41
|
+
* @param semver - The semver string to check
|
|
42
|
+
* @param loose - Whether to use loose parsing
|
|
43
|
+
* @returns Whether the semver string is valid
|
|
44
|
+
*/
|
|
45
|
+
declare const isValidSemver: (semver: any, loose?: boolean) => boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a {@link Range} string is valid
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* If you're looking for type checking, please use the {@link isRange} function.
|
|
51
|
+
*
|
|
52
|
+
* @param range - The range string to check
|
|
53
|
+
* @param loose - Whether to use loose parsing
|
|
54
|
+
* @returns Whether the range string is valid
|
|
55
|
+
*/
|
|
56
|
+
declare const isValidRange: (range: any, loose?: boolean) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a {@link SemVer} or {@link Range} string is valid
|
|
59
|
+
*
|
|
60
|
+
* @param version - The semver string to check
|
|
61
|
+
* @param loose - Whether to use loose parsing
|
|
62
|
+
* @returns Whether the semver string is valid
|
|
63
|
+
*/
|
|
64
|
+
declare const isValidVersion: (version: string | SemVer | Range | null | undefined, loose?: boolean) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Check if a semver string satisfies a range
|
|
67
|
+
*
|
|
68
|
+
* @param version - The semver string to check
|
|
69
|
+
* @param range - The range to check against
|
|
70
|
+
* @param loose - Whether to use loose parsing
|
|
71
|
+
* @returns Whether the semver string satisfies the range
|
|
72
|
+
*/
|
|
73
|
+
declare const satisfiesVersion: (version: string | SemVer | null | undefined, range: string | Range | null | undefined, loose?: boolean) => boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Check if a string is a valid relative version keyword
|
|
76
|
+
*
|
|
77
|
+
* @param val - The string to check
|
|
78
|
+
* @returns Whether the string is a valid relative version keyword
|
|
79
|
+
*/
|
|
80
|
+
declare const isRelativeVersionKeyword: (val: string) => val is ReleaseType;
|
|
81
|
+
/**
|
|
82
|
+
* Derive a new semver version from the current version and a version specifier
|
|
83
|
+
*
|
|
84
|
+
* @param currentSemverVersion - The current semver version
|
|
85
|
+
* @param semverSpecifier - The semver specifier to use
|
|
86
|
+
* @param preid - The pre-release identifier to use
|
|
87
|
+
* @returns The derived new semver version
|
|
88
|
+
*/
|
|
89
|
+
declare const deriveNewSemverVersion: (currentSemverVersion: string, semverSpecifier: string, preid?: string) => string;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { coerceVersion, deriveNewSemverVersion, isRange, isRelativeVersionKeyword, isSemver, isValidRange, isValidSemver, isValidVersion, parseVersion, satisfiesVersion };
|
|
92
|
+
//# sourceMappingURL=semver-fns.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semver-fns.d.mts","names":[],"sources":["../src/semver-fns.ts"],"sourcesContent":[],"mappings":";;;;;;AAsCA;AAUA;;;;AAGS,cAbI,YAaJ,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,KAAA,CAAA,EAAA,OAAA,EAAA,GAbgD,MAahD,GAAA,IAAA;AAUT;AAUA;AAcA;AAgBA;AAaA;AAeA;AAuBA;AAYa,cApHA,aAmJZ,EAAA,CAAA,OAAA,EAAA,MAAA,GAAA,MAAA,GAlJ4B,MAkJ5B,GAAA,IAAA,GAAA,SAAA,EAAA,OAAA,CAAA,EAjJW,aAiJX,EAAA,GAhJE,MAgJF,GAAA,IAAA;;;;;;;cAtIY,+BAA8B;;;;;;;cAU9B,8BAA6B;;;;;;;;;;;cAc7B;;;;;;;;;;;cAgBA;;;;;;;;cAaA,mCACO,SAAS;;;;;;;;;cAchB,qCACO,2CACF;;;;;;;cAqBL,kDAAiD;;;;;;;;;cAYjD"}
|
package/dist/semver-fns.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isString as e}from"./type-checks/src/is-string.mjs";import{isObject as t}from"./type-checks/src/is-object.mjs";import{RELEASE_TYPES as n,coerce as r,inc as i,parse as a,satisfies as o,valid as s,validRange as c}from"semver";const l=(e,t=!0)=>a(e,t),u=(e,t)=>r(e,t),d=e=>t(e)&&`version`in e,f=e=>t(e)&&`range`in e,p=(t,n=!0)=>(e(t)||d(t))&&s(t,n)!==null,m=(t,n=!0)=>(e(t)||f(t))&&c(t,n)!==null,h=(e,t=!0)=>p(e,t)||m(e,t),g=(e,t,n=!0)=>!e||!t||!p(e,n)||!m(t,n)?!1:o(e,t,{loose:n}),_=e=>n.includes(e),v=(e,t,n)=>{if(!s(e))throw Error(`Invalid semver version "${e}" provided.`);let r=t;if(_(t)){let a=i(e,t,n);if(!a)throw Error(`Unable to derive new version from current version "${e}" and version specifier "${t}"`);r=a}else if(!s(t))throw Error(`Invalid semver version specifier "${t}" provided. Please provide either a valid semver version or a valid semver version keyword.`);return r};export{u as coerceVersion,v as deriveNewSemverVersion,f as isRange,_ as isRelativeVersionKeyword,d as isSemver,m as isValidRange,p as isValidSemver,h as isValidVersion,l as parseVersion,g as satisfiesVersion};
|
|
2
|
+
//# sourceMappingURL=semver-fns.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semver-fns.mjs","names":[],"sources":["../src/semver-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\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { CoerceOptions, Range, ReleaseType, SemVer } from \"semver\";\nimport {\n RELEASE_TYPES,\n coerce,\n inc,\n parse,\n satisfies,\n valid,\n validRange\n} from \"semver\";\n\n/**\n * Parse a semver string into a SemVer object\n *\n * @param semver - The semver string to parse\n * @param loose - Whether to use loose parsing\n * @returns The parsed SemVer object\n */\nexport const parseVersion = (semver: string, loose = true) =>\n parse(semver, loose);\n\n/**\n * Coerce a version string into a valid SemVer string\n *\n * @param version - The version string or number or {@link SemVer} to coerce\n * @param options - Options to use when coercing the version\n * @returns The coerced SemVer string or null if invalid\n */\nexport const coerceVersion = (\n version: string | number | SemVer | null | undefined,\n options?: CoerceOptions\n): SemVer | null => {\n return coerce(version, options);\n};\n\n/**\n * Type check for {@link SemVer}\n *\n * @param val - The value to check\n * @returns Whether the value is a valid {@link SemVer}\n */\nexport const isSemver = (val: any): val is SemVer => {\n return isObject(val) && \"version\" in val;\n};\n\n/**\n * Type check for {@link Range}\n *\n * @param val - The value to check\n * @returns Whether the value is a valid {@link Range}\n */\nexport const isRange = (val: any): val is Range => {\n return isObject(val) && \"range\" in val;\n};\n\n/**\n * Check if a {@link SemVer} string is valid\n *\n * @remarks\n * If you're looking for type checking, please use the {@link isSemver} function.\n *\n * @param semver - The semver string to check\n * @param loose - Whether to use loose parsing\n * @returns Whether the semver string is valid\n */\nexport const isValidSemver = (semver: any, loose = true): boolean => {\n return (\n (isString(semver) || isSemver(semver)) && valid(semver, loose) !== null\n );\n};\n\n/**\n * Check if a {@link Range} string is valid\n *\n * @remarks\n * If you're looking for type checking, please use the {@link isRange} function.\n *\n * @param range - The range string to check\n * @param loose - Whether to use loose parsing\n * @returns Whether the range string is valid\n */\nexport const isValidRange = (range: any, loose = true): boolean => {\n return (\n (isString(range) || isRange(range)) && validRange(range, loose) !== null\n );\n};\n\n/**\n * Check if a {@link SemVer} or {@link Range} string is valid\n *\n * @param version - The semver string to check\n * @param loose - Whether to use loose parsing\n * @returns Whether the semver string is valid\n */\nexport const isValidVersion = (\n version: string | SemVer | Range | null | undefined,\n loose = true\n) => {\n return isValidSemver(version, loose) || isValidRange(version, loose);\n};\n\n/**\n * Check if a semver string satisfies a range\n *\n * @param version - The semver string to check\n * @param range - The range to check against\n * @param loose - Whether to use loose parsing\n * @returns Whether the semver string satisfies the range\n */\nexport const satisfiesVersion = (\n version: string | SemVer | null | undefined,\n range: string | Range | null | undefined,\n loose = true\n) => {\n if (\n !version ||\n !range ||\n !isValidSemver(version, loose) ||\n !isValidRange(range, loose)\n ) {\n return false;\n }\n\n return satisfies(version, range, { loose });\n};\n\n/**\n * Check if a string is a valid relative version keyword\n *\n * @param val - The string to check\n * @returns Whether the string is a valid relative version keyword\n */\nexport const isRelativeVersionKeyword = (val: string): val is ReleaseType => {\n return RELEASE_TYPES.includes(val as ReleaseType);\n};\n\n/**\n * Derive a new semver version from the current version and a version specifier\n *\n * @param currentSemverVersion - The current semver version\n * @param semverSpecifier - The semver specifier to use\n * @param preid - The pre-release identifier to use\n * @returns The derived new semver version\n */\nexport const deriveNewSemverVersion = (\n currentSemverVersion: string,\n semverSpecifier: string,\n preid?: string\n) => {\n if (!valid(currentSemverVersion)) {\n throw new Error(\n `Invalid semver version \"${currentSemverVersion}\" provided.`\n );\n }\n\n let newVersion = semverSpecifier;\n\n if (isRelativeVersionKeyword(semverSpecifier)) {\n // Derive the new version from the current version combined with the new version specifier.\n const derivedVersion = inc(currentSemverVersion, semverSpecifier, preid!);\n\n if (!derivedVersion) {\n throw new Error(\n `Unable to derive new version from current version \"${currentSemverVersion}\" and version specifier \"${semverSpecifier}\"`\n );\n }\n newVersion = derivedVersion;\n } else if (!valid(semverSpecifier)) {\n // Ensure the new version specifier is a valid semver version, given it is not a valid semver keyword\n throw new Error(\n `Invalid semver version specifier \"${semverSpecifier}\" provided. Please provide either a valid semver version or a valid semver version keyword.`\n );\n }\n\n return newVersion;\n};\n"],"mappings":"uOAsCA,MAAa,GAAgB,EAAgB,EAAQ,KACnD,EAAM,EAAQ,EAAM,CAST,GACX,EACA,IAEO,EAAO,EAAS,EAAQ,CASpB,EAAY,GAChB,EAAS,EAAI,EAAI,YAAa,EAS1B,EAAW,GACf,EAAS,EAAI,EAAI,UAAW,EAaxB,GAAiB,EAAa,EAAQ,MAE9C,EAAS,EAAO,EAAI,EAAS,EAAO,GAAK,EAAM,EAAQ,EAAM,GAAK,KAc1D,GAAgB,EAAY,EAAQ,MAE5C,EAAS,EAAM,EAAI,EAAQ,EAAM,GAAK,EAAW,EAAO,EAAM,GAAK,KAW3D,GACX,EACA,EAAQ,KAED,EAAc,EAAS,EAAM,EAAI,EAAa,EAAS,EAAM,CAWzD,GACX,EACA,EACA,EAAQ,KAGN,CAAC,GACD,CAAC,GACD,CAAC,EAAc,EAAS,EAAM,EAC9B,CAAC,EAAa,EAAO,EAAM,CAEpB,GAGF,EAAU,EAAS,EAAO,CAAE,QAAO,CAAC,CAShC,EAA4B,GAChC,EAAc,SAAS,EAAmB,CAWtC,GACX,EACA,EACA,IACG,CACH,GAAI,CAAC,EAAM,EAAqB,CAC9B,MAAU,MACR,2BAA2B,EAAqB,aACjD,CAGH,IAAI,EAAa,EAEjB,GAAI,EAAyB,EAAgB,CAAE,CAE7C,IAAM,EAAiB,EAAI,EAAsB,EAAiB,EAAO,CAEzE,GAAI,CAAC,EACH,MAAU,MACR,sDAAsD,EAAqB,2BAA2B,EAAgB,GACvH,CAEH,EAAa,UACJ,CAAC,EAAM,EAAgB,CAEhC,MAAU,MACR,qCAAqC,EAAgB,6FACtD,CAGH,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return/^.[^\n\r@\u2028\u2029]*@.*$/.test(e)}function t(t){return e(t)?t.substring(0,t.lastIndexOf(`@`)):t}function n(e){return/^[^\n\r/\u2028\u2029]*\/.[^\n\r/\u2028\u2029]*\/.*$/.test(e)?e.substring(0,e.lastIndexOf(`/`)):t(e)}exports.getPackageName=n;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return/^.[^\n\r@\u2028\u2029]*@.*$/.test(e)}function t(t){return e(t)?t.substring(0,t.lastIndexOf(`@`)):t}function n(e){return/^[^\n\r/\u2028\u2029]*\/.[^\n\r/\u2028\u2029]*\/.*$/.test(e)?e.substring(0,e.lastIndexOf(`/`)):t(e)}export{n as getPackageName};
|
|
2
|
+
//# sourceMappingURL=package.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.mjs","names":[],"sources":["../../../../string-format/src/package.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 * Check if a package name has a version\n *\n * @example\n * ```typescript\n * hasPackageVersion(\"lodash@4.17.21\");\n * // => true\n * hasPackageVersion(\"@stryke/core@4.17.21\");\n * // => true\n * hasPackageVersion(\"lodash\");\n * // => false\n * hasPackageVersion(\"@stryke/core\");\n * // => false\n * hasPackageVersion(\"lodash/module\");\n * // => false\n * hasPackageVersion(\"@stryke/core/module\");\n * // => false\n * hasPackageVersion(\"lodash/module@4.17.21\");\n * // => true\n * hasPackageVersion(\"@stryke/core/module@4.17.21\");\n * // => true\n * ```\n *\n * @param value - The package name with version\n * @returns Whether the package name has a version\n */\nexport function hasPackageVersion(value: string): boolean {\n return /^.[^\\n\\r@\\u2028\\u2029]*@.*$/.test(value);\n}\n\n/**\n * Remove the version from a package name (if it exists)\n *\n * @example\n * ```typescript\n * removePackageVersion(\"lodash@4.17.21\");\n * // => \"lodash\"\n * removePackageVersion(\"@stryke/core@4.17.21\");\n * // => \"@stryke/core\"\n * removePackageVersion(\"lodash\");\n * // => \"lodash\"\n * removePackageVersion(\"@stryke/core\");\n * // => \"@stryke/core\"\n * getPackageName(\"lodash/module\");\n * // => \"lodash/module\"\n * getPackageName(\"@stryke/core/module\");\n * // => \"@stryke/core/module\"\n * getPackageName(\"lodash/module@4.17.21\");\n * // => \"lodash/module\"\n * getPackageName(\"@stryke/core/module@4.17.21\");\n * // => \"@stryke/core/module\"\n * ```\n *\n * @param value - The package name with version\n * @returns The package name without version\n */\nexport function removePackageVersion(value: string) {\n return hasPackageVersion(value)\n ? value.substring(0, value.lastIndexOf(\"@\"))\n : value;\n}\n\n/**\n * Get the package name from a scoped package string\n *\n * @example\n * ```typescript\n * getPackageName(\"lodash@4.17.21\");\n * // => \"lodash\"\n * getPackageName(\"@stryke/core@4.17.21\");\n * // => \"@stryke/core\"\n * getPackageName(\"lodash\");\n * // => \"lodash\"\n * getPackageName(\"@stryke/core\");\n * // => \"@stryke/core\"\n * getPackageName(\"lodash/module\");\n * // => \"lodash\"\n * getPackageName(\"@stryke/core/module\");\n * // => \"@stryke/core\"\n * getPackageName(\"lodash/module@4.17.21\");\n * // => \"lodash\"\n * getPackageName(\"@stryke/core/module@4.17.21\");\n * // => \"@stryke/core\"\n * ```\n *\n * @param value - The scoped package string\n * @returns The package name without the scope\n */\nexport function getPackageName(value: string) {\n return /^[^\\n\\r/\\u2028\\u2029]*\\/.[^\\n\\r/\\u2028\\u2029]*\\/.*$/.test(value)\n ? value.substring(0, value.lastIndexOf(\"/\"))\n : removePackageVersion(value);\n}\n\n/**\n * Get the package version from a scoped package string\n *\n * @example\n * ```typescript\n * getPackageName(\"lodash@4.17.21\");\n * // => \"4.17.21\"\n * getPackageName(\"@stryke/core@4.17.21\");\n * // => \"4.17.21\"\n * getPackageName(\"lodash\");\n * // => undefined\n * getPackageName(\"@stryke/core\");\n * // => undefined\n * getPackageName(\"lodash/module\");\n * // => undefined\n * getPackageName(\"@stryke/core/module\");\n * // => undefined\n * getPackageName(\"lodash/module@4.17.21\");\n * // => \"4.17.21\"\n * getPackageName(\"@stryke/core/module@4.17.21\");\n * // => \"4.17.21\"\n * ```\n *\n * @param value - The scoped package string\n * @returns The package version without the package name if it exists. If not, returns undefined.\n */\nexport function getPackageVersion(value: string): string | undefined {\n return hasPackageVersion(value) ? value.replace(/^.+@/, \"\") : undefined;\n}\n"],"mappings":"AA4CA,SAAgB,EAAkB,EAAwB,CACxD,MAAO,8BAA8B,KAAK,EAAM,CA6BlD,SAAgB,EAAqB,EAAe,CAClD,OAAO,EAAkB,EAAM,CAC3B,EAAM,UAAU,EAAG,EAAM,YAAY,IAAI,CAAC,CAC1C,EA6BN,SAAgB,EAAe,EAAe,CAC5C,MAAO,sDAAsD,KAAK,EAAM,CACpE,EAAM,UAAU,EAAG,EAAM,YAAY,IAAI,CAAC,CAC1C,EAAqB,EAAM"}
|
package/dist/toml.cjs
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
require(`./
|
|
1
|
+
const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./read-file.cjs`),n=require(`./write-file.cjs`);let r=require(`defu`);r=e.__toESM(r);let i=require(`@ltd/j-toml`);function a(e,n){let r=t.readFileSync(e);return n?.specificationVersion?(0,i.parse)(r,n.specificationVersion,n?.multilineStringJoiner,n?.useBigInt,n?.xOptions):(0,i.parse)(r)}async function o(e,n){let r=await t.readFile(e);return n?.specificationVersion?(0,i.parse)(r,n.specificationVersion,n?.multilineStringJoiner,n?.useBigInt,n?.xOptions):(0,i.parse)(r)}function s(e,t,a){return n.writeFileSync(e,(0,i.stringify)(t,(0,r.default)(a??{},{newline:`
|
|
2
|
+
`,newlineAround:`pairs`,indent:4,forceInlineArraySpacing:1})))}async function c(e,t,a){return n.writeFile(e,(0,i.stringify)(t,(0,r.default)(a??{},{newline:`
|
|
3
|
+
`,newlineAround:`pairs`,indent:4,forceInlineArraySpacing:1})))}exports.readTomlFile=o,exports.readTomlFileSync=a,exports.writeTomlFile=c,exports.writeTomlFileSync=s;
|
package/dist/toml.d.cts
CHANGED
|
@@ -1,2 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/toml.d.ts
|
|
2
|
+
type XOptions = null | {
|
|
3
|
+
readonly keys?: null | RegExp;
|
|
4
|
+
readonly order?: boolean;
|
|
5
|
+
readonly exact?: boolean;
|
|
6
|
+
readonly multi?: boolean;
|
|
7
|
+
readonly longer?: boolean;
|
|
8
|
+
readonly string?: boolean;
|
|
9
|
+
readonly comment?: boolean;
|
|
10
|
+
readonly literal?: boolean;
|
|
11
|
+
readonly null?: boolean;
|
|
12
|
+
readonly tag?: null | (<Table extends object & {
|
|
13
|
+
[key: string | symbol]: any;
|
|
14
|
+
}, Key extends string | symbol, Array extends any[], Index extends number, Tag extends string>(this: void, each: {
|
|
15
|
+
table: Table;
|
|
16
|
+
key: Key;
|
|
17
|
+
tag: Tag;
|
|
18
|
+
} | {
|
|
19
|
+
array: Array;
|
|
20
|
+
index: Index;
|
|
21
|
+
tag: Tag;
|
|
22
|
+
} | {
|
|
23
|
+
table: Table;
|
|
24
|
+
key: Key;
|
|
25
|
+
array: Array;
|
|
26
|
+
index: Index;
|
|
27
|
+
tag: Tag;
|
|
28
|
+
}) => void);
|
|
29
|
+
};
|
|
30
|
+
interface TomlReadOptions {
|
|
31
|
+
specificationVersion?: 1.0 | 0.5 | 0.4 | 0.3 | 0.2 | 0.1;
|
|
32
|
+
multilineStringJoiner?: string;
|
|
33
|
+
useBigInt?: boolean | number;
|
|
34
|
+
xOptions?: XOptions;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Reads a TOML file and returns the object the TOML content represents.
|
|
38
|
+
*
|
|
39
|
+
* @param path - A path to a file.
|
|
40
|
+
* @param options - TOML parse options
|
|
41
|
+
* @returns Object the TOML content of the file represents
|
|
42
|
+
*/
|
|
43
|
+
declare function readTomlFileSync<T extends object = any>(path: string, options?: TomlReadOptions): T;
|
|
44
|
+
/**
|
|
45
|
+
* Reads a TOML file and returns the object the TOML content represents.
|
|
46
|
+
*
|
|
47
|
+
* @param path - A path to a file.
|
|
48
|
+
* @param options - TOML parse options
|
|
49
|
+
* @returns Object the TOML content of the file represents
|
|
50
|
+
*/
|
|
51
|
+
declare function readTomlFile<T extends object = any>(path: string, options?: TomlReadOptions): Promise<T>;
|
|
52
|
+
interface TomlWriteOptions {
|
|
53
|
+
integer?: number;
|
|
54
|
+
newline?: "\n" | "\r\n";
|
|
55
|
+
newlineAround?: "document" | "section" | "header" | "pairs" | "pair";
|
|
56
|
+
indent?: string | number;
|
|
57
|
+
T?: "T" | "t" | " ";
|
|
58
|
+
Z?: "Z" | "z";
|
|
59
|
+
xNull?: boolean;
|
|
60
|
+
xBeforeNewlineInMultilineTable?: "," | "";
|
|
61
|
+
forceInlineArraySpacing?: 0 | 1 | 2 | 3;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Reads a TOML file and returns the object the TOML content represents.
|
|
65
|
+
*
|
|
66
|
+
* @param path - A path to a file.
|
|
67
|
+
* @param data - data which should be serialized/formatted to TOML and written to the file
|
|
68
|
+
* @param options - TOML parse options
|
|
69
|
+
*/
|
|
70
|
+
declare function writeTomlFileSync<T extends object = any>(path: string, data: T, options?: TomlWriteOptions): void;
|
|
71
|
+
/**
|
|
72
|
+
* Reads a TOML file and returns the object the TOML content represents.
|
|
73
|
+
*
|
|
74
|
+
* @param path - A path to a file.
|
|
75
|
+
* @param data - data which should be serialized/formatted to TOML and written to the file
|
|
76
|
+
* @param options - TOML parse options
|
|
77
|
+
*/
|
|
78
|
+
declare function writeTomlFile<T extends object = any>(path: string, data: T, options?: TomlWriteOptions): Promise<void>;
|
|
79
|
+
//#endregion
|
|
80
|
+
export { TomlReadOptions, TomlWriteOptions, XOptions, readTomlFile, readTomlFileSync, writeTomlFile, writeTomlFileSync };
|
|
81
|
+
//# sourceMappingURL=toml.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toml.d.cts","names":[],"sources":["../src/toml.ts"],"sourcesContent":[],"mappings":";KAuBY,QAAA;EAAA,SAAA,IAAQ,CAAA,EAAA,IAAA,GACK,MADL;EACK,SAAA,KAAA,CAAA,EAAA,OAAA;EAoBJ,SAAA,KAAA,CAAA,EAAA,OAAA;EAAY,SAAA,KAAA,CAAA,EAAA,OAAA;EAAU,SAAA,MAAA,CAAA,EAAA,OAAA;EACtB,SAAA,MAAA,CAAA,EAAA,OAAA;EAAc,SAAA,OAAA,CAAA,EAAA,OAAA;EAAY,SAAA,OAAA,CAAA,EAAA,OAAA;EAC1B,SAAA,IAAA,CAAA,EAAA,OAAA;EAAY,SAAA,GAAA,CAAA,EAAA,IAAA,GAAA,CAAA,CAAA,cAAA,MAAA,GAAA;IAAY,CAAA,GAAA,EAAA,MAAA,GAAA,MAAA,CAAA,EAAA,GAAA;EAAc,CAAA,EAAA,YAAA,MAAA,GAAA,MAAA,EAAA,cAAA,GAAA,EAAA,EAAA,cAAA,MAAA,EAAA,YAAA,MAAA,CAAA,CAAA,IAAA,EAAA,IAAA,EAAA,IAAA,EAAA;IAAY,KAAA,EAFlD,KAEkD;IAAG,GAAA,EAFzC,GAEyC;IAIzD,GAAA,EAN0B,GAM1B;EAcD,CAAA,GAAA;IA0BM,KAAA,EA7CD,KA6Ca;IAEtB,KAAA,EA/CuB,KA+CvB;IACD,GAAA,EAhDoC,GAgDpC;EAAR,CAAA,GAAA;IAAO,KAAA,EA/CW,KA+CX;IAgBO,GAAA,EA/DgB,GA+DhB;IAmBD,KAAA,EAlF6B,KAkF7B;IA0BM,KAAA,EA5GqC,KA4GxB;IAE3B,GAAA,EA9G+D,GA8G/D;EACI,CAAA,EAAA,GAAA,IAAA,CAAA;CACT;AAAO,UA5GO,eAAA,CA4GP;;;;aAxGG;;;;;;;;;iBAUG,iEAEJ,kBACT;;;;;;;;iBAuBmB,6DAEV,kBACT,QAAQ;UAgBM,gBAAA;;;;;;;;;;;;;;;;;;iBAmBD,8DAER,aACI;;;;;;;;iBAuBU,0DAEd,aACI,mBACT"}
|