functionalscript 0.0.320 → 0.0.321

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.
@@ -14,30 +14,42 @@ const compileMap = {
14
14
  if (r1[0] === 'error') { throw r1 }
15
15
  const [r2, m2] = require_('./a/')(m1);
16
16
  if (r2[0] === 'error') { throw r2 }
17
- return [['ok', ':index.js'], m2]
17
+ const [r3, m3] = require_('x/r')(m2);
18
+ if (r3[0] === 'error') { throw r3 }
19
+ return [['ok', ':index.js'], m3]
18
20
  }],
19
21
  ':b.js': [
20
22
  'ok',
21
- () => m0 => {
22
- return [['ok', ':b.js'], m0]
23
- }],
23
+ () => m0 => [['ok', ':b.js'], m0]],
24
24
  ':a/index.js': [
25
25
  'ok',
26
- () => m0 => {
27
- return [['ok', ':a/index.js'], m0]
28
- }]
26
+ () => m0 => [['ok', ':a/index.js'], m0]],
27
+ 'x:r.js': [
28
+ 'ok',
29
+ () => m0 => [['ok', 'x:r.js'], m0]],
29
30
  }
30
31
 
31
32
  /** @type {function_.Compile} */
32
33
  const compile = source => compileMap[source] ?? ['error', 'invalid source']
33
34
 
34
- /** @type {{ readonly [k in string]?: { readonly [k in string]?: string } }} */
35
+ /** @type {{ readonly [k in string]?: { readonly dependencies: { readonly [k in string]?: string }, files:{ readonly [k in string]?: string } }}} */
35
36
  const packageMap = {
36
37
  '': {
37
- 'index.js': ':index.js',
38
- 'b.js': ':b.js',
39
- 'a/index.js': ':a/index.js',
40
- }
38
+ dependencies: {
39
+ 'x': 'x'
40
+ },
41
+ files: {
42
+ 'index.js': ':index.js',
43
+ 'b.js': ':b.js',
44
+ 'a/index.js': ':a/index.js',
45
+ }
46
+ },
47
+ 'x': {
48
+ dependencies: {},
49
+ files: {
50
+ 'r.js': 'x:r.js'
51
+ }
52
+ },
41
53
  }
42
54
 
43
55
  /** @type {package_.Get} */
@@ -45,8 +57,8 @@ const packageGet = packageId => {
45
57
  const p = packageMap[packageId]
46
58
  if (p === undefined) { return undefined }
47
59
  return {
48
- dependency: () => undefined,
49
- file: file => p[file]
60
+ dependency: dependency => p.dependencies[dependency],
61
+ file: file => p.files[file]
50
62
  }
51
63
  }
52
64
 
@@ -58,7 +70,7 @@ const getOrBuild = _.getOrBuild
58
70
  {
59
71
  const [r] = getOrBuild({ package: '', path: ['index.js'] })(undefined)
60
72
  if (JSON.stringify(r) !==
61
- '["ok",{"exports":":index.js","requireMap":{"./a/":"/a/index.js","./b":"/b.js"}}]'
73
+ '["ok",{"exports":":index.js","requireMap":{"./a/":"/a/index.js","./b":"/b.js","x/r":"x/r.js"}}]'
62
74
  ) {
63
75
  throw r
64
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.320",
3
+ "version": "0.0.321",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "index.js",
6
6
  "scripts": {