@atlaspack/reporter-bundle-analyzer 2.14.5-canary.16 → 2.14.5-canary.161

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,159 @@
1
1
  # @atlaspack/reporter-bundle-analyzer
2
2
 
3
+ ## 2.14.25
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/utils@2.18.2
9
+ - @atlaspack/plugin@2.14.25
10
+
11
+ ## 2.14.24
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies []:
16
+ - @atlaspack/utils@2.18.1
17
+ - @atlaspack/plugin@2.14.24
18
+
19
+ ## 2.14.23
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
24
+ - @atlaspack/utils@2.18.0
25
+ - @atlaspack/plugin@2.14.23
26
+
27
+ ## 2.14.22
28
+
29
+ ### Patch Changes
30
+
31
+ - [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
32
+
33
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
34
+ - @atlaspack/plugin@2.14.22
35
+ - @atlaspack/utils@2.17.4
36
+
37
+ ## 2.14.21
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies []:
42
+ - @atlaspack/utils@2.17.3
43
+ - @atlaspack/plugin@2.14.21
44
+
45
+ ## 2.14.20
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa)]:
50
+ - @atlaspack/plugin@2.14.20
51
+ - @atlaspack/utils@2.17.2
52
+
53
+ ## 2.14.19
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies []:
58
+ - @atlaspack/utils@2.17.1
59
+ - @atlaspack/plugin@2.14.19
60
+
61
+ ## 2.14.18
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
66
+ - @atlaspack/utils@2.17.0
67
+ - @atlaspack/plugin@2.14.18
68
+
69
+ ## 2.14.17
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies []:
74
+ - @atlaspack/utils@2.16.1
75
+ - @atlaspack/plugin@2.14.17
76
+
77
+ ## 2.14.16
78
+
79
+ ### Patch Changes
80
+
81
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
82
+ - @atlaspack/utils@2.16.0
83
+ - @atlaspack/plugin@2.14.16
84
+
85
+ ## 2.14.15
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies []:
90
+ - @atlaspack/utils@2.15.3
91
+ - @atlaspack/plugin@2.14.15
92
+
93
+ ## 2.14.14
94
+
95
+ ### Patch Changes
96
+
97
+ - Updated dependencies []:
98
+ - @atlaspack/utils@2.15.2
99
+ - @atlaspack/plugin@2.14.14
100
+
101
+ ## 2.14.13
102
+
103
+ ### Patch Changes
104
+
105
+ - Updated dependencies []:
106
+ - @atlaspack/utils@2.15.1
107
+ - @atlaspack/plugin@2.14.13
108
+
109
+ ## 2.14.12
110
+
111
+ ### Patch Changes
112
+
113
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
114
+ - @atlaspack/utils@2.15.0
115
+ - @atlaspack/plugin@2.14.12
116
+
117
+ ## 2.14.11
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies []:
122
+ - @atlaspack/utils@2.14.11
123
+ - @atlaspack/plugin@2.14.11
124
+
125
+ ## 2.14.10
126
+
127
+ ### Patch Changes
128
+
129
+ - Updated dependencies []:
130
+ - @atlaspack/plugin@2.14.10
131
+ - @atlaspack/utils@2.14.10
132
+
133
+ ## 2.14.9
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies []:
138
+ - @atlaspack/utils@2.14.9
139
+ - @atlaspack/plugin@2.14.9
140
+
141
+ ## 2.14.8
142
+
143
+ ### Patch Changes
144
+
145
+ - Updated dependencies []:
146
+ - @atlaspack/utils@2.14.8
147
+ - @atlaspack/plugin@2.14.8
148
+
149
+ ## 2.14.7
150
+
151
+ ### Patch Changes
152
+
153
+ - Updated dependencies []:
154
+ - @atlaspack/utils@2.14.7
155
+ - @atlaspack/plugin@2.14.7
156
+
3
157
  ## 2.14.6
4
158
 
5
159
  ### Patch Changes
@@ -1,3 +1 @@
1
- // @flow strict-local
2
-
3
1
  export * from './src/BundleAnalyzerReporter';
@@ -123,6 +123,7 @@ async function getBundleNode(bundle, options) {
123
123
  let map = dirMap;
124
124
  for (let dir of dirs) {
125
125
  (0, _assert().default)(map instanceof _utils().DefaultMap);
126
+ // @ts-expect-error TS2322
126
127
  map = map.get(dir);
127
128
  }
128
129
  (0, _assert().default)(map instanceof _utils().DefaultMap);
@@ -0,0 +1,3 @@
1
+ import { Reporter } from '@atlaspack/plugin';
2
+ declare const _default: Reporter;
3
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/reporter-bundle-analyzer",
3
- "version": "2.14.5-canary.16+4b2b575b9",
3
+ "version": "2.14.5-canary.161+ee040bb64",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,19 +9,24 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/atlassian-labs/atlaspack.git"
11
11
  },
12
- "main": "lib/BundleAnalyzerReporter.js",
13
- "source": "src/BundleAnalyzerReporter.js",
12
+ "main": "./lib/BundleAnalyzerReporter.js",
13
+ "source": "./src/BundleAnalyzerReporter.ts",
14
+ "types": "./lib/types/BundleAnalyzerReporter.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 16.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/plugin": "2.14.5-canary.16+4b2b575b9",
19
- "@atlaspack/utils": "2.14.5-canary.16+4b2b575b9",
19
+ "@atlaspack/plugin": "2.14.5-canary.161+ee040bb64",
20
+ "@atlaspack/utils": "2.14.5-canary.161+ee040bb64",
20
21
  "nullthrows": "^1.1.1"
21
22
  },
22
23
  "devDependencies": {
23
- "@atlaspack/types": "2.14.5-canary.16+4b2b575b9"
24
+ "@atlaspack/types": "2.14.5-canary.161+ee040bb64"
24
25
  },
25
26
  "type": "commonjs",
26
- "gitHead": "4b2b575b98951f2dcf0c45ed8e94359b23b43815"
27
+ "scripts": {
28
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src",
29
+ "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
30
+ },
31
+ "gitHead": "ee040bb6428f29b57d892ddd8107e29077d08ffd"
27
32
  }
@@ -1,5 +1,3 @@
1
- // @flow strict-local
2
-
3
1
  import type {FilePath, PackagedBundle, PluginOptions} from '@atlaspack/types';
4
2
 
5
3
  import invariant from 'assert';
@@ -8,7 +6,7 @@ import {DefaultMap, generateBuildMetrics} from '@atlaspack/utils';
8
6
  import path from 'path';
9
7
  import nullthrows from 'nullthrows';
10
8
 
11
- export default (new Reporter({
9
+ export default new Reporter({
12
10
  async report({event, options}) {
13
11
  if (event.type !== 'buildSuccess') {
14
12
  return;
@@ -16,7 +14,7 @@ export default (new Reporter({
16
14
 
17
15
  let bundlesByTarget: DefaultMap<
18
16
  string /* target name */,
19
- Array<PackagedBundle>,
17
+ Array<PackagedBundle>
20
18
  > = new DefaultMap(() => []);
21
19
  for (let bundle of event.bundleGraph.getBundles()) {
22
20
  bundlesByTarget.get(bundle.target.name).push(bundle);
@@ -26,10 +24,11 @@ export default (new Reporter({
26
24
  await options.outputFS.mkdirp(reportsDir);
27
25
 
28
26
  await Promise.all(
29
- [...bundlesByTarget.entries()].map(async ([targetName, bundles]) => {
30
- return options.outputFS.writeFile(
31
- path.join(reportsDir, `${targetName}.html`),
32
- `
27
+ [...bundlesByTarget.entries()].map(
28
+ async ([targetName, bundles]: [any, any]) => {
29
+ return options.outputFS.writeFile(
30
+ path.join(reportsDir, `${targetName}.html`),
31
+ `
33
32
  <html>
34
33
  <head>
35
34
  <meta charset="utf-8">
@@ -84,15 +83,16 @@ export default (new Reporter({
84
83
  </body>
85
84
  </html>
86
85
  `,
87
- );
88
- }),
86
+ );
87
+ },
88
+ ),
89
89
  );
90
90
  },
91
- }): Reporter);
91
+ }) as Reporter;
92
92
 
93
- type BundleData = {|
94
- groups: Array<Group>,
95
- |};
93
+ type BundleData = {
94
+ groups: Array<Group>;
95
+ };
96
96
 
97
97
  async function getBundleData(
98
98
  bundles: Array<PackagedBundle>,
@@ -106,10 +106,10 @@ async function getBundleData(
106
106
  };
107
107
  }
108
108
 
109
- type File = {|
110
- basename: string,
111
- size: number,
112
- |};
109
+ type File = {
110
+ basename: string;
111
+ size: number;
112
+ };
113
113
  type DirMapValue = File | DirMap;
114
114
  type DirMap = DefaultMap<FilePath, DirMapValue>;
115
115
  let createMap: () => DirMap = () => new DefaultMap(() => createMap());
@@ -131,6 +131,7 @@ async function getBundleNode(bundle: PackagedBundle, options: PluginOptions) {
131
131
  let map = dirMap;
132
132
  for (let dir of dirs) {
133
133
  invariant(map instanceof DefaultMap);
134
+ // @ts-expect-error TS2322
134
135
  map = map.get(dir);
135
136
  }
136
137
 
@@ -148,14 +149,14 @@ async function getBundleNode(bundle: PackagedBundle, options: PluginOptions) {
148
149
  };
149
150
  }
150
151
 
151
- type Group = {|
152
- label: string,
153
- weight: number,
154
- groups?: Array<Group>,
155
- |};
152
+ type Group = {
153
+ label: string;
154
+ weight: number;
155
+ groups?: Array<Group>;
156
+ };
156
157
 
157
158
  function generateGroups(dirMap: DirMap): Array<Group> {
158
- let groups = [];
159
+ let groups: Array<Group> = [];
159
160
 
160
161
  for (let [directoryName, contents] of dirMap) {
161
162
  if (contents instanceof DefaultMap) {
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }