@forge/bundler 6.1.4-next.7 → 6.1.4-next.8
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 +12 -0
- package/out/metadata.d.ts +1 -1
- package/out/metadata.d.ts.map +1 -1
- package/out/metadata.js +15 -5
- package/out/runtime.d.ts +2 -2
- package/out/runtime.d.ts.map +1 -1
- package/out/runtime.js +12 -5
- package/out/text.d.ts +1 -0
- package/out/text.d.ts.map +1 -1
- package/out/text.js +3 -1
- package/out/typescript.d.ts +0 -1
- package/out/typescript.d.ts.map +1 -1
- package/out/typescript.js +2 -11
- package/out/webpack.d.ts +3 -3
- package/out/webpack.d.ts.map +1 -1
- package/out/webpack.js +8 -11
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @forge/bundler
|
|
2
2
|
|
|
3
|
+
## 6.1.4-next.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 725a653: Don't collect metadata from symlinked external dependencies
|
|
8
|
+
- 7b15cc4: Hide TypeScript bundler behind an EAP
|
|
9
|
+
- Updated dependencies [725a653]
|
|
10
|
+
- Updated dependencies [a0e621c]
|
|
11
|
+
- Updated dependencies [7b15cc4]
|
|
12
|
+
- @forge/cli-shared@8.5.0-next.7
|
|
13
|
+
- @forge/lint@5.11.0-next.7
|
|
14
|
+
|
|
3
15
|
## 6.1.4-next.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/out/metadata.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Logger } from '@forge/cli-shared';
|
|
2
2
|
import { BundlerMetadata } from './types';
|
|
3
|
-
export declare function getMetadata(logger: Logger, files: string[]): Promise<BundlerMetadata>;
|
|
3
|
+
export declare function getMetadata(logger: Logger, appDirectory: string, files: string[]): Promise<BundlerMetadata>;
|
|
4
4
|
//# sourceMappingURL=metadata.d.ts.map
|
package/out/metadata.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AA6KzD,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAGjH"}
|
package/out/metadata.js
CHANGED
|
@@ -10,18 +10,21 @@ const text_1 = require("./text");
|
|
|
10
10
|
const types_1 = require("./types");
|
|
11
11
|
class MetadataCollector {
|
|
12
12
|
logger;
|
|
13
|
+
appDirectory;
|
|
13
14
|
metadata = (0, types_1.emptyMetadata)();
|
|
14
|
-
constructor(logger) {
|
|
15
|
+
constructor(logger, appDirectory) {
|
|
15
16
|
this.logger = logger;
|
|
17
|
+
this.appDirectory = appDirectory;
|
|
16
18
|
}
|
|
17
19
|
async processPackageJson() {
|
|
20
|
+
const packageJsonFile = path_1.default.join(this.appDirectory, 'package.json');
|
|
18
21
|
try {
|
|
19
|
-
await (0, promises_1.access)(
|
|
22
|
+
await (0, promises_1.access)(packageJsonFile);
|
|
20
23
|
}
|
|
21
24
|
catch {
|
|
22
25
|
return undefined;
|
|
23
26
|
}
|
|
24
|
-
const packageFile = await (0, promises_1.readFile)(
|
|
27
|
+
const packageFile = await (0, promises_1.readFile)(packageJsonFile, 'utf8');
|
|
25
28
|
const packageJson = JSON.parse(packageFile);
|
|
26
29
|
if (packageJson.type === 'module') {
|
|
27
30
|
this.metadata.esm = true;
|
|
@@ -41,6 +44,13 @@ class MetadataCollector {
|
|
|
41
44
|
return parts[0];
|
|
42
45
|
}
|
|
43
46
|
async processSourceFile(filePath) {
|
|
47
|
+
if (filePath.split('/').includes('node_modules')) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const rel = path_1.default.relative(await (0, promises_1.realpath)(this.appDirectory), await (0, promises_1.realpath)(filePath));
|
|
51
|
+
if (rel.startsWith('..')) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
44
54
|
const ext = path_1.default.extname(filePath);
|
|
45
55
|
if (ext.match(/^\.[cm]?jsx?$/)) {
|
|
46
56
|
this.metadata.jsFiles++;
|
|
@@ -100,8 +110,8 @@ class MetadataCollector {
|
|
|
100
110
|
}
|
|
101
111
|
}
|
|
102
112
|
}
|
|
103
|
-
async function getMetadata(logger, files) {
|
|
104
|
-
const collector = new MetadataCollector(logger);
|
|
113
|
+
async function getMetadata(logger, appDirectory, files) {
|
|
114
|
+
const collector = new MetadataCollector(logger, appDirectory);
|
|
105
115
|
return collector.collect({ files });
|
|
106
116
|
}
|
|
107
117
|
exports.getMetadata = getMetadata;
|
package/out/runtime.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ConfigReader, Logger } from '@forge/cli-shared';
|
|
1
|
+
import { ConfigReader, Logger, StatsigService } from '@forge/cli-shared';
|
|
2
2
|
import { Bundler } from './types';
|
|
3
3
|
import { WrapperProvider } from './wrapper-provider';
|
|
4
4
|
export declare const NODE_RUNTIME_CODE_FILE = "__forge__.cjs";
|
|
5
5
|
export declare function userCodePath(entryKey: string): string;
|
|
6
|
-
export declare function getNodeBundler(logger: Logger, wrapperProvider: WrapperProvider, configReader: ConfigReader): Bundler;
|
|
6
|
+
export declare function getNodeBundler(logger: Logger, wrapperProvider: WrapperProvider, configReader: ConfigReader, statsigService: StatsigService): Bundler;
|
|
7
7
|
//# 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":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EAEZ,MAAM,EAEN,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,OAAO,EAAkF,MAAM,SAAS,CAAC;AAGlH,OAAO,EAAiB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAMpE,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AAoBtD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AA6JD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,GAC7B,OAAO,CAET"}
|
package/out/runtime.js
CHANGED
|
@@ -7,10 +7,11 @@ const promises_1 = tslib_1.__importDefault(require("fs/promises"));
|
|
|
7
7
|
const webpack_1 = tslib_1.__importDefault(require("webpack"));
|
|
8
8
|
var RawSource = webpack_1.default.sources.RawSource;
|
|
9
9
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
10
|
+
const i18n_1 = require("@forge/i18n");
|
|
10
11
|
const common_1 = require("./config/common");
|
|
11
12
|
const typescript_1 = require("./typescript");
|
|
12
13
|
const webpack_2 = require("./webpack");
|
|
13
|
-
const
|
|
14
|
+
const text_1 = require("./text");
|
|
14
15
|
exports.NODE_RUNTIME_CODE_FILE = '__forge__.cjs';
|
|
15
16
|
const NODE_RUNTIME_BACKUP_WRAPPER_FILE = '__forge_wrapper__.cjs';
|
|
16
17
|
const NODE_RUNTIME_USE_LOCAL_WRAPPER_FILE = '__forge_use_local_wrapper.txt';
|
|
@@ -96,16 +97,22 @@ class TypeScriptNodeBundler extends typescript_1.TypeScriptBundler {
|
|
|
96
97
|
}
|
|
97
98
|
class ConfigBundler {
|
|
98
99
|
configReader;
|
|
100
|
+
statsigService;
|
|
99
101
|
bundlers;
|
|
100
|
-
constructor(logger, wrapperProvider, configReader) {
|
|
102
|
+
constructor(logger, wrapperProvider, configReader, statsigService) {
|
|
101
103
|
this.configReader = configReader;
|
|
104
|
+
this.statsigService = statsigService;
|
|
102
105
|
this.bundlers = new Map([
|
|
103
106
|
['webpack', new NodeBundler(logger, wrapperProvider)],
|
|
104
107
|
['typescript', new TypeScriptNodeBundler(logger, wrapperProvider)]
|
|
105
108
|
]);
|
|
106
109
|
}
|
|
107
110
|
async getBundlerType() {
|
|
108
|
-
|
|
111
|
+
const configuredBundler = (await this.configReader.readConfig()).app.package?.bundler ?? 'webpack';
|
|
112
|
+
if (configuredBundler === 'typescript' && !(await this.statsigService.isTypescriptBundlerEnabled())) {
|
|
113
|
+
throw new cli_shared_1.UserError(text_1.Text.typescriptBundlerEAP);
|
|
114
|
+
}
|
|
115
|
+
return configuredBundler;
|
|
109
116
|
}
|
|
110
117
|
async getBundler() {
|
|
111
118
|
return this.bundlers.get(await this.getBundlerType());
|
|
@@ -117,7 +124,7 @@ class ConfigBundler {
|
|
|
117
124
|
return (await this.getBundler()).watch(args, watch);
|
|
118
125
|
}
|
|
119
126
|
}
|
|
120
|
-
function getNodeBundler(logger, wrapperProvider, configReader) {
|
|
121
|
-
return new ConfigBundler(logger, wrapperProvider, configReader);
|
|
127
|
+
function getNodeBundler(logger, wrapperProvider, configReader, statsigService) {
|
|
128
|
+
return new ConfigBundler(logger, wrapperProvider, configReader, statsigService);
|
|
122
129
|
}
|
|
123
130
|
exports.getNodeBundler = getNodeBundler;
|
package/out/text.d.ts
CHANGED
package/out/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;mCACgB,MAAM,EAAE;8BACb,MAAM,EAAE;;4BAKV,KAAK;;CAE9B,CAAC"}
|
package/out/text.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Text = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
4
5
|
exports.Text = {
|
|
5
6
|
genericBundlingError: (errors) => `Bundling failed: ${errors.join(', ')}`,
|
|
6
7
|
typescriptError: (errors) => `TypeScript errors in the app caused the bundling to fail. Fix the errors listed below before rerunning the command. ${errors.join('\n')}`,
|
|
7
8
|
noExecutableFile: 'Could not find the main executable file',
|
|
8
|
-
metadataFailed: (error) => `Application code metadata processing failed: ${error.message}
|
|
9
|
+
metadataFailed: (error) => `Application code metadata processing failed: ${error.message}`,
|
|
10
|
+
typescriptBundlerEAP: `TypeScript bundler is a Forge EAP feature. Please see ${cli_shared_1.Text.go('dac/platform/forge/manifest-reference/#package')} for more details.`
|
|
9
11
|
};
|
package/out/typescript.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export declare abstract class TypeScriptBundler implements Bundler {
|
|
|
10
10
|
constructor(logger: Logger);
|
|
11
11
|
protected runTypeScript(args: BundlerArgs, outputDir: string): OutputProcess;
|
|
12
12
|
protected isListedFile(line: string): string | null;
|
|
13
|
-
protected isAppFile(line: string): string | null;
|
|
14
13
|
protected getResult(args: BundlerArgs, outputDir: string, output?: string): Promise<BundlerOutput>;
|
|
15
14
|
bundle(args: BundlerArgs): Promise<BundlerOutput>;
|
|
16
15
|
watch(args: BundlerWatchArgs, watch: BundlerWatch): Promise<BundlerWatchOutput>;
|
package/out/typescript.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["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E,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa;IAwB5E,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;cAWnC,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAiBlG,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IA6BjD,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA2DtF"}
|
package/out/typescript.js
CHANGED
|
@@ -48,26 +48,17 @@ class TypeScriptBundler {
|
|
|
48
48
|
}
|
|
49
49
|
return line;
|
|
50
50
|
}
|
|
51
|
-
isAppFile(line) {
|
|
52
|
-
if (!this.isListedFile(line)) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
if (line.includes('node_modules/')) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
return line;
|
|
59
|
-
}
|
|
60
51
|
async getResult(args, outputDir, output) {
|
|
61
52
|
let metadata;
|
|
62
53
|
if (output) {
|
|
63
54
|
const files = [];
|
|
64
55
|
for (const line of output.split('\n')) {
|
|
65
|
-
const filePath = this.
|
|
56
|
+
const filePath = this.isListedFile(line);
|
|
66
57
|
if (filePath) {
|
|
67
58
|
files.push(filePath);
|
|
68
59
|
}
|
|
69
60
|
}
|
|
70
|
-
metadata = await (0, metadata_1.getMetadata)(this.logger, files);
|
|
61
|
+
metadata = await (0, metadata_1.getMetadata)(this.logger, args.appDirectory, files);
|
|
71
62
|
}
|
|
72
63
|
else {
|
|
73
64
|
metadata = (0, types_1.emptyMetadata)();
|
package/out/webpack.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export declare type ConfigWithOutput = webpack.Configuration & {
|
|
|
10
10
|
export declare abstract class WebpackBundler implements Bundler {
|
|
11
11
|
protected readonly logger: Logger;
|
|
12
12
|
constructor(logger: Logger);
|
|
13
|
-
protected getOutput(config: ConfigWithOutput, stats: webpack.Stats): Promise<BundlerOutput>;
|
|
14
|
-
protected
|
|
13
|
+
protected getOutput(args: BundlerArgs, config: ConfigWithOutput, stats: webpack.Stats): Promise<BundlerOutput>;
|
|
14
|
+
protected isRegularModule(name: string): boolean;
|
|
15
15
|
protected localModules(stats: webpack.Stats): string[];
|
|
16
|
-
protected runCompiler(config: ConfigWithOutput): Promise<BundlerOutput>;
|
|
16
|
+
protected runCompiler(args: BundlerArgs, config: ConfigWithOutput): Promise<BundlerOutput>;
|
|
17
17
|
abstract getConfig(args: BundlerArgs): Promise<ConfigWithOutput>;
|
|
18
18
|
bundle(args: BundlerArgs): Promise<BundlerOutput>;
|
|
19
19
|
watch(args: BundlerWatchArgs, watch: BundlerWatch): Promise<BundlerWatchOutput>;
|
package/out/webpack.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,EAA4B,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EACL,OAAO,EAEP,aAAa,EACb,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,EACd,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,MA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Ad,MAAM,EAAE,MAAM;cAE7B,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC;IAkBpH,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAsBhD,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,EAAE;cA0BtC,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAsBhG,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
|
@@ -62,18 +62,15 @@ class WebpackBundler {
|
|
|
62
62
|
constructor(logger) {
|
|
63
63
|
this.logger = logger;
|
|
64
64
|
}
|
|
65
|
-
async getOutput(config, stats) {
|
|
65
|
+
async getOutput(args, config, stats) {
|
|
66
66
|
const outputDir = config.output.path;
|
|
67
|
-
const metadata = await (0, metadata_1.getMetadata)(this.logger, this.localModules(stats));
|
|
67
|
+
const metadata = await (0, metadata_1.getMetadata)(this.logger, args.appDirectory, this.localModules(stats));
|
|
68
68
|
if (stats) {
|
|
69
69
|
metadata.modules = getNodeModuleNames(stats);
|
|
70
70
|
}
|
|
71
71
|
return { outputDir, metadata };
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
if (name.match(/\/node_modules\/(.+)$/)) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
73
|
+
isRegularModule(name) {
|
|
77
74
|
if (name.match(/^external "(?:node:)?([^:"]+)"$/)) {
|
|
78
75
|
return false;
|
|
79
76
|
}
|
|
@@ -99,7 +96,7 @@ class WebpackBundler {
|
|
|
99
96
|
else if (!module.name) {
|
|
100
97
|
throw new Error('Module name is missing');
|
|
101
98
|
}
|
|
102
|
-
else if (this.
|
|
99
|
+
else if (this.isRegularModule(module.name)) {
|
|
103
100
|
result.push(module.name);
|
|
104
101
|
}
|
|
105
102
|
}
|
|
@@ -109,7 +106,7 @@ class WebpackBundler {
|
|
|
109
106
|
}
|
|
110
107
|
return result;
|
|
111
108
|
}
|
|
112
|
-
async runCompiler(config) {
|
|
109
|
+
async runCompiler(args, config) {
|
|
113
110
|
const compiler = getCompiler(config);
|
|
114
111
|
return new Promise((resolve, reject) => {
|
|
115
112
|
compiler.run(async (compilerError, stats) => {
|
|
@@ -120,7 +117,7 @@ class WebpackBundler {
|
|
|
120
117
|
reject(closeError);
|
|
121
118
|
}
|
|
122
119
|
});
|
|
123
|
-
resolve(await this.getOutput(config, stats));
|
|
120
|
+
resolve(await this.getOutput(args, config, stats));
|
|
124
121
|
}
|
|
125
122
|
catch (err) {
|
|
126
123
|
reject(err);
|
|
@@ -130,7 +127,7 @@ class WebpackBundler {
|
|
|
130
127
|
}
|
|
131
128
|
async bundle(args) {
|
|
132
129
|
const config = await this.getConfig(args);
|
|
133
|
-
return await this.runCompiler(config);
|
|
130
|
+
return await this.runCompiler(args, config);
|
|
134
131
|
}
|
|
135
132
|
async watch(args, watch) {
|
|
136
133
|
const config = await this.getConfig(args);
|
|
@@ -147,7 +144,7 @@ class WebpackBundler {
|
|
|
147
144
|
try {
|
|
148
145
|
handleWebpackCompilationResult(this.logger, compilerError, stats);
|
|
149
146
|
this.logger.info(cli_shared_1.LogColor.trace(args.successMessage));
|
|
150
|
-
const result = await this.getOutput(config, stats);
|
|
147
|
+
const result = await this.getOutput(args, config, stats);
|
|
151
148
|
if (isFirstRun) {
|
|
152
149
|
isFirstRun = false;
|
|
153
150
|
resolve({ result, stop: () => watching.close(() => void 0) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/bundler",
|
|
3
|
-
"version": "6.1.4-next.
|
|
3
|
+
"version": "6.1.4-next.8",
|
|
4
4
|
"description": "Default bundler for Forge apps",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Atlassian",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"@babel/plugin-transform-react-jsx": "^7.23.4",
|
|
22
22
|
"@babel/traverse": "^7.24.0",
|
|
23
23
|
"@babel/types": "^7.24.0",
|
|
24
|
-
"@forge/cli-shared": "8.5.0-next.
|
|
24
|
+
"@forge/cli-shared": "8.5.0-next.7",
|
|
25
25
|
"@forge/i18n": "0.0.7",
|
|
26
|
-
"@forge/lint": "5.11.0-next.
|
|
26
|
+
"@forge/lint": "5.11.0-next.7",
|
|
27
27
|
"@forge/manifest": "10.4.0-next.3",
|
|
28
28
|
"babel-loader": "^8.3.0",
|
|
29
29
|
"cheerio": "^1.1.0",
|