functionalscript 0.0.320 → 0.0.324
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/commonjs/build/test.js +32 -18
- package/package.json +1 -1
package/commonjs/build/test.js
CHANGED
|
@@ -14,40 +14,54 @@ 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
|
-
|
|
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
|
-
|
|
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
|
-
/** @
|
|
35
|
+
/** @typedef {{ readonly [k in string]?: string }} StringMap */
|
|
36
|
+
|
|
37
|
+
/** @type {{ readonly [k in string]?: { readonly dependencies: StringMap, files: StringMap }}} */
|
|
35
38
|
const packageMap = {
|
|
36
39
|
'': {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
dependencies: {
|
|
41
|
+
'x': '/node_modules/x'
|
|
42
|
+
},
|
|
43
|
+
files: {
|
|
44
|
+
'index.js': ':index.js',
|
|
45
|
+
'b.js': ':b.js',
|
|
46
|
+
'a/index.js': ':a/index.js',
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
'/node_modules/x': {
|
|
50
|
+
dependencies: {},
|
|
51
|
+
files: {
|
|
52
|
+
'r.js': 'x:r.js'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
41
55
|
}
|
|
42
56
|
|
|
43
57
|
/** @type {package_.Get} */
|
|
44
58
|
const packageGet = packageId => {
|
|
45
59
|
const p = packageMap[packageId]
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
return p === undefined ? undefined :
|
|
61
|
+
{
|
|
62
|
+
dependency: dependency => p.dependencies[dependency],
|
|
63
|
+
file: file => p.files[file]
|
|
64
|
+
}
|
|
51
65
|
}
|
|
52
66
|
|
|
53
67
|
const getOrBuild = _.getOrBuild
|
|
@@ -58,7 +72,7 @@ const getOrBuild = _.getOrBuild
|
|
|
58
72
|
{
|
|
59
73
|
const [r] = getOrBuild({ package: '', path: ['index.js'] })(undefined)
|
|
60
74
|
if (JSON.stringify(r) !==
|
|
61
|
-
'["ok",{"exports":":index.js","requireMap":{"./a/":"/a/index.js","./b":"/b.js"}}]'
|
|
75
|
+
'["ok",{"exports":":index.js","requireMap":{"./a/":"/a/index.js","./b":"/b.js","x/r":"/node_modules/x/r.js"}}]'
|
|
62
76
|
) {
|
|
63
77
|
throw r
|
|
64
78
|
}
|