5
5
6
6
'use strict' ;
7
7
import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path' ;
8
- import type { Dependency , Compilation } from 'webpack' ;
9
- import ContainerExposedDependency from './ContainerExposedDependency' ;
8
+ import type { Compilation , Dependency } from 'webpack' ;
10
9
import type {
10
+ InputFileSystem ,
11
11
LibIdentOptions ,
12
12
NeedBuildContext ,
13
- RequestShortener ,
14
13
ObjectDeserializerContext ,
15
14
ObjectSerializerContext ,
16
- WebpackOptions ,
17
- InputFileSystem ,
15
+ RequestShortener ,
18
16
ResolverWithOptions ,
17
+ WebpackOptions ,
19
18
} from 'webpack/lib/Module' ;
20
19
import type WebpackError from 'webpack/lib/WebpackError' ;
21
- import { getFederationGlobalScope } from './runtime/utils' ;
22
20
import { JAVASCRIPT_MODULE_TYPE_DYNAMIC } from '../Constants' ;
21
+ import ContainerExposedDependency from './ContainerExposedDependency' ;
22
+ import { getFederationGlobalScope } from './runtime/utils' ;
23
23
24
24
const makeSerializable = require (
25
25
normalizeWebpackPath ( 'webpack/lib/util/makeSerializable' ) ,
26
26
) as typeof import ( 'webpack/lib/util/makeSerializable' ) ;
27
- const { sources : webpackSources } = require (
28
- normalizeWebpackPath ( 'webpack' ) ,
29
- ) as typeof import ( 'webpack' ) ;
30
- const { AsyncDependenciesBlock, Template, Module, RuntimeGlobals } = require (
31
- normalizeWebpackPath ( 'webpack' ) ,
32
- ) as typeof import ( 'webpack' ) ;
27
+ const {
28
+ sources : webpackSources ,
29
+ AsyncDependenciesBlock,
30
+ Template,
31
+ Module,
32
+ RuntimeGlobals,
33
+ } = require ( normalizeWebpackPath ( 'webpack' ) ) as typeof import ( 'webpack' ) ;
33
34
const StaticExportsDependency = require (
34
35
normalizeWebpackPath ( 'webpack/lib/dependencies/StaticExportsDependency' ) ,
35
36
) as typeof import ( 'webpack/lib/dependencies/StaticExportsDependency' ) ;
@@ -79,7 +80,6 @@ class ContainerEntryModule extends Module {
79
80
static deserialize ( context : ObjectDeserializerContext ) : ContainerEntryModule {
80
81
const { read } = context ;
81
82
const obj = new ContainerEntryModule ( read ( ) , read ( ) , read ( ) , read ( ) ) ;
82
- //@ts -ignore
83
83
obj . deserialize ( context ) ;
84
84
return obj ;
85
85
}
@@ -119,7 +119,7 @@ class ContainerEntryModule extends Module {
119
119
* @param {function((WebpackError | null)=, boolean=): void } callback callback function, returns true, if the module needs a rebuild
120
120
* @returns {void }
121
121
*/
122
- // @ts -ignore typeof webpack/lib !== typeof webpack/types
122
+ // @ts -expect-error typeof webpack/lib !== typeof webpack/types
123
123
override needBuild (
124
124
context : NeedBuildContext ,
125
125
callback : (
@@ -138,7 +138,7 @@ class ContainerEntryModule extends Module {
138
138
* @param {function(WebpackError): void } callback callback function
139
139
* @returns {void }
140
140
*/
141
- // @ts -ignore typeof webpack/lib !== typeof webpack/types
141
+ // @ts -expect-error typeof webpack/lib !== typeof webpack/types
142
142
override build (
143
143
options : WebpackOptions ,
144
144
compilation : Compilation ,
@@ -152,7 +152,6 @@ class ContainerEntryModule extends Module {
152
152
topLevelDeclarations : new Set ( [ 'moduleMap' , 'get' , 'init' ] ) ,
153
153
} ;
154
154
this . buildMeta . exportsType = 'namespace' ;
155
- //@ts -ignore
156
155
this . clearDependenciesAndBlocks ( ) ;
157
156
158
157
for ( const [ name , options ] of this . _exposes ) {
@@ -170,23 +169,19 @@ class ContainerEntryModule extends Module {
170
169
name,
171
170
index : idx ++ ,
172
171
} ;
173
- //@ts -ignore
174
172
block . addDependency ( dep ) ;
175
173
}
176
- //@ts -ignore
177
174
this . addBlock ( block ) ;
178
175
}
179
- //@ts -ignore
180
176
this . addDependency (
181
- //@ts -ignore
182
177
new StaticExportsDependency (
183
178
[ 'get' , 'init' ] ,
184
179
false ,
185
180
) as unknown as Dependency ,
186
181
) ;
187
182
188
183
this . addDependency (
189
- // @ts -ignore
184
+ // @ts -expect-error flaky type for EntryDependency
190
185
new EntryDependency ( this . _injectRuntimeEntry ) ,
191
186
) ;
192
187
@@ -197,8 +192,7 @@ class ContainerEntryModule extends Module {
197
192
* @param {CodeGenerationContext } context context for code generation
198
193
* @returns {CodeGenerationResult } result
199
194
*/
200
- //@ts -ignore
201
- override codeGeneration ( { moduleGraph, chunkGraph, runtimeTemplate } ) {
195
+ override codeGeneration ( { moduleGraph, chunkGraph, runtimeTemplate } : any ) {
202
196
const sources = new Map ( ) ;
203
197
const runtimeRequirements = new Set ( [
204
198
RuntimeGlobals . definePropertyGetters ,
@@ -232,7 +226,6 @@ class ContainerEntryModule extends Module {
232
226
} ) } .then(${ runtimeTemplate . returningFunction (
233
227
runtimeTemplate . returningFunction (
234
228
`(${ modules
235
- //@ts -ignore
236
229
. map ( ( { module, request } ) =>
237
230
runtimeTemplate . moduleRaw ( {
238
231
module,
@@ -259,7 +252,7 @@ class ContainerEntryModule extends Module {
259
252
const initRuntimeModuleGetter = runtimeTemplate . moduleRaw ( {
260
253
module : moduleGraph . getModule ( initRuntimeDep ) ,
261
254
chunkGraph,
262
- // @ts -expect-error
255
+ // @ts -expect-error flaky type definition for Dependency
263
256
request : initRuntimeDep . userRequest ,
264
257
weak : false ,
265
258
runtimeRequirements,
0 commit comments