@forge/bundler 3.1.4-next.0 → 4.0.0-next.1

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,17 @@
1
1
  # @forge/bundler
2
2
 
3
+ ## 4.0.0-next.1
4
+
5
+ ### Major Changes
6
+
7
+ - 652e9f23: Bump Typescript and ESlint to latest
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [652e9f23]
12
+ - @forge/cli-shared@3.2.2-next.1
13
+ - @forge/lint@3.2.8-next.1
14
+
3
15
  ## 3.1.4-next.0
4
16
 
5
17
  ### Patch Changes
@@ -6,10 +6,10 @@ const path_1 = require("path");
6
6
  const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
7
7
  const html_webpack_plugin_1 = tslib_1.__importDefault(require("html-webpack-plugin"));
8
8
  const tmp_1 = tslib_1.__importDefault(require("tmp"));
9
- exports.getNativeUiBuildConfig = (entrypoints, config) => {
9
+ const getNativeUiBuildConfig = (entrypoints, config) => {
10
10
  const resolvedEntryPoints = {};
11
11
  for (const entrypoint of entrypoints) {
12
- resolvedEntryPoints[entrypoint.name] = path_1.resolve(entrypoint.path);
12
+ resolvedEntryPoints[entrypoint.name] = (0, path_1.resolve)(entrypoint.path);
13
13
  }
14
14
  return {
15
15
  entry: Object.assign({}, resolvedEntryPoints),
@@ -73,3 +73,4 @@ exports.getNativeUiBuildConfig = (entrypoints, config) => {
73
73
  }
74
74
  };
75
75
  };
76
+ exports.getNativeUiBuildConfig = getNativeUiBuildConfig;
@@ -6,10 +6,10 @@ const webpack_1 = tslib_1.__importDefault(require("webpack"));
6
6
  const path_1 = require("path");
7
7
  const webpack_2 = require("../webpack");
8
8
  function bundleStubPath(filePath) {
9
- return path_1.resolve(__dirname, '..', `${filePath}${path_1.extname(__filename)}`);
9
+ return (0, path_1.resolve)(__dirname, '..', `${filePath}${(0, path_1.extname)(__filename)}`);
10
10
  }
11
- exports.getNodeRuntimeBuildConfig = (entrypoints, config) => {
12
- const webpackConfig = webpack_2.getCommonWebpackConfig(entrypoints, config);
11
+ const getNodeRuntimeBuildConfig = (entrypoints, config) => {
12
+ const webpackConfig = (0, webpack_2.getCommonWebpackConfig)(entrypoints, config);
13
13
  const nodeConfigPlugin = new webpack_1.default.ProvidePlugin({
14
14
  api: bundleStubPath('forge-api'),
15
15
  'global.api': bundleStubPath('forge-api'),
@@ -20,3 +20,4 @@ exports.getNodeRuntimeBuildConfig = (entrypoints, config) => {
20
20
  webpackConfig.target = 'node14';
21
21
  return webpackConfig;
22
22
  };
23
+ exports.getNodeRuntimeBuildConfig = getNodeRuntimeBuildConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"sandboxed-webpack-config.d.ts","sourceRoot":"","sources":["../../src/bundler-config/sandboxed-webpack-config.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,WAAW,EAA6C,MAAM,YAAY,CAAC;AA0DnG,eAAO,MAAM,8BAA8B,qCAAsC,aAAa,KAAG,aAsEhG,CAAC"}
1
+ {"version":3,"file":"sandboxed-webpack-config.d.ts","sourceRoot":"","sources":["../../src/bundler-config/sandboxed-webpack-config.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,WAAW,EAA6C,MAAM,YAAY,CAAC;AAyDnG,eAAO,MAAM,8BAA8B,qCAAsC,aAAa,KAAG,aAsEhG,CAAC"}
@@ -8,52 +8,52 @@ const stub_plugin_1 = require("../stub-plugin");
8
8
  const webpack_2 = require("../webpack");
9
9
  const getCustomModulesAliases = () => {
10
10
  return {
11
- 'browserify-cipher': webpack_2.resolveModulePath('browserify-cipher/browser.js'),
12
- 'browserify-sign/algos': webpack_2.resolveModulePath('browserify-sign/algos.js'),
13
- 'browserify-sign': webpack_2.resolveModulePath('browserify-sign/browser/index.js'),
14
- 'create-ecdh': webpack_2.resolveModulePath('create-ecdh/browser.js'),
15
- 'create-hash/md5': webpack_2.resolveModulePath('create-hash/md5.js'),
16
- 'create-hash': webpack_2.resolveModulePath('create-hash/browser.js'),
17
- 'create-hmac': webpack_2.resolveModulePath('create-hmac/browser.js'),
18
- 'diffie-hellman': webpack_2.resolveModulePath('diffie-hellman/browser.js'),
19
- pbkdf2: webpack_2.resolveModulePath('pbkdf2/browser.js'),
20
- 'public-encrypt': webpack_2.resolveModulePath('public-encrypt/browser.js'),
21
- randombytes: webpack_2.resolveModulePath('randombytes/browser.js'),
22
- randomfill: webpack_2.resolveModulePath('randomfill/browser.js'),
23
- assert: webpack_2.resolveModulePath('assert/'),
24
- buffer: webpack_2.resolveModulePath('buffer/'),
25
- console: webpack_2.resolveModulePath('console-browserify'),
26
- crypto: webpack_2.resolveModulePath('crypto-browserify'),
27
- events: webpack_2.resolveModulePath('events/'),
28
- os: webpack_2.resolveModulePath('os-browserify/browser'),
29
- punycode: webpack_2.resolveModulePath('punycode/'),
30
- process: webpack_2.resolveModulePath('process/browser.js'),
31
- string_decoder: webpack_2.resolveModulePath('string_decoder/'),
32
- timers: webpack_2.resolveModulePath('timers-browserify'),
33
- url: webpack_2.resolveModulePath('url/'),
34
- util: webpack_2.resolveModulePath('util/'),
35
- zlib: webpack_2.resolveModulePath('browserify-zlib'),
36
- fs: webpack_2.resolveModulePath('memfs'),
37
- http: webpack_2.resolveModulePath('./http'),
38
- https: webpack_2.resolveModulePath('./http'),
39
- path: webpack_2.resolveModulePath('path-browserify'),
40
- querystring: webpack_2.resolveModulePath('querystring-browser'),
41
- stream: webpack_2.resolveModulePath('readable-stream'),
42
- 'supports-color': webpack_2.resolveModulePath('supports-color/index.js')
11
+ 'browserify-cipher': (0, webpack_2.resolveModulePath)('browserify-cipher/browser.js'),
12
+ 'browserify-sign/algos': (0, webpack_2.resolveModulePath)('browserify-sign/algos.js'),
13
+ 'browserify-sign': (0, webpack_2.resolveModulePath)('browserify-sign/browser/index.js'),
14
+ 'create-ecdh': (0, webpack_2.resolveModulePath)('create-ecdh/browser.js'),
15
+ 'create-hash/md5': (0, webpack_2.resolveModulePath)('create-hash/md5.js'),
16
+ 'create-hash': (0, webpack_2.resolveModulePath)('create-hash/browser.js'),
17
+ 'create-hmac': (0, webpack_2.resolveModulePath)('create-hmac/browser.js'),
18
+ 'diffie-hellman': (0, webpack_2.resolveModulePath)('diffie-hellman/browser.js'),
19
+ pbkdf2: (0, webpack_2.resolveModulePath)('pbkdf2/browser.js'),
20
+ 'public-encrypt': (0, webpack_2.resolveModulePath)('public-encrypt/browser.js'),
21
+ randombytes: (0, webpack_2.resolveModulePath)('randombytes/browser.js'),
22
+ randomfill: (0, webpack_2.resolveModulePath)('randomfill/browser.js'),
23
+ assert: (0, webpack_2.resolveModulePath)('assert/'),
24
+ buffer: (0, webpack_2.resolveModulePath)('buffer/'),
25
+ console: (0, webpack_2.resolveModulePath)('console-browserify'),
26
+ crypto: (0, webpack_2.resolveModulePath)('crypto-browserify'),
27
+ events: (0, webpack_2.resolveModulePath)('events/'),
28
+ os: (0, webpack_2.resolveModulePath)('os-browserify/browser'),
29
+ punycode: (0, webpack_2.resolveModulePath)('punycode/'),
30
+ process: (0, webpack_2.resolveModulePath)('process/browser.js'),
31
+ string_decoder: (0, webpack_2.resolveModulePath)('string_decoder/'),
32
+ timers: (0, webpack_2.resolveModulePath)('timers-browserify'),
33
+ url: (0, webpack_2.resolveModulePath)('url/'),
34
+ util: (0, webpack_2.resolveModulePath)('util/'),
35
+ zlib: (0, webpack_2.resolveModulePath)('browserify-zlib'),
36
+ fs: (0, webpack_2.resolveModulePath)('memfs'),
37
+ http: (0, webpack_2.resolveModulePath)('./http'),
38
+ https: (0, webpack_2.resolveModulePath)('./http'),
39
+ path: (0, webpack_2.resolveModulePath)('path-browserify'),
40
+ querystring: (0, webpack_2.resolveModulePath)('querystring-browser'),
41
+ stream: (0, webpack_2.resolveModulePath)('readable-stream'),
42
+ 'supports-color': (0, webpack_2.resolveModulePath)('supports-color/index.js')
43
43
  };
44
44
  };
45
- exports.getSandboxedRuntimeBuildConfig = (entrypoints, config) => {
46
- const webpackConfig = webpack_2.getCommonWebpackConfig(entrypoints, config);
45
+ const getSandboxedRuntimeBuildConfig = (entrypoints, config) => {
46
+ const webpackConfig = (0, webpack_2.getCommonWebpackConfig)(entrypoints, config);
47
47
  const sandboxedConfigPlugins = [
48
48
  new webpack_1.default.ProvidePlugin({
49
- Buffer: [webpack_2.resolveModulePath('buffer/'), 'Buffer'],
50
- path: webpack_2.resolveModulePath('path-browserify'),
51
- querystring: webpack_2.resolveModulePath('querystring-browser'),
52
- stream: webpack_2.resolveModulePath('readable-stream'),
53
- TextDecoder: [webpack_2.resolveModulePath('text-encoder-lite'), 'TextDecoderLite'],
54
- TextEncoder: [webpack_2.resolveModulePath('text-encoder-lite'), 'TextEncoderLite'],
55
- URL: [webpack_2.resolveModulePath('whatwg-url'), 'URL'],
56
- URLSearchParams: [webpack_2.resolveModulePath('whatwg-url'), 'URLSearchParams']
49
+ Buffer: [(0, webpack_2.resolveModulePath)('buffer/'), 'Buffer'],
50
+ path: (0, webpack_2.resolveModulePath)('path-browserify'),
51
+ querystring: (0, webpack_2.resolveModulePath)('querystring-browser'),
52
+ stream: (0, webpack_2.resolveModulePath)('readable-stream'),
53
+ TextDecoder: [(0, webpack_2.resolveModulePath)('text-encoder-lite'), 'TextDecoderLite'],
54
+ TextEncoder: [(0, webpack_2.resolveModulePath)('text-encoder-lite'), 'TextEncoderLite'],
55
+ URL: [(0, webpack_2.resolveModulePath)('whatwg-url'), 'URL'],
56
+ URLSearchParams: [(0, webpack_2.resolveModulePath)('whatwg-url'), 'URLSearchParams']
57
57
  }),
58
58
  new stub_plugin_1.StubPlugin({
59
59
  modules: [
@@ -79,7 +79,7 @@ exports.getSandboxedRuntimeBuildConfig = (entrypoints, config) => {
79
79
  'worker_threads'
80
80
  ],
81
81
  placeholder: 'requestedModule',
82
- stub: path_1.resolve(__dirname, '..', 'unsupported')
82
+ stub: (0, path_1.resolve)(__dirname, '..', 'unsupported')
83
83
  })
84
84
  ];
85
85
  sandboxedConfigPlugins.forEach((plugin) => webpackConfig.plugins.push(plugin));
@@ -102,3 +102,4 @@ exports.getSandboxedRuntimeBuildConfig = (entrypoints, config) => {
102
102
  webpackConfig.resolve = Object.assign(Object.assign({}, webpackConfig.resolve), { mainFields: ['main', 'module'], exportsFields: [], alias: getCustomModulesAliases() });
103
103
  return webpackConfig;
104
104
  };
105
+ exports.getSandboxedRuntimeBuildConfig = getSandboxedRuntimeBuildConfig;
package/out/console.js CHANGED
@@ -25,7 +25,7 @@ function transformSandBoxLogMessage(message) {
25
25
  '*': starval
26
26
  };
27
27
  }
28
- exports.starSerializer = (arg) => {
28
+ const starSerializer = (arg) => {
29
29
  var _a, _b;
30
30
  if (typeof arg !== 'object') {
31
31
  return arg;
@@ -45,10 +45,11 @@ exports.starSerializer = (arg) => {
45
45
  }
46
46
  const res = {};
47
47
  for (const prop in arg) {
48
- res[prop] = exports.starSerializer(arg[prop]);
48
+ res[prop] = (0, exports.starSerializer)(arg[prop]);
49
49
  }
50
50
  return res;
51
51
  };
52
+ exports.starSerializer = starSerializer;
52
53
  function formatLogMessage(requestId, logEventData) {
53
54
  const transformedMessage = transformSandBoxLogMessage(logEventData.logArguments);
54
55
  return {
@@ -61,7 +62,7 @@ function formatLogMessage(requestId, logEventData) {
61
62
  '*': transformedMessage['*']
62
63
  };
63
64
  }
64
- const logger = bunyan_1.createLogger({
65
+ const logger = (0, bunyan_1.createLogger)({
65
66
  name: 'node-runtime',
66
67
  level: bunyan_1.levelFromName.info,
67
68
  serializers: { err: bunyan_1.stdSerializers.err, '*': exports.starSerializer }
package/out/forge-api.js CHANGED
@@ -4,7 +4,7 @@ exports.asApp = exports.requestJira = exports.fetch = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
6
6
  async function fetch(url, init) {
7
- const result = await node_fetch_1.default(url, init);
7
+ const result = await (0, node_fetch_1.default)(url, init);
8
8
  return Object.assign(Object.assign({}, result), { json: () => result.json(), clone: () => result.clone(), arrayBuffer: () => result.arrayBuffer(), blob: () => result.blob(), buffer: () => result.buffer(), text: () => result.text(), textConverted: () => result.textConverted() });
9
9
  }
10
10
  exports.fetch = fetch;
@@ -1,4 +1,6 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
2
4
  import { IncomingMessage } from 'http';
3
5
  import { RequestOptions, AgentOptions } from 'https';
4
6
  import { Writable } from 'readable-stream';
@@ -1 +1 @@
1
- {"version":3,"file":"http-impl.d.ts","sourceRoot":"","sources":["../src/http-impl.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAY,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAkC,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAe,YAAY,EAAS,MAAM,YAAY,CAAC;AAsB9D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;AAMD,qBAAa,OAAQ,SAAQ,QAAQ;IACnC,OAAO,CAAC,OAAO,CAAW;IAC1B,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI;IAatF,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAM/C,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO;IAQhE,OAAO,CAAC,KAAK;IAsBN,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI;IAe3F,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM;IAmCjD,MAAM,CAAC,uBAAuB,CAC5B,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,GAAG,EACtC,gBAAgB,EAAE,gBAAgB,GACjC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,YAAY,CAAA;KAAE;CA8BvC;AAID,qBAAa,KAAK;gBACJ,OAAO,EAAE,YAAY;CAOlC"}
1
+ {"version":3,"file":"http-impl.d.ts","sourceRoot":"","sources":["../src/http-impl.ts"],"names":[],"mappings":";;;AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAY,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAkC,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAe,YAAY,EAAS,MAAM,YAAY,CAAC;AAsB9D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;AAMD,qBAAa,OAAQ,SAAQ,QAAQ;IACnC,OAAO,CAAC,OAAO,CAAW;IAC1B,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI;IAatF,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAM/C,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO;IAQhE,OAAO,CAAC,KAAK;IAsBN,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI;IAe3F,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM;IAmCjD,MAAM,CAAC,uBAAuB,CAC5B,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,GAAG,EACtC,gBAAgB,EAAE,gBAAgB,GACjC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,YAAY,CAAA;KAAE;CA8BvC;AAID,qBAAa,KAAK;gBACJ,OAAO,EAAE,YAAY;CAOlC"}
package/out/http-impl.js CHANGED
@@ -45,7 +45,7 @@ class Request extends readable_stream_1.Writable {
45
45
  if (init.method !== 'GET') {
46
46
  init.body = Buffer.concat(this.reqBody);
47
47
  }
48
- api_1.fetch(url, init)
48
+ (0, api_1.fetch)(url, init)
49
49
  .then(async (response) => {
50
50
  const content = await response.arrayBuffer();
51
51
  const transformedAPIResponse = new Response(content, response);
@@ -103,7 +103,7 @@ class Request extends readable_stream_1.Writable {
103
103
  }
104
104
  }
105
105
  }
106
- return url_1.format(reqUrlBuilder);
106
+ return (0, url_1.format)(reqUrlBuilder);
107
107
  }
108
108
  static convertToForgeFetchArgs(options, chainableOptions) {
109
109
  if (isString(options)) {
package/out/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.watch = exports.nativeUiBundle = exports.nodeBundle = exports.sandboxBundle = void 0;
3
4
  var webpack_1 = require("./webpack");
4
5
  Object.defineProperty(exports, "sandboxBundle", { enumerable: true, get: function () { return webpack_1.sandboxBundle; } });
5
6
  Object.defineProperty(exports, "nodeBundle", { enumerable: true, get: function () { return webpack_1.nodeBundle; } });
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TSConfigInteractor = exports.STATIC_TSCONFIG_PATH = exports.TSCONFIG = void 0;
4
4
  const path_1 = require("path");
5
5
  exports.TSCONFIG = 'tsconfig.json';
6
- exports.STATIC_TSCONFIG_PATH = path_1.join(__dirname, `../static/${exports.TSCONFIG}`);
6
+ exports.STATIC_TSCONFIG_PATH = (0, path_1.join)(__dirname, `../static/${exports.TSCONFIG}`);
7
7
  class TSConfigInteractor {
8
8
  constructor(fileSystemReader, appDirectory) {
9
9
  this.fileSystemReader = fileSystemReader;
10
10
  this.appDirectory = appDirectory;
11
11
  }
12
12
  getTSConfigPath() {
13
- const APP_TSCONFIG_PATH = path_1.join(this.appDirectory, exports.TSCONFIG);
13
+ const APP_TSCONFIG_PATH = (0, path_1.join)(this.appDirectory, exports.TSCONFIG);
14
14
  return this.fileSystemReader.fileExists(APP_TSCONFIG_PATH) ? APP_TSCONFIG_PATH : exports.STATIC_TSCONFIG_PATH;
15
15
  }
16
16
  }
package/out/webpack.js CHANGED
@@ -14,13 +14,14 @@ const sandboxed_webpack_config_1 = require("./bundler-config/sandboxed-webpack-c
14
14
  const node_webpack_config_1 = require("./bundler-config/node-webpack-config");
15
15
  const tsconfig_interactor_1 = require("./tsconfig-interactor");
16
16
  const nativeui_webpack_config_1 = require("./bundler-config/nativeui-webpack-config");
17
- const compilerOutputFileSystem = memfs_1.createFsFromVolume(new memfs_1.Volume());
17
+ const compilerOutputFileSystem = (0, memfs_1.createFsFromVolume)(new memfs_1.Volume());
18
18
  const readMemoryFileSync = (filePath) => {
19
19
  return compilerOutputFileSystem.readFileSync(filePath, { encoding: 'utf8' }).toString();
20
20
  };
21
- exports.resolveModulePath = (moduleName) => {
21
+ const resolveModulePath = (moduleName) => {
22
22
  return require.resolve(moduleName);
23
23
  };
24
+ exports.resolveModulePath = resolveModulePath;
24
25
  const handleCallback = (err, stats) => {
25
26
  if (err) {
26
27
  throw err;
@@ -47,19 +48,20 @@ const handleCallback = (err, stats) => {
47
48
  }
48
49
  return true;
49
50
  };
50
- exports.getDevToolConfig = (config) => {
51
+ const getDevToolConfig = (config) => {
51
52
  if (!config.isWatchMode) {
52
53
  return 'source-map';
53
54
  }
54
55
  return config.isDebugMode ? 'eval-cheap-module-source-map' : 'cheap-source-map';
55
56
  };
56
- exports.getCommonWebpackConfig = (entrypoints, config) => {
57
+ exports.getDevToolConfig = getDevToolConfig;
58
+ const getCommonWebpackConfig = (entrypoints, config) => {
57
59
  if (!require.main) {
58
60
  throw new Error(text_1.Text.noExecutableFile);
59
61
  }
60
62
  const resolvedEntryPoints = {};
61
63
  for (const entrypoint of entrypoints) {
62
- resolvedEntryPoints[entrypoint.name] = path_1.resolve(entrypoint.path);
64
+ resolvedEntryPoints[entrypoint.name] = (0, path_1.resolve)(entrypoint.path);
63
65
  }
64
66
  return {
65
67
  entry: Object.assign({}, resolvedEntryPoints),
@@ -67,7 +69,7 @@ exports.getCommonWebpackConfig = (entrypoints, config) => {
67
69
  optimization: {
68
70
  minimize: false
69
71
  },
70
- devtool: exports.getDevToolConfig(config),
72
+ devtool: (0, exports.getDevToolConfig)(config),
71
73
  output: {
72
74
  libraryTarget: 'commonjs',
73
75
  globalObject: 'this',
@@ -96,7 +98,7 @@ exports.getCommonWebpackConfig = (entrypoints, config) => {
96
98
  options: {
97
99
  presets: [
98
100
  [
99
- exports.resolveModulePath('@babel/preset-typescript'),
101
+ (0, exports.resolveModulePath)('@babel/preset-typescript'),
100
102
  {
101
103
  isTSX: true,
102
104
  jsxPragma: 'ForgeUI',
@@ -106,15 +108,15 @@ exports.getCommonWebpackConfig = (entrypoints, config) => {
106
108
  ],
107
109
  plugins: [
108
110
  [
109
- exports.resolveModulePath('@babel/plugin-transform-react-jsx'),
111
+ (0, exports.resolveModulePath)('@babel/plugin-transform-react-jsx'),
110
112
  {
111
113
  pragma: 'ForgeUI.createElement'
112
114
  }
113
115
  ],
114
- exports.resolveModulePath('@forge/babel-plugin-transform-ui'),
115
- exports.resolveModulePath('@babel/plugin-proposal-numeric-separator'),
116
- exports.resolveModulePath('@babel/plugin-proposal-class-properties'),
117
- exports.resolveModulePath('@babel/plugin-proposal-optional-chaining')
116
+ (0, exports.resolveModulePath)('@forge/babel-plugin-transform-ui'),
117
+ (0, exports.resolveModulePath)('@babel/plugin-proposal-numeric-separator'),
118
+ (0, exports.resolveModulePath)('@babel/plugin-proposal-class-properties'),
119
+ (0, exports.resolveModulePath)('@babel/plugin-proposal-optional-chaining')
118
120
  ],
119
121
  cacheDirectory: true
120
122
  }
@@ -142,8 +144,9 @@ exports.getCommonWebpackConfig = (entrypoints, config) => {
142
144
  }
143
145
  };
144
146
  };
147
+ exports.getCommonWebpackConfig = getCommonWebpackConfig;
145
148
  const getCompiler = (webpackConfig, options) => {
146
- const compiler = webpack_1.default(webpackConfig);
149
+ const compiler = (0, webpack_1.default)(webpackConfig);
147
150
  if (!(options === null || options === void 0 ? void 0 : options.writeToDisk)) {
148
151
  compiler.outputFileSystem = compilerOutputFileSystem;
149
152
  }
@@ -179,17 +182,17 @@ class Monitor {
179
182
  const runLinter = async (logger = { info: console.log }, fileSystemReader = new cli_shared_1.FileSystemReader(), fileSystemWriter = new cli_shared_1.FileSystemWriter()) => {
180
183
  logger.info(`\n${cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.lint.running)}`);
181
184
  const filesToLint = await fileSystemReader.recursiveReadDir('./src', [
182
- ...(await cli_shared_1.listGitIgnoreFiles(fileSystemReader)),
185
+ ...(await (0, cli_shared_1.listGitIgnoreFiles)(fileSystemReader)),
183
186
  '.git',
184
187
  'node_modules'
185
188
  ]);
186
189
  const configFile = new cli_shared_1.ConfigFile(fileSystemReader, fileSystemWriter);
187
190
  const manifest = await configFile.readConfig();
188
191
  try {
189
- const lintResults = await lint_1.lint(filesToLint, manifest, 'development', logger);
192
+ const lintResults = await (0, lint_1.lint)(filesToLint, manifest, 'development', logger);
190
193
  if (lintResults.some((result) => result.size())) {
191
194
  logger.info('');
192
- lint_1.reportLintResults(logger, lintResults);
195
+ (0, lint_1.reportLintResults)(logger, lintResults);
193
196
  }
194
197
  else {
195
198
  logger.info(cli_shared_1.LogColor.trace(cli_shared_1.Text.lint.noProblems) + '\n');
@@ -199,8 +202,8 @@ const runLinter = async (logger = { info: console.log }, fileSystemReader = new
199
202
  logger.info(cli_shared_1.Text.tunnel.lintFailed + '\n');
200
203
  }
201
204
  };
202
- exports.watch = (entryPoints, debugMode, callback, watchRun) => {
203
- const config = sandboxed_webpack_config_1.getSandboxedRuntimeBuildConfig(entryPoints, {
205
+ const watch = (entryPoints, debugMode, callback, watchRun) => {
206
+ const config = (0, sandboxed_webpack_config_1.getSandboxedRuntimeBuildConfig)(entryPoints, {
204
207
  isWatchMode: true,
205
208
  isDebugMode: debugMode,
206
209
  appDirectory: process.cwd()
@@ -234,7 +237,8 @@ exports.watch = (entryPoints, debugMode, callback, watchRun) => {
234
237
  });
235
238
  return new Monitor(watcher);
236
239
  };
237
- exports.createBundler = (getBuildConfig) => {
240
+ exports.watch = watch;
241
+ const createBundler = (getBuildConfig) => {
238
242
  return (appDirectory, endpoints) => {
239
243
  const config = getBuildConfig(endpoints, { isWatchMode: false, appDirectory });
240
244
  const compiler = getCompiler(config);
@@ -269,11 +273,12 @@ exports.createBundler = (getBuildConfig) => {
269
273
  });
270
274
  };
271
275
  };
272
- exports.sandboxBundle = exports.createBundler(sandboxed_webpack_config_1.getSandboxedRuntimeBuildConfig);
273
- exports.nodeBundle = async (appDirectory, entryPoints) => {
274
- const bundler = exports.createBundler(node_webpack_config_1.getNodeRuntimeBuildConfig);
276
+ exports.createBundler = createBundler;
277
+ exports.sandboxBundle = (0, exports.createBundler)(sandboxed_webpack_config_1.getSandboxedRuntimeBuildConfig);
278
+ const nodeBundle = async (appDirectory, entryPoints) => {
279
+ const bundler = (0, exports.createBundler)(node_webpack_config_1.getNodeRuntimeBuildConfig);
275
280
  const { output: bundlerOutput, sourceMap: bundlerSourceMap, metadata } = await bundler(appDirectory, entryPoints);
276
- const wrapper = fs_1.readFileSync(path_1.join(__dirname, '../out/wrapper.js')).toString();
281
+ const wrapper = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../out/wrapper.js')).toString();
277
282
  const output = {};
278
283
  const sourceMap = {};
279
284
  entryPoints.forEach(({ name }) => {
@@ -287,8 +292,9 @@ exports.nodeBundle = async (appDirectory, entryPoints) => {
287
292
  });
288
293
  return { output, sourceMap, metadata };
289
294
  };
290
- exports.nativeUiBundle = (appDirectory, entrypoints) => {
291
- const config = nativeui_webpack_config_1.getNativeUiBuildConfig(entrypoints, { isWatchMode: false, appDirectory });
295
+ exports.nodeBundle = nodeBundle;
296
+ const nativeUiBundle = (appDirectory, entrypoints) => {
297
+ const config = (0, nativeui_webpack_config_1.getNativeUiBuildConfig)(entrypoints, { isWatchMode: false, appDirectory });
292
298
  const compiler = getCompiler(config, { writeToDisk: true });
293
299
  return new Promise((resolve, reject) => {
294
300
  compiler.run((compilerError, stats) => {
@@ -306,3 +312,4 @@ exports.nativeUiBundle = (appDirectory, entrypoints) => {
306
312
  });
307
313
  });
308
314
  };
315
+ exports.nativeUiBundle = nativeUiBundle;
package/out/wrapper.d.ts CHANGED
@@ -34,7 +34,7 @@ declare function setupRequestContext(meta: any): {
34
34
  repositoryId?: undefined;
35
35
  license?: {
36
36
  isActive: boolean;
37
- };
37
+ } | undefined;
38
38
  principal: {
39
39
  accountId: any;
40
40
  } | undefined;
@@ -44,7 +44,7 @@ declare function setupRequestContext(meta: any): {
44
44
  projectId?: undefined;
45
45
  license?: {
46
46
  isActive: boolean;
47
- };
47
+ } | undefined;
48
48
  principal: {
49
49
  accountId: any;
50
50
  } | undefined;
@@ -54,7 +54,7 @@ declare function setupRequestContext(meta: any): {
54
54
  repositoryId?: undefined;
55
55
  license?: {
56
56
  isActive: boolean;
57
- };
57
+ } | undefined;
58
58
  principal: {
59
59
  accountId: any;
60
60
  } | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bundler",
3
- "version": "3.1.4-next.0",
3
+ "version": "4.0.0-next.1",
4
4
  "description": "Default bundler for Forge apps",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Atlassian",
@@ -20,8 +20,8 @@
20
20
  "@babel/preset-typescript": "^7.16.7",
21
21
  "@forge/api": "2.7.0",
22
22
  "@forge/babel-plugin-transform-ui": "1.1.0",
23
- "@forge/cli-shared": "3.2.2-next.0",
24
- "@forge/lint": "3.2.8-next.0",
23
+ "@forge/cli-shared": "3.2.2-next.1",
24
+ "@forge/lint": "3.2.8-next.1",
25
25
  "assert": "^1.1.1",
26
26
  "babel-loader": "^8.2.3",
27
27
  "browserify-zlib": "^0.2.0",
@@ -42,8 +42,8 @@
42
42
  "string_decoder": "^1.0.0",
43
43
  "text-encoder-lite": "^2.0.0",
44
44
  "timers-browserify": "^2.0.4",
45
- "ts-loader": "^9.2.6",
46
- "typescript": "^3.9.7",
45
+ "ts-loader": "^9.4.1",
46
+ "typescript": "^4.8.4",
47
47
  "url": "^0.11.0",
48
48
  "util": "^0.11.0",
49
49
  "webpack": "^5.66.0",
@@ -52,14 +52,14 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/bunyan": "^1.8.5",
55
- "@types/jest": "^26.0.0",
55
+ "@types/jest": "^29.1.2",
56
56
  "@types/node": "^12.12.63",
57
57
  "@types/react": "^17.0.38",
58
58
  "@types/readable-stream": "^2.3.5",
59
59
  "@types/webpack": "^5.28.0",
60
60
  "@types/webpack-bundle-analyzer": "^4.4.1",
61
- "@typescript-eslint/eslint-plugin": "^2.10.0",
62
- "@typescript-eslint/parser": "^2.10.0",
61
+ "@typescript-eslint/eslint-plugin": "^5.40.0",
62
+ "@typescript-eslint/parser": "^5.40.0",
63
63
  "eslint": "^7.32.0",
64
64
  "eslint-config-prettier": "^6.7.0",
65
65
  "eslint-plugin-prettier": "^3.1.1",