diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-01-09 12:59:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-09 12:59:46 -0500 |
commit | 0ceb554343ff3d311a19f027b7aa8f0806bbb162 (patch) | |
tree | 24603f165b7da831c2b68ad9472e26fabf72134c /tests | |
parent | 3afdae165d3bc9acb5e5a4749334d2673f2566af (diff) |
Native ES modules (#1460)
* Native ES modules
This is a major refactor of internal compiler.
Before: JS and TS both were sent through the typescript compiler where
their imports were parsed and handled. Both compiled to AMD JS and
finally sent to V8
Now: JS is sent directly into V8. TS is sent through the typescript
compiler, but tsc generates ES modules now instead of AMD. This
generated JS is then dumped into V8.
This should much faster for pure JS code. It may improve TS compilation
speed.
In the future this allows us to separate TS out of the runtime heap and
into its own dedicated snapshot. This will result in a smaller runtime
heap, and thus should be faster.
Some tests were unfortunately disabled to ease landing this patch:
1. compiler_tests.ts which I intend to bring back in later commits.
2. Some text_encoding_test.ts tests which made the file invalid utf8.
See PR for a discussion.
Also worth noting that this is necessary to support WASM
Diffstat (limited to 'tests')
-rw-r--r-- | tests/013_dynamic_import.disabled (renamed from tests/013_dynamic_import.test) | 0 | ||||
-rw-r--r-- | tests/014_duplicate_import.disabled (renamed from tests/014_duplicate_import.test) | 0 | ||||
-rw-r--r-- | tests/020_json_modules.ts | 4 | ||||
-rw-r--r-- | tests/async_error.ts.out | 6 | ||||
-rw-r--r-- | tests/error_001.ts.out | 6 | ||||
-rw-r--r-- | tests/error_002.ts.out | 6 | ||||
-rw-r--r-- | tests/error_008_checkjs.js.out | 12 | ||||
-rw-r--r-- | tests/error_008_checkjs.test | 1 | ||||
-rw-r--r-- | tests/subdir/auto_print_hello.ts | 2 |
9 files changed, 9 insertions, 28 deletions
diff --git a/tests/013_dynamic_import.test b/tests/013_dynamic_import.disabled index 8fe463b20..8fe463b20 100644 --- a/tests/013_dynamic_import.test +++ b/tests/013_dynamic_import.disabled diff --git a/tests/014_duplicate_import.test b/tests/014_duplicate_import.disabled index 57d5b6e8b..57d5b6e8b 100644 --- a/tests/014_duplicate_import.test +++ b/tests/014_duplicate_import.disabled diff --git a/tests/020_json_modules.ts b/tests/020_json_modules.ts index 89963751c..71c0eb8db 100644 --- a/tests/020_json_modules.ts +++ b/tests/020_json_modules.ts @@ -1,3 +1,3 @@ import * as config from "./subdir/config.json"; - -console.log(JSON.stringify(config)); +// TODO Shouldn't need 'default' +console.log(JSON.stringify(config["default"])); diff --git a/tests/async_error.ts.out b/tests/async_error.ts.out index 1e7e901f6..8054551e4 100644 --- a/tests/async_error.ts.out +++ b/tests/async_error.ts.out @@ -3,8 +3,4 @@ before error world Error: error at foo ([WILDCARD]tests/async_error.ts:4:9) - at eval ([WILDCARD]tests/async_error.ts:7:1) - at _gatherDependencies ([WILDCARD]/js/compiler.ts:[WILDCARD]) - at run ([WILDCARD]/js/compiler.ts:[WILDCARD]) - at denoMain ([WILDCARD]/js/main.ts:[WILDCARD]) - at <anonymous>:1:1 + at [WILDCARD]tests/async_error.ts:7:1 diff --git a/tests/error_001.ts.out b/tests/error_001.ts.out index 1ab615fc0..7a8491225 100644 --- a/tests/error_001.ts.out +++ b/tests/error_001.ts.out @@ -1,8 +1,4 @@ [WILDCARD]Error: bad at foo (file://[WILDCARD]tests/error_001.ts:2:9) at bar (file://[WILDCARD]tests/error_001.ts:6:3) - at eval (file://[WILDCARD]tests/error_001.ts:9:1) - at _gatherDependencies ([WILDCARD]/js/compiler.ts:[WILDCARD]) - at run ([WILDCARD]/js/compiler.ts:[WILDCARD]) - at denoMain ([WILDCARD]/js/main.ts:[WILDCARD]) - at <anonymous>:1:1 + at file://[WILDCARD]tests/error_001.ts:9:1 diff --git a/tests/error_002.ts.out b/tests/error_002.ts.out index 5a9c21e89..0f3b08303 100644 --- a/tests/error_002.ts.out +++ b/tests/error_002.ts.out @@ -1,8 +1,4 @@ [WILDCARD]Error: exception from mod1 at throwsError (file://[WILDCARD]/tests/subdir/mod1.ts:16:9) at foo (file://[WILDCARD]/tests/error_002.ts:4:3) - at eval (file://[WILDCARD]/tests/error_002.ts:7:1) - at _drainRunQueue ([WILDCARD]/js/compiler.ts:[WILDCARD]) - at run ([WILDCARD]/js/compiler.ts:[WILDCARD]) - at denoMain ([WILDCARD]/js/main.ts:[WILDCARD]) - at <anonymous>:1:1 + at file://[WILDCARD]/tests/error_002.ts:7:1 diff --git a/tests/error_008_checkjs.js.out b/tests/error_008_checkjs.js.out index 793c2f68c..c40012712 100644 --- a/tests/error_008_checkjs.js.out +++ b/tests/error_008_checkjs.js.out @@ -1,10 +1,2 @@ -[96m[WILDCARD]/tests/error_008_checkjs.js[WILDCARD] - [91merror[0m[90m TS2552: [0mCannot find name 'consol'. Did you mean 'console'? - -[WILDCARD] consol.log("hello world!"); -[WILDCARD]~~~~~~[0m - - [96m$asset$/lib.deno_runtime.d.ts[WILDCARD] -[WILDCARD]declare const console: consoleTypes.Console; -[WILDCARD]~~~~~~~[0m -[WILDCARD]'console' is declared here. - +ReferenceError: consol is not defined + at [WILDCARD]tests/error_008_checkjs.js:2:1 diff --git a/tests/error_008_checkjs.test b/tests/error_008_checkjs.test index eebd64aaf..0e43421e4 100644 --- a/tests/error_008_checkjs.test +++ b/tests/error_008_checkjs.test @@ -1,3 +1,4 @@ args: tests/error_008_checkjs.js --reload +check_stderr: true exit_code: 1 output: tests/error_008_checkjs.js.out diff --git a/tests/subdir/auto_print_hello.ts b/tests/subdir/auto_print_hello.ts index a00040281..5efa72e03 100644 --- a/tests/subdir/auto_print_hello.ts +++ b/tests/subdir/auto_print_hello.ts @@ -1,2 +1,2 @@ console.log("hello!"); -export = {}; +export default {}; |