@anthropic-ai/claude-code 0.2.9
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/LICENSE.md +3 -0
- package/README.md +55 -0
- package/cli.mjs +1398 -0
- package/package.json +31 -0
- package/vendor/ripgrep/COPYING +3 -0
- package/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/vendor/ripgrep/arm64-linux/rg +0 -0
- package/vendor/ripgrep/x64-darwin/rg +0 -0
- package/vendor/ripgrep/x64-linux/rg +0 -0
- package/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/vendor/sdk/CHANGELOG.md +1421 -0
- package/vendor/sdk/LICENSE +8 -0
- package/vendor/sdk/README.md +536 -0
- package/vendor/sdk/_shims/MultipartBody.d.ts +9 -0
- package/vendor/sdk/_shims/MultipartBody.d.ts.map +1 -0
- package/vendor/sdk/_shims/MultipartBody.js +16 -0
- package/vendor/sdk/_shims/MultipartBody.js.map +1 -0
- package/vendor/sdk/_shims/MultipartBody.mjs +12 -0
- package/vendor/sdk/_shims/MultipartBody.mjs.map +1 -0
- package/vendor/sdk/_shims/README.md +46 -0
- package/vendor/sdk/_shims/auto/runtime-bun.d.ts +5 -0
- package/vendor/sdk/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/vendor/sdk/_shims/auto/runtime-bun.js +21 -0
- package/vendor/sdk/_shims/auto/runtime-bun.js.map +1 -0
- package/vendor/sdk/_shims/auto/runtime-bun.mjs +2 -0
- package/vendor/sdk/_shims/auto/runtime-bun.mjs.map +1 -0
- package/vendor/sdk/_shims/auto/runtime-node.d.ts +5 -0
- package/vendor/sdk/_shims/auto/runtime-node.d.ts.map +1 -0
- package/vendor/sdk/_shims/auto/runtime-node.js +21 -0
- package/vendor/sdk/_shims/auto/runtime-node.js.map +1 -0
- package/vendor/sdk/_shims/auto/runtime-node.mjs +2 -0
- package/vendor/sdk/_shims/auto/runtime-node.mjs.map +1 -0
- package/vendor/sdk/_shims/auto/runtime.d.ts +5 -0
- package/vendor/sdk/_shims/auto/runtime.d.ts.map +1 -0
- package/vendor/sdk/_shims/auto/runtime.js +21 -0
- package/vendor/sdk/_shims/auto/runtime.js.map +1 -0
- package/vendor/sdk/_shims/auto/runtime.mjs +2 -0
- package/vendor/sdk/_shims/auto/runtime.mjs.map +1 -0
- package/vendor/sdk/_shims/auto/types-node.d.ts +5 -0
- package/vendor/sdk/_shims/auto/types-node.d.ts.map +1 -0
- package/vendor/sdk/_shims/auto/types-node.js +21 -0
- package/vendor/sdk/_shims/auto/types-node.js.map +1 -0
- package/vendor/sdk/_shims/auto/types-node.mjs +2 -0
- package/vendor/sdk/_shims/auto/types-node.mjs.map +1 -0
- package/vendor/sdk/_shims/auto/types.d.ts +101 -0
- package/vendor/sdk/_shims/auto/types.js +3 -0
- package/vendor/sdk/_shims/auto/types.mjs +3 -0
- package/vendor/sdk/_shims/bun-runtime.d.ts +6 -0
- package/vendor/sdk/_shims/bun-runtime.d.ts.map +1 -0
- package/vendor/sdk/_shims/bun-runtime.js +14 -0
- package/vendor/sdk/_shims/bun-runtime.js.map +1 -0
- package/vendor/sdk/_shims/bun-runtime.mjs +10 -0
- package/vendor/sdk/_shims/bun-runtime.mjs.map +1 -0
- package/vendor/sdk/_shims/index.d.ts +81 -0
- package/vendor/sdk/_shims/index.js +13 -0
- package/vendor/sdk/_shims/index.mjs +7 -0
- package/vendor/sdk/_shims/manual-types.d.ts +12 -0
- package/vendor/sdk/_shims/manual-types.js +3 -0
- package/vendor/sdk/_shims/manual-types.mjs +3 -0
- package/vendor/sdk/_shims/node-runtime.d.ts +3 -0
- package/vendor/sdk/_shims/node-runtime.d.ts.map +1 -0
- package/vendor/sdk/_shims/node-runtime.js +89 -0
- package/vendor/sdk/_shims/node-runtime.js.map +1 -0
- package/vendor/sdk/_shims/node-runtime.mjs +56 -0
- package/vendor/sdk/_shims/node-runtime.mjs.map +1 -0
- package/vendor/sdk/_shims/node-types.d.ts +42 -0
- package/vendor/sdk/_shims/node-types.js +3 -0
- package/vendor/sdk/_shims/node-types.mjs +3 -0
- package/vendor/sdk/_shims/registry.d.ts +37 -0
- package/vendor/sdk/_shims/registry.d.ts.map +1 -0
- package/vendor/sdk/_shims/registry.js +41 -0
- package/vendor/sdk/_shims/registry.js.map +1 -0
- package/vendor/sdk/_shims/registry.mjs +37 -0
- package/vendor/sdk/_shims/registry.mjs.map +1 -0
- package/vendor/sdk/_shims/web-runtime.d.ts +5 -0
- package/vendor/sdk/_shims/web-runtime.d.ts.map +1 -0
- package/vendor/sdk/_shims/web-runtime.js +78 -0
- package/vendor/sdk/_shims/web-runtime.js.map +1 -0
- package/vendor/sdk/_shims/web-runtime.mjs +71 -0
- package/vendor/sdk/_shims/web-runtime.mjs.map +1 -0
- package/vendor/sdk/_shims/web-types.d.ts +83 -0
- package/vendor/sdk/_shims/web-types.js +3 -0
- package/vendor/sdk/_shims/web-types.mjs +3 -0
- package/vendor/sdk/_vendor/partial-json-parser/parser.d.ts +3 -0
- package/vendor/sdk/_vendor/partial-json-parser/parser.d.ts.map +1 -0
- package/vendor/sdk/_vendor/partial-json-parser/parser.js +226 -0
- package/vendor/sdk/_vendor/partial-json-parser/parser.js.map +1 -0
- package/vendor/sdk/_vendor/partial-json-parser/parser.mjs +223 -0
- package/vendor/sdk/_vendor/partial-json-parser/parser.mjs.map +1 -0
- package/vendor/sdk/core.d.ts +248 -0
- package/vendor/sdk/core.d.ts.map +1 -0
- package/vendor/sdk/core.js +935 -0
- package/vendor/sdk/core.js.map +1 -0
- package/vendor/sdk/core.mjs +903 -0
- package/vendor/sdk/core.mjs.map +1 -0
- package/vendor/sdk/error.d.ts +48 -0
- package/vendor/sdk/error.d.ts.map +1 -0
- package/vendor/sdk/error.js +114 -0
- package/vendor/sdk/error.js.map +1 -0
- package/vendor/sdk/error.mjs +98 -0
- package/vendor/sdk/error.mjs.map +1 -0
- package/vendor/sdk/index.d.mts +152 -0
- package/vendor/sdk/index.d.ts +152 -0
- package/vendor/sdk/index.d.ts.map +1 -0
- package/vendor/sdk/index.js +179 -0
- package/vendor/sdk/index.js.map +1 -0
- package/vendor/sdk/index.mjs +136 -0
- package/vendor/sdk/index.mjs.map +1 -0
- package/vendor/sdk/internal/decoders/jsonl.d.ts +12 -0
- package/vendor/sdk/internal/decoders/jsonl.d.ts.map +1 -0
- package/vendor/sdk/internal/decoders/jsonl.js +35 -0
- package/vendor/sdk/internal/decoders/jsonl.js.map +1 -0
- package/vendor/sdk/internal/decoders/jsonl.mjs +31 -0
- package/vendor/sdk/internal/decoders/jsonl.mjs.map +1 -0
- package/vendor/sdk/internal/decoders/line.d.ts +20 -0
- package/vendor/sdk/internal/decoders/line.d.ts.map +1 -0
- package/vendor/sdk/internal/decoders/line.js +123 -0
- package/vendor/sdk/internal/decoders/line.js.map +1 -0
- package/vendor/sdk/internal/decoders/line.mjs +119 -0
- package/vendor/sdk/internal/decoders/line.mjs.map +1 -0
- package/vendor/sdk/internal/stream-utils.d.ts +8 -0
- package/vendor/sdk/internal/stream-utils.d.ts.map +1 -0
- package/vendor/sdk/internal/stream-utils.js +39 -0
- package/vendor/sdk/internal/stream-utils.js.map +1 -0
- package/vendor/sdk/internal/stream-utils.mjs +35 -0
- package/vendor/sdk/internal/stream-utils.mjs.map +1 -0
- package/vendor/sdk/lib/BetaMessageStream.d.ts +114 -0
- package/vendor/sdk/lib/BetaMessageStream.d.ts.map +1 -0
- package/vendor/sdk/lib/BetaMessageStream.js +547 -0
- package/vendor/sdk/lib/BetaMessageStream.js.map +1 -0
- package/vendor/sdk/lib/BetaMessageStream.mjs +543 -0
- package/vendor/sdk/lib/BetaMessageStream.mjs.map +1 -0
- package/vendor/sdk/lib/MessageStream.d.ts +114 -0
- package/vendor/sdk/lib/MessageStream.d.ts.map +1 -0
- package/vendor/sdk/lib/MessageStream.js +547 -0
- package/vendor/sdk/lib/MessageStream.js.map +1 -0
- package/vendor/sdk/lib/MessageStream.mjs +543 -0
- package/vendor/sdk/lib/MessageStream.mjs.map +1 -0
- package/vendor/sdk/node_modules/@types/node/LICENSE +21 -0
- package/vendor/sdk/node_modules/@types/node/README.md +15 -0
- package/vendor/sdk/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/vendor/sdk/node_modules/@types/node/assert.d.ts +985 -0
- package/vendor/sdk/node_modules/@types/node/async_hooks.d.ts +522 -0
- package/vendor/sdk/node_modules/@types/node/buffer.buffer.d.ts +385 -0
- package/vendor/sdk/node_modules/@types/node/buffer.d.ts +1903 -0
- package/vendor/sdk/node_modules/@types/node/child_process.d.ts +1549 -0
- package/vendor/sdk/node_modules/@types/node/cluster.d.ts +578 -0
- package/vendor/sdk/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/vendor/sdk/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/vendor/sdk/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/vendor/sdk/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/vendor/sdk/node_modules/@types/node/console.d.ts +452 -0
- package/vendor/sdk/node_modules/@types/node/constants.d.ts +19 -0
- package/vendor/sdk/node_modules/@types/node/crypto.d.ts +4453 -0
- package/vendor/sdk/node_modules/@types/node/dgram.d.ts +596 -0
- package/vendor/sdk/node_modules/@types/node/diagnostics_channel.d.ts +546 -0
- package/vendor/sdk/node_modules/@types/node/dns/promises.d.ts +475 -0
- package/vendor/sdk/node_modules/@types/node/dns.d.ts +853 -0
- package/vendor/sdk/node_modules/@types/node/dom-events.d.ts +124 -0
- package/vendor/sdk/node_modules/@types/node/domain.d.ts +170 -0
- package/vendor/sdk/node_modules/@types/node/events.d.ts +819 -0
- package/vendor/sdk/node_modules/@types/node/fs/promises.d.ts +1205 -0
- package/vendor/sdk/node_modules/@types/node/fs.d.ts +4237 -0
- package/vendor/sdk/node_modules/@types/node/globals.d.ts +442 -0
- package/vendor/sdk/node_modules/@types/node/globals.typedarray.d.ts +21 -0
- package/vendor/sdk/node_modules/@types/node/http.d.ts +1839 -0
- package/vendor/sdk/node_modules/@types/node/http2.d.ts +2517 -0
- package/vendor/sdk/node_modules/@types/node/https.d.ts +544 -0
- package/vendor/sdk/node_modules/@types/node/index.d.ts +90 -0
- package/vendor/sdk/node_modules/@types/node/inspector.d.ts +2775 -0
- package/vendor/sdk/node_modules/@types/node/module.d.ts +291 -0
- package/vendor/sdk/node_modules/@types/node/net.d.ts +924 -0
- package/vendor/sdk/node_modules/@types/node/os.d.ts +473 -0
- package/vendor/sdk/node_modules/@types/node/package.json +225 -0
- package/vendor/sdk/node_modules/@types/node/path.d.ts +191 -0
- package/vendor/sdk/node_modules/@types/node/perf_hooks.d.ts +753 -0
- package/vendor/sdk/node_modules/@types/node/process.d.ts +1553 -0
- package/vendor/sdk/node_modules/@types/node/punycode.d.ts +117 -0
- package/vendor/sdk/node_modules/@types/node/querystring.d.ts +141 -0
- package/vendor/sdk/node_modules/@types/node/readline/promises.d.ts +154 -0
- package/vendor/sdk/node_modules/@types/node/readline.d.ts +715 -0
- package/vendor/sdk/node_modules/@types/node/repl.d.ts +430 -0
- package/vendor/sdk/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/vendor/sdk/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/vendor/sdk/node_modules/@types/node/stream/web.d.ts +523 -0
- package/vendor/sdk/node_modules/@types/node/stream.d.ts +1731 -0
- package/vendor/sdk/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/vendor/sdk/node_modules/@types/node/test.d.ts +1245 -0
- package/vendor/sdk/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/vendor/sdk/node_modules/@types/node/timers.d.ts +126 -0
- package/vendor/sdk/node_modules/@types/node/tls.d.ts +1203 -0
- package/vendor/sdk/node_modules/@types/node/trace_events.d.ts +171 -0
- package/vendor/sdk/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
- package/vendor/sdk/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
- package/vendor/sdk/node_modules/@types/node/ts5.6/index.d.ts +90 -0
- package/vendor/sdk/node_modules/@types/node/tty.d.ts +206 -0
- package/vendor/sdk/node_modules/@types/node/url.d.ts +957 -0
- package/vendor/sdk/node_modules/@types/node/util.d.ts +2083 -0
- package/vendor/sdk/node_modules/@types/node/v8.d.ts +753 -0
- package/vendor/sdk/node_modules/@types/node/vm.d.ts +666 -0
- package/vendor/sdk/node_modules/@types/node/wasi.d.ts +160 -0
- package/vendor/sdk/node_modules/@types/node/worker_threads.d.ts +695 -0
- package/vendor/sdk/node_modules/@types/node/zlib.d.ts +517 -0
- package/vendor/sdk/node_modules/undici-types/README.md +6 -0
- package/vendor/sdk/node_modules/undici-types/agent.d.ts +31 -0
- package/vendor/sdk/node_modules/undici-types/api.d.ts +43 -0
- package/vendor/sdk/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/vendor/sdk/node_modules/undici-types/cache.d.ts +36 -0
- package/vendor/sdk/node_modules/undici-types/client.d.ts +97 -0
- package/vendor/sdk/node_modules/undici-types/connector.d.ts +34 -0
- package/vendor/sdk/node_modules/undici-types/content-type.d.ts +21 -0
- package/vendor/sdk/node_modules/undici-types/cookies.d.ts +28 -0
- package/vendor/sdk/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/vendor/sdk/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/vendor/sdk/node_modules/undici-types/errors.d.ts +128 -0
- package/vendor/sdk/node_modules/undici-types/fetch.d.ts +209 -0
- package/vendor/sdk/node_modules/undici-types/file.d.ts +39 -0
- package/vendor/sdk/node_modules/undici-types/filereader.d.ts +54 -0
- package/vendor/sdk/node_modules/undici-types/formdata.d.ts +108 -0
- package/vendor/sdk/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/vendor/sdk/node_modules/undici-types/global-origin.d.ts +7 -0
- package/vendor/sdk/node_modules/undici-types/handlers.d.ts +9 -0
- package/vendor/sdk/node_modules/undici-types/header.d.ts +4 -0
- package/vendor/sdk/node_modules/undici-types/index.d.ts +63 -0
- package/vendor/sdk/node_modules/undici-types/interceptors.d.ts +5 -0
- package/vendor/sdk/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/vendor/sdk/node_modules/undici-types/mock-client.d.ts +25 -0
- package/vendor/sdk/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/vendor/sdk/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/vendor/sdk/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/vendor/sdk/node_modules/undici-types/package.json +55 -0
- package/vendor/sdk/node_modules/undici-types/patch.d.ts +71 -0
- package/vendor/sdk/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/vendor/sdk/node_modules/undici-types/pool.d.ts +28 -0
- package/vendor/sdk/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/vendor/sdk/node_modules/undici-types/readable.d.ts +61 -0
- package/vendor/sdk/node_modules/undici-types/webidl.d.ts +220 -0
- package/vendor/sdk/node_modules/undici-types/websocket.d.ts +131 -0
- package/vendor/sdk/package.json +124 -0
- package/vendor/sdk/pagination.d.ts +27 -0
- package/vendor/sdk/pagination.d.ts.map +1 -0
- package/vendor/sdk/pagination.js +60 -0
- package/vendor/sdk/pagination.js.map +1 -0
- package/vendor/sdk/pagination.mjs +56 -0
- package/vendor/sdk/pagination.mjs.map +1 -0
- package/vendor/sdk/resource.d.ts +6 -0
- package/vendor/sdk/resource.d.ts.map +1 -0
- package/vendor/sdk/resource.js +11 -0
- package/vendor/sdk/resource.js.map +1 -0
- package/vendor/sdk/resource.mjs +7 -0
- package/vendor/sdk/resource.mjs.map +1 -0
- package/vendor/sdk/resources/beta/beta.d.ts +57 -0
- package/vendor/sdk/resources/beta/beta.d.ts.map +1 -0
- package/vendor/sdk/resources/beta/beta.js +44 -0
- package/vendor/sdk/resources/beta/beta.js.map +1 -0
- package/vendor/sdk/resources/beta/beta.mjs +17 -0
- package/vendor/sdk/resources/beta/beta.mjs.map +1 -0
- package/vendor/sdk/resources/beta/index.d.ts +4 -0
- package/vendor/sdk/resources/beta/index.d.ts.map +1 -0
- package/vendor/sdk/resources/beta/index.js +12 -0
- package/vendor/sdk/resources/beta/index.js.map +1 -0
- package/vendor/sdk/resources/beta/index.mjs +5 -0
- package/vendor/sdk/resources/beta/index.mjs.map +1 -0
- package/vendor/sdk/resources/beta/messages/batches.d.ts +289 -0
- package/vendor/sdk/resources/beta/messages/batches.d.ts.map +1 -0
- package/vendor/sdk/resources/beta/messages/batches.js +112 -0
- package/vendor/sdk/resources/beta/messages/batches.js.map +1 -0
- package/vendor/sdk/resources/beta/messages/batches.mjs +107 -0
- package/vendor/sdk/resources/beta/messages/batches.mjs.map +1 -0
- package/vendor/sdk/resources/beta/messages/index.d.ts +3 -0
- package/vendor/sdk/resources/beta/messages/index.d.ts.map +1 -0
- package/vendor/sdk/resources/beta/messages/index.js +10 -0
- package/vendor/sdk/resources/beta/messages/index.js.map +1 -0
- package/vendor/sdk/resources/beta/messages/index.mjs +4 -0
- package/vendor/sdk/resources/beta/messages/index.mjs.map +1 -0
- package/vendor/sdk/resources/beta/messages/messages.d.ts +1038 -0
- package/vendor/sdk/resources/beta/messages/messages.d.ts.map +1 -0
- package/vendor/sdk/resources/beta/messages/messages.js +93 -0
- package/vendor/sdk/resources/beta/messages/messages.js.map +1 -0
- package/vendor/sdk/resources/beta/messages/messages.mjs +66 -0
- package/vendor/sdk/resources/beta/messages/messages.mjs.map +1 -0
- package/vendor/sdk/resources/beta/models.d.ts +49 -0
- package/vendor/sdk/resources/beta/models.d.ts.map +1 -0
- package/vendor/sdk/resources/beta/models.js +30 -0
- package/vendor/sdk/resources/beta/models.js.map +1 -0
- package/vendor/sdk/resources/beta/models.mjs +25 -0
- package/vendor/sdk/resources/beta/models.mjs.map +1 -0
- package/vendor/sdk/resources/completions.d.ts +166 -0
- package/vendor/sdk/resources/completions.d.ts.map +1 -0
- package/vendor/sdk/resources/completions.js +17 -0
- package/vendor/sdk/resources/completions.js.map +1 -0
- package/vendor/sdk/resources/completions.mjs +13 -0
- package/vendor/sdk/resources/completions.mjs.map +1 -0
- package/vendor/sdk/resources/index.d.ts +6 -0
- package/vendor/sdk/resources/index.d.ts.map +1 -0
- package/vendor/sdk/resources/index.js +29 -0
- package/vendor/sdk/resources/index.js.map +1 -0
- package/vendor/sdk/resources/index.mjs +7 -0
- package/vendor/sdk/resources/index.mjs.map +1 -0
- package/vendor/sdk/resources/messages/batches.d.ts +253 -0
- package/vendor/sdk/resources/messages/batches.d.ts.map +1 -0
- package/vendor/sdk/resources/messages/batches.js +102 -0
- package/vendor/sdk/resources/messages/batches.js.map +1 -0
- package/vendor/sdk/resources/messages/batches.mjs +97 -0
- package/vendor/sdk/resources/messages/batches.mjs.map +1 -0
- package/vendor/sdk/resources/messages/index.d.ts +3 -0
- package/vendor/sdk/resources/messages/index.d.ts.map +1 -0
- package/vendor/sdk/resources/messages/index.js +10 -0
- package/vendor/sdk/resources/messages/index.js.map +1 -0
- package/vendor/sdk/resources/messages/index.mjs +4 -0
- package/vendor/sdk/resources/messages/index.mjs.map +1 -0
- package/vendor/sdk/resources/messages/messages.d.ts +1028 -0
- package/vendor/sdk/resources/messages/messages.d.ts.map +1 -0
- package/vendor/sdk/resources/messages/messages.js +82 -0
- package/vendor/sdk/resources/messages/messages.js.map +1 -0
- package/vendor/sdk/resources/messages/messages.mjs +54 -0
- package/vendor/sdk/resources/messages/messages.mjs.map +1 -0
- package/vendor/sdk/resources/models.d.ts +49 -0
- package/vendor/sdk/resources/models.d.ts.map +1 -0
- package/vendor/sdk/resources/models.js +30 -0
- package/vendor/sdk/resources/models.js.map +1 -0
- package/vendor/sdk/resources/models.mjs +25 -0
- package/vendor/sdk/resources/models.mjs.map +1 -0
- package/vendor/sdk/resources/shared.d.ts +42 -0
- package/vendor/sdk/resources/shared.d.ts.map +1 -0
- package/vendor/sdk/resources/shared.js +4 -0
- package/vendor/sdk/resources/shared.js.map +1 -0
- package/vendor/sdk/resources/shared.mjs +3 -0
- package/vendor/sdk/resources/shared.mjs.map +1 -0
- package/vendor/sdk/resources/top-level.d.ts +2 -0
- package/vendor/sdk/resources/top-level.d.ts.map +1 -0
- package/vendor/sdk/resources/top-level.js +4 -0
- package/vendor/sdk/resources/top-level.js.map +1 -0
- package/vendor/sdk/resources/top-level.mjs +3 -0
- package/vendor/sdk/resources/top-level.mjs.map +1 -0
- package/vendor/sdk/shims/node.d.ts +30 -0
- package/vendor/sdk/shims/node.d.ts.map +1 -0
- package/vendor/sdk/shims/node.js +31 -0
- package/vendor/sdk/shims/node.js.map +1 -0
- package/vendor/sdk/shims/node.mjs +5 -0
- package/vendor/sdk/shims/node.mjs.map +1 -0
- package/vendor/sdk/shims/web.d.ts +26 -0
- package/vendor/sdk/shims/web.d.ts.map +1 -0
- package/vendor/sdk/shims/web.js +31 -0
- package/vendor/sdk/shims/web.js.map +1 -0
- package/vendor/sdk/shims/web.mjs +5 -0
- package/vendor/sdk/shims/web.mjs.map +1 -0
- package/vendor/sdk/src/_shims/MultipartBody.ts +9 -0
- package/vendor/sdk/src/_shims/README.md +46 -0
- package/vendor/sdk/src/_shims/auto/runtime-bun.ts +4 -0
- package/vendor/sdk/src/_shims/auto/runtime-node.ts +4 -0
- package/vendor/sdk/src/_shims/auto/runtime.ts +4 -0
- package/vendor/sdk/src/_shims/auto/types-node.ts +4 -0
- package/vendor/sdk/src/_shims/auto/types.d.ts +101 -0
- package/vendor/sdk/src/_shims/auto/types.js +3 -0
- package/vendor/sdk/src/_shims/auto/types.mjs +3 -0
- package/vendor/sdk/src/_shims/bun-runtime.ts +14 -0
- package/vendor/sdk/src/_shims/index.d.ts +81 -0
- package/vendor/sdk/src/_shims/index.js +13 -0
- package/vendor/sdk/src/_shims/index.mjs +7 -0
- package/vendor/sdk/src/_shims/manual-types.d.ts +12 -0
- package/vendor/sdk/src/_shims/manual-types.js +3 -0
- package/vendor/sdk/src/_shims/manual-types.mjs +3 -0
- package/vendor/sdk/src/_shims/node-runtime.ts +81 -0
- package/vendor/sdk/src/_shims/node-types.d.ts +42 -0
- package/vendor/sdk/src/_shims/node-types.js +3 -0
- package/vendor/sdk/src/_shims/node-types.mjs +3 -0
- package/vendor/sdk/src/_shims/registry.ts +67 -0
- package/vendor/sdk/src/_shims/web-runtime.ts +103 -0
- package/vendor/sdk/src/_shims/web-types.d.ts +83 -0
- package/vendor/sdk/src/_shims/web-types.js +3 -0
- package/vendor/sdk/src/_shims/web-types.mjs +3 -0
- package/vendor/sdk/src/_vendor/partial-json-parser/README.md +3 -0
- package/vendor/sdk/src/_vendor/partial-json-parser/parser.ts +264 -0
- package/vendor/sdk/src/core.ts +1250 -0
- package/vendor/sdk/src/error.ts +133 -0
- package/vendor/sdk/src/index.ts +465 -0
- package/vendor/sdk/src/internal/decoders/jsonl.ts +41 -0
- package/vendor/sdk/src/internal/decoders/line.ts +145 -0
- package/vendor/sdk/src/internal/stream-utils.ts +32 -0
- package/vendor/sdk/src/lib/.keep +4 -0
- package/vendor/sdk/src/lib/BetaMessageStream.ts +661 -0
- package/vendor/sdk/src/lib/MessageStream.ts +662 -0
- package/vendor/sdk/src/pagination.ts +92 -0
- package/vendor/sdk/src/resource.ts +11 -0
- package/vendor/sdk/src/resources/beta/beta.ts +249 -0
- package/vendor/sdk/src/resources/beta/index.ts +83 -0
- package/vendor/sdk/src/resources/beta/messages/batches.ts +486 -0
- package/vendor/sdk/src/resources/beta/messages/index.ts +87 -0
- package/vendor/sdk/src/resources/beta/messages/messages.ts +1444 -0
- package/vendor/sdk/src/resources/beta/models.ts +78 -0
- package/vendor/sdk/src/resources/completions.ts +210 -0
- package/vendor/sdk/src/resources/index.ts +95 -0
- package/vendor/sdk/src/resources/messages/batches.ts +352 -0
- package/vendor/sdk/src/resources/messages/index.ts +85 -0
- package/vendor/sdk/src/resources/messages/messages.ts +1412 -0
- package/vendor/sdk/src/resources/models.ts +75 -0
- package/vendor/sdk/src/resources/shared.ts +72 -0
- package/vendor/sdk/src/resources/top-level.ts +3 -0
- package/vendor/sdk/src/shims/node.ts +50 -0
- package/vendor/sdk/src/shims/web.ts +50 -0
- package/vendor/sdk/src/streaming.ts +372 -0
- package/vendor/sdk/src/tsconfig.json +11 -0
- package/vendor/sdk/src/uploads.ts +255 -0
- package/vendor/sdk/src/version.ts +1 -0
- package/vendor/sdk/streaming.d.ts +36 -0
- package/vendor/sdk/streaming.d.ts.map +1 -0
- package/vendor/sdk/streaming.js +316 -0
- package/vendor/sdk/streaming.js.map +1 -0
- package/vendor/sdk/streaming.mjs +310 -0
- package/vendor/sdk/streaming.mjs.map +1 -0
- package/vendor/sdk/uploads.d.ts +75 -0
- package/vendor/sdk/uploads.d.ts.map +1 -0
- package/vendor/sdk/uploads.js +171 -0
- package/vendor/sdk/uploads.js.map +1 -0
- package/vendor/sdk/uploads.mjs +158 -0
- package/vendor/sdk/uploads.mjs.map +1 -0
- package/vendor/sdk/version.d.ts +2 -0
- package/vendor/sdk/version.d.ts.map +1 -0
- package/vendor/sdk/version.js +5 -0
- package/vendor/sdk/version.js.map +1 -0
- package/vendor/sdk/version.mjs +2 -0
- package/vendor/sdk/version.mjs.map +1 -0
- package/yoga.wasm +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
|
+
*/
|
|
4
|
+
import { type RequestOptions } from "../core.js";
|
|
5
|
+
export interface Shims {
|
|
6
|
+
kind: string;
|
|
7
|
+
fetch: any;
|
|
8
|
+
Request: any;
|
|
9
|
+
Response: any;
|
|
10
|
+
Headers: any;
|
|
11
|
+
FormData: any;
|
|
12
|
+
Blob: any;
|
|
13
|
+
File: any;
|
|
14
|
+
ReadableStream: any;
|
|
15
|
+
getMultipartRequestOptions: <T = Record<string, unknown>>(form: Shims['FormData'], opts: RequestOptions<T>) => Promise<RequestOptions<T>>;
|
|
16
|
+
getDefaultAgent: (url: string) => any;
|
|
17
|
+
fileFromPath: ((path: string, filename?: string, options?: {}) => Promise<Shims['File']>) | ((path: string, options?: {}) => Promise<Shims['File']>);
|
|
18
|
+
isFsReadStream: (value: any) => boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare let auto: boolean;
|
|
21
|
+
export declare let kind: Shims['kind'] | undefined;
|
|
22
|
+
export declare let fetch: Shims['fetch'] | undefined;
|
|
23
|
+
export declare let Request: Shims['Request'] | undefined;
|
|
24
|
+
export declare let Response: Shims['Response'] | undefined;
|
|
25
|
+
export declare let Headers: Shims['Headers'] | undefined;
|
|
26
|
+
export declare let FormData: Shims['FormData'] | undefined;
|
|
27
|
+
export declare let Blob: Shims['Blob'] | undefined;
|
|
28
|
+
export declare let File: Shims['File'] | undefined;
|
|
29
|
+
export declare let ReadableStream: Shims['ReadableStream'] | undefined;
|
|
30
|
+
export declare let getMultipartRequestOptions: Shims['getMultipartRequestOptions'] | undefined;
|
|
31
|
+
export declare let getDefaultAgent: Shims['getDefaultAgent'] | undefined;
|
|
32
|
+
export declare let fileFromPath: Shims['fileFromPath'] | undefined;
|
|
33
|
+
export declare let isFsReadStream: Shims['isFsReadStream'] | undefined;
|
|
34
|
+
export declare function setShims(shims: Shims, options?: {
|
|
35
|
+
auto: boolean;
|
|
36
|
+
}): void;
|
|
37
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/_shims/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,GAAG,CAAC;IACV,cAAc,EAAE,GAAG,CAAC;IACpB,0BAA0B,EAAE,CAAC,CAAC,GAAG,MAAM,CA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cAAc,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,SAAqB,CAAC;AAC3E,eAAO,IAAI,0BAA0B,EAAE,KAAK,CAAC,4BAA4B,CAAC,GAAG,SAAqB,CAAC;AACnG,eAAO,IAAI,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,GAAG,SAAqB,CAAC;AAC7E,eAAO,IAAI,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,SAAqB,CAAC;AACvE,eAAO,IAAI,cAAc,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,SAAqB,CAAC;AAE3E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAoB,QAyBlF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setShims = exports.isFsReadStream = exports.fileFromPath = exports.getDefaultAgent = exports.getMultipartRequestOptions = exports.ReadableStream = exports.File = exports.Blob = exports.FormData = exports.Headers = exports.Response = exports.Request = exports.fetch = exports.kind = exports.auto = void 0;
|
|
4
|
+
exports.auto = false;
|
|
5
|
+
exports.kind = undefined;
|
|
6
|
+
exports.fetch = undefined;
|
|
7
|
+
exports.Request = undefined;
|
|
8
|
+
exports.Response = undefined;
|
|
9
|
+
exports.Headers = undefined;
|
|
10
|
+
exports.FormData = undefined;
|
|
11
|
+
exports.Blob = undefined;
|
|
12
|
+
exports.File = undefined;
|
|
13
|
+
exports.ReadableStream = undefined;
|
|
14
|
+
exports.getMultipartRequestOptions = undefined;
|
|
15
|
+
exports.getDefaultAgent = undefined;
|
|
16
|
+
exports.fileFromPath = undefined;
|
|
17
|
+
exports.isFsReadStream = undefined;
|
|
18
|
+
function setShims(shims, options = { auto: false }) {
|
|
19
|
+
if (exports.auto) {
|
|
20
|
+
throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` before importing anything else from @anthropic-ai/sdk`);
|
|
21
|
+
}
|
|
22
|
+
if (exports.kind) {
|
|
23
|
+
throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` after \`import '@anthropic-ai/sdk/shims/${exports.kind}'\``);
|
|
24
|
+
}
|
|
25
|
+
exports.auto = options.auto;
|
|
26
|
+
exports.kind = shims.kind;
|
|
27
|
+
exports.fetch = shims.fetch;
|
|
28
|
+
exports.Request = shims.Request;
|
|
29
|
+
exports.Response = shims.Response;
|
|
30
|
+
exports.Headers = shims.Headers;
|
|
31
|
+
exports.FormData = shims.FormData;
|
|
32
|
+
exports.Blob = shims.Blob;
|
|
33
|
+
exports.File = shims.File;
|
|
34
|
+
exports.ReadableStream = shims.ReadableStream;
|
|
35
|
+
exports.getMultipartRequestOptions = shims.getMultipartRequestOptions;
|
|
36
|
+
exports.getDefaultAgent = shims.getDefaultAgent;
|
|
37
|
+
exports.fileFromPath = shims.fileFromPath;
|
|
38
|
+
exports.isFsReadStream = shims.isFsReadStream;
|
|
39
|
+
}
|
|
40
|
+
exports.setShims = setShims;
|
|
41
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/_shims/registry.ts"],"names":[],"mappings":";;;AA0BW,QAAA,IAAI,GAAG,KAAK,CAAC;AACb,QAAA,IAAI,GAA8B,SAAS,CAAC;AAC5C,QAAA,KAAK,GAA+B,SAAS,CAAC;AAC9C,QAAA,OAAO,GAAiC,SAAS,CAAC;AAClD,QAAA,QAAQ,GAAkC,SAAS,CAAC;AACpD,QAAA,OAAO,GAAiC,SAAS,CAAC;AAClD,QAAA,QAAQ,GAAkC,SAAS,CAAC;AACpD,QAAA,IAAI,GAA8B,SAAS,CAAC;AAC5C,QAAA,IAAI,GAA8B,SAAS,CAAC;AAC5C,QAAA,cAAc,GAAwC,SAAS,CAAC;AAChE,QAAA,0BAA0B,GAAoD,SAAS,CAAC;AACxF,QAAA,eAAe,GAAyC,SAAS,CAAC;AAClE,QAAA,YAAY,GAAsC,SAAS,CAAC;AAC5D,QAAA,cAAc,GAAwC,SAAS,CAAC;AAE3E,SAAgB,QAAQ,CAAC,KAAY,EAAE,UAA6B,EAAE,IAAI,EAAE,KAAK,EAAE;IACjF,IAAI,YAAI,EAAE;QACR,MAAM,IAAI,KAAK,CACb,8CAA8C,KAAK,CAAC,IAAI,2DAA2D,CACpH,CAAC;KACH;IACD,IAAI,YAAI,EAAE;QACR,MAAM,IAAI,KAAK,CACb,2CAA2C,KAAK,CAAC,IAAI,+CAA+C,YAAI,KAAK,CAC9G,CAAC;KACH;IACD,YAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACpB,YAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAClB,aAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IACpB,eAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IACxB,gBAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC1B,eAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IACxB,gBAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC1B,YAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAClB,YAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAClB,sBAAc,GAAG,KAAK,CAAC,cAAc,CAAC;IACtC,kCAA0B,GAAG,KAAK,CAAC,0BAA0B,CAAC;IAC9D,uBAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IACxC,oBAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAClC,sBAAc,GAAG,KAAK,CAAC,cAAc,CAAC;AACxC,CAAC;AAzBD,4BAyBC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export let auto = false;
|
|
2
|
+
export let kind = undefined;
|
|
3
|
+
export let fetch = undefined;
|
|
4
|
+
export let Request = undefined;
|
|
5
|
+
export let Response = undefined;
|
|
6
|
+
export let Headers = undefined;
|
|
7
|
+
export let FormData = undefined;
|
|
8
|
+
export let Blob = undefined;
|
|
9
|
+
export let File = undefined;
|
|
10
|
+
export let ReadableStream = undefined;
|
|
11
|
+
export let getMultipartRequestOptions = undefined;
|
|
12
|
+
export let getDefaultAgent = undefined;
|
|
13
|
+
export let fileFromPath = undefined;
|
|
14
|
+
export let isFsReadStream = undefined;
|
|
15
|
+
export function setShims(shims, options = { auto: false }) {
|
|
16
|
+
if (auto) {
|
|
17
|
+
throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` before importing anything else from @anthropic-ai/sdk`);
|
|
18
|
+
}
|
|
19
|
+
if (kind) {
|
|
20
|
+
throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${shims.kind}'\` after \`import '@anthropic-ai/sdk/shims/${kind}'\``);
|
|
21
|
+
}
|
|
22
|
+
auto = options.auto;
|
|
23
|
+
kind = shims.kind;
|
|
24
|
+
fetch = shims.fetch;
|
|
25
|
+
Request = shims.Request;
|
|
26
|
+
Response = shims.Response;
|
|
27
|
+
Headers = shims.Headers;
|
|
28
|
+
FormData = shims.FormData;
|
|
29
|
+
Blob = shims.Blob;
|
|
30
|
+
File = shims.File;
|
|
31
|
+
ReadableStream = shims.ReadableStream;
|
|
32
|
+
getMultipartRequestOptions = shims.getMultipartRequestOptions;
|
|
33
|
+
getDefaultAgent = shims.getDefaultAgent;
|
|
34
|
+
fileFromPath = shims.fileFromPath;
|
|
35
|
+
isFsReadStream = shims.isFsReadStream;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=registry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.mjs","sourceRoot":"","sources":["../src/_shims/registry.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,IAAI,IAAI,GAAG,KAAK,CAAC;AACxB,MAAM,CAAC,IAAI,IAAI,GAA8B,SAAS,CAAC;AACvD,MAAM,CAAC,IAAI,KAAK,GAA+B,SAAS,CAAC;AACzD,MAAM,CAA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AAc,GAAG,KAAK,CAAC,cAAc,CAAC;IACtC,0BAA0B,GAAG,KAAK,CAAC,0BAA0B,CAAC;IAC9D,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IACxC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAClC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-runtime.d.ts","sourceRoot":"","sources":["../src/_shims/web-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,wBAAgB,UAAU,CAAC,EAAE,gBAAgB,EAAE,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,KAAK,CA+F3F"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRuntime = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
6
|
+
*/
|
|
7
|
+
const MultipartBody_1 = require("./MultipartBody.js");
|
|
8
|
+
function getRuntime({ manuallyImported } = {}) {
|
|
9
|
+
const recommendation = manuallyImported ?
|
|
10
|
+
`You may need to use polyfills`
|
|
11
|
+
: `Add one of these imports before your first \`import … from '@anthropic-ai/sdk'\`:
|
|
12
|
+
- \`import '@anthropic-ai/sdk/shims/node'\` (if you're running on Node)
|
|
13
|
+
- \`import '@anthropic-ai/sdk/shims/web'\` (otherwise)
|
|
14
|
+
`;
|
|
15
|
+
let _fetch, _Request, _Response, _Headers;
|
|
16
|
+
try {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
_fetch = fetch;
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
_Request = Request;
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
_Response = Response;
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
_Headers = Headers;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new Error(`this environment is missing the following Web Fetch API type: ${error.message}. ${recommendation}`);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
kind: 'web',
|
|
31
|
+
fetch: _fetch,
|
|
32
|
+
Request: _Request,
|
|
33
|
+
Response: _Response,
|
|
34
|
+
Headers: _Headers,
|
|
35
|
+
FormData:
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
typeof FormData !== 'undefined' ? FormData : (class FormData {
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
constructor() {
|
|
40
|
+
throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${recommendation}`);
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
Blob: typeof Blob !== 'undefined' ? Blob : (class Blob {
|
|
44
|
+
constructor() {
|
|
45
|
+
throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${recommendation}`);
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
File:
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
typeof File !== 'undefined' ? File : (class File {
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
constructor() {
|
|
53
|
+
throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${recommendation}`);
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
ReadableStream:
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
typeof ReadableStream !== 'undefined' ? ReadableStream : (class ReadableStream {
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
constructor() {
|
|
61
|
+
throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${recommendation}`);
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
getMultipartRequestOptions: async (
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
form, opts) => ({
|
|
67
|
+
...opts,
|
|
68
|
+
body: new MultipartBody_1.MultipartBody(form),
|
|
69
|
+
}),
|
|
70
|
+
getDefaultAgent: (url) => undefined,
|
|
71
|
+
fileFromPath: () => {
|
|
72
|
+
throw new Error('The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/anthropics/anthropic-sdk-typescript#file-uploads');
|
|
73
|
+
},
|
|
74
|
+
isFsReadStream: (value) => false,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
exports.getRuntime = getRuntime;
|
|
78
|
+
//# sourceMappingURL=web-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-runtime.js","sourceRoot":"","sources":["../src/_shims/web-runtime.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,sDAAgD;AAIhD,SAAgB,UAAU,CAAC,EAAE,gBAAgB,KAAqC,EAAE;IAClF,MAAM,cAAc,GAClB,gBAAgB,CAAC,CAAC;QAChB,+BAA+B;QACjC,CAAC,CAAC;;;CAGL,CAAC;IAEA,IAAI,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;IAC1C,IAAI;QACF,aAAa;QACb,MAAM,GAAG,KAAK,CAAC;QACf,aAAa;QACb,QAAQ,GAAG,OAAO,CAAC;QACnB,aAAa;QACb,SAAS,GAAG,QAAQ,CAAC;QACrB,aAAa;QACb,QAAQ,GAAG,OAAO,CAAC;KACpB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,iEACG,KAAa,CAAC,OACjB,KAAK,cAAc,EAAE,CACtB,CAAC;KACH;IAED,OAAO;QACL,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,SAAS;QACnB,OAAO,EAAE,QAAQ;QACjB,QAAQ;QACN,aAAa;QACb,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC3C,MAAM,QAAQ;YACZ,aAAa;YACb;gBACE,MAAM,IAAI,KAAK,CACb,qFAAqF,cAAc,EAAE,CACtG,CAAC;YACJ,CAAC;SACF,CACF;QACH,IAAI,EACF,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACnC,MAAM,IAAI;YACR;gBACE,MAAM,IAAI,KAAK,CACb,iFAAiF,cAAc,EAAE,CAClG,CAAC;YACJ,CAAC;SACF,CACF;QACH,IAAI;QACF,aAAa;QACb,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACnC,MAAM,IAAI;YACR,aAAa;YACb;gBACE,MAAM,IAAI,KAAK,CACb,iFAAiF,cAAc,EAAE,CAClG,CAAC;YACJ,CAAC;SACF,CACF;QACH,cAAc;QACZ,aAAa;QACb,OAAO,cAAc,KAAK,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CACvD,MAAM,cAAc;YAClB,aAAa;YACb;gBACE,MAAM,IAAI,KAAK,CACb,uFAAuF,cAAc,EAAE,CACxG,CAAC;YACJ,CAAC;SACF,CACF;QACH,0BAA0B,EAAE,KAAK;QAC/B,aAAa;QACb,IAAc,EACd,IAAuB,EACK,EAAE,CAAC,CAAC;YAChC,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,6BAAa,CAAC,IAAI,CAAQ;SACrC,CAAC;QACF,eAAe,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,SAAS;QAC3C,YAAY,EAAE,GAAG,EAAE;YACjB,MAAM,IAAI,KAAK,CACb,iKAAiK,CAClK,CAAC;QACJ,CAAC;QACD,cAAc,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK;KACtC,CAAC;AACJ,CAAC;AA/FD,gCA+FC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { MultipartBody } from "./MultipartBody.mjs";
|
|
2
|
+
export function getRuntime({ manuallyImported } = {}) {
|
|
3
|
+
const recommendation = manuallyImported ?
|
|
4
|
+
`You may need to use polyfills`
|
|
5
|
+
: `Add one of these imports before your first \`import … from '@anthropic-ai/sdk'\`:
|
|
6
|
+
- \`import '@anthropic-ai/sdk/shims/node'\` (if you're running on Node)
|
|
7
|
+
- \`import '@anthropic-ai/sdk/shims/web'\` (otherwise)
|
|
8
|
+
`;
|
|
9
|
+
let _fetch, _Request, _Response, _Headers;
|
|
10
|
+
try {
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
_fetch = fetch;
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
_Request = Request;
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
_Response = Response;
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
_Headers = Headers;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
throw new Error(`this environment is missing the following Web Fetch API type: ${error.message}. ${recommendation}`);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
kind: 'web',
|
|
25
|
+
fetch: _fetch,
|
|
26
|
+
Request: _Request,
|
|
27
|
+
Response: _Response,
|
|
28
|
+
Headers: _Headers,
|
|
29
|
+
FormData:
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
typeof FormData !== 'undefined' ? FormData : (class FormData {
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
constructor() {
|
|
34
|
+
throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${recommendation}`);
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
Blob: typeof Blob !== 'undefined' ? Blob : (class Blob {
|
|
38
|
+
constructor() {
|
|
39
|
+
throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${recommendation}`);
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
File:
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
typeof File !== 'undefined' ? File : (class File {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
constructor() {
|
|
47
|
+
throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${recommendation}`);
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
ReadableStream:
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
typeof ReadableStream !== 'undefined' ? ReadableStream : (class ReadableStream {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
constructor() {
|
|
55
|
+
throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${recommendation}`);
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
getMultipartRequestOptions: async (
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
form, opts) => ({
|
|
61
|
+
...opts,
|
|
62
|
+
body: new MultipartBody(form),
|
|
63
|
+
}),
|
|
64
|
+
getDefaultAgent: (url) => undefined,
|
|
65
|
+
fileFromPath: () => {
|
|
66
|
+
throw new Error('The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/anthropics/anthropic-sdk-typescript#file-uploads');
|
|
67
|
+
},
|
|
68
|
+
isFsReadStream: (value) => false,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=web-runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-runtime.mjs","sourceRoot":"","sources":["../src/_shims/web-runtime.ts"],"names":[],"mappings":"OAGO,EAAE,aAAa,EAAE;AAIxB,MAAM,UAAU,UAAU,CAAC,EAAE,gBAAgB,KAAqC,EAAE;IAClF,MAAM,cAAc,GAClB,gBAAgB,CAAC,CAAC;QAChB,+BAA+B;QACjC,CAAC,CAAC;;;CAGL,CAAC;IAEA,IAAI,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;IAC1C,IAAI;QACF,aAAa;QACb,MAAM,GAAG,KAAK,CAAC;QACf,aAAa;QACb,QAAQ,GAAG,OAAO,CAAC;QACnB,aAAa;QACb,SAAS,GAAG,QAAQ,CAAC;QACrB,aAAa;QACb,QAAQ,GAAG,OAAO,CAAC;KACpB;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,iE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C3C,YAAY,EAAE,GAAG,EAAE;YACjB,MAAM,IAAI,KAAK,CACb,iKAAiK,CAClK,CAAC;QACJ,CAAC;QACD,cAAc,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK;KACtC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
|
3
|
+
*/
|
|
4
|
+
export type Agent = any;
|
|
5
|
+
|
|
6
|
+
declare const _fetch: typeof fetch;
|
|
7
|
+
export { _fetch as fetch };
|
|
8
|
+
|
|
9
|
+
type _Request = Request;
|
|
10
|
+
export { _Request as Request };
|
|
11
|
+
|
|
12
|
+
type _RequestInfo = RequestInfo;
|
|
13
|
+
export { type _RequestInfo as RequestInfo };
|
|
14
|
+
|
|
15
|
+
type _RequestInit = RequestInit;
|
|
16
|
+
export { type _RequestInit as RequestInit };
|
|
17
|
+
|
|
18
|
+
type _Response = Response;
|
|
19
|
+
export { _Response as Response };
|
|
20
|
+
|
|
21
|
+
type _ResponseInit = ResponseInit;
|
|
22
|
+
export { type _ResponseInit as ResponseInit };
|
|
23
|
+
|
|
24
|
+
type _ResponseType = ResponseType;
|
|
25
|
+
export { type _ResponseType as ResponseType };
|
|
26
|
+
|
|
27
|
+
type _BodyInit = BodyInit;
|
|
28
|
+
export { type _BodyInit as BodyInit };
|
|
29
|
+
|
|
30
|
+
type _Headers = Headers;
|
|
31
|
+
export { _Headers as Headers };
|
|
32
|
+
|
|
33
|
+
type _HeadersInit = HeadersInit;
|
|
34
|
+
export { type _HeadersInit as HeadersInit };
|
|
35
|
+
|
|
36
|
+
type EndingType = 'native' | 'transparent';
|
|
37
|
+
|
|
38
|
+
export interface BlobPropertyBag {
|
|
39
|
+
endings?: EndingType;
|
|
40
|
+
type?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
|
44
|
+
lastModified?: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
|
48
|
+
|
|
49
|
+
type _FormData = FormData;
|
|
50
|
+
declare const _FormData: typeof FormData;
|
|
51
|
+
export { _FormData as FormData };
|
|
52
|
+
|
|
53
|
+
type _File = File;
|
|
54
|
+
declare const _File: typeof File;
|
|
55
|
+
export { _File as File };
|
|
56
|
+
|
|
57
|
+
type _Blob = Blob;
|
|
58
|
+
declare const _Blob: typeof Blob;
|
|
59
|
+
export { _Blob as Blob };
|
|
60
|
+
|
|
61
|
+
export declare class Readable {
|
|
62
|
+
readable: boolean;
|
|
63
|
+
readonly readableEnded: boolean;
|
|
64
|
+
readonly readableFlowing: boolean | null;
|
|
65
|
+
readonly readableHighWaterMark: number;
|
|
66
|
+
readonly readableLength: number;
|
|
67
|
+
readonly readableObjectMode: boolean;
|
|
68
|
+
destroyed: boolean;
|
|
69
|
+
read(size?: number): any;
|
|
70
|
+
pause(): this;
|
|
71
|
+
resume(): this;
|
|
72
|
+
isPaused(): boolean;
|
|
73
|
+
destroy(error?: Error): this;
|
|
74
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export declare class FsReadStream extends Readable {
|
|
78
|
+
path: {}; // node type is string | Buffer
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
type _ReadableStream<R = any> = ReadableStream<R>;
|
|
82
|
+
declare const _ReadableStream: typeof ReadableStream;
|
|
83
|
+
export { _ReadableStream as ReadableStream };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/_vendor/partial-json-parser/parser.ts"],"names":[],"mappings":"AAKA,QAAA,MAgQE,YAAY,UAAW,MAAM,KAAG,OAAgE,CAAC;AAEnG,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.partialParse = void 0;
|
|
4
|
+
const tokenize = (input) => {
|
|
5
|
+
let current = 0;
|
|
6
|
+
let tokens = [];
|
|
7
|
+
while (current < input.length) {
|
|
8
|
+
let char = input[current];
|
|
9
|
+
if (char === '\\') {
|
|
10
|
+
current++;
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
if (char === '{') {
|
|
14
|
+
tokens.push({
|
|
15
|
+
type: 'brace',
|
|
16
|
+
value: '{',
|
|
17
|
+
});
|
|
18
|
+
current++;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (char === '}') {
|
|
22
|
+
tokens.push({
|
|
23
|
+
type: 'brace',
|
|
24
|
+
value: '}',
|
|
25
|
+
});
|
|
26
|
+
current++;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (char === '[') {
|
|
30
|
+
tokens.push({
|
|
31
|
+
type: 'paren',
|
|
32
|
+
value: '[',
|
|
33
|
+
});
|
|
34
|
+
current++;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (char === ']') {
|
|
38
|
+
tokens.push({
|
|
39
|
+
type: 'paren',
|
|
40
|
+
value: ']',
|
|
41
|
+
});
|
|
42
|
+
current++;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (char === ':') {
|
|
46
|
+
tokens.push({
|
|
47
|
+
type: 'separator',
|
|
48
|
+
value: ':',
|
|
49
|
+
});
|
|
50
|
+
current++;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (char === ',') {
|
|
54
|
+
tokens.push({
|
|
55
|
+
type: 'delimiter',
|
|
56
|
+
value: ',',
|
|
57
|
+
});
|
|
58
|
+
current++;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (char === '"') {
|
|
62
|
+
let value = '';
|
|
63
|
+
let danglingQuote = false;
|
|
64
|
+
char = input[++current];
|
|
65
|
+
while (char !== '"') {
|
|
66
|
+
if (current === input.length) {
|
|
67
|
+
danglingQuote = true;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
if (char === '\\') {
|
|
71
|
+
current++;
|
|
72
|
+
if (current === input.length) {
|
|
73
|
+
danglingQuote = true;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
value += char + input[current];
|
|
77
|
+
char = input[++current];
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
value += char;
|
|
81
|
+
char = input[++current];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
char = input[++current];
|
|
85
|
+
if (!danglingQuote) {
|
|
86
|
+
tokens.push({
|
|
87
|
+
type: 'string',
|
|
88
|
+
value,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
let WHITESPACE = /\s/;
|
|
94
|
+
if (char && WHITESPACE.test(char)) {
|
|
95
|
+
current++;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
let NUMBERS = /[0-9]/;
|
|
99
|
+
if ((char && NUMBERS.test(char)) || char === '-' || char === '.') {
|
|
100
|
+
let value = '';
|
|
101
|
+
if (char === '-') {
|
|
102
|
+
value += char;
|
|
103
|
+
char = input[++current];
|
|
104
|
+
}
|
|
105
|
+
while ((char && NUMBERS.test(char)) || char === '.') {
|
|
106
|
+
value += char;
|
|
107
|
+
char = input[++current];
|
|
108
|
+
}
|
|
109
|
+
tokens.push({
|
|
110
|
+
type: 'number',
|
|
111
|
+
value,
|
|
112
|
+
});
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
let LETTERS = /[a-z]/i;
|
|
116
|
+
if (char && LETTERS.test(char)) {
|
|
117
|
+
let value = '';
|
|
118
|
+
while (char && LETTERS.test(char)) {
|
|
119
|
+
if (current === input.length) {
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
value += char;
|
|
123
|
+
char = input[++current];
|
|
124
|
+
}
|
|
125
|
+
if (value == 'true' || value == 'false' || value === 'null') {
|
|
126
|
+
tokens.push({
|
|
127
|
+
type: 'name',
|
|
128
|
+
value,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// unknown token, e.g. `nul` which isn't quite `null`
|
|
133
|
+
current++;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
current++;
|
|
139
|
+
}
|
|
140
|
+
return tokens;
|
|
141
|
+
}, strip = (tokens) => {
|
|
142
|
+
if (tokens.length === 0) {
|
|
143
|
+
return tokens;
|
|
144
|
+
}
|
|
145
|
+
let lastToken = tokens[tokens.length - 1];
|
|
146
|
+
switch (lastToken.type) {
|
|
147
|
+
case 'separator':
|
|
148
|
+
tokens = tokens.slice(0, tokens.length - 1);
|
|
149
|
+
return strip(tokens);
|
|
150
|
+
break;
|
|
151
|
+
case 'number':
|
|
152
|
+
let lastCharacterOfLastToken = lastToken.value[lastToken.value.length - 1];
|
|
153
|
+
if (lastCharacterOfLastToken === '.' || lastCharacterOfLastToken === '-') {
|
|
154
|
+
tokens = tokens.slice(0, tokens.length - 1);
|
|
155
|
+
return strip(tokens);
|
|
156
|
+
}
|
|
157
|
+
case 'string':
|
|
158
|
+
let tokenBeforeTheLastToken = tokens[tokens.length - 2];
|
|
159
|
+
if (tokenBeforeTheLastToken?.type === 'delimiter') {
|
|
160
|
+
tokens = tokens.slice(0, tokens.length - 1);
|
|
161
|
+
return strip(tokens);
|
|
162
|
+
}
|
|
163
|
+
else if (tokenBeforeTheLastToken?.type === 'brace' && tokenBeforeTheLastToken.value === '{') {
|
|
164
|
+
tokens = tokens.slice(0, tokens.length - 1);
|
|
165
|
+
return strip(tokens);
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
case 'delimiter':
|
|
169
|
+
tokens = tokens.slice(0, tokens.length - 1);
|
|
170
|
+
return strip(tokens);
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
return tokens;
|
|
174
|
+
}, unstrip = (tokens) => {
|
|
175
|
+
let tail = [];
|
|
176
|
+
tokens.map((token) => {
|
|
177
|
+
if (token.type === 'brace') {
|
|
178
|
+
if (token.value === '{') {
|
|
179
|
+
tail.push('}');
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
tail.splice(tail.lastIndexOf('}'), 1);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (token.type === 'paren') {
|
|
186
|
+
if (token.value === '[') {
|
|
187
|
+
tail.push(']');
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
tail.splice(tail.lastIndexOf(']'), 1);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
if (tail.length > 0) {
|
|
195
|
+
tail.reverse().map((item) => {
|
|
196
|
+
if (item === '}') {
|
|
197
|
+
tokens.push({
|
|
198
|
+
type: 'brace',
|
|
199
|
+
value: '}',
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
else if (item === ']') {
|
|
203
|
+
tokens.push({
|
|
204
|
+
type: 'paren',
|
|
205
|
+
value: ']',
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return tokens;
|
|
211
|
+
}, generate = (tokens) => {
|
|
212
|
+
let output = '';
|
|
213
|
+
tokens.map((token) => {
|
|
214
|
+
switch (token.type) {
|
|
215
|
+
case 'string':
|
|
216
|
+
output += '"' + token.value + '"';
|
|
217
|
+
break;
|
|
218
|
+
default:
|
|
219
|
+
output += token.value;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
return output;
|
|
224
|
+
}, partialParse = (input) => JSON.parse(generate(unstrip(strip(tokenize(input)))));
|
|
225
|
+
exports.partialParse = partialParse;
|
|
226
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js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