chore: update yarn sdks

This commit is contained in:
Johannes Loher 2021-10-27 19:11:00 +02:00
parent 5bb37cb7e9
commit e8cce53fd2
5 changed files with 67 additions and 13 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "eslint", "name": "eslint",
"version": "7.32.0-sdk", "version": "8.1.0-sdk",
"main": "./lib/api.js", "main": "./lib/api.js",
"type": "commonjs" "type": "commonjs"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "prettier", "name": "prettier",
"version": "2.4.0-sdk", "version": "2.4.1-sdk",
"main": "./index.js", "main": "./index.js",
"type": "commonjs" "type": "commonjs"
} }

View file

@ -30,7 +30,7 @@ const moduleWrapper = tsserver => {
function toEditorPath(str) { function toEditorPath(str) {
// We add the `zip:` prefix to both `.zip/` paths and virtual paths // We add the `zip:` prefix to both `.zip/` paths and virtual paths
if (isAbsolute(str) && !str.match(/^\^zip:/) && (str.match(/\.zip\//) || isVirtual(str))) { if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
// We also take the opportunity to turn virtual paths into physical ones; // We also take the opportunity to turn virtual paths into physical ones;
// this makes it much easier to work with workspaces that list peer // this makes it much easier to work with workspaces that list peer
// dependencies, since otherwise Ctrl+Click would bring us to the virtual // dependencies, since otherwise Ctrl+Click would bring us to the virtual
@ -60,10 +60,18 @@ const moduleWrapper = tsserver => {
// //
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910 // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
// //
case `vscode`: { // Update Oct 8 2021: VSCode changed their format in 1.61.
// Before | ^zip:/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
case `vscode <1.61`: {
str = `^zip:${str}`; str = `^zip:${str}`;
} break; } break;
case `vscode`: {
str = `^/zip/${str}`;
} break;
// To make "go to definition" work, // To make "go to definition" work,
// We have to resolve the actual file system path from virtual path // We have to resolve the actual file system path from virtual path
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip) // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
@ -91,9 +99,25 @@ const moduleWrapper = tsserver => {
} }
function fromEditorPath(str) { function fromEditorPath(str) {
return process.platform === `win32` switch (hostInfo) {
? str.replace(/^\^?zip:\//, ``) case `coc-nvim`:
: str.replace(/^\^?zip:/, ``); case `neovim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
// So in order to convert it back, we use .* to match all the thing
// before `zipfile:`
return process.platform === `win32`
? str.replace(/^.*zipfile:\//, ``)
: str.replace(/^.*zipfile:/, ``);
} break;
case `vscode`:
default: {
return process.platform === `win32`
? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
: str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
} break;
}
} }
// Force enable 'allowLocalPluginLoads' // Force enable 'allowLocalPluginLoads'
@ -129,6 +153,9 @@ const moduleWrapper = tsserver => {
typeof parsedMessage.arguments.hostInfo === `string` typeof parsedMessage.arguments.hostInfo === `string`
) { ) {
hostInfo = parsedMessage.arguments.hostInfo; hostInfo = parsedMessage.arguments.hostInfo;
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
hostInfo += ` <1.61`;
}
} }
return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => { return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {

View file

@ -30,7 +30,7 @@ const moduleWrapper = tsserver => {
function toEditorPath(str) { function toEditorPath(str) {
// We add the `zip:` prefix to both `.zip/` paths and virtual paths // We add the `zip:` prefix to both `.zip/` paths and virtual paths
if (isAbsolute(str) && !str.match(/^\^zip:/) && (str.match(/\.zip\//) || isVirtual(str))) { if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
// We also take the opportunity to turn virtual paths into physical ones; // We also take the opportunity to turn virtual paths into physical ones;
// this makes it much easier to work with workspaces that list peer // this makes it much easier to work with workspaces that list peer
// dependencies, since otherwise Ctrl+Click would bring us to the virtual // dependencies, since otherwise Ctrl+Click would bring us to the virtual
@ -60,10 +60,18 @@ const moduleWrapper = tsserver => {
// //
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910 // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
// //
case `vscode`: { // Update Oct 8 2021: VSCode changed their format in 1.61.
// Before | ^zip:/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
case `vscode <1.61`: {
str = `^zip:${str}`; str = `^zip:${str}`;
} break; } break;
case `vscode`: {
str = `^/zip/${str}`;
} break;
// To make "go to definition" work, // To make "go to definition" work,
// We have to resolve the actual file system path from virtual path // We have to resolve the actual file system path from virtual path
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip) // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
@ -91,9 +99,25 @@ const moduleWrapper = tsserver => {
} }
function fromEditorPath(str) { function fromEditorPath(str) {
return process.platform === `win32` switch (hostInfo) {
? str.replace(/^\^?zip:\//, ``) case `coc-nvim`:
: str.replace(/^\^?zip:/, ``); case `neovim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
// So in order to convert it back, we use .* to match all the thing
// before `zipfile:`
return process.platform === `win32`
? str.replace(/^.*zipfile:\//, ``)
: str.replace(/^.*zipfile:/, ``);
} break;
case `vscode`:
default: {
return process.platform === `win32`
? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
: str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
} break;
}
} }
// Force enable 'allowLocalPluginLoads' // Force enable 'allowLocalPluginLoads'
@ -129,6 +153,9 @@ const moduleWrapper = tsserver => {
typeof parsedMessage.arguments.hostInfo === `string` typeof parsedMessage.arguments.hostInfo === `string`
) { ) {
hostInfo = parsedMessage.arguments.hostInfo; hostInfo = parsedMessage.arguments.hostInfo;
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
hostInfo += ` <1.61`;
}
} }
return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => { return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {

View file

@ -1,6 +1,6 @@
{ {
"name": "typescript", "name": "typescript",
"version": "4.4.3-sdk", "version": "4.4.4-sdk",
"main": "./lib/typescript.js", "main": "./lib/typescript.js",
"type": "commonjs" "type": "commonjs"
} }