7 Commits

Author SHA1 Message Date
daren.hsu 62966d1eda add 2022-07-21 07:52:14 +00:00
daren.hsu 51b34b0e1d V1 2022-07-21 03:28:35 +00:00
pochangl d7c883d6df build: terminate on error 2022-07-18 11:58:43 +00:00
pochangl 28261fbdea fix: no python error 2022-07-18 11:58:11 +00:00
pochangl 1a9f8199cc feat: node 改成較早的 tag 2022-07-18 18:18:33 +08:00
pochangl 3707f158a3 拿掉 build files 2022-07-18 17:19:47 +08:00
pochangl 41e2287bcb build: 避免 ts 對 lib 進行 type checking 2022-07-18 16:40:39 +08:00
30117 changed files with 4152277 additions and 26 deletions
+199
View File
@@ -0,0 +1,199 @@
import Vue from 'vue'
import { decode, parsePath, withoutBase, withoutTrailingSlash, normalizeURL } from 'ufo'
import { getMatchedComponentsInstances, getChildrenComponentInstancesUsingFetch, promisify, globalHandleError, urlJoin, sanitizeComponent } from './utils'
import NuxtError from '../layouts/error.vue'
import NuxtLoading from './components/nuxt-loading.vue'
import _6f6c098b from '../layouts/default.vue'
const layouts = { "_default": sanitizeComponent(_6f6c098b) }
export default {
render (h, props) {
const loadingEl = h('NuxtLoading', { ref: 'loading' })
const layoutEl = h(this.layout || 'nuxt')
const templateEl = h('div', {
domProps: {
id: '__layout'
},
key: this.layoutName
}, [layoutEl])
const transitionEl = h('transition', {
props: {
name: 'layout',
mode: 'out-in'
},
on: {
beforeEnter (el) {
// Ensure to trigger scroll event after calling scrollBehavior
window.$nuxt.$nextTick(() => {
window.$nuxt.$emit('triggerScroll')
})
}
}
}, [templateEl])
return h('div', {
domProps: {
id: '__nuxt'
}
}, [
loadingEl,
transitionEl
])
},
data: () => ({
isOnline: true,
layout: null,
layoutName: '',
nbFetching: 0
}),
beforeCreate () {
Vue.util.defineReactive(this, 'nuxt', this.$options.nuxt)
},
created () {
// Add this.$nuxt in child instances
this.$root.$options.$nuxt = this
if (process.client) {
// add to window so we can listen when ready
window.$nuxt = this
this.refreshOnlineStatus()
// Setup the listeners
window.addEventListener('online', this.refreshOnlineStatus)
window.addEventListener('offline', this.refreshOnlineStatus)
}
// Add $nuxt.error()
this.error = this.nuxt.error
// Add $nuxt.context
this.context = this.$options.context
},
async mounted () {
this.$loading = this.$refs.loading
},
watch: {
'nuxt.err': 'errorChanged'
},
computed: {
isOffline () {
return !this.isOnline
},
isFetching () {
return this.nbFetching > 0
},
},
methods: {
refreshOnlineStatus () {
if (process.client) {
if (typeof window.navigator.onLine === 'undefined') {
// If the browser doesn't support connection status reports
// assume that we are online because most apps' only react
// when they now that the connection has been interrupted
this.isOnline = true
} else {
this.isOnline = window.navigator.onLine
}
}
},
async refresh () {
const pages = getMatchedComponentsInstances(this.$route)
if (!pages.length) {
return
}
this.$loading.start()
const promises = pages.map((page) => {
const p = []
// Old fetch
if (page.$options.fetch && page.$options.fetch.length) {
p.push(promisify(page.$options.fetch, this.context))
}
if (page.$fetch) {
p.push(page.$fetch())
} else {
// Get all component instance to call $fetch
for (const component of getChildrenComponentInstancesUsingFetch(page.$vnode.componentInstance)) {
p.push(component.$fetch())
}
}
if (page.$options.asyncData) {
p.push(
promisify(page.$options.asyncData, this.context)
.then((newData) => {
for (const key in newData) {
Vue.set(page.$data, key, newData[key])
}
})
)
}
return Promise.all(p)
})
try {
await Promise.all(promises)
} catch (error) {
this.$loading.fail(error)
globalHandleError(error)
this.error(error)
}
this.$loading.finish()
},
errorChanged () {
if (this.nuxt.err) {
if (this.$loading) {
if (this.$loading.fail) {
this.$loading.fail(this.nuxt.err)
}
if (this.$loading.finish) {
this.$loading.finish()
}
}
let errorLayout = (NuxtError.options || NuxtError).layout;
if (typeof errorLayout === 'function') {
errorLayout = errorLayout(this.context)
}
this.setLayout(errorLayout)
}
},
setLayout (layout) {
if (!layout || !layouts['_' + layout]) {
layout = 'default'
}
this.layoutName = layout
this.layout = layouts['_' + layout]
return this.layout
},
loadLayout (layout) {
if (!layout || !layouts['_' + layout]) {
layout = 'default'
}
return Promise.resolve(layouts['_' + layout])
},
},
components: {
NuxtLoading
}
}
+193
View File
@@ -0,0 +1,193 @@
import Axios from 'axios'
import defu from 'defu'
// Axios.prototype cannot be modified
const axiosExtra = {
setBaseURL (baseURL) {
this.defaults.baseURL = baseURL
},
setHeader (name, value, scopes = 'common') {
for (const scope of Array.isArray(scopes) ? scopes : [ scopes ]) {
if (!value) {
delete this.defaults.headers[scope][name];
continue
}
this.defaults.headers[scope][name] = value
}
},
setToken (token, type, scopes = 'common') {
const value = !token ? null : (type ? type + ' ' : '') + token
this.setHeader('Authorization', value, scopes)
},
onRequest(fn) {
this.interceptors.request.use(config => fn(config) || config)
},
onResponse(fn) {
this.interceptors.response.use(response => fn(response) || response)
},
onRequestError(fn) {
this.interceptors.request.use(undefined, error => fn(error) || Promise.reject(error))
},
onResponseError(fn) {
this.interceptors.response.use(undefined, error => fn(error) || Promise.reject(error))
},
onError(fn) {
this.onRequestError(fn)
this.onResponseError(fn)
},
create(options) {
return createAxiosInstance(defu(options, this.defaults))
}
}
// Request helpers ($get, $post, ...)
for (const method of ['request', 'delete', 'get', 'head', 'options', 'post', 'put', 'patch']) {
axiosExtra['$' + method] = function () { return this[method].apply(this, arguments).then(res => res && res.data) }
}
const extendAxiosInstance = axios => {
for (const key in axiosExtra) {
axios[key] = axiosExtra[key].bind(axios)
}
}
const createAxiosInstance = axiosOptions => {
// Create new axios instance
const axios = Axios.create(axiosOptions)
axios.CancelToken = Axios.CancelToken
axios.isCancel = Axios.isCancel
// Extend axios proto
extendAxiosInstance(axios)
// Intercept to apply default headers
axios.onRequest((config) => {
config.headers = { ...axios.defaults.headers.common, ...config.headers }
})
// Setup interceptors
setupProgress(axios)
return axios
}
const setupProgress = (axios) => {
if (process.server) {
return
}
// A noop loading inteterface for when $nuxt is not yet ready
const noopLoading = {
finish: () => { },
start: () => { },
fail: () => { },
set: () => { }
}
const $loading = () => {
const $nuxt = typeof window !== 'undefined' && window['$nuxt']
return ($nuxt && $nuxt.$loading && $nuxt.$loading.set) ? $nuxt.$loading : noopLoading
}
let currentRequests = 0
axios.onRequest(config => {
if (config && config.progress === false) {
return
}
currentRequests++
})
axios.onResponse(response => {
if (response && response.config && response.config.progress === false) {
return
}
currentRequests--
if (currentRequests <= 0) {
currentRequests = 0
$loading().finish()
}
})
axios.onError(error => {
if (error && error.config && error.config.progress === false) {
return
}
currentRequests--
if (Axios.isCancel(error)) {
if (currentRequests <= 0) {
currentRequests = 0
$loading().finish()
}
return
}
$loading().fail()
$loading().finish()
})
const onProgress = e => {
if (!currentRequests || !e.total) {
return
}
const progress = ((e.loaded * 100) / (e.total * currentRequests))
$loading().set(Math.min(100, progress))
}
axios.defaults.onUploadProgress = onProgress
axios.defaults.onDownloadProgress = onProgress
}
export default (ctx, inject) => {
// runtimeConfig
const runtimeConfig = ctx.$config && ctx.$config.axios || {}
// baseURL
const baseURL = process.browser
? (runtimeConfig.browserBaseURL || runtimeConfig.browserBaseUrl || runtimeConfig.baseURL || runtimeConfig.baseUrl || 'http://localhost:3000/')
: (runtimeConfig.baseURL || runtimeConfig.baseUrl || process.env._AXIOS_BASE_URL_ || 'http://localhost:3000/')
// Create fresh objects for all default header scopes
// Axios creates only one which is shared across SSR requests!
// https://github.com/mzabriskie/axios/blob/master/lib/defaults.js
const headers = {
"common": {
"Accept": "application/json, text/plain, */*"
},
"delete": {},
"get": {},
"head": {},
"post": {},
"put": {},
"patch": {}
}
const axiosOptions = {
baseURL,
headers
}
// Proxy SSR request headers headers
if (process.server && ctx.req && ctx.req.headers) {
const reqHeaders = { ...ctx.req.headers }
for (const h of ["accept","cf-connecting-ip","cf-ray","content-length","content-md5","content-type","host","x-forwarded-host","x-forwarded-port","x-forwarded-proto"]) {
delete reqHeaders[h]
}
axiosOptions.headers.common = { ...reqHeaders, ...axiosOptions.headers.common }
}
if (process.server) {
// Don't accept brotli encoding because Node can't parse it
axiosOptions.headers.common['accept-encoding'] = 'gzip, deflate'
}
const axios = createAxiosInstance(axiosOptions)
// Inject axios to the context as $axios
ctx.$axios = axios
inject('axios', axios)
}
+644
View File
@@ -0,0 +1,644 @@
import Vue from 'vue'
import fetch from 'unfetch'
import middleware from './middleware.js'
import {
applyAsyncData,
promisify,
middlewareSeries,
sanitizeComponent,
resolveRouteComponents,
getMatchedComponents,
getMatchedComponentsInstances,
flatMapComponents,
setContext,
getLocation,
compile,
getQueryDiff,
globalHandleError,
isSamePath,
urlJoin
} from './utils.js'
import { createApp, NuxtError } from './index.js'
import fetchMixin from './mixins/fetch.client'
import NuxtLink from './components/nuxt-link.client.js' // should be included after ./index.js
// Fetch mixin
if (!Vue.__nuxt__fetch__mixin__) {
Vue.mixin(fetchMixin)
Vue.__nuxt__fetch__mixin__ = true
}
// Component: <NuxtLink>
Vue.component(NuxtLink.name, NuxtLink)
Vue.component('NLink', NuxtLink)
if (!global.fetch) { global.fetch = fetch }
// Global shared references
let _lastPaths = []
let app
let router
// Try to rehydrate SSR data from window
const NUXT = window.__NUXT__ || {}
const $config = NUXT.config || {}
if ($config._app) {
__webpack_public_path__ = urlJoin($config._app.cdnURL, $config._app.assetsPath)
}
Object.assign(Vue.config, {"silent":true,"performance":false})
const errorHandler = Vue.config.errorHandler || console.error
// Create and mount App
createApp(null, NUXT.config).then(mountApp).catch(errorHandler)
function componentOption (component, key, ...args) {
if (!component || !component.options || !component.options[key]) {
return {}
}
const option = component.options[key]
if (typeof option === 'function') {
return option(...args)
}
return option
}
function mapTransitions (toComponents, to, from) {
const componentTransitions = (component) => {
const transition = componentOption(component, 'transition', to, from) || {}
return (typeof transition === 'string' ? { name: transition } : transition)
}
const fromComponents = from ? getMatchedComponents(from) : []
const maxDepth = Math.max(toComponents.length, fromComponents.length)
const mergedTransitions = []
for (let i=0; i<maxDepth; i++) {
// Clone original objects to prevent overrides
const toTransitions = Object.assign({}, componentTransitions(toComponents[i]))
const transitions = Object.assign({}, componentTransitions(fromComponents[i]))
// Combine transitions & prefer `leave` properties of "from" route
Object.keys(toTransitions)
.filter(key => typeof toTransitions[key] !== 'undefined' && !key.toLowerCase().includes('leave'))
.forEach((key) => { transitions[key] = toTransitions[key] })
mergedTransitions.push(transitions)
}
return mergedTransitions
}
async function loadAsyncComponents (to, from, next) {
// Check if route changed (this._routeChanged), only if the page is not an error (for validate())
this._routeChanged = Boolean(app.nuxt.err) || from.name !== to.name
this._paramChanged = !this._routeChanged && from.path !== to.path
this._queryChanged = !this._paramChanged && from.fullPath !== to.fullPath
this._diffQuery = (this._queryChanged ? getQueryDiff(to.query, from.query) : [])
if ((this._routeChanged || this._paramChanged) && this.$loading.start && !this.$loading.manual) {
this.$loading.start()
}
try {
if (this._queryChanged) {
const Components = await resolveRouteComponents(
to,
(Component, instance) => ({ Component, instance })
)
// Add a marker on each component that it needs to refresh or not
const startLoader = Components.some(({ Component, instance }) => {
const watchQuery = Component.options.watchQuery
if (watchQuery === true) {
return true
}
if (Array.isArray(watchQuery)) {
return watchQuery.some(key => this._diffQuery[key])
}
if (typeof watchQuery === 'function') {
return watchQuery.apply(instance, [to.query, from.query])
}
return false
})
if (startLoader && this.$loading.start && !this.$loading.manual) {
this.$loading.start()
}
}
// Call next()
next()
} catch (error) {
const err = error || {}
const statusCode = err.statusCode || err.status || (err.response && err.response.status) || 500
const message = err.message || ''
// Handle chunk loading errors
// This may be due to a new deployment or a network problem
if (/^Loading( CSS)? chunk (\d)+ failed\./.test(message)) {
window.location.reload(true /* skip cache */)
return // prevent error page blinking for user
}
this.error({ statusCode, message })
this.$nuxt.$emit('routeChanged', to, from, err)
next()
}
}
function applySSRData (Component, ssrData) {
if (NUXT.serverRendered && ssrData) {
applyAsyncData(Component, ssrData)
}
Component._Ctor = Component
return Component
}
// Get matched components
function resolveComponents (route) {
return flatMapComponents(route, async (Component, _, match, key, index) => {
// If component is not resolved yet, resolve it
if (typeof Component === 'function' && !Component.options) {
Component = await Component()
}
// Sanitize it and save it
const _Component = applySSRData(sanitizeComponent(Component), NUXT.data ? NUXT.data[index] : null)
match.components[key] = _Component
return _Component
})
}
function callMiddleware (Components, context, layout) {
let midd = []
let unknownMiddleware = false
// If layout is undefined, only call global middleware
if (typeof layout !== 'undefined') {
midd = [] // Exclude global middleware if layout defined (already called before)
layout = sanitizeComponent(layout)
if (layout.options.middleware) {
midd = midd.concat(layout.options.middleware)
}
Components.forEach((Component) => {
if (Component.options.middleware) {
midd = midd.concat(Component.options.middleware)
}
})
}
midd = midd.map((name) => {
if (typeof name === 'function') {
return name
}
if (typeof middleware[name] !== 'function') {
unknownMiddleware = true
this.error({ statusCode: 500, message: 'Unknown middleware ' + name })
}
return middleware[name]
})
if (unknownMiddleware) {
return
}
return middlewareSeries(midd, context)
}
async function render (to, from, next) {
if (this._routeChanged === false && this._paramChanged === false && this._queryChanged === false) {
return next()
}
// Handle first render on SPA mode
let spaFallback = false
if (to === from) {
_lastPaths = []
spaFallback = true
} else {
const fromMatches = []
_lastPaths = getMatchedComponents(from, fromMatches).map((Component, i) => {
return compile(from.matched[fromMatches[i]].path)(from.params)
})
}
// nextCalled is true when redirected
let nextCalled = false
const _next = (path) => {
if (from.path === path.path && this.$loading.finish) {
this.$loading.finish()
}
if (from.path !== path.path && this.$loading.pause) {
this.$loading.pause()
}
if (nextCalled) {
return
}
nextCalled = true
next(path)
}
// Update context
await setContext(app, {
route: to,
from,
next: _next.bind(this)
})
this._dateLastError = app.nuxt.dateErr
this._hadError = Boolean(app.nuxt.err)
// Get route's matched components
const matches = []
const Components = getMatchedComponents(to, matches)
// If no Components matched, generate 404
if (!Components.length) {
// Default layout
await callMiddleware.call(this, Components, app.context)
if (nextCalled) {
return
}
// Load layout for error page
const errorLayout = (NuxtError.options || NuxtError).layout
const layout = await this.loadLayout(
typeof errorLayout === 'function'
? errorLayout.call(NuxtError, app.context)
: errorLayout
)
await callMiddleware.call(this, Components, app.context, layout)
if (nextCalled) {
return
}
// Show error page
app.context.error({ statusCode: 404, message: 'This page could not be found' })
return next()
}
// Update ._data and other properties if hot reloaded
Components.forEach((Component) => {
if (Component._Ctor && Component._Ctor.options) {
Component.options.asyncData = Component._Ctor.options.asyncData
Component.options.fetch = Component._Ctor.options.fetch
}
})
// Apply transitions
this.setTransitions(mapTransitions(Components, to, from))
try {
// Call middleware
await callMiddleware.call(this, Components, app.context)
if (nextCalled) {
return
}
if (app.context._errored) {
return next()
}
// Set layout
let layout = Components[0].options.layout
if (typeof layout === 'function') {
layout = layout(app.context)
}
layout = await this.loadLayout(layout)
// Call middleware for layout
await callMiddleware.call(this, Components, app.context, layout)
if (nextCalled) {
return
}
if (app.context._errored) {
return next()
}
// Call .validate()
let isValid = true
try {
for (const Component of Components) {
if (typeof Component.options.validate !== 'function') {
continue
}
isValid = await Component.options.validate(app.context)
if (!isValid) {
break
}
}
} catch (validationError) {
// ...If .validate() threw an error
this.error({
statusCode: validationError.statusCode || '500',
message: validationError.message
})
return next()
}
// ...If .validate() returned false
if (!isValid) {
this.error({ statusCode: 404, message: 'This page could not be found' })
return next()
}
let instances
// Call asyncData & fetch hooks on components matched by the route.
await Promise.all(Components.map(async (Component, i) => {
// Check if only children route changed
Component._path = compile(to.matched[matches[i]].path)(to.params)
Component._dataRefresh = false
const childPathChanged = Component._path !== _lastPaths[i]
// Refresh component (call asyncData & fetch) when:
// Route path changed part includes current component
// Or route param changed part includes current component and watchParam is not `false`
// Or route query is changed and watchQuery returns `true`
if (this._routeChanged && childPathChanged) {
Component._dataRefresh = true
} else if (this._paramChanged && childPathChanged) {
const watchParam = Component.options.watchParam
Component._dataRefresh = watchParam !== false
} else if (this._queryChanged) {
const watchQuery = Component.options.watchQuery
if (watchQuery === true) {
Component._dataRefresh = true
} else if (Array.isArray(watchQuery)) {
Component._dataRefresh = watchQuery.some(key => this._diffQuery[key])
} else if (typeof watchQuery === 'function') {
if (!instances) {
instances = getMatchedComponentsInstances(to)
}
Component._dataRefresh = watchQuery.apply(instances[i], [to.query, from.query])
}
}
if (!this._hadError && this._isMounted && !Component._dataRefresh) {
return
}
const promises = []
const hasAsyncData = (
Component.options.asyncData &&
typeof Component.options.asyncData === 'function'
)
const hasFetch = Boolean(Component.options.fetch) && Component.options.fetch.length
const loadingIncrease = (hasAsyncData && hasFetch) ? 30 : 45
// Call asyncData(context)
if (hasAsyncData) {
const promise = promisify(Component.options.asyncData, app.context)
promise.then((asyncDataResult) => {
applyAsyncData(Component, asyncDataResult)
if (this.$loading.increase) {
this.$loading.increase(loadingIncrease)
}
})
promises.push(promise)
}
// Check disabled page loading
this.$loading.manual = Component.options.loading === false
// Call fetch(context)
if (hasFetch) {
let p = Component.options.fetch(app.context)
if (!p || (!(p instanceof Promise) && (typeof p.then !== 'function'))) {
p = Promise.resolve(p)
}
p.then((fetchResult) => {
if (this.$loading.increase) {
this.$loading.increase(loadingIncrease)
}
})
promises.push(p)
}
return Promise.all(promises)
}))
// If not redirected
if (!nextCalled) {
if (this.$loading.finish && !this.$loading.manual) {
this.$loading.finish()
}
next()
}
} catch (err) {
const error = err || {}
if (error.message === 'ERR_REDIRECT') {
return this.$nuxt.$emit('routeChanged', to, from, error)
}
_lastPaths = []
globalHandleError(error)
// Load error layout
let layout = (NuxtError.options || NuxtError).layout
if (typeof layout === 'function') {
layout = layout(app.context)
}
await this.loadLayout(layout)
this.error(error)
this.$nuxt.$emit('routeChanged', to, from, error)
next()
}
}
// Fix components format in matched, it's due to code-splitting of vue-router
function normalizeComponents (to, ___) {
flatMapComponents(to, (Component, _, match, key) => {
if (typeof Component === 'object' && !Component.options) {
// Updated via vue-router resolveAsyncComponents()
Component = Vue.extend(Component)
Component._Ctor = Component
match.components[key] = Component
}
return Component
})
}
function setLayoutForNextPage (to) {
// Set layout
let hasError = Boolean(this.$options.nuxt.err)
if (this._hadError && this._dateLastError === this.$options.nuxt.dateErr) {
hasError = false
}
let layout = hasError
? (NuxtError.options || NuxtError).layout
: to.matched[0].components.default.options.layout
if (typeof layout === 'function') {
layout = layout(app.context)
}
this.setLayout(layout)
}
function checkForErrors (app) {
// Hide error component if no error
if (app._hadError && app._dateLastError === app.$options.nuxt.dateErr) {
app.error()
}
}
// When navigating on a different route but the same component is used, Vue.js
// Will not update the instance data, so we have to update $data ourselves
function fixPrepatch (to, ___) {
if (this._routeChanged === false && this._paramChanged === false && this._queryChanged === false) {
return
}
const instances = getMatchedComponentsInstances(to)
const Components = getMatchedComponents(to)
let triggerScroll = false
Vue.nextTick(() => {
instances.forEach((instance, i) => {
if (!instance || instance._isDestroyed) {
return
}
if (
instance.constructor._dataRefresh &&
Components[i] === instance.constructor &&
instance.$vnode.data.keepAlive !== true &&
typeof instance.constructor.options.data === 'function'
) {
const newData = instance.constructor.options.data.call(instance)
for (const key in newData) {
Vue.set(instance.$data, key, newData[key])
}
triggerScroll = true
}
})
if (triggerScroll) {
// Ensure to trigger scroll event after calling scrollBehavior
window.$nuxt.$nextTick(() => {
window.$nuxt.$emit('triggerScroll')
})
}
checkForErrors(this)
})
}
function nuxtReady (_app) {
window.onNuxtReadyCbs.forEach((cb) => {
if (typeof cb === 'function') {
cb(_app)
}
})
// Special JSDOM
if (typeof window._onNuxtLoaded === 'function') {
window._onNuxtLoaded(_app)
}
// Add router hooks
router.afterEach((to, from) => {
// Wait for fixPrepatch + $data updates
Vue.nextTick(() => _app.$nuxt.$emit('routeChanged', to, from))
})
}
async function mountApp (__app) {
// Set global variables
app = __app.app
router = __app.router
// Create Vue instance
const _app = new Vue(app)
// Load layout
const layout = NUXT.layout || 'default'
await _app.loadLayout(layout)
_app.setLayout(layout)
// Mounts Vue app to DOM element
const mount = () => {
_app.$mount('#__nuxt')
// Add afterEach router hooks
router.afterEach(normalizeComponents)
router.afterEach(setLayoutForNextPage.bind(_app))
router.afterEach(fixPrepatch.bind(_app))
// Listen for first Vue update
Vue.nextTick(() => {
// Call window.{{globals.readyCallback}} callbacks
nuxtReady(_app)
})
}
// Resolve route components
const Components = await Promise.all(resolveComponents(app.context.route))
// Enable transitions
_app.setTransitions = _app.$options.nuxt.setTransitions.bind(_app)
if (Components.length) {
_app.setTransitions(mapTransitions(Components, router.currentRoute))
_lastPaths = router.currentRoute.matched.map(route => compile(route.path)(router.currentRoute.params))
}
// Initialize error handler
_app.$loading = {} // To avoid error while _app.$nuxt does not exist
if (NUXT.error) {
_app.error(NUXT.error)
}
// Add beforeEach router hooks
router.beforeEach(loadAsyncComponents.bind(_app))
router.beforeEach(render.bind(_app))
// Fix in static: remove trailing slash to force hydration
// Full static, if server-rendered: hydrate, to allow custom redirect to generated page
// Fix in static: remove trailing slash to force hydration
if (NUXT.serverRendered && isSamePath(NUXT.routePath, _app.context.route.path)) {
return mount()
}
// First render on client-side
const clientFirstMount = () => {
normalizeComponents(router.currentRoute, router.currentRoute)
setLayoutForNextPage.call(_app, router.currentRoute)
checkForErrors(_app)
// Don't call fixPrepatch.call(_app, router.currentRoute, router.currentRoute) since it's first render
mount()
}
// fix: force next tick to avoid having same timestamp when an error happen on spa fallback
await new Promise(resolve => setTimeout(resolve, 0))
render.call(_app, router.currentRoute, router.currentRoute, (path) => {
// If not redirected
if (!path) {
clientFirstMount()
return
}
// Add a one-time afterEach hook to
// mount the app wait for redirect and route gets resolved
const unregisterHook = router.afterEach((to, from) => {
unregisterHook()
clientFirstMount()
})
// Push the path and let route to be resolved
router.push(path, undefined, (err) => {
if (err) {
errorHandler(err)
}
})
})
}
+32
View File
@@ -0,0 +1,32 @@
// nuxt/nuxt.js#8607
function wrapFunctional(options) {
if (!options || !options.functional) {
return options
}
const propKeys = Array.isArray(options.props) ? options.props : Object.keys(options.props || {})
return {
render(h) {
const attrs = {}
const props = {}
for (const key in this.$attrs) {
if (propKeys.includes(key)) {
props[key] = this.$attrs[key]
} else {
attrs[key] = this.$attrs[key]
}
}
return h(options, {
on: this.$listeners,
attrs,
props,
scopedSlots: this.$scopedSlots,
}, this.$slots.default)
}
}
}
+122
View File
@@ -0,0 +1,122 @@
export default {
name: 'NuxtChild',
functional: true,
props: {
nuxtChildKey: {
type: String,
default: ''
},
keepAlive: Boolean,
keepAliveProps: {
type: Object,
default: undefined
}
},
render (_, { parent, data, props }) {
const h = parent.$createElement
data.nuxtChild = true
const _parent = parent
const transitions = parent.$nuxt.nuxt.transitions
const defaultTransition = parent.$nuxt.nuxt.defaultTransition
let depth = 0
while (parent) {
if (parent.$vnode && parent.$vnode.data.nuxtChild) {
depth++
}
parent = parent.$parent
}
data.nuxtChildDepth = depth
const transition = transitions[depth] || defaultTransition
const transitionProps = {}
transitionsKeys.forEach((key) => {
if (typeof transition[key] !== 'undefined') {
transitionProps[key] = transition[key]
}
})
const listeners = {}
listenersKeys.forEach((key) => {
if (typeof transition[key] === 'function') {
listeners[key] = transition[key].bind(_parent)
}
})
if (process.client) {
// Add triggerScroll event on beforeEnter (fix #1376)
const beforeEnter = listeners.beforeEnter
listeners.beforeEnter = (el) => {
// Ensure to trigger scroll event after calling scrollBehavior
window.$nuxt.$nextTick(() => {
window.$nuxt.$emit('triggerScroll')
})
if (beforeEnter) {
return beforeEnter.call(_parent, el)
}
}
}
// make sure that leave is called asynchronous (fix #5703)
if (transition.css === false) {
const leave = listeners.leave
// only add leave listener when user didnt provide one
// or when it misses the done argument
if (!leave || leave.length < 2) {
listeners.leave = (el, done) => {
if (leave) {
leave.call(_parent, el)
}
_parent.$nextTick(done)
}
}
}
let routerView = h('routerView', data)
if (props.keepAlive) {
routerView = h('keep-alive', { props: props.keepAliveProps }, [routerView])
}
return h('transition', {
props: transitionProps,
on: listeners
}, [routerView])
}
}
const transitionsKeys = [
'name',
'mode',
'appear',
'css',
'type',
'duration',
'enterClass',
'leaveClass',
'appearClass',
'enterActiveClass',
'enterActiveClass',
'leaveActiveClass',
'appearActiveClass',
'enterToClass',
'leaveToClass',
'appearToClass'
]
const listenersKeys = [
'beforeEnter',
'enter',
'afterEnter',
'enterCancelled',
'beforeLeave',
'leave',
'afterLeave',
'leaveCancelled',
'beforeAppear',
'appear',
'afterAppear',
'appearCancelled'
]
+96
View File
@@ -0,0 +1,96 @@
<template>
<div class="__nuxt-error-page">
<div class="error">
<svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" fill="#DBE1EC" viewBox="0 0 48 48">
<path d="M22 30h4v4h-4zm0-16h4v12h-4zm1.99-10C12.94 4 4 12.95 4 24s8.94 20 19.99 20S44 35.05 44 24 35.04 4 23.99 4zM24 40c-8.84 0-16-7.16-16-16S15.16 8 24 8s16 7.16 16 16-7.16 16-16 16z" />
</svg>
<div class="title">{{ message }}</div>
<p v-if="statusCode === 404" class="description">
<a v-if="typeof $route === 'undefined'" class="error-link" href="/"></a>
<NuxtLink v-else class="error-link" to="/">Back to the home page</NuxtLink>
</p>
<div class="logo">
<a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt</a>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'NuxtError',
props: {
error: {
type: Object,
default: null
}
},
computed: {
statusCode () {
return (this.error && this.error.statusCode) || 500
},
message () {
return this.error.message || 'Error'
}
},
head () {
return {
title: this.message,
meta: [
{
name: 'viewport',
content: 'width=device-width,initial-scale=1.0,minimum-scale=1.0'
}
]
}
}
}
</script>
<style>
.__nuxt-error-page {
padding: 1rem;
background: #F7F8FB;
color: #47494E;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-family: sans-serif;
font-weight: 100 !important;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.__nuxt-error-page .error {
max-width: 450px;
}
.__nuxt-error-page .title {
font-size: 1.5rem;
margin-top: 15px;
color: #47494E;
margin-bottom: 8px;
}
.__nuxt-error-page .description {
color: #7F828B;
line-height: 21px;
margin-bottom: 10px;
}
.__nuxt-error-page a {
color: #7F828B !important;
text-decoration: none;
}
.__nuxt-error-page .logo {
position: fixed;
left: 12px;
bottom: 12px;
}
</style>
+98
View File
@@ -0,0 +1,98 @@
import Vue from 'vue'
const requestIdleCallback = window.requestIdleCallback ||
function (cb) {
const start = Date.now()
return setTimeout(function () {
cb({
didTimeout: false,
timeRemaining: () => Math.max(0, 50 - (Date.now() - start))
})
}, 1)
}
const cancelIdleCallback = window.cancelIdleCallback || function (id) {
clearTimeout(id)
}
const observer = window.IntersectionObserver && new window.IntersectionObserver((entries) => {
entries.forEach(({ intersectionRatio, target: link }) => {
if (intersectionRatio <= 0 || !link.__prefetch) {
return
}
link.__prefetch()
})
})
export default {
name: 'NuxtLink',
extends: Vue.component('RouterLink'),
props: {
prefetch: {
type: Boolean,
default: true
},
noPrefetch: {
type: Boolean,
default: false
}
},
mounted () {
if (this.prefetch && !this.noPrefetch) {
this.handleId = requestIdleCallback(this.observe, { timeout: 2e3 })
}
},
beforeDestroy () {
cancelIdleCallback(this.handleId)
if (this.__observed) {
observer.unobserve(this.$el)
delete this.$el.__prefetch
}
},
methods: {
observe () {
// If no IntersectionObserver, avoid prefetching
if (!observer) {
return
}
// Add to observer
if (this.shouldPrefetch()) {
this.$el.__prefetch = this.prefetchLink.bind(this)
observer.observe(this.$el)
this.__observed = true
}
},
shouldPrefetch () {
return this.getPrefetchComponents().length > 0
},
canPrefetch () {
const conn = navigator.connection
const hasBadConnection = this.$nuxt.isOffline || (conn && ((conn.effectiveType || '').includes('2g') || conn.saveData))
return !hasBadConnection
},
getPrefetchComponents () {
const ref = this.$router.resolve(this.to, this.$route, this.append)
const Components = ref.resolved.matched.map(r => r.components.default)
return Components.filter(Component => typeof Component === 'function' && !Component.options && !Component.__prefetched)
},
prefetchLink () {
if (!this.canPrefetch()) {
return
}
// Stop observing this link (in case of internet connection changes)
observer.unobserve(this.$el)
const Components = this.getPrefetchComponents()
for (const Component of Components) {
const componentOrPromise = Component()
if (componentOrPromise instanceof Promise) {
componentOrPromise.catch(() => {})
}
Component.__prefetched = true
}
}
}
}
+16
View File
@@ -0,0 +1,16 @@
import Vue from 'vue'
export default {
name: 'NuxtLink',
extends: Vue.component('RouterLink'),
props: {
prefetch: {
type: Boolean,
default: true
},
noPrefetch: {
type: Boolean,
default: false
}
}
}
+177
View File
@@ -0,0 +1,177 @@
<script>
export default {
name: 'NuxtLoading',
data () {
return {
percent: 0,
show: false,
canSucceed: true,
reversed: false,
skipTimerCount: 0,
rtl: false,
throttle: 200,
duration: 5000,
continuous: false
}
},
computed: {
left () {
if (!this.continuous && !this.rtl) {
return false
}
return this.rtl
? (this.reversed ? '0px' : 'auto')
: (!this.reversed ? '0px' : 'auto')
}
},
beforeDestroy () {
this.clear()
},
methods: {
clear () {
clearInterval(this._timer)
clearTimeout(this._throttle)
this._timer = null
},
start () {
this.clear()
this.percent = 0
this.reversed = false
this.skipTimerCount = 0
this.canSucceed = true
if (this.throttle) {
this._throttle = setTimeout(() => this.startTimer(), this.throttle)
} else {
this.startTimer()
}
return this
},
set (num) {
this.show = true
this.canSucceed = true
this.percent = Math.min(100, Math.max(0, Math.floor(num)))
return this
},
get () {
return this.percent
},
increase (num) {
this.percent = Math.min(100, Math.floor(this.percent + num))
return this
},
decrease (num) {
this.percent = Math.max(0, Math.floor(this.percent - num))
return this
},
pause () {
clearInterval(this._timer)
return this
},
resume () {
this.startTimer()
return this
},
finish () {
this.percent = this.reversed ? 0 : 100
this.hide()
return this
},
hide () {
this.clear()
setTimeout(() => {
this.show = false
this.$nextTick(() => {
this.percent = 0
this.reversed = false
})
}, 500)
return this
},
fail (error) {
this.canSucceed = false
return this
},
startTimer () {
if (!this.show) {
this.show = true
}
if (typeof this._cut === 'undefined') {
this._cut = 10000 / Math.floor(this.duration)
}
this._timer = setInterval(() => {
/**
* When reversing direction skip one timers
* so 0, 100 are displayed for two iterations
* also disable css width transitioning
* which otherwise interferes and shows
* a jojo effect
*/
if (this.skipTimerCount > 0) {
this.skipTimerCount--
return
}
if (this.reversed) {
this.decrease(this._cut)
} else {
this.increase(this._cut)
}
if (this.continuous) {
if (this.percent >= 100) {
this.skipTimerCount = 1
this.reversed = !this.reversed
} else if (this.percent <= 0) {
this.skipTimerCount = 1
this.reversed = !this.reversed
}
}
}, 100)
}
},
render (h) {
let el = h(false)
if (this.show) {
el = h('div', {
staticClass: 'nuxt-progress',
class: {
'nuxt-progress-notransition': this.skipTimerCount > 0,
'nuxt-progress-failed': !this.canSucceed
},
style: {
width: this.percent + '%',
left: this.left
}
})
}
return el
}
}
</script>
<style>
.nuxt-progress {
position: fixed;
top: 0px;
left: 0px;
right: 0px;
height: 2px;
width: 0%;
opacity: 1;
transition: width 0.1s, opacity 0.4s;
background-color: black;
z-index: 999999;
}
.nuxt-progress.nuxt-progress-notransition {
transition: none;
}
.nuxt-progress-failed {
background-color: red;
}
</style>
+101
View File
@@ -0,0 +1,101 @@
import Vue from 'vue'
import { compile } from '../utils'
import NuxtError from '../../layouts/error.vue'
import NuxtChild from './nuxt-child'
export default {
name: 'Nuxt',
components: {
NuxtChild,
NuxtError
},
props: {
nuxtChildKey: {
type: String,
default: undefined
},
keepAlive: Boolean,
keepAliveProps: {
type: Object,
default: undefined
},
name: {
type: String,
default: 'default'
}
},
errorCaptured (error) {
// if we receive and error while showing the NuxtError component
// capture the error and force an immediate update so we re-render
// without the NuxtError component
if (this.displayingNuxtError) {
this.errorFromNuxtError = error
this.$forceUpdate()
}
},
computed: {
routerViewKey () {
// If nuxtChildKey prop is given or current route has children
if (typeof this.nuxtChildKey !== 'undefined' || this.$route.matched.length > 1) {
return this.nuxtChildKey || compile(this.$route.matched[0].path)(this.$route.params)
}
const [matchedRoute] = this.$route.matched
if (!matchedRoute) {
return this.$route.path
}
const Component = matchedRoute.components.default
if (Component && Component.options) {
const { options } = Component
if (options.key) {
return (typeof options.key === 'function' ? options.key(this.$route) : options.key)
}
}
const strict = /\/$/.test(matchedRoute.path)
return strict ? this.$route.path : this.$route.path.replace(/\/$/, '')
}
},
beforeCreate () {
Vue.util.defineReactive(this, 'nuxt', this.$root.$options.nuxt)
},
render (h) {
// if there is no error
if (!this.nuxt.err) {
// Directly return nuxt child
return h('NuxtChild', {
key: this.routerViewKey,
props: this.$props
})
}
// if an error occurred within NuxtError show a simple
// error message instead to prevent looping
if (this.errorFromNuxtError) {
this.$nextTick(() => (this.errorFromNuxtError = false))
return h('div', {}, [
h('h2', 'An error occurred while showing the error page'),
h('p', 'Unfortunately an error occurred and while showing the error page another error occurred'),
h('p', `Error details: ${this.errorFromNuxtError.toString()}`),
h('nuxt-link', { props: { to: '/' } }, 'Go back to home')
])
}
// track if we are showing the NuxtError component
this.displayingNuxtError = true
this.$nextTick(() => (this.displayingNuxtError = false))
return h(NuxtError, {
props: {
error: this.nuxt.err
}
})
}
}
+7
View File
@@ -0,0 +1,7 @@
import Vue from 'vue'
import * as components from './index'
for (const name in components) {
Vue.component(name, components[name])
Vue.component('Lazy' + name, components[name])
}
+7
View File
@@ -0,0 +1,7 @@
# Discovered Components
This is an auto-generated list of components discovered by [nuxt/components](https://github.com/nuxt/components).
You can directly use them in pages and other components without the need to import them.
**Tip:** If a component is conditionally rendered with `v-if` and is big, it is better to use `Lazy` or `lazy-` prefix to lazy load.
+1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
!function(e){function r(data){for(var r,n,l=data[0],f=data[1],d=data[2],i=0,h=[];i<l.length;i++)n=l[i],Object.prototype.hasOwnProperty.call(o,n)&&o[n]&&h.push(o[n][0]),o[n]=0;for(r in f)Object.prototype.hasOwnProperty.call(f,r)&&(e[r]=f[r]);for(v&&v(data);h.length;)h.shift()();return c.push.apply(c,d||[]),t()}function t(){for(var e,i=0;i<c.length;i++){for(var r=c[i],t=!0,n=1;n<r.length;n++){var f=r[n];0!==o[f]&&(t=!1)}t&&(c.splice(i--,1),e=l(l.s=r[0]))}return e}var n={},o={7:0},c=[];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.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var c,script=document.createElement("script");script.charset="utf-8",script.timeout=120,l.nc&&script.setAttribute("nonce",l.nc),script.src=function(e){return l.p+""+{2:"563a13c",3:"11860e9",4:"16e58e7",5:"63b0410",6:"59320a7",9:"99edc97"}[e]+".js"}(e);var f=new Error;c=function(r){script.onerror=script.onload=null,clearTimeout(d);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+c+")",f.name="ChunkLoadError",f.type=n,f.request=c,t[1](f)}o[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:script})}),12e4);script.onerror=script.onload=c,document.head.appendChild(script)}return Promise.all(r)},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(object,e){return Object.prototype.hasOwnProperty.call(object,e)},l.p="/_nuxt/",l.oe=function(e){throw console.error(e),e};var f=window.webpackJsonp=window.webpackJsonp||[],d=f.push.bind(f);f.push=r,f=f.slice();for(var i=0;i<f.length;i++)r(f[i]);var v=d;t()}([]);
+1
View File
@@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{301:function(e,r,t){"use strict";t.r(r);var n=t(15);t(65),t(32);r.default={middleware:function(e){return Object(n.a)(regeneratorRuntime.mark((function r(){var t,n,c,o,d,w;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=e.req,n=e.res,e.error,c=e.$axios,e.redirect,o=new URL(t.url,"https://".concat(t.headers.host)),d=o.searchParams.get("LINEUserID")||"",r.next=5,c.get("https://api.contree.io/profile",{params:{LINEUserID:d}});case 5:return w=r.sent,r.next=8,n.setHeader("Content-Type","application/json; charset=utf-8");case 8:n.end(JSON.stringify(w.data.slice(-1)));case 9:case"end":return r.stop()}}),r)})))()}}}}]);
+1
View File
@@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{300:function(e,r,t){"use strict";t.r(r);var n=t(15);t(65),t(32);r.default={middleware:function(e){return Object(n.a)(regeneratorRuntime.mark((function r(){var t,n,c,o,d,w;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=e.req,n=e.res,e.error,c=e.$axios,e.redirect,o=new URL(t.url,"https://".concat(t.headers.host)),d=o.searchParams.get("LINEUserID")||"",r.next=5,c.get("https://api.contree.io/profile",{params:{LINEUserID:d}});case 5:return w=r.sent,r.next=8,n.setHeader("Content-Type","application/json; charset=utf-8");case 8:n.end(JSON.stringify(w.data.slice(-1)));case 9:case"end":return r.stop()}}),r)})))()}}}}]);
+2
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
!function(e){function r(data){for(var r,n,l=data[0],f=data[1],d=data[2],i=0,h=[];i<l.length;i++)n=l[i],Object.prototype.hasOwnProperty.call(o,n)&&o[n]&&h.push(o[n][0]),o[n]=0;for(r in f)Object.prototype.hasOwnProperty.call(f,r)&&(e[r]=f[r]);for(v&&v(data);h.length;)h.shift()();return c.push.apply(c,d||[]),t()}function t(){for(var e,i=0;i<c.length;i++){for(var r=c[i],t=!0,n=1;n<r.length;n++){var f=r[n];0!==o[f]&&(t=!1)}t&&(c.splice(i--,1),e=l(l.s=r[0]))}return e}var n={},o={6:0},c=[];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.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var c,script=document.createElement("script");script.charset="utf-8",script.timeout=120,l.nc&&script.setAttribute("nonce",l.nc),script.src=function(e){return l.p+""+{2:"563a13c",3:"7028ef3",4:"3a9ae06",5:"e440647",8:"2109837"}[e]+".js"}(e);var f=new Error;c=function(r){script.onerror=script.onload=null,clearTimeout(d);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+c+")",f.name="ChunkLoadError",f.type=n,f.request=c,t[1](f)}o[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:script})}),12e4);script.onerror=script.onload=c,document.head.appendChild(script)}return Promise.all(r)},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(object,e){return Object.prototype.hasOwnProperty.call(object,e)},l.p="/_nuxt/",l.oe=function(e){throw console.error(e),e};var f=window.webpackJsonp=window.webpackJsonp||[],d=f.push.bind(f);f.push=r,f=f.slice();for(var i=0;i<f.length;i++)r(f[i]);var v=d;t()}([]);
+1
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{302:function(e,r,t){"use strict";t.r(r);var n=t(15),o=(t(65),t(14),"https://api.contree.io/profile");r.default={template:"<p>OK</p>",middleware:function(e){return Object(n.a)(regeneratorRuntime.mark((function r(){var t,n,data,c,d,f,w,x;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=e.req,e.error,n=e.$axios,e.redirect,r.next=3,new Promise((function(e){var body="";t.on("data",(function(data){body+=data})),t.on("end",(function(){e(JSON.parse(body))}))}));case 3:return data=r.sent,c=data.LINEUserID=data.LINEUserID||"test",r.next=7,n.get(o,{params:{LINEUserID:c}});case 7:if(d=r.sent,f=data.VerifyNUM,w=data.VerifySys,!(d.data.length>0)){r.next=16;break}return x=d.data[0].id,r.next=14,n.patch("".concat(o,"/").concat(x),data);case 14:r.next=18;break;case 16:return r.next=18,n.post(o,data);case 18:return r.next=20,n.get("https://nodered.contree.io/contree_push",{params:{userid:c,Verify:f,VerifySys:w}});case 20:case"end":return r.stop()}}),r)})))()}}}}]);
+1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{300:function(e,r,t){"use strict";t.r(r);var n=t(15);t(65),t(32);r.default={middleware:function(e){return Object(n.a)(regeneratorRuntime.mark((function r(){var t,n,o,c,d,w;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=e.req,n=e.res,e.error,o=e.$axios,e.redirect,c=new URL(t.url,"https://".concat(t.headers.host)),d=c.searchParams.get("LINEUserID")||"",console.log(d),r.next=6,o.get("https://api.contree.io/profile",{params:{LINEUserID:d}});case 6:return w=r.sent,r.next=9,n.setHeader("Content-Type","application/json; charset=utf-8");case 9:n.end(JSON.stringify(w.data.slice(-1)));case 10:case"end":return r.stop()}}),r)})))()}}}}]);
+2
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
+53
View File
@@ -0,0 +1,53 @@
/*!
* vuex v3.6.2
* (c) 2021 Evan You
* @license MIT
*/
/*!
* vue-client-only v0.0.0-semantic-release
* (c) 2021-present egoist <0x142857@gmail.com>
* Released under the MIT License.
*/
/*!
* vue-no-ssr v1.1.1
* (c) 2018-present egoist <0x142857@gmail.com>
* Released under the MIT License.
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. 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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/**
* vue-class-component v7.2.3
* (c) 2015-present Evan You
* @license MIT
*/
/*!
* vue-router v3.5.4
* (c) 2022 Evan You
* @license MIT
*/
/*!
* Vue.js v2.7.7
* (c) 2014-2022 Evan You
* Released under the MIT License.
*/
+2
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{301:function(e,r,t){"use strict";t.r(r);var n=t(15),o=(t(65),t(14),"https://api.contree.io/profile");r.default={template:"<p>OK</p>",middleware:function(e){return Object(n.a)(regeneratorRuntime.mark((function r(){var t,n,data,c,d,f,w,x;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=e.req,e.error,n=e.$axios,e.redirect,r.next=3,new Promise((function(e){var body="";t.on("data",(function(data){body+=data})),t.on("end",(function(){e(JSON.parse(body))}))}));case 3:return data=r.sent,c=data.LINEUserID=data.LINEUserID||"test",r.next=7,n.get(o,{params:{LINEUserID:c}});case 7:if(d=r.sent,f=data.VerifyNUM,w=data.VerifySys,!(d.data.length>0)){r.next=16;break}return x=d.data[0].id,r.next=14,n.patch("".concat(o,"/").concat(x),data);case 14:r.next=18;break;case 16:return r.next=18,n.post(o,data);case 18:return r.next=20,n.get("https://nodered.contree.io/contree_push",{params:{userid:c,Verify:f,VerifySys:w}});case 20:case"end":return r.stop()}}),r)})))()}}}}]);
+1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html {{ html_attrs }}>
<head {{ head_attrs }}>
{{ HEAD }}
</head>
<body {{ body_attrs }}>
{{ APP }}
<script src="/_nuxt/0cd3c1f.js"></script><script src="/_nuxt/b8ffd72.js"></script><script src="/_nuxt/7fc9099.js"></script><script src="/_nuxt/e953ce2.js"></script></body>
</html>
+9
View File
@@ -0,0 +1,9 @@
<!doctype html>
<html {{ html_attrs }}>
<head {{ head_attrs }}>
{{ HEAD }}
</head>
<body {{ body_attrs }}>
{{ APP }}
</body>
</html>
+35
View File
@@ -0,0 +1,35 @@
exports.ids = [1];
exports.modules = {
/***/ 87:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(URL) {const ENDPOINT = 'https://api.contree.io/profile';
/* harmony default export */ __webpack_exports__["default"] = ({
async middleware({
req,
res,
error,
$axios,
redirect
}) {
const url = new URL(req.url, `https://${req.headers.host}`);
const uid = url.searchParams.get('LINEUserID') || '';
const response = await $axios.get(ENDPOINT, {
params: {
LINEUserID: uid
}
});
await res.setHeader('Content-Type', 'application/json; charset=utf-8');
res.end(JSON.stringify(response.data.slice(-1)));
}
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(50)["URL"]))
/***/ })
};;
//# sourceMappingURL=Check_Veify.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"pages/Check_Veify.js","sources":["webpack:///./pages/Check_Veify.ts"],"sourcesContent":["import querystring from 'querystring'\nimport { Vue, Component } from \"nuxt-property-decorator\";\nimport { initLIFF } from \"~/plugins/liff\";\n\nconst ENDPOINT = 'https://api.contree.io/profile'\n\nexport default {\n async middleware({ req, res, error, $axios, redirect }) {\n const url: URL = new URL(req.url, `https://${req.headers.host}`)\n const uid: string = url.searchParams.get('LINEUserID') || ''\n const response = await $axios.get(ENDPOINT, {\n params: { LINEUserID: uid }\n })\n await res.setHeader('Content-Type', 'application/json; charset=utf-8')\n res.end(JSON.stringify(response.data.slice(-1)))\n }\n}\n"],"mappings":";;;;;;;AAIA;AAAA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AADA;AAGA;AACA;AACA;AACA;AAVA;;;;;A","sourceRoot":""}
+35
View File
@@ -0,0 +1,35 @@
exports.ids = [2];
exports.modules = {
/***/ 86:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(URL) {const ENDPOINT = 'https://api.contree.io/profile';
/* harmony default export */ __webpack_exports__["default"] = ({
async middleware({
req,
res,
error,
$axios,
redirect
}) {
const url = new URL(req.url, `https://${req.headers.host}`);
const uid = url.searchParams.get('LINEUserID') || '';
const response = await $axios.get(ENDPOINT, {
params: {
LINEUserID: uid
}
});
await res.setHeader('Content-Type', 'application/json; charset=utf-8');
res.end(JSON.stringify(response.data.slice(-1)));
}
});
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(50)["URL"]))
/***/ })
};;
//# sourceMappingURL=autofill.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"pages/autofill.js","sources":["webpack:///./pages/autofill.ts"],"sourcesContent":["import querystring from 'querystring'\nimport { Vue, Component } from \"nuxt-property-decorator\";\nimport { initLIFF } from \"~/plugins/liff\";\n\nconst ENDPOINT = 'https://api.contree.io/profile'\n\nexport default {\n async middleware({ req, res, error, $axios, redirect }) {\n const url: URL = new URL(req.url, `https://${req.headers.host}`)\n const uid: string = url.searchParams.get('LINEUserID') || ''\n const response = await $axios.get(ENDPOINT, {\n params: { LINEUserID: uid }\n })\n await res.setHeader('Content-Type', 'application/json; charset=utf-8')\n res.end(JSON.stringify(response.data.slice(-1)))\n }\n}\n"],"mappings":";;;;;;;AAIA;AAAA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AADA;AAGA;AACA;AACA;AACA;AAVA;;;;;A","sourceRoot":""}
+4085
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+60
View File
@@ -0,0 +1,60 @@
exports.ids = [4];
exports.modules = {
/***/ 88:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
const ENDPOINT = "https://api.contree.io/profile";
const ENDPOINT2 = "https://nodered.contree.io/contree_push";
/* harmony default export */ __webpack_exports__["default"] = ({
template: '<p>OK</p>',
async middleware({
req,
error,
$axios,
redirect
}) {
const data = await new Promise(resolve => {
let body = '';
req.on('data', data => {
body += data;
});
req.on('end', () => {
resolve(JSON.parse(body));
});
});
const uid = data.LINEUserID = data.LINEUserID || 'test';
let response = await $axios.get(ENDPOINT, {
params: {
LINEUserID: uid
}
});
const vnum = data.VerifyNUM;
const vsys = data.VerifySys; //data.BeaconMode = 'leave'
//data.FLAG = false
if (response.data.length > 0) {
const id = response.data[0].id;
await $axios.patch(`${ENDPOINT}/${id}`, data);
} else {
await $axios.post(ENDPOINT, data);
}
await $axios.get(ENDPOINT2, {
params: {
userid: uid,
Verify: vnum,
VerifySys: vsys
}
});
}
});
/***/ })
};;
//# sourceMappingURL=submit.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"pages/submit.js","sources":["webpack:///./pages/submit.ts"],"sourcesContent":["import querystring from 'querystring'\nimport { IForm } from '~/models/submit'\n\nconst ENDPOINT = \"https://api.contree.io/profile\"\nconst ENDPOINT2 = \"https://nodered.contree.io/contree_push\"\n\nexport default {\n template: '<p>OK</p>',\n async middleware({ req, error, $axios, redirect }) {\n const data : IForm = await new Promise((resolve) => {\n let body = ''\n req.on('data', data => {\n body += data\n })\n req.on('end', () => {\n resolve(JSON.parse(body))\n })\n })\n const uid = data.LINEUserID = data.LINEUserID || 'test'\n let response = await $axios.get(ENDPOINT, {\n params: { LINEUserID: uid }\n })\n const vnum = data.VerifyNUM\n const vsys = data.VerifySys\n\n //data.BeaconMode = 'leave'\n //data.FLAG = false\n if (response.data.length > 0) {\n const id = response.data[0].id\n await $axios.patch(`${ENDPOINT}/${id}`, data)\n } else {\n await $axios.post(ENDPOINT, data)\n }\n await $axios.get(ENDPOINT2, {\n params: { userid: uid ,Verify: vnum,VerifySys: vsys }\n })\n }\n}\n"],"mappings":";;;;;;;AAGA;AAAA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AADA;AAGA;AACA;AAGA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AADA;AAGA;AACA;AA/BA;;;;A","sourceRoot":""}
+6638
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+17
View File
@@ -0,0 +1,17 @@
{
"entry": "server.js",
"files": {
"pages/Check_Veify.js": "pages/Check_Veify.js",
"pages/autofill.js": "pages/autofill.js",
"pages/index.js": "pages/index.js",
"pages/submit.js": "pages/submit.js",
"server.js": "server.js"
},
"maps": {
"pages/Check_Veify.js": "pages/Check_Veify.js.map",
"pages/autofill.js": "pages/autofill.js.map",
"pages/index.js": "pages/index.js.map",
"pages/submit.js": "pages/submit.js.map",
"server.js": "server.js.map"
}
}
+1
View File
@@ -0,0 +1 @@
// This file is intentionally left empty for noop aliases
+234
View File
@@ -0,0 +1,234 @@
import Vue from 'vue'
import Meta from 'vue-meta'
import ClientOnly from 'vue-client-only'
import NoSsr from 'vue-no-ssr'
import { createRouter } from './router.js'
import NuxtChild from './components/nuxt-child.js'
import NuxtError from '../layouts/error.vue'
import Nuxt from './components/nuxt.js'
import App from './App.js'
import { setContext, getLocation, getRouteData, normalizeError } from './utils'
/* Plugins */
import nuxt_plugin_plugin_7f3117c2 from 'nuxt_plugin_plugin_7f3117c2' // Source: ./components/plugin.js (mode: 'all')
import nuxt_plugin_plugin_a75347a2 from 'nuxt_plugin_plugin_a75347a2' // Source: ./vuetify/plugin.js (mode: 'all')
import nuxt_plugin_axios_1a10d496 from 'nuxt_plugin_axios_1a10d496' // Source: ./axios.js (mode: 'all')
// Component: <ClientOnly>
Vue.component(ClientOnly.name, ClientOnly)
// TODO: Remove in Nuxt 3: <NoSsr>
Vue.component(NoSsr.name, {
...NoSsr,
render (h, ctx) {
if (process.client && !NoSsr._warned) {
NoSsr._warned = true
console.warn('<no-ssr> has been deprecated and will be removed in Nuxt 3, please use <client-only> instead')
}
return NoSsr.render(h, ctx)
}
})
// Component: <NuxtChild>
Vue.component(NuxtChild.name, NuxtChild)
Vue.component('NChild', NuxtChild)
// Component NuxtLink is imported in server.js or client.js
// Component: <Nuxt>
Vue.component(Nuxt.name, Nuxt)
Object.defineProperty(Vue.prototype, '$nuxt', {
get() {
const globalNuxt = this.$root.$options.$nuxt
if (process.client && !globalNuxt && typeof window !== 'undefined') {
return window.$nuxt
}
return globalNuxt
},
configurable: true
})
Vue.use(Meta, {"keyName":"head","attribute":"data-n-head","ssrAttribute":"data-n-head-ssr","tagIDKeyName":"hid"})
const defaultTransition = {"name":"page","mode":"out-in","appear":false,"appearClass":"appear","appearActiveClass":"appear-active","appearToClass":"appear-to"}
async function createApp(ssrContext, config = {}) {
const router = await createRouter(ssrContext, config)
// Create Root instance
// here we inject the router and store to all child components,
// making them available everywhere as `this.$router` and `this.$store`.
const app = {
head: {"titleTemplate":"%s - punch","title":"punch","meta":[{"charset":"utf-8"},{"name":"viewport","content":"width=device-width, initial-scale=1"},{"hid":"description","name":"description","content":""}],"link":[{"rel":"icon","type":"image\u002Fx-icon","href":"\u002Ffavicon.ico"},{"rel":"stylesheet","type":"text\u002Fcss","href":"https:\u002F\u002Ffonts.googleapis.com\u002Fcss?family=Roboto:100,300,400,500,700,900&display=swap"},{"rel":"stylesheet","type":"text\u002Fcss","href":"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002F@mdi\u002Ffont@latest\u002Fcss\u002Fmaterialdesignicons.min.css"}],"style":[],"script":[]},
router,
nuxt: {
defaultTransition,
transitions: [defaultTransition],
setTransitions (transitions) {
if (!Array.isArray(transitions)) {
transitions = [transitions]
}
transitions = transitions.map((transition) => {
if (!transition) {
transition = defaultTransition
} else if (typeof transition === 'string') {
transition = Object.assign({}, defaultTransition, { name: transition })
} else {
transition = Object.assign({}, defaultTransition, transition)
}
return transition
})
this.$options.nuxt.transitions = transitions
return transitions
},
err: null,
dateErr: null,
error (err) {
err = err || null
app.context._errored = Boolean(err)
err = err ? normalizeError(err) : null
let nuxt = app.nuxt // to work with @vue/composition-api, see https://github.com/nuxt/nuxt.js/issues/6517#issuecomment-573280207
if (this) {
nuxt = this.nuxt || this.$options.nuxt
}
nuxt.dateErr = Date.now()
nuxt.err = err
// Used in src/server.js
if (ssrContext) {
ssrContext.nuxt.error = err
}
return err
}
},
...App
}
const next = ssrContext ? ssrContext.next : location => app.router.push(location)
// Resolve route
let route
if (ssrContext) {
route = router.resolve(ssrContext.url).route
} else {
const path = getLocation(router.options.base, router.options.mode)
route = router.resolve(path).route
}
// Set context to app.context
await setContext(app, {
route,
next,
error: app.nuxt.error.bind(app),
payload: ssrContext ? ssrContext.payload : undefined,
req: ssrContext ? ssrContext.req : undefined,
res: ssrContext ? ssrContext.res : undefined,
beforeRenderFns: ssrContext ? ssrContext.beforeRenderFns : undefined,
ssrContext
})
function inject(key, value) {
if (!key) {
throw new Error('inject(key, value) has no key provided')
}
if (value === undefined) {
throw new Error(`inject('${key}', value) has no value provided`)
}
key = '$' + key
// Add into app
app[key] = value
// Add into context
if (!app.context[key]) {
app.context[key] = value
}
// Check if plugin not already installed
const installKey = '__nuxt_' + key + '_installed__'
if (Vue[installKey]) {
return
}
Vue[installKey] = true
// Call Vue.use() to install the plugin into vm
Vue.use(() => {
if (!Object.prototype.hasOwnProperty.call(Vue.prototype, key)) {
Object.defineProperty(Vue.prototype, key, {
get () {
return this.$root.$options[key]
}
})
}
})
}
// Inject runtime config as $config
inject('config', config)
// Add enablePreview(previewData = {}) in context for plugins
if (process.static && process.client) {
app.context.enablePreview = function (previewData = {}) {
app.previewData = Object.assign({}, previewData)
inject('preview', previewData)
}
}
// Plugin execution
if (typeof nuxt_plugin_plugin_7f3117c2 === 'function') {
await nuxt_plugin_plugin_7f3117c2(app.context, inject)
}
if (typeof nuxt_plugin_plugin_a75347a2 === 'function') {
await nuxt_plugin_plugin_a75347a2(app.context, inject)
}
if (typeof nuxt_plugin_axios_1a10d496 === 'function') {
await nuxt_plugin_axios_1a10d496(app.context, inject)
}
// Lock enablePreview in context
if (process.static && process.client) {
app.context.enablePreview = function () {
console.warn('You cannot call enablePreview() outside a plugin.')
}
}
// Wait for async component to be resolved first
await new Promise((resolve, reject) => {
// Ignore 404s rather than blindly replacing URL in browser
if (process.client) {
const { route } = router.resolve(app.context.route.fullPath)
if (!route.matched.length) {
return resolve()
}
}
router.replace(app.context.route.fullPath, resolve, (err) => {
// https://github.com/vuejs/vue-router/blob/v3.4.3/src/util/errors.js
if (!err._isRouter) return reject(err)
if (err.type !== 2 /* NavigationFailureType.redirected */) return resolve()
// navigated to a different route in router guard
const unregister = router.afterEach(async (to, from) => {
if (process.server && ssrContext && ssrContext.url) {
ssrContext.url = to.fullPath
}
app.context.route = await getRouteData(to)
app.context.params = to.params || {}
app.context.query = to.query || {}
unregister()
resolve()
})
})
})
return {
app,
router
}
}
export { createApp, NuxtError }
+82
View File
@@ -0,0 +1,82 @@
const chunks = {} // chunkId => exports
const chunksInstalling = {} // chunkId => Promise
const failedChunks = {}
function importChunk(chunkId, src) {
// Already installed
if (chunks[chunkId]) {
return Promise.resolve(chunks[chunkId])
}
// Failed loading
if (failedChunks[chunkId]) {
return Promise.reject(failedChunks[chunkId])
}
// Installing
if (chunksInstalling[chunkId]) {
return chunksInstalling[chunkId]
}
// Set a promise in chunk cache
let resolve, reject
const promise = chunksInstalling[chunkId] = new Promise((_resolve, _reject) => {
resolve = _resolve
reject = _reject
})
// Clear chunk data from cache
delete chunks[chunkId]
// Start chunk loading
const script = document.createElement('script')
script.charset = 'utf-8'
script.timeout = 120
script.src = src
let timeout
// Create error before stack unwound to get useful stacktrace later
const error = new Error()
// Complete handlers
const onScriptComplete = script.onerror = script.onload = (event) => {
// Cleanups
clearTimeout(timeout)
delete chunksInstalling[chunkId]
// Avoid mem leaks in IE
script.onerror = script.onload = null
// Verify chunk is loaded
if (chunks[chunkId]) {
return resolve(chunks[chunkId])
}
// Something bad happened
const errorType = event && (event.type === 'load' ? 'missing' : event.type)
const realSrc = event && event.target && event.target.src
error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')'
error.name = 'ChunkLoadError'
error.type = errorType
error.request = realSrc
failedChunks[chunkId] = error
reject(error)
}
// Timeout
timeout = setTimeout(() => {
onScriptComplete({ type: 'timeout', target: script })
}, 120000)
// Append script
document.head.appendChild(script)
// Return promise
return promise
}
export function installJsonp() {
window.__NUXT_JSONP__ = function (chunkId, exports) { chunks[chunkId] = exports }
window.__NUXT_JSONP_CACHE__ = chunks
window.__NUXT_IMPORT__ = importChunk
}
+108
View File
@@ -0,0 +1,108 @@
<style>
#nuxt-loading {
background: white;
visibility: hidden;
opacity: 0;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
animation: nuxtLoadingIn 10s ease;
-webkit-animation: nuxtLoadingIn 10s ease;
animation-fill-mode: forwards;
overflow: hidden;
}
@keyframes nuxtLoadingIn {
0% {
visibility: hidden;
opacity: 0;
}
20% {
visibility: visible;
opacity: 0;
}
100% {
visibility: visible;
opacity: 1;
}
}
@-webkit-keyframes nuxtLoadingIn {
0% {
visibility: hidden;
opacity: 0;
}
20% {
visibility: visible;
opacity: 0;
}
100% {
visibility: visible;
opacity: 1;
}
}
#nuxt-loading>div,
#nuxt-loading>div:after {
border-radius: 50%;
width: 5rem;
height: 5rem;
}
#nuxt-loading>div {
font-size: 10px;
position: relative;
text-indent: -9999em;
border: .5rem solid #F5F5F5;
border-left: .5rem solid black;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: nuxtLoading 1.1s infinite linear;
animation: nuxtLoading 1.1s infinite linear;
}
#nuxt-loading.error>div {
border-left: .5rem solid #ff4500;
animation-duration: 5s;
}
@-webkit-keyframes nuxtLoading {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes nuxtLoading {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
</style>
<script>
window.addEventListener('error', function () {
var e = document.getElementById('nuxt-loading');
if (e) {
e.className += ' error';
}
});
</script>
<div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div>
+3
View File
@@ -0,0 +1,3 @@
const middleware = {}
export default middleware
+90
View File
@@ -0,0 +1,90 @@
import Vue from 'vue'
import { hasFetch, normalizeError, addLifecycleHook, createGetCounter } from '../utils'
const isSsrHydration = (vm) => vm.$vnode && vm.$vnode.elm && vm.$vnode.elm.dataset && vm.$vnode.elm.dataset.fetchKey
const nuxtState = window.__NUXT__
export default {
beforeCreate () {
if (!hasFetch(this)) {
return
}
this._fetchDelay = typeof this.$options.fetchDelay === 'number' ? this.$options.fetchDelay : 200
Vue.util.defineReactive(this, '$fetchState', {
pending: false,
error: null,
timestamp: Date.now()
})
this.$fetch = $fetch.bind(this)
addLifecycleHook(this, 'created', created)
addLifecycleHook(this, 'beforeMount', beforeMount)
}
}
function beforeMount() {
if (!this._hydrated) {
return this.$fetch()
}
}
function created() {
if (!isSsrHydration(this)) {
return
}
// Hydrate component
this._hydrated = true
this._fetchKey = this.$vnode.elm.dataset.fetchKey
const data = nuxtState.fetch[this._fetchKey]
// If fetch error
if (data && data._error) {
this.$fetchState.error = data._error
return
}
// Merge data
for (const key in data) {
Vue.set(this.$data, key, data[key])
}
}
function $fetch() {
if (!this._fetchPromise) {
this._fetchPromise = $_fetch.call(this)
.then(() => { delete this._fetchPromise })
}
return this._fetchPromise
}
async function $_fetch() {
this.$nuxt.nbFetching++
this.$fetchState.pending = true
this.$fetchState.error = null
this._hydrated = false
let error = null
const startTime = Date.now()
try {
await this.$options.fetch.call(this)
} catch (err) {
if (process.dev) {
console.error('Error in fetch():', err)
}
error = normalizeError(err)
}
const delayLeft = this._fetchDelay - (Date.now() - startTime)
if (delayLeft > 0) {
await new Promise(resolve => setTimeout(resolve, delayLeft))
}
this.$fetchState.error = error
this.$fetchState.pending = false
this.$fetchState.timestamp = Date.now()
this.$nextTick(() => this.$nuxt.nbFetching--)
}
+65
View File
@@ -0,0 +1,65 @@
import Vue from 'vue'
import { hasFetch, normalizeError, addLifecycleHook, purifyData, createGetCounter } from '../utils'
async function serverPrefetch() {
if (!this._fetchOnServer) {
return
}
// Call and await on $fetch
try {
await this.$options.fetch.call(this)
} catch (err) {
if (process.dev) {
console.error('Error in fetch():', err)
}
this.$fetchState.error = normalizeError(err)
}
this.$fetchState.pending = false
// Define an ssrKey for hydration
this._fetchKey = this._fetchKey || this.$ssrContext.fetchCounters['']++
// Add data-fetch-key on parent element of Component
const attrs = this.$vnode.data.attrs = this.$vnode.data.attrs || {}
attrs['data-fetch-key'] = this._fetchKey
// Add to ssrContext for window.__NUXT__.fetch
this.$ssrContext.nuxt.fetch[this._fetchKey] =
this.$fetchState.error ? { _error: this.$fetchState.error } : purifyData(this._data)
}
export default {
created() {
if (!hasFetch(this)) {
return
}
if (typeof this.$options.fetchOnServer === 'function') {
this._fetchOnServer = this.$options.fetchOnServer.call(this) !== false
} else {
this._fetchOnServer = this.$options.fetchOnServer !== false
}
const defaultKey = this.$options._scopeId || this.$options.name || ''
const getCounter = createGetCounter(this.$ssrContext.fetchCounters, defaultKey)
if (typeof this.$options.fetchKey === 'function') {
this._fetchKey = this.$options.fetchKey.call(this, getCounter)
} else {
const key = 'string' === typeof this.$options.fetchKey ? this.$options.fetchKey : defaultKey
this._fetchKey = key ? key + ':' + getCounter(key) : String(getCounter(key))
}
// Added for remove vue undefined warning while ssr
this.$fetch = () => {} // issue #8043
Vue.util.defineReactive(this, '$fetchState', {
pending: true,
error: null,
timestamp: Date.now()
})
addLifecycleHook(this, 'serverPrefetch', serverPrefetch)
}
}
+63
View File
@@ -0,0 +1,63 @@
import Vue from 'vue'
import Router from 'vue-router'
import { normalizeURL, decode } from 'ufo'
import { interopDefault } from './utils'
import scrollBehavior from './router.scrollBehavior.js'
const _4c4bd4da = () => interopDefault(import('../pages/autofill.ts' /* webpackChunkName: "pages/autofill" */))
const _ae4b8690 = () => interopDefault(import('../pages/Check_Veify.ts' /* webpackChunkName: "pages/Check_Veify" */))
const _a9d81b18 = () => interopDefault(import('../pages/submit.ts' /* webpackChunkName: "pages/submit" */))
const _6619b0c9 = () => interopDefault(import('../pages/index.vue' /* webpackChunkName: "pages/index" */))
const emptyFn = () => {}
Vue.use(Router)
export const routerOptions = {
mode: 'history',
base: '/',
linkActiveClass: 'nuxt-link-active',
linkExactActiveClass: 'nuxt-link-exact-active',
scrollBehavior,
routes: [{
path: "/autofill",
component: _4c4bd4da,
name: "autofill"
}, {
path: "/Check_Veify",
component: _ae4b8690,
name: "Check_Veify"
}, {
path: "/submit",
component: _a9d81b18,
name: "submit"
}, {
path: "/",
component: _6619b0c9,
name: "index"
}],
fallback: false
}
export function createRouter (ssrContext, config) {
const base = (config._app && config._app.basePath) || routerOptions.base
const router = new Router({ ...routerOptions, base })
// TODO: remove in Nuxt 3
const originalPush = router.push
router.push = function push (location, onComplete = emptyFn, onAbort) {
return originalPush.call(this, location, onComplete, onAbort)
}
const resolve = router.resolve.bind(router)
router.resolve = (to, current, append) => {
if (typeof to === 'string') {
to = normalizeURL(to)
}
return resolve(to, current, append)
}
return router
}
+76
View File
@@ -0,0 +1,76 @@
import { getMatchedComponents, setScrollRestoration } from './utils'
if (process.client) {
if ('scrollRestoration' in window.history) {
setScrollRestoration('manual')
// reset scrollRestoration to auto when leaving page, allowing page reload
// and back-navigation from other pages to use the browser to restore the
// scrolling position.
window.addEventListener('beforeunload', () => {
setScrollRestoration('auto')
})
// Setting scrollRestoration to manual again when returning to this page.
window.addEventListener('load', () => {
setScrollRestoration('manual')
})
}
}
function shouldScrollToTop(route) {
const Pages = getMatchedComponents(route)
if (Pages.length === 1) {
const { options = {} } = Pages[0]
return options.scrollToTop !== false
}
return Pages.some(({ options }) => options && options.scrollToTop)
}
export default function (to, from, savedPosition) {
// If the returned position is falsy or an empty object, will retain current scroll position
let position = false
const isRouteChanged = to !== from
// savedPosition is only available for popstate navigations (back button)
if (savedPosition) {
position = savedPosition
} else if (isRouteChanged && shouldScrollToTop(to)) {
position = { x: 0, y: 0 }
}
const nuxt = window.$nuxt
if (
// Initial load (vuejs/vue-router#3199)
!isRouteChanged ||
// Route hash changes
(to.path === from.path && to.hash !== from.hash)
) {
nuxt.$nextTick(() => nuxt.$emit('triggerScroll'))
}
return new Promise((resolve) => {
// wait for the out transition to complete (if necessary)
nuxt.$once('triggerScroll', () => {
// coords will be used if no selector is provided,
// or if the selector didn't match any element.
if (to.hash) {
let hash = to.hash
// CSS.escape() is not supported with IE and Edge.
if (typeof window.CSS !== 'undefined' && typeof window.CSS.escape !== 'undefined') {
hash = '#' + window.CSS.escape(hash.substr(1))
}
try {
if (document.querySelector(hash)) {
// scroll to anchor by returning the selector
position = { selector: hash }
}
} catch (e) {
console.warn('Failed to save scroll position. Please add CSS.escape() polyfill (https://github.com/mathiasbynens/CSS.escape).')
}
}
resolve(position)
})
})
}
+30
View File
@@ -0,0 +1,30 @@
[
{
"name": "autofill",
"path": "/autofill",
"component": "/home/node/nuxt/pages/autofill.ts",
"chunkName": "pages/autofill",
"_name": "_4c4bd4da"
},
{
"name": "Check_Veify",
"path": "/Check_Veify",
"component": "/home/node/nuxt/pages/Check_Veify.ts",
"chunkName": "pages/Check_Veify",
"_name": "_ae4b8690"
},
{
"name": "submit",
"path": "/submit",
"component": "/home/node/nuxt/pages/submit.ts",
"chunkName": "pages/submit",
"_name": "_a9d81b18"
},
{
"name": "index",
"path": "/",
"component": "/home/node/nuxt/pages/index.vue",
"chunkName": "pages/index",
"_name": "_6619b0c9"
}
]
+268
View File
@@ -0,0 +1,268 @@
import Vue from 'vue'
import { joinURL, normalizeURL, withQuery } from 'ufo'
import fetch from 'node-fetch'
import middleware from './middleware.js'
import {
applyAsyncData,
middlewareSeries,
sanitizeComponent,
getMatchedComponents,
promisify
} from './utils.js'
import fetchMixin from './mixins/fetch.server'
import { createApp, NuxtError } from './index.js'
import NuxtLink from './components/nuxt-link.server.js' // should be included after ./index.js
// Update serverPrefetch strategy
Vue.config.optionMergeStrategies.serverPrefetch = Vue.config.optionMergeStrategies.created
// Fetch mixin
if (!Vue.__nuxt__fetch__mixin__) {
Vue.mixin(fetchMixin)
Vue.__nuxt__fetch__mixin__ = true
}
// Component: <NuxtLink>
Vue.component(NuxtLink.name, NuxtLink)
Vue.component('NLink', NuxtLink)
if (!global.fetch) { global.fetch = fetch }
const noopApp = () => new Vue({ render: h => h('div', { domProps: { id: '__nuxt' } }) })
const createNext = ssrContext => (opts) => {
// If static target, render on client-side
ssrContext.redirected = opts
if (ssrContext.target === 'static' || !ssrContext.res) {
ssrContext.nuxt.serverRendered = false
return
}
let fullPath = withQuery(opts.path, opts.query)
const $config = ssrContext.runtimeConfig || {}
const routerBase = ($config._app && $config._app.basePath) || '/'
if (!fullPath.startsWith('http') && (routerBase !== '/' && !fullPath.startsWith(routerBase))) {
fullPath = joinURL(routerBase, fullPath)
}
// Avoid loop redirect
if (decodeURI(fullPath) === decodeURI(ssrContext.url)) {
ssrContext.redirected = false
return
}
ssrContext.res.writeHead(opts.status, {
Location: normalizeURL(fullPath)
})
ssrContext.res.end()
}
// This exported function will be called by `bundleRenderer`.
// This is where we perform data-prefetching to determine the
// state of our application before actually rendering it.
// Since data fetching is async, this function is expected to
// return a Promise that resolves to the app instance.
export default async (ssrContext) => {
// Create ssrContext.next for simulate next() of beforeEach() when wanted to redirect
ssrContext.redirected = false
ssrContext.next = createNext(ssrContext)
// Used for beforeNuxtRender({ Components, nuxtState })
ssrContext.beforeRenderFns = []
// Nuxt object (window.{{globals.context}}, defaults to window.__NUXT__)
ssrContext.nuxt = { layout: 'default', data: [], fetch: {}, error: null, serverRendered: true, routePath: '' }
ssrContext.fetchCounters = {}
// Remove query from url is static target
// Public runtime config
ssrContext.nuxt.config = ssrContext.runtimeConfig.public
if (ssrContext.nuxt.config._app) {
__webpack_public_path__ = joinURL(ssrContext.nuxt.config._app.cdnURL, ssrContext.nuxt.config._app.assetsPath)
}
// Create the app definition and the instance (created for each request)
const { app, router } = await createApp(ssrContext, ssrContext.runtimeConfig.private)
const _app = new Vue(app)
// Add ssr route path to nuxt context so we can account for page navigation between ssr and csr
ssrContext.nuxt.routePath = app.context.route.path
// Add meta infos (used in renderer.js)
ssrContext.meta = _app.$meta()
// Keep asyncData for each matched component in ssrContext (used in app/utils.js via this.$ssrContext)
ssrContext.asyncData = {}
const beforeRender = async () => {
// Call beforeNuxtRender() methods
await Promise.all(ssrContext.beforeRenderFns.map(fn => promisify(fn, { Components, nuxtState: ssrContext.nuxt })))
}
const renderErrorPage = async () => {
// Don't server-render the page in static target
if (ssrContext.target === 'static') {
ssrContext.nuxt.serverRendered = false
}
// Load layout for error page
const layout = (NuxtError.options || NuxtError).layout
const errLayout = typeof layout === 'function' ? layout.call(NuxtError, app.context) : layout
ssrContext.nuxt.layout = errLayout || 'default'
await _app.loadLayout(errLayout)
_app.setLayout(errLayout)
await beforeRender()
return _app
}
const render404Page = () => {
app.context.error({ statusCode: 404, path: ssrContext.url, message: 'This page could not be found' })
return renderErrorPage()
}
// Components are already resolved by setContext -> getRouteData (app/utils.js)
const Components = getMatchedComponents(app.context.route)
/*
** Call global middleware (nuxt.config.js)
*/
let midd = []
midd = midd.map((name) => {
if (typeof name === 'function') {
return name
}
if (typeof middleware[name] !== 'function') {
app.context.error({ statusCode: 500, message: 'Unknown middleware ' + name })
}
return middleware[name]
})
await middlewareSeries(midd, app.context)
// ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) {
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
/*
** Set layout
*/
let layout = Components.length ? Components[0].options.layout : NuxtError.layout
if (typeof layout === 'function') {
layout = layout(app.context)
}
await _app.loadLayout(layout)
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
layout = _app.setLayout(layout)
ssrContext.nuxt.layout = _app.layoutName
/*
** Call middleware (layout + pages)
*/
midd = []
layout = sanitizeComponent(layout)
if (layout.options.middleware) {
midd = midd.concat(layout.options.middleware)
}
Components.forEach((Component) => {
if (Component.options.middleware) {
midd = midd.concat(Component.options.middleware)
}
})
midd = midd.map((name) => {
if (typeof name === 'function') {
return name
}
if (typeof middleware[name] !== 'function') {
app.context.error({ statusCode: 500, message: 'Unknown middleware ' + name })
}
return middleware[name]
})
await middlewareSeries(midd, app.context)
// ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) {
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
/*
** Call .validate()
*/
let isValid = true
try {
for (const Component of Components) {
if (typeof Component.options.validate !== 'function') {
continue
}
isValid = await Component.options.validate(app.context)
if (!isValid) {
break
}
}
} catch (validationError) {
// ...If .validate() threw an error
app.context.error({
statusCode: validationError.statusCode || '500',
message: validationError.message
})
return renderErrorPage()
}
// ...If .validate() returned false
if (!isValid) {
// Render a 404 error page
return render404Page()
}
// If no Components found, returns 404
if (!Components.length) {
return render404Page()
}
// Call asyncData & fetch hooks on components matched by the route.
const asyncDatas = await Promise.all(Components.map((Component) => {
const promises = []
// Call asyncData(context)
if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
const promise = promisify(Component.options.asyncData, app.context)
promise.then((asyncDataResult) => {
ssrContext.asyncData[Component.cid] = asyncDataResult
applyAsyncData(Component)
return asyncDataResult
})
promises.push(promise)
} else {
promises.push(null)
}
// Call fetch(context)
if (Component.options.fetch && Component.options.fetch.length) {
promises.push(Component.options.fetch(app.context))
} else {
promises.push(null)
}
return Promise.all(promises)
}))
// datas are the first row of each
ssrContext.nuxt.data = asyncDatas.map(r => r[0] || {})
// ...If there is a redirect or an error, stop the process
if (ssrContext.redirected) {
return noopApp()
}
if (ssrContext.nuxt.error) {
return renderErrorPage()
}
// Call beforeNuxtRender methods & add store state
await beforeRender()
return _app
}
+627
View File
@@ -0,0 +1,627 @@
import Vue from 'vue'
import { isSamePath as _isSamePath, joinURL, normalizeURL, withQuery, withoutTrailingSlash } from 'ufo'
// window.{{globals.loadedCallback}} hook
// Useful for jsdom testing or plugins (https://github.com/tmpvar/jsdom#dealing-with-asynchronous-script-loading)
if (process.client) {
window.onNuxtReadyCbs = []
window.onNuxtReady = (cb) => {
window.onNuxtReadyCbs.push(cb)
}
}
export function createGetCounter (counterObject, defaultKey = '') {
return function getCounter (id = defaultKey) {
if (counterObject[id] === undefined) {
counterObject[id] = 0
}
return counterObject[id]++
}
}
export function empty () {}
export function globalHandleError (error) {
if (Vue.config.errorHandler) {
Vue.config.errorHandler(error)
}
}
export function interopDefault (promise) {
return promise.then(m => m.default || m)
}
export function hasFetch(vm) {
return vm.$options && typeof vm.$options.fetch === 'function' && !vm.$options.fetch.length
}
export function purifyData(data) {
if (process.env.NODE_ENV === 'production') {
return data
}
return Object.entries(data).filter(
([key, value]) => {
const valid = !(value instanceof Function) && !(value instanceof Promise)
if (!valid) {
console.warn(`${key} is not able to be stringified. This will break in a production environment.`)
}
return valid
}
).reduce((obj, [key, value]) => {
obj[key] = value
return obj
}, {})
}
export function getChildrenComponentInstancesUsingFetch(vm, instances = []) {
const children = vm.$children || []
for (const child of children) {
if (child.$fetch) {
instances.push(child)
continue; // Don't get the children since it will reload the template
}
if (child.$children) {
getChildrenComponentInstancesUsingFetch(child, instances)
}
}
return instances
}
export function applyAsyncData (Component, asyncData) {
if (
// For SSR, we once all this function without second param to just apply asyncData
// Prevent doing this for each SSR request
!asyncData && Component.options.__hasNuxtData
) {
return
}
const ComponentData = Component.options._originDataFn || Component.options.data || function () { return {} }
Component.options._originDataFn = ComponentData
Component.options.data = function () {
const data = ComponentData.call(this, this)
if (this.$ssrContext) {
asyncData = this.$ssrContext.asyncData[Component.cid]
}
return { ...data, ...asyncData }
}
Component.options.__hasNuxtData = true
if (Component._Ctor && Component._Ctor.options) {
Component._Ctor.options.data = Component.options.data
}
}
export function sanitizeComponent (Component) {
// If Component already sanitized
if (Component.options && Component._Ctor === Component) {
return Component
}
if (!Component.options) {
Component = Vue.extend(Component) // fix issue #6
Component._Ctor = Component
} else {
Component._Ctor = Component
Component.extendOptions = Component.options
}
// If no component name defined, set file path as name, (also fixes #5703)
if (!Component.options.name && Component.options.__file) {
Component.options.name = Component.options.__file
}
return Component
}
export function getMatchedComponents (route, matches = false, prop = 'components') {
return Array.prototype.concat.apply([], route.matched.map((m, index) => {
return Object.keys(m[prop]).map((key) => {
matches && matches.push(index)
return m[prop][key]
})
}))
}
export function getMatchedComponentsInstances (route, matches = false) {
return getMatchedComponents(route, matches, 'instances')
}
export function flatMapComponents (route, fn) {
return Array.prototype.concat.apply([], route.matched.map((m, index) => {
return Object.keys(m.components).reduce((promises, key) => {
if (m.components[key]) {
promises.push(fn(m.components[key], m.instances[key], m, key, index))
} else {
delete m.components[key]
}
return promises
}, [])
}))
}
export function resolveRouteComponents (route, fn) {
return Promise.all(
flatMapComponents(route, async (Component, instance, match, key) => {
// If component is a function, resolve it
if (typeof Component === 'function' && !Component.options) {
try {
Component = await Component()
} catch (error) {
// Handle webpack chunk loading errors
// This may be due to a new deployment or a network problem
if (
error &&
error.name === 'ChunkLoadError' &&
typeof window !== 'undefined' &&
window.sessionStorage
) {
const timeNow = Date.now()
const previousReloadTime = parseInt(window.sessionStorage.getItem('nuxt-reload'))
// check for previous reload time not to reload infinitely
if (!previousReloadTime || previousReloadTime + 60000 < timeNow) {
window.sessionStorage.setItem('nuxt-reload', timeNow)
window.location.reload(true /* skip cache */)
}
}
throw error
}
}
match.components[key] = Component = sanitizeComponent(Component)
return typeof fn === 'function' ? fn(Component, instance, match, key) : Component
})
)
}
export async function getRouteData (route) {
if (!route) {
return
}
// Make sure the components are resolved (code-splitting)
await resolveRouteComponents(route)
// Send back a copy of route with meta based on Component definition
return {
...route,
meta: getMatchedComponents(route).map((Component, index) => {
return { ...Component.options.meta, ...(route.matched[index] || {}).meta }
})
}
}
export async function setContext (app, context) {
// If context not defined, create it
if (!app.context) {
app.context = {
isStatic: process.static,
isDev: false,
isHMR: false,
app,
payload: context.payload,
error: context.error,
base: app.router.options.base,
env: {}
}
// Only set once
if (context.req) {
app.context.req = context.req
}
if (context.res) {
app.context.res = context.res
}
if (context.ssrContext) {
app.context.ssrContext = context.ssrContext
}
app.context.redirect = (status, path, query) => {
if (!status) {
return
}
app.context._redirected = true
// if only 1 or 2 arguments: redirect('/') or redirect('/', { foo: 'bar' })
let pathType = typeof path
if (typeof status !== 'number' && (pathType === 'undefined' || pathType === 'object')) {
query = path || {}
path = status
pathType = typeof path
status = 302
}
if (pathType === 'object') {
path = app.router.resolve(path).route.fullPath
}
// "/absolute/route", "./relative/route" or "../relative/route"
if (/(^[.]{1,2}\/)|(^\/(?!\/))/.test(path)) {
app.context.next({
path,
query,
status
})
} else {
path = withQuery(path, query)
if (process.server) {
app.context.next({
path,
status
})
}
if (process.client) {
// https://developer.mozilla.org/en-US/docs/Web/API/Location/replace
window.location.replace(path)
// Throw a redirect error
throw new Error('ERR_REDIRECT')
}
}
}
if (process.server) {
app.context.beforeNuxtRender = fn => context.beforeRenderFns.push(fn)
}
if (process.client) {
app.context.nuxtState = window.__NUXT__
}
}
// Dynamic keys
const [currentRouteData, fromRouteData] = await Promise.all([
getRouteData(context.route),
getRouteData(context.from)
])
if (context.route) {
app.context.route = currentRouteData
}
if (context.from) {
app.context.from = fromRouteData
}
app.context.next = context.next
app.context._redirected = false
app.context._errored = false
app.context.isHMR = false
app.context.params = app.context.route.params || {}
app.context.query = app.context.route.query || {}
}
export function middlewareSeries (promises, appContext) {
if (!promises.length || appContext._redirected || appContext._errored) {
return Promise.resolve()
}
return promisify(promises[0], appContext)
.then(() => {
return middlewareSeries(promises.slice(1), appContext)
})
}
export function promisify (fn, context) {
let promise
if (fn.length === 2) {
// fn(context, callback)
promise = new Promise((resolve) => {
fn(context, function (err, data) {
if (err) {
context.error(err)
}
data = data || {}
resolve(data)
})
})
} else {
promise = fn(context)
}
if (promise && promise instanceof Promise && typeof promise.then === 'function') {
return promise
}
return Promise.resolve(promise)
}
// Imported from vue-router
export function getLocation (base, mode) {
if (mode === 'hash') {
return window.location.hash.replace(/^#\//, '')
}
base = decodeURI(base).slice(0, -1) // consideration is base is normalized with trailing slash
let path = decodeURI(window.location.pathname)
if (base && path.startsWith(base)) {
path = path.slice(base.length)
}
const fullPath = (path || '/') + window.location.search + window.location.hash
return normalizeURL(fullPath)
}
// Imported from path-to-regexp
/**
* Compile a string to a template function for the path.
*
* @param {string} str
* @param {Object=} options
* @return {!function(Object=, Object=)}
*/
export function compile (str, options) {
return tokensToFunction(parse(str, options), options)
}
export function getQueryDiff (toQuery, fromQuery) {
const diff = {}
const queries = { ...toQuery, ...fromQuery }
for (const k in queries) {
if (String(toQuery[k]) !== String(fromQuery[k])) {
diff[k] = true
}
}
return diff
}
export function normalizeError (err) {
let message
if (!(err.message || typeof err === 'string')) {
try {
message = JSON.stringify(err, null, 2)
} catch (e) {
message = `[${err.constructor.name}]`
}
} else {
message = err.message || err
}
return {
...err,
message,
statusCode: (err.statusCode || err.status || (err.response && err.response.status) || 500)
}
}
/**
* The main path matching regexp utility.
*
* @type {RegExp}
*/
const PATH_REGEXP = new RegExp([
// Match escaped characters that would otherwise appear in future matches.
// This allows the user to escape special characters that won't transform.
'(\\\\.)',
// Match Express-style parameters and un-named parameters with a prefix
// and optional suffixes. Matches appear as:
//
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
].join('|'), 'g')
/**
* Parse a string for the raw tokens.
*
* @param {string} str
* @param {Object=} options
* @return {!Array}
*/
function parse (str, options) {
const tokens = []
let key = 0
let index = 0
let path = ''
const defaultDelimiter = (options && options.delimiter) || '/'
let res
while ((res = PATH_REGEXP.exec(str)) != null) {
const m = res[0]
const escaped = res[1]
const offset = res.index
path += str.slice(index, offset)
index = offset + m.length
// Ignore already escaped sequences.
if (escaped) {
path += escaped[1]
continue
}
const next = str[index]
const prefix = res[2]
const name = res[3]
const capture = res[4]
const group = res[5]
const modifier = res[6]
const asterisk = res[7]
// Push the current path onto the tokens.
if (path) {
tokens.push(path)
path = ''
}
const partial = prefix != null && next != null && next !== prefix
const repeat = modifier === '+' || modifier === '*'
const optional = modifier === '?' || modifier === '*'
const delimiter = res[2] || defaultDelimiter
const pattern = capture || group
tokens.push({
name: name || key++,
prefix: prefix || '',
delimiter,
optional,
repeat,
partial,
asterisk: Boolean(asterisk),
pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
})
}
// Match any characters still remaining.
if (index < str.length) {
path += str.substr(index)
}
// If the path exists, push it onto the end.
if (path) {
tokens.push(path)
}
return tokens
}
/**
* Prettier encoding of URI path segments.
*
* @param {string}
* @return {string}
*/
function encodeURIComponentPretty (str, slashAllowed) {
const re = slashAllowed ? /[?#]/g : /[/?#]/g
return encodeURI(str).replace(re, (c) => {
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
})
}
/**
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
*
* @param {string}
* @return {string}
*/
function encodeAsterisk (str) {
return encodeURIComponentPretty(str, true)
}
/**
* Escape a regular expression string.
*
* @param {string} str
* @return {string}
*/
function escapeString (str) {
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1')
}
/**
* Escape the capturing group by escaping special characters and meaning.
*
* @param {string} group
* @return {string}
*/
function escapeGroup (group) {
return group.replace(/([=!:$/()])/g, '\\$1')
}
/**
* Expose a method for transforming tokens into the path function.
*/
function tokensToFunction (tokens, options) {
// Compile all the tokens into regexps.
const matches = new Array(tokens.length)
// Compile all the patterns before compilation.
for (let i = 0; i < tokens.length; i++) {
if (typeof tokens[i] === 'object') {
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options))
}
}
return function (obj, opts) {
let path = ''
const data = obj || {}
const options = opts || {}
const encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent
for (let i = 0; i < tokens.length; i++) {
const token = tokens[i]
if (typeof token === 'string') {
path += token
continue
}
const value = data[token.name || 'pathMatch']
let segment
if (value == null) {
if (token.optional) {
// Prepend partial segment prefixes.
if (token.partial) {
path += token.prefix
}
continue
} else {
throw new TypeError('Expected "' + token.name + '" to be defined')
}
}
if (Array.isArray(value)) {
if (!token.repeat) {
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
}
if (value.length === 0) {
if (token.optional) {
continue
} else {
throw new TypeError('Expected "' + token.name + '" to not be empty')
}
}
for (let j = 0; j < value.length; j++) {
segment = encode(value[j])
if (!matches[i].test(segment)) {
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
}
path += (j === 0 ? token.prefix : token.delimiter) + segment
}
continue
}
segment = token.asterisk ? encodeAsterisk(value) : encode(value)
if (!matches[i].test(segment)) {
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
}
path += token.prefix + segment
}
return path
}
}
/**
* Get the flags for a regexp from the options.
*
* @param {Object} options
* @return {string}
*/
function flags (options) {
return options && options.sensitive ? '' : 'i'
}
export function addLifecycleHook(vm, hook, fn) {
if (!vm.$options[hook]) {
vm.$options[hook] = []
}
if (!vm.$options[hook].includes(fn)) {
vm.$options[hook].push(fn)
}
}
export const urlJoin = joinURL
export const stripTrailingSlash = withoutTrailingSlash
export const isSamePath = _isSamePath
export function setScrollRestoration (newVal) {
try {
window.history.scrollRestoration = newVal;
} catch(e) {}
}
+1
View File
@@ -0,0 +1 @@
{}
+9
View File
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html {{ HTML_ATTRS }}>
<head {{ HEAD_ATTRS }}>
{{ HEAD }}
</head>
<body {{ BODY_ATTRS }}>
{{ APP }}
</body>
</html>
+23
View File
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Server error</title>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name=viewport>
<style>
.__nuxt-error-page{padding: 1rem;background:#f7f8fb;color:#47494e;text-align:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;font-family:sans-serif;font-weight:100!important;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;position:absolute;top:0;left:0;right:0;bottom:0}.__nuxt-error-page .error{max-width:450px}.__nuxt-error-page .title{font-size:24px;font-size:1.5rem;margin-top:15px;color:#47494e;margin-bottom:8px}.__nuxt-error-page .description{color:#7f828b;line-height:21px;margin-bottom:10px}.__nuxt-error-page a{color:#7f828b!important;text-decoration:none}.__nuxt-error-page .logo{position:fixed;left:12px;bottom:12px}
</style>
</head>
<body>
<div class="__nuxt-error-page">
<div class="error">
<svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" fill="#DBE1EC" viewBox="0 0 48 48"><path d="M22 30h4v4h-4zm0-16h4v12h-4zm1.99-10C12.94 4 4 12.95 4 24s8.94 20 19.99 20S44 35.05 44 24 35.04 4 23.99 4zM24 40c-8.84 0-16-7.16-16-16S15.16 8 24 8s16 7.16 16 16-7.16 16-16 16z"/></svg>
<div class="title">Server error</div>
<div class="description">An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.</div>
</div>
<div class="logo">
<a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt</a>
</div>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
export default {"theme":{"themes":{"dark":{"primary":"#1976d2","accent":"#424242","secondary":"#ff8f00","info":"#26a69a","warning":"#ffc107","error":"#dd2c00","success":"#00e676"}}}}
+19
View File
@@ -0,0 +1,19 @@
import Vue from 'vue'
import Vuetify from 'vuetify/lib/framework'
import options from './options'
Vue.use(Vuetify, {
})
export default (ctx) => {
const vuetifyOptions = typeof options === 'function' ? options(ctx) : options
vuetifyOptions.icons = vuetifyOptions.icons || {}
vuetifyOptions.icons.iconfont = 'mdi'
const vuetify = new Vuetify(vuetifyOptions)
ctx.app.vuetify = vuetify
ctx.$vuetify = vuetify.framework
}
+1 -1
View File
@@ -1,7 +1,7 @@
version: '3.2'
services:
web:
image: node:14
image: node:14.0-buster
command: ./start.sh
environment:
SUBMIT_ENDPOINT: 'https://api.contree.io/profile'
+1 -1
View File
@@ -7,7 +7,7 @@
:absolute="true"
app
)
span 亣白鯊 &amp; 徐忠豪 &amp; 都是同一人 &copy; {{ new Date().getFullYear() }}
span Contree &amp; X &amp; Digitalent &copy; {{ new Date().getFullYear() }}
</template>
<script>
+8 -13
View File
@@ -1,16 +1,11 @@
export interface IForm {
NAME: string,
FBNAME: string,
CARNUM: string,
yesorno: string,
CARCOLOR: string,
Phone: string,
VerifyNUM: string,
VerifySys: string,
WalletAddress: string,
VerifyRemarks: string,
LINEUserID: string,
NumberOfPeople: string,
NumberOfChild: string,
NumberOfBaby: string,
DAYS: string,
ROOM2: string,
ROOM4: string,
BANKACCOUNT: string
LINEdisplayName: string,
LINEpictureUrl: string,
LINEstatusMessage: string,
Veify_Checked: string
}
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../acorn/bin/acorn
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../ansi-html-community/bin/ansi-html
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../atob/bin/atob.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../autoprefixer/bin/autoprefixer
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../browserslist/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../update-browserslist-db/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../css-blank-pseudo/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../css-has-pseudo/cli.js
+1
View File
@@ -0,0 +1 @@
../css-prefers-color-scheme/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../cssesc/bin/cssesc
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../detect-libc/bin/detect-libc.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../errno/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../eslint/bin/eslint.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../esprima/bin/esparse.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../esprima/bin/esvalidate.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../flat/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../he/bin/he
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../html-minifier/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../html-minifier-terser/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../is-docker/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../jiti/bin/jiti.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../js-yaml/bin/js-yaml.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../jsesc/bin/jsesc
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../json5/lib/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../miller-rabin/bin/miller-rabin
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../mime/cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../mkdirp/bin/cmd.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../mustache/bin/mustache
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../nanoid/bin/nanoid.cjs
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../which/bin/node-which
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../nuxt/bin/nuxt.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../@nuxt/cli/bin/nuxt-cli.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../@nuxt/telemetry/bin/nuxt-telemetry.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../@nuxt/typescript-runtime/bin/nuxt-ts.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../@nuxt/typescript-runtime/bin/nuxt-ts.js
Generated Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../@nuxt/opencollective/bin/opencollective.js

Some files were not shown because too many files have changed in this diff Show More