How to use the node-titanium-sdk/lib/jsanalyze.analyzeJsFile function in node-titanium-sdk

To help you get started, we’ve selected a few node-titanium-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appcelerator / titanium_mobile / mobileweb / cli / commands / _build.js View on Github external
fs.readdirSync(dir).sort().forEach(function (filename) {
			var file = path.join(dir, filename),
				stat = fs.statSync(file);
			if (stat.isDirectory()) {
				walk(file, isTitaniumFolder || filename == 'titanium');
			} else if (/\.js$/.test(filename)) {
				self.logger.debug(self.minifyJS ? __('Minifying %s', file.cyan) : __('Analyzing %s', file.cyan));
				try {
					var r = jsanalyze.analyzeJsFile(file, { minify: self.minifyJS, skipStats: isTitaniumFolder || file == tiJSFile });
					self.minifyJS && fs.writeFileSync(file, r.contents);
				} catch (ex) {
					ex.message.split('\n').forEach(self.logger.error);
					self.logger.log();
					process.exit(1);
				}
			}
		});
	}(this.buildDir));
github appcelerator / titanium_mobile / mobileweb / cli / commands / _build.js View on Github external
if (!requireCacheWritten) {
					tiJS += 'require.cache({\n';
					requireCacheWritten = true;
				}

				if (!first) {
					tiJS += ',\n';
				}
				first = false;
				moduleCounter++;

				var file = path.join(dep[0], /\.js$/.test(dep[1]) ? dep[1] : dep[1] + '.js'),
					r;

				try {
					r = jsanalyze.analyzeJsFile(file, { minify: /^url\:/.test(moduleName) && this.minifyJS, skipStats: file == tiJSFile || file.indexOf(tiDir) == 0 });
				} catch (ex) {
					ex.message.split('\n').forEach(this.logger.error);
					this.logger.log();
					process.exit(1);
				}

				if (/^url\:/.test(moduleName)) {
					if (this.minifyJS) {
						this.logger.debug(__('Minifying include %s', file.cyan));
						try {
							fs.writeFileSync(file, r.contents);
						} catch (ex) {
							this.logger.error(__('Failed to minify %s', file));
							if (ex.line) {
								this.logger.error(__('%s [line %s, column %s]', ex.message, ex.line, ex.col));
							} else {
github appcelerator / titanium_mobile / iphone / cli / commands / _buildModule.js View on Github external
this.jsFilesToEncrypt.forEach(function (file) {
				const r = jsanalyze.analyzeJsFile(file, { minify: true });
				this.tiSymbols[file] = r.symbols;
				this.metaData.push.apply(this.metaData, r.symbols);
			}.bind(this));