Squashed commit of the following:

commit bb79d80d284bf22ae17857b37630d3075635057e
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Mon Dec 5 11:06:53 2016 +0000

    Update changelog regarding Makefile

commit d74d0ac99da0b898d1a08ed270629bb00b492e34
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Dec 4 19:24:09 2016 +0000

    make output

commit 5c7ad5830ec881a5c22bd737cac1ec3430577eb3
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Dec 4 19:22:25 2016 +0000

    Remove gulp

commit 160947dcd346d3c0016a15fe3b64d6f194d33bfc
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Dec 4 19:10:57 2016 +0000

    Updated fetch dependency

commit 25b8f300d93c3e6e129c7ac6ab31e85c12cebc6a
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Dec 4 18:45:21 2016 +0000

    Copy frontend assets into place

commit 65b02a14e98215899efc4f5673953bdf23f4c942
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Sun Dec 4 18:40:28 2016 +0000

    Add the target file for `sass`, and set the scss files as the prerequisits

commit 7442df5040ac1459d5f088690390ef043f968852
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Dec 2 21:44:19 2016 +0000

    Makefile output so far

commit 8580a61aa2fb6326b99f58cb2d0418a45d734054
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Dec 2 21:42:32 2016 +0000

    Create sourcemaps during js uglification

commit facdbbf81f4907ce394dcb5719b76451fd45e539
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Fri Dec 2 21:40:48 2016 +0000

    We can now uglify js files and compress all frontend assets

commit 866c4fa0d70377f80061533989c4d8e6d00c818c
Author: Jonny Barnes <jonny@jonnybarnes.uk>
Date:   Thu Dec 1 15:57:49 2016 +0000

    A simple makefile
This commit is contained in:
Jonny Barnes 2016-12-05 11:07:22 +00:00
parent a0b1a4f97b
commit cc65b45f91
41 changed files with 238 additions and 1721 deletions

File diff suppressed because one or more lines are too long

View file

@ -20,6 +20,28 @@
arrayBuffer: 'ArrayBuffer' in self
}
if (support.arrayBuffer) {
var viewClasses = [
'[object Int8Array]',
'[object Uint8Array]',
'[object Uint8ClampedArray]',
'[object Int16Array]',
'[object Uint16Array]',
'[object Int32Array]',
'[object Uint32Array]',
'[object Float32Array]',
'[object Float64Array]'
]
var isDataView = function(obj) {
return obj && DataView.prototype.isPrototypeOf(obj)
}
var isArrayBufferView = ArrayBuffer.isView || function(obj) {
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
}
}
function normalizeName(name) {
if (typeof name !== 'string') {
name = String(name)
@ -152,14 +174,36 @@
function readBlobAsArrayBuffer(blob) {
var reader = new FileReader()
var promise = fileReaderReady(reader)
reader.readAsArrayBuffer(blob)
return fileReaderReady(reader)
return promise
}
function readBlobAsText(blob) {
var reader = new FileReader()
var promise = fileReaderReady(reader)
reader.readAsText(blob)
return fileReaderReady(reader)
return promise
}
function readArrayBufferAsText(buf) {
var view = new Uint8Array(buf)
var chars = new Array(view.length)
for (var i = 0; i < view.length; i++) {
chars[i] = String.fromCharCode(view[i])
}
return chars.join('')
}
function bufferClone(buf) {
if (buf.slice) {
return buf.slice(0)
} else {
var view = new Uint8Array(buf.byteLength)
view.set(new Uint8Array(buf))
return view.buffer
}
}
function Body() {
@ -167,7 +211,9 @@
this._initBody = function(body) {
this._bodyInit = body
if (typeof body === 'string') {
if (!body) {
this._bodyText = ''
} else if (typeof body === 'string') {
this._bodyText = body
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body
@ -175,11 +221,12 @@
this._bodyFormData = body
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
this._bodyText = body.toString()
} else if (!body) {
this._bodyText = ''
} else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
// Only support ArrayBuffers for POST method.
// Receiving ArrayBuffers happens via Blobs, instead.
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
this._bodyArrayBuffer = bufferClone(body.buffer)
// IE 10-11 can't handle a DataView body.
this._bodyInit = new Blob([this._bodyArrayBuffer])
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
this._bodyArrayBuffer = bufferClone(body)
} else {
throw new Error('unsupported BodyInit type')
}
@ -204,6 +251,8 @@
if (this._bodyBlob) {
return Promise.resolve(this._bodyBlob)
} else if (this._bodyArrayBuffer) {
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as blob')
} else {
@ -212,27 +261,28 @@
}
this.arrayBuffer = function() {
return this.blob().then(readBlobAsArrayBuffer)
}
this.text = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob)
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as text')
if (this._bodyArrayBuffer) {
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
} else {
return Promise.resolve(this._bodyText)
return this.blob().then(readBlobAsArrayBuffer)
}
}
} else {
this.text = function() {
var rejected = consumed(this)
return rejected ? rejected : Promise.resolve(this._bodyText)
}
this.text = function() {
var rejected = consumed(this)
if (rejected) {
return rejected
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob)
} else if (this._bodyArrayBuffer) {
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as text')
} else {
return Promise.resolve(this._bodyText)
}
}
@ -260,7 +310,10 @@
function Request(input, options) {
options = options || {}
var body = options.body
if (Request.prototype.isPrototypeOf(input)) {
if (typeof input === 'string') {
this.url = input
} else {
if (input.bodyUsed) {
throw new TypeError('Already read')
}
@ -271,12 +324,10 @@
}
this.method = input.method
this.mode = input.mode
if (!body) {
if (!body && input._bodyInit != null) {
body = input._bodyInit
input.bodyUsed = true
}
} else {
this.url = input
}
this.credentials = options.credentials || this.credentials || 'omit'
@ -294,7 +345,7 @@
}
Request.prototype.clone = function() {
return new Request(this)
return new Request(this, { body: this._bodyInit })
}
function decode(body) {
@ -310,16 +361,17 @@
return form
}
function headers(xhr) {
var head = new Headers()
var pairs = (xhr.getAllResponseHeaders() || '').trim().split('\n')
pairs.forEach(function(header) {
var split = header.trim().split(':')
var key = split.shift().trim()
var value = split.join(':').trim()
head.append(key, value)
function parseHeaders(rawHeaders) {
var headers = new Headers()
rawHeaders.split('\r\n').forEach(function(line) {
var parts = line.split(':')
var key = parts.shift().trim()
if (key) {
var value = parts.join(':').trim()
headers.append(key, value)
}
})
return head
return headers
}
Body.call(Request.prototype)
@ -330,10 +382,10 @@
}
this.type = 'default'
this.status = options.status
this.status = 'status' in options ? options.status : 200
this.ok = this.status >= 200 && this.status < 300
this.statusText = options.statusText
this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
this.statusText = 'statusText' in options ? options.statusText : 'OK'
this.headers = new Headers(options.headers)
this.url = options.url || ''
this._initBody(bodyInit)
}
@ -371,35 +423,16 @@
self.fetch = function(input, init) {
return new Promise(function(resolve, reject) {
var request
if (Request.prototype.isPrototypeOf(input) && !init) {
request = input
} else {
request = new Request(input, init)
}
var request = new Request(input, init)
var xhr = new XMLHttpRequest()
function responseURL() {
if ('responseURL' in xhr) {
return xhr.responseURL
}
// Avoid security warnings on getResponseHeader when not allowed by CORS
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader('X-Request-URL')
}
return
}
xhr.onload = function() {
var options = {
status: xhr.status,
statusText: xhr.statusText,
headers: headers(xhr),
url: responseURL()
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
}
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')
var body = 'response' in xhr ? xhr.response : xhr.responseText
resolve(new Response(body, options))
}

Binary file not shown.

Binary file not shown.