@forge/bundler 6.1.23-next.5 → 6.1.23-next.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @forge/bundler
2
2
 
3
+ ## 6.1.23-next.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 1309c32: Setup internal worker based native UI app compilation
8
+ - Updated dependencies [11472b4]
9
+ - Updated dependencies [a02af38]
10
+ - @forge/cli-shared@8.19.0-next.6
11
+ - @forge/manifest@12.5.0-next.4
12
+ - @forge/lint@5.16.3-next.6
13
+
3
14
  ## 6.1.23-next.5
4
15
 
5
16
  ### Patch Changes
@@ -4,5 +4,6 @@ import { EntryPoint } from '../types';
4
4
  import { CommonOutputOptions } from './common';
5
5
  declare type NativeUIConfig = WebpackConfig & Record<'output', CommonOutputOptions>;
6
6
  export declare const getNativeUiBuildConfig: (entrypoints: EntryPoint[], i18nConfig?: Translations) => NativeUIConfig;
7
+ export declare const getNativeUiWorkerBuildConfig: (entrypoints: EntryPoint[], i18nConfig?: Translations, baseOutputDir?: string) => NativeUIConfig;
7
8
  export {};
8
9
  //# sourceMappingURL=nativeui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nativeui.d.ts","sourceRoot":"","sources":["../../src/config/nativeui.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAe,MAAM,UAAU,CAAC;AAE5D,aAAK,cAAc,GAAG,aAAa,GAAG,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAE5E,eAAO,MAAM,sBAAsB,gBAAiB,UAAU,EAAE,eAAe,YAAY,KAAG,cAgF7F,CAAC"}
1
+ {"version":3,"file":"nativeui.d.ts","sourceRoot":"","sources":["../../src/config/nativeui.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAe,MAAM,UAAU,CAAC;AAE5D,aAAK,cAAc,GAAG,aAAa,GAAG,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAgE5E,eAAO,MAAM,sBAAsB,gBAAiB,UAAU,EAAE,eAAe,YAAY,KAAG,cA8B7F,CAAC;AAEF,eAAO,MAAM,4BAA4B,gBAC1B,UAAU,EAAE,eACZ,YAAY,kBACT,MAAM,KACrB,cAwCF,CAAC"}
@@ -1,89 +1,129 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNativeUiBuildConfig = void 0;
3
+ exports.getNativeUiWorkerBuildConfig = exports.getNativeUiBuildConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path_1 = tslib_1.__importDefault(require("path"));
6
6
  const html_webpack_plugin_1 = tslib_1.__importDefault(require("html-webpack-plugin"));
7
7
  const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
8
8
  const cli_shared_1 = require("@forge/cli-shared");
9
9
  const common_1 = require("./common");
10
+ const WORKER_OUTPUT_SUBDIR = '__worker__';
11
+ const getBundleAnalyzerPlugin = (statsFilename) => process.env.FORGE_INSPECT_ARCHIVE
12
+ ? new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
13
+ analyzerMode: 'disabled',
14
+ generateStatsFile: true,
15
+ statsFilename: path_1.default.join(process.cwd(), statsFilename),
16
+ logLevel: 'silent'
17
+ })
18
+ : null;
19
+ const baseNativeUiConfig = {
20
+ mode: 'production',
21
+ devtool: 'source-map',
22
+ node: { __dirname: true },
23
+ performance: { hints: false },
24
+ resolve: {
25
+ extensions: ['.ts', '.tsx', '.js', '.jsx', '.jpg', '.jpeg', '.png', '.gif', '.svg']
26
+ },
27
+ resolveLoader: {
28
+ modules: require.resolve.paths('babel-loader') || undefined
29
+ },
30
+ module: {
31
+ rules: [
32
+ {
33
+ test: /\.(jpe?g|png|gif|svg)$/i,
34
+ type: 'asset/resource'
35
+ },
36
+ { test: /\.tsx?$/, loader: 'ts-loader' },
37
+ {
38
+ test: /\.jsx?$/,
39
+ exclude: /node_modules/,
40
+ use: [
41
+ {
42
+ loader: 'babel-loader',
43
+ options: {
44
+ plugins: [
45
+ [
46
+ require.resolve('@babel/plugin-transform-react-jsx'),
47
+ {
48
+ pragma: 'React.createElement'
49
+ }
50
+ ],
51
+ require.resolve('@babel/plugin-transform-numeric-separator'),
52
+ require.resolve('@babel/plugin-transform-class-static-block'),
53
+ require.resolve('@babel/plugin-transform-class-properties'),
54
+ require.resolve('@babel/plugin-transform-optional-chaining')
55
+ ],
56
+ cacheDirectory: true
57
+ }
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+ }
63
+ };
10
64
  const getNativeUiBuildConfig = (entrypoints, i18nConfig) => {
11
65
  const resolvedEntryPoints = {};
12
66
  for (const entrypoint of entrypoints) {
67
+ if (entrypoint.name === WORKER_OUTPUT_SUBDIR) {
68
+ throw new Error(`Entry point name "${WORKER_OUTPUT_SUBDIR}" is reserved for the web worker bundle output directory and cannot be used as a resource key.`);
69
+ }
13
70
  resolvedEntryPoints[entrypoint.name] = path_1.default.resolve(entrypoint.path);
14
71
  }
15
72
  return {
16
- entry: {
17
- ...resolvedEntryPoints
18
- },
73
+ ...baseNativeUiConfig,
74
+ entry: { ...resolvedEntryPoints },
19
75
  name: 'native-ui',
20
- mode: 'production',
21
- devtool: 'source-map',
76
+ target: 'web',
22
77
  output: {
23
78
  filename: '[name].js',
24
79
  path: (0, cli_shared_1.tmpDir)('native-ui'),
25
80
  publicPath: 'auto'
26
81
  },
27
- node: {
28
- __dirname: true
29
- },
30
- performance: {
31
- hints: false
32
- },
33
82
  plugins: [
34
- new html_webpack_plugin_1.default({
35
- filename: 'index.html'
36
- }),
37
- process.env.FORGE_INSPECT_ARCHIVE
38
- ? new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
39
- analyzerMode: 'disabled',
40
- generateStatsFile: true,
41
- statsFilename: path_1.default.join(process.cwd(), '.forge_app_inspect_stats.json'),
42
- logLevel: 'silent'
43
- })
44
- : null
83
+ new html_webpack_plugin_1.default({ filename: 'index.html' }),
84
+ getBundleAnalyzerPlugin('.forge_app_inspect_stats.json')
45
85
  ].filter(Boolean),
86
+ module: {
87
+ rules: [...(i18nConfig ? [(0, common_1.geti18nRule)(i18nConfig)] : []), ...baseNativeUiConfig.module.rules]
88
+ }
89
+ };
90
+ };
91
+ exports.getNativeUiBuildConfig = getNativeUiBuildConfig;
92
+ const getNativeUiWorkerBuildConfig = (entrypoints, i18nConfig, baseOutputDir) => {
93
+ const resolvedEntryPoints = {};
94
+ for (const entrypoint of entrypoints) {
95
+ resolvedEntryPoints[entrypoint.name] = path_1.default.resolve(entrypoint.path);
96
+ }
97
+ return {
98
+ ...baseNativeUiConfig,
99
+ entry: { ...resolvedEntryPoints },
100
+ name: 'native-ui-worker',
101
+ target: 'webworker',
102
+ experiments: { outputModule: true },
46
103
  resolve: {
47
- extensions: ['.ts', '.tsx', '.js', '.jsx', '.jpg', '.jpeg', '.png', '.gif', '.svg']
104
+ ...baseNativeUiConfig.resolve,
105
+ alias: {
106
+ 'iframe-resizer': false
107
+ }
48
108
  },
49
- resolveLoader: {
50
- modules: require.resolve.paths('babel-loader') || undefined
109
+ output: {
110
+ filename: '[name].js',
111
+ path: path_1.default.join(baseOutputDir ?? (0, cli_shared_1.tmpDir)('native-ui'), WORKER_OUTPUT_SUBDIR),
112
+ module: true
51
113
  },
52
- target: 'web',
114
+ optimization: {
115
+ splitChunks: false,
116
+ runtimeChunk: false
117
+ },
118
+ plugins: [getBundleAnalyzerPlugin('.forge_app_worker_inspect_stats.json')].filter(Boolean),
53
119
  module: {
54
- rules: [
55
- ...(i18nConfig ? [(0, common_1.geti18nRule)(i18nConfig)] : []),
56
- {
57
- test: /\.(jpe?g|png|gif|svg)$/i,
58
- type: 'asset/resource'
59
- },
60
- { test: /\.tsx?$/, loader: 'ts-loader' },
61
- {
62
- test: /\.jsx?$/,
63
- exclude: /node_modules/,
64
- use: [
65
- {
66
- loader: 'babel-loader',
67
- options: {
68
- plugins: [
69
- [
70
- require.resolve('@babel/plugin-transform-react-jsx'),
71
- {
72
- pragma: 'React.createElement'
73
- }
74
- ],
75
- require.resolve('@babel/plugin-transform-numeric-separator'),
76
- require.resolve('@babel/plugin-transform-class-static-block'),
77
- require.resolve('@babel/plugin-transform-class-properties'),
78
- require.resolve('@babel/plugin-transform-optional-chaining')
79
- ],
80
- cacheDirectory: true
81
- }
82
- }
83
- ]
120
+ rules: [...(i18nConfig ? [(0, common_1.geti18nRule)(i18nConfig)] : []), ...baseNativeUiConfig.module.rules],
121
+ parser: {
122
+ javascript: {
123
+ dynamicImportMode: 'eager'
84
124
  }
85
- ]
125
+ }
86
126
  }
87
127
  };
88
128
  };
89
- exports.getNativeUiBuildConfig = getNativeUiBuildConfig;
129
+ exports.getNativeUiWorkerBuildConfig = getNativeUiWorkerBuildConfig;
package/out/index.d.ts CHANGED
@@ -4,6 +4,6 @@ export { NativeUIBundler, NativeUIBundleResult } from './nativeui';
4
4
  export { getNodeBundler, NODE_RUNTIME_CODE_FILE } from './runtime';
5
5
  export { Bundler, BundlerError, BundlerMetadata, emptyMetadata, mergeMetadata, BundlerOutput, BundlerWatch, EntryPoint, WatcherMonitor } from './types';
6
6
  export { getCompiler, handleWebpackCompilationResult } from './webpack';
7
- export { getNativeUiBuildConfig } from './config/nativeui';
7
+ export { getNativeUiBuildConfig, getNativeUiWorkerBuildConfig } from './config/nativeui';
8
8
  export { getWrapperProvider, LocalWrapperProvider } from './wrapper-provider';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,OAAO,EACP,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,OAAO,EACP,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
package/out/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LocalWrapperProvider = exports.getWrapperProvider = exports.getNativeUiBuildConfig = exports.handleWebpackCompilationResult = exports.getCompiler = exports.mergeMetadata = exports.emptyMetadata = exports.BundlerError = exports.NODE_RUNTIME_CODE_FILE = exports.getNodeBundler = exports.NativeUIBundler = exports.runLinter = exports.getEntryPoints = exports.getOutputDir = void 0;
3
+ exports.LocalWrapperProvider = exports.getWrapperProvider = exports.getNativeUiWorkerBuildConfig = exports.getNativeUiBuildConfig = exports.handleWebpackCompilationResult = exports.getCompiler = exports.mergeMetadata = exports.emptyMetadata = exports.BundlerError = exports.NODE_RUNTIME_CODE_FILE = exports.getNodeBundler = exports.NativeUIBundler = exports.runLinter = exports.getEntryPoints = exports.getOutputDir = void 0;
4
4
  var common_1 = require("./common");
5
5
  Object.defineProperty(exports, "getOutputDir", { enumerable: true, get: function () { return common_1.getOutputDir; } });
6
6
  Object.defineProperty(exports, "getEntryPoints", { enumerable: true, get: function () { return common_1.getEntryPoints; } });
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "getCompiler", { enumerable: true, get: function
20
20
  Object.defineProperty(exports, "handleWebpackCompilationResult", { enumerable: true, get: function () { return webpack_1.handleWebpackCompilationResult; } });
21
21
  var nativeui_2 = require("./config/nativeui");
22
22
  Object.defineProperty(exports, "getNativeUiBuildConfig", { enumerable: true, get: function () { return nativeui_2.getNativeUiBuildConfig; } });
23
+ Object.defineProperty(exports, "getNativeUiWorkerBuildConfig", { enumerable: true, get: function () { return nativeui_2.getNativeUiWorkerBuildConfig; } });
23
24
  var wrapper_provider_1 = require("./wrapper-provider");
24
25
  Object.defineProperty(exports, "getWrapperProvider", { enumerable: true, get: function () { return wrapper_provider_1.getWrapperProvider; } });
25
26
  Object.defineProperty(exports, "LocalWrapperProvider", { enumerable: true, get: function () { return wrapper_provider_1.LocalWrapperProvider; } });
package/out/nativeui.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { ResourceDetails } from '@forge/cli-shared';
2
2
  import { Translations } from '@forge/manifest';
3
3
  import { BundlerArgs, BundlerMetadata } from './types';
4
- import { ConfigWithOutput, WebpackBundler } from './webpack';
4
+ import { WebpackBundler, Configs } from './webpack';
5
5
  export interface NativeUIBundleResult {
6
6
  nativeUiBundlesDetails: ResourceDetails[];
7
7
  metadata: BundlerMetadata;
8
8
  }
9
9
  export declare class NativeUIBundler extends WebpackBundler {
10
- getConfig({ entryPoints, i18nConfig }: BundlerArgs): Promise<ConfigWithOutput>;
10
+ getConfigs({ entryPoints, i18nConfig }: BundlerArgs): Promise<Configs>;
11
11
  bundleResources(resources: ResourceDetails[], i18nConfig?: Translations): Promise<NativeUIBundleResult>;
12
12
  }
13
13
  //# sourceMappingURL=nativeui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nativeui.d.ts","sourceRoot":"","sources":["../src/nativeui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAgB,eAAe,EAA+C,MAAM,SAAS,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,sBAAsB,EAAE,eAAe,EAAE,CAAC;IAC1C,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,qBAAa,eAAgB,SAAQ,cAAc;IAC3C,SAAS,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIvE,eAAe,CAAC,SAAS,EAAE,eAAe,EAAE,EAAE,UAAU,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAyCrH"}
1
+ {"version":3,"file":"nativeui.d.ts","sourceRoot":"","sources":["../src/nativeui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAgB,eAAe,EAA+C,MAAM,SAAS,CAAC;AAClH,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,WAAW,oBAAoB;IACnC,sBAAsB,EAAE,eAAe,EAAE,CAAC;IAC1C,QAAQ,EAAE,eAAe,CAAC;CAC3B;AAED,qBAAa,eAAgB,SAAQ,cAAc;IAC3C,UAAU,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ/D,eAAe,CAAC,SAAS,EAAE,eAAe,EAAE,EAAE,UAAU,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAyCrH"}
package/out/nativeui.js CHANGED
@@ -5,8 +5,12 @@ const nativeui_1 = require("./config/nativeui");
5
5
  const types_1 = require("./types");
6
6
  const webpack_1 = require("./webpack");
7
7
  class NativeUIBundler extends webpack_1.WebpackBundler {
8
- async getConfig({ entryPoints, i18nConfig }) {
9
- return (0, nativeui_1.getNativeUiBuildConfig)(entryPoints, i18nConfig);
8
+ async getConfigs({ entryPoints, i18nConfig }) {
9
+ const iframeConfig = (0, nativeui_1.getNativeUiBuildConfig)(entryPoints, i18nConfig);
10
+ if (process.env.EXP_FORGE_UI_WORKER_RUNTIME === 'true') {
11
+ return [iframeConfig, (0, nativeui_1.getNativeUiWorkerBuildConfig)(entryPoints, i18nConfig, iframeConfig.output.path)];
12
+ }
13
+ return [iframeConfig];
10
14
  }
11
15
  async bundleResources(resources, i18nConfig) {
12
16
  const nativeUiBundlesDetails = [];
package/out/runtime.js CHANGED
@@ -50,7 +50,7 @@ class NodeBundler extends webpack_2.WebpackBundler {
50
50
  super(logger);
51
51
  this.wrapperProvider = wrapperProvider;
52
52
  }
53
- async getConfig(args) {
53
+ async getConfigs(args) {
54
54
  const webpackConfig = (0, common_1.getCommonWebpackConfig)(args);
55
55
  webpackConfig.target = 'node18';
56
56
  webpackConfig.output.filename = '[name].cjs';
@@ -72,7 +72,7 @@ class NodeBundler extends webpack_2.WebpackBundler {
72
72
  });
73
73
  }
74
74
  });
75
- return webpackConfig;
75
+ return [webpackConfig];
76
76
  }
77
77
  }
78
78
  class TypeScriptNodeBundler extends typescript_1.TypeScriptBundler {
package/out/webpack.d.ts CHANGED
@@ -7,6 +7,7 @@ export declare function getCompiler(config: webpack.Configuration): webpack.Comp
7
7
  export declare type ConfigWithOutput = webpack.Configuration & {
8
8
  output: CommonOutputOptions;
9
9
  };
10
+ export declare type Configs = [ConfigWithOutput, ...ConfigWithOutput[]];
10
11
  export declare abstract class WebpackBundler implements Bundler {
11
12
  protected readonly logger: Logger;
12
13
  constructor(logger: Logger);
@@ -14,7 +15,7 @@ export declare abstract class WebpackBundler implements Bundler {
14
15
  protected isRegularModule(name: string): boolean;
15
16
  protected localModules(stats: webpack.Stats): Set<string>;
16
17
  protected runCompiler(args: BundlerArgs, config: ConfigWithOutput): Promise<BundlerOutput>;
17
- abstract getConfig(args: BundlerArgs): Promise<ConfigWithOutput>;
18
+ abstract getConfigs(args: BundlerArgs): Promise<Configs>;
18
19
  bundle(args: BundlerArgs): Promise<BundlerOutput>;
19
20
  watch(args: BundlerWatchArgs, watch: BundlerWatch): Promise<BundlerWatchOutput>;
20
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAA4B,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGt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AAY,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;cAwBzC,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAsBhG,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAElD,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAWjD,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA2CtF"}
package/out/webpack.js CHANGED
@@ -7,6 +7,7 @@ const webpack_1 = tslib_1.__importDefault(require("webpack"));
7
7
  const cli_shared_1 = require("@forge/cli-shared");
8
8
  const metadata_1 = require("./metadata");
9
9
  const text_1 = require("./text");
10
+ const types_1 = require("./types");
10
11
  function handleWebpackCompilationResult(logger, err, stats) {
11
12
  if (err) {
12
13
  throw err;
@@ -120,12 +121,16 @@ class WebpackBundler {
120
121
  });
121
122
  }
122
123
  async bundle(args) {
123
- const config = await this.getConfig(args);
124
- return await this.runCompiler(args, config);
124
+ const configs = await this.getConfigs(args);
125
+ const outputs = await Promise.all(configs.map((cfg) => this.runCompiler(args, cfg)));
126
+ const [primary, ...rest] = outputs;
127
+ const metadata = rest.reduce((acc, output) => (output.metadata ? (0, types_1.mergeMetadata)(acc, output.metadata) : acc), primary.metadata ?? (0, types_1.emptyMetadata)());
128
+ return { outputDir: primary.outputDir, metadata };
125
129
  }
126
130
  async watch(args, watch) {
127
- const config = await this.getConfig(args);
128
- const compiler = getCompiler(config);
131
+ const configs = await this.getConfigs(args);
132
+ const targetConfig = configs[configs.length - 1];
133
+ const compiler = getCompiler(targetConfig);
129
134
  let isFirstRun = true;
130
135
  compiler.hooks.watchRun.tapAsync('watchRun', async (_, watchRunCallback) => {
131
136
  if (!isFirstRun) {
@@ -138,7 +143,7 @@ class WebpackBundler {
138
143
  try {
139
144
  handleWebpackCompilationResult(this.logger, compilerError, stats);
140
145
  this.logger.info(cli_shared_1.LogColor.trace(args.successMessage));
141
- const result = await this.getOutput(args, config, stats);
146
+ const result = await this.getOutput(args, targetConfig, stats);
142
147
  if (isFirstRun) {
143
148
  isFirstRun = false;
144
149
  resolve({ result, stop: () => watching.close(() => void 0) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bundler",
3
- "version": "6.1.23-next.5",
3
+ "version": "6.1.23-next.6",
4
4
  "description": "Default bundler for Forge apps",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Atlassian",
@@ -21,10 +21,10 @@
21
21
  "@babel/plugin-transform-react-jsx": "^7.23.4",
22
22
  "@babel/traverse": "^7.24.0",
23
23
  "@babel/types": "^7.24.0",
24
- "@forge/cli-shared": "8.19.0-next.5",
24
+ "@forge/cli-shared": "8.19.0-next.6",
25
25
  "@forge/i18n": "0.0.7",
26
- "@forge/lint": "5.16.3-next.5",
27
- "@forge/manifest": "12.5.0-next.3",
26
+ "@forge/lint": "5.16.3-next.6",
27
+ "@forge/manifest": "12.5.0-next.4",
28
28
  "babel-loader": "^8.3.0",
29
29
  "cheerio": "^1.1.0",
30
30
  "cross-spawn": "^7.0.6",