Skip to content

Commit

Permalink
Merge pull request #4278 from Agoric/kris-relax
Browse files Browse the repository at this point in the history
refactor: Relax internal dependencies
  • Loading branch information
mergify[bot] authored Jan 11, 2022
2 parents ec9c204 + 36f3c5c commit 3464e52
Show file tree
Hide file tree
Showing 23 changed files with 33 additions and 26 deletions.
2 changes: 0 additions & 2 deletions packages/captp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@
},
"devDependencies": {
"@agoric/install-ses": "^0.5.29",
"@agoric/swingset-vat": "^0.24.1",
"@endo/ses-ava": "^0.2.13",
"ava": "^3.12.1",
"c8": "^7.7.2"
},
"dependencies": {
"@agoric/assert": "^0.3.15",
"@agoric/eventual-send": "^0.14.0",
"@agoric/marshal": "^0.5.0",
"@agoric/nat": "^4.1.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/captp/src/atomics.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @ts-check
/* global BigUint64Array */
/// <reference types="ses"/>

import { assert, details as X } from '@agoric/assert';
const { details: X } = assert;

// This is a pathological minimum, but exercised by the unit test.
export const MIN_DATA_BUFFER_LENGTH = 1;
Expand Down
4 changes: 3 additions & 1 deletion packages/captp/src/captp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-check
/// <reference types="ses"/>

// Your app may need to `import '@agoric/eventual-send/shim'` to get HandledPromise

Expand All @@ -7,14 +8,15 @@
import { Remotable, Far, makeMarshal, QCLASS } from '@agoric/marshal';
import { E, HandledPromise } from '@agoric/eventual-send';
import { isPromise, makePromiseKit } from '@agoric/promise-kit';
import { assert, details as X } from '@agoric/assert';

import { makeTrap } from './trap.js';

import './types.js';

export { E };

const { details: X } = assert;

/**
* @param {any} maybeThenable
* @returns {boolean}
Expand Down
4 changes: 3 additions & 1 deletion packages/captp/test/traplib.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// @ts-check
/* global setTimeout */
/// <reference types="ses"/>

import { assert, details as X } from '@agoric/assert';
import { Far } from '@agoric/marshal';
import { E, makeCapTP } from '../src/captp.js';

import { makeAtomicsTrapGuest, makeAtomicsTrapHost } from '../src/atomics.js';

const { details: X } = assert;

export const createHostBootstrap = makeTrapHandler => {
// Create a remotable that has a syncable return value.
return Far('test traps', {
Expand Down
6 changes: 4 additions & 2 deletions packages/captp/test/worker.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/// <reference types="ses"/>

import '@agoric/install-ses/pre-remoting.js';
import '@agoric/install-ses/debug.js';

import { assert, details as X } from '@agoric/assert';

import { parentPort } from 'worker_threads';
import { makeGuest, makeHost } from './traplib.js';

const { details: X } = assert;

let dispatch;
parentPort.addListener('message', obj => {
switch (obj.type) {
Expand Down
1 change: 0 additions & 1 deletion packages/eventual-send/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
},
"homepage": "/~https://github.com/Agoric/agoric-sdk#readme",
"devDependencies": {
"@agoric/assert": "^0.3.15",
"@agoric/lockdown": "^0.1.1",
"@endo/ses-ava": "^0.2.13",
"ava": "^3.12.1",
Expand Down
2 changes: 0 additions & 2 deletions packages/import-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
"lint": "eslint '**/*.js'"
},
"dependencies": {
"@agoric/assert": "^0.3.15",
"@endo/base64": "^0.2.13",
"@endo/compartment-mapper": "^0.6.1"
},
"devDependencies": {
"@agoric/bundle-source": "^2.0.1",
"@agoric/install-ses": "^0.5.29",
"@agoric/swingset-vat": "^0.24.1",
"@endo/ses-ava": "^0.2.13",
"ava": "^3.12.1",
"c8": "^7.7.2"
Expand Down
4 changes: 3 additions & 1 deletion packages/import-bundle/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* global globalThis */
/// <reference types="ses"/>

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.js';

const { details: X } = assert;

// importBundle takes the output of bundle-source, and returns a namespace
// object (with .default, and maybe other properties for named exports)

Expand Down
5 changes: 4 additions & 1 deletion packages/import-bundle/test/test-compartment-wrapper.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/// <reference types="ses"/>

import { test } from './prepare-test-env-ava.js';
// eslint-disable-next-line import/order
import { assert, details as X } from '@agoric/assert';
import { wrapInescapableCompartment } from '../src/compartment-wrapper.js';

const { details: X } = assert;

// We build a transform that allows oldSrc to increment the odometer, but not
// read it. Note, of course, that SES provides a far easier way to accomplish
// this (pass in a hardened `addMilage` endowment), but there are metering
Expand Down
1 change: 0 additions & 1 deletion packages/marshal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
},
"homepage": "/~https://github.com/Agoric/agoric-sdk#readme",
"dependencies": {
"@agoric/assert": "^0.3.15",
"@agoric/eventual-send": "^0.14.0",
"@agoric/nat": "^4.1.0",
"@agoric/promise-kit": "^0.2.29"
Expand Down
2 changes: 1 addition & 1 deletion packages/marshal/src/dot-membrane.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// eslint-disable-next-line spaced-comment
/// <reference types="ses"/>

import { assert, details as X } from '@agoric/assert';
import { E } from '@agoric/eventual-send';
import { isObject } from './helpers/passStyle-helpers.js';
import { getInterfaceOf } from './helpers/remotable.js';
Expand All @@ -14,6 +13,7 @@ import { passStyleOf } from './passStyleOf.js';

const { fromEntries } = Object;
const { ownKeys } = Reflect;
const { details: X } = assert;

const makeConverter = (mirrorConverter = undefined) => {
/** @type {WeakMap<any,any>=} */
Expand Down
1 change: 0 additions & 1 deletion packages/marshal/src/helpers/copyArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import '../types.js';
import './internal-types.js';
import '@agoric/assert/exported.js';
import { assertChecker, checkNormalProperty } from './passStyle-helpers.js';

const { details: X } = assert;
Expand Down
1 change: 0 additions & 1 deletion packages/marshal/src/helpers/copyRecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {

import '../types.js';
import './internal-types.js';
import '@agoric/assert/exported.js';

const { details: X } = assert;
const { ownKeys } = Reflect;
Expand Down
1 change: 0 additions & 1 deletion packages/marshal/src/helpers/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import '../types.js';
import './internal-types.js';
import '@agoric/assert/exported.js';
import { assertChecker } from './passStyle-helpers.js';

const { details: X } = assert;
Expand Down
1 change: 0 additions & 1 deletion packages/marshal/src/helpers/passStyle-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import '../types.js';
import './internal-types.js';
import '@agoric/assert/exported.js';

const { details: X, quote: q } = assert;
const {
Expand Down
1 change: 0 additions & 1 deletion packages/marshal/src/helpers/remotable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import '../types.js';
import './internal-types.js';
import '@agoric/assert/exported.js';
import {
assertChecker,
canBeMethod,
Expand Down
1 change: 0 additions & 1 deletion packages/marshal/src/helpers/tagged.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {

import '../types.js';
import './internal-types.js';
import '@agoric/assert/exported.js';

const { details: X } = assert;
const { ownKeys } = Reflect;
Expand Down
3 changes: 2 additions & 1 deletion packages/marshal/src/make-far.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// eslint-disable-next-line spaced-comment
/// <reference types="ses"/>

import { assert, details as X, q } from '@agoric/assert';
import { assertChecker, PASS_STYLE } from './helpers/passStyle-helpers.js';
import {
assertIface,
Expand All @@ -12,6 +11,8 @@ import {
} from './helpers/remotable.js';
import { pureCopy } from './pureCopy.js';

const { quote: q, details: X } = assert;

const { prototype: functionPrototype } = Function;
const {
getPrototypeOf,
Expand Down
2 changes: 1 addition & 1 deletion packages/marshal/src/makeTagged.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
// eslint-disable-next-line spaced-comment
/// <reference types="ses"/>

import { assert, details as X } from '@agoric/assert';
import { PASS_STYLE } from './helpers/passStyle-helpers.js';
import { assertPassable } from './passStyleOf.js';

const { create, prototype: objectPrototype } = Object;
const { details: X } = assert;

export const makeTagged = (tag, payload) => {
assert.typeof(
Expand Down
2 changes: 1 addition & 1 deletion packages/marshal/src/marshal-justin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/// <reference types="ses"/>

import { Nat } from '@agoric/nat';
import { assert, details as X, q } from '@agoric/assert';
import { QCLASS } from './marshal.js';

import './types.js';
Expand All @@ -15,6 +14,7 @@ import { AtAtPrefixPattern, passableSymbolForName } from './helpers/symbol.js';
const { ownKeys } = Reflect;
const { isArray } = Array;
const { stringify: quote } = JSON;
const { quote: q, details: X } = assert;

/**
* @typedef {Object} Indenter
Expand Down
4 changes: 3 additions & 1 deletion packages/marshal/src/marshal-stringify.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// @ts-check
/// <reference types="ses"/>

import { assert, details as X } from '@agoric/assert';
import { makeMarshal } from './marshal.js';

import './types.js';

const { details: X } = assert;

/** @type {ConvertValToSlot<any>} */
const doNotConvertValToSlot = val =>
assert.fail(X`Marshal's stringify rejects presences and promises ${val}`);
Expand Down
6 changes: 5 additions & 1 deletion packages/marshal/src/marshal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/// <reference types="ses"/>

import { Nat } from '@agoric/nat';
import { assert, details as X, q } from '@agoric/assert';
import { passStyleOf } from './passStyleOf.js';

import './types.js';
Expand All @@ -21,6 +20,7 @@ import {
const { ownKeys } = Reflect;
const { isArray } = Array;
const { getOwnPropertyDescriptors, defineProperties, is, fromEntries } = Object;
const { details: X, quote: q } = assert;

/**
* Special property name that indicates an encoding that needs special
Expand Down Expand Up @@ -396,6 +396,10 @@ export function makeMarshal(
errorId === undefined
? `Remote${EC.name}`
: `Remote${EC.name}(${errorId})`;
// Due to a defect in the SES type definition, the next line is
// fails a type check.
// Pending /~https://github.com/endojs/endo/issues/977
// @ts-ignore-next-line
const error = assert.error(`${message}`, EC, { errorName });
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/marshal/src/pureCopy.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @ts-check

import { assert, details as X, q } from '@agoric/assert';
import { getTag } from './helpers/passStyle-helpers.js';
import { makeTagged } from './makeTagged.js';
import { passStyleOf } from './passStyleOf.js';

const { is } = Object;
const { details: X, quote: q } = assert;

/**
* This is the equality comparison used by JavaScript's Map and Set
Expand Down

0 comments on commit 3464e52

Please sign in to comment.