sendscript 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +9 -12
- package/README.mz +4 -7
- package/exec.mjs +12 -0
- package/exec.test.mjs +4 -0
- package/index.mjs +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v0.1.4](https://github.com/bas080/sendscript/compare/v0.1.3...v0.1.4)
|
|
8
|
+
|
|
9
|
+
- Add missing index file that exports both modules [`38054ea`](https://github.com/bas080/sendscript/commit/38054ea8284a1626146bec42309b3c014527ff7d)
|
|
10
|
+
- Prevent ref of non existant property on env object [`49520ad`](https://github.com/bas080/sendscript/commit/49520ad32604683c668d95e479de772a91f6ae2b)
|
|
11
|
+
|
|
12
|
+
#### [v0.1.3](https://github.com/bas080/sendscript/compare/v0.1.2...v0.1.3)
|
|
13
|
+
|
|
14
|
+
> 21 January 2024
|
|
15
|
+
|
|
16
|
+
- Remove the d.ts file gen step [`801b2cf`](https://github.com/bas080/sendscript/commit/801b2cf3b38259455186d4df85d98a42c046287c)
|
|
17
|
+
|
|
7
18
|
#### [v0.1.2](https://github.com/bas080/sendscript/compare/v0.1.1...v0.1.2)
|
|
8
19
|
|
|
20
|
+
> 4 January 2024
|
|
21
|
+
|
|
9
22
|
- Update tap to 10.9.5 [`4e3ddcc`](https://github.com/bas080/sendscript/commit/4e3ddcca823ca64c52bc1966ac23a712480d6c4d)
|
|
10
23
|
|
|
11
24
|
#### [v0.1.1](https://github.com/bas080/sendscript/compare/v0.1.0...v0.1.1)
|
package/README.md
CHANGED
|
@@ -193,21 +193,18 @@ There is a good use-case to write an environment module in TypeScript.
|
|
|
193
193
|
coding.
|
|
194
194
|
2. You can use tools like [typedoc][typedoc] to generate docs from your types to
|
|
195
195
|
share with consumers of your API.
|
|
196
|
-
3. You can
|
|
197
|
-
|
|
196
|
+
3. You can use the types of the module to coerce your client to adopt the
|
|
197
|
+
modules type.
|
|
198
198
|
|
|
199
199
|
```bash
|
|
200
200
|
# Create pretty docs for your module.
|
|
201
201
|
npx typedoc my-module.ts
|
|
202
|
-
|
|
203
|
-
# Create the .d.ts file for your module.
|
|
204
|
-
tsc --declaration
|
|
205
202
|
```
|
|
206
203
|
|
|
207
|
-
Now we can use the `my-module.
|
|
204
|
+
Now we can use the `my-module.ts` file for the client API.
|
|
208
205
|
|
|
209
206
|
```ts
|
|
210
|
-
import type * as MyModule from './my-module
|
|
207
|
+
import type * as MyModule from './my-module'
|
|
211
208
|
|
|
212
209
|
import sendScriptApi from 'sendscript/api.mjs'
|
|
213
210
|
|
|
@@ -233,19 +230,19 @@ npm t -- report text-summary
|
|
|
233
230
|
```
|
|
234
231
|
```
|
|
235
232
|
|
|
236
|
-
> sendscript@0.1.
|
|
233
|
+
> sendscript@0.1.4 test
|
|
237
234
|
> tap -R silent
|
|
238
235
|
|
|
239
236
|
|
|
240
|
-
> sendscript@0.1.
|
|
237
|
+
> sendscript@0.1.4 test
|
|
241
238
|
> tap report text-summary
|
|
242
239
|
|
|
243
240
|
|
|
244
241
|
=============================== Coverage summary ===============================
|
|
245
|
-
Statements : 100% (
|
|
246
|
-
Branches : 100% (
|
|
242
|
+
Statements : 100% ( 110/110 )
|
|
243
|
+
Branches : 100% ( 32/32 )
|
|
247
244
|
Functions : 100% ( 10/10 )
|
|
248
|
-
Lines : 100% (
|
|
245
|
+
Lines : 100% ( 110/110 )
|
|
249
246
|
================================================================================
|
|
250
247
|
```
|
|
251
248
|
|
package/README.mz
CHANGED
|
@@ -174,21 +174,18 @@ There is a good use-case to write an environment module in TypeScript.
|
|
|
174
174
|
coding.
|
|
175
175
|
2. You can use tools like [typedoc][typedoc] to generate docs from your types to
|
|
176
176
|
share with consumers of your API.
|
|
177
|
-
3. You can
|
|
178
|
-
|
|
177
|
+
3. You can use the types of the module to coerce your client to adopt the
|
|
178
|
+
modules type.
|
|
179
179
|
|
|
180
180
|
```bash
|
|
181
181
|
# Create pretty docs for your module.
|
|
182
182
|
npx typedoc my-module.ts
|
|
183
|
-
|
|
184
|
-
# Create the .d.ts file for your module.
|
|
185
|
-
tsc --declaration
|
|
186
183
|
```
|
|
187
184
|
|
|
188
|
-
Now we can use the `my-module.
|
|
185
|
+
Now we can use the `my-module.ts` file for the client API.
|
|
189
186
|
|
|
190
187
|
```ts
|
|
191
|
-
import type * as MyModule from './my-module
|
|
188
|
+
import type * as MyModule from './my-module'
|
|
192
189
|
|
|
193
190
|
import sendScriptApi from 'sendscript/api.mjs'
|
|
194
191
|
|
package/exec.mjs
CHANGED
|
@@ -3,6 +3,9 @@ import curry from './curry.mjs'
|
|
|
3
3
|
|
|
4
4
|
const debug = _debug.extend('lisp')
|
|
5
5
|
|
|
6
|
+
class SendScriptError extends Error {};
|
|
7
|
+
class RefError extends SendScriptError {};
|
|
8
|
+
|
|
6
9
|
const exec = curry(async (env, expression) => {
|
|
7
10
|
debug('exec', expression)
|
|
8
11
|
|
|
@@ -22,10 +25,19 @@ const exec = curry(async (env, expression) => {
|
|
|
22
25
|
if (operator === 'ref') {
|
|
23
26
|
const [name] = args
|
|
24
27
|
|
|
28
|
+
if (!Object.hasOwn(env, name)) {
|
|
29
|
+
throw new RefError(expression)
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
return env[name]
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
return await Promise.all(expression.map(exec(env)))
|
|
29
36
|
})
|
|
30
37
|
|
|
38
|
+
export {
|
|
39
|
+
SendScriptError,
|
|
40
|
+
RefError
|
|
41
|
+
}
|
|
42
|
+
|
|
31
43
|
export default exec
|
package/exec.test.mjs
CHANGED
package/index.mjs
ADDED