-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
doc: add initial doc on how to update cjs-module-lexer #43255
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
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5c1eb78
doc: add initial doc on how to update cjs-module-lexer
mhdawson 1f585a8
fixup
mhdawson a64872f
squash: address comments
mhdawson 7fb464d
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson 5bb755c
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson 5308a8f
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson f8cb6f5
address comments
mhdawson 334ed03
fixup
mhdawson 55b4b1d
fixup
mhdawson 9dac62d
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson 277f5bb
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson c9876b1
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson bf1d2be
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson d27e418
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson fb2b273
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson 3d91e29
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson b4ddcb8
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson 7de0eae
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson 5a25b9d
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson 6d33ab2
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson df2c15f
Update doc/contributing/maintaining-cjs-module-lexer.md
mhdawson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Maintaining cjs-module-lexer | ||
|
||
The [cjs-module-lexer](https://github.com/nodejs/node/tree/HEAD/deps/cjs-module-lexer) | ||
dependency is used within the Node.js ESM implementation to detect the | ||
named exports of a CommonJS module. | ||
|
||
It is used within | ||
[`node:internal/modules/esm/translators`](https://github.com/nodejs/node/blob/HEAD/lib/internal/modules/esm/translators.js) | ||
in which both `internal/deps/cjs-module-lexer/lexer` and | ||
`internal/deps/cjs-module-lexer/dist/lexer` are required and used. | ||
|
||
`internal/deps/cjs-module-lexer/lexer` | ||
is a regular JavaScript implementation that is | ||
used when WebAssembly is not available on a platform. | ||
`internal/deps/cjs-module-lexer/dist/lexer` is a faster | ||
implementation using WebAssembly which is generated from a | ||
C based implementation. These two paths | ||
resolve to the files in `deps/cjs-module-lexer` due to their | ||
inclusion in the `deps_files` entry in | ||
[node.gyp](https://github.com/nodejs/node/blob/master/node.gyp). | ||
|
||
The two different versions of lexer.js are maintained in the | ||
[nodejs/cjs-module-lexer][] project. | ||
|
||
In order to update the Node.js dependencies to use to a newer verion | ||
of cjs-module-lexer, complete the following steps: | ||
|
||
* Clone [nodejs/cjs-module-lexer][] | ||
and check out the version that you want Node.js to use. | ||
* Follow the WASM build steps outlined in | ||
[wasm-build-steps](https://github.com/nodejs/cjs-module-lexer#wasm-build-steps). | ||
This will generate the WASM based dist/lexer.js file. | ||
* Preserving the same directory structure, copy the following files over | ||
to `deps/cjs-module-lexer` directory where you have checked out Node.js. | ||
|
||
```text | ||
├── CHANGELOG.md | ||
├── dist | ||
│ ├── lexer.js | ||
│ └── lexer.mjs | ||
├── lexer.js | ||
├── LICENSE | ||
├── package.json | ||
└── README.md | ||
``` | ||
|
||
* Update the link to the cjs-module-lexer in the list at the end of | ||
[doc/api/esm.md](../api/esm.md) | ||
to point to the updated version. | ||
|
||
* Create a PR, adding the files in the deps/cjs-module-lexer that | ||
were modified. | ||
|
||
If updates are needed to cjs-module-lexer for Node.js, first PR | ||
those updates into | ||
[nodejs/cjs-module-lexer][], | ||
request a release and then pull in the updated version once available. | ||
|
||
[nodejs/cjs-module-lexer]: https://github.com/nodejs/cjs-module-lexer |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.