-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch @cosmjs/math for SES compatibility (#9583)
closes: #9408 ## Description Pending endojs/endo#2330, we patch `@cosmjs/math` such that imports from ESM reflect the exported types. ### Security Considerations None. ### Scaling Considerations None. ### Documentation Considerations None. ### Testing Considerations Included test. ### Upgrade Considerations None.
- Loading branch information
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Decimal } from '@cosmjs/math'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// A test to verify that importing @cosmsjs/math into an ESM via bundleSource | ||
// can see the exported Decimal constructor, which was at time of writing obscured | ||
// by https://github.com/endojs/endo/pull/2330, temporarily mitigated by a patch. | ||
// Placed here only because Agoric CLI depends on both bundleSource and CosmJS math. | ||
|
||
import test from '@endo/ses-ava/prepare-endo.js'; | ||
import url from 'url'; | ||
import bundleSource from '@endo/bundle-source'; | ||
import { importBundle } from '@endo/import-bundle'; | ||
|
||
test('bundled @comjs/math exports Decimal', async t => { | ||
const entryPath = url.fileURLToPath( | ||
new URL('bundle-cosmjs-math.js', import.meta.url), | ||
); | ||
const bundle = await bundleSource(entryPath); | ||
const ns = await importBundle(bundle); | ||
t.not(ns.Decimal, undefined); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff --git a/node_modules/@cosmjs/math/build/index.js b/node_modules/@cosmjs/math/build/index.js | ||
index 1f812f6..6e25ac9 100644 | ||
--- a/node_modules/@cosmjs/math/build/index.js | ||
+++ b/node_modules/@cosmjs/math/build/index.js | ||
@@ -1,11 +1,10 @@ | ||
-"use strict"; | ||
-Object.defineProperty(exports, "__esModule", { value: true }); | ||
-exports.Uint64 = exports.Uint53 = exports.Uint32 = exports.Int53 = exports.Decimal = void 0; | ||
-var decimal_1 = require("./decimal"); | ||
-Object.defineProperty(exports, "Decimal", { enumerable: true, get: function () { return decimal_1.Decimal; } }); | ||
-var integers_1 = require("./integers"); | ||
-Object.defineProperty(exports, "Int53", { enumerable: true, get: function () { return integers_1.Int53; } }); | ||
-Object.defineProperty(exports, "Uint32", { enumerable: true, get: function () { return integers_1.Uint32; } }); | ||
-Object.defineProperty(exports, "Uint53", { enumerable: true, get: function () { return integers_1.Uint53; } }); | ||
-Object.defineProperty(exports, "Uint64", { enumerable: true, get: function () { return integers_1.Uint64; } }); | ||
+'use strict'; | ||
+Object.defineProperty(exports, '__esModule', { value: true }); | ||
+var decimal_1 = require('./decimal'); | ||
+var integers_1 = require('./integers'); | ||
+exports.Uint64 = integers_1.Uint64; | ||
+exports.Uint53 = integers_1.Uint53; | ||
+exports.Uint32 = integers_1.Uint32; | ||
+exports.Int53 = integers_1.Int53; | ||
+exports.Decimal = decimal_1.Decimal; | ||
//# sourceMappingURL=index.js.map |