Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"test:watch": "vitest --config vitest.config.ts"
},
"dependencies": {
"@endo/lockdown": "^1.0.7",
"@endo/promise-kit": "^1.1.2",
"@endo/lockdown": "^1.0.9",
"@endo/promise-kit": "^1.1.4",
"@metamask/snaps-utils": "^7.8.0",
"@metamask/utils": "^9.1.0",
"@ocap/shims": "workspace:^",
Expand Down
6 changes: 3 additions & 3 deletions packages/shims/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
"test:watch": "vitest --config vitest.config.ts"
},
"dependencies": {
"@endo/eventual-send": "^1.2.2",
"@endo/lockdown": "^1.0.7",
"@endo/eventual-send": "^1.2.4",
"@endo/lockdown": "^1.0.9",
"ses": "^1.7.0"
},
"devDependencies": {
"@endo/bundle-source": "^3.3.0",
"@metamask/auto-changelog": "^3.4.4",
"deepmerge": "^4.3.1",
"mkdirp": "^3.0.1",
"rimraf": "^6.0.1",
"vitest": "^2.0.5"
},
Expand Down
30 changes: 19 additions & 11 deletions packages/shims/scripts/bundle.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
import 'ses';
import '@endo/lockdown/commit.js';

import { copyFile } from 'fs/promises';
import { mkdirp } from 'mkdirp';
import bundleSource from '@endo/bundle-source';
import { copyFile, mkdir, writeFile } from 'fs/promises';
import path from 'path';
// TODO: Bundle the eventual send shim using bundle-source after the next endo release.
// import bundleSource from '@endo/bundle-source';
import { rimraf } from 'rimraf';
import { fileURLToPath } from 'url';

console.log('Bundling shims...');

const rootDir = path.resolve(import.meta.dirname, '..');
const src = path.resolve(rootDir, 'src');
const dist = path.resolve(rootDir, 'dist');

// const eventualSendSrc = path.resolve(rootDir, '../../node_modules/@endo/eventual-send/shim.js');

const fileNames = {
endoify: 'endoify.mjs',
eventualSend: 'eventual-send.mjs',
lockdown: 'apply-lockdown.mjs',
applyLockdown: 'apply-lockdown.mjs',
};

await mkdirp(dist);
await mkdir(dist, { recursive: true });
await rimraf(`${dist}/*`);

for (const fileName of Object.values(fileNames)) {
for (const fileName of [fileNames.endoify, fileNames.applyLockdown]) {
await copyFile(path.resolve(src, fileName), path.resolve(dist, fileName));
}

// const { source } = await bundleSource(eventualSendSrc, { format: 'endoScript' });
const eventualSendSourcePath = fileURLToPath(
import.meta.resolve('@endo/eventual-send/shim.js'),
);

const { source: eventualSendBundleSource } = await bundleSource(
eventualSendSourcePath,
{ format: 'endoScript' },
);

await writeFile(
path.resolve(dist, fileNames.eventualSend),
eventualSendBundleSource,
);

console.log('Success!');
Loading