diff --git a/.gitignore b/.gitignore index 714cebf..dbfd766 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ pids logs results npm-debug.log +node_modules +.lixian-portal.* diff --git a/.npmignore b/.npmignore index 07e6e47..53239ed 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,2 @@ -/node_modules +node_modules +.lixian-portal.* diff --git a/README.md b/README.md index 1b45b81..6add88f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ lixian-portal ============= -给`iambus/xunlei-lixian`做的一个简洁实用的webui。(不明真相的同学赶快先去膜拜了[iambus/xunlei-lixian](https://github.com/iambus/xunlei-lixian)了再回来) +一个简洁实用的 Web 版迅雷离线下载程序。 # 这是啥 @@ -9,9 +9,9 @@ lixian-portal # 典型使用场景 -1. 家里有个连着移动硬盘的树莓派 +1. 家里有个 HTPC,运行着这个程序 2. 我平常刷微博时发现先几个好看的电影,和想玩的游戏,然后再xxx上找到这些电影和游戏的ed2k链接,然后输入进去 -3. 周末我通过smb文件共享打开树莓派里已经下好的电影和游戏,看之且玩之 +3. 周末我通过 samba 文件共享打开这个程序已经下好的电影和游戏,看之且玩之 4. 室友也可以看(如果有室友的话) # 界面预览 @@ -22,18 +22,15 @@ lixian-portal # 环境 -* linux/osx (如果你想用windows来做下载服务器,你得先在windows上安装好wget) -* python2 -* nodejs +* [NodeJS](http://nodejs.org/) # 安装方法 -* 下载代码并解压缩 -* 运行命令启动`node /path/to/lixian-portal` +* 使用 NodeJS 自带的包管理器 npm 来安装该程序:`npm install lixian-portal -g` +* 运行命令启动:`lixian-portal` * 下载的位置为启动这个程序的目录(Current Working Directory) -* 如需下载到其他位置,可以设置环境变量`LIXIAN_PORTAL_HOME`,例如:可以这样启动程序`LIXIAN_PORTAL_HOME=/mnt/sdb1 node /path/to/lixan-portal` +* 如需下载到其他位置,可以设置环境变量`LIXIAN_PORTAL_HOME`,例如:可以这样启动程序`LIXIAN_PORTAL_HOME=/mnt/sdb1 lixian-portal` # Tricks -* 如果想让它一直在后运行,可以使用这个命令启动`nohup node /path/to/lixian-portal &` -* `lixian-portal`兼容`xunlei-lixian`的设置,按这样的命令格式设置即可`HOME=/path/to/lixian-portal/Downloads lx config output-dir /mnt/Downloads` +* 如果想让它一直在后运行,可以使用这个命令启动`nohup lixian-portal &` diff --git a/app.iced b/app.iced index 6f6af32..fe60b57 100644 --- a/app.iced +++ b/app.iced @@ -23,13 +23,6 @@ app.use express.methodOverride() client.startCron() queue = client.queue -autorefresh = -> - queue.append - name: "刷新任务列表" - func: queue.tasks.updateTasklist - setTimeout autorefresh, 60000 * (1 + Math.random() * 3) -autorefresh() - app.get '/', (req, res, n)-> return res.redirect '/login' if client.stats.requireLogin @@ -43,22 +36,16 @@ app.all '*', (req, res, n)-> ip = ip.split(',')[0].trim() return n 403 if process.env.ONLYFROM && -1 == process.env.ONLYFROM.indexOf ip n null -app.post '/refresh', (req, res, n)-> - - queue.append - name: "刷新任务列表" - func: queue.tasks.updateTasklist - res.redirect 'back' app.post '/', (req, res, n)-> if req.files && req.files.bt && req.files.bt.path && req.files.bt.length bt = req.files.bt await fs.rename bt.path, "#{bt.path}.torrent", defer e return n e if e - await queue.tasks.addBtTask bt.name, "#{bt.path}.torrent", defer e + await queue.execute 'addBtTask', bt.name, "#{bt.path}.torrent", defer e return n e if e - else - await queue.tasks.addTask req.body.url, defer e + if req.body.url && req.body.url.length + await queue.execute 'addTask', req.body.url, defer e return n e if e res.redirect '/' @@ -66,21 +53,17 @@ app.get '/login', (req, res)-> res.locals.vcode = null res.render 'login' app.post '/login', (req, res, n)-> - await queue.tasks.login req.body.username, req.body.password, req.body.vcode, defer e + await queue.execute 'login', req.body.username, req.body.password, defer e return n e if e res.redirect '/' app.get '/logout', (req, res, n)-> - await queue.tasks.logout defer e + await queue.execute 'logout', defer e return n e if e res.redirect '/' app.delete '/tasks/:id', (req, res, n)-> - if client.stats.retrieving?.task.id - client.stats.retrieving.kill() - queue.append - name: "删除任务 #{task.id}" - func: (fcb)-> - queue.tasks.deleteTask req.params.id, fcb + await queue.execute 'deleteTask', req.params.id, defer e + return cb e if e res.redirect '/' @@ -90,6 +73,11 @@ app.use (e, req, res, next)-> await client.init defer e throw e if e +autorefresh = -> + await queue.execute 'updateTasklist', defer(e) + setTimeout autorefresh, 60000 * (1 + Math.random() * 3) +autorefresh() + port = process.env.PORT || 3000 if isNaN Number port await exec "fuser #{port}", defer e diff --git a/client.iced b/client.iced index f45c0e4..e01c4e2 100644 --- a/client.iced +++ b/client.iced @@ -1,29 +1,12 @@ path = require 'path' fs = require 'fs' -lazy = require 'lazy' - -cli = path.join __dirname, 'xunlei-lixian', 'lixian_cli.py' - -{ - exec - execFile - spawn -} = require 'child_process' - -statusMap = - completed: 'success' - failed: 'error' - waiting: 'warn' - downloading: 'info' -statusMapLabel = - completed: '完成' - failed: '失败' - waiting: '等待' - downloading: '下载中' - -regexMG = /^([^ ]+) +(.+) +(completed|downloading|waiting|failed) *(http\:\/\/.+)?$/mg -regexQ = /^([^ ]+) +(.+) +(completed|downloading|waiting|failed) *(http\:\/\/.+)?$/m +mkdirp = require 'mkdirp' +request = require 'request' +StatusBar = require 'status-bar' + +Lixian = require 'node-lixian' +lixian = new Lixian() exports.stats = stats = task: null @@ -39,181 +22,146 @@ exports.stats = stats = exports.queue = queue = [] exports.log = log = [] -workingDirectory = process.env.LIXIAN_PORTAL_HOME || process.cwd() -process.env.HOME = workingDirectory +cwd = process.env.LIXIAN_PORTAL_HOME || process.cwd() -queue.append = (task)-> - @push task unless (@filter (t)->t.name==task.name).length -queue.prepend = (task)-> - @unshift task unless (@filter (t)->t.name==task.name).length +retrieves = [] exports.startCron = -> while true - if queue.length - stats.task = queue.shift() - log.unshift "#{stats.task.name} 启动" - console.log log[log.length - 1] - await stats.task.func defer e - log.unshift "#{stats.task.name} 完成" - console.log log[log.length - 1] - if e - log.unshift e.message - console.error e.message - + if retrieve = retrieves.shift() + await queue.execute 'retrieve', retrieve.task, retrieve.file, defer e + stats.retrieving = null await setTimeout defer(), 100 exports.init = (cb)-> + await lixian.init {}, defer e + return cb e if e + await fs.readFile (path.join cwd, '.lixian-portal.username'), 'utf8', defer e, username + await fs.readFile (path.join cwd, '.lixian-portal.password'), 'utf8', defer e, password + if username && password + console.log '正在尝试自动登录...' + await queue.execute 'login', username, password, defer e + if e + console.error e.message + else + console.log '自动登录成功.' cb null -getPythonBin = (cb)-> - await exec 'which python2', cwd: workingDirectory, defer e - return cb null, 'python2' unless e - await exec 'python --version', cwd: workingDirectory, defer e, out, err - return cb e if e - return cb new Error "invalid Python version: #{err}. (Python 2.x needed)" unless err.match /Python[\s]+2\./ - return cb null, 'python' +stats.executings = [] +queue.execute = (command, args..., cb)=> + commands = + retrieve: (task, file)-> "取回文件 #{task.name}/#{file.name}" + deleteTask: (id)-> "删除任务 #{id}" + updateTasklist: -> "刷新任务列表" + addTask: (url)-> "添加任务 #{url}" + addBtTask: (filename, torrent)-> "添加 BT 任务 #{filename}" + login: (username, password)-> "以 #{username} 登录" + logout: -> "登出" + command_name = commands[command] args... + log.unshift "#{command_name} 启动" + console.log log[0] + stats.executings.push command_name + await queue.tasks[command] args..., defer e, results... + stats.executings.splice (stats.executings.indexOf command_name), 1 + if e + log.unshift e.message + console.log log[0] + log.unshift "#{command_name} 失败" + console.log log[0] + else + log.unshift "#{command_name} 完成" + console.log log[0] + cb e, results... + + queue.tasks = - retrieve: (task, cb)-> - await getPythonBin defer e, pyothon_bin + retrieve: (task, file, cb)-> + await mkdirp (path.join cwd, task.name), defer e return cb e if e - stats.retrieving = spawn pyothon_bin, [cli, 'download', '--continue', '--no-hash', task.id], stdio: 'pipe', cwd: workingDirectory - errBuffer = [] - stats.retrieving.task = task - new lazy(stats.retrieving.stderr).lines.forEach (line)-> - line ?= [] - line = line.toString 'utf8' - errBuffer.push line - line = line.match /\s+(\d?\d%)\s+([^ ]{1,10})\s+([^ ]{1,10})\r?\n?$/ - [dummy, stats.progress, stats.speed, stats.time] = line if line - - await stats.retrieving.on 'exit', defer e - if e - stats.error[task.id] = errBuffer.join '' - stats.retrieving = null - queue.append - name: "刷新任务列表" - func: queue.tasks.updateTasklist - queue.append - name: "删除任务 #{task.id}" - func: (fcb)-> - queue.tasks.deleteTask task.id, fcb + req = request + url: file.url + headers: + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' + 'Cookie': stats.cookie + 'Referer': 'http://dynamic.cloud.vip.xunlei.com/user_task' + 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36' + 'Accept-Language': 'zh-CN,zh;q=0.8,it-IT;q=0.6,it;q=0.4,en-US;q=0.2,en;q=0.2' + proxy: process.env['http_proxy'] + writer = fs.createWriteStream path.join cwd, task.name, file.name + await req.on 'response', defer res + fileSize = Number res.headers['content-length'] + return cb new Error "Invalid Content-Length" if isNaN fileSize + statusBar = StatusBar.create total: fileSize + statusBar.on 'render', (progress)-> + stats.retrieving = + req: req + progress: progress + task: task + file: file + format: statusBar.format + req.pipe statusBar + req.pipe writer + await writer.on 'close', defer() + statusBar.cancel() cb() - updateTasklist: (cb)-> - await getPythonBin defer e, pyothon_bin - return cb e if e - await exec "#{pyothon_bin} #{cli} config encoding utf-8", cwd: workingDirectory, defer e + await lixian.list {}, defer e, data return cb e if e - await exec "#{pyothon_bin} #{cli} list --no-colors", cwd: workingDirectory, defer e, out, err - if e && err.match /user is not logged in|Verification code required/ - stats.requireLogin = true - return cb e - return cb e if e - _tasks = [] - if out.match regexMG - for task in out.match regexMG - task = task.match regexQ - _tasks.push - id: task[1] - filename: task[2] - status: statusMap[task[3]] - statusLabel: statusMapLabel[task[3]] - - stats.tasks = _tasks - - for task in _tasks - if task.status=='success' && !stats.error[task.id]? - queue.append - name: "取回 #{task.id}" - func: (fcb)-> - queue.tasks.retrieve task, fcb + stats.cookie = data.cookie + stats.tasks = data.tasks + for task in stats.tasks + for file in task.files + file.status = 'warning' + file.statusLabel = '未就绪' + if file.url + file.status = 'success' + file.statusLabel = '就绪' + unless retrieves.filter((r)-> r.task.id == task.id && r.file.name == file.name).length + retrieves.push + task: task + file: file cb() deleteTask: (id, cb)-> - await getPythonBin defer e, pyothon_bin + if stats.retrieving?.task.id == id + stats.retrieving.req.abort() + retrieves = retrieves.filter (retrieve)-> retrieve.task.id != id + + await lixian.delete_task delete: id, defer e return cb e if e - await exec "#{pyothon_bin} #{cli} delete #{id}", cwd: workingDirectory, defer e, out, err + await queue.execute 'updateTasklist', defer e return cb e if e - queue.append - name: "刷新任务列表" - func: queue.tasks.updateTasklist cb null - login: (username, password, vcode, cb)-> - await getPythonBin defer e, pyothon_bin + login: (username, password, cb)-> + await lixian.login username: username, password: password, defer e return cb e if e - vcode_path = (path.join workingDirectory, ".lixian-portal-vcode.jpg") - if vcode and stats.login_process? - console.log "vcode: #{vcode}" - stats.login_process.stdin.write vcode - stats.login_process.stdin.write "\n" - await stats.login_process.on 'exit', defer code - @login_result = code - else - await fs.unlink vcode_path, defer e - @login_output = "" - stats.login_process = spawn pyothon_bin, [ - cli - "login" - username - password - "--verification-code-path" - vcode_path - ], cwd: workingDirectory - stats.login_process.on 'exit', (code)=> - @login_result = code - console.log "login exited #{@login_result}" - stats.login_process = null - stats.login_process.stdout.on 'data', (data)=> @login_output+= data.toString 'utf8' - stats.login_process.stderr.on 'data', (data)=> @login_output+= data.toString 'utf8' - stats.login_process.stdin.setEncoding 'utf8' - lixian_code_fetched = false - while stats.login_process && !lixian_code_fetched - await setTimeout defer(), 100 - await fs.exists vcode_path, defer lixian_code_fetched - if lixian_code_fetched - e = true - while e - await setTimeout defer(), 100 - await fs.readFile vcode_path, 'base64', defer e, stats.requireVerificationCode - return cb null - if @login_result == 0 - stats.requireLogin = false - queue.append - name: "刷新任务列表" - func: queue.tasks.updateTasklist - cb null - else - console.error @login_output - @login_output = @login_output.match(/^[\w]+\:\s(.*)$/m)?[1] - @login_output = "用户名、密码或者验证码错误" if @login_output?.match /login failed/ - cb new Error "登录失败: \n\n#{@login_output}" + await queue.execute 'updateTasklist', defer e + return cb e if e + await fs.writeFile (path.join cwd, '.lixian-portal.username'), username, 'utf8', defer e + await fs.writeFile (path.join cwd, '.lixian-portal.password'), password, 'utf8', defer e + stats.requireLogin = false + cb null logout: (cb)-> - await getPythonBin defer e, pyothon_bin - return cb e if e - await exec "#{pyothon_bin} #{cli} logout", cwd: workingDirectory, defer e, out, err - await fs.unlink path.join(workingDirectory, '.xunlei.lixian.cookies'), defer e + await fs.unlink (path.join cwd, '.lixian-portal.username'), defer e + await fs.unlink (path.join cwd, '.lixian-portal.password'), defer e stats.requireLogin = true cb null addBtTask: (filename, torrent, cb)-> - await getPythonBin defer e, pyothon_bin + await lixian.add_torrent torrent: torrent, defer e return cb e if e - await exec "#{pyothon_bin} #{cli} add #{torrent}", cwd: workingDirectory, defer e, out, err - return cb e if e - await queue.tasks.updateTasklist defer e + await queue.execute 'updateTasklist', defer e return cb e if e cb null addTask: (url, cb)-> - await getPythonBin defer e, pyothon_bin - return cb e if e - await exec "#{pyothon_bin} #{cli} add \"#{url}\"", cwd: workingDirectory, defer e, out, err + await lixian.add_url url: url, defer e return cb e if e - await queue.tasks.updateTasklist defer e + await queue.execute 'updateTasklist', defer e return cb e if e cb null diff --git a/node_modules/.bin/express b/node_modules/.bin/express deleted file mode 120000 index b741d99..0000000 --- a/node_modules/.bin/express +++ /dev/null @@ -1 +0,0 @@ -../express/bin/express \ No newline at end of file diff --git a/node_modules/.bin/icake b/node_modules/.bin/icake deleted file mode 120000 index 9f13a4d..0000000 --- a/node_modules/.bin/icake +++ /dev/null @@ -1 +0,0 @@ -../iced-coffee-script/bin/cake \ No newline at end of file diff --git a/node_modules/.bin/iced b/node_modules/.bin/iced deleted file mode 120000 index 101c253..0000000 --- a/node_modules/.bin/iced +++ /dev/null @@ -1 +0,0 @@ -../iced-coffee-script/bin/coffee \ No newline at end of file diff --git a/node_modules/.bin/jade b/node_modules/.bin/jade deleted file mode 120000 index 571fae7..0000000 --- a/node_modules/.bin/jade +++ /dev/null @@ -1 +0,0 @@ -../jade/bin/jade \ No newline at end of file diff --git a/node_modules/express/.npmignore b/node_modules/express/.npmignore deleted file mode 100644 index caf574d..0000000 --- a/node_modules/express/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -.git* -docs/ -examples/ -support/ -test/ -testing.js -.DS_Store -coverage.html -lib-cov diff --git a/node_modules/express/.travis.yml b/node_modules/express/.travis.yml deleted file mode 100644 index cc4dba2..0000000 --- a/node_modules/express/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/node_modules/express/History.md b/node_modules/express/History.md deleted file mode 100644 index 4885f6c..0000000 --- a/node_modules/express/History.md +++ /dev/null @@ -1,1106 +0,0 @@ - -3.1.2 / 2013-04-12 -================== - - * add support for custom Accept parameters - * update cookie-signature - -3.1.1 / 2013-04-01 -================== - - * add X-Forwarded-Host support to `req.host` - * fix relative redirects - * update mkdirp - * update buffer-crc32 - * remove legacy app.configure() method from app template. - -3.1.0 / 2013-01-25 -================== - - * add support for leading "." in "view engine" setting - * add array support to `res.set()` - * add node 0.8.x to travis.yml - * add "subdomain offset" setting for tweaking `req.subdomains` - * add `res.location(url)` implementing `res.redirect()`-like setting of Location - * use app.get() for x-powered-by setting for inheritance - * fix colons in passwords for `req.auth` - -3.0.6 / 2013-01-04 -================== - - * add http verb methods to Router - * update connect - * fix mangling of the `res.cookie()` options object - * fix jsonp whitespace escape. Closes #1132 - -3.0.5 / 2012-12-19 -================== - - * add throwing when a non-function is passed to a route - * fix: explicitly remove Transfer-Encoding header from 204 and 304 responses - * revert "add 'etag' option" - -3.0.4 / 2012-12-05 -================== - - * add 'etag' option to disable `res.send()` Etags - * add escaping of urls in text/plain in `res.redirect()` - for old browsers interpreting as html - * change crc32 module for a more liberal license - * update connect - -3.0.3 / 2012-11-13 -================== - - * update connect - * update cookie module - * fix cookie max-age - -3.0.2 / 2012-11-08 -================== - - * add OPTIONS to cors example. Closes #1398 - * fix route chaining regression. Closes #1397 - -3.0.1 / 2012-11-01 -================== - - * update connect - -3.0.0 / 2012-10-23 -================== - - * add `make clean` - * add "Basic" check to req.auth - * add `req.auth` test coverage - * add cb && cb(payload) to `res.jsonp()`. Closes #1374 - * add backwards compat for `res.redirect()` status. Closes #1336 - * add support for `res.json()` to retain previously defined Content-Types. Closes #1349 - * update connect - * change `res.redirect()` to utilize a pathname-relative Location again. Closes #1382 - * remove non-primitive string support for `res.send()` - * fix view-locals example. Closes #1370 - * fix route-separation example - -3.0.0rc5 / 2012-09-18 -================== - - * update connect - * add redis search example - * add static-files example - * add "x-powered-by" setting (`app.disable('x-powered-by')`) - * add "application/octet-stream" redirect Accept test case. Closes #1317 - -3.0.0rc4 / 2012-08-30 -================== - - * add `res.jsonp()`. Closes #1307 - * add "verbose errors" option to error-pages example - * add another route example to express(1) so people are not so confused - * add redis online user activity tracking example - * update connect dep - * fix etag quoting. Closes #1310 - * fix error-pages 404 status - * fix jsonp callback char restrictions - * remove old OPTIONS default response - -3.0.0rc3 / 2012-08-13 -================== - - * update connect dep - * fix signed cookies to work with `connect.cookieParser()` ("s:" prefix was missing) [tnydwrds] - * fix `res.render()` clobbering of "locals" - -3.0.0rc2 / 2012-08-03 -================== - - * add CORS example - * update connect dep - * deprecate `.createServer()` & remove old stale examples - * fix: escape `res.redirect()` link - * fix vhost example - -3.0.0rc1 / 2012-07-24 -================== - - * add more examples to view-locals - * add scheme-relative redirects (`res.redirect("//foo.com")`) support - * update cookie dep - * update connect dep - * update send dep - * fix `express(1)` -h flag, use -H for hogan. Closes #1245 - * fix `res.sendfile()` socket error handling regression - -3.0.0beta7 / 2012-07-16 -================== - - * update connect dep for `send()` root normalization regression - -3.0.0beta6 / 2012-07-13 -================== - - * add `err.view` property for view errors. Closes #1226 - * add "jsonp callback name" setting - * add support for "/foo/:bar*" non-greedy matches - * change `res.sendfile()` to use `send()` module - * change `res.send` to use "response-send" module - * remove `app.locals.use` and `res.locals.use`, use regular middleware - -3.0.0beta5 / 2012-07-03 -================== - - * add "make check" support - * add route-map example - * add `res.json(obj, status)` support back for BC - * add "methods" dep, remove internal methods module - * update connect dep - * update auth example to utilize cores pbkdf2 - * updated tests to use "supertest" - -3.0.0beta4 / 2012-06-25 -================== - - * Added `req.auth` - * Added `req.range(size)` - * Added `res.links(obj)` - * Added `res.send(body, status)` support back for backwards compat - * Added `.default()` support to `res.format()` - * Added 2xx / 304 check to `req.fresh` - * Revert "Added + support to the router" - * Fixed `res.send()` freshness check, respect res.statusCode - -3.0.0beta3 / 2012-06-15 -================== - - * Added hogan `--hjs` to express(1) [nullfirm] - * Added another example to content-negotiation - * Added `fresh` dep - * Changed: `res.send()` always checks freshness - * Fixed: expose connects mime module. Cloases #1165 - -3.0.0beta2 / 2012-06-06 -================== - - * Added `+` support to the router - * Added `req.host` - * Changed `req.param()` to check route first - * Update connect dep - -3.0.0beta1 / 2012-06-01 -================== - - * Added `res.format()` callback to override default 406 behaviour - * Fixed `res.redirect()` 406. Closes #1154 - -3.0.0alpha5 / 2012-05-30 -================== - - * Added `req.ip` - * Added `{ signed: true }` option to `res.cookie()` - * Removed `res.signedCookie()` - * Changed: dont reverse `req.ips` - * Fixed "trust proxy" setting check for `req.ips` - -3.0.0alpha4 / 2012-05-09 -================== - - * Added: allow `[]` in jsonp callback. Closes #1128 - * Added `PORT` env var support in generated template. Closes #1118 [benatkin] - * Updated: connect 2.2.2 - -3.0.0alpha3 / 2012-05-04 -================== - - * Added public `app.routes`. Closes #887 - * Added _view-locals_ example - * Added _mvc_ example - * Added `res.locals.use()`. Closes #1120 - * Added conditional-GET support to `res.send()` - * Added: coerce `res.set()` values to strings - * Changed: moved `static()` in generated apps below router - * Changed: `res.send()` only set ETag when not previously set - * Changed connect 2.2.1 dep - * Changed: `make test` now runs unit / acceptance tests - * Fixed req/res proto inheritance - -3.0.0alpha2 / 2012-04-26 -================== - - * Added `make benchmark` back - * Added `res.send()` support for `String` objects - * Added client-side data exposing example - * Added `res.header()` and `req.header()` aliases for BC - * Added `express.createServer()` for BC - * Perf: memoize parsed urls - * Perf: connect 2.2.0 dep - * Changed: make `expressInit()` middleware self-aware - * Fixed: use app.get() for all core settings - * Fixed redis session example - * Fixed session example. Closes #1105 - * Fixed generated express dep. Closes #1078 - -3.0.0alpha1 / 2012-04-15 -================== - - * Added `app.locals.use(callback)` - * Added `app.locals` object - * Added `app.locals(obj)` - * Added `res.locals` object - * Added `res.locals(obj)` - * Added `res.format()` for content-negotiation - * Added `app.engine()` - * Added `res.cookie()` JSON cookie support - * Added "trust proxy" setting - * Added `req.subdomains` - * Added `req.protocol` - * Added `req.secure` - * Added `req.path` - * Added `req.ips` - * Added `req.fresh` - * Added `req.stale` - * Added comma-delmited / array support for `req.accepts()` - * Added debug instrumentation - * Added `res.set(obj)` - * Added `res.set(field, value)` - * Added `res.get(field)` - * Added `app.get(setting)`. Closes #842 - * Added `req.acceptsLanguage()` - * Added `req.acceptsCharset()` - * Added `req.accepted` - * Added `req.acceptedLanguages` - * Added `req.acceptedCharsets` - * Added "json replacer" setting - * Added "json spaces" setting - * Added X-Forwarded-Proto support to `res.redirect()`. Closes #92 - * Added `--less` support to express(1) - * Added `express.response` prototype - * Added `express.request` prototype - * Added `express.application` prototype - * Added `app.path()` - * Added `app.render()` - * Added `res.type()` to replace `res.contentType()` - * Changed: `res.redirect()` to add relative support - * Changed: enable "jsonp callback" by default - * Changed: renamed "case sensitive routes" to "case sensitive routing" - * Rewrite of all tests with mocha - * Removed "root" setting - * Removed `res.redirect('home')` support - * Removed `req.notify()` - * Removed `app.register()` - * Removed `app.redirect()` - * Removed `app.is()` - * Removed `app.helpers()` - * Removed `app.dynamicHelpers()` - * Fixed `res.sendfile()` with non-GET. Closes #723 - * Fixed express(1) public dir for windows. Closes #866 - -2.5.9/ 2012-04-02 -================== - - * Added support for PURGE request method [pbuyle] - * Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki] - -2.5.8 / 2012-02-08 -================== - - * Update mkdirp dep. Closes #991 - -2.5.7 / 2012-02-06 -================== - - * Fixed `app.all` duplicate DELETE requests [mscdex] - -2.5.6 / 2012-01-13 -================== - - * Updated hamljs dev dep. Closes #953 - -2.5.5 / 2012-01-08 -================== - - * Fixed: set `filename` on cached templates [matthewleon] - -2.5.4 / 2012-01-02 -================== - - * Fixed `express(1)` eol on 0.4.x. Closes #947 - -2.5.3 / 2011-12-30 -================== - - * Fixed `req.is()` when a charset is present - -2.5.2 / 2011-12-10 -================== - - * Fixed: express(1) LF -> CRLF for windows - -2.5.1 / 2011-11-17 -================== - - * Changed: updated connect to 1.8.x - * Removed sass.js support from express(1) - -2.5.0 / 2011-10-24 -================== - - * Added ./routes dir for generated app by default - * Added npm install reminder to express(1) app gen - * Added 0.5.x support - * Removed `make test-cov` since it wont work with node 0.5.x - * Fixed express(1) public dir for windows. Closes #866 - -2.4.7 / 2011-10-05 -================== - - * Added mkdirp to express(1). Closes #795 - * Added simple _json-config_ example - * Added shorthand for the parsed request's pathname via `req.path` - * Changed connect dep to 1.7.x to fix npm issue... - * Fixed `res.redirect()` __HEAD__ support. [reported by xerox] - * Fixed `req.flash()`, only escape args - * Fixed absolute path checking on windows. Closes #829 [reported by andrewpmckenzie] - -2.4.6 / 2011-08-22 -================== - - * Fixed multiple param callback regression. Closes #824 [reported by TroyGoode] - -2.4.5 / 2011-08-19 -================== - - * Added support for routes to handle errors. Closes #809 - * Added `app.routes.all()`. Closes #803 - * Added "basepath" setting to work in conjunction with reverse proxies etc. - * Refactored `Route` to use a single array of callbacks - * Added support for multiple callbacks for `app.param()`. Closes #801 -Closes #805 - * Changed: removed .call(self) for route callbacks - * Dependency: `qs >= 0.3.1` - * Fixed `res.redirect()` on windows due to `join()` usage. Closes #808 - -2.4.4 / 2011-08-05 -================== - - * Fixed `res.header()` intention of a set, even when `undefined` - * Fixed `*`, value no longer required - * Fixed `res.send(204)` support. Closes #771 - -2.4.3 / 2011-07-14 -================== - - * Added docs for `status` option special-case. Closes #739 - * Fixed `options.filename`, exposing the view path to template engines - -2.4.2. / 2011-07-06 -================== - - * Revert "removed jsonp stripping" for XSS - -2.4.1 / 2011-07-06 -================== - - * Added `res.json()` JSONP support. Closes #737 - * Added _extending-templates_ example. Closes #730 - * Added "strict routing" setting for trailing slashes - * Added support for multiple envs in `app.configure()` calls. Closes #735 - * Changed: `res.send()` using `res.json()` - * Changed: when cookie `path === null` don't default it - * Changed; default cookie path to "home" setting. Closes #731 - * Removed _pids/logs_ creation from express(1) - -2.4.0 / 2011-06-28 -================== - - * Added chainable `res.status(code)` - * Added `res.json()`, an explicit version of `res.send(obj)` - * Added simple web-service example - -2.3.12 / 2011-06-22 -================== - - * \#express is now on freenode! come join! - * Added `req.get(field, param)` - * Added links to Japanese documentation, thanks @hideyukisaito! - * Added; the `express(1)` generated app outputs the env - * Added `content-negotiation` example - * Dependency: connect >= 1.5.1 < 2.0.0 - * Fixed view layout bug. Closes #720 - * Fixed; ignore body on 304. Closes #701 - -2.3.11 / 2011-06-04 -================== - - * Added `npm test` - * Removed generation of dummy test file from `express(1)` - * Fixed; `express(1)` adds express as a dep - * Fixed; prune on `prepublish` - -2.3.10 / 2011-05-27 -================== - - * Added `req.route`, exposing the current route - * Added _package.json_ generation support to `express(1)` - * Fixed call to `app.param()` function for optional params. Closes #682 - -2.3.9 / 2011-05-25 -================== - - * Fixed bug-ish with `../' in `res.partial()` calls - -2.3.8 / 2011-05-24 -================== - - * Fixed `app.options()` - -2.3.7 / 2011-05-23 -================== - - * Added route `Collection`, ex: `app.get('/user/:id').remove();` - * Added support for `app.param(fn)` to define param logic - * Removed `app.param()` support for callback with return value - * Removed module.parent check from express(1) generated app. Closes #670 - * Refactored router. Closes #639 - -2.3.6 / 2011-05-20 -================== - - * Changed; using devDependencies instead of git submodules - * Fixed redis session example - * Fixed markdown example - * Fixed view caching, should not be enabled in development - -2.3.5 / 2011-05-20 -================== - - * Added export `.view` as alias for `.View` - -2.3.4 / 2011-05-08 -================== - - * Added `./examples/say` - * Fixed `res.sendfile()` bug preventing the transfer of files with spaces - -2.3.3 / 2011-05-03 -================== - - * Added "case sensitive routes" option. - * Changed; split methods supported per rfc [slaskis] - * Fixed route-specific middleware when using the same callback function several times - -2.3.2 / 2011-04-27 -================== - - * Fixed view hints - -2.3.1 / 2011-04-26 -================== - - * Added `app.match()` as `app.match.all()` - * Added `app.lookup()` as `app.lookup.all()` - * Added `app.remove()` for `app.remove.all()` - * Added `app.remove.VERB()` - * Fixed template caching collision issue. Closes #644 - * Moved router over from connect and started refactor - -2.3.0 / 2011-04-25 -================== - - * Added options support to `res.clearCookie()` - * Added `res.helpers()` as alias of `res.locals()` - * Added; json defaults to UTF-8 with `res.send()`. Closes #632. [Daniel * Dependency `connect >= 1.4.0` - * Changed; auto set Content-Type in res.attachement [Aaron Heckmann] - * Renamed "cache views" to "view cache". Closes #628 - * Fixed caching of views when using several apps. Closes #637 - * Fixed gotcha invoking `app.param()` callbacks once per route middleware. -Closes #638 - * Fixed partial lookup precedence. Closes #631 -Shaw] - -2.2.2 / 2011-04-12 -================== - - * Added second callback support for `res.download()` connection errors - * Fixed `filename` option passing to template engine - -2.2.1 / 2011-04-04 -================== - - * Added `layout(path)` helper to change the layout within a view. Closes #610 - * Fixed `partial()` collection object support. - Previously only anything with `.length` would work. - When `.length` is present one must still be aware of holes, - however now `{ collection: {foo: 'bar'}}` is valid, exposes - `keyInCollection` and `keysInCollection`. - - * Performance improved with better view caching - * Removed `request` and `response` locals - * Changed; errorHandler page title is now `Express` instead of `Connect` - -2.2.0 / 2011-03-30 -================== - - * Added `app.lookup.VERB()`, ex `app.lookup.put('/user/:id')`. Closes #606 - * Added `app.match.VERB()`, ex `app.match.put('/user/12')`. Closes #606 - * Added `app.VERB(path)` as alias of `app.lookup.VERB()`. - * Dependency `connect >= 1.2.0` - -2.1.1 / 2011-03-29 -================== - - * Added; expose `err.view` object when failing to locate a view - * Fixed `res.partial()` call `next(err)` when no callback is given [reported by aheckmann] - * Fixed; `res.send(undefined)` responds with 204 [aheckmann] - -2.1.0 / 2011-03-24 -================== - - * Added `/_?` partial lookup support. Closes #447 - * Added `request`, `response`, and `app` local variables - * Added `settings` local variable, containing the app's settings - * Added `req.flash()` exception if `req.session` is not available - * Added `res.send(bool)` support (json response) - * Fixed stylus example for latest version - * Fixed; wrap try/catch around `res.render()` - -2.0.0 / 2011-03-17 -================== - - * Fixed up index view path alternative. - * Changed; `res.locals()` without object returns the locals - -2.0.0rc3 / 2011-03-17 -================== - - * Added `res.locals(obj)` to compliment `res.local(key, val)` - * Added `res.partial()` callback support - * Fixed recursive error reporting issue in `res.render()` - -2.0.0rc2 / 2011-03-17 -================== - - * Changed; `partial()` "locals" are now optional - * Fixed `SlowBuffer` support. Closes #584 [reported by tyrda01] - * Fixed .filename view engine option [reported by drudge] - * Fixed blog example - * Fixed `{req,res}.app` reference when mounting [Ben Weaver] - -2.0.0rc / 2011-03-14 -================== - - * Fixed; expose `HTTPSServer` constructor - * Fixed express(1) default test charset. Closes #579 [reported by secoif] - * Fixed; default charset to utf-8 instead of utf8 for lame IE [reported by NickP] - -2.0.0beta3 / 2011-03-09 -================== - - * Added support for `res.contentType()` literal - The original `res.contentType('.json')`, - `res.contentType('application/json')`, and `res.contentType('json')` - will work now. - * Added `res.render()` status option support back - * Added charset option for `res.render()` - * Added `.charset` support (via connect 1.0.4) - * Added view resolution hints when in development and a lookup fails - * Added layout lookup support relative to the page view. - For example while rendering `./views/user/index.jade` if you create - `./views/user/layout.jade` it will be used in favour of the root layout. - * Fixed `res.redirect()`. RFC states absolute url [reported by unlink] - * Fixed; default `res.send()` string charset to utf8 - * Removed `Partial` constructor (not currently used) - -2.0.0beta2 / 2011-03-07 -================== - - * Added res.render() `.locals` support back to aid in migration process - * Fixed flash example - -2.0.0beta / 2011-03-03 -================== - - * Added HTTPS support - * Added `res.cookie()` maxAge support - * Added `req.header()` _Referrer_ / _Referer_ special-case, either works - * Added mount support for `res.redirect()`, now respects the mount-point - * Added `union()` util, taking place of `merge(clone())` combo - * Added stylus support to express(1) generated app - * Added secret to session middleware used in examples and generated app - * Added `res.local(name, val)` for progressive view locals - * Added default param support to `req.param(name, default)` - * Added `app.disabled()` and `app.enabled()` - * Added `app.register()` support for omitting leading ".", either works - * Added `res.partial()`, using the same interface as `partial()` within a view. Closes #539 - * Added `app.param()` to map route params to async/sync logic - * Added; aliased `app.helpers()` as `app.locals()`. Closes #481 - * Added extname with no leading "." support to `res.contentType()` - * Added `cache views` setting, defaulting to enabled in "production" env - * Added index file partial resolution, eg: partial('user') may try _views/user/index.jade_. - * Added `req.accepts()` support for extensions - * Changed; `res.download()` and `res.sendfile()` now utilize Connect's - static file server `connect.static.send()`. - * Changed; replaced `connect.utils.mime()` with npm _mime_ module - * Changed; allow `req.query` to be pre-defined (via middleware or other parent - * Changed view partial resolution, now relative to parent view - * Changed view engine signature. no longer `engine.render(str, options, callback)`, now `engine.compile(str, options) -> Function`, the returned function accepts `fn(locals)`. - * Fixed `req.param()` bug returning Array.prototype methods. Closes #552 - * Fixed; using `Stream#pipe()` instead of `sys.pump()` in `res.sendfile()` - * Fixed; using _qs_ module instead of _querystring_ - * Fixed; strip unsafe chars from jsonp callbacks - * Removed "stream threshold" setting - -1.0.8 / 2011-03-01 -================== - - * Allow `req.query` to be pre-defined (via middleware or other parent app) - * "connect": ">= 0.5.0 < 1.0.0". Closes #547 - * Removed the long deprecated __EXPRESS_ENV__ support - -1.0.7 / 2011-02-07 -================== - - * Fixed `render()` setting inheritance. - Mounted apps would not inherit "view engine" - -1.0.6 / 2011-02-07 -================== - - * Fixed `view engine` setting bug when period is in dirname - -1.0.5 / 2011-02-05 -================== - - * Added secret to generated app `session()` call - -1.0.4 / 2011-02-05 -================== - - * Added `qs` dependency to _package.json_ - * Fixed namespaced `require()`s for latest connect support - -1.0.3 / 2011-01-13 -================== - - * Remove unsafe characters from JSONP callback names [Ryan Grove] - -1.0.2 / 2011-01-10 -================== - - * Removed nested require, using `connect.router` - -1.0.1 / 2010-12-29 -================== - - * Fixed for middleware stacked via `createServer()` - previously the `foo` middleware passed to `createServer(foo)` - would not have access to Express methods such as `res.send()` - or props like `req.query` etc. - -1.0.0 / 2010-11-16 -================== - - * Added; deduce partial object names from the last segment. - For example by default `partial('forum/post', postObject)` will - give you the _post_ object, providing a meaningful default. - * Added http status code string representation to `res.redirect()` body - * Added; `res.redirect()` supporting _text/plain_ and _text/html_ via __Accept__. - * Added `req.is()` to aid in content negotiation - * Added partial local inheritance [suggested by masylum]. Closes #102 - providing access to parent template locals. - * Added _-s, --session[s]_ flag to express(1) to add session related middleware - * Added _--template_ flag to express(1) to specify the - template engine to use. - * Added _--css_ flag to express(1) to specify the - stylesheet engine to use (or just plain css by default). - * Added `app.all()` support [thanks aheckmann] - * Added partial direct object support. - You may now `partial('user', user)` providing the "user" local, - vs previously `partial('user', { object: user })`. - * Added _route-separation_ example since many people question ways - to do this with CommonJS modules. Also view the _blog_ example for - an alternative. - * Performance; caching view path derived partial object names - * Fixed partial local inheritance precedence. [reported by Nick Poulden] Closes #454 - * Fixed jsonp support; _text/javascript_ as per mailinglist discussion - -1.0.0rc4 / 2010-10-14 -================== - - * Added _NODE_ENV_ support, _EXPRESS_ENV_ is deprecated and will be removed in 1.0.0 - * Added route-middleware support (very helpful, see the [docs](http://expressjs.com/guide.html#Route-Middleware)) - * Added _jsonp callback_ setting to enable/disable jsonp autowrapping [Dav Glass] - * Added callback query check on response.send to autowrap JSON objects for simple webservice implementations [Dav Glass] - * Added `partial()` support for array-like collections. Closes #434 - * Added support for swappable querystring parsers - * Added session usage docs. Closes #443 - * Added dynamic helper caching. Closes #439 [suggested by maritz] - * Added authentication example - * Added basic Range support to `res.sendfile()` (and `res.download()` etc) - * Changed; `express(1)` generated app using 2 spaces instead of 4 - * Default env to "development" again [aheckmann] - * Removed _context_ option is no more, use "scope" - * Fixed; exposing _./support_ libs to examples so they can run without installs - * Fixed mvc example - -1.0.0rc3 / 2010-09-20 -================== - - * Added confirmation for `express(1)` app generation. Closes #391 - * Added extending of flash formatters via `app.flashFormatters` - * Added flash formatter support. Closes #411 - * Added streaming support to `res.sendfile()` using `sys.pump()` when >= "stream threshold" - * Added _stream threshold_ setting for `res.sendfile()` - * Added `res.send()` __HEAD__ support - * Added `res.clearCookie()` - * Added `res.cookie()` - * Added `res.render()` headers option - * Added `res.redirect()` response bodies - * Added `res.render()` status option support. Closes #425 [thanks aheckmann] - * Fixed `res.sendfile()` responding with 403 on malicious path - * Fixed `res.download()` bug; when an error occurs remove _Content-Disposition_ - * Fixed; mounted apps settings now inherit from parent app [aheckmann] - * Fixed; stripping Content-Length / Content-Type when 204 - * Fixed `res.send()` 204. Closes #419 - * Fixed multiple _Set-Cookie_ headers via `res.header()`. Closes #402 - * Fixed bug messing with error handlers when `listenFD()` is called instead of `listen()`. [thanks guillermo] - - -1.0.0rc2 / 2010-08-17 -================== - - * Added `app.register()` for template engine mapping. Closes #390 - * Added `res.render()` callback support as second argument (no options) - * Added callback support to `res.download()` - * Added callback support for `res.sendfile()` - * Added support for middleware access via `express.middlewareName()` vs `connect.middlewareName()` - * Added "partials" setting to docs - * Added default expresso tests to `express(1)` generated app. Closes #384 - * Fixed `res.sendfile()` error handling, defer via `next()` - * Fixed `res.render()` callback when a layout is used [thanks guillermo] - * Fixed; `make install` creating ~/.node_libraries when not present - * Fixed issue preventing error handlers from being defined anywhere. Closes #387 - -1.0.0rc / 2010-07-28 -================== - - * Added mounted hook. Closes #369 - * Added connect dependency to _package.json_ - - * Removed "reload views" setting and support code - development env never caches, production always caches. - - * Removed _param_ in route callbacks, signature is now - simply (req, res, next), previously (req, res, params, next). - Use _req.params_ for path captures, _req.query_ for GET params. - - * Fixed "home" setting - * Fixed middleware/router precedence issue. Closes #366 - * Fixed; _configure()_ callbacks called immediately. Closes #368 - -1.0.0beta2 / 2010-07-23 -================== - - * Added more examples - * Added; exporting `Server` constructor - * Added `Server#helpers()` for view locals - * Added `Server#dynamicHelpers()` for dynamic view locals. Closes #349 - * Added support for absolute view paths - * Added; _home_ setting defaults to `Server#route` for mounted apps. Closes #363 - * Added Guillermo Rauch to the contributor list - * Added support for "as" for non-collection partials. Closes #341 - * Fixed _install.sh_, ensuring _~/.node_libraries_ exists. Closes #362 [thanks jf] - * Fixed `res.render()` exceptions, now passed to `next()` when no callback is given [thanks guillermo] - * Fixed instanceof `Array` checks, now `Array.isArray()` - * Fixed express(1) expansion of public dirs. Closes #348 - * Fixed middleware precedence. Closes #345 - * Fixed view watcher, now async [thanks aheckmann] - -1.0.0beta / 2010-07-15 -================== - - * Re-write - - much faster - - much lighter - - Check [ExpressJS.com](http://expressjs.com) for migration guide and updated docs - -0.14.0 / 2010-06-15 -================== - - * Utilize relative requires - * Added Static bufferSize option [aheckmann] - * Fixed caching of view and partial subdirectories [aheckmann] - * Fixed mime.type() comments now that ".ext" is not supported - * Updated haml submodule - * Updated class submodule - * Removed bin/express - -0.13.0 / 2010-06-01 -================== - - * Added node v0.1.97 compatibility - * Added support for deleting cookies via Request#cookie('key', null) - * Updated haml submodule - * Fixed not-found page, now using using charset utf-8 - * Fixed show-exceptions page, now using using charset utf-8 - * Fixed view support due to fs.readFile Buffers - * Changed; mime.type() no longer accepts ".type" due to node extname() changes - -0.12.0 / 2010-05-22 -================== - - * Added node v0.1.96 compatibility - * Added view `helpers` export which act as additional local variables - * Updated haml submodule - * Changed ETag; removed inode, modified time only - * Fixed LF to CRLF for setting multiple cookies - * Fixed cookie complation; values are now urlencoded - * Fixed cookies parsing; accepts quoted values and url escaped cookies - -0.11.0 / 2010-05-06 -================== - - * Added support for layouts using different engines - - this.render('page.html.haml', { layout: 'super-cool-layout.html.ejs' }) - - this.render('page.html.haml', { layout: 'foo' }) // assumes 'foo.html.haml' - - this.render('page.html.haml', { layout: false }) // no layout - * Updated ext submodule - * Updated haml submodule - * Fixed EJS partial support by passing along the context. Issue #307 - -0.10.1 / 2010-05-03 -================== - - * Fixed binary uploads. - -0.10.0 / 2010-04-30 -================== - - * Added charset support via Request#charset (automatically assigned to 'UTF-8' when respond()'s - encoding is set to 'utf8' or 'utf-8'. - * Added "encoding" option to Request#render(). Closes #299 - * Added "dump exceptions" setting, which is enabled by default. - * Added simple ejs template engine support - * Added error reponse support for text/plain, application/json. Closes #297 - * Added callback function param to Request#error() - * Added Request#sendHead() - * Added Request#stream() - * Added support for Request#respond(304, null) for empty response bodies - * Added ETag support to Request#sendfile() - * Added options to Request#sendfile(), passed to fs.createReadStream() - * Added filename arg to Request#download() - * Performance enhanced due to pre-reversing plugins so that plugins.reverse() is not called on each request - * Performance enhanced by preventing several calls to toLowerCase() in Router#match() - * Changed; Request#sendfile() now streams - * Changed; Renamed Request#halt() to Request#respond(). Closes #289 - * Changed; Using sys.inspect() instead of JSON.encode() for error output - * Changed; run() returns the http.Server instance. Closes #298 - * Changed; Defaulting Server#host to null (INADDR_ANY) - * Changed; Logger "common" format scale of 0.4f - * Removed Logger "request" format - * Fixed; Catching ENOENT in view caching, preventing error when "views/partials" is not found - * Fixed several issues with http client - * Fixed Logger Content-Length output - * Fixed bug preventing Opera from retaining the generated session id. Closes #292 - -0.9.0 / 2010-04-14 -================== - - * Added DSL level error() route support - * Added DSL level notFound() route support - * Added Request#error() - * Added Request#notFound() - * Added Request#render() callback function. Closes #258 - * Added "max upload size" setting - * Added "magic" variables to collection partials (\_\_index\_\_, \_\_length\_\_, \_\_isFirst\_\_, \_\_isLast\_\_). Closes #254 - * Added [haml.js](http://github.com/visionmedia/haml.js) submodule; removed haml-js - * Added callback function support to Request#halt() as 3rd/4th arg - * Added preprocessing of route param wildcards using param(). Closes #251 - * Added view partial support (with collections etc) - * Fixed bug preventing falsey params (such as ?page=0). Closes #286 - * Fixed setting of multiple cookies. Closes #199 - * Changed; view naming convention is now NAME.TYPE.ENGINE (for example page.html.haml) - * Changed; session cookie is now httpOnly - * Changed; Request is no longer global - * Changed; Event is no longer global - * Changed; "sys" module is no longer global - * Changed; moved Request#download to Static plugin where it belongs - * Changed; Request instance created before body parsing. Closes #262 - * Changed; Pre-caching views in memory when "cache view contents" is enabled. Closes #253 - * Changed; Pre-caching view partials in memory when "cache view partials" is enabled - * Updated support to node --version 0.1.90 - * Updated dependencies - * Removed set("session cookie") in favour of use(Session, { cookie: { ... }}) - * Removed utils.mixin(); use Object#mergeDeep() - -0.8.0 / 2010-03-19 -================== - - * Added coffeescript example app. Closes #242 - * Changed; cache api now async friendly. Closes #240 - * Removed deprecated 'express/static' support. Use 'express/plugins/static' - -0.7.6 / 2010-03-19 -================== - - * Added Request#isXHR. Closes #229 - * Added `make install` (for the executable) - * Added `express` executable for setting up simple app templates - * Added "GET /public/*" to Static plugin, defaulting to /public - * Added Static plugin - * Fixed; Request#render() only calls cache.get() once - * Fixed; Namespacing View caches with "view:" - * Fixed; Namespacing Static caches with "static:" - * Fixed; Both example apps now use the Static plugin - * Fixed set("views"). Closes #239 - * Fixed missing space for combined log format - * Deprecated Request#sendfile() and 'express/static' - * Removed Server#running - -0.7.5 / 2010-03-16 -================== - - * Added Request#flash() support without args, now returns all flashes - * Updated ext submodule - -0.7.4 / 2010-03-16 -================== - - * Fixed session reaper - * Changed; class.js replacing js-oo Class implementation (quite a bit faster, no browser cruft) - -0.7.3 / 2010-03-16 -================== - - * Added package.json - * Fixed requiring of haml / sass due to kiwi removal - -0.7.2 / 2010-03-16 -================== - - * Fixed GIT submodules (HAH!) - -0.7.1 / 2010-03-16 -================== - - * Changed; Express now using submodules again until a PM is adopted - * Changed; chat example using millisecond conversions from ext - -0.7.0 / 2010-03-15 -================== - - * Added Request#pass() support (finds the next matching route, or the given path) - * Added Logger plugin (default "common" format replaces CommonLogger) - * Removed Profiler plugin - * Removed CommonLogger plugin - -0.6.0 / 2010-03-11 -================== - - * Added seed.yml for kiwi package management support - * Added HTTP client query string support when method is GET. Closes #205 - - * Added support for arbitrary view engines. - For example "foo.engine.html" will now require('engine'), - the exports from this module are cached after the first require(). - - * Added async plugin support - - * Removed usage of RESTful route funcs as http client - get() etc, use http.get() and friends - - * Removed custom exceptions - -0.5.0 / 2010-03-10 -================== - - * Added ext dependency (library of js extensions) - * Removed extname() / basename() utils. Use path module - * Removed toArray() util. Use arguments.values - * Removed escapeRegexp() util. Use RegExp.escape() - * Removed process.mixin() dependency. Use utils.mixin() - * Removed Collection - * Removed ElementCollection - * Shameless self promotion of ebook "Advanced JavaScript" (http://dev-mag.com) ;) - -0.4.0 / 2010-02-11 -================== - - * Added flash() example to sample upload app - * Added high level restful http client module (express/http) - * Changed; RESTful route functions double as HTTP clients. Closes #69 - * Changed; throwing error when routes are added at runtime - * Changed; defaulting render() context to the current Request. Closes #197 - * Updated haml submodule - -0.3.0 / 2010-02-11 -================== - - * Updated haml / sass submodules. Closes #200 - * Added flash message support. Closes #64 - * Added accepts() now allows multiple args. fixes #117 - * Added support for plugins to halt. Closes #189 - * Added alternate layout support. Closes #119 - * Removed Route#run(). Closes #188 - * Fixed broken specs due to use(Cookie) missing - -0.2.1 / 2010-02-05 -================== - - * Added "plot" format option for Profiler (for gnuplot processing) - * Added request number to Profiler plugin - * Fixed binary encoding for multi-part file uploads, was previously defaulting to UTF8 - * Fixed issue with routes not firing when not files are present. Closes #184 - * Fixed process.Promise -> events.Promise - -0.2.0 / 2010-02-03 -================== - - * Added parseParam() support for name[] etc. (allows for file inputs with "multiple" attr) Closes #180 - * Added Both Cache and Session option "reapInterval" may be "reapEvery". Closes #174 - * Added expiration support to cache api with reaper. Closes #133 - * Added cache Store.Memory#reap() - * Added Cache; cache api now uses first class Cache instances - * Added abstract session Store. Closes #172 - * Changed; cache Memory.Store#get() utilizing Collection - * Renamed MemoryStore -> Store.Memory - * Fixed use() of the same plugin several time will always use latest options. Closes #176 - -0.1.0 / 2010-02-03 -================== - - * Changed; Hooks (before / after) pass request as arg as well as evaluated in their context - * Updated node support to 0.1.27 Closes #169 - * Updated dirname(__filename) -> __dirname - * Updated libxmljs support to v0.2.0 - * Added session support with memory store / reaping - * Added quick uid() helper - * Added multi-part upload support - * Added Sass.js support / submodule - * Added production env caching view contents and static files - * Added static file caching. Closes #136 - * Added cache plugin with memory stores - * Added support to StaticFile so that it works with non-textual files. - * Removed dirname() helper - * Removed several globals (now their modules must be required) - -0.0.2 / 2010-01-10 -================== - - * Added view benchmarks; currently haml vs ejs - * Added Request#attachment() specs. Closes #116 - * Added use of node's parseQuery() util. Closes #123 - * Added `make init` for submodules - * Updated Haml - * Updated sample chat app to show messages on load - * Updated libxmljs parseString -> parseHtmlString - * Fixed `make init` to work with older versions of git - * Fixed specs can now run independant specs for those who cant build deps. Closes #127 - * Fixed issues introduced by the node url module changes. Closes 126. - * Fixed two assertions failing due to Collection#keys() returning strings - * Fixed faulty Collection#toArray() spec due to keys() returning strings - * Fixed `make test` now builds libxmljs.node before testing - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/express/LICENSE b/node_modules/express/LICENSE deleted file mode 100644 index 36075a3..0000000 --- a/node_modules/express/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2009-2011 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/express/Makefile b/node_modules/express/Makefile deleted file mode 100644 index 228f299..0000000 --- a/node_modules/express/Makefile +++ /dev/null @@ -1,33 +0,0 @@ - -MOCHA_OPTS= --check-leaks -REPORTER = dot - -check: test - -test: test-unit test-acceptance - -test-unit: - @NODE_ENV=test ./node_modules/.bin/mocha \ - --reporter $(REPORTER) \ - $(MOCHA_OPTS) - -test-acceptance: - @NODE_ENV=test ./node_modules/.bin/mocha \ - --reporter $(REPORTER) \ - --bail \ - test/acceptance/*.js - -test-cov: lib-cov - @EXPRESS_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html - -lib-cov: - @jscoverage lib lib-cov - -benchmark: - @./support/bench - -clean: - rm -f coverage.html - rm -fr lib-cov - -.PHONY: test test-unit test-acceptance benchmark clean diff --git a/node_modules/express/Readme.md b/node_modules/express/Readme.md deleted file mode 100644 index 61ee6ea..0000000 --- a/node_modules/express/Readme.md +++ /dev/null @@ -1,180 +0,0 @@ -![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png) - - Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) [![Dependency Status](https://gemnasium.com/visionmedia/express.png)](https://gemnasium.com/visionmedia/express) - -```js -var express = require('express'); -var app = express(); - -app.get('/', function(req, res){ - res.send('Hello World'); -}); - -app.listen(3000); -``` - -## Installation - - $ npm install -g express - -## Quick Start - - The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below: - - Create the app: - - $ npm install -g express - $ express /tmp/foo && cd /tmp/foo - - Install dependencies: - - $ npm install - - Start the server: - - $ node app - -## Features - - * Built on [Connect](http://github.com/senchalabs/connect) - * Robust routing - * HTTP helpers (redirection, caching, etc) - * View system supporting 14+ template engines - * Content negotiation - * Focus on high performance - * Environment based configuration - * Executable for generating applications quickly - * High test coverage - -## Philosophy - - The Express philosophy is to provide small, robust tooling for HTTP servers. Making - it a great solution for single page applications, web sites, hybrids, or public - HTTP APIs. - - Built on Connect you can use _only_ what you need, and nothing more, applications - can be as big or as small as you like, even a single file. Express does - not force you to use any specific ORM or template engine. With support for over - 14 template engines via [Consolidate.js](http://github.com/visionmedia/consolidate.js) - you can quickly craft your perfect framework. - -## More Information - - * Join #express on freenode - * [Google Group](http://groups.google.com/group/express-js) for discussion - * Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates - * Visit the [Wiki](http://github.com/visionmedia/express/wiki) - * [日本語ドキュメンテーション](http://hideyukisaito.com/doc/expressjs/) by [hideyukisaito](https://github.com/hideyukisaito) - * [Русскоязычная документация](http://jsman.ru/express/) - * Run express examples [online](https://runnable.com/express) - -## Viewing Examples - -Clone the Express repo, then install the dev dependencies to install all the example / test suite deps: - - $ git clone git://github.com/visionmedia/express.git --depth 1 - $ cd express - $ npm install - -then run whichever tests you want: - - $ node examples/content-negotiation - -## Running Tests - -To run the test suite first invoke the following command within the repo, installing the development dependencies: - - $ npm install - -then run the tests: - - $ make test - -## Contributors - -``` -project: express -commits: 3559 -active : 468 days -files : 237 -authors: - 1891 Tj Holowaychuk 53.1% - 1285 visionmedia 36.1% - 182 TJ Holowaychuk 5.1% - 54 Aaron Heckmann 1.5% - 34 csausdev 1.0% - 26 ciaranj 0.7% - 21 Robert Sköld 0.6% - 6 Guillermo Rauch 0.2% - 3 Dav Glass 0.1% - 3 Nick Poulden 0.1% - 2 Randy Merrill 0.1% - 2 Benny Wong 0.1% - 2 Hunter Loftis 0.1% - 2 Jake Gordon 0.1% - 2 Brian McKinney 0.1% - 2 Roman Shtylman 0.1% - 2 Ben Weaver 0.1% - 2 Dave Hoover 0.1% - 2 Eivind Fjeldstad 0.1% - 2 Daniel Shaw 0.1% - 1 Matt Colyer 0.0% - 1 Pau Ramon 0.0% - 1 Pero Pejovic 0.0% - 1 Peter Rekdal Sunde 0.0% - 1 Raynos 0.0% - 1 Teng Siong Ong 0.0% - 1 Viktor Kelemen 0.0% - 1 ctide 0.0% - 1 8bitDesigner 0.0% - 1 isaacs 0.0% - 1 mgutz 0.0% - 1 pikeas 0.0% - 1 shuwatto 0.0% - 1 tstrimple 0.0% - 1 ewoudj 0.0% - 1 Adam Sanderson 0.0% - 1 Andrii Kostenko 0.0% - 1 Andy Hiew 0.0% - 1 Arpad Borsos 0.0% - 1 Ashwin Purohit 0.0% - 1 Benjen 0.0% - 1 Darren Torpey 0.0% - 1 Greg Ritter 0.0% - 1 Gregory Ritter 0.0% - 1 James Herdman 0.0% - 1 Jim Snodgrass 0.0% - 1 Joe McCann 0.0% - 1 Jonathan Dumaine 0.0% - 1 Jonathan Palardy 0.0% - 1 Jonathan Zacsh 0.0% - 1 Justin Lilly 0.0% - 1 Ken Sato 0.0% - 1 Maciej Małecki 0.0% - 1 Masahiro Hayashi 0.0% -``` - -## License - -(The MIT License) - -Copyright (c) 2009-2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/express/bin/express b/node_modules/express/bin/express deleted file mode 100755 index 337c74e..0000000 --- a/node_modules/express/bin/express +++ /dev/null @@ -1,422 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var exec = require('child_process').exec - , program = require('commander') - , mkdirp = require('mkdirp') - , pkg = require('../package.json') - , version = pkg.version - , os = require('os') - , fs = require('fs'); - -// CLI - -program - .version(version) - .option('-s, --sessions', 'add session support') - .option('-e, --ejs', 'add ejs engine support (defaults to jade)') - .option('-J, --jshtml', 'add jshtml engine support (defaults to jade)') - .option('-H, --hogan', 'add hogan.js engine support') - .option('-c, --css ', 'add stylesheet support (less|stylus) (defaults to plain css)') - .option('-f, --force', 'force on non-empty directory') - .parse(process.argv); - -// Path - -var path = program.args.shift() || '.'; - -// end-of-line code - -var eol = os.EOL - -// Template engine - -program.template = 'jade'; -if (program.ejs) program.template = 'ejs'; -if (program.jshtml) program.template = 'jshtml'; -if (program.hogan) program.template = 'hjs'; - -/** - * Routes index template. - */ - -var index = [ - '' - , '/*' - , ' * GET home page.' - , ' */' - , '' - , 'exports.index = function(req, res){' - , ' res.render(\'index\', { title: \'Express\' });' - , '};' -].join(eol); - -/** - * Routes users template. - */ - -var users = [ - '' - , '/*' - , ' * GET users listing.' - , ' */' - , '' - , 'exports.list = function(req, res){' - , ' res.send("respond with a resource");' - , '};' -].join(eol); - -/** - * Jade layout template. - */ - -var jadeLayout = [ - 'doctype 5' - , 'html' - , ' head' - , ' title= title' - , ' link(rel=\'stylesheet\', href=\'/stylesheets/style.css\')' - , ' body' - , ' block content' -].join(eol); - -/** - * Jade index template. - */ - -var jadeIndex = [ - 'extends layout' - , '' - , 'block content' - , ' h1= title' - , ' p Welcome to #{title}' -].join(eol); - -/** - * EJS index template. - */ - -var ejsIndex = [ - '' - , '' - , ' ' - , ' <%= title %>' - , ' ' - , ' ' - , ' ' - , '

<%= title %>

' - , '

Welcome to <%= title %>

' - , ' ' - , '' -].join(eol); - -/** - * JSHTML layout template. - */ - -var jshtmlLayout = [ - '' - , '' - , ' ' - , ' @write(title) ' - , ' ' - , ' ' - , ' ' - , ' @write(body)' - , ' ' - , '' -].join(eol); - -/** - * JSHTML index template. - */ - -var jshtmlIndex = [ - '

@write(title)

' - , '

Welcome to @write(title)

' -].join(eol); - -/** - * Hogan.js index template. - */ -var hoganIndex = [ - '' - , '' - , ' ' - , ' {{ title }}' - , ' ' - , ' ' - , ' ' - , '

{{ title }}

' - , '

Welcome to {{ title }}

' - , ' ' - , '' -].join(eol); - -/** - * Default css template. - */ - -var css = [ - 'body {' - , ' padding: 50px;' - , ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;' - , '}' - , '' - , 'a {' - , ' color: #00B7FF;' - , '}' -].join(eol); - -/** - * Default less template. - */ - -var less = [ - 'body {' - , ' padding: 50px;' - , ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;' - , '}' - , '' - , 'a {' - , ' color: #00B7FF;' - , '}' -].join(eol); - -/** - * Default stylus template. - */ - -var stylus = [ - 'body' - , ' padding: 50px' - , ' font: 14px "Lucida Grande", Helvetica, Arial, sans-serif' - , 'a' - , ' color: #00B7FF' -].join(eol); - -/** - * App template. - */ - -var app = [ - '' - , '/**' - , ' * Module dependencies.' - , ' */' - , '' - , 'var express = require(\'express\')' - , ' , routes = require(\'./routes\')' - , ' , user = require(\'./routes/user\')' - , ' , http = require(\'http\')' - , ' , path = require(\'path\');' - , '' - , 'var app = express();' - , '' - , '// all environments' - , 'app.set(\'port\', process.env.PORT || 3000);' - , 'app.set(\'views\', __dirname + \'/views\');' - , 'app.set(\'view engine\', \':TEMPLATE\');' - , 'app.use(express.favicon());' - , 'app.use(express.logger(\'dev\'));' - , 'app.use(express.bodyParser());' - , 'app.use(express.methodOverride());{sess}' - , 'app.use(app.router);{css}' - , 'app.use(express.static(path.join(__dirname, \'public\')));' - , '' - , '// development only' - , 'if (\'development\' == app.get(\'env\')) {' - , ' app.use(express.errorHandler());' - , '}' - , '' - , 'app.get(\'/\', routes.index);' - , 'app.get(\'/users\', user.list);' - , '' - , 'http.createServer(app).listen(app.get(\'port\'), function(){' - , ' console.log(\'Express server listening on port \' + app.get(\'port\'));' - , '});' - , '' -].join(eol); - -// Generate application - -(function createApplication(path) { - emptyDirectory(path, function(empty){ - if (empty || program.force) { - createApplicationAt(path); - } else { - program.confirm('destination is not empty, continue? ', function(ok){ - if (ok) { - process.stdin.destroy(); - createApplicationAt(path); - } else { - abort('aborting'); - } - }); - } - }); -})(path); - -/** - * Create application at the given directory `path`. - * - * @param {String} path - */ - -function createApplicationAt(path) { - console.log(); - process.on('exit', function(){ - console.log(); - console.log(' install dependencies:'); - console.log(' $ cd %s && npm install', path); - console.log(); - console.log(' run the app:'); - console.log(' $ node app'); - console.log(); - }); - - mkdir(path, function(){ - mkdir(path + '/public'); - mkdir(path + '/public/javascripts'); - mkdir(path + '/public/images'); - mkdir(path + '/public/stylesheets', function(){ - switch (program.css) { - case 'less': - write(path + '/public/stylesheets/style.less', less); - break; - case 'stylus': - write(path + '/public/stylesheets/style.styl', stylus); - break; - default: - write(path + '/public/stylesheets/style.css', css); - } - }); - - mkdir(path + '/routes', function(){ - write(path + '/routes/index.js', index); - write(path + '/routes/user.js', users); - }); - - mkdir(path + '/views', function(){ - switch (program.template) { - case 'ejs': - write(path + '/views/index.ejs', ejsIndex); - break; - case 'jade': - write(path + '/views/layout.jade', jadeLayout); - write(path + '/views/index.jade', jadeIndex); - break; - case 'jshtml': - write(path + '/views/layout.jshtml', jshtmlLayout); - write(path + '/views/index.jshtml', jshtmlIndex); - break; - case 'hjs': - write(path + '/views/index.hjs', hoganIndex); - break; - - } - }); - - // CSS Engine support - switch (program.css) { - case 'less': - app = app.replace('{css}', eol + ' app.use(require(\'less-middleware\')({ src: __dirname + \'/public\' }));'); - break; - case 'stylus': - app = app.replace('{css}', eol + ' app.use(require(\'stylus\').middleware(__dirname + \'/public\'));'); - break; - default: - app = app.replace('{css}', ''); - } - - // Session support - app = app.replace('{sess}', program.sessions - ? eol + ' app.use(express.cookieParser(\'your secret here\'));' + eol + ' app.use(express.session());' - : ''); - - // Template support - app = app.replace(':TEMPLATE', program.template); - - // package.json - var pkg = { - name: 'application-name' - , version: '0.0.1' - , private: true - , scripts: { start: 'node app.js' } - , dependencies: { - express: version - } - } - - if (program.template) pkg.dependencies[program.template] = '*'; - - // CSS Engine support - switch (program.css) { - case 'less': - pkg.dependencies['less-middleware'] = '*'; - break; - default: - if (program.css) { - pkg.dependencies[program.css] = '*'; - } - } - - write(path + '/package.json', JSON.stringify(pkg, null, 2)); - write(path + '/app.js', app); - }); -} - -/** - * Check if the given directory `path` is empty. - * - * @param {String} path - * @param {Function} fn - */ - -function emptyDirectory(path, fn) { - fs.readdir(path, function(err, files){ - if (err && 'ENOENT' != err.code) throw err; - fn(!files || !files.length); - }); -} - -/** - * echo str > path. - * - * @param {String} path - * @param {String} str - */ - -function write(path, str) { - fs.writeFile(path, str); - console.log(' \x1b[36mcreate\x1b[0m : ' + path); -} - -/** - * Mkdir -p. - * - * @param {String} path - * @param {Function} fn - */ - -function mkdir(path, fn) { - mkdirp(path, 0755, function(err){ - if (err) throw err; - console.log(' \033[36mcreate\033[0m : ' + path); - fn && fn(); - }); -} - -/** - * Exit with the given `str`. - * - * @param {String} str - */ - -function abort(str) { - console.error(str); - process.exit(1); -} diff --git a/node_modules/express/client.js b/node_modules/express/client.js deleted file mode 100644 index 8984c44..0000000 --- a/node_modules/express/client.js +++ /dev/null @@ -1,25 +0,0 @@ - -var http = require('http'); - -var times = 50; - -while (times--) { - var req = http.request({ - port: 3000 - , method: 'POST' - , headers: { 'Content-Type': 'application/x-www-form-urlencoded' } - }); - - req.on('response', function(res){ - console.log(res.statusCode); - }); - - var n = 500000; - while (n--) { - req.write('foo=bar&bar=baz&'); - } - - req.write('foo=bar&bar=baz'); - - req.end(); -} \ No newline at end of file diff --git a/node_modules/express/index.js b/node_modules/express/index.js deleted file mode 100644 index bfe9934..0000000 --- a/node_modules/express/index.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = process.env.EXPRESS_COV - ? require('./lib-cov/express') - : require('./lib/express'); \ No newline at end of file diff --git a/node_modules/express/lib/application.js b/node_modules/express/lib/application.js deleted file mode 100644 index 557f734..0000000 --- a/node_modules/express/lib/application.js +++ /dev/null @@ -1,530 +0,0 @@ -/** - * Module dependencies. - */ - -var connect = require('connect') - , Router = require('./router') - , methods = require('methods') - , middleware = require('./middleware') - , debug = require('debug')('express:application') - , locals = require('./utils').locals - , View = require('./view') - , utils = connect.utils - , path = require('path') - , http = require('http') - , join = path.join; - -/** - * Application prototype. - */ - -var app = exports = module.exports = {}; - -/** - * Initialize the server. - * - * - setup default configuration - * - setup default middleware - * - setup route reflection methods - * - * @api private - */ - -app.init = function(){ - this.cache = {}; - this.settings = {}; - this.engines = {}; - this.defaultConfiguration(); -}; - -/** - * Initialize application configuration. - * - * @api private - */ - -app.defaultConfiguration = function(){ - // default settings - this.enable('x-powered-by'); - this.set('env', process.env.NODE_ENV || 'development'); - this.set('subdomain offset', 2); - debug('booting in %s mode', this.get('env')); - - // implicit middleware - this.use(connect.query()); - this.use(middleware.init(this)); - - // inherit protos - this.on('mount', function(parent){ - this.request.__proto__ = parent.request; - this.response.__proto__ = parent.response; - this.engines.__proto__ = parent.engines; - this.settings.__proto__ = parent.settings; - }); - - // router - this._router = new Router(this); - this.routes = this._router.map; - this.__defineGetter__('router', function(){ - this._usedRouter = true; - this._router.caseSensitive = this.enabled('case sensitive routing'); - this._router.strict = this.enabled('strict routing'); - return this._router.middleware; - }); - - // setup locals - this.locals = locals(this); - - // default locals - this.locals.settings = this.settings; - - // default configuration - this.set('views', process.cwd() + '/views'); - this.set('jsonp callback name', 'callback'); - - this.configure('development', function(){ - this.set('json spaces', 2); - }); - - this.configure('production', function(){ - this.enable('view cache'); - }); -}; - -/** - * Proxy `connect#use()` to apply settings to - * mounted applications. - * - * @param {String|Function|Server} route - * @param {Function|Server} fn - * @return {app} for chaining - * @api public - */ - -app.use = function(route, fn){ - var app; - - // default route to '/' - if ('string' != typeof route) fn = route, route = '/'; - - // express app - if (fn.handle && fn.set) app = fn; - - // restore .app property on req and res - if (app) { - app.route = route; - fn = function(req, res, next) { - var orig = req.app; - app.handle(req, res, function(err){ - req.app = res.app = orig; - req.__proto__ = orig.request; - res.__proto__ = orig.response; - next(err); - }); - }; - } - - connect.proto.use.call(this, route, fn); - - // mounted an app - if (app) { - app.parent = this; - app.emit('mount', this); - } - - return this; -}; - -/** - * Register the given template engine callback `fn` - * as `ext`. - * - * By default will `require()` the engine based on the - * file extension. For example if you try to render - * a "foo.jade" file Express will invoke the following internally: - * - * app.engine('jade', require('jade').__express); - * - * For engines that do not provide `.__express` out of the box, - * or if you wish to "map" a different extension to the template engine - * you may use this method. For example mapping the EJS template engine to - * ".html" files: - * - * app.engine('html', require('ejs').renderFile); - * - * In this case EJS provides a `.renderFile()` method with - * the same signature that Express expects: `(path, options, callback)`, - * though note that it aliases this method as `ejs.__express` internally - * so if you're using ".ejs" extensions you dont need to do anything. - * - * Some template engines do not follow this convention, the - * [Consolidate.js](https://github.com/visionmedia/consolidate.js) - * library was created to map all of node's popular template - * engines to follow this convention, thus allowing them to - * work seamlessly within Express. - * - * @param {String} ext - * @param {Function} fn - * @return {app} for chaining - * @api public - */ - -app.engine = function(ext, fn){ - if ('function' != typeof fn) throw new Error('callback function required'); - if ('.' != ext[0]) ext = '.' + ext; - this.engines[ext] = fn; - return this; -}; - -/** - * Map the given param placeholder `name`(s) to the given callback(s). - * - * Parameter mapping is used to provide pre-conditions to routes - * which use normalized placeholders. For example a _:user_id_ parameter - * could automatically load a user's information from the database without - * any additional code, - * - * The callback uses the samesignature as middleware, the only differencing - * being that the value of the placeholder is passed, in this case the _id_ - * of the user. Once the `next()` function is invoked, just like middleware - * it will continue on to execute the route, or subsequent parameter functions. - * - * app.param('user_id', function(req, res, next, id){ - * User.find(id, function(err, user){ - * if (err) { - * next(err); - * } else if (user) { - * req.user = user; - * next(); - * } else { - * next(new Error('failed to load user')); - * } - * }); - * }); - * - * @param {String|Array} name - * @param {Function} fn - * @return {app} for chaining - * @api public - */ - -app.param = function(name, fn){ - var self = this - , fns = [].slice.call(arguments, 1); - - // array - if (Array.isArray(name)) { - name.forEach(function(name){ - fns.forEach(function(fn){ - self.param(name, fn); - }); - }); - // param logic - } else if ('function' == typeof name) { - this._router.param(name); - // single - } else { - if (':' == name[0]) name = name.substr(1); - fns.forEach(function(fn){ - self._router.param(name, fn); - }); - } - - return this; -}; - -/** - * Assign `setting` to `val`, or return `setting`'s value. - * - * app.set('foo', 'bar'); - * app.get('foo'); - * // => "bar" - * - * Mounted servers inherit their parent server's settings. - * - * @param {String} setting - * @param {String} val - * @return {Server} for chaining - * @api public - */ - -app.set = function(setting, val){ - if (1 == arguments.length) { - return this.settings[setting]; - } else { - this.settings[setting] = val; - return this; - } -}; - -/** - * Return the app's absolute pathname - * based on the parent(s) that have - * mounted it. - * - * For example if the application was - * mounted as "/admin", which itself - * was mounted as "/blog" then the - * return value would be "/blog/admin". - * - * @return {String} - * @api private - */ - -app.path = function(){ - return this.parent - ? this.parent.path() + this.route - : ''; -}; - -/** - * Check if `setting` is enabled (truthy). - * - * app.enabled('foo') - * // => false - * - * app.enable('foo') - * app.enabled('foo') - * // => true - * - * @param {String} setting - * @return {Boolean} - * @api public - */ - -app.enabled = function(setting){ - return !!this.set(setting); -}; - -/** - * Check if `setting` is disabled. - * - * app.disabled('foo') - * // => true - * - * app.enable('foo') - * app.disabled('foo') - * // => false - * - * @param {String} setting - * @return {Boolean} - * @api public - */ - -app.disabled = function(setting){ - return !this.set(setting); -}; - -/** - * Enable `setting`. - * - * @param {String} setting - * @return {app} for chaining - * @api public - */ - -app.enable = function(setting){ - return this.set(setting, true); -}; - -/** - * Disable `setting`. - * - * @param {String} setting - * @return {app} for chaining - * @api public - */ - -app.disable = function(setting){ - return this.set(setting, false); -}; - -/** - * Configure callback for zero or more envs, - * when no `env` is specified that callback will - * be invoked for all environments. Any combination - * can be used multiple times, in any order desired. - * - * Examples: - * - * app.configure(function(){ - * // executed for all envs - * }); - * - * app.configure('stage', function(){ - * // executed staging env - * }); - * - * app.configure('stage', 'production', function(){ - * // executed for stage and production - * }); - * - * Note: - * - * These callbacks are invoked immediately, and - * are effectively sugar for the following: - * - * var env = process.env.NODE_ENV || 'development'; - * - * switch (env) { - * case 'development': - * ... - * break; - * case 'stage': - * ... - * break; - * case 'production': - * ... - * break; - * } - * - * @param {String} env... - * @param {Function} fn - * @return {app} for chaining - * @api public - */ - -app.configure = function(env, fn){ - var envs = 'all' - , args = [].slice.call(arguments); - fn = args.pop(); - if (args.length) envs = args; - if ('all' == envs || ~envs.indexOf(this.settings.env)) fn.call(this); - return this; -}; - -/** - * Delegate `.VERB(...)` calls to `router.VERB(...)`. - */ - -methods.forEach(function(method){ - app[method] = function(path){ - if ('get' == method && 1 == arguments.length) return this.set(path); - - // if no router attached yet, attach the router - if (!this._usedRouter) this.use(this.router); - - // setup route - this._router[method].apply(this._router, arguments); - return this; - }; -}); - -/** - * Special-cased "all" method, applying the given route `path`, - * middleware, and callback to _every_ HTTP method. - * - * @param {String} path - * @param {Function} ... - * @return {app} for chaining - * @api public - */ - -app.all = function(path){ - var args = arguments; - methods.forEach(function(method){ - app[method].apply(this, args); - }, this); - return this; -}; - -// del -> delete alias - -app.del = app.delete; - -/** - * Render the given view `name` name with `options` - * and a callback accepting an error and the - * rendered template string. - * - * Example: - * - * app.render('email', { name: 'Tobi' }, function(err, html){ - * // ... - * }) - * - * @param {String} name - * @param {String|Function} options or fn - * @param {Function} fn - * @api public - */ - -app.render = function(name, options, fn){ - var opts = {} - , cache = this.cache - , engines = this.engines - , view; - - // support callback function as second arg - if ('function' == typeof options) { - fn = options, options = {}; - } - - // merge app.locals - utils.merge(opts, this.locals); - - // merge options._locals - if (options._locals) utils.merge(opts, options._locals); - - // merge options - utils.merge(opts, options); - - // set .cache unless explicitly provided - opts.cache = null == opts.cache - ? this.enabled('view cache') - : opts.cache; - - // primed cache - if (opts.cache) view = cache[name]; - - // view - if (!view) { - view = new View(name, { - defaultEngine: this.get('view engine'), - root: this.get('views'), - engines: engines - }); - - if (!view.path) { - var err = new Error('Failed to lookup view "' + name + '"'); - err.view = view; - return fn(err); - } - - // prime the cache - if (opts.cache) cache[name] = view; - } - - // render - try { - view.render(opts, fn); - } catch (err) { - fn(err); - } -}; - -/** - * Listen for connections. - * - * A node `http.Server` is returned, with this - * application (which is a `Function`) as its - * callback. If you wish to create both an HTTP - * and HTTPS server you may do so with the "http" - * and "https" modules as shown here: - * - * var http = require('http') - * , https = require('https') - * , express = require('express') - * , app = express(); - * - * http.createServer(app).listen(80); - * https.createServer({ ... }, app).listen(443); - * - * @return {http.Server} - * @api public - */ - -app.listen = function(){ - var server = http.createServer(this); - return server.listen.apply(server, arguments); -}; diff --git a/node_modules/express/lib/express.js b/node_modules/express/lib/express.js deleted file mode 100644 index d0b7a12..0000000 --- a/node_modules/express/lib/express.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Module dependencies. - */ - -var connect = require('connect') - , proto = require('./application') - , Route = require('./router/route') - , Router = require('./router') - , req = require('./request') - , res = require('./response') - , utils = connect.utils; - -/** - * Expose `createApplication()`. - */ - -exports = module.exports = createApplication; - -/** - * Framework version. - */ - -exports.version = '3.1.2'; - -/** - * Expose mime. - */ - -exports.mime = connect.mime; - -/** - * Create an express application. - * - * @return {Function} - * @api public - */ - -function createApplication() { - var app = connect(); - utils.merge(app, proto); - app.request = { __proto__: req }; - app.response = { __proto__: res }; - app.init(); - return app; -} - -/** - * Expose connect.middleware as express.* - * for example `express.logger` etc. - */ - -for (var key in connect.middleware) { - Object.defineProperty( - exports - , key - , Object.getOwnPropertyDescriptor(connect.middleware, key)); -} - -/** - * Error on createServer(). - */ - -exports.createServer = function(){ - console.warn('Warning: express.createServer() is deprecated, express'); - console.warn('applications no longer inherit from http.Server,'); - console.warn('please use:'); - console.warn(''); - console.warn(' var express = require("express");'); - console.warn(' var app = express();'); - console.warn(''); - return createApplication(); -}; - -/** - * Expose the prototypes. - */ - -exports.application = proto; -exports.request = req; -exports.response = res; - -/** - * Expose constructors. - */ - -exports.Route = Route; -exports.Router = Router; - -// Error handler title - -exports.errorHandler.title = 'Express'; - diff --git a/node_modules/express/lib/middleware.js b/node_modules/express/lib/middleware.js deleted file mode 100644 index 308c5bb..0000000 --- a/node_modules/express/lib/middleware.js +++ /dev/null @@ -1,33 +0,0 @@ - -/** - * Module dependencies. - */ - -var utils = require('./utils'); - -/** - * Initialization middleware, exposing the - * request and response to eachother, as well - * as defaulting the X-Powered-By header field. - * - * @param {Function} app - * @return {Function} - * @api private - */ - -exports.init = function(app){ - return function expressInit(req, res, next){ - req.app = res.app = app; - if (app.enabled('x-powered-by')) res.setHeader('X-Powered-By', 'Express'); - req.res = res; - res.req = req; - req.next = next; - - req.__proto__ = app.request; - res.__proto__ = app.response; - - res.locals = res.locals || utils.locals(res); - - next(); - } -}; diff --git a/node_modules/express/lib/request.js b/node_modules/express/lib/request.js deleted file mode 100644 index 616b0af..0000000 --- a/node_modules/express/lib/request.js +++ /dev/null @@ -1,496 +0,0 @@ - -/** - * Module dependencies. - */ - -var http = require('http') - , utils = require('./utils') - , connect = require('connect') - , fresh = require('fresh') - , parseRange = require('range-parser') - , parse = connect.utils.parseUrl - , mime = connect.mime; - -/** - * Request prototype. - */ - -var req = exports = module.exports = { - __proto__: http.IncomingMessage.prototype -}; - -/** - * Return request header. - * - * The `Referrer` header field is special-cased, - * both `Referrer` and `Referer` are interchangeable. - * - * Examples: - * - * req.get('Content-Type'); - * // => "text/plain" - * - * req.get('content-type'); - * // => "text/plain" - * - * req.get('Something'); - * // => undefined - * - * Aliased as `req.header()`. - * - * @param {String} name - * @return {String} - * @api public - */ - -req.get = -req.header = function(name){ - switch (name = name.toLowerCase()) { - case 'referer': - case 'referrer': - return this.headers.referrer - || this.headers.referer; - default: - return this.headers[name]; - } -}; - -/** - * Check if the given `type(s)` is acceptable, returning - * the best match when true, otherwise `undefined`, in which - * case you should respond with 406 "Not Acceptable". - * - * The `type` value may be a single mime type string - * such as "application/json", the extension name - * such as "json", a comma-delimted list such as "json, html, text/plain", - * or an array `["json", "html", "text/plain"]`. When a list - * or array is given the _best_ match, if any is returned. - * - * Examples: - * - * // Accept: text/html - * req.accepts('html'); - * // => "html" - * - * // Accept: text/*, application/json - * req.accepts('html'); - * // => "html" - * req.accepts('text/html'); - * // => "text/html" - * req.accepts('json, text'); - * // => "json" - * req.accepts('application/json'); - * // => "application/json" - * - * // Accept: text/*, application/json - * req.accepts('image/png'); - * req.accepts('png'); - * // => undefined - * - * // Accept: text/*;q=.5, application/json - * req.accepts(['html', 'json']); - * req.accepts('html, json'); - * // => "json" - * - * @param {String|Array} type(s) - * @return {String} - * @api public - */ - -req.accepts = function(type){ - return utils.accepts(type, this.get('Accept')); -}; - -/** - * Check if the given `charset` is acceptable, - * otherwise you should respond with 406 "Not Acceptable". - * - * @param {String} charset - * @return {Boolean} - * @api public - */ - -req.acceptsCharset = function(charset){ - var accepted = this.acceptedCharsets; - return accepted.length - ? ~accepted.indexOf(charset) - : true; -}; - -/** - * Check if the given `lang` is acceptable, - * otherwise you should respond with 406 "Not Acceptable". - * - * @param {String} lang - * @return {Boolean} - * @api public - */ - -req.acceptsLanguage = function(lang){ - var accepted = this.acceptedLanguages; - return accepted.length - ? ~accepted.indexOf(lang) - : true; -}; - -/** - * Parse Range header field, - * capping to the given `size`. - * - * Unspecified ranges such as "0-" require - * knowledge of your resource length. In - * the case of a byte range this is of course - * the total number of bytes. If the Range - * header field is not given `null` is returned, - * `-1` when unsatisfiable, `-2` when syntactically invalid. - * - * NOTE: remember that ranges are inclusive, so - * for example "Range: users=0-3" should respond - * with 4 users when available, not 3. - * - * @param {Number} size - * @return {Array} - * @api public - */ - -req.range = function(size){ - var range = this.get('Range'); - if (!range) return; - return parseRange(size, range); -}; - -/** - * Return an array of Accepted media types - * ordered from highest quality to lowest. - * - * Examples: - * - * [ { value: 'application/json', - * quality: 1, - * type: 'application', - * subtype: 'json' }, - * { value: 'text/html', - * quality: 0.5, - * type: 'text', - * subtype: 'html' } ] - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('accepted', function(){ - var accept = this.get('Accept'); - return accept - ? utils.parseAccept(accept) - : []; -}); - -/** - * Return an array of Accepted languages - * ordered from highest quality to lowest. - * - * Examples: - * - * Accept-Language: en;q=.5, en-us - * ['en-us', 'en'] - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('acceptedLanguages', function(){ - var accept = this.get('Accept-Language'); - return accept - ? utils - .parseParams(accept) - .map(function(obj){ - return obj.value; - }) - : []; -}); - -/** - * Return an array of Accepted charsets - * ordered from highest quality to lowest. - * - * Examples: - * - * Accept-Charset: iso-8859-5;q=.2, unicode-1-1;q=0.8 - * ['unicode-1-1', 'iso-8859-5'] - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('acceptedCharsets', function(){ - var accept = this.get('Accept-Charset'); - return accept - ? utils - .parseParams(accept) - .map(function(obj){ - return obj.value; - }) - : []; -}); - -/** - * Return the value of param `name` when present or `defaultValue`. - * - * - Checks route placeholders, ex: _/user/:id_ - * - Checks body params, ex: id=12, {"id":12} - * - Checks query string params, ex: ?id=12 - * - * To utilize request bodies, `req.body` - * should be an object. This can be done by using - * the `connect.bodyParser()` middleware. - * - * @param {String} name - * @param {Mixed} [defaultValue] - * @return {String} - * @api public - */ - -req.param = function(name, defaultValue){ - var params = this.params || {}; - var body = this.body || {}; - var query = this.query || {}; - if (null != params[name] && params.hasOwnProperty(name)) return params[name]; - if (null != body[name]) return body[name]; - if (null != query[name]) return query[name]; - return defaultValue; -}; - -/** - * Check if the incoming request contains the "Content-Type" - * header field, and it contains the give mime `type`. - * - * Examples: - * - * // With Content-Type: text/html; charset=utf-8 - * req.is('html'); - * req.is('text/html'); - * req.is('text/*'); - * // => true - * - * // When Content-Type is application/json - * req.is('json'); - * req.is('application/json'); - * req.is('application/*'); - * // => true - * - * req.is('html'); - * // => false - * - * @param {String} type - * @return {Boolean} - * @api public - */ - -req.is = function(type){ - var ct = this.get('Content-Type'); - if (!ct) return false; - ct = ct.split(';')[0]; - if (!~type.indexOf('/')) type = mime.lookup(type); - if (~type.indexOf('*')) { - type = type.split('/'); - ct = ct.split('/'); - if ('*' == type[0] && type[1] == ct[1]) return true; - if ('*' == type[1] && type[0] == ct[0]) return true; - return false; - } - return !! ~ct.indexOf(type); -}; - -/** - * Return the protocol string "http" or "https" - * when requested with TLS. When the "trust proxy" - * setting is enabled the "X-Forwarded-Proto" header - * field will be trusted. If you're running behind - * a reverse proxy that supplies https for you this - * may be enabled. - * - * @return {String} - * @api public - */ - -req.__defineGetter__('protocol', function(){ - var trustProxy = this.app.get('trust proxy'); - return this.connection.encrypted - ? 'https' - : trustProxy - ? (this.get('X-Forwarded-Proto') || 'http') - : 'http'; -}); - -/** - * Short-hand for: - * - * req.protocol == 'https' - * - * @return {Boolean} - * @api public - */ - -req.__defineGetter__('secure', function(){ - return 'https' == this.protocol; -}); - -/** - * Return the remote address, or when - * "trust proxy" is `true` return - * the upstream addr. - * - * @return {String} - * @api public - */ - -req.__defineGetter__('ip', function(){ - return this.ips[0] || this.connection.remoteAddress; -}); - -/** - * When "trust proxy" is `true`, parse - * the "X-Forwarded-For" ip address list. - * - * For example if the value were "client, proxy1, proxy2" - * you would receive the array `["client", "proxy1", "proxy2"]` - * where "proxy2" is the furthest down-stream. - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('ips', function(){ - var trustProxy = this.app.get('trust proxy'); - var val = this.get('X-Forwarded-For'); - return trustProxy && val - ? val.split(/ *, */) - : []; -}); - -/** - * Return basic auth credentials. - * - * Examples: - * - * // http://tobi:hello@example.com - * req.auth - * // => { username: 'tobi', password: 'hello' } - * - * @return {Object} or undefined - * @api public - */ - -req.__defineGetter__('auth', function(){ - // missing - var auth = this.get('Authorization'); - if (!auth) return; - - // malformed - var parts = auth.split(' '); - if ('basic' != parts[0].toLowerCase()) return; - if (!parts[1]) return; - auth = parts[1]; - - // credentials - auth = new Buffer(auth, 'base64').toString().match(/^([^:]*):(.*)$/); - if (!auth) return; - return { username: auth[1], password: auth[2] }; -}); - -/** - * Return subdomains as an array. - * - * Subdomains are the dot-separated parts of the host before the main domain of - * the app. By default, the domain of the app is assumed to be the last two - * parts of the host. This can be changed by setting "subdomain offset". - * - * For example, if the domain is "tobi.ferrets.example.com": - * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`. - * If "subdomain offset" is 3, req.subdomains is `["tobi"]`. - * - * @return {Array} - * @api public - */ - -req.__defineGetter__('subdomains', function(){ - var offset = this.app.get('subdomain offset'); - return this.get('Host') - .split('.') - .reverse() - .slice(offset); -}); - -/** - * Short-hand for `url.parse(req.url).pathname`. - * - * @return {String} - * @api public - */ - -req.__defineGetter__('path', function(){ - return parse(this).pathname; -}); - -/** - * Parse the "Host" header field hostname. - * - * @return {String} - * @api public - */ - -req.__defineGetter__('host', function(){ - var trustProxy = this.app.get('trust proxy'); - var host = trustProxy && this.get('X-Forwarded-Host'); - host = host || this.get('Host'); - return host.split(':')[0]; -}); - -/** - * Check if the request is fresh, aka - * Last-Modified and/or the ETag - * still match. - * - * @return {Boolean} - * @api public - */ - -req.__defineGetter__('fresh', function(){ - var method = this.method; - var s = this.res.statusCode; - - // GET or HEAD for weak freshness validation only - if ('GET' != method && 'HEAD' != method) return false; - - // 2xx or 304 as per rfc2616 14.26 - if ((s >= 200 && s < 300) || 304 == s) { - return fresh(this.headers, this.res._headers); - } - - return false; -}); - -/** - * Check if the request is stale, aka - * "Last-Modified" and / or the "ETag" for the - * resource has changed. - * - * @return {Boolean} - * @api public - */ - -req.__defineGetter__('stale', function(){ - return !this.fresh; -}); - -/** - * Check if the request was an _XMLHttpRequest_. - * - * @return {Boolean} - * @api public - */ - -req.__defineGetter__('xhr', function(){ - var val = this.get('X-Requested-With') || ''; - return 'xmlhttprequest' == val.toLowerCase(); -}); diff --git a/node_modules/express/lib/response.js b/node_modules/express/lib/response.js deleted file mode 100644 index 50fcd05..0000000 --- a/node_modules/express/lib/response.js +++ /dev/null @@ -1,756 +0,0 @@ -/** - * Module dependencies. - */ - -var http = require('http') - , path = require('path') - , connect = require('connect') - , utils = connect.utils - , sign = require('cookie-signature').sign - , normalizeType = require('./utils').normalizeType - , normalizeTypes = require('./utils').normalizeTypes - , etag = require('./utils').etag - , statusCodes = http.STATUS_CODES - , cookie = require('cookie') - , send = require('send') - , mime = connect.mime - , basename = path.basename - , extname = path.extname - , join = path.join; - -/** - * Response prototype. - */ - -var res = module.exports = { - __proto__: http.ServerResponse.prototype -}; - -/** - * Set status `code`. - * - * @param {Number} code - * @return {ServerResponse} - * @api public - */ - -res.status = function(code){ - this.statusCode = code; - return this; -}; - -/** - * Set Link header field with the given `links`. - * - * Examples: - * - * res.links({ - * next: 'http://api.example.com/users?page=2', - * last: 'http://api.example.com/users?page=5' - * }); - * - * @param {Object} links - * @return {ServerResponse} - * @api public - */ - -res.links = function(links){ - return this.set('Link', Object.keys(links).map(function(rel){ - return '<' + links[rel] + '>; rel="' + rel + '"'; - }).join(', ')); -}; - -/** - * Send a response. - * - * Examples: - * - * res.send(new Buffer('wahoo')); - * res.send({ some: 'json' }); - * res.send('

some html

'); - * res.send(404, 'Sorry, cant find that'); - * res.send(404); - * - * @param {Mixed} body or status - * @param {Mixed} body - * @return {ServerResponse} - * @api public - */ - -res.send = function(body){ - var req = this.req - , head = 'HEAD' == req.method - , len; - - // allow status / body - if (2 == arguments.length) { - // res.send(body, status) backwards compat - if ('number' != typeof body && 'number' == typeof arguments[1]) { - this.statusCode = arguments[1]; - } else { - this.statusCode = body; - body = arguments[1]; - } - } - - switch (typeof body) { - // response status - case 'number': - this.get('Content-Type') || this.type('txt'); - this.statusCode = body; - body = http.STATUS_CODES[body]; - break; - // string defaulting to html - case 'string': - if (!this.get('Content-Type')) { - this.charset = this.charset || 'utf-8'; - this.type('html'); - } - break; - case 'boolean': - case 'object': - if (null == body) { - body = ''; - } else if (Buffer.isBuffer(body)) { - this.get('Content-Type') || this.type('bin'); - } else { - return this.json(body); - } - break; - } - - // populate Content-Length - if (undefined !== body && !this.get('Content-Length')) { - this.set('Content-Length', len = Buffer.isBuffer(body) - ? body.length - : Buffer.byteLength(body)); - } - - // ETag support - // TODO: W/ support - if (len > 1024) { - if (!this.get('ETag')) { - this.set('ETag', etag(body)); - } - } - - // freshness - if (req.fresh) this.statusCode = 304; - - // strip irrelevant headers - if (204 == this.statusCode || 304 == this.statusCode) { - this.removeHeader('Content-Type'); - this.removeHeader('Content-Length'); - this.removeHeader('Transfer-Encoding'); - body = ''; - } - - // respond - this.end(head ? null : body); - return this; -}; - -/** - * Send JSON response. - * - * Examples: - * - * res.json(null); - * res.json({ user: 'tj' }); - * res.json(500, 'oh noes!'); - * res.json(404, 'I dont have that'); - * - * @param {Mixed} obj or status - * @param {Mixed} obj - * @return {ServerResponse} - * @api public - */ - -res.json = function(obj){ - // allow status / body - if (2 == arguments.length) { - // res.json(body, status) backwards compat - if ('number' == typeof arguments[1]) { - this.statusCode = arguments[1]; - } else { - this.statusCode = obj; - obj = arguments[1]; - } - } - - // settings - var app = this.app; - var replacer = app.get('json replacer'); - var spaces = app.get('json spaces'); - var body = JSON.stringify(obj, replacer, spaces); - - // content-type - this.charset = this.charset || 'utf-8'; - this.get('Content-Type') || this.set('Content-Type', 'application/json'); - - return this.send(body); -}; - -/** - * Send JSON response with JSONP callback support. - * - * Examples: - * - * res.jsonp(null); - * res.jsonp({ user: 'tj' }); - * res.jsonp(500, 'oh noes!'); - * res.jsonp(404, 'I dont have that'); - * - * @param {Mixed} obj or status - * @param {Mixed} obj - * @return {ServerResponse} - * @api public - */ - -res.jsonp = function(obj){ - // allow status / body - if (2 == arguments.length) { - // res.json(body, status) backwards compat - if ('number' == typeof arguments[1]) { - this.statusCode = arguments[1]; - } else { - this.statusCode = obj; - obj = arguments[1]; - } - } - - // settings - var app = this.app; - var replacer = app.get('json replacer'); - var spaces = app.get('json spaces'); - var body = JSON.stringify(obj, replacer, spaces) - .replace(/\u2028/g, '\\u2028') - .replace(/\u2029/g, '\\u2029'); - var callback = this.req.query[app.get('jsonp callback name')]; - - // content-type - this.charset = this.charset || 'utf-8'; - this.set('Content-Type', 'application/json'); - - // jsonp - if (callback) { - this.set('Content-Type', 'text/javascript'); - var cb = callback.replace(/[^\[\]\w$.]/g, ''); - body = cb + ' && ' + cb + '(' + body + ');'; - } - - return this.send(body); -}; - -/** - * Transfer the file at the given `path`. - * - * Automatically sets the _Content-Type_ response header field. - * The callback `fn(err)` is invoked when the transfer is complete - * or when an error occurs. Be sure to check `res.sentHeader` - * if you wish to attempt responding, as the header and some data - * may have already been transferred. - * - * Options: - * - * - `maxAge` defaulting to 0 - * - `root` root directory for relative filenames - * - * Examples: - * - * The following example illustrates how `res.sendfile()` may - * be used as an alternative for the `static()` middleware for - * dynamic situations. The code backing `res.sendfile()` is actually - * the same code, so HTTP cache support etc is identical. - * - * app.get('/user/:uid/photos/:file', function(req, res){ - * var uid = req.params.uid - * , file = req.params.file; - * - * req.user.mayViewFilesFrom(uid, function(yes){ - * if (yes) { - * res.sendfile('/uploads/' + uid + '/' + file); - * } else { - * res.send(403, 'Sorry! you cant see that.'); - * } - * }); - * }); - * - * @param {String} path - * @param {Object|Function} options or fn - * @param {Function} fn - * @api public - */ - -res.sendfile = function(path, options, fn){ - var self = this - , req = self.req - , next = this.req.next - , options = options || {} - , done; - - // support function as second arg - if ('function' == typeof options) { - fn = options; - options = {}; - } - - // socket errors - req.socket.on('error', error); - - // errors - function error(err) { - if (done) return; - done = true; - - // clean up - cleanup(); - if (!self.headerSent) self.removeHeader('Content-Disposition'); - - // callback available - if (fn) return fn(err); - - // list in limbo if there's no callback - if (self.headerSent) return; - - // delegate - next(err); - } - - // streaming - function stream() { - if (done) return; - cleanup(); - if (fn) self.on('finish', fn); - } - - // cleanup - function cleanup() { - req.socket.removeListener('error', error); - } - - // transfer - var file = send(req, path); - if (options.root) file.root(options.root); - file.maxage(options.maxAge || 0); - file.on('error', error); - file.on('directory', next); - file.on('stream', stream); - file.pipe(this); - this.on('finish', cleanup); -}; - -/** - * Transfer the file at the given `path` as an attachment. - * - * Optionally providing an alternate attachment `filename`, - * and optional callback `fn(err)`. The callback is invoked - * when the data transfer is complete, or when an error has - * ocurred. Be sure to check `res.headerSent` if you plan to respond. - * - * This method uses `res.sendfile()`. - * - * @param {String} path - * @param {String|Function} filename or fn - * @param {Function} fn - * @api public - */ - -res.download = function(path, filename, fn){ - // support function as second arg - if ('function' == typeof filename) { - fn = filename; - filename = null; - } - - filename = filename || path; - this.set('Content-Disposition', 'attachment; filename="' + basename(filename) + '"'); - return this.sendfile(path, fn); -}; - -/** - * Set _Content-Type_ response header with `type` through `mime.lookup()` - * when it does not contain "/", or set the Content-Type to `type` otherwise. - * - * Examples: - * - * res.type('.html'); - * res.type('html'); - * res.type('json'); - * res.type('application/json'); - * res.type('png'); - * - * @param {String} type - * @return {ServerResponse} for chaining - * @api public - */ - -res.contentType = -res.type = function(type){ - return this.set('Content-Type', ~type.indexOf('/') - ? type - : mime.lookup(type)); -}; - -/** - * Respond to the Acceptable formats using an `obj` - * of mime-type callbacks. - * - * This method uses `req.accepted`, an array of - * acceptable types ordered by their quality values. - * When "Accept" is not present the _first_ callback - * is invoked, otherwise the first match is used. When - * no match is performed the server responds with - * 406 "Not Acceptable". - * - * Content-Type is set for you, however if you choose - * you may alter this within the callback using `res.type()` - * or `res.set('Content-Type', ...)`. - * - * res.format({ - * 'text/plain': function(){ - * res.send('hey'); - * }, - * - * 'text/html': function(){ - * res.send('

hey

'); - * }, - * - * 'appliation/json': function(){ - * res.send({ message: 'hey' }); - * } - * }); - * - * In addition to canonicalized MIME types you may - * also use extnames mapped to these types: - * - * res.format({ - * text: function(){ - * res.send('hey'); - * }, - * - * html: function(){ - * res.send('

hey

'); - * }, - * - * json: function(){ - * res.send({ message: 'hey' }); - * } - * }); - * - * By default Express passes an `Error` - * with a `.status` of 406 to `next(err)` - * if a match is not made. If you provide - * a `.default` callback it will be invoked - * instead. - * - * @param {Object} obj - * @return {ServerResponse} for chaining - * @api public - */ - -res.format = function(obj){ - var req = this.req - , next = req.next; - - var fn = obj.default; - if (fn) delete obj.default; - var keys = Object.keys(obj); - - var key = req.accepts(keys); - - this.set('Vary', 'Accept'); - - if (key) { - this.set('Content-Type', normalizeType(key).value); - obj[key](req, this, next); - } else if (fn) { - fn(); - } else { - var err = new Error('Not Acceptable'); - err.status = 406; - err.types = normalizeTypes(keys).map(function(o){ return o.value }); - next(err); - } - - return this; -}; - -/** - * Set _Content-Disposition_ header to _attachment_ with optional `filename`. - * - * @param {String} filename - * @return {ServerResponse} - * @api public - */ - -res.attachment = function(filename){ - if (filename) this.type(extname(filename)); - this.set('Content-Disposition', filename - ? 'attachment; filename="' + basename(filename) + '"' - : 'attachment'); - return this; -}; - -/** - * Set header `field` to `val`, or pass - * an object of header fields. - * - * Examples: - * - * res.set('Foo', ['bar', 'baz']); - * res.set('Accept', 'application/json'); - * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); - * - * Aliased as `res.header()`. - * - * @param {String|Object|Array} field - * @param {String} val - * @return {ServerResponse} for chaining - * @api public - */ - -res.set = -res.header = function(field, val){ - if (2 == arguments.length) { - if (Array.isArray(val)) val = val.map(String); - else val = String(val); - this.setHeader(field, val); - } else { - for (var key in field) { - this.set(key, field[key]); - } - } - return this; -}; - -/** - * Get value for header `field`. - * - * @param {String} field - * @return {String} - * @api public - */ - -res.get = function(field){ - return this.getHeader(field); -}; - -/** - * Clear cookie `name`. - * - * @param {String} name - * @param {Object} options - * @param {ServerResponse} for chaining - * @api public - */ - -res.clearCookie = function(name, options){ - var opts = { expires: new Date(1), path: '/' }; - return this.cookie(name, '', options - ? utils.merge(opts, options) - : opts); -}; - -/** - * Set cookie `name` to `val`, with the given `options`. - * - * Options: - * - * - `maxAge` max-age in milliseconds, converted to `expires` - * - `signed` sign the cookie - * - `path` defaults to "/" - * - * Examples: - * - * // "Remember Me" for 15 minutes - * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true }); - * - * // save as above - * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true }) - * - * @param {String} name - * @param {String|Object} val - * @param {Options} options - * @api public - */ - -res.cookie = function(name, val, options){ - options = utils.merge({}, options); - var secret = this.req.secret; - var signed = options.signed; - if (signed && !secret) throw new Error('connect.cookieParser("secret") required for signed cookies'); - if ('object' == typeof val) val = 'j:' + JSON.stringify(val); - if (signed) val = 's:' + sign(val, secret); - if ('maxAge' in options) { - options.expires = new Date(Date.now() + options.maxAge); - options.maxAge /= 1000; - } - if (null == options.path) options.path = '/'; - this.set('Set-Cookie', cookie.serialize(name, String(val), options)); - return this; -}; - - -/** - * Set the location header to `url`. - * - * The given `url` can also be the name of a mapped url, for - * example by default express supports "back" which redirects - * to the _Referrer_ or _Referer_ headers or "/". - * - * Examples: - * - * res.location('/foo/bar').; - * res.location('http://example.com'); - * res.location('../login'); // /blog/post/1 -> /blog/login - * - * Mounting: - * - * When an application is mounted and `res.location()` - * is given a path that does _not_ lead with "/" it becomes - * relative to the mount-point. For example if the application - * is mounted at "/blog", the following would become "/blog/login". - * - * res.location('login'); - * - * While the leading slash would result in a location of "/login": - * - * res.location('/login'); - * - * @param {String} url - * @api public - */ - -res.location = function(url){ - var app = this.app - , req = this.req; - - // setup redirect map - var map = { back: req.get('Referrer') || '/' }; - - // perform redirect - url = map[url] || url; - - // relative - if (!~url.indexOf('://') && 0 != url.indexOf('//')) { - var path - - // relative to path - if ('.' == url[0]) { - path = req.originalUrl.split('?')[0] - url = path + ('/' == path[path.length - 1] ? '' : '/') + url; - // relative to mount-point - } else if ('/' != url[0]) { - path = app.path(); - url = path + '/' + url; - } - } - - // Respond - this.set('Location', url); - return this; -}; - -/** - * Redirect to the given `url` with optional response `status` - * defaulting to 302. - * - * The resulting `url` is determined by `res.location()`, so - * it will play nicely with mounted apps, relative paths, - * `"back"` etc. - * - * Examples: - * - * res.redirect('/foo/bar'); - * res.redirect('http://example.com'); - * res.redirect(301, 'http://example.com'); - * res.redirect('http://example.com', 301); - * res.redirect('../login'); // /blog/post/1 -> /blog/login - * - * @param {String} url - * @param {Number} code - * @api public - */ - -res.redirect = function(url){ - var app = this.app - , head = 'HEAD' == this.req.method - , status = 302 - , body; - - // allow status / url - if (2 == arguments.length) { - if ('number' == typeof url) { - status = url; - url = arguments[1]; - } else { - status = arguments[1]; - } - } - - // Set location header - this.location(url); - url = this.get('Location'); - - // Support text/{plain,html} by default - this.format({ - text: function(){ - body = statusCodes[status] + '. Redirecting to ' + encodeURI(url); - }, - - html: function(){ - var u = utils.escape(url); - body = '

' + statusCodes[status] + '. Redirecting to ' + u + '

'; - }, - - default: function(){ - body = ''; - } - }); - - // Respond - this.statusCode = status; - this.set('Content-Length', Buffer.byteLength(body)); - this.end(head ? null : body); -}; - -/** - * Render `view` with the given `options` and optional callback `fn`. - * When a callback function is given a response will _not_ be made - * automatically, otherwise a response of _200_ and _text/html_ is given. - * - * Options: - * - * - `cache` boolean hinting to the engine it should cache - * - `filename` filename of the view being rendered - * - * @param {String} view - * @param {Object|Function} options or callback function - * @param {Function} fn - * @api public - */ - -res.render = function(view, options, fn){ - var self = this - , options = options || {} - , req = this.req - , app = req.app; - - // support callback function as second arg - if ('function' == typeof options) { - fn = options, options = {}; - } - - // merge res.locals - options._locals = self.locals; - - // default callback to respond - fn = fn || function(err, str){ - if (err) return req.next(err); - self.send(str); - }; - - // render - app.render(view, options, fn); -}; diff --git a/node_modules/express/lib/router/index.js b/node_modules/express/lib/router/index.js deleted file mode 100644 index 662dc29..0000000 --- a/node_modules/express/lib/router/index.js +++ /dev/null @@ -1,273 +0,0 @@ -/** - * Module dependencies. - */ - -var Route = require('./route') - , utils = require('../utils') - , methods = require('methods') - , debug = require('debug')('express:router') - , parse = require('connect').utils.parseUrl; - -/** - * Expose `Router` constructor. - */ - -exports = module.exports = Router; - -/** - * Initialize a new `Router` with the given `options`. - * - * @param {Object} options - * @api private - */ - -function Router(options) { - options = options || {}; - var self = this; - this.map = {}; - this.params = {}; - this._params = []; - this.caseSensitive = options.caseSensitive; - this.strict = options.strict; - this.middleware = function router(req, res, next){ - self._dispatch(req, res, next); - }; -} - -/** - * Register a param callback `fn` for the given `name`. - * - * @param {String|Function} name - * @param {Function} fn - * @return {Router} for chaining - * @api public - */ - -Router.prototype.param = function(name, fn){ - // param logic - if ('function' == typeof name) { - this._params.push(name); - return; - } - - // apply param functions - var params = this._params - , len = params.length - , ret; - - for (var i = 0; i < len; ++i) { - if (ret = params[i](name, fn)) { - fn = ret; - } - } - - // ensure we end up with a - // middleware function - if ('function' != typeof fn) { - throw new Error('invalid param() call for ' + name + ', got ' + fn); - } - - (this.params[name] = this.params[name] || []).push(fn); - return this; -}; - -/** - * Route dispatcher aka the route "middleware". - * - * @param {IncomingMessage} req - * @param {ServerResponse} res - * @param {Function} next - * @api private - */ - -Router.prototype._dispatch = function(req, res, next){ - var params = this.params - , self = this; - - debug('dispatching %s %s (%s)', req.method, req.url, req.originalUrl); - - // route dispatch - (function pass(i, err){ - var paramCallbacks - , paramIndex = 0 - , paramVal - , route - , keys - , key; - - // match next route - function nextRoute(err) { - pass(req._route_index + 1, err); - } - - // match route - req.route = route = self.matchRequest(req, i); - - // no route - if (!route) return next(err); - debug('matched %s %s', route.method, route.path); - - // we have a route - // start at param 0 - req.params = route.params; - keys = route.keys; - i = 0; - - // param callbacks - function param(err) { - paramIndex = 0; - key = keys[i++]; - paramVal = key && req.params[key.name]; - paramCallbacks = key && params[key.name]; - - try { - if ('route' == err) { - nextRoute(); - } else if (err) { - i = 0; - callbacks(err); - } else if (paramCallbacks && undefined !== paramVal) { - paramCallback(); - } else if (key) { - param(); - } else { - i = 0; - callbacks(); - } - } catch (err) { - param(err); - } - }; - - param(err); - - // single param callbacks - function paramCallback(err) { - var fn = paramCallbacks[paramIndex++]; - if (err || !fn) return param(err); - fn(req, res, paramCallback, paramVal, key.name); - } - - // invoke route callbacks - function callbacks(err) { - var fn = route.callbacks[i++]; - try { - if ('route' == err) { - nextRoute(); - } else if (err && fn) { - if (fn.length < 4) return callbacks(err); - fn(err, req, res, callbacks); - } else if (fn) { - if (fn.length < 4) return fn(req, res, callbacks); - callbacks(); - } else { - nextRoute(err); - } - } catch (err) { - callbacks(err); - } - } - })(0); -}; - -/** - * Attempt to match a route for `req` - * with optional starting index of `i` - * defaulting to 0. - * - * @param {IncomingMessage} req - * @param {Number} i - * @return {Route} - * @api private - */ - -Router.prototype.matchRequest = function(req, i, head){ - var method = req.method.toLowerCase() - , url = parse(req) - , path = url.pathname - , routes = this.map - , i = i || 0 - , route; - - // HEAD support - if (!head && 'head' == method) { - route = this.matchRequest(req, i, true); - if (route) return route; - method = 'get'; - } - - // routes for this method - if (routes = routes[method]) { - - // matching routes - for (var len = routes.length; i < len; ++i) { - route = routes[i]; - if (route.match(path)) { - req._route_index = i; - return route; - } - } - } -}; - -/** - * Attempt to match a route for `method` - * and `url` with optional starting - * index of `i` defaulting to 0. - * - * @param {String} method - * @param {String} url - * @param {Number} i - * @return {Route} - * @api private - */ - -Router.prototype.match = function(method, url, i, head){ - var req = { method: method, url: url }; - return this.matchRequest(req, i, head); -}; - -/** - * Route `method`, `path`, and one or more callbacks. - * - * @param {String} method - * @param {String} path - * @param {Function} callback... - * @return {Router} for chaining - * @api private - */ - -Router.prototype.route = function(method, path, callbacks){ - var method = method.toLowerCase() - , callbacks = utils.flatten([].slice.call(arguments, 2)); - - // ensure path was given - if (!path) throw new Error('Router#' + method + '() requires a path'); - - // ensure all callbacks are functions - callbacks.forEach(function(fn, i){ - if ('function' == typeof fn) return; - var type = {}.toString.call(fn); - var msg = '.' + method + '() requires callback functions but got a ' + type; - throw new Error(msg); - }); - - // create the route - debug('defined %s %s', method, path); - var route = new Route(method, path, callbacks, { - sensitive: this.caseSensitive, - strict: this.strict - }); - - // add it - (this.map[method] = this.map[method] || []).push(route); - return this; -}; - -methods.forEach(function(method){ - Router.prototype[method] = function(path){ - var args = [method].concat([].slice.call(arguments)); - this.route.apply(this, args); - return this; - }; -}); diff --git a/node_modules/express/lib/router/route.js b/node_modules/express/lib/router/route.js deleted file mode 100644 index c1a0b5e..0000000 --- a/node_modules/express/lib/router/route.js +++ /dev/null @@ -1,72 +0,0 @@ - -/** - * Module dependencies. - */ - -var utils = require('../utils'); - -/** - * Expose `Route`. - */ - -module.exports = Route; - -/** - * Initialize `Route` with the given HTTP `method`, `path`, - * and an array of `callbacks` and `options`. - * - * Options: - * - * - `sensitive` enable case-sensitive routes - * - `strict` enable strict matching for trailing slashes - * - * @param {String} method - * @param {String} path - * @param {Array} callbacks - * @param {Object} options. - * @api private - */ - -function Route(method, path, callbacks, options) { - options = options || {}; - this.path = path; - this.method = method; - this.callbacks = callbacks; - this.regexp = utils.pathRegexp(path - , this.keys = [] - , options.sensitive - , options.strict); -} - -/** - * Check if this route matches `path`, if so - * populate `.params`. - * - * @param {String} path - * @return {Boolean} - * @api private - */ - -Route.prototype.match = function(path){ - var keys = this.keys - , params = this.params = [] - , m = this.regexp.exec(path); - - if (!m) return false; - - for (var i = 1, len = m.length; i < len; ++i) { - var key = keys[i - 1]; - - var val = 'string' == typeof m[i] - ? decodeURIComponent(m[i]) - : m[i]; - - if (key) { - params[key.name] = val; - } else { - params.push(val); - } - } - - return true; -}; diff --git a/node_modules/express/lib/utils.js b/node_modules/express/lib/utils.js deleted file mode 100644 index 5e8fd1f..0000000 --- a/node_modules/express/lib/utils.js +++ /dev/null @@ -1,302 +0,0 @@ - -/** - * Module dependencies. - */ - -var mime = require('connect').mime - , crc32 = require('buffer-crc32'); - -/** - * Return ETag for `body`. - * - * @param {String|Buffer} body - * @return {String} - * @api private - */ - -exports.etag = function(body){ - return '"' + crc32.signed(body) + '"'; -}; - -/** - * Make `locals()` bound to the given `obj`. - * - * This is used for `app.locals` and `res.locals`. - * - * @param {Object} obj - * @return {Function} - * @api private - */ - -exports.locals = function(obj){ - function locals(obj){ - for (var key in obj) locals[key] = obj[key]; - return obj; - }; - - return locals; -}; - -/** - * Check if `path` looks absolute. - * - * @param {String} path - * @return {Boolean} - * @api private - */ - -exports.isAbsolute = function(path){ - if ('/' == path[0]) return true; - if (':' == path[1] && '\\' == path[2]) return true; -}; - -/** - * Flatten the given `arr`. - * - * @param {Array} arr - * @return {Array} - * @api private - */ - -exports.flatten = function(arr, ret){ - var ret = ret || [] - , len = arr.length; - for (var i = 0; i < len; ++i) { - if (Array.isArray(arr[i])) { - exports.flatten(arr[i], ret); - } else { - ret.push(arr[i]); - } - } - return ret; -}; - -/** - * Normalize the given `type`, for example "html" becomes "text/html". - * - * @param {String} type - * @return {Object} - * @api private - */ - -exports.normalizeType = function(type){ - return ~type.indexOf('/') - ? acceptParams(type) - : { value: mime.lookup(type), params: {} }; -}; - -/** - * Normalize `types`, for example "html" becomes "text/html". - * - * @param {Array} types - * @return {Array} - * @api private - */ - -exports.normalizeTypes = function(types){ - var ret = []; - - for (var i = 0; i < types.length; ++i) { - ret.push(exports.normalizeType(types[i])); - } - - return ret; -}; - -/** - * Return the acceptable type in `types`, if any. - * - * @param {Array} types - * @param {String} str - * @return {String} - * @api private - */ - -exports.acceptsArray = function(types, str){ - // accept anything when Accept is not present - if (!str) return types[0]; - - // parse - var accepted = exports.parseAccept(str) - , normalized = exports.normalizeTypes(types) - , len = accepted.length; - - for (var i = 0; i < len; ++i) { - for (var j = 0, jlen = types.length; j < jlen; ++j) { - if (exports.accept(normalized[j], accepted[i])) { - return types[j]; - } - } - } -}; - -/** - * Check if `type(s)` are acceptable based on - * the given `str`. - * - * @param {String|Array} type(s) - * @param {String} str - * @return {Boolean|String} - * @api private - */ - -exports.accepts = function(type, str){ - if ('string' == typeof type) type = type.split(/ *, */); - return exports.acceptsArray(type, str); -}; - -/** - * Check if `type` array is acceptable for `other`. - * - * @param {Object} type - * @param {Object} other - * @return {Boolean} - * @api private - */ - -exports.accept = function(type, other){ - var t = type.value.split('/'); - return (t[0] == other.type || '*' == other.type) - && (t[1] == other.subtype || '*' == other.subtype) - && paramsEqual(type.params, other.params); -}; - -/** - * Check if accept params are equal. - * - * @param {Object} a - * @param {Object} b - * @return {Boolean} - * @api private - */ - -function paramsEqual(a, b){ - return !Object.keys(a).some(function(k) { - return a[k] != b[k]; - }); -} - -/** - * Parse accept `str`, returning - * an array objects containing - * `.type` and `.subtype` along - * with the values provided by - * `parseQuality()`. - * - * @param {Type} name - * @return {Type} - * @api private - */ - -exports.parseAccept = function(str){ - return exports - .parseParams(str) - .map(function(obj){ - var parts = obj.value.split('/'); - obj.type = parts[0]; - obj.subtype = parts[1]; - return obj; - }); -}; - -/** - * Parse quality `str`, returning an - * array of objects with `.value`, - * `.quality` and optional `.params` - * - * @param {String} str - * @return {Array} - * @api private - */ - -exports.parseParams = function(str){ - return str - .split(/ *, */) - .map(acceptParams) - .filter(function(obj){ - return obj.quality; - }) - .sort(function(a, b){ - return b.quality - a.quality; - }); -}; - -/** - * Parse accept params `str` returning an - * object with `.value`, `.quality` and `.params`. - * - * @param {String} str - * @return {Object} - * @api private - */ - -function acceptParams(str) { - var parts = str.split(/ *; */); - var ret = { value: parts[0], quality: 1, params: {} }; - - for (var i = 1; i < parts.length; ++i) { - var pms = parts[i].split(/ *= */); - if ('q' == pms[0]) { - ret.quality = parseFloat(pms[1]); - } else { - ret.params[pms[0]] = pms[1]; - } - } - - return ret; -} - -/** - * Escape special characters in the given string of html. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html) { - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; - -/** - * Normalize the given path string, - * returning a regular expression. - * - * An empty array should be passed, - * which will contain the placeholder - * key names. For example "/user/:id" will - * then contain ["id"]. - * - * @param {String|RegExp|Array} path - * @param {Array} keys - * @param {Boolean} sensitive - * @param {Boolean} strict - * @return {RegExp} - * @api private - */ - -exports.pathRegexp = function(path, keys, sensitive, strict) { - if (path instanceof RegExp) return path; - if (Array.isArray(path)) path = '(' + path.join('|') + ')'; - path = path - .concat(strict ? '' : '/?') - .replace(/\/\(/g, '(?:/') - .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?(\*)?/g, function(_, slash, format, key, capture, optional, star){ - keys.push({ name: key, optional: !! optional }); - slash = slash || ''; - return '' - + (optional ? '' : slash) - + '(?:' - + (optional ? slash : '') - + (format || '') + (capture || (format && '([^/.]+?)' || '([^/]+?)')) + ')' - + (optional || '') - + (star ? '(/*)?' : ''); - }) - .replace(/([\/.])/g, '\\$1') - .replace(/\*/g, '(.*)'); - return new RegExp('^' + path + '$', sensitive ? '' : 'i'); -} diff --git a/node_modules/express/lib/view.js b/node_modules/express/lib/view.js deleted file mode 100644 index ae20b17..0000000 --- a/node_modules/express/lib/view.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Module dependencies. - */ - -var path = require('path') - , fs = require('fs') - , utils = require('./utils') - , dirname = path.dirname - , basename = path.basename - , extname = path.extname - , exists = fs.existsSync || path.existsSync - , join = path.join; - -/** - * Expose `View`. - */ - -module.exports = View; - -/** - * Initialize a new `View` with the given `name`. - * - * Options: - * - * - `defaultEngine` the default template engine name - * - `engines` template engine require() cache - * - `root` root path for view lookup - * - * @param {String} name - * @param {Object} options - * @api private - */ - -function View(name, options) { - options = options || {}; - this.name = name; - this.root = options.root; - var engines = options.engines; - this.defaultEngine = options.defaultEngine; - var ext = this.ext = extname(name); - if (!ext) name += (ext = this.ext = ('.' != this.defaultEngine[0] ? '.' : '') + this.defaultEngine); - this.engine = engines[ext] || (engines[ext] = require(ext.slice(1)).__express); - this.path = this.lookup(name); -} - -/** - * Lookup view by the given `path` - * - * @param {String} path - * @return {String} - * @api private - */ - -View.prototype.lookup = function(path){ - var ext = this.ext; - - // . - if (!utils.isAbsolute(path)) path = join(this.root, path); - if (exists(path)) return path; - - // /index. - path = join(dirname(path), basename(path, ext), 'index' + ext); - if (exists(path)) return path; -}; - -/** - * Render with the given `options` and callback `fn(err, str)`. - * - * @param {Object} options - * @param {Function} fn - * @api private - */ - -View.prototype.render = function(options, fn){ - this.engine(this.path, options, fn); -}; diff --git a/node_modules/express/node_modules/buffer-crc32/.npmignore b/node_modules/express/node_modules/buffer-crc32/.npmignore deleted file mode 100644 index b512c09..0000000 --- a/node_modules/express/node_modules/buffer-crc32/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/node_modules/express/node_modules/buffer-crc32/.travis.yml b/node_modules/express/node_modules/buffer-crc32/.travis.yml deleted file mode 100644 index 7a902e8..0000000 --- a/node_modules/express/node_modules/buffer-crc32/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 -notifications: - email: - recipients: - - brianloveswords@gmail.com \ No newline at end of file diff --git a/node_modules/express/node_modules/buffer-crc32/README.md b/node_modules/express/node_modules/buffer-crc32/README.md deleted file mode 100644 index 0d9d8b8..0000000 --- a/node_modules/express/node_modules/buffer-crc32/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# buffer-crc32 - -[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32) - -crc32 that works with binary data and fancy character sets, outputs -buffer, signed or unsigned data and has tests. - -Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix - -# install -``` -npm install buffer-crc32 -``` - -# example -```js -var crc32 = require('buffer-crc32'); -// works with buffers -var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]) -crc32(buf) // -> - -// has convenience methods for getting signed or unsigned ints -crc32.signed(buf) // -> -1805997238 -crc32.unsigned(buf) // -> 2488970058 - -// will cast to buffer if given a string, so you can -// directly use foreign characters safely -crc32('自動販売機') // -> - -// and works in append mode too -var partialCrc = crc32('hey'); -var partialCrc = crc32(' ', partialCrc); -var partialCrc = crc32('sup', partialCrc); -var partialCrc = crc32(' ', partialCrc); -var finalCrc = crc32('bros', partialCrc); // -> -``` - -# tests -This was tested against the output of zlib's crc32 method. You can run -the tests with`npm test` (requires tap) - -# see also -https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also -supports buffer inputs and return unsigned ints (thanks @tjholowaychuk). - -# license -MIT/X11 diff --git a/node_modules/express/node_modules/buffer-crc32/index.js b/node_modules/express/node_modules/buffer-crc32/index.js deleted file mode 100644 index e29ce3e..0000000 --- a/node_modules/express/node_modules/buffer-crc32/index.js +++ /dev/null @@ -1,88 +0,0 @@ -var Buffer = require('buffer').Buffer; - -var CRC_TABLE = [ - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d -]; - -function bufferizeInt(num) { - var tmp = Buffer(4); - tmp.writeInt32BE(num, 0); - return tmp; -} - -function _crc32(buf, previous) { - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - if (Buffer.isBuffer(previous)) { - previous = previous.readUInt32BE(0); - } - var crc = ~~previous ^ -1; - for (var n = 0; n < buf.length; n++) { - crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8); - } - return (crc ^ -1); -} - -function crc32() { - return bufferizeInt(_crc32.apply(null, arguments)); -} -crc32.signed = function () { - return _crc32.apply(null, arguments); -}; -crc32.unsigned = function () { - return _crc32.apply(null, arguments) >>> 0; -}; - -module.exports = crc32; diff --git a/node_modules/express/node_modules/buffer-crc32/package.json b/node_modules/express/node_modules/buffer-crc32/package.json deleted file mode 100644 index 401b2a0..0000000 --- a/node_modules/express/node_modules/buffer-crc32/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "author": { - "name": "Brian J. Brennan", - "email": "brianloveswords@gmail.com", - "url": "http://bjb.io" - }, - "name": "buffer-crc32", - "description": "A pure javascript CRC32 algorithm that plays nice with binary data", - "version": "0.2.1", - "contributors": [ - { - "name": "Vladimir Kuznetsov" - } - ], - "homepage": "https://github.com/brianloveswords/buffer-crc32", - "repository": { - "type": "git", - "url": "git://github.com/brianloveswords/buffer-crc32.git" - }, - "main": "index.js", - "scripts": { - "test": "./node_modules/.bin/tap tests/*.test.js" - }, - "dependencies": {}, - "devDependencies": { - "tap": "~0.2.5" - }, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "readme": "# buffer-crc32\n\n[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)\n\ncrc32 that works with binary data and fancy character sets, outputs\nbuffer, signed or unsigned data and has tests.\n\nDerived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix\n\n# install\n```\nnpm install buffer-crc32\n```\n\n# example\n```js\nvar crc32 = require('buffer-crc32');\n// works with buffers\nvar buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])\ncrc32(buf) // -> \n\n// has convenience methods for getting signed or unsigned ints\ncrc32.signed(buf) // -> -1805997238\ncrc32.unsigned(buf) // -> 2488970058\n\n// will cast to buffer if given a string, so you can\n// directly use foreign characters safely\ncrc32('自動販売機') // -> \n\n// and works in append mode too\nvar partialCrc = crc32('hey');\nvar partialCrc = crc32(' ', partialCrc);\nvar partialCrc = crc32('sup', partialCrc);\nvar partialCrc = crc32(' ', partialCrc);\nvar finalCrc = crc32('bros', partialCrc); // -> \n```\n\n# tests\nThis was tested against the output of zlib's crc32 method. You can run\nthe tests with`npm test` (requires tap)\n\n# see also\nhttps://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also\nsupports buffer inputs and return unsigned ints (thanks @tjholowaychuk).\n\n# license\nMIT/X11\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/brianloveswords/buffer-crc32/issues" - }, - "_id": "buffer-crc32@0.2.1", - "_from": "buffer-crc32@~0.2.1" -} diff --git a/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js b/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js deleted file mode 100644 index bb0f9ef..0000000 --- a/node_modules/express/node_modules/buffer-crc32/tests/crc.test.js +++ /dev/null @@ -1,89 +0,0 @@ -var crc32 = require('..'); -var test = require('tap').test; - -test('simple crc32 is no problem', function (t) { - var input = Buffer('hey sup bros'); - var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); - t.same(crc32(input), expected); - t.end(); -}); - -test('another simple one', function (t) { - var input = Buffer('IEND'); - var expected = Buffer([0xae, 0x42, 0x60, 0x82]); - t.same(crc32(input), expected); - t.end(); -}); - -test('slightly more complex', function (t) { - var input = Buffer([0x00, 0x00, 0x00]); - var expected = Buffer([0xff, 0x41, 0xd9, 0x12]); - t.same(crc32(input), expected); - t.end(); -}); - -test('complex crc32 gets calculated like a champ', function (t) { - var input = Buffer('शीर्षक'); - var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); - t.same(crc32(input), expected); - t.end(); -}); - -test('casts to buffer if necessary', function (t) { - var input = 'शीर्षक'; - var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); - t.same(crc32(input), expected); - t.end(); -}); - -test('can do signed', function (t) { - var input = 'ham sandwich'; - var expected = -1891873021; - t.same(crc32.signed(input), expected); - t.end(); -}); - -test('can do unsigned', function (t) { - var input = 'bear sandwich'; - var expected = 3711466352; - t.same(crc32.unsigned(input), expected); - t.end(); -}); - - -test('simple crc32 in append mode', function (t) { - var input = [Buffer('hey'), Buffer(' '), Buffer('sup'), Buffer(' '), Buffer('bros')]; - var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); - for (var crc = 0, i = 0; i < input.length; i++) { - crc = crc32(input[i], crc); - } - t.same(crc, expected); - t.end(); -}); - - -test('can do signed in append mode', function (t) { - var input1 = 'ham'; - var input2 = ' '; - var input3 = 'sandwich'; - var expected = -1891873021; - - var crc = crc32.signed(input1); - crc = crc32.signed(input2, crc); - crc = crc32.signed(input3, crc); - - t.same(crc, expected); - t.end(); -}); - -test('can do unsigned in append mode', function (t) { - var input1 = 'bear san'; - var input2 = 'dwich'; - var expected = 3711466352; - - var crc = crc32.unsigned(input1); - crc = crc32.unsigned(input2, crc); - t.same(crc, expected); - t.end(); -}); - diff --git a/node_modules/express/node_modules/commander/.npmignore b/node_modules/express/node_modules/commander/.npmignore deleted file mode 100644 index f1250e5..0000000 --- a/node_modules/express/node_modules/commander/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/node_modules/express/node_modules/commander/.travis.yml b/node_modules/express/node_modules/commander/.travis.yml deleted file mode 100644 index f1d0f13..0000000 --- a/node_modules/express/node_modules/commander/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/node_modules/express/node_modules/commander/History.md b/node_modules/express/node_modules/commander/History.md deleted file mode 100644 index 4961d2e..0000000 --- a/node_modules/express/node_modules/commander/History.md +++ /dev/null @@ -1,107 +0,0 @@ - -0.6.1 / 2012-06-01 -================== - - * Added: append (yes or no) on confirmation - * Added: allow node.js v0.7.x - -0.6.0 / 2012-04-10 -================== - - * Added `.prompt(obj, callback)` support. Closes #49 - * Added default support to .choose(). Closes #41 - * Fixed the choice example - -0.5.1 / 2011-12-20 -================== - - * Fixed `password()` for recent nodes. Closes #36 - -0.5.0 / 2011-12-04 -================== - - * Added sub-command option support [itay] - -0.4.3 / 2011-12-04 -================== - - * Fixed custom help ordering. Closes #32 - -0.4.2 / 2011-11-24 -================== - - * Added travis support - * Fixed: line-buffered input automatically trimmed. Closes #31 - -0.4.1 / 2011-11-18 -================== - - * Removed listening for "close" on --help - -0.4.0 / 2011-11-15 -================== - - * Added support for `--`. Closes #24 - -0.3.3 / 2011-11-14 -================== - - * Fixed: wait for close event when writing help info [Jerry Hamlet] - -0.3.2 / 2011-11-01 -================== - - * Fixed long flag definitions with values [felixge] - -0.3.1 / 2011-10-31 -================== - - * Changed `--version` short flag to `-V` from `-v` - * Changed `.version()` so it's configurable [felixge] - -0.3.0 / 2011-10-31 -================== - - * Added support for long flags only. Closes #18 - -0.2.1 / 2011-10-24 -================== - - * "node": ">= 0.4.x < 0.7.0". Closes #20 - -0.2.0 / 2011-09-26 -================== - - * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] - -0.1.0 / 2011-08-24 -================== - - * Added support for custom `--help` output - -0.0.5 / 2011-08-18 -================== - - * Changed: when the user enters nothing prompt for password again - * Fixed issue with passwords beginning with numbers [NuckChorris] - -0.0.4 / 2011-08-15 -================== - - * Fixed `Commander#args` - -0.0.3 / 2011-08-15 -================== - - * Added default option value support - -0.0.2 / 2011-08-15 -================== - - * Added mask support to `Command#password(str[, mask], fn)` - * Added `Command#password(str, fn)` - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/express/node_modules/commander/Makefile b/node_modules/express/node_modules/commander/Makefile deleted file mode 100644 index 0074625..0000000 --- a/node_modules/express/node_modules/commander/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -TESTS = $(shell find test/test.*.js) - -test: - @./test/run $(TESTS) - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/commander/Readme.md b/node_modules/express/node_modules/commander/Readme.md deleted file mode 100644 index b8328c3..0000000 --- a/node_modules/express/node_modules/commander/Readme.md +++ /dev/null @@ -1,262 +0,0 @@ -# Commander.js - - The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). - - [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js) - -## Installation - - $ npm install commander - -## Option parsing - - Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq', 'Add bbq sauce') - .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') - .parse(process.argv); - -console.log('you ordered a pizza with:'); -if (program.peppers) console.log(' - peppers'); -if (program.pineapple) console.log(' - pineappe'); -if (program.bbq) console.log(' - bbq'); -console.log(' - %s cheese', program.cheese); -``` - - Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. - -## Automated --help - - The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: - -``` - $ ./examples/pizza --help - - Usage: pizza [options] - - Options: - - -V, --version output the version number - -p, --peppers Add peppers - -P, --pineapple Add pineappe - -b, --bbq Add bbq sauce - -c, --cheese Add the specified type of cheese [marble] - -h, --help output usage information - -``` - -## Coercion - -```js -function range(val) { - return val.split('..').map(Number); -} - -function list(val) { - return val.split(','); -} - -program - .version('0.0.1') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .parse(process.argv); - -console.log(' int: %j', program.integer); -console.log(' float: %j', program.float); -console.log(' optional: %j', program.optional); -program.range = program.range || []; -console.log(' range: %j..%j', program.range[0], program.range[1]); -console.log(' list: %j', program.list); -console.log(' args: %j', program.args); -``` - -## Custom help - - You can display arbitrary `-h, --help` information - by listening for "--help". Commander will automatically - exit once you are done so that the remainder of your program - does not execute causing undesired behaviours, for example - in the following executable "stuff" will not output when - `--help` is used. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('../'); - -function list(val) { - return val.split(',').map(Number); -} - -program - .version('0.0.1') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); - console.log(''); -}); - -program.parse(process.argv); - -console.log('stuff'); -``` - -yielding the following help output: - -``` - -Usage: custom-help [options] - -Options: - - -h, --help output usage information - -V, --version output the version number - -f, --foo enable some foo - -b, --bar enable some bar - -B, --baz enable some baz - -Examples: - - $ custom-help --help - $ custom-help -h - -``` - -## .prompt(msg, fn) - - Single-line prompt: - -```js -program.prompt('name: ', function(name){ - console.log('hi %s', name); -}); -``` - - Multi-line prompt: - -```js -program.prompt('description:', function(name){ - console.log('hi %s', name); -}); -``` - - Coercion: - -```js -program.prompt('Age: ', Number, function(age){ - console.log('age: %j', age); -}); -``` - -```js -program.prompt('Birthdate: ', Date, function(date){ - console.log('date: %s', date); -}); -``` - -## .password(msg[, mask], fn) - -Prompt for password without echoing: - -```js -program.password('Password: ', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -Prompt for password with mask char "*": - -```js -program.password('Password: ', '*', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -## .confirm(msg, fn) - - Confirm with the given `msg`: - -```js -program.confirm('continue? ', function(ok){ - console.log(' got %j', ok); -}); -``` - -## .choose(list, fn) - - Let the user choose from a `list`: - -```js -var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - -console.log('Choose the coolest pet:'); -program.choose(list, function(i){ - console.log('you chose %d "%s"', i, list[i]); -}); -``` - -## Links - - - [API documentation](http://visionmedia.github.com/commander.js/) - - [ascii tables](https://github.com/LearnBoost/cli-table) - - [progress bars](https://github.com/visionmedia/node-progress) - - [more progress bars](https://github.com/substack/node-multimeter) - - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) - -## License - -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/express/node_modules/commander/index.js b/node_modules/express/node_modules/commander/index.js deleted file mode 100644 index 06ec1e4..0000000 --- a/node_modules/express/node_modules/commander/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/commander'); \ No newline at end of file diff --git a/node_modules/express/node_modules/commander/lib/commander.js b/node_modules/express/node_modules/commander/lib/commander.js deleted file mode 100644 index 5ba87eb..0000000 --- a/node_modules/express/node_modules/commander/lib/commander.js +++ /dev/null @@ -1,1026 +0,0 @@ - -/*! - * commander - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , path = require('path') - , tty = require('tty') - , basename = path.basename; - -/** - * Expose the root command. - */ - -exports = module.exports = new Command; - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function(){ - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg){ - return arg == this.short - || arg == this.long; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this.args = []; - this.name = name; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Command.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * Examples: - * - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function(){ - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd){ - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env){ - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {String} name - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name){ - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - return cmd; -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args){ - if (!args.length) return; - var self = this; - args.forEach(function(arg){ - switch (arg[0]) { - case '<': - self.args.push({ required: true, name: arg.slice(1, -1) }); - break; - case '[': - self.args.push({ required: false, name: arg.slice(1, -1) }); - break; - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function(){ - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn){ - var self = this; - this.parent.on(this.name, function(args, unknown){ - // Parse any so-far unknown options - unknown = unknown || []; - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - self.args.forEach(function(arg, i){ - if (arg.required && null == args[i]) { - self.missingArgument(arg.name); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self.args.length) { - args[self.args.length] = self; - } else { - args.push(self); - } - - fn.apply(this, args); - }); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to false - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => true - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|Mixed} fn or default - * @param {Mixed} defaultValue - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue){ - var self = this - , option = new Option(flags, description) - , oname = option.name() - , name = camelcase(oname); - - // default as 3rd arg - if ('function' != typeof fn) defaultValue = fn, fn = null; - - // preassign default value only for --no-*, [optional], or - if (false == option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (false == option.bool) defaultValue = true; - // preassign only if we have a default - if (undefined !== defaultValue) self[name] = defaultValue; - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on(oname, function(val){ - // coercion - if (null != val && fn) val = fn(val); - - // unassigned or bool - if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { - // if no value, bool true, and we have a default, then use it! - if (null == val) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (null !== val) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv){ - // store raw args - this.rawArgs = argv; - - // guess name - if (!this.name) this.name = basename(argv[1]); - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - this.args = parsed.args; - return this.parseArgs(this.args, parsed.unknown); -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args){ - var ret = [] - , arg; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { - arg.slice(1).split('').forEach(function(c){ - ret.push('-' + c); - }); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown){ - var cmds = this.commands - , len = cmds.length - , name; - - if (args.length) { - name = args[0]; - if (this.listeners(name).length) { - this.emit(args.shift(), args, unknown); - } else { - this.emit('*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg){ - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv){ - var args = [] - , len = argv.length - , literal - , option - , arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if ('--' == arg) { - literal = true; - continue; - } - - if (literal) { - args.push(arg); - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (null == arg) return this.optionMissingArgument(option); - if ('-' == arg[0]) return this.optionMissingArgument(option, arg); - this.emit(option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i+1]; - if (null == arg || '-' == arg[0]) { - arg = null; - } else { - ++i; - } - this.emit(option.name(), arg); - // bool - } else { - this.emit(option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && '-' == arg[0]) { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if (argv[i+1] && '-' != argv[i+1][0]) { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name){ - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag){ - console.error(); - if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error(" error: option `%s' argument missing", option.flags); - } - console.error(); - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag){ - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); - process.exit(1); -}; - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {String} str - * @param {String} flags - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags){ - if (0 == arguments.length) return this._version; - this._version = str; - flags = flags || '-V, --version'; - this.option(flags, 'output the version number'); - this.on('version', function(){ - console.log(str); - process.exit(0); - }); - return this; -}; - -/** - * Set the description `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str){ - if (0 == arguments.length) return this._description; - this._description = str; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str){ - var args = this.args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }); - - var usage = '[options' - + (this.commands.length ? '] [command' : '') - + ']' - + (this.args.length ? ' ' + args : ''); - if (0 == arguments.length) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function(){ - return this.options.reduce(function(max, option){ - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function(){ - var width = this.largestOptionLength(); - - // Prepend the help information - return [pad('-h, --help', width) + ' ' + 'output usage information'] - .concat(this.options.map(function(option){ - return pad(option.flags, width) - + ' ' + option.description; - })) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function(){ - if (!this.commands.length) return ''; - return [ - '' - , ' Commands:' - , '' - , this.commands.map(function(cmd){ - var args = cmd.args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }).join(' '); - - return cmd.name - + (cmd.options.length - ? ' [options]' - : '') + ' ' + args - + (cmd.description() - ? '\n' + cmd.description() - : ''); - }).join('\n\n').replace(/^/gm, ' ') - , '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function(){ - return [ - '' - , ' Usage: ' + this.name + ' ' + this.usage() - , '' + this.commandHelp() - , ' Options:' - , '' - , '' + this.optionHelp().replace(/^/gm, ' ') - , '' - , '' - ].join('\n'); -}; - -/** - * Prompt for a `Number`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForNumber = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseNumber(val){ - val = Number(val); - if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); - fn(val); - }); -}; - -/** - * Prompt for a `Date`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForDate = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseDate(val){ - val = new Date(val); - if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); - fn(val); - }); -}; - -/** - * Single-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptSingleLine = function(str, fn){ - if ('function' == typeof arguments[2]) { - return this['promptFor' + (fn.name || fn)](str, arguments[2]); - } - - process.stdout.write(str); - process.stdin.setEncoding('utf8'); - process.stdin.once('data', function(val){ - fn(val.trim()); - }).resume(); -}; - -/** - * Multi-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptMultiLine = function(str, fn){ - var buf = []; - console.log(str); - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function(val){ - if ('\n' == val || '\r\n' == val) { - process.stdin.removeAllListeners('data'); - fn(buf.join('\n')); - } else { - buf.push(val.trimRight()); - } - }).resume(); -}; - -/** - * Prompt `str` and callback `fn(val)` - * - * Commander supports single-line and multi-line prompts. - * To issue a single-line prompt simply add white-space - * to the end of `str`, something like "name: ", whereas - * for a multi-line prompt omit this "description:". - * - * - * Examples: - * - * program.prompt('Username: ', function(name){ - * console.log('hi %s', name); - * }); - * - * program.prompt('Description:', function(desc){ - * console.log('description was "%s"', desc.trim()); - * }); - * - * @param {String|Object} str - * @param {Function} fn - * @api public - */ - -Command.prototype.prompt = function(str, fn){ - var self = this; - - if ('string' == typeof str) { - if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); - this.promptMultiLine(str, fn); - } else { - var keys = Object.keys(str) - , obj = {}; - - function next() { - var key = keys.shift() - , label = str[key]; - - if (!key) return fn(obj); - self.prompt(label, function(val){ - obj[key] = val; - next(); - }); - } - - next(); - } -}; - -/** - * Prompt for password with `str`, `mask` char and callback `fn(val)`. - * - * The mask string defaults to '', aka no output is - * written while typing, you may want to use "*" etc. - * - * Examples: - * - * program.password('Password: ', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * program.password('Password: ', '*', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {String} mask - * @param {Function} fn - * @api public - */ - -Command.prototype.password = function(str, mask, fn){ - var self = this - , buf = ''; - - // default mask - if ('function' == typeof mask) { - fn = mask; - mask = ''; - } - - process.stdin.resume(); - tty.setRawMode(true); - process.stdout.write(str); - - // keypress - process.stdin.on('keypress', function(c, key){ - if (key && 'enter' == key.name) { - console.log(); - process.stdin.removeAllListeners('keypress'); - tty.setRawMode(false); - if (!buf.trim().length) return self.password(str, mask, fn); - fn(buf); - return; - } - - if (key && key.ctrl && 'c' == key.name) { - console.log('%s', buf); - process.exit(); - } - - process.stdout.write(mask); - buf += c; - }).resume(); -}; - -/** - * Confirmation prompt with `str` and callback `fn(bool)` - * - * Examples: - * - * program.confirm('continue? ', function(ok){ - * console.log(' got %j', ok); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {Function} fn - * @api public - */ - - -Command.prototype.confirm = function(str, fn, verbose){ - var self = this; - this.prompt(str, function(ok){ - if (!ok.trim()) { - if (!verbose) str += '(yes or no) '; - return self.confirm(str, fn, true); - } - fn(parseBool(ok)); - }); -}; - -/** - * Choice prompt with `list` of items and callback `fn(index, item)` - * - * Examples: - * - * var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - * - * console.log('Choose the coolest pet:'); - * program.choose(list, function(i){ - * console.log('you chose %d "%s"', i, list[i]); - * process.stdin.destroy(); - * }); - * - * @param {Array} list - * @param {Number|Function} index or fn - * @param {Function} fn - * @api public - */ - -Command.prototype.choose = function(list, index, fn){ - var self = this - , hasDefault = 'number' == typeof index; - - if (!hasDefault) { - fn = index; - index = null; - } - - list.forEach(function(item, i){ - if (hasDefault && i == index) { - console.log('* %d) %s', i + 1, item); - } else { - console.log(' %d) %s', i + 1, item); - } - }); - - function again() { - self.prompt(' : ', function(val){ - val = parseInt(val, 10) - 1; - if (hasDefault && isNaN(val)) val = index; - - if (null == list[val]) { - again(); - } else { - fn(val, list[val]); - } - }); - } - - again(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word){ - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Parse a boolean `str`. - * - * @param {String} str - * @return {Boolean} - * @api private - */ - -function parseBool(str) { - return /^y|yes|ok|true$/i.test(str); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] == '--help' || options[i] == '-h') { - process.stdout.write(cmd.helpInformation()); - cmd.emit('--help'); - process.exit(0); - } - } -} diff --git a/node_modules/express/node_modules/commander/package.json b/node_modules/express/node_modules/commander/package.json deleted file mode 100644 index 6f9d567..0000000 --- a/node_modules/express/node_modules/commander/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "commander", - "version": "0.6.1", - "description": "the complete solution for node.js command-line programs", - "keywords": [ - "command", - "option", - "parser", - "prompt", - "stdin" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "repository": { - "type": "git", - "url": "https://github.com/visionmedia/commander.js.git" - }, - "dependencies": {}, - "devDependencies": { - "should": ">= 0.0.1" - }, - "scripts": { - "test": "make test" - }, - "main": "index", - "engines": { - "node": ">= 0.4.x" - }, - "readme": "# Commander.js\n\n The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)\n\n## Installation\n\n $ npm install commander\n\n## Option parsing\n\n Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('commander');\n\nprogram\n .version('0.0.1')\n .option('-p, --peppers', 'Add peppers')\n .option('-P, --pineapple', 'Add pineapple')\n .option('-b, --bbq', 'Add bbq sauce')\n .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')\n .parse(process.argv);\n\nconsole.log('you ordered a pizza with:');\nif (program.peppers) console.log(' - peppers');\nif (program.pineapple) console.log(' - pineappe');\nif (program.bbq) console.log(' - bbq');\nconsole.log(' - %s cheese', program.cheese);\n```\n\n Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as \"--template-engine\" are camel-cased, becoming `program.templateEngine` etc.\n\n## Automated --help\n\n The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:\n\n``` \n $ ./examples/pizza --help\n\n Usage: pizza [options]\n\n Options:\n\n -V, --version output the version number\n -p, --peppers Add peppers\n -P, --pineapple Add pineappe\n -b, --bbq Add bbq sauce\n -c, --cheese Add the specified type of cheese [marble]\n -h, --help output usage information\n\n```\n\n## Coercion\n\n```js\nfunction range(val) {\n return val.split('..').map(Number);\n}\n\nfunction list(val) {\n return val.split(',');\n}\n\nprogram\n .version('0.0.1')\n .usage('[options] ')\n .option('-i, --integer ', 'An integer argument', parseInt)\n .option('-f, --float ', 'A float argument', parseFloat)\n .option('-r, --range ..', 'A range', range)\n .option('-l, --list ', 'A list', list)\n .option('-o, --optional [value]', 'An optional value')\n .parse(process.argv);\n\nconsole.log(' int: %j', program.integer);\nconsole.log(' float: %j', program.float);\nconsole.log(' optional: %j', program.optional);\nprogram.range = program.range || [];\nconsole.log(' range: %j..%j', program.range[0], program.range[1]);\nconsole.log(' list: %j', program.list);\nconsole.log(' args: %j', program.args);\n```\n\n## Custom help\n\n You can display arbitrary `-h, --help` information\n by listening for \"--help\". Commander will automatically\n exit once you are done so that the remainder of your program\n does not execute causing undesired behaviours, for example\n in the following executable \"stuff\" will not output when\n `--help` is used.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('../');\n\nfunction list(val) {\n return val.split(',').map(Number);\n}\n\nprogram\n .version('0.0.1')\n .option('-f, --foo', 'enable some foo')\n .option('-b, --bar', 'enable some bar')\n .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('--help', function(){\n console.log(' Examples:');\n console.log('');\n console.log(' $ custom-help --help');\n console.log(' $ custom-help -h');\n console.log('');\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -f, --foo enable some foo\n -b, --bar enable some bar\n -B, --baz enable some baz\n\nExamples:\n\n $ custom-help --help\n $ custom-help -h\n\n```\n\n## .prompt(msg, fn)\n\n Single-line prompt:\n\n```js\nprogram.prompt('name: ', function(name){\n console.log('hi %s', name);\n});\n```\n\n Multi-line prompt:\n\n```js\nprogram.prompt('description:', function(name){\n console.log('hi %s', name);\n});\n```\n\n Coercion:\n\n```js\nprogram.prompt('Age: ', Number, function(age){\n console.log('age: %j', age);\n});\n```\n\n```js\nprogram.prompt('Birthdate: ', Date, function(date){\n console.log('date: %s', date);\n});\n```\n\n## .password(msg[, mask], fn)\n\nPrompt for password without echoing:\n\n```js\nprogram.password('Password: ', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\nPrompt for password with mask char \"*\":\n\n```js\nprogram.password('Password: ', '*', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\n## .confirm(msg, fn)\n\n Confirm with the given `msg`:\n\n```js\nprogram.confirm('continue? ', function(ok){\n console.log(' got %j', ok);\n});\n```\n\n## .choose(list, fn)\n\n Let the user choose from a `list`:\n\n```js\nvar list = ['tobi', 'loki', 'jane', 'manny', 'luna'];\n\nconsole.log('Choose the coolest pet:');\nprogram.choose(list, function(i){\n console.log('you chose %d \"%s\"', i, list[i]);\n});\n```\n\n## Links\n\n - [API documentation](http://visionmedia.github.com/commander.js/)\n - [ascii tables](https://github.com/LearnBoost/cli-table)\n - [progress bars](https://github.com/visionmedia/node-progress)\n - [more progress bars](https://github.com/substack/node-multimeter)\n - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/visionmedia/commander.js/issues" - }, - "_id": "commander@0.6.1", - "_from": "commander@0.6.1" -} diff --git a/node_modules/express/node_modules/connect/.npmignore b/node_modules/express/node_modules/connect/.npmignore deleted file mode 100644 index 9046dde..0000000 --- a/node_modules/express/node_modules/connect/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -*.markdown -*.md -.git* -Makefile -benchmarks/ -docs/ -examples/ -install.sh -support/ -test/ -.DS_Store -coverage.html diff --git a/node_modules/express/node_modules/connect/.travis.yml b/node_modules/express/node_modules/connect/.travis.yml deleted file mode 100644 index c46b989..0000000 --- a/node_modules/express/node_modules/connect/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.6" - - "0.8" - - "0.10" \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/LICENSE b/node_modules/express/node_modules/connect/LICENSE deleted file mode 100644 index 0c5d22d..0000000 --- a/node_modules/express/node_modules/connect/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2010 Sencha Inc. -Copyright (c) 2011 LearnBoost -Copyright (c) 2011 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/Readme.md b/node_modules/express/node_modules/connect/Readme.md deleted file mode 100644 index 7d65f9c..0000000 --- a/node_modules/express/node_modules/connect/Readme.md +++ /dev/null @@ -1,133 +0,0 @@ -[![build status](https://secure.travis-ci.org/senchalabs/connect.png)](http://travis-ci.org/senchalabs/connect) -# Connect - - Connect is an extensible HTTP server framework for [node](http://nodejs.org), providing high performance "plugins" known as _middleware_. - - Connect is bundled with over _20_ commonly used middleware, including - a logger, session support, cookie parser, and [more](http://senchalabs.github.com/connect). Be sure to view the 2.x [documentation](http://senchalabs.github.com/connect/). - -```js -var connect = require('connect') - , http = require('http'); - -var app = connect() - .use(connect.favicon()) - .use(connect.logger('dev')) - .use(connect.static('public')) - .use(connect.directory('public')) - .use(connect.cookieParser()) - .use(connect.session({ secret: 'my secret here' })) - .use(function(req, res){ - res.end('Hello from Connect!\n'); - }); - -http.createServer(app).listen(3000); -``` - -## Middleware - - - [csrf](http://www.senchalabs.org/connect/csrf.html) - - [basicAuth](http://www.senchalabs.org/connect/basicAuth.html) - - [bodyParser](http://www.senchalabs.org/connect/bodyParser.html) - - [json](http://www.senchalabs.org/connect/json.html) - - [multipart](http://www.senchalabs.org/connect/multipart.html) - - [urlencoded](http://www.senchalabs.org/connect/urlencoded.html) - - [cookieParser](http://www.senchalabs.org/connect/cookieParser.html) - - [directory](http://www.senchalabs.org/connect/directory.html) - - [compress](http://www.senchalabs.org/connect/compress.html) - - [errorHandler](http://www.senchalabs.org/connect/errorHandler.html) - - [favicon](http://www.senchalabs.org/connect/favicon.html) - - [limit](http://www.senchalabs.org/connect/limit.html) - - [logger](http://www.senchalabs.org/connect/logger.html) - - [methodOverride](http://www.senchalabs.org/connect/methodOverride.html) - - [query](http://www.senchalabs.org/connect/query.html) - - [responseTime](http://www.senchalabs.org/connect/responseTime.html) - - [session](http://www.senchalabs.org/connect/session.html) - - [static](http://www.senchalabs.org/connect/static.html) - - [staticCache](http://www.senchalabs.org/connect/staticCache.html) - - [vhost](http://www.senchalabs.org/connect/vhost.html) - - [subdomains](http://www.senchalabs.org/connect/subdomains.html) - - [cookieSession](http://www.senchalabs.org/connect/cookieSession.html) - -## Running Tests - -first: - - $ npm install -d - -then: - - $ make test - -## Authors - - Below is the output from [git-summary](http://github.com/visionmedia/git-extras). - - - project: connect - commits: 2033 - active : 301 days - files : 171 - authors: - 1414 Tj Holowaychuk 69.6% - 298 visionmedia 14.7% - 191 Tim Caswell 9.4% - 51 TJ Holowaychuk 2.5% - 10 Ryan Olds 0.5% - 8 Astro 0.4% - 5 Nathan Rajlich 0.2% - 5 Jakub Nešetřil 0.2% - 3 Daniel Dickison 0.1% - 3 David Rio Deiros 0.1% - 3 Alexander Simmerl 0.1% - 3 Andreas Lind Petersen 0.1% - 2 Aaron Heckmann 0.1% - 2 Jacques Crocker 0.1% - 2 Fabian Jakobs 0.1% - 2 Brian J Brennan 0.1% - 2 Adam Malcontenti-Wilson 0.1% - 2 Glen Mailer 0.1% - 2 James Campos 0.1% - 1 Trent Mick 0.0% - 1 Troy Kruthoff 0.0% - 1 Wei Zhu 0.0% - 1 comerc 0.0% - 1 darobin 0.0% - 1 nateps 0.0% - 1 Marco Sanson 0.0% - 1 Arthur Taylor 0.0% - 1 Aseem Kishore 0.0% - 1 Bart Teeuwisse 0.0% - 1 Cameron Howey 0.0% - 1 Chad Weider 0.0% - 1 Craig Barnes 0.0% - 1 Eran Hammer-Lahav 0.0% - 1 Gregory McWhirter 0.0% - 1 Guillermo Rauch 0.0% - 1 Jae Kwon 0.0% - 1 Jakub Nesetril 0.0% - 1 Joshua Peek 0.0% - 1 Jxck 0.0% - 1 AJ ONeal 0.0% - 1 Michael Hemesath 0.0% - 1 Morten Siebuhr 0.0% - 1 Samori Gorse 0.0% - 1 Tom Jensen 0.0% - -## Node Compatibility - - Connect `< 1.x` is compatible with node 0.2.x - - - Connect `1.x` is compatible with node 0.4.x - - - Connect (_master_) `2.x` is compatible with node 0.6.x - -## CLA - - [http://sencha.com/cla](http://sencha.com/cla) - -## License - -View the [LICENSE](https://github.com/senchalabs/connect/blob/master/LICENSE) file. The [Silk](http://www.famfamfam.com/lab/icons/silk/) icons used by the `directory` middleware created by/copyright of [FAMFAMFAM](http://www.famfamfam.com/). diff --git a/node_modules/express/node_modules/connect/index.js b/node_modules/express/node_modules/connect/index.js deleted file mode 100644 index 23240ee..0000000 --- a/node_modules/express/node_modules/connect/index.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = process.env.CONNECT_COV - ? require('./lib-cov/connect') - : require('./lib/connect'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/lib/cache.js b/node_modules/express/node_modules/connect/lib/cache.js deleted file mode 100644 index 052fcdb..0000000 --- a/node_modules/express/node_modules/connect/lib/cache.js +++ /dev/null @@ -1,81 +0,0 @@ - -/*! - * Connect - Cache - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Expose `Cache`. - */ - -module.exports = Cache; - -/** - * LRU cache store. - * - * @param {Number} limit - * @api private - */ - -function Cache(limit) { - this.store = {}; - this.keys = []; - this.limit = limit; -} - -/** - * Touch `key`, promoting the object. - * - * @param {String} key - * @param {Number} i - * @api private - */ - -Cache.prototype.touch = function(key, i){ - this.keys.splice(i,1); - this.keys.push(key); -}; - -/** - * Remove `key`. - * - * @param {String} key - * @api private - */ - -Cache.prototype.remove = function(key){ - delete this.store[key]; -}; - -/** - * Get the object stored for `key`. - * - * @param {String} key - * @return {Array} - * @api private - */ - -Cache.prototype.get = function(key){ - return this.store[key]; -}; - -/** - * Add a cache `key`. - * - * @param {String} key - * @return {Array} - * @api private - */ - -Cache.prototype.add = function(key){ - // initialize store - var len = this.keys.push(key); - - // limit reached, invalidate LRU - if (len > this.limit) this.remove(this.keys.shift()); - - var arr = this.store[key] = []; - arr.createdAt = new Date; - return arr; -}; diff --git a/node_modules/express/node_modules/connect/lib/connect.js b/node_modules/express/node_modules/connect/lib/connect.js deleted file mode 100644 index 024fce4..0000000 --- a/node_modules/express/node_modules/connect/lib/connect.js +++ /dev/null @@ -1,92 +0,0 @@ -/*! - * Connect - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , proto = require('./proto') - , utils = require('./utils') - , path = require('path') - , basename = path.basename - , fs = require('fs'); - -// node patches - -require('./patch'); - -// expose createServer() as the module - -exports = module.exports = createServer; - -/** - * Framework version. - */ - -exports.version = '2.7.5'; - -/** - * Expose mime module. - */ - -exports.mime = require('./middleware/static').mime; - -/** - * Expose the prototype. - */ - -exports.proto = proto; - -/** - * Auto-load middleware getters. - */ - -exports.middleware = {}; - -/** - * Expose utilities. - */ - -exports.utils = utils; - -/** - * Create a new connect server. - * - * @return {Function} - * @api public - */ - -function createServer() { - function app(req, res, next){ app.handle(req, res, next); } - utils.merge(app, proto); - utils.merge(app, EventEmitter.prototype); - app.route = '/'; - app.stack = []; - for (var i = 0; i < arguments.length; ++i) { - app.use(arguments[i]); - } - return app; -}; - -/** - * Support old `.createServer()` method. - */ - -createServer.createServer = createServer; - -/** - * Auto-load bundled middleware with getters. - */ - -fs.readdirSync(__dirname + '/middleware').forEach(function(filename){ - if (!/\.js$/.test(filename)) return; - var name = basename(filename, '.js'); - function load(){ return require('./middleware/' + name); } - exports.middleware.__defineGetter__(name, load); - exports.__defineGetter__(name, load); -}); diff --git a/node_modules/express/node_modules/connect/lib/index.js b/node_modules/express/node_modules/connect/lib/index.js deleted file mode 100644 index 2618ddc..0000000 --- a/node_modules/express/node_modules/connect/lib/index.js +++ /dev/null @@ -1,50 +0,0 @@ - -/** - * Connect is a middleware framework for node, - * shipping with over 18 bundled middleware and a rich selection of - * 3rd-party middleware. - * - * var app = connect() - * .use(connect.logger('dev')) - * .use(connect.static('public')) - * .use(function(req, res){ - * res.end('hello world\n'); - * }) - * .listen(3000); - * - * Installation: - * - * $ npm install connect - * - * Middleware: - * - * - [logger](logger.html) request logger with custom format support - * - [csrf](csrf.html) Cross-site request forgery protection - * - [compress](compress.html) Gzip compression middleware - * - [basicAuth](basicAuth.html) basic http authentication - * - [bodyParser](bodyParser.html) extensible request body parser - * - [json](json.html) application/json parser - * - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser - * - [multipart](multipart.html) multipart/form-data parser - * - [timeout](timeout.html) request timeouts - * - [cookieParser](cookieParser.html) cookie parser - * - [session](session.html) session management support with bundled MemoryStore - * - [cookieSession](cookieSession.html) cookie-based session support - * - [methodOverride](methodOverride.html) faux HTTP method support - * - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time - * - [staticCache](staticCache.html) memory cache layer for the static() middleware - * - [static](static.html) streaming static file server supporting `Range` and more - * - [directory](directory.html) directory listing middleware - * - [vhost](vhost.html) virtual host sub-domain mapping middleware - * - [favicon](favicon.html) efficient favicon server (with default icon) - * - [limit](limit.html) limit the bytesize of request bodies - * - [query](query.html) automatic querystring parser, populating `req.query` - * - [errorHandler](errorHandler.html) flexible error handler - * - * Links: - * - * - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware - * - GitHub [repository](http://github.com/senchalabs/connect) - * - [test documentation](https://github.com/senchalabs/connect/blob/gh-pages/tests.md) - * - */ \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js b/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js deleted file mode 100644 index bc7ec97..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/basicAuth.js +++ /dev/null @@ -1,103 +0,0 @@ - -/*! - * Connect - basicAuth - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , unauthorized = utils.unauthorized; - -/** - * Basic Auth: - * - * Enfore basic authentication by providing a `callback(user, pass)`, - * which must return `true` in order to gain access. Alternatively an async - * method is provided as well, invoking `callback(user, pass, callback)`. Populates - * `req.user`. The final alternative is simply passing username / password - * strings. - * - * Simple username and password - * - * connect(connect.basicAuth('username', 'password')); - * - * Callback verification - * - * connect() - * .use(connect.basicAuth(function(user, pass){ - * return 'tj' == user & 'wahoo' == pass; - * })) - * - * Async callback verification, accepting `fn(err, user)`. - * - * connect() - * .use(connect.basicAuth(function(user, pass, fn){ - * User.authenticate({ user: user, pass: pass }, fn); - * })) - * - * @param {Function|String} callback or username - * @param {String} realm - * @api public - */ - -module.exports = function basicAuth(callback, realm) { - var username, password; - - // user / pass strings - if ('string' == typeof callback) { - username = callback; - password = realm; - if ('string' != typeof password) throw new Error('password argument required'); - realm = arguments[2]; - callback = function(user, pass){ - return user == username && pass == password; - } - } - - realm = realm || 'Authorization Required'; - - return function(req, res, next) { - var authorization = req.headers.authorization; - - if (req.user) return next(); - if (!authorization) return unauthorized(res, realm); - - var parts = authorization.split(' '); - - if (parts.length !== 2) return next(utils.error(400)); - - var scheme = parts[0] - , credentials = new Buffer(parts[1], 'base64').toString() - , index = credentials.indexOf(':'); - - if ('Basic' != scheme || index < 0) return next(utils.error(400)); - - var user = credentials.slice(0, index) - , pass = credentials.slice(index + 1); - - // async - if (callback.length >= 3) { - var pause = utils.pause(req); - callback(user, pass, function(err, user){ - if (err || !user) return unauthorized(res, realm); - req.user = req.remoteUser = user; - next(); - pause.resume(); - }); - // sync - } else { - if (callback(user, pass)) { - req.user = req.remoteUser = user; - next(); - } else { - unauthorized(res, realm); - } - } - } -}; - diff --git a/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js b/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js deleted file mode 100644 index 9f692cd..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js +++ /dev/null @@ -1,61 +0,0 @@ - -/*! - * Connect - bodyParser - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var multipart = require('./multipart') - , urlencoded = require('./urlencoded') - , json = require('./json'); - -/** - * Body parser: - * - * Parse request bodies, supports _application/json_, - * _application/x-www-form-urlencoded_, and _multipart/form-data_. - * - * This is equivalent to: - * - * app.use(connect.json()); - * app.use(connect.urlencoded()); - * app.use(connect.multipart()); - * - * Examples: - * - * connect() - * .use(connect.bodyParser()) - * .use(function(req, res) { - * res.end('viewing user ' + req.body.user.name); - * }); - * - * $ curl -d 'user[name]=tj' http://local/ - * $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/ - * - * View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info. - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function bodyParser(options){ - var _urlencoded = urlencoded(options) - , _multipart = multipart(options) - , _json = json(options); - - return function bodyParser(req, res, next) { - _json(req, res, function(err){ - if (err) return next(err); - _urlencoded(req, res, function(err){ - if (err) return next(err); - _multipart(req, res, next); - }); - }); - } -}; \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/lib/middleware/compress.js b/node_modules/express/node_modules/connect/lib/middleware/compress.js deleted file mode 100644 index e71ea8c..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/compress.js +++ /dev/null @@ -1,152 +0,0 @@ -/*! - * Connect - compress - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var zlib = require('zlib'); - -/** - * Supported content-encoding methods. - */ - -exports.methods = { - gzip: zlib.createGzip - , deflate: zlib.createDeflate -}; - -/** - * Default filter function. - */ - -exports.filter = function(req, res){ - return /json|text|javascript/.test(res.getHeader('Content-Type')); -}; - -/** - * Compress: - * - * Compress response data with gzip/deflate. - * - * Filter: - * - * A `filter` callback function may be passed to - * replace the default logic of: - * - * exports.filter = function(req, res){ - * return /json|text|javascript/.test(res.getHeader('Content-Type')); - * }; - * - * Options: - * - * All remaining options are passed to the gzip/deflate - * creation functions. Consult node's docs for additional details. - * - * - `chunkSize` (default: 16*1024) - * - `windowBits` - * - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression - * - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more - * - `strategy`: compression strategy - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function compress(options) { - options = options || {}; - var names = Object.keys(exports.methods) - , filter = options.filter || exports.filter; - - return function compress(req, res, next){ - var accept = req.headers['accept-encoding'] - , vary = res.getHeader('Vary') - , write = res.write - , end = res.end - , stream - , method; - - // vary - if (!vary) { - res.setHeader('Vary', 'Accept-Encoding'); - } else if (!~vary.indexOf('Accept-Encoding')) { - res.setHeader('Vary', vary + ', Accept-Encoding'); - } - - // proxy - - res.write = function(chunk, encoding){ - if (!this.headerSent) this._implicitHeader(); - return stream - ? stream.write(new Buffer(chunk, encoding)) - : write.call(res, chunk, encoding); - }; - - res.end = function(chunk, encoding){ - if (chunk) this.write(chunk, encoding); - return stream - ? stream.end() - : end.call(res); - }; - - res.on('header', function(){ - var encoding = res.getHeader('Content-Encoding') || 'identity'; - - // already encoded - if ('identity' != encoding) return; - - // default request filter - if (!filter(req, res)) return; - - // SHOULD use identity - if (!accept) return; - - // head - if ('HEAD' == req.method) return; - - // default to gzip - if ('*' == accept.trim()) method = 'gzip'; - - // compression method - if (!method) { - for (var i = 0, len = names.length; i < len; ++i) { - if (~accept.indexOf(names[i])) { - method = names[i]; - break; - } - } - } - - // compression method - if (!method) return; - - // compression stream - stream = exports.methods[method](options); - - // header fields - res.setHeader('Content-Encoding', method); - res.removeHeader('Content-Length'); - - // compression - - stream.on('data', function(chunk){ - write.call(res, chunk); - }); - - stream.on('end', function(){ - end.call(res); - }); - - stream.on('drain', function() { - res.emit('drain'); - }); - }); - - next(); - }; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js b/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js deleted file mode 100644 index 5da23f2..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/cookieParser.js +++ /dev/null @@ -1,62 +0,0 @@ - -/*! - * Connect - cookieParser - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('./../utils') - , cookie = require('cookie'); - -/** - * Cookie parser: - * - * Parse _Cookie_ header and populate `req.cookies` - * with an object keyed by the cookie names. Optionally - * you may enabled signed cookie support by passing - * a `secret` string, which assigns `req.secret` so - * it may be used by other middleware. - * - * Examples: - * - * connect() - * .use(connect.cookieParser('optional secret string')) - * .use(function(req, res, next){ - * res.end(JSON.stringify(req.cookies)); - * }) - * - * @param {String} secret - * @return {Function} - * @api public - */ - -module.exports = function cookieParser(secret){ - return function cookieParser(req, res, next) { - if (req.cookies) return next(); - var cookies = req.headers.cookie; - - req.secret = secret; - req.cookies = {}; - req.signedCookies = {}; - - if (cookies) { - try { - req.cookies = cookie.parse(cookies); - if (secret) { - req.signedCookies = utils.parseSignedCookies(req.cookies, secret); - req.signedCookies = utils.parseJSONCookies(req.signedCookies); - } - req.cookies = utils.parseJSONCookies(req.cookies); - } catch (err) { - err.status = 400; - return next(err); - } - } - next(); - }; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js b/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js deleted file mode 100644 index 402fd55..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/cookieSession.js +++ /dev/null @@ -1,117 +0,0 @@ - -/*! - * Connect - cookieSession - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('./../utils') - , Cookie = require('./session/cookie') - , debug = require('debug')('connect:cookieSession') - , signature = require('cookie-signature') - , crc32 = require('buffer-crc32'); - -/** - * Cookie Session: - * - * Cookie session middleware. - * - * var app = connect(); - * app.use(connect.cookieParser()); - * app.use(connect.cookieSession({ secret: 'tobo!', cookie: { maxAge: 60 * 60 * 1000 }})); - * - * Options: - * - * - `key` cookie name defaulting to `connect.sess` - * - `secret` prevents cookie tampering - * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` - * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") - * - * Clearing sessions: - * - * To clear the session simply set its value to `null`, - * `cookieSession()` will then respond with a 1970 Set-Cookie. - * - * req.session = null; - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function cookieSession(options){ - // TODO: utilize Session/Cookie to unify API - options = options || {}; - var key = options.key || 'connect.sess' - , trustProxy = options.proxy; - - return function cookieSession(req, res, next) { - - // req.secret is for backwards compatibility - var secret = options.secret || req.secret; - if (!secret) throw new Error('`secret` option required for cookie sessions'); - - // default session - req.session = {}; - var cookie = req.session.cookie = new Cookie(options.cookie); - - // pathname mismatch - if (0 != req.originalUrl.indexOf(cookie.path)) return next(); - - // cookieParser secret - if (!options.secret && req.secret) { - req.session = req.signedCookies[key] || {}; - req.session.cookie = cookie; - } else { - // TODO: refactor - var rawCookie = req.cookies[key]; - if (rawCookie) { - var unsigned = utils.parseSignedCookie(rawCookie, secret); - if (unsigned) { - var originalHash = crc32.signed(unsigned); - req.session = utils.parseJSONCookie(unsigned) || {}; - req.session.cookie = cookie; - } - } - } - - res.on('header', function(){ - // removed - if (!req.session) { - debug('clear session'); - cookie.expires = new Date(0); - res.setHeader('Set-Cookie', cookie.serialize(key, '')); - return; - } - - delete req.session.cookie; - - // check security - var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase() - , tls = req.connection.encrypted || (trustProxy && 'https' == proto) - , secured = cookie.secure && tls; - - // only send secure cookies via https - if (cookie.secure && !secured) return debug('not secured'); - - // serialize - debug('serializing %j', req.session); - var val = 'j:' + JSON.stringify(req.session); - - // compare hashes, no need to set-cookie if unchanged - if (originalHash == crc32.signed(val)) return debug('unmodified session'); - - // set-cookie - val = 's:' + signature.sign(val, secret); - val = cookie.serialize(key, val); - debug('set-cookie %j', cookie); - res.setHeader('Set-Cookie', val); - }); - - next(); - }; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/csrf.js b/node_modules/express/node_modules/connect/lib/middleware/csrf.js deleted file mode 100644 index e3c353e..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/csrf.js +++ /dev/null @@ -1,73 +0,0 @@ -/*! - * Connect - csrf - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils'); - -/** - * Anti CSRF: - * - * CRSF protection middleware. - * - * By default this middleware generates a token named "_csrf" - * which should be added to requests which mutate - * state, within a hidden form field, query-string etc. This - * token is validated against the visitor's `req.session._csrf` - * property. - * - * The default `value` function checks `req.body` generated - * by the `bodyParser()` middleware, `req.query` generated - * by `query()`, and the "X-CSRF-Token" header field. - * - * This middleware requires session support, thus should be added - * somewhere _below_ `session()` and `cookieParser()`. - * - * Options: - * - * - `value` a function accepting the request, returning the token - * - * @param {Object} options - * @api public - */ - -module.exports = function csrf(options) { - options = options || {}; - var value = options.value || defaultValue; - - return function(req, res, next){ - // generate CSRF token - var token = req.session._csrf || (req.session._csrf = utils.uid(24)); - - // ignore these methods - if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next(); - - // determine value - var val = value(req); - - // check - if (val != token) return next(utils.error(403)); - - next(); - } -}; - -/** - * Default value function, checking the `req.body` - * and `req.query` for the CSRF token. - * - * @param {IncomingMessage} req - * @return {String} - * @api private - */ - -function defaultValue(req) { - return (req.body && req.body._csrf) - || (req.query && req.query._csrf) - || (req.headers['x-csrf-token']); -} diff --git a/node_modules/express/node_modules/connect/lib/middleware/directory.js b/node_modules/express/node_modules/connect/lib/middleware/directory.js deleted file mode 100644 index 1c925a7..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/directory.js +++ /dev/null @@ -1,229 +0,0 @@ - -/*! - * Connect - directory - * Copyright(c) 2011 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -// TODO: icon / style for directories -// TODO: arrow key navigation -// TODO: make icons extensible - -/** - * Module dependencies. - */ - -var fs = require('fs') - , parse = require('url').parse - , utils = require('../utils') - , path = require('path') - , normalize = path.normalize - , extname = path.extname - , join = path.join; - -/*! - * Icon cache. - */ - -var cache = {}; - -/** - * Directory: - * - * Serve directory listings with the given `root` path. - * - * Options: - * - * - `hidden` display hidden (dot) files. Defaults to false. - * - `icons` display icons. Defaults to false. - * - `filter` Apply this filter function to files. Defaults to false. - * - * @param {String} root - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function directory(root, options){ - options = options || {}; - - // root required - if (!root) throw new Error('directory() root path required'); - var hidden = options.hidden - , icons = options.icons - , filter = options.filter - , root = normalize(root); - - return function directory(req, res, next) { - if ('GET' != req.method && 'HEAD' != req.method) return next(); - - var accept = req.headers.accept || 'text/plain' - , url = parse(req.url) - , dir = decodeURIComponent(url.pathname) - , path = normalize(join(root, dir)) - , originalUrl = parse(req.originalUrl) - , originalDir = decodeURIComponent(originalUrl.pathname) - , showUp = path != root && path != root + '/'; - - // null byte(s), bad request - if (~path.indexOf('\0')) return next(utils.error(400)); - - // malicious path, forbidden - if (0 != path.indexOf(root)) return next(utils.error(403)); - - // check if we have a directory - fs.stat(path, function(err, stat){ - if (err) return 'ENOENT' == err.code - ? next() - : next(err); - - if (!stat.isDirectory()) return next(); - - // fetch files - fs.readdir(path, function(err, files){ - if (err) return next(err); - if (!hidden) files = removeHidden(files); - if (filter) files = files.filter(filter); - files.sort(); - - // content-negotiation - for (var key in exports) { - if (~accept.indexOf(key) || ~accept.indexOf('*/*')) { - exports[key](req, res, files, next, originalDir, showUp, icons); - return; - } - } - - // not acceptable - next(utils.error(406)); - }); - }); - }; -}; - -/** - * Respond with text/html. - */ - -exports.html = function(req, res, files, next, dir, showUp, icons){ - fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){ - if (err) return next(err); - fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){ - if (err) return next(err); - if (showUp) files.unshift('..'); - str = str - .replace('{style}', style) - .replace('{files}', html(files, dir, icons)) - .replace('{directory}', dir) - .replace('{linked-path}', htmlPath(dir)); - res.setHeader('Content-Type', 'text/html'); - res.setHeader('Content-Length', str.length); - res.end(str); - }); - }); -}; - -/** - * Respond with application/json. - */ - -exports.json = function(req, res, files){ - files = JSON.stringify(files); - res.setHeader('Content-Type', 'application/json'); - res.setHeader('Content-Length', files.length); - res.end(files); -}; - -/** - * Respond with text/plain. - */ - -exports.plain = function(req, res, files){ - files = files.join('\n') + '\n'; - res.setHeader('Content-Type', 'text/plain'); - res.setHeader('Content-Length', files.length); - res.end(files); -}; - -/** - * Map html `dir`, returning a linked path. - */ - -function htmlPath(dir) { - var curr = []; - return dir.split('/').map(function(part){ - curr.push(part); - return '' + part + ''; - }).join(' / '); -} - -/** - * Map html `files`, returning an html unordered list. - */ - -function html(files, dir, useIcons) { - return '
    ' + files.map(function(file){ - var icon = '' - , classes = []; - - if (useIcons && '..' != file) { - icon = icons[extname(file)] || icons.default; - icon = ''; - classes.push('icon'); - } - - return '
  • ' - + icon + file + '
  • '; - - }).join('\n') + '
'; -} - -/** - * Load and cache the given `icon`. - * - * @param {String} icon - * @return {String} - * @api private - */ - -function load(icon) { - if (cache[icon]) return cache[icon]; - return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64'); -} - -/** - * Filter "hidden" `files`, aka files - * beginning with a `.`. - * - * @param {Array} files - * @return {Array} - * @api private - */ - -function removeHidden(files) { - return files.filter(function(file){ - return '.' != file[0]; - }); -} - -/** - * Icon map. - */ - -var icons = { - '.js': 'page_white_code_red.png' - , '.c': 'page_white_c.png' - , '.h': 'page_white_h.png' - , '.cc': 'page_white_cplusplus.png' - , '.php': 'page_white_php.png' - , '.rb': 'page_white_ruby.png' - , '.cpp': 'page_white_cplusplus.png' - , '.swf': 'page_white_flash.png' - , '.pdf': 'page_white_acrobat.png' - , 'default': 'page_white.png' -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js b/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js deleted file mode 100644 index 4a84edc..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/errorHandler.js +++ /dev/null @@ -1,86 +0,0 @@ -/*! - * Connect - errorHandler - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , fs = require('fs'); - -// environment - -var env = process.env.NODE_ENV || 'development'; - -/** - * Error handler: - * - * Development error handler, providing stack traces - * and error message responses for requests accepting text, html, - * or json. - * - * Text: - * - * By default, and when _text/plain_ is accepted a simple stack trace - * or error message will be returned. - * - * JSON: - * - * When _application/json_ is accepted, connect will respond with - * an object in the form of `{ "error": error }`. - * - * HTML: - * - * When accepted connect will output a nice html stack trace. - * - * @return {Function} - * @api public - */ - -exports = module.exports = function errorHandler(){ - return function errorHandler(err, req, res, next){ - if (err.status) res.statusCode = err.status; - if (res.statusCode < 400) res.statusCode = 500; - if ('test' != env) console.error(err.stack); - var accept = req.headers.accept || ''; - // html - if (~accept.indexOf('html')) { - fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){ - fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){ - var stack = (err.stack || '') - .split('\n').slice(1) - .map(function(v){ return '
  • ' + v + '
  • '; }).join(''); - html = html - .replace('{style}', style) - .replace('{stack}', stack) - .replace('{title}', exports.title) - .replace('{statusCode}', res.statusCode) - .replace(/\{error\}/g, utils.escape(err.toString())); - res.setHeader('Content-Type', 'text/html; charset=utf-8'); - res.end(html); - }); - }); - // json - } else if (~accept.indexOf('json')) { - var error = { message: err.message, stack: err.stack }; - for (var prop in err) error[prop] = err[prop]; - var json = JSON.stringify({ error: error }); - res.setHeader('Content-Type', 'application/json'); - res.end(json); - // plain text - } else { - res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' }); - res.end(err.stack); - } - }; -}; - -/** - * Template title, framework authors may override this value. - */ - -exports.title = 'Connect'; diff --git a/node_modules/express/node_modules/connect/lib/middleware/favicon.js b/node_modules/express/node_modules/connect/lib/middleware/favicon.js deleted file mode 100644 index ef54354..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/favicon.js +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * Connect - favicon - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var fs = require('fs') - , utils = require('../utils'); - -/** - * Favicon: - * - * By default serves the connect favicon, or the favicon - * located by the given `path`. - * - * Options: - * - * - `maxAge` cache-control max-age directive, defaulting to 1 day - * - * Examples: - * - * Serve default favicon: - * - * connect() - * .use(connect.favicon()) - * - * Serve favicon before logging for brevity: - * - * connect() - * .use(connect.favicon()) - * .use(connect.logger('dev')) - * - * Serve custom favicon: - * - * connect() - * .use(connect.favicon('public/favicon.ico')) - * - * @param {String} path - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function favicon(path, options){ - var options = options || {} - , path = path || __dirname + '/../public/favicon.ico' - , maxAge = options.maxAge || 86400000 - , icon; // favicon cache - - return function favicon(req, res, next){ - if ('/favicon.ico' == req.url) { - if (icon) { - res.writeHead(200, icon.headers); - res.end(icon.body); - } else { - fs.readFile(path, function(err, buf){ - if (err) return next(err); - icon = { - headers: { - 'Content-Type': 'image/x-icon' - , 'Content-Length': buf.length - , 'ETag': '"' + utils.md5(buf) + '"' - , 'Cache-Control': 'public, max-age=' + (maxAge / 1000) - }, - body: buf - }; - res.writeHead(200, icon.headers); - res.end(icon.body); - }); - } - } else { - next(); - } - }; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/json.js b/node_modules/express/node_modules/connect/lib/middleware/json.js deleted file mode 100644 index 17e5918..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/json.js +++ /dev/null @@ -1,86 +0,0 @@ - -/*! - * Connect - json - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , _limit = require('./limit'); - -/** - * noop middleware. - */ - -function noop(req, res, next) { - next(); -} - -/** - * JSON: - * - * Parse JSON request bodies, providing the - * parsed object as `req.body`. - * - * Options: - * - * - `strict` when `false` anything `JSON.parse()` accepts will be parsed - * - `reviver` used as the second "reviver" argument for JSON.parse - * - `limit` byte limit disabled by default - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(options){ - var options = options || {} - , strict = options.strict !== false; - - var limit = options.limit - ? _limit(options.limit) - : noop; - - return function json(req, res, next) { - if (req._body) return next(); - req.body = req.body || {}; - - if (!utils.hasBody(req)) return next(); - - // check Content-Type - if ('application/json' != utils.mime(req)) return next(); - - // flag as parsed - req._body = true; - - // parse - limit(req, res, function(err){ - if (err) return next(err); - var buf = ''; - req.setEncoding('utf8'); - req.on('data', function(chunk){ buf += chunk }); - req.on('end', function(){ - var first = buf.trim()[0]; - - if (0 == buf.length) { - return next(utils.error(400, 'invalid json, empty body')); - } - - if (strict && '{' != first && '[' != first) return next(utils.error(400, 'invalid json')); - try { - req.body = JSON.parse(buf, options.reviver); - } catch (err){ - err.body = buf; - err.status = 400; - return next(err); - } - next(); - }); - }); - }; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/limit.js b/node_modules/express/node_modules/connect/lib/middleware/limit.js deleted file mode 100644 index 09bd1c4..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/limit.js +++ /dev/null @@ -1,78 +0,0 @@ - -/*! - * Connect - limit - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils'), - brokenPause = utils.brokenPause; - -/** - * Limit: - * - * Limit request bodies to the given size in `bytes`. - * - * A string representation of the bytesize may also be passed, - * for example "5mb", "200kb", "1gb", etc. - * - * connect() - * .use(connect.limit('5.5mb')) - * .use(handleImageUpload) - * - * @param {Number|String} bytes - * @return {Function} - * @api public - */ - -module.exports = function limit(bytes){ - if ('string' == typeof bytes) bytes = utils.parseBytes(bytes); - if ('number' != typeof bytes) throw new Error('limit() bytes required'); - return function limit(req, res, next){ - var received = 0 - , len = req.headers['content-length'] - ? parseInt(req.headers['content-length'], 10) - : null; - - // self-awareness - if (req._limit) return next(); - req._limit = true; - - // limit by content-length - if (len && len > bytes) return next(utils.error(413)); - - // limit - if (brokenPause) { - listen(); - } else { - req.on('newListener', function handler(event) { - if (event !== 'data') return; - - req.removeListener('newListener', handler); - // Start listening at the end of the current loop - // otherwise the request will be consumed too early. - // Sideaffect is `limit` will miss the first chunk, - // but that's not a big deal. - // Unfortunately, the tests don't have large enough - // request bodies to test this. - process.nextTick(listen); - }); - }; - - next(); - - function listen() { - req.on('data', function(chunk) { - received += Buffer.isBuffer(chunk) - ? chunk.length : - Buffer.byteLength(chunk); - - if (received > bytes) req.destroy(); - }); - }; - }; -}; \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/lib/middleware/logger.js b/node_modules/express/node_modules/connect/lib/middleware/logger.js deleted file mode 100644 index de72244..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/logger.js +++ /dev/null @@ -1,339 +0,0 @@ -/*! - * Connect - logger - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var bytes = require('bytes'); - -/*! - * Log buffer. - */ - -var buf = []; - -/*! - * Default log buffer duration. - */ - -var defaultBufferDuration = 1000; - -/** - * Logger: - * - * Log requests with the given `options` or a `format` string. - * - * Options: - * - * - `format` Format string, see below for tokens - * - `stream` Output stream, defaults to _stdout_ - * - `buffer` Buffer duration, defaults to 1000ms when _true_ - * - `immediate` Write log line on request instead of response (for response times) - * - * Tokens: - * - * - `:req[header]` ex: `:req[Accept]` - * - `:res[header]` ex: `:res[Content-Length]` - * - `:http-version` - * - `:response-time` - * - `:remote-addr` - * - `:date` - * - `:method` - * - `:url` - * - `:referrer` - * - `:user-agent` - * - `:status` - * - * Formats: - * - * Pre-defined formats that ship with connect: - * - * - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"' - * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms' - * - `tiny` ':method :url :status :res[content-length] - :response-time ms' - * - `dev` concise output colored by response status for development use - * - * Examples: - * - * connect.logger() // default - * connect.logger('short') - * connect.logger('tiny') - * connect.logger({ immediate: true, format: 'dev' }) - * connect.logger(':method :url - :referrer') - * connect.logger(':req[content-type] -> :res[content-type]') - * connect.logger(function(tokens, req, res){ return 'some format string' }) - * - * Defining Tokens: - * - * To define a token, simply invoke `connect.logger.token()` with the - * name and a callback function. The value returned is then available - * as ":type" in this case. - * - * connect.logger.token('type', function(req, res){ return req.headers['content-type']; }) - * - * Defining Formats: - * - * All default formats are defined this way, however it's public API as well: - * - * connect.logger.format('name', 'string or function') - * - * @param {String|Function|Object} format or options - * @return {Function} - * @api public - */ - -exports = module.exports = function logger(options) { - if ('object' == typeof options) { - options = options || {}; - } else if (options) { - options = { format: options }; - } else { - options = {}; - } - - // output on request instead of response - var immediate = options.immediate; - - // format name - var fmt = exports[options.format] || options.format || exports.default; - - // compile format - if ('function' != typeof fmt) fmt = compile(fmt); - - // options - var stream = options.stream || process.stdout - , buffer = options.buffer; - - // buffering support - if (buffer) { - var realStream = stream - , interval = 'number' == typeof buffer - ? buffer - : defaultBufferDuration; - - // flush interval - setInterval(function(){ - if (buf.length) { - realStream.write(buf.join('')); - buf.length = 0; - } - }, interval); - - // swap the stream - stream = { - write: function(str){ - buf.push(str); - } - }; - } - - return function logger(req, res, next) { - req._startTime = new Date; - - // immediate - if (immediate) { - var line = fmt(exports, req, res); - if (null == line) return; - stream.write(line + '\n'); - // proxy end to output logging - } else { - var end = res.end; - res.end = function(chunk, encoding){ - res.end = end; - res.end(chunk, encoding); - var line = fmt(exports, req, res); - if (null == line) return; - stream.write(line + '\n'); - }; - } - - - next(); - }; -}; - -/** - * Compile `fmt` into a function. - * - * @param {String} fmt - * @return {Function} - * @api private - */ - -function compile(fmt) { - fmt = fmt.replace(/"/g, '\\"'); - var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){ - return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "'; - }) + '";' - return new Function('tokens, req, res', js); -}; - -/** - * Define a token function with the given `name`, - * and callback `fn(req, res)`. - * - * @param {String} name - * @param {Function} fn - * @return {Object} exports for chaining - * @api public - */ - -exports.token = function(name, fn) { - exports[name] = fn; - return this; -}; - -/** - * Define a `fmt` with the given `name`. - * - * @param {String} name - * @param {String|Function} fmt - * @return {Object} exports for chaining - * @api public - */ - -exports.format = function(name, str){ - exports[name] = str; - return this; -}; - -/** - * Default format. - */ - -exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'); - -/** - * Short format. - */ - -exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'); - -/** - * Tiny format. - */ - -exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms'); - -/** - * dev (colored) - */ - -exports.format('dev', function(tokens, req, res){ - var status = res.statusCode - , len = parseInt(res.getHeader('Content-Length'), 10) - , color = 32; - - if (status >= 500) color = 31 - else if (status >= 400) color = 33 - else if (status >= 300) color = 36; - - len = isNaN(len) - ? '' - : len = ' - ' + bytes(len); - - return '\033[90m' + req.method - + ' ' + req.originalUrl + ' ' - + '\033[' + color + 'm' + res.statusCode - + ' \033[90m' - + (new Date - req._startTime) - + 'ms' + len - + '\033[0m'; -}); - -/** - * request url - */ - -exports.token('url', function(req){ - return req.originalUrl || req.url; -}); - -/** - * request method - */ - -exports.token('method', function(req){ - return req.method; -}); - -/** - * response time in milliseconds - */ - -exports.token('response-time', function(req){ - return new Date - req._startTime; -}); - -/** - * UTC date - */ - -exports.token('date', function(){ - return new Date().toUTCString(); -}); - -/** - * response status code - */ - -exports.token('status', function(req, res){ - return res.statusCode; -}); - -/** - * normalized referrer - */ - -exports.token('referrer', function(req){ - return req.headers['referer'] || req.headers['referrer']; -}); - -/** - * remote address - */ - -exports.token('remote-addr', function(req){ - if (req.ip) return req.ip; - var sock = req.socket; - if (sock.socket) return sock.socket.remoteAddress; - return sock.remoteAddress; -}); - -/** - * HTTP version - */ - -exports.token('http-version', function(req){ - return req.httpVersionMajor + '.' + req.httpVersionMinor; -}); - -/** - * UA string - */ - -exports.token('user-agent', function(req){ - return req.headers['user-agent']; -}); - -/** - * request header - */ - -exports.token('req', function(req, res, field){ - return req.headers[field.toLowerCase()]; -}); - -/** - * response header - */ - -exports.token('res', function(req, res, field){ - return (res._headers || {})[field.toLowerCase()]; -}); - diff --git a/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js b/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js deleted file mode 100644 index aaf4014..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js +++ /dev/null @@ -1,40 +0,0 @@ - -/*! - * Connect - methodOverride - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Method Override: - * - * Provides faux HTTP method support. - * - * Pass an optional `key` to use when checking for - * a method override, othewise defaults to _\_method_. - * The original method is available via `req.originalMethod`. - * - * @param {String} key - * @return {Function} - * @api public - */ - -module.exports = function methodOverride(key){ - key = key || "_method"; - return function methodOverride(req, res, next) { - req.originalMethod = req.originalMethod || req.method; - - // req.body - if (req.body && key in req.body) { - req.method = req.body[key].toUpperCase(); - delete req.body[key]; - // check X-HTTP-Method-Override - } else if (req.headers['x-http-method-override']) { - req.method = req.headers['x-http-method-override'].toUpperCase(); - } - - next(); - }; -}; - diff --git a/node_modules/express/node_modules/connect/lib/middleware/multipart.js b/node_modules/express/node_modules/connect/lib/middleware/multipart.js deleted file mode 100644 index 7b26fae..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/multipart.js +++ /dev/null @@ -1,133 +0,0 @@ -/*! - * Connect - multipart - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var formidable = require('formidable') - , _limit = require('./limit') - , utils = require('../utils') - , qs = require('qs'); - -/** - * noop middleware. - */ - -function noop(req, res, next) { - next(); -} - -/** - * Multipart: - * - * Parse multipart/form-data request bodies, - * providing the parsed object as `req.body` - * and `req.files`. - * - * Configuration: - * - * The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s - * `IncomingForm` object, allowing you to configure the upload directory, - * size limits, etc. For example if you wish to change the upload dir do the following. - * - * app.use(connect.multipart({ uploadDir: path })); - * - * Options: - * - * - `limit` byte limit defaulting to none - * - `defer` defers processing and exposes the Formidable form object as `req.form`. - * `next()` is called without waiting for the form's "end" event. - * This option is useful if you need to bind to the "progress" event, for example. - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(options){ - options = options || {}; - - var limit = options.limit - ? _limit(options.limit) - : noop; - - return function multipart(req, res, next) { - if (req._body) return next(); - req.body = req.body || {}; - req.files = req.files || {}; - - if (!utils.hasBody(req)) return next(); - - // ignore GET - if ('GET' == req.method || 'HEAD' == req.method) return next(); - - // check Content-Type - if ('multipart/form-data' != utils.mime(req)) return next(); - - // flag as parsed - req._body = true; - - // parse - limit(req, res, function(err){ - if (err) return next(err); - - var form = new formidable.IncomingForm - , data = {} - , files = {} - , done; - - Object.keys(options).forEach(function(key){ - form[key] = options[key]; - }); - - function ondata(name, val, data){ - if (Array.isArray(data[name])) { - data[name].push(val); - } else if (data[name]) { - data[name] = [data[name], val]; - } else { - data[name] = val; - } - } - - form.on('field', function(name, val){ - ondata(name, val, data); - }); - - form.on('file', function(name, val){ - ondata(name, val, files); - }); - - form.on('error', function(err){ - if (!options.defer) { - err.status = 400; - next(err); - } - done = true; - }); - - form.on('end', function(){ - if (done) return; - try { - req.body = qs.parse(data); - req.files = qs.parse(files); - if (!options.defer) next(); - } catch (err) { - form.emit('error', err); - } - }); - - form.parse(req); - - if (options.defer) { - req.form = form; - next(); - } - }); - } -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/query.js b/node_modules/express/node_modules/connect/lib/middleware/query.js deleted file mode 100644 index 93fc5d3..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/query.js +++ /dev/null @@ -1,46 +0,0 @@ -/*! - * Connect - query - * Copyright(c) 2011 TJ Holowaychuk - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var qs = require('qs') - , parse = require('../utils').parseUrl; - -/** - * Query: - * - * Automatically parse the query-string when available, - * populating the `req.query` object. - * - * Examples: - * - * connect() - * .use(connect.query()) - * .use(function(req, res){ - * res.end(JSON.stringify(req.query)); - * }); - * - * The `options` passed are provided to qs.parse function. - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function query(options){ - return function query(req, res, next){ - if (!req.query) { - req.query = ~req.url.indexOf('?') - ? qs.parse(parse(req).query, options) - : {}; - } - - next(); - }; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/responseTime.js b/node_modules/express/node_modules/connect/lib/middleware/responseTime.js deleted file mode 100644 index 62abc04..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/responseTime.js +++ /dev/null @@ -1,32 +0,0 @@ - -/*! - * Connect - responseTime - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Reponse time: - * - * Adds the `X-Response-Time` header displaying the response - * duration in milliseconds. - * - * @return {Function} - * @api public - */ - -module.exports = function responseTime(){ - return function(req, res, next){ - var start = new Date; - - if (res._responseTime) return next(); - res._responseTime = true; - - res.on('header', function(){ - var duration = new Date - start; - res.setHeader('X-Response-Time', duration + 'ms'); - }); - - next(); - }; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/session.js b/node_modules/express/node_modules/connect/lib/middleware/session.js deleted file mode 100644 index 9be6c8b..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/session.js +++ /dev/null @@ -1,356 +0,0 @@ - -/*! - * Connect - session - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Session = require('./session/session') - , debug = require('debug')('connect:session') - , MemoryStore = require('./session/memory') - , signature = require('cookie-signature') - , Cookie = require('./session/cookie') - , Store = require('./session/store') - , utils = require('./../utils') - , parse = utils.parseUrl - , crc32 = require('buffer-crc32'); - -// environment - -var env = process.env.NODE_ENV; - -/** - * Expose the middleware. - */ - -exports = module.exports = session; - -/** - * Expose constructors. - */ - -exports.Store = Store; -exports.Cookie = Cookie; -exports.Session = Session; -exports.MemoryStore = MemoryStore; - -/** - * Warning message for `MemoryStore` usage in production. - */ - -var warning = 'Warning: connection.session() MemoryStore is not\n' - + 'designed for a production environment, as it will leak\n' - + 'memory, and will not scale past a single process.'; - -/** - * Session: - * - * Setup session store with the given `options`. - * - * Session data is _not_ saved in the cookie itself, however - * cookies are used, so we must use the [cookieParser()](cookieParser.html) - * middleware _before_ `session()`. - * - * Examples: - * - * connect() - * .use(connect.cookieParser()) - * .use(connect.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }})) - * - * Options: - * - * - `key` cookie name defaulting to `connect.sid` - * - `store` session store instance - * - `secret` session cookie is signed with this secret to prevent tampering - * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` - * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") - * - * Cookie option: - * - * By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set - * so the cookie becomes a browser-session cookie. When the user closes the - * browser the cookie (and session) will be removed. - * - * ## req.session - * - * To store or access session data, simply use the request property `req.session`, - * which is (generally) serialized as JSON by the store, so nested objects - * are typically fine. For example below is a user-specific view counter: - * - * connect() - * .use(connect.favicon()) - * .use(connect.cookieParser()) - * .use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }})) - * .use(function(req, res, next){ - * var sess = req.session; - * if (sess.views) { - * res.setHeader('Content-Type', 'text/html'); - * res.write('

    views: ' + sess.views + '

    '); - * res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    '); - * res.end(); - * sess.views++; - * } else { - * sess.views = 1; - * res.end('welcome to the session demo. refresh!'); - * } - * } - * )).listen(3000); - * - * ## Session#regenerate() - * - * To regenerate the session simply invoke the method, once complete - * a new SID and `Session` instance will be initialized at `req.session`. - * - * req.session.regenerate(function(err){ - * // will have a new session here - * }); - * - * ## Session#destroy() - * - * Destroys the session, removing `req.session`, will be re-generated next request. - * - * req.session.destroy(function(err){ - * // cannot access session here - * }); - * - * ## Session#reload() - * - * Reloads the session data. - * - * req.session.reload(function(err){ - * // session updated - * }); - * - * ## Session#save() - * - * Save the session. - * - * req.session.save(function(err){ - * // session saved - * }); - * - * ## Session#touch() - * - * Updates the `.maxAge` property. Typically this is - * not necessary to call, as the session middleware does this for you. - * - * ## Session#cookie - * - * Each session has a unique cookie object accompany it. This allows - * you to alter the session cookie per visitor. For example we can - * set `req.session.cookie.expires` to `false` to enable the cookie - * to remain for only the duration of the user-agent. - * - * ## Session#maxAge - * - * Alternatively `req.session.cookie.maxAge` will return the time - * remaining in milliseconds, which we may also re-assign a new value - * to adjust the `.expires` property appropriately. The following - * are essentially equivalent - * - * var hour = 3600000; - * req.session.cookie.expires = new Date(Date.now() + hour); - * req.session.cookie.maxAge = hour; - * - * For example when `maxAge` is set to `60000` (one minute), and 30 seconds - * has elapsed it will return `30000` until the current request has completed, - * at which time `req.session.touch()` is called to reset `req.session.maxAge` - * to its original value. - * - * req.session.cookie.maxAge; - * // => 30000 - * - * Session Store Implementation: - * - * Every session store _must_ implement the following methods - * - * - `.get(sid, callback)` - * - `.set(sid, session, callback)` - * - `.destroy(sid, callback)` - * - * Recommended methods include, but are not limited to: - * - * - `.length(callback)` - * - `.clear(callback)` - * - * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo. - * - * @param {Object} options - * @return {Function} - * @api public - */ - -function session(options){ - var options = options || {} - , key = options.key || 'connect.sid' - , store = options.store || new MemoryStore - , cookie = options.cookie || {} - , trustProxy = options.proxy - , storeReady = true; - - // notify user that this store is not - // meant for a production environment - if ('production' == env && store instanceof MemoryStore) { - console.warn(warning); - } - - // generates the new session - store.generate = function(req){ - req.sessionID = utils.uid(24); - req.session = new Session(req); - req.session.cookie = new Cookie(cookie); - }; - - store.on('disconnect', function(){ storeReady = false; }); - store.on('connect', function(){ storeReady = true; }); - - return function session(req, res, next) { - // self-awareness - if (req.session) return next(); - - // Handle connection as if there is no session if - // the store has temporarily disconnected etc - if (!storeReady) return debug('store is disconnected'), next(); - - // pathname mismatch - if (0 != req.originalUrl.indexOf(cookie.path || '/')) return next(); - - // backwards compatibility for signed cookies - // req.secret is passed from the cookie parser middleware - var secret = options.secret || req.secret; - - // ensure secret is available or bail - if (!secret) throw new Error('`secret` option required for sessions'); - - // parse url - var originalHash - , originalId; - - // expose store - req.sessionStore = store; - - // grab the session cookie value and check the signature - var rawCookie = req.cookies[key]; - - // get signedCookies for backwards compat with signed cookies - var unsignedCookie = req.signedCookies[key]; - - if (!unsignedCookie && rawCookie) { - unsignedCookie = utils.parseSignedCookie(rawCookie, secret); - } - - // set-cookie - res.on('header', function(){ - if (!req.session) return; - var cookie = req.session.cookie - , proto = (req.headers['x-forwarded-proto'] || '').split(',')[0].toLowerCase().trim() - , tls = req.connection.encrypted || (trustProxy && 'https' == proto) - , secured = cookie.secure && tls - , isNew = unsignedCookie != req.sessionID; - - // only send secure cookies via https - if (cookie.secure && !secured) return debug('not secured'); - - // long expires, handle expiry server-side - if (!isNew && cookie.hasLongExpires) return debug('already set cookie'); - - // browser-session length cookie - if (null == cookie.expires) { - if (!isNew) return debug('already set browser-session cookie'); - // compare hashes and ids - } else if (originalHash == hash(req.session) && originalId == req.session.id) { - return debug('unmodified session'); - } - - var val = 's:' + signature.sign(req.sessionID, secret); - val = cookie.serialize(key, val); - debug('set-cookie %s', val); - res.setHeader('Set-Cookie', val); - }); - - // proxy end() to commit the session - var end = res.end; - res.end = function(data, encoding){ - res.end = end; - if (!req.session) return res.end(data, encoding); - debug('saving'); - req.session.resetMaxAge(); - req.session.save(function(err){ - if (err) console.error(err.stack); - debug('saved'); - res.end(data, encoding); - }); - }; - - // generate the session - function generate() { - store.generate(req); - } - - // get the sessionID from the cookie - req.sessionID = unsignedCookie; - - // generate a session if the browser doesn't send a sessionID - if (!req.sessionID) { - debug('no SID sent, generating session'); - generate(); - next(); - return; - } - - // generate the session object - var pause = utils.pause(req); - debug('fetching %s', req.sessionID); - store.get(req.sessionID, function(err, sess){ - // proxy to resume() events - var _next = next; - next = function(err){ - _next(err); - pause.resume(); - }; - - // error handling - if (err) { - debug('error %j', err); - if ('ENOENT' == err.code) { - generate(); - next(); - } else { - next(err); - } - // no session - } else if (!sess) { - debug('no session found'); - generate(); - next(); - // populate req.session - } else { - debug('session found'); - store.createSession(req, sess); - originalId = req.sessionID; - originalHash = hash(sess); - next(); - } - }); - }; -}; - -/** - * Hash the given `sess` object omitting changes - * to `.cookie`. - * - * @param {Object} sess - * @return {String} - * @api private - */ - -function hash(sess) { - return crc32.signed(JSON.stringify(sess, function(key, val){ - if ('cookie' != key) return val; - })); -} diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js b/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js deleted file mode 100644 index cdce2a5..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/session/cookie.js +++ /dev/null @@ -1,140 +0,0 @@ - -/*! - * Connect - session - Cookie - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../../utils') - , cookie = require('cookie'); - -/** - * Initialize a new `Cookie` with the given `options`. - * - * @param {IncomingMessage} req - * @param {Object} options - * @api private - */ - -var Cookie = module.exports = function Cookie(options) { - this.path = '/'; - this.maxAge = null; - this.httpOnly = true; - if (options) utils.merge(this, options); - this.originalMaxAge = undefined == this.originalMaxAge - ? this.maxAge - : this.originalMaxAge; -}; - -/*! - * Prototype. - */ - -Cookie.prototype = { - - /** - * Set expires `date`. - * - * @param {Date} date - * @api public - */ - - set expires(date) { - this._expires = date; - this.originalMaxAge = this.maxAge; - }, - - /** - * Get expires `date`. - * - * @return {Date} - * @api public - */ - - get expires() { - return this._expires; - }, - - /** - * Set expires via max-age in `ms`. - * - * @param {Number} ms - * @api public - */ - - set maxAge(ms) { - this.expires = 'number' == typeof ms - ? new Date(Date.now() + ms) - : ms; - }, - - /** - * Get expires max-age in `ms`. - * - * @return {Number} - * @api public - */ - - get maxAge() { - return this.expires instanceof Date - ? this.expires.valueOf() - Date.now() - : this.expires; - }, - - /** - * Return cookie data object. - * - * @return {Object} - * @api private - */ - - get data() { - return { - originalMaxAge: this.originalMaxAge - , expires: this._expires - , secure: this.secure - , httpOnly: this.httpOnly - , domain: this.domain - , path: this.path - } - }, - - /** - * Check if the cookie has a reasonably large max-age. - * - * @return {Boolean} - * @api private - */ - - get hasLongExpires() { - var week = 604800000; - return this.maxAge > (4 * week); - }, - - /** - * Return a serialized cookie string. - * - * @return {String} - * @api public - */ - - serialize: function(name, val){ - return cookie.serialize(name, val, this.data); - }, - - /** - * Return JSON representation of this cookie. - * - * @return {Object} - * @api private - */ - - toJSON: function(){ - return this.data; - } -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/memory.js b/node_modules/express/node_modules/connect/lib/middleware/session/memory.js deleted file mode 100644 index fb93939..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/session/memory.js +++ /dev/null @@ -1,129 +0,0 @@ - -/*! - * Connect - session - MemoryStore - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Store = require('./store'); - -/** - * Initialize a new `MemoryStore`. - * - * @api public - */ - -var MemoryStore = module.exports = function MemoryStore() { - this.sessions = {}; -}; - -/** - * Inherit from `Store.prototype`. - */ - -MemoryStore.prototype.__proto__ = Store.prototype; - -/** - * Attempt to fetch session by the given `sid`. - * - * @param {String} sid - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.get = function(sid, fn){ - var self = this; - process.nextTick(function(){ - var expires - , sess = self.sessions[sid]; - if (sess) { - sess = JSON.parse(sess); - expires = 'string' == typeof sess.cookie.expires - ? new Date(sess.cookie.expires) - : sess.cookie.expires; - if (!expires || new Date < expires) { - fn(null, sess); - } else { - self.destroy(sid, fn); - } - } else { - fn(); - } - }); -}; - -/** - * Commit the given `sess` object associated with the given `sid`. - * - * @param {String} sid - * @param {Session} sess - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.set = function(sid, sess, fn){ - var self = this; - process.nextTick(function(){ - self.sessions[sid] = JSON.stringify(sess); - fn && fn(); - }); -}; - -/** - * Destroy the session associated with the given `sid`. - * - * @param {String} sid - * @api public - */ - -MemoryStore.prototype.destroy = function(sid, fn){ - var self = this; - process.nextTick(function(){ - delete self.sessions[sid]; - fn && fn(); - }); -}; - -/** - * Invoke the given callback `fn` with all active sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.all = function(fn){ - var arr = [] - , keys = Object.keys(this.sessions); - for (var i = 0, len = keys.length; i < len; ++i) { - arr.push(this.sessions[keys[i]]); - } - fn(null, arr); -}; - -/** - * Clear all sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.clear = function(fn){ - this.sessions = {}; - fn && fn(); -}; - -/** - * Fetch number of sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.length = function(fn){ - fn(null, Object.keys(this.sessions).length); -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/session.js b/node_modules/express/node_modules/connect/lib/middleware/session/session.js deleted file mode 100644 index 0dd4b40..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/session/session.js +++ /dev/null @@ -1,116 +0,0 @@ - -/*! - * Connect - session - Session - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../../utils'); - -/** - * Create a new `Session` with the given request and `data`. - * - * @param {IncomingRequest} req - * @param {Object} data - * @api private - */ - -var Session = module.exports = function Session(req, data) { - Object.defineProperty(this, 'req', { value: req }); - Object.defineProperty(this, 'id', { value: req.sessionID }); - if ('object' == typeof data) utils.merge(this, data); -}; - -/** - * Update reset `.cookie.maxAge` to prevent - * the cookie from expiring when the - * session is still active. - * - * @return {Session} for chaining - * @api public - */ - -Session.prototype.touch = function(){ - return this.resetMaxAge(); -}; - -/** - * Reset `.maxAge` to `.originalMaxAge`. - * - * @return {Session} for chaining - * @api public - */ - -Session.prototype.resetMaxAge = function(){ - this.cookie.maxAge = this.cookie.originalMaxAge; - return this; -}; - -/** - * Save the session data with optional callback `fn(err)`. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.save = function(fn){ - this.req.sessionStore.set(this.id, this, fn || function(){}); - return this; -}; - -/** - * Re-loads the session data _without_ altering - * the maxAge properties. Invokes the callback `fn(err)`, - * after which time if no exception has occurred the - * `req.session` property will be a new `Session` object, - * although representing the same session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.reload = function(fn){ - var req = this.req - , store = this.req.sessionStore; - store.get(this.id, function(err, sess){ - if (err) return fn(err); - if (!sess) return fn(new Error('failed to load session')); - store.createSession(req, sess); - fn(); - }); - return this; -}; - -/** - * Destroy `this` session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.destroy = function(fn){ - delete this.req.session; - this.req.sessionStore.destroy(this.id, fn); - return this; -}; - -/** - * Regenerate this request's session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.regenerate = function(fn){ - this.req.sessionStore.regenerate(this.req, fn); - return this; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/session/store.js b/node_modules/express/node_modules/connect/lib/middleware/session/store.js deleted file mode 100644 index 54294cb..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/session/store.js +++ /dev/null @@ -1,84 +0,0 @@ - -/*! - * Connect - session - Store - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , Session = require('./session') - , Cookie = require('./cookie'); - -/** - * Initialize abstract `Store`. - * - * @api private - */ - -var Store = module.exports = function Store(options){}; - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Store.prototype.__proto__ = EventEmitter.prototype; - -/** - * Re-generate the given requests's session. - * - * @param {IncomingRequest} req - * @return {Function} fn - * @api public - */ - -Store.prototype.regenerate = function(req, fn){ - var self = this; - this.destroy(req.sessionID, function(err){ - self.generate(req); - fn(err); - }); -}; - -/** - * Load a `Session` instance via the given `sid` - * and invoke the callback `fn(err, sess)`. - * - * @param {String} sid - * @param {Function} fn - * @api public - */ - -Store.prototype.load = function(sid, fn){ - var self = this; - this.get(sid, function(err, sess){ - if (err) return fn(err); - if (!sess) return fn(); - var req = { sessionID: sid, sessionStore: self }; - sess = self.createSession(req, sess); - fn(null, sess); - }); -}; - -/** - * Create session from JSON `sess` data. - * - * @param {IncomingRequest} req - * @param {Object} sess - * @return {Session} - * @api private - */ - -Store.prototype.createSession = function(req, sess){ - var expires = sess.cookie.expires - , orig = sess.cookie.originalMaxAge; - sess.cookie = new Cookie(sess.cookie); - if ('string' == typeof expires) sess.cookie.expires = new Date(expires); - sess.cookie.originalMaxAge = orig; - req.session = new Session(req, sess); - return req.session; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/static.js b/node_modules/express/node_modules/connect/lib/middleware/static.js deleted file mode 100644 index f69b58e..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/static.js +++ /dev/null @@ -1,95 +0,0 @@ -/*! - * Connect - static - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var send = require('send') - , utils = require('../utils') - , parse = utils.parseUrl - , url = require('url'); - -/** - * Static: - * - * Static file server with the given `root` path. - * - * Examples: - * - * var oneDay = 86400000; - * - * connect() - * .use(connect.static(__dirname + '/public')) - * - * connect() - * .use(connect.static(__dirname + '/public', { maxAge: oneDay })) - * - * Options: - * - * - `maxAge` Browser cache maxAge in milliseconds. defaults to 0 - * - `hidden` Allow transfer of hidden files. defaults to false - * - `redirect` Redirect to trailing "/" when the pathname is a dir. defaults to true - * - `index` Default file name, defaults to 'index.html' - * - * @param {String} root - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function static(root, options){ - options = options || {}; - - // root required - if (!root) throw new Error('static() root path required'); - - // default redirect - var redirect = false !== options.redirect; - - return function static(req, res, next) { - if ('GET' != req.method && 'HEAD' != req.method) return next(); - var path = parse(req).pathname; - var pause = utils.pause(req); - - function resume() { - next(); - pause.resume(); - } - - function directory() { - if (!redirect) return resume(); - var pathname = url.parse(req.originalUrl).pathname; - res.statusCode = 301; - res.setHeader('Location', pathname + '/'); - res.end('Redirecting to ' + utils.escape(pathname) + '/'); - } - - function error(err) { - if (404 == err.status) return resume(); - next(err); - } - - send(req, path) - .maxage(options.maxAge || 0) - .root(root) - .index(options.index || 'index.html') - .hidden(options.hidden) - .on('error', error) - .on('directory', directory) - .pipe(res); - }; -}; - -/** - * Expose mime module. - * - * If you wish to extend the mime table use this - * reference to the "mime" module in the npm registry. - */ - -exports.mime = send.mime; diff --git a/node_modules/express/node_modules/connect/lib/middleware/staticCache.js b/node_modules/express/node_modules/connect/lib/middleware/staticCache.js deleted file mode 100644 index 7354a8f..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/staticCache.js +++ /dev/null @@ -1,231 +0,0 @@ - -/*! - * Connect - staticCache - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , Cache = require('../cache') - , fresh = require('fresh'); - -/** - * Static cache: - * - * Enables a memory cache layer on top of - * the `static()` middleware, serving popular - * static files. - * - * By default a maximum of 128 objects are - * held in cache, with a max of 256k each, - * totalling ~32mb. - * - * A Least-Recently-Used (LRU) cache algo - * is implemented through the `Cache` object, - * simply rotating cache objects as they are - * hit. This means that increasingly popular - * objects maintain their positions while - * others get shoved out of the stack and - * garbage collected. - * - * Benchmarks: - * - * static(): 2700 rps - * node-static: 5300 rps - * static() + staticCache(): 7500 rps - * - * Options: - * - * - `maxObjects` max cache objects [128] - * - `maxLength` max cache object length 256kb - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function staticCache(options){ - var options = options || {} - , cache = new Cache(options.maxObjects || 128) - , maxlen = options.maxLength || 1024 * 256; - - console.warn('connect.staticCache() is deprecated and will be removed in 3.0'); - console.warn('use varnish or similar reverse proxy caches.'); - - return function staticCache(req, res, next){ - var key = cacheKey(req) - , ranges = req.headers.range - , hasCookies = req.headers.cookie - , hit = cache.get(key); - - // cache static - // TODO: change from staticCache() -> cache() - // and make this work for any request - req.on('static', function(stream){ - var headers = res._headers - , cc = utils.parseCacheControl(headers['cache-control'] || '') - , contentLength = headers['content-length'] - , hit; - - // dont cache set-cookie responses - if (headers['set-cookie']) return hasCookies = true; - - // dont cache when cookies are present - if (hasCookies) return; - - // ignore larger files - if (!contentLength || contentLength > maxlen) return; - - // don't cache partial files - if (headers['content-range']) return; - - // dont cache items we shouldn't be - // TODO: real support for must-revalidate / no-cache - if ( cc['no-cache'] - || cc['no-store'] - || cc['private'] - || cc['must-revalidate']) return; - - // if already in cache then validate - if (hit = cache.get(key)){ - if (headers.etag == hit[0].etag) { - hit[0].date = new Date; - return; - } else { - cache.remove(key); - } - } - - // validation notifiactions don't contain a steam - if (null == stream) return; - - // add the cache object - var arr = []; - - // store the chunks - stream.on('data', function(chunk){ - arr.push(chunk); - }); - - // flag it as complete - stream.on('end', function(){ - var cacheEntry = cache.add(key); - delete headers['x-cache']; // Clean up (TODO: others) - cacheEntry.push(200); - cacheEntry.push(headers); - cacheEntry.push.apply(cacheEntry, arr); - }); - }); - - if (req.method == 'GET' || req.method == 'HEAD') { - if (ranges) { - next(); - } else if (!hasCookies && hit && !mustRevalidate(req, hit)) { - res.setHeader('X-Cache', 'HIT'); - respondFromCache(req, res, hit); - } else { - res.setHeader('X-Cache', 'MISS'); - next(); - } - } else { - next(); - } - } -}; - -/** - * Respond with the provided cached value. - * TODO: Assume 200 code, that's iffy. - * - * @param {Object} req - * @param {Object} res - * @param {Object} cacheEntry - * @return {String} - * @api private - */ - -function respondFromCache(req, res, cacheEntry) { - var status = cacheEntry[0] - , headers = utils.merge({}, cacheEntry[1]) - , content = cacheEntry.slice(2); - - headers.age = (new Date - new Date(headers.date)) / 1000 || 0; - - switch (req.method) { - case 'HEAD': - res.writeHead(status, headers); - res.end(); - break; - case 'GET': - if (utils.conditionalGET(req) && fresh(req.headers, headers)) { - headers['content-length'] = 0; - res.writeHead(304, headers); - res.end(); - } else { - res.writeHead(status, headers); - - function write() { - while (content.length) { - if (false === res.write(content.shift())) { - res.once('drain', write); - return; - } - } - res.end(); - } - - write(); - } - break; - default: - // This should never happen. - res.writeHead(500, ''); - res.end(); - } -} - -/** - * Determine whether or not a cached value must be revalidated. - * - * @param {Object} req - * @param {Object} cacheEntry - * @return {String} - * @api private - */ - -function mustRevalidate(req, cacheEntry) { - var cacheHeaders = cacheEntry[1] - , reqCC = utils.parseCacheControl(req.headers['cache-control'] || '') - , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '') - , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0; - - if ( cacheCC['no-cache'] - || cacheCC['must-revalidate'] - || cacheCC['proxy-revalidate']) return true; - - if (reqCC['no-cache']) return true; - - if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge; - - if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge; - - return false; -} - -/** - * The key to use in the cache. For now, this is the URL path and query. - * - * 'http://example.com?key=value' -> '/?key=value' - * - * @param {Object} req - * @return {String} - * @api private - */ - -function cacheKey(req) { - return utils.parseUrl(req).path; -} diff --git a/node_modules/express/node_modules/connect/lib/middleware/timeout.js b/node_modules/express/node_modules/connect/lib/middleware/timeout.js deleted file mode 100644 index dba4654..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/timeout.js +++ /dev/null @@ -1,55 +0,0 @@ -/*! - * Connect - timeout - * Ported from https://github.com/LearnBoost/connect-timeout - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var debug = require('debug')('connect:timeout'); - -/** - * Timeout: - * - * Times out the request in `ms`, defaulting to `5000`. The - * method `req.clearTimeout()` is added to revert this behaviour - * programmatically within your application's middleware, routes, etc. - * - * The timeout error is passed to `next()` so that you may customize - * the response behaviour. This error has the `.timeout` property as - * well as `.status == 408`. - * - * @param {Number} ms - * @return {Function} - * @api public - */ - -module.exports = function timeout(ms) { - ms = ms || 5000; - - return function(req, res, next) { - var id = setTimeout(function(){ - req.emit('timeout', ms); - }, ms); - - req.on('timeout', function(){ - if (res.headerSent) return debug('response started, cannot timeout'); - var err = new Error('Response timeout'); - err.timeout = ms; - err.status = 503; - next(err); - }); - - req.clearTimeout = function(){ - clearTimeout(id); - }; - - res.on('header', function(){ - clearTimeout(id); - }); - - next(); - }; -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js b/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js deleted file mode 100644 index cceafc0..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js +++ /dev/null @@ -1,78 +0,0 @@ - -/*! - * Connect - urlencoded - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , _limit = require('./limit') - , qs = require('qs'); - -/** - * noop middleware. - */ - -function noop(req, res, next) { - next(); -} - -/** - * Urlencoded: - * - * Parse x-ww-form-urlencoded request bodies, - * providing the parsed object as `req.body`. - * - * Options: - * - * - `limit` byte limit disabled by default - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(options){ - options = options || {}; - - var limit = options.limit - ? _limit(options.limit) - : noop; - - return function urlencoded(req, res, next) { - if (req._body) return next(); - req.body = req.body || {}; - - if (!utils.hasBody(req)) return next(); - - // check Content-Type - if ('application/x-www-form-urlencoded' != utils.mime(req)) return next(); - - // flag as parsed - req._body = true; - - // parse - limit(req, res, function(err){ - if (err) return next(err); - var buf = ''; - req.setEncoding('utf8'); - req.on('data', function(chunk){ buf += chunk }); - req.on('end', function(){ - try { - req.body = buf.length - ? qs.parse(buf, options) - : {}; - next(); - } catch (err){ - err.body = buf; - next(err); - } - }); - }); - } -}; diff --git a/node_modules/express/node_modules/connect/lib/middleware/vhost.js b/node_modules/express/node_modules/connect/lib/middleware/vhost.js deleted file mode 100644 index abbb050..0000000 --- a/node_modules/express/node_modules/connect/lib/middleware/vhost.js +++ /dev/null @@ -1,40 +0,0 @@ - -/*! - * Connect - vhost - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Vhost: - * - * Setup vhost for the given `hostname` and `server`. - * - * connect() - * .use(connect.vhost('foo.com', fooApp)) - * .use(connect.vhost('bar.com', barApp)) - * .use(connect.vhost('*.com', mainApp)) - * - * The `server` may be a Connect server or - * a regular Node `http.Server`. - * - * @param {String} hostname - * @param {Server} server - * @return {Function} - * @api public - */ - -module.exports = function vhost(hostname, server){ - if (!hostname) throw new Error('vhost hostname required'); - if (!server) throw new Error('vhost server required'); - var regexp = new RegExp('^' + hostname.replace(/[^*\w]/g, '\\$&').replace(/[*]/g, '(?:.*?)') + '$', 'i'); - if (server.onvhost) server.onvhost(hostname); - return function vhost(req, res, next){ - if (!req.headers.host) return next(); - var host = req.headers.host.split(':')[0]; - if (!regexp.test(host)) return next(); - if ('function' == typeof server) return server(req, res, next); - server.emit('request', req, res); - }; -}; diff --git a/node_modules/express/node_modules/connect/lib/patch.js b/node_modules/express/node_modules/connect/lib/patch.js deleted file mode 100644 index 7cf0012..0000000 --- a/node_modules/express/node_modules/connect/lib/patch.js +++ /dev/null @@ -1,79 +0,0 @@ - -/*! - * Connect - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var http = require('http') - , res = http.ServerResponse.prototype - , setHeader = res.setHeader - , _renderHeaders = res._renderHeaders - , writeHead = res.writeHead; - -// apply only once - -if (!res._hasConnectPatch) { - - /** - * Provide a public "header sent" flag - * until node does. - * - * @return {Boolean} - * @api public - */ - - res.__defineGetter__('headerSent', function(){ - return this._header; - }); - - /** - * Set header `field` to `val`, special-casing - * the `Set-Cookie` field for multiple support. - * - * @param {String} field - * @param {String} val - * @api public - */ - - res.setHeader = function(field, val){ - var key = field.toLowerCase() - , prev; - - // special-case Set-Cookie - if (this._headers && 'set-cookie' == key) { - if (prev = this.getHeader(field)) { - val = Array.isArray(prev) - ? prev.concat(val) - : [prev, val]; - } - // charset - } else if ('content-type' == key && this.charset) { - val += '; charset=' + this.charset; - } - - return setHeader.call(this, field, val); - }; - - /** - * Proxy to emit "header" event. - */ - - res._renderHeaders = function(){ - if (!this._emittedHeader) this.emit('header'); - this._emittedHeader = true; - return _renderHeaders.call(this); - }; - - res.writeHead = function(){ - if (!this._emittedHeader) this.emit('header'); - this._emittedHeader = true; - return writeHead.apply(this, arguments); - }; - - res._hasConnectPatch = true; -} diff --git a/node_modules/express/node_modules/connect/lib/proto.js b/node_modules/express/node_modules/connect/lib/proto.js deleted file mode 100644 index b304cf7..0000000 --- a/node_modules/express/node_modules/connect/lib/proto.js +++ /dev/null @@ -1,230 +0,0 @@ - -/*! - * Connect - HTTPServer - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var http = require('http') - , utils = require('./utils') - , debug = require('debug')('connect:dispatcher'); - -// prototype - -var app = module.exports = {}; - -// environment - -var env = process.env.NODE_ENV || 'development'; - -/** - * Utilize the given middleware `handle` to the given `route`, - * defaulting to _/_. This "route" is the mount-point for the - * middleware, when given a value other than _/_ the middleware - * is only effective when that segment is present in the request's - * pathname. - * - * For example if we were to mount a function at _/admin_, it would - * be invoked on _/admin_, and _/admin/settings_, however it would - * not be invoked for _/_, or _/posts_. - * - * Examples: - * - * var app = connect(); - * app.use(connect.favicon()); - * app.use(connect.logger()); - * app.use(connect.static(__dirname + '/public')); - * - * If we wanted to prefix static files with _/public_, we could - * "mount" the `static()` middleware: - * - * app.use('/public', connect.static(__dirname + '/public')); - * - * This api is chainable, so the following is valid: - * - * connect() - * .use(connect.favicon()) - * .use(connect.logger()) - * .use(connect.static(__dirname + '/public')) - * .listen(3000); - * - * @param {String|Function|Server} route, callback or server - * @param {Function|Server} callback or server - * @return {Server} for chaining - * @api public - */ - -app.use = function(route, fn){ - // default route to '/' - if ('string' != typeof route) { - fn = route; - route = '/'; - } - - // wrap sub-apps - if ('function' == typeof fn.handle) { - var server = fn; - fn.route = route; - fn = function(req, res, next){ - server.handle(req, res, next); - }; - } - - // wrap vanilla http.Servers - if (fn instanceof http.Server) { - fn = fn.listeners('request')[0]; - } - - // strip trailing slash - if ('/' == route[route.length - 1]) { - route = route.slice(0, -1); - } - - // add the middleware - debug('use %s %s', route || '/', fn.name || 'anonymous'); - this.stack.push({ route: route, handle: fn }); - - return this; -}; - -/** - * Handle server requests, punting them down - * the middleware stack. - * - * @api private - */ - -app.handle = function(req, res, out) { - var stack = this.stack - , fqdn = ~req.url.indexOf('://') - , removed = '' - , slashAdded = false - , index = 0; - - function next(err) { - var layer, path, status, c; - - if (slashAdded) { - req.url = req.url.substr(1); - slashAdded = false; - } - - req.url = removed + req.url; - req.originalUrl = req.originalUrl || req.url; - removed = ''; - - // next callback - layer = stack[index++]; - - // all done - if (!layer || res.headerSent) { - // delegate to parent - if (out) return out(err); - - // unhandled error - if (err) { - // default to 500 - if (res.statusCode < 400) res.statusCode = 500; - debug('default %s', res.statusCode); - - // respect err.status - if (err.status) res.statusCode = err.status; - - // production gets a basic error message - var msg = 'production' == env - ? http.STATUS_CODES[res.statusCode] - : err.stack || err.toString(); - - // log to stderr in a non-test env - if ('test' != env) console.error(err.stack || err.toString()); - if (res.headerSent) return req.socket.destroy(); - res.setHeader('Content-Type', 'text/plain'); - res.setHeader('Content-Length', Buffer.byteLength(msg)); - if ('HEAD' == req.method) return res.end(); - res.end(msg); - } else { - debug('default 404'); - res.statusCode = 404; - res.setHeader('Content-Type', 'text/plain'); - if ('HEAD' == req.method) return res.end(); - res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl)); - } - return; - } - - try { - path = utils.parseUrl(req).pathname; - if (undefined == path) path = '/'; - - // skip this layer if the route doesn't match. - if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err); - - c = path[layer.route.length]; - if (c && '/' != c && '.' != c) return next(err); - - // Call the layer handler - // Trim off the part of the url that matches the route - removed = layer.route; - req.url = req.url.substr(removed.length); - - // Ensure leading slash - if (!fqdn && '/' != req.url[0]) { - req.url = '/' + req.url; - slashAdded = true; - } - - debug('%s', layer.handle.name || 'anonymous'); - var arity = layer.handle.length; - if (err) { - if (arity === 4) { - layer.handle(err, req, res, next); - } else { - next(err); - } - } else if (arity < 4) { - layer.handle(req, res, next); - } else { - next(); - } - } catch (e) { - next(e); - } - } - next(); -}; - -/** - * Listen for connections. - * - * This method takes the same arguments - * as node's `http.Server#listen()`. - * - * HTTP and HTTPS: - * - * If you run your application both as HTTP - * and HTTPS you may wrap them individually, - * since your Connect "server" is really just - * a JavaScript `Function`. - * - * var connect = require('connect') - * , http = require('http') - * , https = require('https'); - * - * var app = connect(); - * - * http.createServer(app).listen(80); - * https.createServer(options, app).listen(443); - * - * @return {http.Server} - * @api public - */ - -app.listen = function(){ - var server = http.createServer(this); - return server.listen.apply(server, arguments); -}; diff --git a/node_modules/express/node_modules/connect/lib/public/directory.html b/node_modules/express/node_modules/connect/lib/public/directory.html deleted file mode 100644 index 2d63704..0000000 --- a/node_modules/express/node_modules/connect/lib/public/directory.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - listing directory {directory} - - - - - -
    -

    {linked-path}

    - {files} -
    - - \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/lib/public/error.html b/node_modules/express/node_modules/connect/lib/public/error.html deleted file mode 100644 index a6d3faf..0000000 --- a/node_modules/express/node_modules/connect/lib/public/error.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - {error} - - - -
    -

    {title}

    -

    {statusCode} {error}

    -
      {stack}
    -
    - - diff --git a/node_modules/express/node_modules/connect/lib/public/favicon.ico b/node_modules/express/node_modules/connect/lib/public/favicon.ico deleted file mode 100644 index 895fc96..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/favicon.ico and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page.png b/node_modules/express/node_modules/connect/lib/public/icons/page.png deleted file mode 100644 index 03ddd79..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_add.png b/node_modules/express/node_modules/connect/lib/public/icons/page_add.png deleted file mode 100644 index d5bfa07..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_add.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png b/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png deleted file mode 100644 index 89ee2da..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_attach.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_code.png deleted file mode 100644 index f7ea904..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_code.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png deleted file mode 100644 index 195dc6d..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_copy.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png b/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png deleted file mode 100644 index 3141467..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_delete.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png b/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png deleted file mode 100644 index 046811e..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_edit.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_error.png b/node_modules/express/node_modules/connect/lib/public/icons/page_error.png deleted file mode 100644 index f07f449..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_error.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png deleted file mode 100644 index eb6158e..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_excel.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_find.png deleted file mode 100644 index 2f19388..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_find.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png b/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png deleted file mode 100644 index 8e83281..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_gear.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_go.png b/node_modules/express/node_modules/connect/lib/public/icons/page_go.png deleted file mode 100644 index 80fe1ed..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_go.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_green.png b/node_modules/express/node_modules/connect/lib/public/icons/page_green.png deleted file mode 100644 index de8e003..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_green.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_key.png deleted file mode 100644 index d6626cb..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_key.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png b/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png deleted file mode 100644 index 7e56870..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_link.png deleted file mode 100644 index 312eab0..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_link.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png deleted file mode 100644 index 246a2f0..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png b/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png deleted file mode 100644 index 968f073..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_paste.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_red.png deleted file mode 100644 index 0b18247..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_red.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png deleted file mode 100644 index cf347c7..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_save.png b/node_modules/express/node_modules/connect/lib/public/icons/page_save.png deleted file mode 100644 index caea546..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_save.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white.png deleted file mode 100644 index 8b8b1ca..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png deleted file mode 100644 index 8f8095e..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png deleted file mode 100644 index 159b240..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png deleted file mode 100644 index aa23dde..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png deleted file mode 100644 index 34a05cc..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png deleted file mode 100644 index f501a59..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png deleted file mode 100644 index 848bdaf..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png deleted file mode 100644 index 0c76bd1..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png deleted file mode 100644 index 87a6914..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png deleted file mode 100644 index c66011f..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png deleted file mode 100644 index 2b6b100..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png deleted file mode 100644 index a9f31a2..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png deleted file mode 100644 index a87cf84..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png deleted file mode 100644 index ffb8fc9..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png deleted file mode 100644 index 0a7d6f4..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png deleted file mode 100644 index bddba1f..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png deleted file mode 100644 index af1ecaf..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png deleted file mode 100644 index 4cc537a..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png deleted file mode 100644 index b93e776..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png deleted file mode 100644 index 9fc5a0a..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png deleted file mode 100644 index b977d7e..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png deleted file mode 100644 index 5818436..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png deleted file mode 100644 index 5769120..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png deleted file mode 100644 index 8d719df..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png deleted file mode 100644 index 106f5aa..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png deleted file mode 100644 index e4a1ecb..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png deleted file mode 100644 index 7e62a92..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png deleted file mode 100644 index e902abb..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png deleted file mode 100644 index 1d2d0a4..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png deleted file mode 100644 index d616484..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png deleted file mode 100644 index 7215d1e..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png deleted file mode 100644 index bf7bd1c..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png deleted file mode 100644 index f6b74cc..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png deleted file mode 100644 index d3fffb6..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png deleted file mode 100644 index a65bcb3..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png deleted file mode 100644 index 23a37b8..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png deleted file mode 100644 index f907e44..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png deleted file mode 100644 index 5b2cbb3..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png deleted file mode 100644 index 7868a25..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png deleted file mode 100644 index 134b669..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png deleted file mode 100644 index c4eff03..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png deleted file mode 100644 index 884ffd6..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png deleted file mode 100644 index f59b7c4..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png deleted file mode 100644 index 44084ad..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png deleted file mode 100644 index 3a1441c..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png deleted file mode 100644 index e770829..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png deleted file mode 100644 index 813f712..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png deleted file mode 100644 index d9cf132..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png deleted file mode 100644 index 52699bf..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png deleted file mode 100644 index 4a05955..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png deleted file mode 100644 index a0a433d..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png deleted file mode 100644 index 1eb8809..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png deleted file mode 100644 index ae8ecbf..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png deleted file mode 100644 index 6ed2490..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png deleted file mode 100644 index fecadd0..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png b/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png deleted file mode 100644 index fd4bbcc..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_word.png b/node_modules/express/node_modules/connect/lib/public/icons/page_word.png deleted file mode 100644 index 834cdfa..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_word.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/icons/page_world.png b/node_modules/express/node_modules/connect/lib/public/icons/page_world.png deleted file mode 100644 index b8895dd..0000000 Binary files a/node_modules/express/node_modules/connect/lib/public/icons/page_world.png and /dev/null differ diff --git a/node_modules/express/node_modules/connect/lib/public/style.css b/node_modules/express/node_modules/connect/lib/public/style.css deleted file mode 100644 index 32b6507..0000000 --- a/node_modules/express/node_modules/connect/lib/public/style.css +++ /dev/null @@ -1,141 +0,0 @@ -body { - margin: 0; - padding: 80px 100px; - font: 13px "Helvetica Neue", "Lucida Grande", "Arial"; - background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9)); - background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9); - background-repeat: no-repeat; - color: #555; - -webkit-font-smoothing: antialiased; -} -h1, h2, h3 { - margin: 0; - font-size: 22px; - color: #343434; -} -h1 em, h2 em { - padding: 0 5px; - font-weight: normal; -} -h1 { - font-size: 60px; -} -h2 { - margin-top: 10px; -} -h3 { - margin: 5px 0 10px 0; - padding-bottom: 5px; - border-bottom: 1px solid #eee; - font-size: 18px; -} -ul { - margin: 0; - padding: 0; -} -ul li { - margin: 5px 0; - padding: 3px 8px; - list-style: none; -} -ul li:hover { - cursor: pointer; - color: #2e2e2e; -} -ul li .path { - padding-left: 5px; - font-weight: bold; -} -ul li .line { - padding-right: 5px; - font-style: italic; -} -ul li:first-child .path { - padding-left: 0; -} -p { - line-height: 1.5; -} -a { - color: #555; - text-decoration: none; -} -a:hover { - color: #303030; -} -#stacktrace { - margin-top: 15px; -} -.directory h1 { - margin-bottom: 15px; - font-size: 18px; -} -ul#files { - width: 100%; - height: 500px; -} -ul#files li { - padding: 0; -} -ul#files li img { - position: absolute; - top: 5px; - left: 5px; -} -ul#files li a { - position: relative; - display: block; - margin: 1px; - width: 30%; - height: 25px; - line-height: 25px; - text-indent: 8px; - float: left; - border: 1px solid transparent; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - overflow: hidden; - text-overflow: ellipsis; -} -ul#files li a.icon { - text-indent: 25px; -} -ul#files li a:focus, -ul#files li a:hover { - outline: none; - background: rgba(255,255,255,0.65); - border: 1px solid #ececec; -} -ul#files li a.highlight { - -webkit-transition: background .4s ease-in-out; - background: #ffff4f; - border-color: #E9DC51; -} -#search { - display: block; - position: fixed; - top: 20px; - right: 20px; - width: 90px; - -webkit-transition: width ease 0.2s, opacity ease 0.4s; - -moz-transition: width ease 0.2s, opacity ease 0.4s; - -webkit-border-radius: 32px; - -moz-border-radius: 32px; - -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); - -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); - -webkit-font-smoothing: antialiased; - text-align: left; - font: 13px "Helvetica Neue", Arial, sans-serif; - padding: 4px 10px; - border: none; - background: transparent; - margin-bottom: 0; - outline: none; - opacity: 0.7; - color: #888; -} -#search:focus { - width: 120px; - opacity: 1.0; -} diff --git a/node_modules/express/node_modules/connect/lib/utils.js b/node_modules/express/node_modules/connect/lib/utils.js deleted file mode 100644 index 35738b8..0000000 --- a/node_modules/express/node_modules/connect/lib/utils.js +++ /dev/null @@ -1,404 +0,0 @@ - -/*! - * Connect - utils - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var http = require('http') - , crypto = require('crypto') - , parse = require('url').parse - , signature = require('cookie-signature') - , nodeVersion = process.versions.node.split('.'); - -// pause is broken in node < 0.10 -exports.brokenPause = parseInt(nodeVersion[0], 10) === 0 - && parseInt(nodeVersion[1], 10) < 10; - -/** - * Return `true` if the request has a body, otherwise return `false`. - * - * @param {IncomingMessage} req - * @return {Boolean} - * @api private - */ - -exports.hasBody = function(req) { - return 'transfer-encoding' in req.headers || 'content-length' in req.headers; -}; - -/** - * Extract the mime type from the given request's - * _Content-Type_ header. - * - * @param {IncomingMessage} req - * @return {String} - * @api private - */ - -exports.mime = function(req) { - var str = req.headers['content-type'] || ''; - return str.split(';')[0]; -}; - -/** - * Generate an `Error` from the given status `code` - * and optional `msg`. - * - * @param {Number} code - * @param {String} msg - * @return {Error} - * @api private - */ - -exports.error = function(code, msg){ - var err = new Error(msg || http.STATUS_CODES[code]); - err.status = code; - return err; -}; - -/** - * Return md5 hash of the given string and optional encoding, - * defaulting to hex. - * - * utils.md5('wahoo'); - * // => "e493298061761236c96b02ea6aa8a2ad" - * - * @param {String} str - * @param {String} encoding - * @return {String} - * @api private - */ - -exports.md5 = function(str, encoding){ - return crypto - .createHash('md5') - .update(str) - .digest(encoding || 'hex'); -}; - -/** - * Merge object b with object a. - * - * var a = { foo: 'bar' } - * , b = { bar: 'baz' }; - * - * utils.merge(a, b); - * // => { foo: 'bar', bar: 'baz' } - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api private - */ - -exports.merge = function(a, b){ - if (a && b) { - for (var key in b) { - a[key] = b[key]; - } - } - return a; -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - - -/** - * Return a unique identifier with the given `len`. - * - * utils.uid(10); - * // => "FDaS435D2z" - * - * @param {Number} len - * @return {String} - * @api private - */ - -exports.uid = function(len) { - return crypto.randomBytes(Math.ceil(len * 3 / 4)) - .toString('base64') - .slice(0, len) - .replace(/\//g, '-') - .replace(/\+/g, '_'); -}; - -/** - * Sign the given `val` with `secret`. - * - * @param {String} val - * @param {String} secret - * @return {String} - * @api private - */ - -exports.sign = function(val, secret){ - console.warn('do not use utils.sign(), use https://github.com/visionmedia/node-cookie-signature') - return val + '.' + crypto - .createHmac('sha256', secret) - .update(val) - .digest('base64') - .replace(/=+$/, ''); -}; - -/** - * Unsign and decode the given `val` with `secret`, - * returning `false` if the signature is invalid. - * - * @param {String} val - * @param {String} secret - * @return {String|Boolean} - * @api private - */ - -exports.unsign = function(val, secret){ - console.warn('do not use utils.unsign(), use https://github.com/visionmedia/node-cookie-signature') - var str = val.slice(0, val.lastIndexOf('.')); - return exports.sign(str, secret) == val - ? str - : false; -}; - -/** - * Parse signed cookies, returning an object - * containing the decoded key/value pairs, - * while removing the signed key from `obj`. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -exports.parseSignedCookies = function(obj, secret){ - var ret = {}; - Object.keys(obj).forEach(function(key){ - var val = obj[key]; - if (0 == val.indexOf('s:')) { - val = signature.unsign(val.slice(2), secret); - if (val) { - ret[key] = val; - delete obj[key]; - } - } - }); - return ret; -}; - -/** - * Parse a signed cookie string, return the decoded value - * - * @param {String} str signed cookie string - * @param {String} secret - * @return {String} decoded value - * @api private - */ - -exports.parseSignedCookie = function(str, secret){ - return 0 == str.indexOf('s:') - ? signature.unsign(str.slice(2), secret) - : str; -}; - -/** - * Parse JSON cookies. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -exports.parseJSONCookies = function(obj){ - Object.keys(obj).forEach(function(key){ - var val = obj[key]; - var res = exports.parseJSONCookie(val); - if (res) obj[key] = res; - }); - return obj; -}; - -/** - * Parse JSON cookie string - * - * @param {String} str - * @return {Object} Parsed object or null if not json cookie - * @api private - */ - -exports.parseJSONCookie = function(str) { - if (0 == str.indexOf('j:')) { - try { - return JSON.parse(str.slice(2)); - } catch (err) { - // no op - } - } -}; - -/** - * Pause `data` and `end` events on the given `obj`. - * Middleware performing async tasks _should_ utilize - * this utility (or similar), to re-emit data once - * the async operation has completed, otherwise these - * events may be lost. Pause is only required for - * node versions less than 10, and is replaced with - * noop's otherwise. - * - * var pause = utils.pause(req); - * fs.readFile(path, function(){ - * next(); - * pause.resume(); - * }); - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -exports.pause = exports.brokenPause - ? require('pause') - : function () { - return { - end: noop, - resume: noop - } - } - -/** - * Strip `Content-*` headers from `res`. - * - * @param {ServerResponse} res - * @api private - */ - -exports.removeContentHeaders = function(res){ - Object.keys(res._headers).forEach(function(field){ - if (0 == field.indexOf('content')) { - res.removeHeader(field); - } - }); -}; - -/** - * Check if `req` is a conditional GET request. - * - * @param {IncomingMessage} req - * @return {Boolean} - * @api private - */ - -exports.conditionalGET = function(req) { - return req.headers['if-modified-since'] - || req.headers['if-none-match']; -}; - -/** - * Respond with 401 "Unauthorized". - * - * @param {ServerResponse} res - * @param {String} realm - * @api private - */ - -exports.unauthorized = function(res, realm) { - res.statusCode = 401; - res.setHeader('WWW-Authenticate', 'Basic realm="' + realm + '"'); - res.end('Unauthorized'); -}; - -/** - * Respond with 304 "Not Modified". - * - * @param {ServerResponse} res - * @param {Object} headers - * @api private - */ - -exports.notModified = function(res) { - exports.removeContentHeaders(res); - res.statusCode = 304; - res.end(); -}; - -/** - * Return an ETag in the form of `"-"` - * from the given `stat`. - * - * @param {Object} stat - * @return {String} - * @api private - */ - -exports.etag = function(stat) { - return '"' + stat.size + '-' + Number(stat.mtime) + '"'; -}; - -/** - * Parse the given Cache-Control `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ - -exports.parseCacheControl = function(str){ - var directives = str.split(',') - , obj = {}; - - for(var i = 0, len = directives.length; i < len; i++) { - var parts = directives[i].split('=') - , key = parts.shift().trim() - , val = parseInt(parts.shift(), 10); - - obj[key] = isNaN(val) ? true : val; - } - - return obj; -}; - -/** - * Parse the `req` url with memoization. - * - * @param {ServerRequest} req - * @return {Object} - * @api private - */ - -exports.parseUrl = function(req){ - var parsed = req._parsedUrl; - if (parsed && parsed.href == req.url) { - return parsed; - } else { - return req._parsedUrl = parse(req.url); - } -}; - -/** - * Parse byte `size` string. - * - * @param {String} size - * @return {Number} - * @api private - */ - -exports.parseBytes = require('bytes'); - -function noop() {} \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/.npmignore b/node_modules/express/node_modules/connect/node_modules/buffer-crc32/.npmignore deleted file mode 100644 index b512c09..0000000 --- a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/.travis.yml b/node_modules/express/node_modules/connect/node_modules/buffer-crc32/.travis.yml deleted file mode 100644 index 7a902e8..0000000 --- a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 -notifications: - email: - recipients: - - brianloveswords@gmail.com \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/README.md b/node_modules/express/node_modules/connect/node_modules/buffer-crc32/README.md deleted file mode 100644 index 4ad5d64..0000000 --- a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# buffer-crc32 - -[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32) - -crc32 that works with binary data and fancy character sets, outputs -buffer, signed or unsigned data and has tests. - -Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix - -# install -``` -npm install buffer-crc32 -``` - -# example -```js -var crc32 = require('buffer-crc32'); -// works with buffers -var buf = Buffer([[0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]) -crc32(buf) // -> - -// has convenience methods for getting signed or unsigned ints -crc32.signed(buf) // -> -1805997238 -crc32.unsigned(buf) // -> 2488970058 - -// will cast to buffer if given a string, so you can -// directly use foreign characters safely -crc32('自動販売機') // -> -``` - -# tests -This was tested against the output of zlib's crc32 method. You can run -the tests with`npm test` (requires tap) diff --git a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/index.js b/node_modules/express/node_modules/connect/node_modules/buffer-crc32/index.js deleted file mode 100644 index ab0e19e..0000000 --- a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/index.js +++ /dev/null @@ -1,84 +0,0 @@ -var Buffer = require('buffer').Buffer; - -var CRC_TABLE = [ - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d -]; - -function bufferizeInt(num) { - var tmp = Buffer(4); - tmp.writeInt32BE(num, 0); - return tmp; -} - -function _crc32(buf) { - if (!Buffer.isBuffer(buf)) - buf = Buffer(buf); - var crc = 0xffffffff; - for (var n = 0; n < buf.length; n++) { - crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8); - } - return (crc ^ 0xffffffff); -} - -function crc32() { - return bufferizeInt(_crc32.apply(null, arguments)); -} -crc32.signed = function () { - return _crc32.apply(null, arguments); -}; -crc32.unsigned = function () { - return crc32.apply(null, arguments).readUInt32BE(0); -}; - -module.exports = crc32; diff --git a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/package.json b/node_modules/express/node_modules/connect/node_modules/buffer-crc32/package.json deleted file mode 100644 index cdcaeb7..0000000 --- a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "author": { - "name": "Brian J. Brennan", - "email": "brianloveswords@gmail.com", - "url": "http://bjb.io" - }, - "name": "buffer-crc32", - "description": "A pure javascript CRC32 algorithm that plays nice with binary data", - "version": "0.1.1", - "homepage": "https://github.com/brianloveswords/buffer-crc32", - "repository": { - "type": "git", - "url": "git://github.com/brianloveswords/buffer-crc32.git" - }, - "main": "index.js", - "scripts": { - "test": "./node_modules/.bin/tap tests/*.test.js" - }, - "dependencies": {}, - "devDependencies": { - "tap": "~0.2.5" - }, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "readme": "# buffer-crc32\n\n[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)\n\ncrc32 that works with binary data and fancy character sets, outputs\nbuffer, signed or unsigned data and has tests.\n\nDerived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix\n\n# install\n```\nnpm install buffer-crc32\n```\n\n# example\n```js\nvar crc32 = require('buffer-crc32');\n// works with buffers\nvar buf = Buffer([[0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])\ncrc32(buf) // -> \n\n// has convenience methods for getting signed or unsigned ints\ncrc32.signed(buf) // -> -1805997238\ncrc32.unsigned(buf) // -> 2488970058\n\n// will cast to buffer if given a string, so you can\n// directly use foreign characters safely\ncrc32('自動販売機') // -> \n```\n\n# tests\nThis was tested against the output of zlib's crc32 method. You can run\nthe tests with`npm test` (requires tap)\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/brianloveswords/buffer-crc32/issues" - }, - "_id": "buffer-crc32@0.1.1", - "_from": "buffer-crc32@0.1.1" -} diff --git a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/tests/crc.test.js b/node_modules/express/node_modules/connect/node_modules/buffer-crc32/tests/crc.test.js deleted file mode 100644 index d4767e3..0000000 --- a/node_modules/express/node_modules/connect/node_modules/buffer-crc32/tests/crc.test.js +++ /dev/null @@ -1,52 +0,0 @@ -var crc32 = require('..'); -var test = require('tap').test; - -test('simple crc32 is no problem', function (t) { - var input = Buffer('hey sup bros'); - var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); - t.same(crc32(input), expected); - t.end(); -}); - -test('another simple one', function (t) { - var input = Buffer('IEND'); - var expected = Buffer([0xae, 0x42, 0x60, 0x82]); - t.same(crc32(input), expected); - t.end(); -}); - -test('slightly more complex', function (t) { - var input = Buffer([0x00, 0x00, 0x00]); - var expected = Buffer([0xff, 0x41, 0xd9, 0x12]); - t.same(crc32(input), expected); - t.end(); -}); - -test('complex crc32 gets calculated like a champ', function (t) { - var input = Buffer('शीर्षक'); - var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); - t.same(crc32(input), expected); - t.end(); -}); - -test('casts to buffer if necessary', function (t) { - var input = 'शीर्षक'; - var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); - t.same(crc32(input), expected); - t.end(); -}); - -test('can do unsigned', function (t) { - var input = 'ham sandwich'; - var expected = -1891873021; - t.same(crc32.signed(input), expected); - t.end(); -}); - -test('can do signed', function (t) { - var input = 'bear sandwich'; - var expected = 3711466352; - t.same(crc32.unsigned(input), expected); - t.end(); -}); - diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore b/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore deleted file mode 100644 index 9daeafb..0000000 --- a/node_modules/express/node_modules/connect/node_modules/bytes/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/History.md b/node_modules/express/node_modules/connect/node_modules/bytes/History.md deleted file mode 100644 index 1332808..0000000 --- a/node_modules/express/node_modules/connect/node_modules/bytes/History.md +++ /dev/null @@ -1,10 +0,0 @@ - -0.2.0 / 2012-10-28 -================== - - * bytes(200).should.eql('200b') - -0.1.0 / 2012-07-04 -================== - - * add bytes to string conversion [yields] diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/Makefile b/node_modules/express/node_modules/connect/node_modules/bytes/Makefile deleted file mode 100644 index 8e8640f..0000000 --- a/node_modules/express/node_modules/connect/node_modules/bytes/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --reporter spec \ - --require should - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md b/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md deleted file mode 100644 index 9325d5b..0000000 --- a/node_modules/express/node_modules/connect/node_modules/bytes/Readme.md +++ /dev/null @@ -1,51 +0,0 @@ -# node-bytes - - Byte string parser / formatter. - -## Example: - -```js -bytes('1kb') -// => 1024 - -bytes('2mb') -// => 2097152 - -bytes('1gb') -// => 1073741824 - -bytes(1073741824) -// => 1gb -``` - -## Installation - -``` -$ npm install bytes -$ component install visionmedia/bytes.js -``` - -## License - -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/component.json b/node_modules/express/node_modules/connect/node_modules/bytes/component.json deleted file mode 100644 index 76a6057..0000000 --- a/node_modules/express/node_modules/connect/node_modules/bytes/component.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "bytes", - "description": "byte size string parser / serializer", - "keywords": ["bytes", "utility"], - "version": "0.1.0", - "scripts": ["index.js"] -} diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/index.js b/node_modules/express/node_modules/connect/node_modules/bytes/index.js deleted file mode 100644 index 70b2e01..0000000 --- a/node_modules/express/node_modules/connect/node_modules/bytes/index.js +++ /dev/null @@ -1,39 +0,0 @@ - -/** - * Parse byte `size` string. - * - * @param {String} size - * @return {Number} - * @api public - */ - -module.exports = function(size) { - if ('number' == typeof size) return convert(size); - var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/) - , n = parseFloat(parts[1]) - , type = parts[2]; - - var map = { - kb: 1 << 10 - , mb: 1 << 20 - , gb: 1 << 30 - }; - - return map[type] * n; -}; - -/** - * convert bytes into string. - * - * @param {Number} b - bytes to convert - * @return {String} - * @api public - */ - -function convert (b) { - var gb = 1 << 30, mb = 1 << 20, kb = 1 << 10; - if (b >= gb) return (Math.round(b / gb * 100) / 100) + 'gb'; - if (b >= mb) return (Math.round(b / mb * 100) / 100) + 'mb'; - if (b >= kb) return (Math.round(b / kb * 100) / 100) + 'kb'; - return b + 'b'; -} diff --git a/node_modules/express/node_modules/connect/node_modules/bytes/package.json b/node_modules/express/node_modules/connect/node_modules/bytes/package.json deleted file mode 100644 index 0db9bc9..0000000 --- a/node_modules/express/node_modules/connect/node_modules/bytes/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "bytes", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "description": "byte size string parser / serializer", - "version": "0.2.0", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "readme": "# node-bytes\n\n Byte string parser / formatter.\n\n## Example:\n\n```js\nbytes('1kb')\n// => 1024\n\nbytes('2mb')\n// => 2097152\n\nbytes('1gb')\n// => 1073741824\n\nbytes(1073741824)\n// => 1gb\n```\n\n## Installation\n\n```\n$ npm install bytes\n$ component install visionmedia/bytes.js\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "_id": "bytes@0.2.0", - "_from": "bytes@0.2.0" -} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore b/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore deleted file mode 100644 index 4fbabb3..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -/test/tmp/ -*.upload -*.un~ -*.http diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml b/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml deleted file mode 100644 index f1d0f13..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/Makefile b/node_modules/express/node_modules/connect/node_modules/formidable/Makefile deleted file mode 100644 index 8945872..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -build: npm test - -npm: - npm install . - -clean: - rm test/tmp/* - -.PHONY: test clean build diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md b/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md deleted file mode 100644 index a5ca104..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md +++ /dev/null @@ -1,311 +0,0 @@ -# Formidable - -[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable) - -## Purpose - -A node.js module for parsing form data, especially file uploads. - -## Current status - -This module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading -and encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from -a large variety of clients and is considered production-ready. - -## Features - -* Fast (~500mb/sec), non-buffering multipart parser -* Automatically writing file uploads to disk -* Low memory footprint -* Graceful error handling -* Very high test coverage - -## Changelog - -### v1.0.9 - -* Emit progress when content length header parsed (Tim Koschützki) -* Fix Readme syntax due to GitHub changes (goob) -* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara) - -### v1.0.8 - -* Strip potentially unsafe characters when using `keepExtensions: true`. -* Switch to utest / urun for testing -* Add travis build - -### v1.0.7 - -* Remove file from package that was causing problems when installing on windows. (#102) -* Fix typos in Readme (Jason Davies). - -### v1.0.6 - -* Do not default to the default to the field name for file uploads where - filename="". - -### v1.0.5 - -* Support filename="" in multipart parts -* Explain unexpected end() errors in parser better - -**Note:** Starting with this version, formidable emits 'file' events for empty -file input fields. Previously those were incorrectly emitted as regular file -input fields with value = "". - -### v1.0.4 - -* Detect a good default tmp directory regardless of platform. (#88) - -### v1.0.3 - -* Fix problems with utf8 characters (#84) / semicolons in filenames (#58) -* Small performance improvements -* New test suite and fixture system - -### v1.0.2 - -* Exclude node\_modules folder from git -* Implement new `'aborted'` event -* Fix files in example folder to work with recent node versions -* Make gently a devDependency - -[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2) - -### v1.0.1 - -* Fix package.json to refer to proper main directory. (#68, Dean Landolt) - -[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1) - -### v1.0.0 - -* Add support for multipart boundaries that are quoted strings. (Jeff Craig) - -This marks the beginning of development on version 2.0 which will include -several architectural improvements. - -[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0) - -### v0.9.11 - -* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki) -* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class - -**Important:** The old property names of the File class will be removed in a -future release. - -[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11) - -### Older releases - -These releases were done before starting to maintain the above Changelog: - -* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10) -* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9) -* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8) -* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7) -* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6) -* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5) -* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4) -* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3) -* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2) -* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0) - -## Installation - -Via [npm](http://github.com/isaacs/npm): - - npm install formidable@latest - -Manually: - - git clone git://github.com/felixge/node-formidable.git formidable - vim my.js - # var formidable = require('./formidable'); - -Note: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library. - -## Example - -Parse an incoming file upload. - - var formidable = require('formidable'), - http = require('http'), - - util = require('util'); - - http.createServer(function(req, res) { - if (req.url == '/upload' && req.method.toLowerCase() == 'post') { - // parse a file upload - var form = new formidable.IncomingForm(); - form.parse(req, function(err, fields, files) { - res.writeHead(200, {'content-type': 'text/plain'}); - res.write('received upload:\n\n'); - res.end(util.inspect({fields: fields, files: files})); - }); - return; - } - - // show a file upload form - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - }).listen(80); - -## API - -### formidable.IncomingForm - -__new formidable.IncomingForm()__ - -Creates a new incoming form. - -__incomingForm.encoding = 'utf-8'__ - -The encoding to use for incoming form fields. - -__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__ - -The directory for placing file uploads in. You can move them later on using -`fs.rename()`. The default directory is picked at module load time depending on -the first existing directory from those listed above. - -__incomingForm.keepExtensions = false__ - -If you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`. - -__incomingForm.type__ - -Either 'multipart' or 'urlencoded' depending on the incoming request. - -__incomingForm.maxFieldsSize = 2 * 1024 * 1024__ - -Limits the amount of memory a field (not file) can allocate in bytes. -If this value is exceeded, an `'error'` event is emitted. The default -size is 2MB. - -__incomingForm.hash = false__ - -If you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`. - -__incomingForm.bytesReceived__ - -The amount of bytes received for this form so far. - -__incomingForm.bytesExpected__ - -The expected number of bytes in this form. - -__incomingForm.parse(request, [cb])__ - -Parses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback: - - incomingForm.parse(req, function(err, fields, files) { - // ... - }); - -__incomingForm.onPart(part)__ - -You may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing. - - incomingForm.onPart = function(part) { - part.addListener('data', function() { - // ... - }); - } - -If you want to use formidable to only handle certain parts for you, you can do so: - - incomingForm.onPart = function(part) { - if (!part.filename) { - // let formidable handle all non-file parts - incomingForm.handlePart(part); - } - } - -Check the code in this method for further inspiration. - -__Event: 'progress' (bytesReceived, bytesExpected)__ - -Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar. - -__Event: 'field' (name, value)__ - -Emitted whenever a field / value pair has been received. - -__Event: 'fileBegin' (name, file)__ - -Emitted whenever a new file is detected in the upload stream. Use this even if -you want to stream the file to somewhere else while buffering the upload on -the file system. - -__Event: 'file' (name, file)__ - -Emitted whenever a field / file pair has been received. `file` is an instance of `File`. - -__Event: 'error' (err)__ - -Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events. - -__Event: 'aborted'__ - -Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core). - -__Event: 'end' ()__ - -Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response. - -### formidable.File - -__file.size = 0__ - -The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet. - -__file.path = null__ - -The path this file is being written to. You can modify this in the `'fileBegin'` event in -case you are unhappy with the way formidable generates a temporary path for your files. - -__file.name = null__ - -The name this file had according to the uploading client. - -__file.type = null__ - -The mime type of this file, according to the uploading client. - -__file.lastModifiedDate = null__ - -A date object (or `null`) containing the time this file was last written to. Mostly -here for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/). - -__file.hash = null__ - -If hash calculation was set, you can read the hex digest out of this var. - -## License - -Formidable is licensed under the MIT license. - -## Ports - -* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable - -## Credits - -* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/TODO b/node_modules/express/node_modules/connect/node_modules/formidable/TODO deleted file mode 100644 index e1107f2..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/TODO +++ /dev/null @@ -1,3 +0,0 @@ -- Better bufferMaxSize handling approach -- Add tests for JSON parser pull request and merge it -- Implement QuerystringParser the same way as MultipartParser diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js deleted file mode 100644 index bff41f1..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js +++ /dev/null @@ -1,70 +0,0 @@ -require('../test/common'); -var multipartParser = require('../lib/multipart_parser'), - MultipartParser = multipartParser.MultipartParser, - parser = new MultipartParser(), - Buffer = require('buffer').Buffer, - boundary = '-----------------------------168072824752491622650073', - mb = 100, - buffer = createMultipartBuffer(boundary, mb * 1024 * 1024), - callbacks = - { partBegin: -1, - partEnd: -1, - headerField: -1, - headerValue: -1, - partData: -1, - end: -1, - }; - - -parser.initWithBoundary(boundary); -parser.onHeaderField = function() { - callbacks.headerField++; -}; - -parser.onHeaderValue = function() { - callbacks.headerValue++; -}; - -parser.onPartBegin = function() { - callbacks.partBegin++; -}; - -parser.onPartData = function() { - callbacks.partData++; -}; - -parser.onPartEnd = function() { - callbacks.partEnd++; -}; - -parser.onEnd = function() { - callbacks.end++; -}; - -var start = +new Date(), - nparsed = parser.write(buffer), - duration = +new Date - start, - mbPerSec = (mb / (duration / 1000)).toFixed(2); - -console.log(mbPerSec+' mb/sec'); - -assert.equal(nparsed, buffer.length); - -function createMultipartBuffer(boundary, size) { - var head = - '--'+boundary+'\r\n' - + 'content-disposition: form-data; name="field1"\r\n' - + '\r\n' - , tail = '\r\n--'+boundary+'--\r\n' - , buffer = new Buffer(size); - - buffer.write(head, 'ascii', 0); - buffer.write(tail, 'ascii', buffer.length - tail.length); - return buffer; -} - -process.on('exit', function() { - for (var k in callbacks) { - assert.equal(0, callbacks[k], k+' count off by '+callbacks[k]); - } -}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js deleted file mode 100644 index f6c15a6..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/example/post.js +++ /dev/null @@ -1,43 +0,0 @@ -require('../test/common'); -var http = require('http'), - util = require('util'), - formidable = require('formidable'), - server; - -server = http.createServer(function(req, res) { - if (req.url == '/') { - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - } else if (req.url == '/post') { - var form = new formidable.IncomingForm(), - fields = []; - - form - .on('error', function(err) { - res.writeHead(200, {'content-type': 'text/plain'}); - res.end('error:\n\n'+util.inspect(err)); - }) - .on('field', function(field, value) { - console.log(field, value); - fields.push([field, value]); - }) - .on('end', function() { - console.log('-> post done'); - res.writeHead(200, {'content-type': 'text/plain'}); - res.end('received fields:\n\n '+util.inspect(fields)); - }); - form.parse(req); - } else { - res.writeHead(404, {'content-type': 'text/plain'}); - res.end('404'); - } -}); -server.listen(TEST_PORT); - -console.log('listening on http://localhost:'+TEST_PORT+'/'); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js deleted file mode 100644 index 050cdd9..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/example/upload.js +++ /dev/null @@ -1,48 +0,0 @@ -require('../test/common'); -var http = require('http'), - util = require('util'), - formidable = require('formidable'), - server; - -server = http.createServer(function(req, res) { - if (req.url == '/') { - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - } else if (req.url == '/upload') { - var form = new formidable.IncomingForm(), - files = [], - fields = []; - - form.uploadDir = TEST_TMP; - - form - .on('field', function(field, value) { - console.log(field, value); - fields.push([field, value]); - }) - .on('file', function(field, file) { - console.log(field, file); - files.push([field, file]); - }) - .on('end', function() { - console.log('-> upload done'); - res.writeHead(200, {'content-type': 'text/plain'}); - res.write('received fields:\n\n '+util.inspect(fields)); - res.write('\n\n'); - res.end('received files:\n\n '+util.inspect(files)); - }); - form.parse(req); - } else { - res.writeHead(404, {'content-type': 'text/plain'}); - res.end('404'); - } -}); -server.listen(TEST_PORT); - -console.log('listening on http://localhost:'+TEST_PORT+'/'); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/index.js deleted file mode 100644 index be41032..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/formidable'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js deleted file mode 100644 index dad8d5f..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/file.js +++ /dev/null @@ -1,73 +0,0 @@ -if (global.GENTLY) require = GENTLY.hijack(require); - -var util = require('./util'), - WriteStream = require('fs').WriteStream, - EventEmitter = require('events').EventEmitter, - crypto = require('crypto'); - -function File(properties) { - EventEmitter.call(this); - - this.size = 0; - this.path = null; - this.name = null; - this.type = null; - this.hash = null; - this.lastModifiedDate = null; - - this._writeStream = null; - - for (var key in properties) { - this[key] = properties[key]; - } - - if(typeof this.hash === 'string') { - this.hash = crypto.createHash(properties.hash); - } - - this._backwardsCompatibility(); -} -module.exports = File; -util.inherits(File, EventEmitter); - -// @todo Next release: Show error messages when accessing these -File.prototype._backwardsCompatibility = function() { - var self = this; - this.__defineGetter__('length', function() { - return self.size; - }); - this.__defineGetter__('filename', function() { - return self.name; - }); - this.__defineGetter__('mime', function() { - return self.type; - }); -}; - -File.prototype.open = function() { - this._writeStream = new WriteStream(this.path); -}; - -File.prototype.write = function(buffer, cb) { - var self = this; - this._writeStream.write(buffer, function() { - if(self.hash) { - self.hash.update(buffer); - } - self.lastModifiedDate = new Date(); - self.size += buffer.length; - self.emit('progress', self.size); - cb(); - }); -}; - -File.prototype.end = function(cb) { - var self = this; - this._writeStream.end(function() { - if(self.hash) { - self.hash = self.hash.digest('hex'); - } - self.emit('end'); - cb(); - }); -}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js deleted file mode 100644 index 060eac2..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js +++ /dev/null @@ -1,384 +0,0 @@ -if (global.GENTLY) require = GENTLY.hijack(require); - -var fs = require('fs'); -var util = require('./util'), - path = require('path'), - File = require('./file'), - MultipartParser = require('./multipart_parser').MultipartParser, - QuerystringParser = require('./querystring_parser').QuerystringParser, - StringDecoder = require('string_decoder').StringDecoder, - EventEmitter = require('events').EventEmitter, - Stream = require('stream').Stream; - -function IncomingForm(opts) { - if (!(this instanceof IncomingForm)) return new IncomingForm; - EventEmitter.call(this); - - opts=opts||{}; - - this.error = null; - this.ended = false; - - this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024; - this.keepExtensions = opts.keepExtensions || false; - this.uploadDir = opts.uploadDir || IncomingForm.UPLOAD_DIR; - this.encoding = opts.encoding || 'utf-8'; - this.headers = null; - this.type = null; - this.hash = false; - - this.bytesReceived = null; - this.bytesExpected = null; - - this._parser = null; - this._flushing = 0; - this._fieldsSize = 0; -}; -util.inherits(IncomingForm, EventEmitter); -exports.IncomingForm = IncomingForm; - -IncomingForm.UPLOAD_DIR = (function() { - var dirs = [process.env.TMP, '/tmp', process.cwd()]; - for (var i = 0; i < dirs.length; i++) { - var dir = dirs[i]; - var isDirectory = false; - - try { - isDirectory = fs.statSync(dir).isDirectory(); - } catch (e) {} - - if (isDirectory) return dir; - } -})(); - -IncomingForm.prototype.parse = function(req, cb) { - this.pause = function() { - try { - req.pause(); - } catch (err) { - // the stream was destroyed - if (!this.ended) { - // before it was completed, crash & burn - this._error(err); - } - return false; - } - return true; - }; - - this.resume = function() { - try { - req.resume(); - } catch (err) { - // the stream was destroyed - if (!this.ended) { - // before it was completed, crash & burn - this._error(err); - } - return false; - } - - return true; - }; - - this.writeHeaders(req.headers); - - var self = this; - req - .on('error', function(err) { - self._error(err); - }) - .on('aborted', function() { - self.emit('aborted'); - }) - .on('data', function(buffer) { - self.write(buffer); - }) - .on('end', function() { - if (self.error) { - return; - } - - var err = self._parser.end(); - if (err) { - self._error(err); - } - }); - - if (cb) { - var fields = {}, files = {}; - this - .on('field', function(name, value) { - fields[name] = value; - }) - .on('file', function(name, file) { - files[name] = file; - }) - .on('error', function(err) { - cb(err, fields, files); - }) - .on('end', function() { - cb(null, fields, files); - }); - } - - return this; -}; - -IncomingForm.prototype.writeHeaders = function(headers) { - this.headers = headers; - this._parseContentLength(); - this._parseContentType(); -}; - -IncomingForm.prototype.write = function(buffer) { - if (!this._parser) { - this._error(new Error('unintialized parser')); - return; - } - - this.bytesReceived += buffer.length; - this.emit('progress', this.bytesReceived, this.bytesExpected); - - var bytesParsed = this._parser.write(buffer); - if (bytesParsed !== buffer.length) { - this._error(new Error('parser error, '+bytesParsed+' of '+buffer.length+' bytes parsed')); - } - - return bytesParsed; -}; - -IncomingForm.prototype.pause = function() { - // this does nothing, unless overwritten in IncomingForm.parse - return false; -}; - -IncomingForm.prototype.resume = function() { - // this does nothing, unless overwritten in IncomingForm.parse - return false; -}; - -IncomingForm.prototype.onPart = function(part) { - // this method can be overwritten by the user - this.handlePart(part); -}; - -IncomingForm.prototype.handlePart = function(part) { - var self = this; - - if (part.filename === undefined) { - var value = '' - , decoder = new StringDecoder(this.encoding); - - part.on('data', function(buffer) { - self._fieldsSize += buffer.length; - if (self._fieldsSize > self.maxFieldsSize) { - self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data')); - return; - } - value += decoder.write(buffer); - }); - - part.on('end', function() { - self.emit('field', part.name, value); - }); - return; - } - - this._flushing++; - - var file = new File({ - path: this._uploadPath(part.filename), - name: part.filename, - type: part.mime, - hash: self.hash - }); - - this.emit('fileBegin', part.name, file); - - file.open(); - - part.on('data', function(buffer) { - self.pause(); - file.write(buffer, function() { - self.resume(); - }); - }); - - part.on('end', function() { - file.end(function() { - self._flushing--; - self.emit('file', part.name, file); - self._maybeEnd(); - }); - }); -}; - -IncomingForm.prototype._parseContentType = function() { - if (!this.headers['content-type']) { - this._error(new Error('bad content-type header, no content-type')); - return; - } - - if (this.headers['content-type'].match(/urlencoded/i)) { - this._initUrlencoded(); - return; - } - - if (this.headers['content-type'].match(/multipart/i)) { - var m; - if (m = this.headers['content-type'].match(/boundary=(?:"([^"]+)"|([^;]+))/i)) { - this._initMultipart(m[1] || m[2]); - } else { - this._error(new Error('bad content-type header, no multipart boundary')); - } - return; - } - - this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type'])); -}; - -IncomingForm.prototype._error = function(err) { - if (this.error) { - return; - } - - this.error = err; - this.pause(); - this.emit('error', err); -}; - -IncomingForm.prototype._parseContentLength = function() { - if (this.headers['content-length']) { - this.bytesReceived = 0; - this.bytesExpected = parseInt(this.headers['content-length'], 10); - this.emit('progress', this.bytesReceived, this.bytesExpected); - } -}; - -IncomingForm.prototype._newParser = function() { - return new MultipartParser(); -}; - -IncomingForm.prototype._initMultipart = function(boundary) { - this.type = 'multipart'; - - var parser = new MultipartParser(), - self = this, - headerField, - headerValue, - part; - - parser.initWithBoundary(boundary); - - parser.onPartBegin = function() { - part = new Stream(); - part.readable = true; - part.headers = {}; - part.name = null; - part.filename = null; - part.mime = null; - headerField = ''; - headerValue = ''; - }; - - parser.onHeaderField = function(b, start, end) { - headerField += b.toString(self.encoding, start, end); - }; - - parser.onHeaderValue = function(b, start, end) { - headerValue += b.toString(self.encoding, start, end); - }; - - parser.onHeaderEnd = function() { - headerField = headerField.toLowerCase(); - part.headers[headerField] = headerValue; - - var m; - if (headerField == 'content-disposition') { - if (m = headerValue.match(/name="([^"]+)"/i)) { - part.name = m[1]; - } - - part.filename = self._fileName(headerValue); - } else if (headerField == 'content-type') { - part.mime = headerValue; - } - - headerField = ''; - headerValue = ''; - }; - - parser.onHeadersEnd = function() { - self.onPart(part); - }; - - parser.onPartData = function(b, start, end) { - part.emit('data', b.slice(start, end)); - }; - - parser.onPartEnd = function() { - part.emit('end'); - }; - - parser.onEnd = function() { - self.ended = true; - self._maybeEnd(); - }; - - this._parser = parser; -}; - -IncomingForm.prototype._fileName = function(headerValue) { - var m = headerValue.match(/filename="(.*?)"($|; )/i) - if (!m) return; - - var filename = m[1].substr(m[1].lastIndexOf('\\') + 1); - filename = filename.replace(/%22/g, '"'); - filename = filename.replace(/&#([\d]{4});/g, function(m, code) { - return String.fromCharCode(code); - }); - return filename; -}; - -IncomingForm.prototype._initUrlencoded = function() { - this.type = 'urlencoded'; - - var parser = new QuerystringParser() - , self = this; - - parser.onField = function(key, val) { - self.emit('field', key, val); - }; - - parser.onEnd = function() { - self.ended = true; - self._maybeEnd(); - }; - - this._parser = parser; -}; - -IncomingForm.prototype._uploadPath = function(filename) { - var name = ''; - for (var i = 0; i < 32; i++) { - name += Math.floor(Math.random() * 16).toString(16); - } - - if (this.keepExtensions) { - var ext = path.extname(filename); - ext = ext.replace(/(\.[a-z0-9]+).*/, '$1') - - name += ext; - } - - return path.join(this.uploadDir, name); -}; - -IncomingForm.prototype._maybeEnd = function() { - if (!this.ended || this._flushing) { - return; - } - - this.emit('end'); -}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js deleted file mode 100644 index 7a6e3e1..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/index.js +++ /dev/null @@ -1,3 +0,0 @@ -var IncomingForm = require('./incoming_form').IncomingForm; -IncomingForm.IncomingForm = IncomingForm; -module.exports = IncomingForm; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js deleted file mode 100644 index 9ca567c..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/multipart_parser.js +++ /dev/null @@ -1,312 +0,0 @@ -var Buffer = require('buffer').Buffer, - s = 0, - S = - { PARSER_UNINITIALIZED: s++, - START: s++, - START_BOUNDARY: s++, - HEADER_FIELD_START: s++, - HEADER_FIELD: s++, - HEADER_VALUE_START: s++, - HEADER_VALUE: s++, - HEADER_VALUE_ALMOST_DONE: s++, - HEADERS_ALMOST_DONE: s++, - PART_DATA_START: s++, - PART_DATA: s++, - PART_END: s++, - END: s++, - }, - - f = 1, - F = - { PART_BOUNDARY: f, - LAST_BOUNDARY: f *= 2, - }, - - LF = 10, - CR = 13, - SPACE = 32, - HYPHEN = 45, - COLON = 58, - A = 97, - Z = 122, - - lower = function(c) { - return c | 0x20; - }; - -for (var s in S) { - exports[s] = S[s]; -} - -function MultipartParser() { - this.boundary = null; - this.boundaryChars = null; - this.lookbehind = null; - this.state = S.PARSER_UNINITIALIZED; - - this.index = null; - this.flags = 0; -}; -exports.MultipartParser = MultipartParser; - -MultipartParser.stateToString = function(stateNumber) { - for (var state in S) { - var number = S[state]; - if (number === stateNumber) return state; - } -}; - -MultipartParser.prototype.initWithBoundary = function(str) { - this.boundary = new Buffer(str.length+4); - this.boundary.write('\r\n--', 'ascii', 0); - this.boundary.write(str, 'ascii', 4); - this.lookbehind = new Buffer(this.boundary.length+8); - this.state = S.START; - - this.boundaryChars = {}; - for (var i = 0; i < this.boundary.length; i++) { - this.boundaryChars[this.boundary[i]] = true; - } -}; - -MultipartParser.prototype.write = function(buffer) { - var self = this, - i = 0, - len = buffer.length, - prevIndex = this.index, - index = this.index, - state = this.state, - flags = this.flags, - lookbehind = this.lookbehind, - boundary = this.boundary, - boundaryChars = this.boundaryChars, - boundaryLength = this.boundary.length, - boundaryEnd = boundaryLength - 1, - bufferLength = buffer.length, - c, - cl, - - mark = function(name) { - self[name+'Mark'] = i; - }, - clear = function(name) { - delete self[name+'Mark']; - }, - callback = function(name, buffer, start, end) { - if (start !== undefined && start === end) { - return; - } - - var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1); - if (callbackSymbol in self) { - self[callbackSymbol](buffer, start, end); - } - }, - dataCallback = function(name, clear) { - var markSymbol = name+'Mark'; - if (!(markSymbol in self)) { - return; - } - - if (!clear) { - callback(name, buffer, self[markSymbol], buffer.length); - self[markSymbol] = 0; - } else { - callback(name, buffer, self[markSymbol], i); - delete self[markSymbol]; - } - }; - - for (i = 0; i < len; i++) { - c = buffer[i]; - switch (state) { - case S.PARSER_UNINITIALIZED: - return i; - case S.START: - index = 0; - state = S.START_BOUNDARY; - case S.START_BOUNDARY: - if (index == boundary.length - 2) { - if (c != CR) { - return i; - } - index++; - break; - } else if (index - 1 == boundary.length - 2) { - if (c != LF) { - return i; - } - index = 0; - callback('partBegin'); - state = S.HEADER_FIELD_START; - break; - } - - if (c != boundary[index+2]) { - return i; - } - index++; - break; - case S.HEADER_FIELD_START: - state = S.HEADER_FIELD; - mark('headerField'); - index = 0; - case S.HEADER_FIELD: - if (c == CR) { - clear('headerField'); - state = S.HEADERS_ALMOST_DONE; - break; - } - - index++; - if (c == HYPHEN) { - break; - } - - if (c == COLON) { - if (index == 1) { - // empty header field - return i; - } - dataCallback('headerField', true); - state = S.HEADER_VALUE_START; - break; - } - - cl = lower(c); - if (cl < A || cl > Z) { - return i; - } - break; - case S.HEADER_VALUE_START: - if (c == SPACE) { - break; - } - - mark('headerValue'); - state = S.HEADER_VALUE; - case S.HEADER_VALUE: - if (c == CR) { - dataCallback('headerValue', true); - callback('headerEnd'); - state = S.HEADER_VALUE_ALMOST_DONE; - } - break; - case S.HEADER_VALUE_ALMOST_DONE: - if (c != LF) { - return i; - } - state = S.HEADER_FIELD_START; - break; - case S.HEADERS_ALMOST_DONE: - if (c != LF) { - return i; - } - - callback('headersEnd'); - state = S.PART_DATA_START; - break; - case S.PART_DATA_START: - state = S.PART_DATA - mark('partData'); - case S.PART_DATA: - prevIndex = index; - - if (index == 0) { - // boyer-moore derrived algorithm to safely skip non-boundary data - i += boundaryEnd; - while (i < bufferLength && !(buffer[i] in boundaryChars)) { - i += boundaryLength; - } - i -= boundaryEnd; - c = buffer[i]; - } - - if (index < boundary.length) { - if (boundary[index] == c) { - if (index == 0) { - dataCallback('partData', true); - } - index++; - } else { - index = 0; - } - } else if (index == boundary.length) { - index++; - if (c == CR) { - // CR = part boundary - flags |= F.PART_BOUNDARY; - } else if (c == HYPHEN) { - // HYPHEN = end boundary - flags |= F.LAST_BOUNDARY; - } else { - index = 0; - } - } else if (index - 1 == boundary.length) { - if (flags & F.PART_BOUNDARY) { - index = 0; - if (c == LF) { - // unset the PART_BOUNDARY flag - flags &= ~F.PART_BOUNDARY; - callback('partEnd'); - callback('partBegin'); - state = S.HEADER_FIELD_START; - break; - } - } else if (flags & F.LAST_BOUNDARY) { - if (c == HYPHEN) { - callback('partEnd'); - callback('end'); - state = S.END; - } else { - index = 0; - } - } else { - index = 0; - } - } - - if (index > 0) { - // when matching a possible boundary, keep a lookbehind reference - // in case it turns out to be a false lead - lookbehind[index-1] = c; - } else if (prevIndex > 0) { - // if our boundary turned out to be rubbish, the captured lookbehind - // belongs to partData - callback('partData', lookbehind, 0, prevIndex); - prevIndex = 0; - mark('partData'); - - // reconsider the current character even so it interrupted the sequence - // it could be the beginning of a new sequence - i--; - } - - break; - case S.END: - break; - default: - return i; - } - } - - dataCallback('headerField'); - dataCallback('headerValue'); - dataCallback('partData'); - - this.index = index; - this.state = state; - this.flags = flags; - - return len; -}; - -MultipartParser.prototype.end = function() { - if (this.state != S.END) { - return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain()); - } -}; - -MultipartParser.prototype.explain = function() { - return 'state = ' + MultipartParser.stateToString(this.state); -}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js deleted file mode 100644 index 63f109e..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/querystring_parser.js +++ /dev/null @@ -1,25 +0,0 @@ -if (global.GENTLY) require = GENTLY.hijack(require); - -// This is a buffering parser, not quite as nice as the multipart one. -// If I find time I'll rewrite this to be fully streaming as well -var querystring = require('querystring'); - -function QuerystringParser() { - this.buffer = ''; -}; -exports.QuerystringParser = QuerystringParser; - -QuerystringParser.prototype.write = function(buffer) { - this.buffer += buffer.toString('ascii'); - return buffer.length; -}; - -QuerystringParser.prototype.end = function() { - var fields = querystring.parse(this.buffer); - for (var field in fields) { - this.onField(field, fields[field]); - } - this.buffer = ''; - - this.onEnd(); -}; \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js b/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js deleted file mode 100644 index e9493e9..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/lib/util.js +++ /dev/null @@ -1,6 +0,0 @@ -// Backwards compatibility ... -try { - module.exports = require('util'); -} catch (e) { - module.exports = require('sys'); -} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile deleted file mode 100644 index 01f7140..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -test: - @find test/simple/test-*.js | xargs -n 1 -t node - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md deleted file mode 100644 index f8f0c66..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md +++ /dev/null @@ -1,167 +0,0 @@ -# Gently - -## Purpose - -A node.js module that helps with stubbing and behavior verification. It allows you to test the most remote and nested corners of your code while keeping being fully unobtrusive. - -## Features - -* Overwrite and stub individual object functions -* Verify that all expected calls have been made in the expected order -* Restore stubbed functions to their original behavior -* Detect object / class names from obj.constructor.name and obj.toString() -* Hijack any required module function or class constructor - -## Installation - -Via [npm](http://github.com/isaacs/npm): - - npm install gently@latest - -## Example - -Make sure your dog is working properly: - - function Dog() {} - - Dog.prototype.seeCat = function() { - this.bark('whuf, whuf'); - this.run(); - } - - Dog.prototype.bark = function(bark) { - require('sys').puts(bark); - } - - var gently = new (require('gently')) - , assert = require('assert') - , dog = new Dog(); - - gently.expect(dog, 'bark', function(bark) { - assert.equal(bark, 'whuf, whuf'); - }); - gently.expect(dog, 'run'); - - dog.seeCat(); - -You can also easily test event emitters with this, for example a simple sequence of 2 events emitted by `fs.WriteStream`: - - var gently = new (require('gently')) - , stream = new (require('fs').WriteStream)('my_file.txt'); - - gently.expect(stream, 'emit', function(event) { - assert.equal(event, 'open'); - }); - - gently.expect(stream, 'emit', function(event) { - assert.equal(event, 'drain'); - }); - -For a full read world example, check out this test case: [test-incoming-form.js](http://github.com/felixge/node-formidable/blob/master/test/simple/test-incoming-form.js) (in [node-formdiable](http://github.com/felixge/node-formidable)). - -## API - -### Gently - -#### new Gently() - -Creates a new gently instance. It listens to the process `'exit'` event to make sure all expectations have been verified. - -#### gently.expect(obj, method, [[count], stubFn]) - -Creates an expectation for an objects method to be called. You can optionally specify the call `count` you are expecting, as well as `stubFn` function that will run instead of the original function. - -Returns a reference to the function that is getting overwritten. - -#### gently.expect([count], stubFn) - -Returns a function that is supposed to be executed `count` times, delegating any calls to the provided `stubFn` function. Naming your stubFn closure will help to properly diagnose errors that are being thrown: - - childProcess.exec('ls', gently.expect(function lsCallback(code) { - assert.equal(0, code); - })); - -#### gently.restore(obj, method) - -Restores an object method that has been previously overwritten using `gently.expect()`. - -#### gently.hijack(realRequire) - -Returns a new require functions that catches a reference to all required modules into `gently.hijacked`. - -To use this function, include a line like this in your `'my-module.js'`. - - if (global.GENTLY) require = GENTLY.hijack(require); - - var sys = require('sys'); - exports.hello = function() { - sys.log('world'); - }; - -Now you can write a test for the module above: - - var gently = global.GENTLY = new (require('gently')) - , myModule = require('./my-module'); - - gently.expect(gently.hijacked.sys, 'log', function(str) { - assert.equal(str, 'world'); - }); - - myModule.hello(); - -#### gently.stub(location, [exportsName]) - -Returns a stub class that will be used instead of the real class from the module at `location` with the given `exportsName`. - -This allows to test an OOP version of the previous example, where `'my-module.js'`. - - if (global.GENTLY) require = GENTLY.hijack(require); - - var World = require('./world'); - - exports.hello = function() { - var world = new World(); - world.hello(); - } - -And `world.js` looks like this: - - var sys = require('sys'); - - function World() { - - } - module.exports = World; - - World.prototype.hello = function() { - sys.log('world'); - }; - -Testing `'my-module.js'` can now easily be accomplished: - - var gently = global.GENTLY = new (require('gently')) - , WorldStub = gently.stub('./world') - , myModule = require('./my-module') - , WORLD; - - gently.expect(WorldStub, 'new', function() { - WORLD = this; - }); - - gently.expect(WORLD, 'hello'); - - myModule.hello(); - -#### gently.hijacked - -An object that holds the references to all hijacked modules. - -#### gently.verify([msg]) - -Verifies that all expectations of this gently instance have been satisfied. If not called manually, this method is called when the process `'exit'` event is fired. - -If `msg` is given, it will appear in any error that might be thrown. - -## License - -Gently is licensed under the MIT license. \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js deleted file mode 100644 index 022fae0..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js +++ /dev/null @@ -1,22 +0,0 @@ -require('../test/common'); -function Dog() {} - -Dog.prototype.seeCat = function() { - this.bark('whuf, whuf'); - this.run(); -} - -Dog.prototype.bark = function(bark) { - require('sys').puts(bark); -} - -var gently = new (require('gently')) - , assert = require('assert') - , dog = new Dog(); - -gently.expect(dog, 'bark', function(bark) { - assert.equal(bark, 'whuf, whuf'); -}); -gently.expect(dog, 'run'); - -dog.seeCat(); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js deleted file mode 100644 index 7def134..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js +++ /dev/null @@ -1,11 +0,0 @@ -require('../test/common'); -var gently = new (require('gently')) - , stream = new (require('fs').WriteStream)('my_file.txt'); - -gently.expect(stream, 'emit', function(event) { - assert.equal(event, 'open'); -}); - -gently.expect(stream, 'emit', function(event) { - assert.equal(event, 'drain'); -}); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js deleted file mode 100644 index 69122bd..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/gently'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js deleted file mode 100644 index 8af0e1e..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js +++ /dev/null @@ -1,184 +0,0 @@ -var path = require('path'); - -function Gently() { - this.expectations = []; - this.hijacked = {}; - - var self = this; - process.addListener('exit', function() { - self.verify('process exit'); - }); -}; -module.exports = Gently; - -Gently.prototype.stub = function(location, exportsName) { - function Stub() { - return Stub['new'].apply(this, arguments); - }; - - Stub['new'] = function () {}; - - var stubName = 'require('+JSON.stringify(location)+')'; - if (exportsName) { - stubName += '.'+exportsName; - } - - Stub.prototype.toString = Stub.toString = function() { - return stubName; - }; - - var exports = this.hijacked[location] || {}; - if (exportsName) { - exports[exportsName] = Stub; - } else { - exports = Stub; - } - - this.hijacked[location] = exports; - return Stub; -}; - -Gently.prototype.hijack = function(realRequire) { - var self = this; - return function(location) { - return self.hijacked[location] = (self.hijacked[location]) - ? self.hijacked[location] - : realRequire(location); - }; -}; - -Gently.prototype.expect = function(obj, method, count, stubFn) { - if (typeof obj != 'function' && typeof obj != 'object' && typeof obj != 'number') { - throw new Error - ( 'Bad 1st argument for gently.expect(), ' - + 'object, function, or number expected, got: '+(typeof obj) - ); - } else if (typeof obj == 'function' && (typeof method != 'string')) { - // expect(stubFn) interface - stubFn = obj; - obj = null; - method = null; - count = 1; - } else if (typeof method == 'function') { - // expect(count, stubFn) interface - count = obj; - stubFn = method; - obj = null; - method = null; - } else if (typeof count == 'function') { - // expect(obj, method, stubFn) interface - stubFn = count; - count = 1; - } else if (count === undefined) { - // expect(obj, method) interface - count = 1; - } - - var name = this._name(obj, method, stubFn); - this.expectations.push({obj: obj, method: method, stubFn: stubFn, name: name, count: count}); - - var self = this; - function delegate() { - return self._stubFn(this, obj, method, name, Array.prototype.slice.call(arguments)); - } - - if (!obj) { - return delegate; - } - - var original = (obj[method]) - ? obj[method]._original || obj[method] - : undefined; - - obj[method] = delegate; - return obj[method]._original = original; -}; - -Gently.prototype.restore = function(obj, method) { - if (!obj[method] || !obj[method]._original) { - throw new Error(this._name(obj, method)+' is not gently stubbed'); - } - obj[method] = obj[method]._original; -}; - -Gently.prototype.verify = function(msg) { - if (!this.expectations.length) { - return; - } - - var validExpectations = []; - for (var i = 0, l = this.expectations.length; i < l; i++) { - var expectation = this.expectations[i]; - - if (expectation.count > 0) { - validExpectations.push(expectation); - } - } - - this.expectations = []; // reset so that no duplicate verification attempts are made - - if (!validExpectations.length) { - return; - } - - var expectation = validExpectations[0]; - - throw new Error - ( 'Expected call to '+expectation.name+' did not happen' - + ( (msg) - ? ' ('+msg+')' - : '' - ) - ); -}; - -Gently.prototype._stubFn = function(self, obj, method, name, args) { - var expectation = this.expectations[0], obj, method; - - if (!expectation) { - throw new Error('Unexpected call to '+name+', no call was expected'); - } - - if (expectation.obj !== obj || expectation.method !== method) { - throw new Error('Unexpected call to '+name+', expected call to '+ expectation.name); - } - - expectation.count -= 1; - if (expectation.count === 0) { - this.expectations.shift(); - - // autorestore original if its not a closure - // and no more expectations on that object - var has_more_expectations = this.expectations.reduce(function (memo, expectation) { - return memo || (expectation.obj === obj && expectation.method === method); - }, false); - if (obj !== null && method !== null && !has_more_expectations) { - if (typeof obj[method]._original !== 'undefined') { - obj[method] = obj[method]._original; - delete obj[method]._original; - } else { - delete obj[method]; - } - } - } - - if (expectation.stubFn) { - return expectation.stubFn.apply(self, args); - } -}; - -Gently.prototype._name = function(obj, method, stubFn) { - if (obj) { - var objectName = obj.toString(); - if (objectName == '[object Object]' && obj.constructor.name) { - objectName = '['+obj.constructor.name+']'; - } - return (objectName)+'.'+method+'()'; - } - - if (stubFn.name) { - return stubFn.name+'()'; - } - - return '>> '+stubFn.toString()+' <<'; -}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js deleted file mode 100644 index 64c1977..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./gently'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json deleted file mode 100644 index 9c1b7a0..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "gently", - "version": "0.9.2", - "directories": { - "lib": "./lib/gently" - }, - "main": "./lib/gently/index", - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": "*" - }, - "optionalDependencies": {} -} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js deleted file mode 100644 index 978b5c5..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js +++ /dev/null @@ -1,8 +0,0 @@ -var path = require('path') - , sys = require('sys'); - -require.paths.unshift(path.dirname(__dirname)+'/lib'); - -global.puts = sys.puts; -global.p = function() {sys.error(sys.inspect.apply(null, arguments))};; -global.assert = require('assert'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js b/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js deleted file mode 100644 index 4f8fe2d..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js +++ /dev/null @@ -1,348 +0,0 @@ -require('../common'); -var Gently = require('gently') - , gently; - -function test(test) { - process.removeAllListeners('exit'); - gently = new Gently(); - test(); -} - -test(function constructor() { - assert.deepEqual(gently.expectations, []); - assert.deepEqual(gently.hijacked, {}); - assert.equal(gently.constructor.name, 'Gently'); -}); - -test(function expectBadArgs() { - var BAD_ARG = 'oh no'; - try { - gently.expect(BAD_ARG); - assert.ok(false, 'throw needs to happen'); - } catch (e) { - assert.equal(e.message, 'Bad 1st argument for gently.expect(), object, function, or number expected, got: '+(typeof BAD_ARG)); - } -}); - -test(function expectObjMethod() { - var OBJ = {}, NAME = 'foobar'; - OBJ.foo = function(x) { - return x; - }; - - gently._name = function() { - return NAME; - }; - - var original = OBJ.foo - , stubFn = function() {}; - - (function testAddOne() { - assert.strictEqual(gently.expect(OBJ, 'foo', stubFn), original); - - assert.equal(gently.expectations.length, 1); - var expectation = gently.expectations[0]; - assert.strictEqual(expectation.obj, OBJ); - assert.strictEqual(expectation.method, 'foo'); - assert.strictEqual(expectation.stubFn, stubFn); - assert.strictEqual(expectation.name, NAME); - assert.strictEqual(OBJ.foo._original, original); - })(); - - (function testAddTwo() { - gently.expect(OBJ, 'foo', 2, stubFn); - assert.equal(gently.expectations.length, 2); - assert.strictEqual(OBJ.foo._original, original); - })(); - - (function testAddOneWithoutMock() { - gently.expect(OBJ, 'foo'); - assert.equal(gently.expectations.length, 3); - })(); - - var stubFnCalled = 0, SELF = {}; - gently._stubFn = function(self, obj, method, name, args) { - stubFnCalled++; - assert.strictEqual(self, SELF); - assert.strictEqual(obj, OBJ); - assert.strictEqual(method, 'foo'); - assert.strictEqual(name, NAME); - assert.deepEqual(args, [1, 2]); - return 23; - }; - assert.equal(OBJ.foo.apply(SELF, [1, 2]), 23); - assert.equal(stubFnCalled, 1); -}); - -test(function expectClosure() { - var NAME = 'MY CLOSURE'; - function closureFn() {}; - - gently._name = function() { - return NAME; - }; - - var fn = gently.expect(closureFn); - assert.equal(gently.expectations.length, 1); - var expectation = gently.expectations[0]; - assert.strictEqual(expectation.obj, null); - assert.strictEqual(expectation.method, null); - assert.strictEqual(expectation.stubFn, closureFn); - assert.strictEqual(expectation.name, NAME); - - var stubFnCalled = 0, SELF = {}; - gently._stubFn = function(self, obj, method, name, args) { - stubFnCalled++; - assert.strictEqual(self, SELF); - assert.strictEqual(obj, null); - assert.strictEqual(method, null); - assert.strictEqual(name, NAME); - assert.deepEqual(args, [1, 2]); - return 23; - }; - assert.equal(fn.apply(SELF, [1, 2]), 23); - assert.equal(stubFnCalled, 1); -}); - -test(function expectClosureCount() { - var stubFnCalled = 0; - function closureFn() {stubFnCalled++}; - - var fn = gently.expect(2, closureFn); - assert.equal(gently.expectations.length, 1); - fn(); - assert.equal(gently.expectations.length, 1); - fn(); - assert.equal(stubFnCalled, 2); -}); - -test(function restore() { - var OBJ = {}, NAME = '[my object].myFn()'; - OBJ.foo = function(x) { - return x; - }; - - gently._name = function() { - return NAME; - }; - - var original = OBJ.foo; - gently.expect(OBJ, 'foo'); - gently.restore(OBJ, 'foo'); - assert.strictEqual(OBJ.foo, original); - - (function testError() { - try { - gently.restore(OBJ, 'foo'); - assert.ok(false, 'throw needs to happen'); - } catch (e) { - assert.equal(e.message, NAME+' is not gently stubbed'); - } - })(); -}); - -test(function _stubFn() { - var OBJ1 = {toString: function() {return '[OBJ 1]'}} - , OBJ2 = {toString: function() {return '[OBJ 2]'}, foo: function () {return 'bar';}} - , SELF = {}; - - gently.expect(OBJ1, 'foo', function(x) { - assert.strictEqual(this, SELF); - return x * 2; - }); - - assert.equal(gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]), 10); - - (function testAutorestore() { - assert.equal(OBJ2.foo(), 'bar'); - - gently.expect(OBJ2, 'foo', function() { - return 'stubbed foo'; - }); - - gently.expect(OBJ2, 'foo', function() { - return "didn't restore yet"; - }); - - assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), 'stubbed foo'); - assert.equal(gently._stubFn(SELF, OBJ2, 'foo', 'dummy_name', []), "didn't restore yet"); - assert.equal(OBJ2.foo(), 'bar'); - assert.deepEqual(gently.expectations, []); - })(); - - (function testNoMoreCallExpected() { - try { - gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]); - assert.ok(false, 'throw needs to happen'); - } catch (e) { - assert.equal(e.message, 'Unexpected call to dummy_name, no call was expected'); - } - })(); - - (function testDifferentCallExpected() { - gently.expect(OBJ2, 'bar'); - try { - gently._stubFn(SELF, OBJ1, 'foo', 'dummy_name', [5]); - assert.ok(false, 'throw needs to happen'); - } catch (e) { - assert.equal(e.message, 'Unexpected call to dummy_name, expected call to '+gently._name(OBJ2, 'bar')); - } - - assert.equal(gently.expectations.length, 1); - })(); - - (function testNoMockCallback() { - OBJ2.bar(); - assert.equal(gently.expectations.length, 0); - })(); -}); - -test(function stub() { - var LOCATION = './my_class'; - - (function testRegular() { - var Stub = gently.stub(LOCATION); - assert.ok(Stub instanceof Function); - assert.strictEqual(gently.hijacked[LOCATION], Stub); - assert.ok(Stub['new'] instanceof Function); - assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+')'); - - (function testConstructor() { - var newCalled = 0 - , STUB - , ARGS = ['foo', 'bar']; - - Stub['new'] = function(a, b) { - assert.equal(a, ARGS[0]); - assert.equal(b, ARGS[1]); - newCalled++; - STUB = this; - }; - - var stub = new Stub(ARGS[0], ARGS[1]); - assert.strictEqual(stub, STUB); - assert.equal(newCalled, 1); - assert.equal(stub.toString(), 'require('+JSON.stringify(LOCATION)+')'); - })(); - - (function testUseReturnValueAsInstance() { - var R = {}; - - Stub['new'] = function() { - return R; - }; - - var stub = new Stub(); - assert.strictEqual(stub, R); - - })(); - })(); - - var EXPORTS_NAME = 'MyClass'; - test(function testExportsName() { - var Stub = gently.stub(LOCATION, EXPORTS_NAME); - assert.strictEqual(gently.hijacked[LOCATION][EXPORTS_NAME], Stub); - assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME); - - (function testConstructor() { - var stub = new Stub(); - assert.equal(Stub.toString(), 'require('+JSON.stringify(LOCATION)+').'+EXPORTS_NAME); - })(); - }); -}); - -test(function hijack() { - var LOCATION = './foo' - , REQUIRE_CALLS = 0 - , EXPORTS = {} - , REQUIRE = function() { - REQUIRE_CALLS++; - return EXPORTS; - }; - - var hijackedRequire = gently.hijack(REQUIRE); - hijackedRequire(LOCATION); - assert.strictEqual(gently.hijacked[LOCATION], EXPORTS); - - assert.equal(REQUIRE_CALLS, 1); - - // make sure we are caching the hijacked module - hijackedRequire(LOCATION); - assert.equal(REQUIRE_CALLS, 1); -}); - -test(function verify() { - var OBJ = {toString: function() {return '[OBJ]'}}; - gently.verify(); - - gently.expect(OBJ, 'foo'); - try { - gently.verify(); - assert.ok(false, 'throw needs to happen'); - } catch (e) { - assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen'); - } - - try { - gently.verify('foo'); - assert.ok(false, 'throw needs to happen'); - } catch (e) { - assert.equal(e.message, 'Expected call to [OBJ].foo() did not happen (foo)'); - } -}); - -test(function processExit() { - var verifyCalled = 0; - gently.verify = function(msg) { - verifyCalled++; - assert.equal(msg, 'process exit'); - }; - - process.emit('exit'); - assert.equal(verifyCalled, 1); -}); - -test(function _name() { - (function testNamedClass() { - function Foo() {}; - var foo = new Foo(); - assert.equal(gently._name(foo, 'bar'), '[Foo].bar()'); - })(); - - (function testToStringPreference() { - function Foo() {}; - Foo.prototype.toString = function() { - return '[Superman 123]'; - }; - var foo = new Foo(); - assert.equal(gently._name(foo, 'bar'), '[Superman 123].bar()'); - })(); - - (function testUnamedClass() { - var Foo = function() {}; - var foo = new Foo(); - assert.equal(gently._name(foo, 'bar'), foo.toString()+'.bar()'); - })(); - - (function testNamedClosure() { - function myClosure() {}; - assert.equal(gently._name(null, null, myClosure), myClosure.name+'()'); - })(); - - (function testUnamedClosure() { - var myClosure = function() {2+2 == 5}; - assert.equal(gently._name(null, null, myClosure), '>> '+myClosure.toString()+' <<'); - })(); -}); - -test(function verifyExpectNone() { - var OBJ = {toString: function() {return '[OBJ]'}}; - gently.verify(); - - gently.expect(OBJ, 'foo', 0); - try { - gently.verify(); - } catch (e) { - assert.fail('Exception should not have been thrown'); - } -}); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/package.json b/node_modules/express/node_modules/connect/node_modules/formidable/package.json deleted file mode 100644 index 177f84f..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "formidable", - "version": "1.0.11", - "dependencies": {}, - "devDependencies": { - "gently": "0.8.0", - "findit": "0.1.1", - "hashish": "0.0.4", - "urun": "0.0.4", - "utest": "0.0.3" - }, - "directories": { - "lib": "./lib" - }, - "main": "./lib/index", - "scripts": { - "test": "make test" - }, - "engines": { - "node": "*" - }, - "optionalDependencies": {}, - "readme": "# Formidable\n\n[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable)\n\n## Purpose\n\nA node.js module for parsing form data, especially file uploads.\n\n## Current status\n\nThis module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading\nand encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from\na large variety of clients and is considered production-ready.\n\n## Features\n\n* Fast (~500mb/sec), non-buffering multipart parser\n* Automatically writing file uploads to disk\n* Low memory footprint\n* Graceful error handling\n* Very high test coverage\n\n## Changelog\n\n### v1.0.9\n\n* Emit progress when content length header parsed (Tim Koschützki)\n* Fix Readme syntax due to GitHub changes (goob)\n* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara)\n\n### v1.0.8\n\n* Strip potentially unsafe characters when using `keepExtensions: true`.\n* Switch to utest / urun for testing\n* Add travis build\n\n### v1.0.7\n\n* Remove file from package that was causing problems when installing on windows. (#102)\n* Fix typos in Readme (Jason Davies).\n\n### v1.0.6\n\n* Do not default to the default to the field name for file uploads where\n filename=\"\".\n\n### v1.0.5\n\n* Support filename=\"\" in multipart parts\n* Explain unexpected end() errors in parser better\n\n**Note:** Starting with this version, formidable emits 'file' events for empty\nfile input fields. Previously those were incorrectly emitted as regular file\ninput fields with value = \"\".\n\n### v1.0.4\n\n* Detect a good default tmp directory regardless of platform. (#88)\n\n### v1.0.3\n\n* Fix problems with utf8 characters (#84) / semicolons in filenames (#58)\n* Small performance improvements\n* New test suite and fixture system\n\n### v1.0.2\n\n* Exclude node\\_modules folder from git\n* Implement new `'aborted'` event\n* Fix files in example folder to work with recent node versions\n* Make gently a devDependency\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2)\n\n### v1.0.1\n\n* Fix package.json to refer to proper main directory. (#68, Dean Landolt)\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1)\n\n### v1.0.0\n\n* Add support for multipart boundaries that are quoted strings. (Jeff Craig)\n\nThis marks the beginning of development on version 2.0 which will include\nseveral architectural improvements.\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0)\n\n### v0.9.11\n\n* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki)\n* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class\n\n**Important:** The old property names of the File class will be removed in a\nfuture release.\n\n[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11)\n\n### Older releases\n\nThese releases were done before starting to maintain the above Changelog:\n\n* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10)\n* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9)\n* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8)\n* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7)\n* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6)\n* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5)\n* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4)\n* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3)\n* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2)\n* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0)\n* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0)\n\n## Installation\n\nVia [npm](http://github.com/isaacs/npm):\n\n npm install formidable@latest\n\nManually:\n\n git clone git://github.com/felixge/node-formidable.git formidable\n vim my.js\n # var formidable = require('./formidable');\n\nNote: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library.\n\n## Example\n\nParse an incoming file upload.\n\n var formidable = require('formidable'),\n http = require('http'),\n\n util = require('util');\n\n http.createServer(function(req, res) {\n if (req.url == '/upload' && req.method.toLowerCase() == 'post') {\n // parse a file upload\n var form = new formidable.IncomingForm();\n form.parse(req, function(err, fields, files) {\n res.writeHead(200, {'content-type': 'text/plain'});\n res.write('received upload:\\n\\n');\n res.end(util.inspect({fields: fields, files: files}));\n });\n return;\n }\n\n // show a file upload form\n res.writeHead(200, {'content-type': 'text/html'});\n res.end(\n '
    '+\n '
    '+\n '
    '+\n ''+\n '
    '\n );\n }).listen(80);\n\n## API\n\n### formidable.IncomingForm\n\n__new formidable.IncomingForm()__\n\nCreates a new incoming form.\n\n__incomingForm.encoding = 'utf-8'__\n\nThe encoding to use for incoming form fields.\n\n__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__\n\nThe directory for placing file uploads in. You can move them later on using\n`fs.rename()`. The default directory is picked at module load time depending on\nthe first existing directory from those listed above.\n\n__incomingForm.keepExtensions = false__\n\nIf you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`.\n\n__incomingForm.type__\n\nEither 'multipart' or 'urlencoded' depending on the incoming request.\n\n__incomingForm.maxFieldsSize = 2 * 1024 * 1024__\n\nLimits the amount of memory a field (not file) can allocate in bytes.\nIf this value is exceeded, an `'error'` event is emitted. The default\nsize is 2MB.\n\n__incomingForm.hash = false__\n\nIf you want checksums calculated for incoming files, set this to either `'sha1'` or `'md5'`.\n\n__incomingForm.bytesReceived__\n\nThe amount of bytes received for this form so far.\n\n__incomingForm.bytesExpected__\n\nThe expected number of bytes in this form.\n\n__incomingForm.parse(request, [cb])__\n\nParses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback:\n\n incomingForm.parse(req, function(err, fields, files) {\n // ...\n });\n\n__incomingForm.onPart(part)__\n\nYou may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing.\n\n incomingForm.onPart = function(part) {\n part.addListener('data', function() {\n // ...\n });\n }\n\nIf you want to use formidable to only handle certain parts for you, you can do so:\n\n incomingForm.onPart = function(part) {\n if (!part.filename) {\n // let formidable handle all non-file parts\n incomingForm.handlePart(part);\n }\n }\n\nCheck the code in this method for further inspiration.\n\n__Event: 'progress' (bytesReceived, bytesExpected)__\n\nEmitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar.\n\n__Event: 'field' (name, value)__\n\nEmitted whenever a field / value pair has been received.\n\n__Event: 'fileBegin' (name, file)__\n\nEmitted whenever a new file is detected in the upload stream. Use this even if\nyou want to stream the file to somewhere else while buffering the upload on\nthe file system.\n\n__Event: 'file' (name, file)__\n\nEmitted whenever a field / file pair has been received. `file` is an instance of `File`.\n\n__Event: 'error' (err)__\n\nEmitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events.\n\n__Event: 'aborted'__\n\nEmitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core).\n\n__Event: 'end' ()__\n\nEmitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response.\n\n### formidable.File\n\n__file.size = 0__\n\nThe size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet.\n\n__file.path = null__\n\nThe path this file is being written to. You can modify this in the `'fileBegin'` event in\ncase you are unhappy with the way formidable generates a temporary path for your files.\n\n__file.name = null__\n\nThe name this file had according to the uploading client.\n\n__file.type = null__\n\nThe mime type of this file, according to the uploading client.\n\n__file.lastModifiedDate = null__\n\nA date object (or `null`) containing the time this file was last written to. Mostly\nhere for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/).\n\n__file.hash = null__\n\nIf hash calculation was set, you can read the hex digest out of this var.\n\n## License\n\nFormidable is licensed under the MIT license.\n\n## Ports\n\n* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable\n\n## Credits\n\n* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js\n", - "readmeFilename": "Readme.md", - "description": "[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable)", - "_id": "formidable@1.0.11", - "_from": "formidable@1.0.11" -} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js deleted file mode 100644 index eb432ad..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/common.js +++ /dev/null @@ -1,19 +0,0 @@ -var mysql = require('..'); -var path = require('path'); - -var root = path.join(__dirname, '../'); -exports.dir = { - root : root, - lib : root + '/lib', - fixture : root + '/test/fixture', - tmp : root + '/test/tmp', -}; - -exports.port = 13532; - -exports.formidable = require('..'); -exports.assert = require('assert'); - -exports.require = function(lib) { - return require(exports.dir.lib + '/' + lib); -}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt deleted file mode 100644 index e7a4785..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt +++ /dev/null @@ -1 +0,0 @@ -I am a text file with a funky name! diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt deleted file mode 100644 index 9b6903e..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt +++ /dev/null @@ -1 +0,0 @@ -I am a plain text file diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md deleted file mode 100644 index 3c9dbe3..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md +++ /dev/null @@ -1,3 +0,0 @@ -* Opera does not allow submitting this file, it shows a warning to the - user that the file could not be found instead. Tested in 9.8, 11.51 on OSX. - Reported to Opera on 08.09.2011 (tracking email DSK-346009@bugs.opera.com). diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js deleted file mode 100644 index 0bae449..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports['generic.http'] = [ - {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt'}, -]; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js deleted file mode 100644 index eb76fdc..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +++ /dev/null @@ -1,21 +0,0 @@ -var properFilename = 'funkyfilename.txt'; - -function expect(filename) { - return [ - {type: 'field', name: 'title', value: 'Weird filename'}, - {type: 'file', name: 'upload', filename: filename, fixture: properFilename}, - ]; -}; - -var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt"; -var ffOrIe = " ? % * | \" < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt"; - -module.exports = { - 'osx-chrome-13.http' : expect(webkit), - 'osx-firefox-3.6.http' : expect(ffOrIe), - 'osx-safari-5.http' : expect(webkit), - 'xp-chrome-12.http' : expect(webkit), - 'xp-ie-7.http' : expect(ffOrIe), - 'xp-ie-8.http' : expect(ffOrIe), - 'xp-safari-5.http' : expect(webkit), -}; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js deleted file mode 100644 index a476169..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multipart.js +++ /dev/null @@ -1,72 +0,0 @@ -exports['rfc1867'] = - { boundary: 'AaB03x', - raw: - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="field1"\r\n'+ - '\r\n'+ - 'Joe Blow\r\nalmost tricked you!\r\n'+ - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ - 'Content-Type: text/plain\r\n'+ - '\r\n'+ - '... contents of file1.txt ...\r\r\n'+ - '--AaB03x--\r\n', - parts: - [ { headers: { - 'content-disposition': 'form-data; name="field1"', - }, - data: 'Joe Blow\r\nalmost tricked you!', - }, - { headers: { - 'content-disposition': 'form-data; name="pics"; filename="file1.txt"', - 'Content-Type': 'text/plain', - }, - data: '... contents of file1.txt ...\r', - } - ] - }; - -exports['noTrailing\r\n'] = - { boundary: 'AaB03x', - raw: - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="field1"\r\n'+ - '\r\n'+ - 'Joe Blow\r\nalmost tricked you!\r\n'+ - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ - 'Content-Type: text/plain\r\n'+ - '\r\n'+ - '... contents of file1.txt ...\r\r\n'+ - '--AaB03x--', - parts: - [ { headers: { - 'content-disposition': 'form-data; name="field1"', - }, - data: 'Joe Blow\r\nalmost tricked you!', - }, - { headers: { - 'content-disposition': 'form-data; name="pics"; filename="file1.txt"', - 'Content-Type': 'text/plain', - }, - data: '... contents of file1.txt ...\r', - } - ] - }; - -exports['emptyHeader'] = - { boundary: 'AaB03x', - raw: - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="field1"\r\n'+ - ': foo\r\n'+ - '\r\n'+ - 'Joe Blow\r\nalmost tricked you!\r\n'+ - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ - 'Content-Type: text/plain\r\n'+ - '\r\n'+ - '... contents of file1.txt ...\r\r\n'+ - '--AaB03x--\r\n', - expectError: true, - }; diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js deleted file mode 100644 index 66ad259..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js +++ /dev/null @@ -1,89 +0,0 @@ -var hashish = require('hashish'); -var fs = require('fs'); -var findit = require('findit'); -var path = require('path'); -var http = require('http'); -var net = require('net'); -var assert = require('assert'); - -var common = require('../common'); -var formidable = common.formidable; - -var server = http.createServer(); -server.listen(common.port, findFixtures); - -function findFixtures() { - var fixtures = []; - findit - .sync(common.dir.fixture + '/js') - .forEach(function(jsPath) { - if (!/\.js$/.test(jsPath)) return; - - var group = path.basename(jsPath, '.js'); - hashish.forEach(require(jsPath), function(fixture, name) { - fixtures.push({ - name : group + '/' + name, - fixture : fixture, - }); - }); - }); - - testNext(fixtures); -} - -function testNext(fixtures) { - var fixture = fixtures.shift(); - if (!fixture) return server.close(); - - var name = fixture.name; - var fixture = fixture.fixture; - - uploadFixture(name, function(err, parts) { - if (err) throw err; - - fixture.forEach(function(expectedPart, i) { - var parsedPart = parts[i]; - assert.equal(parsedPart.type, expectedPart.type); - assert.equal(parsedPart.name, expectedPart.name); - - if (parsedPart.type === 'file') { - var filename = parsedPart.value.name; - assert.equal(filename, expectedPart.filename); - } - }); - - testNext(fixtures); - }); -}; - -function uploadFixture(name, cb) { - server.once('request', function(req, res) { - var form = new formidable.IncomingForm(); - form.uploadDir = common.dir.tmp; - form.parse(req); - - function callback() { - var realCallback = cb; - cb = function() {}; - realCallback.apply(null, arguments); - } - - var parts = []; - form - .on('error', callback) - .on('fileBegin', function(name, value) { - parts.push({type: 'file', name: name, value: value}); - }) - .on('field', function(name, value) { - parts.push({type: 'field', name: name, value: value}); - }) - .on('end', function() { - callback(null, parts); - }); - }); - - var socket = net.createConnection(common.port); - var file = fs.createReadStream(common.dir.fixture + '/http/' + name); - - file.pipe(socket); -} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js deleted file mode 100644 index 2b98598..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/common.js +++ /dev/null @@ -1,24 +0,0 @@ -var path = require('path'), - fs = require('fs'); - -try { - global.Gently = require('gently'); -} catch (e) { - throw new Error('this test suite requires node-gently'); -} - -exports.lib = path.join(__dirname, '../../lib'); - -global.GENTLY = new Gently(); - -global.assert = require('assert'); -global.TEST_PORT = 13532; -global.TEST_FIXTURES = path.join(__dirname, '../fixture'); -global.TEST_TMP = path.join(__dirname, '../tmp'); - -// Stupid new feature in node that complains about gently attaching too many -// listeners to process 'exit'. This is a workaround until I can think of a -// better way to deal with this. -if (process.setMaxListeners) { - process.setMaxListeners(10000); -} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js deleted file mode 100644 index 75232aa..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js +++ /dev/null @@ -1,80 +0,0 @@ -var common = require('../common'); -var CHUNK_LENGTH = 10, - multipartParser = require(common.lib + '/multipart_parser'), - MultipartParser = multipartParser.MultipartParser, - parser = new MultipartParser(), - fixtures = require(TEST_FIXTURES + '/multipart'), - Buffer = require('buffer').Buffer; - -Object.keys(fixtures).forEach(function(name) { - var fixture = fixtures[name], - buffer = new Buffer(Buffer.byteLength(fixture.raw, 'binary')), - offset = 0, - chunk, - nparsed, - - parts = [], - part = null, - headerField, - headerValue, - endCalled = ''; - - parser.initWithBoundary(fixture.boundary); - parser.onPartBegin = function() { - part = {headers: {}, data: ''}; - parts.push(part); - headerField = ''; - headerValue = ''; - }; - - parser.onHeaderField = function(b, start, end) { - headerField += b.toString('ascii', start, end); - }; - - parser.onHeaderValue = function(b, start, end) { - headerValue += b.toString('ascii', start, end); - } - - parser.onHeaderEnd = function() { - part.headers[headerField] = headerValue; - headerField = ''; - headerValue = ''; - }; - - parser.onPartData = function(b, start, end) { - var str = b.toString('ascii', start, end); - part.data += b.slice(start, end); - } - - parser.onEnd = function() { - endCalled = true; - } - - buffer.write(fixture.raw, 'binary', 0); - - while (offset < buffer.length) { - if (offset + CHUNK_LENGTH < buffer.length) { - chunk = buffer.slice(offset, offset+CHUNK_LENGTH); - } else { - chunk = buffer.slice(offset, buffer.length); - } - offset = offset + CHUNK_LENGTH; - - nparsed = parser.write(chunk); - if (nparsed != chunk.length) { - if (fixture.expectError) { - return; - } - puts('-- ERROR --'); - p(chunk.toString('ascii')); - throw new Error(chunk.length+' bytes written, but only '+nparsed+' bytes parsed!'); - } - } - - if (fixture.expectError) { - throw new Error('expected parse error did not happen'); - } - - assert.ok(endCalled); - assert.deepEqual(parts, fixture.parts); -}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js deleted file mode 100644 index 52ceedb..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js +++ /dev/null @@ -1,104 +0,0 @@ -var common = require('../common'); -var WriteStreamStub = GENTLY.stub('fs', 'WriteStream'); - -var File = require(common.lib + '/file'), - EventEmitter = require('events').EventEmitter, - file, - gently; - -function test(test) { - gently = new Gently(); - file = new File(); - test(); - gently.verify(test.name); -} - -test(function constructor() { - assert.ok(file instanceof EventEmitter); - assert.strictEqual(file.size, 0); - assert.strictEqual(file.path, null); - assert.strictEqual(file.name, null); - assert.strictEqual(file.type, null); - assert.strictEqual(file.lastModifiedDate, null); - - assert.strictEqual(file._writeStream, null); - - (function testSetProperties() { - var file2 = new File({foo: 'bar'}); - assert.equal(file2.foo, 'bar'); - })(); -}); - -test(function open() { - var WRITE_STREAM; - file.path = '/foo'; - - gently.expect(WriteStreamStub, 'new', function (path) { - WRITE_STREAM = this; - assert.strictEqual(path, file.path); - }); - - file.open(); - assert.strictEqual(file._writeStream, WRITE_STREAM); -}); - -test(function write() { - var BUFFER = {length: 10}, - CB_STUB, - CB = function() { - CB_STUB.apply(this, arguments); - }; - - file._writeStream = {}; - - gently.expect(file._writeStream, 'write', function (buffer, cb) { - assert.strictEqual(buffer, BUFFER); - - gently.expect(file, 'emit', function (event, bytesWritten) { - assert.ok(file.lastModifiedDate instanceof Date); - assert.equal(event, 'progress'); - assert.equal(bytesWritten, file.size); - }); - - CB_STUB = gently.expect(function writeCb() { - assert.equal(file.size, 10); - }); - - cb(); - - gently.expect(file, 'emit', function (event, bytesWritten) { - assert.equal(event, 'progress'); - assert.equal(bytesWritten, file.size); - }); - - CB_STUB = gently.expect(function writeCb() { - assert.equal(file.size, 20); - }); - - cb(); - }); - - file.write(BUFFER, CB); -}); - -test(function end() { - var CB_STUB, - CB = function() { - CB_STUB.apply(this, arguments); - }; - - file._writeStream = {}; - - gently.expect(file._writeStream, 'end', function (cb) { - gently.expect(file, 'emit', function (event) { - assert.equal(event, 'end'); - }); - - CB_STUB = gently.expect(function endCb() { - }); - - cb(); - }); - - file.end(CB); -}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js deleted file mode 100644 index 84de439..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +++ /dev/null @@ -1,727 +0,0 @@ -var common = require('../common'); -var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser'), - QuerystringParserStub = GENTLY.stub('./querystring_parser', 'QuerystringParser'), - EventEmitterStub = GENTLY.stub('events', 'EventEmitter'), - StreamStub = GENTLY.stub('stream', 'Stream'), - FileStub = GENTLY.stub('./file'); - -var formidable = require(common.lib + '/index'), - IncomingForm = formidable.IncomingForm, - events = require('events'), - fs = require('fs'), - path = require('path'), - Buffer = require('buffer').Buffer, - fixtures = require(TEST_FIXTURES + '/multipart'), - form, - gently; - -function test(test) { - gently = new Gently(); - gently.expect(EventEmitterStub, 'call'); - form = new IncomingForm(); - test(); - gently.verify(test.name); -} - -test(function constructor() { - assert.strictEqual(form.error, null); - assert.strictEqual(form.ended, false); - assert.strictEqual(form.type, null); - assert.strictEqual(form.headers, null); - assert.strictEqual(form.keepExtensions, false); - assert.strictEqual(form.uploadDir, '/tmp'); - assert.strictEqual(form.encoding, 'utf-8'); - assert.strictEqual(form.bytesReceived, null); - assert.strictEqual(form.bytesExpected, null); - assert.strictEqual(form.maxFieldsSize, 2 * 1024 * 1024); - assert.strictEqual(form._parser, null); - assert.strictEqual(form._flushing, 0); - assert.strictEqual(form._fieldsSize, 0); - assert.ok(form instanceof EventEmitterStub); - assert.equal(form.constructor.name, 'IncomingForm'); - - (function testSimpleConstructor() { - gently.expect(EventEmitterStub, 'call'); - var form = IncomingForm(); - assert.ok(form instanceof IncomingForm); - })(); - - (function testSimpleConstructorShortcut() { - gently.expect(EventEmitterStub, 'call'); - var form = formidable(); - assert.ok(form instanceof IncomingForm); - })(); -}); - -test(function parse() { - var REQ = {headers: {}} - , emit = {}; - - gently.expect(form, 'writeHeaders', function(headers) { - assert.strictEqual(headers, REQ.headers); - }); - - var events = ['error', 'aborted', 'data', 'end']; - gently.expect(REQ, 'on', events.length, function(event, fn) { - assert.equal(event, events.shift()); - emit[event] = fn; - return this; - }); - - form.parse(REQ); - - (function testPause() { - gently.expect(REQ, 'pause'); - assert.strictEqual(form.pause(), true); - })(); - - (function testPauseCriticalException() { - form.ended = false; - - var ERR = new Error('dasdsa'); - gently.expect(REQ, 'pause', function() { - throw ERR; - }); - - gently.expect(form, '_error', function(err) { - assert.strictEqual(err, ERR); - }); - - assert.strictEqual(form.pause(), false); - })(); - - (function testPauseHarmlessException() { - form.ended = true; - - var ERR = new Error('dasdsa'); - gently.expect(REQ, 'pause', function() { - throw ERR; - }); - - assert.strictEqual(form.pause(), false); - })(); - - (function testResume() { - gently.expect(REQ, 'resume'); - assert.strictEqual(form.resume(), true); - })(); - - (function testResumeCriticalException() { - form.ended = false; - - var ERR = new Error('dasdsa'); - gently.expect(REQ, 'resume', function() { - throw ERR; - }); - - gently.expect(form, '_error', function(err) { - assert.strictEqual(err, ERR); - }); - - assert.strictEqual(form.resume(), false); - })(); - - (function testResumeHarmlessException() { - form.ended = true; - - var ERR = new Error('dasdsa'); - gently.expect(REQ, 'resume', function() { - throw ERR; - }); - - assert.strictEqual(form.resume(), false); - })(); - - (function testEmitError() { - var ERR = new Error('something bad happened'); - gently.expect(form, '_error',function(err) { - assert.strictEqual(err, ERR); - }); - emit.error(ERR); - })(); - - (function testEmitAborted() { - gently.expect(form, 'emit',function(event) { - assert.equal(event, 'aborted'); - }); - - emit.aborted(); - })(); - - - (function testEmitData() { - var BUFFER = [1, 2, 3]; - gently.expect(form, 'write', function(buffer) { - assert.strictEqual(buffer, BUFFER); - }); - emit.data(BUFFER); - })(); - - (function testEmitEnd() { - form._parser = {}; - - (function testWithError() { - var ERR = new Error('haha'); - gently.expect(form._parser, 'end', function() { - return ERR; - }); - - gently.expect(form, '_error', function(err) { - assert.strictEqual(err, ERR); - }); - - emit.end(); - })(); - - (function testWithoutError() { - gently.expect(form._parser, 'end'); - emit.end(); - })(); - - (function testAfterError() { - form.error = true; - emit.end(); - })(); - })(); - - (function testWithCallback() { - gently.expect(EventEmitterStub, 'call'); - var form = new IncomingForm(), - REQ = {headers: {}}, - parseCalled = 0; - - gently.expect(form, 'writeHeaders'); - gently.expect(REQ, 'on', 4, function() { - return this; - }); - - gently.expect(form, 'on', 4, function(event, fn) { - if (event == 'field') { - fn('field1', 'foo'); - fn('field1', 'bar'); - fn('field2', 'nice'); - } - - if (event == 'file') { - fn('file1', '1'); - fn('file1', '2'); - fn('file2', '3'); - } - - if (event == 'end') { - fn(); - } - return this; - }); - - form.parse(REQ, gently.expect(function parseCbOk(err, fields, files) { - assert.deepEqual(fields, {field1: 'bar', field2: 'nice'}); - assert.deepEqual(files, {file1: '2', file2: '3'}); - })); - - gently.expect(form, 'writeHeaders'); - gently.expect(REQ, 'on', 4, function() { - return this; - }); - - var ERR = new Error('test'); - gently.expect(form, 'on', 3, function(event, fn) { - if (event == 'field') { - fn('foo', 'bar'); - } - - if (event == 'error') { - fn(ERR); - gently.expect(form, 'on'); - } - return this; - }); - - form.parse(REQ, gently.expect(function parseCbErr(err, fields, files) { - assert.strictEqual(err, ERR); - assert.deepEqual(fields, {foo: 'bar'}); - })); - })(); -}); - -test(function pause() { - assert.strictEqual(form.pause(), false); -}); - -test(function resume() { - assert.strictEqual(form.resume(), false); -}); - - -test(function writeHeaders() { - var HEADERS = {}; - gently.expect(form, '_parseContentLength'); - gently.expect(form, '_parseContentType'); - - form.writeHeaders(HEADERS); - assert.strictEqual(form.headers, HEADERS); -}); - -test(function write() { - var parser = {}, - BUFFER = [1, 2, 3]; - - form._parser = parser; - form.bytesExpected = 523423; - - (function testBasic() { - gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { - assert.equal(event, 'progress'); - assert.equal(bytesReceived, BUFFER.length); - assert.equal(bytesExpected, form.bytesExpected); - }); - - gently.expect(parser, 'write', function(buffer) { - assert.strictEqual(buffer, BUFFER); - return buffer.length; - }); - - assert.equal(form.write(BUFFER), BUFFER.length); - assert.equal(form.bytesReceived, BUFFER.length); - })(); - - (function testParserError() { - gently.expect(form, 'emit'); - - gently.expect(parser, 'write', function(buffer) { - assert.strictEqual(buffer, BUFFER); - return buffer.length - 1; - }); - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/parser error/i)); - }); - - assert.equal(form.write(BUFFER), BUFFER.length - 1); - assert.equal(form.bytesReceived, BUFFER.length + BUFFER.length); - })(); - - (function testUninitialized() { - delete form._parser; - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/unintialized parser/i)); - }); - form.write(BUFFER); - })(); -}); - -test(function parseContentType() { - var HEADERS = {}; - - form.headers = {'content-type': 'application/x-www-form-urlencoded'}; - gently.expect(form, '_initUrlencoded'); - form._parseContentType(); - - // accept anything that has 'urlencoded' in it - form.headers = {'content-type': 'broken-client/urlencoded-stupid'}; - gently.expect(form, '_initUrlencoded'); - form._parseContentType(); - - var BOUNDARY = '---------------------------57814261102167618332366269'; - form.headers = {'content-type': 'multipart/form-data; boundary='+BOUNDARY}; - - gently.expect(form, '_initMultipart', function(boundary) { - assert.equal(boundary, BOUNDARY); - }); - form._parseContentType(); - - (function testQuotedBoundary() { - form.headers = {'content-type': 'multipart/form-data; boundary="' + BOUNDARY + '"'}; - - gently.expect(form, '_initMultipart', function(boundary) { - assert.equal(boundary, BOUNDARY); - }); - form._parseContentType(); - })(); - - (function testNoBoundary() { - form.headers = {'content-type': 'multipart/form-data'}; - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/no multipart boundary/i)); - }); - form._parseContentType(); - })(); - - (function testNoContentType() { - form.headers = {}; - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/no content-type/i)); - }); - form._parseContentType(); - })(); - - (function testUnknownContentType() { - form.headers = {'content-type': 'invalid'}; - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/unknown content-type/i)); - }); - form._parseContentType(); - })(); -}); - -test(function parseContentLength() { - var HEADERS = {}; - - form.headers = {}; - form._parseContentLength(); - assert.strictEqual(form.bytesReceived, null); - assert.strictEqual(form.bytesExpected, null); - - form.headers['content-length'] = '8'; - gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { - assert.equal(event, 'progress'); - assert.equal(bytesReceived, 0); - assert.equal(bytesExpected, 8); - }); - form._parseContentLength(); - assert.strictEqual(form.bytesReceived, 0); - assert.strictEqual(form.bytesExpected, 8); - - // JS can be evil, lets make sure we are not - form.headers['content-length'] = '08'; - gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { - assert.equal(event, 'progress'); - assert.equal(bytesReceived, 0); - assert.equal(bytesExpected, 8); - }); - form._parseContentLength(); - assert.strictEqual(form.bytesExpected, 8); -}); - -test(function _initMultipart() { - var BOUNDARY = '123', - PARSER; - - gently.expect(MultipartParserStub, 'new', function() { - PARSER = this; - }); - - gently.expect(MultipartParserStub.prototype, 'initWithBoundary', function(boundary) { - assert.equal(boundary, BOUNDARY); - }); - - form._initMultipart(BOUNDARY); - assert.equal(form.type, 'multipart'); - assert.strictEqual(form._parser, PARSER); - - (function testRegularField() { - var PART; - gently.expect(StreamStub, 'new', function() { - PART = this; - }); - - gently.expect(form, 'onPart', function(part) { - assert.strictEqual(part, PART); - assert.deepEqual - ( part.headers - , { 'content-disposition': 'form-data; name="field1"' - , 'foo': 'bar' - } - ); - assert.equal(part.name, 'field1'); - - var strings = ['hello', ' world']; - gently.expect(part, 'emit', 2, function(event, b) { - assert.equal(event, 'data'); - assert.equal(b.toString(), strings.shift()); - }); - - gently.expect(part, 'emit', function(event, b) { - assert.equal(event, 'end'); - }); - }); - - PARSER.onPartBegin(); - PARSER.onHeaderField(new Buffer('content-disposition'), 0, 10); - PARSER.onHeaderField(new Buffer('content-disposition'), 10, 19); - PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 0, 14); - PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 14, 24); - PARSER.onHeaderEnd(); - PARSER.onHeaderField(new Buffer('foo'), 0, 3); - PARSER.onHeaderValue(new Buffer('bar'), 0, 3); - PARSER.onHeaderEnd(); - PARSER.onHeadersEnd(); - PARSER.onPartData(new Buffer('hello world'), 0, 5); - PARSER.onPartData(new Buffer('hello world'), 5, 11); - PARSER.onPartEnd(); - })(); - - (function testFileField() { - var PART; - gently.expect(StreamStub, 'new', function() { - PART = this; - }); - - gently.expect(form, 'onPart', function(part) { - assert.deepEqual - ( part.headers - , { 'content-disposition': 'form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"' - , 'content-type': 'text/plain' - } - ); - assert.equal(part.name, 'field2'); - assert.equal(part.filename, 'Sun"et.jpg'); - assert.equal(part.mime, 'text/plain'); - - gently.expect(part, 'emit', function(event, b) { - assert.equal(event, 'data'); - assert.equal(b.toString(), '... contents of file1.txt ...'); - }); - - gently.expect(part, 'emit', function(event, b) { - assert.equal(event, 'end'); - }); - }); - - PARSER.onPartBegin(); - PARSER.onHeaderField(new Buffer('content-disposition'), 0, 19); - PARSER.onHeaderValue(new Buffer('form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'), 0, 85); - PARSER.onHeaderEnd(); - PARSER.onHeaderField(new Buffer('Content-Type'), 0, 12); - PARSER.onHeaderValue(new Buffer('text/plain'), 0, 10); - PARSER.onHeaderEnd(); - PARSER.onHeadersEnd(); - PARSER.onPartData(new Buffer('... contents of file1.txt ...'), 0, 29); - PARSER.onPartEnd(); - })(); - - (function testEnd() { - gently.expect(form, '_maybeEnd'); - PARSER.onEnd(); - assert.ok(form.ended); - })(); -}); - -test(function _fileName() { - // TODO - return; -}); - -test(function _initUrlencoded() { - var PARSER; - - gently.expect(QuerystringParserStub, 'new', function() { - PARSER = this; - }); - - form._initUrlencoded(); - assert.equal(form.type, 'urlencoded'); - assert.strictEqual(form._parser, PARSER); - - (function testOnField() { - var KEY = 'KEY', VAL = 'VAL'; - gently.expect(form, 'emit', function(field, key, val) { - assert.equal(field, 'field'); - assert.equal(key, KEY); - assert.equal(val, VAL); - }); - - PARSER.onField(KEY, VAL); - })(); - - (function testOnEnd() { - gently.expect(form, '_maybeEnd'); - - PARSER.onEnd(); - assert.equal(form.ended, true); - })(); -}); - -test(function _error() { - var ERR = new Error('bla'); - - gently.expect(form, 'pause'); - gently.expect(form, 'emit', function(event, err) { - assert.equal(event, 'error'); - assert.strictEqual(err, ERR); - }); - - form._error(ERR); - assert.strictEqual(form.error, ERR); - - // make sure _error only does its thing once - form._error(ERR); -}); - -test(function onPart() { - var PART = {}; - gently.expect(form, 'handlePart', function(part) { - assert.strictEqual(part, PART); - }); - - form.onPart(PART); -}); - -test(function handlePart() { - (function testUtf8Field() { - var PART = new events.EventEmitter(); - PART.name = 'my_field'; - - gently.expect(form, 'emit', function(event, field, value) { - assert.equal(event, 'field'); - assert.equal(field, 'my_field'); - assert.equal(value, 'hello world: €'); - }); - - form.handlePart(PART); - PART.emit('data', new Buffer('hello')); - PART.emit('data', new Buffer(' world: ')); - PART.emit('data', new Buffer([0xE2])); - PART.emit('data', new Buffer([0x82, 0xAC])); - PART.emit('end'); - })(); - - (function testBinaryField() { - var PART = new events.EventEmitter(); - PART.name = 'my_field2'; - - gently.expect(form, 'emit', function(event, field, value) { - assert.equal(event, 'field'); - assert.equal(field, 'my_field2'); - assert.equal(value, 'hello world: '+new Buffer([0xE2, 0x82, 0xAC]).toString('binary')); - }); - - form.encoding = 'binary'; - form.handlePart(PART); - PART.emit('data', new Buffer('hello')); - PART.emit('data', new Buffer(' world: ')); - PART.emit('data', new Buffer([0xE2])); - PART.emit('data', new Buffer([0x82, 0xAC])); - PART.emit('end'); - })(); - - (function testFieldSize() { - form.maxFieldsSize = 8; - var PART = new events.EventEmitter(); - PART.name = 'my_field'; - - gently.expect(form, '_error', function(err) { - assert.equal(err.message, 'maxFieldsSize exceeded, received 9 bytes of field data'); - }); - - form.handlePart(PART); - form._fieldsSize = 1; - PART.emit('data', new Buffer(7)); - PART.emit('data', new Buffer(1)); - })(); - - (function testFilePart() { - var PART = new events.EventEmitter(), - FILE = new events.EventEmitter(), - PATH = '/foo/bar'; - - PART.name = 'my_file'; - PART.filename = 'sweet.txt'; - PART.mime = 'sweet.txt'; - - gently.expect(form, '_uploadPath', function(filename) { - assert.equal(filename, PART.filename); - return PATH; - }); - - gently.expect(FileStub, 'new', function(properties) { - assert.equal(properties.path, PATH); - assert.equal(properties.name, PART.filename); - assert.equal(properties.type, PART.mime); - FILE = this; - - gently.expect(form, 'emit', function (event, field, file) { - assert.equal(event, 'fileBegin'); - assert.strictEqual(field, PART.name); - assert.strictEqual(file, FILE); - }); - - gently.expect(FILE, 'open'); - }); - - form.handlePart(PART); - assert.equal(form._flushing, 1); - - var BUFFER; - gently.expect(form, 'pause'); - gently.expect(FILE, 'write', function(buffer, cb) { - assert.strictEqual(buffer, BUFFER); - gently.expect(form, 'resume'); - // @todo handle cb(new Err) - cb(); - }); - - PART.emit('data', BUFFER = new Buffer('test')); - - gently.expect(FILE, 'end', function(cb) { - gently.expect(form, 'emit', function(event, field, file) { - assert.equal(event, 'file'); - assert.strictEqual(file, FILE); - }); - - gently.expect(form, '_maybeEnd'); - - cb(); - assert.equal(form._flushing, 0); - }); - - PART.emit('end'); - })(); -}); - -test(function _uploadPath() { - (function testUniqueId() { - var UUID_A, UUID_B; - gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) { - assert.equal(uploadDir, form.uploadDir); - UUID_A = uuid; - }); - form._uploadPath(); - - gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) { - UUID_B = uuid; - }); - form._uploadPath(); - - assert.notEqual(UUID_A, UUID_B); - })(); - - (function testFileExtension() { - form.keepExtensions = true; - var FILENAME = 'foo.jpg', - EXT = '.bar'; - - gently.expect(GENTLY.hijacked.path, 'extname', function(filename) { - assert.equal(filename, FILENAME); - gently.restore(path, 'extname'); - - return EXT; - }); - - gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, name) { - assert.equal(path.extname(name), EXT); - }); - form._uploadPath(FILENAME); - })(); -}); - -test(function _maybeEnd() { - gently.expect(form, 'emit', 0); - form._maybeEnd(); - - form.ended = true; - form._flushing = 1; - form._maybeEnd(); - - gently.expect(form, 'emit', function(event) { - assert.equal(event, 'end'); - }); - - form.ended = true; - form._flushing = 0; - form._maybeEnd(); -}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js deleted file mode 100644 index d8dc968..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js +++ /dev/null @@ -1,50 +0,0 @@ -var common = require('../common'); -var multipartParser = require(common.lib + '/multipart_parser'), - MultipartParser = multipartParser.MultipartParser, - events = require('events'), - Buffer = require('buffer').Buffer, - parser; - -function test(test) { - parser = new MultipartParser(); - test(); -} - -test(function constructor() { - assert.equal(parser.boundary, null); - assert.equal(parser.state, 0); - assert.equal(parser.flags, 0); - assert.equal(parser.boundaryChars, null); - assert.equal(parser.index, null); - assert.equal(parser.lookbehind, null); - assert.equal(parser.constructor.name, 'MultipartParser'); -}); - -test(function initWithBoundary() { - var boundary = 'abc'; - parser.initWithBoundary(boundary); - assert.deepEqual(Array.prototype.slice.call(parser.boundary), [13, 10, 45, 45, 97, 98, 99]); - assert.equal(parser.state, multipartParser.START); - - assert.deepEqual(parser.boundaryChars, {10: true, 13: true, 45: true, 97: true, 98: true, 99: true}); -}); - -test(function parserError() { - var boundary = 'abc', - buffer = new Buffer(5); - - parser.initWithBoundary(boundary); - buffer.write('--ad', 'ascii', 0); - assert.equal(parser.write(buffer), 3); -}); - -test(function end() { - (function testError() { - assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain()); - })(); - - (function testRegular() { - parser.state = multipartParser.END; - assert.strictEqual(parser.end(), undefined); - })(); -}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js deleted file mode 100644 index 54d3e2d..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js +++ /dev/null @@ -1,45 +0,0 @@ -var common = require('../common'); -var QuerystringParser = require(common.lib + '/querystring_parser').QuerystringParser, - Buffer = require('buffer').Buffer, - gently, - parser; - -function test(test) { - gently = new Gently(); - parser = new QuerystringParser(); - test(); - gently.verify(test.name); -} - -test(function constructor() { - assert.equal(parser.buffer, ''); - assert.equal(parser.constructor.name, 'QuerystringParser'); -}); - -test(function write() { - var a = new Buffer('a=1'); - assert.equal(parser.write(a), a.length); - - var b = new Buffer('&b=2'); - parser.write(b); - assert.equal(parser.buffer, a + b); -}); - -test(function end() { - var FIELDS = {a: ['b', {c: 'd'}], e: 'f'}; - - gently.expect(GENTLY.hijacked.querystring, 'parse', function(str) { - assert.equal(str, parser.buffer); - return FIELDS; - }); - - gently.expect(parser, 'onField', Object.keys(FIELDS).length, function(key, val) { - assert.deepEqual(FIELDS[key], val); - }); - - gently.expect(parser, 'onEnd'); - - parser.buffer = 'my buffer'; - parser.end(); - assert.equal(parser.buffer, ''); -}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js deleted file mode 100644 index 479e46d..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js +++ /dev/null @@ -1,75 +0,0 @@ -var common = require('../common'); -var BOUNDARY = '---------------------------10102754414578508781458777923', - FIXTURE = TEST_FIXTURES+'/multi_video.upload', - fs = require('fs'), - util = require(common.lib + '/util'), - http = require('http'), - formidable = require(common.lib + '/index'), - server = http.createServer(); - -server.on('request', function(req, res) { - var form = new formidable.IncomingForm(), - uploads = {}; - - form.uploadDir = TEST_TMP; - form.hash = 'sha1'; - form.parse(req); - - form - .on('fileBegin', function(field, file) { - assert.equal(field, 'upload'); - - var tracker = {file: file, progress: [], ended: false}; - uploads[file.filename] = tracker; - file - .on('progress', function(bytesReceived) { - tracker.progress.push(bytesReceived); - assert.equal(bytesReceived, file.length); - }) - .on('end', function() { - tracker.ended = true; - }); - }) - .on('field', function(field, value) { - assert.equal(field, 'title'); - assert.equal(value, ''); - }) - .on('file', function(field, file) { - assert.equal(field, 'upload'); - assert.strictEqual(uploads[file.filename].file, file); - }) - .on('end', function() { - assert.ok(uploads['shortest_video.flv']); - assert.ok(uploads['shortest_video.flv'].ended); - assert.ok(uploads['shortest_video.flv'].progress.length > 3); - assert.equal(uploads['shortest_video.flv'].file.hash, 'd6a17616c7143d1b1438ceeef6836d1a09186b3a'); - assert.equal(uploads['shortest_video.flv'].progress.slice(-1), uploads['shortest_video.flv'].file.length); - assert.ok(uploads['shortest_video.mp4']); - assert.ok(uploads['shortest_video.mp4'].ended); - assert.ok(uploads['shortest_video.mp4'].progress.length > 3); - assert.equal(uploads['shortest_video.mp4'].file.hash, '937dfd4db263f4887ceae19341dcc8d63bcd557f'); - - server.close(); - res.writeHead(200); - res.end('good'); - }); -}); - -server.listen(TEST_PORT, function() { - var client = http.createClient(TEST_PORT), - stat = fs.statSync(FIXTURE), - headers = { - 'content-type': 'multipart/form-data; boundary='+BOUNDARY, - 'content-length': stat.size, - } - request = client.request('POST', '/', headers), - fixture = new fs.ReadStream(FIXTURE); - - fixture - .on('data', function(b) { - request.write(b); - }) - .on('end', function() { - request.end(); - }); -}); diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js deleted file mode 100755 index 50b2361..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/run.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('urun')(__dirname) diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js b/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js deleted file mode 100644 index fe2ac1c..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js +++ /dev/null @@ -1,63 +0,0 @@ -var common = require('../common'); -var test = require('utest'); -var assert = common.assert; -var IncomingForm = common.require('incoming_form').IncomingForm; -var path = require('path'); - -var form; -test('IncomingForm', { - before: function() { - form = new IncomingForm(); - }, - - '#_fileName with regular characters': function() { - var filename = 'foo.txt'; - assert.equal(form._fileName(makeHeader(filename)), 'foo.txt'); - }, - - '#_fileName with unescaped quote': function() { - var filename = 'my".txt'; - assert.equal(form._fileName(makeHeader(filename)), 'my".txt'); - }, - - '#_fileName with escaped quote': function() { - var filename = 'my%22.txt'; - assert.equal(form._fileName(makeHeader(filename)), 'my".txt'); - }, - - '#_fileName with bad quote and additional sub-header': function() { - var filename = 'my".txt'; - var header = makeHeader(filename) + '; foo="bar"'; - assert.equal(form._fileName(header), filename); - }, - - '#_fileName with semicolon': function() { - var filename = 'my;.txt'; - assert.equal(form._fileName(makeHeader(filename)), 'my;.txt'); - }, - - '#_fileName with utf8 character': function() { - var filename = 'my☃.txt'; - assert.equal(form._fileName(makeHeader(filename)), 'my☃.txt'); - }, - - '#_uploadPath strips harmful characters from extension when keepExtensions': function() { - form.keepExtensions = true; - - var ext = path.extname(form._uploadPath('fine.jpg?foo=bar')); - assert.equal(ext, '.jpg'); - - var ext = path.extname(form._uploadPath('fine?foo=bar')); - assert.equal(ext, ''); - - var ext = path.extname(form._uploadPath('super.cr2+dsad')); - assert.equal(ext, '.cr2'); - - var ext = path.extname(form._uploadPath('super.bar')); - assert.equal(ext, '.bar'); - }, -}); - -function makeHeader(filename) { - return 'Content-Disposition: form-data; name="upload"; filename="' + filename + '"'; -} diff --git a/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js b/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js deleted file mode 100644 index 9f1cef8..0000000 --- a/node_modules/express/node_modules/connect/node_modules/formidable/tool/record.js +++ /dev/null @@ -1,47 +0,0 @@ -var http = require('http'); -var fs = require('fs'); -var connections = 0; - -var server = http.createServer(function(req, res) { - var socket = req.socket; - console.log('Request: %s %s -> %s', req.method, req.url, socket.filename); - - req.on('end', function() { - if (req.url !== '/') { - res.end(JSON.stringify({ - method: req.method, - url: req.url, - filename: socket.filename, - })); - return; - } - - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - }); -}); - -server.on('connection', function(socket) { - connections++; - - socket.id = connections; - socket.filename = 'connection-' + socket.id + '.http'; - socket.file = fs.createWriteStream(socket.filename); - socket.pipe(socket.file); - - console.log('--> %s', socket.filename); - socket.on('close', function() { - console.log('<-- %s', socket.filename); - }); -}); - -var port = process.env.PORT || 8080; -server.listen(port, function() { - console.log('Recording connections on port %s', port); -}); diff --git a/node_modules/express/node_modules/connect/node_modules/pause/.npmignore b/node_modules/express/node_modules/connect/node_modules/pause/.npmignore deleted file mode 100644 index f1250e5..0000000 --- a/node_modules/express/node_modules/connect/node_modules/pause/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/node_modules/express/node_modules/connect/node_modules/pause/History.md b/node_modules/express/node_modules/connect/node_modules/pause/History.md deleted file mode 100644 index c8aa68f..0000000 --- a/node_modules/express/node_modules/connect/node_modules/pause/History.md +++ /dev/null @@ -1,5 +0,0 @@ - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/express/node_modules/connect/node_modules/pause/Makefile b/node_modules/express/node_modules/connect/node_modules/pause/Makefile deleted file mode 100644 index 4e9c8d3..0000000 --- a/node_modules/express/node_modules/connect/node_modules/pause/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/pause/Readme.md b/node_modules/express/node_modules/connect/node_modules/pause/Readme.md deleted file mode 100644 index 1cdd68a..0000000 --- a/node_modules/express/node_modules/connect/node_modules/pause/Readme.md +++ /dev/null @@ -1,29 +0,0 @@ - -# pause - - Pause streams... - -## License - -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/pause/index.js b/node_modules/express/node_modules/connect/node_modules/pause/index.js deleted file mode 100644 index 1b7b379..0000000 --- a/node_modules/express/node_modules/connect/node_modules/pause/index.js +++ /dev/null @@ -1,29 +0,0 @@ - -module.exports = function(obj){ - var onData - , onEnd - , events = []; - - // buffer data - obj.on('data', onData = function(data, encoding){ - events.push(['data', data, encoding]); - }); - - // buffer end - obj.on('end', onEnd = function(data, encoding){ - events.push(['end', data, encoding]); - }); - - return { - end: function(){ - obj.removeListener('data', onData); - obj.removeListener('end', onEnd); - }, - resume: function(){ - this.end(); - for (var i = 0, len = events.length; i < len; ++i) { - obj.emit.apply(obj, events[i]); - } - } - }; -}; \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/pause/package.json b/node_modules/express/node_modules/connect/node_modules/pause/package.json deleted file mode 100644 index 73cfe40..0000000 --- a/node_modules/express/node_modules/connect/node_modules/pause/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "pause", - "version": "0.0.1", - "description": "Pause streams...", - "keywords": [], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "main": "index", - "readme": "\n# pause\n\n Pause streams...\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "_id": "pause@0.0.1", - "_from": "pause@0.0.1" -} diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules b/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules deleted file mode 100644 index 49e31da..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "support/expresso"] - path = support/expresso - url = git://github.com/visionmedia/expresso.git -[submodule "support/should"] - path = support/should - url = git://github.com/visionmedia/should.js.git diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.npmignore b/node_modules/express/node_modules/connect/node_modules/qs/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml b/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml deleted file mode 100644 index 2c0a8f6..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.4 \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/History.md b/node_modules/express/node_modules/connect/node_modules/qs/History.md deleted file mode 100644 index 1feef45..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/History.md +++ /dev/null @@ -1,83 +0,0 @@ - -0.5.1 / 2012-09-18 -================== - - * fix encoded `=`. Closes #43 - -0.5.0 / 2012-05-04 -================== - - * Added component support - -0.4.2 / 2012-02-08 -================== - - * Fixed: ensure objects are created when appropriate not arrays [aheckmann] - -0.4.1 / 2012-01-26 -================== - - * Fixed stringify()ing numbers. Closes #23 - -0.4.0 / 2011-11-21 -================== - - * Allow parsing of an existing object (for `bodyParser()`) [jackyz] - * Replaced expresso with mocha - -0.3.2 / 2011-11-08 -================== - - * Fixed global variable leak - -0.3.1 / 2011-08-17 -================== - - * Added `try/catch` around malformed uri components - * Add test coverage for Array native method bleed-though - -0.3.0 / 2011-07-19 -================== - - * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart] - -0.2.0 / 2011-06-29 -================== - - * Added `qs.stringify()` [Cory Forsyth] - -0.1.0 / 2011-04-13 -================== - - * Added jQuery-ish array support - -0.0.7 / 2011-03-13 -================== - - * Fixed; handle empty string and `== null` in `qs.parse()` [dmit] - allows for convenient `qs.parse(url.parse(str).query)` - -0.0.6 / 2011-02-14 -================== - - * Fixed; support for implicit arrays - -0.0.4 / 2011-02-09 -================== - - * Fixed `+` as a space - -0.0.3 / 2011-02-08 -================== - - * Fixed case when right-hand value contains "]" - -0.0.2 / 2011-02-07 -================== - - * Fixed "=" presence in key - -0.0.1 / 2011-02-07 -================== - - * Initial release \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/Makefile b/node_modules/express/node_modules/connect/node_modules/qs/Makefile deleted file mode 100644 index 0a21cf7..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/Makefile +++ /dev/null @@ -1,12 +0,0 @@ - -test/browser/qs.js: querystring.js - component build package.json test/browser/qs - -querystring.js: lib/head.js lib/querystring.js lib/tail.js - cat $^ > $@ - -test: - @./node_modules/.bin/mocha \ - --ui bdd - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/Readme.md b/node_modules/express/node_modules/connect/node_modules/qs/Readme.md deleted file mode 100644 index 27e54a4..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/Readme.md +++ /dev/null @@ -1,58 +0,0 @@ -# node-querystring - - query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others. - -## Installation - - $ npm install qs - -## Examples - -```js -var qs = require('qs'); - -qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com'); -// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } } - -qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}) -// => user[name]=Tobi&user[email]=tobi%40learnboost.com -``` - -## Testing - -Install dev dependencies: - - $ npm install -d - -and execute: - - $ make test - -browser: - - $ open test/browser/index.html - -## License - -(The MIT License) - -Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js b/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js deleted file mode 100644 index 97e2c93..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/benchmark.js +++ /dev/null @@ -1,17 +0,0 @@ - -var qs = require('./'); - -var times = 100000 - , start = new Date - , n = times; - -console.log('times: %d', times); - -while (n--) qs.parse('foo=bar'); -console.log('simple: %dms', new Date - start); - -var start = new Date - , n = times; - -while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); -console.log('nested: %dms', new Date - start); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/component.json b/node_modules/express/node_modules/connect/node_modules/qs/component.json deleted file mode 100644 index ba34ead..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/component.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "querystring", - "description": "Querystring parser / stringifier with nesting support", - "keywords": ["querystring", "query", "parser"], - "main": "lib/querystring.js" -} \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/examples.js b/node_modules/express/node_modules/connect/node_modules/qs/examples.js deleted file mode 100644 index 27617b7..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/examples.js +++ /dev/null @@ -1,51 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('./'); - -var obj = qs.parse('foo'); -console.log(obj) - -var obj = qs.parse('foo=bar=baz'); -console.log(obj) - -var obj = qs.parse('users[]'); -console.log(obj) - -var obj = qs.parse('name=tj&email=tj@vision-media.ca'); -console.log(obj) - -var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane'); -console.log(obj) - -var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); -console.log(obj) - -var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk'); -console.log(obj) - -var obj = qs.parse('a=a&a=b&a=c'); -console.log(obj) - -var obj = qs.parse('user[tj]=tj&user[tj]=TJ'); -console.log(obj) - -var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler'); -console.log(obj) - -var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[1]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[foo]=TJ'); -console.log(obj) - -var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}); -console.log(str); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/index.js b/node_modules/express/node_modules/connect/node_modules/qs/index.js deleted file mode 100644 index d177d20..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/querystring'); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js deleted file mode 100644 index 55d3817..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/lib/head.js +++ /dev/null @@ -1 +0,0 @@ -;(function(){ diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js deleted file mode 100644 index d3689bb..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js +++ /dev/null @@ -1,262 +0,0 @@ - -/** - * Object#toString() ref for stringify(). - */ - -var toString = Object.prototype.toString; - -/** - * Cache non-integer test regexp. - */ - -var isint = /^[0-9]+$/; - -function promote(parent, key) { - if (parent[key].length == 0) return parent[key] = {}; - var t = {}; - for (var i in parent[key]) t[i] = parent[key][i]; - parent[key] = t; - return t; -} - -function parse(parts, parent, key, val) { - var part = parts.shift(); - // end - if (!part) { - if (Array.isArray(parent[key])) { - parent[key].push(val); - } else if ('object' == typeof parent[key]) { - parent[key] = val; - } else if ('undefined' == typeof parent[key]) { - parent[key] = val; - } else { - parent[key] = [parent[key], val]; - } - // array - } else { - var obj = parent[key] = parent[key] || []; - if (']' == part) { - if (Array.isArray(obj)) { - if ('' != val) obj.push(val); - } else if ('object' == typeof obj) { - obj[Object.keys(obj).length] = val; - } else { - obj = parent[key] = [parent[key], val]; - } - // prop - } else if (~part.indexOf(']')) { - part = part.substr(0, part.length - 1); - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - // key - } else { - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - } - } -} - -/** - * Merge parent key/val pair. - */ - -function merge(parent, key, val){ - if (~key.indexOf(']')) { - var parts = key.split('[') - , len = parts.length - , last = len - 1; - parse(parts, parent, 'base', val); - // optimize - } else { - if (!isint.test(key) && Array.isArray(parent.base)) { - var t = {}; - for (var k in parent.base) t[k] = parent.base[k]; - parent.base = t; - } - set(parent.base, key, val); - } - - return parent; -} - -/** - * Parse the given obj. - */ - -function parseObject(obj){ - var ret = { base: {} }; - Object.keys(obj).forEach(function(name){ - merge(ret, name, obj[name]); - }); - return ret.base; -} - -/** - * Parse the given str. - */ - -function parseString(str){ - return String(str) - .split('&') - .reduce(function(ret, pair){ - var eql = pair.indexOf('=') - , brace = lastBraceInKey(pair) - , key = pair.substr(0, brace || eql) - , val = pair.substr(brace || eql, pair.length) - , val = val.substr(val.indexOf('=') + 1, val.length); - - // ?foo - if ('' == key) key = pair, val = ''; - - return merge(ret, decode(key), decode(val)); - }, { base: {} }).base; -} - -/** - * Parse the given query `str` or `obj`, returning an object. - * - * @param {String} str | {Object} obj - * @return {Object} - * @api public - */ - -exports.parse = function(str){ - if (null == str || '' == str) return {}; - return 'object' == typeof str - ? parseObject(str) - : parseString(str); -}; - -/** - * Turn the given `obj` into a query string - * - * @param {Object} obj - * @return {String} - * @api public - */ - -var stringify = exports.stringify = function(obj, prefix) { - if (Array.isArray(obj)) { - return stringifyArray(obj, prefix); - } else if ('[object Object]' == toString.call(obj)) { - return stringifyObject(obj, prefix); - } else if ('string' == typeof obj) { - return stringifyString(obj, prefix); - } else { - return prefix + '=' + obj; - } -}; - -/** - * Stringify the given `str`. - * - * @param {String} str - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyString(str, prefix) { - if (!prefix) throw new TypeError('stringify expects an object'); - return prefix + '=' + encodeURIComponent(str); -} - -/** - * Stringify the given `arr`. - * - * @param {Array} arr - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyArray(arr, prefix) { - var ret = []; - if (!prefix) throw new TypeError('stringify expects an object'); - for (var i = 0; i < arr.length; i++) { - ret.push(stringify(arr[i], prefix + '['+i+']')); - } - return ret.join('&'); -} - -/** - * Stringify the given `obj`. - * - * @param {Object} obj - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyObject(obj, prefix) { - var ret = [] - , keys = Object.keys(obj) - , key; - - for (var i = 0, len = keys.length; i < len; ++i) { - key = keys[i]; - ret.push(stringify(obj[key], prefix - ? prefix + '[' + encodeURIComponent(key) + ']' - : encodeURIComponent(key))); - } - - return ret.join('&'); -} - -/** - * Set `obj`'s `key` to `val` respecting - * the weird and wonderful syntax of a qs, - * where "foo=bar&foo=baz" becomes an array. - * - * @param {Object} obj - * @param {String} key - * @param {String} val - * @api private - */ - -function set(obj, key, val) { - var v = obj[key]; - if (undefined === v) { - obj[key] = val; - } else if (Array.isArray(v)) { - v.push(val); - } else { - obj[key] = [v, val]; - } -} - -/** - * Locate last brace in `str` within the key. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function lastBraceInKey(str) { - var len = str.length - , brace - , c; - for (var i = 0; i < len; ++i) { - c = str[i]; - if (']' == c) brace = false; - if ('[' == c) brace = true; - if ('=' == c && !brace) return i; - } -} - -/** - * Decode `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -function decode(str) { - try { - return decodeURIComponent(str.replace(/\+/g, ' ')); - } catch (err) { - return str; - } -} diff --git a/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js b/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js deleted file mode 100644 index 158693a..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js +++ /dev/null @@ -1 +0,0 @@ -})(); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/package.json b/node_modules/express/node_modules/connect/node_modules/qs/package.json deleted file mode 100644 index b0c394b..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "qs", - "description": "querystring parser", - "version": "0.5.1", - "keywords": [ - "query string", - "parser", - "component" - ], - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/node-querystring.git" - }, - "devDependencies": { - "mocha": "*", - "expect.js": "*" - }, - "component": { - "scripts": { - "querystring": "querystring.js" - } - }, - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "main": "index", - "engines": { - "node": "*" - }, - "readme": "# node-querystring\n\n query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.\n\n## Installation\n\n $ npm install qs\n\n## Examples\n\n```js\nvar qs = require('qs');\n\nqs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');\n// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }\n\nqs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})\n// => user[name]=Tobi&user[email]=tobi%40learnboost.com\n```\n\n## Testing\n\nInstall dev dependencies:\n\n $ npm install -d\n\nand execute:\n\n $ make test\n\nbrowser:\n\n $ open test/browser/index.html\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/visionmedia/node-querystring/issues" - }, - "_id": "qs@0.5.1", - "_from": "qs@0.5.1" -} diff --git a/node_modules/express/node_modules/connect/node_modules/qs/querystring.js b/node_modules/express/node_modules/connect/node_modules/qs/querystring.js deleted file mode 100644 index 7466b06..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/querystring.js +++ /dev/null @@ -1,254 +0,0 @@ -;(function(){ - -/** - * Object#toString() ref for stringify(). - */ - -var toString = Object.prototype.toString; - -/** - * Cache non-integer test regexp. - */ - -var isint = /^[0-9]+$/; - -function promote(parent, key) { - if (parent[key].length == 0) return parent[key] = {}; - var t = {}; - for (var i in parent[key]) t[i] = parent[key][i]; - parent[key] = t; - return t; -} - -function parse(parts, parent, key, val) { - var part = parts.shift(); - // end - if (!part) { - if (Array.isArray(parent[key])) { - parent[key].push(val); - } else if ('object' == typeof parent[key]) { - parent[key] = val; - } else if ('undefined' == typeof parent[key]) { - parent[key] = val; - } else { - parent[key] = [parent[key], val]; - } - // array - } else { - var obj = parent[key] = parent[key] || []; - if (']' == part) { - if (Array.isArray(obj)) { - if ('' != val) obj.push(val); - } else if ('object' == typeof obj) { - obj[Object.keys(obj).length] = val; - } else { - obj = parent[key] = [parent[key], val]; - } - // prop - } else if (~part.indexOf(']')) { - part = part.substr(0, part.length - 1); - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - // key - } else { - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - } - } -} - -/** - * Merge parent key/val pair. - */ - -function merge(parent, key, val){ - if (~key.indexOf(']')) { - var parts = key.split('[') - , len = parts.length - , last = len - 1; - parse(parts, parent, 'base', val); - // optimize - } else { - if (!isint.test(key) && Array.isArray(parent.base)) { - var t = {}; - for (var k in parent.base) t[k] = parent.base[k]; - parent.base = t; - } - set(parent.base, key, val); - } - - return parent; -} - -/** - * Parse the given obj. - */ - -function parseObject(obj){ - var ret = { base: {} }; - Object.keys(obj).forEach(function(name){ - merge(ret, name, obj[name]); - }); - return ret.base; -} - -/** - * Parse the given str. - */ - -function parseString(str){ - return String(str) - .split('&') - .reduce(function(ret, pair){ - try{ - pair = decodeURIComponent(pair.replace(/\+/g, ' ')); - } catch(e) { - // ignore - } - - var eql = pair.indexOf('=') - , brace = lastBraceInKey(pair) - , key = pair.substr(0, brace || eql) - , val = pair.substr(brace || eql, pair.length) - , val = val.substr(val.indexOf('=') + 1, val.length); - - // ?foo - if ('' == key) key = pair, val = ''; - - return merge(ret, key, val); - }, { base: {} }).base; -} - -/** - * Parse the given query `str` or `obj`, returning an object. - * - * @param {String} str | {Object} obj - * @return {Object} - * @api public - */ - -exports.parse = function(str){ - if (null == str || '' == str) return {}; - return 'object' == typeof str - ? parseObject(str) - : parseString(str); -}; - -/** - * Turn the given `obj` into a query string - * - * @param {Object} obj - * @return {String} - * @api public - */ - -var stringify = exports.stringify = function(obj, prefix) { - if (Array.isArray(obj)) { - return stringifyArray(obj, prefix); - } else if ('[object Object]' == toString.call(obj)) { - return stringifyObject(obj, prefix); - } else if ('string' == typeof obj) { - return stringifyString(obj, prefix); - } else { - return prefix + '=' + obj; - } -}; - -/** - * Stringify the given `str`. - * - * @param {String} str - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyString(str, prefix) { - if (!prefix) throw new TypeError('stringify expects an object'); - return prefix + '=' + encodeURIComponent(str); -} - -/** - * Stringify the given `arr`. - * - * @param {Array} arr - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyArray(arr, prefix) { - var ret = []; - if (!prefix) throw new TypeError('stringify expects an object'); - for (var i = 0; i < arr.length; i++) { - ret.push(stringify(arr[i], prefix + '['+i+']')); - } - return ret.join('&'); -} - -/** - * Stringify the given `obj`. - * - * @param {Object} obj - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyObject(obj, prefix) { - var ret = [] - , keys = Object.keys(obj) - , key; - - for (var i = 0, len = keys.length; i < len; ++i) { - key = keys[i]; - ret.push(stringify(obj[key], prefix - ? prefix + '[' + encodeURIComponent(key) + ']' - : encodeURIComponent(key))); - } - - return ret.join('&'); -} - -/** - * Set `obj`'s `key` to `val` respecting - * the weird and wonderful syntax of a qs, - * where "foo=bar&foo=baz" becomes an array. - * - * @param {Object} obj - * @param {String} key - * @param {String} val - * @api private - */ - -function set(obj, key, val) { - var v = obj[key]; - if (undefined === v) { - obj[key] = val; - } else if (Array.isArray(v)) { - v.push(val); - } else { - obj[key] = [v, val]; - } -} - -/** - * Locate last brace in `str` within the key. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function lastBraceInKey(str) { - var len = str.length - , brace - , c; - for (var i = 0; i < len; ++i) { - c = str[i]; - if (']' == c) brace = false; - if ('[' == c) brace = true; - if ('=' == c && !brace) return i; - } -} -})(); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js deleted file mode 100644 index 76aa4e8..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js +++ /dev/null @@ -1,1202 +0,0 @@ - -(function (global, module) { - - if ('undefined' == typeof module) { - var module = { exports: {} } - , exports = module.exports - } - - /** - * Exports. - */ - - module.exports = expect; - expect.Assertion = Assertion; - - /** - * Exports version. - */ - - expect.version = '0.1.2'; - - /** - * Possible assertion flags. - */ - - var flags = { - not: ['to', 'be', 'have', 'include', 'only'] - , to: ['be', 'have', 'include', 'only', 'not'] - , only: ['have'] - , have: ['own'] - , be: ['an'] - }; - - function expect (obj) { - return new Assertion(obj); - } - - /** - * Constructor - * - * @api private - */ - - function Assertion (obj, flag, parent) { - this.obj = obj; - this.flags = {}; - - if (undefined != parent) { - this.flags[flag] = true; - - for (var i in parent.flags) { - if (parent.flags.hasOwnProperty(i)) { - this.flags[i] = true; - } - } - } - - var $flags = flag ? flags[flag] : keys(flags) - , self = this - - if ($flags) { - for (var i = 0, l = $flags.length; i < l; i++) { - // avoid recursion - if (this.flags[$flags[i]]) continue; - - var name = $flags[i] - , assertion = new Assertion(this.obj, name, this) - - if ('function' == typeof Assertion.prototype[name]) { - // clone the function, make sure we dont touch the prot reference - var old = this[name]; - this[name] = function () { - return old.apply(self, arguments); - } - - for (var fn in Assertion.prototype) { - if (Assertion.prototype.hasOwnProperty(fn) && fn != name) { - this[name][fn] = bind(assertion[fn], assertion); - } - } - } else { - this[name] = assertion; - } - } - } - }; - - /** - * Performs an assertion - * - * @api private - */ - - Assertion.prototype.assert = function (truth, msg, error) { - var msg = this.flags.not ? error : msg - , ok = this.flags.not ? !truth : truth; - - if (!ok) { - throw new Error(msg); - } - - this.and = new Assertion(this.obj); - }; - - /** - * Check if the value is truthy - * - * @api public - */ - - Assertion.prototype.ok = function () { - this.assert( - !!this.obj - , 'expected ' + i(this.obj) + ' to be truthy' - , 'expected ' + i(this.obj) + ' to be falsy'); - }; - - /** - * Assert that the function throws. - * - * @param {Function|RegExp} callback, or regexp to match error string against - * @api public - */ - - Assertion.prototype.throwError = - Assertion.prototype.throwException = function (fn) { - expect(this.obj).to.be.a('function'); - - var thrown = false - , not = this.flags.not - - try { - this.obj(); - } catch (e) { - if ('function' == typeof fn) { - fn(e); - } else if ('object' == typeof fn) { - var subject = 'string' == typeof e ? e : e.message; - if (not) { - expect(subject).to.not.match(fn); - } else { - expect(subject).to.match(fn); - } - } - thrown = true; - } - - if ('object' == typeof fn && not) { - // in the presence of a matcher, ensure the `not` only applies to - // the matching. - this.flags.not = false; - } - - var name = this.obj.name || 'fn'; - this.assert( - thrown - , 'expected ' + name + ' to throw an exception' - , 'expected ' + name + ' not to throw an exception'); - }; - - /** - * Checks if the array is empty. - * - * @api public - */ - - Assertion.prototype.empty = function () { - var expectation; - - if ('object' == typeof this.obj && null !== this.obj && !isArray(this.obj)) { - if ('number' == typeof this.obj.length) { - expectation = !this.obj.length; - } else { - expectation = !keys(this.obj).length; - } - } else { - if ('string' != typeof this.obj) { - expect(this.obj).to.be.an('object'); - } - - expect(this.obj).to.have.property('length'); - expectation = !this.obj.length; - } - - this.assert( - expectation - , 'expected ' + i(this.obj) + ' to be empty' - , 'expected ' + i(this.obj) + ' to not be empty'); - return this; - }; - - /** - * Checks if the obj exactly equals another. - * - * @api public - */ - - Assertion.prototype.be = - Assertion.prototype.equal = function (obj) { - this.assert( - obj === this.obj - , 'expected ' + i(this.obj) + ' to equal ' + i(obj) - , 'expected ' + i(this.obj) + ' to not equal ' + i(obj)); - return this; - }; - - /** - * Checks if the obj sortof equals another. - * - * @api public - */ - - Assertion.prototype.eql = function (obj) { - this.assert( - expect.eql(obj, this.obj) - , 'expected ' + i(this.obj) + ' to sort of equal ' + i(obj) - , 'expected ' + i(this.obj) + ' to sort of not equal ' + i(obj)); - return this; - }; - - /** - * Assert within start to finish (inclusive). - * - * @param {Number} start - * @param {Number} finish - * @api public - */ - - Assertion.prototype.within = function (start, finish) { - var range = start + '..' + finish; - this.assert( - this.obj >= start && this.obj <= finish - , 'expected ' + i(this.obj) + ' to be within ' + range - , 'expected ' + i(this.obj) + ' to not be within ' + range); - return this; - }; - - /** - * Assert typeof / instance of - * - * @api public - */ - - Assertion.prototype.a = - Assertion.prototype.an = function (type) { - if ('string' == typeof type) { - // proper english in error msg - var n = /^[aeiou]/.test(type) ? 'n' : ''; - - // typeof with support for 'array' - this.assert( - 'array' == type ? isArray(this.obj) : - 'object' == type - ? 'object' == typeof this.obj && null !== this.obj - : type == typeof this.obj - , 'expected ' + i(this.obj) + ' to be a' + n + ' ' + type - , 'expected ' + i(this.obj) + ' not to be a' + n + ' ' + type); - } else { - // instanceof - var name = type.name || 'supplied constructor'; - this.assert( - this.obj instanceof type - , 'expected ' + i(this.obj) + ' to be an instance of ' + name - , 'expected ' + i(this.obj) + ' not to be an instance of ' + name); - } - - return this; - }; - - /** - * Assert numeric value above _n_. - * - * @param {Number} n - * @api public - */ - - Assertion.prototype.greaterThan = - Assertion.prototype.above = function (n) { - this.assert( - this.obj > n - , 'expected ' + i(this.obj) + ' to be above ' + n - , 'expected ' + i(this.obj) + ' to be below ' + n); - return this; - }; - - /** - * Assert numeric value below _n_. - * - * @param {Number} n - * @api public - */ - - Assertion.prototype.lessThan = - Assertion.prototype.below = function (n) { - this.assert( - this.obj < n - , 'expected ' + i(this.obj) + ' to be below ' + n - , 'expected ' + i(this.obj) + ' to be above ' + n); - return this; - }; - - /** - * Assert string value matches _regexp_. - * - * @param {RegExp} regexp - * @api public - */ - - Assertion.prototype.match = function (regexp) { - this.assert( - regexp.exec(this.obj) - , 'expected ' + i(this.obj) + ' to match ' + regexp - , 'expected ' + i(this.obj) + ' not to match ' + regexp); - return this; - }; - - /** - * Assert property "length" exists and has value of _n_. - * - * @param {Number} n - * @api public - */ - - Assertion.prototype.length = function (n) { - expect(this.obj).to.have.property('length'); - var len = this.obj.length; - this.assert( - n == len - , 'expected ' + i(this.obj) + ' to have a length of ' + n + ' but got ' + len - , 'expected ' + i(this.obj) + ' to not have a length of ' + len); - return this; - }; - - /** - * Assert property _name_ exists, with optional _val_. - * - * @param {String} name - * @param {Mixed} val - * @api public - */ - - Assertion.prototype.property = function (name, val) { - if (this.flags.own) { - this.assert( - Object.prototype.hasOwnProperty.call(this.obj, name) - , 'expected ' + i(this.obj) + ' to have own property ' + i(name) - , 'expected ' + i(this.obj) + ' to not have own property ' + i(name)); - return this; - } - - if (this.flags.not && undefined !== val) { - if (undefined === this.obj[name]) { - throw new Error(i(this.obj) + ' has no property ' + i(name)); - } - } else { - var hasProp; - try { - hasProp = name in this.obj - } catch (e) { - hasProp = undefined !== this.obj[name] - } - - this.assert( - hasProp - , 'expected ' + i(this.obj) + ' to have a property ' + i(name) - , 'expected ' + i(this.obj) + ' to not have a property ' + i(name)); - } - - if (undefined !== val) { - this.assert( - val === this.obj[name] - , 'expected ' + i(this.obj) + ' to have a property ' + i(name) - + ' of ' + i(val) + ', but got ' + i(this.obj[name]) - , 'expected ' + i(this.obj) + ' to not have a property ' + i(name) - + ' of ' + i(val)); - } - - this.obj = this.obj[name]; - return this; - }; - - /** - * Assert that the array contains _obj_ or string contains _obj_. - * - * @param {Mixed} obj|string - * @api public - */ - - Assertion.prototype.string = - Assertion.prototype.contain = function (obj) { - if ('string' == typeof this.obj) { - this.assert( - ~this.obj.indexOf(obj) - , 'expected ' + i(this.obj) + ' to contain ' + i(obj) - , 'expected ' + i(this.obj) + ' to not contain ' + i(obj)); - } else { - this.assert( - ~indexOf(this.obj, obj) - , 'expected ' + i(this.obj) + ' to contain ' + i(obj) - , 'expected ' + i(this.obj) + ' to not contain ' + i(obj)); - } - return this; - }; - - /** - * Assert exact keys or inclusion of keys by using - * the `.own` modifier. - * - * @param {Array|String ...} keys - * @api public - */ - - Assertion.prototype.key = - Assertion.prototype.keys = function ($keys) { - var str - , ok = true; - - $keys = isArray($keys) - ? $keys - : Array.prototype.slice.call(arguments); - - if (!$keys.length) throw new Error('keys required'); - - var actual = keys(this.obj) - , len = $keys.length; - - // Inclusion - ok = every($keys, function (key) { - return ~indexOf(actual, key); - }); - - // Strict - if (!this.flags.not && this.flags.only) { - ok = ok && $keys.length == actual.length; - } - - // Key string - if (len > 1) { - $keys = map($keys, function (key) { - return i(key); - }); - var last = $keys.pop(); - str = $keys.join(', ') + ', and ' + last; - } else { - str = i($keys[0]); - } - - // Form - str = (len > 1 ? 'keys ' : 'key ') + str; - - // Have / include - str = (!this.flags.only ? 'include ' : 'only have ') + str; - - // Assertion - this.assert( - ok - , 'expected ' + i(this.obj) + ' to ' + str - , 'expected ' + i(this.obj) + ' to not ' + str); - - return this; - }; - - /** - * Function bind implementation. - */ - - function bind (fn, scope) { - return function () { - return fn.apply(scope, arguments); - } - } - - /** - * Array every compatibility - * - * @see bit.ly/5Fq1N2 - * @api public - */ - - function every (arr, fn, thisObj) { - var scope = thisObj || global; - for (var i = 0, j = arr.length; i < j; ++i) { - if (!fn.call(scope, arr[i], i, arr)) { - return false; - } - } - return true; - }; - - /** - * Array indexOf compatibility. - * - * @see bit.ly/a5Dxa2 - * @api public - */ - - function indexOf (arr, o, i) { - if (Array.prototype.indexOf) { - return Array.prototype.indexOf.call(arr, o, i); - } - - if (arr.length === undefined) { - return -1; - } - - for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0 - ; i < j && arr[i] !== o; i++); - - return j <= i ? -1 : i; - }; - - /** - * Inspects an object. - * - * @see taken from node.js `util` module (copyright Joyent, MIT license) - * @api private - */ - - function i (obj, showHidden, depth) { - var seen = []; - - function stylize (str) { - return str; - }; - - function format (value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (value && typeof value.inspect === 'function' && - // Filter out the util module, it's inspect function is special - value !== exports && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - return value.inspect(recurseTimes); - } - - // Primitive types cannot have properties - switch (typeof value) { - case 'undefined': - return stylize('undefined', 'undefined'); - - case 'string': - var simple = '\'' + json.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return stylize(simple, 'string'); - - case 'number': - return stylize('' + value, 'number'); - - case 'boolean': - return stylize('' + value, 'boolean'); - } - // For some reason typeof null is "object", so special case here. - if (value === null) { - return stylize('null', 'null'); - } - - // Look up the keys of the object. - var visible_keys = keys(value); - var $keys = showHidden ? Object.getOwnPropertyNames(value) : visible_keys; - - // Functions without properties can be shortcutted. - if (typeof value === 'function' && $keys.length === 0) { - if (isRegExp(value)) { - return stylize('' + value, 'regexp'); - } else { - var name = value.name ? ': ' + value.name : ''; - return stylize('[Function' + name + ']', 'special'); - } - } - - // Dates without properties can be shortcutted - if (isDate(value) && $keys.length === 0) { - return stylize(value.toUTCString(), 'date'); - } - - var base, type, braces; - // Determine the object type - if (isArray(value)) { - type = 'Array'; - braces = ['[', ']']; - } else { - type = 'Object'; - braces = ['{', '}']; - } - - // Make functions say that they are functions - if (typeof value === 'function') { - var n = value.name ? ': ' + value.name : ''; - base = (isRegExp(value)) ? ' ' + value : ' [Function' + n + ']'; - } else { - base = ''; - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + value.toUTCString(); - } - - if ($keys.length === 0) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return stylize('' + value, 'regexp'); - } else { - return stylize('[Object]', 'special'); - } - } - - seen.push(value); - - var output = map($keys, function (key) { - var name, str; - if (value.__lookupGetter__) { - if (value.__lookupGetter__(key)) { - if (value.__lookupSetter__(key)) { - str = stylize('[Getter/Setter]', 'special'); - } else { - str = stylize('[Getter]', 'special'); - } - } else { - if (value.__lookupSetter__(key)) { - str = stylize('[Setter]', 'special'); - } - } - } - if (indexOf(visible_keys, key) < 0) { - name = '[' + key + ']'; - } - if (!str) { - if (indexOf(seen, value[key]) < 0) { - if (recurseTimes === null) { - str = format(value[key]); - } else { - str = format(value[key], recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (isArray(value)) { - str = map(str.split('\n'), function (line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + map(str.split('\n'), function (line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = stylize('[Circular]', 'special'); - } - } - if (typeof name === 'undefined') { - if (type === 'Array' && key.match(/^\d+$/)) { - return str; - } - name = json.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = stylize(name, 'string'); - } - } - - return name + ': ' + str; - }); - - seen.pop(); - - var numLinesEst = 0; - var length = reduce(output, function (prev, cur) { - numLinesEst++; - if (indexOf(cur, '\n') >= 0) numLinesEst++; - return prev + cur.length + 1; - }, 0); - - if (length > 50) { - output = braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - - } else { - output = braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; - } - - return output; - } - return format(obj, (typeof depth === 'undefined' ? 2 : depth)); - }; - - function isArray (ar) { - return Object.prototype.toString.call(ar) == '[object Array]'; - }; - - function isRegExp(re) { - var s = '' + re; - return re instanceof RegExp || // easy case - // duck-type for context-switching evalcx case - typeof(re) === 'function' && - re.constructor.name === 'RegExp' && - re.compile && - re.test && - re.exec && - s.match(/^\/.*\/[gim]{0,3}$/); - }; - - function isDate(d) { - if (d instanceof Date) return true; - return false; - }; - - function keys (obj) { - if (Object.keys) { - return Object.keys(obj); - } - - var keys = []; - - for (var i in obj) { - if (Object.prototype.hasOwnProperty.call(obj, i)) { - keys.push(i); - } - } - - return keys; - } - - function map (arr, mapper, that) { - if (Array.prototype.map) { - return Array.prototype.map.call(arr, mapper, that); - } - - var other= new Array(arr.length); - - for (var i= 0, n = arr.length; i= 2) { - var rv = arguments[1]; - } else { - do { - if (i in this) { - rv = this[i++]; - break; - } - - // if array contains no values, no initial value to return - if (++i >= len) - throw new TypeError(); - } while (true); - } - - for (; i < len; i++) { - if (i in this) - rv = fun.call(null, rv, this[i], i, this); - } - - return rv; - }; - - /** - * Asserts deep equality - * - * @see taken from node.js `assert` module (copyright Joyent, MIT license) - * @api private - */ - - expect.eql = function eql (actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - } else if ('undefined' != typeof Buffer - && Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - // 7.3. Other pairs that do not both pass typeof value == "object", - // equivalence is determined by ==. - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - // 7.4. For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical "prototype" property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } - } - - function isUndefinedOrNull (value) { - return value === null || value === undefined; - } - - function isArguments (object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; - } - - function objEquiv (a, b) { - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) - return false; - // an identical "prototype" property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return expect.eql(a, b); - } - try{ - var ka = keys(a), - kb = keys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!expect.eql(a[key], b[key])) - return false; - } - return true; - } - - var json = (function () { - "use strict"; - - if ('object' == typeof JSON && JSON.parse && JSON.stringify) { - return { - parse: nativeJSON.parse - , stringify: nativeJSON.stringify - } - } - - var JSON = {}; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - function date(d, key) { - return isFinite(d.valueOf()) ? - d.getUTCFullYear() + '-' + - f(d.getUTCMonth() + 1) + '-' + - f(d.getUTCDate()) + 'T' + - f(d.getUTCHours()) + ':' + - f(d.getUTCMinutes()) + ':' + - f(d.getUTCSeconds()) + 'Z' : null; - }; - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - - // If the string contains no control characters, no quote characters, and no - // backslash characters, then we can safely slap some quotes around it. - // Otherwise we must also replace the offending characters with safe escape - // sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' ? c : - '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : '"' + string + '"'; - } - - - function str(key, holder) { - - // Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; - - // If the value has a toJSON method, call it to obtain a replacement value. - - if (value instanceof Date) { - value = date(key); - } - - // If we were called with a replacer function, then call the replacer to - // obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - - // What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - - // JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - - // If the value is a boolean or null, convert it to a string. Note: - // typeof null does not produce 'null'. The case is included here in - // the remote chance that this gets fixed someday. - - return String(value); - - // If the type is 'object', we might be dealing with an object or an array or - // null. - - case 'object': - - // Due to a specification blunder in ECMAScript, typeof null is 'object', - // so watch out for that case. - - if (!value) { - return 'null'; - } - - // Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - - // Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - - // The value is an array. Stringify every element. Use null as a placeholder - // for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - - // Join all of the elements together, separated with commas, and wrap them in - // brackets. - - v = partial.length === 0 ? '[]' : gap ? - '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : - '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - - // If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - if (typeof rep[i] === 'string') { - k = rep[i]; - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - - // Otherwise, iterate through all of the keys in the object. - - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - - // Join all of the member texts together, separated with commas, - // and wrap them in braces. - - v = partial.length === 0 ? '{}' : gap ? - '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : - '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - - // If the JSON object does not yet have a stringify method, give it one. - - JSON.stringify = function (value, replacer, space) { - - // The stringify method takes a value and an optional replacer, and an optional - // space parameter, and returns a JSON text. The replacer can be a function - // that can replace values, or an array of strings that will select the keys. - // A default replacer method can be provided. Use of the space parameter can - // produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - - // If the space parameter is a number, make an indent string containing that - // many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - - // If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - - // If there is a replacer, it must be a function or an array. - // Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - - // Make a fake root object containing our value under the key of ''. - // Return the result of stringifying the value. - - return str('', {'': value}); - }; - - // If the JSON object does not yet have a parse method, give it one. - - JSON.parse = function (text, reviver) { - // The parse method takes a text and an optional reviver function, and returns - // a JavaScript value if the text is a valid JSON text. - - var j; - - function walk(holder, key) { - - // The walk method is used to recursively walk the resulting structure so - // that modifications can be made. - - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.prototype.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - } - - - // Parsing happens in four stages. In the first stage, we replace certain - // Unicode characters with escape sequences. JavaScript handles many characters - // incorrectly, either silently deleting them, or treating them as line endings. - - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - - // In the second stage, we run the text against regular expressions that look - // for non-JSON patterns. We are especially concerned with '()' and 'new' - // because they can cause invocation, and '=' because it can cause mutation. - // But just to be safe, we want to reject all unexpected forms. - - // We split the second stage into 4 regexp operations in order to work around - // crippling inefficiencies in IE's and Safari's regexp engines. First we - // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we - // replace all simple value tokens with ']' characters. Third, we delete all - // open brackets that follow a colon or comma or that begin the text. Finally, - // we look to see that the remaining characters are only whitespace or ']' or - // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ - .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') - .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') - .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - - // In the third stage we use the eval function to compile the text into a - // JavaScript structure. The '{' operator is subject to a syntactic ambiguity - // in JavaScript: it can begin a block or an object literal. We wrap the text - // in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - - // In the optional fourth stage, we recursively walk the new structure, passing - // each name/value pair to a reviver function for possible transformation. - - return typeof reviver === 'function' ? - walk({'': j}, '') : j; - } - - // If the text is not JSON parseable, then a SyntaxError is thrown. - - throw new SyntaxError('JSON.parse'); - }; - - return JSON; - })(); - - if ('undefined' != typeof window) { - window.expect = module.exports; - } - -})( - this - , 'undefined' != typeof module ? module : {} - , 'undefined' != typeof exports ? exports : {} -); \ No newline at end of file diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html deleted file mode 100644 index c73147a..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - Mocha - - - - - - - - - - - - -
    - - diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js deleted file mode 100644 index f3201aa..0000000 --- a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js +++ /dev/null @@ -1,8981 +0,0 @@ -/*! - * jQuery JavaScript Library v1.6.2 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Thu Jun 30 14:16:56 2011 -0400 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // (both of which we optimize for) - quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Check for digits - rdigit = /\d/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z])/ig, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = (context ? context.ownerDocument || context : document); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return (context || rootjQuery).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if (selector.selector !== undefined) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.6.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + (this.selector ? " " : "") + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.done( fn ); - - return this; - }, - - eq: function( i ) { - return i === -1 ? - this.slice( i ) : - this.slice( i, +i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).unbind( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery._Deferred(); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNaN: function( obj ) { - return obj == null || !rdigit.test( obj ) || isNaN( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw msg; - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return (new Function( "return " + data ))(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - // (xml & tmp used internally) - parseXML: function( data , xml , tmp ) { - - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - - tmp = xml.documentElement; - - if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) { - jQuery.error( "Invalid XML: " + data ); - } - - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Converts a dashed string to camelCased string; - // Used by both the css and data modules - camelCase: function( string ) { - return string.replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // The extra typeof function check is to prevent crashes - // in Safari 2 (See: #3039) - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array ) { - - if ( indexOf ) { - return indexOf.call( array, elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return (new Date()).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -var // Promise methods - promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ), - // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - // Create a simple deferred (one callbacks list) - _Deferred: function() { - var // callbacks list - callbacks = [], - // stored [ context , args ] - fired, - // to avoid firing when already doing so - firing, - // flag to know if the deferred has been cancelled - cancelled, - // the deferred itself - deferred = { - - // done( f1, f2, ...) - done: function() { - if ( !cancelled ) { - var args = arguments, - i, - length, - elem, - type, - _fired; - if ( fired ) { - _fired = fired; - fired = 0; - } - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - deferred.done.apply( deferred, elem ); - } else if ( type === "function" ) { - callbacks.push( elem ); - } - } - if ( _fired ) { - deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); - } - } - return this; - }, - - // resolve with given context and args - resolveWith: function( context, args ) { - if ( !cancelled && !fired && !firing ) { - // make sure args are available (#8421) - args = args || []; - firing = 1; - try { - while( callbacks[ 0 ] ) { - callbacks.shift().apply( context, args ); - } - } - finally { - fired = [ context, args ]; - firing = 0; - } - } - return this; - }, - - // resolve with this as context and given arguments - resolve: function() { - deferred.resolveWith( this, arguments ); - return this; - }, - - // Has this deferred been resolved? - isResolved: function() { - return !!( firing || fired ); - }, - - // Cancel - cancel: function() { - cancelled = 1; - callbacks = []; - return this; - } - }; - - return deferred; - }, - - // Full fledged deferred (two callbacks list) - Deferred: function( func ) { - var deferred = jQuery._Deferred(), - failDeferred = jQuery._Deferred(), - promise; - // Add errorDeferred methods, then and promise - jQuery.extend( deferred, { - then: function( doneCallbacks, failCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ); - return this; - }, - always: function() { - return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments ); - }, - fail: failDeferred.done, - rejectWith: failDeferred.resolveWith, - reject: failDeferred.resolve, - isRejected: failDeferred.isResolved, - pipe: function( fnDone, fnFail ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject ); - } else { - newDefer[ action ]( returned ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - if ( promise ) { - return promise; - } - promise = obj = {}; - } - var i = promiseMethods.length; - while( i-- ) { - obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; - } - return obj; - } - }); - // Make sure only one callback list will be used - deferred.done( failDeferred.cancel ).fail( deferred.cancel ); - // Unexpose cancel - delete deferred.cancel; - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = arguments, - i = 0, - length = args.length, - count = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - // Strange bug in FF4: - // Values changed onto the arguments object sometimes end up as undefined values - // outside the $.when method. Cloning the object into a fresh array solves the issue - deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) ); - } - }; - } - if ( length > 1 ) { - for( ; i < length; i++ ) { - if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return deferred.promise(); - } -}); - - - -jQuery.support = (function() { - - var div = document.createElement( "div" ), - documentElement = document.documentElement, - all, - a, - select, - opt, - input, - marginDiv, - support, - fragment, - body, - testElementParent, - testElement, - testElementStyle, - tds, - events, - eventName, - i, - isSupported; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
    a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName( "tbody" ).length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName( "link" ).length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute( "href" ) === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55$/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains it's value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.firstChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - div.innerHTML = ""; - - // Figure out if the W3C box model works as expected - div.style.width = div.style.paddingLeft = "1px"; - - body = document.getElementsByTagName( "body" )[ 0 ]; - // We use our own, invisible, body unless the body is already present - // in which case we use a div (#9239) - testElement = document.createElement( body ? "div" : "body" ); - testElementStyle = { - visibility: "hidden", - width: 0, - height: 0, - border: 0, - margin: 0 - }; - if ( body ) { - jQuery.extend( testElementStyle, { - position: "absolute", - left: -1000, - top: -1000 - }); - } - for ( i in testElementStyle ) { - testElement.style[ i ] = testElementStyle[ i ]; - } - testElement.appendChild( div ); - testElementParent = body || documentElement; - testElementParent.insertBefore( testElement, testElementParent.firstChild ); - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - support.boxModel = div.offsetWidth === 2; - - if ( "zoom" in div.style ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
    "; - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); - } - - div.innerHTML = "
    t
    "; - tds = div.getElementsByTagName( "td" ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE < 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - div.innerHTML = ""; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( document.defaultView && document.defaultView.getComputedStyle ) { - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - // Remove the body element we added - testElement.innerHTML = ""; - testElementParent.removeChild( testElement ); - - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for( i in { - submit: 1, - change: 1, - focusin: 1 - } ) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - // Null connected elements to avoid leaks in IE - testElement = fragment = select = opt = body = marginDiv = div = input = null; - - return support; -})(); - -// Keep track of boxModel -jQuery.boxModel = jQuery.support.boxModel; - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([a-z])([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache, - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ jQuery.expando ] = id = ++jQuery.uuid; - } else { - id = jQuery.expando; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery - // metadata on plain JS objects when the object is serialized using - // JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); - } else { - cache[ id ] = jQuery.extend(cache[ id ], name); - } - } - - thisCache = cache[ id ]; - - // Internal jQuery data is stored in a separate object inside the object's data - // cache in order to avoid key collisions between internal data and user-defined - // data - if ( pvt ) { - if ( !thisCache[ internalKey ] ) { - thisCache[ internalKey ] = {}; - } - - thisCache = thisCache[ internalKey ]; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should - // not attempt to inspect the internal events object using jQuery.data, as this - // internal data object is undocumented and subject to change. - if ( name === "events" && !thisCache[name] ) { - return thisCache[ internalKey ] && thisCache[ internalKey ].events; - } - - return getByName ? - // Check for both converted-to-camel and non-converted data property names - thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] : - thisCache; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var internalKey = jQuery.expando, isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; - - if ( thisCache ) { - delete thisCache[ name ]; - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !isEmptyDataObject(thisCache) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( pvt ) { - delete cache[ id ][ internalKey ]; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - var internalCache = cache[ id ][ internalKey ]; - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - if ( jQuery.support.deleteExpando || cache != window ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the entire user cache at once because it's faster than - // iterating through each key, but we need to continue to persist internal - // data if it existed - if ( internalCache ) { - cache[ id ] = {}; - // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery - // metadata on plain JS objects when the object is serialized using - // JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - - cache[ id ][ internalKey ] = internalCache; - - // Otherwise, we need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - } else if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ jQuery.expando ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( jQuery.expando ); - } else { - elem[ jQuery.expando ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var data = null; - - if ( typeof key === "undefined" ) { - if ( this.length ) { - data = jQuery.data( this[0] ); - - if ( this[0].nodeType === 1 ) { - var attr = this[0].attributes, name; - for ( var i = 0, l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( this[0], name, data[ name ] ); - } - } - } - } - - return data; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - var parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - data = dataAttr( this[0], key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var $this = jQuery( this ), - args = [ parts[0], value ]; - - $this.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - $this.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - !jQuery.isNaN( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON -// property to be considered empty objects; this property always exists in -// order to make sure JSON.stringify does not expose internal metadata -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery.data( elem, deferDataKey, undefined, true ); - if ( defer && - ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) && - ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery.data( elem, queueDataKey, undefined, true ) && - !jQuery.data( elem, markDataKey, undefined, true ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.resolve(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = (type || "fx") + "mark"; - jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 ); - if ( count ) { - jQuery.data( elem, key, count, true ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - if ( elem ) { - type = (type || "fx") + "queue"; - var q = jQuery.data( elem, type, undefined, true ); - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery.data( elem, type, jQuery.makeArray(data), true ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - defer; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift("inprogress"); - } - - fn.call(elem, function() { - jQuery.dequeue(elem, type); - }); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; - type = type || "fx"; - - return this.queue( type, function() { - var elem = this; - setTimeout(function() { - jQuery.dequeue( elem, type ); - }, time ); - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) { - count++; - tmp.done( resolve ); - } - } - resolve(); - return defer.promise(); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - rinvalidChar = /\:|^on/, - formHook, boolHook; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.prop ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = (value || "").split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " "; - for ( var i = 0, l = this.length; i < l; i++ ) { - if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return undefined; - } - - var isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { - var option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attrFix: { - // Always normalize to ensure hook usage - tabindex: "tabIndex" - }, - - attr: function( elem, name, value, pass ) { - var nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return undefined; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( !("getAttribute" in elem) ) { - return jQuery.prop( elem, name, value ); - } - - var ret, hooks, - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // Normalize the name if needed - if ( notxml ) { - name = jQuery.attrFix[ name ] || name; - - hooks = jQuery.attrHooks[ name ]; - - if ( !hooks ) { - // Use boolHook for boolean attributes - if ( rboolean.test( name ) ) { - - hooks = boolHook; - - // Use formHook for forms and if the name contains certain characters - } else if ( formHook && name !== "className" && - (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) { - - hooks = formHook; - } - } - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return undefined; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, name ) { - var propName; - if ( elem.nodeType === 1 ) { - name = jQuery.attrFix[ name ] || name; - - if ( jQuery.support.getSetAttribute ) { - // Use removeAttribute in browsers that support it - elem.removeAttribute( name ); - } else { - jQuery.attr( elem, name, "" ); - elem.removeAttributeNode( elem.getAttributeNode( name ) ); - } - - // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) { - elem[ propName ] = false; - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabIndex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - }, - // Use the value property for back compat - // Use the formHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( formHook && jQuery.nodeName( elem, "button" ) ) { - return formHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( formHook && jQuery.nodeName( elem, "button" ) ) { - return formHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return undefined; - } - - var ret, hooks, - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return (elem[ name ] = value); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: {} -}); - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - return jQuery.prop( elem, name ) ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !jQuery.support.getSetAttribute ) { - - // propFix is more comprehensive and contains all fixes - jQuery.attrFix = jQuery.propFix; - - // Use this for any attribute on a form in IE6/7 - formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - // Return undefined if nodeValue is empty string - return ret && ret.nodeValue !== "" ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Check form objects in IE (multiple bugs related) - // Only use nodeValue if the attribute node exists on the form - var ret = elem.getAttributeNode( name ); - if ( ret ) { - ret.nodeValue = value; - return value; - } - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return (elem.style.cssText = "" + value); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }); -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0); - } - } - }); -}); - - - - -var rnamespaces = /\.(.*)$/, - rformElems = /^(?:textarea|input|select)$/i, - rperiod = /\./g, - rspaces = / /g, - rescape = /[^\w\s.|`]/g, - fcleanup = function( nm ) { - return nm.replace(rescape, "\\$&"); - }; - -/* - * A number of helper functions used for managing events. - * Many of the ideas behind this code originated from - * Dean Edwards' addEvent library. - */ -jQuery.event = { - - // Bind an event to an element - // Original by Dean Edwards - add: function( elem, types, handler, data ) { - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - if ( handler === false ) { - handler = returnFalse; - } else if ( !handler ) { - // Fixes bug #7229. Fix recommended by jdalton - return; - } - - var handleObjIn, handleObj; - - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the function being executed has a unique ID - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure - var elemData = jQuery._data( elem ); - - // If no elemData is found then we must be trying to bind to one of the - // banned noData elements - if ( !elemData ) { - return; - } - - var events = elemData.events, - eventHandle = elemData.handle; - - if ( !events ) { - elemData.events = events = {}; - } - - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.handle.apply( eventHandle.elem, arguments ) : - undefined; - }; - } - - // Add elem as a property of the handle function - // This is to prevent a memory leak with non-native events in IE. - eventHandle.elem = elem; - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = types.split(" "); - - var type, i = 0, namespaces; - - while ( (type = types[ i++ ]) ) { - handleObj = handleObjIn ? - jQuery.extend({}, handleObjIn) : - { handler: handler, data: data }; - - // Namespaced event handlers - if ( type.indexOf(".") > -1 ) { - namespaces = type.split("."); - type = namespaces.shift(); - handleObj.namespace = namespaces.slice(0).sort().join("."); - - } else { - namespaces = []; - handleObj.namespace = ""; - } - - handleObj.type = type; - if ( !handleObj.guid ) { - handleObj.guid = handler.guid; - } - - // Get the current list of functions bound to this event - var handlers = events[ type ], - special = jQuery.event.special[ type ] || {}; - - // Init the event handler queue - if ( !handlers ) { - handlers = events[ type ] = []; - - // Check for a special event handler - // Only use addEventListener/attachEvent if the special - // events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add the function to the element's handler list - handlers.push( handleObj ); - - // Keep track of which events have been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, pos ) { - // don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - if ( handler === false ) { - handler = returnFalse; - } - - var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - events = elemData && elemData.events; - - if ( !elemData || !events ) { - return; - } - - // types is actually an event object here - if ( types && types.type ) { - handler = types.handler; - types = types.type; - } - - // Unbind all events for the element - if ( !types || typeof types === "string" && types.charAt(0) === "." ) { - types = types || ""; - - for ( type in events ) { - jQuery.event.remove( elem, type + types ); - } - - return; - } - - // Handle multiple events separated by a space - // jQuery(...).unbind("mouseover mouseout", fn); - types = types.split(" "); - - while ( (type = types[ i++ ]) ) { - origType = type; - handleObj = null; - all = type.indexOf(".") < 0; - namespaces = []; - - if ( !all ) { - // Namespaced event handlers - namespaces = type.split("."); - type = namespaces.shift(); - - namespace = new RegExp("(^|\\.)" + - jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - eventType = events[ type ]; - - if ( !eventType ) { - continue; - } - - if ( !handler ) { - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( all || namespace.test( handleObj.namespace ) ) { - jQuery.event.remove( elem, origType, handleObj.handler, j ); - eventType.splice( j--, 1 ); - } - } - - continue; - } - - special = jQuery.event.special[ type ] || {}; - - for ( j = pos || 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( handler.guid === handleObj.guid ) { - // remove the given handler for the given type - if ( all || namespace.test( handleObj.namespace ) ) { - if ( pos == null ) { - eventType.splice( j--, 1 ); - } - - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - - if ( pos != null ) { - break; - } - } - } - - // remove generic event handler if no more handlers exist - if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - ret = null; - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - var handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - delete elemData.events; - delete elemData.handle; - - if ( jQuery.isEmptyObject( elemData ) ) { - jQuery.removeData( elem, undefined, true ); - } - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Event object or event type - var type = event.type || event, - namespaces = [], - exclusive; - - if ( type.indexOf("!") >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.exclusive = exclusive; - event.namespace = namespaces.join("."); - event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); - - // triggerHandler() and global events don't bubble or run the default action - if ( onlyHandlers || !elem ) { - event.preventDefault(); - event.stopPropagation(); - } - - // Handle a global trigger - if ( !elem ) { - // TODO: Stop taunting the data cache; remove global events and always attach to document - jQuery.each( jQuery.cache, function() { - // internalKey variable is just used to make it easier to find - // and potentially change this stuff later; currently it just - // points to jQuery.expando - var internalKey = jQuery.expando, - internalCache = this[ internalKey ]; - if ( internalCache && internalCache.events && internalCache.events[ type ] ) { - jQuery.event.trigger( event, data, internalCache.handle.elem ); - } - }); - return; - } - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - event.target = elem; - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - var cur = elem, - // IE doesn't like method names with a colon (#3533, #8272) - ontype = type.indexOf(":") < 0 ? "on" + type : ""; - - // Fire event on the current element, then bubble up the DOM tree - do { - var handle = jQuery._data( cur, "handle" ); - - event.currentTarget = cur; - if ( handle ) { - handle.apply( cur, data ); - } - - // Trigger an inline bound script - if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) { - event.result = false; - event.preventDefault(); - } - - // Bubble up to document, then to window - cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window; - } while ( cur && !event.isPropagationStopped() ); - - // If nobody prevented the default action, do it now - if ( !event.isDefaultPrevented() ) { - var old, - special = jQuery.event.special[ type ] || {}; - - if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction)() check here because IE6/7 fails that test. - // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch. - try { - if ( ontype && elem[ type ] ) { - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - jQuery.event.triggered = type; - elem[ type ](); - } - } catch ( ieError ) {} - - if ( old ) { - elem[ ontype ] = old; - } - - jQuery.event.triggered = undefined; - } - } - - return event.result; - }, - - handle: function( event ) { - event = jQuery.event.fix( event || window.event ); - // Snapshot the handlers list since a called handler may add/remove events. - var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0), - run_all = !event.exclusive && !event.namespace, - args = Array.prototype.slice.call( arguments, 0 ); - - // Use the fix-ed Event rather than the (read-only) native event - args[0] = event; - event.currentTarget = this; - - for ( var j = 0, l = handlers.length; j < l; j++ ) { - var handleObj = handlers[ j ]; - - // Triggered event must 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event. - if ( run_all || event.namespace_re.test( handleObj.namespace ) ) { - // Pass in a reference to the handler function itself - // So that we can later remove it - event.handler = handleObj.handler; - event.data = handleObj.data; - event.handleObj = handleObj; - - var ret = handleObj.handler.apply( this, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - return event.result; - }, - - props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // store a copy of the original event object - // and "clone" to set read-only properties - var originalEvent = event; - event = jQuery.Event( originalEvent ); - - for ( var i = this.props.length, prop; i; ) { - prop = this.props[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary - if ( !event.target ) { - // Fixes #1925 where srcElement might not be defined either - event.target = event.srcElement || document; - } - - // check if target is a textnode (safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && event.fromElement ) { - event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; - } - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && event.clientX != null ) { - var eventDocument = event.target.ownerDocument || document, - doc = eventDocument.documentElement, - body = eventDocument.body; - - event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } - - // Add which for key events - if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { - event.which = event.charCode != null ? event.charCode : event.keyCode; - } - - // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) - if ( !event.metaKey && event.ctrlKey ) { - event.metaKey = event.ctrlKey; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && event.button !== undefined ) { - event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); - } - - return event; - }, - - // Deprecated, use jQuery.guid instead - guid: 1E8, - - // Deprecated, use jQuery.proxy instead - proxy: jQuery.proxy, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady, - teardown: jQuery.noop - }, - - live: { - add: function( handleObj ) { - jQuery.event.add( this, - liveConvert( handleObj.origType, handleObj.selector ), - jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); - }, - - remove: function( handleObj ) { - jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); - } - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !this.preventDefault ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // timeStamp is buggy for some events on Firefox(#3843) - // So we won't rely on the native value - this.timeStamp = jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Checks if an event happened on an element within another element -// Used in jQuery.event.special.mouseenter and mouseleave handlers -var withinElement = function( event ) { - - // Check if mouse(over|out) are still within the same parent element - var related = event.relatedTarget, - inside = false, - eventType = event.type; - - event.type = event.data; - - if ( related !== this ) { - - if ( related ) { - inside = jQuery.contains( this, related ); - } - - if ( !inside ) { - - jQuery.event.handle.apply( this, arguments ); - - event.type = eventType; - } - } -}, - -// In case of event delegation, we only need to rename the event.type, -// liveHandler will take care of the rest. -delegate = function( event ) { - event.type = event.data; - jQuery.event.handle.apply( this, arguments ); -}; - -// Create mouseenter and mouseleave events -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - setup: function( data ) { - jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); - }, - teardown: function( data ) { - jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); - } - }; -}); - -// submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function( data, namespaces ) { - if ( !jQuery.nodeName( this, "form" ) ) { - jQuery.event.add(this, "click.specialSubmit", function( e ) { - var elem = e.target, - type = elem.type; - - if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { - trigger( "submit", this, arguments ); - } - }); - - jQuery.event.add(this, "keypress.specialSubmit", function( e ) { - var elem = e.target, - type = elem.type; - - if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { - trigger( "submit", this, arguments ); - } - }); - - } else { - return false; - } - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialSubmit" ); - } - }; - -} - -// change delegation, happens here so we have bind. -if ( !jQuery.support.changeBubbles ) { - - var changeFilters, - - getVal = function( elem ) { - var type = elem.type, val = elem.value; - - if ( type === "radio" || type === "checkbox" ) { - val = elem.checked; - - } else if ( type === "select-multiple" ) { - val = elem.selectedIndex > -1 ? - jQuery.map( elem.options, function( elem ) { - return elem.selected; - }).join("-") : - ""; - - } else if ( jQuery.nodeName( elem, "select" ) ) { - val = elem.selectedIndex; - } - - return val; - }, - - testChange = function testChange( e ) { - var elem = e.target, data, val; - - if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { - return; - } - - data = jQuery._data( elem, "_change_data" ); - val = getVal(elem); - - // the current data will be also retrieved by beforeactivate - if ( e.type !== "focusout" || elem.type !== "radio" ) { - jQuery._data( elem, "_change_data", val ); - } - - if ( data === undefined || val === data ) { - return; - } - - if ( data != null || val ) { - e.type = "change"; - e.liveFired = undefined; - jQuery.event.trigger( e, arguments[1], elem ); - } - }; - - jQuery.event.special.change = { - filters: { - focusout: testChange, - - beforedeactivate: testChange, - - click: function( e ) { - var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; - - if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) { - testChange.call( this, e ); - } - }, - - // Change has to be called before submit - // Keydown will be called before keypress, which is used in submit-event delegation - keydown: function( e ) { - var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; - - if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) || - (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || - type === "select-multiple" ) { - testChange.call( this, e ); - } - }, - - // Beforeactivate happens also before the previous element is blurred - // with this event you can't trigger a change event, but you can store - // information - beforeactivate: function( e ) { - var elem = e.target; - jQuery._data( elem, "_change_data", getVal(elem) ); - } - }, - - setup: function( data, namespaces ) { - if ( this.type === "file" ) { - return false; - } - - for ( var type in changeFilters ) { - jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); - } - - return rformElems.test( this.nodeName ); - }, - - teardown: function( namespaces ) { - jQuery.event.remove( this, ".specialChange" ); - - return rformElems.test( this.nodeName ); - } - }; - - changeFilters = jQuery.event.special.change.filters; - - // Handle when the input is .focus()'d - changeFilters.focus = changeFilters.beforeactivate; -} - -function trigger( type, elem, args ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - // Don't pass args or remember liveFired; they apply to the donor event. - var event = jQuery.extend( {}, args[ 0 ] ); - event.type = type; - event.originalEvent = {}; - event.liveFired = undefined; - jQuery.event.handle.call( elem, event ); - if ( event.isDefaultPrevented() ) { - args[ 0 ].preventDefault(); - } -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - - function handler( donor ) { - // Donor event is always a native one; fix it and switch its type. - // Let focusin/out handler cancel the donor focus/blur event. - var e = jQuery.event.fix( donor ); - e.type = fix; - e.originalEvent = {}; - jQuery.event.trigger( e, null, e.target ); - if ( e.isDefaultPrevented() ) { - donor.preventDefault(); - } - } - }); -} - -jQuery.each(["bind", "one"], function( i, name ) { - jQuery.fn[ name ] = function( type, data, fn ) { - var handler; - - // Handle object literals - if ( typeof type === "object" ) { - for ( var key in type ) { - this[ name ](key, data, type[key], fn); - } - return this; - } - - if ( arguments.length === 2 || data === false ) { - fn = data; - data = undefined; - } - - if ( name === "one" ) { - handler = function( event ) { - jQuery( this ).unbind( event, handler ); - return fn.apply( this, arguments ); - }; - handler.guid = fn.guid || jQuery.guid++; - } else { - handler = fn; - } - - if ( type === "unload" && name !== "one" ) { - this.one( type, data, fn ); - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.add( this[i], type, handler, data ); - } - } - - return this; - }; -}); - -jQuery.fn.extend({ - unbind: function( type, fn ) { - // Handle object literals - if ( typeof type === "object" && !type.preventDefault ) { - for ( var key in type ) { - this.unbind(key, type[key]); - } - - } else { - for ( var i = 0, l = this.length; i < l; i++ ) { - jQuery.event.remove( this[i], type, fn ); - } - } - - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.live( types, data, fn, selector ); - }, - - undelegate: function( selector, types, fn ) { - if ( arguments.length === 0 ) { - return this.unbind( "live" ); - - } else { - return this.die( types, null, fn, selector ); - } - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -var liveMap = { - focus: "focusin", - blur: "focusout", - mouseenter: "mouseover", - mouseleave: "mouseout" -}; - -jQuery.each(["live", "die"], function( i, name ) { - jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { - var type, i = 0, match, namespaces, preType, - selector = origSelector || this.selector, - context = origSelector ? this : jQuery( this.context ); - - if ( typeof types === "object" && !types.preventDefault ) { - for ( var key in types ) { - context[ name ]( key, data, types[key], selector ); - } - - return this; - } - - if ( name === "die" && !types && - origSelector && origSelector.charAt(0) === "." ) { - - context.unbind( origSelector ); - - return this; - } - - if ( data === false || jQuery.isFunction( data ) ) { - fn = data || returnFalse; - data = undefined; - } - - types = (types || "").split(" "); - - while ( (type = types[ i++ ]) != null ) { - match = rnamespaces.exec( type ); - namespaces = ""; - - if ( match ) { - namespaces = match[0]; - type = type.replace( rnamespaces, "" ); - } - - if ( type === "hover" ) { - types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); - continue; - } - - preType = type; - - if ( liveMap[ type ] ) { - types.push( liveMap[ type ] + namespaces ); - type = type + namespaces; - - } else { - type = (liveMap[ type ] || type) + namespaces; - } - - if ( name === "live" ) { - // bind live handler - for ( var j = 0, l = context.length; j < l; j++ ) { - jQuery.event.add( context[j], "live." + liveConvert( type, selector ), - { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); - } - - } else { - // unbind live handler - context.unbind( "live." + liveConvert( type, selector ), fn ); - } - } - - return this; - }; -}); - -function liveHandler( event ) { - var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, - elems = [], - selectors = [], - events = jQuery._data( this, "events" ); - - // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) - if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { - return; - } - - if ( event.namespace ) { - namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); - } - - event.liveFired = this; - - var live = events.live.slice(0); - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { - selectors.push( handleObj.selector ); - - } else { - live.splice( j--, 1 ); - } - } - - match = jQuery( event.target ).closest( selectors, event.currentTarget ); - - for ( i = 0, l = match.length; i < l; i++ ) { - close = match[i]; - - for ( j = 0; j < live.length; j++ ) { - handleObj = live[j]; - - if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) { - elem = close.elem; - related = null; - - // Those two events require additional checking - if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { - event.type = handleObj.preType; - related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; - - // Make sure not to accidentally match a child element with the same selector - if ( related && jQuery.contains( elem, related ) ) { - related = elem; - } - } - - if ( !related || related !== elem ) { - elems.push({ elem: elem, handleObj: handleObj, level: close.level }); - } - } - } - } - - for ( i = 0, l = elems.length; i < l; i++ ) { - match = elems[i]; - - if ( maxLevel && match.level > maxLevel ) { - break; - } - - event.currentTarget = match.elem; - event.data = match.handleObj.data; - event.handleObj = match.handleObj; - - ret = match.handleObj.origHandler.apply( match.elem, arguments ); - - if ( ret === false || event.isPropagationStopped() ) { - maxLevel = match.level; - - if ( ret === false ) { - stop = false; - } - if ( event.isImmediatePropagationStopped() ) { - break; - } - } - } - - return stop; -} - -function liveConvert( type, selector ) { - return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&"); -} - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.bind( name, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set; - - if ( !expr ) { - return []; - } - - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var match, - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( var type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - var found, item, - filter = Expr.filter[ type ], - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw "Syntax error, unrecognized expression: " + msg; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - var first = match[2], - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - var doneName = match[0], - parent = elem.parentNode; - - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent.sizcache = doneName; - } - - var diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Utility function for retreiving the text value of an array of DOM nodes -Sizzle.getText = function( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += Sizzle.getText( elem.childNodes ); - } - } - - return ret; -}; - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

    "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
    "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( typeof selector === "string" ? - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array - if ( jQuery.isArray( selectors ) ) { - var match, selector, - matches = {}, - level = 1; - - if ( cur && selectors.length ) { - for ( i = 0, l = selectors.length; i < l; i++ ) { - selector = selectors[i]; - - if ( !matches[ selector ] ) { - matches[ selector ] = POS.test( selector ) ? - jQuery( selector, context || this.context ) : - selector; - } - } - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( selector in matches ) { - match = matches[ selector ]; - - if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) { - ret.push({ selector: selector, elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - if ( !elem || typeof elem === "string" ) { - return jQuery.inArray( this[0], - // If it receives a string, the selector is used - // If it receives nothing, the siblings are used - elem ? jQuery( elem ) : this.parent().children() ); - } - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ), - // The variable 'args' was introduced in - // https://github.com/jquery/jquery/commit/52a0238 - // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. - // http://code.google.com/p/v8/issues/detail?id=1050 - args = slice.call(arguments); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, args.join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return (elem === qualifier) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return (jQuery.inArray( elem, qualifier ) >= 0) === keep; - }); -} - - - - -var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /", "" ], - legend: [ 1, "
    ", "
    " ], - thead: [ 1, "", "
    " ], - tr: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - col: [ 2, "", "
    " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }; - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - - - - - - diff --git a/node_modules/express/node_modules/debug/example/wildcards.js b/node_modules/express/node_modules/debug/example/wildcards.js deleted file mode 100644 index 1fdac20..0000000 --- a/node_modules/express/node_modules/debug/example/wildcards.js +++ /dev/null @@ -1,10 +0,0 @@ - -var debug = { - foo: require('../')('test:foo'), - bar: require('../')('test:bar'), - baz: require('../')('test:baz') -}; - -debug.foo('foo') -debug.bar('bar') -debug.baz('baz') \ No newline at end of file diff --git a/node_modules/express/node_modules/debug/example/worker.js b/node_modules/express/node_modules/debug/example/worker.js deleted file mode 100644 index 7f6d288..0000000 --- a/node_modules/express/node_modules/debug/example/worker.js +++ /dev/null @@ -1,22 +0,0 @@ - -// DEBUG=* node example/worker -// DEBUG=worker:* node example/worker -// DEBUG=worker:a node example/worker -// DEBUG=worker:b node example/worker - -var a = require('../')('worker:a') - , b = require('../')('worker:b'); - -function work() { - a('doing lots of uninteresting work'); - setTimeout(work, Math.random() * 1000); -} - -work(); - -function workb() { - b('doing some work'); - setTimeout(workb, Math.random() * 2000); -} - -workb(); \ No newline at end of file diff --git a/node_modules/express/node_modules/debug/index.js b/node_modules/express/node_modules/debug/index.js deleted file mode 100644 index e02c13b..0000000 --- a/node_modules/express/node_modules/debug/index.js +++ /dev/null @@ -1,5 +0,0 @@ -if ('undefined' == typeof window) { - module.exports = require('./lib/debug'); -} else { - module.exports = require('./debug'); -} diff --git a/node_modules/express/node_modules/debug/lib/debug.js b/node_modules/express/node_modules/debug/lib/debug.js deleted file mode 100644 index 0b07aa1..0000000 --- a/node_modules/express/node_modules/debug/lib/debug.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Module dependencies. - */ - -var tty = require('tty'); - -/** - * Expose `debug()` as the module. - */ - -module.exports = debug; - -/** - * Enabled debuggers. - */ - -var names = [] - , skips = []; - -(process.env.DEBUG || '') - .split(/[\s,]+/) - .forEach(function(name){ - name = name.replace('*', '.*?'); - if (name[0] === '-') { - skips.push(new RegExp('^' + name.substr(1) + '$')); - } else { - names.push(new RegExp('^' + name + '$')); - } - }); - -/** - * Colors. - */ - -var colors = [6, 2, 3, 4, 5, 1]; - -/** - * Previous debug() call. - */ - -var prev = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Is stdout a TTY? Colored output is disabled when `true`. - */ - -var isatty = tty.isatty(2); - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function color() { - return colors[prevColor++ % colors.length]; -} - -/** - * Humanize the given `ms`. - * - * @param {Number} m - * @return {String} - * @api private - */ - -function humanize(ms) { - var sec = 1000 - , min = 60 * 1000 - , hour = 60 * min; - - if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; - if (ms >= min) return (ms / min).toFixed(1) + 'm'; - if (ms >= sec) return (ms / sec | 0) + 's'; - return ms + 'ms'; -} - -/** - * Create a debugger with the given `name`. - * - * @param {String} name - * @return {Type} - * @api public - */ - -function debug(name) { - function disabled(){} - disabled.enabled = false; - - var match = skips.some(function(re){ - return re.test(name); - }); - - if (match) return disabled; - - match = names.some(function(re){ - return re.test(name); - }); - - if (!match) return disabled; - var c = color(); - - function colored(fmt) { - var curr = new Date; - var ms = curr - (prev[name] || curr); - prev[name] = curr; - - fmt = ' \u001b[9' + c + 'm' + name + ' ' - + '\u001b[3' + c + 'm\u001b[90m' - + fmt + '\u001b[3' + c + 'm' - + ' +' + humanize(ms) + '\u001b[0m'; - - console.error.apply(this, arguments); - } - - function plain(fmt) { - fmt = new Date().toUTCString() - + ' ' + name + ' ' + fmt; - console.error.apply(this, arguments); - } - - colored.enabled = plain.enabled = true; - - return isatty || process.env.DEBUG_COLORS - ? colored - : plain; -} diff --git a/node_modules/express/node_modules/debug/package.json b/node_modules/express/node_modules/debug/package.json deleted file mode 100644 index 112d22b..0000000 --- a/node_modules/express/node_modules/debug/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "debug", - "version": "0.7.2", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "description": "small debugging utility", - "keywords": [ - "debug", - "log", - "debugger" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*" - }, - "main": "lib/debug.js", - "browserify": "debug.js", - "engines": { - "node": "*" - }, - "component": { - "scripts": { - "debug/index.js": "index.js", - "debug/debug.js": "debug.js" - } - }, - "readme": "\n# debug\n\n tiny node.js debugging utility modelled after node core's debugging technique.\n\n## Installation\n\n```\n$ npm install debug\n```\n\n## Usage\n\n With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.\n \nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n \n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with \"connect:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. \n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n a('doing some work');\n}, 1200);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "_id": "debug@0.7.2", - "_from": "debug@*" -} diff --git a/node_modules/express/node_modules/fresh/.npmignore b/node_modules/express/node_modules/fresh/.npmignore deleted file mode 100644 index 9daeafb..0000000 --- a/node_modules/express/node_modules/fresh/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/node_modules/express/node_modules/fresh/Makefile b/node_modules/express/node_modules/fresh/Makefile deleted file mode 100644 index 8e8640f..0000000 --- a/node_modules/express/node_modules/fresh/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --reporter spec \ - --require should - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/fresh/Readme.md b/node_modules/express/node_modules/fresh/Readme.md deleted file mode 100644 index 273130d..0000000 --- a/node_modules/express/node_modules/fresh/Readme.md +++ /dev/null @@ -1,32 +0,0 @@ - -# node-fresh - - HTTP response freshness testing - -## fresh(req, res) - - Check freshness of `req` and `res` headers. - - When the cache is "fresh" __true__ is returned, - otherwise __false__ is returned to indicate that - the cache is now stale. - -## Example: - -```js -var req = { 'if-none-match': 'tobi' }; -var res = { 'etag': 'luna' }; -fresh(req, res); -// => false - -var req = { 'if-none-match': 'tobi' }; -var res = { 'etag': 'tobi' }; -fresh(req, res); -// => true -``` - -## Installation - -``` -$ npm install fresh -``` \ No newline at end of file diff --git a/node_modules/express/node_modules/fresh/index.js b/node_modules/express/node_modules/fresh/index.js deleted file mode 100644 index b2f4d41..0000000 --- a/node_modules/express/node_modules/fresh/index.js +++ /dev/null @@ -1,49 +0,0 @@ - -/** - * Expose `fresh()`. - */ - -module.exports = fresh; - -/** - * Check freshness of `req` and `res` headers. - * - * When the cache is "fresh" __true__ is returned, - * otherwise __false__ is returned to indicate that - * the cache is now stale. - * - * @param {Object} req - * @param {Object} res - * @return {Boolean} - * @api public - */ - -function fresh(req, res) { - // defaults - var etagMatches = true; - var notModified = true; - - // fields - var modifiedSince = req['if-modified-since']; - var noneMatch = req['if-none-match']; - var lastModified = res['last-modified']; - var etag = res['etag']; - - // unconditional request - if (!modifiedSince && !noneMatch) return false; - - // parse if-none-match - if (noneMatch) noneMatch = noneMatch.split(/ *, */); - - // if-none-match - if (noneMatch) etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0]; - - // if-modified-since - if (modifiedSince) { - modifiedSince = new Date(modifiedSince); - lastModified = new Date(lastModified); - notModified = lastModified <= modifiedSince; - } - - return !! (etagMatches && notModified); -} \ No newline at end of file diff --git a/node_modules/express/node_modules/fresh/package.json b/node_modules/express/node_modules/fresh/package.json deleted file mode 100644 index d9fddb2..0000000 --- a/node_modules/express/node_modules/fresh/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "fresh", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "description": "HTTP response freshness testing", - "version": "0.1.0", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "readme": "\n# node-fresh\n\n HTTP response freshness testing\n\n## fresh(req, res)\n\n Check freshness of `req` and `res` headers.\n\n When the cache is \"fresh\" __true__ is returned,\n otherwise __false__ is returned to indicate that\n the cache is now stale.\n\n## Example:\n\n```js\nvar req = { 'if-none-match': 'tobi' };\nvar res = { 'etag': 'luna' };\nfresh(req, res);\n// => false\n\nvar req = { 'if-none-match': 'tobi' };\nvar res = { 'etag': 'tobi' };\nfresh(req, res);\n// => true\n```\n\n## Installation\n\n```\n$ npm install fresh\n```", - "readmeFilename": "Readme.md", - "_id": "fresh@0.1.0", - "_from": "fresh@0.1.0" -} diff --git a/node_modules/express/node_modules/methods/index.js b/node_modules/express/node_modules/methods/index.js deleted file mode 100644 index 297d022..0000000 --- a/node_modules/express/node_modules/methods/index.js +++ /dev/null @@ -1,26 +0,0 @@ - -module.exports = [ - 'get' - , 'post' - , 'put' - , 'head' - , 'delete' - , 'options' - , 'trace' - , 'copy' - , 'lock' - , 'mkcol' - , 'move' - , 'propfind' - , 'proppatch' - , 'unlock' - , 'report' - , 'mkactivity' - , 'checkout' - , 'merge' - , 'm-search' - , 'notify' - , 'subscribe' - , 'unsubscribe' - , 'patch' -]; \ No newline at end of file diff --git a/node_modules/express/node_modules/methods/package.json b/node_modules/express/node_modules/methods/package.json deleted file mode 100644 index f867a8b..0000000 --- a/node_modules/express/node_modules/methods/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "methods", - "version": "0.0.1", - "description": "HTTP methods that node supports", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [ - "http", - "methods" - ], - "author": { - "name": "TJ Holowaychuk" - }, - "license": "MIT", - "readme": "ERROR: No README data found!", - "_id": "methods@0.0.1", - "_from": "methods@0.0.1" -} diff --git a/node_modules/express/node_modules/mkdirp/.npmignore b/node_modules/express/node_modules/mkdirp/.npmignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/express/node_modules/mkdirp/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/express/node_modules/mkdirp/.travis.yml b/node_modules/express/node_modules/mkdirp/.travis.yml deleted file mode 100644 index 84fd7ca..0000000 --- a/node_modules/express/node_modules/mkdirp/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 - - 0.9 diff --git a/node_modules/express/node_modules/mkdirp/LICENSE b/node_modules/express/node_modules/mkdirp/LICENSE deleted file mode 100644 index 432d1ae..0000000 --- a/node_modules/express/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/express/node_modules/mkdirp/examples/pow.js b/node_modules/express/node_modules/mkdirp/examples/pow.js deleted file mode 100644 index e692421..0000000 --- a/node_modules/express/node_modules/mkdirp/examples/pow.js +++ /dev/null @@ -1,6 +0,0 @@ -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); diff --git a/node_modules/express/node_modules/mkdirp/index.js b/node_modules/express/node_modules/mkdirp/index.js deleted file mode 100644 index fda6de8..0000000 --- a/node_modules/express/node_modules/mkdirp/index.js +++ /dev/null @@ -1,82 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, mode, f, made) { - if (typeof mode === 'function' || mode === undefined) { - f = mode; - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || function () {}; - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - fs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - mkdirP(path.dirname(p), mode, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, mode, cb, made); - }); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - fs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} - -mkdirP.sync = function sync (p, mode, made) { - if (mode === undefined) { - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - try { - fs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), mode, made); - sync(p, mode, made); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = fs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; diff --git a/node_modules/express/node_modules/mkdirp/package.json b/node_modules/express/node_modules/mkdirp/package.json deleted file mode 100644 index b5200ad..0000000 --- a/node_modules/express/node_modules/mkdirp/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.3.5", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "main": "./index", - "keywords": [ - "mkdir", - "directory" - ], - "repository": { - "type": "git", - "url": "http://github.com/substack/node-mkdirp.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "devDependencies": { - "tap": "~0.4.0" - }, - "license": "MIT", - "readme": "# mkdirp\n\nLike `mkdir -p`, but in node.js!\n\n[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)\n\n# example\n\n## pow.js\n\n```js\nvar mkdirp = require('mkdirp');\n \nmkdirp('/tmp/foo/bar/baz', function (err) {\n if (err) console.error(err)\n else console.log('pow!')\n});\n```\n\nOutput\n\n```\npow!\n```\n\nAnd now /tmp/foo/bar/baz exists, huzzah!\n\n# methods\n\n```js\nvar mkdirp = require('mkdirp');\n```\n\n## mkdirp(dir, mode, cb)\n\nCreate a new directory and any necessary subdirectories at `dir` with octal\npermission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\n`cb(err, made)` fires with the error or the first directory `made`\nthat had to be created, if any.\n\n## mkdirp.sync(dir, mode)\n\nSynchronously create a new directory and any necessary subdirectories at `dir`\nwith octal permission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\nReturns the first directory that had to be created, if any.\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install mkdirp\n```\n\n# license\n\nMIT\n", - "readmeFilename": "readme.markdown", - "bugs": { - "url": "https://github.com/substack/node-mkdirp/issues" - }, - "_id": "mkdirp@0.3.5", - "_from": "mkdirp@~0.3.4" -} diff --git a/node_modules/express/node_modules/mkdirp/readme.markdown b/node_modules/express/node_modules/mkdirp/readme.markdown deleted file mode 100644 index 83b0216..0000000 --- a/node_modules/express/node_modules/mkdirp/readme.markdown +++ /dev/null @@ -1,63 +0,0 @@ -# mkdirp - -Like `mkdir -p`, but in node.js! - -[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) - -# example - -## pow.js - -```js -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); -``` - -Output - -``` -pow! -``` - -And now /tmp/foo/bar/baz exists, huzzah! - -# methods - -```js -var mkdirp = require('mkdirp'); -``` - -## mkdirp(dir, mode, cb) - -Create a new directory and any necessary subdirectories at `dir` with octal -permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -`cb(err, made)` fires with the error or the first directory `made` -that had to be created, if any. - -## mkdirp.sync(dir, mode) - -Synchronously create a new directory and any necessary subdirectories at `dir` -with octal permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -Returns the first directory that had to be created, if any. - -# install - -With [npm](http://npmjs.org) do: - -``` -npm install mkdirp -``` - -# license - -MIT diff --git a/node_modules/express/node_modules/mkdirp/test/chmod.js b/node_modules/express/node_modules/mkdirp/test/chmod.js deleted file mode 100644 index 520dcb8..0000000 --- a/node_modules/express/node_modules/mkdirp/test/chmod.js +++ /dev/null @@ -1,38 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -test('chmod-pre', function (t) { - var mode = 0744 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); - t.end(); - }); - }); -}); - -test('chmod', function (t) { - var mode = 0755 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.end(); - }); - }); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/clobber.js b/node_modules/express/node_modules/mkdirp/test/clobber.js deleted file mode 100644 index 0eb7099..0000000 --- a/node_modules/express/node_modules/mkdirp/test/clobber.js +++ /dev/null @@ -1,37 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -// a file in the way -var itw = ps.slice(0, 3).join('/'); - - -test('clobber-pre', function (t) { - console.error("about to write to "+itw) - fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); - - fs.stat(itw, function (er, stat) { - t.ifError(er) - t.ok(stat && stat.isFile(), 'should be file') - t.end() - }) -}) - -test('clobber', function (t) { - t.plan(2); - mkdirp(file, 0755, function (err) { - t.ok(err); - t.equal(err.code, 'ENOTDIR'); - t.end(); - }); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/mkdirp.js b/node_modules/express/node_modules/mkdirp/test/mkdirp.js deleted file mode 100644 index b07cd70..0000000 --- a/node_modules/express/node_modules/mkdirp/test/mkdirp.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('woo', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/perm.js b/node_modules/express/node_modules/mkdirp/test/perm.js deleted file mode 100644 index 23a7abb..0000000 --- a/node_modules/express/node_modules/mkdirp/test/perm.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('async perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); - -test('async root perm', function (t) { - mkdirp('/tmp', 0755, function (err) { - if (err) t.fail(err); - t.end(); - }); - t.end(); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/perm_sync.js b/node_modules/express/node_modules/mkdirp/test/perm_sync.js deleted file mode 100644 index f685f60..0000000 --- a/node_modules/express/node_modules/mkdirp/test/perm_sync.js +++ /dev/null @@ -1,39 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; - - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); - -test('sync root perm', function (t) { - t.plan(1); - - var file = '/tmp'; - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/race.js b/node_modules/express/node_modules/mkdirp/test/race.js deleted file mode 100644 index 96a0447..0000000 --- a/node_modules/express/node_modules/mkdirp/test/race.js +++ /dev/null @@ -1,41 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('race', function (t) { - t.plan(4); - var ps = [ '', 'tmp' ]; - - for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); - } - var file = ps.join('/'); - - var res = 2; - mk(file, function () { - if (--res === 0) t.end(); - }); - - mk(file, function () { - if (--res === 0) t.end(); - }); - - function mk (file, cb) { - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - if (cb) cb(); - } - }) - }) - }); - } -}); diff --git a/node_modules/express/node_modules/mkdirp/test/rel.js b/node_modules/express/node_modules/mkdirp/test/rel.js deleted file mode 100644 index 7985824..0000000 --- a/node_modules/express/node_modules/mkdirp/test/rel.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('rel', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var cwd = process.cwd(); - process.chdir('/tmp'); - - var file = [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - process.chdir(cwd); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/return.js b/node_modules/express/node_modules/mkdirp/test/return.js deleted file mode 100644 index bce68e5..0000000 --- a/node_modules/express/node_modules/mkdirp/test/return.js +++ /dev/null @@ -1,25 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, '/tmp/' + x); - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, null); - }); - }); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/return_sync.js b/node_modules/express/node_modules/mkdirp/test/return_sync.js deleted file mode 100644 index 7c222d3..0000000 --- a/node_modules/express/node_modules/mkdirp/test/return_sync.js +++ /dev/null @@ -1,24 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - // Note that this will throw on failure, which will fail the test. - var made = mkdirp.sync(file); - t.equal(made, '/tmp/' + x); - - // making the same file again should have no effect. - made = mkdirp.sync(file); - t.equal(made, null); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/root.js b/node_modules/express/node_modules/mkdirp/test/root.js deleted file mode 100644 index 97ad7a2..0000000 --- a/node_modules/express/node_modules/mkdirp/test/root.js +++ /dev/null @@ -1,18 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('root', function (t) { - // '/' on unix, 'c:/' on windows. - var file = path.resolve('/'); - - mkdirp(file, 0755, function (err) { - if (err) throw err - fs.stat(file, function (er, stat) { - if (er) throw er - t.ok(stat.isDirectory(), 'target is a directory'); - t.end(); - }) - }); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/sync.js b/node_modules/express/node_modules/mkdirp/test/sync.js deleted file mode 100644 index 7530cad..0000000 --- a/node_modules/express/node_modules/mkdirp/test/sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file, 0755); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/umask.js b/node_modules/express/node_modules/mkdirp/test/umask.js deleted file mode 100644 index 64ccafe..0000000 --- a/node_modules/express/node_modules/mkdirp/test/umask.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('implicit mode from umask', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0777 & (~process.umask())); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/express/node_modules/mkdirp/test/umask_sync.js b/node_modules/express/node_modules/mkdirp/test/umask_sync.js deleted file mode 100644 index 35bd5cb..0000000 --- a/node_modules/express/node_modules/mkdirp/test/umask_sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('umask sync modes', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, (0777 & (~process.umask()))); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/node_modules/express/node_modules/range-parser/.npmignore b/node_modules/express/node_modules/range-parser/.npmignore deleted file mode 100644 index 9daeafb..0000000 --- a/node_modules/express/node_modules/range-parser/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/node_modules/express/node_modules/range-parser/History.md b/node_modules/express/node_modules/range-parser/History.md deleted file mode 100644 index 82df7b1..0000000 --- a/node_modules/express/node_modules/range-parser/History.md +++ /dev/null @@ -1,15 +0,0 @@ - -0.0.4 / 2012-06-17 -================== - - * changed: ret -1 for unsatisfiable and -2 when invalid - -0.0.3 / 2012-06-17 -================== - - * fix last-byte-pos default to len - 1 - -0.0.2 / 2012-06-14 -================== - - * add `.type` diff --git a/node_modules/express/node_modules/range-parser/Makefile b/node_modules/express/node_modules/range-parser/Makefile deleted file mode 100644 index 8e8640f..0000000 --- a/node_modules/express/node_modules/range-parser/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --reporter spec \ - --require should - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/range-parser/Readme.md b/node_modules/express/node_modules/range-parser/Readme.md deleted file mode 100644 index b2a67fe..0000000 --- a/node_modules/express/node_modules/range-parser/Readme.md +++ /dev/null @@ -1,28 +0,0 @@ - -# node-range-parser - - Range header field parser. - -## Example: - -```js -assert(-1 == parse(200, 'bytes=500-20')); -assert(-2 == parse(200, 'bytes=malformed')); -parse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }])); -parse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }])); -parse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }])); -parse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }])); -parse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }])); -parse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }])); -parse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }])); -parse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }])); -parse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }])); -parse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }])); -parse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }])); -``` - -## Installation - -``` -$ npm install range-parser -``` \ No newline at end of file diff --git a/node_modules/express/node_modules/range-parser/index.js b/node_modules/express/node_modules/range-parser/index.js deleted file mode 100644 index 9b0f7a8..0000000 --- a/node_modules/express/node_modules/range-parser/index.js +++ /dev/null @@ -1,49 +0,0 @@ - -/** - * Parse "Range" header `str` relative to the given file `size`. - * - * @param {Number} size - * @param {String} str - * @return {Array} - * @api public - */ - -module.exports = function(size, str){ - var valid = true; - var i = str.indexOf('='); - - if (-1 == i) return -2; - - var arr = str.slice(i + 1).split(',').map(function(range){ - var range = range.split('-') - , start = parseInt(range[0], 10) - , end = parseInt(range[1], 10); - - // -nnn - if (isNaN(start)) { - start = size - end; - end = size - 1; - // nnn- - } else if (isNaN(end)) { - end = size - 1; - } - - // limit last-byte-pos to current length - if (end > size - 1) end = size - 1; - - // invalid - if (isNaN(start) - || isNaN(end) - || start > end - || start < 0) valid = false; - - return { - start: start, - end: end - }; - }); - - arr.type = str.slice(0, i); - - return valid ? arr : -1; -}; \ No newline at end of file diff --git a/node_modules/express/node_modules/range-parser/package.json b/node_modules/express/node_modules/range-parser/package.json deleted file mode 100644 index efdf450..0000000 --- a/node_modules/express/node_modules/range-parser/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "range-parser", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "description": "Range header field string parser", - "version": "0.0.4", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "readme": "\n# node-range-parser\n\n Range header field parser.\n\n## Example:\n\n```js\nassert(-1 == parse(200, 'bytes=500-20'));\nassert(-2 == parse(200, 'bytes=malformed'));\nparse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }]));\nparse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }]));\nparse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }]));\nparse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }]));\nparse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }]));\nparse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }]));\nparse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }]));\nparse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }]));\nparse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }]));\nparse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }]));\nparse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }]));\n```\n\n## Installation\n\n```\n$ npm install range-parser\n```", - "readmeFilename": "Readme.md", - "_id": "range-parser@0.0.4", - "_from": "range-parser@0.0.4" -} diff --git a/node_modules/express/node_modules/send/.npmignore b/node_modules/express/node_modules/send/.npmignore deleted file mode 100644 index f1250e5..0000000 --- a/node_modules/express/node_modules/send/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/node_modules/express/node_modules/send/History.md b/node_modules/express/node_modules/send/History.md deleted file mode 100644 index 20c5319..0000000 --- a/node_modules/express/node_modules/send/History.md +++ /dev/null @@ -1,25 +0,0 @@ - -0.1.0 / 2012-08-25 -================== - - * add options parameter to send() that is passed to fs.createReadStream() [kanongil] - -0.0.4 / 2012-08-16 -================== - - * allow custom "Accept-Ranges" definition - -0.0.3 / 2012-07-16 -================== - - * fix normalization of the root directory. Closes #3 - -0.0.2 / 2012-07-09 -================== - - * add passing of req explicitly for now (YUCK) - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/express/node_modules/send/Makefile b/node_modules/express/node_modules/send/Makefile deleted file mode 100644 index a9dcfd5..0000000 --- a/node_modules/express/node_modules/send/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec \ - --bail - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/send/Readme.md b/node_modules/express/node_modules/send/Readme.md deleted file mode 100644 index 85171a9..0000000 --- a/node_modules/express/node_modules/send/Readme.md +++ /dev/null @@ -1,123 +0,0 @@ - -# send - - Send is Connect's `static()` extracted for generalized use, a streaming static file - server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework. - -## Installation - - $ npm install send - -## Examples - - Small: - -```js -var http = require('http'); -var send = require('send'); - -var app = http.createServer(function(req, res){ - send(req, req.url).pipe(res); -}); -``` - - Serving from a root directory with custom error-handling: - -```js -var http = require('http'); -var send = require('send'); - -var app = http.createServer(function(req, res){ - // your custom error-handling logic: - function error(err) { - res.statusCode = err.status || 500; - res.end(err.message); - } - - // your custom directory handling logic: - function redirect() { - res.statusCode = 301; - res.setHeader('Location', req.url + '/'); - res.end('Redirecting to ' + req.url + '/'); - } - - // transfer arbitrary files from within - // /www/example.com/public/* - send(req, url.parse(req.url).pathname) - .root('/www/example.com/public') - .on('error', error) - .on('directory', redirect) - .pipe(res); -}); -``` - -## API - -### Events - - - `error` an error occurred `(err)` - - `directory` a directory was requested - - `stream` file streaming has started `(stream)` - - `end` streaming has completed - -### .root(dir) - - Serve files relative to `path`. Aliased as `.from(dir)`. - -### .index(path) - - By default send supports "index.html" files, to disable this - invoke `.index(false)` or to supply a new index pass a string. - -### .maxage(ms) - - Provide a max-age in milliseconds for http caching, defaults to 0. - -## Error-handling - - By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc. - -## Caching - - It does _not_ perform internal caching, you should use a reverse proxy cache such - as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;). - -## Debugging - - To enable `debug()` instrumentation output export __DEBUG__: - -``` -$ DEBUG=send node app -``` - -## Running tests - -``` -$ npm install -$ make test -``` - -## License - -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/express/node_modules/send/index.js b/node_modules/express/node_modules/send/index.js deleted file mode 100644 index f17158d..0000000 --- a/node_modules/express/node_modules/send/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/send'); \ No newline at end of file diff --git a/node_modules/express/node_modules/send/lib/send.js b/node_modules/express/node_modules/send/lib/send.js deleted file mode 100644 index de72146..0000000 --- a/node_modules/express/node_modules/send/lib/send.js +++ /dev/null @@ -1,473 +0,0 @@ - -/** - * Module dependencies. - */ - -var debug = require('debug')('send') - , parseRange = require('range-parser') - , Stream = require('stream') - , mime = require('mime') - , fresh = require('fresh') - , path = require('path') - , http = require('http') - , fs = require('fs') - , basename = path.basename - , normalize = path.normalize - , join = path.join - , utils = require('./utils'); - -/** - * Expose `send`. - */ - -exports = module.exports = send; - -/** - * Expose mime module. - */ - -exports.mime = mime; - -/** - * Return a `SendStream` for `req` and `path`. - * - * @param {Request} req - * @param {String} path - * @param {Object} options - * @return {SendStream} - * @api public - */ - -function send(req, path, options) { - return new SendStream(req, path, options); -} - -/** - * Initialize a `SendStream` with the given `path`. - * - * Events: - * - * - `error` an error occurred - * - `stream` file streaming has started - * - `end` streaming has completed - * - `directory` a directory was requested - * - * @param {Request} req - * @param {String} path - * @param {Object} options - * @api private - */ - -function SendStream(req, path, options) { - var self = this; - this.req = req; - this.path = path; - this.options = options || {}; - this.maxage(0); - this.hidden(false); - this.index('index.html'); -} - -/** - * Inherits from `Stream.prototype`. - */ - -SendStream.prototype.__proto__ = Stream.prototype; - -/** - * Enable or disable "hidden" (dot) files. - * - * @param {Boolean} path - * @return {SendStream} - * @api public - */ - -SendStream.prototype.hidden = function(val){ - debug('hidden %s', val); - this._hidden = val; - return this; -}; - -/** - * Set index `path`, set to a falsy - * value to disable index support. - * - * @param {String|Boolean} path - * @return {SendStream} - * @api public - */ - -SendStream.prototype.index = function(path){ - debug('index %s', path); - this._index = path; - return this; -}; - -/** - * Set root `path`. - * - * @param {String} path - * @return {SendStream} - * @api public - */ - -SendStream.prototype.root = -SendStream.prototype.from = function(path){ - this._root = normalize(path); - return this; -}; - -/** - * Set max-age to `ms`. - * - * @param {Number} ms - * @return {SendStream} - * @api public - */ - -SendStream.prototype.maxage = function(ms){ - if (Infinity == ms) ms = 60 * 60 * 24 * 365 * 1000; - debug('max-age %d', ms); - this._maxage = ms; - return this; -}; - -/** - * Emit error with `status`. - * - * @param {Number} status - * @api private - */ - -SendStream.prototype.error = function(status, err){ - var res = this.res; - var msg = http.STATUS_CODES[status]; - err = err || new Error(msg); - err.status = status; - if (this.listeners('error').length) return this.emit('error', err); - res.statusCode = err.status; - res.end(msg); -}; - -/** - * Check if the pathname is potentially malicious. - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isMalicious = function(){ - return !this._root && ~this.path.indexOf('..'); -}; - -/** - * Check if the pathname ends with "/". - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.hasTrailingSlash = function(){ - return '/' == this.path[this.path.length - 1]; -}; - -/** - * Check if the basename leads with ".". - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.hasLeadingDot = function(){ - return '.' == basename(this.path)[0]; -}; - -/** - * Check if this is a conditional GET request. - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isConditionalGET = function(){ - return this.req.headers['if-none-match'] - || this.req.headers['if-modified-since']; -}; - -/** - * Strip content-* header fields. - * - * @api private - */ - -SendStream.prototype.removeContentHeaderFields = function(){ - var res = this.res; - Object.keys(res._headers).forEach(function(field){ - if (0 == field.indexOf('content')) { - res.removeHeader(field); - } - }); -}; - -/** - * Respond with 304 not modified. - * - * @api private - */ - -SendStream.prototype.notModified = function(){ - var res = this.res; - debug('not modified'); - this.removeContentHeaderFields(); - res.statusCode = 304; - res.end(); -}; - -/** - * Check if the request is cacheable, aka - * responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}). - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isCachable = function(){ - var res = this.res; - return (res.statusCode >= 200 && res.statusCode < 300) || 304 == res.statusCode; -}; - -/** - * Handle stat() error. - * - * @param {Error} err - * @api private - */ - -SendStream.prototype.onStatError = function(err){ - var notfound = ['ENOENT', 'ENAMETOOLONG', 'ENOTDIR']; - if (~notfound.indexOf(err.code)) return this.error(404, err); - this.error(500, err); -}; - -/** - * Check if the cache is fresh. - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isFresh = function(){ - return fresh(this.req.headers, this.res._headers); -}; - -/** - * Redirect to `path`. - * - * @param {String} path - * @api private - */ - -SendStream.prototype.redirect = function(path){ - if (this.listeners('directory').length) return this.emit('directory'); - var res = this.res; - path += '/'; - res.statusCode = 301; - res.setHeader('Location', path); - res.end('Redirecting to ' + utils.escape(path)); -}; - -/** - * Pipe to `res. - * - * @param {Stream} res - * @return {Stream} res - * @api public - */ - -SendStream.prototype.pipe = function(res){ - var self = this - , args = arguments - , path = this.path - , root = this._root; - - // references - this.res = res; - - // invalid request uri - path = utils.decode(path); - if (-1 == path) return this.error(400); - - // null byte(s) - if (~path.indexOf('\0')) return this.error(400); - - // join / normalize from optional root dir - if (root) path = normalize(join(this._root, path)); - - // ".." is malicious without "root" - if (this.isMalicious()) return this.error(403); - - // malicious path - if (root && 0 != path.indexOf(root)) return this.error(403); - - // hidden file support - if (!this._hidden && this.hasLeadingDot()) return this.error(404); - - // index file support - if (this._index && this.hasTrailingSlash()) path += this._index; - - debug('stat "%s"', path); - fs.stat(path, function(err, stat){ - if (err) return self.onStatError(err); - if (stat.isDirectory()) return self.redirect(self.path); - self.send(path, stat); - }); - - return res; -}; - -/** - * Transfer `path`. - * - * @param {String} path - * @api public - */ - -SendStream.prototype.send = function(path, stat){ - var options = this.options; - var len = stat.size; - var res = this.res; - var req = this.req; - var ranges = req.headers.range; - var offset = options.start || 0; - - // set header fields - this.setHeader(stat); - - // set content-type - this.type(path); - - // conditional GET support - if (this.isConditionalGET() - && this.isCachable() - && this.isFresh()) { - return this.notModified(); - } - - // adjust len to start/end options - len = Math.max(0, len - offset); - if (options.end !== undefined) { - var bytes = options.end - offset + 1; - if (len > bytes) len = bytes; - } - - // Range support - if (ranges) { - ranges = parseRange(len, ranges); - - // unsatisfiable - if (-1 == ranges) { - res.setHeader('Content-Range', 'bytes */' + stat.size); - return this.error(416); - } - - // valid (syntactically invalid ranges are treated as a regular response) - if (-2 != ranges) { - options.start = offset + ranges[0].start; - options.end = offset + ranges[0].end; - - // Content-Range - res.statusCode = 206; - res.setHeader('Content-Range', 'bytes ' - + ranges[0].start - + '-' - + ranges[0].end - + '/' - + len); - len = options.end - options.start + 1; - } - } - - // content-length - res.setHeader('Content-Length', len); - - // HEAD support - if ('HEAD' == req.method) return res.end(); - - this.stream(path, options); -}; - -/** - * Stream `path` to the response. - * - * @param {String} path - * @param {Object} options - * @api private - */ - -SendStream.prototype.stream = function(path, options){ - // TODO: this is all lame, refactor meeee - var self = this; - var res = this.res; - var req = this.req; - - // pipe - var stream = fs.createReadStream(path, options); - this.emit('stream', stream); - stream.pipe(res); - - // socket closed, done with the fd - req.on('close', stream.destroy.bind(stream)); - - // error handling code-smell - stream.on('error', function(err){ - // no hope in responding - if (res._header) { - console.error(err.stack); - req.destroy(); - return; - } - - // 500 - err.status = 500; - self.emit('error', err); - }); - - // end - stream.on('end', function(){ - self.emit('end'); - }); -}; - -/** - * Set content-type based on `path` - * if it hasn't been explicitly set. - * - * @param {String} path - * @api private - */ - -SendStream.prototype.type = function(path){ - var res = this.res; - if (res.getHeader('Content-Type')) return; - var type = mime.lookup(path); - var charset = mime.charsets.lookup(type); - debug('content-type %s', type); - res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')); -}; - -/** - * Set reaponse header fields, most - * fields may be pre-defined. - * - * @param {Object} stat - * @api private - */ - -SendStream.prototype.setHeader = function(stat){ - var res = this.res; - if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes'); - if (!res.getHeader('ETag')) res.setHeader('ETag', utils.etag(stat)); - if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString()); - if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + (this._maxage / 1000)); - if (!res.getHeader('Last-Modified')) res.setHeader('Last-Modified', stat.mtime.toUTCString()); -}; diff --git a/node_modules/express/node_modules/send/lib/utils.js b/node_modules/express/node_modules/send/lib/utils.js deleted file mode 100644 index 950e5a2..0000000 --- a/node_modules/express/node_modules/send/lib/utils.js +++ /dev/null @@ -1,47 +0,0 @@ - -/** - * Return an ETag in the form of `"-"` - * from the given `stat`. - * - * @param {Object} stat - * @return {String} - * @api private - */ - -exports.etag = function(stat) { - return '"' + stat.size + '-' + Number(stat.mtime) + '"'; -}; - -/** - * decodeURIComponent. - * - * Allows V8 to only deoptimize this fn instead of all - * of send(). - * - * @param {String} path - * @api private - */ - -exports.decode = function(path){ - try { - return decodeURIComponent(path); - } catch (err) { - return -1; - } -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; \ No newline at end of file diff --git a/node_modules/express/node_modules/send/node_modules/mime/LICENSE b/node_modules/express/node_modules/send/node_modules/mime/LICENSE deleted file mode 100644 index 451fc45..0000000 --- a/node_modules/express/node_modules/send/node_modules/mime/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Benjamin Thomas, Robert Kieffer - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/express/node_modules/send/node_modules/mime/README.md b/node_modules/express/node_modules/send/node_modules/mime/README.md deleted file mode 100644 index d8b66a8..0000000 --- a/node_modules/express/node_modules/send/node_modules/mime/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# mime - -Comprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community. - -## Install - -Install with [npm](http://github.com/isaacs/npm): - - npm install mime - -## API - Queries - -### mime.lookup(path) -Get the mime type associated with a file. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g. - - var mime = require('mime'); - - mime.lookup('/path/to/file.txt'); // => 'text/plain' - mime.lookup('file.txt'); // => 'text/plain' - mime.lookup('.TXT'); // => 'text/plain' - mime.lookup('htm'); // => 'text/html' - -### mime.extension(type) -Get the default extension for `type` - - mime.extension('text/html'); // => 'html' - mime.extension('application/octet-stream'); // => 'bin' - -### mime.charsets.lookup() - -Map mime-type to charset - - mime.charsets.lookup('text/plain'); // => 'UTF-8' - -(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) - -## API - Defining Custom Types - -The following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/bentomas/node-mime/wiki/Requesting-New-Types). - -### mime.define() - -Add custom mime/extension mappings - - mime.define({ - 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], - 'application/x-my-type': ['x-mt', 'x-mtt'], - // etc ... - }); - - mime.lookup('x-sft'); // => 'text/x-some-format' - -The first entry in the extensions array is returned by `mime.extension()`. E.g. - - mime.extension('text/x-some-format'); // => 'x-sf' - -### mime.load(filepath) - -Load mappings from an Apache ".types" format file - - mime.load('./my_project.types'); - -The .types file format is simple - See the `types` dir for examples. diff --git a/node_modules/express/node_modules/send/node_modules/mime/mime.js b/node_modules/express/node_modules/send/node_modules/mime/mime.js deleted file mode 100644 index 1e00585..0000000 --- a/node_modules/express/node_modules/send/node_modules/mime/mime.js +++ /dev/null @@ -1,104 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -function Mime() { - // Map of extension -> mime type - this.types = Object.create(null); - - // Map of mime type -> extension - this.extensions = Object.create(null); -} - -/** - * Define mimetype -> extension mappings. Each key is a mime-type that maps - * to an array of extensions associated with the type. The first extension is - * used as the default extension for the type. - * - * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); - * - * @param map (Object) type definitions - */ -Mime.prototype.define = function (map) { - for (var type in map) { - var exts = map[type]; - - for (var i = 0; i < exts.length; i++) { - this.types[exts[i]] = type; - } - - // Default extension is the first one we encounter - if (!this.extensions[type]) { - this.extensions[type] = exts[0]; - } - } -}; - -/** - * Load an Apache2-style ".types" file - * - * This may be called multiple times (it's expected). Where files declare - * overlapping types/extensions, the last file wins. - * - * @param file (String) path of file to load. - */ -Mime.prototype.load = function(file) { - // Read file and split into lines - var map = {}, - content = fs.readFileSync(file, 'ascii'), - lines = content.split(/[\r\n]+/); - - lines.forEach(function(line) { - // Clean up whitespace/comments, and split into fields - var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); - map[fields.shift()] = fields; - }); - - this.define(map); -}; - -/** - * Lookup a mime type based on extension - */ -Mime.prototype.lookup = function(path, fallback) { - var ext = path.replace(/.*[\.\/]/, '').toLowerCase(); - - return this.types[ext] || fallback || this.default_type; -}; - -/** - * Return file extension associated with a mime type - */ -Mime.prototype.extension = function(mimeType) { - return this.extensions[mimeType]; -}; - -// Default instance -var mime = new Mime(); - -// Load local copy of -// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -mime.load(path.join(__dirname, 'types/mime.types')); - -// Load additional types from node.js community -mime.load(path.join(__dirname, 'types/node.types')); - -// Default type -mime.default_type = mime.lookup('bin'); - -// -// Additional API specific to the default instance -// - -mime.Mime = Mime; - -/** - * Lookup a charset based on mime type. - */ -mime.charsets = { - lookup: function(mimeType, fallback) { - // Assume text types are utf8 - return (/^text\//).test(mimeType) ? 'UTF-8' : fallback; - } -} - -module.exports = mime; diff --git a/node_modules/express/node_modules/send/node_modules/mime/package.json b/node_modules/express/node_modules/send/node_modules/mime/package.json deleted file mode 100644 index 74a6b69..0000000 --- a/node_modules/express/node_modules/send/node_modules/mime/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "author": { - "name": "Robert Kieffer", - "email": "robert@broofa.com", - "url": "http://github.com/broofa" - }, - "contributors": [ - { - "name": "Benjamin Thomas", - "email": "benjamin@benjaminthomas.org", - "url": "http://github.com/bentomas" - } - ], - "dependencies": {}, - "description": "A comprehensive library for mime-type mapping", - "devDependencies": {}, - "keywords": [ - "util", - "mime" - ], - "main": "mime.js", - "name": "mime", - "repository": { - "url": "https://github.com/broofa/node-mime", - "type": "git" - }, - "version": "1.2.6", - "readme": "# mime\n\nComprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.\n\n## Install\n\nInstall with [npm](http://github.com/isaacs/npm):\n\n npm install mime\n\n## API - Queries\n\n### mime.lookup(path)\nGet the mime type associated with a file. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.\n\n var mime = require('mime');\n\n mime.lookup('/path/to/file.txt'); // => 'text/plain'\n mime.lookup('file.txt'); // => 'text/plain'\n mime.lookup('.TXT'); // => 'text/plain'\n mime.lookup('htm'); // => 'text/html'\n\n### mime.extension(type)\nGet the default extension for `type`\n\n mime.extension('text/html'); // => 'html'\n mime.extension('application/octet-stream'); // => 'bin'\n\n### mime.charsets.lookup()\n\nMap mime-type to charset\n\n mime.charsets.lookup('text/plain'); // => 'UTF-8'\n\n(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)\n\n## API - Defining Custom Types\n\nThe following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/bentomas/node-mime/wiki/Requesting-New-Types).\n\n### mime.define()\n\nAdd custom mime/extension mappings\n\n mime.define({\n 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],\n 'application/x-my-type': ['x-mt', 'x-mtt'],\n // etc ...\n });\n\n mime.lookup('x-sft'); // => 'text/x-some-format'\n\nThe first entry in the extensions array is returned by `mime.extension()`. E.g.\n\n mime.extension('text/x-some-format'); // => 'x-sf'\n\n### mime.load(filepath)\n\nLoad mappings from an Apache \".types\" format file\n\n mime.load('./my_project.types');\n\nThe .types file format is simple - See the `types` dir for examples.\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/broofa/node-mime/issues" - }, - "_id": "mime@1.2.6", - "_from": "mime@1.2.6" -} diff --git a/node_modules/express/node_modules/send/node_modules/mime/test.js b/node_modules/express/node_modules/send/node_modules/mime/test.js deleted file mode 100644 index cbad034..0000000 --- a/node_modules/express/node_modules/send/node_modules/mime/test.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Usage: node test.js - */ - -var mime = require('./mime'); -var assert = require('assert'); - -function eq(a, b) { - console.log('Test: ' + a + ' === ' + b); - assert.strictEqual.apply(null, arguments); -} - -console.log(Object.keys(mime.extensions).length + ' types'); -console.log(Object.keys(mime.types).length + ' extensions\n'); - -// -// Test mime lookups -// - -eq('text/plain', mime.lookup('text.txt')); -eq('text/plain', mime.lookup('.text.txt')); -eq('text/plain', mime.lookup('.txt')); -eq('text/plain', mime.lookup('txt')); -eq('application/octet-stream', mime.lookup('text.nope')); -eq('fallback', mime.lookup('text.fallback', 'fallback')); -eq('application/octet-stream', mime.lookup('constructor')); -eq('text/plain', mime.lookup('TEXT.TXT')); -eq('text/event-stream', mime.lookup('text/event-stream')); -eq('application/x-web-app-manifest+json', mime.lookup('text.webapp')); - -// -// Test extensions -// - -eq('txt', mime.extension(mime.types.text)); -eq('html', mime.extension(mime.types.htm)); -eq('bin', mime.extension('application/octet-stream')); -eq(undefined, mime.extension('constructor')); - -// -// Test node types -// - -eq('application/octet-stream', mime.lookup('file.buffer')); -eq('audio/mp4', mime.lookup('file.m4a')); - -// -// Test charsets -// - -eq('UTF-8', mime.charsets.lookup('text/plain')); -eq(undefined, mime.charsets.lookup(mime.types.js)); -eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); - -console.log('\nOK'); diff --git a/node_modules/express/node_modules/send/node_modules/mime/types/mime.types b/node_modules/express/node_modules/send/node_modules/mime/types/mime.types deleted file mode 100644 index b3cae2e..0000000 --- a/node_modules/express/node_modules/send/node_modules/mime/types/mime.types +++ /dev/null @@ -1,1510 +0,0 @@ -# This file maps Internet media types to unique file extension(s). -# Although created for httpd, this file is used by many software systems -# and has been placed in the public domain for unlimited redisribution. -# -# The table below contains both registered and (common) unregistered types. -# A type that has no unique extension can be ignored -- they are listed -# here to guide configurations toward known types and to make it easier to -# identify "new" types. File extensions are also commonly used to indicate -# content languages and encodings, so choose them carefully. -# -# Internet media types should be registered as described in RFC 4288. -# The registry is at . -# -# MIME type (lowercased) Extensions -# ============================================ ========== -# application/1d-interleaved-parityfec -# application/3gpp-ims+xml -# application/activemessage -application/andrew-inset ez -# application/applefile -application/applixware aw -application/atom+xml atom -application/atomcat+xml atomcat -# application/atomicmail -application/atomsvc+xml atomsvc -# application/auth-policy+xml -# application/batch-smtp -# application/beep+xml -# application/calendar+xml -# application/cals-1840 -# application/ccmp+xml -application/ccxml+xml ccxml -application/cdmi-capability cdmia -application/cdmi-container cdmic -application/cdmi-domain cdmid -application/cdmi-object cdmio -application/cdmi-queue cdmiq -# application/cea-2018+xml -# application/cellml+xml -# application/cfw -# application/cnrp+xml -# application/commonground -# application/conference-info+xml -# application/cpl+xml -# application/csta+xml -# application/cstadata+xml -application/cu-seeme cu -# application/cybercash -application/davmount+xml davmount -# application/dca-rft -# application/dec-dx -# application/dialog-info+xml -# application/dicom -# application/dns -# application/dskpp+xml -application/dssc+der dssc -application/dssc+xml xdssc -# application/dvcs -application/ecmascript ecma -# application/edi-consent -# application/edi-x12 -# application/edifact -application/emma+xml emma -# application/epp+xml -application/epub+zip epub -# application/eshop -# application/example -application/exi exi -# application/fastinfoset -# application/fastsoap -# application/fits -application/font-tdpfr pfr -# application/framework-attributes+xml -# application/h224 -# application/held+xml -# application/http -application/hyperstudio stk -# application/ibe-key-request+xml -# application/ibe-pkg-reply+xml -# application/ibe-pp-data -# application/iges -# application/im-iscomposing+xml -# application/index -# application/index.cmd -# application/index.obj -# application/index.response -# application/index.vnd -application/inkml+xml ink inkml -# application/iotp -application/ipfix ipfix -# application/ipp -# application/isup -application/java-archive jar -application/java-serialized-object ser -application/java-vm class -application/javascript js -application/json json -# application/kpml-request+xml -# application/kpml-response+xml -application/lost+xml lostxml -application/mac-binhex40 hqx -application/mac-compactpro cpt -# application/macwriteii -application/mads+xml mads -application/marc mrc -application/marcxml+xml mrcx -application/mathematica ma nb mb -# application/mathml-content+xml -# application/mathml-presentation+xml -application/mathml+xml mathml -# application/mbms-associated-procedure-description+xml -# application/mbms-deregister+xml -# application/mbms-envelope+xml -# application/mbms-msk+xml -# application/mbms-msk-response+xml -# application/mbms-protection-description+xml -# application/mbms-reception-report+xml -# application/mbms-register+xml -# application/mbms-register-response+xml -# application/mbms-user-service-description+xml -application/mbox mbox -# application/media_control+xml -application/mediaservercontrol+xml mscml -application/metalink4+xml meta4 -application/mets+xml mets -# application/mikey -application/mods+xml mods -# application/moss-keys -# application/moss-signature -# application/mosskey-data -# application/mosskey-request -application/mp21 m21 mp21 -application/mp4 mp4s -# application/mpeg4-generic -# application/mpeg4-iod -# application/mpeg4-iod-xmt -# application/msc-ivr+xml -# application/msc-mixer+xml -application/msword doc dot -application/mxf mxf -# application/nasdata -# application/news-checkgroups -# application/news-groupinfo -# application/news-transmission -# application/nss -# application/ocsp-request -# application/ocsp-response -application/octet-stream bin dms lha lrf lzh so iso dmg dist distz pkg bpk dump elc deploy -application/oda oda -application/oebps-package+xml opf -application/ogg ogx -application/onenote onetoc onetoc2 onetmp onepkg -application/oxps oxps -# application/parityfec -application/patch-ops-error+xml xer -application/pdf pdf -application/pgp-encrypted pgp -# application/pgp-keys -application/pgp-signature asc sig -application/pics-rules prf -# application/pidf+xml -# application/pidf-diff+xml -application/pkcs10 p10 -application/pkcs7-mime p7m p7c -application/pkcs7-signature p7s -application/pkcs8 p8 -application/pkix-attr-cert ac -application/pkix-cert cer -application/pkix-crl crl -application/pkix-pkipath pkipath -application/pkixcmp pki -application/pls+xml pls -# application/poc-settings+xml -application/postscript ai eps ps -# application/prs.alvestrand.titrax-sheet -application/prs.cww cww -# application/prs.nprend -# application/prs.plucker -# application/prs.rdf-xml-crypt -# application/prs.xsf+xml -application/pskc+xml pskcxml -# application/qsig -application/rdf+xml rdf -application/reginfo+xml rif -application/relax-ng-compact-syntax rnc -# application/remote-printing -application/resource-lists+xml rl -application/resource-lists-diff+xml rld -# application/riscos -# application/rlmi+xml -application/rls-services+xml rs -application/rpki-ghostbusters gbr -application/rpki-manifest mft -application/rpki-roa roa -# application/rpki-updown -application/rsd+xml rsd -application/rss+xml rss -application/rtf rtf -# application/rtx -# application/samlassertion+xml -# application/samlmetadata+xml -application/sbml+xml sbml -application/scvp-cv-request scq -application/scvp-cv-response scs -application/scvp-vp-request spq -application/scvp-vp-response spp -application/sdp sdp -# application/set-payment -application/set-payment-initiation setpay -# application/set-registration -application/set-registration-initiation setreg -# application/sgml -# application/sgml-open-catalog -application/shf+xml shf -# application/sieve -# application/simple-filter+xml -# application/simple-message-summary -# application/simplesymbolcontainer -# application/slate -# application/smil -application/smil+xml smi smil -# application/soap+fastinfoset -# application/soap+xml -application/sparql-query rq -application/sparql-results+xml srx -# application/spirits-event+xml -application/srgs gram -application/srgs+xml grxml -application/sru+xml sru -application/ssml+xml ssml -# application/tamp-apex-update -# application/tamp-apex-update-confirm -# application/tamp-community-update -# application/tamp-community-update-confirm -# application/tamp-error -# application/tamp-sequence-adjust -# application/tamp-sequence-adjust-confirm -# application/tamp-status-query -# application/tamp-status-response -# application/tamp-update -# application/tamp-update-confirm -application/tei+xml tei teicorpus -application/thraud+xml tfi -# application/timestamp-query -# application/timestamp-reply -application/timestamped-data tsd -# application/tve-trigger -# application/ulpfec -# application/vcard+xml -# application/vemmi -# application/vividence.scriptfile -# application/vnd.3gpp.bsf+xml -application/vnd.3gpp.pic-bw-large plb -application/vnd.3gpp.pic-bw-small psb -application/vnd.3gpp.pic-bw-var pvb -# application/vnd.3gpp.sms -# application/vnd.3gpp2.bcmcsinfo+xml -# application/vnd.3gpp2.sms -application/vnd.3gpp2.tcap tcap -application/vnd.3m.post-it-notes pwn -application/vnd.accpac.simply.aso aso -application/vnd.accpac.simply.imp imp -application/vnd.acucobol acu -application/vnd.acucorp atc acutc -application/vnd.adobe.air-application-installer-package+zip air -application/vnd.adobe.fxp fxp fxpl -# application/vnd.adobe.partial-upload -application/vnd.adobe.xdp+xml xdp -application/vnd.adobe.xfdf xfdf -# application/vnd.aether.imp -# application/vnd.ah-barcode -application/vnd.ahead.space ahead -application/vnd.airzip.filesecure.azf azf -application/vnd.airzip.filesecure.azs azs -application/vnd.amazon.ebook azw -application/vnd.americandynamics.acc acc -application/vnd.amiga.ami ami -# application/vnd.amundsen.maze+xml -application/vnd.android.package-archive apk -application/vnd.anser-web-certificate-issue-initiation cii -application/vnd.anser-web-funds-transfer-initiation fti -application/vnd.antix.game-component atx -application/vnd.apple.installer+xml mpkg -application/vnd.apple.mpegurl m3u8 -# application/vnd.arastra.swi -application/vnd.aristanetworks.swi swi -application/vnd.astraea-software.iota iota -application/vnd.audiograph aep -# application/vnd.autopackage -# application/vnd.avistar+xml -application/vnd.blueice.multipass mpm -# application/vnd.bluetooth.ep.oob -application/vnd.bmi bmi -application/vnd.businessobjects rep -# application/vnd.cab-jscript -# application/vnd.canon-cpdl -# application/vnd.canon-lips -# application/vnd.cendio.thinlinc.clientconf -application/vnd.chemdraw+xml cdxml -application/vnd.chipnuts.karaoke-mmd mmd -application/vnd.cinderella cdy -# application/vnd.cirpack.isdn-ext -application/vnd.claymore cla -application/vnd.cloanto.rp9 rp9 -application/vnd.clonk.c4group c4g c4d c4f c4p c4u -application/vnd.cluetrust.cartomobile-config c11amc -application/vnd.cluetrust.cartomobile-config-pkg c11amz -# application/vnd.collection+json -# application/vnd.commerce-battelle -application/vnd.commonspace csp -application/vnd.contact.cmsg cdbcmsg -application/vnd.cosmocaller cmc -application/vnd.crick.clicker clkx -application/vnd.crick.clicker.keyboard clkk -application/vnd.crick.clicker.palette clkp -application/vnd.crick.clicker.template clkt -application/vnd.crick.clicker.wordbank clkw -application/vnd.criticaltools.wbs+xml wbs -application/vnd.ctc-posml pml -# application/vnd.ctct.ws+xml -# application/vnd.cups-pdf -# application/vnd.cups-postscript -application/vnd.cups-ppd ppd -# application/vnd.cups-raster -# application/vnd.cups-raw -# application/vnd.curl -application/vnd.curl.car car -application/vnd.curl.pcurl pcurl -# application/vnd.cybank -application/vnd.data-vision.rdz rdz -application/vnd.dece.data uvf uvvf uvd uvvd -application/vnd.dece.ttml+xml uvt uvvt -application/vnd.dece.unspecified uvx uvvx -application/vnd.dece.zip uvz uvvz -application/vnd.denovo.fcselayout-link fe_launch -# application/vnd.dir-bi.plate-dl-nosuffix -application/vnd.dna dna -application/vnd.dolby.mlp mlp -# application/vnd.dolby.mobile.1 -# application/vnd.dolby.mobile.2 -application/vnd.dpgraph dpg -application/vnd.dreamfactory dfac -application/vnd.dvb.ait ait -# application/vnd.dvb.dvbj -# application/vnd.dvb.esgcontainer -# application/vnd.dvb.ipdcdftnotifaccess -# application/vnd.dvb.ipdcesgaccess -# application/vnd.dvb.ipdcesgaccess2 -# application/vnd.dvb.ipdcesgpdd -# application/vnd.dvb.ipdcroaming -# application/vnd.dvb.iptv.alfec-base -# application/vnd.dvb.iptv.alfec-enhancement -# application/vnd.dvb.notif-aggregate-root+xml -# application/vnd.dvb.notif-container+xml -# application/vnd.dvb.notif-generic+xml -# application/vnd.dvb.notif-ia-msglist+xml -# application/vnd.dvb.notif-ia-registration-request+xml -# application/vnd.dvb.notif-ia-registration-response+xml -# application/vnd.dvb.notif-init+xml -# application/vnd.dvb.pfr -application/vnd.dvb.service svc -# application/vnd.dxr -application/vnd.dynageo geo -# application/vnd.easykaraoke.cdgdownload -# application/vnd.ecdis-update -application/vnd.ecowin.chart mag -# application/vnd.ecowin.filerequest -# application/vnd.ecowin.fileupdate -# application/vnd.ecowin.series -# application/vnd.ecowin.seriesrequest -# application/vnd.ecowin.seriesupdate -# application/vnd.emclient.accessrequest+xml -application/vnd.enliven nml -# application/vnd.eprints.data+xml -application/vnd.epson.esf esf -application/vnd.epson.msf msf -application/vnd.epson.quickanime qam -application/vnd.epson.salt slt -application/vnd.epson.ssf ssf -# application/vnd.ericsson.quickcall -application/vnd.eszigno3+xml es3 et3 -# application/vnd.etsi.aoc+xml -# application/vnd.etsi.cug+xml -# application/vnd.etsi.iptvcommand+xml -# application/vnd.etsi.iptvdiscovery+xml -# application/vnd.etsi.iptvprofile+xml -# application/vnd.etsi.iptvsad-bc+xml -# application/vnd.etsi.iptvsad-cod+xml -# application/vnd.etsi.iptvsad-npvr+xml -# application/vnd.etsi.iptvservice+xml -# application/vnd.etsi.iptvsync+xml -# application/vnd.etsi.iptvueprofile+xml -# application/vnd.etsi.mcid+xml -# application/vnd.etsi.overload-control-policy-dataset+xml -# application/vnd.etsi.sci+xml -# application/vnd.etsi.simservs+xml -# application/vnd.etsi.tsl+xml -# application/vnd.etsi.tsl.der -# application/vnd.eudora.data -application/vnd.ezpix-album ez2 -application/vnd.ezpix-package ez3 -# application/vnd.f-secure.mobile -application/vnd.fdf fdf -application/vnd.fdsn.mseed mseed -application/vnd.fdsn.seed seed dataless -# application/vnd.ffsns -# application/vnd.fints -application/vnd.flographit gph -application/vnd.fluxtime.clip ftc -# application/vnd.font-fontforge-sfd -application/vnd.framemaker fm frame maker book -application/vnd.frogans.fnc fnc -application/vnd.frogans.ltf ltf -application/vnd.fsc.weblaunch fsc -application/vnd.fujitsu.oasys oas -application/vnd.fujitsu.oasys2 oa2 -application/vnd.fujitsu.oasys3 oa3 -application/vnd.fujitsu.oasysgp fg5 -application/vnd.fujitsu.oasysprs bh2 -# application/vnd.fujixerox.art-ex -# application/vnd.fujixerox.art4 -# application/vnd.fujixerox.hbpl -application/vnd.fujixerox.ddd ddd -application/vnd.fujixerox.docuworks xdw -application/vnd.fujixerox.docuworks.binder xbd -# application/vnd.fut-misnet -application/vnd.fuzzysheet fzs -application/vnd.genomatix.tuxedo txd -# application/vnd.geocube+xml -application/vnd.geogebra.file ggb -application/vnd.geogebra.tool ggt -application/vnd.geometry-explorer gex gre -application/vnd.geonext gxt -application/vnd.geoplan g2w -application/vnd.geospace g3w -# application/vnd.globalplatform.card-content-mgt -# application/vnd.globalplatform.card-content-mgt-response -application/vnd.gmx gmx -application/vnd.google-earth.kml+xml kml -application/vnd.google-earth.kmz kmz -application/vnd.grafeq gqf gqs -# application/vnd.gridmp -application/vnd.groove-account gac -application/vnd.groove-help ghf -application/vnd.groove-identity-message gim -application/vnd.groove-injector grv -application/vnd.groove-tool-message gtm -application/vnd.groove-tool-template tpl -application/vnd.groove-vcard vcg -# application/vnd.hal+json -application/vnd.hal+xml hal -application/vnd.handheld-entertainment+xml zmm -application/vnd.hbci hbci -# application/vnd.hcl-bireports -application/vnd.hhe.lesson-player les -application/vnd.hp-hpgl hpgl -application/vnd.hp-hpid hpid -application/vnd.hp-hps hps -application/vnd.hp-jlyt jlt -application/vnd.hp-pcl pcl -application/vnd.hp-pclxl pclxl -# application/vnd.httphone -application/vnd.hydrostatix.sof-data sfd-hdstx -application/vnd.hzn-3d-crossword x3d -# application/vnd.ibm.afplinedata -# application/vnd.ibm.electronic-media -application/vnd.ibm.minipay mpy -application/vnd.ibm.modcap afp listafp list3820 -application/vnd.ibm.rights-management irm -application/vnd.ibm.secure-container sc -application/vnd.iccprofile icc icm -application/vnd.igloader igl -application/vnd.immervision-ivp ivp -application/vnd.immervision-ivu ivu -# application/vnd.informedcontrol.rms+xml -# application/vnd.informix-visionary -# application/vnd.infotech.project -# application/vnd.infotech.project+xml -application/vnd.insors.igm igm -application/vnd.intercon.formnet xpw xpx -application/vnd.intergeo i2g -# application/vnd.intertrust.digibox -# application/vnd.intertrust.nncp -application/vnd.intu.qbo qbo -application/vnd.intu.qfx qfx -# application/vnd.iptc.g2.conceptitem+xml -# application/vnd.iptc.g2.knowledgeitem+xml -# application/vnd.iptc.g2.newsitem+xml -# application/vnd.iptc.g2.packageitem+xml -application/vnd.ipunplugged.rcprofile rcprofile -application/vnd.irepository.package+xml irp -application/vnd.is-xpr xpr -application/vnd.isac.fcs fcs -application/vnd.jam jam -# application/vnd.japannet-directory-service -# application/vnd.japannet-jpnstore-wakeup -# application/vnd.japannet-payment-wakeup -# application/vnd.japannet-registration -# application/vnd.japannet-registration-wakeup -# application/vnd.japannet-setstore-wakeup -# application/vnd.japannet-verification -# application/vnd.japannet-verification-wakeup -application/vnd.jcp.javame.midlet-rms rms -application/vnd.jisp jisp -application/vnd.joost.joda-archive joda -application/vnd.kahootz ktz ktr -application/vnd.kde.karbon karbon -application/vnd.kde.kchart chrt -application/vnd.kde.kformula kfo -application/vnd.kde.kivio flw -application/vnd.kde.kontour kon -application/vnd.kde.kpresenter kpr kpt -application/vnd.kde.kspread ksp -application/vnd.kde.kword kwd kwt -application/vnd.kenameaapp htke -application/vnd.kidspiration kia -application/vnd.kinar kne knp -application/vnd.koan skp skd skt skm -application/vnd.kodak-descriptor sse -application/vnd.las.las+xml lasxml -# application/vnd.liberty-request+xml -application/vnd.llamagraphics.life-balance.desktop lbd -application/vnd.llamagraphics.life-balance.exchange+xml lbe -application/vnd.lotus-1-2-3 123 -application/vnd.lotus-approach apr -application/vnd.lotus-freelance pre -application/vnd.lotus-notes nsf -application/vnd.lotus-organizer org -application/vnd.lotus-screencam scm -application/vnd.lotus-wordpro lwp -application/vnd.macports.portpkg portpkg -# application/vnd.marlin.drm.actiontoken+xml -# application/vnd.marlin.drm.conftoken+xml -# application/vnd.marlin.drm.license+xml -# application/vnd.marlin.drm.mdcf -application/vnd.mcd mcd -application/vnd.medcalcdata mc1 -application/vnd.mediastation.cdkey cdkey -# application/vnd.meridian-slingshot -application/vnd.mfer mwf -application/vnd.mfmp mfm -application/vnd.micrografx.flo flo -application/vnd.micrografx.igx igx -application/vnd.mif mif -# application/vnd.minisoft-hp3000-save -# application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.mobius.daf daf -application/vnd.mobius.dis dis -application/vnd.mobius.mbk mbk -application/vnd.mobius.mqy mqy -application/vnd.mobius.msl msl -application/vnd.mobius.plc plc -application/vnd.mobius.txf txf -application/vnd.mophun.application mpn -application/vnd.mophun.certificate mpc -# application/vnd.motorola.flexsuite -# application/vnd.motorola.flexsuite.adsi -# application/vnd.motorola.flexsuite.fis -# application/vnd.motorola.flexsuite.gotap -# application/vnd.motorola.flexsuite.kmr -# application/vnd.motorola.flexsuite.ttc -# application/vnd.motorola.flexsuite.wem -# application/vnd.motorola.iprm -application/vnd.mozilla.xul+xml xul -application/vnd.ms-artgalry cil -# application/vnd.ms-asf -application/vnd.ms-cab-compressed cab -application/vnd.ms-excel xls xlm xla xlc xlt xlw -application/vnd.ms-excel.addin.macroenabled.12 xlam -application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb -application/vnd.ms-excel.sheet.macroenabled.12 xlsm -application/vnd.ms-excel.template.macroenabled.12 xltm -application/vnd.ms-fontobject eot -application/vnd.ms-htmlhelp chm -application/vnd.ms-ims ims -application/vnd.ms-lrm lrm -# application/vnd.ms-office.activex+xml -application/vnd.ms-officetheme thmx -application/vnd.ms-pki.seccat cat -application/vnd.ms-pki.stl stl -# application/vnd.ms-playready.initiator+xml -application/vnd.ms-powerpoint ppt pps pot -application/vnd.ms-powerpoint.addin.macroenabled.12 ppam -application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm -application/vnd.ms-powerpoint.slide.macroenabled.12 sldm -application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm -application/vnd.ms-powerpoint.template.macroenabled.12 potm -application/vnd.ms-project mpp mpt -# application/vnd.ms-tnef -# application/vnd.ms-wmdrm.lic-chlg-req -# application/vnd.ms-wmdrm.lic-resp -# application/vnd.ms-wmdrm.meter-chlg-req -# application/vnd.ms-wmdrm.meter-resp -application/vnd.ms-word.document.macroenabled.12 docm -application/vnd.ms-word.template.macroenabled.12 dotm -application/vnd.ms-works wps wks wcm wdb -application/vnd.ms-wpl wpl -application/vnd.ms-xpsdocument xps -application/vnd.mseq mseq -# application/vnd.msign -# application/vnd.multiad.creator -# application/vnd.multiad.creator.cif -# application/vnd.music-niff -application/vnd.musician mus -application/vnd.muvee.style msty -application/vnd.mynfc taglet -# application/vnd.ncd.control -# application/vnd.ncd.reference -# application/vnd.nervana -# application/vnd.netfpx -application/vnd.neurolanguage.nlu nlu -application/vnd.noblenet-directory nnd -application/vnd.noblenet-sealer nns -application/vnd.noblenet-web nnw -# application/vnd.nokia.catalogs -# application/vnd.nokia.conml+wbxml -# application/vnd.nokia.conml+xml -# application/vnd.nokia.isds-radio-presets -# application/vnd.nokia.iptv.config+xml -# application/vnd.nokia.landmark+wbxml -# application/vnd.nokia.landmark+xml -# application/vnd.nokia.landmarkcollection+xml -# application/vnd.nokia.n-gage.ac+xml -application/vnd.nokia.n-gage.data ngdat -application/vnd.nokia.n-gage.symbian.install n-gage -# application/vnd.nokia.ncd -# application/vnd.nokia.pcd+wbxml -# application/vnd.nokia.pcd+xml -application/vnd.nokia.radio-preset rpst -application/vnd.nokia.radio-presets rpss -application/vnd.novadigm.edm edm -application/vnd.novadigm.edx edx -application/vnd.novadigm.ext ext -# application/vnd.ntt-local.file-transfer -# application/vnd.ntt-local.sip-ta_remote -# application/vnd.ntt-local.sip-ta_tcp_stream -application/vnd.oasis.opendocument.chart odc -application/vnd.oasis.opendocument.chart-template otc -application/vnd.oasis.opendocument.database odb -application/vnd.oasis.opendocument.formula odf -application/vnd.oasis.opendocument.formula-template odft -application/vnd.oasis.opendocument.graphics odg -application/vnd.oasis.opendocument.graphics-template otg -application/vnd.oasis.opendocument.image odi -application/vnd.oasis.opendocument.image-template oti -application/vnd.oasis.opendocument.presentation odp -application/vnd.oasis.opendocument.presentation-template otp -application/vnd.oasis.opendocument.spreadsheet ods -application/vnd.oasis.opendocument.spreadsheet-template ots -application/vnd.oasis.opendocument.text odt -application/vnd.oasis.opendocument.text-master odm -application/vnd.oasis.opendocument.text-template ott -application/vnd.oasis.opendocument.text-web oth -# application/vnd.obn -# application/vnd.oftn.l10n+json -# application/vnd.oipf.contentaccessdownload+xml -# application/vnd.oipf.contentaccessstreaming+xml -# application/vnd.oipf.cspg-hexbinary -# application/vnd.oipf.dae.svg+xml -# application/vnd.oipf.dae.xhtml+xml -# application/vnd.oipf.mippvcontrolmessage+xml -# application/vnd.oipf.pae.gem -# application/vnd.oipf.spdiscovery+xml -# application/vnd.oipf.spdlist+xml -# application/vnd.oipf.ueprofile+xml -# application/vnd.oipf.userprofile+xml -application/vnd.olpc-sugar xo -# application/vnd.oma-scws-config -# application/vnd.oma-scws-http-request -# application/vnd.oma-scws-http-response -# application/vnd.oma.bcast.associated-procedure-parameter+xml -# application/vnd.oma.bcast.drm-trigger+xml -# application/vnd.oma.bcast.imd+xml -# application/vnd.oma.bcast.ltkm -# application/vnd.oma.bcast.notification+xml -# application/vnd.oma.bcast.provisioningtrigger -# application/vnd.oma.bcast.sgboot -# application/vnd.oma.bcast.sgdd+xml -# application/vnd.oma.bcast.sgdu -# application/vnd.oma.bcast.simple-symbol-container -# application/vnd.oma.bcast.smartcard-trigger+xml -# application/vnd.oma.bcast.sprov+xml -# application/vnd.oma.bcast.stkm -# application/vnd.oma.cab-address-book+xml -# application/vnd.oma.cab-feature-handler+xml -# application/vnd.oma.cab-pcc+xml -# application/vnd.oma.cab-user-prefs+xml -# application/vnd.oma.dcd -# application/vnd.oma.dcdc -application/vnd.oma.dd2+xml dd2 -# application/vnd.oma.drm.risd+xml -# application/vnd.oma.group-usage-list+xml -# application/vnd.oma.pal+xml -# application/vnd.oma.poc.detailed-progress-report+xml -# application/vnd.oma.poc.final-report+xml -# application/vnd.oma.poc.groups+xml -# application/vnd.oma.poc.invocation-descriptor+xml -# application/vnd.oma.poc.optimized-progress-report+xml -# application/vnd.oma.push -# application/vnd.oma.scidm.messages+xml -# application/vnd.oma.xcap-directory+xml -# application/vnd.omads-email+xml -# application/vnd.omads-file+xml -# application/vnd.omads-folder+xml -# application/vnd.omaloc-supl-init -application/vnd.openofficeorg.extension oxt -# application/vnd.openxmlformats-officedocument.custom-properties+xml -# application/vnd.openxmlformats-officedocument.customxmlproperties+xml -# application/vnd.openxmlformats-officedocument.drawing+xml -# application/vnd.openxmlformats-officedocument.drawingml.chart+xml -# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml -# application/vnd.openxmlformats-officedocument.extended-properties+xml -# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml -# application/vnd.openxmlformats-officedocument.presentationml.comments+xml -# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml -application/vnd.openxmlformats-officedocument.presentationml.presentation pptx -# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml -application/vnd.openxmlformats-officedocument.presentationml.slide sldx -# application/vnd.openxmlformats-officedocument.presentationml.slide+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml -application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx -# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml -# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml -# application/vnd.openxmlformats-officedocument.presentationml.tags+xml -application/vnd.openxmlformats-officedocument.presentationml.template potx -# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx -# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml -# application/vnd.openxmlformats-officedocument.theme+xml -# application/vnd.openxmlformats-officedocument.themeoverride+xml -# application/vnd.openxmlformats-officedocument.vmldrawing -# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.document docx -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx -# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml -# application/vnd.openxmlformats-package.core-properties+xml -# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml -# application/vnd.openxmlformats-package.relationships+xml -# application/vnd.quobject-quoxdocument -# application/vnd.osa.netdeploy -application/vnd.osgeo.mapguide.package mgp -# application/vnd.osgi.bundle -application/vnd.osgi.dp dp -# application/vnd.otps.ct-kip+xml -application/vnd.palm pdb pqa oprc -# application/vnd.paos.xml -application/vnd.pawaafile paw -application/vnd.pg.format str -application/vnd.pg.osasli ei6 -# application/vnd.piaccess.application-licence -application/vnd.picsel efif -application/vnd.pmi.widget wg -# application/vnd.poc.group-advertisement+xml -application/vnd.pocketlearn plf -application/vnd.powerbuilder6 pbd -# application/vnd.powerbuilder6-s -# application/vnd.powerbuilder7 -# application/vnd.powerbuilder7-s -# application/vnd.powerbuilder75 -# application/vnd.powerbuilder75-s -# application/vnd.preminet -application/vnd.previewsystems.box box -application/vnd.proteus.magazine mgz -application/vnd.publishare-delta-tree qps -application/vnd.pvi.ptid1 ptid -# application/vnd.pwg-multiplexed -# application/vnd.pwg-xhtml-print+xml -# application/vnd.qualcomm.brew-app-res -application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb -# application/vnd.radisys.moml+xml -# application/vnd.radisys.msml+xml -# application/vnd.radisys.msml-audit+xml -# application/vnd.radisys.msml-audit-conf+xml -# application/vnd.radisys.msml-audit-conn+xml -# application/vnd.radisys.msml-audit-dialog+xml -# application/vnd.radisys.msml-audit-stream+xml -# application/vnd.radisys.msml-conf+xml -# application/vnd.radisys.msml-dialog+xml -# application/vnd.radisys.msml-dialog-base+xml -# application/vnd.radisys.msml-dialog-fax-detect+xml -# application/vnd.radisys.msml-dialog-fax-sendrecv+xml -# application/vnd.radisys.msml-dialog-group+xml -# application/vnd.radisys.msml-dialog-speech+xml -# application/vnd.radisys.msml-dialog-transform+xml -# application/vnd.rainstor.data -# application/vnd.rapid -application/vnd.realvnc.bed bed -application/vnd.recordare.musicxml mxl -application/vnd.recordare.musicxml+xml musicxml -# application/vnd.renlearn.rlprint -application/vnd.rig.cryptonote cryptonote -application/vnd.rim.cod cod -application/vnd.rn-realmedia rm -application/vnd.route66.link66+xml link66 -# application/vnd.ruckus.download -# application/vnd.s3sms -application/vnd.sailingtracker.track st -# application/vnd.sbm.cid -# application/vnd.sbm.mid2 -# application/vnd.scribus -# application/vnd.sealed.3df -# application/vnd.sealed.csf -# application/vnd.sealed.doc -# application/vnd.sealed.eml -# application/vnd.sealed.mht -# application/vnd.sealed.net -# application/vnd.sealed.ppt -# application/vnd.sealed.tiff -# application/vnd.sealed.xls -# application/vnd.sealedmedia.softseal.html -# application/vnd.sealedmedia.softseal.pdf -application/vnd.seemail see -application/vnd.sema sema -application/vnd.semd semd -application/vnd.semf semf -application/vnd.shana.informed.formdata ifm -application/vnd.shana.informed.formtemplate itp -application/vnd.shana.informed.interchange iif -application/vnd.shana.informed.package ipk -application/vnd.simtech-mindmapper twd twds -application/vnd.smaf mmf -# application/vnd.smart.notebook -application/vnd.smart.teacher teacher -# application/vnd.software602.filler.form+xml -# application/vnd.software602.filler.form-xml-zip -application/vnd.solent.sdkm+xml sdkm sdkd -application/vnd.spotfire.dxp dxp -application/vnd.spotfire.sfs sfs -# application/vnd.sss-cod -# application/vnd.sss-dtf -# application/vnd.sss-ntf -application/vnd.stardivision.calc sdc -application/vnd.stardivision.draw sda -application/vnd.stardivision.impress sdd -application/vnd.stardivision.math smf -application/vnd.stardivision.writer sdw vor -application/vnd.stardivision.writer-global sgl -application/vnd.stepmania.package smzip -application/vnd.stepmania.stepchart sm -# application/vnd.street-stream -application/vnd.sun.xml.calc sxc -application/vnd.sun.xml.calc.template stc -application/vnd.sun.xml.draw sxd -application/vnd.sun.xml.draw.template std -application/vnd.sun.xml.impress sxi -application/vnd.sun.xml.impress.template sti -application/vnd.sun.xml.math sxm -application/vnd.sun.xml.writer sxw -application/vnd.sun.xml.writer.global sxg -application/vnd.sun.xml.writer.template stw -# application/vnd.sun.wadl+xml -application/vnd.sus-calendar sus susp -application/vnd.svd svd -# application/vnd.swiftview-ics -application/vnd.symbian.install sis sisx -application/vnd.syncml+xml xsm -application/vnd.syncml.dm+wbxml bdm -application/vnd.syncml.dm+xml xdm -# application/vnd.syncml.dm.notification -# application/vnd.syncml.ds.notification -application/vnd.tao.intent-module-archive tao -application/vnd.tcpdump.pcap pcap cap dmp -application/vnd.tmobile-livetv tmo -application/vnd.trid.tpt tpt -application/vnd.triscape.mxs mxs -application/vnd.trueapp tra -# application/vnd.truedoc -# application/vnd.ubisoft.webplayer -application/vnd.ufdl ufd ufdl -application/vnd.uiq.theme utz -application/vnd.umajin umj -application/vnd.unity unityweb -application/vnd.uoml+xml uoml -# application/vnd.uplanet.alert -# application/vnd.uplanet.alert-wbxml -# application/vnd.uplanet.bearer-choice -# application/vnd.uplanet.bearer-choice-wbxml -# application/vnd.uplanet.cacheop -# application/vnd.uplanet.cacheop-wbxml -# application/vnd.uplanet.channel -# application/vnd.uplanet.channel-wbxml -# application/vnd.uplanet.list -# application/vnd.uplanet.list-wbxml -# application/vnd.uplanet.listcmd -# application/vnd.uplanet.listcmd-wbxml -# application/vnd.uplanet.signal -application/vnd.vcx vcx -# application/vnd.vd-study -# application/vnd.vectorworks -# application/vnd.verimatrix.vcas -# application/vnd.vidsoft.vidconference -application/vnd.visio vsd vst vss vsw -application/vnd.visionary vis -# application/vnd.vividence.scriptfile -application/vnd.vsf vsf -# application/vnd.wap.sic -# application/vnd.wap.slc -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/vnd.webturbo wtb -# application/vnd.wfa.wsc -# application/vnd.wmc -# application/vnd.wmf.bootstrap -# application/vnd.wolfram.mathematica -# application/vnd.wolfram.mathematica.package -application/vnd.wolfram.player nbp -application/vnd.wordperfect wpd -application/vnd.wqd wqd -# application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf stf -# application/vnd.wv.csp+wbxml -# application/vnd.wv.csp+xml -# application/vnd.wv.ssp+xml -application/vnd.xara xar -application/vnd.xfdl xfdl -# application/vnd.xfdl.webform -# application/vnd.xmi+xml -# application/vnd.xmpie.cpkg -# application/vnd.xmpie.dpkg -# application/vnd.xmpie.plan -# application/vnd.xmpie.ppkg -# application/vnd.xmpie.xlim -application/vnd.yamaha.hv-dic hvd -application/vnd.yamaha.hv-script hvs -application/vnd.yamaha.hv-voice hvp -application/vnd.yamaha.openscoreformat osf -application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg -# application/vnd.yamaha.remote-setup -application/vnd.yamaha.smaf-audio saf -application/vnd.yamaha.smaf-phrase spf -# application/vnd.yamaha.through-ngn -# application/vnd.yamaha.tunnel-udpencap -application/vnd.yellowriver-custom-menu cmp -application/vnd.zul zir zirz -application/vnd.zzazz.deck+xml zaz -application/voicexml+xml vxml -# application/vq-rtcpxr -# application/watcherinfo+xml -# application/whoispp-query -# application/whoispp-response -application/widget wgt -application/winhlp hlp -# application/wita -# application/wordperfect5.1 -application/wsdl+xml wsdl -application/wspolicy+xml wspolicy -application/x-7z-compressed 7z -application/x-abiword abw -application/x-ace-compressed ace -application/x-authorware-bin aab x32 u32 vox -application/x-authorware-map aam -application/x-authorware-seg aas -application/x-bcpio bcpio -application/x-bittorrent torrent -application/x-bzip bz -application/x-bzip2 bz2 boz -application/x-cdlink vcd -application/x-chat chat -application/x-chess-pgn pgn -# application/x-compress -application/x-cpio cpio -application/x-csh csh -application/x-debian-package deb udeb -application/x-director dir dcr dxr cst cct cxt w3d fgd swa -application/x-doom wad -application/x-dtbncx+xml ncx -application/x-dtbook+xml dtb -application/x-dtbresource+xml res -application/x-dvi dvi -application/x-font-bdf bdf -# application/x-font-dos -# application/x-font-framemaker -application/x-font-ghostscript gsf -# application/x-font-libgrx -application/x-font-linux-psf psf -application/x-font-otf otf -application/x-font-pcf pcf -application/x-font-snf snf -# application/x-font-speedo -# application/x-font-sunos-news -application/x-font-ttf ttf ttc -application/x-font-type1 pfa pfb pfm afm -application/x-font-woff woff -# application/x-font-vfont -application/x-futuresplash spl -application/x-gnumeric gnumeric -application/x-gtar gtar -# application/x-gzip -application/x-hdf hdf -application/x-java-jnlp-file jnlp -application/x-latex latex -application/x-mobipocket-ebook prc mobi -application/x-ms-application application -application/x-ms-wmd wmd -application/x-ms-wmz wmz -application/x-ms-xbap xbap -application/x-msaccess mdb -application/x-msbinder obd -application/x-mscardfile crd -application/x-msclip clp -application/x-msdownload exe dll com bat msi -application/x-msmediaview mvb m13 m14 -application/x-msmetafile wmf -application/x-msmoney mny -application/x-mspublisher pub -application/x-msschedule scd -application/x-msterminal trm -application/x-mswrite wri -application/x-netcdf nc cdf -application/x-pkcs12 p12 pfx -application/x-pkcs7-certificates p7b spc -application/x-pkcs7-certreqresp p7r -application/x-rar-compressed rar -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-silverlight-app xap -application/x-stuffit sit -application/x-stuffitx sitx -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-tex-tfm tfm -application/x-texinfo texinfo texi -application/x-ustar ustar -application/x-wais-source src -application/x-x509-ca-cert der crt -application/x-xfig fig -application/x-xpinstall xpi -# application/x400-bp -# application/xcap-att+xml -# application/xcap-caps+xml -application/xcap-diff+xml xdf -# application/xcap-el+xml -# application/xcap-error+xml -# application/xcap-ns+xml -# application/xcon-conference-info-diff+xml -# application/xcon-conference-info+xml -application/xenc+xml xenc -application/xhtml+xml xhtml xht -# application/xhtml-voice+xml -application/xml xml xsl -application/xml-dtd dtd -# application/xml-external-parsed-entity -# application/xmpp+xml -application/xop+xml xop -application/xslt+xml xslt -application/xspf+xml xspf -application/xv+xml mxml xhvml xvml xvm -application/yang yang -application/yin+xml yin -application/zip zip -# audio/1d-interleaved-parityfec -# audio/32kadpcm -# audio/3gpp -# audio/3gpp2 -# audio/ac3 -audio/adpcm adp -# audio/amr -# audio/amr-wb -# audio/amr-wb+ -# audio/asc -# audio/atrac-advanced-lossless -# audio/atrac-x -# audio/atrac3 -audio/basic au snd -# audio/bv16 -# audio/bv32 -# audio/clearmode -# audio/cn -# audio/dat12 -# audio/dls -# audio/dsr-es201108 -# audio/dsr-es202050 -# audio/dsr-es202211 -# audio/dsr-es202212 -# audio/dv -# audio/dvi4 -# audio/eac3 -# audio/evrc -# audio/evrc-qcp -# audio/evrc0 -# audio/evrc1 -# audio/evrcb -# audio/evrcb0 -# audio/evrcb1 -# audio/evrcwb -# audio/evrcwb0 -# audio/evrcwb1 -# audio/example -# audio/fwdred -# audio/g719 -# audio/g722 -# audio/g7221 -# audio/g723 -# audio/g726-16 -# audio/g726-24 -# audio/g726-32 -# audio/g726-40 -# audio/g728 -# audio/g729 -# audio/g7291 -# audio/g729d -# audio/g729e -# audio/gsm -# audio/gsm-efr -# audio/gsm-hr-08 -# audio/ilbc -# audio/ip-mr_v2.5 -# audio/l16 -# audio/l20 -# audio/l24 -# audio/l8 -# audio/lpc -audio/midi mid midi kar rmi -# audio/mobile-xmf -audio/mp4 mp4a -# audio/mp4a-latm -# audio/mpa -# audio/mpa-robust -audio/mpeg mpga mp2 mp2a mp3 m2a m3a -# audio/mpeg4-generic -audio/ogg oga ogg spx -# audio/parityfec -# audio/pcma -# audio/pcma-wb -# audio/pcmu-wb -# audio/pcmu -# audio/prs.sid -# audio/qcelp -# audio/red -# audio/rtp-enc-aescm128 -# audio/rtp-midi -# audio/rtx -# audio/smv -# audio/smv0 -# audio/smv-qcp -# audio/sp-midi -# audio/speex -# audio/t140c -# audio/t38 -# audio/telephone-event -# audio/tone -# audio/uemclip -# audio/ulpfec -# audio/vdvi -# audio/vmr-wb -# audio/vnd.3gpp.iufp -# audio/vnd.4sb -# audio/vnd.audiokoz -# audio/vnd.celp -# audio/vnd.cisco.nse -# audio/vnd.cmles.radio-events -# audio/vnd.cns.anp1 -# audio/vnd.cns.inf1 -audio/vnd.dece.audio uva uvva -audio/vnd.digital-winds eol -# audio/vnd.dlna.adts -# audio/vnd.dolby.heaac.1 -# audio/vnd.dolby.heaac.2 -# audio/vnd.dolby.mlp -# audio/vnd.dolby.mps -# audio/vnd.dolby.pl2 -# audio/vnd.dolby.pl2x -# audio/vnd.dolby.pl2z -# audio/vnd.dolby.pulse.1 -audio/vnd.dra dra -audio/vnd.dts dts -audio/vnd.dts.hd dtshd -# audio/vnd.dvb.file dvb -# audio/vnd.everad.plj -# audio/vnd.hns.audio -audio/vnd.lucent.voice lvp -audio/vnd.ms-playready.media.pya pya -# audio/vnd.nokia.mobile-xmf -# audio/vnd.nortel.vbk -audio/vnd.nuera.ecelp4800 ecelp4800 -audio/vnd.nuera.ecelp7470 ecelp7470 -audio/vnd.nuera.ecelp9600 ecelp9600 -# audio/vnd.octel.sbc -# audio/vnd.qcelp -# audio/vnd.rhetorex.32kadpcm -audio/vnd.rip rip -# audio/vnd.sealedmedia.softseal.mpeg -# audio/vnd.vmx.cvsd -# audio/vorbis -# audio/vorbis-config -audio/webm weba -audio/x-aac aac -audio/x-aiff aif aiff aifc -audio/x-mpegurl m3u -audio/x-ms-wax wax -audio/x-ms-wma wma -audio/x-pn-realaudio ram ra -audio/x-pn-realaudio-plugin rmp -audio/x-wav wav -chemical/x-cdx cdx -chemical/x-cif cif -chemical/x-cmdf cmdf -chemical/x-cml cml -chemical/x-csml csml -# chemical/x-pdb -chemical/x-xyz xyz -image/bmp bmp -image/cgm cgm -# image/example -# image/fits -image/g3fax g3 -image/gif gif -image/ief ief -# image/jp2 -image/jpeg jpeg jpg jpe -# image/jpm -# image/jpx -image/ktx ktx -# image/naplps -image/png png -image/prs.btif btif -# image/prs.pti -image/svg+xml svg svgz -# image/t38 -image/tiff tiff tif -# image/tiff-fx -image/vnd.adobe.photoshop psd -# image/vnd.cns.inf2 -image/vnd.dece.graphic uvi uvvi uvg uvvg -image/vnd.dvb.subtitle sub -image/vnd.djvu djvu djv -image/vnd.dwg dwg -image/vnd.dxf dxf -image/vnd.fastbidsheet fbs -image/vnd.fpx fpx -image/vnd.fst fst -image/vnd.fujixerox.edmics-mmr mmr -image/vnd.fujixerox.edmics-rlc rlc -# image/vnd.globalgraphics.pgb -# image/vnd.microsoft.icon -# image/vnd.mix -image/vnd.ms-modi mdi -image/vnd.net-fpx npx -# image/vnd.radiance -# image/vnd.sealed.png -# image/vnd.sealedmedia.softseal.gif -# image/vnd.sealedmedia.softseal.jpg -# image/vnd.svf -image/vnd.wap.wbmp wbmp -image/vnd.xiff xif -image/webp webp -image/x-cmu-raster ras -image/x-cmx cmx -image/x-freehand fh fhc fh4 fh5 fh7 -image/x-icon ico -image/x-pcx pcx -image/x-pict pic pct -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-rgb rgb -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -# message/cpim -# message/delivery-status -# message/disposition-notification -# message/example -# message/external-body -# message/feedback-report -# message/global -# message/global-delivery-status -# message/global-disposition-notification -# message/global-headers -# message/http -# message/imdn+xml -# message/news -# message/partial -message/rfc822 eml mime -# message/s-http -# message/sip -# message/sipfrag -# message/tracking-status -# message/vnd.si.simp -# model/example -model/iges igs iges -model/mesh msh mesh silo -model/vnd.collada+xml dae -model/vnd.dwf dwf -# model/vnd.flatland.3dml -model/vnd.gdl gdl -# model/vnd.gs-gdl -# model/vnd.gs.gdl -model/vnd.gtw gtw -# model/vnd.moml+xml -model/vnd.mts mts -# model/vnd.parasolid.transmit.binary -# model/vnd.parasolid.transmit.text -model/vnd.vtu vtu -model/vrml wrl vrml -# multipart/alternative -# multipart/appledouble -# multipart/byteranges -# multipart/digest -# multipart/encrypted -# multipart/example -# multipart/form-data -# multipart/header-set -# multipart/mixed -# multipart/parallel -# multipart/related -# multipart/report -# multipart/signed -# multipart/voice-message -# text/1d-interleaved-parityfec -text/calendar ics ifb -text/css css -text/csv csv -# text/directory -# text/dns -# text/ecmascript -# text/enriched -# text/example -# text/fwdred -text/html html htm -# text/javascript -text/n3 n3 -# text/parityfec -text/plain txt text conf def list log in -# text/prs.fallenstein.rst -text/prs.lines.tag dsc -# text/vnd.radisys.msml-basic-layout -# text/red -# text/rfc822-headers -text/richtext rtx -# text/rtf -# text/rtp-enc-aescm128 -# text/rtx -text/sgml sgml sgm -# text/t140 -text/tab-separated-values tsv -text/troff t tr roff man me ms -text/turtle ttl -# text/ulpfec -text/uri-list uri uris urls -text/vcard vcard -# text/vnd.abc -text/vnd.curl curl -text/vnd.curl.dcurl dcurl -text/vnd.curl.scurl scurl -text/vnd.curl.mcurl mcurl -# text/vnd.dmclientscript -text/vnd.dvb.subtitle sub -# text/vnd.esmertec.theme-descriptor -text/vnd.fly fly -text/vnd.fmi.flexstor flx -text/vnd.graphviz gv -text/vnd.in3d.3dml 3dml -text/vnd.in3d.spot spot -# text/vnd.iptc.newsml -# text/vnd.iptc.nitf -# text/vnd.latex-z -# text/vnd.motorola.reflex -# text/vnd.ms-mediapackage -# text/vnd.net2phone.commcenter.command -# text/vnd.si.uricatalogue -text/vnd.sun.j2me.app-descriptor jad -# text/vnd.trolltech.linguist -# text/vnd.wap.si -# text/vnd.wap.sl -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/x-asm s asm -text/x-c c cc cxx cpp h hh dic -text/x-fortran f for f77 f90 -text/x-pascal p pas -text/x-java-source java -text/x-setext etx -text/x-uuencode uu -text/x-vcalendar vcs -text/x-vcard vcf -# text/xml -# text/xml-external-parsed-entity -# video/1d-interleaved-parityfec -video/3gpp 3gp -# video/3gpp-tt -video/3gpp2 3g2 -# video/bmpeg -# video/bt656 -# video/celb -# video/dv -# video/example -video/h261 h261 -video/h263 h263 -# video/h263-1998 -# video/h263-2000 -video/h264 h264 -# video/h264-rcdo -# video/h264-svc -video/jpeg jpgv -# video/jpeg2000 -video/jpm jpm jpgm -video/mj2 mj2 mjp2 -# video/mp1s -# video/mp2p -# video/mp2t -video/mp4 mp4 mp4v mpg4 -# video/mp4v-es -video/mpeg mpeg mpg mpe m1v m2v -# video/mpeg4-generic -# video/mpv -# video/nv -video/ogg ogv -# video/parityfec -# video/pointer -video/quicktime qt mov -# video/raw -# video/rtp-enc-aescm128 -# video/rtx -# video/smpte292m -# video/ulpfec -# video/vc1 -# video/vnd.cctv -video/vnd.dece.hd uvh uvvh -video/vnd.dece.mobile uvm uvvm -# video/vnd.dece.mp4 -video/vnd.dece.pd uvp uvvp -video/vnd.dece.sd uvs uvvs -video/vnd.dece.video uvv uvvv -# video/vnd.directv.mpeg -# video/vnd.directv.mpeg-tts -# video/vnd.dlna.mpeg-tts -video/vnd.dvb.file dvb -video/vnd.fvt fvt -# video/vnd.hns.video -# video/vnd.iptvforum.1dparityfec-1010 -# video/vnd.iptvforum.1dparityfec-2005 -# video/vnd.iptvforum.2dparityfec-1010 -# video/vnd.iptvforum.2dparityfec-2005 -# video/vnd.iptvforum.ttsavc -# video/vnd.iptvforum.ttsmpeg2 -# video/vnd.motorola.video -# video/vnd.motorola.videop -video/vnd.mpegurl mxu m4u -video/vnd.ms-playready.media.pyv pyv -# video/vnd.nokia.interleaved-multimedia -# video/vnd.nokia.videovoip -# video/vnd.objectvideo -# video/vnd.sealed.mpeg1 -# video/vnd.sealed.mpeg4 -# video/vnd.sealed.swf -# video/vnd.sealedmedia.softseal.mov -video/vnd.uvvu.mp4 uvu uvvu -video/vnd.vivo viv -video/webm webm -video/x-f4v f4v -video/x-fli fli -video/x-flv flv -video/x-m4v m4v -video/x-ms-asf asf asx -video/x-ms-wm wm -video/x-ms-wmv wmv -video/x-ms-wmx wmx -video/x-ms-wvx wvx -video/x-msvideo avi -video/x-sgi-movie movie -x-conference/x-cooltalk ice diff --git a/node_modules/express/node_modules/send/node_modules/mime/types/node.types b/node_modules/express/node_modules/send/node_modules/mime/types/node.types deleted file mode 100644 index b7fe8c0..0000000 --- a/node_modules/express/node_modules/send/node_modules/mime/types/node.types +++ /dev/null @@ -1,65 +0,0 @@ -# What: Google Chrome Extension -# Why: To allow apps to (work) be served with the right content type header. -# http://codereview.chromium.org/2830017 -# Added by: niftylettuce -application/x-chrome-extension crx - -# What: OTF Message Silencer -# Why: To silence the "Resource interpreted as font but transferred with MIME -# type font/otf" message that occurs in Google Chrome -# Added by: niftylettuce -font/opentype otf - -# What: HTC support -# Why: To properly render .htc files such as CSS3PIE -# Added by: niftylettuce -text/x-component htc - -# What: HTML5 application cache manifest -# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps -# per https://developer.mozilla.org/en/offline_resources_in_firefox -# Added by: louisremi -text/cache-manifest appcache manifest - -# What: node binary buffer format -# Why: semi-standard extension w/in the node community -# Added by: tootallnate -application/octet-stream buffer - -# What: The "protected" MP-4 formats used by iTunes. -# Why: Required for streaming music to browsers (?) -# Added by: broofa -application/mp4 m4p -audio/mp4 m4a - -# What: Music playlist format (http://en.wikipedia.org/wiki/M3U) -# Why: See https://github.com/bentomas/node-mime/pull/6 -# Added by: mjrusso -application/x-mpegURL m3u8 - -# What: Video format, Part of RFC1890 -# Why: See https://github.com/bentomas/node-mime/pull/6 -# Added by: mjrusso -video/MP2T ts - -# What: The FLAC lossless codec format -# Why: Streaming and serving FLAC audio -# Added by: jacobrask -audio/flac flac - -# What: EventSource mime type -# Why: mime type of Server-Sent Events stream -# http://www.w3.org/TR/eventsource/#text-event-stream -# Added by: francois2metz -text/event-stream event-stream - -# What: Mozilla App manifest mime type -# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests -# Added by: ednapiranha -application/x-web-app-manifest+json webapp - -# What: Matroska Mime Types -# Why: http://en.wikipedia.org/wiki/Matroska -# Added by: aduncan88 -video/x-matroska mkv -audio/x-matroska mka diff --git a/node_modules/express/node_modules/send/package.json b/node_modules/express/node_modules/send/package.json deleted file mode 100644 index 5e936f1..0000000 --- a/node_modules/express/node_modules/send/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "send", - "version": "0.1.0", - "description": "Better streaming static file server with Range and conditional-GET support", - "keywords": [ - "static", - "file", - "server" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "dependencies": { - "debug": "*", - "mime": "1.2.6", - "fresh": "0.1.0", - "range-parser": "0.0.4" - }, - "devDependencies": { - "mocha": "*", - "should": "*", - "supertest": "0.0.1", - "connect": "2.x" - }, - "scripts": { - "test": "make test" - }, - "main": "index", - "readme": "\n# send\n\n Send is Connect's `static()` extracted for generalized use, a streaming static file\n server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework.\n\n## Installation\n\n $ npm install send\n\n## Examples\n\n Small:\n\n```js\nvar http = require('http');\nvar send = require('send');\n\nvar app = http.createServer(function(req, res){\n send(req, req.url).pipe(res);\n});\n```\n\n Serving from a root directory with custom error-handling:\n\n```js\nvar http = require('http');\nvar send = require('send');\n\nvar app = http.createServer(function(req, res){\n // your custom error-handling logic:\n function error(err) {\n res.statusCode = err.status || 500;\n res.end(err.message);\n }\n\n // your custom directory handling logic:\n function redirect() {\n res.statusCode = 301;\n res.setHeader('Location', req.url + '/');\n res.end('Redirecting to ' + req.url + '/');\n }\n\n // transfer arbitrary files from within\n // /www/example.com/public/*\n send(req, url.parse(req.url).pathname)\n .root('/www/example.com/public')\n .on('error', error)\n .on('directory', redirect)\n .pipe(res);\n});\n```\n\n## API\n\n### Events\n\n - `error` an error occurred `(err)`\n - `directory` a directory was requested\n - `stream` file streaming has started `(stream)`\n - `end` streaming has completed\n\n### .root(dir)\n\n Serve files relative to `path`. Aliased as `.from(dir)`.\n\n### .index(path)\n\n By default send supports \"index.html\" files, to disable this\n invoke `.index(false)` or to supply a new index pass a string.\n\n### .maxage(ms)\n\n Provide a max-age in milliseconds for http caching, defaults to 0.\n\n## Error-handling\n\n By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc.\n\n## Caching\n\n It does _not_ perform internal caching, you should use a reverse proxy cache such\n as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;).\n\n## Debugging\n\n To enable `debug()` instrumentation output export __DEBUG__:\n\n```\n$ DEBUG=send node app\n```\n\n## Running tests\n\n```\n$ npm install\n$ make test\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "_id": "send@0.1.0", - "_from": "send@0.1.0" -} diff --git a/node_modules/express/package.json b/node_modules/express/package.json deleted file mode 100644 index fb41815..0000000 --- a/node_modules/express/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "name": "express", - "description": "Sinatra inspired web development framework", - "version": "3.1.2", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "contributors": [ - { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "Aaron Heckmann", - "email": "aaron.heckmann+github@gmail.com" - }, - { - "name": "Ciaran Jessup", - "email": "ciaranj@gmail.com" - }, - { - "name": "Guillermo Rauch", - "email": "rauchg@gmail.com" - } - ], - "dependencies": { - "connect": "2.7.5", - "commander": "0.6.1", - "range-parser": "0.0.4", - "mkdirp": "~0.3.4", - "cookie": "0.0.5", - "buffer-crc32": "~0.2.1", - "fresh": "0.1.0", - "methods": "0.0.1", - "send": "0.1.0", - "cookie-signature": "1.0.0", - "debug": "*" - }, - "devDependencies": { - "ejs": "*", - "mocha": "*", - "jade": "*", - "hjs": "*", - "stylus": "*", - "should": "*", - "connect-redis": "*", - "github-flavored-markdown": "*", - "supertest": "0.0.1" - }, - "keywords": [ - "express", - "framework", - "sinatra", - "web", - "rest", - "restful", - "router", - "app", - "api" - ], - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/express" - }, - "main": "index", - "bin": { - "express": "./bin/express" - }, - "scripts": { - "prepublish": "npm prune", - "test": "make test" - }, - "engines": { - "node": "*" - }, - "readme": "![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png)\n\n Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express) [![Dependency Status](https://gemnasium.com/visionmedia/express.png)](https://gemnasium.com/visionmedia/express)\n\n```js\nvar express = require('express');\nvar app = express();\n\napp.get('/', function(req, res){\n res.send('Hello World');\n});\n\napp.listen(3000);\n```\n\n## Installation\n\n $ npm install -g express\n\n## Quick Start\n\n The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:\n\n Create the app:\n\n $ npm install -g express\n $ express /tmp/foo && cd /tmp/foo\n\n Install dependencies:\n\n $ npm install\n\n Start the server:\n\n $ node app\n\n## Features\n\n * Built on [Connect](http://github.com/senchalabs/connect)\n * Robust routing\n * HTTP helpers (redirection, caching, etc)\n * View system supporting 14+ template engines\n * Content negotiation\n * Focus on high performance\n * Environment based configuration\n * Executable for generating applications quickly\n * High test coverage\n\n## Philosophy\n\n The Express philosophy is to provide small, robust tooling for HTTP servers. Making\n it a great solution for single page applications, web sites, hybrids, or public\n HTTP APIs.\n\n Built on Connect you can use _only_ what you need, and nothing more, applications\n can be as big or as small as you like, even a single file. Express does\n not force you to use any specific ORM or template engine. With support for over\n 14 template engines via [Consolidate.js](http://github.com/visionmedia/consolidate.js)\n you can quickly craft your perfect framework.\n\n## More Information\n\n * Join #express on freenode\n * [Google Group](http://groups.google.com/group/express-js) for discussion\n * Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates\n * Visit the [Wiki](http://github.com/visionmedia/express/wiki)\n * [日本語ドキュメンテーション](http://hideyukisaito.com/doc/expressjs/) by [hideyukisaito](https://github.com/hideyukisaito)\n * [Русскоязычная документация](http://jsman.ru/express/)\n * Run express examples [online](https://runnable.com/express)\n\n## Viewing Examples\n\nClone the Express repo, then install the dev dependencies to install all the example / test suite deps:\n\n $ git clone git://github.com/visionmedia/express.git --depth 1\n $ cd express\n $ npm install\n\nthen run whichever tests you want:\n\n $ node examples/content-negotiation\n\n## Running Tests\n\nTo run the test suite first invoke the following command within the repo, installing the development dependencies:\n\n $ npm install\n\nthen run the tests:\n\n $ make test\n\n## Contributors\n\n```\nproject: express\ncommits: 3559\nactive : 468 days\nfiles : 237\nauthors:\n 1891\tTj Holowaychuk 53.1%\n 1285\tvisionmedia 36.1%\n 182\tTJ Holowaychuk 5.1%\n 54\tAaron Heckmann 1.5%\n 34\tcsausdev 1.0%\n 26\tciaranj 0.7%\n 21\tRobert Sköld 0.6%\n 6\tGuillermo Rauch 0.2%\n 3\tDav Glass 0.1%\n 3\tNick Poulden 0.1%\n 2\tRandy Merrill 0.1%\n 2\tBenny Wong 0.1%\n 2\tHunter Loftis 0.1%\n 2\tJake Gordon 0.1%\n 2\tBrian McKinney 0.1%\n 2\tRoman Shtylman 0.1%\n 2\tBen Weaver 0.1%\n 2\tDave Hoover 0.1%\n 2\tEivind Fjeldstad 0.1%\n 2\tDaniel Shaw 0.1%\n 1\tMatt Colyer 0.0%\n 1\tPau Ramon 0.0%\n 1\tPero Pejovic 0.0%\n 1\tPeter Rekdal Sunde 0.0%\n 1\tRaynos 0.0%\n 1\tTeng Siong Ong 0.0%\n 1\tViktor Kelemen 0.0%\n 1\tctide 0.0%\n 1\t8bitDesigner 0.0%\n 1\tisaacs 0.0%\n 1\tmgutz 0.0%\n 1\tpikeas 0.0%\n 1\tshuwatto 0.0%\n 1\ttstrimple 0.0%\n 1\tewoudj 0.0%\n 1\tAdam Sanderson 0.0%\n 1\tAndrii Kostenko 0.0%\n 1\tAndy Hiew 0.0%\n 1\tArpad Borsos 0.0%\n 1\tAshwin Purohit 0.0%\n 1\tBenjen 0.0%\n 1\tDarren Torpey 0.0%\n 1\tGreg Ritter 0.0%\n 1\tGregory Ritter 0.0%\n 1\tJames Herdman 0.0%\n 1\tJim Snodgrass 0.0%\n 1\tJoe McCann 0.0%\n 1\tJonathan Dumaine 0.0%\n 1\tJonathan Palardy 0.0%\n 1\tJonathan Zacsh 0.0%\n 1\tJustin Lilly 0.0%\n 1\tKen Sato 0.0%\n 1\tMaciej Małecki 0.0%\n 1\tMasahiro Hayashi 0.0%\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2009-2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/visionmedia/express/issues" - }, - "_id": "express@3.1.2", - "_from": "express@~3.1.0" -} diff --git a/node_modules/express/test.js b/node_modules/express/test.js deleted file mode 100644 index 1ff7958..0000000 --- a/node_modules/express/test.js +++ /dev/null @@ -1,39 +0,0 @@ - -/** - * Module dependencies. - */ - -var express = require('./') - , app = express() - -var users = ['foo', 'bar', 'baz']; - -app.use(express.bodyParser()); -console.log(app.locals); - -app.get('/api/users', function(req, res){ - res.send(users); -}); - -app.del('/api/users', function(req, res){ - users = []; - res.send(200); -}); - -app.post('/api/users', function(req, res){ - users.push(req.body.name); - res.send(201); -}); - -app.get('/api/user/:id', function(req, res){ - var id = req.params.id; - res.send(users[id]); -}); - -app.use('/api', function(req, res, next){ - var err = new Error('Method Not Allowed'); - err.status = 405; -}); - -app.listen(5555); -console.log('listening on 5555'); diff --git a/node_modules/iced-coffee-script/.npmignore b/node_modules/iced-coffee-script/.npmignore deleted file mode 100644 index 21e430d..0000000 --- a/node_modules/iced-coffee-script/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -*.coffee -*.html -.DS_Store -.git* -Cakefile -documentation/ -examples/ -extras/coffee-script.js -raw/ -src/ -test/ diff --git a/node_modules/iced-coffee-script/CNAME b/node_modules/iced-coffee-script/CNAME deleted file mode 100644 index 9abc2e3..0000000 --- a/node_modules/iced-coffee-script/CNAME +++ /dev/null @@ -1 +0,0 @@ -icedcoffeescript.org diff --git a/node_modules/iced-coffee-script/CONTRIBUTING.md b/node_modules/iced-coffee-script/CONTRIBUTING.md deleted file mode 100644 index 6390c68..0000000 --- a/node_modules/iced-coffee-script/CONTRIBUTING.md +++ /dev/null @@ -1,9 +0,0 @@ -## How to contribute to CoffeeScript - -* Before you open a ticket or send a pull request, [search](https://github.com/jashkenas/coffee-script/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one. - -* Before sending a pull request for a feature, be sure to have [tests](https://github.com/jashkenas/coffee-script/tree/master/test). - -* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/coffee-script/tree/master/src). If you're just getting started with CoffeeScript, there's a nice [style guide](https://github.com/polarmobile/coffeescript-style-guide). - -* In your pull request, do not add documentation to `index.html` or re-build the minified `coffee-script.js` file. We'll do those things before cutting a new release. \ No newline at end of file diff --git a/node_modules/iced-coffee-script/LICENSE b/node_modules/iced-coffee-script/LICENSE deleted file mode 100644 index a396eae..0000000 --- a/node_modules/iced-coffee-script/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2009-2013 Jeremy Ashkenas - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/iced-coffee-script/README b/node_modules/iced-coffee-script/README deleted file mode 100644 index bf4c284..0000000 --- a/node_modules/iced-coffee-script/README +++ /dev/null @@ -1,56 +0,0 @@ - - - ICED - - _____ __ __ - / ____| / _|/ _| - .- ----------- -. | | ___ | |_| |_ ___ ___ - ( (ice cubes) ) | | / _ \| _| _/ _ \/ _ \ - |`-..________ ..-'| | |___| (_) | | | || __/ __/ - | | \_____\___/|_| |_| \___|\___| - | ;--. - | (__ \ _____ _ _ - | | ) ) / ____| (_) | | - | |/ / | (___ ___ _ __ _ _ __ | |_ - | ( / \___ \ / __| '__| | '_ \| __| - | |/ ____) | (__| | | | |_) | |_ - | | |_____/ \___|_| |_| .__/ \__| - `-.._________..-' | | - |_| - - - CoffeeScript is a little language that compiles into JavaScript. - IcedCoffeeScript is a superset of CoffeeScript that adds two new - keywords: await and defer. - - Install Node.js, and then the CoffeeScript compiler: - sudo bin/cake install - - Or, if you have the Node Package Manager installed: - npm install -g iced-coffee-script - (Leave off the -g if you don't wish to install globally.) - - Execute a script: - iced /path/to/script.coffee - - Compile a script: - iced -c /path/to/script.coffee - - For documentation, usage, and examples, see: - http://maxtaco.github.com/coffee-script - - For iced-specific technical documentation, see: - https://github.com/maxtaco/coffee-script/blob/iced/iced.md - - To suggest a feature, report a bug, or general discussion: - https://github.com/maxtaco/coffee-script/issues/ - - DM or tweet at me with questions: @maxtaco - - Or better yet, tweet about how much you love IcedCoffeeScript. - - The source repository: - git://github.com/maxtaco/coffee-script.git - - All contributors are listed here: - http://github.com/maxtaco/coffee-script/contributors diff --git a/node_modules/iced-coffee-script/Rakefile b/node_modules/iced-coffee-script/Rakefile deleted file mode 100644 index d90cce3..0000000 --- a/node_modules/iced-coffee-script/Rakefile +++ /dev/null @@ -1,79 +0,0 @@ -require 'rubygems' -require 'erb' -require 'fileutils' -require 'rake/testtask' -require 'json' - -desc "Build the documentation page" -task :doc do - source = 'documentation/index.html.erb' - child = fork { exec "bin/coffee -bcw -o documentation/js documentation/coffee/*.coffee" } - at_exit { Process.kill("INT", child) } - Signal.trap("INT") { exit } - loop do - mtime = File.stat(source).mtime - if !@mtime || mtime > @mtime - rendered = ERB.new(File.read(source)).result(binding) - File.open('index.html', 'w+') {|f| f.write(rendered) } - end - @mtime = mtime - sleep 1 - end -end - -desc "Build coffee-script-source gem" -task :gem do - require 'rubygems' - require 'rubygems/package' - - gemspec = Gem::Specification.new do |s| - s.name = 'coffee-script-source' - s.version = JSON.parse(File.read('package.json'))["version"] - s.date = Time.now.strftime("%Y-%m-%d") - - s.homepage = "http://jashkenas.github.com/coffee-script/" - s.summary = "The CoffeeScript Compiler" - s.description = <<-EOS - CoffeeScript is a little language that compiles into JavaScript. - Underneath all of those embarrassing braces and semicolons, - JavaScript has always had a gorgeous object model at its heart. - CoffeeScript is an attempt to expose the good parts of JavaScript - in a simple way. - EOS - - s.files = [ - 'lib/coffee_script/coffee-script.js', - 'lib/coffee_script/source.rb' - ] - - s.authors = ['Jeremy Ashkenas'] - s.email = 'jashkenas@gmail.com' - s.rubyforge_project = 'coffee-script-source' - s.license = "MIT" - end - - file = File.open("coffee-script-source.gem", "w") - Gem::Package.open(file, 'w') do |pkg| - pkg.metadata = gemspec.to_yaml - - path = "lib/coffee_script/source.rb" - contents = <<-ERUBY -module CoffeeScript - module Source - def self.bundled_path - File.expand_path("../coffee-script.js", __FILE__) - end - end -end - ERUBY - pkg.add_file_simple(path, 0644, contents.size) do |tar_io| - tar_io.write(contents) - end - - contents = File.read("extras/coffee-script.js") - path = "lib/coffee_script/coffee-script.js" - pkg.add_file_simple(path, 0644, contents.size) do |tar_io| - tar_io.write(contents) - end - end -end diff --git a/node_modules/iced-coffee-script/UPDATING.md b/node_modules/iced-coffee-script/UPDATING.md deleted file mode 100644 index 1d12153..0000000 --- a/node_modules/iced-coffee-script/UPDATING.md +++ /dev/null @@ -1,167 +0,0 @@ -# How to Keep IcedCoffeeScript Up-to-Date with Mainline CoffeeScript - -## Source - -### Current Method: Fork/Merge - -Here is the current system: - -1. Add a remote upstream repo to pull in the mainline changes: -```sh -git remote add upstream git@github.com:jashkenas/coffee-script -``` - -1. Pull from the upstream into our master branch; push to our own origin/master while we are at it. -```sh -git checkout master -git pull upstream master -git push origin master -``` - -1. Make sure the local `iced2` branch is up-to-date: -```sh -git checkout iced2 -git pull origin iced2 -``` - -1. Then do the merge: -```sh -git merge master -``` - -1. Then, once the rebase has succeeded: - a. Update the version number of `package.json` - a. Update the version number in `src/coffee-script.coffee` - -1. Then build a million different times: -```sh -./bin/cake build -./bin/cake build:parser -./bin/cake build -./bin/cake build -./bin/cake build:browser -./bin/cake test -``` - -1. You're good to push if it all looks good. First commit all the new changes post-rebase with: -```sh -git commit -a -``` - -1. Then do a push to the *iced2* branch. -```sh -git push origin iced2 -``` - -1. Make and push a new tag (supplying whatever your new version is): -``` -git tag -a -m vbump 1.6.2c -git push --tags -``` - -1. Finally, publish to npm. It's usually worth cloning out a fresh -copy from github, and then running: -```sh -npm publish -``` - -## Documentation - -The documentation system is totally separate. Here is the general idea: - -1. Make sure the *iced* branch is up-to-date: -```sh -git checkout iced2 -git pull origin iced2 -``` - -1. Checkout and update the *gh-pages* branch: -```sh -git checkout gh-pages -git pull origin gh-pages -``` - -1. Then do the merge: -```sh -git merge iced2 -``` - -1. This will destroy you with conflicts, but most of them can be worked -through. Basically, you want to call `theirs`, as below, on everything -*but* the `documentation/index.html.erb` file. - -1. Edit `documentation/index.html.erb` by hand, changing the current version -number to whatever it is nowadays. - -1. Rebuild the documentation like `index.html` and the -embedded examples. -```sh -rake doc -``` - -1. Run `docco` on the source files: -```sh -icake doc:source -``` - -1. Commit everything: -```sh -git commit -a -``` - -1. And push -```sh -git push origin gh-pages -``` - -1. Test that the `run` button still works on the front page, and that the -sandbox is still operational. - -## How Do I Build Docs for the first time on a machine? - -You are **fucked**! But here is an attempt to guide you: - -1. First of all, there's the original reference from CoffeeScript, which isn't great, but it's worth a look. Find it [here](https://github.com/jashkenas/coffee-script/wiki/%5BHowto%5D-Hacking-on-the-CoffeeScript-Compiler) - -1. Boiling it down, here's how I just did it on *Linux*. Note that due to -ruby, it's going to be a bit different on MacOS X: - -```sh -npm install -g docco # jashkenas write docco as a node module, this is easy enough -sudo apt-get install libonig2 # the ruby stuff needs this as an external lib dependency -sudo gem install ultraviolet # this installs some dependencies, etc -icake build:ultraviolet # this is likely to fail due to hardcoded paths and hacks -rake doc # give it a shot, and now you're back to where we were above -``` - -There are several hard parts about dealing with this setup. The first is -generating the appropriate `coffeescript.yaml` file from Jeremy's TexMate -bundle. That's failed on me before and plus we want to make a bunch of ICS -additions for `await` and `defer`. What I have in the `Cakefile` is my best -attempt to automate it, but it's likely to break. - -The bigger problem is figuring out where to dump `coffeescript.yaml` (or -better yet the `ics.yaml` that I make from it) when it's ready to go. This -moves around depending on the latest shenanigans in the `ultraviolet` library. -The hardcoded paths in the `Cakefile` is what worked on 8 Sep 2013, but who -knows for the future. The upshot is that these syntax files now reside in the -`textpow` library and not the `ultraviolet` library as they used to. And they -have new names --- `source.coffeescript.syntax`, for example. Good luck! - -#### To Accept Their Changes - -I wrote a little shell script called `theirs`: - -```bash -#!/bin/sh - -git checkout --theirs $* -git add $* -``` - -I run this on any *autogenerated* file that has a -conflict. For instance, those files in `lib/coffee-script/` -or `documentation/js`. For conflicts in `package.json`, `Cakefile` -or `src/`, you probably need to do a hand-merge. - - diff --git a/node_modules/iced-coffee-script/bin/cake b/node_modules/iced-coffee-script/bin/cake deleted file mode 100755 index 5965f4e..0000000 --- a/node_modules/iced-coffee-script/bin/cake +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'); -var fs = require('fs'); -var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); - -require(lib + '/coffee-script/cake').run(); diff --git a/node_modules/iced-coffee-script/bin/coffee b/node_modules/iced-coffee-script/bin/coffee deleted file mode 100755 index 3d1d71c..0000000 --- a/node_modules/iced-coffee-script/bin/coffee +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'); -var fs = require('fs'); -var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); - -require(lib + '/coffee-script/command').run(); diff --git a/node_modules/iced-coffee-script/extras/coffee-script-iced-large.js b/node_modules/iced-coffee-script/extras/coffee-script-iced-large.js deleted file mode 100644 index 972bacb..0000000 --- a/node_modules/iced-coffee-script/extras/coffee-script-iced-large.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * IcedCoffeeScript Compiler v1.6.3-g - * http://iced-coffee-script.github.io/iced-coffee-script - * - * Copyright 2011, Jeremy Ashkenas, Maxwell Krohn - * Released under the MIT License - */ -!function(n){var e=function(){function n(e){return n[e]}return n["./iced"]=function(){var n={},e={exports:n};return function(){var e,t=[].slice;n.generator=e=function(n,e,r){var i,u,o,f,c,l;return e.transform=function(n,e){return n.icedTransform(e)},e["const"]=i={k:"__iced_k",k_noop:"__iced_k_noop",param:"__iced_p_",ns:"iced",runtime:"runtime",Deferrals:"Deferrals",deferrals:"__iced_deferrals",fulfill:"_fulfill",b_while:"_break",t_while:"_while",c_while:"_continue",n_while:"_next",n_arg:"__iced_next_arg",context:"context",defer_method:"defer",slot:"__slot",assign_fn:"assign_fn",autocb:"autocb",retslot:"ret",trace:"__iced_trace",passed_deferral:"__iced_passed_deferral",findDeferral:"findDeferral",lineno:"lineno",parent:"parent",filename:"filename",funcname:"funcname",catchExceptions:"catchExceptions",runtime_modes:["node","inline","window","none","browserify"],trampoline:"trampoline"},n.makeDeferReturn=function(e,r,u,o,f){var c,l,a,s;a={};for(c in o)s=o[c],a[c]=s;return a[i.lineno]=null!=r?r[i.lineno]:void 0,l=function(){var i,o,c;return i=1<=arguments.length?t.call(arguments,0):[],null!=r&&null!=(c=r.assign_fn)&&c.apply(null,i),e?(o=e,f||(e=null),o._fulfill(u,a)):n._warn("overused deferral at "+n._trace_to_string(a))},l[i.trace]=a,l},n.__c=0,n.tickCounter=function(e){return n.__c++,0===n.__c%e?(n.__c=0,!0):!1},n.__active_trace=null,n._trace_to_string=function(n){var e;return e=n[i.funcname]||"",""+e+" ("+n[i.filename]+":"+(n[i.lineno]+1)+")"},n._warn=function(n){return"undefined"!=typeof console&&null!==console?console.log("ICED warning: "+n):void 0},r.trampoline=function(e){return n.tickCounter(500)?"undefined"!=typeof process&&null!==process?process.nextTick(e):setTimeout(e):e()},r.Deferrals=u=function(){function e(n,e){this.trace=e,this.continuation=n,this.count=1,this.ret=null}return e.prototype._call=function(e){var t;return this.continuation?(n.__active_trace=e,t=this.continuation,this.continuation=null,t(this.ret)):n._warn("Entered dead await at "+n._trace_to_string(e))},e.prototype._fulfill=function(n,e){var t=this;return--this.count>0?void 0:r.trampoline(function(){return t._call(e)})},e.prototype.defer=function(e){var t;return this.count++,t=this,n.makeDeferReturn(t,e,null,this.trace)},e.prototype._defer=function(n){return this.defer(n)},e}(),r.findDeferral=c=function(n){var e,t,r;for(t=0,r=n.length;r>t;t++)if(e=n[t],null!=e?e[i.trace]:void 0)return e;return null},r.Rendezvous=o=function(){function e(){this.completed=[],this.waiters=[],this.defer_id=0}var t;return t=function(){function n(n,e,t){this.rv=n,this.id=e,this.multi=t}return n.prototype.defer=function(n){return this.rv._deferWithId(this.id,n,this.multi)},n}(),e.prototype.wait=function(n){var e;return this.completed.length?(e=this.completed.shift(),n(e)):this.waiters.push(n)},e.prototype.defer=function(n){var e;return e=this.defer_id++,this.deferWithId(e,n)},e.prototype.id=function(n,e){return null==e&&(e=!1),new t(this,n,e)},e.prototype._fulfill=function(n){var e;return this.waiters.length?(e=this.waiters.shift(),e(n)):this.completed.push(n)},e.prototype._deferWithId=function(e,t,r){return this.count++,n.makeDeferReturn(this,t,e,{},r)},e}(),r.stackWalk=l=function(e){var t,r,u,o;for(r=[],u=e?e[i.trace]:n.__active_trace;u;)t=" at "+n._trace_to_string(u),r.push(t),u=null!=u?null!=(o=u[i.parent])?o[i.trace]:void 0:void 0;return r},r.exceptionHandler=f=function(n,e){var t;return e||(e=console.log),e(n.stack),t=l(),t.length?(e("Iced callback trace:"),e(t.join("\n"))):void 0},r.catchExceptions=function(n){return"undefined"!=typeof process&&null!==process?process.on("uncaughtException",function(e){return f(e,n),process.exit(1)}):void 0}},n.runtime={},e(this,n,n.runtime)}.call(this),e.exports}(),n["./icedlib"]=function(){var e={},t={exports:e};return function(){var t,r,i,u,o,f,c,l,a=[].slice;u=o=function(){},i=n("./iced"),e.iced=r=i.runtime,l=function(n,e,t,i){var u,f,c,l,s,d;d=o,l=r.findDeferral(arguments),f=new r.Rendezvous,i[0]=f.id(!0).defer({assign_fn:function(){return function(){return u=a.call(arguments,0)}}(),lineno:17,context:s}),setTimeout(f.id(!1).defer({lineno:18,context:s}),e),function(n){s=new r.Deferrals(n,{parent:l,filename:"src/icedlib.coffee",funcname:"_timeout"}),f.wait(s.defer({assign_fn:function(){return function(){return c=arguments[0]}}(),lineno:19})),s._fulfill()}(function(){return t&&(t[0]=c),n.apply(null,u)})},e.timeout=function(n,e,t){var r;return r=[],l(n,e,t,r),r[0]},f=function(n,e,t){var i,u,f,c;c=o,u=r.findDeferral(arguments),function(n){f=new r.Deferrals(n,{parent:u,filename:"src/icedlib.coffee",funcname:"_iand"}),t[0]=f.defer({assign_fn:function(){return function(){return i=arguments[0]}}(),lineno:34}),f._fulfill()}(function(){return i||(e[0]=!1),n()})},e.iand=function(n,e){var t;return t=[],f(n,e,t),t[0]},c=function(n,e,t){var i,u,f,c;c=o,u=r.findDeferral(arguments),function(n){f=new r.Deferrals(n,{parent:u,filename:"src/icedlib.coffee",funcname:"_ior"}),t[0]=f.defer({assign_fn:function(){return function(){return i=arguments[0]}}(),lineno:51}),f._fulfill()}(function(){return i&&(e[0]=!0),n()})},e.ior=function(n,e){var t;return t=[],c(n,e,t),t[0]},e.Pipeliner=t=function(){function n(n,e){this.window=n||1,this.delay=e||0,this.queue=[],this.n_out=0,this.cb=null,this[i["const"].deferrals]=this,this.defer=this._defer}return n.prototype.waitInQueue=function(n){var e,t,i,u=this;i=o,e=r.findDeferral(arguments),function(n){var i,o;i=[],o=function(n){var f,c,l;return f=function(){return n(i)},c=function(){return r.trampoline(function(){return o(n)})},l=function(n){return i.push(n),c()},u.n_out>=u.window?(!function(n){t=new r.Deferrals(n,{parent:e,filename:"src/icedlib.coffee",funcname:"Pipeliner.waitInQueue"}),u.cb=t.defer({lineno:88}),t._fulfill()}(l),void 0):f()},o(n)}(function(){u.n_out++,function(n){return u.delay?(!function(n){t=new r.Deferrals(n,{parent:e,filename:"src/icedlib.coffee",funcname:"Pipeliner.waitInQueue"}),setTimeout(t.defer({lineno:96}),u.delay),t._fulfill()}(n),void 0):n()}(function(){return n()})})},n.prototype.__defer=function(n,e){var t,i,u,f,c,l=this;c=o,u=r.findDeferral(arguments),function(t){f=new r.Deferrals(t,{parent:u,filename:"src/icedlib.coffee",funcname:"Pipeliner.__defer"}),i=f.defer({lineno:109}),n[0]=function(){var n,t;return n=1<=arguments.length?a.call(arguments,0):[],null!=(t=e.assign_fn)&&t.apply(null,n),i()},f._fulfill()}(function(){return l.n_out--,l.cb?(t=l.cb,l.cb=null,t()):void 0})},n.prototype._defer=function(n){var e;return e=[],this.__defer(e,n),e[0]},n.prototype.flush=function(n){var e,t,i,u,o,f=this;i=n,e=r.findDeferral(arguments),u=[],o=function(n){var i,c,l;return i=function(){return n(u)},c=function(){return r.trampoline(function(){return o(n)})},l=function(n){return u.push(n),c()},f.n_out?(!function(n){t=new r.Deferrals(n,{parent:e,filename:"src/icedlib.coffee",funcname:"Pipeliner.flush"}),f.cb=t.defer({lineno:136}),t._fulfill()}(l),void 0):i()},o(i)},n}()}.call(this),t.exports}(),n["./icedlib"]}();"function"==typeof define&&define.amd?(define(function(){return e}),define(function(){return e.iced})):(n.icedlib=e,n.iced=e.iced)}(this); \ No newline at end of file diff --git a/node_modules/iced-coffee-script/extras/coffee-script-iced.js b/node_modules/iced-coffee-script/extras/coffee-script-iced.js deleted file mode 100644 index 709e414..0000000 --- a/node_modules/iced-coffee-script/extras/coffee-script-iced.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * IcedCoffeeScript Compiler v1.6.3-g - * http://iced-coffee-script.github.io/iced-coffee-script - * - * Copyright 2011, Jeremy Ashkenas, Maxwell Krohn - * Released under the MIT License - */ -!function(t){var e=function(){function t(e){return t[e]}return t["./iced"]=function(){var t={},e={exports:t};return function(){var e,n=[].slice;t.generator=e=function(t,e,r){var i,o,u,c,a,l;return e.transform=function(t,e){return t.icedTransform(e)},e["const"]=i={k:"__iced_k",k_noop:"__iced_k_noop",param:"__iced_p_",ns:"iced",runtime:"runtime",Deferrals:"Deferrals",deferrals:"__iced_deferrals",fulfill:"_fulfill",b_while:"_break",t_while:"_while",c_while:"_continue",n_while:"_next",n_arg:"__iced_next_arg",context:"context",defer_method:"defer",slot:"__slot",assign_fn:"assign_fn",autocb:"autocb",retslot:"ret",trace:"__iced_trace",passed_deferral:"__iced_passed_deferral",findDeferral:"findDeferral",lineno:"lineno",parent:"parent",filename:"filename",funcname:"funcname",catchExceptions:"catchExceptions",runtime_modes:["node","inline","window","none","browserify"],trampoline:"trampoline"},t.makeDeferReturn=function(e,r,o,u,c){var a,l,s,f;s={};for(a in u)f=u[a],s[a]=f;return s[i.lineno]=null!=r?r[i.lineno]:void 0,l=function(){var i,u,a;return i=1<=arguments.length?n.call(arguments,0):[],null!=r&&null!=(a=r.assign_fn)&&a.apply(null,i),e?(u=e,c||(e=null),u._fulfill(o,s)):t._warn("overused deferral at "+t._trace_to_string(s))},l[i.trace]=s,l},t.__c=0,t.tickCounter=function(e){return t.__c++,0===t.__c%e?(t.__c=0,!0):!1},t.__active_trace=null,t._trace_to_string=function(t){var e;return e=t[i.funcname]||"",""+e+" ("+t[i.filename]+":"+(t[i.lineno]+1)+")"},t._warn=function(t){return"undefined"!=typeof console&&null!==console?console.log("ICED warning: "+t):void 0},r.trampoline=function(e){return t.tickCounter(500)?"undefined"!=typeof process&&null!==process?process.nextTick(e):setTimeout(e):e()},r.Deferrals=o=function(){function e(t,e){this.trace=e,this.continuation=t,this.count=1,this.ret=null}return e.prototype._call=function(e){var n;return this.continuation?(t.__active_trace=e,n=this.continuation,this.continuation=null,n(this.ret)):t._warn("Entered dead await at "+t._trace_to_string(e))},e.prototype._fulfill=function(t,e){var n=this;return--this.count>0?void 0:r.trampoline(function(){return n._call(e)})},e.prototype.defer=function(e){var n;return this.count++,n=this,t.makeDeferReturn(n,e,null,this.trace)},e.prototype._defer=function(t){return this.defer(t)},e}(),r.findDeferral=a=function(t){var e,n,r;for(n=0,r=t.length;r>n;n++)if(e=t[n],null!=e?e[i.trace]:void 0)return e;return null},r.Rendezvous=u=function(){function e(){this.completed=[],this.waiters=[],this.defer_id=0}var n;return n=function(){function t(t,e,n){this.rv=t,this.id=e,this.multi=n}return t.prototype.defer=function(t){return this.rv._deferWithId(this.id,t,this.multi)},t}(),e.prototype.wait=function(t){var e;return this.completed.length?(e=this.completed.shift(),t(e)):this.waiters.push(t)},e.prototype.defer=function(t){var e;return e=this.defer_id++,this.deferWithId(e,t)},e.prototype.id=function(t,e){return null==e&&(e=!1),new n(this,t,e)},e.prototype._fulfill=function(t){var e;return this.waiters.length?(e=this.waiters.shift(),e(t)):this.completed.push(t)},e.prototype._deferWithId=function(e,n,r){return this.count++,t.makeDeferReturn(this,n,e,{},r)},e}(),r.stackWalk=l=function(e){var n,r,o,u;for(r=[],o=e?e[i.trace]:t.__active_trace;o;)n=" at "+t._trace_to_string(o),r.push(n),o=null!=o?null!=(u=o[i.parent])?u[i.trace]:void 0:void 0;return r},r.exceptionHandler=c=function(t,e){var n;return e||(e=console.log),e(t.stack),n=l(),n.length?(e("Iced callback trace:"),e(n.join("\n"))):void 0},r.catchExceptions=function(t){return"undefined"!=typeof process&&null!==process?process.on("uncaughtException",function(e){return c(e,t),process.exit(1)}):void 0}},t.runtime={},e(this,t,t.runtime)}.call(this),e.exports}(),t["./iced"]}();"function"==typeof define&&define.amd?define(function(){return e.runtime}):t.iced=e.runtime}(this); \ No newline at end of file diff --git a/node_modules/iced-coffee-script/iced.md b/node_modules/iced-coffee-script/iced.md deleted file mode 100644 index 7061ca8..0000000 --- a/node_modules/iced-coffee-script/iced.md +++ /dev/null @@ -1,709 +0,0 @@ -# What Is IcedCoffeeScript? - -IcedCoffeeScript (ICS) is a system for handling callbacks in event-based code. -There were two existing implementations, one in [the sfslite library for -C++](https://github.com/maxtaco/sfslite), and another in the [tamejs translator -for JavaScript](https://github.com/maxtaco/tamejs). This extension to -CoffeeScript is a third implementation. The code and translation techniques -are derived from experience with JS, but with some new Coffee-style -flavoring. - -This document first presents a "Iced" tutorial (adapted from the JavaScript -version), and then discusses the specifics of the CoffeeScript implementation. - -# Installing and Running ICS - -ICS is available as an npm package: - - npm install -g iced-coffee-script - -You can alternatively checkout ICS and install from source: - - git clone https://github.com/maxtaco/coffee-script - ./bin/cake install - -This will give you libraries under `iced-coffee-script` and -the binaries `iced` and `icake`, which are replacements -for `coffee` and `cake` respectively. In almost all cases, -`iced` should serve as a drop-in replacement for `coffee`, -since the ICS language is a superset of CoffeeScript. - -For more information about CS and ICS, you can also see -our brochure page. - -# Quick Tutorial and Examples - -Here is a simple example that prints "hello" 10 times, with 100ms -delay slots in between: - -```coffeescript -# A basic serial loop -for i in [0..10] - await setTimeout(defer(), 100) - console.log "hello" -``` - -There is one new language addition here, the `await ... ` block (or -expression), and also one new primitive function, `defer`. The two of -them work in concert. A function must "wait" at the close of a -`await` block until all `defer`rals made in that `await` block are -fulfilled. The function `defer` returns a callback, and a callee in -an `await` block can fulfill a deferral by simply calling the callback -it was given. In the code above, there is only one deferral produced -in each iteration of the loop, so after it's fulfilled by `setTimer` -in 100ms, control continues past the `await` block, onto the log line, -and back to the next iteration of the loop. The code looks and feels -like threaded code, but is still in the asynchronous idiom (if you -look at the rewritten code output by the *coffee* compiler). - -This next example does the same, while showcasing power of the -`await..` language addition. In the example below, the two timers -are fired in parallel, and only when both have fulfilled their deferrals -(after 100ms), does progress continue... - -```coffeescript -for i in [0..10] - await - setTimeout defer(), 100 - setTimeout defer(), 10 - console.log ("hello"); -``` - -Now for something more useful. Here is a parallel DNS resolver that -will exit as soon as the last of your resolutions completes: - -```coffeescript -dns = require("dns"); - -do_one = (cb, host) -> - await dns.resolve host, "A", defer(err, ip) - msg = if err then "ERROR! #{err}" else "#{host} -> #{ip}" - console.log msg - cb() - -do_all = (lst) -> - await - for h in lst - do_one defer(), h - -do_all process.argv[2...] -``` - -You can run this on the command line like so: - - iced examples/iced/dns.coffee yahoo.com google.com nytimes.com okcupid.com tinyurl.com - -And you will get a response: - - yahoo.com -> 72.30.2.43,98.137.149.56,209.191.122.70,67.195.160.76,69.147.125.65 - google.com -> 74.125.93.105,74.125.93.99,74.125.93.104,74.125.93.147,74.125.93.106,74.125.93.103 - nytimes.com -> 199.239.136.200 - okcupid.com -> 66.59.66.6 - tinyurl.com -> 195.66.135.140,195.66.135.139 - -If you want to run these DNS resolutions in serial (rather than -parallel), then the change from above is trivial: just switch the -order of the `await` and `for` statements above: - -```coffeescript -do_all = (lst) -> - for h in lst - await - do_one defer(), h -``` - -### Slightly More Advanced Example - -We've shown parallel and serial work flows, what about something in -between? For instance, we might want to make progress in parallel on -our DNS lookups, but not smash the server all at once. A compromise is -windowing, which can be achieved in IcedCoffeeScript conveniently in a -number of different ways. The [2007 academic paper on -tame](http://pdos.csail.mit.edu/~max/docs/tame.pdf) suggests a -technique called a *rendezvous*. A rendezvous is implemented in -CoffeeScript as a pure CS construct (no rewriting involved), which -allows a program to continue as soon as the first deferral is -fulfilled (rather than the last): - -```coffeescript -do_all = (lst, windowsz) -> - rv = new iced.Rendezvous - nsent = 0 - nrecv = 0 - - while nrecv < lst.length - if nsent - nrecv < windowsz and nsent < n - do_one rv.id(nsent).defer(), lst[nsent] - nsent++ - else - await rv.wait defer evid - console.log "got back lookup nsent=#{evid}" - nrecv++ -``` - -This code maintains two counters: the number of requests sent, and the -number received. It keeps looping until the last lookup is received. -Inside the loop, if there is room in the window and there are more to -send, then send; otherwise, wait and harvest. `Rendezvous.defer` -makes a deferral much like the `defer` primitive, but it can be -labeled with an identifier. This way, the waiter can know which -deferral has fulfilled. In this case we use the variable `nsent` as the -defer ID --- it's the ID of this deferral in launch order. When we -harvest the deferral, `rv.wait` fires its callback with the ID of the -deferral that's harvested. - -Note that with windowing, the arrival order might not be the same as -the issue order. In this example, a slower DNS lookup might arrive -after faster ones, even if issued before them. - -### Composing Serial And Parallel Patterns - -In IcedCoffeeScript, arbitrary composition of serial and parallel control flows is -possible with just normal functional decomposition. Therefore, we -don't allow direct `await` nesting. With inline anonymous CoffeeScript -functions, you can concisely achieve interesting patterns. The code -below launches 10 parallel computations, each of which must complete -two serial actions before finishing: - -```coffeescript -f = (n,cb) -> - await - for i in [0..n] - ((cb) -> - await setTimeout defer(), 5 * Math.random() - await setTimeout defer(), 4 * Math.random() - cb() - )(defer()) - cb() -``` - -### autocb - -Most of the time, an iced function will call its callback and return -at the same time. To get this behavior "for free", you can simply -name this callback `autocb` and it will fire whenever your iced function -returns. For instance, the above example could be equivalently written as: - -```coffeescript -f = (n,autocb) -> - await - for i in [0..n] - ((autocb) -> - setTimeout defer(), 5 * Math.random() - setTimeout defer(), 4 * Math.random() - )(defer()) -``` -In the first example, recall, you call `cb()` explicitly. In this -example, because the callback is named `autocb`, it's fired -automatically when the iced function returns. - -If your callback needs to fulfill with a value, then you can pass -that value via `return`. Consider the following function, that waits -for a random number of seconds between 0 and 4. After waiting, it -then fulfills its callback `cb` with the amount of time it waited: - -```coffeescript -rand_wait = (cb) -> - time = Math.floor Math.random() * 5 - if time is 0 - cb(0) - return - await setTimeout defer(), time - cb(time) # return here, implicitly..... -``` - -This function can written equivalently with `autocb` as: - -```coffeescript -rand_wait = (autocb) -> - time = Math.floor Math.random() * 5 - return 0 if time is 0 - await setTimeout defer(), time - return time -``` - -Implicitly, `return 0;` is mapped by the CoffeeScript compiler to `autocb(0); return`. - -## Language Design Considerations - -In sum, the iced additions to CoffeeScript consist of three new keywords: - -* **await**, marking off a block or a single statement. -* **defer**, which is quite similar to a normal function call, but is compiled specially -to accommodate argument passing. - -Finally, `autocb` isn't a bona-fide keyword, but the compiler searches -for it in parameters to CoffeeScript functions, and updates the -behavior of the `Code` block accordingly. - -These keywords represent the potential for these iced additions to -break existing CoffeeScript code --- any preexisting use of these -keywords as regular function, variable or class names will cause -headaches. - -### Debugging and Stack Traces -- Now Greatly Improved! - -An oft-cited problem with async-style programming, with ICS or -hand-rolled, is that stack traces are often incomplete or -incomprehensible. If an exception is caught in a Iced function, the -stack trace will only show the "bottom half" of the call stack, or all -of those functions that are descendents of the main event loop. The -"top half" of the call stack, telling you "who _really_ called this -function," is probably long gone. - -ICS has a workaround to this problem. When an iced function is -entered, the runtime will find the first argument to the function that -was output by `defer()`. Such callbacks are annotated to contain the -file, line and function where they were created. They also are -annotated to hold a refernce to `defer()`-generated callback passed to -the function in which they were created. This chaining creates an -implicit stack that can be walked when an exception is thrown. - -Consider this example: - -```coffeescript -iced.catchExceptions() - -foo = (y) -> - await setTimeout defer(), 10 - throw new Error "oh no!" - y(10) - -bar = (x) -> - await foo defer() - x() - -baz = () -> - await bar defer() - -baz() -``` - -The function `iced.catchExceptions` sets the `uncaughtException` -handler in Node to print out the standard callstack, and also the Iced -"callstack", and then to exit. The callback generated by `defer()` -in the function `bar` holds a reference to `x`. Similarly, -the callback generated in `foo` holds a reference to `y`. -Here's what happens when this program is run: - -``` -Error: oh no! - at Deferrals.continuation (/Users/max/src/coffee-script/prog.iced:24:13) - at Deferrals._call (/Users/max/src/coffee-script/lib/coffee-script/iced.js:86:19) - at Deferrals._fulfill (/Users/max/src/coffee-script/lib/coffee-script/iced.js:97:23) - at Object._onTimeout (/Users/max/src/coffee-script/lib/coffee-script/iced.js:53:18) - at Timer.ontimeout (timers.js:84:39) -Iced 'stack' trace (w/ real line numbers): - at foo (prog.iced:4) - at bar (prog.iced:9) - at baz (prog.iced:13) -``` - -The first stack trace is the standard Node stacktrace. It is -inscrutable, since it mainly covers node internals, and has line -numbering relative to the translated file (I still haven't fixed this -bug, sorry). The second stack trace is much better. It tells the -sequence of Iced calls the lead to this exception. Line numbers are -relative to the original input file. - -The relavant API is as follows: - -#### iced.stackWalk cb - -Start from the given `cb`, or use the currently active callback -if none was given, and walk up the Iced-generated stack. Return -a list of call site descriptions. You can call this from your -own exception-handling code. - -#### iced.catchExceptions() - -Tell the runtime to catch uncaught exceptions, and to print -a Iced-aware stack dump as above. - - -### The Lowdown on defer - -The implementation of `defer` is interesting --- it's trying to -emulate ``call by reference'' in languages like C++ or Java. Here is an -example that shows off the four different cases required to make this -happen: - -```coffeescript -cb = defer x, obj.field, arr[i], rest... -``` - -And here is the output from the iced `coffee` compiler: - -```javascript -cb = __iced_deferrals.defer({ - assign_fn: (function(__slot_1, __slot_2, __slot_3) { - return function() { - x = arguments[0]; - __slot_1.field = arguments[1]; - __slot_2[__slot_3] = arguments[2]; - return rest = __slice.call(arguments, 3); - }; - })(obj, arr, i) - }); -``` - -The `__iced_deferrals` object is an internal object of type `Deferrals` -that's collecting all calls to `defer` in the current `await` block. -The one in question should fulfill with 3 or more values. When it does, -it will call into the innermost anonymous function to perform the -appropriate assignments in the original scope. The four cases are: - -1. **Simple assignment** --- seen in `x = arguments[0]`. Here, the -`x` variable is in the scope of the original `defer` call. - -1. **Object slot assignment** --- seen in `__slot_1.field = arguments[1]`. -Here, the reference `obj` must be captured at the time of the `defer` call, -and `obj.field` is filled in later. - -1. **Array cell assignment** --- seen in `__slot_2[__slot_3] = arguments[2]`. -This of course will work on an array or an object. Here, the reference -to the array, and the value of the index must be captured when `defer` -is called, and the cell is assigned later. - -1. **Splat assignment** --- seen in `res = __slice.call(arguments,3)`. -This is much like a simple assignment, but allows a ``splat'' meaning -assignment of multiple values at once, accessed as an array. - -These specifics are also detailed in the code in the `Defer` class, -file `nodes.coffee`. - -### Awaits No Longer Work as Expressions - -The following do not work and will generate syntax errors at compile time: - -```coffeescript -y = (await foo defer x) -``` - -```coffeescript -x = if true - await foo defer y - y -else 10 -``` - -```coffescript -my_func 10, ( - await foo defer y - y -) -``` - -That is, you can't treat `await` statements as expressions. -And recursively speaking, you can't treat any blocks that -contain `await` statements as expressions. Previous versions of -IcedCoffeeScript supported this arcane feature, but it was extremely -difficult to implement properly, and unnecessarily obscured the -control flow of iced programs. - -## Translation Technique - -The IcedCoffeeScript addition uses a similar continuation-passing translation -to *tamejs*, but it's been refined to generate cleaner code, and to translate -only when necessary. Here are the general steps involved: - -* **1** Run the standard CoffeeScript lexer, rewriter, and parser, with a -few small additions (for `await` and `defer`), yielding -a standard CoffeeScript-style abstract syntax tree (AST). - -* **2** Apply *iced annotations*: - - * **2.1** Find all `await` nodes in the AST. Mark these nodes and their - ancestors with an **A** flag. - - * **2.2** Find all `for`, `while`, `until`, or `loop` nodes marked with - **A**. Flood them and their descendants with an **L** flag. Stop - flooding when the first loop without an **A** flag is hit. - - * **2.3** Find all `continue` or `break` nodes marked with an **L** flag. - Mark them and their descendants with a **P** flag. - -* **3** ``Rotate'' all those nodes marked with **A** or **P**: - - * **3.1** For each `Block` node _b_ in the `AST` marked **A** or **P**: - - * **3.1.1** Find _b_'s first child _c_ marked with **A** or **P**. - - * **3.1.2** Cut _b_'s list of expressions after _c_, and move those - expressions on the right of the cut into a new block, called - _d_. This block is _c_'s continuation block and becomes _c_'s - child in the AST. This is the actual ``rotation.'' - - * **3.1.3** Call the rotation recursively on the child block _d_. - - * **3.1.4** Add an additional code to _c_'s body, which is to call the - continuation represented by _d_. For `if` statements this means - calling the continuation in both branches; for `switch` - statements, this means calling the continuation from all - branches; for loops, this means calling `continue` at the end of - the loop body; for blocks, this means just calling the - continuation as the last statement in the block. See - `callContinuation` in `nodes.coffee.` - -* **4** Output preamble/boilerplate; for the case of JavaScript output to -browsers, inline the small class `Deferrals` needed during runtime; -for node-based server-side JavaScript, a `require` statement suffices -here. Only do this if the source file has a `defer` statement -in it. - -* **5** Compile as normal. The effect of the above is to mutate the original -CoffeeScript AST into another valid CoffeeScript AST. This AST is then -compiled with the normal rules. - - -Translation Example ------------------- - -For an example translation, consider the following block of code: - -```coffeescript - -while x1 - f1() - -while x2 - if y - f2() - continue - f3() - await - f4(defer()) - if z - f5() - break - f6() - -while x3 - f7() -``` - -* Here is schematic diagram for this AST: - - - -* After Step 2.1, nodes in blue are marked with **A**. Recall, Step 2.1 traces -upwards from all `await` blocks. - - - -* After Step 2.2, nodes in purple are marked with **L**. Recall, Step 2.2 floods -downwards from any any loops marked with **A**. - - - -* After Step 2.3, nodes in yellow are marked with **P**. Recall, Step 2.3 -traces upwards from any jumps marked with **L**. - - - -* The green nodes are those marked with **A** or **P**. They are "marked" -for rotations in the next step. - - - -* In Step 3, rotate all marked nodes AST nodes. This rotation -introduces the new orange `block` nodes in the graph, and attaches -them to pivot nodes as _continuation_ blocks. - - - - -* In translated code, the general format of a _pivot_ node is: - -```javascript -(function (k) { - // the body - k(); -})(function () { - // the continuation block. -} -``` - -To see how pivots and continuations are output in our example, look -at this portion of the AST, introduced after Step 3: - - ![detail](/media/detail.png) - -Here is the translated output (slightly hand-edited for clarity): - -```javascript -(function() { - // await block f4() - (function(k) { - var __deferrals = new iced.Deferrals(k); - f4(__deferrals.defer({})); - __deferrals._fulfill(); - })(function() { - // The continuation block, starting at 'if z' - (function(k) { - if (z) { - f5(); - (function(k) { - // 'break' throws away the current continuation 'k' - // and just calls _break() - _break(); - })(function() { - // A continuation block, after 'break', up to 'f6()' - // This code will never be reached - f6(); - return k(); - }); - } else { - return k(); - } - })(function() { - // end of the loop, call _continue() to start at the top - return _continue(); - }); - }); -}); -``` - -## API and Library Documentation - -### iced.Rendezvous - -The `Rendezvous` is a not a core feature, meaning it's written as a -straight-ahead CoffeeScript library. It's quite useful for more advanced -control flows, so we've included it in the main runtime library. - -The `Rendezvous` is similar to a blocking condition variable (or a -"Hoare style monitor") in threaded programming. - -#### iced.Rendezvous.id(i,[multi]).defer slots... - -Associate a new deferral with the given Rendezvous, whose deferral ID -is `i`, and whose callbacks slots are supplied as `slots`. Those -slots can take the two forms of `defer` return as above. As with -standard `defer`, the return value of the `Rendezvous`'s `defer` is -fed to a function expecting a callback. As soon as that callback -fires (and the deferral is fulfilled), the provided slots will be -filled with the arguments to that callback. - -Also, note the optional boolean flag `multi`. By default, a function -generated by `defer` can be called only once, and will generate an -error on subsequent calls. Only with the `multi` flag set to `true` -(and only in the case of a `Rendezvous`), can this restriction be -relaxed. - -#### iced.Rendezvous.defer slots... - -You don't need to explicitly assign an ID to a deferral generated from a -Rendezvous. If you don't, one will automatically be assigned, in -ascending order starting from `0`. - -#### iced.Rendezvous.wait cb - -Wait until the next deferral on this rendezvous is fulfilled. When it -is, callback `cb` with the ID of the fulfilled deferral. If an -unclaimed deferral fulfilled before `wait` was called, then `cb` is fired -immediately. - -Though `wait` would work with any hand-rolled JS function expecting -a callback, it's meant to work particularly well with *tamejs*'s -`await` function. - -#### Example - -Here is an example that shows off the different inputs and -outputs of a `Rendezvous`. It does two parallel DNS lookups, -and reports only when the first returns: - -```coffeescript -hosts = [ "okcupid.com", "google.com" ]; -ips = errs = [] -rv = new iced.Rendezvous -for h,i in hosts - dns.resolve hosts[i], rv.id(i).defer errs[i], ips[i] - -await rv.wait defer which -console.log "#{hosts[which]} -> #{ips[which]}" -``` - -### connectors - -A *connector* is a function that takes as input -a callback, and outputs another callback. The best example -is a `timeout`, given here: - -#### iced.timeout(cb, time, res = []) - -Timeout an arbitrary async operation. - -Given a callback `cb`, a time to wait `time`, and an array to output a -result `res`, return another callback. This connector will set up a -race between the callback returned to the caller, and the timer that -fires after `time` milliseconds. If the callback returned to the -caller fires first, then fill `res[0] = true;`. If the timer won -(i.e., if there was a timeout), then fill `res[0] = false;`. - -In the following example, we timeout a DNS lookup after 100ms: - -```coffeescript -{timeout} = require 'icedlib' -info = []; -host = "pirateWarezSite.ru"; -await dns.lookup host, timeout(defer(err, ip), 100, info) -if not info[0] - console.log "#{host}: timed out!" -else if (err) - console.log "#{host}: error: #{err}" -else - console.log "#{host} -> #{ip}" -``` - -### The Pipeliner library - -There's another way to do the windowed DNS lookups we saw earlier --- -you can use the control flow library called `Pipeliner`, which -manages the common pattern of having "m calls total, with only -n of them in flight at once, where m > n." - -The Pipeliner class is available in the `icedlib` library: - -```coffeescript -{Pipeliner} = require 'icedlib' -pipeliner = new Pipeliner w,s -``` - -Using the pipeliner, we can rewrite our earlier windowed DNS lookups -as follows: - -```coffescript -do_all = (lst, windowsz) -> - pipeliner = new Pipeliner windowsz - for x in list - await pipeliner.waitInQueue defer() - do_one pipeliner.defer(), x - await pipeliner.flush defer() -``` - -The API is as follows: - -#### new Pipeliner w, s - -Create a new Pipeliner controller, with a window of at most `w` calls -out at once, and waiting `s` seconds before launching each call. The -default values are `w = 10` and `s = 0`. - -#### Pipeliner.waitInQueue c - -Wait in a queue until there's room in the window to launch a new call. -The callback `c` will be fulfilled when there is room. - -#### Pipeliner.defer args... - -Create a new `defer`al for this pipeline, and pass it to whatever -function is doing the actual work. When the work completes, fulfill -this `defer`al --- that will update the accounting in the pipeliner -class, allowing queued actions to proceed. - -#### Pipeliner.flush c - -Wait for the pipeline to clear out. Fulfills the callback `c` -when the last action in the pipeline is done. diff --git a/node_modules/iced-coffee-script/lib/coffee-script/browser.js b/node_modules/iced-coffee-script/lib/coffee-script/browser.js deleted file mode 100644 index 1383a60..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/browser.js +++ /dev/null @@ -1,120 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var CoffeeScript, compile, runScripts, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - - - CoffeeScript = require('./coffee-script'); - - CoffeeScript.require = require; - - compile = CoffeeScript.compile; - - CoffeeScript["eval"] = function(code, options) { - if (options == null) { - options = {}; - } - if (options.bare == null) { - options.bare = true; - } - return eval(compile(code, options)); - }; - - CoffeeScript.run = function(code, options) { - if (options == null) { - options = {}; - } - options.bare = true; - options.shiftLine = true; - return Function(compile(code, options))(); - }; - - if (typeof window === "undefined" || window === null) { - return; - } - - if ((typeof btoa !== "undefined" && btoa !== null) && (typeof JSON !== "undefined" && JSON !== null) && (typeof unescape !== "undefined" && unescape !== null) && (typeof encodeURIComponent !== "undefined" && encodeURIComponent !== null)) { - compile = function(code, options) { - var js, v3SourceMap, _ref; - if (options == null) { - options = {}; - } - options.sourceMap = true; - options.inline = true; - _ref = CoffeeScript.compile(code, options), js = _ref.js, v3SourceMap = _ref.v3SourceMap; - return "" + js + "\n//# sourceMappingURL=data:application/json;base64," + (btoa(unescape(encodeURIComponent(v3SourceMap)))) + "\n//# sourceURL=coffeescript"; - }; - } - - CoffeeScript.load = function(url, callback, options) { - var xhr; - if (options == null) { - options = {}; - } - options.sourceFiles = [url]; - xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest(); - xhr.open('GET', url, true); - if ('overrideMimeType' in xhr) { - xhr.overrideMimeType('text/plain'); - } - xhr.onreadystatechange = function() { - var _ref; - if (xhr.readyState === 4) { - if ((_ref = xhr.status) === 0 || _ref === 200) { - CoffeeScript.run(xhr.responseText, options); - } else { - throw new Error("Could not load " + url); - } - if (callback) { - return callback(); - } - } - }; - return xhr.send(null); - }; - - runScripts = function() { - var coffees, coffeetypes, execute, index, length, s, scripts; - scripts = window.document.getElementsByTagName('script'); - coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']; - coffees = (function() { - var _i, _len, _ref, _results; - _results = []; - for (_i = 0, _len = scripts.length; _i < _len; _i++) { - s = scripts[_i]; - if (_ref = s.type, __indexOf.call(coffeetypes, _ref) >= 0) { - _results.push(s); - } - } - return _results; - })(); - index = 0; - length = coffees.length; - (execute = function() { - var mediatype, options, script; - script = coffees[index++]; - mediatype = script != null ? script.type : void 0; - if (__indexOf.call(coffeetypes, mediatype) >= 0) { - options = { - literate: mediatype === 'text/literate-coffeescript' - }; - if (script.src) { - return CoffeeScript.load(script.src, execute, options); - } else { - options.sourceFiles = ['embedded']; - CoffeeScript.run(script.innerHTML, options); - return execute(); - } - } - })(); - return null; - }; - - if (window.addEventListener) { - window.addEventListener('DOMContentLoaded', runScripts, false); - } else { - window.attachEvent('onload', runScripts); - } - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/cake.js b/node_modules/iced-coffee-script/lib/coffee-script/cake.js deleted file mode 100644 index ea53548..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/cake.js +++ /dev/null @@ -1,116 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var CoffeeScript, cakefileDirectory, existsSync, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; - - - - fs = require('fs'); - - path = require('path'); - - helpers = require('./helpers'); - - optparse = require('./optparse'); - - CoffeeScript = require('./coffee-script'); - - existsSync = fs.existsSync || path.existsSync; - - tasks = {}; - - options = {}; - - switches = []; - - oparse = null; - - helpers.extend(global, { - task: function(name, description, action) { - var _ref; - if (!action) { - _ref = [description, action], action = _ref[0], description = _ref[1]; - } - return tasks[name] = { - name: name, - description: description, - action: action - }; - }, - option: function(letter, flag, description) { - return switches.push([letter, flag, description]); - }, - invoke: function(name, cb) { - if (!tasks[name]) { - missingTask(name); - } - return tasks[name].action(options); - } - }); - - exports.run = function(cb) { - var arg, args, e, _i, _len, _ref, _results; - global.__originalDirname = fs.realpathSync('.'); - process.chdir(cakefileDirectory(__originalDirname)); - args = process.argv.slice(2); - CoffeeScript.run(fs.readFileSync('Cakefile').toString(), { - filename: 'Cakefile' - }); - oparse = new optparse.OptionParser(switches); - if (!args.length) { - return printTasks(); - } - try { - options = oparse.parse(args); - } catch (_error) { - e = _error; - return fatalError("" + e); - } - _ref = options["arguments"]; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - arg = _ref[_i]; - _results.push(invoke(arg)); - } - return _results; - }; - - printTasks = function() { - var cakefilePath, desc, name, relative, spaces, task; - relative = path.relative || path.resolve; - cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile'); - console.log("" + cakefilePath + " defines the following tasks:\n"); - for (name in tasks) { - task = tasks[name]; - spaces = 20 - name.length; - spaces = spaces > 0 ? Array(spaces + 1).join(' ') : ''; - desc = task.description ? "# " + task.description : ''; - console.log("cake " + name + spaces + " " + desc); - } - if (switches.length) { - return console.log(oparse.help()); - } - }; - - fatalError = function(message) { - console.error(message + '\n'); - console.log('To see a list of all tasks/options, run "cake"'); - return process.exit(1); - }; - - missingTask = function(task) { - return fatalError("No such task: " + task); - }; - - cakefileDirectory = function(dir) { - var parent; - if (existsSync(path.join(dir, 'Cakefile'))) { - return dir; - } - parent = path.normalize(path.join(dir, '..')); - if (parent !== dir) { - return cakefileDirectory(parent); - } - throw new Error("Cakefile not found in " + (process.cwd())); - }; - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/coffee-script.js b/node_modules/iced-coffee-script/lib/coffee-script/coffee-script.js deleted file mode 100644 index 763483f..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/coffee-script.js +++ /dev/null @@ -1,373 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var Lexer, Module, SourceMap, child_process, compile, compileFile, ext, fileExtensions, findExtension, fork, formatSourcePosition, fs, getSourceMap, helpers, iced, lexer, loadFile, parser, path, sourceMaps, vm, _i, _len, - __hasProp = {}.hasOwnProperty, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - - - fs = require('fs'); - - vm = require('vm'); - - path = require('path'); - - child_process = require('child_process'); - - Lexer = require('./lexer').Lexer; - - parser = require('./parser').parser; - - helpers = require('./helpers'); - - SourceMap = require('./sourcemap').SourceMap; - - iced = require('./iced'); - - exports.VERSION = '1.6.3-g'; - - fileExtensions = ['.coffee', '.litcoffee', '.coffee.md', '.iced']; - - exports.helpers = helpers; - - exports.compile = compile = function(code, options) { - var answer, currentColumn, currentLine, fragment, fragments, header, js, map, merge, newLines, _i, _len; - if (options == null) { - options = {}; - } - merge = helpers.merge; - if (options.sourceMap) { - map = new SourceMap; - } - fragments = (iced.transform(parser.parse(lexer.tokenize(code, options)))).compileToFragments(options); - currentLine = 0; - if (options.header) { - currentLine += 1; - } - if (options.shiftLine) { - currentLine += 1; - } - currentColumn = 0; - js = ""; - for (_i = 0, _len = fragments.length; _i < _len; _i++) { - fragment = fragments[_i]; - if (options.sourceMap) { - if (fragment.locationData) { - map.add([fragment.locationData.first_line, fragment.locationData.first_column], [currentLine, currentColumn], { - noReplace: true - }); - } - newLines = helpers.count(fragment.code, "\n"); - currentLine += newLines; - currentColumn = fragment.code.length - (newLines ? fragment.code.lastIndexOf("\n") : 0); - } - js += fragment.code; - } - if (options.header) { - header = "Generated by IcedCoffeeScript " + this.VERSION; - js = "// " + header + "\n" + js; - } - if (options.sourceMap) { - answer = { - js: js - }; - answer.sourceMap = map; - answer.v3SourceMap = map.generate(options, code); - return answer; - } else { - return js; - } - }; - - exports.tokens = function(code, options) { - return lexer.tokenize(code, options); - }; - - exports.nodes = function(source, options) { - if (typeof source === 'string') { - return iced.transform(parser.parse(lexer.tokenize(source, options)), options); - } else { - return iced.transform(parser.parse(source), options); - } - }; - - exports.run = function(code, options) { - var answer, mainModule, _ref; - if (options == null) { - options = {}; - } - mainModule = require.main; - mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.'; - mainModule.moduleCache && (mainModule.moduleCache = {}); - mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename || '.'))); - if (!helpers.isCoffee(mainModule.filename) || require.extensions) { - answer = compile(code, options); - code = (_ref = answer.js) != null ? _ref : answer; - } - return mainModule._compile(code, mainModule.filename); - }; - - exports["eval"] = function(code, options) { - var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref, _ref1, _require; - if (options == null) { - options = {}; - } - if (!(code = code.trim())) { - return; - } - Script = vm.Script; - if (Script) { - if (options.sandbox != null) { - if (options.sandbox instanceof Script.createContext().constructor) { - sandbox = options.sandbox; - } else { - sandbox = Script.createContext(); - _ref = options.sandbox; - for (k in _ref) { - if (!__hasProp.call(_ref, k)) continue; - v = _ref[k]; - sandbox[k] = v; - } - } - sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox; - } else { - sandbox = global; - } - sandbox.__filename = options.filename || 'eval'; - sandbox.__dirname = path.dirname(sandbox.__filename); - if (!(sandbox !== global || sandbox.module || sandbox.require)) { - Module = require('module'); - sandbox.module = _module = new Module(options.modulename || 'eval'); - sandbox.require = _require = function(path) { - return Module._load(path, _module, true); - }; - _module.filename = sandbox.__filename; - _ref1 = Object.getOwnPropertyNames(require); - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - r = _ref1[_i]; - if (r !== 'paths') { - _require[r] = require[r]; - } - } - _require.paths = _module.paths = Module._nodeModulePaths(process.cwd()); - _require.resolve = function(request) { - return Module._resolveFilename(request, _module); - }; - } - } - o = {}; - for (k in options) { - if (!__hasProp.call(options, k)) continue; - v = options[k]; - o[k] = v; - } - o.bare = true; - js = compile(code, o); - if (sandbox === global) { - return vm.runInThisContext(js); - } else { - return vm.runInContext(js, sandbox); - } - }; - - compileFile = function(filename, sourceMap) { - var answer, err, raw, stripped; - raw = fs.readFileSync(filename, 'utf8'); - stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw; - try { - answer = compile(stripped, { - filename: filename, - sourceMap: sourceMap, - literate: helpers.isLiterate(filename) - }); - } catch (_error) { - err = _error; - err.filename = filename; - err.code = stripped; - throw err; - } - return answer; - }; - - loadFile = function(module, filename) { - var answer; - answer = compileFile(filename, false); - return module._compile(answer, filename); - }; - - if (require.extensions) { - for (_i = 0, _len = fileExtensions.length; _i < _len; _i++) { - ext = fileExtensions[_i]; - require.extensions[ext] = loadFile; - } - Module = require('module'); - findExtension = function(filename) { - var curExtension, extensions; - extensions = path.basename(filename).split('.'); - if (extensions[0] === '') { - extensions.shift(); - } - while (extensions.shift()) { - curExtension = '.' + extensions.join('.'); - if (Module._extensions[curExtension]) { - return curExtension; - } - } - return '.js'; - }; - Module.prototype.load = function(filename) { - var extension; - this.filename = filename; - this.paths = Module._nodeModulePaths(path.dirname(filename)); - extension = findExtension(filename); - Module._extensions[extension](this, filename); - return this.loaded = true; - }; - } - - if (child_process) { - fork = child_process.fork; - child_process.fork = function(path, args, options) { - var execPath; - if (args == null) { - args = []; - } - if (options == null) { - options = {}; - } - execPath = helpers.isCoffee(path) ? 'coffee' : null; - if (!Array.isArray(args)) { - args = []; - options = args || {}; - } - options.execPath || (options.execPath = execPath); - return fork(path, args, options); - }; - } - - lexer = new Lexer; - - parser.lexer = { - lex: function() { - var tag, token; - token = this.tokens[this.pos++]; - if (token) { - tag = token[0], this.yytext = token[1], this.yylloc = token[2]; - this.yylineno = this.yylloc.first_line; - } else { - tag = ''; - } - return tag; - }, - setInput: function(tokens) { - this.tokens = tokens; - return this.pos = 0; - }, - upcomingInput: function() { - return ""; - } - }; - - parser.yy = require('./nodes'); - - exports.iced = iced.runtime; - - parser.yy.parseError = function(message, _arg) { - var token; - token = _arg.token; - message = "unexpected " + (token === 1 ? 'end of input' : token); - return helpers.throwSyntaxError(message, parser.lexer.yylloc); - }; - - formatSourcePosition = function(frame, getSourceMapping) { - var as, column, fileLocation, fileName, functionName, isConstructor, isMethodCall, line, methodName, source, tp, typeName; - fileName = void 0; - fileLocation = ''; - if (frame.isNative()) { - fileLocation = "native"; - } else { - if (frame.isEval()) { - fileName = frame.getScriptNameOrSourceURL(); - if (!fileName) { - fileLocation = "" + (frame.getEvalOrigin()) + ", "; - } - } else { - fileName = frame.getFileName(); - } - fileName || (fileName = ""); - line = frame.getLineNumber(); - column = frame.getColumnNumber(); - source = getSourceMapping(fileName, line, column); - fileLocation = source ? "" + fileName + ":" + source[0] + ":" + source[1] : "" + fileName + ":" + line + ":" + column; - } - functionName = frame.getFunctionName(); - isConstructor = frame.isConstructor(); - isMethodCall = !(frame.isToplevel() || isConstructor); - if (isMethodCall) { - methodName = frame.getMethodName(); - typeName = frame.getTypeName(); - if (functionName) { - tp = as = ''; - if (typeName && functionName.indexOf(typeName)) { - tp = "" + typeName + "."; - } - if (methodName && functionName.indexOf("." + methodName) !== functionName.length - methodName.length - 1) { - as = " [as " + methodName + "]"; - } - return "" + tp + functionName + as + " (" + fileLocation + ")"; - } else { - return "" + typeName + "." + (methodName || '') + " (" + fileLocation + ")"; - } - } else if (isConstructor) { - return "new " + (functionName || '') + " (" + fileLocation + ")"; - } else if (functionName) { - return "" + functionName + " (" + fileLocation + ")"; - } else { - return fileLocation; - } - }; - - sourceMaps = {}; - - getSourceMap = function(filename) { - var answer, _ref; - if (sourceMaps[filename]) { - return sourceMaps[filename]; - } - if (_ref = path != null ? path.extname(filename) : void 0, __indexOf.call(fileExtensions, _ref) < 0) { - return; - } - answer = compileFile(filename, true); - return sourceMaps[filename] = answer.sourceMap; - }; - - Error.prepareStackTrace = function(err, stack) { - var frame, frames, getSourceMapping, _ref; - getSourceMapping = function(filename, line, column) { - var answer, sourceMap; - sourceMap = getSourceMap(filename); - if (sourceMap) { - answer = sourceMap.sourceLocation([line - 1, column - 1]); - } - if (answer) { - return [answer[0] + 1, answer[1] + 1]; - } else { - return null; - } - }; - frames = (function() { - var _j, _len1, _results; - _results = []; - for (_j = 0, _len1 = stack.length; _j < _len1; _j++) { - frame = stack[_j]; - if (frame.getFunction() === exports.run) { - break; - } - _results.push(" at " + (formatSourcePosition(frame, getSourceMapping))); - } - return _results; - })(); - return "" + err.name + ": " + ((_ref = err.message) != null ? _ref : '') + "\n" + (frames.join('\n')) + "\n"; - }; - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/command.js b/node_modules/iced-coffee-script/lib/coffee-script/command.js deleted file mode 100644 index ccb2f89..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/command.js +++ /dev/null @@ -1,546 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, exists, forkNode, fs, handleIcedOptions, helpers, hidden, iced, joinTimeout, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, runtime_modes_str, sourceCode, sources, spawn, timeLog, unwatchDir, usage, useWinPathSep, version, wait, watch, watchDir, watchers, writeJs, _ref, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - - - fs = require('fs'); - - path = require('path'); - - helpers = require('./helpers'); - - optparse = require('./optparse'); - - CoffeeScript = require('./coffee-script'); - - _ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec; - - EventEmitter = require('events').EventEmitter; - - iced = require('./iced'); - - runtime_modes_str = "{" + (iced["const"].runtime_modes.join(", ")) + "}"; - - exists = fs.exists || path.exists; - - useWinPathSep = path.sep === '\\'; - - helpers.extend(CoffeeScript, new EventEmitter); - - printLine = function(line) { - return process.stdout.write(line + '\n'); - }; - - printWarn = function(line) { - return process.stderr.write(line + '\n'); - }; - - hidden = function(file) { - return /^\.|~$/.test(file); - }; - - BANNER = 'Usage: iced [options] path/to/script.iced -- [args]\n\nIf called without options, `iced` will run your script.'; - - SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-m', '--map', 'generate source map and save as .map files'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-l', '--literate', 'treat stdio as literate style coffee-script'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands'], ['-I', '--runtime [WHICH]', "how to include the iced runtime, one of " + runtime_modes_str + "; default is 'node'"], ['-F', '--runforce', 'output an Iced runtime even if not needed']]; - - opts = {}; - - sources = []; - - sourceCode = []; - - notSources = {}; - - watchers = {}; - - optionParser = null; - - exports.run = function() { - var literals, source, _i, _len, _results; - parseOptions(); - if (opts.nodejs) { - return forkNode(); - } - if (opts.help) { - return usage(); - } - if (opts.version) { - return version(); - } - if (opts.interactive) { - return require('./repl').start(); - } - if (opts.watch && !fs.watch) { - return printWarn("The --watch feature depends on Node v0.6.0+. You are running " + process.version + "."); - } - if (opts.stdio) { - return compileStdio(); - } - if (opts["eval"]) { - return compileScript(null, sources[0]); - } - if (!sources.length) { - return require('./repl').start(); - } - literals = opts.run ? sources.splice(1) : []; - process.argv = process.argv.slice(0, 2).concat(literals); - process.argv[0] = 'coffee'; - _results = []; - for (_i = 0, _len = sources.length; _i < _len; _i++) { - source = sources[_i]; - _results.push(compilePath(source, true, path.normalize(source))); - } - return _results; - }; - - compilePath = function(source, topLevel, base) { - return fs.stat(source, function(err, stats) { - if (err && err.code !== 'ENOENT') { - throw err; - } - if ((err != null ? err.code : void 0) === 'ENOENT') { - console.error("File not found: " + source); - process.exit(1); - } - if (stats.isDirectory() && path.dirname(source) !== 'node_modules') { - if (opts.watch) { - watchDir(source, base); - } - return fs.readdir(source, function(err, files) { - var file, index, _ref1, _ref2; - if (err && err.code !== 'ENOENT') { - throw err; - } - if ((err != null ? err.code : void 0) === 'ENOENT') { - return; - } - index = sources.indexOf(source); - files = files.filter(function(file) { - return !hidden(file); - }); - [].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = files.length; _i < _len; _i++) { - file = files[_i]; - _results.push(path.join(source, file)); - } - return _results; - })())), _ref1; - [].splice.apply(sourceCode, [index, index - index + 1].concat(_ref2 = files.map(function() { - return null; - }))), _ref2; - return files.forEach(function(file) { - return compilePath(path.join(source, file), false, base); - }); - }); - } else if (topLevel || helpers.isCoffee(source)) { - if (opts.watch) { - watch(source, base); - } - return fs.readFile(source, function(err, code) { - if (err && err.code !== 'ENOENT') { - throw err; - } - if ((err != null ? err.code : void 0) === 'ENOENT') { - return; - } - return compileScript(source, code.toString(), base); - }); - } else { - notSources[source] = true; - return removeSource(source, base); - } - }); - }; - - compileScript = function(file, input, base) { - var compiled, err, message, o, options, t, task, useColors; - if (base == null) { - base = null; - } - o = opts; - options = compileOptions(file, base); - try { - t = task = { - file: file, - input: input, - options: options - }; - CoffeeScript.emit('compile', task); - if (o.tokens) { - return printTokens(CoffeeScript.tokens(t.input, t.options)); - } else if (o.nodes) { - return printLine(CoffeeScript.nodes(t.input, t.options).toString().trim()); - } else if (o.run) { - return CoffeeScript.run(t.input, t.options); - } else if (o.join && t.file !== o.join) { - if (helpers.isLiterate(file)) { - t.input = helpers.invertLiterate(t.input); - } - sourceCode[sources.indexOf(t.file)] = t.input; - return compileJoin(); - } else { - compiled = CoffeeScript.compile(t.input, t.options); - t.output = compiled; - if (o.map) { - t.output = compiled.js; - t.sourceMap = compiled.v3SourceMap; - } - CoffeeScript.emit('success', task); - if (o.print) { - return printLine(t.output.trim()); - } else if (o.compile || o.map) { - return writeJs(base, t.file, t.output, options.jsPath, t.sourceMap); - } - } - } catch (_error) { - err = _error; - CoffeeScript.emit('failure', err, task); - if (CoffeeScript.listeners('failure').length) { - return; - } - useColors = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS; - message = helpers.prettyErrorMessage(err, file || '[stdin]', input, useColors); - if (o.watch) { - return printLine(message + '\x07'); - } else { - printWarn(message); - return process.exit(1); - } - } - }; - - compileStdio = function() { - var code, stdin; - code = ''; - stdin = process.openStdin(); - stdin.on('data', function(buffer) { - if (buffer) { - return code += buffer.toString(); - } - }); - return stdin.on('end', function() { - return compileScript(null, code); - }); - }; - - joinTimeout = null; - - compileJoin = function() { - if (!opts.join) { - return; - } - if (!sourceCode.some(function(code) { - return code === null; - })) { - clearTimeout(joinTimeout); - return joinTimeout = wait(100, function() { - return compileScript(opts.join, sourceCode.join('\n'), opts.join); - }); - } - }; - - watch = function(source, base) { - var compile, compileTimeout, e, prevStats, rewatch, watchErr, watcher; - prevStats = null; - compileTimeout = null; - watchErr = function(e) { - if (e.code === 'ENOENT') { - if (sources.indexOf(source) === -1) { - return; - } - try { - rewatch(); - return compile(); - } catch (_error) { - e = _error; - removeSource(source, base, true); - return compileJoin(); - } - } else { - throw e; - } - }; - compile = function() { - clearTimeout(compileTimeout); - return compileTimeout = wait(25, function() { - return fs.stat(source, function(err, stats) { - if (err) { - return watchErr(err); - } - if (prevStats && stats.size === prevStats.size && stats.mtime.getTime() === prevStats.mtime.getTime()) { - return rewatch(); - } - prevStats = stats; - return fs.readFile(source, function(err, code) { - if (err) { - return watchErr(err); - } - compileScript(source, code.toString(), base); - return rewatch(); - }); - }); - }); - }; - try { - watcher = fs.watch(source, compile); - } catch (_error) { - e = _error; - watchErr(e); - } - return rewatch = function() { - if (watcher != null) { - watcher.close(); - } - return watcher = fs.watch(source, compile); - }; - }; - - watchDir = function(source, base) { - var e, readdirTimeout, watcher; - readdirTimeout = null; - try { - return watcher = fs.watch(source, function() { - clearTimeout(readdirTimeout); - return readdirTimeout = wait(25, function() { - return fs.readdir(source, function(err, files) { - var file, _i, _len, _results; - if (err) { - if (err.code !== 'ENOENT') { - throw err; - } - watcher.close(); - return unwatchDir(source, base); - } - _results = []; - for (_i = 0, _len = files.length; _i < _len; _i++) { - file = files[_i]; - if (!(!hidden(file) && !notSources[file])) { - continue; - } - file = path.join(source, file); - if (sources.some(function(s) { - return s.indexOf(file) >= 0; - })) { - continue; - } - sources.push(file); - sourceCode.push(null); - _results.push(compilePath(file, false, base)); - } - return _results; - }); - }); - }); - } catch (_error) { - e = _error; - if (e.code !== 'ENOENT') { - throw e; - } - } - }; - - unwatchDir = function(source, base) { - var file, prevSources, toRemove, _i, _len; - prevSources = sources.slice(0); - toRemove = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = sources.length; _i < _len; _i++) { - file = sources[_i]; - if (file.indexOf(source) >= 0) { - _results.push(file); - } - } - return _results; - })(); - for (_i = 0, _len = toRemove.length; _i < _len; _i++) { - file = toRemove[_i]; - removeSource(file, base, true); - } - if (!sources.some(function(s, i) { - return prevSources[i] !== s; - })) { - return; - } - return compileJoin(); - }; - - removeSource = function(source, base, removeJs) { - var index, jsPath; - index = sources.indexOf(source); - sources.splice(index, 1); - sourceCode.splice(index, 1); - if (removeJs && !opts.join) { - jsPath = outputPath(source, base); - return exists(jsPath, function(itExists) { - if (itExists) { - return fs.unlink(jsPath, function(err) { - if (err && err.code !== 'ENOENT') { - throw err; - } - return timeLog("removed " + source); - }); - } - }); - } - }; - - outputPath = function(source, base, extension) { - var baseDir, basename, dir, srcDir; - if (extension == null) { - extension = ".js"; - } - basename = helpers.baseFileName(source, true, useWinPathSep); - srcDir = path.dirname(source); - baseDir = base === '.' || base === './' ? srcDir : srcDir.substring(base.length); - dir = opts.output ? path.join(opts.output, baseDir) : srcDir; - return path.join(dir, basename + extension); - }; - - writeJs = function(base, sourcePath, js, jsPath, generatedSourceMap) { - var compile, jsDir, sourceMapPath; - if (generatedSourceMap == null) { - generatedSourceMap = null; - } - sourceMapPath = outputPath(sourcePath, base, ".map"); - jsDir = path.dirname(jsPath); - compile = function() { - if (opts.compile) { - if (js.length <= 0) { - js = ' '; - } - if (generatedSourceMap) { - js = "" + js + "\n//# sourceMappingURL=" + (helpers.baseFileName(sourceMapPath, false, useWinPathSep)) + "\n"; - } - fs.writeFile(jsPath, js, function(err) { - if (err) { - return printLine(err.message); - } else if (opts.compile && opts.watch) { - return timeLog("compiled " + sourcePath); - } - }); - } - if (generatedSourceMap) { - return fs.writeFile(sourceMapPath, generatedSourceMap, function(err) { - if (err) { - return printLine("Could not write source map: " + err.message); - } - }); - } - }; - return exists(jsDir, function(itExists) { - if (itExists) { - return compile(); - } else { - return exec("mkdir -p " + jsDir, compile); - } - }); - }; - - wait = function(milliseconds, func) { - return setTimeout(func, milliseconds); - }; - - timeLog = function(message) { - return console.log("" + ((new Date).toLocaleTimeString()) + " - " + message); - }; - - printTokens = function(tokens) { - var strings, tag, token, value; - strings = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = tokens.length; _i < _len; _i++) { - token = tokens[_i]; - tag = token[0]; - value = token[1].toString().replace(/\n/, '\\n'); - _results.push("[" + tag + " " + value + "]"); - } - return _results; - })(); - return printLine(strings.join(' ')); - }; - - handleIcedOptions = function(o) { - var v, val; - if (!o.runtime && ((v = process.env.ICED_RUNTIME) != null)) { - o.runtime = v; - } - if (((val = o.runtime) != null) && __indexOf.call(iced["const"].runtime_modes, val) < 0) { - throw new Error("Option -I/--runtime has to be one of " + runtime_modes_str + ", got '" + val + "'"); - } - }; - - parseOptions = function() { - var i, o, source, _i, _len; - optionParser = new optparse.OptionParser(SWITCHES, BANNER); - o = opts = optionParser.parse(process.argv.slice(2)); - handleIcedOptions(o); - o.compile || (o.compile = !!o.output); - o.run = !(o.compile || o.print || o.map); - o.print = !!(o.print || (o["eval"] || o.stdio && o.compile)); - sources = o["arguments"]; - for (i = _i = 0, _len = sources.length; _i < _len; i = ++_i) { - source = sources[i]; - sourceCode[i] = null; - } - }; - - compileOptions = function(filename, base) { - var answer, cwd, jsDir, jsPath; - answer = { - filename: filename, - literate: opts.literate || helpers.isLiterate(filename), - bare: opts.bare, - header: opts.compile, - sourceMap: opts.map, - runtime: opts.runtime, - runforce: opts.runforce - }; - if (filename) { - if (base) { - cwd = process.cwd(); - jsPath = outputPath(filename, base); - jsDir = path.dirname(jsPath); - answer = helpers.merge(answer, { - jsPath: jsPath, - sourceRoot: path.relative(jsDir, cwd), - sourceFiles: [path.relative(cwd, filename)], - generatedFile: helpers.baseFileName(jsPath, false, useWinPathSep) - }); - } else { - answer = helpers.merge(answer, { - sourceRoot: "", - sourceFiles: [helpers.baseFileName(filename, false, useWinPathSep)], - generatedFile: helpers.baseFileName(filename, true, useWinPathSep) + ".js" - }); - } - } - return answer; - }; - - forkNode = function() { - var args, nodeArgs; - nodeArgs = opts.nodejs.split(/\s+/); - args = process.argv.slice(1); - args.splice(args.indexOf('--nodejs'), 2); - return spawn(process.execPath, nodeArgs.concat(args), { - cwd: process.cwd(), - env: process.env, - customFds: [0, 1, 2] - }); - }; - - usage = function() { - return printLine((new optparse.OptionParser(SWITCHES, BANNER)).help()); - }; - - version = function() { - return printLine("IcedCoffeeScript version " + CoffeeScript.VERSION); - }; - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/grammar.js b/node_modules/iced-coffee-script/lib/coffee-script/grammar.js deleted file mode 100644 index fd297d4..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/grammar.js +++ /dev/null @@ -1,641 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; - - - - Parser = require('jison').Parser; - - unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/; - - o = function(patternString, action, options) { - var addLocationDataFn, match, patternCount; - patternString = patternString.replace(/\s{2,}/g, ' '); - patternCount = patternString.split(' ').length; - if (!action) { - return [patternString, '$$ = $1;', options]; - } - action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())"; - action = action.replace(/\bnew /g, '$&yy.'); - action = action.replace(/\b(?:Block\.wrap|extend)\b/g, 'yy.$&'); - addLocationDataFn = function(first, last) { - if (!last) { - return "yy.addLocationDataFn(@" + first + ")"; - } else { - return "yy.addLocationDataFn(@" + first + ", @" + last + ")"; - } - }; - action = action.replace(/LOC\(([0-9]*)\)/g, addLocationDataFn('$1')); - action = action.replace(/LOC\(([0-9]*),\s*([0-9]*)\)/g, addLocationDataFn('$1', '$2')); - return [patternString, "$$ = " + (addLocationDataFn(1, patternCount)) + "(" + action + ");", options]; - }; - - grammar = { - Root: [ - o('', function() { - return new Block; - }), o('Body') - ], - Body: [ - o('Line', function() { - return Block.wrap([$1]); - }), o('Body TERMINATOR Line', function() { - return $1.push($3); - }), o('Body TERMINATOR') - ], - Line: [o('Expression'), o('Statement')], - Statement: [ - o('Return'), o('Comment'), o('STATEMENT', function() { - return new Literal($1); - }), o('Await') - ], - Await: [ - o('AWAIT Block', function() { - return new Await($2); - }), o('AWAIT Expression', function() { - return new Await(Block.wrap([$2])); - }) - ], - Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw'), o('Defer')], - Block: [ - o('INDENT OUTDENT', function() { - return new Block; - }), o('INDENT Body OUTDENT', function() { - return $2; - }) - ], - Identifier: [ - o('IDENTIFIER', function() { - return new Literal($1); - }) - ], - AlphaNumeric: [ - o('NUMBER', function() { - return new Literal($1); - }), o('STRING', function() { - return new Literal($1); - }) - ], - Literal: [ - o('AlphaNumeric'), o('JS', function() { - return new Literal($1); - }), o('REGEX', function() { - return new Literal($1); - }), o('DEBUGGER', function() { - return new Literal($1); - }), o('UNDEFINED', function() { - return new Undefined; - }), o('NULL', function() { - return new Null; - }), o('BOOL', function() { - return new Bool($1); - }) - ], - Assign: [ - o('Assignable = Expression', function() { - return new Assign($1, $3); - }), o('Assignable = TERMINATOR Expression', function() { - return new Assign($1, $4); - }), o('Assignable = INDENT Expression OUTDENT', function() { - return new Assign($1, $4); - }) - ], - AssignObj: [ - o('ObjAssignable', function() { - return new Value($1); - }), o('ObjAssignable : Expression', function() { - return new Assign(LOC(1)(new Value($1)), $3, 'object'); - }), o('ObjAssignable :\ - INDENT Expression OUTDENT', function() { - return new Assign(LOC(1)(new Value($1)), $4, 'object'); - }), o('Comment') - ], - ObjAssignable: [o('Identifier'), o('AlphaNumeric'), o('ThisProperty')], - Return: [ - o('RETURN Expression', function() { - return new Return($2); - }), o('RETURN', function() { - return new Return; - }) - ], - Comment: [ - o('HERECOMMENT', function() { - return new Comment($1); - }) - ], - Code: [ - o('PARAM_START ParamList PARAM_END FuncGlyph Block', function() { - return new Code($2, $5, $4); - }), o('FuncGlyph Block', function() { - return new Code([], $2, $1); - }) - ], - FuncGlyph: [ - o('->', function() { - return 'func'; - }), o('=>', function() { - return 'boundfunc'; - }) - ], - OptComma: [o(''), o(',')], - ParamList: [ - o('', function() { - return []; - }), o('Param', function() { - return [$1]; - }), o('ParamList , Param', function() { - return $1.concat($3); - }), o('ParamList OptComma TERMINATOR Param', function() { - return $1.concat($4); - }), o('ParamList OptComma INDENT ParamList OptComma OUTDENT', function() { - return $1.concat($4); - }) - ], - Param: [ - o('ParamVar', function() { - return new Param($1); - }), o('ParamVar ...', function() { - return new Param($1, null, true); - }), o('ParamVar = Expression', function() { - return new Param($1, $3); - }) - ], - ParamVar: [o('Identifier'), o('ThisProperty'), o('Array'), o('Object')], - Splat: [ - o('Expression ...', function() { - return new Splat($1); - }) - ], - SimpleAssignable: [ - o('Identifier', function() { - return new Value($1); - }), o('Value Accessor', function() { - return $1.add($2); - }), o('Invocation Accessor', function() { - return new Value($1, [].concat($2)); - }), o('ThisProperty') - ], - Assignable: [ - o('SimpleAssignable'), o('Array', function() { - return new Value($1); - }), o('Object', function() { - return new Value($1); - }) - ], - Value: [ - o('Assignable'), o('Literal', function() { - return new Value($1); - }), o('Parenthetical', function() { - return new Value($1); - }), o('Range', function() { - return new Value($1); - }), o('This') - ], - Accessor: [ - o('. Identifier', function() { - return new Access($2); - }), o('. Defer', function() { - return new Access($2.setCustom()); - }), o('?. Identifier', function() { - return new Access($2, 'soak'); - }), o(':: Identifier', function() { - return [LOC(1)(new Access(new Literal('prototype'))), LOC(2)(new Access($2))]; - }), o('?:: Identifier', function() { - return [LOC(1)(new Access(new Literal('prototype'), 'soak')), LOC(2)(new Access($2))]; - }), o('::', function() { - return new Access(new Literal('prototype')); - }), o('Index') - ], - Index: [ - o('INDEX_START IndexValue INDEX_END', function() { - return $2; - }), o('INDEX_SOAK Index', function() { - return extend($2, { - soak: true - }); - }) - ], - IndexValue: [ - o('Expression', function() { - return new Index($1); - }), o('Slice', function() { - return new Slice($1); - }) - ], - Object: [ - o('{ AssignList OptComma }', function() { - return new Obj($2, $1.generated); - }) - ], - AssignList: [ - o('', function() { - return []; - }), o('AssignObj', function() { - return [$1]; - }), o('AssignList , AssignObj', function() { - return $1.concat($3); - }), o('AssignList OptComma TERMINATOR AssignObj', function() { - return $1.concat($4); - }), o('AssignList OptComma INDENT AssignList OptComma OUTDENT', function() { - return $1.concat($4); - }) - ], - Class: [ - o('CLASS', function() { - return new Class; - }), o('CLASS Block', function() { - return new Class(null, null, $2); - }), o('CLASS EXTENDS Expression', function() { - return new Class(null, $3); - }), o('CLASS EXTENDS Expression Block', function() { - return new Class(null, $3, $4); - }), o('CLASS SimpleAssignable', function() { - return new Class($2); - }), o('CLASS SimpleAssignable Block', function() { - return new Class($2, null, $3); - }), o('CLASS SimpleAssignable EXTENDS Expression', function() { - return new Class($2, $4); - }), o('CLASS SimpleAssignable EXTENDS Expression Block', function() { - return new Class($2, $4, $5); - }) - ], - Invocation: [ - o('Value OptFuncExist Arguments', function() { - return new Call($1, $3, $2); - }), o('Invocation OptFuncExist Arguments', function() { - return new Call($1, $3, $2); - }), o('SUPER', function() { - return new Call('super', [new Splat(new Literal('arguments'))]); - }), o('SUPER Arguments', function() { - return new Call('super', $2); - }) - ], - Defer: [ - o('DEFER Arguments', function() { - return new Defer($2, yylineno); - }) - ], - OptFuncExist: [ - o('', function() { - return false; - }), o('FUNC_EXIST', function() { - return true; - }) - ], - Arguments: [ - o('CALL_START CALL_END', function() { - return []; - }), o('CALL_START ArgList OptComma CALL_END', function() { - return $2; - }) - ], - This: [ - o('THIS', function() { - return new Value(new Literal('this')); - }), o('@', function() { - return new Value(new Literal('this')); - }) - ], - ThisProperty: [ - o('@ Identifier', function() { - return new Value(LOC(1)(new Literal('this')), [LOC(2)(new Access($2))], 'this'); - }) - ], - Array: [ - o('[ ]', function() { - return new Arr([]); - }), o('[ ArgList OptComma ]', function() { - return new Arr($2); - }) - ], - RangeDots: [ - o('..', function() { - return 'inclusive'; - }), o('...', function() { - return 'exclusive'; - }) - ], - Range: [ - o('[ Expression RangeDots Expression ]', function() { - return new Range($2, $4, $3); - }) - ], - Slice: [ - o('Expression RangeDots Expression', function() { - return new Range($1, $3, $2); - }), o('Expression RangeDots', function() { - return new Range($1, null, $2); - }), o('RangeDots Expression', function() { - return new Range(null, $2, $1); - }), o('RangeDots', function() { - return new Range(null, null, $1); - }) - ], - ArgList: [ - o('Arg', function() { - return [$1]; - }), o('ArgList , Arg', function() { - return $1.concat($3); - }), o('ArgList OptComma TERMINATOR Arg', function() { - return $1.concat($4); - }), o('INDENT ArgList OptComma OUTDENT', function() { - return $2; - }), o('ArgList OptComma INDENT ArgList OptComma OUTDENT', function() { - return $1.concat($4); - }) - ], - Arg: [o('Expression'), o('Splat')], - SimpleArgs: [ - o('Expression'), o('SimpleArgs , Expression', function() { - return [].concat($1, $3); - }) - ], - Try: [ - o('TRY Block', function() { - return new Try($2); - }), o('TRY Block Catch', function() { - return new Try($2, $3[0], $3[1]); - }), o('TRY Block FINALLY Block', function() { - return new Try($2, null, null, $4); - }), o('TRY Block Catch FINALLY Block', function() { - return new Try($2, $3[0], $3[1], $5); - }) - ], - Catch: [ - o('CATCH Identifier Block', function() { - return [$2, $3]; - }), o('CATCH Object Block', function() { - return [LOC(2)(new Value($2)), $3]; - }), o('CATCH Block', function() { - return [null, $2]; - }) - ], - Throw: [ - o('THROW Expression', function() { - return new Throw($2); - }) - ], - Parenthetical: [ - o('( Body )', function() { - return new Parens($2); - }), o('( INDENT Body OUTDENT )', function() { - return new Parens($3); - }) - ], - WhileSource: [ - o('WHILE Expression', function() { - return new While($2); - }), o('WHILE Expression WHEN Expression', function() { - return new While($2, { - guard: $4 - }); - }), o('UNTIL Expression', function() { - return new While($2, { - invert: true - }); - }), o('UNTIL Expression WHEN Expression', function() { - return new While($2, { - invert: true, - guard: $4 - }); - }) - ], - While: [ - o('WhileSource Block', function() { - return $1.addBody($2); - }), o('Statement WhileSource', function() { - return $2.addBody(LOC(1)(Block.wrap([$1]))); - }), o('Expression WhileSource', function() { - return $2.addBody(LOC(1)(Block.wrap([$1]))); - }), o('Loop', function() { - return $1; - }) - ], - Loop: [ - o('LOOP Block', function() { - return new While(LOC(1)(new Literal('true'))).addBody($2); - }), o('LOOP Expression', function() { - return new While(LOC(1)(new Literal('true'))).addBody(LOC(2)(Block.wrap([$2]))); - }) - ], - For: [ - o('Statement ForBody', function() { - return new For($1, $2); - }), o('Expression ForBody', function() { - return new For($1, $2); - }), o('ForBody Block', function() { - return new For($2, $1); - }) - ], - ForBody: [ - o('FOR Range', function() { - return { - source: LOC(2)(new Value($2)) - }; - }), o('ForStart ForSource', function() { - $2.own = $1.own; - $2.name = $1[0]; - $2.index = $1[1]; - return $2; - }) - ], - ForStart: [ - o('FOR ForVariables', function() { - return $2; - }), o('FOR OWN ForVariables', function() { - $3.own = true; - return $3; - }) - ], - ForValue: [ - o('Identifier'), o('ThisProperty'), o('Array', function() { - return new Value($1); - }), o('Object', function() { - return new Value($1); - }) - ], - ForVariables: [ - o('ForValue', function() { - return [$1]; - }), o('ForValue , ForValue', function() { - return [$1, $3]; - }) - ], - ForSource: [ - o('FORIN Expression', function() { - return { - source: $2 - }; - }), o('FOROF Expression', function() { - return { - source: $2, - object: true - }; - }), o('FORIN Expression WHEN Expression', function() { - return { - source: $2, - guard: $4 - }; - }), o('FOROF Expression WHEN Expression', function() { - return { - source: $2, - guard: $4, - object: true - }; - }), o('FORIN Expression BY Expression', function() { - return { - source: $2, - step: $4 - }; - }), o('FORIN Expression WHEN Expression BY Expression', function() { - return { - source: $2, - guard: $4, - step: $6 - }; - }), o('FORIN Expression BY Expression WHEN Expression', function() { - return { - source: $2, - step: $4, - guard: $6 - }; - }) - ], - Switch: [ - o('SWITCH Expression INDENT Whens OUTDENT', function() { - return new Switch($2, $4); - }), o('SWITCH Expression INDENT Whens ELSE Block OUTDENT', function() { - return new Switch($2, $4, $6); - }), o('SWITCH INDENT Whens OUTDENT', function() { - return new Switch(null, $3); - }), o('SWITCH INDENT Whens ELSE Block OUTDENT', function() { - return new Switch(null, $3, $5); - }) - ], - Whens: [ - o('When'), o('Whens When', function() { - return $1.concat($2); - }) - ], - When: [ - o('LEADING_WHEN SimpleArgs Block', function() { - return [[$2, $3]]; - }), o('LEADING_WHEN SimpleArgs Block TERMINATOR', function() { - return [[$2, $3]]; - }) - ], - IfBlock: [ - o('IF Expression Block', function() { - return new If($2, $3, { - type: $1 - }); - }), o('IfBlock ELSE IF Expression Block', function() { - return $1.addElse(LOC(3, 5)(new If($4, $5, { - type: $3 - }))); - }) - ], - If: [ - o('IfBlock'), o('IfBlock ELSE Block', function() { - return $1.addElse($3); - }), o('Statement POST_IF Expression', function() { - return new If($3, LOC(1)(Block.wrap([$1])), { - type: $2, - statement: true - }); - }), o('Expression POST_IF Expression', function() { - return new If($3, LOC(1)(Block.wrap([$1])), { - type: $2, - statement: true - }); - }) - ], - Operation: [ - o('UNARY Expression', function() { - return new Op($1, $2); - }), o('- Expression', (function() { - return new Op('-', $2); - }), { - prec: 'UNARY' - }), o('+ Expression', (function() { - return new Op('+', $2); - }), { - prec: 'UNARY' - }), o('-- SimpleAssignable', function() { - return new Op('--', $2); - }), o('++ SimpleAssignable', function() { - return new Op('++', $2); - }), o('SimpleAssignable --', function() { - return new Op('--', $1, null, true); - }), o('SimpleAssignable ++', function() { - return new Op('++', $1, null, true); - }), o('Expression ?', function() { - return new Existence($1); - }), o('Expression + Expression', function() { - return new Op('+', $1, $3); - }), o('Expression - Expression', function() { - return new Op('-', $1, $3); - }), o('Expression MATH Expression', function() { - return new Op($2, $1, $3); - }), o('Expression SHIFT Expression', function() { - return new Op($2, $1, $3); - }), o('Expression COMPARE Expression', function() { - return new Op($2, $1, $3); - }), o('Expression LOGIC Expression', function() { - return new Op($2, $1, $3); - }), o('Expression RELATION Expression', function() { - if ($2.charAt(0) === '!') { - return new Op($2.slice(1), $1, $3).invert(); - } else { - return new Op($2, $1, $3); - } - }), o('SimpleAssignable COMPOUND_ASSIGN\ - Expression', function() { - return new Assign($1, $3, $2); - }), o('SimpleAssignable COMPOUND_ASSIGN\ - INDENT Expression OUTDENT', function() { - return new Assign($1, $4, $2); - }), o('SimpleAssignable COMPOUND_ASSIGN TERMINATOR\ - Expression', function() { - return new Assign($1, $4, $2); - }), o('SimpleAssignable EXTENDS Expression', function() { - return new Extends($1, $3); - }) - ] - }; - - operators = [['left', '.', '?.', '::', '?::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS', 'AWAIT'], ['right', 'POST_IF']]; - - tokens = []; - - for (name in grammar) { - alternatives = grammar[name]; - grammar[name] = (function() { - var _i, _j, _len, _len1, _ref, _results; - _results = []; - for (_i = 0, _len = alternatives.length; _i < _len; _i++) { - alt = alternatives[_i]; - _ref = alt[0].split(' '); - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - token = _ref[_j]; - if (!grammar[token]) { - tokens.push(token); - } - } - if (name === 'Root') { - alt[1] = "return " + alt[1]; - } - _results.push(alt); - } - return _results; - })(); - } - - exports.parser = new Parser({ - tokens: tokens.join(' '), - bnf: grammar, - operators: operators.reverse(), - startSymbol: 'Root' - }); - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/helpers.js b/node_modules/iced-coffee-script/lib/coffee-script/helpers.js deleted file mode 100644 index 209779f..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/helpers.js +++ /dev/null @@ -1,227 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var buildLocationData, extend, flatten, last, repeat, _ref; - - - - exports.starts = function(string, literal, start) { - return literal === string.substr(start, literal.length); - }; - - exports.ends = function(string, literal, back) { - var len; - len = literal.length; - return literal === string.substr(string.length - len - (back || 0), len); - }; - - exports.repeat = repeat = function(str, n) { - var res; - res = ''; - while (n > 0) { - if (n & 1) { - res += str; - } - n >>>= 1; - str += str; - } - return res; - }; - - exports.compact = function(array) { - var item, _i, _len, _results; - _results = []; - for (_i = 0, _len = array.length; _i < _len; _i++) { - item = array[_i]; - if (item) { - _results.push(item); - } - } - return _results; - }; - - exports.count = function(string, substr) { - var num, pos; - num = pos = 0; - if (!substr.length) { - return 1 / 0; - } - while (pos = 1 + string.indexOf(substr, pos)) { - num++; - } - return num; - }; - - exports.merge = function(options, overrides) { - return extend(extend({}, options), overrides); - }; - - extend = exports.extend = function(object, properties) { - var key, val; - for (key in properties) { - val = properties[key]; - object[key] = val; - } - return object; - }; - - exports.flatten = flatten = function(array) { - var element, flattened, _i, _len; - flattened = []; - for (_i = 0, _len = array.length; _i < _len; _i++) { - element = array[_i]; - if (element instanceof Array) { - flattened = flattened.concat(flatten(element)); - } else { - flattened.push(element); - } - } - return flattened; - }; - - exports.del = function(obj, key) { - var val; - val = obj[key]; - delete obj[key]; - return val; - }; - - exports.last = last = function(array, back) { - return array[array.length - (back || 0) - 1]; - }; - - exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) { - var e, _i, _len; - for (_i = 0, _len = this.length; _i < _len; _i++) { - e = this[_i]; - if (fn(e)) { - return true; - } - } - return false; - }; - - exports.invertLiterate = function(code) { - var line, lines, maybe_code; - maybe_code = true; - lines = (function() { - var _i, _len, _ref1, _results; - _ref1 = code.split('\n'); - _results = []; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - line = _ref1[_i]; - if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) { - _results.push(line); - } else if (maybe_code = /^\s*$/.test(line)) { - _results.push(line); - } else { - _results.push('# ' + line); - } - } - return _results; - })(); - return lines.join('\n'); - }; - - buildLocationData = function(first, last) { - if (!last) { - return first; - } else { - return { - first_line: first.first_line, - first_column: first.first_column, - last_line: last.last_line, - last_column: last.last_column - }; - } - }; - - exports.addLocationDataFn = function(first, last) { - return function(obj) { - if (((typeof obj) === 'object') && (!!obj['updateLocationDataIfMissing'])) { - obj.updateLocationDataIfMissing(buildLocationData(first, last)); - } - return obj; - }; - }; - - exports.locationDataToString = function(obj) { - var locationData; - if (("2" in obj) && ("first_line" in obj[2])) { - locationData = obj[2]; - } else if ("first_line" in obj) { - locationData = obj; - } - if (locationData) { - return ("" + (locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ("" + (locationData.last_line + 1) + ":" + (locationData.last_column + 1)); - } else { - return "No location data"; - } - }; - - exports.baseFileName = function(file, stripExt, useWinPathSep) { - var parts, pathSep; - if (stripExt == null) { - stripExt = false; - } - if (useWinPathSep == null) { - useWinPathSep = false; - } - pathSep = useWinPathSep ? /\\|\// : /\//; - parts = file.split(pathSep); - file = parts[parts.length - 1]; - if (!stripExt) { - return file; - } - parts = file.split('.'); - parts.pop(); - if (parts[parts.length - 1] === 'coffee' && parts.length > 1) { - parts.pop(); - } - return parts.join('.'); - }; - - exports.isCoffee = function(file) { - return /\.((lit)?coffee|coffee\.md|iced)$/.test(file); - }; - - exports.isLiterate = function(file) { - return /\.(litcoffee|coffee\.md)$/.test(file); - }; - - exports.throwSyntaxError = function(message, location) { - var error; - if (location.last_line == null) { - location.last_line = location.first_line; - } - if (location.last_column == null) { - location.last_column = location.first_column; - } - error = new SyntaxError(message); - error.location = location; - throw error; - }; - - exports.prettyErrorMessage = function(error, filename, code, useColors) { - var codeLine, colorize, end, first_column, first_line, last_column, last_line, marker, message, start, _ref1; - if (!error.location) { - return error.stack || ("" + error); - } - filename = error.filename || filename; - code = error.code || code; - _ref1 = error.location, first_line = _ref1.first_line, first_column = _ref1.first_column, last_line = _ref1.last_line, last_column = _ref1.last_column; - codeLine = code.split('\n')[first_line]; - start = first_column; - end = first_line === last_line ? last_column + 1 : codeLine.length; - marker = repeat(' ', start) + repeat('^', end - start); - if (useColors) { - colorize = function(str) { - return "\x1B[1;31m" + str + "\x1B[0m"; - }; - codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end); - marker = colorize(marker); - } - message = "" + filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + error.message + "\n" + codeLine + "\n" + marker; - return message; - }; - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/iced.js b/node_modules/iced-coffee-script/lib/coffee-script/iced.js deleted file mode 100644 index 43031d5..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/iced.js +++ /dev/null @@ -1,256 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var generator, - __slice = [].slice; - - - - exports.generator = generator = function(intern, compiletime, runtime) { - var C, Deferrals, Rendezvous, exceptionHandler, findDeferral, stackWalk; - compiletime.transform = function(x, options) { - return x.icedTransform(options); - }; - compiletime["const"] = C = { - k: "__iced_k", - k_noop: "__iced_k_noop", - param: "__iced_p_", - ns: "iced", - runtime: "runtime", - Deferrals: "Deferrals", - deferrals: "__iced_deferrals", - fulfill: "_fulfill", - b_while: "_break", - t_while: "_while", - c_while: "_continue", - n_while: "_next", - n_arg: "__iced_next_arg", - context: "context", - defer_method: "defer", - slot: "__slot", - assign_fn: "assign_fn", - autocb: "autocb", - retslot: "ret", - trace: "__iced_trace", - passed_deferral: "__iced_passed_deferral", - findDeferral: "findDeferral", - lineno: "lineno", - parent: "parent", - filename: "filename", - funcname: "funcname", - catchExceptions: 'catchExceptions', - runtime_modes: ["node", "inline", "window", "none", "browserify"], - trampoline: "trampoline" - }; - intern.makeDeferReturn = function(obj, defer_args, id, trace_template, multi) { - var k, ret, trace, v; - trace = {}; - for (k in trace_template) { - v = trace_template[k]; - trace[k] = v; - } - trace[C.lineno] = defer_args != null ? defer_args[C.lineno] : void 0; - ret = function() { - var inner_args, o, _ref; - inner_args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; - if (defer_args != null) { - if ((_ref = defer_args.assign_fn) != null) { - _ref.apply(null, inner_args); - } - } - if (obj) { - o = obj; - if (!multi) { - obj = null; - } - return o._fulfill(id, trace); - } else { - return intern._warn("overused deferral at " + (intern._trace_to_string(trace))); - } - }; - ret[C.trace] = trace; - return ret; - }; - intern.__c = 0; - intern.tickCounter = function(mod) { - intern.__c++; - if ((intern.__c % mod) === 0) { - intern.__c = 0; - return true; - } else { - return false; - } - }; - intern.__active_trace = null; - intern._trace_to_string = function(tr) { - var fn; - fn = tr[C.funcname] || ""; - return "" + fn + " (" + tr[C.filename] + ":" + (tr[C.lineno] + 1) + ")"; - }; - intern._warn = function(m) { - return typeof console !== "undefined" && console !== null ? console.log("ICED warning: " + m) : void 0; - }; - runtime.trampoline = function(fn) { - if (!intern.tickCounter(500)) { - return fn(); - } else if (typeof process !== "undefined" && process !== null) { - return process.nextTick(fn); - } else { - return setTimeout(fn); - } - }; - runtime.Deferrals = Deferrals = (function() { - function Deferrals(k, trace) { - this.trace = trace; - this.continuation = k; - this.count = 1; - this.ret = null; - } - - Deferrals.prototype._call = function(trace) { - var c; - if (this.continuation) { - intern.__active_trace = trace; - c = this.continuation; - this.continuation = null; - return c(this.ret); - } else { - return intern._warn("Entered dead await at " + (intern._trace_to_string(trace))); - } - }; - - Deferrals.prototype._fulfill = function(id, trace) { - var _this = this; - if (--this.count > 0) { - - } else { - return runtime.trampoline((function() { - return _this._call(trace); - })); - } - }; - - Deferrals.prototype.defer = function(args) { - var self; - this.count++; - self = this; - return intern.makeDeferReturn(self, args, null, this.trace); - }; - - Deferrals.prototype._defer = function(args) { - return this["defer"](args); - }; - - return Deferrals; - - })(); - runtime.findDeferral = findDeferral = function(args) { - var a, _i, _len; - for (_i = 0, _len = args.length; _i < _len; _i++) { - a = args[_i]; - if (a != null ? a[C.trace] : void 0) { - return a; - } - } - return null; - }; - runtime.Rendezvous = Rendezvous = (function() { - var RvId; - - function Rendezvous() { - this.completed = []; - this.waiters = []; - this.defer_id = 0; - } - - RvId = (function() { - function RvId(rv, id, multi) { - this.rv = rv; - this.id = id; - this.multi = multi; - } - - RvId.prototype.defer = function(defer_args) { - return this.rv._deferWithId(this.id, defer_args, this.multi); - }; - - return RvId; - - })(); - - Rendezvous.prototype.wait = function(cb) { - var x; - if (this.completed.length) { - x = this.completed.shift(); - return cb(x); - } else { - return this.waiters.push(cb); - } - }; - - Rendezvous.prototype.defer = function(defer_args) { - var id; - id = this.defer_id++; - return this.deferWithId(id, defer_args); - }; - - Rendezvous.prototype.id = function(i, multi) { - if (multi == null) { - multi = false; - } - return new RvId(this, i, multi); - }; - - Rendezvous.prototype._fulfill = function(id, trace) { - var cb; - if (this.waiters.length) { - cb = this.waiters.shift(); - return cb(id); - } else { - return this.completed.push(id); - } - }; - - Rendezvous.prototype._deferWithId = function(id, defer_args, multi) { - this.count++; - return intern.makeDeferReturn(this, defer_args, id, {}, multi); - }; - - return Rendezvous; - - })(); - runtime.stackWalk = stackWalk = function(cb) { - var line, ret, tr, _ref; - ret = []; - tr = cb ? cb[C.trace] : intern.__active_trace; - while (tr) { - line = " at " + (intern._trace_to_string(tr)); - ret.push(line); - tr = tr != null ? (_ref = tr[C.parent]) != null ? _ref[C.trace] : void 0 : void 0; - } - return ret; - }; - runtime.exceptionHandler = exceptionHandler = function(err, logger) { - var stack; - if (!logger) { - logger = console.log; - } - logger(err.stack); - stack = stackWalk(); - if (stack.length) { - logger("Iced callback trace:"); - return logger(stack.join("\n")); - } - }; - return runtime.catchExceptions = function(logger) { - return typeof process !== "undefined" && process !== null ? process.on('uncaughtException', function(err) { - exceptionHandler(err, logger); - return process.exit(1); - }) : void 0; - }; - }; - - exports.runtime = {}; - - generator(this, exports, exports.runtime); - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/icedlib.js b/node_modules/iced-coffee-script/lib/coffee-script/icedlib.js deleted file mode 100644 index 1da9cff..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/icedlib.js +++ /dev/null @@ -1,288 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var Pipeliner, iced, iced_internals, __iced_k, __iced_k_noop, _iand, _ior, _timeout, - __slice = [].slice; - - __iced_k = __iced_k_noop = function() {}; - - iced_internals = require('./iced'); - - exports.iced = iced = iced_internals.runtime; - - _timeout = function(cb, t, res, tmp) { - var arr, rv, which, ___iced_passed_deferral, __iced_deferrals, __iced_k, - _this = this; - __iced_k = __iced_k_noop; - ___iced_passed_deferral = iced.findDeferral(arguments); - rv = new iced.Rendezvous; - tmp[0] = rv.id(true).defer({ - assign_fn: (function() { - return function() { - return arr = __slice.call(arguments, 0); - }; - })(), - lineno: 17, - context: __iced_deferrals - }); - setTimeout(rv.id(false).defer({ - lineno: 18, - context: __iced_deferrals - }), t); - (function(__iced_k) { - __iced_deferrals = new iced.Deferrals(__iced_k, { - parent: ___iced_passed_deferral, - filename: "src/icedlib.coffee", - funcname: "_timeout" - }); - rv.wait(__iced_deferrals.defer({ - assign_fn: (function() { - return function() { - return which = arguments[0]; - }; - })(), - lineno: 19 - })); - __iced_deferrals._fulfill(); - })(function() { - if (res) { - res[0] = which; - } - return cb.apply(null, arr); - }); - }; - - exports.timeout = function(cb, t, res) { - var tmp; - tmp = []; - _timeout(cb, t, res, tmp); - return tmp[0]; - }; - - _iand = function(cb, res, tmp) { - var ok, ___iced_passed_deferral, __iced_deferrals, __iced_k, - _this = this; - __iced_k = __iced_k_noop; - ___iced_passed_deferral = iced.findDeferral(arguments); - (function(__iced_k) { - __iced_deferrals = new iced.Deferrals(__iced_k, { - parent: ___iced_passed_deferral, - filename: "src/icedlib.coffee", - funcname: "_iand" - }); - tmp[0] = __iced_deferrals.defer({ - assign_fn: (function() { - return function() { - return ok = arguments[0]; - }; - })(), - lineno: 34 - }); - __iced_deferrals._fulfill(); - })(function() { - if (!ok) { - res[0] = false; - } - return cb(); - }); - }; - - exports.iand = function(cb, res) { - var tmp; - tmp = []; - _iand(cb, res, tmp); - return tmp[0]; - }; - - _ior = function(cb, res, tmp) { - var ok, ___iced_passed_deferral, __iced_deferrals, __iced_k, - _this = this; - __iced_k = __iced_k_noop; - ___iced_passed_deferral = iced.findDeferral(arguments); - (function(__iced_k) { - __iced_deferrals = new iced.Deferrals(__iced_k, { - parent: ___iced_passed_deferral, - filename: "src/icedlib.coffee", - funcname: "_ior" - }); - tmp[0] = __iced_deferrals.defer({ - assign_fn: (function() { - return function() { - return ok = arguments[0]; - }; - })(), - lineno: 51 - }); - __iced_deferrals._fulfill(); - })(function() { - if (ok) { - res[0] = true; - } - return cb(); - }); - }; - - exports.ior = function(cb, res) { - var tmp; - tmp = []; - _ior(cb, res, tmp); - return tmp[0]; - }; - - exports.Pipeliner = Pipeliner = (function() { - function Pipeliner(window, delay) { - this.window = window || 1; - this.delay = delay || 0; - this.queue = []; - this.n_out = 0; - this.cb = null; - this[iced_internals["const"].deferrals] = this; - this["defer"] = this._defer; - } - - Pipeliner.prototype.waitInQueue = function(cb) { - var ___iced_passed_deferral, __iced_deferrals, __iced_k, - _this = this; - __iced_k = __iced_k_noop; - ___iced_passed_deferral = iced.findDeferral(arguments); - (function(__iced_k) { - var _results, _while; - _results = []; - _while = function(__iced_k) { - var _break, _continue, _next; - _break = function() { - return __iced_k(_results); - }; - _continue = function() { - return iced.trampoline(function() { - return _while(__iced_k); - }); - }; - _next = function(__iced_next_arg) { - _results.push(__iced_next_arg); - return _continue(); - }; - if (!(_this.n_out >= _this.window)) { - return _break(); - } else { - (function(__iced_k) { - __iced_deferrals = new iced.Deferrals(__iced_k, { - parent: ___iced_passed_deferral, - filename: "src/icedlib.coffee", - funcname: "Pipeliner.waitInQueue" - }); - _this.cb = __iced_deferrals.defer({ - lineno: 88 - }); - __iced_deferrals._fulfill(); - })(_next); - } - }; - _while(__iced_k); - })(function() { - _this.n_out++; - (function(__iced_k) { - if (_this.delay) { - (function(__iced_k) { - __iced_deferrals = new iced.Deferrals(__iced_k, { - parent: ___iced_passed_deferral, - filename: "src/icedlib.coffee", - funcname: "Pipeliner.waitInQueue" - }); - setTimeout(__iced_deferrals.defer({ - lineno: 96 - }), _this.delay); - __iced_deferrals._fulfill(); - })(__iced_k); - } else { - return __iced_k(); - } - })(function() { - return cb(); - }); - }); - }; - - Pipeliner.prototype.__defer = function(out, deferArgs) { - var tmp, voidCb, ___iced_passed_deferral, __iced_deferrals, __iced_k, - _this = this; - __iced_k = __iced_k_noop; - ___iced_passed_deferral = iced.findDeferral(arguments); - (function(__iced_k) { - __iced_deferrals = new iced.Deferrals(__iced_k, { - parent: ___iced_passed_deferral, - filename: "src/icedlib.coffee", - funcname: "Pipeliner.__defer" - }); - voidCb = __iced_deferrals.defer({ - lineno: 109 - }); - out[0] = function() { - var args, _ref; - args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; - if ((_ref = deferArgs.assign_fn) != null) { - _ref.apply(null, args); - } - return voidCb(); - }; - __iced_deferrals._fulfill(); - })(function() { - _this.n_out--; - if (_this.cb) { - tmp = _this.cb; - _this.cb = null; - return tmp(); - } - }); - }; - - Pipeliner.prototype._defer = function(deferArgs) { - var tmp; - tmp = []; - this.__defer(tmp, deferArgs); - return tmp[0]; - }; - - Pipeliner.prototype.flush = function(autocb) { - var ___iced_passed_deferral, __iced_deferrals, __iced_k, _results, _while, - _this = this; - __iced_k = autocb; - ___iced_passed_deferral = iced.findDeferral(arguments); - _results = []; - _while = function(__iced_k) { - var _break, _continue, _next; - _break = function() { - return __iced_k(_results); - }; - _continue = function() { - return iced.trampoline(function() { - return _while(__iced_k); - }); - }; - _next = function(__iced_next_arg) { - _results.push(__iced_next_arg); - return _continue(); - }; - if (!_this.n_out) { - return _break(); - } else { - (function(__iced_k) { - __iced_deferrals = new iced.Deferrals(__iced_k, { - parent: ___iced_passed_deferral, - filename: "src/icedlib.coffee", - funcname: "Pipeliner.flush" - }); - _this.cb = __iced_deferrals.defer({ - lineno: 136 - }); - __iced_deferrals._fulfill(); - })(_next); - } - }; - _while(__iced_k); - }; - - return Pipeliner; - - })(); - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/index.js b/node_modules/iced-coffee-script/lib/coffee-script/index.js deleted file mode 100644 index f8f766b..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/index.js +++ /dev/null @@ -1,13 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var key, val, _ref; - - - - _ref = require('./coffee-script'); - for (key in _ref) { - val = _ref[key]; - exports[key] = val; - } - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/lexer.js b/node_modules/iced-coffee-script/lib/coffee-script/lexer.js deleted file mode 100644 index 5076904..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/lexer.js +++ /dev/null @@ -1,907 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, invertLiterate, key, last, locationDataToString, repeat, starts, throwSyntaxError, _ref, _ref1, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - - - _ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES; - - _ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last, repeat = _ref1.repeat, invertLiterate = _ref1.invertLiterate, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError; - - exports.Lexer = Lexer = (function() { - function Lexer() {} - - Lexer.prototype.tokenize = function(code, opts) { - var consumed, i, tag, _ref2; - if (opts == null) { - opts = {}; - } - this.literate = opts.literate; - this.indent = 0; - this.baseIndent = 0; - this.indebt = 0; - this.outdebt = 0; - this.indents = []; - this.ends = []; - this.tokens = []; - this.chunkLine = opts.line || 0; - this.chunkColumn = opts.column || 0; - code = this.clean(code); - i = 0; - while (this.chunk = code.slice(i)) { - consumed = this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken(); - _ref2 = this.getLineAndColumnFromChunk(consumed), this.chunkLine = _ref2[0], this.chunkColumn = _ref2[1]; - i += consumed; - } - this.closeIndentation(); - if (tag = this.ends.pop()) { - this.error("missing " + tag); - } - if (opts.rewrite === false) { - return this.tokens; - } - return (new Rewriter).rewrite(this.tokens); - }; - - Lexer.prototype.clean = function(code) { - if (code.charCodeAt(0) === BOM) { - code = code.slice(1); - } - code = code.replace(/\r/g, '').replace(TRAILING_SPACES, ''); - if (WHITESPACE.test(code)) { - code = "\n" + code; - this.chunkLine--; - } - if (this.literate) { - code = invertLiterate(code); - } - return code; - }; - - Lexer.prototype.identifierToken = function() { - var colon, colonOffset, forcedIdentifier, id, idLength, input, match, poppedToken, prev, tag, tagToken, _ref2, _ref3, _ref4; - if (!(match = IDENTIFIER.exec(this.chunk))) { - return 0; - } - input = match[0], id = match[1], colon = match[2]; - idLength = id.length; - poppedToken = void 0; - if (id === 'own' && this.tag() === 'FOR') { - this.token('OWN', id); - return id.length; - } - forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::' || _ref2 === '?::') || !prev.spaced && prev[0] === '@') && id !== 'defer'; - tag = 'IDENTIFIER'; - if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { - tag = id.toUpperCase(); - if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) { - tag = 'LEADING_WHEN'; - } else if (tag === 'FOR') { - this.seenFor = true; - } else if (tag === 'UNLESS') { - tag = 'IF'; - } else if (__indexOf.call(UNARY, tag) >= 0) { - tag = 'UNARY'; - } else if (__indexOf.call(RELATION, tag) >= 0) { - if (tag !== 'INSTANCEOF' && this.seenFor) { - tag = 'FOR' + tag; - this.seenFor = false; - } else { - tag = 'RELATION'; - if (this.value() === '!') { - poppedToken = this.tokens.pop(); - id = '!' + id; - } - } - } - } - if (__indexOf.call(JS_FORBIDDEN, id) >= 0) { - if (forcedIdentifier) { - tag = 'IDENTIFIER'; - id = new String(id); - id.reserved = true; - } else if (__indexOf.call(RESERVED, id) >= 0) { - this.error("reserved word \"" + id + "\""); - } - } - if (!forcedIdentifier) { - if (__indexOf.call(COFFEE_ALIASES, id) >= 0) { - id = COFFEE_ALIAS_MAP[id]; - } - tag = (function() { - switch (id) { - case '!': - return 'UNARY'; - case '==': - case '!=': - return 'COMPARE'; - case '&&': - case '||': - return 'LOGIC'; - case 'true': - case 'false': - return 'BOOL'; - case 'break': - case 'continue': - return 'STATEMENT'; - default: - return tag; - } - })(); - } - tagToken = this.token(tag, id, 0, idLength); - if (poppedToken) { - _ref4 = [poppedToken[2].first_line, poppedToken[2].first_column], tagToken[2].first_line = _ref4[0], tagToken[2].first_column = _ref4[1]; - } - if (colon) { - colonOffset = input.lastIndexOf(':'); - this.token(':', ':', colonOffset, colon.length); - } - return input.length; - }; - - Lexer.prototype.numberToken = function() { - var binaryLiteral, lexedLength, match, number, octalLiteral; - if (!(match = NUMBER.exec(this.chunk))) { - return 0; - } - number = match[0]; - if (/^0[BOX]/.test(number)) { - this.error("radix prefix '" + number + "' must be lowercase"); - } else if (/E/.test(number) && !/^0x/.test(number)) { - this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'"); - } else if (/^0\d*[89]/.test(number)) { - this.error("decimal literal '" + number + "' must not be prefixed with '0'"); - } else if (/^0\d+/.test(number)) { - this.error("octal literal '" + number + "' must be prefixed with '0o'"); - } - lexedLength = number.length; - if (octalLiteral = /^0o([0-7]+)/.exec(number)) { - number = '0x' + parseInt(octalLiteral[1], 8).toString(16); - } - if (binaryLiteral = /^0b([01]+)/.exec(number)) { - number = '0x' + parseInt(binaryLiteral[1], 2).toString(16); - } - this.token('NUMBER', number, 0, lexedLength); - return lexedLength; - }; - - Lexer.prototype.stringToken = function() { - var match, octalEsc, string; - switch (this.chunk.charAt(0)) { - case "'": - if (!(match = SIMPLESTR.exec(this.chunk))) { - return 0; - } - string = match[0]; - this.token('STRING', string.replace(MULTILINER, '\\\n'), 0, string.length); - break; - case '"': - if (!(string = this.balancedString(this.chunk, '"'))) { - return 0; - } - if (0 < string.indexOf('#{', 1)) { - this.interpolateString(string.slice(1, -1), { - strOffset: 1, - lexedLength: string.length - }); - } else { - this.token('STRING', this.escapeLines(string, 0, string.length)); - } - break; - default: - return 0; - } - if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) { - this.error("octal escape sequences " + string + " are not allowed"); - } - return string.length; - }; - - Lexer.prototype.heredocToken = function() { - var doc, heredoc, match, quote; - if (!(match = HEREDOC.exec(this.chunk))) { - return 0; - } - heredoc = match[0]; - quote = heredoc.charAt(0); - doc = this.sanitizeHeredoc(match[2], { - quote: quote, - indent: null - }); - if (quote === '"' && 0 <= doc.indexOf('#{')) { - this.interpolateString(doc, { - heredoc: true, - strOffset: 3, - lexedLength: heredoc.length - }); - } else { - this.token('STRING', this.makeString(doc, quote, true), 0, heredoc.length); - } - return heredoc.length; - }; - - Lexer.prototype.commentToken = function() { - var comment, here, match; - if (!(match = this.chunk.match(COMMENT))) { - return 0; - } - comment = match[0], here = match[1]; - if (here) { - this.token('HERECOMMENT', this.sanitizeHeredoc(here, { - herecomment: true, - indent: repeat(' ', this.indent) - }), 0, comment.length); - } - return comment.length; - }; - - Lexer.prototype.jsToken = function() { - var match, script; - if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) { - return 0; - } - this.token('JS', (script = match[0]).slice(1, -1), 0, script.length); - return script.length; - }; - - Lexer.prototype.regexToken = function() { - var flags, length, match, prev, regex, _ref2, _ref3; - if (this.chunk.charAt(0) !== '/') { - return 0; - } - if (match = HEREGEX.exec(this.chunk)) { - length = this.heregexToken(match); - return length; - } - prev = last(this.tokens); - if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) { - return 0; - } - if (!(match = REGEX.exec(this.chunk))) { - return 0; - } - _ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2]; - if (regex.slice(0, 2) === '/*') { - this.error('regular expressions cannot begin with `*`'); - } - if (regex === '//') { - regex = '/(?:)/'; - } - this.token('REGEX', "" + regex + flags, 0, match.length); - return match.length; - }; - - Lexer.prototype.heregexToken = function(match) { - var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4; - heregex = match[0], body = match[1], flags = match[2]; - if (0 > body.indexOf('#{')) { - re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/'); - if (re.match(/^\*/)) { - this.error('regular expressions cannot begin with `*`'); - } - this.token('REGEX', "/" + (re || '(?:)') + "/" + flags, 0, heregex.length); - return heregex.length; - } - this.token('IDENTIFIER', 'RegExp', 0, 0); - this.token('CALL_START', '(', 0, 0); - tokens = []; - _ref2 = this.interpolateString(body, { - regex: true - }); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - token = _ref2[_i]; - tag = token[0], value = token[1]; - if (tag === 'TOKENS') { - tokens.push.apply(tokens, value); - } else if (tag === 'NEOSTRING') { - if (!(value = value.replace(HEREGEX_OMIT, ''))) { - continue; - } - value = value.replace(/\\/g, '\\\\'); - token[0] = 'STRING'; - token[1] = this.makeString(value, '"', true); - tokens.push(token); - } else { - this.error("Unexpected " + tag); - } - prev = last(this.tokens); - plusToken = ['+', '+']; - plusToken[2] = prev[2]; - tokens.push(plusToken); - } - tokens.pop(); - if (((_ref3 = tokens[0]) != null ? _ref3[0] : void 0) !== 'STRING') { - this.token('STRING', '""', 0, 0); - this.token('+', '+', 0, 0); - } - (_ref4 = this.tokens).push.apply(_ref4, tokens); - if (flags) { - flagsOffset = heregex.lastIndexOf(flags); - this.token(',', ',', flagsOffset, 0); - this.token('STRING', '"' + flags + '"', flagsOffset, flags.length); - } - this.token(')', ')', heregex.length - 1, 0); - return heregex.length; - }; - - Lexer.prototype.lineToken = function() { - var diff, indent, match, noNewlines, size; - if (!(match = MULTI_DENT.exec(this.chunk))) { - return 0; - } - indent = match[0]; - this.seenFor = false; - size = indent.length - 1 - indent.lastIndexOf('\n'); - noNewlines = this.unfinished(); - if (size - this.indebt === this.indent) { - if (noNewlines) { - this.suppressNewlines(); - } else { - this.newlineToken(0); - } - return indent.length; - } - if (size > this.indent) { - if (noNewlines) { - this.indebt = size - this.indent; - this.suppressNewlines(); - return indent.length; - } - if (!this.tokens.length) { - this.baseIndent = this.indent = size; - return indent.length; - } - diff = size - this.indent + this.outdebt; - this.token('INDENT', diff, indent.length - size, size); - this.indents.push(diff); - this.ends.push('OUTDENT'); - this.outdebt = this.indebt = 0; - } else if (size < this.baseIndent) { - this.error('missing indentation', indent.length); - } else { - this.indebt = 0; - this.outdentToken(this.indent - size, noNewlines, indent.length); - } - this.indent = size; - return indent.length; - }; - - Lexer.prototype.outdentToken = function(moveOut, noNewlines, outdentLength) { - var dent, len; - while (moveOut > 0) { - len = this.indents.length - 1; - if (this.indents[len] === void 0) { - moveOut = 0; - } else if (this.indents[len] === this.outdebt) { - moveOut -= this.outdebt; - this.outdebt = 0; - } else if (this.indents[len] < this.outdebt) { - this.outdebt -= this.indents[len]; - moveOut -= this.indents[len]; - } else { - dent = this.indents.pop() + this.outdebt; - moveOut -= dent; - this.outdebt = 0; - this.pair('OUTDENT'); - this.token('OUTDENT', dent, 0, outdentLength); - } - } - if (dent) { - this.outdebt -= moveOut; - } - while (this.value() === ';') { - this.tokens.pop(); - } - if (!(this.tag() === 'TERMINATOR' || noNewlines)) { - this.token('TERMINATOR', '\n', outdentLength, 0); - } - return this; - }; - - Lexer.prototype.whitespaceToken = function() { - var match, nline, prev; - if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) { - return 0; - } - prev = last(this.tokens); - if (prev) { - prev[match ? 'spaced' : 'newLine'] = true; - } - if (match) { - return match[0].length; - } else { - return 0; - } - }; - - Lexer.prototype.newlineToken = function(offset) { - while (this.value() === ';') { - this.tokens.pop(); - } - if (this.tag() !== 'TERMINATOR') { - this.token('TERMINATOR', '\n', offset, 0); - } - return this; - }; - - Lexer.prototype.suppressNewlines = function() { - if (this.value() === '\\') { - this.tokens.pop(); - } - return this; - }; - - Lexer.prototype.literalToken = function() { - var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5; - if (match = OPERATOR.exec(this.chunk)) { - value = match[0]; - if (CODE.test(value)) { - this.tagParameters(); - } - } else { - value = this.chunk.charAt(0); - } - tag = value; - prev = last(this.tokens); - if (value === '=' && prev) { - if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) { - this.error("reserved word \"" + (this.value()) + "\" can't be assigned"); - } - if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') { - prev[0] = 'COMPOUND_ASSIGN'; - prev[1] += '='; - return value.length; - } - } - if (value === ';') { - this.seenFor = false; - tag = 'TERMINATOR'; - } else if (__indexOf.call(MATH, value) >= 0) { - tag = 'MATH'; - } else if (__indexOf.call(COMPARE, value) >= 0) { - tag = 'COMPARE'; - } else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) { - tag = 'COMPOUND_ASSIGN'; - } else if (__indexOf.call(UNARY, value) >= 0) { - tag = 'UNARY'; - } else if (__indexOf.call(SHIFT, value) >= 0) { - tag = 'SHIFT'; - } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) { - tag = 'LOGIC'; - } else if (prev && !prev.spaced) { - if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) { - if (prev[0] === '?') { - prev[0] = 'FUNC_EXIST'; - } - tag = 'CALL_START'; - } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) { - tag = 'INDEX_START'; - switch (prev[0]) { - case '?': - prev[0] = 'INDEX_SOAK'; - } - } - } - switch (value) { - case '(': - case '{': - case '[': - this.ends.push(INVERSES[value]); - break; - case ')': - case '}': - case ']': - this.pair(value); - } - this.token(tag, value); - return value.length; - }; - - Lexer.prototype.sanitizeHeredoc = function(doc, options) { - var attempt, herecomment, indent, match, _ref2; - indent = options.indent, herecomment = options.herecomment; - if (herecomment) { - if (HEREDOC_ILLEGAL.test(doc)) { - this.error("block comment cannot contain \"*/\", starting"); - } - if (doc.indexOf('\n') < 0) { - return doc; - } - } else { - while (match = HEREDOC_INDENT.exec(doc)) { - attempt = match[1]; - if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) { - indent = attempt; - } - } - } - if (indent) { - doc = doc.replace(RegExp("\\n" + indent, "g"), '\n'); - } - if (!herecomment) { - doc = doc.replace(/^\n/, ''); - } - return doc; - }; - - Lexer.prototype.tagParameters = function() { - var i, stack, tok, tokens; - if (this.tag() !== ')') { - return this; - } - stack = []; - tokens = this.tokens; - i = tokens.length; - tokens[--i][0] = 'PARAM_END'; - while (tok = tokens[--i]) { - switch (tok[0]) { - case ')': - stack.push(tok); - break; - case '(': - case 'CALL_START': - if (stack.length) { - stack.pop(); - } else if (tok[0] === '(') { - tok[0] = 'PARAM_START'; - return this; - } else { - return this; - } - } - } - return this; - }; - - Lexer.prototype.closeIndentation = function() { - return this.outdentToken(this.indent); - }; - - Lexer.prototype.balancedString = function(str, end) { - var continueCount, i, letter, match, prev, stack, _i, _ref2; - continueCount = 0; - stack = [end]; - for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) { - if (continueCount) { - --continueCount; - continue; - } - switch (letter = str.charAt(i)) { - case '\\': - ++continueCount; - continue; - case end: - stack.pop(); - if (!stack.length) { - return str.slice(0, +i + 1 || 9e9); - } - end = stack[stack.length - 1]; - continue; - } - if (end === '}' && (letter === '"' || letter === "'")) { - stack.push(end = letter); - } else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) { - continueCount += match[0].length - 1; - } else if (end === '}' && letter === '{') { - stack.push(end = '}'); - } else if (end === '"' && prev === '#' && letter === '{') { - stack.push(end = '}'); - } - prev = letter; - } - return this.error("missing " + (stack.pop()) + ", starting"); - }; - - Lexer.prototype.interpolateString = function(str, options) { - var column, expr, heredoc, i, inner, interpolated, len, letter, lexedLength, line, locationToken, nested, offsetInChunk, pi, plusToken, popped, regex, rparen, strOffset, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4; - if (options == null) { - options = {}; - } - heredoc = options.heredoc, regex = options.regex, offsetInChunk = options.offsetInChunk, strOffset = options.strOffset, lexedLength = options.lexedLength; - offsetInChunk = offsetInChunk || 0; - strOffset = strOffset || 0; - lexedLength = lexedLength || str.length; - if (heredoc && str.length > 0 && str[0] === '\n') { - str = str.slice(1); - strOffset++; - } - tokens = []; - pi = 0; - i = -1; - while (letter = str.charAt(i += 1)) { - if (letter === '\\') { - i += 1; - continue; - } - if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) { - continue; - } - if (pi < i) { - tokens.push(this.makeToken('NEOSTRING', str.slice(pi, i), strOffset + pi)); - } - inner = expr.slice(1, -1); - if (inner.length) { - _ref2 = this.getLineAndColumnFromChunk(strOffset + i + 1), line = _ref2[0], column = _ref2[1]; - nested = new Lexer().tokenize(inner, { - line: line, - column: column, - rewrite: false - }); - popped = nested.pop(); - if (((_ref3 = nested[0]) != null ? _ref3[0] : void 0) === 'TERMINATOR') { - popped = nested.shift(); - } - if (len = nested.length) { - if (len > 1) { - nested.unshift(this.makeToken('(', '(', strOffset + i + 1, 0)); - nested.push(this.makeToken(')', ')', strOffset + i + 1 + inner.length, 0)); - } - tokens.push(['TOKENS', nested]); - } - } - i += expr.length; - pi = i + 1; - } - if ((i > pi && pi < str.length)) { - tokens.push(this.makeToken('NEOSTRING', str.slice(pi), strOffset + pi)); - } - if (regex) { - return tokens; - } - if (!tokens.length) { - return this.token('STRING', '""', offsetInChunk, lexedLength); - } - if (tokens[0][0] !== 'NEOSTRING') { - tokens.unshift(this.makeToken('NEOSTRING', '', offsetInChunk)); - } - if (interpolated = tokens.length > 1) { - this.token('(', '(', offsetInChunk, 0); - } - for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) { - token = tokens[i]; - tag = token[0], value = token[1]; - if (i) { - if (i) { - plusToken = this.token('+', '+'); - } - locationToken = tag === 'TOKENS' ? value[0] : token; - plusToken[2] = { - first_line: locationToken[2].first_line, - first_column: locationToken[2].first_column, - last_line: locationToken[2].first_line, - last_column: locationToken[2].first_column - }; - } - if (tag === 'TOKENS') { - (_ref4 = this.tokens).push.apply(_ref4, value); - } else if (tag === 'NEOSTRING') { - token[0] = 'STRING'; - token[1] = this.makeString(value, '"', heredoc); - this.tokens.push(token); - } else { - this.error("Unexpected " + tag); - } - } - if (interpolated) { - rparen = this.makeToken(')', ')', offsetInChunk + lexedLength, 0); - rparen.stringEnd = true; - this.tokens.push(rparen); - } - return tokens; - }; - - Lexer.prototype.pair = function(tag) { - var size, wanted; - if (tag !== (wanted = last(this.ends))) { - if ('OUTDENT' !== wanted) { - this.error("unmatched " + tag); - } - this.indent -= size = last(this.indents); - this.outdentToken(size, true); - return this.pair(tag); - } - return this.ends.pop(); - }; - - Lexer.prototype.getLineAndColumnFromChunk = function(offset) { - var column, lineCount, lines, string; - if (offset === 0) { - return [this.chunkLine, this.chunkColumn]; - } - if (offset >= this.chunk.length) { - string = this.chunk; - } else { - string = this.chunk.slice(0, +(offset - 1) + 1 || 9e9); - } - lineCount = count(string, '\n'); - column = this.chunkColumn; - if (lineCount > 0) { - lines = string.split('\n'); - column = last(lines).length; - } else { - column += string.length; - } - return [this.chunkLine + lineCount, column]; - }; - - Lexer.prototype.makeToken = function(tag, value, offsetInChunk, length) { - var lastCharacter, locationData, token, _ref2, _ref3; - if (offsetInChunk == null) { - offsetInChunk = 0; - } - if (length == null) { - length = value.length; - } - locationData = {}; - _ref2 = this.getLineAndColumnFromChunk(offsetInChunk), locationData.first_line = _ref2[0], locationData.first_column = _ref2[1]; - lastCharacter = Math.max(0, length - 1); - _ref3 = this.getLineAndColumnFromChunk(offsetInChunk + lastCharacter), locationData.last_line = _ref3[0], locationData.last_column = _ref3[1]; - token = [tag, value, locationData]; - return token; - }; - - Lexer.prototype.token = function(tag, value, offsetInChunk, length) { - var token; - token = this.makeToken(tag, value, offsetInChunk, length); - this.tokens.push(token); - return token; - }; - - Lexer.prototype.tag = function(index, tag) { - var tok; - return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]); - }; - - Lexer.prototype.value = function(index, val) { - var tok; - return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]); - }; - - Lexer.prototype.unfinished = function() { - var _ref2; - return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS'); - }; - - Lexer.prototype.escapeLines = function(str, heredoc) { - return str.replace(MULTILINER, heredoc ? '\\n' : ''); - }; - - Lexer.prototype.makeString = function(body, quote, heredoc) { - if (!body) { - return quote + quote; - } - body = body.replace(/\\([\s\S])/g, function(match, contents) { - if (contents === '\n' || contents === quote) { - return contents; - } else { - return match; - } - }); - body = body.replace(RegExp("" + quote, "g"), '\\$&'); - return quote + this.escapeLines(body, heredoc) + quote; - }; - - Lexer.prototype.error = function(message, offset) { - var first_column, first_line, _ref2; - if (offset == null) { - offset = 0; - } - _ref2 = this.getLineAndColumnFromChunk(offset), first_line = _ref2[0], first_column = _ref2[1]; - return throwSyntaxError(message, { - first_line: first_line, - first_column: first_column - }); - }; - - return Lexer; - - })(); - - JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super']; - - COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when']; - - COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(['await', 'defer']); - - COFFEE_ALIAS_MAP = { - and: '&&', - or: '||', - is: '==', - isnt: '!=', - not: '!', - yes: 'true', - no: 'false', - on: 'true', - off: 'false' - }; - - COFFEE_ALIASES = (function() { - var _results; - _results = []; - for (key in COFFEE_ALIAS_MAP) { - _results.push(key); - } - return _results; - })(); - - COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES); - - RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield']; - - STRICT_PROSCRIBED = ['arguments', 'eval']; - - JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED); - - exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS).concat(STRICT_PROSCRIBED); - - exports.STRICT_PROSCRIBED = STRICT_PROSCRIBED; - - BOM = 65279; - - IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/; - - NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i; - - HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/; - - OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?(\.|::)|\.{2,3})/; - - WHITESPACE = /^[^\n\S]+/; - - COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)$)|^(?:\s*#(?!##[^#]).*)+/; - - CODE = /^[-=]>/; - - MULTI_DENT = /^(?:\n[^\n\S]*)+/; - - SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/; - - JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/; - - REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/; - - HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/; - - HEREGEX_OMIT = /\s+(?:#.*)?/g; - - MULTILINER = /\n/g; - - HEREDOC_INDENT = /\n+([^\n\S]*)/g; - - HEREDOC_ILLEGAL = /\*\//; - - LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/; - - TRAILING_SPACES = /\s+$/; - - COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|=']; - - UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO']; - - LOGIC = ['&&', '||', '&', '|', '^']; - - SHIFT = ['<<', '>>', '>>>']; - - COMPARE = ['==', '!=', '<', '>', '<=', '>=']; - - MATH = ['*', '/', '%']; - - RELATION = ['IN', 'OF', 'INSTANCEOF']; - - BOOL = ['TRUE', 'FALSE']; - - NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--']; - - NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING', ']'); - - CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER']; - - INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED'); - - LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR']; - - CALLABLE.push('DEFER'); - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/nodes.js b/node_modules/iced-coffee-script/lib/coffee-script/nodes.js deleted file mode 100644 index 9460036..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/nodes.js +++ /dev/null @@ -1,4280 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var Access, Arr, Assign, Await, Base, Block, Call, Class, Closure, Code, CodeFragment, Comment, CpsCascade, Defer, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, IcedReturnValue, IcedRuntime, IcedTailCall, If, In, Index, InlineRuntime, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, NULL, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Slot, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, iced, last, locationDataToString, merge, multident, some, starts, throwSyntaxError, unfoldSoak, utility, _ref, _ref1, _ref2, _ref3, - __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, - __slice = [].slice; - - - - Error.stackTraceLimit = Infinity; - - Scope = require('./scope').Scope; - - _ref = require('./lexer'), RESERVED = _ref.RESERVED, STRICT_PROSCRIBED = _ref.STRICT_PROSCRIBED; - - iced = require('./iced'); - - _ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last, some = _ref1.some, addLocationDataFn = _ref1.addLocationDataFn, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError; - - exports.extend = extend; - - exports.addLocationDataFn = addLocationDataFn; - - YES = function() { - return true; - }; - - NO = function() { - return false; - }; - - THIS = function() { - return this; - }; - - NEGATE = function() { - this.negated = !this.negated; - return this; - }; - - NULL = function() { - return new Value(new Literal('null')); - }; - - exports.CodeFragment = CodeFragment = (function() { - function CodeFragment(parent, code) { - var _ref2; - this.code = "" + code; - this.locationData = parent != null ? parent.locationData : void 0; - this.type = (parent != null ? (_ref2 = parent.constructor) != null ? _ref2.name : void 0 : void 0) || 'unknown'; - } - - CodeFragment.prototype.toString = function() { - return "" + this.code + (this.locationData ? ": " + locationDataToString(this.locationData) : ''); - }; - - return CodeFragment; - - })(); - - fragmentsToText = function(fragments) { - var fragment; - return ((function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = fragments.length; _i < _len; _i++) { - fragment = fragments[_i]; - _results.push(fragment.code); - } - return _results; - })()).join(''); - }; - - exports.Base = Base = (function() { - function Base() { - this.icedContinuationBlock = null; - this.icedLoopFlag = false; - this.icedNodeFlag = false; - this.icedGotCpsSplitFlag = false; - this.icedCpsPivotFlag = false; - this.icedHasAutocbFlag = false; - this.icedFoundArguments = false; - this.icedParentAwait = null; - this.icedCallContinuationFlag = false; - } - - Base.prototype.compile = function(o, lvl) { - return fragmentsToText(this.compileToFragments(o, lvl)); - }; - - Base.prototype.compileToFragments = function(o, lvl) { - var node; - o = extend({}, o); - if (lvl) { - o.level = lvl; - } - node = this.unfoldSoak(o) || this; - node.tab = o.indent; - if (node.icedHasContinuation() && !node.icedGotCpsSplitFlag) { - return node.icedCompileCps(o); - } else if (o.level === LEVEL_TOP || !node.isStatement(o)) { - return node.compileNode(o); - } else { - return node.compileClosure(o); - } - }; - - Base.prototype.compileClosure = function(o) { - var jumpNode; - if (jumpNode = this.jumps()) { - jumpNode.error('cannot use a pure statement in an expression'); - } - o.sharedScope = true; - this.icedClearAutocbFlags(); - return Closure.wrap(this).compileNode(o); - }; - - Base.prototype.cache = function(o, level, reused) { - var ref, sub; - if (!this.isComplex()) { - ref = level ? this.compileToFragments(o, level) : this; - return [ref, ref]; - } else { - ref = new Literal(reused || o.scope.freeVariable('ref')); - sub = new Assign(ref, this); - if (level) { - return [sub.compileToFragments(o, level), [this.makeCode(ref.value)]]; - } else { - return [sub, ref]; - } - } - }; - - Base.prototype.cacheToCodeFragments = function(cacheValues) { - return [fragmentsToText(cacheValues[0]), fragmentsToText(cacheValues[1])]; - }; - - Base.prototype.makeReturn = function(res) { - var me; - me = this.unwrapAll(); - if (res) { - return new Call(new Literal("" + res + ".push"), [me]); - } else { - return new Return(me, this.icedHasAutocbFlag); - } - }; - - Base.prototype.contains = function(pred) { - var node; - node = void 0; - this.traverseChildren(false, function(n) { - if (pred(n)) { - node = n; - return false; - } - }); - return node; - }; - - Base.prototype.lastNonComment = function(list) { - var i; - i = list.length; - while (i--) { - if (!(list[i] instanceof Comment)) { - return list[i]; - } - } - return null; - }; - - Base.prototype.toString = function(idt, name) { - var extras, tree; - if (idt == null) { - idt = ''; - } - if (name == null) { - name = this.constructor.name; - } - extras = []; - if (this.icedNodeFlag) { - extras.push("A"); - } - if (this.icedLoopFlag) { - extras.push("L"); - } - if (this.icedCpsPivotFlag) { - extras.push("P"); - } - if (this.icedHasAutocbFlag) { - extras.push("C"); - } - if (this.icedParentAwait) { - extras.push("D"); - } - if (this.icedFoundArguments) { - extras.push("G"); - } - if (extras.length) { - extras = " (" + extras.join('') + ")"; - } - tree = '\n' + idt + name; - tree = '\n' + idt + name; - if (this.soak) { - tree += '?'; - } - tree += extras; - this.eachChild(function(node) { - return tree += node.toString(idt + TAB); - }); - if (this.icedContinuationBlock) { - idt += TAB; - tree += '\n' + idt + "Continuation"; - tree += this.icedContinuationBlock.toString(idt + TAB); - } - return tree; - }; - - Base.prototype.eachChild = function(func) { - var attr, child, _i, _j, _len, _len1, _ref2, _ref3; - if (!this.children) { - return this; - } - _ref2 = this.children; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - attr = _ref2[_i]; - if (this[attr]) { - _ref3 = flatten([this[attr]]); - for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { - child = _ref3[_j]; - if (func(child) === false) { - return this; - } - } - } - } - return this; - }; - - Base.prototype.traverseChildren = function(crossScope, func) { - return this.eachChild(function(child) { - var recur; - recur = func(child); - if (recur !== false) { - return child.traverseChildren(crossScope, func); - } - }); - }; - - Base.prototype.invert = function() { - return new Op('!', this); - }; - - Base.prototype.unwrapAll = function() { - var node; - node = this; - while (node !== (node = node.unwrap())) { - continue; - } - return node; - }; - - Base.prototype.flattenChildren = function() { - var attr, child, out, _i, _j, _len, _len1, _ref2, _ref3; - out = []; - _ref2 = this.children; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - attr = _ref2[_i]; - if (this[attr]) { - _ref3 = flatten([this[attr]]); - for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { - child = _ref3[_j]; - out.push(child); - } - } - } - return out; - }; - - Base.prototype.icedCompileCps = function(o) { - var code; - this.icedGotCpsSplitFlag = true; - code = CpsCascade.wrap(this, this.icedContinuationBlock, null, o); - return code.compileNode(o); - }; - - Base.prototype.icedWalkAst = function(p, o) { - var child, _i, _len, _ref2; - this.icedParentAwait = p; - this.icedHasAutocbFlag = o.foundAutocb; - _ref2 = this.flattenChildren(); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - child = _ref2[_i]; - if (child.icedWalkAst(p, o)) { - this.icedNodeFlag = true; - } - } - return this.icedNodeFlag; - }; - - Base.prototype.icedWalkAstLoops = function(flood) { - var child, _i, _len, _ref2; - if (this.isLoop() && this.icedNodeFlag) { - flood = true; - } - if (this.isLoop() && !this.icedNodeFlag) { - flood = false; - } - this.icedLoopFlag = flood; - _ref2 = this.flattenChildren(); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - child = _ref2[_i]; - if (child.icedWalkAstLoops(flood)) { - this.icedLoopFlag = true; - } - } - return this.icedLoopFlag; - }; - - Base.prototype.icedWalkCpsPivots = function() { - var child, _i, _len, _ref2; - if (this.icedNodeFlag || (this.icedLoopFlag && this.icedIsJump())) { - this.icedCpsPivotFlag = true; - } - _ref2 = this.flattenChildren(); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - child = _ref2[_i]; - if (child.icedWalkCpsPivots()) { - this.icedCpsPivotFlag = true; - } - } - return this.icedCpsPivotFlag; - }; - - Base.prototype.icedClearAutocbFlags = function() { - this.icedHasAutocbFlag = false; - return this.traverseChildren(false, function(node) { - node.icedHasAutocbFlag = false; - return true; - }); - }; - - Base.prototype.icedCpsRotate = function() { - var child, _i, _len, _ref2; - _ref2 = this.flattenChildren(); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - child = _ref2[_i]; - child.icedCpsRotate(); - } - return this; - }; - - Base.prototype.icedIsCpsPivot = function() { - return this.icedCpsPivotFlag; - }; - - Base.prototype.icedNestContinuationBlock = function(b) { - return this.icedContinuationBlock = b; - }; - - Base.prototype.icedHasContinuation = function() { - return !!this.icedContinuationBlock; - }; - - Base.prototype.icedCallContinuation = function() { - return this.icedCallContinuationFlag = true; - }; - - Base.prototype.icedWrapContinuation = NO; - - Base.prototype.icedIsJump = NO; - - Base.prototype.icedUnwrap = function(e) { - if (e.icedHasContinuation() && this.icedHasContinuation()) { - return this; - } else { - if (this.icedHasContinuation()) { - e.icedContinuationBlock = this.icedContinuationBlock; - } - return e; - } - }; - - Base.prototype.icedStatementAssertion = function() { - if (this.icedIsCpsPivot()) { - return this.error("await'ed statements can't act as expressions"); - } - }; - - Base.prototype.children = []; - - Base.prototype.isStatement = NO; - - Base.prototype.jumps = NO; - - Base.prototype.isComplex = YES; - - Base.prototype.isChainable = NO; - - Base.prototype.isAssignable = NO; - - Base.prototype.isLoop = NO; - - Base.prototype.unwrap = THIS; - - Base.prototype.unfoldSoak = NO; - - Base.prototype.assigns = NO; - - Base.prototype.updateLocationDataIfMissing = function(locationData) { - if (this.locationData) { - return this; - } - this.locationData = locationData; - return this.eachChild(function(child) { - return child.updateLocationDataIfMissing(locationData); - }); - }; - - Base.prototype.error = function(message) { - return throwSyntaxError(message, this.locationData); - }; - - Base.prototype.makeCode = function(code) { - return new CodeFragment(this, code); - }; - - Base.prototype.wrapInBraces = function(fragments) { - return [].concat(this.makeCode('('), fragments, this.makeCode(')')); - }; - - Base.prototype.joinFragmentArrays = function(fragmentsList, joinStr) { - var answer, fragments, i, _i, _len; - answer = []; - for (i = _i = 0, _len = fragmentsList.length; _i < _len; i = ++_i) { - fragments = fragmentsList[i]; - if (i) { - answer.push(this.makeCode(joinStr)); - } - answer = answer.concat(fragments); - } - return answer; - }; - - return Base; - - })(); - - exports.Block = Block = (function(_super) { - __extends(Block, _super); - - function Block(nodes) { - Block.__super__.constructor.call(this); - this.expressions = compact(flatten(nodes || [])); - } - - Block.prototype.children = ['expressions']; - - Block.prototype.push = function(node) { - this.expressions.push(node); - return this; - }; - - Block.prototype.pop = function() { - return this.expressions.pop(); - }; - - Block.prototype.unshift = function(node) { - this.expressions.unshift(node); - return this; - }; - - Block.prototype.unwrap = function() { - if (this.expressions.length === 1) { - return this.icedUnwrap(this.expressions[0]); - } else { - return this; - } - }; - - Block.prototype.isEmpty = function() { - return !this.expressions.length; - }; - - Block.prototype.isStatement = function(o) { - var exp, _i, _len, _ref2; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - exp = _ref2[_i]; - if (exp.isStatement(o)) { - return true; - } - } - return false; - }; - - Block.prototype.jumps = function(o) { - var exp, _i, _len, _ref2; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - exp = _ref2[_i]; - if (exp.jumps(o)) { - return exp; - } - } - }; - - Block.prototype.makeReturn = function(res) { - var expr, foundReturn, len; - len = this.expressions.length; - foundReturn = false; - while (len--) { - expr = this.expressions[len]; - if (!(expr instanceof Comment)) { - this.expressions[len] = expr.makeReturn(res); - if (expr instanceof Return && !expr.expression && !expr.icedHasAutocbFlag) { - this.expressions.splice(len, 1); - foundReturn = true; - } else if (!(expr instanceof If) || expr.elseBody) { - foundReturn = true; - } - break; - } - } - if (this.icedHasAutocbFlag && !this.icedNodeFlag && !foundReturn) { - this.expressions.push(new Return(null, true)); - } - return this; - }; - - Block.prototype.compileToFragments = function(o, level) { - if (o == null) { - o = {}; - } - if (o.scope) { - return Block.__super__.compileToFragments.call(this, o, level); - } else { - return this.compileRoot(o); - } - }; - - Block.prototype.compileNode = function(o) { - var answer, compiledNodes, fragments, index, node, top, _i, _len, _ref2; - this.tab = o.indent; - top = o.level === LEVEL_TOP; - compiledNodes = []; - _ref2 = this.expressions; - for (index = _i = 0, _len = _ref2.length; _i < _len; index = ++_i) { - node = _ref2[index]; - node = node.unwrapAll(); - node = node.unfoldSoak(o) || node; - if (node instanceof Block) { - compiledNodes.push(node.compileNode(o)); - } else if (top) { - node.front = true; - fragments = node.compileToFragments(o); - if (!node.isStatement(o)) { - fragments.unshift(this.makeCode("" + this.tab)); - fragments.push(this.makeCode(";")); - } - compiledNodes.push(fragments); - } else { - compiledNodes.push(node.compileToFragments(o, LEVEL_LIST)); - } - } - if (top) { - if (this.spaced) { - return [].concat(this.joinFragmentArrays(compiledNodes, '\n\n'), this.makeCode("\n")); - } else { - return this.joinFragmentArrays(compiledNodes, '\n'); - } - } - if (compiledNodes.length) { - answer = this.joinFragmentArrays(compiledNodes, ', '); - } else { - answer = [this.makeCode("void 0")]; - } - if (compiledNodes.length > 1 && o.level >= LEVEL_LIST) { - return this.wrapInBraces(answer); - } else { - return answer; - } - }; - - Block.prototype.compileRoot = function(o) { - var exp, fragments, i, name, prelude, preludeExps, rest, _i, _len, _ref2; - o.indent = o.bare ? '' : TAB; - o.level = LEVEL_TOP; - this.spaced = true; - o.scope = new Scope(null, this, null); - _ref2 = o.locals || []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - name = _ref2[_i]; - o.scope.parameter(name); - } - prelude = []; - if (!o.bare) { - preludeExps = (function() { - var _j, _len1, _ref3, _results; - _ref3 = this.expressions; - _results = []; - for (i = _j = 0, _len1 = _ref3.length; _j < _len1; i = ++_j) { - exp = _ref3[i]; - if (!(exp.unwrap() instanceof Comment)) { - break; - } - _results.push(exp); - } - return _results; - }).call(this); - rest = this.expressions.slice(preludeExps.length); - this.expressions = preludeExps; - if (preludeExps.length) { - prelude = this.compileNode(merge(o, { - indent: '' - })); - prelude.push(this.makeCode("\n")); - } - this.expressions = rest; - } - fragments = this.compileWithDeclarations(o); - if (o.bare) { - return fragments; - } - return [].concat(prelude, this.makeCode("(function() {\n"), fragments, this.makeCode("\n}).call(this);\n")); - }; - - Block.prototype.compileWithDeclarations = function(o) { - var assigns, declars, exp, fragments, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4; - fragments = []; - post = []; - _ref2 = this.expressions; - for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { - exp = _ref2[i]; - exp = exp.unwrap(); - if (!(exp instanceof Comment || exp instanceof Literal)) { - break; - } - } - o = merge(o, { - level: LEVEL_TOP - }); - if (i) { - rest = this.expressions.splice(i, 9e9); - _ref3 = [this.spaced, false], spaced = _ref3[0], this.spaced = _ref3[1]; - _ref4 = [this.compileNode(o), spaced], fragments = _ref4[0], this.spaced = _ref4[1]; - this.expressions = rest; - } - post = this.compileNode(o); - scope = o.scope; - if (scope.expressions === this) { - declars = o.scope.hasDeclarations(); - assigns = scope.hasAssignments; - if (declars || assigns) { - if (i) { - fragments.push(this.makeCode('\n')); - } - fragments.push(this.makeCode("" + this.tab + "var ")); - if (declars) { - fragments.push(this.makeCode(scope.declaredVariables().join(', '))); - } - if (assigns) { - if (declars) { - fragments.push(this.makeCode(",\n" + (this.tab + TAB))); - } - fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB)))); - } - fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : ''))); - } else if (fragments.length && post.length) { - fragments.push(this.makeCode("\n")); - } - } - return fragments.concat(post); - }; - - Block.wrap = function(nodes) { - if (nodes.length === 1 && nodes[0] instanceof Block) { - return nodes[0]; - } - return new Block(nodes); - }; - - Block.prototype.icedThreadReturn = function(call) { - var expr, len; - call = call || new IcedTailCall; - len = this.expressions.length; - while (len--) { - expr = this.expressions[len]; - if (expr.isStatement()) { - break; - } - if (!(expr instanceof Comment) && !(expr instanceof Return)) { - call.assignValue(expr); - this.expressions[len] = call; - return; - } - } - return this.expressions.push(call); - }; - - Block.prototype.icedCompileCps = function(o) { - this.icedGotCpsSplitFlag = true; - if (this.expressions.length > 1) { - return Block.__super__.icedCompileCps.call(this, o); - } else { - return this.compileNode(o); - } - }; - - Block.prototype.icedCpsRotate = function() { - var child, e, i, pivot, rest, _i, _j, _len, _len1, _ref2; - pivot = null; - _ref2 = this.expressions; - for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { - e = _ref2[i]; - if (e.icedIsCpsPivot()) { - pivot = e; - pivot.icedCallContinuation(); - } - e.icedCpsRotate(); - if (pivot) { - break; - } - } - if (!pivot) { - return this; - } - if (pivot.icedContinuationBlock) { - throw SyntaxError("unexpected continuation block in node"); - } - rest = this.expressions.slice(i + 1); - this.expressions = this.expressions.slice(0, i + 1); - if (rest.length) { - child = new Block(rest); - pivot.icedNestContinuationBlock(child); - for (_j = 0, _len1 = rest.length; _j < _len1; _j++) { - e = rest[_j]; - if (e.icedNodeFlag) { - child.icedNodeFlag = true; - } - if (e.icedLoopFlag) { - child.icedLoopFlag = true; - } - if (e.icedCpsPivotFlag) { - child.icedCpsPivotFlag = true; - } - if (e.icedHasAutocbFlag) { - child.icedHasAutocbFlag = true; - } - } - child.icedCpsRotate(); - } - return this; - }; - - Block.prototype.icedAddRuntime = function(foundDefer, foundAwait) { - var index, node; - index = 0; - while ((node = this.expressions[index]) && node instanceof Comment || node instanceof Value && node.isString()) { - index++; - } - return this.expressions.splice(index, 0, new IcedRuntime(foundDefer, foundAwait)); - }; - - Block.prototype.icedTransform = function(opts) { - var obj; - obj = {}; - this.icedWalkAst(null, obj); - if (!(opts != null ? opts.repl : void 0)) { - this.icedAddRuntime(obj.foundDefer, obj.foundAwait); - } - if (obj.foundAwait) { - this.icedWalkAstLoops(false); - this.icedWalkCpsPivots(); - this.icedCpsRotate(); - } - return this; - }; - - Block.prototype.icedGetSingle = function() { - if (this.expressions.length === 1) { - return this.expressions[0]; - } else { - return null; - } - }; - - return Block; - - })(Base); - - exports.Literal = Literal = (function(_super) { - __extends(Literal, _super); - - function Literal(value) { - this.value = value; - Literal.__super__.constructor.call(this); - } - - Literal.prototype.makeReturn = function() { - if (this.isStatement()) { - return this; - } else { - return Literal.__super__.makeReturn.apply(this, arguments); - } - }; - - Literal.prototype.isAssignable = function() { - return IDENTIFIER.test(this.value); - }; - - Literal.prototype.isStatement = function() { - var _ref2; - return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger'; - }; - - Literal.prototype.isComplex = NO; - - Literal.prototype.assigns = function(name) { - return name === this.value; - }; - - Literal.prototype.jumps = function(o) { - if (this.value === 'break' && !((o != null ? o.loop : void 0) || (o != null ? o.block : void 0))) { - return this; - } - if (this.value === 'continue' && !(o != null ? o.loop : void 0)) { - return this; - } - }; - - Literal.prototype.compileNode = function(o) { - var answer, code, _ref2; - if (this.icedLoopFlag && this.icedIsJump()) { - return this.icedCompileIced(o); - } - code = this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value; - answer = this.isStatement() ? "" + this.tab + code + ";" : code; - return [this.makeCode(answer)]; - }; - - Literal.prototype.toString = function() { - return ' "' + this.value + '"'; - }; - - Literal.prototype.icedWalkAst = function(parent, o) { - if (this.value === 'arguments' && o.foundAwaitFunc) { - o.foundArguments = true; - this.value = "_arguments"; - } - return false; - }; - - Literal.prototype.icedIsJump = function() { - return this.isStatement(); - }; - - Literal.prototype.icedCompileIced = function(o) { - var call, d, func, l; - d = { - 'continue': iced["const"].c_while, - 'break': iced["const"].b_while - }; - l = d[this.value]; - func = new Value(new Literal(l)); - call = new Call(func, []); - return call.compileNode(o); - }; - - return Literal; - - })(Base); - - exports.Undefined = (function(_super) { - __extends(Undefined, _super); - - function Undefined() { - _ref2 = Undefined.__super__.constructor.apply(this, arguments); - return _ref2; - } - - Undefined.prototype.isAssignable = NO; - - Undefined.prototype.isComplex = NO; - - Undefined.prototype.compileNode = function(o) { - return [this.makeCode(o.level >= LEVEL_ACCESS ? '(void 0)' : 'void 0')]; - }; - - return Undefined; - - })(Base); - - exports.Null = (function(_super) { - __extends(Null, _super); - - function Null() { - _ref3 = Null.__super__.constructor.apply(this, arguments); - return _ref3; - } - - Null.prototype.isAssignable = NO; - - Null.prototype.isComplex = NO; - - Null.prototype.compileNode = function() { - return [this.makeCode("null")]; - }; - - return Null; - - })(Base); - - exports.Bool = (function(_super) { - __extends(Bool, _super); - - Bool.prototype.isAssignable = NO; - - Bool.prototype.isComplex = NO; - - Bool.prototype.compileNode = function() { - return [this.makeCode(this.val)]; - }; - - function Bool(val) { - this.val = val; - } - - return Bool; - - })(Base); - - exports.Return = Return = (function(_super) { - __extends(Return, _super); - - function Return(expr, auto) { - Return.__super__.constructor.call(this); - this.icedHasAutocbFlag = auto; - if (expr && !expr.unwrap().isUndefined) { - this.expression = expr; - } - } - - Return.prototype.children = ['expression']; - - Return.prototype.isStatement = YES; - - Return.prototype.makeReturn = THIS; - - Return.prototype.jumps = THIS; - - Return.prototype.compileToFragments = function(o, level) { - var expr, _ref4; - expr = (_ref4 = this.expression) != null ? _ref4.makeReturn() : void 0; - if (expr && !(expr instanceof Return)) { - return expr.compileToFragments(o, level); - } else { - return Return.__super__.compileToFragments.call(this, o, level); - } - }; - - Return.prototype.compileNode = function(o) { - var answer; - if (this.icedHasAutocbFlag) { - return this.icedCompileIced(o); - } - answer = []; - answer.push(this.makeCode(this.tab + ("return" + (this.expression ? " " : "")))); - if (this.expression) { - answer = answer.concat(this.expression.compileToFragments(o, LEVEL_PAREN)); - } - answer.push(this.makeCode(";")); - return answer; - }; - - Return.prototype.icedCompileIced = function(o) { - var args, block, call, cb, ret; - cb = new Value(new Literal(iced["const"].autocb)); - args = this.expression ? [this.expression] : []; - call = new Call(cb, args); - ret = new Literal("return"); - block = new Block([call, ret]); - return block.compileNode(o); - }; - - return Return; - - })(Base); - - exports.Value = Value = (function(_super) { - __extends(Value, _super); - - function Value(base, props, tag) { - Value.__super__.constructor.call(this); - if (!props && base instanceof Value) { - return base; - } - this.base = base; - this.properties = props || []; - if (tag) { - this[tag] = true; - } - return this; - } - - Value.prototype.children = ['base', 'properties']; - - Value.prototype.copy = function() { - return new Value(this.base, this.properties); - }; - - Value.prototype.add = function(props) { - this.properties = this.properties.concat(props); - return this; - }; - - Value.prototype.hasProperties = function() { - return !!this.properties.length; - }; - - Value.prototype.isArray = function() { - return !this.properties.length && this.base instanceof Arr; - }; - - Value.prototype.isComplex = function() { - return this.hasProperties() || this.base.isComplex(); - }; - - Value.prototype.isAssignable = function() { - return this.hasProperties() || this.base.isAssignable(); - }; - - Value.prototype.isSimpleNumber = function() { - return this.base instanceof Literal && SIMPLENUM.test(this.base.value); - }; - - Value.prototype.isString = function() { - return this.base instanceof Literal && IS_STRING.test(this.base.value); - }; - - Value.prototype.isAtomic = function() { - var node, _i, _len, _ref4; - _ref4 = this.properties.concat(this.base); - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - node = _ref4[_i]; - if (node.soak || node instanceof Call) { - return false; - } - } - return true; - }; - - Value.prototype.isStatement = function(o) { - return !this.properties.length && this.base.isStatement(o); - }; - - Value.prototype.assigns = function(name) { - return !this.properties.length && this.base.assigns(name); - }; - - Value.prototype.jumps = function(o) { - return !this.properties.length && this.base.jumps(o); - }; - - Value.prototype.isObject = function(onlyGenerated) { - if (this.properties.length) { - return false; - } - return (this.base instanceof Obj) && (!onlyGenerated || this.base.generated); - }; - - Value.prototype.isSplice = function() { - return last(this.properties) instanceof Slice; - }; - - Value.prototype.unwrap = function() { - if (this.properties.length) { - return this; - } else { - return this.base; - } - }; - - Value.prototype.cacheReference = function(o) { - var base, bref, name, nref; - name = last(this.properties); - if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) { - return [this, this]; - } - base = new Value(this.base, this.properties.slice(0, -1)); - if (base.isComplex()) { - bref = new Literal(o.scope.freeVariable('base')); - base = new Value(new Parens(new Assign(bref, base))); - } - if (!name) { - return [base, bref]; - } - if (name.isComplex()) { - nref = new Literal(o.scope.freeVariable('name')); - name = new Index(new Assign(nref, name.index)); - nref = new Index(nref); - } - return [base.add(name), new Value(bref || base.base, [nref || name])]; - }; - - Value.prototype.compileNode = function(o) { - var fragments, prop, props, _i, _len; - this.base.front = this.front; - props = this.properties; - fragments = this.base.compileToFragments(o, (props.length ? LEVEL_ACCESS : null)); - if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(fragmentsToText(fragments))) { - fragments.push(this.makeCode('.')); - } - for (_i = 0, _len = props.length; _i < _len; _i++) { - prop = props[_i]; - fragments.push.apply(fragments, prop.compileToFragments(o)); - } - return fragments; - }; - - Value.prototype.unfoldSoak = function(o) { - var _this = this; - return this.unfoldedSoak != null ? this.unfoldedSoak : this.unfoldedSoak = (function() { - var fst, i, ifn, prop, ref, snd, _i, _len, _ref4, _ref5; - if (ifn = _this.base.unfoldSoak(o)) { - (_ref4 = ifn.body.properties).push.apply(_ref4, _this.properties); - return ifn; - } - _ref5 = _this.properties; - for (i = _i = 0, _len = _ref5.length; _i < _len; i = ++_i) { - prop = _ref5[i]; - if (!prop.soak) { - continue; - } - prop.soak = false; - fst = new Value(_this.base, _this.properties.slice(0, i)); - snd = new Value(_this.base, _this.properties.slice(i)); - if (fst.isComplex()) { - ref = new Literal(o.scope.freeVariable('ref')); - fst = new Parens(new Assign(ref, fst)); - snd.base = ref; - } - return new If(new Existence(fst), snd, { - soak: true - }); - } - return false; - })(); - }; - - Value.prototype.icedToSlot = function(i) { - var sufffix, suffix; - if (this.base instanceof Obj) { - return this.base.icedToSlot(i); - } - sufffix = null; - if (this.properties && this.properties.length) { - suffix = this.properties.pop(); - } - return new Slot(i, this, suffix); - }; - - Value.prototype.icedToSlotAccess = function() { - if (this["this"]) { - return this.properties[0]; - } else { - return new Access(this); - } - }; - - return Value; - - })(Base); - - exports.Comment = Comment = (function(_super) { - __extends(Comment, _super); - - function Comment(comment) { - this.comment = comment; - Comment.__super__.constructor.call(this); - } - - Comment.prototype.isStatement = YES; - - Comment.prototype.makeReturn = THIS; - - Comment.prototype.compileNode = function(o, level) { - var code; - code = "/*" + (multident(this.comment, this.tab)) + (__indexOf.call(this.comment, '\n') >= 0 ? "\n" + this.tab : '') + "*/"; - if ((level || o.level) === LEVEL_TOP) { - code = o.indent + code; - } - return [this.makeCode("\n"), this.makeCode(code)]; - }; - - return Comment; - - })(Base); - - exports.Call = Call = (function(_super) { - __extends(Call, _super); - - function Call(variable, args, soak) { - this.args = args != null ? args : []; - this.soak = soak; - Call.__super__.constructor.call(this); - this.isNew = false; - this.isSuper = variable === 'super'; - this.variable = this.isSuper ? null : variable; - } - - Call.prototype.children = ['variable', 'args']; - - Call.prototype.newInstance = function() { - var base, _ref4; - base = ((_ref4 = this.variable) != null ? _ref4.base : void 0) || this.variable; - if (base instanceof Call && !base.isNew) { - base.newInstance(); - } else { - this.isNew = true; - } - return this; - }; - - Call.prototype.superReference = function(o) { - var accesses, method; - method = o.scope.namedMethod(); - if (method != null ? method.klass : void 0) { - accesses = [new Access(new Literal('__super__'))]; - if (method["static"]) { - accesses.push(new Access(new Literal('constructor'))); - } - accesses.push(new Access(new Literal(method.name))); - return (new Value(new Literal(method.klass), accesses)).compile(o); - } else if (method != null ? method.ctor : void 0) { - return "" + method.name + ".__super__.constructor"; - } else { - return this.error('cannot call super outside of an instance method.'); - } - }; - - Call.prototype.superThis = function(o) { - var method; - if (o.scope.icedgen) { - return "_this"; - } else { - method = o.scope.method; - return (method && !method.klass && method.context) || "this"; - } - }; - - Call.prototype.unfoldSoak = function(o) { - var call, ifn, left, list, rite, _i, _len, _ref4, _ref5; - if (this.soak) { - if (this.variable) { - if (ifn = unfoldSoak(o, this, 'variable')) { - return ifn; - } - _ref4 = new Value(this.variable).cacheReference(o), left = _ref4[0], rite = _ref4[1]; - } else { - left = new Literal(this.superReference(o)); - rite = new Value(left); - } - rite = new Call(rite, this.args); - rite.isNew = this.isNew; - left = new Literal("typeof " + (left.compile(o)) + " === \"function\""); - return new If(left, new Value(rite), { - soak: true - }); - } - call = this; - list = []; - while (true) { - if (call.variable instanceof Call) { - list.push(call); - call = call.variable; - continue; - } - if (!(call.variable instanceof Value)) { - break; - } - list.push(call); - if (!((call = call.variable.base) instanceof Call)) { - break; - } - } - _ref5 = list.reverse(); - for (_i = 0, _len = _ref5.length; _i < _len; _i++) { - call = _ref5[_i]; - if (ifn) { - if (call.variable instanceof Call) { - call.variable = ifn; - } else { - call.variable.base = ifn; - } - } - ifn = unfoldSoak(o, call, 'variable'); - } - return ifn; - }; - - Call.prototype.compileNode = function(o) { - var arg, argIndex, compiledArgs, compiledArray, fragments, preface, _i, _len, _ref4, _ref5; - if ((_ref4 = this.variable) != null) { - _ref4.front = this.front; - } - compiledArray = Splat.compileSplattedArray(o, this.args, true); - if (compiledArray.length) { - return this.compileSplat(o, compiledArray); - } - compiledArgs = []; - _ref5 = this.args; - for (argIndex = _i = 0, _len = _ref5.length; _i < _len; argIndex = ++_i) { - arg = _ref5[argIndex]; - arg.icedStatementAssertion(); - if (argIndex) { - compiledArgs.push(this.makeCode(", ")); - } - compiledArgs.push.apply(compiledArgs, arg.compileToFragments(o, LEVEL_LIST)); - } - fragments = []; - if (this.isSuper) { - preface = this.superReference(o) + (".call(" + (this.superThis(o))); - if (compiledArgs.length) { - preface += ", "; - } - fragments.push(this.makeCode(preface)); - } else { - if (this.isNew) { - fragments.push(this.makeCode('new ')); - } - fragments.push.apply(fragments, this.variable.compileToFragments(o, LEVEL_ACCESS)); - fragments.push(this.makeCode("(")); - } - fragments.push.apply(fragments, compiledArgs); - fragments.push(this.makeCode(")")); - return fragments; - }; - - Call.prototype.compileSplat = function(o, splatArgs) { - var answer, base, fun, idt, name, ref; - if (this.isSuper) { - return [].concat(this.makeCode("" + (this.superReference(o)) + ".apply(" + (this.superThis(o)) + ", "), splatArgs, this.makeCode(")")); - } - if (this.isNew) { - idt = this.tab + TAB; - return [].concat(this.makeCode("(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return Object(result) === result ? result : child;\n" + this.tab + "})("), this.variable.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), splatArgs, this.makeCode(", function(){})")); - } - answer = []; - base = new Value(this.variable); - if ((name = base.properties.pop()) && base.isComplex()) { - ref = o.scope.freeVariable('ref'); - answer = answer.concat(this.makeCode("(" + ref + " = "), base.compileToFragments(o, LEVEL_LIST), this.makeCode(")"), name.compileToFragments(o)); - } else { - fun = base.compileToFragments(o, LEVEL_ACCESS); - if (SIMPLENUM.test(fragmentsToText(fun))) { - fun = this.wrapInBraces(fun); - } - if (name) { - ref = fragmentsToText(fun); - fun.push.apply(fun, name.compileToFragments(o)); - } else { - ref = 'null'; - } - answer = answer.concat(fun); - } - return answer = answer.concat(this.makeCode(".apply(" + ref + ", "), splatArgs, this.makeCode(")")); - }; - - return Call; - - })(Base); - - exports.Extends = Extends = (function(_super) { - __extends(Extends, _super); - - function Extends(child, parent) { - this.child = child; - this.parent = parent; - Extends.__super__.constructor.call(this); - } - - Extends.prototype.children = ['child', 'parent']; - - Extends.prototype.compileToFragments = function(o) { - return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compileToFragments(o); - }; - - return Extends; - - })(Base); - - exports.Access = Access = (function(_super) { - __extends(Access, _super); - - function Access(name, tag) { - this.name = name; - Access.__super__.constructor.call(this); - this.name.asKey = true; - this.soak = tag === 'soak'; - } - - Access.prototype.children = ['name']; - - Access.prototype.compileToFragments = function(o) { - var name; - name = this.name.compileToFragments(o); - if ((IDENTIFIER.test(fragmentsToText(name))) || this.name instanceof Defer) { - name.unshift(this.makeCode(".")); - } else { - name.unshift(this.makeCode("[")); - name.push(this.makeCode("]")); - } - return name; - }; - - Access.prototype.isComplex = NO; - - return Access; - - })(Base); - - exports.Index = Index = (function(_super) { - __extends(Index, _super); - - function Index(index) { - this.index = index; - Index.__super__.constructor.call(this); - } - - Index.prototype.children = ['index']; - - Index.prototype.compileToFragments = function(o) { - return [].concat(this.makeCode("["), this.index.compileToFragments(o, LEVEL_PAREN), this.makeCode("]")); - }; - - Index.prototype.isComplex = function() { - return this.index.isComplex(); - }; - - return Index; - - })(Base); - - exports.Range = Range = (function(_super) { - __extends(Range, _super); - - Range.prototype.children = ['from', 'to']; - - function Range(from, to, tag) { - this.from = from; - this.to = to; - Range.__super__.constructor.call(this); - this.exclusive = tag === 'exclusive'; - this.equals = this.exclusive ? '' : '='; - } - - Range.prototype.compileVariables = function(o) { - var step, _ref4, _ref5, _ref6, _ref7; - o = merge(o, { - top: true - }); - _ref4 = this.cacheToCodeFragments(this.from.cache(o, LEVEL_LIST)), this.fromC = _ref4[0], this.fromVar = _ref4[1]; - _ref5 = this.cacheToCodeFragments(this.to.cache(o, LEVEL_LIST)), this.toC = _ref5[0], this.toVar = _ref5[1]; - if (step = del(o, 'step')) { - _ref6 = this.cacheToCodeFragments(step.cache(o, LEVEL_LIST)), this.step = _ref6[0], this.stepVar = _ref6[1]; - } - _ref7 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref7[0], this.toNum = _ref7[1]; - if (this.stepVar) { - return this.stepNum = this.stepVar.match(SIMPLENUM); - } - }; - - Range.prototype.compileNode = function(o) { - var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref4, _ref5; - if (!this.fromVar) { - this.compileVariables(o); - } - if (!o.index) { - return this.compileArray(o); - } - known = this.fromNum && this.toNum; - idx = del(o, 'index'); - idxName = del(o, 'name'); - namedIndex = idxName && idxName !== idx; - varPart = "" + idx + " = " + this.fromC; - if (this.toC !== this.toVar) { - varPart += ", " + this.toC; - } - if (this.step !== this.stepVar) { - varPart += ", " + this.step; - } - _ref4 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref4[0], gt = _ref4[1]; - condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref5 = [+this.fromNum, +this.toNum], from = _ref5[0], to = _ref5[1], _ref5), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = this.stepVar ? "" + this.stepVar + " > 0" : "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar); - stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? namedIndex ? from <= to ? "++" + idx : "--" + idx : from <= to ? "" + idx + "++" : "" + idx + "--" : namedIndex ? "" + cond + " ? ++" + idx + " : --" + idx : "" + cond + " ? " + idx + "++ : " + idx + "--"; - if (namedIndex) { - varPart = "" + idxName + " = " + varPart; - } - if (namedIndex) { - stepPart = "" + idxName + " = " + stepPart; - } - return [this.makeCode("" + varPart + "; " + condPart + "; " + stepPart)]; - }; - - Range.prototype.compileArray = function(o) { - var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref4, _ref5, _results; - if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) { - range = (function() { - _results = []; - for (var _i = _ref4 = +this.fromNum, _ref5 = +this.toNum; _ref4 <= _ref5 ? _i <= _ref5 : _i >= _ref5; _ref4 <= _ref5 ? _i++ : _i--){ _results.push(_i); } - return _results; - }).apply(this); - if (this.exclusive) { - range.pop(); - } - return [this.makeCode("[" + (range.join(', ')) + "]")]; - } - idt = this.tab + TAB; - i = o.scope.freeVariable('i'); - result = o.scope.freeVariable('results'); - pre = "\n" + idt + result + " = [];"; - if (this.fromNum && this.toNum) { - o.index = i; - body = fragmentsToText(this.compileNode(o)); - } else { - vars = ("" + i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : ''); - cond = "" + this.fromVar + " <= " + this.toVar; - body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--"; - } - post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent; - hasArgs = function(node) { - return node != null ? node.contains(function(n) { - return n instanceof Literal && n.value === 'arguments' && !n.asKey; - }) : void 0; - }; - if (hasArgs(this.from) || hasArgs(this.to)) { - args = ', arguments'; - } - return [this.makeCode("(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")")]; - }; - - return Range; - - })(Base); - - exports.Slice = Slice = (function(_super) { - __extends(Slice, _super); - - Slice.prototype.children = ['range']; - - function Slice(range) { - this.range = range; - Slice.__super__.constructor.call(this); - } - - Slice.prototype.compileNode = function(o) { - var compiled, compiledText, from, fromCompiled, to, toStr, _ref4; - _ref4 = this.range, to = _ref4.to, from = _ref4.from; - fromCompiled = from && from.compileToFragments(o, LEVEL_PAREN) || [this.makeCode('0')]; - if (to) { - compiled = to.compileToFragments(o, LEVEL_PAREN); - compiledText = fragmentsToText(compiled); - if (!(!this.range.exclusive && +compiledText === -1)) { - toStr = ', ' + (this.range.exclusive ? compiledText : SIMPLENUM.test(compiledText) ? "" + (+compiledText + 1) : (compiled = to.compileToFragments(o, LEVEL_ACCESS), "+" + (fragmentsToText(compiled)) + " + 1 || 9e9")); - } - } - return [this.makeCode(".slice(" + (fragmentsToText(fromCompiled)) + (toStr || '') + ")")]; - }; - - return Slice; - - })(Base); - - exports.Obj = Obj = (function(_super) { - __extends(Obj, _super); - - function Obj(props, generated) { - this.generated = generated != null ? generated : false; - this.objects = this.properties = props || []; - Obj.__super__.constructor.call(this); - } - - Obj.prototype.children = ['properties']; - - Obj.prototype.compileNode = function(o) { - var answer, i, idt, indent, join, lastNoncom, node, prop, props, _i, _j, _len, _len1; - props = this.properties; - if (!props.length) { - return [this.makeCode(this.front ? '({})' : '{}')]; - } - if (this.generated) { - for (_i = 0, _len = props.length; _i < _len; _i++) { - node = props[_i]; - if (node instanceof Value) { - node.error('cannot have an implicit value in an implicit object'); - } - } - } - idt = o.indent += TAB; - lastNoncom = this.lastNonComment(this.properties); - answer = []; - for (i = _j = 0, _len1 = props.length; _j < _len1; i = ++_j) { - prop = props[i]; - join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; - indent = prop instanceof Comment ? '' : idt; - if (prop instanceof Assign && prop.variable instanceof Value && prop.variable.hasProperties()) { - prop.variable.error('Invalid object key'); - } - if (prop instanceof Value && prop["this"]) { - prop = new Assign(prop.properties[0].name, prop, 'object'); - } - if (!(prop instanceof Comment)) { - if (!(prop instanceof Assign)) { - prop = new Assign(prop, prop, 'object'); - } - (prop.variable.base || prop.variable).asKey = true; - } - if (indent) { - answer.push(this.makeCode(indent)); - } - answer.push.apply(answer, prop.compileToFragments(o, LEVEL_TOP)); - if (join) { - answer.push(this.makeCode(join)); - } - } - answer.unshift(this.makeCode("{" + (props.length && '\n'))); - answer.push(this.makeCode("" + (props.length && '\n' + this.tab) + "}")); - if (this.front) { - return this.wrapInBraces(answer); - } else { - return answer; - } - }; - - Obj.prototype.assigns = function(name) { - var prop, _i, _len, _ref4; - _ref4 = this.properties; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - prop = _ref4[_i]; - if (prop.assigns(name)) { - return true; - } - } - return false; - }; - - Obj.prototype.icedToSlot = function(i) { - var access, prop, _i, _len, _ref4, _results; - _ref4 = this.properties; - _results = []; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - prop = _ref4[_i]; - if (prop instanceof Assign) { - _results.push((prop.value.icedToSlot(i)).addAccess(prop.variable.icedToSlotAccess())); - } else if (prop instanceof Value) { - access = prop.icedToSlotAccess(); - _results.push((prop.icedToSlot(i)).addAccess(access)); - } else { - _results.push(void 0); - } - } - return _results; - }; - - return Obj; - - })(Base); - - exports.Arr = Arr = (function(_super) { - __extends(Arr, _super); - - function Arr(objs) { - this.objects = objs || []; - Arr.__super__.constructor.call(this); - } - - Arr.prototype.children = ['objects']; - - Arr.prototype.compileNode = function(o) { - var answer, compiledObjs, fragments, index, obj, _i, _len; - if (!this.objects.length) { - return [this.makeCode('[]')]; - } - o.indent += TAB; - answer = Splat.compileSplattedArray(o, this.objects); - if (answer.length) { - return answer; - } - answer = []; - compiledObjs = (function() { - var _i, _len, _ref4, _results; - _ref4 = this.objects; - _results = []; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - obj = _ref4[_i]; - _results.push(obj.compileToFragments(o, LEVEL_LIST)); - } - return _results; - }).call(this); - for (index = _i = 0, _len = compiledObjs.length; _i < _len; index = ++_i) { - fragments = compiledObjs[index]; - if (index) { - answer.push(this.makeCode(", ")); - } - answer.push.apply(answer, fragments); - } - if (fragmentsToText(answer).indexOf('\n') >= 0) { - answer.unshift(this.makeCode("[\n" + o.indent)); - answer.push(this.makeCode("\n" + this.tab + "]")); - } else { - answer.unshift(this.makeCode("[")); - answer.push(this.makeCode("]")); - } - return answer; - }; - - Arr.prototype.assigns = function(name) { - var obj, _i, _len, _ref4; - _ref4 = this.objects; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - obj = _ref4[_i]; - if (obj.assigns(name)) { - return true; - } - } - return false; - }; - - return Arr; - - })(Base); - - exports.Class = Class = (function(_super) { - __extends(Class, _super); - - function Class(variable, parent, body) { - this.variable = variable; - this.parent = parent; - this.body = body != null ? body : new Block; - Class.__super__.constructor.call(this); - this.boundFuncs = []; - this.body.classBody = true; - } - - Class.prototype.children = ['variable', 'parent', 'body']; - - Class.prototype.determineName = function() { - var decl, tail; - if (!this.variable) { - return null; - } - decl = (tail = last(this.variable.properties)) ? tail instanceof Access && tail.name.value : this.variable.base.value; - if (__indexOf.call(STRICT_PROSCRIBED, decl) >= 0) { - this.variable.error("class variable name may not be " + decl); - } - return decl && (decl = IDENTIFIER.test(decl) && decl); - }; - - Class.prototype.setContext = function(name) { - return this.body.traverseChildren(false, function(node) { - if (node.classBody) { - return false; - } - if (node instanceof Literal && node.value === 'this') { - return node.value = name; - } else if (node instanceof Code) { - node.klass = name; - if (node.bound) { - return node.context = name; - } - } - }); - }; - - Class.prototype.addBoundFunctions = function(o) { - var bvar, lhs, _i, _len, _ref4; - _ref4 = this.boundFuncs; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - bvar = _ref4[_i]; - lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o); - this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)")); - } - }; - - Class.prototype.addProperties = function(node, name, o) { - var assign, base, exprs, func, props; - props = node.base.properties.slice(0); - exprs = (function() { - var _results; - _results = []; - while (assign = props.shift()) { - if (assign instanceof Assign) { - base = assign.variable.base; - delete assign.context; - func = assign.value; - if (base.value === 'constructor') { - if (this.ctor) { - assign.error('cannot define more than one constructor in a class'); - } - if (func.bound) { - assign.error('cannot define a constructor as a bound function'); - } - if (func instanceof Code) { - assign = this.ctor = func; - } else { - this.externalCtor = o.scope.freeVariable('class'); - assign = new Assign(new Literal(this.externalCtor), func); - } - } else { - if (assign.variable["this"]) { - func["static"] = true; - if (func.bound) { - func.context = name; - } - } else { - assign.variable = new Value(new Literal(name), [new Access(new Literal('prototype')), new Access(base)]); - if (func instanceof Code && func.bound) { - this.boundFuncs.push(base); - func.bound = false; - } - } - } - } - _results.push(assign); - } - return _results; - }).call(this); - return compact(exprs); - }; - - Class.prototype.walkBody = function(name, o) { - var _this = this; - return this.traverseChildren(false, function(child) { - var cont, exps, i, node, _i, _len, _ref4; - cont = true; - if (child instanceof Class) { - return false; - } - if (child instanceof Block) { - _ref4 = exps = child.expressions; - for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { - node = _ref4[i]; - if (node instanceof Value && node.isObject(true)) { - cont = false; - exps[i] = _this.addProperties(node, name, o); - } - } - child.expressions = exps = flatten(exps); - } - return cont && !(child instanceof Class); - }); - }; - - Class.prototype.hoistDirectivePrologue = function() { - var expressions, index, node; - index = 0; - expressions = this.body.expressions; - while ((node = expressions[index]) && node instanceof Comment || node instanceof Value && node.isString()) { - ++index; - } - return this.directives = expressions.splice(0, index); - }; - - Class.prototype.ensureConstructor = function(name, o) { - var missing, ref, superCall; - missing = !this.ctor; - this.ctor || (this.ctor = new Code); - this.ctor.ctor = this.ctor.name = name; - this.ctor.klass = null; - this.ctor.noReturn = true; - if (missing) { - if (this.parent) { - superCall = new Literal("" + name + ".__super__.constructor.apply(this, arguments)"); - } - if (this.externalCtor) { - superCall = new Literal("" + this.externalCtor + ".apply(this, arguments)"); - } - if (superCall) { - ref = new Literal(o.scope.freeVariable('ref')); - this.ctor.body.unshift(new Assign(ref, superCall)); - } - this.addBoundFunctions(o); - if (superCall) { - this.ctor.body.push(ref); - this.ctor.body.makeReturn(); - } - return this.body.expressions.unshift(this.ctor); - } else { - return this.addBoundFunctions(o); - } - }; - - Class.prototype.compileNode = function(o) { - var call, decl, klass, lname, name, params, _ref4; - decl = this.determineName(); - name = decl || '_Class'; - if (name.reserved) { - name = "_" + name; - } - lname = new Literal(name); - this.hoistDirectivePrologue(); - this.setContext(name); - this.walkBody(name, o); - this.ensureConstructor(name, o); - this.body.spaced = true; - if (!(this.ctor instanceof Code)) { - this.body.expressions.unshift(this.ctor); - } - this.body.expressions.push(lname); - (_ref4 = this.body.expressions).unshift.apply(_ref4, this.directives); - call = Closure.wrap(this.body); - if (this.parent) { - this.superClass = new Literal(o.scope.freeVariable('super', false)); - this.body.expressions.unshift(new Extends(lname, this.superClass)); - call.args.push(this.parent); - params = call.variable.params || call.variable.base.params; - params.push(new Param(this.superClass)); - } - klass = new Parens(call, true); - if (this.variable) { - klass = new Assign(this.variable, klass); - } - return klass.compileToFragments(o); - }; - - return Class; - - })(Base); - - exports.Assign = Assign = (function(_super) { - __extends(Assign, _super); - - function Assign(variable, value, context, options) { - var forbidden, name, _ref4; - this.variable = variable; - this.value = value; - this.context = context; - Assign.__super__.constructor.call(this); - this.param = options && options.param; - this.subpattern = options && options.subpattern; - forbidden = (_ref4 = (name = this.variable.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0); - if (forbidden && this.context !== 'object') { - this.variable.error("variable name may not be \"" + name + "\""); - } - this.icedlocal = options && options.icedlocal; - } - - Assign.prototype.children = ['variable', 'value']; - - Assign.prototype.isStatement = function(o) { - return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0; - }; - - Assign.prototype.assigns = function(name) { - return this[this.context === 'object' ? 'value' : 'variable'].assigns(name); - }; - - Assign.prototype.unfoldSoak = function(o) { - return unfoldSoak(o, this, 'variable'); - }; - - Assign.prototype.compileNode = function(o) { - var answer, compiledName, isValue, match, name, val, varBase, _ref4, _ref5, _ref6, _ref7; - this.value.icedStatementAssertion(); - if (isValue = this.variable instanceof Value) { - if (this.variable.isArray() || this.variable.isObject()) { - return this.compilePatternMatch(o); - } - if (this.variable.isSplice()) { - return this.compileSplice(o); - } - if ((_ref4 = this.context) === '||=' || _ref4 === '&&=' || _ref4 === '?=') { - return this.compileConditional(o); - } - } - compiledName = this.variable.compileToFragments(o, LEVEL_LIST); - name = fragmentsToText(compiledName); - if (!this.context) { - varBase = this.variable.unwrapAll(); - if (!varBase.isAssignable()) { - this.variable.error("\"" + (this.variable.compile(o)) + "\" cannot be assigned"); - } - if (!(typeof varBase.hasProperties === "function" ? varBase.hasProperties() : void 0)) { - if (this.param || this.icedlocal) { - o.scope.add(name, 'var', this.icedlocal); - } else { - o.scope.find(name); - } - } - } - if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) { - if (match[1]) { - this.value.klass = match[1]; - } - this.value.name = (_ref5 = (_ref6 = (_ref7 = match[2]) != null ? _ref7 : match[3]) != null ? _ref6 : match[4]) != null ? _ref5 : match[5]; - } - val = this.value.compileToFragments(o, LEVEL_LIST); - if (this.context === 'object') { - return compiledName.concat(this.makeCode(": "), val); - } - answer = compiledName.concat(this.makeCode(" " + (this.context || '=') + " "), val); - if (o.level <= LEVEL_LIST) { - return answer; - } else { - return this.wrapInBraces(answer); - } - }; - - Assign.prototype.compilePatternMatch = function(o) { - var acc, assigns, code, fragments, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, vvarText, _i, _len, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; - top = o.level === LEVEL_TOP; - value = this.value; - objects = this.variable.base.objects; - if (!(olen = objects.length)) { - code = value.compileToFragments(o); - if (o.level >= LEVEL_OP) { - return this.wrapInBraces(code); - } else { - return code; - } - } - isObject = this.variable.isObject(); - if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) { - if (obj instanceof Assign) { - _ref4 = obj, (_ref5 = _ref4.variable, idx = _ref5.base), obj = _ref4.value; - } else { - idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0); - } - acc = IDENTIFIER.test(idx.unwrap().value || 0); - value = new Value(value); - value.properties.push(new (acc ? Access : Index)(idx)); - if (_ref6 = obj.unwrap().value, __indexOf.call(RESERVED, _ref6) >= 0) { - obj.error("assignment to a reserved word: " + (obj.compile(o))); - } - return new Assign(obj, value, null, { - param: this.param - }).compileToFragments(o, LEVEL_TOP); - } - vvar = value.compileToFragments(o, LEVEL_LIST); - vvarText = fragmentsToText(vvar); - assigns = []; - splat = false; - if (!IDENTIFIER.test(vvarText) || this.variable.assigns(vvarText)) { - assigns.push([this.makeCode("" + (ref = o.scope.freeVariable('ref')) + " = ")].concat(__slice.call(vvar))); - vvar = [this.makeCode(ref)]; - vvarText = ref; - } - for (i = _i = 0, _len = objects.length; _i < _len; i = ++_i) { - obj = objects[i]; - idx = i; - if (isObject) { - if (obj instanceof Assign) { - _ref7 = obj, (_ref8 = _ref7.variable, idx = _ref8.base), obj = _ref7.value; - } else { - if (obj.base instanceof Parens) { - _ref9 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref9[0], idx = _ref9[1]; - } else { - idx = obj["this"] ? obj.properties[0].name : obj; - } - } - } - if (!splat && obj instanceof Splat) { - name = obj.name.unwrap().value; - obj = obj.unwrap(); - val = "" + olen + " <= " + vvarText + ".length ? " + (utility('slice')) + ".call(" + vvarText + ", " + i; - if (rest = olen - i - 1) { - ivar = o.scope.freeVariable('i'); - val += ", " + ivar + " = " + vvarText + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])"; - } else { - val += ") : []"; - } - val = new Literal(val); - splat = "" + ivar + "++"; - } else { - name = obj.unwrap().value; - if (obj instanceof Splat) { - obj.error("multiple splats are disallowed in an assignment"); - } - if (typeof idx === 'number') { - idx = new Literal(splat || idx); - acc = false; - } else { - acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0); - } - val = new Value(new Literal(vvarText), [new (acc ? Access : Index)(idx)]); - } - if ((name != null) && __indexOf.call(RESERVED, name) >= 0) { - obj.error("assignment to a reserved word: " + (obj.compile(o))); - } - assigns.push(new Assign(obj, val, null, { - param: this.param, - subpattern: true - }).compileToFragments(o, LEVEL_LIST)); - } - if (!(top || this.subpattern)) { - assigns.push(vvar); - } - fragments = this.joinFragmentArrays(assigns, ', '); - if (o.level < LEVEL_LIST) { - return fragments; - } else { - return this.wrapInBraces(fragments); - } - }; - - Assign.prototype.compileConditional = function(o) { - var left, right, _ref4; - _ref4 = this.variable.cacheReference(o), left = _ref4[0], right = _ref4[1]; - if (!left.properties.length && left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) { - this.variable.error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been declared before"); - } - if (__indexOf.call(this.context, "?") >= 0) { - o.isExistentialEquals = true; - } - return new Op(this.context.slice(0, -1), left, new Assign(right, this.value, '=')).compileToFragments(o); - }; - - Assign.prototype.compileSplice = function(o) { - var answer, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref4, _ref5, _ref6; - _ref4 = this.variable.properties.pop().range, from = _ref4.from, to = _ref4.to, exclusive = _ref4.exclusive; - name = this.variable.compile(o); - if (from) { - _ref5 = this.cacheToCodeFragments(from.cache(o, LEVEL_OP)), fromDecl = _ref5[0], fromRef = _ref5[1]; - } else { - fromDecl = fromRef = '0'; - } - if (to) { - if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) { - to = +to.compile(o) - +fromRef; - if (!exclusive) { - to += 1; - } - } else { - to = to.compile(o, LEVEL_ACCESS) + ' - ' + fromRef; - if (!exclusive) { - to += ' + 1'; - } - } - } else { - to = "9e9"; - } - _ref6 = this.value.cache(o, LEVEL_LIST), valDef = _ref6[0], valRef = _ref6[1]; - answer = [].concat(this.makeCode("[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat("), valDef, this.makeCode(")), "), valRef); - if (o.level > LEVEL_TOP) { - return this.wrapInBraces(answer); - } else { - return answer; - } - }; - - return Assign; - - })(Base); - - exports.Code = Code = (function(_super) { - __extends(Code, _super); - - function Code(params, body, tag) { - Code.__super__.constructor.call(this); - this.params = params || []; - this.body = body || new Block; - this.icedgen = tag === 'icedgen'; - this.bound = tag === 'boundfunc' || this.icedgen; - if (this.bound || this.icedgen) { - this.context = '_this'; - } - this.icedPassedDeferral = null; - } - - Code.prototype.children = ['params', 'body']; - - Code.prototype.isStatement = function() { - return !!this.ctor; - }; - - Code.prototype.jumps = NO; - - Code.prototype.compileNode = function(o) { - var answer, code, exprs, i, idt, lit, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref4, _ref5, _ref6, _ref7, _ref8; - o.scope = new Scope(o.scope, this.body, this); - o.scope.shared = del(o, 'sharedScope') || this.icedgen; - o.scope.icedgen = this.icedgen; - o.indent += TAB; - delete o.bare; - delete o.isExistentialEquals; - params = []; - exprs = []; - this.eachParamName(function(name) { - if (!o.scope.check(name)) { - return o.scope.parameter(name); - } - }); - _ref4 = this.params; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - param = _ref4[_i]; - if (!param.splat) { - continue; - } - _ref5 = this.params; - for (_j = 0, _len1 = _ref5.length; _j < _len1; _j++) { - p = _ref5[_j].name; - if (p["this"]) { - p = p.properties[0].name; - } - if (p.value) { - o.scope.add(p.value, 'var', true); - } - } - splats = new Assign(new Value(new Arr((function() { - var _k, _len2, _ref6, _results; - _ref6 = this.params; - _results = []; - for (_k = 0, _len2 = _ref6.length; _k < _len2; _k++) { - p = _ref6[_k]; - _results.push(p.asReference(o)); - } - return _results; - }).call(this))), new Value(new Literal('arguments'))); - break; - } - _ref6 = this.params; - for (_k = 0, _len2 = _ref6.length; _k < _len2; _k++) { - param = _ref6[_k]; - if (param.isComplex()) { - val = ref = param.asReference(o); - if (param.value) { - val = new Op('?', ref, param.value); - } - exprs.push(new Assign(new Value(param.name), val, '=', { - param: true - })); - } else { - ref = param; - if (param.value) { - lit = new Literal(ref.name.value + ' == null'); - val = new Assign(new Value(param.name), param.value, '='); - exprs.push(new If(lit, val)); - } - } - if (!splats) { - params.push(ref); - } - } - wasEmpty = this.body.isEmpty(); - if (splats) { - exprs.unshift(splats); - } - if (exprs.length) { - (_ref7 = this.body.expressions).unshift.apply(_ref7, exprs); - } - for (i = _l = 0, _len3 = params.length; _l < _len3; i = ++_l) { - p = params[i]; - params[i] = p.compileToFragments(o); - o.scope.parameter(fragmentsToText(params[i])); - } - uniqs = []; - this.eachParamName(function(name, node) { - if (__indexOf.call(uniqs, name) >= 0) { - node.error("multiple parameters named '" + name + "'"); - } - return uniqs.push(name); - }); - if (this.icedHasAutocbFlag) { - wasEmpty = false; - } - if (!(wasEmpty || this.noReturn)) { - this.body.makeReturn(); - } - if (this.bound) { - if ((_ref8 = o.scope.parent.method) != null ? _ref8.bound : void 0) { - this.bound = this.context = o.scope.parent.method.context; - } else if (!this["static"]) { - o.scope.parent.assign('_this', 'this'); - } - } - idt = o.indent; - code = 'function'; - if (this.ctor) { - code += ' ' + this.name; - } - code += '('; - answer = [this.makeCode(code)]; - for (i = _m = 0, _len4 = params.length; _m < _len4; i = ++_m) { - p = params[i]; - if (i) { - answer.push(this.makeCode(", ")); - } - answer.push.apply(answer, p); - } - answer.push(this.makeCode(') {')); - this.icedPatchBody(o); - if (!this.body.isEmpty()) { - answer = answer.concat(this.makeCode("\n"), this.body.compileWithDeclarations(o), this.makeCode("\n" + this.tab)); - } - answer.push(this.makeCode('}')); - if (this.ctor) { - return [this.makeCode(this.tab)].concat(__slice.call(answer)); - } - if (this.front || (o.level >= LEVEL_ACCESS)) { - return this.wrapInBraces(answer); - } else { - return answer; - } - }; - - Code.prototype.eachParamName = function(iterator) { - var param, _i, _len, _ref4, _results; - _ref4 = this.params; - _results = []; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - param = _ref4[_i]; - _results.push(param.eachName(iterator)); - } - return _results; - }; - - Code.prototype.traverseChildren = function(crossScope, func) { - if (crossScope) { - return Code.__super__.traverseChildren.call(this, crossScope, func); - } - }; - - Code.prototype.icedPatchBody = function(o) { - var f, lhs, r, rhs; - if (this.icedFoundArguments && this.icedNodeFlag) { - o.scope.assign('_arguments', 'arguments'); - } - if (this.icedNodeFlag && !this.icedgen) { - this.icedPassedDeferral = o.scope.freeVariable(iced["const"].passed_deferral); - lhs = new Value(new Literal(this.icedPassedDeferral)); - f = new Value(new Literal(iced["const"].ns)); - f.add(new Access(new Value(new Literal(iced["const"].findDeferral)))); - rhs = new Call(f, [new Value(new Literal('arguments'))]); - this.body.unshift(new Assign(lhs, rhs)); - } - if (this.icedNodeFlag && !this.icedgen) { - r = this.icedHasAutocbFlag ? iced["const"].autocb : iced["const"].k_noop; - rhs = new Value(new Literal(r)); - lhs = new Value(new Literal(iced["const"].k)); - return this.body.unshift(new Assign(lhs, rhs, null, { - icedlocal: true - })); - } - }; - - Code.prototype.icedWalkAst = function(parent, o) { - var cf_prev, fa_prev, faf_prev, fg_prev, param, _i, _len, _ref4; - this.icedParentAwait = parent; - fa_prev = o.foundAutocb; - cf_prev = o.currFunc; - fg_prev = o.foundArguments; - faf_prev = o.foundAwaitFunc; - o.foundAutocb = false; - o.foundArguments = false; - o.foundAwaitFunc = false; - o.currFunc = this; - _ref4 = this.params; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - param = _ref4[_i]; - if (param.name instanceof Literal && param.name.value === iced["const"].autocb) { - o.foundAutocb = true; - break; - } - } - this.icedHasAutocbFlag = o.foundAutocb; - Code.__super__.icedWalkAst.call(this, parent, o); - this.icedFoundArguments = o.foundArguments; - o.foundAwaitFunc = faf_prev; - o.foundArguments = fg_prev; - o.foundAutocb = fa_prev; - o.currFunc = cf_prev; - return false; - }; - - Code.prototype.icedWalkAstLoops = function(flood) { - if (Code.__super__.icedWalkAstLoops.call(this, false)) { - this.icedLoopFlag = true; - } - return false; - }; - - Code.prototype.icedWalkCpsPivots = function() { - Code.__super__.icedWalkCpsPivots.call(this); - return this.icedCpsPivotFlag = false; - }; - - Code.prototype.icedTraceName = function() { - var parts; - parts = []; - if (this.klass) { - parts.push(this.klass); - } - if (this.name) { - parts.push(this.name); - } - return parts.join('.'); - }; - - return Code; - - })(Base); - - exports.Param = Param = (function(_super) { - __extends(Param, _super); - - function Param(name, value, splat) { - var _ref4; - this.name = name; - this.value = value; - this.splat = splat; - Param.__super__.constructor.call(this); - if (_ref4 = (name = this.name.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0) { - this.name.error("parameter name \"" + name + "\" is not allowed"); - } - } - - Param.prototype.children = ['name', 'value']; - - Param.prototype.compileToFragments = function(o) { - return this.name.compileToFragments(o, LEVEL_LIST); - }; - - Param.prototype.asReference = function(o) { - var node; - if (this.reference) { - return this.reference; - } - node = this.name; - if (node["this"]) { - node = node.properties[0].name; - if (node.value.reserved) { - node = new Literal(o.scope.freeVariable(node.value)); - } - } else if (node.isComplex()) { - node = new Literal(o.scope.freeVariable('arg')); - } - node = new Value(node); - if (this.splat) { - node = new Splat(node); - } - return this.reference = node; - }; - - Param.prototype.isComplex = function() { - return this.name.isComplex(); - }; - - Param.prototype.eachName = function(iterator, name) { - var atParam, node, obj, _i, _len, _ref4; - if (name == null) { - name = this.name; - } - atParam = function(obj) { - var node; - node = obj.properties[0].name; - if (!node.value.reserved) { - return iterator(node.value, node); - } - }; - if (name instanceof Literal) { - return iterator(name.value, name); - } - if (name instanceof Value) { - return atParam(name); - } - _ref4 = name.objects; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - obj = _ref4[_i]; - if (obj instanceof Assign) { - this.eachName(iterator, obj.value.unwrap()); - } else if (obj instanceof Splat) { - node = obj.name.unwrap(); - iterator(node.value, node); - } else if (obj instanceof Value) { - if (obj.isArray() || obj.isObject()) { - this.eachName(iterator, obj.base); - } else if (obj["this"]) { - atParam(obj); - } else { - iterator(obj.base.value, obj.base); - } - } else { - obj.error("illegal parameter " + (obj.compile())); - } - } - }; - - return Param; - - })(Base); - - exports.Splat = Splat = (function(_super) { - __extends(Splat, _super); - - Splat.prototype.children = ['name']; - - Splat.prototype.isAssignable = YES; - - function Splat(name) { - Splat.__super__.constructor.call(this); - this.name = name.compile ? name : new Literal(name); - } - - Splat.prototype.assigns = function(name) { - return this.name.assigns(name); - }; - - Splat.prototype.compileToFragments = function(o) { - return this.name.compileToFragments(o); - }; - - Splat.prototype.unwrap = function() { - return this.name; - }; - - Splat.compileSplattedArray = function(o, list, apply) { - var args, base, compiledNode, concatPart, fragments, i, index, node, _i, _len; - index = -1; - while ((node = list[++index]) && !(node instanceof Splat)) { - continue; - } - if (index >= list.length) { - return []; - } - if (list.length === 1) { - node = list[0]; - fragments = node.compileToFragments(o, LEVEL_LIST); - if (apply) { - return fragments; - } - return [].concat(node.makeCode("" + (utility('slice')) + ".call("), fragments, node.makeCode(")")); - } - args = list.slice(index); - for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { - node = args[i]; - compiledNode = node.compileToFragments(o, LEVEL_LIST); - args[i] = node instanceof Splat ? [].concat(node.makeCode("" + (utility('slice')) + ".call("), compiledNode, node.makeCode(")")) : [].concat(node.makeCode("["), compiledNode, node.makeCode("]")); - } - if (index === 0) { - node = list[0]; - concatPart = node.joinFragmentArrays(args.slice(1), ', '); - return args[0].concat(node.makeCode(".concat("), concatPart, node.makeCode(")")); - } - base = (function() { - var _j, _len1, _ref4, _results; - _ref4 = list.slice(0, index); - _results = []; - for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) { - node = _ref4[_j]; - _results.push(node.compileToFragments(o, LEVEL_LIST)); - } - return _results; - })(); - base = list[0].joinFragmentArrays(base, ', '); - concatPart = list[index].joinFragmentArrays(args, ', '); - return [].concat(list[0].makeCode("["), base, list[index].makeCode("].concat("), concatPart, (last(list)).makeCode(")")); - }; - - Splat.prototype.icedToSlot = function(i) { - return new Slot(i, new Value(this.name), null, true); - }; - - return Splat; - - })(Base); - - exports.While = While = (function(_super) { - __extends(While, _super); - - function While(condition, options) { - this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition; - this.guard = options != null ? options.guard : void 0; - } - - While.prototype.children = ['condition', 'guard', 'body']; - - While.prototype.isStatement = YES; - - While.prototype.isLoop = YES; - - While.prototype.makeReturn = function(res) { - if (res) { - return While.__super__.makeReturn.apply(this, arguments); - } else { - this.returns = !this.jumps({ - loop: true - }); - return this; - } - }; - - While.prototype.addBody = function(body) { - this.body = body; - return this; - }; - - While.prototype.jumps = function() { - var expressions, node, _i, _len; - expressions = this.body.expressions; - if (!expressions.length) { - return false; - } - for (_i = 0, _len = expressions.length; _i < _len; _i++) { - node = expressions[_i]; - if (node.jumps({ - loop: true - })) { - return node; - } - } - return false; - }; - - While.prototype.compileNode = function(o) { - var answer, body, rvar, set; - this.condition.icedStatementAssertion(); - if (this.icedNodeFlag) { - return this.icedCompileIced(o); - } - o.indent += TAB; - set = ''; - body = this.body; - if (body.isEmpty()) { - body = this.makeCode(''); - } else { - if (this.returns) { - body.makeReturn(rvar = o.scope.freeVariable('results')); - set = "" + this.tab + rvar + " = [];\n"; - } - if (this.guard) { - if (body.expressions.length > 1) { - body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); - } else { - if (this.guard) { - body = Block.wrap([new If(this.guard, body)]); - } - } - } - body = [].concat(this.makeCode("\n"), body.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab)); - } - answer = [].concat(this.makeCode(set + this.tab + "while ("), this.condition.compileToFragments(o, LEVEL_PAREN), this.makeCode(") {"), body, this.makeCode("}")); - if (this.returns) { - if (this.icedHasAutocbFlag) { - answer.push(this.makeCode("\n" + this.tab + iced["const"].autocb + "(" + rvar + ");")); - answer.push(this.makeCode("\n" + this.tab + "return;")); - } else { - answer.push(this.makeCode("\n" + this.tab + "return " + rvar + ";")); - } - } - return answer; - }; - - While.prototype.icedWrap = function(d) { - var body, break_assign, break_block, break_body, break_expr, break_id, call1, call2, cond, condition, continue_assign, continue_block, continue_block_inner, continue_body, continue_fn, continue_id, f, guard_if, k_id, k_param, next_arg, next_assign, next_block, next_body, next_id, outStatements, rvar, rvar_init, rvar_value, top_assign, top_block, top_body, top_call, top_func, top_id, top_statements, tramp; - condition = d.condition; - body = d.body; - rvar = d.rvar; - outStatements = []; - if (rvar) { - rvar_value = new Value(new Literal(rvar)); - } - top_id = new Value(new Literal(iced["const"].t_while)); - k_id = new Value(new Literal(iced["const"].k)); - k_param = new Param(new Literal(iced["const"].k)); - break_id = new Value(new Literal(iced["const"].b_while)); - if (rvar) { - break_expr = new Call(k_id, [rvar_value]); - break_block = new Block([break_expr]); - break_body = new Code([], break_block, 'icedgen'); - break_assign = new Assign(break_id, break_body, null, { - icedlocal: true - }); - } else { - break_assign = new Assign(break_id, k_id, null, { - icedlocal: true - }); - } - continue_id = new Value(new Literal(iced["const"].c_while)); - continue_block_inner = new Block([new Call(top_id, [k_id])]); - if (d.step) { - continue_block_inner.unshift(d.step); - } - continue_fn = new Code([], continue_block_inner); - tramp = new Value(new Literal(iced["const"].ns)); - tramp.add(new Access(new Value(new Literal(iced["const"].trampoline)))); - continue_block = new Block([new Call(tramp, [continue_fn])]); - continue_body = new Code([], continue_block, 'icedgen'); - continue_assign = new Assign(continue_id, continue_body, null, { - icedlocal: true - }); - next_id = new Value(new Literal(iced["const"].n_while)); - if (rvar) { - next_arg = new Param(new Literal(iced["const"].n_arg)); - f = rvar_value.copy(); - f.add(new Access(new Value(new Literal('push')))); - call1 = new Call(f, [next_arg]); - call2 = new Call(continue_id, []); - next_block = new Block([call1, call2]); - next_body = new Code([next_arg], next_block, 'icedgen'); - next_assign = new Assign(next_id, next_body, null, { - icedlocal: true - }); - } else { - next_assign = new Assign(next_id, continue_id); - } - cond = new If(condition.invert(), new Block([new Call(break_id, [])])); - if (d.guard) { - continue_block = new Block([new Call(continue_id, [])]); - guard_if = new If(d.guard, body); - guard_if.addElse(continue_block); - cond.addElse(new Block([d.pre_body, guard_if])); - } else { - cond.addElse(new Block([d.pre_body, body])); - } - top_body = new Block([break_assign, continue_assign, next_assign, cond]); - top_func = new Code([k_param], top_body, 'icedgen'); - top_assign = new Assign(top_id, top_func, null, { - icedlocal: true - }); - top_call = new Call(top_id, [k_id]); - top_statements = []; - if (d.init) { - top_statements = top_statements.concat(d.init); - } - if (rvar) { - rvar_init = new Assign(rvar_value, new Arr); - top_statements.push(rvar_init); - } - top_statements = top_statements.concat([top_assign, top_call]); - return top_block = new Block(top_statements); - }; - - While.prototype.icedCallContinuation = function() { - return this.body.icedThreadReturn(new IcedTailCall(iced["const"].n_while)); - }; - - While.prototype.icedCompileIced = function(o) { - var b, opts; - opts = { - condition: this.condition, - body: this.body, - guard: this.guard - }; - if (this.returns) { - opts.rvar = o.scope.freeVariable('results'); - } - b = this.icedWrap(opts); - return b.compileNode(o); - }; - - return While; - - })(Base); - - exports.Op = Op = (function(_super) { - var CONVERSIONS, INVERSIONS; - - __extends(Op, _super); - - function Op(op, first, second, flip) { - Op.__super__.constructor.call(this); - if (op === 'in') { - return new In(first, second); - } - if (op === 'do') { - return this.generateDo(first); - } - if (op === 'new') { - if (first instanceof Call && !first["do"] && !first.isNew) { - return first.newInstance(); - } - if (first instanceof Code && first.bound || first["do"]) { - first = new Parens(first); - } - } - this.operator = CONVERSIONS[op] || op; - this.first = first; - this.second = second; - this.flip = !!flip; - return this; - } - - CONVERSIONS = { - '==': '===', - '!=': '!==', - 'of': 'in' - }; - - INVERSIONS = { - '!==': '===', - '===': '!==' - }; - - Op.prototype.children = ['first', 'second']; - - Op.prototype.isSimpleNumber = NO; - - Op.prototype.isUnary = function() { - return !this.second; - }; - - Op.prototype.isComplex = function() { - var _ref4; - return !(this.isUnary() && ((_ref4 = this.operator) === '+' || _ref4 === '-')) || this.first.isComplex(); - }; - - Op.prototype.isChainable = function() { - var _ref4; - return (_ref4 = this.operator) === '<' || _ref4 === '>' || _ref4 === '>=' || _ref4 === '<=' || _ref4 === '===' || _ref4 === '!=='; - }; - - Op.prototype.invert = function() { - var allInvertable, curr, fst, op, _ref4; - if (this.isChainable() && this.first.isChainable()) { - allInvertable = true; - curr = this; - while (curr && curr.operator) { - allInvertable && (allInvertable = curr.operator in INVERSIONS); - curr = curr.first; - } - if (!allInvertable) { - return new Parens(this).invert(); - } - curr = this; - while (curr && curr.operator) { - curr.invert = !curr.invert; - curr.operator = INVERSIONS[curr.operator]; - curr = curr.first; - } - return this; - } else if (op = INVERSIONS[this.operator]) { - this.operator = op; - if (this.first.unwrap() instanceof Op) { - this.first.invert(); - } - return this; - } else if (this.second) { - return new Parens(this).invert(); - } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref4 = fst.operator) === '!' || _ref4 === 'in' || _ref4 === 'instanceof')) { - return fst; - } else { - return new Op('!', this); - } - }; - - Op.prototype.unfoldSoak = function(o) { - var _ref4; - return ((_ref4 = this.operator) === '++' || _ref4 === '--' || _ref4 === 'delete') && unfoldSoak(o, this, 'first'); - }; - - Op.prototype.generateDo = function(exp) { - var call, func, param, passedParams, ref, _i, _len, _ref4; - passedParams = []; - func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp; - _ref4 = func.params || []; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - param = _ref4[_i]; - if (param.value) { - passedParams.push(param.value); - delete param.value; - } else { - passedParams.push(param); - } - } - call = new Call(exp, passedParams); - call["do"] = true; - return call; - }; - - Op.prototype.compileNode = function(o) { - var answer, isChain, _ref4, _ref5; - isChain = this.isChainable() && this.first.isChainable(); - if (!isChain) { - this.first.front = this.front; - } - if (this.operator === 'delete' && o.scope.check(this.first.unwrapAll().value)) { - this.error('delete operand may not be argument or var'); - } - if (((_ref4 = this.operator) === '--' || _ref4 === '++') && (_ref5 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref5) >= 0)) { - this.error("cannot increment/decrement \"" + (this.first.unwrapAll().value) + "\""); - } - if (this.isUnary()) { - return this.compileUnary(o); - } - if (isChain) { - return this.compileChain(o); - } - if (this.operator === '?') { - return this.compileExistence(o); - } - answer = [].concat(this.first.compileToFragments(o, LEVEL_OP), this.makeCode(' ' + this.operator + ' '), this.second.compileToFragments(o, LEVEL_OP)); - if (o.level <= LEVEL_OP) { - return answer; - } else { - return this.wrapInBraces(answer); - } - }; - - Op.prototype.compileChain = function(o) { - var fragments, fst, shared, _ref4; - _ref4 = this.first.second.cache(o), this.first.second = _ref4[0], shared = _ref4[1]; - fst = this.first.compileToFragments(o, LEVEL_OP); - fragments = fst.concat(this.makeCode(" " + (this.invert ? '&&' : '||') + " "), shared.compileToFragments(o), this.makeCode(" " + this.operator + " "), this.second.compileToFragments(o, LEVEL_OP)); - return this.wrapInBraces(fragments); - }; - - Op.prototype.compileExistence = function(o) { - var fst, ref; - if (!o.isExistentialEquals && this.first.isComplex()) { - ref = new Literal(o.scope.freeVariable('ref')); - fst = new Parens(new Assign(ref, this.first)); - } else { - fst = this.first; - ref = fst; - } - return new If(new Existence(fst), ref, { - type: 'if' - }).addElse(this.second).compileToFragments(o); - }; - - Op.prototype.compileUnary = function(o) { - var op, parts, plusMinus; - parts = []; - op = this.operator; - parts.push([this.makeCode(op)]); - if (op === '!' && this.first instanceof Existence) { - this.first.negated = !this.first.negated; - return this.first.compileToFragments(o); - } - if (o.level >= LEVEL_ACCESS) { - return (new Parens(this)).compileToFragments(o); - } - plusMinus = op === '+' || op === '-'; - if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) { - parts.push([this.makeCode(' ')]); - } - if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) { - this.first = new Parens(this.first); - } - parts.push(this.first.compileToFragments(o, LEVEL_OP)); - if (this.flip) { - parts.reverse(); - } - return this.joinFragmentArrays(parts, ''); - }; - - Op.prototype.toString = function(idt) { - return Op.__super__.toString.call(this, idt, this.constructor.name + ' ' + this.operator); - }; - - Op.prototype.icedWrapContinuation = function() { - return this.icedCallContinuationFlag; - }; - - return Op; - - })(Base); - - exports.In = In = (function(_super) { - __extends(In, _super); - - function In(object, array) { - this.object = object; - this.array = array; - In.__super__.constructor.call(this); - } - - In.prototype.children = ['object', 'array']; - - In.prototype.invert = NEGATE; - - In.prototype.compileNode = function(o) { - var hasSplat, obj, _i, _len, _ref4; - if (this.array instanceof Value && this.array.isArray()) { - _ref4 = this.array.base.objects; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - obj = _ref4[_i]; - if (!(obj instanceof Splat)) { - continue; - } - hasSplat = true; - break; - } - if (!hasSplat) { - return this.compileOrTest(o); - } - } - return this.compileLoopTest(o); - }; - - In.prototype.compileOrTest = function(o) { - var cmp, cnj, i, item, ref, sub, tests, _i, _len, _ref4, _ref5, _ref6; - if (this.array.base.objects.length === 0) { - return [this.makeCode("" + (!!this.negated))]; - } - _ref4 = this.object.cache(o, LEVEL_OP), sub = _ref4[0], ref = _ref4[1]; - _ref5 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref5[0], cnj = _ref5[1]; - tests = []; - _ref6 = this.array.base.objects; - for (i = _i = 0, _len = _ref6.length; _i < _len; i = ++_i) { - item = _ref6[i]; - if (i) { - tests.push(this.makeCode(cnj)); - } - tests = tests.concat((i ? ref : sub), this.makeCode(cmp), item.compileToFragments(o, LEVEL_ACCESS)); - } - if (o.level < LEVEL_OP) { - return tests; - } else { - return this.wrapInBraces(tests); - } - }; - - In.prototype.compileLoopTest = function(o) { - var fragments, ref, sub, _ref4; - _ref4 = this.object.cache(o, LEVEL_LIST), sub = _ref4[0], ref = _ref4[1]; - fragments = [].concat(this.makeCode(utility('indexOf') + ".call("), this.array.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), ref, this.makeCode(") " + (this.negated ? '< 0' : '>= 0'))); - if (fragmentsToText(sub) === fragmentsToText(ref)) { - return fragments; - } - fragments = sub.concat(this.makeCode(', '), fragments); - if (o.level < LEVEL_LIST) { - return fragments; - } else { - return this.wrapInBraces(fragments); - } - }; - - In.prototype.toString = function(idt) { - return In.__super__.toString.call(this, idt, this.constructor.name + (this.negated ? '!' : '')); - }; - - return In; - - })(Base); - - exports.Slot = Slot = (function(_super) { - __extends(Slot, _super); - - function Slot(index, value, suffix, splat) { - Slot.__super__.constructor.call(this); - this.index = index; - this.value = value; - this.suffix = suffix; - this.splat = splat; - this.access = null; - } - - Slot.prototype.addAccess = function(a) { - this.access = a; - return this; - }; - - Slot.prototype.children = ['value', 'suffix']; - - return Slot; - - })(Base); - - exports.Defer = Defer = (function(_super) { - __extends(Defer, _super); - - function Defer(args, lineno) { - var a, i; - this.lineno = lineno; - Defer.__super__.constructor.call(this); - this.slots = flatten((function() { - var _i, _len, _results; - _results = []; - for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { - a = args[i]; - _results.push(a.icedToSlot(i)); - } - return _results; - })()); - this.params = []; - this.vars = []; - this.custom = false; - } - - Defer.prototype.children = ['slots']; - - Defer.prototype.setCustom = function() { - this.custom = true; - return this; - }; - - Defer.prototype.newParam = function() { - var l; - l = "" + iced["const"].slot + "_" + (this.params.length + 1); - this.params.push(new Param(new Literal(l))); - return new Value(new Literal(l)); - }; - - Defer.prototype.makeAssignFn = function(o) { - var a, args, assign, assignments, block, call, func, i, i_lit, inner_fn, lit, outer_block, outer_fn, prop, s, slot, _i, _len, _ref4; - if (this.slots.length === 0) { - return null; - } - assignments = []; - args = []; - i = 0; - _ref4 = this.slots; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - s = _ref4[_i]; - i = s.index; - a = new Value(new Literal("arguments")); - i_lit = new Value(new Literal(i)); - if (s.splat) { - func = new Value(new Literal(utility('slice'))); - func.add(new Access(new Value(new Literal('call')))); - call = new Call(func, [a, i_lit]); - slot = s.value; - this.vars.push(slot); - assign = new Assign(slot, call); - } else { - a.add(new Index(i_lit)); - if (s.access) { - a.add(s.access); - } - if (!s.suffix) { - lit = s.value.compile(o, LEVEL_TOP); - if (lit === "_") { - slot = new Value(new Literal(iced["const"].deferrals)); - slot.add(new Access(new Value(new Literal(iced["const"].retslot)))); - } else { - slot = s.value; - this.vars.push(slot); - } - } else { - args.push(s.value); - slot = this.newParam(); - if (s.suffix instanceof Index) { - prop = new Index(this.newParam()); - args.push(s.suffix.index); - } else { - prop = s.suffix; - } - slot.add(prop); - } - assign = new Assign(slot, a); - } - assignments.push(assign); - } - block = new Block(assignments); - inner_fn = new Code([], block, 'icedgen'); - outer_block = new Block([new Return(inner_fn)]); - outer_fn = new Code(this.params, outer_block, 'icedgen'); - return call = new Call(outer_fn, args); - }; - - Defer.prototype.transform = function(o) { - var assign_fn, assignments, context_assign, context_lhs, context_rhs, fn, ln_assign, ln_lhs, ln_rhs, meth; - meth = new Value(new Literal(iced["const"].defer_method)); - if (this.custom) { - fn = meth; - } else { - fn = new Value(new Literal(iced["const"].deferrals)); - fn.add(new Access(meth)); - } - assignments = []; - if ((assign_fn = this.makeAssignFn(o))) { - assignments.push(new Assign(new Value(new Literal(iced["const"].assign_fn)), assign_fn, "object")); - } - ln_lhs = new Value(new Literal(iced["const"].lineno)); - ln_rhs = new Value(new Literal(this.lineno)); - ln_assign = new Assign(ln_lhs, ln_rhs, "object"); - assignments.push(ln_assign); - if (this.custom) { - context_lhs = new Value(new Literal(iced["const"].context)); - context_rhs = new Value(new Literal(iced["const"].deferrals)); - context_assign = new Assign(context_lhs, context_rhs, "object"); - assignments.push(context_assign); - } - o = new Obj(assignments); - return new Call(fn, [new Value(o)]); - }; - - Defer.prototype.compileNode = function(o) { - var call, name, scope, v, _i, _len, _ref4; - call = this.transform(o); - _ref4 = this.vars; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - v = _ref4[_i]; - name = v.compile(o, LEVEL_LIST); - scope = o.scope; - scope.add(name, 'var'); - } - return call.compileNode(o); - }; - - Defer.prototype.icedWalkAst = function(p, o) { - this.icedHasAutocbFlag = o.foundAutocb; - o.foundDefer = true; - this.parentFunc = o.currFunc; - return Defer.__super__.icedWalkAst.call(this, p, o); - }; - - return Defer; - - })(Base); - - exports.Await = Await = (function(_super) { - __extends(Await, _super); - - function Await(body) { - this.body = body; - Await.__super__.constructor.call(this); - } - - Await.prototype.transform = function(o) { - var assign, assignments, body, call, cb_assignment, cb_lhs, cb_rhs, cls, fn_assignment, fn_lhs, fn_rhs, func_assignment, func_lhs, func_rhs, lhs, meth, n, name, rhs, trace, _ref4, _ref5; - body = this.body; - name = iced["const"].deferrals; - o.scope.add(name, 'var'); - lhs = new Value(new Literal(name)); - cls = new Value(new Literal(iced["const"].ns)); - cls.add(new Access(new Value(new Literal(iced["const"].Deferrals)))); - assignments = []; - if (n = (_ref4 = this.parentFunc) != null ? _ref4.icedPassedDeferral : void 0) { - cb_lhs = new Value(new Literal(iced["const"].parent)); - cb_rhs = new Value(new Literal(n)); - cb_assignment = new Assign(cb_lhs, cb_rhs, "object"); - assignments.push(cb_assignment); - } - if (o.filename != null) { - fn_lhs = new Value(new Literal(iced["const"].filename)); - fn_rhs = new Value(new Literal('"' + o.filename.replace('\\', '\\\\') + '"')); - fn_assignment = new Assign(fn_lhs, fn_rhs, "object"); - assignments.push(fn_assignment); - } - if (n = (_ref5 = this.parentFunc) != null ? _ref5.icedTraceName() : void 0) { - func_lhs = new Value(new Literal(iced["const"].funcname)); - func_rhs = new Value(new Literal('"' + n + '"')); - func_assignment = new Assign(func_lhs, func_rhs, "object"); - assignments.push(func_assignment); - } - trace = new Obj(assignments, true); - call = new Call(cls, [new Value(new Literal(iced["const"].k)), trace]); - rhs = new Op("new", call); - assign = new Assign(lhs, rhs); - body.unshift(assign); - meth = lhs.copy().add(new Access(new Value(new Literal(iced["const"].fulfill)))); - call = new Call(meth, []); - body.push(call); - return this.body = body; - }; - - Await.prototype.children = ['body']; - - Await.prototype.isStatement = function() { - return YES; - }; - - Await.prototype.makeReturn = THIS; - - Await.prototype.compileNode = function(o) { - this.transform(o); - return this.body.compileNode(o); - }; - - Await.prototype.icedWalkAst = function(p, o) { - this.icedHasAutocbFlag = o.foundAutocb; - this.parentFunc = o.currFunc; - p = p || this; - this.icedParentAwait = p; - Await.__super__.icedWalkAst.call(this, p, o); - return this.icedNodeFlag = o.foundAwaitFunc = o.foundAwait = true; - }; - - return Await; - - })(Base); - - IcedRuntime = (function(_super) { - __extends(IcedRuntime, _super); - - function IcedRuntime(foundDefer, foundAwait) { - this.foundDefer = foundDefer; - this.foundAwait = foundAwait; - IcedRuntime.__super__.constructor.call(this); - } - - IcedRuntime.prototype.compileNode = function(o, level) { - var access, accessname, assign, call, callv, file, inc, k, klass, lhs_vec, modname, ns, req, rhs, v, val, window_mode, window_val, _i, _j, _len, _len1, _ref4; - this.expressions = []; - v = o.runtime ? o.runtime : o.bare ? "none" : this.foundDefer ? "node" : "none"; - if (o.runtime && !this.foundDefer && !o.runforce) { - v = "none"; - } - window_mode = false; - window_val = null; - inc = null; - inc = (function() { - switch (v) { - case "inline": - case "window": - if (v === "window") { - window_mode = true; - } - if (window_mode) { - window_val = new Value(new Literal(v)); - } - return InlineRuntime.generate(window_val ? window_val.copy() : null); - case "node": - case "browserify": - if (v === "browserify") { - modname = "iced-coffee-script/lib/coffee-script/iced"; - accessname = iced["const"].runtime; - } else { - modname = "iced-coffee-script"; - accessname = iced["const"].ns; - } - file = new Literal("'" + modname + "'"); - access = new Access(new Literal(accessname)); - req = new Value(new Literal("require")); - call = new Call(req, [file]); - callv = new Value(call); - callv.add(access); - ns = new Value(new Literal(iced["const"].ns)); - return new Assign(ns, callv); - case "none": - return null; - default: - throw SyntaxError("unexpected flag IcedRuntime " + v); - } - })(); - if (inc) { - this.push(inc); - } - if (this.foundAwait) { - rhs = new Code([], new Block([])); - lhs_vec = []; - _ref4 = [iced["const"].k_noop, iced["const"].k]; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - k = _ref4[_i]; - val = new Value(new Literal(k)); - if (window_val) { - klass = window_val.copy(); - klass.add(new Access(val)); - val = klass; - } - lhs_vec.push(val); - } - assign = rhs; - for (_j = 0, _len1 = lhs_vec.length; _j < _len1; _j++) { - v = lhs_vec[_j]; - assign = new Assign(v, assign); - } - this.push(assign); - } - if (this.isEmpty()) { - return []; - } else { - return IcedRuntime.__super__.compileNode.call(this, o); - } - }; - - IcedRuntime.prototype.icedWalkAst = function(p, o) { - this.icedHasAutocbFlag = o.foundAutocb; - return IcedRuntime.__super__.icedWalkAst.call(this, p, o); - }; - - return IcedRuntime; - - })(Block); - - exports.Try = Try = (function(_super) { - __extends(Try, _super); - - function Try(attempt, errorVariable, recovery, ensure) { - this.attempt = attempt; - this.errorVariable = errorVariable; - this.recovery = recovery; - this.ensure = ensure; - } - - Try.prototype.children = ['attempt', 'recovery', 'ensure']; - - Try.prototype.isStatement = YES; - - Try.prototype.jumps = function(o) { - var _ref4; - return this.attempt.jumps(o) || ((_ref4 = this.recovery) != null ? _ref4.jumps(o) : void 0); - }; - - Try.prototype.makeReturn = function(res) { - if (this.attempt) { - this.attempt = this.attempt.makeReturn(res); - } - if (this.recovery) { - this.recovery = this.recovery.makeReturn(res); - } - return this; - }; - - Try.prototype.compileNode = function(o) { - var catchPart, ensurePart, placeholder, tryPart; - o.indent += TAB; - tryPart = this.attempt.compileToFragments(o, LEVEL_TOP); - catchPart = this.recovery ? (placeholder = new Literal('_error'), this.errorVariable ? this.recovery.unshift(new Assign(this.errorVariable, placeholder)) : void 0, [].concat(this.makeCode(" catch ("), placeholder.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}"))) : !(this.ensure || this.recovery) ? [this.makeCode(' catch (_error) {}')] : []; - ensurePart = this.ensure ? [].concat(this.makeCode(" finally {\n"), this.ensure.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}")) : []; - return [].concat(this.makeCode("" + this.tab + "try {\n"), tryPart, this.makeCode("\n" + this.tab + "}"), catchPart, ensurePart); - }; - - return Try; - - })(Base); - - exports.Throw = Throw = (function(_super) { - __extends(Throw, _super); - - function Throw(expression) { - this.expression = expression; - Throw.__super__.constructor.call(this); - } - - Throw.prototype.children = ['expression']; - - Throw.prototype.isStatement = YES; - - Throw.prototype.jumps = NO; - - Throw.prototype.makeReturn = THIS; - - Throw.prototype.compileNode = function(o) { - return [].concat(this.makeCode(this.tab + "throw "), this.expression.compileToFragments(o), this.makeCode(";")); - }; - - return Throw; - - })(Base); - - exports.Existence = Existence = (function(_super) { - __extends(Existence, _super); - - function Existence(expression) { - this.expression = expression; - Existence.__super__.constructor.call(this); - } - - Existence.prototype.children = ['expression']; - - Existence.prototype.invert = NEGATE; - - Existence.prototype.compileNode = function(o) { - var cmp, cnj, code, _ref4; - this.expression.front = this.front; - code = this.expression.compile(o, LEVEL_OP); - if (IDENTIFIER.test(code) && !o.scope.check(code)) { - _ref4 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref4[0], cnj = _ref4[1]; - code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null"; - } else { - code = "" + code + " " + (this.negated ? '==' : '!=') + " null"; - } - return [this.makeCode(o.level <= LEVEL_COND ? code : "(" + code + ")")]; - }; - - return Existence; - - })(Base); - - exports.Parens = Parens = (function(_super) { - __extends(Parens, _super); - - function Parens(body) { - this.body = body; - Parens.__super__.constructor.call(this); - } - - Parens.prototype.children = ['body']; - - Parens.prototype.unwrap = function() { - return this.body; - }; - - Parens.prototype.isComplex = function() { - return this.body.isComplex(); - }; - - Parens.prototype.compileNode = function(o) { - var bare, expr, fragments; - expr = this.body.unwrap(); - if (expr instanceof Value && expr.isAtomic()) { - expr.front = this.front; - return expr.compileToFragments(o); - } - fragments = expr.compileToFragments(o, LEVEL_PAREN); - bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns)); - if (bare) { - return fragments; - } else { - return this.wrapInBraces(fragments); - } - }; - - return Parens; - - })(Base); - - exports.For = For = (function(_super) { - __extends(For, _super); - - function For(body, source) { - var _ref4; - For.__super__.constructor.call(this); - this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index; - this.body = Block.wrap([body]); - this.own = !!source.own; - this.object = !!source.object; - if (this.object) { - _ref4 = [this.index, this.name], this.name = _ref4[0], this.index = _ref4[1]; - } - if (this.index instanceof Value) { - this.index.error('index cannot be a pattern matching expression'); - } - this.range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length; - this.pattern = this.name instanceof Value; - if (this.range && this.index) { - this.index.error('indexes do not apply to range loops'); - } - if (this.range && this.pattern) { - this.name.error('cannot pattern match over range loops'); - } - if (this.own && !this.object) { - this.index.error('cannot use own with for-in'); - } - this.returns = false; - } - - For.prototype.children = ['body', 'source', 'guard', 'step']; - - For.prototype.compileNode = function(o) { - var body, bodyFragments, compare, compareDown, declare, declareDown, defPart, defPartFragments, down, forPartFragments, guardPart, idt1, increment, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, step, stepNum, stepVar, svar, varPart, _ref4, _ref5; - body = Block.wrap([this.body]); - lastJumps = (_ref4 = last(body.expressions)) != null ? _ref4.jumps() : void 0; - if (lastJumps && lastJumps instanceof Return) { - this.returns = false; - } - source = this.range ? this.source.base : this.source; - scope = o.scope; - name = this.name && (this.name.compile(o, LEVEL_LIST)); - index = this.index && (this.index.compile(o, LEVEL_LIST)); - if (name && !this.pattern) { - scope.find(name); - } - if (index) { - scope.find(index); - } - if (this.returns) { - rvar = scope.freeVariable('results'); - } - ivar = (this.object && index) || scope.freeVariable('i'); - kvar = (this.range && name) || index || ivar; - kvarAssign = kvar !== ivar ? "" + kvar + " = " : ""; - if (this.step && !this.range) { - _ref5 = this.cacheToCodeFragments(this.step.cache(o, LEVEL_LIST)), step = _ref5[0], stepVar = _ref5[1]; - stepNum = stepVar.match(SIMPLENUM); - } - if (this.pattern) { - name = ivar; - } - varPart = ''; - guardPart = ''; - defPart = ''; - idt1 = this.tab + TAB; - source.icedStatementAssertion(); - if (this.icedNodeFlag) { - return this.icedCompileIced(o, { - stepVar: stepVar, - body: body, - rvar: rvar, - kvar: kvar, - guard: this.guard - }); - } - if (this.range) { - forPartFragments = source.compileToFragments(merge(o, { - index: ivar, - name: name, - step: this.step - })); - } else { - svar = this.source.compile(o, LEVEL_LIST); - if ((name || this.own) && !IDENTIFIER.test(svar)) { - defPart += "" + this.tab + (ref = scope.freeVariable('ref')) + " = " + svar + ";\n"; - svar = ref; - } - if (name && !this.pattern) { - namePart = "" + name + " = " + svar + "[" + kvar + "]"; - } - if (!this.object) { - if (step !== stepVar) { - defPart += "" + this.tab + step + ";\n"; - } - if (!(this.step && stepNum && (down = +stepNum < 0))) { - lvar = scope.freeVariable('len'); - } - declare = "" + kvarAssign + ivar + " = 0, " + lvar + " = " + svar + ".length"; - declareDown = "" + kvarAssign + ivar + " = " + svar + ".length - 1"; - compare = "" + ivar + " < " + lvar; - compareDown = "" + ivar + " >= 0"; - if (this.step) { - if (stepNum) { - if (down) { - compare = compareDown; - declare = declareDown; - } - } else { - compare = "" + stepVar + " > 0 ? " + compare + " : " + compareDown; - declare = "(" + stepVar + " > 0 ? (" + declare + ") : " + declareDown + ")"; - } - increment = "" + ivar + " += " + stepVar; - } else { - increment = "" + (kvar !== ivar ? "++" + ivar : "" + ivar + "++"); - } - forPartFragments = [this.makeCode("" + declare + "; " + compare + "; " + kvarAssign + increment)]; - } - } - if (this.returns) { - resultPart = "" + this.tab + rvar + " = [];\n"; - returnResult = this.icedHasAutocbFlag ? "\n" + this.tab + iced["const"].autocb + "(" + rvar + "); return;" : "\n" + this.tab + "return " + rvar + ";"; - body.makeReturn(rvar); - } - if (this.guard) { - if (body.expressions.length > 1) { - body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); - } else { - if (this.guard) { - body = Block.wrap([new If(this.guard, body)]); - } - } - } - if (this.pattern) { - body.expressions.unshift(new Assign(this.name, new Literal("" + svar + "[" + kvar + "]"))); - } - defPartFragments = [].concat(this.makeCode(defPart), this.pluckDirectCall(o, body)); - if (namePart) { - varPart = "\n" + idt1 + namePart + ";"; - } - if (this.object) { - forPartFragments = [this.makeCode("" + kvar + " in " + svar)]; - if (this.own) { - guardPart = "\n" + idt1 + "if (!" + (utility('hasProp')) + ".call(" + svar + ", " + kvar + ")) continue;"; - } - } - bodyFragments = body.compileToFragments(merge(o, { - indent: idt1 - }), LEVEL_TOP); - if (bodyFragments && (bodyFragments.length > 0)) { - bodyFragments = [].concat(this.makeCode("\n"), bodyFragments, this.makeCode("\n")); - } - return [].concat(defPartFragments, this.makeCode("" + (resultPart || '') + this.tab + "for ("), forPartFragments, this.makeCode(") {" + guardPart + varPart), bodyFragments, this.makeCode("" + this.tab + "}" + (returnResult || ''))); - }; - - For.prototype.pluckDirectCall = function(o, body) { - var base, defs, expr, fn, idx, ref, val, _i, _len, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; - defs = []; - _ref4 = body.expressions; - for (idx = _i = 0, _len = _ref4.length; _i < _len; idx = ++_i) { - expr = _ref4[idx]; - expr = expr.unwrapAll(); - if (!(expr instanceof Call)) { - continue; - } - val = expr.variable.unwrapAll(); - if (!((val instanceof Code) || (val instanceof Value && ((_ref5 = val.base) != null ? _ref5.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref6 = (_ref7 = val.properties[0].name) != null ? _ref7.value : void 0) === 'call' || _ref6 === 'apply')))) { - continue; - } - fn = ((_ref8 = val.base) != null ? _ref8.unwrapAll() : void 0) || val; - ref = new Literal(o.scope.freeVariable('fn')); - base = new Value(ref); - if (val.base) { - _ref9 = [base, val], val.base = _ref9[0], base = _ref9[1]; - } - body.expressions[idx] = new Call(base, expr.args); - defs = defs.concat(this.makeCode(this.tab), new Assign(ref, fn).compileToFragments(o, LEVEL_TOP), this.makeCode(';\n')); - } - return defs; - }; - - For.prototype.icedCompileIced = function(o, d) { - var a1, a2, a3, a4, a5, b, body, condition, empty_arr, guard, iname, init, ival, key, key_lit, key_val, keys, keys_access, keys_len, keys_val, kval, len, len_rhs, len_val, loop_body, loop_keys, loop_source, pos, pre_body, ref, ref_val, ref_val_copy, rop, rvar, scope, source_access, step; - body = d.body; - condition = null; - init = []; - step = null; - scope = o.scope; - pre_body = new Block([]); - if (this.object) { - ref = scope.freeVariable('ref'); - ref_val = new Value(new Literal(ref)); - a1 = new Assign(ref_val, this.source); - keys = scope.freeVariable('keys'); - keys_val = new Value(new Literal(keys)); - key = scope.freeVariable('k'); - key_lit = new Literal(key); - key_val = new Value(key_lit); - empty_arr = new Value(new Arr); - loop_body = new Block([key_val]); - loop_source = { - object: true, - name: key_lit, - source: ref_val - }; - loop_keys = new For(loop_body, loop_source); - a2 = new Assign(keys_val, loop_keys); - iname = scope.freeVariable('i'); - ival = new Value(new Literal(iname)); - a3 = new Assign(ival, new Value(new Literal(0))); - init = [a1, a2, a3]; - keys_len = keys_val.copy(); - keys_len.add(new Access(new Value(new Literal("length")))); - condition = new Op('<', ival, keys_len); - step = new Op('++', ival); - if (this.name) { - source_access = ref_val.copy(); - source_access.add(new Index(this.index)); - a5 = new Assign(this.name, source_access); - pre_body.unshift(a5); - } - keys_access = keys_val.copy(); - keys_access.add(new Index(ival)); - a4 = new Assign(this.index, keys_access); - pre_body.unshift(a4); - } else if (this.range && this.name) { - pos = this.source.base.from <= this.source.base.to; - rop = this.source.base.exclusive ? (pos ? '<' : '>') : (pos ? '<=' : '>='); - condition = new Op(rop, this.name, this.source.base.to); - init = [new Assign(this.name, this.source.base.from)]; - if (this.step != null) { - step = new Op((pos ? "+=" : "-="), this.name, this.step); - } else { - step = new Op((pos ? '++' : "--"), this.name); - } - } else if (!this.range && this.name) { - kval = new Value(new Literal(d.kvar)); - len = scope.freeVariable('len'); - ref = scope.freeVariable('ref'); - ref_val = new Value(new Literal(ref)); - len_val = new Value(new Literal(len)); - a1 = new Assign(ref_val, this.source); - len_rhs = ref_val.copy().add(new Access(new Value(new Literal("length")))); - a2 = new Assign(len_val, len_rhs); - a3 = new Assign(kval, new Value(new Literal(0))); - init = [a1, a2, a3]; - condition = new Op('<', kval, len_val); - step = new Op('++', kval); - ref_val_copy = ref_val.copy(); - ref_val_copy.add(new Index(kval)); - a4 = new Assign(this.name, ref_val_copy); - pre_body.unshift(a4); - } - rvar = d.rvar; - guard = d.guard; - b = this.icedWrap({ - condition: condition, - body: body, - init: init, - step: step, - rvar: rvar, - guard: guard, - pre_body: pre_body - }); - return b.compileNode(o); - }; - - return For; - - })(While); - - exports.Switch = Switch = (function(_super) { - __extends(Switch, _super); - - function Switch(subject, cases, otherwise) { - this.subject = subject; - this.cases = cases; - this.otherwise = otherwise; - Switch.__super__.constructor.call(this); - } - - Switch.prototype.children = ['subject', 'cases', 'otherwise']; - - Switch.prototype.isStatement = YES; - - Switch.prototype.jumps = function(o) { - var block, conds, _i, _len, _ref4, _ref5, _ref6; - if (o == null) { - o = { - block: true - }; - } - _ref4 = this.cases; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - _ref5 = _ref4[_i], conds = _ref5[0], block = _ref5[1]; - if (block.jumps(o)) { - return block; - } - } - return (_ref6 = this.otherwise) != null ? _ref6.jumps(o) : void 0; - }; - - Switch.prototype.makeReturn = function(res) { - var pair, _i, _len, _ref4, _ref5; - _ref4 = this.cases; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - pair = _ref4[_i]; - pair[1].makeReturn(res); - } - if (res) { - this.otherwise || (this.otherwise = new Block([new Literal('void 0')])); - } - if ((_ref5 = this.otherwise) != null) { - _ref5.makeReturn(res); - } - return this; - }; - - Switch.prototype.compileNode = function(o) { - var block, body, cond, conditions, expr, fragments, i, idt1, idt2, _i, _j, _len, _len1, _ref4, _ref5, _ref6; - if (this.subject) { - this.subject.icedStatementAssertion(); - } - idt1 = o.indent + TAB; - idt2 = o.indent = idt1 + TAB; - fragments = [].concat(this.makeCode(this.tab + "switch ("), (this.subject ? this.subject.compileToFragments(o, LEVEL_PAREN) : this.makeCode("false")), this.makeCode(") {\n")); - _ref4 = this.cases; - for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { - _ref5 = _ref4[i], conditions = _ref5[0], block = _ref5[1]; - _ref6 = flatten([conditions]); - for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) { - cond = _ref6[_j]; - if (!this.subject) { - cond = cond.invert(); - } - fragments = fragments.concat(this.makeCode(idt1 + "case "), cond.compileToFragments(o, LEVEL_PAREN), this.makeCode(":\n")); - } - if ((body = block.compileToFragments(o, LEVEL_TOP)).length > 0) { - fragments = fragments.concat(body, this.makeCode('\n')); - } - if (i === this.cases.length - 1 && !this.otherwise) { - break; - } - expr = this.lastNonComment(block.expressions); - if (expr instanceof Return || (expr instanceof Literal && expr.jumps() && expr.value !== 'debugger')) { - continue; - } - fragments.push(cond.makeCode(idt2 + 'break;\n')); - } - if (this.otherwise && this.otherwise.expressions.length) { - fragments.push.apply(fragments, [this.makeCode(idt1 + "default:\n")].concat(__slice.call(this.otherwise.compileToFragments(o, LEVEL_TOP)), [this.makeCode("\n")])); - } - fragments.push(this.makeCode(this.tab + '}')); - return fragments; - }; - - Switch.prototype.icedCallContinuation = function() { - var block, condition, _i, _len, _ref4, _ref5; - _ref4 = this.cases; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - _ref5 = _ref4[_i], condition = _ref5[0], block = _ref5[1]; - block.icedThreadReturn(); - } - if (this.otherwise != null) { - return this.otherwise.icedThreadReturn(); - } else { - return this.otherwise = new Block([new IcedTailCall]); - } - }; - - return Switch; - - })(Base); - - exports.If = If = (function(_super) { - __extends(If, _super); - - function If(condition, body, options) { - this.body = body; - if (options == null) { - options = {}; - } - If.__super__.constructor.call(this); - this.condition = options.type === 'unless' ? condition.invert() : condition; - this.elseBody = null; - this.isChain = false; - this.soak = options.soak; - } - - If.prototype.children = ['condition', 'body', 'elseBody']; - - If.prototype.bodyNode = function() { - var _ref4; - return (_ref4 = this.body) != null ? _ref4.unwrap() : void 0; - }; - - If.prototype.elseBodyNode = function() { - var _ref4; - return (_ref4 = this.elseBody) != null ? _ref4.unwrap() : void 0; - }; - - If.prototype.addElse = function(elseBody) { - if (this.isChain) { - this.elseBodyNode().addElse(elseBody); - } else { - this.isChain = elseBody instanceof If; - this.elseBody = this.ensureBlock(elseBody); - this.elseBody.updateLocationDataIfMissing(elseBody.locationData); - } - return this; - }; - - If.prototype.isStatement = function(o) { - var _ref4; - return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref4 = this.elseBodyNode()) != null ? _ref4.isStatement(o) : void 0); - }; - - If.prototype.jumps = function(o) { - var _ref4; - return this.body.jumps(o) || ((_ref4 = this.elseBody) != null ? _ref4.jumps(o) : void 0); - }; - - If.prototype.compileNode = function(o) { - this.condition.icedStatementAssertion(); - if (this.isStatement(o || this.icedIsCpsPivot())) { - return this.compileStatement(o); - } else { - return this.compileExpression(o); - } - }; - - If.prototype.makeReturn = function(res) { - if (res) { - this.elseBody || (this.elseBody = new Block([new Literal('void 0')])); - } - this.body && (this.body = new Block([this.body.makeReturn(res)])); - this.elseBody && (this.elseBody = new Block([this.elseBody.makeReturn(res)])); - return this; - }; - - If.prototype.ensureBlock = function(node) { - if (node instanceof Block) { - return node; - } else { - return new Block([node]); - } - }; - - If.prototype.compileStatement = function(o) { - var answer, body, child, cond, exeq, ifPart, indent; - child = del(o, 'chainChild'); - exeq = del(o, 'isExistentialEquals'); - if (exeq) { - return new If(this.condition.invert(), this.elseBodyNode(), { - type: 'if' - }).compileToFragments(o); - } - indent = o.indent + TAB; - cond = this.condition.compileToFragments(o, LEVEL_PAREN); - body = this.ensureBlock(this.body).compileToFragments(merge(o, { - indent: indent - })); - ifPart = [].concat(this.makeCode("if ("), cond, this.makeCode(") {\n"), body, this.makeCode("\n" + this.tab + "}")); - if (!child) { - ifPart.unshift(this.makeCode(this.tab)); - } - if (!this.elseBody) { - return ifPart; - } - answer = ifPart.concat(this.makeCode(' else ')); - if (this.isChain) { - o.chainChild = true; - answer = answer.concat(this.elseBody.unwrap().compileToFragments(o, LEVEL_TOP)); - } else { - answer = answer.concat(this.makeCode("{\n"), this.elseBody.compileToFragments(merge(o, { - indent: indent - }), LEVEL_TOP), this.makeCode("\n" + this.tab + "}")); - } - return answer; - }; - - If.prototype.compileExpression = function(o) { - var alt, body, cond, fragments; - cond = this.condition.compileToFragments(o, LEVEL_COND); - body = this.bodyNode().compileToFragments(o, LEVEL_LIST); - alt = this.elseBodyNode() ? this.elseBodyNode().compileToFragments(o, LEVEL_LIST) : [this.makeCode('void 0')]; - fragments = cond.concat(this.makeCode(" ? "), body, this.makeCode(" : "), alt); - if (o.level >= LEVEL_COND) { - return this.wrapInBraces(fragments); - } else { - return fragments; - } - }; - - If.prototype.unfoldSoak = function() { - return this.soak && this; - }; - - If.prototype.icedCallContinuation = function() { - if (this.elseBody) { - this.elseBody.icedThreadReturn(); - this.isChain = false; - } else { - this.addElse(new IcedTailCall); - } - return this.body.icedThreadReturn(); - }; - - return If; - - })(Base); - - Closure = { - wrap: function(expressions, statement, noReturn) { - var args, argumentsNode, call, func, meth; - if (expressions.jumps()) { - return expressions; - } - func = new Code([], Block.wrap([expressions])); - args = []; - argumentsNode = expressions.contains(this.isLiteralArguments); - if (argumentsNode && expressions.classBody) { - argumentsNode.error("Class bodies shouldn't reference arguments"); - } - if (argumentsNode || expressions.contains(this.isLiteralThis)) { - meth = new Literal(argumentsNode ? 'apply' : 'call'); - args = [new Literal('this')]; - if (argumentsNode) { - args.push(new Literal('arguments')); - } - func = new Value(func, [new Access(meth)]); - } - func.noReturn = noReturn; - call = new Call(func, args); - if (statement) { - return Block.wrap([call]); - } else { - return call; - } - }, - isLiteralArguments: function(node) { - return node instanceof Literal && node.value === 'arguments' && !node.asKey; - }, - isLiteralThis: function(node) { - return (node instanceof Literal && node.value === 'this' && !node.asKey) || (node instanceof Code && node.bound) || (node instanceof Call && node.isSuper); - } - }; - - unfoldSoak = function(o, parent, name) { - var ifn; - if (!(ifn = parent[name].unfoldSoak(o))) { - return; - } - parent[name] = ifn.body; - ifn.body = new Value(parent); - return ifn; - }; - - CpsCascade = { - wrap: function(statement, rest, returnValue, o) { - var args, block, call, cont, e, func; - func = new Code([new Param(new Literal(iced["const"].k))], Block.wrap([statement]), 'icedgen'); - args = []; - if (returnValue) { - returnValue.bindName(o); - args.push(returnValue); - } - block = Block.wrap([rest]); - if ((e = block.icedGetSingle()) && e instanceof IcedTailCall && e.canInline()) { - cont = e.extractFunc(); - } else { - cont = new Code(args, block, 'icedgen'); - } - call = new Call(func, [cont]); - return new Block([call]); - } - }; - - IcedTailCall = (function(_super) { - __extends(IcedTailCall, _super); - - function IcedTailCall(func, val) { - this.func = func; - if (val == null) { - val = null; - } - IcedTailCall.__super__.constructor.call(this); - if (!this.func) { - this.func = iced["const"].k; - } - this.value = val; - } - - IcedTailCall.prototype.children = ['value']; - - IcedTailCall.prototype.assignValue = function(v) { - return this.value = v; - }; - - IcedTailCall.prototype.canInline = function() { - return !this.value || this.value instanceof IcedReturnValue; - }; - - IcedTailCall.prototype.literalFunc = function() { - return new Literal(this.func); - }; - - IcedTailCall.prototype.extractFunc = function() { - return new Value(this.literalFunc()); - }; - - IcedTailCall.prototype.compileNode = function(o) { - var args, f, out; - f = this.literalFunc(); - out = o.level === LEVEL_TOP ? this.value ? new Block([this.value, new Call(f)]) : new Call(f) : (args = this.value ? [this.value] : [], new Call(f, args)); - return out.compileNode(o); - }; - - return IcedTailCall; - - })(Base); - - IcedReturnValue = (function(_super) { - __extends(IcedReturnValue, _super); - - IcedReturnValue.counter = 0; - - function IcedReturnValue() { - IcedReturnValue.__super__.constructor.call(this, null, null, false); - } - - IcedReturnValue.prototype.bindName = function(o) { - var l; - l = "" + (o.scope.freeVariable(iced["const"].param, false)) + "_" + (IcedReturnValue.counter++); - return this.name = new Literal(l); - }; - - IcedReturnValue.prototype.compile = function(o) { - if (!this.name) { - this.bindName(o); - } - return IcedReturnValue.__super__.compile.call(this, o); - }; - - return IcedReturnValue; - - })(Param); - - InlineRuntime = { - generate: function(ns_window) { - var a1, a2, af, apply_call, assignments, body, call_meth, cn, cnt, cnt_member, constructor_assign, constructor_body, constructor_code, constructor_name, constructor_params, decr, defer_assign, defer_body, defer_code, defer_name, defer_params, dp, dp_value, fn, fn_assign, fn_code, fn_name, if_body, if_cond, if_expr, inc, inner_body, inner_code, inner_params, ip, k, k_member, klass, klass_assign, my_apply, my_if, my_null, ns, ns_obj, ns_val, obj, outer_block, p1, ret_member, tr_assign, tr_block, tr_code, tr_name, tr_params, _fulfill_assign, _fulfill_body, _fulfill_call, _fulfill_code, _fulfill_method, _fulfill_name; - k = new Literal("continuation"); - cnt = new Literal("count"); - cn = new Value(new Literal(iced["const"].Deferrals)); - ns = new Value(new Literal(iced["const"].ns)); - if (ns_window) { - ns_window.add(new Access(ns)); - ns = ns_window; - } - k_member = new Value(new Literal("this")); - k_member.add(new Access(k)); - p1 = new Param(k_member); - cnt_member = new Value(new Literal("this")); - cnt_member.add(new Access(cnt)); - ret_member = new Value(new Literal("this")); - ret_member.add(new Access(new Value(new Literal(iced["const"].retslot)))); - a1 = new Assign(cnt_member, new Value(new Literal(1))); - a2 = new Assign(ret_member, NULL()); - constructor_params = [p1]; - constructor_body = new Block([a1, a2]); - constructor_code = new Code(constructor_params, constructor_body); - constructor_name = new Value(new Literal("constructor")); - constructor_assign = new Assign(constructor_name, constructor_code); - if_expr = new Call(k_member, [ret_member]); - if_body = new Block([if_expr]); - decr = new Op('--', cnt_member); - if_cond = new Op('!', decr); - my_if = new If(if_cond, if_body); - _fulfill_body = new Block([my_if]); - _fulfill_code = new Code([], _fulfill_body); - _fulfill_name = new Value(new Literal(iced["const"].fulfill)); - _fulfill_assign = new Assign(_fulfill_name, _fulfill_code); - inc = new Op("++", cnt_member); - ip = new Literal("inner_params"); - dp = new Literal("defer_params"); - dp_value = new Value(dp); - call_meth = new Value(dp); - af = new Literal(iced["const"].assign_fn); - call_meth.add(new Access(af, "soak")); - my_apply = new Literal("apply"); - call_meth.add(new Access(my_apply, "soak")); - my_null = NULL(); - apply_call = new Call(call_meth, [my_null, new Value(ip)]); - _fulfill_method = new Value(new Literal("this")); - _fulfill_method.add(new Access(new Literal(iced["const"].fulfill))); - _fulfill_call = new Call(_fulfill_method, []); - inner_body = new Block([apply_call, _fulfill_call]); - inner_params = [new Param(ip, null, true)]; - inner_code = new Code(inner_params, inner_body, "boundfunc"); - defer_body = new Block([inc, inner_code]); - defer_params = [new Param(dp)]; - defer_code = new Code(defer_params, defer_body); - defer_name = new Value(new Literal(iced["const"].defer_method)); - defer_assign = new Assign(defer_name, defer_code); - assignments = [constructor_assign, _fulfill_assign, defer_assign]; - obj = new Obj(assignments, true); - body = new Block([new Value(obj)]); - klass = new Class(null, null, body); - klass_assign = new Assign(cn, klass, "object"); - outer_block = new Block([NULL()]); - fn_code = new Code([], outer_block); - fn_name = new Value(new Literal(iced["const"].findDeferral)); - fn_assign = new Assign(fn_name, fn_code, "object"); - fn = new Literal("_fn"); - tr_block = new Block([new Call(new Value(fn), [])]); - tr_params = [new Param(fn)]; - tr_code = new Code(tr_params, tr_block); - tr_name = new Value(new Literal(iced["const"].trampoline)); - tr_assign = new Assign(tr_name, tr_code, "object"); - ns_obj = new Obj([klass_assign, fn_assign, tr_assign], true); - ns_val = new Value(ns_obj); - return new Assign(ns, ns_val); - } - }; - - UTILITIES = { - "extends": function() { - return "function(child, parent) { for (var key in parent) { if (" + (utility('hasProp')) + ".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }"; - }, - bind: function() { - return 'function(fn, me){ return function(){ return fn.apply(me, arguments); }; }'; - }, - indexOf: function() { - return "[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"; - }, - hasProp: function() { - return '{}.hasOwnProperty'; - }, - slice: function() { - return '[].slice'; - } - }; - - LEVEL_TOP = 1; - - LEVEL_PAREN = 2; - - LEVEL_LIST = 3; - - LEVEL_COND = 4; - - LEVEL_OP = 5; - - LEVEL_ACCESS = 6; - - TAB = ' '; - - IDENTIFIER_STR = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; - - IDENTIFIER = RegExp("^" + IDENTIFIER_STR + "$"); - - SIMPLENUM = /^[+-]?\d+$/; - - METHOD_DEF = RegExp("^(?:(" + IDENTIFIER_STR + ")\\.prototype(?:\\.(" + IDENTIFIER_STR + ")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|(" + IDENTIFIER_STR + ")$"); - - IS_STRING = /^['"]/; - - utility = function(name) { - var ref; - ref = "__" + name; - Scope.root.assign(ref, UTILITIES[name]()); - return ref; - }; - - multident = function(code, tab) { - code = code.replace(/\n/g, '$&' + tab); - return code.replace(/\s+$/, ''); - }; - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/optparse.js b/node_modules/iced-coffee-script/lib/coffee-script/optparse.js deleted file mode 100644 index f7f8b79..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/optparse.js +++ /dev/null @@ -1,141 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat; - - - - repeat = require('./helpers').repeat; - - exports.OptionParser = OptionParser = (function() { - function OptionParser(rules, banner) { - this.banner = banner; - this.rules = buildRules(rules); - } - - OptionParser.prototype.parse = function(args) { - var arg, i, isOption, matchedRule, options, originalArgs, pos, rule, seenNonOptionArg, skippingArgument, value, _i, _j, _len, _len1, _ref; - options = { - "arguments": [] - }; - skippingArgument = false; - originalArgs = args; - args = normalizeArguments(args); - for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { - arg = args[i]; - if (skippingArgument) { - skippingArgument = false; - continue; - } - if (arg === '--') { - pos = originalArgs.indexOf('--'); - options["arguments"] = options["arguments"].concat(originalArgs.slice(pos + 1)); - break; - } - isOption = !!(arg.match(LONG_FLAG) || arg.match(SHORT_FLAG)); - seenNonOptionArg = options["arguments"].length > 0; - if (!seenNonOptionArg) { - matchedRule = false; - _ref = this.rules; - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - rule = _ref[_j]; - if (rule.shortFlag === arg || rule.longFlag === arg) { - value = true; - if (rule.hasArgument) { - skippingArgument = true; - value = args[i + 1]; - } - options[rule.name] = rule.isList ? (options[rule.name] || []).concat(value) : value; - matchedRule = true; - break; - } - } - if (isOption && !matchedRule) { - throw new Error("unrecognized option: " + arg); - } - } - if (seenNonOptionArg || !isOption) { - options["arguments"].push(arg); - } - } - return options; - }; - - OptionParser.prototype.help = function() { - var letPart, lines, rule, spaces, _i, _len, _ref; - lines = []; - if (this.banner) { - lines.unshift("" + this.banner + "\n"); - } - _ref = this.rules; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - rule = _ref[_i]; - spaces = 15 - rule.longFlag.length; - spaces = spaces > 0 ? repeat(' ', spaces) : ''; - letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' '; - lines.push(' ' + letPart + rule.longFlag + spaces + rule.description); - } - return "\n" + (lines.join('\n')) + "\n"; - }; - - return OptionParser; - - })(); - - LONG_FLAG = /^(--\w[\w\-]*)/; - - SHORT_FLAG = /^(-\w)$/; - - MULTI_FLAG = /^-(\w{2,})/; - - OPTIONAL = /\[(\w+(\*?))\]/; - - buildRules = function(rules) { - var tuple, _i, _len, _results; - _results = []; - for (_i = 0, _len = rules.length; _i < _len; _i++) { - tuple = rules[_i]; - if (tuple.length < 3) { - tuple.unshift(null); - } - _results.push(buildRule.apply(null, tuple)); - } - return _results; - }; - - buildRule = function(shortFlag, longFlag, description, options) { - var match; - if (options == null) { - options = {}; - } - match = longFlag.match(OPTIONAL); - longFlag = longFlag.match(LONG_FLAG)[1]; - return { - name: longFlag.substr(2), - shortFlag: shortFlag, - longFlag: longFlag, - description: description, - hasArgument: !!(match && match[1]), - isList: !!(match && match[2]) - }; - }; - - normalizeArguments = function(args) { - var arg, l, match, result, _i, _j, _len, _len1, _ref; - args = args.slice(0); - result = []; - for (_i = 0, _len = args.length; _i < _len; _i++) { - arg = args[_i]; - if (match = arg.match(MULTI_FLAG)) { - _ref = match[1].split(''); - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - l = _ref[_j]; - result.push('-' + l); - } - } else { - result.push(arg); - } - } - return result; - }; - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/parser.js b/node_modules/iced-coffee-script/lib/coffee-script/parser.js deleted file mode 100755 index 87e5557..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/parser.js +++ /dev/null @@ -1,620 +0,0 @@ -/* parser generated by jison 0.4.2 */ -var parser = (function(){ -var parser = {trace: function trace() { }, -yy: {}, -symbols_: {"error":2,"Root":3,"Body":4,"Line":5,"TERMINATOR":6,"Expression":7,"Statement":8,"Return":9,"Comment":10,"STATEMENT":11,"Await":12,"AWAIT":13,"Block":14,"Value":15,"Invocation":16,"Code":17,"Operation":18,"Assign":19,"If":20,"Try":21,"While":22,"For":23,"Switch":24,"Class":25,"Throw":26,"Defer":27,"INDENT":28,"OUTDENT":29,"Identifier":30,"IDENTIFIER":31,"AlphaNumeric":32,"NUMBER":33,"STRING":34,"Literal":35,"JS":36,"REGEX":37,"DEBUGGER":38,"UNDEFINED":39,"NULL":40,"BOOL":41,"Assignable":42,"=":43,"AssignObj":44,"ObjAssignable":45,":":46,"ThisProperty":47,"RETURN":48,"HERECOMMENT":49,"PARAM_START":50,"ParamList":51,"PARAM_END":52,"FuncGlyph":53,"->":54,"=>":55,"OptComma":56,",":57,"Param":58,"ParamVar":59,"...":60,"Array":61,"Object":62,"Splat":63,"SimpleAssignable":64,"Accessor":65,"Parenthetical":66,"Range":67,"This":68,".":69,"?.":70,"::":71,"?::":72,"Index":73,"INDEX_START":74,"IndexValue":75,"INDEX_END":76,"INDEX_SOAK":77,"Slice":78,"{":79,"AssignList":80,"}":81,"CLASS":82,"EXTENDS":83,"OptFuncExist":84,"Arguments":85,"SUPER":86,"DEFER":87,"FUNC_EXIST":88,"CALL_START":89,"CALL_END":90,"ArgList":91,"THIS":92,"@":93,"[":94,"]":95,"RangeDots":96,"..":97,"Arg":98,"SimpleArgs":99,"TRY":100,"Catch":101,"FINALLY":102,"CATCH":103,"THROW":104,"(":105,")":106,"WhileSource":107,"WHILE":108,"WHEN":109,"UNTIL":110,"Loop":111,"LOOP":112,"ForBody":113,"FOR":114,"ForStart":115,"ForSource":116,"ForVariables":117,"OWN":118,"ForValue":119,"FORIN":120,"FOROF":121,"BY":122,"SWITCH":123,"Whens":124,"ELSE":125,"When":126,"LEADING_WHEN":127,"IfBlock":128,"IF":129,"POST_IF":130,"UNARY":131,"-":132,"+":133,"--":134,"++":135,"?":136,"MATH":137,"SHIFT":138,"COMPARE":139,"LOGIC":140,"RELATION":141,"COMPOUND_ASSIGN":142,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"TERMINATOR",11:"STATEMENT",13:"AWAIT",28:"INDENT",29:"OUTDENT",31:"IDENTIFIER",33:"NUMBER",34:"STRING",36:"JS",37:"REGEX",38:"DEBUGGER",39:"UNDEFINED",40:"NULL",41:"BOOL",43:"=",46:":",48:"RETURN",49:"HERECOMMENT",50:"PARAM_START",52:"PARAM_END",54:"->",55:"=>",57:",",60:"...",69:".",70:"?.",71:"::",72:"?::",74:"INDEX_START",76:"INDEX_END",77:"INDEX_SOAK",79:"{",81:"}",82:"CLASS",83:"EXTENDS",86:"SUPER",87:"DEFER",88:"FUNC_EXIST",89:"CALL_START",90:"CALL_END",92:"THIS",93:"@",94:"[",95:"]",97:"..",100:"TRY",102:"FINALLY",103:"CATCH",104:"THROW",105:"(",106:")",108:"WHILE",109:"WHEN",110:"UNTIL",112:"LOOP",114:"FOR",118:"OWN",120:"FORIN",121:"FOROF",122:"BY",123:"SWITCH",125:"ELSE",127:"LEADING_WHEN",129:"IF",130:"POST_IF",131:"UNARY",132:"-",133:"+",134:"--",135:"++",136:"?",137:"MATH",138:"SHIFT",139:"COMPARE",140:"LOGIC",141:"RELATION",142:"COMPOUND_ASSIGN"}, -productions_: [0,[3,0],[3,1],[4,1],[4,3],[4,2],[5,1],[5,1],[8,1],[8,1],[8,1],[8,1],[12,2],[12,2],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[14,2],[14,3],[30,1],[32,1],[32,1],[35,1],[35,1],[35,1],[35,1],[35,1],[35,1],[35,1],[19,3],[19,4],[19,5],[44,1],[44,3],[44,5],[44,1],[45,1],[45,1],[45,1],[9,2],[9,1],[10,1],[17,5],[17,2],[53,1],[53,1],[56,0],[56,1],[51,0],[51,1],[51,3],[51,4],[51,6],[58,1],[58,2],[58,3],[59,1],[59,1],[59,1],[59,1],[63,2],[64,1],[64,2],[64,2],[64,1],[42,1],[42,1],[42,1],[15,1],[15,1],[15,1],[15,1],[15,1],[65,2],[65,2],[65,2],[65,2],[65,2],[65,1],[65,1],[73,3],[73,2],[75,1],[75,1],[62,4],[80,0],[80,1],[80,3],[80,4],[80,6],[25,1],[25,2],[25,3],[25,4],[25,2],[25,3],[25,4],[25,5],[16,3],[16,3],[16,1],[16,2],[27,2],[84,0],[84,1],[85,2],[85,4],[68,1],[68,1],[47,2],[61,2],[61,4],[96,1],[96,1],[67,5],[78,3],[78,2],[78,2],[78,1],[91,1],[91,3],[91,4],[91,4],[91,6],[98,1],[98,1],[99,1],[99,3],[21,2],[21,3],[21,4],[21,5],[101,3],[101,3],[101,2],[26,2],[66,3],[66,5],[107,2],[107,4],[107,2],[107,4],[22,2],[22,2],[22,2],[22,1],[111,2],[111,2],[23,2],[23,2],[23,2],[113,2],[113,2],[115,2],[115,3],[119,1],[119,1],[119,1],[119,1],[117,1],[117,3],[116,2],[116,2],[116,4],[116,4],[116,4],[116,6],[116,6],[24,5],[24,7],[24,4],[24,6],[124,1],[124,2],[126,3],[126,4],[128,3],[128,5],[20,1],[20,3],[20,3],[20,3],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,2],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,3],[18,5],[18,4],[18,3]], -performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { - -var $0 = $$.length - 1; -switch (yystate) { -case 1:return this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Block); -break; -case 2:return this.$ = $$[$0]; -break; -case 3:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Block.wrap([$$[$0]])); -break; -case 4:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].push($$[$0])); -break; -case 5:this.$ = $$[$0-1]; -break; -case 6:this.$ = $$[$0]; -break; -case 7:this.$ = $$[$0]; -break; -case 8:this.$ = $$[$0]; -break; -case 9:this.$ = $$[$0]; -break; -case 10:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 11:this.$ = $$[$0]; -break; -case 12:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Await($$[$0])); -break; -case 13:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Await(yy.Block.wrap([$$[$0]]))); -break; -case 14:this.$ = $$[$0]; -break; -case 15:this.$ = $$[$0]; -break; -case 16:this.$ = $$[$0]; -break; -case 17:this.$ = $$[$0]; -break; -case 18:this.$ = $$[$0]; -break; -case 19:this.$ = $$[$0]; -break; -case 20:this.$ = $$[$0]; -break; -case 21:this.$ = $$[$0]; -break; -case 22:this.$ = $$[$0]; -break; -case 23:this.$ = $$[$0]; -break; -case 24:this.$ = $$[$0]; -break; -case 25:this.$ = $$[$0]; -break; -case 26:this.$ = $$[$0]; -break; -case 27:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Block); -break; -case 28:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]); -break; -case 29:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 30:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 31:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 32:this.$ = $$[$0]; -break; -case 33:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 34:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 35:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 36:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Undefined); -break; -case 37:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Null); -break; -case 38:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Bool($$[$0])); -break; -case 39:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0])); -break; -case 40:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0])); -break; -case 41:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1])); -break; -case 42:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 43:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-2])(new yy.Value($$[$0-2])), $$[$0], 'object')); -break; -case 44:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-4])(new yy.Value($$[$0-4])), $$[$0-1], 'object')); -break; -case 45:this.$ = $$[$0]; -break; -case 46:this.$ = $$[$0]; -break; -case 47:this.$ = $$[$0]; -break; -case 48:this.$ = $$[$0]; -break; -case 49:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Return($$[$0])); -break; -case 50:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Return); -break; -case 51:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Comment($$[$0])); -break; -case 52:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Code($$[$0-3], $$[$0], $$[$0-1])); -break; -case 53:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Code([], $$[$0], $$[$0-1])); -break; -case 54:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('func'); -break; -case 55:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('boundfunc'); -break; -case 56:this.$ = $$[$0]; -break; -case 57:this.$ = $$[$0]; -break; -case 58:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]); -break; -case 59:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); -break; -case 60:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0])); -break; -case 61:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0])); -break; -case 62:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2])); -break; -case 63:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Param($$[$0])); -break; -case 64:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Param($$[$0-1], null, true)); -break; -case 65:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Param($$[$0-2], $$[$0])); -break; -case 66:this.$ = $$[$0]; -break; -case 67:this.$ = $$[$0]; -break; -case 68:this.$ = $$[$0]; -break; -case 69:this.$ = $$[$0]; -break; -case 70:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Splat($$[$0-1])); -break; -case 71:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 72:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].add($$[$0])); -break; -case 73:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value($$[$0-1], [].concat($$[$0]))); -break; -case 74:this.$ = $$[$0]; -break; -case 75:this.$ = $$[$0]; -break; -case 76:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 77:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 78:this.$ = $$[$0]; -break; -case 79:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 80:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 81:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 82:this.$ = $$[$0]; -break; -case 83:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0])); -break; -case 84:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0].setCustom())); -break; -case 85:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0], 'soak')); -break; -case 86:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'))), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]); -break; -case 87:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'), 'soak')), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]); -break; -case 88:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Access(new yy.Literal('prototype'))); -break; -case 89:this.$ = $$[$0]; -break; -case 90:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]); -break; -case 91:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.extend($$[$0], { - soak: true - })); -break; -case 92:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Index($$[$0])); -break; -case 93:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Slice($$[$0])); -break; -case 94:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Obj($$[$0-2], $$[$0-3].generated)); -break; -case 95:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]); -break; -case 96:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); -break; -case 97:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0])); -break; -case 98:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0])); -break; -case 99:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2])); -break; -case 100:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Class); -break; -case 101:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class(null, null, $$[$0])); -break; -case 102:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class(null, $$[$0])); -break; -case 103:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class(null, $$[$0-1], $$[$0])); -break; -case 104:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class($$[$0])); -break; -case 105:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class($$[$0-1], null, $$[$0])); -break; -case 106:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class($$[$0-2], $$[$0])); -break; -case 107:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Class($$[$0-3], $$[$0-1], $$[$0])); -break; -case 108:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1])); -break; -case 109:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1])); -break; -case 110:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))])); -break; -case 111:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Call('super', $$[$0])); -break; -case 112:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Defer($$[$0], yylineno)); -break; -case 113:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(false); -break; -case 114:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(true); -break; -case 115:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([]); -break; -case 116:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]); -break; -case 117:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this'))); -break; -case 118:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this'))); -break; -case 119:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('this')), [yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))], 'this')); -break; -case 120:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Arr([])); -break; -case 121:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Arr($$[$0-2])); -break; -case 122:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('inclusive'); -break; -case 123:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('exclusive'); -break; -case 124:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Range($$[$0-3], $$[$0-1], $$[$0-2])); -break; -case 125:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Range($$[$0-2], $$[$0], $$[$0-1])); -break; -case 126:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range($$[$0-1], null, $$[$0])); -break; -case 127:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range(null, $$[$0], $$[$0-1])); -break; -case 128:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Range(null, null, $$[$0])); -break; -case 129:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); -break; -case 130:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0])); -break; -case 131:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0])); -break; -case 132:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]); -break; -case 133:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2])); -break; -case 134:this.$ = $$[$0]; -break; -case 135:this.$ = $$[$0]; -break; -case 136:this.$ = $$[$0]; -break; -case 137:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([].concat($$[$0-2], $$[$0])); -break; -case 138:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Try($$[$0])); -break; -case 139:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Try($$[$0-1], $$[$0][0], $$[$0][1])); -break; -case 140:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Try($$[$0-2], null, null, $$[$0])); -break; -case 141:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0])); -break; -case 142:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-1], $$[$0]]); -break; -case 143:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Value($$[$0-1])), $$[$0]]); -break; -case 144:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([null, $$[$0]]); -break; -case 145:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Throw($$[$0])); -break; -case 146:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Parens($$[$0-1])); -break; -case 147:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Parens($$[$0-2])); -break; -case 148:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0])); -break; -case 149:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], { - guard: $$[$0] - })); -break; -case 150:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0], { - invert: true - })); -break; -case 151:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], { - invert: true, - guard: $$[$0] - })); -break; -case 152:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].addBody($$[$0])); -break; -case 153:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]])))); -break; -case 154:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]])))); -break; -case 155:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])($$[$0]); -break; -case 156:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody($$[$0])); -break; -case 157:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody(yy.addLocationDataFn(_$[$0])(yy.Block.wrap([$$[$0]])))); -break; -case 158:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0])); -break; -case 159:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0])); -break; -case 160:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0], $$[$0-1])); -break; -case 161:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({ - source: yy.addLocationDataFn(_$[$0])(new yy.Value($$[$0])) - }); -break; -case 162:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])((function () { - $$[$0].own = $$[$0-1].own; - $$[$0].name = $$[$0-1][0]; - $$[$0].index = $$[$0-1][1]; - return $$[$0]; - }())); -break; -case 163:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0]); -break; -case 164:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () { - $$[$0].own = true; - return $$[$0]; - }())); -break; -case 165:this.$ = $$[$0]; -break; -case 166:this.$ = $$[$0]; -break; -case 167:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 168:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 169:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); -break; -case 170:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-2], $$[$0]]); -break; -case 171:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({ - source: $$[$0] - }); -break; -case 172:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({ - source: $$[$0], - object: true - }); -break; -case 173:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({ - source: $$[$0-2], - guard: $$[$0] - }); -break; -case 174:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({ - source: $$[$0-2], - guard: $$[$0], - object: true - }); -break; -case 175:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({ - source: $$[$0-2], - step: $$[$0] - }); -break; -case 176:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({ - source: $$[$0-4], - guard: $$[$0-2], - step: $$[$0] - }); -break; -case 177:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({ - source: $$[$0-4], - step: $$[$0-2], - guard: $$[$0] - }); -break; -case 178:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Switch($$[$0-3], $$[$0-1])); -break; -case 179:this.$ = yy.addLocationDataFn(_$[$0-6], _$[$0])(new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1])); -break; -case 180:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Switch(null, $$[$0-1])); -break; -case 181:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])(new yy.Switch(null, $$[$0-3], $$[$0-1])); -break; -case 182:this.$ = $$[$0]; -break; -case 183:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].concat($$[$0])); -break; -case 184:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([[$$[$0-1], $$[$0]]]); -break; -case 185:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])([[$$[$0-2], $$[$0-1]]]); -break; -case 186:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - })); -break; -case 187:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])($$[$0-4].addElse(yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - })))); -break; -case 188:this.$ = $$[$0]; -break; -case 189:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].addElse($$[$0])); -break; -case 190:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), { - type: $$[$0-1], - statement: true - })); -break; -case 191:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), { - type: $$[$0-1], - statement: true - })); -break; -case 192:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op($$[$0-1], $$[$0])); -break; -case 193:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('-', $$[$0])); -break; -case 194:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('+', $$[$0])); -break; -case 195:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0])); -break; -case 196:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0])); -break; -case 197:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0-1], null, true)); -break; -case 198:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0-1], null, true)); -break; -case 199:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Existence($$[$0-1])); -break; -case 200:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('+', $$[$0-2], $$[$0])); -break; -case 201:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('-', $$[$0-2], $$[$0])); -break; -case 202:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); -break; -case 203:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); -break; -case 204:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); -break; -case 205:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); -break; -case 206:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () { - if ($$[$0-1].charAt(0) === '!') { - return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert(); - } else { - return new yy.Op($$[$0-1], $$[$0-2], $$[$0]); - } - }())); -break; -case 207:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0], $$[$0-1])); -break; -case 208:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3])); -break; -case 209:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0], $$[$0-2])); -break; -case 210:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Extends($$[$0-2], $$[$0])); -break; -} -}, -table: [{1:[2,1],3:1,4:2,5:3,7:4,8:5,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[3]},{1:[2,2],6:[1,76]},{1:[2,3],6:[2,3],29:[2,3],106:[2,3]},{1:[2,6],6:[2,6],29:[2,6],106:[2,6],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,7],6:[2,7],29:[2,7],106:[2,7],107:89,108:[1,67],110:[1,68],113:90,114:[1,70],115:71,130:[1,88]},{1:[2,14],6:[2,14],28:[2,14],29:[2,14],52:[2,14],57:[2,14],60:[2,14],65:92,69:[1,94],70:[1,95],71:[1,96],72:[1,97],73:98,74:[1,99],76:[2,14],77:[1,100],81:[2,14],84:91,88:[1,93],89:[2,113],90:[2,14],95:[2,14],97:[2,14],106:[2,14],108:[2,14],109:[2,14],110:[2,14],114:[2,14],122:[2,14],130:[2,14],132:[2,14],133:[2,14],136:[2,14],137:[2,14],138:[2,14],139:[2,14],140:[2,14],141:[2,14]},{1:[2,15],6:[2,15],28:[2,15],29:[2,15],52:[2,15],57:[2,15],60:[2,15],65:102,69:[1,94],70:[1,95],71:[1,96],72:[1,97],73:98,74:[1,99],76:[2,15],77:[1,100],81:[2,15],84:101,88:[1,93],89:[2,113],90:[2,15],95:[2,15],97:[2,15],106:[2,15],108:[2,15],109:[2,15],110:[2,15],114:[2,15],122:[2,15],130:[2,15],132:[2,15],133:[2,15],136:[2,15],137:[2,15],138:[2,15],139:[2,15],140:[2,15],141:[2,15]},{1:[2,16],6:[2,16],28:[2,16],29:[2,16],52:[2,16],57:[2,16],60:[2,16],76:[2,16],81:[2,16],90:[2,16],95:[2,16],97:[2,16],106:[2,16],108:[2,16],109:[2,16],110:[2,16],114:[2,16],122:[2,16],130:[2,16],132:[2,16],133:[2,16],136:[2,16],137:[2,16],138:[2,16],139:[2,16],140:[2,16],141:[2,16]},{1:[2,17],6:[2,17],28:[2,17],29:[2,17],52:[2,17],57:[2,17],60:[2,17],76:[2,17],81:[2,17],90:[2,17],95:[2,17],97:[2,17],106:[2,17],108:[2,17],109:[2,17],110:[2,17],114:[2,17],122:[2,17],130:[2,17],132:[2,17],133:[2,17],136:[2,17],137:[2,17],138:[2,17],139:[2,17],140:[2,17],141:[2,17]},{1:[2,18],6:[2,18],28:[2,18],29:[2,18],52:[2,18],57:[2,18],60:[2,18],76:[2,18],81:[2,18],90:[2,18],95:[2,18],97:[2,18],106:[2,18],108:[2,18],109:[2,18],110:[2,18],114:[2,18],122:[2,18],130:[2,18],132:[2,18],133:[2,18],136:[2,18],137:[2,18],138:[2,18],139:[2,18],140:[2,18],141:[2,18]},{1:[2,19],6:[2,19],28:[2,19],29:[2,19],52:[2,19],57:[2,19],60:[2,19],76:[2,19],81:[2,19],90:[2,19],95:[2,19],97:[2,19],106:[2,19],108:[2,19],109:[2,19],110:[2,19],114:[2,19],122:[2,19],130:[2,19],132:[2,19],133:[2,19],136:[2,19],137:[2,19],138:[2,19],139:[2,19],140:[2,19],141:[2,19]},{1:[2,20],6:[2,20],28:[2,20],29:[2,20],52:[2,20],57:[2,20],60:[2,20],76:[2,20],81:[2,20],90:[2,20],95:[2,20],97:[2,20],106:[2,20],108:[2,20],109:[2,20],110:[2,20],114:[2,20],122:[2,20],130:[2,20],132:[2,20],133:[2,20],136:[2,20],137:[2,20],138:[2,20],139:[2,20],140:[2,20],141:[2,20]},{1:[2,21],6:[2,21],28:[2,21],29:[2,21],52:[2,21],57:[2,21],60:[2,21],76:[2,21],81:[2,21],90:[2,21],95:[2,21],97:[2,21],106:[2,21],108:[2,21],109:[2,21],110:[2,21],114:[2,21],122:[2,21],130:[2,21],132:[2,21],133:[2,21],136:[2,21],137:[2,21],138:[2,21],139:[2,21],140:[2,21],141:[2,21]},{1:[2,22],6:[2,22],28:[2,22],29:[2,22],52:[2,22],57:[2,22],60:[2,22],76:[2,22],81:[2,22],90:[2,22],95:[2,22],97:[2,22],106:[2,22],108:[2,22],109:[2,22],110:[2,22],114:[2,22],122:[2,22],130:[2,22],132:[2,22],133:[2,22],136:[2,22],137:[2,22],138:[2,22],139:[2,22],140:[2,22],141:[2,22]},{1:[2,23],6:[2,23],28:[2,23],29:[2,23],52:[2,23],57:[2,23],60:[2,23],76:[2,23],81:[2,23],90:[2,23],95:[2,23],97:[2,23],106:[2,23],108:[2,23],109:[2,23],110:[2,23],114:[2,23],122:[2,23],130:[2,23],132:[2,23],133:[2,23],136:[2,23],137:[2,23],138:[2,23],139:[2,23],140:[2,23],141:[2,23]},{1:[2,24],6:[2,24],28:[2,24],29:[2,24],52:[2,24],57:[2,24],60:[2,24],76:[2,24],81:[2,24],90:[2,24],95:[2,24],97:[2,24],106:[2,24],108:[2,24],109:[2,24],110:[2,24],114:[2,24],122:[2,24],130:[2,24],132:[2,24],133:[2,24],136:[2,24],137:[2,24],138:[2,24],139:[2,24],140:[2,24],141:[2,24]},{1:[2,25],6:[2,25],28:[2,25],29:[2,25],52:[2,25],57:[2,25],60:[2,25],76:[2,25],81:[2,25],90:[2,25],95:[2,25],97:[2,25],106:[2,25],108:[2,25],109:[2,25],110:[2,25],114:[2,25],122:[2,25],130:[2,25],132:[2,25],133:[2,25],136:[2,25],137:[2,25],138:[2,25],139:[2,25],140:[2,25],141:[2,25]},{1:[2,26],6:[2,26],28:[2,26],29:[2,26],52:[2,26],57:[2,26],60:[2,26],76:[2,26],81:[2,26],90:[2,26],95:[2,26],97:[2,26],106:[2,26],108:[2,26],109:[2,26],110:[2,26],114:[2,26],122:[2,26],130:[2,26],132:[2,26],133:[2,26],136:[2,26],137:[2,26],138:[2,26],139:[2,26],140:[2,26],141:[2,26]},{1:[2,8],6:[2,8],29:[2,8],106:[2,8],108:[2,8],110:[2,8],114:[2,8],130:[2,8]},{1:[2,9],6:[2,9],29:[2,9],106:[2,9],108:[2,9],110:[2,9],114:[2,9],130:[2,9]},{1:[2,10],6:[2,10],29:[2,10],106:[2,10],108:[2,10],110:[2,10],114:[2,10],130:[2,10]},{1:[2,11],6:[2,11],29:[2,11],106:[2,11],108:[2,11],110:[2,11],114:[2,11],130:[2,11]},{1:[2,78],6:[2,78],28:[2,78],29:[2,78],43:[1,103],52:[2,78],57:[2,78],60:[2,78],69:[2,78],70:[2,78],71:[2,78],72:[2,78],74:[2,78],76:[2,78],77:[2,78],81:[2,78],88:[2,78],89:[2,78],90:[2,78],95:[2,78],97:[2,78],106:[2,78],108:[2,78],109:[2,78],110:[2,78],114:[2,78],122:[2,78],130:[2,78],132:[2,78],133:[2,78],136:[2,78],137:[2,78],138:[2,78],139:[2,78],140:[2,78],141:[2,78]},{1:[2,79],6:[2,79],28:[2,79],29:[2,79],52:[2,79],57:[2,79],60:[2,79],69:[2,79],70:[2,79],71:[2,79],72:[2,79],74:[2,79],76:[2,79],77:[2,79],81:[2,79],88:[2,79],89:[2,79],90:[2,79],95:[2,79],97:[2,79],106:[2,79],108:[2,79],109:[2,79],110:[2,79],114:[2,79],122:[2,79],130:[2,79],132:[2,79],133:[2,79],136:[2,79],137:[2,79],138:[2,79],139:[2,79],140:[2,79],141:[2,79]},{1:[2,80],6:[2,80],28:[2,80],29:[2,80],52:[2,80],57:[2,80],60:[2,80],69:[2,80],70:[2,80],71:[2,80],72:[2,80],74:[2,80],76:[2,80],77:[2,80],81:[2,80],88:[2,80],89:[2,80],90:[2,80],95:[2,80],97:[2,80],106:[2,80],108:[2,80],109:[2,80],110:[2,80],114:[2,80],122:[2,80],130:[2,80],132:[2,80],133:[2,80],136:[2,80],137:[2,80],138:[2,80],139:[2,80],140:[2,80],141:[2,80]},{1:[2,81],6:[2,81],28:[2,81],29:[2,81],52:[2,81],57:[2,81],60:[2,81],69:[2,81],70:[2,81],71:[2,81],72:[2,81],74:[2,81],76:[2,81],77:[2,81],81:[2,81],88:[2,81],89:[2,81],90:[2,81],95:[2,81],97:[2,81],106:[2,81],108:[2,81],109:[2,81],110:[2,81],114:[2,81],122:[2,81],130:[2,81],132:[2,81],133:[2,81],136:[2,81],137:[2,81],138:[2,81],139:[2,81],140:[2,81],141:[2,81]},{1:[2,82],6:[2,82],28:[2,82],29:[2,82],52:[2,82],57:[2,82],60:[2,82],69:[2,82],70:[2,82],71:[2,82],72:[2,82],74:[2,82],76:[2,82],77:[2,82],81:[2,82],88:[2,82],89:[2,82],90:[2,82],95:[2,82],97:[2,82],106:[2,82],108:[2,82],109:[2,82],110:[2,82],114:[2,82],122:[2,82],130:[2,82],132:[2,82],133:[2,82],136:[2,82],137:[2,82],138:[2,82],139:[2,82],140:[2,82],141:[2,82]},{1:[2,110],6:[2,110],28:[2,110],29:[2,110],52:[2,110],57:[2,110],60:[2,110],69:[2,110],70:[2,110],71:[2,110],72:[2,110],74:[2,110],76:[2,110],77:[2,110],81:[2,110],85:104,88:[2,110],89:[1,105],90:[2,110],95:[2,110],97:[2,110],106:[2,110],108:[2,110],109:[2,110],110:[2,110],114:[2,110],122:[2,110],130:[2,110],132:[2,110],133:[2,110],136:[2,110],137:[2,110],138:[2,110],139:[2,110],140:[2,110],141:[2,110]},{6:[2,58],28:[2,58],30:109,31:[1,75],47:110,51:106,52:[2,58],57:[2,58],58:107,59:108,61:111,62:112,79:[1,72],93:[1,113],94:[1,114]},{14:115,28:[1,116]},{7:117,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:119,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:120,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{15:122,16:123,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:124,47:65,61:49,62:50,64:121,66:25,67:26,68:27,79:[1,72],86:[1,28],92:[1,60],93:[1,61],94:[1,59],105:[1,58]},{15:122,16:123,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:124,47:65,61:49,62:50,64:125,66:25,67:26,68:27,79:[1,72],86:[1,28],92:[1,60],93:[1,61],94:[1,59],105:[1,58]},{1:[2,75],6:[2,75],28:[2,75],29:[2,75],43:[2,75],52:[2,75],57:[2,75],60:[2,75],69:[2,75],70:[2,75],71:[2,75],72:[2,75],74:[2,75],76:[2,75],77:[2,75],81:[2,75],83:[1,129],88:[2,75],89:[2,75],90:[2,75],95:[2,75],97:[2,75],106:[2,75],108:[2,75],109:[2,75],110:[2,75],114:[2,75],122:[2,75],130:[2,75],132:[2,75],133:[2,75],134:[1,126],135:[1,127],136:[2,75],137:[2,75],138:[2,75],139:[2,75],140:[2,75],141:[2,75],142:[1,128]},{1:[2,188],6:[2,188],28:[2,188],29:[2,188],52:[2,188],57:[2,188],60:[2,188],76:[2,188],81:[2,188],90:[2,188],95:[2,188],97:[2,188],106:[2,188],108:[2,188],109:[2,188],110:[2,188],114:[2,188],122:[2,188],125:[1,130],130:[2,188],132:[2,188],133:[2,188],136:[2,188],137:[2,188],138:[2,188],139:[2,188],140:[2,188],141:[2,188]},{14:131,28:[1,116]},{14:132,28:[1,116]},{1:[2,155],6:[2,155],28:[2,155],29:[2,155],52:[2,155],57:[2,155],60:[2,155],76:[2,155],81:[2,155],90:[2,155],95:[2,155],97:[2,155],106:[2,155],108:[2,155],109:[2,155],110:[2,155],114:[2,155],122:[2,155],130:[2,155],132:[2,155],133:[2,155],136:[2,155],137:[2,155],138:[2,155],139:[2,155],140:[2,155],141:[2,155]},{14:133,28:[1,116]},{7:134,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,135],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,100],6:[2,100],14:136,15:122,16:123,28:[1,116],29:[2,100],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:124,47:65,52:[2,100],57:[2,100],60:[2,100],61:49,62:50,64:138,66:25,67:26,68:27,76:[2,100],79:[1,72],81:[2,100],83:[1,137],86:[1,28],90:[2,100],92:[1,60],93:[1,61],94:[1,59],95:[2,100],97:[2,100],105:[1,58],106:[2,100],108:[2,100],109:[2,100],110:[2,100],114:[2,100],122:[2,100],130:[2,100],132:[2,100],133:[2,100],136:[2,100],137:[2,100],138:[2,100],139:[2,100],140:[2,100],141:[2,100]},{7:139,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{85:140,89:[1,105]},{1:[2,50],6:[2,50],7:141,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,29:[2,50],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],106:[2,50],107:39,108:[2,50],110:[2,50],111:40,112:[1,69],113:41,114:[2,50],115:71,123:[1,42],128:37,129:[1,66],130:[2,50],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,51],6:[2,51],28:[2,51],29:[2,51],57:[2,51],81:[2,51],106:[2,51],108:[2,51],110:[2,51],114:[2,51],130:[2,51]},{7:143,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],14:142,15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,116],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,76],6:[2,76],28:[2,76],29:[2,76],43:[2,76],52:[2,76],57:[2,76],60:[2,76],69:[2,76],70:[2,76],71:[2,76],72:[2,76],74:[2,76],76:[2,76],77:[2,76],81:[2,76],88:[2,76],89:[2,76],90:[2,76],95:[2,76],97:[2,76],106:[2,76],108:[2,76],109:[2,76],110:[2,76],114:[2,76],122:[2,76],130:[2,76],132:[2,76],133:[2,76],136:[2,76],137:[2,76],138:[2,76],139:[2,76],140:[2,76],141:[2,76]},{1:[2,77],6:[2,77],28:[2,77],29:[2,77],43:[2,77],52:[2,77],57:[2,77],60:[2,77],69:[2,77],70:[2,77],71:[2,77],72:[2,77],74:[2,77],76:[2,77],77:[2,77],81:[2,77],88:[2,77],89:[2,77],90:[2,77],95:[2,77],97:[2,77],106:[2,77],108:[2,77],109:[2,77],110:[2,77],114:[2,77],122:[2,77],130:[2,77],132:[2,77],133:[2,77],136:[2,77],137:[2,77],138:[2,77],139:[2,77],140:[2,77],141:[2,77]},{1:[2,32],6:[2,32],28:[2,32],29:[2,32],52:[2,32],57:[2,32],60:[2,32],69:[2,32],70:[2,32],71:[2,32],72:[2,32],74:[2,32],76:[2,32],77:[2,32],81:[2,32],88:[2,32],89:[2,32],90:[2,32],95:[2,32],97:[2,32],106:[2,32],108:[2,32],109:[2,32],110:[2,32],114:[2,32],122:[2,32],130:[2,32],132:[2,32],133:[2,32],136:[2,32],137:[2,32],138:[2,32],139:[2,32],140:[2,32],141:[2,32]},{1:[2,33],6:[2,33],28:[2,33],29:[2,33],52:[2,33],57:[2,33],60:[2,33],69:[2,33],70:[2,33],71:[2,33],72:[2,33],74:[2,33],76:[2,33],77:[2,33],81:[2,33],88:[2,33],89:[2,33],90:[2,33],95:[2,33],97:[2,33],106:[2,33],108:[2,33],109:[2,33],110:[2,33],114:[2,33],122:[2,33],130:[2,33],132:[2,33],133:[2,33],136:[2,33],137:[2,33],138:[2,33],139:[2,33],140:[2,33],141:[2,33]},{1:[2,34],6:[2,34],28:[2,34],29:[2,34],52:[2,34],57:[2,34],60:[2,34],69:[2,34],70:[2,34],71:[2,34],72:[2,34],74:[2,34],76:[2,34],77:[2,34],81:[2,34],88:[2,34],89:[2,34],90:[2,34],95:[2,34],97:[2,34],106:[2,34],108:[2,34],109:[2,34],110:[2,34],114:[2,34],122:[2,34],130:[2,34],132:[2,34],133:[2,34],136:[2,34],137:[2,34],138:[2,34],139:[2,34],140:[2,34],141:[2,34]},{1:[2,35],6:[2,35],28:[2,35],29:[2,35],52:[2,35],57:[2,35],60:[2,35],69:[2,35],70:[2,35],71:[2,35],72:[2,35],74:[2,35],76:[2,35],77:[2,35],81:[2,35],88:[2,35],89:[2,35],90:[2,35],95:[2,35],97:[2,35],106:[2,35],108:[2,35],109:[2,35],110:[2,35],114:[2,35],122:[2,35],130:[2,35],132:[2,35],133:[2,35],136:[2,35],137:[2,35],138:[2,35],139:[2,35],140:[2,35],141:[2,35]},{1:[2,36],6:[2,36],28:[2,36],29:[2,36],52:[2,36],57:[2,36],60:[2,36],69:[2,36],70:[2,36],71:[2,36],72:[2,36],74:[2,36],76:[2,36],77:[2,36],81:[2,36],88:[2,36],89:[2,36],90:[2,36],95:[2,36],97:[2,36],106:[2,36],108:[2,36],109:[2,36],110:[2,36],114:[2,36],122:[2,36],130:[2,36],132:[2,36],133:[2,36],136:[2,36],137:[2,36],138:[2,36],139:[2,36],140:[2,36],141:[2,36]},{1:[2,37],6:[2,37],28:[2,37],29:[2,37],52:[2,37],57:[2,37],60:[2,37],69:[2,37],70:[2,37],71:[2,37],72:[2,37],74:[2,37],76:[2,37],77:[2,37],81:[2,37],88:[2,37],89:[2,37],90:[2,37],95:[2,37],97:[2,37],106:[2,37],108:[2,37],109:[2,37],110:[2,37],114:[2,37],122:[2,37],130:[2,37],132:[2,37],133:[2,37],136:[2,37],137:[2,37],138:[2,37],139:[2,37],140:[2,37],141:[2,37]},{1:[2,38],6:[2,38],28:[2,38],29:[2,38],52:[2,38],57:[2,38],60:[2,38],69:[2,38],70:[2,38],71:[2,38],72:[2,38],74:[2,38],76:[2,38],77:[2,38],81:[2,38],88:[2,38],89:[2,38],90:[2,38],95:[2,38],97:[2,38],106:[2,38],108:[2,38],109:[2,38],110:[2,38],114:[2,38],122:[2,38],130:[2,38],132:[2,38],133:[2,38],136:[2,38],137:[2,38],138:[2,38],139:[2,38],140:[2,38],141:[2,38]},{4:144,5:3,7:4,8:5,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,145],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:146,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,150],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,63:151,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],91:148,92:[1,60],93:[1,61],94:[1,59],95:[1,147],98:149,100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,117],6:[2,117],28:[2,117],29:[2,117],52:[2,117],57:[2,117],60:[2,117],69:[2,117],70:[2,117],71:[2,117],72:[2,117],74:[2,117],76:[2,117],77:[2,117],81:[2,117],88:[2,117],89:[2,117],90:[2,117],95:[2,117],97:[2,117],106:[2,117],108:[2,117],109:[2,117],110:[2,117],114:[2,117],122:[2,117],130:[2,117],132:[2,117],133:[2,117],136:[2,117],137:[2,117],138:[2,117],139:[2,117],140:[2,117],141:[2,117]},{1:[2,118],6:[2,118],28:[2,118],29:[2,118],30:152,31:[1,75],52:[2,118],57:[2,118],60:[2,118],69:[2,118],70:[2,118],71:[2,118],72:[2,118],74:[2,118],76:[2,118],77:[2,118],81:[2,118],88:[2,118],89:[2,118],90:[2,118],95:[2,118],97:[2,118],106:[2,118],108:[2,118],109:[2,118],110:[2,118],114:[2,118],122:[2,118],130:[2,118],132:[2,118],133:[2,118],136:[2,118],137:[2,118],138:[2,118],139:[2,118],140:[2,118],141:[2,118]},{28:[2,54]},{28:[2,55]},{1:[2,71],6:[2,71],28:[2,71],29:[2,71],43:[2,71],52:[2,71],57:[2,71],60:[2,71],69:[2,71],70:[2,71],71:[2,71],72:[2,71],74:[2,71],76:[2,71],77:[2,71],81:[2,71],83:[2,71],88:[2,71],89:[2,71],90:[2,71],95:[2,71],97:[2,71],106:[2,71],108:[2,71],109:[2,71],110:[2,71],114:[2,71],122:[2,71],130:[2,71],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71],138:[2,71],139:[2,71],140:[2,71],141:[2,71],142:[2,71]},{1:[2,74],6:[2,74],28:[2,74],29:[2,74],43:[2,74],52:[2,74],57:[2,74],60:[2,74],69:[2,74],70:[2,74],71:[2,74],72:[2,74],74:[2,74],76:[2,74],77:[2,74],81:[2,74],83:[2,74],88:[2,74],89:[2,74],90:[2,74],95:[2,74],97:[2,74],106:[2,74],108:[2,74],109:[2,74],110:[2,74],114:[2,74],122:[2,74],130:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74],137:[2,74],138:[2,74],139:[2,74],140:[2,74],141:[2,74],142:[2,74]},{7:153,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:154,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:155,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:157,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],14:156,15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,116],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{30:162,31:[1,75],47:163,61:164,62:165,67:158,79:[1,72],93:[1,113],94:[1,59],117:159,118:[1,160],119:161},{116:166,120:[1,167],121:[1,168]},{6:[2,95],10:172,28:[2,95],30:173,31:[1,75],32:174,33:[1,73],34:[1,74],44:170,45:171,47:175,49:[1,47],57:[2,95],80:169,81:[2,95],93:[1,113]},{1:[2,30],6:[2,30],28:[2,30],29:[2,30],46:[2,30],52:[2,30],57:[2,30],60:[2,30],69:[2,30],70:[2,30],71:[2,30],72:[2,30],74:[2,30],76:[2,30],77:[2,30],81:[2,30],88:[2,30],89:[2,30],90:[2,30],95:[2,30],97:[2,30],106:[2,30],108:[2,30],109:[2,30],110:[2,30],114:[2,30],122:[2,30],130:[2,30],132:[2,30],133:[2,30],136:[2,30],137:[2,30],138:[2,30],139:[2,30],140:[2,30],141:[2,30]},{1:[2,31],6:[2,31],28:[2,31],29:[2,31],46:[2,31],52:[2,31],57:[2,31],60:[2,31],69:[2,31],70:[2,31],71:[2,31],72:[2,31],74:[2,31],76:[2,31],77:[2,31],81:[2,31],88:[2,31],89:[2,31],90:[2,31],95:[2,31],97:[2,31],106:[2,31],108:[2,31],109:[2,31],110:[2,31],114:[2,31],122:[2,31],130:[2,31],132:[2,31],133:[2,31],136:[2,31],137:[2,31],138:[2,31],139:[2,31],140:[2,31],141:[2,31]},{1:[2,29],6:[2,29],28:[2,29],29:[2,29],43:[2,29],46:[2,29],52:[2,29],57:[2,29],60:[2,29],69:[2,29],70:[2,29],71:[2,29],72:[2,29],74:[2,29],76:[2,29],77:[2,29],81:[2,29],83:[2,29],88:[2,29],89:[2,29],90:[2,29],95:[2,29],97:[2,29],106:[2,29],108:[2,29],109:[2,29],110:[2,29],114:[2,29],120:[2,29],121:[2,29],122:[2,29],130:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29],137:[2,29],138:[2,29],139:[2,29],140:[2,29],141:[2,29],142:[2,29]},{1:[2,5],5:176,6:[2,5],7:4,8:5,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,29:[2,5],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],106:[2,5],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,199],6:[2,199],28:[2,199],29:[2,199],52:[2,199],57:[2,199],60:[2,199],76:[2,199],81:[2,199],90:[2,199],95:[2,199],97:[2,199],106:[2,199],108:[2,199],109:[2,199],110:[2,199],114:[2,199],122:[2,199],130:[2,199],132:[2,199],133:[2,199],136:[2,199],137:[2,199],138:[2,199],139:[2,199],140:[2,199],141:[2,199]},{7:177,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:178,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:179,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:180,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:181,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:182,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:183,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:184,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,154],6:[2,154],28:[2,154],29:[2,154],52:[2,154],57:[2,154],60:[2,154],76:[2,154],81:[2,154],90:[2,154],95:[2,154],97:[2,154],106:[2,154],108:[2,154],109:[2,154],110:[2,154],114:[2,154],122:[2,154],130:[2,154],132:[2,154],133:[2,154],136:[2,154],137:[2,154],138:[2,154],139:[2,154],140:[2,154],141:[2,154]},{1:[2,159],6:[2,159],28:[2,159],29:[2,159],52:[2,159],57:[2,159],60:[2,159],76:[2,159],81:[2,159],90:[2,159],95:[2,159],97:[2,159],106:[2,159],108:[2,159],109:[2,159],110:[2,159],114:[2,159],122:[2,159],130:[2,159],132:[2,159],133:[2,159],136:[2,159],137:[2,159],138:[2,159],139:[2,159],140:[2,159],141:[2,159]},{7:185,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,153],6:[2,153],28:[2,153],29:[2,153],52:[2,153],57:[2,153],60:[2,153],76:[2,153],81:[2,153],90:[2,153],95:[2,153],97:[2,153],106:[2,153],108:[2,153],109:[2,153],110:[2,153],114:[2,153],122:[2,153],130:[2,153],132:[2,153],133:[2,153],136:[2,153],137:[2,153],138:[2,153],139:[2,153],140:[2,153],141:[2,153]},{1:[2,158],6:[2,158],28:[2,158],29:[2,158],52:[2,158],57:[2,158],60:[2,158],76:[2,158],81:[2,158],90:[2,158],95:[2,158],97:[2,158],106:[2,158],108:[2,158],109:[2,158],110:[2,158],114:[2,158],122:[2,158],130:[2,158],132:[2,158],133:[2,158],136:[2,158],137:[2,158],138:[2,158],139:[2,158],140:[2,158],141:[2,158]},{85:186,89:[1,105]},{1:[2,72],6:[2,72],28:[2,72],29:[2,72],43:[2,72],52:[2,72],57:[2,72],60:[2,72],69:[2,72],70:[2,72],71:[2,72],72:[2,72],74:[2,72],76:[2,72],77:[2,72],81:[2,72],83:[2,72],88:[2,72],89:[2,72],90:[2,72],95:[2,72],97:[2,72],106:[2,72],108:[2,72],109:[2,72],110:[2,72],114:[2,72],122:[2,72],130:[2,72],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[2,72],138:[2,72],139:[2,72],140:[2,72],141:[2,72],142:[2,72]},{89:[2,114]},{27:188,30:187,31:[1,75],87:[1,45]},{30:189,31:[1,75]},{1:[2,88],6:[2,88],28:[2,88],29:[2,88],30:190,31:[1,75],43:[2,88],52:[2,88],57:[2,88],60:[2,88],69:[2,88],70:[2,88],71:[2,88],72:[2,88],74:[2,88],76:[2,88],77:[2,88],81:[2,88],83:[2,88],88:[2,88],89:[2,88],90:[2,88],95:[2,88],97:[2,88],106:[2,88],108:[2,88],109:[2,88],110:[2,88],114:[2,88],122:[2,88],130:[2,88],132:[2,88],133:[2,88],134:[2,88],135:[2,88],136:[2,88],137:[2,88],138:[2,88],139:[2,88],140:[2,88],141:[2,88],142:[2,88]},{30:191,31:[1,75]},{1:[2,89],6:[2,89],28:[2,89],29:[2,89],43:[2,89],52:[2,89],57:[2,89],60:[2,89],69:[2,89],70:[2,89],71:[2,89],72:[2,89],74:[2,89],76:[2,89],77:[2,89],81:[2,89],83:[2,89],88:[2,89],89:[2,89],90:[2,89],95:[2,89],97:[2,89],106:[2,89],108:[2,89],109:[2,89],110:[2,89],114:[2,89],122:[2,89],130:[2,89],132:[2,89],133:[2,89],134:[2,89],135:[2,89],136:[2,89],137:[2,89],138:[2,89],139:[2,89],140:[2,89],141:[2,89],142:[2,89]},{7:193,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],60:[1,197],61:49,62:50,64:36,66:25,67:26,68:27,75:192,78:194,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],96:195,97:[1,196],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{73:198,74:[1,99],77:[1,100]},{85:199,89:[1,105]},{1:[2,73],6:[2,73],28:[2,73],29:[2,73],43:[2,73],52:[2,73],57:[2,73],60:[2,73],69:[2,73],70:[2,73],71:[2,73],72:[2,73],74:[2,73],76:[2,73],77:[2,73],81:[2,73],83:[2,73],88:[2,73],89:[2,73],90:[2,73],95:[2,73],97:[2,73],106:[2,73],108:[2,73],109:[2,73],110:[2,73],114:[2,73],122:[2,73],130:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73],137:[2,73],138:[2,73],139:[2,73],140:[2,73],141:[2,73],142:[2,73]},{6:[1,201],7:200,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,202],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,111],6:[2,111],28:[2,111],29:[2,111],52:[2,111],57:[2,111],60:[2,111],69:[2,111],70:[2,111],71:[2,111],72:[2,111],74:[2,111],76:[2,111],77:[2,111],81:[2,111],88:[2,111],89:[2,111],90:[2,111],95:[2,111],97:[2,111],106:[2,111],108:[2,111],109:[2,111],110:[2,111],114:[2,111],122:[2,111],130:[2,111],132:[2,111],133:[2,111],136:[2,111],137:[2,111],138:[2,111],139:[2,111],140:[2,111],141:[2,111]},{7:205,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,150],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,63:151,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],90:[1,203],91:204,92:[1,60],93:[1,61],94:[1,59],98:149,100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{6:[2,56],28:[2,56],52:[1,206],56:208,57:[1,207]},{6:[2,59],28:[2,59],29:[2,59],52:[2,59],57:[2,59]},{6:[2,63],28:[2,63],29:[2,63],43:[1,210],52:[2,63],57:[2,63],60:[1,209]},{6:[2,66],28:[2,66],29:[2,66],43:[2,66],52:[2,66],57:[2,66],60:[2,66]},{6:[2,67],28:[2,67],29:[2,67],43:[2,67],52:[2,67],57:[2,67],60:[2,67]},{6:[2,68],28:[2,68],29:[2,68],43:[2,68],52:[2,68],57:[2,68],60:[2,68]},{6:[2,69],28:[2,69],29:[2,69],43:[2,69],52:[2,69],57:[2,69],60:[2,69]},{30:152,31:[1,75]},{7:205,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,150],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,63:151,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],91:148,92:[1,60],93:[1,61],94:[1,59],95:[1,147],98:149,100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,53],6:[2,53],28:[2,53],29:[2,53],52:[2,53],57:[2,53],60:[2,53],76:[2,53],81:[2,53],90:[2,53],95:[2,53],97:[2,53],106:[2,53],108:[2,53],109:[2,53],110:[2,53],114:[2,53],122:[2,53],130:[2,53],132:[2,53],133:[2,53],136:[2,53],137:[2,53],138:[2,53],139:[2,53],140:[2,53],141:[2,53]},{4:212,5:3,7:4,8:5,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,29:[1,211],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,192],6:[2,192],28:[2,192],29:[2,192],52:[2,192],57:[2,192],60:[2,192],76:[2,192],81:[2,192],90:[2,192],95:[2,192],97:[2,192],106:[2,192],107:86,108:[2,192],109:[2,192],110:[2,192],113:87,114:[2,192],115:71,122:[2,192],130:[2,192],132:[2,192],133:[2,192],136:[1,77],137:[2,192],138:[2,192],139:[2,192],140:[2,192],141:[2,192]},{107:89,108:[1,67],110:[1,68],113:90,114:[1,70],115:71,130:[1,88]},{1:[2,193],6:[2,193],28:[2,193],29:[2,193],52:[2,193],57:[2,193],60:[2,193],76:[2,193],81:[2,193],90:[2,193],95:[2,193],97:[2,193],106:[2,193],107:86,108:[2,193],109:[2,193],110:[2,193],113:87,114:[2,193],115:71,122:[2,193],130:[2,193],132:[2,193],133:[2,193],136:[1,77],137:[2,193],138:[2,193],139:[2,193],140:[2,193],141:[2,193]},{1:[2,194],6:[2,194],28:[2,194],29:[2,194],52:[2,194],57:[2,194],60:[2,194],76:[2,194],81:[2,194],90:[2,194],95:[2,194],97:[2,194],106:[2,194],107:86,108:[2,194],109:[2,194],110:[2,194],113:87,114:[2,194],115:71,122:[2,194],130:[2,194],132:[2,194],133:[2,194],136:[1,77],137:[2,194],138:[2,194],139:[2,194],140:[2,194],141:[2,194]},{1:[2,195],6:[2,195],28:[2,195],29:[2,195],52:[2,195],57:[2,195],60:[2,195],69:[2,75],70:[2,75],71:[2,75],72:[2,75],74:[2,75],76:[2,195],77:[2,75],81:[2,195],88:[2,75],89:[2,75],90:[2,195],95:[2,195],97:[2,195],106:[2,195],108:[2,195],109:[2,195],110:[2,195],114:[2,195],122:[2,195],130:[2,195],132:[2,195],133:[2,195],136:[2,195],137:[2,195],138:[2,195],139:[2,195],140:[2,195],141:[2,195]},{65:92,69:[1,94],70:[1,95],71:[1,96],72:[1,97],73:98,74:[1,99],77:[1,100],84:91,88:[1,93],89:[2,113]},{65:102,69:[1,94],70:[1,95],71:[1,96],72:[1,97],73:98,74:[1,99],77:[1,100],84:101,88:[1,93],89:[2,113]},{69:[2,78],70:[2,78],71:[2,78],72:[2,78],74:[2,78],77:[2,78],88:[2,78],89:[2,78]},{1:[2,196],6:[2,196],28:[2,196],29:[2,196],52:[2,196],57:[2,196],60:[2,196],69:[2,75],70:[2,75],71:[2,75],72:[2,75],74:[2,75],76:[2,196],77:[2,75],81:[2,196],88:[2,75],89:[2,75],90:[2,196],95:[2,196],97:[2,196],106:[2,196],108:[2,196],109:[2,196],110:[2,196],114:[2,196],122:[2,196],130:[2,196],132:[2,196],133:[2,196],136:[2,196],137:[2,196],138:[2,196],139:[2,196],140:[2,196],141:[2,196]},{1:[2,197],6:[2,197],28:[2,197],29:[2,197],52:[2,197],57:[2,197],60:[2,197],76:[2,197],81:[2,197],90:[2,197],95:[2,197],97:[2,197],106:[2,197],108:[2,197],109:[2,197],110:[2,197],114:[2,197],122:[2,197],130:[2,197],132:[2,197],133:[2,197],136:[2,197],137:[2,197],138:[2,197],139:[2,197],140:[2,197],141:[2,197]},{1:[2,198],6:[2,198],28:[2,198],29:[2,198],52:[2,198],57:[2,198],60:[2,198],76:[2,198],81:[2,198],90:[2,198],95:[2,198],97:[2,198],106:[2,198],108:[2,198],109:[2,198],110:[2,198],114:[2,198],122:[2,198],130:[2,198],132:[2,198],133:[2,198],136:[2,198],137:[2,198],138:[2,198],139:[2,198],140:[2,198],141:[2,198]},{6:[1,215],7:213,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,214],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:216,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{14:217,28:[1,116],129:[1,218]},{1:[2,138],6:[2,138],28:[2,138],29:[2,138],52:[2,138],57:[2,138],60:[2,138],76:[2,138],81:[2,138],90:[2,138],95:[2,138],97:[2,138],101:219,102:[1,220],103:[1,221],106:[2,138],108:[2,138],109:[2,138],110:[2,138],114:[2,138],122:[2,138],130:[2,138],132:[2,138],133:[2,138],136:[2,138],137:[2,138],138:[2,138],139:[2,138],140:[2,138],141:[2,138]},{1:[2,152],6:[2,152],28:[2,152],29:[2,152],52:[2,152],57:[2,152],60:[2,152],76:[2,152],81:[2,152],90:[2,152],95:[2,152],97:[2,152],106:[2,152],108:[2,152],109:[2,152],110:[2,152],114:[2,152],122:[2,152],130:[2,152],132:[2,152],133:[2,152],136:[2,152],137:[2,152],138:[2,152],139:[2,152],140:[2,152],141:[2,152]},{1:[2,160],6:[2,160],28:[2,160],29:[2,160],52:[2,160],57:[2,160],60:[2,160],76:[2,160],81:[2,160],90:[2,160],95:[2,160],97:[2,160],106:[2,160],108:[2,160],109:[2,160],110:[2,160],114:[2,160],122:[2,160],130:[2,160],132:[2,160],133:[2,160],136:[2,160],137:[2,160],138:[2,160],139:[2,160],140:[2,160],141:[2,160]},{28:[1,222],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{124:223,126:224,127:[1,225]},{1:[2,101],6:[2,101],28:[2,101],29:[2,101],52:[2,101],57:[2,101],60:[2,101],76:[2,101],81:[2,101],90:[2,101],95:[2,101],97:[2,101],106:[2,101],108:[2,101],109:[2,101],110:[2,101],114:[2,101],122:[2,101],130:[2,101],132:[2,101],133:[2,101],136:[2,101],137:[2,101],138:[2,101],139:[2,101],140:[2,101],141:[2,101]},{7:226,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,104],6:[2,104],14:227,28:[1,116],29:[2,104],52:[2,104],57:[2,104],60:[2,104],69:[2,75],70:[2,75],71:[2,75],72:[2,75],74:[2,75],76:[2,104],77:[2,75],81:[2,104],83:[1,228],88:[2,75],89:[2,75],90:[2,104],95:[2,104],97:[2,104],106:[2,104],108:[2,104],109:[2,104],110:[2,104],114:[2,104],122:[2,104],130:[2,104],132:[2,104],133:[2,104],136:[2,104],137:[2,104],138:[2,104],139:[2,104],140:[2,104],141:[2,104]},{1:[2,145],6:[2,145],28:[2,145],29:[2,145],52:[2,145],57:[2,145],60:[2,145],76:[2,145],81:[2,145],90:[2,145],95:[2,145],97:[2,145],106:[2,145],107:86,108:[2,145],109:[2,145],110:[2,145],113:87,114:[2,145],115:71,122:[2,145],130:[2,145],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,112],6:[2,112],28:[2,112],29:[2,112],43:[2,112],52:[2,112],57:[2,112],60:[2,112],69:[2,112],70:[2,112],71:[2,112],72:[2,112],74:[2,112],76:[2,112],77:[2,112],81:[2,112],83:[2,112],88:[2,112],89:[2,112],90:[2,112],95:[2,112],97:[2,112],106:[2,112],108:[2,112],109:[2,112],110:[2,112],114:[2,112],122:[2,112],130:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112],137:[2,112],138:[2,112],139:[2,112],140:[2,112],141:[2,112],142:[2,112]},{1:[2,49],6:[2,49],29:[2,49],106:[2,49],107:86,108:[2,49],110:[2,49],113:87,114:[2,49],115:71,130:[2,49],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,12],6:[2,12],29:[2,12],106:[2,12],108:[2,12],110:[2,12],114:[2,12],130:[2,12]},{1:[2,13],6:[2,13],29:[2,13],106:[2,13],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[2,13],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{6:[1,76],106:[1,229]},{4:230,5:3,7:4,8:5,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{6:[2,134],28:[2,134],57:[2,134],60:[1,232],95:[2,134],96:231,97:[1,196],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,120],6:[2,120],28:[2,120],29:[2,120],43:[2,120],52:[2,120],57:[2,120],60:[2,120],69:[2,120],70:[2,120],71:[2,120],72:[2,120],74:[2,120],76:[2,120],77:[2,120],81:[2,120],88:[2,120],89:[2,120],90:[2,120],95:[2,120],97:[2,120],106:[2,120],108:[2,120],109:[2,120],110:[2,120],114:[2,120],120:[2,120],121:[2,120],122:[2,120],130:[2,120],132:[2,120],133:[2,120],136:[2,120],137:[2,120],138:[2,120],139:[2,120],140:[2,120],141:[2,120]},{6:[2,56],28:[2,56],56:233,57:[1,234],95:[2,56]},{6:[2,129],28:[2,129],29:[2,129],57:[2,129],90:[2,129],95:[2,129]},{7:205,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,150],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,63:151,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],91:235,92:[1,60],93:[1,61],94:[1,59],98:149,100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{6:[2,135],28:[2,135],29:[2,135],57:[2,135],90:[2,135],95:[2,135]},{1:[2,119],6:[2,119],28:[2,119],29:[2,119],43:[2,119],46:[2,119],52:[2,119],57:[2,119],60:[2,119],69:[2,119],70:[2,119],71:[2,119],72:[2,119],74:[2,119],76:[2,119],77:[2,119],81:[2,119],83:[2,119],88:[2,119],89:[2,119],90:[2,119],95:[2,119],97:[2,119],106:[2,119],108:[2,119],109:[2,119],110:[2,119],114:[2,119],120:[2,119],121:[2,119],122:[2,119],130:[2,119],132:[2,119],133:[2,119],134:[2,119],135:[2,119],136:[2,119],137:[2,119],138:[2,119],139:[2,119],140:[2,119],141:[2,119],142:[2,119]},{14:236,28:[1,116],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,148],6:[2,148],28:[2,148],29:[2,148],52:[2,148],57:[2,148],60:[2,148],76:[2,148],81:[2,148],90:[2,148],95:[2,148],97:[2,148],106:[2,148],107:86,108:[1,67],109:[1,237],110:[1,68],113:87,114:[1,70],115:71,122:[2,148],130:[2,148],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,150],6:[2,150],28:[2,150],29:[2,150],52:[2,150],57:[2,150],60:[2,150],76:[2,150],81:[2,150],90:[2,150],95:[2,150],97:[2,150],106:[2,150],107:86,108:[1,67],109:[1,238],110:[1,68],113:87,114:[1,70],115:71,122:[2,150],130:[2,150],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,156],6:[2,156],28:[2,156],29:[2,156],52:[2,156],57:[2,156],60:[2,156],76:[2,156],81:[2,156],90:[2,156],95:[2,156],97:[2,156],106:[2,156],108:[2,156],109:[2,156],110:[2,156],114:[2,156],122:[2,156],130:[2,156],132:[2,156],133:[2,156],136:[2,156],137:[2,156],138:[2,156],139:[2,156],140:[2,156],141:[2,156]},{1:[2,157],6:[2,157],28:[2,157],29:[2,157],52:[2,157],57:[2,157],60:[2,157],76:[2,157],81:[2,157],90:[2,157],95:[2,157],97:[2,157],106:[2,157],107:86,108:[1,67],109:[2,157],110:[1,68],113:87,114:[1,70],115:71,122:[2,157],130:[2,157],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,161],6:[2,161],28:[2,161],29:[2,161],52:[2,161],57:[2,161],60:[2,161],76:[2,161],81:[2,161],90:[2,161],95:[2,161],97:[2,161],106:[2,161],108:[2,161],109:[2,161],110:[2,161],114:[2,161],122:[2,161],130:[2,161],132:[2,161],133:[2,161],136:[2,161],137:[2,161],138:[2,161],139:[2,161],140:[2,161],141:[2,161]},{120:[2,163],121:[2,163]},{30:162,31:[1,75],47:163,61:164,62:165,79:[1,72],93:[1,113],94:[1,114],117:239,119:161},{57:[1,240],120:[2,169],121:[2,169]},{57:[2,165],120:[2,165],121:[2,165]},{57:[2,166],120:[2,166],121:[2,166]},{57:[2,167],120:[2,167],121:[2,167]},{57:[2,168],120:[2,168],121:[2,168]},{1:[2,162],6:[2,162],28:[2,162],29:[2,162],52:[2,162],57:[2,162],60:[2,162],76:[2,162],81:[2,162],90:[2,162],95:[2,162],97:[2,162],106:[2,162],108:[2,162],109:[2,162],110:[2,162],114:[2,162],122:[2,162],130:[2,162],132:[2,162],133:[2,162],136:[2,162],137:[2,162],138:[2,162],139:[2,162],140:[2,162],141:[2,162]},{7:241,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:242,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{6:[2,56],28:[2,56],56:243,57:[1,244],81:[2,56]},{6:[2,96],28:[2,96],29:[2,96],57:[2,96],81:[2,96]},{6:[2,42],28:[2,42],29:[2,42],46:[1,245],57:[2,42],81:[2,42]},{6:[2,45],28:[2,45],29:[2,45],57:[2,45],81:[2,45]},{6:[2,46],28:[2,46],29:[2,46],46:[2,46],57:[2,46],81:[2,46]},{6:[2,47],28:[2,47],29:[2,47],46:[2,47],57:[2,47],81:[2,47]},{6:[2,48],28:[2,48],29:[2,48],46:[2,48],57:[2,48],81:[2,48]},{1:[2,4],6:[2,4],29:[2,4],106:[2,4]},{1:[2,200],6:[2,200],28:[2,200],29:[2,200],52:[2,200],57:[2,200],60:[2,200],76:[2,200],81:[2,200],90:[2,200],95:[2,200],97:[2,200],106:[2,200],107:86,108:[2,200],109:[2,200],110:[2,200],113:87,114:[2,200],115:71,122:[2,200],130:[2,200],132:[2,200],133:[2,200],136:[1,77],137:[1,80],138:[2,200],139:[2,200],140:[2,200],141:[2,200]},{1:[2,201],6:[2,201],28:[2,201],29:[2,201],52:[2,201],57:[2,201],60:[2,201],76:[2,201],81:[2,201],90:[2,201],95:[2,201],97:[2,201],106:[2,201],107:86,108:[2,201],109:[2,201],110:[2,201],113:87,114:[2,201],115:71,122:[2,201],130:[2,201],132:[2,201],133:[2,201],136:[1,77],137:[1,80],138:[2,201],139:[2,201],140:[2,201],141:[2,201]},{1:[2,202],6:[2,202],28:[2,202],29:[2,202],52:[2,202],57:[2,202],60:[2,202],76:[2,202],81:[2,202],90:[2,202],95:[2,202],97:[2,202],106:[2,202],107:86,108:[2,202],109:[2,202],110:[2,202],113:87,114:[2,202],115:71,122:[2,202],130:[2,202],132:[2,202],133:[2,202],136:[1,77],137:[2,202],138:[2,202],139:[2,202],140:[2,202],141:[2,202]},{1:[2,203],6:[2,203],28:[2,203],29:[2,203],52:[2,203],57:[2,203],60:[2,203],76:[2,203],81:[2,203],90:[2,203],95:[2,203],97:[2,203],106:[2,203],107:86,108:[2,203],109:[2,203],110:[2,203],113:87,114:[2,203],115:71,122:[2,203],130:[2,203],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[2,203],139:[2,203],140:[2,203],141:[2,203]},{1:[2,204],6:[2,204],28:[2,204],29:[2,204],52:[2,204],57:[2,204],60:[2,204],76:[2,204],81:[2,204],90:[2,204],95:[2,204],97:[2,204],106:[2,204],107:86,108:[2,204],109:[2,204],110:[2,204],113:87,114:[2,204],115:71,122:[2,204],130:[2,204],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[2,204],140:[2,204],141:[1,84]},{1:[2,205],6:[2,205],28:[2,205],29:[2,205],52:[2,205],57:[2,205],60:[2,205],76:[2,205],81:[2,205],90:[2,205],95:[2,205],97:[2,205],106:[2,205],107:86,108:[2,205],109:[2,205],110:[2,205],113:87,114:[2,205],115:71,122:[2,205],130:[2,205],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[2,205],141:[1,84]},{1:[2,206],6:[2,206],28:[2,206],29:[2,206],52:[2,206],57:[2,206],60:[2,206],76:[2,206],81:[2,206],90:[2,206],95:[2,206],97:[2,206],106:[2,206],107:86,108:[2,206],109:[2,206],110:[2,206],113:87,114:[2,206],115:71,122:[2,206],130:[2,206],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[2,206],140:[2,206],141:[2,206]},{1:[2,191],6:[2,191],28:[2,191],29:[2,191],52:[2,191],57:[2,191],60:[2,191],76:[2,191],81:[2,191],90:[2,191],95:[2,191],97:[2,191],106:[2,191],107:86,108:[1,67],109:[2,191],110:[1,68],113:87,114:[1,70],115:71,122:[2,191],130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,190],6:[2,190],28:[2,190],29:[2,190],52:[2,190],57:[2,190],60:[2,190],76:[2,190],81:[2,190],90:[2,190],95:[2,190],97:[2,190],106:[2,190],107:86,108:[1,67],109:[2,190],110:[1,68],113:87,114:[1,70],115:71,122:[2,190],130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,108],6:[2,108],28:[2,108],29:[2,108],52:[2,108],57:[2,108],60:[2,108],69:[2,108],70:[2,108],71:[2,108],72:[2,108],74:[2,108],76:[2,108],77:[2,108],81:[2,108],88:[2,108],89:[2,108],90:[2,108],95:[2,108],97:[2,108],106:[2,108],108:[2,108],109:[2,108],110:[2,108],114:[2,108],122:[2,108],130:[2,108],132:[2,108],133:[2,108],136:[2,108],137:[2,108],138:[2,108],139:[2,108],140:[2,108],141:[2,108]},{1:[2,83],6:[2,83],28:[2,83],29:[2,83],43:[2,83],52:[2,83],57:[2,83],60:[2,83],69:[2,83],70:[2,83],71:[2,83],72:[2,83],74:[2,83],76:[2,83],77:[2,83],81:[2,83],83:[2,83],88:[2,83],89:[2,83],90:[2,83],95:[2,83],97:[2,83],106:[2,83],108:[2,83],109:[2,83],110:[2,83],114:[2,83],122:[2,83],130:[2,83],132:[2,83],133:[2,83],134:[2,83],135:[2,83],136:[2,83],137:[2,83],138:[2,83],139:[2,83],140:[2,83],141:[2,83],142:[2,83]},{1:[2,84],6:[2,84],28:[2,84],29:[2,84],43:[2,84],52:[2,84],57:[2,84],60:[2,84],69:[2,84],70:[2,84],71:[2,84],72:[2,84],74:[2,84],76:[2,84],77:[2,84],81:[2,84],83:[2,84],88:[2,84],89:[2,84],90:[2,84],95:[2,84],97:[2,84],106:[2,84],108:[2,84],109:[2,84],110:[2,84],114:[2,84],122:[2,84],130:[2,84],132:[2,84],133:[2,84],134:[2,84],135:[2,84],136:[2,84],137:[2,84],138:[2,84],139:[2,84],140:[2,84],141:[2,84],142:[2,84]},{1:[2,85],6:[2,85],28:[2,85],29:[2,85],43:[2,85],52:[2,85],57:[2,85],60:[2,85],69:[2,85],70:[2,85],71:[2,85],72:[2,85],74:[2,85],76:[2,85],77:[2,85],81:[2,85],83:[2,85],88:[2,85],89:[2,85],90:[2,85],95:[2,85],97:[2,85],106:[2,85],108:[2,85],109:[2,85],110:[2,85],114:[2,85],122:[2,85],130:[2,85],132:[2,85],133:[2,85],134:[2,85],135:[2,85],136:[2,85],137:[2,85],138:[2,85],139:[2,85],140:[2,85],141:[2,85],142:[2,85]},{1:[2,86],6:[2,86],28:[2,86],29:[2,86],43:[2,86],52:[2,86],57:[2,86],60:[2,86],69:[2,86],70:[2,86],71:[2,86],72:[2,86],74:[2,86],76:[2,86],77:[2,86],81:[2,86],83:[2,86],88:[2,86],89:[2,86],90:[2,86],95:[2,86],97:[2,86],106:[2,86],108:[2,86],109:[2,86],110:[2,86],114:[2,86],122:[2,86],130:[2,86],132:[2,86],133:[2,86],134:[2,86],135:[2,86],136:[2,86],137:[2,86],138:[2,86],139:[2,86],140:[2,86],141:[2,86],142:[2,86]},{1:[2,87],6:[2,87],28:[2,87],29:[2,87],43:[2,87],52:[2,87],57:[2,87],60:[2,87],69:[2,87],70:[2,87],71:[2,87],72:[2,87],74:[2,87],76:[2,87],77:[2,87],81:[2,87],83:[2,87],88:[2,87],89:[2,87],90:[2,87],95:[2,87],97:[2,87],106:[2,87],108:[2,87],109:[2,87],110:[2,87],114:[2,87],122:[2,87],130:[2,87],132:[2,87],133:[2,87],134:[2,87],135:[2,87],136:[2,87],137:[2,87],138:[2,87],139:[2,87],140:[2,87],141:[2,87],142:[2,87]},{76:[1,246]},{60:[1,197],76:[2,92],96:247,97:[1,196],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{76:[2,93]},{7:248,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,76:[2,128],79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{11:[2,122],13:[2,122],31:[2,122],33:[2,122],34:[2,122],36:[2,122],37:[2,122],38:[2,122],39:[2,122],40:[2,122],41:[2,122],48:[2,122],49:[2,122],50:[2,122],54:[2,122],55:[2,122],76:[2,122],79:[2,122],82:[2,122],86:[2,122],87:[2,122],92:[2,122],93:[2,122],94:[2,122],100:[2,122],104:[2,122],105:[2,122],108:[2,122],110:[2,122],112:[2,122],114:[2,122],123:[2,122],129:[2,122],131:[2,122],132:[2,122],133:[2,122],134:[2,122],135:[2,122]},{11:[2,123],13:[2,123],31:[2,123],33:[2,123],34:[2,123],36:[2,123],37:[2,123],38:[2,123],39:[2,123],40:[2,123],41:[2,123],48:[2,123],49:[2,123],50:[2,123],54:[2,123],55:[2,123],76:[2,123],79:[2,123],82:[2,123],86:[2,123],87:[2,123],92:[2,123],93:[2,123],94:[2,123],100:[2,123],104:[2,123],105:[2,123],108:[2,123],110:[2,123],112:[2,123],114:[2,123],123:[2,123],129:[2,123],131:[2,123],132:[2,123],133:[2,123],134:[2,123],135:[2,123]},{1:[2,91],6:[2,91],28:[2,91],29:[2,91],43:[2,91],52:[2,91],57:[2,91],60:[2,91],69:[2,91],70:[2,91],71:[2,91],72:[2,91],74:[2,91],76:[2,91],77:[2,91],81:[2,91],83:[2,91],88:[2,91],89:[2,91],90:[2,91],95:[2,91],97:[2,91],106:[2,91],108:[2,91],109:[2,91],110:[2,91],114:[2,91],122:[2,91],130:[2,91],132:[2,91],133:[2,91],134:[2,91],135:[2,91],136:[2,91],137:[2,91],138:[2,91],139:[2,91],140:[2,91],141:[2,91],142:[2,91]},{1:[2,109],6:[2,109],28:[2,109],29:[2,109],52:[2,109],57:[2,109],60:[2,109],69:[2,109],70:[2,109],71:[2,109],72:[2,109],74:[2,109],76:[2,109],77:[2,109],81:[2,109],88:[2,109],89:[2,109],90:[2,109],95:[2,109],97:[2,109],106:[2,109],108:[2,109],109:[2,109],110:[2,109],114:[2,109],122:[2,109],130:[2,109],132:[2,109],133:[2,109],136:[2,109],137:[2,109],138:[2,109],139:[2,109],140:[2,109],141:[2,109]},{1:[2,39],6:[2,39],28:[2,39],29:[2,39],52:[2,39],57:[2,39],60:[2,39],76:[2,39],81:[2,39],90:[2,39],95:[2,39],97:[2,39],106:[2,39],107:86,108:[2,39],109:[2,39],110:[2,39],113:87,114:[2,39],115:71,122:[2,39],130:[2,39],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{7:249,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:250,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,115],6:[2,115],28:[2,115],29:[2,115],43:[2,115],52:[2,115],57:[2,115],60:[2,115],69:[2,115],70:[2,115],71:[2,115],72:[2,115],74:[2,115],76:[2,115],77:[2,115],81:[2,115],83:[2,115],88:[2,115],89:[2,115],90:[2,115],95:[2,115],97:[2,115],106:[2,115],108:[2,115],109:[2,115],110:[2,115],114:[2,115],122:[2,115],130:[2,115],132:[2,115],133:[2,115],134:[2,115],135:[2,115],136:[2,115],137:[2,115],138:[2,115],139:[2,115],140:[2,115],141:[2,115],142:[2,115]},{6:[2,56],28:[2,56],56:251,57:[1,234],90:[2,56]},{6:[2,134],28:[2,134],29:[2,134],57:[2,134],60:[1,252],90:[2,134],95:[2,134],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{53:253,54:[1,62],55:[1,63]},{6:[2,57],28:[2,57],29:[2,57],30:109,31:[1,75],47:110,58:254,59:108,61:111,62:112,79:[1,72],93:[1,113],94:[1,114]},{6:[1,255],28:[1,256]},{6:[2,64],28:[2,64],29:[2,64],52:[2,64],57:[2,64]},{7:257,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,27],6:[2,27],28:[2,27],29:[2,27],52:[2,27],57:[2,27],60:[2,27],76:[2,27],81:[2,27],90:[2,27],95:[2,27],97:[2,27],102:[2,27],103:[2,27],106:[2,27],108:[2,27],109:[2,27],110:[2,27],114:[2,27],122:[2,27],125:[2,27],127:[2,27],130:[2,27],132:[2,27],133:[2,27],136:[2,27],137:[2,27],138:[2,27],139:[2,27],140:[2,27],141:[2,27]},{6:[1,76],29:[1,258]},{1:[2,207],6:[2,207],28:[2,207],29:[2,207],52:[2,207],57:[2,207],60:[2,207],76:[2,207],81:[2,207],90:[2,207],95:[2,207],97:[2,207],106:[2,207],107:86,108:[2,207],109:[2,207],110:[2,207],113:87,114:[2,207],115:71,122:[2,207],130:[2,207],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{7:259,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:260,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,210],6:[2,210],28:[2,210],29:[2,210],52:[2,210],57:[2,210],60:[2,210],76:[2,210],81:[2,210],90:[2,210],95:[2,210],97:[2,210],106:[2,210],107:86,108:[2,210],109:[2,210],110:[2,210],113:87,114:[2,210],115:71,122:[2,210],130:[2,210],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,189],6:[2,189],28:[2,189],29:[2,189],52:[2,189],57:[2,189],60:[2,189],76:[2,189],81:[2,189],90:[2,189],95:[2,189],97:[2,189],106:[2,189],108:[2,189],109:[2,189],110:[2,189],114:[2,189],122:[2,189],130:[2,189],132:[2,189],133:[2,189],136:[2,189],137:[2,189],138:[2,189],139:[2,189],140:[2,189],141:[2,189]},{7:261,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,139],6:[2,139],28:[2,139],29:[2,139],52:[2,139],57:[2,139],60:[2,139],76:[2,139],81:[2,139],90:[2,139],95:[2,139],97:[2,139],102:[1,262],106:[2,139],108:[2,139],109:[2,139],110:[2,139],114:[2,139],122:[2,139],130:[2,139],132:[2,139],133:[2,139],136:[2,139],137:[2,139],138:[2,139],139:[2,139],140:[2,139],141:[2,139]},{14:263,28:[1,116]},{14:266,28:[1,116],30:264,31:[1,75],62:265,79:[1,72]},{124:267,126:224,127:[1,225]},{29:[1,268],125:[1,269],126:270,127:[1,225]},{29:[2,182],125:[2,182],127:[2,182]},{7:272,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],99:271,100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,102],6:[2,102],14:273,28:[1,116],29:[2,102],52:[2,102],57:[2,102],60:[2,102],76:[2,102],81:[2,102],90:[2,102],95:[2,102],97:[2,102],106:[2,102],107:86,108:[1,67],109:[2,102],110:[1,68],113:87,114:[1,70],115:71,122:[2,102],130:[2,102],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,105],6:[2,105],28:[2,105],29:[2,105],52:[2,105],57:[2,105],60:[2,105],76:[2,105],81:[2,105],90:[2,105],95:[2,105],97:[2,105],106:[2,105],108:[2,105],109:[2,105],110:[2,105],114:[2,105],122:[2,105],130:[2,105],132:[2,105],133:[2,105],136:[2,105],137:[2,105],138:[2,105],139:[2,105],140:[2,105],141:[2,105]},{7:274,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,146],6:[2,146],28:[2,146],29:[2,146],52:[2,146],57:[2,146],60:[2,146],69:[2,146],70:[2,146],71:[2,146],72:[2,146],74:[2,146],76:[2,146],77:[2,146],81:[2,146],88:[2,146],89:[2,146],90:[2,146],95:[2,146],97:[2,146],106:[2,146],108:[2,146],109:[2,146],110:[2,146],114:[2,146],122:[2,146],130:[2,146],132:[2,146],133:[2,146],136:[2,146],137:[2,146],138:[2,146],139:[2,146],140:[2,146],141:[2,146]},{6:[1,76],29:[1,275]},{7:276,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{6:[2,70],11:[2,123],13:[2,123],28:[2,70],31:[2,123],33:[2,123],34:[2,123],36:[2,123],37:[2,123],38:[2,123],39:[2,123],40:[2,123],41:[2,123],48:[2,123],49:[2,123],50:[2,123],54:[2,123],55:[2,123],57:[2,70],79:[2,123],82:[2,123],86:[2,123],87:[2,123],92:[2,123],93:[2,123],94:[2,123],95:[2,70],100:[2,123],104:[2,123],105:[2,123],108:[2,123],110:[2,123],112:[2,123],114:[2,123],123:[2,123],129:[2,123],131:[2,123],132:[2,123],133:[2,123],134:[2,123],135:[2,123]},{6:[1,278],28:[1,279],95:[1,277]},{6:[2,57],7:205,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[2,57],29:[2,57],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,63:151,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],90:[2,57],92:[1,60],93:[1,61],94:[1,59],95:[2,57],98:280,100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{6:[2,56],28:[2,56],29:[2,56],56:281,57:[1,234]},{1:[2,186],6:[2,186],28:[2,186],29:[2,186],52:[2,186],57:[2,186],60:[2,186],76:[2,186],81:[2,186],90:[2,186],95:[2,186],97:[2,186],106:[2,186],108:[2,186],109:[2,186],110:[2,186],114:[2,186],122:[2,186],125:[2,186],130:[2,186],132:[2,186],133:[2,186],136:[2,186],137:[2,186],138:[2,186],139:[2,186],140:[2,186],141:[2,186]},{7:282,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:283,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{120:[2,164],121:[2,164]},{30:162,31:[1,75],47:163,61:164,62:165,79:[1,72],93:[1,113],94:[1,114],119:284},{1:[2,171],6:[2,171],28:[2,171],29:[2,171],52:[2,171],57:[2,171],60:[2,171],76:[2,171],81:[2,171],90:[2,171],95:[2,171],97:[2,171],106:[2,171],107:86,108:[2,171],109:[1,285],110:[2,171],113:87,114:[2,171],115:71,122:[1,286],130:[2,171],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,172],6:[2,172],28:[2,172],29:[2,172],52:[2,172],57:[2,172],60:[2,172],76:[2,172],81:[2,172],90:[2,172],95:[2,172],97:[2,172],106:[2,172],107:86,108:[2,172],109:[1,287],110:[2,172],113:87,114:[2,172],115:71,122:[2,172],130:[2,172],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{6:[1,289],28:[1,290],81:[1,288]},{6:[2,57],10:172,28:[2,57],29:[2,57],30:173,31:[1,75],32:174,33:[1,73],34:[1,74],44:291,45:171,47:175,49:[1,47],81:[2,57],93:[1,113]},{7:292,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,293],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,90],6:[2,90],28:[2,90],29:[2,90],43:[2,90],52:[2,90],57:[2,90],60:[2,90],69:[2,90],70:[2,90],71:[2,90],72:[2,90],74:[2,90],76:[2,90],77:[2,90],81:[2,90],83:[2,90],88:[2,90],89:[2,90],90:[2,90],95:[2,90],97:[2,90],106:[2,90],108:[2,90],109:[2,90],110:[2,90],114:[2,90],122:[2,90],130:[2,90],132:[2,90],133:[2,90],134:[2,90],135:[2,90],136:[2,90],137:[2,90],138:[2,90],139:[2,90],140:[2,90],141:[2,90],142:[2,90]},{7:294,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,76:[2,126],79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{76:[2,127],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,40],6:[2,40],28:[2,40],29:[2,40],52:[2,40],57:[2,40],60:[2,40],76:[2,40],81:[2,40],90:[2,40],95:[2,40],97:[2,40],106:[2,40],107:86,108:[2,40],109:[2,40],110:[2,40],113:87,114:[2,40],115:71,122:[2,40],130:[2,40],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{29:[1,295],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{6:[1,278],28:[1,279],90:[1,296]},{6:[2,70],28:[2,70],29:[2,70],57:[2,70],90:[2,70],95:[2,70]},{14:297,28:[1,116]},{6:[2,60],28:[2,60],29:[2,60],52:[2,60],57:[2,60]},{30:109,31:[1,75],47:110,58:298,59:108,61:111,62:112,79:[1,72],93:[1,113],94:[1,114]},{6:[2,58],28:[2,58],29:[2,58],30:109,31:[1,75],47:110,51:299,57:[2,58],58:107,59:108,61:111,62:112,79:[1,72],93:[1,113],94:[1,114]},{6:[2,65],28:[2,65],29:[2,65],52:[2,65],57:[2,65],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,28],6:[2,28],28:[2,28],29:[2,28],52:[2,28],57:[2,28],60:[2,28],76:[2,28],81:[2,28],90:[2,28],95:[2,28],97:[2,28],102:[2,28],103:[2,28],106:[2,28],108:[2,28],109:[2,28],110:[2,28],114:[2,28],122:[2,28],125:[2,28],127:[2,28],130:[2,28],132:[2,28],133:[2,28],136:[2,28],137:[2,28],138:[2,28],139:[2,28],140:[2,28],141:[2,28]},{29:[1,300],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,209],6:[2,209],28:[2,209],29:[2,209],52:[2,209],57:[2,209],60:[2,209],76:[2,209],81:[2,209],90:[2,209],95:[2,209],97:[2,209],106:[2,209],107:86,108:[2,209],109:[2,209],110:[2,209],113:87,114:[2,209],115:71,122:[2,209],130:[2,209],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{14:301,28:[1,116],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{14:302,28:[1,116]},{1:[2,140],6:[2,140],28:[2,140],29:[2,140],52:[2,140],57:[2,140],60:[2,140],76:[2,140],81:[2,140],90:[2,140],95:[2,140],97:[2,140],106:[2,140],108:[2,140],109:[2,140],110:[2,140],114:[2,140],122:[2,140],130:[2,140],132:[2,140],133:[2,140],136:[2,140],137:[2,140],138:[2,140],139:[2,140],140:[2,140],141:[2,140]},{14:303,28:[1,116]},{14:304,28:[1,116]},{1:[2,144],6:[2,144],28:[2,144],29:[2,144],52:[2,144],57:[2,144],60:[2,144],76:[2,144],81:[2,144],90:[2,144],95:[2,144],97:[2,144],102:[2,144],106:[2,144],108:[2,144],109:[2,144],110:[2,144],114:[2,144],122:[2,144],130:[2,144],132:[2,144],133:[2,144],136:[2,144],137:[2,144],138:[2,144],139:[2,144],140:[2,144],141:[2,144]},{29:[1,305],125:[1,306],126:270,127:[1,225]},{1:[2,180],6:[2,180],28:[2,180],29:[2,180],52:[2,180],57:[2,180],60:[2,180],76:[2,180],81:[2,180],90:[2,180],95:[2,180],97:[2,180],106:[2,180],108:[2,180],109:[2,180],110:[2,180],114:[2,180],122:[2,180],130:[2,180],132:[2,180],133:[2,180],136:[2,180],137:[2,180],138:[2,180],139:[2,180],140:[2,180],141:[2,180]},{14:307,28:[1,116]},{29:[2,183],125:[2,183],127:[2,183]},{14:308,28:[1,116],57:[1,309]},{28:[2,136],57:[2,136],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,103],6:[2,103],28:[2,103],29:[2,103],52:[2,103],57:[2,103],60:[2,103],76:[2,103],81:[2,103],90:[2,103],95:[2,103],97:[2,103],106:[2,103],108:[2,103],109:[2,103],110:[2,103],114:[2,103],122:[2,103],130:[2,103],132:[2,103],133:[2,103],136:[2,103],137:[2,103],138:[2,103],139:[2,103],140:[2,103],141:[2,103]},{1:[2,106],6:[2,106],14:310,28:[1,116],29:[2,106],52:[2,106],57:[2,106],60:[2,106],76:[2,106],81:[2,106],90:[2,106],95:[2,106],97:[2,106],106:[2,106],107:86,108:[1,67],109:[2,106],110:[1,68],113:87,114:[1,70],115:71,122:[2,106],130:[2,106],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{106:[1,311]},{95:[1,312],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,121],6:[2,121],28:[2,121],29:[2,121],43:[2,121],52:[2,121],57:[2,121],60:[2,121],69:[2,121],70:[2,121],71:[2,121],72:[2,121],74:[2,121],76:[2,121],77:[2,121],81:[2,121],88:[2,121],89:[2,121],90:[2,121],95:[2,121],97:[2,121],106:[2,121],108:[2,121],109:[2,121],110:[2,121],114:[2,121],120:[2,121],121:[2,121],122:[2,121],130:[2,121],132:[2,121],133:[2,121],136:[2,121],137:[2,121],138:[2,121],139:[2,121],140:[2,121],141:[2,121]},{7:205,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,63:151,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],98:313,100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:205,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:[1,150],30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,63:151,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],91:314,92:[1,60],93:[1,61],94:[1,59],98:149,100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{6:[2,130],28:[2,130],29:[2,130],57:[2,130],90:[2,130],95:[2,130]},{6:[1,278],28:[1,279],29:[1,315]},{1:[2,149],6:[2,149],28:[2,149],29:[2,149],52:[2,149],57:[2,149],60:[2,149],76:[2,149],81:[2,149],90:[2,149],95:[2,149],97:[2,149],106:[2,149],107:86,108:[1,67],109:[2,149],110:[1,68],113:87,114:[1,70],115:71,122:[2,149],130:[2,149],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,151],6:[2,151],28:[2,151],29:[2,151],52:[2,151],57:[2,151],60:[2,151],76:[2,151],81:[2,151],90:[2,151],95:[2,151],97:[2,151],106:[2,151],107:86,108:[1,67],109:[2,151],110:[1,68],113:87,114:[1,70],115:71,122:[2,151],130:[2,151],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{120:[2,170],121:[2,170]},{7:316,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:317,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:318,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,94],6:[2,94],28:[2,94],29:[2,94],43:[2,94],52:[2,94],57:[2,94],60:[2,94],69:[2,94],70:[2,94],71:[2,94],72:[2,94],74:[2,94],76:[2,94],77:[2,94],81:[2,94],88:[2,94],89:[2,94],90:[2,94],95:[2,94],97:[2,94],106:[2,94],108:[2,94],109:[2,94],110:[2,94],114:[2,94],120:[2,94],121:[2,94],122:[2,94],130:[2,94],132:[2,94],133:[2,94],136:[2,94],137:[2,94],138:[2,94],139:[2,94],140:[2,94],141:[2,94]},{10:172,30:173,31:[1,75],32:174,33:[1,73],34:[1,74],44:319,45:171,47:175,49:[1,47],93:[1,113]},{6:[2,95],10:172,28:[2,95],29:[2,95],30:173,31:[1,75],32:174,33:[1,73],34:[1,74],44:170,45:171,47:175,49:[1,47],57:[2,95],80:320,93:[1,113]},{6:[2,97],28:[2,97],29:[2,97],57:[2,97],81:[2,97]},{6:[2,43],28:[2,43],29:[2,43],57:[2,43],81:[2,43],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{7:321,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{76:[2,125],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,41],6:[2,41],28:[2,41],29:[2,41],52:[2,41],57:[2,41],60:[2,41],76:[2,41],81:[2,41],90:[2,41],95:[2,41],97:[2,41],106:[2,41],108:[2,41],109:[2,41],110:[2,41],114:[2,41],122:[2,41],130:[2,41],132:[2,41],133:[2,41],136:[2,41],137:[2,41],138:[2,41],139:[2,41],140:[2,41],141:[2,41]},{1:[2,116],6:[2,116],28:[2,116],29:[2,116],43:[2,116],52:[2,116],57:[2,116],60:[2,116],69:[2,116],70:[2,116],71:[2,116],72:[2,116],74:[2,116],76:[2,116],77:[2,116],81:[2,116],83:[2,116],88:[2,116],89:[2,116],90:[2,116],95:[2,116],97:[2,116],106:[2,116],108:[2,116],109:[2,116],110:[2,116],114:[2,116],122:[2,116],130:[2,116],132:[2,116],133:[2,116],134:[2,116],135:[2,116],136:[2,116],137:[2,116],138:[2,116],139:[2,116],140:[2,116],141:[2,116],142:[2,116]},{1:[2,52],6:[2,52],28:[2,52],29:[2,52],52:[2,52],57:[2,52],60:[2,52],76:[2,52],81:[2,52],90:[2,52],95:[2,52],97:[2,52],106:[2,52],108:[2,52],109:[2,52],110:[2,52],114:[2,52],122:[2,52],130:[2,52],132:[2,52],133:[2,52],136:[2,52],137:[2,52],138:[2,52],139:[2,52],140:[2,52],141:[2,52]},{6:[2,61],28:[2,61],29:[2,61],52:[2,61],57:[2,61]},{6:[2,56],28:[2,56],29:[2,56],56:322,57:[1,207]},{1:[2,208],6:[2,208],28:[2,208],29:[2,208],52:[2,208],57:[2,208],60:[2,208],76:[2,208],81:[2,208],90:[2,208],95:[2,208],97:[2,208],106:[2,208],108:[2,208],109:[2,208],110:[2,208],114:[2,208],122:[2,208],130:[2,208],132:[2,208],133:[2,208],136:[2,208],137:[2,208],138:[2,208],139:[2,208],140:[2,208],141:[2,208]},{1:[2,187],6:[2,187],28:[2,187],29:[2,187],52:[2,187],57:[2,187],60:[2,187],76:[2,187],81:[2,187],90:[2,187],95:[2,187],97:[2,187],106:[2,187],108:[2,187],109:[2,187],110:[2,187],114:[2,187],122:[2,187],125:[2,187],130:[2,187],132:[2,187],133:[2,187],136:[2,187],137:[2,187],138:[2,187],139:[2,187],140:[2,187],141:[2,187]},{1:[2,141],6:[2,141],28:[2,141],29:[2,141],52:[2,141],57:[2,141],60:[2,141],76:[2,141],81:[2,141],90:[2,141],95:[2,141],97:[2,141],106:[2,141],108:[2,141],109:[2,141],110:[2,141],114:[2,141],122:[2,141],130:[2,141],132:[2,141],133:[2,141],136:[2,141],137:[2,141],138:[2,141],139:[2,141],140:[2,141],141:[2,141]},{1:[2,142],6:[2,142],28:[2,142],29:[2,142],52:[2,142],57:[2,142],60:[2,142],76:[2,142],81:[2,142],90:[2,142],95:[2,142],97:[2,142],102:[2,142],106:[2,142],108:[2,142],109:[2,142],110:[2,142],114:[2,142],122:[2,142],130:[2,142],132:[2,142],133:[2,142],136:[2,142],137:[2,142],138:[2,142],139:[2,142],140:[2,142],141:[2,142]},{1:[2,143],6:[2,143],28:[2,143],29:[2,143],52:[2,143],57:[2,143],60:[2,143],76:[2,143],81:[2,143],90:[2,143],95:[2,143],97:[2,143],102:[2,143],106:[2,143],108:[2,143],109:[2,143],110:[2,143],114:[2,143],122:[2,143],130:[2,143],132:[2,143],133:[2,143],136:[2,143],137:[2,143],138:[2,143],139:[2,143],140:[2,143],141:[2,143]},{1:[2,178],6:[2,178],28:[2,178],29:[2,178],52:[2,178],57:[2,178],60:[2,178],76:[2,178],81:[2,178],90:[2,178],95:[2,178],97:[2,178],106:[2,178],108:[2,178],109:[2,178],110:[2,178],114:[2,178],122:[2,178],130:[2,178],132:[2,178],133:[2,178],136:[2,178],137:[2,178],138:[2,178],139:[2,178],140:[2,178],141:[2,178]},{14:323,28:[1,116]},{29:[1,324]},{6:[1,325],29:[2,184],125:[2,184],127:[2,184]},{7:326,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{1:[2,107],6:[2,107],28:[2,107],29:[2,107],52:[2,107],57:[2,107],60:[2,107],76:[2,107],81:[2,107],90:[2,107],95:[2,107],97:[2,107],106:[2,107],108:[2,107],109:[2,107],110:[2,107],114:[2,107],122:[2,107],130:[2,107],132:[2,107],133:[2,107],136:[2,107],137:[2,107],138:[2,107],139:[2,107],140:[2,107],141:[2,107]},{1:[2,147],6:[2,147],28:[2,147],29:[2,147],52:[2,147],57:[2,147],60:[2,147],69:[2,147],70:[2,147],71:[2,147],72:[2,147],74:[2,147],76:[2,147],77:[2,147],81:[2,147],88:[2,147],89:[2,147],90:[2,147],95:[2,147],97:[2,147],106:[2,147],108:[2,147],109:[2,147],110:[2,147],114:[2,147],122:[2,147],130:[2,147],132:[2,147],133:[2,147],136:[2,147],137:[2,147],138:[2,147],139:[2,147],140:[2,147],141:[2,147]},{1:[2,124],6:[2,124],28:[2,124],29:[2,124],52:[2,124],57:[2,124],60:[2,124],69:[2,124],70:[2,124],71:[2,124],72:[2,124],74:[2,124],76:[2,124],77:[2,124],81:[2,124],88:[2,124],89:[2,124],90:[2,124],95:[2,124],97:[2,124],106:[2,124],108:[2,124],109:[2,124],110:[2,124],114:[2,124],122:[2,124],130:[2,124],132:[2,124],133:[2,124],136:[2,124],137:[2,124],138:[2,124],139:[2,124],140:[2,124],141:[2,124]},{6:[2,131],28:[2,131],29:[2,131],57:[2,131],90:[2,131],95:[2,131]},{6:[2,56],28:[2,56],29:[2,56],56:327,57:[1,234]},{6:[2,132],28:[2,132],29:[2,132],57:[2,132],90:[2,132],95:[2,132]},{1:[2,173],6:[2,173],28:[2,173],29:[2,173],52:[2,173],57:[2,173],60:[2,173],76:[2,173],81:[2,173],90:[2,173],95:[2,173],97:[2,173],106:[2,173],107:86,108:[2,173],109:[2,173],110:[2,173],113:87,114:[2,173],115:71,122:[1,328],130:[2,173],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,175],6:[2,175],28:[2,175],29:[2,175],52:[2,175],57:[2,175],60:[2,175],76:[2,175],81:[2,175],90:[2,175],95:[2,175],97:[2,175],106:[2,175],107:86,108:[2,175],109:[1,329],110:[2,175],113:87,114:[2,175],115:71,122:[2,175],130:[2,175],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,174],6:[2,174],28:[2,174],29:[2,174],52:[2,174],57:[2,174],60:[2,174],76:[2,174],81:[2,174],90:[2,174],95:[2,174],97:[2,174],106:[2,174],107:86,108:[2,174],109:[2,174],110:[2,174],113:87,114:[2,174],115:71,122:[2,174],130:[2,174],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{6:[2,98],28:[2,98],29:[2,98],57:[2,98],81:[2,98]},{6:[2,56],28:[2,56],29:[2,56],56:330,57:[1,244]},{29:[1,331],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{6:[1,255],28:[1,256],29:[1,332]},{29:[1,333]},{1:[2,181],6:[2,181],28:[2,181],29:[2,181],52:[2,181],57:[2,181],60:[2,181],76:[2,181],81:[2,181],90:[2,181],95:[2,181],97:[2,181],106:[2,181],108:[2,181],109:[2,181],110:[2,181],114:[2,181],122:[2,181],130:[2,181],132:[2,181],133:[2,181],136:[2,181],137:[2,181],138:[2,181],139:[2,181],140:[2,181],141:[2,181]},{29:[2,185],125:[2,185],127:[2,185]},{28:[2,137],57:[2,137],107:86,108:[1,67],110:[1,68],113:87,114:[1,70],115:71,130:[1,85],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{6:[1,278],28:[1,279],29:[1,334]},{7:335,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{7:336,8:118,9:19,10:20,11:[1,21],12:22,13:[1,48],15:6,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,30:64,31:[1,75],32:51,33:[1,73],34:[1,74],35:24,36:[1,52],37:[1,53],38:[1,54],39:[1,55],40:[1,56],41:[1,57],42:23,47:65,48:[1,46],49:[1,47],50:[1,29],53:30,54:[1,62],55:[1,63],61:49,62:50,64:36,66:25,67:26,68:27,79:[1,72],82:[1,43],86:[1,28],87:[1,45],92:[1,60],93:[1,61],94:[1,59],100:[1,38],104:[1,44],105:[1,58],107:39,108:[1,67],110:[1,68],111:40,112:[1,69],113:41,114:[1,70],115:71,123:[1,42],128:37,129:[1,66],131:[1,31],132:[1,32],133:[1,33],134:[1,34],135:[1,35]},{6:[1,289],28:[1,290],29:[1,337]},{6:[2,44],28:[2,44],29:[2,44],57:[2,44],81:[2,44]},{6:[2,62],28:[2,62],29:[2,62],52:[2,62],57:[2,62]},{1:[2,179],6:[2,179],28:[2,179],29:[2,179],52:[2,179],57:[2,179],60:[2,179],76:[2,179],81:[2,179],90:[2,179],95:[2,179],97:[2,179],106:[2,179],108:[2,179],109:[2,179],110:[2,179],114:[2,179],122:[2,179],130:[2,179],132:[2,179],133:[2,179],136:[2,179],137:[2,179],138:[2,179],139:[2,179],140:[2,179],141:[2,179]},{6:[2,133],28:[2,133],29:[2,133],57:[2,133],90:[2,133],95:[2,133]},{1:[2,176],6:[2,176],28:[2,176],29:[2,176],52:[2,176],57:[2,176],60:[2,176],76:[2,176],81:[2,176],90:[2,176],95:[2,176],97:[2,176],106:[2,176],107:86,108:[2,176],109:[2,176],110:[2,176],113:87,114:[2,176],115:71,122:[2,176],130:[2,176],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{1:[2,177],6:[2,177],28:[2,177],29:[2,177],52:[2,177],57:[2,177],60:[2,177],76:[2,177],81:[2,177],90:[2,177],95:[2,177],97:[2,177],106:[2,177],107:86,108:[2,177],109:[2,177],110:[2,177],113:87,114:[2,177],115:71,122:[2,177],130:[2,177],132:[1,79],133:[1,78],136:[1,77],137:[1,80],138:[1,81],139:[1,82],140:[1,83],141:[1,84]},{6:[2,99],28:[2,99],29:[2,99],57:[2,99],81:[2,99]}], -defaultActions: {62:[2,54],63:[2,55],93:[2,114],194:[2,93]}, -parseError: function parseError(str, hash) { - throw new Error(str); -}, -parse: function parse(input) { - var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - this.yy.parser = this; - if (typeof this.lexer.yylloc == "undefined") - this.lexer.yylloc = {}; - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - var ranges = this.lexer.options && this.lexer.options.ranges; - if (typeof this.yy.parseError === "function") - this.parseError = this.yy.parseError; - function popStack(n) { - stack.length = stack.length - 2 * n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - function lex() { - var token; - token = self.lexer.lex() || 1; - if (typeof token !== "number") { - token = self.symbols_[token] || token; - } - return token; - } - var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; - while (true) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == "undefined") { - symbol = lex(); - } - action = table[state] && table[state][symbol]; - } - if (typeof action === "undefined" || !action.length || !action[0]) { - var errStr = ""; - if (!recovering) { - expected = []; - for (p in table[state]) - if (this.terminals_[p] && p > 2) { - expected.push("'" + this.terminals_[p] + "'"); - } - if (this.lexer.showPosition) { - errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); - } - this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); - } - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) - recovering--; - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); - if (typeof r !== "undefined") { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; - } - } - return true; -} -}; -undefined -function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; -return new Parser; -})(); -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = parser; -exports.Parser = parser.Parser; -exports.parse = function () { return parser.parse.apply(parser, arguments); }; -exports.main = function commonjsMain(args) { - if (!args[1]) { - console.log('Usage: '+args[0]+' FILE'); - process.exit(1); - } - var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); - return exports.parser.parse(source); -}; -if (typeof module !== 'undefined' && require.main === module) { - exports.main(process.argv.slice(1)); -} -} \ No newline at end of file diff --git a/node_modules/iced-coffee-script/lib/coffee-script/repl.js b/node_modules/iced-coffee-script/lib/coffee-script/repl.js deleted file mode 100644 index 4b63d5f..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/repl.js +++ /dev/null @@ -1,194 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var CoffeeScript, addHistory, addMultilineHandler, fs, iced, icedmod, merge, nodeREPL, path, prettyErrorMessage, replDefaults, vm, __iced_k, __iced_k_noop, _ref; - - __iced_k = __iced_k_noop = function() {}; - - fs = require('fs'); - - path = require('path'); - - vm = require('vm'); - - nodeREPL = require('repl'); - - CoffeeScript = require('./coffee-script'); - - _ref = require('./helpers'), merge = _ref.merge, prettyErrorMessage = _ref.prettyErrorMessage; - - icedmod = require('./iced'); - - iced = icedmod.runtime; - - replDefaults = { - prompt: 'iced> ', - historyFile: process.env.HOME ? path.join(process.env.HOME, '.iced_history') : void 0, - historyMaxInputSize: 10240, - "eval": function(input, context, filename, cb) { - var Assign, Block, Literal, Value, ast, err, js, ret, run, ___iced_passed_deferral, __iced_deferrals, __iced_k, _ref1, - _this = this; - __iced_k = __iced_k_noop; - ___iced_passed_deferral = iced.findDeferral(arguments); - input = input.replace(/\uFF00/g, '\n'); - input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1'); - _ref1 = require('./nodes'), Block = _ref1.Block, Assign = _ref1.Assign, Value = _ref1.Value, Literal = _ref1.Literal; - context.iced = iced; - run = function(js) { - return vm.runInContext(js, context, filename); - }; - try { - ast = CoffeeScript.nodes(input, { - repl: true - }); - if (!ast.icedIsCpsPivot()) { - ast = new Block([new Assign(new Value(new Literal('_')), ast, '=')]); - } - js = ast.compile({ - bare: true, - locals: Object.keys(context) - }); - (function(__iced_k) { - if (ast.icedIsCpsPivot()) { - (function(__iced_k) { - __iced_deferrals = new iced.Deferrals(__iced_k, { - parent: ___iced_passed_deferral, - filename: "src/repl.coffee" - }); - context[icedmod["const"].k] = __iced_deferrals.defer({ - lineno: 39 - }); - ret = run(js); - __iced_deferrals._fulfill(); - })(__iced_k); - } else { - return __iced_k(ret = run(js)); - } - })(function() { - return cb(null, ret); - }); - } catch (_error) { - err = _error; - return cb(prettyErrorMessage(err, filename, input, true)); - } - } - }; - - addMultilineHandler = function(repl) { - var inputStream, multiline, nodeLineListener, outputStream, rli; - rli = repl.rli, inputStream = repl.inputStream, outputStream = repl.outputStream; - multiline = { - enabled: false, - initialPrompt: repl.prompt.replace(/^[^> ]*/, function(x) { - return x.replace(/./g, '-'); - }), - prompt: repl.prompt.replace(/^[^> ]*>?/, function(x) { - return x.replace(/./g, '.'); - }), - buffer: '' - }; - nodeLineListener = rli.listeners('line')[0]; - rli.removeListener('line', nodeLineListener); - rli.on('line', function(cmd) { - if (multiline.enabled) { - multiline.buffer += "" + cmd + "\n"; - rli.setPrompt(multiline.prompt); - rli.prompt(true); - } else { - nodeLineListener(cmd); - } - }); - return inputStream.on('keypress', function(char, key) { - if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) { - return; - } - if (multiline.enabled) { - if (!multiline.buffer.match(/\n/)) { - multiline.enabled = !multiline.enabled; - rli.setPrompt(repl.prompt); - rli.prompt(true); - return; - } - if ((rli.line != null) && !rli.line.match(/^\s*$/)) { - return; - } - multiline.enabled = !multiline.enabled; - rli.line = ''; - rli.cursor = 0; - rli.output.cursorTo(0); - rli.output.clearLine(1); - multiline.buffer = multiline.buffer.replace(/\n/g, '\uFF00'); - rli.emit('line', multiline.buffer); - multiline.buffer = ''; - } else { - multiline.enabled = !multiline.enabled; - rli.setPrompt(multiline.initialPrompt); - rli.prompt(true); - } - }); - }; - - addHistory = function(repl, filename, maxSize) { - var buffer, fd, lastLine, readFd, size, stat; - lastLine = null; - try { - stat = fs.statSync(filename); - size = Math.min(maxSize, stat.size); - readFd = fs.openSync(filename, 'r'); - buffer = new Buffer(size); - fs.readSync(readFd, buffer, 0, size, stat.size - size); - repl.rli.history = buffer.toString().split('\n').reverse(); - if (stat.size > maxSize) { - repl.rli.history.pop(); - } - if (repl.rli.history[0] === '') { - repl.rli.history.shift(); - } - repl.rli.historyIndex = -1; - lastLine = repl.rli.history[0]; - } catch (_error) {} - fd = fs.openSync(filename, 'a'); - repl.rli.addListener('line', function(code) { - if (code && code.length && code !== '.history' && lastLine !== code) { - fs.write(fd, "" + code + "\n"); - return lastLine = code; - } - }); - repl.rli.on('exit', function() { - return fs.close(fd); - }); - return repl.commands['.history'] = { - help: 'Show command history', - action: function() { - repl.outputStream.write("" + (repl.rli.history.slice(0).reverse().join('\n')) + "\n"); - return repl.displayPrompt(); - } - }; - }; - - module.exports = { - start: function(opts) { - var build, major, minor, repl, _ref1; - if (opts == null) { - opts = {}; - } - _ref1 = process.versions.node.split('.').map(function(n) { - return parseInt(n); - }), major = _ref1[0], minor = _ref1[1], build = _ref1[2]; - if (major === 0 && minor < 8) { - console.warn("Node 0.8.0+ required for CoffeeScript REPL"); - process.exit(1); - } - opts = merge(replDefaults, opts); - repl = nodeREPL.start(opts); - repl.on('exit', function() { - return repl.outputStream.write('\n'); - }); - addMultilineHandler(repl); - if (opts.historyFile) { - addHistory(repl, opts.historyFile, opts.historyMaxInputSize); - } - return repl; - } - }; - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/rewriter.js b/node_modules/iced-coffee-script/lib/coffee-script/rewriter.js deleted file mode 100644 index b21814c..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/rewriter.js +++ /dev/null @@ -1,494 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, - __slice = [].slice; - - - - generate = function(tag, value) { - var tok; - tok = [tag, value]; - tok.generated = true; - return tok; - }; - - exports.Rewriter = (function() { - function Rewriter() {} - - Rewriter.prototype.rewrite = function(tokens) { - this.tokens = tokens; - this.removeLeadingNewlines(); - this.removeMidExpressionNewlines(); - this.closeOpenCalls(); - this.closeOpenIndexes(); - this.addImplicitIndentation(); - this.tagPostfixConditionals(); - this.addImplicitBracesAndParens(); - this.addLocationDataToGeneratedTokens(); - return this.tokens; - }; - - Rewriter.prototype.scanTokens = function(block) { - var i, token, tokens; - tokens = this.tokens; - i = 0; - while (token = tokens[i]) { - i += block.call(this, token, i, tokens); - } - return true; - }; - - Rewriter.prototype.detectEnd = function(i, condition, action) { - var levels, token, tokens, _ref, _ref1; - tokens = this.tokens; - levels = 0; - while (token = tokens[i]) { - if (levels === 0 && condition.call(this, token, i)) { - return action.call(this, token, i); - } - if (!token || levels < 0) { - return action.call(this, token, i - 1); - } - if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) { - levels += 1; - } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) { - levels -= 1; - } - i += 1; - } - return i - 1; - }; - - Rewriter.prototype.removeLeadingNewlines = function() { - var i, tag, _i, _len, _ref; - _ref = this.tokens; - for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { - tag = _ref[i][0]; - if (tag !== 'TERMINATOR') { - break; - } - } - if (i) { - return this.tokens.splice(0, i); - } - }; - - Rewriter.prototype.removeMidExpressionNewlines = function() { - return this.scanTokens(function(token, i, tokens) { - var _ref; - if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) { - return 1; - } - tokens.splice(i, 1); - return 0; - }); - }; - - Rewriter.prototype.closeOpenCalls = function() { - var action, condition; - condition = function(token, i) { - var _ref; - return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')'; - }; - action = function(token, i) { - return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END'; - }; - return this.scanTokens(function(token, i) { - if (token[0] === 'CALL_START') { - this.detectEnd(i + 1, condition, action); - } - return 1; - }); - }; - - Rewriter.prototype.closeOpenIndexes = function() { - var action, condition; - condition = function(token, i) { - var _ref; - return (_ref = token[0]) === ']' || _ref === 'INDEX_END'; - }; - action = function(token, i) { - return token[0] = 'INDEX_END'; - }; - return this.scanTokens(function(token, i) { - if (token[0] === 'INDEX_START') { - this.detectEnd(i + 1, condition, action); - } - return 1; - }); - }; - - Rewriter.prototype.matchTags = function() { - var fuzz, i, j, pattern, _i, _ref, _ref1; - i = arguments[0], pattern = 2 <= arguments.length ? __slice.call(arguments, 1) : []; - fuzz = 0; - for (j = _i = 0, _ref = pattern.length; 0 <= _ref ? _i < _ref : _i > _ref; j = 0 <= _ref ? ++_i : --_i) { - while (this.tag(i + j + fuzz) === 'HERECOMMENT') { - fuzz += 2; - } - if (pattern[j] == null) { - continue; - } - if (typeof pattern[j] === 'string') { - pattern[j] = [pattern[j]]; - } - if (_ref1 = this.tag(i + j + fuzz), __indexOf.call(pattern[j], _ref1) < 0) { - return false; - } - } - return true; - }; - - Rewriter.prototype.looksObjectish = function(j) { - return this.matchTags(j, '@', null, ':') || this.matchTags(j, null, ':'); - }; - - Rewriter.prototype.findTagsBackwards = function(i, tags) { - var backStack, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; - backStack = []; - while (i >= 0 && (backStack.length || (_ref2 = this.tag(i), __indexOf.call(tags, _ref2) < 0) && ((_ref3 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref3) < 0) || this.tokens[i].generated) && (_ref4 = this.tag(i), __indexOf.call(LINEBREAKS, _ref4) < 0))) { - if (_ref = this.tag(i), __indexOf.call(EXPRESSION_END, _ref) >= 0) { - backStack.push(this.tag(i)); - } - if ((_ref1 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref1) >= 0) && backStack.length) { - backStack.pop(); - } - i -= 1; - } - return _ref5 = this.tag(i), __indexOf.call(tags, _ref5) >= 0; - }; - - Rewriter.prototype.addImplicitBracesAndParens = function() { - var stack; - stack = []; - return this.scanTokens(function(token, i, tokens) { - var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, nextTag, offset, prevTag, ret, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; - tag = token[0]; - prevTag = (i > 0 ? tokens[i - 1] : [])[0]; - nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0]; - stackTop = function() { - return stack[stack.length - 1]; - }; - startIdx = i; - forward = function(n) { - return i - startIdx + n; - }; - inImplicit = function() { - var _ref, _ref1; - return (_ref = stackTop()) != null ? (_ref1 = _ref[2]) != null ? _ref1.ours : void 0 : void 0; - }; - inImplicitCall = function() { - var _ref; - return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '('; - }; - inImplicitObject = function() { - var _ref; - return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '{'; - }; - inImplicitControl = function() { - var _ref; - return inImplicit && ((_ref = stackTop()) != null ? _ref[0] : void 0) === 'CONTROL'; - }; - startImplicitCall = function(j) { - var idx; - idx = j != null ? j : i; - stack.push([ - '(', idx, { - ours: true - } - ]); - tokens.splice(idx, 0, generate('CALL_START', '(')); - if (j == null) { - return i += 1; - } - }; - endImplicitCall = function() { - stack.pop(); - tokens.splice(i, 0, generate('CALL_END', ')')); - return i += 1; - }; - startImplicitObject = function(j, startsLine) { - var idx; - if (startsLine == null) { - startsLine = true; - } - idx = j != null ? j : i; - stack.push([ - '{', idx, { - sameLine: true, - startsLine: startsLine, - ours: true - } - ]); - tokens.splice(idx, 0, generate('{', generate(new String('{')))); - if (j == null) { - return i += 1; - } - }; - endImplicitObject = function(j) { - j = j != null ? j : i; - stack.pop(); - tokens.splice(j, 0, generate('}', '}')); - return i += 1; - }; - if (inImplicitCall() && (tag === 'IF' || tag === 'TRY' || tag === 'FINALLY' || tag === 'CATCH' || tag === 'CLASS' || tag === 'SWITCH')) { - stack.push([ - 'CONTROL', i, { - ours: true - } - ]); - return forward(1); - } - if (tag === 'INDENT' && inImplicit()) { - if (prevTag !== '=>' && prevTag !== '->' && prevTag !== '[' && prevTag !== '(' && prevTag !== ',' && prevTag !== '{' && prevTag !== 'TRY' && prevTag !== 'ELSE' && prevTag !== '=') { - while (inImplicitCall()) { - endImplicitCall(); - } - } - if (inImplicitControl()) { - stack.pop(); - } - stack.push([tag, i]); - return forward(1); - } - if (__indexOf.call(EXPRESSION_START, tag) >= 0) { - stack.push([tag, i]); - return forward(1); - } - if (__indexOf.call(EXPRESSION_END, tag) >= 0) { - while (inImplicit()) { - if (inImplicitCall()) { - endImplicitCall(); - } else if (inImplicitObject()) { - endImplicitObject(); - } else { - stack.pop(); - } - } - stack.pop(); - } - if ((__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced && !token.stringEnd || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (__indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || __indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !((_ref = tokens[i + 1]) != null ? _ref.spaced : void 0) && !((_ref1 = tokens[i + 1]) != null ? _ref1.newLine : void 0))) { - if (tag === '?') { - tag = token[0] = 'FUNC_EXIST'; - } - startImplicitCall(i + 1); - ret = forward(2); - return ret; - } - if (__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.matchTags(i + 1, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) { - startImplicitCall(i + 1); - stack.push(['INDENT', i + 2]); - return forward(3); - } - if (tag === ':') { - if (this.tag(i - 2) === '@') { - s = i - 2; - } else { - s = i - 1; - } - while (this.tag(s - 2) === 'HERECOMMENT') { - s -= 2; - } - startsLine = s === 0 || (_ref2 = this.tag(s - 1), __indexOf.call(LINEBREAKS, _ref2) >= 0) || tokens[s - 1].newLine; - if (stackTop()) { - _ref3 = stackTop(), stackTag = _ref3[0], stackIdx = _ref3[1]; - if ((stackTag === '{' || stackTag === 'INDENT' && this.tag(stackIdx - 1) === '{') && (startsLine || this.tag(s - 1) === ',' || this.tag(s - 1) === '{')) { - return forward(1); - } - } - startImplicitObject(s, !!startsLine); - return forward(2); - } - if (prevTag === 'OUTDENT' && inImplicitCall() && (tag === '.' || tag === '?.' || tag === '::' || tag === '?::')) { - endImplicitCall(); - return forward(1); - } - if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) { - stackTop()[2].sameLine = false; - } - if (__indexOf.call(IMPLICIT_END, tag) >= 0) { - while (inImplicit()) { - _ref4 = stackTop(), stackTag = _ref4[0], stackIdx = _ref4[1], (_ref5 = _ref4[2], sameLine = _ref5.sameLine, startsLine = _ref5.startsLine); - if (inImplicitCall() && prevTag !== ',') { - endImplicitCall(); - } else if (inImplicitObject() && sameLine && !startsLine) { - endImplicitObject(); - } else if (inImplicitObject() && tag === 'TERMINATOR' && prevTag !== ',' && !(startsLine && this.looksObjectish(i + 1))) { - endImplicitObject(); - } else { - break; - } - } - } - if (tag === ',' && !this.looksObjectish(i + 1) && inImplicitObject() && (nextTag !== 'TERMINATOR' || !this.looksObjectish(i + 2))) { - offset = nextTag === 'OUTDENT' ? 1 : 0; - while (inImplicitObject()) { - endImplicitObject(i + offset); - } - } - return forward(1); - }); - }; - - Rewriter.prototype.addLocationDataToGeneratedTokens = function() { - return this.scanTokens(function(token, i, tokens) { - var column, line, nextLocation, prevLocation, _ref, _ref1; - if (token[2]) { - return 1; - } - if (!(token.generated || token.explicit)) { - return 1; - } - if (token[0] === '{' && (nextLocation = (_ref = tokens[i + 1]) != null ? _ref[2] : void 0)) { - line = nextLocation.first_line, column = nextLocation.first_column; - } else if (prevLocation = (_ref1 = tokens[i - 1]) != null ? _ref1[2] : void 0) { - line = prevLocation.last_line, column = prevLocation.last_column; - } else { - line = column = 0; - } - token[2] = { - first_line: line, - first_column: column, - last_line: line, - last_column: column - }; - return 1; - }); - }; - - Rewriter.prototype.addImplicitIndentation = function() { - var action, condition, indent, outdent, starter; - starter = indent = outdent = null; - condition = function(token, i) { - var _ref, _ref1; - return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((_ref1 = token[0]) === 'CATCH' || _ref1 === 'FINALLY') && (starter === '->' || starter === '=>')); - }; - action = function(token, i) { - return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); - }; - return this.scanTokens(function(token, i, tokens) { - var j, tag, _i, _ref, _ref1; - tag = token[0]; - if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') { - tokens.splice(i, 1); - return 0; - } - if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { - tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation()))); - return 2; - } - if (tag === 'CATCH') { - for (j = _i = 1; _i <= 2; j = ++_i) { - if (!((_ref = this.tag(i + j)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) { - continue; - } - tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation()))); - return 2 + j; - } - } - if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { - starter = tag; - _ref1 = this.indentation(true), indent = _ref1[0], outdent = _ref1[1]; - if (starter === 'THEN') { - indent.fromThen = true; - } - tokens.splice(i + 1, 0, indent); - this.detectEnd(i + 2, condition, action); - if (tag === 'THEN') { - tokens.splice(i, 1); - } - return 1; - } - return 1; - }); - }; - - Rewriter.prototype.tagPostfixConditionals = function() { - var action, condition, original; - original = null; - condition = function(token, i) { - var prevTag, tag; - tag = token[0]; - prevTag = this.tokens[i - 1][0]; - return tag === 'TERMINATOR' || (tag === 'INDENT' && __indexOf.call(SINGLE_LINERS, prevTag) < 0); - }; - action = function(token, i) { - if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) { - return original[0] = 'POST_' + original[0]; - } - }; - return this.scanTokens(function(token, i) { - if (token[0] !== 'IF') { - return 1; - } - original = token; - this.detectEnd(i + 1, condition, action); - return 1; - }); - }; - - Rewriter.prototype.indentation = function(implicit) { - var indent, outdent; - if (implicit == null) { - implicit = false; - } - indent = ['INDENT', 2]; - outdent = ['OUTDENT', 2]; - if (implicit) { - indent.generated = outdent.generated = true; - } - if (!implicit) { - indent.explicit = outdent.explicit = true; - } - return [indent, outdent]; - }; - - Rewriter.prototype.generate = generate; - - Rewriter.prototype.tag = function(i) { - var _ref; - return (_ref = this.tokens[i]) != null ? _ref[0] : void 0; - }; - - return Rewriter; - - })(); - - BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']]; - - exports.INVERSES = INVERSES = {}; - - EXPRESSION_START = []; - - EXPRESSION_END = []; - - for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) { - _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1]; - EXPRESSION_START.push(INVERSES[rite] = left); - EXPRESSION_END.push(INVERSES[left] = rite); - } - - EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END); - - IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; - - IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++']; - - IMPLICIT_UNSPACED_CALL = ['+', '-']; - - IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR']; - - SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN']; - - SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN']; - - LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT']; - - IMPLICIT_FUNC.push('DEFER'); - - IMPLICIT_CALL.push('DEFER'); - - IMPLICIT_END.push('AWAIT'); - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/scope.js b/node_modules/iced-coffee-script/lib/coffee-script/scope.js deleted file mode 100644 index 940f12c..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/scope.js +++ /dev/null @@ -1,150 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var Scope, extend, iced, last, _ref; - - - - _ref = require('./helpers'), extend = _ref.extend, last = _ref.last; - - iced = require('./iced'); - - exports.Scope = Scope = (function() { - Scope.root = null; - - function Scope(parent, expressions, method) { - this.parent = parent; - this.expressions = expressions; - this.method = method; - this.variables = [ - { - name: 'arguments', - type: 'arguments' - } - ]; - this.positions = {}; - if (!this.parent) { - Scope.root = this; - } - } - - Scope.prototype.add = function(name, type, immediate) { - if (this.shared && !immediate) { - return this.parent.add(name, type, immediate); - } - if (Object.prototype.hasOwnProperty.call(this.positions, name)) { - return this.variables[this.positions[name]].type = type; - } else { - return this.positions[name] = this.variables.push({ - name: name, - type: type - }) - 1; - } - }; - - Scope.prototype.namedMethod = function() { - var _ref1; - if (((_ref1 = this.method) != null ? _ref1.name : void 0) || !this.parent) { - return this.method; - } - return this.parent.namedMethod(); - }; - - Scope.prototype.find = function(name) { - if (this.check(name)) { - return true; - } - this.add(name, 'var'); - return false; - }; - - Scope.prototype.parameter = function(name) { - if (this.shared && this.parent.check(name, true)) { - return; - } - return this.add(name, 'param'); - }; - - Scope.prototype.check = function(name) { - var _ref1; - return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0)); - }; - - Scope.prototype.temporary = function(name, index) { - if (name.length > 1) { - return '_' + name + (index > 1 ? index - 1 : ''); - } else { - return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); - } - }; - - Scope.prototype.type = function(name) { - var v, _i, _len, _ref1; - _ref1 = this.variables; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - v = _ref1[_i]; - if (v.name === name) { - return v.type; - } - } - return null; - }; - - Scope.prototype.freeVariable = function(name, reserve) { - var index, temp; - if (reserve == null) { - reserve = true; - } - index = 0; - while (this.check((temp = this.temporary(name, index)))) { - index++; - } - if (reserve) { - this.add(temp, 'var', true); - } - return temp; - }; - - Scope.prototype.assign = function(name, value) { - this.add(name, { - value: value, - assigned: true - }, true); - return this.hasAssignments = true; - }; - - Scope.prototype.hasDeclarations = function() { - return !!this.declaredVariables().length; - }; - - Scope.prototype.declaredVariables = function() { - var realVars, tempVars, v, _i, _len, _ref1; - realVars = []; - tempVars = []; - _ref1 = this.variables; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - v = _ref1[_i]; - if ((v.type === 'var') || (v.type === 'param' && v.name === iced["const"].k)) { - (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); - } - } - return realVars.sort().concat(tempVars.sort()); - }; - - Scope.prototype.assignedVariables = function() { - var v, _i, _len, _ref1, _results; - _ref1 = this.variables; - _results = []; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - v = _ref1[_i]; - if (v.type.assigned) { - _results.push("" + v.name + " = " + v.type.value); - } - } - return _results; - }; - - return Scope; - - })(); - -}).call(this); diff --git a/node_modules/iced-coffee-script/lib/coffee-script/sourcemap.js b/node_modules/iced-coffee-script/lib/coffee-script/sourcemap.js deleted file mode 100644 index 158c7d9..0000000 --- a/node_modules/iced-coffee-script/lib/coffee-script/sourcemap.js +++ /dev/null @@ -1,163 +0,0 @@ -// Generated by IcedCoffeeScript 1.6.3-g -(function() { - var LineMap, SourceMap; - - - - LineMap = (function() { - function LineMap(line) { - this.line = line; - this.columns = []; - } - - LineMap.prototype.add = function(column, _arg, options) { - var sourceColumn, sourceLine; - sourceLine = _arg[0], sourceColumn = _arg[1]; - if (options == null) { - options = {}; - } - if (this.columns[column] && options.noReplace) { - return; - } - return this.columns[column] = { - line: this.line, - column: column, - sourceLine: sourceLine, - sourceColumn: sourceColumn - }; - }; - - LineMap.prototype.sourceLocation = function(column) { - var mapping; - while (!((mapping = this.columns[column]) || (column <= 0))) { - column--; - } - return mapping && [mapping.sourceLine, mapping.sourceColumn]; - }; - - return LineMap; - - })(); - - SourceMap = (function() { - var BASE64_CHARS, VLQ_CONTINUATION_BIT, VLQ_SHIFT, VLQ_VALUE_MASK; - - function SourceMap() { - this.lines = []; - } - - SourceMap.prototype.add = function(sourceLocation, generatedLocation, options) { - var column, line, lineMap, _base; - if (options == null) { - options = {}; - } - line = generatedLocation[0], column = generatedLocation[1]; - lineMap = ((_base = this.lines)[line] || (_base[line] = new LineMap(line))); - return lineMap.add(column, sourceLocation, options); - }; - - SourceMap.prototype.sourceLocation = function(_arg) { - var column, line, lineMap; - line = _arg[0], column = _arg[1]; - while (!((lineMap = this.lines[line]) || (line <= 0))) { - line--; - } - return lineMap && lineMap.sourceLocation(column); - }; - - SourceMap.prototype.generate = function(options, code) { - var buffer, lastColumn, lastSourceColumn, lastSourceLine, lineMap, lineNumber, mapping, needComma, v3, writingline, _i, _j, _len, _len1, _ref, _ref1; - if (options == null) { - options = {}; - } - if (code == null) { - code = null; - } - writingline = 0; - lastColumn = 0; - lastSourceLine = 0; - lastSourceColumn = 0; - needComma = false; - buffer = ""; - _ref = this.lines; - for (lineNumber = _i = 0, _len = _ref.length; _i < _len; lineNumber = ++_i) { - lineMap = _ref[lineNumber]; - if (lineMap) { - _ref1 = lineMap.columns; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - mapping = _ref1[_j]; - if (!(mapping)) { - continue; - } - while (writingline < mapping.line) { - lastColumn = 0; - needComma = false; - buffer += ";"; - writingline++; - } - if (needComma) { - buffer += ","; - needComma = false; - } - buffer += this.encodeVlq(mapping.column - lastColumn); - lastColumn = mapping.column; - buffer += this.encodeVlq(0); - buffer += this.encodeVlq(mapping.sourceLine - lastSourceLine); - lastSourceLine = mapping.sourceLine; - buffer += this.encodeVlq(mapping.sourceColumn - lastSourceColumn); - lastSourceColumn = mapping.sourceColumn; - needComma = true; - } - } - } - v3 = { - version: 3, - file: options.generatedFile || '', - sourceRoot: options.sourceRoot || '', - sources: options.sourceFiles || [''], - names: [], - mappings: buffer - }; - if (options.inline) { - v3.sourcesContent = [code]; - } - return JSON.stringify(v3, null, 2); - }; - - VLQ_SHIFT = 5; - - VLQ_CONTINUATION_BIT = 1 << VLQ_SHIFT; - - VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1; - - SourceMap.prototype.encodeVlq = function(value) { - var answer, nextChunk, signBit, valueToEncode; - answer = ''; - signBit = value < 0 ? 1 : 0; - valueToEncode = (Math.abs(value) << 1) + signBit; - while (valueToEncode || !answer) { - nextChunk = valueToEncode & VLQ_VALUE_MASK; - valueToEncode = valueToEncode >> VLQ_SHIFT; - if (valueToEncode) { - nextChunk |= VLQ_CONTINUATION_BIT; - } - answer += this.encodeBase64(nextChunk); - } - return answer; - }; - - BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - - SourceMap.prototype.encodeBase64 = function(value) { - return BASE64_CHARS[value] || (function() { - throw new Error("Cannot Base64 encode value: " + value); - })(); - }; - - return SourceMap; - - })(); - - exports.SourceMap = SourceMap; - -}).call(this); diff --git a/node_modules/iced-coffee-script/media/detail.png b/node_modules/iced-coffee-script/media/detail.png deleted file mode 100644 index fc9eefb..0000000 Binary files a/node_modules/iced-coffee-script/media/detail.png and /dev/null differ diff --git a/node_modules/iced-coffee-script/media/post-rotate.png b/node_modules/iced-coffee-script/media/post-rotate.png deleted file mode 100644 index 7237741..0000000 Binary files a/node_modules/iced-coffee-script/media/post-rotate.png and /dev/null differ diff --git a/node_modules/iced-coffee-script/media/rotate.graffle b/node_modules/iced-coffee-script/media/rotate.graffle deleted file mode 100644 index f2eeee1..0000000 --- a/node_modules/iced-coffee-script/media/rotate.graffle +++ /dev/null @@ -1,6497 +0,0 @@ - - - - - ApplicationVersion - - com.omnigroup.OmniGrafflePro - 138.33.0.157554 - - CreationDate - 2011-12-10 05:12:29 +0000 - Creator - Maxwell Krohn - GraphDocumentVersion - 8 - GuidesLocked - NO - GuidesVisible - YES - ImageCounter - 1 - LinksVisible - NO - MagnetsVisible - NO - MasterSheets - - ModificationDate - 2011-12-11 16:42:40 +0000 - Modifier - Maxwell Krohn - NotesVisible - NO - OriginVisible - NO - PageBreaks - YES - PrintInfo - - NSBottomMargin - - float - 41 - - NSHorizonalPagination - - int - 0 - - NSLeftMargin - - float - 18 - - NSOrientation - - int - 1 - - NSPaperSize - - coded - BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAx7X05TU2l6ZT1mZn2WgRgDgWQChg== - - NSPrintReverseOrientation - - int - 0 - - NSRightMargin - - float - 18 - - NSTopMargin - - float - 18 - - - ReadOnly - NO - Sheets - - - ActiveLayerIndex - 4 - AutoAdjust - - BackgroundGraphic - - Bounds - {{0, 0}, {756, 553}} - Class - SolidGraphic - ID - 2 - Style - - shadow - - Draws - NO - - stroke - - Draws - NO - - - - CanvasOrigin - {0, 0} - ColumnAlign - 1 - ColumnSpacing - 36 - DisplayScale - 1 0/72 in = 1.0000 in - GraphicsList - - - Bounds - {{346, 248.625}, {9, 15}} - Class - ShapedGraphic - FitText - YES - Flow - Resize - ID - 89 - Layer - 0 - Shape - Rectangle - Style - - fill - - Draws - NO - - shadow - - Draws - NO - - stroke - - Draws - NO - - - Text - - Pad - 0 - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\b\fs24 \cf0 A} - VerticalPad - 0 - - Wrap - NO - - - Bounds - {{346, 172.5}, {9, 15}} - Class - ShapedGraphic - FitText - YES - Flow - Resize - ID - 88 - Layer - 0 - Shape - Rectangle - Style - - fill - - Draws - NO - - shadow - - Draws - NO - - stroke - - Draws - NO - - - Text - - Pad - 0 - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\b\fs24 \cf0 A} - VerticalPad - 0 - - Wrap - NO - - - Bounds - {{346, 89}, {9, 15}} - Class - ShapedGraphic - FitText - YES - Flow - Resize - ID - 87 - Layer - 0 - Shape - Rectangle - Style - - fill - - Draws - NO - - shadow - - Draws - NO - - stroke - - Draws - NO - - - Text - - Pad - 0 - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\b\fs24 \cf0 A} - VerticalPad - 0 - - Wrap - NO - - - Bounds - {{346, 4}, {9, 15}} - Class - ShapedGraphic - FitText - YES - Flow - Resize - ID - 86 - Layer - 0 - Shape - Rectangle - Style - - fill - - Draws - NO - - shadow - - Draws - NO - - stroke - - Draws - NO - - - Text - - Pad - 0 - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\b\fs24 \cf0 A} - VerticalPad - 0 - - Wrap - NO - - - Class - LineGraphic - Head - - ID - 103 - - ID - 136 - Layer - 1 - Points - - {419.83569, 37.414627} - {661.16437, 103.58539} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 133 - - - - Class - LineGraphic - Head - - ID - 97 - - ID - 135 - Layer - 1 - Points - - {351.1936, 37.437035} - {110.8064, 103.56297} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 133 - - - - Class - LineGraphic - Head - - ID - 104 - - ID - 134 - Layer - 1 - Points - - {385.5, 46.500011} - {385.5, 94.499992} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 133 - - - - Bounds - {{346, 10}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 133 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 131 - - ID - 132 - Layer - 1 - Points - - {551.99615, 300.60721} - {590.00385, 356.39279} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 107 - - - - Bounds - {{562.5, 356}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 131 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 127 - - ID - 130 - Layer - 1 - Points - - {622.07526, 389.92178} - {683.42474, 438.57822} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 131 - - - - Class - LineGraphic - Head - - ID - 125 - - ID - 129 - Layer - 1 - Points - - {581.92474, 389.92178} - {520.57532, 438.57819} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 131 - - - - Class - LineGraphic - Head - - ID - 126 - - ID - 128 - Layer - 1 - Points - - {601.77014, 392.49969} - {601.2298, 436.00031} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 131 - - - - Bounds - {{664, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 127 - Layer - 1 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f6()} - VerticalPad - 0 - - - - Bounds - {{561.5, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 126 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 break} - VerticalPad - 0 - - - - Bounds - {{461, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 125 - Layer - 1 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f5()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 119 - - ID - 124 - Layer - 1 - Points - - {385.5, 361.25} - {385.5, 392.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 122 - - - - Class - LineGraphic - Head - - ID - 122 - - ID - 123 - Layer - 1 - Points - - {385.5, 292.5} - {385.5, 324.25} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 108 - - - - Bounds - {{346, 324.75}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 122 - Layer - 1 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 120 - - ID - 121 - Layer - 1 - Points - - {224.00079, 301.19794} - {202.99921, 355.80206} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 106 - - - - Bounds - {{156.5, 356}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 120 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{346, 393}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 119 - Layer - 1 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f4()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 111 - - ID - 118 - Layer - 1 - Points - - {216.0753, 389.92178} - {277.42471, 438.57822} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 120 - - - - Class - LineGraphic - Head - - ID - 109 - - ID - 117 - Layer - 1 - Points - - {175.92476, 389.92175} - {114.57525, 438.57825} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 120 - - - - Class - LineGraphic - Head - - ID - 110 - - ID - 116 - Layer - 1 - Points - - {195.77019, 392.49969} - {195.22981, 436.00031} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 120 - - - - Class - LineGraphic - Head - - ID - 107 - - ID - 115 - Layer - 1 - Points - - {411.13647, 212.1042} - {514.36359, 268.89578} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 105 - - - - Class - LineGraphic - Head - - ID - 106 - - ID - 114 - Layer - 1 - Points - - {359.86353, 212.1042} - {256.63651, 268.89575} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 105 - - - - Class - LineGraphic - Head - - ID - 108 - - ID - 113 - Layer - 1 - Points - - {385.5, 216.50002} - {385.5, 255.49998} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 105 - - - - Class - LineGraphic - Head - - ID - 105 - - ID - 112 - Layer - 1 - Points - - {385.5, 131.50002} - {385.5, 179.49998} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 104 - - - - Bounds - {{258, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 111 - Layer - 1 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f3()} - VerticalPad - 0 - - - - Bounds - {{155.5, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 110 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 continue} - VerticalPad - 0 - - - - Bounds - {{55, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 109 - Layer - 1 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f2()} - VerticalPad - 0 - - - - Bounds - {{346, 256}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 108 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 await} - VerticalPad - 0 - - - - Bounds - {{500.5, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 107 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 if z} - VerticalPad - 0 - - - - Bounds - {{191.5, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 106 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 if y} - VerticalPad - 0 - - - - Bounds - {{346, 180}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 105 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{346, 95}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 104 - Layer - 1 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 while x2} - VerticalPad - 0 - - - - Class - Group - Graphics - - - Class - LineGraphic - Head - - ID - 100 - - ID - 99 - Points - - {694.5, 216.50002} - {694.5, 264.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 102 - - - - Bounds - {{655, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 100 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f7()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 102 - - ID - 101 - Points - - {695.28235, 131.49973} - {694.71759, 179.50027} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 103 - - - - Bounds - {{655, 180}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 102 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{656, 95}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 103 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 while x3} - VerticalPad - 0 - - - - ID - 98 - Layer - 1 - - - Class - Group - Graphics - - - Class - LineGraphic - Head - - ID - 94 - - ID - 93 - Points - - {75.5, 216.50002} - {75.5, 264.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 96 - - - - Bounds - {{36, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 94 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f1()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 96 - - ID - 95 - Points - - {76.282356, 131.49973} - {75.717644, 179.50027} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 97 - - - - Bounds - {{36, 180}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 96 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{37, 95}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 97 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 while x1} - VerticalPad - 0 - - - - ID - 92 - Layer - 1 - - - Class - LineGraphic - Head - - ID - 44 - - ID - 81 - Layer - 2 - Points - - {419.83569, 37.414627} - {661.16437, 103.58539} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 78 - - - - Class - LineGraphic - Head - - ID - 38 - - ID - 80 - Layer - 2 - Points - - {351.1936, 37.437035} - {110.8064, 103.56297} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 78 - - - - Class - LineGraphic - Head - - ID - 45 - - ID - 79 - Layer - 2 - Points - - {385.5, 46.500011} - {385.5, 94.499992} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 78 - - - - Bounds - {{346, 10}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 78 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 76 - - ID - 77 - Layer - 2 - Points - - {551.99615, 300.60721} - {590.00385, 356.39279} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 48 - - - - Bounds - {{562.5, 356}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 76 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 71 - - ID - 74 - Layer - 2 - Points - - {622.07526, 389.92178} - {683.42474, 438.57822} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 76 - - - - Class - LineGraphic - Head - - ID - 69 - - ID - 73 - Layer - 2 - Points - - {581.92474, 389.92178} - {520.57532, 438.57819} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 76 - - - - Class - LineGraphic - Head - - ID - 70 - - ID - 72 - Layer - 2 - Points - - {601.77014, 392.49969} - {601.2298, 436.00031} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 76 - - - - Bounds - {{664, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 71 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f6()} - VerticalPad - 0 - - - - Bounds - {{561.5, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 70 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 break} - VerticalPad - 0 - - - - Bounds - {{461, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 69 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f5()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 60 - - ID - 68 - Layer - 2 - Points - - {385.5, 361.25} - {385.5, 392.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 66 - - - - Class - LineGraphic - Head - - ID - 66 - - ID - 67 - Layer - 2 - Points - - {385.5, 292.5} - {385.5, 324.25} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 49 - - - - Bounds - {{346, 324.75}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 66 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 64 - - ID - 65 - Layer - 2 - Points - - {224.00079, 301.19794} - {202.99921, 355.80206} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 47 - - - - Bounds - {{156.5, 356}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 64 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{346, 393}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 60 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f4()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 52 - - ID - 59 - Layer - 2 - Points - - {216.0753, 389.92178} - {277.42471, 438.57822} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 64 - - - - Class - LineGraphic - Head - - ID - 50 - - ID - 58 - Layer - 2 - Points - - {175.92471, 389.92178} - {114.57523, 438.57825} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 64 - - - - Class - LineGraphic - Head - - ID - 51 - - ID - 62 - Layer - 2 - Points - - {195.77019, 392.49969} - {195.22981, 436.00031} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 64 - - - - Class - LineGraphic - Head - - ID - 48 - - ID - 56 - Layer - 2 - Points - - {411.13647, 212.1042} - {514.36359, 268.89578} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 46 - - - - Class - LineGraphic - Head - - ID - 47 - - ID - 55 - Layer - 2 - Points - - {359.86356, 212.10419} - {256.63647, 268.89578} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 46 - - - - Class - LineGraphic - Head - - ID - 49 - - ID - 54 - Layer - 2 - Points - - {385.5, 216.50002} - {385.5, 255.49998} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 46 - - - - Class - LineGraphic - Head - - ID - 46 - - ID - 53 - Layer - 2 - Points - - {385.5, 131.50002} - {385.5, 179.49998} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 45 - - - - Bounds - {{258, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 52 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f3()} - VerticalPad - 0 - - - - Bounds - {{155.5, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 51 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 continue} - VerticalPad - 0 - - - - Bounds - {{55, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 50 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f2()} - VerticalPad - 0 - - - - Bounds - {{346, 256}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 49 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 await} - VerticalPad - 0 - - - - Bounds - {{500.5, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 48 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 if z} - VerticalPad - 0 - - - - Bounds - {{191.5, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 47 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 if y} - VerticalPad - 0 - - - - Bounds - {{346, 180}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 46 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{346, 95}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 45 - Layer - 2 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 while x2} - VerticalPad - 0 - - - - Class - Group - Graphics - - - Class - LineGraphic - Head - - ID - 41 - - ID - 40 - Points - - {694.5, 216.50002} - {694.5, 264.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 43 - - - - Bounds - {{655, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 41 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f7()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 43 - - ID - 42 - Points - - {695.28235, 131.49973} - {694.71759, 179.50027} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 44 - - - - Bounds - {{655, 180}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 43 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{656, 95}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 44 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 while x3} - VerticalPad - 0 - - - - ID - 39 - Layer - 2 - - - Class - Group - Graphics - - - Class - LineGraphic - Head - - ID - 35 - - ID - 34 - Points - - {75.5, 216.50002} - {75.5, 264.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 37 - - - - Bounds - {{36, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 35 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f1()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 37 - - ID - 36 - Points - - {76.282356, 131.49973} - {75.717644, 179.50027} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 38 - - - - Bounds - {{36, 180}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 37 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{37, 95}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 38 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 while x1} - VerticalPad - 0 - - - - ID - 33 - Layer - 2 - - - Bounds - {{137.00021, 5.0000305}, {518.99976, 485.00015}} - Class - ShapedGraphic - ID - 91 - Layer - 3 - Shape - Bezier - ShapeData - - UnitPoints - - {-0.10693675, -0.5} - {-0.10693675, -0.5} - {-0.14161879, -0.071133643} - {-0.14161879, -0.071133643} - {-0.14161879, -0.071133643} - {-0.40944257, 0.05051589} - {-0.40944257, 0.05051589} - {-0.40944257, 0.05051589} - {-0.5, 0.31649494} - {-0.5, 0.31649494} - {-0.5, 0.31649494} - {-0.48458618, 0.5} - {-0.48458618, 0.49999976} - {-0.48458618, 0.49999976} - {-0.29961511, 0.5} - {-0.29961511, 0.5} - {-0.29961511, 0.5} - {-0.27649364, 0.26288617} - {-0.27649364, 0.26288617} - {-0.27649364, 0.26288617} - {-0.18015492, 0.067010641} - {-0.18015492, 0.067010641} - {-0.18015492, 0.067010641} - {-0.020232081, -0.029896706} - {-0.020232081, -0.029896706} - {-0.020232081, -0.029896706} - {0.17437387, 0.095876276} - {0.17437387, 0.095876276} - {0.17437387, 0.095876276} - {0.29768735, 0.2628867} - {0.29768735, 0.2628867} - {0.29768735, 0.2628867} - {0.30539495, 0.47938085} - {0.30539495, 0.47938085} - {0.30539495, 0.47938085} - {0.50000006, 0.47938085} - {0.50000006, 0.47938085} - {0.50000006, 0.47938085} - {0.50000006, 0.24639207} - {0.50000006, 0.24639207} - {0.50000006, 0.24639207} - {0.36127168, 0.029897034} - {0.36127168, 0.029897034} - {0.36127168, 0.029897034} - {0.10308123, -0.081443101} - {0.10308123, -0.081443101} - {0.10308123, -0.081443101} - {0.064546824, -0.5} - {0.064546824, -0.49999988} - {0.064546824, -0.50000018} - {-0.10693675, -0.5} - - - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 1 - - - - - - Bounds - {{326, 4}, {118, 301}} - Class - ShapedGraphic - ID - 84 - Layer - 4 - Shape - RoundRect - Style - - fill - - Color - - b - 1 - g - 0.8 - r - 0.4 - - MiddleColor - - b - 0.588235 - g - 0.917647 - r - 0.568627 - - TrippleBlend - YES - - - - - Bounds - {{38.000275, 67.999847}, {714.99963, 433.00006}} - Class - ShapedGraphic - ID - 90 - Layer - 5 - Shape - Bezier - ShapeData - - UnitPoints - - {-0.014685571, -0.49999997} - {-0.014685571, -0.50000036} - {-0.10559458, -0.45381027} - {-0.10559458, -0.45381027} - {-0.10559458, -0.45381027} - {-0.11398581, -0.16974851} - {-0.11398581, -0.16974851} - {-0.11398581, -0.16974851} - {-0.30699325, -0.045034766} - {-0.30699325, -0.045034766} - {-0.30699325, -0.045034766} - {-0.5, 0.42609698} - {-0.5, 0.42609698} - {-0.5, 0.42609698} - {-0.44965035, 0.47459596} - {-0.44965035, 0.47459596} - {-0.44965035, 0.47459596} - {0.0062935948, 0.4999997} - {0.0062935948, 0.50000006} - {0.0062935948, 0.50000006} - {0.45244771, 0.46535784} - {0.45244771, 0.46535784} - {0.45244771, 0.46535784} - {0.50000006, 0.40762061} - {0.50000006, 0.40762061} - {0.49999946, 0.40762061} - {0.30419588, -0.033487022} - {0.30419588, -0.033487022} - {0.30419588, -0.033487022} - {0.11398667, -0.17436829} - {0.11398667, -0.17436829} - {0.11398667, -0.17436808} - {0.069231153, -0.45842981} - {0.069231153, -0.45842981} - {0.069231153, -0.45842981} - {-0.014685869, -0.5000006} - - - Style - - fill - - Color - - b - 0.811765 - g - 0.435294 - r - 1 - - - - - - GridInfo - - HPages - 1 - KeepToScale - - Layers - - - Lock - NO - Name - A Labels - Print - YES - View - NO - - - Lock - NO - Name - Final - Print - YES - View - NO - - - Lock - NO - Name - Graph - Print - YES - View - YES - - - Lock - NO - Name - Pass 3 - Print - YES - View - NO - - - Lock - NO - Name - Pass 1 - Print - YES - View - NO - - - Lock - NO - Name - Pass 2 - Print - YES - View - NO - - - LayoutInfo - - Animate - NO - circoMinDist - 18 - circoSeparation - 0.0 - layoutEngine - dot - neatoSeparation - 0.0 - twopiSeparation - 0.0 - - Orientation - 2 - PrintOnePage - - RowAlign - 1 - RowSpacing - 36 - SheetTitle - Canvas 1 - UniqueID - 1 - VPages - 1 - - - ActiveLayerIndex - 0 - AutoAdjust - - BackgroundGraphic - - Bounds - {{0, 0}, {756, 553}} - Class - SolidGraphic - ID - 2 - Style - - shadow - - Draws - NO - - stroke - - Draws - NO - - - - CanvasOrigin - {0, 0} - ColumnAlign - 1 - ColumnSpacing - 36 - DisplayScale - 1 0/72 in = 1.0000 in - GraphicsList - - - Bounds - {{609.42883, 467.47443}, {53, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 91 - Layer - 0 - Line - - ID - 90 - Position - 0.41918012499809265 - RotationType - 0 - - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 0.8 - r - 1 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 71 - - ID - 90 - Layer - 0 - Points - - {604.43402, 468.48761} - {679.56836, 509.01151} - - Style - - stroke - - Color - - b - 0.4 - g - 0.8 - r - 1 - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - Width - 2 - - - Tail - - ID - 70 - - - - Bounds - {{247.13251, 456.6409}, {53, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 89 - Layer - 0 - Line - - ID - 88 - Position - 0.49565210938453674 - RotationType - 0 - - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 0.8 - r - 1 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 52 - - ID - 88 - Layer - 0 - Points - - {215.28778, 462.22324} - {333.00085, 487.27643} - - Style - - stroke - - Color - - b - 0.4 - g - 0.8 - r - 1 - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - Width - 2 - - - Tail - - ID - 51 - - - - Bounds - {{456.758, 264.49744}, {53, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 87 - Layer - 0 - Line - - ID - 86 - Position - 0.49565210938453674 - RotationType - 0 - - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 0.8 - r - 1 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 48 - - ID - 86 - Layer - 0 - Points - - {425.49759, 282.20352} - {542.03174, 282.79648} - - Style - - stroke - - Color - - b - 0.4 - g - 0.8 - r - 1 - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - Width - 2 - - - Tail - - ID - 49 - - - - Bounds - {{253.32349, 264.52615}, {53, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 85 - Layer - 0 - Line - - ID - 84 - Position - 0.45652154088020325 - RotationType - 0 - - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 0.8 - r - 1 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 49 - - ID - 84 - Layer - 0 - Points - - {224.65329, 282.80084} - {345.50232, 282.19916} - - Style - - stroke - - Color - - b - 0.4 - g - 0.8 - r - 1 - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - Width - 2 - - - Tail - - ID - 47 - - - - Bounds - {{500, 95}, {53, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 82 - Layer - 0 - Line - - ID - 81 - Position - 0.49565210938453674 - RotationType - 0 - - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 0.8 - r - 1 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 44 - - ID - 81 - Layer - 0 - Points - - {425.50003, 113} - {655.5, 113} - - Style - - stroke - - Color - - b - 0.4 - g - 0.8 - r - 1 - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - Width - 2 - - - Tail - - ID - 45 - - - - Class - LineGraphic - Head - - ID - 38 - - ID - 80 - Layer - 0 - Points - - {351.1936, 37.437035} - {110.8064, 103.56297} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 78 - - - - Class - LineGraphic - Head - - ID - 45 - - ID - 79 - Layer - 0 - Points - - {385.5, 46.500011} - {385.5, 94.499992} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 78 - - - - Bounds - {{346, 10}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 78 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 76 - - ID - 77 - Layer - 0 - Points - - {582.0293, 301.5} - {582.0293, 355.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 48 - - - - Bounds - {{542.5293, 356}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 76 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 69 - - ID - 73 - Layer - 0 - Points - - {561.51398, 389.80014} - {498.01974, 438.70108} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 76 - - - - Class - LineGraphic - Head - - ID - 70 - - ID - 72 - Layer - 0 - Points - - {581.21851, 392.49597} - {579.31134, 436.00406} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 76 - - - - Bounds - {{666, 505}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 71 - Layer - 0 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f6()} - VerticalPad - 0 - - - - Bounds - {{539, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 70 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 break} - VerticalPad - 0 - - - - Bounds - {{438, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 69 - Layer - 0 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f5()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 60 - - ID - 68 - Layer - 0 - Points - - {385.5, 361.25} - {385.5, 392.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 66 - - - - Class - LineGraphic - Head - - ID - 66 - - ID - 67 - Layer - 0 - Points - - {385.5, 300.5} - {385.5, 324.25} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 49 - - - - Bounds - {{346, 324.75}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 66 - Layer - 0 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 64 - - ID - 65 - Layer - 0 - Points - - {184.65109, 301.5} - {184.63783, 355.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 47 - - - - Bounds - {{145.15562, 356}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 64 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{346, 393}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 60 - Layer - 0 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f4()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 50 - - ID - 58 - Layer - 0 - Points - - {163.90605, 389.73416} - {99.246216, 438.76492} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 64 - - - - Class - LineGraphic - Head - - ID - 51 - - ID - 62 - Layer - 0 - Points - - {183.35385, 392.48959} - {180.28973, 436.01022} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 64 - - - - Class - LineGraphic - Head - - ID - 47 - - ID - 55 - Layer - 0 - Points - - {356.09601, 210.44415} - {214.05963, 270.55582} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 46 - - - - Class - LineGraphic - Head - - ID - 46 - - ID - 53 - Layer - 0 - Points - - {385.5, 131.50002} - {385.5, 179.49998} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 45 - - - - Bounds - {{329.78827, 477}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 52 - Layer - 0 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f3()} - VerticalPad - 0 - - - - Bounds - {{139.5, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 51 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 continue} - VerticalPad - 0 - - - - Bounds - {{39, 436.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 50 - Layer - 0 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f2()} - VerticalPad - 0 - - - - Bounds - {{346, 264}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 49 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 await} - VerticalPad - 0 - - - - Bounds - {{542.5293, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 48 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 if z} - VerticalPad - 0 - - - - Bounds - {{145.15562, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 47 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 if y} - VerticalPad - 0 - - - - Bounds - {{346, 180}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 46 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{346, 95}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 45 - Layer - 0 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 while x2} - VerticalPad - 0 - - - - Class - Group - Graphics - - - Class - LineGraphic - Head - - ID - 41 - - ID - 40 - Points - - {694.5, 216.50002} - {694.5, 264.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 43 - - - - Bounds - {{655, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 41 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f7()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 43 - - ID - 42 - Points - - {695.28235, 131.49973} - {694.71759, 179.50027} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 44 - - - - Bounds - {{655, 180}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 43 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{656, 95}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 44 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 while x3} - VerticalPad - 0 - - - - ID - 39 - Layer - 0 - - - Class - Group - Graphics - - - Class - LineGraphic - Head - - ID - 35 - - ID - 34 - Points - - {75.5, 216.50002} - {75.5, 264.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 37 - - - - Bounds - {{36, 265}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 35 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f1()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 37 - - ID - 36 - Points - - {76.282356, 131.49973} - {75.717644, 179.50027} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 38 - - - - Bounds - {{36, 180}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 37 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{37, 95}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 38 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 while x1} - VerticalPad - 0 - - - - ID - 33 - Layer - 0 - - - GridInfo - - HPages - 1 - KeepToScale - - Layers - - - Lock - NO - Name - Graph - Print - YES - View - YES - - - Lock - NO - Name - Layer 1 - Print - YES - View - YES - - - LayoutInfo - - Animate - NO - circoMinDist - 18 - circoSeparation - 0.0 - layoutEngine - dot - neatoSeparation - 0.0 - twopiSeparation - 0.0 - - Orientation - 2 - PrintOnePage - - RowAlign - 1 - RowSpacing - 36 - SheetTitle - Canvas 2 - UniqueID - 2 - VPages - 1 - - - ActiveLayerIndex - 0 - AutoAdjust - - BackgroundGraphic - - Bounds - {{0, 0}, {756, 553}} - Class - SolidGraphic - ID - 2 - Style - - shadow - - Draws - NO - - stroke - - Draws - NO - - - - CanvasOrigin - {0, 0} - ColumnAlign - 1 - ColumnSpacing - 36 - DisplayScale - 1 0/72 in = 1.0000 in - GraphicsList - - - Bounds - {{407.44391, 341.46844}, {53, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 91 - Line - - ID - 90 - Position - 0.41918012499809265 - RotationType - 0 - - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 0.8 - r - 1 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 71 - - ID - 90 - Points - - {402.44086, 342.48489} - {477.59482, 383.00098} - - Style - - stroke - - Color - - b - 0.4 - g - 0.8 - r - 1 - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - Width - 2 - - - Tail - - ID - 70 - - - - Bounds - {{254.75797, 138.49727}, {53, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 87 - Line - - ID - 86 - Position - 0.49565210938453674 - RotationType - 0 - - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 0.8 - r - 1 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 48 - - ID - 86 - Points - - {223.49757, 156.20346} - {340.03171, 156.79623} - - Style - - stroke - - Color - - b - 0.4 - g - 0.8 - r - 1 - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - Width - 2 - - - Tail - - ID - 49 - - - - Class - LineGraphic - Head - - ID - 76 - - ID - 77 - Points - - {380.0293, 175.50002} - {380.0293, 229.49998} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 48 - - - - Bounds - {{340.5293, 230}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 76 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 69 - - ID - 73 - Points - - {359.51303, 263.79996} - {296.01627, 312.70004} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 76 - - - - Class - LineGraphic - Head - - ID - 70 - - ID - 72 - Points - - {379.21838, 266.49597} - {377.31091, 310.00403} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 76 - - - - Bounds - {{464, 379}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 71 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f6()} - VerticalPad - 0 - - - - Bounds - {{337, 310.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 70 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 break} - VerticalPad - 0 - - - - Bounds - {{236, 310.5}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 69 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f5()} - VerticalPad - 0 - - - - Class - LineGraphic - Head - - ID - 60 - - ID - 68 - Points - - {183.5, 235.25002} - {183.5, 266.5} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 66 - - - - Class - LineGraphic - Head - - ID - 66 - - ID - 67 - Points - - {183.5, 174.50002} - {183.5, 198.24998} - - Style - - stroke - - HeadArrow - FilledArrow - LineType - 1 - TailArrow - 0 - - - Tail - - ID - 49 - - - - Bounds - {{144, 198.75}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 66 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 block} - VerticalPad - 0 - - - - Bounds - {{144, 267}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 60 - Shape - Circle - Style - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 f4()} - VerticalPad - 0 - - - - Bounds - {{144, 138}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 49 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 await} - VerticalPad - 0 - - - - Bounds - {{340.5293, 139}, {79, 36}} - Class - ShapedGraphic - FontInfo - - Font - AndaleMono - Size - 10 - - ID - 48 - Shape - Circle - Style - - fill - - Color - - b - 0.4 - g - 1 - r - 0.8 - - - - Text - - Text - {\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf100 -{\fonttbl\f0\fnil\fcharset0 AndaleMono;} -{\colortbl;\red255\green255\blue255;} -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc - -\f0\fs20 \cf0 if z} - VerticalPad - 0 - - - - GridInfo - - HPages - 1 - KeepToScale - - Layers - - - Lock - NO - Name - Layer 1 - Print - YES - View - YES - - - LayoutInfo - - Animate - NO - circoMinDist - 18 - circoSeparation - 0.0 - layoutEngine - dot - neatoSeparation - 0.0 - twopiSeparation - 0.0 - - Orientation - 2 - PrintOnePage - - RowAlign - 1 - RowSpacing - 36 - SheetTitle - Canvas 3 - UniqueID - 3 - VPages - 1 - - - SmartAlignmentGuidesActive - YES - SmartDistanceGuidesActive - YES - UseEntirePage - - WindowInfo - - CurrentSheet - 2 - ExpandedCanvases - - - name - Canvas 1 - - - name - Canvas 2 - - - Frame - {{50, 89}, {1085, 789}} - ListView - - OutlineWidth - 142 - RightSidebar - - ShowRuler - - Sidebar - - SidebarWidth - 120 - VisibleRegion - {{-97, -40}, {950, 634}} - Zoom - 1 - ZoomValues - - - Canvas 1 - 1 - 2 - - - Canvas 2 - 1 - 1 - - - Canvas 3 - 1 - 1 - - - - saveQuickLookFiles - YES - - diff --git a/node_modules/iced-coffee-script/media/rotate1.png b/node_modules/iced-coffee-script/media/rotate1.png deleted file mode 100644 index e9560ac..0000000 Binary files a/node_modules/iced-coffee-script/media/rotate1.png and /dev/null differ diff --git a/node_modules/iced-coffee-script/media/rotate2.png b/node_modules/iced-coffee-script/media/rotate2.png deleted file mode 100644 index 369a762..0000000 Binary files a/node_modules/iced-coffee-script/media/rotate2.png and /dev/null differ diff --git a/node_modules/iced-coffee-script/media/rotate3.png b/node_modules/iced-coffee-script/media/rotate3.png deleted file mode 100644 index c34fd56..0000000 Binary files a/node_modules/iced-coffee-script/media/rotate3.png and /dev/null differ diff --git a/node_modules/iced-coffee-script/media/rotate4.png b/node_modules/iced-coffee-script/media/rotate4.png deleted file mode 100644 index 2c9aaff..0000000 Binary files a/node_modules/iced-coffee-script/media/rotate4.png and /dev/null differ diff --git a/node_modules/iced-coffee-script/media/rotate5.png b/node_modules/iced-coffee-script/media/rotate5.png deleted file mode 100644 index 2f1da94..0000000 Binary files a/node_modules/iced-coffee-script/media/rotate5.png and /dev/null differ diff --git a/node_modules/iced-coffee-script/media/sketch.pdf b/node_modules/iced-coffee-script/media/sketch.pdf deleted file mode 100644 index b689083..0000000 Binary files a/node_modules/iced-coffee-script/media/sketch.pdf and /dev/null differ diff --git a/node_modules/iced-coffee-script/package.json b/node_modules/iced-coffee-script/package.json deleted file mode 100644 index d54e155..0000000 --- a/node_modules/iced-coffee-script/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "iced-coffee-script", - "description": "IcedCoffeeScript", - "keywords": [ - "javascript", - "language", - "coffeescript", - "compiler" - ], - "author": { - "name": "Maxwell Krohn" - }, - "version": "1.6.3-g", - "licenses": [ - { - "type": "MIT", - "url": "https://raw.github.com/maxtaco/coffee-script/master/LICENSE" - } - ], - "engines": { - "node": ">=0.8.0" - }, - "directories": { - "lib": "./lib/coffee-script" - }, - "main": "./lib/coffee-script/coffee-script", - "bin": { - "iced": "./bin/coffee", - "icake": "./bin/cake" - }, - "scripts": { - "test": "node ./bin/cake test" - }, - "homepage": "http://maxtaco.github.io/coffee-script", - "bugs": { - "url": "https://github.com/maxtaco/coffee-script/issues" - }, - "repository": { - "type": "git", - "url": "git://github.com/maxtaco/coffee-script.git" - }, - "devDependencies": { - "uglify-js": "~2.2", - "jison": ">=0.2.0" - }, - "readme": " \n \n ICED\n \n _____ __ __\n / ____| / _|/ _|\n .- ----------- -. | | ___ | |_| |_ ___ ___\n ( (ice cubes) ) | | / _ \\| _| _/ _ \\/ _ \\\n |`-..________ ..-'| | |___| (_) | | | || __/ __/\n | | \\_____\\___/|_| |_| \\___|\\___|\n | ;--.\n | (__ \\ _____ _ _\n | | ) ) / ____| (_) | |\n | |/ / | (___ ___ _ __ _ _ __ | |_\n | ( / \\___ \\ / __| '__| | '_ \\| __|\n | |/ ____) | (__| | | | |_) | |_\n | | |_____/ \\___|_| |_| .__/ \\__|\n `-.._________..-' | |\n |_|\n\n\n CoffeeScript is a little language that compiles into JavaScript.\n IcedCoffeeScript is a superset of CoffeeScript that adds two new \n keywords: await and defer.\n\n Install Node.js, and then the CoffeeScript compiler:\n sudo bin/cake install\n\n Or, if you have the Node Package Manager installed:\n npm install -g iced-coffee-script\n (Leave off the -g if you don't wish to install globally.)\n\n Execute a script:\n iced /path/to/script.coffee\n\n Compile a script:\n iced -c /path/to/script.coffee\n\n For documentation, usage, and examples, see:\n http://maxtaco.github.com/coffee-script\n\n For iced-specific technical documentation, see:\n https://github.com/maxtaco/coffee-script/blob/iced/iced.md\n\n To suggest a feature, report a bug, or general discussion:\n https://github.com/maxtaco/coffee-script/issues/\n\n DM or tweet at me with questions: @maxtaco\n\n Or better yet, tweet about how much you love IcedCoffeeScript.\n\n The source repository:\n git://github.com/maxtaco/coffee-script.git\n\n All contributors are listed here:\n http://github.com/maxtaco/coffee-script/contributors\n", - "readmeFilename": "README", - "_id": "iced-coffee-script@1.6.3-g", - "_from": "iced-coffee-script@>1.4.0" -} diff --git a/node_modules/jade/.npmignore b/node_modules/jade/.npmignore deleted file mode 100644 index fdc7b89..0000000 --- a/node_modules/jade/.npmignore +++ /dev/null @@ -1,14 +0,0 @@ -test -support -benchmarks -examples -lib-cov -coverage.html -.gitmodules -.travis.yml -History.md -Makefile -test/ -support/ -benchmarks/ -examples/ diff --git a/node_modules/jade/LICENSE b/node_modules/jade/LICENSE deleted file mode 100644 index 8ad0e0d..0000000 --- a/node_modules/jade/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2009-2010 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/jade/Readme.md b/node_modules/jade/Readme.md deleted file mode 100644 index 9a312cd..0000000 --- a/node_modules/jade/Readme.md +++ /dev/null @@ -1,1300 +0,0 @@ -# Jade - template engine -[![Build Status](https://secure.travis-ci.org/visionmedia/jade.png)](http://travis-ci.org/visionmedia/jade) -[![Dependency Status](https://gemnasium.com/visionmedia/jade.png)](https://gemnasium.com/visionmedia/jade) - - Jade is a high performance template engine heavily influenced by [Haml](http://haml-lang.com) - and implemented with JavaScript for [node](http://nodejs.org). For discussion join the [Google Group](http://groups.google.com/group/jadejs). - -## Test drive - - You can test drive Jade online [here](http://naltatis.github.com/jade-syntax-docs). - -## README Contents - -- [Features](#a1) -- [Implementations](#a2) -- [Installation](#a3) -- [Browser Support](#a4) -- [Public API](#a5) -- [Syntax](#a6) - - [Line Endings](#a6-1) - - [Tags](#a6-2) - - [Tag Text](#a6-3) - - [Comments](#a6-4) - - [Block Comments](#a6-5) - - [Nesting](#a6-6) - - [Block Expansion](#a6-7) - - [Case](#a6-8) - - [Attributes](#a6-9) - - [HTML](#a6-10) - - [Doctypes](#a6-11) -- [Filters](#a7) -- [Code](#a8) -- [Iteration](#a9) -- [Conditionals](#a10) -- [Template inheritance](#a11) -- [Block append / prepend](#a12) -- [Includes](#a13) -- [Mixins](#a14) -- [Generated Output](#a15) -- [Example Makefile](#a16) -- [jade(1)](#a17) -- [Tutorials](#a18) -- [License](#a19) - - -## Features - - - client-side support - - great readability - - flexible indentation - - block-expansion - - mixins - - static includes - - attribute interpolation - - code is escaped by default for security - - contextual error reporting at compile & run time - - executable for compiling jade templates via the command line - - html 5 mode (the default doctype) - - optional memory caching - - combine dynamic and static tag classes - - parse tree manipulation via _filters_ - - template inheritance - - block append / prepend - - supports [Express JS](http://expressjs.com) out of the box - - transparent iteration over objects, arrays, and even non-enumerables via `each` - - block comments - - no tag prefix - - filters - - :stylus must have [stylus](http://github.com/LearnBoost/stylus) installed - - :less must have [less.js](http://github.com/cloudhead/less.js) installed - - :markdown must have [markdown-js](http://github.com/evilstreak/markdown-js), [node-discount](http://github.com/visionmedia/node-discount), or [marked](http://github.com/chjj/marked) installed - - :cdata - - :coffeescript must have [coffee-script](http://jashkenas.github.com/coffee-script/) installed - - [Emacs Mode](https://github.com/brianc/jade-mode) - - [Vim Syntax](https://github.com/digitaltoad/vim-jade) - - [TextMate Bundle](http://github.com/miksago/jade-tmbundle) - - [Coda/SubEtha syntax Mode](https://github.com/aaronmccall/jade.mode) - - [Screencasts](http://tjholowaychuk.com/post/1004255394/jade-screencast-template-engine-for-nodejs) - - [html2jade](https://github.com/donpark/html2jade) converter - - -## Implementations - - - [php](http://github.com/everzet/jade.php) - - [scala](http://scalate.fusesource.org/versions/snapshot/documentation/scaml-reference.html) - - [ruby](http://github.com/stonean/slim) - - [python](https://github.com/SyrusAkbary/pyjade) - - [java](https://github.com/neuland/jade4j) - - -## Installation - -via npm: - -```bash -$ npm install jade -``` - - -## Browser Support - - To compile jade to a single file compatible for client-side use simply execute: - -```bash -$ make jade.js -``` - - Alternatively, if uglifyjs is installed via npm (`npm install uglify-js`) you may execute the following which will create both files. However each release builds these for you. - -```bash -$ make jade.min.js -``` - - By default Jade instruments templates with line number statements such as `__.lineno = 3` for debugging purposes. When used in a browser it's useful to minimize this boiler plate, you can do so by passing the option `{ compileDebug: false }`. The following template - -```jade -p Hello #{name} -``` - - Can then be as small as the following generated function: - -```js -function anonymous(locals, attrs, escape, rethrow) { - var buf = []; - with (locals || {}) { - var interp; - buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); - } - return buf.join(""); -} -``` - - Through the use of Jade's `./runtime.js` you may utilize these pre-compiled templates on the client-side _without_ Jade itself, all you need is the associated utility functions (in runtime.js), which are then available as `jade.attrs`, `jade.escape` etc. To enable this you should pass `{ client: true }` to `jade.compile()` to tell Jade to reference the helper functions - via `jade.attrs`, `jade.escape` etc. - -```js -function anonymous(locals, attrs, escape, rethrow) { - var attrs = jade.attrs, escape = jade.escape, rethrow = jade.rethrow; - var buf = []; - with (locals || {}) { - var interp; - buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); - } - return buf.join(""); -} -``` - -
    -## Public API - -```js -var jade = require('jade'); - -// Compile a function -var fn = jade.compile('string of jade', options); -fn(locals); -``` - -### Options - - - `self` Use a `self` namespace to hold the locals _(false by default)_ - - `locals` Local variable object - - `filename` Used in exceptions, and required when using includes - - `debug` Outputs tokens and function body generated - - `compiler` Compiler to replace jade's default - - `compileDebug` When `false` no debug instrumentation is compiled - - `pretty` Add pretty-indentation whitespace to output _(false by default)_ - - -## Syntax - - -### Line Endings - -**CRLF** and **CR** are converted to **LF** before parsing. - - -### Tags - -A tag is simply a leading word: - -```jade -html -``` - -for example is converted to `` - -tags can also have ids: - -```jade -div#container -``` - -which would render `
    ` - -how about some classes? - -```jade -div.user-details -``` - -renders `
    ` - -multiple classes? _and_ an id? sure: - -```jade -div#foo.bar.baz -``` - -renders `
    ` - -div div div sure is annoying, how about: - -```jade -#foo -.bar -``` - -which is syntactic sugar for what we have already been doing, and outputs: - -```html -
    -``` - -
    -### Tag Text - -Simply place some content after the tag: - -```jade -p wahoo! -``` - -renders `

    wahoo!

    `. - -well cool, but how about large bodies of text: - -```jade -p - | foo bar baz - | rawr rawr - | super cool - | go jade go -``` - -renders `

    foo bar baz rawr.....

    ` - -interpolation? yup! both types of text can utilize interpolation, -if we passed `{ name: 'tj', email: 'tj@vision-media.ca' }` to the compiled function we can do the following: - -```jade -#user #{name} <#{email}> -``` - -outputs `
    tj <tj@vision-media.ca>
    ` - -Actually want `#{}` for some reason? escape it! - -```jade -p \#{something} -``` - -now we have `

    #{something}

    ` - -We can also utilize the unescaped variant `!{html}`, so the following -will result in a literal script tag: - -```jade -- var html = "" -| !{html} -``` - -Nested tags that also contain text can optionally use a text block: - -```jade -label - | Username: - input(name='user[name]') -``` - -or immediate tag text: - -```jade -label Username: - input(name='user[name]') -``` - -Tags that accept _only_ text such as `script` and `style` do not -need the leading `|` character, for example: - -```jade -html - head - title Example - script - if (foo) { - bar(); - } else { - baz(); - } -``` - -Once again as an alternative, we may use a trailing `.` to indicate a text block, for example: - -```jade -p. - foo asdf - asdf - asdfasdfaf - asdf - asd. -``` - -outputs: - -```html -

    foo asdf -asdf - asdfasdfaf - asdf -asd. -

    -``` - -This however differs from a trailing `.` followed by a space, which although is ignored by the Jade parser, tells Jade that this period is a literal: - -```jade -p . -``` - -outputs: - -```html -

    .

    -``` - -It should be noted that text blocks should be doubled escaped. For example if you desire the following output. - -```html -

    foo\bar

    -``` - -use: - -```jade -p. - foo\\bar -``` - -
    -### Comments - -Single line comments currently look the same as JavaScript comments, -aka `//` and must be placed on their own line: - -```jade -// just some paragraphs -p foo -p bar -``` - -would output - -```html - -

    foo

    -

    bar

    -``` - -Jade also supports unbuffered comments, by simply adding a hyphen: - -```jade -//- will not output within markup -p foo -p bar -``` - -outputting - -```html -

    foo

    -

    bar

    -``` - -
    -### Block Comments - - A block comment is legal as well: - -```jade -body - // - #content - h1 Example -``` - -outputting - -```html - - - -``` - -Jade supports conditional-comments as well, for example: - -```jade -head - //if lt IE 8 - script(src='/ie-sucks.js') -``` - -outputs: - -```html - - - -``` - - -### Nesting - - Jade supports nesting to define the tags in a natural way: - -```jade -ul - li.first - a(href='#') foo - li - a(href='#') bar - li.last - a(href='#') baz -``` - - -### Block Expansion - - Block expansion allows you to create terse single-line nested tags, - the following example is equivalent to the nesting example above. - -```jade -ul - li.first: a(href='#') foo - li: a(href='#') bar - li.last: a(href='#') baz -``` - - -### Case - - The case statement takes the following form: - -```jade -html - body - friends = 10 - case friends - when 0 - p you have no friends - when 1 - p you have a friend - default - p you have #{friends} friends -``` - - Block expansion may also be used: - -```jade -friends = 5 - -html - body - case friends - when 0: p you have no friends - when 1: p you have a friend - default: p you have #{friends} friends -``` - - -### Attributes - -Jade currently supports `(` and `)` as attribute delimiters. - -```jade -a(href='/login', title='View login page') Login -``` - -When a value is `undefined` or `null` the attribute is _not_ added, -so this is fine, it will not compile `something="null"`. - -```jade -div(something=null) -``` - -Boolean attributes are also supported: - -```jade -input(type="checkbox", checked) -``` - -Boolean attributes with code will only output the attribute when `true`: - -```jade -input(type="checkbox", checked=someValue) -``` - -Multiple lines work too: - -```jade -input(type='checkbox', - name='agreement', - checked) -``` - -Multiple lines without the comma work fine: - -```jade -input(type='checkbox' - name='agreement' - checked) -``` - -Funky whitespace? fine: - -```jade -input( - type='checkbox' - name='agreement' - checked) -``` - -Colons work: - -```jade -rss(xmlns:atom="atom") -``` - -Suppose we have the `user` local `{ id: 12, name: 'tobi' }` -and we wish to create an anchor tag with `href` pointing to "/user/12" -we could use regular javascript concatenation: - -```jade -a(href='/user/' + user.id)= user.name -``` - -or we could use jade's interpolation, which I added because everyone -using Ruby or CoffeeScript seems to think this is legal js..: - -```jade -a(href='/user/#{user.id}')= user.name -``` - -The `class` attribute is special-cased when an array is given, -allowing you to pass an array such as `bodyClasses = ['user', 'authenticated']` directly: - -```jade -body(class=bodyClasses) -``` - - -### HTML - - Inline html is fine, we can use the pipe syntax to - write arbitrary text, in this case some html: - -```jade -html - body - |

    Title

    - |

    foo bar baz

    -``` - - Or we can use the trailing `.` to indicate to Jade that we - only want text in this block, allowing us to omit the pipes: - -```jade -html - body. -

    Title

    -

    foo bar baz

    -``` - - Both of these examples yield the same result: - -```html -

    Title

    -

    foo bar baz

    - -``` - - The same rule applies for anywhere you can have text - in jade, raw html is fine: - -```jade -html - body - h1 User #{name} -``` - -
    -### Doctypes - -To add a doctype simply use `!!!`, or `doctype` followed by an optional value: - -```jade -!!! -``` - -or - -```jade -doctype -``` - -Will output the _html 5_ doctype, however: - -```jade -!!! transitional -``` - -Will output the _transitional_ doctype. - -Doctypes are case-insensitive, so the following are equivalent: - -```jade -doctype Basic -doctype basic -``` - -it's also possible to simply pass a doctype literal: - -```jade -doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN -``` - -yielding: - -```html - -``` - -Below are the doctypes defined by default, which can easily be extended: - -```js -var doctypes = exports.doctypes = { - '5': '', - 'default': '', - 'xml': '', - 'transitional': '', - 'strict': '', - 'frameset': '', - '1.1': '', - 'basic': '', - 'mobile': '' -}; -``` - -To alter the default simply change: - -```js -jade.doctypes.default = 'whatever you want'; -``` - - -## Filters - -Filters are prefixed with `:`, for example `:markdown` and -pass the following block of text to an arbitrary function for processing. View the _features_ -at the top of this document for available filters. - -```jade -body - :markdown - Woah! jade _and_ markdown, very **cool** - we can even link to [stuff](http://google.com) -``` - -Renders: - -```html -

    Woah! jade and markdown, very cool we can even link to stuff

    -``` - - -## Code - -Jade currently supports three classifications of executable code. The first -is prefixed by `-`, and is not buffered: - -```jade -- var foo = 'bar'; -``` - -This can be used for conditionals, or iteration: - -```jade -- for (var key in obj) - p= obj[key] -``` - -Due to Jade's buffering techniques the following is valid as well: - -```jade -- if (foo) - ul - li yay - li foo - li worked -- else - p oh no! didnt work -``` - -Hell, even verbose iteration: - -```jade -- if (items.length) - ul - - items.forEach(function(item){ - li= item - - }) -``` - -Anything you want! - -Next up we have _escaped_ buffered code, which is used to -buffer a return value, which is prefixed by `=`: - -```jade -- var foo = 'bar' -= foo -h1= foo -``` - -Which outputs `bar

    bar

    `. Code buffered by `=` is escaped -by default for security, however to output unescaped return values -you may use `!=`: - -```jade -p!= aVarContainingMoreHTML -``` - - Jade also has designer-friendly variants, making the literal JavaScript - more expressive and declarative. For example the following assignments - are equivalent, and the expression is still regular javascript: - -```jade -- var foo = 'foo ' + 'bar' -foo = 'foo ' + 'bar' -``` - - Likewise Jade has first-class `if`, `else if`, `else`, `until`, `while`, `unless` among others, however you must remember that the expressions are still regular javascript: - -```jade -if foo == 'bar' - ul - li yay - li foo - li worked -else - p oh no! didnt work -``` - -
    -## Iteration - - Along with vanilla JavaScript Jade also supports a subset of - constructs that allow you to create more designer-friendly templates, - one of these constructs is `each`, taking the form: - -```jade -each VAL[, KEY] in OBJ -``` - -An example iterating over an array: - -```jade -- var items = ["one", "two", "three"] -each item in items - li= item -``` - -outputs: - -```html -
  • one
  • -
  • two
  • -
  • three
  • -``` - -iterating an array with index: - -```jade -items = ["one", "two", "three"] -each item, i in items - li #{item}: #{i} -``` - -outputs: - -```html -
  • one: 0
  • -
  • two: 1
  • -
  • three: 2
  • -``` - -iterating an object's keys and values: - -```jade -obj = { foo: 'bar' } -each val, key in obj - li #{key}: #{val} -``` - -would output `
  • foo: bar
  • ` - -Internally Jade converts these statements to regular -JavaScript loops such as `users.forEach(function(user){`, -so lexical scope and nesting applies as it would with regular -JavaScript: - -```jade -each user in users - each role in user.roles - li= role -``` - - You may also use `for` if you prefer: - -```jade -for user in users - for role in user.roles - li= role -``` - -
    -## Conditionals - - Jade conditionals are equivalent to those using the code (`-`) prefix, - however allow you to ditch parenthesis to become more designer friendly, - however keep in mind the expression given is _regular_ JavaScript: - -```jade -for user in users - if user.role == 'admin' - p #{user.name} is an admin - else - p= user.name -``` - - is equivalent to the following using vanilla JavaScript literals: - -```jade -for user in users - - if (user.role == 'admin') - p #{user.name} is an admin - - else - p= user.name -``` - - Jade also provides `unless` which is equivalent to `if (!(expr))`: - -```jade -for user in users - unless user.isAnonymous - p - | Click to view - a(href='/users/' + user.id)= user.name -``` - - -## Template inheritance - - Jade supports template inheritance via the `block` and `extends` keywords. A block is simply a "block" of Jade that may be replaced within a child template, this process is recursive. To activate template inheritance in Express 2.x you must add: `app.set('view options', { layout: false });`. - - Jade blocks can provide default content if desired, however optional as shown below by `block scripts`, `block content`, and `block foot`. - -```jade -html - head - h1 My Site - #{title} - block scripts - script(src='/jquery.js') - body - block content - block foot - #footer - p some footer content -``` - - Now to extend the layout, simply create a new file and use the `extends` directive as shown below, giving the path (with or without the .jade extension). You may now define one or more blocks that will override the parent block content, note that here the `foot` block is _not_ redefined and will output "some footer content". - -```jade -extends layout - -block scripts - script(src='/jquery.js') - script(src='/pets.js') - -block content - h1= title - each pet in pets - include pet -``` - - It's also possible to override a block to provide additional blocks, as shown in the following example where `content` now exposes a `sidebar` and `primary` block for overriding, or the child template could override `content` all together. - -```jade -extends regular-layout - -block content - .sidebar - block sidebar - p nothing - .primary - block primary - p nothing -``` - - -## Block append / prepend - - Jade allows you to _replace_ (default), _prepend_, or _append_ blocks. Suppose for example you have default scripts in a "head" block that you wish to utilize on _every_ page, you might do this: - -```jade -html - head - block head - script(src='/vendor/jquery.js') - script(src='/vendor/caustic.js') - body - block content -``` - - Now suppose you have a page of your application for a JavaScript game, you want some game related scripts as well as these defaults, you can simply `append` the block: - -```jade -extends layout - -block append head - script(src='/vendor/three.js') - script(src='/game.js') -``` - - When using `block append` or `block prepend` the `block` is optional: - -```jade -extends layout - -append head - script(src='/vendor/three.js') - script(src='/game.js') -``` - - -## Includes - - Includes allow you to statically include chunks of Jade, - or other content like css, or html which lives in separate files. The classical example is including a header and footer. Suppose we have the following directory structure: - - ./layout.jade - ./includes/ - ./head.jade - ./foot.jade - -and the following _layout.jade_: - -```jade -html - include includes/head - body - h1 My Site - p Welcome to my super amazing site. - include includes/foot -``` - -both includes _includes/head_ and _includes/foot_ are -read relative to the `filename` option given to _layout.jade_, -which should be an absolute path to this file, however Express does this for you. Include then parses these files, and injects the AST produced to render what you would expect: - -```html - - - My Site - - - -

    My Site

    -

    Welcome to my super lame site.

    - - - -``` - - As mentioned `include` can be used to include other content - such as html or css. By providing an extension Jade will not - assume that the file is Jade source and will include it as - a literal: - -```jade -html - body - include content.html -``` - - Include directives may also accept a block, in which case the - the given block will be appended to the _last_ block defined - in the file. For example if `head.jade` contains: - -```jade -head - script(src='/jquery.js') -``` - - We may append values by providing a block to `include head` - as shown below, adding the two scripts. - -```jade -html - include head - script(src='/foo.js') - script(src='/bar.js') - body - h1 test -``` - - You may also `yield` within an included template, allowing you to explicitly mark where the block given to `include` will be placed. Suppose for example you wish to prepend scripts rather than append, you might do the following: - -```jade -head - yield - script(src='/jquery.js') - script(src='/jquery.ui.js') -``` - - Since included Jade is parsed and literally merges the AST, lexically scoped variables function as if the included Jade was written right in the same file. This means `include` may be used as sort of partial, for example suppose we have `user.jade` which utilizes a `user` variable. - -```jade -h1= user.name -p= user.occupation -``` - -We could then simply `include user` while iterating users, and since the `user` variable is already defined within the loop the included template will have access to it. - -```jade -users = [{ name: 'Tobi', occupation: 'Ferret' }] - -each user in users - .user - include user -``` - -yielding: - -```html -
    -

    Tobi

    -

    Ferret

    -
    -``` - -If we wanted to expose a different variable name as `user` since `user.jade` references that name, we could simply define a new variable as shown here with `user = person`: - -```jade -each person in users - .user - user = person - include user -``` - -
    -## Mixins - - Mixins are converted to regular JavaScript functions in - the compiled template that Jade constructs. Mixins may - take arguments, though not required: - -```jade -mixin list - ul - li foo - li bar - li baz -``` - - Utilizing a mixin without args looks similar, just without a block: - -```jade -h2 Groceries -mixin list -``` - - Mixins may take one or more arguments as well, the arguments - are regular javascripts expressions, so for example the following: - -```jade -mixin pets(pets) - ul.pets - - each pet in pets - li= pet - -mixin profile(user) - .user - h2= user.name - mixin pets(user.pets) -``` - - Would yield something similar to the following html: - -```html -
    -

    tj

    -
      -
    • tobi
    • -
    • loki
    • -
    • jane
    • -
    • manny
    • -
    -
    -``` - -
    -## Generated Output - - Suppose we have the following Jade: - -```jade -- var title = 'yay' -h1.title #{title} -p Just an example -``` - - When the `compileDebug` option is not explicitly `false`, Jade - will compile the function instrumented with `__.lineno = n;`, which - in the event of an exception is passed to `rethrow()` which constructs - a useful message relative to the initial Jade input. - -```js -function anonymous(locals) { - var __ = { lineno: 1, input: "- var title = 'yay'\nh1.title #{title}\np Just an example", filename: "testing/test.js" }; - var rethrow = jade.rethrow; - try { - var attrs = jade.attrs, escape = jade.escape; - var buf = []; - with (locals || {}) { - var interp; - __.lineno = 1; - var title = 'yay' - __.lineno = 2; - buf.push(''); - buf.push('' + escape((interp = title) == null ? '' : interp) + ''); - buf.push(''); - __.lineno = 3; - buf.push('

    '); - buf.push('Just an example'); - buf.push('

    '); - } - return buf.join(""); - } catch (err) { - rethrow(err, __.input, __.filename, __.lineno); - } -} -``` - -When the `compileDebug` option _is_ explicitly `false`, this instrumentation -is stripped, which is very helpful for light-weight client-side templates. Combining Jade's options with the `./runtime.js` file in this repo allows you -to toString() compiled templates and avoid running the entire Jade library on -the client, increasing performance, and decreasing the amount of JavaScript -required. - -```js -function anonymous(locals) { - var attrs = jade.attrs, escape = jade.escape; - var buf = []; - with (locals || {}) { - var interp; - var title = 'yay' - buf.push(''); - buf.push('' + escape((interp = title) == null ? '' : interp) + ''); - buf.push(''); - buf.push('

    '); - buf.push('Just an example'); - buf.push('

    '); - } - return buf.join(""); -} -``` - -
    -## Example Makefile - - Below is an example Makefile used to compile _pages/*.jade_ - into _pages/*.html_ files by simply executing `make`. - -_Note:_ If you try to run this snippet and `make` throws a `missing separator` error, you should make sure all indented lines use a tab for indentation instead of spaces. (For whatever reason, GitHub renders this code snippet with 4-space indentation although the actual README file uses tabs in this snippet.) - -```make -JADE = $(shell find . -wholename './pages/*.jade') -HTML = $(JADE:.jade=.html) - -all: $(HTML) - -%.html: %.jade - jade < $< --path $< > $@ - -clean: - rm -f $(HTML) - -.PHONY: clean -``` - -this can be combined with the `watch(1)` command to produce -a watcher-like behaviour: - -```bash -$ watch make -``` - - -## jade(1) - -``` - -Usage: jade [options] [dir|file ...] - -Options: - - -h, --help output usage information - -V, --version output the version number - -o, --obj javascript options object - -O, --out output the compiled html to - -p, --path filename used to resolve includes - -P, --pretty compile pretty html output - -c, --client compile for client-side runtime.js - -D, --no-debug compile without debugging (smaller functions) - -Examples: - - # translate jade the templates dir - $ jade templates - - # create {foo,bar}.html - $ jade {foo,bar}.jade - - # jade over stdio - $ jade < my.jade > my.html - - # jade over stdio - $ echo "h1 Jade!" | jade - - # foo, bar dirs rendering to /tmp - $ jade foo bar --out /tmp - -``` - - -## Tutorials - - - cssdeck interactive [Jade syntax tutorial](http://cssdeck.com/labs/learning-the-jade-templating-engine-syntax) - - cssdeck interactive [Jade logic tutorial](http://cssdeck.com/labs/jade-templating-tutorial-codecast-part-2) - - in [Japanese](http://blog.craftgear.net/4f501e97c1347ec934000001/title/10%E5%88%86%E3%81%A7%E3%82%8F%E3%81%8B%E3%82%8Bjade%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%82%A8%E3%83%B3%E3%82%B8%E3%83%B3) - - -## License - -(The MIT License) - -Copyright (c) 2009-2010 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/jade/Readme_zh-cn.md b/node_modules/jade/Readme_zh-cn.md deleted file mode 100644 index cb90608..0000000 --- a/node_modules/jade/Readme_zh-cn.md +++ /dev/null @@ -1,921 +0,0 @@ -# Jade - 模板引擎 - - Jade 是一个高性能的模板引擎,它深受[Haml](http://haml-lang.com)影响,它是用javascript实现的,并且可以供[node](http://nodejs.org)使用. - - 翻译:[草依山](http://jser.me)   [翻译反馈](http://weibo.com/1826461472/z9jriDdmB#pl_profile_nav)  [Fork me](https://github.com/jserme/jade/) - -## 特性 - - - 客户端支持 - - 代码高可读 - - 灵活的缩进 - - 块展开 - - 混合 - - 静态包含 - - 属性改写 - - 安全,默认代码是转义的 - - 运行时和编译时上下文错误报告 - - 命令行下编译jade模板 - - html 5 模式 (使用 _!!! 5_ 文档类型) - - 在内存中缓存(可选) - - 合并动态和静态标签类 - - 可以通过 _filters_ 修改树 - - 模板继承 - - 原生支持 [Express JS](http://expressjs.com) - - 通过 `each` 枚举对象、数组甚至是不能枚举的对象 - - 块注释 - - 没有前缀的标签 - - AST filters - - 过滤器 - - :sass 必须已经安装[sass.js](http://github.com/visionmedia/sass.js) - - :less 必须已经安装[less.js](http://github.com/cloudhead/less.js) - - :markdown 必须已经安装[markdown-js](http://github.com/evilstreak/markdown-js) 或者[node-discount](http://github.com/visionmedia/node-discount) - - :cdata - - :coffeescript 必须已经安装[coffee-script](http://jashkenas.github.com/coffee-script/) - - [Vim Syntax](https://github.com/digitaltoad/vim-jade) - - [TextMate Bundle](http://github.com/miksago/jade-tmbundle) - - [Screencasts](http://tjholowaychuk.com/post/1004255394/jade-screencast-template-engine-for-nodejs) - - [html2jade](https://github.com/donpark/html2jade) 转换器 - -## 其它实现 - - - [php](http://github.com/everzet/jade.php) - - [scala](http://scalate.fusesource.org/versions/snapshot/documentation/scaml-reference.html) - - [ruby](http://github.com/stonean/slim) - -## 安装 - -通过 npm: - - npm install jade - -## 浏览器支持 - - 把jade编译为一个可供浏览器使用的单文件,只需要简单的执行: - - $ make jade.js - - 如果你已经安装了uglifyjs (`npm install uglify-js`),你可以执行下面的命令它会生成所有的文件。其实每一个正式版本里都帮你做了这事。 - - $ make jade.min.js - - 默认情况下,为了方便调试Jade会把模板组织成带有形如 `__.lineno = 3` 的行号的形式。 - 在浏览器里使用的时候,你可以通过传递一个选项`{ compileDebug: false }`来去掉这个。 - 下面的模板 - - p Hello #{name} - - 会被翻译成下面的函数: - -```js -function anonymous(locals, attrs, escape, rethrow) { - var buf = []; - with (locals || {}) { - var interp; - buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); - } - return buf.join(""); -} -``` - - 通过使用Jade的 `./runtime.js`你可以在浏览器使用这些预编译的模板而不需要使用Jade, 你只需要使用runtime.js里的工具函数, 它们会放在`jade.attrs`, `jade.escape` 这些里。 把选项 `{ client: true }` 传递给 `jade.compile()`, Jade 会把这些帮助函数的引用放在`jade.attrs`, `jade.escape`. - -```js -function anonymous(locals, attrs, escape, rethrow) { - var attrs = jade.attrs, escape = jade.escape, rethrow = jade.rethrow; - var buf = []; - with (locals || {}) { - var interp; - buf.push('\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\n

    '); - } - return buf.join(""); -} -``` - -## 公开API - -```javascript - var jade = require('jade'); - - // Compile a function - var fn = jade.compile('string of jade', options); - fn(locals); -``` - -### 选项 - - - `self` 使用`self` 命名空间来持有本地变量. _默认为false_ - - `locals` 本地变量对象 - - `filename` 异常发生时使用,includes时必需 - - `debug` 输出token和翻译后的函数体 - - `compiler` 替换掉jade默认的编译器 - - `compileDebug` `false`的时候调试的结构不会被输出 - -## 语法 - -### 行结束标志 - -**CRLF** 和 **CR** 会在编译之前被转换为 **LF** - -### 标签 - -标签就是一个简单的单词: - - html - -它会被转换为 `` - -标签也是可以有id的: - - div#container - -它会被转换为 `
    ` - -怎么加类呢? - - div.user-details - -转换为 `
    ` - -多个类? 和id? 也是可以搞定的: - - div#foo.bar.baz - -转换为 `
    ` - -不停的div div div 很讨厌啊 , 可以这样: - - #foo - .bar - -这个算是我们的语法糖,它已经被很好的支持了,上面的会输出: - - `
    ` - -### 标签文本 - -只需要简单的把内容放在标签之后: - - p wahoo! - -它会被渲染为 `

    wahoo!

    `. - -很帅吧,但是大段的文本怎么办呢: - - p - | foo bar baz - | rawr rawr - | super cool - | go jade go - -渲染为 `

    foo bar baz rawr.....

    ` - -怎么和数据结合起来? 所有类型的文本展示都可以和数据结合起来,如果我们把`{ name: 'tj', email: 'tj@vision-media.ca' }` 传给编译函数,下面是模板上的写法: - - #user #{name} <#{email}> - -它会被渲染为 `
    tj <tj@vision-media.ca>
    ` - -当就是要输出`#{}` 的时候怎么办? 转义一下! - - p \#{something} - -它会输出`

    #{something}

    ` - -同样可以使用非转义的变量`!{html}`, 下面的模板将直接输出一个script标签 - - - var html = "" - | !{html} - -内联标签同样可以使用文本块来包含文本: - - label - | Username: - input(name='user[name]') - -或者直接使用标签文本: - - label Username: - input(name='user[name]') - -_只_包含文本的标签,比如`script`, `style`, 和 `textarea` 不需要前缀`|` 字符, 比如: - - html - head - title Example - script - if (foo) { - bar(); - } else { - baz(); - } - -这里还有一种选择,可以使用'.' 来开始一段文本块,比如: - - p. - foo asdf - asdf - asdfasdfaf - asdf - asd. - -会被渲染为: - -

    foo asdf - asdf - asdfasdfaf - asdf - asd - . -

    - -这和带一个空格的 '.' 是不一样的, 带空格的会被Jade的解析器忽略,当作一个普通的文字: - - p . - -渲染为: - -

    .

    - - -需要注意的是广西块需要两次转义。比如想要输出下面的文本: - -

    foo\bar

    - -使用: - - p. - foo\\bar - -### 注释 - -单行注释和JavaScript里是一样的,通过"//"来开始,并且必须单独一行: - - // just some paragraphs - p foo - p bar - -渲染为: - - -

    foo

    -

    bar

    - -Jade 同样支持不输出的注释,加一个短横线就行了: - - //- will not output within markup - p foo - p bar - -渲染为: - -

    foo

    -

    bar

    - -### 块注释 - - 块注释也是支持的: - - body - // - #content - h1 Example - -渲染为: - - - - - -Jade 同样很好的支持了条件注释: - - body - //if IE - a(href='http://www.mozilla.com/en-US/firefox/') Get Firefox - - -渲染为: - - - - - -### 内联 - - Jade 支持以自然的方式定义标签嵌套: - - ul - li.first - a(href='#') foo - li - a(href='#') bar - li.last - a(href='#') baz - -### 块展开 - - 块展开可以帮助你在一行内创建嵌套的标签,下面的例子和上面的是一样的: - - ul - li.first: a(href='#') foo - li: a(href='#') bar - li.last: a(href='#') baz - - -### 属性 - -Jade 现在支持使用'(' 和 ')' 作为属性分隔符 - - a(href='/login', title='View login page') Login - -当一个值是 `undefined` 或者 `null` 属性_不_会被加上, -所以呢,它不会编译出 'something="null"'. - - div(something=null) - -Boolean 属性也是支持的: - - input(type="checkbox", checked) - -使用代码的Boolean 属性只有当属性为`true`时才会输出: - - input(type="checkbox", checked=someValue) - -多行同样也是可用的: - - input(type='checkbox', - name='agreement', - checked) - -多行的时候可以不加逗号: - - input(type='checkbox' - name='agreement' - checked) - -加点空格,格式好看一点?同样支持 - - input( - type='checkbox' - name='agreement' - checked) - -冒号也是支持的: - - rss(xmlns:atom="atom") - -假如我有一个`user` 对象 `{ id: 12, name: 'tobi' }` -我们希望创建一个指向"/user/12"的链接 `href`, 我们可以使用普通的javascript字符串连接,如下: - - a(href='/user/' + user.id)= user.name - -或者我们使用jade的修改方式,这个我想很多使用Ruby或者 CoffeeScript的人会看起来像普通的js..: - - a(href='/user/#{user.id}')= user.name - -`class`属性是一个特殊的属性,你可以直接传递一个数组,比如`bodyClasses = ['user', 'authenticated']` : - - body(class=bodyClasses) - -### HTML - - 内联的html是可以的,我们可以使用管道定义一段文本 : - -``` -html - body - |

    Title

    - |

    foo bar baz

    -``` - - 或者我们可以使用`.` 来告诉Jade我们需要一段文本: - -``` -html - body. -

    Title

    -

    foo bar baz

    -``` - - 上面的两个例子都会渲染成相同的结果: - -``` -

    Title

    -

    foo bar baz

    - -``` - - 这条规则适应于在jade里的任何文本: - -``` -html - body - h1 User #{name} -``` - -### Doctypes - -添加文档类型只需要简单的使用 `!!!`, 或者 `doctype` 跟上下面的可选项: - - !!! - -会渲染出 _transitional_ 文档类型, 或者: - - !!! 5 - -or - - !!! html - -or - - doctype html - -doctypes 是大小写不敏感的, 所以下面两个是一样的: - - doctype Basic - doctype basic - -当然也是可以直接传递一段文档类型的文本: - - doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN - -渲染后: - - - -会输出 _html 5_ 文档类型. 下面的默认的文档类型,可以很简单的扩展: - -```javascript - var doctypes = exports.doctypes = { - '5': '', - 'xml': '', - 'default': '', - 'transitional': '', - 'strict': '', - 'frameset': '', - '1.1': '', - 'basic': '', - 'mobile': '' - }; -``` - -通过下面的代码可以很简单的改变默认的文档类型: - -```javascript - jade.doctypes.default = 'whatever you want'; -``` - -## 过滤器 - -过滤器前缀 `:`, 比如 `:markdown` 会把下面块里的文本交给专门的函数进行处理。查看顶部 _特性_ 里有哪些可用的过滤器。 - - body - :markdown - Woah! jade _and_ markdown, very **cool** - we can even link to [stuff](http://google.com) - -渲染为: - -

    Woah! jade and markdown, very cool we can even link to stuff

    - -## 代码 - -Jade目前支持三种类型的可执行代码。第一种是前缀`-`, 这是不会被输出的: - - - var foo = 'bar'; - -这可以用在条件语句或者循环中: - - - for (var key in obj) - p= obj[key] - -由于Jade的缓存技术,下面的代码也是可以的: - - - if (foo) - ul - li yay - li foo - li worked - - else - p oh no! didnt work - -哈哈,甚至是很长的循环也是可以的: - - - if (items.length) - ul - - items.forEach(function(item){ - li= item - - }) - -所以你想要的! - -下一步我们要_转义_输出的代码,比如我们返回一个值,只要前缀一个`=`: - - - var foo = 'bar' - = foo - h1= foo - -它会渲染为`bar

    bar

    `. 为了安全起见,使用`=`输出的代码默认是转义的,如果想直接输出不转义的值可以使用`!=`: - - p!= aVarContainingMoreHTML - -Jade 同样是设计师友好的,它可以使javascript更直接更富表现力。比如下面的赋值语句是相等的,同时表达式还是通常的javascript: - - - var foo = 'foo ' + 'bar' - foo = 'foo ' + 'bar' - -Jade会把 `if`, `else if`, `else`, `until`, `while`, `unless`同别的优先对待, 但是你得记住它们还是普通的javascript: - - if foo == 'bar' - ul - li yay - li foo - li worked - else - p oh no! didnt work - -## 循环 - -尽管已经支持JavaScript原生代码,Jade还是支持了一些特殊的标签,它们可以让模板更加易于理解,其中之一就是`each`, 这种形式: - - each VAL[, KEY] in OBJ - -一个遍历数组的例子 : - - - var items = ["one", "two", "three"] - each item in items - li= item - -渲染为: - -
  • one
  • -
  • two
  • -
  • three
  • - -遍历一个数组同时带上索引: - - items = ["one", "two", "three"] - each item, i in items - li #{item}: #{i} - -渲染为: - -
  • one: 0
  • -
  • two: 1
  • -
  • three: 2
  • - -遍历一个数组的键值: - - obj = { foo: 'bar' } - each val, key in obj - li #{key}: #{val} - -将会渲染为:`
  • foo: bar
  • ` - -Jade在内部会把这些语句转换成原生的JavaScript语句,就像使用 `users.forEach(function(user){`, -词法作用域和嵌套会像在普通的JavaScript中一样: - - each user in users - each role in user.roles - li= role - -如果你喜欢,也可以使用`for` : - - for user in users - for role in user.roles - li= role - -## 条件语句 - -Jade 条件语句和使用了(`-`) 前缀的JavaScript语句是一致的,然后它允许你不使用圆括号,这样会看上去对设计师更友好一点, -同时要在心里记住这个表达式渲染出的是_常规_Javascript: - - for user in users - if user.role == 'admin' - p #{user.name} is an admin - else - p= user.name - -和下面的使用了常规JavaScript的代码是相等的: - - for user in users - - if (user.role == 'admin') - p #{user.name} is an admin - - else - p= user.name - -Jade 同时支持`unless`, 这和`if (!(expr))`是等价的: - - for user in users - unless user.isAnonymous - p - | Click to view - a(href='/users/' + user.id)= user.name - -## 模板继承 - - Jade 支持通过 `block` 和 `extends` 关键字来实现模板继承。 一个块就是一个Jade的"block" ,它将在子模板中实现,同时是支持递归的。 - - Jade 块如果没有内容,Jade会添加默认内容,下面的代码默认会输出`block scripts`, `block content`, 和 `block foot`. - -``` -html - head - h1 My Site - #{title} - block scripts - script(src='/jquery.js') - body - block content - block foot - #footer - p some footer content -``` - - 现在我们来继承这个布局,简单创建一个新文件,像下面那样直接使用`extends`,给定路径(可以选择带.jade扩展名或者不带). 你可以定义一个或者更多的块来覆盖父级块内容, 注意到这里的`foot`块_没有_定义,所以它还会输出父级的"some footer content"。 - -``` -extends extend-layout - -block scripts - script(src='/jquery.js') - script(src='/pets.js') - -block content - h1= title - each pet in pets - include pet -``` - - 同样可以在一个子块里添加块,就像下面实现的块`content`里又定义了两个可以被实现的块`sidebar`和`primary`,或者子模板直接实现`content`。 - -``` -extends regular-layout - -block content - .sidebar - block sidebar - p nothing - .primary - block primary - p nothing -``` - -## 包含 - - Includes 允许你静态包含一段Jade, 或者别的存放在单个文件中的东西比如css, html。 非常常见的例子是包含头部和页脚。 假设我们有一个下面目录结构的文件夹: - - ./layout.jade - ./includes/ - ./head.jade - ./tail.jade - -下面是 _layout.jade_ 的内容: - - html - include includes/head - body - h1 My Site - p Welcome to my super amazing site. - include includes/foot - -这两个包含 _includes/head_ 和 _includes/foot_ 都会读取相对于给 _layout.jade_ 参数`filename` 的路径的文件, 这是一个绝对路径,不用担心Express帮你搞定这些了。Include 会解析这些文件,并且插入到已经生成的语法树中,然后渲染为你期待的内容: - -```html - - - My Site - - - -

    My Site

    -

    Welcome to my super lame site.

    - - - -``` - - 前面已经提到,`include` 可以包含比如html或者css这样的内容。给定一个扩展名后,Jade不会把这个文件当作一个Jade源代码,并且会把它当作一个普通文本包含进来: - -``` -html - body - include content.html -``` - - Include 也可以接受块内容,给定的块将会附加到包含文件 _最后_ 的块里。 举个例子,`head.jade` 包含下面的内容: - - - ``` -head - script(src='/jquery.js') -``` - - 我们可以像下面给`include head`添加内容, 这里是添加两个脚本. - -``` -html - include head - script(src='/foo.js') - script(src='/bar.js') - body - h1 test -``` - - -## Mixins - - Mixins在编译的模板里会被Jade转换为普通的JavaScript函数。 Mixins 可以还参数,但不是必需的: - - mixin list - ul - li foo - li bar - li baz - - 使用不带参数的mixin看上去非常简单,在一个块外: - - h2 Groceries - mixin list - - Mixins 也可以带一个或者多个参数,参数就是普通的javascripts表达式,比如下面的例子: - - mixin pets(pets) - ul.pets - - each pet in pets - li= pet - - mixin profile(user) - .user - h2= user.name - mixin pets(user.pets) - - 会输出像下面的html: - -```html -
    -

    tj

    -
      -
    • tobi
    • -
    • loki
    • -
    • jane
    • -
    • manny
    • -
    -
    -``` - -## 产生输出 - - 假设我们有下面的Jade源码: - -``` -- var title = 'yay' -h1.title #{title} -p Just an example -``` - - 当 `compileDebug` 选项不是`false`, Jade 会编译时会把函数里加上 `__.lineno = n;`, 这个参数会在编译出错时传递给`rethrow()`, 而这个函数会在Jade初始输出时给出一个有用的错误信息。 - -```js -function anonymous(locals) { - var __ = { lineno: 1, input: "- var title = 'yay'\nh1.title #{title}\np Just an example", filename: "testing/test.js" }; - var rethrow = jade.rethrow; - try { - var attrs = jade.attrs, escape = jade.escape; - var buf = []; - with (locals || {}) { - var interp; - __.lineno = 1; - var title = 'yay' - __.lineno = 2; - buf.push(''); - buf.push('' + escape((interp = title) == null ? '' : interp) + ''); - buf.push(''); - __.lineno = 3; - buf.push('

    '); - buf.push('Just an example'); - buf.push('

    '); - } - return buf.join(""); - } catch (err) { - rethrow(err, __.input, __.filename, __.lineno); - } -} -``` - -当`compileDebug` 参数是`false`, 这个参数会被去掉,这样对于轻量级的浏览器端模板是非常有用的。结合Jade的参数和当前源码库里的 `./runtime.js` 文件,你可以通过toString()来编译模板而不需要在浏览器端运行整个Jade库,这样可以提高性能,也可以减少载入的JavaScript数量。 - -```js -function anonymous(locals) { - var attrs = jade.attrs, escape = jade.escape; - var buf = []; - with (locals || {}) { - var interp; - var title = 'yay' - buf.push(''); - buf.push('' + escape((interp = title) == null ? '' : interp) + ''); - buf.push(''); - buf.push('

    '); - buf.push('Just an example'); - buf.push('

    '); - } - return buf.join(""); -} -``` - -## Makefile的一个例子 - - 通过执行`make`, 下面的Makefile例子可以把 _pages/*.jade_ 编译为 _pages/*.html_ 。 - -```make -JADE = $(shell find pages/*.jade) -HTML = $(JADE:.jade=.html) - -all: $(HTML) - -%.html: %.jade - jade < $< --path $< > $@ - -clean: - rm -f $(HTML) - -.PHONY: clean -``` - -这个可以和`watch(1)` 命令起来产生像下面的行为: - - $ watch make - -## 命令行的jade(1) - -``` - -使用: jade [options] [dir|file ...] - -选项: - - -h, --help 输出帮助信息 - -v, --version 输出版本号 - -o, --obj javascript选项 - -O, --out 输出编译后的html到 - -p, --path 在处理stdio时,查找包含文件时的查找路径 - -Examples: - - # 编译整个目录 - $ jade templates - - # 生成 {foo,bar}.html - $ jade {foo,bar}.jade - - # 在标准IO下使用jade - $ jade < my.jade > my.html - - # 在标准IO下使用jade, 同时指定用于查找包含的文件 - $ jade < my.jade -p my.jade > my.html - - # 在标准IO下使用jade - $ echo "h1 Jade!" | jade - - # foo, bar 目录渲染到 /tmp - $ jade foo bar --out /tmp - -``` - -## License - -(The MIT License) - -Copyright (c) 2009-2010 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/jade/bin/jade b/node_modules/jade/bin/jade deleted file mode 100755 index 8f1c816..0000000 --- a/node_modules/jade/bin/jade +++ /dev/null @@ -1,168 +0,0 @@ -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var fs = require('fs') - , program = require('commander') - , path = require('path') - , basename = path.basename - , dirname = path.dirname - , resolve = path.resolve - , exists = fs.existsSync || path.existsSync - , join = path.join - , mkdirp = require('mkdirp') - , jade = require('../'); - -// jade options - -var options = {}; - -// options - -program - .version(jade.version) - .usage('[options] [dir|file ...]') - .option('-o, --obj ', 'javascript options object') - .option('-O, --out ', 'output the compiled html to ') - .option('-p, --path ', 'filename used to resolve includes') - .option('-P, --pretty', 'compile pretty html output') - .option('-c, --client', 'compile function for client-side runtime.js') - .option('-D, --no-debug', 'compile without debugging (smaller functions)') - .option('-w, --watch', 'watch files for changes and automatically re-render') - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' # translate jade the templates dir'); - console.log(' $ jade templates'); - console.log(''); - console.log(' # create {foo,bar}.html'); - console.log(' $ jade {foo,bar}.jade'); - console.log(''); - console.log(' # jade over stdio'); - console.log(' $ jade < my.jade > my.html'); - console.log(''); - console.log(' # jade over stdio'); - console.log(' $ echo "h1 Jade!" | jade'); - console.log(''); - console.log(' # foo, bar dirs rendering to /tmp'); - console.log(' $ jade foo bar --out /tmp '); - console.log(''); -}); - -program.parse(process.argv); - -// options given, parse them - -if (program.obj) { - if (exists(program.obj)) { - options = JSON.parse(fs.readFileSync(program.obj)); - } else { - options = eval('(' + program.obj + ')'); - } -} - -// --filename - -if (program.path) options.filename = program.path; - -// --no-debug - -options.compileDebug = program.debug; - -// --client - -options.client = program.client; - -// --pretty - -options.pretty = program.pretty; - -// --watch - -options.watch = program.watch; - -// left-over args are file paths - -var files = program.args; - -// compile files - -if (files.length) { - console.log(); - files.forEach(renderFile); - if (options.watch) { - files.forEach(function (file) { - fs.watchFile(file, {interval: 100}, function (curr, prev) { - if (curr.mtime > prev.mtime) renderFile(file); - }); - }); - } - process.on('exit', function () { - console.log(); - }); -// stdio -} else { - stdin(); -} - -/** - * Compile from stdin. - */ - -function stdin() { - var buf = ''; - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function(chunk){ buf += chunk; }); - process.stdin.on('end', function(){ - var fn = jade.compile(buf, options); - var output = options.client - ? fn.toString() - : fn(options); - process.stdout.write(output); - }).resume(); -} - -/** - * Process the given path, compiling the jade files found. - * Always walk the subdirectories. - */ - -function renderFile(path) { - var re = /\.jade$/; - fs.lstat(path, function(err, stat) { - if (err) throw err; - // Found jade file - if (stat.isFile() && re.test(path)) { - fs.readFile(path, 'utf8', function(err, str){ - if (err) throw err; - options.filename = path; - var fn = jade.compile(str, options); - var extname = options.client ? '.js' : '.html'; - path = path.replace(re, extname); - if (program.out) path = join(program.out, basename(path)); - var dir = resolve(dirname(path)); - mkdirp(dir, 0755, function(err){ - if (err) throw err; - var output = options.client - ? fn.toString() - : fn(options); - fs.writeFile(path, output, function(err){ - if (err) throw err; - console.log(' \033[90mrendered \033[36m%s\033[0m', path); - }); - }); - }); - // Found directory - } else if (stat.isDirectory()) { - fs.readdir(path, function(err, files) { - if (err) throw err; - files.map(function(filename) { - return path + '/' + filename; - }).forEach(renderFile); - }); - } - }); -} diff --git a/node_modules/jade/index.js b/node_modules/jade/index.js deleted file mode 100644 index 8ad059f..0000000 --- a/node_modules/jade/index.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = process.env.JADE_COV - ? require('./lib-cov/jade') - : require('./lib/jade'); \ No newline at end of file diff --git a/node_modules/jade/jade.js b/node_modules/jade/jade.js deleted file mode 100644 index ad22ec3..0000000 --- a/node_modules/jade/jade.js +++ /dev/null @@ -1,3654 +0,0 @@ -(function() { - -// CommonJS require() - -function require(p){ - var path = require.resolve(p) - , mod = require.modules[path]; - if (!mod) throw new Error('failed to require "' + p + '"'); - if (!mod.exports) { - mod.exports = {}; - mod.call(mod.exports, mod, mod.exports, require.relative(path)); - } - return mod.exports; - } - -require.modules = {}; - -require.resolve = function (path){ - var orig = path - , reg = path + '.js' - , index = path + '/index.js'; - return require.modules[reg] && reg - || require.modules[index] && index - || orig; - }; - -require.register = function (path, fn){ - require.modules[path] = fn; - }; - -require.relative = function (parent) { - return function(p){ - if ('.' != p.charAt(0)) return require(p); - - var path = parent.split('/') - , segs = p.split('/'); - path.pop(); - - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; - if ('..' == seg) path.pop(); - else if ('.' != seg) path.push(seg); - } - - return require(path.join('/')); - }; - }; - - -require.register("compiler.js", function(module, exports, require){ - -/*! - * Jade - Compiler - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var nodes = require('./nodes') - , filters = require('./filters') - , doctypes = require('./doctypes') - , selfClosing = require('./self-closing') - , runtime = require('./runtime') - , utils = require('./utils'); - - - if (!Object.keys) { - Object.keys = function(obj){ - var arr = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - arr.push(key); - } - } - return arr; - } - } - - if (!String.prototype.trimLeft) { - String.prototype.trimLeft = function(){ - return this.replace(/^\s+/, ''); - } - } - - - -/** - * Initialize `Compiler` with the given `node`. - * - * @param {Node} node - * @param {Object} options - * @api public - */ - -var Compiler = module.exports = function Compiler(node, options) { - this.options = options = options || {}; - this.node = node; - this.hasCompiledDoctype = false; - this.hasCompiledTag = false; - this.pp = options.pretty || false; - this.debug = false !== options.compileDebug; - this.indents = 0; - this.parentIndents = 0; - if (options.doctype) this.setDoctype(options.doctype); -}; - -/** - * Compiler prototype. - */ - -Compiler.prototype = { - - /** - * Compile parse tree to JavaScript. - * - * @api public - */ - - compile: function(){ - this.buf = ['var interp;']; - if (this.pp) this.buf.push("var __indent = [];"); - this.lastBufferedIdx = -1; - this.visit(this.node); - return this.buf.join('\n'); - }, - - /** - * Sets the default doctype `name`. Sets terse mode to `true` when - * html 5 is used, causing self-closing tags to end with ">" vs "/>", - * and boolean attributes are not mirrored. - * - * @param {string} name - * @api public - */ - - setDoctype: function(name){ - name = (name && name.toLowerCase()) || 'default'; - this.doctype = doctypes[name] || ''; - this.terse = this.doctype.toLowerCase() == ''; - this.xml = 0 == this.doctype.indexOf(' 1 && !escape && block.nodes[0].isText && block.nodes[1].isText) - this.prettyIndent(1, true); - - for (var i = 0; i < len; ++i) { - // Pretty print text - if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText) - this.prettyIndent(1, false); - - this.visit(block.nodes[i]); - // Multiple text nodes are separated by newlines - if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText) - this.buffer('\\n'); - } - }, - - /** - * Visit `doctype`. Sets terse mode to `true` when html 5 - * is used, causing self-closing tags to end with ">" vs "/>", - * and boolean attributes are not mirrored. - * - * @param {Doctype} doctype - * @api public - */ - - visitDoctype: function(doctype){ - if (doctype && (doctype.val || !this.doctype)) { - this.setDoctype(doctype.val || 'default'); - } - - if (this.doctype) this.buffer(this.doctype); - this.hasCompiledDoctype = true; - }, - - /** - * Visit `mixin`, generating a function that - * may be called within the template. - * - * @param {Mixin} mixin - * @api public - */ - - visitMixin: function(mixin){ - var name = mixin.name.replace(/-/g, '_') + '_mixin' - , args = mixin.args || '' - , block = mixin.block - , attrs = mixin.attrs - , pp = this.pp; - - if (mixin.call) { - if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');") - if (block || attrs.length) { - - this.buf.push(name + '.call({'); - - if (block) { - this.buf.push('block: function(){'); - - // Render block with no indents, dynamically added when rendered - this.parentIndents++; - var _indents = this.indents; - this.indents = 0; - this.visit(mixin.block); - this.indents = _indents; - this.parentIndents--; - - if (attrs.length) { - this.buf.push('},'); - } else { - this.buf.push('}'); - } - } - - if (attrs.length) { - var val = this.attrs(attrs); - if (val.inherits) { - this.buf.push('attributes: merge({' + val.buf - + '}, attributes), escaped: merge(' + val.escaped + ', escaped, true)'); - } else { - this.buf.push('attributes: {' + val.buf + '}, escaped: ' + val.escaped); - } - } - - if (args) { - this.buf.push('}, ' + args + ');'); - } else { - this.buf.push('});'); - } - - } else { - this.buf.push(name + '(' + args + ');'); - } - if (pp) this.buf.push("__indent.pop();") - } else { - this.buf.push('var ' + name + ' = function(' + args + '){'); - this.buf.push('var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};'); - this.parentIndents++; - this.visit(block); - this.parentIndents--; - this.buf.push('};'); - } - }, - - /** - * Visit `tag` buffering tag markup, generating - * attributes, visiting the `tag`'s code and block. - * - * @param {Tag} tag - * @api public - */ - - visitTag: function(tag){ - this.indents++; - var name = tag.name - , pp = this.pp; - - if (tag.buffer) name = "' + (" + name + ") + '"; - - if (!this.hasCompiledTag) { - if (!this.hasCompiledDoctype && 'html' == name) { - this.visitDoctype(); - } - this.hasCompiledTag = true; - } - - // pretty print - if (pp && !tag.isInline()) - this.prettyIndent(0, true); - - if ((~selfClosing.indexOf(name) || tag.selfClosing) && !this.xml) { - this.buffer('<' + name); - this.visitAttributes(tag.attrs); - this.terse - ? this.buffer('>') - : this.buffer('/>'); - } else { - // Optimize attributes buffering - if (tag.attrs.length) { - this.buffer('<' + name); - if (tag.attrs.length) this.visitAttributes(tag.attrs); - this.buffer('>'); - } else { - this.buffer('<' + name + '>'); - } - if (tag.code) this.visitCode(tag.code); - this.escape = 'pre' == tag.name; - this.visit(tag.block); - - // pretty print - if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline()) - this.prettyIndent(0, true); - - this.buffer(''); - } - this.indents--; - }, - - /** - * Visit `filter`, throwing when the filter does not exist. - * - * @param {Filter} filter - * @api public - */ - - visitFilter: function(filter){ - var fn = filters[filter.name]; - - // unknown filter - if (!fn) { - if (filter.isASTFilter) { - throw new Error('unknown ast filter "' + filter.name + ':"'); - } else { - throw new Error('unknown filter ":' + filter.name + '"'); - } - } - - if (filter.isASTFilter) { - this.buf.push(fn(filter.block, this, filter.attrs)); - } else { - var text = filter.block.nodes.map(function(node){ return node.val }).join('\n'); - filter.attrs = filter.attrs || {}; - filter.attrs.filename = this.options.filename; - this.buffer(utils.text(fn(text, filter.attrs))); - } - }, - - /** - * Visit `text` node. - * - * @param {Text} text - * @api public - */ - - visitText: function(text){ - text = utils.text(text.val.replace(/\\/g, '_SLASH_')); - if (this.escape) text = escape(text); - text = text.replace(/_SLASH_/g, '\\\\'); - this.buffer(text); - }, - - /** - * Visit a `comment`, only buffering when the buffer flag is set. - * - * @param {Comment} comment - * @api public - */ - - visitComment: function(comment){ - if (!comment.buffer) return; - if (this.pp) this.prettyIndent(1, true); - this.buffer(''); - }, - - /** - * Visit a `BlockComment`. - * - * @param {Comment} comment - * @api public - */ - - visitBlockComment: function(comment){ - if (!comment.buffer) return; - if (0 == comment.val.trim().indexOf('if')) { - this.buffer(''); - } else { - this.buffer(''); - } - }, - - /** - * Visit `code`, respecting buffer / escape flags. - * If the code is followed by a block, wrap it in - * a self-calling function. - * - * @param {Code} code - * @api public - */ - - visitCode: function(code){ - // Wrap code blocks with {}. - // we only wrap unbuffered code blocks ATM - // since they are usually flow control - - // Buffer code - if (code.buffer) { - var val = code.val.trimLeft(); - this.buf.push('var __val__ = ' + val); - val = 'null == __val__ ? "" : __val__'; - if (code.escape) val = 'escape(' + val + ')'; - this.buf.push("buf.push(" + val + ");"); - } else { - this.buf.push(code.val); - } - - // Block support - if (code.block) { - if (!code.buffer) this.buf.push('{'); - this.visit(code.block); - if (!code.buffer) this.buf.push('}'); - } - }, - - /** - * Visit `each` block. - * - * @param {Each} each - * @api public - */ - - visitEach: function(each){ - this.buf.push('' - + '// iterate ' + each.obj + '\n' - + ';(function(){\n' - + ' if (\'number\' == typeof ' + each.obj + '.length) {\n'); - - if (each.alternative) { - this.buf.push(' if (' + each.obj + '.length) {'); - } - - this.buf.push('' - + ' for (var ' + each.key + ' = 0, $$l = ' + each.obj + '.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n' - + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); - - this.visit(each.block); - - this.buf.push(' }\n'); - - if (each.alternative) { - this.buf.push(' } else {'); - this.visit(each.alternative); - this.buf.push(' }'); - } - - this.buf.push('' - + ' } else {\n' - + ' var $$l = 0;\n' - + ' for (var ' + each.key + ' in ' + each.obj + ') {\n' - + ' $$l++;' - + ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){' - + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); - - this.visit(each.block); - - this.buf.push(' }\n'); - - this.buf.push(' }\n'); - if (each.alternative) { - this.buf.push(' if ($$l === 0) {'); - this.visit(each.alternative); - this.buf.push(' }'); - } - this.buf.push(' }\n}).call(this);\n'); - }, - - /** - * Visit `attrs`. - * - * @param {Array} attrs - * @api public - */ - - visitAttributes: function(attrs){ - var val = this.attrs(attrs); - if (val.inherits) { - this.buf.push("buf.push(attrs(merge({ " + val.buf + - " }, attributes), merge(" + val.escaped + ", escaped, true)));"); - } else if (val.constant) { - eval('var buf={' + val.buf + '};'); - this.buffer(runtime.attrs(buf, JSON.parse(val.escaped)), true); - } else { - this.buf.push("buf.push(attrs({ " + val.buf + " }, " + val.escaped + "));"); - } - }, - - /** - * Compile attributes. - */ - - attrs: function(attrs){ - var buf = [] - , classes = [] - , escaped = {} - , constant = attrs.every(function(attr){ return isConstant(attr.val) }) - , inherits = false; - - if (this.terse) buf.push('terse: true'); - - attrs.forEach(function(attr){ - if (attr.name == 'attributes') return inherits = true; - escaped[attr.name] = attr.escaped; - if (attr.name == 'class') { - classes.push('(' + attr.val + ')'); - } else { - var pair = "'" + attr.name + "':(" + attr.val + ')'; - buf.push(pair); - } - }); - - if (classes.length) { - classes = classes.join(" + ' ' + "); - buf.push("class: " + classes); - } - - return { - buf: buf.join(', ').replace('class:', '"class":'), - escaped: JSON.stringify(escaped), - inherits: inherits, - constant: constant - }; - } -}; - -/** - * Check if expression can be evaluated to a constant - * - * @param {String} expression - * @return {Boolean} - * @api private - */ - -function isConstant(val){ - // Check strings/literals - if (/^ *("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|true|false|null|undefined) *$/i.test(val)) - return true; - - // Check numbers - if (!isNaN(Number(val))) - return true; - - // Check arrays - var matches; - if (matches = /^ *\[(.*)\] *$/.exec(val)) - return matches[1].split(',').every(isConstant); - - return false; -} - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -function escape(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -} - -}); // module: compiler.js - -require.register("doctypes.js", function(module, exports, require){ - -/*! - * Jade - doctypes - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = { - '5': '' - , 'default': '' - , 'xml': '' - , 'transitional': '' - , 'strict': '' - , 'frameset': '' - , '1.1': '' - , 'basic': '' - , 'mobile': '' -}; -}); // module: doctypes.js - -require.register("filters.js", function(module, exports, require){ - -/*! - * Jade - filters - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = { - - /** - * Wrap text with CDATA block. - */ - - cdata: function(str){ - return ''; - }, - - /** - * Transform sass to css, wrapped in style tags. - */ - - sass: function(str){ - str = str.replace(/\\n/g, '\n'); - var sass = require('sass').render(str).replace(/\n/g, '\\n'); - return ''; - }, - - /** - * Transform stylus to css, wrapped in style tags. - */ - - stylus: function(str, options){ - var ret; - str = str.replace(/\\n/g, '\n'); - var stylus = require('stylus'); - stylus(str, options).render(function(err, css){ - if (err) throw err; - ret = css.replace(/\n/g, '\\n'); - }); - return ''; - }, - - /** - * Transform less to css, wrapped in style tags. - */ - - less: function(str){ - var ret; - str = str.replace(/\\n/g, '\n'); - require('less').render(str, function(err, css){ - if (err) throw err; - ret = ''; - }); - return ret; - }, - - /** - * Transform markdown to html. - */ - - markdown: function(str){ - var md; - - // support markdown / discount - try { - md = require('markdown'); - } catch (err){ - try { - md = require('discount'); - } catch (err) { - try { - md = require('markdown-js'); - } catch (err) { - try { - md = require('marked'); - } catch (err) { - throw new - Error('Cannot find markdown library, install markdown, discount, or marked.'); - } - } - } - } - - str = str.replace(/\\n/g, '\n'); - return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,'''); - }, - - /** - * Transform coffeescript to javascript. - */ - - coffeescript: function(str){ - var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); - return ''; - } -}; - -}); // module: filters.js - -require.register("inline-tags.js", function(module, exports, require){ - -/*! - * Jade - inline tags - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = [ - 'a' - , 'abbr' - , 'acronym' - , 'b' - , 'br' - , 'code' - , 'em' - , 'font' - , 'i' - , 'img' - , 'ins' - , 'kbd' - , 'map' - , 'samp' - , 'small' - , 'span' - , 'strong' - , 'sub' - , 'sup' -]; -}); // module: inline-tags.js - -require.register("jade.js", function(module, exports, require){ -/*! - * Jade - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Parser = require('./parser') - , Lexer = require('./lexer') - , Compiler = require('./compiler') - , runtime = require('./runtime') - -/** - * Library version. - */ - -exports.version = '0.27.6'; - -/** - * Expose self closing tags. - */ - -exports.selfClosing = require('./self-closing'); - -/** - * Default supported doctypes. - */ - -exports.doctypes = require('./doctypes'); - -/** - * Text filters. - */ - -exports.filters = require('./filters'); - -/** - * Utilities. - */ - -exports.utils = require('./utils'); - -/** - * Expose `Compiler`. - */ - -exports.Compiler = Compiler; - -/** - * Expose `Parser`. - */ - -exports.Parser = Parser; - -/** - * Expose `Lexer`. - */ - -exports.Lexer = Lexer; - -/** - * Nodes. - */ - -exports.nodes = require('./nodes'); - -/** - * Jade runtime helpers. - */ - -exports.runtime = runtime; - -/** - * Template function cache. - */ - -exports.cache = {}; - -/** - * Parse the given `str` of jade and return a function body. - * - * @param {String} str - * @param {Object} options - * @return {String} - * @api private - */ - -function parse(str, options){ - try { - // Parse - var parser = new Parser(str, options.filename, options); - - // Compile - var compiler = new (options.compiler || Compiler)(parser.parse(), options) - , js = compiler.compile(); - - // Debug compiler - if (options.debug) { - console.error('\nCompiled Function:\n\n\033[90m%s\033[0m', js.replace(/^/gm, ' ')); - } - - return '' - + 'var buf = [];\n' - + (options.self - ? 'var self = locals || {};\n' + js - : 'with (locals || {}) {\n' + js + '\n}\n') - + 'return buf.join("");'; - } catch (err) { - parser = parser.context(); - runtime.rethrow(err, parser.filename, parser.lexer.lineno); - } -} - -/** - * Strip any UTF-8 BOM off of the start of `str`, if it exists. - * - * @param {String} str - * @return {String} - * @api private - */ - -function stripBOM(str){ - return 0xFEFF == str.charCodeAt(0) - ? str.substring(1) - : str; -} - -/** - * Compile a `Function` representation of the given jade `str`. - * - * Options: - * - * - `compileDebug` when `false` debugging code is stripped from the compiled template - * - `client` when `true` the helper functions `escape()` etc will reference `jade.escape()` - * for use with the Jade client-side runtime.js - * - * @param {String} str - * @param {Options} options - * @return {Function} - * @api public - */ - -exports.compile = function(str, options){ - var options = options || {} - , client = options.client - , filename = options.filename - ? JSON.stringify(options.filename) - : 'undefined' - , fn; - - str = stripBOM(String(str)); - - if (options.compileDebug !== false) { - fn = [ - 'var __jade = [{ lineno: 1, filename: ' + filename + ' }];' - , 'try {' - , parse(str, options) - , '} catch (err) {' - , ' rethrow(err, __jade[0].filename, __jade[0].lineno);' - , '}' - ].join('\n'); - } else { - fn = parse(str, options); - } - - if (client) { - fn = 'attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n' + fn; - } - - fn = new Function('locals, attrs, escape, rethrow, merge', fn); - - if (client) return fn; - - return function(locals){ - return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow, runtime.merge); - }; -}; - -/** - * Render the given `str` of jade and invoke - * the callback `fn(err, str)`. - * - * Options: - * - * - `cache` enable template caching - * - `filename` filename required for `include` / `extends` and caching - * - * @param {String} str - * @param {Object|Function} options or fn - * @param {Function} fn - * @api public - */ - -exports.render = function(str, options, fn){ - // swap args - if ('function' == typeof options) { - fn = options, options = {}; - } - - // cache requires .filename - if (options.cache && !options.filename) { - return fn(new Error('the "filename" option is required for caching')); - } - - try { - var path = options.filename; - var tmpl = options.cache - ? exports.cache[path] || (exports.cache[path] = exports.compile(str, options)) - : exports.compile(str, options); - fn(null, tmpl(options)); - } catch (err) { - fn(err); - } -}; - -/** - * Render a Jade file at the given `path` and callback `fn(err, str)`. - * - * @param {String} path - * @param {Object|Function} options or callback - * @param {Function} fn - * @api public - */ - -exports.renderFile = function(path, options, fn){ - var key = path + ':string'; - - if ('function' == typeof options) { - fn = options, options = {}; - } - - try { - options.filename = path; - var str = options.cache - ? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8')) - : fs.readFileSync(path, 'utf8'); - exports.render(str, options, fn); - } catch (err) { - fn(err); - } -}; - -/** - * Express support. - */ - -exports.__express = exports.renderFile; - -}); // module: jade.js - -require.register("lexer.js", function(module, exports, require){ -/*! - * Jade - Lexer - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -var utils = require('./utils'); - -/** - * Initialize `Lexer` with the given `str`. - * - * Options: - * - * - `colons` allow colons for attr delimiters - * - * @param {String} str - * @param {Object} options - * @api private - */ - -var Lexer = module.exports = function Lexer(str, options) { - options = options || {}; - this.input = str.replace(/\r\n|\r/g, '\n'); - this.colons = options.colons; - this.deferredTokens = []; - this.lastIndents = 0; - this.lineno = 1; - this.stash = []; - this.indentStack = []; - this.indentRe = null; - this.pipeless = false; -}; - -/** - * Lexer prototype. - */ - -Lexer.prototype = { - - /** - * Construct a token with the given `type` and `val`. - * - * @param {String} type - * @param {String} val - * @return {Object} - * @api private - */ - - tok: function(type, val){ - return { - type: type - , line: this.lineno - , val: val - } - }, - - /** - * Consume the given `len` of input. - * - * @param {Number} len - * @api private - */ - - consume: function(len){ - this.input = this.input.substr(len); - }, - - /** - * Scan for `type` with the given `regexp`. - * - * @param {String} type - * @param {RegExp} regexp - * @return {Object} - * @api private - */ - - scan: function(regexp, type){ - var captures; - if (captures = regexp.exec(this.input)) { - this.consume(captures[0].length); - return this.tok(type, captures[1]); - } - }, - - /** - * Defer the given `tok`. - * - * @param {Object} tok - * @api private - */ - - defer: function(tok){ - this.deferredTokens.push(tok); - }, - - /** - * Lookahead `n` tokens. - * - * @param {Number} n - * @return {Object} - * @api private - */ - - lookahead: function(n){ - var fetch = n - this.stash.length; - while (fetch-- > 0) this.stash.push(this.next()); - return this.stash[--n]; - }, - - /** - * Return the indexOf `start` / `end` delimiters. - * - * @param {String} start - * @param {String} end - * @return {Number} - * @api private - */ - - indexOfDelimiters: function(start, end){ - var str = this.input - , nstart = 0 - , nend = 0 - , pos = 0; - for (var i = 0, len = str.length; i < len; ++i) { - if (start == str.charAt(i)) { - ++nstart; - } else if (end == str.charAt(i)) { - if (++nend == nstart) { - pos = i; - break; - } - } - } - return pos; - }, - - /** - * Stashed token. - */ - - stashed: function() { - return this.stash.length - && this.stash.shift(); - }, - - /** - * Deferred token. - */ - - deferred: function() { - return this.deferredTokens.length - && this.deferredTokens.shift(); - }, - - /** - * end-of-source. - */ - - eos: function() { - if (this.input.length) return; - if (this.indentStack.length) { - this.indentStack.shift(); - return this.tok('outdent'); - } else { - return this.tok('eos'); - } - }, - - /** - * Blank line. - */ - - blank: function() { - var captures; - if (captures = /^\n *\n/.exec(this.input)) { - this.consume(captures[0].length - 1); - - ++this.lineno; - if (this.pipeless) return this.tok('text', ''); - return this.next(); - } - }, - - /** - * Comment. - */ - - comment: function() { - var captures; - if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('comment', captures[2]); - tok.buffer = '-' != captures[1]; - return tok; - } - }, - - /** - * Interpolated tag. - */ - - interpolation: function() { - var captures; - if (captures = /^#\{(.*?)\}/.exec(this.input)) { - this.consume(captures[0].length); - return this.tok('interpolation', captures[1]); - } - }, - - /** - * Tag. - */ - - tag: function() { - var captures; - if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) { - this.consume(captures[0].length); - var tok, name = captures[1]; - if (':' == name[name.length - 1]) { - name = name.slice(0, -1); - tok = this.tok('tag', name); - this.defer(this.tok(':')); - while (' ' == this.input[0]) this.input = this.input.substr(1); - } else { - tok = this.tok('tag', name); - } - tok.selfClosing = !! captures[2]; - return tok; - } - }, - - /** - * Filter. - */ - - filter: function() { - return this.scan(/^:(\w+)/, 'filter'); - }, - - /** - * Doctype. - */ - - doctype: function() { - return this.scan(/^(?:!!!|doctype) *([^\n]+)?/, 'doctype'); - }, - - /** - * Id. - */ - - id: function() { - return this.scan(/^#([\w-]+)/, 'id'); - }, - - /** - * Class. - */ - - className: function() { - return this.scan(/^\.([\w-]+)/, 'class'); - }, - - /** - * Text. - */ - - text: function() { - return this.scan(/^(?:\| ?| ?)?([^\n]+)/, 'text'); - }, - - /** - * Extends. - */ - - "extends": function() { - return this.scan(/^extends? +([^\n]+)/, 'extends'); - }, - - /** - * Block prepend. - */ - - prepend: function() { - var captures; - if (captures = /^prepend +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = 'prepend' - , name = captures[1] - , tok = this.tok('block', name); - tok.mode = mode; - return tok; - } - }, - - /** - * Block append. - */ - - append: function() { - var captures; - if (captures = /^append +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = 'append' - , name = captures[1] - , tok = this.tok('block', name); - tok.mode = mode; - return tok; - } - }, - - /** - * Block. - */ - - block: function() { - var captures; - if (captures = /^block\b *(?:(prepend|append) +)?([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = captures[1] || 'replace' - , name = captures[2] - , tok = this.tok('block', name); - - tok.mode = mode; - return tok; - } - }, - - /** - * Yield. - */ - - yield: function() { - return this.scan(/^yield */, 'yield'); - }, - - /** - * Include. - */ - - include: function() { - return this.scan(/^include +([^\n]+)/, 'include'); - }, - - /** - * Case. - */ - - "case": function() { - return this.scan(/^case +([^\n]+)/, 'case'); - }, - - /** - * When. - */ - - when: function() { - return this.scan(/^when +([^:\n]+)/, 'when'); - }, - - /** - * Default. - */ - - "default": function() { - return this.scan(/^default */, 'default'); - }, - - /** - * Assignment. - */ - - assignment: function() { - var captures; - if (captures = /^(\w+) += *([^;\n]+)( *;? *)/.exec(this.input)) { - this.consume(captures[0].length); - var name = captures[1] - , val = captures[2]; - return this.tok('code', 'var ' + name + ' = (' + val + ');'); - } - }, - - /** - * Call mixin. - */ - - call: function(){ - var captures; - if (captures = /^\+([-\w]+)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('call', captures[1]); - - // Check for args (not attributes) - if (captures = /^ *\((.*?)\)/.exec(this.input)) { - if (!/^ *[-\w]+ *=/.test(captures[1])) { - this.consume(captures[0].length); - tok.args = captures[1]; - } - } - - return tok; - } - }, - - /** - * Mixin. - */ - - mixin: function(){ - var captures; - if (captures = /^mixin +([-\w]+)(?: *\((.*)\))?/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('mixin', captures[1]); - tok.args = captures[2]; - return tok; - } - }, - - /** - * Conditional. - */ - - conditional: function() { - var captures; - if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var type = captures[1] - , js = captures[2]; - - switch (type) { - case 'if': js = 'if (' + js + ')'; break; - case 'unless': js = 'if (!(' + js + '))'; break; - case 'else if': js = 'else if (' + js + ')'; break; - case 'else': js = 'else'; break; - } - - return this.tok('code', js); - } - }, - - /** - * While. - */ - - "while": function() { - var captures; - if (captures = /^while +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - return this.tok('code', 'while (' + captures[1] + ')'); - } - }, - - /** - * Each. - */ - - each: function() { - var captures; - if (captures = /^(?:- *)?(?:each|for) +(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('each', captures[1]); - tok.key = captures[2] || '$index'; - tok.code = captures[3]; - return tok; - } - }, - - /** - * Code. - */ - - code: function() { - var captures; - if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var flags = captures[1]; - captures[1] = captures[2]; - var tok = this.tok('code', captures[1]); - tok.escape = flags.charAt(0) === '='; - tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '='; - return tok; - } - }, - - /** - * Attributes. - */ - - attrs: function() { - if ('(' == this.input.charAt(0)) { - var index = this.indexOfDelimiters('(', ')') - , str = this.input.substr(1, index-1) - , tok = this.tok('attrs') - , len = str.length - , colons = this.colons - , states = ['key'] - , escapedAttr - , key = '' - , val = '' - , quote - , c - , p; - - function state(){ - return states[states.length - 1]; - } - - function interpolate(attr) { - return attr.replace(/(\\)?#\{([^}]+)\}/g, function(_, escape, expr){ - return escape - ? _ - : quote + " + (" + expr + ") + " + quote; - }); - } - - this.consume(index + 1); - tok.attrs = {}; - tok.escaped = {}; - - function parse(c) { - var real = c; - // TODO: remove when people fix ":" - if (colons && ':' == c) c = '='; - switch (c) { - case ',': - case '\n': - switch (state()) { - case 'expr': - case 'array': - case 'string': - case 'object': - val += c; - break; - default: - states.push('key'); - val = val.trim(); - key = key.trim(); - if ('' == key) return; - key = key.replace(/^['"]|['"]$/g, '').replace('!', ''); - tok.escaped[key] = escapedAttr; - tok.attrs[key] = '' == val - ? true - : interpolate(val); - key = val = ''; - } - break; - case '=': - switch (state()) { - case 'key char': - key += real; - break; - case 'val': - case 'expr': - case 'array': - case 'string': - case 'object': - val += real; - break; - default: - escapedAttr = '!' != p; - states.push('val'); - } - break; - case '(': - if ('val' == state() - || 'expr' == state()) states.push('expr'); - val += c; - break; - case ')': - if ('expr' == state() - || 'val' == state()) states.pop(); - val += c; - break; - case '{': - if ('val' == state()) states.push('object'); - val += c; - break; - case '}': - if ('object' == state()) states.pop(); - val += c; - break; - case '[': - if ('val' == state()) states.push('array'); - val += c; - break; - case ']': - if ('array' == state()) states.pop(); - val += c; - break; - case '"': - case "'": - switch (state()) { - case 'key': - states.push('key char'); - break; - case 'key char': - states.pop(); - break; - case 'string': - if (c == quote) states.pop(); - val += c; - break; - default: - states.push('string'); - val += c; - quote = c; - } - break; - case '': - break; - default: - switch (state()) { - case 'key': - case 'key char': - key += c; - break; - default: - val += c; - } - } - p = c; - } - - for (var i = 0; i < len; ++i) { - parse(str.charAt(i)); - } - - parse(','); - - if ('/' == this.input.charAt(0)) { - this.consume(1); - tok.selfClosing = true; - } - - return tok; - } - }, - - /** - * Indent | Outdent | Newline. - */ - - indent: function() { - var captures, re; - - // established regexp - if (this.indentRe) { - captures = this.indentRe.exec(this.input); - // determine regexp - } else { - // tabs - re = /^\n(\t*) */; - captures = re.exec(this.input); - - // spaces - if (captures && !captures[1].length) { - re = /^\n( *)/; - captures = re.exec(this.input); - } - - // established - if (captures && captures[1].length) this.indentRe = re; - } - - if (captures) { - var tok - , indents = captures[1].length; - - ++this.lineno; - this.consume(indents + 1); - - if (' ' == this.input[0] || '\t' == this.input[0]) { - throw new Error('Invalid indentation, you can use tabs or spaces but not both'); - } - - // blank line - if ('\n' == this.input[0]) return this.tok('newline'); - - // outdent - if (this.indentStack.length && indents < this.indentStack[0]) { - while (this.indentStack.length && this.indentStack[0] > indents) { - this.stash.push(this.tok('outdent')); - this.indentStack.shift(); - } - tok = this.stash.pop(); - // indent - } else if (indents && indents != this.indentStack[0]) { - this.indentStack.unshift(indents); - tok = this.tok('indent', indents); - // newline - } else { - tok = this.tok('newline'); - } - - return tok; - } - }, - - /** - * Pipe-less text consumed only when - * pipeless is true; - */ - - pipelessText: function() { - if (this.pipeless) { - if ('\n' == this.input[0]) return; - var i = this.input.indexOf('\n'); - if (-1 == i) i = this.input.length; - var str = this.input.substr(0, i); - this.consume(str.length); - return this.tok('text', str); - } - }, - - /** - * ':' - */ - - colon: function() { - return this.scan(/^: */, ':'); - }, - - /** - * Return the next token object, or those - * previously stashed by lookahead. - * - * @return {Object} - * @api private - */ - - advance: function(){ - return this.stashed() - || this.next(); - }, - - /** - * Return the next token object. - * - * @return {Object} - * @api private - */ - - next: function() { - return this.deferred() - || this.blank() - || this.eos() - || this.pipelessText() - || this.yield() - || this.doctype() - || this.interpolation() - || this["case"]() - || this.when() - || this["default"]() - || this["extends"]() - || this.append() - || this.prepend() - || this.block() - || this.include() - || this.mixin() - || this.call() - || this.conditional() - || this.each() - || this["while"]() - || this.assignment() - || this.tag() - || this.filter() - || this.code() - || this.id() - || this.className() - || this.attrs() - || this.indent() - || this.comment() - || this.colon() - || this.text(); - } -}; - -}); // module: lexer.js - -require.register("nodes/attrs.js", function(module, exports, require){ - -/*! - * Jade - nodes - Attrs - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'), - Block = require('./block'); - -/** - * Initialize a `Attrs` node. - * - * @api public - */ - -var Attrs = module.exports = function Attrs() { - this.attrs = []; -}; - -/** - * Inherit from `Node`. - */ - -Attrs.prototype = new Node; -Attrs.prototype.constructor = Attrs; - - -/** - * Set attribute `name` to `val`, keep in mind these become - * part of a raw js object literal, so to quote a value you must - * '"quote me"', otherwise or example 'user.name' is literal JavaScript. - * - * @param {String} name - * @param {String} val - * @param {Boolean} escaped - * @return {Tag} for chaining - * @api public - */ - -Attrs.prototype.setAttribute = function(name, val, escaped){ - this.attrs.push({ name: name, val: val, escaped: escaped }); - return this; -}; - -/** - * Remove attribute `name` when present. - * - * @param {String} name - * @api public - */ - -Attrs.prototype.removeAttribute = function(name){ - for (var i = 0, len = this.attrs.length; i < len; ++i) { - if (this.attrs[i] && this.attrs[i].name == name) { - delete this.attrs[i]; - } - } -}; - -/** - * Get attribute value by `name`. - * - * @param {String} name - * @return {String} - * @api public - */ - -Attrs.prototype.getAttribute = function(name){ - for (var i = 0, len = this.attrs.length; i < len; ++i) { - if (this.attrs[i] && this.attrs[i].name == name) { - return this.attrs[i].val; - } - } -}; - -}); // module: nodes/attrs.js - -require.register("nodes/block-comment.js", function(module, exports, require){ - -/*! - * Jade - nodes - BlockComment - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `BlockComment` with the given `block`. - * - * @param {String} val - * @param {Block} block - * @param {Boolean} buffer - * @api public - */ - -var BlockComment = module.exports = function BlockComment(val, block, buffer) { - this.block = block; - this.val = val; - this.buffer = buffer; -}; - -/** - * Inherit from `Node`. - */ - -BlockComment.prototype = new Node; -BlockComment.prototype.constructor = BlockComment; - -}); // module: nodes/block-comment.js - -require.register("nodes/block.js", function(module, exports, require){ - -/*! - * Jade - nodes - Block - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Block` with an optional `node`. - * - * @param {Node} node - * @api public - */ - -var Block = module.exports = function Block(node){ - this.nodes = []; - if (node) this.push(node); -}; - -/** - * Inherit from `Node`. - */ - -Block.prototype = new Node; -Block.prototype.constructor = Block; - - -/** - * Block flag. - */ - -Block.prototype.isBlock = true; - -/** - * Replace the nodes in `other` with the nodes - * in `this` block. - * - * @param {Block} other - * @api private - */ - -Block.prototype.replace = function(other){ - other.nodes = this.nodes; -}; - -/** - * Pust the given `node`. - * - * @param {Node} node - * @return {Number} - * @api public - */ - -Block.prototype.push = function(node){ - return this.nodes.push(node); -}; - -/** - * Check if this block is empty. - * - * @return {Boolean} - * @api public - */ - -Block.prototype.isEmpty = function(){ - return 0 == this.nodes.length; -}; - -/** - * Unshift the given `node`. - * - * @param {Node} node - * @return {Number} - * @api public - */ - -Block.prototype.unshift = function(node){ - return this.nodes.unshift(node); -}; - -/** - * Return the "last" block, or the first `yield` node. - * - * @return {Block} - * @api private - */ - -Block.prototype.includeBlock = function(){ - var ret = this - , node; - - for (var i = 0, len = this.nodes.length; i < len; ++i) { - node = this.nodes[i]; - if (node.yield) return node; - else if (node.textOnly) continue; - else if (node.includeBlock) ret = node.includeBlock(); - else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock(); - if (ret.yield) return ret; - } - - return ret; -}; - -/** - * Return a clone of this block. - * - * @return {Block} - * @api private - */ - -Block.prototype.clone = function(){ - var clone = new Block; - for (var i = 0, len = this.nodes.length; i < len; ++i) { - clone.push(this.nodes[i].clone()); - } - return clone; -}; - - -}); // module: nodes/block.js - -require.register("nodes/case.js", function(module, exports, require){ - -/*! - * Jade - nodes - Case - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Case` with `expr`. - * - * @param {String} expr - * @api public - */ - -var Case = exports = module.exports = function Case(expr, block){ - this.expr = expr; - this.block = block; -}; - -/** - * Inherit from `Node`. - */ - -Case.prototype = new Node; -Case.prototype.constructor = Case; - - -var When = exports.When = function When(expr, block){ - this.expr = expr; - this.block = block; - this.debug = false; -}; - -/** - * Inherit from `Node`. - */ - -When.prototype = new Node; -When.prototype.constructor = When; - - - -}); // module: nodes/case.js - -require.register("nodes/code.js", function(module, exports, require){ - -/*! - * Jade - nodes - Code - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Code` node with the given code `val`. - * Code may also be optionally buffered and escaped. - * - * @param {String} val - * @param {Boolean} buffer - * @param {Boolean} escape - * @api public - */ - -var Code = module.exports = function Code(val, buffer, escape) { - this.val = val; - this.buffer = buffer; - this.escape = escape; - if (val.match(/^ *else/)) this.debug = false; -}; - -/** - * Inherit from `Node`. - */ - -Code.prototype = new Node; -Code.prototype.constructor = Code; - -}); // module: nodes/code.js - -require.register("nodes/comment.js", function(module, exports, require){ - -/*! - * Jade - nodes - Comment - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Comment` with the given `val`, optionally `buffer`, - * otherwise the comment may render in the output. - * - * @param {String} val - * @param {Boolean} buffer - * @api public - */ - -var Comment = module.exports = function Comment(val, buffer) { - this.val = val; - this.buffer = buffer; -}; - -/** - * Inherit from `Node`. - */ - -Comment.prototype = new Node; -Comment.prototype.constructor = Comment; - -}); // module: nodes/comment.js - -require.register("nodes/doctype.js", function(module, exports, require){ - -/*! - * Jade - nodes - Doctype - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Doctype` with the given `val`. - * - * @param {String} val - * @api public - */ - -var Doctype = module.exports = function Doctype(val) { - this.val = val; -}; - -/** - * Inherit from `Node`. - */ - -Doctype.prototype = new Node; -Doctype.prototype.constructor = Doctype; - -}); // module: nodes/doctype.js - -require.register("nodes/each.js", function(module, exports, require){ - -/*! - * Jade - nodes - Each - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize an `Each` node, representing iteration - * - * @param {String} obj - * @param {String} val - * @param {String} key - * @param {Block} block - * @api public - */ - -var Each = module.exports = function Each(obj, val, key, block) { - this.obj = obj; - this.val = val; - this.key = key; - this.block = block; -}; - -/** - * Inherit from `Node`. - */ - -Each.prototype = new Node; -Each.prototype.constructor = Each; - -}); // module: nodes/each.js - -require.register("nodes/filter.js", function(module, exports, require){ - -/*! - * Jade - nodes - Filter - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , Block = require('./block'); - -/** - * Initialize a `Filter` node with the given - * filter `name` and `block`. - * - * @param {String} name - * @param {Block|Node} block - * @api public - */ - -var Filter = module.exports = function Filter(name, block, attrs) { - this.name = name; - this.block = block; - this.attrs = attrs; - this.isASTFilter = !block.nodes.every(function(node){ return node.isText }); -}; - -/** - * Inherit from `Node`. - */ - -Filter.prototype = new Node; -Filter.prototype.constructor = Filter; - -}); // module: nodes/filter.js - -require.register("nodes/index.js", function(module, exports, require){ - -/*! - * Jade - nodes - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -exports.Node = require('./node'); -exports.Tag = require('./tag'); -exports.Code = require('./code'); -exports.Each = require('./each'); -exports.Case = require('./case'); -exports.Text = require('./text'); -exports.Block = require('./block'); -exports.Mixin = require('./mixin'); -exports.Filter = require('./filter'); -exports.Comment = require('./comment'); -exports.Literal = require('./literal'); -exports.BlockComment = require('./block-comment'); -exports.Doctype = require('./doctype'); - -}); // module: nodes/index.js - -require.register("nodes/literal.js", function(module, exports, require){ - -/*! - * Jade - nodes - Literal - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Literal` node with the given `str. - * - * @param {String} str - * @api public - */ - -var Literal = module.exports = function Literal(str) { - this.str = str - .replace(/\\/g, "\\\\") - .replace(/\n|\r\n/g, "\\n") - .replace(/'/g, "\\'"); -}; - -/** - * Inherit from `Node`. - */ - -Literal.prototype = new Node; -Literal.prototype.constructor = Literal; - - -}); // module: nodes/literal.js - -require.register("nodes/mixin.js", function(module, exports, require){ - -/*! - * Jade - nodes - Mixin - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Attrs = require('./attrs'); - -/** - * Initialize a new `Mixin` with `name` and `block`. - * - * @param {String} name - * @param {String} args - * @param {Block} block - * @api public - */ - -var Mixin = module.exports = function Mixin(name, args, block, call){ - this.name = name; - this.args = args; - this.block = block; - this.attrs = []; - this.call = call; -}; - -/** - * Inherit from `Attrs`. - */ - -Mixin.prototype = new Attrs; -Mixin.prototype.constructor = Mixin; - - - -}); // module: nodes/mixin.js - -require.register("nodes/node.js", function(module, exports, require){ - -/*! - * Jade - nodes - Node - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Initialize a `Node`. - * - * @api public - */ - -var Node = module.exports = function Node(){}; - -/** - * Clone this node (return itself) - * - * @return {Node} - * @api private - */ - -Node.prototype.clone = function(){ - return this; -}; - -}); // module: nodes/node.js - -require.register("nodes/tag.js", function(module, exports, require){ - -/*! - * Jade - nodes - Tag - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Attrs = require('./attrs'), - Block = require('./block'), - inlineTags = require('../inline-tags'); - -/** - * Initialize a `Tag` node with the given tag `name` and optional `block`. - * - * @param {String} name - * @param {Block} block - * @api public - */ - -var Tag = module.exports = function Tag(name, block) { - this.name = name; - this.attrs = []; - this.block = block || new Block; -}; - -/** - * Inherit from `Attrs`. - */ - -Tag.prototype = new Attrs; -Tag.prototype.constructor = Tag; - - -/** - * Clone this tag. - * - * @return {Tag} - * @api private - */ - -Tag.prototype.clone = function(){ - var clone = new Tag(this.name, this.block.clone()); - clone.line = this.line; - clone.attrs = this.attrs; - clone.textOnly = this.textOnly; - return clone; -}; - -/** - * Check if this tag is an inline tag. - * - * @return {Boolean} - * @api private - */ - -Tag.prototype.isInline = function(){ - return ~inlineTags.indexOf(this.name); -}; - -/** - * Check if this tag's contents can be inlined. Used for pretty printing. - * - * @return {Boolean} - * @api private - */ - -Tag.prototype.canInline = function(){ - var nodes = this.block.nodes; - - function isInline(node){ - // Recurse if the node is a block - if (node.isBlock) return node.nodes.every(isInline); - return node.isText || (node.isInline && node.isInline()); - } - - // Empty tag - if (!nodes.length) return true; - - // Text-only or inline-only tag - if (1 == nodes.length) return isInline(nodes[0]); - - // Multi-line inline-only tag - if (this.block.nodes.every(isInline)) { - for (var i = 1, len = nodes.length; i < len; ++i) { - if (nodes[i-1].isText && nodes[i].isText) - return false; - } - return true; - } - - // Mixed tag - return false; -}; -}); // module: nodes/tag.js - -require.register("nodes/text.js", function(module, exports, require){ - -/*! - * Jade - nodes - Text - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Text` node with optional `line`. - * - * @param {String} line - * @api public - */ - -var Text = module.exports = function Text(line) { - this.val = ''; - if ('string' == typeof line) this.val = line; -}; - -/** - * Inherit from `Node`. - */ - -Text.prototype = new Node; -Text.prototype.constructor = Text; - - -/** - * Flag as text. - */ - -Text.prototype.isText = true; -}); // module: nodes/text.js - -require.register("parser.js", function(module, exports, require){ - -/*! - * Jade - Parser - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Lexer = require('./lexer') - , nodes = require('./nodes') - , utils = require('./utils'); - -/** - * Initialize `Parser` with the given input `str` and `filename`. - * - * @param {String} str - * @param {String} filename - * @param {Object} options - * @api public - */ - -var Parser = exports = module.exports = function Parser(str, filename, options){ - this.input = str; - this.lexer = new Lexer(str, options); - this.filename = filename; - this.blocks = {}; - this.mixins = {}; - this.options = options; - this.contexts = [this]; -}; - -/** - * Tags that may not contain tags. - */ - -var textOnly = exports.textOnly = ['script', 'style']; - -/** - * Parser prototype. - */ - -Parser.prototype = { - - /** - * Push `parser` onto the context stack, - * or pop and return a `Parser`. - */ - - context: function(parser){ - if (parser) { - this.contexts.push(parser); - } else { - return this.contexts.pop(); - } - }, - - /** - * Return the next token object. - * - * @return {Object} - * @api private - */ - - advance: function(){ - return this.lexer.advance(); - }, - - /** - * Skip `n` tokens. - * - * @param {Number} n - * @api private - */ - - skip: function(n){ - while (n--) this.advance(); - }, - - /** - * Single token lookahead. - * - * @return {Object} - * @api private - */ - - peek: function() { - return this.lookahead(1); - }, - - /** - * Return lexer lineno. - * - * @return {Number} - * @api private - */ - - line: function() { - return this.lexer.lineno; - }, - - /** - * `n` token lookahead. - * - * @param {Number} n - * @return {Object} - * @api private - */ - - lookahead: function(n){ - return this.lexer.lookahead(n); - }, - - /** - * Parse input returning a string of js for evaluation. - * - * @return {String} - * @api public - */ - - parse: function(){ - var block = new nodes.Block, parser; - block.line = this.line(); - - while ('eos' != this.peek().type) { - if ('newline' == this.peek().type) { - this.advance(); - } else { - block.push(this.parseExpr()); - } - } - - if (parser = this.extending) { - this.context(parser); - var ast = parser.parse(); - this.context(); - // hoist mixins - for (var name in this.mixins) - ast.unshift(this.mixins[name]); - return ast; - } - - return block; - }, - - /** - * Expect the given type, or throw an exception. - * - * @param {String} type - * @api private - */ - - expect: function(type){ - if (this.peek().type === type) { - return this.advance(); - } else { - throw new Error('expected "' + type + '", but got "' + this.peek().type + '"'); - } - }, - - /** - * Accept the given `type`. - * - * @param {String} type - * @api private - */ - - accept: function(type){ - if (this.peek().type === type) { - return this.advance(); - } - }, - - /** - * tag - * | doctype - * | mixin - * | include - * | filter - * | comment - * | text - * | each - * | code - * | yield - * | id - * | class - * | interpolation - */ - - parseExpr: function(){ - switch (this.peek().type) { - case 'tag': - return this.parseTag(); - case 'mixin': - return this.parseMixin(); - case 'block': - return this.parseBlock(); - case 'case': - return this.parseCase(); - case 'when': - return this.parseWhen(); - case 'default': - return this.parseDefault(); - case 'extends': - return this.parseExtends(); - case 'include': - return this.parseInclude(); - case 'doctype': - return this.parseDoctype(); - case 'filter': - return this.parseFilter(); - case 'comment': - return this.parseComment(); - case 'text': - return this.parseText(); - case 'each': - return this.parseEach(); - case 'code': - return this.parseCode(); - case 'call': - return this.parseCall(); - case 'interpolation': - return this.parseInterpolation(); - case 'yield': - this.advance(); - var block = new nodes.Block; - block.yield = true; - return block; - case 'id': - case 'class': - var tok = this.advance(); - this.lexer.defer(this.lexer.tok('tag', 'div')); - this.lexer.defer(tok); - return this.parseExpr(); - default: - throw new Error('unexpected token "' + this.peek().type + '"'); - } - }, - - /** - * Text - */ - - parseText: function(){ - var tok = this.expect('text') - , node = new nodes.Text(tok.val); - node.line = this.line(); - return node; - }, - - /** - * ':' expr - * | block - */ - - parseBlockExpansion: function(){ - if (':' == this.peek().type) { - this.advance(); - return new nodes.Block(this.parseExpr()); - } else { - return this.block(); - } - }, - - /** - * case - */ - - parseCase: function(){ - var val = this.expect('case').val - , node = new nodes.Case(val); - node.line = this.line(); - node.block = this.block(); - return node; - }, - - /** - * when - */ - - parseWhen: function(){ - var val = this.expect('when').val - return new nodes.Case.When(val, this.parseBlockExpansion()); - }, - - /** - * default - */ - - parseDefault: function(){ - this.expect('default'); - return new nodes.Case.When('default', this.parseBlockExpansion()); - }, - - /** - * code - */ - - parseCode: function(){ - var tok = this.expect('code') - , node = new nodes.Code(tok.val, tok.buffer, tok.escape) - , block - , i = 1; - node.line = this.line(); - while (this.lookahead(i) && 'newline' == this.lookahead(i).type) ++i; - block = 'indent' == this.lookahead(i).type; - if (block) { - this.skip(i-1); - node.block = this.block(); - } - return node; - }, - - /** - * comment - */ - - parseComment: function(){ - var tok = this.expect('comment') - , node; - - if ('indent' == this.peek().type) { - node = new nodes.BlockComment(tok.val, this.block(), tok.buffer); - } else { - node = new nodes.Comment(tok.val, tok.buffer); - } - - node.line = this.line(); - return node; - }, - - /** - * doctype - */ - - parseDoctype: function(){ - var tok = this.expect('doctype') - , node = new nodes.Doctype(tok.val); - node.line = this.line(); - return node; - }, - - /** - * filter attrs? text-block - */ - - parseFilter: function(){ - var block - , tok = this.expect('filter') - , attrs = this.accept('attrs'); - - this.lexer.pipeless = true; - block = this.parseTextBlock(); - this.lexer.pipeless = false; - - var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); - node.line = this.line(); - return node; - }, - - /** - * tag ':' attrs? block - */ - - parseASTFilter: function(){ - var block - , tok = this.expect('tag') - , attrs = this.accept('attrs'); - - this.expect(':'); - block = this.block(); - - var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); - node.line = this.line(); - return node; - }, - - /** - * each block - */ - - parseEach: function(){ - var tok = this.expect('each') - , node = new nodes.Each(tok.code, tok.val, tok.key); - node.line = this.line(); - node.block = this.block(); - if (this.peek().type == 'code' && this.peek().val == 'else') { - this.advance(); - node.alternative = this.block(); - } - return node; - }, - - /** - * 'extends' name - */ - - parseExtends: function(){ - var path = require('path') - , fs = require('fs') - , dirname = path.dirname - , basename = path.basename - , join = path.join; - - if (!this.filename) - throw new Error('the "filename" option is required to extend templates'); - - var path = this.expect('extends').val.trim() - , dir = dirname(this.filename); - - var path = join(dir, path + '.jade') - , str = fs.readFileSync(path, 'utf8') - , parser = new Parser(str, path, this.options); - - parser.blocks = this.blocks; - parser.contexts = this.contexts; - this.extending = parser; - - // TODO: null node - return new nodes.Literal(''); - }, - - /** - * 'block' name block - */ - - parseBlock: function(){ - var block = this.expect('block') - , mode = block.mode - , name = block.val.trim(); - - block = 'indent' == this.peek().type - ? this.block() - : new nodes.Block(new nodes.Literal('')); - - var prev = this.blocks[name]; - - if (prev) { - switch (prev.mode) { - case 'append': - block.nodes = block.nodes.concat(prev.nodes); - prev = block; - break; - case 'prepend': - block.nodes = prev.nodes.concat(block.nodes); - prev = block; - break; - } - } - - block.mode = mode; - return this.blocks[name] = prev || block; - }, - - /** - * include block? - */ - - parseInclude: function(){ - var path = require('path') - , fs = require('fs') - , dirname = path.dirname - , basename = path.basename - , join = path.join; - - var path = this.expect('include').val.trim() - , dir = dirname(this.filename); - - if (!this.filename) - throw new Error('the "filename" option is required to use includes'); - - // no extension - if (!~basename(path).indexOf('.')) { - path += '.jade'; - } - - // non-jade - if ('.jade' != path.substr(-5)) { - var path = join(dir, path) - , str = fs.readFileSync(path, 'utf8'); - return new nodes.Literal(str); - } - - var path = join(dir, path) - , str = fs.readFileSync(path, 'utf8') - , parser = new Parser(str, path, this.options); - parser.blocks = utils.merge({}, this.blocks); - parser.mixins = this.mixins; - - this.context(parser); - var ast = parser.parse(); - this.context(); - ast.filename = path; - - if ('indent' == this.peek().type) { - ast.includeBlock().push(this.block()); - } - - return ast; - }, - - /** - * call ident block - */ - - parseCall: function(){ - var tok = this.expect('call') - , name = tok.val - , args = tok.args - , mixin = new nodes.Mixin(name, args, new nodes.Block, true); - - this.tag(mixin); - if (mixin.block.isEmpty()) mixin.block = null; - return mixin; - }, - - /** - * mixin block - */ - - parseMixin: function(){ - var tok = this.expect('mixin') - , name = tok.val - , args = tok.args - , mixin; - - // definition - if ('indent' == this.peek().type) { - mixin = new nodes.Mixin(name, args, this.block(), false); - this.mixins[name] = mixin; - return mixin; - // call - } else { - return new nodes.Mixin(name, args, null, true); - } - }, - - /** - * indent (text | newline)* outdent - */ - - parseTextBlock: function(){ - var block = new nodes.Block; - block.line = this.line(); - var spaces = this.expect('indent').val; - if (null == this._spaces) this._spaces = spaces; - var indent = Array(spaces - this._spaces + 1).join(' '); - while ('outdent' != this.peek().type) { - switch (this.peek().type) { - case 'newline': - this.advance(); - break; - case 'indent': - this.parseTextBlock().nodes.forEach(function(node){ - block.push(node); - }); - break; - default: - var text = new nodes.Text(indent + this.advance().val); - text.line = this.line(); - block.push(text); - } - } - - if (spaces == this._spaces) this._spaces = null; - this.expect('outdent'); - return block; - }, - - /** - * indent expr* outdent - */ - - block: function(){ - var block = new nodes.Block; - block.line = this.line(); - this.expect('indent'); - while ('outdent' != this.peek().type) { - if ('newline' == this.peek().type) { - this.advance(); - } else { - block.push(this.parseExpr()); - } - } - this.expect('outdent'); - return block; - }, - - /** - * interpolation (attrs | class | id)* (text | code | ':')? newline* block? - */ - - parseInterpolation: function(){ - var tok = this.advance(); - var tag = new nodes.Tag(tok.val); - tag.buffer = true; - return this.tag(tag); - }, - - /** - * tag (attrs | class | id)* (text | code | ':')? newline* block? - */ - - parseTag: function(){ - // ast-filter look-ahead - var i = 2; - if ('attrs' == this.lookahead(i).type) ++i; - if (':' == this.lookahead(i).type) { - if ('indent' == this.lookahead(++i).type) { - return this.parseASTFilter(); - } - } - - var tok = this.advance() - , tag = new nodes.Tag(tok.val); - - tag.selfClosing = tok.selfClosing; - - return this.tag(tag); - }, - - /** - * Parse tag. - */ - - tag: function(tag){ - var dot; - - tag.line = this.line(); - - // (attrs | class | id)* - out: - while (true) { - switch (this.peek().type) { - case 'id': - case 'class': - var tok = this.advance(); - tag.setAttribute(tok.type, "'" + tok.val + "'"); - continue; - case 'attrs': - var tok = this.advance() - , obj = tok.attrs - , escaped = tok.escaped - , names = Object.keys(obj); - - if (tok.selfClosing) tag.selfClosing = true; - - for (var i = 0, len = names.length; i < len; ++i) { - var name = names[i] - , val = obj[name]; - tag.setAttribute(name, val, escaped[name]); - } - continue; - default: - break out; - } - } - - // check immediate '.' - if ('.' == this.peek().val) { - dot = tag.textOnly = true; - this.advance(); - } - - // (text | code | ':')? - switch (this.peek().type) { - case 'text': - tag.block.push(this.parseText()); - break; - case 'code': - tag.code = this.parseCode(); - break; - case ':': - this.advance(); - tag.block = new nodes.Block; - tag.block.push(this.parseExpr()); - break; - } - - // newline* - while ('newline' == this.peek().type) this.advance(); - - tag.textOnly = tag.textOnly || ~textOnly.indexOf(tag.name); - - // script special-case - if ('script' == tag.name) { - var type = tag.getAttribute('type'); - if (!dot && type && 'text/javascript' != type.replace(/^['"]|['"]$/g, '')) { - tag.textOnly = false; - } - } - - // block? - if ('indent' == this.peek().type) { - if (tag.textOnly) { - this.lexer.pipeless = true; - tag.block = this.parseTextBlock(); - this.lexer.pipeless = false; - } else { - var block = this.block(); - if (tag.block) { - for (var i = 0, len = block.nodes.length; i < len; ++i) { - tag.block.push(block.nodes[i]); - } - } else { - tag.block = block; - } - } - } - - return tag; - } -}; - -}); // module: parser.js - -require.register("runtime.js", function(module, exports, require){ - -/*! - * Jade - runtime - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Lame Array.isArray() polyfill for now. - */ - -if (!Array.isArray) { - Array.isArray = function(arr){ - return '[object Array]' == Object.prototype.toString.call(arr); - }; -} - -/** - * Lame Object.keys() polyfill for now. - */ - -if (!Object.keys) { - Object.keys = function(obj){ - var arr = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - arr.push(key); - } - } - return arr; - } -} - -/** - * Merge two attribute objects giving precedence - * to values in object `b`. Classes are special-cased - * allowing for arrays and merging/joining appropriately - * resulting in a string. - * - * @param {Object} a - * @param {Object} b - * @return {Object} a - * @api private - */ - -exports.merge = function merge(a, b) { - var ac = a['class']; - var bc = b['class']; - - if (ac || bc) { - ac = ac || []; - bc = bc || []; - if (!Array.isArray(ac)) ac = [ac]; - if (!Array.isArray(bc)) bc = [bc]; - ac = ac.filter(nulls); - bc = bc.filter(nulls); - a['class'] = ac.concat(bc).join(' '); - } - - for (var key in b) { - if (key != 'class') { - a[key] = b[key]; - } - } - - return a; -}; - -/** - * Filter null `val`s. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function nulls(val) { - return val != null; -} - -/** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - * @api private - */ - -exports.attrs = function attrs(obj, escaped){ - var buf = [] - , terse = obj.terse; - - delete obj.terse; - var keys = Object.keys(obj) - , len = keys.length; - - if (len) { - buf.push(''); - for (var i = 0; i < len; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('boolean' == typeof val || null == val) { - if (val) { - terse - ? buf.push(key) - : buf.push(key + '="' + key + '"'); - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - buf.push(key + "='" + JSON.stringify(val) + "'"); - } else if ('class' == key && Array.isArray(val)) { - buf.push(key + '="' + exports.escape(val.join(' ')) + '"'); - } else if (escaped && escaped[key]) { - buf.push(key + '="' + exports.escape(val) + '"'); - } else { - buf.push(key + '="' + val + '"'); - } - } - } - - return buf.join(' '); -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function escape(html){ - return String(html) - .replace(/&(?!(\w+|\#\d+);)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - -/** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - -exports.rethrow = function rethrow(err, filename, lineno){ - if (!filename) throw err; - - var context = 3 - , str = require('fs').readFileSync(filename, 'utf8') - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // Error context - var context = lines.slice(start, end).map(function(line, i){ - var curr = i + start + 1; - return (curr == lineno ? ' > ' : ' ') - + curr - + '| ' - + line; - }).join('\n'); - - // Alter exception message - err.path = filename; - err.message = (filename || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; -}; - -}); // module: runtime.js - -require.register("self-closing.js", function(module, exports, require){ - -/*! - * Jade - self closing tags - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = [ - 'meta' - , 'img' - , 'link' - , 'input' - , 'source' - , 'area' - , 'base' - , 'col' - , 'br' - , 'hr' -]; -}); // module: self-closing.js - -require.register("utils.js", function(module, exports, require){ - -/*! - * Jade - utils - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Convert interpolation in the given string to JavaScript. - * - * @param {String} str - * @return {String} - * @api private - */ - -var interpolate = exports.interpolate = function(str){ - return str.replace(/(_SLASH_)?([#!]){(.*?)}/g, function(str, escape, flag, code){ - code = code - .replace(/\\'/g, "'") - .replace(/_SLASH_/g, '\\'); - - return escape - ? str.slice(7) - : "' + " - + ('!' == flag ? '' : 'escape') - + "((interp = " + code - + ") == null ? '' : interp) + '"; - }); -}; - -/** - * Escape single quotes in `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -var escape = exports.escape = function(str) { - return str.replace(/'/g, "\\'"); -}; - -/** - * Interpolate, and escape the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.text = function(str){ - return interpolate(escape(str)); -}; - -/** - * Merge `b` into `a`. - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api public - */ - -exports.merge = function(a, b) { - for (var key in b) a[key] = b[key]; - return a; -}; - - -}); // module: utils.js - -window.jade = require("jade"); -})(); diff --git a/node_modules/jade/jade.md b/node_modules/jade/jade.md deleted file mode 100644 index 051dc03..0000000 --- a/node_modules/jade/jade.md +++ /dev/null @@ -1,510 +0,0 @@ - -# Jade - - The jade template engine for node.js - -## Synopsis - - jade [-h|--help] [-v|--version] [-o|--obj STR] - [-O|--out DIR] [-p|--path PATH] [-P|--pretty] - [-c|--client] [-D|--no-debug] - -## Examples - - translate jade the templates dir - - $ jade templates - - create {foo,bar}.html - - $ jade {foo,bar}.jade - - jade over stdio - - $ jade < my.jade > my.html - - jade over s - - $ echo "h1 Jade!" | jade - - foo, bar dirs rendering to /tmp - - $ jade foo bar --out /tmp - - compile client-side templates without debugging - instrumentation, making the output javascript - very light-weight. This requires runtime.js - in your projects. - - $ jade --client --no-debug < my.jade - -## Tags - - Tags are simply nested via whitespace, closing - tags defined for you. These indents are called "blocks". - - ul - li - a Foo - li - a Bar - - You may have several tags in one "block": - - ul - li - a Foo - a Bar - a Baz - -## Self-closing Tags - - Some tags are flagged as self-closing by default, such - as `meta`, `link`, and so on. To explicitly self-close - a tag simply append the `/` character: - - foo/ - foo(bar='baz')/ - - Would yield: - - - - -## Attributes - - Tag attributes look similar to HTML, however - the values are regular JavaScript, here are - some examples: - - a(href='google.com') Google - a(class='button', href='google.com') Google - - As mentioned the attribute values are just JavaScript, - this means ternary operations and other JavaScript expressions - work just fine: - - body(class=user.authenticated ? 'authenticated' : 'anonymous') - a(href=user.website || 'http://google.com') - - Multiple lines work too: - - input(type='checkbox', - name='agreement', - checked) - - Multiple lines without the comma work fine: - - input(type='checkbox' - name='agreement' - checked) - - Funky whitespace? fine: - - input( - type='checkbox' - name='agreement' - checked) - -## Boolean attributes - - Boolean attributes are mirrored by Jade, and accept - bools, aka _true_ or _false_. When no value is specified - _true_ is assumed. For example: - - input(type="checkbox", checked) - // => "" - - For example if the checkbox was for an agreement, perhaps `user.agreed` - was _true_ the following would also output 'checked="checked"': - - input(type="checkbox", checked=user.agreed) - -## Class attributes - - The _class_ attribute accepts an array of classes, - this can be handy when generated from a javascript - function etc: - - classes = ['foo', 'bar', 'baz'] - a(class=classes) - // => "" - -## Class literal - - Classes may be defined using a ".CLASSNAME" syntax: - - .button - // => "
    " - - Or chained: - - .large.button - // => "
    " - - The previous defaulted to divs, however you - may also specify the tag type: - - h1.title My Title - // => "

    My Title

    " - -## Id literal - - Much like the class literal there's an id literal: - - #user-1 - // => "
    " - - Again we may specify the tag as well: - - ul#menu - li: a(href='/home') Home - li: a(href='/store') Store - li: a(href='/contact') Contact - - Finally all of these may be used in any combination, - the following are all valid tags: - - a.button#contact(style: 'color: red') Contact - a.button(style: 'color: red')#contact Contact - a(style: 'color: red').button#contact Contact - -## Block expansion - - Jade supports the concept of "block expansion", in which - using a trailing ":" after a tag will inject a block: - - ul - li: a Foo - li: a Bar - li: a Baz - -## Text - - Arbitrary text may follow tags: - - p Welcome to my site - - yields: - -

    Welcome to my site

    - -## Pipe text - - Another form of text is "pipe" text. Pipes act - as the text margin for large bodies of text. - - p - | This is a large - | body of text for - | this tag. - | - | Nothing too - | exciting. - - yields: - -

    This is a large - body of text for - this tag. - - Nothing too - exciting. -

    - - Using pipes we can also specify regular Jade tags - within the text: - - p - | Click to visit - a(href='http://google.com') Google - | if you want. - -## Text only tags - - As an alternative to pipe text you may add - a trailing "." to indicate that the block - contains nothing but plain-text, no tags: - - p. - This is a large - body of text for - this tag. - - Nothing too - exciting. - - Some tags are text-only by default, for example - _script_, _textarea_, and _style_ tags do not - contain nested HTML so Jade implies the trailing ".": - - script - if (foo) { - bar(); - } - - style - body { - padding: 50px; - font: 14px Helvetica; - } - -## Template script tags - - Sometimes it's useful to define HTML in script - tags using Jade, typically for client-side templates. - - To do this simply give the _script_ tag an arbitrary - _type_ attribute such as _text/x-template_: - - script(type='text/template') - h1 Look! - p Jade still works in here! - -## Interpolation - - Both plain-text and piped-text support interpolation, - which comes in two forms, escapes and non-escaped. The - following will output the _user.name_ in the paragraph - but HTML within it will be escaped to prevent XSS attacks: - - p Welcome #{user.name} - - The following syntax is identical however it will _not_ escape - HTML, and should only be used with strings that you trust: - - p Welcome !{user.name} - -## Inline HTML - - Sometimes constructing small inline snippets of HTML - in Jade can be annoying, luckily we can add plain - HTML as well: - - p Welcome #{user.name} - -## Code - - To buffer output with Jade simply use _=_ at the beginning - of a line or after a tag. This method escapes any HTML - present in the string. - - p= user.description - - To buffer output unescaped use the _!=_ variant, but again - be careful of XSS. - - p!= user.description - - The final way to mess with JavaScript code in Jade is the unbuffered - _-_, which can be used for conditionals, defining variables etc: - - - var user = { description: 'foo bar baz' } - #user - - if (user.description) { - h2 Description - p.description= user.description - - } - - When compiled blocks are wrapped in anonymous functions, so the - following is also valid, without braces: - - - var user = { description: 'foo bar baz' } - #user - - if (user.description) - h2 Description - p.description= user.description - - If you really want you could even use `.forEach()` and others: - - - users.forEach(function(user){ - .user - h2= user.name - p User #{user.name} is #{user.age} years old - - }) - - Taking this further Jade provides some syntax for conditionals, - iteration, switch statements etc. Let's look at those next! - -## Assignment - - Jade's first-class assignment is simple, simply use the _=_ - operator and Jade will _var_ it for you. The following are equivalent: - - - var user = { name: 'tobi' } - user = { name: 'tobi' } - -## Conditionals - - Jade's first-class conditional syntax allows for optional - parenthesis, and you may now omit the leading _-_ otherwise - it's identical, still just regular javascript: - - user = { description: 'foo bar baz' } - #user - if user.description - h2 Description - p.description= user.description - - Jade provides the negated version, _unless_ as well, the following - are equivalent: - - - if (!(user.isAnonymous)) - p You're logged in as #{user.name} - - unless user.isAnonymous - p You're logged in as #{user.name} - -## Iteration - - JavaScript's _for_ loops don't look very declarative, so Jade - also provides its own _for_ loop construct, aliased as _each_: - - for user in users - .user - h2= user.name - p user #{user.name} is #{user.age} year old - - As mentioned _each_ is identical: - - each user in users - .user - h2= user.name - - If necessary the index is available as well: - - for user, i in users - .user(class='user-#{i}') - h2= user.name - - Remember, it's just JavaScript: - - ul#letters - for letter in ['a', 'b', 'c'] - li= letter - -## Mixins - - Mixins provide a way to define jade "functions" which "mix in" - their contents when called. This is useful for abstracting - out large fragments of Jade. - - The simplest possible mixin which accepts no arguments might - look like this: - - mixin hello - p Hello - - You use a mixin by placing `+` before the name: - - +hello - - For something a little more dynamic, mixins can take - arguments, the mixin itself is converted to a javascript - function internally: - - mixin hello(user) - p Hello #{user} - - +hello('Tobi') - - Yields: - -

    Hello Tobi

    - - Mixins may optionally take blocks, when a block is passed - its contents becomes the implicit `block` argument. For - example here is a mixin passed a block, and also invoked - without passing a block: - - mixin article(title) - .article - .article-wrapper - h1= title - if block - block - else - p No content provided - - +article('Hello world') - - +article('Hello world') - p This is my - p Amazing article - - yields: - -
    -
    -

    Hello world

    -

    No content provided

    -
    -
    - -
    -
    -

    Hello world

    -

    This is my

    -

    Amazing article

    -
    -
    - - Mixins can even take attributes, just like a tag. When - attributes are passed they become the implicit `attributes` - argument. Individual attributes can be accessed just like - normal object properties: - - mixin centered - .centered(class=attributes.class) - block - - +centered.bold Hello world - - +centered.red - p This is my - p Amazing article - - yields: - -
    Hello world
    -
    -

    This is my

    -

    Amazing article

    -
    - - If you use `attributes` directly, *all* passed attributes - get used: - - mixin link - a.menu(attributes) - block - - +link.highlight(href='#top') Top - +link#sec1.plain(href='#section1') Section 1 - +link#sec2.plain(href='#section2') Section 2 - - yields: - - Top - Section 1 - Section 2 - - If you pass arguments, they must directly follow the mixin: - - mixin list(arr) - if block - .title - block - ul(attributes) - each item in arr - li= item - - +list(['foo', 'bar', 'baz'])(id='myList', class='bold') - - yields: - -
      -
    • foo
    • -
    • bar
    • -
    • baz
    • -
    diff --git a/node_modules/jade/jade.min.js b/node_modules/jade/jade.min.js deleted file mode 100644 index 93f3b3d..0000000 --- a/node_modules/jade/jade.min.js +++ /dev/null @@ -1,2 +0,0 @@ -(function(){function require(p){var path=require.resolve(p),mod=require.modules[path];if(!mod)throw new Error('failed to require "'+p+'"');return mod.exports||(mod.exports={},mod.call(mod.exports,mod,mod.exports,require.relative(path))),mod.exports}require.modules={},require.resolve=function(path){var orig=path,reg=path+".js",index=path+"/index.js";return require.modules[reg]&®||require.modules[index]&&index||orig},require.register=function(path,fn){require.modules[path]=fn},require.relative=function(parent){return function(p){if("."!=p.charAt(0))return require(p);var path=parent.split("/"),segs=p.split("/");path.pop();for(var i=0;i/g,">").replace(/"/g,""")}var nodes=require("./nodes"),filters=require("./filters"),doctypes=require("./doctypes"),selfClosing=require("./self-closing"),runtime=require("./runtime"),utils=require("./utils");Object.keys||(Object.keys=function(obj){var arr=[];for(var key in obj)obj.hasOwnProperty(key)&&arr.push(key);return arr}),String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/,"")});var Compiler=module.exports=function Compiler(node,options){this.options=options=options||{},this.node=node,this.hasCompiledDoctype=!1,this.hasCompiledTag=!1,this.pp=options.pretty||!1,this.debug=!1!==options.compileDebug,this.indents=0,this.parentIndents=0,options.doctype&&this.setDoctype(options.doctype)};Compiler.prototype={compile:function(){return this.buf=["var interp;"],this.pp&&this.buf.push("var __indent = [];"),this.lastBufferedIdx=-1,this.visit(this.node),this.buf.join("\n")},setDoctype:function(name){name=name&&name.toLowerCase()||"default",this.doctype=doctypes[name]||"",this.terse=this.doctype.toLowerCase()=="",this.xml=0==this.doctype.indexOf("1&&!escape&&block.nodes[0].isText&&block.nodes[1].isText&&this.prettyIndent(1,!0);for(var i=0;i0&&!escape&&block.nodes[i].isText&&block.nodes[i-1].isText&&this.prettyIndent(1,!1),this.visit(block.nodes[i]),block.nodes[i+1]&&block.nodes[i].isText&&block.nodes[i+1].isText&&this.buffer("\\n")},visitDoctype:function(doctype){doctype&&(doctype.val||!this.doctype)&&this.setDoctype(doctype.val||"default"),this.doctype&&this.buffer(this.doctype),this.hasCompiledDoctype=!0},visitMixin:function(mixin){var name=mixin.name.replace(/-/g,"_")+"_mixin",args=mixin.args||"",block=mixin.block,attrs=mixin.attrs,pp=this.pp;if(mixin.call){pp&&this.buf.push("__indent.push('"+Array(this.indents+1).join(" ")+"');");if(block||attrs.length){this.buf.push(name+".call({");if(block){this.buf.push("block: function(){"),this.parentIndents++;var _indents=this.indents;this.indents=0,this.visit(mixin.block),this.indents=_indents,this.parentIndents--,attrs.length?this.buf.push("},"):this.buf.push("}")}if(attrs.length){var val=this.attrs(attrs);val.inherits?this.buf.push("attributes: merge({"+val.buf+"}, attributes), escaped: merge("+val.escaped+", escaped, true)"):this.buf.push("attributes: {"+val.buf+"}, escaped: "+val.escaped)}args?this.buf.push("}, "+args+");"):this.buf.push("});")}else this.buf.push(name+"("+args+");");pp&&this.buf.push("__indent.pop();")}else this.buf.push("var "+name+" = function("+args+"){"),this.buf.push("var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};"),this.parentIndents++,this.visit(block),this.parentIndents--,this.buf.push("};")},visitTag:function(tag){this.indents++;var name=tag.name,pp=this.pp;tag.buffer&&(name="' + ("+name+") + '"),this.hasCompiledTag||(!this.hasCompiledDoctype&&"html"==name&&this.visitDoctype(),this.hasCompiledTag=!0),pp&&!tag.isInline()&&this.prettyIndent(0,!0),(~selfClosing.indexOf(name)||tag.selfClosing)&&!this.xml?(this.buffer("<"+name),this.visitAttributes(tag.attrs),this.terse?this.buffer(">"):this.buffer("/>")):(tag.attrs.length?(this.buffer("<"+name),tag.attrs.length&&this.visitAttributes(tag.attrs),this.buffer(">")):this.buffer("<"+name+">"),tag.code&&this.visitCode(tag.code),this.escape="pre"==tag.name,this.visit(tag.block),pp&&!tag.isInline()&&"pre"!=tag.name&&!tag.canInline()&&this.prettyIndent(0,!0),this.buffer("")),this.indents--},visitFilter:function(filter){var fn=filters[filter.name];if(!fn)throw filter.isASTFilter?new Error('unknown ast filter "'+filter.name+':"'):new Error('unknown filter ":'+filter.name+'"');if(filter.isASTFilter)this.buf.push(fn(filter.block,this,filter.attrs));else{var text=filter.block.nodes.map(function(node){return node.val}).join("\n");filter.attrs=filter.attrs||{},filter.attrs.filename=this.options.filename,this.buffer(utils.text(fn(text,filter.attrs)))}},visitText:function(text){text=utils.text(text.val.replace(/\\/g,"_SLASH_")),this.escape&&(text=escape(text)),text=text.replace(/_SLASH_/g,"\\\\"),this.buffer(text)},visitComment:function(comment){if(!comment.buffer)return;this.pp&&this.prettyIndent(1,!0),this.buffer("")},visitBlockComment:function(comment){if(!comment.buffer)return;0==comment.val.trim().indexOf("if")?(this.buffer("")):(this.buffer(""))},visitCode:function(code){if(code.buffer){var val=code.val.trimLeft();this.buf.push("var __val__ = "+val),val='null == __val__ ? "" : __val__',code.escape&&(val="escape("+val+")"),this.buf.push("buf.push("+val+");")}else this.buf.push(code.val);code.block&&(code.buffer||this.buf.push("{"),this.visit(code.block),code.buffer||this.buf.push("}"))},visitEach:function(each){this.buf.push("// iterate "+each.obj+"\n"+";(function(){\n"+" if ('number' == typeof "+each.obj+".length) {\n"),each.alternative&&this.buf.push(" if ("+each.obj+".length) {"),this.buf.push(" for (var "+each.key+" = 0, $$l = "+each.obj+".length; "+each.key+" < $$l; "+each.key+"++) {\n"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n"),each.alternative&&(this.buf.push(" } else {"),this.visit(each.alternative),this.buf.push(" }")),this.buf.push(" } else {\n var $$l = 0;\n for (var "+each.key+" in "+each.obj+") {\n"+" $$l++;"+" if ("+each.obj+".hasOwnProperty("+each.key+")){"+" var "+each.val+" = "+each.obj+"["+each.key+"];\n"),this.visit(each.block),this.buf.push(" }\n"),this.buf.push(" }\n"),each.alternative&&(this.buf.push(" if ($$l === 0) {"),this.visit(each.alternative),this.buf.push(" }")),this.buf.push(" }\n}).call(this);\n")},visitAttributes:function(attrs){var val=this.attrs(attrs);val.inherits?this.buf.push("buf.push(attrs(merge({ "+val.buf+" }, attributes), merge("+val.escaped+", escaped, true)));"):val.constant?(eval("var buf={"+val.buf+"};"),this.buffer(runtime.attrs(buf,JSON.parse(val.escaped)),!0)):this.buf.push("buf.push(attrs({ "+val.buf+" }, "+val.escaped+"));")},attrs:function(attrs){var buf=[],classes=[],escaped={},constant=attrs.every(function(attr){return isConstant(attr.val)}),inherits=!1;return this.terse&&buf.push("terse: true"),attrs.forEach(function(attr){if(attr.name=="attributes")return inherits=!0;escaped[attr.name]=attr.escaped;if(attr.name=="class")classes.push("("+attr.val+")");else{var pair="'"+attr.name+"':("+attr.val+")";buf.push(pair)}}),classes.length&&(classes=classes.join(" + ' ' + "),buf.push("class: "+classes)),{buf:buf.join(", ").replace("class:",'"class":'),escaped:JSON.stringify(escaped),inherits:inherits,constant:constant}}}}),require.register("doctypes.js",function(module,exports,require){module.exports={5:"","default":"",xml:'',transitional:'',strict:'',frameset:'',1.1:'',basic:'',mobile:''}}),require.register("filters.js",function(module,exports,require){module.exports={cdata:function(str){return""},sass:function(str){str=str.replace(/\\n/g,"\n");var sass=require("sass").render(str).replace(/\n/g,"\\n");return'"},stylus:function(str,options){var ret;str=str.replace(/\\n/g,"\n");var stylus=require("stylus");return stylus(str,options).render(function(err,css){if(err)throw err;ret=css.replace(/\n/g,"\\n")}),'"},less:function(str){var ret;return str=str.replace(/\\n/g,"\n"),require("less").render(str,function(err,css){if(err)throw err;ret='"}),ret},markdown:function(str){var md;try{md=require("markdown")}catch(err){try{md=require("discount")}catch(err){try{md=require("markdown-js")}catch(err){try{md=require("marked")}catch(err){throw new Error("Cannot find markdown library, install markdown, discount, or marked.")}}}}return str=str.replace(/\\n/g,"\n"),md.parse(str).replace(/\n/g,"\\n").replace(/'/g,"'")},coffeescript:function(str){var js=require("coffee-script").compile(str).replace(/\\/g,"\\\\").replace(/\n/g,"\\n");return'"}}}),require.register("inline-tags.js",function(module,exports,require){module.exports=["a","abbr","acronym","b","br","code","em","font","i","img","ins","kbd","map","samp","small","span","strong","sub","sup"]}),require.register("jade.js",function(module,exports,require){function parse(str,options){try{var parser=new Parser(str,options.filename,options),compiler=new(options.compiler||Compiler)(parser.parse(),options),js=compiler.compile();return options.debug&&console.error("\nCompiled Function:\n\n%s",js.replace(/^/gm," ")),"var buf = [];\n"+(options.self?"var self = locals || {};\n"+js:"with (locals || {}) {\n"+js+"\n}\n")+'return buf.join("");'}catch(err){parser=parser.context(),runtime.rethrow(err,parser.filename,parser.lexer.lineno)}}function stripBOM(str){return 65279==str.charCodeAt(0)?str.substring(1):str}var Parser=require("./parser"),Lexer=require("./lexer"),Compiler=require("./compiler"),runtime=require("./runtime");exports.version="0.27.6",exports.selfClosing=require("./self-closing"),exports.doctypes=require("./doctypes"),exports.filters=require("./filters"),exports.utils=require("./utils"),exports.Compiler=Compiler,exports.Parser=Parser,exports.Lexer=Lexer,exports.nodes=require("./nodes"),exports.runtime=runtime,exports.cache={},exports.compile=function(str,options){var options=options||{},client=options.client,filename=options.filename?JSON.stringify(options.filename):"undefined",fn;return str=stripBOM(String(str)),options.compileDebug!==!1?fn=["var __jade = [{ lineno: 1, filename: "+filename+" }];","try {",parse(str,options),"} catch (err) {"," rethrow(err, __jade[0].filename, __jade[0].lineno);","}"].join("\n"):fn=parse(str,options),client&&(fn="attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n"+fn),fn=new Function("locals, attrs, escape, rethrow, merge",fn),client?fn:function(locals){return fn(locals,runtime.attrs,runtime.escape,runtime.rethrow,runtime.merge)}},exports.render=function(str,options,fn){"function"==typeof options&&(fn=options,options={});if(options.cache&&!options.filename)return fn(new Error('the "filename" option is required for caching'));try{var path=options.filename,tmpl=options.cache?exports.cache[path]||(exports.cache[path]=exports.compile(str,options)):exports.compile(str,options);fn(null,tmpl(options))}catch(err){fn(err)}},exports.renderFile=function(path,options,fn){var key=path+":string";"function"==typeof options&&(fn=options,options={});try{options.filename=path;var str=options.cache?exports.cache[key]||(exports.cache[key]=fs.readFileSync(path,"utf8")):fs.readFileSync(path,"utf8");exports.render(str,options,fn)}catch(err){fn(err)}},exports.__express=exports.renderFile}),require.register("lexer.js",function(module,exports,require){var utils=require("./utils"),Lexer=module.exports=function Lexer(str,options){options=options||{},this.input=str.replace(/\r\n|\r/g,"\n"),this.colons=options.colons,this.deferredTokens=[],this.lastIndents=0,this.lineno=1,this.stash=[],this.indentStack=[],this.indentRe=null,this.pipeless=!1};Lexer.prototype={tok:function(type,val){return{type:type,line:this.lineno,val:val}},consume:function(len){this.input=this.input.substr(len)},scan:function(regexp,type){var captures;if(captures=regexp.exec(this.input))return this.consume(captures[0].length),this.tok(type,captures[1])},defer:function(tok){this.deferredTokens.push(tok)},lookahead:function(n){var fetch=n-this.stash.length;while(fetch-->0)this.stash.push(this.next());return this.stash[--n]},indexOfDelimiters:function(start,end){var str=this.input,nstart=0,nend=0,pos=0;for(var i=0,len=str.length;iindents)this.stash.push(this.tok("outdent")),this.indentStack.shift();tok=this.stash.pop()}else indents&&indents!=this.indentStack[0]?(this.indentStack.unshift(indents),tok=this.tok("indent",indents)):tok=this.tok("newline");return tok}},pipelessText:function(){if(this.pipeless){if("\n"==this.input[0])return;var i=this.input.indexOf("\n");-1==i&&(i=this.input.length);var str=this.input.substr(0,i);return this.consume(str.length),this.tok("text",str)}},colon:function(){return this.scan(/^: */,":")},advance:function(){return this.stashed()||this.next()},next:function(){return this.deferred()||this.blank()||this.eos()||this.pipelessText()||this.yield()||this.doctype()||this.interpolation()||this["case"]()||this.when()||this["default"]()||this["extends"]()||this.append()||this.prepend()||this.block()||this.include()||this.mixin()||this.call()||this.conditional()||this.each()||this["while"]()||this.assignment()||this.tag()||this.filter()||this.code()||this.id()||this.className()||this.attrs()||this.indent()||this.comment()||this.colon()||this.text()}}}),require.register("nodes/attrs.js",function(module,exports,require){var Node=require("./node"),Block=require("./block"),Attrs=module.exports=function Attrs(){this.attrs=[]};Attrs.prototype=new Node,Attrs.prototype.constructor=Attrs,Attrs.prototype.setAttribute=function(name,val,escaped){return this.attrs.push({name:name,val:val,escaped:escaped}),this},Attrs.prototype.removeAttribute=function(name){for(var i=0,len=this.attrs.length;i/g,">").replace(/"/g,""")},exports.rethrow=function rethrow(err,filename,lineno){if(!filename)throw err;var context=3,str=require("fs").readFileSync(filename,"utf8"),lines=str.split("\n"),start=Math.max(lineno-context,0),end=Math.min(lines.length,lineno+context),context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" > ":" ")+curr+"| "+line}).join("\n");throw err.path=filename,err.message=(filename||"Jade")+":"+lineno+"\n"+context+"\n\n"+err.message,err}}),require.register("self-closing.js",function(module,exports,require){module.exports=["meta","img","link","input","source","area","base","col","br","hr"]}),require.register("utils.js",function(module,exports,require){var interpolate=exports.interpolate=function(str){return str.replace(/(_SLASH_)?([#!]){(.*?)}/g,function(str,escape,flag,code){return code=code.replace(/\\'/g,"'").replace(/_SLASH_/g,"\\"),escape?str.slice(7):"' + "+("!"==flag?"":"escape")+"((interp = "+code+") == null ? '' : interp) + '"})},escape=exports.escape=function(str){return str.replace(/'/g,"\\'")};exports.text=function(str){return interpolate(escape(str))},exports.merge=function(a,b){for(var key in b)a[key]=b[key];return a}}),window.jade=require("jade")})(); \ No newline at end of file diff --git a/node_modules/jade/lib/compiler.js b/node_modules/jade/lib/compiler.js deleted file mode 100644 index bb56142..0000000 --- a/node_modules/jade/lib/compiler.js +++ /dev/null @@ -1,655 +0,0 @@ - -/*! - * Jade - Compiler - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var nodes = require('./nodes') - , filters = require('./filters') - , doctypes = require('./doctypes') - , selfClosing = require('./self-closing') - , runtime = require('./runtime') - , utils = require('./utils'); - -// if browser -// -// if (!Object.keys) { -// Object.keys = function(obj){ -// var arr = []; -// for (var key in obj) { -// if (obj.hasOwnProperty(key)) { -// arr.push(key); -// } -// } -// return arr; -// } -// } -// -// if (!String.prototype.trimLeft) { -// String.prototype.trimLeft = function(){ -// return this.replace(/^\s+/, ''); -// } -// } -// -// end - - -/** - * Initialize `Compiler` with the given `node`. - * - * @param {Node} node - * @param {Object} options - * @api public - */ - -var Compiler = module.exports = function Compiler(node, options) { - this.options = options = options || {}; - this.node = node; - this.hasCompiledDoctype = false; - this.hasCompiledTag = false; - this.pp = options.pretty || false; - this.debug = false !== options.compileDebug; - this.indents = 0; - this.parentIndents = 0; - if (options.doctype) this.setDoctype(options.doctype); -}; - -/** - * Compiler prototype. - */ - -Compiler.prototype = { - - /** - * Compile parse tree to JavaScript. - * - * @api public - */ - - compile: function(){ - this.buf = ['var interp;']; - if (this.pp) this.buf.push("var __indent = [];"); - this.lastBufferedIdx = -1; - this.visit(this.node); - return this.buf.join('\n'); - }, - - /** - * Sets the default doctype `name`. Sets terse mode to `true` when - * html 5 is used, causing self-closing tags to end with ">" vs "/>", - * and boolean attributes are not mirrored. - * - * @param {string} name - * @api public - */ - - setDoctype: function(name){ - name = (name && name.toLowerCase()) || 'default'; - this.doctype = doctypes[name] || ''; - this.terse = this.doctype.toLowerCase() == ''; - this.xml = 0 == this.doctype.indexOf(' 1 && !escape && block.nodes[0].isText && block.nodes[1].isText) - this.prettyIndent(1, true); - - for (var i = 0; i < len; ++i) { - // Pretty print text - if (pp && i > 0 && !escape && block.nodes[i].isText && block.nodes[i-1].isText) - this.prettyIndent(1, false); - - this.visit(block.nodes[i]); - // Multiple text nodes are separated by newlines - if (block.nodes[i+1] && block.nodes[i].isText && block.nodes[i+1].isText) - this.buffer('\\n'); - } - }, - - /** - * Visit `doctype`. Sets terse mode to `true` when html 5 - * is used, causing self-closing tags to end with ">" vs "/>", - * and boolean attributes are not mirrored. - * - * @param {Doctype} doctype - * @api public - */ - - visitDoctype: function(doctype){ - if (doctype && (doctype.val || !this.doctype)) { - this.setDoctype(doctype.val || 'default'); - } - - if (this.doctype) this.buffer(this.doctype); - this.hasCompiledDoctype = true; - }, - - /** - * Visit `mixin`, generating a function that - * may be called within the template. - * - * @param {Mixin} mixin - * @api public - */ - - visitMixin: function(mixin){ - var name = mixin.name.replace(/-/g, '_') + '_mixin' - , args = mixin.args || '' - , block = mixin.block - , attrs = mixin.attrs - , pp = this.pp; - - if (mixin.call) { - if (pp) this.buf.push("__indent.push('" + Array(this.indents + 1).join(' ') + "');") - if (block || attrs.length) { - - this.buf.push(name + '.call({'); - - if (block) { - this.buf.push('block: function(){'); - - // Render block with no indents, dynamically added when rendered - this.parentIndents++; - var _indents = this.indents; - this.indents = 0; - this.visit(mixin.block); - this.indents = _indents; - this.parentIndents--; - - if (attrs.length) { - this.buf.push('},'); - } else { - this.buf.push('}'); - } - } - - if (attrs.length) { - var val = this.attrs(attrs); - if (val.inherits) { - this.buf.push('attributes: merge({' + val.buf - + '}, attributes), escaped: merge(' + val.escaped + ', escaped, true)'); - } else { - this.buf.push('attributes: {' + val.buf + '}, escaped: ' + val.escaped); - } - } - - if (args) { - this.buf.push('}, ' + args + ');'); - } else { - this.buf.push('});'); - } - - } else { - this.buf.push(name + '(' + args + ');'); - } - if (pp) this.buf.push("__indent.pop();") - } else { - this.buf.push('var ' + name + ' = function(' + args + '){'); - this.buf.push('var block = this.block, attributes = this.attributes || {}, escaped = this.escaped || {};'); - this.parentIndents++; - this.visit(block); - this.parentIndents--; - this.buf.push('};'); - } - }, - - /** - * Visit `tag` buffering tag markup, generating - * attributes, visiting the `tag`'s code and block. - * - * @param {Tag} tag - * @api public - */ - - visitTag: function(tag){ - this.indents++; - var name = tag.name - , pp = this.pp; - - if (tag.buffer) name = "' + (" + name + ") + '"; - - if (!this.hasCompiledTag) { - if (!this.hasCompiledDoctype && 'html' == name) { - this.visitDoctype(); - } - this.hasCompiledTag = true; - } - - // pretty print - if (pp && !tag.isInline()) - this.prettyIndent(0, true); - - if ((~selfClosing.indexOf(name) || tag.selfClosing) && !this.xml) { - this.buffer('<' + name); - this.visitAttributes(tag.attrs); - this.terse - ? this.buffer('>') - : this.buffer('/>'); - } else { - // Optimize attributes buffering - if (tag.attrs.length) { - this.buffer('<' + name); - if (tag.attrs.length) this.visitAttributes(tag.attrs); - this.buffer('>'); - } else { - this.buffer('<' + name + '>'); - } - if (tag.code) this.visitCode(tag.code); - this.escape = 'pre' == tag.name; - this.visit(tag.block); - - // pretty print - if (pp && !tag.isInline() && 'pre' != tag.name && !tag.canInline()) - this.prettyIndent(0, true); - - this.buffer(''); - } - this.indents--; - }, - - /** - * Visit `filter`, throwing when the filter does not exist. - * - * @param {Filter} filter - * @api public - */ - - visitFilter: function(filter){ - var fn = filters[filter.name]; - - // unknown filter - if (!fn) throw new Error('unknown filter ":' + filter.name + '"'); - - var text = filter.block.nodes.map( - function(node){ return node.val; } - ).join('\n'); - filter.attrs = filter.attrs || {}; - filter.attrs.filename = this.options.filename; - this.buffer(utils.text(fn(text, filter.attrs))); - }, - - /** - * Visit `text` node. - * - * @param {Text} text - * @api public - */ - - visitText: function(text){ - text = utils.text(text.val.replace(/\\/g, '_SLASH_')); - if (this.escape) text = escape(text); - text = text.replace(/_SLASH_/g, '\\\\'); - this.buffer(text); - }, - - /** - * Visit a `comment`, only buffering when the buffer flag is set. - * - * @param {Comment} comment - * @api public - */ - - visitComment: function(comment){ - if (!comment.buffer) return; - if (this.pp) this.prettyIndent(1, true); - this.buffer(''); - }, - - /** - * Visit a `BlockComment`. - * - * @param {Comment} comment - * @api public - */ - - visitBlockComment: function(comment){ - if (!comment.buffer) return; - if (0 == comment.val.trim().indexOf('if')) { - this.buffer(''); - } else { - this.buffer(''); - } - }, - - /** - * Visit `code`, respecting buffer / escape flags. - * If the code is followed by a block, wrap it in - * a self-calling function. - * - * @param {Code} code - * @api public - */ - - visitCode: function(code){ - // Wrap code blocks with {}. - // we only wrap unbuffered code blocks ATM - // since they are usually flow control - - // Buffer code - if (code.buffer) { - var val = code.val.trimLeft(); - this.buf.push('var __val__ = ' + val); - val = 'null == __val__ ? "" : __val__'; - if (code.escape) val = 'escape(' + val + ')'; - this.buf.push("buf.push(" + val + ");"); - } else { - this.buf.push(code.val); - } - - // Block support - if (code.block) { - if (!code.buffer) this.buf.push('{'); - this.visit(code.block); - if (!code.buffer) this.buf.push('}'); - } - }, - - /** - * Visit `each` block. - * - * @param {Each} each - * @api public - */ - - visitEach: function(each){ - this.buf.push('' - + '// iterate ' + each.obj + '\n' - + ';(function(){\n' - + ' if (\'number\' == typeof ' + each.obj + '.length) {\n'); - - if (each.alternative) { - this.buf.push(' if (' + each.obj + '.length) {'); - } - - this.buf.push('' - + ' for (var ' + each.key + ' = 0, $$l = ' + each.obj + '.length; ' + each.key + ' < $$l; ' + each.key + '++) {\n' - + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); - - this.visit(each.block); - - this.buf.push(' }\n'); - - if (each.alternative) { - this.buf.push(' } else {'); - this.visit(each.alternative); - this.buf.push(' }'); - } - - this.buf.push('' - + ' } else {\n' - + ' var $$l = 0;\n' - + ' for (var ' + each.key + ' in ' + each.obj + ') {\n' - + ' $$l++;' - // if browser - // + ' if (' + each.obj + '.hasOwnProperty(' + each.key + ')){' - // end - + ' var ' + each.val + ' = ' + each.obj + '[' + each.key + '];\n'); - - this.visit(each.block); - - // if browser - // this.buf.push(' }\n'); - // end - - this.buf.push(' }\n'); - if (each.alternative) { - this.buf.push(' if ($$l === 0) {'); - this.visit(each.alternative); - this.buf.push(' }'); - } - this.buf.push(' }\n}).call(this);\n'); - }, - - /** - * Visit `attrs`. - * - * @param {Array} attrs - * @api public - */ - - visitAttributes: function(attrs){ - var val = this.attrs(attrs); - if (val.inherits) { - this.buf.push("buf.push(attrs(merge({ " + val.buf + - " }, attributes), merge(" + val.escaped + ", escaped, true)));"); - } else if (val.constant) { - eval('var buf={' + val.buf + '};'); - this.buffer(runtime.attrs(buf, JSON.parse(val.escaped)), true); - } else { - this.buf.push("buf.push(attrs({ " + val.buf + " }, " + val.escaped + "));"); - } - }, - - /** - * Compile attributes. - */ - - attrs: function(attrs){ - var buf = [] - , classes = [] - , escaped = {} - , constant = attrs.every(function(attr){ return isConstant(attr.val) }) - , inherits = false; - - if (this.terse) buf.push('terse: true'); - - attrs.forEach(function(attr){ - if (attr.name == 'attributes') return inherits = true; - escaped[attr.name] = attr.escaped; - if (attr.name == 'class') { - classes.push('(' + attr.val + ')'); - } else { - var pair = "'" + attr.name + "':(" + attr.val + ')'; - buf.push(pair); - } - }); - - if (classes.length) { - classes = classes.join(" + ' ' + "); - buf.push('"class": ' + classes); - } - - return { - buf: buf.join(', '), - escaped: JSON.stringify(escaped), - inherits: inherits, - constant: constant - }; - } -}; - -/** - * Check if expression can be evaluated to a constant - * - * @param {String} expression - * @return {Boolean} - * @api private - */ - -function isConstant(val){ - // Check strings/literals - if (/^ *("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|true|false|null|undefined) *$/i.test(val)) - return true; - - // Check numbers - if (!isNaN(Number(val))) - return true; - - // Check arrays - var matches; - if (matches = /^ *\[(.*)\] *$/.exec(val)) - return matches[1].split(',').every(isConstant); - - return false; -} - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -function escape(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -} diff --git a/node_modules/jade/lib/doctypes.js b/node_modules/jade/lib/doctypes.js deleted file mode 100644 index e87ca1e..0000000 --- a/node_modules/jade/lib/doctypes.js +++ /dev/null @@ -1,18 +0,0 @@ - -/*! - * Jade - doctypes - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = { - '5': '' - , 'default': '' - , 'xml': '' - , 'transitional': '' - , 'strict': '' - , 'frameset': '' - , '1.1': '' - , 'basic': '' - , 'mobile': '' -}; \ No newline at end of file diff --git a/node_modules/jade/lib/filters.js b/node_modules/jade/lib/filters.js deleted file mode 100644 index d633559..0000000 --- a/node_modules/jade/lib/filters.js +++ /dev/null @@ -1,105 +0,0 @@ - -/*! - * Jade - filters - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Wrap text with CDATA block. - */ - -exports.cdata = function(str){ - return ''; -}; - -/** - * Wrap text in script tags. - */ - -exports.js = function(str){ - return ''; -}; - -/** - * Wrap text in style tags. - */ - -exports.css = function(str){ - return ''; -}; - -/** - * Transform stylus to css, wrapped in style tags. - */ - -exports.stylus = function(str, options){ - var ret; - str = str.replace(/\\n/g, '\n'); - var stylus = require('stylus'); - stylus(str, options).render(function(err, css){ - if (err) throw err; - ret = css.replace(/\n/g, '\\n'); - }); - return ''; -}; - -/** - * Transform less to css, wrapped in style tags. - */ - -exports.less = function(str){ - var ret; - str = str.replace(/\\n/g, '\n'); - require('less').render(str, function(err, css){ - if (err) throw err; - ret = ''; - }); - return ret; -}; - -/** - * Transform markdown to html. - */ - -exports.markdown = function(str){ - var md; - - // support markdown / discount - try { - md = require('markdown'); - } catch (err){ - try { - md = require('discount'); - } catch (err) { - try { - md = require('markdown-js'); - } catch (err) { - try { - md = require('marked'); - } catch (err) { - throw new - Error('Cannot find markdown library, install markdown, discount, or marked.'); - } - } - } - } - - str = str.replace(/\\n/g, '\n'); - return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,'''); -}; - -/** - * Transform coffeescript to javascript. - */ - -exports.coffeescript = function(str){ - var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n'); - return ''; -}; - -// aliases - -exports.md = exports.markdown; -exports.styl = exports.stylus; -exports.coffee = exports.coffeescript; diff --git a/node_modules/jade/lib/inline-tags.js b/node_modules/jade/lib/inline-tags.js deleted file mode 100644 index 491de0b..0000000 --- a/node_modules/jade/lib/inline-tags.js +++ /dev/null @@ -1,28 +0,0 @@ - -/*! - * Jade - inline tags - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = [ - 'a' - , 'abbr' - , 'acronym' - , 'b' - , 'br' - , 'code' - , 'em' - , 'font' - , 'i' - , 'img' - , 'ins' - , 'kbd' - , 'map' - , 'samp' - , 'small' - , 'span' - , 'strong' - , 'sub' - , 'sup' -]; \ No newline at end of file diff --git a/node_modules/jade/lib/jade.js b/node_modules/jade/lib/jade.js deleted file mode 100644 index d8330cc..0000000 --- a/node_modules/jade/lib/jade.js +++ /dev/null @@ -1,253 +0,0 @@ -/*! - * Jade - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Parser = require('./parser') - , Lexer = require('./lexer') - , Compiler = require('./compiler') - , runtime = require('./runtime') -// if node - , fs = require('fs'); -// end - -/** - * Library version. - */ - -exports.version = '0.28.2'; - -/** - * Expose self closing tags. - */ - -exports.selfClosing = require('./self-closing'); - -/** - * Default supported doctypes. - */ - -exports.doctypes = require('./doctypes'); - -/** - * Text filters. - */ - -exports.filters = require('./filters'); - -/** - * Utilities. - */ - -exports.utils = require('./utils'); - -/** - * Expose `Compiler`. - */ - -exports.Compiler = Compiler; - -/** - * Expose `Parser`. - */ - -exports.Parser = Parser; - -/** - * Expose `Lexer`. - */ - -exports.Lexer = Lexer; - -/** - * Nodes. - */ - -exports.nodes = require('./nodes'); - -/** - * Jade runtime helpers. - */ - -exports.runtime = runtime; - -/** - * Template function cache. - */ - -exports.cache = {}; - -/** - * Parse the given `str` of jade and return a function body. - * - * @param {String} str - * @param {Object} options - * @return {String} - * @api private - */ - -function parse(str, options){ - try { - // Parse - var parser = new Parser(str, options.filename, options); - - // Compile - var compiler = new (options.compiler || Compiler)(parser.parse(), options) - , js = compiler.compile(); - - // Debug compiler - if (options.debug) { - console.error('\nCompiled Function:\n\n\033[90m%s\033[0m', js.replace(/^/gm, ' ')); - } - - return '' - + 'var buf = [];\n' - + (options.self - ? 'var self = locals || {};\n' + js - : 'with (locals || {}) {\n' + js + '\n}\n') - + 'return buf.join("");'; - } catch (err) { - parser = parser.context(); - runtime.rethrow(err, parser.filename, parser.lexer.lineno); - } -} - -/** - * Strip any UTF-8 BOM off of the start of `str`, if it exists. - * - * @param {String} str - * @return {String} - * @api private - */ - -function stripBOM(str){ - return 0xFEFF == str.charCodeAt(0) - ? str.substring(1) - : str; -} - -/** - * Compile a `Function` representation of the given jade `str`. - * - * Options: - * - * - `compileDebug` when `false` debugging code is stripped from the compiled template - * - `client` when `true` the helper functions `escape()` etc will reference `jade.escape()` - * for use with the Jade client-side runtime.js - * - * @param {String} str - * @param {Options} options - * @return {Function} - * @api public - */ - -exports.compile = function(str, options){ - var options = options || {} - , client = options.client - , filename = options.filename - ? JSON.stringify(options.filename) - : 'undefined' - , fn; - - str = stripBOM(String(str)); - - if (options.compileDebug !== false) { - fn = [ - 'var __jade = [{ lineno: 1, filename: ' + filename + ' }];' - , 'try {' - , parse(str, options) - , '} catch (err) {' - , ' rethrow(err, __jade[0].filename, __jade[0].lineno);' - , '}' - ].join('\n'); - } else { - fn = parse(str, options); - } - - if (client) { - fn = 'attrs = attrs || jade.attrs; escape = escape || jade.escape; rethrow = rethrow || jade.rethrow; merge = merge || jade.merge;\n' + fn; - } - - fn = new Function('locals, attrs, escape, rethrow, merge', fn); - - if (client) return fn; - - return function(locals){ - return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow, runtime.merge); - }; -}; - -/** - * Render the given `str` of jade and invoke - * the callback `fn(err, str)`. - * - * Options: - * - * - `cache` enable template caching - * - `filename` filename required for `include` / `extends` and caching - * - * @param {String} str - * @param {Object|Function} options or fn - * @param {Function} fn - * @api public - */ - -exports.render = function(str, options, fn){ - // swap args - if ('function' == typeof options) { - fn = options, options = {}; - } - - // cache requires .filename - if (options.cache && !options.filename) { - return fn(new Error('the "filename" option is required for caching')); - } - - try { - var path = options.filename; - var tmpl = options.cache - ? exports.cache[path] || (exports.cache[path] = exports.compile(str, options)) - : exports.compile(str, options); - fn(null, tmpl(options)); - } catch (err) { - fn(err); - } -}; - -/** - * Render a Jade file at the given `path` and callback `fn(err, str)`. - * - * @param {String} path - * @param {Object|Function} options or callback - * @param {Function} fn - * @api public - */ - -exports.renderFile = function(path, options, fn){ - var key = path + ':string'; - - if ('function' == typeof options) { - fn = options, options = {}; - } - - try { - options.filename = path; - var str = options.cache - ? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8')) - : fs.readFileSync(path, 'utf8'); - exports.render(str, options, fn); - } catch (err) { - fn(err); - } -}; - -/** - * Express support. - */ - -exports.__express = exports.renderFile; diff --git a/node_modules/jade/lib/lexer.js b/node_modules/jade/lib/lexer.js deleted file mode 100644 index 1e0bfff..0000000 --- a/node_modules/jade/lib/lexer.js +++ /dev/null @@ -1,775 +0,0 @@ -/*! - * Jade - Lexer - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -var utils = require('./utils'); - -/** - * Initialize `Lexer` with the given `str`. - * - * Options: - * - * - `colons` allow colons for attr delimiters - * - * @param {String} str - * @param {Object} options - * @api private - */ - -var Lexer = module.exports = function Lexer(str, options) { - options = options || {}; - this.input = str.replace(/\r\n|\r/g, '\n'); - this.colons = options.colons; - this.deferredTokens = []; - this.lastIndents = 0; - this.lineno = 1; - this.stash = []; - this.indentStack = []; - this.indentRe = null; - this.pipeless = false; -}; - -/** - * Lexer prototype. - */ - -Lexer.prototype = { - - /** - * Construct a token with the given `type` and `val`. - * - * @param {String} type - * @param {String} val - * @return {Object} - * @api private - */ - - tok: function(type, val){ - return { - type: type - , line: this.lineno - , val: val - } - }, - - /** - * Consume the given `len` of input. - * - * @param {Number} len - * @api private - */ - - consume: function(len){ - this.input = this.input.substr(len); - }, - - /** - * Scan for `type` with the given `regexp`. - * - * @param {String} type - * @param {RegExp} regexp - * @return {Object} - * @api private - */ - - scan: function(regexp, type){ - var captures; - if (captures = regexp.exec(this.input)) { - this.consume(captures[0].length); - return this.tok(type, captures[1]); - } - }, - - /** - * Defer the given `tok`. - * - * @param {Object} tok - * @api private - */ - - defer: function(tok){ - this.deferredTokens.push(tok); - }, - - /** - * Lookahead `n` tokens. - * - * @param {Number} n - * @return {Object} - * @api private - */ - - lookahead: function(n){ - var fetch = n - this.stash.length; - while (fetch-- > 0) this.stash.push(this.next()); - return this.stash[--n]; - }, - - /** - * Return the indexOf `start` / `end` delimiters. - * - * @param {String} start - * @param {String} end - * @return {Number} - * @api private - */ - - indexOfDelimiters: function(start, end){ - var str = this.input - , nstart = 0 - , nend = 0 - , pos = 0; - for (var i = 0, len = str.length; i < len; ++i) { - if (start == str.charAt(i)) { - ++nstart; - } else if (end == str.charAt(i)) { - if (++nend == nstart) { - pos = i; - break; - } - } - } - return pos; - }, - - /** - * Stashed token. - */ - - stashed: function() { - return this.stash.length - && this.stash.shift(); - }, - - /** - * Deferred token. - */ - - deferred: function() { - return this.deferredTokens.length - && this.deferredTokens.shift(); - }, - - /** - * end-of-source. - */ - - eos: function() { - if (this.input.length) return; - if (this.indentStack.length) { - this.indentStack.shift(); - return this.tok('outdent'); - } else { - return this.tok('eos'); - } - }, - - /** - * Blank line. - */ - - blank: function() { - var captures; - if (captures = /^\n *\n/.exec(this.input)) { - this.consume(captures[0].length - 1); - ++this.lineno; - if (this.pipeless) return this.tok('text', ''); - return this.next(); - } - }, - - /** - * Comment. - */ - - comment: function() { - var captures; - if (captures = /^ *\/\/(-)?([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('comment', captures[2]); - tok.buffer = '-' != captures[1]; - return tok; - } - }, - - /** - * Interpolated tag. - */ - - interpolation: function() { - var captures; - if (captures = /^#\{(.*?)\}/.exec(this.input)) { - this.consume(captures[0].length); - return this.tok('interpolation', captures[1]); - } - }, - - /** - * Tag. - */ - - tag: function() { - var captures; - if (captures = /^(\w[-:\w]*)(\/?)/.exec(this.input)) { - this.consume(captures[0].length); - var tok, name = captures[1]; - if (':' == name[name.length - 1]) { - name = name.slice(0, -1); - tok = this.tok('tag', name); - this.defer(this.tok(':')); - while (' ' == this.input[0]) this.input = this.input.substr(1); - } else { - tok = this.tok('tag', name); - } - tok.selfClosing = !! captures[2]; - return tok; - } - }, - - /** - * Filter. - */ - - filter: function() { - return this.scan(/^:(\w+)/, 'filter'); - }, - - /** - * Doctype. - */ - - doctype: function() { - return this.scan(/^(?:!!!|doctype) *([^\n]+)?/, 'doctype'); - }, - - /** - * Id. - */ - - id: function() { - return this.scan(/^#([\w-]+)/, 'id'); - }, - - /** - * Class. - */ - - className: function() { - return this.scan(/^\.([\w-]+)/, 'class'); - }, - - /** - * Text. - */ - - text: function() { - return this.scan(/^(?:\| ?| ?)?([^\n]+)/, 'text'); - }, - - /** - * Extends. - */ - - "extends": function() { - return this.scan(/^extends? +([^\n]+)/, 'extends'); - }, - - /** - * Block prepend. - */ - - prepend: function() { - var captures; - if (captures = /^prepend +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = 'prepend' - , name = captures[1] - , tok = this.tok('block', name); - tok.mode = mode; - return tok; - } - }, - - /** - * Block append. - */ - - append: function() { - var captures; - if (captures = /^append +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = 'append' - , name = captures[1] - , tok = this.tok('block', name); - tok.mode = mode; - return tok; - } - }, - - /** - * Block. - */ - - block: function() { - var captures; - if (captures = /^block\b *(?:(prepend|append) +)?([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var mode = captures[1] || 'replace' - , name = captures[2] - , tok = this.tok('block', name); - - tok.mode = mode; - return tok; - } - }, - - /** - * Yield. - */ - - yield: function() { - return this.scan(/^yield */, 'yield'); - }, - - /** - * Include. - */ - - include: function() { - return this.scan(/^include +([^\n]+)/, 'include'); - }, - - /** - * Case. - */ - - "case": function() { - return this.scan(/^case +([^\n]+)/, 'case'); - }, - - /** - * When. - */ - - when: function() { - return this.scan(/^when +([^:\n]+)/, 'when'); - }, - - /** - * Default. - */ - - "default": function() { - return this.scan(/^default */, 'default'); - }, - - /** - * Assignment. - */ - - assignment: function() { - var captures; - if (captures = /^(\w+) += *([^;\n]+)( *;? *)/.exec(this.input)) { - this.consume(captures[0].length); - var name = captures[1] - , val = captures[2]; - return this.tok('code', 'var ' + name + ' = (' + val + ');'); - } - }, - - /** - * Call mixin. - */ - - call: function(){ - var captures; - if (captures = /^\+([-\w]+)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('call', captures[1]); - - // Check for args (not attributes) - if (captures = /^ *\((.*?)\)/.exec(this.input)) { - if (!/^ *[-\w]+ *=/.test(captures[1])) { - this.consume(captures[0].length); - tok.args = captures[1]; - } - } - - return tok; - } - }, - - /** - * Mixin. - */ - - mixin: function(){ - var captures; - if (captures = /^mixin +([-\w]+)(?: *\((.*)\))?/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('mixin', captures[1]); - tok.args = captures[2]; - return tok; - } - }, - - /** - * Conditional. - */ - - conditional: function() { - var captures; - if (captures = /^(if|unless|else if|else)\b([^\n]*)/.exec(this.input)) { - this.consume(captures[0].length); - var type = captures[1] - , js = captures[2]; - - switch (type) { - case 'if': js = 'if (' + js + ')'; break; - case 'unless': js = 'if (!(' + js + '))'; break; - case 'else if': js = 'else if (' + js + ')'; break; - case 'else': js = 'else'; break; - } - - return this.tok('code', js); - } - }, - - /** - * While. - */ - - "while": function() { - var captures; - if (captures = /^while +([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - return this.tok('code', 'while (' + captures[1] + ')'); - } - }, - - /** - * Each. - */ - - each: function() { - var captures; - if (captures = /^(?:- *)?(?:each|for) +(\w+)(?: *, *(\w+))? * in *([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var tok = this.tok('each', captures[1]); - tok.key = captures[2] || '$index'; - tok.code = captures[3]; - return tok; - } - }, - - /** - * Code. - */ - - code: function() { - var captures; - if (captures = /^(!?=|-)([^\n]+)/.exec(this.input)) { - this.consume(captures[0].length); - var flags = captures[1]; - captures[1] = captures[2]; - var tok = this.tok('code', captures[1]); - tok.escape = flags.charAt(0) === '='; - tok.buffer = flags.charAt(0) === '=' || flags.charAt(1) === '='; - return tok; - } - }, - - /** - * Attributes. - */ - - attrs: function() { - if ('(' == this.input.charAt(0)) { - var index = this.indexOfDelimiters('(', ')') - , str = this.input.substr(1, index-1) - , tok = this.tok('attrs') - , len = str.length - , colons = this.colons - , states = ['key'] - , escapedAttr - , key = '' - , val = '' - , quote - , c - , p; - - function state(){ - return states[states.length - 1]; - } - - function interpolate(attr) { - return attr.replace(/(\\)?#\{([^}]+)\}/g, function(_, escape, expr){ - return escape - ? _ - : quote + " + (" + expr + ") + " + quote; - }); - } - - this.consume(index + 1); - tok.attrs = {}; - tok.escaped = {}; - - function parse(c) { - var real = c; - // TODO: remove when people fix ":" - if (colons && ':' == c) c = '='; - switch (c) { - case ',': - case '\n': - switch (state()) { - case 'expr': - case 'array': - case 'string': - case 'object': - val += c; - break; - default: - states.push('key'); - val = val.trim(); - key = key.trim(); - if ('' == key) return; - key = key.replace(/^['"]|['"]$/g, '').replace('!', ''); - tok.escaped[key] = escapedAttr; - tok.attrs[key] = '' == val - ? true - : interpolate(val); - key = val = ''; - } - break; - case '=': - switch (state()) { - case 'key char': - key += real; - break; - case 'val': - case 'expr': - case 'array': - case 'string': - case 'object': - val += real; - break; - default: - escapedAttr = '!' != p; - states.push('val'); - } - break; - case '(': - if ('val' == state() - || 'expr' == state()) states.push('expr'); - val += c; - break; - case ')': - if ('expr' == state() - || 'val' == state()) states.pop(); - val += c; - break; - case '{': - if ('val' == state()) states.push('object'); - val += c; - break; - case '}': - if ('object' == state()) states.pop(); - val += c; - break; - case '[': - if ('val' == state()) states.push('array'); - val += c; - break; - case ']': - if ('array' == state()) states.pop(); - val += c; - break; - case '"': - case "'": - switch (state()) { - case 'key': - states.push('key char'); - break; - case 'key char': - states.pop(); - break; - case 'string': - if (c == quote) states.pop(); - val += c; - break; - default: - states.push('string'); - val += c; - quote = c; - } - break; - case '': - break; - default: - switch (state()) { - case 'key': - case 'key char': - key += c; - break; - default: - val += c; - } - } - p = c; - } - - for (var i = 0; i < len; ++i) { - parse(str.charAt(i)); - } - - parse(','); - - if ('/' == this.input.charAt(0)) { - this.consume(1); - tok.selfClosing = true; - } - - return tok; - } - }, - - /** - * Indent | Outdent | Newline. - */ - - indent: function() { - var captures, re; - - // established regexp - if (this.indentRe) { - captures = this.indentRe.exec(this.input); - // determine regexp - } else { - // tabs - re = /^\n(\t*) */; - captures = re.exec(this.input); - - // spaces - if (captures && !captures[1].length) { - re = /^\n( *)/; - captures = re.exec(this.input); - } - - // established - if (captures && captures[1].length) this.indentRe = re; - } - - if (captures) { - var tok - , indents = captures[1].length; - - ++this.lineno; - this.consume(indents + 1); - - if (' ' == this.input[0] || '\t' == this.input[0]) { - throw new Error('Invalid indentation, you can use tabs or spaces but not both'); - } - - // blank line - if ('\n' == this.input[0]) return this.tok('newline'); - - // outdent - if (this.indentStack.length && indents < this.indentStack[0]) { - while (this.indentStack.length && this.indentStack[0] > indents) { - this.stash.push(this.tok('outdent')); - this.indentStack.shift(); - } - tok = this.stash.pop(); - // indent - } else if (indents && indents != this.indentStack[0]) { - this.indentStack.unshift(indents); - tok = this.tok('indent', indents); - // newline - } else { - tok = this.tok('newline'); - } - - return tok; - } - }, - - /** - * Pipe-less text consumed only when - * pipeless is true; - */ - - pipelessText: function() { - if (this.pipeless) { - if ('\n' == this.input[0]) return; - var i = this.input.indexOf('\n'); - if (-1 == i) i = this.input.length; - var str = this.input.substr(0, i); - this.consume(str.length); - return this.tok('text', str); - } - }, - - /** - * ':' - */ - - colon: function() { - return this.scan(/^: */, ':'); - }, - - /** - * Return the next token object, or those - * previously stashed by lookahead. - * - * @return {Object} - * @api private - */ - - advance: function(){ - return this.stashed() - || this.next(); - }, - - /** - * Return the next token object. - * - * @return {Object} - * @api private - */ - - next: function() { - return this.deferred() - || this.blank() - || this.eos() - || this.pipelessText() - || this.yield() - || this.doctype() - || this.interpolation() - || this["case"]() - || this.when() - || this["default"]() - || this["extends"]() - || this.append() - || this.prepend() - || this.block() - || this.include() - || this.mixin() - || this.call() - || this.conditional() - || this.each() - || this["while"]() - || this.assignment() - || this.tag() - || this.filter() - || this.code() - || this.id() - || this.className() - || this.attrs() - || this.indent() - || this.comment() - || this.colon() - || this.text(); - } -}; diff --git a/node_modules/jade/lib/nodes/attrs.js b/node_modules/jade/lib/nodes/attrs.js deleted file mode 100644 index 5de9b59..0000000 --- a/node_modules/jade/lib/nodes/attrs.js +++ /dev/null @@ -1,77 +0,0 @@ - -/*! - * Jade - nodes - Attrs - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'), - Block = require('./block'); - -/** - * Initialize a `Attrs` node. - * - * @api public - */ - -var Attrs = module.exports = function Attrs() { - this.attrs = []; -}; - -/** - * Inherit from `Node`. - */ - -Attrs.prototype.__proto__ = Node.prototype; - -/** - * Set attribute `name` to `val`, keep in mind these become - * part of a raw js object literal, so to quote a value you must - * '"quote me"', otherwise or example 'user.name' is literal JavaScript. - * - * @param {String} name - * @param {String} val - * @param {Boolean} escaped - * @return {Tag} for chaining - * @api public - */ - -Attrs.prototype.setAttribute = function(name, val, escaped){ - this.attrs.push({ name: name, val: val, escaped: escaped }); - return this; -}; - -/** - * Remove attribute `name` when present. - * - * @param {String} name - * @api public - */ - -Attrs.prototype.removeAttribute = function(name){ - for (var i = 0, len = this.attrs.length; i < len; ++i) { - if (this.attrs[i] && this.attrs[i].name == name) { - delete this.attrs[i]; - } - } -}; - -/** - * Get attribute value by `name`. - * - * @param {String} name - * @return {String} - * @api public - */ - -Attrs.prototype.getAttribute = function(name){ - for (var i = 0, len = this.attrs.length; i < len; ++i) { - if (this.attrs[i] && this.attrs[i].name == name) { - return this.attrs[i].val; - } - } -}; diff --git a/node_modules/jade/lib/nodes/block-comment.js b/node_modules/jade/lib/nodes/block-comment.js deleted file mode 100644 index 4f41e4a..0000000 --- a/node_modules/jade/lib/nodes/block-comment.js +++ /dev/null @@ -1,33 +0,0 @@ - -/*! - * Jade - nodes - BlockComment - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `BlockComment` with the given `block`. - * - * @param {String} val - * @param {Block} block - * @param {Boolean} buffer - * @api public - */ - -var BlockComment = module.exports = function BlockComment(val, block, buffer) { - this.block = block; - this.val = val; - this.buffer = buffer; -}; - -/** - * Inherit from `Node`. - */ - -BlockComment.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/block.js b/node_modules/jade/lib/nodes/block.js deleted file mode 100644 index 6bb18c9..0000000 --- a/node_modules/jade/lib/nodes/block.js +++ /dev/null @@ -1,122 +0,0 @@ - -/*! - * Jade - nodes - Block - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Block` with an optional `node`. - * - * @param {Node} node - * @api public - */ - -var Block = module.exports = function Block(node){ - this.nodes = []; - if (node) this.push(node); -}; - -/** - * Inherit from `Node`. - */ - -Block.prototype.__proto__ = Node.prototype; - -/** - * Block flag. - */ - -Block.prototype.isBlock = true; - -/** - * Replace the nodes in `other` with the nodes - * in `this` block. - * - * @param {Block} other - * @api private - */ - -Block.prototype.replace = function(other){ - other.nodes = this.nodes; -}; - -/** - * Pust the given `node`. - * - * @param {Node} node - * @return {Number} - * @api public - */ - -Block.prototype.push = function(node){ - return this.nodes.push(node); -}; - -/** - * Check if this block is empty. - * - * @return {Boolean} - * @api public - */ - -Block.prototype.isEmpty = function(){ - return 0 == this.nodes.length; -}; - -/** - * Unshift the given `node`. - * - * @param {Node} node - * @return {Number} - * @api public - */ - -Block.prototype.unshift = function(node){ - return this.nodes.unshift(node); -}; - -/** - * Return the "last" block, or the first `yield` node. - * - * @return {Block} - * @api private - */ - -Block.prototype.includeBlock = function(){ - var ret = this - , node; - - for (var i = 0, len = this.nodes.length; i < len; ++i) { - node = this.nodes[i]; - if (node.yield) return node; - else if (node.textOnly) continue; - else if (node.includeBlock) ret = node.includeBlock(); - else if (node.block && !node.block.isEmpty()) ret = node.block.includeBlock(); - if (ret.yield) return ret; - } - - return ret; -}; - -/** - * Return a clone of this block. - * - * @return {Block} - * @api private - */ - -Block.prototype.clone = function(){ - var clone = new Block; - for (var i = 0, len = this.nodes.length; i < len; ++i) { - clone.push(this.nodes[i].clone()); - } - return clone; -}; - diff --git a/node_modules/jade/lib/nodes/case.js b/node_modules/jade/lib/nodes/case.js deleted file mode 100644 index 08ff033..0000000 --- a/node_modules/jade/lib/nodes/case.js +++ /dev/null @@ -1,43 +0,0 @@ - -/*! - * Jade - nodes - Case - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a new `Case` with `expr`. - * - * @param {String} expr - * @api public - */ - -var Case = exports = module.exports = function Case(expr, block){ - this.expr = expr; - this.block = block; -}; - -/** - * Inherit from `Node`. - */ - -Case.prototype.__proto__ = Node.prototype; - -var When = exports.When = function When(expr, block){ - this.expr = expr; - this.block = block; - this.debug = false; -}; - -/** - * Inherit from `Node`. - */ - -When.prototype.__proto__ = Node.prototype; - diff --git a/node_modules/jade/lib/nodes/code.js b/node_modules/jade/lib/nodes/code.js deleted file mode 100644 index babc675..0000000 --- a/node_modules/jade/lib/nodes/code.js +++ /dev/null @@ -1,35 +0,0 @@ - -/*! - * Jade - nodes - Code - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Code` node with the given code `val`. - * Code may also be optionally buffered and escaped. - * - * @param {String} val - * @param {Boolean} buffer - * @param {Boolean} escape - * @api public - */ - -var Code = module.exports = function Code(val, buffer, escape) { - this.val = val; - this.buffer = buffer; - this.escape = escape; - if (val.match(/^ *else/)) this.debug = false; -}; - -/** - * Inherit from `Node`. - */ - -Code.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/comment.js b/node_modules/jade/lib/nodes/comment.js deleted file mode 100644 index 2e1469e..0000000 --- a/node_modules/jade/lib/nodes/comment.js +++ /dev/null @@ -1,32 +0,0 @@ - -/*! - * Jade - nodes - Comment - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Comment` with the given `val`, optionally `buffer`, - * otherwise the comment may render in the output. - * - * @param {String} val - * @param {Boolean} buffer - * @api public - */ - -var Comment = module.exports = function Comment(val, buffer) { - this.val = val; - this.buffer = buffer; -}; - -/** - * Inherit from `Node`. - */ - -Comment.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/doctype.js b/node_modules/jade/lib/nodes/doctype.js deleted file mode 100644 index b8f33e5..0000000 --- a/node_modules/jade/lib/nodes/doctype.js +++ /dev/null @@ -1,29 +0,0 @@ - -/*! - * Jade - nodes - Doctype - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Doctype` with the given `val`. - * - * @param {String} val - * @api public - */ - -var Doctype = module.exports = function Doctype(val) { - this.val = val; -}; - -/** - * Inherit from `Node`. - */ - -Doctype.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/each.js b/node_modules/jade/lib/nodes/each.js deleted file mode 100644 index f54101f..0000000 --- a/node_modules/jade/lib/nodes/each.js +++ /dev/null @@ -1,35 +0,0 @@ - -/*! - * Jade - nodes - Each - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize an `Each` node, representing iteration - * - * @param {String} obj - * @param {String} val - * @param {String} key - * @param {Block} block - * @api public - */ - -var Each = module.exports = function Each(obj, val, key, block) { - this.obj = obj; - this.val = val; - this.key = key; - this.block = block; -}; - -/** - * Inherit from `Node`. - */ - -Each.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/filter.js b/node_modules/jade/lib/nodes/filter.js deleted file mode 100644 index 0d7ff6e..0000000 --- a/node_modules/jade/lib/nodes/filter.js +++ /dev/null @@ -1,34 +0,0 @@ - -/*! - * Jade - nodes - Filter - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node') - , Block = require('./block'); - -/** - * Initialize a `Filter` node with the given - * filter `name` and `block`. - * - * @param {String} name - * @param {Block|Node} block - * @api public - */ - -var Filter = module.exports = function Filter(name, block, attrs) { - this.name = name; - this.block = block; - this.attrs = attrs; -}; - -/** - * Inherit from `Node`. - */ - -Filter.prototype.__proto__ = Node.prototype; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/index.js b/node_modules/jade/lib/nodes/index.js deleted file mode 100644 index 386ad2f..0000000 --- a/node_modules/jade/lib/nodes/index.js +++ /dev/null @@ -1,20 +0,0 @@ - -/*! - * Jade - nodes - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -exports.Node = require('./node'); -exports.Tag = require('./tag'); -exports.Code = require('./code'); -exports.Each = require('./each'); -exports.Case = require('./case'); -exports.Text = require('./text'); -exports.Block = require('./block'); -exports.Mixin = require('./mixin'); -exports.Filter = require('./filter'); -exports.Comment = require('./comment'); -exports.Literal = require('./literal'); -exports.BlockComment = require('./block-comment'); -exports.Doctype = require('./doctype'); diff --git a/node_modules/jade/lib/nodes/literal.js b/node_modules/jade/lib/nodes/literal.js deleted file mode 100644 index fde586b..0000000 --- a/node_modules/jade/lib/nodes/literal.js +++ /dev/null @@ -1,32 +0,0 @@ - -/*! - * Jade - nodes - Literal - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Literal` node with the given `str. - * - * @param {String} str - * @api public - */ - -var Literal = module.exports = function Literal(str) { - this.str = str - .replace(/\\/g, "\\\\") - .replace(/\n|\r\n/g, "\\n") - .replace(/'/g, "\\'"); -}; - -/** - * Inherit from `Node`. - */ - -Literal.prototype.__proto__ = Node.prototype; diff --git a/node_modules/jade/lib/nodes/mixin.js b/node_modules/jade/lib/nodes/mixin.js deleted file mode 100644 index 8407bc7..0000000 --- a/node_modules/jade/lib/nodes/mixin.js +++ /dev/null @@ -1,36 +0,0 @@ - -/*! - * Jade - nodes - Mixin - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Attrs = require('./attrs'); - -/** - * Initialize a new `Mixin` with `name` and `block`. - * - * @param {String} name - * @param {String} args - * @param {Block} block - * @api public - */ - -var Mixin = module.exports = function Mixin(name, args, block, call){ - this.name = name; - this.args = args; - this.block = block; - this.attrs = []; - this.call = call; -}; - -/** - * Inherit from `Attrs`. - */ - -Mixin.prototype.__proto__ = Attrs.prototype; - diff --git a/node_modules/jade/lib/nodes/node.js b/node_modules/jade/lib/nodes/node.js deleted file mode 100644 index e98f042..0000000 --- a/node_modules/jade/lib/nodes/node.js +++ /dev/null @@ -1,25 +0,0 @@ - -/*! - * Jade - nodes - Node - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Initialize a `Node`. - * - * @api public - */ - -var Node = module.exports = function Node(){}; - -/** - * Clone this node (return itself) - * - * @return {Node} - * @api private - */ - -Node.prototype.clone = function(){ - return this; -}; diff --git a/node_modules/jade/lib/nodes/tag.js b/node_modules/jade/lib/nodes/tag.js deleted file mode 100644 index 4b6728a..0000000 --- a/node_modules/jade/lib/nodes/tag.js +++ /dev/null @@ -1,95 +0,0 @@ - -/*! - * Jade - nodes - Tag - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Attrs = require('./attrs'), - Block = require('./block'), - inlineTags = require('../inline-tags'); - -/** - * Initialize a `Tag` node with the given tag `name` and optional `block`. - * - * @param {String} name - * @param {Block} block - * @api public - */ - -var Tag = module.exports = function Tag(name, block) { - this.name = name; - this.attrs = []; - this.block = block || new Block; -}; - -/** - * Inherit from `Attrs`. - */ - -Tag.prototype.__proto__ = Attrs.prototype; - -/** - * Clone this tag. - * - * @return {Tag} - * @api private - */ - -Tag.prototype.clone = function(){ - var clone = new Tag(this.name, this.block.clone()); - clone.line = this.line; - clone.attrs = this.attrs; - clone.textOnly = this.textOnly; - return clone; -}; - -/** - * Check if this tag is an inline tag. - * - * @return {Boolean} - * @api private - */ - -Tag.prototype.isInline = function(){ - return ~inlineTags.indexOf(this.name); -}; - -/** - * Check if this tag's contents can be inlined. Used for pretty printing. - * - * @return {Boolean} - * @api private - */ - -Tag.prototype.canInline = function(){ - var nodes = this.block.nodes; - - function isInline(node){ - // Recurse if the node is a block - if (node.isBlock) return node.nodes.every(isInline); - return node.isText || (node.isInline && node.isInline()); - } - - // Empty tag - if (!nodes.length) return true; - - // Text-only or inline-only tag - if (1 == nodes.length) return isInline(nodes[0]); - - // Multi-line inline-only tag - if (this.block.nodes.every(isInline)) { - for (var i = 1, len = nodes.length; i < len; ++i) { - if (nodes[i-1].isText && nodes[i].isText) - return false; - } - return true; - } - - // Mixed tag - return false; -}; \ No newline at end of file diff --git a/node_modules/jade/lib/nodes/text.js b/node_modules/jade/lib/nodes/text.js deleted file mode 100644 index 3b5dd55..0000000 --- a/node_modules/jade/lib/nodes/text.js +++ /dev/null @@ -1,36 +0,0 @@ - -/*! - * Jade - nodes - Text - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Node = require('./node'); - -/** - * Initialize a `Text` node with optional `line`. - * - * @param {String} line - * @api public - */ - -var Text = module.exports = function Text(line) { - this.val = ''; - if ('string' == typeof line) this.val = line; -}; - -/** - * Inherit from `Node`. - */ - -Text.prototype.__proto__ = Node.prototype; - -/** - * Flag as text. - */ - -Text.prototype.isText = true; \ No newline at end of file diff --git a/node_modules/jade/lib/parser.js b/node_modules/jade/lib/parser.js deleted file mode 100644 index f8c929f..0000000 --- a/node_modules/jade/lib/parser.js +++ /dev/null @@ -1,699 +0,0 @@ -/*! - * Jade - Parser - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Lexer = require('./lexer') - , nodes = require('./nodes') - , utils = require('./utils') - , filters = require('./filters') - , path = require('path') - , extname = path.extname; - -/** - * Initialize `Parser` with the given input `str` and `filename`. - * - * @param {String} str - * @param {String} filename - * @param {Object} options - * @api public - */ - -var Parser = exports = module.exports = function Parser(str, filename, options){ - this.input = str; - this.lexer = new Lexer(str, options); - this.filename = filename; - this.blocks = {}; - this.mixins = {}; - this.options = options; - this.contexts = [this]; -}; - -/** - * Tags that may not contain tags. - */ - -var textOnly = exports.textOnly = ['script', 'style']; - -/** - * Parser prototype. - */ - -Parser.prototype = { - - /** - * Push `parser` onto the context stack, - * or pop and return a `Parser`. - */ - - context: function(parser){ - if (parser) { - this.contexts.push(parser); - } else { - return this.contexts.pop(); - } - }, - - /** - * Return the next token object. - * - * @return {Object} - * @api private - */ - - advance: function(){ - return this.lexer.advance(); - }, - - /** - * Skip `n` tokens. - * - * @param {Number} n - * @api private - */ - - skip: function(n){ - while (n--) this.advance(); - }, - - /** - * Single token lookahead. - * - * @return {Object} - * @api private - */ - - peek: function() { - return this.lookahead(1); - }, - - /** - * Return lexer lineno. - * - * @return {Number} - * @api private - */ - - line: function() { - return this.lexer.lineno; - }, - - /** - * `n` token lookahead. - * - * @param {Number} n - * @return {Object} - * @api private - */ - - lookahead: function(n){ - return this.lexer.lookahead(n); - }, - - /** - * Parse input returning a string of js for evaluation. - * - * @return {String} - * @api public - */ - - parse: function(){ - var block = new nodes.Block, parser; - block.line = this.line(); - - while ('eos' != this.peek().type) { - if ('newline' == this.peek().type) { - this.advance(); - } else { - block.push(this.parseExpr()); - } - } - - if (parser = this.extending) { - this.context(parser); - var ast = parser.parse(); - this.context(); - // hoist mixins - for (var name in this.mixins) - ast.unshift(this.mixins[name]); - return ast; - } - - return block; - }, - - /** - * Expect the given type, or throw an exception. - * - * @param {String} type - * @api private - */ - - expect: function(type){ - if (this.peek().type === type) { - return this.advance(); - } else { - throw new Error('expected "' + type + '", but got "' + this.peek().type + '"'); - } - }, - - /** - * Accept the given `type`. - * - * @param {String} type - * @api private - */ - - accept: function(type){ - if (this.peek().type === type) { - return this.advance(); - } - }, - - /** - * tag - * | doctype - * | mixin - * | include - * | filter - * | comment - * | text - * | each - * | code - * | yield - * | id - * | class - * | interpolation - */ - - parseExpr: function(){ - switch (this.peek().type) { - case 'tag': - return this.parseTag(); - case 'mixin': - return this.parseMixin(); - case 'block': - return this.parseBlock(); - case 'case': - return this.parseCase(); - case 'when': - return this.parseWhen(); - case 'default': - return this.parseDefault(); - case 'extends': - return this.parseExtends(); - case 'include': - return this.parseInclude(); - case 'doctype': - return this.parseDoctype(); - case 'filter': - return this.parseFilter(); - case 'comment': - return this.parseComment(); - case 'text': - return this.parseText(); - case 'each': - return this.parseEach(); - case 'code': - return this.parseCode(); - case 'call': - return this.parseCall(); - case 'interpolation': - return this.parseInterpolation(); - case 'yield': - this.advance(); - var block = new nodes.Block; - block.yield = true; - return block; - case 'id': - case 'class': - var tok = this.advance(); - this.lexer.defer(this.lexer.tok('tag', 'div')); - this.lexer.defer(tok); - return this.parseExpr(); - default: - throw new Error('unexpected token "' + this.peek().type + '"'); - } - }, - - /** - * Text - */ - - parseText: function(){ - var tok = this.expect('text'); - var node = new nodes.Text(tok.val); - node.line = this.line(); - return node; - }, - - /** - * ':' expr - * | block - */ - - parseBlockExpansion: function(){ - if (':' == this.peek().type) { - this.advance(); - return new nodes.Block(this.parseExpr()); - } else { - return this.block(); - } - }, - - /** - * case - */ - - parseCase: function(){ - var val = this.expect('case').val; - var node = new nodes.Case(val); - node.line = this.line(); - node.block = this.block(); - return node; - }, - - /** - * when - */ - - parseWhen: function(){ - var val = this.expect('when').val - return new nodes.Case.When(val, this.parseBlockExpansion()); - }, - - /** - * default - */ - - parseDefault: function(){ - this.expect('default'); - return new nodes.Case.When('default', this.parseBlockExpansion()); - }, - - /** - * code - */ - - parseCode: function(){ - var tok = this.expect('code'); - var node = new nodes.Code(tok.val, tok.buffer, tok.escape); - var block; - var i = 1; - node.line = this.line(); - while (this.lookahead(i) && 'newline' == this.lookahead(i).type) ++i; - block = 'indent' == this.lookahead(i).type; - if (block) { - this.skip(i-1); - node.block = this.block(); - } - return node; - }, - - /** - * comment - */ - - parseComment: function(){ - var tok = this.expect('comment'); - var node; - - if ('indent' == this.peek().type) { - node = new nodes.BlockComment(tok.val, this.block(), tok.buffer); - } else { - node = new nodes.Comment(tok.val, tok.buffer); - } - - node.line = this.line(); - return node; - }, - - /** - * doctype - */ - - parseDoctype: function(){ - var tok = this.expect('doctype'); - var node = new nodes.Doctype(tok.val); - node.line = this.line(); - return node; - }, - - /** - * filter attrs? text-block - */ - - parseFilter: function(){ - var tok = this.expect('filter'); - var attrs = this.accept('attrs'); - var block; - - this.lexer.pipeless = true; - block = this.parseTextBlock(); - this.lexer.pipeless = false; - - var node = new nodes.Filter(tok.val, block, attrs && attrs.attrs); - node.line = this.line(); - return node; - }, - - /** - * each block - */ - - parseEach: function(){ - var tok = this.expect('each'); - var node = new nodes.Each(tok.code, tok.val, tok.key); - node.line = this.line(); - node.block = this.block(); - if (this.peek().type == 'code' && this.peek().val == 'else') { - this.advance(); - node.alternative = this.block(); - } - return node; - }, - - /** - * 'extends' name - */ - - parseExtends: function(){ - var path = require('path'); - var fs = require('fs'); - var dirname = path.dirname; - var basename = path.basename; - var join = path.join; - - if (!this.filename) - throw new Error('the "filename" option is required to extend templates'); - - path = this.expect('extends').val.trim(); - var dir = dirname(this.filename); - - path = join(dir, path + '.jade'); - var str = fs.readFileSync(path, 'utf8'); - var parser = new Parser(str, path, this.options); - - parser.blocks = this.blocks; - parser.contexts = this.contexts; - this.extending = parser; - - // TODO: null node - return new nodes.Literal(''); - }, - - /** - * 'block' name block - */ - - parseBlock: function(){ - var block = this.expect('block'); - var mode = block.mode; - var name = block.val.trim(); - - block = 'indent' == this.peek().type - ? this.block() - : new nodes.Block(new nodes.Literal('')); - - var prev = this.blocks[name]; - - if (prev) { - switch (prev.mode) { - case 'append': - block.nodes = block.nodes.concat(prev.nodes); - prev = block; - break; - case 'prepend': - block.nodes = prev.nodes.concat(block.nodes); - prev = block; - break; - } - } - - block.mode = mode; - return this.blocks[name] = prev || block; - }, - - /** - * include block? - */ - - parseInclude: function(){ - var path = require('path'); - var fs = require('fs'); - var dirname = path.dirname; - var basename = path.basename; - var join = path.join; - var str; - - path = this.expect('include').val.trim(); - var dir = dirname(this.filename); - - if (!this.filename) - throw new Error('the "filename" option is required to use includes'); - - // no extension - if (!~basename(path).indexOf('.')) { - path += '.jade'; - } - - // non-jade - if ('.jade' != path.substr(-5)) { - path = join(dir, path); - str = fs.readFileSync(path, 'utf8').replace(/\r/g, ''); - var ext = extname(path).slice(1); - var filter = filters[ext]; - if (filter) str = filter(str, { filename: path }).replace(/\\n/g, '\n'); - return new nodes.Literal(str); - } - - path = join(dir, path); - str = fs.readFileSync(path, 'utf8'); - var parser = new Parser(str, path, this.options); - parser.blocks = utils.merge({}, this.blocks); - parser.mixins = this.mixins; - - this.context(parser); - var ast = parser.parse(); - this.context(); - ast.filename = path; - - if ('indent' == this.peek().type) { - ast.includeBlock().push(this.block()); - } - - return ast; - }, - - /** - * call ident block - */ - - parseCall: function(){ - var tok = this.expect('call'); - var name = tok.val; - var args = tok.args; - var mixin = new nodes.Mixin(name, args, new nodes.Block, true); - - this.tag(mixin); - if (mixin.block.isEmpty()) mixin.block = null; - return mixin; - }, - - /** - * mixin block - */ - - parseMixin: function(){ - var tok = this.expect('mixin'); - var name = tok.val; - var args = tok.args; - var mixin; - - // definition - if ('indent' == this.peek().type) { - mixin = new nodes.Mixin(name, args, this.block(), false); - this.mixins[name] = mixin; - return mixin; - // call - } else { - return new nodes.Mixin(name, args, null, true); - } - }, - - /** - * indent (text | newline)* outdent - */ - - parseTextBlock: function(){ - var block = new nodes.Block; - block.line = this.line(); - var spaces = this.expect('indent').val; - if (null == this._spaces) this._spaces = spaces; - var indent = Array(spaces - this._spaces + 1).join(' '); - while ('outdent' != this.peek().type) { - switch (this.peek().type) { - case 'newline': - this.advance(); - break; - case 'indent': - this.parseTextBlock().nodes.forEach(function(node){ - block.push(node); - }); - break; - default: - var text = new nodes.Text(indent + this.advance().val); - text.line = this.line(); - block.push(text); - } - } - - if (spaces == this._spaces) this._spaces = null; - this.expect('outdent'); - return block; - }, - - /** - * indent expr* outdent - */ - - block: function(){ - var block = new nodes.Block; - block.line = this.line(); - this.expect('indent'); - while ('outdent' != this.peek().type) { - if ('newline' == this.peek().type) { - this.advance(); - } else { - block.push(this.parseExpr()); - } - } - this.expect('outdent'); - return block; - }, - - /** - * interpolation (attrs | class | id)* (text | code | ':')? newline* block? - */ - - parseInterpolation: function(){ - var tok = this.advance(); - var tag = new nodes.Tag(tok.val); - tag.buffer = true; - return this.tag(tag); - }, - - /** - * tag (attrs | class | id)* (text | code | ':')? newline* block? - */ - - parseTag: function(){ - // ast-filter look-ahead - var i = 2; - if ('attrs' == this.lookahead(i).type) ++i; - - var tok = this.advance(); - var tag = new nodes.Tag(tok.val); - - tag.selfClosing = tok.selfClosing; - - return this.tag(tag); - }, - - /** - * Parse tag. - */ - - tag: function(tag){ - var dot; - - tag.line = this.line(); - - // (attrs | class | id)* - out: - while (true) { - switch (this.peek().type) { - case 'id': - case 'class': - var tok = this.advance(); - tag.setAttribute(tok.type, "'" + tok.val + "'"); - continue; - case 'attrs': - var tok = this.advance() - , obj = tok.attrs - , escaped = tok.escaped - , names = Object.keys(obj); - - if (tok.selfClosing) tag.selfClosing = true; - - for (var i = 0, len = names.length; i < len; ++i) { - var name = names[i] - , val = obj[name]; - tag.setAttribute(name, val, escaped[name]); - } - continue; - default: - break out; - } - } - - // check immediate '.' - if ('.' == this.peek().val) { - dot = tag.textOnly = true; - this.advance(); - } - - // (text | code | ':')? - switch (this.peek().type) { - case 'text': - tag.block.push(this.parseText()); - break; - case 'code': - tag.code = this.parseCode(); - break; - case ':': - this.advance(); - tag.block = new nodes.Block; - tag.block.push(this.parseExpr()); - break; - } - - // newline* - while ('newline' == this.peek().type) this.advance(); - - tag.textOnly = tag.textOnly || ~textOnly.indexOf(tag.name); - - // script special-case - if ('script' == tag.name) { - var type = tag.getAttribute('type'); - if (!dot && type && 'text/javascript' != type.replace(/^['"]|['"]$/g, '')) { - tag.textOnly = false; - } - } - - // block? - if ('indent' == this.peek().type) { - if (tag.textOnly) { - this.lexer.pipeless = true; - tag.block = this.parseTextBlock(); - this.lexer.pipeless = false; - } else { - var block = this.block(); - if (tag.block) { - for (var i = 0, len = block.nodes.length; i < len; ++i) { - tag.block.push(block.nodes[i]); - } - } else { - tag.block = block; - } - } - } - - return tag; - } -}; diff --git a/node_modules/jade/lib/runtime.js b/node_modules/jade/lib/runtime.js deleted file mode 100644 index fb711f5..0000000 --- a/node_modules/jade/lib/runtime.js +++ /dev/null @@ -1,174 +0,0 @@ - -/*! - * Jade - runtime - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Lame Array.isArray() polyfill for now. - */ - -if (!Array.isArray) { - Array.isArray = function(arr){ - return '[object Array]' == Object.prototype.toString.call(arr); - }; -} - -/** - * Lame Object.keys() polyfill for now. - */ - -if (!Object.keys) { - Object.keys = function(obj){ - var arr = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - arr.push(key); - } - } - return arr; - } -} - -/** - * Merge two attribute objects giving precedence - * to values in object `b`. Classes are special-cased - * allowing for arrays and merging/joining appropriately - * resulting in a string. - * - * @param {Object} a - * @param {Object} b - * @return {Object} a - * @api private - */ - -exports.merge = function merge(a, b) { - var ac = a['class']; - var bc = b['class']; - - if (ac || bc) { - ac = ac || []; - bc = bc || []; - if (!Array.isArray(ac)) ac = [ac]; - if (!Array.isArray(bc)) bc = [bc]; - ac = ac.filter(nulls); - bc = bc.filter(nulls); - a['class'] = ac.concat(bc).join(' '); - } - - for (var key in b) { - if (key != 'class') { - a[key] = b[key]; - } - } - - return a; -}; - -/** - * Filter null `val`s. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function nulls(val) { - return val != null; -} - -/** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - * @api private - */ - -exports.attrs = function attrs(obj, escaped){ - var buf = [] - , terse = obj.terse; - - delete obj.terse; - var keys = Object.keys(obj) - , len = keys.length; - - if (len) { - buf.push(''); - for (var i = 0; i < len; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('boolean' == typeof val || null == val) { - if (val) { - terse - ? buf.push(key) - : buf.push(key + '="' + key + '"'); - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - buf.push(key + "='" + JSON.stringify(val) + "'"); - } else if ('class' == key && Array.isArray(val)) { - buf.push(key + '="' + exports.escape(val.join(' ')) + '"'); - } else if (escaped && escaped[key]) { - buf.push(key + '="' + exports.escape(val) + '"'); - } else { - buf.push(key + '="' + val + '"'); - } - } - } - - return buf.join(' '); -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function escape(html){ - return String(html) - .replace(/&(?!(\w+|\#\d+);)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - -/** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - -exports.rethrow = function rethrow(err, filename, lineno){ - if (!filename) throw err; - - var context = 3 - , str = require('fs').readFileSync(filename, 'utf8') - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // Error context - var context = lines.slice(start, end).map(function(line, i){ - var curr = i + start + 1; - return (curr == lineno ? ' > ' : ' ') - + curr - + '| ' - + line; - }).join('\n'); - - // Alter exception message - err.path = filename; - err.message = (filename || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; -}; diff --git a/node_modules/jade/lib/self-closing.js b/node_modules/jade/lib/self-closing.js deleted file mode 100644 index 0548771..0000000 --- a/node_modules/jade/lib/self-closing.js +++ /dev/null @@ -1,19 +0,0 @@ - -/*! - * Jade - self closing tags - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -module.exports = [ - 'meta' - , 'img' - , 'link' - , 'input' - , 'source' - , 'area' - , 'base' - , 'col' - , 'br' - , 'hr' -]; \ No newline at end of file diff --git a/node_modules/jade/lib/utils.js b/node_modules/jade/lib/utils.js deleted file mode 100644 index ca4a7fa..0000000 --- a/node_modules/jade/lib/utils.js +++ /dev/null @@ -1,68 +0,0 @@ - -/*! - * Jade - utils - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Convert interpolation in the given string to JavaScript. - * - * @param {String} str - * @return {String} - * @api private - */ - -var interpolate = exports.interpolate = function(str){ - return str.replace(/(_SLASH_)?([#!]){(.*?)}/g, function(str, escape, flag, code){ - code = code - .replace(/\\'/g, "'") - .replace(/_SLASH_/g, '\\'); - - return escape - ? str.slice(7) - : "' + " - + ('!' == flag ? '' : 'escape') - + "((interp = " + code - + ") == null ? '' : interp) + '"; - }); -}; - -/** - * Escape single quotes in `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -var escape = exports.escape = function(str) { - return str.replace(/'/g, "\\'"); -}; - -/** - * Interpolate, and escape the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.text = function(str){ - return interpolate(escape(str)); -}; - -/** - * Merge `b` into `a`. - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api public - */ - -exports.merge = function(a, b) { - for (var key in b) a[key] = b[key]; - return a; -}; - diff --git a/node_modules/jade/node_modules/commander/.npmignore b/node_modules/jade/node_modules/commander/.npmignore deleted file mode 100644 index f1250e5..0000000 --- a/node_modules/jade/node_modules/commander/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/node_modules/jade/node_modules/commander/.travis.yml b/node_modules/jade/node_modules/commander/.travis.yml deleted file mode 100644 index f1d0f13..0000000 --- a/node_modules/jade/node_modules/commander/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/node_modules/jade/node_modules/commander/History.md b/node_modules/jade/node_modules/commander/History.md deleted file mode 100644 index 4961d2e..0000000 --- a/node_modules/jade/node_modules/commander/History.md +++ /dev/null @@ -1,107 +0,0 @@ - -0.6.1 / 2012-06-01 -================== - - * Added: append (yes or no) on confirmation - * Added: allow node.js v0.7.x - -0.6.0 / 2012-04-10 -================== - - * Added `.prompt(obj, callback)` support. Closes #49 - * Added default support to .choose(). Closes #41 - * Fixed the choice example - -0.5.1 / 2011-12-20 -================== - - * Fixed `password()` for recent nodes. Closes #36 - -0.5.0 / 2011-12-04 -================== - - * Added sub-command option support [itay] - -0.4.3 / 2011-12-04 -================== - - * Fixed custom help ordering. Closes #32 - -0.4.2 / 2011-11-24 -================== - - * Added travis support - * Fixed: line-buffered input automatically trimmed. Closes #31 - -0.4.1 / 2011-11-18 -================== - - * Removed listening for "close" on --help - -0.4.0 / 2011-11-15 -================== - - * Added support for `--`. Closes #24 - -0.3.3 / 2011-11-14 -================== - - * Fixed: wait for close event when writing help info [Jerry Hamlet] - -0.3.2 / 2011-11-01 -================== - - * Fixed long flag definitions with values [felixge] - -0.3.1 / 2011-10-31 -================== - - * Changed `--version` short flag to `-V` from `-v` - * Changed `.version()` so it's configurable [felixge] - -0.3.0 / 2011-10-31 -================== - - * Added support for long flags only. Closes #18 - -0.2.1 / 2011-10-24 -================== - - * "node": ">= 0.4.x < 0.7.0". Closes #20 - -0.2.0 / 2011-09-26 -================== - - * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] - -0.1.0 / 2011-08-24 -================== - - * Added support for custom `--help` output - -0.0.5 / 2011-08-18 -================== - - * Changed: when the user enters nothing prompt for password again - * Fixed issue with passwords beginning with numbers [NuckChorris] - -0.0.4 / 2011-08-15 -================== - - * Fixed `Commander#args` - -0.0.3 / 2011-08-15 -================== - - * Added default option value support - -0.0.2 / 2011-08-15 -================== - - * Added mask support to `Command#password(str[, mask], fn)` - * Added `Command#password(str, fn)` - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/jade/node_modules/commander/Makefile b/node_modules/jade/node_modules/commander/Makefile deleted file mode 100644 index 0074625..0000000 --- a/node_modules/jade/node_modules/commander/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -TESTS = $(shell find test/test.*.js) - -test: - @./test/run $(TESTS) - -.PHONY: test \ No newline at end of file diff --git a/node_modules/jade/node_modules/commander/Readme.md b/node_modules/jade/node_modules/commander/Readme.md deleted file mode 100644 index b8328c3..0000000 --- a/node_modules/jade/node_modules/commander/Readme.md +++ /dev/null @@ -1,262 +0,0 @@ -# Commander.js - - The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander). - - [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js) - -## Installation - - $ npm install commander - -## Option parsing - - Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq', 'Add bbq sauce') - .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') - .parse(process.argv); - -console.log('you ordered a pizza with:'); -if (program.peppers) console.log(' - peppers'); -if (program.pineapple) console.log(' - pineappe'); -if (program.bbq) console.log(' - bbq'); -console.log(' - %s cheese', program.cheese); -``` - - Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. - -## Automated --help - - The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: - -``` - $ ./examples/pizza --help - - Usage: pizza [options] - - Options: - - -V, --version output the version number - -p, --peppers Add peppers - -P, --pineapple Add pineappe - -b, --bbq Add bbq sauce - -c, --cheese Add the specified type of cheese [marble] - -h, --help output usage information - -``` - -## Coercion - -```js -function range(val) { - return val.split('..').map(Number); -} - -function list(val) { - return val.split(','); -} - -program - .version('0.0.1') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .parse(process.argv); - -console.log(' int: %j', program.integer); -console.log(' float: %j', program.float); -console.log(' optional: %j', program.optional); -program.range = program.range || []; -console.log(' range: %j..%j', program.range[0], program.range[1]); -console.log(' list: %j', program.list); -console.log(' args: %j', program.args); -``` - -## Custom help - - You can display arbitrary `-h, --help` information - by listening for "--help". Commander will automatically - exit once you are done so that the remainder of your program - does not execute causing undesired behaviours, for example - in the following executable "stuff" will not output when - `--help` is used. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('../'); - -function list(val) { - return val.split(',').map(Number); -} - -program - .version('0.0.1') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); - console.log(''); -}); - -program.parse(process.argv); - -console.log('stuff'); -``` - -yielding the following help output: - -``` - -Usage: custom-help [options] - -Options: - - -h, --help output usage information - -V, --version output the version number - -f, --foo enable some foo - -b, --bar enable some bar - -B, --baz enable some baz - -Examples: - - $ custom-help --help - $ custom-help -h - -``` - -## .prompt(msg, fn) - - Single-line prompt: - -```js -program.prompt('name: ', function(name){ - console.log('hi %s', name); -}); -``` - - Multi-line prompt: - -```js -program.prompt('description:', function(name){ - console.log('hi %s', name); -}); -``` - - Coercion: - -```js -program.prompt('Age: ', Number, function(age){ - console.log('age: %j', age); -}); -``` - -```js -program.prompt('Birthdate: ', Date, function(date){ - console.log('date: %s', date); -}); -``` - -## .password(msg[, mask], fn) - -Prompt for password without echoing: - -```js -program.password('Password: ', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -Prompt for password with mask char "*": - -```js -program.password('Password: ', '*', function(pass){ - console.log('got "%s"', pass); - process.stdin.destroy(); -}); -``` - -## .confirm(msg, fn) - - Confirm with the given `msg`: - -```js -program.confirm('continue? ', function(ok){ - console.log(' got %j', ok); -}); -``` - -## .choose(list, fn) - - Let the user choose from a `list`: - -```js -var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - -console.log('Choose the coolest pet:'); -program.choose(list, function(i){ - console.log('you chose %d "%s"', i, list[i]); -}); -``` - -## Links - - - [API documentation](http://visionmedia.github.com/commander.js/) - - [ascii tables](https://github.com/LearnBoost/cli-table) - - [progress bars](https://github.com/visionmedia/node-progress) - - [more progress bars](https://github.com/substack/node-multimeter) - - [examples](https://github.com/visionmedia/commander.js/tree/master/examples) - -## License - -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/jade/node_modules/commander/index.js b/node_modules/jade/node_modules/commander/index.js deleted file mode 100644 index 06ec1e4..0000000 --- a/node_modules/jade/node_modules/commander/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/commander'); \ No newline at end of file diff --git a/node_modules/jade/node_modules/commander/lib/commander.js b/node_modules/jade/node_modules/commander/lib/commander.js deleted file mode 100644 index 5ba87eb..0000000 --- a/node_modules/jade/node_modules/commander/lib/commander.js +++ /dev/null @@ -1,1026 +0,0 @@ - -/*! - * commander - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , path = require('path') - , tty = require('tty') - , basename = path.basename; - -/** - * Expose the root command. - */ - -exports = module.exports = new Command; - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function(){ - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg){ - return arg == this.short - || arg == this.long; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this.args = []; - this.name = name; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Command.prototype.__proto__ = EventEmitter.prototype; - -/** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * Examples: - * - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function(){ - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd){ - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env){ - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {String} name - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name){ - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - return cmd; -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args){ - if (!args.length) return; - var self = this; - args.forEach(function(arg){ - switch (arg[0]) { - case '<': - self.args.push({ required: true, name: arg.slice(1, -1) }); - break; - case '[': - self.args.push({ required: false, name: arg.slice(1, -1) }); - break; - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function(){ - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn){ - var self = this; - this.parent.on(this.name, function(args, unknown){ - // Parse any so-far unknown options - unknown = unknown || []; - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - self.args.forEach(function(arg, i){ - if (arg.required && null == args[i]) { - self.missingArgument(arg.name); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self.args.length) { - args[self.args.length] = self; - } else { - args.push(self); - } - - fn.apply(this, args); - }); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to false - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => true - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|Mixed} fn or default - * @param {Mixed} defaultValue - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue){ - var self = this - , option = new Option(flags, description) - , oname = option.name() - , name = camelcase(oname); - - // default as 3rd arg - if ('function' != typeof fn) defaultValue = fn, fn = null; - - // preassign default value only for --no-*, [optional], or - if (false == option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (false == option.bool) defaultValue = true; - // preassign only if we have a default - if (undefined !== defaultValue) self[name] = defaultValue; - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on(oname, function(val){ - // coercion - if (null != val && fn) val = fn(val); - - // unassigned or bool - if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { - // if no value, bool true, and we have a default, then use it! - if (null == val) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (null !== val) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv){ - // store raw args - this.rawArgs = argv; - - // guess name - if (!this.name) this.name = basename(argv[1]); - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - this.args = parsed.args; - return this.parseArgs(this.args, parsed.unknown); -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args){ - var ret = [] - , arg; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { - arg.slice(1).split('').forEach(function(c){ - ret.push('-' + c); - }); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown){ - var cmds = this.commands - , len = cmds.length - , name; - - if (args.length) { - name = args[0]; - if (this.listeners(name).length) { - this.emit(args.shift(), args, unknown); - } else { - this.emit('*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg){ - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv){ - var args = [] - , len = argv.length - , literal - , option - , arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if ('--' == arg) { - literal = true; - continue; - } - - if (literal) { - args.push(arg); - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (null == arg) return this.optionMissingArgument(option); - if ('-' == arg[0]) return this.optionMissingArgument(option, arg); - this.emit(option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i+1]; - if (null == arg || '-' == arg[0]) { - arg = null; - } else { - ++i; - } - this.emit(option.name(), arg); - // bool - } else { - this.emit(option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && '-' == arg[0]) { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if (argv[i+1] && '-' != argv[i+1][0]) { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name){ - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag){ - console.error(); - if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error(" error: option `%s' argument missing", option.flags); - } - console.error(); - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag){ - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); - process.exit(1); -}; - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {String} str - * @param {String} flags - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags){ - if (0 == arguments.length) return this._version; - this._version = str; - flags = flags || '-V, --version'; - this.option(flags, 'output the version number'); - this.on('version', function(){ - console.log(str); - process.exit(0); - }); - return this; -}; - -/** - * Set the description `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str){ - if (0 == arguments.length) return this._description; - this._description = str; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str){ - var args = this.args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }); - - var usage = '[options' - + (this.commands.length ? '] [command' : '') - + ']' - + (this.args.length ? ' ' + args : ''); - if (0 == arguments.length) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function(){ - return this.options.reduce(function(max, option){ - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function(){ - var width = this.largestOptionLength(); - - // Prepend the help information - return [pad('-h, --help', width) + ' ' + 'output usage information'] - .concat(this.options.map(function(option){ - return pad(option.flags, width) - + ' ' + option.description; - })) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function(){ - if (!this.commands.length) return ''; - return [ - '' - , ' Commands:' - , '' - , this.commands.map(function(cmd){ - var args = cmd.args.map(function(arg){ - return arg.required - ? '<' + arg.name + '>' - : '[' + arg.name + ']'; - }).join(' '); - - return cmd.name - + (cmd.options.length - ? ' [options]' - : '') + ' ' + args - + (cmd.description() - ? '\n' + cmd.description() - : ''); - }).join('\n\n').replace(/^/gm, ' ') - , '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function(){ - return [ - '' - , ' Usage: ' + this.name + ' ' + this.usage() - , '' + this.commandHelp() - , ' Options:' - , '' - , '' + this.optionHelp().replace(/^/gm, ' ') - , '' - , '' - ].join('\n'); -}; - -/** - * Prompt for a `Number`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForNumber = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseNumber(val){ - val = Number(val); - if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); - fn(val); - }); -}; - -/** - * Prompt for a `Date`. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptForDate = function(str, fn){ - var self = this; - this.promptSingleLine(str, function parseDate(val){ - val = new Date(val); - if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); - fn(val); - }); -}; - -/** - * Single-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptSingleLine = function(str, fn){ - if ('function' == typeof arguments[2]) { - return this['promptFor' + (fn.name || fn)](str, arguments[2]); - } - - process.stdout.write(str); - process.stdin.setEncoding('utf8'); - process.stdin.once('data', function(val){ - fn(val.trim()); - }).resume(); -}; - -/** - * Multi-line prompt. - * - * @param {String} str - * @param {Function} fn - * @api private - */ - -Command.prototype.promptMultiLine = function(str, fn){ - var buf = []; - console.log(str); - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function(val){ - if ('\n' == val || '\r\n' == val) { - process.stdin.removeAllListeners('data'); - fn(buf.join('\n')); - } else { - buf.push(val.trimRight()); - } - }).resume(); -}; - -/** - * Prompt `str` and callback `fn(val)` - * - * Commander supports single-line and multi-line prompts. - * To issue a single-line prompt simply add white-space - * to the end of `str`, something like "name: ", whereas - * for a multi-line prompt omit this "description:". - * - * - * Examples: - * - * program.prompt('Username: ', function(name){ - * console.log('hi %s', name); - * }); - * - * program.prompt('Description:', function(desc){ - * console.log('description was "%s"', desc.trim()); - * }); - * - * @param {String|Object} str - * @param {Function} fn - * @api public - */ - -Command.prototype.prompt = function(str, fn){ - var self = this; - - if ('string' == typeof str) { - if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); - this.promptMultiLine(str, fn); - } else { - var keys = Object.keys(str) - , obj = {}; - - function next() { - var key = keys.shift() - , label = str[key]; - - if (!key) return fn(obj); - self.prompt(label, function(val){ - obj[key] = val; - next(); - }); - } - - next(); - } -}; - -/** - * Prompt for password with `str`, `mask` char and callback `fn(val)`. - * - * The mask string defaults to '', aka no output is - * written while typing, you may want to use "*" etc. - * - * Examples: - * - * program.password('Password: ', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * program.password('Password: ', '*', function(pass){ - * console.log('got "%s"', pass); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {String} mask - * @param {Function} fn - * @api public - */ - -Command.prototype.password = function(str, mask, fn){ - var self = this - , buf = ''; - - // default mask - if ('function' == typeof mask) { - fn = mask; - mask = ''; - } - - process.stdin.resume(); - tty.setRawMode(true); - process.stdout.write(str); - - // keypress - process.stdin.on('keypress', function(c, key){ - if (key && 'enter' == key.name) { - console.log(); - process.stdin.removeAllListeners('keypress'); - tty.setRawMode(false); - if (!buf.trim().length) return self.password(str, mask, fn); - fn(buf); - return; - } - - if (key && key.ctrl && 'c' == key.name) { - console.log('%s', buf); - process.exit(); - } - - process.stdout.write(mask); - buf += c; - }).resume(); -}; - -/** - * Confirmation prompt with `str` and callback `fn(bool)` - * - * Examples: - * - * program.confirm('continue? ', function(ok){ - * console.log(' got %j', ok); - * process.stdin.destroy(); - * }); - * - * @param {String} str - * @param {Function} fn - * @api public - */ - - -Command.prototype.confirm = function(str, fn, verbose){ - var self = this; - this.prompt(str, function(ok){ - if (!ok.trim()) { - if (!verbose) str += '(yes or no) '; - return self.confirm(str, fn, true); - } - fn(parseBool(ok)); - }); -}; - -/** - * Choice prompt with `list` of items and callback `fn(index, item)` - * - * Examples: - * - * var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; - * - * console.log('Choose the coolest pet:'); - * program.choose(list, function(i){ - * console.log('you chose %d "%s"', i, list[i]); - * process.stdin.destroy(); - * }); - * - * @param {Array} list - * @param {Number|Function} index or fn - * @param {Function} fn - * @api public - */ - -Command.prototype.choose = function(list, index, fn){ - var self = this - , hasDefault = 'number' == typeof index; - - if (!hasDefault) { - fn = index; - index = null; - } - - list.forEach(function(item, i){ - if (hasDefault && i == index) { - console.log('* %d) %s', i + 1, item); - } else { - console.log(' %d) %s', i + 1, item); - } - }); - - function again() { - self.prompt(' : ', function(val){ - val = parseInt(val, 10) - 1; - if (hasDefault && isNaN(val)) val = index; - - if (null == list[val]) { - again(); - } else { - fn(val, list[val]); - } - }); - } - - again(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word){ - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Parse a boolean `str`. - * - * @param {String} str - * @return {Boolean} - * @api private - */ - -function parseBool(str) { - return /^y|yes|ok|true$/i.test(str); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] == '--help' || options[i] == '-h') { - process.stdout.write(cmd.helpInformation()); - cmd.emit('--help'); - process.exit(0); - } - } -} diff --git a/node_modules/jade/node_modules/commander/package.json b/node_modules/jade/node_modules/commander/package.json deleted file mode 100644 index 6f9d567..0000000 --- a/node_modules/jade/node_modules/commander/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "commander", - "version": "0.6.1", - "description": "the complete solution for node.js command-line programs", - "keywords": [ - "command", - "option", - "parser", - "prompt", - "stdin" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "repository": { - "type": "git", - "url": "https://github.com/visionmedia/commander.js.git" - }, - "dependencies": {}, - "devDependencies": { - "should": ">= 0.0.1" - }, - "scripts": { - "test": "make test" - }, - "main": "index", - "engines": { - "node": ">= 0.4.x" - }, - "readme": "# Commander.js\n\n The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).\n\n [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)\n\n## Installation\n\n $ npm install commander\n\n## Option parsing\n\n Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('commander');\n\nprogram\n .version('0.0.1')\n .option('-p, --peppers', 'Add peppers')\n .option('-P, --pineapple', 'Add pineapple')\n .option('-b, --bbq', 'Add bbq sauce')\n .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')\n .parse(process.argv);\n\nconsole.log('you ordered a pizza with:');\nif (program.peppers) console.log(' - peppers');\nif (program.pineapple) console.log(' - pineappe');\nif (program.bbq) console.log(' - bbq');\nconsole.log(' - %s cheese', program.cheese);\n```\n\n Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as \"--template-engine\" are camel-cased, becoming `program.templateEngine` etc.\n\n## Automated --help\n\n The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:\n\n``` \n $ ./examples/pizza --help\n\n Usage: pizza [options]\n\n Options:\n\n -V, --version output the version number\n -p, --peppers Add peppers\n -P, --pineapple Add pineappe\n -b, --bbq Add bbq sauce\n -c, --cheese Add the specified type of cheese [marble]\n -h, --help output usage information\n\n```\n\n## Coercion\n\n```js\nfunction range(val) {\n return val.split('..').map(Number);\n}\n\nfunction list(val) {\n return val.split(',');\n}\n\nprogram\n .version('0.0.1')\n .usage('[options] ')\n .option('-i, --integer ', 'An integer argument', parseInt)\n .option('-f, --float ', 'A float argument', parseFloat)\n .option('-r, --range ..', 'A range', range)\n .option('-l, --list ', 'A list', list)\n .option('-o, --optional [value]', 'An optional value')\n .parse(process.argv);\n\nconsole.log(' int: %j', program.integer);\nconsole.log(' float: %j', program.float);\nconsole.log(' optional: %j', program.optional);\nprogram.range = program.range || [];\nconsole.log(' range: %j..%j', program.range[0], program.range[1]);\nconsole.log(' list: %j', program.list);\nconsole.log(' args: %j', program.args);\n```\n\n## Custom help\n\n You can display arbitrary `-h, --help` information\n by listening for \"--help\". Commander will automatically\n exit once you are done so that the remainder of your program\n does not execute causing undesired behaviours, for example\n in the following executable \"stuff\" will not output when\n `--help` is used.\n\n```js\n#!/usr/bin/env node\n\n/**\n * Module dependencies.\n */\n\nvar program = require('../');\n\nfunction list(val) {\n return val.split(',').map(Number);\n}\n\nprogram\n .version('0.0.1')\n .option('-f, --foo', 'enable some foo')\n .option('-b, --bar', 'enable some bar')\n .option('-B, --baz', 'enable some baz');\n\n// must be before .parse() since\n// node's emit() is immediate\n\nprogram.on('--help', function(){\n console.log(' Examples:');\n console.log('');\n console.log(' $ custom-help --help');\n console.log(' $ custom-help -h');\n console.log('');\n});\n\nprogram.parse(process.argv);\n\nconsole.log('stuff');\n```\n\nyielding the following help output:\n\n```\n\nUsage: custom-help [options]\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -f, --foo enable some foo\n -b, --bar enable some bar\n -B, --baz enable some baz\n\nExamples:\n\n $ custom-help --help\n $ custom-help -h\n\n```\n\n## .prompt(msg, fn)\n\n Single-line prompt:\n\n```js\nprogram.prompt('name: ', function(name){\n console.log('hi %s', name);\n});\n```\n\n Multi-line prompt:\n\n```js\nprogram.prompt('description:', function(name){\n console.log('hi %s', name);\n});\n```\n\n Coercion:\n\n```js\nprogram.prompt('Age: ', Number, function(age){\n console.log('age: %j', age);\n});\n```\n\n```js\nprogram.prompt('Birthdate: ', Date, function(date){\n console.log('date: %s', date);\n});\n```\n\n## .password(msg[, mask], fn)\n\nPrompt for password without echoing:\n\n```js\nprogram.password('Password: ', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\nPrompt for password with mask char \"*\":\n\n```js\nprogram.password('Password: ', '*', function(pass){\n console.log('got \"%s\"', pass);\n process.stdin.destroy();\n});\n```\n\n## .confirm(msg, fn)\n\n Confirm with the given `msg`:\n\n```js\nprogram.confirm('continue? ', function(ok){\n console.log(' got %j', ok);\n});\n```\n\n## .choose(list, fn)\n\n Let the user choose from a `list`:\n\n```js\nvar list = ['tobi', 'loki', 'jane', 'manny', 'luna'];\n\nconsole.log('Choose the coolest pet:');\nprogram.choose(list, function(i){\n console.log('you chose %d \"%s\"', i, list[i]);\n});\n```\n\n## Links\n\n - [API documentation](http://visionmedia.github.com/commander.js/)\n - [ascii tables](https://github.com/LearnBoost/cli-table)\n - [progress bars](https://github.com/visionmedia/node-progress)\n - [more progress bars](https://github.com/substack/node-multimeter)\n - [examples](https://github.com/visionmedia/commander.js/tree/master/examples)\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/visionmedia/commander.js/issues" - }, - "_id": "commander@0.6.1", - "_from": "commander@0.6.1" -} diff --git a/node_modules/jade/node_modules/mkdirp/.npmignore b/node_modules/jade/node_modules/mkdirp/.npmignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/jade/node_modules/mkdirp/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/jade/node_modules/mkdirp/.travis.yml b/node_modules/jade/node_modules/mkdirp/.travis.yml deleted file mode 100644 index 84fd7ca..0000000 --- a/node_modules/jade/node_modules/mkdirp/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 - - 0.9 diff --git a/node_modules/jade/node_modules/mkdirp/LICENSE b/node_modules/jade/node_modules/mkdirp/LICENSE deleted file mode 100644 index 432d1ae..0000000 --- a/node_modules/jade/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/jade/node_modules/mkdirp/examples/pow.js b/node_modules/jade/node_modules/mkdirp/examples/pow.js deleted file mode 100644 index e692421..0000000 --- a/node_modules/jade/node_modules/mkdirp/examples/pow.js +++ /dev/null @@ -1,6 +0,0 @@ -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); diff --git a/node_modules/jade/node_modules/mkdirp/index.js b/node_modules/jade/node_modules/mkdirp/index.js deleted file mode 100644 index fda6de8..0000000 --- a/node_modules/jade/node_modules/mkdirp/index.js +++ /dev/null @@ -1,82 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, mode, f, made) { - if (typeof mode === 'function' || mode === undefined) { - f = mode; - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || function () {}; - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - fs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - mkdirP(path.dirname(p), mode, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, mode, cb, made); - }); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - fs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} - -mkdirP.sync = function sync (p, mode, made) { - if (mode === undefined) { - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - try { - fs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), mode, made); - sync(p, mode, made); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = fs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; diff --git a/node_modules/jade/node_modules/mkdirp/package.json b/node_modules/jade/node_modules/mkdirp/package.json deleted file mode 100644 index bd9194b..0000000 --- a/node_modules/jade/node_modules/mkdirp/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.3.5", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "main": "./index", - "keywords": [ - "mkdir", - "directory" - ], - "repository": { - "type": "git", - "url": "http://github.com/substack/node-mkdirp.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "devDependencies": { - "tap": "~0.4.0" - }, - "license": "MIT", - "readme": "# mkdirp\n\nLike `mkdir -p`, but in node.js!\n\n[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)\n\n# example\n\n## pow.js\n\n```js\nvar mkdirp = require('mkdirp');\n \nmkdirp('/tmp/foo/bar/baz', function (err) {\n if (err) console.error(err)\n else console.log('pow!')\n});\n```\n\nOutput\n\n```\npow!\n```\n\nAnd now /tmp/foo/bar/baz exists, huzzah!\n\n# methods\n\n```js\nvar mkdirp = require('mkdirp');\n```\n\n## mkdirp(dir, mode, cb)\n\nCreate a new directory and any necessary subdirectories at `dir` with octal\npermission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\n`cb(err, made)` fires with the error or the first directory `made`\nthat had to be created, if any.\n\n## mkdirp.sync(dir, mode)\n\nSynchronously create a new directory and any necessary subdirectories at `dir`\nwith octal permission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\nReturns the first directory that had to be created, if any.\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install mkdirp\n```\n\n# license\n\nMIT\n", - "readmeFilename": "readme.markdown", - "bugs": { - "url": "https://github.com/substack/node-mkdirp/issues" - }, - "_id": "mkdirp@0.3.5", - "_from": "mkdirp@0.3.x" -} diff --git a/node_modules/jade/node_modules/mkdirp/readme.markdown b/node_modules/jade/node_modules/mkdirp/readme.markdown deleted file mode 100644 index 83b0216..0000000 --- a/node_modules/jade/node_modules/mkdirp/readme.markdown +++ /dev/null @@ -1,63 +0,0 @@ -# mkdirp - -Like `mkdir -p`, but in node.js! - -[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) - -# example - -## pow.js - -```js -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); -``` - -Output - -``` -pow! -``` - -And now /tmp/foo/bar/baz exists, huzzah! - -# methods - -```js -var mkdirp = require('mkdirp'); -``` - -## mkdirp(dir, mode, cb) - -Create a new directory and any necessary subdirectories at `dir` with octal -permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -`cb(err, made)` fires with the error or the first directory `made` -that had to be created, if any. - -## mkdirp.sync(dir, mode) - -Synchronously create a new directory and any necessary subdirectories at `dir` -with octal permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -Returns the first directory that had to be created, if any. - -# install - -With [npm](http://npmjs.org) do: - -``` -npm install mkdirp -``` - -# license - -MIT diff --git a/node_modules/jade/node_modules/mkdirp/test/chmod.js b/node_modules/jade/node_modules/mkdirp/test/chmod.js deleted file mode 100644 index 520dcb8..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/chmod.js +++ /dev/null @@ -1,38 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -test('chmod-pre', function (t) { - var mode = 0744 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); - t.end(); - }); - }); -}); - -test('chmod', function (t) { - var mode = 0755 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.end(); - }); - }); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/clobber.js b/node_modules/jade/node_modules/mkdirp/test/clobber.js deleted file mode 100644 index 0eb7099..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/clobber.js +++ /dev/null @@ -1,37 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -// a file in the way -var itw = ps.slice(0, 3).join('/'); - - -test('clobber-pre', function (t) { - console.error("about to write to "+itw) - fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); - - fs.stat(itw, function (er, stat) { - t.ifError(er) - t.ok(stat && stat.isFile(), 'should be file') - t.end() - }) -}) - -test('clobber', function (t) { - t.plan(2); - mkdirp(file, 0755, function (err) { - t.ok(err); - t.equal(err.code, 'ENOTDIR'); - t.end(); - }); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/mkdirp.js b/node_modules/jade/node_modules/mkdirp/test/mkdirp.js deleted file mode 100644 index b07cd70..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/mkdirp.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('woo', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/perm.js b/node_modules/jade/node_modules/mkdirp/test/perm.js deleted file mode 100644 index 23a7abb..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/perm.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('async perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); - -test('async root perm', function (t) { - mkdirp('/tmp', 0755, function (err) { - if (err) t.fail(err); - t.end(); - }); - t.end(); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/perm_sync.js b/node_modules/jade/node_modules/mkdirp/test/perm_sync.js deleted file mode 100644 index f685f60..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/perm_sync.js +++ /dev/null @@ -1,39 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; - - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); - -test('sync root perm', function (t) { - t.plan(1); - - var file = '/tmp'; - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/race.js b/node_modules/jade/node_modules/mkdirp/test/race.js deleted file mode 100644 index 96a0447..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/race.js +++ /dev/null @@ -1,41 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('race', function (t) { - t.plan(4); - var ps = [ '', 'tmp' ]; - - for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); - } - var file = ps.join('/'); - - var res = 2; - mk(file, function () { - if (--res === 0) t.end(); - }); - - mk(file, function () { - if (--res === 0) t.end(); - }); - - function mk (file, cb) { - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - if (cb) cb(); - } - }) - }) - }); - } -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/rel.js b/node_modules/jade/node_modules/mkdirp/test/rel.js deleted file mode 100644 index 7985824..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/rel.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('rel', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var cwd = process.cwd(); - process.chdir('/tmp'); - - var file = [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - process.chdir(cwd); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/return.js b/node_modules/jade/node_modules/mkdirp/test/return.js deleted file mode 100644 index bce68e5..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/return.js +++ /dev/null @@ -1,25 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, '/tmp/' + x); - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, null); - }); - }); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/return_sync.js b/node_modules/jade/node_modules/mkdirp/test/return_sync.js deleted file mode 100644 index 7c222d3..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/return_sync.js +++ /dev/null @@ -1,24 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - // Note that this will throw on failure, which will fail the test. - var made = mkdirp.sync(file); - t.equal(made, '/tmp/' + x); - - // making the same file again should have no effect. - made = mkdirp.sync(file); - t.equal(made, null); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/root.js b/node_modules/jade/node_modules/mkdirp/test/root.js deleted file mode 100644 index 97ad7a2..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/root.js +++ /dev/null @@ -1,18 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('root', function (t) { - // '/' on unix, 'c:/' on windows. - var file = path.resolve('/'); - - mkdirp(file, 0755, function (err) { - if (err) throw err - fs.stat(file, function (er, stat) { - if (er) throw er - t.ok(stat.isDirectory(), 'target is a directory'); - t.end(); - }) - }); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/sync.js b/node_modules/jade/node_modules/mkdirp/test/sync.js deleted file mode 100644 index 7530cad..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file, 0755); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/umask.js b/node_modules/jade/node_modules/mkdirp/test/umask.js deleted file mode 100644 index 64ccafe..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/umask.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('implicit mode from umask', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0777 & (~process.umask())); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/jade/node_modules/mkdirp/test/umask_sync.js b/node_modules/jade/node_modules/mkdirp/test/umask_sync.js deleted file mode 100644 index 35bd5cb..0000000 --- a/node_modules/jade/node_modules/mkdirp/test/umask_sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('umask sync modes', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, (0777 & (~process.umask()))); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/node_modules/jade/package.json b/node_modules/jade/package.json deleted file mode 100644 index 84d581a..0000000 --- a/node_modules/jade/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "jade", - "description": "Jade template engine", - "version": "0.28.2", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/jade" - }, - "main": "./index.js", - "bin": { - "jade": "./bin/jade" - }, - "man": [ - "./jade.1" - ], - "dependencies": { - "commander": "0.6.1", - "mkdirp": "0.3.x" - }, - "devDependencies": { - "coffee-script": "~1.4.0", - "mocha": "*", - "markdown": "*", - "stylus": "*", - "uubench": "*", - "should": "*", - "less": "*", - "uglify-js": "*" - }, - "component": { - "scripts": { - "jade": "runtime.js" - } - }, - "scripts": { - "test": "mocha -R spec", - "prepublish": "npm prune" - }, - "readme": "# Jade - template engine \n[![Build Status](https://secure.travis-ci.org/visionmedia/jade.png)](http://travis-ci.org/visionmedia/jade)\n[![Dependency Status](https://gemnasium.com/visionmedia/jade.png)](https://gemnasium.com/visionmedia/jade)\n\n Jade is a high performance template engine heavily influenced by [Haml](http://haml-lang.com)\n and implemented with JavaScript for [node](http://nodejs.org). For discussion join the [Google Group](http://groups.google.com/group/jadejs).\n\n## Test drive\n\n You can test drive Jade online [here](http://naltatis.github.com/jade-syntax-docs).\n\n## README Contents\n\n- [Features](#a1)\n- [Implementations](#a2)\n- [Installation](#a3)\n- [Browser Support](#a4)\n- [Public API](#a5)\n- [Syntax](#a6)\n - [Line Endings](#a6-1)\n - [Tags](#a6-2)\n - [Tag Text](#a6-3)\n - [Comments](#a6-4)\n - [Block Comments](#a6-5)\n - [Nesting](#a6-6)\n - [Block Expansion](#a6-7)\n - [Case](#a6-8)\n - [Attributes](#a6-9)\n - [HTML](#a6-10)\n - [Doctypes](#a6-11)\n- [Filters](#a7)\n- [Code](#a8)\n- [Iteration](#a9)\n- [Conditionals](#a10)\n- [Template inheritance](#a11)\n- [Block append / prepend](#a12)\n- [Includes](#a13)\n- [Mixins](#a14)\n- [Generated Output](#a15)\n- [Example Makefile](#a16)\n- [jade(1)](#a17)\n- [Tutorials](#a18)\n- [License](#a19)\n\n\n## Features\n\n - client-side support\n - great readability\n - flexible indentation\n - block-expansion\n - mixins\n - static includes\n - attribute interpolation\n - code is escaped by default for security\n - contextual error reporting at compile & run time\n - executable for compiling jade templates via the command line\n - html 5 mode (the default doctype)\n - optional memory caching\n - combine dynamic and static tag classes\n - parse tree manipulation via _filters_\n - template inheritance\n - block append / prepend\n - supports [Express JS](http://expressjs.com) out of the box\n - transparent iteration over objects, arrays, and even non-enumerables via `each`\n - block comments\n - no tag prefix\n - filters\n - :stylus must have [stylus](http://github.com/LearnBoost/stylus) installed\n - :less must have [less.js](http://github.com/cloudhead/less.js) installed\n - :markdown must have [markdown-js](http://github.com/evilstreak/markdown-js), [node-discount](http://github.com/visionmedia/node-discount), or [marked](http://github.com/chjj/marked) installed\n - :cdata\n - :coffeescript must have [coffee-script](http://jashkenas.github.com/coffee-script/) installed\n - [Emacs Mode](https://github.com/brianc/jade-mode)\n - [Vim Syntax](https://github.com/digitaltoad/vim-jade)\n - [TextMate Bundle](http://github.com/miksago/jade-tmbundle)\n - [Coda/SubEtha syntax Mode](https://github.com/aaronmccall/jade.mode)\n - [Screencasts](http://tjholowaychuk.com/post/1004255394/jade-screencast-template-engine-for-nodejs)\n - [html2jade](https://github.com/donpark/html2jade) converter\n\n\n## Implementations\n\n - [php](http://github.com/everzet/jade.php)\n - [scala](http://scalate.fusesource.org/versions/snapshot/documentation/scaml-reference.html)\n - [ruby](http://github.com/stonean/slim)\n - [python](https://github.com/SyrusAkbary/pyjade)\n - [java](https://github.com/neuland/jade4j)\n\n\n## Installation\n\nvia npm:\n\n```bash\n$ npm install jade\n```\n\n\n## Browser Support\n\n To compile jade to a single file compatible for client-side use simply execute:\n\n```bash\n$ make jade.js\n```\n\n Alternatively, if uglifyjs is installed via npm (`npm install uglify-js`) you may execute the following which will create both files. However each release builds these for you.\n\n```bash\n$ make jade.min.js\n```\n\n By default Jade instruments templates with line number statements such as `__.lineno = 3` for debugging purposes. When used in a browser it's useful to minimize this boiler plate, you can do so by passing the option `{ compileDebug: false }`. The following template\n\n```jade\np Hello #{name}\n```\n\n Can then be as small as the following generated function:\n\n```js\nfunction anonymous(locals, attrs, escape, rethrow) {\n var buf = [];\n with (locals || {}) {\n var interp;\n buf.push('\\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\\n

    ');\n }\n return buf.join(\"\");\n}\n```\n\n Through the use of Jade's `./runtime.js` you may utilize these pre-compiled templates on the client-side _without_ Jade itself, all you need is the associated utility functions (in runtime.js), which are then available as `jade.attrs`, `jade.escape` etc. To enable this you should pass `{ client: true }` to `jade.compile()` to tell Jade to reference the helper functions\n via `jade.attrs`, `jade.escape` etc.\n\n```js\nfunction anonymous(locals, attrs, escape, rethrow) {\n var attrs = jade.attrs, escape = jade.escape, rethrow = jade.rethrow;\n var buf = [];\n with (locals || {}) {\n var interp;\n buf.push('\\n

    Hello ' + escape((interp = name) == null ? '' : interp) + '\\n

    ');\n }\n return buf.join(\"\");\n}\n```\n\n
    \n## Public API\n\n```js\nvar jade = require('jade');\n\n// Compile a function\nvar fn = jade.compile('string of jade', options);\nfn(locals);\n```\n\n### Options\n\n - `self` Use a `self` namespace to hold the locals _(false by default)_\n - `locals` Local variable object\n - `filename` Used in exceptions, and required when using includes\n - `debug` Outputs tokens and function body generated\n - `compiler` Compiler to replace jade's default\n - `compileDebug` When `false` no debug instrumentation is compiled\n - `pretty` Add pretty-indentation whitespace to output _(false by default)_\n\n\n## Syntax\n\n\n### Line Endings\n\n**CRLF** and **CR** are converted to **LF** before parsing.\n\n\n### Tags\n\nA tag is simply a leading word:\n\n```jade\nhtml\n```\n\nfor example is converted to ``\n\ntags can also have ids:\n\n```jade\ndiv#container\n```\n\nwhich would render `
    `\n\nhow about some classes?\n\n```jade\ndiv.user-details\n```\n\nrenders `
    `\n\nmultiple classes? _and_ an id? sure:\n\n```jade\ndiv#foo.bar.baz\n```\n\nrenders `
    `\n\ndiv div div sure is annoying, how about:\n\n```jade\n#foo\n.bar\n```\n\nwhich is syntactic sugar for what we have already been doing, and outputs:\n\n```html\n
    \n```\n\n
    \n### Tag Text\n\nSimply place some content after the tag:\n\n```jade\np wahoo!\n```\n\nrenders `

    wahoo!

    `.\n\nwell cool, but how about large bodies of text:\n\n```jade\np\n | foo bar baz\n | rawr rawr\n | super cool\n | go jade go\n```\n\nrenders `

    foo bar baz rawr.....

    `\n\ninterpolation? yup! both types of text can utilize interpolation,\nif we passed `{ name: 'tj', email: 'tj@vision-media.ca' }` to the compiled function we can do the following:\n\n```jade\n#user #{name} <#{email}>\n```\n\noutputs `
    tj <tj@vision-media.ca>
    `\n\nActually want `#{}` for some reason? escape it!\n\n```jade\np \\#{something}\n```\n\nnow we have `

    #{something}

    `\n\nWe can also utilize the unescaped variant `!{html}`, so the following\nwill result in a literal script tag:\n\n```jade\n- var html = \"\"\n| !{html}\n```\n\nNested tags that also contain text can optionally use a text block:\n\n```jade\nlabel\n | Username:\n input(name='user[name]')\n```\n\nor immediate tag text:\n\n```jade\nlabel Username:\n input(name='user[name]')\n```\n\nTags that accept _only_ text such as `script` and `style` do not\nneed the leading `|` character, for example:\n\n```jade\nhtml\n head\n title Example\n script\n if (foo) {\n bar();\n } else {\n baz();\n }\n```\n\nOnce again as an alternative, we may use a trailing `.` to indicate a text block, for example:\n\n```jade\np.\n foo asdf\n asdf\n asdfasdfaf\n asdf\n asd.\n```\n\noutputs:\n\n```html\n

    foo asdf\nasdf\n asdfasdfaf\n asdf\nasd.\n

    \n```\n\nThis however differs from a trailing `.` followed by a space, which although is ignored by the Jade parser, tells Jade that this period is a literal:\n\n```jade\np .\n```\n\noutputs:\n\n```html\n

    .

    \n```\n\nIt should be noted that text blocks should be doubled escaped. For example if you desire the following output.\n\n```html\n

    foo\\bar

    \n```\n\nuse:\n\n```jade\np.\n foo\\\\bar\n```\n\n
    \n### Comments\n\nSingle line comments currently look the same as JavaScript comments,\naka `//` and must be placed on their own line:\n\n```jade\n// just some paragraphs\np foo\np bar\n```\n\nwould output\n\n```html\n\n

    foo

    \n

    bar

    \n```\n\nJade also supports unbuffered comments, by simply adding a hyphen:\n\n```jade\n//- will not output within markup\np foo\np bar\n```\n\noutputting\n\n```html\n

    foo

    \n

    bar

    \n```\n\n
    \n### Block Comments\n\n A block comment is legal as well:\n\n```jade\nbody\n //\n #content\n h1 Example\n```\n\noutputting\n\n```html\n\n \n\n```\n\nJade supports conditional-comments as well, for example:\n\n```jade\nhead\n //if lt IE 8\n script(src='/ie-sucks.js')\n```\n\noutputs:\n\n```html\n\n \n\n```\n\n\n### Nesting\n\n Jade supports nesting to define the tags in a natural way:\n\n```jade\nul\n li.first\n a(href='#') foo\n li\n a(href='#') bar\n li.last\n a(href='#') baz\n```\n\n\n### Block Expansion\n\n Block expansion allows you to create terse single-line nested tags,\n the following example is equivalent to the nesting example above.\n\n```jade\nul\n li.first: a(href='#') foo\n li: a(href='#') bar\n li.last: a(href='#') baz\n```\n\n\n### Case\n\n The case statement takes the following form:\n\n```jade\nhtml\n body\n friends = 10\n case friends\n when 0\n p you have no friends\n when 1\n p you have a friend\n default\n p you have #{friends} friends\n```\n\n Block expansion may also be used:\n\n```jade\nfriends = 5\n\nhtml\n body\n case friends\n when 0: p you have no friends\n when 1: p you have a friend\n default: p you have #{friends} friends\n```\n\n\n### Attributes\n\nJade currently supports `(` and `)` as attribute delimiters.\n\n```jade\na(href='/login', title='View login page') Login\n```\n\nWhen a value is `undefined` or `null` the attribute is _not_ added,\nso this is fine, it will not compile `something=\"null\"`.\n\n```jade\ndiv(something=null)\n```\n\nBoolean attributes are also supported:\n\n```jade\ninput(type=\"checkbox\", checked)\n```\n\nBoolean attributes with code will only output the attribute when `true`:\n\n```jade\ninput(type=\"checkbox\", checked=someValue)\n```\n\nMultiple lines work too:\n\n```jade\ninput(type='checkbox',\n name='agreement',\n checked)\n```\n\nMultiple lines without the comma work fine:\n\n```jade\ninput(type='checkbox'\n name='agreement'\n checked)\n```\n\nFunky whitespace? fine:\n\n```jade\ninput(\n type='checkbox'\n name='agreement'\n checked)\n```\n\nColons work:\n\n```jade\nrss(xmlns:atom=\"atom\")\n```\n\nSuppose we have the `user` local `{ id: 12, name: 'tobi' }`\nand we wish to create an anchor tag with `href` pointing to \"/user/12\"\nwe could use regular javascript concatenation:\n\n```jade\na(href='/user/' + user.id)= user.name\n```\n\nor we could use jade's interpolation, which I added because everyone\nusing Ruby or CoffeeScript seems to think this is legal js..:\n\n```jade\na(href='/user/#{user.id}')= user.name\n```\n\nThe `class` attribute is special-cased when an array is given,\nallowing you to pass an array such as `bodyClasses = ['user', 'authenticated']` directly:\n\n```jade\nbody(class=bodyClasses)\n```\n\n\n### HTML\n\n Inline html is fine, we can use the pipe syntax to\n write arbitrary text, in this case some html:\n\n```jade\nhtml\n body\n |

    Title

    \n |

    foo bar baz

    \n```\n\n Or we can use the trailing `.` to indicate to Jade that we\n only want text in this block, allowing us to omit the pipes:\n\n```jade\nhtml\n body.\n

    Title

    \n

    foo bar baz

    \n```\n\n Both of these examples yield the same result:\n\n```html\n

    Title

    \n

    foo bar baz

    \n\n```\n\n The same rule applies for anywhere you can have text\n in jade, raw html is fine:\n\n```jade\nhtml\n body\n h1 User #{name}\n```\n\n
    \n### Doctypes\n\nTo add a doctype simply use `!!!`, or `doctype` followed by an optional value:\n\n```jade\n!!!\n```\n\nor\n\n```jade\ndoctype\n```\n\nWill output the _html 5_ doctype, however:\n\n```jade\n!!! transitional\n```\n\nWill output the _transitional_ doctype.\n\nDoctypes are case-insensitive, so the following are equivalent:\n\n```jade\ndoctype Basic\ndoctype basic\n```\n\nit's also possible to simply pass a doctype literal:\n\n```jade\ndoctype html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\n```\n\nyielding:\n\n```html\n\n```\n\nBelow are the doctypes defined by default, which can easily be extended:\n\n```js\nvar doctypes = exports.doctypes = {\n '5': '',\n 'default': '',\n 'xml': '',\n 'transitional': '',\n 'strict': '',\n 'frameset': '',\n '1.1': '',\n 'basic': '',\n 'mobile': ''\n};\n```\n\nTo alter the default simply change:\n\n```js\njade.doctypes.default = 'whatever you want';\n```\n\n\n## Filters\n\nFilters are prefixed with `:`, for example `:markdown` and\npass the following block of text to an arbitrary function for processing. View the _features_\nat the top of this document for available filters.\n\n```jade\nbody\n :markdown\n Woah! jade _and_ markdown, very **cool**\n we can even link to [stuff](http://google.com)\n```\n\nRenders:\n\n```html\n

    Woah! jade and markdown, very cool we can even link to stuff

    \n```\n\n\n## Code\n\nJade currently supports three classifications of executable code. The first\nis prefixed by `-`, and is not buffered:\n\n```jade\n- var foo = 'bar';\n```\n\nThis can be used for conditionals, or iteration:\n\n```jade\n- for (var key in obj)\n p= obj[key]\n```\n\nDue to Jade's buffering techniques the following is valid as well:\n\n```jade\n- if (foo)\n ul\n li yay\n li foo\n li worked\n- else\n p oh no! didnt work\n```\n\nHell, even verbose iteration:\n\n```jade\n- if (items.length)\n ul\n - items.forEach(function(item){\n li= item\n - })\n```\n\nAnything you want!\n\nNext up we have _escaped_ buffered code, which is used to\nbuffer a return value, which is prefixed by `=`:\n\n```jade\n- var foo = 'bar'\n= foo\nh1= foo\n```\n\nWhich outputs `bar

    bar

    `. Code buffered by `=` is escaped\nby default for security, however to output unescaped return values\nyou may use `!=`:\n\n```jade\np!= aVarContainingMoreHTML\n```\n\n Jade also has designer-friendly variants, making the literal JavaScript\n more expressive and declarative. For example the following assignments\n are equivalent, and the expression is still regular javascript:\n\n```jade\n- var foo = 'foo ' + 'bar'\nfoo = 'foo ' + 'bar'\n```\n\n Likewise Jade has first-class `if`, `else if`, `else`, `until`, `while`, `unless` among others, however you must remember that the expressions are still regular javascript:\n\n```jade\nif foo == 'bar'\n ul\n li yay\n li foo\n li worked\nelse\n p oh no! didnt work\n```\n\n
    \n## Iteration\n\n Along with vanilla JavaScript Jade also supports a subset of\n constructs that allow you to create more designer-friendly templates,\n one of these constructs is `each`, taking the form:\n\n```jade\neach VAL[, KEY] in OBJ\n```\n\nAn example iterating over an array:\n\n```jade\n- var items = [\"one\", \"two\", \"three\"]\neach item in items\n li= item\n```\n\noutputs:\n\n```html\n
  • one
  • \n
  • two
  • \n
  • three
  • \n```\n\niterating an array with index:\n\n```jade\nitems = [\"one\", \"two\", \"three\"]\neach item, i in items\n li #{item}: #{i}\n```\n\noutputs:\n\n```html\n
  • one: 0
  • \n
  • two: 1
  • \n
  • three: 2
  • \n```\n\niterating an object's keys and values:\n\n```jade\nobj = { foo: 'bar' }\neach val, key in obj\n li #{key}: #{val}\n```\n\nwould output `
  • foo: bar
  • `\n\nInternally Jade converts these statements to regular\nJavaScript loops such as `users.forEach(function(user){`,\nso lexical scope and nesting applies as it would with regular\nJavaScript:\n\n```jade\neach user in users\n each role in user.roles\n li= role\n```\n\n You may also use `for` if you prefer:\n\n```jade\nfor user in users\n for role in user.roles\n li= role\n```\n\n
    \n## Conditionals\n\n Jade conditionals are equivalent to those using the code (`-`) prefix,\n however allow you to ditch parenthesis to become more designer friendly,\n however keep in mind the expression given is _regular_ JavaScript:\n\n```jade\nfor user in users\n if user.role == 'admin'\n p #{user.name} is an admin\n else\n p= user.name\n```\n\n is equivalent to the following using vanilla JavaScript literals:\n\n```jade\nfor user in users\n - if (user.role == 'admin')\n p #{user.name} is an admin\n - else\n p= user.name\n```\n\n Jade also provides `unless` which is equivalent to `if (!(expr))`:\n\n```jade\nfor user in users\n unless user.isAnonymous\n p\n | Click to view\n a(href='/users/' + user.id)= user.name\n```\n\n\n## Template inheritance\n\n Jade supports template inheritance via the `block` and `extends` keywords. A block is simply a \"block\" of Jade that may be replaced within a child template, this process is recursive. To activate template inheritance in Express 2.x you must add: `app.set('view options', { layout: false });`.\n\n Jade blocks can provide default content if desired, however optional as shown below by `block scripts`, `block content`, and `block foot`.\n\n```jade\nhtml\n head\n h1 My Site - #{title}\n block scripts\n script(src='/jquery.js')\n body\n block content\n block foot\n #footer\n p some footer content\n```\n\n Now to extend the layout, simply create a new file and use the `extends` directive as shown below, giving the path (with or without the .jade extension). You may now define one or more blocks that will override the parent block content, note that here the `foot` block is _not_ redefined and will output \"some footer content\".\n\n```jade\nextends layout\n\nblock scripts\n script(src='/jquery.js')\n script(src='/pets.js')\n\nblock content\n h1= title\n each pet in pets\n include pet\n```\n\n It's also possible to override a block to provide additional blocks, as shown in the following example where `content` now exposes a `sidebar` and `primary` block for overriding, or the child template could override `content` all together.\n\n```jade\nextends regular-layout\n\nblock content\n .sidebar\n block sidebar\n p nothing\n .primary\n block primary\n p nothing\n```\n\n\n## Block append / prepend\n\n Jade allows you to _replace_ (default), _prepend_, or _append_ blocks. Suppose for example you have default scripts in a \"head\" block that you wish to utilize on _every_ page, you might do this:\n\n```jade\nhtml\n head\n block head\n script(src='/vendor/jquery.js')\n script(src='/vendor/caustic.js')\n body\n block content\n```\n\n Now suppose you have a page of your application for a JavaScript game, you want some game related scripts as well as these defaults, you can simply `append` the block:\n\n```jade\nextends layout\n\nblock append head\n script(src='/vendor/three.js')\n script(src='/game.js')\n```\n\n When using `block append` or `block prepend` the `block` is optional:\n\n```jade\nextends layout\n\nappend head\n script(src='/vendor/three.js')\n script(src='/game.js')\n```\n\n\n## Includes\n\n Includes allow you to statically include chunks of Jade,\n or other content like css, or html which lives in separate files. The classical example is including a header and footer. Suppose we have the following directory structure:\n\n ./layout.jade\n ./includes/\n ./head.jade\n ./foot.jade\n\nand the following _layout.jade_:\n\n```jade\nhtml\n include includes/head\n body\n h1 My Site\n p Welcome to my super amazing site.\n include includes/foot\n```\n\nboth includes _includes/head_ and _includes/foot_ are\nread relative to the `filename` option given to _layout.jade_,\nwhich should be an absolute path to this file, however Express does this for you. Include then parses these files, and injects the AST produced to render what you would expect:\n\n```html\n\n \n My Site\n \n \n \n

    My Site

    \n

    Welcome to my super lame site.

    \n
    \n

    Copyright>(c) foobar

    \n
    \n \n\n```\n\n As mentioned `include` can be used to include other content\n such as html or css. By providing an extension Jade will not\n assume that the file is Jade source and will include it as\n a literal:\n\n```jade\nhtml\n body\n include content.html\n```\n\n Include directives may also accept a block, in which case the\n the given block will be appended to the _last_ block defined\n in the file. For example if `head.jade` contains:\n\n```jade\nhead\n script(src='/jquery.js')\n```\n\n We may append values by providing a block to `include head`\n as shown below, adding the two scripts.\n\n```jade\nhtml\n include head\n script(src='/foo.js')\n script(src='/bar.js')\n body\n h1 test\n```\n\n You may also `yield` within an included template, allowing you to explicitly mark where the block given to `include` will be placed. Suppose for example you wish to prepend scripts rather than append, you might do the following:\n\n```jade\nhead\n yield\n script(src='/jquery.js')\n script(src='/jquery.ui.js')\n```\n\n Since included Jade is parsed and literally merges the AST, lexically scoped variables function as if the included Jade was written right in the same file. This means `include` may be used as sort of partial, for example suppose we have `user.jade` which utilizes a `user` variable.\n\n```jade\nh1= user.name\np= user.occupation\n```\n\nWe could then simply `include user` while iterating users, and since the `user` variable is already defined within the loop the included template will have access to it.\n\n```jade\nusers = [{ name: 'Tobi', occupation: 'Ferret' }]\n\neach user in users\n .user\n include user\n```\n\nyielding:\n\n```html\n
    \n

    Tobi

    \n

    Ferret

    \n
    \n```\n\nIf we wanted to expose a different variable name as `user` since `user.jade` references that name, we could simply define a new variable as shown here with `user = person`:\n\n```jade\neach person in users\n .user\n user = person\n include user\n```\n\n
    \n## Mixins\n\n Mixins are converted to regular JavaScript functions in\n the compiled template that Jade constructs. Mixins may\n take arguments, though not required:\n\n```jade\nmixin list\n ul\n li foo\n li bar\n li baz\n```\n\n Utilizing a mixin without args looks similar, just without a block:\n\n```jade\nh2 Groceries\nmixin list\n```\n\n Mixins may take one or more arguments as well, the arguments\n are regular javascripts expressions, so for example the following:\n\n```jade\nmixin pets(pets)\n ul.pets\n - each pet in pets\n li= pet\n\nmixin profile(user)\n .user\n h2= user.name\n mixin pets(user.pets)\n```\n\n Would yield something similar to the following html:\n\n```html\n
    \n

    tj

    \n
      \n
    • tobi
    • \n
    • loki
    • \n
    • jane
    • \n
    • manny
    • \n
    \n
    \n```\n\n
    \n## Generated Output\n\n Suppose we have the following Jade:\n\n```jade\n- var title = 'yay'\nh1.title #{title}\np Just an example\n```\n\n When the `compileDebug` option is not explicitly `false`, Jade\n will compile the function instrumented with `__.lineno = n;`, which\n in the event of an exception is passed to `rethrow()` which constructs\n a useful message relative to the initial Jade input.\n\n```js\nfunction anonymous(locals) {\n var __ = { lineno: 1, input: \"- var title = 'yay'\\nh1.title #{title}\\np Just an example\", filename: \"testing/test.js\" };\n var rethrow = jade.rethrow;\n try {\n var attrs = jade.attrs, escape = jade.escape;\n var buf = [];\n with (locals || {}) {\n var interp;\n __.lineno = 1;\n var title = 'yay'\n __.lineno = 2;\n buf.push('');\n buf.push('' + escape((interp = title) == null ? '' : interp) + '');\n buf.push('');\n __.lineno = 3;\n buf.push('

    ');\n buf.push('Just an example');\n buf.push('

    ');\n }\n return buf.join(\"\");\n } catch (err) {\n rethrow(err, __.input, __.filename, __.lineno);\n }\n}\n```\n\nWhen the `compileDebug` option _is_ explicitly `false`, this instrumentation\nis stripped, which is very helpful for light-weight client-side templates. Combining Jade's options with the `./runtime.js` file in this repo allows you\nto toString() compiled templates and avoid running the entire Jade library on\nthe client, increasing performance, and decreasing the amount of JavaScript\nrequired.\n\n```js\nfunction anonymous(locals) {\n var attrs = jade.attrs, escape = jade.escape;\n var buf = [];\n with (locals || {}) {\n var interp;\n var title = 'yay'\n buf.push('');\n buf.push('' + escape((interp = title) == null ? '' : interp) + '');\n buf.push('');\n buf.push('

    ');\n buf.push('Just an example');\n buf.push('

    ');\n }\n return buf.join(\"\");\n}\n```\n\n
    \n## Example Makefile\n\n Below is an example Makefile used to compile _pages/*.jade_\n into _pages/*.html_ files by simply executing `make`.\n\n_Note:_ If you try to run this snippet and `make` throws a `missing separator` error, you should make sure all indented lines use a tab for indentation instead of spaces. (For whatever reason, GitHub renders this code snippet with 4-space indentation although the actual README file uses tabs in this snippet.)\n\n```make\nJADE = $(shell find . -wholename './pages/*.jade')\nHTML = $(JADE:.jade=.html)\n\nall: $(HTML)\n\n%.html: %.jade\n\tjade < $< --path $< > $@\n\nclean:\n\trm -f $(HTML)\n\n.PHONY: clean\n```\n\nthis can be combined with the `watch(1)` command to produce\na watcher-like behaviour:\n\n```bash\n$ watch make\n```\n\n\n## jade(1)\n\n```\n\nUsage: jade [options] [dir|file ...]\n\nOptions:\n\n -h, --help output usage information\n -V, --version output the version number\n -o, --obj javascript options object\n -O, --out output the compiled html to \n -p, --path filename used to resolve includes\n -P, --pretty compile pretty html output\n -c, --client compile for client-side runtime.js\n -D, --no-debug compile without debugging (smaller functions)\n\nExamples:\n\n # translate jade the templates dir\n $ jade templates\n\n # create {foo,bar}.html\n $ jade {foo,bar}.jade\n\n # jade over stdio\n $ jade < my.jade > my.html\n\n # jade over stdio\n $ echo \"h1 Jade!\" | jade\n\n # foo, bar dirs rendering to /tmp\n $ jade foo bar --out /tmp\n\n```\n\n\n## Tutorials\n\n - cssdeck interactive [Jade syntax tutorial](http://cssdeck.com/labs/learning-the-jade-templating-engine-syntax)\n - cssdeck interactive [Jade logic tutorial](http://cssdeck.com/labs/jade-templating-tutorial-codecast-part-2)\n - in [Japanese](http://blog.craftgear.net/4f501e97c1347ec934000001/title/10%E5%88%86%E3%81%A7%E3%82%8F%E3%81%8B%E3%82%8Bjade%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%82%A8%E3%83%B3%E3%82%B8%E3%83%B3)\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2009-2010 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/visionmedia/jade/issues" - }, - "_id": "jade@0.28.2", - "_from": "jade@~0.28.2" -} diff --git a/node_modules/jade/runtime.js b/node_modules/jade/runtime.js deleted file mode 100644 index 0f54907..0000000 --- a/node_modules/jade/runtime.js +++ /dev/null @@ -1,179 +0,0 @@ - -jade = (function(exports){ -/*! - * Jade - runtime - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Lame Array.isArray() polyfill for now. - */ - -if (!Array.isArray) { - Array.isArray = function(arr){ - return '[object Array]' == Object.prototype.toString.call(arr); - }; -} - -/** - * Lame Object.keys() polyfill for now. - */ - -if (!Object.keys) { - Object.keys = function(obj){ - var arr = []; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - arr.push(key); - } - } - return arr; - } -} - -/** - * Merge two attribute objects giving precedence - * to values in object `b`. Classes are special-cased - * allowing for arrays and merging/joining appropriately - * resulting in a string. - * - * @param {Object} a - * @param {Object} b - * @return {Object} a - * @api private - */ - -exports.merge = function merge(a, b) { - var ac = a['class']; - var bc = b['class']; - - if (ac || bc) { - ac = ac || []; - bc = bc || []; - if (!Array.isArray(ac)) ac = [ac]; - if (!Array.isArray(bc)) bc = [bc]; - ac = ac.filter(nulls); - bc = bc.filter(nulls); - a['class'] = ac.concat(bc).join(' '); - } - - for (var key in b) { - if (key != 'class') { - a[key] = b[key]; - } - } - - return a; -}; - -/** - * Filter null `val`s. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function nulls(val) { - return val != null; -} - -/** - * Render the given attributes object. - * - * @param {Object} obj - * @param {Object} escaped - * @return {String} - * @api private - */ - -exports.attrs = function attrs(obj, escaped){ - var buf = [] - , terse = obj.terse; - - delete obj.terse; - var keys = Object.keys(obj) - , len = keys.length; - - if (len) { - buf.push(''); - for (var i = 0; i < len; ++i) { - var key = keys[i] - , val = obj[key]; - - if ('boolean' == typeof val || null == val) { - if (val) { - terse - ? buf.push(key) - : buf.push(key + '="' + key + '"'); - } - } else if (0 == key.indexOf('data') && 'string' != typeof val) { - buf.push(key + "='" + JSON.stringify(val) + "'"); - } else if ('class' == key && Array.isArray(val)) { - buf.push(key + '="' + exports.escape(val.join(' ')) + '"'); - } else if (escaped && escaped[key]) { - buf.push(key + '="' + exports.escape(val) + '"'); - } else { - buf.push(key + '="' + val + '"'); - } - } - } - - return buf.join(' '); -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function escape(html){ - return String(html) - .replace(/&(?!(\w+|\#\d+);)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - -/** - * Re-throw the given `err` in context to the - * the jade in `filename` at the given `lineno`. - * - * @param {Error} err - * @param {String} filename - * @param {String} lineno - * @api private - */ - -exports.rethrow = function rethrow(err, filename, lineno){ - if (!filename) throw err; - - var context = 3 - , str = require('fs').readFileSync(filename, 'utf8') - , lines = str.split('\n') - , start = Math.max(lineno - context, 0) - , end = Math.min(lines.length, lineno + context); - - // Error context - var context = lines.slice(start, end).map(function(line, i){ - var curr = i + start + 1; - return (curr == lineno ? ' > ' : ' ') - + curr - + '| ' - + line; - }).join('\n'); - - // Alter exception message - err.path = filename; - err.message = (filename || 'Jade') + ':' + lineno - + '\n' + context + '\n\n' + err.message; - throw err; -}; - - return exports; - -})({}); diff --git a/node_modules/jade/runtime.min.js b/node_modules/jade/runtime.min.js deleted file mode 100644 index 1714efb..0000000 --- a/node_modules/jade/runtime.min.js +++ /dev/null @@ -1 +0,0 @@ -jade=function(exports){Array.isArray||(Array.isArray=function(arr){return"[object Array]"==Object.prototype.toString.call(arr)}),Object.keys||(Object.keys=function(obj){var arr=[];for(var key in obj)obj.hasOwnProperty(key)&&arr.push(key);return arr}),exports.merge=function merge(a,b){var ac=a["class"],bc=b["class"];if(ac||bc)ac=ac||[],bc=bc||[],Array.isArray(ac)||(ac=[ac]),Array.isArray(bc)||(bc=[bc]),ac=ac.filter(nulls),bc=bc.filter(nulls),a["class"]=ac.concat(bc).join(" ");for(var key in b)key!="class"&&(a[key]=b[key]);return a};function nulls(val){return val!=null}return exports.attrs=function attrs(obj,escaped){var buf=[],terse=obj.terse;delete obj.terse;var keys=Object.keys(obj),len=keys.length;if(len){buf.push("");for(var i=0;i/g,">").replace(/"/g,""")},exports.rethrow=function rethrow(err,filename,lineno){if(!filename)throw err;var context=3,str=require("fs").readFileSync(filename,"utf8"),lines=str.split("\n"),start=Math.max(lineno-context,0),end=Math.min(lines.length,lineno+context),context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" > ":" ")+curr+"| "+line}).join("\n");throw err.path=filename,err.message=(filename||"Jade")+":"+lineno+"\n"+context+"\n\n"+err.message,err},exports}({}); \ No newline at end of file diff --git a/node_modules/jade/testing/index.html b/node_modules/jade/testing/index.html deleted file mode 100644 index 105c9f4..0000000 --- a/node_modules/jade/testing/index.html +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/node_modules/jade/testing/index.jade b/node_modules/jade/testing/index.jade deleted file mode 100644 index a22e82a..0000000 --- a/node_modules/jade/testing/index.jade +++ /dev/null @@ -1,4 +0,0 @@ - -html - body - include some.js diff --git a/node_modules/jade/testing/layout.html b/node_modules/jade/testing/layout.html deleted file mode 100644 index cbbfc7a..0000000 --- a/node_modules/jade/testing/layout.html +++ /dev/null @@ -1 +0,0 @@ -Application \ No newline at end of file diff --git a/node_modules/jade/testing/layout.jade b/node_modules/jade/testing/layout.jade deleted file mode 100644 index a48765c..0000000 --- a/node_modules/jade/testing/layout.jade +++ /dev/null @@ -1,6 +0,0 @@ -!!! 5 -html - head - title Application - body - block content diff --git a/node_modules/jade/testing/mobile.html b/node_modules/jade/testing/mobile.html deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/jade/testing/mobile.jade b/node_modules/jade/testing/mobile.jade deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/jade/testing/nested/something.html b/node_modules/jade/testing/nested/something.html deleted file mode 100644 index d6b0493..0000000 --- a/node_modules/jade/testing/nested/something.html +++ /dev/null @@ -1 +0,0 @@ -

    out

    \ No newline at end of file diff --git a/node_modules/jade/testing/nested/something.jade b/node_modules/jade/testing/nested/something.jade deleted file mode 100644 index 552c797..0000000 --- a/node_modules/jade/testing/nested/something.jade +++ /dev/null @@ -1 +0,0 @@ -p out \ No newline at end of file diff --git a/node_modules/jade/testing/some.js b/node_modules/jade/testing/some.js deleted file mode 100644 index 3104e71..0000000 --- a/node_modules/jade/testing/some.js +++ /dev/null @@ -1,4 +0,0 @@ - -if (something) { - something('hey'); -} diff --git a/node_modules/jade/testing/test.md b/node_modules/jade/testing/test.md deleted file mode 100644 index 9af1bb2..0000000 --- a/node_modules/jade/testing/test.md +++ /dev/null @@ -1,5 +0,0 @@ -Just a _test_ of some **markdown**: - - - foo - - bar - - baz diff --git a/node_modules/lazy/.npmignore b/node_modules/lazy/.npmignore deleted file mode 100644 index 1377554..0000000 --- a/node_modules/lazy/.npmignore +++ /dev/null @@ -1 +0,0 @@ -*.swp diff --git a/node_modules/lazy/README.md b/node_modules/lazy/README.md deleted file mode 100644 index f2d853f..0000000 --- a/node_modules/lazy/README.md +++ /dev/null @@ -1,185 +0,0 @@ -Lazy lists for node -=================== - - -# Table of contents: - -[Introduction](#Introduction) - -[Documentation](#Documentation) - -
    -# Introduction -Lazy comes really handy when you need to treat a stream of events like a list. -The best use case currently is returning a lazy list from an asynchronous -function, and having data pumped into it via events. In asynchronous -programming you can't just return a regular list because you don't yet have -data for it. The usual solution so far has been to provide a callback that gets -called when the data is available. But doing it this way you lose the power of -chaining functions and creating pipes, which leads to not that nice interfaces. -(See the 2nd example below to see how it improved the interface in one of my -modules.) - -Check out this toy example, first you create a Lazy object: -```javascript - var Lazy = require('lazy'); - - var lazy = new Lazy; - lazy - .filter(function (item) { - return item % 2 == 0 - }) - .take(5) - .map(function (item) { - return item*2; - }) - .join(function (xs) { - console.log(xs); - }); -``` - -This code says that 'lazy' is going to be a lazy list that filters even -numbers, takes first five of them, then multiplies all of them by 2, and then -calls the join function (think of join as in threads) on the final list. - -And now you can emit 'data' events with data in them at some point later, -```javascript - [0,1,2,3,4,5,6,7,8,9,10].forEach(function (x) { - lazy.emit('data', x); - }); -``` - -The output will be produced by the 'join' function, which will output the -expected [0, 4, 8, 12, 16]. - -And here is a real-world example. Some time ago I wrote a hash database for -node.js called node-supermarket (think of key-value store except greater). Now -it had a similar interface as a list, you could .forEach on the stored -elements, .filter them, etc. But being asynchronous in nature it lead to the -following code, littered with callbacks and temporary lists: -```javascript - var Store = require('supermarket'); - - var db = new Store({ filename : 'users.db', json : true }); - - var users_over_20 = []; - db.filter( - function (user, meta) { - // predicate function - return meta.age > 20; - }, - function (err, user, meta) { - // function that gets executed when predicate is true - if (users_over_20.length < 5) - users_over_20.push(meta); - }, - function () { - // done function, called when all records have been filtered - - // now do something with users_over_20 - } - ) -``` -This code selects first five users who are over 20 years old and stores them -in users_over_20. - -But now we changed the node-supermarket interface to return lazy lists, and -the code became: -```javascript - var Store = require('supermarket'); - - var db = new Store({ filename : 'users.db', json : true }); - - db.filter(function (user, meta) { - return meta.age > 20; - }) - .take(5) - .join(function (xs) { - // xs contains the first 5 users who are over 20! - }); -``` -This is so much nicer! - -Here is the latest feature: .lines. Given a stream of data that has \n's in it, -.lines converts that into a list of lines. - -Here is an example from node-iptables that I wrote the other week, -```javascript - var Lazy = require('lazy'); - var spawn = require('child_process').spawn; - var iptables = spawn('iptables', ['-L', '-n', '-v']); - - Lazy(iptables.stdout) - .lines - .map(String) - .skip(2) // skips the two lines that are iptables header - .map(function (line) { - // packets, bytes, target, pro, opt, in, out, src, dst, opts - var fields = line.trim().split(/\s+/, 9); - return { - parsed : { - packets : fields[0], - bytes : fields[1], - target : fields[2], - protocol : fields[3], - opt : fields[4], - in : fields[5], - out : fields[6], - src : fields[7], - dst : fields[8] - }, - raw : line.trim() - }; - }); -``` -This example takes the `iptables -L -n -v` command and uses .lines on its output. -Then it .skip's two lines from input and maps a function on all other lines that -creates a data structure from the output. - - -# Documentation - -Supports the following operations: - -* lazy.filter(f) -* lazy.forEach(f) -* lazy.map(f) -* lazy.take(n) -* lazy.takeWhile(f) -* lazy.bucket(init, f) -* lazy.lines -* lazy.sum(f) -* lazy.product(f) -* lazy.foldr(op, i, f) -* lazy.skip(n) -* lazy.head(f) -* lazy.tail(f) -* lazy.join(f) - -The Lazy object itself has a .range property for generating all the possible ranges. - -Here are several examples: - -* Lazy.range('10..') - infinite range starting from 10 -* Lazy.range('(10..') - infinite range starting from 11 -* Lazy.range(10) - range from 0 to 9 -* Lazy.range(-10, 10) - range from -10 to 9 (-10, -9, ... 0, 1, ... 9) -* Lazy.range(-10, 10, 2) - range from -10 to 8, skipping every 2nd element (-10, -8, ... 0, 2, 4, 6, 8) -* Lazy.range(10, 0, 2) - reverse range from 10 to 1, skipping every 2nd element (10, 8, 6, 4, 2) -* Lazy.range(10, 0) - reverse range from 10 to 1 -* Lazy.range('5..50') - range from 5 to 49 -* Lazy.range('50..44') - range from 50 to 45 -* Lazy.range('1,1.1..4') - range from 1 to 4 with increment of 0.1 (1, 1.1, 1.2, ... 3.9) -* Lazy.range('4,3.9..1') - reverse range from 4 to 1 with decerement of 0.1 -* Lazy.range('[1..10]') - range from 1 to 10 (all inclusive) -* Lazy.range('[10..1]') - range from 10 to 1 (all inclusive) -* Lazy.range('[1..10)') - range grom 1 to 9 -* Lazy.range('[10..1)') - range from 10 to 2 -* Lazy.range('(1..10]') - range from 2 to 10 -* Lazy.range('(10..1]') - range from 9 to 1 -* Lazy.range('(1..10)') - range from 2 to 9 -* Lazy.range('[5,10..50]') - range from 5 to 50 with a step of 5 (all inclusive) - -Then you can use other lazy functions on these ranges. - - diff --git a/node_modules/lazy/lazy.js b/node_modules/lazy/lazy.js deleted file mode 100644 index 08a01e7..0000000 --- a/node_modules/lazy/lazy.js +++ /dev/null @@ -1,349 +0,0 @@ -var EventEmitter = require('events').EventEmitter; -var util = require('util'); -var stream = require('stream'); - -function Lazy(em, opts) { - if (!(this instanceof Lazy)) return new Lazy(em, opts); - EventEmitter.call(this); - var self = this; - - - self.once = function (name, f) { - self.on(name, function g () { - self.removeListener(name, g); - f.apply(this, arguments); - }); - } - - if (!opts) opts = {}; - var dataName = opts.data || 'data'; - var pipeName = opts.pipe || 'pipe'; - var endName = opts.pipe || 'end'; - - if (pipeName != endName) { - var piped = false; - self.once(pipeName, function () { piped = true }); - self.once(endName, function () { - if (!piped) self.emit(pipeName); - }); - } - - self.push = function (x) { - self.emit(dataName, x); - } - - self.end = function () { - self.emit(endName); - } - - if (em && em.on) { - em.on(endName, function () { - self.emit(endName); - }); - self.on(pipeName, function () { - em.emit(pipeName); - }); - // Check for v0.10 or Greater (Stream2 has Duplex type) - if (stream.Duplex && em instanceof(stream)) { - em.on('readable', function () { - var x = em.read(); - self.emit(dataName, x); - }); - } else { - // Old Stream1 or Event support - em.on(dataName, function (x) { - self.emit(dataName, x); - }); - } - } - - function newLazy (g, h, l) { - if (!g) { - g = function () { - return true; - }; - } - if (!h) { - h = function (x) { - return x; - }; - } - var lazy = new Lazy(null, opts, l); - self.on(dataName, function (x, y) { - if (g.call(lazy, x)) { - lazy.emit(dataName, h(x), y); - } - }); - self.once(pipeName, function () { - lazy.emit(pipeName); - }); - return lazy; - } - - self.filter = function (f) { - return newLazy(function (x) { - return f(x); - }); - } - - self.forEach = function (f) { - return newLazy(function (x) { - f(x); - return true; - }); - } - - self.map = function (f) { - return newLazy( - function () { return true }, - function (x) { return f(x) } - ); - } - - self.head = function (f) { - var lazy = newLazy(); - lazy.on(dataName, function g (x) { - f(x) - lazy.removeListener(dataName, g) - }) - } - - self.tail = function () { - var skip = true; - return newLazy(function () { - if (skip) { - skip = false; - return false; - } - return true; - }); - } - - self.skip = function (n) { - return newLazy(function () { - if (n > 0) { - n--; - return false; - } - return true; - }); - } - - self.take = function (n) { - return newLazy(function () { - if (n == 0) self.emit(pipeName); - return n-- > 0; - }); - } - - self.takeWhile = function (f) { - var cond = true; - return newLazy(function (x) { - if (cond && f(x)) return true; - cond = false; - self.emit(pipeName); - return false; - }); - } - - self.foldr = function (op, i, f) { - var acc = i; - var lazy = newLazy(); - lazy.on(dataName, function g (x) { - acc = op(x, acc); - }); - lazy.once(pipeName, function () { - f(acc); - }); - } - - self.sum = function (f) { - return self.foldr(function (x, acc) { return x + acc }, 0, f); - } - - self.product = function (f) { - return self.foldr(function (x, acc) { return x*acc }, 1, f); - } - - self.join = function (f) { - var data = [] - var lazy = newLazy(function (x) { - data.push(x); - return true; - }); - lazy.once(pipeName, function () { f(data) }); - return self; - } - - self.bucket = function (init, f) { - var lazy = new Lazy(null, opts); - var yieldTo = function (x) { - lazy.emit(dataName, x); - }; - - var acc = init; - - self.on(dataName, function (x) { - acc = f.call(yieldTo, acc, x); - }); - - self.once(pipeName, function () { - lazy.emit(pipeName); - }); - - // flush on end event - self.once(endName, function () { - var finalBuffer = mergeBuffers(acc); - if (finalBuffer) { - yieldTo(finalBuffer); - } - }); - - return lazy; - } - - // Streams that use this should emit strings or buffers only - self.__defineGetter__('lines', function () { - return self.bucket([], function (chunkArray, chunk) { - var newline = '\n'.charCodeAt(0), lastNewLineIndex = 0; - if (typeof chunk === 'string') chunk = new Buffer(chunk); - if (chunk){ - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === newline) { - // If we have content from the current chunk to append to our buffers, do it. - if (i > 0) { - chunkArray.push(chunk.slice(lastNewLineIndex, i)); - } - - // Wrap all our buffers and emit it. - this(mergeBuffers(chunkArray)); - lastNewLineIndex = i + 1; - } - } - } - - if (lastNewLineIndex > 0) { - // New line found in the chunk, push the remaining part of the buffer. - if (lastNewLineIndex < chunk.length) { - chunkArray.push(chunk.slice(lastNewLineIndex)); - } - } else { - // No new line found, push the whole buffer. - if (chunk && chunk.length) { - chunkArray.push(chunk); - } - } - return chunkArray; - }); - }); -} - -Lazy.range = function () { - var args = arguments; - var step = 1; - var infinite = false; - - if (args.length == 1 && typeof args[0] == 'number') { - var i = 0, j = args[0]; - } - else if (args.length == 1 && typeof args[0] == 'string') { // 'start[,next]..[end]' - var arg = args[0]; - var startOpen = false, endClosed = false; - if (arg[0] == '(' || arg[0] == '[') { - if (arg[0] == '(') startOpen = true; - arg = arg.slice(1); - } - if (arg.slice(-1) == ']') endClosed = true; - - var parts = arg.split('..'); - if (parts.length != 2) - throw new Error("single argument range takes 'start..' or 'start..end' or 'start,next..end'"); - - if (parts[1] == '') { // 'start..' - var i = parts[0]; - infinite = true; - } - else { // 'start[,next]..end' - var progression = parts[0].split(','); - if (progression.length == 1) { // start..end - var i = parts[0], j = parts[1]; - } - else { // 'start,next..end' - var i = progression[0], j = parts[1]; - step = Math.abs(progression[1]-i); - } - } - - i = parseInt(i, 10); - j = parseInt(j, 10); - - if (startOpen) { - if (infinite || i < j) i++; - else i--; - } - - if (endClosed) { - if (i < j) j++; - else j--; - } - } - else if (args.length == 2 || args.length == 3) { // start, end[, step] - var i = args[0], j = args[1]; - if (args.length == 3) { - var step = args[2]; - } - } - else { - throw new Error("range takes 1, 2 or 3 arguments"); - } - var lazy = new Lazy; - var stopInfinite = false; - lazy.on('pipe', function () { - stopInfinite = true; - }); - if (infinite) { - process.nextTick(function g () { - if (stopInfinite) return; - lazy.emit('data', i++); - process.nextTick(g); - }); - } - else { - process.nextTick(function () { - if (i < j) { - for (; ij; i-=step) { - lazy.emit('data', i) - } - } - lazy.emit('end'); - }); - } - return lazy; -} - -var mergeBuffers = function mergeBuffers(buffers) { - // We expect buffers to be a non-empty Array - if (!buffers || !Array.isArray(buffers) || !buffers.length) return; - - var finalBufferLength, finalBuffer, currentBuffer, currentSize = 0; - - // Sum all the buffers lengths - finalBufferLength = buffers.reduce(function(left, right) { return (left.length||left) + (right.length||right); }, 0); - finalBuffer = new Buffer(finalBufferLength); - while(buffers.length) { - currentBuffer = buffers.shift(); - currentBuffer.copy(finalBuffer, currentSize); - currentSize += currentBuffer.length; - } - - return finalBuffer; -} - - -util.inherits(Lazy, EventEmitter); -module.exports = Lazy; diff --git a/node_modules/lazy/lazy.js~ b/node_modules/lazy/lazy.js~ deleted file mode 100644 index fbdf2a4..0000000 --- a/node_modules/lazy/lazy.js~ +++ /dev/null @@ -1,348 +0,0 @@ -var EventEmitter = require('events').EventEmitter; -var util = require('util'); -var stream = require('stream'); - -function Lazy(em, opts) { - if (!(this instanceof Lazy)) return new Lazy(em, opts); - EventEmitter.call(this); - var self = this; - - - self.once = function (name, f) { - self.on(name, function g () { - self.removeListener(name, g); - f.apply(this, arguments); - }); - } - - if (!opts) opts = {}; - var dataName = opts.data || 'data'; - var pipeName = opts.pipe || 'pipe'; - var endName = opts.pipe || 'end'; - - if (pipeName != endName) { - var piped = false; - self.once(pipeName, function () { piped = true }); - self.once(endName, function () { - if (!piped) self.emit(pipeName); - }); - } - - self.push = function (x) { - self.emit(dataName, x); - } - - self.end = function () { - self.emit(endName); - } - - if (em && em.on) { - em.on(endName, function () { - self.emit(endName); - }); - self.on(pipeName, function () { - em.emit(pipeName); - }); - // Check for v0.10 or Greater (Stream2 has Duplex type) - if (stream.Duplex && em instanceof(stream)) { - em.on('readable', function () { - var x = em.read(); - self.emit(dataName, x); - }); - } else { - // Old Stream1 or Event support - em.on(dataName, function (x) { - self.emit(dataName, x); - }); - } - } - - function newLazy (g, h, l) { - if (!g) { - g = function () { - return true; - }; - } - if (!h) { - h = function (x) { - return x; - }; - } - var lazy = new Lazy(null, opts, l); - self.on(dataName, function (x, y) { - if (g.call(lazy, x)) { - lazy.emit(dataName, h(x), y); - } - }); - self.once(pipeName, function () { - lazy.emit(pipeName); - }); - return lazy; - } - - self.filter = function (f) { - return newLazy(function (x) { - return f(x); - }); - } - - self.forEach = function (f) { - return newLazy(function (x) { - f(x); - return true; - }); - } - - self.map = function (f) { - return newLazy( - function () { return true }, - function (x) { return f(x) } - ); - } - - self.head = function (f) { - var lazy = newLazy(); - lazy.on(dataName, function g (x) { - f(x) - lazy.removeListener(dataName, g) - }) - } - - self.tail = function () { - var skip = true; - return newLazy(function () { - if (skip) { - skip = false; - return false; - } - return true; - }); - } - - self.skip = function (n) { - return newLazy(function () { - if (n > 0) { - n--; - return false; - } - return true; - }); - } - - self.take = function (n) { - return newLazy(function () { - if (n == 0) self.emit(pipeName); - return n-- > 0; - }); - } - - self.takeWhile = function (f) { - var cond = true; - return newLazy(function (x) { - if (cond && f(x)) return true; - cond = false; - self.emit(pipeName); - return false; - }); - } - - self.foldr = function (op, i, f) { - var acc = i; - var lazy = newLazy(); - lazy.on(dataName, function g (x) { - acc = op(x, acc); - }); - lazy.once(pipeName, function () { - f(acc); - }); - } - - self.sum = function (f) { - return self.foldr(function (x, acc) { return x + acc }, 0, f); - } - - self.product = function (f) { - return self.foldr(function (x, acc) { return x*acc }, 1, f); - } - - self.join = function (f) { - var data = [] - var lazy = newLazy(function (x) { - data.push(x); - return true; - }); - lazy.once(pipeName, function () { f(data) }); - return self; - } - - self.bucket = function (init, f) { - var lazy = new Lazy(null, opts); - var yieldTo = function (x) { - lazy.emit(dataName, x); - }; - - var acc = init; - - self.on(dataName, function (x) { - acc = f.call(yieldTo, acc, x); - }); - - self.once(pipeName, function () { - lazy.emit(pipeName); - }); - - // flush on end event - self.once(endName, function () { - var finalBuffer = mergeBuffers(acc); - if (finalBuffer) { - yieldTo(finalBuffer); - } - }); - - return lazy; - } - - // Streams that use this should emit strings or buffers only - self.__defineGetter__('lines', function () { - return self.bucket([], function (chunkArray, chunk) { - var newline = '\n'.charCodeAt(0), lastNewLineIndex = 0; - if (typeof chunk === 'string') chunk = new Buffer(chunk); - - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === newline) { - // If we have content from the current chunk to append to our buffers, do it. - if (i > 0) { - chunkArray.push(chunk.slice(lastNewLineIndex, i)); - } - - // Wrap all our buffers and emit it. - this(mergeBuffers(chunkArray)); - lastNewLineIndex = i + 1; - } - } - - if (lastNewLineIndex > 0) { - // New line found in the chunk, push the remaining part of the buffer. - if (lastNewLineIndex < chunk.length) { - chunkArray.push(chunk.slice(lastNewLineIndex)); - } - } else { - // No new line found, push the whole buffer. - if (chunk.length) { - chunkArray.push(chunk); - } - } - return chunkArray; - }); - }); -} - -Lazy.range = function () { - var args = arguments; - var step = 1; - var infinite = false; - - if (args.length == 1 && typeof args[0] == 'number') { - var i = 0, j = args[0]; - } - else if (args.length == 1 && typeof args[0] == 'string') { // 'start[,next]..[end]' - var arg = args[0]; - var startOpen = false, endClosed = false; - if (arg[0] == '(' || arg[0] == '[') { - if (arg[0] == '(') startOpen = true; - arg = arg.slice(1); - } - if (arg.slice(-1) == ']') endClosed = true; - - var parts = arg.split('..'); - if (parts.length != 2) - throw new Error("single argument range takes 'start..' or 'start..end' or 'start,next..end'"); - - if (parts[1] == '') { // 'start..' - var i = parts[0]; - infinite = true; - } - else { // 'start[,next]..end' - var progression = parts[0].split(','); - if (progression.length == 1) { // start..end - var i = parts[0], j = parts[1]; - } - else { // 'start,next..end' - var i = progression[0], j = parts[1]; - step = Math.abs(progression[1]-i); - } - } - - i = parseInt(i, 10); - j = parseInt(j, 10); - - if (startOpen) { - if (infinite || i < j) i++; - else i--; - } - - if (endClosed) { - if (i < j) j++; - else j--; - } - } - else if (args.length == 2 || args.length == 3) { // start, end[, step] - var i = args[0], j = args[1]; - if (args.length == 3) { - var step = args[2]; - } - } - else { - throw new Error("range takes 1, 2 or 3 arguments"); - } - var lazy = new Lazy; - var stopInfinite = false; - lazy.on('pipe', function () { - stopInfinite = true; - }); - if (infinite) { - process.nextTick(function g () { - if (stopInfinite) return; - lazy.emit('data', i++); - process.nextTick(g); - }); - } - else { - process.nextTick(function () { - if (i < j) { - for (; ij; i-=step) { - lazy.emit('data', i) - } - } - lazy.emit('end'); - }); - } - return lazy; -} - -var mergeBuffers = function mergeBuffers(buffers) { - // We expect buffers to be a non-empty Array - if (!buffers || !Array.isArray(buffers) || !buffers.length) return; - - var finalBufferLength, finalBuffer, currentBuffer, currentSize = 0; - - // Sum all the buffers lengths - finalBufferLength = buffers.reduce(function(left, right) { return (left.length||left) + (right.length||right); }, 0); - finalBuffer = new Buffer(finalBufferLength); - while(buffers.length) { - currentBuffer = buffers.shift(); - currentBuffer.copy(finalBuffer, currentSize); - currentSize += currentBuffer.length; - } - - return finalBuffer; -} - - -util.inherits(Lazy, EventEmitter); -module.exports = Lazy; diff --git a/node_modules/lazy/package.json b/node_modules/lazy/package.json deleted file mode 100644 index 5686143..0000000 --- a/node_modules/lazy/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "lazy", - "version": "1.0.11", - "description": "Lazy lists for node", - "main": "./lazy.js", - "keywords": [ - "lazy lists", - "functional" - ], - "author": { - "name": "Peteris Krumins", - "email": "peteris.krumins@gmail.com", - "url": "http://www.catonmat.net" - }, - "license": { - "type": "MIT" - }, - "repository": { - "type": "git", - "url": "http://github.com/pkrumins/node-lazy.git" - }, - "devDependencies": { - "expresso": ">=0.7.5" - }, - "engines": { - "node": ">=0.2.0" - }, - "scripts": { - "test": "expresso" - }, - "readme": "Lazy lists for node\n===================\n\n\n# Table of contents:\n\n[Introduction](#Introduction)\n \n[Documentation](#Documentation)\n\n\n# Introduction\nLazy comes really handy when you need to treat a stream of events like a list.\nThe best use case currently is returning a lazy list from an asynchronous\nfunction, and having data pumped into it via events. In asynchronous\nprogramming you can't just return a regular list because you don't yet have\ndata for it. The usual solution so far has been to provide a callback that gets\ncalled when the data is available. But doing it this way you lose the power of\nchaining functions and creating pipes, which leads to not that nice interfaces.\n(See the 2nd example below to see how it improved the interface in one of my\nmodules.)\n\nCheck out this toy example, first you create a Lazy object:\n```javascript\n var Lazy = require('lazy');\n\n var lazy = new Lazy;\n lazy\n .filter(function (item) {\n return item % 2 == 0\n })\n .take(5)\n .map(function (item) {\n return item*2;\n })\n .join(function (xs) {\n console.log(xs);\n });\n```\n\nThis code says that 'lazy' is going to be a lazy list that filters even\nnumbers, takes first five of them, then multiplies all of them by 2, and then\ncalls the join function (think of join as in threads) on the final list.\n\nAnd now you can emit 'data' events with data in them at some point later,\n```javascript\n [0,1,2,3,4,5,6,7,8,9,10].forEach(function (x) {\n lazy.emit('data', x);\n });\n```\n\nThe output will be produced by the 'join' function, which will output the\nexpected [0, 4, 8, 12, 16].\n\nAnd here is a real-world example. Some time ago I wrote a hash database for\nnode.js called node-supermarket (think of key-value store except greater). Now\nit had a similar interface as a list, you could .forEach on the stored\nelements, .filter them, etc. But being asynchronous in nature it lead to the\nfollowing code, littered with callbacks and temporary lists:\n```javascript\n var Store = require('supermarket');\n\n var db = new Store({ filename : 'users.db', json : true });\n\n var users_over_20 = [];\n db.filter(\n function (user, meta) {\n // predicate function\n return meta.age > 20;\n },\n function (err, user, meta) {\n // function that gets executed when predicate is true\n if (users_over_20.length < 5)\n users_over_20.push(meta);\n },\n function () {\n // done function, called when all records have been filtered\n\n // now do something with users_over_20\n }\n )\n```\nThis code selects first five users who are over 20 years old and stores them\nin users_over_20.\n\nBut now we changed the node-supermarket interface to return lazy lists, and\nthe code became:\n```javascript\n var Store = require('supermarket');\n\n var db = new Store({ filename : 'users.db', json : true });\n\n db.filter(function (user, meta) {\n return meta.age > 20;\n })\n .take(5)\n .join(function (xs) {\n // xs contains the first 5 users who are over 20!\n });\n```\nThis is so much nicer!\n\nHere is the latest feature: .lines. Given a stream of data that has \\n's in it,\n.lines converts that into a list of lines.\n\nHere is an example from node-iptables that I wrote the other week,\n```javascript\n var Lazy = require('lazy');\n var spawn = require('child_process').spawn;\n var iptables = spawn('iptables', ['-L', '-n', '-v']);\n\n Lazy(iptables.stdout)\n .lines\n .map(String)\n .skip(2) // skips the two lines that are iptables header\n .map(function (line) {\n // packets, bytes, target, pro, opt, in, out, src, dst, opts\n var fields = line.trim().split(/\\s+/, 9);\n return {\n parsed : {\n packets : fields[0],\n bytes : fields[1],\n target : fields[2],\n protocol : fields[3],\n opt : fields[4],\n in : fields[5],\n out : fields[6],\n src : fields[7],\n dst : fields[8]\n },\n raw : line.trim()\n };\n });\n```\nThis example takes the `iptables -L -n -v` command and uses .lines on its output.\nThen it .skip's two lines from input and maps a function on all other lines that\ncreates a data structure from the output.\n\n\n# Documentation\n\nSupports the following operations:\n\n* lazy.filter(f)\n* lazy.forEach(f)\n* lazy.map(f)\n* lazy.take(n)\n* lazy.takeWhile(f)\n* lazy.bucket(init, f)\n* lazy.lines\n* lazy.sum(f)\n* lazy.product(f)\n* lazy.foldr(op, i, f)\n* lazy.skip(n)\n* lazy.head(f)\n* lazy.tail(f)\n* lazy.join(f)\n\nThe Lazy object itself has a .range property for generating all the possible ranges.\n\nHere are several examples:\n\n* Lazy.range('10..') - infinite range starting from 10\n* Lazy.range('(10..') - infinite range starting from 11\n* Lazy.range(10) - range from 0 to 9\n* Lazy.range(-10, 10) - range from -10 to 9 (-10, -9, ... 0, 1, ... 9)\n* Lazy.range(-10, 10, 2) - range from -10 to 8, skipping every 2nd element (-10, -8, ... 0, 2, 4, 6, 8)\n* Lazy.range(10, 0, 2) - reverse range from 10 to 1, skipping every 2nd element (10, 8, 6, 4, 2)\n* Lazy.range(10, 0) - reverse range from 10 to 1\n* Lazy.range('5..50') - range from 5 to 49\n* Lazy.range('50..44') - range from 50 to 45\n* Lazy.range('1,1.1..4') - range from 1 to 4 with increment of 0.1 (1, 1.1, 1.2, ... 3.9)\n* Lazy.range('4,3.9..1') - reverse range from 4 to 1 with decerement of 0.1\n* Lazy.range('[1..10]') - range from 1 to 10 (all inclusive)\n* Lazy.range('[10..1]') - range from 10 to 1 (all inclusive)\n* Lazy.range('[1..10)') - range grom 1 to 9\n* Lazy.range('[10..1)') - range from 10 to 2\n* Lazy.range('(1..10]') - range from 2 to 10\n* Lazy.range('(10..1]') - range from 9 to 1\n* Lazy.range('(1..10)') - range from 2 to 9\n* Lazy.range('[5,10..50]') - range from 5 to 50 with a step of 5 (all inclusive)\n\nThen you can use other lazy functions on these ranges.\n\n\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/pkrumins/node-lazy/issues" - }, - "_id": "lazy@1.0.11", - "_from": "lazy@~1.0.9" -} diff --git a/node_modules/lazy/package.json~ b/node_modules/lazy/package.json~ deleted file mode 100644 index d1762a1..0000000 --- a/node_modules/lazy/package.json~ +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "lazy", - "version": "1.0.10", - "description": "Lazy lists for node", - "main": "./lazy.js", - "keywords": [ - "lazy lists", "functional" - ], - "author": { - "name": "Peteris Krumins", - "email": "peteris.krumins@gmail.com", - "web": "http://www.catonmat.net", - "twitter": "pkrumins" - }, - "license": { - "type": "MIT" - }, - "repository": { - "type": "git", - "url": "http://github.com/pkrumins/node-lazy.git" - }, - "devDependencies" : { - "expresso" : ">=0.7.5" - }, - "engines": { - "node": ">=0.2.0" - }, - "scripts": { - "test": "expresso" - } -} - diff --git a/node_modules/lazy/test/bucket.js b/node_modules/lazy/test/bucket.js deleted file mode 100644 index b1efdac..0000000 --- a/node_modules/lazy/test/bucket.js +++ /dev/null @@ -1,37 +0,0 @@ -var assert = require('assert'); -var Lazy = require('..'); - -exports.bucket = function () { - var joined = false; - var lazy = new Lazy; - lazy.bucket('', function splitter (acc, x) { - var accx = acc + x; - var i = accx.indexOf('\n'); - if (i >= 0) { - this(accx.slice(0, i)); - return splitter.call(this, accx.slice(i + 1), ''); - } - return accx; - }).join(function (lines) { - assert.deepEqual(lines, 'foo bar baz quux moo'.split(' ')); - joined = true; - }); - - setTimeout(function () { - lazy.emit('data', 'foo\nba'); - }, 50); - setTimeout(function () { - lazy.emit('data', 'r'); - }, 100); - setTimeout(function () { - lazy.emit('data', '\nbaz\nquux\nm'); - }, 150); - setTimeout(function () { - lazy.emit('data', 'oo'); - }, 200); - setTimeout(function () { - lazy.emit('data', '\nzoom'); - lazy.emit('end'); - assert.ok(joined); - }, 250); -}; diff --git a/node_modules/lazy/test/complex.js b/node_modules/lazy/test/complex.js deleted file mode 100644 index f79d619..0000000 --- a/node_modules/lazy/test/complex.js +++ /dev/null @@ -1,52 +0,0 @@ -var assert = require('assert'); -var Lazy = require('..'); -var expresso = expresso; - -function range(i, j) { - var r = []; - for (;i 5 }).join(function (xs) { - assert.deepEqual(xs, [6,7,8,9]); - executed = true; - }); - - range(0,10).forEach(function (x) { - lazy.emit('data', x); - }); - lazy.emit('pipe'); - - assert.ok(executed, 'join didn\'t execute'); -} - diff --git a/node_modules/lazy/test/foldr.js b/node_modules/lazy/test/foldr.js deleted file mode 100644 index 407fa30..0000000 --- a/node_modules/lazy/test/foldr.js +++ /dev/null @@ -1,26 +0,0 @@ -var assert = require('assert'); -var Lazy = require('..'); -var expresso = expresso; - -function range(i, j) { - var r = []; - for (;i 0); - }) - .join(function (lines) { - assert.deepEqual( - lines.map(function (x) { return x.toString() }), - 'foo bar baz quux moo'.split(' ') - ); - joined = true; - }); - ; - - setTimeout(function () { - lazy.push(new Buffer('foo\nbar')); - lazy.push(new Buffer('\nbaz\nquux\nmoo')); - lazy.push(new Buffer('')); - lazy.push(new Buffer('\ndoom')); - lazy.end(); - assert.ok(joined); - }, 50); -}; - -exports['string lines'] = function () { - var lazy = Lazy(); - var joined = false; - lazy.lines - .forEach(function (line) { - assert.ok(line instanceof Buffer); - assert.ok(!line.toString().match(/\n/)); - assert.ok(line.length > 0); - }) - .join(function (lines) { - assert.deepEqual( - lines.map(function (x) { return x.toString() }), - 'foo bar baz quux moo'.split(' ') - ); - joined = true; - }); - ; - - setTimeout(function () { - lazy.push('foo\nbar'); - lazy.push('\nbaz\nquux\nmoo'); - lazy.push(''); - lazy.push('\ndoom'); - lazy.end(); - assert.ok(joined); - }, 50); -}; - -exports.endStream = function () { - var to = setTimeout(function () { - assert.fail('never finished'); - }, 2500); - - var em = new EventEmitter; - var i = 0; - var lines = []; - Lazy(em).lines.forEach(function (line) { - i ++; - lines.push(line); - if (i == 2) { - clearTimeout(to); - assert.eql(lines.map(String), [ 'foo', 'bar' ]); - } - }); - - setTimeout(function () { - em.emit('data', 'fo'); - }, 100); - - setTimeout(function () { - em.emit('data', 'o\nbar'); - }, 150); - - setTimeout(function () { - em.emit('end'); - }, 200); -}; diff --git a/node_modules/lazy/test/map.js b/node_modules/lazy/test/map.js deleted file mode 100644 index a3010ef..0000000 --- a/node_modules/lazy/test/map.js +++ /dev/null @@ -1,29 +0,0 @@ -var assert = require('assert'); -var Lazy = require('..'); -var expresso = expresso; - -function range(i, j) { - var r = []; - for (;i i) for (;ij;i-=s) r.push(i); - return r; -} - -exports['infinite range'] = function () { - var joinExecuted = false; - Lazy.range('10..').take(10).join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(10, 20)); - assert.equal(xs.length, 10); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['infinite range half-open'] = function () { - var joinExecuted = false; - Lazy.range('(10..').take(10).join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(11, 21)); - assert.equal(xs.length, 10); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range i'] = function () { - var joinExecuted = false; - Lazy.range(10).join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(0, 10)); - assert.equal(xs.length, 10); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range i,j (ij)'] = function () { - var joinExecuted = false; - Lazy.range(10, 0, 2).join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(10, 0, 2)); - assert.equal(xs.length, 5); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range i,j (i>j)'] = function () { - var joinExecuted = false; - Lazy.range(10, -8).join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(10, -8)); - assert.equal(xs.length, 18); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range i..j (ij)'] = function () { - var joinExecuted = false; - Lazy.range('50..44').join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(50, 44)); - assert.equal(xs.length, 6); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range i,next..j (ij)'] = function () { - var joinExecuted = false; - Lazy.range('4,3.9..1').join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(4,1,0.1)); - assert.equal(xs.length, 30); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range [i..j] (ij)'] = function () { - var joinExecuted = false; - Lazy.range('[10..1]').join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(10,0)); - assert.equal(xs.length, 10); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range [i..j) (ij)'] = function () { - var joinExecuted = false; - Lazy.range('[10..1)').join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(10,1)); - assert.equal(xs.length, 9); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range (i..j] (ij)'] = function () { - var joinExecuted = false; - Lazy.range('(10..1]').join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(9,0)); - assert.equal(xs.length, 9); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range (i..j) (ij)'] = function () { - var joinExecuted = false; - Lazy.range('(10..1)').join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(9,1)); - assert.equal(xs.length, 8); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - -exports['range [i,step..j]'] = function () { - var joinExecuted = false; - Lazy.range('[5,10..50]').join(function (xs) { - joinExecuted = true; - assert.deepEqual(xs, range(5,51,5)); - assert.equal(xs.length, 10); - }); - - setTimeout(function () { - assert.ok(joinExecuted, 'join didn\'t execute'); - }, 2000); -} - diff --git a/node_modules/lazy/test/skip.js b/node_modules/lazy/test/skip.js deleted file mode 100644 index a7714ee..0000000 --- a/node_modules/lazy/test/skip.js +++ /dev/null @@ -1,27 +0,0 @@ -var assert = require('assert'); -var Lazy = require('..'); -var expresso = expresso; - -function range(i, j) { - var r = []; - for (;i1.4.0", "express": "~3.1.0", + "iced-coffee-script": "1.6.3-b", "jade": "~0.28.2", - "lazy": "~1.0.9" + "mkdirp": "^0.5.0", + "node-lixian": "^1.0.5", + "request": "^2.44.0", + "status-bar": "^2.0.1" }, "bin": { "lixian-portal": "./bin/lixian-portal" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "fetch-xunlei-lixian": "rm -Rf xunlei-lixian && mkdir xunlei-lixian && curl -L https://github.com/iambus/xunlei-lixian/archive/master.tar.gz | tar -xz --strip-component 1 -C xunlei-lixian", "start": "node index.js" }, "main": "bin/lixian-portal", @@ -23,6 +25,5 @@ }, "author": "Michael Yin", "license": "BSD", - "readmeFilename": "README.md", - "gitHead": "6bdc29c4643ed1bc9e540ad481e2693018f748c9" + "readmeFilename": "README.md" } diff --git a/views/error.jade b/views/error.jade index 2758ac9..9103371 100644 --- a/views/error.jade +++ b/views/error.jade @@ -2,5 +2,8 @@ extends layout block content .alert.alert-warning h1 操作失败⋯⋯ - =error.message - a.btn.btn-primary(href='.') 返回 \ No newline at end of file + if error.message + = error.message + else + |#{error.stderr}; #{error.stdout} + a.btn.btn-primary(href='.') 返回 diff --git a/views/layout.jade b/views/layout.jade index 983d69b..823192f 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -12,9 +12,6 @@ html body .container h1 lixian... - if info.stats.task - h6 正在进行任务: #{info.stats.task.name} - h6 取回速度: #{info.stats.speed} .row .col-lg-12 block content diff --git a/views/login.jade b/views/login.jade index cb0b0e5..af0437e 100644 --- a/views/login.jade +++ b/views/login.jade @@ -12,7 +12,7 @@ block content .form-group input.form-control(name='vcode',type='text',placeholder='验证码') .form-group - img(src="data:image/jpeg;base64,#{info.stats.requireVerificationCode}") + img(src=info.stats.requireVerificationCode) .form-group button.btn.btn-primary(type='submit') i.icon-signin diff --git a/views/tasks.jade b/views/tasks.jade index dcdda02..51063d5 100644 --- a/views/tasks.jade +++ b/views/tasks.jade @@ -1,11 +1,30 @@ extends layout block content + script. + $(function(){ + var fn = function(){ + $.get('.', function(data){ + $('#stats').html($('#stats', data).html()); + $('#tasks').html($('#tasks', data).html()); + $('#queue').html($('#queue', data).html()); + $('#log').html($('#log', data).html()); + setTimeout(fn, 500); + }); + }; + fn(); + }); + #stats + if info.stats.executings.length + h6 正在进行任务: + ul + for executing in info.stats.executings + li #{executing} + + if info.stats.retrieving + h6 取回速度: #{info.stats.retrieving.format.speed(info.stats.retrieving.progress.speed)} form.form-inline(method='post',action='/', enctype='multipart/form-data',style='margin-bottom: 0.5em;') .pull-right .btn-group - a.btn.btn-info(href='/') - i.icon-refresh - |刷新 a.btn.btn-danger(href='/logout') i.icon-signout |登出 @@ -20,32 +39,34 @@ block content label input(name='bt',type='checkbox',accept='*/torrent',onclick='$(".url").toggle()') | BT任务 - table.table + table.table#tasks tr + th th 任务状态 th 取回状态 th 文件名 th 操作 for task in info.stats.tasks - tr(class=task.status) - td=task.statusLabel + tr + td(colspan=4) #{task.name} td - if info.stats.retrieving && info.stats.retrieving.task.id == task.id - .label.label-info 正在取回(#{info.stats.progress} 预计剩余时间:#{info.stats.time}) - if info.stats.error[task.id] - .label.label-error(title=info.stats.error[task.id]) 错误 - td=task.filename - td - .btn-toolbar(style='margin:0;') - .btn-group - a.btn-mini.btn.btn-danger(href='/tasks/#{task.id}?_method=delete') 删除 + a.btn-xs.btn.btn-inline.btn-danger(href='/tasks/#{task.id}?_method=delete') 删除 + for file in task.files + tr(class=file.status) + td + td=file.statusLabel + td + if info.stats.retrieving && info.stats.retrieving.file.url == file.url + .label.label-info 正在取回(#{info.stats.retrieving.format.storage(info.stats.retrieving.progress.currentSize)}, #{info.stats.retrieving.format.percentage(info.stats.retrieving.progress.percentage)} 预计剩余时间:#{info.stats.retrieving.format.time(info.stats.retrieving.progress.remainingTime)}) + td #{file.name} + td #accordion2.panel-group .panel.panel-default .panel-heading .panel-title - a.accordion-toggle(data-toggle='collapse', data-parent='#accordion2', href='#collapseOne') + a.accordion-toggle(data-toggle='collapse', data-parent='#accordion2', href='#queue') | 任务队列 - #collapseOne.panel-body.collapse.in + #queue.panel-body.collapse.in .panel-inner ul for item in info.queue @@ -53,8 +74,8 @@ block content .panel.panel-default .panel-heading .panel-title - a.accordion-toggle(data-toggle='collapse', data-parent='#accordion2', href='#collapseTwo') + a.accordion-toggle(data-toggle='collapse', data-parent='#accordion2', href='#log') | 任务日志 - #collapseTwo.panel-body.collapse + #log.panel-body.collapse .panel-inner pre=info.log.join('\n') diff --git a/xunlei-lixian/.gitignore b/xunlei-lixian/.gitignore deleted file mode 100644 index 0d20b64..0000000 --- a/xunlei-lixian/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.pyc diff --git a/xunlei-lixian/LICENSE b/xunlei-lixian/LICENSE deleted file mode 100644 index c62024a..0000000 --- a/xunlei-lixian/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -============================================== -This is a copy of the MIT license. -============================================== -Copyright (C) 2012 Boyu Guo - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/xunlei-lixian/README.md b/xunlei-lixian/README.md deleted file mode 100644 index e849e5a..0000000 --- a/xunlei-lixian/README.md +++ /dev/null @@ -1,468 +0,0 @@ -xunlei-lixian -============= -迅雷离线下载脚本。欢迎继续关注[浏览器端的迅雷离线应用](https://github.com/iambus/xunlei-lixian-web)。 - -### 声明 -迅雷离线下载为会员功能。非会员无法使用。 - -Quick start ------------ - - python lixian_cli.py login "Your Xunlei account" "Your password" - python lixian_cli.py login "Your password" - python lixian_cli.py login - - python lixian_cli.py config username "Your Xunlei account" - python lixian_cli.py config password "Your password" - - python lixian_cli.py list - python lixian_cli.py list --completed - python lixian_cli.py list --completed --name --original-url --download-url --no-status --no-id - python lixian_cli.py list --deleted - python lixian_cli.py list --expired - python lixian_cli.py list id1 id2 - python lixian_cli.py list zip rar - python lixian_cli.py list 2012.04.04 2012.04.05 - - python lixian_cli.py download task-id - python lixian_cli.py download ed2k-url - python lixian_cli.py download --tool=wget ed2k-url - python lixian_cli.py download --tool=asyn ed2k-url - python lixian_cli.py download ed2k-url --output "file to save" - python lixian_cli.py download id1 id2 id3 - python lixian_cli.py download url1 url2 url3 - python lixian_cli.py download --input download-urls-file - python lixian_cli.py download --input download-urls-file --delete - python lixian_cli.py download --input download-urls-file --output-dir root-dir-to-save-files - python lixian_cli.py download bt://torrent-info-hash - python lixian_cli.py download 1.torrent - python lixian_cli.py download torrent-info-hash - python lixian_cli.py download --bt http://xxx/xxx.torrent - python lixian_cli.py download bt-task-id/file-id - python lixian_cli.py download --all - python lixian_cli.py download mkv - python lixian_cli.py download 2012.04.04 - python lixian_cli.py download 0 1 2 - python lixian_cli.py download 0-2 - - python lixian_cli.py add url - python lixian_cli.py add 1.torrent - python lixian_cli.py add torrent-info-hash - python lixian_cli.py add --bt http://xxx/xxx.torrent - - python lixian_cli.py delete task-id - python lixian_cli.py delete url - python lixian_cli.py delete file-name-on-cloud-to-delete - - python lixian_cli.py pause id - - python lixian_cli.py restart id - - python lixian_cli.py rename id name - - python lixian_cli.py logout - -安装指南 --------- - -1. 安装git(非github用户应该只需要执行第一步Download and Install Git) - - http://help.github.com/set-up-git-redirect - -2. 下载代码(Windows用户请在git-bash里执行) - - git clone git://github.com/iambus/xunlei-lixian.git - -3. 安装Python 2.x(请下载最新的2.7版本。不支持Python 3.x。) - - http://www.python.org/getit/ - -4. 在命令行里运行 - - python lixian_cli.py - -注:不方便安装git的用户可以选择跳过前两步,在github网页上下载最新的源代码包(选择"Download as zip"或者"Download as tar.gz"): - -https://github.com/iambus/xunlei-lixian/downloads - - -一些提示 --------- - -1. 你可以为python lixian_cli.py创建一个别名(比如lx),以减少敲键次数。 - - Linux上可以使用: - - ln -s 你的lixian_cli.py路径 ~/bin/lx - - Windows上可以创建一个lx.bat脚本,放在你的PATH中: - - @echo off - python 完整的lixian_cli.py路径 %* - - 注:下文中提到的lx都是指python lixian_cli.py的别名。 - -2. 你可以使用lx config保存一些配置。见“命令详解”一节。 - - lx config delete - lx config tool asyn - lx config username your-id - lx config password your-password - - 注:密码保存的时候会加密(hash) - -3. 部分命令有短名字。lx d相当于lx download,lx a相当于lx add,lx l相当于lx list,lx x相当于lx list。也可以通过plugin api自己添加alias。 - -4. 使用lx download下载的文件会自动验证hash。其中ed2k和bt会做完整的hash校验。http下载只做部分校验。 - - 注:包含多个文件的bt种子,如果没有完整下载所有文件,对于已下载的文件,可能有少量片段无法验证。如果很重视文件的正确性请选择下载bt种子中的所有文件。(目前还没有发现由于软件问题而导致hash验证失败的情况。) - -5. 如果觉得大文件的hash速度太慢,可以关掉: - - lx download --no-hash ... - - 也可以使用lx config默认关掉它: - - lx config no-hash - -6. lx hash命令可以用于手动计算hash。见“其他工具”一节。 - - -命令详解 --------- - -注:下文中提到的lx都是指python lixian_cli.py的别名。 - -常用命令: - -* lx login -* lx download -* lx list -* lx add -* lx delete -* lx pause -* lx restart -* lx rename -* lx readd -* lx config -* lx info -* lx help - -### lx login -登录,获得一个有效session,默认保存路径是~/.xunlei.lixian.cookies。一般来说,除非服务器故障或者执行了lx logout(或者你手动删除了cookies文件),否则session的有效期是一天左右。session过期之后需要手动重新执行login。但如果使用lx config password把密码保存到配置文件里,则会自动重新登录。后文会介绍[lx config](#lx-config)。 - -lx login接受两个参数,用户名和密码。第二次登录可以只填密码。 - - lx login username password - lx login password - -如果不希望明文显示密码,也可以直接运行 - - lx login - -或者使用-代替密码 - - lx login username - - -上面的命令会进入交互式不回显的密码输入。 - -可以用--cookies指定保存的session文件路径。-表示不保存(在login这个例子里,没什么实际意义)。 - - lx login username password --cookies some-path - lx login username password --cookies - - -注意,除了lx login外,大多数lx命令,比如lx download,都需要先执行登录。这些命令大多支持--username和--password,以及--cookies参数,根据传递进来的参数,检查用户是否已经登录,如果尚未登录则尝试登录。一般来说不建议在其他命令里使用这些参数(因为麻烦),除非你不希望保存session信息到硬盘。 - -### lx download -下载。目前支持普通的http下载,ed2k下载,和bt下载。可以使用thunder/flashget/qq旋风的连接(bt任务除外)。在信息足够的情况下(见“一些提示”一节的第3条),下载的文件会自动验证hash,出错了会重新下载(我个人目前还没遇到过下载文件损坏的情况)。见“一些提示”一节的第3条。 - - lx download id - lx download http://somewhere - lx download ed2k://somefile - lx download bt://info-hash - lx download link1 link2 link3 ... - lx download --all - lx download keywords - lx download date - -对于bt任务,可以指定本地.torrent文件路径,或者torrent文件的info hash。(很多网站使用info hash来标识一个bt种子文件,这种情况你就不需要下载种子了,lx download可以自动下载种子,不过前提是之前已经有人使用迅雷离线下载过同样的种子。[如后所述](#其他工具),你也可以使用lx hash --info-hash来手动生成bt种子的info hash。) - - lx download Community.S03E01.720p.HDTV.X264-DIMENSION.torrent - lx download 61AAA3C6FBB8B71EBE2F5A2A3481296B51D882F6 - lx download bt://61AAA3C6FBB8B71EBE2F5A2A3481296B51D882F6 - -如果url本身指向了要添加任务的种子文件,需要加上--bt参数告诉lx脚本这是一个种子。 - - lx download --bt http://tvu.org.ru/torrent.php?tid=64757 - -可以把多个连接保存到文件里,使用--input参数批量下载: - - lx download --input links.txt - -注意:在断点续传的情况下,如果文件已经存在,并且文件大小相等,并且使用了--continue,重新下载并不只是简单的忽略这个文件,而是先做hash校验,如果校验通过才忽略。如果文件比较多或者比较大,可能比较耗时。建议手动从--input文件里删除已经下载过的链接。也可以使用--mini-hash参数,如下。 - -如果指定了--mini-hash参数,对于已经下载过的文件,并且文件大小正确(一般意味着这个文件的正确性已经在前一次下载中验证过了),会做一个最简单的校验。对于尚未下载完成的任务,在完成之后还是会做完整的hash。 - -如果指定了--no-hash参数,永远不会做完整的hash。但还是会做文件大小检验和取样hash(很快)。 - -可以使用--delete参数在下载完成之后删除任务。 - - lx download link --delete - -如果一个文件已经存在,使用参数--continue支持断点续传,使用--overwrite覆盖已存在的文件,重新下载。 - -你可能需要用--tool参数来指定下载工具。默认的下载工具是wget,有些环境的wget是最低功能版本,不支持指定cookie或者断点续传。这种情况可以使用--tool=asyn。这在“支持的下载工具”一节有说明。 - - lx download --tool=wget link - lx download --tool=asyn link - ---output和--output-dir分别用来指定保存文件的路径和目录。 - -如果要下载的文件尚未在离线任务里,会被自动添加。 - -你也可以使用指定要下载的任务id(lx list命令可以用来查看任务id): - - lx download task-id - -但是要注意,多任务下载的时候,不能混用id和url(以后可能会支持)。 - -类似任务id,也可以指定任务的序列号。序列号从0开始。可以使用lx list -n查看序列号。如果希望lx list默认显示序列号,可以使用lx config n。若要下载任务列表中的第一个任务: - - lx download 0 - -要下载前三个任务: - - lx download 0-2 - -对于bt任务,如果只想下载部分文件,可以在task id后指定文件id: - - lx download bt-task-id/file-id bt-task-id/file-id2 - -或者: - - lx download bt-task-id/[1,3,5-7] - -注:上面的命令下载对应bt任务里文件id为1,3,5,6,7的五个文件。 - -也可以指定bt子文件的扩展名: - - lx download bt-task-id/.mkv - -或者: - - lx download bt-task-id/[.mkv,.mp4] - -更多的用法:TODO - -可以使用--all参数下载所有的任务(如果已经在参数中指定了要下载的链接或者任务id,--all参数会被忽略): - - lx download --all - -也可以使用一个简单的关键字匹配要下载的文件名: - - lx download mkv - -也可以搜索多个关键字(满足其中一个就算匹配): - - lx download mkv mp4 - -任务的添加日期也可以作为关键字: - - lx download 2012.04.04 - lx download 2012.04.04 2012.04.05 - -### lx list -列出已存在的离线任务。默认只会列出任务id,任务名,以及状态。可以使用--original-url和--download-url参数来列出原始链接和下载链接。--completed参数用于忽略未完成任务。 - - lx list - lx list --completed - lx list --no-status --original-url --download-url - -如果要列出bt任务的子文件,可以在任务id后面加上/: - - lx list id/ - -可以使用--deleted或者--expired参数来列出已删除和已过期的任务。 - -详细参数可以参考lx help list。 - -### lx add -添加任务到迅雷离线服务器上。 - - lx add url1 url2 url3 - lx add --input links.txt - lx add --bt torrent-file - lx add --bt torrent-url - lx add --bt info-hash - -提示:lx download会自动添加任务,而无需执行lx add。 - -### lx delete -从迅雷离线服务器上删除任务。 - - lx delete id1 id2 - lx delete ed2k://... - lx delete mkv - lx delete --all mkv - lx delete --all mkv mp4 - -### lx pause -暂停任务。 - - lx pause id1 id2 - lx pause --all mkv - -### lx restart -重新开始任务。 - - lx restart id1 id2 - lx restart --all mkv - -### lx rename -重命名任务 - - lx rename task-id task-name - -### lx logout -不想保留session可以使用lx logout退出。一般用不着。 - - lx logout - lx logout --cookies your-cookies-file - -### lx readd -重新添加已过期或者已删除的任务。 - - lx readd --deleted task-id - lx readd --expired task-name - -提示:可以用lx list --deleted或者lx list --expired列出已删除和过期的任务。 - -### lx config -保存配置。配置文件的保存路径是~/.xunlei.lixian.config。虽然你可以差不多可以保存任何参数,但是目前只有以下几个参数会真正起作用: - -* username -* password -* tool -* continue -* delete -* output-dir -* hash -* mini-hash -* id -* n -* size -* format-size -* colors -* wget-opts(见稍后的说明) -* aria2-opts(见稍后的说明)(见支持的下载工具一节) -* axel-opts(见稍后的说明) -* watch-interval -* log-level -* log-path - -(因为只有这几个参数我觉得是比较有用的。如果你觉得其他的参数有用可以发信给我或者直接open一个issue。) - -不加参数会打印当前保存的所有配置: - - lx config - -可以使用--print打印指定的配置: - - lx config --print password - -添加一个新的参数: - - lx config username your-username - lx config password your-password - lx config delete - lx config no-delete - -删除一个参数: - - lx config --delete password - -注:密码是hash过的,不是明文保存。 -注:如果不希望在命令行参数中明文保存密码,可以运行lx config password,或者lx config password -,会进入交互式不回显密码输入(只支持password配置)。 - -关于wget-opts/aria2-opts/axel-opts,因为这些工具的命令行参数一般都包含-,所以需要用额外的--转义。另外多个命令行参数需要用引号合并到一起: - - lx config -- aria2-opts "-s10 -x10 -c" - -### lx info -打印cookies文件里保存的迅雷内部id,包括登录的ID,一个内部使用的ID,以及gdriveid。 - -关于gdriveid:理论上gdriveid是下载迅雷离线链接需要的唯一cookie,你可以用lx list --download-url获取下载地址,然后用lx info获取gdriveid,然后手动使用其他工具下载,比如wget "--header=Cookie: gdriveid=your-gdriveid" download-url。 - --i参数可以只打印登录ID: - - lx info -i - -如果想把登录id复制到剪切板: - - lx info -i | clip - -### lx help -打印帮助信息。 - - lx help - lx help examples - lx help readme - lx help download - -支持的下载工具 --------------- - -* wget:默认下载工具。注意有些Linux发行版(比如某些运行在路由设备上的mini系统)自带的wget可能无法满足功能要求。可以尝试使用其他工具。 -* asyn:内置的下载工具。在命令行中加上--tool=asyn可以启用。注意此工具的下载表现一般,在高速下载或者设备性能不太好的情况(比如运行在低端路由上),CPU使用可能稍高。在我的RT-N16上,以250K/s的速度下载,CPU使用大概在10%~20%。 -* urllib2:内置下载工具。不支持断点续传错误重连,不建议使用。 -* curl:尚未测试。 -* aria2:测试通过。注意某些环境里的aria2c需要加上额外的参数才能运行。可以使用lx config进行配置:lx config -- aria2-opts --event-poll=select -* axel: 测试通过。注意官方版本的axel有一个URL重定向长度超过255被截断的bug,需要手动修改源代码编译。见issue #44. -* 其他工具,比如ProZilla,暂时都不支持。有需要请可以我,或者直接提交一个issue。 - - -其他工具 --------- - -* lx hash可以用于手动计算hash。 - - lx hash --ed2k filename - lx hash --info-hash torrent-file - lx hash --verify-sha1 filename sha1 - lx hash --verify-bt filename torrent-file - -* lixian_batch.py是我自己用的一个简单的“多任务”下载脚本。其实就是多个--input文件,每个文件里定义的链接下载到文件所在的目录里。 - - python lixian_batch.py folder1/links.txt folder2/links.txt ... - -既知问题 --------- - -1. --tool=asyn的性能不是很好。见“支持的下载工具”一节里的说明。 -2. 有些时候任务添加到服务器上,但是马上刷新拿不到这个数据。这应该是服务器同步的问题。技术上可以自动重刷一遍,但是暂时没有做。用户可以自己重试下。 -3. bt下载的校验如果失败,可能需要重新下载所有文件。从技术上来讲这是没有必要的。但是一来重下出错的片段有些繁琐,二来我自己都从来没遇到过bt校验失败需要重下的情况,所以暂时不考虑支持片段修复。更新:bt校验失败不会重下。 -4. 有时候因为帐号异常,登录需要验证码。目前还不支持验证码。 - -以后 ----- - -其实一开始是考虑做一个可以在路由器上运行的网页版离线下载管理器的。但是这个工作量比命令行版的大很多(不是一个数量级的),在资源消耗和出错概率上也大很多,而且可能还要有更多的依赖库,安装起来也不方便。当然主要还是精力和需求的原因。现在的这个命令行本对我来说已经够用了,也挺简单,短期就不考虑增加网页版了。 - -相关项目 --------- - -* [layerssss/lixian-portal](http://micy.in/lixian-portal/): 给iambus/xunlei-lixian做的一个简洁实用的webui - -特别感谢 --------- - -[群晖公司](http://www.synology.com/)在部分产品中绑定了迅雷离线脚本,并且捐赠了作者一台[DS213+](http://www.synology.com/products/product.php?product_name=DS213%2B)作为反馈。再此表示感谢! - -许可协议 --------- - -xunlei-lixian使用MIT许可协议。 - -此文档未完成。 --------------- - diff --git a/xunlei-lixian/lixian.py b/xunlei-lixian/lixian.py deleted file mode 100644 index 01d073e..0000000 --- a/xunlei-lixian/lixian.py +++ /dev/null @@ -1,1093 +0,0 @@ - -__all__ = ['XunleiClient'] - -import urllib -import urllib2 -import cookielib -import re -import time -import os.path -import json -from ast import literal_eval - - -def retry(f_or_arg, *args): - #retry_sleeps = [1, 1, 1] - retry_sleeps = [1, 2, 3, 5, 10, 20, 30, 60] + [60] * 60 - def decorator(f): - def withretry(*args, **kwargs): - for second in retry_sleeps: - try: - return f(*args, **kwargs) - except: - import traceback - logger.debug("Exception happened. Retrying...") - logger.debug(traceback.format_exc()) - time.sleep(second) - raise - return withretry - if callable(f_or_arg) and not args: - return decorator(f_or_arg) - else: - a = f_or_arg - assert type(a) == int - assert not args - retry_sleeps = [1] * a - return decorator - -class Logger: - def stdout(self, message): - print message - def info(self, message): - print message - def debug(self, message): - pass - def trace(self, message): - pass - -logger = Logger() - -class WithAttrSnapshot: - def __init__(self, object, **attrs): - self.object = object - self.attrs = attrs - def __enter__(self): - self.old_attrs = [] - for k in self.attrs: - if hasattr(self.object, k): - self.old_attrs.append((k, True, getattr(self.object, k))) - else: - self.old_attrs.append((k, False, None)) - for k in self.attrs: - setattr(self.object, k, self.attrs[k]) - def __exit__(self, exc_type, exc_val, exc_tb): - for k, has_old_attr, v in self.old_attrs: - if has_old_attr: - setattr(self.object, k, v) - else: - delattr(self.object, k) - -class WithAttr: - def __init__(self, object): - self.object = object - def __call__(self, **kwargs): - return WithAttrSnapshot(self.object, **kwargs) - def __getattr__(self, k): - return lambda (v): WithAttrSnapshot(self.object, **{k:v}) - -# TODO: write unit test -class OnDemandTaskList: - def __init__(self, fetch_page, page_size, limit): - self.fetch_page = fetch_page - if limit and page_size > limit: - page_size = limit - self.page_size = page_size - self.limit = limit - self.pages = {} - self.max_task_number = None - self.real_total_task_number = None - self.total_pages = None - - def is_out_of_range(self, n): - if self.limit: - if n >= self.limit: - return True - if self.max_task_number: - if n >= self.max_task_number: - return True - if self.real_total_task_number: - if n >= self.real_total_task_number: - return True - - def check_out_of_range(self, n): - if self.is_out_of_range(n): - raise IndexError('task index out of range') - - def is_out_of_page(self, page): - raise NotImplementedError() - - def get_nth_task(self, n): - self.check_out_of_range(n) - page = n / self.page_size - n_in_page = n - page * self.page_size - return self.hit_page(page)[n_in_page] - - def touch(self): - self.hit_page(0) - - def hit_page(self, page): - if page in self.pages: - return self.pages[page] - info = self.fetch_page(page, self.page_size) - tasks = info['tasks'] - if self.max_task_number is None: - self.max_task_number = info['total_task_number'] - if self.limit and self.max_task_number > self.limit: - self.max_task_number = self.limit - self.total_pages = self.max_task_number / self.page_size - if self.max_task_number % self.page_size != 0: - self.total_pages += 1 - if self.max_task_number == 0: - self.real_total_task_number = 0 - if page >= self.total_pages: - tasks = [] - elif page == self.total_pages - 1: - if self.page_size * page + len(tasks) > self.max_task_number: - tasks = tasks[0:self.max_task_number - self.page_size * page] - if len(tasks) > 0: - self.real_total_task_number = self.page_size * page + len(tasks) - else: - self.max_task_number -= self.page_size - self.total_pages -= 1 - if len(self.pages.get(page-1, [])) == self.page_size: - self.real_total_task_number = self.max_task_number - else: - if len(tasks) == 0: - self.max_task_number = self.page_size * page - self.total_pages = page - if len(self.pages.get(page-1, [])) == self.page_size: - self.real_total_task_number = self.max_task_number - elif len(tasks) < self.page_size: - self.real_total_task_number = self.page_size * page + len(tasks) - self.max_task_number = self.real_total_task_number - self.total_pages = page - else: - pass - for i, t in enumerate(tasks): - t['#'] = self.page_size * page + i - self.pages[page] = tasks - return tasks - - def __getitem__(self, n): - return self.get_nth_task(n) - - def __iter__(self): - class Iterator: - def __init__(self, container): - self.container = container - self.current = 0 - def next(self): - self.container.touch() - assert type(self.container.max_task_number) == int - if self.container.real_total_task_number is None: - if self.current < self.container.max_task_number: - try: - task = self.container[self.current] - except IndexError: - raise StopIteration() - else: - raise StopIteration() - else: - if self.current < self.container.real_total_task_number: - task = self.container[self.current] - else: - raise StopIteration() - self.current += 1 - return task - return Iterator(self) - - def __len__(self): - if self.real_total_task_number: - return self.real_total_task_number - self.touch() - self.hit_page(self.total_pages-1) - if self.real_total_task_number: - return self.real_total_task_number - count = 0 - for t in self: - count += 1 - return count - -class XunleiClient(object): - default_page_size = 100 - default_bt_page_size = 9999 - def __init__(self, username=None, password=None, cookie_path=None, login=True, verification_code_reader=None): - self.attr = WithAttr(self) - - self.username = username - self.password = password - self.cookie_path = cookie_path - if cookie_path: - self.cookiejar = cookielib.LWPCookieJar() - if os.path.exists(cookie_path): - self.load_cookies() - else: - self.cookiejar = cookielib.CookieJar() - - self.page_size = self.default_page_size - self.bt_page_size = self.default_bt_page_size - - self.limit = None - - self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookiejar)) - self.verification_code_reader = verification_code_reader - self.login_time = None - if login: - self.id = self.get_userid_or_none() - if not self.id: - self.login() - self.id = self.get_userid() - - @property - def page_size(self): - return self._page_size - @page_size.setter - def page_size(self, size): - self._page_size = size - self.set_page_size(size) - - @retry - def urlopen(self, url, **args): - logger.debug(url) -# import traceback -# for line in traceback.format_stack(): -# print line.strip() - if 'data' in args and type(args['data']) == dict: - args['data'] = urlencode(args['data']) - return self.opener.open(urllib2.Request(url, **args), timeout=60) - - def urlread1(self, url, **args): - args.setdefault('headers', {}) - headers = args['headers'] - headers.setdefault('Accept-Encoding', 'gzip, deflate') -# headers.setdefault('Referer', 'http://lixian.vip.xunlei.com/task.html') -# headers.setdefault('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0') -# headers.setdefault('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8') -# headers.setdefault('Accept-Language', 'zh-cn,zh;q=0.7,en-us;q=0.3') - response = self.urlopen(url, **args) - data = response.read() - if response.info().get('Content-Encoding') == 'gzip': - data = ungzip(data) - elif response.info().get('Content-Encoding') == 'deflate': - data = undeflate(data) - return data - - def urlread(self, url, **args): - data = self.urlread1(url, **args) - if self.is_session_timeout(data): - logger.debug('session timed out') - self.login() - data = self.urlread1(url, **args) - return data - - def load_cookies(self): - self.cookiejar.load(self.cookie_path, ignore_discard=True, ignore_expires=True) - - def save_cookies(self): - if self.cookie_path: - self.cookiejar.save(self.cookie_path, ignore_discard=True) - - def get_cookie(self, domain, k): - if self.has_cookie(domain, k): - return self.cookiejar._cookies[domain]['/'][k].value - - def has_cookie(self, domain, k): - return domain in self.cookiejar._cookies and k in self.cookiejar._cookies[domain]['/'] - - def get_userid(self): - if self.has_cookie('.xunlei.com', 'userid'): - return self.get_cookie('.xunlei.com', 'userid') - else: - raise Exception('Probably login failed') - - def get_userid_or_none(self): - return self.get_cookie('.xunlei.com', 'userid') - - def get_username(self): - return self.get_cookie('.xunlei.com', 'usernewno') - - def get_gdriveid(self): - return self.get_cookie('.vip.xunlei.com', 'gdriveid') - - def has_gdriveid(self): - return self.has_cookie('.vip.xunlei.com', 'gdriveid') - - def get_referer(self): - return 'http://dynamic.cloud.vip.xunlei.com/user_task?userid=%s' % self.id - - def set_cookie(self, domain, k, v): - c = cookielib.Cookie(version=0, name=k, value=v, port=None, port_specified=False, domain=domain, domain_specified=True, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={}, rfc2109=False) - self.cookiejar.set_cookie(c) - - def del_cookie(self, domain, k): - if self.has_cookie(domain, k): - self.cookiejar.clear(domain=domain, path="/", name=k) - - def set_gdriveid(self, id): - self.set_cookie('.vip.xunlei.com', 'gdriveid', id) - - def set_page_size(self, n): - self.set_cookie('.vip.xunlei.com', 'pagenum', str(n)) - - def get_cookie_header(self): - def domain_header(domain): - root = self.cookiejar._cookies[domain]['/'] - return '; '.join(k+'='+root[k].value for k in root) - return domain_header('.xunlei.com') + '; ' + domain_header('.vip.xunlei.com') - - def is_login_ok(self, html): - return len(html) > 512 - - def has_logged_in(self): - id = self.get_userid_or_none() - if not id: - return False - #print self.urlopen('http://dynamic.cloud.vip.xunlei.com/user_task?userid=%s&st=0' % id).read().decode('utf-8') - with self.attr(page_size=1): - url = 'http://dynamic.cloud.vip.xunlei.com/user_task?userid=%s&st=0' % id - #url = 'http://dynamic.lixian.vip.xunlei.com/login?cachetime=%d' % current_timestamp() - r = self.is_login_ok(self.urlread(url)) - return r - - def is_session_timeout(self, html): - is_timeout = html == '''''' or html == '''''' or html == '''''' - if is_timeout: - logger.trace(html) - return True - maybe_timeout = html == '''rebuild({"rtcode":-1,"list":[]})''' - if maybe_timeout: - if self.login_time and time.time() - self.login_time < 60 * 10: # 10 minutes - return False - else: - logger.trace(html) - return True - return is_timeout - - def read_verification_code(self): - if not self.verification_code_reader: - raise NotImplementedError('Verification code required') - else: - verification_code_url = 'http://verify.xunlei.com/image?cachetime=%s' % current_timestamp() - image = self.urlopen(verification_code_url).read() - return self.verification_code_reader(image) - - def login(self, username=None, password=None): - username = self.username - password = self.password - if not username and self.has_cookie('.xunlei.com', 'usernewno'): - username = self.get_username() - if not username: - # TODO: don't depend on lixian_config - import lixian_config - username = lixian_config.get_config('username') -# if not username: -# raise NotImplementedError('user is not logged in') - if not password: - raise NotImplementedError('user is not logged in') - - logger.debug('login') - cachetime = current_timestamp() - check_url = 'http://login.xunlei.com/check?u=%s&cachetime=%d' % (username, cachetime) - login_page = self.urlopen(check_url).read() - verification_code = self.get_cookie('.xunlei.com', 'check_result')[2:].upper() - if not verification_code: - verification_code = self.read_verification_code() - if verification_code: - verification_code = verification_code.upper() - assert verification_code - password = encypt_password(password) - password = md5(password+verification_code) - login_page = self.urlopen('http://login.xunlei.com/sec2login/', data={'u': username, 'p': password, 'verifycode': verification_code}) - self.id = self.get_userid() - with self.attr(page_size=1): - login_page = self.urlopen('http://dynamic.lixian.vip.xunlei.com/login?cachetime=%d&from=0'%current_timestamp()).read() - if not self.is_login_ok(login_page): - logger.trace(login_page) - raise RuntimeError('login failed') - self.save_cookies() - self.login_time = time.time() - - def logout(self): - logger.debug('logout') - #session_id = self.get_cookie('.xunlei.com', 'sessionid') - #timestamp = current_timestamp() - #url = 'http://login.xunlei.com/unregister?sessionid=%s&cachetime=%s&noCacheIE=%s' % (session_id, timestamp, timestamp) - #self.urlopen(url).read() - #self.urlopen('http://dynamic.vip.xunlei.com/login/indexlogin_contr/logout/').read() - ckeys = ["vip_isvip","lx_sessionid","vip_level","lx_login","dl_enable","in_xl","ucid","lixian_section"] - ckeys1 = ["sessionid","usrname","nickname","usernewno","userid"] - self.del_cookie('.vip.xunlei.com', 'gdriveid') - for k in ckeys: - self.set_cookie('.vip.xunlei.com', k, '') - for k in ckeys1: - self.set_cookie('.xunlei.com', k, '') - self.save_cookies() - self.login_time = None - - def to_page_url(self, type_id, page_index, page_size): - # type_id: 1 for downloading, 2 for completed, 4 for downloading+completed+expired, 11 for deleted, 13 for expired - if type_id == 0: - type_id = 4 - page = page_index + 1 - p = 1 # XXX: what is it? - # jsonp = 'jsonp%s' % current_timestamp() - # url = 'http://dynamic.cloud.vip.xunlei.com/interface/showtask_unfresh?type_id=%s&page=%s&tasknum=%s&p=%s&interfrom=task&callback=%s' % (type_id, page, page_size, p, jsonp) - url = 'http://dynamic.cloud.vip.xunlei.com/interface/showtask_unfresh?type_id=%s&page=%s&tasknum=%s&p=%s&interfrom=task' % (type_id, page, page_size, p) - return url - - @retry(10) - def read_task_page_info_by_url(self, url): - page = self.urlread(url).decode('utf-8', 'ignore') - data = parse_json_response(page) - if not self.has_gdriveid(): - gdriveid = data['info']['user']['cookie'] - self.set_gdriveid(gdriveid) - self.save_cookies() - # tasks = parse_json_tasks(data) - tasks = [t for t in parse_json_tasks(data) if not t['expired']] - for t in tasks: - t['client'] = self - # current_page = int(re.search(r'page=(\d+)', url).group(1)) - total_tasks = int(data['info']['total_num']) - # assert total_pages >= data['global_new']['page'].count('
  • .*?', page) - match_next_page = re.search(r'
  • ', page) - return tasks, match_next_page and 'http://dynamic.cloud.vip.xunlei.com'+match_next_page.group(1) - - def read_history_page(self, type=0, pg=None): - if pg is None: - url = 'http://dynamic.cloud.vip.xunlei.com/user_history?userid=%s&type=%d' % (self.id, type) - else: - url = 'http://dynamic.cloud.vip.xunlei.com/user_history?userid=%s&p=%d&type=%d' % (self.id, pg, type) - return self.read_history_page_url(url) - - def read_history(self, type=0): - '''read one page''' - tasks = self.read_history_page(type)[0] - for i, task in enumerate(tasks): - task['#'] = i - return tasks - - def read_all_history(self, type=0): - '''read all pages of deleted/expired tasks''' - all_tasks = [] - tasks, next_link = self.read_history_page(type) - all_tasks.extend(tasks) - while next_link: - if self.limit and len(all_tasks) > self.limit: - break - tasks, next_link = self.read_history_page_url(next_link) - all_tasks.extend(tasks) - if self.limit: - all_tasks = all_tasks[0:self.limit] - for i, task in enumerate(all_tasks): - task['#'] = i - return all_tasks - - def read_deleted(self): - return self.read_history() - - def read_all_deleted(self): - return self.read_all_history() - - def read_expired(self): - return self.read_history(1) - - def read_all_expired(self): - return self.read_all_history(1) - - def list_bt(self, task): - assert task['type'] == 'bt' - url = 'http://dynamic.cloud.vip.xunlei.com/interface/fill_bt_list?callback=fill_bt_list&tid=%s&infoid=%s&g_net=1&p=1&uid=%s&noCacheIE=%s' % (task['id'], task['bt_hash'], self.id, current_timestamp()) - with self.attr(page_size=self.bt_page_size): - html = remove_bom(self.urlread(url)).decode('utf-8') - sub_tasks = parse_bt_list(html) - for t in sub_tasks: - t['date'] = task['date'] - return sub_tasks - - def get_torrent_file_by_info_hash(self, info_hash): - url = 'http://dynamic.cloud.vip.xunlei.com/interface/get_torrent?userid=%s&infoid=%s' % (self.id, info_hash.upper()) - response = self.urlopen(url) - torrent = response.read() - if torrent == "": - raise Exception('Torrent file not found on xunlei cloud: '+info_hash) - assert response.headers['content-type'] == 'application/octet-stream' - return torrent - - def get_torrent_file(self, task): - return self.get_torrent_file_by_info_hash(task['bt_hash']) - - def add_task(self, url): - protocol = parse_url_protocol(url) - assert protocol in ('ed2k', 'http', 'https', 'ftp', 'thunder', 'Flashget', 'qqdl', 'bt', 'magnet'), 'protocol "%s" is not suppoted' % protocol - - from lixian_url import url_unmask - url = url_unmask(url) - protocol = parse_url_protocol(url) - assert protocol in ('ed2k', 'http', 'https', 'ftp', 'bt', 'magnet'), 'protocol "%s" is not suppoted' % protocol - - if protocol == 'bt': - return self.add_torrent_task_by_info_hash(url[5:]) - elif protocol == 'magnet': - return self.add_magnet_task(url) - - random = current_random() - check_url = 'http://dynamic.cloud.vip.xunlei.com/interface/task_check?callback=queryCid&url=%s&random=%s&tcache=%s' % (urllib.quote(url), random, current_timestamp()) - js = self.urlread(check_url).decode('utf-8') - qcid = re.match(r'^queryCid(\(.+\))\s*$', js).group(1) - qcid = literal_eval(qcid) - if len(qcid) == 8: - cid, gcid, size_required, filename, goldbean_need, silverbean_need, is_full, random = qcid - elif len(qcid) == 9: - cid, gcid, size_required, filename, goldbean_need, silverbean_need, is_full, random, ext = qcid - elif len(qcid) == 10: - cid, gcid, size_required, some_key, filename, goldbean_need, silverbean_need, is_full, random, ext = qcid - else: - raise NotImplementedError(qcid) - assert goldbean_need == 0 - assert silverbean_need == 0 - - if url.startswith('http://') or url.startswith('ftp://'): - task_type = 0 - elif url.startswith('ed2k://'): - task_type = 2 - else: - raise NotImplementedError() - task_url = 'http://dynamic.cloud.vip.xunlei.com/interface/task_commit?'+urlencode( - {'callback': 'ret_task', - 'uid': self.id, - 'cid': cid, - 'gcid': gcid, - 'size': size_required, - 'goldbean': goldbean_need, - 'silverbean': silverbean_need, - 't': filename, - 'url': url, - 'type': task_type, - 'o_page': 'task', - 'o_taskid': '0', - }) - - response = self.urlread(task_url) - assert response == 'ret_task(Array)', response - - def add_batch_tasks(self, urls, old_task_ids=None): - assert urls - urls = list(urls) - for url in urls: - if parse_url_protocol(url) not in ('http', 'https', 'ftp', 'ed2k', 'bt', 'thunder', 'magnet'): - raise NotImplementedError('Unsupported: '+url) - urls = filter(lambda u: parse_url_protocol(u) in ('http', 'https', 'ftp', 'ed2k', 'thunder'), urls) - if not urls: - return - #self.urlopen('http://dynamic.cloud.vip.xunlei.com/interface/batch_task_check', data={'url':'\r\n'.join(urls), 'random':current_random()}) - jsonp = 'jsonp%s' % current_timestamp() - url = 'http://dynamic.cloud.vip.xunlei.com/interface/batch_task_commit?callback=%s' % jsonp - if old_task_ids: - batch_old_taskid = ','.join(old_task_ids) - else: - batch_old_taskid = '0' + ',' * (len(urls) - 1) # XXX: what is it? - data = {} - for i in range(len(urls)): - data['cid[%d]' % i] = '' - data['url[%d]' % i] = urllib.quote(to_utf_8(urls[i])) # fix per request #98 - data['batch_old_taskid'] = batch_old_taskid - data['verify_code'] = '' - response = self.urlread(url, data=data) - - response_info = get_response_info(response, jsonp) - code = response_info['process'] - while code == -12 or code == -11: - verification_code = self.read_verification_code() - assert verification_code - data['verify_code'] = verification_code - response = self.urlread(url, data=data) - response_info = get_response_info(response, jsonp) - code = response_info['process'] - if code == len(urls): - return - else: - msg = response_info.get('msg') - assert not msg, repr(msg.decode('utf-8')) - assert code == len(urls), 'invalid response code: %s' % code - - def commit_torrent_task(self, data): - jsonp = 'jsonp%s' % current_timestamp() - commit_url = 'http://dynamic.cloud.vip.xunlei.com/interface/bt_task_commit?callback=%s' % jsonp - def commit(): - response = self.urlread(commit_url, data=data) - response_info = get_response_info(response, jsonp) - code = response_info['progress'] - while code == -12 or code == -11: - verification_code = self.read_verification_code() - assert verification_code - data['verify_code'] = verification_code - response = self.urlread(commit_url, data=data) - response_info = get_response_info(response, jsonp) - code = response_info['progress'] - return response_info - response_info = commit() - if is_dirty_resource(response_info): - data['btname'] = encode_dirty_name(data['btname']) - response_info = commit() - msg = response_info.get('msg') - assert not msg, repr(msg) - - def add_torrent_task_by_content(self, content, path='attachment.torrent'): - assert re.match(r'd\d+:', content), 'Probably not a valid content file [%s...]' % repr(content[:17]) - upload_url = 'http://dynamic.cloud.vip.xunlei.com/interface/torrent_upload' - content_type, body = encode_multipart_formdata([], [('filepath', path, content)]) - response = self.urlread(upload_url, data=body, headers={'Content-Type': content_type}).decode('utf-8') - - upload_success = re.search(r'', response, flags=re.S) - if upload_success: - bt = json.loads(upload_success.group(1)) - bt_hash = bt['infoid'] - bt_name = bt['ftitle'] - bt_size = bt['btsize'] - data = {'uid':self.id, 'btname':bt_name, 'cid':bt_hash, 'tsize':bt_size, - 'findex':''.join(f['id']+'_' for f in bt['filelist']), - 'size':''.join(f['subsize']+'_' for f in bt['filelist']), - 'from':'0'} - self.commit_torrent_task(data) - return bt_hash - already_exists = re.search(r"parent\.edit_bt_list\((\{.*\}),'','0'\)", response, flags=re.S) - if already_exists: - bt = json.loads(already_exists.group(1)) - bt_hash = bt['infoid'] - return bt_hash - raise NotImplementedError(response) - - def add_torrent_task_by_info_hash(self, sha1): - return self.add_torrent_task_by_content(self.get_torrent_file_by_info_hash(sha1), sha1.upper()+'.torrent') - - def add_torrent_task(self, path): - with open(path, 'rb') as x: - return self.add_torrent_task_by_content(x.read(), os.path.basename(path)) - - def add_torrent_task_by_info_hash2(self, sha1, old_task_id=None): - '''similar to add_torrent_task_by_info_hash, but faster. I may delete current add_torrent_task_by_info_hash completely in future''' - link = 'http://dynamic.cloud.vip.xunlei.com/interface/get_torrent?userid=%s&infoid=%s' % (self.id, sha1.upper()) - return self.add_torrent_task_by_link(link, old_task_id=old_task_id) - - def add_magnet_task(self, link): - return self.add_torrent_task_by_link(link) - - def add_torrent_task_by_link(self, link, old_task_id=None): - url = 'http://dynamic.cloud.vip.xunlei.com/interface/url_query?callback=queryUrl&u=%s&random=%s' % (urllib.quote(link), current_timestamp()) - response = self.urlread(url) - success = re.search(r'queryUrl(\(1,.*\))\s*$', response, flags=re.S) # XXX: sometimes it returns queryUrl(0,...)? - if not success: - already_exists = re.search(r"queryUrl\(-1,'([^']{40})", response, flags=re.S) - if already_exists: - return already_exists.group(1) - raise NotImplementedError(repr(response)) - args = success.group(1).decode('utf-8') - args = literal_eval(args.replace('new Array', '')) - _, cid, tsize, btname, _, names, sizes_, sizes, _, types, findexes, _, timestamp, _ = args - def toList(x): - if type(x) in (list, tuple): - return x - else: - return [x] - data = {'uid':self.id, 'btname':btname, 'cid':cid, 'tsize':tsize, - 'findex':''.join(x+'_' for x in toList(findexes)), - 'size':''.join(x+'_' for x in toList(sizes)), - 'from':'0'} - if old_task_id: - data['o_taskid'] = old_task_id - data['o_page'] = 'history' - self.commit_torrent_task(data) - return cid - - def readd_all_expired_tasks(self): - url = 'http://dynamic.cloud.vip.xunlei.com/interface/delay_once?callback=anything' - response = self.urlread(url) - - def delete_tasks_by_id(self, ids): - jsonp = 'jsonp%s' % current_timestamp() - data = {'taskids': ','.join(ids)+',', 'databases': '0,'} - url = 'http://dynamic.cloud.vip.xunlei.com/interface/task_delete?callback=%s&type=%s&noCacheIE=%s' % (jsonp, 2, current_timestamp()) # XXX: what is 'type'? - response = self.urlread(url, data=data) - response = remove_bom(response) - assert_response(response, jsonp, '{"result":1,"type":2}') - - def delete_task_by_id(self, id): - self.delete_tasks_by_id([id]) - - def delete_task(self, task): - self.delete_task_by_id(task['id']) - - def delete_tasks(self, tasks): - self.delete_tasks_by_id([t['id'] for t in tasks]) - - def pause_tasks_by_id(self, ids): - url = 'http://dynamic.cloud.vip.xunlei.com/interface/task_pause?tid=%s&uid=%s&noCacheIE=%s' % (','.join(ids)+',', self.id, current_timestamp()) - assert self.urlread(url) == 'pause_task_resp()' - - def pause_task_by_id(self, id): - self.pause_tasks_by_id([id]) - - def pause_task(self, task): - self.pause_task_by_id(task['id']) - - def pause_tasks(self, tasks): - self.pause_tasks_by_id(t['id'] for t in tasks) - - def restart_tasks(self, tasks): - jsonp = 'jsonp%s' % current_timestamp() - url = 'http://dynamic.cloud.vip.xunlei.com/interface/redownload?callback=%s' % jsonp - form = [] - for task in tasks: - assert task['type'] in ('ed2k', 'http', 'https', 'ftp', 'https', 'bt'), "'%s' is not tested" % task['type'] - data = {'id[]': task['id'], - 'cid[]': '', # XXX: should I set this? - 'url[]': task['original_url'], - 'download_status[]': task['status']} - if task['type'] == 'ed2k': - data['taskname[]'] = task['name'].encode('utf-8') # XXX: shouldn't I set this for other task types? - form.append(urlencode(data)) - form.append(urlencode({'type':1})) - data = '&'.join(form) - response = self.urlread(url, data=data) - assert_response(response, jsonp) - - def rename_task(self, task, new_name): - assert type(new_name) == unicode - url = 'http://dynamic.cloud.vip.xunlei.com/interface/rename' - taskid = task['id'] - bt = '1' if task['type'] == 'bt' else '0' - url = url+'?'+urlencode({'taskid':taskid, 'bt':bt, 'filename':new_name.encode('utf-8')}) - response = self.urlread(url) - assert '"result":0' in response, response - - def restart_task(self, task): - self.restart_tasks([task]) - - def get_task_by_id(self, id): - tasks = self.read_all_tasks(0) - for x in tasks: - if x['id'] == id: - return x - raise Exception('No task found for id '+id) - - -def current_timestamp(): - return int(time.time()*1000) - -def current_random(): - from random import randint - return '%s%06d.%s' % (current_timestamp(), randint(0, 999999), randint(100000000, 9999999999)) - -def convert_task(data): - expired = {'0':False, '4': True}[data['flag']] - assert re.match(r'[^:]+', data['url']), 'Invalid URL in: ' + repr(data) - task = {'id': data['id'], - 'type': re.match(r'[^:]+', data['url']).group().lower(), - 'name': decode_dirty_name(unescape_html(data['taskname'])), - 'status': int(data['download_status']), - 'status_text': {'0':'waiting', '1':'downloading', '2':'completed', '3':'failed', '5':'pending'}[data['download_status']], - 'expired': expired, - 'size': int(data['ysfilesize']), - 'original_url': unescape_html(data['url']), - 'xunlei_url': data['lixian_url'] or None, - 'bt_hash': data['cid'], - 'dcid': data['cid'], - 'gcid': data['gcid'], - 'date': data['dt_committed'][:10].replace('-', '.'), - 'progress': '%s%%' % data['progress'], - 'speed': '%s' % data['speed'], - } - return task - -def parse_json_response(html): - m = re.match(ur'^\ufeff?rebuild\((\{.*\})\)$', html) - if not m: - logger.trace(html) - raise RuntimeError('Invalid response') - return json.loads(m.group(1)) - -def parse_json_tasks(result): - tasks = result['info']['tasks'] - return map(convert_task, tasks) - -def parse_task(html): - inputs = re.findall(r']+/>', html) - def parse_attrs(html): - return dict((k, v1 or v2) for k, v1, v2 in re.findall(r'''\b(\w+)=(?:'([^']*)'|"([^"]*)")''', html)) - info = dict((x['id'], unescape_html(x['value'])) for x in map(parse_attrs, inputs)) - mini_info = {} - mini_map = {} - #mini_info = dict((re.sub(r'\d+$', '', k), info[k]) for k in info) - for k in info: - mini_key = re.sub(r'\d+$', '', k) - mini_info[mini_key] = info[k] - mini_map[mini_key] = k - taskid = mini_map['taskname'][8:] - url = mini_info['f_url'] - task_type = re.match(r'[^:]+', url).group().lower() - task = {'id': taskid, - 'type': task_type, - 'name': mini_info['taskname'], - 'status': int(mini_info['d_status']), - 'status_text': {'0':'waiting', '1':'downloading', '2':'completed', '3':'failed', '5':'pending'}[mini_info['d_status']], - 'size': int(mini_info.get('ysfilesize', 0)), - 'original_url': mini_info['f_url'], - 'xunlei_url': mini_info.get('dl_url', None), - 'bt_hash': mini_info['dcid'], - 'dcid': mini_info['dcid'], - 'gcid': parse_gcid(mini_info.get('dl_url', None)), - } - - m = re.search(r']*>([^<>]*)', html) - task['progress'] = m and m.group(1) or '' - m = re.search(r']*id="speed\d+">([^<>]*)', html) - task['speed'] = m and m.group(1).replace(' ', '') or '' - m = re.search(r'([^<>]*)', html) - task['date'] = m and m.group(1) or '' - - return task - -def parse_history(html): - rwbox = re.search(r'
    ', html, re.S).group() - rw_lists = re.findall(r'
    ]*/>', rwbox, re.S) - return map(parse_task, rw_lists) - -def parse_bt_list(js): - result = json.loads(re.match(r'^fill_bt_list\((.+)\)\s*$', js).group(1))['Result'] - files = [] - for record in result['Record']: - files.append({ - 'id': record['taskid'], - 'index': record['id'], - 'type': 'bt', - 'name': record['title'], # TODO: support folder - 'status': int(record['download_status']), - 'status_text': {'0':'waiting', '1':'downloading', '2':'completed', '3':'failed', '5':'pending'}[record['download_status']], - 'size': int(record['filesize']), - 'original_url': record['url'], - 'xunlei_url': record['downurl'], - 'dcid': record['cid'], - 'gcid': parse_gcid(record['downurl']), - 'speed': '', - 'progress': '%s%%' % record['percent'], - 'date': '', - }) - return files - -def parse_gcid(url): - if not url: - return - m = re.search(r'&g=([A-F0-9]{40})&', url) - if not m: - return - return m.group(1) - -def urlencode(x): - def unif8(u): - if type(u) == unicode: - u = u.encode('utf-8') - return u - return urllib.urlencode([(unif8(k), unif8(v)) for k, v in x.items()]) - -def encode_multipart_formdata(fields, files): - #http://code.activestate.com/recipes/146306/ - """ - fields is a sequence of (name, value) elements for regular form fields. - files is a sequence of (name, filename, value) elements for data to be uploaded as files - Return (content_type, body) ready for httplib.HTTP instance - """ - BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$' - CRLF = '\r\n' - L = [] - for (key, value) in fields: - L.append('--' + BOUNDARY) - L.append('Content-Disposition: form-data; name="%s"' % key) - L.append('') - L.append(value) - for (key, filename, value) in files: - L.append('--' + BOUNDARY) - L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename)) - L.append('Content-Type: %s' % get_content_type(filename)) - L.append('') - L.append(value) - L.append('--' + BOUNDARY + '--') - L.append('') - body = CRLF.join(L) - content_type = 'multipart/form-data; boundary=%s' % BOUNDARY - return content_type, body - -def get_content_type(filename): - import mimetypes - return mimetypes.guess_type(filename)[0] or 'application/octet-stream' - -def assert_default_page(response, id): - #assert response == "" % id - assert re.match(r"^$" % id, response), response - -def remove_bom(response): - if response.startswith('\xef\xbb\xbf'): - response = response[3:] - return response - -def assert_response(response, jsonp, value=1): - response = remove_bom(response) - assert response == '%s(%s)' % (jsonp, value), repr(response) - -def get_response_info(response, jsonp): - response = remove_bom(response) - m = re.match(r'^%s\((.+)\)$' % jsonp, response) - assert m, 'invalid jsonp response: %s' % response - logger.trace('get_response_info') - logger.trace(response) - parameter = m.group(1) - m = re.match(r"^\{process:(-?\d+),msg:'(.*)'\}$", parameter) - if m: - return {'process': int(m.group(1)), 'msg': m.group(2)} - return json.loads(parameter) - -def parse_url_protocol(url): - m = re.match(r'([^:]+)://', url) - if m: - return m.group(1) - elif url.startswith('magnet:'): - return 'magnet' - else: - return url - -def unescape_html(html): - import xml.sax.saxutils - return xml.sax.saxutils.unescape(html) - -def to_utf_8(s): - if type(s) == unicode: - return s.encode('utf-8') - else: - return s - -def md5(s): - import hashlib - return hashlib.md5(s).hexdigest().lower() - -def encypt_password(password): - if not re.match(r'^[0-9a-f]{32}$', password): - password = md5(md5(password)) - return password - -def ungzip(s): - from StringIO import StringIO - import gzip - buffer = StringIO(s) - f = gzip.GzipFile(fileobj=buffer) - return f.read() - -def undeflate(s): - import zlib - return zlib.decompress(s, -zlib.MAX_WBITS) - -def is_dirty_resource(response_info): - return response_info['progress'] == 2 and response_info.get('rtcode') == '76' and response_info.get('msg') == u"\u6587\u4ef6\u540d\u4e2d\u5305\u542b\u8fdd\u89c4\u5185\u5bb9\uff0c\u65e0\u6cd5\u6dfb\u52a0\u5230\u79bb\u7ebf\u7a7a\u95f4[0976]" - -def encode_dirty_name(x): - import base64 - try: - return unicode('[base64]' + base64.encodestring(x.encode('utf-8')).replace('\n', '')) - except: - return x - -def decode_dirty_name(x): - import base64 - try: - if x.startswith('[base64]'): - return base64.decodestring(x[len('[base64]'):]).decode('utf-8') - else: - return x - except: - return x - diff --git a/xunlei-lixian/lixian_alias.py b/xunlei-lixian/lixian_alias.py deleted file mode 100644 index 3c7a34a..0000000 --- a/xunlei-lixian/lixian_alias.py +++ /dev/null @@ -1,20 +0,0 @@ - - -__all__ = ['register_alias', 'to_alias'] - -aliases = {'d': 'download', 'l': 'list', 'a': 'add', 'x': 'delete'} - -def register_alias(alias, command): - aliases[alias] = command - -def get_aliases(): - return aliases - -def get_alias(a): - aliases = get_aliases() - if a in aliases: - return aliases[a] - -def to_alias(a): - return get_alias(a) or a - diff --git a/xunlei-lixian/lixian_batch.py b/xunlei-lixian/lixian_batch.py deleted file mode 100755 index fadeba0..0000000 --- a/xunlei-lixian/lixian_batch.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python - -import sys -import os.path -import lixian_cli - -def download_batch(files): - for f in map(os.path.abspath, files): - print 'Downloading', f, '...' - os.chdir(os.path.dirname(f)) - lixian_cli.execute_command(['download', '--input', f, '--delete', '--continue']) - -if __name__ == '__main__': - download_batch(sys.argv[1:]) - diff --git a/xunlei-lixian/lixian_cli.py b/xunlei-lixian/lixian_cli.py deleted file mode 100755 index b495214..0000000 --- a/xunlei-lixian/lixian_cli.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -from lixian_commands.util import * -import lixian_help -import sys - -from lixian_commands.login import login -from lixian_commands.logout import logout -from lixian_commands.download import download_task -from lixian_commands.list import list_task -from lixian_commands.add import add_task -from lixian_commands.delete import delete_task -from lixian_commands.pause import pause_task -from lixian_commands.restart import restart_task -from lixian_commands.rename import rename_task -from lixian_commands.readd import readd_task -from lixian_commands.info import lixian_info -from lixian_commands.config import lx_config -from lixian_commands.help import lx_help - - -def execute_command(args=sys.argv[1:]): - import lixian_plugins # load plugins at import - if not args: - usage() - sys.exit(1) - command = args[0] - if command.startswith('-'): - if command in ('-h', '--help'): - usage(lixian_help.welcome_help) - elif command in ('-v', '--version'): - print '0.0.x' - else: - usage() - sys.exit(1) - sys.exit(0) - import lixian_alias - command = lixian_alias.to_alias(command) - commands = {'login': login, - 'logout': logout, - 'download': download_task, - 'list': list_task, - 'add': add_task, - 'delete': delete_task, - 'pause': pause_task, - 'restart': restart_task, - 'rename': rename_task, - 'readd': readd_task, - 'info': lixian_info, - 'config': lx_config, - 'help': lx_help} - import lixian_plugins.commands - commands.update(lixian_plugins.commands.commands) - if command not in commands: - usage() - sys.exit(1) - if '-h' in args or '--help' in args: - lx_help([command]) - else: - commands[command](args[1:]) - -if __name__ == '__main__': - execute_command() - - diff --git a/xunlei-lixian/lixian_cli_parser.py b/xunlei-lixian/lixian_cli_parser.py deleted file mode 100644 index 4e4f02a..0000000 --- a/xunlei-lixian/lixian_cli_parser.py +++ /dev/null @@ -1,178 +0,0 @@ - -__all__ = ['expand_command_line', 'parse_command_line', 'Parser', 'command_line_parse', 'command_line_option', 'command_line_value', 'command_line_parser', 'with_parser'] - -def expand_windows_command_line(args): - from glob import glob - expanded = [] - for x in args: - try: - xx = glob(x) - except: - xx = None - if xx: - expanded += xx - else: - expanded.append(x) - return expanded - -def expand_command_line(args): - import platform - return expand_windows_command_line(args) if platform.system() == 'Windows' else args - -def parse_command_line(args, keys=[], bools=[], alias={}, default={}, help=None): - args = expand_command_line(args) - options = {} - for k in keys: - options[k] = None - for k in bools: - options[k] = None - left = [] - args = args[:] - while args: - x = args.pop(0) - if x == '--': - left.extend(args) - break - if x.startswith('-') and len(x) > 1: - k = x.lstrip('-') - if k in bools: - options[k] = True - elif k.startswith('no-') and k[3:] in bools: - options[k[3:]] = False - elif k in keys: - options[k] = args.pop(0) - elif '=' in k and k[:k.index('=')] in keys: - options[k[:k.index('=')]] = k[k.index('=')+1:] - elif k in alias: - k = alias[k] - if k in bools: - options[k] = True - else: - options[k] = args.pop(0) - elif '=' in k and k[:k.index('=')] in alias: - k, v = k[:k.index('=')], k[k.index('=')+1:] - k = alias[k] - if k not in keys: - raise RuntimeError('Invalid boolean option '+x) - options[k] = v - else: - if help: - print 'Unknown option ' + x - print - print help - exit(1) - else: - raise RuntimeError('Unknown option '+x) - else: - left.append(x) - - for k in default: - if options[k] is None: - options[k] = default[k] - - class Args(object): - def __init__(self, args, left): - self.__dict__['_args'] = args - self.__dict__['_left'] = left - def __getattr__(self, k): - v = self._args.get(k, None) - if v: - return v - if '_' in k: - return self._args.get(k.replace('_', '-'), None) - def __setattr__(self, k, v): - self._args[k] = v - def __getitem__(self, i): - if type(i) == int: - return self._left[i] - else: - return self._args[i] - def __setitem__(self, i, v): - if type(i) == int: - self._left[i] = v - else: - self._args[i] = v - def __len__(self): - return len(self._left) - def __str__(self): - return '' % (self._args, self._left) - return Args(options, left) - -class Stack: - def __init__(self, **args): - self.__dict__.update(args) - -class Parser: - def __init__(self): - self.stack = [] - def with_parser(self, parser): - self.stack.append(parser) - return self - def __call__(self, args, keys=[], bools=[], alias={}, default={}, help=None): - stack = Stack(keys=list(keys), bools=list(bools), alias=dict(alias), default=dict(default)) - keys = [] - bools = [] - alias = {} - default = {} - for stack in [x.args_stack for x in self.stack] + [stack]: - keys += stack.keys - bools += stack.bools - alias.update(stack.alias) - default.update(stack.default) - args = parse_command_line(args, keys=keys, bools=bools, alias=alias, default=default, help=help) - for fn in self.stack: - new_args = fn(args) - if new_args: - args = new_args - return args - -def command_line_parse(keys=[], bools=[], alias={}, default={}): - def wrapper(fn): - if hasattr(fn, 'args_stack'): - stack = fn.args_stack - stack.keys += keys - stack.bools += bools - stack.alias.update(alias) - stack.default.update(default) - else: - fn.args_stack = Stack(keys=list(keys), bools=list(bools), alias=dict(alias), default=dict(default)) - return fn - return wrapper - -def command_line_option(name, alias=None, default=None): - alias = {alias:name} if alias else {} - default = {name:default} if default is not None else {} - return command_line_parse(bools=[name], alias=alias, default=default) - -def command_line_value(name, alias=None, default=None): - alias = {alias:name} if alias else {} - default = {name:default} if default else {} - return command_line_parse(keys=[name], alias=alias, default=default) - -def command_line_parser(*args, **kwargs): - def wrapper(f): - parser = Parser() - for x in reversed(getattr(f, 'args_parsers', [])): - parser = parser.with_parser(x) - if hasattr(f, 'args_stack'): - def parse_no_body(args): - pass - parse_no_body.args_stack = f.args_stack - parser = parser.with_parser(parse_no_body) - import functools - @functools.wraps(f) - def parse(args_list): - return f(parser(args_list, *args, **kwargs)) - return parse - return wrapper - -def with_parser(parser): - def wrapper(f): - if hasattr(f, 'args_parsers'): - f.args_parsers.append(parser) - else: - f.args_parsers = [parser] - return f - return wrapper - - diff --git a/xunlei-lixian/lixian_colors.py b/xunlei-lixian/lixian_colors.py deleted file mode 100644 index 2c25ccb..0000000 --- a/xunlei-lixian/lixian_colors.py +++ /dev/null @@ -1,70 +0,0 @@ - -import os -import sys - -def get_console_type(use_colors=True): - if use_colors and sys.stdout.isatty() and sys.stderr.isatty(): - import platform - if platform.system() == 'Windows': - import lixian_colors_win32 - return lixian_colors_win32.WinConsole - else: - import lixian_colors_linux - return lixian_colors_linux.AnsiConsole - else: - import lixian_colors_console - return lixian_colors_console.Console - -console_type = get_console_type() -raw_console_type = get_console_type(False) - -def Console(use_colors=True): - return get_console_type(use_colors)() - -def get_softspace(output): - if hasattr(output, 'softspace'): - return output.softspace - import lixian_colors_console - if isinstance(output, lixian_colors_console.Console): - return get_softspace(output.output) - return 0 - -class ScopedColors(console_type): - def __init__(self, *args): - console_type.__init__(self, *args) - def __call__(self): - console = self - class Scoped: - def __enter__(self): - self.stdout = sys.stdout - softspace = get_softspace(sys.stdout) - sys.stdout = console - sys.stdout.softspace = softspace - def __exit__(self, type, value, traceback): - softspace = get_softspace(sys.stdout) - sys.stdout = self.stdout - sys.stdout.softspace = softspace - return Scoped() - -class RawScopedColors(raw_console_type): - def __init__(self, *args): - raw_console_type.__init__(self, *args) - def __call__(self): - class Scoped: - def __enter__(self): - pass - def __exit__(self, type, value, traceback): - pass - return Scoped() - -class RootColors: - def __init__(self, use_colors=True): - self.use_colors = use_colors - def __getattr__(self, name): - return getattr(ScopedColors() if self.use_colors else RawScopedColors(), name) - def __call__(self, use_colors): - assert use_colors in (True, False, None), use_colors - return RootColors(use_colors) - -colors = RootColors() - diff --git a/xunlei-lixian/lixian_colors_console.py b/xunlei-lixian/lixian_colors_console.py deleted file mode 100644 index 258d75f..0000000 --- a/xunlei-lixian/lixian_colors_console.py +++ /dev/null @@ -1,46 +0,0 @@ - -__all__ = ['Console'] - -import sys - -styles = [ - 'black', - 'blue', - 'green', - 'red', - 'cyan', - 'yellow', - 'purple', - 'white', - - 'bold', - 'italic', - 'underline', - 'inverse', -] - - -class Console: - def __init__(self, output=None, styles=[]): - output = output or sys.stdout - if isinstance(output, Console): - self.output = output.output - self.styles = output.styles + styles - else: - self.output = output - self.styles = styles - assert not isinstance(self.output, Console) - def __getattr__(self, name): - if name in styles: - return self.ansi(name) - else: - raise AttributeError(name) - def ansi(self, code): - return self.__class__(self.output, self.styles + [code]) if code not in (None, '') else self - def __call__(self, s): - self.write(s) - def write(self, s): - self.output.write(s) - def flush(self, *args): - self.output.flush(*args) - diff --git a/xunlei-lixian/lixian_colors_linux.py b/xunlei-lixian/lixian_colors_linux.py deleted file mode 100644 index c224dcd..0000000 --- a/xunlei-lixian/lixian_colors_linux.py +++ /dev/null @@ -1,62 +0,0 @@ - -__all__ = ['AnsiConsole'] - -from lixian_colors_console import Console - -import sys - -colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'purple' : [35, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -} - -class Render: - def __init__(self, output, code): - self.output = output - self.left, self.right = code - def __enter__(self): - self.output.write(self.left) - self.output.flush() - def __exit__(self, type, value, traceback): - self.output.write(self.right) - self.output.flush() - -def mix_styles(styles): - left = [] - right = [] - for style in styles: - if style in colors: - color = colors[style] - left.append(color[0]) - right.append(color[1]) - right.reverse() - return [''.join('\033[%dm' % n for n in left), ''.join('\033[%dm' % n for n in right)] - -class AnsiConsole(Console): - def __init__(self, output=None, styles=[]): - Console.__init__(self, output, styles) - - def write(self, s): - if self.styles: - with self.render(mix_styles(self.styles)): - self.output.write(s) - self.output.flush() - else: - self.output.write(s) - self.output.flush() - - def render(self, code): - return Render(self.output, code) - diff --git a/xunlei-lixian/lixian_colors_win32.py b/xunlei-lixian/lixian_colors_win32.py deleted file mode 100644 index 0e7e780..0000000 --- a/xunlei-lixian/lixian_colors_win32.py +++ /dev/null @@ -1,201 +0,0 @@ - -__all__ = ['WinConsole'] - -from lixian_colors_console import Console - -import ctypes -from ctypes import windll, byref, Structure -from ctypes.wintypes import SHORT, WORD - -import sys - -INVALID_HANDLE_VALUE = -1 -STD_OUTPUT_HANDLE = -11 -STD_ERROR_HANDLE = -12 - -class COORD(Structure): - _fields_ = (('X', SHORT), - ('Y', SHORT),) - -class SMALL_RECT(Structure): - _fields_ = (('Left', SHORT), - ('Top', SHORT), - ('Right', SHORT), - ('Bottom', SHORT),) - -class CONSOLE_SCREEN_BUFFER_INFO(Structure): - _fields_ = (('dwSize', COORD), - ('dwCursorPosition', COORD), - ('wAttributes', WORD), - ('srWindow', SMALL_RECT), - ('dwMaximumWindowSize', COORD),) - - -def GetWinError(): - code = ctypes.GetLastError() - message = ctypes.FormatError(code) - return '[Error %s] %s' % (code, message) - -def GetStdHandle(handle): - h = windll.kernel32.GetStdHandle(handle) - if h == INVALID_HANDLE_VALUE: - raise OSError(GetWinError()) - return h - -def GetConsoleScreenBufferInfo(handle): - info = CONSOLE_SCREEN_BUFFER_INFO() - if not windll.kernel32.GetConsoleScreenBufferInfo(handle, byref(info)): - raise OSError(GetWinError()) - return info - -def SetConsoleTextAttribute(handle, attributes): - if not windll.Kernel32.SetConsoleTextAttribute(handle, attributes): - raise OSError(GetWinError()) - - -FOREGROUND_BLUE = 0x0001 -FOREGROUND_GREEN = 0x0002 -FOREGROUND_RED = 0x0004 -FOREGROUND_INTENSITY = 0x0008 -BACKGROUND_BLUE = 0x0010 -BACKGROUND_GREEN = 0x0020 -BACKGROUND_RED = 0x0040 -BACKGROUND_INTENSITY = 0x0080 -COMMON_LVB_LEADING_BYTE = 0x0100 -COMMON_LVB_TRAILING_BYTE = 0x0200 -COMMON_LVB_GRID_HORIZONTAL = 0x0400 -COMMON_LVB_GRID_LVERTICAL = 0x0800 -COMMON_LVB_GRID_RVERTICAL = 0x1000 -COMMON_LVB_REVERSE_VIDEO = 0x4000 -COMMON_LVB_UNDERSCORE = 0x8000 - -colors = { - 'black' : 0b000, - 'blue' : 0b001, - 'green' : 0b010, - 'red' : 0b100, - 'cyan' : 0b011, - 'yellow' : 0b110, - 'purple' : 0b101, - 'magenta': 0b101, - 'white' : 0b111, -} - -def mix_styles(styles, attributes): - fg_color = -1 - bg_color = -1 - fg_bright = -1 - bg_bright = -1 - reverse = -1 - underscore = -1 - for style in styles: - if style == 0: - # reset mode - raise NotImplementedError() - elif style == 1: - # foreground bright on - fg_bright = 1 - elif style == 2: - # both bright off - fg_bright = 0 - bg_bright = 0 - elif style == 4 or style == 'underline': - # Underscore - underscore = 1 - elif style == 5: - # background bright on - bg_bright = 1 - elif style == 7 or style == 'inverse': - # Reverse foreground and background attributes. - reverse = 1 - elif style == 21 or style == 22: - # foreground bright off - fg_bright = 0 - elif style == 24: - # Underscore: no - underscore = 0 - elif style == 25: - # background bright off - bg_bright = 0 - elif style == 27: - # Reverse: no - reverse = 0 - elif 30 <= style <= 37: - # set foreground color - fg_color = style - 30 - elif style == 39: - # default text color - fg_color = 7 - fg_bright = 0 - elif 40 <= style <= 47: - # set background color - bg_color = style - 40 - elif style == 49: - # default background color - bg_color = 0 - elif 90 <= style <= 97: - # set bold foreground color - fg_bright = 1 - fg_color = style - 90 - elif 100 <= style <= 107: - # set bold background color - bg_bright = 1 - bg_color = style - 100 - elif style == 'bold': - fg_bright = 1 - elif style in colors: - fg_color = colors[style] - - if fg_color != -1: - attributes &= ~ 0b111 - attributes |= fg_color - if fg_bright != -1: - attributes &= ~ 0b1000 - attributes |= fg_bright << 3 - if bg_color != -1: - attributes &= ~ 0b1110000 - attributes |= bg_color << 4 - if bg_bright != -1: - attributes &= ~ 0b10000000 - attributes |= bg_bright << 7 - if reverse != -1: - attributes &= ~ COMMON_LVB_REVERSE_VIDEO - attributes |= reverse << 14 - # XXX: COMMON_LVB_REVERSE_VIDEO doesn't work... - if reverse: - attributes = (attributes & ~(0b11111111 | COMMON_LVB_REVERSE_VIDEO)) | ((attributes & 0b11110000) >> 4) | ((attributes & 0b1111) << 4) - if underscore != -1: - attributes &= ~ COMMON_LVB_UNDERSCORE - attributes |= underscore << 15 - - return attributes - -class Render: - def __init__(self, handle, default, attributes): - self.handle = handle - self.default = default - self.attributes = attributes - def __enter__(self): - SetConsoleTextAttribute(self.handle, self.attributes) - def __exit__(self, type, value, traceback): - SetConsoleTextAttribute(self.handle, self.default) - -class WinConsole(Console): - def __init__(self, output=None, styles=[], handle=STD_OUTPUT_HANDLE): - Console.__init__(self, output, styles) - self.handle = GetStdHandle(handle) - self.default = GetConsoleScreenBufferInfo(self.handle).wAttributes - - def write(self, s): - if self.styles: - with self.render(mix_styles(self.styles, self.default)): - self.output.write(s) - self.output.flush() - else: - self.output.write(s) - self.output.flush() - - def render(self, attributes): - return Render(self.handle, self.default, attributes) - - diff --git a/xunlei-lixian/lixian_commands/__init__.py b/xunlei-lixian/lixian_commands/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/xunlei-lixian/lixian_commands/add.py b/xunlei-lixian/lixian_commands/add.py deleted file mode 100644 index b7d152a..0000000 --- a/xunlei-lixian/lixian_commands/add.py +++ /dev/null @@ -1,27 +0,0 @@ - -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_config import get_config -import lixian_help -import lixian_query - -@command_line_parser(help=lixian_help.add) -@with_parser(parse_login) -@with_parser(parse_colors) -@with_parser(parse_logging) -@with_parser(parse_size) -@command_line_value('limit', default=get_config('limit')) -@command_line_value('page-size', default=get_config('page-size')) -@command_line_value('input', alias='i') -@command_line_option('torrent', alias='bt') -def add_task(args): - assert len(args) or args.input - client = create_client(args) - tasks = lixian_query.find_tasks_to_download(client, args) - print 'All tasks added. Checking status...' - columns = ['id', 'status', 'name'] - if get_config('n'): - columns.insert(0, 'n') - if args.size: - columns.append('size') - output_tasks(tasks, columns, args) diff --git a/xunlei-lixian/lixian_commands/config.py b/xunlei-lixian/lixian_commands/config.py deleted file mode 100644 index 8c5822b..0000000 --- a/xunlei-lixian/lixian_commands/config.py +++ /dev/null @@ -1,36 +0,0 @@ - - -from lixian import encypt_password -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_config import * -import lixian_help -from getpass import getpass - -@command_line_parser(help=lixian_help.config) -@command_line_option('print') -@command_line_option('delete') -def lx_config(args): - if args.delete: - assert len(args) == 1 - delete_config(args[0]) - elif args['print'] or not len(args): - if len(args): - assert len(args) == 1 - print get_config(args[0]) - else: - print 'Loading', global_config.path, '...\n' - print source_config() - print global_config - else: - assert len(args) in (1, 2) - if args[0] == 'password': - if len(args) == 1 or args[1] == '-': - password = getpass('Password: ') - else: - password = args[1] - print 'Saving password (encrypted) to', global_config.path - put_config('password', encypt_password(password)) - else: - print 'Saving configuration to', global_config.path - put_config(*args) diff --git a/xunlei-lixian/lixian_commands/delete.py b/xunlei-lixian/lixian_commands/delete.py deleted file mode 100644 index 3e74719..0000000 --- a/xunlei-lixian/lixian_commands/delete.py +++ /dev/null @@ -1,38 +0,0 @@ - -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_config import get_config -from lixian_encoding import default_encoding -from lixian_colors import colors -import lixian_help -import lixian_query - -@command_line_parser(help=lixian_help.delete) -@with_parser(parse_login) -@with_parser(parse_colors) -@with_parser(parse_logging) -@command_line_option('i') -@command_line_option('all') -@command_line_option('failed') -@command_line_value('limit', default=get_config('limit')) -@command_line_value('page-size', default=get_config('page-size')) -def delete_task(args): - client = create_client(args) - to_delete = lixian_query.search_tasks(client, args) - if not to_delete: - print 'Nothing to delete' - return - with colors(args.colors).red.bold(): - print "Below files are going to be deleted:" - for x in to_delete: - print x['name'].encode(default_encoding) - if args.i: - yes_or_no = raw_input('Are your sure to delete them from Xunlei cloud? (y/n) ') - while yes_or_no.lower() not in ('y', 'yes', 'n', 'no'): - yes_or_no = raw_input('yes or no? ') - if yes_or_no.lower() in ('y', 'yes'): - pass - elif yes_or_no.lower() in ('n', 'no'): - print 'Deletion abort per user request.' - return - client.delete_tasks(to_delete) diff --git a/xunlei-lixian/lixian_commands/download.py b/xunlei-lixian/lixian_commands/download.py deleted file mode 100644 index 1e2127c..0000000 --- a/xunlei-lixian/lixian_commands/download.py +++ /dev/null @@ -1,325 +0,0 @@ - -import lixian_download_tools -import lixian_nodes -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_config import * -from lixian_encoding import default_encoding -from lixian_colors import colors -import lixian_help -import lixian_query -import lixian_hash -import lixian_hash_bt -import lixian_hash_ed2k - -import os -import os.path -import re - -def ensure_dir_exists(dirname): - if dirname and not os.path.exists(dirname): - try: - os.makedirs(dirname) - except os.error: - if not os.path.exists(dirname): - raise - -def escape_filename(name): - amp = re.compile(r'&(amp;)+', flags=re.I) - name = re.sub(amp, '&', name) - name = re.sub(r'[\\/:*?"<>|]', '-', name) - return name - -def safe_encode_native_path(path): - return path.encode(default_encoding).decode(default_encoding).replace('?', '-').encode(default_encoding) - -def verify_basic_hash(path, task): - if os.path.getsize(path) != task['size']: - print 'hash error: incorrect file size (%s != %s)' % (os.path.getsize(path), task['size']) - return False - return lixian_hash.verify_dcid(path, task['dcid']) - -def verify_hash(path, task): - if verify_basic_hash(path, task): - if task['type'] == 'ed2k': - return lixian_hash_ed2k.verify_ed2k_link(path, task['original_url']) - else: - return True - -def verify_mini_hash(path, task): - return os.path.exists(path) and os.path.getsize(path) == task['size'] and lixian_hash.verify_dcid(path, task['dcid']) - -def verify_mini_bt_hash(dirname, files): - for f in files: - name = f['name'].encode(default_encoding) - path = os.path.join(dirname, *name.split('\\')) - if not verify_mini_hash(path, f): - return False - return True - -def download_file(client, path, task, options): - download_tool = lixian_download_tools.get_tool(options['tool']) - - resuming = options.get('resuming') - overwrite = options.get('overwrite') - mini_hash = options.get('mini_hash') - no_hash = options.get('no_hash') - - url = str(task['xunlei_url']) - if options['node']: - if options['node'] == 'best' or options['node'] == 'fastest': - from lixian_util import parse_size - if task['size'] >= parse_size(options['node_detection_threshold']): - url = lixian_nodes.use_fastest_node(url, options['vod_nodes'], client.get_gdriveid()) - elif options['node'] == 'fast': - from lixian_util import parse_size - if task['size'] >= parse_size(options['node_detection_threshold']): - url = lixian_nodes.use_fast_node(url, options['vod_nodes'], parse_size(options['node_detection_acceptable']), client.get_gdriveid()) - else: - url = lixian_nodes.switch_node(url, options['node'], client.get_gdriveid()) - - def download1(download, path): - if not os.path.exists(path): - download() - elif not resuming: - if overwrite: - download() - else: - raise Exception('%s already exists. Please try --continue or --overwrite' % path) - else: - if download.finished(): - pass - else: - download() - - def download1_checked(client, url, path, size): - download = download_tool(client=client, url=url, path=path, size=size, resuming=resuming) - checked = 0 - while checked < 10: - download1(download, path) - if download.finished(): - break - else: - checked += 1 - assert os.path.getsize(path) == size, 'incorrect downloaded file size (%s != %s)' % (os.path.getsize(path), size) - - def download2(client, url, path, task): - size = task['size'] - if mini_hash and resuming and verify_mini_hash(path, task): - return - download1_checked(client, url, path, size) - verify = verify_basic_hash if no_hash else verify_hash - if not verify(path, task): - with colors(options.get('colors')).yellow(): - print 'hash error, redownloading...' - os.rename(path, path + '.error') - download1_checked(client, url, path, size) - if not verify(path, task): - raise Exception('hash check failed') - - download2(client, url, path, task) - - -def download_single_task(client, task, options): - output = options.get('output') - output = output and os.path.expanduser(output) - output_dir = options.get('output_dir') - output_dir = output_dir and os.path.expanduser(output_dir) - delete = options.get('delete') - resuming = options.get('resuming') - overwrite = options.get('overwrite') - mini_hash = options.get('mini_hash') - no_hash = options.get('no_hash') - no_bt_dir = options.get('no_bt_dir') - save_torrent_file = options.get('save_torrent_file') - - assert client.get_gdriveid() - if task['status_text'] != 'completed': - if 'files' not in task: - with colors(options.get('colors')).yellow(): - print 'skip task %s as the status is %s' % (task['name'].encode(default_encoding), task['status_text']) - return - - if output: - output_path = output - output_dir = os.path.dirname(output) - output_name = os.path.basename(output) - else: - output_name = safe_encode_native_path(escape_filename(task['name'])) - output_dir = output_dir or '.' - output_path = os.path.join(output_dir, output_name) - - if task['type'] == 'bt': - files, skipped, single_file = lixian_query.expand_bt_sub_tasks(task) - if single_file: - dirname = output_dir - else: - if no_bt_dir: - output_path = os.path.dirname(output_path) - dirname = output_path - assert dirname # dirname must be non-empty, otherwise dirname + os.path.sep + ... might be dangerous - ensure_dir_exists(dirname) - for t in skipped: - with colors(options.get('colors')).yellow(): - print 'skip task %s/%s (%s) as the status is %s' % (str(t['id']), t['index'], t['name'].encode(default_encoding), t['status_text']) - if mini_hash and resuming and verify_mini_bt_hash(dirname, files): - print task['name'].encode(default_encoding), 'is already done' - if delete and 'files' not in task: - client.delete_task(task) - return - if not single_file: - with colors(options.get('colors')).green(): - print output_name + '/' - for f in files: - name = f['name'] - if f['status_text'] != 'completed': - print 'Skipped %s file %s ...' % (f['status_text'], name.encode(default_encoding)) - continue - if not single_file: - print name.encode(default_encoding), '...' - else: - with colors(options.get('colors')).green(): - print name.encode(default_encoding), '...' - # XXX: if file name is escaped, hashing bt won't get correct file - splitted_path = map(escape_filename, name.split('\\')) - name = safe_encode_native_path(os.path.join(*splitted_path)) - path = dirname + os.path.sep + name # fix issue #82 - if splitted_path[:-1]: - subdir = safe_encode_native_path(os.path.join(*splitted_path[:-1])) - subdir = dirname + os.path.sep + subdir # fix issue #82 - ensure_dir_exists(subdir) - download_file(client, path, f, options) - if save_torrent_file: - info_hash = str(task['bt_hash']) - if single_file: - torrent = os.path.join(dirname, escape_filename(task['name']).encode(default_encoding) + '.torrent') - else: - torrent = os.path.join(dirname, info_hash + '.torrent') - if os.path.exists(torrent): - pass - else: - content = client.get_torrent_file_by_info_hash(info_hash) - with open(torrent, 'wb') as ouput_stream: - ouput_stream.write(content) - if not no_hash: - torrent_file = client.get_torrent_file(task) - print 'Hashing bt ...' - from lixian_progress import SimpleProgressBar - bar = SimpleProgressBar() - file_set = [f['name'].encode('utf-8').split('\\') for f in files] if 'files' in task else None - verified = lixian_hash_bt.verify_bt(output_path, lixian_hash_bt.bdecode(torrent_file)['info'], file_set=file_set, progress_callback=bar.update) - bar.done() - if not verified: - # note that we don't delete bt download folder if hash failed - raise Exception('bt hash check failed') - else: - ensure_dir_exists(output_dir) - - with colors(options.get('colors')).green(): - print output_name, '...' - download_file(client, output_path, task, options) - - if delete and 'files' not in task: - client.delete_task(task) - -def download_multiple_tasks(client, tasks, options): - for task in tasks: - download_single_task(client, task, options) - skipped = filter(lambda t: t['status_text'] != 'completed', tasks) - if skipped: - with colors(options.get('colors')).yellow(): - print "Below tasks were skipped as they were not ready:" - for task in skipped: - print task['id'], task['status_text'], task['name'].encode(default_encoding) - -@command_line_parser(help=lixian_help.download) -@with_parser(parse_login) -@with_parser(parse_colors) -@with_parser(parse_logging) -@command_line_value('tool', default=get_config('tool', 'wget')) -@command_line_value('input', alias='i') -@command_line_value('output', alias='o') -@command_line_value('output-dir', default=get_config('output-dir')) -@command_line_option('torrent', alias='bt') -@command_line_option('all') -@command_line_value('category') -@command_line_value('limit', default=get_config('limit')) -@command_line_value('page-size', default=get_config('page-size')) -@command_line_option('delete', default=get_config('delete')) -@command_line_option('continue', alias='c', default=get_config('continue')) -@command_line_option('overwrite') -@command_line_option('mini-hash', default=get_config('mini-hash')) -@command_line_option('hash', default=get_config('hash', True)) -@command_line_option('bt-dir', default=True) -@command_line_option('save-torrent-file') -@command_line_option('watch') -@command_line_option('watch-present') -@command_line_value('watch-interval', default=get_config('watch-interval', '3m')) -@command_line_value('node', default=get_config('node')) -@command_line_value('node-detection-threshold', default=get_config('node-detection-threshold', '100M')) -@command_line_value('node-detection-acceptable', default=get_config('node-detection-acceptable', '1M')) -@command_line_value('vod-nodes', default=get_config('vod-nodes', lixian_nodes.VOD_RANGE)) -def download_task(args): - assert len(args) or args.input or args.all or args.category, 'Not enough arguments' - lixian_download_tools.get_tool(args.tool) # check tool - download_args = {'tool': args.tool, - 'output': args.output, - 'output_dir': args.output_dir, - 'delete': args.delete, - 'resuming': args._args['continue'], - 'overwrite': args.overwrite, - 'mini_hash': args.mini_hash, - 'no_hash': not args.hash, - 'no_bt_dir': not args.bt_dir, - 'save_torrent_file': args.save_torrent_file, - 'node': args.node, - 'node_detection_threshold': args.node_detection_threshold, - 'node_detection_acceptable': args.node_detection_acceptable, - 'vod_nodes': args.vod_nodes, - 'colors': args.colors} - client = create_client(args) - query = lixian_query.build_query(client, args) - query.query_once() - - def sleep(n): - assert isinstance(n, (int, basestring)), repr(n) - import time - if isinstance(n, basestring): - n, u = re.match(r'^(\d+)([smh])?$', n.lower()).groups() - n = int(n) * {None: 1, 's': 1, 'm': 60, 'h': 3600}[u] - time.sleep(n) - - if args.watch_present: - assert not args.output, 'not supported with watch option yet' - tasks = query.pull_completed() - while True: - if tasks: - download_multiple_tasks(client, tasks, download_args) - if not query.download_jobs: - break - if not tasks: - sleep(args.watch_interval) - query.refresh_status() - tasks = query.pull_completed() - - elif args.watch: - assert not args.output, 'not supported with watch option yet' - tasks = query.pull_completed() - while True: - if tasks: - download_multiple_tasks(client, tasks, download_args) - if (not query.download_jobs) and (not query.queries): - break - if not tasks: - sleep(args.watch_interval) - query.refresh_status() - query.query_search() - tasks = query.pull_completed() - - else: - tasks = query.peek_download_jobs() - if args.output: - assert len(tasks) == 1 - download_single_task(client, tasks[0], download_args) - else: - download_multiple_tasks(client, tasks, download_args) diff --git a/xunlei-lixian/lixian_commands/help.py b/xunlei-lixian/lixian_commands/help.py deleted file mode 100644 index 230d8b7..0000000 --- a/xunlei-lixian/lixian_commands/help.py +++ /dev/null @@ -1,12 +0,0 @@ - -from lixian_commands.util import * -import lixian_help - -def lx_help(args): - if len(args) == 1: - helper = getattr(lixian_help, args[0].lower(), lixian_help.help) - usage(helper) - elif len(args) == 0: - usage(lixian_help.welcome_help) - else: - usage(lixian_help.help) diff --git a/xunlei-lixian/lixian_commands/info.py b/xunlei-lixian/lixian_commands/info.py deleted file mode 100644 index aa1cc09..0000000 --- a/xunlei-lixian/lixian_commands/info.py +++ /dev/null @@ -1,19 +0,0 @@ - - -from lixian import XunleiClient -from lixian_commands.util import * -from lixian_cli_parser import * -import lixian_help - -@command_line_parser(help=lixian_help.info) -@with_parser(parse_login) -@command_line_option('id', alias='i') -def lixian_info(args): - client = XunleiClient(args.username, args.password, args.cookies, login=False) - if args.id: - print client.get_username() - else: - print 'id:', client.get_username() - print 'internalid:', client.get_userid() - print 'gdriveid:', client.get_gdriveid() or '' - diff --git a/xunlei-lixian/lixian_commands/list.py b/xunlei-lixian/lixian_commands/list.py deleted file mode 100644 index 9ad2cb6..0000000 --- a/xunlei-lixian/lixian_commands/list.py +++ /dev/null @@ -1,57 +0,0 @@ - -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_config import get_config -import lixian_help -import lixian_query -import re - -@command_line_parser(help=lixian_help.list) -@with_parser(parse_login) -@with_parser(parse_colors) -@with_parser(parse_logging) -@with_parser(parse_size) -@command_line_option('all', default=True) -@command_line_option('completed') -@command_line_option('failed') -@command_line_option('deleted') -@command_line_option('expired') -@command_line_value('category') -@command_line_value('limit', default=get_config('limit')) -@command_line_value('page-size', default=get_config('page-size')) -@command_line_option('id', default=get_config('id', True)) -@command_line_option('name', default=True) -@command_line_option('status', default=True) -@command_line_option('dcid') -@command_line_option('gcid') -@command_line_option('original-url') -@command_line_option('download-url') -@command_line_option('speed') -@command_line_option('progress') -@command_line_option('date') -@command_line_option('n', default=get_config('n')) -def list_task(args): - - parent_ids = [a[:-1] for a in args if re.match(r'^#?\d+/$', a)] - if parent_ids and not all(re.match(r'^#?\d+/$', a) for a in args): - raise NotImplementedError("Can't mix 'id/' with others") - assert len(parent_ids) <= 1, "sub-tasks listing only supports single task id" - ids = [a[:-1] if re.match(r'^#?\d+/$', a) else a for a in args] - - client = create_client(args) - if parent_ids: - args[0] = args[0][:-1] - tasks = lixian_query.search_tasks(client, args) - assert len(tasks) == 1 - tasks = client.list_bt(tasks[0]) - #tasks = client.list_bt(client.get_task_by_id(parent_ids[0])) - tasks.sort(key=lambda x: int(x['index'])) - else: - tasks = lixian_query.search_tasks(client, args) - if len(args) == 1 and re.match(r'\d+/', args[0]) and len(tasks) == 1 and 'files' in tasks[0]: - parent_ids = [tasks[0]['id']] - tasks = tasks[0]['files'] - columns = ['n', 'id', 'name', 'status', 'size', 'progress', 'speed', 'date', 'dcid', 'gcid', 'original-url', 'download-url'] - columns = filter(lambda k: getattr(args, k), columns) - - output_tasks(tasks, columns, args, not parent_ids) diff --git a/xunlei-lixian/lixian_commands/login.py b/xunlei-lixian/lixian_commands/login.py deleted file mode 100644 index 4b16b9c..0000000 --- a/xunlei-lixian/lixian_commands/login.py +++ /dev/null @@ -1,42 +0,0 @@ - - -from lixian import XunleiClient -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_config import get_config -import lixian_help -from getpass import getpass - -@command_line_parser(help=lixian_help.login) -@with_parser(parse_login) -@with_parser(parse_logging) -def login(args): - if args.cookies == '-': - args._args['cookies'] = None - if len(args) < 1: - args.username = args.username or XunleiClient(cookie_path=args.cookies, login=False).get_username() or get_config('username') or raw_input('ID: ') - args.password = args.password or get_config('password') or getpass('Password: ') - elif len(args) == 1: - args.username = args.username or XunleiClient(cookie_path=args.cookies, login=False).get_username() or get_config('username') - args.password = args[0] - if args.password == '-': - args.password = getpass('Password: ') - elif len(args) == 2: - args.username, args.password = list(args) - if args.password == '-': - args.password = getpass('Password: ') - elif len(args) == 3: - args.username, args.password, args.cookies = list(args) - if args.password == '-': - args.password = getpass('Password: ') - elif len(args) > 3: - raise RuntimeError('Too many arguments') - if not args.username: - raise RuntimeError("What's your name?") - if args.cookies: - print 'Saving login session to', args.cookies - else: - print 'Testing login without saving session' - import lixian_verification_code - verification_code_reader = lixian_verification_code.default_verification_code_reader(args) - XunleiClient(args.username, args.password, args.cookies, login=True, verification_code_reader=verification_code_reader) diff --git a/xunlei-lixian/lixian_commands/logout.py b/xunlei-lixian/lixian_commands/logout.py deleted file mode 100644 index ce6dc14..0000000 --- a/xunlei-lixian/lixian_commands/logout.py +++ /dev/null @@ -1,18 +0,0 @@ - -from lixian import XunleiClient -from lixian_commands.util import * -from lixian_cli_parser import * -import lixian_config -import lixian_help - -@command_line_parser(help=lixian_help.logout) -@with_parser(parse_logging) -@command_line_value('cookies', default=lixian_config.LIXIAN_DEFAULT_COOKIES) -def logout(args): - if len(args): - raise RuntimeError('Too many arguments') - print 'logging out from', args.cookies - assert args.cookies - client = XunleiClient(cookie_path=args.cookies, login=False) - client.logout() - diff --git a/xunlei-lixian/lixian_commands/pause.py b/xunlei-lixian/lixian_commands/pause.py deleted file mode 100644 index 6d6ac5c..0000000 --- a/xunlei-lixian/lixian_commands/pause.py +++ /dev/null @@ -1,23 +0,0 @@ - -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_config import get_config -from lixian_encoding import default_encoding -import lixian_help -import lixian_query - -@command_line_parser(help=lixian_help.pause) -@with_parser(parse_login) -@with_parser(parse_colors) -@with_parser(parse_logging) -@command_line_option('i') -@command_line_option('all') -@command_line_value('limit', default=get_config('limit')) -@command_line_value('page-size', default=get_config('page-size')) -def pause_task(args): - client = create_client(args) - to_pause = lixian_query.search_tasks(client, args) - print "Below files are going to be paused:" - for x in to_pause: - print x['name'].encode(default_encoding) - client.pause_tasks(to_pause) diff --git a/xunlei-lixian/lixian_commands/readd.py b/xunlei-lixian/lixian_commands/readd.py deleted file mode 100644 index 1fb1ce5..0000000 --- a/xunlei-lixian/lixian_commands/readd.py +++ /dev/null @@ -1,40 +0,0 @@ - -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_encoding import default_encoding -import lixian_help -import lixian_query - -@command_line_parser(help=lixian_help.readd) -@with_parser(parse_login) -@with_parser(parse_logging) -@command_line_option('deleted') -@command_line_option('expired') -@command_line_option('all') -def readd_task(args): - if args.deleted: - status = 'deleted' - elif args.expired: - status = 'expired' - else: - raise NotImplementedError('Please use --expired or --deleted') - client = create_client(args) - if status == 'expired' and args.all: - return client.readd_all_expired_tasks() - to_readd = lixian_query.search_tasks(client, args) - non_bt = [] - bt = [] - if not to_readd: - return - print "Below files are going to be re-added:" - for x in to_readd: - print x['name'].encode(default_encoding) - if x['type'] == 'bt': - bt.append((x['bt_hash'], x['id'])) - else: - non_bt.append((x['original_url'], x['id'])) - if non_bt: - urls, ids = zip(*non_bt) - client.add_batch_tasks(urls, ids) - for hash, id in bt: - client.add_torrent_task_by_info_hash2(hash, id) diff --git a/xunlei-lixian/lixian_commands/rename.py b/xunlei-lixian/lixian_commands/rename.py deleted file mode 100644 index ed5e020..0000000 --- a/xunlei-lixian/lixian_commands/rename.py +++ /dev/null @@ -1,19 +0,0 @@ - -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_encoding import from_native -import lixian_help -import re -import sys - -@command_line_parser(help=lixian_help.rename) -@with_parser(parse_login) -@with_parser(parse_logging) -def rename_task(args): - if len(args) != 2 or not re.match(r'\d+$', args[0]): - usage(lixian_help.rename, 'Incorrect arguments') - sys.exit(1) - client = create_client(args) - taskid, new_name = args - task = client.get_task_by_id(taskid) - client.rename_task(task, from_native(new_name)) diff --git a/xunlei-lixian/lixian_commands/restart.py b/xunlei-lixian/lixian_commands/restart.py deleted file mode 100644 index 920054e..0000000 --- a/xunlei-lixian/lixian_commands/restart.py +++ /dev/null @@ -1,23 +0,0 @@ - -from lixian_commands.util import * -from lixian_cli_parser import * -from lixian_config import get_config -from lixian_encoding import default_encoding -import lixian_help -import lixian_query - -@command_line_parser(help=lixian_help.restart) -@with_parser(parse_login) -@with_parser(parse_colors) -@with_parser(parse_logging) -@command_line_option('i') -@command_line_option('all') -@command_line_value('limit', default=get_config('limit')) -@command_line_value('page-size', default=get_config('page-size')) -def restart_task(args): - client = create_client(args) - to_restart = lixian_query.search_tasks(client, args) - print "Below files are going to be restarted:" - for x in to_restart: - print x['name'].encode(default_encoding) - client.restart_tasks(to_restart) diff --git a/xunlei-lixian/lixian_commands/util.py b/xunlei-lixian/lixian_commands/util.py deleted file mode 100644 index e100cbc..0000000 --- a/xunlei-lixian/lixian_commands/util.py +++ /dev/null @@ -1,112 +0,0 @@ - -__all__ = ['parse_login', 'parse_colors', 'parse_logging', 'parse_size', 'create_client', 'output_tasks', 'usage'] - -from lixian_cli_parser import * -from lixian_config import get_config -from lixian_config import LIXIAN_DEFAULT_COOKIES -from lixian_encoding import default_encoding, to_native -from lixian_colors import colors -from getpass import getpass -import lixian_help - -@command_line_value('username', default=get_config('username')) -@command_line_value('password', default=get_config('password')) -@command_line_value('cookies', default=LIXIAN_DEFAULT_COOKIES) -@command_line_value('verification-code-path', default=get_config('verification-code-path')) -def parse_login(args): - if args.password == '-': - args.password = getpass('Password: ') - if args.cookies == '-': - args._args['cookies'] = None - return args - -@command_line_option('colors', default=get_config('colors', True)) -def parse_colors(args): - pass - -@command_line_value('log-level', default=get_config('log-level')) -@command_line_value('log-path', default=get_config('log-path')) -@command_line_option('debug') -@command_line_option('trace') -def parse_logging(args): - path = args.log_path - level = args.log_level - if args.trace: - level = 'trace' - elif args.debug: - level = 'debug' - if path or level: - import lixian_logging - level = level or 'info' - lixian_logging.init_logger(use_colors=args.colors, level=level, path=path) - logger = lixian_logging.get_logger() - import lixian - # inject logger to lixian (this makes lixian.py zero-dependency) - lixian.logger = logger - -@command_line_option('size', default=get_config('size')) -@command_line_option('format-size', default=get_config('format-size')) -def parse_size(args): - pass - -def create_client(args): - from lixian import XunleiClient - import lixian_verification_code - verification_code_reader = lixian_verification_code.default_verification_code_reader(args) - client = XunleiClient(args.username, args.password, args.cookies, verification_code_reader=verification_code_reader) - if args.page_size: - client.page_size = int(args.page_size) - return client - -def output_tasks(tasks, columns, args, top=True): - for i, t in enumerate(tasks): - status_colors = { - 'waiting': 'yellow', - 'downloading': 'magenta', - 'completed':'green', - 'pending':'cyan', - 'failed':'red', - } - c = status_colors[t['status_text']] - with colors(args.colors).ansi(c)(): - for k in columns: - if k == 'n': - if top: - print '#%d' % t['#'], - elif k == 'id': - print t.get('index', t['id']), - elif k == 'name': - print t['name'].encode(default_encoding), - elif k == 'status': - with colors(args.colors).bold(): - print t['status_text'], - elif k == 'size': - if args.format_size: - from lixian_util import format_size - print format_size(t['size']), - else: - print t['size'], - elif k == 'progress': - print t['progress'], - elif k == 'speed': - print t['speed'], - elif k == 'date': - print t['date'], - elif k == 'dcid': - print t['dcid'], - elif k == 'gcid': - print t['gcid'], - elif k == 'original-url': - print t['original_url'], - elif k == 'download-url': - print t['xunlei_url'], - else: - raise NotImplementedError(k) - print - -def usage(doc=lixian_help.usage, message=None): - if hasattr(doc, '__call__'): - doc = doc() - if message: - print to_native(message) - print to_native(doc).strip() diff --git a/xunlei-lixian/lixian_config.py b/xunlei-lixian/lixian_config.py deleted file mode 100644 index 2e0da6c..0000000 --- a/xunlei-lixian/lixian_config.py +++ /dev/null @@ -1,86 +0,0 @@ - -import os -import os.path - -def get_config_path(filename): - if os.path.exists(filename): - return filename - import sys - local_path = os.path.join(sys.path[0], filename) - if os.path.exists(local_path): - return local_path - user_home = os.getenv('USERPROFILE') or os.getenv('HOME') - lixian_home = os.getenv('LIXIAN_HOME') or user_home - return os.path.join(lixian_home, filename) - -LIXIAN_DEFAULT_CONFIG = get_config_path('.xunlei.lixian.config') -LIXIAN_DEFAULT_COOKIES = get_config_path('.xunlei.lixian.cookies') - -def load_config(path): - values = {} - if os.path.exists(path): - with open(path) as x: - for line in x.readlines(): - line = line.strip() - if line: - if line.startswith('--'): - line = line.lstrip('-') - if line.startswith('no-'): - values[line[3:]] = False - elif '=' in line: - k, v = line.split('=', 1) - values[k] = v - else: - values[line] = True - else: - raise NotImplementedError(line) - return values - -def dump_config(path, values): - with open(path, 'w') as x: - for k in values: - v = values[k] - if v is True: - x.write('--%s\n'%k) - elif v is False: - x.write('--no-%s\n'%k) - else: - x.write('--%s=%s\n'%(k, v)) - -class Config: - def __init__(self, path=LIXIAN_DEFAULT_CONFIG): - self.path = path - self.values = load_config(path) - def put(self, k, v=True): - self.values[k] = v - dump_config(self.path, self.values) - def get(self, k, v=None): - return self.values.get(k, v) - def delete(self, k): - if k in self.values: - del self.values[k] - dump_config(self.path, self.values) - def source(self): - if os.path.exists(self.path): - with open(self.path) as x: - return x.read() - def __str__(self): - return '' % self.values - -global_config = Config() - -def put_config(k, v=True): - if k.startswith('no-') and v is True: - k = k[3:] - v = False - global_config.put(k, v) - -def get_config(k, v=None): - return global_config.get(k, v) - -def delete_config(k): - return global_config.delete(k) - -def source_config(): - return global_config.source() - diff --git a/xunlei-lixian/lixian_download_asyn.py b/xunlei-lixian/lixian_download_asyn.py deleted file mode 100644 index a06db85..0000000 --- a/xunlei-lixian/lixian_download_asyn.py +++ /dev/null @@ -1,358 +0,0 @@ - -import asyncore -import asynchat -import socket -import re -#from cStringIO import StringIO -from time import time, sleep -import sys -import os - -#asynchat.async_chat.ac_out_buffer_size = 1024*1024 - -class http_client(asynchat.async_chat): - - def __init__(self, url, headers=None, start_from=0): - asynchat.async_chat.__init__(self) - - self.args = {'headers': headers, 'start_from': start_from} - - m = re.match(r'http://([^/:]+)(?::(\d+))?(/.*)?$', url) - assert m, 'Invalid url: %s' % url - host, port, path = m.groups() - port = int(port or 80) - path = path or '/' - - def resolve_host(host): - try: - return socket.gethostbyname(host) - except: - pass - host_ip = resolve_host(host) - if not host_ip: - self.log_error("host can't be resolved: " + host) - self.size = None - return - if host_ip == '180.168.41.175': - # fuck shanghai dian DNS - self.log_error('gethostbyname failed') - self.size = None - return - - - request_headers = {'host': host, 'connection': 'close'} - if start_from: - request_headers['RANGE'] = 'bytes=%d-' % start_from - if headers: - request_headers.update(headers) - headers = request_headers - self.request = 'GET %s HTTP/1.1\r\n%s\r\n\r\n' % (path, '\r\n'.join('%s: %s' % (k, headers[k]) for k in headers)) - self.op = 'GET' - - self.headers = {} # for response headers - - #self.buffer = StringIO() - self.buffer = [] - self.buffer_size = 0 - self.cache_size = 1024*1024 - self.size = None - self.completed = 0 - self.set_terminator("\r\n\r\n") - self.reading_headers = True - - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - try: - self.connect((host, port)) - except: - self.close() - self.log_error('connect_failed') - - def handle_connect(self): - self.start_time = time() - self.push(self.request) - - def handle_close(self): - asynchat.async_chat.handle_close(self) - self.flush_data() - if self.reading_headers: - self.log_error('incomplete http response') - return - self.handle_status_update(self.size, self.completed, force_update=True) - self.handle_speed_update(self.completed, self.start_time, force_update=True) - if self.size is not None and self.completed < self.size: - self.log_error('incomplete download') - - def handle_connection_error(self): - self.handle_error() - - def handle_error(self): - self.close() - self.flush_data() - error_message = sys.exc_info()[1] - self.log_error('there is some error: %s' % error_message) - #raise - - def collect_incoming_data(self, data): - if self.reading_headers: - #self.buffer.write(data) - self.buffer.append(data) - self.buffer_size += len(data) - return - elif self.cache_size: - #self.buffer.write(data) - self.buffer.append(data) - self.buffer_size += len(data) - #if self.buffer.tell() > self.cache_size: - if self.buffer_size > self.cache_size: - #self.handle_data(self.buffer.getvalue()) - self.handle_data(''.join(self.buffer)) - #self.buffer.truncate(0) - #self.buffer.clear() - del self.buffer[:] - self.buffer_size = 0 - else: - self.handle_data(data) - - self.completed += len(data) - self.handle_status_update(self.size, self.completed) - self.handle_speed_update(self.completed, self.start_time) - if self.size == self.completed: - self.close() - self.flush_data() - self.handle_status_update(self.size, self.completed, force_update=True) - self.handle_speed_update(self.completed, self.start_time, force_update=True) - - def handle_data(self, data): - print len(data) - pass - - def flush_data(self): - #if self.buffer.tell(): - if self.buffer_size: - #self.handle_data(self.buffer.getvalue()) - self.handle_data(''.join(self.buffer)) - #self.buffer.truncate(0) - del self.buffer[:] - self.buffer_size = 0 - - def parse_headers(self, header): - lines = header.split('\r\n') - status_line = lines.pop(0) - #print status_line - protocal, status_code, status_text = re.match(r'^HTTP/([\d.]+) (\d+) (.+)$', status_line).groups() - status_code = int(status_code) - self.status_code = status_code - self.status_text = status_text - #headers = dict(h.split(': ', 1) for h in lines) - for k, v in (h.split(': ', 1) for h in lines): - self.headers[k.lower()] = v - - if status_code in (200, 206): - pass - elif status_code == 302: - return self.handle_http_relocate(self.headers['location']) - else: - return self.handle_http_status_error() - - self.size = self.headers.get('content-length', None) - if self.size is not None: - self.size = int(self.size) - self.handle_http_headers() - - def found_terminator(self): - if self.reading_headers: - self.reading_headers = False - #self.parse_headers("".join(self.buffer.getvalue())) - self.parse_headers("".join(self.buffer)) - #self.buffer.truncate(0) - del self.buffer[:] - self.buffer_size = 0 - self.set_terminator(None) - else: - raise NotImplementedError() - - def handle_http_headers(self): - pass - - def handle_http_status_error(self): - self.close() - - def handle_http_relocate(self, location): - self.close() - relocate_times = getattr(self, 'relocate_times', 0) - max_relocate_times = getattr(self, 'max_relocate_times', 2) - if relocate_times >= max_relocate_times: - raise Exception('too many relocate times') - new_client = self.__class__(location, **self.args) - new_client.relocate_times = relocate_times + 1 - new_client.max_relocate_times = max_relocate_times - self.next_client = new_client - - def handle_status_update(self, total, completed, force_update=False): - pass - - def handle_speed_update(self, completed, start_time, force_update=False): - pass - - def log_error(self, message): - print 'log_error', message - self.error_message = message - -class ProgressBar: - def __init__(self, total=0): - self.total = total - self.completed = 0 - self.start = time() - self.speed = 0 - self.bar_width = 0 - self.displayed = False - def update(self): - self.displayed = True - bar_size = 40 - if self.total: - percent = self.completed * 100.0 / self.total - if percent > 100: - percent = 100.0 - dots = int(bar_size * percent / 100) - plus = percent / 100 * bar_size - dots - if plus > 0.8: - plus = '=' - elif plus > 0.4: - plus = '-' - else: - plus = '' - bar = '=' * dots + plus - percent = int(percent) - else: - percent = 0 - bar = '-' - speed = self.speed - if speed < 1000: - speed = '%sB/s' % int(speed) - elif speed < 1000*10: - speed = '%.1fK/s' % (speed/1000.0) - elif speed < 1000*1000: - speed = '%dK/s' % int(speed/1000) - elif speed < 1000*1000*100: - speed = '%.1fM/s' % (speed/1000.0/1000.0) - else: - speed = '%dM/s' % int(speed/1000/1000) - seconds = time() - self.start - if seconds < 10: - seconds = '%.1fs' % seconds - elif seconds < 60: - seconds = '%ds' % int(seconds) - elif seconds < 60*60: - seconds = '%dm%ds' % (int(seconds/60), int(seconds)%60) - elif seconds < 60*60*24: - seconds = '%dh%dm%ds' % (int(seconds)/60/60, (int(seconds)/60)%60, int(seconds)%60) - else: - seconds = int(seconds) - days = seconds/60/60/24 - seconds -= days*60*60*24 - hours = seconds/60/60 - seconds -= hours*60*60 - minutes = seconds/60 - seconds -= minutes*60 - seconds = '%dd%dh%dm%ds' % (days, hours, minutes, seconds) - completed = ','.join((x[::-1] for x in reversed(re.findall('..?.?', str(self.completed)[::-1])))) - bar = '{0:>3}%[{1:<40}] {2:<12} {3:>4} in {4:>6s}'.format(percent, bar, completed, speed, seconds) - new_bar_width = len(bar) - bar = bar.ljust(self.bar_width) - self.bar_width = new_bar_width - sys.stdout.write('\r'+bar) - sys.stdout.flush() - def update_status(self, total, completed): - self.total = total - self.completed = completed - self.update() - def update_speed(self, start, speed): - self.start = start - self.speed = speed - self.update() - def done(self): - if self.displayed: - print - self.displayed = False - -def download(url, path, headers=None, resuming=False): - class download_client(http_client): - def __init__(self, url, headers=headers, start_from=0): - self.output = None - self.bar = ProgressBar() - http_client.__init__(self, url, headers=headers, start_from=start_from) - self.start_from = start_from - self.last_status_time = time() - self.last_speed_time = time() - self.last_size = 0 - self.path = path - def handle_close(self): - http_client.handle_close(self) - if self.output: - self.output.close() - self.output = None - def handle_http_status_error(self): - http_client.handle_http_status_error(self) - self.log_error('http status error: %s, %s' % (self.status_code, self.status_text)) - def handle_data(self, data): - if not self.output: - if self.start_from: - self.output = open(path, 'ab') - else: - self.output = open(path, 'wb') - self.output.write(data) - def handle_status_update(self, total, completed, force_update=False): - if total is None: - return - if time() - self.last_status_time > 1 or force_update: - #print '%.02f' % (completed*100.0/total) - self.bar.update_status(total+start_from, completed+start_from) - self.last_status_time = time() - def handle_speed_update(self, completed, start_time, force_update=False): - now = time() - period = now - self.last_speed_time - if period > 1 or force_update: - #print '%.02f, %.02f' % ((completed-self.last_size)/period, completed/(now-start_time)) - self.bar.update_speed(start_time, (completed-self.last_size)/period) - self.last_speed_time = time() - self.last_size = completed - def log_error(self, message): - self.bar.done() - http_client.log_error(self, message) - def __del__(self): # XXX: sometimes handle_close() is not called, don't know why... - #http_client.__del__(self) - if self.output: - self.output.close() - self.output = None - - max_retry_times = 25 - retry_times = 0 - start_from = 0 - if resuming and os.path.exists(path): - start_from = os.path.getsize(path) - # TODO: fix status bar for resuming - while True: - client = download_client(url, start_from=start_from) - asyncore.loop() - while hasattr(client, 'next_client'): - client = client.next_client - client.bar.done() - if getattr(client, 'error_message', None): - retry_times += 1 - if retry_times >= max_retry_times: - raise Exception(client.error_message) - if client.size and client.completed: - start_from = os.path.getsize(path) - print 'retry', retry_times - sleep(retry_times) - else: - break - - -def main(): - url, path = sys.argv[1:] - download(url, path) - -if __name__ == '__main__': - main() - diff --git a/xunlei-lixian/lixian_download_tools.py b/xunlei-lixian/lixian_download_tools.py deleted file mode 100644 index 4d1185b..0000000 --- a/xunlei-lixian/lixian_download_tools.py +++ /dev/null @@ -1,128 +0,0 @@ - -__all__ = ['download_tool', 'get_tool'] - -from lixian_config import * -import subprocess -import urllib2 -import os.path - -download_tools = {} - -def download_tool(name): - def register(tool): - download_tools[name] = tool_adaptor(tool) - return tool - return register - -class DownloadToolAdaptor: - def __init__(self, tool, **kwargs): - self.tool = tool - self.client = kwargs['client'] - self.url = kwargs['url'] - self.path = kwargs['path'] - self.resuming = kwargs.get('resuming') - self.size = kwargs['size'] - def finished(self): - assert os.path.getsize(self.path) <= self.size, 'existing file (%s) bigger than expected (%s)' % (os.path.getsize(self.path), self.size) - return os.path.getsize(self.path) == self.size - def __call__(self): - self.tool(self.client, self.url, self.path, self.resuming) - -def tool_adaptor(tool): - import types - if type(tool) == types.FunctionType: - def adaptor(**kwargs): - return DownloadToolAdaptor(tool, **kwargs) - return adaptor - else: - return tool - - -def check_bin(bin): - import distutils.spawn - assert distutils.spawn.find_executable(bin), "Can't find %s" % bin - -@download_tool('urllib2') -def urllib2_download(client, download_url, filename, resuming=False): - '''In the case you don't even have wget...''' - assert not resuming - print 'Downloading', download_url, 'to', filename, '...' - request = urllib2.Request(download_url, headers={'Cookie': 'gdriveid='+client.get_gdriveid()}) - response = urllib2.urlopen(request) - import shutil - with open(filename, 'wb') as output: - shutil.copyfileobj(response, output) - -@download_tool('asyn') -def asyn_download(client, download_url, filename, resuming=False): - import lixian_download_asyn - lixian_download_asyn.download(download_url, filename, headers={'Cookie': 'gdriveid='+str(client.get_gdriveid())}, resuming=resuming) - -@download_tool('wget') -def wget_download(client, download_url, filename, resuming=False): - gdriveid = str(client.get_gdriveid()) - wget_opts = ['wget', '--header=Cookie: gdriveid='+gdriveid, download_url, '-O', filename] - if resuming: - wget_opts.append('-c') - wget_opts.extend(get_config('wget-opts', '').split()) - check_bin(wget_opts[0]) - exit_code = subprocess.call(wget_opts) - if exit_code != 0: - raise Exception('wget exited abnormally') - -@download_tool('curl') -def curl_download(client, download_url, filename, resuming=False): - gdriveid = str(client.get_gdriveid()) - curl_opts = ['curl', '-L', download_url, '--cookie', 'gdriveid='+gdriveid, '--output', filename] - if resuming: - curl_opts += ['--continue-at', '-'] - curl_opts.extend(get_config('curl-opts', '').split()) - check_bin(curl_opts[0]) - exit_code = subprocess.call(curl_opts) - if exit_code != 0: - raise Exception('curl exited abnormally') - -@download_tool('aria2') -@download_tool('aria2c') -class Aria2DownloadTool: - def __init__(self, **kwargs): - self.gdriveid = str(kwargs['client'].get_gdriveid()) - self.url = kwargs['url'] - self.path = kwargs['path'] - self.size = kwargs['size'] - self.resuming = kwargs.get('resuming') - def finished(self): - assert os.path.getsize(self.path) <= self.size, 'existing file (%s) bigger than expected (%s)' % (os.path.getsize(self.path), self.size) - return os.path.getsize(self.path) == self.size and not os.path.exists(self.path + '.aria2') - def __call__(self): - gdriveid = self.gdriveid - download_url = self.url - path = self.path - resuming = self.resuming - dir = os.path.dirname(path) - filename = os.path.basename(path) - aria2_opts = ['aria2c', '--header=Cookie: gdriveid='+gdriveid, download_url, '--out', filename, '--file-allocation=none'] - if dir: - aria2_opts.extend(('--dir', dir)) - if resuming: - aria2_opts.append('-c') - aria2_opts.extend(get_config('aria2-opts', '').split()) - check_bin(aria2_opts[0]) - exit_code = subprocess.call(aria2_opts) - if exit_code != 0: - raise Exception('aria2c exited abnormally') - -@download_tool('axel') -def axel_download(client, download_url, path, resuming=False): - gdriveid = str(client.get_gdriveid()) - axel_opts = ['axel', '--header=Cookie: gdriveid='+gdriveid, download_url, '--output', path] - axel_opts.extend(get_config('axel-opts', '').split()) - check_bin(axel_opts[0]) - exit_code = subprocess.call(axel_opts) - if exit_code != 0: - raise Exception('axel exited abnormally') - -def get_tool(name): - return download_tools[name] - - diff --git a/xunlei-lixian/lixian_encoding.py b/xunlei-lixian/lixian_encoding.py deleted file mode 100644 index 33930d2..0000000 --- a/xunlei-lixian/lixian_encoding.py +++ /dev/null @@ -1,27 +0,0 @@ - -from lixian_config import get_config -import sys - -default_encoding = get_config('encoding', sys.getfilesystemencoding()) -if default_encoding is None or default_encoding.lower() == 'ascii': - default_encoding = 'utf-8' - - -def to_native(s): - if type(s) == unicode: - return s.encode(default_encoding) - else: - return s - -def from_native(s): - if type(s) == str: - return s.decode(default_encoding) - else: - return s - -def try_native_to_utf_8(url): - try: - return url.decode(default_encoding).encode('utf-8') - except: - return url - diff --git a/xunlei-lixian/lixian_filter_expr.py b/xunlei-lixian/lixian_filter_expr.py deleted file mode 100644 index 1a9fe9f..0000000 --- a/xunlei-lixian/lixian_filter_expr.py +++ /dev/null @@ -1,69 +0,0 @@ - -__all__ = ['filter_expr'] - -import re - -def get_name(x): - assert isinstance(x, (basestring, dict)) - if type(x) == dict: - return x['name'] - else: - return x - -def filter_expr1(links, p): - if not links: - return links - if re.match(r'^\[[^][]+\]$', p): - matched = [] - for p in re.split(r'\s*,\s*', p[1:-1]): - assert re.match(r'^\d+(-\d+)?|\.\w+$', p), p - if re.match(r'^\d+$', p): - i = int(p) - matched.append((i, links[i])) - elif '-' in p: - start, end = p.split('-') - if not start: - start = 0 - if not end: - end = len(links) - 1 - start = int(start) - end = int(end) - assert 0 <= start < len(links) - assert 0 <= end < len(links) - if start <= end: - matched += list(enumerate(links))[start:end+1] - else: - matched += reversed(list(enumerate(links))[end:start+1]) - elif p.startswith('.'): - matched += filter(lambda (i, x): get_name(x).lower().endswith(p.lower()), enumerate(links)) - else: - raise NotImplementedError(p) - indexes = [] - for i, _ in matched: - if i not in indexes: - indexes.append(i) - return [links[x] for x in indexes] - elif re.match(r'^\d+$', p): - n = int(p) - if 0 <= n < len(links): - return [links[int(p)]] - else: - return filter(lambda x: re.search(p, get_name(x), re.I), links) - elif p == '*': - return links - elif re.match(r'\.\w+$', p): - return filter(lambda x: get_name(x).lower().endswith(p.lower()), links) - else: - import lixian_plugins.filters - filter_results = lixian_plugins.filters.filter_things(links, p) - if filter_results is None: - return filter(lambda x: re.search(p, get_name(x), re.I), links) - else: - return filter_results - -def filter_expr(links, expr): - for p in expr.split('/'): - links = filter_expr1(links, p) - return links - - diff --git a/xunlei-lixian/lixian_hash.py b/xunlei-lixian/lixian_hash.py deleted file mode 100755 index bae5205..0000000 --- a/xunlei-lixian/lixian_hash.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python - -import hashlib -import lixian_hash_ed2k -import lixian_hash_bt -import os - -def lib_hash_file(h, path): - with open(path, 'rb') as stream: - while True: - bytes = stream.read(1024*1024) - if not bytes: - break - h.update(bytes) - return h.hexdigest() - -def sha1_hash_file(path): - return lib_hash_file(hashlib.sha1(), path) - -def verify_sha1(path, sha1): - return sha1_hash_file(path).lower() == sha1.lower() - -def md5_hash_file(path): - return lib_hash_file(hashlib.md5(), path) - -def verify_md5(path, md5): - return md5_hash_file(path).lower() == md5.lower() - -def md4_hash_file(path): - return lib_hash_file(hashlib.new('md4'), path) - -def verify_md4(path, md4): - return md4_hash_file(path).lower() == md4.lower() - -def dcid_hash_file(path): - h = hashlib.sha1() - size = os.path.getsize(path) - with open(path, 'rb') as stream: - if size < 0xF000: - h.update(stream.read()) - else: - h.update(stream.read(0x5000)) - stream.seek(size/3) - h.update(stream.read(0x5000)) - stream.seek(size-0x5000) - h.update(stream.read(0x5000)) - return h.hexdigest() - -def verify_dcid(path, dcid): - return dcid_hash_file(path).lower() == dcid.lower() - -def main(args): - option = args.pop(0) - def verify_bt(f, t): - from lixian_progress import SimpleProgressBar - bar = SimpleProgressBar() - result = lixian_hash_bt.verify_bt_file(t, f, progress_callback=bar.update) - bar.done() - return result - if option.startswith('--verify'): - hash_fun = {'--verify-sha1':verify_sha1, - '--verify-md5':verify_md5, - '--verify-md4':verify_md4, - '--verify-dcid':verify_dcid, - '--verify-ed2k':lixian_hash_ed2k.verify_ed2k_link, - '--verify-bt': verify_bt, - }[option] - assert len(args) == 2 - hash, path = args - if hash_fun(path, hash): - print 'looks good...' - else: - print 'failed...' - else: - hash_fun = {'--sha1':sha1_hash_file, - '--md5':md5_hash_file, - '--md4':md4_hash_file, - '--dcid':dcid_hash_file, - '--ed2k':lixian_hash_ed2k.generate_ed2k_link, - '--info-hash':lixian_hash_bt.info_hash, - }[option] - for f in args: - h = hash_fun(f) - print '%s *%s' % (h, f) - -if __name__ == '__main__': - import sys - args = sys.argv[1:] - main(args) - diff --git a/xunlei-lixian/lixian_hash_bt.py b/xunlei-lixian/lixian_hash_bt.py deleted file mode 100644 index 3a026be..0000000 --- a/xunlei-lixian/lixian_hash_bt.py +++ /dev/null @@ -1,249 +0,0 @@ - -import os.path -import sys -import hashlib -from cStringIO import StringIO -import re - -from lixian_encoding import default_encoding - -def magnet_to_infohash(magnet): - import re - import base64 - m = re.match(r'magnet:\?xt=urn:btih:(\w+)', magnet) - assert m, magnet - code = m.group(1) - if re.match(r'^[a-zA-Z0-9]{40}$', code): - return code.decode('hex') - else: - return base64.b32decode(code) - -class decoder: - def __init__(self, bytes): - self.bytes = bytes - self.i = 0 - def decode_value(self): - x = self.bytes[self.i] - if x.isdigit(): - return self.decode_string() - self.i += 1 - if x == 'd': - v = {} - while self.peek() != 'e': - k = self.decode_string() - v[k] = self.decode_value() - self.i += 1 - return v - elif x == 'l': - v = [] - while self.peek() != 'e': - v.append(self.decode_value()) - self.i += 1 - return v - elif x == 'i': - return self.decode_int() - else: - raise NotImplementedError(x) - def decode_string(self): - i = self.bytes.index(':', self.i) - n = int(self.bytes[self.i:i]) - s = self.bytes[i+1:i+1+n] - self.i = i + 1 + n - return s - def decode_int(self): - e = self.bytes.index('e', self.i) - n = int(self.bytes[self.i:e]) - self.i = e + 1 - return n - def peek(self): - return self.bytes[self.i] - -class encoder: - def __init__(self, stream): - self.stream = stream - def encode(self, v): - if type(v) == str: - self.stream.write(str(len(v))) - self.stream.write(':') - self.stream.write(v) - elif type(v) == dict: - self.stream.write('d') - for k in sorted(v): - self.encode(k) - self.encode(v[k]) - self.stream.write('e') - elif type(v) == list: - self.stream.write('l') - for x in v: - self.encode(x) - self.stream.write('e') - elif type(v) in (int, long): - self.stream.write('i') - self.stream.write(str(v)) - self.stream.write('e') - else: - raise NotImplementedError(type(v)) - -def bdecode(bytes): - return decoder(bytes).decode_value() - -def bencode(v): - from cStringIO import StringIO - stream = StringIO() - encoder(stream).encode(v) - return stream.getvalue() - -def assert_content(content): - assert re.match(r'd\d+:', content), 'Probably not a valid content file [%s...]' % repr(content[:17]) - -def info_hash_from_content(content): - assert_content(content) - return hashlib.sha1(bencode(bdecode(content)['info'])).hexdigest() - -def info_hash(path): - if not path.lower().endswith('.torrent'): - print '[WARN] Is it really a .torrent file? '+path - if os.path.getsize(path) > 3*1000*1000: - raise NotImplementedError('Torrent file too big') - with open(path, 'rb') as stream: - return info_hash_from_content(stream.read()) - -def encode_path(path): - return path.decode('utf-8').encode(default_encoding) - -class sha1_reader: - def __init__(self, pieces, progress_callback=None): - assert pieces - assert len(pieces) % 20 == 0 - self.total = len(pieces)/20 - self.processed = 0 - self.stream = StringIO(pieces) - self.progress_callback = progress_callback - def next_sha1(self): - self.processed += 1 - if self.progress_callback: - self.progress_callback(float(self.processed)/self.total) - return self.stream.read(20) - -def sha1_update_stream(sha1, stream, n): - while n > 0: - readn = min(n, 1024*1024) - bytes = stream.read(readn) - assert len(bytes) == readn - n -= readn - sha1.update(bytes) - assert n == 0 - -def verify_bt_single_file(path, info, progress_callback=None): - # TODO: check md5sum if available - if os.path.getsize(path) != info['length']: - return False - piece_length = info['piece length'] - assert piece_length > 0 - sha1_stream = sha1_reader(info['pieces'], progress_callback=progress_callback) - size = info['length'] - with open(path, 'rb') as stream: - while size > 0: - n = min(size, piece_length) - size -= n - sha1sum = hashlib.sha1() - sha1_update_stream(sha1sum, stream, n) - if sha1sum.digest() != sha1_stream.next_sha1(): - return False - assert size == 0 - assert stream.read(1) == '' - assert sha1_stream.next_sha1() == '' - return True - -def verify_bt_multiple(folder, info, file_set=None, progress_callback=None): - # TODO: check md5sum if available - piece_length = info['piece length'] - assert piece_length > 0 - - path_encoding = info.get('encoding', 'utf-8') - files = [] - for x in info['files']: - if 'path.utf-8' in x: - unicode_path = [p.decode('utf-8') for p in x['path.utf-8']] - else: - unicode_path = [p.decode(path_encoding) for p in x['path']] - native_path = [p.encode(default_encoding) for p in unicode_path] - utf8_path = [p.encode('utf-8') for p in unicode_path] - files.append({'path':os.path.join(folder, apply(os.path.join, native_path)), 'length':x['length'], 'file':utf8_path}) - - sha1_stream = sha1_reader(info['pieces'], progress_callback=progress_callback) - sha1sum = hashlib.sha1() - - piece_left = piece_length - complete_piece = True - - while files: - f = files.pop(0) - path = f['path'] - size = f['length'] - if os.path.exists(path) and ((not file_set) or (f['file'] in file_set)): - if os.path.getsize(path) != size: - return False - if size <= piece_left: - with open(path, 'rb') as stream: - sha1_update_stream(sha1sum, stream, size) - assert stream.read(1) == '' - piece_left -= size - if not piece_left: - if sha1sum.digest() != sha1_stream.next_sha1() and complete_piece: - return False - complete_piece = True - sha1sum = hashlib.sha1() - piece_left = piece_length - else: - with open(path, 'rb') as stream: - while size >= piece_left: - size -= piece_left - sha1_update_stream(sha1sum, stream, piece_left) - if sha1sum.digest() != sha1_stream.next_sha1() and complete_piece: - return False - complete_piece = True - sha1sum = hashlib.sha1() - piece_left = piece_length - if size: - sha1_update_stream(sha1sum, stream, size) - piece_left -= size - else: - if size: - while size >= piece_left: - size -= piece_left - sha1_stream.next_sha1() - sha1sum = hashlib.sha1() - piece_left = piece_length - if size: - complete_piece = False - piece_left -= size - else: - complete_piece = True - - if piece_left < piece_length: - if complete_piece: - if sha1sum.digest() != sha1_stream.next_sha1(): - return False - else: - sha1_stream.next_sha1() - assert sha1_stream.next_sha1() == '' - - return True - -def verify_bt(path, info, file_set=None, progress_callback=None): - if not os.path.exists(path): - raise Exception("File doesn't exist: %s" % path) - if 'files' not in info: - if os.path.isfile(path): - return verify_bt_single_file(path, info, progress_callback=progress_callback) - else: - path = os.path.join(path, encode_path(info['name'])) - return verify_bt_single_file(path, info, progress_callback=progress_callback) - else: - return verify_bt_multiple(path, info, file_set=file_set, progress_callback=progress_callback) - -def verify_bt_file(path, torrent_path, file_set=None, progress_callback=None): - with open(torrent_path, 'rb') as x: - return verify_bt(path, bdecode(x.read())['info'], file_set, progress_callback) - diff --git a/xunlei-lixian/lixian_hash_ed2k.py b/xunlei-lixian/lixian_hash_ed2k.py deleted file mode 100644 index 0d88552..0000000 --- a/xunlei-lixian/lixian_hash_ed2k.py +++ /dev/null @@ -1,79 +0,0 @@ - -import hashlib - -chunk_size = 9728000 -buffer_size = 1024*1024 - -def md4(): - return hashlib.new('md4') - -def hash_stream(stream): - total_md4 = None - while True: - chunk_md4 = md4() - chunk_left = chunk_size - while chunk_left: - n = min(chunk_left, buffer_size) - part = stream.read(n) - chunk_md4.update(part) - if len(part) < n: - if total_md4: - total_md4.update(chunk_md4.digest()) - return total_md4.hexdigest() - else: - return chunk_md4.hexdigest() - chunk_left -= n - if total_md4 is None: - total_md4 = md4() - total_md4.update(chunk_md4.digest()) - raise NotImplementedError() - -def hash_string(s): - from cStringIO import StringIO - return hash_stream(StringIO(s)) - -def hash_file(path): - with open(path, 'rb') as stream: - return hash_stream(stream) - -def parse_ed2k_link(link): - import re, urllib - ed2k_re = r'ed2k://\|file\|([^|]*)\|(\d+)\|([a-fA-F0-9]{32})\|' - m = re.match(ed2k_re, link) or re.match(ed2k_re, urllib.unquote(link)) - if not m: - raise Exception('not an acceptable ed2k link: '+link) - name, file_size, hash_hex = m.groups() - from lixian_url import unquote_url - return unquote_url(name), hash_hex.lower(), int(file_size) - -def parse_ed2k_id(link): - return parse_ed2k_link(link)[1:] - -def parse_ed2k_file(link): - return parse_ed2k_link(link)[0] - -def verify_ed2k_link(path, link): - hash_hex, file_size = parse_ed2k_id(link) - import os.path - if os.path.getsize(path) != file_size: - return False - return hash_file(path).lower() == hash_hex.lower() - -def generate_ed2k_link(path): - import sys, os.path, urllib - filename = os.path.basename(path) - encoding = sys.getfilesystemencoding() - if encoding.lower() != 'ascii': - filename = filename.decode(encoding).encode('utf-8') - return 'ed2k://|file|%s|%d|%s|/' % (urllib.quote(filename), os.path.getsize(path), hash_file(path)) - -def test_md4(): - assert hash_string("") == '31d6cfe0d16ae931b73c59d7e0c089c0' - assert hash_string("a") == 'bde52cb31de33e46245e05fbdbd6fb24' - assert hash_string("abc") == 'a448017aaf21d8525fc10ae87aa6729d' - assert hash_string("message digest") == 'd9130a8164549fe818874806e1c7014b' - assert hash_string("abcdefghijklmnopqrstuvwxyz") == 'd79e1c308aa5bbcdeea8ed63df412da9' - assert hash_string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") == '043f8582f241db351ce627e153e7f0e4' - assert hash_string("12345678901234567890123456789012345678901234567890123456789012345678901234567890") == 'e33b4ddc9c38f2199c3e7b164fcc0536' - - diff --git a/xunlei-lixian/lixian_help.py b/xunlei-lixian/lixian_help.py deleted file mode 100644 index 1d50424..0000000 --- a/xunlei-lixian/lixian_help.py +++ /dev/null @@ -1,300 +0,0 @@ - -basic_commands = [ - ('help', "try this help..."), - ('login', "login Xunlei cloud"), - ('download', "download tasks from Xunlei cloud"), - ('list', "list tasks on Xunlei cloud"), - ('add', "add tasks to Xunlei cloud"), - ('delete', "delete tasks from Xunlei cloud"), - ('pause', "pause tasks on Xunlei cloud"), - ('restart', "restart tasks on Xunlei cloud"), - ('rename', "rename task"), - ('readd', "re-add tasks"), - ('config', "save configuration so you don't have to repeat it"), - ('info', "print user id, internal user id, and gdriveid"), - ('logout', "logout from Xunlei cloud"), -] - -def join_commands(commands): - n = max(len(x[0]) for x in commands) - n = max(n, 10) - return ''.join(' %%-%ds %%s\n' % n % (k, h) for (k, h) in commands) - -basic_usage = '''python lixian_cli.py [] - -Basic commands: -''' + join_commands(basic_commands) - -extended_usage = '' - -# lx -def usage(): - return basic_usage + ''' -Use 'python lixian_cli.py help' for details. -Use 'python lixian_cli.py help ' for more information on a specific command. -Check https://github.com/iambus/xunlei-lixian for detailed (and Chinese) doc.''' - -# lx xxx -# lx help help -help_help = '''Get helps: - python lixian_cli.py help help - python lixian_cli.py help examples - python lixian_cli.py help readme - python lixian_cli.py help ''' - -# lx xxx -# lx help help -help = help_help - -# lx help -# lx -h -def welcome_help(): - return '''Python script for Xunlei cloud. - -Basic usage: -''' + basic_usage + extended_usage + '\n' + help_help - -def examples(): - return '''python lixian_cli.py login "Your Xunlei account" "Your password" -python lixian_cli.py login "Your password" -python lixian_cli.py login - -python lixian_cli.py config username "Your Xunlei account" -python lixian_cli.py config password "Your password" - -python lixian_cli.py list -python lixian_cli.py list --completed -python lixian_cli.py list --completed --name --original-url --download-url --no-status --no-id -python lixian_cli.py list --deleted -python lixian_cli.py list --expired -python lixian_cli.py list id1 id2 -python lixian_cli.py list zip rar -python lixian_cli.py list 2012.04.04 2012.04.05 - -python lixian_cli.py download task-id -python lixian_cli.py download ed2k-url -python lixian_cli.py download --tool=wget ed2k-url -python lixian_cli.py download --tool=asyn ed2k-url -python lixian_cli.py download ed2k-url --output "file to save" -python lixian_cli.py download id1 id2 id3 -python lixian_cli.py download url1 url2 url3 -python lixian_cli.py download --input download-urls-file -python lixian_cli.py download --input download-urls-file --delete -python lixian_cli.py download --input download-urls-file --output-dir root-dir-to-save-files -python lixian_cli.py download bt://torrent-info-hash -python lixian_cli.py download 1.torrent -python lixian_cli.py download torrent-info-hash -python lixian_cli.py download --bt http://xxx/xxx.torrent -python lixian_cli.py download bt-task-id/file-id -python lixian_cli.py download --all -python lixian_cli.py download mkv -python lixian_cli.py download 2012.04.04 -python lixian_cli.py download 0 1 2 -python lixian_cli.py download 0-2 - -python lixian_cli.py add url -python lixian_cli.py add 1.torrent -python lixian_cli.py add torrent-info-hash -python lixian_cli.py add --bt http://xxx/xxx.torrent - -python lixian_cli.py delete task-id -python lixian_cli.py delete url -python lixian_cli.py delete file-name-on-cloud-to-delete - -python lixian_cli.py pause id - -python lixian_cli.py restart id - -python lixian_cli.py rename id name - -python lixian_cli.py logout - -Please check https://github.com/iambus/xunlei-lixian for detailed (and Chinese) doc. -''' - -def readme(): - import sys - import os.path - doc = os.path.join(sys.path[0], 'README.md') - with open(doc) as txt: - return txt.read().decode('utf-8') - - -login = '''python lixian_cli.py login - -login Xunlei cloud - -Examples: - python lixian_cli.py login "Your Xunlei account" "Your password" - python lixian_cli.py login "Your password" - python lixian_cli.py login -''' - -download = '''python lixian_cli.py download [options] [id|url]... - -download tasks from Xunlei cloud - -Options: - --input=[file] -i Download URLs found in file. - --output=[file] -o Download task to file. - --output-dir=[dir] Download task to dir. - --tool=[wget|asyn|aria2|curl] Choose download tool. - Default: wget - --continue -c Continue downloading a partially downloaded file. - Default: false. - --overwrite Overwrite partially downloaded file. - Default: false. - --delete Delete task from Xunlei cloud after download is finished. - Default: false. - --torrent --bt Treat URLs as torrent files - Default: false. - --all Download all tasks. This option will be ignored if specific download URLs or task ids can be found. - Default: false. - --hash When this option is false (--no-hash), never do full hash, but a minimal hash will be performed (supposed to be very fast). - Default: true. - --mini-hash If the target file already exists, and the file size is complete, do a minimal hash (instead of full hash, which would be much more expensive). This is useful when you are resuming a batch download, in this case the previously downloaded and verified files won't be re-verified. - Default: false. - -Examples: - python lixian_cli.py download task-id - python lixian_cli.py download ed2k-url - python lixian_cli.py download --tool=wget ed2k-url - python lixian_cli.py download --tool=asyn ed2k-url - python lixian_cli.py download ed2k-url --output "file to save" - python lixian_cli.py download id1 id2 id3 - python lixian_cli.py download url1 url2 url3 - python lixian_cli.py download --input download-urls-file - python lixian_cli.py download --input download-urls-file --delete - python lixian_cli.py download --input download-urls-file --output-dir root-dir-to-save-files - python lixian_cli.py download bt://torrent-info-hash - python lixian_cli.py download 1.torrent - python lixian_cli.py download torrent-info-hash - python lixian_cli.py download --bt http://xxx/xxx.torrent - python lixian_cli.py download bt-task-id/file-id - python lixian_cli.py download --all - python lixian_cli.py download mkv - python lixian_cli.py download 2012.04.04 - python lixian_cli.py download 0 1 2 - python lixian_cli.py download 0-2 -''' - -list = '''python lixian_cli.py list - -list tasks on Xunlei cloud - -Options: - --completed Print only completed tasks. Default: no - --deleted Print only deleted tasks. Default: no - --expired Print only expired tasks. Default: no - --[no]-n Print task sequence number. Default: no - --[no]-id Print task id. Default: yes - --[no]-name Print task name. Default: yes - --[no]-status Print task status. Default: yes - --[no]-size Print task size. Default: no - --[no]-progress Print task progress (in percent). Default: no - --[no]-speed Print task speed. Default: no - --[no]-date Print the date task added. Default: no - --[no]-original-url Print the original URL. Default: no - --[no]-download-url Print the download URL used to download from Xunlei cloud. Default: no - --[no]-format-size Print file size in human readable format. Default: no - --[no]-colors Colorful output. Default: yes - -Examples: - python lixian_cli.py list - python lixian_cli.py list id - python lixian_cli.py list bt-task-id/ - python lixian_cli.py list --completed - python lixian_cli.py list --completed --name --original-url --download-url --no-status --no-id - python lixian_cli.py list --deleted - python lixian_cli.py list --expired - python lixian_cli.py list id1 id2 - python lixian_cli.py list zip rar - python lixian_cli.py list 2012.04.04 2012.04.05 -''' - -add = '''python lixian_cli.py add [options] url... - -add tasks to Xunlei cloud - -Options: - --input=[file] Download URLs found in file. - --torrent --bt Treat all arguments as torrent files (e.g. local torrent file, torrent http url, torrent info hash) - Default: false. - -Examples: - python lixian_cli.py add url - python lixian_cli.py add 1.torrent - python lixian_cli.py add torrent-info-hash - python lixian_cli.py add --bt http://xxx/xxx.torrent -''' - -delete = '''python lixian_cli.py delete [options] [id|url|filename|keyword|date]... - -delete tasks from Xunlei cloud - -Options: - -i prompt before delete - --all delete all tasks if there are multiple matches - -Examples: - python lixian_cli.py delete task-id - python lixian_cli.py delete url - python lixian_cli.py delete file-name-on-cloud-to-delete -''' - -pause = '''python lixian_cli.py pause [options] [id|url|filename|keyword|date]... - -pause tasks on Xunlei cloud - -Options: - -i prompt before pausing tasks - --all pause all tasks if there are multiple matches -''' - -restart = '''python lixian_cli.py restart [id|url|filename|keyword|date]... - -restart tasks on Xunlei cloud - -Options: - -i prompt before restart - --all restart all tasks if there are multiple matches -''' - -rename = '''python lixian_cli.py rename task-id task-name - -rename task -''' - -readd = '''python lixian_cli.py readd [--deleted|--expired] task-id... - -re-add deleted/expired tasks - -Options: - --deleted re-add deleted tasks - --expired re-add expired tasks -''' - -config = '''python lixian_cli.py config key [value] - -save configuration so you don't have to repeat it - -Examples: - python lixian_cli.py config username "your xunlei id" - python lixian_cli.py config password "your xunlei password" - python lixian_cli.py config continue -''' - -info = '''python lixian_cli.py info - -print user id, internal user id, and gdriveid - -Options: - --id -i print user id only -''' - -logout = '''python lixian_cli.py logout - -logout from Xunlei cloud -''' - - diff --git a/xunlei-lixian/lixian_logging.py b/xunlei-lixian/lixian_logging.py deleted file mode 100644 index 2ad85e7..0000000 --- a/xunlei-lixian/lixian_logging.py +++ /dev/null @@ -1,91 +0,0 @@ - -__all__ = ['init_logger', 'get_logger'] - -import logging - -INFO = logging.INFO -DEBUG = logging.DEBUG -TRACE = 1 - -def file_logger(path, level): - import os.path - path = os.path.expanduser(path) - - logger = logging.getLogger('lixian') - logger.setLevel(min(level, DEBUG)) # if file log is enabled, always log debug message - - handler = logging.FileHandler(filename=path, ) - handler.setFormatter(logging.Formatter('%(asctime)s %(message)s')) - - logger.addHandler(handler) - - return logger - -class ConsoleLogger: - def __init__(self, level=INFO): - self.level = level - def stdout(self, message): - print message - def info(self, message): - if self.level <= INFO: - print message - def debug(self, message): - if self.level <= DEBUG: - print message - def trace(self, message): - pass - -class FileLogger: - def __init__(self, path, level=INFO, file_level=None, console_level=None): - console_level = console_level or level - file_level = file_level or level - self.console = ConsoleLogger(console_level) - self.logger = file_logger(path, file_level) - def stdout(self, message): - self.console.stdout(message) - def info(self, message): - self.console.info(message) - self.logger.info(message) - def debug(self, message): - self.console.debug(message) - self.logger.debug(message) - def trace(self, message): - self.logger.log(level=TRACE, msg=message) - -default_logger = None - -def init_logger(use_colors=True, level=INFO, path=None): - global default_logger - if not default_logger: - if isinstance(level, int): - assert level in (INFO, DEBUG, TRACE) - console_level = level - file_level = level - elif isinstance(level, basestring): - level = level.lower() - if level in ('info', 'debug', 'trace'): - level = {'info': INFO, 'debug': DEBUG, 'trace': TRACE}[level] - console_level = level - file_level = level - else: - console_level = INFO - file_level = DEBUG - for level in level.split(','): - device, level = level.split(':') - if device == 'console': - console_level = {'info': INFO, 'debug': DEBUG, 'trace': TRACE}[level] - elif device == 'file': - file_level = {'info': INFO, 'debug': DEBUG, 'trace': TRACE}[level] - else: - raise NotImplementedError('Invalid logging level: ' + device) - else: - raise NotImplementedError(type(level)) - if path: - default_logger = FileLogger(path, console_level=console_level, file_level=file_level) - else: - default_logger = ConsoleLogger(console_level) - -def get_logger(): - init_logger() - return default_logger - diff --git a/xunlei-lixian/lixian_nodes.py b/xunlei-lixian/lixian_nodes.py deleted file mode 100644 index e25ef00..0000000 --- a/xunlei-lixian/lixian_nodes.py +++ /dev/null @@ -1,149 +0,0 @@ - -import lixian_logging - -import urllib2 -import re - -VOD_RANGE = '0-50' - -def resolve_node_url(url, gdriveid, timeout=60): - request = urllib2.Request(url, headers={'Cookie': 'gdriveid=' + gdriveid}) - response = urllib2.urlopen(request, timeout=timeout) - response.close() - return response.geturl() - -def switch_node_in_url(node_url, node): - return re.sub(r'(http://)(vod\d+)(\.t\d+\.lixian\.vip\.xunlei\.com)', r'\1%s\3' % node, node_url) - - -def switch_node(url, node, gdriveid): - assert re.match(r'^vod\d+$', node) - logger = lixian_logging.get_logger() - logger.debug('Download URL: ' + url) - try: - url = resolve_node_url(url, gdriveid, timeout=60) - logger.debug('Resolved URL: ' + url) - except: - import traceback - logger.debug(traceback.format_exc()) - return url - url = switch_node_in_url(url, node) - logger.debug('Switch to node URL: ' + url) - return url - -def test_response_speed(response, max_size, max_duration): - import time - current_duration = 0 - current_size = 0 - start = time.clock() - while current_duration < max_duration and current_size < max_size: - data = response.read(max_size - current_size) - if not data: - # print "End of file" - break - current_size += len(data) - end = time.clock() - current_duration = end - start - if current_size < 1024: - raise Exception("Sample too small: %d" % current_size) - return current_size / current_duration, current_size, current_duration - - -def get_node_url_speed(url, gdriveid): - request = urllib2.Request(url, headers={'Cookie': 'gdriveid=' + gdriveid}) - response = urllib2.urlopen(request, timeout=3) - speed, size, duration = test_response_speed(response, 2*1000*1000, 3) - response.close() - return speed - - -def parse_vod_nodes(vod_nodes): - if vod_nodes == 'all' or not vod_nodes: - vod_nodes = VOD_RANGE - nodes = [] - # remove duplicate nodes - seen = set() - def add(node): - if node not in seen: - nodes.append(node) - seen.add(node) - for expr in re.split(r'\s*,\s*', vod_nodes): - if re.match(r'^\d+-\d+$', expr): - start, end = map(int, expr.split('-')) - if start <= end: - for i in range(start, end + 1): - add("vod%d" % i) - else: - for i in range(start, end - 1, -1): - add("vod%d" % i) - elif re.match(r'^\d+$', expr): - add('vod'+expr) - else: - raise Exception("Invalid vod expr: " + expr) - return nodes - -def get_best_node_url_from(node_url, nodes, gdriveid): - best = None - best_speed = 0 - logger = lixian_logging.get_logger() - for node in nodes: - url = switch_node_in_url(node_url, node) - try: - speed = get_node_url_speed(url, gdriveid) - logger.debug("%s speed: %s" % (node, speed)) - if speed > best_speed: - best_speed = speed - best = url - except Exception, e: - logger.debug("%s error: %s" % (node, e)) - return best - -def get_good_node_url_from(node_url, nodes, acceptable_speed, gdriveid): - best = None - best_speed = 0 - logger = lixian_logging.get_logger() - for node in nodes: - url = switch_node_in_url(node_url, node) - try: - speed = get_node_url_speed(url, gdriveid) - logger.debug("%s speed: %s" % (node, speed)) - if speed > acceptable_speed: - return url - elif speed > best_speed: - best_speed = speed - best = url - except Exception, e: - logger.debug("%s error: %s" % (node, e)) - return best - -def use_node_by_policy(url, vod_nodes, gdriveid, policy): - nodes = parse_vod_nodes(vod_nodes) - assert nodes - logger = lixian_logging.get_logger() - logger.debug('Download URL: ' + url) - try: - node_url = resolve_node_url(url, gdriveid, timeout=60) - logger.debug('Resolved URL: ' + node_url) - except: - import traceback - logger.debug(traceback.format_exc()) - return url - default_node = re.match(r'http://(vod\d+)\.', node_url).group(1) - if default_node not in nodes: - nodes.insert(0, default_node) - chosen = policy(node_url, nodes, gdriveid) - if chosen: - logger.debug('Switch to URL: ' + chosen) - return chosen - else: - return node_url - - -def use_fastest_node(url, vod_nodes, gdriveid): - return use_node_by_policy(url, vod_nodes, gdriveid, get_best_node_url_from) - -def use_fast_node(url, vod_nodes, acceptable_speed, gdriveid): - def policy(url, vod_nodes, gdriveid): - return get_good_node_url_from(url, vod_nodes, acceptable_speed, gdriveid) - return use_node_by_policy(url, vod_nodes, gdriveid, policy) - diff --git a/xunlei-lixian/lixian_plugins/__init__.py b/xunlei-lixian/lixian_plugins/__init__.py deleted file mode 100644 index 9d2ee87..0000000 --- a/xunlei-lixian/lixian_plugins/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ - -def load_plugins_at(dir): - import os - import os.path - import re - home = os.path.dirname(os.path.dirname(__file__)) - plugin_dir = os.path.join(home, dir.replace('.', '/')) - plugins = os.listdir(plugin_dir) - plugins = [re.sub(r'\.py$', '', p) for p in plugins if re.match(r'^[a-zA-Z]\w*\.py$', p)] - for p in plugins: - __import__(dir + '.' + p) - -def load_plugins(): - load_plugins_at('lixian_plugins.commands') - load_plugins_at('lixian_plugins.queries') - load_plugins_at('lixian_plugins.filters') - load_plugins_at('lixian_plugins.parsers') - load_plugins_at('lixian_plugins') - -load_plugins() diff --git a/xunlei-lixian/lixian_plugins/api/__init__.py b/xunlei-lixian/lixian_plugins/api/__init__.py deleted file mode 100644 index ad710dd..0000000 --- a/xunlei-lixian/lixian_plugins/api/__init__.py +++ /dev/null @@ -1,68 +0,0 @@ - -__all__ = ['command', 'register_alias', - 'user_query', 'extract_info_hash_from_url', 'download_torrent_from_url', - 'task_filter', 'name_filter', - 'page_parser'] - -################################################## -# commands -################################################## - -from lixian_plugins.commands import command - -################################################## -# commands -################################################## - -from lixian_alias import register_alias - -################################################## -# queries -################################################## - -from lixian_query import user_query - -def extract_info_hash_from_url(regexp): - import lixian_queries - import re - @user_query - def processor(base, x): - m = re.match(regexp, x) - if m: - return lixian_queries.BtHashQuery(base, m.group(1)) - -def download_torrent_from_url(regexp): - import lixian_queries - import re - @user_query - def processor(base, x): - if re.match(regexp, x): - return lixian_queries.bt_url_processor(base, x) - -################################################## -# filters -################################################## - -from lixian_plugins.filters import task_filter -from lixian_plugins.filters import name_filter - -################################################## -# parsers -################################################## - -def page_parser(pattern): - def f(extend_links): - import lixian_plugins.parsers - patterns = pattern if type(pattern) is list else [pattern] - for p in patterns: - lixian_plugins.parsers.register_parser(p, extend_links) - return f - - -################################################## -# download tools -################################################## - -from lixian_download_tools import download_tool - - diff --git a/xunlei-lixian/lixian_plugins/commands/__init__.py b/xunlei-lixian/lixian_plugins/commands/__init__.py deleted file mode 100644 index 894b084..0000000 --- a/xunlei-lixian/lixian_plugins/commands/__init__.py +++ /dev/null @@ -1,36 +0,0 @@ - -__all__ = [] - -commands = {} - -extended_commands = [] - -def update_helps(commands): - if commands: - import lixian_help - lixian_help.extended_usage = '''\nExtended commands: -''' + lixian_help.join_commands([(x[0], x[1]) for x in commands]) - - for name, usage, doc in commands: - setattr(lixian_help, name, doc) - -def register_command(command): - extended_commands.append(command) - global commands - commands = dict((x.command_name, x) for x in extended_commands) - update_helps(sorted((x.command_name, x.command_usage, x.command_help) for x in extended_commands)) - - -def command(name='', usage='', help=''): - def as_command(f): - assert usage, 'missing command usage: ' + f.func_name - f.command_name = name or f.func_name.replace('_', '-') - f.command_usage = usage - f.command_help = help or f.func_doc - import textwrap - if f.command_help: - f.command_help = textwrap.dedent(f.command_help) - register_command(f) - return f - return as_command - diff --git a/xunlei-lixian/lixian_plugins/commands/aria2.py b/xunlei-lixian/lixian_plugins/commands/aria2.py deleted file mode 100644 index 5f5e28f..0000000 --- a/xunlei-lixian/lixian_plugins/commands/aria2.py +++ /dev/null @@ -1,91 +0,0 @@ - -from lixian_plugins.api import command - -from lixian_config import * -from lixian_encoding import default_encoding -from lixian_cli_parser import command_line_parser -from lixian_cli_parser import with_parser -from lixian_cli_parser import command_line_option, command_line_value -from lixian_commands.util import parse_login, create_client - -def export_aria2_conf(args): - client = create_client(args) - import lixian_query - tasks = lixian_query.search_tasks(client, args) - files = [] - for task in tasks: - if task['type'] == 'bt': - subs, skipped, single_file = lixian_query.expand_bt_sub_tasks(task) - if not subs: - continue - if single_file: - files.append((subs[0]['xunlei_url'], subs[0]['name'], None)) - else: - for f in subs: - files.append((f['xunlei_url'], f['name'], task['name'])) - else: - files.append((task['xunlei_url'], task['name'], None)) - output = '' - for url, name, dir in files: - if type(url) == unicode: - url = url.encode(default_encoding) - output += url + '\n' - output += ' out=' + name.encode(default_encoding) + '\n' - if dir: - output += ' dir=' + dir.encode(default_encoding) + '\n' - output += ' header=Cookie: gdriveid=' + client.get_gdriveid() + '\n' - return output - -@command(usage='export task download urls as aria2 format') -@command_line_parser() -@with_parser(parse_login) -@command_line_option('all') -def export_aria2(args): - ''' - usage: lx export-aria2 [id|name]... - ''' - print export_aria2_conf(args) - -def download_aria2_stdin(aria2_conf, j): - aria2_opts = ['aria2c', '-i', '-', '-j', j] - aria2_opts.extend(get_config('aria2-opts', '').split()) - from subprocess import Popen, PIPE - sub = Popen(aria2_opts, stdin=PIPE, bufsize=1, shell=True) - sub.communicate(aria2_conf) - sub.stdin.close() - exit_code = sub.wait() - if exit_code != 0: - raise Exception('aria2c exited abnormaly') - -def download_aria2_temp(aria2_conf, j): - import tempfile - temp = tempfile.NamedTemporaryFile('w', delete=False) - temp.file.write(aria2_conf) - temp.file.close() - try: - aria2_opts = ['aria2c', '-i', temp.name, '-j', j] - aria2_opts.extend(get_config('aria2-opts', '').split()) - import subprocess - exit_code = subprocess.call(aria2_opts) - finally: - import os - os.unlink(temp.name) - if exit_code != 0: - raise Exception('aria2c exited abnormaly') - -@command(usage='concurrently download tasks in aria2') -@command_line_parser() -@with_parser(parse_login) -@command_line_option('all') -@command_line_value('max-concurrent-downloads', alias='j', default=get_config('aria2-j', '5')) -def download_aria2(args): - ''' - usage: lx download-aria2 -j 5 [id|name]... - ''' - aria2_conf = export_aria2_conf(args) - import platform - if platform.system() == 'Windows': - download_aria2_temp(aria2_conf, args.max_concurrent_downloads) - else: - download_aria2_stdin(aria2_conf, args.max_concurrent_downloads) - diff --git a/xunlei-lixian/lixian_plugins/commands/decode_url.py b/xunlei-lixian/lixian_plugins/commands/decode_url.py deleted file mode 100644 index f83c06c..0000000 --- a/xunlei-lixian/lixian_plugins/commands/decode_url.py +++ /dev/null @@ -1,12 +0,0 @@ - -from lixian_plugins.api import command - -@command(usage='convert thunder:// (and more) to normal url') -def decode_url(args): - ''' - usage: lx decode-url thunder://... - ''' - from lixian_url import url_unmask - for x in args: - print url_unmask(x) - diff --git a/xunlei-lixian/lixian_plugins/commands/diagnostics.py b/xunlei-lixian/lixian_plugins/commands/diagnostics.py deleted file mode 100644 index 5ff7294..0000000 --- a/xunlei-lixian/lixian_plugins/commands/diagnostics.py +++ /dev/null @@ -1,16 +0,0 @@ - -from lixian_plugins.api import command - -@command(name='diagnostics', usage='print helpful information for diagnostics') -def lx_diagnostics(args): - ''' - usage: lx diagnostics - ''' - from lixian_encoding import default_encoding - print 'default_encoding ->', default_encoding - import sys - print 'sys.getdefaultencoding() ->', sys.getdefaultencoding() - print 'sys.getfilesystemencoding() ->', sys.getfilesystemencoding() - print r"print u'\u4e2d\u6587'.encode('utf-8') ->", u'\u4e2d\u6587'.encode('utf-8') - print r"print u'\u4e2d\u6587'.encode('gbk') ->", u'\u4e2d\u6587'.encode('gbk') - diff --git a/xunlei-lixian/lixian_plugins/commands/echo.py b/xunlei-lixian/lixian_plugins/commands/echo.py deleted file mode 100644 index d4abf9d..0000000 --- a/xunlei-lixian/lixian_plugins/commands/echo.py +++ /dev/null @@ -1,11 +0,0 @@ - -from lixian_plugins.api import command - -@command(usage='echo arguments') -def echo(args): - ''' - lx echo ... - ''' - import lixian_cli_parser - print ' '.join(lixian_cli_parser.expand_command_line(args)) - diff --git a/xunlei-lixian/lixian_plugins/commands/export_download_urls.py b/xunlei-lixian/lixian_plugins/commands/export_download_urls.py deleted file mode 100644 index 8c3dff2..0000000 --- a/xunlei-lixian/lixian_plugins/commands/export_download_urls.py +++ /dev/null @@ -1,37 +0,0 @@ - -from lixian_plugins.api import command - - -from lixian_cli_parser import command_line_parser -from lixian_cli_parser import with_parser -from lixian_cli_parser import command_line_option, command_line_value -from lixian_commands.util import parse_login, create_client - -@command(usage='export task download urls') -@command_line_parser() -@with_parser(parse_login) -@command_line_option('all') -@command_line_value('category') -def export_download_urls(args): - ''' - usage: lx export-download-urls [id|name]... - ''' - assert len(args) or args.all or args.category, 'Not enough arguments' - client = create_client(args) - import lixian_query - tasks = lixian_query.search_tasks(client, args) - urls = [] - for task in tasks: - if task['type'] == 'bt': - subs, skipped, single_file = lixian_query.expand_bt_sub_tasks(task) - if not subs: - continue - if single_file: - urls.append((subs[0]['xunlei_url'], subs[0]['name'], None)) - else: - for f in subs: - urls.append((f['xunlei_url'], f['name'], task['name'])) - else: - urls.append((task['xunlei_url'], task['name'], None)) - for url, _, _ in urls: - print url diff --git a/xunlei-lixian/lixian_plugins/commands/extend_links.py b/xunlei-lixian/lixian_plugins/commands/extend_links.py deleted file mode 100644 index c62ddf7..0000000 --- a/xunlei-lixian/lixian_plugins/commands/extend_links.py +++ /dev/null @@ -1,26 +0,0 @@ - -from lixian_plugins.api import command - -@command(usage='parse links') -def extend_links(args): - ''' - usage: lx extend-links http://kuai.xunlei.com/d/... http://www.verycd.com/topics/... - - parse and print links from pages - - lx extend-links urls... - lx extend-links --name urls... - ''' - - from lixian_cli_parser import parse_command_line - from lixian_encoding import default_encoding - - args = parse_command_line(args, [], ['name']) - import lixian_plugins.parsers - if args.name: - for x in lixian_plugins.parsers.extend_links_name(args): - print x.encode(default_encoding) - else: - for x in lixian_plugins.parsers.extend_links(args): - print x - diff --git a/xunlei-lixian/lixian_plugins/commands/get_torrent.py b/xunlei-lixian/lixian_plugins/commands/get_torrent.py deleted file mode 100644 index ed2c202..0000000 --- a/xunlei-lixian/lixian_plugins/commands/get_torrent.py +++ /dev/null @@ -1,44 +0,0 @@ - -from lixian_plugins.api import command - -from lixian_cli_parser import command_line_parser, command_line_option -from lixian_cli_parser import with_parser -from lixian_cli import parse_login -from lixian_commands.util import create_client - -@command(name='get-torrent', usage='get .torrent by task id or info hash') -@command_line_parser() -@with_parser(parse_login) -@command_line_option('rename', default=True) -def get_torrent(args): - ''' - usage: lx get-torrent [info-hash|task-id]... - ''' - client = create_client(args) - for id in args: - id = id.lower() - import re - if re.match(r'[a-fA-F0-9]{40}$', id): - torrent = client.get_torrent_file_by_info_hash(id) - elif re.match(r'\d+$', id): - import lixian_query - task = lixian_query.get_task_by_id(client, id) - id = task['bt_hash'] - id = id.lower() - torrent = client.get_torrent_file_by_info_hash(id) - else: - raise NotImplementedError() - if args.rename: - import lixian_hash_bt - from lixian_encoding import default_encoding - info = lixian_hash_bt.bdecode(torrent)['info'] - name = info['name'].decode(info.get('encoding', 'utf-8')).encode(default_encoding) - import re - name = re.sub(r'[\\/:*?"<>|]', '-', name) - else: - name = id - path = name + '.torrent' - print path - with open(path, 'wb') as output: - output.write(torrent) - diff --git a/xunlei-lixian/lixian_plugins/commands/hash.py b/xunlei-lixian/lixian_plugins/commands/hash.py deleted file mode 100644 index 0a089ef..0000000 --- a/xunlei-lixian/lixian_plugins/commands/hash.py +++ /dev/null @@ -1,27 +0,0 @@ - -from lixian_plugins.api import command - -@command(name='hash', usage='compute hashes') -def print_hash(args): - ''' - lx hash --sha1 file... - lx hash --md5 file... - lx hash --md4 file... - lx hash --dcid file... - lx hash --ed2k file... - lx hash --info-hash xxx.torrent... - lx hash --verify-sha1 file hash - lx hash --verify-md5 file hash - lx hash --verify-md4 file hash - lx hash --verify-dcid file hash - lx hash --verify-ed2k file ed2k://... - lx hash --verify-bt file xxx.torrent - ''' - #assert len(args) == 1 - import lixian_hash - #import lixian_hash_ed2k - #print 'ed2k:', lixian_hash_ed2k.hash_file(args[0]) - #print 'dcid:', lixian_hash.dcid_hash_file(args[0]) - import lixian_cli_parser - lixian_hash.main(lixian_cli_parser.expand_command_line(args)) - diff --git a/xunlei-lixian/lixian_plugins/commands/kuai.py b/xunlei-lixian/lixian_plugins/commands/kuai.py deleted file mode 100644 index ad75d83..0000000 --- a/xunlei-lixian/lixian_plugins/commands/kuai.py +++ /dev/null @@ -1,16 +0,0 @@ - -from lixian_plugins.api import command - -@command(usage='parse links from kuai.xunlei.com') -def kuai(args): - ''' - usage: lx kuai http://kuai.xunlei.com/d/xxx... - - Note that you can simply use: - lx add http://kuai.xunlei.com/d/xxx... - or: - lx download http://kuai.xunlei.com/d/xxx... - ''' - import lixian_kuai - lixian_kuai.main(args) - diff --git a/xunlei-lixian/lixian_plugins/commands/list_torrent.py b/xunlei-lixian/lixian_plugins/commands/list_torrent.py deleted file mode 100644 index 44876bc..0000000 --- a/xunlei-lixian/lixian_plugins/commands/list_torrent.py +++ /dev/null @@ -1,65 +0,0 @@ - -from lixian_plugins.api import command - -from lixian_cli_parser import parse_command_line -from lixian_config import get_config -from lixian_encoding import default_encoding - -def b_encoding(b): - if 'encoding' in b: - return b['encoding'] - if 'codepage' in b: - return 'cp' + str(b['codepage']) - return 'utf-8' - -def b_name(info, encoding='utf-8'): - if 'name.utf-8' in info: - return info['name.utf-8'].decode('utf-8') - return info['name'].decode(encoding) - -def b_path(f, encoding='utf-8'): - if 'path.utf-8' in f: - return [p.decode('utf-8') for p in f['path.utf-8']] - return [p.decode(encoding) for p in f['path']] - -@command(usage='list files in local .torrent') -def list_torrent(args): - ''' - usage: lx list-torrent [--size] xxx.torrent... - ''' - args = parse_command_line(args, [], ['size'], default={'size':get_config('size')}) - torrents = args - if not torrents: - from glob import glob - torrents = glob('*.torrent') - if not torrents: - raise Exception('No .torrent file found') - for p in torrents: - with open(p, 'rb') as stream: - from lixian_hash_bt import bdecode - b = bdecode(stream.read()) - encoding = b_encoding(b) - info = b['info'] - from lixian_util import format_size - if args.size: - size = sum(f['length'] for f in info['files']) if 'files' in info else info['length'] - print '*', b_name(info, encoding).encode(default_encoding), format_size(size) - else: - print '*', b_name(info, encoding).encode(default_encoding) - if 'files' in info: - for f in info['files']: - if f['path'][0].startswith('_____padding_file_'): - continue - path = '/'.join(b_path(f, encoding)).encode(default_encoding) - if args.size: - print '%s (%s)' % (path, format_size(f['length'])) - else: - print path - else: - path = b_name(info, encoding).encode(default_encoding) - if args.size: - from lixian_util import format_size - print '%s (%s)' % (path, format_size(info['length'])) - else: - print path - diff --git a/xunlei-lixian/lixian_plugins/commands/speed_test.py b/xunlei-lixian/lixian_plugins/commands/speed_test.py deleted file mode 100644 index fa3062d..0000000 --- a/xunlei-lixian/lixian_plugins/commands/speed_test.py +++ /dev/null @@ -1,96 +0,0 @@ -from lixian_plugins.api import command - - -from lixian_cli_parser import command_line_parser -from lixian_cli_parser import with_parser -from lixian_cli_parser import command_line_option, command_line_value -from lixian_commands.util import parse_login, parse_colors, create_client -from lixian_config import get_config - -from lixian_encoding import default_encoding -from lixian_colors import colors - -import lixian_nodes - -@command(usage='test download speed from multiple vod nodes') -@command_line_parser() -@with_parser(parse_login) -@with_parser(parse_colors) -@command_line_value('vod-nodes', default=get_config('vod-nodes', lixian_nodes.VOD_RANGE)) -def speed_test(args): - ''' - usage: lx speed_test [--vod-nodes=0-50] [id|name] - ''' - assert len(args) - client = create_client(args) - import lixian_query - tasks = lixian_query.search_tasks(client, args) - if not tasks: - raise Exception('No task found') - task = tasks[0] - urls = [] - if task['type'] == 'bt': - subs, skipped, single_file = lixian_query.expand_bt_sub_tasks(task) - if not subs: - raise Exception('No files found') - subs = [f for f in subs if f['size'] > 1000*1000] or subs # skip files with length < 1M - if single_file: - urls.append((subs[0]['xunlei_url'], subs[0]['name'], None)) - else: - for f in subs: - urls.append((f['xunlei_url'], f['name'], task['name'])) - else: - urls.append((task['xunlei_url'], task['name'], None)) - url, filename, dirname = urls[0] - name = dirname + '/' + filename if dirname else filename - test_file(client, url, name, args) - -def test_file(client, url, name, options): - with colors(options.colors).cyan(): - print name.encode(default_encoding) - # print 'File:', name.encode(default_encoding) - # print 'Address:', url - node_url = lixian_nodes.resolve_node_url(url, client.get_gdriveid(), timeout=3) - # print 'Node:', node_url - test_nodes(node_url, client.get_gdriveid(), options) - -def test_nodes(node_url, gdriveid, options): - nodes = lixian_nodes.parse_vod_nodes(options.vod_nodes) - best = None - best_speed = 0 - for node in nodes: - # print 'Node:', node - url = lixian_nodes.switch_node_in_url(node_url, node) - try: - speed = lixian_nodes.get_node_url_speed(url, gdriveid) - if best_speed < speed: - best = node - best_speed = speed - kb = int(speed/1000) - # print 'Speed: %dKB/s' % kb, '.' * (kb /100) - show_node_speed(node, kb, options) - except Exception, e: - show_node_error(node, e, options) - if best: - with colors(options.colors).green(): - print best, - print "is the fastest node!" - -def show_node_speed(node, kb, options): - node = "%-5s " % node - speed = '%dKB/s' % kb - bar = '.' * (kb /100) - whitespaces = ' ' * (79 - len(node) - len(bar) - len(speed)) - if kb >= 1000: - with colors(options.colors).green(): - # print node + bar + whitespaces + speed - with colors(options.colors).bold(): - print node[:-1], - print bar + whitespaces + speed - else: - print node + bar + whitespaces + speed - -def show_node_error(node, e, options): - with colors(options.colors).red(): - print "%-5s %s" % (node, e) - diff --git a/xunlei-lixian/lixian_plugins/filters/__init__.py b/xunlei-lixian/lixian_plugins/filters/__init__.py deleted file mode 100644 index de170b3..0000000 --- a/xunlei-lixian/lixian_plugins/filters/__init__.py +++ /dev/null @@ -1,67 +0,0 @@ - -import re - -name_filters = {} -task_filters = {} - -def find_matcher(keyword, filters): - for p in filters: - if re.search(p, keyword): - return filters[p] - -def has_task_filter(keyword): - return bool(find_matcher(keyword, task_filters)) - -def filter_tasks_with_matcher(tasks, keyword, (mode, m)): - if mode == 'single': - return filter(lambda x: m(keyword, x), tasks) - elif mode == 'batch': - return m(keyword, tasks) - else: - raise NotImplementedError(mode) - -def filter_tasks(tasks, keyword): - m = find_matcher(keyword, task_filters) - if m: - return filter_tasks_with_matcher(tasks, keyword, m) - -def filter_things(things, keyword): - if not things: - # XXX: neither None or things should be OK - return things - assert len(set(map(type, things))) == 1 - filters = task_filters if type(things[0]) == dict else name_filters - m = find_matcher(keyword, filters) - if m: - return filter_tasks_with_matcher(things, keyword, m) - -def define_task_filter(pattern, matcher, batch=False): - task_filters[pattern] = ('batch' if batch else 'single', matcher) - -def define_name_filter(pattern, matcher): - name_filters[pattern] = ('single', matcher) - task_filters[pattern] = ('single', lambda k, x: matcher(k, x['name'])) - -def task_filter(pattern=None, protocol=None, batch=False): - assert bool(pattern) ^ bool(protocol) - def define_filter(matcher): - if pattern: - define_task_filter(pattern, matcher, batch) - else: - assert re.match(r'^[\w-]+$', protocol), protocol - define_task_filter(r'^%s:' % protocol, lambda k, x: matcher(re.sub(r'^[\w-]+:', '', k), x), batch) - return matcher - return define_filter - -def name_filter(pattern=None, protocol=None): - # FIXME: duplicate code - assert bool(pattern) ^ bool(protocol) - def define_filter(matcher): - if pattern: - define_name_filter(pattern, matcher) - else: - assert re.match(r'^\w+$', protocol), protocol - define_name_filter(r'^%s:' % protocol, lambda k, x: matcher(re.sub(r'^\w+:', '', k), x)) - return matcher - return define_filter - diff --git a/xunlei-lixian/lixian_plugins/filters/date.py b/xunlei-lixian/lixian_plugins/filters/date.py deleted file mode 100644 index be9f476..0000000 --- a/xunlei-lixian/lixian_plugins/filters/date.py +++ /dev/null @@ -1,7 +0,0 @@ - -from lixian_plugins.api import task_filter - -@task_filter(pattern=r'^\d{4}[-.]\d{2}[-.]\d{2}$') -def filter_by_date(keyword, task): - return task['date'] == keyword.replace('-', '.') - diff --git a/xunlei-lixian/lixian_plugins/filters/name.py b/xunlei-lixian/lixian_plugins/filters/name.py deleted file mode 100644 index 803ee37..0000000 --- a/xunlei-lixian/lixian_plugins/filters/name.py +++ /dev/null @@ -1,7 +0,0 @@ - -from lixian_plugins.api import name_filter - -@name_filter(protocol='name') -def filter_by_raw_text(keyword, name): - return keyword.lower() in name.lower() - diff --git a/xunlei-lixian/lixian_plugins/filters/raw.py b/xunlei-lixian/lixian_plugins/filters/raw.py deleted file mode 100644 index 863d32a..0000000 --- a/xunlei-lixian/lixian_plugins/filters/raw.py +++ /dev/null @@ -1,7 +0,0 @@ - -from lixian_plugins.api import name_filter - -@name_filter(protocol='raw') -def filter_by_raw_text(keyword, name): - return keyword.lower() in name.lower() - diff --git a/xunlei-lixian/lixian_plugins/filters/regexp.py b/xunlei-lixian/lixian_plugins/filters/regexp.py deleted file mode 100644 index f9fd722..0000000 --- a/xunlei-lixian/lixian_plugins/filters/regexp.py +++ /dev/null @@ -1,8 +0,0 @@ - -from lixian_plugins.api import name_filter - -import re - -@name_filter(protocol='regexp') -def filter_by_regexp(keyword, name): - return re.search(keyword, name) diff --git a/xunlei-lixian/lixian_plugins/filters/size.py b/xunlei-lixian/lixian_plugins/filters/size.py deleted file mode 100644 index c08d516..0000000 --- a/xunlei-lixian/lixian_plugins/filters/size.py +++ /dev/null @@ -1,23 +0,0 @@ - -from lixian_plugins.api import task_filter - -import re - -@task_filter(protocol='size') -def filter_by_size(keyword, task): - ''' - Example: - lx download size:10m- - lx download size:1G+ - lx download 0/size:1g- - ''' - m = re.match(r'^([<>])?(\d+(?:\.\d+)?)([GM])?([+-])?$', keyword, flags=re.I) - assert m, keyword - less_or_great, n, u, less_or_more = m.groups() - assert bool(less_or_great) ^ bool(less_or_more), 'must bt size, size-, or size+' - size = float(n) * {None: 1, 'G': 1000**3, 'g': 1000**3, 'M': 1000**2, 'm': 1000**2}[u] - if less_or_great == '<' or less_or_more == '-': - return task['size'] < size - else: - return task['size'] > size - diff --git a/xunlei-lixian/lixian_plugins/filters/sort.py b/xunlei-lixian/lixian_plugins/filters/sort.py deleted file mode 100644 index fce958f..0000000 --- a/xunlei-lixian/lixian_plugins/filters/sort.py +++ /dev/null @@ -1,11 +0,0 @@ - -from lixian_plugins.api import task_filter - -@task_filter(protocol='sort', batch=True) -def sort_by_name(keyword, tasks): - ''' - Example: - lx list sort: - lx download 0/sort:/[0-1] - ''' - return sorted(tasks, key=lambda x: x['name']) diff --git a/xunlei-lixian/lixian_plugins/filters/total_size.py b/xunlei-lixian/lixian_plugins/filters/total_size.py deleted file mode 100644 index f224cbc..0000000 --- a/xunlei-lixian/lixian_plugins/filters/total_size.py +++ /dev/null @@ -1,27 +0,0 @@ - -from lixian_plugins.api import task_filter - -import re - -@task_filter(protocol='total-size', batch=True) -def fetch_by_total_size(keyword, tasks): - ''' - Example: - lx download total_size:1g - lx download 0/total_size:1g - lx list total_size:1g - ''' - m = re.match(r'^(\d+(?:\.\d+)?)([GM])?$', keyword, flags=re.I) - assert m, keyword - n, u = m.groups() - limit = float(n) * {None: 1, 'G': 1000**3, 'g': 1000**3, 'M': 1000**2, 'm': 1000**2}[u] - total = 0 - results = [] - for t in tasks: - total += t['size'] - if total <= limit: - results.append(t) - else: - return results - return results - diff --git a/xunlei-lixian/lixian_plugins/parsers/__init__.py b/xunlei-lixian/lixian_plugins/parsers/__init__.py deleted file mode 100644 index 092d947..0000000 --- a/xunlei-lixian/lixian_plugins/parsers/__init__.py +++ /dev/null @@ -1,69 +0,0 @@ - -import re - -page_parsers = {} - -def register_parser(site, extend_link): - page_parsers[site] = extend_link - - -def in_site(url, site): - if url.startswith(site): - return True - if '*' in site: - import fnmatch - p = fnmatch.translate(site) - return re.match(p, url) - -def find_parser(link): - for p in page_parsers: - if in_site(link, p): - return page_parsers[p] - - -def to_name(x): - if type(x) == dict: - return x['name'] - else: - return x - -def to_url(x): - if type(x) == dict: - return x['url'] - else: - return x - -def parse_pattern(link): - m = re.search(r'[^:]//', link) - if m: - u = link[:m.start()+1] - p = link[m.start()+3:] - assert '//' not in p, link - if p.endswith('/'): - u += '/' - p = p[:-1] - return u, p - -def try_to_extend_link(link): - parser = find_parser(link) - if parser: - x = parse_pattern(link) - if x: - links = parser(x[0]) - import lixian_filter_expr - return lixian_filter_expr.filter_expr(links, x[1]) - else: - return parser(link) - -def extend_link(link): - return try_to_extend_link(link) or [link] - -def extend_links_rich(links): - return sum(map(extend_link, links), []) - -def extend_links(links): - return map(to_url, extend_links_rich(links)) - -def extend_links_name(links): - return map(to_name, extend_links_rich(links)) - diff --git a/xunlei-lixian/lixian_plugins/parsers/icili.py b/xunlei-lixian/lixian_plugins/parsers/icili.py deleted file mode 100644 index 8ba801a..0000000 --- a/xunlei-lixian/lixian_plugins/parsers/icili.py +++ /dev/null @@ -1,19 +0,0 @@ - -from lixian_plugins.api import page_parser - -import urllib2 -import re - -def icili_links(url): - assert url.startswith('http://www.icili.com/emule/download/'), url - html = urllib2.urlopen(url).read() - table = re.search(r'.*?
    ', html, flags=re.S).group() - links = re.findall(r'value="(ed2k://[^"]+)"', table) - return links - -@page_parser('http://www.icili.com/emule/download/') -def extend_link(url): - links = icili_links(url) - from lixian_hash_ed2k import parse_ed2k_file - return [{'url':x, 'name':parse_ed2k_file(x)} for x in links] - diff --git a/xunlei-lixian/lixian_plugins/parsers/kuai.py b/xunlei-lixian/lixian_plugins/parsers/kuai.py deleted file mode 100644 index 7ed5219..0000000 --- a/xunlei-lixian/lixian_plugins/parsers/kuai.py +++ /dev/null @@ -1,52 +0,0 @@ - -from lixian_plugins.api import page_parser - -import urllib -import re - -def generate_lixian_url(info): - print info['url'] - info = dict(info) - info['namehex'] = '0102' - info['fid'] = re.search(r'fid=([^&]+)', info['url']).group(1) - info['tid'] = re.search(r'tid=([^&]+)', info['url']).group(1) - info['internalid'] = '111' - info['taskid'] = 'xxx' - return 'http://gdl.lixian.vip.xunlei.com/download?fid=%(fid)s&mid=666&threshold=150&tid=%(tid)s&srcid=4&verno=1&g=%(gcid)s&scn=t16&i=%(gcid)s&t=1&ui=%(internalid)s&ti=%(taskid)s&s=%(size)s&m=0&n=%(namehex)s' % info - -def parse_link(html): - attrs = dict(re.findall(r'(\w+)="([^"]+)"', html)) - if 'file_url' not in attrs: - return - keys = {'url': 'file_url', 'name':'file_name', 'size':'file_size', 'gcid':'gcid', 'cid':'cid', 'gcid_resid':'gcid_resid'} - info = {} - for k in keys: - info[k] = attrs[keys[k]] - #info['name'] = urllib.unquote(info['name']) - return info - -@page_parser('http://kuai.xunlei.com/d/') -def kuai_links(url): - assert url.startswith('http://kuai.xunlei.com/d/'), url - html = urllib.urlopen(url).read().decode('utf-8') - #return re.findall(r'file_url="([^"]+)"', html) - #return map(parse_link, re.findall(r'', html, flags=re.S)) - return filter(bool, map(parse_link, re.findall(r'.*?', html, flags=re.S))) - -extend_link = kuai_links - -def main(args): - from lixian_cli_parser import parse_command_line - args = parse_command_line(args, [], ['name']) - for x in args: - for v in kuai_links(x): - if args.name: - print v['name'] - else: - print v['url'] - - -if __name__ == '__main__': - import sys - main(sys.argv[1:]) - diff --git a/xunlei-lixian/lixian_plugins/parsers/qjwm.py b/xunlei-lixian/lixian_plugins/parsers/qjwm.py deleted file mode 100644 index 174f78e..0000000 --- a/xunlei-lixian/lixian_plugins/parsers/qjwm.py +++ /dev/null @@ -1,22 +0,0 @@ - -from lixian_plugins.api import page_parser - -import urllib2 -import re - -def qjwm_link(url): - assert re.match(r'http://.*\.qjwm\.com/down(load)?_\d+.html', url) - url = url.replace('/down_', '/download_') - html = urllib2.urlopen(url).read() - m = re.search(r'var thunder_url = "([^"]+)";', html) - if m: - url = m.group(1) - url = url.decode('gbk') - return url - - -@page_parser('http://*.qjwm.com/*') -def extend_link(url): - url = qjwm_link(url) - return url and [url] or [] - diff --git a/xunlei-lixian/lixian_plugins/parsers/simplecd.py b/xunlei-lixian/lixian_plugins/parsers/simplecd.py deleted file mode 100644 index d494655..0000000 --- a/xunlei-lixian/lixian_plugins/parsers/simplecd.py +++ /dev/null @@ -1,30 +0,0 @@ - -from lixian_plugins.api import page_parser - -import urllib2 -import re - - -def simplecd_links(url): - m = re.match(r'(http://(?:www\.)?s[ia]mplecd\.\w+/)(id|entry)/', url) - assert m, url - site = m.group(1) - html = urllib2.urlopen(url).read() - ids = re.findall(r'value="(\w+)"\s+name="selectemule"', html) - form = '&'.join('rid=' + id for id in ids) - q = 'mode=copy&' + form - html = urllib2.urlopen(site + 'download/?' + q).read() - table = re.search(r'', html, flags=re.S).group() - links = re.findall(r'ed2k://[^\s<>]+', table) - import lixian_url - return map(lixian_url.normalize_unicode_link, links) - -@page_parser(['http://simplecd.*/', - 'http://www.simplecd.*/', - 'http://samplecd.*/', - 'http://www.samplecd.*/']) -def extend_link(url): - links = simplecd_links(url) - from lixian_hash_ed2k import parse_ed2k_file - return [{'url':x, 'name':parse_ed2k_file(x)} for x in links] - diff --git a/xunlei-lixian/lixian_plugins/parsers/verycd.py b/xunlei-lixian/lixian_plugins/parsers/verycd.py deleted file mode 100644 index ab50696..0000000 --- a/xunlei-lixian/lixian_plugins/parsers/verycd.py +++ /dev/null @@ -1,21 +0,0 @@ - -from lixian_plugins.api import page_parser - -import urllib2 -import re - -def parse_links(html): - html = re.search(r'.*?', html, re.S).group() - links = re.findall(r'value="([^"]+)"', html) - return [x for x in links if x.startswith('ed2k://')] - -def verycd_links(url): - assert url.startswith('http://www.verycd.com/topics/'), url - return parse_links(urllib2.urlopen(url).read()) - -@page_parser('http://www.verycd.com/topics/') -def extend_link(url): - links = verycd_links(url) - from lixian_hash_ed2k import parse_ed2k_file - return [{'url':x, 'name':parse_ed2k_file(x)} for x in links] - diff --git a/xunlei-lixian/lixian_plugins/queries/__init__.py b/xunlei-lixian/lixian_plugins/queries/__init__.py deleted file mode 100644 index 139597f..0000000 --- a/xunlei-lixian/lixian_plugins/queries/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/xunlei-lixian/lixian_plugins/queries/torrentz.py b/xunlei-lixian/lixian_plugins/queries/torrentz.py deleted file mode 100644 index be74ab2..0000000 --- a/xunlei-lixian/lixian_plugins/queries/torrentz.py +++ /dev/null @@ -1,5 +0,0 @@ - -from lixian_plugins.api import extract_info_hash_from_url - -extract_info_hash_from_url(r'^http://torrentz.eu/([0-9a-f]{40})$') - diff --git a/xunlei-lixian/lixian_progress.py b/xunlei-lixian/lixian_progress.py deleted file mode 100644 index f72ec27..0000000 --- a/xunlei-lixian/lixian_progress.py +++ /dev/null @@ -1,30 +0,0 @@ - -import sys - -class SimpleProgressBar: - def __init__(self): - self.displayed = False - def update(self, percent): - self.displayed = True - bar_size = 40 - percent *= 100.0 - if percent > 100: - percent = 100.0 - dots = int(bar_size * percent / 100) - plus = percent / 100 * bar_size - dots - if plus > 0.8: - plus = '=' - elif plus > 0.4: - plus = '-' - else: - plus = '' - percent = int(percent) - bar = '=' * dots + plus - bar = '{0:>3}%[{1:<40}]'.format(percent, bar) - sys.stdout.write('\r'+bar) - sys.stdout.flush() - def done(self): - if self.displayed: - print - self.displayed = False - diff --git a/xunlei-lixian/lixian_queries.py b/xunlei-lixian/lixian_queries.py deleted file mode 100644 index aa86ad1..0000000 --- a/xunlei-lixian/lixian_queries.py +++ /dev/null @@ -1,326 +0,0 @@ - -from lixian_query import ExactQuery -from lixian_query import SearchQuery -from lixian_query import query -from lixian_query import bt_query - -import lixian_hash_bt -import lixian_url -import lixian_encoding - -import re - -################################################## -# queries -################################################## - -class SingleTaskQuery(ExactQuery): - def __init__(self, base, t): - super(SingleTaskQuery, self).__init__(base) - self.id = t['id'] - - def query_once(self): - return [self.base.get_task_by_id(self.id)] - - def query_search(self): - t = self.base.find_task_by_id(self.id) - return [t] if t else [] - - -@query(priority=1) -@bt_query(priority=1) -def single_id_processor(base, x): - if not re.match(r'^\d+/?$', x): - return - n = x.rstrip('/') - t = base.find_task_by_id(n) - if t: - return SingleTaskQuery(base, t) - -################################################## - -class MultipleTasksQuery(ExactQuery): - def __init__(self, base, tasks): - super(MultipleTasksQuery, self).__init__(base) - self.tasks = tasks - - def query_once(self): - return map(self.base.get_task_by_id, (t['id'] for t in self.tasks)) - - def query_search(self): - return filter(bool, map(self.base.find_task_by_id, (t['id'] for t in self.tasks))) - -@query(priority=1) -@bt_query(priority=1) -def range_id_processor(base, x): - m = re.match(r'^(\d+)-(\d+)$', x) - if not m: - return - begin = int(m.group(1)) - end = int(m.group(2)) - tasks = base.get_tasks() - if begin <= end: - found = filter(lambda x: begin <= x['#'] <= end, tasks) - else: - found = reversed(filter(lambda x: end <= x['#'] <= begin, tasks)) - if found: - return MultipleTasksQuery(base, found) - -################################################## - -class SubTaskQuery(ExactQuery): - def __init__(self, base, t, subs): - super(SubTaskQuery, self).__init__(base) - self.task = t - self.subs = subs - - def query_once(self): - task = dict(self.base.get_task_by_id(self.task['id'])) - files = self.base.get_files(task) - task['files'] = self.subs - return [task] - - def query_search(self): - task = self.base.find_task_by_id(self.task['id']) - if not task: - return [] - task = dict(task) - files = self.base.get_files(task) - task['files'] = self.subs - return [task] - -@query(priority=2) -@bt_query(priority=2) -def sub_id_processor(base, x): - x = lixian_encoding.from_native(x) - - m = re.match(r'^(\d+)/(.+)$', x) - if not m: - return - task_id, sub_id = m.groups() - task = base.find_task_by_id(task_id) - if not task: - return - - assert task['type'] == 'bt', 'task %s is not a bt task' % lixian_encoding.to_native(task['name']) - files = base.get_files(task) - import lixian_filter_expr - files = lixian_filter_expr.filter_expr(files, sub_id) - subs = [x for x in files] - return SubTaskQuery(base, task, subs) - -################################################## - -class BtHashQuery(ExactQuery): - def __init__(self, base, x): - super(BtHashQuery, self).__init__(base) - self.hash = re.match(r'^(?:bt://)?([0-9a-f]{40})$', x, flags=re.I).group(1).lower() - self.task = self.base.find_task_by_hash(self.hash) - - def prepare(self): - if not self.task: - self.base.add_bt_task_by_hash(self.hash) - - def query_once(self): - t = self.base.find_task_by_hash(self.hash) - assert t, 'Task not found: bt://' + self.hash - return [t] - - def query_search(self): - t = self.base.find_task_by_hash(self.hash) - return [t] if t else [] - -@query(priority=1) -@bt_query(priority=1) -def bt_hash_processor(base, x): - if re.match(r'^(bt://)?[0-9a-f]{40}$', x, flags=re.I): - return BtHashQuery(base, x) - -################################################## - -class LocalBtQuery(ExactQuery): - def __init__(self, base, x): - super(LocalBtQuery, self).__init__(base) - self.path = x - self.hash = lixian_hash_bt.info_hash(self.path) - self.task = self.base.find_task_by_hash(self.hash) - with open(self.path, 'rb') as stream: - self.torrent = stream.read() - - def prepare(self): - if not self.task: - self.base.add_bt_task_by_content(self.torrent, self.path) - - def query_once(self): - t = self.base.find_task_by_hash(self.hash) - assert t, 'Task not found: bt://' + self.hash - return [t] - - def query_search(self): - t = self.base.find_task_by_hash(self.hash) - return [t] if t else [] - -@query(priority=1) -@bt_query(priority=1) -def local_bt_processor(base, x): - import os.path - if x.lower().endswith('.torrent') and os.path.exists(x): - return LocalBtQuery(base, x) - -################################################## - -class MagnetQuery(ExactQuery): - def __init__(self, base, x): - super(MagnetQuery, self).__init__(base) - self.url = x - self.hash = lixian_hash_bt.magnet_to_infohash(x).encode('hex').lower() - self.task = self.base.find_task_by_hash(self.hash) - - def prepare(self): - if not self.task: - self.base.add_magnet_task(self.url) - - def query_once(self): - t = self.base.find_task_by_hash(self.hash) - assert t, 'Task not found: bt://' + self.hash - return [t] - - def query_search(self): - t = self.base.find_task_by_hash(self.hash) - return [t] if t else [] - -@query(priority=4) -@bt_query(priority=4) -def magnet_processor(base, url): - if re.match(r'magnet:', url): - return MagnetQuery(base, url) - -################################################## - -class BatchUrlsQuery(ExactQuery): - def __init__(self, base, urls): - super(BatchUrlsQuery, self).__init__(base) - self.urls = urls - - def prepare(self): - for url in self.urls: - if not self.base.find_task_by_url(url): - self.base.add_url_task(url) - - def query_once(self): - return map(self.base.get_task_by_url, self.urls) - - def query_search(self): - return filter(bool, map(self.base.find_task_by_url, self.urls)) - -@query(priority=6) -@bt_query(priority=6) -def url_extend_processor(base, url): - import lixian_plugins.parsers - extended = lixian_plugins.parsers.try_to_extend_link(url) - if extended: - extended = map(lixian_plugins.parsers.to_url, extended) - return BatchUrlsQuery(base, extended) - -################################################## - -class UrlQuery(ExactQuery): - def __init__(self, base, x): - super(UrlQuery, self).__init__(base) - self.url = lixian_url.url_unmask(x) - self.task = self.base.find_task_by_url(self.url) - - def prepare(self): - if not self.task: - self.base.add_url_task(self.url) - - def query_once(self): - t = self.base.find_task_by_url(self.url) - assert t, 'Task not found: ' + self.url - return [t] - - def query_search(self): - t = self.base.find_task_by_url(self.url) - return [t] if t else [] - -@query(priority=7) -def url_processor(base, url): - if re.match(r'\w+://', url): - return UrlQuery(base, url) - -################################################## - -class BtUrlQuery(ExactQuery): - def __init__(self, base, url, torrent): - super(BtUrlQuery, self).__init__(base) - self.url = url - self.torrent = torrent - self.hash = lixian_hash_bt.info_hash_from_content(self.torrent) - self.task = self.base.find_task_by_hash(self.hash) - - def prepare(self): - if not self.task: - self.base.add_bt_task_by_content(self.torrent, self.url) - - def query_once(self): - t = self.base.find_task_by_hash(self.hash) - assert t, 'Task not found: bt://' + self.hash - return [t] - - def query_search(self): - t = self.base.find_task_by_hash(self.hash) - return [t] if t else [] - -@bt_query(priority=7) -def bt_url_processor(base, url): - if not re.match(r'http://', url): - return - print 'Downloading torrent file from', url - import urllib2 - response = urllib2.urlopen(url, timeout=60) - torrent = response.read() - if response.info().get('Content-Encoding') == 'gzip': - def ungzip(s): - from StringIO import StringIO - import gzip - buffer = StringIO(s) - f = gzip.GzipFile(fileobj=buffer) - return f.read() - torrent = ungzip(torrent) - return BtUrlQuery(base, url, torrent) - -################################################## - -class FilterQuery(SearchQuery): - def __init__(self, base, x): - super(FilterQuery, self).__init__(base) - self.keyword = x - - def query_search(self): - import lixian_plugins.filters - tasks = lixian_plugins.filters.filter_tasks(self.base.get_tasks(), self.keyword) - assert tasks is not None - return tasks - -@query(priority=8) -@bt_query(priority=8) -def filter_processor(base, x): - import lixian_plugins.filters - if lixian_plugins.filters.has_task_filter(x): - return FilterQuery(base, x) - -################################################## - -class DefaultQuery(SearchQuery): - def __init__(self, base, x): - super(DefaultQuery, self).__init__(base) - self.text = lixian_encoding.from_native(x) - - def query_search(self): - return filter(lambda t: t['name'].lower().find(self.text.lower()) != -1, self.base.get_tasks()) - -@query(priority=9) -@bt_query(priority=9) -def default_processor(base, x): - return DefaultQuery(base, x) - diff --git a/xunlei-lixian/lixian_query.py b/xunlei-lixian/lixian_query.py deleted file mode 100644 index e1a27cc..0000000 --- a/xunlei-lixian/lixian_query.py +++ /dev/null @@ -1,476 +0,0 @@ - -__all__ = ['query', 'bt_query', 'user_query', 'Query', 'ExactQuery', 'SearchQuery', - 'build_query', 'find_tasks_to_download', 'search_tasks', 'expand_bt_sub_tasks'] - -import lixian_hash_bt -import lixian_hash_ed2k -import lixian_encoding - - -def link_normalize(url): - from lixian_url import url_unmask, normalize_unicode_link - url = url_unmask(url) - if url.startswith('magnet:'): - return 'bt://'+lixian_hash_bt.magnet_to_infohash(url).encode('hex') - elif url.startswith('ed2k://'): - return lixian_hash_ed2k.parse_ed2k_id(url) - elif url.startswith('bt://'): - return url.lower() - elif url.startswith('http://') or url.startswith('ftp://'): - return normalize_unicode_link(url) - return url - -def link_equals(x1, x2): - return link_normalize(x1) == link_normalize(x2) - - -class TaskBase(object): - def __init__(self, client, list_tasks, limit=None): - self.client = client - self.fetch_tasks_unlimited = list_tasks - self.limit = limit - - self.queries = [] - - self.tasks = None - self.files = {} - - self.commit_jobs = [[], []] - - self.download_jobs = [] - - def fetch_tasks(self): - if self.limit: - with self.client.attr(limit=self.limit): - return self.fetch_tasks_unlimited() - else: - return self.fetch_tasks_unlimited() - - def register_queries(self, queries): - self.queries += queries - - def unregister_query(self, query): - self.queries.remove(query) - - def get_tasks(self): - if self.tasks is None: - self.tasks = self.fetch_tasks() - return self.tasks - - def refresh_tasks(self): - self.tasks = self.fetch_tasks() - return self.tasks - - def get_files(self, task): - assert isinstance(task, dict), task - id = task['id'] - if id in self.files: - return self.files[id] - self.files[id] = self.client.list_bt(task) - return self.files[id] - - def find_task_by_id(self, id): - assert isinstance(id, basestring), repr(id) - for t in self.get_tasks(): - if t['id'] == str(id) or t['#'] == int(id): - return t - - def get_task_by_id(self, id): - t = self.find_task_by_id(id) - if not t: - raise Exception('No task found for id '+id) - return t - - def find_task_by_hash(self, hash): - for t in self.get_tasks(): - if t['type'] == 'bt' and t['bt_hash'].lower() == hash: - return t - - def find_task_by_url(self, url): - for t in self.get_tasks(): - if link_equals(t['original_url'], url): - return t - - def get_task_by_url(self, url): - t = self.find_task_by_url(url) - if not t: - raise Exception('No task found for ' + lixian_encoding.to_native(url)) - return t - - def add_url_task(self, url): - self.commit_jobs[0].append(url) - - def add_bt_task_by_hash(self, hash): - self.commit_jobs[1].append(['hash', hash]) - - def add_bt_task_by_content(self, content, name): - self.commit_jobs[1].append(['content', (content, name)]) - - def add_magnet_task(self, hash): - self.commit_jobs[1].append(['magnet', hash]) - - def commit(self): - urls, bts = self.commit_jobs - if urls: - self.client.add_batch_tasks(map(lixian_encoding.try_native_to_utf_8, urls)) - for bt_type, value in bts: - if bt_type == 'hash': - print 'Adding bt task', value # TODO: print the thing user inputs (may be not hash) - self.client.add_torrent_task_by_info_hash(value) - elif bt_type == 'content': - content, name = value - print 'Adding bt task', name - self.client.add_torrent_task_by_content(content) - elif bt_type == 'magnet': - print 'Adding magnet task', value # TODO: print the thing user inputs (may be not hash) - self.client.add_task(value) - else: - raise NotImplementedError(bt_type) - self.commit_jobs = [[], []] - self.refresh_tasks() - - def prepare(self): - # prepare actions (e.g. add tasks) - for query in self.queries: - query.prepare() - # commit and refresh task list - self.commit() - - def query_complete(self): - for query in list(self.queries): - query.query_complete() - - def merge_results(self): - tasks = merge_tasks(self.download_jobs) - for t in tasks: - if t['type'] == 'bt': - # XXX: a dirty trick to cache requests - t['base'] = self - self.download_jobs = tasks - - def query_once(self): - self.prepare() - # merge results - for query in self.queries: - self.download_jobs += query.query_once() - self.query_complete() - self.merge_results() - - def query_search(self): - for query in self.queries: - self.download_jobs += query.query_search() - self.merge_results() - - def peek_download_jobs(self): - return self.download_jobs - - def pull_completed(self): - completed = [] - waiting = [] - for t in self.download_jobs: - if t['status_text'] == 'completed': - completed.append(t) - elif t['type'] != 'bt': - waiting.append(t) - elif 'files' not in t: - waiting.append(t) - else: - i_completed = [] - i_waiting = [] - for f in t['files']: - if f['status_text'] == 'completed': - i_completed.append(f) - else: - i_waiting.append(f) - if i_completed: - tt = dict(t) - tt['files'] = i_completed - completed.append(tt) - if i_waiting: - tt = dict(t) - tt['files'] = i_waiting - waiting.append(tt) - self.download_jobs = waiting - return completed - - def refresh_status(self): - self.refresh_tasks() - self.files = {} - tasks = [] - for old_task in self.download_jobs: - new_task = dict(self.get_task_by_id(old_task['id'])) - if 'files' in old_task: - files = self.get_files(new_task) - new_task['files'] = [files[f['index']] for f in old_task['files']] - tasks.append(new_task) - self.download_jobs = tasks - -class Query(object): - def __init__(self, base): - self.bind(base) - - def bind(self, base): - self.base = base - self.client = base.client - return self - - def unregister(self): - self.base.unregister_query(self) - - def prepare(self): - pass - - def query_once(self): - raise NotImplementedError() - - def query_complete(self): - raise NotImplementedError() - - def query_search(self): - raise NotImplementedError() - -class ExactQuery(Query): - def __init__(self, base): - super(ExactQuery, self).__init__(base) - - def query_once(self): - raise NotImplementedError() - - def query_complete(self): - self.unregister() - - def query_search(self): - raise NotImplementedError() - -class SearchQuery(Query): - def __init__(self, base): - super(SearchQuery, self).__init__(base) - - def query_once(self): - return self.query_search() - - def query_complete(self): - pass - - def query_search(self): - raise NotImplementedError() - -################################################## -# register -################################################## - -processors = [] - -bt_processors = [] - -# 0 -# 1 -- builtin -- most -# 2 -- subs -- 0/[0-9] -# 4 -- magnet -# 5 -- user -# 6 -- extend url -# 7 -- plain url, bt url -# 8 -- filter -# 9 -- default -- text search - -def query(priority): - assert isinstance(priority, (int, float)) - def register(processor): - processors.append((priority, processor)) - return processor - return register - -def bt_query(priority): - assert isinstance(priority, (int, float)) - def register(processor): - bt_processors.append((priority, processor)) - return processor - return register - -def user_query(processor): - return query(priority=5)(processor) - -def load_default_queries(): - import lixian_queries - - -################################################## -# query -################################################## - -def to_list_tasks(client, args): - if args.category: - return lambda: client.read_all_tasks_by_category(args.category) - elif args.deleted: - return client.read_all_deleted - elif args.expired: - return client.read_all_expired - elif args.completed: - return client.read_all_tasks - elif args.failed: - return client.read_all_tasks - elif args.all: - return client.read_all_tasks - else: - return client.read_all_tasks - -def to_query(base, arg, processors): - for _, process in sorted(processors): - q = process(base, arg) - if q: - return q - raise NotImplementedError('No proper query process found for: ' + arg) - -def merge_files(files1, files2): - ids = [] - files = [] - for f in files1 + files2: - if f['id'] not in ids: - files.append(f) - ids.append(f['id']) - return files - -def merge_tasks(tasks): - result_tasks = [] - task_mapping = {} - for task in tasks: - assert type(task) == dict, repr(type) - id = task['id'] - assert 'index' not in task - if id in task_mapping: - if 'files' in task and 'files' in task_mapping[id]: - task_mapping[id]['files'] = merge_files(task_mapping[id]['files'], task['files']) - else: - if 'files' in task: - t = dict(task) - result_tasks.append(t) - task_mapping[id] = t - else: - result_tasks.append(task) - task_mapping[id] = task - return result_tasks - -class AllQuery(SearchQuery): - def __init__(self, base): - super(AllQuery, self).__init__(base) - def query_search(self): - return self.base.get_tasks() - -class CompletedQuery(SearchQuery): - def __init__(self, base): - super(CompletedQuery, self).__init__(base) - def query_search(self): - return filter(lambda x: x['status_text'] == 'completed', self.base.get_tasks()) - -class FailedQuery(SearchQuery): - def __init__(self, base): - super(FailedQuery, self).__init__(base) - def query_search(self): - return filter(lambda x: x['status_text'] == 'failed', self.base.get_tasks()) - -class NoneQuery(SearchQuery): - def __init__(self, base): - super(NoneQuery, self).__init__(base) - def query_search(self): - return [] - -def default_query(options): - if options.category: - return AllQuery - elif options.deleted: - return AllQuery - elif options.expired: - return AllQuery - elif options.completed: - return CompletedQuery - elif options.failed: - return FailedQuery - elif options.all: - return AllQuery - else: - return NoneQuery - -def parse_queries(base, args): - return [to_query(base, arg, bt_processors if args.torrent else processors) for arg in args] or [default_query(args)(base)] - -def parse_limit(args): - limit = args.limit - if limit: - limit = int(limit) - ids = [] - for x in args: - import re - if re.match(r'^\d+$', x): - ids.append(int(x)) - elif re.match(r'^(\d+)/', x): - ids.append(int(x.split('/')[0])) - elif re.match(r'^(\d+)-(\d+)$', x): - ids.extend(map(int, x.split('-'))) - else: - return limit - if ids and limit: - return min(max(ids)+1, limit) - elif ids: - return max(ids)+1 - else: - return limit - -def build_query(client, args): - if args.input: - import fileinput - args._left.extend(line.strip() for line in fileinput.input(args.input) if line.strip()) - load_default_queries() # IMPORTANT: init default queries - limit = parse_limit(args) - base = TaskBase(client, to_list_tasks(client, args), limit) - base.register_queries(parse_queries(base, args)) - return base - -################################################## -# compatible APIs -################################################## - -def find_tasks_to_download(client, args): - base = build_query(client, args) - base.query_once() - return base.peek_download_jobs() - -def search_tasks(client, args): - base = build_query(client, args) - base.query_search() - return base.peek_download_jobs() - -def expand_bt_sub_tasks(task): - files = task['base'].get_files(task) # XXX: a dirty trick to cache requests - not_ready = [] - single_file = False - if len(files) == 1 and files[0]['name'] == task['name']: - single_file = True - if 'files' in task: - ordered_files = [] - for t in task['files']: - assert isinstance(t, dict) - if t['status_text'] != 'completed': - not_ready.append(t) - else: - ordered_files.append(t) - files = ordered_files - return files, not_ready, single_file - - -################################################## -# simple helpers -################################################## - -def get_task_by_id(client, id): - base = TaskBase(client, client.read_all_tasks) - return base.get_task_by_id(id) - -def get_task_by_any(client, arg): - import lixian_cli_parser - tasks = search_tasks(client, lixian_cli_parser.parse_command_line([arg])) - if not tasks: - raise LookupError(arg) - if len(tasks) > 1: - raise LookupError('Too many results for ' + arg) - return tasks[0] - diff --git a/xunlei-lixian/lixian_url.py b/xunlei-lixian/lixian_url.py deleted file mode 100644 index 0f3d685..0000000 --- a/xunlei-lixian/lixian_url.py +++ /dev/null @@ -1,75 +0,0 @@ - -import base64 -import urllib - -def xunlei_url_encode(url): - return 'thunder://'+base64.encodestring('AA'+url+'ZZ').replace('\n', '') - -def xunlei_url_decode(url): - assert url.startswith('thunder://') - url = base64.decodestring(url[10:]) - assert url.startswith('AA') and url.endswith('ZZ') - return url[2:-2] - -def flashget_url_encode(url): - return 'Flashget://'+base64.encodestring('[FLASHGET]'+url+'[FLASHGET]').replace('\n', '') - -def flashget_url_decode(url): - assert url.startswith('Flashget://') - url = base64.decodestring(url[11:]) - assert url.startswith('[FLASHGET]') and url.endswith('[FLASHGET]') - return url.replace('[FLASHGET]', '') - -def flashgetx_url_decode(url): - assert url.startswith('flashgetx://|mhts|') - name, size, hash, end = url.split('|')[2:] - assert end == '/' - return 'ed2k://|file|'+base64.decodestring(name)+'|'+size+'|'+hash+'/' - -def qqdl_url_encode(url): - return 'qqdl://' + base64.encodestring(url).replace('\n', '') - -def qqdl_url_decode(url): - assert url.startswith('qqdl://') - return base64.decodestring(url[7:]) - -def url_unmask(url): - if url.startswith('thunder://'): - return normalize_unicode_link(xunlei_url_decode(url)) - elif url.startswith('Flashget://'): - return flashget_url_decode(url) - elif url.startswith('flashgetx://'): - return flashgetx_url_decode(url) - elif url.startswith('qqdl://'): - return qqdl_url_decode(url) - else: - return url - -def normalize_unicode_link(url): - import re - def escape_unicode(m): - c = m.group() - if ord(c) < 0x80: - return c - else: - return urllib.quote(c.encode('utf-8')) - def escape_str(m): - c = m.group() - if ord(c) < 0x80: - return c - else: - return urllib.quote(c) - if type(url) == unicode: - return re.sub(r'.', escape_unicode, url) - else: - return re.sub(r'.', escape_str, url) - -def unquote_url(x): - x = urllib.unquote(x) - if type(x) != str: - return x - try: - return x.decode('utf-8') - except UnicodeDecodeError: - return x.decode('gbk') # can't decode in utf-8 and gbk - diff --git a/xunlei-lixian/lixian_util.py b/xunlei-lixian/lixian_util.py deleted file mode 100644 index 7d58612..0000000 --- a/xunlei-lixian/lixian_util.py +++ /dev/null @@ -1,29 +0,0 @@ - -__all__ = [] - -import re - -def format_1d(n): - return re.sub(r'\.0*$', '', '%.1f' % n) - -def format_size(n): - if n < 1000: - return '%sB' % n - elif n < 1000**2: - return '%sK' % format_1d(n/1000.) - elif n < 1000**3: - return '%sM' % format_1d(n/1000.**2) - elif n < 1000**4: - return '%sG' % format_1d(n/1000.**3) - - -def parse_size(size): - size = str(size) - if re.match('^\d+$', size): - return int(size) - m = re.match(r'^(\d+(?:\.\d+)?)(K|M|G)B?$', size, flags=re.I) - if not m: - raise Exception("Invalid size format: %s" % size) - return int(float(m.group(1)) * {'K': 1000, 'M': 1000*1000, 'G': 1000*1000*1000}[m.group(2).upper()]) - - diff --git a/xunlei-lixian/lixian_verification_code.py b/xunlei-lixian/lixian_verification_code.py deleted file mode 100644 index c6d9345..0000000 --- a/xunlei-lixian/lixian_verification_code.py +++ /dev/null @@ -1,13 +0,0 @@ - -def file_path_verification_code_reader(path): - def reader(image): - with open(path, 'wb') as output: - output.write(image) - print 'Verification code picture is saved to %s, please open it manually and enter what you see.' % path - code = raw_input('Verification code: ') - return code - return reader - -def default_verification_code_reader(args): - if args.verification_code_path: - return file_path_verification_code_reader(args.verification_code_path) diff --git a/xunlei-lixian/tests/123.txt b/xunlei-lixian/tests/123.txt deleted file mode 100644 index d800886..0000000 --- a/xunlei-lixian/tests/123.txt +++ /dev/null @@ -1 +0,0 @@ -123 \ No newline at end of file diff --git a/xunlei-lixian/tests/123456.txt b/xunlei-lixian/tests/123456.txt deleted file mode 100644 index 4632e06..0000000 --- a/xunlei-lixian/tests/123456.txt +++ /dev/null @@ -1 +0,0 @@ -123456 \ No newline at end of file diff --git a/xunlei-lixian/tests/The-quick-brown-fox-jumps-over-the-lazy-dog.txt b/xunlei-lixian/tests/The-quick-brown-fox-jumps-over-the-lazy-dog.txt deleted file mode 100644 index ff3bb63..0000000 --- a/xunlei-lixian/tests/The-quick-brown-fox-jumps-over-the-lazy-dog.txt +++ /dev/null @@ -1 +0,0 @@ -The quick brown fox jumps over the lazy dog \ No newline at end of file diff --git a/xunlei-lixian/tests/a.txt b/xunlei-lixian/tests/a.txt deleted file mode 100644 index 2e65efe..0000000 --- a/xunlei-lixian/tests/a.txt +++ /dev/null @@ -1 +0,0 @@ -a \ No newline at end of file diff --git a/xunlei-lixian/tests/abc.txt b/xunlei-lixian/tests/abc.txt deleted file mode 100644 index f2ba8f8..0000000 --- a/xunlei-lixian/tests/abc.txt +++ /dev/null @@ -1 +0,0 @@ -abc \ No newline at end of file diff --git a/xunlei-lixian/tests/empty.txt b/xunlei-lixian/tests/empty.txt deleted file mode 100644 index e69de29..0000000