@bolt-foundry/gambit 0.8.1 → 0.8.5-rc.4
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 +110 -2
- package/README.md +108 -23
- package/esm/_dnt.polyfills.d.ts +17 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +122 -0
- package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts +322 -0
- package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/collections/1.1.5/deep_merge.js +105 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts +14 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.js +34 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts +13 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.js +18 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts +10 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_is_same_path.js +17 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts +12 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_is_subdir.js +25 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts +9 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/_to_path_string.js +13 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/copy.d.ts +117 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/copy.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/copy.js +313 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts +48 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/empty_dir.js +87 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts +49 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_dir.js +102 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts +47 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_file.js +90 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts +49 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_link.js +61 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts +70 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.js +156 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/eol.d.ts +52 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/eol.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/eol.js +67 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/exists.d.ts +218 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/exists.js +271 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts +267 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/expand_glob.js +442 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/mod.d.ts +29 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/mod.js +29 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/move.d.ts +86 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/move.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/move.js +142 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/walk.d.ts +777 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/walk.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fs/1.0.22/walk.js +846 -0
- package/esm/deps/jsr.io/@std/json/1.0.2/types.d.ts +5 -0
- package/esm/deps/jsr.io/@std/json/1.0.2/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/json/1.0.2/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/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 +12085 -5691
- 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 +732 -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 +829 -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 +3764 -647
- 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 +135 -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 +164 -0
- package/esm/src/workspace_contract.d.ts +76 -0
- package/esm/src/workspace_contract.d.ts.map +1 -0
- package/esm/src/workspace_contract.js +74 -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 +122 -0
- package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts +322 -0
- package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/collections/1.1.5/deep_merge.js +108 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts +14 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_create_walk_entry.js +71 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts +13 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_get_file_info_type.js +21 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts +10 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_is_same_path.js +20 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts +12 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_is_subdir.js +28 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts +9 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/_to_path_string.js +16 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/copy.d.ts +117 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/copy.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/copy.js +350 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts +48 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/empty_dir.js +124 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts +49 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_dir.js +139 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts +47 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_file.js +127 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts +49 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_link.js +98 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts +70 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/ensure_symlink.js +193 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/eol.d.ts +52 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/eol.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/eol.js +105 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/exists.d.ts +218 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/exists.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/exists.js +308 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts +267 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/expand_glob.js +479 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/mod.d.ts +29 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/mod.js +45 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/move.d.ts +86 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/move.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/move.js +179 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/walk.d.ts +777 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/walk.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fs/1.0.22/walk.js +883 -0
- package/script/deps/jsr.io/@std/json/1.0.2/types.d.ts +5 -0
- package/script/deps/jsr.io/@std/json/1.0.2/types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/json/1.0.2/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/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 +12085 -5691
- 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 +774 -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 +869 -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 +3768 -651
- 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 +172 -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 +201 -0
- package/script/src/workspace_contract.d.ts +76 -0
- package/script/src/workspace_contract.d.ts.map +1 -0
- package/script/src/workspace_contract.js +82 -0
|
@@ -0,0 +1,193 @@
|
|
|
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.ensureSymlink = ensureSymlink;
|
|
37
|
+
exports.ensureSymlinkSync = ensureSymlinkSync;
|
|
38
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
39
|
+
const dntShim = __importStar(require("../../../../../_dnt.shims.js"));
|
|
40
|
+
const dirname_js_1 = require("../../path/1.1.4/dirname.js");
|
|
41
|
+
const resolve_js_1 = require("../../path/1.1.4/resolve.js");
|
|
42
|
+
const ensure_dir_js_1 = require("./ensure_dir.js");
|
|
43
|
+
const _get_file_info_type_js_1 = require("./_get_file_info_type.js");
|
|
44
|
+
const _to_path_string_js_1 = require("./_to_path_string.js");
|
|
45
|
+
const os_js_1 = require("../../internal/1.0.12/os.js");
|
|
46
|
+
function resolveSymlinkTarget(target, linkName) {
|
|
47
|
+
if (typeof target !== "string")
|
|
48
|
+
return target; // URL is always absolute path
|
|
49
|
+
if (typeof linkName === "string") {
|
|
50
|
+
return (0, resolve_js_1.resolve)((0, dirname_js_1.dirname)(linkName), target);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return new URL(target, linkName);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function getSymlinkOption(type) {
|
|
57
|
+
return os_js_1.isWindows ? { type: type === "dir" ? "dir" : "file" } : undefined;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Asynchronously ensures that the link exists, and points to a valid file.
|
|
61
|
+
*
|
|
62
|
+
* If the parent directories for the link do not exist, they are created. If the
|
|
63
|
+
* link already exists, and it is not modified, this function does nothing. If
|
|
64
|
+
* the link already exists, and it does not point to the given target, an error
|
|
65
|
+
* is thrown.
|
|
66
|
+
*
|
|
67
|
+
* Requires `--allow-read` and `--allow-write` permissions.
|
|
68
|
+
*
|
|
69
|
+
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
|
|
70
|
+
* for more information on Deno's permissions system.
|
|
71
|
+
*
|
|
72
|
+
* @param target The source file path as a string or URL. If it is a relative path string, it have to be relative to the link path.
|
|
73
|
+
* @param linkName The destination link path as a string or URL.
|
|
74
|
+
*
|
|
75
|
+
* @returns A void promise that resolves once the link exists.
|
|
76
|
+
*
|
|
77
|
+
* @example Basic usage
|
|
78
|
+
* ```ts ignore
|
|
79
|
+
* import { ensureSymlink } from "@std/fs/ensure-symlink";
|
|
80
|
+
*
|
|
81
|
+
* // Ensures the link `./targetFile.link.dat` exists and points to `./targetFile.dat`
|
|
82
|
+
* await ensureSymlink("./targetFile.dat", "./targetFile.link.dat");
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example Ensuring a link in a folder
|
|
86
|
+
* ```ts ignore
|
|
87
|
+
* import { ensureSymlink } from "@std/fs/ensure-symlink";
|
|
88
|
+
*
|
|
89
|
+
* // Ensures the link `./folder/targetFile.link.dat` exists and points to `./folder/targetFile.dat`
|
|
90
|
+
* await ensureSymlink("./targetFile.dat", "./folder/targetFile.link.dat");
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
async function ensureSymlink(target, linkName) {
|
|
94
|
+
const targetRealPath = resolveSymlinkTarget(target, linkName);
|
|
95
|
+
let srcStatInfo;
|
|
96
|
+
try {
|
|
97
|
+
srcStatInfo = await dntShim.Deno.lstat(targetRealPath);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
if (error instanceof dntShim.Deno.errors.NotFound) {
|
|
101
|
+
throw new dntShim.Deno.errors.NotFound(`Cannot ensure symlink as the target path does not exist: ${targetRealPath}`);
|
|
102
|
+
}
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
const srcFilePathType = (0, _get_file_info_type_js_1.getFileInfoType)(srcStatInfo);
|
|
106
|
+
await (0, ensure_dir_js_1.ensureDir)((0, dirname_js_1.dirname)((0, _to_path_string_js_1.toPathString)(linkName)));
|
|
107
|
+
const options = getSymlinkOption(srcFilePathType);
|
|
108
|
+
try {
|
|
109
|
+
await dntShim.Deno.symlink(target, linkName, options);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if (!(error instanceof dntShim.Deno.errors.AlreadyExists)) {
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
const linkStatInfo = await dntShim.Deno.lstat(linkName);
|
|
116
|
+
if (!linkStatInfo.isSymlink) {
|
|
117
|
+
const type = (0, _get_file_info_type_js_1.getFileInfoType)(linkStatInfo);
|
|
118
|
+
throw new dntShim.Deno.errors.AlreadyExists(`A '${type}' already exists at the path: ${linkName}`);
|
|
119
|
+
}
|
|
120
|
+
const linkPath = await dntShim.Deno.readLink(linkName);
|
|
121
|
+
const linkRealPath = (0, resolve_js_1.resolve)(linkPath);
|
|
122
|
+
if (linkRealPath !== targetRealPath) {
|
|
123
|
+
throw new dntShim.Deno.errors.AlreadyExists(`A symlink targeting to an undesired path already exists: ${linkName} -> ${linkRealPath}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Synchronously ensures that the link exists, and points to a valid file.
|
|
129
|
+
*
|
|
130
|
+
* If the parent directories for the link do not exist, they are created. If the
|
|
131
|
+
* link already exists, and it is not modified, this function does nothing. If
|
|
132
|
+
* the link already exists, and it does not point to the given target, an error
|
|
133
|
+
* is thrown.
|
|
134
|
+
*
|
|
135
|
+
* Requires `--allow-read` and `--allow-write` permissions.
|
|
136
|
+
*
|
|
137
|
+
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
|
|
138
|
+
* for more information on Deno's permissions system.
|
|
139
|
+
*
|
|
140
|
+
* @param target The source file path as a string or URL. If it is a relative path string, it have to be relative to the link path.
|
|
141
|
+
* @param linkName The destination link path as a string or URL.
|
|
142
|
+
* @returns A void value that returns once the link exists.
|
|
143
|
+
*
|
|
144
|
+
* @example Basic usage
|
|
145
|
+
* ```ts ignore
|
|
146
|
+
* import { ensureSymlinkSync } from "@std/fs/ensure-symlink";
|
|
147
|
+
*
|
|
148
|
+
* // Ensures the link `./targetFile.link.dat` exists and points to `./targetFile.dat`
|
|
149
|
+
* ensureSymlinkSync("./targetFile.dat", "./targetFile.link.dat");
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @example Ensuring a link in a folder
|
|
153
|
+
* ```ts ignore
|
|
154
|
+
* import { ensureSymlinkSync } from "@std/fs/ensure-symlink";
|
|
155
|
+
*
|
|
156
|
+
* // Ensures the link `./folder/targetFile.link.dat` exists and points to `./folder/targetFile.dat`
|
|
157
|
+
* ensureSymlinkSync("./targetFile.dat", "./folder/targetFile.link.dat");
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
function ensureSymlinkSync(target, linkName) {
|
|
161
|
+
const targetRealPath = resolveSymlinkTarget(target, linkName);
|
|
162
|
+
let srcStatInfo;
|
|
163
|
+
try {
|
|
164
|
+
srcStatInfo = dntShim.Deno.lstatSync(targetRealPath);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
if (error instanceof dntShim.Deno.errors.NotFound) {
|
|
168
|
+
throw new dntShim.Deno.errors.NotFound(`Cannot ensure symlink as the target path does not exist: ${targetRealPath}`);
|
|
169
|
+
}
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
const srcFilePathType = (0, _get_file_info_type_js_1.getFileInfoType)(srcStatInfo);
|
|
173
|
+
(0, ensure_dir_js_1.ensureDirSync)((0, dirname_js_1.dirname)((0, _to_path_string_js_1.toPathString)(linkName)));
|
|
174
|
+
const options = getSymlinkOption(srcFilePathType);
|
|
175
|
+
try {
|
|
176
|
+
dntShim.Deno.symlinkSync(target, linkName, options);
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
if (!(error instanceof dntShim.Deno.errors.AlreadyExists)) {
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
const linkStatInfo = dntShim.Deno.lstatSync(linkName);
|
|
183
|
+
if (!linkStatInfo.isSymlink) {
|
|
184
|
+
const type = (0, _get_file_info_type_js_1.getFileInfoType)(linkStatInfo);
|
|
185
|
+
throw new dntShim.Deno.errors.AlreadyExists(`A '${type}' already exists at the path: ${linkName}`);
|
|
186
|
+
}
|
|
187
|
+
const linkPath = dntShim.Deno.readLinkSync(linkName);
|
|
188
|
+
const linkRealPath = (0, resolve_js_1.resolve)(linkPath);
|
|
189
|
+
if (linkRealPath !== targetRealPath) {
|
|
190
|
+
throw new dntShim.Deno.errors.AlreadyExists(`A symlink targeting to an undesired path already exists: ${linkName} -> ${linkRealPath}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export declare const LF: "\n";
|
|
2
|
+
/** End-of-line character for Windows platforms. */
|
|
3
|
+
export declare const CRLF: "\r\n";
|
|
4
|
+
/**
|
|
5
|
+
* End-of-line character evaluated for the current platform.
|
|
6
|
+
*
|
|
7
|
+
* @example Usage
|
|
8
|
+
* ```ts ignore
|
|
9
|
+
* import { EOL } from "@std/fs/eol";
|
|
10
|
+
*
|
|
11
|
+
* EOL; // "\n" on POSIX platforms and "\r\n" on Windows
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const EOL: "\n" | "\r\n";
|
|
15
|
+
/**
|
|
16
|
+
* Returns the detected EOL character(s) detected in the input string. If no EOL
|
|
17
|
+
* character is detected, `null` is returned.
|
|
18
|
+
*
|
|
19
|
+
* @param content The input string to detect EOL characters.
|
|
20
|
+
*
|
|
21
|
+
* @returns The detected EOL character(s) or `null` if no EOL character is detected.
|
|
22
|
+
*
|
|
23
|
+
* @example Usage
|
|
24
|
+
* ```ts ignore
|
|
25
|
+
* import { detect } from "@std/fs/eol";
|
|
26
|
+
*
|
|
27
|
+
* detect("deno\r\nis not\r\nnode"); // "\r\n"
|
|
28
|
+
* detect("deno\nis not\r\nnode"); // "\r\n"
|
|
29
|
+
* detect("deno\nis not\nnode"); // "\n"
|
|
30
|
+
* detect("deno is not node"); // null
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function detect(content: string): typeof EOL | null;
|
|
34
|
+
/**
|
|
35
|
+
* Normalize the input string to the targeted EOL.
|
|
36
|
+
*
|
|
37
|
+
* @param content The input string to normalize.
|
|
38
|
+
* @param eol The EOL character(s) to normalize the input string to.
|
|
39
|
+
*
|
|
40
|
+
* @returns The input string normalized to the targeted EOL.
|
|
41
|
+
*
|
|
42
|
+
* @example Usage
|
|
43
|
+
* ```ts ignore
|
|
44
|
+
* import { LF, format } from "@std/fs/eol";
|
|
45
|
+
*
|
|
46
|
+
* const CRLFinput = "deno\r\nis not\r\nnode";
|
|
47
|
+
*
|
|
48
|
+
* format(CRLFinput, LF); // "deno\nis not\nnode"
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function format(content: string, eol: typeof EOL): string;
|
|
52
|
+
//# sourceMappingURL=eol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eol.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.22/eol.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,EAAG,IAAa,CAAC;AAEhC,mDAAmD;AACnD,eAAO,MAAM,IAAI,EAAG,MAAe,CAAC;AAEpC;;;;;;;;;GASG;AACH,eAAO,MAAM,GAAG,EAAE,IAAI,GAAG,MAEgD,CAAC;AAI1E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,GAAG,IAAI,CAQzD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,GAAG,MAAM,CAE/D"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
3
|
+
// This module is browser compatible.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.EOL = exports.CRLF = exports.LF = void 0;
|
|
39
|
+
exports.detect = detect;
|
|
40
|
+
exports.format = format;
|
|
41
|
+
/** End-of-line character for POSIX platforms such as macOS and Linux. */
|
|
42
|
+
const dntShim = __importStar(require("../../../../../_dnt.shims.js"));
|
|
43
|
+
exports.LF = "\n";
|
|
44
|
+
/** End-of-line character for Windows platforms. */
|
|
45
|
+
exports.CRLF = "\r\n";
|
|
46
|
+
/**
|
|
47
|
+
* End-of-line character evaluated for the current platform.
|
|
48
|
+
*
|
|
49
|
+
* @example Usage
|
|
50
|
+
* ```ts ignore
|
|
51
|
+
* import { EOL } from "@std/fs/eol";
|
|
52
|
+
*
|
|
53
|
+
* EOL; // "\n" on POSIX platforms and "\r\n" on Windows
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
exports.EOL =
|
|
57
|
+
// deno-lint-ignore no-explicit-any
|
|
58
|
+
dntShim.dntGlobalThis.Deno?.build.os === "windows" ? exports.CRLF : exports.LF;
|
|
59
|
+
const regDetect = /(?:\r?\n)/g;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the detected EOL character(s) detected in the input string. If no EOL
|
|
62
|
+
* character is detected, `null` is returned.
|
|
63
|
+
*
|
|
64
|
+
* @param content The input string to detect EOL characters.
|
|
65
|
+
*
|
|
66
|
+
* @returns The detected EOL character(s) or `null` if no EOL character is detected.
|
|
67
|
+
*
|
|
68
|
+
* @example Usage
|
|
69
|
+
* ```ts ignore
|
|
70
|
+
* import { detect } from "@std/fs/eol";
|
|
71
|
+
*
|
|
72
|
+
* detect("deno\r\nis not\r\nnode"); // "\r\n"
|
|
73
|
+
* detect("deno\nis not\r\nnode"); // "\r\n"
|
|
74
|
+
* detect("deno\nis not\nnode"); // "\n"
|
|
75
|
+
* detect("deno is not node"); // null
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
function detect(content) {
|
|
79
|
+
const d = content.match(regDetect);
|
|
80
|
+
if (!d || d.length === 0) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const hasCRLF = d.some((x) => x === exports.CRLF);
|
|
84
|
+
return hasCRLF ? exports.CRLF : exports.LF;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Normalize the input string to the targeted EOL.
|
|
88
|
+
*
|
|
89
|
+
* @param content The input string to normalize.
|
|
90
|
+
* @param eol The EOL character(s) to normalize the input string to.
|
|
91
|
+
*
|
|
92
|
+
* @returns The input string normalized to the targeted EOL.
|
|
93
|
+
*
|
|
94
|
+
* @example Usage
|
|
95
|
+
* ```ts ignore
|
|
96
|
+
* import { LF, format } from "@std/fs/eol";
|
|
97
|
+
*
|
|
98
|
+
* const CRLFinput = "deno\r\nis not\r\nnode";
|
|
99
|
+
*
|
|
100
|
+
* format(CRLFinput, LF); // "deno\nis not\nnode"
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
function format(content, eol) {
|
|
104
|
+
return content.replace(regDetect, eol);
|
|
105
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
export interface ExistsOptions {
|
|
2
|
+
/**
|
|
3
|
+
* When `true`, will check if the path is readable by the user as well.
|
|
4
|
+
*
|
|
5
|
+
* @default {false}
|
|
6
|
+
*/
|
|
7
|
+
isReadable?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* When `true`, will check if the path is a directory as well. Directory
|
|
10
|
+
* symlinks are included.
|
|
11
|
+
*
|
|
12
|
+
* @default {false}
|
|
13
|
+
*/
|
|
14
|
+
isDirectory?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* When `true`, will check if the path is a file as well. File symlinks are
|
|
17
|
+
* included.
|
|
18
|
+
*
|
|
19
|
+
* @default {false}
|
|
20
|
+
*/
|
|
21
|
+
isFile?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Asynchronously test whether or not the given path exists by checking with
|
|
25
|
+
* the file system.
|
|
26
|
+
*
|
|
27
|
+
* Note: Do not use this function if performing a check before another operation
|
|
28
|
+
* on that file. Doing so creates a race condition. Instead, perform the actual
|
|
29
|
+
* file operation directly. This function is not recommended for this use case.
|
|
30
|
+
* See the recommended method below.
|
|
31
|
+
*
|
|
32
|
+
* @see {@link https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use} for
|
|
33
|
+
* more information on the time-of-check to time-of-use bug.
|
|
34
|
+
*
|
|
35
|
+
* Requires `--allow-read` permissions, and in some cases, `--allow-sys`
|
|
36
|
+
* permissions if `options.isReadable` is `true`.
|
|
37
|
+
*
|
|
38
|
+
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
|
|
39
|
+
* for more information on Deno's permissions system.
|
|
40
|
+
*
|
|
41
|
+
* @param path The path to the file or directory, as a string or URL.
|
|
42
|
+
* @param options Additional options for the check.
|
|
43
|
+
*
|
|
44
|
+
* @returns A promise that resolves with `true` if the path exists, `false`
|
|
45
|
+
* otherwise.
|
|
46
|
+
*
|
|
47
|
+
* @example Recommended method
|
|
48
|
+
* ```ts ignore
|
|
49
|
+
* // Notice no use of exists
|
|
50
|
+
* try {
|
|
51
|
+
* await Deno.remove("./foo", { recursive: true });
|
|
52
|
+
* } catch (error) {
|
|
53
|
+
* if (!(error instanceof Deno.errors.NotFound)) {
|
|
54
|
+
* throw error;
|
|
55
|
+
* }
|
|
56
|
+
* // Do nothing...
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Notice that `exists()` is not used in the above example. Doing so avoids a
|
|
61
|
+
* possible race condition. See the above note for details.
|
|
62
|
+
*
|
|
63
|
+
* @example Basic usage
|
|
64
|
+
* ```ts ignore
|
|
65
|
+
* import { exists } from "@std/fs/exists";
|
|
66
|
+
*
|
|
67
|
+
* await exists("./exists"); // true
|
|
68
|
+
* await exists("./does_not_exist"); // false
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @example Check if a path is readable
|
|
72
|
+
*
|
|
73
|
+
* Requires `--allow-sys` permissions in some cases.
|
|
74
|
+
*
|
|
75
|
+
* ```ts ignore
|
|
76
|
+
* import { exists } from "@std/fs/exists";
|
|
77
|
+
*
|
|
78
|
+
* await exists("./readable", { isReadable: true }); // true
|
|
79
|
+
* await exists("./not_readable", { isReadable: true }); // false
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example Check if a path is a directory
|
|
83
|
+
* ```ts ignore
|
|
84
|
+
* import { exists } from "@std/fs/exists";
|
|
85
|
+
*
|
|
86
|
+
* await exists("./directory", { isDirectory: true }); // true
|
|
87
|
+
* await exists("./file", { isDirectory: true }); // false
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @example Check if a path is a file
|
|
91
|
+
* ```ts ignore
|
|
92
|
+
* import { exists } from "@std/fs/exists";
|
|
93
|
+
*
|
|
94
|
+
* await exists("./file", { isFile: true }); // true
|
|
95
|
+
* await exists("./directory", { isFile: true }); // false
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @example Check if a path is a readable directory
|
|
99
|
+
*
|
|
100
|
+
* Requires `--allow-sys` permissions in some cases.
|
|
101
|
+
*
|
|
102
|
+
* ```ts ignore
|
|
103
|
+
* import { exists } from "@std/fs/exists";
|
|
104
|
+
*
|
|
105
|
+
* await exists("./readable_directory", { isReadable: true, isDirectory: true }); // true
|
|
106
|
+
* await exists("./not_readable_directory", { isReadable: true, isDirectory: true }); // false
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @example Check if a path is a readable file
|
|
110
|
+
*
|
|
111
|
+
* Requires `--allow-sys` permissions in some cases.
|
|
112
|
+
*
|
|
113
|
+
* ```ts ignore
|
|
114
|
+
* import { exists } from "@std/fs/exists";
|
|
115
|
+
*
|
|
116
|
+
* await exists("./readable_file", { isReadable: true, isFile: true }); // true
|
|
117
|
+
* await exists("./not_readable_file", { isReadable: true, isFile: true }); // false
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare function exists(path: string | URL, options?: ExistsOptions): Promise<boolean>;
|
|
121
|
+
/**
|
|
122
|
+
* Synchronously test whether or not the given path exists by checking with
|
|
123
|
+
* the file system.
|
|
124
|
+
*
|
|
125
|
+
* Note: Do not use this function if performing a check before another operation
|
|
126
|
+
* on that file. Doing so creates a race condition. Instead, perform the actual
|
|
127
|
+
* file operation directly. This function is not recommended for this use case.
|
|
128
|
+
* See the recommended method below.
|
|
129
|
+
*
|
|
130
|
+
* @see {@link https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use} for
|
|
131
|
+
* more information on the time-of-check to time-of-use bug.
|
|
132
|
+
*
|
|
133
|
+
* Requires `--allow-read` permissions, and in some cases, `--allow-sys`
|
|
134
|
+
* permissions if `options.isReadable` is `true`.
|
|
135
|
+
*
|
|
136
|
+
* @see {@link https://docs.deno.com/runtime/manual/basics/permissions#file-system-access}
|
|
137
|
+
* for more information on Deno's permissions system.
|
|
138
|
+
*
|
|
139
|
+
* @param path The path to the file or directory, as a string or URL.
|
|
140
|
+
* @param options Additional options for the check.
|
|
141
|
+
*
|
|
142
|
+
* @returns `true` if the path exists, `false` otherwise.
|
|
143
|
+
*
|
|
144
|
+
* @example Recommended method
|
|
145
|
+
* ```ts ignore
|
|
146
|
+
* // Notice no use of exists
|
|
147
|
+
* try {
|
|
148
|
+
* Deno.removeSync("./foo", { recursive: true });
|
|
149
|
+
* } catch (error) {
|
|
150
|
+
* if (!(error instanceof Deno.errors.NotFound)) {
|
|
151
|
+
* throw error;
|
|
152
|
+
* }
|
|
153
|
+
* // Do nothing...
|
|
154
|
+
* }
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* Notice that `existsSync()` is not used in the above example. Doing so avoids
|
|
158
|
+
* a possible race condition. See the above note for details.
|
|
159
|
+
*
|
|
160
|
+
* @example Basic usage
|
|
161
|
+
* ```ts ignore
|
|
162
|
+
* import { existsSync } from "@std/fs/exists";
|
|
163
|
+
*
|
|
164
|
+
* existsSync("./exists"); // true
|
|
165
|
+
* existsSync("./does_not_exist"); // false
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @example Check if a path is readable
|
|
169
|
+
*
|
|
170
|
+
* Requires `--allow-sys` permissions in some cases.
|
|
171
|
+
*
|
|
172
|
+
* ```ts ignore
|
|
173
|
+
* import { existsSync } from "@std/fs/exists";
|
|
174
|
+
*
|
|
175
|
+
* existsSync("./readable", { isReadable: true }); // true
|
|
176
|
+
* existsSync("./not_readable", { isReadable: true }); // false
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @example Check if a path is a directory
|
|
180
|
+
* ```ts ignore
|
|
181
|
+
* import { existsSync } from "@std/fs/exists";
|
|
182
|
+
*
|
|
183
|
+
* existsSync("./directory", { isDirectory: true }); // true
|
|
184
|
+
* existsSync("./file", { isDirectory: true }); // false
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* @example Check if a path is a file
|
|
188
|
+
* ```ts ignore
|
|
189
|
+
* import { existsSync } from "@std/fs/exists";
|
|
190
|
+
*
|
|
191
|
+
* existsSync("./file", { isFile: true }); // true
|
|
192
|
+
* existsSync("./directory", { isFile: true }); // false
|
|
193
|
+
* ```
|
|
194
|
+
*
|
|
195
|
+
* @example Check if a path is a readable directory
|
|
196
|
+
*
|
|
197
|
+
* Requires `--allow-sys` permissions in some cases.
|
|
198
|
+
*
|
|
199
|
+
* ```ts ignore
|
|
200
|
+
* import { existsSync } from "@std/fs/exists";
|
|
201
|
+
*
|
|
202
|
+
* existsSync("./readable_directory", { isReadable: true, isDirectory: true }); // true
|
|
203
|
+
* existsSync("./not_readable_directory", { isReadable: true, isDirectory: true }); // false
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @example Check if a path is a readable file
|
|
207
|
+
*
|
|
208
|
+
* Requires `--allow-sys` permissions in some cases.
|
|
209
|
+
*
|
|
210
|
+
* ```ts ignore
|
|
211
|
+
* import { existsSync } from "@std/fs/exists";
|
|
212
|
+
*
|
|
213
|
+
* existsSync("./readable_file", { isReadable: true, isFile: true }); // true
|
|
214
|
+
* existsSync("./not_readable_file", { isReadable: true, isFile: true }); // false
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
export declare function existsSync(path: string | URL, options?: ExistsOptions): boolean;
|
|
218
|
+
//# sourceMappingURL=exists.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exists.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/fs/1.0.22/exists.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,OAAO,CAAC,CAsClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAqCT"}
|