+34
-14
@@ -31,3 +31,3 @@ /* | ||
| var source = copy.sourceFactory(obj.source, filters); | ||
| var dest = copy.destFactory(obj.dest, filters); | ||
| var dest = copy.destFactory(obj.dest, filters, obj.filenameFilter); | ||
| dest.processSource(source); | ||
@@ -373,3 +373,3 @@ } | ||
| this._require.forEach(function(moduleName) { | ||
| this._project.require(moduleName); | ||
| this._project.require(moduleName, '<build file>'); | ||
| }, this); | ||
@@ -405,3 +405,3 @@ return this._project.getCurrentModules().map(function(location) { | ||
| */ | ||
| copy.destFactory = function(dest, filters) { | ||
| copy.destFactory = function(dest, filters, filenameFilter) { | ||
| if (dest == null) { | ||
@@ -421,3 +421,3 @@ throw new Error('Missing dest'); | ||
| if (copy.isDirectory(dest)) { | ||
| return new copy.DirectoryDestination(dest, filters); | ||
| return new copy.DirectoryDestination(dest, filters, filenameFilter); | ||
| } | ||
@@ -514,5 +514,6 @@ else { | ||
| */ | ||
| copy.DirectoryDestination = function(dirname, filters) { | ||
| copy.DirectoryDestination = function(dirname, filters, filenameFilter) { | ||
| this.name = dirname; | ||
| this._filters = filters; | ||
| this._filenameFilter = filenameFilter; | ||
| }; | ||
@@ -529,2 +530,5 @@ | ||
| var destfile = path.join(this.name, data.location.path); | ||
| if (this._filenameFilter != null) { | ||
| destfile = this._filenameFilter(destfile); | ||
| } | ||
| var output = this._runFilters(data.get); | ||
@@ -536,2 +540,5 @@ copy._writeToFile(destfile, output, data.encoding); | ||
| var destfile = path.join(this.name, s.location.path); | ||
| if (this._filenameFilter != null) { | ||
| destfile = this._filenameFilter(destfile); | ||
| } | ||
| var output = this._runFilters(s.get); | ||
@@ -861,5 +868,18 @@ copy._writeToFile(destfile, output, s.encoding); | ||
| } | ||
| // Check if it's a Simplified CommonJS Wrapper. A module is only | ||
| // treated as a CJS module if it doesn't contain a dependency array and | ||
| // the definition function contains at least one parameter. | ||
| // http://requirejs.org/docs/api.html#cjsmodule | ||
| else if ((args[0][0] === 'function' && args[0][2].length) || | ||
| (args[1][0] === 'function' && args[1][2].length && | ||
| args[0][0] === 'string')) { | ||
| // By definition there are no dependencies, so no more work is | ||
| // necessary. | ||
| return; | ||
| } | ||
| else { | ||
| /* | ||
| console.log('- ' + module.path + ' has define(...) ' + | ||
| 'with non-array parameter. Ignoring requirement.'); | ||
| 'with unrecognized parameter. Ignoring requirement.'); | ||
| */ | ||
| return; | ||
@@ -901,3 +921,3 @@ } | ||
| CommonJsProject.prototype.require = function(moduleName) { | ||
| CommonJsProject.prototype.require = function(moduleName, parentModuleName) { | ||
| var module = this.currentModules[moduleName]; | ||
@@ -944,3 +964,3 @@ if (module) { | ||
| if (!module) { | ||
| console.error('Failed to find module: ' + moduleName); | ||
| console.error('Failed to find module: ' + moduleName + ' from ' + parentModuleName); | ||
| return; | ||
@@ -954,5 +974,5 @@ } | ||
| // require() all this modules requirements | ||
| findRequires(module).forEach(function(moduleName) { | ||
| module.deps[moduleName] = 1; | ||
| this.require(moduleName); | ||
| findRequires(module).forEach(function(innerModuleName) { | ||
| module.deps[innerModuleName] = 1; | ||
| this.require(innerModuleName, moduleName); | ||
| }, this); | ||
@@ -1077,6 +1097,6 @@ } | ||
| input = input.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); | ||
| input = '"' + input.replace(/\n/g, '\\n" +\n "') + '"'; | ||
| input = input.replace(/\\/g, "\\\\").replace(/'/g, '\\\''); | ||
| input = '\'' + input.replace(/\n/g, '\\n\' +\n \'') + '\''; | ||
| return 'define("text!' + module + '", [], ' + input + ');\n\n'; | ||
| return 'define(\'text!' + module + '\', [], ' + input + ');\n\n'; | ||
| }; | ||
@@ -1083,0 +1103,0 @@ copy.filter.addDefines.onRead = true; |
+1
-1
@@ -5,3 +5,3 @@ { | ||
| "keywords": [ "build", "commonjs", "requirejs" ], | ||
| "version": "0.4.10", | ||
| "version": "0.4.11", | ||
| "homepage": "https://github.com/joewalker/dryice", | ||
@@ -8,0 +8,0 @@ "author": "Joe Walker <joe@getahead.org>", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
58594
1.77%1164
1.75%0
-100%