Skip to content

Commit

Permalink
fix(script-compiler): support node: prefix (#89)
Browse files Browse the repository at this point in the history
* chore(deps): update textlint

* test: add prh@6 test

* fix(script-compiler): support node: prefix

It just remove node: prefix from importing

* add comment

* CI: drop Node.js 16 support
  • Loading branch information
azu committed Apr 3, 2024
1 parent 9150d00 commit 985a49a
Show file tree
Hide file tree
Showing 11 changed files with 434 additions and 266 deletions.
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"
]
}
}
}
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:/, "");
}),
// 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

0 comments on commit 985a49a

Please sign in to comment.