Template Upload
This commit is contained in:
19
node_modules/browser-sync-client/README.md
generated
vendored
Normal file
19
node_modules/browser-sync-client/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# browser-sync-client [](https://travis-ci.org/BrowserSync/browser-sync-client)
|
||||
|
||||
Client-side script for BrowserSync
|
||||
|
||||
## Contributors
|
||||
|
||||
```
|
||||
177 Shane Osbourne
|
||||
2 Sergey Slipchenko
|
||||
1 Hugo Dias
|
||||
1 Shinnosuke Watanabe
|
||||
1 Tim Schaub
|
||||
1 Shane Daniel
|
||||
1 Matthieu Vachon
|
||||
```
|
||||
|
||||
## License
|
||||
Copyright (c) 2014 Shane Osbourne
|
||||
Licensed under the MIT license.
|
0
node_modules/browser-sync-client/dist/.gitkeep
generated
vendored
Normal file
0
node_modules/browser-sync-client/dist/.gitkeep
generated
vendored
Normal file
2030
node_modules/browser-sync-client/dist/index.js
generated
vendored
Normal file
2030
node_modules/browser-sync-client/dist/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/browser-sync-client/dist/index.min.js
generated
vendored
Normal file
1
node_modules/browser-sync-client/dist/index.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
144
node_modules/browser-sync-client/index.js
generated
vendored
Normal file
144
node_modules/browser-sync-client/index.js
generated
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
|
||||
var etag = require("etag");
|
||||
var fresh = require("fresh");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var zlib = require("zlib");
|
||||
|
||||
var minifiedScript = path.join(__dirname, "/dist/index.min.js");
|
||||
var unminifiedScript = path.join(__dirname, "/dist/index.js");
|
||||
|
||||
/**
|
||||
* Does the current request support compressed encoding?
|
||||
* @param {Object} req
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function supportsGzip (req) {
|
||||
var accept = req.headers['accept-encoding'];
|
||||
return accept && accept.indexOf('gzip') > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set headers on the response
|
||||
* @param {Object} res
|
||||
* @param {String} body
|
||||
*/
|
||||
function setHeaders(res, body) {
|
||||
|
||||
res.setHeader("Cache-Control", "public, max-age=0");
|
||||
res.setHeader("Content-Type", "text/javascript");
|
||||
res.setHeader("ETag", etag(body));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} options
|
||||
* @param {String} connector
|
||||
* @returns {String}
|
||||
*/
|
||||
function getScriptBody(options, connector) {
|
||||
|
||||
var script = minifiedScript;
|
||||
|
||||
if (options && !options.minify) {
|
||||
script = unminifiedScript;
|
||||
}
|
||||
|
||||
return connector + fs.readFileSync(script);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} req
|
||||
* @returns {String}
|
||||
*/
|
||||
function isConditionalGet(req) {
|
||||
return req.headers["if-none-match"] || req.headers["if-modified-since"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a not-modified response
|
||||
* @param {Object} res
|
||||
*/
|
||||
function notModified(res) {
|
||||
res.removeHeader("Content-Type");
|
||||
res.statusCode = 304;
|
||||
res.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Public method for returning either a middleware fn
|
||||
* or the content as a string
|
||||
* @param {Object} options
|
||||
* @param {String} connector - content to be prepended
|
||||
* @param {String} type - either `file` or `middleware`
|
||||
* @returns {*}
|
||||
*/
|
||||
function init(options, connector, type) {
|
||||
|
||||
var gzipCached;
|
||||
|
||||
/**
|
||||
* Combine string to create the final version
|
||||
* @type {String}
|
||||
*/
|
||||
var requestBody = getScriptBody(options, connector);
|
||||
|
||||
/**
|
||||
* If the user asked for a file, simply return the string.
|
||||
*/
|
||||
if (type && type === "file") {
|
||||
return requestBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Otherwise return a function to be used a middleware
|
||||
*/
|
||||
return function (req, res) {
|
||||
|
||||
/**
|
||||
* default to using the uncompressed string
|
||||
* @type {String}
|
||||
*/
|
||||
var output = requestBody;
|
||||
|
||||
/**
|
||||
* Set the appropriate headers for caching
|
||||
*/
|
||||
setHeaders(res, output);
|
||||
|
||||
if (isConditionalGet(req) && fresh(req.headers, res._headers)) {
|
||||
return notModified(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* If gzip is supported, compress the string once
|
||||
* and save for future requests
|
||||
*/
|
||||
if (supportsGzip(req)) {
|
||||
|
||||
res.setHeader("Content-Encoding", "gzip");
|
||||
|
||||
if (!gzipCached) {
|
||||
var buf = new Buffer(output, "utf-8");
|
||||
zlib.gzip(buf, function (_, result) {
|
||||
gzipCached = result;
|
||||
res.end(result);
|
||||
});
|
||||
} else {
|
||||
res.end(gzipCached);
|
||||
}
|
||||
|
||||
} else {
|
||||
res.end(output);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.middleware = init;
|
||||
module.exports.plugin = init;
|
||||
module.exports.minified = function () {
|
||||
return fs.readFileSync(minifiedScript, 'utf8');
|
||||
};
|
||||
module.exports.unminified = function () {
|
||||
return fs.readFileSync(unminifiedScript, 'utf8');
|
||||
}
|
117
node_modules/browser-sync-client/package.json
generated
vendored
Normal file
117
node_modules/browser-sync-client/package.json
generated
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"browser-sync-client@2.5.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\browser-sync"
|
||||
]
|
||||
],
|
||||
"_from": "browser-sync-client@2.5.0",
|
||||
"_id": "browser-sync-client@2.5.0",
|
||||
"_inCache": true,
|
||||
"_location": "/browser-sync-client",
|
||||
"_nodeVersion": "6.10.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/browser-sync-client-2.5.0.tgz_1494856130857_0.43215389852412045"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "shakyshane@gmail.com",
|
||||
"name": "shakyshane"
|
||||
},
|
||||
"_npmVersion": "3.10.10",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "browser-sync-client",
|
||||
"raw": "browser-sync-client@2.5.0",
|
||||
"rawSpec": "2.5.0",
|
||||
"scope": null,
|
||||
"spec": "2.5.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browser-sync"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/browser-sync-client/-/browser-sync-client-2.5.0.tgz",
|
||||
"_shasum": "29eb4b22a53bd528ee12d97448e0f52576022230",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "browser-sync-client@2.5.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\browser-sync",
|
||||
"author": {
|
||||
"email": "shane.osbourne8@gmail.com",
|
||||
"name": "Shane Osbourne"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/shakyshane/browser-sync-client/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"etag": "^1.7.0",
|
||||
"fresh": "^0.3.0"
|
||||
},
|
||||
"description": "Client-side scripts for BrowserSync",
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.9.11",
|
||||
"browserify": "^11.2.0",
|
||||
"chai": "~1.9.0",
|
||||
"crossbow": "latest",
|
||||
"express": "^4.12.3",
|
||||
"gulp-contribs": "0.0.2",
|
||||
"gulp-jshint": "~1.4.0",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-uglify": "^0.2.1",
|
||||
"karma": "^0.13.15",
|
||||
"karma-chrome-launcher": "^0.1.3",
|
||||
"karma-coverage": "^0.2.1",
|
||||
"karma-firefox-launcher": "^0.1.4",
|
||||
"karma-html2js-preprocessor": "^0.1.0",
|
||||
"karma-mocha": "~0.1.1",
|
||||
"karma-sinon": "~1.0.0",
|
||||
"mocha": "^1.18.2",
|
||||
"nodemon": "^1.11.0",
|
||||
"sinon": "~1.8.2",
|
||||
"supertest": "^0.10.0",
|
||||
"through2": "^0.4.1",
|
||||
"vinyl-fs": "^2.4.4",
|
||||
"vinyl-source-stream": "^1.1.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "29eb4b22a53bd528ee12d97448e0f52576022230",
|
||||
"tarball": "https://registry.npmjs.org/browser-sync-client/-/browser-sync-client-2.5.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "d43b46e6ef82d0e2bb2d98f5c7fd2e72db609477",
|
||||
"homepage": "https://github.com/shakyshane/browser-sync-client",
|
||||
"installable": true,
|
||||
"keywords": [],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/shakyshane/browser-sync-client/blob/master/LICENSE-MIT"
|
||||
}
|
||||
],
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "shakyshane",
|
||||
"email": "shane.osbourne8@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "browser-sync-client",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/shakyshane/browser-sync-client.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "cb run default",
|
||||
"start": "cb dev",
|
||||
"test": "cb test"
|
||||
},
|
||||
"version": "2.5.0"
|
||||
}
|
Reference in New Issue
Block a user