assembleWasmPackage function
Assemble an npm package from an already built Dart Wasm module.
Only the known runtime artifacts and explicitly selected documentation assets
are copied. metadata retains caller-owned JSON fields, including author and
contributors. Entrypoints, exports and the file list belong to this builder;
supplying those fields is an error rather than a silent override.
Existing managed output follows the same rebuild rules. Use assembleNativePackage for native artifacts; this function has no backend fallback.
Implementation
Future<Directory> assembleWasmPackage({
required BuiltModule module,
required Directory output,
required Map<String, Object?> metadata,
Map<String, File> assets = const {},
}) async {
if (module.target != BuildTarget.wasm) {
throw ArgumentError('assembleWasmPackage requires a Wasm module.');
}
return _assemblePackage(
modules: [module],
rootTarget: module.target,
output: output,
metadata: metadata,
assets: assets,
);
}