zephyr-modernjs-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,14 +1,50 @@
1
- # Zephyr ModernJS: We made application federation easy
1
+ # Zephyr Modern.js Plugin
2
2
 
3
- ### How to use?
3
+ <div align="center">
4
4
 
5
- The plugin requires the following configuration to work:
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
- - Output
8
- - HTML
9
- - Source
7
+ <hr/>
8
+ <img src="https://cdn.prod.website-files.com/669061ee3adb95b628c3acda/66981c766e352fe1f57191e2_Opengraph-zephyr.png" alt="Zephyr Logo" />
9
+ </div>
10
+
11
+ A Modern.js plugin for deploying applications with Zephyr Cloud. This plugin integrates seamlessly with Modern.js framework to enable application federation and deployment capabilities.
12
+
13
+ ## Get Started
14
+
15
+ The fastest way to get started is to use `create-zephyr-apps` to generate a new Modern.js 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/modernjs) for Modern.js and Zephyr integration.
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ # npm
27
+ npm install --save-dev zephyr-modernjs-plugin
28
+
29
+ # yarn
30
+ yarn add --dev zephyr-modernjs-plugin
31
+
32
+ # pnpm
33
+ pnpm add --dev zephyr-modernjs-plugin
34
+
35
+ # bun
36
+ bun add --dev zephyr-modernjs-plugin
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ Add the plugin to your Modern.js configuration:
42
+
43
+ ```typescript
44
+ // modern.config.ts
45
+ import { defineConfig } from '@modern-js/app-tools';
46
+ import { withZephyr } from 'zephyr-modernjs-plugin';
10
47
 
11
- ```ts
12
48
  export default defineConfig({
13
49
  output: {
14
50
  distPath: {
@@ -28,7 +64,130 @@ export default defineConfig({
28
64
  appTools({
29
65
  bundler: 'rspack', // Set to 'webpack' to enable webpack
30
66
  }),
31
- withZephyr(), // Last
67
+ withZephyr(), // Must be last
32
68
  ],
33
69
  });
34
70
  ```
71
+
72
+ ## Required Configuration
73
+
74
+ The plugin requires the following Modern.js configuration to work properly:
75
+
76
+ ### Output Configuration
77
+
78
+ ```typescript
79
+ output: {
80
+ distPath: {
81
+ html: './', // HTML files at root of dist
82
+ },
83
+ }
84
+ ```
85
+
86
+ ### HTML Configuration
87
+
88
+ ```typescript
89
+ html: {
90
+ outputStructure: 'flat', // Flat structure for assets
91
+ }
92
+ ```
93
+
94
+ ### Source Configuration
95
+
96
+ ```typescript
97
+ source: {
98
+ mainEntryName: 'index', // Main entry point name
99
+ }
100
+ ```
101
+
102
+ ## Bundler Support
103
+
104
+ The plugin works with both Webpack and Rspack bundlers:
105
+
106
+ ### With Rspack (Recommended)
107
+
108
+ ```typescript
109
+ plugins: [
110
+ appTools({
111
+ bundler: 'rspack',
112
+ }),
113
+ withZephyr(),
114
+ ];
115
+ ```
116
+
117
+ ### With Webpack
118
+
119
+ ```typescript
120
+ plugins: [
121
+ appTools({
122
+ bundler: 'webpack',
123
+ }),
124
+ withZephyr(),
125
+ ];
126
+ ```
127
+
128
+ ## Features
129
+
130
+ - 🚀 Seamless deployment during Modern.js build
131
+ - ⚡ Support for both Webpack and Rspack bundlers
132
+ - 📦 Automatic asset optimization
133
+ - 🏗️ Application federation capabilities
134
+ - 🔧 Zero-config setup with required configuration
135
+ - 📊 Build analytics and monitoring
136
+ - 🌐 Global CDN distribution
137
+
138
+ ## Project Structure
139
+
140
+ Your Modern.js project should follow this structure:
141
+
142
+ ```
143
+ my-modernjs-app/
144
+ ├── src/
145
+ │ ├── routes/
146
+ │ │ ├── layout.tsx
147
+ │ │ └── page.tsx
148
+ │ └── index.ts
149
+ ├── modern.config.ts
150
+ └── package.json
151
+ ```
152
+
153
+ ## Getting Started
154
+
155
+ 1. Install the plugin in your Modern.js project
156
+ 2. Add the required configuration to `modern.config.ts`
157
+ 3. Add the plugin to your plugins array (ensure it's last)
158
+ 4. Build your application with `npm run build`
159
+ 5. Your app will be automatically deployed to Zephyr Cloud
160
+
161
+ ## Build Scripts
162
+
163
+ Add these scripts to your `package.json`:
164
+
165
+ ```json
166
+ {
167
+ "scripts": {
168
+ "dev": "modern dev",
169
+ "build": "modern build",
170
+ "serve": "modern serve"
171
+ }
172
+ }
173
+ ```
174
+
175
+ ## Requirements
176
+
177
+ - Modern.js 2.x or higher
178
+ - Node.js 18 or higher
179
+ - Zephyr Cloud account (sign up at [zephyr-cloud.io](https://zephyr-cloud.io))
180
+
181
+ ## Examples
182
+
183
+ Check out our [examples directory](../../examples/) for complete working examples:
184
+
185
+ - [modern-js](../../examples/modern-js/) - Complete Modern.js setup with Zephyr
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.
@@ -1,3 +1,3 @@
1
- import type { ZephyrPluginOptions } from 'zephyr-edge-contract';
2
1
  import type { AppTools, CliPluginFuture } from '@modern-js/app-tools';
2
+ import type { ZephyrPluginOptions } from 'zephyr-edge-contract';
3
3
  export declare const withZephyr: (zephyrOptions?: ZephyrPluginOptions) => CliPluginFuture<AppTools<"rspack" | "webpack">>;
@@ -70,13 +70,13 @@ function zephyrFixPublicPath() {
70
70
  setup(api) {
71
71
  api.modifyWebpackConfig(async (config, { isServer }) => {
72
72
  if (!isServer) {
73
- (0, zephyr_agent_1.ze_log)('Modifying publicPath for Dev Server');
73
+ zephyr_agent_1.ze_log.misc('Modifying publicPath for Dev Server');
74
74
  config.output = { ...config.output, publicPath: 'auto' };
75
75
  }
76
76
  });
77
77
  api.modifyRspackConfig(async (config, { isServer }) => {
78
78
  if (!isServer) {
79
- (0, zephyr_agent_1.ze_log)('Modifying publicPath for Dev Server');
79
+ zephyr_agent_1.ze_log.misc('Modifying publicPath for Dev Server');
80
80
  config.output = { ...config.output, publicPath: 'auto' };
81
81
  }
82
82
  });
@@ -1 +1 @@
1
- {"version":3,"file":"with-zephyr.js","sourceRoot":"","sources":["../../src/modernjs-plugin/with-zephyr.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+CAAsC;AAEtC,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,aAAa,CAAC;AAEjD,MAAM,UAAU,GAAG,CACxB,aAAmC,EACc,EAAE,CAAC,CAAC;IACrD,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,CAAC,4CAA4C,CAAC;IAEnD,KAAK,CAAC,KAAK,CAAC,GAAG;QACb,GAAG,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;YAC9C,MAAM,cAAc,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC,WAAW,CAAC;YACvD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;gBACjC,OAAO;YACT,CAAC;YAED,MAAM,EAAE,UAAU,EAAE,GAAG,wDAAa,uBAAuB,GAAC,CAAC;YAC7D,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;YACzD,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;YAC7C,MAAM,cAAc,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC,WAAW,CAAC;YACvD,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO;YACT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,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;CACjD,CAAC,CAAC;AA/BU,QAAA,UAAU,cA+BpB;AAEH,SAAS,mBAAmB;IAC1B,OAAO;QACL,IAAI,EAAE,uBAAuB;QAC7B,GAAG,EAAE,CAAC,UAAU,CAAC;QACjB,KAAK,CAAC,GAAG;YACP,GAAG,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,qBAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;oBACnD,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;gBAC3D,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,GAAG,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACpD,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,qBAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;oBACnD,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;gBAC3D,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zephyr-modernjs-plugin",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "description": "Modernjs plugin for Zephyr",
5
5
  "repository": {
6
6
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zephyr-modernjs-plugin",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "description": "Modernjs plugin for Zephyr",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,9 +19,9 @@
19
19
  "@modern-js/app-tools": "^2.66.0",
20
20
  "is-ci": "^4.1.0",
21
21
  "tslib": "^2.8.1",
22
- "zephyr-edge-contract": "0.0.49",
23
- "zephyr-agent": "0.0.49",
24
- "zephyr-xpack-internal": "0.0.49"
22
+ "zephyr-agent": "0.0.51",
23
+ "zephyr-edge-contract": "0.0.51",
24
+ "zephyr-xpack-internal": "0.0.51"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/is-ci": "3.0.4",
@@ -31,8 +31,8 @@
31
31
  "ts-jest": "^29.2.6"
32
32
  },
33
33
  "peerDependencies": {
34
- "zephyr-webpack-plugin": "0.0.49",
35
- "zephyr-rspack-plugin": "0.0.49"
34
+ "zephyr-rspack-plugin": "0.0.51",
35
+ "zephyr-webpack-plugin": "0.0.51"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "zephyr-rspack-plugin": {