@ws-test-realm/admin-kit 0.6.4-ng20 → 0.6.6-ng20

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/bom-shape.js CHANGED
@@ -129,7 +129,15 @@ export class ${className}Module {}
129
129
  }
130
130
 
131
131
  function publicApiSource(name) {
132
- return `export * from './lib/${name}-module';\n`;
132
+ // ng-packagr's NG3001 requires every class declared by a re-exported
133
+ // module to be reachable from public-api too. Re-exporting the component
134
+ // satisfies that. (This also doubles as the DCE-protection convention
135
+ // for any @ExpansionEntry-decorated components the dev adds later — they
136
+ // just need to be exported by name from the component file, which `export
137
+ // *` covers automatically.)
138
+ return `export * from './lib/${name}-module';
139
+ export * from './lib/${name}';
140
+ `;
133
141
  }
134
142
 
135
143
  module.exports = {
@@ -72,6 +72,50 @@ function deployExt({ workspaceDir, id, modulesDir, extDir, stagedDir }) {
72
72
  return { extDir, copiedFiles: fileCount };
73
73
  }
74
74
 
75
+ // Publish the LIB output (`dist/<id>/`) to the fiddle's
76
+ // `<adminDir>/.federation/<id>/`. Cross-workspace consumers' ng-packagr
77
+ // reads this directory (via the symlink `node_modules/<id>` → here) to
78
+ // resolve TypeScript imports. Without an up-to-date publish, consumers
79
+ // compile against stale typings — references to renamed/removed classes
80
+ // silently resolve against the old names, baking obsolete identifiers
81
+ // into the consumer's fesm. At runtime the consumer's chunk then imports
82
+ // a name the deployed remote no longer exports → `undefined.ɵcmp`.
83
+ //
84
+ // Both jar and ext targets need this. (The jar's META-INF/federation/<id>/
85
+ // only carries the RUNTIME bundle, not the LIB output.)
86
+ //
87
+ // Idempotent: wipes the destination first so removed files (e.g. classes
88
+ // renamed out of existence) don't linger.
89
+ function publishLibTypings({ workspaceDir, id, adminDir }) {
90
+ if (!adminDir) return null;
91
+ const libDir = path.join(workspaceDir, "dist", id);
92
+ if (!fs.existsSync(libDir)) return null;
93
+ // Only publish if it looks like an ng-packagr lib output (has package.json
94
+ // + index.d.ts). Skip otherwise to avoid clobbering with a weird tree.
95
+ if (
96
+ !fs.existsSync(path.join(libDir, "package.json")) ||
97
+ !fs.existsSync(path.join(libDir, "index.d.ts"))
98
+ ) {
99
+ return null;
100
+ }
101
+ const federationDir = path.join(adminDir, ".federation", id);
102
+ if (fs.existsSync(federationDir)) {
103
+ fs.rmSync(federationDir, { recursive: true, force: true });
104
+ }
105
+ fs.mkdirSync(federationDir, { recursive: true });
106
+ fs.cpSync(libDir, federationDir, { recursive: true });
107
+ let fileCount = 0;
108
+ const walk = (d) => {
109
+ for (const e of fs.readdirSync(d, { withFileTypes: true })) {
110
+ const p = path.join(d, e.name);
111
+ if (e.isDirectory()) walk(p);
112
+ else fileCount += 1;
113
+ }
114
+ };
115
+ walk(federationDir);
116
+ return { federationDir, fileCount };
117
+ }
118
+
75
119
  function deployOne({
76
120
  workspaceDir,
77
121
  id,
@@ -97,6 +141,8 @@ function deployOne({
97
141
  modulesFolder,
98
142
  });
99
143
 
144
+ const typings = publishLibTypings({ workspaceDir, id, adminDir });
145
+
100
146
  if (target.kind === "jar") {
101
147
  const packResult = packIntoJar({
102
148
  jarPath: target.jarPath,
@@ -108,6 +154,7 @@ function deployOne({
108
154
  jarPath: target.jarPath,
109
155
  pomPath: target.pomPath,
110
156
  artifactId: target.artifactId,
157
+ typings,
111
158
  ...packResult,
112
159
  };
113
160
  }
@@ -119,7 +166,7 @@ function deployOne({
119
166
  extDir: target.extDir,
120
167
  stagedDir,
121
168
  });
122
- return { kind: "ext", ...extResult };
169
+ return { kind: "ext", typings, ...extResult };
123
170
  }
124
171
 
125
172
  function deployRemotes({ workspaceDir, restrictTo = [], withDeps = false }) {
@@ -164,6 +211,9 @@ function deployRemotes({ workspaceDir, restrictTo = [], withDeps = false }) {
164
211
  console.log(` ext dir: ${r.extDir}`);
165
212
  console.log(` copied files: ${r.copiedFiles}`);
166
213
  }
214
+ if (r.typings) {
215
+ console.log(` typings: ${r.typings.federationDir} (${r.typings.fileCount} files)`);
216
+ }
167
217
  results.push({ id, ...r });
168
218
  }
169
219
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ws-test-realm/admin-kit",
3
- "version": "0.6.4-ng20",
3
+ "version": "0.6.6-ng20",
4
4
  "description": "Workflow CLI + scaffolding for Wiresphere admin-modules workspaces (Angular 20 + 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": {