functionalscript 0.0.355 → 0.0.356

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.
@@ -0,0 +1,17 @@
1
+ # Path
2
+
3
+ ## Simplified Common.js
4
+
5
+ A path should be disambiguous.
6
+
7
+ Path limitations:
8
+
9
+ - Accepted file extensions: `.f.js`, `.json`.
10
+ - A file path should be fully specified. For example `../package/dependencies/test.f.js`.
11
+ - A package name can't contain `/`. For example
12
+ - `functionalscript/main.f.js` is allowed.
13
+ - `functionalscript/functionalscript/main.f.js` is not allowed.
14
+
15
+ `package.json` limitations:
16
+
17
+ - Only GitHub packages can be referenced. In the future, we may add generic Git repositories.
@@ -98,11 +98,15 @@ const mapDependency = d => ([external, internal]) => {
98
98
  * (items: list.List<string>) =>
99
99
  * Path|undefined}
100
100
  */
101
- const parseGlobal = d => dir => items => {
102
- const v = variants([undefined, items])
103
- const r = list.first(undefined)(list.filterMap(mapDependency(d))(v))
104
- if (r === undefined) { return undefined }
105
- return { package: r[0], items: list.toArray(r[1]), dir }
101
+ const parseGlobal = dependencies =>
102
+ {
103
+ const filterMap = list.filterMap(mapDependency(dependencies))
104
+ return dir => items => {
105
+ const v = variants([undefined, items])
106
+ const r = list.first(undefined)(filterMap(v))
107
+ if (r === undefined) { return undefined }
108
+ return { package: r[0], items: list.toArray(r[1]), dir }
109
+ }
106
110
  }
107
111
 
108
112
  /**
@@ -112,12 +116,15 @@ const parseGlobal = d => dir => items => {
112
116
  * (path: string) =>
113
117
  * Path|undefined }
114
118
  */
115
- const parse = packageId => dependencies => local => path => {
116
- const parsed = parseLocal(local)(path)
117
- if (parsed === undefined) { return undefined }
118
- const {external, dir, items } = parsed
119
- if (!external) { return { package: packageId, items, dir } }
120
- return parseGlobal(dependencies)(dir)(items)
119
+ const parse = packageId => dependencies => {
120
+ const pg = parseGlobal(dependencies)
121
+ return local => path => {
122
+ const parsed = parseLocal(local)(path)
123
+ if (parsed === undefined) { return undefined }
124
+ const {external, dir, items } = parsed
125
+ if (!external) { return { package: packageId, items, dir } }
126
+ return pg(dir)(items)
127
+ }
121
128
  }
122
129
 
123
130
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.355",
3
+ "version": "0.0.356",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
5
  "main": "main.f.js",
6
6
  "scripts": {