Skip to content

Commit

Permalink
Integrate SES 0.13, which no longer depends on Babel (merge #3244)
Browse files Browse the repository at this point in the history
This is the first in a sequence of changes toward achieving Endo bundles #2684 with satisfactory performance endojs/endo#655. It was necessary to make breaking changes in SES and Compartment Mapper to decouple Babel, ejecting a separate package for the StaticModuleRecord constructor, and adding a semi-private API for third-party participation in the SES module system that the new records could plug into. Then, the package structure needed amendment to straddle Node.js ESM and the `node -r esm` emulation.

This change updates the Agoric SDK dependencies to these new versions. Unfortunately, the previous coupling between SES and StaticModuleRecord hid the fact that the Babel dependency does not initialize properly under SES, so it becomes necessary to also pre-initialize Babel anywhere it’s actually used, anywhere we use `@agoric/bundle-source` in the same environment.

This should have no user-facing consequences and the pre-initialization of Babel should be reverted when we have a version of StaticModuleRecord that can be initialized under SES. endojs/endo#768
  • Loading branch information
kriskowal authored Jun 9, 2021
2 parents e3d55e0 + 3de8d33 commit 98dbf8a
Show file tree
Hide file tree
Showing 57 changed files with 214 additions and 94 deletions.
7 changes: 4 additions & 3 deletions packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
},
"devDependencies": {
"@agoric/install-metering-and-ses": "^0.2.13",
"@agoric/ses-ava": "^0.1.1",
"@endo/ses-ava": "^0.2.1",
"ava": "^3.12.1"
},
"dependencies": {
"@agoric/assert": "^0.2.12",
"@agoric/babel-parser": "^7.6.4",
"@agoric/babel-standalone": "^7.14.3",
"@agoric/bundle-source": "^1.3.7",
"@agoric/captp": "^1.7.13",
"@agoric/eventual-send": "^0.13.14",
Expand All @@ -49,14 +50,14 @@
"@agoric/tame-metering": "^1.3.9",
"@agoric/transform-metering": "^1.4.12",
"@agoric/xsnap": "^0.6.2",
"@endo/base64": "^0.1.0",
"@endo/base64": "^0.2.1",
"@types/tmp": "^0.2.0",
"anylogger": "^0.21.0",
"esm": "agoric-labs/esm#Agoric-built",
"node-lmdb": "^0.9.4",
"re2": "^1.10.5",
"semver": "^6.3.0",
"ses": "^0.12.7",
"ses": "^0.13.1",
"tmp": "^0.2.1"
},
"files": [
Expand Down
3 changes: 3 additions & 0 deletions packages/SwingSet/test/metering/test-dynamic-vat-metered.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global require */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-metering-and-ses';
import bundleSource from '@agoric/bundle-source';
import test from 'ava';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global require */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-metering-and-ses';
import bundleSource from '@agoric/bundle-source';
import test from 'ava';
Expand Down
3 changes: 3 additions & 0 deletions packages/SwingSet/test/metering/test-dynamic-vat-unmetered.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global require */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-metering-and-ses';
import bundleSource from '@agoric/bundle-source';
import test from 'ava';
Expand Down
3 changes: 3 additions & 0 deletions packages/SwingSet/test/metering/test-metering.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* global require */
// eslint-disable-next-line import/order
import { replaceGlobalMeter } from './install-global-metering';
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';
import { assert, details as X } from '@agoric/assert';
import bundleSource from '@agoric/bundle-source';
Expand Down
3 changes: 3 additions & 0 deletions packages/SwingSet/test/vat-admin/terminate/test-terminate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global __dirname */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';
import path from 'path';
import test from 'ava';
Expand Down
3 changes: 3 additions & 0 deletions packages/SwingSet/test/vat-admin/test-innerVat.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global __dirname */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-metering-and-ses';
import path from 'path';
import test from 'ava';
Expand Down
3 changes: 3 additions & 0 deletions packages/SwingSet/test/vat-admin/test-replay.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global __dirname */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-metering-and-ses';
import path from 'path';
import test from 'ava';
Expand Down
3 changes: 3 additions & 0 deletions packages/SwingSet/tools/install-ses-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

import 'ses';
import '@agoric/eventual-send/shim';
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';

lockdown({
// The default `{errorTaming: 'safe'}` setting, if possible, redacts the
Expand Down
6 changes: 5 additions & 1 deletion packages/SwingSet/tools/prepare-test-env-ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
* `test` function.
*/

// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';

// eslint thinks these are extraneous dependencies because this file
// is in the tools/ directory rather than the test/ directory.
// TODO How do we tell eslint that tools/ is dev-only? Either
// that, or should we just move tools/* into test/ ?
//
// eslint-disable-next-line import/no-extraneous-dependencies
import { wrapTest } from '@agoric/ses-ava';
import { wrapTest } from '@endo/ses-ava';
import './prepare-test-env';
// eslint-disable-next-line import/no-extraneous-dependencies
import rawTest from 'ava';
Expand Down
4 changes: 4 additions & 0 deletions packages/SwingSet/tools/prepare-test-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* for virtual objects: makeKind, makeWeakStore
*/

// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';

import './install-ses-debug';
import { makeFakeVirtualObjectManager } from './fakeVirtualObjectManager';

Expand Down
3 changes: 3 additions & 0 deletions packages/agoric-cli/lib/entrypoint.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global process */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';

import path from 'path';
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"dependencies": {
"@agoric/access-token": "^0.4.0",
"@agoric/assert": "^0.2.12",
"@agoric/babel-standalone": "^7.14.3",
"@agoric/bundle-source": "^1.3.7",
"@agoric/captp": "^1.7.13",
"@agoric/install-ses": "^0.5.13",
Expand Down
5 changes: 4 additions & 1 deletion packages/agoric-cli/test/test-main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* global globalThis */
import test from 'ava';
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';
import test from 'ava';
import fs from 'fs';
import anylogger from 'anylogger';

Expand Down
2 changes: 1 addition & 1 deletion packages/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
"access": "public"
},
"dependencies": {
"ses": "^0.12.7"
"ses": "^0.13.1"
}
}
7 changes: 4 additions & 3 deletions packages/bundle-source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@
"ava": "^3.12.1"
},
"dependencies": {
"@agoric/compartment-mapper": "^0.2.4",
"@agoric/babel-standalone": "^7.14.3",
"@babel/generator": "^7.14.2",
"@babel/parser": "^7.14.2",
"@babel/traverse": "^7.14.2",
"@endo/base64": "^0.1.0",
"@endo/base64": "^0.2.1",
"@endo/compartment-mapper": "^0.3.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"acorn": "^8.2.4",
"esm": "agoric-labs/esm#Agoric-built",
"rollup": "^2.47.0",
"ses": "^0.12.6",
"ses": "^0.13.1",
"source-map": "^0.7.3"
},
"keywords": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/bundle-source/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import commonjs0 from '@rollup/plugin-commonjs';
import * as babelParser from '@babel/parser';
import babelGenerate from '@babel/generator';
import babelTraverse from '@babel/traverse';
import { makeArchive } from '@agoric/compartment-mapper';
import { makeArchive } from '@endo/compartment-mapper/archive.js';
import { encodeBase64 } from '@endo/base64';

import { SourceMapConsumer } from 'source-map';
Expand Down
2 changes: 1 addition & 1 deletion packages/bundle-source/test/sanity.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import 'ses';

import { decodeBase64 } from '@endo/base64';
import { parseArchive } from '@agoric/compartment-mapper';
import { parseArchive } from '@endo/compartment-mapper/import-archive.js';
import test from 'ava';
import bundleSource from '..';

Expand Down
3 changes: 3 additions & 0 deletions packages/bundle-source/test/test-bigint-transform.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global __dirname */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';
import test from 'ava';
import bundleSource from '..';
Expand Down
3 changes: 3 additions & 0 deletions packages/bundle-source/test/test-circular.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global __dirname */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';
import test from 'ava';
import bundleSource from '..';
Expand Down
5 changes: 4 additions & 1 deletion packages/bundle-source/test/test-comment.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* global __dirname */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';
import test from 'ava';
import { decodeBase64 } from '@endo/base64';
import { parseArchive } from '@agoric/compartment-mapper';
import { parseArchive } from '@endo/compartment-mapper/import-archive.js';
import bundleSource from '..';

function evaluate(src, endowments) {
Expand Down
3 changes: 3 additions & 0 deletions packages/bundle-source/test/test-explicit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global __dirname */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';
import test from 'ava';
import { rollup } from 'rollup';
Expand Down
3 changes: 3 additions & 0 deletions packages/bundle-source/test/test-external-fs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global __dirname */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';
import test from 'ava';
import bundleSource from '..';
Expand Down
2 changes: 1 addition & 1 deletion packages/dapp-svelte-wallet/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"rollup-plugin-livereload": "^1.0.0",
"rollup-plugin-svelte": "^5.0.3",
"rollup-plugin-terser": "^6.1.0",
"ses": "^0.12.7",
"ses": "^0.13.1",
"sirv-cli": "^1.0.0",
"smelte": "^1.0.15",
"svelte": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/dapp-svelte-wallet/ui/src/install-ses-lockdown.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'ses/lockdown';
import 'ses';
import '@agoric/eventual-send/shim';

lockdown();
Expand Down
6 changes: 4 additions & 2 deletions packages/import-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
},
"dependencies": {
"@agoric/assert": "^0.2.12",
"@agoric/compartment-mapper": "^0.2.3",
"@endo/base64": "^0.1.0"
"@endo/base64": "^0.2.1",
"@endo/compartment-mapper": "^0.3.0"
},
"devDependencies": {
"@agoric/babel-standalone": "^7.14.3",
"@agoric/bundle-source": "^1.3.7",
"@agoric/install-ses": "^0.5.13",
"@agoric/swingset-vat": "^0.17.2",
"@endo/ses-ava": "^0.2.0",
"ava": "^3.12.1",
"esm": "agoric-labs/esm#Agoric-built"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/import-bundle/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parseArchive } from '@agoric/compartment-mapper';
import { parseArchive } from '@endo/compartment-mapper/import-archive.js';
import { decodeBase64 } from '@endo/base64';
import { assert, details as X } from '@agoric/assert';
import { wrapInescapableCompartment } from './compartment-wrapper';
Expand Down
5 changes: 4 additions & 1 deletion packages/import-bundle/test/test-import-bundle.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* global require */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-ses';
import { encodeBase64 } from '@endo/base64';
import * as fs from 'fs';
import { makeArchive } from '@agoric/compartment-mapper';
import { makeArchive } from '@endo/compartment-mapper/archive.js';

import bundleSource from '@agoric/bundle-source';
import test from 'ava';
Expand Down
2 changes: 1 addition & 1 deletion packages/install-ses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@agoric/eventual-send": "^0.13.14",
"ses": "^0.12.7"
"ses": "^0.13.1"
},
"files": [
"src/**/*.js"
Expand Down
2 changes: 2 additions & 0 deletions packages/notifier/src/notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const makeNotifierKit = (...args) => {
value: state,
updateCount: currentUpdateCount,
});
assert(currentResponse);
nextPromiseKit.resolve(currentResponse);
nextPromiseKit = makePromiseKit();
},
Expand All @@ -109,6 +110,7 @@ export const makeNotifierKit = (...args) => {
value: finalState,
updateCount: currentUpdateCount,
});
assert(currentResponse);
nextPromiseKit.resolve(currentResponse);
nextPromiseKit = undefined;
},
Expand Down
2 changes: 1 addition & 1 deletion packages/pegasus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@agoric/install-ses": "^0.5.13",
"ava": "^3.12.1",
"esm": "agoric-labs/esm#Agoric-built",
"ses": "^0.12.7"
"ses": "^0.13.1"
},
"files": [
"bundles/",
Expand Down
1 change: 1 addition & 0 deletions packages/solo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"ws": "^7.2.0"
},
"devDependencies": {
"@agoric/babel-standalone": "^7.14.3",
"@agoric/bundle-source": "^1.3.7",
"ava": "^3.12.1"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/solo/src/entrypoint.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const esmRequire = require('esm')(module);
// import node-lmdb early to work around SES incompatibility
require('node-lmdb');

// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
esmRequire('@agoric/babel-standalone');

// we need to enable Math.random as a workaround for 'brace-expansion' module
// (dep chain: temp->glob->minimatch->brace-expansion)
esmRequire('@agoric/install-metering-and-ses');
Expand Down
3 changes: 3 additions & 0 deletions packages/solo/test/test-home.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// See https://github.com/endojs/endo/issues/647
// TODO restore
// import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava';
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/swingset-vat/tools/prepare-test-env';
// eslint-disable-next-line import/no-extraneous-dependencies
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/spawner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@agoric/marshal": "^0.4.11"
},
"devDependencies": {
"@agoric/babel-standalone": "^7.14.3",
"@agoric/bundle-source": "^1.3.7",
"@agoric/install-metering-and-ses": "^0.2.13",
"@agoric/install-ses": "^0.5.13",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* global __dirname */
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';
import '@agoric/install-metering-and-ses';
import test from 'ava';
import path from 'path';
Expand Down
6 changes: 5 additions & 1 deletion packages/swingset-runner/bin/runner
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
* as yet not-entirely-ESM-supporting version of NodeJS.
*/

// LMDB bindings need to be imported before lockdown.
// Initialize trasitive dependencies that run afoul of the property override
// after SES lockdown hazard.
import 'node-lmdb';
// TODO Remove babel-standalone preinitialization
// https://github.com/endojs/endo/issues/768
import '@agoric/babel-standalone';

// Now do lockdown.
import '../src/install-optional-metering-and-ses';
Expand Down
Loading

0 comments on commit 98dbf8a

Please sign in to comment.