@@ -142,6 +142,48 @@ can be added as a non-externalizable dependency. In this case
142
142
simply add the path to the JavaScript file in the ` deps_files `
143
143
list in the ` node.gyp ` file.
144
144
145
+ ## Common approach for dependencies with WASM components
146
+
147
+ WASM components within dependencies are most often built
148
+ outside of the regular Node.js ` make build ` step. They also
149
+ require different tools.
150
+
151
+ It is important that the tools and their versions used to build
152
+ WASM components shipped within Node.js are well documented and
153
+ be available if needed to rebuild/update older Node.js versions.
154
+
155
+ In order to minimize the different number of tools and versions
156
+ used to build WASM components and to document and ensure future
157
+ availability, the project builds and maintains a common
158
+ [ wasm-builder] ( https://github.com/nodejs/wasm-builder ) container
159
+ that should be use to build WASM components in Node.js
160
+ dependencies.
161
+
162
+ The container provides a durable copy of the versions of the tools
163
+ used for a specific build which are under the control of the Node.js
164
+ project. In addition, the tools and verions are documented through metadata
165
+ within the container in the ` /home/node/metadata directory ` .
166
+
167
+ The available tools can be found by looking at the current version of the
168
+ [ Dockerfile] ( https://github.com/nodejs/wasm-builder/blob/main/container-build-info/Dockerfile )
169
+ used to create the container.
170
+
171
+ If additional WASM tool are needed beyond those available in the
172
+ container, additions should be PR'd into the wasm-builder container.
173
+
174
+ Examples of using the container include:
175
+
176
+ * [ build/wasm.js] ( https://github.com/nodejs/undici/blob/main/build/wasm.js ) from undici
177
+ * [ tools/build-wasm.js] ( https://github.com/nodejs/amaro/blob/main/tools/build-wasm.js ) from amaro
178
+
179
+ In addition to using the container to build WASM components, the goal is also
180
+ for the WASM components and final files that are shipped with Node.js to be
181
+ built by the [ dep-updaters] ( https://github.com/nodejs/node/tree/main/tools/dep_updaters )
182
+ that are run on a regular basis and that they use only the files available in the Node.js
183
+ repo for the dependency. For example, being able to rebuild the WASM and files that
184
+ we ship in Node.js using only the files in
185
+ [ ../deps/undici] ( https://github.com/nodejs/node/tree/main/deps/undici ) .
186
+
145
187
## Updating dependencies
146
188
147
189
Most dependencies are automatically updated by
0 commit comments