Remove ESM from some modules
DELETE
packages/intrinsics-whitelist/.eslintrc.js
-/* global module */
-module.exports = {
- parser: 'babel-eslint',
- extends: [
- 'airbnb-base',
- 'plugin:prettier/recommended',
- 'plugin:eslint-comments/recommended'
- ],
- env: {
- es6: true, // supports new ES6 globals (e.g., new types such as Set)
- },
- rules: {
- 'implicit-arrow-linebreak': 'off',
- 'function-paren-newline': 'off',
- 'arrow-parens': 'off',
- strict: 'off',
- 'no-console': 'off',
- 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
- 'no-return-assign': 'off',
- 'no-param-reassign': 'off',
- 'no-restricted-syntax': ['off', 'ForOfStatement'],
- 'no-unused-expressions': 'off',
- 'no-loop-func': 'off',
- 'import/prefer-default-export': 'off', // contrary to Agoric standard
- },
-};

ADD
packages/intrinsics-whitelist/.eslintrc.json
+{
+ "parser": "babel-eslint",
+ "extends": [
+ "airbnb-base",
+ "plugin:prettier/recommended",
+ "plugin:eslint-comments/recommended"
+ ],
+ "env": {
+ "es6": true
+ },
+ "rules": {
+ "implicit-arrow-linebreak": "off",
+ "function-paren-newline": "off",
+ "arrow-parens": "off",
+ "strict": "off",
+ "no-console": "off",
+ "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
+ "no-return-assign": "off",
+ "no-param-reassign": "off",
+ "no-restricted-syntax": ["off", "ForOfStatement"],
+ "no-unused-expressions": "off",
+ "no-loop-func": "off",
+ "import/extensions": "off",
+ "import/prefer-default-export": "off"
+ }
+}

DELETE
packages/intrinsics-whitelist/index.js
-'use strict';
-
-const main = require('./src/whitelistIntrinsics');
-
-module.exports = main.default;

MODIFY
packages/intrinsics-whitelist/package.json
packages/intrinsics-whitelist/package.json
"description": "Whitelist intrinsics",
"author": "Agoric",
"license": "Apache-2.0",
- "main": "index.js",
+ "type": "module",
+ "main": "src/main.js",
"scripts": {
"lint-fix": "eslint --fix '**/*.js'",
"lint": "eslint '**/*.js'",
- "test": "tape -r esm 'test/**/*.test.js'",
+ "test": "tap --no-esm --no-coverage 'test/**/*.test.js'",
"build": "exit 0"
},
"devDependencies": {
"@agoric/intrinsics": "0.1.0",
"@agoric/test262-runner": "0.1.0",
"eslint": "6.8.0",
- "esm": "^3.2.25",
- "sinon": "^8.0.1",
- "tape": "4.12.1"
+ "tap": "^14.10.5"
}
}

RENAME
packages/intrinsics-whitelist/src/whitelistIntrinsics.js
packages/intrinsics-whitelist/src/main.js
// See the License for the specific language governing permissions and
// limitations under the License.
-import whitelist, { FunctionInstance } from './whitelist';
+import whitelist, { FunctionInstance } from './whitelist.js';
const { getPrototypeOf, getOwnPropertyDescriptor } = Object;

MODIFY
packages/intrinsics-whitelist/test/whitelistIntrinsics.test.js
packages/intrinsics-whitelist/test/whitelistIntrinsics.test.js
-import test from 'tape';
+import tap from 'tap';
import getIntrinsics from '@agoric/intrinsics';
-import whitelistPrototypes from '..';
+import whitelistPrototypes from '../src/main.js';
+const { test } = tap;
+
+// eslint-disable-next-line no-eval
+if (!eval.toString().includes('native code')) {
+ throw new TypeError('Module "esm" enabled: aborting');
+}
test('whitelistPrototypes - on', t => {
t.plan(5);

DELETE
packages/intrinsics/.eslintrc.js
-/* global module */
-module.exports = {
- parser: 'babel-eslint',
- extends: [
- 'airbnb-base',
- 'plugin:prettier/recommended',
- 'plugin:eslint-comments/recommended'
- ],
- env: {
- es6: true, // supports new ES6 globals (e.g., new types such as Set)
- },
- rules: {
- 'implicit-arrow-linebreak': 'off',
- 'function-paren-newline': 'off',
- 'arrow-parens': 'off',
- strict: 'off',
- 'no-console': 'off',
- 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
- 'no-return-assign': 'off',
- 'no-param-reassign': 'off',
- 'no-restricted-syntax': ['off', 'ForOfStatement'],
- 'no-unused-expressions': 'off',
- 'no-loop-func': 'off',
- 'import/prefer-default-export': 'off', // contrary to Agoric standard
- },
-};

ADD
packages/intrinsics/.eslintrc.json
+{
+ "parser": "babel-eslint",
+ "extends": [
+ "airbnb-base",
+ "plugin:prettier/recommended",
+ "plugin:eslint-comments/recommended"
+ ],
+ "env": {
+ "es6": true
+ },
+ "rules": {
+ "implicit-arrow-linebreak": "off",
+ "function-paren-newline": "off",
+ "arrow-parens": "off",
+ "strict": "off",
+ "no-console": "off",
+ "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
+ "no-return-assign": "off",
+ "no-param-reassign": "off",
+ "no-restricted-syntax": ["off", "ForOfStatement"],
+ "no-unused-expressions": "off",
+ "no-loop-func": "off",
+ "import/extensions": "off",
+ "import/prefer-default-export": "off"
+ }
+}

DELETE
packages/intrinsics/index.js
-'use strict';
-
-const main = require('./src/getIntrinsics');
-
-module.exports = main.default;

MODIFY
packages/intrinsics/package.json
packages/intrinsics/package.json
"description": "Get all intrinsics",
"author": "Agoric",
"license": "Apache-2.0",
- "main": "index.js",
+ "type": "module",
+ "main": "src/main.js",
"scripts": {
"lint-fix": "eslint --fix '**/*.js'",
"lint": "eslint '**/*.js'",
- "test": "tape -r esm 'test/**/*.test.js'",
+ "test": "tap --no-esm --no-coverage 'test/**/*.test.js'",
"build": "exit 0"
},
"devDependencies": {
"eslint": "6.8.0",
+ "eslint-config-airbnb-base": "^14.0.0",
+ "eslint-config-prettier": "6.7.0",
+ "eslint-plugin-eslint-comments": "^3.1.2",
+ "eslint-plugin-import": "2.19.1",
+ "eslint-plugin-prettier": "3.1.1",
"esm": "^3.2.25",
- "sinon": "^8.0.1",
- "tape": "4.12.1"
+ "tap": "^14.10.5"
}
}

RENAME
packages/intrinsics/src/getIntrinsics.js
packages/intrinsics/src/main.js
MODIFY
packages/intrinsics/test/getIntrinsics.test.js
packages/intrinsics/test/getIntrinsics.test.js
-import test from 'tape';
-import getIntrinsics from '..';
+import tap from 'tap';
+import getIntrinsics from '../src/main.js';
+
+const { test } = tap;
+
+// eslint-disable-next-line no-eval
+if (!eval.toString().includes('native code')) {
+ throw new TypeError('Module "esm" enabled: aborting');
+}
const { getPrototypeOf } = Object;

Remove ESM from some modules