@atlaspack/core 2.25.2-dev-9bc89ddee.0 → 2.25.2-dev-9dac9ed3a.0
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/PackagerRunner.js +9 -4
- package/dist/requests/AtlaspackBuildRequest.js +9 -4
- package/dist/requests/PackageRequest.js +1 -4
- package/dist/requests/TargetRequest.js +1 -0
- package/dist/requests/WriteBundlesRequest.js +21 -2
- package/lib/Atlaspack.js +6 -3
- package/lib/PackagerRunner.js +17 -6
- package/lib/requests/AtlaspackBuildRequest.js +6 -4
- package/lib/requests/PackageRequest.js +1 -5
- package/lib/requests/TargetRequest.js +2 -1
- 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 +19 -19
- package/src/Atlaspack.ts +9 -2
- package/src/PackagerRunner.ts +18 -6
- package/src/requests/AtlaspackBuildRequest.ts +19 -4
- package/src/requests/PackageRequest.ts +1 -3
- package/src/requests/TargetRequest.ts +1 -0
- package/src/requests/WriteBundlesRequest.ts +32 -3
- package/test/TargetRequest.test.ts +12 -0
- package/test/fixtures/custom-targets/package.json +6 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -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
|
}
|
|
@@ -382,6 +382,9 @@ describe('TargetResolver', () => {
|
|
|
382
382
|
loc: undefined,
|
|
383
383
|
sourceType: 'module',
|
|
384
384
|
unstableSingleFileOutput: false,
|
|
385
|
+
customEnv: {
|
|
386
|
+
useFlag: 'false',
|
|
387
|
+
},
|
|
385
388
|
}),
|
|
386
389
|
loc: {
|
|
387
390
|
filePath: relative(
|
|
@@ -416,6 +419,9 @@ describe('TargetResolver', () => {
|
|
|
416
419
|
loc: undefined,
|
|
417
420
|
sourceType: 'module',
|
|
418
421
|
unstableSingleFileOutput: false,
|
|
422
|
+
customEnv: {
|
|
423
|
+
useFlag: 'true',
|
|
424
|
+
},
|
|
419
425
|
}),
|
|
420
426
|
loc: {
|
|
421
427
|
filePath: relative(
|
|
@@ -501,6 +507,9 @@ describe('TargetResolver', () => {
|
|
|
501
507
|
loc: undefined,
|
|
502
508
|
sourceType: 'module',
|
|
503
509
|
unstableSingleFileOutput: false,
|
|
510
|
+
customEnv: {
|
|
511
|
+
useFlag: 'false',
|
|
512
|
+
},
|
|
504
513
|
}),
|
|
505
514
|
loc: {
|
|
506
515
|
filePath: relative(
|
|
@@ -535,6 +544,9 @@ describe('TargetResolver', () => {
|
|
|
535
544
|
loc: undefined,
|
|
536
545
|
sourceType: 'module',
|
|
537
546
|
unstableSingleFileOutput: false,
|
|
547
|
+
customEnv: {
|
|
548
|
+
useFlag: 'true',
|
|
549
|
+
},
|
|
538
550
|
}),
|
|
539
551
|
loc: {
|
|
540
552
|
filePath: relative(
|