Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bem-techs-core

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bem-techs-core - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

lib/i18n/i18n-js.js

9

package.json
{
"name": "bem-techs-core",
"version": "0.1.1",
"version": "0.2.0",
"description": "Core bem tech modules",

@@ -32,3 +32,3 @@ "main": "index.js",

"bem-smoke": "~0.3.0",
"bem": "~0.6.15",
"bem": "~1.0.0-alpha4",
"sinon": "~1.7.3",

@@ -39,3 +39,3 @@ "sinon-chai": "~2.4.0",

"peerDependencies": {
"bem": "~0.6.15"
"bem": "~1.0.0"
},

@@ -45,3 +45,4 @@ "dependencies": {

"bemhtml-compat": "0.0.10",
"bem-xjst": "~0.3.1"
"bem-xjst": "~0.3.1",
"dom-js": "0.0.9"
},

@@ -48,0 +49,0 @@ "directories": {

'use strict';
var compat = require('bemhtml-compat');

@@ -9,6 +8,4 @@

getBuildSuffixesMap: function() {
return {
'bemhtml.js': ['bemhtml', 'bemhtml.xjst']
};
getBuildSuffixesMap : function() {
return { 'bemhtml.js' : ['bemhtml', 'bemhtml.xjst'] };
},

@@ -33,5 +30,4 @@

getBuildResult : function(files, suffix, output, opts) {
var _t = this;
return this.__base(files, suffix, output, opts)
.then(_t.getCompiledResult.bind(_t));
.then(this.getCompiledResult.bind(this));
},

@@ -38,0 +34,0 @@

@@ -7,6 +7,4 @@ 'use strict';

getBuildSuffixesMap: function() {
return {
'bemtree.js': ['bemtree']
};
getSuffixes : function() {
return ['bemtree'];
},

@@ -18,2 +16,6 @@

getBuildSuffixes : function() {
return ['bemtree.js'];
},
getCompiledResult : function(sources) {

@@ -20,0 +22,0 @@ sources = sources.join('\n');

'use strict';
var PATH = require('path'),
BEM = require('bem'),
Q = BEM.require('q'),
ymPath = require.resolve('ym');
ymPath = require.resolve('ym'),
Deps = require('bem/lib/techs/v2/deps.js').Deps;

@@ -12,23 +12,33 @@ exports.baseTechName = 'vanilla.js';

getSuffixes : function() {
return ['vanilla.js', 'browser.js', 'js'];
transformBuildDecl: function(decl) {
var ss = this.getWeakSuffixesMap();
return decl
.then(function(decl){
var deps = new Deps().parseDepsDecl(decl)
.filter(function(dependson) {
return ((dependson.item.tech in ss) || (!dependson.item.tech));
}).map(function(item){
return item.item;
});
return {deps: deps};
});
},
getCreateSuffixes : function() {
return ['browser.js'];
getWeakBuildSuffixesMap:function(){
return { 'js' : ['vanilla.js', 'browser.js', 'js'] };
},
getBuildSuffixes : function() {
return ['js'];
getBuildSuffixesMap:function(){
return { 'js' : ['browser.js', 'js'] };
},
getBuildSuffixesMap : function() {
return {
'js' : this.getSuffixes()
};
getCreateSuffixes : function() {
return ['browser.js'];
},
getYmChunk : function(output) {
var outputDir = PATH.resolve(output, '..'),
ymRelPath = PATH.relative(outputDir, ymPath);
var outputDir = PATH.resolve(output, '..');
var ymRelPath = PATH.relative(outputDir, ymPath);
return this.getBuildResultChunk(ymRelPath, ymPath);

@@ -35,0 +45,0 @@ },

'use strict';
var BEM = require('bem'),
Q = BEM.require('q');
Q = BEM.require('q'),
Deps = require('bem/lib/techs/v2/deps.js').Deps;
exports.API_VER = 2;

@@ -11,40 +11,52 @@

getBuildSuffixesMap: function() {
return {
'js': ['vanilla.js', 'js', 'browser.js', 'bemhtml', 'bemhtml.xjst']
};
getWeakBuildSuffixesMap:function(){
return { 'js' : ['browser.js', 'vanilla.js', 'js', 'bemhtml', 'bemhtml.xjst'] };
},
getTechBuildResults: function(techName, decl, output, opts) {
opts = Object.create(opts);
opts.force = true;
var tech = this.context.createTech(techName);
return tech.getBuildResults(decl, this.context.getLevels(), output, opts);
getBuildSuffixesMap:function(){
return { 'js' : ['browser.js', 'js'] };
},
transformBuildDecl: function(decl) {
var buildSuffixes = this.getWeakBuildSuffixesMap();
var sourceSuffixes = this.getWeakSuffixesMap();
return decl
.then(function(decl){
var deps = new Deps().parseDepsDecl(decl)
.filter(function(dependsOn, dependent) {
return (((dependsOn.item.tech in sourceSuffixes) && dependent.item.tech in buildSuffixes) ||
(!dependsOn.item.tech && !dependent.item.tech));
}).map(function(item){
return item.item;
});
return {deps: deps};
});
},
getBuildResult: function(files, suffix, output, opts) {
var _this = this;
return this.context.opts.declaration
.then(function(decl) {
var browserJsResults = _this.getTechBuildResults('browser.js', decl, output, opts);
getBuildResult:function(files, suffix, output, opts){
if (!decl.depsByTechs || ! decl.depsByTechs.js) {
return browserJsResults;
}
var bemhtmlTech = this.context.createTech('bemhtml'),
browserTech = this.context.createTech('browser.js'),
decl = this.transformBuildDecl(this.context.opts.declaration);
var bemhtmlDecl = {
deps: decl.depsByTechs.js.bemhtml
};
if(!(browserTech.API_VER === 2 && bemhtmlTech.API_VER === 2)){
return Q.reject(this.getTechName() + ' can\'t use v1 techs to produce pieces of result');
}
var bemhtmlResults = _this.getTechBuildResults('bemhtml', bemhtmlDecl, output, opts);
opts = Object.create(opts);
opts.force = true;
return Q.all([browserJsResults, bemhtmlResults])
.spread(function(browserJs, bemhtml) {
return [
browserJs.js.join(''),
bemhtml['bemhtml.js']
].join('\n');
});
return Q.all(
[
bemhtmlTech.getBuildResults(
bemhtmlTech.transformBuildDecl(decl),
this.context.getLevels(),output,opts),
browserTech.getBuildResults(
browserTech.transformBuildDecl(decl),
this.context.getLevels(),output,opts)])
.spread(function(bemhtml,browser){
var result = browser.js;
result.push(bemhtml['bemhtml.js']+'\n');
return result;
});

@@ -51,0 +63,0 @@ }

'use strict';
var BEM = require('bem'),

@@ -7,4 +6,2 @@ Q = BEM.require('q'),

exports.API_VER = 2;
exports.techMixin = {

@@ -17,5 +14,5 @@

.then(function(c) {
/*globals BEMHTML:true*/
/** @name BEMHTML variable appears after runInThisContext() call */
VM.runInThisContext(c, path);
/*globals BEMHTML:true*/
return BEMHTML;

@@ -22,0 +19,0 @@ });

@@ -7,20 +7,14 @@ 'use strict';

getSuffixes : function() {
return ['vanilla.js', 'node.js'];
getWeakBuildSuffixesMap: function(){
return { 'node.js' : ['vanilla.js', 'node.js'] };
},
getCreateSuffixes : function() {
return ['node.js'];
getBuildSuffixesMap: function(){
return { 'node.js' : ['node.js'] };
},
getBuildSuffixes : function() {
getCreateSuffixes : function() {
return ['node.js'];
},
getBuildSuffixesMap : function() {
return {
'node.js' : this.getSuffixes()
};
},
getYmChunk : function() {

@@ -34,5 +28,5 @@ return [

getBuildResult : function(files, suffix, output, opts) {
getBuildResult : function() {
var ymChunk = this.getYmChunk();
return this.__base(files, suffix, output, opts)
return this.__base.apply(this, arguments)
.then(function(res) {

@@ -39,0 +33,0 @@ return [ymChunk].concat(res);

'use strict';
var BEM = require('bem'),

@@ -10,16 +9,6 @@ Template = BEM.require('./template');

getSuffixes : function() {
return ['vanilla.js'];
},
getBuildSuffixes : function() {
return ['vanilla.js'];
},
getBuildSuffixesMap : function() {
return this.getSuffixes()
.reduce(function(map, suffix) {
map[suffix] = [suffix];
return map;
}, {});
return {
'js':['vanilla.js']
};
},

@@ -26,0 +15,0 @@

@@ -9,16 +9,14 @@ 'use strict';

deps: [
{block: 'block'}
],
depsByTechs: {
js: {
bemhtml: [
{block: 'block'}
{block: 'block'},
{
block: 'block',
tech: 'js',
shouldDeps: [
{block: 'block', tech: 'bemhtml'}
]
}
}
]
};
beforeEach(function() {
beforeEach(function(done) {
tech = BEMSmoke.testTech(require.resolve('../techs/browser.js+bemhtml.js'))

@@ -50,3 +48,4 @@ .withTechMap({

})
.build('/out', decl);
.build('/out', decl)
.notify(done);
});

@@ -64,3 +63,2 @@

'',
'',
'compiled:',

@@ -71,2 +69,3 @@ '',

'/* end: block/block.bemhtml.xjst */',
'',
'')

@@ -73,0 +72,0 @@ .notify(done);

@@ -96,3 +96,3 @@ 'use strict';

})
.producesFile('/out.vanilla.js')
.producesFile('/out.js')
.withContent('/* block/block.vanilla.js: begin */ /**/',

@@ -99,0 +99,0 @@ '//block;',

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc