Skip to content
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

Add support for node.js environment #33

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
.vscode/

node_modules/
node_modules/
./dist
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
"description": "Natural 🌿 effect system that fits TypeScript",
"type": "module",
"exports": {
".": "./src/index.ts",
"./core": "./src/index.ts",
"./runners": "./src/runners.ts",
"./assistant": "./src/assistants.ts",
"./exception": "./src/exception.ts",
"./env": "./src/env.ts",
"./state": "./src/state.ts",
"./log": "./src/log.ts",
"./async-task": "./src/async-task.ts",
"./monad": "./src/monad.ts",
"./with-handler": "./src/with-handler.ts"
".": "./dist/index.js",
"./core": "./dist/index.js",
"./runners": "./dist/runners.js",
"./assistant": "./dist/assistants.js",
"./exception": "./dist/exception.js",
"./env": "./dist/env.js",
"./state": "./dist/state.js",
"./log": "./dist/log.js",
"./async-task": "./dist/async-task.js",
"./monad": "./dist/monad.js",
"./with-handler": "./dist/with-handler.js"
},
"sideEffects": false,
"scripts": {
"typecheck": "tsc",
"prepare": "npm run typecheck"
"build": "tsc",
"prepare": "npm run build"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/assistants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Eq, Unreachable } from './utils';
import { Effects, Handlers, NameOfEffect, ExcludeHandledEffects, UsedEffectsInHandlers, Effectful } from './core';
import { Eq, Unreachable } from './utils.js';
import { Effects, Handlers, NameOfEffect, ExcludeHandledEffects, UsedEffectsInHandlers, Effectful } from './core.js';

/**
* Type constructor constructing message representing type
Expand Down
4 changes: 2 additions & 2 deletions src/async-task.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Effect, Effectful, HandleTactics, createPrimitive } from './core';
import { unsafeRunAsync } from './runners';
import { Effect, Effectful, HandleTactics, createPrimitive } from './core.js';
import { unsafeRunAsync } from './runners.js';

/**
* Effect for computations rely on asynchronous tasks
Expand Down
2 changes: 1 addition & 1 deletion src/core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Eq, UnionToIntersection, Delay, Simplify, isGenerator, Unreachable, withName } from './utils';
import { Eq, UnionToIntersection, Delay, Simplify, isGenerator, Unreachable, withName } from './utils.js';

/**
* Constructor for types of values representing code
Expand Down
2 changes: 1 addition & 1 deletion src/exception.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createPrimitives, Effect, Handlers } from './core';
import { createPrimitives, Effect, Handlers } from './core.js';

/**
* Effect spec template for exception effects (similar to 'Either' or 'Result' monads)
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* @packageDocumentation
*/

export { Effect, Effects, createPrimitives, Effectful, HandleTactics, Handlers, handle, run } from './core'
export { Effect, Effects, createPrimitives, Effectful, HandleTactics, Handlers, handle, run } from './core.js'
2 changes: 1 addition & 1 deletion src/monad.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Effectful } from './core';
import { Effectful } from './core.js';

/**
* Applies function to result of a computation
Expand Down
6 changes: 3 additions & 3 deletions src/runners.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Effects, Code, HandleTactics, handle, run, Effectful, HandleError } from './core';
import { Eq, Simplify, UnionToIntersection } from './utils';
import { Effects, Code, HandleTactics, handle, run, Effectful, HandleError } from './core.js';
import { Eq, Simplify, UnionToIntersection } from './utils.js';

export { run } from './core'
export { run } from './core.js'

/**
* Constructs type for handlers used at top level
Expand Down
2 changes: 1 addition & 1 deletion src/with-handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Effectful, Effects, ExcludeHandledEffects, handle, Handlers, UsedEffectsInHandlers } from './core'
import { Effectful, Effects, ExcludeHandledEffects, handle, Handlers, UsedEffectsInHandlers } from './core.js'

/**
* Wraps function with given handlers
Expand Down
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"compilerOptions": {
"target": "ES2020",
"moduleResolution": "bundler",
"noEmit": true,
"module": "ESNext",
"moduleResolution": "nodenext",
"outDir": "./dist",
"declaration": true,
"declarationMap": true,
"exactOptionalPropertyTypes": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
Expand Down