-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(enhanced): update share options of share plugin
- Loading branch information
1 parent
358ba00
commit cbd573c
Showing
29 changed files
with
83 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
1 change: 1 addition & 0 deletions
1
packages/enhanced/test/configCases/sharing/layers-consume-entry/async-boundary.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from 'react'; |
5 changes: 5 additions & 0 deletions
5
packages/enhanced/test/configCases/sharing/layers-consume-entry/index-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
it('should load module with correct layer from entry layer', async () => { | ||
const { version, layer } = await import('./async-boundary'); | ||
expect(version).toBe('1.0.0'); | ||
expect(layer).toBe('module-layer'); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/enhanced/test/configCases/sharing/layers-consume-entry/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './index-test'; |
5 changes: 1 addition & 4 deletions
5
...figCases/sharing/layers/layer-exporter.js → ...ng/layers-consume-entry/layer-exporter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
module.exports = function layerLoader(source) { | ||
// Inject the layer name as an export | ||
return [ | ||
source, | ||
'export const layer = "react-layer";' | ||
].join('\n'); | ||
return [source, 'export const layer = "module-layer";'].join('\n'); | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions
39
packages/enhanced/test/configCases/sharing/layers-consume-entry/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const { ConsumeSharedPlugin } = require('../../../../dist/src'); | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
mode: 'development', | ||
devtool: false, | ||
entry: { | ||
main: { | ||
import: './index.js', | ||
layer: 'entry-layer', | ||
}, | ||
}, | ||
experiments: { | ||
layers: true, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /async-boundary\.js$/, | ||
issuerLayer: 'entry-layer', | ||
use: [ | ||
{ | ||
loader: path.resolve(__dirname, './layer-exporter.js'), | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new ConsumeSharedPlugin({ | ||
consumes: { | ||
react: { | ||
singleton: true, | ||
shareKey: 'react', | ||
}, | ||
}, | ||
}), | ||
], | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/enhanced/test/configCases/sharing/layers-loaders-no-entry/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/.federation |
1 change: 1 addition & 0 deletions
1
packages/enhanced/test/configCases/sharing/layers-loaders-no-entry/async-boundary.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from 'react'; |
5 changes: 1 addition & 4 deletions
5
...igCases/sharing/layers/differing-layer.js → ...ayers-loaders-no-entry/differing-layer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
module.exports = function layerLoader(source) { | ||
// Inject the layer name as an export | ||
return [ | ||
source, | ||
'export const layer = "differing-layer";' | ||
].join('\n'); | ||
return [source, 'export const layer = "differing-layer";'].join('\n'); | ||
}; |
4 changes: 2 additions & 2 deletions
4
...figCases/sharing/layers/differing-test.js → ...layers-loaders-no-entry/differing-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
it('Module graph should have a layer different layer', async () => { | ||
const {version, layer} = (await import('react')); | ||
const { version, layer } = await import('react'); | ||
expect(version).toBe('1.0.0'); | ||
expect(layer).toBe('differing-layer'); | ||
}); | ||
|
||
it('Module graph should have a layer set explicitly thats not the inherited issuerLayer', async () => { | ||
const {dix, layer} = (await import('react/index2')); | ||
const { dix, layer } = await import('react/index2'); | ||
expect(dix).toBe('1.0.0'); | ||
expect(layer).toBe('explicit-layer'); | ||
}); |
5 changes: 1 addition & 4 deletions
5
...figCases/sharing/layers/explicit-layer.js → ...layers-loaders-no-entry/explicit-layer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
module.exports = function layerLoader(source) { | ||
// Inject the layer name as an export | ||
return [ | ||
source, | ||
'export const layer = "explicit-layer";' | ||
].join('\n'); | ||
return [source, 'export const layer = "explicit-layer";'].join('\n'); | ||
}; |
2 changes: 1 addition & 1 deletion
2
.../configCases/sharing/layers/index-test.js → ...ing/layers-loaders-no-entry/index-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
it('Module Graph should have layerd share', async () => { | ||
const {version, layer} = (await import('./async-boundary')); | ||
const { version, layer } = await import('./async-boundary'); | ||
expect(version).toBe('1.0.0'); | ||
expect(layer).toBe('react-layer'); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/enhanced/test/configCases/sharing/layers-loaders-no-entry/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import './index-test'; | ||
import './other-test'; | ||
import './differing-test'; |
4 changes: 4 additions & 0 deletions
4
packages/enhanced/test/configCases/sharing/layers-loaders-no-entry/layer-exporter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = function layerLoader(source) { | ||
// Inject the layer name as an export | ||
return [source, 'export const layer = "react-layer";'].join('\n'); | ||
}; |
2 changes: 2 additions & 0 deletions
2
...ges/enhanced/test/configCases/sharing/layers-loaders-no-entry/node_modules/react/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...es/enhanced/test/configCases/sharing/layers-loaders-no-entry/node_modules/react/index2.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../configCases/sharing/layers/other-test.js → ...ing/layers-loaders-no-entry/other-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
it('Module Graph should unlayered share', async () => { | ||
const {version, layer} = (await import('./async-boundary')); | ||
const { version, layer } = await import('./async-boundary'); | ||
expect(version).toBe('1.0.0'); | ||
expect(layer).toBeUndefined(); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/enhanced/test/configCases/sharing/layers-loaders-no-entry/other.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './other-test'; |
11 changes: 11 additions & 0 deletions
11
packages/enhanced/test/configCases/sharing/layers-loaders-no-entry/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "layered-react-test", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "webpack --config=webpack.config.js" | ||
}, | ||
"dependencies": { | ||
"react": "1.0.0" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/enhanced/test/configCases/sharing/layers-loaders-no-entry/test.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
layers: true, | ||
findBundle: function () { | ||
return ['bundle0.js']; | ||
}, | ||
}; |
File renamed without changes.
1 change: 0 additions & 1 deletion
1
packages/enhanced/test/configCases/sharing/layers/async-boundary.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.