@forge/bundler 4.19.0-next.13 → 4.19.0-next.15

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,34 @@
1
1
  # @forge/bundler
2
2
 
3
+ ## 4.19.0-next.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d51b7be]
8
+ - @forge/i18n@0.0.1-next.13
9
+ - @forge/cli-shared@5.5.0-next.14
10
+ - @forge/manifest@7.7.0-next.14
11
+ - @forge/lint@5.3.3-next.14
12
+
13
+ ## 4.19.0-next.14
14
+
15
+ ### Minor Changes
16
+
17
+ - ac1a61b: Bundle files on disk instead of memory
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [ac1a61b]
22
+ - Updated dependencies [23f6675]
23
+ - Updated dependencies [27249cd]
24
+ - Updated dependencies [0f75e93]
25
+ - Updated dependencies [5f82d22]
26
+ - @forge/cli-shared@5.5.0-next.13
27
+ - @forge/i18n@0.0.1-next.12
28
+ - @forge/manifest@7.7.0-next.13
29
+ - @forge/api@3.9.2-next.2
30
+ - @forge/lint@5.3.3-next.13
31
+
3
32
  ## 4.19.0-next.13
4
33
 
5
34
  ### Patch Changes
@@ -6,22 +6,21 @@ export interface ConfigBuilder {
6
6
  isWatchMode: boolean;
7
7
  isDebugMode?: boolean;
8
8
  appDirectory: string;
9
+ outputDir: string;
9
10
  }
10
11
  export declare type EntryPoint = {
11
12
  name: string;
12
13
  path: string;
13
14
  };
14
- export declare type FunctionsEntryPoint = EntryPoint & {
15
- functions: string[];
16
- };
17
- export declare function getEntryPoints(handlers: Handler[]): FunctionsEntryPoint[];
15
+ export declare function getEntryPoints(handlers: Handler[]): EntryPoint[];
18
16
  export declare const resolveModulePath: (moduleName: string) => string;
19
17
  export declare function resolveStubPath(stubName: string): string;
20
18
  export declare const getDevToolConfig: (config: ConfigBuilder) => string;
21
- declare type RequiredFields<T, F extends keyof T> = T & Required<Pick<T, F>>;
19
+ export declare type RequiredFields<T, F extends keyof T> = T & Required<Pick<T, F>>;
20
+ export declare type CommonOutputOptions = RequiredFields<Required<WebpackConfig>['output'], 'path'>;
22
21
  declare type CommonModuleOptions = RequiredFields<ModuleOptions, 'rules'>;
23
22
  export declare type WebpackEntries = Record<string, string>;
24
- export declare type CommonWebpackConfig = RequiredFields<WebpackConfig, 'module' | 'plugins' | 'output'> & Record<'module', CommonModuleOptions> & Record<'entry', WebpackEntries>;
23
+ export declare type CommonWebpackConfig = RequiredFields<WebpackConfig, 'module' | 'plugins'> & Record<'output', CommonOutputOptions> & Record<'module', CommonModuleOptions> & Record<'entry', WebpackEntries>;
25
24
  export declare const geti18nRule: (i18nConfig: Translations) => {
26
25
  test: RegExp;
27
26
  include: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/config/common.ts"],"names":[],"mappings":";AACA,OAAgB,EAAE,aAAa,IAAI,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,mBAAmB,GAAG,UAAU,GAAG;IAC7C,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,mBAAmB,EAAE,CAiBzE;AAED,eAAO,MAAM,iBAAiB,eAAgB,MAAM,KAAG,MAEtD,CAAC;AAEF,wBAAgB,eAAe,CAAC,QAAQ,EA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AM,CAAC;CACd,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,CAOhE;AAED,eAAO,MAAM,iBAAiB,eAAgB,MAAM,KAAG,MAEtD,CAAC;AAEF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,eAAO,MAAM,gBAAgB,WAAY,aAAa,KAAG,MASxD,CAAC;AAEF,oBAAY,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5E,oBAAY,mBAAmB,GAAG,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5F,aAAK,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAClE,oBAAY,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACpD,oBAAY,mBAAmB,GAAG,cAAc,CAAC,aAAa,EAAE,QAAQ,GAAG,SAAS,CAAC,GACnF,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GACrC,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GACrC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAElC,eAAO,MAAM,WAAW,eAAgB,YAAY;;;;;+DAIe;YAAE,QAAQ;gBAAE,QAAQ,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE;;CAalG,CAAC;AAEF,eAAO,MAAM,sBAAsB,gBAAiB,UAAU,EAAE,UAAU,aAAa,KAAG,mBAwGzF,CAAC"}
@@ -2,25 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCommonWebpackConfig = exports.geti18nRule = exports.getDevToolConfig = exports.resolveStubPath = exports.resolveModulePath = exports.getEntryPoints = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const path_1 = require("path");
5
+ const path_1 = tslib_1.__importDefault(require("path"));
6
6
  const webpack_1 = tslib_1.__importDefault(require("webpack"));
7
- const text_1 = require("../text");
8
7
  const cli_shared_1 = require("@forge/cli-shared");
9
8
  const i18n_1 = require("@forge/i18n");
9
+ const text_1 = require("../text");
10
10
  const tsconfig_interactor_1 = require("../tsconfig-interactor");
11
11
  function getEntryPoints(handlers) {
12
- const entryPointMap = new Map();
13
- for (const { module, func } of handlers) {
14
- if (!entryPointMap.has(module)) {
15
- entryPointMap.set(module, []);
16
- }
17
- entryPointMap.get(module).push(func);
18
- }
19
- const currentDirectory = process.cwd();
20
- return Array.from(entryPointMap.entries()).map(([module, functions]) => ({
12
+ const modules = new Set(handlers.map(({ module }) => module));
13
+ return Array.from(modules).map((module) => ({
21
14
  name: module,
22
- path: (0, path_1.join)(currentDirectory, 'src', module),
23
- functions
15
+ path: path_1.default.resolve('src', module)
24
16
  }));
25
17
  }
26
18
  exports.getEntryPoints = getEntryPoints;
@@ -41,10 +33,10 @@ const getDevToolConfig = (config) => {
41
33
  exports.getDevToolConfig = getDevToolConfig;
42
34
  const geti18nRule = (i18nConfig) => {
43
35
  const i18nResources = i18nConfig.resources || [];
44
- const i18nResourcesMap = new Map(i18nResources.map(({ key, path }) => [(0, path_1.resolve)(path), key]));
36
+ const i18nResourcesMap = new Map(i18nResources.map(({ key, path: resource }) => [path_1.default.resolve(resource), key]));
45
37
  const getFilename = ({ module: { resource: i18nResourcePath } }) => {
46
38
  const i18nResourceKey = i18nResourcesMap.get(i18nResourcePath);
47
- return (0, path_1.join)(i18n_1.I18N_BUNDLE_FOLDER_NAME, `${i18nResourceKey}.json`);
39
+ return path_1.default.join(i18n_1.I18N_BUNDLE_FOLDER_NAME, `${i18nResourceKey}.json`);
48
40
  };
49
41
  return {
50
42
  test: /\.json$/i,
@@ -62,7 +54,7 @@ const getCommonWebpackConfig = (entrypoints, config) => {
62
54
  }
63
55
  const resolvedEntryPoints = {};
64
56
  for (const entrypoint of entrypoints) {
65
- resolvedEntryPoints[entrypoint.name] = (0, path_1.resolve)(entrypoint.path);
57
+ resolvedEntryPoints[entrypoint.name] = path_1.default.resolve(entrypoint.path);
66
58
  }
67
59
  return {
68
60
  entry: resolvedEntryPoints,
@@ -75,7 +67,7 @@ const getCommonWebpackConfig = (entrypoints, config) => {
75
67
  libraryTarget: 'commonjs',
76
68
  globalObject: 'this',
77
69
  filename: '[name].js',
78
- path: '/'
70
+ path: config.outputDir
79
71
  },
80
72
  node: {
81
73
  __dirname: true
@@ -1,5 +1,7 @@
1
1
  import { Configuration as WebpackConfig } from 'webpack';
2
2
  import { Translations } from '@forge/manifest';
3
- import { EntryPoint } from './common';
4
- export declare const getNativeUiBuildConfig: (entrypoints: EntryPoint[], i18nConfig?: Translations) => WebpackConfig;
3
+ import { CommonOutputOptions, EntryPoint } from './common';
4
+ declare type NativeUIConfig = WebpackConfig & Record<'output', CommonOutputOptions>;
5
+ export declare const getNativeUiBuildConfig: (entrypoints: EntryPoint[], i18nConfig?: Translations) => NativeUIConfig;
6
+ export {};
5
7
  //# sourceMappingURL=nativeui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nativeui.d.ts","sourceRoot":"","sources":["../../src/config/nativeui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAKzD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAe,MAAM,UAAU,CAAC;AAEnD,eAAO,MAAM,sBAAsB,gBAAiB,UAAU,EAAE,eAAe,YAAY,KAAG,aAyE7F,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,mBAAmB,EAAE,UAAU,EAAe,MAAM,UAAU,CAAC;AAExE,aAAK,cAAc,GAAG,aAAa,GAAG,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAE5E,eAAO,MAAM,sBAAsB,gBAAiB,UAAU,EAAE,eAAe,YAAY,KAAG,cAyE7F,CAAC"}
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNativeUiBuildConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const path_1 = require("path");
6
- const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
5
+ const path_1 = tslib_1.__importDefault(require("path"));
7
6
  const html_webpack_plugin_1 = tslib_1.__importDefault(require("html-webpack-plugin"));
8
- const tmp_1 = tslib_1.__importDefault(require("tmp"));
7
+ const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
8
+ const cli_shared_1 = require("@forge/cli-shared");
9
9
  const common_1 = require("./common");
10
10
  const getNativeUiBuildConfig = (entrypoints, i18nConfig) => {
11
11
  const resolvedEntryPoints = {};
12
12
  for (const entrypoint of entrypoints) {
13
- resolvedEntryPoints[entrypoint.name] = (0, path_1.resolve)(entrypoint.path);
13
+ resolvedEntryPoints[entrypoint.name] = path_1.default.resolve(entrypoint.path);
14
14
  }
15
15
  return {
16
16
  entry: {
@@ -21,7 +21,7 @@ const getNativeUiBuildConfig = (entrypoints, i18nConfig) => {
21
21
  devtool: 'source-map',
22
22
  output: {
23
23
  filename: '[name].js',
24
- path: tmp_1.default.dirSync().name,
24
+ path: (0, cli_shared_1.tmpDir)('native-ui'),
25
25
  publicPath: 'auto'
26
26
  },
27
27
  node: {
@@ -1,5 +1,5 @@
1
1
  import { BaseError, FileSystemReader, UserError } from '@forge/cli-shared';
2
- import { CommonWebpackConfig, ConfigBuilder, FunctionsEntryPoint } from './common';
2
+ import { CommonWebpackConfig, ConfigBuilder, EntryPoint } from './common';
3
3
  export declare const NODE_WEBPACK_CONFIG_NAME = "node-runtime";
4
4
  export declare const NODE_WEBPACK_USER_CODE_DIR = "bundled";
5
5
  export declare const NODE_RUNTIME_VERSION_FILE = "runtime.json";
@@ -35,5 +35,5 @@ export declare class NetworkWrapperProvider implements WrapperProvider {
35
35
  export declare const getWrapperProvider: ({ fileSystemReader }: {
36
36
  fileSystemReader: FileSystemReader;
37
37
  }) => LocalWrapperProvider | NetworkWrapperProvider;
38
- export declare const getNodeRuntimeBuildConfig: (wrapperProvider: WrapperProvider) => (entrypoints: FunctionsEntryPoint[], config: ConfigBuilder) => CommonWebpackConfig;
38
+ export declare const getNodeRuntimeBuildConfig: (wrapperProvider: WrapperProvider) => (entrypoints: EntryPoint[], config: ConfigBuilder) => CommonWebpackConfig;
39
39
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/config/node.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAA6C,MAAM,mBAAmB,CAAC;AAEtH,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AACvD,eAAO,MAAM,0BAA0B,YAAY,CAAC;AACpD,eAAO,MAAM,yBAAyB,iBAAiB,CAAC;AAWxD,qBAAa,yBAA0B,SAAQ,SAAS;;CAIvD;AAED,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CAGhD;AAED,qBAAa,yBAA0B,SAAQ,SAAS;gBAC1C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS;CAG3D;AAED,oBAAY,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,W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AC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CACjD;AAED,qBAAa,oBAAqB,YAAW,eAAe;IAExD,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,MAAM;IAEzB,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC;CAUtD;AAED,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,OAAO,CAAC,OAAO,CAA4B;IAC3C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;;YAKX,uBAAuB;IAS/B,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC;CAuCtD;AAED,eAAO,MAAM,kBAAkB;sBAA8C,gBAAgB;mDAQ5F,CAAC;AAEF,eAAO,MAAM,yBAAyB,oBAClB,eAAe,mBACnB,UAAU,EAAE,UAAU,aAAa,KAAG,mBA4DnD,CAAC"}
package/out/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { Bundler, InDiskBundler, Watcher, WatcherMonitor, BundlerOutput } from './types';
2
- export { getSandboxBundler, getNodeBundler, nativeUiBundle, watch, getCompiler, getInMemoryBundle, handleWebpackCompilationResult, runLinter } from './webpack';
3
- export { EntryPoint, FunctionsEntryPoint, getEntryPoints } from './config/common';
1
+ export { Bundler, WatcherMonitor, BundlerOutput } from './types';
2
+ export { getSandboxBundler, getNodeBundler, nativeUiBundle, getCompiler, handleWebpackCompilationResult, runLinter } from './webpack';
3
+ export { EntryPoint, getEntryPoints } from './config/common';
4
4
  export { getNativeUiBuildConfig } from './config/nativeui';
5
5
  export { getNodeRuntimeBuildConfig, getWrapperProvider, LocalWrapperProvider } from './config/node';
6
6
  export { getSandboxedRuntimeBuildConfig } from './config/sandbox';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,KAAK,EACL,WAAW,EACX,iBAAiB,EACjB,8BAA8B,EAC9B,SAAS,EACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,WAAW,EACX,8BAA8B,EAC9B,SAAS,EACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC"}
package/out/index.js CHANGED
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSandboxedRuntimeBuildConfig = exports.LocalWrapperProvider = exports.getWrapperProvider = exports.getNodeRuntimeBuildConfig = exports.getNativeUiBuildConfig = exports.getEntryPoints = exports.runLinter = exports.handleWebpackCompilationResult = exports.getInMemoryBundle = exports.getCompiler = exports.watch = exports.nativeUiBundle = exports.getNodeBundler = exports.getSandboxBundler = void 0;
3
+ exports.getSandboxedRuntimeBuildConfig = exports.LocalWrapperProvider = exports.getWrapperProvider = exports.getNodeRuntimeBuildConfig = exports.getNativeUiBuildConfig = exports.getEntryPoints = exports.runLinter = exports.handleWebpackCompilationResult = exports.getCompiler = exports.nativeUiBundle = exports.getNodeBundler = exports.getSandboxBundler = void 0;
4
4
  var webpack_1 = require("./webpack");
5
5
  Object.defineProperty(exports, "getSandboxBundler", { enumerable: true, get: function () { return webpack_1.getSandboxBundler; } });
6
6
  Object.defineProperty(exports, "getNodeBundler", { enumerable: true, get: function () { return webpack_1.getNodeBundler; } });
7
7
  Object.defineProperty(exports, "nativeUiBundle", { enumerable: true, get: function () { return webpack_1.nativeUiBundle; } });
8
- Object.defineProperty(exports, "watch", { enumerable: true, get: function () { return webpack_1.watch; } });
9
8
  Object.defineProperty(exports, "getCompiler", { enumerable: true, get: function () { return webpack_1.getCompiler; } });
10
- Object.defineProperty(exports, "getInMemoryBundle", { enumerable: true, get: function () { return webpack_1.getInMemoryBundle; } });
11
9
  Object.defineProperty(exports, "handleWebpackCompilationResult", { enumerable: true, get: function () { return webpack_1.handleWebpackCompilationResult; } });
12
10
  Object.defineProperty(exports, "runLinter", { enumerable: true, get: function () { return webpack_1.runLinter; } });
13
11
  var common_1 = require("./config/common");
package/out/types.d.ts CHANGED
@@ -1,26 +1,17 @@
1
1
  import { Logger } from '@forge/cli-shared';
2
2
  import { Translations } from '@forge/manifest';
3
- import { Compiler } from 'webpack';
4
- import { EntryPoint } from './webpack';
5
- export declare type BundledFiles = {
6
- [filename: string]: string;
3
+ import { EntryPoint } from './config/common';
4
+ export declare type BundlerMetadata = {
5
+ modules?: string[];
6
+ nodeRuntimeVersion?: string;
7
7
  };
8
8
  export interface BundlerOutput {
9
- output: BundledFiles;
10
- sourceMap?: BundledFiles;
11
- metadata?: {
12
- [key: string]: any;
13
- };
9
+ outputDir: string;
10
+ metadata?: BundlerMetadata;
14
11
  }
15
12
  export declare type BundleLogger = Pick<Logger, 'info' | 'warn'>;
16
- export declare type Bundler<EP = EntryPoint> = (logger: BundleLogger, appDirectory: string, endpointPath: EP[], i18nConfig?: Translations) => Promise<BundlerOutput>;
17
- export declare type InDiskBundler = (logger: BundleLogger, entrypoints: EntryPoint[], i18nConfig?: Translations) => Promise<{
18
- outputDir: string;
19
- }>;
20
- export declare type WatcherCallback = (err: Error | null, output?: BundlerOutput) => void;
13
+ export declare type Bundler = (logger: BundleLogger, appDirectory: string, endpointPath: EntryPoint[], i18nConfig?: Translations) => Promise<BundlerOutput>;
21
14
  export interface WatcherMonitor {
22
15
  stop(): void;
23
16
  }
24
- export declare type WatchRun = (compiler: Compiler, ...args: any[]) => void;
25
- export declare type Watcher = (logger: Logger, endpointPath: EntryPoint[], isDebugMode: boolean, callback: WatcherCallback, watchRun?: WatchRun) => WatcherMonitor;
26
17
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAIvC,oBAAY,YAAY,GAAG;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE1D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,QAAQ,CAAC,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED,o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CAC7B,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,oBAAY,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAEzD,oBAAY,OAAO,GAAG,CACpB,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,UAAU,EAAE,EAC1B,UAAU,CAAC,EAAE,YAAY,KACtB,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,MAAM,WAAW,cAAc;IAC7B,IAAI,IAAI,IAAI,CAAC;CACd"}
package/out/webpack.d.ts CHANGED
@@ -1,21 +1,15 @@
1
- import { IFs } from 'memfs';
2
- import webpack, { Compiler, Configuration as WebpackConfig } from 'webpack';
3
- import { Bundler, Watcher, InDiskBundler, BundlerOutput, BundleLogger } from './types';
1
+ import webpack from 'webpack';
4
2
  import { FileSystemReader, FileSystemWriter } from '@forge/cli-shared';
5
3
  import { LintLogger } from '@forge/lint';
6
- import { CommonWebpackConfig, ConfigBuilder, EntryPoint, FunctionsEntryPoint } from './config/common';
4
+ import { CommonWebpackConfig, ConfigBuilder, EntryPoint } from './config/common';
7
5
  import { WrapperProvider } from './config/node';
8
- export { EntryPoint };
6
+ import { Bundler, BundleLogger, BundlerMetadata } from './types';
9
7
  export declare function handleWebpackCompilationResult(logger: BundleLogger, err: Error | null | undefined, stats: webpack.Stats | undefined): asserts stats is webpack.Stats;
10
- export declare function getInMemoryBundle(config: CommonWebpackConfig, fileSystem?: IFs): BundlerOutput;
11
- interface CompilerOptions {
12
- writeToDisk?: boolean;
13
- }
14
- export declare const getCompiler: (webpackConfig: WebpackConfig, options?: CompilerOptions) => Compiler;
8
+ export declare function getCompiler(config: webpack.Configuration): webpack.Compiler;
9
+ export declare function getMetadata(config: CommonWebpackConfig, stats?: webpack.Stats): BundlerMetadata;
15
10
  export declare const runLinter: (logger?: LintLogger, fileSystemReader?: FileSystemReader, fileSystemWriter?: FileSystemWriter) => Promise<void>;
16
- export declare const watch: Watcher;
17
- export declare function createBundler<EP extends EntryPoint = EntryPoint>(getBuildConfig: (entrypoints: EP[], configBuilder: ConfigBuilder) => CommonWebpackConfig): Bundler<EP>;
11
+ export declare function createBundler(getBuildConfig: (entrypoints: EntryPoint[], configBuilder: ConfigBuilder) => CommonWebpackConfig): Bundler;
18
12
  export declare const getSandboxBundler: () => Bundler;
19
- export declare const getNodeBundler: (wrapperProvider: WrapperProvider) => Bundler<FunctionsEntryPoint>;
20
- export declare const nativeUiBundle: InDiskBundler;
13
+ export declare const getNodeBundler: (wrapperProvider: WrapperProvider) => Bundler;
14
+ export declare const nativeUiBundle: Bundler;
21
15
  //# sourceMappingURL=webpack.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,GAAG,EAAU,MAAM,OAAO,CAAC;AACxD,OAAO,OAAO,EAAE,EAAE,QAAQ,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAG5E,OAAO,EAAE,OAAO,EAAgB,OAAO,EAAkB,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrH,OAAO,EAEL,gBAAgB,EAGhB,gBAAgB,EAGjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAA2B,UAAU,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtG,OAAO,EAKL,eAAe,EAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,UAAU,EAAE,CAAC;AAQtB,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC7B,KAAK,EA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CAAC;AAEjE,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC7B,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,SAAS,GAC/B,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAkChC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,QAAQ,CAE3E;AAqBD,wBAAgB,WAAW,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,GAAG,eAAe,CAY/F;AAED,eAAO,MAAM,SAAS,YAEZ,UAAU,+EAGjB,QAAQ,IAAI,CA+Bd,CAAC;AAEF,wBAAgB,aAAa,CAC3B,cAAc,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,aAAa,EAAE,aAAa,KAAK,mBAAmB,GAC/F,OAAO,CAyBT;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,OAA6D,CAAC;AACpG,eAAO,MAAM,cAAc,EAAE,CAAC,eAAe,EAAE,eAAe,KAAK,OACR,CAAC;AAE5D,eAAO,MAAM,cAAc,EAAE,OAqB5B,CAAC"}
package/out/webpack.js CHANGED
@@ -1,20 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nativeUiBundle = exports.getNodeBundler = exports.getSandboxBundler = exports.createBundler = exports.watch = exports.runLinter = exports.getCompiler = exports.getInMemoryBundle = exports.handleWebpackCompilationResult = void 0;
3
+ exports.nativeUiBundle = exports.getNodeBundler = exports.getSandboxBundler = exports.createBundler = exports.runLinter = exports.getMetadata = exports.getCompiler = exports.handleWebpackCompilationResult = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const memfs_1 = require("memfs");
6
- const webpack_1 = tslib_1.__importDefault(require("webpack"));
5
+ const fs_1 = require("fs");
7
6
  const path_1 = tslib_1.__importDefault(require("path"));
8
- const text_1 = require("./text");
7
+ const webpack_1 = tslib_1.__importDefault(require("webpack"));
9
8
  const cli_shared_1 = require("@forge/cli-shared");
10
9
  const lint_1 = require("@forge/lint");
11
- const sandbox_1 = require("./config/sandbox");
12
- const node_1 = require("./config/node");
13
10
  const nativeui_1 = require("./config/nativeui");
14
- const compilerOutputFileSystem = (0, memfs_1.createFsFromVolume)(new memfs_1.Volume());
15
- const readMemoryFileSync = (outputFileSystem, filePath) => {
16
- return outputFileSystem.readFileSync('/' + filePath, { encoding: 'utf8' }).toString();
17
- };
11
+ const node_1 = require("./config/node");
12
+ const sandbox_1 = require("./config/sandbox");
13
+ const text_1 = require("./text");
18
14
  function handleWebpackCompilationResult(logger, err, stats) {
19
15
  if (err) {
20
16
  throw err;
@@ -42,45 +38,11 @@ function handleWebpackCompilationResult(logger, err, stats) {
42
38
  }
43
39
  }
44
40
  exports.handleWebpackCompilationResult = handleWebpackCompilationResult;
45
- function tryReadSourceMapSync(fileSystem, sourceMap, fileName) {
46
- const mapFileName = `${fileName}.map`;
47
- try {
48
- sourceMap[mapFileName] = readMemoryFileSync(fileSystem, mapFileName);
49
- }
50
- catch (e) {
51
- }
41
+ function getCompiler(config) {
42
+ return (0, webpack_1.default)(config);
52
43
  }
53
- function getInMemoryBundle(config, fileSystem) {
54
- const output = {}, sourceMap = {};
55
- const outputFileSystem = fileSystem || compilerOutputFileSystem;
56
- const fileNamePattern = config.output?.filename ?? '[name].js';
57
- for (const name in config.entry) {
58
- const fileName = fileNamePattern.replace('[name]', name);
59
- output[fileName] = readMemoryFileSync(outputFileSystem, fileName);
60
- if (config.name === node_1.NODE_WEBPACK_CONFIG_NAME && name.startsWith(node_1.NODE_WEBPACK_USER_CODE_DIR + '/')) {
61
- const wrapperName = name.slice(node_1.NODE_WEBPACK_USER_CODE_DIR.length + 1);
62
- const wrapperFileName = `${wrapperName}.cjs`;
63
- output[wrapperFileName] = readMemoryFileSync(outputFileSystem, wrapperFileName);
64
- tryReadSourceMapSync(outputFileSystem, sourceMap, wrapperFileName);
65
- }
66
- tryReadSourceMapSync(outputFileSystem, sourceMap, fileName);
67
- }
68
- const metadata = {};
69
- if (config.name === node_1.NODE_WEBPACK_CONFIG_NAME) {
70
- metadata.nodeRuntimeVersion = readMemoryFileSync(outputFileSystem, node_1.NODE_RUNTIME_VERSION_FILE);
71
- }
72
- return { output, sourceMap, metadata };
73
- }
74
- exports.getInMemoryBundle = getInMemoryBundle;
75
- const getCompiler = (webpackConfig, options) => {
76
- const compiler = (0, webpack_1.default)(webpackConfig);
77
- if (!options?.writeToDisk) {
78
- compiler.outputFileSystem = compilerOutputFileSystem;
79
- }
80
- return compiler;
81
- };
82
44
  exports.getCompiler = getCompiler;
83
- const getNodeModuleNames = (stats) => {
45
+ function getNodeModuleNames(stats) {
84
46
  const { modules } = stats.toJson({ modules: true });
85
47
  if (modules) {
86
48
  const filteredModuleNames = new Set();
@@ -98,16 +60,18 @@ const getNodeModuleNames = (stats) => {
98
60
  });
99
61
  return Array.from(filteredModuleNames);
100
62
  }
101
- };
102
- class Monitor {
103
- watcher;
104
- constructor(watcher) {
105
- this.watcher = watcher;
63
+ }
64
+ function getMetadata(config, stats) {
65
+ const metadata = {};
66
+ if (stats) {
67
+ metadata.modules = getNodeModuleNames(stats);
106
68
  }
107
- stop() {
108
- this.watcher.close(() => null);
69
+ if (config.name === node_1.NODE_WEBPACK_CONFIG_NAME && config.output?.path) {
70
+ metadata.nodeRuntimeVersion = (0, fs_1.readFileSync)(path_1.default.join(config.output.path, node_1.NODE_RUNTIME_VERSION_FILE)).toString();
109
71
  }
72
+ return metadata;
110
73
  }
74
+ exports.getMetadata = getMetadata;
111
75
  const runLinter = async (logger = { info: console.log }, fileSystemReader = new cli_shared_1.FileSystemReader(), fileSystemWriter = new cli_shared_1.FileSystemWriter()) => {
112
76
  logger.info(`\n${cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.lint.running)}`);
113
77
  const exclude = [...(await (0, cli_shared_1.listGitIgnoreFiles)(fileSystemReader)), '.git', 'node_modules'];
@@ -135,52 +99,24 @@ const runLinter = async (logger = { info: console.log }, fileSystemReader = new
135
99
  }
136
100
  };
137
101
  exports.runLinter = runLinter;
138
- const watch = (logger, entryPoints, debugMode, callback, watchRun) => {
139
- const config = (0, sandbox_1.getSandboxedRuntimeBuildConfig)(entryPoints, {
140
- isWatchMode: true,
141
- isDebugMode: debugMode,
142
- appDirectory: process.cwd()
143
- });
144
- const compiler = (0, exports.getCompiler)(config);
145
- if (typeof watchRun === 'function') {
146
- compiler.hooks.watchRun.tapAsync('watchRun', (watchRunCompiler, watchRunCallback) => {
147
- watchRun(watchRunCompiler, exports.runLinter, watchRunCallback);
148
- });
149
- }
150
- const watcher = compiler.watch({ poll: 1000 }, (compilerError, stats) => {
151
- try {
152
- handleWebpackCompilationResult(logger, compilerError, stats);
153
- callback(null, getInMemoryBundle(config));
154
- }
155
- catch (fileReadError) {
156
- callback(fileReadError);
157
- }
158
- });
159
- return new Monitor(watcher);
160
- };
161
- exports.watch = watch;
162
102
  function createBundler(getBuildConfig) {
163
103
  return (logger, appDirectory, endpoints) => {
164
- const config = getBuildConfig(endpoints, { isWatchMode: false, appDirectory });
165
- const compiler = (0, exports.getCompiler)(config);
104
+ const outputDir = (0, cli_shared_1.tmpDir)('dist');
105
+ const config = getBuildConfig(endpoints, { isWatchMode: false, appDirectory, outputDir });
106
+ const compiler = getCompiler(config);
166
107
  return new Promise((resolve, reject) => {
167
108
  compiler.run((compilerError, stats) => {
168
109
  try {
169
110
  handleWebpackCompilationResult(logger, compilerError, stats);
170
- const result = getInMemoryBundle(config);
171
111
  compiler.close((closeError) => {
172
112
  if (closeError) {
173
113
  reject(closeError);
174
114
  }
175
115
  });
176
- result.metadata = {
177
- modules: getNodeModuleNames(stats),
178
- ...result.metadata
179
- };
180
- resolve(result);
116
+ resolve({ outputDir, metadata: getMetadata(config, stats) });
181
117
  }
182
- catch (fileReadError) {
183
- reject(fileReadError);
118
+ catch (err) {
119
+ reject(err);
184
120
  }
185
121
  });
186
122
  });
@@ -191,16 +127,14 @@ const getSandboxBundler = () => createBundler(sandbox_1.getSandboxedRuntimeBuild
191
127
  exports.getSandboxBundler = getSandboxBundler;
192
128
  const getNodeBundler = (wrapperProvider) => createBundler((0, node_1.getNodeRuntimeBuildConfig)(wrapperProvider));
193
129
  exports.getNodeBundler = getNodeBundler;
194
- const nativeUiBundle = (logger, entrypoints, i18nConfig) => {
130
+ const nativeUiBundle = (logger, appDirectory, entrypoints, i18nConfig) => {
195
131
  const config = (0, nativeui_1.getNativeUiBuildConfig)(entrypoints, i18nConfig);
196
- const compiler = (0, exports.getCompiler)(config, { writeToDisk: true });
132
+ const compiler = getCompiler(config);
197
133
  return new Promise((resolve, reject) => {
198
134
  compiler.run((compilerError, stats) => {
199
135
  try {
200
136
  handleWebpackCompilationResult(logger, compilerError, stats);
201
- resolve({
202
- outputDir: config.output.path
203
- });
137
+ resolve({ outputDir: config.output.path });
204
138
  }
205
139
  catch (err) {
206
140
  reject(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bundler",
3
- "version": "4.19.0-next.13",
3
+ "version": "4.19.0-next.15",
4
4
  "description": "Default bundler for Forge apps",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Atlassian",
@@ -19,12 +19,12 @@
19
19
  "@babel/plugin-transform-optional-chaining": "^7.23.4",
20
20
  "@babel/plugin-transform-react-jsx": "^7.23.4",
21
21
  "@babel/preset-typescript": "^7.23.3",
22
- "@forge/api": "3.9.2-next.1",
22
+ "@forge/api": "3.9.2-next.2",
23
23
  "@forge/babel-plugin-transform-ui": "1.1.18",
24
- "@forge/cli-shared": "5.5.0-next.12",
25
- "@forge/i18n": "0.0.1-next.11",
26
- "@forge/lint": "5.3.3-next.12",
27
- "@forge/manifest": "7.7.0-next.12",
24
+ "@forge/cli-shared": "5.5.0-next.14",
25
+ "@forge/i18n": "0.0.1-next.13",
26
+ "@forge/lint": "5.3.3-next.14",
27
+ "@forge/manifest": "7.7.0-next.14",
28
28
  "@forge/util": "1.4.4",
29
29
  "assert": "^2.1.0",
30
30
  "babel-loader": "^8.3.0",