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
|
@@ -1,176 +1,85 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zephyr Runtime Plugin for Module Federation. This file MUST stay in ESM
|
|
3
|
-
* format (.mjs) for Vite/Rollup compatibility.
|
|
4
|
-
*
|
|
5
|
-
* Keep this runtime logic aligned with the xpack runtime plugin at
|
|
6
|
-
* `libs/zephyr-xpack-internal/src/xpack-extract/runtime-plugin.ts`.
|
|
7
|
-
*
|
|
8
|
-
* We intentionally duplicate logic in both plugins for now. Once zephyr-agent
|
|
9
|
-
* supports ESM runtime exports, we can move to a shared runtime
|
|
10
|
-
* implementation.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
1
|
const globalCacheKey = '__ZEPHYR_MANIFEST_CACHE__';
|
|
14
|
-
const _global = typeof window
|
|
15
|
-
|
|
2
|
+
const _global = "u" > typeof window ? window : globalThis;
|
|
16
3
|
function getGlobalManifestCache() {
|
|
17
|
-
|
|
18
|
-
_global[globalCacheKey]
|
|
19
|
-
}
|
|
20
|
-
return _global[globalCacheKey];
|
|
4
|
+
if (!_global[globalCacheKey]) _global[globalCacheKey] = new Map();
|
|
5
|
+
return _global[globalCacheKey];
|
|
21
6
|
}
|
|
22
|
-
|
|
23
7
|
function getScriptBaseUrl() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} catch
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return '';
|
|
8
|
+
if ("u" > typeof document && document.currentScript) try {
|
|
9
|
+
const src = document.currentScript.src;
|
|
10
|
+
if (src) {
|
|
11
|
+
const url = new URL(src);
|
|
12
|
+
const routeBase = /^\/__zephyr\/v1\/[vte]\/[^/]+/.exec(url.pathname);
|
|
13
|
+
return routeBase ? `${url.origin}${routeBase[0]}` : url.origin;
|
|
14
|
+
}
|
|
15
|
+
} catch {}
|
|
16
|
+
return '';
|
|
37
17
|
}
|
|
38
|
-
|
|
39
18
|
function getRemotes(args) {
|
|
40
|
-
|
|
41
|
-
return args.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (Array.isArray(args?.userOptions?.remotes)) {
|
|
45
|
-
return args.userOptions.remotes;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return [];
|
|
19
|
+
if (Array.isArray(args?.options?.remotes)) return args.options.remotes;
|
|
20
|
+
if (Array.isArray(args?.userOptions?.remotes)) return args.userOptions.remotes;
|
|
21
|
+
return [];
|
|
49
22
|
}
|
|
50
|
-
|
|
51
23
|
export default function createZephyrRuntimePlugin(options = {}) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (!manifest) {
|
|
68
|
-
console.error('[Zephyr] Failed to parse manifest JSON');
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return manifest;
|
|
73
|
-
} catch (error) {
|
|
74
|
-
console.error('[Zephyr] Unexpected error fetching manifest:', error);
|
|
75
|
-
return;
|
|
24
|
+
const defaultManifestUrl = `${getScriptBaseUrl()}/zephyr-manifest.json`;
|
|
25
|
+
const { manifestUrl = defaultManifestUrl } = options;
|
|
26
|
+
let processedRemotes;
|
|
27
|
+
async function fetchManifest(url) {
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(url);
|
|
30
|
+
if (!response.ok) return;
|
|
31
|
+
const manifest = await response.json().catch(()=>void 0);
|
|
32
|
+
if (!manifest) return void console.error('[Zephyr] Failed to parse manifest JSON');
|
|
33
|
+
return manifest;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error('[Zephyr] Unexpected error fetching manifest:', error);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
76
38
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const remoteName =
|
|
97
|
-
typeof args?.id === 'string' ? args.id.split('/')[0] : undefined;
|
|
98
|
-
|
|
99
|
-
if (!remoteName || !processedRemotes[remoteName]) {
|
|
100
|
-
return args;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const resolvedUrl = getResolvedRemoteUrl(processedRemotes[remoteName]);
|
|
104
|
-
const remotes = getRemotes(args);
|
|
105
|
-
|
|
106
|
-
const targetRemote = remotes.find(
|
|
107
|
-
(remote) =>
|
|
108
|
-
hasEntry(remote) &&
|
|
109
|
-
(remote.name === remoteName || remote.alias === remoteName)
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
if (!targetRemote) {
|
|
113
|
-
return args;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
targetRemote.entry = resolvedUrl;
|
|
117
|
-
|
|
118
|
-
return args;
|
|
119
|
-
},
|
|
120
|
-
};
|
|
39
|
+
const manifestCache = getGlobalManifestCache();
|
|
40
|
+
if (!manifestCache.has(manifestUrl)) manifestCache.set(manifestUrl, fetchManifest(manifestUrl));
|
|
41
|
+
const zephyrManifestPromise = manifestCache.get(manifestUrl);
|
|
42
|
+
return {
|
|
43
|
+
name: 'zephyr-runtime-remote-resolver',
|
|
44
|
+
async beforeRequest (args) {
|
|
45
|
+
const zephyrManifest = await zephyrManifestPromise;
|
|
46
|
+
if (!processedRemotes) processedRemotes = identifyRemotes(args, zephyrManifest);
|
|
47
|
+
const remoteName = 'string' == typeof args?.id ? args.id.split('/')[0] : void 0;
|
|
48
|
+
if (!remoteName || !processedRemotes[remoteName]) return args;
|
|
49
|
+
const resolvedUrl = getResolvedRemoteUrl(processedRemotes[remoteName]);
|
|
50
|
+
const remotes = getRemotes(args);
|
|
51
|
+
const targetRemote = remotes.find((remote)=>hasEntry(remote) && (remote.name === remoteName || remote.alias === remoteName));
|
|
52
|
+
if (!targetRemote) return args;
|
|
53
|
+
targetRemote.entry = resolvedUrl;
|
|
54
|
+
return args;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
121
57
|
}
|
|
122
|
-
|
|
123
58
|
function identifyRemotes(args, zephyrManifest) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return identifiedRemotes;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
59
|
+
const identifiedRemotes = {};
|
|
60
|
+
if (!zephyrManifest) return identifiedRemotes;
|
|
61
|
+
const remotes = getRemotes(args);
|
|
62
|
+
if (!remotes.length) return identifiedRemotes;
|
|
63
|
+
const dependencies = zephyrManifest.dependencies ?? {};
|
|
64
|
+
remotes.forEach((remote)=>{
|
|
65
|
+
const resolvedRemote = dependencies[remote.name] ?? dependencies[remote.alias ?? ''];
|
|
66
|
+
if (resolvedRemote) {
|
|
67
|
+
identifiedRemotes[remote.name] = resolvedRemote;
|
|
68
|
+
if (remote.alias && remote.alias !== remote.name) identifiedRemotes[remote.alias] = resolvedRemote;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
132
71
|
return identifiedRemotes;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const dependencies = zephyrManifest.dependencies ?? {};
|
|
136
|
-
|
|
137
|
-
remotes.forEach((remote) => {
|
|
138
|
-
const resolvedRemote =
|
|
139
|
-
dependencies[remote.name] ?? dependencies[remote.alias ?? ''];
|
|
140
|
-
if (resolvedRemote) {
|
|
141
|
-
identifiedRemotes[remote.name] = resolvedRemote;
|
|
142
|
-
if (remote.alias && remote.alias !== remote.name) {
|
|
143
|
-
identifiedRemotes[remote.alias] = resolvedRemote;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
return identifiedRemotes;
|
|
149
72
|
}
|
|
150
|
-
|
|
151
73
|
function hasEntry(remote) {
|
|
152
|
-
|
|
153
|
-
remote !== null &&
|
|
154
|
-
remote !== undefined &&
|
|
155
|
-
typeof remote === 'object' &&
|
|
156
|
-
'entry' in remote &&
|
|
157
|
-
typeof remote.entry === 'string'
|
|
158
|
-
);
|
|
74
|
+
return null != remote && 'object' == typeof remote && 'entry' in remote && 'string' == typeof remote.entry;
|
|
159
75
|
}
|
|
160
|
-
|
|
161
76
|
function getResolvedRemoteUrl(resolvedRemote) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (edgeUrl.indexOf('@') !== -1) {
|
|
171
|
-
const [, url] = edgeUrl.split('@');
|
|
172
|
-
edgeUrl = url;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return edgeUrl;
|
|
77
|
+
const _window = "u" > typeof window ? window : globalThis;
|
|
78
|
+
const sessionEdgeURL = _window.sessionStorage?.getItem?.(resolvedRemote.application_uid);
|
|
79
|
+
let edgeUrl = sessionEdgeURL ?? resolvedRemote.remote_entry_url;
|
|
80
|
+
if (-1 !== edgeUrl.indexOf('@')) {
|
|
81
|
+
const [, url] = edgeUrl.split('@');
|
|
82
|
+
edgeUrl = url;
|
|
83
|
+
}
|
|
84
|
+
return edgeUrl;
|
|
176
85
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PartialAssetMapScope, ZephyrBuildTarget } from 'zephyr-agent';
|
|
2
|
+
export interface VitePartialBuildOptions {
|
|
3
|
+
/** Artifact family for this independent producer process. */
|
|
4
|
+
target?: ZephyrBuildTarget;
|
|
5
|
+
/** Shared by every producer and finalizer process for one logical build. */
|
|
6
|
+
invocationId?: string;
|
|
7
|
+
/** Rebuild generation within the invocation (default: 0). */
|
|
8
|
+
generation?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function resolveVitePartialBuildScope(options: VitePartialBuildOptions | undefined, env?: NodeJS.ProcessEnv): PartialAssetMapScope | undefined;
|
|
11
|
+
export declare function requireVitePartialBuildScope(options: VitePartialBuildOptions | undefined): PartialAssetMapScope;
|
|
12
|
+
//# sourceMappingURL=partial-build-scope.d.mts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PartialAssetMapScope, ZephyrBuildTarget } from 'zephyr-agent';
|
|
2
|
+
export interface VitePartialBuildOptions {
|
|
3
|
+
/** Artifact family for this independent producer process. */
|
|
4
|
+
target?: ZephyrBuildTarget;
|
|
5
|
+
/** Shared by every producer and finalizer process for one logical build. */
|
|
6
|
+
invocationId?: string;
|
|
7
|
+
/** Rebuild generation within the invocation (default: 0). */
|
|
8
|
+
generation?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function resolveVitePartialBuildScope(options: VitePartialBuildOptions | undefined, env?: NodeJS.ProcessEnv): PartialAssetMapScope | undefined;
|
|
11
|
+
export declare function requireVitePartialBuildScope(options: VitePartialBuildOptions | undefined): PartialAssetMapScope;
|
|
12
|
+
//# sourceMappingURL=partial-build-scope.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
requireVitePartialBuildScope: ()=>requireVitePartialBuildScope,
|
|
32
|
+
resolveVitePartialBuildScope: ()=>resolveVitePartialBuildScope
|
|
33
|
+
});
|
|
34
|
+
const external_zephyr_agent_namespaceObject = require("zephyr-agent");
|
|
35
|
+
function firstDefined(parts) {
|
|
36
|
+
return parts.every((part)=>!!part) ? parts.join(':') : void 0;
|
|
37
|
+
}
|
|
38
|
+
function resolveCiInvocationId(env) {
|
|
39
|
+
return firstDefined([
|
|
40
|
+
env['GITHUB_RUN_ID'],
|
|
41
|
+
env['GITHUB_RUN_ATTEMPT'] ?? '1',
|
|
42
|
+
env['GITHUB_JOB']
|
|
43
|
+
]) ?? firstDefined([
|
|
44
|
+
env['CI_PIPELINE_ID'],
|
|
45
|
+
env['CI_JOB_ID']
|
|
46
|
+
]) ?? firstDefined([
|
|
47
|
+
env['BUILDKITE_BUILD_ID'],
|
|
48
|
+
env['BUILDKITE_JOB_ID']
|
|
49
|
+
]) ?? firstDefined([
|
|
50
|
+
env['CIRCLE_WORKFLOW_ID'],
|
|
51
|
+
env['CIRCLE_BUILD_NUM']
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
function resolveVitePartialBuildScope(options, env = process.env) {
|
|
55
|
+
const invocationId = options?.invocationId?.trim() || env['ZE_BUILD_INVOCATION_ID']?.trim() || resolveCiInvocationId(env);
|
|
56
|
+
if (!invocationId) return;
|
|
57
|
+
const generation = options?.generation ?? 0;
|
|
58
|
+
if (!Number.isSafeInteger(generation) || generation < 0) throw new external_zephyr_agent_namespaceObject.ZephyrError(external_zephyr_agent_namespaceObject.ZeErrors.ERR_DEPLOY_LOCAL_BUILD, {
|
|
59
|
+
message: 'Vite partial build generation must be a non-negative safe integer.'
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
invocationId,
|
|
63
|
+
generation
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function requireVitePartialBuildScope(options) {
|
|
67
|
+
const scope = resolveVitePartialBuildScope(options);
|
|
68
|
+
if (scope) return scope;
|
|
69
|
+
throw new external_zephyr_agent_namespaceObject.ZephyrError(external_zephyr_agent_namespaceObject.ZeErrors.ERR_DEPLOY_LOCAL_BUILD, {
|
|
70
|
+
message: "withZephyrPartial() requires a shared invocationId (or ZE_BUILD_INVOCATION_ID) so concurrent builds of the same application cannot mix outputs."
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.requireVitePartialBuildScope = __webpack_exports__.requireVitePartialBuildScope;
|
|
74
|
+
exports.resolveVitePartialBuildScope = __webpack_exports__.resolveVitePartialBuildScope;
|
|
75
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
76
|
+
"requireVitePartialBuildScope",
|
|
77
|
+
"resolveVitePartialBuildScope"
|
|
78
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
79
|
+
Object.defineProperty(exports, '__esModule', {
|
|
80
|
+
value: true
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=partial-build-scope.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { ZeErrors, ZephyrError } from "zephyr-agent";
|
|
3
|
+
function firstDefined(parts) {
|
|
4
|
+
return parts.every((part)=>!!part) ? parts.join(':') : void 0;
|
|
5
|
+
}
|
|
6
|
+
function resolveCiInvocationId(env) {
|
|
7
|
+
return firstDefined([
|
|
8
|
+
env['GITHUB_RUN_ID'],
|
|
9
|
+
env['GITHUB_RUN_ATTEMPT'] ?? '1',
|
|
10
|
+
env['GITHUB_JOB']
|
|
11
|
+
]) ?? firstDefined([
|
|
12
|
+
env['CI_PIPELINE_ID'],
|
|
13
|
+
env['CI_JOB_ID']
|
|
14
|
+
]) ?? firstDefined([
|
|
15
|
+
env['BUILDKITE_BUILD_ID'],
|
|
16
|
+
env['BUILDKITE_JOB_ID']
|
|
17
|
+
]) ?? firstDefined([
|
|
18
|
+
env['CIRCLE_WORKFLOW_ID'],
|
|
19
|
+
env['CIRCLE_BUILD_NUM']
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
function resolveVitePartialBuildScope(options, env = process.env) {
|
|
23
|
+
const invocationId = options?.invocationId?.trim() || env['ZE_BUILD_INVOCATION_ID']?.trim() || resolveCiInvocationId(env);
|
|
24
|
+
if (!invocationId) return;
|
|
25
|
+
const generation = options?.generation ?? 0;
|
|
26
|
+
if (!Number.isSafeInteger(generation) || generation < 0) throw new ZephyrError(ZeErrors.ERR_DEPLOY_LOCAL_BUILD, {
|
|
27
|
+
message: 'Vite partial build generation must be a non-negative safe integer.'
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
invocationId,
|
|
31
|
+
generation
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function requireVitePartialBuildScope(options) {
|
|
35
|
+
const scope = resolveVitePartialBuildScope(options);
|
|
36
|
+
if (scope) return scope;
|
|
37
|
+
throw new ZephyrError(ZeErrors.ERR_DEPLOY_LOCAL_BUILD, {
|
|
38
|
+
message: "withZephyrPartial() requires a shared invocationId (or ZE_BUILD_INVOCATION_ID) so concurrent builds of the same application cannot mix outputs."
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { requireVitePartialBuildScope, resolveVitePartialBuildScope };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=partial-build-scope.mjs.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ZephyrBuildTarget } from 'zephyr-agent';
|
|
2
|
+
import type { ZephyrOutputBundle } from './zephyr-output.mjs';
|
|
3
|
+
export interface ZephyrInternalOptions {
|
|
4
|
+
root: string;
|
|
5
|
+
outDir: string;
|
|
6
|
+
/** Artifact family determines whether filesystem reads must preserve ignored paths. */
|
|
7
|
+
target?: ZephyrBuildTarget;
|
|
8
|
+
configFile?: string;
|
|
9
|
+
publicDir?: string;
|
|
10
|
+
dir?: string;
|
|
11
|
+
assets?: ZephyrOutputBundle;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=zephyr-internal-options.d.mts.map
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ZephyrBuildTarget } from 'zephyr-agent';
|
|
2
|
+
import type { ZephyrOutputBundle } from './zephyr-output';
|
|
2
3
|
export interface ZephyrInternalOptions {
|
|
3
4
|
root: string;
|
|
4
5
|
outDir: string;
|
|
6
|
+
/** Artifact family determines whether filesystem reads must preserve ignored paths. */
|
|
7
|
+
target?: ZephyrBuildTarget;
|
|
5
8
|
configFile?: string;
|
|
6
9
|
publicDir?: string;
|
|
7
10
|
dir?: string;
|
|
8
|
-
assets?:
|
|
11
|
+
assets?: ZephyrOutputBundle;
|
|
9
12
|
}
|
|
13
|
+
//# sourceMappingURL=zephyr-internal-options.d.ts.map
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
|
|
3
20
|
//# sourceMappingURL=zephyr-internal-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The output fields Zephyr consumes from both Rollup and Rolldown. Keeping this boundary
|
|
3
|
+
* structural lets one plugin build support Vite 5-8.
|
|
4
|
+
*/
|
|
5
|
+
export interface ZephyrOutputChunk {
|
|
6
|
+
type: 'chunk';
|
|
7
|
+
code: string;
|
|
8
|
+
fileName: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ZephyrOutputAsset {
|
|
12
|
+
type: 'asset';
|
|
13
|
+
source: string | Uint8Array;
|
|
14
|
+
fileName: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
names?: string[];
|
|
17
|
+
needsCodeReference?: boolean;
|
|
18
|
+
originalFileName?: string | null;
|
|
19
|
+
originalFileNames?: string[] | null;
|
|
20
|
+
}
|
|
21
|
+
export type ZephyrOutput = ZephyrOutputChunk | ZephyrOutputAsset;
|
|
22
|
+
export type ZephyrOutputBundle = Record<string, ZephyrOutput>;
|
|
23
|
+
//# sourceMappingURL=zephyr-output.d.mts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The output fields Zephyr consumes from both Rollup and Rolldown. Keeping this boundary
|
|
3
|
+
* structural lets one plugin build support Vite 5-8.
|
|
4
|
+
*/
|
|
5
|
+
export interface ZephyrOutputChunk {
|
|
6
|
+
type: 'chunk';
|
|
7
|
+
code: string;
|
|
8
|
+
fileName: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ZephyrOutputAsset {
|
|
12
|
+
type: 'asset';
|
|
13
|
+
source: string | Uint8Array;
|
|
14
|
+
fileName: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
names?: string[];
|
|
17
|
+
needsCodeReference?: boolean;
|
|
18
|
+
originalFileName?: string | null;
|
|
19
|
+
originalFileNames?: string[] | null;
|
|
20
|
+
}
|
|
21
|
+
export type ZephyrOutput = ZephyrOutputChunk | ZephyrOutputAsset;
|
|
22
|
+
export type ZephyrOutputBundle = Record<string, ZephyrOutput>;
|
|
23
|
+
//# sourceMappingURL=zephyr-output.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=zephyr-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "node:module";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes entrypoint paths to be relative and posix-style.
|
|
3
|
+
*
|
|
4
|
+
* - Converts Windows backslashes to forward slashes
|
|
5
|
+
* - Removes leading './', '/', and 'dist/' prefixes
|
|
6
|
+
*
|
|
7
|
+
* @param entrypoint - The raw entrypoint path
|
|
8
|
+
* @returns Normalized entrypoint path relative to build output
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeEntrypoint(entrypoint: string): string;
|
|
11
|
+
//# sourceMappingURL=normalize-entrypoint.d.mts.map
|
|
@@ -1,31 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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__);
|
|
13
30
|
function normalizeEntrypoint(entrypoint) {
|
|
14
31
|
let normalized = entrypoint.trim();
|
|
15
|
-
// Normalize path separators to forward slashes (web/posix style)
|
|
16
32
|
normalized = normalized.split('\\').join('/');
|
|
17
|
-
|
|
18
|
-
while
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
// Remove leading '/'
|
|
22
|
-
while (normalized.startsWith('/')) {
|
|
23
|
-
normalized = normalized.slice(1);
|
|
24
|
-
}
|
|
25
|
-
// Remove 'dist/' prefix if present
|
|
26
|
-
if (normalized.startsWith('dist/')) {
|
|
27
|
-
normalized = normalized.slice('dist/'.length);
|
|
28
|
-
}
|
|
33
|
+
while(normalized.startsWith('./'))normalized = normalized.slice(2);
|
|
34
|
+
while(normalized.startsWith('/'))normalized = normalized.slice(1);
|
|
35
|
+
if (normalized.startsWith('dist/')) normalized = normalized.slice(5);
|
|
29
36
|
return normalized;
|
|
30
37
|
}
|
|
38
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
39
|
+
normalizeEntrypoint: ()=>normalizeEntrypoint
|
|
40
|
+
});
|
|
41
|
+
exports.normalizeEntrypoint = __webpack_exports__.normalizeEntrypoint;
|
|
42
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
43
|
+
"normalizeEntrypoint"
|
|
44
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
45
|
+
Object.defineProperty(exports, '__esModule', {
|
|
46
|
+
value: true
|
|
47
|
+
});
|
|
48
|
+
|
|
31
49
|
//# sourceMappingURL=normalize-entrypoint.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
function normalizeEntrypoint(entrypoint) {
|
|
3
|
+
let normalized = entrypoint.trim();
|
|
4
|
+
normalized = normalized.split('\\').join('/');
|
|
5
|
+
while(normalized.startsWith('./'))normalized = normalized.slice(2);
|
|
6
|
+
while(normalized.startsWith('/'))normalized = normalized.slice(1);
|
|
7
|
+
if (normalized.startsWith('dist/')) normalized = normalized.slice(5);
|
|
8
|
+
return normalized;
|
|
9
|
+
}
|
|
10
|
+
export { normalizeEntrypoint };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=normalize-entrypoint.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Normalize emitted paths without importing Vite's ESM-only runtime. */
|
|
2
|
+
export declare function normalizeVitePath(pathname: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Filesystem walkers return paths using the host separator. Keep that portable
|
|
5
|
+
* normalization separate from logical Rollup/Vite bundle keys: on POSIX, a backslash in a
|
|
6
|
+
* bundle key is an alias character rather than a native separator and TAP must reject it
|
|
7
|
+
* instead of silently changing a descriptor-locked path.
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeFilesystemVitePath(pathname: string): string;
|
|
10
|
+
//# sourceMappingURL=normalize-vite-path.d.mts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Normalize emitted paths without importing Vite's ESM-only runtime. */
|
|
2
|
+
export declare function normalizeVitePath(pathname: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Filesystem walkers return paths using the host separator. Keep that portable
|
|
5
|
+
* normalization separate from logical Rollup/Vite bundle keys: on POSIX, a backslash in a
|
|
6
|
+
* bundle key is an alias character rather than a native separator and TAP must reject it
|
|
7
|
+
* instead of silently changing a descriptor-locked path.
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeFilesystemVitePath(pathname: string): string;
|
|
10
|
+
//# sourceMappingURL=normalize-vite-path.d.ts.map
|