keri-ts 0.2.3 → 0.3.0
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/README.md +57 -8
- package/esm/app/cli/agent.js +0 -19
- package/esm/app/cli/annotate.js +7 -2
- package/esm/app/cli/benchmark.js +210 -0
- package/esm/app/cli/cli.js +50 -52
- package/esm/app/cli/command-definitions.js +258 -6
- package/esm/app/cli/common/existing.js +40 -0
- package/esm/app/cli/common/parsing.js +20 -0
- package/esm/app/cli/export.js +51 -0
- package/esm/app/cli/incept.js +106 -0
- package/esm/app/cli/index.js +2 -0
- package/esm/app/cli/init.js +72 -41
- package/esm/app/configing.js +261 -0
- package/esm/app/habbing.js +386 -0
- package/esm/app/index.js +3 -0
- package/esm/app/keeping.js +321 -0
- package/esm/app/version.js +2 -2
- package/esm/db/basing.js +66 -1
- package/esm/db/core/lmdber.js +13 -7
- package/esm/db/core/path-manager.js +193 -169
- package/esm/db/index.js +1 -0
- package/esm/db/keeping.js +214 -0
- package/esm/deps/jsr.io/@std/internal/1.0.12/_os.js +12 -0
- package/esm/deps/jsr.io/@std/internal/1.0.12/os.js +5 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/assert_path.js +7 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/basename.js +40 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/common.js +23 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/constants.js +46 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/dirname.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/format.js +19 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.js +9 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.js +235 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.js +77 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/relative.js +9 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.js +19 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.js +15 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/basename.js +35 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/common.js +33 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/constants.js +17 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/dirname.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/extname.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/format.js +27 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/from_file_url.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.js +83 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/is_absolute.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/is_glob.js +42 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/join.js +29 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/join_globs.js +34 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/mod.js +216 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/normalize.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/normalize_glob.js +35 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/parse.js +39 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/_util.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.js +52 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.js +14 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/dirname.js +64 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.js +93 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/format.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.js +21 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.js +23 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/join.js +45 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/join_globs.js +40 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize.js +58 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/parse.js +115 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/relative.js +106 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/resolve.js +59 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.js +27 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.js +20 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/relative.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/resolve.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/to_file_url.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.js +29 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/types.js +3 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/_util.js +15 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.js +47 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.js +14 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/dirname.js +113 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/format.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.js +38 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/join.js +77 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/join_globs.js +41 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize.js +135 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/parse.js +176 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/relative.js +131 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/resolve.js +154 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.js +34 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.js +49 -0
- package/package.json +4 -2
- package/types/app/cli/agent.d.ts.map +1 -1
- package/types/app/cli/annotate.d.ts.map +1 -1
- package/types/app/cli/benchmark.d.ts +11 -0
- package/types/app/cli/benchmark.d.ts.map +1 -0
- package/types/app/cli/cli.d.ts.map +1 -1
- package/types/app/cli/command-definitions.d.ts +5 -2
- package/types/app/cli/command-definitions.d.ts.map +1 -1
- package/types/app/cli/command-types.d.ts +12 -0
- package/types/app/cli/command-types.d.ts.map +1 -1
- package/types/app/cli/common/existing.d.ts +4 -0
- package/types/app/cli/common/existing.d.ts.map +1 -0
- package/types/app/cli/common/parsing.d.ts +15 -0
- package/types/app/cli/common/parsing.d.ts.map +1 -0
- package/types/app/cli/export.d.ts +8 -0
- package/types/app/cli/export.d.ts.map +1 -0
- package/types/app/cli/incept.d.ts +8 -0
- package/types/app/cli/incept.d.ts.map +1 -0
- package/types/app/cli/index.d.ts +2 -0
- package/types/app/cli/index.d.ts.map +1 -1
- package/types/app/cli/init.d.ts +5 -0
- package/types/app/cli/init.d.ts.map +1 -1
- package/types/app/configing.d.ts +57 -0
- package/types/app/configing.d.ts.map +1 -0
- package/types/app/habbing.d.ts +107 -0
- package/types/app/habbing.d.ts.map +1 -0
- package/types/app/index.d.ts +3 -0
- package/types/app/index.d.ts.map +1 -1
- package/types/app/keeping.d.ts +72 -0
- package/types/app/keeping.d.ts.map +1 -0
- package/types/app/version.d.ts +2 -2
- package/types/db/basing.d.ts +16 -1
- package/types/db/basing.d.ts.map +1 -1
- package/types/db/core/lmdber.d.ts +8 -4
- package/types/db/core/lmdber.d.ts.map +1 -1
- package/types/db/core/path-manager.d.ts +88 -24
- package/types/db/core/path-manager.d.ts.map +1 -1
- package/types/db/index.d.ts +1 -0
- package/types/db/index.d.ts.map +1 -1
- package/types/db/keeping.d.ts +73 -0
- package/types/db/keeping.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts +2 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts +3 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts +40 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts +35 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts +27 -0
- package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts +28 -0
- package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts +15 -0
- package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts +77 -0
- package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts +23 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts +28 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts +213 -0
- package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts +26 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts +29 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts +35 -0
- package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts +39 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts +13 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts +30 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts +37 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts +16 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts +72 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts +31 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts +37 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts +25 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts +16 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts +21 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts +38 -0
- package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts +13 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts +18 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts +71 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts +18 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts +21 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts +19 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts +25 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts +23 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts.map +1 -0
- package/esm/app/cli/stub-commands.js +0 -61
- package/types/app/cli/stub-commands.d.ts +0 -6
- package/types/app/cli/stub-commands.d.ts.map +0 -1
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// Copyright the Browserify authors. MIT License.
|
|
3
|
+
// Ported mostly from https://github.com/browserify/path-browserify/
|
|
4
|
+
// This module is browser compatible.
|
|
5
|
+
/**
|
|
6
|
+
* Utilities for working with OS-specific file paths.
|
|
7
|
+
*
|
|
8
|
+
* Functions from this module will automatically switch to support the path style
|
|
9
|
+
* of the current OS, either `windows` for Microsoft Windows, or `posix` for
|
|
10
|
+
* every other operating system, eg. Linux, MacOS, BSD etc.
|
|
11
|
+
*
|
|
12
|
+
* To use functions for a specific path style regardless of the current OS
|
|
13
|
+
* import the modules from the platform sub directory instead.
|
|
14
|
+
*
|
|
15
|
+
* ## Basic Path Operations
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import * as path from "@std/path";
|
|
19
|
+
* import { assertEquals } from "@std/assert";
|
|
20
|
+
*
|
|
21
|
+
* // Get components of a path
|
|
22
|
+
* if (Deno.build.os === "windows") {
|
|
23
|
+
* assertEquals(path.basename("C:\\Users\\user\\file.txt"), "file.txt");
|
|
24
|
+
* assertEquals(path.dirname("C:\\Users\\user\\file.txt"), "C:\\Users\\user");
|
|
25
|
+
* assertEquals(path.extname("C:\\Users\\user\\file.txt"), ".txt");
|
|
26
|
+
* } else {
|
|
27
|
+
* assertEquals(path.basename("/home/user/file.txt"), "file.txt");
|
|
28
|
+
* assertEquals(path.dirname("/home/user/file.txt"), "/home/user");
|
|
29
|
+
* assertEquals(path.extname("/home/user/file.txt"), ".txt");
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* // Join path segments
|
|
33
|
+
* if (Deno.build.os === "windows") {
|
|
34
|
+
* assertEquals(path.join("C:\\", "Users", "docs", "file.txt"), "C:\\Users\\docs\\file.txt");
|
|
35
|
+
* } else {
|
|
36
|
+
* assertEquals(path.join("/home", "user", "docs", "file.txt"), "/home/user/docs/file.txt");
|
|
37
|
+
* }
|
|
38
|
+
*
|
|
39
|
+
* // Normalize a path
|
|
40
|
+
* if (Deno.build.os === "windows") {
|
|
41
|
+
* assertEquals(path.normalize("C:\\Users\\user\\..\\temp\\.\\file.txt"), "C:\\Users\\temp\\file.txt");
|
|
42
|
+
* } else {
|
|
43
|
+
* assertEquals(path.normalize("/home/user/../temp/./file.txt"), "/home/temp/file.txt");
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* // Resolve absolute path
|
|
47
|
+
* if (Deno.build.os === "windows") {
|
|
48
|
+
* const resolved = path.resolve("C:\\foo", "docs", "file.txt");
|
|
49
|
+
* assertEquals(resolved, "C:\\foo\\docs\\file.txt");
|
|
50
|
+
* assertEquals(path.isAbsolute(resolved), true);
|
|
51
|
+
* } else {
|
|
52
|
+
* const resolved = path.resolve("/foo", "docs", "file.txt");
|
|
53
|
+
* assertEquals(resolved, "/foo/docs/file.txt");
|
|
54
|
+
* assertEquals(path.isAbsolute(resolved), true);
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* // Get relative path
|
|
58
|
+
* if (Deno.build.os === "windows") {
|
|
59
|
+
* assertEquals(path.relative("C:\\Users", "C:\\Users\\docs\\file.txt"), "docs\\file.txt");
|
|
60
|
+
* assertEquals(path.relative("C:\\Users", "D:\\Programs"), "D:\\Programs");
|
|
61
|
+
* } else {
|
|
62
|
+
* assertEquals(path.relative("/home/user", "/home/user/docs/file.txt"), "docs/file.txt");
|
|
63
|
+
* assertEquals(path.relative("/home/user", "/var/data"), "../../var/data");
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* ## Path Parsing and Formatting
|
|
68
|
+
*
|
|
69
|
+
* ```ts
|
|
70
|
+
* import * as path from "@std/path";
|
|
71
|
+
* import { assertEquals } from "@std/assert";
|
|
72
|
+
*
|
|
73
|
+
* if (Deno.build.os === "windows") {
|
|
74
|
+
* const parsedWindows = path.parse("C:\\Users\\user\\file.txt");
|
|
75
|
+
* assertEquals(parsedWindows.root, "C:\\");
|
|
76
|
+
* assertEquals(parsedWindows.dir, "C:\\Users\\user");
|
|
77
|
+
* assertEquals(parsedWindows.base, "file.txt");
|
|
78
|
+
* assertEquals(parsedWindows.ext, ".txt");
|
|
79
|
+
* assertEquals(parsedWindows.name, "file");
|
|
80
|
+
*
|
|
81
|
+
* // Format path from components (Windows)
|
|
82
|
+
* assertEquals(
|
|
83
|
+
* path.format({ dir: "C:\\Users\\user", base: "file.txt" }),
|
|
84
|
+
* "C:\\Users\\user\\file.txt"
|
|
85
|
+
* );
|
|
86
|
+
* } else {
|
|
87
|
+
* const parsedPosix = path.parse("/home/user/file.txt");
|
|
88
|
+
* assertEquals(parsedPosix.root, "/");
|
|
89
|
+
* assertEquals(parsedPosix.dir, "/home/user");
|
|
90
|
+
* assertEquals(parsedPosix.base, "file.txt");
|
|
91
|
+
* assertEquals(parsedPosix.ext, ".txt");
|
|
92
|
+
* assertEquals(parsedPosix.name, "file");
|
|
93
|
+
*
|
|
94
|
+
* // Format path from components (POSIX)
|
|
95
|
+
* assertEquals(
|
|
96
|
+
* path.format({ dir: "/home/user", base: "file.txt" }),
|
|
97
|
+
* "/home/user/file.txt"
|
|
98
|
+
* );
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* ## URL Conversion
|
|
103
|
+
*
|
|
104
|
+
* ```ts
|
|
105
|
+
* import * as path from "@std/path";
|
|
106
|
+
* import { assertEquals } from "@std/assert";
|
|
107
|
+
*
|
|
108
|
+
* // Convert between file URLs and paths
|
|
109
|
+
* if (Deno.build.os === "windows") {
|
|
110
|
+
* assertEquals(path.fromFileUrl("file:///C:/Users/user/file.txt"), "C:\\Users\\user\\file.txt");
|
|
111
|
+
* assertEquals(path.toFileUrl("C:\\Users\\user\\file.txt").href, "file:///C:/Users/user/file.txt");
|
|
112
|
+
* } else {
|
|
113
|
+
* assertEquals(path.fromFileUrl("file:///home/user/file.txt"), "/home/user/file.txt");
|
|
114
|
+
* assertEquals(path.toFileUrl("/home/user/file.txt").href, "file:///home/user/file.txt");
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* ## Path Properties
|
|
119
|
+
*
|
|
120
|
+
* ```ts
|
|
121
|
+
* import * as path from "@std/path";
|
|
122
|
+
* import { assertEquals } from "@std/assert";
|
|
123
|
+
*
|
|
124
|
+
* // Check if path is absolute
|
|
125
|
+
* if (Deno.build.os === "windows") {
|
|
126
|
+
* assertEquals(path.isAbsolute("C:\\Users"), true);
|
|
127
|
+
* assertEquals(path.isAbsolute("\\\\Server\\share"), true);
|
|
128
|
+
* assertEquals(path.isAbsolute("C:relative\\path"), false);
|
|
129
|
+
* assertEquals(path.isAbsolute("..\\relative\\path"), false);
|
|
130
|
+
* } else {
|
|
131
|
+
* assertEquals(path.isAbsolute("/home/user"), true);
|
|
132
|
+
* assertEquals(path.isAbsolute("./relative/path"), false);
|
|
133
|
+
* assertEquals(path.isAbsolute("../relative/path"), false);
|
|
134
|
+
* }
|
|
135
|
+
*
|
|
136
|
+
* // Convert to namespaced path (Windows-specific)
|
|
137
|
+
* if (Deno.build.os === "windows") {
|
|
138
|
+
* assertEquals(path.toNamespacedPath("C:\\Users\\file.txt"), "\\\\?\\C:\\Users\\file.txt");
|
|
139
|
+
* assertEquals(path.toNamespacedPath("\\\\server\\share\\file.txt"), "\\\\?\\UNC\\server\\share\\file.txt");
|
|
140
|
+
* } else {
|
|
141
|
+
* // On POSIX, toNamespacedPath returns the path unchanged
|
|
142
|
+
* assertEquals(path.toNamespacedPath("/home/user/file.txt"), "/home/user/file.txt");
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* ## Glob Pattern Utilities
|
|
147
|
+
*
|
|
148
|
+
* ```ts
|
|
149
|
+
* import * as path from "@std/path";
|
|
150
|
+
* import { assertEquals } from "@std/assert";
|
|
151
|
+
*
|
|
152
|
+
* // Check if a string is a glob pattern
|
|
153
|
+
* assertEquals(path.isGlob("*.txt"), true);
|
|
154
|
+
*
|
|
155
|
+
* // Convert glob pattern to RegExp
|
|
156
|
+
* const pattern = path.globToRegExp("*.txt");
|
|
157
|
+
* assertEquals(pattern.test("file.txt"), true);
|
|
158
|
+
*
|
|
159
|
+
* // Join multiple glob patterns
|
|
160
|
+
* if (Deno.build.os === "windows") {
|
|
161
|
+
* assertEquals(path.joinGlobs(["src", "**\\*.ts"]), "src\\**\\*.ts");
|
|
162
|
+
* } else {
|
|
163
|
+
* assertEquals(path.joinGlobs(["src", "**\/*.ts"]), "src/**\/*.ts");
|
|
164
|
+
* }
|
|
165
|
+
*
|
|
166
|
+
* // Normalize a glob pattern
|
|
167
|
+
* if (Deno.build.os === "windows") {
|
|
168
|
+
* assertEquals(path.normalizeGlob("src\\..\\**\\*.ts"), "**\\*.ts");
|
|
169
|
+
* } else {
|
|
170
|
+
* assertEquals(path.normalizeGlob("src/../**\/*.ts"), "**\/*.ts");
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* For POSIX-specific functions:
|
|
175
|
+
*
|
|
176
|
+
* ```ts
|
|
177
|
+
* import { fromFileUrl } from "@std/path/posix/from-file-url";
|
|
178
|
+
* import { assertEquals } from "@std/assert";
|
|
179
|
+
*
|
|
180
|
+
* assertEquals(fromFileUrl("file:///home/foo"), "/home/foo");
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* For Windows-specific functions:
|
|
184
|
+
*
|
|
185
|
+
* ```ts
|
|
186
|
+
* import { fromFileUrl } from "@std/path/windows/from-file-url";
|
|
187
|
+
* import { assertEquals } from "@std/assert";
|
|
188
|
+
*
|
|
189
|
+
* assertEquals(fromFileUrl("file:///home/foo"), "\\home\\foo");
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* Functions for working with URLs can be found in
|
|
193
|
+
* {@link ./doc/posix/~ | @std/path/posix}.
|
|
194
|
+
*
|
|
195
|
+
* @module
|
|
196
|
+
*/
|
|
197
|
+
export * from "./basename.js";
|
|
198
|
+
export * from "./constants.js";
|
|
199
|
+
export * from "./dirname.js";
|
|
200
|
+
export * from "./extname.js";
|
|
201
|
+
export * from "./format.js";
|
|
202
|
+
export * from "./from_file_url.js";
|
|
203
|
+
export * from "./is_absolute.js";
|
|
204
|
+
export * from "./join.js";
|
|
205
|
+
export * from "./normalize.js";
|
|
206
|
+
export * from "./parse.js";
|
|
207
|
+
export * from "./relative.js";
|
|
208
|
+
export * from "./resolve.js";
|
|
209
|
+
export * from "./to_file_url.js";
|
|
210
|
+
export * from "./to_namespaced_path.js";
|
|
211
|
+
export * from "./common.js";
|
|
212
|
+
export * from "./types.js";
|
|
213
|
+
export * from "./glob_to_regexp.js";
|
|
214
|
+
export * from "./is_glob.js";
|
|
215
|
+
export * from "./join_globs.js";
|
|
216
|
+
export * from "./normalize_glob.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { isWindows } from "../../internal/1.0.12/os.js";
|
|
4
|
+
import { normalize as posixNormalize } from "./posix/normalize.js";
|
|
5
|
+
import { normalize as windowsNormalize } from "./windows/normalize.js";
|
|
6
|
+
/**
|
|
7
|
+
* Normalize the path, resolving `'..'` and `'.'` segments.
|
|
8
|
+
*
|
|
9
|
+
* Note: Resolving these segments does not necessarily mean that all will be
|
|
10
|
+
* eliminated. A `'..'` at the top-level will be preserved, and an empty path is
|
|
11
|
+
* canonically `'.'`.
|
|
12
|
+
*
|
|
13
|
+
* @example Usage
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { normalize } from "@std/path/normalize";
|
|
16
|
+
* import { assertEquals } from "@std/assert";
|
|
17
|
+
*
|
|
18
|
+
* if (Deno.build.os === "windows") {
|
|
19
|
+
* assertEquals(normalize("C:\\foo\\bar\\..\\baz\\quux"), "C:\\foo\\baz\\quux");
|
|
20
|
+
* assertEquals(normalize(new URL("file:///C:/foo/bar/../baz/quux")), "C:\\foo\\baz\\quux");
|
|
21
|
+
* } else {
|
|
22
|
+
* assertEquals(normalize("/foo/bar/../baz/quux"), "/foo/baz/quux");
|
|
23
|
+
* assertEquals(normalize(new URL("file:///foo/bar/../baz/quux")), "/foo/baz/quux");
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param path Path to be normalized
|
|
28
|
+
* @returns The normalized path.
|
|
29
|
+
*/
|
|
30
|
+
export function normalize(path) {
|
|
31
|
+
return isWindows ? windowsNormalize(path) : posixNormalize(path);
|
|
32
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { isWindows } from "../../internal/1.0.12/os.js";
|
|
4
|
+
import { normalizeGlob as posixNormalizeGlob } from "./posix/normalize_glob.js";
|
|
5
|
+
import { normalizeGlob as windowsNormalizeGlob, } from "./windows/normalize_glob.js";
|
|
6
|
+
/**
|
|
7
|
+
* Normalizes a glob string.
|
|
8
|
+
*
|
|
9
|
+
* Behaves like
|
|
10
|
+
* {@linkcode https://jsr.io/@std/path/doc/~/normalize | normalize()}, but
|
|
11
|
+
* doesn't collapse "**\/.." when `globstar` is true.
|
|
12
|
+
*
|
|
13
|
+
* @example Usage
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { normalizeGlob } from "@std/path/normalize-glob";
|
|
16
|
+
* import { assertEquals } from "@std/assert";
|
|
17
|
+
*
|
|
18
|
+
* if (Deno.build.os === "windows") {
|
|
19
|
+
* assertEquals(normalizeGlob("foo\\bar\\..\\baz"), "foo\\baz");
|
|
20
|
+
* assertEquals(normalizeGlob("foo\\**\\..\\bar\\..\\baz", { globstar: true }), "foo\\**\\..\\baz");
|
|
21
|
+
* } else {
|
|
22
|
+
* assertEquals(normalizeGlob("foo/bar/../baz"), "foo/baz");
|
|
23
|
+
* assertEquals(normalizeGlob("foo/**\/../bar/../baz", { globstar: true }), "foo/**\/../baz");
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param glob Glob string to normalize.
|
|
28
|
+
* @param options Glob options.
|
|
29
|
+
* @returns The normalized glob string.
|
|
30
|
+
*/
|
|
31
|
+
export function normalizeGlob(glob, options = {}) {
|
|
32
|
+
return isWindows
|
|
33
|
+
? windowsNormalizeGlob(glob, options)
|
|
34
|
+
: posixNormalizeGlob(glob, options);
|
|
35
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { isWindows } from "../../internal/1.0.12/os.js";
|
|
4
|
+
import { parse as posixParse } from "./posix/parse.js";
|
|
5
|
+
import { parse as windowsParse } from "./windows/parse.js";
|
|
6
|
+
/**
|
|
7
|
+
* Return an object containing the parsed components of the path.
|
|
8
|
+
*
|
|
9
|
+
* Use {@linkcode https://jsr.io/@std/path/doc/~/format | format()} to reverse
|
|
10
|
+
* the result.
|
|
11
|
+
*
|
|
12
|
+
* @example Usage
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { parse } from "@std/path/parse";
|
|
15
|
+
* import { assertEquals } from "@std/assert";
|
|
16
|
+
*
|
|
17
|
+
* if (Deno.build.os === "windows") {
|
|
18
|
+
* const parsedPathObj = parse("C:\\path\\to\\script.ts");
|
|
19
|
+
* assertEquals(parsedPathObj.root, "C:\\");
|
|
20
|
+
* assertEquals(parsedPathObj.dir, "C:\\path\\to");
|
|
21
|
+
* assertEquals(parsedPathObj.base, "script.ts");
|
|
22
|
+
* assertEquals(parsedPathObj.ext, ".ts");
|
|
23
|
+
* assertEquals(parsedPathObj.name, "script");
|
|
24
|
+
* } else {
|
|
25
|
+
* const parsedPathObj = parse("/path/to/dir/script.ts");
|
|
26
|
+
* parsedPathObj.root; // "/"
|
|
27
|
+
* parsedPathObj.dir; // "/path/to/dir"
|
|
28
|
+
* parsedPathObj.base; // "script.ts"
|
|
29
|
+
* parsedPathObj.ext; // ".ts"
|
|
30
|
+
* parsedPathObj.name; // "script"
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param path Path to process
|
|
35
|
+
* @returns An object with the parsed path components.
|
|
36
|
+
*/
|
|
37
|
+
export function parse(path) {
|
|
38
|
+
return isWindows ? windowsParse(path) : posixParse(path);
|
|
39
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// Copyright the Browserify authors. MIT License.
|
|
3
|
+
// Ported from https://github.com/browserify/path-browserify/
|
|
4
|
+
// This module is browser compatible.
|
|
5
|
+
import { CHAR_FORWARD_SLASH } from "../_common/constants.js";
|
|
6
|
+
export function isPosixPathSeparator(code) {
|
|
7
|
+
return code === CHAR_FORWARD_SLASH;
|
|
8
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { assertArgs, lastPathSegment, stripSuffix, } from "../_common/basename.js";
|
|
4
|
+
import { fromFileUrl } from "./from_file_url.js";
|
|
5
|
+
import { stripTrailingSeparators } from "../_common/strip_trailing_separators.js";
|
|
6
|
+
import { isPosixPathSeparator } from "./_util.js";
|
|
7
|
+
/**
|
|
8
|
+
* Return the last portion of a `path`.
|
|
9
|
+
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
10
|
+
*
|
|
11
|
+
* @example Usage
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { basename } from "@std/path/posix/basename";
|
|
14
|
+
* import { assertEquals } from "@std/assert";
|
|
15
|
+
*
|
|
16
|
+
* assertEquals(basename("/home/user/Documents/"), "Documents");
|
|
17
|
+
* assertEquals(basename("/home/user/Documents/image.png"), "image.png");
|
|
18
|
+
* assertEquals(basename("/home/user/Documents/image.png", ".png"), "image");
|
|
19
|
+
* assertEquals(basename(new URL("file:///home/user/Documents/image.png")), "image.png");
|
|
20
|
+
* assertEquals(basename(new URL("file:///home/user/Documents/image.png"), ".png"), "image");
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example Working with URLs
|
|
24
|
+
*
|
|
25
|
+
* Note: This function doesn't automatically strip hash and query parts from
|
|
26
|
+
* URLs. If your URL contains a hash or query, remove them before passing the
|
|
27
|
+
* URL to the function. This can be done by passing the URL to `new URL(url)`,
|
|
28
|
+
* and setting the `hash` and `search` properties to empty strings.
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { basename } from "@std/path/posix/basename";
|
|
32
|
+
* import { assertEquals } from "@std/assert";
|
|
33
|
+
*
|
|
34
|
+
* assertEquals(basename("https://deno.land/std/path/mod.ts"), "mod.ts");
|
|
35
|
+
* assertEquals(basename("https://deno.land/std/path/mod.ts", ".ts"), "mod");
|
|
36
|
+
* assertEquals(basename("https://deno.land/std/path/mod.ts?a=b"), "mod.ts?a=b");
|
|
37
|
+
* assertEquals(basename("https://deno.land/std/path/mod.ts#header"), "mod.ts#header");
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param path The path to extract the name from.
|
|
41
|
+
* @param suffix The suffix to remove from extracted name.
|
|
42
|
+
* @returns The extracted name.
|
|
43
|
+
*/
|
|
44
|
+
export function basename(path, suffix = "") {
|
|
45
|
+
if (path instanceof URL) {
|
|
46
|
+
path = fromFileUrl(path);
|
|
47
|
+
}
|
|
48
|
+
assertArgs(path, suffix);
|
|
49
|
+
const lastSegment = lastPathSegment(path, isPosixPathSeparator);
|
|
50
|
+
const strippedSegment = stripTrailingSeparators(lastSegment, isPosixPathSeparator);
|
|
51
|
+
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
52
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* The character used to separate entries in the PATH environment variable.
|
|
5
|
+
*/
|
|
6
|
+
export const DELIMITER = ":";
|
|
7
|
+
/**
|
|
8
|
+
* The character used to separate components of a file path.
|
|
9
|
+
*/
|
|
10
|
+
export const SEPARATOR = "/";
|
|
11
|
+
/**
|
|
12
|
+
* A regular expression that matches one or more path separators.
|
|
13
|
+
*/
|
|
14
|
+
export const SEPARATOR_PATTERN = /\/+/;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { assertArg } from "../_common/dirname.js";
|
|
4
|
+
import { stripTrailingSeparators } from "../_common/strip_trailing_separators.js";
|
|
5
|
+
import { isPosixPathSeparator } from "./_util.js";
|
|
6
|
+
import { fromFileUrl } from "./from_file_url.js";
|
|
7
|
+
/**
|
|
8
|
+
* Return the directory path of a `path`.
|
|
9
|
+
*
|
|
10
|
+
* @example Usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { dirname } from "@std/path/posix/dirname";
|
|
13
|
+
* import { assertEquals } from "@std/assert";
|
|
14
|
+
*
|
|
15
|
+
* assertEquals(dirname("/home/user/Documents/"), "/home/user");
|
|
16
|
+
* assertEquals(dirname("/home/user/Documents/image.png"), "/home/user/Documents");
|
|
17
|
+
* assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path");
|
|
18
|
+
* assertEquals(dirname(new URL("file:///home/user/Documents/image.png")), "/home/user/Documents");
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Working with URLs
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { dirname } from "@std/path/posix/dirname";
|
|
25
|
+
* import { assertEquals } from "@std/assert";
|
|
26
|
+
*
|
|
27
|
+
* assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path");
|
|
28
|
+
* assertEquals(dirname("https://deno.land/std/path/mod.ts?a=b"), "https://deno.land/std/path");
|
|
29
|
+
* assertEquals(dirname("https://deno.land/std/path/mod.ts#header"), "https://deno.land/std/path");
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param path The path to get the directory from.
|
|
33
|
+
* @returns The directory path.
|
|
34
|
+
*/
|
|
35
|
+
export function dirname(path) {
|
|
36
|
+
if (path instanceof URL) {
|
|
37
|
+
path = fromFileUrl(path);
|
|
38
|
+
}
|
|
39
|
+
assertArg(path);
|
|
40
|
+
let end = -1;
|
|
41
|
+
let matchedNonSeparator = false;
|
|
42
|
+
for (let i = path.length - 1; i >= 1; --i) {
|
|
43
|
+
if (isPosixPathSeparator(path.charCodeAt(i))) {
|
|
44
|
+
if (matchedNonSeparator) {
|
|
45
|
+
end = i;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
matchedNonSeparator = true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// No matches. Fallback based on provided path:
|
|
54
|
+
//
|
|
55
|
+
// - leading slashes paths
|
|
56
|
+
// "/foo" => "/"
|
|
57
|
+
// "///foo" => "/"
|
|
58
|
+
// - no slash path
|
|
59
|
+
// "foo" => "."
|
|
60
|
+
if (end === -1) {
|
|
61
|
+
return isPosixPathSeparator(path.charCodeAt(0)) ? "/" : ".";
|
|
62
|
+
}
|
|
63
|
+
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
64
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { CHAR_DOT } from "../_common/constants.js";
|
|
4
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
5
|
+
import { isPosixPathSeparator } from "./_util.js";
|
|
6
|
+
import { fromFileUrl } from "./from_file_url.js";
|
|
7
|
+
/**
|
|
8
|
+
* Return the extension of the `path` with leading period.
|
|
9
|
+
*
|
|
10
|
+
* @example Usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { extname } from "@std/path/posix/extname";
|
|
13
|
+
* import { assertEquals } from "@std/assert";
|
|
14
|
+
*
|
|
15
|
+
* assertEquals(extname("/home/user/Documents/file.ts"), ".ts");
|
|
16
|
+
* assertEquals(extname("/home/user/Documents/"), "");
|
|
17
|
+
* assertEquals(extname("/home/user/Documents/image.png"), ".png");
|
|
18
|
+
* assertEquals(extname(new URL("file:///home/user/Documents/file.ts")), ".ts");
|
|
19
|
+
* assertEquals(extname(new URL("file:///home/user/Documents/file.ts?a=b")), ".ts");
|
|
20
|
+
* assertEquals(extname(new URL("file:///home/user/Documents/file.ts#header")), ".ts");
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example Working with URLs
|
|
24
|
+
*
|
|
25
|
+
* Note: This function doesn't automatically strip hash and query parts from
|
|
26
|
+
* URLs. If your URL contains a hash or query, remove them before passing the
|
|
27
|
+
* URL to the function. This can be done by passing the URL to `new URL(url)`,
|
|
28
|
+
* and setting the `hash` and `search` properties to empty strings.
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { extname } from "@std/path/posix/extname";
|
|
32
|
+
* import { assertEquals } from "@std/assert";
|
|
33
|
+
*
|
|
34
|
+
* assertEquals(extname("https://deno.land/std/path/mod.ts"), ".ts");
|
|
35
|
+
* assertEquals(extname("https://deno.land/std/path/mod.ts?a=b"), ".ts?a=b");
|
|
36
|
+
* assertEquals(extname("https://deno.land/std/path/mod.ts#header"), ".ts#header");
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param path The path to get the extension from.
|
|
40
|
+
* @returns The extension (ex. for `file.ts` returns `.ts`).
|
|
41
|
+
*/
|
|
42
|
+
export function extname(path) {
|
|
43
|
+
if (path instanceof URL) {
|
|
44
|
+
path = fromFileUrl(path);
|
|
45
|
+
}
|
|
46
|
+
assertPath(path);
|
|
47
|
+
let startDot = -1;
|
|
48
|
+
let startPart = 0;
|
|
49
|
+
let end = -1;
|
|
50
|
+
let matchedSlash = true;
|
|
51
|
+
// Track the state of characters (if any) we see before our first dot and
|
|
52
|
+
// after any path separator we find
|
|
53
|
+
let preDotState = 0;
|
|
54
|
+
for (let i = path.length - 1; i >= 0; --i) {
|
|
55
|
+
const code = path.charCodeAt(i);
|
|
56
|
+
if (isPosixPathSeparator(code)) {
|
|
57
|
+
// If we reached a path separator that was not part of a set of path
|
|
58
|
+
// separators at the end of the string, stop now
|
|
59
|
+
if (!matchedSlash) {
|
|
60
|
+
startPart = i + 1;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (end === -1) {
|
|
66
|
+
// We saw the first non-path separator, mark this as the end of our
|
|
67
|
+
// extension
|
|
68
|
+
matchedSlash = false;
|
|
69
|
+
end = i + 1;
|
|
70
|
+
}
|
|
71
|
+
if (code === CHAR_DOT) {
|
|
72
|
+
// If this is our first dot, mark it as the start of our extension
|
|
73
|
+
if (startDot === -1)
|
|
74
|
+
startDot = i;
|
|
75
|
+
else if (preDotState !== 1)
|
|
76
|
+
preDotState = 1;
|
|
77
|
+
}
|
|
78
|
+
else if (startDot !== -1) {
|
|
79
|
+
// We saw a non-dot and non-path separator before our dot, so we should
|
|
80
|
+
// have a good chance at having a non-empty extension
|
|
81
|
+
preDotState = -1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (startDot === -1 ||
|
|
85
|
+
end === -1 ||
|
|
86
|
+
// We saw a non-dot character immediately before the dot
|
|
87
|
+
preDotState === 0 ||
|
|
88
|
+
// The (right-most) trimmed path component is exactly '..'
|
|
89
|
+
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
|
90
|
+
return "";
|
|
91
|
+
}
|
|
92
|
+
return path.slice(startDot, end);
|
|
93
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { _format, assertArg } from "../_common/format.js";
|
|
4
|
+
/**
|
|
5
|
+
* Generate a path from `ParsedPath` object.
|
|
6
|
+
*
|
|
7
|
+
* @example Usage
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { format } from "@std/path/posix/format";
|
|
10
|
+
* import { assertEquals } from "@std/assert";
|
|
11
|
+
*
|
|
12
|
+
* const path = format({
|
|
13
|
+
* root: "/",
|
|
14
|
+
* dir: "/path/dir",
|
|
15
|
+
* base: "file.txt",
|
|
16
|
+
* ext: ".txt",
|
|
17
|
+
* name: "file"
|
|
18
|
+
* });
|
|
19
|
+
* assertEquals(path, "/path/dir/file.txt");
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @param pathObject The path object to format.
|
|
23
|
+
* @returns The formatted path.
|
|
24
|
+
*/
|
|
25
|
+
export function format(pathObject) {
|
|
26
|
+
assertArg(pathObject);
|
|
27
|
+
return _format("/", pathObject);
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { assertArg } from "../_common/from_file_url.js";
|
|
4
|
+
/**
|
|
5
|
+
* Converts a file URL to a path string.
|
|
6
|
+
*
|
|
7
|
+
* @example Usage
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { fromFileUrl } from "@std/path/posix/from-file-url";
|
|
10
|
+
* import { assertEquals } from "@std/assert";
|
|
11
|
+
*
|
|
12
|
+
* assertEquals(fromFileUrl(new URL("file:///home/foo")), "/home/foo");
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param url The file URL to convert.
|
|
16
|
+
* @returns The path string.
|
|
17
|
+
*/
|
|
18
|
+
export function fromFileUrl(url) {
|
|
19
|
+
url = assertArg(url);
|
|
20
|
+
return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25"));
|
|
21
|
+
}
|