vite-plugin-zephyr 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 +144 -7
- package/dist/lib/internal/extract/extract_vite_assets_map.js +12 -4
- package/dist/lib/internal/extract/extract_vite_assets_map.js.map +1 -1
- package/dist/lib/internal/mf-vite-etl/load_resolved_remotes.js +3 -3
- package/dist/lib/internal/mf-vite-etl/load_resolved_remotes.js.map +1 -1
- package/dist/lib/internal/mf-vite-etl/runtime_plugins_parser.js +1 -1
- package/dist/lib/internal/mf-vite-etl/runtime_plugins_parser.js.map +1 -1
- package/dist/lib/vite-plugin-zephyr.d.ts +3 -2
- package/dist/lib/vite-plugin-zephyr.js +5 -2
- package/dist/lib/vite-plugin-zephyr.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
@@ -1,39 +1,176 @@
|
|
1
|
-
#
|
1
|
+
# Vite Plugin Zephyr
|
2
2
|
|
3
3
|
<div align="center">
|
4
4
|
|
5
|
-
[Zephyr Cloud](https://zephyr-cloud.io) | [Zephyr Docs](https://docs.zephyr-cloud.io
|
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
|
|
10
|
-
|
11
|
+
A Vite plugin for deploying applications with Zephyr Cloud. This plugin integrates with Vite's build process to enable seamless deployment of your applications with Module Federation support. Read more from our documentation [here](https://docs.zephyr-cloud.io/recipes/react-vite).
|
11
12
|
|
12
|
-
##
|
13
|
+
## Get Started
|
14
|
+
|
15
|
+
The fastest way to get started is to use `create-zephyr-apps` to generate a new Vite application with Zephyr integration and there are various vite examples available:
|
13
16
|
|
17
|
+
```bash
|
18
|
+
npx create-zephyr-apps@latest
|
14
19
|
```
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
```bash
|
15
24
|
# npm
|
16
25
|
npm install --save-dev vite-plugin-zephyr
|
26
|
+
|
17
27
|
# yarn
|
18
28
|
yarn add --dev vite-plugin-zephyr
|
29
|
+
|
19
30
|
# pnpm
|
20
31
|
pnpm add --dev vite-plugin-zephyr
|
32
|
+
|
21
33
|
# bun
|
22
34
|
bun add --dev vite-plugin-zephyr
|
23
35
|
```
|
24
36
|
|
25
37
|
## Usage
|
26
38
|
|
27
|
-
|
39
|
+
### Basic Configuration
|
40
|
+
|
41
|
+
Add the plugin to your Vite configuration:
|
42
|
+
|
43
|
+
```javascript
|
44
|
+
// vite.config.js
|
45
|
+
import { defineConfig } from 'vite';
|
46
|
+
import react from '@vitejs/plugin-react';
|
47
|
+
import { withZephyr } from 'vite-plugin-zephyr';
|
48
|
+
|
49
|
+
export default defineConfig({
|
50
|
+
plugins: [react(), withZephyr()],
|
51
|
+
build: {
|
52
|
+
target: 'chrome89',
|
53
|
+
},
|
54
|
+
});
|
55
|
+
```
|
56
|
+
|
57
|
+
### With Module Federation
|
28
58
|
|
29
|
-
|
59
|
+
For microfrontend applications using Module Federation:
|
60
|
+
|
61
|
+
```javascript
|
62
|
+
// vite.config.js
|
63
|
+
import { defineConfig } from 'vite';
|
64
|
+
import react from '@vitejs/plugin-react';
|
30
65
|
import { withZephyr, type ModuleFederationOptions } from 'vite-plugin-zephyr';
|
31
66
|
|
67
|
+
const mfConfig = {
|
68
|
+
name: 'my-app',
|
69
|
+
remotes: {
|
70
|
+
shared: 'shared@http://localhost:3001/remoteEntry.js',
|
71
|
+
},
|
72
|
+
shared: {
|
73
|
+
react: { singleton: true },
|
74
|
+
'react-dom': { singleton: true },
|
75
|
+
},
|
76
|
+
};
|
77
|
+
|
78
|
+
export default defineConfig({
|
79
|
+
plugins: [
|
80
|
+
react(),
|
81
|
+
withZephyr({ mfConfig })
|
82
|
+
],
|
83
|
+
build: {
|
84
|
+
target: 'chrome89',
|
85
|
+
},
|
86
|
+
});
|
87
|
+
```
|
88
|
+
|
89
|
+
### TypeScript Configuration
|
90
|
+
|
91
|
+
```typescript
|
92
|
+
// vite.config.ts
|
93
|
+
import { defineConfig } from 'vite';
|
94
|
+
import react from '@vitejs/plugin-react';
|
95
|
+
import { withZephyr, type ModuleFederationOptions } from 'vite-plugin-zephyr';
|
96
|
+
|
97
|
+
const mfConfig: ModuleFederationOptions = {
|
98
|
+
name: 'host-app',
|
99
|
+
remotes: {
|
100
|
+
'remote-app': 'remoteApp@http://localhost:3001/remoteEntry.js',
|
101
|
+
},
|
102
|
+
shared: {
|
103
|
+
react: { singleton: true },
|
104
|
+
'react-dom': { singleton: true },
|
105
|
+
},
|
106
|
+
};
|
107
|
+
|
32
108
|
export default defineConfig({
|
33
109
|
plugins: [react(), withZephyr({ mfConfig })],
|
34
110
|
build: {
|
35
111
|
target: 'chrome89',
|
36
112
|
},
|
37
113
|
});
|
38
|
-
export default config;
|
39
114
|
```
|
115
|
+
|
116
|
+
## Features
|
117
|
+
|
118
|
+
- 🚀 Seamless deployment during Vite build
|
119
|
+
- 🏗️ Module Federation support via [@module-federation/vite](https://github.com/module-federation/vite)
|
120
|
+
- 📦 Asset optimization and caching
|
121
|
+
- 🔧 Zero-config setup for simple applications
|
122
|
+
- 📊 Build analytics and monitoring
|
123
|
+
- 🌐 Global CDN distribution
|
124
|
+
- ⚡ Hot module replacement in development
|
125
|
+
|
126
|
+
## Module Federation Support
|
127
|
+
|
128
|
+
This plugin uses the official [vite plugin from Module Federation](https://github.com/module-federation/vite) under the hood, providing:
|
129
|
+
|
130
|
+
- **Host Applications**: Consume remote modules from other applications
|
131
|
+
- **Remote Applications**: Expose modules for consumption by host applications
|
132
|
+
- **Shared Dependencies**: Efficient sharing of common libraries
|
133
|
+
- **Dynamic Imports**: Runtime loading of remote modules
|
134
|
+
|
135
|
+
## Getting Started
|
136
|
+
|
137
|
+
1. Install the plugin in your Vite project
|
138
|
+
2. Add it to your Vite configuration
|
139
|
+
3. Configure Module Federation (if needed) for microfrontends
|
140
|
+
4. Build your application with `vite build`
|
141
|
+
5. Your app will be automatically deployed to Zephyr Cloud
|
142
|
+
|
143
|
+
## Build Scripts
|
144
|
+
|
145
|
+
Add these scripts to your `package.json`:
|
146
|
+
|
147
|
+
```json
|
148
|
+
{
|
149
|
+
"scripts": {
|
150
|
+
"dev": "vite",
|
151
|
+
"build": "vite build",
|
152
|
+
"preview": "vite preview"
|
153
|
+
}
|
154
|
+
}
|
155
|
+
```
|
156
|
+
|
157
|
+
## Requirements
|
158
|
+
|
159
|
+
- Vite 4.x or higher
|
160
|
+
- Node.js 18 or higher
|
161
|
+
- Zephyr Cloud account (sign up at [zephyr-cloud.io](https://zephyr-cloud.io))
|
162
|
+
|
163
|
+
## Examples
|
164
|
+
|
165
|
+
Check out our [examples directory](../../examples/) for complete working examples:
|
166
|
+
|
167
|
+
- [vite-react-ts](../../examples/vite-react-ts/) - Basic React + TypeScript setup
|
168
|
+
- [vite-react-mf](../../examples/vite-react-mf/) - Module Federation setup with host and remote
|
169
|
+
|
170
|
+
## Contributing
|
171
|
+
|
172
|
+
We welcome contributions! Please read our [contributing guidelines](../../CONTRIBUTING.md) for more information.
|
173
|
+
|
174
|
+
## License
|
175
|
+
|
176
|
+
Licensed under the Apache-2.0 License. See [LICENSE](LICENSE) for more information.
|
@@ -15,16 +15,24 @@ async function extract_vite_assets_map(zephyr_engine, vite_internal_options) {
|
|
15
15
|
function getAssetType(asset) {
|
16
16
|
return asset.type;
|
17
17
|
}
|
18
|
+
/**
|
19
|
+
* Extracts buffer content from Rollup assets.
|
20
|
+
*
|
21
|
+
* @param asset - Output chunk or asset from Rollup
|
22
|
+
* @returns String for text-based chunks, Buffer for binary assets, undefined for unknown
|
23
|
+
* types
|
24
|
+
*/
|
18
25
|
function extractBuffer(asset) {
|
19
26
|
switch (asset.type) {
|
20
27
|
case 'chunk':
|
21
28
|
return asset.code;
|
22
29
|
case 'asset':
|
23
|
-
|
24
|
-
|
25
|
-
|
30
|
+
if (typeof asset.source === 'string') {
|
31
|
+
return asset.source;
|
32
|
+
}
|
33
|
+
return Buffer.from(asset.source);
|
26
34
|
default:
|
27
|
-
return
|
35
|
+
return undefined;
|
28
36
|
}
|
29
37
|
}
|
30
38
|
//# sourceMappingURL=extract_vite_assets_map.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"extract_vite_assets_map.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/extract_vite_assets_map.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"extract_vite_assets_map.js","sourceRoot":"","sources":["../../../../src/lib/internal/extract/extract_vite_assets_map.ts"],"names":[],"mappings":";;AAWA,0DAiBC;AA3BD,+CAMsB;AAEtB,6DAAwD;AAEjD,KAAK,UAAU,uBAAuB,CAC3C,aAA2B,EAC3B,qBAA4C;IAE5C,MAAM,eAAe,GAAG,aAAa,CAAC,eAAe,CAAC;IACtD,MAAM,MAAM,GAAG,MAAM,IAAA,qCAAgB,EAAC,qBAAqB,CAAC,CAAC;IAC7D,MAAM,eAAe,GAAG,MAAM,IAAA,iCAAkB,EAAC,eAAe,CAAC,CAAC;IAClE,MAAM,IAAA,oCAAqB,EAAC,eAAe,CAAC,CAAC;IAE7C,MAAM,cAAc,GAAG,qBAAqB,CAAC,MAAM,CAAC;IACpD,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,EAAE,EACF,MAAM,EACN,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,EAAE,CAAC,EACvC,cAAc,CACf,CAAC;IACF,OAAO,IAAA,6BAAc,EAAC,eAAe,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,YAAY,CAAC,KAAgC;IACpD,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,KAAgC;IACrD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,IAAI,CAAC;QACpB,KAAK,OAAO;YACV,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACrC,OAAO,KAAK,CAAC,MAAM,CAAC;YACtB,CAAC;YACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACnC;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
@@ -2,8 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.load_resolved_remotes = load_resolved_remotes;
|
4
4
|
const zephyr_agent_1 = require("zephyr-agent");
|
5
|
-
const runtime_plugins_parser_1 = require("./runtime_plugins_parser");
|
6
5
|
const runtime_plugin_1 = require("./runtime_plugin");
|
6
|
+
const runtime_plugins_parser_1 = require("./runtime_plugins_parser");
|
7
7
|
function load_resolved_remotes(resolved_remotes, code) {
|
8
8
|
const startTime = Date.now();
|
9
9
|
try {
|
@@ -27,11 +27,11 @@ function load_resolved_remotes(resolved_remotes, code) {
|
|
27
27
|
// Replace the original array with the updated one
|
28
28
|
const updatedCode = code.substring(0, startIndex) + updatedPluginsArray + code.substring(endIndex);
|
29
29
|
const endTime = Date.now();
|
30
|
-
|
30
|
+
zephyr_agent_1.ze_log.remotes(`load_resolved_remotes took ${endTime - startTime}ms`);
|
31
31
|
return updatedCode;
|
32
32
|
}
|
33
33
|
catch (error) {
|
34
|
-
|
34
|
+
zephyr_agent_1.ze_log.remotes('Error in load_resolved_remotes:', error);
|
35
35
|
return code; // Return original code in case of error
|
36
36
|
}
|
37
37
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"load_resolved_remotes.js","sourceRoot":"","sources":["../../../../src/lib/internal/mf-vite-etl/load_resolved_remotes.ts"],"names":[],"mappings":";;AAKA,sDAsCC;AA1CD,+CAAsC;AACtC,
|
1
|
+
{"version":3,"file":"load_resolved_remotes.js","sourceRoot":"","sources":["../../../../src/lib/internal/mf-vite-etl/load_resolved_remotes.ts"],"names":[],"mappings":";;AAKA,sDAsCC;AA1CD,+CAAsC;AACtC,qDAAyD;AACzD,qEAA8D;AAE9D,SAAgB,qBAAqB,CACnC,gBAAwC,EACxC,IAAY;IAEZ,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,CAAC;QACH,MAAM,wBAAwB,GAAG,IAAA,2CAAkB,EAAC,IAAI,CAAC,CAAC;QAE1D,IAAI,CAAC,wBAAwB;YAAE,OAAO,IAAI,CAAC;QAE3C,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,wBAAwB,CAAC;QAExE,iCAAiC;QACjC,yDAAyD;QACzD,4DAA4D;QAC5D,IAAI,mBAAmB,CAAC;QACxB,MAAM,aAAa,GAAG,IAAA,sCAAqB,EAAC,gBAAgB,CAAC,CAAC;QAE9D,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;YAC1B,0BAA0B;YAC1B,mBAAmB,GAAG,IAAI,aAAa,GAAG,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,8BAA8B;YAC9B,mBAAmB,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,aAAa,GAAG,CAAC,CAAC;QAC3E,CAAC;QAED,kDAAkD;QAClD,MAAM,WAAW,GACf,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,mBAAmB,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAEjF,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,qBAAM,CAAC,OAAO,CAAC,8BAA8B,OAAO,GAAG,SAAS,IAAI,CAAC,CAAC;QACtE,OAAO,WAAW,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,qBAAM,CAAC,OAAO,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,CAAC,wCAAwC;IACvD,CAAC;AACH,CAAC"}
|
@@ -36,7 +36,7 @@ function parseRuntimePlugin(code) {
|
|
36
36
|
if (!pluginsArrayNode ||
|
37
37
|
!('start' in pluginsArrayNode) ||
|
38
38
|
!('end' in pluginsArrayNode)) {
|
39
|
-
|
39
|
+
zephyr_agent_1.ze_log.mf('Could not find plugins array in remote entry');
|
40
40
|
return undefined;
|
41
41
|
}
|
42
42
|
// Extract the plugins array
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"runtime_plugins_parser.js","sourceRoot":"","sources":["../../../../src/lib/internal/mf-vite-etl/runtime_plugins_parser.ts"],"names":[],"mappings":";;AAUA,gDAgDC;;AA1DD,0DAA0B;AAC1B,oEAA8B;AAC9B,+CAAsC;AAQtC,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,6BAA6B;IAC7B,MAAM,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,IAAI,EAAE;QAC5B,WAAW,EAAE,QAAQ;QACrB,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,IAAI,gBAAwC,CAAC;IAE7C,iDAAiD;IACjD,oBAAI,CAAC,MAAM,CAAC,GAAG,EAAE;QACf,cAAc,CAAC,IAAS;;YACtB,IAAI,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,MAAK,aAAa,IAAI,CAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,MAAM,IAAG,CAAC,EAAE,CAAC;gBACtE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBAElC,IAAI,OAAO,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;oBACxC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;wBACtC,IACE,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;4BAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS;4BAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,iBAAiB,EACrC,CAAC;4BACD,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC;4BAC9B,MAAM;wBACR,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,IACE,CAAC,gBAAgB;QACjB,CAAC,CAAC,OAAO,IAAI,gBAAgB,CAAC;QAC9B,CAAC,CAAC,KAAK,IAAI,gBAAgB,CAAC,EAC5B,CAAC;QACD,
|
1
|
+
{"version":3,"file":"runtime_plugins_parser.js","sourceRoot":"","sources":["../../../../src/lib/internal/mf-vite-etl/runtime_plugins_parser.ts"],"names":[],"mappings":";;AAUA,gDAgDC;;AA1DD,0DAA0B;AAC1B,oEAA8B;AAC9B,+CAAsC;AAQtC,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,6BAA6B;IAC7B,MAAM,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,IAAI,EAAE;QAC5B,WAAW,EAAE,QAAQ;QACrB,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IAEH,IAAI,gBAAwC,CAAC;IAE7C,iDAAiD;IACjD,oBAAI,CAAC,MAAM,CAAC,GAAG,EAAE;QACf,cAAc,CAAC,IAAS;;YACtB,IAAI,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,MAAK,aAAa,IAAI,CAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,MAAM,IAAG,CAAC,EAAE,CAAC;gBACtE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBAElC,IAAI,OAAO,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;oBACxC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;wBACtC,IACE,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;4BAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS;4BAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,iBAAiB,EACrC,CAAC;4BACD,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC;4BAC9B,MAAM;wBACR,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,IACE,CAAC,gBAAgB;QACjB,CAAC,CAAC,OAAO,IAAI,gBAAgB,CAAC;QAC9B,CAAC,CAAC,KAAK,IAAI,gBAAgB,CAAC,EAC5B,CAAC;QACD,qBAAM,CAAC,EAAE,CAAC,8CAA8C,CAAC,CAAC;QAC1D,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,4BAA4B;IAC5B,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC;IAC1C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC;IACtC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAEtD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAChD,CAAC"}
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import type { Plugin } from 'vite';
|
2
1
|
import { federation } from '@module-federation/vite';
|
2
|
+
import type { Plugin } from 'vite';
|
3
|
+
import type { ZephyrPluginOptions } from 'zephyr-edge-contract';
|
3
4
|
export type ModuleFederationOptions = Parameters<typeof federation>[0];
|
4
|
-
interface VitePluginZephyrOptions {
|
5
|
+
interface VitePluginZephyrOptions extends Omit<ZephyrPluginOptions, 'mfConfig'> {
|
5
6
|
mfConfig?: ModuleFederationOptions;
|
6
7
|
}
|
7
8
|
export declare function withZephyr(_options?: VitePluginZephyrOptions): Plugin[];
|
@@ -1,12 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.withZephyr = withZephyr;
|
4
|
-
const zephyr_agent_1 = require("zephyr-agent");
|
5
4
|
const vite_1 = require("@module-federation/vite");
|
5
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
6
|
+
const extract_mf_plugin_1 = require("./internal/extract/extract_mf_plugin");
|
6
7
|
const extract_vite_assets_map_1 = require("./internal/extract/extract_vite_assets_map");
|
7
8
|
const extract_mf_vite_remotes_1 = require("./internal/mf-vite-etl/extract-mf-vite-remotes");
|
8
9
|
const load_resolved_remotes_1 = require("./internal/mf-vite-etl/load_resolved_remotes");
|
9
|
-
const extract_mf_plugin_1 = require("./internal/extract/extract_mf_plugin");
|
10
10
|
function withZephyr(_options) {
|
11
11
|
const mfConfig = _options === null || _options === void 0 ? void 0 : _options.mfConfig;
|
12
12
|
const plugins = [];
|
@@ -23,6 +23,7 @@ function zephyrPlugin() {
|
|
23
23
|
resolve_vite_internal_options = resolve;
|
24
24
|
});
|
25
25
|
let root;
|
26
|
+
let baseHref = '/';
|
26
27
|
let mfPlugin;
|
27
28
|
return {
|
28
29
|
name: 'with-zephyr',
|
@@ -30,6 +31,7 @@ function zephyrPlugin() {
|
|
30
31
|
configResolved: async (config) => {
|
31
32
|
var _a, _b;
|
32
33
|
root = config.root;
|
34
|
+
baseHref = config.base || '/';
|
33
35
|
if (config.command === 'serve')
|
34
36
|
return;
|
35
37
|
zephyr_defer_create({
|
@@ -68,6 +70,7 @@ function zephyrPlugin() {
|
|
68
70
|
vite_internal_options_defer,
|
69
71
|
zephyr_engine_defer,
|
70
72
|
]);
|
73
|
+
zephyr_engine.buildProperties.baseHref = baseHref;
|
71
74
|
await zephyr_engine.start_new_build();
|
72
75
|
const assetsMap = await (0, extract_vite_assets_map_1.extract_vite_assets_map)(zephyr_engine, vite_internal_options);
|
73
76
|
await zephyr_engine.upload_assets({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"vite-plugin-zephyr.js","sourceRoot":"","sources":["../../src/lib/vite-plugin-zephyr.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"vite-plugin-zephyr.js","sourceRoot":"","sources":["../../src/lib/vite-plugin-zephyr.ts"],"names":[],"mappings":"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"}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vite-plugin-zephyr",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.51",
|
4
4
|
"description": "Vite plugin for Zephyr",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -23,8 +23,8 @@
|
|
23
23
|
"is-ci": "^4.1.0",
|
24
24
|
"json5": "2.2.3",
|
25
25
|
"rollup": "^4.36.0",
|
26
|
-
"vite": "^6.2.
|
27
|
-
"zephyr-agent": "0.0.
|
26
|
+
"vite": "^6.2.7",
|
27
|
+
"zephyr-agent": "0.0.51"
|
28
28
|
},
|
29
29
|
"devDependencies": {
|
30
30
|
"@types/is-ci": "3.0.4",
|