MCPcopy Index your code
hub / github.com/webpack/minimizer-webpack-plugin / transform

Function transform

src/minify.js:387–410  ·  view source on GitHub ↗

* @param {string} options options * @returns {Promise } minified result

(options)

Source from the content-addressed store, hash-verified

385 * @returns {Promise<MinimizedResult>} minified result
386 */
387async 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
412module.exports = { minify, transform };

Callers 1

worker.test.jsFile · 0.90

Calls 1

minifyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…