zephyr-webpack-plugin 0.0.0-canary.65 → 0.0.0-canary.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -83,6 +83,11 @@ const config = {
83
83
  module.exports = withZephyr()(config);
84
84
  ```
85
85
 
86
+ Webpack configuration arrays are coordinated as one logical application build. Client
87
+ and server compiler assets are merged only after every compiler finishes and are uploaded
88
+ once. For custom SSR layouts, pass `snapshotType: 'ssr'` and an `entrypoint` relative to
89
+ the shared output root.
90
+
86
91
  ### TypeScript Configuration
87
92
 
88
93
  ```typescript
@@ -0,0 +1,6 @@
1
+ export { withZephyr } from './webpack-plugin/with-zephyr.mjs';
2
+ export type { ZephyrWebpackPluginOptions } from './types/index.mjs';
3
+ export type { ZephyrBuildHooks, DeploymentInfo } from 'zephyr-agent';
4
+ export { onDeploymentDone } from 'zephyr-xpack-internal';
5
+ export { resolveIndexHtml } from 'zephyr-agent';
6
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export type { ZephyrWebpackPluginOptions } from './types';
3
3
  export type { ZephyrBuildHooks, DeploymentInfo } from 'zephyr-agent';
4
4
  export { onDeploymentDone } from 'zephyr-xpack-internal';
5
5
  export { resolveIndexHtml } from 'zephyr-agent';
6
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,11 +1,50 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveIndexHtml = exports.onDeploymentDone = exports.withZephyr = void 0;
4
- var with_zephyr_1 = require("./webpack-plugin/with-zephyr");
5
- Object.defineProperty(exports, "withZephyr", { enumerable: true, get: function () { return with_zephyr_1.withZephyr; } });
6
- // hacks
7
- var zephyr_xpack_internal_1 = require("zephyr-xpack-internal");
8
- Object.defineProperty(exports, "onDeploymentDone", { enumerable: true, get: function () { return zephyr_xpack_internal_1.onDeploymentDone; } });
9
- var zephyr_agent_1 = require("zephyr-agent");
10
- Object.defineProperty(exports, "resolveIndexHtml", { enumerable: true, get: function () { return zephyr_agent_1.resolveIndexHtml; } });
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
+ onDeploymentDone: ()=>external_zephyr_xpack_internal_namespaceObject.onDeploymentDone,
32
+ resolveIndexHtml: ()=>external_zephyr_agent_namespaceObject.resolveIndexHtml,
33
+ withZephyr: ()=>with_zephyr_js_namespaceObject.withZephyr
34
+ });
35
+ const with_zephyr_js_namespaceObject = require("./webpack-plugin/with-zephyr.js");
36
+ const external_zephyr_xpack_internal_namespaceObject = require("zephyr-xpack-internal");
37
+ const external_zephyr_agent_namespaceObject = require("zephyr-agent");
38
+ exports.onDeploymentDone = __webpack_exports__.onDeploymentDone;
39
+ exports.resolveIndexHtml = __webpack_exports__.resolveIndexHtml;
40
+ exports.withZephyr = __webpack_exports__.withZephyr;
41
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
42
+ "onDeploymentDone",
43
+ "resolveIndexHtml",
44
+ "withZephyr"
45
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
46
+ Object.defineProperty(exports, '__esModule', {
47
+ value: true
48
+ });
49
+
11
50
  //# sourceMappingURL=index.js.map
package/dist/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import "node:module";
2
+ export { withZephyr } from "./webpack-plugin/with-zephyr.mjs";
3
+ export { onDeploymentDone } from "zephyr-xpack-internal";
4
+ export { resolveIndexHtml } from "zephyr-agent";
@@ -0,0 +1,22 @@
1
+ import type { ZephyrBuildHooks, ZephyrBuildTarget, ZephyrEngine } from 'zephyr-agent';
2
+ import type { XPackBuildCoordinator } from 'zephyr-xpack-internal';
3
+ export interface ZephyrWebpackPluginOptions {
4
+ /** Zephyr build target, including the `tap-app` mini-app artifact family. */
5
+ target?: ZephyrBuildTarget;
6
+ /** Wait for HTML processing before deployment when the framework emits HTML late. */
7
+ wait_for_index_html?: boolean;
8
+ hooks?: ZephyrBuildHooks;
9
+ /** Override automatic CSR/SSR detection for coordinated compiler arrays. */
10
+ snapshotType?: 'csr' | 'ssr';
11
+ /** Server entrypoint relative to the shared output root. */
12
+ entrypoint?: string;
13
+ /** Framework integration only: shared logical-build state for compiler wrappers. */
14
+ __engine?: ZephyrEngine;
15
+ /** Framework integration only. */
16
+ __coordinator?: XPackBuildCoordinator;
17
+ /** Framework integration only. */
18
+ __participant?: string;
19
+ /** Framework integration only. */
20
+ __assetPrefix?: string;
21
+ }
22
+ //# sourceMappingURL=index.d.mts.map
@@ -1,5 +1,22 @@
1
- import type { ZephyrBuildHooks } from 'zephyr-agent';
1
+ import type { ZephyrBuildHooks, ZephyrBuildTarget, ZephyrEngine } from 'zephyr-agent';
2
+ import type { XPackBuildCoordinator } from 'zephyr-xpack-internal';
2
3
  export interface ZephyrWebpackPluginOptions {
4
+ /** Zephyr build target, including the `tap-app` mini-app artifact family. */
5
+ target?: ZephyrBuildTarget;
6
+ /** Wait for HTML processing before deployment when the framework emits HTML late. */
3
7
  wait_for_index_html?: boolean;
4
8
  hooks?: ZephyrBuildHooks;
9
+ /** Override automatic CSR/SSR detection for coordinated compiler arrays. */
10
+ snapshotType?: 'csr' | 'ssr';
11
+ /** Server entrypoint relative to the shared output root. */
12
+ entrypoint?: string;
13
+ /** Framework integration only: shared logical-build state for compiler wrappers. */
14
+ __engine?: ZephyrEngine;
15
+ /** Framework integration only. */
16
+ __coordinator?: XPackBuildCoordinator;
17
+ /** Framework integration only. */
18
+ __participant?: string;
19
+ /** Framework integration only. */
20
+ __assetPrefix?: string;
5
21
  }
22
+ //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,20 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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=index.js.map
@@ -0,0 +1 @@
1
+ import "node:module";
@@ -0,0 +1,4 @@
1
+ import type { Compiler } from 'webpack';
2
+ import type { XPackConfiguration } from 'zephyr-xpack-internal';
3
+ export type WebpackConfiguration = XPackConfiguration<Compiler>;
4
+ //# sourceMappingURL=missing-webpack-types.d.mts.map
@@ -1,3 +1,4 @@
1
1
  import type { Compiler } from 'webpack';
2
2
  import type { XPackConfiguration } from 'zephyr-xpack-internal';
3
3
  export type WebpackConfiguration = XPackConfiguration<Compiler>;
4
+ //# sourceMappingURL=missing-webpack-types.d.ts.map
@@ -1,3 +1,20 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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=missing-webpack-types.js.map
@@ -0,0 +1 @@
1
+ import "node:module";
@@ -0,0 +1,4 @@
1
+ import type { Configuration } from 'webpack';
2
+ import type { ZephyrWebpackPluginOptions } from '../types/index.mjs';
3
+ export declare function withZephyr(zephyrPluginOptions?: ZephyrWebpackPluginOptions): <T extends Configuration | Configuration[]>(config: T) => Promise<T>;
4
+ //# sourceMappingURL=with-zephyr.d.mts.map
@@ -1,3 +1,4 @@
1
1
  import type { Configuration } from 'webpack';
2
2
  import type { ZephyrWebpackPluginOptions } from '../types';
3
- export declare function withZephyr(zephyrPluginOptions?: ZephyrWebpackPluginOptions): (config: Configuration) => Promise<Configuration>;
3
+ export declare function withZephyr(zephyrPluginOptions?: ZephyrWebpackPluginOptions): <T extends Configuration | Configuration[]>(config: T) => Promise<T>;
4
+ //# sourceMappingURL=with-zephyr.d.ts.map
@@ -1,43 +1,128 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withZephyr = withZephyr;
4
- const zephyr_agent_1 = require("zephyr-agent");
5
- const zephyr_xpack_internal_1 = require("zephyr-xpack-internal");
6
- const ze_webpack_plugin_1 = require("./ze-webpack-plugin");
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: ()=>withZephyr
32
+ });
33
+ const external_zephyr_agent_namespaceObject = require("zephyr-agent");
34
+ const external_zephyr_xpack_internal_namespaceObject = require("zephyr-xpack-internal");
35
+ const external_ze_webpack_plugin_js_namespaceObject = require("./ze-webpack-plugin.js");
36
+ function mergeResolvedDependencies(previous, current) {
37
+ const merged = new Map();
38
+ for (const dependency of [
39
+ ...previous,
40
+ ...current
41
+ ])merged.set(`${dependency.application_uid}\0${dependency.name}`, dependency);
42
+ return [
43
+ ...merged.values()
44
+ ];
45
+ }
46
+ function resolveBuildTarget(options) {
47
+ const target = options?.target;
48
+ if (void 0 !== target) (0, external_zephyr_agent_namespaceObject.assertZephyrBuildTarget)(target, 'withZephyr({ target })');
49
+ return target;
50
+ }
51
+ function applyBuildTarget(engine, target) {
52
+ if (void 0 !== target) engine.env.target = target;
53
+ }
7
54
  function withZephyr(zephyrPluginOptions) {
8
- return (config) => {
9
- // Skip Zephyr execution during Nx graph calculation
10
- // Nx sets global.NX_GRAPH_CREATION = true during graph creation
11
- if ((0, zephyr_agent_1.getGlobal)().NX_GRAPH_CREATION) {
12
- return Promise.resolve(config);
55
+ const target = resolveBuildTarget(zephyrPluginOptions);
56
+ return async (config)=>{
57
+ if ((0, external_zephyr_agent_namespaceObject.getGlobal)().NX_GRAPH_CREATION) return config;
58
+ if (!Array.isArray(config)) return await _zephyr_configuration(config, zephyrPluginOptions);
59
+ if (0 === config.length) return config;
60
+ const engine = await external_zephyr_agent_namespaceObject.ZephyrEngine.create({
61
+ builder: 'webpack',
62
+ context: config[0]?.context,
63
+ target
64
+ });
65
+ applyBuildTarget(engine, target);
66
+ try {
67
+ const { coordinator, compilers } = (0, external_zephyr_xpack_internal_namespaceObject.coordinateXPackCompilers)(engine, config, {
68
+ snapshotType: zephyrPluginOptions?.snapshotType,
69
+ entrypoint: zephyrPluginOptions?.entrypoint
70
+ });
71
+ for (const [index, item] of config.entries())await _zephyr_configuration(item, {
72
+ ...zephyrPluginOptions,
73
+ target,
74
+ __engine: engine,
75
+ __coordinator: coordinator,
76
+ __participant: compilers[index]?.participant,
77
+ __assetPrefix: compilers[index]?.assetPrefix
78
+ });
79
+ } catch (error) {
80
+ if (engine.hasActiveBuild) engine.build_failed();
81
+ throw error;
13
82
  }
14
- return _zephyr_configuration(config, zephyrPluginOptions);
83
+ return config;
15
84
  };
16
85
  }
17
86
  async function _zephyr_configuration(config, _zephyrOptions) {
87
+ let zephyr_engine;
18
88
  try {
19
- // create instance of ZephyrEngine to track the application
20
- const zephyr_engine = await zephyr_agent_1.ZephyrEngine.create({
89
+ const target = resolveBuildTarget(_zephyrOptions);
90
+ zephyr_engine = _zephyrOptions?.__engine ?? await external_zephyr_agent_namespaceObject.ZephyrEngine.create({
21
91
  builder: 'webpack',
22
92
  context: config.context,
93
+ target
23
94
  });
24
- // Resolve dependencies and update the config
25
- const dependencyPairs = (0, zephyr_xpack_internal_1.extractFederatedDependencyPairs)(config);
26
- const resolved_dependency_pairs = await zephyr_engine.resolve_remote_dependencies(dependencyPairs, (0, zephyr_xpack_internal_1.extractLibraryType)(config.output?.library));
27
- (0, zephyr_xpack_internal_1.mutWebpackFederatedRemotesConfig)(zephyr_engine, config, resolved_dependency_pairs);
28
- const mfConfig = (0, zephyr_xpack_internal_1.makeCopyOfModuleFederationOptions)(config);
29
- zephyr_agent_1.ze_log.mf(`with-zephyr.mfConfig: ${JSON.stringify(mfConfig, null, 2)}`);
30
- // inject the ZephyrWebpackPlugin
31
- config.plugins?.push(new ze_webpack_plugin_1.ZeWebpackPlugin({
95
+ applyBuildTarget(zephyr_engine, target);
96
+ const dependencyPairs = (0, external_zephyr_xpack_internal_namespaceObject.extractFederatedDependencyPairs)(config);
97
+ const previousDependencies = zephyr_engine.federated_dependencies ?? [];
98
+ const resolved_dependency_pairs = await zephyr_engine.resolve_remote_dependencies(dependencyPairs, (0, external_zephyr_xpack_internal_namespaceObject.extractLibraryType)(config.output?.library));
99
+ zephyr_engine.federated_dependencies = mergeResolvedDependencies(previousDependencies, resolved_dependency_pairs ?? []);
100
+ (0, external_zephyr_xpack_internal_namespaceObject.mutWebpackFederatedRemotesConfig)(zephyr_engine, config, resolved_dependency_pairs);
101
+ await (0, external_zephyr_xpack_internal_namespaceObject.mutPathModePublicPath)(zephyr_engine, config);
102
+ const mfConfig = (0, external_zephyr_xpack_internal_namespaceObject.makeCopyOfModuleFederationOptions)(config);
103
+ external_zephyr_agent_namespaceObject.ze_log.mf(`with-zephyr.mfConfig: ${JSON.stringify(mfConfig, null, 2)}`);
104
+ (config.plugins ??= []).push(new external_ze_webpack_plugin_js_namespaceObject.ZeWebpackPlugin({
32
105
  zephyr_engine,
33
106
  mfConfig: mfConfig,
34
107
  wait_for_index_html: _zephyrOptions?.wait_for_index_html,
35
108
  hooks: _zephyrOptions?.hooks,
109
+ coordinator: _zephyrOptions?.__coordinator,
110
+ participant: _zephyrOptions?.__participant,
111
+ assetPrefix: _zephyrOptions?.__assetPrefix
36
112
  }));
37
- }
38
- catch (error) {
39
- (0, zephyr_agent_1.handleGlobalError)(error);
113
+ } catch (error) {
114
+ if (_zephyrOptions?.__coordinator) throw error;
115
+ if (zephyr_engine?.hasActiveBuild !== false) zephyr_engine?.build_failed();
116
+ (0, external_zephyr_agent_namespaceObject.handleGlobalError)(error);
40
117
  }
41
118
  return config;
42
119
  }
120
+ exports.withZephyr = __webpack_exports__.withZephyr;
121
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
122
+ "withZephyr"
123
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
124
+ Object.defineProperty(exports, '__esModule', {
125
+ value: true
126
+ });
127
+
43
128
  //# sourceMappingURL=with-zephyr.js.map
@@ -0,0 +1,91 @@
1
+ import "node:module";
2
+ import { ZephyrEngine, assertZephyrBuildTarget, getGlobal, handleGlobalError, ze_log } from "zephyr-agent";
3
+ import { coordinateXPackCompilers, extractFederatedDependencyPairs, extractLibraryType, makeCopyOfModuleFederationOptions, mutPathModePublicPath, mutWebpackFederatedRemotesConfig } from "zephyr-xpack-internal";
4
+ import { ZeWebpackPlugin } from "./ze-webpack-plugin.mjs";
5
+ function mergeResolvedDependencies(previous, current) {
6
+ const merged = new Map();
7
+ for (const dependency of [
8
+ ...previous,
9
+ ...current
10
+ ])merged.set(`${dependency.application_uid}\0${dependency.name}`, dependency);
11
+ return [
12
+ ...merged.values()
13
+ ];
14
+ }
15
+ function resolveBuildTarget(options) {
16
+ const target = options?.target;
17
+ if (void 0 !== target) assertZephyrBuildTarget(target, 'withZephyr({ target })');
18
+ return target;
19
+ }
20
+ function applyBuildTarget(engine, target) {
21
+ if (void 0 !== target) engine.env.target = target;
22
+ }
23
+ function withZephyr(zephyrPluginOptions) {
24
+ const target = resolveBuildTarget(zephyrPluginOptions);
25
+ return async (config)=>{
26
+ if (getGlobal().NX_GRAPH_CREATION) return config;
27
+ if (!Array.isArray(config)) return await _zephyr_configuration(config, zephyrPluginOptions);
28
+ if (0 === config.length) return config;
29
+ const engine = await ZephyrEngine.create({
30
+ builder: 'webpack',
31
+ context: config[0]?.context,
32
+ target
33
+ });
34
+ applyBuildTarget(engine, target);
35
+ try {
36
+ const { coordinator, compilers } = coordinateXPackCompilers(engine, config, {
37
+ snapshotType: zephyrPluginOptions?.snapshotType,
38
+ entrypoint: zephyrPluginOptions?.entrypoint
39
+ });
40
+ for (const [index, item] of config.entries())await _zephyr_configuration(item, {
41
+ ...zephyrPluginOptions,
42
+ target,
43
+ __engine: engine,
44
+ __coordinator: coordinator,
45
+ __participant: compilers[index]?.participant,
46
+ __assetPrefix: compilers[index]?.assetPrefix
47
+ });
48
+ } catch (error) {
49
+ if (engine.hasActiveBuild) engine.build_failed();
50
+ throw error;
51
+ }
52
+ return config;
53
+ };
54
+ }
55
+ async function _zephyr_configuration(config, _zephyrOptions) {
56
+ let zephyr_engine;
57
+ try {
58
+ const target = resolveBuildTarget(_zephyrOptions);
59
+ zephyr_engine = _zephyrOptions?.__engine ?? await ZephyrEngine.create({
60
+ builder: 'webpack',
61
+ context: config.context,
62
+ target
63
+ });
64
+ applyBuildTarget(zephyr_engine, target);
65
+ const dependencyPairs = extractFederatedDependencyPairs(config);
66
+ const previousDependencies = zephyr_engine.federated_dependencies ?? [];
67
+ const resolved_dependency_pairs = await zephyr_engine.resolve_remote_dependencies(dependencyPairs, extractLibraryType(config.output?.library));
68
+ zephyr_engine.federated_dependencies = mergeResolvedDependencies(previousDependencies, resolved_dependency_pairs ?? []);
69
+ mutWebpackFederatedRemotesConfig(zephyr_engine, config, resolved_dependency_pairs);
70
+ await mutPathModePublicPath(zephyr_engine, config);
71
+ const mfConfig = makeCopyOfModuleFederationOptions(config);
72
+ ze_log.mf(`with-zephyr.mfConfig: ${JSON.stringify(mfConfig, null, 2)}`);
73
+ (config.plugins ??= []).push(new ZeWebpackPlugin({
74
+ zephyr_engine,
75
+ mfConfig: mfConfig,
76
+ wait_for_index_html: _zephyrOptions?.wait_for_index_html,
77
+ hooks: _zephyrOptions?.hooks,
78
+ coordinator: _zephyrOptions?.__coordinator,
79
+ participant: _zephyrOptions?.__participant,
80
+ assetPrefix: _zephyrOptions?.__assetPrefix
81
+ }));
82
+ } catch (error) {
83
+ if (_zephyrOptions?.__coordinator) throw error;
84
+ if (zephyr_engine?.hasActiveBuild !== false) zephyr_engine?.build_failed();
85
+ handleGlobalError(error);
86
+ }
87
+ return config;
88
+ }
89
+ export { withZephyr };
90
+
91
+ //# sourceMappingURL=with-zephyr.mjs.map
@@ -0,0 +1,19 @@
1
+ import type { Compiler } from 'webpack';
2
+ import type { ZephyrEngine, ZephyrBuildHooks } from 'zephyr-agent';
3
+ import type { ModuleFederationPlugin, XPackBuildCoordinator } from 'zephyr-xpack-internal';
4
+ export interface ZephyrWebpackInternalPluginOptions {
5
+ zephyr_engine: ZephyrEngine;
6
+ pluginName: string;
7
+ mfConfig: ModuleFederationPlugin[] | ModuleFederationPlugin | undefined;
8
+ wait_for_index_html?: boolean;
9
+ hooks?: ZephyrBuildHooks;
10
+ coordinator?: XPackBuildCoordinator;
11
+ participant?: string;
12
+ assetPrefix?: string;
13
+ }
14
+ export declare class ZeWebpackPlugin {
15
+ _options: ZephyrWebpackInternalPluginOptions;
16
+ constructor(options: Omit<ZephyrWebpackInternalPluginOptions, 'pluginName'>);
17
+ apply(compiler: Compiler): void;
18
+ }
19
+ //# sourceMappingURL=ze-webpack-plugin.d.mts.map
@@ -1,15 +1,19 @@
1
1
  import type { Compiler } from 'webpack';
2
2
  import type { ZephyrEngine, ZephyrBuildHooks } from 'zephyr-agent';
3
- import type { ModuleFederationPlugin } from 'zephyr-xpack-internal';
3
+ import type { ModuleFederationPlugin, XPackBuildCoordinator } from 'zephyr-xpack-internal';
4
4
  export interface ZephyrWebpackInternalPluginOptions {
5
5
  zephyr_engine: ZephyrEngine;
6
6
  pluginName: string;
7
7
  mfConfig: ModuleFederationPlugin[] | ModuleFederationPlugin | undefined;
8
8
  wait_for_index_html?: boolean;
9
9
  hooks?: ZephyrBuildHooks;
10
+ coordinator?: XPackBuildCoordinator;
11
+ participant?: string;
12
+ assetPrefix?: string;
10
13
  }
11
14
  export declare class ZeWebpackPlugin {
12
15
  _options: ZephyrWebpackInternalPluginOptions;
13
16
  constructor(options: Omit<ZephyrWebpackInternalPluginOptions, 'pluginName'>);
14
17
  apply(compiler: Compiler): void;
15
18
  }
19
+ //# sourceMappingURL=ze-webpack-plugin.d.ts.map
@@ -1,19 +1,59 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZeWebpackPlugin = void 0;
4
- const zephyr_xpack_internal_1 = require("zephyr-xpack-internal");
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
+ ZeWebpackPlugin: ()=>ZeWebpackPlugin
32
+ });
33
+ const external_zephyr_xpack_internal_namespaceObject = require("zephyr-xpack-internal");
5
34
  const pluginName = 'ZeWebpackPlugin';
6
35
  class ZeWebpackPlugin {
7
- constructor(options) {
8
- this._options = Object.assign({ pluginName }, options);
36
+ _options;
37
+ constructor(options){
38
+ this._options = Object.assign({
39
+ pluginName
40
+ }, options);
9
41
  }
10
42
  apply(compiler) {
11
43
  this._options.zephyr_engine.buildProperties.output = compiler.outputPath;
12
- (0, zephyr_xpack_internal_1.detectAndStoreBaseHref)(this._options.zephyr_engine, compiler);
13
- (0, zephyr_xpack_internal_1.logBuildSteps)(this._options, compiler);
14
- (0, zephyr_xpack_internal_1.setupManifestEmission)(this._options, compiler);
15
- (0, zephyr_xpack_internal_1.setupZeDeploy)(this._options, compiler);
44
+ if (this._options.coordinator && this._options.participant) this._options.coordinator.registerParticipantBaseHref(this._options.participant, (0, external_zephyr_xpack_internal_namespaceObject.detectBaseHref)(compiler));
45
+ else (0, external_zephyr_xpack_internal_namespaceObject.detectAndStoreBaseHref)(this._options.zephyr_engine, compiler);
46
+ (0, external_zephyr_xpack_internal_namespaceObject.logBuildSteps)(this._options, compiler);
47
+ (0, external_zephyr_xpack_internal_namespaceObject.setupManifestEmission)(this._options, compiler);
48
+ (0, external_zephyr_xpack_internal_namespaceObject.setupZeDeploy)(this._options, compiler);
16
49
  }
17
50
  }
18
- exports.ZeWebpackPlugin = ZeWebpackPlugin;
51
+ exports.ZeWebpackPlugin = __webpack_exports__.ZeWebpackPlugin;
52
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
53
+ "ZeWebpackPlugin"
54
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
55
+ Object.defineProperty(exports, '__esModule', {
56
+ value: true
57
+ });
58
+
19
59
  //# sourceMappingURL=ze-webpack-plugin.js.map
@@ -0,0 +1,22 @@
1
+ import "node:module";
2
+ import { detectAndStoreBaseHref, detectBaseHref, logBuildSteps, setupManifestEmission, setupZeDeploy } from "zephyr-xpack-internal";
3
+ const pluginName = 'ZeWebpackPlugin';
4
+ class ZeWebpackPlugin {
5
+ _options;
6
+ constructor(options){
7
+ this._options = Object.assign({
8
+ pluginName: pluginName
9
+ }, options);
10
+ }
11
+ apply(compiler) {
12
+ this._options.zephyr_engine.buildProperties.output = compiler.outputPath;
13
+ if (this._options.coordinator && this._options.participant) this._options.coordinator.registerParticipantBaseHref(this._options.participant, detectBaseHref(compiler));
14
+ else detectAndStoreBaseHref(this._options.zephyr_engine, compiler);
15
+ logBuildSteps(this._options, compiler);
16
+ setupManifestEmission(this._options, compiler);
17
+ setupZeDeploy(this._options, compiler);
18
+ }
19
+ }
20
+ export { ZeWebpackPlugin };
21
+
22
+ //# sourceMappingURL=ze-webpack-plugin.mjs.map
package/package.json CHANGED
@@ -1,41 +1,64 @@
1
1
  {
2
2
  "name": "zephyr-webpack-plugin",
3
- "version": "0.0.0-canary.65",
3
+ "version": "0.0.0-canary.67",
4
4
  "description": "Webpack plugin for Zephyr",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
8
- "directory": "libs/zephyr-webpack-plugin"
9
- },
10
5
  "license": "Apache-2.0",
11
6
  "author": {
12
7
  "name": "ZephyrCloudIO",
13
8
  "url": "https://github.com/ZephyrCloudIO"
14
9
  },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
13
+ "directory": "libs/zephyr-webpack-plugin"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE",
19
+ "!dist/**/*.map"
20
+ ],
15
21
  "type": "commonjs",
16
- "main": "dist/index.js",
17
- "types": "dist/index.d.ts",
22
+ "main": "./dist/index.js",
23
+ "module": "./dist/index.mjs",
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "import": {
28
+ "types": "./dist/index.d.mts",
29
+ "default": "./dist/index.mjs"
30
+ },
31
+ "require": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ }
35
+ },
36
+ "./package.json": "./package.json",
37
+ "./*": "./*"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public",
41
+ "provenance": true
42
+ },
18
43
  "dependencies": {
19
- "tslib": "^2.8.1",
20
- "zephyr-xpack-internal": "0.0.0-canary.65",
21
- "zephyr-agent": "0.0.0-canary.65"
44
+ "zephyr-agent": "0.0.0-canary.67",
45
+ "zephyr-xpack-internal": "0.0.0-canary.67"
22
46
  },
23
47
  "devDependencies": {
24
- "@types/jest": "29.5.14",
48
+ "@rslib/core": "0.23.2",
49
+ "@rstest/core": "0.11.1",
25
50
  "@types/node-persist": "^3.1.8",
26
- "@typescript-eslint/eslint-plugin": "^8.27.0",
27
- "ts-jest": "^29.2.6",
28
- "webpack": "^5.103.0"
51
+ "typescript": "~5.9.3",
52
+ "webpack": "^5.108.4"
29
53
  },
30
54
  "peerDependencies": {
31
55
  "webpack": "^5.0.0"
32
56
  },
33
- "publishConfig": {
34
- "access": "public",
35
- "provenance": true
36
- },
37
57
  "scripts": {
38
- "build": "nx run zephyr-webpack-plugin:build",
39
- "patch-version": "pnpm version"
58
+ "build": "rslib build",
59
+ "patch-version": "pnpm version",
60
+ "dev": "rslib build --watch",
61
+ "typecheck": "tsc -b",
62
+ "test": "rstest run"
40
63
  }
41
64
  }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,4DAA0D;AAAjD,yGAAA,UAAU,OAAA;AAInB,QAAQ;AACR,+DAAyD;AAAhD,yHAAA,gBAAgB,OAAA;AACzB,6CAAgD;AAAvC,gHAAA,gBAAgB,OAAA"}
package/dist/package.json DELETED
@@ -1,41 +0,0 @@
1
- {
2
- "name": "zephyr-webpack-plugin",
3
- "version": "1.1.2",
4
- "description": "Webpack plugin for Zephyr",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/ZephyrCloudIO/zephyr-packages.git",
8
- "directory": "libs/zephyr-webpack-plugin"
9
- },
10
- "license": "Apache-2.0",
11
- "author": {
12
- "name": "ZephyrCloudIO",
13
- "url": "https://github.com/ZephyrCloudIO"
14
- },
15
- "type": "commonjs",
16
- "main": "dist/index.js",
17
- "types": "dist/index.d.ts",
18
- "scripts": {
19
- "build": "nx run zephyr-webpack-plugin:build",
20
- "patch-version": "pnpm version"
21
- },
22
- "dependencies": {
23
- "tslib": "catalog:typescript",
24
- "zephyr-agent": "workspace:*",
25
- "zephyr-xpack-internal": "workspace:*"
26
- },
27
- "devDependencies": {
28
- "@types/jest": "catalog:typescript",
29
- "@types/node-persist": "catalog:typescript",
30
- "@typescript-eslint/eslint-plugin": "catalog:eslint",
31
- "ts-jest": "catalog:typescript",
32
- "webpack": "catalog:webpack5"
33
- },
34
- "peerDependencies": {
35
- "webpack": "^5.0.0"
36
- },
37
- "publishConfig": {
38
- "access": "public",
39
- "provenance": true
40
- }
41
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"missing-webpack-types.js","sourceRoot":"","sources":["../../src/types/missing-webpack-types.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"with-zephyr.js","sourceRoot":"","sources":["../../src/webpack-plugin/with-zephyr.ts"],"names":[],"mappings":";;AAYA,gCASC;AApBD,+CAAkF;AAClF,iEAK+B;AAG/B,2DAAsD;AAEtD,SAAgB,UAAU,CAAC,mBAAgD;IACzE,OAAO,CAAC,MAAqB,EAAE,EAAE;QAC/B,oDAAoD;QACpD,gEAAgE;QAChE,IAAI,IAAA,wBAAS,GAAE,CAAC,iBAAiB,EAAE,CAAC;YAClC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,qBAAqB,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,qBAAqB,CAClC,MAA4B,EAC5B,cAA2C;IAE3C,IAAI,CAAC;QACH,2DAA2D;QAC3D,MAAM,aAAa,GAAG,MAAM,2BAAY,CAAC,MAAM,CAAC;YAC9C,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;QAEH,6CAA6C;QAC7C,MAAM,eAAe,GAAG,IAAA,uDAA+B,EAAC,MAAM,CAAC,CAAC;QAChE,MAAM,yBAAyB,GAAG,MAAM,aAAa,CAAC,2BAA2B,CAC/E,eAAe,EACf,IAAA,0CAAkB,EAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC3C,CAAC;QAEF,IAAA,wDAAgC,EAAC,aAAa,EAAE,MAAM,EAAE,yBAAyB,CAAC,CAAC;QAEnF,MAAM,QAAQ,GAAG,IAAA,yDAAiC,EAAC,MAAM,CAAC,CAAC;QAE3D,qBAAM,CAAC,EAAE,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAExE,iCAAiC;QACjC,MAAM,CAAC,OAAO,EAAE,IAAI,CAClB,IAAI,mCAAe,CAAC;YAClB,aAAa;YACb,QAAQ,EAAE,QAAQ;YAClB,mBAAmB,EAAE,cAAc,EAAE,mBAAmB;YACxD,KAAK,EAAE,cAAc,EAAE,KAAK;SAC7B,CAAC,CACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAA,gCAAiB,EAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ze-webpack-plugin.js","sourceRoot":"","sources":["../../src/webpack-plugin/ze-webpack-plugin.ts"],"names":[],"mappings":";;;AAIA,iEAK+B;AAE/B,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAcrC,MAAa,eAAe;IAG1B,YAAY,OAA+D;QACzE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC;QACzE,IAAA,8CAAsB,EAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QAC9D,IAAA,qCAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACvC,IAAA,6CAAqB,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/C,IAAA,qCAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AAdD,0CAcC"}
package/eslint.config.mjs DELETED
@@ -1,16 +0,0 @@
1
- import baseConfig from '../../eslint.config.mjs';
2
-
3
- export default [
4
- ...baseConfig,
5
- {
6
- files: ['**/*.ts', '**/*.tsx'],
7
- rules: {
8
- '@typescript-eslint/explicit-function-return-type': [
9
- 'error',
10
- {
11
- allowExpressions: true,
12
- },
13
- ],
14
- },
15
- },
16
- ];