@forge/bundler 6.1.4 → 6.1.5-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,19 @@
1
1
  # @forge/bundler
2
2
 
3
+ ## 6.1.5-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fb25473: Fix edge cases in metadata collection
8
+
9
+ ## 6.1.5-next.0
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [e0b9806]
14
+ - @forge/cli-shared@8.5.1-next.0
15
+ - @forge/lint@5.11.1-next.0
16
+
3
17
  ## 6.1.4
4
18
 
5
19
  ### 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, appDirectory: string, files: string[]): Promise<BundlerMetadata>;
3
+ export declare function getMetadata(logger: Logger, appDirectory: string, files: Set<string>): Promise<BundlerMetadata>;
4
4
  //# sourceMappingURL=metadata.d.ts.map
@@ -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;AA6KzD,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAGjH"}
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,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAGpH"}
package/out/metadata.js CHANGED
@@ -58,7 +58,7 @@ class MetadataCollector {
58
58
  else if (ext.match(/^\.[cm]?tsx?$/)) {
59
59
  this.metadata.tsFiles++;
60
60
  }
61
- else if (ext === '.json') {
61
+ else {
62
62
  return;
63
63
  }
64
64
  const source = await (0, promises_1.readFile)(filePath, 'utf8');
@@ -97,7 +97,7 @@ class MetadataCollector {
97
97
  }
98
98
  async collect({ files }) {
99
99
  await this.warnIfFailed(() => this.processPackageJson());
100
- await Promise.all(files.map((filePath) => this.warnIfFailed(() => this.processSourceFile(filePath))));
100
+ await Promise.all(Array.from(files, (filePath) => this.warnIfFailed(() => this.processSourceFile(filePath))));
101
101
  return this.metadata;
102
102
  }
103
103
  async warnIfFailed(action) {
package/out/typescript.js CHANGED
@@ -51,11 +51,11 @@ class TypeScriptBundler {
51
51
  async getResult(args, outputDir, output) {
52
52
  let metadata;
53
53
  if (output) {
54
- const files = [];
54
+ const files = new Set();
55
55
  for (const line of output.split('\n')) {
56
56
  const filePath = this.isListedFile(line);
57
57
  if (filePath) {
58
- files.push(filePath);
58
+ files.add(filePath);
59
59
  }
60
60
  }
61
61
  metadata = await (0, metadata_1.getMetadata)(this.logger, args.appDirectory, files);
package/out/webpack.d.ts CHANGED
@@ -12,7 +12,7 @@ export declare abstract class WebpackBundler implements Bundler {
12
12
  constructor(logger: Logger);
13
13
  protected getOutput(args: BundlerArgs, config: ConfigWithOutput, stats: webpack.Stats): Promise<BundlerOutput>;
14
14
  protected isRegularModule(name: string): boolean;
15
- protected localModules(stats: webpack.Stats): string[];
15
+ protected localModules(stats: webpack.Stats): Set<string>;
16
16
  protected runCompiler(args: BundlerArgs, config: ConfigWithOutput): Promise<BundlerOutput>;
17
17
  abstract getConfig(args: BundlerArgs): Promise<ConfigWithOutput>;
18
18
  bundle(args: BundlerArgs): Promise<Bundl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,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC;IAkBpH,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAmBhD,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;cAwBzC,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
@@ -77,27 +77,21 @@ class WebpackBundler {
77
77
  if (name.startsWith('webpack/runtime/')) {
78
78
  return false;
79
79
  }
80
- if (path_1.default.extname(name) === '.json') {
81
- return false;
82
- }
83
80
  if (!path_1.default.extname(name).match(/^\.[cm]?[jt]sx?$/)) {
84
- throw new Error(`Unknown module type for ${JSON.stringify(name)}.`);
81
+ return false;
85
82
  }
86
83
  return true;
87
84
  }
88
85
  localModules(stats) {
89
86
  const { modules } = stats.toJson({ modules: true });
90
- const result = [];
87
+ const result = new Set();
91
88
  const addModules = (modules) => {
92
89
  for (const module of modules) {
93
90
  if (module.modules) {
94
91
  addModules(module.modules);
95
92
  }
96
- else if (!module.name) {
97
- throw new Error('Module name is missing');
98
- }
99
- else if (this.isRegularModule(module.name)) {
100
- result.push(module.name);
93
+ else if (module.name && this.isRegularModule(module.name)) {
94
+ result.add(module.name);
101
95
  }
102
96
  }
103
97
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bundler",
3
- "version": "6.1.4",
3
+ "version": "6.1.5-next.1",
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",
24
+ "@forge/cli-shared": "8.5.1-next.0",
25
25
  "@forge/i18n": "0.0.7",
26
- "@forge/lint": "5.11.0",
26
+ "@forge/lint": "5.11.1-next.0",
27
27
  "@forge/manifest": "10.4.0",
28
28
  "babel-loader": "^8.3.0",
29
29
  "cheerio": "^1.1.0",