@atlaspack/core 2.26.1-dev-68c10d2af.0 → 2.26.2
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/CHANGELOG.md +49 -0
- package/dist/SymbolPropagation.js +20 -17
- package/dist/atlaspack-v3/worker/worker.js +6 -1
- package/dist/requests/AssetGraphRequestRust.js +3 -49
- package/dist/requests/AtlaspackConfigRequest.js +21 -7
- package/lib/SymbolPropagation.js +20 -15
- package/lib/atlaspack-v3/worker/worker.js +9 -1
- package/lib/requests/AssetGraphRequestRust.js +4 -18
- package/lib/requests/AtlaspackConfigRequest.js +27 -7
- package/lib/types/atlaspack-v3/worker/worker.d.ts +2 -0
- package/package.json +20 -21
- package/src/SymbolPropagation.ts +28 -18
- package/src/atlaspack-v3/worker/worker.ts +8 -1
- package/src/requests/AssetGraphRequestRust.ts +4 -19
- package/src/requests/AtlaspackConfigRequest.ts +24 -7
- package/test/AtlaspackConfigRequest.test.ts +72 -0
- package/test/fixtures/config-with-reporters/.parcelrc +7 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/LICENSE +0 -201
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
PureAtlaspackConfigPipeline,
|
|
13
13
|
AtlaspackOptions,
|
|
14
14
|
ProcessedAtlaspackConfig,
|
|
15
|
+
AtlaspackPluginNode,
|
|
15
16
|
} from '../types';
|
|
16
17
|
|
|
17
18
|
import {createBuildCache} from '@atlaspack/build-cache';
|
|
@@ -197,13 +198,29 @@ export async function resolveAtlaspackConfig(
|
|
|
197
198
|
await parseAndProcessConfig(configPath, contents, options);
|
|
198
199
|
|
|
199
200
|
if (options.additionalReporters.length > 0) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
if (options.featureFlags.deduplicateReporters) {
|
|
202
|
+
const reporterMap = new Map<PackageName, AtlaspackPluginNode>();
|
|
203
|
+
|
|
204
|
+
options.additionalReporters.forEach(({packageName, resolveFrom}) => {
|
|
205
|
+
reporterMap.set(packageName, {packageName, resolveFrom});
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
config.reporters?.forEach((reporter) => {
|
|
209
|
+
if (!reporterMap.has(reporter.packageName)) {
|
|
210
|
+
reporterMap.set(reporter.packageName, reporter);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
config.reporters = Array.from(reporterMap.values());
|
|
215
|
+
} else {
|
|
216
|
+
config.reporters = [
|
|
217
|
+
...options.additionalReporters.map(({packageName, resolveFrom}) => ({
|
|
218
|
+
packageName,
|
|
219
|
+
resolveFrom,
|
|
220
|
+
})),
|
|
221
|
+
...(config.reporters ?? []),
|
|
222
|
+
];
|
|
223
|
+
}
|
|
207
224
|
}
|
|
208
225
|
|
|
209
226
|
return {config, extendedFiles, usedDefault};
|
|
@@ -801,6 +801,78 @@ describe('AtlaspackConfigRequest', () => {
|
|
|
801
801
|
});
|
|
802
802
|
});
|
|
803
803
|
|
|
804
|
+
describe('additionalReporters', () => {
|
|
805
|
+
it('should deduplicate reporters by packageName', async () => {
|
|
806
|
+
const configPath = path.join(
|
|
807
|
+
__dirname,
|
|
808
|
+
'fixtures',
|
|
809
|
+
'config-with-reporters',
|
|
810
|
+
'.parcelrc',
|
|
811
|
+
);
|
|
812
|
+
|
|
813
|
+
const options = {
|
|
814
|
+
...DEFAULT_OPTIONS,
|
|
815
|
+
projectRoot: path.join(__dirname, 'fixtures', 'config-with-reporters'),
|
|
816
|
+
config: configPath,
|
|
817
|
+
additionalReporters: [
|
|
818
|
+
{
|
|
819
|
+
packageName: '@atlaspack/reporter-cli',
|
|
820
|
+
resolveFrom: '/custom/path',
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
packageName: '@atlaspack/reporter-dev-server',
|
|
824
|
+
resolveFrom: '/another/path',
|
|
825
|
+
},
|
|
826
|
+
],
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
const result = await resolveAtlaspackConfig(options);
|
|
830
|
+
assert(result !== null && result !== undefined);
|
|
831
|
+
|
|
832
|
+
const {config} = result;
|
|
833
|
+
|
|
834
|
+
// With feature flag enabled, should have 3 reporters (with deduplication)
|
|
835
|
+
assert(
|
|
836
|
+
config.reporters && config.reporters.length === 3,
|
|
837
|
+
'Should have exactly 3 reporters with deduplication',
|
|
838
|
+
);
|
|
839
|
+
|
|
840
|
+
const cliReporter = config.reporters?.find(
|
|
841
|
+
(r) => r.packageName === '@atlaspack/reporter-cli',
|
|
842
|
+
);
|
|
843
|
+
const bundleAnalyzerReporter = config.reporters?.find(
|
|
844
|
+
(r) => r.packageName === '@atlaspack/reporter-bundle-analyzer',
|
|
845
|
+
);
|
|
846
|
+
const devServerReporter = config.reporters?.find(
|
|
847
|
+
(r) => r.packageName === '@atlaspack/reporter-dev-server',
|
|
848
|
+
);
|
|
849
|
+
|
|
850
|
+
assert(cliReporter, 'CLI reporter should exist');
|
|
851
|
+
assert.equal(
|
|
852
|
+
cliReporter.resolveFrom,
|
|
853
|
+
'/custom/path',
|
|
854
|
+
'CLI reporter should use additional reporter resolveFrom',
|
|
855
|
+
);
|
|
856
|
+
|
|
857
|
+
assert(
|
|
858
|
+
bundleAnalyzerReporter,
|
|
859
|
+
'Bundle analyzer reporter should exist from original config',
|
|
860
|
+
);
|
|
861
|
+
|
|
862
|
+
assert(devServerReporter, 'Dev server reporter should exist');
|
|
863
|
+
assert.equal(devServerReporter.resolveFrom, '/another/path');
|
|
864
|
+
|
|
865
|
+
const cliReporters = config.reporters?.filter(
|
|
866
|
+
(r) => r.packageName === '@atlaspack/reporter-cli',
|
|
867
|
+
);
|
|
868
|
+
assert.equal(
|
|
869
|
+
cliReporters?.length,
|
|
870
|
+
1,
|
|
871
|
+
'Should have exactly one CLI reporter after deduplication',
|
|
872
|
+
);
|
|
873
|
+
});
|
|
874
|
+
});
|
|
875
|
+
|
|
804
876
|
describe('resolve', () => {
|
|
805
877
|
it('should return null if there is no .parcelrc file found', async () => {
|
|
806
878
|
let resolved = await resolveAtlaspackConfig(DEFAULT_OPTIONS);
|