zephyr-rspack-plugin 0.0.49 → 0.0.51

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 CHANGED
@@ -1,23 +1,37 @@
1
- # zephyr-rspack-plugin
1
+ # Zephyr Rspack Plugin
2
2
 
3
3
  <div align="center">
4
4
 
5
- [Zephyr Cloud](https://zephyr-cloud.io) | [Zephyr Docs](https://docs.zephyr-cloud.io/recipes/rspack-react) | [Rspack Docs](https://rspack.dev) | [Discord](https://zephyr-cloud.io/discord) | [Twitter](https://x.com/ZephyrCloudIO) | [LinkedIn](https://www.linkedin.com/company/zephyr-cloud/)
5
+ [Zephyr Cloud](https://zephyr-cloud.io) | [Zephyr Docs](https://docs.zephyr-cloud.io/recipes/rspack-react) | [Discord](https://zephyr-cloud.io/discord) | [Twitter](https://x.com/ZephyrCloudIO) | [LinkedIn](https://www.linkedin.com/company/zephyr-cloud/)
6
6
 
7
7
  <hr/>
8
+ <img src="https://cdn.prod.website-files.com/669061ee3adb95b628c3acda/66981c766e352fe1f57191e2_Opengraph-zephyr.png" alt="Zephyr Logo" />
8
9
  </div>
9
10
 
10
- `zephyr-rspack-plugin` is a plugin to deploy application built with [Rspack](https://rspack.dev). Read more from our documentation [here](https://docs.zephyr-cloud.io/recipes/react-rspack-nx).
11
+ An Rspack plugin for deploying applications with Zephyr Cloud. This plugin integrates seamlessly with Rspack's fast bundling to enable deployment of your applications with Module Federation support. Read more from our documentation [here](https://docs.zephyr-cloud.io/recipes/react-rspack-nx).
11
12
 
12
- ## Installation
13
+ ## Get Started
14
+
15
+ The fastest way to get started is to use to use `create-zephyr-apps` to generate a new Webpack application with Zephyr integration and choose from various rspack example:
13
16
 
17
+ ```bash
18
+ npx create-zephyr-apps@latest
14
19
  ```
20
+
21
+ For more information please refer to our [documentation](https://docs.zephyr-cloud.io/recipes).
22
+
23
+ ## Installation
24
+
25
+ ```bash
15
26
  # npm
16
27
  npm install --save-dev zephyr-rspack-plugin
28
+
17
29
  # yarn
18
30
  yarn add --dev zephyr-rspack-plugin
31
+
19
32
  # pnpm
20
- pnpm add --dev zephyr-rspack-plugin
33
+ pnpm add --save-dev zephyr-rspack-plugin
34
+
21
35
  # bun
22
36
  bun add --dev zephyr-rspack-plugin
23
37
  ```
@@ -26,21 +40,152 @@ bun add --dev zephyr-rspack-plugin
26
40
 
27
41
  ### With Nx and Rspack
28
42
 
29
- ```
43
+ For Nx projects using Rspack:
44
+
45
+ ```javascript
46
+ // rspack.config.js
47
+ import { composePlugins, withNx } from '@nx/rspack';
48
+ import { withReact } from '@nx/react';
49
+ import { withModuleFederation } from '@nx/rspack/module-federation';
50
+ import { withZephyr } from 'zephyr-rspack-plugin';
51
+
52
+ const mfConfig = {
53
+ name: 'my-app',
54
+ remotes: {
55
+ 'shared-ui': 'shared_ui@http://localhost:3001/remoteEntry.js',
56
+ },
57
+ shared: {
58
+ react: { singleton: true },
59
+ 'react-dom': { singleton: true },
60
+ },
61
+ };
62
+
30
63
  export default composePlugins(
31
64
  withNx(),
32
65
  withReact(),
33
66
  withModuleFederation(mfConfig),
34
- withZephyr(),
67
+ withZephyr(), // Add Zephyr plugin
35
68
  (config) => {
36
69
  return config;
37
70
  }
38
71
  );
39
72
  ```
40
73
 
41
- ### With Rspack directly
74
+ ### With Rspack Directly
75
+
76
+ For standalone Rspack projects:
77
+
78
+ ```javascript
79
+ // rspack.config.js
80
+ const { withZephyr } = require('zephyr-rspack-plugin');
42
81
 
82
+ const config = {
83
+ entry: './src/index.js',
84
+ output: {
85
+ path: path.resolve(__dirname, 'dist'),
86
+ filename: '[name].[contenthash].js',
87
+ },
88
+ // ... other Rspack configuration
89
+ };
90
+
91
+ module.exports = withZephyr()(config);
43
92
  ```
44
- module.exports = withZephyr()(your_rspack_config);
45
93
 
94
+ ### TypeScript Configuration
95
+
96
+ ```typescript
97
+ // rspack.config.ts
98
+ import { Configuration } from '@rspack/core';
99
+ import { withZephyr } from 'zephyr-rspack-plugin';
100
+
101
+ const config: Configuration = {
102
+ entry: './src/index.tsx',
103
+ output: {
104
+ path: path.resolve(__dirname, 'dist'),
105
+ filename: '[name].[contenthash].js',
106
+ },
107
+ // ... other configuration
108
+ };
109
+
110
+ export default withZephyr({
111
+ // Zephyr options
112
+ deploy: true,
113
+ environment: 'production',
114
+ })(config);
46
115
  ```
116
+
117
+ ## Features
118
+
119
+ - 🚀 Fast builds with Rspack'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
+ - 🎯 Nx integration for monorepo support
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 Rspack project
141
+ 2. Add it to your Rspack configuration
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": "rspack serve",
154
+ "build": "rspack build",
155
+ "build:prod": "NODE_ENV=production rspack build"
156
+ }
157
+ }
158
+ ```
159
+
160
+ ## Requirements
161
+
162
+ - Rspack 0.3 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
+ - [rspack-sample-app](../../examples/rspack-sample-app/) - Basic Rspack setup
171
+ - [rspack-mf](../../examples/rspack-mf/) - Module Federation setup with host and remote
172
+ - [rspack-nx-mf](../../examples/rspack-nx-mf/) - Nx workspace with Rspack and Module Federation
173
+
174
+ ## Nx Integration
175
+
176
+ This plugin works seamlessly with Nx workspaces:
177
+
178
+ ```bash
179
+ # Generate a new Rspack app with Module Federation
180
+ nx g @nx/rspack:app my-app --mf=true
181
+
182
+ # Add Zephyr plugin to the generated configuration
183
+ ```
184
+
185
+ ## Contributing
186
+
187
+ We welcome contributions! Please read our [contributing guidelines](../../CONTRIBUTING.md) for more information.
188
+
189
+ ## License
190
+
191
+ Licensed under the Apache-2.0 License. See [LICENSE](LICENSE) for more information.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zephyr-rspack-plugin",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "description": "Repack plugin for Zephyr",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,6 +9,7 @@ class ZeRspackPlugin {
9
9
  }
10
10
  apply(compiler) {
11
11
  this._options.zephyr_engine.buildProperties.output = compiler.outputPath;
12
+ (0, zephyr_xpack_internal_1.detectAndStoreBaseHref)(this._options.zephyr_engine, compiler);
12
13
  (0, zephyr_xpack_internal_1.logBuildSteps)(this._options, compiler);
13
14
  (0, zephyr_xpack_internal_1.setupZeDeploy)(this._options, compiler);
14
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ze-rspack-plugin.js","sourceRoot":"","sources":["../../src/rspack-plugin/ze-rspack-plugin.ts"],"names":[],"mappings":";;;AAGA,iEAAqE;AAGrE,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAapC,MAAa,cAAc;IAGzB,YAAY,OAA8D;QACxE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC;QAEzE,IAAA,qCAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACvC,IAAA,qCAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AAbD,wCAaC"}
1
+ {"version":3,"file":"ze-rspack-plugin.js","sourceRoot":"","sources":["../../src/rspack-plugin/ze-rspack-plugin.ts"],"names":[],"mappings":";;;AAGA,iEAI+B;AAG/B,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAapC,MAAa,cAAc;IAGzB,YAAY,OAA8D;QACxE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC;QACzE,IAAA,8CAAsB,EAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QAC9D,IAAA,qCAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACvC,IAAA,qCAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AAbD,wCAaC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zephyr-rspack-plugin",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "description": "Repack plugin for Zephyr",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,8 +20,8 @@
20
20
  "@rspack/core": "1.2.8",
21
21
  "is-ci": "^4.1.0",
22
22
  "tslib": "^2.8.1",
23
- "zephyr-agent": "0.0.49",
24
- "zephyr-xpack-internal": "0.0.49"
23
+ "zephyr-xpack-internal": "0.0.51",
24
+ "zephyr-agent": "0.0.51"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/is-ci": "3.0.4",