Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/webpack-cli/lib/migrate/ |
Upload File : |
const jscodeshift = require("jscodeshift"); const pEachSeries = require("p-each-series"); const PLazy = require("p-lazy"); const loadersTransform = require("./loaders/loaders"); const resolveTransform = require("./resolve/resolve"); const removeJsonLoaderTransform = require("./removeJsonLoader/removeJsonLoader"); const uglifyJsPluginTransform = require("./uglifyJsPlugin/uglifyJsPlugin"); const loaderOptionsPluginTransform = require("./loaderOptionsPlugin/loaderOptionsPlugin"); const bannerPluginTransform = require("./bannerPlugin/bannerPlugin"); const extractTextPluginTransform = require("./extractTextPlugin/extractTextPlugin"); const removeDeprecatedPluginsTransform = require("./removeDeprecatedPlugins/removeDeprecatedPlugins"); const transformsObject = { loadersTransform, resolveTransform, removeJsonLoaderTransform, uglifyJsPluginTransform, loaderOptionsPluginTransform, bannerPluginTransform, extractTextPluginTransform, removeDeprecatedPluginsTransform }; const transformations = Object.keys(transformsObject).reduce((res, key) => { res[key] = (ast, source) => transformSingleAST(ast, source, transformsObject[key]); return res; }, {}); function transformSingleAST(ast, source, transformFunction) { return new PLazy((resolve, reject) => { setTimeout(_ => { try { resolve(transformFunction(jscodeshift, ast, source)); } catch (err) { reject(err); } }, 0); }); } /** * * Transforms a given piece of source code by applying selected transformations to the AST. * By default, transforms a webpack version 1 configuration file into a webpack version 2 * configuration file. * * @param {String} source - source file contents * @param {Function[]} [transforms] - List of transformation functions, defined in the * order to apply them in. By default, all defined transformations. * @param {Object} [options] - recast formatting options * @returns {String} source — transformed source code */ function transform(source, transforms, options) { const ast = jscodeshift(source); const recastOptions = Object.assign( { quote: "single" }, options ); transforms = transforms || Object.keys(transformations).map(k => transformations[k]); return pEachSeries(transforms, f => f(ast, source)) .then(_ => { return ast.toSource(recastOptions); }) .catch(err => { console.error(err); }); } module.exports = { transform, transformSingleAST, transformations };