@atlaspack/packager-js 2.14.5-canary.27 → 2.14.5-canary.271
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 +396 -0
- package/dist/CJSOutputFormat.js +34 -0
- package/dist/DevPackager.js +202 -0
- package/dist/ESMOutputFormat.js +102 -0
- package/dist/GlobalOutputFormat.js +18 -0
- package/dist/ScopeHoistingPackager.js +1369 -0
- package/dist/helpers.js +170 -0
- package/dist/index.js +120 -0
- package/dist/utils.js +60 -0
- package/lib/DevPackager.js +28 -3
- package/lib/ESMOutputFormat.js +1 -1
- package/lib/ScopeHoistingPackager.js +265 -107
- package/lib/dev-prelude.js +6 -6
- package/lib/helpers.js +38 -3
- package/lib/index.js +35 -9
- package/lib/types/CJSOutputFormat.d.ts +7 -0
- package/lib/types/DevPackager.d.ts +15 -0
- package/lib/types/ESMOutputFormat.d.ts +7 -0
- package/lib/types/GlobalOutputFormat.d.ts +7 -0
- package/lib/types/ScopeHoistingPackager.d.ts +71 -0
- package/lib/types/helpers.d.ts +12 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/utils.d.ts +6 -0
- package/package.json +17 -12
- package/src/{CJSOutputFormat.js → CJSOutputFormat.ts} +0 -1
- package/src/{DevPackager.js → DevPackager.ts} +34 -7
- package/src/{ESMOutputFormat.js → ESMOutputFormat.ts} +3 -4
- package/src/{GlobalOutputFormat.js → GlobalOutputFormat.ts} +0 -1
- package/src/{ScopeHoistingPackager.js → ScopeHoistingPackager.ts} +427 -180
- package/src/dev-prelude.js +6 -6
- package/src/{helpers.js → helpers.ts} +37 -3
- package/src/{index.js → index.ts} +64 -38
- package/src/{utils.js → utils.ts} +1 -2
- package/tsconfig.json +27 -0
- package/tsconfig.tsbuildinfo +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,401 @@
|
|
|
1
1
|
# @atlaspack/packager-js
|
|
2
2
|
|
|
3
|
+
## 2.23.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`339b600`](https://github.com/atlassian-labs/atlaspack/commit/339b60095d755742cea50f811d08ccc44a4ae521), [`373ee2d`](https://github.com/atlassian-labs/atlaspack/commit/373ee2d3b5cc315df1e90e647619f915892e2b87)]:
|
|
8
|
+
- @atlaspack/rust@3.9.1
|
|
9
|
+
- @atlaspack/feature-flags@2.26.1
|
|
10
|
+
- @atlaspack/utils@3.1.1
|
|
11
|
+
- @atlaspack/plugin@2.14.37
|
|
12
|
+
- @atlaspack/types@2.15.27
|
|
13
|
+
|
|
14
|
+
## 2.23.6
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#852](https://github.com/atlassian-labs/atlaspack/pull/852) [`5776be2`](https://github.com/atlassian-labs/atlaspack/commit/5776be21f70a3f2b9471ba33da3ba1a883f21f1a) Thanks [@marcins](https://github.com/marcins)! - Support passing a function for source property in schema validation to allow for deferred reads of files
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`02f6aa1`](https://github.com/atlassian-labs/atlaspack/commit/02f6aa1906953fc184d2b49c905c2ef815cb878d), [`58527ee`](https://github.com/atlassian-labs/atlaspack/commit/58527eec15c1aebaaadbeb63586f3082c16beae3), [`525898e`](https://github.com/atlassian-labs/atlaspack/commit/525898e33cc229a4bc938ae853732be36d20c01a), [`cfb39a0`](https://github.com/atlassian-labs/atlaspack/commit/cfb39a0d729eb620cf2ca1611750a2bf7a080d08), [`d0c7bea`](https://github.com/atlassian-labs/atlaspack/commit/d0c7bea04458255b4c5d4299600e734b5f919fe1), [`1086c6a`](https://github.com/atlassian-labs/atlaspack/commit/1086c6a2c59271b63b3fb78e6acdb9d3a0dbf354), [`9cd9521`](https://github.com/atlassian-labs/atlaspack/commit/9cd9521978f783046e2ae4ce78f2de7aeb07d073), [`5776be2`](https://github.com/atlassian-labs/atlaspack/commit/5776be21f70a3f2b9471ba33da3ba1a883f21f1a)]:
|
|
21
|
+
- @atlaspack/rust@3.9.0
|
|
22
|
+
- @atlaspack/feature-flags@2.26.0
|
|
23
|
+
- @atlaspack/utils@3.1.0
|
|
24
|
+
- @atlaspack/plugin@2.14.36
|
|
25
|
+
- @atlaspack/types@2.15.26
|
|
26
|
+
|
|
27
|
+
## 2.23.5
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [#810](https://github.com/atlassian-labs/atlaspack/pull/810) [`c372f3f`](https://github.com/atlassian-labs/atlaspack/commit/c372f3fd6fce8200d5cf47f41bc7895c6cbb5558) Thanks [@benjervis](https://github.com/benjervis)! - Add the `scope-hosting-stats` debug tool to report on the percentage of assets that were able to be scope hoisted during the build.
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`79a7e22`](https://github.com/atlassian-labs/atlaspack/commit/79a7e22ef119891a2f4180a9d3cc66b38dd52092), [`3da8e69`](https://github.com/atlassian-labs/atlaspack/commit/3da8e690605472d81c531366b65fa9844f8ca337), [`c372f3f`](https://github.com/atlassian-labs/atlaspack/commit/c372f3fd6fce8200d5cf47f41bc7895c6cbb5558), [`17dfea9`](https://github.com/atlassian-labs/atlaspack/commit/17dfea9e9f3169807808520df9c09ebf70dc8b10), [`f1070ec`](https://github.com/atlassian-labs/atlaspack/commit/f1070ec48e99b4ec111a03179c5ab5b74163fab1), [`27fd73f`](https://github.com/atlassian-labs/atlaspack/commit/27fd73fa07d358653f1be6f2d15d72dc5d8fc2fd), [`3091fa3`](https://github.com/atlassian-labs/atlaspack/commit/3091fa36425ecffe3938e55247a035b08cda37a2)]:
|
|
34
|
+
- @atlaspack/feature-flags@2.25.5
|
|
35
|
+
- @atlaspack/rust@3.8.3
|
|
36
|
+
- @atlaspack/utils@3.0.3
|
|
37
|
+
- @atlaspack/plugin@2.14.35
|
|
38
|
+
- @atlaspack/types@2.15.25
|
|
39
|
+
|
|
40
|
+
## 2.23.4
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- [#814](https://github.com/atlassian-labs/atlaspack/pull/814) [`4fe7211`](https://github.com/atlassian-labs/atlaspack/commit/4fe7211301085c3e118d69a192e190e5ac343b42) Thanks [@JakeLane](https://github.com/JakeLane)! - Experimental config option to manually specify static export bindings as a performance optimisation. Requires the "exportsRebindingOptimisation" flag to be enabled.
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [[`662d3c6`](https://github.com/atlassian-labs/atlaspack/commit/662d3c627888b16bf27df15cfac5a9094509e93d)]:
|
|
47
|
+
- @atlaspack/feature-flags@2.25.4
|
|
48
|
+
- @atlaspack/types@2.15.24
|
|
49
|
+
- @atlaspack/utils@3.0.2
|
|
50
|
+
- @atlaspack/plugin@2.14.34
|
|
51
|
+
|
|
52
|
+
## 2.23.3
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [[`236e546`](https://github.com/atlassian-labs/atlaspack/commit/236e5465863dca6044a7191e05260a5b924c342e), [`f07351a`](https://github.com/atlassian-labs/atlaspack/commit/f07351a2398b6a8e5155a2daad77e69b7dcb2b4b)]:
|
|
57
|
+
- @atlaspack/utils@3.0.1
|
|
58
|
+
- @atlaspack/feature-flags@2.25.3
|
|
59
|
+
- @atlaspack/types@2.15.23
|
|
60
|
+
- @atlaspack/plugin@2.14.33
|
|
61
|
+
|
|
62
|
+
## 2.23.2
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- [#796](https://github.com/atlassian-labs/atlaspack/pull/796) [`0e967b0`](https://github.com/atlassian-labs/atlaspack/commit/0e967b0cf0fbd885588b81476ec1f25a507ffa94) Thanks [@benjervis](https://github.com/benjervis)! - Minor refactor of the internals of the scope hoisting packager. Some of the internal objects are now keyed on Assets rather than string asset IDs.
|
|
67
|
+
|
|
68
|
+
- [#801](https://github.com/atlassian-labs/atlaspack/pull/801) [`b104fd8`](https://github.com/atlassian-labs/atlaspack/commit/b104fd846ea17c583e68ddc6b309c5e1edee6938) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix incorrect output with skipped assets with scope hoisting improvements
|
|
69
|
+
|
|
70
|
+
- Updated dependencies [[`0207171`](https://github.com/atlassian-labs/atlaspack/commit/0207171e59e985c51e105aec2e0a99de174374bd), [`10ee3fa`](https://github.com/atlassian-labs/atlaspack/commit/10ee3fa5b75a92acde8973673d9b3c5b6f3958e5), [`bbe4e28`](https://github.com/atlassian-labs/atlaspack/commit/bbe4e28c89e5e9284bd730075d4d6f2a3cb37b21), [`1180103`](https://github.com/atlassian-labs/atlaspack/commit/118010351ed444f8178988afb3f77807154dd933), [`2bc93b1`](https://github.com/atlassian-labs/atlaspack/commit/2bc93b17cea07fd7cbb68acec84d8471345a22b4)]:
|
|
71
|
+
- @atlaspack/feature-flags@2.25.2
|
|
72
|
+
- @atlaspack/rust@3.8.2
|
|
73
|
+
- @atlaspack/utils@3.0.0
|
|
74
|
+
- @atlaspack/plugin@2.14.32
|
|
75
|
+
- @atlaspack/types@2.15.22
|
|
76
|
+
|
|
77
|
+
## 2.23.1
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- [#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.
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922), [`686a398`](https://github.com/atlassian-labs/atlaspack/commit/686a398faa1f9e19cbf9274add2c46e246bafba8)]:
|
|
84
|
+
- @atlaspack/diagnostic@2.14.4
|
|
85
|
+
- @atlaspack/feature-flags@2.25.1
|
|
86
|
+
- @atlaspack/plugin@2.14.31
|
|
87
|
+
- @atlaspack/rust@3.8.1
|
|
88
|
+
- @atlaspack/types@2.15.21
|
|
89
|
+
- @atlaspack/utils@2.19.3
|
|
90
|
+
|
|
91
|
+
## 2.23.0
|
|
92
|
+
|
|
93
|
+
### Minor Changes
|
|
94
|
+
|
|
95
|
+
- [#774](https://github.com/atlassian-labs/atlaspack/pull/774) [`602f8ed`](https://github.com/atlassian-labs/atlaspack/commit/602f8ed9d8381301df8b2cc82c1d5cf6f2f94fec) Thanks [@JakeLane](https://github.com/JakeLane)! - Add feature flag exportsRebindingOptimisation which detects cases where we don't need the rebinding helper for esm exports
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- [#780](https://github.com/atlassian-labs/atlaspack/pull/780) [`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1) Thanks [@JakeLane](https://github.com/JakeLane)! - Fix isStaticBindingSafe in v3
|
|
100
|
+
|
|
101
|
+
- 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)]:
|
|
102
|
+
- @atlaspack/feature-flags@2.25.0
|
|
103
|
+
- @atlaspack/rust@3.8.0
|
|
104
|
+
- @atlaspack/utils@2.19.2
|
|
105
|
+
- @atlaspack/plugin@2.14.30
|
|
106
|
+
- @atlaspack/types@2.15.20
|
|
107
|
+
|
|
108
|
+
## 2.22.2
|
|
109
|
+
|
|
110
|
+
### Patch Changes
|
|
111
|
+
|
|
112
|
+
- [#768](https://github.com/atlassian-labs/atlaspack/pull/768) [`58b9fb0`](https://github.com/atlassian-labs/atlaspack/commit/58b9fb037680a36a0b4af7890f2a03532095b88f) Thanks [@benjervis](https://github.com/benjervis)! - Fixes a small error in the scope hoisting V2 fixes that caused assets to be wrapped unnecessarily
|
|
113
|
+
|
|
114
|
+
## 2.22.1
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- [#763](https://github.com/atlassian-labs/atlaspack/pull/763) [`830261d`](https://github.com/atlassian-labs/atlaspack/commit/830261dcf4a40293090b61cab52fd75d5683c73f) Thanks [@benjervis](https://github.com/benjervis)! - Fixes scope hoisting by iterating from the main entry asset of a bundle when packaging. Behind the feature flag `applyScopeHoistingImprovementsV2`.
|
|
119
|
+
|
|
120
|
+
- Updated dependencies [[`830261d`](https://github.com/atlassian-labs/atlaspack/commit/830261dcf4a40293090b61cab52fd75d5683c73f), [`53dd47b`](https://github.com/atlassian-labs/atlaspack/commit/53dd47bd6d23cd47f87297347f03a609ab38a03d)]:
|
|
121
|
+
- @atlaspack/feature-flags@2.24.1
|
|
122
|
+
- @atlaspack/rust@3.7.0
|
|
123
|
+
- @atlaspack/utils@2.19.1
|
|
124
|
+
- @atlaspack/plugin@2.14.29
|
|
125
|
+
- @atlaspack/types@2.15.19
|
|
126
|
+
|
|
127
|
+
## 2.22.0
|
|
128
|
+
|
|
129
|
+
### Minor Changes
|
|
130
|
+
|
|
131
|
+
- [#762](https://github.com/atlassian-labs/atlaspack/pull/762) [`a5081c3`](https://github.com/atlassian-labs/atlaspack/commit/a5081c3f9207d28716ee4edd3841de1830ea4b80) Thanks [@JakeLane](https://github.com/JakeLane)! - Add feature flag 'useNewPrelude' which enables a micro-optimisation removing a 'for in' call and replacing with undefined check
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- 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)]:
|
|
136
|
+
- @atlaspack/feature-flags@2.24.0
|
|
137
|
+
- @atlaspack/utils@2.19.0
|
|
138
|
+
- @atlaspack/plugin@2.14.28
|
|
139
|
+
- @atlaspack/types@2.15.18
|
|
140
|
+
|
|
141
|
+
## 2.21.3
|
|
142
|
+
|
|
143
|
+
### Patch Changes
|
|
144
|
+
|
|
145
|
+
- Updated dependencies [[`3cfb7cf`](https://github.com/atlassian-labs/atlaspack/commit/3cfb7cfd90b78a5c48ce717e779ff789769825a3)]:
|
|
146
|
+
- @atlaspack/feature-flags@2.23.2
|
|
147
|
+
- @atlaspack/rust@3.6.2
|
|
148
|
+
- @atlaspack/utils@2.18.4
|
|
149
|
+
- @atlaspack/plugin@2.14.27
|
|
150
|
+
- @atlaspack/types@2.15.17
|
|
151
|
+
|
|
152
|
+
## 2.21.2
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- [#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
|
|
157
|
+
|
|
158
|
+
- [#755](https://github.com/atlassian-labs/atlaspack/pull/755) [`b6e72b6`](https://github.com/atlassian-labs/atlaspack/commit/b6e72b6dd2b517cbb0e700fa69e63332d3eacb1e) Thanks [@benjervis](https://github.com/benjervis)! - Allow runtime assets to be marked as requiring execution on load
|
|
159
|
+
|
|
160
|
+
- Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
|
|
161
|
+
- @atlaspack/feature-flags@2.23.1
|
|
162
|
+
- @atlaspack/diagnostic@2.14.3
|
|
163
|
+
- @atlaspack/plugin@2.14.26
|
|
164
|
+
- @atlaspack/types@2.15.16
|
|
165
|
+
- @atlaspack/utils@2.18.3
|
|
166
|
+
- @atlaspack/rust@3.6.1
|
|
167
|
+
|
|
168
|
+
## 2.21.1
|
|
169
|
+
|
|
170
|
+
### Patch Changes
|
|
171
|
+
|
|
172
|
+
- Updated dependencies [[`f6b3f22`](https://github.com/atlassian-labs/atlaspack/commit/f6b3f2276c7e417580b49c4879563aab51f156b1)]:
|
|
173
|
+
- @atlaspack/feature-flags@2.23.0
|
|
174
|
+
- @atlaspack/utils@2.18.2
|
|
175
|
+
- @atlaspack/plugin@2.14.25
|
|
176
|
+
- @atlaspack/types@2.15.15
|
|
177
|
+
|
|
178
|
+
## 2.21.0
|
|
179
|
+
|
|
180
|
+
### Minor Changes
|
|
181
|
+
|
|
182
|
+
- [#732](https://github.com/atlassian-labs/atlaspack/pull/732) [`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45) Thanks [@vykimnguyen](https://github.com/vykimnguyen)! - add tesseract context
|
|
183
|
+
|
|
184
|
+
### Patch Changes
|
|
185
|
+
|
|
186
|
+
- [#744](https://github.com/atlassian-labs/atlaspack/pull/744) [`3718bff`](https://github.com/atlassian-labs/atlaspack/commit/3718bff20484138e405e321472336ac058432e10) Thanks [@benjervis](https://github.com/benjervis)! - Fix the scope hoisting improvements feature by making all entry assets of a bundle
|
|
187
|
+
wrapped, which means there is no top level scope.
|
|
188
|
+
- 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)]:
|
|
189
|
+
- @atlaspack/rust@3.6.0
|
|
190
|
+
- @atlaspack/feature-flags@2.22.0
|
|
191
|
+
- @atlaspack/utils@2.18.1
|
|
192
|
+
- @atlaspack/plugin@2.14.24
|
|
193
|
+
- @atlaspack/types@2.15.14
|
|
194
|
+
|
|
195
|
+
## 2.20.0
|
|
196
|
+
|
|
197
|
+
### Minor Changes
|
|
198
|
+
|
|
199
|
+
- [#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
|
|
200
|
+
|
|
201
|
+
### Patch Changes
|
|
202
|
+
|
|
203
|
+
- Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
|
|
204
|
+
- @atlaspack/feature-flags@2.21.0
|
|
205
|
+
- @atlaspack/utils@2.18.0
|
|
206
|
+
- @atlaspack/rust@3.5.0
|
|
207
|
+
- @atlaspack/types@2.15.13
|
|
208
|
+
- @atlaspack/plugin@2.14.23
|
|
209
|
+
|
|
210
|
+
## 2.19.1
|
|
211
|
+
|
|
212
|
+
### Patch Changes
|
|
213
|
+
|
|
214
|
+
- [#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
|
|
215
|
+
|
|
216
|
+
- Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94), [`12bee0e`](https://github.com/atlassian-labs/atlaspack/commit/12bee0e23f0464d7f6bd3e24fbe0d19c126d587d)]:
|
|
217
|
+
- @atlaspack/feature-flags@2.20.1
|
|
218
|
+
- @atlaspack/diagnostic@2.14.2
|
|
219
|
+
- @atlaspack/plugin@2.14.22
|
|
220
|
+
- @atlaspack/types@2.15.12
|
|
221
|
+
- @atlaspack/utils@2.17.4
|
|
222
|
+
- @atlaspack/rust@3.4.2
|
|
223
|
+
|
|
224
|
+
## 2.19.0
|
|
225
|
+
|
|
226
|
+
### Minor Changes
|
|
227
|
+
|
|
228
|
+
- [#721](https://github.com/atlassian-labs/atlaspack/pull/721) [`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd) Thanks [@benjervis](https://github.com/benjervis)! - Add support for bundle merging based on `webpackChunkName` comments.
|
|
229
|
+
|
|
230
|
+
Adding a `webpackChunkName` comment to an import will allow the bundler to merge multiple imports into a single bundle.
|
|
231
|
+
|
|
232
|
+
e.g.:
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
import(/* webpackChunkName: "my-chunk" */ './my-module');
|
|
236
|
+
import(/* webpackChunkName: "my-chunk" */ './another-module');
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
This can be enabled with the feature flag `supportWebpackChunkName`.
|
|
240
|
+
|
|
241
|
+
### Patch Changes
|
|
242
|
+
|
|
243
|
+
- Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
|
|
244
|
+
- @atlaspack/feature-flags@2.20.0
|
|
245
|
+
- @atlaspack/types@2.15.11
|
|
246
|
+
- @atlaspack/utils@2.17.3
|
|
247
|
+
- @atlaspack/plugin@2.14.21
|
|
248
|
+
|
|
249
|
+
## 2.18.2
|
|
250
|
+
|
|
251
|
+
### Patch Changes
|
|
252
|
+
|
|
253
|
+
- [#702](https://github.com/atlassian-labs/atlaspack/pull/702) [`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa) Thanks [@alshdavid](https://github.com/alshdavid)! - Fixes to Flow types
|
|
254
|
+
|
|
255
|
+
- 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)]:
|
|
256
|
+
- @atlaspack/plugin@2.14.20
|
|
257
|
+
- @atlaspack/feature-flags@2.19.2
|
|
258
|
+
- @atlaspack/utils@2.17.2
|
|
259
|
+
- @atlaspack/types@2.15.10
|
|
260
|
+
|
|
261
|
+
## 2.18.1
|
|
262
|
+
|
|
263
|
+
### Patch Changes
|
|
264
|
+
|
|
265
|
+
- Updated dependencies [[`13aef17`](https://github.com/atlassian-labs/atlaspack/commit/13aef177eea289a6e40d2113b5ec1ac9be18a33d)]:
|
|
266
|
+
- @atlaspack/feature-flags@2.19.1
|
|
267
|
+
- @atlaspack/utils@2.17.1
|
|
268
|
+
- @atlaspack/types@2.15.9
|
|
269
|
+
- @atlaspack/plugin@2.14.19
|
|
270
|
+
|
|
271
|
+
## 2.18.0
|
|
272
|
+
|
|
273
|
+
### Minor Changes
|
|
274
|
+
|
|
275
|
+
- [#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
|
|
276
|
+
|
|
277
|
+
### Patch Changes
|
|
278
|
+
|
|
279
|
+
- 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)]:
|
|
280
|
+
- @atlaspack/feature-flags@2.19.0
|
|
281
|
+
- @atlaspack/utils@2.17.0
|
|
282
|
+
- @atlaspack/rust@3.4.1
|
|
283
|
+
- @atlaspack/types@2.15.8
|
|
284
|
+
- @atlaspack/plugin@2.14.18
|
|
285
|
+
|
|
286
|
+
## 2.17.1
|
|
287
|
+
|
|
288
|
+
### Patch Changes
|
|
289
|
+
|
|
290
|
+
- Updated dependencies [[`c75bf55`](https://github.com/atlassian-labs/atlaspack/commit/c75bf553fff4decc285b5fd499a275853b18f8f2)]:
|
|
291
|
+
- @atlaspack/rust@3.4.0
|
|
292
|
+
- @atlaspack/utils@2.16.1
|
|
293
|
+
- @atlaspack/types@2.15.7
|
|
294
|
+
- @atlaspack/plugin@2.14.17
|
|
295
|
+
|
|
296
|
+
## 2.17.0
|
|
297
|
+
|
|
298
|
+
### Minor Changes
|
|
299
|
+
|
|
300
|
+
- [#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 `asset-file-names-in-output` debug tool, which adds a comment to each asset inserted into a bundle that help identify it
|
|
301
|
+
|
|
302
|
+
### Patch Changes
|
|
303
|
+
|
|
304
|
+
- Updated dependencies [[`e8a60ff`](https://github.com/atlassian-labs/atlaspack/commit/e8a60ffbea41caef265786bbf73349771760081c), [`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
|
|
305
|
+
- @atlaspack/feature-flags@2.18.4
|
|
306
|
+
- @atlaspack/utils@2.16.0
|
|
307
|
+
- @atlaspack/types@2.15.6
|
|
308
|
+
- @atlaspack/plugin@2.14.16
|
|
309
|
+
|
|
310
|
+
## 2.16.2
|
|
311
|
+
|
|
312
|
+
### Patch Changes
|
|
313
|
+
|
|
314
|
+
- [#654](https://github.com/atlassian-labs/atlaspack/pull/654) [`4d7abde`](https://github.com/atlassian-labs/atlaspack/commit/4d7abde0a6faa148bcf330b08d820f171f853b76) Thanks [@marcins](https://github.com/marcins)! - Fixes constant inlining to work correctly with scope hoisting optimisations
|
|
315
|
+
|
|
316
|
+
- Updated dependencies [[`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be)]:
|
|
317
|
+
- @atlaspack/feature-flags@2.18.3
|
|
318
|
+
- @atlaspack/utils@2.15.3
|
|
319
|
+
- @atlaspack/types@2.15.5
|
|
320
|
+
- @atlaspack/plugin@2.14.15
|
|
321
|
+
|
|
322
|
+
## 2.16.1
|
|
323
|
+
|
|
324
|
+
### Patch Changes
|
|
325
|
+
|
|
326
|
+
- Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
|
|
327
|
+
- @atlaspack/feature-flags@2.18.2
|
|
328
|
+
- @atlaspack/utils@2.15.2
|
|
329
|
+
- @atlaspack/types@2.15.4
|
|
330
|
+
- @atlaspack/plugin@2.14.14
|
|
331
|
+
|
|
332
|
+
## 2.16.0
|
|
333
|
+
|
|
334
|
+
### Minor Changes
|
|
335
|
+
|
|
336
|
+
- [#644](https://github.com/atlassian-labs/atlaspack/pull/644) [`fc59be7`](https://github.com/atlassian-labs/atlaspack/commit/fc59be71f43dd87d3e6fb7f3f50c424d2b664858) Thanks [@marcins](https://github.com/marcins)! - Removes the unused unstable `forceSkipWrapAssets` feature
|
|
337
|
+
|
|
338
|
+
### Patch Changes
|
|
339
|
+
|
|
340
|
+
- [#633](https://github.com/atlassian-labs/atlaspack/pull/633) [`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b) Thanks [@sbhuiyan-atlassian](https://github.com/sbhuiyan-atlassian)! - Ported various HMR changes from Parcel
|
|
341
|
+
|
|
342
|
+
- Updated dependencies [[`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
|
|
343
|
+
- @atlaspack/feature-flags@2.18.1
|
|
344
|
+
- @atlaspack/types@2.15.3
|
|
345
|
+
- @atlaspack/utils@2.15.1
|
|
346
|
+
- @atlaspack/plugin@2.14.13
|
|
347
|
+
|
|
348
|
+
## 2.15.0
|
|
349
|
+
|
|
350
|
+
### Minor Changes
|
|
351
|
+
|
|
352
|
+
- [#627](https://github.com/atlassian-labs/atlaspack/pull/627) [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2) Thanks [@benjervis](https://github.com/benjervis)! - Expands the situations where scope hoisting may be applied to include assets with no dependencies, regardless of whether if they have a wrapped ancestor.
|
|
353
|
+
|
|
354
|
+
Can be enabled with the `applyScopeHoistingImprovement` feature flag.
|
|
355
|
+
|
|
356
|
+
### Patch Changes
|
|
357
|
+
|
|
358
|
+
- [#632](https://github.com/atlassian-labs/atlaspack/pull/632) [`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75) Thanks [@marcins](https://github.com/marcins)! - Added a new feature flag `inlineConstOptimisationFix` which when enabled changes the behaviour for output of constant modules. This fixes two issues with constant modules:
|
|
359
|
+
- Previously constant modules, if they needed a namespace anywhere, would have a namespace everywhere, with this change they only have a namespace in the bundles where needed.
|
|
360
|
+
- Previously in the case of wrapped assets, a constant module dependnecy of that wrapped asset would be rendered after the module - which meant the minifier would not be able to inline the constants safely. With this flag all constant modules are rendered at the top of the bundle.
|
|
361
|
+
|
|
362
|
+
- Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2), [`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
|
|
363
|
+
- @atlaspack/feature-flags@2.18.0
|
|
364
|
+
- @atlaspack/utils@2.15.0
|
|
365
|
+
- @atlaspack/types@2.15.2
|
|
366
|
+
- @atlaspack/plugin@2.14.12
|
|
367
|
+
|
|
368
|
+
## 2.14.11
|
|
369
|
+
|
|
370
|
+
### Patch Changes
|
|
371
|
+
|
|
372
|
+
- Updated dependencies [[`73ea3c4`](https://github.com/atlassian-labs/atlaspack/commit/73ea3c4d85d4401fdd15abcbf988237e890e7ad3), [`b1b3693`](https://github.com/atlassian-labs/atlaspack/commit/b1b369317c66f8a431c170df2ebba4fa5b2e38ef)]:
|
|
373
|
+
- @atlaspack/feature-flags@2.17.0
|
|
374
|
+
- @atlaspack/utils@2.14.11
|
|
375
|
+
- @atlaspack/types@2.15.1
|
|
376
|
+
- @atlaspack/plugin@2.14.11
|
|
377
|
+
|
|
378
|
+
## 2.14.10
|
|
379
|
+
|
|
380
|
+
### Patch Changes
|
|
381
|
+
|
|
382
|
+
- 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)]:
|
|
383
|
+
- @atlaspack/types@2.15.0
|
|
384
|
+
- @atlaspack/rust@3.3.5
|
|
385
|
+
- @atlaspack/plugin@2.14.10
|
|
386
|
+
- @atlaspack/utils@2.14.10
|
|
387
|
+
|
|
388
|
+
## 2.14.9
|
|
389
|
+
|
|
390
|
+
### Patch Changes
|
|
391
|
+
|
|
392
|
+
- 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)]:
|
|
393
|
+
- @atlaspack/rust@3.3.4
|
|
394
|
+
- @atlaspack/feature-flags@2.16.0
|
|
395
|
+
- @atlaspack/utils@2.14.9
|
|
396
|
+
- @atlaspack/types@2.14.9
|
|
397
|
+
- @atlaspack/plugin@2.14.9
|
|
398
|
+
|
|
3
399
|
## 2.14.8
|
|
4
400
|
|
|
5
401
|
### Patch Changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CJSOutputFormat = void 0;
|
|
4
|
+
class CJSOutputFormat {
|
|
5
|
+
constructor(packager) {
|
|
6
|
+
this.packager = packager;
|
|
7
|
+
}
|
|
8
|
+
buildBundlePrelude() {
|
|
9
|
+
let res = '';
|
|
10
|
+
let lines = 0;
|
|
11
|
+
for (let [source, specifiers] of this.packager.externals) {
|
|
12
|
+
// CJS only supports the namespace symbol. This ensures that all accesses
|
|
13
|
+
// are live and the `this` binding is correct.
|
|
14
|
+
let namespace = specifiers.get('*');
|
|
15
|
+
if (namespace) {
|
|
16
|
+
res += `var ${namespace} = require(${JSON.stringify(source)});\n`;
|
|
17
|
+
lines++;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
res += `require(${JSON.stringify(source)});\n`;
|
|
21
|
+
lines++;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (res.length > 0) {
|
|
25
|
+
res += '\n';
|
|
26
|
+
lines++;
|
|
27
|
+
}
|
|
28
|
+
return [res, lines];
|
|
29
|
+
}
|
|
30
|
+
buildBundlePostlude() {
|
|
31
|
+
return ['', 0];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.CJSOutputFormat = CJSOutputFormat;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DevPackager = void 0;
|
|
7
|
+
const utils_1 = require("@atlaspack/utils");
|
|
8
|
+
const source_map_1 = __importDefault(require("@parcel/source-map"));
|
|
9
|
+
const feature_flags_1 = require("@atlaspack/feature-flags");
|
|
10
|
+
const assert_1 = __importDefault(require("assert"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const fs_1 = __importDefault(require("fs"));
|
|
13
|
+
const utils_2 = require("./utils");
|
|
14
|
+
const PRELUDE = fs_1.default
|
|
15
|
+
.readFileSync(path_1.default.join(__dirname, 'dev-prelude.js'), 'utf8')
|
|
16
|
+
.trim()
|
|
17
|
+
.replace(/;$/, '');
|
|
18
|
+
class DevPackager {
|
|
19
|
+
constructor(options, bundleGraph, bundle, parcelRequireName) {
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.bundleGraph = bundleGraph;
|
|
22
|
+
this.bundle = bundle;
|
|
23
|
+
this.parcelRequireName = parcelRequireName;
|
|
24
|
+
}
|
|
25
|
+
async package() {
|
|
26
|
+
// Load assets
|
|
27
|
+
let queue = new utils_1.PromiseQueue({ maxConcurrent: 32 });
|
|
28
|
+
this.bundle.traverseAssets((asset) => {
|
|
29
|
+
queue.add(async () => {
|
|
30
|
+
let [code, mapBuffer] = await Promise.all([
|
|
31
|
+
asset.getCode(),
|
|
32
|
+
this.bundle.env.sourceMap && asset.getMapBuffer(),
|
|
33
|
+
]);
|
|
34
|
+
return { code, mapBuffer };
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
let results = await queue.run();
|
|
38
|
+
let assets = '';
|
|
39
|
+
let i = 0;
|
|
40
|
+
let first = true;
|
|
41
|
+
let map = new source_map_1.default(this.options.projectRoot);
|
|
42
|
+
let prefix = this.getPrefix();
|
|
43
|
+
let lineOffset = (0, utils_1.countLines)(prefix);
|
|
44
|
+
let script = null;
|
|
45
|
+
this.bundle.traverse((node) => {
|
|
46
|
+
let wrapped = first ? '' : ',';
|
|
47
|
+
if (node.type === 'dependency') {
|
|
48
|
+
let resolved = this.bundleGraph.getResolvedAsset(node.value, this.bundle);
|
|
49
|
+
if (resolved && resolved.type !== 'js') {
|
|
50
|
+
// if this is a reference to another javascript asset, we should not include
|
|
51
|
+
// its output, as its contents should already be loaded.
|
|
52
|
+
(0, assert_1.default)(!this.bundle.hasAsset(resolved));
|
|
53
|
+
wrapped +=
|
|
54
|
+
JSON.stringify(this.bundleGraph.getAssetPublicId(resolved)) +
|
|
55
|
+
':[function() {},{}]';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (node.type === 'asset') {
|
|
62
|
+
let asset = node.value;
|
|
63
|
+
(0, assert_1.default)(asset.type === 'js', 'all assets in a js bundle must be js assets');
|
|
64
|
+
// If this is the main entry of a script rather than a module, we need to hoist it
|
|
65
|
+
// outside the bundle wrapper function so that its variables are exposed as globals.
|
|
66
|
+
if (this.bundle.env.sourceType === 'script' &&
|
|
67
|
+
asset === this.bundle.getMainEntry()) {
|
|
68
|
+
// @ts-expect-error TS2322
|
|
69
|
+
script = results[i++];
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
let deps = {};
|
|
73
|
+
let dependencies = this.bundleGraph.getDependencies(asset);
|
|
74
|
+
for (let dep of dependencies) {
|
|
75
|
+
let resolved = this.bundleGraph.getResolvedAsset(dep, this.bundle);
|
|
76
|
+
let specifier = (0, utils_2.getSpecifier)(dep);
|
|
77
|
+
if (this.bundleGraph.isDependencySkipped(dep)) {
|
|
78
|
+
deps[specifier] = false;
|
|
79
|
+
}
|
|
80
|
+
else if (resolved) {
|
|
81
|
+
deps[specifier] = this.bundleGraph.getAssetPublicId(resolved);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// An external module - map placeholder to original specifier.
|
|
85
|
+
deps[specifier] = dep.specifier;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if ((0, feature_flags_1.getFeatureFlag)('hmrImprovements')) {
|
|
89
|
+
// Add dependencies for parcelRequire calls added by runtimes
|
|
90
|
+
// so that the HMR runtime can correctly traverse parents.
|
|
91
|
+
let hmrDeps = asset.meta.hmrDeps;
|
|
92
|
+
if (this.options.hmrOptions && Array.isArray(hmrDeps)) {
|
|
93
|
+
for (let id of hmrDeps) {
|
|
94
|
+
(0, assert_1.default)(typeof id === 'string');
|
|
95
|
+
deps[id] = id;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// @ts-expect-error TS2339
|
|
100
|
+
let { code, mapBuffer } = results[i];
|
|
101
|
+
let output = code || '';
|
|
102
|
+
wrapped +=
|
|
103
|
+
JSON.stringify(this.bundleGraph.getAssetPublicId(asset)) +
|
|
104
|
+
':[function(require,module,exports,__globalThis) {\n' +
|
|
105
|
+
output +
|
|
106
|
+
'\n},';
|
|
107
|
+
wrapped += JSON.stringify(deps);
|
|
108
|
+
wrapped += ']';
|
|
109
|
+
if (this.bundle.env.isNode() &&
|
|
110
|
+
asset.meta.has_node_replacements === true) {
|
|
111
|
+
const relPath = (0, utils_1.normalizeSeparators)(path_1.default.relative(this.bundle.target.distDir, path_1.default.dirname(asset.filePath)));
|
|
112
|
+
wrapped = wrapped.replace('$parcel$dirnameReplace', relPath);
|
|
113
|
+
wrapped = wrapped.replace('$parcel$filenameReplace', relPath);
|
|
114
|
+
}
|
|
115
|
+
if (this.bundle.env.sourceMap) {
|
|
116
|
+
if (mapBuffer) {
|
|
117
|
+
map.addBuffer(mapBuffer, lineOffset);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
map.addEmptyMap(path_1.default
|
|
121
|
+
.relative(this.options.projectRoot, asset.filePath)
|
|
122
|
+
.replace(/\\+/g, '/'), output, lineOffset);
|
|
123
|
+
}
|
|
124
|
+
lineOffset += (0, utils_1.countLines)(output) + 1;
|
|
125
|
+
}
|
|
126
|
+
i++;
|
|
127
|
+
}
|
|
128
|
+
assets += wrapped;
|
|
129
|
+
first = false;
|
|
130
|
+
});
|
|
131
|
+
let entries = this.bundle.getEntryAssets();
|
|
132
|
+
let mainEntry = this.bundle.getMainEntry();
|
|
133
|
+
if ((!this.isEntry() && this.bundle.env.outputFormat === 'global') ||
|
|
134
|
+
this.bundle.env.sourceType === 'script') {
|
|
135
|
+
// In async bundles we don't want the main entry to execute until we require it
|
|
136
|
+
// as there might be dependencies in a sibling bundle that hasn't loaded yet.
|
|
137
|
+
entries = entries.filter((a) => a.id !== mainEntry?.id);
|
|
138
|
+
mainEntry = null;
|
|
139
|
+
}
|
|
140
|
+
let contents = prefix +
|
|
141
|
+
'({' +
|
|
142
|
+
assets +
|
|
143
|
+
'},' +
|
|
144
|
+
JSON.stringify(entries.map((asset) => this.bundleGraph.getAssetPublicId(asset))) +
|
|
145
|
+
', ' +
|
|
146
|
+
JSON.stringify(mainEntry ? this.bundleGraph.getAssetPublicId(mainEntry) : null) +
|
|
147
|
+
', ' +
|
|
148
|
+
JSON.stringify(this.parcelRequireName) +
|
|
149
|
+
')' +
|
|
150
|
+
'\n';
|
|
151
|
+
// The entry asset of a script bundle gets hoisted outside the bundle wrapper function
|
|
152
|
+
// so that its variables become globals. We need to replace any require calls for
|
|
153
|
+
// runtimes with a parcelRequire call.
|
|
154
|
+
if (this.bundle.env.sourceType === 'script' && script) {
|
|
155
|
+
let entryMap;
|
|
156
|
+
// @ts-expect-error TS2339
|
|
157
|
+
let mapBuffer = script.mapBuffer;
|
|
158
|
+
if (mapBuffer) {
|
|
159
|
+
entryMap = new source_map_1.default(this.options.projectRoot, mapBuffer);
|
|
160
|
+
}
|
|
161
|
+
contents += (0, utils_2.replaceScriptDependencies)(this.bundleGraph, this.bundle,
|
|
162
|
+
// @ts-expect-error TS2339
|
|
163
|
+
script.code, entryMap, this.parcelRequireName);
|
|
164
|
+
if (this.bundle.env.sourceMap && entryMap) {
|
|
165
|
+
// @ts-expect-error TS2551
|
|
166
|
+
map.addSourceMap(entryMap, lineOffset);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
contents,
|
|
171
|
+
map,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
getPrefix() {
|
|
175
|
+
let interpreter;
|
|
176
|
+
let mainEntry = this.bundle.getMainEntry();
|
|
177
|
+
if (mainEntry && this.isEntry() && !this.bundle.target.env.isBrowser()) {
|
|
178
|
+
let _interpreter = mainEntry.meta.interpreter;
|
|
179
|
+
(0, assert_1.default)(_interpreter == null || typeof _interpreter === 'string');
|
|
180
|
+
interpreter = _interpreter;
|
|
181
|
+
}
|
|
182
|
+
let importScripts = '';
|
|
183
|
+
if (this.bundle.env.isWorker() || this.bundle.env.isTesseract()) {
|
|
184
|
+
let bundles = this.bundleGraph.getReferencedBundles(this.bundle);
|
|
185
|
+
for (let b of bundles) {
|
|
186
|
+
importScripts += `importScripts("${(0, utils_1.relativeBundlePath)(this.bundle, b)}");\n`;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return (
|
|
190
|
+
// If the entry asset included a hashbang, repeat it at the top of the bundle
|
|
191
|
+
(interpreter != null ? `#!${interpreter}\n` : '') +
|
|
192
|
+
importScripts +
|
|
193
|
+
PRELUDE);
|
|
194
|
+
}
|
|
195
|
+
isEntry() {
|
|
196
|
+
return (!this.bundleGraph.hasParentBundleOfType(this.bundle, 'js') ||
|
|
197
|
+
this.bundle.env.isIsolated() ||
|
|
198
|
+
this.bundle.bundleBehavior === 'isolated' ||
|
|
199
|
+
this.bundle.bundleBehavior === 'inlineIsolated');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
exports.DevPackager = DevPackager;
|