zephyr-repack-plugin 0.0.0-canary-20250323205926 → 0.0.0-canary-20250324122603

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.
@@ -0,0 +1,9 @@
1
+ import { Configuration } from '@rspack/core';
2
+ import { DelegateConfig } from '../../type/zephyr-internal-types';
3
+ import { XPackConfiguration } from 'zephyr-xpack-internal';
4
+ import { Compiler } from '@rspack/core';
5
+ type Plugin = NonNullable<XPackConfiguration<Compiler>['plugins']>[number];
6
+ export declare function is_repack_plugin(plugin?: Plugin): any;
7
+ type Platform = DelegateConfig['target'];
8
+ export declare function get_platform_from_repack(config: Configuration): Platform;
9
+ export {};
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.is_repack_plugin = is_repack_plugin;
4
+ exports.get_platform_from_repack = get_platform_from_repack;
5
+ function is_repack_plugin(plugin) {
6
+ if (!plugin || typeof plugin !== 'object') {
7
+ return false;
8
+ }
9
+ return (plugin.constructor.name.includes('RepackPlugin') ||
10
+ plugin['name']?.includes('RepackPlugin'));
11
+ }
12
+ function get_platform_from_repack(config) {
13
+ return config.plugins
14
+ ?.filter(is_repack_plugin)
15
+ ?.map((plugin) => plugin.config.platform)[0];
16
+ }
17
+ //# sourceMappingURL=get-platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-platform.js","sourceRoot":"","sources":["../../../src/lib/utils/get-platform.ts"],"names":[],"mappings":";;AAMA,4CAQC;AAID,4DAIC;AAhBD,SAAgB,gBAAgB,CAAC,MAAe;IAC9C,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;QAChD,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CACzC,CAAC;AACJ,CAAC;AAID,SAAgB,wBAAwB,CAAC,MAAqB;IAC5D,OAAO,MAAM,CAAC,OAAO;QACnB,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAC1B,EAAE,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC"}
@@ -1,4 +1,3 @@
1
1
  import { Configuration } from '@rspack/core';
2
2
  import { ZephyrRepackPluginOptions } from './ze-repack-plugin';
3
- import { RePackConfiguration, RepackEnv } from '../type/zephyr-internal-types';
4
- export declare function withZephyr(zephyrPluginOptions?: ZephyrRepackPluginOptions): (configFn: (env: RepackEnv) => RePackConfiguration) => (config: RePackConfiguration) => Promise<Configuration>;
3
+ export declare function withZephyr(zephyrPluginOptions?: ZephyrRepackPluginOptions): (config: Configuration) => Promise<Configuration>;
@@ -3,29 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withZephyr = withZephyr;
4
4
  const zephyr_agent_1 = require("zephyr-agent");
5
5
  const ze_repack_plugin_1 = require("./ze-repack-plugin");
6
+ const get_platform_1 = require("./utils/get-platform");
6
7
  const zephyr_xpack_internal_1 = require("zephyr-xpack-internal");
7
8
  const delegate_module_template_1 = require("../delegate-module/delegate-module-template");
8
9
  const ze_util_verification_1 = require("./utils/ze-util-verification");
9
10
  function withZephyr(zephyrPluginOptions) {
10
- // RETURN 1: Function that takes the user's config function
11
- return (configFn) => {
12
- // RETURN 2: Function that takes the base config and returns the final webpack config
13
- return (config) => {
14
- // Extract environment from config
15
- // Generate user config by calling their function with env
16
- const userConfig = configFn({
17
- platform: config.platform,
18
- mode: config.mode,
19
- });
20
- const updatedZephyrConfig = {
21
- ...zephyrPluginOptions,
22
- target: config.platform,
23
- };
24
- (0, zephyr_agent_1.ze_log)('updatedZephyrConfig: ', updatedZephyrConfig);
25
- // Return the final processed configuration
26
- return _zephyr_configuration(userConfig, updatedZephyrConfig);
27
- };
28
- };
11
+ return (config) => _zephyr_configuration(config, zephyrPluginOptions);
29
12
  }
30
13
  async function _zephyr_configuration(config,
31
14
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -35,11 +18,11 @@ _zephyrOptions) {
35
18
  builder: 'repack',
36
19
  context: config.context,
37
20
  });
38
- (0, zephyr_agent_1.ze_log)('Configuring with Zephyr... \n config:', config, '\n _zephyrOptions: ', _zephyrOptions);
39
- zephyr_engine.env.target = _zephyrOptions?.target;
21
+ (0, zephyr_agent_1.ze_log)('Configuring with Zephyr...');
22
+ const target = (0, get_platform_1.get_platform_from_repack)(config);
23
+ (0, zephyr_agent_1.ze_log)('Deploy build target: ', target);
40
24
  const dependency_pairs = (0, zephyr_xpack_internal_1.extractFederatedDependencyPairs)(config);
41
- (0, zephyr_agent_1.ze_log)('Resolving and building towards target by zephyr_engine.env.target: ', zephyr_engine.env.target);
42
- const resolved_dependency_pairs = await zephyr_engine.resolve_remote_dependencies(dependency_pairs, zephyr_engine.env.target);
25
+ const resolved_dependency_pairs = await zephyr_engine.resolve_remote_dependencies(dependency_pairs, target);
43
26
  (0, zephyr_xpack_internal_1.mutWebpackFederatedRemotesConfig)(zephyr_engine, config, resolved_dependency_pairs, delegate_module_template_1.repack_delegate_module_template);
44
27
  (0, zephyr_agent_1.ze_log)('dependency resolution completed successfully...or at least trying to...');
45
28
  const mf_configs = (0, zephyr_xpack_internal_1.makeCopyOfModuleFederationOptions)(config);
@@ -49,6 +32,7 @@ _zephyrOptions) {
49
32
  (0, zephyr_agent_1.ze_log)('Application uid created...');
50
33
  config.plugins?.push(new ze_repack_plugin_1.ZeRepackPlugin({
51
34
  zephyr_engine,
35
+ target,
52
36
  mfConfig: (0, zephyr_xpack_internal_1.makeCopyOfModuleFederationOptions)(config),
53
37
  }));
54
38
  return config;
@@ -1 +1 @@
1
- {"version":3,"file":"with-zephyr.js","sourceRoot":"","sources":["../../src/lib/with-zephyr.ts"],"names":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B,EAAC,MAAM,CAAC,CAAC;IAChD,IAAA,qBAAM,EAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;IAExC,MAAM,gBAAgB,GAAG,IAAA,uDAA+B,EAAC,MAAM,CAAC,CAAC;IAEjE,MAAM,yBAAyB,GAAG,MAAM,aAAa,CAAC,2BAA2B,CAC/E,gBAAgB,EAChB,MAAM,CACP,CAAC;IACF,IAAA,wDAAgC,EAC9B,aAAa,EACb,MAAM,EACN,yBAAyB,EACzB,0DAA+B,CAChC,CAAC;IAEF,IAAA,qBAAM,EAAC,yEAAyE,CAAC,CAAC;IAElF,MAAM,UAAU,GAAG,IAAA,yDAAiC,EAAC,MAAM,CAAC,CAAC;IAC7D,oEAAoE;IACpE,kDAAkD;IAClD,MAAM,IAAA,8CAAuB,EAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAEzD,IAAA,qBAAM,EAAC,4BAA4B,CAAC,CAAC;IACrC,MAAM,CAAC,OAAO,EAAE,IAAI,CAClB,IAAI,iCAAc,CAAC;QACjB,aAAa;QACb,MAAM;QACN,QAAQ,EAAE,IAAA,yDAAiC,EAAC,MAAM,CAAC;KACpD,CAAC,CACH,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,12 +1,11 @@
1
1
  import { Compiler } from '@rspack/core';
2
2
  import { ZephyrEngine } from 'zephyr-agent';
3
3
  import { ModuleFederationPlugin } from 'zephyr-xpack-internal';
4
- import { Platform } from '../type/zephyr-internal-types';
5
4
  export interface ZephyrRepackPluginOptions {
6
5
  zephyr_engine: ZephyrEngine;
7
6
  pluginName: string;
8
7
  mfConfig: ModuleFederationPlugin[] | ModuleFederationPlugin | undefined;
9
- target?: Platform | undefined;
8
+ target: 'ios' | 'android' | 'web' | undefined;
10
9
  }
11
10
  export declare class ZeRepackPlugin {
12
11
  _options: ZephyrRepackPluginOptions;
package/dist/package.json CHANGED
@@ -15,10 +15,12 @@
15
15
  "zephyr-xpack-internal": "workspace:*"
16
16
  },
17
17
  "devDependencies": {
18
- "@callstack/repack": "5.0.0",
19
- "@rspack/core": "1.0.8",
18
+ "@callstack/repack": "5.0.4",
19
+ "@rspack/core": "catalog:rspack",
20
+ "@typescript-eslint/eslint-plugin": "catalog:eslint",
20
21
  "@types/find-package-json": "^1.2.6",
21
- "@types/is-ci": "^3.0.4"
22
+ "ts-jest": "catalog:typescript",
23
+ "@types/jest": "catalog:typescript"
22
24
  },
23
25
  "types": "./index.d.ts"
24
26
  }
@@ -1,22 +1,6 @@
1
- import { Configuration, Context } from '@rspack/core';
2
- import { EnvOptions } from '@callstack/repack';
3
1
  export interface DelegateConfig {
4
2
  org: string;
5
3
  project: string;
6
4
  application?: undefined;
7
5
  target?: 'ios' | 'android' | 'web' | undefined;
8
6
  }
9
- export type Platform = DelegateConfig['target'];
10
- export interface RepackEnv {
11
- context?: Context;
12
- reactNativePath?: string;
13
- mode?: 'development' | 'production' | undefined;
14
- devServer?: {
15
- port?: number;
16
- host?: string;
17
- https?: boolean;
18
- hmr?: boolean;
19
- };
20
- platform?: EnvOptions['platform'];
21
- }
22
- export type RePackConfiguration = Configuration & RepackEnv;
package/package.json CHANGED
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "name": "zephyr-repack-plugin",
3
- "version": "0.0.0-canary-20250323205926",
3
+ "version": "0.0.0-canary-20250324122603",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "type": "commonjs",
8
8
  "dependencies": {
9
- "zephyr-xpack-internal": "0.0.0-canary-20250323205926",
10
- "zephyr-agent": "0.0.0-canary-20250323205926"
9
+ "zephyr-agent": "0.0.0-canary-20250324122603",
10
+ "zephyr-xpack-internal": "0.0.0-canary-20250324122603"
11
11
  },
12
12
  "devDependencies": {
13
- "@callstack/repack": "5.0.0",
14
- "@rspack/core": "1.0.8",
13
+ "@callstack/repack": "5.0.4",
14
+ "@rspack/core": "1.2.8",
15
+ "@typescript-eslint/eslint-plugin": "^8.27.0",
15
16
  "@types/find-package-json": "^1.2.6",
16
- "@types/is-ci": "^3.0.4"
17
+ "ts-jest": "^29.2.6",
18
+ "@types/jest": "29.5.14"
17
19
  },
18
20
  "scripts": {
19
21
  "build": "nx build zephyr-repack-plugin",