Skip to content

Commit

Permalink
Merge pull request #72 from fink-lang/esm
Browse files Browse the repository at this point in the history
publish as esm, features
  • Loading branch information
kollhof authored Oct 6, 2020
2 parents 6d832dd + e474e61 commit 52a516e
Show file tree
Hide file tree
Showing 102 changed files with 1,160 additions and 926 deletions.
10 changes: 6 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@

module.exports = {
export default {
testEnvironment: 'node',
setupFiles: [],
moduleFileExtensions: ['js', 'fnk'],
transform: {
'^.+\\.fnk$': ['@fink/jest/transform']
'^.+\\.fnk$': ['@fink/jest/transform.js']
},
transformIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/build/'],

snapshotSerializers: ['<rootDir>/build/test-helpers/snapshot'],
snapshotResolver: '@fink/jest/snapshot-resolver',
resolver: '@fink/jest/cjs/module-resolver.js',

snapshotSerializers: ['<rootDir>/build/test-helpers/snapshot.js'],
snapshotResolver: '@fink/jest/snapshot-resolver.js',

modulePathIgnorePatterns: ['<rootDir>/build/'],

Expand Down
1 change: 1 addition & 0 deletions package-cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "commonjs"}
1,088 changes: 624 additions & 464 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 16 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"engines": {
"node": ">=14.0.0"
},
"type": "module",
"exports": {
"./": {
"import": "./",
"require": "./cjs/"
}
},
"private": false,
"publishConfig": {
"access": "public"
Expand All @@ -20,23 +27,25 @@
"clean": "rimraf ./build",
"build": "run build:*",
"build:dir": "mkdir -p ./build/pkg/",
"build:fnk": "fnk --src ./src --out-dir build/pkg --ignore './src/**/*.test.fnk'",
"build:fnk-esm": "fnk --module-type esm --src ./src --out-dir build/pkg --ignore './src/**/*.test.fnk'",
"build:fnk-cjs": "fnk --module-type cjs --src ./src --out-dir build/pkg/cjs --ignore './src/**/*.test.fnk'",
"build:files-cjs": "cp package-cjs.json ./build/pkg/cjs/package.json",
"build:files": "cp package.json ./README.md ./LICENSE ./build/pkg/",
"test": "run test:build-helpers jest",
"test:build-helpers": "fnk --src ./src/testing --out-dir build/test-helpers",
"test:build-helpers": "fnk --module-type cjs --src ./src/testing --out-dir build/test-helpers",
"jest": "jest --verbose --runInBand --no-cache ",
"cd": "run clean test build release",
"release": "semantic-release"
},
"dependencies": {
"@fink/prattler": "^5.3.1",
"@fink/std-lib": "^4.0.1"
"@fink/prattler": "^6.0.0",
"@fink/std-lib": "^5.0.0"
},
"devDependencies": {
"@fink/cli": "^6.2.1",
"@fink/jest": "^5.4.0",
"@fink/cli": "^7.0.0",
"@fink/jest": "^6.0.0",
"@fink/larix": "^12.2.2",
"@fink/loxia": "^12.2.2",
"@fink/loxia": "^13.0.1",
"commitizen": "^4.0.5",
"cz-conventional-changelog": "^3.1.0",
"jest-cli": "^26.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{add_operator} = import '@fink/prattler/symbols'
{starts_with} = import '@fink/std-lib/str'
{add_operator} = import '@fink/prattler/symbols.fnk'
{starts_with} = import '@fink/std-lib/str.fnk'

{next_is_new_expr} = import '../block/indentation'
{next_is_new_expr} = import '../block/indentation.fnk'

{prefix, infix, infix_right} = import '../symbols'
{prefix, infix, infix_right} = import '../symbols.fnk'


arithm = fn op: infix op, 'arithm'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{describe, it, expect, to_match_snapshot} = import '@fink/jest'
{describe, it, expect, to_match_snapshot} = import '@fink/jest/test.fnk'

{parse_expr, parse} = import '../../parser.fnk'

{parse_expr, parse} = import '../../'


describe 'arithmitic', fn:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{add_operator} = import '@fink/prattler/symbols'
{infix_right} = import '../symbols'
{add_operator} = import '@fink/prattler/symbols.fnk'
{infix_right} = import '../symbols.fnk'


assign = fn op: infix_right op, 'assign'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{describe, it, expect, to_match_snapshot} = import '@fink/jest'
{describe, it, expect, to_match_snapshot} = import '@fink/jest/test.fnk'

{parse_expr} = import '../../parser.fnk'

{parse_expr} = import '../../'


describe 'assignment', fn:
Expand Down
File renamed without changes.
9 changes: 0 additions & 9 deletions src/lang/async/index.fnk

This file was deleted.

9 changes: 9 additions & 0 deletions src/lang/async/init.fnk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{add_keyword} = import '@fink/prattler/symbols.fnk'

{prefix} = import '../symbols.fnk'


add_async = fn ctx:
pipe ctx:
add_keyword prefix 'await', 'prefix'

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{describe, it, expect, to_match_snapshot} = import '@fink/jest'
{describe, it, expect, to_match_snapshot} = import '@fink/jest/test.fnk'

{parse_expr} = import '../../parser.fnk'

{parse_expr} = import '../../'


describe 'async', fn:
Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions src/lang/block/expr.fnk
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{inspect} = import 'util'

{advance, expression, next_is, next_is_end, has_errors} = import '@fink/prattler'
{curr_loc, next_loc} = import '@fink/prattler'
{add_error} = import '@fink/prattler/errors'
{advance, expression, next_is, next_is_end, has_errors} = import '@fink/prattler/parser.fnk'
{curr_loc, next_loc} = import '@fink/prattler/parser.fnk'
{add_error} = import '@fink/prattler/errors.fnk'

{collect_single_comment} = import '../comments/collect'
{next_is_call_arg} = import '../call/opless'
{call_expr} = import '../call/expr'
{collect_single_comment} = import '../comments/collect.fnk'
{next_is_call_arg} = import '../call/opless.fnk'
{call_expr} = import '../call/expr.fnk'

{update_indentation, push_block, pop_block} = import './indentation'
{end_of_block_indent, next_is_unindented, next_is_indented} = import './indentation'
{next_is_new_expr} = import './indentation'
{update_indentation, push_block, pop_block} = import './indentation.fnk'
{end_of_block_indent, next_is_unindented} = import './indentation.fnk'
{next_is_new_expr, next_is_indented} = import './indentation.fnk'


empty_expr = fn {loc: {end}}:
Expand Down
7 changes: 4 additions & 3 deletions src/lang/block/indentation.fnk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{inspect} = import 'util'

{curr_loc, next_loc, next_is, next_is_end, has_errors} = import '@fink/prattler'
{advance} = import '@fink/prattler'
{add_error} = import '@fink/prattler/errors'
{curr_loc, next_loc, next_is, next_is_end} = import '@fink/prattler/parser.fnk'
{advance, has_errors} = import '@fink/prattler/parser.fnk'
{add_error} = import '@fink/prattler/errors.fnk'



end_of_block_indent = {end_of_block_indent: true}
Expand Down
14 changes: 9 additions & 5 deletions src/lang/block/index.fnk → src/lang/block/init.fnk
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{curr_loc} = import '@fink/prattler'
{add_separator, add_keyword} = import '@fink/prattler/symbols'
{curr_loc} = import '@fink/prattler/parser.fnk'
{add_separator, add_keyword} = import '@fink/prattler/symbols.fnk'

{prefix, terminator} = import '../symbols'
{prefix, terminator} = import '../symbols.fnk'

{end_of_block_indent} = import './indentation.fnk'
{expressions, single_expression} = import './expr.fnk'

{end_of_block_indent} = import './indentation'
{expressions, single_expression} = import './expr'


terminated_block = fn ctx, end_symbol, block_expr=single_expression:
expressions ctx, end_symbol, block_expr



indented_block = fn ctx, block_expr=single_expression:
terminated_block ctx, end_of_block_indent, block_expr



named_block = fn op, type, block_expr:
dict:
...prefix op
Expand All @@ -27,6 +30,7 @@ named_block = fn op, type, block_expr:
[{type, op, args, exprs, comments, loc: {start, end: loc.end}}, next_ctx]



add_named_block = fn op, type='block', block_expr=single_expression: fn ctx:
pipe ctx:
add_keyword named_block op, type, block_expr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{describe, it, expect, to_match_snapshot} = import '@fink/jest'
{describe, it, expect, to_match_snapshot} = import '@fink/jest/test.fnk'

{parse} = import '../..'
{parse} = import '../../parser.fnk'


describe 'expression block', fn:
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion src/lang/call/index.fnk → src/lang/call/init.fnk
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{add_named_block} = import '../block'
{add_named_block} = import '../block/init.fnk'



add_pipe = fn ctx:
pipe ctx:
add_named_block 'pipe'



add_call_operators = fn ctx:
pipe ctx:
add_pipe
4 changes: 2 additions & 2 deletions src/lang/call/index.test.fnk → src/lang/call/init.test.fnk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{describe, it, expect, to_match_snapshot} = import '@fink/jest'
{describe, it, expect, to_match_snapshot} = import '@fink/jest/test.fnk'

{parse} = import '../..'
{parse} = import '../../parser.fnk'


describe 'pipe foo: ...', fn:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lang/call/opless.fnk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{next_lbp} = import '@fink/prattler/symbols'
{next_lbp} = import '@fink/prattler/symbols.fnk'


callable = fn callee, lbp:
Expand Down
5 changes: 3 additions & 2 deletions src/lang/call/opless.test.fnk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{describe, it, expect, to_match_snapshot} = import '@fink/jest'
{describe, it, expect, to_match_snapshot} = import '@fink/jest/test.fnk'

{parse} = import '../../parser.fnk'

{parse} = import '../..'


describe 'call expr', fn:
Expand Down
26 changes: 13 additions & 13 deletions src/lang/call/opless.test.fnk.snap
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ module (1:0-14:0)
rx'spam'
call (6:0-6:6)
ident (6:0-6:3) foo
array (6:4-6:6)
list (6:4-6:6)
call (7:0-7:6)
ident (7:0-7:3) foo
object (7:4-7:6)
rec (7:4-7:6)
call (8:0-8:13)
ident (8:0-8:3) foo
Expand Down Expand Up @@ -82,14 +82,14 @@ module (1:0-6:0)
ident (1:0-1:3) foo
group (1:4-1:6)
array (2:0-2:15)
list (2:0-2:15)
group (2:1-2:9)
call (2:2-2:8)
ident (2:2-2:5) foo
group (2:6-2:8)
ident (2:11-2:14) bar
array list (3:0-6:0):
list (3:0-6:0):
call (4:2-4:8)
ident (4:2-4:5) foo
group (4:6-4:8)
Expand All @@ -102,13 +102,13 @@ module (1:0-6:0)
call (1:0-1:5)
ident (1:0-1:3) foo
empty (1:4-1:5)
array (2:0-2:14)
list (2:0-2:14)
group (2:1-2:8)
call (2:2-2:7)
ident (2:2-2:5) foo
empty (2:6-2:7)
ident (2:10-2:13) bar
array list (3:0-6:0):
list (3:0-6:0):
call (4:2-4:7)
ident (4:2-4:5) foo
empty (4:6-4:7)
Expand All @@ -129,12 +129,12 @@ module (1:0-5:0)
match:expr (3:2-3:17)
literal (3:2-3:7) false
block (3:7-3:17)
array (3:9-3:17)
list (3:9-3:17)
ident (3:10-3:11) a
ident (3:14-3:15) b
block else (4:2-5:0):
object (4:9-4:21)
object:prop (4:10-4:19)
rec (4:9-4:21)
rec:kv (4:10-4:19)
ident (4:10-4:13) foo
ident (4:15-4:19) spam
`;
Expand All @@ -144,11 +144,11 @@ module (1:0-5:0)
group (1:0-1:12)
ident (1:1-1:4) foo
ident (1:7-1:10) bar
array (2:0-2:12)
list (2:0-2:12)
ident (2:1-2:4) foo
ident (2:7-2:10) bar
object (3:0-3:13)
object:prop (3:1-3:11)
rec (3:0-3:13)
rec:kv (3:1-3:11)
ident (3:1-3:4) foo
ident (3:7-3:11) spam
string ' (4:0-4:13)
Expand All @@ -163,7 +163,7 @@ module (1:0-3:0)
ident (1:1-1:4) foo
ident (1:5-1:8) bar
ident (1:10-1:14) spam
array (2:0-2:12)
list (2:0-2:12)
spread ... (2:1-2:11)
call (2:4-2:11)
ident (2:4-2:7) foo
Expand Down
2 changes: 1 addition & 1 deletion src/lang/comments/collect.fnk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{next_is, collect_text, advance} = import '@fink/prattler'
{next_is, collect_text, advance} = import '@fink/prattler/parser.fnk'


collect_single_comment = fn ctx, op:
Expand Down
9 changes: 5 additions & 4 deletions src/lang/comments/comment.fnk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{curr_loc} = import '@fink/prattler'
{curr_loc} = import '@fink/prattler/parser.fnk'

{prefix} = import '../symbols.fnk'
{next_is_end_of_block, single_expression} = import '../block/expr.fnk'
{collect_comments} = import './collect.fnk'

{prefix} = import '../symbols'
{next_is_end_of_block, single_expression} = import '../block/expr'
{collect_comments} = import './collect'


comment = fn op:
Expand Down
5 changes: 3 additions & 2 deletions src/lang/comments/doc-comment.fnk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{collect_text, expression} = import '@fink/prattler'
{collect_text, expression} = import '@fink/prattler/parser.fnk'

{prefix} = import '../symbols.fnk'

{prefix} = import '../symbols'


doc_comment = fn op:
Expand Down
10 changes: 0 additions & 10 deletions src/lang/comments/index.fnk

This file was deleted.

Loading

0 comments on commit 52a516e

Please sign in to comment.