Docs build script (#3332)

* Remove artifacts from repo

* Remove docs stuff from build script

* Add new docs build script

* Add 'third-party' shim in playground worker

* Build from src if it's a PR

* Add command to package.json and remove old stuff from travis
This commit is contained in:
Lucas Duailibe authored and Lucas Azzola committed 2017-11-28 09:27:25 +11:00
1 parent 56951a71b4
commit f514d1e93f
16 files changed
+88 -35470

No files matched your search

+1
View File
@@ -9,6 +9,7 @@
/website/node_modules
/website/build
/website/i18n
/website/static/lib
.DS_Store
coverage
.idea
-7
View File
@@ -23,10 +23,3 @@ script:
- yarn lint-docs
- AST_COMPARE=1 yarn test -- --runInBand
- if [ "${NODE_ENV}" = "development" ]; then yarn codecov; fi
deploy:
provider: script
script: website/deploy.sh
skip_cleanup: true
on:
branch: master
node: stable
+1
View File
@@ -88,6 +88,7 @@
"lint": "cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter",
"lint-docs": "prettylint {.,docs,website}/*.md",
"build": "node ./scripts/build/build.js",
"build-docs": "node ./scripts/build/build-docs.js",
"check-deps": "node ./scripts/check-deps.js"
}
}
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/env node
"use strict";
const path = require("path");
const shell = require("shelljs");
const rootDir = path.join(__dirname, "..", "..");
const docs = path.join(rootDir, "website/static/lib");
const parsers = [
"babylon",
"flow",
"typescript",
"graphql",
"postcss",
"parse5",
"markdown"
];
function pipe(string) {
return new shell.ShellString(string);
}
const isPullRequest = process.env.PULL_REQUEST === "true";
const prettierPath = isPullRequest ? "dist" : "node_modules/prettier/";
// --- Build prettier for PR ---
if (isPullRequest) {
const pkg = require("../../package.json");
pkg.version = `preview-${process.env.REVIEW_ID}`;
pipe(JSON.stringify(pkg, null, 2)).to("package.json");
shell.exec("node scripts/build/build.js");
}
// --- Docs ---
shell.mkdir("-p", docs);
shell.echo("Bundling docs index...");
shell.cp(`${prettierPath}/index.js`, `${docs}/index.js`);
shell.exec(
`node_modules/babel-cli/bin/babel.js ${docs}/index.js --out-file ${
docs
}/index.js --presets=es2015`
);
shell.echo("Bundling docs babylon...");
shell.exec(
`rollup -c scripts/build/rollup.docs.config.js --environment filepath:parser-babylon.js -i ${
prettierPath
}/parser-babylon.js`
);
shell.exec(
`node_modules/babel-cli/bin/babel.js ${docs}/parser-babylon.js --out-file ${
docs
}/parser-babylon.js --presets=es2015`
);
for (const parser of parsers) {
if (parser === "babylon") {
continue;
}
shell.echo(`Bundling docs ${parser}...`);
shell.exec(
`rollup -c scripts/build/rollup.docs.config.js --environment filepath:parser-${
parser
}.js -i ${prettierPath}/parser-${parser}.js`
);
}
shell.echo("Copy sw-toolbox.js to docs");
shell.cp("node_modules/sw-toolbox/sw-toolbox.js", `${docs}/sw-toolbox.js`);
// --- Site ---
shell.cd("website");
shell.echo("Building website...");
shell.exec("yarn install");
shell.exec("yarn build");
shell.echo();
+1 -44
View File
@@ -8,7 +8,6 @@ const formatMarkdown = require("../../website/static/markdown");
const shell = require("shelljs");
const rootDir = path.join(__dirname, "..", "..");
const docs = path.join(rootDir, "website/static/lib");
const parsers = [
"babylon",
"flow",
@@ -28,8 +27,7 @@ function pipe(string) {
shell.set("-e");
shell.cd(rootDir);
shell.rm("-Rf", "dist/", docs);
shell.mkdir("-p", docs);
shell.rm("-Rf", "dist/");
// --- Lib ---
@@ -66,44 +64,6 @@ pipe(`module.exports = ${content}`).to("dist/parser-postcss.js");
shell.echo();
// --- Docs ---
shell.echo("Bundling docs index...");
shell.exec(
`rollup -c scripts/build/rollup.index.config.js --environment BUILD_TARGET:website -o ${
docs
}/index.js`
);
shell.exec(
`node_modules/babel-cli/bin/babel.js ${docs}/index.js --out-file ${
docs
}/index.js --presets=es2015`
);
shell.echo("Bundling docs babylon...");
shell.exec(
"rollup -c scripts/build/rollup.docs.config.js --environment filepath:parser-babylon.js"
);
shell.exec(
`node_modules/babel-cli/bin/babel.js ${docs}/parser-babylon.js --out-file ${
docs
}/parser-babylon.js --presets=es2015`
);
for (const parser of parsers) {
if (parser === "babylon") {
continue;
}
shell.echo(`Bundling docs ${parser}...`);
shell.exec(
`rollup -c scripts/build/rollup.docs.config.js --environment filepath:parser-${
parser
}.js`
);
}
shell.echo();
// --- Misc ---
shell.echo("Remove eval");
@@ -133,9 +93,6 @@ const newIssueTemplate = issueTemplate.replace(
);
pipe(newIssueTemplate).to(".github/ISSUE_TEMPLATE.md");
shell.echo("Copy sw-toolbox.js to docs");
shell.cp("node_modules/sw-toolbox/sw-toolbox.js", `${docs}/sw-toolbox.js`);
shell.echo("Copy package.json");
const pkgWithoutDependencies = Object.assign({}, pkg);
delete pkgWithoutDependencies.dependencies;
+1 -1
View File
@@ -9,7 +9,7 @@ const filename = filepath.replace(/.+\//, "");
const basename = filename.replace(/\..+/, "");
export default Object.assign(baseConfig, {
entry: "dist/" + filepath,
entry: "node_modules/prettier/" + filepath,
dest: "website/static/lib/" + filename,
format: "iife",
plugins: [json(), resolve({ preferBuiltins: true }), commonjs(), globals()],
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-6
View File
@@ -1,6 +0,0 @@
var flow = (function () {
function createError$1(t,r){const e=new SyntaxError(t+" ("+r.start.line+":"+r.start.column+")");return e.loc=r,e}function includeShebang$1(t,r){if(!t.startsWith("#!"))return;const e=t.indexOf("\n"),n={type:"Line",value:t.slice(2,e),range:[0,e],loc:{source:null,start:{line:1,column:0},end:{line:1,column:e}}};r.comments=[n].concat(r.comments);}function createCommonjsModule(t,r){return r={exports:{}},t(r,r.exports),r.exports}function parse(t){"use strict";const r=flow_parser.parse(t,{esproposal_class_instance_fields:!0,esproposal_class_static_fields:!0,esproposal_export_star_as:!0});if(r.errors.length>0){const t=r.errors[0].loc;throw createError(r.errors[0].message,{start:{line:t.start.line,column:t.start.column+1},end:{line:t.end.line,column:t.end.column+1}})}return includeShebang(t,r),r}var parserCreateError=createError$1; var parserIncludeShebang=includeShebang$1; var flow_parser=createCommonjsModule(function(t,r){!function(t){"use strict";function e(t,r){throw[0,t,r]}function n(t,r){if(typeof r===_k)return t.fun=r,0;if(r.fun)return t.fun=r.fun,0;for(var e=r.length;e--;)t[e]=r[e];return 0}function a(t,r,e){if("number"==typeof t)switch(t){case 0:r.fun=e;break;case 1:default:n(r,e);}else switch(t[0]){case 0:for(var u=1;u<t[1].length;u++)a(t[1][u],r[u],e[u]);}return 0}function u(t,r){var e=t.length,n=e+r.length-1,a=new Array(n);a[0]=0;for(var u=1,i=1;u<e;u++)a[u]=t[u];for(;u<n;u++,i++)a[u]=r[i];return a}function i(t,r,e,n,a){if(n<=r)for(u=1;u<=a;u++)e[n+u]=t[r+u];else for(var u=a;u>=1;u--)e[n+u]=t[r+u];return 0}function f(t,r,e){var n=new Array(e+1);n[0]=0;for(var a=1,u=r+1;a<=e;a++,u++)n[a]=t[u];return n}function c(t,r,e){for(var n=new Array(e),a=0;a<e;a++)n[a]=t[r+a];return n}function s(t,r,e){var n=String.fromCharCode;if(0==r&&e<=4096&&e==t.length)return n.apply(null,t);for(var a=fb;0<e;r+=Tu,e-=Tu)a+=n.apply(null,c(t,r,Math.min(e,Tu)));return a}function o(r){if(t.Uint8Array)e=new t.Uint8Array(r.l);else var e=new Array(r.l);for(var n=r.c,a=n.length,u=0;u<a;u++)e[u]=n.charCodeAt(u);for(a=r.l;u<a;u++)e[u]=0;return r.c=e,r.t=4,e}function v(t,r,e,n,a){if(0==a)return 0;if(0==n&&(a>=e.l||2==e.t&&a>=e.c.length))e.c=4==t.t?s(t.c,r,a):0==r&&t.c.length==a?t.c:t.c.substr(r,a),e.t=e.c.length==e.l?0:2;else if(2==e.t&&n==e.c.length)e.c+=4==t.t?s(t.c,r,a):0==r&&t.c.length==a?t.c:t.c.substr(r,a),e.t=e.c.length==e.l?0:2;else{4!=e.t&&o(e);var u=t.c,i=e.c;if(4==t.t)for(c=0;c<a;c++)i[n+c]=u[r+c];else{for(var f=Math.min(a,u.length-r),c=0;c<f;c++)i[n+c]=u.charCodeAt(r+c);for(;c<a;c++)i[n+c]=0;}}return 0}function l(t,r){for(var e=t.length,n=new Array(e+1),a=0;a<e;a++)n[a]=t[a];return n[a]=r,n}function b(t,r){if(t.fun)return b(t.fun,r);var e=t.length,n=r.length,a=e-n;return 0==a?t.apply(null,r):a<0?b(t.apply(null,c(r,0,e)),c(r,e,n-e)):function(e){return b(t,l(r,e))}}function k(t,r){if(r.repeat)return r.repeat(t);var e=fb,n=0;if(0==t)return e;for(;;){if(1&t&&(e+=r),0==(t>>=1))return e;r+=r,9==++n&&r.slice(0,1);}}function p(t){2==t.t?t.c+=k(t.l-t.c.length,"\0"):t.c=s(t.c,0,t.c.length),t.t=0;}function h(t){if(t.length<24){for(var r=0;r<t.length;r++)if(t.charCodeAt(r)>Xb)return!1;return!0}return!/[^\x00-\x7f]/.test(t)}function d(t){for(var r,e,n,a,u=fb,i=fb,f=0,c=t.length;f<c;f++){if((e=t.charCodeAt(f))<Yn){for(var s=f+1;s<c&&(e=t.charCodeAt(s))<Yn;s++);if(s-f>Mn?(i.substr(0,1),u+=i,i=fb,u+=t.slice(f,s)):i+=t.slice(f,s),s==c)break;f=s;}a=1,++f<c&&(-64&(n=t.charCodeAt(f)))==Yn&&(r=n+(e<<6),e<Pl?(a=r-12416)<Yn&&(a=1):(a=2,++f<c&&(-64&(n=t.charCodeAt(f)))==Yn&&(r=n+(r<<6),e<qp?((a=r-925824)<Nc||a>=55295&&a<il)&&(a=2):(a=3,++f<c&&(-64&(n=t.charCodeAt(f)))==Yn&&e<No&&((a=n-63447168+(r<<6))<zc||a>Wv)&&(a=3))))),a<4?(f-=a,i+="�"):i+=a>ii?String.fromCharCode(55232+(a>>10),Fi+(a&na)):String.fromCharCode(a),i.length>Tu&&(i.substr(0,1),u+=i,i=fb);}return u+i}function m(t){switch(t.t){case 9:return t.c;default:p(t);case 0:if(h(t.c))return t.t=9,t.c;t.t=8;case 8:return d(t.c)}}function y(t,r,e){this.t=t,this.c=r,this.l=e;}function w(t){return new y(0,t,t.length)}function g(t,r){e(t,w(r));}function T(t){g(Od.Invalid_argument,t);}function _(){T(fu);}function S(t,r){return r>>>0>=t.length-1&&_(),t}function A(t){return isFinite(t)?Math.abs(t)>=2.2250738585072014e-308?0:0!=t?1:2:isNaN(t)?4:3}function E(t,r){var e=t[3]<<16,n=r[3]<<16;return e>n?1:e<n?-1:t[2]>r[2]?1:t[2]<r[2]?-1:t[1]>r[1]?1:t[1]<r[1]?-1:0}function x(t,r){return t<r?-1:t==r?0:1}function I(t,r){return 6&t.t&&p(t),6&r.t&&p(r),t.c<r.c?-1:t.c>r.c?1:0}function C(t,r,e){for(var n=[];;){if(!e||t!==r)if(t instanceof y){if(!(r instanceof y))return 1;if(t!==r&&0!=(i=I(t,r)))return i}else if(t instanceof Array&&t[0]===(0|t[0])){var a=t[0];if(a===wn&&(a=0),a===Gl){t=t[1];continue}if(!(r instanceof Array&&r[0]===(0|r[0])))return 1;var u=r[0];if(u===wn&&(u=0),u===Gl){r=r[1];continue}if(a!=u)return a<u?-1:1;switch(a){case 248:if(0!=(i=x(t[2],r[2])))return i;break;case 251:T("equal: abstract value");case 255:var i=E(t,r);if(0!=i)return i;break;default:if(t.length!=r.length)return t.length<r.length?-1:Line truncated
return parserFlow_1;
}());
-18
View File
@@ -1,18 +0,0 @@
var graphql = (function () {
function unwrapExports (x) {
return x && x.__esModule ? x['default'] : x;
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var parserGraphql_1 = createCommonjsModule(function (module) {
"use strict";function createError$1(e,n){const r=new SyntaxError(e+" ("+n.start.line+":"+n.start.column+")");return r.loc=n,r}function createCommonjsModule$$1(e,n){return n={exports:{}},e(n,n.exports),n.exports}function parseComments(e){const n=[];let r=e.loc.startToken.next;for(;"<EOF>"!==r.kind;)"Comment"===r.kind&&(Object.assign(r,{column:r.column-1}),n.push(r)),r=r.next;return n}function removeTokens(e){if(e&&"object"==typeof e){delete e.startToken,delete e.endToken,delete e.prev,delete e.next;for(const n in e)removeTokens(e[n]);}return e}function parse(e){const n=index;try{const r=n.parse(e);return r.comments=parseComments(r),removeTokens(r),r}catch(e){throw e instanceof index$2.GraphQLError?createError(e.message,{start:{line:e.locations[0].line,column:e.locations[0].column}}):e}}var parserCreateError=createError$1,location=createCommonjsModule$$1(function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getLocation=function(e,n){for(var r=/\r\n|[\n\r]/g,t=1,i=n+1,o=void 0;(o=r.exec(e.body))&&o.index<n;)t+=1,i=n+1-(o.index+o[0].length);return{line:t,column:i}};}),GraphQLError_1=createCommonjsModule$$1(function(e,n){function r(e,n,i,o,a,u){var c=i;if(!c&&n&&n.length>0){var l=n[0];c=l&&l.loc&&l.loc.source;}var s=o;!s&&n&&(s=n.filter(function(e){return Boolean(e.loc)}).map(function(e){return e.loc.start})),s&&0===s.length&&(s=void 0);var f=void 0,d=c;d&&s&&(f=s.map(function(e){return(0,t.getLocation)(d,e)})),Object.defineProperties(this,{message:{value:e,enumerable:!0,writable:!0},locations:{value:f||void 0,enumerable:!0},path:{value:a||void 0,enumerable:!0},nodes:{value:n||void 0},source:{value:c||void 0},positions:{value:s||void 0},originalError:{value:u}}),u&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0});}Object.defineProperty(n,"__esModule",{value:!0}),n.GraphQLError=r;var t=location;r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:"GraphQLError"}});}),syntaxError_1=createCommonjsModule$$1(function(e,n){function r(e,n){var r=n.line,a=e.locationOffset.line-1,u=t(e,n),c=r+a,l=(c-1).toString(),s=c.toString(),f=(c+1).toString(),d=f.length,v=e.body.split(/\r\n|[\n\r]/g);return v[0]=i(e.locationOffset.column-1)+v[0],(r>=2?o(d,l)+": "+v[r-2]+"\n":"")+o(d,s)+": "+v[r-1]+"\n"+i(2+d+n.column-1+u)+"^\n"+(r<v.length?o(d,f)+": "+v[r]+"\n":"")}function t(e,n){return 1===n.line?e.locationOffset.column-1:0}function i(e){return Array(e+1).join(" ")}function o(e,n){return i(e-n.length)+n}Object.defineProperty(n,"__esModule",{value:!0}),n.syntaxError=function(e,n,i){var o=(0,a.getLocation)(e,n),c=o.line+e.locationOffset.line-1,l=t(e,o),s=o.column+l;return new u.GraphQLError("Syntax Error "+e.name+" ("+c+":"+s+") "+i+"\n\n"+r(e,o),void 0,e,[n])};var a=location,u=GraphQLError_1;}),locatedError_1=createCommonjsModule$$1(function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.locatedError=function(e,n,t){if(e&&e.path)return e;var i=e?e.message||String(e):"An unknown error occurred.";return new r.GraphQLError(i,e&&e.nodes||n,e&&e.source,e&&e.positions,t,e)};var r=GraphQLError_1;}),invariant_1=createCommonjsModule$$1(function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,n){if(!e)throw new Error(n)};}),formatError_1=createCommonjsModule$$1(function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.formatError=function(e){return e||(0,r.default)(0,"Received null or undefined error."),{message:e.message,locations:e.locations,path:e.path}};var r=function(e){return e&&e.__esModule?e:{default:e}}(invariant_1);}),index$2=createCommonjsModule$$1(function(e,n){Object.defineProperty(n,"__esModule",{value:!0});var r=GraphQLError_1;Object.defineProperty(n,"GraphQLError",{enumerable:!0,get:function(){return r.GraphQLError}});var t=syntaxError_1;Object.defineProperty(n,"syntaxError",{enumerable:!0,get:function(){return t.syntaxError}});var i=locatedError_1;Object.defineProperty(n,"locatedError",{enumerable:!0,get:function(){return i.locatedError}});var o=formatError_1;Object.defineProperty(n,"formatError",{enumerable:!0,get:function(){return o.formatError}});}),lexer=createCommonjsModule$$1(function(e,n){function r(){var e=this.lastToken=this.token;if(e.kind!==m){do{e=e.next=o(this,e);}while(e.kind===F);this.token=e;}return e}function t(e,n,r,t,i,o,a){this.kind=e,this.start=n,this.end=r,this.line=t,this.column=i,this.value=a,this.prev=o,this.next=null;}function i(e){return isNaN(e)?m:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'+("00"+e.toString(16).toUpperCase()).slice(-4)+'"'}function o(e,n){var r=e.source,o=r.body,s=o.length,d=u(o,n.end,e),v=e.line,T=1+d-e.lineStart;if(d>=s)return new t(m,s,s,v,T,n);var C=w.call(o,d);if(C<32&&9!==C&&10!==C&&13!==C)throw(0,E.syntaxError)(r,d,"Cannot contain the invalid character "+i(C)+".");switch(C){case 33:return new t(k,d,d+1,v,T,n);caLine truncated
});
var parserGraphql = unwrapExports(parserGraphql_1);
return parserGraphql;
}());
-236
View File
@@ -1,236 +0,0 @@
var markdown = (function (util,path) {
util = 'default' in util ? util['default'] : util;
path = 'default' in path ? path['default'] : path;
var global$1 = typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {};
// shim for using process in browser
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
var cachedSetTimeout = defaultSetTimout;
var cachedClearTimeout = defaultClearTimeout;
if (typeof global$1.setTimeout === 'function') {
cachedSetTimeout = setTimeout;
}
if (typeof global$1.clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
}
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
function nextTick(fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
}
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
var title = 'browser';
var platform = 'browser';
var browser = true;
var env = {};
var argv = [];
var version = ''; // empty string to avoid regexp issues
var versions = {};
var release = {};
var config = {};
function noop$1() {}
var on = noop$1;
var addListener = noop$1;
var once = noop$1;
var off = noop$1;
var removeListener = noop$1;
var removeAllListeners = noop$1;
var emit = noop$1;
function binding(name) {
throw new Error('process.binding is not supported');
}
function cwd () { return '/' }
function chdir (dir) {
throw new Error('process.chdir is not supported');
}
function umask() { return 0; }
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
var performance = global$1.performance || {};
var performanceNow =
performance.now ||
performance.mozNow ||
performance.msNow ||
performance.oNow ||
performance.webkitNow ||
function(){ return (new Date()).getTime() };
// generate timestamp or delta
// see http://nodejs.org/api/process.html#process_process_hrtime
function hrtime(previousTimestamp){
var clocktime = performanceNow.call(performance)*1e-3;
var seconds = Math.floor(clocktime);
var nanoseconds = Math.floor((clocktime%1)*1e9);
if (previousTimestamp) {
seconds = seconds - previousTimestamp[0];
nanoseconds = nanoseconds - previousTimestamp[1];
if (nanoseconds<0) {
seconds--;
nanoseconds += 1e9;
}
}
return [seconds,nanoseconds]
}
var startTime = new Date();
function uptime() {
var currentTime = new Date();
var dif = currentTime - startTime;
return dif / 1000;
}
var process = {
nextTick: nextTick,
title: title,
browser: browser,
env: env,
argv: argv,
version: version,
versions: versions,
on: on,
addListener: addListener,
once: once,
off: off,
removeListener: removeListener,
removeAllListeners: removeAllListeners,
emit: emit,
binding: binding,
cwd: cwd,
chdir: chdir,
umask: umask,
hrtime: hrtime,
platform: platform,
release: release,
config: config,
uptime: uptime
};
function _interopDefault$1(r){return r&&"object"==typeof r&&"default"in r?r.default:r}function extend(){for(var r={},e=0;e<arguments.length;e++){var t=arguments[e];for(var a in t)hasOwnProperty.call(t,a)&&(r[a]=t[a]);}return r}function createCommonjsModule(r,e){return e={exports:{}},r(e,e.exports),e.exports}function create(r){function e(e){return e&&(e=formatter.apply(null,arguments)),new r(e)}return e.displayName=r.displayName||r.name,e}function matters$1(r){var e,t=[],a=-1;"string"!=typeof r&&"length"in r||(r=[r]),e=r.length;for(;++a<e;)t[a]=matter(r[a]);return t}function matter(r){var e=r;if("string"==typeof e){if(!own.call(markers,e))throw fault("Missing matter definition for `%s`",e);e={type:e,marker:markers[e]};}else if("object"!=typeof e)throw fault("Expected matter to be an object, not `%j`",e);if(!own.call(e,"type"))throw fault("Missing `type` in matter `%j`",e);if(!own.call(e,"marker"))throw fault("Missing `marker` in matter `%j`",e);return e}function create$1(r){function e(e,t,i){var s,l,c,u,p,d;if(t.charAt(0)===a&&t.charAt(1)===a&&t.charAt(2)===a&&t.charAt(3)===n)for(s=o+n,l="",d="",c=3,u=t.length;++c<u;){if((p=t.charAt(c))===a&&(d||!l)&&t.charAt(c+1)===a&&t.charAt(c+2)===a)return!!i||(s+=d+o,e(s)({type:r.type,value:l}));p===n?d+=p:(s+=d+p,l+=d+p,d="");}}var t=r.type+"FrontMatter",a=r.marker,o=a+a+a,n="\n";return e.displayName=t,e.onlyAtStart=!0,[t,e]}function create$2(r){function e(r){return o+(r.value?"\n"+r.value:"")+"\n"+o}var t=r.type,a=r.marker,o=a+a+a;return e.displayName=t+"FrontMatter",[t,e]}function frontmatter(r){var e=this.Parser,t=this.Compiler,a=matters(r||["yaml"]);isRemarkParser(e)&&attachParser(e,a),isRemarkCompiler(t)&&attachCompiler(t,a);}function attachParser(r,e){var t,a=r.prototype,o=wrap(parse$1,e),n=[];for(t in o)n.push(t);a.blockMethods=n.concat(a.blockMethods),a.blockTokenizers=xtend(o,a.blockTokenizers);}function attachCompiler(r,e){var t=r.prototype;t.visitors=xtend(wrap(compile,e),t.visitors);}function wrap(r,e){for(var t,a={},o=e.length,n=-1;++n<o;)a[(t=r(e[n]))[0]]=t[1];return a}function isRemarkParser(r){return Boolean(r&&r.prototype&&r.prototype.blockTokenizers)}function isRemarkCompiler(r){return Boolean(r&&r.prototype&&r.prototype.visitors)}function unherit$1(r){function e(e){return r.apply(this,e)}function t(){return this instanceof t?r.apply(this,arguments):new e(arguments)}var a,o,n;inherits(t,r),inherits(e,t),a=t.prototype;for(o in a)(n=a[o])&&"object"==typeof n&&(a[o]="concat"in n?n.concat():xtend$2(n));return t}function factory(r,e,t){return function(){var a=t||this,o=a[r];return a[r]=!e,function(){a[r]=o;}}}function factory$1(r){var e=indices(String(r));return{toPosition:offsetToPositionFactory(e),toOffset:positionToOffsetFactory(e)}}function offsetToPositionFactory(r){return function(e){var t=-1,a=r.length;if(e<0)return{};for(;++t<a;)if(r[t]>e)return{line:t+1,column:e-(r[t-1]||0)+1,offset:e};return{}}}function positionToOffsetFactory(r){return function(e){var t=e&&e.line,a=e&&e.column;return!isNaN(t)&&!isNaN(a)&&t-1 in r?(r[t-2]||0)+a-1||0:-1}}function indices(r){for(var e=[],t=r.indexOf("\n");-1!==t;)e.push(t+1),t=r.indexOf("\n",t+1);return e.push(r.length+1),e}function factory$2(r,e){return function(t){for(var a,o=0,n=t.indexOf("\\"),i=r[e],s=[];-1!==n;)s.push(t.slice(o,n)),o=n+1,(a=t.charAt(o))&&-1!==i.indexOf(a)||s.push("\\"),n=t.indexOf("\\",o);return s.push(t.slice(o)),s.join("")}}function decimal$1(r){var e="string"==typeof r?r.charCodeAt(0):r;return e>=48&&e<=57}function hexadecimal$1(r){var e="string"==typeof r?r.charCodeAt(0):r;return e>=97&&e<=102||e>=65&&e<=70||e>=48&&e<=57}function alphabetical$1(r){var e="string"==typeof r?r.charCodeAt(0):r;return e>=97&&e<=122||e>=65&&e<=90}function alphanumerical$1(r){return alphabetical(r)||decimal$2(r)}function wrapper(r,e){var t,a,o={};e||(e={});for(a in defaults)t=e[a],o[a]=null===t||void 0===t?defaults[a]:t;return(o.position.indent||o.position.start)&&(o.indent=o.position.indent||[],o.position=o.position.start),parse$5(r,o)}function parse$5(r,e){function t(){return{line:B,column:I,offset:R+(x.offset||0)}}function a(e){return r.charAt(e)}function o(){F&&(P.push(F),$&&$.call(S,F,{start:b,end:t()}),F=EMPTY);}var n,i,s,l,c,u,p,d,f,g,h,m,D,E,b,C,A,w,q=e.additional,v=e.nonTerminated,$=e.text,y=e.reference,L=e.warning,S=e.textContext,T=e.referenceContext,N=e.warningContext,x=e.position,k=e.indent||[],_=r.length,R=0,O=-1,I=x.column||1,B=x.line||1,F=EMPTY,P=[];for(b=t(),p=L?function(r,e){var a=t();a.column+=e,a.offset+=e,L.call(N,MESSAGES[r],a,r);}:noop,R--,_++;++R<_;)if(l===NEWLINE&&(I=k[O]||1),(l=a(R))!==AMPERSAND)l===NEWLINE&&(B++,O++,I=0),l?(F+=l,I++):o();else{if((u=a(R+1))===TAB||u===NEWLINE||u===FORM_FEED||u===SPACE||u===LESS_THAN||u===AMPERSAND||u===EMPTY||q&&u===q){F+=l,I++;continue}for(h=m=R+1,w=m,u!==OCTOTHORP?D=NAMED:(u=a(w=++h))===X_LOWER||u===X_UPPER?(D=HEXADECIMAL,w=++h):D=DECIMAL,n=EMPTY,g=EMPTY,s=EMPTY,E=TESTS[D],w--;++w<_&&(u=a(w),E(u));)s+=u,D===NAMED&&own$1.call(legacy,s)&&(n=s,g=legacy[sLine truncated
return parserMarkdown_1;
}(util,path));
-9
View File
@@ -1,9 +0,0 @@
var parse5 = (function (util,stream) {
util = 'default' in util ? util['default'] : util;
stream = 'default' in stream ? stream['default'] : stream;
function _interopDefault$1(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function createCommonjsModule(e,t){return t={exports:{}},e(t,t.exports),t.exports}function enquoteDoctypeId(e){var t=-1!==e.indexOf('"')?"'":'"';return t+e+t}function hasPrefix(e,t){for(var n=0;n<t.length;n++)if(0===e.indexOf(t[n]))return!0;return!1}function parse(e){const t=index;try{return extendAst((!/^\s*<(!doctype|html|head|body)/i.test(e)?t.parseFragment:t.parse)(e,{treeAdapter:t.treeAdapters.htmlparser2,locationInfo:!0}))}catch(e){throw e}}function extendAst(e){if(!e||!e.children)return e;for(const t of e.children)extendAst(t),t.attribs&&(t.attributes=convertAttribs(t.attribs));return e}function convertAttribs(e){return Object.keys(e).map(t=>({type:"attribute",key:t,value:e[t]}))}var require$$1=_interopDefault$1(require$$0); var require$$0=_interopDefault$1(require$$1); var REPLACEMENT_CHARACTER="�"; var CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533}; var CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],CDATA_END_STRING:[93,93,62],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]}; var unicode={REPLACEMENT_CHARACTER:REPLACEMENT_CHARACTER,CODE_POINTS:CODE_POINTS,CODE_POINT_SEQUENCES:CODE_POINT_SEQUENCES}; var preprocessor=createCommonjsModule(function(e){function t(e,t){return e>=55296&&e<=56319&&t>=56320&&t<=57343}function n(e,t){return 1024*(e-55296)+9216+t}var r=unicode.CODE_POINTS,i=e.exports=function(){this.html=null,this.pos=-1,this.lastGapPos=-1,this.lastCharPos=-1,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536;};i.prototype.dropParsedChunk=function(){this.pos>this.bufferWaterline&&(this.lastCharPos-=this.pos,this.html=this.html.substring(this.pos),this.pos=0,this.lastGapPos=-1,this.gapStack=[]);},i.prototype._addGap=function(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos;},i.prototype._processHighRangeCodePoint=function(e){if(this.pos!==this.lastCharPos){var i=this.html.charCodeAt(this.pos+1);t(e,i)&&(this.pos++,e=n(e,i),this._addGap());}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,r.EOF;return e},i.prototype.write=function(e,t){this.html?this.html+=e:this.html=e,this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1,this.lastChunkWritten=t;},i.prototype.insertHtmlAtCurrentPos=function(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1,this.html.length),this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1;},i.prototype.advance=function(){if(++this.pos>this.lastCharPos)return this.lastChunkWritten||(this.endOfChunkHit=!0),r.EOF;var e=this.html.charCodeAt(this.pos);return this.skipNextNewLine&&e===r.LINE_FEED?(this.skipNextNewLine=!1,this._addGap(),this.advance()):e===r.CARRIAGE_RETURN?(this.skipNextNewLine=!0,r.LINE_FEED):(this.skipNextNewLine=!1,e>=55296?this._processHighRangeCodePoint(e):e)},i.prototype.retreat=function(){this.pos===this.lastGapPos&&(this.lastGapPos=this.gapStack.pop(),this.pos--),this.pos--;};}); var named_entity_data=new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,Line truncated
return parserParse5_1;
}(util,stream));
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-16
View File
@@ -1,16 +0,0 @@
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.toolbox=e()}}(function(){return function e(t,n,r){function o(c,s){if(!n[c]){if(!t[c]){var a="function"==typeof require&&require;if(!s&&a)return a(c,!0);if(i)return i(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[c]={exports:{}};t[c][0].call(f.exports,function(e){var n=t[c][1][e];return o(n?n:e)},f,f.exports,e,t,n,r)}return n[c].exports}for(var i="function"==typeof require&&require,c=0;c<r.length;c++)o(r[c]);return o}({1:[function(e,t,n){"use strict";function r(e,t){t=t||{};var n=t.debug||m.debug;n&&console.log("[sw-toolbox] "+e)}function o(e){var t;return e&&e.cache&&(t=e.cache.name),t=t||m.cache.name,caches.open(t)}function i(e,t){t=t||{};var n=t.successResponses||m.successResponses;return fetch(e.clone()).then(function(r){return"GET"===e.method&&n.test(r.status)&&o(t).then(function(n){n.put(e,r).then(function(){var r=t.cache||m.cache;(r.maxEntries||r.maxAgeSeconds)&&r.name&&c(e,n,r)})}),r.clone()})}function c(e,t,n){var r=s.bind(null,e,t,n);d=d?d.then(r):r()}function s(e,t,n){var o=e.url,i=n.maxAgeSeconds,c=n.maxEntries,s=n.name,a=Date.now();return r("Updating LRU order for "+o+". Max entries is "+c+", max age is "+i),g.getDb(s).then(function(e){return g.setTimestampForUrl(e,o,a)}).then(function(e){return g.expireEntries(e,c,i,a)}).then(function(e){r("Successfully updated IDB.");var n=e.map(function(e){return t.delete(e)});return Promise.all(n).then(function(){r("Done with cache cleanup.")})}).catch(function(e){r(e)})}function a(e,t,n){return r("Renaming cache: ["+e+"] to ["+t+"]",n),caches.delete(t).then(function(){return Promise.all([caches.open(e),caches.open(t)]).then(function(t){var n=t[0],r=t[1];return n.keys().then(function(e){return Promise.all(e.map(function(e){return n.match(e).then(function(t){return r.put(e,t)})}))}).then(function(){return caches.delete(e)})})})}function u(e,t){return o(t).then(function(t){return t.add(e)})}function f(e,t){return o(t).then(function(t){return t.delete(e)})}function h(e){e instanceof Promise||p(e),m.preCacheItems=m.preCacheItems.concat(e)}function p(e){var t=Array.isArray(e);if(t&&e.forEach(function(e){"string"==typeof e||e instanceof Request||(t=!1)}),!t)throw new TypeError("The precache method expects either an array of strings and/or Requests or a Promise that resolves to an array of strings and/or Requests.");return e}function l(e,t,n){if(!e)return!1;if(t){var r=e.headers.get("date");if(r){var o=new Date(r);if(o.getTime()+1e3*t<n)return!1}}return!0}var d,m=e("./options"),g=e("./idb-cache-expiration");t.exports={debug:r,fetchAndCache:i,openCache:o,renameCache:a,cache:u,uncache:f,precache:h,validatePrecacheInput:p,isResponseFresh:l}},{"./idb-cache-expiration":2,"./options":4}],2:[function(e,t,n){"use strict";function r(e){return new Promise(function(t,n){var r=indexedDB.open(u+e,f);r.onupgradeneeded=function(){var e=r.result.createObjectStore(h,{keyPath:p});e.createIndex(l,l,{unique:!1})},r.onsuccess=function(){t(r.result)},r.onerror=function(){n(r.error)}})}function o(e){return e in d||(d[e]=r(e)),d[e]}function i(e,t,n){return new Promise(function(r,o){var i=e.transaction(h,"readwrite"),c=i.objectStore(h);c.put({url:t,timestamp:n}),i.oncomplete=function(){r(e)},i.onabort=function(){o(i.error)}})}function c(e,t,n){return t?new Promise(function(r,o){var i=1e3*t,c=[],s=e.transaction(h,"readwrite"),a=s.objectStore(h),u=a.index(l);u.openCursor().onsuccess=function(e){var t=e.target.result;if(t&&n-i>t.value[l]){var r=t.value[p];c.push(r),a.delete(r),t.continue()}},s.oncomplete=function(){r(c)},s.onabort=o}):Promise.resolve([])}function s(e,t){return t?new Promise(function(n,r){var o=[],i=e.transaction(h,"readwrite"),c=i.objectStore(h),s=c.index(l),a=s.count();s.count().onsuccess=function(){var e=a.result;e>t&&(s.openCursor().onsuccess=function(n){var r=n.target.result;if(r){var i=r.value[p];o.push(i),c.delete(i),e-o.length>t&&r.continue()}})},i.oncomplete=function(){n(o)},i.onabort=r}):Promise.resolve([])}function a(e,t,n,r){return c(e,n,r).then(function(n){return s(e,t).then(function(e){return n.concat(e)})})}var u="sw-toolbox-",f=1,h="store",p="url",l="timestamp",d={};t.exports={getDb:o,setTimestampForUrl:i,expireEntries:a}},{}],3:[function(e,t,n){"use strict";function r(e){var t=a.match(e.request);t?e.respondWith(t(e.request)):a.default&&"GET"===e.request.method&&0===e.request.url.indexOf("http")&&e.respondWith(a.default(e.request))}function o(e){s.debug("activate event fired");var t=u.cache.name+"$$$inactive$$$";e.waitUntil(s.renameCache(t,u.cache.name))}function i(e){return e.reduce(function(e,t){return e.concat(t)},[])}function c(e){var t=u.cache.name+"$$$inactive$$$";s.debug("install event fired"),s.debug("creating cache ["+t+"]"),e.waitUntil(s.opeLine truncated
//# sourceMappingURL=sw-toolbox.js.map
+3
View File
@@ -22,6 +22,9 @@ self.require = function require(path) {
if (path === "stream") {
return { PassThrough() {} };
}
if (path === "./third-party") {
return {};
}
return self[path.replace(/.+-/, "")];
};