@squide/firefly-webpack-configs 4.2.0 → 4.2.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 +15 -0
- package/dist/defineConfig.d.ts +59 -0
- package/dist/defineConfig.js +385 -0
- package/dist/index.d.ts +2 -25
- package/dist/index.js +5 -45
- package/dist/nonCacheableRemoteEntryPlugin.d.ts +3 -0
- package/dist/nonCacheableRemoteEntryPlugin.js +19 -0
- package/dist/shared.d.ts +1 -0
- package/dist/shared.js +6 -0
- package/dist/sharedDependenciesResolutionPlugin.d.ts +9 -0
- package/dist/sharedDependenciesResolutionPlugin.js +135 -0
- package/package.json +27 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @squide/firefly-webpack-configs
|
|
2
2
|
|
|
3
|
+
## 4.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#225](https://github.com/gsoft-inc/wl-squide/pull/225) [`4eb46d6`](https://github.com/gsoft-inc/wl-squide/commit/4eb46d69283804a5809494f7275f9d447022a97d) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added additional shared dependencies for Honeycomb.
|
|
8
|
+
|
|
9
|
+
## 4.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#221](https://github.com/gsoft-inc/wl-squide/pull/221) [`8411080`](https://github.com/gsoft-inc/wl-squide/commit/8411080dfd0df6d0eafb01888298154fa5e5d925) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Fix deferred registrations.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`8411080`](https://github.com/gsoft-inc/wl-squide/commit/8411080dfd0df6d0eafb01888298154fa5e5d925)]:
|
|
16
|
+
- @squide/webpack-configs@4.3.1
|
|
17
|
+
|
|
3
18
|
## 4.2.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ModuleFederationPlugin } from "@module-federation/enhanced/webpack";
|
|
2
|
+
import type { SwcConfig } from "@workleap/swc-configs";
|
|
3
|
+
import { type DefineBuildConfigOptions, type DefineDevConfigOptions } from "@workleap/webpack-configs";
|
|
4
|
+
import type HtmlWebpackPlugin from "html-webpack-plugin";
|
|
5
|
+
import type webpack from "webpack";
|
|
6
|
+
export type ModuleFederationPluginOptions = ConstructorParameters<typeof ModuleFederationPlugin>[0];
|
|
7
|
+
export type ModuleFederationRemotesOption = ModuleFederationPluginOptions["remotes"];
|
|
8
|
+
export type ModuleFederationRuntimePlugins = NonNullable<ModuleFederationPluginOptions["runtimePlugins"]>;
|
|
9
|
+
export type ModuleFederationShared = NonNullable<ModuleFederationPluginOptions["shared"]>;
|
|
10
|
+
export type Router = "react-router";
|
|
11
|
+
export interface Features {
|
|
12
|
+
router?: Router;
|
|
13
|
+
msw?: boolean;
|
|
14
|
+
i18next?: boolean;
|
|
15
|
+
environmentVariables?: boolean;
|
|
16
|
+
honeycomb?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface RemoteDefinition {
|
|
19
|
+
name: string;
|
|
20
|
+
url: string;
|
|
21
|
+
}
|
|
22
|
+
export interface DefineHostModuleFederationPluginOptions extends ModuleFederationPluginOptions {
|
|
23
|
+
features?: Features;
|
|
24
|
+
}
|
|
25
|
+
export declare function defineHostModuleFederationPluginOptions(remotes: RemoteDefinition[], options: DefineHostModuleFederationPluginOptions): ModuleFederationPluginOptions;
|
|
26
|
+
export interface DefineDevHostConfigOptions extends Omit<DefineDevConfigOptions, "htmlWebpackPlugin" | "port"> {
|
|
27
|
+
htmlWebpackPluginOptions?: HtmlWebpackPlugin.Options;
|
|
28
|
+
features?: Features;
|
|
29
|
+
sharedDependencies?: ModuleFederationShared;
|
|
30
|
+
runtimePlugins?: ModuleFederationRuntimePlugins;
|
|
31
|
+
moduleFederationPluginOptions?: ModuleFederationPluginOptions;
|
|
32
|
+
}
|
|
33
|
+
export declare function defineDevHostConfig(swcConfig: SwcConfig, port: number, remotes: RemoteDefinition[], options?: DefineDevHostConfigOptions): webpack.Configuration;
|
|
34
|
+
export interface DefineBuildHostConfigOptions extends Omit<DefineBuildConfigOptions, "htmlWebpackPlugin"> {
|
|
35
|
+
htmlWebpackPluginOptions?: HtmlWebpackPlugin.Options;
|
|
36
|
+
features?: Features;
|
|
37
|
+
sharedDependencies?: ModuleFederationShared;
|
|
38
|
+
runtimePlugins?: ModuleFederationRuntimePlugins;
|
|
39
|
+
moduleFederationPluginOptions?: ModuleFederationPluginOptions;
|
|
40
|
+
}
|
|
41
|
+
export declare function defineBuildHostConfig(swcConfig: SwcConfig, remotes: RemoteDefinition[], options?: DefineBuildHostConfigOptions): webpack.Configuration;
|
|
42
|
+
export interface DefineRemoteModuleFederationPluginOptions extends ModuleFederationPluginOptions {
|
|
43
|
+
features?: Features;
|
|
44
|
+
}
|
|
45
|
+
export declare function defineRemoteModuleFederationPluginOptions(applicationName: string, options: DefineRemoteModuleFederationPluginOptions): ModuleFederationPluginOptions;
|
|
46
|
+
export interface DefineDevRemoteModuleConfigOptions extends Omit<DefineDevConfigOptions, "port" | "overlay"> {
|
|
47
|
+
features?: Features;
|
|
48
|
+
sharedDependencies?: ModuleFederationShared;
|
|
49
|
+
runtimePlugins?: ModuleFederationRuntimePlugins;
|
|
50
|
+
moduleFederationPluginOptions?: ModuleFederationPluginOptions;
|
|
51
|
+
}
|
|
52
|
+
export declare function defineDevRemoteModuleConfig(swcConfig: SwcConfig, applicationName: string, port: number, options?: DefineDevRemoteModuleConfigOptions): webpack.Configuration;
|
|
53
|
+
export interface DefineBuildRemoteModuleConfigOptions extends DefineBuildConfigOptions {
|
|
54
|
+
features?: Features;
|
|
55
|
+
sharedDependencies?: ModuleFederationShared;
|
|
56
|
+
runtimePlugins?: ModuleFederationRuntimePlugins;
|
|
57
|
+
moduleFederationPluginOptions?: ModuleFederationPluginOptions;
|
|
58
|
+
}
|
|
59
|
+
export declare function defineBuildRemoteModuleConfig(swcConfig: SwcConfig, applicationName: string, options?: DefineBuildRemoteModuleConfigOptions): webpack.Configuration;
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__module_federation_enhanced_webpack__ from "@module-federation/enhanced/webpack";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__workleap_webpack_configs__ from "@workleap/webpack-configs";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_deepmerge__ from "deepmerge";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs__ from "node:fs";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_url__ from "node:url";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__shared_js__ from "./shared.js";
|
|
8
|
+
|
|
9
|
+
;// CONCATENATED MODULE: external "@module-federation/enhanced/webpack"
|
|
10
|
+
|
|
11
|
+
;// CONCATENATED MODULE: external "@workleap/webpack-configs"
|
|
12
|
+
|
|
13
|
+
;// CONCATENATED MODULE: external "deepmerge"
|
|
14
|
+
|
|
15
|
+
;// CONCATENATED MODULE: external "node:fs"
|
|
16
|
+
|
|
17
|
+
;// CONCATENATED MODULE: external "node:path"
|
|
18
|
+
|
|
19
|
+
;// CONCATENATED MODULE: external "node:url"
|
|
20
|
+
|
|
21
|
+
;// CONCATENATED MODULE: external "./shared.js"
|
|
22
|
+
|
|
23
|
+
;// CONCATENATED MODULE: ./src/defineConfig.ts?__rslib_entry__
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// Using import.meta.url instead of import.meta.dirname because Jest is throwing the following error:
|
|
32
|
+
// SyntaxError: Cannot use 'import.meta' outside a module
|
|
33
|
+
const applicationDirectory = (0,__WEBPACK_EXTERNAL_MODULE_node_path__.dirname)((0,__WEBPACK_EXTERNAL_MODULE_node_url__.fileURLToPath)(import.meta.url));
|
|
34
|
+
const packageDirectory = __WEBPACK_EXTERNAL_MODULE_node_url__["default"].fileURLToPath(new URL(".", import.meta.url));
|
|
35
|
+
// Must be similar to the module name defined in @workleap/module-federation.
|
|
36
|
+
const RemoteRegisterModuleName = "./register";
|
|
37
|
+
const RemoteEntryPoint = "remoteEntry.js";
|
|
38
|
+
// Generally, only the host application should have eager dependencies.
|
|
39
|
+
// For more informations about shared dependencies refer to: https://github.com/patricklafrance/wmf-versioning
|
|
40
|
+
function getDefaultSharedDependencies(features, isHost) {
|
|
41
|
+
return {
|
|
42
|
+
"react": {
|
|
43
|
+
singleton: true,
|
|
44
|
+
eager: isHost ? true : undefined,
|
|
45
|
+
// Fixed the warning when `react-i18next` is imported in any remote modules.
|
|
46
|
+
// For more information, refer to: https://github.com/i18next/react-i18next/issues/1697#issuecomment-1821748226.
|
|
47
|
+
requiredVersion: features.i18next ? false : undefined
|
|
48
|
+
},
|
|
49
|
+
"react-dom": {
|
|
50
|
+
singleton: true,
|
|
51
|
+
eager: isHost ? true : undefined
|
|
52
|
+
},
|
|
53
|
+
"@squide/core": {
|
|
54
|
+
singleton: true,
|
|
55
|
+
eager: isHost ? true : undefined
|
|
56
|
+
},
|
|
57
|
+
"@squide/module-federation": {
|
|
58
|
+
singleton: true,
|
|
59
|
+
eager: isHost ? true : undefined
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// Generally, only the host application should have eager dependencies.
|
|
64
|
+
// For more informations about shared dependencies refer to: https://github.com/patricklafrance/wmf-versioning
|
|
65
|
+
function getReactRouterSharedDependencies(isHost) {
|
|
66
|
+
return {
|
|
67
|
+
"react-router-dom": {
|
|
68
|
+
singleton: true,
|
|
69
|
+
eager: isHost ? true : undefined
|
|
70
|
+
},
|
|
71
|
+
"@squide/react-router": {
|
|
72
|
+
singleton: true,
|
|
73
|
+
eager: isHost ? true : undefined
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function getMswSharedDependency(isHost) {
|
|
78
|
+
return {
|
|
79
|
+
"@squide/msw": {
|
|
80
|
+
singleton: true,
|
|
81
|
+
eager: isHost ? true : undefined
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function getI18nextSharedDependency(isHost) {
|
|
86
|
+
return {
|
|
87
|
+
"i18next": {
|
|
88
|
+
singleton: true,
|
|
89
|
+
eager: isHost ? true : undefined
|
|
90
|
+
},
|
|
91
|
+
// Not adding as a shared dependency for the moment because it causes the following error:
|
|
92
|
+
// Uncaught (in promise) TypeError: i18next_browser_languagedetector__WEBPACK_IMPORTED_MODULE_3__ is not a constructor
|
|
93
|
+
// "i18next-browser-languagedetector": {
|
|
94
|
+
// singleton: true,
|
|
95
|
+
// eager: isHost ? true : undefined
|
|
96
|
+
// },
|
|
97
|
+
"react-i18next": {
|
|
98
|
+
singleton: true,
|
|
99
|
+
eager: isHost ? true : undefined
|
|
100
|
+
},
|
|
101
|
+
"@squide/i18next": {
|
|
102
|
+
singleton: true,
|
|
103
|
+
eager: isHost ? true : undefined
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function getEnvironmentVariablesSharedDependencies(isHost) {
|
|
108
|
+
return {
|
|
109
|
+
"@squide/env-vars": {
|
|
110
|
+
singleton: true,
|
|
111
|
+
eager: isHost ? true : undefined
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function getHoneycombSharedDependencies(isHost) {
|
|
116
|
+
return {
|
|
117
|
+
"@honeycombio/opentelemetry-web": {
|
|
118
|
+
singleton: true,
|
|
119
|
+
eager: isHost ? true : undefined
|
|
120
|
+
},
|
|
121
|
+
"@opentelemetry/api": {
|
|
122
|
+
singleton: true,
|
|
123
|
+
eager: isHost ? true : undefined
|
|
124
|
+
},
|
|
125
|
+
"@opentelemetry/auto-instrumentations-web": {
|
|
126
|
+
singleton: true,
|
|
127
|
+
eager: isHost ? true : undefined
|
|
128
|
+
},
|
|
129
|
+
"@squide/firefly-honeycomb": {
|
|
130
|
+
singleton: true,
|
|
131
|
+
eager: isHost ? true : undefined
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function getFeaturesDependencies(features, isHost) {
|
|
136
|
+
const { router = "react-router", msw = true, i18next, environmentVariables, honeycomb } = features;
|
|
137
|
+
return {
|
|
138
|
+
...router === "react-router" ? getReactRouterSharedDependencies(isHost) : {},
|
|
139
|
+
...msw ? getMswSharedDependency(isHost) : {},
|
|
140
|
+
...i18next ? getI18nextSharedDependency(isHost) : {},
|
|
141
|
+
...environmentVariables ? getEnvironmentVariablesSharedDependencies(isHost) : {},
|
|
142
|
+
...honeycomb ? getHoneycombSharedDependencies(isHost) : {}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function resolveDefaultSharedDependencies(features, isHost) {
|
|
146
|
+
return {
|
|
147
|
+
...getDefaultSharedDependencies(features, isHost),
|
|
148
|
+
...getFeaturesDependencies(features, isHost)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const forceNamedChunkIdsTransformer = (config)=>{
|
|
152
|
+
config.optimization = {
|
|
153
|
+
...config.optimization ?? {},
|
|
154
|
+
// Without named chunk ids, there are some Webpack features that do not work
|
|
155
|
+
// when used with Module Federation. One of these feature is using a dynamic import in
|
|
156
|
+
// a remote module.
|
|
157
|
+
chunkIds: "named"
|
|
158
|
+
};
|
|
159
|
+
return config;
|
|
160
|
+
};
|
|
161
|
+
function createSetUniqueNameTransformer(uniqueName) {
|
|
162
|
+
const transformer = (config)=>{
|
|
163
|
+
config.output = {
|
|
164
|
+
...config.output ?? {},
|
|
165
|
+
// Every host and remotes must have a "uniqueName" for React Refresh to work
|
|
166
|
+
// with Module Federation.
|
|
167
|
+
uniqueName
|
|
168
|
+
};
|
|
169
|
+
return config;
|
|
170
|
+
};
|
|
171
|
+
return transformer;
|
|
172
|
+
}
|
|
173
|
+
function resolveEntryFilePath(entryPaths) {
|
|
174
|
+
for(const entryPath in entryPaths){
|
|
175
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_fs__["default"].existsSync(__WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(applicationDirectory, entryPath))) {
|
|
176
|
+
return entryPath;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return entryPaths[0];
|
|
180
|
+
}
|
|
181
|
+
const HostEntryFilePaths = [
|
|
182
|
+
"./src/index.ts",
|
|
183
|
+
"./src/index.tsx"
|
|
184
|
+
];
|
|
185
|
+
// The function return type is mandatory, otherwise we got an error TS4058.
|
|
186
|
+
function defineHostModuleFederationPluginOptions(remotes, options) {
|
|
187
|
+
const { features = {}, shared = {}, runtimePlugins = [], ...rest } = options;
|
|
188
|
+
const defaultSharedDependencies = resolveDefaultSharedDependencies(features, true);
|
|
189
|
+
return {
|
|
190
|
+
name: __WEBPACK_EXTERNAL_MODULE__shared_js__.HostApplicationName,
|
|
191
|
+
// Since Squide modules are only exporting a register function with a standardized API
|
|
192
|
+
// it doesn't requires any typing.
|
|
193
|
+
dts: false,
|
|
194
|
+
// Currently only supporting .js remotes.
|
|
195
|
+
manifest: false,
|
|
196
|
+
remotes: remotes.reduce((acc, x)=>{
|
|
197
|
+
// Object reduce are always a mess for typings.
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
199
|
+
// @ts-ignore
|
|
200
|
+
acc[x.name] = `${x.name}@${x.url}/${RemoteEntryPoint}`;
|
|
201
|
+
return acc;
|
|
202
|
+
}, {}),
|
|
203
|
+
// Deep merging the default shared dependencies with the provided shared dependencies
|
|
204
|
+
// to allow the consumer to easily override a default option of a shared dependency
|
|
205
|
+
// without extending the whole default shared dependencies object.
|
|
206
|
+
shared: __WEBPACK_EXTERNAL_MODULE_deepmerge__["default"].all([
|
|
207
|
+
defaultSharedDependencies,
|
|
208
|
+
shared
|
|
209
|
+
]),
|
|
210
|
+
runtimePlugins: [
|
|
211
|
+
__WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(packageDirectory, "./sharedDependenciesResolutionPlugin.js"),
|
|
212
|
+
__WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(packageDirectory, "./nonCacheableRemoteEntryPlugin.js"),
|
|
213
|
+
...runtimePlugins
|
|
214
|
+
],
|
|
215
|
+
// Commented because it doesn't seems to work, the runtime is still embedded into remotes.
|
|
216
|
+
// experiments: {
|
|
217
|
+
// // The runtime is 100kb minified.
|
|
218
|
+
// federationRuntime: "hoisted"
|
|
219
|
+
// },
|
|
220
|
+
...rest
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// Fixing HMR and page reloads when using `publicPath: auto` either in the host or remotes webpack configuration.
|
|
224
|
+
// Otherwise, when a nested page that belongs to a remote module is reloaded, an "Unexpected token" error will be thrown.
|
|
225
|
+
function trySetHtmlWebpackPluginPublicPath(options) {
|
|
226
|
+
if (!options.publicPath) {
|
|
227
|
+
options.publicPath = "/";
|
|
228
|
+
}
|
|
229
|
+
return options;
|
|
230
|
+
}
|
|
231
|
+
// The function return type is mandatory, otherwise we got an error TS4058.
|
|
232
|
+
function defineDevHostConfig(swcConfig, port, remotes, options = {}) {
|
|
233
|
+
const { entry = resolveEntryFilePath(HostEntryFilePaths), publicPath = "auto", cache, plugins = [], htmlWebpackPluginOptions, transformers = [], features, sharedDependencies, runtimePlugins, moduleFederationPluginOptions = defineHostModuleFederationPluginOptions(remotes, {
|
|
234
|
+
features,
|
|
235
|
+
shared: sharedDependencies,
|
|
236
|
+
runtimePlugins
|
|
237
|
+
}), ...webpackOptions } = options;
|
|
238
|
+
return (0,__WEBPACK_EXTERNAL_MODULE__workleap_webpack_configs__.defineDevConfig)(swcConfig, {
|
|
239
|
+
entry,
|
|
240
|
+
port,
|
|
241
|
+
publicPath,
|
|
242
|
+
cache,
|
|
243
|
+
htmlWebpackPlugin: trySetHtmlWebpackPluginPublicPath(htmlWebpackPluginOptions ?? (0,__WEBPACK_EXTERNAL_MODULE__workleap_webpack_configs__.defineBuildHtmlWebpackPluginConfig)()),
|
|
244
|
+
plugins: [
|
|
245
|
+
...plugins,
|
|
246
|
+
new __WEBPACK_EXTERNAL_MODULE__module_federation_enhanced_webpack__.ModuleFederationPlugin(moduleFederationPluginOptions)
|
|
247
|
+
],
|
|
248
|
+
...webpackOptions,
|
|
249
|
+
transformers: [
|
|
250
|
+
createSetUniqueNameTransformer(__WEBPACK_EXTERNAL_MODULE__shared_js__.HostApplicationName),
|
|
251
|
+
...transformers
|
|
252
|
+
]
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
// The function return type is mandatory, otherwise we got an error TS4058.
|
|
256
|
+
function defineBuildHostConfig(swcConfig, remotes, options = {}) {
|
|
257
|
+
const { entry = resolveEntryFilePath(HostEntryFilePaths), publicPath = "auto", plugins = [], htmlWebpackPluginOptions, transformers = [], features, sharedDependencies, runtimePlugins, moduleFederationPluginOptions = defineHostModuleFederationPluginOptions(remotes, {
|
|
258
|
+
features,
|
|
259
|
+
shared: sharedDependencies,
|
|
260
|
+
runtimePlugins
|
|
261
|
+
}), ...webpackOptions } = options;
|
|
262
|
+
return (0,__WEBPACK_EXTERNAL_MODULE__workleap_webpack_configs__.defineBuildConfig)(swcConfig, {
|
|
263
|
+
entry,
|
|
264
|
+
publicPath,
|
|
265
|
+
htmlWebpackPlugin: trySetHtmlWebpackPluginPublicPath(htmlWebpackPluginOptions ?? (0,__WEBPACK_EXTERNAL_MODULE__workleap_webpack_configs__.defineDevHtmlWebpackPluginConfig)()),
|
|
266
|
+
plugins: [
|
|
267
|
+
...plugins,
|
|
268
|
+
new __WEBPACK_EXTERNAL_MODULE__module_federation_enhanced_webpack__.ModuleFederationPlugin(moduleFederationPluginOptions)
|
|
269
|
+
],
|
|
270
|
+
transformers: [
|
|
271
|
+
forceNamedChunkIdsTransformer,
|
|
272
|
+
createSetUniqueNameTransformer(__WEBPACK_EXTERNAL_MODULE__shared_js__.HostApplicationName),
|
|
273
|
+
...transformers
|
|
274
|
+
],
|
|
275
|
+
...webpackOptions
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
//////////////////////////// Remote /////////////////////////////
|
|
279
|
+
const RemoteEntryFilePaths = [
|
|
280
|
+
"./src/register.tsx",
|
|
281
|
+
"./src/register.ts"
|
|
282
|
+
];
|
|
283
|
+
// The function return type is mandatory, otherwise we got an error TS4058.
|
|
284
|
+
function defineRemoteModuleFederationPluginOptions(applicationName, options) {
|
|
285
|
+
const { features = {}, exposes = {}, shared = {}, runtimePlugins = [], ...rest } = options;
|
|
286
|
+
const defaultSharedDependencies = resolveDefaultSharedDependencies(features, false);
|
|
287
|
+
return {
|
|
288
|
+
name: applicationName,
|
|
289
|
+
// Since Squide modules are only exporting a register function with a standardized API
|
|
290
|
+
// it doesn't requires any typing.
|
|
291
|
+
dts: false,
|
|
292
|
+
// Currently only supporting .js remotes.
|
|
293
|
+
manifest: false,
|
|
294
|
+
filename: RemoteEntryPoint,
|
|
295
|
+
exposes: {
|
|
296
|
+
[RemoteRegisterModuleName]: "./src/register",
|
|
297
|
+
...exposes
|
|
298
|
+
},
|
|
299
|
+
// Deep merging the default shared dependencies with the provided shared dependencies
|
|
300
|
+
// to allow the consumer to easily override a default option of a shared dependency
|
|
301
|
+
// without extending the whole default shared dependencies object.
|
|
302
|
+
shared: __WEBPACK_EXTERNAL_MODULE_deepmerge__["default"].all([
|
|
303
|
+
defaultSharedDependencies,
|
|
304
|
+
shared
|
|
305
|
+
]),
|
|
306
|
+
runtimePlugins: [
|
|
307
|
+
__WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(packageDirectory, "./sharedDependenciesResolutionPlugin.js"),
|
|
308
|
+
__WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(packageDirectory, "./nonCacheableRemoteEntryPlugin.js"),
|
|
309
|
+
...runtimePlugins
|
|
310
|
+
],
|
|
311
|
+
// Commented because it doesn't seems to work, the runtime is still embedded into remotes.
|
|
312
|
+
// experiments: {
|
|
313
|
+
// // The runtime is 100kb minified.
|
|
314
|
+
// federationRuntime: "hoisted"
|
|
315
|
+
// },
|
|
316
|
+
...rest
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
const devRemoteModuleTransformer = (config)=>{
|
|
320
|
+
// "config.devServer" does exist but webpack types are a messed. It could probably be solved by importing "webpack-dev-server"
|
|
321
|
+
// but I would prefer not adding it as a project dependency.
|
|
322
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
323
|
+
// @ts-ignore
|
|
324
|
+
config.devServer.headers = {
|
|
325
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
326
|
+
// @ts-ignore
|
|
327
|
+
...config.devServer.headers ?? {},
|
|
328
|
+
// Otherwise hot reload in the host failed with a CORS error.
|
|
329
|
+
"Access-Control-Allow-Origin": "*"
|
|
330
|
+
};
|
|
331
|
+
return config;
|
|
332
|
+
};
|
|
333
|
+
// The function return type is mandatory, otherwise we got an error TS4058.
|
|
334
|
+
function defineDevRemoteModuleConfig(swcConfig, applicationName, port, options = {}) {
|
|
335
|
+
const { entry = resolveEntryFilePath(RemoteEntryFilePaths), publicPath = "auto", cache, plugins = [], htmlWebpackPlugin = false, transformers = [], features, sharedDependencies, runtimePlugins, moduleFederationPluginOptions = defineRemoteModuleFederationPluginOptions(applicationName, {
|
|
336
|
+
features,
|
|
337
|
+
shared: sharedDependencies,
|
|
338
|
+
runtimePlugins
|
|
339
|
+
}), ...webpackOptions } = options;
|
|
340
|
+
return (0,__WEBPACK_EXTERNAL_MODULE__workleap_webpack_configs__.defineDevConfig)(swcConfig, {
|
|
341
|
+
entry,
|
|
342
|
+
port,
|
|
343
|
+
publicPath,
|
|
344
|
+
cache,
|
|
345
|
+
htmlWebpackPlugin,
|
|
346
|
+
// Disable the error overlay by default for remotes as otherwise every remote module's error overlay will be
|
|
347
|
+
// stack on top of the host application's error overlay.
|
|
348
|
+
overlay: false,
|
|
349
|
+
plugins: [
|
|
350
|
+
...plugins,
|
|
351
|
+
new __WEBPACK_EXTERNAL_MODULE__module_federation_enhanced_webpack__.ModuleFederationPlugin(moduleFederationPluginOptions)
|
|
352
|
+
],
|
|
353
|
+
transformers: [
|
|
354
|
+
devRemoteModuleTransformer,
|
|
355
|
+
createSetUniqueNameTransformer(applicationName),
|
|
356
|
+
...transformers
|
|
357
|
+
],
|
|
358
|
+
...webpackOptions
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
// The function return type is mandatory, otherwise we got an error TS4058.
|
|
362
|
+
function defineBuildRemoteModuleConfig(swcConfig, applicationName, options = {}) {
|
|
363
|
+
const { entry = resolveEntryFilePath(RemoteEntryFilePaths), publicPath = "auto", plugins = [], htmlWebpackPlugin = false, transformers = [], features, sharedDependencies, runtimePlugins, moduleFederationPluginOptions = defineRemoteModuleFederationPluginOptions(applicationName, {
|
|
364
|
+
features,
|
|
365
|
+
shared: sharedDependencies,
|
|
366
|
+
runtimePlugins
|
|
367
|
+
}), ...webpackOptions } = options;
|
|
368
|
+
return (0,__WEBPACK_EXTERNAL_MODULE__workleap_webpack_configs__.defineBuildConfig)(swcConfig, {
|
|
369
|
+
entry,
|
|
370
|
+
publicPath,
|
|
371
|
+
htmlWebpackPlugin,
|
|
372
|
+
plugins: [
|
|
373
|
+
...plugins,
|
|
374
|
+
new __WEBPACK_EXTERNAL_MODULE__module_federation_enhanced_webpack__.ModuleFederationPlugin(moduleFederationPluginOptions)
|
|
375
|
+
],
|
|
376
|
+
transformers: [
|
|
377
|
+
forceNamedChunkIdsTransformer,
|
|
378
|
+
createSetUniqueNameTransformer(applicationName),
|
|
379
|
+
...transformers
|
|
380
|
+
],
|
|
381
|
+
...webpackOptions
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export { defineBuildHostConfig, defineBuildRemoteModuleConfig, defineDevHostConfig, defineDevRemoteModuleConfig, defineHostModuleFederationPluginOptions, defineRemoteModuleFederationPluginOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
import { SwcConfig } from '@workleap/swc-configs';
|
|
4
|
-
import webpack from 'webpack';
|
|
5
|
-
export * from '@workleap/webpack-configs';
|
|
6
|
-
|
|
7
|
-
type FireflyFeatures = Omit<Features, "router" | "msw">;
|
|
8
|
-
interface FireflyDefineDevHostConfigOptions extends DefineDevHostConfigOptions {
|
|
9
|
-
features?: FireflyFeatures;
|
|
10
|
-
}
|
|
11
|
-
declare function defineDevHostConfig(swcConfig: SwcConfig, port: number, remotes: RemoteDefinition[], { features, ...options }?: FireflyDefineDevHostConfigOptions): webpack.Configuration;
|
|
12
|
-
interface FireflyDefineBuildHostConfigOptions extends DefineBuildHostConfigOptions {
|
|
13
|
-
features?: FireflyFeatures;
|
|
14
|
-
}
|
|
15
|
-
declare function defineBuildHostConfig(swcConfig: SwcConfig, remotes: RemoteDefinition[], { features, ...options }?: FireflyDefineBuildHostConfigOptions): webpack.Configuration;
|
|
16
|
-
interface FireflyDefineDevRemoteModuleConfigOptions extends DefineDevRemoteModuleConfigOptions {
|
|
17
|
-
features?: FireflyFeatures;
|
|
18
|
-
}
|
|
19
|
-
declare function defineDevRemoteModuleConfig(swcConfig: SwcConfig, applicationName: string, port: number, { features, ...options }?: FireflyDefineDevRemoteModuleConfigOptions): webpack.Configuration;
|
|
20
|
-
interface FireflyDefineBuildRemoteModuleConfigOptions extends DefineBuildRemoteModuleConfigOptions {
|
|
21
|
-
features?: FireflyFeatures;
|
|
22
|
-
}
|
|
23
|
-
declare function defineBuildRemoteModuleConfig(swcConfig: SwcConfig, applicationName: string, { features, ...options }?: FireflyDefineBuildRemoteModuleConfigOptions): webpack.Configuration;
|
|
24
|
-
|
|
25
|
-
export { type FireflyDefineBuildHostConfigOptions, type FireflyDefineBuildRemoteModuleConfigOptions, type FireflyDefineDevHostConfigOptions, type FireflyDefineDevRemoteModuleConfigOptions, type FireflyFeatures, defineBuildHostConfig, defineBuildRemoteModuleConfig, defineDevHostConfig, defineDevRemoteModuleConfig };
|
|
1
|
+
export * from "@workleap/webpack-configs";
|
|
2
|
+
export * from "./defineConfig.ts";
|
package/dist/index.js
CHANGED
|
@@ -1,47 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
export * from "@workleap/webpack-configs";
|
|
2
|
+
export * from "./defineConfig.js";
|
|
3
|
+
|
|
4
|
+
;// CONCATENATED MODULE: ./src/index.ts?__rslib_entry__
|
|
5
|
+
|
|
4
6
|
|
|
5
|
-
// src/index.ts
|
|
6
|
-
function defineDevHostConfig(swcConfig, port, remotes, { features = {}, ...options } = {}) {
|
|
7
|
-
return defineDevHostConfig$1(swcConfig, port, remotes, {
|
|
8
|
-
...options,
|
|
9
|
-
features: {
|
|
10
|
-
router: "react-router",
|
|
11
|
-
msw: true,
|
|
12
|
-
...features
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function defineBuildHostConfig(swcConfig, remotes, { features = {}, ...options } = {}) {
|
|
17
|
-
return defineBuildHostConfig$1(swcConfig, remotes, {
|
|
18
|
-
...options,
|
|
19
|
-
features: {
|
|
20
|
-
router: "react-router",
|
|
21
|
-
msw: true,
|
|
22
|
-
...features
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function defineDevRemoteModuleConfig(swcConfig, applicationName, port, { features = {}, ...options } = {}) {
|
|
27
|
-
return defineDevRemoteModuleConfig$1(swcConfig, applicationName, port, {
|
|
28
|
-
...options,
|
|
29
|
-
features: {
|
|
30
|
-
router: "react-router",
|
|
31
|
-
msw: true,
|
|
32
|
-
...features
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function defineBuildRemoteModuleConfig(swcConfig, applicationName, { features = {}, ...options } = {}) {
|
|
37
|
-
return defineBuildRemoteModuleConfig$1(swcConfig, applicationName, {
|
|
38
|
-
...options,
|
|
39
|
-
features: {
|
|
40
|
-
router: "react-router",
|
|
41
|
-
msw: true,
|
|
42
|
-
...features
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
7
|
|
|
47
|
-
export { defineBuildHostConfig, defineBuildRemoteModuleConfig, defineDevHostConfig, defineDevRemoteModuleConfig };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
;// CONCATENATED MODULE: ./src/nonCacheableRemoteEntryPlugin.ts?__rslib_entry__
|
|
3
|
+
const nonCacheableRemoteEntryPlugin_rslib_entry_plugin = ()=>{
|
|
4
|
+
return {
|
|
5
|
+
name: "non-cacheable-remote-entry-plugin",
|
|
6
|
+
createScript: function({ url }) {
|
|
7
|
+
const element = document.createElement("script");
|
|
8
|
+
// Adding a timestamp to make sure the remote entry points are never cached.
|
|
9
|
+
// View: https://github.com/module-federation/module-federation-examples/issues/566.
|
|
10
|
+
element.src = `${url}?t=${Date.now()}`;
|
|
11
|
+
element.type = "text/javascript";
|
|
12
|
+
element.async = true;
|
|
13
|
+
return element;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/* ESM default export */ const nonCacheableRemoteEntryPlugin_rslib_entry_ = (nonCacheableRemoteEntryPlugin_rslib_entry_plugin);
|
|
18
|
+
|
|
19
|
+
export { nonCacheableRemoteEntryPlugin_rslib_entry_ as default };
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HostApplicationName = "host";
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FederationHost, FederationRuntimePlugin } from "@module-federation/enhanced/runtime";
|
|
2
|
+
type Shared = FederationHost["shareScopeMap"][string][string][string];
|
|
3
|
+
interface ResolveSharedDependencyResult {
|
|
4
|
+
resolvedEntry: Shared;
|
|
5
|
+
highestVersionEntry: Shared;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveSharedDependency(pkgName: string, entries: Shared[], logFct?: (...rest: unknown[]) => void): ResolveSharedDependencyResult;
|
|
8
|
+
declare const plugin: () => FederationRuntimePlugin;
|
|
9
|
+
export default plugin;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_semver__ from "semver";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__shared_js__ from "./shared.js";
|
|
3
|
+
|
|
4
|
+
;// CONCATENATED MODULE: external "semver"
|
|
5
|
+
|
|
6
|
+
;// CONCATENATED MODULE: external "./shared.js"
|
|
7
|
+
|
|
8
|
+
;// CONCATENATED MODULE: ./src/sharedDependenciesResolutionPlugin.ts?__rslib_entry__
|
|
9
|
+
/*
|
|
10
|
+
This custom share dependency resolution strategy ensure that only the host app can ask for a new major version of a library.
|
|
11
|
+
Otherwise, any remote can request for an higher non-major version.
|
|
12
|
+
|
|
13
|
+
Examples:
|
|
14
|
+
|
|
15
|
+
host: 2.0
|
|
16
|
+
remote-1: 2.1 <-----
|
|
17
|
+
remote-2: 2.0
|
|
18
|
+
|
|
19
|
+
host: 2.0 <-----
|
|
20
|
+
remote-1: 3.1
|
|
21
|
+
remote-2: 2.0
|
|
22
|
+
|
|
23
|
+
host: 2.0
|
|
24
|
+
remote-1: 3.1
|
|
25
|
+
remote-2: 2.1 <-----
|
|
26
|
+
|
|
27
|
+
host: >2.0
|
|
28
|
+
remote-1: 3.1
|
|
29
|
+
remote-2: 2.1 <-----
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
// Toggle to "true" to facilitate the debugging of this plugin.
|
|
33
|
+
const isDebug = false;
|
|
34
|
+
function log(...args) {
|
|
35
|
+
if (isDebug) {
|
|
36
|
+
console.log(...args);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function findHighestVersionForMajor(entries, major) {
|
|
40
|
+
return entries.find((x)=>{
|
|
41
|
+
return (0,__WEBPACK_EXTERNAL_MODULE_semver__.parse)(x.version).major === major;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// The return type is required otherwise we get the following error: error TS2742: The inferred type of 'resolveSharedDependency' cannot be named without a reference to.
|
|
45
|
+
function resolveSharedDependency(pkgName, entries, logFct = ()=>{}) {
|
|
46
|
+
const cleanedEntries = entries.map((x)=>({
|
|
47
|
+
...x,
|
|
48
|
+
// Removing any special characters like >,>=,^,~ etc...
|
|
49
|
+
version: (0,__WEBPACK_EXTERNAL_MODULE_semver__.minVersion)(x.version).version
|
|
50
|
+
}));
|
|
51
|
+
// From higher to lower versions.
|
|
52
|
+
const sortedEntries = cleanedEntries.sort((x, y)=>(0,__WEBPACK_EXTERNAL_MODULE_semver__.rcompare)(x.version, y.version));
|
|
53
|
+
logFct("[squide] Sorted the entries by version from higher to lower", sortedEntries);
|
|
54
|
+
const highestVersionEntry = sortedEntries[0];
|
|
55
|
+
logFct(`[squide] ${pkgName} highest requested version is`, highestVersionEntry.version, highestVersionEntry);
|
|
56
|
+
// The host is always right!
|
|
57
|
+
if (highestVersionEntry.from === __WEBPACK_EXTERNAL_MODULE__shared_js__.HostApplicationName) {
|
|
58
|
+
logFct("[squide] %cThis is the host version%c, great, resolving to:", "color: black; background-color: pink;", "", highestVersionEntry.version, highestVersionEntry);
|
|
59
|
+
return {
|
|
60
|
+
resolvedEntry: highestVersionEntry,
|
|
61
|
+
highestVersionEntry: highestVersionEntry
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
logFct(`[squide] ${pkgName} Highest requested version is not from the host.`);
|
|
65
|
+
const hostEntry = sortedEntries.find((x)=>x.from === __WEBPACK_EXTERNAL_MODULE__shared_js__.HostApplicationName);
|
|
66
|
+
// Found nothing, that's odd but let's not break the app for this.
|
|
67
|
+
if (!hostEntry) {
|
|
68
|
+
logFct(`[squide] The host is not requesting any version of ${pkgName}, %caborting%c.`, "color: black; background-color: pink;", "");
|
|
69
|
+
return {
|
|
70
|
+
resolvedEntry: highestVersionEntry,
|
|
71
|
+
highestVersionEntry: highestVersionEntry
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
logFct(`[squide] ${pkgName} version requested by the host is:`, hostEntry.version, hostEntry);
|
|
75
|
+
const parsedHighestVersion = (0,__WEBPACK_EXTERNAL_MODULE_semver__.parse)(highestVersionEntry.version);
|
|
76
|
+
const parsedHostVersion = (0,__WEBPACK_EXTERNAL_MODULE_semver__.parse)(hostEntry.version);
|
|
77
|
+
// Major versions should always be introduced by the host application.
|
|
78
|
+
if (parsedHighestVersion.major === parsedHostVersion.major) {
|
|
79
|
+
logFct(`[squide] Resolving to %c${parsedHighestVersion.major}%c.`, "color: black; background-color: pink;", "");
|
|
80
|
+
return {
|
|
81
|
+
resolvedEntry: highestVersionEntry,
|
|
82
|
+
highestVersionEntry: highestVersionEntry
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
logFct("[squide] The major number of the highest requested version is higher than the major number of the version requested by the host, looking for another version to resolve to.");
|
|
86
|
+
// Start at the second entry since the first entry is the current higher version entry.
|
|
87
|
+
// The result could either be the actual host entry or any other entry that is higher than the version requested
|
|
88
|
+
// by the host, but match the host entry major version number.
|
|
89
|
+
const fallbackEntry = findHighestVersionForMajor(sortedEntries.splice(1), parsedHostVersion.major);
|
|
90
|
+
logFct(`[squide] The %chighest requested version%c for ${pkgName} that is in-range with the requested host major version number is:`, "color: black; background-color: pink;", "", fallbackEntry.version, fallbackEntry);
|
|
91
|
+
return {
|
|
92
|
+
resolvedEntry: fallbackEntry,
|
|
93
|
+
highestVersionEntry: highestVersionEntry
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const sharedDependenciesResolutionPlugin_rslib_entry_plugin = ()=>{
|
|
97
|
+
return {
|
|
98
|
+
name: "shared-dependencies-resolution-plugin",
|
|
99
|
+
resolveShare: function(args) {
|
|
100
|
+
const { shareScopeMap, scope, pkgName } = args;
|
|
101
|
+
log(`[squide] Resolving ${pkgName}:`, args);
|
|
102
|
+
// This custom strategy only applies to singleton shared dependencies.
|
|
103
|
+
const entries = Object.values(shareScopeMap[scope][pkgName]).filter((x)=>{
|
|
104
|
+
return(// Temporary check until all the remotes on Webpack Module Federation has been updated to Module Federation 2.0.
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
x.singleton || x.shareConfig && x.shareConfig.singleton);
|
|
108
|
+
});
|
|
109
|
+
// Not a singleton dependency.
|
|
110
|
+
if (entries.length === 0) {
|
|
111
|
+
log(`[squide] ${pkgName} is not a singleton dependency, aborting.`);
|
|
112
|
+
return args;
|
|
113
|
+
}
|
|
114
|
+
// If there's only one version entry, then it means that everyone is requesting the same version
|
|
115
|
+
// of the dependency.
|
|
116
|
+
if (entries.length <= 1) {
|
|
117
|
+
log(`[squide] There's only one version requested for ${pkgName}, resolving to:`, entries[0].version, entries[0]);
|
|
118
|
+
return args;
|
|
119
|
+
}
|
|
120
|
+
args.resolver = ()=>{
|
|
121
|
+
log(`[squide] There's %cmore than one requested version%c for ${pkgName}:`, "color: black; background-color: pink;", "", entries.length, shareScopeMap[scope][pkgName]);
|
|
122
|
+
const { resolvedEntry, highestVersionEntry } = resolveSharedDependency(pkgName, entries, log);
|
|
123
|
+
if (resolvedEntry.version !== highestVersionEntry.version) {
|
|
124
|
+
// eslint-disable-next-line max-len
|
|
125
|
+
console.log(`%c[squide] "${highestVersionEntry.from}" requested version "${highestVersionEntry.version}" of "${pkgName}". This version is higher than the major number of the version requested by the host for this dependency (${resolvedEntry.version}). The version for "${pkgName}" has been forced to "${resolvedEntry.version}".`, "color: white; background-color: red;");
|
|
126
|
+
}
|
|
127
|
+
return resolvedEntry;
|
|
128
|
+
};
|
|
129
|
+
return args;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
/* ESM default export */ const sharedDependenciesResolutionPlugin_rslib_entry_ = (sharedDependenciesResolutionPlugin_rslib_entry_plugin);
|
|
134
|
+
|
|
135
|
+
export { sharedDependenciesResolutionPlugin_rslib_entry_ as default, resolveSharedDependency };
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squide/firefly-webpack-configs",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.2",
|
|
5
5
|
"description": "Webpack configuration helpers for the Squide firefly technology stack.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/gsoft-inc/wl-squide.git",
|
|
10
|
-
"directory": "packages/firefly-configs"
|
|
10
|
+
"directory": "packages/firefly-webpack-configs"
|
|
11
11
|
},
|
|
12
|
+
"type": "module",
|
|
12
13
|
"publishConfig": {
|
|
13
14
|
"access": "public",
|
|
14
15
|
"provenance": true
|
|
15
16
|
},
|
|
16
|
-
"type": "module",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
@@ -35,32 +35,40 @@
|
|
|
35
35
|
"webpack": ">=5.0.0",
|
|
36
36
|
"webpack-dev-server": ">=5.0.0"
|
|
37
37
|
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@module-federation/enhanced": "^0.8.4",
|
|
40
|
+
"@types/node": "^22.10.2",
|
|
41
|
+
"@types/semver": "^7.5.8",
|
|
42
|
+
"@workleap/webpack-configs": "^1.5.2",
|
|
43
|
+
"deepmerge": "^4.3.1",
|
|
44
|
+
"html-webpack-plugin": "^5.6.3",
|
|
45
|
+
"semver": "^7.6.3"
|
|
46
|
+
},
|
|
38
47
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@swc/core": "1.
|
|
41
|
-
"@swc/jest": "0.2.
|
|
42
|
-
"@types/jest": "29.5.
|
|
43
|
-
"@
|
|
48
|
+
"@rslib/core": "0.1.4",
|
|
49
|
+
"@swc/core": "1.10.1",
|
|
50
|
+
"@swc/jest": "0.2.37",
|
|
51
|
+
"@types/jest": "29.5.14",
|
|
52
|
+
"@typescript-eslint/parser": "8.18.0",
|
|
53
|
+
"@workleap/eslint-plugin": "3.2.5",
|
|
44
54
|
"@workleap/swc-configs": "2.2.3",
|
|
45
|
-
"@workleap/tsup-configs": "3.0.6",
|
|
46
55
|
"@workleap/typescript-configs": "3.0.2",
|
|
47
56
|
"eslint": "8.57.0",
|
|
48
57
|
"jest": "29.7.0",
|
|
49
58
|
"jest-environment-jsdom": "29.7.0",
|
|
50
|
-
"ts-
|
|
51
|
-
"tsup": "8.3.0",
|
|
59
|
+
"ts-node": "10.9.2",
|
|
52
60
|
"typescript": "5.5.4",
|
|
53
|
-
"webpack": "5.
|
|
54
|
-
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"@workleap/webpack-configs": "1.5.1",
|
|
57
|
-
"@squide/webpack-configs": "4.3.0"
|
|
61
|
+
"webpack": "5.97.1",
|
|
62
|
+
"webpack-dev-server": "5.2.0"
|
|
58
63
|
},
|
|
59
64
|
"engines": {
|
|
60
|
-
"node": ">=
|
|
65
|
+
"node": ">=21.1.0"
|
|
61
66
|
},
|
|
62
67
|
"scripts": {
|
|
63
|
-
"dev": "
|
|
64
|
-
"build": "
|
|
68
|
+
"dev": "rslib build --watch --config ./rslib.dev.ts",
|
|
69
|
+
"build": "rslib build --config ./rslib.build.ts",
|
|
70
|
+
"eslint": "eslint . --max-warnings=-0 --cache --cache-location node_modules/.cache/eslint",
|
|
71
|
+
"typecheck": "tsc",
|
|
72
|
+
"test": "jest"
|
|
65
73
|
}
|
|
66
74
|
}
|