From 8355af4392c7214377e24cfc66f24affb9ec47a2 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Thu, 21 Sep 2023 23:01:42 +0000 Subject: [PATCH] fix(agoric): disable RESM --- packages/agoric-cli/package.json | 1 - packages/agoric-cli/src/entrypoint.js | 1 - packages/agoric-cli/src/scripts.js | 6 ++---- packages/agoric-cli/test/test-main.js | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/agoric-cli/package.json b/packages/agoric-cli/package.json index 70a4297ab28b..fce1cc4c0673 100644 --- a/packages/agoric-cli/package.json +++ b/packages/agoric-cli/package.json @@ -64,7 +64,6 @@ "commander": "^10.0.0", "dd-trace": "^3.3.0", "deterministic-json": "^1.0.5", - "esm": "agoric-labs/esm#Agoric-built", "inquirer": "^8.2.2", "opener": "^1.5.2", "tmp": "^0.2.1", diff --git a/packages/agoric-cli/src/entrypoint.js b/packages/agoric-cli/src/entrypoint.js index 942a040d1bf5..dacf5e47f963 100755 --- a/packages/agoric-cli/src/entrypoint.js +++ b/packages/agoric-cli/src/entrypoint.js @@ -4,7 +4,6 @@ /* global process */ import '@endo/init/pre.js'; -import 'esm'; import '@agoric/casting/node-fetch-shim.js'; import '@endo/init'; diff --git a/packages/agoric-cli/src/scripts.js b/packages/agoric-cli/src/scripts.js index 54857b5d7e34..7f0ca5ce6552 100644 --- a/packages/agoric-cli/src/scripts.js +++ b/packages/agoric-cli/src/scripts.js @@ -4,13 +4,11 @@ import bundleSource from '@endo/bundle-source'; import { E } from '@endo/captp'; import { search as readContainingPackageDescriptor } from '@endo/compartment-mapper'; -import createEsmRequire from 'esm'; import { createRequire } from 'module'; import path from 'path'; import url from 'url'; const require = createRequire(import.meta.url); -const esmRequire = createEsmRequire(/** @type {NodeModule} */ ({})); const PATH_SEP_RE = new RegExp(`${path.sep.replace(/\\/g, '\\\\')}`, 'g'); @@ -154,9 +152,9 @@ export { bootPlugin } from ${JSON.stringify(absPath)}; ); const modulePath = pathResolve(moduleFile); - let mainNS = await (nativeEsm && import(modulePath)); + const mainNS = await (nativeEsm && import(modulePath)); if (!mainNS) { - mainNS = esmRequire(modulePath); + throw Error('standardthings/esm emulation disabled'); } const allEndowments = harden({ diff --git a/packages/agoric-cli/test/test-main.js b/packages/agoric-cli/test/test-main.js index 88219733fae1..e61dc104ce6e 100644 --- a/packages/agoric-cli/test/test-main.js +++ b/packages/agoric-cli/test/test-main.js @@ -1,7 +1,6 @@ /* global globalThis */ import '@agoric/casting/node-fetch-shim.js'; import '@endo/init/pre.js'; -import 'esm'; import '@endo/init/debug.js'; import test from 'ava'; import fs from 'fs';