sendscript 0.1.3 → 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 CHANGED
@@ -4,8 +4,15 @@ 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
+
7
12
  #### [v0.1.3](https://github.com/bas080/sendscript/compare/v0.1.2...v0.1.3)
8
13
 
14
+ > 21 January 2024
15
+
9
16
  - Remove the d.ts file gen step [`801b2cf`](https://github.com/bas080/sendscript/commit/801b2cf3b38259455186d4df85d98a42c046287c)
10
17
 
11
18
  #### [v0.1.2](https://github.com/bas080/sendscript/compare/v0.1.1...v0.1.2)
package/README.md CHANGED
@@ -230,19 +230,19 @@ npm t -- report text-summary
230
230
  ```
231
231
  ```
232
232
 
233
- > sendscript@0.1.3 test
233
+ > sendscript@0.1.4 test
234
234
  > tap -R silent
235
235
 
236
236
 
237
- > sendscript@0.1.3 test
237
+ > sendscript@0.1.4 test
238
238
  > tap report text-summary
239
239
 
240
240
 
241
241
  =============================== Coverage summary ===============================
242
- Statements : 100% ( 98/98 )
243
- Branches : 100% ( 30/30 )
242
+ Statements : 100% ( 110/110 )
243
+ Branches : 100% ( 32/32 )
244
244
  Functions : 100% ( 10/10 )
245
- Lines : 100% ( 98/98 )
245
+ Lines : 100% ( 110/110 )
246
246
  ================================================================================
247
247
  ```
248
248
 
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
@@ -38,5 +38,9 @@ test('should evaluate basic expressions correctly', async (t) => {
38
38
  [1, 2, 3]
39
39
  )
40
40
 
41
+ t.rejects(async () => {
42
+ await evaluate(['ref', 'doesNotExist'])
43
+ })
44
+
41
45
  t.end()
42
46
  })
package/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import api from './api.mjs'
2
+ import exec from './exec.mjs'
3
+
4
+ export default { api, exec }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sendscript",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Blur the line between server and client code.",
5
5
  "module": true,
6
6
  "main": "index.mjs",