@atlaspack/utils 2.14.5-canary.20 → 2.14.5-canary.200

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.
Files changed (147) hide show
  1. package/CHANGELOG.md +255 -0
  2. package/benchmark.js +23 -0
  3. package/lib/DefaultMap.js +42 -0
  4. package/lib/Deferred.js +30 -0
  5. package/lib/PromiseQueue.js +112 -0
  6. package/lib/TapStream.js +34 -0
  7. package/lib/alternatives.js +116 -0
  8. package/lib/ansi-html.js +20 -0
  9. package/lib/blob.js +40 -0
  10. package/lib/bundle-url.js +34 -0
  11. package/lib/collection.js +111 -0
  12. package/lib/config.js +174 -0
  13. package/lib/countLines.js +15 -0
  14. package/lib/debounce.js +18 -0
  15. package/lib/debug-tools.js +38 -0
  16. package/lib/dependency-location.js +21 -0
  17. package/lib/escape-html.js +22 -0
  18. package/lib/generateBuildMetrics.js +121 -0
  19. package/lib/generateCertificate.js +129 -0
  20. package/lib/getCertificate.js +18 -0
  21. package/lib/getExisting.js +25 -0
  22. package/lib/getModuleParts.js +30 -0
  23. package/lib/getRootDir.js +52 -0
  24. package/lib/glob.js +118 -0
  25. package/lib/hash.js +50 -0
  26. package/lib/http-server.js +85 -0
  27. package/lib/index.js +635 -37310
  28. package/lib/is-url.js +24 -0
  29. package/lib/isDirectoryInside.js +18 -0
  30. package/lib/objectHash.js +26 -0
  31. package/lib/openInBrowser.js +74 -0
  32. package/lib/parseCSSImport.js +15 -0
  33. package/lib/path.js +39 -0
  34. package/lib/prettifyTime.js +9 -0
  35. package/lib/prettyDiagnostic.js +134 -0
  36. package/lib/progress-message.js +39 -0
  37. package/lib/relativeBundlePath.js +22 -0
  38. package/lib/relativeUrl.js +24 -0
  39. package/lib/replaceBundleReferences.js +199 -0
  40. package/lib/schema.js +355 -0
  41. package/lib/shared-buffer.js +31 -0
  42. package/lib/sourcemap.js +127 -0
  43. package/lib/stream.js +76 -0
  44. package/lib/throttle.js +15 -0
  45. package/lib/types/DefaultMap.d.ts +13 -0
  46. package/lib/types/Deferred.d.ts +8 -0
  47. package/lib/types/PromiseQueue.d.ts +25 -0
  48. package/lib/types/TapStream.d.ts +6 -0
  49. package/lib/types/alternatives.d.ts +3 -0
  50. package/lib/types/ansi-html.d.ts +1 -0
  51. package/lib/types/blob.d.ts +4 -0
  52. package/lib/types/bundle-url.d.ts +4 -0
  53. package/lib/types/collection.d.ts +33 -0
  54. package/lib/types/config.d.ts +17 -0
  55. package/lib/types/countLines.d.ts +1 -0
  56. package/lib/types/debounce.d.ts +1 -0
  57. package/lib/types/debug-tools.d.ts +7 -0
  58. package/lib/types/dependency-location.d.ts +14 -0
  59. package/lib/types/escape-html.d.ts +1 -0
  60. package/lib/types/generateBuildMetrics.d.ts +18 -0
  61. package/lib/types/generateCertificate.d.ts +5 -0
  62. package/lib/types/getCertificate.d.ts +5 -0
  63. package/lib/types/getExisting.d.ts +8 -0
  64. package/lib/types/getModuleParts.d.ts +4 -0
  65. package/lib/types/getRootDir.d.ts +2 -0
  66. package/lib/types/glob.d.ts +10 -0
  67. package/lib/types/hash.d.ts +7 -0
  68. package/lib/types/http-server.d.ts +19 -0
  69. package/lib/types/index.d.ts +48 -0
  70. package/lib/types/is-url.d.ts +1 -0
  71. package/lib/types/isDirectoryInside.d.ts +2 -0
  72. package/lib/types/objectHash.d.ts +3 -0
  73. package/lib/types/openInBrowser.d.ts +1 -0
  74. package/lib/types/parseCSSImport.d.ts +1 -0
  75. package/lib/types/path.d.ts +8 -0
  76. package/lib/types/prettifyTime.d.ts +1 -0
  77. package/lib/types/prettyDiagnostic.d.ts +17 -0
  78. package/lib/types/progress-message.d.ts +3 -0
  79. package/lib/types/relativeBundlePath.d.ts +4 -0
  80. package/lib/types/relativeUrl.d.ts +1 -0
  81. package/lib/types/replaceBundleReferences.d.ts +39 -0
  82. package/lib/types/schema.d.ts +107 -0
  83. package/lib/types/shared-buffer.d.ts +2 -0
  84. package/lib/types/sourcemap.d.ts +15 -0
  85. package/lib/types/stream.d.ts +8 -0
  86. package/lib/types/throttle.d.ts +1 -0
  87. package/lib/types/urlJoin.d.ts +5 -0
  88. package/lib/urlJoin.js +35 -0
  89. package/package.json +26 -17
  90. package/src/{DefaultMap.js → DefaultMap.ts} +8 -12
  91. package/src/Deferred.ts +26 -0
  92. package/src/{PromiseQueue.js → PromiseQueue.ts} +40 -35
  93. package/src/{TapStream.js → TapStream.ts} +8 -7
  94. package/src/{alternatives.js → alternatives.ts} +15 -16
  95. package/src/{ansi-html.js → ansi-html.ts} +1 -1
  96. package/src/{blob.js → blob.ts} +3 -5
  97. package/src/{bundle-url.js → bundle-url.ts} +3 -5
  98. package/src/{collection.js → collection.ts} +23 -20
  99. package/src/{config.js → config.ts} +20 -21
  100. package/src/{countLines.js → countLines.ts} +0 -2
  101. package/src/{debounce.js → debounce.ts} +3 -5
  102. package/src/debug-tools.ts +45 -0
  103. package/src/{dependency-location.js → dependency-location.ts} +15 -11
  104. package/src/{escape-html.js → escape-html.ts} +5 -3
  105. package/src/{generateBuildMetrics.js → generateBuildMetrics.ts} +18 -20
  106. package/src/{generateCertificate.js → generateCertificate.ts} +8 -6
  107. package/src/{getCertificate.js → getCertificate.ts} +6 -5
  108. package/src/{getExisting.js → getExisting.ts} +4 -3
  109. package/src/{getModuleParts.js → getModuleParts.ts} +3 -2
  110. package/src/{getRootDir.js → getRootDir.ts} +1 -3
  111. package/src/{glob.js → glob.ts} +16 -12
  112. package/src/{hash.js → hash.ts} +23 -18
  113. package/src/{http-server.js → http-server.ts} +34 -40
  114. package/src/{index.js → index.ts} +13 -9
  115. package/src/{is-url.js → is-url.ts} +1 -2
  116. package/src/{isDirectoryInside.js → isDirectoryInside.ts} +1 -2
  117. package/src/{objectHash.js → objectHash.ts} +1 -4
  118. package/src/{openInBrowser.js → openInBrowser.ts} +2 -4
  119. package/src/{parseCSSImport.js → parseCSSImport.ts} +0 -2
  120. package/src/{path.js → path.ts} +2 -4
  121. package/src/{prettifyTime.js → prettifyTime.ts} +0 -2
  122. package/src/{prettyDiagnostic.js → prettyDiagnostic.ts} +23 -21
  123. package/src/progress-message.ts +43 -0
  124. package/src/{relativeBundlePath.js → relativeBundlePath.ts} +4 -4
  125. package/src/{relativeUrl.js → relativeUrl.ts} +0 -1
  126. package/src/{replaceBundleReferences.js → replaceBundleReferences.ts} +63 -39
  127. package/src/{schema.js → schema.ts} +158 -141
  128. package/src/{shared-buffer.js → shared-buffer.ts} +5 -3
  129. package/src/{sourcemap.js → sourcemap.ts} +17 -8
  130. package/src/{stream.js → stream.ts} +30 -22
  131. package/src/throttle.ts +13 -0
  132. package/src/{urlJoin.js → urlJoin.ts} +1 -3
  133. package/test/{DefaultMap.test.js → DefaultMap.test.ts} +4 -6
  134. package/test/{PromiseQueue.test.js → PromiseQueue.test.ts} +5 -6
  135. package/test/{collection.test.js → collection.test.ts} +0 -2
  136. package/test/{config.test.js → config.test.ts} +0 -3
  137. package/test/{objectHash.test.js → objectHash.test.ts} +4 -5
  138. package/test/{prettifyTime.test.js → prettifyTime.test.ts} +0 -1
  139. package/test/{replaceBundleReferences.test.js → replaceBundleReferences.test.ts} +0 -32
  140. package/test/{sourcemap.test.js → sourcemap.test.ts} +0 -1
  141. package/test/{throttle.test.js → throttle.test.ts} +1 -3
  142. package/test/{urlJoin.test.js → urlJoin.test.ts} +0 -2
  143. package/tsconfig.json +4 -0
  144. package/lib/index.js.map +0 -1
  145. package/src/Deferred.js +0 -23
  146. package/src/progress-message.js +0 -22
  147. package/src/throttle.js +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,260 @@
1
1
  # @atlaspack/utils
2
2
 
3
+ ## 2.19.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#785](https://github.com/atlassian-labs/atlaspack/pull/785) [`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922) Thanks [@matt-koko](https://github.com/matt-koko)! - We need to re-publish every package in Atlaspack with the corrected types field.
8
+
9
+ - Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922), [`686a398`](https://github.com/atlassian-labs/atlaspack/commit/686a398faa1f9e19cbf9274add2c46e246bafba8)]:
10
+ - @atlaspack/codeframe@2.13.13
11
+ - @atlaspack/diagnostic@2.14.4
12
+ - @atlaspack/feature-flags@2.25.1
13
+ - @atlaspack/logger@2.14.23
14
+ - @atlaspack/markdown-ansi@2.14.4
15
+ - @atlaspack/rust@3.8.1
16
+ - @atlaspack/types-internal@2.20.1
17
+
18
+ ## 2.19.2
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`7a52bab`](https://github.com/atlassian-labs/atlaspack/commit/7a52bab6281e8edbfa66af248eb6f872c6b4b7bd), [`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1), [`5a0363f`](https://github.com/atlassian-labs/atlaspack/commit/5a0363f1086e81068959b87e92064bed5a11a9b4), [`038e87a`](https://github.com/atlassian-labs/atlaspack/commit/038e87a7858d39556d59d3a2d17db534d45f62c6), [`f6532d7`](https://github.com/atlassian-labs/atlaspack/commit/f6532d7a4f7f007bd4e5e36af04dd466f0b9f572), [`0684997`](https://github.com/atlassian-labs/atlaspack/commit/0684997c127a6204af1376b36e556fddd1ba5557), [`602f8ed`](https://github.com/atlassian-labs/atlaspack/commit/602f8ed9d8381301df8b2cc82c1d5cf6f2f94fec)]:
23
+ - @atlaspack/feature-flags@2.25.0
24
+ - @atlaspack/types-internal@2.20.0
25
+ - @atlaspack/rust@3.8.0
26
+ - @atlaspack/codeframe@2.13.12
27
+ - @atlaspack/logger@2.14.22
28
+
29
+ ## 2.19.1
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [[`830261d`](https://github.com/atlassian-labs/atlaspack/commit/830261dcf4a40293090b61cab52fd75d5683c73f), [`53dd47b`](https://github.com/atlassian-labs/atlaspack/commit/53dd47bd6d23cd47f87297347f03a609ab38a03d)]:
34
+ - @atlaspack/feature-flags@2.24.1
35
+ - @atlaspack/rust@3.7.0
36
+ - @atlaspack/types-internal@2.19.5
37
+ - @atlaspack/logger@2.14.21
38
+ - @atlaspack/codeframe@2.13.11
39
+
40
+ ## 2.19.0
41
+
42
+ ### Minor Changes
43
+
44
+ - [#753](https://github.com/atlassian-labs/atlaspack/pull/753) [`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add configurable async bundle merging and redundant shared bundle removal behind a feature flag.
45
+
46
+ ### Patch Changes
47
+
48
+ - Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767), [`a5081c3`](https://github.com/atlassian-labs/atlaspack/commit/a5081c3f9207d28716ee4edd3841de1830ea4b80), [`f930003`](https://github.com/atlassian-labs/atlaspack/commit/f930003364fdc31e5487520ebe256f1a9389f579), [`f930003`](https://github.com/atlassian-labs/atlaspack/commit/f930003364fdc31e5487520ebe256f1a9389f579), [`8843980`](https://github.com/atlassian-labs/atlaspack/commit/88439807be20025fd3433380204ff1205079729e)]:
49
+ - @atlaspack/feature-flags@2.24.0
50
+ - @atlaspack/types-internal@2.19.4
51
+ - @atlaspack/codeframe@2.13.10
52
+ - @atlaspack/logger@2.14.20
53
+
54
+ ## 2.18.4
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [[`3cfb7cf`](https://github.com/atlassian-labs/atlaspack/commit/3cfb7cfd90b78a5c48ce717e779ff789769825a3)]:
59
+ - @atlaspack/feature-flags@2.23.2
60
+ - @atlaspack/rust@3.6.2
61
+ - @atlaspack/types-internal@2.19.3
62
+ - @atlaspack/logger@2.14.19
63
+ - @atlaspack/codeframe@2.13.9
64
+
65
+ ## 2.18.3
66
+
67
+ ### Patch Changes
68
+
69
+ - [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
70
+
71
+ - [#754](https://github.com/atlassian-labs/atlaspack/pull/754) [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2) Thanks [@benjervis](https://github.com/benjervis)! - Adds padding to the progress reporting improvement lines so that the numbers appear right aligned
72
+
73
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd)]:
74
+ - @atlaspack/types-internal@2.19.2
75
+ - @atlaspack/feature-flags@2.23.1
76
+ - @atlaspack/markdown-ansi@2.14.3
77
+ - @atlaspack/diagnostic@2.14.3
78
+ - @atlaspack/codeframe@2.13.8
79
+ - @atlaspack/logger@2.14.18
80
+ - @atlaspack/rust@3.6.1
81
+
82
+ ## 2.18.2
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [[`f6b3f22`](https://github.com/atlassian-labs/atlaspack/commit/f6b3f2276c7e417580b49c4879563aab51f156b1)]:
87
+ - @atlaspack/feature-flags@2.23.0
88
+ - @atlaspack/types-internal@2.19.1
89
+ - @atlaspack/codeframe@2.13.7
90
+ - @atlaspack/logger@2.14.17
91
+
92
+ ## 2.18.1
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [[`ad26146`](https://github.com/atlassian-labs/atlaspack/commit/ad26146f13b4c1cc65d4a0f9c67060b90ef14ff3), [`f1b48e7`](https://github.com/atlassian-labs/atlaspack/commit/f1b48e7a04e005cef0f36a3e692087a9ecdb6f7a), [`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45), [`73dd7ba`](https://github.com/atlassian-labs/atlaspack/commit/73dd7baab69456ef2f6e4a0cc7dbb04f407eb148)]:
97
+ - @atlaspack/rust@3.6.0
98
+ - @atlaspack/types-internal@2.19.0
99
+ - @atlaspack/feature-flags@2.22.0
100
+ - @atlaspack/logger@2.14.16
101
+ - @atlaspack/codeframe@2.13.6
102
+
103
+ ## 2.18.0
104
+
105
+ ### Minor Changes
106
+
107
+ - [#731](https://github.com/atlassian-labs/atlaspack/pull/731) [`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2) Thanks [@marcins](https://github.com/marcins)! - Implement "inline isolated" scripts
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
112
+ - @atlaspack/feature-flags@2.21.0
113
+ - @atlaspack/rust@3.5.0
114
+ - @atlaspack/logger@2.14.15
115
+
116
+ ## 2.17.4
117
+
118
+ ### Patch Changes
119
+
120
+ - [#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
121
+
122
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94), [`12bee0e`](https://github.com/atlassian-labs/atlaspack/commit/12bee0e23f0464d7f6bd3e24fbe0d19c126d587d)]:
123
+ - @atlaspack/feature-flags@2.20.1
124
+ - @atlaspack/markdown-ansi@2.14.2
125
+ - @atlaspack/diagnostic@2.14.2
126
+ - @atlaspack/codeframe@2.13.5
127
+ - @atlaspack/logger@2.14.14
128
+ - @atlaspack/rust@3.4.2
129
+
130
+ ## 2.17.3
131
+
132
+ ### Patch Changes
133
+
134
+ - Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
135
+ - @atlaspack/feature-flags@2.20.0
136
+
137
+ ## 2.17.2
138
+
139
+ ### Patch Changes
140
+
141
+ - Updated dependencies [[`1c7865a`](https://github.com/atlassian-labs/atlaspack/commit/1c7865a64451116d94015e248302435839d347c0), [`a0b959f`](https://github.com/atlassian-labs/atlaspack/commit/a0b959fbf61fc3f820ff03c7e8988945fe40a91a)]:
142
+ - @atlaspack/feature-flags@2.19.2
143
+
144
+ ## 2.17.1
145
+
146
+ ### Patch Changes
147
+
148
+ - Updated dependencies [[`13aef17`](https://github.com/atlassian-labs/atlaspack/commit/13aef177eea289a6e40d2113b5ec1ac9be18a33d)]:
149
+ - @atlaspack/feature-flags@2.19.1
150
+
151
+ ## 2.17.0
152
+
153
+ ### Minor Changes
154
+
155
+ - [#640](https://github.com/atlassian-labs/atlaspack/pull/640) [`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d) Thanks [@JakeLane](https://github.com/JakeLane)! - Clean up conditional bundling feature flags
156
+
157
+ - [#693](https://github.com/atlassian-labs/atlaspack/pull/693) [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417) Thanks [@mattcompiles](https://github.com/mattcompiles)! - These packages should have been bumped in [pull request 691](https://github.com/atlassian-labs/atlaspack/pull/691).
158
+
159
+ Rectifying by creating a new changeset now.
160
+
161
+ ### Patch Changes
162
+
163
+ - [#645](https://github.com/atlassian-labs/atlaspack/pull/645) [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3) Thanks [@alshdavid](https://github.com/alshdavid)! - Updated build system and added some extra test-specific code
164
+
165
+ - [#682](https://github.com/atlassian-labs/atlaspack/pull/682) [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56) Thanks [@alshdavid](https://github.com/alshdavid)! - Updating build system
166
+
167
+ - Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`c4415a4`](https://github.com/atlassian-labs/atlaspack/commit/c4415a455543d984ca28452c2cb87a794d22497c), [`f0f7c71`](https://github.com/atlassian-labs/atlaspack/commit/f0f7c7168a1d3d18c6f30d2daed611275692b7c5), [`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)]:
168
+ - @atlaspack/feature-flags@2.19.0
169
+ - @atlaspack/rust@3.4.1
170
+ - @atlaspack/codeframe@2.13.4
171
+ - @atlaspack/logger@2.14.13
172
+
173
+ ## 2.16.1
174
+
175
+ ### Patch Changes
176
+
177
+ - Updated dependencies [[`c75bf55`](https://github.com/atlassian-labs/atlaspack/commit/c75bf553fff4decc285b5fd499a275853b18f8f2)]:
178
+ - @atlaspack/rust@3.4.0
179
+ - @atlaspack/logger@2.14.12
180
+
181
+ ## 2.16.0
182
+
183
+ ### Minor Changes
184
+
185
+ - [#659](https://github.com/atlassian-labs/atlaspack/pull/659) [`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529) Thanks [@benjervis](https://github.com/benjervis)! - Add the debug-tools system for altering the behaviour when attempting to identify issues.
186
+
187
+ ### Patch Changes
188
+
189
+ - Updated dependencies [[`e8a60ff`](https://github.com/atlassian-labs/atlaspack/commit/e8a60ffbea41caef265786bbf73349771760081c)]:
190
+ - @atlaspack/feature-flags@2.18.4
191
+
192
+ ## 2.15.3
193
+
194
+ ### Patch Changes
195
+
196
+ - Updated dependencies [[`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be)]:
197
+ - @atlaspack/feature-flags@2.18.3
198
+
199
+ ## 2.15.2
200
+
201
+ ### Patch Changes
202
+
203
+ - Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
204
+ - @atlaspack/feature-flags@2.18.2
205
+
206
+ ## 2.15.1
207
+
208
+ ### Patch Changes
209
+
210
+ - Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb), [`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
211
+ - @atlaspack/logger@2.14.11
212
+ - @atlaspack/feature-flags@2.18.1
213
+
214
+ ## 2.15.0
215
+
216
+ ### Minor Changes
217
+
218
+ - [#622](https://github.com/atlassian-labs/atlaspack/pull/622) [`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c) Thanks [@benjervis](https://github.com/benjervis)! - Add the `setIntersectStatic` method that doesn't mutate the passed in Sets
219
+
220
+ ### Patch Changes
221
+
222
+ - Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2)]:
223
+ - @atlaspack/feature-flags@2.18.0
224
+
225
+ ## 2.14.11
226
+
227
+ ### Patch Changes
228
+
229
+ - Updated dependencies [[`73ea3c4`](https://github.com/atlassian-labs/atlaspack/commit/73ea3c4d85d4401fdd15abcbf988237e890e7ad3), [`b1b3693`](https://github.com/atlassian-labs/atlaspack/commit/b1b369317c66f8a431c170df2ebba4fa5b2e38ef)]:
230
+ - @atlaspack/feature-flags@2.17.0
231
+
232
+ ## 2.14.10
233
+
234
+ ### Patch Changes
235
+
236
+ - Updated dependencies [[`35fdd4b`](https://github.com/atlassian-labs/atlaspack/commit/35fdd4b52da0af20f74667f7b8adfb2f90279b7c), [`6dd4ccb`](https://github.com/atlassian-labs/atlaspack/commit/6dd4ccb753541de32322d881f973d571dd57e4ca)]:
237
+ - @atlaspack/rust@3.3.5
238
+ - @atlaspack/logger@2.14.10
239
+
240
+ ## 2.14.9
241
+
242
+ ### Patch Changes
243
+
244
+ - Updated dependencies [[`124b7ff`](https://github.com/atlassian-labs/atlaspack/commit/124b7fff44f71aac9fbad289a9a9509b3dfc9aaa), [`e052521`](https://github.com/atlassian-labs/atlaspack/commit/e0525210850ed1606146eb86991049cf567c5dec), [`15c6d70`](https://github.com/atlassian-labs/atlaspack/commit/15c6d7000bd89da876bc590aa75b17a619a41896), [`e4d966c`](https://github.com/atlassian-labs/atlaspack/commit/e4d966c3c9c4292c5013372ae65b10d19d4bacc6), [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818), [`42a775d`](https://github.com/atlassian-labs/atlaspack/commit/42a775de8eec638ad188f3271964170d8c04d84b), [`29c2f10`](https://github.com/atlassian-labs/atlaspack/commit/29c2f106de9679adfb5afa04e1910471dc65a427), [`f4da1e1`](https://github.com/atlassian-labs/atlaspack/commit/f4da1e120e73eeb5e8b8927f05e88f04d6148c7b), [`1ef91fc`](https://github.com/atlassian-labs/atlaspack/commit/1ef91fcc863fdd2831511937083dbbc1263b3d9d)]:
245
+ - @atlaspack/rust@3.3.4
246
+ - @atlaspack/feature-flags@2.16.0
247
+ - @atlaspack/logger@2.14.9
248
+
249
+ ## 2.14.8
250
+
251
+ ### Patch Changes
252
+
253
+ - Updated dependencies [[`30f6017`](https://github.com/atlassian-labs/atlaspack/commit/30f60175ba4d272c5fc193973c63bc298584775b), [`1ab0a27`](https://github.com/atlassian-labs/atlaspack/commit/1ab0a275aeca40350415e2b03e7440d1dddc6228), [`b8a4ae8`](https://github.com/atlassian-labs/atlaspack/commit/b8a4ae8f83dc0a83d8b145c5f729936ce52080a3)]:
254
+ - @atlaspack/feature-flags@2.15.1
255
+ - @atlaspack/rust@3.3.3
256
+ - @atlaspack/logger@2.14.8
257
+
3
258
  ## 2.14.7
4
259
 
5
260
  ### Patch Changes
package/benchmark.js ADDED
@@ -0,0 +1,23 @@
1
+ require('@atlaspack/babel-register');
2
+ const b = require('benny');
3
+
4
+ const {setIntersect, setIntersectStatic} = require('./src/collection.js');
5
+
6
+ const setA = new Set([
7
+ 23, 25, 29, 29, 12, 16, 14, 23, 18, 19, 16, 24, 9, 29, 26,
8
+ ]);
9
+ const setB = new Set([24, 1, 3, 6, 1, 3, 1, 5, 20, 15, 21, 23, 13, 16, 6]);
10
+
11
+ b.suite(
12
+ 'Collection - set intersection',
13
+ b.add('Control', () => {
14
+ const setClone = new Set(setA);
15
+ return () => setIntersect(setClone, setB);
16
+ }),
17
+ b.add('setIntersectStatic', () => {
18
+ setIntersectStatic(setA, setB);
19
+ }),
20
+ b.configure({minSamples: 100}),
21
+ b.cycle(),
22
+ b.complete(),
23
+ );
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DefaultWeakMap = exports.DefaultMap = void 0;
7
+ class DefaultMap extends Map {
8
+ constructor(getDefault, entries) {
9
+ super(entries);
10
+ this._getDefault = getDefault;
11
+ }
12
+ get(key) {
13
+ let ret;
14
+ if (this.has(key)) {
15
+ ret = super.get(key);
16
+ } else {
17
+ ret = this._getDefault(key);
18
+ this.set(key, ret);
19
+ }
20
+ return ret;
21
+ }
22
+ }
23
+ exports.DefaultMap = DefaultMap;
24
+ // Duplicated from DefaultMap implementation for Flow
25
+ // Roughly mirrors https://github.com/facebook/flow/blob/2eb5a78d92c167117ba9caae070afd2b9f598599/lib/core.js#L617
26
+ class DefaultWeakMap extends WeakMap {
27
+ constructor(getDefault, entries) {
28
+ super(entries);
29
+ this._getDefault = getDefault;
30
+ }
31
+ get(key) {
32
+ let ret;
33
+ if (this.has(key)) {
34
+ ret = super.get(key);
35
+ } else {
36
+ ret = this._getDefault(key);
37
+ this.set(key, ret);
38
+ }
39
+ return ret;
40
+ }
41
+ }
42
+ exports.DefaultWeakMap = DefaultWeakMap;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.makeDeferredWithPromise = makeDeferredWithPromise;
7
+ function _assert() {
8
+ const data = _interopRequireDefault(require("assert"));
9
+ _assert = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function makeDeferredWithPromise() {
16
+ let deferred;
17
+ let promise = new Promise((resolve, reject) => {
18
+ deferred = {
19
+ resolve,
20
+ reject
21
+ };
22
+ });
23
+
24
+ // Promise constructor callback executes synchronously, so this is defined
25
+ (0, _assert().default)(deferred != null);
26
+ return {
27
+ deferred,
28
+ promise
29
+ };
30
+ }
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _Deferred = require("./Deferred");
8
+ class PromiseQueue {
9
+ _numRunning = 0;
10
+ _queue = [];
11
+ _runPromise = null;
12
+ _count = 0;
13
+ _results = [];
14
+ _addSubscriptions = new Set();
15
+ constructor(opts = {
16
+ maxConcurrent: Infinity
17
+ }) {
18
+ if (opts.maxConcurrent <= 0) {
19
+ throw new TypeError('maxConcurrent must be a positive, non-zero value');
20
+ }
21
+ this._maxConcurrent = opts.maxConcurrent;
22
+ }
23
+ getNumWaiting() {
24
+ return this._queue.length;
25
+ }
26
+ add(fn) {
27
+ new Promise((resolve, reject) => {
28
+ let i = this._count++;
29
+ let wrapped = () => fn().then(result => {
30
+ this._results[i] = result;
31
+ resolve(result);
32
+ }, err => {
33
+ reject(err);
34
+ throw err;
35
+ });
36
+ this._queue.push(wrapped);
37
+ for (const addFn of this._addSubscriptions) {
38
+ addFn();
39
+ }
40
+ if (this._numRunning > 0 && this._numRunning < this._maxConcurrent) {
41
+ this._next();
42
+ }
43
+ }).catch(() => {});
44
+ }
45
+ subscribeToAdd(fn) {
46
+ this._addSubscriptions.add(fn);
47
+ return () => {
48
+ this._addSubscriptions.delete(fn);
49
+ };
50
+ }
51
+ run() {
52
+ if (this._runPromise != null) {
53
+ return this._runPromise;
54
+ }
55
+ if (this._queue.length === 0) {
56
+ return Promise.resolve([]);
57
+ }
58
+ let {
59
+ deferred,
60
+ promise
61
+ } = (0, _Deferred.makeDeferredWithPromise)();
62
+ this._deferred = deferred;
63
+ this._runPromise = promise;
64
+ while (this._queue.length && this._numRunning < this._maxConcurrent) {
65
+ this._next();
66
+ }
67
+ return promise;
68
+ }
69
+ async _next() {
70
+ let fn = this._queue.shift();
71
+ await this._runFn(fn);
72
+ if (this._queue.length) {
73
+ this._next();
74
+ } else if (this._numRunning === 0) {
75
+ this._done();
76
+ }
77
+ }
78
+ async _runFn(fn) {
79
+ this._numRunning++;
80
+ try {
81
+ await fn();
82
+ } catch (e) {
83
+ // Only store the first error that occurs.
84
+ // We don't reject immediately so that any other concurrent
85
+ // requests have time to complete.
86
+ if (this._error == null) {
87
+ this._error = e;
88
+ }
89
+ } finally {
90
+ this._numRunning--;
91
+ }
92
+ }
93
+ _resetState() {
94
+ this._queue = [];
95
+ this._count = 0;
96
+ this._results = [];
97
+ this._runPromise = null;
98
+ this._numRunning = 0;
99
+ this._deferred = null;
100
+ }
101
+ _done() {
102
+ if (this._deferred != null) {
103
+ if (this._error != null) {
104
+ this._deferred.reject(this._error);
105
+ } else {
106
+ this._deferred.resolve(this._results);
107
+ }
108
+ }
109
+ this._resetState();
110
+ }
111
+ }
112
+ exports.default = PromiseQueue;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ function _stream() {
8
+ const data = require("stream");
9
+ _stream = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ /*
15
+ * "Taps" into the contents of a flowing stream, yielding chunks to the passed
16
+ * callback. Continues to pass data chunks down the stream.
17
+ */
18
+ class TapStream extends _stream().Transform {
19
+ constructor(tap, options) {
20
+ super({
21
+ ...options
22
+ });
23
+ this._tap = tap;
24
+ }
25
+ _transform(chunk, encoding, callback) {
26
+ try {
27
+ this._tap(Buffer.from(chunk));
28
+ callback(null, chunk);
29
+ } catch (err) {
30
+ callback(err);
31
+ }
32
+ }
33
+ }
34
+ exports.default = TapStream;
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.findAlternativeFiles = findAlternativeFiles;
7
+ exports.findAlternativeNodeModules = findAlternativeNodeModules;
8
+ function _path() {
9
+ const data = _interopRequireDefault(require("path"));
10
+ _path = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
15
+ var _schema = require("./schema");
16
+ var _path2 = require("./path");
17
+ var _config = require("./config");
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+ async function findAlternativeNodeModules(fs, moduleName, dir) {
20
+ let potentialModules = [];
21
+ let root = _path().default.parse(dir).root;
22
+ let isOrganisationModule = moduleName.startsWith('@');
23
+ while (dir !== root) {
24
+ // Skip node_modules directories
25
+ if (_path().default.basename(dir) === 'node_modules') {
26
+ dir = _path().default.dirname(dir);
27
+ }
28
+ try {
29
+ let modulesDir = _path().default.join(dir, 'node_modules');
30
+ let stats = await fs.stat(modulesDir);
31
+ if (stats.isDirectory()) {
32
+ let dirContent = (await fs.readdir(modulesDir)).sort();
33
+
34
+ // Filter out the modules that interest us
35
+ let modules = dirContent.filter(i => isOrganisationModule ? i.startsWith('@') : !i.startsWith('@'));
36
+
37
+ // If it's an organisation module, loop through all the modules of that organisation
38
+ if (isOrganisationModule) {
39
+ await Promise.all(modules.map(async item => {
40
+ let orgDirPath = _path().default.join(modulesDir, item);
41
+ let orgDirContent = (await fs.readdir(orgDirPath)).sort();
42
+
43
+ // Add all org packages
44
+ potentialModules.push(...orgDirContent.map(i => `${item}/${i}`));
45
+ }));
46
+ } else {
47
+ potentialModules.push(...modules);
48
+ }
49
+ }
50
+ } catch (err) {
51
+ // ignore
52
+ }
53
+
54
+ // Move up a directory
55
+ dir = _path().default.dirname(dir);
56
+ }
57
+ return (0, _schema.fuzzySearch)(potentialModules.sort(), moduleName).slice(0, 2);
58
+ }
59
+ async function findAllFilesUp({
60
+ fs,
61
+ dir,
62
+ root,
63
+ basedir,
64
+ maxlength,
65
+ collected,
66
+ leadingDotSlash = true,
67
+ includeDirectories = true
68
+ }) {
69
+ let dirContent = (await fs.readdir(dir)).sort();
70
+ return Promise.all(dirContent.map(async item => {
71
+ let fullPath = _path().default.join(dir, item);
72
+ let relativeFilePath = (0, _path2.relativePath)(basedir, fullPath, leadingDotSlash);
73
+ if (relativeFilePath.length < maxlength) {
74
+ let stats = await fs.stat(fullPath);
75
+ let isDir = stats.isDirectory();
76
+ if (isDir && includeDirectories || stats.isFile()) {
77
+ collected.push(relativeFilePath);
78
+ }
79
+
80
+ // If it's a directory, run over each item within said directory...
81
+ if (isDir) {
82
+ return findAllFilesUp({
83
+ fs,
84
+ dir: fullPath,
85
+ root,
86
+ basedir,
87
+ maxlength,
88
+ collected
89
+ });
90
+ }
91
+ }
92
+ }));
93
+ }
94
+ async function findAlternativeFiles(fs, fileSpecifier, dir, projectRoot, leadingDotSlash = true, includeDirectories = true, includeExtension = false) {
95
+ let potentialFiles = [];
96
+ // Find our root, we won't recommend files above the package root as that's bad practise
97
+ let pkg = await (0, _config.resolveConfig)(fs, _path().default.join(dir, 'index'), ['package.json'], projectRoot);
98
+ let pkgRoot = pkg ? _path().default.dirname(pkg) : projectRoot;
99
+ await findAllFilesUp({
100
+ fs,
101
+ dir: pkgRoot,
102
+ root: pkgRoot,
103
+ basedir: dir,
104
+ maxlength: fileSpecifier.length + 10,
105
+ collected: potentialFiles,
106
+ leadingDotSlash,
107
+ includeDirectories
108
+ });
109
+ if (_path().default.extname(fileSpecifier) === '' && !includeExtension) {
110
+ potentialFiles = potentialFiles.map(p => {
111
+ let ext = _path().default.extname(p);
112
+ return ext.length > 0 ? p.slice(0, -ext.length) : p;
113
+ });
114
+ }
115
+ return (0, _schema.fuzzySearch)(potentialFiles.sort(), fileSpecifier).slice(0, 2);
116
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ansiHtml = ansiHtml;
7
+ function _ansiHtmlCommunity() {
8
+ const data = _interopRequireDefault(require("ansi-html-community"));
9
+ _ansiHtmlCommunity = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ var _escapeHtml = require("./escape-html");
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ // @ts-expect-error ansi-html-community is not typed
17
+
18
+ function ansiHtml(ansi) {
19
+ return (0, _ansiHtmlCommunity().default)((0, _escapeHtml.escapeHTML)(ansi));
20
+ }
package/lib/blob.js ADDED
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.blobToBuffer = blobToBuffer;
7
+ exports.blobToString = blobToString;
8
+ function _buffer() {
9
+ const data = require("buffer");
10
+ _buffer = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
15
+ var _ = require("./");
16
+ function _stream() {
17
+ const data = require("stream");
18
+ _stream = function () {
19
+ return data;
20
+ };
21
+ return data;
22
+ }
23
+ function blobToBuffer(blob) {
24
+ if (blob instanceof _stream().Readable) {
25
+ return (0, _.bufferStream)(blob);
26
+ } else if (blob instanceof _buffer().Buffer) {
27
+ return Promise.resolve(_buffer().Buffer.from(blob));
28
+ } else {
29
+ return Promise.resolve(_buffer().Buffer.from(blob, 'utf8'));
30
+ }
31
+ }
32
+ async function blobToString(blob) {
33
+ if (blob instanceof _stream().Readable) {
34
+ return (await (0, _.bufferStream)(blob)).toString();
35
+ } else if (blob instanceof _buffer().Buffer) {
36
+ return blob.toString();
37
+ } else {
38
+ return blob;
39
+ }
40
+ }