ventojs 1.14.0 → 1.15.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/esm/bare.d.ts +1 -1
- package/esm/bare.d.ts.map +1 -1
- package/esm/bare.js +1 -1
- package/esm/deps.d.ts +0 -3
- package/esm/deps.d.ts.map +1 -1
- package/esm/deps.js +0 -3
- package/esm/plugins/echo.d.ts +1 -0
- package/esm/plugins/echo.d.ts.map +1 -1
- package/esm/plugins/echo.js +23 -4
- package/esm/plugins/escape.d.ts +1 -0
- package/esm/plugins/escape.d.ts.map +1 -1
- package/esm/plugins/escape.js +14 -3
- package/esm/plugins/export.d.ts +1 -0
- package/esm/plugins/export.d.ts.map +1 -1
- package/esm/plugins/export.js +55 -33
- package/esm/plugins/for.d.ts +1 -0
- package/esm/plugins/for.d.ts.map +1 -1
- package/esm/plugins/for.js +7 -10
- package/esm/plugins/function.d.ts +1 -0
- package/esm/plugins/function.d.ts.map +1 -1
- package/esm/plugins/function.js +1 -0
- package/esm/plugins/if.d.ts +1 -0
- package/esm/plugins/if.d.ts.map +1 -1
- package/esm/plugins/if.js +1 -0
- package/esm/plugins/import.d.ts +1 -0
- package/esm/plugins/import.d.ts.map +1 -1
- package/esm/plugins/import.js +45 -3
- package/esm/plugins/include.d.ts +1 -0
- package/esm/plugins/include.d.ts.map +1 -1
- package/esm/plugins/include.js +16 -11
- package/esm/plugins/js.d.ts +1 -0
- package/esm/plugins/js.d.ts.map +1 -1
- package/esm/plugins/js.js +1 -0
- package/esm/plugins/layout.d.ts +1 -0
- package/esm/plugins/layout.d.ts.map +1 -1
- package/esm/plugins/layout.js +1 -0
- package/esm/plugins/set.d.ts +1 -0
- package/esm/plugins/set.d.ts.map +1 -1
- package/esm/plugins/set.js +1 -0
- package/esm/plugins/trim.d.ts +1 -0
- package/esm/plugins/trim.d.ts.map +1 -1
- package/esm/plugins/trim.js +1 -0
- package/esm/plugins/unescape.d.ts +1 -0
- package/esm/plugins/unescape.d.ts.map +1 -1
- package/esm/plugins/unescape.js +22 -3
- package/esm/src/environment.d.ts +2 -2
- package/esm/src/environment.d.ts.map +1 -1
- package/esm/src/environment.js +13 -16
- package/esm/src/errors.d.ts +1 -0
- package/esm/src/errors.d.ts.map +1 -1
- package/esm/src/errors.js +1 -0
- package/esm/src/js.d.ts +11 -4
- package/esm/src/js.d.ts.map +1 -1
- package/esm/src/js.js +160 -174
- package/esm/src/{loader.node.d.ts → loader.d.ts} +1 -1
- package/esm/src/loader.d.ts.map +1 -0
- package/esm/src/{loader.node.js → loader.js} +1 -1
- package/esm/src/tokenizer.d.ts +1 -6
- package/esm/src/tokenizer.d.ts.map +1 -1
- package/esm/src/tokenizer.js +66 -72
- package/esm/src/transformer.d.ts +1 -0
- package/esm/src/transformer.d.ts.map +1 -1
- package/esm/src/transformer.js +1 -0
- package/esm/src/url_loader.d.ts +10 -0
- package/esm/src/url_loader.d.ts.map +1 -0
- package/esm/src/url_loader.js +19 -0
- package/esm/test/utils.d.ts.map +1 -1
- package/package.json +53 -2
- package/esm/deps/jsr.io/@std/html/1.0.3/entities.d.ts +0 -57
- package/esm/deps/jsr.io/@std/html/1.0.3/entities.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/html/1.0.3/entities.js +0 -92
- package/esm/deps/jsr.io/@std/html/1.0.3/mod.d.ts +0 -15
- package/esm/deps/jsr.io/@std/html/1.0.3/mod.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/html/1.0.3/mod.js +0 -16
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/assert_path.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/assert_path.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/assert_path.js +0 -7
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/basename.d.ts +0 -4
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/basename.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/basename.js +0 -40
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/common.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/common.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/common.js +0 -23
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/constants.d.ts +0 -40
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/constants.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/constants.js +0 -46
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/dirname.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/dirname.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/dirname.js +0 -8
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/format.d.ts +0 -4
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/format.js +0 -19
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/from_file_url.d.ts +0 -3
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/from_file_url.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/from_file_url.js +0 -9
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/glob_to_reg_exp.d.ts +0 -35
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/glob_to_reg_exp.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/glob_to_reg_exp.js +0 -234
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/normalize.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/normalize.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/normalize.js +0 -8
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/normalize_string.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/normalize_string.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/normalize_string.js +0 -77
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/relative.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/relative.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/relative.js +0 -9
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/strip_trailing_separators.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/strip_trailing_separators.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/strip_trailing_separators.js +0 -19
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/to_file_url.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/to_file_url.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_common/to_file_url.js +0 -15
- package/esm/deps/jsr.io/@std/path/1.0.8/_os.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/_os.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/_os.js +0 -9
- package/esm/deps/jsr.io/@std/path/1.0.8/basename.d.ts +0 -28
- package/esm/deps/jsr.io/@std/path/1.0.8/basename.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/basename.js +0 -36
- package/esm/deps/jsr.io/@std/path/1.0.8/common.d.ts +0 -28
- package/esm/deps/jsr.io/@std/path/1.0.8/common.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/common.js +0 -33
- package/esm/deps/jsr.io/@std/path/1.0.8/constants.d.ts +0 -15
- package/esm/deps/jsr.io/@std/path/1.0.8/constants.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/constants.js +0 -17
- package/esm/deps/jsr.io/@std/path/1.0.8/dirname.d.ts +0 -23
- package/esm/deps/jsr.io/@std/path/1.0.8/dirname.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/dirname.js +0 -29
- package/esm/deps/jsr.io/@std/path/1.0.8/extname.d.ts +0 -23
- package/esm/deps/jsr.io/@std/path/1.0.8/extname.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/extname.js +0 -29
- package/esm/deps/jsr.io/@std/path/1.0.8/format.d.ts +0 -22
- package/esm/deps/jsr.io/@std/path/1.0.8/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/format.js +0 -27
- package/esm/deps/jsr.io/@std/path/1.0.8/from_file_url.d.ts +0 -23
- package/esm/deps/jsr.io/@std/path/1.0.8/from_file_url.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/from_file_url.js +0 -28
- package/esm/deps/jsr.io/@std/path/1.0.8/glob_to_regexp.d.ts +0 -77
- package/esm/deps/jsr.io/@std/path/1.0.8/glob_to_regexp.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/glob_to_regexp.js +0 -83
- package/esm/deps/jsr.io/@std/path/1.0.8/is_absolute.d.ts +0 -22
- package/esm/deps/jsr.io/@std/path/1.0.8/is_absolute.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/is_absolute.js +0 -28
- package/esm/deps/jsr.io/@std/path/1.0.8/is_glob.d.ts +0 -17
- package/esm/deps/jsr.io/@std/path/1.0.8/is_glob.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/is_glob.js +0 -42
- package/esm/deps/jsr.io/@std/path/1.0.8/join.d.ts +0 -23
- package/esm/deps/jsr.io/@std/path/1.0.8/join.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/join.js +0 -29
- package/esm/deps/jsr.io/@std/path/1.0.8/join_globs.d.ts +0 -28
- package/esm/deps/jsr.io/@std/path/1.0.8/join_globs.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/join_globs.js +0 -34
- package/esm/deps/jsr.io/@std/path/1.0.8/mod.d.ts +0 -54
- package/esm/deps/jsr.io/@std/path/1.0.8/mod.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/mod.js +0 -57
- package/esm/deps/jsr.io/@std/path/1.0.8/normalize.d.ts +0 -27
- package/esm/deps/jsr.io/@std/path/1.0.8/normalize.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/normalize.js +0 -33
- package/esm/deps/jsr.io/@std/path/1.0.8/normalize_glob.d.ts +0 -29
- package/esm/deps/jsr.io/@std/path/1.0.8/normalize_glob.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/normalize_glob.js +0 -35
- package/esm/deps/jsr.io/@std/path/1.0.8/parse.d.ts +0 -35
- package/esm/deps/jsr.io/@std/path/1.0.8/parse.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/parse.js +0 -39
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/_util.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/_util.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/_util.js +0 -8
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/basename.d.ts +0 -40
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/basename.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/basename.js +0 -49
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/common.d.ts +0 -19
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/common.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/common.js +0 -24
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/constants.d.ts +0 -13
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/constants.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/constants.js +0 -14
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/dirname.d.ts +0 -32
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/dirname.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/dirname.js +0 -62
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/extname.d.ts +0 -37
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/extname.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/extname.js +0 -89
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/format.d.ts +0 -24
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/format.js +0 -28
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/from_file_url.d.ts +0 -17
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/from_file_url.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/from_file_url.js +0 -21
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/glob_to_regexp.d.ts +0 -72
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/glob_to_regexp.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/glob_to_regexp.js +0 -82
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/is_absolute.d.ts +0 -17
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/is_absolute.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/is_absolute.js +0 -23
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/is_glob.d.ts +0 -2
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/is_glob.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/is_glob.js +0 -3
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/join.d.ts +0 -33
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/join.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/join.js +0 -42
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/join_globs.d.ts +0 -20
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/join_globs.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/join_globs.js +0 -40
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/mod.d.ts +0 -40
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/mod.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/mod.js +0 -43
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/normalize.d.ts +0 -40
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/normalize.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/normalize.js +0 -57
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/normalize_glob.d.ts +0 -20
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/normalize_glob.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/normalize_glob.js +0 -32
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/parse.d.ts +0 -25
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/parse.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/parse.js +0 -115
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/relative.d.ts +0 -20
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/relative.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/relative.js +0 -106
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/resolve.d.ts +0 -17
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/resolve.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/resolve.js +0 -59
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/to_file_url.d.ts +0 -18
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/to_file_url.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/to_file_url.js +0 -27
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/to_namespaced_path.d.ts +0 -16
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/to_namespaced_path.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/posix/to_namespaced_path.js +0 -20
- package/esm/deps/jsr.io/@std/path/1.0.8/relative.d.ts +0 -24
- package/esm/deps/jsr.io/@std/path/1.0.8/relative.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/relative.js +0 -30
- package/esm/deps/jsr.io/@std/path/1.0.8/resolve.d.ts +0 -22
- package/esm/deps/jsr.io/@std/path/1.0.8/resolve.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/resolve.js +0 -30
- package/esm/deps/jsr.io/@std/path/1.0.8/to_file_url.d.ts +0 -23
- package/esm/deps/jsr.io/@std/path/1.0.8/to_file_url.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/to_file_url.js +0 -28
- package/esm/deps/jsr.io/@std/path/1.0.8/to_namespaced_path.d.ts +0 -21
- package/esm/deps/jsr.io/@std/path/1.0.8/to_namespaced_path.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/to_namespaced_path.js +0 -29
- package/esm/deps/jsr.io/@std/path/1.0.8/types.d.ts +0 -38
- package/esm/deps/jsr.io/@std/path/1.0.8/types.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/types.js +0 -3
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/_util.d.ts +0 -4
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/_util.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/_util.js +0 -15
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/basename.d.ts +0 -23
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/basename.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/basename.js +0 -44
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/constants.d.ts +0 -13
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/constants.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/constants.js +0 -14
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/dirname.d.ts +0 -20
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/dirname.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/dirname.js +0 -112
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/extname.d.ts +0 -20
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/extname.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/extname.js +0 -81
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/format.d.ts +0 -24
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/format.js +0 -28
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/from_file_url.d.ts +0 -19
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/from_file_url.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/from_file_url.js +0 -30
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/glob_to_regexp.d.ts +0 -71
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/glob_to_regexp.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/glob_to_regexp.js +0 -82
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/is_absolute.d.ts +0 -17
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/is_absolute.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/is_absolute.js +0 -38
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/join.d.ts +0 -20
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/join.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/join.js +0 -74
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/join_globs.d.ts +0 -21
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/join_globs.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/join_globs.js +0 -41
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/normalize.d.ts +0 -22
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/normalize.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/normalize.js +0 -134
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/normalize_glob.d.ts +0 -20
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/normalize_glob.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/normalize_glob.js +0 -32
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/parse.d.ts +0 -25
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/parse.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/parse.js +0 -176
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/relative.d.ts +0 -23
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/relative.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/relative.js +0 -131
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/resolve.d.ts +0 -17
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/resolve.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/resolve.js +0 -154
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/to_file_url.d.ts +0 -18
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/to_file_url.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/to_file_url.js +0 -34
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/to_namespaced_path.d.ts +0 -17
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/to_namespaced_path.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.8/windows/to_namespaced_path.js +0 -49
- package/esm/src/loader.node.d.ts.map +0 -1
@@ -1,134 +0,0 @@
|
|
1
|
-
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
-
// This module is browser compatible.
|
3
|
-
import { assertArg } from "../_common/normalize.js";
|
4
|
-
import { CHAR_COLON } from "../_common/constants.js";
|
5
|
-
import { normalizeString } from "../_common/normalize_string.js";
|
6
|
-
import { isPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
7
|
-
/**
|
8
|
-
* Normalize the `path`, resolving `'..'` and `'.'` segments.
|
9
|
-
* Note that resolving these segments does not necessarily mean that all will be eliminated.
|
10
|
-
* A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`.
|
11
|
-
*
|
12
|
-
* @example Usage
|
13
|
-
* ```ts
|
14
|
-
* import { normalize } from "@std/path/windows/normalize";
|
15
|
-
* import { assertEquals } from "@std/assert";
|
16
|
-
*
|
17
|
-
* const normalized = normalize("C:\\foo\\..\\bar");
|
18
|
-
* assertEquals(normalized, "C:\\bar");
|
19
|
-
* ```
|
20
|
-
*
|
21
|
-
* Note: If you are working with file URLs,
|
22
|
-
* use the new version of `normalize` from `@std/path/windows/unstable-normalize`.
|
23
|
-
*
|
24
|
-
* @param path The path to normalize
|
25
|
-
* @returns The normalized path
|
26
|
-
*/
|
27
|
-
export function normalize(path) {
|
28
|
-
assertArg(path);
|
29
|
-
const len = path.length;
|
30
|
-
let rootEnd = 0;
|
31
|
-
let device;
|
32
|
-
let isAbsolute = false;
|
33
|
-
const code = path.charCodeAt(0);
|
34
|
-
// Try to match a root
|
35
|
-
if (len > 1) {
|
36
|
-
if (isPathSeparator(code)) {
|
37
|
-
// Possible UNC root
|
38
|
-
// If we started with a separator, we know we at least have an absolute
|
39
|
-
// path of some kind (UNC or otherwise)
|
40
|
-
isAbsolute = true;
|
41
|
-
if (isPathSeparator(path.charCodeAt(1))) {
|
42
|
-
// Matched double path separator at beginning
|
43
|
-
let j = 2;
|
44
|
-
let last = j;
|
45
|
-
// Match 1 or more non-path separators
|
46
|
-
for (; j < len; ++j) {
|
47
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
48
|
-
break;
|
49
|
-
}
|
50
|
-
if (j < len && j !== last) {
|
51
|
-
const firstPart = path.slice(last, j);
|
52
|
-
// Matched!
|
53
|
-
last = j;
|
54
|
-
// Match 1 or more path separators
|
55
|
-
for (; j < len; ++j) {
|
56
|
-
if (!isPathSeparator(path.charCodeAt(j)))
|
57
|
-
break;
|
58
|
-
}
|
59
|
-
if (j < len && j !== last) {
|
60
|
-
// Matched!
|
61
|
-
last = j;
|
62
|
-
// Match 1 or more non-path separators
|
63
|
-
for (; j < len; ++j) {
|
64
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
65
|
-
break;
|
66
|
-
}
|
67
|
-
if (j === len) {
|
68
|
-
// We matched a UNC root only
|
69
|
-
// Return the normalized version of the UNC root since there
|
70
|
-
// is nothing left to process
|
71
|
-
return `\\\\${firstPart}\\${path.slice(last)}\\`;
|
72
|
-
}
|
73
|
-
else if (j !== last) {
|
74
|
-
// We matched a UNC root with leftovers
|
75
|
-
device = `\\\\${firstPart}\\${path.slice(last, j)}`;
|
76
|
-
rootEnd = j;
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
else {
|
82
|
-
rootEnd = 1;
|
83
|
-
}
|
84
|
-
}
|
85
|
-
else if (isWindowsDeviceRoot(code)) {
|
86
|
-
// Possible device root
|
87
|
-
if (path.charCodeAt(1) === CHAR_COLON) {
|
88
|
-
device = path.slice(0, 2);
|
89
|
-
rootEnd = 2;
|
90
|
-
if (len > 2) {
|
91
|
-
if (isPathSeparator(path.charCodeAt(2))) {
|
92
|
-
// Treat separator following drive name as an absolute path
|
93
|
-
// indicator
|
94
|
-
isAbsolute = true;
|
95
|
-
rootEnd = 3;
|
96
|
-
}
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
else if (isPathSeparator(code)) {
|
102
|
-
// `path` contains just a path separator, exit early to avoid unnecessary
|
103
|
-
// work
|
104
|
-
return "\\";
|
105
|
-
}
|
106
|
-
let tail;
|
107
|
-
if (rootEnd < len) {
|
108
|
-
tail = normalizeString(path.slice(rootEnd), !isAbsolute, "\\", isPathSeparator);
|
109
|
-
}
|
110
|
-
else {
|
111
|
-
tail = "";
|
112
|
-
}
|
113
|
-
if (tail.length === 0 && !isAbsolute)
|
114
|
-
tail = ".";
|
115
|
-
if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {
|
116
|
-
tail += "\\";
|
117
|
-
}
|
118
|
-
if (device === undefined) {
|
119
|
-
if (isAbsolute) {
|
120
|
-
if (tail.length > 0)
|
121
|
-
return `\\${tail}`;
|
122
|
-
else
|
123
|
-
return "\\";
|
124
|
-
}
|
125
|
-
return tail;
|
126
|
-
}
|
127
|
-
else if (isAbsolute) {
|
128
|
-
if (tail.length > 0)
|
129
|
-
return `${device}\\${tail}`;
|
130
|
-
else
|
131
|
-
return `${device}\\`;
|
132
|
-
}
|
133
|
-
return device + tail;
|
134
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import type { GlobOptions } from "../_common/glob_to_reg_exp.js";
|
2
|
-
export type { GlobOptions };
|
3
|
-
/**
|
4
|
-
* Like normalize(), but doesn't collapse "**\/.." when `globstar` is true.
|
5
|
-
*
|
6
|
-
* @example Usage
|
7
|
-
* ```ts
|
8
|
-
* import { normalizeGlob } from "@std/path/windows/normalize-glob";
|
9
|
-
* import { assertEquals } from "@std/assert";
|
10
|
-
*
|
11
|
-
* const normalized = normalizeGlob("**\\foo\\..\\bar", { globstar: true });
|
12
|
-
* assertEquals(normalized, "**\\bar");
|
13
|
-
* ```
|
14
|
-
*
|
15
|
-
* @param glob The glob pattern to normalize.
|
16
|
-
* @param options The options for glob pattern.
|
17
|
-
* @returns The normalized glob pattern.
|
18
|
-
*/
|
19
|
-
export declare function normalizeGlob(glob: string, options?: Pick<GlobOptions, "globstar">): string;
|
20
|
-
//# sourceMappingURL=normalize_glob.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"normalize_glob.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.8/windows/normalize_glob.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIjE,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAM,GAC1C,MAAM,CAcR"}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
-
// This module is browser compatible.
|
3
|
-
import { normalize } from "./normalize.js";
|
4
|
-
import { SEPARATOR_PATTERN } from "./constants.js";
|
5
|
-
/**
|
6
|
-
* Like normalize(), but doesn't collapse "**\/.." when `globstar` is true.
|
7
|
-
*
|
8
|
-
* @example Usage
|
9
|
-
* ```ts
|
10
|
-
* import { normalizeGlob } from "@std/path/windows/normalize-glob";
|
11
|
-
* import { assertEquals } from "@std/assert";
|
12
|
-
*
|
13
|
-
* const normalized = normalizeGlob("**\\foo\\..\\bar", { globstar: true });
|
14
|
-
* assertEquals(normalized, "**\\bar");
|
15
|
-
* ```
|
16
|
-
*
|
17
|
-
* @param glob The glob pattern to normalize.
|
18
|
-
* @param options The options for glob pattern.
|
19
|
-
* @returns The normalized glob pattern.
|
20
|
-
*/
|
21
|
-
export function normalizeGlob(glob, options = {}) {
|
22
|
-
const { globstar = false } = options;
|
23
|
-
if (glob.match(/\0/g)) {
|
24
|
-
throw new Error(`Glob contains invalid characters: "${glob}"`);
|
25
|
-
}
|
26
|
-
if (!globstar) {
|
27
|
-
return normalize(glob);
|
28
|
-
}
|
29
|
-
const s = SEPARATOR_PATTERN.source;
|
30
|
-
const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
|
31
|
-
return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
|
32
|
-
}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import type { ParsedPath } from "../types.js";
|
2
|
-
export type { ParsedPath } from "../types.js";
|
3
|
-
/**
|
4
|
-
* Return a `ParsedPath` object of the `path`.
|
5
|
-
*
|
6
|
-
* @example Usage
|
7
|
-
* ```ts
|
8
|
-
* import { parse } from "@std/path/windows/parse";
|
9
|
-
* import { assertEquals } from "@std/assert";
|
10
|
-
*
|
11
|
-
* const parsed = parse("C:\\foo\\bar\\baz.ext");
|
12
|
-
* assertEquals(parsed, {
|
13
|
-
* root: "C:\\",
|
14
|
-
* dir: "C:\\foo\\bar",
|
15
|
-
* base: "baz.ext",
|
16
|
-
* ext: ".ext",
|
17
|
-
* name: "baz",
|
18
|
-
* });
|
19
|
-
* ```
|
20
|
-
*
|
21
|
-
* @param path The path to parse.
|
22
|
-
* @returns The `ParsedPath` object.
|
23
|
-
*/
|
24
|
-
export declare function parse(path: string): ParsedPath;
|
25
|
-
//# sourceMappingURL=parse.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.8/windows/parse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAwJ9C"}
|
@@ -1,176 +0,0 @@
|
|
1
|
-
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
-
// This module is browser compatible.
|
3
|
-
import { CHAR_COLON, CHAR_DOT } from "../_common/constants.js";
|
4
|
-
import { assertPath } from "../_common/assert_path.js";
|
5
|
-
import { isPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
6
|
-
/**
|
7
|
-
* Return a `ParsedPath` object of the `path`.
|
8
|
-
*
|
9
|
-
* @example Usage
|
10
|
-
* ```ts
|
11
|
-
* import { parse } from "@std/path/windows/parse";
|
12
|
-
* import { assertEquals } from "@std/assert";
|
13
|
-
*
|
14
|
-
* const parsed = parse("C:\\foo\\bar\\baz.ext");
|
15
|
-
* assertEquals(parsed, {
|
16
|
-
* root: "C:\\",
|
17
|
-
* dir: "C:\\foo\\bar",
|
18
|
-
* base: "baz.ext",
|
19
|
-
* ext: ".ext",
|
20
|
-
* name: "baz",
|
21
|
-
* });
|
22
|
-
* ```
|
23
|
-
*
|
24
|
-
* @param path The path to parse.
|
25
|
-
* @returns The `ParsedPath` object.
|
26
|
-
*/
|
27
|
-
export function parse(path) {
|
28
|
-
assertPath(path);
|
29
|
-
const ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
30
|
-
const len = path.length;
|
31
|
-
if (len === 0)
|
32
|
-
return ret;
|
33
|
-
let rootEnd = 0;
|
34
|
-
let code = path.charCodeAt(0);
|
35
|
-
// Try to match a root
|
36
|
-
if (len > 1) {
|
37
|
-
if (isPathSeparator(code)) {
|
38
|
-
// Possible UNC root
|
39
|
-
rootEnd = 1;
|
40
|
-
if (isPathSeparator(path.charCodeAt(1))) {
|
41
|
-
// Matched double path separator at beginning
|
42
|
-
let j = 2;
|
43
|
-
let last = j;
|
44
|
-
// Match 1 or more non-path separators
|
45
|
-
for (; j < len; ++j) {
|
46
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
47
|
-
break;
|
48
|
-
}
|
49
|
-
if (j < len && j !== last) {
|
50
|
-
// Matched!
|
51
|
-
last = j;
|
52
|
-
// Match 1 or more path separators
|
53
|
-
for (; j < len; ++j) {
|
54
|
-
if (!isPathSeparator(path.charCodeAt(j)))
|
55
|
-
break;
|
56
|
-
}
|
57
|
-
if (j < len && j !== last) {
|
58
|
-
// Matched!
|
59
|
-
last = j;
|
60
|
-
// Match 1 or more non-path separators
|
61
|
-
for (; j < len; ++j) {
|
62
|
-
if (isPathSeparator(path.charCodeAt(j)))
|
63
|
-
break;
|
64
|
-
}
|
65
|
-
if (j === len) {
|
66
|
-
// We matched a UNC root only
|
67
|
-
rootEnd = j;
|
68
|
-
}
|
69
|
-
else if (j !== last) {
|
70
|
-
// We matched a UNC root with leftovers
|
71
|
-
rootEnd = j + 1;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
}
|
75
|
-
}
|
76
|
-
}
|
77
|
-
else if (isWindowsDeviceRoot(code)) {
|
78
|
-
// Possible device root
|
79
|
-
if (path.charCodeAt(1) === CHAR_COLON) {
|
80
|
-
rootEnd = 2;
|
81
|
-
if (len > 2) {
|
82
|
-
if (isPathSeparator(path.charCodeAt(2))) {
|
83
|
-
if (len === 3) {
|
84
|
-
// `path` contains just a drive root, exit early to avoid
|
85
|
-
// unnecessary work
|
86
|
-
ret.root = ret.dir = path;
|
87
|
-
ret.base = "\\";
|
88
|
-
return ret;
|
89
|
-
}
|
90
|
-
rootEnd = 3;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
else {
|
94
|
-
// `path` contains just a relative drive root, exit early to avoid
|
95
|
-
// unnecessary work
|
96
|
-
ret.root = ret.dir = path;
|
97
|
-
return ret;
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}
|
102
|
-
else if (isPathSeparator(code)) {
|
103
|
-
// `path` contains just a path separator, exit early to avoid
|
104
|
-
// unnecessary work
|
105
|
-
ret.root = ret.dir = path;
|
106
|
-
ret.base = "\\";
|
107
|
-
return ret;
|
108
|
-
}
|
109
|
-
if (rootEnd > 0)
|
110
|
-
ret.root = path.slice(0, rootEnd);
|
111
|
-
let startDot = -1;
|
112
|
-
let startPart = rootEnd;
|
113
|
-
let end = -1;
|
114
|
-
let matchedSlash = true;
|
115
|
-
let i = path.length - 1;
|
116
|
-
// Track the state of characters (if any) we see before our first dot and
|
117
|
-
// after any path separator we find
|
118
|
-
let preDotState = 0;
|
119
|
-
// Get non-dir info
|
120
|
-
for (; i >= rootEnd; --i) {
|
121
|
-
code = path.charCodeAt(i);
|
122
|
-
if (isPathSeparator(code)) {
|
123
|
-
// If we reached a path separator that was not part of a set of path
|
124
|
-
// separators at the end of the string, stop now
|
125
|
-
if (!matchedSlash) {
|
126
|
-
startPart = i + 1;
|
127
|
-
break;
|
128
|
-
}
|
129
|
-
continue;
|
130
|
-
}
|
131
|
-
if (end === -1) {
|
132
|
-
// We saw the first non-path separator, mark this as the end of our
|
133
|
-
// extension
|
134
|
-
matchedSlash = false;
|
135
|
-
end = i + 1;
|
136
|
-
}
|
137
|
-
if (code === CHAR_DOT) {
|
138
|
-
// If this is our first dot, mark it as the start of our extension
|
139
|
-
if (startDot === -1)
|
140
|
-
startDot = i;
|
141
|
-
else if (preDotState !== 1)
|
142
|
-
preDotState = 1;
|
143
|
-
}
|
144
|
-
else if (startDot !== -1) {
|
145
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
146
|
-
// have a good chance at having a non-empty extension
|
147
|
-
preDotState = -1;
|
148
|
-
}
|
149
|
-
}
|
150
|
-
if (startDot === -1 ||
|
151
|
-
end === -1 ||
|
152
|
-
// We saw a non-dot character immediately before the dot
|
153
|
-
preDotState === 0 ||
|
154
|
-
// The (right-most) trimmed path component is exactly '..'
|
155
|
-
(preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)) {
|
156
|
-
if (end !== -1) {
|
157
|
-
ret.base = ret.name = path.slice(startPart, end);
|
158
|
-
}
|
159
|
-
}
|
160
|
-
else {
|
161
|
-
ret.name = path.slice(startPart, startDot);
|
162
|
-
ret.base = path.slice(startPart, end);
|
163
|
-
ret.ext = path.slice(startDot, end);
|
164
|
-
}
|
165
|
-
// Fallback to '\' in case there is no basename
|
166
|
-
ret.base = ret.base || "\\";
|
167
|
-
// If the directory is the root, use the entire root as the `dir` including
|
168
|
-
// the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the
|
169
|
-
// trailing slash (`C:\abc\def` -> `C:\abc`).
|
170
|
-
if (startPart > 0 && startPart !== rootEnd) {
|
171
|
-
ret.dir = path.slice(0, startPart - 1);
|
172
|
-
}
|
173
|
-
else
|
174
|
-
ret.dir = ret.root;
|
175
|
-
return ret;
|
176
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Return the relative path from `from` to `to` based on current working directory.
|
3
|
-
*
|
4
|
-
* An example in windws, for instance:
|
5
|
-
* from = 'C:\\orandea\\test\\aaa'
|
6
|
-
* to = 'C:\\orandea\\impl\\bbb'
|
7
|
-
* The output of the function should be: '..\\..\\impl\\bbb'
|
8
|
-
*
|
9
|
-
* @example Usage
|
10
|
-
* ```ts
|
11
|
-
* import { relative } from "@std/path/windows/relative";
|
12
|
-
* import { assertEquals } from "@std/assert";
|
13
|
-
*
|
14
|
-
* const relativePath = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb");
|
15
|
-
* assertEquals(relativePath, "..\\..\\impl\\bbb");
|
16
|
-
* ```
|
17
|
-
*
|
18
|
-
* @param from The path from which to calculate the relative path
|
19
|
-
* @param to The path to which to calculate the relative path
|
20
|
-
* @returns The relative path from `from` to `to`
|
21
|
-
*/
|
22
|
-
export declare function relative(from: string, to: string): string;
|
23
|
-
//# sourceMappingURL=relative.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"relative.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.8/windows/relative.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAmGzD"}
|
@@ -1,131 +0,0 @@
|
|
1
|
-
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2
|
-
// This module is browser compatible.
|
3
|
-
import { CHAR_BACKWARD_SLASH } from "../_common/constants.js";
|
4
|
-
import { resolve } from "./resolve.js";
|
5
|
-
import { assertArgs } from "../_common/relative.js";
|
6
|
-
/**
|
7
|
-
* Return the relative path from `from` to `to` based on current working directory.
|
8
|
-
*
|
9
|
-
* An example in windws, for instance:
|
10
|
-
* from = 'C:\\orandea\\test\\aaa'
|
11
|
-
* to = 'C:\\orandea\\impl\\bbb'
|
12
|
-
* The output of the function should be: '..\\..\\impl\\bbb'
|
13
|
-
*
|
14
|
-
* @example Usage
|
15
|
-
* ```ts
|
16
|
-
* import { relative } from "@std/path/windows/relative";
|
17
|
-
* import { assertEquals } from "@std/assert";
|
18
|
-
*
|
19
|
-
* const relativePath = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb");
|
20
|
-
* assertEquals(relativePath, "..\\..\\impl\\bbb");
|
21
|
-
* ```
|
22
|
-
*
|
23
|
-
* @param from The path from which to calculate the relative path
|
24
|
-
* @param to The path to which to calculate the relative path
|
25
|
-
* @returns The relative path from `from` to `to`
|
26
|
-
*/
|
27
|
-
export function relative(from, to) {
|
28
|
-
assertArgs(from, to);
|
29
|
-
const fromOrig = resolve(from);
|
30
|
-
const toOrig = resolve(to);
|
31
|
-
if (fromOrig === toOrig)
|
32
|
-
return "";
|
33
|
-
from = fromOrig.toLowerCase();
|
34
|
-
to = toOrig.toLowerCase();
|
35
|
-
if (from === to)
|
36
|
-
return "";
|
37
|
-
// Trim any leading backslashes
|
38
|
-
let fromStart = 0;
|
39
|
-
let fromEnd = from.length;
|
40
|
-
for (; fromStart < fromEnd; ++fromStart) {
|
41
|
-
if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH)
|
42
|
-
break;
|
43
|
-
}
|
44
|
-
// Trim trailing backslashes (applicable to UNC paths only)
|
45
|
-
for (; fromEnd - 1 > fromStart; --fromEnd) {
|
46
|
-
if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH)
|
47
|
-
break;
|
48
|
-
}
|
49
|
-
const fromLen = fromEnd - fromStart;
|
50
|
-
// Trim any leading backslashes
|
51
|
-
let toStart = 0;
|
52
|
-
let toEnd = to.length;
|
53
|
-
for (; toStart < toEnd; ++toStart) {
|
54
|
-
if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH)
|
55
|
-
break;
|
56
|
-
}
|
57
|
-
// Trim trailing backslashes (applicable to UNC paths only)
|
58
|
-
for (; toEnd - 1 > toStart; --toEnd) {
|
59
|
-
if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH)
|
60
|
-
break;
|
61
|
-
}
|
62
|
-
const toLen = toEnd - toStart;
|
63
|
-
// Compare paths to find the longest common path from root
|
64
|
-
const length = fromLen < toLen ? fromLen : toLen;
|
65
|
-
let lastCommonSep = -1;
|
66
|
-
let i = 0;
|
67
|
-
for (; i <= length; ++i) {
|
68
|
-
if (i === length) {
|
69
|
-
if (toLen > length) {
|
70
|
-
if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) {
|
71
|
-
// We get here if `from` is the exact base path for `to`.
|
72
|
-
// For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz'
|
73
|
-
return toOrig.slice(toStart + i + 1);
|
74
|
-
}
|
75
|
-
else if (i === 2) {
|
76
|
-
// We get here if `from` is the device root.
|
77
|
-
// For example: from='C:\\'; to='C:\\foo'
|
78
|
-
return toOrig.slice(toStart + i);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
if (fromLen > length) {
|
82
|
-
if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) {
|
83
|
-
// We get here if `to` is the exact base path for `from`.
|
84
|
-
// For example: from='C:\\foo\\bar'; to='C:\\foo'
|
85
|
-
lastCommonSep = i;
|
86
|
-
}
|
87
|
-
else if (i === 2) {
|
88
|
-
// We get here if `to` is the device root.
|
89
|
-
// For example: from='C:\\foo\\bar'; to='C:\\'
|
90
|
-
lastCommonSep = 3;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
break;
|
94
|
-
}
|
95
|
-
const fromCode = from.charCodeAt(fromStart + i);
|
96
|
-
const toCode = to.charCodeAt(toStart + i);
|
97
|
-
if (fromCode !== toCode)
|
98
|
-
break;
|
99
|
-
else if (fromCode === CHAR_BACKWARD_SLASH)
|
100
|
-
lastCommonSep = i;
|
101
|
-
}
|
102
|
-
// We found a mismatch before the first common path separator was seen, so
|
103
|
-
// return the original `to`.
|
104
|
-
if (i !== length && lastCommonSep === -1) {
|
105
|
-
return toOrig;
|
106
|
-
}
|
107
|
-
let out = "";
|
108
|
-
if (lastCommonSep === -1)
|
109
|
-
lastCommonSep = 0;
|
110
|
-
// Generate the relative path based on the path difference between `to` and
|
111
|
-
// `from`
|
112
|
-
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
113
|
-
if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) {
|
114
|
-
if (out.length === 0)
|
115
|
-
out += "..";
|
116
|
-
else
|
117
|
-
out += "\\..";
|
118
|
-
}
|
119
|
-
}
|
120
|
-
// Lastly, append the rest of the destination (`to`) path that comes after
|
121
|
-
// the common path parts
|
122
|
-
if (out.length > 0) {
|
123
|
-
return out + toOrig.slice(toStart + lastCommonSep, toEnd);
|
124
|
-
}
|
125
|
-
else {
|
126
|
-
toStart += lastCommonSep;
|
127
|
-
if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH)
|
128
|
-
++toStart;
|
129
|
-
return toOrig.slice(toStart, toEnd);
|
130
|
-
}
|
131
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Resolves path segments into a `path`.
|
3
|
-
*
|
4
|
-
* @example Usage
|
5
|
-
* ```ts
|
6
|
-
* import { resolve } from "@std/path/windows/resolve";
|
7
|
-
* import { assertEquals } from "@std/assert";
|
8
|
-
*
|
9
|
-
* const resolved = resolve("C:\\foo\\bar", "..\\baz");
|
10
|
-
* assertEquals(resolved, "C:\\foo\\baz");
|
11
|
-
* ```
|
12
|
-
*
|
13
|
-
* @param pathSegments The path segments to process to path
|
14
|
-
* @returns The resolved path
|
15
|
-
*/
|
16
|
-
export declare function resolve(...pathSegments: string[]): string;
|
17
|
-
//# sourceMappingURL=resolve.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.8/windows/resolve.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,GAAG,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAwJzD"}
|