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