zephyr-modernjs-plugin 0.0.1 → 0.0.35

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/LICENSE ADDED
@@ -0,0 +1,39 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ ...
13
+
14
+ END OF TERMS AND CONDITIONS
15
+
16
+ APPENDIX: How to apply the Apache License to your work.
17
+
18
+ To apply the Apache License to your work, attach the following
19
+ boilerplate notice, with the fields enclosed by brackets "[]"
20
+ replaced with your own identifying information. (Don't include
21
+ the brackets!) The text should be enclosed in the appropriate
22
+ comment syntax for the file format. We also recommend that a
23
+ file or class name and description of purpose be included on the
24
+ same line as the copyright notice for each file. The "copyright"
25
+ word should be left as is (without quotes).
26
+
27
+ Copyright [2023] [Zephyr Cloud]
28
+
29
+ Licensed under the Apache License, Version 2.0 (the "License");
30
+ you may not use this file except in compliance with the License.
31
+ You may obtain a copy of the License at
32
+
33
+ http://www.apache.org/licenses/LICENSE-2.0
34
+
35
+ Unless required by applicable law or agreed to in writing, software
36
+ distributed under the License is distributed on an "AS IS" BASIS,
37
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38
+ See the License for the specific language governing permissions and
39
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # Zephyr ModernJS: We made application federation easy
2
+
3
+ ### How to use?
4
+
5
+ The plugin requires the following configuration to work:
6
+
7
+ - Output
8
+ - HTML
9
+ - Source
10
+
11
+ ```ts
12
+ export default defineConfig({
13
+ output: {
14
+ distPath: {
15
+ html: './',
16
+ },
17
+ },
18
+ html: {
19
+ outputStructure: 'flat',
20
+ },
21
+ source: {
22
+ mainEntryName: 'index',
23
+ },
24
+ runtime: {
25
+ router: true,
26
+ },
27
+ plugins: [
28
+ appTools({
29
+ bundler: 'rspack', // Set to 'webpack' to enable webpack
30
+ }),
31
+ withZephyr(), // Last
32
+ ],
33
+ });
34
+ ```
@@ -0,0 +1 @@
1
+ export { withZephyr } from './modernjs-plugin/with-zephyr';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withZephyr = void 0;
4
+ var with_zephyr_1 = require("./modernjs-plugin/with-zephyr");
5
+ Object.defineProperty(exports, "withZephyr", { enumerable: true, get: function () { return with_zephyr_1.withZephyr; } });
6
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2D;AAAlD,yGAAA,UAAU,OAAA;AAEnB,QAAQ;AACR,+DAAyD;AAAhD,yHAAA,gBAAgB,OAAA;AACzB,6CAAgD;AAAvC,gHAAA,gBAAgB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2D;AAAlD,yGAAA,UAAU,OAAA"}
@@ -0,0 +1,3 @@
1
+ import { ZephyrPluginOptions } from 'zephyr-edge-contract';
2
+ import { AppTools, CliPluginFuture } from '@modern-js/app-tools';
3
+ export declare const withZephyr: (zephyrOptions?: ZephyrPluginOptions) => CliPluginFuture<AppTools<"rspack" | "webpack">>;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.withZephyr = void 0;
37
+ const zephyr_agent_1 = require("zephyr-agent");
38
+ const pluginName = 'zephyr-modernjs-plugin';
39
+ const isDev = process.env['NODE_ENV'] === 'development';
40
+ const withZephyr = (zephyrOptions) => ({
41
+ name: pluginName,
42
+ pre: ['@modern-js/plugin-module-federation-config'],
43
+ async setup(api) {
44
+ api.modifyWebpackConfig(async (config, utils) => {
45
+ const currentBundler = api.getAppContext().bundlerType;
46
+ if (currentBundler !== 'webpack') {
47
+ return;
48
+ }
49
+ const { withZephyr } = await Promise.resolve().then(() => __importStar(require('zephyr-webpack-plugin')));
50
+ const z_config = await withZephyr(zephyrOptions)(config);
51
+ utils.mergeConfig(config, z_config);
52
+ });
53
+ api.modifyRspackConfig(async (config, utils) => {
54
+ const currentBundler = api.getAppContext().bundlerType;
55
+ if (currentBundler !== 'rspack') {
56
+ return;
57
+ }
58
+ const { withZephyr } = await Promise.resolve().then(() => __importStar(require('zephyr-rspack-plugin')));
59
+ const z_config = await withZephyr(zephyrOptions)(config);
60
+ utils.mergeConfig(config, z_config);
61
+ });
62
+ },
63
+ usePlugins: isDev ? [zephyrFixPublicPath()] : [],
64
+ });
65
+ exports.withZephyr = withZephyr;
66
+ function zephyrFixPublicPath() {
67
+ return {
68
+ name: 'zephyr-publicpath-fix',
69
+ pre: [pluginName],
70
+ setup(api) {
71
+ api.modifyWebpackConfig(async (config, { isServer }) => {
72
+ if (!isServer) {
73
+ (0, zephyr_agent_1.ze_log)('Modifying publicPath for Dev Server');
74
+ config.output = { ...config.output, publicPath: 'auto' };
75
+ }
76
+ });
77
+ api.modifyRspackConfig(async (config, { isServer }) => {
78
+ if (!isServer) {
79
+ (0, zephyr_agent_1.ze_log)('Modifying publicPath for Dev Server');
80
+ config.output = { ...config.output, publicPath: 'auto' };
81
+ }
82
+ });
83
+ },
84
+ };
85
+ }
86
+ //# sourceMappingURL=with-zephyr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"with-zephyr.js","sourceRoot":"","sources":["../../src/modernjs-plugin/with-zephyr.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+CAAsC;AAEtC,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,aAAa,CAAC;AAEjD,MAAM,UAAU,GAAG,CACxB,aAAmC,EACc,EAAE,CAAC,CAAC;IACrD,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,CAAC,4CAA4C,CAAC;IAEnD,KAAK,CAAC,KAAK,CAAC,GAAG;QACb,GAAG,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;YAC9C,MAAM,cAAc,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC,WAAW,CAAC;YACvD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;gBACjC,OAAO;YACT,CAAC;YAED,MAAM,EAAE,UAAU,EAAE,G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AAkB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;gBACpD,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,IAAA,qBAAM,EAAC,qCAAqC,CAAC,CAAC;oBAC9C,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;gBAC3D,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "zephyr-modernjs-plugin",
3
+ "version": "0.0.35",
4
+ "license": "Apache-2.0",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "commonjs",
8
+ "scripts": {
9
+ "build": "nx run zephyr-modernjs-plugin:build",
10
+ "patch-version": "pnpm version"
11
+ },
12
+ "dependencies": {
13
+ "is-ci": "^3.0.1",
14
+ "tslib": "^2.3.0",
15
+ "@modern-js/app-tools": "^2.65.0",
16
+ "@module-federation/modern-js": "^0.8.9",
17
+ "zephyr-agent": "workspace:*",
18
+ "zephyr-edge-contract": "workspace:*",
19
+ "zephyr-xpack-internal": "workspace:*"
20
+ },
21
+ "devDependencies": {
22
+ "@types/is-ci": "^3.0.4",
23
+ "@types/node-persist": "^3.1.8"
24
+ },
25
+ "peerDependencies": {
26
+ "zephyr-rspack-plugin": "workspace:*",
27
+ "zephyr-webpack-plugin": "workspace:*"
28
+ },
29
+ "peerDependenciesMeta": {
30
+ "zephyr-rspack-plugin": {
31
+ "optional": true
32
+ },
33
+ "zephyr-webpack-plugin": {
34
+ "optional": true
35
+ }
36
+ }
37
+ }
package/package.json CHANGED
@@ -1,28 +1,37 @@
1
1
  {
2
2
  "name": "zephyr-modernjs-plugin",
3
- "version": "0.0.1",
3
+ "version": "0.0.35",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "commonjs",
8
- "scripts": {
9
- "build": "nx run zephyr-modernjs-plugin:build",
10
- "patch-version": "pnpm version"
11
- },
12
8
  "dependencies": {
13
- "@module-federation/automatic-vendor-federation": "1.2.1",
14
9
  "is-ci": "^3.0.1",
15
10
  "tslib": "^2.3.0",
16
- "@modern-js/app-tools": "^2.63.7",
11
+ "@modern-js/app-tools": "^2.65.0",
17
12
  "@module-federation/modern-js": "^0.8.9",
18
- "zephyr-agent": "workspace:*",
19
- "zephyr-edge-contract": "workspace:*",
20
- "zephyr-xpack-internal": "workspace:*",
21
- "webpack": "5.97.1",
22
- "@rspack/core": "^1.1.8"
13
+ "zephyr-agent": "0.0.35",
14
+ "zephyr-edge-contract": "0.0.35",
15
+ "zephyr-xpack-internal": "0.0.35"
23
16
  },
24
17
  "devDependencies": {
25
18
  "@types/is-ci": "^3.0.4",
26
19
  "@types/node-persist": "^3.1.8"
20
+ },
21
+ "peerDependencies": {
22
+ "zephyr-rspack-plugin": "0.0.35",
23
+ "zephyr-webpack-plugin": "0.0.35"
24
+ },
25
+ "peerDependenciesMeta": {
26
+ "zephyr-rspack-plugin": {
27
+ "optional": true
28
+ },
29
+ "zephyr-webpack-plugin": {
30
+ "optional": true
31
+ }
32
+ },
33
+ "scripts": {
34
+ "build": "nx run zephyr-modernjs-plugin:build",
35
+ "patch-version": "pnpm version"
27
36
  }
28
37
  }
package/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { withZephyr } from './modernjs-plugin/with-zephyr';
2
- export { onDeploymentDone } from 'zephyr-xpack-internal';
3
- export { resolveIndexHtml } from 'zephyr-agent';
package/index.js DELETED
@@ -1,11 +0,0 @@
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("./modernjs-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; } });
11
- //# sourceMappingURL=index.js.map
@@ -1,3 +0,0 @@
1
- import { ZephyrPluginOptions } from 'zephyr-edge-contract';
2
- import { AppTools, CliPlugin } from '@modern-js/app-tools';
3
- export declare const withZephyr: (zephyrOptions?: ZephyrPluginOptions) => CliPlugin<AppTools<'rspack' | 'webpack'>>;
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withZephyr = void 0;
4
- const ze_modernjs_plugin_1 = require("./ze-modernjs-plugin");
5
- const zephyr_xpack_internal_1 = require("zephyr-xpack-internal");
6
- const zephyr_agent_1 = require("zephyr-agent");
7
- const pluginName = 'zephyr-modernjs-plugin';
8
- const isDev = process.env['NODE_ENV'] === 'development';
9
- const withZephyr = (zephyrOptions) => ({
10
- name: pluginName,
11
- pre: ['@modern-js/plugin-module-federation-config'],
12
- setup: async ({ useAppContext }) => {
13
- const appContext = useAppContext();
14
- const zephyrEngineOptions = {
15
- context: appContext.appDirectory,
16
- builder: appContext.bundlerType === 'rspack' ? 'rspack' : 'webpack',
17
- };
18
- const zephyrEngine = await zephyr_agent_1.ZephyrEngine.create(zephyrEngineOptions);
19
- return {
20
- config: async () => {
21
- const dependencyPairs = (0, zephyr_xpack_internal_1.extractFederatedDependencyPairs)(appContext);
22
- const resolvedDependencies = await zephyrEngine.resolve_remote_dependencies(dependencyPairs);
23
- (0, zephyr_xpack_internal_1.mutWebpackFederatedRemotesConfig)(zephyrEngine, appContext, resolvedDependencies);
24
- const mfConfig = (0, zephyr_xpack_internal_1.makeCopyOfModuleFederationOptions)(appContext);
25
- return {
26
- tools: {
27
- webpack(config) {
28
- config.plugins?.push(
29
- // @ts-expect-error Probably should change for Webpack ?
30
- new ze_modernjs_plugin_1.ZeModernjsPlugin({
31
- zephyr_engine: zephyrEngine,
32
- mfConfig,
33
- wait_for_index_html: zephyrOptions?.wait_for_index_html,
34
- }));
35
- },
36
- rspack(config) {
37
- config.plugins?.push(new ze_modernjs_plugin_1.ZeModernjsPlugin({
38
- zephyr_engine: zephyrEngine,
39
- mfConfig,
40
- wait_for_index_html: zephyrOptions?.wait_for_index_html,
41
- }));
42
- },
43
- },
44
- };
45
- },
46
- };
47
- },
48
- usePlugins: isDev ? [zephyrFixPublicPath()] : [],
49
- });
50
- exports.withZephyr = withZephyr;
51
- function zephyrFixPublicPath() {
52
- return {
53
- name: 'zephyr-publicpath-fix',
54
- pre: [pluginName],
55
- setup: async () => ({
56
- config: async () => ({
57
- tools: {
58
- webpack(config, { isServer }) {
59
- if (!isServer) {
60
- config.output = { ...config.output, publicPath: 'auto' };
61
- }
62
- return config;
63
- },
64
- rspack(config, { isServer }) {
65
- if (!isServer) {
66
- config.output = { ...config.output, publicPath: 'auto' };
67
- }
68
- return config;
69
- },
70
- },
71
- }),
72
- }),
73
- };
74
- }
75
- //# sourceMappingURL=with-zephyr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"with-zephyr.js","sourceRoot":"","sources":["../../src/modernjs-plugin/with-zephyr.ts"],"names":[],"mappings":";;;AAEA,6DAAwD;AACxD,iEAI+B;AAC/B,+CAA4C;AAE5C,MAAM,UAAU,GAAG,wBAAwB,CAAC;AAE5C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,aAAa,CAAC;AAEjD,MAAM,UAAU,GAAG,CACxB,aAAmC,EACQ,EAAE,CAAC,CAAC;IAC/C,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,CAAC,4CAA4C,CAAC;IAEnD,KAAK,EAAE,KAAK,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;QACjC,MAAM,UAAU,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U,QAAA,UAAU,cAoDpB;AAEH,SAAS,mBAAmB;IAC1B,OAAO;QACL,IAAI,EAAE,uBAAuB;QAC7B,GAAG,EAAE,CAAC,UAAU,CAAC;QACjB,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAClB,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;gBACnB,KAAK,EAAE;oBACL,OAAO,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE;wBAC1B,IAAI,CAAC,QAAQ,EAAE,CAAC;4BACd,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;wBAC3D,CAAC;wBACD,OAAO,MAAM,CAAC;oBAChB,CAAC;oBACD,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE;wBACzB,IAAI,CAAC,QAAQ,EAAE,CAAC;4BACd,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;wBAC3D,CAAC;wBACD,OAAO,MAAM,CAAC;oBAChB,CAAC;iBACF;aACF,CAAC;SACH,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -1,14 +0,0 @@
1
- import { ZephyrEngine } from 'zephyr-agent';
2
- import { ModuleFederationPlugin } from 'zephyr-xpack-internal';
3
- import { Compiler } from '@rspack/core';
4
- export interface ZephyrModernjsInternalPluginOptions {
5
- zephyr_engine: ZephyrEngine;
6
- pluginName: string;
7
- mfConfig: ModuleFederationPlugin[] | ModuleFederationPlugin | undefined;
8
- wait_for_index_html?: boolean;
9
- }
10
- export declare class ZeModernjsPlugin {
11
- _options: ZephyrModernjsInternalPluginOptions;
12
- constructor(options: Omit<ZephyrModernjsInternalPluginOptions, 'pluginName'>);
13
- apply(compiler: Compiler): void;
14
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZeModernjsPlugin = void 0;
4
- const ze_setup_deploy_1 = require("./ze-setup-deploy");
5
- const ze_setup_build_steps_logging_1 = require("./ze-setup-build-steps-logging");
6
- const pluginName = 'ZeRspackPlugin';
7
- class ZeModernjsPlugin {
8
- constructor(options) {
9
- this._options = Object.assign({ pluginName }, options);
10
- }
11
- apply(compiler) {
12
- this._options.zephyr_engine.buildProperties.output = compiler.outputPath;
13
- (0, ze_setup_build_steps_logging_1.logBuildSteps)(this._options, compiler);
14
- (0, ze_setup_deploy_1.setupZeDeploy)(this._options, compiler);
15
- }
16
- }
17
- exports.ZeModernjsPlugin = ZeModernjsPlugin;
18
- //# sourceMappingURL=ze-modernjs-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ze-modernjs-plugin.js","sourceRoot":"","sources":["../../src/modernjs-plugin/ze-modernjs-plugin.ts"],"names":[],"mappings":";;;AAEA,uDAAkD;AAClD,iFAA+D;AAI/D,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAapC,MAAa,gBAAgB;IAG3B,YAAY,OAAgE;QAC1E,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;QAEzE,IAAA,4CAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACvC,IAAA,+BAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF;AAbD,4CAaC"}
@@ -1,10 +0,0 @@
1
- import { type Source } from 'zephyr-edge-contract';
2
- import { Stats, StatsCompilation } from '@rspack/core';
3
- import { ZephyrModernjsInternalPluginOptions } from './ze-modernjs-plugin';
4
- export interface ZephyrAgentProps {
5
- stats: Stats;
6
- stats_json: StatsCompilation;
7
- pluginOptions: ZephyrModernjsInternalPluginOptions;
8
- assets: Record<string, Source>;
9
- }
10
- export declare function modernjs_zephyr_agent({ stats, stats_json, assets, pluginOptions, }: ZephyrAgentProps): Promise<void>;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.modernjs_zephyr_agent = void 0;
4
- const zephyr_agent_1 = require("zephyr-agent");
5
- const zephyr_xpack_internal_1 = require("zephyr-xpack-internal");
6
- async function modernjs_zephyr_agent({ stats, stats_json, assets, pluginOptions, }) {
7
- (0, zephyr_agent_1.ze_log)('Initiating: Zephyr Modernjs Upload Agent');
8
- const zeStart = Date.now();
9
- const { wait_for_index_html, zephyr_engine } = pluginOptions;
10
- try {
11
- const assetsMap = await (0, zephyr_xpack_internal_1.buildWebpackAssetMap)(assets, {
12
- wait_for_index_html,
13
- });
14
- // rspack dash data
15
- const { EDGE_URL, PLATFORM } = await zephyr_engine.application_configuration;
16
- const dashData = await (0, zephyr_xpack_internal_1.getBuildStats)({
17
- stats,
18
- stats_json,
19
- assets,
20
- pluginOptions,
21
- EDGE_URL,
22
- PLATFORM,
23
- });
24
- await zephyr_engine.upload_assets({
25
- assetsMap,
26
- mfConfig: pluginOptions.mfConfig,
27
- buildStats: dashData,
28
- });
29
- }
30
- catch (err) {
31
- (0, zephyr_agent_1.logFn)('error', zephyr_agent_1.ZephyrError.format(err));
32
- }
33
- finally {
34
- (0, zephyr_xpack_internal_1.emitDeploymentDone)();
35
- // todo: log end
36
- (0, zephyr_agent_1.ze_log)('Zephyr Rspack Upload Agent: Done in', Date.now() - zeStart, 'ms');
37
- }
38
- }
39
- exports.modernjs_zephyr_agent = modernjs_zephyr_agent;
40
- //# sourceMappingURL=ze-modernjs-upload-agent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ze-modernjs-upload-agent.js","sourceRoot":"","sources":["../../src/modernjs-plugin/ze-modernjs-upload-agent.ts"],"names":[],"mappings":";;;AAAA,+CAA0D;AAQ1D,iEAI+B;AASxB,KAAK,UAAU,qBAAqB,CAAC,EAC1C,KAAK,EACL,UAAU,EACV,MAAM,EACN,aAAa,GACI;IACjB,IAAA,qBAAM,EAAC,0CAA0C,CAAC,CAAC;IAEnD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC3B,MAAM,EAAE,mBAAmB,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;IAE7D,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,IAAA,4CAAoB,EAAC,MAAM,EAAE;YACnD,mBAAmB;SACpB,CAAC,CAAC;QAEH,mBAAmB;QACnB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,aAAa,CAAC,yBAAyB,CAAC;QAE7E,MAAM,QAAQ,GAAG,MAAM,IAAA,qCAAa,EAAC;YACnC,KAAK;YACL,UAAU;YACV,MAAM;YACN,aAAa;YACb,QAAQ;YACR,QAAQ;SACT,CAAC,CAAC;QAEH,MAAM,aAAa,CAAC,aAAa,CAAC;YAChC,SAAS;YACT,QAAQ,EAAE,aAAa,CAAC,QAGX;YACb,UAAU,EAAE,QAAuC;SACpD,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAA,oBAAK,EAAC,OAAO,EAAE,0BAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1C,CAAC;YAAS,CAAC;QACT,IAAA,0CAAkB,GAAE,CAAC;QACrB,gBAAgB;QAChB,IAAA,qBAAM,EAAC,qCAAqC,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AA3CD,sDA2CC"}
@@ -1,5 +0,0 @@
1
- import { Compiler } from '@rspack/core';
2
- import { ZephyrModernjsInternalPluginOptions } from './ze-modernjs-plugin';
3
- export declare function logBuildSteps(pluginOptions: ZephyrModernjsInternalPluginOptions, compiler: Compiler): {
4
- buildStartedAt: number;
5
- };
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logBuildSteps = void 0;
4
- const zephyr_agent_1 = require("zephyr-agent");
5
- function logBuildSteps(pluginOptions, compiler) {
6
- const { pluginName } = pluginOptions;
7
- let buildStartedAt = Date.now();
8
- compiler.hooks.beforeCompile.tapAsync(pluginName, async (params, cb) => {
9
- buildStartedAt = Date.now();
10
- (0, zephyr_agent_1.ze_log)('build started at', buildStartedAt);
11
- cb();
12
- });
13
- compiler.hooks.failed.tap(pluginName, (err) => {
14
- (0, zephyr_agent_1.ze_log)(`build failed in ${Date.now() - buildStartedAt}ms`);
15
- pluginOptions.zephyr_engine.logger.then((logger) => {
16
- logger({
17
- level: 'error',
18
- action: 'build:failed',
19
- message: zephyr_agent_1.ZephyrError.format(err),
20
- });
21
- });
22
- });
23
- return { buildStartedAt };
24
- }
25
- exports.logBuildSteps = logBuildSteps;
26
- //# sourceMappingURL=ze-setup-build-steps-logging.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ze-setup-build-steps-logging.js","sourceRoot":"","sources":["../../src/modernjs-plugin/ze-setup-build-steps-logging.ts"],"names":[],"mappings":";;;AAEA,+CAAmD;AAEnD,SAAgB,aAAa,CAC3B,aAAkD,EAClD,QAAkB;IAElB,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;IAErC,IAAI,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEhC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE;QACrE,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5B,IAAA,qBAAM,EAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;QAC3C,EAAE,EAAE,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE;QAC5C,IAAA,qBAAM,EAAC,mBAAmB,IAAI,CAAC,GAAG,EAAE,GAAG,cAAc,IAAI,CAAC,CAAC;QAE3D,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACjD,MAAM,CAAC;gBACL,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,cAAc;gBACtB,OAAO,EAAE,0BAAW,CAAC,MAAM,CAAC,GAAG,CAAC;aACjC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC;AA3BD,sCA2BC"}
@@ -1,3 +0,0 @@
1
- import { ZephyrModernjsInternalPluginOptions } from './ze-modernjs-plugin';
2
- import { Compiler } from '@rspack/core';
3
- export declare function setupZeDeploy(pluginOptions: ZephyrModernjsInternalPluginOptions, compiler: Compiler): void;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupZeDeploy = void 0;
4
- const tslib_1 = require("tslib");
5
- const process = tslib_1.__importStar(require("node:process"));
6
- const ze_modernjs_upload_agent_1 = require("./ze-modernjs-upload-agent");
7
- const zephyr_xpack_internal_1 = require("zephyr-xpack-internal");
8
- function setupZeDeploy(pluginOptions, compiler) {
9
- const { pluginName } = pluginOptions;
10
- compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
11
- compilation.hooks.processAssets.tapPromise({
12
- name: pluginName,
13
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT,
14
- }, async (assets) => {
15
- const stats = compilation.getStats();
16
- const stats_json = compilation.getStats().toJson();
17
- await pluginOptions.zephyr_engine.start_new_build();
18
- process.nextTick(ze_modernjs_upload_agent_1.modernjs_zephyr_agent, {
19
- stats,
20
- stats_json,
21
- assets,
22
- pluginOptions,
23
- });
24
- if (!pluginOptions.wait_for_index_html) {
25
- await (0, zephyr_xpack_internal_1.onDeploymentDone)();
26
- }
27
- // empty line to separate logs from other plugins
28
- console.log();
29
- });
30
- });
31
- }
32
- exports.setupZeDeploy = setupZeDeploy;
33
- //# sourceMappingURL=ze-setup-deploy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ze-setup-deploy.js","sourceRoot":"","sources":["../../src/modernjs-plugin/ze-setup-deploy.ts"],"names":[],"mappings":";;;;AAAA,8DAAwC;AAExC,yEAAmE;AAGnE,iEAAyD;AAEzD,SAAgB,aAAa,CAC3B,aAAkD,EAClD,QAAkB;IAElB,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;IAErC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE,EAAE;QAC7D,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU,CACxC;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,2BAA2B;SAChE,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;YACf,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC;YAEnD,MAAM,aAAa,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC;YAEpD,OAAO,CAAC,QAAQ,CAAC,gDAAqB,EAAE;gBACtC,KAAK;gBACL,UAAU;gBACV,MAAM;gBACN,aAAa;aACd,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,CAAC;gBACvC,MAAM,IAAA,wCAAgB,GAAE,CAAC;YAC3B,CAAC;YAED,iDAAiD;YACjD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAlCD,sCAkCC"}
@@ -1 +0,0 @@
1
- {"version":"5.4.3"}