@atlaspack/reporter-bundle-analyzer 2.12.1-canary.3354

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright (c) 2024 Atlassian US., Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,112 @@
1
+ /* eslint-env browser */
2
+ /* global CarrotSearchFoamTree */
3
+
4
+ let bundleData = JSON.parse(document.getElementById('bundle-data').innerText);
5
+
6
+ let visualization = document.createElement('div');
7
+ visualization.style.height = '100vh';
8
+ visualization.style.width = '100vw';
9
+ document.body.appendChild(visualization);
10
+
11
+ let tooltip;
12
+
13
+ // Foam Tree docs:
14
+ // https://get.carrotsearch.com/foamtree/demo/api/index.html
15
+ // Some options from Atlaspack 1 Visualizer:
16
+ // https://github.com/gregtillbrook/parcel-plugin-bundle-visualiser/blob/ca5440fc61c85e40e7abc220ad99e274c7c104c6/src/buildReportAssets/init.js#L4
17
+ // and Webpack Bundle Analyzer:
18
+ // https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/4a232f0cf7bbfed907a5c554879edd5d6f4b48ce/client/components/Treemap.jsx
19
+ let foamtree = new CarrotSearchFoamTree({
20
+ element: visualization,
21
+ dataObject: bundleData,
22
+ layout: 'squarified',
23
+ stacking: 'flattened',
24
+ pixelRatio: window.devicePixelRatio || 1,
25
+ maxGroups: Infinity,
26
+ maxGroupLevelsDrawn: Infinity,
27
+ maxGroupLabelLevelsDrawn: Infinity,
28
+ maxGroupLevelsAttached: Infinity,
29
+ rolloutDuration: 0,
30
+ pullbackDuration: 0,
31
+ maxLabelSizeForTitleBar: 0, // disable the title bar
32
+ onGroupHover(e) {
33
+ if (e.group.label == null || e.group.weight == null) {
34
+ if (tooltip != null) {
35
+ tooltip.remove();
36
+ tooltip = null;
37
+ }
38
+ return;
39
+ }
40
+
41
+ if (tooltip == null) {
42
+ tooltip = document.createElement('div');
43
+ tooltip.classList.add('tooltip');
44
+ document.body.appendChild(tooltip);
45
+ }
46
+
47
+ tooltip.style.transform = translate3d(e.xAbsolute, e.yAbsolute, 0);
48
+ tooltip.innerHTML = `
49
+ <div class="tooltip-content">
50
+ <div>
51
+ <span class="tooltip-title">${e.group.label}</span>
52
+ </div>
53
+ <dl>
54
+ <div>
55
+ <dt>Size</dt>
56
+ <dd>${formatSize(e.group.weight)}</dd>
57
+ </div>
58
+ </dl>
59
+ </div>
60
+ `;
61
+ },
62
+ onGroupClick(e) {
63
+ this.zoom(e.group);
64
+ },
65
+ });
66
+
67
+ visualization.addEventListener('mousemove', e => {
68
+ if (tooltip == null) {
69
+ return;
70
+ }
71
+
72
+ tooltip.style.transform = translate3d(
73
+ visualization.clientLeft + e.clientX,
74
+ visualization.clientTop + e.clientY,
75
+ 0,
76
+ );
77
+ });
78
+
79
+ window.addEventListener(
80
+ 'resize',
81
+ debounce(() => {
82
+ foamtree.resize();
83
+ }, 100),
84
+ );
85
+
86
+ function debounce(fn, delay) {
87
+ let timeout;
88
+
89
+ return function (...args) {
90
+ if (timeout) {
91
+ clearTimeout(timeout);
92
+ }
93
+
94
+ timeout = setTimeout(() => {
95
+ fn(...args);
96
+ }, delay);
97
+ };
98
+ }
99
+
100
+ function translate3d(x, y, z) {
101
+ return `translate3d(${x}px, ${y}px, ${z}px)`;
102
+ }
103
+
104
+ const UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
105
+ function formatSize(x) {
106
+ let l = 0,
107
+ n = parseInt(x, 10) || 0;
108
+ while (n >= 1000 && ++l) {
109
+ n /= 1000;
110
+ }
111
+ return `${n.toFixed(l > 0 ? 2 : 0)} ${UNITS[l]}`;
112
+ }
@@ -0,0 +1,208 @@
1
+ Carrot Search FoamTree License Agreement
2
+
3
+ By downloading, installing, copying, saving on your computer, or otherwise
4
+ using this software, you (Licensee, as defined below) are becoming a party to
5
+ this Agreement and you are consenting to be bound by all the terms and
6
+ conditions of this Agreement. If you do not agree to the terms and conditions
7
+ of this Agreement, you should not download, install or use the software.
8
+
9
+ If there is a separate agreement in force between Carrot Search and the
10
+ Licensee, Licensee will not be bound by this Agreement.
11
+
12
+ Upon your acceptance of this Agreement, Carrot Search grants to you a
13
+ non-exclusive and non-transferable license to use FoamTree, provided that you
14
+ agree to the following:
15
+
16
+
17
+ 1. Parties
18
+
19
+ a. Carrot Search means Carrot Search s.c., located at Boznicza 11/57, 61-751
20
+ Poznan, Poland.
21
+
22
+ b. Licensee means the individual or legal entity specified in the License File
23
+ defined below.
24
+
25
+
26
+ 2. Definitions
27
+
28
+ a. FoamTree means a software system for visualizing hierarchical data
29
+ structures. FoamTree is distributed in a binary form along with documentation.
30
+
31
+ b. Integration Code means the source code provided by Carrot Search to Licensee
32
+ to facilitate integration of FoamTree with the software developed by Licensee.
33
+
34
+ c. License File means electronic evidence and specification of the license
35
+ granted to the Licensee by Carrot Search. Only Carrot Search is permitted to
36
+ produce License Files for FoamTree.
37
+
38
+ d. Licensing Period means the perpetual or limited period in which Licensee can
39
+ use FoamTree. Licensing Period is specified in the License File.
40
+
41
+ e. Maintenance Period means the limited period in which Licensee is entitled to
42
+ upgrade to new versions of FoamTree and receive support. Maintenance Period is
43
+ specified in the License File.
44
+
45
+ f. Server means a computer controlled by Licensee which serves FoamTree for the
46
+ purposes of delivering services to end users. Identification of the Server in
47
+ the License File may vary based on the characteristics of Licensee's software
48
+ that uses FoamTree.
49
+
50
+
51
+ 3. Ownership
52
+
53
+ a. FoamTree is the property of Carrot Search. FoamTree is licensed, not sold.
54
+ Title and copyrights to FoamTree, in whole or in part, and all copies thereof,
55
+ and all modifications, enhancements, derivatives and other alterations of
56
+ FoamTree, regardless of who made them, if any, are, and will remain, the sole
57
+ and exclusive property of Carrot Search.
58
+
59
+ b. The structure, organization, and code embodied in FoamTree, except for
60
+ Integration Code, are valuable and confidential trade secrets of Carrot Search
61
+ and are protected by copyright laws, intellectual property laws and treaties.
62
+ Licensee agrees to abide by the copyright law and all other applicable laws.
63
+
64
+
65
+ 4. Grant of license
66
+
67
+ Subject to the terms, conditions, and limitations set forth in this Agreement,
68
+ Carrot Search hereby grants to Licensee a worldwide, limited, non-exclusive,
69
+ non-transferable license to use FoamTree as follows:
70
+
71
+ a. Licensee may:
72
+
73
+ i. serve FoamTree from the Server or Servers identified in the License File
74
+ for the purposes of delivering services to end users during the Licensing
75
+ Period;
76
+
77
+ ii. use FoamTree on computers controlled by Licensee for the purposes of
78
+ development of Licensee's software dependent on FoamTree during the Licensing
79
+ Period;
80
+
81
+ iii. upgrade to any version of FoamTree released during the Maintenance
82
+ Period;
83
+
84
+ iv. include Integration Code, in entirety or in parts, in the software
85
+ developed by Licensee;
86
+
87
+ v. make back-up copies of FoamTree and License File solely for archival
88
+ purposes;
89
+
90
+ vi. use the Limited Version of FoamTree, as described in Section 5, without
91
+ purchasing a License File.
92
+
93
+
94
+ b. Licensee may not:
95
+
96
+ i. sell, redistribute, encumber, give, lend, rent, lease, sublicense, or
97
+ otherwise transfer FoamTree, or any portions of FoamTree, to anyone without
98
+ the prior written consent of Carrot Search;
99
+
100
+ ii. reverse engineer, decompile, disassemble, modify, translate, make any
101
+ attempt to discover the source code of FoamTree, or create derivative works
102
+ from FoamTree;
103
+
104
+ iii. allow the use of FoamTree on Servers not identified in the License File;
105
+
106
+ iv. disable, remove or circumvent the feature limitation mechanisms built
107
+ into the Limited Version of FoamTree. Any attempt to do so will be in
108
+ violation of this Agreement and will terminate Licensee's rights to use
109
+ FoamTree.
110
+
111
+
112
+ c. Carrot Search will:
113
+
114
+ i. promptly, and in any event within 72 hours, respond to e-mail requests
115
+ for support that are made during mutually agreed upon business hours, taking
116
+ into account time zone differences, except weekends and holidays;
117
+
118
+ ii. notify Licensee of and provide any bug fix and new releases of FoamTree;
119
+
120
+ iii. provide a number of free consulting hours, specified in the License
121
+ File, for integration code adjustments, performance tuning and extra
122
+ documentation. Any additional technical support shall be charged at standard
123
+ Carrot Search hourly rate.
124
+
125
+
126
+ 5. Use of the Limited Version
127
+
128
+ a. Subject to the terms of this Agreement, Licensee is granted a right to use
129
+ the Limited Version of FoamTree without charge;
130
+
131
+
132
+ 6. Disclaimer of warranty
133
+
134
+ FoamTree is provided on an "as is" without warranties of any kind, express,
135
+ implied or statutory, including but not limited to, the implied warranties of
136
+ title, noninfringement, merchantability and fitness for a particular purpose.
137
+
138
+
139
+ 7. Disclaimer of damages
140
+
141
+ a. Regardless of whether any remedy set forth herein fails of its essential
142
+ purpose, in no event will Carrot Search be liable to Licensee under any theory
143
+ for any damages suffered by Licensee or any user of FoamTree, or for any
144
+ special, incidental, indirect, consequential, or similar damages (including
145
+ without limitation, damages for loss of business profits, business
146
+ interruption, loss of business information, or any other pecuniary loss)
147
+ arising out of the use or inability to use FoamTree, or the provision of or
148
+ failure to provide support services, even if Carrot Search has been advised of
149
+ the possibility of such damages, and regardless of the legal or equitable
150
+ theory (contract, tort or otherwise) upon which the claim is based;
151
+
152
+ b. In any case, Carrot Search's entire liability under any provision of this
153
+ agreement will be limited to the amount actually paid by licensee for FoamTree.
154
+
155
+
156
+ 8. Term and Termination
157
+
158
+ This Agreement takes effect upon Licensee's acceptance of the terms of this
159
+ Agreement and remains effective until terminated by either party in accordance
160
+ with this Agreement. Licensee may terminate this Agreement at any time by
161
+ destroying all copies of FoamTree. This Agreement will automatically terminate
162
+ if Licensee fails to comply with any term or condition of this Agreement. Upon
163
+ termination of this Agreement, Licensee warrants that they will immediately
164
+ destroy all copies of FoamTree.
165
+
166
+
167
+ 9. General
168
+
169
+ a. Unless the Licensee explicitly opts out by notifying the Carrot Search, the
170
+ Licensee agrees to be identified as a customer of Carrot Search and that Carrot
171
+ Search may refer to Licensee by name, trade name and trademark on Carrot Search
172
+ web site and marketing materials;
173
+
174
+ b. Carrot Search reserves the right at any time to cease the support of FoamTree
175
+ and to alter prices, features, specifications, capabilities, functions,
176
+ licensing terms, release dates, general availability or other characteristics
177
+ of FoamTree;
178
+
179
+ c. This Agreement, including Third Party Software license agreements,
180
+ constitutes the entire agreement between the parties concerning Licensee' use
181
+ of the Software, and supersedes any and all prior or contemporaneous oral or
182
+ written representations, communications, or advertising with respect to the
183
+ Software. No purchase order, other ordering document or any hand written or
184
+ typewritten text which purports to modify or supplement the printed text of
185
+ this Agreement or any schedule will add to or vary the terms of this Agreement
186
+ unless signed by both Licensee and Carrot Search.
187
+
188
+ d. A waiver by either party of any term or condition of this Agreement or any
189
+ breach thereof, in any one instance, will not waive such term or condition or
190
+ any subsequent breach. The provisions of this Agreement which require or
191
+ contemplate performance after the expiration or termination of this Agreement
192
+ will be enforceable notwithstanding said expiration or termination.
193
+
194
+ e. This Agreement will be construed under the laws of the Polish trade and
195
+ European Union, without regard to conflicts of laws provisions thereof. This
196
+ Agreement and the performance of all obligations hereunder shall be governed
197
+ according to Polish Law and the parties hereto hereby submit to the
198
+ jurisdiction of the Polish Courts. All civil suits between the parties hereto
199
+ shall be adjudicated by a common court with official residence in Poznan,
200
+ Poland.
201
+
202
+ f. Titles are inserted for convenience only and will not affect in any way the
203
+ meaning or interpretation of this Agreement. If any provision of this Agreement
204
+ is held invalid, the remainder of this Agreement will continue in full force
205
+ and effect. Either Licensor or Licensee may assign this Agreement in the case
206
+ of a merger or sale of substantially all of its respective assets to another
207
+ entity. This Agreement will be binding upon and will inure to the benefit of
208
+ the parties, their successors and assigns.