@forge/bundler 4.21.0-next.8 → 4.21.0
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 +80 -0
- package/out/nativeui.d.ts +1 -1
- package/out/nativeui.d.ts.map +1 -1
- package/out/nativeui.js +1 -1
- package/out/runtime.d.ts +6 -5
- package/out/runtime.d.ts.map +1 -1
- package/out/runtime.js +28 -17
- package/out/webpack.d.ts +1 -1
- package/out/webpack.d.ts.map +1 -1
- package/out/webpack.js +2 -2
- package/out/wrapper-provider.d.ts +2 -0
- package/out/wrapper-provider.d.ts.map +1 -1
- package/out/wrapper-provider.js +16 -17
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
+
## 4.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 9471e5d: Package Node runtime in a central location and remove 'bundled'
|
|
8
|
+
- 30f197e: Refactoring to enable alternate bundler support
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 4879128: Revert Changes: Added config file utility method to only read appId and refactored commands to perform validation after command configuration
|
|
13
|
+
- Updated dependencies [70cd30c]
|
|
14
|
+
- Updated dependencies [576da26]
|
|
15
|
+
- Updated dependencies [2712852]
|
|
16
|
+
- Updated dependencies [4879128]
|
|
17
|
+
- Updated dependencies [009ab70]
|
|
18
|
+
- Updated dependencies [cf5bc5c]
|
|
19
|
+
- Updated dependencies [272d770]
|
|
20
|
+
- Updated dependencies [9471e5d]
|
|
21
|
+
- Updated dependencies [78a006f]
|
|
22
|
+
- Updated dependencies [4c15b3a]
|
|
23
|
+
- Updated dependencies [359756b]
|
|
24
|
+
- Updated dependencies [34db0f6]
|
|
25
|
+
- Updated dependencies [01ca857]
|
|
26
|
+
- Updated dependencies [70badb7]
|
|
27
|
+
- Updated dependencies [30f197e]
|
|
28
|
+
- @forge/cli-shared@6.7.0
|
|
29
|
+
- @forge/api@5.1.1
|
|
30
|
+
- @forge/manifest@8.8.0
|
|
31
|
+
- @forge/lint@5.7.2
|
|
32
|
+
|
|
33
|
+
## 4.21.0-next.13
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 4879128: Revert Changes: Added config file utility method to only read appId and refactored commands to perform validation after command configuration
|
|
38
|
+
- Updated dependencies [4879128]
|
|
39
|
+
- @forge/cli-shared@6.7.0-next.11
|
|
40
|
+
- @forge/lint@5.7.2-next.11
|
|
41
|
+
|
|
42
|
+
## 4.21.0-next.12
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [cf5bc5c]
|
|
47
|
+
- Updated dependencies [4c15b3a]
|
|
48
|
+
- @forge/cli-shared@6.7.0-next.10
|
|
49
|
+
- @forge/manifest@8.8.0-next.5
|
|
50
|
+
- @forge/lint@5.7.2-next.10
|
|
51
|
+
|
|
52
|
+
## 4.21.0-next.11
|
|
53
|
+
|
|
54
|
+
### Minor Changes
|
|
55
|
+
|
|
56
|
+
- 9471e5d: Package Node runtime in a central location and remove 'bundled'
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [9471e5d]
|
|
61
|
+
- @forge/cli-shared@6.7.0-next.9
|
|
62
|
+
- @forge/lint@5.7.2-next.9
|
|
63
|
+
|
|
64
|
+
## 4.21.0-next.10
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [2712852]
|
|
69
|
+
- @forge/manifest@8.8.0-next.4
|
|
70
|
+
- @forge/cli-shared@6.6.2-next.8
|
|
71
|
+
- @forge/lint@5.7.2-next.8
|
|
72
|
+
|
|
73
|
+
## 4.21.0-next.9
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Updated dependencies [009ab70]
|
|
78
|
+
- Updated dependencies [34db0f6]
|
|
79
|
+
- @forge/manifest@8.7.1-next.3
|
|
80
|
+
- @forge/cli-shared@6.6.2-next.7
|
|
81
|
+
- @forge/lint@5.7.2-next.7
|
|
82
|
+
|
|
3
83
|
## 4.21.0-next.8
|
|
4
84
|
|
|
5
85
|
### Patch Changes
|
package/out/nativeui.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface NativeUIBundleResult {
|
|
|
6
6
|
nativeUiBundlesDetails: ResourceDetails[];
|
|
7
7
|
}
|
|
8
8
|
export declare class NativeUIBundler extends WebpackBundler {
|
|
9
|
-
getConfig({ entryPoints, i18nConfig }: BundlerArgs): ConfigWithOutput
|
|
9
|
+
getConfig({ entryPoints, i18nConfig }: BundlerArgs): Promise<ConfigWithOutput>;
|
|
10
10
|
bundleResources(resources: ResourceDetails[], i18nConfig?: Translations): Promise<NativeUIBundleResult>;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=nativeui.d.ts.map
|
package/out/nativeui.d.ts.map
CHANGED
|
@@ -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,EAA4B,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,sBAAsB,EAAE,eAAe,EAAE,CAAC;CAC3C;AAED,qBAAa,eAAgB,SAAQ,cAAc;
|
|
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,EAA4B,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,sBAAsB,EAAE,eAAe,EAAE,CAAC;CAC3C;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;CAgCrH"}
|
package/out/nativeui.js
CHANGED
|
@@ -5,7 +5,7 @@ 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
|
-
getConfig({ entryPoints, i18nConfig }) {
|
|
8
|
+
async getConfig({ entryPoints, i18nConfig }) {
|
|
9
9
|
return (0, nativeui_1.getNativeUiBuildConfig)(entryPoints, i18nConfig);
|
|
10
10
|
}
|
|
11
11
|
async bundleResources(resources, i18nConfig) {
|
package/out/runtime.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { ConfigReader } from '@forge/cli-shared';
|
|
1
|
+
import { ConfigReader, StatsigReader } from '@forge/cli-shared';
|
|
2
2
|
import { BundleLogger, BundlerArgs } from './types';
|
|
3
3
|
import { ConfigWithOutput, WebpackBundler } from './webpack';
|
|
4
4
|
import { WrapperProvider } from './wrapper-provider';
|
|
5
5
|
export declare class SandboxBundler extends WebpackBundler {
|
|
6
6
|
constructor(logger: BundleLogger);
|
|
7
|
-
getConfig(args: BundlerArgs): ConfigWithOutput
|
|
7
|
+
getConfig(args: BundlerArgs): Promise<ConfigWithOutput>;
|
|
8
8
|
}
|
|
9
9
|
declare class NodeBundler extends WebpackBundler {
|
|
10
10
|
private readonly wrapperProvider;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
private readonly statsigReader;
|
|
12
|
+
constructor(logger: BundleLogger, wrapperProvider: WrapperProvider, statsigReader: StatsigReader);
|
|
13
|
+
getConfig(args: BundlerArgs): Promise<ConfigWithOutput>;
|
|
13
14
|
}
|
|
14
|
-
export declare function getNodeBundler(logger: BundleLogger, wrapperProvider: WrapperProvider, configReader: ConfigReader): NodeBundler;
|
|
15
|
+
export declare function getNodeBundler(logger: BundleLogger, wrapperProvider: WrapperProvider, configReader: ConfigReader, statsigReader: StatsigReader): NodeBundler;
|
|
15
16
|
export {};
|
|
16
17
|
//# sourceMappingURL=runtime.d.ts.map
|
package/out/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIhE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAc,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAiB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEpE,qBAAa,cAAe,SAAQ,cAAc;gBACpC,MAAM,EAAE,YAAY;IAI1B,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG9D;AAkDD,cAAM,WAAY,SAAQ,cAAc;IAGpC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAF9B,MAAM,EAAE,YAAY,EACH,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa;IAKzC,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAmD9D;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,GAC3B,WAAW,CAKb"}
|
package/out/runtime.js
CHANGED
|
@@ -11,42 +11,53 @@ class SandboxBundler extends webpack_2.WebpackBundler {
|
|
|
11
11
|
constructor(logger) {
|
|
12
12
|
super(logger);
|
|
13
13
|
}
|
|
14
|
-
getConfig(args) {
|
|
14
|
+
async getConfig(args) {
|
|
15
15
|
return (0, sandbox_1.getSandboxedRuntimeBuildConfig)(args);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.SandboxBundler = SandboxBundler;
|
|
19
|
+
const NODE_RUNTIME_CODE_FILE = '__forge__.js';
|
|
20
|
+
const NODE_RUNTIME_BACKUP_WRAPPER_FILE = '__forge_wrapper__.cjs';
|
|
19
21
|
const NODE_RUNTIME_VERSION_FILE = 'runtime.json';
|
|
20
22
|
const NODE_WEBPACK_USER_CODE_DIR = 'bundled';
|
|
21
|
-
async function emitWrapperFiles(provider, entrypoints, emit) {
|
|
23
|
+
async function emitWrapperFiles(provider, entrypoints, emit, useSingleWrapper) {
|
|
22
24
|
const wrapper = await provider.getNodeRuntimeWrapper();
|
|
23
25
|
const loader = await provider.getNodeRuntimeLoader();
|
|
26
|
+
let entrypointScript;
|
|
24
27
|
if (loader) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
entrypointScript = loader;
|
|
29
|
+
await emit(NODE_RUNTIME_BACKUP_WRAPPER_FILE, wrapper.script);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
entrypointScript = wrapper;
|
|
33
|
+
}
|
|
34
|
+
if (useSingleWrapper) {
|
|
35
|
+
await emit(NODE_RUNTIME_CODE_FILE, entrypointScript.script);
|
|
29
36
|
}
|
|
30
37
|
else {
|
|
31
38
|
for (const entrypoint of entrypoints) {
|
|
32
|
-
await emit(`${entrypoint.name}.cjs`,
|
|
39
|
+
await emit(`${entrypoint.name}.cjs`, entrypointScript.script);
|
|
33
40
|
}
|
|
34
41
|
}
|
|
35
|
-
await emit(NODE_RUNTIME_VERSION_FILE, JSON.stringify({ version:
|
|
42
|
+
await emit(NODE_RUNTIME_VERSION_FILE, JSON.stringify({ version: entrypointScript.version }, null, 2));
|
|
36
43
|
}
|
|
37
44
|
class NodeBundler extends webpack_2.WebpackBundler {
|
|
38
45
|
wrapperProvider;
|
|
39
|
-
|
|
46
|
+
statsigReader;
|
|
47
|
+
constructor(logger, wrapperProvider, statsigReader) {
|
|
40
48
|
super(logger);
|
|
41
49
|
this.wrapperProvider = wrapperProvider;
|
|
50
|
+
this.statsigReader = statsigReader;
|
|
42
51
|
}
|
|
43
|
-
getConfig(args) {
|
|
52
|
+
async getConfig(args) {
|
|
44
53
|
const webpackConfig = (0, common_1.getCommonWebpackConfig)(args);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
if (!(await this.statsigReader.packageSingleWrapper())) {
|
|
55
|
+
const newEntries = {};
|
|
56
|
+
for (const [entryKey, entryPath] of Object.entries(webpackConfig.entry)) {
|
|
57
|
+
newEntries[`${NODE_WEBPACK_USER_CODE_DIR}/${entryKey}`] = entryPath;
|
|
58
|
+
}
|
|
59
|
+
webpackConfig.entry = newEntries;
|
|
48
60
|
}
|
|
49
|
-
webpackConfig.entry = newEntries;
|
|
50
61
|
webpackConfig.target = 'node18';
|
|
51
62
|
webpackConfig.output.filename = '[name].cjs';
|
|
52
63
|
webpackConfig.name = 'node-runtime';
|
|
@@ -58,13 +69,13 @@ class NodeBundler extends webpack_2.WebpackBundler {
|
|
|
58
69
|
});
|
|
59
70
|
webpackConfig.plugins.push({
|
|
60
71
|
apply: (compiler) => {
|
|
61
|
-
compiler.hooks.make.tapPromise('AfterEmitPlugin', async (compilation) => await emitWrapperFiles(this.wrapperProvider, args.entryPoints, async (name, contents) => compilation.emitAsset(name, new RawSource(contents))));
|
|
72
|
+
compiler.hooks.make.tapPromise('AfterEmitPlugin', async (compilation) => await emitWrapperFiles(this.wrapperProvider, args.entryPoints, async (name, contents) => compilation.emitAsset(name, new RawSource(contents)), await this.statsigReader.packageSingleWrapper()));
|
|
62
73
|
}
|
|
63
74
|
});
|
|
64
75
|
return webpackConfig;
|
|
65
76
|
}
|
|
66
77
|
}
|
|
67
|
-
function getNodeBundler(logger, wrapperProvider, configReader) {
|
|
68
|
-
return new NodeBundler(logger, wrapperProvider);
|
|
78
|
+
function getNodeBundler(logger, wrapperProvider, configReader, statsigReader) {
|
|
79
|
+
return new NodeBundler(logger, wrapperProvider, statsigReader);
|
|
69
80
|
}
|
|
70
81
|
exports.getNodeBundler = getNodeBundler;
|
package/out/webpack.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare abstract class WebpackBundler implements Bundler {
|
|
|
11
11
|
constructor(logger: BundleLogger);
|
|
12
12
|
protected getOutput(config: ConfigWithOutput, stats: webpack.Stats): Promise<BundlerOutput>;
|
|
13
13
|
protected runCompiler(config: ConfigWithOutput): Promise<BundlerOutput>;
|
|
14
|
-
abstract getConfig(args: BundlerArgs): ConfigWithOutput
|
|
14
|
+
abstract getConfig(args: BundlerArgs): Promise<ConfigWithOutput>;
|
|
15
15
|
bundle(args: BundlerArgs): Promise<BundlerOutput>;
|
|
16
16
|
watch(args: BundlerWatchArgs, watch: BundlerWatch): Promise<BundlerWatchOutput>;
|
|
17
17
|
}
|
package/out/webpack.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAE,mBAAmB,EAA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AEjB,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC7B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC,GAAG,SAAS,GAC7E,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAkChC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,QAAQ,CAE3E;AAqBD,oBAAY,gBAAgB,GAAG,OAAO,CAAC,aAAa,GAAG;IAAE,MAAM,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAEvF,8BAAsB,cAAe,YAAW,OAAO;IACzC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY;gBAApB,MAAM,EAAE,YAAY;cAEnC,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC;cAWjF,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAsB7E,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAE1D,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAKjD,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAsCtF"}
|
package/out/webpack.js
CHANGED
|
@@ -88,11 +88,11 @@ class WebpackBundler {
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
async bundle(args) {
|
|
91
|
-
const config = this.getConfig(args);
|
|
91
|
+
const config = await this.getConfig(args);
|
|
92
92
|
return await this.runCompiler(config);
|
|
93
93
|
}
|
|
94
94
|
async watch(args, watch) {
|
|
95
|
-
const config = this.getConfig(args);
|
|
95
|
+
const config = await this.getConfig(args);
|
|
96
96
|
const compiler = getCompiler(config);
|
|
97
97
|
let isFirstRun = true;
|
|
98
98
|
compiler.hooks.watchRun.tapAsync('watchRun', async (_, watchRunCallback) => {
|
|
@@ -10,6 +10,7 @@ export declare class ParseWrapperCDNIndexError extends BaseError {
|
|
|
10
10
|
}
|
|
11
11
|
export declare type RuntimeScript = {
|
|
12
12
|
script: string;
|
|
13
|
+
source: string;
|
|
13
14
|
version: string;
|
|
14
15
|
};
|
|
15
16
|
export interface WrapperProvider {
|
|
@@ -20,6 +21,7 @@ export declare class LocalWrapperProvider implements WrapperProvider {
|
|
|
20
21
|
private readonly filesystemReader;
|
|
21
22
|
private readonly runtimePath;
|
|
22
23
|
constructor(filesystemReader: FileSystemReader, runtimePath: string);
|
|
24
|
+
private getLocalScript;
|
|
23
25
|
getNodeRuntimeWrapper(): Promise<RuntimeScript>;
|
|
24
26
|
getNodeRuntimeLoader(): Promise<RuntimeScript | undefined>;
|
|
25
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper-provider.d.ts","sourceRoot":"","sources":["../src/wrapper-provider.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,SAAS,EAGT,cAAc,EACf,MAAM,mBAAmB,CAAC;AAW3B,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,WAAW,eAAe;IAC9B,qBAAqB,IAAI,OAAO,CAAC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BAAa,sBAAuB,YAAW,eAAe;IAKhD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc;IAJ7D,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,MAAM,CAA4B;IAC1C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEM,cAAc,EAAE,cAAc;YAI/C,sBAAsB;IAgBpC,OAAO,CAAC,cAAc,CAoCpB;IAEI,qBAAqB,IAAI,OAAO,CAAC,aAAa,CAAC;IAO/C,oBAAoB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAQjE;AAED,eAAO,MAAM,kBAAkB;sBAIX,gBAAgB;oBAClB,cAAc;mDAS/B,CAAC"}
|
package/out/wrapper-provider.js
CHANGED
|
@@ -44,25 +44,23 @@ class LocalWrapperProvider {
|
|
|
44
44
|
this.filesystemReader = filesystemReader;
|
|
45
45
|
this.runtimePath = runtimePath;
|
|
46
46
|
}
|
|
47
|
-
async
|
|
48
|
-
const
|
|
49
|
-
|
|
47
|
+
async getLocalScript(scriptType) {
|
|
48
|
+
const source = path_1.default.join(this.runtimePath, `dist/${scriptType}.js`);
|
|
49
|
+
const script = await this.filesystemReader.readFileAsync(source);
|
|
50
|
+
if (!script) {
|
|
50
51
|
throw new LocalWrapperNotFoundError();
|
|
51
52
|
}
|
|
52
53
|
return {
|
|
53
|
-
script
|
|
54
|
-
|
|
54
|
+
script,
|
|
55
|
+
source,
|
|
56
|
+
version: 'local'
|
|
55
57
|
};
|
|
56
58
|
}
|
|
59
|
+
async getNodeRuntimeWrapper() {
|
|
60
|
+
return await this.getLocalScript(ScriptType.WRAPPER);
|
|
61
|
+
}
|
|
57
62
|
async getNodeRuntimeLoader() {
|
|
58
|
-
|
|
59
|
-
if (!loader) {
|
|
60
|
-
throw new LocalWrapperNotFoundError();
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
script: loader,
|
|
64
|
-
version: 'local-loader'
|
|
65
|
-
};
|
|
63
|
+
return await this.getLocalScript(ScriptType.LOADER);
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
exports.LocalWrapperProvider = LocalWrapperProvider;
|
|
@@ -91,15 +89,16 @@ class NetworkWrapperProvider {
|
|
|
91
89
|
if (!indexResponse.ok) {
|
|
92
90
|
throw new WrapperNetworkError(`Failed to fetch runtime component: ${this.cdnUrl} ${indexResponse.status}.`, (0, cli_shared_1.getAtlassianTraceId)(indexResponse.headers));
|
|
93
91
|
}
|
|
94
|
-
const
|
|
95
|
-
const response = await (0, node_fetch_1.default)(
|
|
92
|
+
const source = await this.getScriptPathFromIndex(await indexResponse.text(), (0, cli_shared_1.getAtlassianTraceId)(indexResponse.headers), scriptType);
|
|
93
|
+
const response = await (0, node_fetch_1.default)(source);
|
|
96
94
|
if (!response.ok) {
|
|
97
|
-
throw new WrapperNetworkError(`Failed to fetch runtime component: ${
|
|
95
|
+
throw new WrapperNetworkError(`Failed to fetch runtime component: ${source.toString()} ${response.status}.`, (0, cli_shared_1.getAtlassianTraceId)(response.headers));
|
|
98
96
|
}
|
|
99
97
|
const script = await response.text();
|
|
100
98
|
return {
|
|
101
99
|
script,
|
|
102
|
-
|
|
100
|
+
source,
|
|
101
|
+
version: new URL(source).pathname
|
|
103
102
|
};
|
|
104
103
|
}
|
|
105
104
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/bundler",
|
|
3
|
-
"version": "4.21.0
|
|
3
|
+
"version": "4.21.0",
|
|
4
4
|
"description": "Default bundler for Forge apps",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
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": "5.1.1
|
|
22
|
+
"@forge/api": "5.1.1",
|
|
23
23
|
"@forge/babel-plugin-transform-ui": "1.1.21",
|
|
24
|
-
"@forge/cli-shared": "6.
|
|
24
|
+
"@forge/cli-shared": "6.7.0",
|
|
25
25
|
"@forge/i18n": "0.0.4",
|
|
26
|
-
"@forge/lint": "5.7.2
|
|
27
|
-
"@forge/manifest": "8.
|
|
26
|
+
"@forge/lint": "5.7.2",
|
|
27
|
+
"@forge/manifest": "8.8.0",
|
|
28
28
|
"@forge/util": "1.4.8",
|
|
29
29
|
"assert": "^2.1.0",
|
|
30
30
|
"babel-loader": "^8.3.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@atlassian/xen-test-util": "^4.2.0",
|
|
64
|
-
"@forge/runtime": "5.10.7
|
|
64
|
+
"@forge/runtime": "5.10.7",
|
|
65
65
|
"@types/jest": "^29.5.12",
|
|
66
66
|
"@types/node": "14.18.63",
|
|
67
67
|
"@types/react": "^18.2.64",
|