vite-plugin-zephyr 1.2.4 → 1.4.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 +46 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +0 -1
- package/dist/lib/internal/extract/extract-entrypoint.mjs +0 -1
- package/dist/lib/internal/extract/extract_mf_plugin.d.mts +1 -2
- package/dist/lib/internal/extract/extract_mf_plugin.d.ts +2 -3
- package/dist/lib/internal/extract/extract_mf_plugin.mjs +0 -1
- package/dist/lib/internal/extract/extract_vite_assets_map.d.ts +1 -1
- package/dist/lib/internal/extract/extract_vite_assets_map.mjs +0 -1
- package/dist/lib/internal/extract/load_public_dir.d.ts +1 -1
- package/dist/lib/internal/extract/load_public_dir.mjs +0 -1
- package/dist/lib/internal/extract/load_static_assets.d.ts +2 -2
- package/dist/lib/internal/extract/load_static_assets.mjs +0 -1
- package/dist/lib/internal/extract/load_static_entries.d.ts +1 -1
- package/dist/lib/internal/extract/load_static_entries.mjs +0 -1
- package/dist/lib/internal/extract/merge_vite_output_assets.d.ts +1 -1
- package/dist/lib/internal/extract/merge_vite_output_assets.mjs +0 -1
- package/dist/lib/internal/mf-vite-etl/ensure_runtime_plugin.mjs +0 -1
- package/dist/lib/internal/mf-vite-etl/extract-mf-vite-remotes.mjs +0 -1
- package/dist/lib/internal/mf-vite-etl/federation-metadata.d.ts +1 -1
- package/dist/lib/internal/mf-vite-etl/federation-metadata.mjs +0 -1
- package/dist/lib/internal/partial-build-scope.mjs +0 -1
- package/dist/lib/internal/types/zephyr-internal-options.d.ts +1 -1
- package/dist/lib/internal/types/zephyr-internal-options.mjs +1 -1
- package/dist/lib/internal/types/zephyr-output.mjs +1 -1
- package/dist/lib/internal/utils/normalize-entrypoint.mjs +0 -1
- package/dist/lib/internal/utils/normalize-vite-path.mjs +0 -1
- package/dist/lib/vite-plugin-zephyr-partial.d.mts +1 -2
- package/dist/lib/vite-plugin-zephyr-partial.d.ts +2 -3
- package/dist/lib/vite-plugin-zephyr-partial.mjs +0 -1
- package/dist/lib/vite-plugin-zephyr.d.mts +1 -2
- package/dist/lib/vite-plugin-zephyr.d.ts +3 -4
- package/dist/lib/vite-plugin-zephyr.js +696 -560
- package/dist/lib/vite-plugin-zephyr.mjs +245 -99
- package/package.json +11 -11
- package/dist/rslib-runtime.mjs +0 -21
package/README.md
CHANGED
|
@@ -58,11 +58,52 @@ export default defineConfig({
|
|
|
58
58
|
|
|
59
59
|
### Multi-Environment and SSR Builds
|
|
60
60
|
|
|
61
|
-
Vite
|
|
62
|
-
child environments and
|
|
63
|
-
that each current environment contributed output; persisted
|
|
64
|
-
are merged atomically.
|
|
65
|
-
path
|
|
61
|
+
Vite 7 and 8 application-builder invocations collect output across `client`, `server`,
|
|
62
|
+
RSC, or custom child environments and publish once through the `buildApp` hook. The
|
|
63
|
+
plugin validates that each current environment contributed output; persisted
|
|
64
|
+
partial-build contributions are merged atomically. Programmatic `vite.build()` calls,
|
|
65
|
+
including Slidev builds, use the direct single-environment upload path, as do Vite 5
|
|
66
|
+
and single-environment watch builds.
|
|
67
|
+
|
|
68
|
+
When `createBuilder()` instantiates multiple environments, publish through
|
|
69
|
+
`builder.buildApp()`. Calling `builder.build(environment)` individually is rejected to
|
|
70
|
+
prevent separate, incomplete deployments. This check tracks actual environment
|
|
71
|
+
creation, so ordinary legacy SSR builds can still select one server environment.
|
|
72
|
+
|
|
73
|
+
Non-watch programmatic builds collect every output format and publish one combined
|
|
74
|
+
snapshot when the bundler closes, after all expected writes succeed. External partial
|
|
75
|
+
output is claimed and committed once for that snapshot. Library `formats` and explicit
|
|
76
|
+
output arrays are both supported. Separate output directories are preserved relative
|
|
77
|
+
to their common root; TAP artifact paths remain unchanged.
|
|
78
|
+
|
|
79
|
+
Direct SSR builds infer `snapshotType: 'ssr'` from the selected server build and use its
|
|
80
|
+
emitted entry chunk, including renamed or hashed filenames. Explicit `snapshotType` and
|
|
81
|
+
`entrypoint` options take precedence. Multiple server entry chunks require an explicit
|
|
82
|
+
emitted `entrypoint`. TAP builds do not infer SSR unless explicitly requested.
|
|
83
|
+
|
|
84
|
+
For direct non-watch publication, Zephyr must observe the final `outputOptions`,
|
|
85
|
+
`writeBundle` and `closeBundle` hooks. Output plugins are checked after normal option
|
|
86
|
+
hooks have returned their changes. Later post-ordered hooks and unresolved asynchronous
|
|
87
|
+
output plugins are rejected because they could change the writers or fail after Zephyr
|
|
88
|
+
records success. Application-builder and watch publication keep their own lifecycles.
|
|
89
|
+
|
|
90
|
+
If publication and partial-claim rollback both fail, the rollback error is logged
|
|
91
|
+
separately and the original publication error keeps the configured throw-or-log behavior.
|
|
92
|
+
|
|
93
|
+
Vite 6 does not dispatch plugin `buildApp` hooks. Its non-watch publication supports only
|
|
94
|
+
a single environment without an explicit `builder` configuration; other configurations
|
|
95
|
+
are rejected to avoid publishing incomplete output. Use Vite 7 or newer for coordinated
|
|
96
|
+
application builds.
|
|
97
|
+
|
|
98
|
+
Place `withZephyr()` before other plugins that combine `enforce: 'pre'` with a
|
|
99
|
+
pre-ordered `buildApp` hook. Zephyr checks this order before building so it can start
|
|
100
|
+
collecting output before any application build hook compiles an environment. The
|
|
101
|
+
ordering check also applies to legacy builds carrying those plugins.
|
|
102
|
+
|
|
103
|
+
Files generated by a framework after `vite.build()` returns are outside the Vite upload
|
|
104
|
+
lifecycle. For example, Slidev can generate a PDF, an OG image, `404.html`, and
|
|
105
|
+
`_redirects` after Vite finishes; those files need a separate post-build publication
|
|
106
|
+
step if they must be included.
|
|
66
107
|
|
|
67
108
|
```typescript
|
|
68
109
|
withZephyr({
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { withZephyr } from './lib/vite-plugin-zephyr';
|
|
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';
|
|
1
|
+
export { withZephyr } from './lib/vite-plugin-zephyr.js';
|
|
2
|
+
export { withZephyrPartial } from './lib/vite-plugin-zephyr-partial.js';
|
|
3
|
+
export type { WithZephyrOptions } from './lib/vite-plugin-zephyr.js';
|
|
4
|
+
export type { VitePartialBuildOptions } from './lib/internal/partial-build-scope.js';
|
|
5
|
+
export type { ModuleFederationOptions } from './lib/internal/mf-vite-etl/ensure_runtime_plugin.js';
|
|
6
6
|
export type { ZephyrBuildHooks, DeploymentInfo } from 'zephyr-agent';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Plugin, PluginOption } from 'vite' with {
|
|
2
|
-
'resolution-mode': 'import'
|
|
1
|
+
import type { Plugin, PluginOption } from 'vite' with { 'resolution-mode': 'import'
|
|
3
2
|
};
|
|
4
3
|
import type { ModuleFederationOptions } from '../mf-vite-etl/ensure_runtime_plugin.mjs';
|
|
5
4
|
export interface ViteMFPlugin {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { Plugin, PluginOption } from 'vite' with {
|
|
2
|
-
'resolution-mode': 'import'
|
|
1
|
+
import type { Plugin, PluginOption } from 'vite' with { 'resolution-mode': 'import'
|
|
3
2
|
};
|
|
4
|
-
import type { ModuleFederationOptions } from '../mf-vite-etl/ensure_runtime_plugin';
|
|
3
|
+
import type { ModuleFederationOptions } from '../mf-vite-etl/ensure_runtime_plugin.js';
|
|
5
4
|
export interface ViteMFPlugin {
|
|
6
5
|
_options: ModuleFederationOptions;
|
|
7
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ZeBuildAssetsMap, type ZephyrEngine } from 'zephyr-agent';
|
|
2
|
-
import type { ZephyrInternalOptions } from '../types/zephyr-internal-options';
|
|
2
|
+
import type { ZephyrInternalOptions } from '../types/zephyr-internal-options.js';
|
|
3
3
|
export declare function extract_vite_assets_map(_zephyr_engine: ZephyrEngine, vite_internal_options: ZephyrInternalOptions): Promise<ZeBuildAssetsMap>;
|
|
4
4
|
//# sourceMappingURL=extract_vite_assets_map.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ZephyrInternalOptions } from '../types/zephyr-internal-options';
|
|
2
|
-
import type { ZephyrOutputBundle } from '../types/zephyr-output';
|
|
1
|
+
import type { ZephyrInternalOptions } from '../types/zephyr-internal-options.js';
|
|
2
|
+
import type { ZephyrOutputBundle } from '../types/zephyr-output.js';
|
|
3
3
|
export declare function loadStaticAssets(vite_internal_options: ZephyrInternalOptions): Promise<ZephyrOutputBundle>;
|
|
4
4
|
//# sourceMappingURL=load_static_assets.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ZephyrBuildTarget } from 'zephyr-agent';
|
|
2
|
-
import type { ZephyrOutput, ZephyrOutputBundle } from '../types/zephyr-output';
|
|
2
|
+
import type { ZephyrOutput, ZephyrOutputBundle } from '../types/zephyr-output.js';
|
|
3
3
|
export interface MergeViteOutputAssetsOptions {
|
|
4
4
|
/** TAP paths are protocol values and must already use their published spelling. */
|
|
5
5
|
target?: ZephyrBuildTarget;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModuleFederationManifestOptions, ModuleFederationOptions } from './ensure_runtime_plugin';
|
|
1
|
+
import type { ModuleFederationManifestOptions, ModuleFederationOptions } from './ensure_runtime_plugin.js';
|
|
2
2
|
/** The established single-container snapshot shape. */
|
|
3
3
|
export interface ViteLegacyModuleFederationConfig {
|
|
4
4
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Plugin } from 'vite' with {
|
|
2
|
-
'resolution-mode': 'import'
|
|
1
|
+
import type { Plugin } from 'vite' with { 'resolution-mode': 'import'
|
|
3
2
|
};
|
|
4
3
|
import { type VitePartialBuildOptions } from './internal/partial-build-scope.mjs';
|
|
5
4
|
export declare function withZephyrPartial(options?: VitePartialBuildOptions): Plugin;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Plugin } from 'vite' with {
|
|
2
|
-
'resolution-mode': 'import'
|
|
1
|
+
import type { Plugin } from 'vite' with { 'resolution-mode': 'import'
|
|
3
2
|
};
|
|
4
|
-
import { type VitePartialBuildOptions } from './internal/partial-build-scope';
|
|
3
|
+
import { type VitePartialBuildOptions } from './internal/partial-build-scope.js';
|
|
5
4
|
export declare function withZephyrPartial(options?: VitePartialBuildOptions): Plugin;
|
|
6
5
|
//# sourceMappingURL=vite-plugin-zephyr-partial.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "node:module";
|
|
2
1
|
import { ZeErrors, ZephyrEngine, ZephyrError, assertZephyrBuildTarget, handleGlobalError, savePartialAssetMap } from "zephyr-agent";
|
|
3
2
|
import { extract_vite_assets_map } from "./internal/extract/extract_vite_assets_map.mjs";
|
|
4
3
|
import { requireVitePartialBuildScope } from "./internal/partial-build-scope.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Plugin } from 'vite' with {
|
|
2
|
-
'resolution-mode': 'import'
|
|
1
|
+
import type { Plugin } from 'vite' with { 'resolution-mode': 'import'
|
|
3
2
|
};
|
|
4
3
|
import { type ZephyrBuildHooks, type ZephyrBuildTarget } from 'zephyr-agent';
|
|
5
4
|
import { type ModuleFederationOptions } from './internal/mf-vite-etl/ensure_runtime_plugin.mjs';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { Plugin } from 'vite' with {
|
|
2
|
-
'resolution-mode': 'import'
|
|
1
|
+
import type { Plugin } from 'vite' with { 'resolution-mode': 'import'
|
|
3
2
|
};
|
|
4
3
|
import { type ZephyrBuildHooks, type ZephyrBuildTarget } from 'zephyr-agent';
|
|
5
|
-
import { type ModuleFederationOptions } from './internal/mf-vite-etl/ensure_runtime_plugin';
|
|
6
|
-
import { type VitePartialBuildOptions } from './internal/partial-build-scope';
|
|
4
|
+
import { type ModuleFederationOptions } from './internal/mf-vite-etl/ensure_runtime_plugin.js';
|
|
5
|
+
import { type VitePartialBuildOptions } from './internal/partial-build-scope.js';
|
|
7
6
|
export interface WithZephyrOptions {
|
|
8
7
|
/** Zephyr build target, including the `tap-app` mini-app artifact family. */
|
|
9
8
|
target?: ZephyrBuildTarget;
|