@abp/aspnetcore.mvc.ui
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -13,5 +13,7 @@ "use strict"; | ||
function init(rootMappingFilePath) { | ||
var resourceMapping = buildResourceMapping(rootMappingFilePath); | ||
function init(rootPath) { | ||
var investigatedPackagePaths = {}; | ||
var resourceMapping = buildResourceMapping(rootPath); | ||
function replaceAliases(text) { | ||
@@ -37,2 +39,11 @@ if (!resourceMapping.aliases) { | ||
function requireOptional(filePath) { | ||
//TODO: Implement this using a library instead of try-catch! | ||
try { | ||
return require(filePath); | ||
} catch (e) { | ||
return undefined; | ||
} | ||
} | ||
function cleanFiles() { | ||
@@ -46,16 +57,23 @@ if (resourceMapping.clean) { | ||
function buildResourceMapping(mappingFilePath) { | ||
var resourcemapping = require(mappingFilePath); | ||
function buildResourceMapping(packagePath) { | ||
if (investigatedPackagePaths[packagePath]) { | ||
return {}; | ||
} | ||
if (resourcemapping.imports && resourcemapping.imports.length) { | ||
investigatedPackagePaths[packagePath] = 'OK'; | ||
var packageJson = requireOptional(path.join(packagePath, 'package.json')); | ||
var resourcemapping = requireOptional(path.join(packagePath, 'abp.resourcemapping.js')) || { }; | ||
if (packageJson && packageJson.dependencies) { | ||
var aliases = {}; | ||
var mappings = {}; | ||
for (var i = 0; i < resourcemapping.imports.length; i++) { | ||
var importedMappingFilePath = path.join(path.dirname(mappingFilePath), resourcemapping.imports[i]); | ||
var importedResourceMapping = buildResourceMapping(importedMappingFilePath); | ||
extendObject(aliases, importedResourceMapping.aliases); | ||
extendObject(mappings, importedResourceMapping.mappings); | ||
for (var dependency in packageJson.dependencies) { | ||
if (packageJson.dependencies.hasOwnProperty(dependency)) { | ||
var dependedPackagePath = path.join(rootPath, 'node_modules', dependency); | ||
var importedResourceMapping = buildResourceMapping(dependedPackagePath); | ||
extendObject(aliases, importedResourceMapping.aliases); | ||
extendObject(mappings, importedResourceMapping.mappings); | ||
} | ||
} | ||
@@ -79,9 +97,11 @@ | ||
for (var mapping in resourceMapping.mappings) { | ||
if (resourceMapping.mappings.hasOwnProperty(mapping)) { | ||
var source = replaceAliases(mapping); | ||
var destination = replaceAliases(resourceMapping.mappings[mapping]); | ||
tasks.push( | ||
gulp.src(source).pipe(gulp.dest(destination)) | ||
); | ||
if (resourceMapping.mappings) { | ||
for (var mapping in resourceMapping.mappings) { | ||
if (resourceMapping.mappings.hasOwnProperty(mapping)) { | ||
var source = replaceAliases(mapping); | ||
var destination = replaceAliases(resourceMapping.mappings[mapping]); | ||
tasks.push( | ||
gulp.src(source).pipe(gulp.dest(destination)) | ||
); | ||
} | ||
} | ||
@@ -88,0 +108,0 @@ } |
{ | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"name": "@abp/aspnetcore.mvc.ui", | ||
@@ -4,0 +4,0 @@ "publishConfig": { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
4174
88