diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 828ba06..e2d8dc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 16 - name: Install Packages @@ -30,7 +30,7 @@ jobs: matrix: os: [ubuntu-latest] eslint: [6, 7, 8] - node: [12.22.0, 14, 16, 17, 18, 19, 20, 21] + node: [14, 16, 17, 18, 19, 20, 21] include: - os: windows-latest eslint: 7 @@ -41,9 +41,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js ${{ matrix.node }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - name: Install Packages diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index dc0b6f5..185d57e 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -29,9 +29,9 @@ jobs: { "type": "refactor", "section": "Chores", "hidden": false }, { "type": "test", "section": "Chores", "hidden": false } ] - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 if: ${{ steps.release.outputs.release_created }} - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: lts/* registry-url: https://registry.npmjs.org diff --git a/lib/processor.js b/lib/processor.js index 63aa915..c1661d8 100644 --- a/lib/processor.js +++ b/lib/processor.js @@ -28,7 +28,9 @@ "use strict"; -const parse = require("mdast-util-from-markdown"); +const { createSyncFn } = require("synckit"); + +const parse = createSyncFn(require.resolve("./worker.mjs")); const UNSATISFIABLE_RULES = [ "eol-last", // The Markdown parser strips trailing newlines in code fences diff --git a/lib/worker.mjs b/lib/worker.mjs new file mode 100644 index 0000000..ba06136 --- /dev/null +++ b/lib/worker.mjs @@ -0,0 +1,9 @@ +import { fromMarkdown } from "mdast-util-from-markdown"; +import { runAsWorker } from "synckit"; + +runAsWorker( + /** + * @param {string} text + */ + (text) => fromMarkdown(text) +); diff --git a/package.json b/package.json index 7446546..79aaab9 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "files": [ "index.js", "lib/index.js", - "lib/processor.js" + "lib/processor.js", + "lib/worker.mjs" ], "devDependencies": { "chai": "^4.2.0", @@ -46,12 +47,13 @@ "nyc": "^14.1.1" }, "dependencies": { - "mdast-util-from-markdown": "^0.8.5" + "mdast-util-from-markdown": "^2.0.0", + "synckit": "^0.8.5" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^14.18.0 || >=16.0.0" } }