Skip to content

Commit 3c1fc8d

Browse files
committed
Merge remote-tracking branch 'origin/main' into HEAD
* origin/main: perf: bundle runtime dependencies and report full install size (#2310)
2 parents 4ffd542 + 7a2d48d commit 3c1fc8d

14 files changed

Lines changed: 163 additions & 403 deletions

File tree

.github/workflows/size.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ jobs:
9999
--startup-runs 7 \
100100
--json .tmp/size-report.json \
101101
--markdown .tmp/size-report.md
102+
cp /tmp/agent-device-size-base.json .tmp/size-report-base.json
103+
104+
- name: Upload detailed size reports
105+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
106+
with:
107+
name: size-report
108+
path: .tmp/size-report*.json
109+
include-hidden-files: true
110+
if-no-files-found: error
102111

103112
- name: Add job summary
104113
run: cat .tmp/size-report.md >> "$GITHUB_STEP_SUMMARY"

package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,6 @@
265265
"maestro",
266266
"detox"
267267
],
268-
"dependencies": {
269-
"@limrun/api": "^0.24.5",
270-
"ipaddr.js": "^2.5.0",
271-
"undici": "7.29.0",
272-
"yaml": "^2.9.0",
273-
"yauzl": "^3.4.0"
274-
},
275268
"peerDependencies": {
276269
"ai": "^6.0.0 || ^7.0.0"
277270
},
@@ -302,6 +295,7 @@
302295
"@agent-device/xml": "workspace:*",
303296
"@arethetypeswrong/cli": "^0.18.5",
304297
"@chenglou/freerange": "^0.0.4",
298+
"@limrun/api": "^0.24.5",
305299
"@nkzw/eslint-plugin": "^2.0.0",
306300
"@nkzw/oxlint-config": "^1.3.0",
307301
"@stryker-mutator/core": "10.0.0",
@@ -317,6 +311,7 @@
317311
"eslint-plugin-perfectionist": "^5.10.1",
318312
"fallow": "^2.104.0",
319313
"fast-check": "^4.9.0",
314+
"ipaddr.js": "^2.5.0",
320315
"oxc-parser": "^0.146.0",
321316
"oxfmt": "^0.64.0",
322317
"oxlint": "^1.79.0",
@@ -325,7 +320,10 @@
325320
"tar-stream": "^3.2.0",
326321
"tsdown": "^0.22.14",
327322
"typescript": "^7.0.2",
323+
"undici": "7.29.0",
328324
"vite": "^8.2.1",
329-
"vitest": "^4.1.11"
325+
"vitest": "^4.1.11",
326+
"yaml": "^2.9.0",
327+
"yauzl": "^3.4.0"
330328
}
331329
}

packages/host-kit/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"description": "Private host-mechanics package: each export is one narrow capability port over the host machine \u2014 running commands, observing and owning processes, diagnostics, retry/deadline, archive extraction, durable files and locks, request-scoped plumbing, and the installed version.",
77
"dependencies": {
88
"@agent-device/contracts": "workspace:*",
9-
"@agent-device/kernel": "workspace:*",
10-
"yauzl": "^3.4.0"
9+
"@agent-device/kernel": "workspace:*"
1110
},
1211
"devDependencies": {
1312
"@types/tar-stream": "^3.1.4",
1413
"@types/yauzl": "^3.4.0",
15-
"tar-stream": "^3.2.0"
14+
"tar-stream": "^3.2.0",
15+
"yauzl": "^3.4.0"
1616
},
1717
"exports": {
1818
"./archive": {

packages/maestro/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
"dependencies": {
99
"@agent-device/contracts": "workspace:*",
1010
"@agent-device/kernel": "workspace:*",
11-
"@agent-device/selectors": "workspace:*",
12-
"yaml": "^2.9.0"
11+
"@agent-device/selectors": "workspace:*"
1312
},
1413
"exports": {
1514
".": {
1615
"types": "./src/index.ts",
1716
"default": "./src/index.ts"
1817
}
18+
},
19+
"devDependencies": {
20+
"yaml": "^2.9.0"
1921
}
2022
}

packages/provider-limrun/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
"dependencies": {
88
"@agent-device/capture-kit": "workspace:*",
99
"@agent-device/contracts": "workspace:*",
10-
"@agent-device/kernel": "workspace:*",
11-
"@limrun/api": "^0.24.5"
10+
"@agent-device/kernel": "workspace:*"
1211
},
1312
"exports": {
1413
".": {
1514
"types": "./src/index.ts",
1615
"default": "./src/index.ts"
1716
}
17+
},
18+
"devDependencies": {
19+
"@limrun/api": "^0.24.5"
1820
}
1921
}

packages/provision-kit/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
"dependencies": {
88
"@agent-device/contracts": "workspace:*",
99
"@agent-device/host-kit": "workspace:*",
10-
"@agent-device/kernel": "workspace:*",
11-
"ipaddr.js": "^2.5.0",
12-
"undici": "7.29.0"
10+
"@agent-device/kernel": "workspace:*"
1311
},
1412
"exports": {
1513
"./app-resolution-cache": {
@@ -44,5 +42,9 @@
4442
"types": "./src/toolchain-probe.ts",
4543
"default": "./src/toolchain-probe.ts"
4644
}
45+
},
46+
"devDependencies": {
47+
"ipaddr.js": "^2.5.0",
48+
"undici": "7.29.0"
4749
}
4850
}

pnpm-lock.yaml

Lines changed: 21 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/__tests__/size-report-package.test.ts

Lines changed: 20 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,12 @@ import { readFile } from 'node:fs/promises';
33
import { join } from 'node:path';
44
import { test } from 'vitest';
55
import { formatMarkdown } from '../size-report.mjs';
6-
import {
7-
assertPublishPackageContents,
8-
classifyNpmPackEntry,
9-
summarizeNpmPackComponents,
10-
} from '../size-report-package.mjs';
6+
import { assertPublishPackageContents } from '../size-report-package.mjs';
117

128
const fixturePack = JSON.parse(
139
await readFile(join(import.meta.dirname, 'fixtures', 'size-report-npm-pack.json'), 'utf8'),
1410
);
1511

16-
test('classifies every shipped entry into one named component', () => {
17-
const classified = fixturePack.files.map(classifyNpmPackEntry);
18-
19-
assert.deepEqual(
20-
classified.map((entry) => [entry.path, entry.component]),
21-
[
22-
['dist/src/index.js', 'js'],
23-
['dist/src/index.d.ts', 'js'],
24-
['dist/apple/runner/RunnerTests.swift', 'apple-runner'],
25-
['dist/apple/snapshot-presentation/Package.swift', 'apple-snapshot-presentation'],
26-
['apple/snapshot-bridge/SnapshotBridge.m', 'apple-snapshot-bridge'],
27-
['apple/snapshot-bridge/SnapshotBridgeRuntime.m', 'apple-snapshot-bridge'],
28-
['apple/snapshot-bridge/SnapshotBridgeRuntime.h', 'apple-snapshot-bridge'],
29-
['apple/macos-helper/Sources/main.swift', 'macos-helper'],
30-
['android/snapshot-helper/dist/helper.apk', 'android-helpers'],
31-
['android/snapshot-helper/dist/helper.manifest.json', 'android-helpers'],
32-
['android/ime-helper/dist/helper.apk', 'android-helpers'],
33-
['android/ime-helper/dist/helper.manifest.json', 'android-helpers'],
34-
['package.json', 'other'],
35-
['vendor/unknown.bin', 'other'],
36-
],
37-
);
38-
});
39-
40-
test('unknown package paths fall into other', () => {
41-
assert.equal(
42-
classifyNpmPackEntry({ path: 'new/future-package-file', size: 13 }).component,
43-
'other',
44-
);
45-
});
46-
4712
test('publish package requires both Android helpers and excludes benchmark scripts', () => {
4813
assert.doesNotThrow(() => assertPublishPackageContents(fixturePack.files));
4914
assert.throws(
@@ -78,65 +43,34 @@ test('publish package requires both Android helpers and excludes benchmark scrip
7843
);
7944
});
8045

81-
test('component bytes sum exactly to npm pack unpackedSize', () => {
82-
const components = summarizeNpmPackComponents(fixturePack);
83-
84-
assert.equal(
85-
components.reduce((total, component) => total + component.unpackedBytes, 0),
86-
fixturePack.unpackedSize,
87-
);
88-
assert.deepEqual(
89-
Object.fromEntries(components.map((component) => [component.id, component.unpackedBytes])),
90-
{
91-
js: 503,
92-
'apple-runner': 503,
93-
'apple-snapshot-presentation': 113,
94-
'apple-snapshot-bridge': 0,
95-
'macos-helper': 211,
96-
'android-helpers': 812,
97-
other: 177,
98-
},
99-
);
100-
assert.throws(
101-
() => summarizeNpmPackComponents({ ...fixturePack, unpackedSize: 2318 }),
102-
/does not match npm pack unpackedSize/,
103-
);
104-
});
105-
106-
test('Markdown reports component diffs and changed packed files', () => {
46+
test('Markdown emphasizes total install size and startup without duplicate breakdowns', () => {
10747
const current = {
108-
js: { rawBytes: 10, gzipBytes: 8 },
48+
bundled: { rawBytes: 300, gzipBytes: 100 },
10949
npmPack: {
11050
tarballBytes: 100,
111-
unpackedBytes: 2319,
112-
components: summarizeNpmPackComponents(fixturePack),
51+
unpackedBytes: 300,
11352
entries: fixturePack.files,
11453
},
115-
chunks: [],
54+
cleanInstalled: { packageBytes: 300, totalBytes: 350, files: 3 },
55+
startup: { runs: 7, benchmarks: [{ name: 'CLI --help', medianMs: 20 }] },
11656
};
117-
const baseEntries = fixturePack.files.map((entry) =>
118-
entry.path === 'dist/src/index.js' ? { ...entry, size: 300 } : entry,
119-
);
12057
const base = {
121-
js: { rawBytes: 10, gzipBytes: 8 },
122-
npmPack: {
123-
tarballBytes: 100,
124-
unpackedBytes: 2218,
125-
components: summarizeNpmPackComponents({
126-
...fixturePack,
127-
unpackedSize: 2218,
128-
files: baseEntries,
129-
}),
130-
entries: baseEntries,
131-
},
132-
chunks: [],
58+
...current,
59+
npmPack: { ...current.npmPack, tarballBytes: 90, unpackedBytes: 200 },
60+
cleanInstalled: { packageBytes: 200, totalBytes: 900, files: 8 },
61+
startup: { runs: 7, benchmarks: [{ name: 'CLI --help', medianMs: 25 }] },
13362
};
13463

13564
const markdown = formatMarkdown(current, base);
13665

137-
assert.match(markdown, /### npm unpacked components/);
138-
assert.match(markdown, /\| JS \/ dist source \| 402 B \| 503 B \| \+101 B \|/);
139-
assert.match(markdown, /\| Other package files \| 177 B \| 177 B \| 0 B \|/);
140-
assert.match(markdown, /### Top changed packed files/);
141-
assert.match(markdown, /`dist\/src\/index\.js` \| 300 B \| 401 B \| \+101 B/);
66+
assert.match(markdown, /<!-- agent-device-size-report -->/);
67+
assert.match(markdown, /\| Installed \(including dependencies\) \| 900 B \| 350 B \| -550 B \|/);
68+
assert.match(markdown, /\| Package \(unpacked\) \| 200 B \| 300 B \| \+100 B \|/);
69+
assert.match(markdown, /\| Package \(download\) \| 90 B \| 100 B \| \+10 B \|/);
70+
assert.match(markdown, /\| CLI --help \| 25.0 ms \| 20.0 ms \| -5.0 ms \|/);
71+
assert.doesNotMatch(markdown, /JS raw|JS gzip|npm bundled|components|Top.*chunks|packed files/);
72+
assert.match(
73+
formatMarkdown(current, null),
74+
/\| Installed \(including dependencies\) \| - \| 350 B \| - \|/,
75+
);
14276
});

0 commit comments

Comments
 (0)