@pzlr/build-core
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -5,2 +5,3 @@ 'use strict'; | ||
$C = require('collection.js'), | ||
Sugar = require('sugar'), | ||
fs = require('fs-extra-promise'), | ||
@@ -15,7 +16,13 @@ path = require('path'); | ||
dependencies = [], | ||
rootDependencies = []; | ||
rootDependencies = [], | ||
dependenciesIgnore = []; | ||
$C(config.dependencies).forEach((src) => { | ||
src = path.join(cwd, 'node_modules', src); | ||
$C(config.dependencies).forEach((obj) => { | ||
const | ||
src = path.join(cwd, 'node_modules', Sugar.Object.isString(obj) ? obj : obj.src); | ||
dependenciesIgnore.push({ | ||
exclude: $C(obj.exclude).reduce((map, el) => (map[el] = true, map), {}), | ||
}); | ||
let | ||
@@ -54,7 +61,7 @@ cfg = path.join(src, '.pzlrrc'); | ||
const | ||
withExt = Boolean(path.extname(path.basename(name))), | ||
advExt = withExt ? '' : 'index.js', | ||
baseExt = path.extname(name), | ||
advExt = baseExt ? '' : 'index.js', | ||
base = path.join(sourceDirs[0], config.blockDir, name); | ||
if (!withExt && sourceDirs.length === 1 || fs.existsSync(path.join(base, advExt))) { | ||
if (!baseExt && sourceDirs.length === 1 || fs.existsSync(path.join(base, advExt))) { | ||
return base; | ||
@@ -67,2 +74,6 @@ } | ||
if (baseExt && dependenciesIgnore[i - 1].exclude[baseExt]) { | ||
continue; | ||
} | ||
if (fs.existsSync(path.join(src, advExt))) { | ||
@@ -73,3 +84,3 @@ return src; | ||
return withExt ? null : base; | ||
return baseExt ? null : base; | ||
} | ||
@@ -90,4 +101,5 @@ | ||
rootDependencies, | ||
dependenciesIgnore, | ||
block, | ||
entry | ||
}; |
@@ -7,3 +7,3 @@ { | ||
"typings": "index.d.ts", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"license": "MIT", | ||
@@ -10,0 +10,0 @@ "author": { |
50769
606