functionalscript 0.0.318 → 0.0.319
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/index.js +1 -1
- package/commonjs/path/index.js +4 -5
- package/commonjs/path/test.js +11 -11
- package/package.json +1 -1
package/commonjs/build/index.js
CHANGED
|
@@ -37,7 +37,7 @@ const getOrBuild = compile => packageGet => moduleMapInterface => {
|
|
|
37
37
|
/** @typedef {typeof moduleMapInterface extends module_.MapInterface<infer M> ? M : never} M */
|
|
38
38
|
/** @type {(moduleId: module_.Id) => function_.Require<[map.Map<string>, M]>} */
|
|
39
39
|
const req = moduleId => p => prior => {
|
|
40
|
-
const r = path.parseAndFind(packageGet)(moduleId
|
|
40
|
+
const r = path.parseAndFind(packageGet)(moduleId)(p)
|
|
41
41
|
if (r === undefined) { return [['error', 'file not found'], prior] }
|
|
42
42
|
const requireMap = map.set(p)(module_.idToString(moduleId))(prior[0])
|
|
43
43
|
r
|
package/commonjs/path/index.js
CHANGED
|
@@ -132,16 +132,15 @@ const parse = packageId => dependencies => local => path => {
|
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* @type {(packageGet: package_.Get) =>
|
|
135
|
-
* (
|
|
136
|
-
* (local: string) =>
|
|
135
|
+
* (moduleId: module_.Id) =>
|
|
137
136
|
* (path: string) =>
|
|
138
137
|
* Result
|
|
139
138
|
* }
|
|
140
139
|
*/
|
|
141
|
-
const parseAndFind = packageGet =>
|
|
142
|
-
const currentPack = packageGet(
|
|
140
|
+
const parseAndFind = packageGet => moduleId => path => {
|
|
141
|
+
const currentPack = packageGet(moduleId.package)
|
|
143
142
|
if (currentPack === undefined) { return undefined }
|
|
144
|
-
const p = parse(
|
|
143
|
+
const p = parse(moduleId.package)(currentPack.dependency)(moduleId.path.join('/'))(path)
|
|
145
144
|
if (p === undefined) { return undefined }
|
|
146
145
|
const pack = packageGet(p.package)
|
|
147
146
|
if (pack === undefined) { return undefined }
|
package/commonjs/path/test.js
CHANGED
|
@@ -84,7 +84,7 @@ const stringify = g => {
|
|
|
84
84
|
file: path => at(path)({ 'a/c': 'return "a/c"' }),
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))(''
|
|
87
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: ['a', 'b']})('../c'))
|
|
88
88
|
if (result !== '{"id":{"package":"","path":["a","c"]},"source":"return \\"a/c\\""}') { throw result }
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -108,33 +108,33 @@ const stringify = g => {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
{
|
|
111
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))(''
|
|
111
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: ['a', 'b']})('z/a/c'))
|
|
112
112
|
if (result !== '{"id":{"package":"node_modules/z","path":["a","c","index.js"]},"source":"return \\"a/c\\""}') {
|
|
113
113
|
throw result
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
{
|
|
117
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))(''
|
|
117
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: ['a', 'b']})('../..'))
|
|
118
118
|
if (result !== '{"id":{"package":"","path":["index.js"]},"source":"return \\"index.js\\""}') { throw result }
|
|
119
119
|
}
|
|
120
120
|
{
|
|
121
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))('')('
|
|
121
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: []})('./x'))
|
|
122
122
|
if (result !== '{"id":{"package":"","path":["x.js"]},"source":"return \\"x.js\\""}') { throw result }
|
|
123
123
|
}
|
|
124
124
|
{
|
|
125
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))('')('
|
|
125
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: []})('./x.js'))
|
|
126
126
|
if (result !== '{"id":{"package":"","path":["x.js"]},"source":"return \\"x.js\\""}') { throw result }
|
|
127
127
|
}
|
|
128
128
|
{
|
|
129
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))('')('
|
|
129
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: []})('./x/'))
|
|
130
130
|
if (result !== '{"id":{"package":"","path":["x","index.js"]},"source":"return \\"x/index.js\\""}') { throw result }
|
|
131
131
|
}
|
|
132
132
|
{
|
|
133
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))(''
|
|
133
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: ['x', 'a']})('../'))
|
|
134
134
|
if (result !== '{"id":{"package":"","path":["x","index.js"]},"source":"return \\"x/index.js\\""}') { throw result }
|
|
135
135
|
}
|
|
136
136
|
{
|
|
137
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))(''
|
|
137
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: ['x', 'a']})('..'))
|
|
138
138
|
if (result !== '{"id":{"package":"","path":["x","index.js"]},"source":"return \\"x/index.js\\""}') { throw result }
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -158,11 +158,11 @@ const stringify = g => {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
{
|
|
161
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))(''
|
|
161
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: ['a', 'b']})('z/a/c'))
|
|
162
162
|
if (result !== '{"id":{"package":"node_modules/z/a","path":["c.js"]},"source":"return \\"c.js\\""}') { throw result }
|
|
163
163
|
}
|
|
164
164
|
{
|
|
165
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))(''
|
|
165
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({ package: '', path: ['a', 'b']})('z/a/c/'))
|
|
166
166
|
if (result !== '{"id":{"package":"node_modules/z/a","path":["c","index.js"]},"source":"return \\"c/index.js\\""}') { throw result }
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -186,6 +186,6 @@ const stringify = g => {
|
|
|
186
186
|
}),
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
const result = stringify(_.parseAndFind(p => at(p)(packages))(''
|
|
189
|
+
const result = stringify(_.parseAndFind(p => at(p)(packages))({package: '', path: ['a', 'b']})('z/a/c'))
|
|
190
190
|
if (result !== '{"id":{"package":"node_modules/z/a/c","path":["index.js"]},"source":"return \\"a/c\\""}') { throw result }
|
|
191
191
|
}
|