Describe the bug
Refs: Agoric/agoric-sdk#8458
Refs: #1842
New contract packages are encountering a new Hardened JavaScript incompatibility (property override mistake) when attempting to use @endo/bundle-source to generate contract bundles.
One of the following errors appears:
(TypeError#1)
TypeError#1: Cannot assign to read only property 'constructor' of object '[object Object]'
at _interopRequireWildcard (/home/x/projects/x/contract/node_modules/@babel/highlight/lib/index.js:12:710)
at Object.<anonymous> (/home/x/projects/x/contract/node_modules/@babel/highlight/lib/index.js:10:14)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at module.exports.o.a._extensions..js (/home/x/projects/xcontract/node_modules/esm/esm.js:1:102412)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
Or:
TypeError#1: Cannot assign to read only property 'constructor' of object '[object Object]'
at _interopRequireWildcard (/home/x/projects/x/contract/node_modules/@babel/code-frame/lib/index.js:11:710)
at Object.<anonymous> (/home/x/projects/x/contract/node_modules/@babel/code-frame/lib/index.js:9:14)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at module.exports.o.a._extensions..js (/home/x/projects/x/contract/node_modules/esm/esm.js:1:102412)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at Object.<anonymous> (/home/x/projects/x/contract/node_modules/@babel/traverse/lib/path/replacement.js:12:18)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at module.exports.o.a._extensions..js (/home/x/projects/x/contract/node_modules/esm/esm.js:1:102412)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
Work-arounds
One option is to patch current versions, as demonstrated for this contract Kryha/KREAd@3c98655
Or, adding the following snippet to package.json in the affected application and running yarn should temporarily mitigate the problem. This will become vestigial and should be removed when a patch for @babel/code-frame gets released.
{
"resolutions": {
"@babel/code-frame": "7.18.6"
}
}
Or, call lockdown with override-taming set to severe:
lockdown({ overrideTaming: 'severe' });
Steps to reproduce
- Create a new package
- Add
@endo/bundle-source to dependencies
- Run
yarn
- Create an empty entry
entry.js
- Run
bundle-source --to-json bundles entry.js entry
Expected behavior
Should generate a bundle in bundles.
Platform environment
All
Additional context
Babel released what it believed to be a backward-compatible version circa 7.20 that introduced one or more property override mistakes incompatible with the Hardened JavaScript environment. Since semver does not differentiate between ordinary JavaScript and hardened JavaScript and as Babel does not test under a Hardened JavaScript environment (or merely an environment with a few frozen intrinsic prototypes), the breaking change was not recognized by the authors.
Notes
@babel/highlight 7.22.5 is compatible
@babel/code-frame 7.18.6 is compatible
@bable/code-frame 7.22.13 is incompatible
Describe the bug
Refs: Agoric/agoric-sdk#8458
Refs: #1842
New contract packages are encountering a new Hardened JavaScript incompatibility (property override mistake) when attempting to use
@endo/bundle-sourceto generate contract bundles.One of the following errors appears:
Or:
Work-arounds
One option is to patch current versions, as demonstrated for this contract Kryha/KREAd@3c98655
Or, adding the following snippet to
package.jsonin the affected application and runningyarnshould temporarily mitigate the problem. This will become vestigial and should be removed when a patch for@babel/code-framegets released.{ "resolutions": { "@babel/code-frame": "7.18.6" } }Or, call lockdown with override-taming set to severe:
Steps to reproduce
@endo/bundle-sourceto dependenciesyarnentry.jsbundle-source --to-json bundles entry.js entryExpected behavior
Should generate a bundle in
bundles.Platform environment
All
Additional context
Babel released what it believed to be a backward-compatible version circa 7.20 that introduced one or more property override mistakes incompatible with the Hardened JavaScript environment. Since semver does not differentiate between ordinary JavaScript and hardened JavaScript and as Babel does not test under a Hardened JavaScript environment (or merely an environment with a few frozen intrinsic prototypes), the breaking change was not recognized by the authors.
Notes
@babel/highlight7.22.5 is compatible@babel/code-frame7.18.6 is compatible@bable/code-frame7.22.13 is incompatible