Fix spdlog and node-pty in binary
This commit is contained in:
parent
1e55736c69
commit
eaea947318
@ -82,7 +82,7 @@ const buildServerBinaryCopy = register("build:server:binary:copy", async (runner
|
|||||||
const webOutputPath = path.join(pkgsPath, "web", "out");
|
const webOutputPath = path.join(pkgsPath, "web", "out");
|
||||||
const browserAppOutputPath = path.join(pkgsPath, "app", "browser", "out");
|
const browserAppOutputPath = path.join(pkgsPath, "app", "browser", "out");
|
||||||
const nodePtyModule = path.join(pkgsPath, "protocol", "node_modules", "node-pty", "build", "Release", "pty.node");
|
const nodePtyModule = path.join(pkgsPath, "protocol", "node_modules", "node-pty", "build", "Release", "pty.node");
|
||||||
const spdlogModule = path.join(pkgsPath, "server", "node_modules", "spdlog", "build", "Release", "spdlog.node");
|
const spdlogModule = path.join(pkgsPath, "protocol", "node_modules", "spdlog", "build", "Release", "spdlog.node");
|
||||||
|
|
||||||
if (!fs.existsSync(nodePtyModule)) {
|
if (!fs.existsSync(nodePtyModule)) {
|
||||||
throw new Error("Could not find pty.node. Ensure all packages have been installed");
|
throw new Error("Could not find pty.node. Ensure all packages have been installed");
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-loader": "^0.6.0",
|
"node-loader": "^0.6.0",
|
||||||
"spdlog": "^0.7.2",
|
|
||||||
"trash": "^4.3.0",
|
"trash": "^4.3.0",
|
||||||
"webpack-merge": "^4.2.1"
|
"webpack-merge": "^4.2.1"
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"express": "^4.16.4",
|
"express": "^4.16.4",
|
||||||
"google-protobuf": "^3.6.1",
|
"google-protobuf": "^3.6.1",
|
||||||
"node-pty": "^0.8.1",
|
"node-pty": "^0.8.1",
|
||||||
|
"spdlog": "^0.7.2",
|
||||||
"tslib": "^1.9.3",
|
"tslib": "^1.9.3",
|
||||||
"ws": "^6.1.2"
|
"ws": "^6.1.2"
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/// <reference path="../../../../lib/vscode/src/typings/spdlog.d.ts" />
|
||||||
import { ChildProcess, SpawnOptions, ForkOptions } from "child_process";
|
import { ChildProcess, SpawnOptions, ForkOptions } from "child_process";
|
||||||
import { EventEmitter } from "events";
|
import { EventEmitter } from "events";
|
||||||
import { Socket } from "net";
|
import { Socket } from "net";
|
||||||
@ -7,9 +8,6 @@ import { logger } from "@coder/logger";
|
|||||||
|
|
||||||
// tslint:disable no-any
|
// tslint:disable no-any
|
||||||
|
|
||||||
declare var __non_webpack_require__: typeof require;
|
|
||||||
declare var __webpack_require__: typeof require;
|
|
||||||
|
|
||||||
export type ForkProvider = (modulePath: string, args: string[], options: ForkOptions) => ChildProcess;
|
export type ForkProvider = (modulePath: string, args: string[], options: ForkOptions) => ChildProcess;
|
||||||
|
|
||||||
export interface Disposer extends IDisposable {
|
export interface Disposer extends IDisposable {
|
||||||
@ -26,6 +24,19 @@ interface ActiveEvalEmitter {
|
|||||||
* Helper class for server-side evaluations.
|
* Helper class for server-side evaluations.
|
||||||
*/
|
*/
|
||||||
export class EvalHelper {
|
export class EvalHelper {
|
||||||
|
// For any non-external modules that are not built in, we need to require and
|
||||||
|
// access them here. A require on the client-side won't work since that code
|
||||||
|
// won't exist on the server (and bloat the client with an unused import), and
|
||||||
|
// we can't manually import on the server-side and then call
|
||||||
|
// `__webpack_require__` on the client-side because Webpack stores modules by
|
||||||
|
// their paths which would require us to hard-code the path. These aren't
|
||||||
|
// required immediately so we have a chance to unpack the .node files and set
|
||||||
|
// their locations.
|
||||||
|
public modules = {
|
||||||
|
spdlog: require("spdlog") as typeof import("spdlog"),
|
||||||
|
pty: require("node-pty") as typeof import("node-pty"),
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some spawn code tries to preserve the env (the debug adapter for instance)
|
* Some spawn code tries to preserve the env (the debug adapter for instance)
|
||||||
* but the env is mostly blank (since we're in the browser), so we'll just
|
* but the env is mostly blank (since we're in the browser), so we'll just
|
||||||
@ -38,29 +49,6 @@ export class EvalHelper {
|
|||||||
options.env = { ...process.env, ...options.env };
|
options.env = { ...process.env, ...options.env };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Try a non-webpack require, then a webpack require if that fails.
|
|
||||||
*/
|
|
||||||
public require(modulePath: string): any {
|
|
||||||
logger.info(`Attempting to require ${modulePath}`);
|
|
||||||
try {
|
|
||||||
return __non_webpack_require__(modulePath);
|
|
||||||
} catch (error) { /* Nothing. */ }
|
|
||||||
|
|
||||||
logger.warn(`Non-webpack require failed for ${modulePath}`);
|
|
||||||
try {
|
|
||||||
return __webpack_require__(modulePath);
|
|
||||||
} catch (error) { /* Nothing. */ }
|
|
||||||
|
|
||||||
logger.warn(`Webpack require failed for ${modulePath}`);
|
|
||||||
try {
|
|
||||||
return require(modulePath);
|
|
||||||
} catch (error) {
|
|
||||||
logger.error(`Failed to require ${modulePath}`);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,20 +113,17 @@ export class ActiveEvalHelper implements ActiveEvalEmitter {
|
|||||||
* Helper class for server-side active evaluations.
|
* Helper class for server-side active evaluations.
|
||||||
*/
|
*/
|
||||||
export class ServerActiveEvalHelper extends ActiveEvalHelper implements EvalHelper {
|
export class ServerActiveEvalHelper extends ActiveEvalHelper implements EvalHelper {
|
||||||
private readonly evalHelper: EvalHelper;
|
private readonly evalHelper = new EvalHelper();
|
||||||
|
public modules = this.evalHelper.modules;
|
||||||
|
|
||||||
public constructor(emitter: ActiveEvalEmitter, public readonly fork: ForkProvider) {
|
public constructor(emitter: ActiveEvalEmitter, public readonly fork: ForkProvider) {
|
||||||
super(emitter);
|
super(emitter);
|
||||||
this.evalHelper = new EvalHelper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public preserveEnv(options: SpawnOptions | ForkOptions): void {
|
public preserveEnv(options: SpawnOptions | ForkOptions): void {
|
||||||
this.evalHelper.preserveEnv(options);
|
this.evalHelper.preserveEnv(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public require(modulePath: string): any {
|
|
||||||
return this.evalHelper.require(modulePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If there is a callback ID, return a function that emits the callback event
|
* If there is a callback ID, return a function that emits the callback event
|
||||||
* on the active evaluation with that ID and all arguments passed to it.
|
* on the active evaluation with that ID and all arguments passed to it.
|
||||||
|
@ -30,6 +30,13 @@ async-limiter@~1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
|
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8"
|
||||||
integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==
|
integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==
|
||||||
|
|
||||||
|
bindings@^1.3.0:
|
||||||
|
version "1.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.4.0.tgz#909efa49f2ebe07ecd3cb136778f665052040127"
|
||||||
|
integrity sha512-7znEVX22Djn+nYjxCWKDne0RRloa9XfYa84yk3s+HkE3LpDYZmhArYr9O9huBoHY3/oXispx5LorIX7Sl2CgSQ==
|
||||||
|
dependencies:
|
||||||
|
file-uri-to-path "1.0.0"
|
||||||
|
|
||||||
body-parser@1.18.3:
|
body-parser@1.18.3:
|
||||||
version "1.18.3"
|
version "1.18.3"
|
||||||
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.3.tgz#5b292198ffdd553b3a0f20ded0592b956955c8b4"
|
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.3.tgz#5b292198ffdd553b3a0f20ded0592b956955c8b4"
|
||||||
@ -144,6 +151,11 @@ express@^4.16.4:
|
|||||||
utils-merge "1.0.1"
|
utils-merge "1.0.1"
|
||||||
vary "~1.1.2"
|
vary "~1.1.2"
|
||||||
|
|
||||||
|
file-uri-to-path@1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
|
||||||
|
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
|
||||||
|
|
||||||
finalhandler@1.1.1:
|
finalhandler@1.1.1:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.1.tgz#eebf4ed840079c83f4249038c9d703008301b105"
|
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.1.tgz#eebf4ed840079c83f4249038c9d703008301b105"
|
||||||
@ -231,12 +243,24 @@ mime@1.4.1:
|
|||||||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6"
|
resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6"
|
||||||
integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==
|
integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==
|
||||||
|
|
||||||
|
minimist@0.0.8:
|
||||||
|
version "0.0.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
|
||||||
|
integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=
|
||||||
|
|
||||||
|
mkdirp@^0.5.1:
|
||||||
|
version "0.5.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
|
||||||
|
integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=
|
||||||
|
dependencies:
|
||||||
|
minimist "0.0.8"
|
||||||
|
|
||||||
ms@2.0.0:
|
ms@2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||||
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
|
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
|
||||||
|
|
||||||
nan@2.12.1:
|
nan@2.12.1, nan@^2.8.0:
|
||||||
version "2.12.1"
|
version "2.12.1"
|
||||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552"
|
resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552"
|
||||||
integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==
|
integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==
|
||||||
@ -342,6 +366,15 @@ setprototypeof@1.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656"
|
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656"
|
||||||
integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==
|
integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==
|
||||||
|
|
||||||
|
spdlog@^0.7.2:
|
||||||
|
version "0.7.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/spdlog/-/spdlog-0.7.2.tgz#9298753d7694b9ee9bbfd7e01ea1e4c6ace1e64d"
|
||||||
|
integrity sha512-rHfWCaWMD4NindDnql6rc6kn7Bs8JR92jhiUpCl3D6v+jYcQ6GozMLig0RliOOR8st5mU+IHLZnr15fBys5x/Q==
|
||||||
|
dependencies:
|
||||||
|
bindings "^1.3.0"
|
||||||
|
mkdirp "^0.5.1"
|
||||||
|
nan "^2.8.0"
|
||||||
|
|
||||||
"statuses@>= 1.4.0 < 2":
|
"statuses@>= 1.4.0 < 2":
|
||||||
version "1.5.0"
|
version "1.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
|
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
"node-netstat": "^1.6.0",
|
"node-netstat": "^1.6.0",
|
||||||
"pem": "^1.14.1",
|
"pem": "^1.14.1",
|
||||||
"promise.prototype.finally": "^3.1.0",
|
"promise.prototype.finally": "^3.1.0",
|
||||||
"spdlog": "^0.7.2",
|
|
||||||
"ws": "^6.1.2",
|
"ws": "^6.1.2",
|
||||||
"xhr2": "^0.1.4"
|
"xhr2": "^0.1.4"
|
||||||
},
|
},
|
||||||
|
@ -80,7 +80,6 @@ export class Entry extends Command {
|
|||||||
if (!fs.existsSync(dataDir)) {
|
if (!fs.existsSync(dataDir)) {
|
||||||
fs.mkdirSync(dataDir);
|
fs.mkdirSync(dataDir);
|
||||||
}
|
}
|
||||||
require("spdlog");
|
|
||||||
|
|
||||||
const logDir = path.join(dataDir, "logs", new Date().toISOString().replace(/[-:.TZ]/g, ""));
|
const logDir = path.join(dataDir, "logs", new Date().toISOString().replace(/[-:.TZ]/g, ""));
|
||||||
process.env.VSCODE_LOGS = logDir;
|
process.env.VSCODE_LOGS = logDir;
|
||||||
|
@ -437,11 +437,6 @@ binary-extensions@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.12.0.tgz#c2d780f53d45bba8317a8902d4ceeaf3a6385b14"
|
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.12.0.tgz#c2d780f53d45bba8317a8902d4ceeaf3a6385b14"
|
||||||
integrity sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==
|
integrity sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==
|
||||||
|
|
||||||
bindings@^1.3.0:
|
|
||||||
version "1.3.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.1.tgz#21fc7c6d67c18516ec5aaa2815b145ff77b26ea5"
|
|
||||||
integrity sha512-i47mqjF9UbjxJhxGf+pZ6kSxrnI3wBLlnGI2ArWJ4r0VrvDS7ZYXkprq/pLaBWYq4GM0r4zdHY+NNRqEMU7uew==
|
|
||||||
|
|
||||||
bl@^1.0.0:
|
bl@^1.0.0:
|
||||||
version "1.2.2"
|
version "1.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c"
|
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c"
|
||||||
@ -2447,7 +2442,7 @@ mute-stream@0.0.7:
|
|||||||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
|
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
|
||||||
integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=
|
integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=
|
||||||
|
|
||||||
nan@^2.8.0, nan@^2.9.2:
|
nan@^2.9.2:
|
||||||
version "2.12.1"
|
version "2.12.1"
|
||||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552"
|
resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552"
|
||||||
integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==
|
integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==
|
||||||
@ -3327,15 +3322,6 @@ source-map@~0.1.38:
|
|||||||
dependencies:
|
dependencies:
|
||||||
amdefine ">=0.0.4"
|
amdefine ">=0.0.4"
|
||||||
|
|
||||||
spdlog@^0.7.2:
|
|
||||||
version "0.7.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/spdlog/-/spdlog-0.7.2.tgz#9298753d7694b9ee9bbfd7e01ea1e4c6ace1e64d"
|
|
||||||
integrity sha512-rHfWCaWMD4NindDnql6rc6kn7Bs8JR92jhiUpCl3D6v+jYcQ6GozMLig0RliOOR8st5mU+IHLZnr15fBys5x/Q==
|
|
||||||
dependencies:
|
|
||||||
bindings "^1.3.0"
|
|
||||||
mkdirp "^0.5.1"
|
|
||||||
nan "^2.8.0"
|
|
||||||
|
|
||||||
split-string@^3.0.1, split-string@^3.0.2:
|
split-string@^3.0.1, split-string@^3.0.2:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
||||||
|
@ -15,11 +15,9 @@ class Pty implements nodePty.IPty {
|
|||||||
|
|
||||||
public constructor(file: string, args: string[] | string, options: nodePty.IPtyForkOptions) {
|
public constructor(file: string, args: string[] | string, options: nodePty.IPtyForkOptions) {
|
||||||
this.ae = client.run((ae, file, args, options) => {
|
this.ae = client.run((ae, file, args, options) => {
|
||||||
const nodePty = ae.require("node-pty") as typeof import("node-pty");
|
|
||||||
|
|
||||||
ae.preserveEnv(options);
|
ae.preserveEnv(options);
|
||||||
|
|
||||||
const ptyProc = nodePty.spawn(file, args, options);
|
const ptyProc = ae.modules.pty.spawn(file, args, options);
|
||||||
|
|
||||||
let process = ptyProc.process;
|
let process = ptyProc.process;
|
||||||
ae.emit("process", process);
|
ae.emit("process", process);
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
/// <reference path="../../../../lib/vscode/src/typings/spdlog.d.ts" />
|
|
||||||
import { RotatingLogger as NodeRotatingLogger } from "spdlog";
|
import { RotatingLogger as NodeRotatingLogger } from "spdlog";
|
||||||
import { logger } from "@coder/logger";
|
import { logger } from "@coder/logger";
|
||||||
import { client } from "@coder/ide/src/fill/client";
|
import { client } from "@coder/ide/src/fill/client";
|
||||||
|
|
||||||
const ae = client.run((ae) => {
|
const ae = client.run((ae) => {
|
||||||
const spdlog = ae.require("spdlog") as typeof import("spdlog");
|
|
||||||
const loggers = new Map<number, NodeRotatingLogger>();
|
const loggers = new Map<number, NodeRotatingLogger>();
|
||||||
|
|
||||||
ae.on("new", (id: number, name: string, filePath: string, fileSize: number, fileCount: number) => {
|
ae.on("new", (id: number, name: string, filePath: string, fileSize: number, fileCount: number) => {
|
||||||
const logger = new spdlog.RotatingLogger(name, filePath, fileSize, fileCount);
|
const logger = new ae.modules.spdlog.RotatingLogger(name, filePath, fileSize, fileCount);
|
||||||
loggers.set(id, logger);
|
loggers.set(id, logger);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -19,7 +17,7 @@ const ae = client.run((ae) => {
|
|||||||
ae.on("errorLog", (id: number, message: string) => loggers.get(id)!.error(message));
|
ae.on("errorLog", (id: number, message: string) => loggers.get(id)!.error(message));
|
||||||
ae.on("flush", (id: number) => loggers.get(id)!.flush());
|
ae.on("flush", (id: number) => loggers.get(id)!.flush());
|
||||||
ae.on("info", (id: number, message: string) => loggers.get(id)!.info(message));
|
ae.on("info", (id: number, message: string) => loggers.get(id)!.info(message));
|
||||||
ae.on("setAsyncMode", (bufferSize: number, flushInterval: number) => spdlog.setAsyncMode(bufferSize, flushInterval));
|
ae.on("setAsyncMode", (bufferSize: number, flushInterval: number) => ae.modules.spdlog.setAsyncMode(bufferSize, flushInterval));
|
||||||
ae.on("setLevel", (id: number, level: number) => loggers.get(id)!.setLevel(level));
|
ae.on("setLevel", (id: number, level: number) => loggers.get(id)!.setLevel(level));
|
||||||
ae.on("trace", (id: number, message: string) => loggers.get(id)!.trace(message));
|
ae.on("trace", (id: number, message: string) => loggers.get(id)!.trace(message));
|
||||||
ae.on("warn", (id: number, message: string) => loggers.get(id)!.warn(message));
|
ae.on("warn", (id: number, message: string) => loggers.get(id)!.warn(message));
|
||||||
|
23
yarn.lock
23
yarn.lock
@ -523,13 +523,6 @@ binary-extensions@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.12.0.tgz#c2d780f53d45bba8317a8902d4ceeaf3a6385b14"
|
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.12.0.tgz#c2d780f53d45bba8317a8902d4ceeaf3a6385b14"
|
||||||
integrity sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==
|
integrity sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==
|
||||||
|
|
||||||
bindings@^1.3.0:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.4.0.tgz#909efa49f2ebe07ecd3cb136778f665052040127"
|
|
||||||
integrity sha512-7znEVX22Djn+nYjxCWKDne0RRloa9XfYa84yk3s+HkE3LpDYZmhArYr9O9huBoHY3/oXispx5LorIX7Sl2CgSQ==
|
|
||||||
dependencies:
|
|
||||||
file-uri-to-path "1.0.0"
|
|
||||||
|
|
||||||
block-stream@*:
|
block-stream@*:
|
||||||
version "0.0.9"
|
version "0.0.9"
|
||||||
resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a"
|
resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a"
|
||||||
@ -1804,11 +1797,6 @@ file-loader@^3.0.1:
|
|||||||
loader-utils "^1.0.2"
|
loader-utils "^1.0.2"
|
||||||
schema-utils "^1.0.0"
|
schema-utils "^1.0.0"
|
||||||
|
|
||||||
file-uri-to-path@1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
|
|
||||||
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
|
|
||||||
|
|
||||||
filesize@^3.6.1:
|
filesize@^3.6.1:
|
||||||
version "3.6.1"
|
version "3.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317"
|
resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317"
|
||||||
@ -3367,7 +3355,7 @@ multicast-dns@^6.0.1:
|
|||||||
dns-packet "^1.3.1"
|
dns-packet "^1.3.1"
|
||||||
thunky "^1.0.2"
|
thunky "^1.0.2"
|
||||||
|
|
||||||
nan@^2.10.0, nan@^2.8.0, nan@^2.9.2:
|
nan@^2.10.0, nan@^2.9.2:
|
||||||
version "2.12.1"
|
version "2.12.1"
|
||||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552"
|
resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552"
|
||||||
integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==
|
integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==
|
||||||
@ -4774,15 +4762,6 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
|
|||||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||||
|
|
||||||
spdlog@^0.7.2:
|
|
||||||
version "0.7.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/spdlog/-/spdlog-0.7.2.tgz#9298753d7694b9ee9bbfd7e01ea1e4c6ace1e64d"
|
|
||||||
integrity sha512-rHfWCaWMD4NindDnql6rc6kn7Bs8JR92jhiUpCl3D6v+jYcQ6GozMLig0RliOOR8st5mU+IHLZnr15fBys5x/Q==
|
|
||||||
dependencies:
|
|
||||||
bindings "^1.3.0"
|
|
||||||
mkdirp "^0.5.1"
|
|
||||||
nan "^2.8.0"
|
|
||||||
|
|
||||||
spdx-correct@^3.0.0:
|
spdx-correct@^3.0.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4"
|
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4"
|
||||||
|
Reference in New Issue
Block a user