diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2019-11-14 02:35:56 +1100 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-11-13 10:35:56 -0500 |
commit | 8d03397293b388317299dfb0648b541a7005807d (patch) | |
tree | 38aeb4deb371e81f47b6750110d96de46b9f5b05 /std/manual.md | |
parent | ee1b8dc883db1531d913f7b10a8d1160f3209d93 (diff) |
Make bundles fully standalone (#3325)
- Bundles are fully standalone. They now include the shared loader with
`deno_typescript`.
- Refactor of the loader in `deno_typescript` to perform module
instantiation in a more
- Change of behaviour when an output file is not specified on the CLI.
Previously a default name was determined and the bundle written to that
file, now the bundle will be sent to `stdout`.
- Refactors in the TypeScript compiler to be able to support the concept
of a request type. This provides a cleaner abstraction and makes it
easier to support things like single module transpiles to the userland.
- Remove a "dangerous" circular dependency between `os.ts` and `deno.ts`,
and define `pid` and `noColor` in a better way.
- Don't bind early to `console` in `repl.ts`.
- Add an integration test for generating a bundle.
Diffstat (limited to 'std/manual.md')
-rw-r--r-- | std/manual.md | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/std/manual.md b/std/manual.md index a5083d577..f5aed463c 100644 --- a/std/manual.md +++ b/std/manual.md @@ -793,9 +793,8 @@ Particularly useful ones: ### Bundling -`deno bundle [URL]` will output a single JavaScript file, using -[AMD](https://en.wikipedia.org/wiki/Asynchronous_module_definition), which -includes all dependencies of the specified input. +`deno bundle [URL]` will output a single JavaScript file, which includes all +dependencies of the specified input. For example: ``` > deno bundle https://deno.land/std/examples/colors.ts @@ -804,32 +803,21 @@ Emitting bundle to "colors.bundle.js" 9.2 kB emitted. ``` -To run then bundle in Deno use +The bundle can just be run as any other module in Deno would: ``` -deno https://deno.land/std/bundle/run.ts colors.bundle.js +deno colors.bundle.js ``` -Bundles can also be loaded in the web browser with the assistance of -[RequireJS](https://requirejs.org/). Suppose we have a bundle called -`website.bundle.js`, then the following HTML should be able to load it: +Bundles can also be loaded in the web browser. For example: ```html -<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script> <script src="website.bundle.js"></script> -<script> - requirejs(["website"], website => website.main()); -</script> ``` -Here we assume there's an exported function `main()` from `website.ts`. - -```js -// website.ts -export main() { - console.log("hello from the web browser"); -} -``` +Bundles, whether loaded in the web browser, or in Deno, would run the root +module which is specified on the command line when creating the bundle, so put +any initiation logic in that module. ### Installing executable scripts |