1export async function transformSource( 2 source, { url, format }, defaultTransformSource) { 3 if (format === 'module') { 4 if (typeof source !== 'string') { 5 source = new TextDecoder().decode(source); 6 } 7 return { 8 source: source.replace(`'A message';`, `'A message'.toUpperCase();`) 9 }; 10 } else { // source could be a buffer, e.g. for WASM 11 return defaultTransformSource( 12 source, {url, format}, defaultTransformSource); 13 } 14} 15