Skip to content

Commit 6ebf250

Browse files
committed
feat: deno platform
1 parent d35262c commit 6ebf250

33 files changed

+1142
-22
lines changed

.patterns/jsdoc-documentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,4 +567,4 @@ export const TypeId = ...
567567
- [ ] Integration examples for advanced use cases
568568
- [ ] Real-world usage patterns demonstrated
569569

570-
This comprehensive JSDoc approach ensures that Effect library documentation provides practical, reliable examples that help developers understand and correctly use the APIs.
570+
This comprehensive JSDoc approach ensures that Effect library documentation provides practical, reliable examples that help developers understand and correctly use the APIs.

deno.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/denoland/deno/refs/heads/main/cli/schemas/config-file.v1.json",
33
"nodeModulesDir": "manual",
4-
"unstable": ["bare-node-builtins", "node-globals"],
5-
"workspace": ["./packages/*"],
4+
"unstable": [
5+
"bare-node-builtins",
6+
"node-globals"
7+
],
8+
"workspace": [
9+
"./packages/*"
10+
],
611
"exclude": [
712
"**/*.mjs",
813
"**/*.cjs",

eslint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,5 +153,11 @@ export default tseslint.config(
153153
}
154154
]
155155
}
156+
},
157+
{
158+
files: ["packages/platform-deno/src/**/*", "packages/platform-deno/test/**/*"],
159+
rules: {
160+
"import-x/namespace": "off"
161+
}
156162
}
157163
)

packages/effect/src/internal/effect.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,10 +1092,10 @@ export const fn: typeof Effect.fn = function() {
10921092
const name = nameFirst ? arguments[0] : "Effect.fn"
10931093
const spanOptions = nameFirst ? arguments[1] : undefined
10941094

1095-
const prevLimit = globalThis.Error.stackTraceLimit
1096-
globalThis.Error.stackTraceLimit = 2
1095+
const prevLimit = (globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit
1096+
;(globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit = 2
10971097
const defError = new globalThis.Error()
1098-
globalThis.Error.stackTraceLimit = prevLimit
1098+
;(globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit = prevLimit
10991099

11001100
if (nameFirst) {
11011101
return (body: Function, ...pipeables: Array<Function>) =>
@@ -1131,10 +1131,10 @@ const makeFn = (
11311131
if (!isEffect(result)) {
11321132
return result
11331133
}
1134-
const prevLimit = globalThis.Error.stackTraceLimit
1135-
globalThis.Error.stackTraceLimit = 2
1134+
const prevLimit = (globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit
1135+
;(globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit = 2
11361136
const callError = new globalThis.Error()
1137-
globalThis.Error.stackTraceLimit = prevLimit
1137+
;(globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit = prevLimit
11381138
return updateService(
11391139
addSpan ?
11401140
useSpan(name, spanOptions!, (span) => provideParentSpan(result, span)) :

packages/effect/src/unstable/ai/Tool.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*/
2929
import type * as Effect from "../../Effect.ts"
3030
import { constFalse, constTrue, identity } from "../../Function.ts"
31+
import type { ErrorWithStackTraceLimit } from "../../internal/tracer.ts"
3132
import type * as JsonSchema from "../../JsonSchema.ts"
3233
import { pipeArguments } from "../../Pipeable.ts"
3334
import * as Predicate from "../../Predicate.ts"
@@ -1305,11 +1306,11 @@ function filter(obj: any) {
13051306
*/
13061307
export const unsafeSecureJsonParse = (text: string): unknown => {
13071308
// Performance optimization, see https://github.com/fastify/secure-json-parse/pull/90
1308-
const { stackTraceLimit } = Error
1309-
Error.stackTraceLimit = 0
1309+
const { stackTraceLimit } = Error as ErrorWithStackTraceLimit
1310+
;(Error as ErrorWithStackTraceLimit).stackTraceLimit = 0
13101311
try {
13111312
return _parse(text)
13121313
} finally {
1313-
Error.stackTraceLimit = stackTraceLimit
1314+
;(Error as ErrorWithStackTraceLimit).stackTraceLimit = stackTraceLimit
13141315
}
13151316
}

packages/effect/src/unstable/http/FetchHttpClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class RequestInit extends ServiceMap.Service<RequestInit, globalThis.Requ
2929
const fetch: HttpClient.HttpClient = HttpClient.make((request, url, signal, fiber) => {
3030
const fetch = fiber.getRef(Fetch)
3131
const options: globalThis.RequestInit = fiber.services.mapUnsafe.get(RequestInit.key) ?? {}
32+
// @ts-ignore
3233
const headers = options.headers ? Headers.merge(Headers.fromInput(options.headers), request.headers) : request.headers
3334
const send = (body: BodyInit | undefined) =>
3435
Effect.map(

packages/effect/src/unstable/workers/Transferable.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,6 @@ export const MessagePort: Transferable<Schema.declare<MessagePort>> = schema(
154154
*/
155155
export const Uint8Array: Transferable<Schema.Uint8Array> = schema(
156156
Schema.Uint8Array,
157+
// @ts-ignore
157158
(_) => [_.buffer]
158159
)

packages/platform-deno/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Effectful Technologies Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/platform-deno/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# `@effect/platform-deno`
2+
3+
Provides Deno-specific implementations for the abstractions defined in [`@effect/platform`](https://github.com/Effect-TS/effect/tree/main/packages/platform), allowing you to write platform-independent code that runs smoothly in Deno environments.
4+
5+
## Documentation
6+
7+
- **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/platform-deno).

packages/platform-deno/docgen.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "../../node_modules/@effect/docgen/schema.json",
3+
"srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform-deno/src/",
4+
"exclude": ["src/internal/**/*.ts"],
5+
"examplesCompilerOptions": {
6+
"noEmit": true,
7+
"strict": true,
8+
"skipLibCheck": true,
9+
"moduleResolution": "NodeNext",
10+
"module": "ES2022",
11+
"target": "ES2022",
12+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
13+
"rewriteRelativeImportExtensions": true,
14+
"allowImportingTsExtensions": true
15+
}
16+
}

0 commit comments

Comments
 (0)