aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2021-09-25 19:49:37 +0000
committerKevin J Hoerr <kjhoerr@protonmail.com>2021-09-25 19:49:37 +0000
commit79ef182b6c3efc074422aed01c668bdef2f30676 (patch)
tree199feec6ac134021aa3fbe888176e321719a1b21
parent4228765100aeca3d0ae170621335631ffb784753 (diff)
downloadao-coverage-79ef182b6c3efc074422aed01c668bdef2f30676.tar.gz
ao-coverage-79ef182b6c3efc074422aed01c668bdef2f30676.tar.bz2
ao-coverage-79ef182b6c3efc074422aed01c668bdef2f30676.zip
Move to Plug'n'Play over node_modules
-rw-r--r--.devcontainer/devcontainer.json2
-rw-r--r--.devcontainer/docker-compose.yml1
-rw-r--r--.gitignore1
-rw-r--r--.vscode/extensions.json7
-rw-r--r--.vscode/launch.json20
-rw-r--r--.vscode/settings.json10
-rw-r--r--.yarn/cache/@types-node-npm-16.10.1-60de6357e2-84d7f082e9.zipbin0 -> 325554 bytes
-rwxr-xr-x.yarn/sdks/eslint/bin/eslint.js20
-rw-r--r--.yarn/sdks/eslint/lib/api.js20
-rw-r--r--.yarn/sdks/eslint/package.json6
-rw-r--r--.yarn/sdks/integrations.yml5
-rwxr-xr-x.yarn/sdks/prettier/index.js20
-rw-r--r--.yarn/sdks/prettier/package.json6
-rwxr-xr-x.yarn/sdks/typescript/bin/tsc20
-rwxr-xr-x.yarn/sdks/typescript/bin/tsserver20
-rw-r--r--.yarn/sdks/typescript/lib/tsc.js20
-rw-r--r--.yarn/sdks/typescript/lib/tsserver.js157
-rw-r--r--.yarn/sdks/typescript/lib/tsserverlibrary.js157
-rw-r--r--.yarn/sdks/typescript/lib/typescript.js20
-rw-r--r--.yarn/sdks/typescript/package.json6
-rw-r--r--.yarnrc.yml2
-rw-r--r--CHANGELOG.md8
-rw-r--r--Dockerfile8
-rw-r--r--package.json7
-rw-r--r--src/util/config.test.ts1
-rw-r--r--yarn.lock8
26 files changed, 539 insertions, 13 deletions
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index c16b503..407f7ed 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -15,6 +15,6 @@
"esbenp.prettier-vscode"
],
"forwardPorts": [3000, 27017],
- "postCreateCommand": "sudo chown node:node node_modules; yarn install",
+ "postCreateCommand": "yarn install",
"remoteUser": "node"
} \ No newline at end of file
diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml
index 3f03bc3..42a5823 100644
--- a/.devcontainer/docker-compose.yml
+++ b/.devcontainer/docker-compose.yml
@@ -34,7 +34,6 @@ services:
volumes:
- ..:/workspace:cached
- - node-nm:/workspace/node_modules:cached
- dev-dist:/dist:cached
# Overrides default command so things don't shut down after the process ends.
diff --git a/.gitignore b/.gitignore
index b4295de..9f2bd1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,6 @@ dist
build
coverage
docs
-.vscode
tsconfig.tsbuildinfo
.env*
!.env.sample
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..daaa5ee
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,7 @@
+{
+ "recommendations": [
+ "arcanis.vscode-zipfs",
+ "dbaeumer.vscode-eslint",
+ "esbenp.prettier-vscode"
+ ]
+}
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..7576274
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,20 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "pwa-node",
+ "request": "launch",
+ "name": "Launch Program",
+ "skipFiles": [
+ "<node_internals>/**"
+ ],
+ "program": "${workspaceFolder}/src/util/config.ts",
+ "outFiles": [
+ "${workspaceFolder}/**/*.js"
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..6278784
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,10 @@
+{
+ "search.exclude": {
+ "**/.yarn": true,
+ "**/.pnp.*": true
+ },
+ "eslint.nodePath": ".yarn/sdks",
+ "prettier.prettierPath": ".yarn/sdks/prettier/index.js",
+ "typescript.tsdk": ".yarn/sdks/typescript/lib",
+ "typescript.enablePromptUseWorkspaceTsdk": true
+}
diff --git a/.yarn/cache/@types-node-npm-16.10.1-60de6357e2-84d7f082e9.zip b/.yarn/cache/@types-node-npm-16.10.1-60de6357e2-84d7f082e9.zip
new file mode 100644
index 0000000..3703ebf
--- /dev/null
+++ b/.yarn/cache/@types-node-npm-16.10.1-60de6357e2-84d7f082e9.zip
Binary files differ
diff --git a/.yarn/sdks/eslint/bin/eslint.js b/.yarn/sdks/eslint/bin/eslint.js
new file mode 100755
index 0000000..4d327a4
--- /dev/null
+++ b/.yarn/sdks/eslint/bin/eslint.js
@@ -0,0 +1,20 @@
+#!/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);
+
+if (existsSync(absPnpApiPath)) {
+ if (!process.versions.pnp) {
+ // Setup the environment to be able to require eslint/bin/eslint.js
+ require(absPnpApiPath).setup();
+ }
+}
+
+// Defer to the real eslint/bin/eslint.js your application uses
+module.exports = absRequire(`eslint/bin/eslint.js`);
diff --git a/.yarn/sdks/eslint/lib/api.js b/.yarn/sdks/eslint/lib/api.js
new file mode 100644
index 0000000..97a0524
--- /dev/null
+++ b/.yarn/sdks/eslint/lib/api.js
@@ -0,0 +1,20 @@
+#!/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);
+
+if (existsSync(absPnpApiPath)) {
+ if (!process.versions.pnp) {
+ // Setup the environment to be able to require eslint/lib/api.js
+ require(absPnpApiPath).setup();
+ }
+}
+
+// Defer to the real eslint/lib/api.js your application uses
+module.exports = absRequire(`eslint/lib/api.js`);
diff --git a/.yarn/sdks/eslint/package.json b/.yarn/sdks/eslint/package.json
new file mode 100644
index 0000000..744a773
--- /dev/null
+++ b/.yarn/sdks/eslint/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "eslint",
+ "version": "7.32.0-sdk",
+ "main": "./lib/api.js",
+ "type": "commonjs"
+}
diff --git a/.yarn/sdks/integrations.yml b/.yarn/sdks/integrations.yml
new file mode 100644
index 0000000..aa9d0d0
--- /dev/null
+++ b/.yarn/sdks/integrations.yml
@@ -0,0 +1,5 @@
+# This file is automatically generated by @yarnpkg/sdks.
+# Manual changes might be lost!
+
+integrations:
+ - vscode
diff --git a/.yarn/sdks/prettier/index.js b/.yarn/sdks/prettier/index.js
new file mode 100755
index 0000000..f6882d8
--- /dev/null
+++ b/.yarn/sdks/prettier/index.js
@@ -0,0 +1,20 @@
+#!/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);
+
+if (existsSync(absPnpApiPath)) {
+ if (!process.versions.pnp) {
+ // Setup the environment to be able to require prettier/index.js
+ require(absPnpApiPath).setup();
+ }
+}
+
+// Defer to the real prettier/index.js your application uses
+module.exports = absRequire(`prettier/index.js`);
diff --git a/.yarn/sdks/prettier/package.json b/.yarn/sdks/prettier/package.json
new file mode 100644
index 0000000..fdd19b5
--- /dev/null
+++ b/.yarn/sdks/prettier/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "prettier",
+ "version": "2.4.1-sdk",
+ "main": "./index.js",
+ "type": "commonjs"
+}
diff --git a/.yarn/sdks/typescript/bin/tsc b/.yarn/sdks/typescript/bin/tsc
new file mode 100755
index 0000000..5608e57
--- /dev/null
+++ b/.yarn/sdks/typescript/bin/tsc
@@ -0,0 +1,20 @@
+#!/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);
+
+if (existsSync(absPnpApiPath)) {
+ if (!process.versions.pnp) {
+ // Setup the environment to be able to require typescript/bin/tsc
+ require(absPnpApiPath).setup();
+ }
+}
+
+// Defer to the real typescript/bin/tsc your application uses
+module.exports = absRequire(`typescript/bin/tsc`);
diff --git a/.yarn/sdks/typescript/bin/tsserver b/.yarn/sdks/typescript/bin/tsserver
new file mode 100755
index 0000000..cd7d557
--- /dev/null
+++ b/.yarn/sdks/typescript/bin/tsserver
@@ -0,0 +1,20 @@
+#!/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);
+
+if (existsSync(absPnpApiPath)) {
+ if (!process.versions.pnp) {
+ // Setup the environment to be able to require typescript/bin/tsserver
+ require(absPnpApiPath).setup();
+ }
+}
+
+// Defer to the real typescript/bin/tsserver your application uses
+module.exports = absRequire(`typescript/bin/tsserver`);
diff --git a/.yarn/sdks/typescript/lib/tsc.js b/.yarn/sdks/typescript/lib/tsc.js
new file mode 100644
index 0000000..16042d0
--- /dev/null
+++ b/.yarn/sdks/typescript/lib/tsc.js
@@ -0,0 +1,20 @@
+#!/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);
+
+if (existsSync(absPnpApiPath)) {
+ if (!process.versions.pnp) {
+ // Setup the environment to be able to require typescript/lib/tsc.js
+ require(absPnpApiPath).setup();
+ }
+}
+
+// Defer to the real typescript/lib/tsc.js your application uses
+module.exports = absRequire(`typescript/lib/tsc.js`);
diff --git a/.yarn/sdks/typescript/lib/tsserver.js b/.yarn/sdks/typescript/lib/tsserver.js
new file mode 100644
index 0000000..4d90f38
--- /dev/null
+++ b/.yarn/sdks/typescript/lib/tsserver.js
@@ -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/tsserver.js
+ require(absPnpApiPath).setup();
+ }
+}
+
+// Defer to the real typescript/lib/tsserver.js your application uses
+module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));
diff --git a/.yarn/sdks/typescript/lib/tsserverlibrary.js b/.yarn/sdks/typescript/lib/tsserverlibrary.js
new file mode 100644
index 0000000..c3de4ff
--- /dev/null
+++ b/.yarn/sdks/typescript/lib/tsserverlibrary.js
@@ -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`));
diff --git a/.yarn/sdks/typescript/lib/typescript.js b/.yarn/sdks/typescript/lib/typescript.js
new file mode 100644
index 0000000..cbdbf15
--- /dev/null
+++ b/.yarn/sdks/typescript/lib/typescript.js
@@ -0,0 +1,20 @@
+#!/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);
+
+if (existsSync(absPnpApiPath)) {
+ if (!process.versions.pnp) {
+ // Setup the environment to be able to require typescript/lib/typescript.js
+ require(absPnpApiPath).setup();
+ }
+}
+
+// Defer to the real typescript/lib/typescript.js your application uses
+module.exports = absRequire(`typescript/lib/typescript.js`);
diff --git a/.yarn/sdks/typescript/package.json b/.yarn/sdks/typescript/package.json
new file mode 100644
index 0000000..1a10512
--- /dev/null
+++ b/.yarn/sdks/typescript/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "typescript",
+ "version": "4.4.3-sdk",
+ "main": "./lib/typescript.js",
+ "type": "commonjs"
+}
diff --git a/.yarnrc.yml b/.yarnrc.yml
index 40d8966..07cb92a 100644
--- a/.yarnrc.yml
+++ b/.yarnrc.yml
@@ -1,7 +1,5 @@
enableTelemetry: 0
-nodeLinker: node-modules
-
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f59c551..2712b18 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+### Added
+
+- Lint check during pipeline
+
+### Changed
+
+- Moved to using Plug'n'Play over node_modules
+
## [0.5.3]
### Added
diff --git a/Dockerfile b/Dockerfile
index 9af85dd..c9d783f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -23,13 +23,11 @@ WORKDIR /app
COPY --from=dependencies /app/package.json ./
COPY --from=dependencies /app/yarn.lock ./
COPY --from=dependencies /app/.yarnrc.yml ./
-COPY --from=dependencies /app/.yarn/releases ./.yarn/releases
COPY --from=dependencies /app/.yarn/cache ./.yarn/cache
COPY --from=dependencies /app/.yarn/plugins ./.yarn/plugins
+COPY --from=dependencies /app/.yarn/releases ./.yarn/releases
RUN yarn install \
- && yarn workspaces focus -A --production \
- && yarn cache clean \
- && rm -r yarn.lock .yarn
+ && yarn workspaces focus -A --production
COPY --from=build /app/build ./build
COPY public ./public
@@ -44,4 +42,4 @@ RUN mkdir -p ${HOST_DIR}
VOLUME [ "${HOST_DIR}" ]
EXPOSE ${PORT}
-CMD [ "node", "./build/index.js" ]
+CMD [ "yarn", "node", "./build/index.js" ]
diff --git a/package.json b/package.json
index da60a5d..eeb2e80 100644
--- a/package.json
+++ b/package.json
@@ -8,9 +8,9 @@
},
"main": "build/index.js",
"scripts": {
- "start:dev": "tsc-watch --onSuccess \"node ./build/index.js\"",
- "start": "tsc && node ./build/index.js",
- "start:prod": "tsc && NODE_ENV=production node ./build/index.js",
+ "start:dev": "tsc-watch --onSuccess \"yarn node ./build/index.js\"",
+ "start": "tsc && yarn node ./build/index.js",
+ "start:prod": "tsc && NODE_ENV=production yarn node ./build/index.js",
"format": "prettier --write 'src/**/*.ts'",
"lint": "eslint 'src/**/*.ts'",
"lint:fix": "eslint --fix 'src/**/*.ts'",
@@ -41,6 +41,7 @@
"@types/express": "^4.17.13",
"@types/jest": "^27.0.1",
"@types/jsdom": "^16.2.13",
+ "@types/node": "^16.10.1",
"@types/supertest": "^2.0.11",
"@types/triple-beam": "^1.3.2",
"@types/uuid": "^8.3.1",
diff --git a/src/util/config.test.ts b/src/util/config.test.ts
index 21d4041..0e7e69e 100644
--- a/src/util/config.test.ts
+++ b/src/util/config.test.ts
@@ -146,6 +146,7 @@ const ServerMock = (mockErr: Error | undefined): jest.Mock<Server, void[]> =>
},
maxHeadersCount: 0,
maxConnections: 0,
+ maxRequestsPerSocket: 0,
listen: jest.fn(),
listening: true,
address: jest.fn(),
diff --git a/yarn.lock b/yarn.lock
index f62d313..bb58156 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -960,6 +960,13 @@ __metadata:
languageName: node
linkType: hard
+"@types/node@npm:^16.10.1":
+ version: 16.10.1
+ resolution: "@types/node@npm:16.10.1"
+ checksum: 84d7f082e9421fdf1f08dbe00b66848897b2675eacc94a4fa445c4d34cef57c901ecd3276d03ebe110607a848d3df0ab33816aeff51a234e036111dd8ef1422f
+ languageName: node
+ linkType: hard
+
"@types/parse5@npm:*":
version: 6.0.1
resolution: "@types/parse5@npm:6.0.1"
@@ -1388,6 +1395,7 @@ __metadata:
"@types/express": ^4.17.13
"@types/jest": ^27.0.1
"@types/jsdom": ^16.2.13
+ "@types/node": ^16.10.1
"@types/supertest": ^2.0.11
"@types/triple-beam": ^1.3.2
"@types/uuid": ^8.3.1