vite-plugin-zephyr 1.1.2 → 1.2.0
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 +45 -1
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +44 -6
- package/dist/index.mjs +3 -0
- package/dist/lib/internal/extract/extract-entrypoint.d.mts +11 -0
- package/dist/lib/internal/extract/extract-entrypoint.d.ts +2 -1
- package/dist/lib/internal/extract/extract-entrypoint.js +53 -38
- package/dist/lib/internal/extract/extract-entrypoint.mjs +32 -0
- package/dist/lib/internal/extract/extract_mf_plugin.d.mts +10 -0
- package/dist/lib/internal/extract/extract_mf_plugin.d.ts +6 -2
- package/dist/lib/internal/extract/extract_mf_plugin.js +48 -5
- package/dist/lib/internal/extract/extract_mf_plugin.mjs +17 -0
- package/dist/lib/internal/extract/extract_vite_assets_map.d.mts +4 -0
- package/dist/lib/internal/extract/extract_vite_assets_map.d.ts +2 -1
- package/dist/lib/internal/extract/extract_vite_assets_map.js +65 -35
- package/dist/lib/internal/extract/extract_vite_assets_map.mjs +49 -0
- package/dist/lib/internal/extract/load_public_dir.d.mts +10 -0
- package/dist/lib/internal/extract/load_public_dir.d.ts +5 -2
- package/dist/lib/internal/extract/load_public_dir.js +57 -19
- package/dist/lib/internal/extract/load_public_dir.mjs +31 -0
- package/dist/lib/internal/extract/load_static_assets.d.mts +4 -0
- package/dist/lib/internal/extract/load_static_assets.d.ts +3 -2
- package/dist/lib/internal/extract/load_static_assets.js +60 -35
- package/dist/lib/internal/extract/load_static_assets.mjs +29 -0
- package/dist/lib/internal/extract/load_static_entries.d.mts +10 -0
- package/dist/lib/internal/extract/load_static_entries.d.ts +5 -2
- package/dist/lib/internal/extract/load_static_entries.js +56 -14
- package/dist/lib/internal/extract/load_static_entries.mjs +31 -0
- package/dist/lib/internal/extract/merge_vite_output_assets.d.mts +13 -0
- package/dist/lib/internal/extract/merge_vite_output_assets.d.ts +13 -0
- package/dist/lib/internal/extract/merge_vite_output_assets.js +68 -0
- package/dist/lib/internal/extract/merge_vite_output_assets.mjs +31 -0
- package/dist/lib/internal/mf-vite-etl/ensure_runtime_plugin.d.mts +31 -0
- package/dist/lib/internal/mf-vite-etl/ensure_runtime_plugin.d.ts +11 -0
- package/dist/lib/internal/mf-vite-etl/ensure_runtime_plugin.js +56 -15
- package/dist/lib/internal/mf-vite-etl/ensure_runtime_plugin.mjs +21 -0
- package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.d.mts +13 -0
- package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.d.ts +1 -0
- package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.js +55 -19
- package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.mjs +24 -0
- package/dist/lib/internal/mf-vite-etl/federation-metadata.d.mts +38 -0
- package/dist/lib/internal/mf-vite-etl/federation-metadata.d.ts +38 -0
- package/dist/lib/internal/mf-vite-etl/federation-metadata.js +154 -0
- package/dist/lib/internal/mf-vite-etl/federation-metadata.mjs +111 -0
- package/dist/lib/internal/mf-vite-etl/runtime_plugin.mjs +68 -159
- package/dist/lib/internal/partial-build-scope.d.mts +12 -0
- package/dist/lib/internal/partial-build-scope.d.ts +12 -0
- package/dist/lib/internal/partial-build-scope.js +83 -0
- package/dist/lib/internal/partial-build-scope.mjs +43 -0
- package/dist/lib/internal/types/zephyr-internal-options.d.mts +13 -0
- package/dist/lib/internal/types/zephyr-internal-options.d.ts +6 -2
- package/dist/lib/internal/types/zephyr-internal-options.js +18 -1
- package/dist/lib/internal/types/zephyr-internal-options.mjs +1 -0
- package/dist/lib/internal/types/zephyr-output.d.mts +23 -0
- package/dist/lib/internal/types/zephyr-output.d.ts +23 -0
- package/dist/lib/internal/types/zephyr-output.js +20 -0
- package/dist/lib/internal/types/zephyr-output.mjs +1 -0
- package/dist/lib/internal/utils/normalize-entrypoint.d.mts +11 -0
- package/dist/lib/internal/utils/normalize-entrypoint.d.ts +1 -0
- package/dist/lib/internal/utils/normalize-entrypoint.js +42 -24
- package/dist/lib/internal/utils/normalize-entrypoint.mjs +12 -0
- package/dist/lib/internal/utils/normalize-vite-path.d.mts +10 -0
- package/dist/lib/internal/utils/normalize-vite-path.d.ts +10 -0
- package/dist/lib/internal/utils/normalize-vite-path.js +51 -0
- package/dist/lib/internal/utils/normalize-vite-path.mjs +11 -0
- package/dist/lib/vite-plugin-zephyr-partial.d.mts +6 -0
- package/dist/lib/vite-plugin-zephyr-partial.d.ts +5 -8
- package/dist/lib/vite-plugin-zephyr-partial.js +75 -27
- package/dist/lib/vite-plugin-zephyr-partial.mjs +64 -0
- package/dist/lib/vite-plugin-zephyr.d.mts +21 -0
- package/dist/lib/vite-plugin-zephyr.d.ts +16 -3
- package/dist/lib/vite-plugin-zephyr.js +685 -239
- package/dist/lib/vite-plugin-zephyr.mjs +662 -0
- package/dist/rslib-runtime.mjs +21 -0
- package/package.json +53 -44
- package/dist/index.js.map +0 -1
- package/dist/lib/internal/extract/extract-entrypoint.js.map +0 -1
- package/dist/lib/internal/extract/extract_mf_plugin.js.map +0 -1
- package/dist/lib/internal/extract/extract_vite_assets_map.js.map +0 -1
- package/dist/lib/internal/extract/load_public_dir.js.map +0 -1
- package/dist/lib/internal/extract/load_static_assets.js.map +0 -1
- package/dist/lib/internal/extract/load_static_entries.js.map +0 -1
- package/dist/lib/internal/mf-vite-etl/ensure_runtime_plugin.js.map +0 -1
- package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.js.map +0 -1
- package/dist/lib/internal/types/zephyr-internal-options.js.map +0 -1
- package/dist/lib/internal/utils/normalize-entrypoint.js.map +0 -1
- package/dist/lib/vite-plugin-zephyr-partial.js.map +0 -1
- package/dist/lib/vite-plugin-zephyr.js.map +0 -1
- package/dist/package.json +0 -85
- package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -56,6 +56,50 @@ export default defineConfig({
|
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
### Multi-Environment and SSR Builds
|
|
60
|
+
|
|
61
|
+
Vite 6, 7, and 8 environment builds are collected across `client`, `server`, RSC, or custom
|
|
62
|
+
child environments and published once after `buildApp` completes. The plugin validates
|
|
63
|
+
that each current environment contributed output; persisted partial-build contributions
|
|
64
|
+
are merged atomically. Vite 5 and watch builds use the direct single-environment upload
|
|
65
|
+
path.
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
withZephyr({
|
|
69
|
+
snapshotType: 'ssr',
|
|
70
|
+
entrypoint: 'server/index.mjs',
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- `snapshotType` overrides automatic CSR/SSR detection.
|
|
75
|
+
- `entrypoint` is relative to the shared snapshot root and is required when an SSR entry
|
|
76
|
+
cannot be inferred.
|
|
77
|
+
|
|
78
|
+
For intentionally separate Vite invocations, use `withZephyrPartial()` in producer
|
|
79
|
+
configs and `withZephyr()` in the final config. Give every producer and finalizer the
|
|
80
|
+
same `invocationId` (or set `ZE_BUILD_INVOCATION_ID`). To derive that identity from a
|
|
81
|
+
supported CI job, explicitly pass `partialBuild: {}` to the finalizer; an ordinary
|
|
82
|
+
`withZephyr()` build ignores ambient CI metadata. The plugin fails closed when a producer
|
|
83
|
+
has no shared build identity. Partial maps are isolated by invocation and generation,
|
|
84
|
+
protected by an inter-process lock, and claimed transactionally. Commit removes only
|
|
85
|
+
unchanged claimed revisions, while rollback releases the claim without overwriting a
|
|
86
|
+
newer concurrent write.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
withZephyrPartial({ invocationId: process.env.BUILD_ID });
|
|
90
|
+
withZephyr({ partialBuild: { invocationId: process.env.BUILD_ID } });
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
For builds with no user-defined `base`, the plugin defaults Vite to `./`. Relative build
|
|
94
|
+
asset URLs work for hostname deployments and allow Zephyr to add a path prefix later.
|
|
95
|
+
Explicit bases are preserved; an origin-absolute base such as `/docs/` produces a warning
|
|
96
|
+
when the application or one of its environments uses path addressing because that URL
|
|
97
|
+
cannot be relocated under another prefix.
|
|
98
|
+
|
|
99
|
+
This build-time default does not by itself make deep SSR/RSC routes prefix-aware. Runtime
|
|
100
|
+
HTML generation must still resolve asset URLs against the request/deployment base. The
|
|
101
|
+
specialized TanStack Start and Vinext plugins coordinate that runtime output separately.
|
|
102
|
+
|
|
59
103
|
### With Module Federation
|
|
60
104
|
|
|
61
105
|
For microfrontend applications using Module Federation:
|
|
@@ -157,7 +201,7 @@ Add these scripts to your `package.json`:
|
|
|
157
201
|
|
|
158
202
|
## Requirements
|
|
159
203
|
|
|
160
|
-
- Vite 5.x, 6.x, or
|
|
204
|
+
- Vite 5.x, 6.x, 7.x, or 8.x
|
|
161
205
|
- Rollup 4.x
|
|
162
206
|
- Node.js version supported by your Vite toolchain
|
|
163
207
|
- Zephyr Cloud account (sign up at [zephyr-cloud.io](https://zephyr-cloud.io))
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { withZephyr } from './lib/vite-plugin-zephyr.mjs';
|
|
2
|
+
export { withZephyrPartial } from './lib/vite-plugin-zephyr-partial.mjs';
|
|
3
|
+
export type { WithZephyrOptions } from './lib/vite-plugin-zephyr.mjs';
|
|
4
|
+
export type { VitePartialBuildOptions } from './lib/internal/partial-build-scope.mjs';
|
|
5
|
+
export type { ModuleFederationOptions } from './lib/internal/mf-vite-etl/ensure_runtime_plugin.mjs';
|
|
6
|
+
export type { ZephyrBuildHooks, DeploymentInfo } from 'zephyr-agent';
|
|
7
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export { withZephyr } from './lib/vite-plugin-zephyr';
|
|
2
2
|
export { withZephyrPartial } from './lib/vite-plugin-zephyr-partial';
|
|
3
|
+
export type { WithZephyrOptions } from './lib/vite-plugin-zephyr';
|
|
4
|
+
export type { VitePartialBuildOptions } from './lib/internal/partial-build-scope';
|
|
5
|
+
export type { ModuleFederationOptions } from './lib/internal/mf-vite-etl/ensure_runtime_plugin';
|
|
3
6
|
export type { ZephyrBuildHooks, DeploymentInfo } from 'zephyr-agent';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
withZephyr: ()=>vite_plugin_zephyr_js_namespaceObject.withZephyr,
|
|
32
|
+
withZephyrPartial: ()=>vite_plugin_zephyr_partial_js_namespaceObject.withZephyrPartial
|
|
33
|
+
});
|
|
34
|
+
const vite_plugin_zephyr_js_namespaceObject = require("./lib/vite-plugin-zephyr.js");
|
|
35
|
+
const vite_plugin_zephyr_partial_js_namespaceObject = require("./lib/vite-plugin-zephyr-partial.js");
|
|
36
|
+
exports.withZephyr = __webpack_exports__.withZephyr;
|
|
37
|
+
exports.withZephyrPartial = __webpack_exports__.withZephyrPartial;
|
|
38
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
39
|
+
"withZephyr",
|
|
40
|
+
"withZephyrPartial"
|
|
41
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
42
|
+
Object.defineProperty(exports, '__esModule', {
|
|
43
|
+
value: true
|
|
44
|
+
});
|
|
45
|
+
|
|
8
46
|
//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ResolvedConfig } from 'vite' with { 'resolution-mode': 'import' };
|
|
2
|
+
/**
|
|
3
|
+
* Extracts and normalizes the entrypoint from Vite config.
|
|
4
|
+
*
|
|
5
|
+
* Priority order:
|
|
6
|
+
*
|
|
7
|
+
* 1. Config.build.rollupOptions.input (auto-detected)
|
|
8
|
+
* 2. 'index.html' (Vite default)
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractEntrypoint(config: ResolvedConfig): string;
|
|
11
|
+
//# sourceMappingURL=extract-entrypoint.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResolvedConfig } from 'vite';
|
|
1
|
+
import type { ResolvedConfig } from 'vite' with { 'resolution-mode': 'import' };
|
|
2
2
|
/**
|
|
3
3
|
* Extracts and normalizes the entrypoint from Vite config.
|
|
4
4
|
*
|
|
@@ -8,3 +8,4 @@ import type { ResolvedConfig } from 'vite';
|
|
|
8
8
|
* 2. 'index.html' (Vite default)
|
|
9
9
|
*/
|
|
10
10
|
export declare function extractEntrypoint(config: ResolvedConfig): string;
|
|
11
|
+
//# sourceMappingURL=extract-entrypoint.d.ts.map
|
|
@@ -1,54 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
extractEntrypoint: ()=>extractEntrypoint
|
|
32
|
+
});
|
|
33
|
+
const external_zephyr_agent_namespaceObject = require("zephyr-agent");
|
|
34
|
+
const normalize_entrypoint_js_namespaceObject = require("../utils/normalize-entrypoint.js");
|
|
14
35
|
function extractEntrypoint(config) {
|
|
15
|
-
|
|
16
|
-
// Priority 1: Extract from Vite config
|
|
17
|
-
const input = (_b = (_a = config.build) === null || _a === void 0 ? void 0 : _a.rollupOptions) === null || _b === void 0 ? void 0 : _b.input;
|
|
36
|
+
const input = config.build?.rollupOptions?.input;
|
|
18
37
|
if (input) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return (0, normalize_entrypoint_1.normalizeEntrypoint)(input);
|
|
38
|
+
if ('string' == typeof input) {
|
|
39
|
+
external_zephyr_agent_namespaceObject.ze_log.init(`Detected entrypoint from Vite config: ${input}`);
|
|
40
|
+
return (0, normalize_entrypoint_js_namespaceObject.normalizeEntrypoint)(input);
|
|
23
41
|
}
|
|
24
|
-
|
|
25
|
-
if (typeof input === 'object' && !Array.isArray(input)) {
|
|
42
|
+
if ('object' == typeof input && !Array.isArray(input)) {
|
|
26
43
|
const entries = Object.entries(input);
|
|
27
44
|
if (entries.length > 0) {
|
|
28
45
|
const [firstKey, firstValue] = entries[0];
|
|
29
|
-
if (entries.length > 1) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
else {
|
|
33
|
-
zephyr_agent_1.ze_log.init(`Detected entrypoint from Vite config: ${firstKey} -> ${firstValue}`);
|
|
34
|
-
}
|
|
35
|
-
return (0, normalize_entrypoint_1.normalizeEntrypoint)(String(firstValue));
|
|
46
|
+
if (entries.length > 1) external_zephyr_agent_namespaceObject.ze_log.init(`Multiple entrypoints detected (${entries.length}). Using first: ${firstKey} -> ${firstValue}`);
|
|
47
|
+
else external_zephyr_agent_namespaceObject.ze_log.init(`Detected entrypoint from Vite config: ${firstKey} -> ${firstValue}`);
|
|
48
|
+
return (0, normalize_entrypoint_js_namespaceObject.normalizeEntrypoint)(String(firstValue));
|
|
36
49
|
}
|
|
37
50
|
}
|
|
38
|
-
// Case: Array input (rare, but possible)
|
|
39
51
|
if (Array.isArray(input) && input.length > 0) {
|
|
40
52
|
const firstEntry = input[0];
|
|
41
|
-
if (input.length > 1) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
else {
|
|
45
|
-
zephyr_agent_1.ze_log.init(`Detected entrypoint from Vite config: ${firstEntry}`);
|
|
46
|
-
}
|
|
47
|
-
return (0, normalize_entrypoint_1.normalizeEntrypoint)(String(firstEntry));
|
|
53
|
+
if (input.length > 1) external_zephyr_agent_namespaceObject.ze_log.init(`Multiple entrypoints detected (${input.length}). Using first: ${firstEntry}`);
|
|
54
|
+
else external_zephyr_agent_namespaceObject.ze_log.init(`Detected entrypoint from Vite config: ${firstEntry}`);
|
|
55
|
+
return (0, normalize_entrypoint_js_namespaceObject.normalizeEntrypoint)(String(firstEntry));
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
|
-
|
|
51
|
-
zephyr_agent_1.ze_log.init('No entrypoint specified, using Vite default: index.html');
|
|
58
|
+
external_zephyr_agent_namespaceObject.ze_log.init('No entrypoint specified, using Vite default: index.html');
|
|
52
59
|
return 'index.html';
|
|
53
60
|
}
|
|
61
|
+
exports.extractEntrypoint = __webpack_exports__.extractEntrypoint;
|
|
62
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
63
|
+
"extractEntrypoint"
|
|
64
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
65
|
+
Object.defineProperty(exports, '__esModule', {
|
|
66
|
+
value: true
|
|
67
|
+
});
|
|
68
|
+
|
|
54
69
|
//# sourceMappingURL=extract-entrypoint.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { ze_log } from "zephyr-agent";
|
|
3
|
+
import { normalizeEntrypoint } from "../utils/normalize-entrypoint.mjs";
|
|
4
|
+
function extractEntrypoint(config) {
|
|
5
|
+
const input = config.build?.rollupOptions?.input;
|
|
6
|
+
if (input) {
|
|
7
|
+
if ('string' == typeof input) {
|
|
8
|
+
ze_log.init(`Detected entrypoint from Vite config: ${input}`);
|
|
9
|
+
return normalizeEntrypoint(input);
|
|
10
|
+
}
|
|
11
|
+
if ('object' == typeof input && !Array.isArray(input)) {
|
|
12
|
+
const entries = Object.entries(input);
|
|
13
|
+
if (entries.length > 0) {
|
|
14
|
+
const [firstKey, firstValue] = entries[0];
|
|
15
|
+
if (entries.length > 1) ze_log.init(`Multiple entrypoints detected (${entries.length}). Using first: ${firstKey} -> ${firstValue}`);
|
|
16
|
+
else ze_log.init(`Detected entrypoint from Vite config: ${firstKey} -> ${firstValue}`);
|
|
17
|
+
return normalizeEntrypoint(String(firstValue));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(input) && input.length > 0) {
|
|
21
|
+
const firstEntry = input[0];
|
|
22
|
+
if (input.length > 1) ze_log.init(`Multiple entrypoints detected (${input.length}). Using first: ${firstEntry}`);
|
|
23
|
+
else ze_log.init(`Detected entrypoint from Vite config: ${firstEntry}`);
|
|
24
|
+
return normalizeEntrypoint(String(firstEntry));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
ze_log.init('No entrypoint specified, using Vite default: index.html');
|
|
28
|
+
return 'index.html';
|
|
29
|
+
}
|
|
30
|
+
export { extractEntrypoint };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=extract-entrypoint.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Plugin, PluginOption } from 'vite' with {
|
|
2
|
+
'resolution-mode': 'import'
|
|
3
|
+
};
|
|
4
|
+
import type { ModuleFederationOptions } from '../mf-vite-etl/ensure_runtime_plugin.mjs';
|
|
5
|
+
export interface ViteMFPlugin {
|
|
6
|
+
_options: ModuleFederationOptions;
|
|
7
|
+
}
|
|
8
|
+
export declare function extract_mf_plugins(plugins: readonly PluginOption[]): Array<Plugin & ViteMFPlugin>;
|
|
9
|
+
export declare function extract_mf_plugin(plugins: readonly PluginOption[]): Plugin<any> & ViteMFPlugin;
|
|
10
|
+
//# sourceMappingURL=extract_mf_plugin.d.mts.map
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import type { Plugin, PluginOption } from 'vite'
|
|
1
|
+
import type { Plugin, PluginOption } from 'vite' with {
|
|
2
|
+
'resolution-mode': 'import'
|
|
3
|
+
};
|
|
2
4
|
import type { ModuleFederationOptions } from '../mf-vite-etl/ensure_runtime_plugin';
|
|
3
5
|
export interface ViteMFPlugin {
|
|
4
6
|
_options: ModuleFederationOptions;
|
|
5
7
|
}
|
|
6
|
-
export declare function
|
|
8
|
+
export declare function extract_mf_plugins(plugins: readonly PluginOption[]): Array<Plugin & ViteMFPlugin>;
|
|
9
|
+
export declare function extract_mf_plugin(plugins: readonly PluginOption[]): Plugin<any> & ViteMFPlugin;
|
|
10
|
+
//# sourceMappingURL=extract_mf_plugin.d.ts.map
|
|
@@ -1,14 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4
30
|
function isPlugin(plugin) {
|
|
5
|
-
return !!plugin && typeof plugin
|
|
31
|
+
return !!plugin && 'object' == typeof plugin && 'name' in plugin;
|
|
6
32
|
}
|
|
7
33
|
function flattenPlugins(plugins) {
|
|
8
|
-
const flatPlugins = plugins.flat(
|
|
34
|
+
const flatPlugins = plugins.flat(1 / 0);
|
|
9
35
|
return flatPlugins.filter(isPlugin);
|
|
10
36
|
}
|
|
37
|
+
function extract_mf_plugins(plugins) {
|
|
38
|
+
return flattenPlugins(plugins).filter((plugin)=>'module-federation-vite' === plugin.name && '_options' in plugin && !!plugin._options);
|
|
39
|
+
}
|
|
11
40
|
function extract_mf_plugin(plugins) {
|
|
12
|
-
return
|
|
41
|
+
return extract_mf_plugins(plugins)[0];
|
|
13
42
|
}
|
|
43
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
44
|
+
extract_mf_plugin: ()=>extract_mf_plugin,
|
|
45
|
+
extract_mf_plugins: ()=>extract_mf_plugins
|
|
46
|
+
});
|
|
47
|
+
exports.extract_mf_plugin = __webpack_exports__.extract_mf_plugin;
|
|
48
|
+
exports.extract_mf_plugins = __webpack_exports__.extract_mf_plugins;
|
|
49
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
50
|
+
"extract_mf_plugin",
|
|
51
|
+
"extract_mf_plugins"
|
|
52
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
53
|
+
Object.defineProperty(exports, '__esModule', {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
56
|
+
|
|
14
57
|
//# sourceMappingURL=extract_mf_plugin.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
function isPlugin(plugin) {
|
|
3
|
+
return !!plugin && 'object' == typeof plugin && 'name' in plugin;
|
|
4
|
+
}
|
|
5
|
+
function flattenPlugins(plugins) {
|
|
6
|
+
const flatPlugins = plugins.flat(1 / 0);
|
|
7
|
+
return flatPlugins.filter(isPlugin);
|
|
8
|
+
}
|
|
9
|
+
function extract_mf_plugins(plugins) {
|
|
10
|
+
return flattenPlugins(plugins).filter((plugin)=>'module-federation-vite' === plugin.name && '_options' in plugin && !!plugin._options);
|
|
11
|
+
}
|
|
12
|
+
function extract_mf_plugin(plugins) {
|
|
13
|
+
return extract_mf_plugins(plugins)[0];
|
|
14
|
+
}
|
|
15
|
+
export { extract_mf_plugin, extract_mf_plugins };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=extract_mf_plugin.mjs.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ZeBuildAssetsMap, type ZephyrEngine } from 'zephyr-agent';
|
|
2
|
+
import type { ZephyrInternalOptions } from '../types/zephyr-internal-options.mjs';
|
|
3
|
+
export declare function extract_vite_assets_map(_zephyr_engine: ZephyrEngine, vite_internal_options: ZephyrInternalOptions): Promise<ZeBuildAssetsMap>;
|
|
4
|
+
//# sourceMappingURL=extract_vite_assets_map.d.mts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type ZeBuildAssetsMap, type ZephyrEngine } from 'zephyr-agent';
|
|
2
2
|
import type { ZephyrInternalOptions } from '../types/zephyr-internal-options';
|
|
3
|
-
export declare function extract_vite_assets_map(
|
|
3
|
+
export declare function extract_vite_assets_map(_zephyr_engine: ZephyrEngine, vite_internal_options: ZephyrInternalOptions): Promise<ZeBuildAssetsMap>;
|
|
4
|
+
//# sourceMappingURL=extract_vite_assets_map.d.ts.map
|
|
@@ -1,56 +1,86 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
extract_vite_assets_map: ()=>extract_vite_assets_map
|
|
32
|
+
});
|
|
33
|
+
const external_zephyr_agent_namespaceObject = require("zephyr-agent");
|
|
34
|
+
const external_load_static_assets_js_namespaceObject = require("./load_static_assets.js");
|
|
35
|
+
const external_merge_vite_output_assets_js_namespaceObject = require("./merge_vite_output_assets.js");
|
|
36
|
+
async function extract_vite_assets_map(_zephyr_engine, vite_internal_options) {
|
|
37
|
+
const assets = await (0, external_load_static_assets_js_namespaceObject.loadStaticAssets)(vite_internal_options);
|
|
11
38
|
const runtime_assets = vite_internal_options.assets;
|
|
12
|
-
const complete_assets =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
39
|
+
const complete_assets = {
|
|
40
|
+
...assets
|
|
41
|
+
};
|
|
42
|
+
(0, external_merge_vite_output_assets_js_namespaceObject.mergeViteOutputAssets)(complete_assets, Object.entries(runtime_assets ?? {}), {
|
|
43
|
+
target: vite_internal_options.target
|
|
44
|
+
});
|
|
45
|
+
const filtered_assets = Object.fromEntries(Object.entries(complete_assets).map(toRollupOutputEntry).filter((entry)=>null !== entry));
|
|
46
|
+
return (0, external_zephyr_agent_namespaceObject.buildAssetsMap)(filtered_assets, extractBuffer, getAssetType);
|
|
17
47
|
}
|
|
18
48
|
function shouldSkipAsset(assetPath) {
|
|
19
49
|
return /(^|\/)\.vite-inspect(\/|$)/.test(assetPath);
|
|
20
50
|
}
|
|
21
|
-
function
|
|
22
|
-
if (!asset || typeof asset
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return
|
|
51
|
+
function isBundlerOutput(asset) {
|
|
52
|
+
if (!asset || 'object' != typeof asset || !('type' in asset)) return false;
|
|
53
|
+
if ('chunk' === asset.type) return 'code' in asset && 'string' == typeof asset.code;
|
|
54
|
+
if ('asset' === asset.type && 'source' in asset) return 'string' == typeof asset.source || asset.source instanceof Uint8Array;
|
|
55
|
+
return false;
|
|
26
56
|
}
|
|
27
57
|
function toRollupOutputEntry([assetPath, asset]) {
|
|
28
|
-
if (shouldSkipAsset(assetPath) || !
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
58
|
+
if (shouldSkipAsset(assetPath) || !isBundlerOutput(asset)) return null;
|
|
59
|
+
return [
|
|
60
|
+
assetPath,
|
|
61
|
+
asset
|
|
62
|
+
];
|
|
32
63
|
}
|
|
33
64
|
function getAssetType(asset) {
|
|
34
65
|
return asset.type;
|
|
35
66
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Extracts buffer content from Rollup assets.
|
|
38
|
-
*
|
|
39
|
-
* @param asset - Output chunk or asset from Rollup
|
|
40
|
-
* @returns String for text-based chunks, Buffer for binary assets, undefined for unknown
|
|
41
|
-
* types
|
|
42
|
-
*/
|
|
43
67
|
function extractBuffer(asset) {
|
|
44
|
-
switch
|
|
68
|
+
switch(asset.type){
|
|
45
69
|
case 'chunk':
|
|
46
70
|
return asset.code;
|
|
47
71
|
case 'asset':
|
|
48
|
-
if (typeof asset.source
|
|
49
|
-
return asset.source;
|
|
50
|
-
}
|
|
72
|
+
if ('string' == typeof asset.source) return asset.source;
|
|
51
73
|
return Buffer.from(asset.source);
|
|
52
74
|
default:
|
|
53
|
-
return
|
|
75
|
+
return;
|
|
54
76
|
}
|
|
55
77
|
}
|
|
78
|
+
exports.extract_vite_assets_map = __webpack_exports__.extract_vite_assets_map;
|
|
79
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
80
|
+
"extract_vite_assets_map"
|
|
81
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
82
|
+
Object.defineProperty(exports, '__esModule', {
|
|
83
|
+
value: true
|
|
84
|
+
});
|
|
85
|
+
|
|
56
86
|
//# sourceMappingURL=extract_vite_assets_map.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { buildAssetsMap } from "zephyr-agent";
|
|
3
|
+
import { loadStaticAssets } from "./load_static_assets.mjs";
|
|
4
|
+
import { mergeViteOutputAssets } from "./merge_vite_output_assets.mjs";
|
|
5
|
+
async function extract_vite_assets_map(_zephyr_engine, vite_internal_options) {
|
|
6
|
+
const assets = await loadStaticAssets(vite_internal_options);
|
|
7
|
+
const runtime_assets = vite_internal_options.assets;
|
|
8
|
+
const complete_assets = {
|
|
9
|
+
...assets
|
|
10
|
+
};
|
|
11
|
+
mergeViteOutputAssets(complete_assets, Object.entries(runtime_assets ?? {}), {
|
|
12
|
+
target: vite_internal_options.target
|
|
13
|
+
});
|
|
14
|
+
const filtered_assets = Object.fromEntries(Object.entries(complete_assets).map(toRollupOutputEntry).filter((entry)=>null !== entry));
|
|
15
|
+
return buildAssetsMap(filtered_assets, extractBuffer, getAssetType);
|
|
16
|
+
}
|
|
17
|
+
function shouldSkipAsset(assetPath) {
|
|
18
|
+
return /(^|\/)\.vite-inspect(\/|$)/.test(assetPath);
|
|
19
|
+
}
|
|
20
|
+
function isBundlerOutput(asset) {
|
|
21
|
+
if (!asset || 'object' != typeof asset || !('type' in asset)) return false;
|
|
22
|
+
if ('chunk' === asset.type) return 'code' in asset && 'string' == typeof asset.code;
|
|
23
|
+
if ('asset' === asset.type && 'source' in asset) return 'string' == typeof asset.source || asset.source instanceof Uint8Array;
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
function toRollupOutputEntry([assetPath, asset]) {
|
|
27
|
+
if (shouldSkipAsset(assetPath) || !isBundlerOutput(asset)) return null;
|
|
28
|
+
return [
|
|
29
|
+
assetPath,
|
|
30
|
+
asset
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
function getAssetType(asset) {
|
|
34
|
+
return asset.type;
|
|
35
|
+
}
|
|
36
|
+
function extractBuffer(asset) {
|
|
37
|
+
switch(asset.type){
|
|
38
|
+
case 'chunk':
|
|
39
|
+
return asset.code;
|
|
40
|
+
case 'asset':
|
|
41
|
+
if ('string' == typeof asset.source) return asset.source;
|
|
42
|
+
return Buffer.from(asset.source);
|
|
43
|
+
default:
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export { extract_vite_assets_map };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=extract_vite_assets_map.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ZephyrBuildTarget } from 'zephyr-agent';
|
|
2
|
+
import type { ZephyrOutputAsset } from '../types/zephyr-output.mjs';
|
|
3
|
+
interface LoadPublicDirOptions {
|
|
4
|
+
outDir: string;
|
|
5
|
+
publicDir: string;
|
|
6
|
+
target?: ZephyrBuildTarget;
|
|
7
|
+
}
|
|
8
|
+
export declare function load_public_dir({ publicDir, outDir, target, }: LoadPublicDirOptions): Promise<ZephyrOutputAsset[]>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=load_public_dir.d.mts.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ZephyrBuildTarget } from 'zephyr-agent';
|
|
2
|
+
import type { ZephyrOutputAsset } from '../types/zephyr-output';
|
|
2
3
|
interface LoadPublicDirOptions {
|
|
3
4
|
outDir: string;
|
|
4
5
|
publicDir: string;
|
|
6
|
+
target?: ZephyrBuildTarget;
|
|
5
7
|
}
|
|
6
|
-
export declare function load_public_dir({ publicDir, outDir, }: LoadPublicDirOptions): Promise<
|
|
8
|
+
export declare function load_public_dir({ publicDir, outDir, target, }: LoadPublicDirOptions): Promise<ZephyrOutputAsset[]>;
|
|
7
9
|
export {};
|
|
10
|
+
//# sourceMappingURL=load_public_dir.d.ts.map
|