vite-plugin-zephyr 1.4.2 → 1.5.0
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/README.md +25 -0
- package/package.json +7 -2
- package/skills/zephyr-core/LICENSE +201 -0
- package/skills/zephyr-core/README.md +13 -0
- package/skills/zephyr-core/SKILL.md +77 -0
- package/skills/zephyr-core/references/deployment-model.md +123 -0
- package/skills/zephyr-core/references/docs-map.md +27 -0
- package/skills/zephyr-core/references/env-vars.md +75 -0
- package/skills/zephyr-core/references/examples-resume.md +81 -0
- package/skills/zephyr-core/references/sdk-setup.md +166 -0
- package/skills/zephyr-core/references/troubleshooting.md +48 -0
- package/skills/zephyr-module-federation/LICENSE +201 -0
- package/skills/zephyr-module-federation/README.md +12 -0
- package/skills/zephyr-module-federation/SKILL.md +62 -0
- package/skills/zephyr-module-federation/references/docs-map.md +10 -0
- package/skills/zephyr-module-federation/references/examples.md +33 -0
- package/skills/zephyr-module-federation/references/gotchas.md +54 -0
- package/skills/zephyr-module-federation/references/remote-resolution.md +98 -0
- package/skills/zephyr-module-federation/references/setup-patterns.md +128 -0
- package/skills/zephyr-vite/SKILL.md +110 -0
- package/skills/zephyr-vite/references/build-lifecycle.md +70 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# SDK Setup
|
|
2
|
+
|
|
3
|
+
Use this file when the user asks how to add Zephyr to a frontend project, which SDK/plugin to install, or whether `with-zephyr` can wire up an existing app.
|
|
4
|
+
|
|
5
|
+
## Fastest path
|
|
6
|
+
|
|
7
|
+
For an existing app, start with the codemod:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
curl -fsSL https://with.zephyr-cloud.io | node
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Other launch forms:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx with-zephyr
|
|
17
|
+
yarn dlx with-zephyr
|
|
18
|
+
pnpx with-zephyr
|
|
19
|
+
bunx with-zephyr
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Why: the codemod detects the stack and makes the smallest setup change for supported bundlers/frameworks.
|
|
23
|
+
|
|
24
|
+
## Minimal prerequisites
|
|
25
|
+
|
|
26
|
+
- A Zephyr account or org/app access path
|
|
27
|
+
- A git repository with a remote, branch, and commit
|
|
28
|
+
- A supported Zephyr SDK path, or a build output directory for `zephyr-agent`
|
|
29
|
+
|
|
30
|
+
## What happens after `with-zephyr`
|
|
31
|
+
|
|
32
|
+
- It detects the stack and usually adds the matching Zephyr integration to the project config.
|
|
33
|
+
- It may add or update the relevant build config file for the bundler/framework.
|
|
34
|
+
- The next step is normally just to run the app's build command.
|
|
35
|
+
- After a successful Zephyr-enabled build, look for the version URL in the build output/logs.
|
|
36
|
+
|
|
37
|
+
## SDK picker
|
|
38
|
+
|
|
39
|
+
Use the official picker doc first:
|
|
40
|
+
|
|
41
|
+
- Docs page: `https://docs.zephyr-cloud.io/getting-started/find-your-sdk`
|
|
42
|
+
- Raw markdown: `https://docs.zephyr-cloud.io/getting-started/find-your-sdk.md`
|
|
43
|
+
- Source: `https://docs.zephyr-cloud.io/getting-started/find-your-sdk.md`
|
|
44
|
+
|
|
45
|
+
Current mapping:
|
|
46
|
+
|
|
47
|
+
| Stack | SDK |
|
|
48
|
+
| ----------------- | ----------------------------------- |
|
|
49
|
+
| Vite | `vite-plugin-zephyr` |
|
|
50
|
+
| Webpack | `zephyr-webpack-plugin` |
|
|
51
|
+
| Rspack | `zephyr-rspack-plugin` |
|
|
52
|
+
| Rsbuild / Rslib | `zephyr-rsbuild-plugin` |
|
|
53
|
+
| Rollup | `rollup-plugin-zephyr` |
|
|
54
|
+
| Rolldown | `zephyr-rolldown-plugin` |
|
|
55
|
+
| Parcel | `parcel-reporter-zephyr` |
|
|
56
|
+
| Metro | `zephyr-metro-plugin` |
|
|
57
|
+
| Re.Pack | `zephyr-repack-plugin` |
|
|
58
|
+
| Astro | `zephyr-astro-integration` |
|
|
59
|
+
| Modern.js | `zephyr-modernjs-plugin` |
|
|
60
|
+
| Nitro v3 | built-in `preset: 'zephyr'` |
|
|
61
|
+
| Nuxt | `zephyr-nuxt-module` |
|
|
62
|
+
| Rspress | `zephyr-rspress-plugin` |
|
|
63
|
+
| Ember.js via Vite | `vite-plugin-zephyr` |
|
|
64
|
+
| TanStack Start | `vite-plugin-tanstack-start-zephyr` |
|
|
65
|
+
| Vinext | `vite-plugin-vinext-zephyr` |
|
|
66
|
+
|
|
67
|
+
Fallback for unsupported stacks:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { uploadOutputToZephyr } from 'zephyr-agent';
|
|
71
|
+
|
|
72
|
+
await uploadOutputToZephyr({
|
|
73
|
+
rootDir: process.cwd(),
|
|
74
|
+
outputDir: '.output',
|
|
75
|
+
ssr: true,
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For a build command or prebuilt directory without a bundler integration, the
|
|
80
|
+
`zephyr-cli` package wraps the command and uploads its output:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
ze-cli pnpm build
|
|
84
|
+
ze-cli deploy ./dist
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Use these fallbacks when there is no official Zephyr SDK for the stack, but the project still produces a deployable output directory. They are the low-level integration paths for custom frameworks and internal tooling.
|
|
88
|
+
|
|
89
|
+
Minimum assumption: Zephyr still needs a real built output directory and enough app/build context to upload it correctly.
|
|
90
|
+
|
|
91
|
+
## Smallest working examples
|
|
92
|
+
|
|
93
|
+
Vite:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { defineConfig } from 'vite';
|
|
97
|
+
import react from '@vitejs/plugin-react';
|
|
98
|
+
import { withZephyr } from 'vite-plugin-zephyr';
|
|
99
|
+
|
|
100
|
+
export default defineConfig({
|
|
101
|
+
plugins: [react(), withZephyr()],
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Source example: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/bundlers/react-vite/vite.config.ts`
|
|
106
|
+
|
|
107
|
+
Rspack:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import { defineConfig } from '@rspack/cli';
|
|
111
|
+
import { withZephyr } from 'zephyr-rspack-plugin';
|
|
112
|
+
|
|
113
|
+
const config = defineConfig({
|
|
114
|
+
entry: { main: './src/main.tsx' },
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export default withZephyr()(config);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Source example: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/bundlers/react-rspack/rspack.config.ts`
|
|
121
|
+
|
|
122
|
+
TanStack Start:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import { withZephyr } from 'vite-plugin-tanstack-start-zephyr';
|
|
126
|
+
|
|
127
|
+
plugins: [tanstackStart(), viteReact(), withZephyr()];
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Source example: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/frameworks/tanstack-start/vite.config.ts`
|
|
131
|
+
|
|
132
|
+
Astro:
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
import { defineConfig } from 'astro/config';
|
|
136
|
+
import { withZephyr } from 'zephyr-astro-integration';
|
|
137
|
+
|
|
138
|
+
export default defineConfig({
|
|
139
|
+
integrations: [mdx(), sitemap(), withZephyr()],
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Source example: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/frameworks/astro/astro.config.mjs`
|
|
144
|
+
|
|
145
|
+
## Important setup notes
|
|
146
|
+
|
|
147
|
+
- Plugin placement is stack-specific, not globally “always last”.
|
|
148
|
+
- Nx compose-plugin setups usually put Zephyr last in the composition.
|
|
149
|
+
- Vite Module Federation and framework-specific integrations can require a specific order; verify against the stack docs/example before moving plugins around.
|
|
150
|
+
- For existing apps, prefer the codemod before hand-editing configs.
|
|
151
|
+
- Git context matters for deployment identity: repo, branch, and commit need to exist.
|
|
152
|
+
- If docs disagree on Rspack naming, prefer `zephyr-rspack-plugin` from the SDK picker and examples.
|
|
153
|
+
|
|
154
|
+
## Important availability caveats
|
|
155
|
+
|
|
156
|
+
- Astro integration is static-only. Do not present it as a general SSR deployment path.
|
|
157
|
+
- Nitro v3, Nuxt, and TanStack Start SSR-style paths are currently constrained to Zephyr's managed Cloudflare path in the public docs.
|
|
158
|
+
- If the user needs unsupported SSR behavior or a custom runtime, verify whether `zephyr-agent` output upload is a better fit than an official framework SDK.
|
|
159
|
+
|
|
160
|
+
## Best docs to link
|
|
161
|
+
|
|
162
|
+
- Quick start: `https://docs.zephyr-cloud.io/getting-started/quick-start.md`
|
|
163
|
+
- SDK picker: `https://docs.zephyr-cloud.io/getting-started/find-your-sdk.md`
|
|
164
|
+
- Existing app integration: `https://docs.zephyr-cloud.io/integrations/existing-app.md`
|
|
165
|
+
- Vite: `https://docs.zephyr-cloud.io/bundlers/vite.md`
|
|
166
|
+
- llms index: `https://docs.zephyr-cloud.io/llms.txt`
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Use this file for common Zephyr setup and build failures.
|
|
4
|
+
|
|
5
|
+
## First checks
|
|
6
|
+
|
|
7
|
+
- Confirm the stack is using the right SDK/plugin.
|
|
8
|
+
- Confirm the project is a git repo with a remote, branch, and commit.
|
|
9
|
+
- Confirm the user is authenticated and has access to the target app/org.
|
|
10
|
+
- Confirm the Zephyr integration is attached to the actual build config being executed.
|
|
11
|
+
|
|
12
|
+
## Common failure classes
|
|
13
|
+
|
|
14
|
+
### Wrong plugin for the stack
|
|
15
|
+
|
|
16
|
+
- Vite -> `vite-plugin-zephyr`
|
|
17
|
+
- Rspack -> `zephyr-rspack-plugin`
|
|
18
|
+
- Webpack -> `zephyr-webpack-plugin`
|
|
19
|
+
- TanStack Start, Vinext, Astro, Rspress, Nuxt, Nitro -> prefer their dedicated integration paths
|
|
20
|
+
|
|
21
|
+
### Git context missing
|
|
22
|
+
|
|
23
|
+
Common symptoms:
|
|
24
|
+
|
|
25
|
+
- app identity cannot be resolved
|
|
26
|
+
- build ID / auth / application UID errors
|
|
27
|
+
- deployment metadata is incomplete
|
|
28
|
+
|
|
29
|
+
### Auth/access mismatch
|
|
30
|
+
|
|
31
|
+
Common symptoms:
|
|
32
|
+
|
|
33
|
+
- login succeeds locally but deploy cannot write
|
|
34
|
+
- CI token works for one org/app but not another
|
|
35
|
+
- build accepts config but publish fails later
|
|
36
|
+
|
|
37
|
+
### Docs drift to call out
|
|
38
|
+
|
|
39
|
+
- If Rspack docs and examples disagree, prefer `zephyr-rspack-plugin` from the SDK picker and examples.
|
|
40
|
+
- Public docs around status names have some drift; keep answers focused on immutable versions plus mutable routing targets.
|
|
41
|
+
|
|
42
|
+
## Good error docs
|
|
43
|
+
|
|
44
|
+
- Error index: `https://docs.zephyr-cloud.io/errors.md`
|
|
45
|
+
- Git remote missing: `https://docs.zephyr-cloud.io/errors/ze10014.md`
|
|
46
|
+
- Git config missing: `https://docs.zephyr-cloud.io/errors/ze10016.md`
|
|
47
|
+
- Auth error: `https://docs.zephyr-cloud.io/errors/ze10018.md`
|
|
48
|
+
- Build ID failure: `https://docs.zephyr-cloud.io/errors/ze10019.md`
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026-present Zephyr Cloud and contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# zephyr-module-federation
|
|
2
|
+
|
|
3
|
+
Skill for Zephyr Module Federation setup and remote resolution workflows.
|
|
4
|
+
|
|
5
|
+
Includes:
|
|
6
|
+
|
|
7
|
+
- `SKILL.md` for the main trigger and workflow
|
|
8
|
+
- `references/setup-patterns.md` for host/remote config patterns
|
|
9
|
+
- `references/remote-resolution.md` for `zephyr:dependencies` and selector behavior
|
|
10
|
+
- `references/examples.md` for working example paths
|
|
11
|
+
- `references/gotchas.md` for common MF issues
|
|
12
|
+
- `references/docs-map.md` for deeper docs links
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zephyr-module-federation
|
|
3
|
+
description: Use when the user asks about zephyr:dependencies, hosts/remotes, Module Federation build order, remote resolution, cross-bundler remotes, or monorepo MF on Zephyr.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
author: Zephyr Cloud IO
|
|
7
|
+
purpose: Use when the user asks about zephyr:dependencies, hosts/remotes, Module Federation build order, remote resolution, cross-bundler remotes, or monorepo MF on Zephyr.
|
|
8
|
+
domain: federation
|
|
9
|
+
type: core
|
|
10
|
+
sources:
|
|
11
|
+
- ZephyrCloudIO/zephyr-packages:**/skills/zephyr-module-federation/references/*.md
|
|
12
|
+
- ZephyrCloudIO/zephyr-packages:**/scripts/sync-package-skills.mjs
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Zephyr Module Federation
|
|
16
|
+
|
|
17
|
+
Use this skill for Zephyr's Module Federation workflow: host/remote setup, `zephyr:dependencies`, resolution behavior, build order, and cross-bundler examples.
|
|
18
|
+
|
|
19
|
+
Module Federation is the pattern where a host app loads code from separately built remote apps at runtime.
|
|
20
|
+
|
|
21
|
+
Zephyr does not replace normal Module Federation config; it adds deploy-time dependency resolution and routing on top of the host/remote setup.
|
|
22
|
+
|
|
23
|
+
Use this skill when the user needs help wiring, resolving, or deploying hosts/remotes. Use `zephyr-core` when the question is mostly about general Zephyr setup, version URLs, tags/environments, or public env vars.
|
|
24
|
+
|
|
25
|
+
## What to cover
|
|
26
|
+
|
|
27
|
+
- Explain both layers: bundler MF config and Zephyr dependency mapping.
|
|
28
|
+
- Prefer concrete examples over abstract theory.
|
|
29
|
+
- Keep the answer grounded in the user's stack: Webpack, Rspack, Vite, Rsbuild, Turbo, Nx, or mixed-bundler.
|
|
30
|
+
- If the question is mostly about general Zephyr setup, version URLs, tags/envs, or public env vars, also read `../zephyr-core/SKILL.md`.
|
|
31
|
+
- Localhost remote URLs in examples are for local development only; deployed answers should steer toward Zephyr resolution instead of hardcoded production URLs.
|
|
32
|
+
|
|
33
|
+
## Core mental model
|
|
34
|
+
|
|
35
|
+
- Module Federation defines host/remote wiring in bundler config.
|
|
36
|
+
- Zephyr adds deploy-time dependency resolution through `zephyr:dependencies`.
|
|
37
|
+
- `workspace:*` is the most important Zephyr-specific dev workflow for coordinated branch/user/CI resolution.
|
|
38
|
+
- Remotes usually need to be built before hosts.
|
|
39
|
+
- Names must stay consistent across `package.json`, MF config, and dependency declarations.
|
|
40
|
+
|
|
41
|
+
## Answer flow
|
|
42
|
+
|
|
43
|
+
1. Read `references/setup-patterns.md` for host/remote config shapes.
|
|
44
|
+
2. Read `references/remote-resolution.md` for `zephyr:dependencies`, selectors, and `workspace:*`.
|
|
45
|
+
3. Read `references/examples.md` for concrete file paths and snippets.
|
|
46
|
+
4. Read `references/gotchas.md` for build order, naming, and mixed-bundler edge cases.
|
|
47
|
+
5. Link deeper docs from `references/docs-map.md`.
|
|
48
|
+
|
|
49
|
+
## Source priorities
|
|
50
|
+
|
|
51
|
+
- Public docs source: `https://docs.zephyr-cloud.io`
|
|
52
|
+
- Examples source: `https://github.com/ZephyrCloudIO/zephyr-examples`
|
|
53
|
+
- Docs site: `https://docs.zephyr-cloud.io`
|
|
54
|
+
- Raw docs path pattern: `https://docs.zephyr-cloud.io/<path>.md`
|
|
55
|
+
- Docs index: `https://docs.zephyr-cloud.io/llms.txt`
|
|
56
|
+
|
|
57
|
+
## Guardrails
|
|
58
|
+
|
|
59
|
+
- Do not treat `zephyr:dependencies` as a replacement for MF config; it complements it.
|
|
60
|
+
- Do not recommend hardcoded production remote URLs when Zephyr resolution should be used.
|
|
61
|
+
- Do not ignore build order for remotes and hosts.
|
|
62
|
+
- Call out naming mismatches early; they are a common failure source.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Docs Map
|
|
2
|
+
|
|
3
|
+
## Best first links
|
|
4
|
+
|
|
5
|
+
- MF guide: `https://docs.zephyr-cloud.io/tutorials/mf-guide.md`
|
|
6
|
+
- Remote dependencies: `https://docs.zephyr-cloud.io/features/remote-dependencies.md`
|
|
7
|
+
- Multi-bundler integration: `https://docs.zephyr-cloud.io/integrations/vite-rspack-webpack-mf.md`
|
|
8
|
+
- Versions: `https://docs.zephyr-cloud.io/features/versions.md`
|
|
9
|
+
- Tags & environments: `https://docs.zephyr-cloud.io/features/tags-environments.md`
|
|
10
|
+
- Docs index: `https://docs.zephyr-cloud.io/llms.txt`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Use this file when the user wants concrete working MF examples to copy from.
|
|
4
|
+
|
|
5
|
+
## Best examples
|
|
6
|
+
|
|
7
|
+
- Webpack host/remote: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/module-federation/react-webpack`
|
|
8
|
+
- Rsbuild consumer/provider: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/module-federation/react-rsbuild`
|
|
9
|
+
- Cross-bundler host + remotes: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/module-federation/react-vite-rspack-webpack`
|
|
10
|
+
- Advanced staged builds: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/module-federation/tractor-sample`
|
|
11
|
+
- Turborepo monorepo MF: `https://github.com/ZephyrCloudIO/zephyr-examples/tree/main/build-systems/turborepo-rspack-mf`
|
|
12
|
+
|
|
13
|
+
## Strong snippets
|
|
14
|
+
|
|
15
|
+
### Cross-bundler Vite host
|
|
16
|
+
|
|
17
|
+
File: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/module-federation/react-vite-rspack-webpack/host/vite.config.ts`
|
|
18
|
+
|
|
19
|
+
- Good for showing remote `type: 'module'` vs `type: 'var'`
|
|
20
|
+
- Good for showing `withZephyr({ mfConfig })`
|
|
21
|
+
|
|
22
|
+
### Host dependency mapping
|
|
23
|
+
|
|
24
|
+
File: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/module-federation/react-vite-rspack-webpack/host/package.json`
|
|
25
|
+
|
|
26
|
+
- Good for `workspace:*` mapping
|
|
27
|
+
|
|
28
|
+
### Turborepo build-order explanation
|
|
29
|
+
|
|
30
|
+
File: `https://github.com/ZephyrCloudIO/zephyr-examples/blob/main/build-systems/turborepo-rspack-mf/README.md`
|
|
31
|
+
|
|
32
|
+
- Good for explaining why remotes should build before host
|
|
33
|
+
- Good for monorepo orchestration answers
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Gotchas
|
|
2
|
+
|
|
3
|
+
Use this file when the user is stuck or their MF setup looks valid but still fails.
|
|
4
|
+
|
|
5
|
+
## Common issues
|
|
6
|
+
|
|
7
|
+
### Remotes built after host
|
|
8
|
+
|
|
9
|
+
- Zephyr usually needs remotes available first to resolve them cleanly.
|
|
10
|
+
- In cyclic setups, users may need a staged build process.
|
|
11
|
+
|
|
12
|
+
### Naming mismatch
|
|
13
|
+
|
|
14
|
+
Keep names aligned across:
|
|
15
|
+
|
|
16
|
+
- remote `package.json` `name`
|
|
17
|
+
- MF config `name`
|
|
18
|
+
- host remotes keys / import names
|
|
19
|
+
- `zephyr:dependencies` keys and targets
|
|
20
|
+
|
|
21
|
+
If these drift, resolution and runtime loading become fragile fast.
|
|
22
|
+
|
|
23
|
+
### Mixed-bundler remote type mismatch
|
|
24
|
+
|
|
25
|
+
- Vite module remotes often use `type: 'module'`
|
|
26
|
+
- Webpack/Rspack-style remotes may use `type: 'var'`
|
|
27
|
+
- If the user picks the wrong type, the host may fail to load the remote at runtime even if the deploy succeeded.
|
|
28
|
+
|
|
29
|
+
### Vite-specific MF caveats
|
|
30
|
+
|
|
31
|
+
- Plugin order can matter in Vite MF setups; do not assume Zephyr should always be the last plugin.
|
|
32
|
+
- `build.target` may need to account for top-level await support in MF setups.
|
|
33
|
+
- `modulePreload` behavior can matter for cross-bundler Vite setups.
|
|
34
|
+
- Use the Zephyr Vite MF docs/examples when debugging these issues rather than generic plugin-order guesses.
|
|
35
|
+
|
|
36
|
+
### Hardcoded URLs left in place
|
|
37
|
+
|
|
38
|
+
- Hardcoded localhost URLs are fine for local example configs.
|
|
39
|
+
- For Zephyr answers, steer the user toward Zephyr dependency resolution rather than manually swapping production remote URLs.
|
|
40
|
+
|
|
41
|
+
### Git and access still matter
|
|
42
|
+
|
|
43
|
+
- MF setup can be correct while deployment still fails because git context or app access is missing.
|
|
44
|
+
|
|
45
|
+
### Missing remote build
|
|
46
|
+
|
|
47
|
+
- `workspace:*` falls back to the latest published version of the remote when no matching workspace build exists, so it still fails if the remote has never been published.
|
|
48
|
+
- If resolution fails, check that the remote was built and published first. Other selectors have no such fallback and need a matching tag, environment, or version.
|
|
49
|
+
|
|
50
|
+
## Quick diagnostic flow
|
|
51
|
+
|
|
52
|
+
1. If the host cannot find the remote at all, check naming alignment first.
|
|
53
|
+
2. If naming is correct but Zephyr cannot resolve the remote target, check selector choice and whether the remote was built into a resolvable environment.
|
|
54
|
+
3. If resolution succeeds but runtime loading still breaks, check remote `type`, Vite MF caveats, and bundler compatibility.
|