fix(ses-ava)!: Favor NESM and RESM compatibility over CJS and UMD
MODIFY
packages/ses-ava/NEWS.md
packages/ses-ava/NEWS.md
@@ -2,7 +2,9 @@ User-visible changes in SES-Ava
## Next Release
-No changes yet.
+- *BREAKING*: Removes compatibility layer for UMD and CommonJS consumers.
+ Supporting both Node.js ESM and the `node -r esm` shim requires
+ the main entry point module to be ESM regardless of environment.
## Release 0.1.1 (5-April-2021)

MODIFY
packages/ses-ava/package.json
packages/ses-ava/package.json
"author": "Agoric",
"license": "Apache-2.0",
"type": "module",
- "main": "./dist/ses-ava.cjs",
- "module": "./src/main.js",
- "browser": "./dist/ses-ava.umd.js",
- "unpkg": "./dist/ses-ava.umd.js",
+ "main": "./src/main.js",
"exports": {
- "import": "./src/main.js",
- "require": "./dist/ses-ava.cjs",
- "browser": "./dist/ses-ava.umd.js"
+ "import": "./src/main.js"
},
"scripts": {
- "build": "rollup --config rollup.config.js",
- "clean": "rm -rf dist",
"lint": "yarn lint:types && yarn lint:js",
"lint:types": "tsc --build jsconfig.json",
"lint:js": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
- "prepublish": "yarn clean && yarn build",
"test": "yarn ava"
},
"dependencies": {
},
"files": [
"LICENSE*",
- "dist",
"src",
"exported.js"
],

DELETE
packages/ses-ava/rollup.config.js
-import resolve from '@rollup/plugin-node-resolve';
-import { terser } from 'rollup-plugin-terser';
-import commonjs from '@rollup/plugin-commonjs';
-import fs from 'fs';
-
-const metaPath = new URL('package.json', import.meta.url).pathname;
-const meta = JSON.parse(fs.readFileSync(metaPath, 'utf-8'));
-const name = meta.name.split('/').pop();
-const umd = meta.umd || name;
-
-export default [
- {
- input: 'src/main.js',
- output: [
- {
- file: `dist/${name}.mjs`,
- format: 'esm',
- },
- {
- file: `dist/${name}.cjs`,
- format: 'cjs',
- },
- ],
- plugins: [resolve(), commonjs()],
- },
- {
- input: 'src/main.js',
- output: {
- file: `dist/${name}.umd.js`,
- format: 'umd',
- name: umd,
- },
- plugins: [resolve(), commonjs()],
- },
- {
- input: 'src/main.js',
- output: {
- file: `dist/${name}.umd.min.js`,
- format: 'umd',
- name: umd,
- },
- plugins: [resolve(), commonjs(), terser()],
- },
-];

MODIFY
packages/ses-ava/src/main.js
packages/ses-ava/src/main.js
-export { wrapTest } from './ses-ava-test';
+export { wrapTest } from './ses-ava-test.js';

fix(ses-ava)!: Favor NESM and RESM compatibility over CJS and UMD