- Notifications
You must be signed in to change notification settings - Fork 147
Update documentation for 1.3.x #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this :)
doc/project/building.md Outdated
| | ||
| By default, Scala.js produces "libraries", that do not actually *do* anything when their `-fastopt.js` file is loaded. | ||
| To make it do something, you need a top-level object with a `main` method: | ||
| To produce JavaScript, we need to either expose something (e.g. a method or a class) or do something when the JavaScript is loaded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| To produce JavaScript, we need to either expose something (e.g. a method or a class) or do something when the JavaScript is loaded. | |
| To produce JavaScript code, we need to either export something (e.g. a method or a class) or do something when the JavaScript code is loaded. |
? "produce JavaScript" sounds odd to me. It's like producing the JavaScript language as a whole; not producing some JavaScript code.
doc/project/building.md Outdated
| To produce JavaScript, we need to either expose something (e.g. a method or a class) or do something when the JavaScript is loaded. | ||
| Otherwise, Scala.js will not produce any JavaScript code (because to do nothing, there is no need for any code). | ||
| | ||
| To do something when your code is loaded, you need a top-level object with a `main` method (to expose something, see [Export Scala.js APIs to JavaScript]({{ site.production_url }}/doc/interoperability/export-to-javascript.html)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| To do something when your code is loaded, you need a top-level object with a `main` method (to expose something, see [Export Scala.js APIs to JavaScript]({{ site.production_url }}/doc/interoperability/export-to-javascript.html)). | |
| To do something when your code is loaded, you need a top-level object with a `main` method (to export something, see [Export Scala.js APIs to JavaScript]({{ site.production_url }}/doc/interoperability/export-to-javascript.html)). |
doc/project/building.md Outdated
| `js.JSApp` is now deprecated. | ||
| See [the Scaladoc of `js.JSApp`]({{ site.production_url }}/api/scalajs-library/0.6.20/#scala.scalajs.js.JSApp) for migration tips. | ||
| | ||
| ## Produce JavaScript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Produce JavaScript | |
| ## Produce JavaScript code |
and several more times below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also above, in the no-diff area, there is still:
Now, the .js file produced by
fastOptJSwill print"Hello world!".
which should not only be replaced by fastLinkJS, but also probably reworked, because now at that point we haven't tried to do anything yet.
doc/project/building.md Outdated
| | ||
| sbt> fastLinkJS | ||
| | ||
| This will perform fast Scala.js-specific optimizations and write the resulting code to a directory. With the default options, it will write a single file `main.js`. You can now use this JavaScript file in your HTML page or in whatever way you like. The resulting directory in the target folder will have the suffix `-fastopt`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using one line per sentence for new paragraphs. IMO it yields better diffs on subsequent edits:
| This will perform fast Scala.js-specific optimizations and write the resulting code to a directory. With the default options, it will write a single file `main.js`. You can now use this JavaScript file in your HTML page or in whatever way you like. The resulting directory in the target folder will have the suffix `-fastopt`. | |
| This will perform fast Scala.js-specific optimizations and write the resulting code to a directory. | |
| With the default options, it will write a single file `main.js`. | |
| You can now use this JavaScript file in your HTML page or in whatever way you like. | |
| The resulting directory in the target folder will have the suffix `-fastopt`. |
doc/project/building.md Outdated
| | ||
| This will perform fast Scala.js-specific optimizations and write the resulting code to a directory. With the default options, it will write a single file `main.js`. You can now use this JavaScript file in your HTML page or in whatever way you like. The resulting directory in the target folder will have the suffix `-fastopt`. | ||
| | ||
| **Note for Scala.js 1.2.x and earlier:** in Scala.js 1.2.x and earlier, `fastLinkJS` was called `fastOptJS` and always produced a single file with the suffix `-fastopt.js` directly in the target directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fastLinkJSwas calledfastOptJS
That's a bit misleading. We haven't renamed fastOptJS. It is even still there. Perhaps phrase this as follows:
| **Note for Scala.js 1.2.x and earlier:** in Scala.js 1.2.x and earlier, `fastLinkJS` was called `fastOptJS` and always produced a single file with the suffix `-fastopt.js` directly in the target directory. | |
| **Note for Scala.js 1.2.x and earlier:** in Scala.js 1.2.x and earlier, we used `fastOptJS` instead of `fastLinkJS`, which always produces a single file with the suffix `-fastopt.js` directly in the target directory. |
doc/project/building.md Outdated
| | ||
| sbt> set scalaJSStage in Global := FullOptStage | ||
| | ||
| **Note for Scala.js 1.2.x and earlier:** in Scala.js 1.2.x and earlier, `fullLinkJS` was called `fullOptJS` and always produced a single file with the suffix `-opt.js`. `scalaJSStage` works the same way in Scala.js 1.2.x and in later versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark.
doc/project/linking-errors.md Outdated
| --- | ||
| | ||
| When linking a Scala.js application, either directly through `fastOptJS`/`fullOptJS` or indirectly through `run` or `test`, Scala.js can sometimes report *linking errors*. | ||
| When linking a Scala.js application, either directly through `fastLinkJS` / `fullLinkJS` (`fastOptJS`/`fullOptJS` up to Scala.js 1.2.x) or indirectly through `run` or `test`, Scala.js can sometimes report *linking errors*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| When linking a Scala.js application, either directly through `fastLinkJS` / `fullLinkJS` (`fastOptJS`/`fullOptJS` up to Scala.js 1.2.x) or indirectly through `run` or `test`, Scala.js can sometimes report *linking errors*. | |
| When linking a Scala.js application, either directly through `fastLinkJS`/`fullLinkJS` (`fastOptJS`/`fullOptJS` up to Scala.js 1.2.x) or indirectly through `run` or `test`, Scala.js can sometimes report *linking errors*. |
doc/project/module.md Outdated
| | ||
| Support for ECMAScript modules is [still experimental in Node.js](https://nodejs.org/api/esm.html). | ||
| To run and test a Scala.js application or library using ES modules with Node.js, you will need the following additional settings: | ||
| Node.js needs explicit signalling that a module is an ECMAScript module (the default is CommonJS). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We typically use American spelling:
| Node.js needs explicit signalling that a module is an ECMAScript module (the default is CommonJS). | |
| Node.js needs explicit signaling that a module is an ECMAScript module (the default is CommonJS). |
doc/project/module.md Outdated
| - Use the file extension `.mjs`. | ||
| - Configure it in `package.json`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We typically use * for bulleted lists. (- in Scaladocs because that's the only thing it understands)
| - Use the file extension `.mjs`. | |
| - Configure it in `package.json`. | |
| * Use the file extension `.mjs`. | |
| * Configure it in `package.json`. |
doc/project/testing.md Outdated
| ## Testing over `fullLinkJS`-generated files | ||
| | ||
| By default, tests runs over `fastOptJS`-built JS files since their build time are shorter than `fullOptJS`. | ||
| By default, tests runs over `fastLinkJS`-built (`fastOptJS` up to Scala.js 1.2.x) JS files since their build time are shorter than `fullLinkJS` (`fullLinkJS` up to Scala.js 1.2.x). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| By default, tests runs over `fastLinkJS`-built (`fastOptJS` up to Scala.js 1.2.x) JS files since their build time are shorter than `fullLinkJS` (`fullLinkJS` up to Scala.js 1.2.x). | |
| By default, tests run over `fastLinkJS`-built (resp. `fastOptJS` up to Scala.js 1.2.x) JS files since their build time is shorter than `fullLinkJS` (resp. `fullLinkJS`). |
As a side effect, update the Node.js ES module support section.
| Updated. I hope I have addressed everything. |
As a side effect, update the Node.js ES module support section.