| Index: pkg/dev_compiler/USAGE.md
|
| diff --git a/pkg/dev_compiler/USAGE.md b/pkg/dev_compiler/USAGE.md
|
| index 9a3de65ec6023b64bea8d647d89dff688cdaded7..dcdce9a9873c8bb4f41542951aa86476d7ac2a6d 100644
|
| --- a/pkg/dev_compiler/USAGE.md
|
| +++ b/pkg/dev_compiler/USAGE.md
|
| @@ -1,81 +1,84 @@
|
| # Usage
|
|
|
| -The [Dart Dev Compiler](README.md) (DDC) is an **experimental**
|
| -development compiler from Dart to EcmaScript 6. It is
|
| -still incomplete, under heavy development, and not yet ready for
|
| -production use.
|
| +The [Dart Dev Compiler](README.md) (DDC) is an **experimental** development
|
| +compiler from Dart to EcmaScript 6. It is still incomplete, under heavy
|
| +development, and not yet ready for production use.
|
|
|
| With those caveats, we welcome feedback for those experimenting.
|
|
|
| -The easiest way to compile and run DDC generated code for now is via NodeJS. The following instructions are in a state of flux - please expect them to change. If you find issues, please let us know.
|
| +The easiest way to compile and run DDC generated code for now is via NodeJS.
|
| +The following instructions are in a state of flux -- please expect them to
|
| +change. If you find issues, please let us know.
|
|
|
| -(1) Clone the [DDC repository](https://github.com/dart-lang/dev_compiler) and set the environment variable DDC_PATH to your checkout.
|
| +1. Clone the [DDC repository](https://github.com/dart-lang/sdk) and
|
| + set the environment variable `DDC_PATH` to the `pkg/dev_compiler`
|
| + subdirectory within wherever you check that out.
|
|
|
| -(2) Install nodejs v6.0 or later and add it to your path. It can be installed from:
|
| +2. Install nodejs v6.0 or later and add it to your path. It can be installed
|
| + from:
|
|
|
| -https://nodejs.org/
|
| + https://nodejs.org/
|
|
|
| -Note, v6 or later is required for harmony / ES6 support.
|
| + Note, v6 or later is required for harmony / ES6 support.
|
|
|
| -(3) Create a node compatible version of the dart_sdk:
|
| +3. Define a node path (you can add other directories if you want to separate
|
| + things out):
|
|
|
| -```
|
| -dart $DDC_PATH/tool/build_sdk.dart --dart-sdk $DDC_PATH/gen/patched_sdk/ --modules node -o dart_sdk.js
|
| -```
|
| + ```sh
|
| + export NODE_PATH=$DDC_PATH/lib/js/common:.
|
| + ```
|
|
|
| -You can ignore any errors or warnings for now.
|
| +4. Compile a test file with a `main` entry point:
|
|
|
| -(4) Define a node path (you can add other directories if you want to separate things out):
|
| + ```sh
|
| + dart $DDC_PATH/bin/dartdevc.dart --modules node -o hello.js hello.dart
|
| + ```
|
|
|
| -```
|
| -export NODE_PATH=.
|
| -```
|
| + Note, the `hello.js` built here is not fully linked. It loads the SDK via a `require` call.
|
|
|
| -(5) Compile a test file with a `main` entry point:
|
| +5. Run it via your node built in step 1:
|
|
|
| -```
|
| -dart $DDC_PATH/bin/dartdevc.dart --modules node -o hello.js hello.dart
|
| -```
|
| + ```sh
|
| + node -e 'require("hello").hello.main()'
|
| + ```
|
|
|
| -Note, the `hello.js` built here is not fully linked. It loads the SDK via a `require` call.
|
| +6. Compile multiple libraries using summaries. E.g., write a `world.dart` that
|
| + imports `hello.dart` with it's own `main`. Step 5 above generated a summary
|
| + (`hello.sum`) for `hello.dart`. Build world:
|
|
|
| -(6) Run it via your node built in step 1:
|
| + ```sh
|
| + dart $DDC_PATH/bin/dartdevc.dart --modules node -s hello.sum -o world.js world.dart
|
| + ```
|
|
|
| -```
|
| -node -e 'require("hello").hello.main()'
|
| -```
|
| + Run world just like hello above:
|
|
|
| -(7) Compile multiple libraries using summaries. E.g., write a `world.dart` that imports `hello.dart` with it's own `main`. Step 5 above generated a summary (`hello.sum`) for `hello.dart`. Build world:
|
| + ```sh
|
| + node -e 'require("world").world.main()'
|
| + ```
|
|
|
| -```
|
| -dart $DDC_PATH/bin/dartdevc.dart --modules node -s hello.sum -o world.js world.dart
|
| -```
|
| +7. Node modules do not run directly on the browser or v8. You can use a tool
|
| + like `browserify` to build a linked javascript file that can:
|
|
|
| -Run world just like hello above:
|
| + Install:
|
|
|
| -```
|
| -node -e 'require("world").world.main()'
|
| -```
|
| + ```sh
|
| + sudo npm install -g browserify
|
| + ```
|
|
|
| -(8) Node modules do not run directly on the browser or v8. You can use a tool like `browserify` to build a linked javascript file that can:
|
| + and run, e.g.,:
|
|
|
| -Install:
|
| -```
|
| -sudo npm install -g browserify
|
| -```
|
| + ```sh
|
| + echo 'require("world").world.main()' | browserify -d - > world.dart.js
|
| + ```
|
|
|
| -and run, e.g.,:
|
| -```
|
| -echo 'require("world").world.main()' | browserify -d - > world.dart.js
|
| -```
|
| -
|
| -The produced `world.dart.js` fully links all dependencies (`dart_sdk`, `hello`, and `world`) and executes `world.main`. It can be loaded via script tag and run in Chrome (stable or later).
|
| + The produced `world.dart.js` fully links all dependencies (`dart_sdk`,
|
| + `hello`, and `world`) and executes `world.main`. It can be loaded via
|
| + script tag and run in Chrome (stable or later).
|
|
|
| ## Feedback
|
|
|
| -Please file issues in our [GitHub issue tracker](https://github.com/dart-lang/sdk/issues).
|
| -
|
| -You can also view or join our [mailing list](https://groups.google.com/a/dartlang.org/forum/#!forum/dev-compiler).
|
| -
|
| -
|
| +Please file issues in our [GitHub issue
|
| +tracker](https://github.com/dart-lang/sdk/issues).
|
|
|
| +You can also view or join our [mailing
|
| +list](https://groups.google.com/a/dartlang.org/forum/#!forum/dev-compiler).
|
|
|