functionalscript 0.0.277 → 0.0.278

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.
@@ -4,7 +4,7 @@ const function_ = require('../module/function')
4
4
  const { todo } = require('../../dev')
5
5
  const map = require('../../types/map')
6
6
  const object = require('../../types/object')
7
- const list = require('../../types/list')
7
+ const path = require('../path')
8
8
 
9
9
  /**
10
10
  * @template M
@@ -47,8 +47,32 @@ const getOrBuild = packageGet => moduleMapInterface => compile => moduleId => {
47
47
  }
48
48
 
49
49
  /** @type {function_.Require<readonly[M, map.Map<string>]>} */
50
- const require_ = path => ([moduleMap, requireMap]) => {
51
- return todo()
50
+ const require_ = pathStr => prior => {
51
+ const pathResult = path.parseAndFind(packageGet)(moduleId.packageId)(moduleIdStr)(pathStr)
52
+ if (pathResult === undefined) { return [['error', `file not found: '${pathStr}'`], prior] }
53
+ const mId = { packageId: pathResult.package, path: pathResult.file.split('/') }
54
+ const [state, newMap] = getOrBuild
55
+ (packageGet)
56
+ (moduleMapInterface)
57
+ (compile)
58
+ (mId)
59
+ (prior[0])
60
+ switch (state[0]) {
61
+ case 'ok': {
62
+ const newRequireMap = map.set(pathStr)(module_.idToString(mId))(prior[1])
63
+ return [
64
+ ['ok', state[1].exports],
65
+ [newMap, newRequireMap]
66
+ ]
67
+ }
68
+ case 'building': {
69
+ return todo()
70
+ }
71
+ // 'ok'
72
+ default: {
73
+ return todo()
74
+ }
75
+ }
52
76
  }
53
77
 
54
78
  return moduleMapFirst => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.277",
3
+ "version": "0.0.278",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "index.js",
6
6
  "scripts": {