functionalscript 0.0.321 → 0.0.325
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 +31 -17
- package/package.json +1 -1
package/commonjs/build/test.js
CHANGED
|
@@ -10,13 +10,13 @@ const compileMap = {
|
|
|
10
10
|
':index.js': [
|
|
11
11
|
'ok',
|
|
12
12
|
require_ => m0 => {
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
return [['ok', ':index.js'],
|
|
13
|
+
let [r, m] = require_('./b')(m0);
|
|
14
|
+
if (r[0] === 'error') { throw r }
|
|
15
|
+
[r, m] = require_('./a/')(m);
|
|
16
|
+
if (r[0] === 'error') { throw r }
|
|
17
|
+
[r, m] = require_('x/r')(m);
|
|
18
|
+
if (r[0] === 'error') { throw r }
|
|
19
|
+
return [['ok', ':index.js'], m]
|
|
20
20
|
}],
|
|
21
21
|
':b.js': [
|
|
22
22
|
'ok',
|
|
@@ -32,11 +32,13 @@ const compileMap = {
|
|
|
32
32
|
/** @type {function_.Compile} */
|
|
33
33
|
const compile = source => compileMap[source] ?? ['error', 'invalid source']
|
|
34
34
|
|
|
35
|
-
/** @
|
|
35
|
+
/** @typedef {{ readonly [k in string]?: string }} StringMap */
|
|
36
|
+
|
|
37
|
+
/** @type {{ readonly [k in string]?: { readonly dependencies: StringMap, files: StringMap }}} */
|
|
36
38
|
const packageMap = {
|
|
37
39
|
'': {
|
|
38
40
|
dependencies: {
|
|
39
|
-
'x': 'x'
|
|
41
|
+
'x': '/node_modules/x'
|
|
40
42
|
},
|
|
41
43
|
files: {
|
|
42
44
|
'index.js': ':index.js',
|
|
@@ -44,7 +46,7 @@ const packageMap = {
|
|
|
44
46
|
'a/index.js': ':a/index.js',
|
|
45
47
|
}
|
|
46
48
|
},
|
|
47
|
-
'x': {
|
|
49
|
+
'/node_modules/x': {
|
|
48
50
|
dependencies: {},
|
|
49
51
|
files: {
|
|
50
52
|
'r.js': 'x:r.js'
|
|
@@ -55,11 +57,11 @@ const packageMap = {
|
|
|
55
57
|
/** @type {package_.Get} */
|
|
56
58
|
const packageGet = packageId => {
|
|
57
59
|
const p = packageMap[packageId]
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
return p === undefined ? undefined :
|
|
61
|
+
{
|
|
62
|
+
dependency: dependency => p.dependencies[dependency],
|
|
63
|
+
file: file => p.files[file]
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
const getOrBuild = _.getOrBuild
|
|
@@ -68,9 +70,21 @@ const getOrBuild = _.getOrBuild
|
|
|
68
70
|
(/** @type {module_.MapInterface<map.Map<module_.State>>} */(map))
|
|
69
71
|
|
|
70
72
|
{
|
|
71
|
-
|
|
73
|
+
let [r, m] = getOrBuild({ package: '', path: ['index.js'] })(undefined)
|
|
74
|
+
if (JSON.stringify(r) !==
|
|
75
|
+
'["ok",{"exports":":index.js","requireMap":{"./a/":"/a/index.js","./b":"/b.js","x/r":"/node_modules/x/r.js"}}]'
|
|
76
|
+
) {
|
|
77
|
+
throw r
|
|
78
|
+
}
|
|
79
|
+
[r, m] = getOrBuild({ package: '', path: ['b.js'] })(m)
|
|
80
|
+
if (JSON.stringify(r) !==
|
|
81
|
+
'["ok",{"exports":":b.js","requireMap":{}}]'
|
|
82
|
+
) {
|
|
83
|
+
throw r
|
|
84
|
+
}
|
|
85
|
+
[r, m] = getOrBuild({ package: '', path: ['c.js']})(m)
|
|
72
86
|
if (JSON.stringify(r) !==
|
|
73
|
-
'["
|
|
87
|
+
'["error",["file not found"]]'
|
|
74
88
|
) {
|
|
75
89
|
throw r
|
|
76
90
|
}
|