zephyr-webpack-plugin 0.0.49 → 0.0.50

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,44 +1,271 @@
1
- # zephyr-webpack-plugin
1
+ # Zephyr Webpack 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) | [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
 
11
+ A Webpack plugin for deploying applications with Zephyr Cloud. This plugin integrates seamlessly with Webpack's ecosystem to enable deployment of your applications with comprehensive Module Federation support.
12
+
10
13
  ## Installation
11
14
 
12
- ```
15
+ ```bash
13
16
  # npm
14
17
  npm install --save-dev zephyr-webpack-plugin
18
+
15
19
  # yarn
16
20
  yarn add --dev zephyr-webpack-plugin
21
+
17
22
  # pnpm
18
23
  pnpm add --dev zephyr-webpack-plugin
24
+
19
25
  # bun
20
26
  bun add --dev zephyr-webpack-plugin
21
27
  ```
22
28
 
23
29
  ## Usage
24
30
 
25
- ### With Nx, Webpack or Rspack
31
+ ### With Nx and Webpack
32
+
33
+ For Nx projects using Webpack:
34
+
35
+ ```javascript
36
+ // webpack.config.js
37
+ import { composePlugins, withNx } from '@nx/webpack';
38
+ import { withReact } from '@nx/react';
39
+ import { withModuleFederation } from '@nx/webpack/module-federation';
40
+ import { withZephyr } from 'zephyr-webpack-plugin';
41
+
42
+ const mfConfig = {
43
+ name: 'my-app',
44
+ remotes: {
45
+ 'shared-ui': 'shared_ui@http://localhost:3001/remoteEntry.js',
46
+ },
47
+ shared: {
48
+ react: { singleton: true },
49
+ 'react-dom': { singleton: true },
50
+ },
51
+ };
26
52
 
27
- ```
28
53
  export default composePlugins(
29
54
  withNx(),
30
55
  withReact(),
31
56
  withModuleFederation(mfConfig),
32
- withZephyr(),
57
+ withZephyr(), // Add Zephyr plugin
33
58
  (config) => {
34
59
  return config;
35
60
  }
36
61
  );
37
62
  ```
38
63
 
39
- ### With Webpack directly
64
+ ### With Webpack Directly
65
+
66
+ For standalone Webpack projects:
67
+
68
+ ```javascript
69
+ // webpack.config.js
70
+ const { withZephyr } = require('zephyr-webpack-plugin');
71
+
72
+ const config = {
73
+ entry: './src/index.js',
74
+ output: {
75
+ path: path.resolve(__dirname, 'dist'),
76
+ filename: '[name].[contenthash].js',
77
+ },
78
+ // ... other Webpack configuration
79
+ };
80
+
81
+ module.exports = withZephyr()(config);
82
+ ```
83
+
84
+ ### TypeScript Configuration
40
85
 
86
+ ```typescript
87
+ // webpack.config.ts
88
+ import { Configuration } from 'webpack';
89
+ import { withZephyr } from 'zephyr-webpack-plugin';
90
+
91
+ const config: Configuration = {
92
+ entry: './src/index.tsx',
93
+ output: {
94
+ path: path.resolve(__dirname, 'dist'),
95
+ filename: '[name].[contenthash].js',
96
+ },
97
+ // ... other configuration
98
+ };
99
+
100
+ export default withZephyr({
101
+ // Zephyr options
102
+ deploy: true,
103
+ environment: 'production',
104
+ })(config);
41
105
  ```
42
- module.exports = withZephyr()(your_webpack_config);
43
106
 
107
+ ### With Module Federation Plugin
108
+
109
+ ```javascript
110
+ // webpack.config.js
111
+ const ModuleFederationPlugin = require('@module-federation/webpack');
112
+ const { withZephyr } = require('zephyr-webpack-plugin');
113
+
114
+ const config = {
115
+ entry: './src/index.js',
116
+ plugins: [
117
+ new ModuleFederationPlugin({
118
+ name: 'host',
119
+ remotes: {
120
+ mfe1: 'mfe1@http://localhost:3001/remoteEntry.js',
121
+ },
122
+ shared: {
123
+ react: { singleton: true },
124
+ 'react-dom': { singleton: true },
125
+ },
126
+ }),
127
+ ],
128
+ // ... other configuration
129
+ };
130
+
131
+ module.exports = withZephyr()(config);
44
132
  ```
133
+
134
+ ## Configuration Options
135
+
136
+ The `withZephyr` function accepts configuration options:
137
+
138
+ ```javascript
139
+ withZephyr({
140
+ // Enable/disable deployment
141
+ deploy: true,
142
+
143
+ // Deployment environment
144
+ environment: 'production',
145
+
146
+ // Module Federation configuration (if not using external plugin)
147
+ moduleFederation: {
148
+ name: 'my-app',
149
+ remotes: {},
150
+ exposes: {},
151
+ shared: {},
152
+ },
153
+
154
+ // Additional metadata
155
+ metadata: {
156
+ version: '1.0.0',
157
+ description: 'My Webpack app',
158
+ },
159
+ });
160
+ ```
161
+
162
+ ## Features
163
+
164
+ - 🏗️ Full Module Federation support with Webpack 5
165
+ - 📦 Automatic asset optimization and caching
166
+ - 🔧 Zero-config setup for simple applications
167
+ - 📊 Build analytics and monitoring
168
+ - 🌐 Global CDN distribution
169
+ - ⚡ Hot module replacement in development
170
+ - 🎯 Nx integration for monorepo support
171
+ - 🔗 Automatic vendor federation for shared dependencies
172
+
173
+ ## Module Federation Support
174
+
175
+ This plugin provides comprehensive Module Federation support:
176
+
177
+ - **Host Applications**: Consume remote modules from other applications
178
+ - **Remote Applications**: Expose modules for consumption by host applications
179
+ - **Shared Dependencies**: Efficient sharing of common libraries
180
+ - **Dynamic Imports**: Runtime loading of remote modules
181
+ - **Automatic Vendor Federation**: Smart dependency sharing
182
+ - **Federation Dashboard**: Build-time federation analytics
183
+
184
+ ## Getting Started
185
+
186
+ 1. Install the plugin in your Webpack project
187
+ 2. Add it to your Webpack configuration
188
+ 3. Configure Module Federation (if needed) for microfrontends
189
+ 4. Build your application with `npm run build`
190
+ 5. Your app will be automatically deployed to Zephyr Cloud
191
+
192
+ ## Build Scripts
193
+
194
+ Add these scripts to your `package.json`:
195
+
196
+ ```json
197
+ {
198
+ "scripts": {
199
+ "dev": "webpack serve",
200
+ "build": "webpack",
201
+ "build:prod": "NODE_ENV=production webpack"
202
+ }
203
+ }
204
+ ```
205
+
206
+ ## Advanced Configuration
207
+
208
+ ### Custom Webpack Configuration
209
+
210
+ ```javascript
211
+ // webpack.config.js
212
+ const { withZephyr } = require('zephyr-webpack-plugin');
213
+
214
+ const config = {
215
+ entry: './src/index.js',
216
+ optimization: {
217
+ splitChunks: {
218
+ chunks: 'all',
219
+ },
220
+ },
221
+ resolve: {
222
+ extensions: ['.js', '.jsx', '.ts', '.tsx'],
223
+ },
224
+ module: {
225
+ rules: [
226
+ {
227
+ test: /\.(js|jsx|ts|tsx)$/,
228
+ exclude: /node_modules/,
229
+ use: 'babel-loader',
230
+ },
231
+ ],
232
+ },
233
+ };
234
+
235
+ module.exports = withZephyr({
236
+ deploy: process.env.NODE_ENV === 'production',
237
+ environment: process.env.NODE_ENV || 'development',
238
+ })(config);
239
+ ```
240
+
241
+ ## Requirements
242
+
243
+ - Webpack 5.x or higher
244
+ - Node.js 18 or higher
245
+ - Zephyr Cloud account (sign up at [zephyr-cloud.io](https://zephyr-cloud.io))
246
+
247
+ ## Examples
248
+
249
+ Check out our [examples directory](../../examples/) for complete working examples:
250
+
251
+ - [sample-webpack-application](../../examples/sample-webpack-application/) - Basic Webpack setup
252
+ - [react-micro-frontends](../../examples/react-micro-frontends/) - Module Federation setup with multiple teams
253
+
254
+ ## Nx Integration
255
+
256
+ This plugin works seamlessly with Nx workspaces:
257
+
258
+ ```bash
259
+ # Generate a new Webpack app with Module Federation
260
+ nx g @nx/react:app my-app --bundler=webpack --mf=true
261
+
262
+ # Add Zephyr plugin to the generated configuration
263
+ ```
264
+
265
+ ## Contributing
266
+
267
+ We welcome contributions! Please read our [contributing guidelines](../../CONTRIBUTING.md) for more information.
268
+
269
+ ## License
270
+
271
+ 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-webpack-plugin",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "description": "Webpack plugin for Zephyr",
5
5
  "repository": {
6
6
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zephyr-webpack-plugin",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "description": "Webpack plugin for Zephyr",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,8 +20,8 @@
20
20
  "is-ci": "^4.1.0",
21
21
  "tslib": "^2.8.1",
22
22
  "webpack": "^5.98.0",
23
- "zephyr-agent": "0.0.49",
24
- "zephyr-xpack-internal": "0.0.49"
23
+ "zephyr-agent": "0.0.50",
24
+ "zephyr-xpack-internal": "0.0.50"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/is-ci": "3.0.4",