| 123 | * @returns {string} stripped JS |
| 124 | */ |
| 125 | const stripTypes = (input) => { |
| 126 | try { |
| 127 | // Pass only `mode`. `sourceUrl` would emit a `//# sourceURL=…` pragma |
| 128 | // into the output (V8 debugger hint), and `sourceMap: true` is |
| 129 | // rejected in strip mode — we build the source map by hand instead. |
| 130 | // eslint-disable-next-line n/no-unsupported-features/node-builtins |
| 131 | return mod.stripTypeScriptTypes(input, { mode: "strip" }); |
| 132 | } catch (err) { |
| 133 | throw new ModuleBuildError(/** @type {Error} */ (err)); |
| 134 | } |
| 135 | }; |
| 136 | |
| 137 | /** |
| 138 | * Coerce a Buffer-or-string source to a UTF-8 string, dropping any BOM. |