Skip to content

Commit

Permalink
Update dependencies (#57)
Browse files Browse the repository at this point in the history
This makes it compatible with unified 11 and unified-engine 11.
  • Loading branch information
remcohaszing committed Aug 22, 2023
1 parent a413cfe commit 752400a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 20 deletions.
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
coverage/
*.md
18 changes: 14 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {fileURLToPath} from 'node:url'
import {findUp, pathExists} from 'find-up'
import {loadPlugin} from 'load-plugin'
import {engine} from 'unified-engine'
import {fromPosition} from 'unist-util-lsp'
import {fromPoint, fromPosition} from 'unist-util-lsp'
import {VFile} from 'vfile'
import {
createConnection,
Expand All @@ -59,10 +59,12 @@ import {TextDocument} from 'vscode-languageserver-textdocument'
*/
function vfileMessageToDiagnostic(message) {
const diagnostic = Diagnostic.create(
message.position
? fromPosition(message.position)
message.place
? 'start' in message.place
? fromPosition(message.place)
: {start: fromPoint(message.place), end: fromPoint(message.place)}
: Range.create(0, 0, 0, 0),
String(message.stack || message.reason),
message.reason,
message.fatal === true
? DiagnosticSeverity.Error
: message.fatal === false
Expand All @@ -82,6 +84,14 @@ function vfileMessageToDiagnostic(message) {
}
}

if (
typeof message.cause === 'object' &&
message.cause &&
'stack' in message.cause
) {
diagnostic.message += '\n' + message.cause.stack
}

if (message.note) {
diagnostic.message += '\n' + message.note
}
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@
"dependencies": {
"find-up": "^6.0.0",
"load-plugin": "^5.0.0",
"unified-engine": "^10.0.0",
"unist-util-lsp": "^1.0.0",
"vfile": "^5.0.0",
"vfile-message": "^3.0.0",
"unified-engine": "^11.0.0",
"unist-util-lsp": "^2.0.0",
"vfile": "^6.0.0",
"vfile-message": "^4.0.0",
"vscode-languageserver": "^8.0.0",
"vscode-languageserver-textdocument": "^1.0.0"
},
"devDependencies": {
"@types/node": "*",
"c8": "^7.0.0",
"prettier": "^2.0.0",
"@types/node": "^20.0.0",
"c8": "^8.0.0",
"prettier": "^3.0.0",
"remark-cli": "^11.0.0",
"remark-preset-wooorm": "^9.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
"unified": "^10.0.0",
"xo": "^0.54.0"
"unified": "^11.0.0",
"xo": "^0.56.0"
},
"scripts": {
"prepack": "npm run build",
"build": "tsc --build --clean && tsc --build && type-coverage",
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
"format": "remark . -qfo && prettier . -w --log-level warn && xo --fix",
"test-api": "node --unhandled-rejections=strict --conditions development test/index.js",
"test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api",
"test": "npm run build && npm run format && npm run test-coverage"
Expand Down
8 changes: 5 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ test('`initialize`, `textDocument/didOpen` (and a broken plugin)', async () => {
[
{
message:
'Error: Whoops!\n at Function.oneError (one-error.js:1:1)\n at Function.freeze (index.js:1:1)',
'Cannot process file\n' +
'Error: Whoops!\n' +
' at Function.oneError (one-error.js:1:1)',
range: {start: {line: 0, character: 0}, end: {line: 0, character: 0}},
severity: 1
}
Expand Down Expand Up @@ -754,8 +756,8 @@ test('`workspace/didChangeWorkspaceFolders`', async () => {
*/
function cleanStack(stack, max) {
return stack
.replace(/\(.+\//g, '(')
.replace(/\d+:\d+/g, '1:1')
.replaceAll(/\(.+\//g, '(')
.replaceAll(/\d+:\d+/g, '1:1')
.split('\n')
.slice(0, max)
.join('\n')
Expand Down
1 change: 1 addition & 0 deletions test/missing-package-with-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import {createUnifiedLanguageServer} from 'unified-language-server'

createUnifiedLanguageServer({
processorName: 'xxx-missing-yyy',
// @ts-expect-error This will be ok when we update to remark 15.
defaultProcessor: remark
})
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"checkJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"lib": ["es2020"],
"lib": ["es2022"],
"module": "node16",
"skipLibCheck": true,
"strict": true,
"target": "es2020"
"target": "es2022"
}
}

0 comments on commit 752400a

Please sign in to comment.