拿掉 build files

This commit is contained in:
2022-07-18 16:33:23 +08:00
parent 41e2287bcb
commit 3707f158a3
31953 changed files with 0 additions and 4411796 deletions
-220
View File
@@ -1,220 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.0.2](https://github.com/nuxt/loading-screen/compare/@nuxt/loading-screen@2.0.1...@nuxt/loading-screen@2.0.2) (2020-06-25)
### Bug Fixes
* **module:** set default value for baseURLAlt ([dbd3b29](https://github.com/nuxt/loading-screen/commit/dbd3b29327bf0b856f8364e4a060e4d0f26d38b3))
## [2.0.1](https://github.com/nuxt/loading-screen/compare/@nuxt/loading-screen@2.0.0...@nuxt/loading-screen@2.0.1) (2020-06-24)
### Bug Fixes
* disable altPort by default ([fb344b3](https://github.com/nuxt/loading-screen/commit/fb344b374b7722d998b7bb19ae05428c29ef7a8d))
# 2.0.0 (2020-06-18)
### Bug Fixes
* {STATE} was being interpolated by poi ([69955ff](https://github.com/nuxt/loading-screen/commit/69955ff334fcc25229ab2ad16825e54c52f69a34))
* getPort import ([f04edfe](https://github.com/nuxt/loading-screen/commit/f04edfe413f1c4e2ccb306c727a1c7d0a5a81f1a))
* lazy listen and redirect users directly opening port ([cdb0b04](https://github.com/nuxt/loading-screen/commit/cdb0b042ed069f95aaddcac5af07fe9ea48b5e18))
### Features
* allow customisation with options ([#57](https://github.com/nuxt/loading-screen/issues/57)) ([ee40ac5](https://github.com/nuxt/loading-screen/commit/ee40ac52e5f69c3fbfb5515fcf92975bd6b3a30e)), closes [#43](https://github.com/nuxt/loading-screen/issues/43)
* altPort option and disable for codesandbox ([f176eb3](https://github.com/nuxt/loading-screen/commit/f176eb3abe9cb05711cf75951c9293dce633ae2c))
* listen on new port ([#60](https://github.com/nuxt/loading-screen/issues/60)) ([119a032](https://github.com/nuxt/loading-screen/commit/119a032cc3d3ac17e540aabd093a61d46b9dae81))
* use baseURLAlt only for SSE ([9f27089](https://github.com/nuxt/loading-screen/commit/9f27089933b2cee45d246987393faefe78be71fb))
### BREAKING CHANGES
* no longer adding serverMiddleware
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [1.2.0](https://github.com/nuxt/loading-screen/compare/v1.1.0...v1.2.0) (2019-10-01)
### Bug Fixes
* ensure EventSource is supported in current browser ([ee4b180](https://github.com/nuxt/loading-screen/commit/ee4b180))
* typo in var name ([#47](https://github.com/nuxt/loading-screen/issues/47)) ([e47885a](https://github.com/nuxt/loading-screen/commit/e47885a))
### Features
* show build error ([#45](https://github.com/nuxt/loading-screen/issues/45)) ([9f23404](https://github.com/nuxt/loading-screen/commit/9f23404))
## [1.1.0](https://github.com/nuxt/loading-screen/compare/v1.0.1...v1.1.0) (2019-09-21)
### Features
* prevent endless reloading ([#44](https://github.com/nuxt/loading-screen/issues/44)) ([260dd61](https://github.com/nuxt/loading-screen/commit/260dd61))
### [1.0.1](https://github.com/nuxt/loading-screen/compare/v1.0.0...v1.0.1) (2019-08-20)
### Bug Fixes
* set `Content-Type` of for index page ([#38](https://github.com/nuxt/loading-screen/issues/38)) ([ad9051c](https://github.com/nuxt/loading-screen/commit/ad9051c))
## [1.0.0](https://github.com/nuxt/loading-screen/compare/v0.5.2...v1.0.0) (2019-08-05)
### ⚠ BREAKING CHANGES
* /ws endpoint changed to /sse
### Bug Fixes
* missing underscore in reloading var ([#22](https://github.com/nuxt/loading-screen/issues/22)) ([3295e15](https://github.com/nuxt/loading-screen/commit/3295e15))
### Features
* switch from WebSocket to EventSource ([#34](https://github.com/nuxt/loading-screen/issues/34)) ([68ea10e](https://github.com/nuxt/loading-screen/commit/68ea10e))
## [0.5.2](https://github.com/nuxt/loading-screen/compare/v0.5.1...v0.5.2) (2019-05-01)
### Bug Fixes
* **ws:** wsReconnect timeout ([#16](https://github.com/nuxt/loading-screen/issues/16)) ([27a974d](https://github.com/nuxt/loading-screen/commit/27a974d))
## [0.5.1](https://github.com/nuxt/loading-screen/compare/v0.5.0...v0.5.1) (2019-04-26)
### Bug Fixes
* **style:** make `progress_bar` width responsive ([#14](https://github.com/nuxt/loading-screen/issues/14)) ([a52089a](https://github.com/nuxt/loading-screen/commit/a52089a))
# [0.5.0](https://github.com/nuxt/loading-screen/compare/v0.4.1...v0.5.0) (2019-04-24)
### Features
* always reload ([32b57a8](https://github.com/nuxt/loading-screen/commit/32b57a8))
## [0.4.1](https://github.com/nuxt/loading-screen/compare/v0.4.0...v0.4.1) (2019-04-24)
### Bug Fixes
* _closed guard ([b7f3b3e](https://github.com/nuxt/loading-screen/commit/b7f3b3e))
* use unique top level selector ([4f8811e](https://github.com/nuxt/loading-screen/commit/4f8811e))
* workaround for duplicate instance ([a6dd5a7](https://github.com/nuxt/loading-screen/commit/a6dd5a7))
# [0.4.0](https://github.com/nuxt/loading-screen/compare/v0.3.1...v0.4.0) (2019-04-24)
### Features
* improved `showNuxtApp` ([6fb1fa6](https://github.com/nuxt/loading-screen/commit/6fb1fa6))
## [0.3.1](https://github.com/nuxt/loading-screen/compare/v0.3.0...v0.3.1) (2019-04-24)
### Bug Fixes
* stop requesting before replacing document ([441d3cd](https://github.com/nuxt/loading-screen/commit/441d3cd))
# [0.3.0](https://github.com/nuxt/loading-screen/compare/v0.2.0...v0.3.0) (2019-04-09)
### Features
* improve loading and error handling ([6316379](https://github.com/nuxt/loading-screen/commit/6316379)), closes [#9](https://github.com/nuxt/loading-screen/issues/9)
* support baseURL ([#8](https://github.com/nuxt/loading-screen/issues/8)) ([583012c](https://github.com/nuxt/loading-screen/commit/583012c))
# [0.2.0](https://github.com/nuxt/loading-screen/compare/v0.1.3...v0.2.0) (2019-03-23)
### Features
* fallback to fetch if ws timesout ([#6](https://github.com/nuxt/loading-screen/issues/6)) ([46bd50a](https://github.com/nuxt/loading-screen/commit/46bd50a))
## [0.1.3](https://github.com/nuxt/loading-screen/compare/v0.1.2...v0.1.3) (2019-03-22)
### Bug Fixes
* use wss for https ([#4](https://github.com/nuxt/loading-screen/issues/4)) ([eeb85eb](https://github.com/nuxt/loading-screen/commit/eeb85eb))
## [0.1.2](https://github.com/nuxt/loading-screen/compare/v0.1.1...v0.1.2) (2019-03-20)
### Performance Improvements
* prevent duplicate allDone getter calls ([0cb31cd](https://github.com/nuxt/loading-screen/commit/0cb31cd))
## [0.1.1](https://github.com/nuxt/loading-screen/compare/v0.1.0...v0.1.1) (2019-03-20)
### Performance Improvements
* throttle ws broadcast ([3069cb9](https://github.com/nuxt/loading-screen/commit/3069cb9))
# [0.1.0](https://github.com/nuxt/loading-screen/compare/v0.0.2...v0.1.0) (2019-03-20)
### Bug Fixes
* **app:** don't update wsURL when retry ([c7e0ed0](https://github.com/nuxt/loading-screen/commit/c7e0ed0))
* **app:** Remove logging and don't finish is not bundle is given as first message ([031271d](https://github.com/nuxt/loading-screen/commit/031271d))
* **poi:** set html.template option ([ce72848](https://github.com/nuxt/loading-screen/commit/ce72848))
* correctly handle ws upgrade events on server ([4ba32a2](https://github.com/nuxt/loading-screen/commit/4ba32a2))
### Features
* SSR initial state ([9982c9e](https://github.com/nuxt/loading-screen/commit/9982c9e))
## 0.0.1 (2019-03-16)
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2016-2019 Nuxt.js Team
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.
-32
View File
@@ -1,32 +0,0 @@
## Loading Screen
[![Github Actions CI][github-actions-src]][github-actions-href]
[![Standard JS][standard-js-src]][standard-js-href]
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![package phobia][package-phobia-src]][package-phobia-href]
This module is internally being used by [nuxt.js](https://github.com/nuxt/nuxt.js) to show loading screen.
![nuxt-loading-screen](https://user-images.githubusercontent.com/904724/54605661-12812680-4a4a-11e9-92e0-e7d7ed3a7c66.gif)
## License
MIT - Made with 💖 By Nuxt team!
<!-- Refs -->
[github-actions-src]: https://github.com/nuxt/loading-screen/workflows/ci/badge.svg?branch=master
[github-actions-href]: https://github.com/nuxt/loading-screen/actions?query=workflow%3Aci
[standard-js-src]: https://flat.badgen.net/badge/code%20style/standard/green
[standard-js-href]: https://standardjs.com
[npm-version-src]: https://flat.badgen.net/npm/v/@nuxt/loading-screen/latest
[npm-version-href]: https://npmjs.com/package/@nuxt/loading-screen
[npm-downloads-src]: https://flat.badgen.net/npm/dt/@nuxt/loading-screen
[npm-downloads-href]: https://npmjs.com/package/@nuxt/loading-screen
[package-phobia-src]: https://flat.badgen.net/packagephobia/install/@nuxt/loading-screen
[package-phobia-href]: https://packagephobia.now.sh/result?p=@nuxt/loading-screen
@@ -1 +0,0 @@
@import url(https://fonts.googleapis.com/css?family=Quicksand:400,500);a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.loading-screen{display:flex;flex-flow:column nowrap;justify-content:center;align-content:center;align-items:center;font-family:Quicksand,sans-serif;height:100vh;transition:opacity .4s}.loading-screen.hide{opacity:0}.loading-screen .row{flex:0 0 auto}.logo{margin-bottom:40px}.v-enter-active,.v-leave-active{transition-delay:.5s;transition-property:all;transition-duration:.6s}.v-enter,.v-leave-to{opacity:0;transform:translateY(-10px)}.placeholder{text-align:center}h3{font-weight:500;font-size:18px;color:#383838;margin:1em 0;letter-spacing:1px}.hasErrors{color:#d0021b}.errorStack{padding:1.5em;border:1px solid #108775;border-radius:1em;background-color:#eee;margin:1em 0}p.pre{margin-top:1em;line-height:1.2em;white-space:pre}h4{margin-bottom:30px;font-size:15px;color:#383838}.reload_prevented{width:500px;max-width:85vw}.reload_prevented p{margin-bottom:1rem}.progress_bar_container{background-color:#ddd;border-radius:6px;width:500px;max-width:85vw;height:10px;margin-bottom:10px}.progress_bar{border-radius:6px;height:10px;width:10px;transition:width .4s}.progress_bar.client{background-color:#00c58e}.progress_bar.server{background-color:#108775}.progress_bar.modern{background-color:#2f495e}
@@ -1 +0,0 @@
@import url(https://fonts.googleapis.com/css?family=Quicksand:400,500);a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.loading-screen{display:flex;flex-flow:column nowrap;justify-content:center;align-content:center;align-items:center;font-family:Quicksand,sans-serif;height:100vh;transition:opacity .4s}.loading-screen.hide{opacity:0}.loading-screen .row{flex:0 0 auto}.logo{margin-bottom:40px}.v-enter-active,.v-leave-active{transition-delay:.5s;transition-property:all;transition-duration:.6s}.v-enter,.v-leave-to{opacity:0;transform:translateY(-10px)}.placeholder{text-align:center}h3{font-weight:500;font-size:18px;color:#383838;margin:1em 0;letter-spacing:1px}.hasErrors{color:#d0021b}.errorStack{padding:1.5em;border:1px solid #108775;border-radius:1em;background-color:#eee;margin:1em 0}p.pre{margin-top:1em;line-height:1.2em;white-space:pre}h4{margin-bottom:30px;font-size:15px;color:#383838}.reload_prevented{width:500px;max-width:85vw}.reload_prevented p{margin-bottom:1rem}.progress_bar_container{background-color:#ddd;border-radius:6px;width:500px;max-width:85vw;height:10px;margin-bottom:10px}.progress_bar{border-radius:6px;height:10px;width:10px;transition:width .4s}.progress_bar.client{background-color:#00c58e}.progress_bar.server{background-color:#108775}.progress_bar.modern{background-color:#2f495e}
File diff suppressed because one or more lines are too long
@@ -1,5 +0,0 @@
/*!
* Vue.js v2.6.11
* (c) 2014-2019 Evan You
* Released under the MIT License.
*/
File diff suppressed because one or more lines are too long
@@ -1,5 +0,0 @@
/*!
* Vue.js v2.6.12
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={2:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="__BASE_URL__/";var f=window.webpackJsonp=window.webpackJsonp||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([]);
@@ -1 +0,0 @@
!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={2:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="__BASE_URL__/";var f=window.webpackJsonp=window.webpackJsonp||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([]);
-1
View File
@@ -1 +0,0 @@
<!doctype html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Nuxt.js: Loading app...</title><link href="__BASE_URL__/assets/css/index.28675de3.chunk.css" rel="stylesheet"></head><body><div id="nuxt_loading_screen"></div><script>window.$STATE=__STATE__</script><script>window.$OPTIONS=__OPTIONS__</script><script>!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={2:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="__BASE_URL__/";var f=window.webpackJsonp=window.webpackJsonp||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([])</script><script src="__BASE_URL__/assets/js/chunk-vendors.b9580920.chunk.js"></script><script src="__BASE_URL__/assets/js/index.28675de3.chunk.js"></script></body></html>
-146
View File
@@ -1,146 +0,0 @@
const { resolve } = require('path')
const { readFileSync } = require('fs')
const connect = require('connect')
const serveStatic = require('serve-static')
const getPort = require('get-port-please')
const { json, end, header } = require('node-res')
const { parseStack } = require('./utils')
const SSE = require('./sse')
class LoadingUI {
constructor (options) {
this.options = options
this._lastBroadcast = 0
this.states = []
this.allDone = true
this.hasErrors = false
this.serveIndex = this.serveIndex.bind(this)
this._init()
}
_init () {
// Create a connect middleware stack
this.app = connect()
// Create an SSE handler instance
this.sse = new SSE()
// Fix CORS
this.app.use((req, res, next) => {
res.setHeader('Access-Control-Allow-Origin', '*')
next()
})
// Subscribe to SSR channel
this.app.use('/sse', (req, res) => this.sse.subscribe(req, res))
// Serve state with JSON
this.app.use('/json', (req, res) => json(req, res, this.state))
// Load indexTemplate
const distPath = resolve(__dirname, '../app-dist')
this.indexTemplate = readFileSync(resolve(distPath, 'index.html'), 'utf-8')
// Serve assets
this.app.use('/assets', serveStatic(resolve(distPath, 'assets')))
}
async initAlt ({ url }) {
if (this._server || this.options.baseURLAlt) {
return
}
// Redirect users directly open this port
this.app.use('/', (req, res) => {
res.setHeader('Location', url)
res.statusCode = 307
res.end(url)
})
// Start listening on alternative port
const port = await getPort({ random: true, name: 'nuxt_loading' })
return new Promise((resolve, reject) => {
this._server = this.app.listen(port, (err) => {
if (err) { return reject(err) }
this.options.baseURLAlt = `http://localhost:${port}`
resolve()
})
})
}
close () {
if (this._server) {
return new Promise((resolve, reject) => {
this._server.close((err) => {
if (err) {
return reject(err)
}
resolve()
})
})
}
}
get state () {
return {
error: this.error,
states: this.states,
allDone: this.allDone,
hasErrors: this.hasErrors
}
}
setStates (states) {
this.clearError()
this.states = states
this.allDone = this.states.every(state => state.progress === 0 || state.progress === 100)
this.hasErrors = this.states.some(state => state.hasErrors === true)
this.broadcastState()
}
setError (error) {
this.clearStates(true)
this.error = {
description: error.toString(),
stack: parseStack(error.stack).join('\n')
}
this.broadcastState()
}
clearError () {
this.error = undefined
}
clearStates (hasErrors) {
this.states = []
this.allDone = false
this.hasErrors = !!hasErrors
}
broadcastState () {
const now = new Date()
if ((now - this._lastBroadcast > 500) || this.allDone || this.hasErrors) {
this.sse.broadcast('state', this.state)
this._lastBroadcast = now
}
}
serveIndex (req, res) {
const html = this.indexTemplate
.replace('__STATE__', JSON.stringify(this.state))
.replace('__OPTIONS__', JSON.stringify(this.options))
.replace(/__BASE_URL__/g, this.options.baseURL)
header(res, 'Content-Type', 'text/html')
end(res, html)
}
}
module.exports = LoadingUI
-48
View File
@@ -1,48 +0,0 @@
module.exports = function NuxtLoadingScreen () {
if (!this.options.dev) {
return
}
const defu = require('defu')
const LoadingUI = require('./loading')
const { nuxt } = this
const baseURL = nuxt.options.router.base + '_loading'
const options = this.options.build.loadingScreen = defu(this.options.build.loadingScreen, {
baseURL,
baseURLAlt: baseURL,
altPort: false,
image: undefined,
colors: {}
})
const loading = new LoadingUI(options)
nuxt.options.serverMiddleware.push({
path: '/_loading',
handler: (req, res) => { loading.app(req, res) }
})
if (options.altPort) {
nuxt.hook('listen', async (_, { url }) => {
await loading.initAlt({ url })
})
}
nuxt.hook('close', async () => {
await loading.close()
})
nuxt.hook('bundler:progress', (states) => {
loading.setStates(states)
})
nuxt.hook('cli:buildError', (error) => {
loading.setError(error)
})
nuxt.hook('server:nuxt:renderLoading', (req, res) => {
loading.serveIndex(req, res)
})
}
-43
View File
@@ -1,43 +0,0 @@
const { status, header } = require('node-res')
class SSE {
constructor () {
this.subscriptions = new Set()
this.counter = 0
}
// Subscribe to a channel and set initial headers
subscribe (req, res) {
req.socket.setTimeout(0)
status(res, 200)
header(res, 'Content-Type', 'text/event-stream')
header(res, 'Cache-Control', 'no-cache')
if (req.httpVersion !== '2.0') {
header(res, 'Connection', 'keep-alive')
}
this.subscriptions.add(res)
res.on('close', () => this.subscriptions.delete(res))
this.broadcast('ready', {})
}
// Publish event and data to all connected clients
broadcast (event, data) {
this.counter++
// Do console.log(this.subscriptions.size) to see, if there are any memory leaks
for (const res of this.subscriptions) {
this.clientBroadcast(res, event, data)
}
}
// Publish event and data to a given response object
clientBroadcast (res, event, data) {
res.write(`id: ${this.counter}\n`)
res.write('event: message\n')
res.write(`data: ${JSON.stringify({ event, ...data })}\n\n`)
}
}
module.exports = SSE
-21
View File
@@ -1,21 +0,0 @@
const { sep } = require('path')
// copied from https://github.com/nuxt/consola/blob/master/src/utils/error.js
function parseStack (stack) {
const cwd = process.cwd() + sep
const lines = stack
.split('\n')
.splice(1)
.map(l => l
.trim()
.replace('file://', '')
.replace(cwd, '')
)
return lines
}
module.exports = {
parseStack
}
-17
View File
@@ -1,17 +0,0 @@
import { sep } from 'path'
// copied from https://github.com/nuxt/consola/blob/master/src/utils/error.js
export function parseStack (stack) {
const cwd = process.cwd() + sep
const lines = stack
.split('\n')
.splice(1)
.map(l => l
.trim()
.replace('file://', '')
.replace(cwd, '')
)
return lines
}
View File
-71
View File
@@ -1,71 +0,0 @@
{
"_args": [
[
"@nuxt/loading-screen@2.0.4",
"/home/node/nuxt"
]
],
"_from": "@nuxt/loading-screen@2.0.4",
"_id": "@nuxt/loading-screen@2.0.4",
"_inBundle": false,
"_integrity": "sha512-xpEDAoRu75tLUYCkUJCIvJkWJSuwr8pqomvQ+fkXpSrkxZ/9OzlBFjAbVdOAWTMj4aV/LVQso4vcEdircKeFIQ==",
"_location": "/@nuxt/loading-screen",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@nuxt/loading-screen@2.0.4",
"name": "@nuxt/loading-screen",
"escapedName": "@nuxt%2floading-screen",
"scope": "@nuxt",
"rawSpec": "2.0.4",
"saveSpec": null,
"fetchSpec": "2.0.4"
},
"_requiredBy": [
"/nuxt"
],
"_resolved": "https://registry.npmjs.org/@nuxt/loading-screen/-/loading-screen-2.0.4.tgz",
"_spec": "2.0.4",
"_where": "/home/node/nuxt",
"bugs": {
"url": "https://github.com/nuxt/loading-screen/issues"
},
"dependencies": {
"connect": "^3.7.0",
"defu": "^5.0.0",
"get-port-please": "^2.2.0",
"node-res": "^5.0.1",
"serve-static": "^1.14.1"
},
"description": "[![Github Actions CI][github-actions-src]][github-actions-href] [![Standard JS][standard-js-src]][standard-js-href] [![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![package phobia][package-phobia-src]][package-phobia-href]",
"devDependencies": {
"@nuxtjs/eslint-config": "latest",
"eslint": "latest",
"poi": "latest",
"standard-version": "latest",
"unfetch": "latest",
"vue": "latest",
"vue-template-compiler": "latest"
},
"files": [
"lib",
"app-dist"
],
"homepage": "https://github.com/nuxt/loading-screen#readme",
"license": "MIT",
"main": "lib/module.js",
"name": "@nuxt/loading-screen",
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt/loading-screen.git"
},
"scripts": {
"build": "yarn poi --prod",
"lint": "eslint --ext .vue,.ts,.js .",
"prepack": "yarn build",
"release": "yarn test && standard-version && git push --follow-tags && npm publish",
"test": "yarn lint"
},
"version": "2.0.4"
}