Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
content: fs.readFileSync(path.resolve(templatesDir, file)) + '',
input: JSON.stringify(input)
});
});
// node run.js --grep filter
if (argv.grep) {
var re = new RegExp(argv.grep);
templates = templates.filter(function(template) {
return re.test(template.name);
});
}
var xjst = {
next: require('../').bemhtml,
prev: require('bem-xjst').bemhtml
};
util._extend(benchmark.options, {
minSamples: (argv['min-samples'] | 0) || 50,
maxTime: (argv['max-time'] | 0) || 2
});
var suite = new benchmark.Suite();
function both(callback) {
callback('next', xjst.next);
if (argv.compare)
callback('prev', xjst.prev);
}
templates.forEach(function(template) {
function toHtml(source, input) {
return bemxjst.compile(ibem + source, {}).apply.call(input);
}
common.toHtml;
var fs = require('fs');
var bemhtmlPrev = require('bem-xjst').bemhtml;
var bemhtmlNext = require('bem-xjst').bemhtml;
var dataPath = './node_modules/web-data/data';
var files = fs.readdirSync(dataPath);
var templatesPrev = bemhtmlPrev.compile(fs.readFileSync('./node_modules/web-data/templates.js', 'utf8'));
var templatesNext = bemhtmlNext.compile(fs.readFileSync('./node_modules/web-data/templates.js', 'utf8'));
var argv = require('yargs')
.describe('bemjsons', 'amount of bemjsons (default 2000, max 2000)')
.describe('repeats', 'amount of repeats test')
.describe('verbose', 'verbose results')
.help('h')
.alias('help', 'h')
.argv;
var sortNumbers = function(a, b) { return (a < b) ? -1 : 1; };
var test = function() {
var xjst = require('bem-xjst');
var bemhtml = xjst.bemhtml.generate('', { exportName: 'BEMHTML' });
var bemtree = xjst.bemtree.generate('', { exportName: 'BEMTREE' });
module.exports = require('enb/lib/build-flow').create()
.name('bemxjst')
.target('target', '?.bemxjst.js')
.builder(function() {
return bemhtml
//.replace('api.exportApply(exports);', '')
.replace('if (typeof modules === "object") {', 'if (false && typeof modules === "object") {')
.replace('BEMHTML = buildBemXjst(_libs)', 'BEMHTML = buildBemXjst')
.replace('BEMHTML= buildBemXjst(glob)', 'BEMHTML = buildBemXjst')
.concat(bemtree)
//.replace('api.exportApply(exports);', '')
.replace('if (typeof modules === "object") {', 'if (false && typeof modules === "object") {')
.replace('BEMTREE = buildBemXjst(_libs)', 'BEMTREE = buildBemXjst')
.replace('BEMTREE= buildBemXjst(glob)', 'BEMTREE = buildBemXjst')
const path = require('path');
const bemLoader = require('bem-loader');
const CollectBemAssetsPlugin = bemLoader.CollectBemAssetsPlugin;
const fs = require('fs-extra');
const bemxjst = require('bem-xjst');
const bemhtml = bemxjst.bemhtml;
const templates = bemhtml.compile([
fs.readFileSync('./node_modules/bem-core/common.blocks/ua/ua.bemhtml'),
fs.readFileSync('./node_modules/bem-core/common.blocks/page/page.bemhtml'),
fs.readFileSync('./node_modules/bem-core/common.blocks/page/__js/page__js.bemhtml'),
fs.readFileSync('./node_modules/bem-core/common.blocks/page/__css/page__css.bemhtml'),
fs.readFileSync('./components/react/react.bemhtml.js')
].join(''));
fs.outputFile(
'./dist/index.html',
templates.apply({
block: 'page',
scripts: { elem: 'js', url: './main.js' },
content: { block: 'react' }
})
var fs = require('fs');
var bemhtmlPrev = require('bem-xjst').bemhtml;
var bemhtmlNext = require('bem-xjst').bemhtml;
var dataPath = './node_modules/web-data/data';
var files = fs.readdirSync(dataPath);
var templatesPrev = bemhtmlPrev.compile(fs.readFileSync('./node_modules/web-data/templates.js', 'utf8'));
var templatesNext = bemhtmlNext.compile(fs.readFileSync('./node_modules/web-data/templates.js', 'utf8'));
var argv = require('yargs')
.describe('bemjsons', 'amount of bemjsons (default 2000, max 2000)')
.describe('repeats', 'amount of repeats test')
.describe('verbose', 'verbose results')
.help('h')
.alias('help', 'h')
.argv;
var sortNumbers = function(a, b) { return (a < b) ? -1 : 1; };
match: function (json) {
var srcjs = compat.transpile(this.src),
compiled = bemxjst.compile(srcjs, {});
return beautifyHtml(compiled.apply.call (json));
}
};
var fs = require('fs');
var bemhtmlPrev = require('bem-xjst').bemhtml;
var bemhtmlNext = require('bem-xjst').bemhtml;
var dataPath = './node_modules/web-data/data';
var files = fs.readdirSync(dataPath);
var templatesPrev = bemhtmlPrev.compile(fs.readFileSync('./node_modules/web-data/templates.js', 'utf8'));
var templatesNext = bemhtmlNext.compile(fs.readFileSync('./node_modules/web-data/templates.js', 'utf8'));
var argv = require('yargs')
.describe('bemjsons', 'amount of bemjsons (default 2000, max 2000)')
.describe('repeats', 'amount of repeats test')
.describe('verbose', 'verbose results')
.help('h')
.alias('help', 'h')
.argv;
var sortNumbers = function(a, b) { return (a < b) ? -1 : 1; };
var test = function() {
var timesPrev = [];
var timesNext = [];
var res = { compile: '', applyPrev: [], applyNext: [] };
var fs = require('fs');
var bemhtmlPrev = require('bem-xjst').bemhtml;
var bemhtmlNext = require('bem-xjst').bemhtml;
var dataPath = './node_modules/web-data/data';
var files = fs.readdirSync(dataPath);
var templatesPrev = bemhtmlPrev.compile(fs.readFileSync('./node_modules/web-data/templates.js', 'utf8'));
var templatesNext = bemhtmlNext.compile(fs.readFileSync('./node_modules/web-data/templates.js', 'utf8'));
var argv = require('yargs')
.describe('bemjsons', 'amount of bemjsons (default 2000, max 2000)')
.describe('repeats', 'amount of repeats test')
.describe('verbose', 'verbose results')
.help('h')
.alias('help', 'h')
.argv;
var sortNumbers = function(a, b) { return (a < b) ? -1 : 1; };
var test = function() {
var timesPrev = [];
var timesNext = [];
var res = { compile: '', applyPrev: [], applyNext: [] };
var times = argv.bemjsons || 2000;
getCompiledResult : function(sources) {
sources = sources.join('\n');
var BEMHTML = require('bem-xjst/lib/bemhtml'),
exportName = this.getExportName(),
optimize = process.env[exportName + '_ENV'] !== 'development';
return BEMHTML.generate(sources, {
wrap : true,
exportName : exportName,
optimize : optimize,
cache : optimize && process.env[exportName + '_CACHE'] === 'on'
});
},