@bolt-foundry/gambit 0.8.1 → 0.8.5-rc.10
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 +150 -2
- package/README.md +109 -23
- package/esm/_dnt.polyfills.d.ts +17 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +123 -0
- package/esm/deps/jsr.io/@std/collections/1.1.6/deep_merge.d.ts +322 -0
- package/esm/deps/jsr.io/@std/collections/1.1.6/deep_merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.1.6/deep_merge.js +105 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.d.ts +14 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.js +34 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.d.ts +13 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.js +18 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_is_same_path.d.ts +10 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_is_same_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_is_same_path.js +17 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_is_subdir.d.ts +12 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_is_subdir.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_is_subdir.js +25 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_to_path_string.d.ts +9 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_to_path_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/_to_path_string.js +13 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/copy.d.ts +117 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/copy.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/copy.js +313 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/empty_dir.d.ts +48 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/empty_dir.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/empty_dir.js +87 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_dir.d.ts +49 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_dir.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_dir.js +102 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_file.d.ts +47 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_file.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_file.js +90 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_link.d.ts +49 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_link.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_link.js +61 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.d.ts +70 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.js +156 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/eol.d.ts +52 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/eol.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/eol.js +67 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/exists.d.ts +218 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/exists.js +271 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/expand_glob.d.ts +267 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/expand_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/expand_glob.js +442 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/mod.d.ts +29 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/mod.js +29 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/move.d.ts +86 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/move.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/move.js +142 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/walk.d.ts +777 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/walk.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.23/walk.js +846 -0
- package/esm/deps/jsr.io/@std/json/1.0.3/types.d.ts +7 -0
- package/esm/deps/jsr.io/@std/json/1.0.3/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/json/1.0.3/types.js +3 -0
- package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts +20 -0
- package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/jsonc/1.0.2/mod.js +21 -0
- package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts +21 -0
- package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.js +320 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/constants.d.ts +1 -1
- package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.js +753 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/mod.js +110 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/parse.js +25 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/toml/1.0.11/stringify.js +283 -0
- package/esm/gambit/simulator-ui/dist/bundle.js +12670 -5471
- package/esm/gambit/simulator-ui/dist/bundle.js.map +4 -4
- package/esm/gambit/simulator-ui/dist/favicon.ico +0 -0
- package/esm/mod.d.ts +21 -7
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +14 -4
- package/esm/src/cli_utils.d.ts +1 -0
- package/esm/src/cli_utils.d.ts.map +1 -1
- package/esm/src/cli_utils.js +52 -4
- package/esm/src/default_runtime.d.ts +46 -0
- package/esm/src/default_runtime.d.ts.map +1 -0
- package/esm/src/default_runtime.js +415 -0
- package/esm/src/durable_streams.js +26 -1
- package/esm/src/model_matchers.d.ts +10 -0
- package/esm/src/model_matchers.d.ts.map +1 -0
- package/esm/src/model_matchers.js +26 -0
- package/esm/src/openai_compat.d.ts +74 -0
- package/esm/src/openai_compat.d.ts.map +1 -0
- package/esm/src/openai_compat.js +329 -0
- package/esm/src/project_config.d.ts +47 -0
- package/esm/src/project_config.d.ts.map +1 -0
- package/esm/src/project_config.js +134 -0
- package/esm/src/providers/codex.d.ts +37 -0
- package/esm/src/providers/codex.d.ts.map +1 -0
- package/esm/src/providers/codex.js +810 -0
- package/esm/src/providers/google.d.ts +18 -0
- package/esm/src/providers/google.d.ts.map +1 -0
- package/esm/src/providers/google.js +428 -0
- package/esm/src/providers/ollama.d.ts +19 -0
- package/esm/src/providers/ollama.d.ts.map +1 -0
- package/esm/src/providers/ollama.js +789 -0
- package/esm/src/providers/openrouter.d.ts +26 -0
- package/esm/src/providers/openrouter.d.ts.map +1 -0
- package/esm/src/providers/openrouter.js +886 -0
- package/esm/src/providers/router.d.ts +19 -0
- package/esm/src/providers/router.d.ts.map +1 -0
- package/esm/src/providers/router.js +93 -0
- package/esm/src/server.d.ts +11 -0
- package/esm/src/server.d.ts.map +1 -1
- package/esm/src/server.js +3927 -689
- package/esm/src/server_feedback_grading_routes.d.ts +32 -0
- package/esm/src/server_feedback_grading_routes.d.ts.map +1 -0
- package/esm/src/server_feedback_grading_routes.js +305 -0
- package/esm/src/server_helpers.d.ts +4 -0
- package/esm/src/server_helpers.d.ts.map +1 -0
- package/esm/src/server_helpers.js +46 -0
- package/esm/src/server_session_store.d.ts +87 -0
- package/esm/src/server_session_store.d.ts.map +1 -0
- package/esm/src/server_session_store.js +873 -0
- package/esm/src/server_types.d.ts +110 -0
- package/esm/src/server_types.d.ts.map +1 -0
- package/esm/src/server_types.js +1 -0
- package/esm/src/server_ui_routes.d.ts +33 -0
- package/esm/src/server_ui_routes.d.ts.map +1 -0
- package/esm/src/server_ui_routes.js +136 -0
- package/esm/src/session_artifacts.d.ts +22 -0
- package/esm/src/session_artifacts.d.ts.map +1 -0
- package/esm/src/session_artifacts.js +243 -0
- package/esm/src/trace.d.ts.map +1 -1
- package/esm/src/trace.js +8 -5
- package/esm/src/workspace.d.ts +19 -0
- package/esm/src/workspace.d.ts.map +1 -0
- package/esm/src/workspace.js +162 -0
- package/esm/src/workspace_contract.d.ts +78 -0
- package/esm/src/workspace_contract.d.ts.map +1 -0
- package/esm/src/workspace_contract.js +76 -0
- package/package.json +3 -2
- package/script/_dnt.polyfills.d.ts +17 -0
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +123 -0
- package/script/deps/jsr.io/@std/collections/1.1.6/deep_merge.d.ts +322 -0
- package/script/deps/jsr.io/@std/collections/1.1.6/deep_merge.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/collections/1.1.6/deep_merge.js +108 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.d.ts +14 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_create_walk_entry.js +71 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.d.ts +13 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_get_file_info_type.js +21 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_is_same_path.d.ts +10 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_is_same_path.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_is_same_path.js +20 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_is_subdir.d.ts +12 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_is_subdir.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_is_subdir.js +28 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_to_path_string.d.ts +9 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_to_path_string.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/_to_path_string.js +16 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/copy.d.ts +117 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/copy.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/copy.js +350 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/empty_dir.d.ts +48 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/empty_dir.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/empty_dir.js +124 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_dir.d.ts +49 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_dir.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_dir.js +139 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_file.d.ts +47 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_file.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_file.js +127 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_link.d.ts +49 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_link.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_link.js +98 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.d.ts +70 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/ensure_symlink.js +193 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/eol.d.ts +52 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/eol.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/eol.js +105 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/exists.d.ts +218 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/exists.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/exists.js +308 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/expand_glob.d.ts +267 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/expand_glob.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/expand_glob.js +479 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/mod.d.ts +29 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/mod.js +45 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/move.d.ts +86 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/move.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/move.js +179 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/walk.d.ts +777 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/walk.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.23/walk.js +883 -0
- package/script/deps/jsr.io/@std/json/1.0.3/types.d.ts +7 -0
- package/script/deps/jsr.io/@std/json/1.0.3/types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/json/1.0.3/types.js +4 -0
- package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts +20 -0
- package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/jsonc/1.0.2/mod.js +37 -0
- package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts +21 -0
- package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/jsonc/1.0.2/parse.js +323 -0
- package/script/deps/jsr.io/@std/path/1.1.4/constants.d.ts +1 -1
- package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts +93 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/_parser.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/_parser.js +781 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts +109 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/mod.js +126 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts +21 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/parse.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/parse.js +28 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts +35 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/stringify.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/toml/1.0.11/stringify.js +286 -0
- package/script/gambit/simulator-ui/dist/bundle.js +12670 -5471
- package/script/gambit/simulator-ui/dist/bundle.js.map +4 -4
- package/script/gambit/simulator-ui/dist/favicon.ico +0 -0
- package/script/mod.d.ts +21 -7
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +22 -7
- package/script/src/cli_utils.d.ts +1 -0
- package/script/src/cli_utils.d.ts.map +1 -1
- package/script/src/cli_utils.js +52 -3
- package/script/src/default_runtime.d.ts +46 -0
- package/script/src/default_runtime.d.ts.map +1 -0
- package/script/src/default_runtime.js +452 -0
- package/script/src/durable_streams.js +26 -1
- package/script/src/model_matchers.d.ts +10 -0
- package/script/src/model_matchers.d.ts.map +1 -0
- package/script/src/model_matchers.js +29 -0
- package/script/src/openai_compat.d.ts +74 -0
- package/script/src/openai_compat.d.ts.map +1 -0
- package/script/src/openai_compat.js +366 -0
- package/script/src/project_config.d.ts +47 -0
- package/script/src/project_config.d.ts.map +1 -0
- package/script/src/project_config.js +173 -0
- package/script/src/providers/codex.d.ts +37 -0
- package/script/src/providers/codex.d.ts.map +1 -0
- package/script/src/providers/codex.js +850 -0
- package/script/src/providers/google.d.ts +18 -0
- package/script/src/providers/google.d.ts.map +1 -0
- package/script/src/providers/google.js +435 -0
- package/script/src/providers/ollama.d.ts +19 -0
- package/script/src/providers/ollama.d.ts.map +1 -0
- package/script/src/providers/ollama.js +831 -0
- package/script/src/providers/openrouter.d.ts +26 -0
- package/script/src/providers/openrouter.d.ts.map +1 -0
- package/script/src/providers/openrouter.js +926 -0
- package/script/src/providers/router.d.ts +19 -0
- package/script/src/providers/router.d.ts.map +1 -0
- package/script/src/providers/router.js +96 -0
- package/script/src/server.d.ts +11 -0
- package/script/src/server.d.ts.map +1 -1
- package/script/src/server.js +3931 -693
- package/script/src/server_feedback_grading_routes.d.ts +32 -0
- package/script/src/server_feedback_grading_routes.d.ts.map +1 -0
- package/script/src/server_feedback_grading_routes.js +343 -0
- package/script/src/server_helpers.d.ts +4 -0
- package/script/src/server_helpers.d.ts.map +1 -0
- package/script/src/server_helpers.js +84 -0
- package/script/src/server_session_store.d.ts +87 -0
- package/script/src/server_session_store.d.ts.map +1 -0
- package/script/src/server_session_store.js +910 -0
- package/script/src/server_types.d.ts +110 -0
- package/script/src/server_types.d.ts.map +1 -0
- package/script/src/server_types.js +2 -0
- package/script/src/server_ui_routes.d.ts +33 -0
- package/script/src/server_ui_routes.d.ts.map +1 -0
- package/script/src/server_ui_routes.js +173 -0
- package/script/src/session_artifacts.d.ts +22 -0
- package/script/src/session_artifacts.d.ts.map +1 -0
- package/script/src/session_artifacts.js +279 -0
- package/script/src/trace.d.ts.map +1 -1
- package/script/src/trace.js +8 -5
- package/script/src/workspace.d.ts +19 -0
- package/script/src/workspace.d.ts.map +1 -0
- package/script/src/workspace.js +199 -0
- package/script/src/workspace_contract.d.ts +78 -0
- package/script/src/workspace_contract.d.ts.map +1 -0
- package/script/src/workspace_contract.js +84 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.expandGlob = expandGlob;
|
|
37
|
+
exports.expandGlobSync = expandGlobSync;
|
|
38
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
39
|
+
const dntShim = __importStar(require("../../../../../_dnt.shims.js"));
|
|
40
|
+
const glob_to_regexp_js_1 = require("../../path/1.1.4/glob_to_regexp.js");
|
|
41
|
+
const join_globs_js_1 = require("../../path/1.1.4/join_globs.js");
|
|
42
|
+
const is_glob_js_1 = require("../../path/1.1.4/is_glob.js");
|
|
43
|
+
const is_absolute_js_1 = require("../../path/1.1.4/is_absolute.js");
|
|
44
|
+
const resolve_js_1 = require("../../path/1.1.4/resolve.js");
|
|
45
|
+
const constants_js_1 = require("../../path/1.1.4/constants.js");
|
|
46
|
+
const walk_js_1 = require("./walk.js");
|
|
47
|
+
const _to_path_string_js_1 = require("./_to_path_string.js");
|
|
48
|
+
const _create_walk_entry_js_1 = require("./_create_walk_entry.js");
|
|
49
|
+
const os_js_1 = require("../../internal/1.0.12/os.js");
|
|
50
|
+
function split(path) {
|
|
51
|
+
const s = constants_js_1.SEPARATOR_PATTERN.source;
|
|
52
|
+
const segments = path
|
|
53
|
+
.replace(new RegExp(`^${s}|${s}$`, "g"), "")
|
|
54
|
+
.split(constants_js_1.SEPARATOR_PATTERN);
|
|
55
|
+
const isAbsolute_ = (0, is_absolute_js_1.isAbsolute)(path);
|
|
56
|
+
const split = {
|
|
57
|
+
segments,
|
|
58
|
+
isAbsolute: isAbsolute_,
|
|
59
|
+
hasTrailingSep: path.match(new RegExp(`${s}$`)) !== null,
|
|
60
|
+
};
|
|
61
|
+
if (os_js_1.isWindows && isAbsolute_) {
|
|
62
|
+
split.winRoot = segments.shift();
|
|
63
|
+
}
|
|
64
|
+
return split;
|
|
65
|
+
}
|
|
66
|
+
function throwUnlessNotFound(error) {
|
|
67
|
+
if (!(error instanceof dntShim.Deno.errors.NotFound)) {
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function comparePath(a, b) {
|
|
72
|
+
if (a.path < b.path)
|
|
73
|
+
return -1;
|
|
74
|
+
if (a.path > b.path)
|
|
75
|
+
return 1;
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns an async iterator that yields each file path matching the given glob
|
|
80
|
+
* pattern.
|
|
81
|
+
*
|
|
82
|
+
* The file paths are absolute paths. If `root` is not provided, the current
|
|
83
|
+
* working directory is used. The `root` directory is not included in the
|
|
84
|
+
* yielded file paths.
|
|
85
|
+
*
|
|
86
|
+
* Requires `--allow-read` permission.
|
|
87
|
+
*
|
|
88
|
+
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
|
|
89
|
+
* for more information on Deno's permissions system.
|
|
90
|
+
*
|
|
91
|
+
* @param glob The glob pattern to expand.
|
|
92
|
+
* @param options Additional options for the expansion.
|
|
93
|
+
*
|
|
94
|
+
* @returns An async iterator that yields each walk entry matching the glob
|
|
95
|
+
* pattern.
|
|
96
|
+
*
|
|
97
|
+
* @example Basic usage
|
|
98
|
+
*
|
|
99
|
+
* File structure:
|
|
100
|
+
* ```
|
|
101
|
+
* folder
|
|
102
|
+
* ├── script.ts
|
|
103
|
+
* └── foo.ts
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* ```ts ignore
|
|
107
|
+
* // script.ts
|
|
108
|
+
* import { expandGlob } from "@std/fs/expand-glob";
|
|
109
|
+
*
|
|
110
|
+
* await Array.fromAsync(expandGlob("*.ts"));
|
|
111
|
+
* // [
|
|
112
|
+
* // {
|
|
113
|
+
* // path: "/Users/user/folder/script.ts",
|
|
114
|
+
* // name: "script.ts",
|
|
115
|
+
* // isFile: true,
|
|
116
|
+
* // isDirectory: false,
|
|
117
|
+
* // isSymlink: false,
|
|
118
|
+
* // },
|
|
119
|
+
* // {
|
|
120
|
+
* // path: "/Users/user/folder/foo.ts",
|
|
121
|
+
* // name: "foo.ts",
|
|
122
|
+
* // isFile: true,
|
|
123
|
+
* // isDirectory: false,
|
|
124
|
+
* // isSymlink: false,
|
|
125
|
+
* // },
|
|
126
|
+
* // ]
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* @example Define root directory
|
|
130
|
+
*
|
|
131
|
+
* Setting the `root` option to `/folder` will expand the glob pattern from the
|
|
132
|
+
* `/folder` directory.
|
|
133
|
+
*
|
|
134
|
+
* File structure:
|
|
135
|
+
* ```
|
|
136
|
+
* folder
|
|
137
|
+
* ├── subdir
|
|
138
|
+
* │ └── bar.ts
|
|
139
|
+
* ├── script.ts
|
|
140
|
+
* └── foo.ts
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* ```ts ignore
|
|
144
|
+
* // script.ts
|
|
145
|
+
* import { expandGlob } from "@std/fs/expand-glob";
|
|
146
|
+
*
|
|
147
|
+
* await Array.fromAsync(expandGlob("*.ts", { root: "./subdir" }));
|
|
148
|
+
* // [
|
|
149
|
+
* // {
|
|
150
|
+
* // path: "/Users/user/folder/subdir/bar.ts",
|
|
151
|
+
* // name: "bar.ts",
|
|
152
|
+
* // isFile: true,
|
|
153
|
+
* // isDirectory: false,
|
|
154
|
+
* // isSymlink: false,
|
|
155
|
+
* // },
|
|
156
|
+
* // ]
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @example Exclude files
|
|
160
|
+
*
|
|
161
|
+
* Setting the `exclude` option to `["foo.ts"]` will exclude the `foo.ts` file
|
|
162
|
+
* from the expansion.
|
|
163
|
+
*
|
|
164
|
+
* File structure:
|
|
165
|
+
* ```
|
|
166
|
+
* folder
|
|
167
|
+
* ├── script.ts
|
|
168
|
+
* └── foo.ts
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* ```ts ignore
|
|
172
|
+
* // script.ts
|
|
173
|
+
* import { expandGlob } from "@std/fs/expand-glob";
|
|
174
|
+
*
|
|
175
|
+
* await Array.fromAsync(expandGlob("*.ts", { exclude: ["foo.ts"] }));
|
|
176
|
+
* // [
|
|
177
|
+
* // {
|
|
178
|
+
* // path: "/Users/user/folder/script.ts",
|
|
179
|
+
* // name: "true.ts",
|
|
180
|
+
* // isFile: false,
|
|
181
|
+
* // isDirectory: false,
|
|
182
|
+
* // isSymlink: false,
|
|
183
|
+
* // },
|
|
184
|
+
* // ]
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* @example Exclude directories
|
|
188
|
+
*
|
|
189
|
+
* Setting the `includeDirs` option to `false` will exclude directories from the
|
|
190
|
+
* expansion.
|
|
191
|
+
*
|
|
192
|
+
* File structure:
|
|
193
|
+
* ```
|
|
194
|
+
* folder
|
|
195
|
+
* ├── subdir
|
|
196
|
+
* │ └── bar.ts
|
|
197
|
+
* ├── script.ts
|
|
198
|
+
* └── foo.ts
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* ```ts ignore
|
|
202
|
+
* // script.ts
|
|
203
|
+
* import { expandGlob } from "@std/fs/expand-glob";
|
|
204
|
+
*
|
|
205
|
+
* await Array.fromAsync(expandGlob("*", { includeDirs: false }));
|
|
206
|
+
* // [
|
|
207
|
+
* // {
|
|
208
|
+
* // path: "/Users/user/folder/script.ts",
|
|
209
|
+
* // name: "script.ts",
|
|
210
|
+
* // isFile: true,
|
|
211
|
+
* // isDirectory: false,
|
|
212
|
+
* // isSymlink: false,
|
|
213
|
+
* // },
|
|
214
|
+
* // {
|
|
215
|
+
* // path: "/Users/user/folder/foo.ts",
|
|
216
|
+
* // name: "foo.ts",
|
|
217
|
+
* // isFile: true,
|
|
218
|
+
* // isDirectory: false,
|
|
219
|
+
* // isSymlink: false,
|
|
220
|
+
* // },
|
|
221
|
+
* // ]
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* @example Follow symbolic links
|
|
225
|
+
*
|
|
226
|
+
* Setting the `followSymlinks` option to `true` will follow symbolic links.
|
|
227
|
+
*
|
|
228
|
+
* File structure:
|
|
229
|
+
* ```
|
|
230
|
+
* folder
|
|
231
|
+
* ├── script.ts
|
|
232
|
+
* └── link.ts -> script.ts (symbolic link)
|
|
233
|
+
* ```
|
|
234
|
+
*
|
|
235
|
+
* ```ts ignore
|
|
236
|
+
* // script.ts
|
|
237
|
+
* import { expandGlob } from "@std/fs/expand-glob";
|
|
238
|
+
*
|
|
239
|
+
* await Array.fromAsync(expandGlob("*.ts", { followSymlinks: true }));
|
|
240
|
+
* // [
|
|
241
|
+
* // {
|
|
242
|
+
* // path: "/Users/user/folder/script.ts",
|
|
243
|
+
* // name: "script.ts",
|
|
244
|
+
* // isFile: true,
|
|
245
|
+
* // isDirectory: false,
|
|
246
|
+
* // isSymlink: false,
|
|
247
|
+
* // },
|
|
248
|
+
* // {
|
|
249
|
+
* // path: "/Users/user/folder/symlink",
|
|
250
|
+
* // name: "symlink",
|
|
251
|
+
* // isFile: true,
|
|
252
|
+
* // isDirectory: false,
|
|
253
|
+
* // isSymlink: true,
|
|
254
|
+
* // },
|
|
255
|
+
* // ]
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
async function* expandGlob(glob, options) {
|
|
259
|
+
let { root, exclude = [], includeDirs = true, extended = true, globstar = true, caseInsensitive = false, followSymlinks = false, canonicalize = true, } = options ?? {};
|
|
260
|
+
const { segments, isAbsolute: isGlobAbsolute, hasTrailingSep, winRoot, } = split((0, _to_path_string_js_1.toPathString)(glob));
|
|
261
|
+
root ??= isGlobAbsolute ? winRoot ?? "/" : dntShim.Deno.cwd();
|
|
262
|
+
const globOptions = { extended, globstar, caseInsensitive };
|
|
263
|
+
const absRoot = isGlobAbsolute ? root : (0, resolve_js_1.resolve)(root); // root is always string here
|
|
264
|
+
const resolveFromRoot = (path) => (0, resolve_js_1.resolve)(absRoot, path);
|
|
265
|
+
const excludePatterns = exclude
|
|
266
|
+
.map(resolveFromRoot)
|
|
267
|
+
.map((s) => (0, glob_to_regexp_js_1.globToRegExp)(s, globOptions));
|
|
268
|
+
const shouldInclude = (path) => !excludePatterns.some((p) => p.test(path));
|
|
269
|
+
let fixedRoot = isGlobAbsolute ? winRoot ?? "/" : absRoot;
|
|
270
|
+
while (segments.length > 0 && !(0, is_glob_js_1.isGlob)(segments[0])) {
|
|
271
|
+
const seg = segments.shift();
|
|
272
|
+
fixedRoot = (0, join_globs_js_1.joinGlobs)([fixedRoot, unescapeGlobSegment(seg)], globOptions);
|
|
273
|
+
}
|
|
274
|
+
let fixedRootInfo;
|
|
275
|
+
try {
|
|
276
|
+
fixedRootInfo = await (0, _create_walk_entry_js_1.createWalkEntry)(fixedRoot);
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
return throwUnlessNotFound(error);
|
|
280
|
+
}
|
|
281
|
+
async function* advanceMatch(walkInfo, globSegment) {
|
|
282
|
+
if (!walkInfo.isDirectory) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
else if (globSegment === "..") {
|
|
286
|
+
const parentPath = (0, join_globs_js_1.joinGlobs)([walkInfo.path, ".."], globOptions);
|
|
287
|
+
if (shouldInclude(parentPath)) {
|
|
288
|
+
return yield await (0, _create_walk_entry_js_1.createWalkEntry)(parentPath);
|
|
289
|
+
}
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
else if (globSegment === "**") {
|
|
293
|
+
return yield* (0, walk_js_1.walk)(walkInfo.path, {
|
|
294
|
+
skip: excludePatterns,
|
|
295
|
+
maxDepth: globstar ? Infinity : 1,
|
|
296
|
+
followSymlinks,
|
|
297
|
+
canonicalize,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
const globPattern = (0, glob_to_regexp_js_1.globToRegExp)(globSegment, globOptions);
|
|
301
|
+
for await (const walkEntry of (0, walk_js_1.walk)(walkInfo.path, {
|
|
302
|
+
maxDepth: 1,
|
|
303
|
+
skip: excludePatterns,
|
|
304
|
+
followSymlinks,
|
|
305
|
+
})) {
|
|
306
|
+
if (walkEntry.path !== walkInfo.path &&
|
|
307
|
+
walkEntry.name.match(globPattern)) {
|
|
308
|
+
yield walkEntry;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
let currentMatches = [fixedRootInfo];
|
|
313
|
+
for (const segment of segments) {
|
|
314
|
+
// Advancing the list of current matches may introduce duplicates, so we
|
|
315
|
+
// pass everything through this Map.
|
|
316
|
+
const nextMatchMap = new Map();
|
|
317
|
+
await Promise.all(currentMatches.map(async (currentMatch) => {
|
|
318
|
+
for await (const nextMatch of advanceMatch(currentMatch, segment)) {
|
|
319
|
+
nextMatchMap.set(nextMatch.path, nextMatch);
|
|
320
|
+
}
|
|
321
|
+
}));
|
|
322
|
+
currentMatches = [...nextMatchMap.values()].sort(comparePath);
|
|
323
|
+
}
|
|
324
|
+
if (hasTrailingSep) {
|
|
325
|
+
currentMatches = currentMatches.filter((entry) => entry.isDirectory);
|
|
326
|
+
}
|
|
327
|
+
if (!includeDirs) {
|
|
328
|
+
currentMatches = currentMatches.filter((entry) => !entry.isDirectory);
|
|
329
|
+
}
|
|
330
|
+
yield* currentMatches;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Returns an iterator that yields each file path matching the given glob
|
|
334
|
+
* pattern. The file paths are relative to the provided `root` directory.
|
|
335
|
+
* If `root` is not provided, the current working directory is used.
|
|
336
|
+
* The `root` directory is not included in the yielded file paths.
|
|
337
|
+
*
|
|
338
|
+
* Requires the `--allow-read` flag.
|
|
339
|
+
*
|
|
340
|
+
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
|
|
341
|
+
* for more information on Deno's permissions system.
|
|
342
|
+
*
|
|
343
|
+
* @param glob The glob pattern to expand.
|
|
344
|
+
* @param options Additional options for the expansion.
|
|
345
|
+
*
|
|
346
|
+
* @returns An iterator that yields each walk entry matching the glob pattern.
|
|
347
|
+
*
|
|
348
|
+
* @example Usage
|
|
349
|
+
*
|
|
350
|
+
* File structure:
|
|
351
|
+
* ```
|
|
352
|
+
* folder
|
|
353
|
+
* ├── script.ts
|
|
354
|
+
* └── foo.ts
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* ```ts ignore
|
|
358
|
+
* // script.ts
|
|
359
|
+
* import { expandGlobSync } from "@std/fs/expand-glob";
|
|
360
|
+
*
|
|
361
|
+
* const entries = [];
|
|
362
|
+
* for (const entry of expandGlobSync("*.ts")) {
|
|
363
|
+
* entries.push(entry);
|
|
364
|
+
* }
|
|
365
|
+
*
|
|
366
|
+
* entries[0]!.path; // "/Users/user/folder/script.ts"
|
|
367
|
+
* entries[0]!.name; // "script.ts"
|
|
368
|
+
* entries[0]!.isFile; // false
|
|
369
|
+
* entries[0]!.isDirectory; // true
|
|
370
|
+
* entries[0]!.isSymlink; // false
|
|
371
|
+
*
|
|
372
|
+
* entries[1]!.path; // "/Users/user/folder/foo.ts"
|
|
373
|
+
* entries[1]!.name; // "foo.ts"
|
|
374
|
+
* entries[1]!.isFile; // true
|
|
375
|
+
* entries[1]!.isDirectory; // false
|
|
376
|
+
* entries[1]!.isSymlink; // false
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
function* expandGlobSync(glob, options) {
|
|
380
|
+
let { root, exclude = [], includeDirs = true, extended = true, globstar = true, caseInsensitive = false, followSymlinks = false, canonicalize = true, } = options ?? {};
|
|
381
|
+
const { segments, isAbsolute: isGlobAbsolute, hasTrailingSep, winRoot, } = split((0, _to_path_string_js_1.toPathString)(glob));
|
|
382
|
+
root ??= isGlobAbsolute ? winRoot ?? "/" : dntShim.Deno.cwd();
|
|
383
|
+
const globOptions = { extended, globstar, caseInsensitive };
|
|
384
|
+
const absRoot = isGlobAbsolute ? root : (0, resolve_js_1.resolve)(root); // root is always string here
|
|
385
|
+
const resolveFromRoot = (path) => (0, resolve_js_1.resolve)(absRoot, path);
|
|
386
|
+
const excludePatterns = exclude
|
|
387
|
+
.map(resolveFromRoot)
|
|
388
|
+
.map((s) => (0, glob_to_regexp_js_1.globToRegExp)(s, globOptions));
|
|
389
|
+
const shouldInclude = (path) => !excludePatterns.some((p) => p.test(path));
|
|
390
|
+
let fixedRoot = isGlobAbsolute ? winRoot ?? "/" : absRoot;
|
|
391
|
+
while (segments.length > 0 && !(0, is_glob_js_1.isGlob)(segments[0])) {
|
|
392
|
+
const seg = segments.shift();
|
|
393
|
+
fixedRoot = (0, join_globs_js_1.joinGlobs)([fixedRoot, unescapeGlobSegment(seg)], globOptions);
|
|
394
|
+
}
|
|
395
|
+
let fixedRootInfo;
|
|
396
|
+
try {
|
|
397
|
+
fixedRootInfo = (0, _create_walk_entry_js_1.createWalkEntrySync)(fixedRoot);
|
|
398
|
+
}
|
|
399
|
+
catch (error) {
|
|
400
|
+
return throwUnlessNotFound(error);
|
|
401
|
+
}
|
|
402
|
+
function* advanceMatch(walkInfo, globSegment) {
|
|
403
|
+
if (!walkInfo.isDirectory) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
else if (globSegment === "..") {
|
|
407
|
+
const parentPath = (0, join_globs_js_1.joinGlobs)([walkInfo.path, ".."], globOptions);
|
|
408
|
+
if (shouldInclude(parentPath)) {
|
|
409
|
+
return yield (0, _create_walk_entry_js_1.createWalkEntrySync)(parentPath);
|
|
410
|
+
}
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
else if (globSegment === "**") {
|
|
414
|
+
return yield* (0, walk_js_1.walkSync)(walkInfo.path, {
|
|
415
|
+
skip: excludePatterns,
|
|
416
|
+
maxDepth: globstar ? Infinity : 1,
|
|
417
|
+
followSymlinks,
|
|
418
|
+
canonicalize,
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
const globPattern = (0, glob_to_regexp_js_1.globToRegExp)(globSegment, globOptions);
|
|
422
|
+
for (const walkEntry of (0, walk_js_1.walkSync)(walkInfo.path, {
|
|
423
|
+
maxDepth: 1,
|
|
424
|
+
skip: excludePatterns,
|
|
425
|
+
followSymlinks,
|
|
426
|
+
})) {
|
|
427
|
+
if (walkEntry.path !== walkInfo.path &&
|
|
428
|
+
walkEntry.name.match(globPattern)) {
|
|
429
|
+
yield walkEntry;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
let currentMatches = [fixedRootInfo];
|
|
434
|
+
for (const segment of segments) {
|
|
435
|
+
// Advancing the list of current matches may introduce duplicates, so we
|
|
436
|
+
// pass everything through this Map.
|
|
437
|
+
const nextMatchMap = new Map();
|
|
438
|
+
for (const currentMatch of currentMatches) {
|
|
439
|
+
for (const nextMatch of advanceMatch(currentMatch, segment)) {
|
|
440
|
+
nextMatchMap.set(nextMatch.path, nextMatch);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
currentMatches = [...nextMatchMap.values()].sort(comparePath);
|
|
444
|
+
}
|
|
445
|
+
if (hasTrailingSep) {
|
|
446
|
+
currentMatches = currentMatches.filter((entry) => entry.isDirectory);
|
|
447
|
+
}
|
|
448
|
+
if (!includeDirs) {
|
|
449
|
+
currentMatches = currentMatches.filter((entry) => !entry.isDirectory);
|
|
450
|
+
}
|
|
451
|
+
yield* currentMatches;
|
|
452
|
+
}
|
|
453
|
+
const globEscapeChar =
|
|
454
|
+
// deno-lint-ignore no-explicit-any
|
|
455
|
+
dntShim.dntGlobalThis.Deno?.build.os === "windows" ? "`" : `\\`;
|
|
456
|
+
const globMetachars = "*?{}[]()|+@!";
|
|
457
|
+
function unescapeGlobSegment(segment) {
|
|
458
|
+
let result = "";
|
|
459
|
+
let lastIndex = 0;
|
|
460
|
+
for (let i = 0; i < segment.length; i++) {
|
|
461
|
+
const char = segment[i];
|
|
462
|
+
if (char === globEscapeChar) {
|
|
463
|
+
const nextChar = segment[i + 1];
|
|
464
|
+
if (nextChar && globMetachars.includes(nextChar)) {
|
|
465
|
+
// append the slice before the escape char, then the metachar
|
|
466
|
+
result += segment.slice(lastIndex, i) + nextChar;
|
|
467
|
+
i++; // skip next char since we already processed it
|
|
468
|
+
lastIndex = i + 1;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
// no escaped, return the original segment
|
|
473
|
+
if (lastIndex === 0) {
|
|
474
|
+
return segment;
|
|
475
|
+
}
|
|
476
|
+
// append any remaining characters
|
|
477
|
+
result += segment.slice(lastIndex);
|
|
478
|
+
return result;
|
|
479
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for working with the filesystem.
|
|
3
|
+
*
|
|
4
|
+
* ```ts ignore
|
|
5
|
+
* import { ensureFile, copy, ensureDir, move } from "@std/fs";
|
|
6
|
+
*
|
|
7
|
+
* await ensureFile("example.txt");
|
|
8
|
+
*
|
|
9
|
+
* await copy("example.txt", "example_copy.txt");
|
|
10
|
+
*
|
|
11
|
+
* await ensureDir("subdir");
|
|
12
|
+
*
|
|
13
|
+
* await move("example_copy.txt", "subdir/example_copy.txt");
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
export * from "./empty_dir.js";
|
|
19
|
+
export * from "./ensure_dir.js";
|
|
20
|
+
export * from "./ensure_file.js";
|
|
21
|
+
export * from "./ensure_link.js";
|
|
22
|
+
export * from "./ensure_symlink.js";
|
|
23
|
+
export * from "./exists.js";
|
|
24
|
+
export * from "./expand_glob.js";
|
|
25
|
+
export * from "./move.js";
|
|
26
|
+
export * from "./copy.js";
|
|
27
|
+
export * from "./walk.js";
|
|
28
|
+
export * from "./eol.js";
|
|
29
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.23/mod.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
/**
|
|
19
|
+
* Helpers for working with the filesystem.
|
|
20
|
+
*
|
|
21
|
+
* ```ts ignore
|
|
22
|
+
* import { ensureFile, copy, ensureDir, move } from "@std/fs";
|
|
23
|
+
*
|
|
24
|
+
* await ensureFile("example.txt");
|
|
25
|
+
*
|
|
26
|
+
* await copy("example.txt", "example_copy.txt");
|
|
27
|
+
*
|
|
28
|
+
* await ensureDir("subdir");
|
|
29
|
+
*
|
|
30
|
+
* await move("example_copy.txt", "subdir/example_copy.txt");
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @module
|
|
34
|
+
*/
|
|
35
|
+
__exportStar(require("./empty_dir.js"), exports);
|
|
36
|
+
__exportStar(require("./ensure_dir.js"), exports);
|
|
37
|
+
__exportStar(require("./ensure_file.js"), exports);
|
|
38
|
+
__exportStar(require("./ensure_link.js"), exports);
|
|
39
|
+
__exportStar(require("./ensure_symlink.js"), exports);
|
|
40
|
+
__exportStar(require("./exists.js"), exports);
|
|
41
|
+
__exportStar(require("./expand_glob.js"), exports);
|
|
42
|
+
__exportStar(require("./move.js"), exports);
|
|
43
|
+
__exportStar(require("./copy.js"), exports);
|
|
44
|
+
__exportStar(require("./walk.js"), exports);
|
|
45
|
+
__exportStar(require("./eol.js"), exports);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Options for {@linkcode move} and {@linkcode moveSync}. */
|
|
2
|
+
export interface MoveOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the destination file should be overwritten if it already exists.
|
|
5
|
+
*
|
|
6
|
+
* @default {false}
|
|
7
|
+
*/
|
|
8
|
+
overwrite?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Asynchronously moves a file or directory (along with its contents).
|
|
12
|
+
*
|
|
13
|
+
* Requires `--allow-read` and `--allow-write` permissions.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
|
|
16
|
+
* for more information on Deno's permissions system.
|
|
17
|
+
*
|
|
18
|
+
* @param src The source file or directory as a string or URL.
|
|
19
|
+
* @param dest The destination file or directory as a string or URL.
|
|
20
|
+
* @param options Options for the move operation.
|
|
21
|
+
* @throws {Deno.errors.AlreadyExists} If `dest` already exists and
|
|
22
|
+
* `options.overwrite` is `false`.
|
|
23
|
+
* @throws {Deno.errors.NotSupported} If `src` is a sub-directory of `dest`.
|
|
24
|
+
*
|
|
25
|
+
* @returns A void promise that resolves once the operation completes.
|
|
26
|
+
*
|
|
27
|
+
* @example Basic usage
|
|
28
|
+
* ```ts ignore
|
|
29
|
+
* import { move } from "@std/fs/move";
|
|
30
|
+
*
|
|
31
|
+
* await move("./foo", "./bar");
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* This will move the file or directory at `./foo` to `./bar` without
|
|
35
|
+
* overwriting.
|
|
36
|
+
*
|
|
37
|
+
* @example Overwriting
|
|
38
|
+
* ```ts ignore
|
|
39
|
+
* import { move } from "@std/fs/move";
|
|
40
|
+
*
|
|
41
|
+
* await move("./foo", "./bar", { overwrite: true });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* This will move the file or directory at `./foo` to `./bar`, overwriting
|
|
45
|
+
* `./bar` if it already exists.
|
|
46
|
+
*/
|
|
47
|
+
export declare function move(src: string | URL, dest: string | URL, options?: MoveOptions): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Synchronously moves a file or directory (along with its contents).
|
|
50
|
+
*
|
|
51
|
+
* Requires `--allow-read` and `--allow-write` permissions.
|
|
52
|
+
*
|
|
53
|
+
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
|
|
54
|
+
* for more information on Deno's permissions system.
|
|
55
|
+
*
|
|
56
|
+
* @param src The source file or directory as a string or URL.
|
|
57
|
+
* @param dest The destination file or directory as a string or URL.
|
|
58
|
+
* @param options Options for the move operation.
|
|
59
|
+
* @throws {Deno.errors.AlreadyExists} If `dest` already exists and
|
|
60
|
+
* `options.overwrite` is `false`.
|
|
61
|
+
* @throws {Deno.errors.NotSupported} If `src` is a sub-directory of `dest`.
|
|
62
|
+
*
|
|
63
|
+
* @returns A void value that returns once the operation completes.
|
|
64
|
+
*
|
|
65
|
+
* @example Basic usage
|
|
66
|
+
* ```ts ignore
|
|
67
|
+
* import { moveSync } from "@std/fs/move";
|
|
68
|
+
*
|
|
69
|
+
* moveSync("./foo", "./bar");
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* This will move the file or directory at `./foo` to `./bar` without
|
|
73
|
+
* overwriting.
|
|
74
|
+
*
|
|
75
|
+
* @example Overwriting
|
|
76
|
+
* ```ts ignore
|
|
77
|
+
* import { moveSync } from "@std/fs/move";
|
|
78
|
+
*
|
|
79
|
+
* moveSync("./foo", "./bar", { overwrite: true });
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* This will move the file or directory at `./foo` to `./bar`, overwriting
|
|
83
|
+
* `./bar` if it already exists.
|
|
84
|
+
*/
|
|
85
|
+
export declare function moveSync(src: string | URL, dest: string | URL, options?: MoveOptions): void;
|
|
86
|
+
//# sourceMappingURL=move.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.23/move.ts"],"names":[],"mappings":"AAMA,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC,CAkCf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,CAAC,EAAE,WAAW,GACpB,IAAI,CAoCN"}
|