-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Upgrade unist-util-visit to 4.1.0 #19
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b0bf6de
Set up spys instead of using mock
candrews 1381f13
Export as an ES6 module instead of CommonJS
candrews aea7fb9
Upgrade unist-util-visit to 3.0.0
candrews 55bf722
Upgrade unist-util-visit to 4.1.0
candrews 135b622
Use `import` instead of `require`
candrews ad07917
Use ES2020 instead of ESNext
candrews 449b019
Merge branch 'esm' into es6-unist-util-visit-4.1.0
sjwall 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 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -11,9 +11,10 @@ | |
}, | ||
"author": "Sam Wall ([email protected])", | ||
"license": "MIT", | ||
"type": "module", | ||
"scripts": { | ||
"build": "rimraf lib && tsc", | ||
"test": "jest --coverage" | ||
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -33,7 +34,7 @@ | |
"peerDependencies": { | ||
"mermaid": "^8.0.0", | ||
"react": "^16.8.4 || ^17.0.0", | ||
"unist-util-visit": "^2.0.0" | ||
"unist-util-visit": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"@mdx-js/mdx": "^1.6.22", | ||
|
@@ -57,6 +58,6 @@ | |
"rimraf": "^3.0.2", | ||
"ts-jest": "^27.0.4", | ||
"typescript": "^4.3.5", | ||
"unist-util-visit": "^2.0.0" | ||
"unist-util-visit": "^4.1.0" | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -5931,6 +5931,11 @@ unist-util-is@^4.0.0: | |
resolved "https://registry.npmjs.org/unist-util-is/-/unist-util-is-4.1.0.tgz" | ||
integrity sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg== | ||
|
||
unist-util-is@^5.0.0: | ||
version "5.1.1" | ||
resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-5.1.1.tgz#e8aece0b102fa9bc097b0fef8f870c496d4a6236" | ||
integrity sha512-F5CZ68eYzuSvJjGhCLPL3cYx45IxkqXSetCcRgUXtbcm50X2L9oOWQlfUfDdAf+6Pd27YDblBfdtmsThXmwpbQ== | ||
|
||
unist-util-position@^3.0.0: | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/unist-util-position/-/unist-util-position-3.1.0.tgz#1c42ee6301f8d52f47d14f62bbdb796571fa2d47" | ||
|
@@ -5965,6 +5970,14 @@ unist-util-visit-parents@^3.0.0: | |
"@types/unist" "^2.0.0" | ||
unist-util-is "^4.0.0" | ||
|
||
unist-util-visit-parents@^5.0.0: | ||
version "5.1.0" | ||
resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-5.1.0.tgz#44bbc5d25f2411e7dfc5cecff12de43296aa8521" | ||
integrity sha512-y+QVLcY5eR/YVpqDsLf/xh9R3Q2Y4HxkZTp7ViLDU6WtJCEcPmRzW1gpdWDCDIqIlhuPDXOgttqPlykrHYDekg== | ||
dependencies: | ||
"@types/unist" "^2.0.0" | ||
unist-util-is "^5.0.0" | ||
|
||
[email protected], unist-util-visit@^2.0.0: | ||
version "2.0.3" | ||
resolved "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz" | ||
|
@@ -5974,6 +5987,15 @@ [email protected], unist-util-visit@^2.0.0: | |
unist-util-is "^4.0.0" | ||
unist-util-visit-parents "^3.0.0" | ||
|
||
unist-util-visit@^4.1.0: | ||
version "4.1.0" | ||
resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-4.1.0.tgz#f41e407a9e94da31594e6b1c9811c51ab0b3d8f5" | ||
integrity sha512-n7lyhFKJfVZ9MnKtqbsqkQEk5P1KShj0+//V7mAcoI6bpbUjh3C/OG8HVD+pBihfh6Ovl01m8dkcv9HNqYajmQ== | ||
dependencies: | ||
"@types/unist" "^2.0.0" | ||
unist-util-is "^5.0.0" | ||
unist-util-visit-parents "^5.0.0" | ||
|
||
universalify@^0.1.0, universalify@^0.1.2: | ||
version "0.1.2" | ||
resolved "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz" | ||
|
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.
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.
Docusaurus does not support ESM yet facebook/docusaurus#5379
I am happy to merge this change in (and make the appropriate changes to document this) if there are people wanting to use this library outside of Docusaurus.
I don't see a reason to merge this change until Docusaurus is up upgraded to support ESM if there are no use cases outside of it. The main reason for this is that it could cause confusion in the documentation and will add more support overhead
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.
Are you sure that doesn't work?
The GitHub Action at https://github.com/candrews/mdx-mermaid/blob/135b622f14972e347b1e6b84f9303d3ea23cee43/.github/workflows/build.yml#L28 passes, meaning that the "doc" project builds (which includes the
require
->import
change).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.
The code compiles and the React component works but the mdx parser in Docusuarus doesn't process the markdown files.
Running up the docs locally with
yarn start
at the bottom of intro.md there should be a diagram http://localhost:3000/mdx-mermaid/docs/intro/Actual:

Expected:

The diagram on the index works because it is using the React component directly and not the plugin
mdx-mermaid/doc/src/components/HomepageFeatures.js
Lines 10 to 19 in 3d6784c
The import statement is returning a promise which I guess that the parser is ignoring as it doesn't know how to handle it
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.
A dynamic import is always a promise this is why it needs to be awaited. Docusaurus itself is also using
.mjs
inside their own config.Which means the docusaurus config needs to be following:
With that config it should actually work.