Chromium Code Reviews| Index: pkg/dev_compiler/USAGE.md |
| diff --git a/pkg/dev_compiler/USAGE.md b/pkg/dev_compiler/USAGE.md |
| index 9a3de65ec6023b64bea8d647d89dff688cdaded7..7db9c62cee76b33663eac70d01703d211a59008a 100644 |
| --- a/pkg/dev_compiler/USAGE.md |
| +++ b/pkg/dev_compiler/USAGE.md |
| @@ -1,81 +1,92 @@ |
| # 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/dev_compiler) and |
|
vsm
2017/01/11 00:23:45
This should now point to the sdk:
https://github.
Bob Nystrom
2017/01/11 00:55:16
Done.
|
| + set the environment variable DDC_PATH to your checkout. |
| -(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. Create a node compatible version of the dart_sdk: |
|
vsm
2017/01/11 00:23:45
I think you can skip step #3 altogether and replac
Bob Nystrom
2017/01/11 00:55:16
Done.
|
| -``` |
| -dart $DDC_PATH/tool/build_sdk.dart --dart-sdk $DDC_PATH/gen/patched_sdk/ --modules node -o dart_sdk.js |
| -``` |
| + ```sh |
| + dart $DDC_PATH/tool/build_sdk.dart --dart-sdk $DDC_PATH/gen/patched_sdk/ \ |
| + --dart-sdk-summary=build --modules node -o dart_sdk.js |
| + ``` |
| -You can ignore any errors or warnings for now. |
| + You can ignore any errors or warnings for now. |
| -(4) Define a node path (you can add other directories if you want to separate things out): |
| +4. Define a node path (you can add other directories if you want to separate |
| + things out): |
| -``` |
| -export NODE_PATH=. |
| -``` |
| + ```sh |
| + export NODE_PATH=. |
| + ``` |
| -(5) Compile a test file with a `main` entry point: |
| +5. Compile a test file with a `main` entry point: |
| -``` |
| -dart $DDC_PATH/bin/dartdevc.dart --modules node -o hello.js hello.dart |
| -``` |
| + ```sh |
| + dart $DDC_PATH/bin/dartdevc.dart --modules node -o hello.js hello.dart |
| + ``` |
| -Note, the `hello.js` built here is not fully linked. It loads the SDK via a `require` call. |
| + Note, the `hello.js` built here is not fully linked. It loads the SDK via a `require` call. |
| -(6) Run it via your node built in step 1: |
| +6. Run it via your node built in step 1: |
| -``` |
| -node -e 'require("hello").hello.main()' |
| -``` |
| + ```sh |
| + node -e 'require("hello").hello.main()' |
| + ``` |
| -(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: |
| +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: |
| -``` |
| -dart $DDC_PATH/bin/dartdevc.dart --modules node -s hello.sum -o world.js world.dart |
| -``` |
| + ```sh |
| + dart $DDC_PATH/bin/dartdevc.dart --modules node -s hello.sum -o world.js world.dart |
| + ``` |
| -Run world just like hello above: |
| + Run world just like hello above: |
| -``` |
| -node -e 'require("world").world.main()' |
| -``` |
| + ```sh |
| + node -e 'require("world").world.main()' |
| + ``` |
| -(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: |
| +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: |
| -Install: |
| -``` |
| -sudo npm install -g browserify |
| -``` |
| + Install: |
| -and run, e.g.,: |
| -``` |
| -echo 'require("world").world.main()' | browserify -d - > world.dart.js |
| -``` |
| + ```sh |
| + sudo npm install -g browserify |
| + ``` |
| -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). |
| + and run, e.g.,: |
| -## Feedback |
| - |
| -Please file issues in our [GitHub issue tracker](https://github.com/dart-lang/sdk/issues). |
| + ```sh |
| + echo 'require("world").world.main()' | browserify -d - > world.dart.js |
| + ``` |
| -You can also view or join our [mailing list](https://groups.google.com/a/dartlang.org/forum/#!forum/dev-compiler). |
| + 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 |
|
vsm
2017/01/11 00:23:45
Now that we're built as part of the SDK, someone w
Bob Nystrom
2017/01/11 00:55:16
...yes, but I wasn't planning to rewrite this whol
|
| +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). |