Skip to content

Commit 44ac346

Browse files
chore: remove unused vars from enhanced (#2994)
1 parent 9e32644 commit 44ac346

22 files changed

+36
-141
lines changed

.github/workflows/devtools.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
branches: [main]
99

1010
env:
11-
PLAYWRIGHT_BROWSERS_PATH: 0 # Places binaries to node_modules/@playwright/test
11+
PLAYWRIGHT_BROWSERS_PATH: 0
1212

1313
jobs:
1414
main:
@@ -44,8 +44,8 @@ jobs:
4444
- name: E2E Chrome Devtools Dev
4545
uses: nick-fields/retry@v3
4646
with:
47-
timeout_minutes: 10
48-
max_attempts: 3 # Initial attempt + 2 retries
47+
timeout_minutes: 15
48+
max_attempts: 3
4949
command: |
5050
npx kill-port 3009 3010 3011 3012 3013 4001 &&
5151
pnpm run app:manifest:dev & echo "done" && \
@@ -56,14 +56,19 @@ jobs:
5656
- name: E2E Chrome Devtools Prod
5757
uses: nick-fields/retry@v3
5858
with:
59-
timeout_minutes: 10
60-
max_attempts: 3 # Initial attempt + 2 retries
59+
timeout_minutes: 15
60+
max_attempts: 3
6161
command: |
62+
npx kill-port 3009 3010 3011 3012 3013 4001 &&
6263
npx kill-port 3009 3010 3011 3012 3013 4001 &&
6364
pnpm run app:manifest:prod & echo "done" && \
65+
npx kill-port 4001
6466
npx wait-on tcp:3009 tcp:3010 tcp:3011 tcp:3012 tcp:3013 && \
6567
sleep 10 &&
6668
npx nx e2e:devtools chrome-devtools
6769
6870
- name: kill port
69-
run: npx kill-port 3013 3009 3010 3011 3012 4001
71+
run: npx kill-port 3013 3009 3010 3011 3012 4001; exit 0
72+
73+
- name: Kill All Node Processes
74+
run: pkill -f node || true

packages/enhanced/.eslintrc.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
}
2727
]
2828
}
29-
]
29+
],
30+
"no-unused-vars": "off",
31+
"no-unused-expressions": "off",
32+
"@typescript-eslint/no-unused-vars": "warn",
33+
"@typescript-eslint/no-unused-expressions": "warn"
3034
}
3135
},
3236
{

packages/enhanced/jest.embed.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
import { readFileSync, rmdirSync, existsSync } from 'fs';
33
import path from 'path';
44
import os from 'os';
5+
const rimraf = require('rimraf');
56

67
// Reading the SWC compilation config and remove the "exclude"
78
// for the test files to be compiled by SWC
89
const { exclude: _, ...swcJestConfig } = JSON.parse(
910
readFileSync(`${__dirname}/.swcrc`, 'utf-8'),
1011
);
1112

12-
if (existsSync(__dirname + '/test/js')) {
13-
rmdirSync(__dirname + '/test/js', { recursive: true });
14-
}
13+
rimraf.sync(__dirname + '/test/js');
1514

1615
// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves.
1716
// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude"

packages/enhanced/project.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"commands": [
4343
{
4444
"command": "node packages/enhanced/test/script.js",
45-
"forwardAllArgs": true
45+
"forwardAllArgs": false
4646
}
4747
]
4848
}
@@ -54,7 +54,7 @@
5454
"commands": [
5555
{
5656
"command": "node packages/enhanced/test/script-experiments.js",
57-
"forwardAllArgs": true
57+
"forwardAllArgs": false
5858
}
5959
]
6060
}

packages/enhanced/src/lib/container/ContainerEntryModule.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ class ContainerEntryModule extends Module {
141141
arg1: boolean | undefined,
142142
) => void,
143143
): void {
144-
const baseContext = context as NeedBuildContext;
145144
callback(null, !this.buildMeta);
146145
}
147146
/**

packages/enhanced/src/lib/container/ContainerReferencePlugin.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy
44
*/
55
import type { Compiler } from 'webpack';
6-
import {
7-
getWebpackPath,
8-
normalizeWebpackPath,
9-
} from '@module-federation/sdk/normalize-webpack-path';
6+
import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';
107

118
// import * as RuntimeGlobals from 'webpack/lib/RuntimeGlobals';
129
import FallbackDependency from './FallbackDependency';

packages/enhanced/src/lib/container/HoistContainerReferencesPlugin.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,27 @@ import type {
55
WebpackPluginInstance,
66
Module,
77
Dependency,
8-
NormalModule as NormalModuleType,
98
} from 'webpack';
109
import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';
11-
import type { RuntimeSpec } from 'webpack/lib/util/runtime';
12-
import type ExportsInfo from 'webpack/lib/ExportsInfo';
13-
import ContainerEntryModule from './ContainerEntryModule';
14-
import { moduleFederationPlugin } from '@module-federation/sdk';
1510
import FederationModulesPlugin from './runtime/FederationModulesPlugin';
1611
import ContainerEntryDependency from './ContainerEntryDependency';
1712
import FederationRuntimeDependency from './runtime/FederationRuntimeDependency';
18-
import RemoteToExternalDependency from './RemoteToExternalDependency';
19-
import RemoteModule from './RemoteModule';
2013

21-
const { NormalModule, AsyncDependenciesBlock, ExternalModule } = require(
14+
const { AsyncDependenciesBlock, ExternalModule } = require(
2215
normalizeWebpackPath('webpack'),
2316
) as typeof import('webpack');
24-
const ConcatenatedModule = require(
25-
normalizeWebpackPath('webpack/lib/optimize/ConcatenatedModule'),
26-
) as typeof import('webpack/lib/optimize/ConcatenatedModule');
2717

2818
const PLUGIN_NAME = 'HoistContainerReferences';
2919

3020
/**
3121
* This class is used to hoist container references in the code.
3222
*/
3323
export class HoistContainerReferences implements WebpackPluginInstance {
34-
private readonly containerName: string;
35-
private readonly entryFilePath?: string;
36-
private readonly bundlerRuntimeDep?: string;
37-
private readonly explanation: string;
38-
private readonly experiments: moduleFederationPlugin.ModuleFederationPluginOptions['experiments'];
39-
40-
constructor(
41-
name?: string,
42-
entryFilePath?: string,
43-
bundlerRuntimeDep?: string,
44-
experiments?: moduleFederationPlugin.ModuleFederationPluginOptions['experiments'],
45-
) {
46-
this.containerName = name || 'no known chunk name';
47-
this.entryFilePath = entryFilePath;
48-
this.bundlerRuntimeDep = bundlerRuntimeDep;
49-
this.experiments = experiments;
50-
this.explanation =
51-
'Bundler runtime path module is required for proper functioning';
52-
}
53-
5424
apply(compiler: Compiler): void {
5525
compiler.hooks.thisCompilation.tap(
5626
PLUGIN_NAME,
5727
(compilation: Compilation) => {
5828
const logger = compilation.getLogger(PLUGIN_NAME);
59-
const { chunkGraph, moduleGraph } = compilation;
6029
const hooks = FederationModulesPlugin.getCompilationHooks(compilation);
6130
const containerEntryDependencies = new Set<Dependency>();
6231
hooks.addContainerEntryModule.tap(

packages/enhanced/src/lib/container/RemoteModule.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ class RemoteModule extends Module {
161161
override codeGeneration(
162162
context: CodeGenerationContext,
163163
): CodeGenerationResult {
164-
const { runtimeTemplate, moduleGraph, chunkGraph } = context;
165-
// @ts-ignore
164+
const { moduleGraph, chunkGraph } = context;
166165
const module = moduleGraph.getModule(this.dependencies[0]);
167166
const id = module && chunkGraph.getModuleId(module);
168167
const sources = new Map();

packages/enhanced/src/lib/container/RemoteRuntimeModule.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy
44
*/
55
import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';
6-
import type { Compilation, Chunk } from 'webpack';
6+
import type { Compilation } from 'webpack';
77
import RemoteModule from './RemoteModule';
88
import { getFederationGlobalScope } from './runtime/utils';
99
import type ExternalModule from 'webpack/lib/ExternalModule';
1010
import type FallbackModule from './FallbackModule';
1111
import type { RemotesOptions } from '@module-federation/webpack-bundler-runtime';
12-
import { FEDERATION_SUPPORTED_TYPES } from '@module-federation/webpack-bundler-runtime/constant';
1312

1413
const extractUrlAndGlobal = require(
1514
normalizeWebpackPath('webpack/lib/util/extractUrlAndGlobal'),

packages/enhanced/src/lib/container/runtime/ChildCompilationRuntimePlugin.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class RuntimeModuleChunkPlugin {
5959
chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk),
6060
);
6161
for (let i = 0; i < entries.length; i++) {
62-
const [module, entrypoint] = entries[i];
62+
const [module, _entrypoint] = entries[i];
6363
const final = i + 1 === entries.length;
6464
const moduleId = chunkGraph.getModuleId(module);
6565
source.add('\n');
@@ -244,7 +244,6 @@ class CustomRuntimePlugin {
244244
}
245245

246246
class CustomRuntimeModule extends RuntimeModule {
247-
private bundledCode: string | null = null;
248247
private entryModuleId: string | number | undefined;
249248

250249
constructor(

0 commit comments

Comments
 (0)