Skip to content

Commit

Permalink
fix(bundle-source): Relieve execa dependency (merge #2164)
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal authored Mar 21, 2024
2 parents 86766d2 + eff91d8 commit 9a5027f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 165 deletions.
4 changes: 4 additions & 0 deletions packages/bundle-source/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

# v3.2.1 (2024-03-20)

- Fixes an install-time bug introduced in 3.2.0.

# v2.8.0 (2023-09-11)

- The `@endo/bundle-source/cache.js` maker now accepts additional optional
Expand Down
6 changes: 2 additions & 4 deletions packages/bundle-source/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@endo/bundle-source",
"version": "3.2.0",
"version": "3.2.1",
"description": "Create source bundles from ES Modules",
"type": "module",
"main": "src/index.js",
Expand All @@ -14,7 +14,6 @@
"./package.json": "./package.json"
},
"scripts": {
"postinstall": "patch-package",
"build": "exit 0",
"build:types": "tsc --build tsconfig.build.json",
"clean:types": "git clean -f '*.d.ts*'",
Expand Down Expand Up @@ -43,8 +42,7 @@
"@endo/lockdown": "^1.0.5",
"@endo/ses-ava": "^1.2.0",
"ava": "^6.1.2",
"c8": "^7.14.0",
"execa": "^8.0.1"
"c8": "^7.14.0"
},
"keywords": [],
"files": [
Expand Down
136 changes: 0 additions & 136 deletions packages/bundle-source/patches/mimic-fn+4.0.0.patch

This file was deleted.

19 changes: 0 additions & 19 deletions packages/bundle-source/test/execava.js

This file was deleted.

47 changes: 41 additions & 6 deletions packages/bundle-source/test/test-tool-command.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,50 @@
import test from '@endo/ses-ava/prepare-endo.js';

import { spawn } from 'child_process';
import url from 'url';
import { execava } from './execava.js';
import Buffer from 'buffer';

const cwd = url.fileURLToPath(new URL('..', import.meta.url));
const opts = { cwd };

const shellOut = () =>
new Promise((resolve, reject) => {
const errorChunks = [];
const child = spawn(
'node',
[
'bin/bundle-source',
'--cache-json',
'bundles',
'demo/circular/a.js',
'circular',
'demo/dir1/index.js',
'dir1',
],
{
cwd,
stdio: ['inherit', 'inherit', 'pipe'],
},
);
child.on('close', code => {
if (code !== 0) {
reject(
new Error(
`Exit code: ${code}\nError output: ${new TextDecoder().decode(
Buffer.concat(errorChunks),
)}`,
),
);
} else {
resolve(undefined);
}
});
child.stderr.on('data', chunk => {
errorChunks.push(chunk);
});
});

test('bundle-source command is concurrency safe', async t => {
const $ = execava(t, opts);
const concurrentJobs = Array.from({ length: 5 }).map(() =>
$`node bin/bundle-source --cache-json bundles demo/circular/a.js circular demo/dir1/index.js dir1`.expect(),
);
const concurrentJobs = Array.from({ length: 5 }).map(() => shellOut());
await Promise.all(concurrentJobs);
t.pass();
});

0 comments on commit 9a5027f

Please sign in to comment.