/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v5.104.1
lib/util/magicComment.js
25 строк
645 B
Alexander Akait
perf: avoid extra `require` in some places (#19734)
25 июл 2025, 18:22
Не верифицирован
25 июл 2025, 18:22
1d6d841
Код
Авторство
О чём код?
/* MIT License http://www.opensource.org/licenses/mit-license.php Author Alexander Akait @alexander-akait */ "use strict"; const memoize = require("./memoize"); const getVm = memoize(() => require("vm")); // regexp to match at least one "magic comment" module.exports.createMagicCommentContext = () => getVm().createContext(undefined, { name: "Webpack Magic Comment Parser", codeGeneration: { strings: false, wasm: false } }); module.exports.webpackCommentRegExp = new RegExp( /(^|\W)webpack[A-Z]{1,}[A-Za-z]{1,}:/ ); // regexp to match at least one "magic comment" /** * @returns {import("vm").Context} magic comment context */