Skip to content

Commit 9043516

Browse files
committed
fix: silence the builtin modules warning in agoric-cli deploy
1 parent fc046ec commit 9043516

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

packages/agoric-cli/lib/deploy.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable no-await-in-loop */
2+
import builtinModules from 'builtin-modules';
23
import parseArgs from 'minimist';
34
import { evaluateProgram } from '@agoric/evaluate';
45
import { E, HandledPromise, makeCapTP } from '@agoric/captp';
@@ -55,7 +56,7 @@ export default async function deployMain(progname, rawArgs, powers) {
5556

5657
// Wait for the chain to become ready.
5758
let bootP = getBootstrap();
58-
log.error('Chain loaded:', await E.G(bootP).LOADING);
59+
log.info('Chain loaded:', await E.G(bootP).LOADING);
5960
// Take a new copy, since the chain objects have been added to bootstrap.
6061
bootP = getBootstrap();
6162

@@ -64,7 +65,11 @@ export default async function deployMain(progname, rawArgs, powers) {
6465
const pathResolve = (...resArgs) =>
6566
path.resolve(path.dirname(moduleFile), ...resArgs);
6667
log('running', moduleFile);
67-
const { source, sourceMap } = await bundleSource(moduleFile);
68+
const { source, sourceMap } = await bundleSource(
69+
moduleFile,
70+
undefined,
71+
{ externals: builtinModules },
72+
);
6873

6974
const actualSource = `(${source}\n)\n${sourceMap}`;
7075
const mainNS = evaluateProgram(actualSource, {
@@ -84,7 +89,7 @@ export default async function deployMain(progname, rawArgs, powers) {
8489
}
8590
}
8691

87-
log('Done!');
92+
log.info('Done!');
8893
ws.close();
8994
exit.res(0);
9095
} catch (e) {

packages/agoric-cli/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@agoric/eventual-send": "^0.5.0",
3434
"@agoric/make-promise": "^0.0.1",
3535
"anylogger": "^0.21.0",
36+
"builtin-modules": "^3.1.0",
3637
"chalk": "^2.4.2",
3738
"esm": "^3.2.25",
3839
"minimist": "^1.2.0",

packages/bundle-source/src/index.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,24 @@ const SUPPORTED_FORMATS = ['getExport', 'nestedEvaluate'];
1212
export default async function bundleSource(
1313
startFilename,
1414
moduleFormat = DEFAULT_MODULE_FORMAT,
15-
access = undefined,
15+
powers = undefined,
1616
) {
1717
if (!SUPPORTED_FORMATS.includes(moduleFormat)) {
1818
throw Error(`moduleFormat ${moduleFormat} is not implemented`);
1919
}
20-
const { commonjsPlugin, rollup, resolvePlugin, pathResolve } = access || {
21-
rollup: rollup0,
22-
resolvePlugin: resolve0,
23-
commonjsPlugin: commonjs0,
24-
pathResolve: path.resolve,
25-
};
20+
const {
21+
commonjsPlugin = commonjs0,
22+
rollup = rollup0,
23+
resolvePlugin = resolve0,
24+
pathResolve = path.resolve,
25+
externals = [],
26+
} = powers || {};
2627
const resolvedPath = pathResolve(startFilename);
2728
const bundle = await rollup({
2829
input: resolvedPath,
2930
treeshake: false,
3031
preserveModules: moduleFormat === 'nestedEvaluate',
31-
external: ['@agoric/evaluate', '@agoric/harden'],
32+
external: ['@agoric/evaluate', '@agoric/harden', ...externals],
3233
plugins: [resolvePlugin({ preferBuiltins: true }), commonjsPlugin()],
3334
acornInjectPlugins: [eventualSend(acorn)],
3435
});

0 commit comments

Comments
 (0)