Skip to content

Commit 4ff43fe

Browse files
chore: upgrade dependencies to latest
- @biomejs/biome 1.9 → 2.4 (config migrated) - @types/node 22 → 24 - @vitest/coverage-istanbul 2 → 4 - typescript 5.6 → 6.0 (added ignoreDeprecations + rootDir) - vitest 2 → 4 - webpack 5.95 → 5.106 - simple-git-hooks, tsx bumped to latest Adapt to webpack's rename of ModuleFederationPlugin#_options to #options (introduced around 5.100), with fallback to the legacy field. Update the plugin test to mock the barrel export, which vitest 4 no longer collapses through deep auto-mocks. Tighten Compiler hook callback typings for TS 6.
1 parent 031cf0c commit 4ff43fe

10 files changed

Lines changed: 2820 additions & 3582 deletions

File tree

biome.jsonc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
33
"vcs": {
44
"enabled": true,
5-
"clientKind": "git"
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"includes": ["**", "!dist", "!coverage"]
610
},
711
"formatter": {
812
"indentStyle": "space",
913
"lineWidth": 100,
10-
"ignore": ["**/*.json"]
14+
"includes": ["**", "!**/*.json"]
1115
},
1216
"javascript": {
1317
"formatter": {

package-lock.json

Lines changed: 2787 additions & 3558 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@
3333
"mkdirp": "^3.0.1"
3434
},
3535
"devDependencies": {
36-
"@biomejs/biome": "^1.9.3",
36+
"@biomejs/biome": "^2.4.13",
3737
"@types/download": "^8.0.5",
3838
"@types/minimist": "^1.2.5",
3939
"@types/mkdirp": "^2.0.0",
40-
"@types/node": "^22.7.5",
41-
"@vitest/coverage-istanbul": "^2.1.3",
42-
"simple-git-hooks": "^2.11.1",
43-
"tsx": "^4.19.1",
44-
"typescript": "^5.6.3",
45-
"vitest": "^2.1.2",
46-
"webpack": "^5.95.0"
40+
"@types/node": "^24.12.2",
41+
"@vitest/coverage-istanbul": "^4.1.5",
42+
"simple-git-hooks": "^2.13.1",
43+
"tsx": "^4.21.0",
44+
"typescript": "^6.0.3",
45+
"vitest": "^4.1.5",
46+
"webpack": "^5.106.2"
4747
},
4848
"simple-git-hooks": {
4949
"pre-commit": "npm run lint"

src/__tests__/plugin.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ import { describe, expect, test, vi } from 'vitest';
22
import webpack, { type Compilation, type Compiler } from 'webpack';
33

44
import { DEFAULT_DIR_DOWNLOADED_TYPES, DEFAULT_DIR_EMITTED_TYPES } from '../constants';
5-
import { downloadTypes } from '../downloadTypes/downloadTypes';
5+
import { downloadTypes } from '../downloadTypes';
66
import type { ModuleFederationPluginOptions, ModuleFederationTypesPluginOptions } from '../models';
77
import { ModuleFederationTypesPlugin } from '../plugin';
88

9-
vi.mock('../downloadTypes/downloadTypes');
9+
vi.mock('../downloadTypes', async importActual => ({
10+
...(await importActual<typeof import('../downloadTypes')>()),
11+
downloadTypes: vi.fn(),
12+
}));
1013

1114
const mockDownloadTypes = vi.mocked(downloadTypes);
1215
const mockAfterEmit = vi.fn();
@@ -37,13 +40,15 @@ function installPlugin(
3740
tap: mockAfterEmit as unknown,
3841
},
3942
beforeRun: {
40-
tapPromise: (_, callback) => callback({} as Compiler) as unknown,
43+
tapPromise: (_: unknown, callback: (compiler: Compiler) => unknown) =>
44+
callback({} as Compiler) as unknown,
4145
},
4246
watchRun: {
43-
tap: (_, callback) => callback({} as Compiler) as unknown,
47+
tap: (_: unknown, callback: (compiler: Compiler) => unknown) =>
48+
callback({} as Compiler) as unknown,
4449
},
4550
},
46-
} as Compiler);
51+
} as unknown as Compiler);
4752

4853
return pluginInstance;
4954
}

src/bin/__tests__/download-federated-types.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ vi.mock('node:fs', async () => ({
1212

1313
vi.mock('minimist', () => ({
1414
default: (args: string[]) => {
15-
const webpackConfigIndex = args.findIndex(arg => arg === '--webpack-config');
15+
const webpackConfigIndex = args.indexOf('--webpack-config');
1616
return webpackConfigIndex > -1 ? { 'webpack-config': args[webpackConfigIndex + 1] } : {};
1717
},
1818
}));

src/compileTypes/rewritePathsWithExposedFederatedModules.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import path from 'node:path';
44
import { mkdirp } from 'mkdirp';
55

66
import { PREFIX_NOT_FOR_IMPORT } from '../constants';
7-
import type { CommonLogger, FederationConfig } from '../models';
8-
97
import { getLogger } from '../helpers';
8+
import type { CommonLogger, FederationConfig } from '../models';
109
import { includeTypesFromNodeModules, substituteAliasedModules } from './helpers';
1110

1211
export function rewritePathsWithExposedFederatedModules(

src/compileTypes/workerLogger.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { parentPort } from 'node:worker_threads';
2-
3-
import type { CommonLogger } from '../models';
4-
import type { LogLevel } from '../models';
2+
import type { CommonLogger, LogLevel } from '../models';
53

64
export function sendLog(level: LogLevel, items: unknown[]) {
75
parentPort?.postMessage({

src/downloadTypes/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from './downloadRemoteEntryTypes';
21
export * from './downloadRemoteEntryManifest';
2+
export * from './downloadRemoteEntryTypes';
33
export * from './downloadRemoteEntryURLsFromManifests';

src/plugin.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ export class ModuleFederationTypesPlugin implements WebpackPluginInstance {
7272
moduleFederationPluginNames.includes(plugin!.constructor.name.replace(/^_/, '')),
7373
);
7474

75-
const federationPluginOptions: ModuleFederationPluginOptions = (federationOptions as Dict)
76-
?._options as ModuleFederationPluginOptions;
75+
// webpack >= 5.100 exposes `options`; earlier versions used `_options`.
76+
const federationPluginOptions: ModuleFederationPluginOptions = ((federationOptions as Dict)
77+
?.options ?? (federationOptions as Dict)?._options) as ModuleFederationPluginOptions;
7778

7879
if (!federationPluginOptions?.name) {
7980
logger.warn(

tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"allowSyntheticDefaultImports": true,
44
"declaration": true,
55
"esModuleInterop": true,
6+
"ignoreDeprecations": "6.0",
67
"lib": ["esnext"],
78
"module": "CommonJS",
89
"moduleResolution": "Node",
@@ -12,6 +13,7 @@
1213
"noUnusedLocals": true,
1314
"noUnusedParameters": true,
1415
"outDir": "./dist",
16+
"rootDir": "./src",
1517
"skipLibCheck": true,
1618
"sourceMap": true,
1719
"strict": true,

0 commit comments

Comments
 (0)