Skip to content

Commit 5b1679f

Browse files
fix(nextjs-mf): align share flag rename
1 parent 88a8f19 commit 5b1679f

File tree

10 files changed

+130
-130
lines changed

10 files changed

+130
-130
lines changed

apps/website-new/docs/en/configure/advanced-sharing.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface SharedConfig {
2626
issuerLayer?: string; // Restrict config to apply only when the consuming module (issuer) is in this layer.
2727
include?: IncludeExcludeOptions; // Rules to include specific modules/versions
2828
exclude?: IncludeExcludeOptions; // Rules to exclude specific modules/versions
29-
nodeModulesReconstructedLookup?: boolean; // Enable enhanced matching for relative imports for this shared item
29+
allowNodeModulesSuffixMatch?: boolean; // Enable enhanced matching for relative imports for this shared item
3030
}
3131

3232
interface IncludeExcludeOptions {
@@ -365,9 +365,9 @@ In this Next.js-style example:
365365
- `react` is configured differently for `rsc` (React Server Components) layer and `client` layer. Each uses its own `layer`, `issuerLayer`, and `shareScope` to ensure proper isolation and version control.
366366
- `next/` prefix sharing is applied to the `client` layer, excluding certain subpaths that might not be needed or could cause issues on the client.
367367

368-
## nodeModulesReconstructedLookup
368+
## allowNodeModulesSuffixMatch
369369

370-
`nodeModulesReconstructedLookup` is now a per-shared-item option in the `shared` configuration. It enables enhanced matching for relative imports inside node_modules for the specific shared item where it is set.
370+
`allowNodeModulesSuffixMatch` is now a per-shared-item option in the `shared` configuration. It enables enhanced matching for relative imports inside node_modules for the specific shared item where it is set.
371371

372372
**How to use:**
373373

@@ -381,8 +381,8 @@ module.exports = {
381381
new ModuleFederationPlugin({
382382
name: 'host',
383383
shared: {
384-
'shared': { nodeModulesReconstructedLookup: true }, // Share the root module with enhanced lookup
385-
'shared/directory/': { nodeModulesReconstructedLookup: true } // Share all modules under this path with enhanced lookup
384+
'shared': { allowNodeModulesSuffixMatch: true }, // Share the root module with enhanced lookup
385+
'shared/directory/': { allowNodeModulesSuffixMatch: true } // Share all modules under this path with enhanced lookup
386386
}
387387
})
388388
]

apps/website-new/docs/en/configure/experiments.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ new ModuleFederationPlugin({
1515
disableSnapshot: false,
1616
target: 'web',
1717
},
18-
nodeModulesReconstructedLookup: true
18+
allowNodeModulesSuffixMatch: true
1919
},
2020
shared: {
2121
react: {
@@ -45,7 +45,7 @@ When `asyncStartup` is enabled, all Module Federation entrypoints will initializ
4545
When using this mode, all entrypoints will initialize asynchronously. If you're manually requiring a bundled entrypoint or exposing a UMD library, it will return a promise resolving to the exports.
4646
:::
4747

48-
## nodeModulesReconstructedLookup
48+
## allowNodeModulesSuffixMatch
4949

5050
- **Type:** `boolean`
5151
- **Required:** No
@@ -57,14 +57,14 @@ Enables enhanced module resolution for packages located in `node_modules`, parti
5757

5858
**How to use:**
5959

60-
Set `nodeModulesReconstructedLookup: true` on individual shared items that need this behavior:
60+
Set `allowNodeModulesSuffixMatch: true` on individual shared items that need this behavior:
6161

6262
```ts
6363
new ModuleFederationPlugin({
6464
name: 'host',
6565
shared: {
66-
'shared': { nodeModulesReconstructedLookup: true },
67-
'shared/directory/': { nodeModulesReconstructedLookup: true }
66+
'shared': { allowNodeModulesSuffixMatch: true },
67+
'shared/directory/': { allowNodeModulesSuffixMatch: true }
6868
}
6969
});
7070
```

packages/enhanced/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface ProvideSharedPluginOptions {
2929
/**
3030
* Enable reconstructed lookup for node_modules paths
3131
*/
32-
nodeModulesReconstructedLookup?: boolean;
32+
allowNodeModulesSuffixMatch?: boolean;
3333
};
3434
}
3535
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ describe('ConsumeSharedPlugin', () => {
12921292
});
12931293
});
12941294

1295-
it('should reconstruct node_modules path and share submodules with nodeModulesReconstructedLookup experiment', async () => {
1295+
it('should reconstruct node_modules path and share submodules with allowNodeModulesSuffixMatch experiment', async () => {
12961296
// Setup shared@1.0.0 in the root node_modules
12971297
const sharedRootDir = path.join(nodeModulesDir, 'shared');
12981298
const sharedDir = path.join(sharedRootDir, 'directory');
@@ -1345,7 +1345,7 @@ describe('ConsumeSharedPlugin', () => {
13451345
shareKey: 'shared/directory/',
13461346
shareScope: 'default',
13471347
singleton: false,
1348-
nodeModulesReconstructedLookup: true,
1348+
allowNodeModulesSuffixMatch: true,
13491349
},
13501350
},
13511351
}),

packages/enhanced/test/unit/sharing/ConsumeSharedPlugin/ConsumeSharedPlugin.buildMeta.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('ConsumeSharedPlugin - BuildMeta Copying', () => {
5757
request: 'react',
5858
include: undefined,
5959
exclude: undefined,
60-
nodeModulesReconstructedLookup: undefined,
60+
allowNodeModulesSuffixMatch: undefined,
6161
});
6262

6363
// Create a mock fallback module with buildMeta/buildInfo
@@ -146,7 +146,7 @@ describe('ConsumeSharedPlugin - BuildMeta Copying', () => {
146146
request: 'lodash',
147147
include: undefined,
148148
exclude: undefined,
149-
nodeModulesReconstructedLookup: undefined,
149+
allowNodeModulesSuffixMatch: undefined,
150150
});
151151

152152
// Create a mock fallback module with different buildMeta/buildInfo
@@ -229,7 +229,7 @@ describe('ConsumeSharedPlugin - BuildMeta Copying', () => {
229229
request: 'missing-meta',
230230
include: undefined,
231231
exclude: undefined,
232-
nodeModulesReconstructedLookup: undefined,
232+
allowNodeModulesSuffixMatch: undefined,
233233
});
234234

235235
// Store original buildMeta/buildInfo
@@ -324,7 +324,7 @@ describe('ConsumeSharedPlugin - BuildMeta Copying', () => {
324324
request: 'no-import',
325325
include: undefined,
326326
exclude: undefined,
327-
nodeModulesReconstructedLookup: undefined,
327+
allowNodeModulesSuffixMatch: undefined,
328328
});
329329

330330
const originalBuildMeta = mockConsumeSharedModule.buildMeta;
@@ -374,7 +374,7 @@ describe('ConsumeSharedPlugin - BuildMeta Copying', () => {
374374
request: 'missing-fallback',
375375
include: undefined,
376376
exclude: undefined,
377-
nodeModulesReconstructedLookup: undefined,
377+
allowNodeModulesSuffixMatch: undefined,
378378
});
379379

380380
const originalBuildMeta = mockConsumeSharedModule.buildMeta;
@@ -430,7 +430,7 @@ describe('ConsumeSharedPlugin - BuildMeta Copying', () => {
430430
request: 'spread-test',
431431
include: undefined,
432432
exclude: undefined,
433-
nodeModulesReconstructedLookup: undefined,
433+
allowNodeModulesSuffixMatch: undefined,
434434
});
435435

436436
// Create a fallback module with nested objects to test deep copying

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ describe('SharePlugin', () => {
556556
});
557557
});
558558

559-
describe('nodeModulesReconstructedLookup functionality', () => {
559+
describe('allowNodeModulesSuffixMatch functionality', () => {
560560
let mockCompiler;
561561

562562
beforeEach(() => {
@@ -565,33 +565,33 @@ describe('SharePlugin', () => {
565565
ProvideSharedPluginMock.mockClear();
566566
});
567567

568-
it('should pass nodeModulesReconstructedLookup to both ConsumeSharedPlugin and ProvideSharedPlugin', () => {
568+
it('should pass allowNodeModulesSuffixMatch to both ConsumeSharedPlugin and ProvideSharedPlugin', () => {
569569
const plugin = new SharePlugin({
570570
shared: {
571571
react: {
572572
requiredVersion: '^17.0.0',
573-
nodeModulesReconstructedLookup: true,
573+
allowNodeModulesSuffixMatch: true,
574574
},
575575
},
576576
});
577577

578578
plugin.apply(mockCompiler);
579579

580-
// Check ConsumeSharedPlugin receives nodeModulesReconstructedLookup in config
580+
// Check ConsumeSharedPlugin receives allowNodeModulesSuffixMatch in config
581581
expect(ConsumeSharedPluginMock).toHaveBeenCalledTimes(1);
582582
const consumeOptions = ConsumeSharedPluginMock.mock.calls[0][0];
583583
const reactConsume = consumeOptions.consumes.find(
584584
(consume) => Object.keys(consume)[0] === 'react',
585585
);
586-
expect(reactConsume.react.nodeModulesReconstructedLookup).toBe(true);
586+
expect(reactConsume.react.allowNodeModulesSuffixMatch).toBe(true);
587587

588-
// Check ProvideSharedPlugin receives nodeModulesReconstructedLookup in config
588+
// Check ProvideSharedPlugin receives allowNodeModulesSuffixMatch in config
589589
expect(ProvideSharedPluginMock).toHaveBeenCalledTimes(1);
590590
const provideOptions = ProvideSharedPluginMock.mock.calls[0][0];
591591
const reactProvide = provideOptions.provides.find(
592592
(provide) => Object.keys(provide)[0] === 'react',
593593
);
594-
expect(reactProvide.react.nodeModulesReconstructedLookup).toBe(true);
594+
expect(reactProvide.react.allowNodeModulesSuffixMatch).toBe(true);
595595
});
596596
});
597597

0 commit comments

Comments
 (0)