* @param {string} options options * @returns {Promise } minified result
(options)
| 385 | * @returns {Promise<MinimizedResult>} minified result |
| 386 | */ |
| 387 | async function transform(options) { |
| 388 | // 'use strict' => this === undefined (Clean Scope) |
| 389 | // Safer for possible security issues, albeit not critical at all here |
| 390 | |
| 391 | const evaluatedOptions = |
| 392 | /** |
| 393 | * @template T |
| 394 | * @type {import("./index.js").InternalOptions<T>} |
| 395 | */ |
| 396 | ( |
| 397 | // eslint-disable-next-line no-new-func |
| 398 | new Function( |
| 399 | "exports", |
| 400 | "require", |
| 401 | "module", |
| 402 | "__filename", |
| 403 | "__dirname", |
| 404 | `'use strict'\nreturn ${options}`, |
| 405 | // eslint-disable-next-line n/exports-style |
| 406 | )(exports, require, module, __filename, __dirname) |
| 407 | ); |
| 408 | |
| 409 | return minify(evaluatedOptions); |
| 410 | } |
| 411 | |
| 412 | module.exports = { minify, transform }; |
no test coverage detected
searching dependent graphs…