From f0f98a8fda19583b5de67fe0cc65735351457a98 Mon Sep 17 00:00:00 2001 From: Joel Holdbrooks Date: Wed, 14 Aug 2013 10:46:37 -0700 Subject: [PATCH] Add externs file, compile prod in advanced mode --- project.clj | 3 +- resources/externs/process.js | 169 +++++++++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 resources/externs/process.js diff --git a/project.clj b/project.clj index 521e26d..0a90f97 100644 --- a/project.clj +++ b/project.clj @@ -20,7 +20,8 @@ {:id "prod" :source-paths ["src/clj" "src/cljs"] :compiler {:output-to "bin/frak.prod.js" - :optimizations :simple + :externs ["resources/externs/process.js"] + :optimizations :advanced :pretty-print false :target :nodejs}}]} :main frak.cli) diff --git a/resources/externs/process.js b/resources/externs/process.js new file mode 100644 index 0000000..b1592f4 --- /dev/null +++ b/resources/externs/process.js @@ -0,0 +1,169 @@ +/* + * Copyright 2012 The Closure Compiler Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Definitions for node's global process object. Depends on the stream module. + * @see http://nodejs.org/api/process.html + * @externs + * @author Daniel Wirtz + */ + +/** + * @constructor + * @extends events.EventEmitter + */ +var process = function() {}; + +/** + * @type {stream.ReadableStream} + */ +process.stdin; + +/** + * @type {stream.WritableStream} + */ +process.stdout; + +/** + * @type {stream.WritableStream} + */ +process.stderr; + +/** + * @type {Array.} + */ +process.argv; + +/** + * @type {string} + */ +process.execPath; + +/** + */ +process.abort = function() {}; + +/** + * @param {string} directory + */ +process.chdir = function(directory) {}; + +/** + * @return {string} + * @nosideeffects + */ +process.cwd = function() {}; + +/** + * @type {Object.} + */ +process.env; + +/** + * @param {number=} code + */ +process.exit = function(code) {}; + +/** + * @return {number} + * @nosideeffects + */ +process.getgid = function() {}; + +/** + * @param {number} id + */ +process.setgid = function(id) {}; + +/** + * @return {number} + * @nosideeffects + */ +process.getuid = function() {}; + +/** + * @param {number} id + */ +process.setuid = function(id) {}; + +/** + * @type {!string} + */ +process.version; + +/** + * @type {Object.} + */ +process.versions; + +/** + * @type {Object.} + */ +process.config; + +/** + * @param {number} pid + * @param {string=} signal + */ +process.kill = function(pid, signal) {}; + +/** + * @type {number} + */ +process.pid; + +/** + * @type {string} + */ +process.title; + +/** + * @type {string} + */ +process.arch; + +/** + * @type {string} + */ +process.platform; + +/** + * @return {Object.} + * @nosideeffects + */ +process.memoryUsage = function() {}; + +/** + * @param {!function()} callback + */ +process.nextTick = function(callback) {}; + +/** + * @param {number=} mask + */ +process.umask = function(mask) {}; + +/** + * @return {number} + * @nosideeffects + */ +process.uptime = function() {}; + +/** + * @return {number} + * @nosideeffects + */ +process.hrtime = function() {}; -- 2.25.1