Skip to content

Commit e55a389

Browse files
committed
feat(nf-core): respect unresolved deps when removing unused shared packages from configuration
1 parent 2160a86 commit e55a389

File tree

9 files changed

+19
-89
lines changed

9 files changed

+19
-89
lines changed

libs/native-federation-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"fast-glob": "^3.3.3"
1111
},
1212
"peerDependencies": {
13-
"@softarc/sheriff-core": "^0.18.0"
13+
"@softarc/sheriff-core": "^0.18.2"
1414
}
1515
}

libs/native-federation-core/src/lib/core/remove-unused-deps.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,16 @@ function findUsedDeps(
6060
for (const fileName of Object.keys(fileInfos)) {
6161
const fileInfo = fileInfos[fileName];
6262

63-
if (!fileInfo || !fileInfo.externalLibraries) {
63+
if (!fileInfo) {
6464
continue;
6565
}
6666

67-
for (const pckg of fileInfo.externalLibraries) {
67+
const libs = [
68+
...(fileInfo.externalLibraries || []),
69+
...(fileInfo.unresolvedImports || []),
70+
];
71+
72+
for (const pckg of libs) {
6873
usedPackageNames.add(pckg);
6974
}
7075

libs/native-federation-core/src/lib/utils/logger.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

libs/native-federation-core/src/lib/utils/logger.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

libs/native-federation-core/src/lib/utils/mapped-paths.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

libs/native-federation-core/src/lib/utils/mapped-paths.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

libs/native-federation/src/schematics/init/schematic.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,12 @@ export default function config(options: MfSchematicSchema): Rule {
105105

106106
const exists = tree.exists(federationConfigPath);
107107

108-
const cand1 = path.join(projectSourceRoot, 'app', 'app.component.ts').replace(/\\/g, '/');
109-
const cand2 = path.join(projectSourceRoot, 'app', 'app.ts').replace(/\\/g, '/');
108+
const cand1 = path
109+
.join(projectSourceRoot, 'app', 'app.component.ts')
110+
.replace(/\\/g, '/');
111+
const cand2 = path
112+
.join(projectSourceRoot, 'app', 'app.ts')
113+
.replace(/\\/g, '/');
110114

111115
const appComponent = tree.exists(cand1)
112116
? cand1

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"@rollup/plugin-node-resolve": "^15.1.0",
8080
"@rollup/plugin-replace": "^5.0.2",
8181
"@schematics/angular": "19.0.0",
82-
"@softarc/sheriff-core": "^0.18.0",
82+
"@softarc/sheriff-core": "^0.18.2",
8383
"@swc-node/register": "1.9.2",
8484
"@swc/cli": "0.6.0",
8585
"@swc/core": "1.5.7",

0 commit comments

Comments
 (0)