Skip to content

Commit f542dc1

Browse files
Merge remote-tracking branch 'origin/pr8-unified-api' into pr8-unified-api
# Conflicts: # packages/enhanced/src/lib/sharing/SharePlugin.ts # packages/enhanced/test/compiler-unit/sharing/SharePlugin.test.ts # packages/enhanced/test/unit/sharing/SharePlugin.improved.test.ts # packages/enhanced/test/unit/sharing/SharePlugin.test.ts
2 parents 4eaf792 + 8d1e46f commit f542dc1

File tree

4 files changed

+14
-32
lines changed

4 files changed

+14
-32
lines changed

packages/enhanced/src/lib/sharing/SharePlugin.ts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -176,27 +176,15 @@ class SharePlugin {
176176
process.env['FEDERATION_WEBPACK_PATH'] =
177177
process.env['FEDERATION_WEBPACK_PATH'] || getWebpackPath(compiler);
178178

179-
// Apply ConsumeSharedPlugin with enhanced error handling
180-
try {
181-
new ConsumeSharedPlugin({
182-
shareScope: this._shareScope,
183-
consumes: this._consumes,
184-
}).apply(compiler);
185-
} catch (error) {
186-
const message = error instanceof Error ? error.message : String(error);
187-
throw new Error(`Failed to apply ConsumeSharedPlugin: ${message}`);
188-
}
189-
190-
// Apply ProvideSharedPlugin with enhanced error handling
191-
try {
192-
new ProvideSharedPlugin({
193-
shareScope: this._shareScope,
194-
provides: this._provides,
195-
}).apply(compiler);
196-
} catch (error) {
197-
const message = error instanceof Error ? error.message : String(error);
198-
throw new Error(`Failed to apply ProvideSharedPlugin: ${message}`);
199-
}
179+
new ConsumeSharedPlugin({
180+
shareScope: this._shareScope,
181+
consumes: this._consumes,
182+
}).apply(compiler);
183+
184+
new ProvideSharedPlugin({
185+
shareScope: this._shareScope,
186+
provides: this._provides,
187+
}).apply(compiler);
200188
}
201189
}
202190

packages/enhanced/test/compiler-unit/sharing/SharePlugin.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,7 @@ describe('SharePlugin Compiler Integration', () => {
273273
new SharePlugin({
274274
shared: {},
275275
});
276-
}).toThrow(
277-
'SharePlugin requires at least one shared module configuration',
278-
);
276+
}).not.toThrow();
279277

280278
expect(() => {
281279
new SharePlugin({

packages/enhanced/test/unit/sharing/SharePlugin.improved.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,13 @@ describe('SharePlugin Real Behavior', () => {
287287
});
288288

289289
describe('edge cases and error handling', () => {
290-
it('should throw error for empty shared configuration', () => {
290+
it('should handle empty shared configuration', () => {
291291
expect(() => {
292292
new SharePlugin({
293293
shareScope: 'default',
294294
shared: {},
295295
});
296-
}).toThrow(
297-
'SharePlugin requires at least one shared module configuration',
298-
);
296+
}).not.toThrow();
299297
});
300298

301299
it('should handle missing shareScope with default fallback', () => {

packages/enhanced/test/unit/sharing/SharePlugin.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ const SharePlugin = require('../../../src/lib/sharing/SharePlugin').default;
4444

4545
describe('SharePlugin', () => {
4646
describe('constructor', () => {
47-
it('should throw error for empty shared configuration', () => {
47+
it('should handle empty shared configuration', () => {
4848
expect(() => {
4949
new SharePlugin({
5050
shared: {},
5151
});
52-
}).toThrow(
53-
'SharePlugin requires at least one shared module configuration',
54-
);
52+
}).not.toThrow();
5553
});
5654

5755
it('should allow both include and exclude filters together', () => {

0 commit comments

Comments
 (0)