@ws-test-realm/admin-kit 0.2.5-ng16 → 0.2.7-ng16
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/lib/build-modules.js
CHANGED
|
@@ -53,6 +53,20 @@ function partitionByKind(workspaceDir, names) {
|
|
|
53
53
|
function buildLibs({ workspaceDir, restrictTo = [], withDeps = false }) {
|
|
54
54
|
const { order, angularJson } = loadOrder({ workspaceDir, restrictTo, withDeps });
|
|
55
55
|
|
|
56
|
+
// Flush native-federation's shared-chunk cache at the start of every build.
|
|
57
|
+
// The cache (under `<workspace>/node_modules/.cache/native-federation/`)
|
|
58
|
+
// keys by output filename only, so changes to `federation.config.js`'s
|
|
59
|
+
// share map don't invalidate stale chunks — a workspace lib whose set of
|
|
60
|
+
// externals/inlines changed will keep emitting the previous build's
|
|
61
|
+
// output. Cheaper to always rebuild than to debug stale-chunk classes of
|
|
62
|
+
// bugs; the cost is recompiling the third-party Angular shared chunks
|
|
63
|
+
// each pass.
|
|
64
|
+
const cacheDir = path.join(workspaceDir, "node_modules", ".cache", "native-federation");
|
|
65
|
+
if (fs.existsSync(cacheDir)) {
|
|
66
|
+
fs.rmSync(cacheDir, { recursive: true, force: true });
|
|
67
|
+
console.log(`Flushed native-federation cache: ${cacheDir}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
56
70
|
console.log(`\n=== Build order ===`);
|
|
57
71
|
order.forEach((n, i) => console.log(` ${i + 1}. ${n}`));
|
|
58
72
|
|
package/lib/generate-module.js
CHANGED
|
@@ -110,6 +110,13 @@ function registerInAngularJson(workspaceDir, name) {
|
|
|
110
110
|
main: `projects/${name}/src/main.ts`,
|
|
111
111
|
polyfills: [],
|
|
112
112
|
tsConfig: `projects/${name}/tsconfig.app.json`,
|
|
113
|
+
// Cross-workspace federation siblings reach this workspace via
|
|
114
|
+
// admin-kit-managed symlinks at node_modules/<name>; esbuild needs
|
|
115
|
+
// preserveSymlinks=true to resolve peer imports out of those .d.ts/
|
|
116
|
+
// .mjs files against THIS workspace's node_modules (where the
|
|
117
|
+
// peers are installed) rather than walking up from the symlink
|
|
118
|
+
// target in the fiddle.
|
|
119
|
+
preserveSymlinks: true,
|
|
113
120
|
styles: [],
|
|
114
121
|
scripts: [],
|
|
115
122
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ws-test-realm/admin-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7-ng16",
|
|
4
4
|
"description": "Workflow CLI + scaffolding for Wiresphere admin-modules workspaces (Angular 16 + native-federation line). Ships `ws-init-workspace`, `ws-modules` (build+deploy driver), `ws-generate-module`/`ws-drop-module`, `ws-wire-host`, `ws-wire-pom`, `ws-sync-paths`, and `ws-purge`. Depends on @ws-test-realm/devkit (toolchain BOM) + @ws-test-realm/shared (runtime BOM + native-federation share map).",
|
|
5
5
|
"license": "Artistic-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -8,12 +8,30 @@ module.exports = withNativeFederation({
|
|
|
8
8
|
// shared chunk for this package (declared in `shared` below). Without
|
|
9
9
|
// the shim, esbuild would inline the whole library here and decorator
|
|
10
10
|
// side effects would fire a second time on remote load.
|
|
11
|
-
'./Module': './src/exposed-module.ts',
|
|
11
|
+
'./Module': './projects/__name__/src/exposed-module.ts',
|
|
12
12
|
},
|
|
13
13
|
// share() expands includeSecondaries against each package's exports field.
|
|
14
14
|
// withNativeFederation's own share() invocation is commented out upstream.
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
|
|
15
|
+
//
|
|
16
|
+
// Three flavors of entries below the share() spread:
|
|
17
|
+
//
|
|
18
|
+
// 1. Self-share `'__name__': WORKSPACE_LIBS` — emits a chunk + import-map
|
|
19
|
+
// entry for THIS module so siblings consuming it via bare specifiers
|
|
20
|
+
// get the same instance at runtime.
|
|
21
|
+
//
|
|
22
|
+
// 2. Cross-workspace siblings (e.g. `'ws-framework': WORKSPACE_LIBS`) —
|
|
23
|
+
// add when this module imports from another admin module that lives
|
|
24
|
+
// in a different workspace. admin-kit symlinks `node_modules/<name>`
|
|
25
|
+
// to the fiddle's `.federation/<name>/` so esbuild can resolve.
|
|
26
|
+
//
|
|
27
|
+
// 3. Module-carried federation contributions — runtime libs THIS module
|
|
28
|
+
// introduces for the federation, that aren't in `sharedDescriptors()`'s
|
|
29
|
+
// default slice. Example: db-login carries `@auth0/angular-jwt`. The
|
|
30
|
+
// module's project package.json should list these as
|
|
31
|
+
// `peerDependencies` (not `dependencies`); ng-packagr leaves them as
|
|
32
|
+
// bare imports, native-federation emits the chunk + share entry, and
|
|
33
|
+
// the runtime singleton mechanism dedupes if other consumers ever
|
|
34
|
+
// import them.
|
|
35
|
+
shared: { ...share(sharedDescriptors()), '__name__': WORKSPACE_LIBS },
|
|
18
36
|
skip: ['rxjs/ajax', 'rxjs/fetch', 'rxjs/testing', 'rxjs/webSocket'],
|
|
19
37
|
});
|
|
@@ -2,8 +2,21 @@
|
|
|
2
2
|
"extends": "../../tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"outDir": "../../out-tsc/app",
|
|
5
|
-
"
|
|
5
|
+
"strict": false,
|
|
6
|
+
"strictNullChecks": false,
|
|
7
|
+
"noImplicitAny": false,
|
|
8
|
+
"noImplicitReturns": false,
|
|
9
|
+
"useDefineForClassFields": false,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"skipDefaultLibCheck": true,
|
|
12
|
+
"types": ["node"]
|
|
6
13
|
},
|
|
7
|
-
"
|
|
8
|
-
|
|
14
|
+
"angularCompilerOptions": {
|
|
15
|
+
"strictTemplates": false,
|
|
16
|
+
"strictInjectionParameters": false,
|
|
17
|
+
"strictInputAccessModifiers": false
|
|
18
|
+
},
|
|
19
|
+
"files": ["src/main.ts"],
|
|
20
|
+
"include": ["src/**/*.ts"],
|
|
21
|
+
"exclude": ["src/**/*.spec.ts", "src/test.ts"]
|
|
9
22
|
}
|