opx.enabled = true if opx.enabled is false and (opx.whitelist or opx.blacklist)
if opx.enabled
opx.whitelist or= [ /.*/ ]
- opx.whitelist = [opx.whitelist] unless _.isArray opx.whitelist
opx.blacklist or= []
- opx.blacklist = [opx.blacklist] unless _.isArray opx.blacklist
@set 'limn options', opts
# create data directory
# wrap modules in commonjs closure for browser
@use compiler do
- enabled : 'commonjs_define'
+ enabled : <[ amd commonjs_define ]>
src : [ STATIC ]
dest : varDir
options :
- commonjs : { drop_path_parts:1, drop_full_ext:false }
+ amd : { drop_path_parts:1, drop_full_ext:false }
commonjs_define : { drop_path_parts:1, drop_full_ext:false }
log_level : LOG_LEVEL
@use compiler do
- enabled : 'commonjs_define'
+ enabled : <[ amd commonjs_define ]>
src : [ varDir, WWW ]
dest : varDir
options :
- commonjs : { drop_path_parts:1, drop_full_ext:true }
+ amd : { drop_path_parts:1, drop_full_ext:true }
commonjs_define : { drop_path_parts:1, drop_full_ext:true }
log_level : LOG_LEVEL
-_ = require 'underscore'
url = require 'url'
minimatch = require 'minimatch'
request = require 'request'
false
ProxyMiddleware = (options={}) ->
- {whitelist, blacklist} = options = {whitelist:[], blacklist:[], ...options}
+ options = {whitelist, blacklist} = {-verbose, whitelist:[], blacklist:[], ...options}
+ whitelist = [whitelist] unless Array.isArray whitelist
whitelist .= map -> minimatch.filter it, {+nocase}
+ blacklist = [blacklist] unless Array.isArray blacklist
blacklist .= map -> minimatch.filter it, {+nocase}
return (req, res) ->
# Set the no-buffering flag for nginx
res.header 'X-Accel-Buffering', 'no'
- console.log "[Proxy] #targetUrl"
+ console.log "[Proxy] #targetUrl" if options.verbose
request.get targetUrl .pipe res
+++ /dev/null
-// Backbone.js 0.5.3
-// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.
-// Backbone may be freely distributed under the MIT license.
-// For all details and documentation:
-// http://documentcloud.github.com/backbone
-
-(function(){
-
- // Initial Setup
- // -------------
-
- // Save a reference to the global object.
- var root = this;
-
- // Save the previous value of the `Backbone` variable.
- var previousBackbone = root.Backbone;
-
- // The top-level namespace. All public Backbone classes and modules will
- // be attached to this. Exported for both CommonJS and the browser.
- var Backbone;
- if (typeof exports !== 'undefined') {
- Backbone = exports;
- } else {
- Backbone = root.Backbone = {};
- }
-
- // Current version of the library. Keep in sync with `package.json`.
- Backbone.VERSION = '0.5.3';
-
- // Require Underscore, if we're on the server, and it's not already present.
- var _ = root._;
- if (!_ && (typeof require !== 'undefined')) _ = require('underscore')._;
-
- // For Backbone's purposes, jQuery or Zepto owns the `$` variable.
- var $ = root.jQuery || root.Zepto;
-
- // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
- // to its previous owner. Returns a reference to this Backbone object.
- Backbone.noConflict = function() {
- root.Backbone = previousBackbone;
- return this;
- };
-
- // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option will
- // fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and set a
- // `X-Http-Method-Override` header.
- Backbone.emulateHTTP = false;
-
- // Turn on `emulateJSON` to support legacy servers that can't deal with direct
- // `application/json` requests ... will encode the body as
- // `application/x-www-form-urlencoded` instead and will send the model in a
- // form param named `model`.
- Backbone.emulateJSON = false;
-
- // Backbone.Events
- // -----------------
-
- // A module that can be mixed in to *any object* in order to provide it with
- // custom events. You may `bind` or `unbind` a callback function to an event;
- // `trigger`-ing an event fires all callbacks in succession.
- //
- // var object = {};
- // _.extend(object, Backbone.Events);
- // object.bind('expand', function(){ alert('expanded'); });
- // object.trigger('expand');
- //
- Backbone.Events = {
-
- // Bind an event, specified by a string name, `ev`, to a `callback` function.
- // Passing `"all"` will bind the callback to all events fired.
- bind : function(ev, callback, context) {
- var calls = this._callbacks || (this._callbacks = {});
- var list = calls[ev] || (calls[ev] = []);
- list.push([callback, context]);
- return this;
- },
-
- // Remove one or many callbacks. If `callback` is null, removes all
- // callbacks for the event. If `ev` is null, removes all bound callbacks
- // for all events.
- unbind : function(ev, callback) {
- var calls;
- if (!ev) {
- this._callbacks = {};
- } else if (calls = this._callbacks) {
- if (!callback) {
- calls[ev] = [];
- } else {
- var list = calls[ev];
- if (!list) return this;
- for (var i = 0, l = list.length; i < l; i++) {
- if (list[i] && callback === list[i][0]) {
- list[i] = null;
- break;
- }
- }
- }
- }
- return this;
- },
-
- // Trigger an event, firing all bound callbacks. Callbacks are passed the
- // same arguments as `trigger` is, apart from the event name.
- // Listening for `"all"` passes the true event name as the first argument.
- trigger : function(eventName) {
- var list, calls, ev, cal