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

alpaca-sm

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alpaca-sm - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

37

lib/jsParse.js

@@ -19,2 +19,12 @@ var esprima = require('esprima');

var closureReg = function(content) {
var ns = alp.config.get('ns');
return alp.config.get('optimizer') ?
new RegExp('(window\\.' + ns + ')\\s*=\\s*\\1(\\|\\|\\{\\})[,;]\\s*?function\\s*\\(.*?\\)\\s*?\\{\\s*?' + content + '\\s*\\}\\s*?\\(' + ns + '\\);', 'gi') :
new RegExp('(window\\.' + ns + ')(\\s*)=\\2\\1\\2\\|\\|\\2\\{\\};([\\r\\n\\s])*\\(function\\2\\(' + ns + '\\)\\2\\{[\\r\\n\\s]*?' + content + '\\2\\}\\(' + ns + '\\)\\);*', 'gim');
};
function getCleanCss() {

@@ -37,2 +47,7 @@ if (!CleanCss) {

}
function exportsAssign(exports) {
return exports ? exports + ' = ' + exports + ' || {};':'';
}
/**

@@ -409,8 +424,8 @@ * 为js添加一个外包。

function generateContent(obj, minCb) {
function generateContent(obj, isJsFile, minCb) {
var content, isMinifile = alp.config.get('optimizer');
var escodegenOptions = {};
if (obj.content) {
if (!isJsFile && 'content' in obj && _.is(obj.content, 'string')) {
content = obj.content;
} else {
} else if (isJsFile) {
//content = escodegen.generate(obj.ast).replace(/([\s\n\r]+);\1/gi, "");

@@ -429,5 +444,6 @@ //content = escodegen.generate(obj.ast).replace(/;;/gi, "");

}
content = escodegen.generate(obj.ast,escodegenOptions);
content = escodegen.generate(obj.ast, escodegenOptions);
content = content.replace(/(,\s*(<<<require>>>)\s*(?=;?))|(<<<require>>>\s*,?)/gim, "");
} else {
content = "";
}

@@ -439,10 +455,12 @@

}*/
content = content.replace(/[;,][\s\n\r]*(?=[;,])/gi,"");
content = content.replace(/[;,][\s\n\r]*(?=[;,])/gi, "");
return content;
//return minCb(content, !!obj.content);
} else {
return content.replace(/([\s\n\r]+);/gi, "");
content = content.replace(/([\s\n\r]+);/gi, "");
}
return content.replace(closureReg(exportsAssign(obj.exportStr)));
}

@@ -467,3 +485,4 @@

_result[k] = {
content: generateContent(obj, minCb),
content: generateContent(obj, _.isJsFile(k), minCb),
exportStr: obj.exportStr,
map: {

@@ -470,0 +489,0 @@ base: obj.base,

{
"name": "alpaca-sm",
"version": "1.1.5",
"version": "1.1.6",
"description": "分析Html文件依赖的js文件和css文件",

@@ -5,0 +5,0 @@ "main": "index.js",

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