@appshell/webpack-plugin 1.0.0-alpha.0 → 1.0.0-alpha.100

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 (80) hide show
  1. package/README.md +41 -32
  2. package/dist/main.js +5 -5
  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 +26 -0
  6. package/dist/types/config/src/credentials.d.ts +48 -0
  7. package/dist/types/config/src/generate.manifest.d.ts +30 -2
  8. package/dist/types/config/src/index.d.ts +12 -9
  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 +93 -8
  14. package/dist/types/config/src/sync.d.ts +0 -1
  15. package/dist/types/config/src/tls.d.ts +11 -0
  16. package/dist/types/config/src/types.d.ts +184 -31
  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 +15 -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 +2 -5
  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 +56 -3
  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 +12 -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/deregister.d.ts +0 -3
  46. package/dist/types/config/src/deregister.d.ts.map +0 -1
  47. package/dist/types/config/src/generate.env.d.ts +0 -3
  48. package/dist/types/config/src/generate.env.d.ts.map +0 -1
  49. package/dist/types/config/src/generate.global-config.d.ts +0 -10
  50. package/dist/types/config/src/generate.global-config.d.ts.map +0 -1
  51. package/dist/types/config/src/generate.manifest.d.ts.map +0 -1
  52. package/dist/types/config/src/index.d.ts.map +0 -1
  53. package/dist/types/config/src/mappers/appshell.config.d.ts.map +0 -1
  54. package/dist/types/config/src/outdated.d.ts.map +0 -1
  55. package/dist/types/config/src/publish.d.ts.map +0 -1
  56. package/dist/types/config/src/register.d.ts +0 -4
  57. package/dist/types/config/src/register.d.ts.map +0 -1
  58. package/dist/types/config/src/sync.d.ts.map +0 -1
  59. package/dist/types/config/src/types.d.ts.map +0 -1
  60. package/dist/types/config/src/utils/blur.d.ts.map +0 -1
  61. package/dist/types/config/src/utils/compare.d.ts.map +0 -1
  62. package/dist/types/config/src/utils/config.d.ts.map +0 -1
  63. package/dist/types/config/src/utils/copy.d.ts.map +0 -1
  64. package/dist/types/config/src/utils/index.d.ts.map +0 -1
  65. package/dist/types/config/src/utils/isValidUrl.d.ts +0 -3
  66. package/dist/types/config/src/utils/isValidUrl.d.ts.map +0 -1
  67. package/dist/types/config/src/utils/list.d.ts.map +0 -1
  68. package/dist/types/config/src/utils/load.d.ts.map +0 -1
  69. package/dist/types/config/src/utils/loadJson.d.ts +0 -10
  70. package/dist/types/config/src/utils/loadJson.d.ts.map +0 -1
  71. package/dist/types/config/src/utils/merge.d.ts +0 -4
  72. package/dist/types/config/src/utils/merge.d.ts.map +0 -1
  73. package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts +0 -4
  74. package/dist/types/config/src/validators/AppshellGlobalConfigValidator.d.ts.map +0 -1
  75. package/dist/types/config/src/validators/AppshellManifestValidator.d.ts +0 -4
  76. package/dist/types/config/src/validators/AppshellManifestValidator.d.ts.map +0 -1
  77. package/dist/types/config/src/validators/AppshellTemplateValidator.d.ts.map +0 -1
  78. package/dist/types/config/src/validators/index.d.ts.map +0 -1
  79. package/dist/types/webpack-plugin/src/AppshellPlugin.d.ts.map +0 -1
  80. package/dist/types/webpack-plugin/src/index.d.ts.map +0 -1
package/README.md CHANGED
@@ -35,7 +35,7 @@ or
35
35
  pnpm add -D @appshell/webpack-plugin
36
36
  ```
37
37
 
38
- Then add the plugin to the `webpack` config of each remote app module. For example:
38
+ Then add the plugin to the `webpack` config of each remote package. For example:
39
39
 
40
40
  **webpack.config.js**
41
41
 
@@ -54,31 +54,43 @@ module.exports = {
54
54
  ## Publishing on build
55
55
 
56
56
  The plugin can publish the generated manifest to an Appshell registry after every successful build,
57
- so a running `--watch` keeps an environment current as you work. It is **off by default** — nothing
58
- is sent anywhere unless you opt in.
57
+ so a running `--watch` keeps an application current as you work. **Development builds publish by
58
+ default** — you never toggle it per project — while production builds never publish on their own.
59
59
 
60
60
  ```js
61
61
  new AppshellPlugin({
62
62
  config: './path/to/appshell.config.yaml',
63
- registry: 'https://registry.example.com',
64
- environment: 'acme/my-dev', // optional: activate the published version here
65
- publish: true,
63
+ // registry / application are usually omitted — see below.
64
+ registry: 'https://registry.example.com', // optional override
65
+ application: 'acme/my-dev', // optional: activate the published version here
66
66
  });
67
67
  ```
68
68
 
69
- Every option falls back to an environment variable, which is usually how you enable this — the same
70
- webpack config then publishes in a dev loop or in CI without being edited:
69
+ By default the plugin defers to your **CLI context** — the registry, application, and token you set
70
+ with `appshell config set` and `appshell login` (stored in `~/.appshell`). That's the same context
71
+ the CLI uses, so one machine-level setting drives both; a project needs no per-repo configuration.
71
72
 
72
- | Option | Variable | Notes |
73
- | ------------- | --------------------------- | ------------------------------------------------ |
74
- | `publish` | `APPSHELL_PUBLISH_ON_BUILD` | Any non-empty value opts in |
75
- | `registry` | `APPSHELL_REGISTRY_URL` | Required when publishing |
76
- | `environment` | `APPSHELL_ENVIRONMENT` | `scope/name`; omit to publish without activating |
77
- | — | `APPSHELL_TOKEN` | Bearer token. Never a plugin option |
73
+ Resolution precedence, per field: explicit plugin option → `APPSHELL_*` env var → `~/.appshell`
74
+ context → default. When an option or env var points somewhere other than your persisted context, the
75
+ plugin warns that it is overriding it.
78
76
 
79
- The app is published under its **npm** name and version, unscoped — the registry takes the scope
77
+ | Field | Option | Env var | Notes |
78
+ | ----------- | ------------- | --------------------------- | ------------------------------------------------------------------------------------- |
79
+ | publish | `publish` | `APPSHELL_PUBLISH_ON_BUILD` | Defaults to `true` in development mode; set `0`/`false` to opt out |
80
+ | registry | `registry` | `APPSHELL_REGISTRY` | From CLI context by default |
81
+ | application | `application` | `APPSHELL_APPLICATION` | `scope/name` (or joined with `APPSHELL_SCOPE_ID`); omit to publish without activating |
82
+ | force | `force` | — | Overwrite a changed version; defaults to `true` in dev mode |
83
+ | token | — | `APPSHELL_TOKEN` | Otherwise from `~/.appshell/credentials`; never a plugin option |
84
+
85
+ In CI there is no `~/.appshell`, so `APPSHELL_REGISTRY`, `APPSHELL_APPLICATION`, and `APPSHELL_TOKEN`
86
+ are the whole story. If publishing defaults on in development but no registry is resolvable, the build
87
+ still succeeds — publishing is skipped with a warning.
88
+
89
+ The package is published under its **npm** name and version, unscoped — the registry takes the scope
80
90
  from your token. Publishing the same content twice is a no-op, so a watch loop that rebuilds without
81
- a version bump is harmless; publishing _different_ content under an existing version is rejected.
91
+ a version bump is harmless. Publishing _different_ content under an existing version is normally
92
+ rejected; in development mode the plugin asks the registry to overwrite it, which a local (unauthenticated)
93
+ registry honors by default and a real registry refuses unless configured with `ALLOW_FORCE_PUBLISH`.
82
94
 
83
95
  A failed publish is reported as a compilation error rather than thrown, so `--watch` reports it and
84
96
  keeps running.
@@ -92,7 +104,7 @@ Sample appshell.config.yaml
92
104
  ```yaml
93
105
  remotes:
94
106
  TestModule/Foo: # Must match the scope/module defined in ModuleFederationPlugin
95
- url: ${APPS_TEST_URL}/remoteEntry.js # Environment variables will be expanded when the global runtime manifest is generated.
107
+ url: ${APPS_TEST_URL}/remoteEntry.js # Application variables will be expanded when the global runtime manifest is generated.
96
108
  metadata: # Use metadata to provide additional information
97
109
  route: ${FOO_ROUTE}
98
110
  displayName: Foo App
@@ -118,7 +130,7 @@ remotes:
118
130
  order: 30
119
131
  icon: ViewList
120
132
 
121
- environment:
133
+ vars:
122
134
  RUNTIME_ARG_1: ${RUNTIME_ARG_1}
123
135
  RUNTIME_ARG_2: ${RUNTIME_ARG_2}
124
136
  RUNTIME_ARG_3: ${RUNTIME_ARG_3}
@@ -126,7 +138,7 @@ environment:
126
138
 
127
139
  > **Note** the variable expansion syntax `${CRA_MFE_URL}`. When the `appshell manifest` is generated the actual runtime environment values are injected.
128
140
 
129
- > **Note** the `environment` section defines runtime environment variables that are injected into the global namesapce `window.__appshell_env__[module_name]` when an Appshell component is loaded. See the examples for a use case.
141
+ > **Note** the `vars` section defines runtime configuration values a package reads with `getVars()` from [`@appshell/runtime/vars`](../runtime/README.md) once it is loaded. The package must share `@appshell/runtime` as a singleton to receive them. See the examples for a use case.
130
142
 
131
143
  **What happens at build time?**
132
144
 
@@ -258,7 +270,7 @@ Sample `appshell manifest`:
258
270
  }
259
271
  }
260
272
  },
261
- "environment": {
273
+ "vars": {
262
274
  "CraModule": {
263
275
  "RUNTIME_ARG_1": "Foo",
264
276
  "RUNTIME_ARG_2": "Biz"
@@ -292,19 +304,16 @@ module.exports = {
292
304
 
293
305
  ### `Options`
294
306
 
295
- - [`config`](#config)
296
-
297
- #### `config`
298
-
299
- Type:
300
-
301
- ```ts
302
- type config = string;
303
- ```
304
-
305
- Default: `appshell.config.yaml`
307
+ | Option | Type | Default | Purpose |
308
+ | ------ | ---- | ------- | ------- |
309
+ | `config` | `string` | `appshell.config.yaml` | Location of the config file |
310
+ | `registry` | `string` | CLI context | Registry to publish to |
311
+ | `application` | `string` | CLI context | Application to activate the published version in |
312
+ | `publish` | `boolean` | `true` in development | Publish after every successful build |
313
+ | `force` | `boolean` | `true` in development | Ask the registry to overwrite an existing version whose content differs |
306
314
 
307
- Location of the `appshell.config.yaml` file.
315
+ `registry` and `application` are usually omitted — see
316
+ [Publishing on build](#publishing-on-build) for the resolution order.
308
317
 
309
318
  ## License
310
319