Add evaluation helpers (#33)
* Add evaluation helpers * Make some helpers only available server-side They don't make any sense on the client side. * Fork the right thing
This commit is contained in:
@ -380,7 +380,7 @@ class Dialog {
|
||||
}
|
||||
|
||||
private async list(directory: string): Promise<ReadonlyArray<DialogEntry>> {
|
||||
return ideClient.evaluate((directory) => {
|
||||
return ideClient.evaluate((_helper, directory) => {
|
||||
const fs = __non_webpack_require__("fs") as typeof import("fs");
|
||||
const util = __non_webpack_require__("util") as typeof import("util");
|
||||
const path = __non_webpack_require__("path") as typeof import("path");
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { client } from "@coder/ide/src/fill/client";
|
||||
import { EventEmitter } from "events";
|
||||
import * as nodePty from "node-pty";
|
||||
import { ActiveEval } from "@coder/protocol";
|
||||
import { ActiveEvalHelper } from "@coder/protocol";
|
||||
|
||||
// Use this to prevent Webpack from hijacking require.
|
||||
declare var __non_webpack_require__: typeof require;
|
||||
@ -11,16 +11,15 @@ declare var __non_webpack_require__: typeof require;
|
||||
*/
|
||||
class Pty implements nodePty.IPty {
|
||||
private readonly emitter = new EventEmitter();
|
||||
private readonly ae: ActiveEval;
|
||||
private readonly ae: ActiveEvalHelper;
|
||||
private _pid = -1;
|
||||
private _process = "";
|
||||
|
||||
public constructor(file: string, args: string[] | string, options: nodePty.IPtyForkOptions) {
|
||||
this.ae = client.run((ae, file, args, options) => {
|
||||
const nodePty = __non_webpack_require__("node-pty") as typeof import("node-pty");
|
||||
const { preserveEnv } = __non_webpack_require__("@coder/ide/src/fill/evaluation") as typeof import("@coder/ide/src/fill/evaluation");
|
||||
|
||||
preserveEnv(options);
|
||||
ae.preserveEnv(options);
|
||||
|
||||
const ptyProc = nodePty.spawn(file, args, options);
|
||||
|
||||
|
Reference in New Issue
Block a user