@appshell/react 1.0.0-alpha.67 → 1.0.0-alpha.69

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.
@@ -14,8 +14,9 @@ import { AppshellTemplate } from './types';
14
14
  */
15
15
  export declare const manifestFrom: <TMetadata extends Record<string, unknown>>(template: AppshellTemplate) => {
16
16
  vars: Record<string, Record<string, string | number | undefined>>;
17
- remotes: Record<string, import("./types").PublishedRemote<TMetadata>>;
18
- modules: Record<string, import("./types").ModuleFederationPluginOptions>;
17
+ components: Record<string, import("./types").PublishedRemote<TMetadata>>;
18
+ remotes?: string[];
19
+ shared?: import("./types").SharedContract;
19
20
  tokens?: Record<string, import("./types").AppshellTokenUsage>;
20
21
  overrides?: import("./types").AppshellOverrides;
21
22
  };
@@ -26,8 +27,9 @@ export declare const manifestFrom: <TMetadata extends Record<string, unknown>>(t
26
27
  */
27
28
  declare const _default: <TMetadata extends Record<string, unknown>>(templatePath: string) => Promise<{
28
29
  vars: Record<string, Record<string, string | number | undefined>>;
29
- remotes: Record<string, import("./types").PublishedRemote<TMetadata>>;
30
- modules: Record<string, import("./types").ModuleFederationPluginOptions>;
30
+ components: Record<string, import("./types").PublishedRemote<TMetadata>>;
31
+ remotes?: string[];
32
+ shared?: import("./types").SharedContract;
31
33
  tokens?: Record<string, import("./types").AppshellTokenUsage>;
32
34
  overrides?: import("./types").AppshellOverrides;
33
35
  } | null>;
@@ -1,8 +1,9 @@
1
- import { AppshellTemplate, ConfigMap, PublishedRemote } from '../types';
1
+ import { AppshellTemplate, ConfigMap, PublishedRemote, SharedContract } from '../types';
2
2
  export declare const toAppshellManifest: <TMetadata extends Record<string, unknown>>(template: AppshellTemplate, args: ConfigMap) => {
3
3
  vars: Record<string, Record<string, string | number | undefined>>;
4
- remotes: Record<string, PublishedRemote<TMetadata>>;
5
- modules: Record<string, import("../types").ModuleFederationPluginOptions>;
4
+ components: Record<string, PublishedRemote<TMetadata>>;
5
+ remotes?: string[];
6
+ shared?: SharedContract;
6
7
  tokens?: Record<string, import("../types").AppshellTokenUsage>;
7
8
  overrides?: import("../types").AppshellOverrides;
8
9
  };
@@ -93,7 +93,28 @@ export type AppshellConfig<TMetadata = Metadata> = {
93
93
  * content changing identity.
94
94
  */
95
95
  visibility?: 'public' | 'private';
96
- remotes?: Record<string, AppshellConfigRemote<TMetadata>>;
96
+ /**
97
+ * What this package publishes, keyed by federation entrypoint.
98
+ *
99
+ * Appshell's own word rather than a framework's. It was `remotes`, which is MF's word
100
+ * for the opposite — what a package consumes — so the file read inverted to anyone who
101
+ * knew the framework. `exposes` would fix that and put MF's vocabulary at the top level
102
+ * of appshell's model, which is what the loader recipe exists to prevent.
103
+ */
104
+ components?: Record<string, AppshellConfigRemote<TMetadata>>;
105
+ /**
106
+ * What this package consumes, by the name it refers to them by.
107
+ *
108
+ * A flat list because a referenced remote is required by definition: unbound, the region
109
+ * renders an error. `RemoteSlot`'s `fallback` is a loading placeholder — it shows while
110
+ * the remote arrives, not when it is absent — so unlike a design token's `var()`
111
+ * fallback it describes no degraded-but-working state.
112
+ *
113
+ * The application binds each name to a registry address, so a package never states the
114
+ * scope its siblings were published into — which it cannot know, since scope is assigned
115
+ * by whoever publishes.
116
+ */
117
+ remotes?: string[];
97
118
  vars?: Record<string, unknown>;
98
119
  overrides?: AppshellOverrides;
99
120
  };
@@ -101,7 +122,8 @@ export type AppshellTemplate<TMetadata = Metadata> = {
101
122
  name?: string;
102
123
  /** Carried from the yaml for publish to read; never mapped into the manifest. */
103
124
  visibility?: 'public' | 'private';
104
- remotes?: Record<string, AppshellConfigRemote<TMetadata>>;
125
+ components?: Record<string, AppshellConfigRemote<TMetadata>>;
126
+ remotes?: string[];
105
127
  module: ModuleFederationPluginOptions;
106
128
  vars?: Record<string, unknown>;
107
129
  tokens?: Record<string, AppshellTokenUsage>;
@@ -142,9 +164,28 @@ export type AppshellTokenUsage = {
142
164
  required: string[];
143
165
  optional: string[];
144
166
  };
167
+ /** A shared-dependency contract, named as one framework's model among possible models. */
168
+ export type SharedContract = {
169
+ apiVersion: 'federation.appshell.org/v1';
170
+ kind: 'ModuleFederation';
171
+ /** Keyed by share scope, as Module Federation groups them. */
172
+ scopes: Record<string, SharedObject>;
173
+ };
145
174
  export type AppshellManifest<TMetadata = Metadata> = {
146
- remotes: Record<string, PublishedRemote<TMetadata>>;
147
- modules: Record<string, ModuleFederationPluginOptions>;
175
+ /** What this package publishes, keyed by federation entrypoint. */
176
+ components: Record<string, PublishedRemote<TMetadata>>;
177
+ /** What it consumes, by local name; the application binds each to an address. */
178
+ remotes?: string[];
179
+ /**
180
+ * The shared-dependency contract this package was built against.
181
+ *
182
+ * Tagged like the loader recipe, and for the same reason: share scopes, singletons and
183
+ * version ranges are Module Federation's model of the problem, which single-spa and
184
+ * import maps solve differently. This replaced `modules`, which stored MF's plugin
185
+ * options verbatim — one reader took two fields from it, while its source paths and
186
+ * type-generation flags sat inside the package digest.
187
+ */
188
+ shared?: SharedContract;
148
189
  vars: Record<string, Record<string, string | number | undefined>>;
149
190
  /** Keyed by federation scope, so a merged manifest still says which package needs what. */
150
191
  tokens?: Record<string, AppshellTokenUsage>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appshell/react",
3
- "version": "1.0.0-alpha.67",
3
+ "version": "1.0.0-alpha.69",
4
4
  "description": "React utilities for building micro-frontends with Appshell and Module Federation",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/types/react/src/index.d.ts",
@@ -34,8 +34,8 @@
34
34
  "react": "^18.2.0",
35
35
  "react-dom": "^18.2.0"
36
36
  },
37
- "gitHead": "4939e80b0e0bd445b44dc7a1ebdb6fe6d80f5b34",
37
+ "gitHead": "a245de9d4419fd2ea66625b1f269e8bf06993797",
38
38
  "dependencies": {
39
- "@appshell/runtime": "^1.0.0-alpha.67"
39
+ "@appshell/runtime": "^1.0.0-alpha.69"
40
40
  }
41
41
  }