@appshell/webpack-plugin 1.0.0-alpha.47 → 1.0.0-alpha.49

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.
@@ -8,8 +8,8 @@ export { clearCredential, credentialsPath, resolveToken, saveCredential } from '
8
8
  export type { Credential } from './credentials';
9
9
  export { default as generateManifest, manifestFrom } from './generate.manifest';
10
10
  export { default as outdated } from './outdated';
11
- export { activate, publish } from './publish';
12
- export type { PublishOptions, PublishResult } from './publish';
11
+ export { activate, openOverlay, publish } from './publish';
12
+ export type { OpenedOverlay, OverlayRemotePatch, PublishOptions, PublishResult } from './publish';
13
13
  export { default as sync } from './sync';
14
14
  export type { AppshellComposition, AppshellConfig, AppshellConfigRemote, AppshellIndex, AppshellManifest, AppshellRemote, AppshellTemplate, AppshellTokenUsage, ComparisonResult, ComparisonResults, ComparisonTarget, Metadata, ModuleFederationPluginOptions, PackageSpec, ResolvedRemote, Schema, SharedConfig, SharedModuleSpec, SharedObject, } from './types';
15
15
  export * as utils from './utils';
@@ -26,3 +26,47 @@ export declare const publish: ({ registry, token, name, version, manifest, visib
26
26
  * @param application `scope/name`
27
27
  */
28
28
  export declare const activate: (registry: string, application: string, packageId: string, token?: string) => Promise<void>;
29
+ /** What an overlay redirects a single remote to. */
30
+ export type OverlayRemotePatch = {
31
+ remoteEntryUrl: string;
32
+ manifestUrl?: string;
33
+ /**
34
+ * The remote's `metadata` as this build declares it.
35
+ *
36
+ * Sent because a developer iterating on `appshell.config.yaml` is editing metadata as
37
+ * much as code; without it an overlay serves their new bundle beside the published
38
+ * route, displayName and icon. The registry replaces rather than merges, so a key
39
+ * removed from the yaml disappears rather than standing.
40
+ */
41
+ metadata?: Metadata;
42
+ };
43
+ export type OpenedOverlay = {
44
+ id: string;
45
+ confirmUrl: string;
46
+ url: string;
47
+ remotes: string[];
48
+ expiresAt: string;
49
+ /**
50
+ * False when an overlay was already open for this developer and this one extended it.
51
+ * A browser carries a single overlay id, so an extended overlay is one some browser has
52
+ * already confirmed — nothing needs sending back to the confirmation page.
53
+ */
54
+ created: boolean;
55
+ };
56
+ /**
57
+ * Points some of an application's remotes at a developer's own machine, for that
58
+ * developer only.
59
+ *
60
+ * This is what a local dev loop does instead of republishing. A published version is
61
+ * immutable and content-addressed; overwriting one on every rebuild makes the digest
62
+ * describe whoever built last, and two developers sharing a registry overwrite each
63
+ * other. An overlay is per-developer, per-browser and expiring, so neither happens.
64
+ *
65
+ * Extending is the normal case rather than the exception: the registry merges remotes
66
+ * into whatever overlay this developer already holds, so serving two micro-frontends
67
+ * locally redirects both without minting a second overlay or asking for confirmation
68
+ * twice.
69
+ *
70
+ * @param application `scope/name`
71
+ */
72
+ export declare const openOverlay: (registry: string, application: string, remotes: Record<string, OverlayRemotePatch>, token?: string) => Promise<OpenedOverlay>;
@@ -61,6 +61,15 @@ export default class AppshellPlugin {
61
61
  * federation name — the registry requires a lowercase name and has no other source
62
62
  * for a version. The scope is taken from the caller's token, so it is stripped here.
63
63
  */
64
+ /**
65
+ * Points this package's remotes at the running dev server, for this developer only.
66
+ *
67
+ * Deliberately incapable of failing a build. A dev server that will not start because a
68
+ * registry is unreachable, a token expired, or a package was never published is worse
69
+ * than one serving code the browser cannot yet compose — the developer can still see
70
+ * their own output, and the message says what to do about the rest.
71
+ */
72
+ private static redirectToDevServer;
64
73
  static identify(context: string): {
65
74
  name: string;
66
75
  version: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appshell/webpack-plugin",
3
- "version": "1.0.0-alpha.47",
3
+ "version": "1.0.0-alpha.49",
4
4
  "description": "Webpack plugin used to generate a global Appshell configuration for micro-frontends built with Module Federation",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/types/webpack-plugin/src/index.d.ts",
@@ -32,8 +32,8 @@
32
32
  "plugin"
33
33
  ],
34
34
  "license": "MIT",
35
- "gitHead": "9299f50b31ded495f5e846731a940fe69299f8fe",
35
+ "gitHead": "efd0f9c0156d747c1104edc34044a415999ab3c6",
36
36
  "dependencies": {
37
- "@appshell/tokens": "^1.0.0-alpha.47"
37
+ "@appshell/tokens": "^1.0.0-alpha.49"
38
38
  }
39
39
  }