Skip to content

Commit 8972788

Browse files
committed
feat: deno platform
1 parent c8a844b commit 8972788

30 files changed

+1140
-22
lines changed

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"typescript.enablePromptUseWorkspaceTsdk": true,
66
"editor.formatOnSave": true,
77
"editor.defaultFormatter": "dprint.dprint",
8+
"[markdown][javascript][javascriptreact][typescript][typescriptreact]": {
9+
"editor.defaultFormatter": "dprint.dprint"
10+
},
811
"editor.formatOnSaveMode": "file",
912
"editor.codeActionsOnSave": {
1013
"source.fixAll.oxc": "explicit"
@@ -23,5 +26,7 @@
2326
"editor.suggestSelection": "recentlyUsed",
2427
"editor.wordBasedSuggestions": "matchingDocuments",
2528
"editor.parameterHints.enabled": true,
26-
"files.insertFinalNewline": true
29+
"files.insertFinalNewline": true,
30+
"deno.enable": true,
31+
"deno.lint": false
2732
}

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",

packages/effect/src/internal/effect.ts

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

1112-
const prevLimit = globalThis.Error.stackTraceLimit
1113-
globalThis.Error.stackTraceLimit = 2
1112+
const prevLimit = (globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit
1113+
;(globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit = 2
11141114
const defError = new globalThis.Error()
1115-
globalThis.Error.stackTraceLimit = prevLimit
1115+
;(globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit = prevLimit
11161116

11171117
if (nameFirst) {
11181118
return (body: Function, ...pipeables: Array<Function>) =>
@@ -1148,10 +1148,10 @@ const makeFn = (
11481148
if (!isEffect(result)) {
11491149
return result
11501150
}
1151-
const prevLimit = globalThis.Error.stackTraceLimit
1152-
globalThis.Error.stackTraceLimit = 2
1151+
const prevLimit = (globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit
1152+
;(globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit = 2
11531153
const callError = new globalThis.Error()
1154-
globalThis.Error.stackTraceLimit = prevLimit
1154+
;(globalThis.Error as ErrorWithStackTraceLimit).stackTraceLimit = prevLimit
11551155
return updateService(
11561156
addSpan ?
11571157
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"
@@ -1302,11 +1303,11 @@ function filter(obj: any) {
13021303
*/
13031304
export const unsafeSecureJsonParse = (text: string): unknown => {
13041305
// Performance optimization, see https://github.com/fastify/secure-json-parse/pull/90
1305-
const { stackTraceLimit } = Error
1306-
Error.stackTraceLimit = 0
1306+
const { stackTraceLimit } = Error as ErrorWithStackTraceLimit
1307+
;(Error as ErrorWithStackTraceLimit).stackTraceLimit = 0
13071308
try {
13081309
return _parse(text)
13091310
} finally {
1310-
Error.stackTraceLimit = stackTraceLimit
1311+
;(Error as ErrorWithStackTraceLimit).stackTraceLimit = stackTraceLimit
13111312
}
13121313
}

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
@@ -153,5 +153,6 @@ export const MessagePort: Transferable<Schema.declare<MessagePort>> = schema(
153153
*/
154154
export const Uint8Array: Transferable<Schema.Uint8Array> = schema(
155155
Schema.Uint8Array,
156+
// @ts-ignore
156157
(_) => [_.buffer]
157158
)

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+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"name": "@effect/platform-deno",
3+
"type": "module",
4+
"version": "0.77.6",
5+
"license": "MIT",
6+
"description": "Platform specific implementations for the Deno runtime",
7+
"homepage": "https://effect.website",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/Effect-TS/effect-smol.git",
11+
"directory": "packages/platform-deno"
12+
},
13+
"bugs": {
14+
"url": "https://github.com/Effect-TS/effect-smol/issues"
15+
},
16+
"tags": [
17+
"deno",
18+
"typescript",
19+
"algebraic-data-types",
20+
"functional-programming"
21+
],
22+
"keywords": [
23+
"deno",
24+
"typescript",
25+
"algebraic-data-types",
26+
"functional-programming"
27+
],
28+
"engines": {
29+
"deno": ">=2.5.0"
30+
},
31+
"sideEffects": [],
32+
"exports": {
33+
"./package.json": "./package.json",
34+
".": "./src/index.ts",
35+
"./*": "./src/*.ts",
36+
"./internal/*": null,
37+
"./*/index": null
38+
},
39+
"files": [
40+
"src/**/*.ts",
41+
"dist/**/*.js",
42+
"dist/**/*.js.map",
43+
"dist/**/*.d.ts",
44+
"dist/**/*.d.ts.map"
45+
],
46+
"publishConfig": {
47+
"provenance": true,
48+
"exports": {
49+
"./package.json": "./package.json",
50+
".": "./dist/index.js",
51+
"./*": "./dist/*.js",
52+
"./internal/*": null,
53+
"./*/index": null
54+
}
55+
},
56+
"scripts": {
57+
"codegen": "build-utils prepare-v4",
58+
"build": "tsc -b tsconfig.build.json && babel dist --plugins annotate-pure-calls --out-dir dist --source-maps",
59+
"check": "deno check",
60+
"test": "vitest",
61+
"coverage": "vitest --coverage"
62+
},
63+
"dependencies": {
64+
"@std/path": "jsr:^1.1.4"
65+
},
66+
"peerDependencies": {
67+
"effect": "workspace:^"
68+
},
69+
"devDependencies": {
70+
"@std/assert": "jsr:^1.0.16",
71+
"effect": "workspace:^"
72+
}
73+
}

0 commit comments

Comments
 (0)