You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To do the inverse, add `import "@@@@prompt-foundry/typescript-sdk/shims/node"` (which does import polyfills).
219
+
To do the inverse, add `import "@prompt-foundry/typescript-sdk/shims/node"` (which does import polyfills).
220
220
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/prompt-foundry/typescript-sdk/tree/main/src/_shims#readme)).
221
221
222
222
### Logging and middleware
@@ -226,7 +226,7 @@ which can be used to inspect or alter the `Request` or `Response` before/after e
`@@@@prompt-foundry/typescript-sdk` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
3
+
`@prompt-foundry/typescript-sdk` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
4
4
edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
5
5
6
-
To do this, `@@@@prompt-foundry/typescript-sdk` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
6
+
To do this, `@prompt-foundry/typescript-sdk` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
7
7
8
8
It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to
9
9
automatically select the correct shims for each environment. However, conditional exports are a fairly new
@@ -15,32 +15,32 @@ getting the wrong raw `Response` type from `.asResponse()`, for example.
15
15
16
16
The user can work around these issues by manually importing one of:
All of the code here in `_shims` handles selecting the automatic default shims or manual overrides.
22
22
23
23
### How it works - Runtime
24
24
25
-
Runtime shims get installed by calling `setShims` exported by `@@@@prompt-foundry/typescript-sdk/_shims/registry`.
25
+
Runtime shims get installed by calling `setShims` exported by `@prompt-foundry/typescript-sdk/_shims/registry`.
26
26
27
-
Manually importing `@@@@prompt-foundry/typescript-sdk/shims/node` or `@@@@prompt-foundry/typescript-sdk/shims/web`, calls `setShims` with the respective runtime shims.
27
+
Manually importing `@prompt-foundry/typescript-sdk/shims/node` or `@prompt-foundry/typescript-sdk/shims/web`, calls `setShims` with the respective runtime shims.
28
28
29
-
All client code imports shims from `@@@@prompt-foundry/typescript-sdk/_shims/index`, which:
29
+
All client code imports shims from `@prompt-foundry/typescript-sdk/_shims/index`, which:
30
30
31
31
- checks if shims have been set manually
32
-
- if not, calls `setShims` with the shims from `@@@@prompt-foundry/typescript-sdk/_shims/auto/runtime`
33
-
- re-exports the installed shims from `@@@@prompt-foundry/typescript-sdk/_shims/registry`.
32
+
- if not, calls `setShims` with the shims from `@prompt-foundry/typescript-sdk/_shims/auto/runtime`
33
+
- re-exports the installed shims from `@prompt-foundry/typescript-sdk/_shims/registry`.
34
34
35
-
`@@@@prompt-foundry/typescript-sdk/_shims/auto/runtime` exports web runtime shims.
36
-
If the `node` export condition is set, the export map replaces it with `@@@@prompt-foundry/typescript-sdk/_shims/auto/runtime-node`.
35
+
`@prompt-foundry/typescript-sdk/_shims/auto/runtime` exports web runtime shims.
36
+
If the `node` export condition is set, the export map replaces it with `@prompt-foundry/typescript-sdk/_shims/auto/runtime-node`.
37
37
38
38
### How it works - Type time
39
39
40
-
All client code imports shim types from `@@@@prompt-foundry/typescript-sdk/_shims/index`, which selects the manual types from `@@@@prompt-foundry/typescript-sdk/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@@@@prompt-foundry/typescript-sdk/_shims/auto/types`.
40
+
All client code imports shim types from `@prompt-foundry/typescript-sdk/_shims/index`, which selects the manual types from `@prompt-foundry/typescript-sdk/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@prompt-foundry/typescript-sdk/_shims/auto/types`.
41
41
42
-
`@@@@prompt-foundry/typescript-sdk/_shims/manual-types` exports an empty namespace.
43
-
Manually importing `@@@@prompt-foundry/typescript-sdk/shims/node` or `@@@@prompt-foundry/typescript-sdk/shims/web` merges declarations into this empty namespace, so they get picked up by `@@@@prompt-foundry/typescript-sdk/_shims/index`.
42
+
`@prompt-foundry/typescript-sdk/_shims/manual-types` exports an empty namespace.
43
+
Manually importing `@prompt-foundry/typescript-sdk/shims/node` or `@prompt-foundry/typescript-sdk/shims/web` merges declarations into this empty namespace, so they get picked up by `@prompt-foundry/typescript-sdk/_shims/index`.
44
44
45
-
`@@@@prompt-foundry/typescript-sdk/_shims/auto/types` exports web type definitions.
46
-
If the `node` export condition is set, the export map replaces it with `@@@@prompt-foundry/typescript-sdk/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
45
+
`@prompt-foundry/typescript-sdk/_shims/auto/types` exports web type definitions.
46
+
If the `node` export condition is set, the export map replaces it with `@prompt-foundry/typescript-sdk/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
0 commit comments