Skip to content

doc: add doc for --loader option #22104

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
and profile Node.js instances. The tools attach to Node.js instances via a
tcp port and communicate using the [Chrome DevTools Protocol][].

### `--loader=file`
<!--
added: v9.0.0
-->

Specify the `file` of the custom [experimental ECMAScript Module][] loader.

### `--napi-modules`
<!-- YAML
added: v7.10.0
Expand Down Expand Up @@ -687,3 +694,4 @@ greater than `4` (its current default value). For more information, see the
[debugger]: debugger.html
[emit_warning]: process.html#process_process_emitwarning_warning_type_code_ctor
[libuv threadpool documentation]: http://docs.libuv.org/en/latest/threadpool.html
[experimental ECMAScript Module]: esm.html#esm_loader_hooks
Copy link
Contributor

@vsemozhetbyt vsemozhetbyt Aug 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: reference list is sorted in ASCII order, so this item needs to be placed before the [libuv threadpool documentation].

Copy link
Contributor Author

@SirR4T SirR4T Aug 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will fix that. Any way we could add this as a rule to make lint?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to have it as a rule as we are already a bit messy in some docs in these sections,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would updating remark-preset-lint-node to also include remark-lint-alphabetize-lists work? I expect this would cause build failures, if remark-preset-lint-node was updated before fixes for that landed in master. How would the transition be handled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that remark-lint-alphabetize-lists can fix this case as reference lists are not common markdown lists. Maybe @rubys can tell if there is a ready easy solution for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark calls those lines definitions. Looking at the source to remark-lint-alphabetize-lists
, if list where changed to definition on line 18, the code would do what you want.

6 changes: 6 additions & 0 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ Default is
V8 Inspector integration allows attaching Chrome DevTools and IDEs to Node.js instances for debugging and profiling.
It uses the Chrome DevTools Protocol.
.
.It Fl -loader Ns = Ns Ar file
Specify the
.Ar file
as a custom loader, to load
.Fl -experimental-modules .
.
.It Fl -napi-modules
This option is a no-op.
It is kept for compatibility.
Expand Down
3 changes: 3 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2621,6 +2621,9 @@ static void PrintHelp() {
" --inspect[=[host:]port] activate inspector on host:port\n"
" (default: 127.0.0.1:9229)\n"
#endif // HAVE_INSPECTOR
" --loader=file (with --experimental-modules) use the \n"
Copy link
Contributor

@vsemozhetbyt vsemozhetbyt Aug 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand @devsnek's comment correctly, this line causes the parallel/test-cli-node-print-help.js to fail when node is compiled without Intl. Maybe we can replace (with --experimental-modules) with something else, like(with experimental-modules flag)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, if this flag can be used only with --experimental-modules, it seems we should place it inside the same if-clause and update the parallel/test-cli-node-print-help.js.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm opening a pr to fix the flags. this line should stay how it is.

" specified file as a custom loader\n"
" for ECMAScript Modules \n"
" --napi-modules load N-API modules (no-op - option\n"
" kept for compatibility)\n"
" --no-deprecation silence deprecation warnings\n"
Expand Down