Skip to content

Commit

Permalink
fix: stop calling require.resolve on top level module code.
Browse files Browse the repository at this point in the history
  • Loading branch information
barak007 committed Sep 12, 2024
1 parent 8eda497 commit db4de41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions packages/runtime-node/src/node-environments-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ export interface RunEnvironmentOptions {
mode?: LaunchEnvironmentMode;
}

const cliEntry = require.resolve('./remote-node-entry');

export interface INodeEnvironmentsManagerOptions {
features: Map<string, IStaticFeatureDefinition>;
bundlePath?: string;
Expand Down Expand Up @@ -120,7 +118,7 @@ export interface ILaunchEnvironmentOptions {

export class NodeEnvironmentsManager {
private runningFeatures = new Map<string, { com: Communication; runningEnvironments: RunningEnvironmentRecord }>();

private cliEntry = require.resolve('./remote-node-entry');
constructor(
private socketServer: io.Server,
private options: INodeEnvironmentsManagerOptions,
Expand Down Expand Up @@ -467,7 +465,7 @@ export class NodeEnvironmentsManager {
}

private async runRemoteNodeEnvironment(options: StartEnvironmentOptions) {
const { remoteNodeEnvironment, process: childProc } = await startRemoteNodeEnvironment(cliEntry, {
const { remoteNodeEnvironment, process: childProc } = await startRemoteNodeEnvironment(this.cliEntry, {
inspect: this.options.inspect,
port: this.options.port,
socketServerOptions: this.socketServerOptions,
Expand Down
5 changes: 2 additions & 3 deletions packages/runtime-node/src/worker-thread-initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ export type WorkerThreadInitializerOptions = InitializerOptions & {
};
};

const workerThreadEntryPath = require.resolve('./worker-thread-entry');

export function workerThreadInitializer({
communication,
env,
environmentStartupOptions,
}: WorkerThreadInitializerOptions): WorkerThreadInitializer {
const workerThreadEntryPath = require.resolve('./worker-thread-entry');
const disposables = createDisposables('workerThreadInitializer');

const instanceId = communication.getEnvironmentInstanceId(env.env, env.endpointType);
Expand Down Expand Up @@ -93,6 +92,6 @@ export function workerThreadInitializer({
return {
id: instanceId,
initialize,
dispose: ()=>disposables.dispose(),
dispose: () => disposables.dispose(),
};
}

0 comments on commit db4de41

Please sign in to comment.