@appshell/webpack-plugin 1.0.0-alpha.9 → 1.0.0-alpha.90

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.
Files changed (82) hide show
  1. package/README.md +21 -24
  2. package/dist/main.js +3 -3
  3. package/dist/types/config/src/axios.d.ts +0 -1
  4. package/dist/types/config/src/configmap.d.ts +0 -1
  5. package/dist/types/config/src/context.d.ts +3 -4
  6. package/dist/types/config/src/credentials.d.ts +35 -3
  7. package/dist/types/config/src/generate.manifest.d.ts +30 -2
  8. package/dist/types/config/src/index.d.ts +9 -10
  9. package/dist/types/config/src/loader.d.ts +18 -0
  10. package/dist/types/config/src/mappers/appshell.config.d.ts +9 -3
  11. package/dist/types/config/src/outdated.d.ts +0 -1
  12. package/dist/types/config/src/package-name.d.ts +20 -0
  13. package/dist/types/config/src/publish.d.ts +89 -7
  14. package/dist/types/config/src/sync.d.ts +0 -1
  15. package/dist/types/config/src/tls.d.ts +23 -0
  16. package/dist/types/config/src/types.d.ts +164 -30
  17. package/dist/types/config/src/utils/blur.d.ts +0 -1
  18. package/dist/types/config/src/utils/compare.d.ts +0 -1
  19. package/dist/types/config/src/utils/config.d.ts +0 -1
  20. package/dist/types/config/src/utils/copy.d.ts +0 -1
  21. package/dist/types/config/src/utils/dump.d.ts +10 -0
  22. package/dist/types/config/src/utils/index.d.ts +1 -4
  23. package/dist/types/config/src/utils/list.d.ts +0 -1
  24. package/dist/types/config/src/utils/load.d.ts +0 -1
  25. package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts +0 -1
  26. package/dist/types/config/src/validators/index.d.ts +0 -3
  27. package/dist/types/runtime/src/errors.d.ts +32 -0
  28. package/dist/types/runtime/src/identity.d.ts +47 -0
  29. package/dist/types/runtime/src/index.d.ts +6 -0
  30. package/dist/types/runtime/src/store.d.ts +25 -0
  31. package/dist/types/runtime/src/types.d.ts +9 -0
  32. package/dist/types/runtime/src/wire.d.ts +58 -0
  33. package/dist/types/tokens/src/contract.d.ts +51 -0
  34. package/dist/types/tokens/src/contrast.d.ts +37 -0
  35. package/dist/types/tokens/src/index.d.ts +4 -0
  36. package/dist/types/tokens/src/presets.d.ts +4 -0
  37. package/dist/types/tokens/src/theme.d.ts +54 -0
  38. package/dist/types/webpack-plugin/src/AppshellPlugin.d.ts +46 -5
  39. package/dist/types/webpack-plugin/src/devHint.d.ts +45 -0
  40. package/dist/types/webpack-plugin/src/index.d.ts +3 -1
  41. package/dist/types/webpack-plugin/src/shared.d.ts +36 -0
  42. package/package.json +11 -4
  43. package/dist/types/config/src/axios.d.ts.map +0 -1
  44. package/dist/types/config/src/configmap.d.ts.map +0 -1
  45. package/dist/types/config/src/context.d.ts.map +0 -1
  46. package/dist/types/config/src/credentials.d.ts.map +0 -1
  47. package/dist/types/config/src/deregister.d.ts +0 -3
  48. package/dist/types/config/src/deregister.d.ts.map +0 -1
  49. package/dist/types/config/src/generate.env.d.ts +0 -3
  50. package/dist/types/config/src/generate.env.d.ts.map +0 -1
  51. package/dist/types/config/src/generate.global-config.d.ts +0 -10
  52. package/dist/types/config/src/generate.global-config.d.ts.map +0 -1
  53. package/dist/types/config/src/generate.manifest.d.ts.map +0 -1
  54. package/dist/types/config/src/index.d.ts.map +0 -1
  55. package/dist/types/config/src/mappers/appshell.config.d.ts.map +0 -1
  56. package/dist/types/config/src/outdated.d.ts.map +0 -1
  57. package/dist/types/config/src/publish.d.ts.map +0 -1
  58. package/dist/types/config/src/register.d.ts +0 -4
  59. package/dist/types/config/src/register.d.ts.map +0 -1
  60. package/dist/types/config/src/sync.d.ts.map +0 -1
  61. package/dist/types/config/src/types.d.ts.map +0 -1
  62. package/dist/types/config/src/utils/blur.d.ts.map +0 -1
  63. package/dist/types/config/src/utils/compare.d.ts.map +0 -1
  64. package/dist/types/config/src/utils/config.d.ts.map +0 -1
  65. package/dist/types/config/src/utils/copy.d.ts.map +0 -1
  66. package/dist/types/config/src/utils/index.d.ts.map +0 -1
  67. package/dist/types/config/src/utils/isValidUrl.d.ts +0 -3
  68. package/dist/types/config/src/utils/isValidUrl.d.ts.map +0 -1
  69. package/dist/types/config/src/utils/list.d.ts.map +0 -1
  70. package/dist/types/config/src/utils/load.d.ts.map +0 -1
  71. package/dist/types/config/src/utils/loadJson.d.ts +0 -10
  72. package/dist/types/config/src/utils/loadJson.d.ts.map +0 -1
  73. package/dist/types/config/src/utils/merge.d.ts +0 -4
  74. package/dist/types/config/src/utils/merge.d.ts.map +0 -1
  75. package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts +0 -4
  76. package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts.map +0 -1
  77. package/dist/types/config/src/validators/AppshellManifestValidator.d.ts +0 -4
  78. package/dist/types/config/src/validators/AppshellManifestValidator.d.ts.map +0 -1
  79. package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts.map +0 -1
  80. package/dist/types/config/src/validators/index.d.ts.map +0 -1
  81. package/dist/types/webpack-plugin/src/AppshellPlugin.d.ts.map +0 -1
  82. package/dist/types/webpack-plugin/src/index.d.ts.map +0 -1
@@ -1,3 +1,2 @@
1
1
  declare const _default: import("axios").AxiosInstance;
2
2
  export default _default;
3
- //# sourceMappingURL=axios.d.ts.map
@@ -4,4 +4,3 @@ declare const _default: {
4
4
  create: (config: AppshellConfig) => Record<string, string>;
5
5
  };
6
6
  export default _default;
7
- //# sourceMappingURL=configmap.d.ts.map
@@ -1,12 +1,12 @@
1
1
  export type AppshellContext = {
2
2
  registry?: string;
3
3
  /** Activation target as `scope/name`. */
4
- environment?: string;
4
+ application?: string;
5
5
  scopeId: string;
6
6
  token?: string;
7
7
  };
8
8
  /**
9
- * The registry, environment, and token a developer is working against, resolved
9
+ * The registry, application, and token a developer is working against, resolved
10
10
  * the way the CLI resolves them: env var, then `~/.appshell/config`, then a
11
11
  * default. This lets the webpack plugin defer to `appshell config set` and
12
12
  * `appshell login` instead of requiring per-project configuration.
@@ -18,6 +18,5 @@ export declare const resolveContext: () => AppshellContext;
18
18
  */
19
19
  export declare const persistedContext: () => {
20
20
  registry?: string;
21
- environment?: string;
21
+ application?: string;
22
22
  };
23
- //# sourceMappingURL=context.d.ts.map
@@ -3,14 +3,46 @@ export type Credential = {
3
3
  refreshToken?: string;
4
4
  /** Epoch milliseconds. */
5
5
  expiresAt?: number;
6
+ /**
7
+ * Where this credential came from, so it can renew itself.
8
+ *
9
+ * A refresh token is useless without the issuer that minted it and the client it was
10
+ * minted for, and neither is derivable from the registry url — an operator is free to
11
+ * point several registries at one issuer, or one registry at an issuer that moves.
12
+ * Captured at login for that reason.
13
+ *
14
+ * Optional because a credential written before this existed has neither; such a
15
+ * credential simply cannot refresh, and the next login repairs it.
16
+ */
17
+ issuer?: string;
18
+ clientId?: string;
6
19
  };
7
20
  export declare const credentialsPath: () => string;
8
21
  export declare const saveCredential: (registry: string, credential: Credential) => void;
9
22
  export declare const clearCredential: (registry: string) => void;
10
23
  /**
24
+ * The stored access token, or nothing if it has expired.
25
+ *
11
26
  * APPSHELL_TOKEN wins so CI never depends on a writable home directory.
12
- * Expired tokens are treated as absent; refresh is the caller's concern.
27
+ *
28
+ * Deliberately synchronous and deliberately does not refresh: callers that can await
29
+ * should use `ensureToken`, which renews. This remains for the places that cannot —
30
+ * `resolveContext` among them, which the webpack plugin calls while building.
13
31
  */
14
32
  export declare const resolveToken: (registry: string) => string | undefined;
15
- export declare const requireToken: (registry: string) => string;
16
- //# sourceMappingURL=credentials.d.ts.map
33
+ /**
34
+ * The stored access token, renewed first if it has expired.
35
+ *
36
+ * `appshell login` obtains a refresh token and, until this existed, nothing ever read it:
37
+ * every expiry meant a full device-authorization flow — open a browser, enter a code,
38
+ * approve — with the credential that would have avoided it sitting in the file.
39
+ *
40
+ * Renewal cannot widen what a caller may do. The issuer mints the new access token from
41
+ * the account as it stands now, so a revoked role or a disabled account produces a weaker
42
+ * token or none at all, never a stale stronger one.
43
+ *
44
+ * A failed renewal returns nothing rather than throwing. The caller's own 401 is the
45
+ * better place to explain what to do, and a network blip on the way to the issuer should
46
+ * not read as *you are logged out*.
47
+ */
48
+ export declare const ensureToken: (registry: string) => Promise<string | undefined>;
@@ -1,8 +1,36 @@
1
+ import { AppshellTemplate } from './types';
2
+ /**
3
+ * Substitutes a template into the manifest the registry stores.
4
+ *
5
+ * Split out from the file-reading half so a caller holding a template in memory — the
6
+ * webpack plugin, which just built one — does not have to write it to disk and read it
7
+ * back to get a manifest. One substitution pass, one place it can be wrong.
8
+ *
9
+ * Operates on a copy, because substitution writes in place. Reading a template off disk
10
+ * hid that: every call parsed its own fresh object, so nothing downstream could notice.
11
+ * A caller passing a template it still holds would get its `${VAR}` placeholders replaced
12
+ * underneath it — and the plugin is exactly that caller, building the manifest during
13
+ * `processAssets` and then writing the same template to disk at `afterEmit`.
14
+ */
15
+ export declare const manifestFrom: <TMetadata extends Record<string, unknown>>(template: AppshellTemplate) => {
16
+ vars: Record<string, Record<string, string | number | undefined>>;
17
+ components: Record<string, import("./types").PublishedRemote<TMetadata>>;
18
+ remotes?: string[];
19
+ shared?: import("./types").SharedContract;
20
+ tokens?: Record<string, import("./types").AppshellTokenUsage>;
21
+ overrides?: import("./types").AppshellOverrides;
22
+ };
1
23
  /**
2
24
  * Generates an appshell manifest
3
25
  * @param templatePath path of the appshell manifest template to compile into an appshell manifest
4
26
  * @returns an appshell manifest
5
27
  */
6
- declare const _default: <TMetadata extends Record<string, unknown>>(templatePath: string) => Promise<import("./types").AppshellManifest<TMetadata> | null>;
28
+ declare const _default: <TMetadata extends Record<string, unknown>>(templatePath: string) => Promise<{
29
+ vars: Record<string, Record<string, string | number | undefined>>;
30
+ components: Record<string, import("./types").PublishedRemote<TMetadata>>;
31
+ remotes?: string[];
32
+ shared?: import("./types").SharedContract;
33
+ tokens?: Record<string, import("./types").AppshellTokenUsage>;
34
+ overrides?: import("./types").AppshellOverrides;
35
+ } | null>;
7
36
  export default _default;
8
- //# sourceMappingURL=generate.manifest.d.ts.map
@@ -4,18 +4,17 @@
4
4
  export { default as configmap } from './configmap';
5
5
  export { persistedContext, resolveContext } from './context';
6
6
  export type { AppshellContext } from './context';
7
- export { clearCredential, credentialsPath, requireToken, resolveToken, saveCredential, } from './credentials';
7
+ export { clearCredential, credentialsPath, ensureToken, resolveToken, saveCredential, } from './credentials';
8
8
  export type { Credential } from './credentials';
9
- export { default as deregister } from './deregister';
10
- export { default as generateEnv } from './generate.env';
11
- export { default as generateGlobalConfig } from './generate.global-config';
12
- export { default as generateManifest } from './generate.manifest';
9
+ export { default as generateManifest, manifestFrom } from './generate.manifest';
10
+ export { loaderOf } from './loader';
13
11
  export { default as outdated } from './outdated';
14
- export { activate, publish } from './publish';
15
- export type { PublishOptions, PublishResult } from './publish';
16
- export { default as register } from './register';
12
+ export { parsePackageName } from './package-name';
13
+ export type { PackageName } from './package-name';
14
+ export { activate, openOverlay, publish } from './publish';
15
+ export type { OpenedOverlay, OverlayRemotePatch, PublishOptions, PublishResult } from './publish';
17
16
  export { default as sync } from './sync';
18
- export type { AppshellComposition, AppshellConfig, AppshellConfigRemote, AppshellGlobalConfig, AppshellIndex, AppshellManifest, AppshellRemote, AppshellTemplate, ComparisonResult, ComparisonResults, ComparisonTarget, Metadata, ModuleFederationPluginOptions, PackageSpec, ResolvedRemote, Schema, SharedModuleSpec, } from './types';
17
+ export { caFile, httpsAgent } from './tls';
18
+ export type { AppshellComposition, AppshellConfig, AppshellConfigRemote, AppshellIndex, AppshellManifest, AppshellRemote, AppshellTemplate, AppshellTokenUsage, ComparisonResult, ComparisonResults, ComparisonTarget, Metadata, ModuleFederationPluginOptions, PackageSpec, ResolvedRemote, Schema, SharedConfig, SharedModuleSpec, SharedObject, } from './types';
19
19
  export * as utils from './utils';
20
20
  export * as validators from './validators';
21
- //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { ModuleFederationLoader } from './types';
2
+ /**
3
+ * How to load one component, derived from the Module Federation config that emits it.
4
+ *
5
+ * One definition, used twice: the manifest a publish stores, and the patch an overlay
6
+ * sends. Those describe the same thing from either side of a publish, and two copies of
7
+ * the derivation would disagree the moment one of them changed — the drift being that an
8
+ * overlay addresses a dev server's bundle by a container name the build no longer uses,
9
+ * which surfaces as module federation failing to find a container rather than as anything
10
+ * naming the cause.
11
+ *
12
+ * The federation fields sit under a kind rather than at the top level, so they read as one
13
+ * framework's vocabulary rather than as something generic.
14
+ */
15
+ export declare const loaderOf: (module: {
16
+ shareScope?: string;
17
+ filename?: string;
18
+ }, federationKey: string) => ModuleFederationLoader;
@@ -1,3 +1,9 @@
1
- import { AppshellManifest, AppshellTemplate, ConfigMap } from '../types';
2
- export declare const toAppshellManifest: <TMetadata extends Record<string, unknown>>(template: AppshellTemplate, args: ConfigMap) => AppshellManifest<TMetadata>;
3
- //# sourceMappingURL=appshell.config.d.ts.map
1
+ import { AppshellTemplate, ConfigMap, PublishedRemote, SharedContract } from '../types';
2
+ export declare const toAppshellManifest: <TMetadata extends Record<string, unknown>>(template: AppshellTemplate, args: ConfigMap) => {
3
+ vars: Record<string, Record<string, string | number | undefined>>;
4
+ components: Record<string, PublishedRemote<TMetadata>>;
5
+ remotes?: string[];
6
+ shared?: SharedContract;
7
+ tokens?: Record<string, import("../types").AppshellTokenUsage>;
8
+ overrides?: import("../types").AppshellOverrides;
9
+ };
@@ -1,4 +1,3 @@
1
1
  import { PackageSpec, SharedModuleSpec } from './types';
2
2
  declare const _default: (packageSpec: PackageSpec, sharedModuleSpec: SharedModuleSpec) => Promise<import("./types").ComparisonResults>;
3
3
  export default _default;
4
- //# sourceMappingURL=outdated.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * An npm package name split into where it belongs and what it is called.
3
+ *
4
+ * `@acme/checkout` is scope `acme`, name `checkout`. A bare `checkout` declares no scope
5
+ * and belongs wherever the publisher does.
6
+ *
7
+ * One definition because three places used to strip the scope with their own copy of the
8
+ * same regular expression — the cli's `identify`, its workspace scan, and the webpack
9
+ * plugin. Three copies of a rule about identity is three chances for a package to publish
10
+ * to a different place than the tooling thinks it does.
11
+ *
12
+ * Scope is worth declaring for the reason it is worth checking in: `@acme/checkout` says
13
+ * where it belongs in a file under review, identically for everyone, rather than landing
14
+ * in whichever namespace the person running the publish happens to carry.
15
+ */
16
+ export type PackageName = {
17
+ scopeId?: string;
18
+ name: string;
19
+ };
20
+ export declare const parsePackageName: (raw: string) => PackageName;
@@ -1,7 +1,15 @@
1
- import { AppshellManifest, Metadata } from './types';
1
+ import { AppshellManifest, Metadata, ModuleFederationLoader } from './types';
2
2
  export type PublishOptions = {
3
3
  registry: string;
4
4
  token?: string;
5
+ /**
6
+ * Where this package belongs, when the package name declares it.
7
+ *
8
+ * Omitted means the publisher's own namespace, which is how every publish worked before
9
+ * this existed. The registry refuses a scope the caller does not own, so declaring one
10
+ * is a statement of fact rather than a request.
11
+ */
12
+ scopeId?: string;
5
13
  name: string;
6
14
  version: string;
7
15
  manifest: AppshellManifest;
@@ -11,19 +19,93 @@ export type PublishOptions = {
11
19
  force?: boolean;
12
20
  };
13
21
  export type PublishResult = {
14
- /** `scope/name@version`. The scope comes from the token, not the caller. */
22
+ /** `scope/name@version`. From the package name where it declares one, else the token. */
15
23
  id: string;
16
24
  created: boolean;
25
+ /** Empty unless a shared block was sent. See `openOverlay`. */
26
+ divergence: SharedDivergence[];
17
27
  };
18
28
  /**
19
29
  * Publishing the same content twice is a no-op; publishing different content
20
30
  * under a version that already exists is rejected by the registry, unless
21
31
  * `force` is set and the registry is configured to honor it (dev registries).
22
32
  */
23
- export declare const publish: ({ registry, token, name, version, manifest, visibility, metadata, force, }: PublishOptions) => Promise<PublishResult>;
33
+ export declare const publish: ({ registry, token, scopeId, name, version, manifest, visibility, metadata, force, }: PublishOptions) => Promise<PublishResult>;
24
34
  /**
25
- * Activating a newer version of an already active app upgrades it in place.
26
- * @param environment `scope/name`
35
+ * Activating a newer version of an already active package upgrades it in place.
36
+ * @param application `scope/name`
27
37
  */
28
- export declare const activate: (registry: string, environment: string, appId: string, token?: string) => Promise<void>;
29
- //# sourceMappingURL=publish.d.ts.map
38
+ export declare const activate: (registry: string, application: string, packageId: string, token?: string) => Promise<void>;
39
+ /** What an overlay redirects a single remote to, or introduces one as. */
40
+ export type OverlayRemotePatch = {
41
+ remoteEntryUrl: string;
42
+ manifestUrl?: string;
43
+ /**
44
+ * How to load this build's copy, from the Module Federation config that emits it.
45
+ *
46
+ * Sent because the loader describes the code being loaded, and an overlay points at
47
+ * this build rather than the published one. Without it a redirect addresses a dev
48
+ * server's bundle by whatever container name the last publish happened to have, so
49
+ * renaming the container locally resolves to a container the browser cannot find.
50
+ *
51
+ * It is also what lets an overlay introduce a component that is not published yet: a
52
+ * redirect inherits the published loader, an addition has no published anything.
53
+ */
54
+ loader?: ModuleFederationLoader;
55
+ /**
56
+ * The remote's `metadata` as this build declares it.
57
+ *
58
+ * Sent because a developer iterating on `appshell.config.yaml` is editing metadata as
59
+ * much as code; without it an overlay serves their new bundle beside the published
60
+ * route, displayName and icon. The registry replaces rather than merges, so a key
61
+ * removed from the yaml disappears rather than standing.
62
+ */
63
+ metadata?: Metadata;
64
+ };
65
+ /** One shared dependency where a local build and the published version disagree. */
66
+ export type SharedDivergence = {
67
+ packageId: string;
68
+ shareScope: string;
69
+ packageName: string;
70
+ published?: string;
71
+ local?: string;
72
+ singleton: {
73
+ published: boolean;
74
+ local: boolean;
75
+ };
76
+ };
77
+ export type OpenedOverlay = {
78
+ id: string;
79
+ confirmUrl: string;
80
+ url: string;
81
+ remotes: string[];
82
+ expiresAt: string;
83
+ /**
84
+ * False when an overlay was already open for this developer and this one extended it.
85
+ * A browser carries a single overlay id, so an extended overlay is one some browser has
86
+ * already confirmed — nothing needs sending back to the confirmation page.
87
+ */
88
+ created: boolean;
89
+ /**
90
+ * What this build declares that the published version does not. Empty unless a shared
91
+ * block was sent — see `openOverlay`.
92
+ */
93
+ divergence: SharedDivergence[];
94
+ };
95
+ /**
96
+ * Points some of an application's remotes at a developer's own machine, for that
97
+ * developer only.
98
+ *
99
+ * This is what a local dev loop does instead of republishing. A published version is
100
+ * immutable and content-addressed; overwriting one on every rebuild makes the digest
101
+ * describe whoever built last, and two developers sharing a registry overwrite each
102
+ * other. An overlay is per-developer, per-browser and expiring, so neither happens.
103
+ *
104
+ * Extending is the normal case rather than the exception: the registry merges remotes
105
+ * into whatever overlay this developer already holds, so serving two micro-frontends
106
+ * locally redirects both without minting a second overlay or asking for confirmation
107
+ * twice.
108
+ *
109
+ * @param application `scope/name`
110
+ */
111
+ export declare const openOverlay: (registry: string, application: string, remotes: Record<string, OverlayRemotePatch>, token?: string, shared?: Record<string, unknown>, shellFlavor?: "prod" | "dev") => Promise<OpenedOverlay>;
@@ -18,4 +18,3 @@ export declare const groupByBaselineModule: (conflicts: Record<string, Compariso
18
18
  */
19
19
  declare const _default: (workingDir: string, registry: string, conflicts: Record<string, ComparisonResult>, resolutionStrategy?: ResolutionStrategy, packageManager?: PackageManager, dryRun?: boolean) => Promise<void>;
20
20
  export default _default;
21
- //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1,23 @@
1
+ import https from 'https';
2
+ /**
3
+ * An extra CA bundle to trust, from `ca-file` in the cli config or `APPSHELL_CA_FILE`.
4
+ *
5
+ * A registry behind a private CA — a corporate root, a TLS-inspecting proxy, or a local
6
+ * cluster using mkcert — fails with "unable to verify the first certificate", which says
7
+ * nothing about which host or what to do. Node can be told through `NODE_EXTRA_CA_CERTS`
8
+ * or `--use-system-ca`, but both are environment variables a user has to remember in
9
+ * every new terminal, and neither travels with the registry they apply to.
10
+ *
11
+ * npm draws the same conclusion with `cafile` in .npmrc: trust is configuration of the
12
+ * registry you talk to, not of the shell you happen to be in.
13
+ */
14
+ export declare const caFile: () => string | undefined;
15
+ /**
16
+ * The agent to use for registry and issuer requests, or undefined when no CA is
17
+ * configured and Node's defaults apply.
18
+ *
19
+ * A configured file that does not exist throws rather than being skipped: falling back
20
+ * silently would reproduce the original certificate error, having been told exactly how
21
+ * to avoid it.
22
+ */
23
+ export declare const httpsAgent: () => https.Agent | undefined;
@@ -1,4 +1,6 @@
1
+ import type { AppshellIndex, AppshellRemote, Metadata, RemoteLoader } from '@appshell/runtime';
1
2
  import { JSONSchema4, JSONSchema6, JSONSchema7 } from 'json-schema';
3
+ export type { AppshellIndex, AppshellRemote, Metadata, ModuleFederationLoader, RemoteLoader, } from '@appshell/runtime';
2
4
  export type Schema = JSONSchema4 | JSONSchema6 | JSONSchema7;
3
5
  export type ConfigValidator = {
4
6
  validate: <T>(...config: T[]) => void;
@@ -43,58 +45,165 @@ export type ComparisonTarget = {
43
45
  name: string;
44
46
  dependencies: Record<string, string | undefined>;
45
47
  };
48
+ /**
49
+ * Every key `appshell config set` accepts, kept adjacent to the type it must agree with.
50
+ *
51
+ * It used to live in the set handler, and adding `caFile` to CliConfig without touching it
52
+ * produced a setting the cli could read and refuse to write.
53
+ */
54
+ export declare const CLI_SETTINGS: readonly ["registry", "application", "scopeId", "authIssuer", "clientId", "apiKey", "apiKeyHeader", "caFile"];
55
+ export type CliSetting = (typeof CLI_SETTINGS)[number];
46
56
  export type CliConfig = Record<string, string> & {
47
57
  apiKey: string;
58
+ /**
59
+ * PEM bundle to trust in addition to Node's built-ins, for a registry behind a private
60
+ * CA. Optional, and absent from `config init` output: an empty path is not a default
61
+ * worth writing, and its absence means "use Node's defaults".
62
+ */
63
+ caFile?: string;
48
64
  registry: string;
49
- environment: string;
65
+ application: string;
50
66
  scopeId: string;
51
67
  authIssuer: string;
52
68
  clientId: string;
53
69
  };
70
+ /**
71
+ * Neither `url` nor `filename`.
72
+ *
73
+ * `url` is an origin, and an origin belongs to a deployment: a package is published once
74
+ * and deployed many times, so a url here would freeze one environment's answer into an
75
+ * immutable version and make the artifact's digest depend on where it was built.
76
+ *
77
+ * `filename` was a hand-written copy of the Module Federation `filename`, which is what
78
+ * actually decides the file webpack emits. Two statements of one fact, and only one of
79
+ * them is enforced by anything.
80
+ */
54
81
  export type AppshellConfigRemote<TMetadata = Metadata> = {
55
82
  id: string;
56
- url: string;
57
- filename: string;
58
83
  metadata: TMetadata;
59
84
  };
60
85
  export type AppshellConfig<TMetadata = Metadata> = {
61
86
  name?: string;
62
- remotes?: Record<string, AppshellConfigRemote<TMetadata>>;
63
- environment?: Record<string, unknown>;
87
+ /**
88
+ * What the registry should publish this package as. `--visibility` overrides it.
89
+ *
90
+ * Declared here but deliberately absent from the manifest, as `name` already is: the
91
+ * manifest is hashed into the package digest, and visibility is not a property of the
92
+ * artifact. Keeping it out is what lets a package be made public later without its
93
+ * content changing identity.
94
+ */
95
+ visibility?: 'public' | 'private';
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[];
118
+ vars?: Record<string, unknown>;
64
119
  overrides?: AppshellOverrides;
65
120
  };
66
121
  export type AppshellTemplate<TMetadata = Metadata> = {
67
122
  name?: string;
68
- remotes?: Record<string, AppshellConfigRemote<TMetadata>>;
123
+ /** Carried from the yaml for publish to read; never mapped into the manifest. */
124
+ visibility?: 'public' | 'private';
125
+ components?: Record<string, AppshellConfigRemote<TMetadata>>;
126
+ remotes?: string[];
69
127
  module: ModuleFederationPluginOptions;
70
- environment?: Record<string, unknown>;
128
+ vars?: Record<string, unknown>;
129
+ tokens?: Record<string, AppshellTokenUsage>;
71
130
  overrides?: AppshellOverrides;
72
131
  };
73
132
  /** Appshell manifest types */
74
- export type AppshellRemote<TMetadata = Metadata> = {
75
- id: string;
76
- manifestUrl: string;
77
- remoteEntryUrl: string;
78
- scope: string;
79
- module: string;
80
- shareScope?: string;
81
- metadata: TMetadata;
133
+ /** The parts of a remote an application may point somewhere else. */
134
+ export type RemoteOverride = {
135
+ remoteEntryUrl?: string;
136
+ manifestUrl?: string;
82
137
  };
83
138
  export type AppshellOverrides = {
84
- environment: Record<string, Record<string, string | number | undefined>>;
139
+ vars: Record<string, Record<string, string | number | undefined>>;
140
+ /**
141
+ * Where an application loads a remote from, keyed by registry address.
142
+ *
143
+ * A package is published once; an application is deployed many times, per environment.
144
+ * The origin a bundle is served from is a property of a deployment, so it belongs to
145
+ * whoever deploys rather than being frozen into an immutable artifact at publish — which
146
+ * is also what makes adopting someone else's package and serving it yourself a spec edit
147
+ * rather than a republish.
148
+ *
149
+ * `filename` stays in the manifest: `remoteEntry.js` is genuinely build output. Only the
150
+ * origin varies by environment.
151
+ */
152
+ remotes?: Record<string, RemoteOverride>;
153
+ };
154
+ /**
155
+ * Which design tokens a package's own output reaches for. Observed from the emitted
156
+ * assets rather than declared: the CSS already says it, and a hand-kept list is a copy
157
+ * that drifts the first time someone adds a token and forgets the yaml.
158
+ *
159
+ * `required` is a reference with no fallback — the package has no plan B. `optional` is
160
+ * `var(--appshell-x, something)`, which degrades on its own. That split is read off what
161
+ * the author wrote rather than asked of them.
162
+ */
163
+ export type AppshellTokenUsage = {
164
+ required: string[];
165
+ optional: string[];
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>;
85
173
  };
86
174
  export type AppshellManifest<TMetadata = Metadata> = {
87
- remotes: Record<string, AppshellRemote<TMetadata>>;
88
- modules: Record<string, ModuleFederationPluginOptions>;
89
- environment: Record<string, Record<string, string | number | undefined>>;
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;
189
+ vars: Record<string, Record<string, string | number | undefined>>;
190
+ /** Keyed by federation scope, so a merged manifest still says which package needs what. */
191
+ tokens?: Record<string, AppshellTokenUsage>;
90
192
  overrides?: AppshellOverrides;
91
193
  };
92
- export type AppshellIndex = Record<string, string>;
93
- export type Metadata = Record<string, unknown>;
94
- export type AppshellGlobalConfig<TMetadata = Metadata> = {
95
- index: AppshellIndex;
96
- metadata?: Record<string, TMetadata>;
97
- overrides?: AppshellOverrides;
194
+ /**
195
+ * A remote as a package publishes it: what the build knows about itself, and nothing
196
+ * about where it ends up.
197
+ *
198
+ * Distinct from `AppshellRemote`, which is the same remote after the registry has
199
+ * resolved it for the browser. They were one type, which is why the origin ended up in
200
+ * the artifact: the browser genuinely needs a url, so the published form appeared to as
201
+ * well. The registry supplies it at composition, from the address and its serving plane.
202
+ */
203
+ export type PublishedRemote<TMetadata = Metadata> = {
204
+ id: string;
205
+ loader: RemoteLoader;
206
+ metadata: TMetadata;
98
207
  };
99
208
  /** An `AppshellRemote` the registry already resolved, so the browser needs no manifest fetch. */
100
209
  export type ResolvedRemote<TMetadata = Metadata> = AppshellRemote<TMetadata>;
@@ -102,19 +211,45 @@ export type ResolvedRemote<TMetadata = Metadata> = AppshellRemote<TMetadata>;
102
211
  * The wire contract for `window.__appshell_config__`. Deliberately not an
103
212
  * `AppshellManifest`: that is a build artifact, and reusing it left it unclear
104
213
  * which fields the browser actually needs. `modules` is build-time webpack
105
- * config and never crosses the wire; `environment` arrives already merged with
106
- * the environment's overrides, leaving the browser only local overrides to apply.
214
+ * config and never crosses the wire; `vars` arrives already merged with the
215
+ * application's overrides, leaving the browser only local overrides to apply.
107
216
  */
108
217
  export type AppshellComposition<TMetadata = Metadata> = {
109
218
  /** `scope/name` — makes the payload self-describing for fetch-on-miss and for `env diff`. */
110
- environmentId: string;
219
+ applicationId: string;
111
220
  revision: number;
112
221
  /** The remote key the host mounts at the root, and the props it is given. */
113
222
  root: string;
114
223
  rootProps: Record<string, unknown>;
115
224
  index: AppshellIndex;
116
225
  remotes: Record<string, ResolvedRemote<TMetadata>>;
117
- environment: Record<string, Record<string, string | number | undefined>>;
226
+ vars: Record<string, Record<string, string | number | undefined>>;
227
+ /**
228
+ * Present whenever a per-developer overlay changed anything about this render — a
229
+ * redirected remote, a different shell bundle, a substituted theme, or any combination.
230
+ * The shell is expected to surface it: a page that quietly runs code from somewhere
231
+ * else is the one thing this feature must never be, and swapping the shell or the theme
232
+ * out counts.
233
+ *
234
+ * `shellFlavor` is what was actually served, not what was asked for. `theme` is the ref
235
+ * the overlay substituted, present only when it substituted one.
236
+ */
237
+ overlay?: {
238
+ id: string;
239
+ remotes: string[];
240
+ /**
241
+ * Those of `remotes` the overlay introduced rather than redirected — components the
242
+ * application does not publish, running for this developer and nobody else.
243
+ *
244
+ * Separate from `remotes` because the two are not the same claim. A redirected
245
+ * component exists for everyone and this browser runs a different copy of it; an
246
+ * added one does not exist outside this overlay at all, so a feature built on top of
247
+ * one works here and is absent everywhere else.
248
+ */
249
+ added?: string[];
250
+ shellFlavor: 'prod' | 'dev';
251
+ theme?: string;
252
+ };
118
253
  };
119
254
  /**
120
255
  * Advanced configuration for modules that should be exposed by this container.
@@ -293,4 +428,3 @@ export interface ModuleFederationPluginOptions {
293
428
  */
294
429
  shared?: (string | SharedObject)[] | SharedObject;
295
430
  }
296
- //# sourceMappingURL=types.d.ts.map
@@ -1,3 +1,2 @@
1
1
  declare const _default: (token?: string, chars?: number) => string;
2
2
  export default _default;
3
- //# sourceMappingURL=blur.d.ts.map
@@ -5,4 +5,3 @@ export declare const compareDependencies: (sample: ComparisonTarget, baseline: C
5
5
  export declare const compareSharedDependencies: (packageSpec: PackageSpec, sharedModule: SharedModuleSpec) => ComparisonResults;
6
6
  export declare const compareSharedModules: (sampleSpec: SharedModuleSpec, baselineSpec: SharedModuleSpec) => ComparisonResults;
7
7
  export declare const printResults: (results: ComparisonResults) => void;
8
- //# sourceMappingURL=compare.d.ts.map
@@ -3,4 +3,3 @@ import { CliConfig } from '../types';
3
3
  export declare const readConfig: (configPath: string) => CliConfig;
4
4
  export declare const writeConfig: (configPath: string, config: CliConfig) => void;
5
5
  export declare const mergeConfigWithArgs: (config: CliConfig, argv: yargs.ArgumentsCamelCase<unknown>) => void;
6
- //# sourceMappingURL=config.d.ts.map
@@ -8,4 +8,3 @@ declare const _default: (pattern: {
8
8
  to: string;
9
9
  }) => void;
10
10
  export default _default;
11
- //# sourceMappingURL=copy.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Serialises a value to YAML.
3
+ *
4
+ * The counterpart to `load`, and here rather than at each call site so the YAML library
5
+ * stays in one package. `appshell theme init` writes a file an author then edits, so the
6
+ * output is line-wrapped generously — a colour value broken across lines is technically
7
+ * valid and horrible to read.
8
+ */
9
+ declare const dump: (value: unknown) => string;
10
+ export default dump;