-
-
Notifications
You must be signed in to change notification settings - Fork 31
feat: deno platform #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lishaduck
wants to merge
1
commit into
Effect-TS:main
Choose a base branch
from
lishaduck:platform-deno
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: deno platform #859
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Effectful Technologies Inc | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # `@effect/platform-deno` | ||
|
|
||
| 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. | ||
|
|
||
| ## Documentation | ||
|
|
||
| - **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/platform-deno). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "$schema": "../../node_modules/@effect/docgen/schema.json", | ||
| "srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/platform-deno/src/", | ||
| "exclude": ["src/internal/**/*.ts"], | ||
| "examplesCompilerOptions": { | ||
| "noEmit": true, | ||
| "strict": true, | ||
| "skipLibCheck": true, | ||
| "moduleResolution": "NodeNext", | ||
| "module": "NodeNext", | ||
| "target": "ES2022", | ||
| "lib": ["ES2022", "DOM", "DOM.Iterable"], | ||
| "rewriteRelativeImportExtensions": true, | ||
| "allowImportingTsExtensions": true, | ||
| "paths": { | ||
| "effect": ["../../../effect/src/index.js"], | ||
| "effect/*": ["../../../effect/src/*.js"] | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| { | ||
| "name": "@effect/platform-deno", | ||
| "type": "module", | ||
| "version": "0.77.6", | ||
| "license": "MIT", | ||
| "description": "Platform specific implementations for the Deno runtime", | ||
| "homepage": "https://effect.website", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/Effect-TS/effect-smol.git", | ||
| "directory": "packages/platform-deno" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/Effect-TS/effect-smol/issues" | ||
| }, | ||
| "tags": [ | ||
| "deno", | ||
| "typescript", | ||
| "algebraic-data-types", | ||
| "functional-programming" | ||
| ], | ||
| "keywords": [ | ||
| "deno", | ||
| "typescript", | ||
| "algebraic-data-types", | ||
| "functional-programming" | ||
| ], | ||
| "engines": { | ||
| "deno": ">=2.5.0" | ||
| }, | ||
| "sideEffects": [], | ||
| "exports": { | ||
| "./package.json": "./package.json", | ||
| ".": "./src/index.ts", | ||
| "./*": "./src/*.ts", | ||
| "./internal/*": null, | ||
| "./*/index": null | ||
| }, | ||
| "files": [ | ||
| "src/**/*.ts", | ||
| "dist/**/*.js", | ||
| "dist/**/*.js.map", | ||
| "dist/**/*.d.ts", | ||
| "dist/**/*.d.ts.map" | ||
| ], | ||
| "publishConfig": { | ||
| "provenance": true, | ||
| "exports": { | ||
| "./package.json": "./package.json", | ||
| ".": "./dist/index.js", | ||
| "./*": "./dist/*.js", | ||
| "./internal/*": null, | ||
| "./*/index": null | ||
| } | ||
| }, | ||
| "scripts": { | ||
| "codegen": "build-utils prepare-v4", | ||
| "build": "tsc -b tsconfig.build.json && babel dist --plugins annotate-pure-calls --out-dir dist --source-maps", | ||
| "check": "deno check", | ||
| "test": "vitest", | ||
| "coverage": "vitest --coverage" | ||
| }, | ||
| "dependencies": { | ||
| "@std/path": "jsr:^1.1.4" | ||
| }, | ||
| "peerDependencies": { | ||
| "effect": "workspace:^" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/deno": "^2.5.0", | ||
| "@std/assert": "jsr:^1.0.16", | ||
| "effect": "workspace:^" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /** | ||
| * This module exposes database primitives. | ||
| * @module | ||
| * | ||
| * @since 1.0.0 | ||
| */ | ||
|
|
||
| import * as Layer from "effect/Layer" | ||
| import * as KeyValueStore from "effect/unstable/persistence/KeyValueStore" | ||
| import { makeKvStore } from "./internal/kv.ts" | ||
|
|
||
| /** | ||
| * Creates a {@linkcode KeyValueStore} layer that uses the Web-native {@linkcode localStorage} API. | ||
| * | ||
| * Values are stored between sessions. | ||
| * | ||
| * @since 1.0.0 | ||
| * @category layer | ||
| */ | ||
| export const layerLocalStorage: Layer.Layer<KeyValueStore.KeyValueStore> = KeyValueStore.layerStorage(() => | ||
| localStorage | ||
| ) | ||
|
|
||
| /** | ||
| * Creates a {@linkcode KeyValueStore} layer that uses the Web-native {@linkcode sessionStorage} API. | ||
| * | ||
| * Values are stored only for the current session. | ||
| * | ||
| * @since 1.0.0 | ||
| * @category layer | ||
| */ | ||
| export const layerSessionStorage: Layer.Layer<KeyValueStore.KeyValueStore> = KeyValueStore.layerStorage(() => | ||
| sessionStorage | ||
| ) | ||
|
|
||
| /** | ||
| * Creates a {@linkcode KeyValueStore} layer that uses Deno’s cloud-native {@linkcode Deno.Kv} API. | ||
| * | ||
| * @remarks | ||
| * This does not support gradual adoption, | ||
| * and will fail semi-gracefully on non-`string` or {@linkcode Uint8Array} values. | ||
| * kvStore | ||
| * @since 1.0.0 | ||
| * @category layer | ||
| */ | ||
| export const layerKv: Layer.Layer<KeyValueStore.KeyValueStore> = Layer.effect( | ||
| KeyValueStore.KeyValueStore | ||
| )( | ||
| makeKvStore() | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This shouldn't really be necessary but just in case)
This code was originally released as
jsr:@lishaduck/effect-platform-denounder the Universal Permissive License v1.0, and was extensively based on the MIT-licensed@effect/platform-browser&@effect/platform-node-shared. I am the sole copyright holder (@pixeleet's single contribution was legally trivial), and I explicitly grant permission to relicense this code under the MIT License for use in this repository and its derivatives.