Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add driver subproject #172

Draft
wants to merge 225 commits into
base: new-definition-typing
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
225 commits
Select commit Hold shift + click to select a range
75b627b
WIP: Add driver
NeilKleistGao Mar 10, 2023
a648821
Minor changes
LPTK Mar 10, 2023
1cc3c14
Remove timestamp file
NeilKleistGao Mar 16, 2023
c301a8e
Remove typing unit when using comiler
NeilKleistGao Mar 17, 2023
4a5f7db
Add import and export
NeilKleistGao Mar 17, 2023
16dcbc4
First version of driver
NeilKleistGao Mar 17, 2023
779726f
WIP: Merge from new-definition-typing
NeilKleistGao Mar 24, 2023
14ee3ad
WIP: Fix module parameter
NeilKleistGao Mar 24, 2023
ff6e294
WIP: Add import parse
NeilKleistGao Mar 24, 2023
7b11950
WIP: Add import translates
NeilKleistGao Mar 24, 2023
ea80f78
WIP: Store work
NeilKleistGao Mar 24, 2023
7a6ab8c
WIP: Fix something...
NeilKleistGao Mar 24, 2023
09c65f5
Fix typing logic
NeilKleistGao Mar 25, 2023
659f5a3
Wrap module before compiling and fix import path
NeilKleistGao Mar 25, 2023
86e5315
Fix subdirectory bugs and add options for ignoring definitions
NeilKleistGao Mar 25, 2023
cba89a3
Merge branch 'new-definition-typing' into driver
NeilKleistGao Mar 26, 2023
b77a362
Add cycle dependence check
NeilKleistGao Mar 27, 2023
e88fa9c
Fix error report
NeilKleistGao Mar 27, 2023
1436365
Merge from new-definition typing and use declare and fix indent
NeilKleistGao Mar 27, 2023
1e90e6f
Merge from new-definition-typing and apply new top-level module gener…
NeilKleistGao Apr 11, 2023
76885b9
Remove export renaming
NeilKleistGao Apr 11, 2023
0a919ed
Remove IIFE
NeilKleistGao Apr 11, 2023
76f3258
Fix missing declare keyword and refactor code
NeilKleistGao Apr 11, 2023
5185f2b
WIP: Allow cycle dependencies
NeilKleistGao Apr 11, 2023
e540500
Silence error messages when generating mlsi to break cycle dependencies
NeilKleistGao Apr 12, 2023
ff0be49
Adjust package
NeilKleistGao Apr 12, 2023
3f4ae56
WIP: Add difftests for driver
NeilKleistGao Apr 12, 2023
f4c9098
WIP: Fix cycle dependencies
NeilKleistGao Apr 13, 2023
048cf02
WIP: ban unresolved symbols
NeilKleistGao Apr 13, 2023
298e7a0
Fix export set and add output dir for difftests
NeilKleistGao Apr 13, 2023
6595ebc
Update output suffix name
NeilKleistGao Apr 13, 2023
ff84ee2
Update ts2mls
NeilKleistGao Apr 14, 2023
e52cb8d
WIP: Add es5
NeilKleistGao Apr 17, 2023
7069541
WIP: Add unsupported types
NeilKleistGao Apr 17, 2023
660c8a5
WIP: Use Unsupported instead
NeilKleistGao Apr 17, 2023
0beaf5d
WIP: Use <> for all and ban unsupported tricky features
NeilKleistGao Apr 18, 2023
77d7f55
WIP: Fix interface function overriding
NeilKleistGao Apr 18, 2023
1d36bb6
WIP: Fix multi-line unsupported code
NeilKleistGao Apr 18, 2023
8be3757
WIP: Handle more unsupported types
NeilKleistGao Apr 18, 2023
184da9f
WIP: Generate for intrinsic
NeilKleistGao Apr 18, 2023
905589c
WIP: Remove ParseOnly and use module keyword
NeilKleistGao Apr 19, 2023
7ef3081
WIP: Use extends keyword
NeilKleistGao Apr 20, 2023
b401e1d
Add `export` keyword
LPTK Apr 20, 2023
ebe67bc
Merge branch 'driver' of github.com:NeilKleistGao/mlscript into driver
NeilKleistGao Apr 20, 2023
3c0a859
WIP: Add identifier escape
NeilKleistGao Apr 20, 2023
e5084ce
Fix selection parsing and new class ctor runtime name
NeilKleistGao Apr 21, 2023
9a1973d
Merge from new definition typing
NeilKleistGao Apr 24, 2023
11842ee
Enhance ident escape error message and fix symbolic argument
NeilKleistGao Apr 25, 2023
aa24b10
Replace keywords with ident escape in ts2mls
NeilKleistGao Apr 25, 2023
0158f2b
Add declare keyword in ts2mls
NeilKleistGao Apr 25, 2023
8230858
WIP: Add export parse in ts2mls
NeilKleistGao Apr 25, 2023
27df8d4
Remove unexported variables and functions, and fix nested exported types
NeilKleistGao Apr 25, 2023
eb287d8
Update helpers
NeilKleistGao Apr 27, 2023
c377401
Use val in ts2mls
NeilKleistGao Apr 27, 2023
11c3be5
Merge from new-defs
NeilKleistGao Apr 28, 2023
261a24a
WIP: Remove old invalid module test
NeilKleistGao Apr 28, 2023
f5816da
WIP: Generate top-level modules
NeilKleistGao Apr 28, 2023
bddb734
WIP: Generate import in ts2mls
NeilKleistGao Apr 28, 2023
5d4b5fb
WIP: Recover full name from import path(not ready)
NeilKleistGao Apr 28, 2023
5e30c4e
WIP: Improve code quality of import resolving
NeilKleistGao May 2, 2023
c2c8324
WIP: Add single import parsing(not ready yet)
NeilKleistGao May 2, 2023
32f2bdc
WIP: Generate type alias
NeilKleistGao May 2, 2023
c00321a
WIP: Inline type names
NeilKleistGao May 2, 2023
b2485f9
WIP: Parse re-export in ts2mls and fix some bugs(not ready)
NeilKleistGao May 4, 2023
6cf5510
WIP: Parse normal export in ts2mls(not ready)
NeilKleistGao May 4, 2023
de7869e
WIP: Add node module path resolver
NeilKleistGao May 8, 2023
9ebc9b2
WIP: Add module resolver
NeilKleistGao May 9, 2023
6191b1e
WIP: Refactor path related code
NeilKleistGao May 9, 2023
4ba886c
WIP: Refactor driver
NeilKleistGao May 9, 2023
785fcbe
WIP: Generate new ctor
NeilKleistGao May 29, 2023
daf7c35
WIP: Refactor path management
NeilKleistGao May 29, 2023
d73058c
WIP: Generate imported files in ts2mls
NeilKleistGao May 29, 2023
d8b155a
WIP: Handle cycle dependencies in ts2mls
NeilKleistGao May 29, 2023
c6f59d5
WIP: Remove export in cycle modules
NeilKleistGao May 29, 2023
0fda118
WIP: Fix re-exports
NeilKleistGao May 30, 2023
3c3d2eb
WIP: Move ts2mls JVM test to driver
NeilKleistGao May 30, 2023
7944cb7
WIP: Improve namespace translation
NeilKleistGao May 30, 2023
38d88dd
WIP: Invoke ts2mls when importing from ts
NeilKleistGao May 30, 2023
299e469
WIP: Merge from new-definition-typing
NeilKleistGao May 31, 2023
36f1cac
Merge branch 'new-definition-typing' into driver
NeilKleistGao Jun 1, 2023
fd7b8c9
WIP: Refactor code
NeilKleistGao Jun 2, 2023
ca9dcd5
WIP: Adjust structures for tsconfig
NeilKleistGao Jun 2, 2023
b72b93d
WIP: Fix several problems
NeilKleistGao Jun 5, 2023
83ac95a
WIP: Search js path based on tsconfig.json
NeilKleistGao Jun 5, 2023
9399d54
WIP: Generate mlsi for node_modules
NeilKleistGao Jun 5, 2023
9eba28e
WIP: Allow importing node_modules directly(not ready)
NeilKleistGao Jun 5, 2023
4af255d
WIP: Parse require in ts2mls(not ready)
NeilKleistGao Jun 5, 2023
ca91b0b
WIP: Merge from new-definition-typing
NeilKleistGao Jun 6, 2023
7107afc
WIP: Fix commonJS modules
NeilKleistGao Jun 6, 2023
8d73371
WIP: Rerun test
NeilKleistGao Jun 6, 2023
501ce91
WIP: Merge from new-definition-typing
NeilKleistGao Jun 7, 2023
2a13636
WIP: Fix ts2mls test path and function translation
NeilKleistGao Jun 8, 2023
3f8d59a
WIP: Fix optional parameters in functions
NeilKleistGao Jun 8, 2023
c1c8aae
Merge branch 'new-definition-typing' into driver
NeilKleistGao Jun 10, 2023
48103e0
WIP: Refactor driver diff test
NeilKleistGao Jun 10, 2023
24b8afc
WIP: Merge from new-definition-typing
NeilKleistGao Jun 13, 2023
d73c846
WIP: Fix recomp check and filename check, remove outdated output
NeilKleistGao Jun 13, 2023
dce3d87
WIP: Update re-comp check
NeilKleistGao Jun 13, 2023
3bbf334
WIP: Fix ts2mls test
NeilKleistGao Jun 13, 2023
a4782c7
WIP: Import es5 and dom
NeilKleistGao Jun 13, 2023
4cda131
WIP: Fix node_modules resolve names
NeilKleistGao Jun 13, 2023
46217f7
WIP: Fix node_module generated path and refactor code
NeilKleistGao Jun 14, 2023
b4909e1
WIP: Rename file
NeilKleistGao Jun 14, 2023
321c9b3
WIP: Fix export
NeilKleistGao Jun 14, 2023
d9d49cf
WIP: Generate based on node_modules structures
NeilKleistGao Jun 14, 2023
c65aa2f
WIP: Fix node_modules entry name
NeilKleistGao Jun 15, 2023
4273e60
WIP: Don't show depList if it is empty
NeilKleistGao Jun 15, 2023
93a59c3
WIP: Fix escape
NeilKleistGao Jun 15, 2023
02c90c2
WIP: Refactor code
NeilKleistGao Jun 15, 2023
c3305cb
WIP: Fix node_modules search
NeilKleistGao Jun 15, 2023
7c08dfa
WIP: Generate square bracket
NeilKleistGao Jun 16, 2023
a8dca48
WIP: Generate last version of overloading
NeilKleistGao Jun 16, 2023
69bf868
WIP: Fix ts2mls test and allow to ignore type errors
NeilKleistGao Jun 16, 2023
2557cbf
WIP: Rerun test
NeilKleistGao Jun 16, 2023
267f1e5
WIP: Refactor backend
NeilKleistGao Jun 16, 2023
c3486f6
WIP: Add Unsupported type(not ready)
NeilKleistGao Jun 16, 2023
5068d9b
WIP: Fix codegen error swallowing
NeilKleistGao Jun 17, 2023
91e4875
WIP: Parse but not type yet
NeilKleistGao Jun 19, 2023
a8de13a
WIP: Implement unsupported type
NeilKleistGao Jun 19, 2023
26f2a26
WIP: Make unsupported keyword
NeilKleistGao Jun 19, 2023
7c80f6b
Update ts2mls converter
NeilKleistGao Jun 19, 2023
4d640fa
WIP: Allow more content in es5
NeilKleistGao Jun 20, 2023
2bd9f0f
WIP: Minor changes
NeilKleistGao Jun 20, 2023
19bb735
WIP: Override builtin types in es5(not ready)
NeilKleistGao Jun 20, 2023
e099755
WIP: Use classes
NeilKleistGao Jun 20, 2023
728880a
WIP: Add more content in es5
NeilKleistGao Jun 20, 2023
ac34315
WIP: Cherry pick for literals
LPTK Jun 20, 2023
5d493cd
WIP: Erase member functions' names to avoid clash
NeilKleistGao Jun 21, 2023
aeb904c
WIP: Fix member name clash
NeilKleistGao Jun 21, 2023
cf2f8dd
WIP: Add more checks and update block for tail-recursion
NeilKleistGao Jun 21, 2023
797e11f
WIP: Fix list building
NeilKleistGao Jun 22, 2023
f333276
Merge branch 'new-definition-typing' into driver
NeilKleistGao Jun 23, 2023
12ddafb
WIP: Ban unexpected updating in ts2mls
NeilKleistGao Jun 23, 2023
a26f135
WIP: Fix unsupported parents
NeilKleistGao Jun 23, 2023
307b76c
WIP: Fix object flag check and unsupported check
NeilKleistGao Jun 23, 2023
ea9b063
WIP: Rename test cases
NeilKleistGao Jun 23, 2023
cf85ab8
WIP: Add Predef.mlsi
NeilKleistGao Jun 23, 2023
0f25e5d
WIP: Fix array name in es5
NeilKleistGao Jun 24, 2023
c4b7db5
WIP: Fix several bugs
NeilKleistGao Jun 24, 2023
a750e7f
WIP: Support UMD(not ready)
NeilKleistGao Jun 24, 2023
9d30fee
WIP: Add module setting
NeilKleistGao Jun 25, 2023
6036e0b
WIP: Fix substitution name parsing
NeilKleistGao Jun 25, 2023
9efb8bb
WIP: Fix several problems
NeilKleistGao Jun 25, 2023
082c74a
WIP: Support interfaces merging and referenced files
NeilKleistGao Jun 25, 2023
45ab56b
WIP: Refactor code
NeilKleistGao Jun 26, 2023
c927c0a
WIP: Fix commonjs export
NeilKleistGao Jun 26, 2023
6a59966
WIP: Refactor code
NeilKleistGao Jun 26, 2023
7b57bad
WIP: Support call signature
NeilKleistGao Jun 26, 2023
8864ca3
WIP: Fix some bugs(not ready)
NeilKleistGao Jun 26, 2023
4119fad
WIP: Fix declarations
NeilKleistGao Jun 27, 2023
0b84df2
WIP: Rerun test
NeilKleistGao Jun 27, 2023
46342de
WIP: Fix forall translation
NeilKleistGao Jun 27, 2023
699082c
WIP: Refactor converter
NeilKleistGao Jun 27, 2023
3f010f5
WIP: Fix interface parents
NeilKleistGao Jun 27, 2023
dd9a47b
WIP: Fix several problems
NeilKleistGao Jun 27, 2023
8612512
WIP: Fix re-export names
NeilKleistGao Jun 27, 2023
9073753
WIP: Move imports outside typing units
NeilKleistGao Jun 27, 2023
121acf4
WIP: Improve unsupported and fix interface parents
NeilKleistGao Jun 28, 2023
4f24820
WIP: Update test
NeilKleistGao Jun 28, 2023
e004f8f
WIP: Fix several problems
NeilKleistGao Jun 28, 2023
f719047
WIP: Update CI
NeilKleistGao Jun 28, 2023
2f05887
WIP: Try to fix jvm memory problem and fix error printing
NeilKleistGao Jun 29, 2023
1779ba6
WIP: Fix parameters and update test cases
NeilKleistGao Jun 29, 2023
299a3ec
WIP: Try to avoid printing red errors if they are expected
NeilKleistGao Jun 29, 2023
3704d15
WIP: Update test cases
NeilKleistGao Jun 29, 2023
9cb66e8
WIP: Merge branch 'new-definition-typing' into driver
NeilKleistGao Jun 29, 2023
3296187
Update shared/src/main/scala/mlscript/ConstraintSolver.scala
NeilKleistGao Jun 29, 2023
2764b3c
WIP: Rerun test
NeilKleistGao Jun 29, 2023
44f3197
WIP: Minor changes
NeilKleistGao Jul 2, 2023
708ce71
WIP: Update test
NeilKleistGao Jul 3, 2023
118071d
WIP: Redirect error messages
NeilKleistGao Jul 3, 2023
815c31f
WIP: Add typing debug option
NeilKleistGao Jul 3, 2023
ee0bac3
WIP: Update driver/js/src/main/scala/driver/Driver.scala
NeilKleistGao Jul 3, 2023
dcfee9a
WIP: Minor changes
NeilKleistGao Jul 3, 2023
068d4da
WIP: Fix getSourceFile and remove IsUndefined
NeilKleistGao Jul 3, 2023
6d0f9a9
WIP: Use git diff logic for all test cases
NeilKleistGao Jul 4, 2023
7957344
WIP: Merge branch 'new-definition-typing' into driver
NeilKleistGao Jul 4, 2023
cff3709
WIP: Rerun test
NeilKleistGao Jul 4, 2023
38091b0
WIP: Fail when expected errors are not raised
NeilKleistGao Jul 4, 2023
0cef3d7
WIP: Parse selection in inheritance
NeilKleistGao Jul 8, 2023
ff607d5
WIP: Handle imported symbols in driver
NeilKleistGao Jul 10, 2023
56e079b
WIP: Fix cycle signatures handling
NeilKleistGao Jul 10, 2023
2b9f4e0
WIP: Fix several problems
NeilKleistGao Jul 10, 2023
7132edb
WIP: Add declaration check in NuMember and fix declare keyword genera…
NeilKleistGao Jul 12, 2023
ac6e0d2
WIP: Fix export check in driver
NeilKleistGao Jul 12, 2023
3b4f5c5
WIP: Fix driver debug
NeilKleistGao Jul 12, 2023
ad42dd8
WIP: Ignore tsc-generated files
NeilKleistGao Jul 12, 2023
c5f532a
WIP: Get members' name from identifiers rather than symbols
NeilKleistGao Jul 12, 2023
95f97b7
WIP: Improve comments and fix typos
NeilKleistGao Jul 12, 2023
a8b7aff
WIP: Improve error messages
NeilKleistGao Jul 12, 2023
da5f3f1
WIP: Update README
NeilKleistGao Jul 12, 2023
3334cf6
WIP: Move files
NeilKleistGao Jul 14, 2023
76c58e4
WIP: Refactor driver diff test
NeilKleistGao Jul 14, 2023
2bcf4e7
WIP: Optimize driver diff test
NeilKleistGao Jul 14, 2023
906526a
WIP: Add watch method
NeilKleistGao Jul 14, 2023
d5b5172
WIP: Fix several problems
NeilKleistGao Jul 17, 2023
de5c30e
WIP: Update package.json
NeilKleistGao Jul 17, 2023
b9f95db
WIP: Fix several problems
NeilKleistGao Jul 17, 2023
12db979
WIP: Add js check
NeilKleistGao Jul 17, 2023
a701892
WIP: Update build.sbt and version
NeilKleistGao Jul 17, 2023
e125e7d
WIP: Fix several problems
NeilKleistGao Jul 17, 2023
d010e8d
WIP: Add fallback for unsupported type notations and fix mixin parents
NeilKleistGao Jul 17, 2023
6b62ab4
Merge from new-definition-typing
NeilKleistGao Jul 17, 2023
a28fde4
WIP: Fix several problem
NeilKleistGao Jul 18, 2023
1ed0827
WIP: Add README
NeilKleistGao Jul 18, 2023
18c9ecf
Fix watch file type and rename package
NeilKleistGao Jul 20, 2023
2a107bf
Fix several problems
NeilKleistGao Jul 27, 2023
c3c8920
Merge from new-definition-typing
NeilKleistGao Sep 14, 2023
1a65bb9
Fix inexhaustive match
NeilKleistGao Sep 14, 2023
3a9e6be
Improve recompile track
NeilKleistGao Sep 15, 2023
bf12c76
Update version
NeilKleistGao Sep 15, 2023
04a464a
Refactor code
NeilKleistGao Sep 16, 2023
f34c413
Merge from new-definition-typing
NeilKleistGao Sep 19, 2023
dc10f93
Merge from new-definition-typing
NeilKleistGao Sep 19, 2023
5c5cee1
WIP: Add weak keyword
NeilKleistGao Oct 26, 2023
571a982
WIP: Refactor parsing
NeilKleistGao Oct 27, 2023
20cba24
Check weak import
NeilKleistGao Oct 27, 2023
3353770
Merge from new-definition-typing and fix some problems
NeilKleistGao Oct 27, 2023
90735f1
Merge from new-definition-typing
NeilKleistGao Oct 27, 2023
5408fc4
Remove redundant type annos
NeilKleistGao Oct 27, 2023
6be69a4
Merge from new-definition-typing
NeilKleistGao Dec 29, 2023
022ff54
Minor changes
NeilKleistGao Dec 30, 2023
8c77e7a
Merge branch 'new-definition-typing' of https://github.com/hkust-taco…
NeilKleistGao Jan 2, 2024
9aa9fc3
Merge from new-definition-typing
NeilKleistGao Jan 3, 2024
af5dcf2
Merge from new-definition-typing
NeilKleistGao Jan 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions driver/js/src/main/scala/driver/Driver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ class Driver(options: DriverOptions) {
}

val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}")
val jsFile = s"${options.outputDir}/${file.jsFilename}"
val mlsiWriter = JSWriter(mlsiFile)
implicit val raise: Raise = (diag: Diagnostic) => report(diag, mlsiWriter.writeErr)
parseAndRun(file.filename, {
Expand Down Expand Up @@ -279,7 +280,8 @@ class Driver(options: DriverOptions) {
compile(newFilename, true)(newCtx, newExtrCtx, newVars, stack :+ file.filename) || r
})

if (!dependentRecompile && !gitHelper.filter(file.filename)) return false
if (!dependentRecompile && !gitHelper.filter(file.filename) && JSFileSystem.exists(mlsiFile) && JSFileSystem.exists(jsFile))
return false

System.out.println(s"compiling ${file.filename}...")
val importedSym = (try { otherList.map(d => importModule(file.`import`(d))) }
Expand All @@ -301,7 +303,7 @@ class Driver(options: DriverOptions) {
mlsiWriter.write(interfaces)
mlsiWriter.close()
if (Driver.totalErrors == 0)
generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map(
generate(Pgrm(definitions), jsFile, file.moduleName, imports.map(
imp => new Import(resolveJSPath(file, imp.path)) with ModuleType {
val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename))
}
Expand Down
26 changes: 15 additions & 11 deletions driver/js/src/main/scala/driver/DriverHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ object DriverHelper {
): Unit = {
System.out.println(s"start watching $workDir")
val options = DriverOptions(filename, workDir, s"${g.__dirname}/predefs/", outputDir, tsconfig, ".interfaces", commonJS, expectTypeError, false, false)
watcher.watch(workDir, js.Dictionary("ignoreInitial" -> true)).on("all", (event: js.Dynamic, file: js.Dynamic) => {
val driver = Driver(options)
driver.genPackageJson()
val res = driver.execute
watcher.watch(workDir,
js.Dictionary("ignoreInitial" -> true, "ignored" -> "(.*\\.mlsi) | (.*\\.js)")
).on("all", (event: js.Dynamic, file: js.Dynamic) => {
if (event.toString() === "change" || event.toString() === "add") {
val driver = Driver(options)
driver.genPackageJson()
val res = driver.execute

import DriverResult._
res match {
case Error => System.err.println(s"Compiling error(s) found in $filename.")
case TypeError => System.err.println(s"Type error(s) found in $filename")
case ExpectError => System.err.println(s"Expect compiling error(s) in $filename")
case ExpectTypeError => System.err.println(s"Expect type error(s) in $filename")
case OK => ()
import DriverResult._
res match {
case Error => System.err.println(s"Compiling error(s) found in $filename.")
case TypeError => System.err.println(s"Type error(s) found in $filename")
case ExpectError => System.err.println(s"Expect compiling error(s) in $filename")
case ExpectTypeError => System.err.println(s"Expect type error(s) in $filename")
case OK => ()
}
}
})
}
Expand Down
42 changes: 42 additions & 0 deletions driver/npm/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
# MLscript Driver

**This is a pre-release of MLscript driver.**
NeilKleistGao marked this conversation as resolved.
Show resolved Hide resolved

## Quick Start
To install MLscript driver, you can use `npm`:
```shell
npm i mlscript-driver
```

The newest version is recommended: there may be lots of bugs in the previous versions.

To watch the project directory, you can use TypeScript(recommended)/JavaScript:
```ts
import driver from "mlscript-driver"

// filename: string, workDir: string, outputDir: string, tsconfig: string, commonJS: boolean, expectTypeError: boolean
driver.watch("./mlscript/Main.mls", "./", "./js/", "./tsconfig.json", false, true)
```

The path must start with `./`, or it will be treated as `node_modules` paths.

If you need to interoperate with TypeScript, you must provide the path of `tsconfig.json` file.
Otherwise, it is optional.

You can choose to use CommonJS or ES modules(recommended).

Since Mlscript is still under development, type inferences are not fully supported.
If there is a type error but it is correct, please set the `expectTypeError` flag to `true`.
To get the type error messages, please check the corresponding `.mlsi` files in `.interfaces`.

For more details, you can check the demo [here](https://github.com/NeilKleistGao/mlscript-driver-demo).

## Project Structure
The MLscript driver uses `git` to track the file changes.
Please make sure your project locates in a git repo.

Though not necessary, we still recommend you organize the project in this structure:
- `.interfaces`: temporary interface files generated by MLscript driver.
- `mlscript`: directory for MLscript files.
- `node_modules`: third-party libraries in TypeScript.
- `ts`: directory for TypeScript files.
- configuration files: `package.json` and `tsconfig.json` should locate in the root directory.
2 changes: 1 addition & 1 deletion driver/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mlscript-driver",
"version": "0.0.2",
"version": "0.0.4",
"description": "mlscript driver",
"types": "lib/index.d.ts",
"main": "lib/index.js",
Expand Down
Loading