summaryrefslogtreecommitdiff
path: root/deno_typescript/README.md
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-06-18 09:06:48 -0400
committerGitHub <noreply@github.com>2020-06-18 09:06:48 -0400
commita2969ecd27645bafc7195baa7cfecbebfd8d2bf4 (patch)
treed4bfd2fa7473b9bbfb5fa25eee4dc7238f040ddf /deno_typescript/README.md
parent940f8e8433ae5ec74b2642438849089a0433e512 (diff)
Deno.bundle supports targets < ES2017 (#6346)
This commit provides a "system_loader_es5.js" bundle loader which will be added to the bundle when the target is < ES2017, which is the minimum target syntax required for "system_loader.js". Supports #5913 (via Deno.bundle()) with a couple caveats: * Allowing "deno bundle" to take a different target is not supported, as we specifically ignore "target" when passed in a TypeScript config file. This is because deno bundle is really intended to generate bundles that work in Deno. It is an unintentional side effect that some bundles are loadable in browsers. * While a target of "es3" will be accepted, the module loader will still only be compatible with ES5 or later. Realistically no one should be expecting bundles generated by Deno to be used on IE8 and prior, and there is just too much "baggage" to support that at this point. This is a minor variation of 75bb9d, which exposed some sort of internal V8 bug. Ref #6358 This is 100% authored by Kitson Kelly. Github might change the author when landing so I'm leaving this in: Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Diffstat (limited to 'deno_typescript/README.md')
-rw-r--r--deno_typescript/README.md17
1 files changed, 11 insertions, 6 deletions
diff --git a/deno_typescript/README.md b/deno_typescript/README.md
index 70fe74773..7ee4cf1df 100644
--- a/deno_typescript/README.md
+++ b/deno_typescript/README.md
@@ -69,9 +69,14 @@ At the time of this writing, while V8 and other JavaScript engines have
implemented top-level-await, no browsers have it implemented, meaning that most
browsers could not consume modules that require top-level-await.
-In order to facilitate this, there are two functions that are in the scope of
-the module in addition to the `System.register()` method. `__instantiate(main)`
-will bootstrap everything synchronously and `__instantiateAsync(main)` will do
-so asynchronously. When emitting a bundle that contains a module that requires
-top-level-await, Deno will detect this and utilise
-`await __instantiateAsync(main)` instead.
+In order to allow more browsers to consume bundles, there is an argument that is
+passed to the `__instantiate()` function which determines if the code is
+bootstrapped asynchronously or not. When emitting a bundle that contains a
+module that requires top-level-await, Deno will detect this and utilise
+`await __instantiate(main, true)`.
+
+The `system_loader_es5.js` is a transpiled version of `system_loader.js` that is
+designed to work with ES5 or later, and will be used when the bundle target is <
+ES2017. While ES3 is still a potential target which can be passed in a
+`tsconfig.json` to Deno, any resulting bundle will not be compatible, as there
+is a need to utilise items like `Object.defineProperty()`.