functionalscript 0.0.591 → 0.0.592

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/dev/module.mjs CHANGED
@@ -158,20 +158,24 @@ const folderMapAdd = m => s => {
158
158
 
159
159
  const indent = ' '
160
160
 
161
- /** @type {(i: string) => (p: string) => (m: FolderMap) => string} */
161
+ /** @type {(i: string) => (p: string) => (m: FolderMap) => readonly[string,string]} */
162
162
  const codeAdd = i => p => m => {
163
163
  let result = ''
164
+ let im = ''
164
165
  for (const [k, v] of Object.entries(m)) {
165
- const np = `${p}${k}/`
166
+ const np = `${p}${k}`
166
167
  if (typeof v === 'string') {
167
- result += `${i}${k}: require("${np}${v}"),\n`
168
+ result += `${i}${k}: ${np},\n`
169
+ im += `import ${np} from './${np.replaceAll('$', '/')}/${v}'\n`
168
170
  } else {
171
+ const [r, x] = codeAdd(i + indent)(`${np}\$`)(v)
169
172
  result += `${i}${k}: \{\n`
170
- result += codeAdd(i + indent)(np)(v)
173
+ result += r
171
174
  result += `${i}\},\n`
175
+ im += x
172
176
  }
173
177
  }
174
- return result
178
+ return [result, im]
175
179
  }
176
180
 
177
181
  export const index = async() => {
@@ -183,11 +187,12 @@ export const index = async() => {
183
187
  m = folderMapAdd(m)(s)
184
188
  }
185
189
  }
186
- console.log(m)
190
+ const [e, i] = codeAdd(indent)('')(m)
187
191
  let s =
188
192
  '// Generated file.\n' +
189
- 'module.exports = {\n'
190
- s += codeAdd(indent)('./')(m)
191
- s += '}\n'
192
- await writeFile('index.f.cjs', s)
193
+ i +
194
+ 'export default {\n' +
195
+ e +
196
+ '}\n'
197
+ await writeFile('index.f.mjs', s)
193
198
  }
package/index.f.mjs ADDED
@@ -0,0 +1,73 @@
1
+ // Generated file.
2
+ import com from './com/module.f.cjs'
3
+ import commonjs from './commonjs/module.f.cjs'
4
+ import dev from './dev/module.f.cjs'
5
+ import djs from './djs/module.f.cjs'
6
+ import fsc from './fsc/module.f.cjs'
7
+ import fsm from './fsm/module.f.cjs'
8
+ import html from './html/module.f.cjs'
9
+ import js$tokenizer from './js/tokenizer/module.f.cjs'
10
+ import json from './json/module.f.cjs'
11
+ import nodejs from './nodejs/module.f.cjs'
12
+ import prime_field from './prime_field/module.f.cjs'
13
+ import secp from './secp/module.f.cjs'
14
+ import sha2 from './sha2/module.f.cjs'
15
+ import text from './text/module.f.cjs'
16
+ import types$array from './types/array/module.f.cjs'
17
+ import types$bigfloat from './types/bigfloat/module.f.cjs'
18
+ import types$bigint from './types/bigint/module.f.cjs'
19
+ import types$btree from './types/btree/module.f.cjs'
20
+ import types$byte_set from './types/byte_set/module.f.cjs'
21
+ import types$function from './types/function/module.f.cjs'
22
+ import types$list from './types/list/module.f.cjs'
23
+ import types$map from './types/map/module.f.cjs'
24
+ import types$nibble_set from './types/nibble_set/module.f.cjs'
25
+ import types$nullable from './types/nullable/module.f.cjs'
26
+ import types$number from './types/number/module.f.cjs'
27
+ import types$object from './types/object/module.f.cjs'
28
+ import types$range from './types/range/module.f.cjs'
29
+ import types$range_map from './types/range_map/module.f.cjs'
30
+ import types$result from './types/result/module.f.cjs'
31
+ import types$sorted_list from './types/sorted_list/module.f.cjs'
32
+ import types$sorted_set from './types/sorted_set/module.f.cjs'
33
+ import types$string from './types/string/module.f.cjs'
34
+ import types$string_set from './types/string_set/module.f.cjs'
35
+ export default {
36
+ com: com,
37
+ commonjs: commonjs,
38
+ dev: dev,
39
+ djs: djs,
40
+ fsc: fsc,
41
+ fsm: fsm,
42
+ html: html,
43
+ js: {
44
+ tokenizer: js$tokenizer,
45
+ },
46
+ json: json,
47
+ nodejs: nodejs,
48
+ prime_field: prime_field,
49
+ secp: secp,
50
+ sha2: sha2,
51
+ text: text,
52
+ types: {
53
+ array: types$array,
54
+ bigfloat: types$bigfloat,
55
+ bigint: types$bigint,
56
+ btree: types$btree,
57
+ byte_set: types$byte_set,
58
+ function: types$function,
59
+ list: types$list,
60
+ map: types$map,
61
+ nibble_set: types$nibble_set,
62
+ nullable: types$nullable,
63
+ number: types$number,
64
+ object: types$object,
65
+ range: types$range,
66
+ range_map: types$range_map,
67
+ result: types$result,
68
+ sorted_list: types$sorted_list,
69
+ sorted_set: types$sorted_set,
70
+ string: types$string,
71
+ string_set: types$string_set,
72
+ },
73
+ }
package/jsr.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@functionalscript/functionalscript",
3
- "version": "0.0.591",
4
- "exports": "./index.f.cjs"
3
+ "version": "0.0.592",
4
+ "exports": "./index.f.mjs"
5
5
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.0.591",
3
+ "version": "0.0.592",
4
4
  "description": "FunctionalScript is a functional subset of JavaScript",
5
- "main": "index.f.cjs",
5
+ "main": "index.f.mjs",
6
6
  "scripts": {
7
7
  "tsc": "tsc",
8
8
  "test": "tsc && npm run test-only",
package/index.f.cjs DELETED
@@ -1,40 +0,0 @@
1
- // Generated file.
2
- module.exports = {
3
- com: require("./com/module.f.cjs"),
4
- commonjs: require("./commonjs/module.f.cjs"),
5
- dev: require("./dev/module.f.cjs"),
6
- djs: require("./djs/module.f.cjs"),
7
- fsc: require("./fsc/module.f.cjs"),
8
- fsm: require("./fsm/module.f.cjs"),
9
- html: require("./html/module.f.cjs"),
10
- js: {
11
- tokenizer: require("./js/tokenizer/module.f.cjs"),
12
- },
13
- json: require("./json/module.f.cjs"),
14
- nodejs: require("./nodejs/module.f.cjs"),
15
- prime_field: require("./prime_field/module.f.cjs"),
16
- secp: require("./secp/module.f.cjs"),
17
- sha2: require("./sha2/module.f.cjs"),
18
- text: require("./text/module.f.cjs"),
19
- types: {
20
- array: require("./types/array/module.f.cjs"),
21
- bigfloat: require("./types/bigfloat/module.f.cjs"),
22
- bigint: require("./types/bigint/module.f.cjs"),
23
- btree: require("./types/btree/module.f.cjs"),
24
- byte_set: require("./types/byte_set/module.f.cjs"),
25
- function: require("./types/function/module.f.cjs"),
26
- list: require("./types/list/module.f.cjs"),
27
- map: require("./types/map/module.f.cjs"),
28
- nibble_set: require("./types/nibble_set/module.f.cjs"),
29
- nullable: require("./types/nullable/module.f.cjs"),
30
- number: require("./types/number/module.f.cjs"),
31
- object: require("./types/object/module.f.cjs"),
32
- range: require("./types/range/module.f.cjs"),
33
- range_map: require("./types/range_map/module.f.cjs"),
34
- result: require("./types/result/module.f.cjs"),
35
- sorted_list: require("./types/sorted_list/module.f.cjs"),
36
- sorted_set: require("./types/sorted_set/module.f.cjs"),
37
- string: require("./types/string/module.f.cjs"),
38
- string_set: require("./types/string_set/module.f.cjs"),
39
- },
40
- }