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

grunt-depsconcat

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-depsconcat - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "grunt-depsconcat",
"version": "0.1.1",
"version": "0.1.2",
"description": "Concatenate files in order based on dependencies",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -14,2 +14,3 @@ module.exports = function(grunt) {

requireTemplate: null,
nameTemplate: null,
ext: null

@@ -19,3 +20,3 @@ });

this.files.forEach(function(f) {
var ext, files, tree, regex, serialized;
var ext, files, tree, requireRegex, nameRegex, serialized;
var filePath, i;

@@ -26,18 +27,22 @@

tree = {};
nameRegex = null;
if (!options.requireTemplate) {
if (ext === '.css')
regex = '@import\\s+url\\(["\']?([^"\'()]+)["\']?\\);?[\\n\\r]*';
requireRegex = '@import\\s+url\\(["\']?([^"\'()]+)["\']?\\);?[\\n\\r]*';
else {
ext = '.js';
regex = '\\/\\/@require\\s+([^\\n\\r]+)[\\n\\r]*';
requireRegex = '\\/\\/@require\\s+([^\\n\\r]+)[\\n\\r]*';
}
} else
regex = options.requireTemplate;
requireRegex = options.requireTemplate;
regex = new RegExp(regex, 'gi');
requireRegex = new RegExp(requireRegex, 'gi');
if (options.nameTemplate)
nameRegex = new RegExp(options.nameTemplate, 'gi');
f.src.filter(function(filePath) {
if (!grunt.file.exists(filePath)) {
grunt.log.warn('Source file ' + filepath + ' not found.');
grunt.log.warn('Source file ' + filePath + ' not found.');
return false;

@@ -48,3 +53,13 @@ }

}).map(function(filePath) {
files[path.basename(filePath, ext)] = filePath;
var matches;
if (nameRegex) {
nameRegex.lastIndex = 0;
matches = grunt.file.read(filePath).match(nameRegex) || [];
if (matches.length)
files[nameRegex.exec(matches[0])[1]] = filePath;
} else
files[path.basename(filePath, ext)] = filePath;
tree[filePath] = [];

@@ -56,7 +71,7 @@ });

matches = grunt.file.read(filePath).match(regex) || [];
matches = grunt.file.read(filePath).match(requireRegex) || [];
for (i = 0; i < matches.length; i++) {
regex.lastIndex = 0;
name = regex.exec(matches[i])[1];
requireRegex.lastIndex = 0;
name = requireRegex.exec(matches[i])[1];

@@ -63,0 +78,0 @@ if (files[name])

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