@mf-toolkit/shared-inspector 0.3.0 → 0.3.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/README.md +19 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
# `@mf-toolkit/shared-inspector`
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@mf-toolkit/shared-inspector)
|
|
4
|
-
[](https://nodejs.org)
|
|
7
|
-
|
|
8
|
-
> ⚠️ **Work in progress.** This package is fully tested (252 tests) and published to npm. The API is stable but may receive minor changes before the official stable release.
|
|
4
|
+
[](https://github.com/zvitaly7/mf-toolkit/blob/main/LICENSE)
|
|
5
|
+
[](https://nodejs.org)
|
|
9
6
|
|
|
10
7
|
Build-time analyser for Module Federation `shared` dependencies. Two-phase architecture: **collect facts → analyse facts**.
|
|
11
8
|
|
|
@@ -268,6 +265,22 @@ Accepts N `ProjectManifest` objects (one per microfrontend) and returns a `Feder
|
|
|
268
265
|
|
|
269
266
|
Formats a `FederationReport` as a human-readable terminal string.
|
|
270
267
|
|
|
268
|
+
### `MfSharedInspectorPlugin` options
|
|
269
|
+
|
|
270
|
+
Extends all `buildProjectManifest` options (except `name`, auto-resolved from compiler) plus:
|
|
271
|
+
|
|
272
|
+
| Option | Type | Default | Description |
|
|
273
|
+
|--------|------|---------|-------------|
|
|
274
|
+
| `sourceDirs` | `string[]` | — | Directories to scan |
|
|
275
|
+
| `sharedConfig` | `Record<string, SharedDepConfig>` | auto-extracted | Override auto-extraction from `ModuleFederationPlugin` |
|
|
276
|
+
| `tsconfigPath` | `string` | `undefined` | tsconfig.json for path alias resolution |
|
|
277
|
+
| `workspacePackages` | `string[]` | `[]` | Local monorepo packages to exclude |
|
|
278
|
+
| `warn` | `boolean` | `true` | Print findings to console |
|
|
279
|
+
| `failOn` | `'mismatch' \| 'unused' \| 'any'` | `undefined` | Fail the build when findings match |
|
|
280
|
+
| `writeManifest` | `boolean` | `false` | Write `project-manifest.json` to `outputDir` |
|
|
281
|
+
| `outputDir` | `string` | `'.'` | Directory for manifest output |
|
|
282
|
+
| `analysis` | `AnalysisOptions` | `{}` | Options forwarded to `analyzeProject` |
|
|
283
|
+
|
|
271
284
|
## Detection categories
|
|
272
285
|
|
|
273
286
|
### Per-project (`analyzeProject`)
|
|
@@ -296,6 +309,7 @@ Formats a `FederationReport` as a human-readable terminal string.
|
|
|
296
309
|
- **TypeScript path aliases without `tsconfigPath`**: aliased imports are treated as external package names. Pass `tsconfigPath` to resolve them correctly.
|
|
297
310
|
- **Dynamic imports with variables** (`import(moduleName)`): not analysed — requires runtime information.
|
|
298
311
|
- **Exact tsconfig alias patterns** (non-wildcard, e.g. `"@root": ["."]`): not supported, only `"@alias/*"` wildcard form.
|
|
312
|
+
- **Subclassed `ModuleFederationPlugin`**: auto-extraction matches by constructor name. A custom subclass (`class MyMFP extends ModuleFederationPlugin`) won't be detected — pass `sharedConfig` explicitly in that case.
|
|
299
313
|
|
|
300
314
|
## Demo
|
|
301
315
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { buildProjectManifest } from './collector/build-project-manifest.js';
|
|
|
2
2
|
export { analyzeProject } from './analyzer/analyze-project.js';
|
|
3
3
|
export { analyzeFederation } from './analyzer/analyze-federation.js';
|
|
4
4
|
export { inspect } from './inspect.js';
|
|
5
|
-
export { formatReport } from './reporter/format-report.js';
|
|
5
|
+
export { formatReport, type FormatReportContext } from './reporter/format-report.js';
|
|
6
6
|
export { formatFederationReport } from './reporter/format-federation-report.js';
|
|
7
7
|
export { writeReport, writeManifest } from './reporter/write-report.js';
|
|
8
8
|
export type { ProjectManifest, ProjectReport, CollectorOptions, AnalysisOptions, SharedDepConfig, PackageOccurrence, UnusedEntry, CandidateEntry, MismatchedEntry, SingletonRiskEntry, EagerRiskEntry, FederationAnalysisOptions, FederationReport, GhostShareEntry, HostGapEntry, VersionConflictEntry, SingletonMismatchEntry, } from './types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGxE,YAAY,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,iFAAiF;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,iFAAiF;AACjF,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,iFAAiF;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,iFAAiF;AACjF,OAAO,EAAE,YAAY,EAA4B,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC"}
|