Socket
Socket
Sign inDemoInstall

alloy

Package Overview
Dependencies
Maintainers
4
Versions
269
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alloy - npm Package Compare versions

Comparing version 0.1.17 to 0.1.19

Alloy/optimizer.js

7

Alloy/alloy.js

@@ -11,3 +11,5 @@ /**

_ = require("./lib/alloy/underscore")._,
pkginfo = require('pkginfo');
pkginfo = require('pkginfo'),
path = require('path'),
fs = require('fs');

@@ -20,2 +22,5 @@ // setup our module so have the pkginfo version from package.json

// patch to remove the warning in node >=0.8
path.existsSync = fs.existsSync || path.existsSync;
//

@@ -22,0 +27,0 @@ //TODO: we need a much more robust help from command line -- see sort of what i did in titanium

2

Alloy/commands/compile/compilerUtils.js

@@ -183,3 +183,3 @@ var U = require('../../utils'),

}
console.log('Copying assets ' + source + ' --> ' + dest);
//console.log('Copying assets ' + source + ' --> ' + dest);
U.copyFileSync(source, dest);

@@ -186,0 +186,0 @@ }

@@ -100,3 +100,3 @@ var path = require('path'),

var code = _.template(fs.readFileSync(path.join(alloyRoot,'template','app.js'),'utf8'),{config:compileConfig.runtimeConfig});
code = U.processSourceCode(code, alloyConfig);
code = U.processSourceCode(code, alloyConfig, 'app.js');

@@ -113,3 +113,3 @@ // trigger our custom compiler makefile

copyBuiltins();
fixRequirePaths(alloyConfig);
optimizeCompiledCode(alloyConfig);

@@ -174,3 +174,3 @@ // trigger our custom compiler makefile

var code = _.template(fs.readFileSync(path.join(compileConfig.dir.template, 'component.js'), 'utf8'), template);
code = U.processSourceCode(code, compileConfig.alloyConfig);
code = U.processSourceCode(code, compileConfig.alloyConfig, viewName+'.js');
if (manifest) {

@@ -317,3 +317,3 @@ wrench.mkdirSyncRecursive(path.join(compileConfig.dir.resourcesAlloy, 'widgets', manifest.id, 'components'), 0777);

var found = requires.findAllRequires(f,alloyFilter);
_.extend(alloyLibs,found);
alloyLibs = _.union(alloyLibs,found);
}

@@ -352,3 +352,3 @@ });

function fixRequirePaths(config) {
function optimizeCompiledCode(config) {
var resourcesDir = compileConfig.dir.resources,

@@ -355,0 +355,0 @@ files = wrench.readdirSyncRecursive(resourcesDir);

@@ -122,3 +122,3 @@ var jsp = require("../../uglify-js/uglify-js").parser,

return U.formatAST(ast,true,config);
return U.formatAST(ast,config,fn);
}

@@ -125,0 +125,0 @@

@@ -33,3 +33,3 @@ //Utilities for finding and working with the Titanium SDK

_.each(osxSdkPaths, function(sdkPath) {
if (path.existsSync(sdkPath)) {
if (path.existsSync(path.join(sdkPath, SDK_PATHS.darwin.suffix))) {
SDK_PATHS.darwin.path = sdkPath;

@@ -36,0 +36,0 @@ }

@@ -12,3 +12,4 @@ // The island of misfit toys... for functions

pro = require("./uglify-js/uglify-js").uglify,
_ = require("./lib/alloy/underscore")._
_ = require("./lib/alloy/underscore")._,
optimizer = require('./optimizer.js')
;

@@ -100,29 +101,22 @@

exports.processSourceCode = function(code, config) {
var defines = {},
DEFINES, ast;
config = config || {};
config.deploytype = config.deploytype || 'development';
config.beautify = config.beautify || true;
DEFINES = {
OS_IOS : config.platform == 'ios',
OS_ANDROID: config.platform == 'android',
OS_MOBILEWEB: config.platform == 'mobileweb',
ENV_DEV: config.deploytype == 'development',
ENV_DEVELOPMENT: config.deploytype == 'development',
ENV_TEST: config.deploytype == 'test',
ENV_PRODUCTION: config.deploytype == 'production'
exports.processSourceCode = function(code, config, fn)
{
function show_copyright(comments) {
var ret = "";
for (var i = 0; i < comments.length; ++i) {
var c = comments[i];
if (c.type == "comment1") {
ret += "//" + c.value + "\n";
} else {
ret += "/*" + c.value + "*/";
}
}
return ret;
};
for (var k in DEFINES) {
defines[k] = [ "num", DEFINES[k] ? 1 : 0 ];
}
ast = jsp.parse(code); // parse code and get the initial AST
ast = pro.ast_mangle(ast,{except:['Ti','Titanium'],defines:defines}); // get a new AST with mangled names
ast = pro.ast_squeeze(ast); // get an AST with compression optimizations
return pro.gen_code(ast,{beautify:config.beautify});
var c = jsp.tokenizer(code)();
// extract header copyright so we can preserve it (if at the top of the file)
var copyrights = show_copyright(c.comments_before);
var ast = jsp.parse(code);
var newCode = exports.formatAST(ast,config,fn);
return (copyrights ? copyrights + '\n' : '' ) + newCode;
};

@@ -218,3 +212,3 @@

exports.formatAST = function(ast,beautify,config)
exports.formatAST = function(ast,config,fn)
{

@@ -260,3 +254,3 @@ // use the general defaults from the uglify command line

ascii_only: false,
beautify: beautify,
beautify: config.beautify,
indent_level: 4,

@@ -274,2 +268,3 @@ indent_start: 0,

ast = pro.ast_mangle(ast,options); // get a new AST with mangled names
ast = optimizer.optimize(ast, DEFINES, fn); // optimize our titanium based code
ast = pro.ast_squeeze(ast); // get an AST with compression optimizations

@@ -279,21 +274,1 @@ return pro.gen_code(ast,options.codegen_options);

exports.formatJS = function(code, beautify)
{
function show_copyright(comments) {
var ret = "";
for (var i = 0; i < comments.length; ++i) {
var c = comments[i];
if (c.type == "comment1") {
ret += "//" + c.value + "\n";
} else {
ret += "/*" + c.value + "*/";
}
}
return ret;
};
var c = jsp.tokenizer(code)();
// extract header copyright so we can preserve it
var copyrights = show_copyright(c.comments_before);
var ast = jsp.parse(code); // parse code and get the initial AST
return copyrights + "\n" + exports.formatAST(ast);
}

@@ -16,3 +16,3 @@ {

],
"version": "0.1.17",
"version": "0.1.19",
"author": "Appcelerator, Inc. <info@appcelerator.com>",

@@ -19,0 +19,0 @@ "maintainers": [

Sorry, the diff of this file is not supported yet

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