chore: update yarn and foundry-vtt-types
This commit is contained in:
parent
b1111305d1
commit
d03c69c8a6
20 changed files with 1699 additions and 825 deletions
55
.yarn/releases/yarn-2.4.2.cjs
vendored
55
.yarn/releases/yarn-2.4.2.cjs
vendored
File diff suppressed because one or more lines are too long
631
.yarn/releases/yarn-3.0.2.cjs
vendored
Executable file
631
.yarn/releases/yarn-3.0.2.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
2
.yarn/sdks/eslint/bin/eslint.js
vendored
2
.yarn/sdks/eslint/bin/eslint.js
vendored
|
@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||||
const {createRequire, createRequireFromPath} = require(`module`);
|
const {createRequire, createRequireFromPath} = require(`module`);
|
||||||
const {resolve} = require(`path`);
|
const {resolve} = require(`path`);
|
||||||
|
|
||||||
const relPnpApiPath = "../../../../.pnp.js";
|
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||||
|
|
||||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||||
|
|
2
.yarn/sdks/eslint/lib/api.js
vendored
2
.yarn/sdks/eslint/lib/api.js
vendored
|
@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||||
const {createRequire, createRequireFromPath} = require(`module`);
|
const {createRequire, createRequireFromPath} = require(`module`);
|
||||||
const {resolve} = require(`path`);
|
const {resolve} = require(`path`);
|
||||||
|
|
||||||
const relPnpApiPath = "../../../../.pnp.js";
|
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||||
|
|
||||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||||
|
|
2
.yarn/sdks/eslint/package.json
vendored
2
.yarn/sdks/eslint/package.json
vendored
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "eslint",
|
"name": "eslint",
|
||||||
"version": "7.20.0-pnpify",
|
"version": "7.32.0-sdk",
|
||||||
"main": "./lib/api.js",
|
"main": "./lib/api.js",
|
||||||
"type": "commonjs"
|
"type": "commonjs"
|
||||||
}
|
}
|
||||||
|
|
4
.yarn/sdks/integrations.yml
vendored
4
.yarn/sdks/integrations.yml
vendored
|
@ -1,5 +1,5 @@
|
||||||
# This file is automatically generated by PnPify.
|
# This file is automatically generated by @yarnpkg/sdks.
|
||||||
# Manual changes will be lost!
|
# Manual changes might be lost!
|
||||||
|
|
||||||
integrations:
|
integrations:
|
||||||
- vscode
|
- vscode
|
||||||
|
|
14
.yarn/sdks/prettier/index.js
vendored
14
.yarn/sdks/prettier/index.js
vendored
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
const {existsSync} = require(`fs`);
|
const {existsSync} = require(`fs`);
|
||||||
const {createRequire, createRequireFromPath} = require(`module`);
|
const {createRequire, createRequireFromPath} = require(`module`);
|
||||||
const {resolve, dirname} = require(`path`);
|
const {resolve} = require(`path`);
|
||||||
|
|
||||||
const relPnpApiPath = "../../../.pnp.js";
|
const relPnpApiPath = "../../../.pnp.cjs";
|
||||||
|
|
||||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||||
|
@ -14,16 +14,6 @@ if (existsSync(absPnpApiPath)) {
|
||||||
// Setup the environment to be able to require prettier/index.js
|
// Setup the environment to be able to require prettier/index.js
|
||||||
require(absPnpApiPath).setup();
|
require(absPnpApiPath).setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
const pnpifyResolution = require.resolve(`@yarnpkg/pnpify`, {paths: [dirname(absPnpApiPath)]});
|
|
||||||
if (typeof global[`__yarnpkg_sdk_is_using_pnpify__`] === `undefined`) {
|
|
||||||
Object.defineProperty(global, `__yarnpkg_sdk_is_using_pnpify__`, {configurable: true, value: true});
|
|
||||||
|
|
||||||
process.env.NODE_OPTIONS += ` -r ${pnpifyResolution}`;
|
|
||||||
|
|
||||||
// Apply PnPify to the current process
|
|
||||||
absRequire(pnpifyResolution).patchFs();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defer to the real prettier/index.js your application uses
|
// Defer to the real prettier/index.js your application uses
|
||||||
|
|
2
.yarn/sdks/prettier/package.json
vendored
2
.yarn/sdks/prettier/package.json
vendored
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "prettier",
|
"name": "prettier",
|
||||||
"version": "2.2.1-pnpify",
|
"version": "2.4.1-sdk",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"type": "commonjs"
|
"type": "commonjs"
|
||||||
}
|
}
|
||||||
|
|
2
.yarn/sdks/typescript/bin/tsc
vendored
2
.yarn/sdks/typescript/bin/tsc
vendored
|
@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||||
const {createRequire, createRequireFromPath} = require(`module`);
|
const {createRequire, createRequireFromPath} = require(`module`);
|
||||||
const {resolve} = require(`path`);
|
const {resolve} = require(`path`);
|
||||||
|
|
||||||
const relPnpApiPath = "../../../../.pnp.js";
|
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||||
|
|
||||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||||
|
|
2
.yarn/sdks/typescript/bin/tsserver
vendored
2
.yarn/sdks/typescript/bin/tsserver
vendored
|
@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||||
const {createRequire, createRequireFromPath} = require(`module`);
|
const {createRequire, createRequireFromPath} = require(`module`);
|
||||||
const {resolve} = require(`path`);
|
const {resolve} = require(`path`);
|
||||||
|
|
||||||
const relPnpApiPath = "../../../../.pnp.js";
|
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||||
|
|
||||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||||
|
|
2
.yarn/sdks/typescript/lib/tsc.js
vendored
2
.yarn/sdks/typescript/lib/tsc.js
vendored
|
@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||||
const {createRequire, createRequireFromPath} = require(`module`);
|
const {createRequire, createRequireFromPath} = require(`module`);
|
||||||
const {resolve} = require(`path`);
|
const {resolve} = require(`path`);
|
||||||
|
|
||||||
const relPnpApiPath = "../../../../.pnp.js";
|
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||||
|
|
||||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||||
|
|
84
.yarn/sdks/typescript/lib/tsserver.js
vendored
84
.yarn/sdks/typescript/lib/tsserver.js
vendored
|
@ -4,15 +4,22 @@ const {existsSync} = require(`fs`);
|
||||||
const {createRequire, createRequireFromPath} = require(`module`);
|
const {createRequire, createRequireFromPath} = require(`module`);
|
||||||
const {resolve} = require(`path`);
|
const {resolve} = require(`path`);
|
||||||
|
|
||||||
const relPnpApiPath = "../../../../.pnp.js";
|
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||||
|
|
||||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||||
|
|
||||||
const moduleWrapper = tsserver => {
|
const moduleWrapper = tsserver => {
|
||||||
|
if (!process.versions.pnp) {
|
||||||
|
return tsserver;
|
||||||
|
}
|
||||||
|
|
||||||
const {isAbsolute} = require(`path`);
|
const {isAbsolute} = require(`path`);
|
||||||
const pnpApi = require(`pnpapi`);
|
const pnpApi = require(`pnpapi`);
|
||||||
|
|
||||||
|
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
|
||||||
|
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
|
||||||
|
|
||||||
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
||||||
return `${locator.name}@${locator.reference}`;
|
return `${locator.name}@${locator.reference}`;
|
||||||
}));
|
}));
|
||||||
|
@ -23,9 +30,9 @@ 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\//) || str.match(/\$\$virtual\//))) {
|
if (isAbsolute(str) && !str.match(/^\^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 is 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
|
||||||
// file instances instead of the real ones.
|
// file instances instead of the real ones.
|
||||||
//
|
//
|
||||||
|
@ -34,26 +41,49 @@ const moduleWrapper = tsserver => {
|
||||||
// with peer dep (otherwise jumping into react-dom would show resolution
|
// with peer dep (otherwise jumping into react-dom would show resolution
|
||||||
// errors on react).
|
// errors on react).
|
||||||
//
|
//
|
||||||
const resolved = pnpApi.resolveVirtual(str);
|
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
|
||||||
if (resolved) {
|
if (resolved) {
|
||||||
const locator = pnpApi.findPackageLocator(resolved);
|
const locator = pnpApi.findPackageLocator(resolved);
|
||||||
if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) {
|
if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) {
|
||||||
str = resolved;
|
str = resolved;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str.replace(/\\/g, `/`)
|
str = normalize(str);
|
||||||
str = str.replace(/^\/?/, `/`);
|
|
||||||
|
|
||||||
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
|
||||||
// VSCode only adds it automatically for supported schemes,
|
|
||||||
// so we have to do it manually for the `zip` scheme.
|
|
||||||
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
|
||||||
//
|
|
||||||
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
|
||||||
//
|
|
||||||
if (str.match(/\.zip\//)) {
|
if (str.match(/\.zip\//)) {
|
||||||
str = `${isVSCode ? `^` : ``}zip:${str}`;
|
switch (hostInfo) {
|
||||||
|
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
||||||
|
// VSCode only adds it automatically for supported schemes,
|
||||||
|
// so we have to do it manually for the `zip` scheme.
|
||||||
|
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
||||||
|
//
|
||||||
|
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
||||||
|
//
|
||||||
|
case `vscode`: {
|
||||||
|
str = `^zip:${str}`;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
// To make "go to definition" work,
|
||||||
|
// 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)
|
||||||
|
case `coc-nvim`: {
|
||||||
|
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||||
|
str = resolve(`zipfile:${str}`);
|
||||||
|
} break;
|
||||||
|
|
||||||
|
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
|
||||||
|
// We have to resolve the actual file system path from virtual path,
|
||||||
|
// everything else is up to neovim
|
||||||
|
case `neovim`: {
|
||||||
|
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||||
|
str = `zipfile:${str}`;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
str = `zip:${str}`;
|
||||||
|
} break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,15 +96,29 @@ const moduleWrapper = tsserver => {
|
||||||
: str.replace(/^\^?zip:/, ``);
|
: str.replace(/^\^?zip:/, ``);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force enable 'allowLocalPluginLoads'
|
||||||
|
// TypeScript tries to resolve plugins using a path relative to itself
|
||||||
|
// which doesn't work when using the global cache
|
||||||
|
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
|
||||||
|
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
|
||||||
|
// TypeScript already does local loads and if this code is running the user trusts the workspace
|
||||||
|
// https://github.com/microsoft/vscode/issues/45856
|
||||||
|
const ConfiguredProject = tsserver.server.ConfiguredProject;
|
||||||
|
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
|
||||||
|
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
|
||||||
|
this.projectService.allowLocalPluginLoads = true;
|
||||||
|
return originalEnablePluginsWithOptions.apply(this, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
// And here is the point where we hijack the VSCode <-> TS communications
|
// And here is the point where we hijack the VSCode <-> TS communications
|
||||||
// by adding ourselves in the middle. We locate everything that looks
|
// by adding ourselves in the middle. We locate everything that looks
|
||||||
// like an absolute path of ours and normalize it.
|
// like an absolute path of ours and normalize it.
|
||||||
|
|
||||||
const Session = tsserver.server.Session;
|
const Session = tsserver.server.Session;
|
||||||
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
||||||
let isVSCode = false;
|
let hostInfo = `unknown`;
|
||||||
|
|
||||||
return Object.assign(Session.prototype, {
|
Object.assign(Session.prototype, {
|
||||||
onMessage(/** @type {string} */ message) {
|
onMessage(/** @type {string} */ message) {
|
||||||
const parsedMessage = JSON.parse(message)
|
const parsedMessage = JSON.parse(message)
|
||||||
|
|
||||||
|
@ -82,9 +126,9 @@ const moduleWrapper = tsserver => {
|
||||||
parsedMessage != null &&
|
parsedMessage != null &&
|
||||||
typeof parsedMessage === `object` &&
|
typeof parsedMessage === `object` &&
|
||||||
parsedMessage.arguments &&
|
parsedMessage.arguments &&
|
||||||
parsedMessage.arguments.hostInfo === `vscode`
|
typeof parsedMessage.arguments.hostInfo === `string`
|
||||||
) {
|
) {
|
||||||
isVSCode = true;
|
hostInfo = parsedMessage.arguments.hostInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {
|
return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {
|
||||||
|
@ -98,6 +142,8 @@ const moduleWrapper = tsserver => {
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return tsserver;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (existsSync(absPnpApiPath)) {
|
if (existsSync(absPnpApiPath)) {
|
||||||
|
|
157
.yarn/sdks/typescript/lib/tsserverlibrary.js
vendored
Normal file
157
.yarn/sdks/typescript/lib/tsserverlibrary.js
vendored
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const {existsSync} = require(`fs`);
|
||||||
|
const {createRequire, createRequireFromPath} = require(`module`);
|
||||||
|
const {resolve} = require(`path`);
|
||||||
|
|
||||||
|
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||||
|
|
||||||
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||||
|
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||||
|
|
||||||
|
const moduleWrapper = tsserver => {
|
||||||
|
if (!process.versions.pnp) {
|
||||||
|
return tsserver;
|
||||||
|
}
|
||||||
|
|
||||||
|
const {isAbsolute} = require(`path`);
|
||||||
|
const pnpApi = require(`pnpapi`);
|
||||||
|
|
||||||
|
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
|
||||||
|
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
|
||||||
|
|
||||||
|
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
||||||
|
return `${locator.name}@${locator.reference}`;
|
||||||
|
}));
|
||||||
|
|
||||||
|
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
|
||||||
|
// doesn't understand. This layer makes sure to remove the protocol
|
||||||
|
// before forwarding it to TS, and to add it back on all returned paths.
|
||||||
|
|
||||||
|
function toEditorPath(str) {
|
||||||
|
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
|
||||||
|
if (isAbsolute(str) && !str.match(/^\^zip:/) && (str.match(/\.zip\//) || isVirtual(str))) {
|
||||||
|
// We also take the opportunity to turn virtual paths into physical ones;
|
||||||
|
// this makes it much easier to work with workspaces that list peer
|
||||||
|
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
|
||||||
|
// file instances instead of the real ones.
|
||||||
|
//
|
||||||
|
// We only do this to modules owned by the the dependency tree roots.
|
||||||
|
// This avoids breaking the resolution when jumping inside a vendor
|
||||||
|
// with peer dep (otherwise jumping into react-dom would show resolution
|
||||||
|
// errors on react).
|
||||||
|
//
|
||||||
|
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
|
||||||
|
if (resolved) {
|
||||||
|
const locator = pnpApi.findPackageLocator(resolved);
|
||||||
|
if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) {
|
||||||
|
str = resolved;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
str = normalize(str);
|
||||||
|
|
||||||
|
if (str.match(/\.zip\//)) {
|
||||||
|
switch (hostInfo) {
|
||||||
|
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
||||||
|
// VSCode only adds it automatically for supported schemes,
|
||||||
|
// so we have to do it manually for the `zip` scheme.
|
||||||
|
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
||||||
|
//
|
||||||
|
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
||||||
|
//
|
||||||
|
case `vscode`: {
|
||||||
|
str = `^zip:${str}`;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
// To make "go to definition" work,
|
||||||
|
// 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)
|
||||||
|
case `coc-nvim`: {
|
||||||
|
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||||
|
str = resolve(`zipfile:${str}`);
|
||||||
|
} break;
|
||||||
|
|
||||||
|
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
|
||||||
|
// We have to resolve the actual file system path from virtual path,
|
||||||
|
// everything else is up to neovim
|
||||||
|
case `neovim`: {
|
||||||
|
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
||||||
|
str = `zipfile:${str}`;
|
||||||
|
} break;
|
||||||
|
|
||||||
|
default: {
|
||||||
|
str = `zip:${str}`;
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fromEditorPath(str) {
|
||||||
|
return process.platform === `win32`
|
||||||
|
? str.replace(/^\^?zip:\//, ``)
|
||||||
|
: str.replace(/^\^?zip:/, ``);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force enable 'allowLocalPluginLoads'
|
||||||
|
// TypeScript tries to resolve plugins using a path relative to itself
|
||||||
|
// which doesn't work when using the global cache
|
||||||
|
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
|
||||||
|
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
|
||||||
|
// TypeScript already does local loads and if this code is running the user trusts the workspace
|
||||||
|
// https://github.com/microsoft/vscode/issues/45856
|
||||||
|
const ConfiguredProject = tsserver.server.ConfiguredProject;
|
||||||
|
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
|
||||||
|
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
|
||||||
|
this.projectService.allowLocalPluginLoads = true;
|
||||||
|
return originalEnablePluginsWithOptions.apply(this, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
// And here is the point where we hijack the VSCode <-> TS communications
|
||||||
|
// by adding ourselves in the middle. We locate everything that looks
|
||||||
|
// like an absolute path of ours and normalize it.
|
||||||
|
|
||||||
|
const Session = tsserver.server.Session;
|
||||||
|
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
||||||
|
let hostInfo = `unknown`;
|
||||||
|
|
||||||
|
Object.assign(Session.prototype, {
|
||||||
|
onMessage(/** @type {string} */ message) {
|
||||||
|
const parsedMessage = JSON.parse(message)
|
||||||
|
|
||||||
|
if (
|
||||||
|
parsedMessage != null &&
|
||||||
|
typeof parsedMessage === `object` &&
|
||||||
|
parsedMessage.arguments &&
|
||||||
|
typeof parsedMessage.arguments.hostInfo === `string`
|
||||||
|
) {
|
||||||
|
hostInfo = parsedMessage.arguments.hostInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => {
|
||||||
|
return typeof value === `string` ? fromEditorPath(value) : value;
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
send(/** @type {any} */ msg) {
|
||||||
|
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
|
||||||
|
return typeof value === `string` ? toEditorPath(value) : value;
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return tsserver;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (existsSync(absPnpApiPath)) {
|
||||||
|
if (!process.versions.pnp) {
|
||||||
|
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
|
||||||
|
require(absPnpApiPath).setup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defer to the real typescript/lib/tsserverlibrary.js your application uses
|
||||||
|
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));
|
2
.yarn/sdks/typescript/lib/typescript.js
vendored
2
.yarn/sdks/typescript/lib/typescript.js
vendored
|
@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
|
||||||
const {createRequire, createRequireFromPath} = require(`module`);
|
const {createRequire, createRequireFromPath} = require(`module`);
|
||||||
const {resolve} = require(`path`);
|
const {resolve} = require(`path`);
|
||||||
|
|
||||||
const relPnpApiPath = "../../../../.pnp.js";
|
const relPnpApiPath = "../../../../.pnp.cjs";
|
||||||
|
|
||||||
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
||||||
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
|
||||||
|
|
2
.yarn/sdks/typescript/package.json
vendored
2
.yarn/sdks/typescript/package.json
vendored
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "typescript",
|
"name": "typescript",
|
||||||
"version": "4.1.5-pnpify",
|
"version": "4.4.3-sdk",
|
||||||
"main": "./lib/typescript.js",
|
"main": "./lib/typescript.js",
|
||||||
"type": "commonjs"
|
"type": "commonjs"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
# SPDX-FileCopyrightText: 2021 Johannes Loher
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
nodeLinker: pnp
|
nodeLinker: pnp
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||||
spec: "@yarnpkg/plugin-interactive-tools"
|
spec: "@yarnpkg/plugin-interactive-tools"
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-2.4.2.cjs
|
yarnPath: .yarn/releases/yarn-3.0.2.cjs
|
||||||
|
|
3
.yarnrc.yml.license
Normal file
3
.yarnrc.yml.license
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
SPDX-FileCopyrightText: 2021 Johannes Loher
|
||||||
|
|
||||||
|
SPDX-License-Identifier: MIT
|
|
@ -31,7 +31,7 @@
|
||||||
"postinstall": "husky install"
|
"postinstall": "husky install"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@league-of-foundry-developers/foundry-vtt-types": "0.7.9-6",
|
"@league-of-foundry-developers/foundry-vtt-types": "0.8.9-3",
|
||||||
"@rollup/plugin-node-resolve": "13.0.4",
|
"@rollup/plugin-node-resolve": "13.0.4",
|
||||||
"@types/fs-extra": "9.0.12",
|
"@types/fs-extra": "9.0.12",
|
||||||
"@typescript-eslint/eslint-plugin": "4.31.2",
|
"@typescript-eslint/eslint-plugin": "4.31.2",
|
||||||
|
@ -56,5 +56,6 @@
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.(ts|js)": "eslint --fix",
|
"*.(ts|js)": "eslint --fix",
|
||||||
"*.json": "prettier --write"
|
"*.json": "prettier --write"
|
||||||
}
|
},
|
||||||
|
"packageManager": "yarn@3.0.2"
|
||||||
}
|
}
|
||||||
|
|
15
src/module/global.d.ts
vendored
Normal file
15
src/module/global.d.ts
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// SPDX-FileCopyrightText: 2021 Johannes Loher <johannes.loher@fg4f.de>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
import { risk } from './risk';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace Die {
|
||||||
|
interface Modifiers {
|
||||||
|
ri: typeof risk;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
Reference in a new issue