@atlaspack/optimizer-inline-requires 2.14.5-canary.2 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,272 @@
1
1
  # @atlaspack/optimizer-inline-requires
2
2
 
3
+ ## 2.14.31
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/feature-flags@2.25.1
11
+ - @atlaspack/plugin@2.14.31
12
+ - @atlaspack/rust@3.8.1
13
+ - @atlaspack/types@2.15.21
14
+
15
+ ## 2.14.30
16
+
17
+ ### Patch Changes
18
+
19
+ - 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)]:
20
+ - @atlaspack/feature-flags@2.25.0
21
+ - @atlaspack/rust@3.8.0
22
+ - @atlaspack/plugin@2.14.30
23
+ - @atlaspack/types@2.15.20
24
+
25
+ ## 2.14.29
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [[`830261d`](https://github.com/atlassian-labs/atlaspack/commit/830261dcf4a40293090b61cab52fd75d5683c73f), [`53dd47b`](https://github.com/atlassian-labs/atlaspack/commit/53dd47bd6d23cd47f87297347f03a609ab38a03d)]:
30
+ - @atlaspack/feature-flags@2.24.1
31
+ - @atlaspack/rust@3.7.0
32
+ - @atlaspack/plugin@2.14.29
33
+ - @atlaspack/types@2.15.19
34
+
35
+ ## 2.14.28
36
+
37
+ ### Patch Changes
38
+
39
+ - 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)]:
40
+ - @atlaspack/feature-flags@2.24.0
41
+ - @atlaspack/plugin@2.14.28
42
+ - @atlaspack/types@2.15.18
43
+
44
+ ## 2.14.27
45
+
46
+ ### Patch Changes
47
+
48
+ - Updated dependencies [[`3cfb7cf`](https://github.com/atlassian-labs/atlaspack/commit/3cfb7cfd90b78a5c48ce717e779ff789769825a3)]:
49
+ - @atlaspack/feature-flags@2.23.2
50
+ - @atlaspack/rust@3.6.2
51
+ - @atlaspack/plugin@2.14.27
52
+ - @atlaspack/types@2.15.17
53
+
54
+ ## 2.14.26
55
+
56
+ ### Patch Changes
57
+
58
+ - [#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
59
+
60
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd)]:
61
+ - @atlaspack/feature-flags@2.23.1
62
+ - @atlaspack/plugin@2.14.26
63
+ - @atlaspack/types@2.15.16
64
+ - @atlaspack/rust@3.6.1
65
+
66
+ ## 2.14.25
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [[`f6b3f22`](https://github.com/atlassian-labs/atlaspack/commit/f6b3f2276c7e417580b49c4879563aab51f156b1)]:
71
+ - @atlaspack/feature-flags@2.23.0
72
+ - @atlaspack/plugin@2.14.25
73
+ - @atlaspack/types@2.15.15
74
+
75
+ ## 2.14.24
76
+
77
+ ### Patch Changes
78
+
79
+ - 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)]:
80
+ - @atlaspack/rust@3.6.0
81
+ - @atlaspack/feature-flags@2.22.0
82
+ - @atlaspack/plugin@2.14.24
83
+ - @atlaspack/types@2.15.14
84
+
85
+ ## 2.14.23
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
90
+ - @atlaspack/feature-flags@2.21.0
91
+ - @atlaspack/rust@3.5.0
92
+ - @atlaspack/types@2.15.13
93
+ - @atlaspack/plugin@2.14.23
94
+
95
+ ## 2.14.22
96
+
97
+ ### Patch Changes
98
+
99
+ - [#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
100
+
101
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94), [`12bee0e`](https://github.com/atlassian-labs/atlaspack/commit/12bee0e23f0464d7f6bd3e24fbe0d19c126d587d)]:
102
+ - @atlaspack/feature-flags@2.20.1
103
+ - @atlaspack/plugin@2.14.22
104
+ - @atlaspack/types@2.15.12
105
+ - @atlaspack/rust@3.4.2
106
+
107
+ ## 2.14.21
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
112
+ - @atlaspack/feature-flags@2.20.0
113
+ - @atlaspack/types@2.15.11
114
+ - @atlaspack/plugin@2.14.21
115
+
116
+ ## 2.14.20
117
+
118
+ ### Patch Changes
119
+
120
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa), [`1c7865a`](https://github.com/atlassian-labs/atlaspack/commit/1c7865a64451116d94015e248302435839d347c0), [`a0b959f`](https://github.com/atlassian-labs/atlaspack/commit/a0b959fbf61fc3f820ff03c7e8988945fe40a91a)]:
121
+ - @atlaspack/plugin@2.14.20
122
+ - @atlaspack/feature-flags@2.19.2
123
+ - @atlaspack/types@2.15.10
124
+
125
+ ## 2.14.19
126
+
127
+ ### Patch Changes
128
+
129
+ - Updated dependencies [[`13aef17`](https://github.com/atlassian-labs/atlaspack/commit/13aef177eea289a6e40d2113b5ec1ac9be18a33d)]:
130
+ - @atlaspack/feature-flags@2.19.1
131
+ - @atlaspack/types@2.15.9
132
+ - @atlaspack/plugin@2.14.19
133
+
134
+ ## 2.14.18
135
+
136
+ ### Patch Changes
137
+
138
+ - 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), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417)]:
139
+ - @atlaspack/feature-flags@2.19.0
140
+ - @atlaspack/rust@3.4.1
141
+ - @atlaspack/types@2.15.8
142
+ - @atlaspack/plugin@2.14.18
143
+
144
+ ## 2.14.17
145
+
146
+ ### Patch Changes
147
+
148
+ - Updated dependencies [[`c75bf55`](https://github.com/atlassian-labs/atlaspack/commit/c75bf553fff4decc285b5fd499a275853b18f8f2)]:
149
+ - @atlaspack/rust@3.4.0
150
+ - @atlaspack/types@2.15.7
151
+ - @atlaspack/plugin@2.14.17
152
+
153
+ ## 2.14.16
154
+
155
+ ### Patch Changes
156
+
157
+ - Updated dependencies [[`e8a60ff`](https://github.com/atlassian-labs/atlaspack/commit/e8a60ffbea41caef265786bbf73349771760081c)]:
158
+ - @atlaspack/feature-flags@2.18.4
159
+ - @atlaspack/types@2.15.6
160
+ - @atlaspack/plugin@2.14.16
161
+
162
+ ## 2.14.15
163
+
164
+ ### Patch Changes
165
+
166
+ - [#655](https://github.com/atlassian-labs/atlaspack/pull/655) [`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be) Thanks [@yamadapc](https://github.com/yamadapc)! - Clean-up inline requires multi-threading feature-flag
167
+
168
+ - Updated dependencies [[`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be)]:
169
+ - @atlaspack/feature-flags@2.18.3
170
+ - @atlaspack/types@2.15.5
171
+ - @atlaspack/plugin@2.14.15
172
+
173
+ ## 2.14.14
174
+
175
+ ### Patch Changes
176
+
177
+ - Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
178
+ - @atlaspack/feature-flags@2.18.2
179
+ - @atlaspack/types@2.15.4
180
+ - @atlaspack/plugin@2.14.14
181
+
182
+ ## 2.14.13
183
+
184
+ ### Patch Changes
185
+
186
+ - Updated dependencies [[`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
187
+ - @atlaspack/feature-flags@2.18.1
188
+ - @atlaspack/types@2.15.3
189
+ - @atlaspack/plugin@2.14.13
190
+
191
+ ## 2.14.12
192
+
193
+ ### Patch Changes
194
+
195
+ - Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2)]:
196
+ - @atlaspack/feature-flags@2.18.0
197
+ - @atlaspack/types@2.15.2
198
+ - @atlaspack/plugin@2.14.12
199
+
200
+ ## 2.14.11
201
+
202
+ ### Patch Changes
203
+
204
+ - Updated dependencies [[`73ea3c4`](https://github.com/atlassian-labs/atlaspack/commit/73ea3c4d85d4401fdd15abcbf988237e890e7ad3), [`b1b3693`](https://github.com/atlassian-labs/atlaspack/commit/b1b369317c66f8a431c170df2ebba4fa5b2e38ef)]:
205
+ - @atlaspack/feature-flags@2.17.0
206
+ - @atlaspack/types@2.15.1
207
+ - @atlaspack/plugin@2.14.11
208
+
209
+ ## 2.14.10
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [[`51aba5f`](https://github.com/atlassian-labs/atlaspack/commit/51aba5fc0e49235ee06bbc3c376f48c3e7da5c4b), [`1e32d4e`](https://github.com/atlassian-labs/atlaspack/commit/1e32d4eae6b3af3968e8a0ef97d35b4347fd4196), [`35fdd4b`](https://github.com/atlassian-labs/atlaspack/commit/35fdd4b52da0af20f74667f7b8adfb2f90279b7c), [`6dd4ccb`](https://github.com/atlassian-labs/atlaspack/commit/6dd4ccb753541de32322d881f973d571dd57e4ca)]:
214
+ - @atlaspack/types@2.15.0
215
+ - @atlaspack/rust@3.3.5
216
+ - @atlaspack/plugin@2.14.10
217
+
218
+ ## 2.14.9
219
+
220
+ ### Patch Changes
221
+
222
+ - 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)]:
223
+ - @atlaspack/rust@3.3.4
224
+ - @atlaspack/feature-flags@2.16.0
225
+ - @atlaspack/types@2.14.9
226
+ - @atlaspack/plugin@2.14.9
227
+
228
+ ## 2.14.8
229
+
230
+ ### Patch Changes
231
+
232
+ - 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)]:
233
+ - @atlaspack/feature-flags@2.15.1
234
+ - @atlaspack/rust@3.3.3
235
+ - @atlaspack/types@2.14.8
236
+ - @atlaspack/plugin@2.14.8
237
+
238
+ ## 2.14.7
239
+
240
+ ### Patch Changes
241
+
242
+ - Updated dependencies [[`a1773d2`](https://github.com/atlassian-labs/atlaspack/commit/a1773d2a62d0ef7805ac7524621dcabcc1afe929), [`556d6ab`](https://github.com/atlassian-labs/atlaspack/commit/556d6ab8ede759fa7f37fcd3f4da336ef1c55e8f)]:
243
+ - @atlaspack/feature-flags@2.15.0
244
+ - @atlaspack/rust@3.3.2
245
+ - @atlaspack/types@2.14.7
246
+ - @atlaspack/plugin@2.14.7
247
+
248
+ ## 2.14.6
249
+
250
+ ### Patch Changes
251
+
252
+ - [#542](https://github.com/atlassian-labs/atlaspack/pull/542) [`e0f5337`](https://github.com/atlassian-labs/atlaspack/commit/e0f533757bd1019dbd108a04952c87da15286e09) Thanks [@yamadapc](https://github.com/yamadapc)! - Add feature-flagged option to use rayon thread-pool to optimize inline requires
253
+
254
+ - Updated dependencies [[`e0f5337`](https://github.com/atlassian-labs/atlaspack/commit/e0f533757bd1019dbd108a04952c87da15286e09)]:
255
+ - @atlaspack/feature-flags@2.14.4
256
+ - @atlaspack/rust@3.3.1
257
+ - @atlaspack/types@2.14.6
258
+ - @atlaspack/plugin@2.14.6
259
+
260
+ ## 2.14.5
261
+
262
+ ### Patch Changes
263
+
264
+ - Updated dependencies [[`11d6f16`](https://github.com/atlassian-labs/atlaspack/commit/11d6f16b6397dee2f217167e5c98b39edb63f7a7), [`e2ba0f6`](https://github.com/atlassian-labs/atlaspack/commit/e2ba0f69702656f3d1ce95ab1454e35062b13b39), [`d2c50c2`](https://github.com/atlassian-labs/atlaspack/commit/d2c50c2c020888b33bb25b8690d9320c2b69e2a6), [`46a90dc`](https://github.com/atlassian-labs/atlaspack/commit/46a90dccd019a26b222c878a92d23acc75dc67c5)]:
265
+ - @atlaspack/feature-flags@2.14.3
266
+ - @atlaspack/rust@3.3.0
267
+ - @atlaspack/types@2.14.5
268
+ - @atlaspack/plugin@2.14.5
269
+
3
270
  ## 2.14.4
4
271
 
5
272
  ### Patch Changes
@@ -29,15 +29,17 @@ function _sourceMap() {
29
29
  return data;
30
30
  }
31
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
+ // @ts-expect-error TS7034
32
33
  let assetPublicIdsWithSideEffects = null;
33
- // $FlowFixMe not sure how to anotate the export here to make it work...
34
34
  module.exports = new (_plugin().Optimizer)({
35
35
  loadBundleConfig({
36
36
  bundle,
37
37
  bundleGraph,
38
38
  tracer
39
39
  }) {
40
+ // @ts-expect-error TS7005
40
41
  if (assetPublicIdsWithSideEffects !== null) {
42
+ // @ts-expect-error TS7005
41
43
  return {
42
44
  assetPublicIdsWithSideEffects
43
45
  };
@@ -52,6 +54,7 @@ module.exports = new (_plugin().Optimizer)({
52
54
  bundleGraph.traverse(node => {
53
55
  if (node.type === 'asset' && node.value.sideEffects) {
54
56
  const publicId = bundleGraph.getAssetPublicId(node.value);
57
+ // @ts-expect-error TS7005
55
58
  let sideEffectsMap = (0, _nullthrows().default)(assetPublicIdsWithSideEffects);
56
59
  sideEffectsMap.add(publicId);
57
60
  }
@@ -61,7 +64,7 @@ module.exports = new (_plugin().Optimizer)({
61
64
  assetPublicIdsWithSideEffects
62
65
  };
63
66
  },
64
- optimize({
67
+ async optimize({
65
68
  bundle,
66
69
  contents,
67
70
  map: originalMap,
@@ -77,19 +80,23 @@ module.exports = new (_plugin().Optimizer)({
77
80
  }
78
81
  try {
79
82
  let sourceMap = null;
80
- const result = (0, _rust().runInlineRequiresOptimizer)({
83
+ const result = await (0, _rust().runInlineRequiresOptimizerAsync)({
81
84
  code: contents.toString(),
82
85
  sourceMaps: !!bundle.env.sourceMap,
83
86
  ignoreModuleIds: Array.from(bundleConfig.assetPublicIdsWithSideEffects)
84
87
  });
88
+
89
+ // @ts-expect-error TS2339
85
90
  const sourceMapResult = result.sourceMap;
86
91
  if (sourceMapResult != null) {
87
92
  sourceMap = new (_sourceMap().default)(options.projectRoot);
88
93
  sourceMap.addVLQMap(JSON.parse(sourceMapResult));
89
94
  if (originalMap) {
95
+ // @ts-expect-error TS2345
90
96
  sourceMap.extends(originalMap);
91
97
  }
92
98
  }
99
+ // @ts-expect-error TS2339
93
100
  return {
94
101
  contents: result.code,
95
102
  map: sourceMap
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/optimizer-inline-requires",
3
- "version": "2.14.5-canary.2+88fcaf47c",
3
+ "version": "2.14.5-canary.200+10ee3fa5b",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,20 +9,25 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/atlassian-labs/atlaspack.git"
11
11
  },
12
- "main": "lib/InlineRequires.js",
13
- "source": "src/InlineRequires.js",
12
+ "main": "./lib/InlineRequires.js",
13
+ "source": "./src/InlineRequires.ts",
14
+ "types": "./lib/types/InlineRequires.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 14.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/feature-flags": "2.14.1-canary.70+88fcaf47c",
19
- "@atlaspack/plugin": "2.14.5-canary.2+88fcaf47c",
20
- "@atlaspack/rust": "3.2.1-canary.2+88fcaf47c",
21
- "@atlaspack/types": "2.14.5-canary.2+88fcaf47c",
19
+ "@atlaspack/feature-flags": "2.14.1-canary.268+10ee3fa5b",
20
+ "@atlaspack/plugin": "2.14.5-canary.200+10ee3fa5b",
21
+ "@atlaspack/rust": "3.2.1-canary.200+10ee3fa5b",
22
+ "@atlaspack/types": "2.14.5-canary.200+10ee3fa5b",
22
23
  "@parcel/source-map": "^2.1.1",
23
24
  "@swc/core": "^1.10.0",
24
25
  "nullthrows": "^1.1.1"
25
26
  },
26
27
  "type": "commonjs",
27
- "gitHead": "88fcaf47c77a6b7a16003028dd65a4b7a1f19dd7"
28
- }
28
+ "scripts": {
29
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src",
30
+ "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
31
+ },
32
+ "gitHead": "10ee3fa5b75a92acde8973673d9b3c5b6f3958e5"
33
+ }
@@ -1,19 +1,20 @@
1
- // @flow strict-local
2
1
  import {Optimizer} from '@atlaspack/plugin';
3
- import {runInlineRequiresOptimizer} from '@atlaspack/rust';
2
+ import {runInlineRequiresOptimizerAsync} from '@atlaspack/rust';
4
3
  import nullthrows from 'nullthrows';
5
4
  import SourceMap from '@parcel/source-map';
6
5
 
6
+ // @ts-expect-error TS7034
7
7
  let assetPublicIdsWithSideEffects = null;
8
8
 
9
- type BundleConfig = {|
10
- assetPublicIdsWithSideEffects: Set<string>,
11
- |};
9
+ type BundleConfig = {
10
+ assetPublicIdsWithSideEffects: Set<string>;
11
+ };
12
12
 
13
- // $FlowFixMe not sure how to anotate the export here to make it work...
14
- module.exports = new Optimizer<empty, BundleConfig>({
13
+ module.exports = new Optimizer<never, BundleConfig>({
15
14
  loadBundleConfig({bundle, bundleGraph, tracer}): BundleConfig {
15
+ // @ts-expect-error TS7005
16
16
  if (assetPublicIdsWithSideEffects !== null) {
17
+ // @ts-expect-error TS7005
17
18
  return {assetPublicIdsWithSideEffects};
18
19
  }
19
20
 
@@ -32,6 +33,7 @@ module.exports = new Optimizer<empty, BundleConfig>({
32
33
  bundleGraph.traverse((node) => {
33
34
  if (node.type === 'asset' && node.value.sideEffects) {
34
35
  const publicId = bundleGraph.getAssetPublicId(node.value);
36
+ // @ts-expect-error TS7005
35
37
  let sideEffectsMap = nullthrows(assetPublicIdsWithSideEffects);
36
38
  sideEffectsMap.add(publicId);
37
39
  }
@@ -42,7 +44,7 @@ module.exports = new Optimizer<empty, BundleConfig>({
42
44
  return {assetPublicIdsWithSideEffects};
43
45
  },
44
46
 
45
- optimize({
47
+ async optimize({
46
48
  bundle,
47
49
  contents,
48
50
  map: originalMap,
@@ -56,21 +58,25 @@ module.exports = new Optimizer<empty, BundleConfig>({
56
58
 
57
59
  try {
58
60
  let sourceMap = null;
59
- const result = runInlineRequiresOptimizer({
61
+ const result = await runInlineRequiresOptimizerAsync({
60
62
  code: contents.toString(),
61
63
  sourceMaps: !!bundle.env.sourceMap,
62
64
  ignoreModuleIds: Array.from(bundleConfig.assetPublicIdsWithSideEffects),
63
65
  });
66
+
67
+ // @ts-expect-error TS2339
64
68
  const sourceMapResult = result.sourceMap;
65
69
  if (sourceMapResult != null) {
66
70
  sourceMap = new SourceMap(options.projectRoot);
67
71
  sourceMap.addVLQMap(JSON.parse(sourceMapResult));
68
72
  if (originalMap) {
73
+ // @ts-expect-error TS2345
69
74
  sourceMap.extends(originalMap);
70
75
  }
71
76
  }
77
+ // @ts-expect-error TS2339
72
78
  return {contents: result.code, map: sourceMap};
73
- } catch (err) {
79
+ } catch (err: any) {
74
80
  logger.warn({
75
81
  origin: 'atlaspack-optimizer-experimental-inline-requires',
76
82
  message: `Unable to optimise requires for ${bundle.name}: ${err.message}`,
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }