@atlaspack/core 2.16.2-canary.222 → 2.16.2-canary.230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Atlaspack.js +3 -1
- package/dist/BundleGraph.js +9 -2
- package/dist/PackagerRunner.js +9 -4
- package/dist/requests/AtlaspackBuildRequest.js +9 -4
- package/dist/requests/PackageRequest.js +1 -4
- package/dist/requests/WriteBundlesRequest.js +21 -2
- package/lib/Atlaspack.js +6 -3
- package/lib/BundleGraph.js +7 -2
- package/lib/PackagerRunner.js +17 -6
- package/lib/requests/AtlaspackBuildRequest.js +6 -4
- package/lib/requests/PackageRequest.js +1 -5
- package/lib/requests/WriteBundlesRequest.js +27 -2
- package/lib/types/PackagerRunner.d.ts +5 -0
- package/lib/types/requests/AtlaspackBuildRequest.d.ts +4 -0
- package/lib/types/requests/WriteBundlesRequest.d.ts +7 -1
- package/package.json +17 -17
- package/src/Atlaspack.ts +9 -2
- package/src/BundleGraph.ts +18 -7
- package/src/PackagerRunner.ts +18 -6
- package/src/requests/AtlaspackBuildRequest.ts +19 -4
- package/src/requests/PackageRequest.ts +1 -3
- package/src/requests/WriteBundlesRequest.ts +32 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -46,15 +46,13 @@ export function createPackageRequest(
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
async function run({input, api, farm}) {
|
|
49
|
+
async function run({input, api, farm}: RunInput<BundleInfo>) {
|
|
51
50
|
let {bundleGraphReference, optionsRef, bundle, useMainThread} = input;
|
|
52
51
|
let runPackage = farm.createHandle('runPackage', useMainThread);
|
|
53
52
|
|
|
54
53
|
let start = Date.now();
|
|
55
54
|
let {devDeps, invalidDevDeps} = await getDevDepRequests(api);
|
|
56
55
|
let {cachePath} = nullthrows(
|
|
57
|
-
// @ts-expect-error TS2347
|
|
58
56
|
await api.runRequest<null, ConfigAndCachePath>(
|
|
59
57
|
createAtlaspackConfigRequest(),
|
|
60
58
|
),
|
|
@@ -20,13 +20,20 @@ import nullthrows from 'nullthrows';
|
|
|
20
20
|
import {hashString} from '@atlaspack/rust';
|
|
21
21
|
import {createPackageRequest} from './PackageRequest';
|
|
22
22
|
import createWriteBundleRequest from './WriteBundleRequest';
|
|
23
|
+
import {debugTools} from '@atlaspack/utils';
|
|
23
24
|
|
|
24
25
|
type WriteBundlesRequestInput = {
|
|
25
26
|
bundleGraph: BundleGraph;
|
|
26
27
|
optionsRef: SharedReference;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
|
-
export type WriteBundlesRequestResult =
|
|
30
|
+
export type WriteBundlesRequestResult = {
|
|
31
|
+
bundleInfo: Map<string, PackagedBundleInfo>;
|
|
32
|
+
scopeHoistingStats?: {
|
|
33
|
+
totalAssets: number;
|
|
34
|
+
wrappedAssets: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
30
37
|
|
|
31
38
|
type RunInput<TResult> = {
|
|
32
39
|
input: WriteBundlesRequestInput;
|
|
@@ -206,8 +213,30 @@ async function run({
|
|
|
206
213
|
}),
|
|
207
214
|
);
|
|
208
215
|
|
|
209
|
-
|
|
210
|
-
|
|
216
|
+
let result: WriteBundlesRequestResult = {bundleInfo: res};
|
|
217
|
+
|
|
218
|
+
if (debugTools['scope-hoisting-stats']) {
|
|
219
|
+
// Aggregate scope hoisting stats from all bundles
|
|
220
|
+
let aggregatedScopeHoistingStats = {
|
|
221
|
+
totalAssets: 0,
|
|
222
|
+
wrappedAssets: 0,
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
for (let bundle of bundles) {
|
|
226
|
+
let bundleInfo = bundleInfoMap[bundle.id];
|
|
227
|
+
if (bundleInfo?.scopeHoistingStats) {
|
|
228
|
+
aggregatedScopeHoistingStats.totalAssets +=
|
|
229
|
+
bundleInfo.scopeHoistingStats.totalAssets;
|
|
230
|
+
aggregatedScopeHoistingStats.wrappedAssets +=
|
|
231
|
+
bundleInfo.scopeHoistingStats.wrappedAssets;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
result.scopeHoistingStats = aggregatedScopeHoistingStats;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
api.storeResult(result);
|
|
239
|
+
return result;
|
|
211
240
|
} finally {
|
|
212
241
|
await dispose();
|
|
213
242
|
}
|