@forge/bundler 4.12.4-next.4 → 4.13.0-next.11

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,66 @@
1
1
  # @forge/bundler
2
2
 
3
+ ## 4.13.0-next.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8e7c4ca]
8
+ - @forge/cli-shared@3.20.2-next.4
9
+ - @forge/lint@3.7.2-next.5
10
+ - @forge/node-runtime@0.4.0-next.5
11
+
12
+ ## 4.13.0-next.10
13
+
14
+ ### Patch Changes
15
+
16
+ - 5c47ac2: Bumping dependencies via Renovate:
17
+
18
+ - @types/react
19
+
20
+ ## 4.13.0-next.9
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [863f7eb]
25
+ - @forge/util@1.3.2-next.0
26
+ - @forge/api@2.19.3-next.0
27
+ - @forge/cli-shared@3.20.2-next.3
28
+ - @forge/node-runtime@0.4.0-next.4
29
+ - @forge/lint@3.7.2-next.4
30
+
31
+ ## 4.13.0-next.8
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [ce14925]
36
+ - @forge/cli-shared@3.20.2-next.2
37
+ - @forge/lint@3.7.2-next.3
38
+
39
+ ## 4.13.0-next.7
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [92a511b]
44
+ - @forge/lint@3.7.2-next.2
45
+
46
+ ## 4.13.0-next.6
47
+
48
+ ### Patch Changes
49
+
50
+ - @forge/cli-shared@3.20.2-next.1
51
+ - @forge/lint@3.7.2-next.1
52
+
53
+ ## 4.13.0-next.5
54
+
55
+ ### Minor Changes
56
+
57
+ - 1d4baff: Track node-runtime version
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [1d4baff]
62
+ - @forge/node-runtime@0.4.0-next.3
63
+
3
64
  ## 4.12.4-next.4
4
65
 
5
66
  ### Patch Changes
@@ -2,6 +2,7 @@ import { CommonWebpackConfig, ConfigBuilder, FunctionsEntryPoint } from './commo
2
2
  import { BaseError, FileSystemReader, UserError } from '@forge/cli-shared';
3
3
  export declare const NODE_WEBPACK_CONFIG_NAME = "node-runtime";
4
4
  export declare const NODE_WEBPACK_USER_CODE_DIR = "bundled";
5
+ export declare const NODE_RUNTIME_VERSION_FILE = "runtime.json";
5
6
  export declare class LocalWrapperNotFoundError extends UserError {
6
7
  constructor();
7
8
  }
@@ -11,20 +12,24 @@ export declare class WrapperNetworkError extends BaseError {
11
12
  export declare class ParseWrapperCDNIndexError extends BaseError {
12
13
  constructor(message: string, requestId: string | undefined);
13
14
  }
15
+ export type WrapperScript = {
16
+ script: string;
17
+ version: string;
18
+ };
14
19
  export interface WrapperProvider {
15
- getNodeRuntimeWrapper(): Promise<string>;
20
+ getNodeRuntimeWrapper(): Promise<WrapperScript>;
16
21
  }
17
22
  export declare class LocalWrapperProvider implements WrapperProvider {
18
23
  private readonly filesystemReader;
19
24
  constructor(filesystemReader: FileSystemReader);
20
- getNodeRuntimeWrapper(): Promise<string>;
25
+ getNodeRuntimeWrapper(): Promise<WrapperScript>;
21
26
  }
22
27
  export declare class NetworkWrapperProvider implements WrapperProvider {
23
28
  private readonly cdnUrl;
24
29
  private wrapper;
25
30
  constructor(cdnUrl: string);
26
31
  private getWrapperPathFromIndex;
27
- getNodeRuntimeWrapper(): Promise<string>;
32
+ getNodeRuntimeWrapper(): Promise<WrapperScript>;
28
33
  }
29
34
  export declare const getWrapperProvider: ({ fileSystemReader }: {
30
35
  fileSystemReader: FileSystemReader;
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/config/node.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAuB,MAAM,mBAAmB,CAAC;AAGhG,eAAO,MAAM,wBAAwB,iBAAiB,CAAC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AA0B,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,MAAM,MAAM,aAAa,GAAG;IAC1B,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;IAC9C,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IACzD,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC;CAUtD;AAED,qBAAa,sBAAuB,YAAW,eAAe;IAEhD,OAAO,CAAC,QAAQ,CAAC,MAAM;IADnC,OAAO,CAAC,OAAO,CAA4B;gBACd,MAAM,EAAE,MAAM;YAE7B,uBAAuB;IAS/B,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC;CAuCtD;AAED,eAAO,MAAM,kBAAkB;sBAA8C,gBAAgB;mDAM5F,CAAC;AAEF,eAAO,MAAM,yBAAyB,oBAClB,eAAe,mBACnB,mBAAmB,EAAE,UAAU,aAAa,KAAG,mBA2D5D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNodeRuntimeBuildConfig = exports.getWrapperProvider = exports.NetworkWrapperProvider = exports.LocalWrapperProvider = exports.ParseWrapperCDNIndexError = exports.WrapperNetworkError = exports.LocalWrapperNotFoundError = exports.NODE_WEBPACK_USER_CODE_DIR = exports.NODE_WEBPACK_CONFIG_NAME = void 0;
3
+ exports.getNodeRuntimeBuildConfig = exports.getWrapperProvider = exports.NetworkWrapperProvider = exports.LocalWrapperProvider = exports.ParseWrapperCDNIndexError = exports.WrapperNetworkError = exports.LocalWrapperNotFoundError = exports.NODE_RUNTIME_VERSION_FILE = exports.NODE_WEBPACK_USER_CODE_DIR = exports.NODE_WEBPACK_CONFIG_NAME = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const node_runtime_1 = require("@forge/node-runtime");
6
6
  const common_1 = require("./common");
@@ -9,6 +9,7 @@ const cli_shared_1 = require("@forge/cli-shared");
9
9
  const cheerio_1 = tslib_1.__importDefault(require("cheerio"));
10
10
  exports.NODE_WEBPACK_CONFIG_NAME = 'node-runtime';
11
11
  exports.NODE_WEBPACK_USER_CODE_DIR = 'bundled';
12
+ exports.NODE_RUNTIME_VERSION_FILE = 'runtime.json';
12
13
  const FORGE_RUNTIME_CDN = 'https://forge-node-runtime.prod-east.frontend.public.atl-paas.net/';
13
14
  class LocalWrapperNotFoundError extends cli_shared_1.UserError {
14
15
  constructor() {
@@ -37,7 +38,10 @@ class LocalWrapperProvider {
37
38
  if (!wrapper) {
38
39
  throw new LocalWrapperNotFoundError();
39
40
  }
40
- return wrapper;
41
+ return {
42
+ script: wrapper,
43
+ version: 'local'
44
+ };
41
45
  }
42
46
  }
43
47
  exports.LocalWrapperProvider = LocalWrapperProvider;
@@ -68,7 +72,11 @@ class NetworkWrapperProvider {
68
72
  if (!response.ok) {
69
73
  throw new WrapperNetworkError(`Failed to fetch runtime component: ${wrapperUrl.toString()} ${response.status}.`, (0, cli_shared_1.getAtlassianTraceId)(response.headers));
70
74
  }
71
- this.wrapper = await response.text();
75
+ const script = await response.text();
76
+ this.wrapper = {
77
+ script,
78
+ version: new URL(wrapperUrl).pathname
79
+ };
72
80
  return this.wrapper;
73
81
  }
74
82
  catch (e) {
@@ -107,10 +115,13 @@ const getNodeRuntimeBuildConfig = (wrapperProvider) => (entrypoints, config) =>
107
115
  compiler.hooks.make.tapPromise('AfterEmitPlugin', async (compilation) => {
108
116
  const { RawSource } = compiler.webpack.sources;
109
117
  const wrapper = await wrapperProvider.getNodeRuntimeWrapper();
110
- const source = new RawSource(wrapper);
118
+ const source = new RawSource(wrapper.script);
111
119
  for (const entrypoint of entrypoints) {
112
120
  compilation.emitAsset(`${entrypoint.name}.js`, source);
113
121
  }
122
+ compilation.emitAsset(exports.NODE_RUNTIME_VERSION_FILE, new RawSource(JSON.stringify({
123
+ version: wrapper.version
124
+ }, null, 2)));
114
125
  });
115
126
  }
116
127
  });
@@ -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,EACL,OAAO,EAGP,OAAO,EAEP,aAAa,EACb,aAAa,EACb,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,gBAAgB,EAGhB,gBAAgB,EAGjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA2B,UAAU,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtG,OAAO,EAIL,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,EAAE,OAAO,CAAC,KAAK,GAAG,SAAS,GAC/B,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAkChC;AAWD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,GAAG,aAAa,CAmB9F;AAED,UAAU,eAAe;IACvB,WAAW,CA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Y,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;AAWD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAE,GAAG,GAAG,aAAa,CAyB9F;AAED,UAAU,eAAe;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,WAAW,kBAAmB,aAAa,YAAY,eAAe,KAAG,QAOrF,CAAC;AA6BF,eAAO,MAAM,SAAS,YAEZ,UAAU,+EAGjB,QAAQ,IAAI,CA+Bd,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,OAwBnB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,SAAS,UAAU,GAAG,UAAU,EAC9D,cAAc,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,aAAa,KAAK,mBAAmB,GACvF,OAAO,CAAC,EAAE,CAAC,CA+Bb;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,OAA6D,CAAC;AACpG,eAAO,MAAM,cAAc,EAAE,CAAC,eAAe,EAAE,eAAe,KAAK,OAAO,CAAC,mBAAmB,CACnC,CAAC;AAE5D,eAAO,MAAM,cAAc,EAAE,aAkB5B,CAAC"}
package/out/webpack.js CHANGED
@@ -53,15 +53,19 @@ function getInMemoryBundle(config, fileSystem) {
53
53
  const output = {}, sourceMap = {};
54
54
  const outputFileSystem = fileSystem || compilerOutputFileSystem;
55
55
  for (const name in config.entry) {
56
- output[name] = readMemoryFileSync(outputFileSystem, `/${name}.js`).toString();
56
+ output[name] = readMemoryFileSync(outputFileSystem, `/${name}.js`);
57
57
  if (config.name === node_1.NODE_WEBPACK_CONFIG_NAME && name.startsWith(node_1.NODE_WEBPACK_USER_CODE_DIR + '/')) {
58
58
  const wrapperName = name.slice(node_1.NODE_WEBPACK_USER_CODE_DIR.length + 1);
59
- output[wrapperName] = readMemoryFileSync(outputFileSystem, `/${wrapperName}.js`).toString();
59
+ output[wrapperName] = readMemoryFileSync(outputFileSystem, `/${wrapperName}.js`);
60
60
  tryReadSourceMapSync(outputFileSystem, sourceMap, wrapperName);
61
61
  }
62
62
  tryReadSourceMapSync(outputFileSystem, sourceMap, name);
63
63
  }
64
- return { output, sourceMap };
64
+ const metadata = {};
65
+ if (config.name === node_1.NODE_WEBPACK_CONFIG_NAME) {
66
+ metadata.nodeRuntimeVersion = readMemoryFileSync(outputFileSystem, `/${node_1.NODE_RUNTIME_VERSION_FILE}`);
67
+ }
68
+ return { output, sourceMap, metadata };
65
69
  }
66
70
  exports.getInMemoryBundle = getInMemoryBundle;
67
71
  const getCompiler = (webpackConfig, options) => {
@@ -164,9 +168,7 @@ function createBundler(getBuildConfig) {
164
168
  reject(closeError);
165
169
  }
166
170
  });
167
- result.metadata = {
168
- modules: getNodeModuleNames(stats)
169
- };
171
+ result.metadata = Object.assign({ modules: getNodeModuleNames(stats) }, result.metadata);
170
172
  resolve(result);
171
173
  }
172
174
  catch (fileReadError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bundler",
3
- "version": "4.12.4-next.4",
3
+ "version": "4.13.0-next.11",
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.0",
20
20
  "@babel/plugin-transform-react-jsx": "^7.22.15",
21
21
  "@babel/preset-typescript": "^7.23.0",
22
- "@forge/api": "2.19.2",
22
+ "@forge/api": "2.19.3-next.0",
23
23
  "@forge/babel-plugin-transform-ui": "1.1.9",
24
- "@forge/cli-shared": "3.20.2-next.0",
25
- "@forge/lint": "3.7.2-next.0",
26
- "@forge/node-runtime": "0.3.1-next.2",
27
- "@forge/util": "1.3.1",
24
+ "@forge/cli-shared": "3.20.2-next.4",
25
+ "@forge/lint": "3.7.2-next.5",
26
+ "@forge/node-runtime": "0.4.0-next.5",
27
+ "@forge/util": "1.3.2-next.0",
28
28
  "assert": "^2.1.0",
29
29
  "babel-loader": "^8.3.0",
30
30
  "browserify-zlib": "^0.2.0",
@@ -59,10 +59,10 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@atlassian/xen-test-util": "^3.1.2",
62
- "@forge/runtime": "5.1.2-next.0",
62
+ "@forge/runtime": "5.1.2-next.2",
63
63
  "@types/jest": "^29.5.5",
64
64
  "@types/node": "14.18.63",
65
- "@types/react": "^17.0.67",
65
+ "@types/react": "^17.0.68",
66
66
  "@types/readable-stream": "^4.0.3",
67
67
  "@types/webpack-bundle-analyzer": "^4.6.1",
68
68
  "@typescript-eslint/eslint-plugin": "^5.62.0",