zephyr-rsbuild-plugin 0.0.0-canary-20250902114854
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/LICENSE +39 -0
- package/README.md +193 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +38 -0
- package/dist/rsbuild-plugin/with-zephyr.d.ts +5 -0
- package/dist/rsbuild-plugin/with-zephyr.js +15 -0
- package/dist/rsbuild-plugin/with-zephyr.js.map +1 -0
- package/package.json +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
...
|
|
13
|
+
|
|
14
|
+
END OF TERMS AND CONDITIONS
|
|
15
|
+
|
|
16
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
17
|
+
|
|
18
|
+
To apply the Apache License to your work, attach the following
|
|
19
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
20
|
+
replaced with your own identifying information. (Don't include
|
|
21
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
22
|
+
comment syntax for the file format. We also recommend that a
|
|
23
|
+
file or class name and description of purpose be included on the
|
|
24
|
+
same line as the copyright notice for each file. The "copyright"
|
|
25
|
+
word should be left as is (without quotes).
|
|
26
|
+
|
|
27
|
+
Copyright [2023] [Zephyr Cloud]
|
|
28
|
+
|
|
29
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
30
|
+
you may not use this file except in compliance with the License.
|
|
31
|
+
You may obtain a copy of the License at
|
|
32
|
+
|
|
33
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
34
|
+
|
|
35
|
+
Unless required by applicable law or agreed to in writing, software
|
|
36
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
37
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
38
|
+
See the License for the specific language governing permissions and
|
|
39
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Zephyr Rsbuild Plugin
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
[Zephyr Cloud](https://zephyr-cloud.io) | [Zephyr Docs](https://docs.zephyr-cloud.io/recipes/rsbuild-react) | [Discord](https://zephyr-cloud.io/discord) | [Twitter](https://x.com/ZephyrCloudIO) | [LinkedIn](https://www.linkedin.com/company/zephyr-cloud/)
|
|
6
|
+
|
|
7
|
+
<hr/>
|
|
8
|
+
<img src="https://cdn.prod.website-files.com/669061ee3adb95b628c3acda/66981c766e352fe1f57191e2_Opengraph-zephyr.png" alt="Zephyr Logo" />
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
An Rsbuild plugin for deploying applications with Zephyr Cloud. This plugin integrates seamlessly with Rsbuild's fast bundling to enable deployment of your applications with Module Federation support.
|
|
12
|
+
|
|
13
|
+
## Get Started
|
|
14
|
+
|
|
15
|
+
The fastest way to get started is to use `create-zephyr-apps` to generate a new Rsbuild application with Zephyr integration:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx create-zephyr-apps@latest
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
For more information please refer to our [documentation](https://docs.zephyr-cloud.io/recipes).
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# npm
|
|
27
|
+
npm install --save-dev zephyr-rsbuild-plugin
|
|
28
|
+
|
|
29
|
+
# yarn
|
|
30
|
+
yarn add --dev zephyr-rsbuild-plugin
|
|
31
|
+
|
|
32
|
+
# pnpm
|
|
33
|
+
pnpm add --save-dev zephyr-rsbuild-plugin
|
|
34
|
+
|
|
35
|
+
# bun
|
|
36
|
+
bun add --dev zephyr-rsbuild-plugin
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
### Basic Setup
|
|
42
|
+
|
|
43
|
+
Add the plugin to your Rsbuild configuration:
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
// rsbuild.config.js
|
|
47
|
+
import { defineConfig } from '@rsbuild/core';
|
|
48
|
+
import { pluginReact } from '@rsbuild/plugin-react';
|
|
49
|
+
import { withZephyr } from 'zephyr-rsbuild-plugin';
|
|
50
|
+
|
|
51
|
+
export default defineConfig({
|
|
52
|
+
plugins: [
|
|
53
|
+
pluginReact(),
|
|
54
|
+
withZephyr(), // Add Zephyr plugin
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### With Options
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
// rsbuild.config.js
|
|
63
|
+
import { defineConfig } from '@rsbuild/core';
|
|
64
|
+
import { pluginReact } from '@rsbuild/plugin-react';
|
|
65
|
+
import { withZephyr } from 'zephyr-rsbuild-plugin';
|
|
66
|
+
|
|
67
|
+
export default defineConfig({
|
|
68
|
+
plugins: [
|
|
69
|
+
pluginReact(),
|
|
70
|
+
withZephyr({
|
|
71
|
+
wait_for_index_html: true, // Wait for HTML processing
|
|
72
|
+
}),
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### TypeScript Configuration
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
// rsbuild.config.ts
|
|
81
|
+
import { defineConfig } from '@rsbuild/core';
|
|
82
|
+
import { pluginReact } from '@rsbuild/plugin-react';
|
|
83
|
+
import { withZephyr } from 'zephyr-rsbuild-plugin';
|
|
84
|
+
|
|
85
|
+
export default defineConfig({
|
|
86
|
+
plugins: [pluginReact(), withZephyr()],
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### With Module Federation
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// rsbuild.config.ts
|
|
94
|
+
import { defineConfig } from '@rsbuild/core';
|
|
95
|
+
import { pluginReact } from '@rsbuild/plugin-react';
|
|
96
|
+
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin';
|
|
97
|
+
import { withZephyr } from 'zephyr-rsbuild-plugin';
|
|
98
|
+
|
|
99
|
+
export default defineConfig({
|
|
100
|
+
plugins: [
|
|
101
|
+
pluginReact(),
|
|
102
|
+
pluginModuleFederation({
|
|
103
|
+
name: 'my-app',
|
|
104
|
+
remotes: {
|
|
105
|
+
'shared-ui': 'shared_ui@http://localhost:3001/remoteEntry.js',
|
|
106
|
+
},
|
|
107
|
+
shared: {
|
|
108
|
+
react: { singleton: true },
|
|
109
|
+
'react-dom': { singleton: true },
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
withZephyr(), // Add after Module Federation
|
|
113
|
+
],
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Features
|
|
118
|
+
|
|
119
|
+
- 🚀 Fast builds with Rsbuild's Rust-based bundler
|
|
120
|
+
- 🏗️ Full Module Federation support
|
|
121
|
+
- 📦 Automatic asset optimization and caching
|
|
122
|
+
- 🔧 Zero-config setup for simple applications
|
|
123
|
+
- 📊 Build analytics and monitoring
|
|
124
|
+
- 🌐 Global CDN distribution
|
|
125
|
+
- ⚡ Hot module replacement in development
|
|
126
|
+
- 🎯 Simple plugin integration
|
|
127
|
+
|
|
128
|
+
## Module Federation Support
|
|
129
|
+
|
|
130
|
+
This plugin provides comprehensive Module Federation support:
|
|
131
|
+
|
|
132
|
+
- **Host Applications**: Consume remote modules from other applications
|
|
133
|
+
- **Remote Applications**: Expose modules for consumption by host applications
|
|
134
|
+
- **Shared Dependencies**: Efficient sharing of common libraries
|
|
135
|
+
- **Dynamic Imports**: Runtime loading of remote modules
|
|
136
|
+
- **Automatic Vendor Federation**: Smart dependency sharing
|
|
137
|
+
|
|
138
|
+
## Getting Started
|
|
139
|
+
|
|
140
|
+
1. Install the plugin in your Rsbuild project
|
|
141
|
+
2. Add it to your Rsbuild configuration plugins array
|
|
142
|
+
3. Configure Module Federation (if needed) for microfrontends
|
|
143
|
+
4. Build your application with `npm run build`
|
|
144
|
+
5. Your app will be automatically deployed to Zephyr Cloud
|
|
145
|
+
|
|
146
|
+
## Build Scripts
|
|
147
|
+
|
|
148
|
+
Add these scripts to your `package.json`:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"scripts": {
|
|
153
|
+
"dev": "rsbuild dev",
|
|
154
|
+
"build": "rsbuild build",
|
|
155
|
+
"preview": "rsbuild preview"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Requirements
|
|
161
|
+
|
|
162
|
+
- Rsbuild 1.0 or higher
|
|
163
|
+
- Node.js 18 or higher
|
|
164
|
+
- Zephyr Cloud account (sign up at [zephyr-cloud.io](https://zephyr-cloud.io))
|
|
165
|
+
|
|
166
|
+
## Examples
|
|
167
|
+
|
|
168
|
+
Check out our [examples directory](../../examples/) for complete working examples:
|
|
169
|
+
|
|
170
|
+
- [rsbuild-sample-app](../../examples/rsbuild-sample-app/) - Basic Rsbuild setup with Zephyr
|
|
171
|
+
|
|
172
|
+
## API Reference
|
|
173
|
+
|
|
174
|
+
### withZephyr(options?)
|
|
175
|
+
|
|
176
|
+
Creates an Rsbuild plugin for Zephyr integration.
|
|
177
|
+
|
|
178
|
+
#### Parameters
|
|
179
|
+
|
|
180
|
+
- `options` (optional): Configuration options
|
|
181
|
+
- `wait_for_index_html?: boolean` - Wait for HTML processing before deployment
|
|
182
|
+
|
|
183
|
+
#### Returns
|
|
184
|
+
|
|
185
|
+
An Rsbuild plugin that can be added to the plugins array.
|
|
186
|
+
|
|
187
|
+
## Contributing
|
|
188
|
+
|
|
189
|
+
We welcome contributions! Please read our [contributing guidelines](../../CONTRIBUTING.md) for more information.
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache-2.0 License. See [LICENSE](LICENSE) for more information.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveIndexHtml = exports.onDeploymentDone = exports.withZephyr = void 0;
|
|
4
|
+
var with_zephyr_1 = require("./rsbuild-plugin/with-zephyr");
|
|
5
|
+
Object.defineProperty(exports, "withZephyr", { enumerable: true, get: function () { return with_zephyr_1.withZephyr; } });
|
|
6
|
+
var zephyr_rspack_plugin_1 = require("zephyr-rspack-plugin");
|
|
7
|
+
Object.defineProperty(exports, "onDeploymentDone", { enumerable: true, get: function () { return zephyr_rspack_plugin_1.onDeploymentDone; } });
|
|
8
|
+
Object.defineProperty(exports, "resolveIndexHtml", { enumerable: true, get: function () { return zephyr_rspack_plugin_1.resolveIndexHtml; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,4DAA0D;AAAjD,yGAAA,UAAU,OAAA;AAEnB,6DAA0E;AAAjE,wHAAA,gBAAgB,OAAA;AAAE,wHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zephyr-rsbuild-plugin",
|
|
3
|
+
"version": "0.0.57",
|
|
4
|
+
"description": "Rsbuild plugin for Zephyr",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
|
|
8
|
+
"directory": "libs/zephyr-rsbuild-plugin"
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "ZephyrCloudIO",
|
|
13
|
+
"url": "https://github.com/ZephyrCloudIO"
|
|
14
|
+
},
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "nx run zephyr-rsbuild-plugin:build",
|
|
20
|
+
"patch-version": "pnpm version"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@rsbuild/core": "^1.3.22",
|
|
24
|
+
"zephyr-rspack-plugin": "workspace:*"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/jest": "catalog:typescript",
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "catalog:eslint",
|
|
29
|
+
"ts-jest": "catalog:typescript"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@rsbuild/core": ">=1.0.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public",
|
|
36
|
+
"provenance": true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withZephyr = withZephyr;
|
|
4
|
+
const zephyr_rspack_plugin_1 = require("zephyr-rspack-plugin");
|
|
5
|
+
function withZephyr(options) {
|
|
6
|
+
return {
|
|
7
|
+
name: 'zephyr-rsbuild-plugin',
|
|
8
|
+
setup(api) {
|
|
9
|
+
api.modifyRspackConfig(async (config) => {
|
|
10
|
+
return await (0, zephyr_rspack_plugin_1.withZephyr)(options)(config);
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=with-zephyr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-zephyr.js","sourceRoot":"","sources":["../../src/rsbuild-plugin/with-zephyr.ts"],"names":[],"mappings":";;AAOA,gCASC;AAfD,+DAAsE;AAMtE,SAAgB,UAAU,CAAC,OAAoC;IAC7D,OAAO;QACL,IAAI,EAAE,uBAAuB;QAC7B,KAAK,CAAC,GAAG;YACP,GAAG,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBACtC,OAAO,MAAM,IAAA,iCAAgB,EAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;YACjD,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zephyr-rsbuild-plugin",
|
|
3
|
+
"version": "0.0.0-canary-20250902114854",
|
|
4
|
+
"description": "Rsbuild plugin for Zephyr",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
|
|
8
|
+
"directory": "libs/zephyr-rsbuild-plugin"
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"author": {
|
|
12
|
+
"name": "ZephyrCloudIO",
|
|
13
|
+
"url": "https://github.com/ZephyrCloudIO"
|
|
14
|
+
},
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@rsbuild/core": "^1.3.22",
|
|
20
|
+
"zephyr-rspack-plugin": "0.0.0-canary-20250902114854"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/jest": "29.5.14",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
|
25
|
+
"ts-jest": "^29.2.6"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@rsbuild/core": ">=1.0.0"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"provenance": true
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "nx run zephyr-rsbuild-plugin:build",
|
|
36
|
+
"patch-version": "pnpm version"
|
|
37
|
+
}
|
|
38
|
+
}
|