Skip to content
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

fix(script-compiler): support node: prefix #89

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [ 16,18 ]
node-version: [ 18, 20 ]
os: [ ubuntu-latest, windows-latest ]
steps:
- name: checkout
Expand Down
2 changes: 1 addition & 1 deletion packages/@textlint/config-inliner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"trailingComma": "none"
},
"dependencies": {
"@textlint/config-loader": "^13.3.0",
"@textlint/config-loader": "^14.0.4",
"untildify": "^4.0.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/@textlint/config-partial-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"trailingComma": "none"
},
"dependencies": {
"@textlint/config-loader": "^13.3.0",
"@textlint/kernel": "^13.3.0",
"@textlint/types": "^13.3.0",
"@textlint/utils": "^13.3.0"
"@textlint/config-loader": "^14.0.4",
"@textlint/kernel": "^14.0.4",
"@textlint/types": "^14.0.4",
"@textlint/utils": "^14.0.4"
},
"devDependencies": {
"@types/mocha": "^10.0.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/@textlint/runtime-helper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
},
"dependencies": {
"@kvs/env": "^1.1.0",
"@textlint/config-loader": "^13.3.0",
"@textlint/kernel": "^13.3.0",
"@textlint/module-interop": "^13.3.0",
"@textlint/types": "^13.3.0",
"@textlint/utils": "^13.3.0"
"@textlint/config-loader": "^14.0.4",
"@textlint/kernel": "^14.0.4",
"@textlint/module-interop": "^14.0.4",
"@textlint/types": "^14.0.4",
"@textlint/utils": "^14.0.4"
},
"devDependencies": {
"@types/mocha": "^10.0.1",
Expand Down
7 changes: 6 additions & 1 deletion packages/@textlint/script-compiler/.textlintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"rules": {
"no-dropping-the-ra": true,
"preset-ja-technical-writing": true
"preset-ja-technical-writing": true,
"prh": {
"rulePaths": [
"./prh.yml"
]
}
Comment on lines +4 to +9
Copy link
Member Author

Choose a reason for hiding this comment

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

Add prh as test

}
}
13 changes: 7 additions & 6 deletions packages/@textlint/script-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@
"dependencies": {
"@babel/core": "^7.12.10",
"@textlint/config-inliner": "^0.16.0",
"@textlint/config-loader": "^13.3.0",
"@textlint/config-loader": "^14.0.4",
"@textlint/config-partial-parser": "^0.16.0",
"@textlint/kernel": "^13.3.0",
"@textlint/kernel": "^14.0.4",
"@textlint/runtime-helper": "^0.16.0",
"@textlint/script-parser": "^0.16.0",
"@textlint/textlint-plugin-markdown": "^13.3.0",
"@textlint/textlint-plugin-text": "^13.3.0",
"@textlint/types": "^13.3.0",
"@textlint/textlint-plugin-markdown": "^14.0.4",
"@textlint/textlint-plugin-text": "^14.0.4",
"@textlint/types": "^14.0.4",
"babel-loader": "^8.2.2",
"babel-plugin-static-fs": "^3.0.0",
"meow": "^9.0.0",
"node-polyfill-webpack-plugin": "^2.0.1",
"read-pkg": "^5.2.0",
"rimraf": "^3.0.2",
"terser-webpack-plugin": "^5.3.6",
"webpack": "^5.75.0"
"webpack": "^5.91.0"
},
"devDependencies": {
"@types/mocha": "^10.0.1",
Expand All @@ -79,6 +79,7 @@
"prettier": "^2.3.0",
"textlint-rule-no-dropping-the-ra": "^3.0.0",
"textlint-rule-preset-ja-technical-writing": "^6.0.0",
"textlint-rule-prh": "^6.0.0",
"ts-node": "^10.9.1",
"ts-node-test-register": "^10.0.0",
"typescript": "^4.9.5"
Expand Down
3 changes: 3 additions & 0 deletions packages/@textlint/script-compiler/prh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: 1
rules:
- expected: jQuery
8 changes: 7 additions & 1 deletion packages/@textlint/script-compiler/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ export const createWebpackConfig = ({
new webpack.BannerPlugin({
banner: `textlinteditor:@@@ ${JSON.stringify(metadata)} @@@`
}),
// Remove the `node:` prefix
// see: https://github.com/webpack/webpack/issues/14166
// see: https://github.com/web-infra-dev/rsbuild/pull/1402
new webpack.NormalModuleReplacementPlugin(/^node:/, (resource) => {
resource.request = resource.request.replace(/^node:/, "");
}),
Comment on lines +94 to +99
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix #88

// Node.js polyfill
new NodePolyfillPlugin({})
],
Expand Down Expand Up @@ -193,7 +199,7 @@ export const compile = async (options: compileOptions) => {
config: rawConfig
}
});
webpack([config], (error: undefined | (Error & { details?: string }), stats?) => {
webpack([config], (error: null | (Error & { details?: string }), stats?) => {
if (error) {
console.error(error.stack || error);
if (error.details) {
Expand Down
2 changes: 1 addition & 1 deletion packages/textchecker-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"vite": "^4.4.4"
},
"dependencies": {
"@textlint/source-code-fixer": "^13.3.0",
"@textlint/source-code-fixer": "^14.0.4",
"eventmit": "^1.1.0",
"lit-html": "^1.3.0",
"p-debounce": "^2.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/webextension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"@reach/router": "^1.3.4",
"@react-stately/data": "^3.1.2",
"@spectrum-icons/workflow": "^3.2.0",
"@textlint/config-loader": "^13.3.0",
"@textlint/config-loader": "^14.0.4",
"@textlint/script-parser": "^0.16.0",
"@textlint/types": "^13.3.0",
"@textlint/types": "^14.0.4",
"codemirror": "^5.59.2",
"comlink": "^4.3.0",
"comlink-extension": "^1.0.8",
Expand Down
Loading
Loading