
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
enb-transform-flow
Advanced tools
Позволяет преобразовать исходный код с помощью произвольного набора преобразователей
npm i enb-transform-flow
Опции
Пример
[ require('enb-transform-flow/techs/tarnsform-flow'), {
sourceSuffixes: ['js'],
target: '?.js',
transformators: [
function (params) {
var result = require('babel').transform(params.code);
return {
code: result.code;
data: {
map: result.map
}
}
},
function (params) {
var result = require('uglify-js').minify(params.code);
return {
code: result.code;
data: {
map: result.map
}
}
}
]
} ]
[ require('enb-transform-flow/techs/tarnsform-flow'), {
sourceSuffixes: ['js'],
target: '_?.js',
transformators: [
/**
* Функция-трансформатор, запускающая обработку бабелем полученного кода
*
* @param {Object} params Параметры трансформатора
* @param {String} params.code Код, который нужно преобразовать
* @param {Object} params.queue Очередь для выполнения тасок в параллельных подпроцессах
* @param {Object} params.map sourcemap с предыдущего преобразования
* @param {String} params.filename Имя файла
* @returns {Promise}
*/
function (params) {
var compilerFilename = require('path').resolve(__dirname, './worker-tasks/babel-transformator');
var relativeFilename = "/" + path.relative(process.cwd(), params.filename);
return params.queue.push(compilerFilename, params.code, {
externalHelpers: 'var',
ast: false,
blacklist: ['useStrict'],
sourceMaps: true,
sourceFileName: relativeFilename,
filename: params.filename,
filenameRelative: relativeFilename
}).then(function (compiledObj) {
return {
code: compiledObj.code,
data: {
map: compiledObj.map
}
};
});
},
/**
* Функция-минификатор, запускающая минификацию uglifyjs'ом полученного кода
*
* @param {Object} params Параметры трансформатора
* @param {String} params.code Код, который нужно преобразовать
* @param {Object} params.queue Очередь для выполнения тасок в параллельных подпроцессах
* @param {Object} params.map sourcemap с предыдущего преобразования
* @param {String} params.filename Имя файла
* @returns {Promise}
*/
function (params) {
var code = params.code;
var queue = params.queue;
var compilerFilename = require('path').resolve(__dirname, './worker-tasks/uglifyjs-minifier');
return queue.push(compilerFilename, code, {
fromString: true
}).then(function (compiledObj) {
return {
code: compiledObj.code
}
});
}
]
} ]
FAQs
Enb tarnsformation flow tech
The npm package enb-transform-flow receives a total of 3 weekly downloads. As such, enb-transform-flow popularity was classified as not popular.
We found that enb-transform-flow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.