-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fallback to async API on processSync error via synckit (#307)
* feat: fallback to async API on processSync error via synckit * refactor: catch process error in worker instead * feat: cache broken sync processor * fix: mark processor broken
- Loading branch information
Showing
11 changed files
with
199 additions
and
21 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ before_install: | |
install: yarn --frozen-lockfile | ||
|
||
script: | ||
- yarn build | ||
- yarn lint | ||
- yarn test | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { runAsWorker } from 'synckit' | ||
import type { VFileOptions } from 'vfile' | ||
import vfile from 'vfile' | ||
|
||
import { getRemarkProcessor } from './rules' | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
runAsWorker( | ||
async ( | ||
textOrFileOptions: string | VFileOptions, | ||
physicalFilename: string, | ||
isMdx: boolean, | ||
) => { | ||
const remarkProcessor = getRemarkProcessor(physicalFilename, isMdx) | ||
const file = vfile(textOrFileOptions) | ||
try { | ||
await remarkProcessor.process(file) | ||
} catch (err) { | ||
if (!file.messages.includes(err)) { | ||
file.message(err).fatal = true | ||
} | ||
} | ||
return typeof textOrFileOptions === 'string' | ||
? file.toString() | ||
: { messages: file.messages } | ||
}, | ||
) |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"validate-links", | ||
2 | ||
] | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "./tsconfig.base", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"eslint-mdx": ["packages/eslint-mdx/src"], | ||
"eslint-plugin-mdx": ["packages/eslint-plugin-mdx/src"] | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"extends": "./tsconfig.base.json", | ||
"extends": "./tsconfig.base", | ||
"compilerOptions": { | ||
"noEmit": true | ||
}, | ||
|
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