Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Docs: update for PR #13/#14 #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ yarn add --dev @swc/core @swc/register
```

### Usage
```bash
require("@swc/register");
```

All subsequent files required by node will be transformed by swc. You can also
call @swc/register directly from command line.

```bash
swc-node <filename>
node -r '@swc/register' <filename>
Comment on lines -25 to -27
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the automatic hook is being removed in #14, node -r '@swc/register' is no longer supported.

Babel has a dedicated package @babel/node (node -r @swc/node). swc should use a dedicated package, too.

Copy link
Member

Choose a reason for hiding this comment

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

As the automatic hook is being removed in #14, node -r '@swc/register' is no longer supported.
Babel has a dedicated package @babel/node (node -r @swc/node). swc should use a dedicated package, too.

This does mean we need a custom CLI?
While reading again before merging into the main repository, I found that this package would be useless.

```js
require("@swc/register")({
extensions: [],
ignore: [],
only: [],
// And swc configuration
jsc: {},
env: {}
});
```
Comment on lines +19 to 28
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the automatic hook is being removed in #14, @swc/register always requires an option. It is to match the behavior of @babel/register.


All subsequent files required by node will be transformed by swc.

&nbsp;

--------
Expand Down