@atlaspack/core 2.19.2 → 2.19.3-typescript-80839fbd5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/lib/AssetGraph.js +25 -10
- package/lib/Atlaspack.js +47 -7
- package/lib/AtlaspackConfig.js +24 -6
- package/lib/AtlaspackConfig.schema.js +0 -4
- package/lib/BundleGraph.js +78 -17
- package/lib/CommittedAsset.js +6 -0
- package/lib/Dependency.js +2 -0
- package/lib/Environment.js +2 -2
- package/lib/EnvironmentManager.js +6 -0
- package/lib/IdentifierRegistry.js +1 -3
- package/lib/PackagerRunner.js +10 -5
- package/lib/ReporterRunner.js +6 -9
- package/lib/RequestTracker.js +28 -11
- package/lib/SymbolPropagation.js +52 -7
- package/lib/Transformation.js +15 -7
- package/lib/UncommittedAsset.js +10 -7
- package/lib/Validation.js +18 -2
- package/lib/applyRuntimes.js +5 -0
- package/lib/assetUtils.js +5 -3
- package/lib/atlaspack-v3/AtlaspackV3.js +10 -2
- package/lib/atlaspack-v3/NapiWorkerPool.js +3 -0
- package/lib/atlaspack-v3/fs.js +3 -1
- package/lib/atlaspack-v3/index.js +28 -1
- package/lib/atlaspack-v3/jsCallable.js +0 -2
- package/lib/atlaspack-v3/worker/compat/asset-symbols.js +5 -3
- package/lib/atlaspack-v3/worker/compat/bitflags.js +5 -5
- package/lib/atlaspack-v3/worker/compat/dependency.js +3 -0
- package/lib/atlaspack-v3/worker/compat/environment.js +2 -3
- package/lib/atlaspack-v3/worker/compat/mutable-asset.js +8 -3
- package/lib/atlaspack-v3/worker/compat/plugin-config.js +3 -5
- package/lib/atlaspack-v3/worker/compat/plugin-options.js +1 -0
- package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +3 -0
- package/lib/atlaspack-v3/worker/compat/target.js +2 -0
- package/lib/atlaspack-v3/worker/worker.js +18 -5
- package/lib/constants.js +0 -1
- package/lib/dumpGraphToGraphViz.js +70 -15
- package/lib/index.js +17 -1
- package/lib/loadAtlaspackPlugin.js +3 -0
- package/lib/loadDotEnv.js +4 -1
- package/lib/projectPath.js +5 -0
- package/lib/public/Asset.js +14 -2
- package/lib/public/Bundle.js +3 -3
- package/lib/public/BundleGraph.js +7 -2
- package/lib/public/BundleGroup.js +2 -2
- package/lib/public/Config.js +27 -13
- package/lib/public/Dependency.js +4 -2
- package/lib/public/Environment.js +2 -2
- package/lib/public/MutableBundleGraph.js +33 -7
- package/lib/public/PluginOptions.js +1 -0
- package/lib/public/Symbols.js +63 -14
- package/lib/public/Target.js +3 -2
- package/lib/registerCoreWithSerializer.js +2 -3
- package/lib/requests/AssetGraphRequest.js +15 -3
- package/lib/requests/AssetGraphRequestRust.js +7 -4
- package/lib/requests/AssetRequest.js +21 -5
- package/lib/requests/AtlaspackBuildRequest.js +6 -2
- package/lib/requests/AtlaspackConfigRequest.js +15 -11
- package/lib/requests/BundleGraphRequest.js +6 -6
- package/lib/requests/ConfigRequest.js +1 -0
- package/lib/requests/DevDepRequest.js +20 -4
- package/lib/requests/EntryRequest.js +9 -0
- package/lib/requests/PackageRequest.js +7 -2
- package/lib/requests/PathRequest.js +20 -5
- package/lib/requests/TargetRequest.js +72 -40
- package/lib/requests/ValidationRequest.js +5 -1
- package/lib/requests/WriteBundleRequest.js +24 -8
- package/lib/requests/WriteBundlesRequest.js +26 -6
- package/lib/requests/asset-graph-dot.js +1 -7
- package/lib/rustWorkerThreadDylibHack.js +0 -1
- package/lib/types.js +2 -0
- package/lib/utils.js +13 -2
- package/lib/worker.js +9 -6
- package/package.json +24 -23
- package/src/{AssetGraph.js → AssetGraph.ts} +53 -47
- package/src/{Atlaspack.js → Atlaspack.ts} +75 -38
- package/src/{AtlaspackConfig.schema.js → AtlaspackConfig.schema.ts} +16 -19
- package/src/{AtlaspackConfig.js → AtlaspackConfig.ts} +81 -54
- package/src/{BundleGraph.js → BundleGraph.ts} +188 -120
- package/src/{CommittedAsset.js → CommittedAsset.ts} +14 -12
- package/src/{Dependency.js → Dependency.ts} +48 -39
- package/src/{Environment.js → Environment.ts} +8 -9
- package/src/{EnvironmentManager.js → EnvironmentManager.ts} +14 -5
- package/src/{IdentifierRegistry.js → IdentifierRegistry.ts} +1 -4
- package/src/{InternalConfig.js → InternalConfig.ts} +18 -20
- package/src/{PackagerRunner.js → PackagerRunner.ts} +67 -59
- package/src/{ReporterRunner.js → ReporterRunner.ts} +13 -18
- package/src/{RequestTracker.js → RequestTracker.ts} +255 -206
- package/src/{SymbolPropagation.js → SymbolPropagation.ts} +157 -44
- package/src/{TargetDescriptor.schema.js → TargetDescriptor.schema.ts} +0 -1
- package/src/{Transformation.js → Transformation.ts} +67 -61
- package/src/{UncommittedAsset.js → UncommittedAsset.ts} +34 -33
- package/src/{Validation.js → Validation.ts} +32 -17
- package/src/{applyRuntimes.js → applyRuntimes.ts} +27 -25
- package/src/{assetUtils.js → assetUtils.ts} +44 -33
- package/src/atlaspack-v3/{AtlaspackV3.js → AtlaspackV3.ts} +20 -15
- package/src/atlaspack-v3/{NapiWorkerPool.js → NapiWorkerPool.ts} +10 -5
- package/src/atlaspack-v3/{fs.js → fs.ts} +3 -4
- package/src/atlaspack-v3/{index.js → index.ts} +2 -4
- package/src/atlaspack-v3/jsCallable.ts +14 -0
- package/src/atlaspack-v3/worker/compat/{asset-symbols.js → asset-symbols.ts} +52 -49
- package/src/atlaspack-v3/worker/compat/{bitflags.js → bitflags.ts} +8 -10
- package/src/atlaspack-v3/worker/compat/{dependency.js → dependency.ts} +12 -12
- package/src/atlaspack-v3/worker/compat/{environment.js → environment.ts} +4 -8
- package/src/atlaspack-v3/worker/compat/{index.js → index.ts} +0 -1
- package/src/atlaspack-v3/worker/compat/{mutable-asset.js → mutable-asset.ts} +20 -19
- package/src/atlaspack-v3/worker/compat/{plugin-config.js → plugin-config.ts} +26 -29
- package/src/atlaspack-v3/worker/compat/{plugin-logger.js → plugin-logger.ts} +0 -2
- package/src/atlaspack-v3/worker/compat/{plugin-options.js → plugin-options.ts} +4 -5
- package/src/atlaspack-v3/worker/compat/{plugin-tracer.js → plugin-tracer.ts} +2 -2
- package/src/atlaspack-v3/worker/compat/{target.js → target.ts} +3 -4
- package/src/atlaspack-v3/worker/{worker.js → worker.ts} +78 -64
- package/src/{constants.js → constants.ts} +0 -3
- package/src/{dumpGraphToGraphViz.js → dumpGraphToGraphViz.ts} +73 -28
- package/src/{index.js → index.ts} +2 -1
- package/src/{loadAtlaspackPlugin.js → loadAtlaspackPlugin.ts} +11 -9
- package/src/{loadDotEnv.js → loadDotEnv.ts} +2 -2
- package/src/{projectPath.js → projectPath.ts} +20 -9
- package/src/public/{Asset.js → Asset.ts} +29 -23
- package/src/public/{Bundle.js → Bundle.ts} +17 -19
- package/src/public/{BundleGraph.js → BundleGraph.ts} +71 -48
- package/src/public/{BundleGroup.js → BundleGroup.ts} +5 -8
- package/src/public/{Config.js → Config.ts} +63 -39
- package/src/public/{Dependency.js → Dependency.ts} +16 -14
- package/src/public/{Environment.js → Environment.ts} +11 -14
- package/src/public/{MutableBundleGraph.js → MutableBundleGraph.ts} +33 -17
- package/src/public/{PluginOptions.js → PluginOptions.ts} +5 -5
- package/src/public/{Symbols.js → Symbols.ts} +109 -36
- package/src/public/{Target.js → Target.ts} +6 -5
- package/src/{registerCoreWithSerializer.js → registerCoreWithSerializer.ts} +6 -6
- package/src/requests/{AssetGraphRequest.js → AssetGraphRequest.ts} +51 -45
- package/src/requests/{AssetGraphRequestRust.js → AssetGraphRequestRust.ts} +18 -19
- package/src/requests/{AssetRequest.js → AssetRequest.ts} +22 -17
- package/src/requests/{AtlaspackBuildRequest.js → AtlaspackBuildRequest.ts} +30 -31
- package/src/requests/{AtlaspackConfigRequest.js → AtlaspackConfigRequest.ts} +61 -51
- package/src/requests/{BundleGraphRequest.js → BundleGraphRequest.ts} +38 -41
- package/src/requests/{ConfigRequest.js → ConfigRequest.ts} +40 -43
- package/src/requests/{DevDepRequest.js → DevDepRequest.ts} +42 -30
- package/src/requests/{EntryRequest.js → EntryRequest.ts} +43 -31
- package/src/requests/{PackageRequest.js → PackageRequest.ts} +21 -21
- package/src/requests/{PathRequest.js → PathRequest.ts} +45 -37
- package/src/requests/{TargetRequest.js → TargetRequest.ts} +196 -153
- package/src/requests/{ValidationRequest.js → ValidationRequest.ts} +18 -17
- package/src/requests/{WriteBundleRequest.js → WriteBundleRequest.ts} +63 -41
- package/src/requests/{WriteBundlesRequest.js → WriteBundlesRequest.ts} +38 -27
- package/src/requests/{asset-graph-dot.js → asset-graph-dot.ts} +8 -12
- package/src/{resolveOptions.js → resolveOptions.ts} +6 -8
- package/src/{rustWorkerThreadDylibHack.js → rustWorkerThreadDylibHack.ts} +1 -4
- package/src/{serializerCore.browser.js → serializerCore.browser.ts} +2 -3
- package/src/{summarizeRequest.js → summarizeRequest.ts} +17 -5
- package/src/types.ts +637 -0
- package/src/{utils.js → utils.ts} +45 -20
- package/src/{worker.js → worker.ts} +44 -34
- package/test/{AssetGraph.test.js → AssetGraph.test.ts} +4 -8
- package/test/{Atlaspack.test.js → Atlaspack.test.ts} +5 -10
- package/test/{AtlaspackConfig.test.js → AtlaspackConfig.test.ts} +0 -5
- package/test/{AtlaspackConfigRequest.test.js → AtlaspackConfigRequest.test.ts} +3 -15
- package/test/{BundleGraph.test.js → BundleGraph.test.ts} +8 -13
- package/test/{Dependency.test.js → Dependency.test.ts} +2 -3
- package/test/{EntryRequest.test.js → EntryRequest.test.ts} +1 -6
- package/test/{Environment.test.js → Environment.test.ts} +2 -5
- package/test/{EnvironmentManager.test.js → EnvironmentManager.test.ts} +7 -9
- package/test/{IdentifierRegistry.test.js → IdentifierRegistry.test.ts} +2 -4
- package/test/{InternalAsset.test.js → InternalAsset.test.ts} +2 -7
- package/test/{PublicAsset.test.js → PublicAsset.test.ts} +2 -7
- package/test/{PublicBundle.test.js → PublicBundle.test.ts} +1 -2
- package/test/{PublicDependency.test.js → PublicDependency.test.ts} +0 -2
- package/test/{PublicEnvironment.test.js → PublicEnvironment.test.ts} +0 -2
- package/test/{PublicMutableBundleGraph.test.js → PublicMutableBundleGraph.test.ts} +6 -11
- package/test/{RequestTracker.test.js → RequestTracker.test.ts} +26 -36
- package/test/{SymbolPropagation.test.js → SymbolPropagation.test.ts} +124 -74
- package/test/{TargetRequest.test.js → TargetRequest.test.ts} +3 -17
- package/test/public/{Config.test.js → Config.test.ts} +7 -11
- package/test/requests/{AssetGraphRequestRust.test.js → AssetGraphRequestRust.test.ts} +0 -1
- package/test/requests/{ConfigRequest.test.js → ConfigRequest.test.ts} +19 -22
- package/test/requests/{DevDepRequest.test.js → DevDepRequest.test.ts} +0 -2
- package/test/{test-utils.js → test-utils.ts} +0 -2
- package/test/{utils.test.js → utils.test.ts} +1 -3
- package/tsconfig.json +4 -0
- package/src/atlaspack-v3/jsCallable.js +0 -18
- package/src/types.js +0 -603
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright (c) 2024 Atlassian US., Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/lib/AssetGraph.js
CHANGED
|
@@ -71,7 +71,11 @@ function nodeFromDep(dep) {
|
|
|
71
71
|
}
|
|
72
72
|
function nodeFromAssetGroup(assetGroup) {
|
|
73
73
|
return {
|
|
74
|
-
id: (0, _rust().hashString)(
|
|
74
|
+
id: (0, _rust().hashString)(
|
|
75
|
+
// @ts-expect-error TS2345
|
|
76
|
+
(0, _projectPath.fromProjectPathRelative)(assetGroup.filePath) +
|
|
77
|
+
// @ts-expect-error TS2345
|
|
78
|
+
(0, _EnvironmentManager.toEnvironmentId)(assetGroup.env) + String(assetGroup.isSource) + String(assetGroup.sideEffects) + (assetGroup.code ?? '') + ':' + (assetGroup.pipeline ?? '') + ':' + (assetGroup.query ?? '')),
|
|
75
79
|
type: 'asset_group',
|
|
76
80
|
value: assetGroup,
|
|
77
81
|
usedSymbolsDownDirty: true
|
|
@@ -101,6 +105,8 @@ function nodeFromEntryFile(entry) {
|
|
|
101
105
|
value: entry
|
|
102
106
|
};
|
|
103
107
|
}
|
|
108
|
+
|
|
109
|
+
// @ts-expect-error TS2417
|
|
104
110
|
class AssetGraph extends _graph().ContentGraph {
|
|
105
111
|
/**
|
|
106
112
|
* Incremented when the asset graph is modified such that it requires a bundling pass.
|
|
@@ -138,13 +144,9 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
138
144
|
this.undeferredDependencies = new Set();
|
|
139
145
|
this.envCache = new Map();
|
|
140
146
|
}
|
|
141
|
-
|
|
142
|
-
// $FlowFixMe[prop-missing]
|
|
143
147
|
static deserialize(opts) {
|
|
144
148
|
return new AssetGraph(opts);
|
|
145
149
|
}
|
|
146
|
-
|
|
147
|
-
// $FlowFixMe[prop-missing]
|
|
148
150
|
serialize() {
|
|
149
151
|
return {
|
|
150
152
|
...super.serialize(),
|
|
@@ -206,6 +208,8 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
206
208
|
if ((0, _featureFlags().getFeatureFlag)('environmentDeduplication')) {
|
|
207
209
|
return;
|
|
208
210
|
}
|
|
211
|
+
|
|
212
|
+
// @ts-expect-error TS2345
|
|
209
213
|
let {
|
|
210
214
|
id,
|
|
211
215
|
context
|
|
@@ -215,6 +219,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
215
219
|
if (env) {
|
|
216
220
|
input.env = (0, _EnvironmentManager.toEnvironmentRef)(env);
|
|
217
221
|
} else {
|
|
222
|
+
// @ts-expect-error TS2345
|
|
218
223
|
this.envCache.set(idAndContext, (0, _EnvironmentManager.fromEnvironmentId)(input.env));
|
|
219
224
|
}
|
|
220
225
|
}
|
|
@@ -242,8 +247,6 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
242
247
|
let existing = this.getNodeByContentKey(node.id);
|
|
243
248
|
if (existing != null) {
|
|
244
249
|
(0, _assert().default)(existing.type === node.type);
|
|
245
|
-
// $FlowFixMe[incompatible-type] Checked above
|
|
246
|
-
// $FlowFixMe[prop-missing]
|
|
247
250
|
existing.value = node.value;
|
|
248
251
|
let existingId = this.getNodeIdByContentKey(node.id);
|
|
249
252
|
this.updateNode(existingId, existing);
|
|
@@ -275,6 +278,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
275
278
|
env: target.env,
|
|
276
279
|
isEntry: true,
|
|
277
280
|
needsStableName: true,
|
|
281
|
+
// @ts-expect-error TS2322
|
|
278
282
|
symbols: (0, _EnvironmentManager.fromEnvironmentId)(target.env).isLibrary ? new Map([['*', {
|
|
279
283
|
local: '*',
|
|
280
284
|
isWeak: true,
|
|
@@ -283,7 +287,9 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
283
287
|
}));
|
|
284
288
|
if ((0, _EnvironmentManager.fromEnvironmentId)(node.value.env).isLibrary) {
|
|
285
289
|
// in library mode, all of the entry's symbols are "used"
|
|
290
|
+
// @ts-expect-error TS2345
|
|
286
291
|
node.usedSymbolsDown.add('*');
|
|
292
|
+
// @ts-expect-error TS2345
|
|
287
293
|
node.usedSymbolsUp.set('*', undefined);
|
|
288
294
|
}
|
|
289
295
|
return node;
|
|
@@ -361,7 +367,10 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
361
367
|
if (traversedNode.type === 'asset') {
|
|
362
368
|
let hasDeferred = this.getNodeIdsConnectedFrom(traversedNodeId).some(childNodeId => {
|
|
363
369
|
let childNode = (0, _nullthrows().default)(this.getNode(childNodeId));
|
|
364
|
-
|
|
370
|
+
// @ts-expect-error TS2339
|
|
371
|
+
return childNode.hasDeferred == null ? false :
|
|
372
|
+
// @ts-expect-error TS2339
|
|
373
|
+
childNode.hasDeferred;
|
|
365
374
|
});
|
|
366
375
|
if (!hasDeferred) {
|
|
367
376
|
delete traversedNode.hasDeferred;
|
|
@@ -370,6 +379,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
370
379
|
hasDeferred
|
|
371
380
|
};
|
|
372
381
|
} else if (traversedNode.type === 'asset_group' && nodeId !== traversedNodeId) {
|
|
382
|
+
// @ts-expect-error TS2339
|
|
373
383
|
if (!(ctx !== null && ctx !== void 0 && ctx.hasDeferred)) {
|
|
374
384
|
this.safeToIncrementallyBundle = false;
|
|
375
385
|
this.setNeedsBundling();
|
|
@@ -400,7 +410,9 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
400
410
|
}
|
|
401
411
|
let isDeferrable = [...dependencySymbols].every(([, {
|
|
402
412
|
isWeak
|
|
403
|
-
}]) => isWeak) && sideEffects === false && canDefer &&
|
|
413
|
+
}]) => isWeak) && sideEffects === false && canDefer &&
|
|
414
|
+
// @ts-expect-error TS2345
|
|
415
|
+
!dependencySymbols.has('*');
|
|
404
416
|
if (!isDeferrable) {
|
|
405
417
|
return false;
|
|
406
418
|
}
|
|
@@ -426,7 +438,9 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
426
438
|
if (this.undeferredDependencies.has(d)) {
|
|
427
439
|
return false;
|
|
428
440
|
}
|
|
429
|
-
let depIsDeferrable = d.symbols && !((0, _EnvironmentManager.fromEnvironmentId)(d.env).isLibrary && d.isEntry) &&
|
|
441
|
+
let depIsDeferrable = d.symbols && !((0, _EnvironmentManager.fromEnvironmentId)(d.env).isLibrary && d.isEntry) &&
|
|
442
|
+
// @ts-expect-error TS2345
|
|
443
|
+
!d.symbols.has('*') && ![...d.symbols.keys()].some(symbol => {
|
|
430
444
|
var _resolvedAsset$symbol;
|
|
431
445
|
let assetSymbol = (_resolvedAsset$symbol = resolvedAsset.symbols) === null || _resolvedAsset$symbol === void 0 || (_resolvedAsset$symbol = _resolvedAsset$symbol.get(symbol)) === null || _resolvedAsset$symbol === void 0 ? void 0 : _resolvedAsset$symbol.local;
|
|
432
446
|
return assetSymbol != null && symbols.has(assetSymbol);
|
|
@@ -441,6 +455,7 @@ class AssetGraph extends _graph().ContentGraph {
|
|
|
441
455
|
resolveAssetGroup(assetGroup, assets, correspondingRequest) {
|
|
442
456
|
this.normalizeEnvironment(assetGroup);
|
|
443
457
|
let assetGroupNode = nodeFromAssetGroup(assetGroup);
|
|
458
|
+
// @ts-expect-error TS2322
|
|
444
459
|
assetGroupNode = this.getNodeByContentKey(assetGroupNode.id);
|
|
445
460
|
if (!assetGroupNode) {
|
|
446
461
|
return;
|
package/lib/Atlaspack.js
CHANGED
|
@@ -123,28 +123,43 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
123
123
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
124
124
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
125
125
|
// eslint-disable-next-line no-unused-vars
|
|
126
|
+
|
|
126
127
|
(0, _registerCoreWithSerializer.registerCoreWithSerializer)();
|
|
127
128
|
const INTERNAL_TRANSFORM = exports.INTERNAL_TRANSFORM = Symbol('internal_transform');
|
|
128
129
|
const INTERNAL_RESOLVE = exports.INTERNAL_RESOLVE = Symbol('internal_resolve');
|
|
129
|
-
|
|
130
|
+
let WORKER_PATH = exports.WORKER_PATH = _path().default.join(__dirname, 'worker.js');
|
|
131
|
+
if (process.env.ATLASPACK_REGISTER_USE_SRC === 'true') {
|
|
132
|
+
exports.WORKER_PATH = WORKER_PATH = _path().default.join(__dirname, 'worker.ts');
|
|
133
|
+
}
|
|
130
134
|
class Atlaspack {
|
|
135
|
+
// @ts-expect-error TS2564
|
|
131
136
|
#requestTracker;
|
|
137
|
+
// @ts-expect-error TS2564
|
|
132
138
|
#config;
|
|
139
|
+
// @ts-expect-error TS2564
|
|
133
140
|
#farm;
|
|
134
141
|
#initialized = false;
|
|
142
|
+
// @ts-expect-error TS2564
|
|
135
143
|
#disposable;
|
|
136
144
|
#initialOptions;
|
|
145
|
+
// @ts-expect-error TS2564
|
|
137
146
|
#reporterRunner;
|
|
138
147
|
#resolvedOptions = null;
|
|
148
|
+
// @ts-expect-error TS2564
|
|
139
149
|
#optionsRef;
|
|
150
|
+
// @ts-expect-error TS2564
|
|
140
151
|
#watchAbortController;
|
|
141
152
|
#watchQueue = new (_utils2().PromiseQueue)({
|
|
142
153
|
maxConcurrent: 1
|
|
143
154
|
});
|
|
155
|
+
// @ts-expect-error TS2564
|
|
144
156
|
#watchEvents;
|
|
145
157
|
#watcherSubscription;
|
|
146
158
|
#watcherCount = 0;
|
|
147
159
|
#requestedAssetIds = new Set();
|
|
160
|
+
|
|
161
|
+
// @ts-expect-error TS2564
|
|
162
|
+
|
|
148
163
|
constructor(options) {
|
|
149
164
|
this.#initialOptions = options;
|
|
150
165
|
}
|
|
@@ -194,8 +209,6 @@ class Atlaspack {
|
|
|
194
209
|
throw new Error('Atlaspack v3 must be run with lmdb lite cache');
|
|
195
210
|
}
|
|
196
211
|
const lmdb = resolvedOptions.cache.getNativeRef();
|
|
197
|
-
|
|
198
|
-
// $FlowFixMe
|
|
199
212
|
const version = require('../package.json').version;
|
|
200
213
|
await lmdb.put('current_session_version', Buffer.from(version));
|
|
201
214
|
let threads = undefined;
|
|
@@ -206,12 +219,12 @@ class Atlaspack {
|
|
|
206
219
|
}
|
|
207
220
|
rustAtlaspack = await _atlaspackV.AtlaspackV3.create({
|
|
208
221
|
...options,
|
|
222
|
+
// @ts-expect-error TS2353
|
|
209
223
|
corePath: _path().default.join(__dirname, '..'),
|
|
210
224
|
threads,
|
|
211
225
|
entries: Array.isArray(entries) ? entries : entries == null ? undefined : [entries],
|
|
212
226
|
env: resolvedOptions.env,
|
|
213
227
|
fs: inputFS && new _atlaspackV.FileSystemV3(inputFS),
|
|
214
|
-
// $FlowFixMe ProjectPath is a string
|
|
215
228
|
defaultTargetOptions: resolvedOptions.defaultTargetOptions,
|
|
216
229
|
lmdb
|
|
217
230
|
});
|
|
@@ -221,6 +234,7 @@ class Atlaspack {
|
|
|
221
234
|
});
|
|
222
235
|
}
|
|
223
236
|
}
|
|
237
|
+
// @ts-expect-error TS2454
|
|
224
238
|
this.rustAtlaspack = rustAtlaspack;
|
|
225
239
|
let {
|
|
226
240
|
config
|
|
@@ -266,6 +280,7 @@ class Atlaspack {
|
|
|
266
280
|
this.#requestTracker = await _RequestTracker.default.init({
|
|
267
281
|
farm: this.#farm,
|
|
268
282
|
options: resolvedOptions,
|
|
283
|
+
// @ts-expect-error TS2454
|
|
269
284
|
rustAtlaspack
|
|
270
285
|
});
|
|
271
286
|
this.#initialized = true;
|
|
@@ -332,6 +347,8 @@ class Atlaspack {
|
|
|
332
347
|
if (!this.#initialized) {
|
|
333
348
|
await this._init();
|
|
334
349
|
}
|
|
350
|
+
|
|
351
|
+
// @ts-expect-error TS7034
|
|
335
352
|
let watchEventsDisposable;
|
|
336
353
|
if (cb) {
|
|
337
354
|
watchEventsDisposable = this.#watchEvents.addListener(({
|
|
@@ -351,8 +368,11 @@ class Atlaspack {
|
|
|
351
368
|
this.#watchQueue.run();
|
|
352
369
|
}
|
|
353
370
|
this.#watcherCount++;
|
|
371
|
+
|
|
372
|
+
// @ts-expect-error TS7034
|
|
354
373
|
let unsubscribePromise;
|
|
355
374
|
const unsubscribe = async () => {
|
|
375
|
+
// @ts-expect-error TS7005
|
|
356
376
|
if (watchEventsDisposable) {
|
|
357
377
|
watchEventsDisposable.dispose();
|
|
358
378
|
}
|
|
@@ -370,9 +390,12 @@ class Atlaspack {
|
|
|
370
390
|
};
|
|
371
391
|
return {
|
|
372
392
|
unsubscribe() {
|
|
393
|
+
// @ts-expect-error TS7005
|
|
373
394
|
if (unsubscribePromise == null) {
|
|
374
395
|
unsubscribePromise = unsubscribe();
|
|
375
396
|
}
|
|
397
|
+
|
|
398
|
+
// @ts-expect-error TS7005
|
|
376
399
|
return unsubscribePromise;
|
|
377
400
|
}
|
|
378
401
|
};
|
|
@@ -415,13 +438,14 @@ class Atlaspack {
|
|
|
415
438
|
});
|
|
416
439
|
this.#requestedAssetIds.clear();
|
|
417
440
|
await (0, _dumpGraphToGraphViz.default)(
|
|
418
|
-
//
|
|
441
|
+
// @ts-expect-error TS2345
|
|
419
442
|
this.#requestTracker.graph, 'RequestGraph', _RequestTracker.requestGraphEdgeTypes);
|
|
420
443
|
let event = {
|
|
421
444
|
type: 'buildSuccess',
|
|
422
445
|
changedAssets: new Map(Array.from(changedAssets).map(([id, asset]) => [id, (0, _Asset.assetFromValue)(asset, options)])),
|
|
423
446
|
bundleGraph: new _BundleGraph.default(bundleGraph, (bundle, bundleGraph, options) => _Bundle.PackagedBundle.getWithInfo(bundle, bundleGraph, options, bundleInfo.get(bundle.id)), options),
|
|
424
447
|
buildTime: Date.now() - startTime,
|
|
448
|
+
// @ts-expect-error TS7006
|
|
425
449
|
requestBundle: async bundle => {
|
|
426
450
|
let bundleNode = bundleGraph._graph.getNodeByContentKey(bundle.id);
|
|
427
451
|
(0, _assert().default)((bundleNode === null || bundleNode === void 0 ? void 0 : bundleNode.type) === 'bundle', 'Bundle does not exist');
|
|
@@ -447,15 +471,21 @@ class Atlaspack {
|
|
|
447
471
|
}
|
|
448
472
|
let results = await this.#watchQueue.run();
|
|
449
473
|
let result = results.filter(Boolean).pop();
|
|
474
|
+
// @ts-expect-error TS18049
|
|
450
475
|
if (result.type === 'buildFailure') {
|
|
476
|
+
// @ts-expect-error TS18049
|
|
451
477
|
throw new BuildError(result.diagnostics);
|
|
452
478
|
}
|
|
453
479
|
return result;
|
|
454
480
|
},
|
|
455
481
|
unstable_requestStats: this.#requestTracker.flushStats()
|
|
456
482
|
};
|
|
483
|
+
|
|
484
|
+
// @ts-expect-error TS2345
|
|
457
485
|
await this.#reporterRunner.report(event);
|
|
458
|
-
await this.#requestTracker.runRequest(
|
|
486
|
+
await this.#requestTracker.runRequest(
|
|
487
|
+
// @ts-expect-error TS2345
|
|
488
|
+
(0, _ValidationRequest.default)({
|
|
459
489
|
optionsRef: this.#optionsRef,
|
|
460
490
|
assetRequests
|
|
461
491
|
}), {
|
|
@@ -464,6 +494,8 @@ class Atlaspack {
|
|
|
464
494
|
if (this.#reporterRunner.errors.length) {
|
|
465
495
|
throw this.#reporterRunner.errors;
|
|
466
496
|
}
|
|
497
|
+
|
|
498
|
+
// @ts-expect-error TS2322
|
|
467
499
|
return event;
|
|
468
500
|
} catch (e) {
|
|
469
501
|
if (e instanceof _utils.BuildAbortError) {
|
|
@@ -475,7 +507,10 @@ class Atlaspack {
|
|
|
475
507
|
diagnostics: Array.isArray(diagnostic) ? diagnostic : [diagnostic],
|
|
476
508
|
unstable_requestStats: this.#requestTracker.flushStats()
|
|
477
509
|
};
|
|
510
|
+
|
|
511
|
+
// @ts-expect-error TS2345
|
|
478
512
|
await this.#reporterRunner.report(event);
|
|
513
|
+
// @ts-expect-error TS2322
|
|
479
514
|
return event;
|
|
480
515
|
} finally {
|
|
481
516
|
if (this.isProfiling) {
|
|
@@ -588,7 +623,11 @@ class Atlaspack {
|
|
|
588
623
|
requestedAssetIds: this.#requestedAssetIds
|
|
589
624
|
};
|
|
590
625
|
const start = Date.now();
|
|
591
|
-
const result = await this.#requestTracker.runRequest(this.rustAtlaspack != null ?
|
|
626
|
+
const result = await this.#requestTracker.runRequest(this.rustAtlaspack != null ?
|
|
627
|
+
// @ts-expect-error TS2345
|
|
628
|
+
(0, _AssetGraphRequestRust.createAssetGraphRequestRust)(this.rustAtlaspack)(input) :
|
|
629
|
+
// @ts-expect-error TS2345
|
|
630
|
+
(0, _AssetGraphRequest.default)(input), {
|
|
592
631
|
force: true
|
|
593
632
|
});
|
|
594
633
|
const duration = Date.now() - start;
|
|
@@ -675,6 +714,7 @@ class Atlaspack {
|
|
|
675
714
|
return null;
|
|
676
715
|
}
|
|
677
716
|
return {
|
|
717
|
+
// @ts-expect-error TS2322
|
|
678
718
|
filePath: (0, _projectPath.fromProjectPath)(projectRoot, res.filePath),
|
|
679
719
|
code: res.code,
|
|
680
720
|
query: res.query,
|
package/lib/AtlaspackConfig.js
CHANGED
|
@@ -90,6 +90,7 @@ class AtlaspackConfig {
|
|
|
90
90
|
}
|
|
91
91
|
async loadPlugin(node) {
|
|
92
92
|
let plugin = await this._loadPlugin(node);
|
|
93
|
+
// @ts-expect-error TS2322
|
|
93
94
|
return {
|
|
94
95
|
...plugin,
|
|
95
96
|
name: node.packageName,
|
|
@@ -129,7 +130,9 @@ class AtlaspackConfig {
|
|
|
129
130
|
if (allowEmpty) {
|
|
130
131
|
return [];
|
|
131
132
|
}
|
|
132
|
-
throw await this.missingPluginError(this.transformers,
|
|
133
|
+
throw await this.missingPluginError(this.transformers,
|
|
134
|
+
// @ts-expect-error TS2345
|
|
135
|
+
(0, _diagnostic().md)`No transformers found for __${(0, _projectPath.fromProjectPathRelative)(filePath)}__` + (pipeline != null ? ` with pipeline: '${pipeline}'` : '') + '.', '/transformers');
|
|
133
136
|
}
|
|
134
137
|
return this.loadPlugins(transformers);
|
|
135
138
|
}
|
|
@@ -154,7 +157,9 @@ class AtlaspackConfig {
|
|
|
154
157
|
async getPackager(filePath) {
|
|
155
158
|
let packager = this.matchGlobMap((0, _projectPath.toProjectPathUnsafe)(filePath), this.packagers);
|
|
156
159
|
if (!packager) {
|
|
157
|
-
throw await this.missingPluginError(this.packagers,
|
|
160
|
+
throw await this.missingPluginError(this.packagers,
|
|
161
|
+
// @ts-expect-error TS2345
|
|
162
|
+
(0, _diagnostic().md)`No packager found for __${filePath}__.`, '/packagers');
|
|
158
163
|
}
|
|
159
164
|
return this.loadPlugin(packager);
|
|
160
165
|
}
|
|
@@ -183,7 +188,9 @@ class AtlaspackConfig {
|
|
|
183
188
|
async getCompressors(filePath) {
|
|
184
189
|
let compressors = this.matchGlobMapPipelines((0, _projectPath.toProjectPathUnsafe)(filePath), this.compressors) ?? [];
|
|
185
190
|
if (compressors.length === 0) {
|
|
186
|
-
throw await this.missingPluginError(this.compressors,
|
|
191
|
+
throw await this.missingPluginError(this.compressors,
|
|
192
|
+
// @ts-expect-error TS2345
|
|
193
|
+
(0, _diagnostic().md)`No compressors found for __${filePath}__.`, '/compressors');
|
|
187
194
|
}
|
|
188
195
|
return this.loadPlugins(compressors);
|
|
189
196
|
}
|
|
@@ -196,6 +203,7 @@ class AtlaspackConfig {
|
|
|
196
203
|
let [patternPipeline, patternGlob] = pattern.split(':');
|
|
197
204
|
if (!patternGlob) {
|
|
198
205
|
patternGlob = patternPipeline;
|
|
206
|
+
// @ts-expect-error TS2322
|
|
199
207
|
patternPipeline = null;
|
|
200
208
|
}
|
|
201
209
|
let re = this.regexCache.get(patternGlob);
|
|
@@ -235,6 +243,7 @@ class AtlaspackConfig {
|
|
|
235
243
|
}
|
|
236
244
|
for (let pattern in globMap) {
|
|
237
245
|
if (this.isGlobMatch(filePath, pattern)) {
|
|
246
|
+
// @ts-expect-error TS2345
|
|
238
247
|
matches.push(globMap[pattern]);
|
|
239
248
|
}
|
|
240
249
|
}
|
|
@@ -250,7 +259,7 @@ class AtlaspackConfig {
|
|
|
250
259
|
return pipeline;
|
|
251
260
|
};
|
|
252
261
|
let res = flatten();
|
|
253
|
-
//
|
|
262
|
+
// @ts-expect-error TS2322
|
|
254
263
|
return res;
|
|
255
264
|
}
|
|
256
265
|
async missingPluginError(plugins, message, key) {
|
|
@@ -258,7 +267,13 @@ class AtlaspackConfig {
|
|
|
258
267
|
if (Array.isArray(plugins)) {
|
|
259
268
|
configsWithPlugin = new Set(getConfigPaths(this.options, plugins));
|
|
260
269
|
} else {
|
|
261
|
-
configsWithPlugin = new Set(Object.keys(plugins).flatMap(k =>
|
|
270
|
+
configsWithPlugin = new Set(Object.keys(plugins).flatMap(k =>
|
|
271
|
+
// @ts-expect-error TS7053
|
|
272
|
+
Array.isArray(plugins[k]) ?
|
|
273
|
+
// @ts-expect-error TS7053
|
|
274
|
+
getConfigPaths(this.options, plugins[k]) :
|
|
275
|
+
// @ts-expect-error TS7053
|
|
276
|
+
[getConfigPath(this.options, plugins[k])]));
|
|
262
277
|
}
|
|
263
278
|
if (configsWithPlugin.size === 0) {
|
|
264
279
|
configsWithPlugin.add((0, _projectPath.fromProjectPath)(this.options.projectRoot, this.filePath));
|
|
@@ -291,8 +306,11 @@ class AtlaspackConfig {
|
|
|
291
306
|
}
|
|
292
307
|
exports.AtlaspackConfig = AtlaspackConfig;
|
|
293
308
|
function getConfigPaths(options, nodes) {
|
|
294
|
-
return nodes
|
|
309
|
+
return nodes
|
|
310
|
+
// @ts-expect-error TS2339
|
|
311
|
+
.map(node => node !== '...' ? getConfigPath(options, node) : null).filter(Boolean);
|
|
295
312
|
}
|
|
296
313
|
function getConfigPath(options, node) {
|
|
314
|
+
// @ts-expect-error TS2339
|
|
297
315
|
return (0, _projectPath.fromProjectPath)(options.projectRoot, node.resolveFrom);
|
|
298
316
|
}
|
|
@@ -6,14 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.validatePackageName = validatePackageName;
|
|
8
8
|
// Parcel validates plugin package names due to:
|
|
9
|
-
//
|
|
10
9
|
// * https://github.com/parcel-bundler/parcel/issues/3397#issuecomment-521353931
|
|
11
|
-
//
|
|
12
10
|
// Ultimately:
|
|
13
|
-
//
|
|
14
11
|
// * We do not care about package names
|
|
15
12
|
// * Validation makes interop between parcel/atlaspack confusing.
|
|
16
|
-
//
|
|
17
13
|
function validatePackageName(
|
|
18
14
|
// eslint-disable-next-line no-unused-vars
|
|
19
15
|
pkg,
|