Skip to content

Commit

Permalink
refactor: remove import @agoric/harden from miscellaneous sources
Browse files Browse the repository at this point in the history
  • Loading branch information
FUDCo committed Jun 30, 2020
1 parent dead67a commit d6cf911
Show file tree
Hide file tree
Showing 84 changed files with 130 additions and 96 deletions.
1 change: 0 additions & 1 deletion packages/ERTP/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"dependencies": {
"@agoric/assert": "^0.0.7",
"@agoric/eventual-send": "^0.9.2",
"@agoric/harden": "^0.0.8",
"@agoric/import-manager": "^0.0.6",
"@agoric/layer-cake": "^0.0.1",
"@agoric/marshal": "^0.2.2",
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/amountMath.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global harden */
// @ts-check
import harden from '@agoric/harden';

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

import { mustBeComparable } from '@agoric/same-structure';
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/issuer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright (C) 2019 Agoric, under Apache License 2.0

/* global harden */
// @ts-check

import harden from '@agoric/harden';
import { assert, details } from '@agoric/assert';
import makeStore from '@agoric/weak-store';
import { isPromise } from '@agoric/produce-promise';
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/mathHelpers/natMathHelpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global harden */

import Nat from '@agoric/nat';
import harden from '@agoric/harden';

// Fungible digital assets use the natMathHelpers to manage balances -
// the operations are merely arithmetic on natural, non-negative
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/mathHelpers/setMathHelpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { passStyleOf } from '@agoric/marshal';
import { assert, details } from '@agoric/assert';
import { sameStructure } from '@agoric/same-structure';
Expand Down
3 changes: 2 additions & 1 deletion packages/ERTP/src/mathHelpers/strSetMathHelpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { passStyleOf } from '@agoric/marshal';
import { assert, details } from '@agoric/assert';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

import produceIssuer from '../../../src/issuer';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

function makeAliceMaker(E, log) {
return harden({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* global harden */
// eslint-disable-next-line import/no-extraneous-dependencies

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import harden from '@agoric/harden';

import makeAmountMath from '../../../src/amountMath';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* global harden */
// eslint-disable-next-line import/no-extraneous-dependencies

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import harden from '@agoric/harden';

import makeAmountMath from '../../../src/amountMath';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* global harden */
// eslint-disable-next-line import/no-extraneous-dependencies

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import harden from '@agoric/harden';

import makeAmountMath from '../../../src/amountMath';

Expand Down
1 change: 1 addition & 0 deletions packages/ERTP/test/unitTests/test-issuerObj.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import '@agoric/install-ses';
import test from 'tape-promise/tape';
import { E } from '@agoric/eventual-send';

Expand Down
4 changes: 3 additions & 1 deletion packages/ERTP/test/unitTests/test-mintObj.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* global harden */
// eslint-disable-next-line import/no-extraneous-dependencies

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import harden from '@agoric/harden';

import produceIssuer from '../../src/issuer';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

// This javascript source file uses the "tildot" syntax (foo~.bar()) for
// eventual sends.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

export default function setup(syscall, state, helpers) {
function log(what) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

// This javascript source file uses the "tildot" syntax (foo~.bar()) for
// eventual sends.
Expand Down
2 changes: 1 addition & 1 deletion packages/acorn-eventual-send/test/test-rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('SwingSet bug', async t => {
const bundle = await rollup({
input: require.resolve('../encouragementBotCommsWavyDot/bootstrap.js'),
treeshake: false,
external: ['@agoric/evaluate', '@agoric/nat', '@agoric/harden'],
external: ['@agoric/evaluate', '@agoric/nat'],
acornInjectPlugins: [eventualSend(acorn)],
});
t.ok(bundle);
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 @@ -16,6 +16,7 @@
"lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.{js,jsx}'"
},
"devDependencies": {
"@agoric/install-ses": "0.1.0",
"tap-spec": "^5.0.0",
"tape": "^4.11.0",
"tape-promise": "^4.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/test/test-main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global globalThis */
import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import fs from 'fs';
import anylogger from 'anylogger';
Expand Down
2 changes: 1 addition & 1 deletion packages/assert/package.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
},
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
"dependencies": {
"@agoric/harden": "^0.0.8"
},
"devDependencies": {
"esm": "^3.2.25",
"@agoric/install-ses": "0.1.0",
"tap-spec": "^5.0.0",
"tape": "^4.11.0",
"tape-promise": "^4.0.0"
Expand Down
7 changes: 3 additions & 4 deletions packages/assert/src/assert.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Copyright (C) 2019 Agoric, under Apache License 2.0

/* global harden */

// @ts-check

// This module assumes the de-facto standard `console` host object.
// To the extent that this `console` is considered a resource,
// this module must be considered a resource module.

import rawHarden from '@agoric/harden';

const harden = /** @type {<T>(x: T) => T} */ (rawHarden);

/**
* Prepend the correct indefinite article onto a noun, typically a typeof result
* e.g., "an Object" vs. "a Number"
Expand Down
1 change: 1 addition & 0 deletions packages/assert/test/test-assert.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@agoric/install-ses';
import { test } from 'tape';
import { an, assert, details, q } from '../src/assert';
import { throwsAndLogs } from './throwsAndLogs';
Expand Down
2 changes: 1 addition & 1 deletion packages/assert/test/throwsAndLogs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import harden from '@agoric/harden';
/* global harden */

const { defineProperty } = Object;

Expand Down
3 changes: 2 additions & 1 deletion packages/bundle-source/demo/dir1/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import harden from '@agoric/harden';
/* global harden */

import { encourage, makeError } from './encourage';
import more from './sub/more';

Expand Down
2 changes: 1 addition & 1 deletion packages/bundle-source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@agoric/acorn-eventual-send": "^2.0.5",
"@agoric/babel-parser": "^7.6.4",
"@agoric/harden": "^0.0.8",
"@agoric/install-ses": "0.1.0",
"@agoric/transform-eventual-send": "^1.3.0",
"@babel/generator": "^7.6.4",
"@rollup/plugin-commonjs": "^11.0.2",
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 @@ -48,7 +48,7 @@ export default async function bundleSource(
input: resolvedPath,
treeshake: false,
preserveModules: moduleFormat === 'nestedEvaluate',
external: ['@agoric/harden', ...externals],
external: [...externals],
plugins: [
resolvePlugin({ preferBuiltins: true }),
tildotPlugin(),
Expand Down
2 changes: 1 addition & 1 deletion packages/bundle-source/test/circular.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global Compartment */

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import bundleSource from '..';
Expand All @@ -15,7 +16,6 @@ test('circular export', async t => {
'nestedEvaluate',
);

// Fake out `require('@agoric/harden')`.
const require = _ => o => o;
const nestedEvaluate = src => {
// console.log('========== evaluating', src);
Expand Down
5 changes: 1 addition & 4 deletions packages/bundle-source/test/sanity.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global Compartment */

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import bundleSource from '..';
Expand All @@ -21,9 +22,7 @@ test('nestedEvaluate', async t => {
// console.log(srcMap1);

t.equal(mf1, 'nestedEvaluate', 'module format is nestedEvaluate');
t.assert(src1.match(/require\('@agoric\/harden'\)/), 'harden is required');

// Fake out `require('@agoric/harden')`.
const require = _ => o => o;
const nestedEvaluate = src => {
// console.log('========== evaluating', src);
Expand Down Expand Up @@ -78,9 +77,7 @@ test('getExport', async t => {
// console.log(srcMap1);

t.equal(mf1, 'getExport', 'module format is getExport');
t.assert(src1.match(/require\('@agoric\/harden'\)/), 'harden is required');

// Fake out `require('@agoric/harden')`.
// eslint-disable-next-line no-eval
const ex1 = eval(`const require = _ => o => o;${srcMap1}`)();

Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/test/tildot-transform.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import bundleSource from '..';

Expand Down
5 changes: 3 additions & 2 deletions packages/captp/lib/captp.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* global harden */

// This logic was mostly lifted from @agoric/swingset-vat liveSlots.js
// Defects in it are mfig's fault.
import { Remotable, makeMarshal, QCLASS } from '@agoric/marshal';
import harden from '@agoric/harden';
import Nat from '@agoric/nat';
import { HandledPromise, E } from '@agoric/eventual-send';
import { isPromise } from '@agoric/produce-promise';

export { E, HandledPromise, Nat, harden };
export { E, HandledPromise, Nat };

export function makeCapTP(ourId, send, bootstrapObj = undefined) {
let unplug = false;
Expand Down
2 changes: 1 addition & 1 deletion packages/captp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.js'"
},
"devDependencies": {
"@agoric/install-ses": "0.1.0",
"tap-spec": "^5.0.0",
"tape": "^4.11.0",
"tape-promise": "^4.0.0"
},
"dependencies": {
"@agoric/eventual-send": "^0.9.2",
"@agoric/harden": "^0.0.8",
"@agoric/marshal": "^0.2.2",
"@agoric/nat": "^2.0.1",
"@agoric/produce-promise": "^0.1.2",
Expand Down
5 changes: 4 additions & 1 deletion packages/captp/test/crosstalk.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* global harden */

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import { harden, makeCapTP, E } from '../lib/captp';
import { makeCapTP, E } from '../lib/captp';

test('prevent crosstalk', async t => {
try {
Expand Down
5 changes: 4 additions & 1 deletion packages/captp/test/disco.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* global harden */

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import { harden, makeCapTP } from '../lib/captp';
import { makeCapTP } from '../lib/captp';

test('try disconnecting captp', async t => {
try {
Expand Down
5 changes: 4 additions & 1 deletion packages/captp/test/loopback.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* global harden */

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import { E, harden, makeCapTP } from '../lib/captp';
import { E, makeCapTP } from '../lib/captp';

test('try loopback captp', async t => {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/eventual-send/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
},
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
"dependencies": {
"@agoric/harden": "^0.0.8"
},
"devDependencies": {
"esm": "^3.2.7",
"@agoric/install-ses": "0.1.0",
"rollup": "^1.2.2",
"tape": "^4.11.0",
"tape-promise": "^4.0.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/eventual-send/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export default [
file: 'dist/eventual-send.umd.js',
format: 'umd',
name: 'EventualSend',
globals: {
'@agoric/harden': 'harden',
},
// globals: {
// '@agoric/harden': 'harden',
// },
},
{
file: 'dist/eventual-send.esm.js',
Expand Down
5 changes: 2 additions & 3 deletions packages/eventual-send/src/E.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* global */
/* global harden */

// eslint-disable-next-line spaced-comment
/// <reference path="index.d.ts" />

import harden from '@agoric/harden';

const readOnlyProxy = {
set(_target, _prop, _value) {
return false;
Expand Down
4 changes: 1 addition & 3 deletions packages/eventual-send/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* global HandledPromise */

import harden from '@agoric/harden';
/* global harden HandledPromise */

import makeE from './E';

Expand Down
1 change: 1 addition & 0 deletions packages/eventual-send/test/test-e.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@agoric/install-ses';
import test from 'tape-promise/tape';
import { E, HandledPromise } from '../src/index';

Expand Down
2 changes: 1 addition & 1 deletion packages/import-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
},
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
"dependencies": {
"@agoric/harden": "^0.0.8"
},
"devDependencies": {
"@agoric/install-ses": "0.1.0",
"esm": "^3.2.25",
"tap-spec": "^5.0.0",
"tape": "^4.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/import-manager/src/importManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (C) 2019 Agoric, under Apache License 2.0

import harden from '@agoric/harden';
/* global harden */

// ImportManager allows a package to make some code available that can be run
// locally by a calling vat without requiring a remote round trip to the hosting
Expand Down
1 change: 1 addition & 0 deletions packages/import-manager/test/unitTests/test-importsA.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (C) 2019 Agoric, under Apache License 2.0

import '@agoric/install-ses';
import { test } from 'tape-promise/tape';
import { makeGoodImportManager } from './goodImports';

Expand Down
Loading

0 comments on commit d6cf911

Please sign in to comment.