Added node-modules

This commit is contained in:
Dobie Wollert
2014-09-14 07:04:16 -04:00
parent 663941bf57
commit 6a92348cf5
4870 changed files with 670395 additions and 0 deletions

115
node_modules/piler/spec/acceptance.spec.coffee generated vendored Normal file
View File

@ -0,0 +1,115 @@
util = require "util"
async = require "async"
request = require "request"
zombie = require "zombie"
{CSSLint} = require "csslint"
rules = CSSLint.getRules().filter (rule) -> rule.id is "errors"
CSSLint.clearRules()
CSSLint.addRule r for r in rules
validateCSS = CSSLint.verify
servers =
development: 7000
production: 7001
for type, port of servers then do (type, port) ->
fetchPage = (path) -> ->
jasmine.asyncSpecWait()
@browser = new zombie.Browser()
@httpRoot = "http://localhost:#{ port }"
@browser.visit @httpRoot + path, (err, browser) ->
throw err if err
jasmine.asyncSpecDone()
describe "JS assets in #{ type } server", ->
beforeEach fetchPage "/"
it "Can share plain js files from fs", ->
expect(@browser.window["js fs"]).toEqual true
it "can share raw js strings", ->
expect(@browser.window["raw js"]).toEqual true
it "has no namespaced raw js here", ->
expect(@browser.window["raw namespace js"]).toBeUndefined()
it "Coffee script files get compiled transparently", ->
expect(@browser.window["coffee fs"]).toEqual true
it "addOb adds global variables", ->
expect(@browser.window["addOb global"]).toEqual true
it "addOb does not override namespace objects", ->
expect(@browser.window.namespaceob.second).toEqual true, "second addOb missing"
expect(@browser.window.namespaceob.first).toEqual true, "first addOb missing"
it "js.addExec gets executed", ->
expect(@browser.window["js exec"]).toEqual true
it "addUrl can load assets from remote servers", ->
expect(@browser.window["remote script"]).toEqual true
it "No namespaced js here", ->
expect(@browser.window["namespace"]).toBeUndefined()
describe "Namespaced JS assets in #{ type } server", ->
beforeEach fetchPage "/namespace"
it "We have namaspaced js here", ->
expect(@browser.window["namespace"]).toEqual true
it "We have also global js", ->
expect(@browser.window["js fs"]).toEqual true
it "namespaced js.addExec gets executed", ->
expect(@browser.window["namespace js exec"]).toEqual true
it "can share raw js strings in namespaces", ->
expect(@browser.window["raw namespace js"]).toEqual true
describe "CSS assets in #{ type } server", ->
beforeEach fetchPage "/"
it "We have css links", ->
$ = @browser.window.jQuery
expect($("link[rel='stylesheet']").size()).toBeGreaterThan 0
it "has valid CSS", ->
$ = @browser.window.jQuery
cssUrls = $("link[rel='stylesheet']").map -> this.href
jasmine.asyncSpecWait()
async.reduce cssUrls, "", (memo, path, cb) =>
request @httpRoot + path, (err, res, body) ->
# console.log res.statusCode, path
expect(res.statusCode).toBe 200, "#{ path } is missing"
return cb err if err
cb null, memo + body
, (err, css) ->
expect(err).toBeFalsy()
# Just use csslint to validate that we have sane css here until we come
# up with something better. This will at least confirm that
# preprocessors work.
result = validateCSS css,rules
expect(result.messages.length).toBe 0, "#{ util.inspect result.messages }"
jasmine.asyncSpecDone()

92
node_modules/piler/spec/asseturlparser.spec.coffee generated vendored Normal file
View File

@ -0,0 +1,92 @@
assetUrlParse = require "../lib/asseturlparse"
describe "parses url production url", ->
for url in [ "/pile/min/cachekey/my.js?v=43234", "/pile/min/my.js"]
urlOb = assetUrlParse url
it "is minified", ->
expect(urlOb.min).toBeDefined()
it "name is my", ->
expect(urlOb.name).toBe "my"
it "has extension js", ->
expect(urlOb.ext).toBe "js"
describe "can find global", ->
urlOb = assetUrlParse "/pile/min/cachekey/global.js?v=67cc16bec85749bfe34592397e4a31b0f47d4c59"
it "has the default global", ->
expect(urlOb.min).toBeDefined()
expect(urlOb.dev).toBeUndefined()
expect(urlOb.name).toBe "global"
it "has extension js", ->
expect(urlOb.ext).toBe "js"
describe "parses url development url", ->
for url in [ "/pile/dev/cachekey/my.exec-123.js?v=43234", "/pile/dev/cachekey/my.exec-123.js"]
urlOb = assetUrlParse url
it "name is my", ->
expect(urlOb.name).toBe "my"
it "is dev", ->
expect(urlOb.dev).toBeDefined()
it "has uid 123", ->
expect(urlOb.dev.uid).toBe "123"
it "has type exec", ->
expect(urlOb.dev.type).toBe "exec"
it "has ext js", ->
expect(urlOb.ext).toBe "js"
describe "parses css urls too", ->
for url in [ "/pile/dev/cachekey/my.file-321.css?v=43234", "/pile/dev/cachekey/my.file-321.css"]
urlOb = assetUrlParse url
it "is css", ->
expect(urlOb.ext).toBe "css"
it "is dev", ->
expect(urlOb.dev).toBeDefined()
it "is has name my", ->
expect(urlOb.name).toBe "my"
describe "longer custom url root works too", ->
urlOb = assetUrlParse "/node-pile/pile/min/cachekey/global.js?v=67cc16bec85749bfe34592397e4a31b0f47d4c59"
it "is min", ->
expect(urlOb.min).toBeDefined()
it "is not development", ->
expect(urlOb.dev).toBeUndefined()
it "it is the global pile", ->
expect(urlOb.name).toBe "global"
describe "longer custom url root works too and in development", ->
urlOb = assetUrlParse "/node-pile/pile/dev/cachekey/my.file-321.css?v=43234"
it "is min", ->
expect(urlOb.min).toBeUndefined()
it "is not development", ->
expect(urlOb.dev).toBeDefined()
it "it is the global pile", ->
expect(urlOb.name).toBe "my"
it "has id 321", ->
expect(urlOb.dev.uid).toBe "321"

33
node_modules/piler/spec/basepile.spec.coffee generated vendored Normal file
View File

@ -0,0 +1,33 @@
{JSPile, CSSPile, JSManager, CSSManager} = require "../lib/piler"
for Pile in [JSPile, CSSPile] then do (Pile) ->
describe "addFile works as expected in #{ Pile.name }", ->
dummyPath = "/foo/bar"
it "Pile addFile adds up to one file", ->
js = new Pile
js.addFile dummyPath
expect(js.code.length).toBe 1
it "Pile addFile cannot make duplicates", ->
js = new Pile
js.addFile dummyPath
js.addFile dummyPath
expect(js.code.length).toBe 1
describe "addUrl works as expected in #{ Pile.name }", ->
dummyUrl = "http://example.com/test.js"
it "Pile addUrl adds up to one url", ->
js = new Pile
js.addUrl dummyUrl
expect(js.urls.length).toBe 1
it "Pile addUrl cannot make duplicates", ->
js = new Pile
js.addUrl dummyUrl
js.addUrl dummyUrl
expect(js.urls.length).toBe 1

13
node_modules/piler/spec/hrefupdater.spec.coffee generated vendored Normal file
View File

@ -0,0 +1,13 @@
{incUrlSeq} = require "../lib/livecss"
describe "incUrlSeq increases the id in the url", ->
url = "/foo/bar.js?v=123"
it "adds id in to url", ->
expect(incUrlSeq url).toBe url.replace('.','--1.')
it "increases existing id", ->
url2 = incUrlSeq url
expect(incUrlSeq url2).toBe url.replace('.','--2.')

68
node_modules/piler/spec/testapp/app.coffee generated vendored Normal file
View File

@ -0,0 +1,68 @@
express = require "express"
pile = require("../../index")
js = pile.createJSManager()
css = pile.createCSSManager()
app = express.createServer()
app.configure ->
app.use express.static __dirname + '/clientscripts'
js.bind app
css.bind app
css.addFile __dirname + "/stylesheets/style.css"
css.addFile "namespaced", __dirname + "/stylesheets/namespaced.css"
css.addFile __dirname + "/stylesheets/style.styl"
css.addFile __dirname + "/stylesheets/import.styl"
css.addFile __dirname + "/stylesheets/style.less"
css.addRaw "#raw { display: none }"
js.addOb "addOb global": true
js.addUrl "/remote.js"
js.addFile __dirname + "/clientscripts/jquery.js"
js.addFile __dirname + "/clientscripts/global.js"
js.addFile __dirname + "/clientscripts/global.coffee"
js.addRaw "window['raw js'] = true;"
js.addRaw "mynamespace", "window['raw namespace js'] = true;"
# js.addModule __dirname + "/sharedmodule.coffee"
js.addFile "mynamespace", __dirname + "/clientscripts/namespace.js"
js.addExec ->
window["js exec"] = true
js.addExec "mynamespace", ->
window["namespace js exec"] = true
js.addOb "namespaceob.first": true
js.addOb "namespaceob.second": true
app.get "/namespace", (req, res) ->
res.render "namespace.jade",
layout: false
js: js.renderTags "mynamespace"
css: css.renderTags "mynamespace"
app.get "/", (req, res) ->
res.render "index.jade",
js: js.renderTags()
css: css.renderTags("namespaced")
port = if process.env.NODE_ENV is "production" then 7001 else 7000
app.listen port
console.log "server running on port #{ port }"

View File

@ -0,0 +1,3 @@
window["coffee fs"] = true

View File

@ -0,0 +1,2 @@
window["js fs"] = true;

8981
node_modules/piler/spec/testapp/clientscripts/jquery.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
window["namespace"] = true;

View File

@ -0,0 +1,3 @@
window["remote script"] = true;

View File

@ -0,0 +1,5 @@
#less_import {
display: none;
}

View File

@ -0,0 +1,4 @@
@import "style.styl"
#stylys_import
display none

View File

@ -0,0 +1,3 @@
#namespaced {
display: none;
}

View File

@ -0,0 +1,6 @@
#plain {
display: none !important;
}

10
node_modules/piler/spec/testapp/stylesheets/style.less generated vendored Normal file
View File

@ -0,0 +1,10 @@
@import "import.less";
h1 {
font-size: 25px * 2;
}
#less {
display: none;
}

View File

@ -0,0 +1,9 @@
@import 'nib'
h1
color green
background-color blue
border-radius 5px
#stylus
display none

11
node_modules/piler/spec/testapp/views/index.jade generated vendored Normal file
View File

@ -0,0 +1,11 @@
h2 Failed CSS tests:
#tests
#plain Adding plain css files is broken
#stylus Adding Stylus is broken
#less Adding LESS is broken
#raw Adding CSS strings is broken
#namespaced Adding namespaced CSS files is broken
#stylys_import Can import stylys styles
#less_import Can import less styles
small (all ok if there is nothing visible above)

9
node_modules/piler/spec/testapp/views/layout.jade generated vendored Normal file
View File

@ -0,0 +1,9 @@
!!! 5
html(lang="en")
head
!{css}
style #tests * { color: red }
body
h1 Piler test page
#container !{body}
!{js}

7
node_modules/piler/spec/testapp/views/namespace.jade generated vendored Normal file
View File

@ -0,0 +1,7 @@
!!! 5
html(lang="en")
head
!{css}
body
h1 node-piles - namespace
!{js}