Skip to content

Commit

Permalink
Updated TS, Yarn and using opener for better docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
sushruth committed May 26, 2022
1 parent 035d1ba commit 1c9970e
Show file tree
Hide file tree
Showing 16 changed files with 240 additions and 54 deletions.
140 changes: 126 additions & 14 deletions .pnp.data.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": true,
"editor.insertSpaces": false,
"editor.tabSize": 2,
"prettier.useEditorConfig": true,
"typescript.preferences.quoteStyle": "single",
"javascript.preferences.quoteStyle": "single",
"editor.formatOnSave": true,
"editor.insertSpaces": false,
"editor.tabSize": 2,
"prettier.useEditorConfig": true,
"typescript.preferences.quoteStyle": "single",
"javascript.preferences.quoteStyle": "single",
"prettier.singleQuote": true,
"cSpell.words": [
"authrc"
],
]
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
30 changes: 21 additions & 9 deletions .yarn/sdks/typescript/lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const moduleWrapper = tsserver => {
const pnpApi = require(`pnpapi`);

const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
const isPortal = str => str.startsWith("portal:/");
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);

const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
Expand All @@ -44,7 +45,7 @@ const moduleWrapper = tsserver => {
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
if (resolved) {
const locator = pnpApi.findPackageLocator(resolved);
if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) {
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
str = resolved;
}
}
Expand Down Expand Up @@ -85,7 +86,7 @@ const moduleWrapper = tsserver => {
// everything else is up to neovim
case `neovim`: {
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
str = `zipfile:${str}`;
str = `zipfile://${str}`;
} break;

default: {
Expand All @@ -100,8 +101,7 @@ const moduleWrapper = tsserver => {

function fromEditorPath(str) {
switch (hostInfo) {
case `coc-nvim`:
case `neovim`: {
case `coc-nvim`: {
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
Expand All @@ -111,6 +111,12 @@ const moduleWrapper = tsserver => {
: str.replace(/^.*zipfile:/, ``);
} break;

case `neovim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
return str.replace(/^zipfile:\/\//, ``);
} break;

case `vscode`:
default: {
return process.platform === `win32`
Expand Down Expand Up @@ -143,8 +149,9 @@ const moduleWrapper = tsserver => {
let hostInfo = `unknown`;

Object.assign(Session.prototype, {
onMessage(/** @type {string} */ message) {
const parsedMessage = JSON.parse(message)
onMessage(/** @type {string | object} */ message) {
const isStringMessage = typeof message === 'string';
const parsedMessage = isStringMessage ? JSON.parse(message) : message;

if (
parsedMessage != null &&
Expand All @@ -158,9 +165,14 @@ const moduleWrapper = tsserver => {
}
}

return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {
return typeof value === `string` ? fromEditorPath(value) : value;
}));
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
return typeof value === 'string' ? fromEditorPath(value) : value;
});

return originalOnMessage.call(
this,
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
);
},

send(/** @type {any} */ msg) {
Expand Down
Loading

1 comment on commit 1c9970e

@vercel
Copy link

@vercel vercel bot commented on 1c9970e May 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ado-auth – ./

ado-auth.vercel.app
ado-auth-git-main-sushruth.vercel.app
ado-auth-sushruth.vercel.app

Please sign in to comment.