From f610e3485fb663104453177b2931c7d5610ee24c Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 11 Oct 2024 10:28:42 -0700 Subject: [PATCH] feat(import-bundle): Thread native flag --- packages/import-bundle/NEWS.md | 11 +++++++++++ packages/import-bundle/src/index.js | 2 ++ 2 files changed, 13 insertions(+) diff --git a/packages/import-bundle/NEWS.md b/packages/import-bundle/NEWS.md index e2df12a512..506fc7636d 100644 --- a/packages/import-bundle/NEWS.md +++ b/packages/import-bundle/NEWS.md @@ -1,5 +1,16 @@ User-visible changes to `@endo/import-bundle`: +# Next release + +Experimental: + +- Adds a `__native__: true` option that indicates that the application will + fall through to the native implementation of Compartment, currently only + available on XS, which lacks support for precompiled module sources (as exist + in many archived applications, particularly Agoric smart contract bundles) + and instead supports loading modules from original sources (which is not + possible at runtime on XS). + # v1.3.0 (2024-10-10) - Adds support for `endoScript` format bundles. diff --git a/packages/import-bundle/src/index.js b/packages/import-bundle/src/index.js index f8b374b35a..de5d1017fe 100644 --- a/packages/import-bundle/src/index.js +++ b/packages/import-bundle/src/index.js @@ -24,6 +24,7 @@ export async function importBundle(bundle, options = {}, powers = {}) { transforms = [], inescapableTransforms = [], inescapableGlobalProperties = {}, + __native__ = false, expectedSha512 = undefined, } = options; const { @@ -71,6 +72,7 @@ export async function importBundle(bundle, options = {}, powers = {}) { const { namespace } = await archive['import']({ globals: endowments, __shimTransforms__: transforms, + __native__, // @ts-expect-error TS2740 missing properties from type Compartment: CompartmentToUse, });