bem-techs-core
Advanced tools
Comparing version 0.1.1 to 0.2.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76137
39
2075
5
18
+ Addeddom-js@0.0.9
- Removed@colors/colors@1.6.0(transitive)
- Removed@dabh/diagnostics@2.0.3(transitive)
- Removed@types/triple-beam@1.3.5(transitive)
- Removedapw@0.3.14(transitive)
- Removedasync@3.2.6(transitive)
- Removedbem@0.6.16(transitive)
- Removedbenchmark@1.0.0(transitive)
- Removedborschik@0.3.5(transitive)
- Removedcli-table@0.2.0(transitive)
- Removedcoffee-script@1.12.7(transitive)
- Removedcollections@0.1.24(transitive)
- Removedcolor@3.2.1(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcolor-string@1.9.1(transitive)
- Removedcolors@0.3.00.6.2(transitive)
- Removedcolorspace@1.1.4(transitive)
- Removedcsso@1.3.12(transitive)
- Removedcssp@1.0.6(transitive)
- Removedenabled@2.0.0(transitive)
- Removedfecha@4.2.3(transitive)
- Removedfn.name@1.1.0(transitive)
- Removedfs-boot@0.0.9(transitive)
- Removedinherit@1.0.4(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis@0.3.0(transitive)
- Removedis-arrayish@0.3.2(transitive)
- Removedis-stream@2.0.1(transitive)
- Removedkuler@2.0.0(transitive)
- Removedlogform@2.7.0(transitive)
- Removedmime@1.2.11(transitive)
- Removedmimeparse@0.1.4(transitive)
- Removedmkdirp@0.3.5(transitive)
- Removedms@2.1.3(transitive)
- Removednode.extend@1.0.10(transitive)
- Removedometajs@3.1.19(transitive)
- Removedone-time@1.0.0(transitive)
- Removedq@0.8.4(transitive)
- Removedq-fs@0.1.36(transitive)
- Removedq-http@0.1.16(transitive)
- Removedq-io@0.0.181.9.4(transitive)
- Removedqq@0.3.5(transitive)
- Removedqs@0.1.0(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedreqf@1.0.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafe-stable-stringify@2.5.0(transitive)
- Removedsimple-swizzle@0.2.2(transitive)
- Removedstack-trace@0.0.10(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedtext-hex@1.0.0(transitive)
- Removedtriple-beam@1.4.1(transitive)
- Removedunderscore@1.3.3(transitive)
- Removedurl2@0.0.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedweak-map@1.0.0(transitive)
- Removedwinston@3.17.0(transitive)
- Removedwinston-transport@4.9.0(transitive)