update
This commit is contained in:
parent
befd344ab0
commit
06181b34d6
199
.nuxt/App.js
Normal file
199
.nuxt/App.js
Normal 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
.nuxt/axios.js
Normal file
193
.nuxt/axios.js
Normal 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
.nuxt/client.js
Normal file
644
.nuxt/client.js
Normal 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
.nuxt/components/index.js
Normal file
32
.nuxt/components/index.js
Normal 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
.nuxt/components/nuxt-child.js
Normal file
122
.nuxt/components/nuxt-child.js
Normal 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
.nuxt/components/nuxt-error.vue
Normal file
96
.nuxt/components/nuxt-error.vue
Normal 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
.nuxt/components/nuxt-link.client.js
Normal file
98
.nuxt/components/nuxt-link.client.js
Normal 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
.nuxt/components/nuxt-link.server.js
Normal file
16
.nuxt/components/nuxt-link.server.js
Normal 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
.nuxt/components/nuxt-loading.vue
Normal file
177
.nuxt/components/nuxt-loading.vue
Normal 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
.nuxt/components/nuxt.js
Normal file
101
.nuxt/components/nuxt.js
Normal 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
.nuxt/components/plugin.js
Normal file
7
.nuxt/components/plugin.js
Normal 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
.nuxt/components/readme.md
Normal file
7
.nuxt/components/readme.md
Normal 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
.nuxt/empty.js
Normal file
1
.nuxt/empty.js
Normal file
@ -0,0 +1 @@
|
||||
// This file is intentionally left empty for noop aliases
|
234
.nuxt/index.js
Normal file
234
.nuxt/index.js
Normal 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
.nuxt/jsonp.js
Normal file
82
.nuxt/jsonp.js
Normal 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
.nuxt/loading.html
Normal file
108
.nuxt/loading.html
Normal 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
.nuxt/middleware.js
Normal file
3
.nuxt/middleware.js
Normal file
@ -0,0 +1,3 @@
|
||||
const middleware = {}
|
||||
|
||||
export default middleware
|
90
.nuxt/mixins/fetch.client.js
Normal file
90
.nuxt/mixins/fetch.client.js
Normal 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
.nuxt/mixins/fetch.server.js
Normal file
65
.nuxt/mixins/fetch.server.js
Normal 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)
|
||||
}
|
||||
}
|
58
.nuxt/router.js
Normal file
58
.nuxt/router.js
Normal file
@ -0,0 +1,58 @@
|
||||
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 _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: "/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
.nuxt/router.scrollBehavior.js
Normal file
76
.nuxt/router.scrollBehavior.js
Normal 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)
|
||||
})
|
||||
})
|
||||
}
|
23
.nuxt/routes.json
Normal file
23
.nuxt/routes.json
Normal file
@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"name": "autofill",
|
||||
"path": "/autofill",
|
||||
"component": "/home/node/nuxt/pages/autofill.ts",
|
||||
"chunkName": "pages/autofill",
|
||||
"_name": "_4c4bd4da"
|
||||
},
|
||||
{
|
||||
"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
.nuxt/server.js
Normal file
268
.nuxt/server.js
Normal 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
.nuxt/utils.js
Normal file
627
.nuxt/utils.js
Normal 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
.nuxt/vetur/tags.json
Normal file
1
.nuxt/vetur/tags.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
9
.nuxt/views/app.template.html
Normal file
9
.nuxt/views/app.template.html
Normal file
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html {{ HTML_ATTRS }}>
|
||||
<head {{ HEAD_ATTRS }}>
|
||||
{{ HEAD }}
|
||||
</head>
|
||||
<body {{ BODY_ATTRS }}>
|
||||
{{ APP }}
|
||||
</body>
|
||||
</html>
|
23
.nuxt/views/error.html
Normal file
23
.nuxt/views/error.html
Normal 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
.nuxt/vuetify/options.js
Normal file
1
.nuxt/vuetify/options.js
Normal file
@ -0,0 +1 @@
|
||||
export default {"theme":{"themes":{"dark":{"primary":"#1976d2","accent":"#424242","secondary":"#ff8f00","info":"#26a69a","warning":"#ffc107","error":"#dd2c00","success":"#00e676"}}}}
|
19
.nuxt/vuetify/plugin.js
Normal file
19
.nuxt/vuetify/plugin.js
Normal 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
|
||||
}
|
@ -4,7 +4,7 @@ services:
|
||||
image: node:14
|
||||
command: ./start.sh
|
||||
environment:
|
||||
SUBMIT_ENDPOINT: 'https://json_2series.digitalent.tw/users'
|
||||
SUBMIT_ENDPOINT: 'https://api.contree.io/profile'
|
||||
RMLINK_ENDPOINT: ''
|
||||
working_dir: /home/node/nuxt
|
||||
volumes:
|
||||
|
2
node_modules/.bin/ansi-html
generated
vendored
2
node_modules/.bin/ansi-html
generated
vendored
@ -1 +1 @@
|
||||
../ansi-html/bin/ansi-html
|
||||
../ansi-html-community/bin/ansi-html
|
1
node_modules/.bin/browserslist-lint
generated
vendored
Symbolic link
1
node_modules/.bin/browserslist-lint
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../update-browserslist-db/cli.js
|
1
node_modules/.bin/is-docker
generated
vendored
Symbolic link
1
node_modules/.bin/is-docker
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../is-docker/cli.js
|
1
node_modules/.bin/jiti
generated
vendored
Symbolic link
1
node_modules/.bin/jiti
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../jiti/bin/jiti.js
|
1
node_modules/.bin/resolve
generated
vendored
Symbolic link
1
node_modules/.bin/resolve
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../resolve/bin/resolve
|
17362
node_modules/.package-lock.json
generated
vendored
Normal file
17362
node_modules/.package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
202
node_modules/@ampproject/remapping/LICENSE
generated
vendored
Normal file
202
node_modules/@ampproject/remapping/LICENSE
generated
vendored
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Google LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
218
node_modules/@ampproject/remapping/README.md
generated
vendored
Normal file
218
node_modules/@ampproject/remapping/README.md
generated
vendored
Normal file
@ -0,0 +1,218 @@
|
||||
# @ampproject/remapping
|
||||
|
||||
> Remap sequential sourcemaps through transformations to point at the original source code
|
||||
|
||||
Remapping allows you to take the sourcemaps generated through transforming your code and "remap"
|
||||
them to the original source locations. Think "my minified code, transformed with babel and bundled
|
||||
with webpack", all pointing to the correct location in your original source code.
|
||||
|
||||
With remapping, none of your source code transformations need to be aware of the input's sourcemap,
|
||||
they only need to generate an output sourcemap. This greatly simplifies building custom
|
||||
transformations (think a find-and-replace).
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install @ampproject/remapping
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
function remapping(
|
||||
map: SourceMap | SourceMap[],
|
||||
loader: (file: string, ctx: LoaderContext) => (SourceMap | null | undefined),
|
||||
options?: { excludeContent: boolean, decodedMappings: boolean }
|
||||
): SourceMap;
|
||||
|
||||
// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the
|
||||
// "source" location (where child sources are resolved relative to, or the location of original
|
||||
// source), and the ability to override the "content" of an original source for inclusion in the
|
||||
// output sourcemap.
|
||||
type LoaderContext = {
|
||||
readonly importer: string;
|
||||
readonly depth: number;
|
||||
source: string;
|
||||
content: string | null | undefined;
|
||||
}
|
||||
```
|
||||
|
||||
`remapping` takes the final output sourcemap, and a `loader` function. For every source file pointer
|
||||
in the sourcemap, the `loader` will be called with the resolved path. If the path itself represents
|
||||
a transformed file (it has a sourcmap associated with it), then the `loader` should return that
|
||||
sourcemap. If not, the path will be treated as an original, untransformed source code.
|
||||
|
||||
```js
|
||||
// Babel transformed "helloworld.js" into "transformed.js"
|
||||
const transformedMap = JSON.stringify({
|
||||
file: 'transformed.js',
|
||||
// 1st column of 2nd line of output file translates into the 1st source
|
||||
// file, line 3, column 2
|
||||
mappings: ';CAEE',
|
||||
sources: ['helloworld.js'],
|
||||
version: 3,
|
||||
});
|
||||
|
||||
// Uglify minified "transformed.js" into "transformed.min.js"
|
||||
const minifiedTransformedMap = JSON.stringify({
|
||||
file: 'transformed.min.js',
|
||||
// 0th column of 1st line of output file translates into the 1st source
|
||||
// file, line 2, column 1.
|
||||
mappings: 'AACC',
|
||||
names: [],
|
||||
sources: ['transformed.js'],
|
||||
version: 3,
|
||||
});
|
||||
|
||||
const remapped = remapping(
|
||||
minifiedTransformedMap,
|
||||
(file, ctx) => {
|
||||
|
||||
// The "transformed.js" file is an transformed file.
|
||||
if (file === 'transformed.js') {
|
||||
// The root importer is empty.
|
||||
console.assert(ctx.importer === '');
|
||||
// The depth in the sourcemap tree we're currently loading.
|
||||
// The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc.
|
||||
console.assert(ctx.depth === 1);
|
||||
|
||||
return transformedMap;
|
||||
}
|
||||
|
||||
// Loader will be called to load transformedMap's source file pointers as well.
|
||||
console.assert(file === 'helloworld.js');
|
||||
// `transformed.js`'s sourcemap points into `helloworld.js`.
|
||||
console.assert(ctx.importer === 'transformed.js');
|
||||
// This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`.
|
||||
console.assert(ctx.depth === 2);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// file: 'transpiled.min.js',
|
||||
// mappings: 'AAEE',
|
||||
// sources: ['helloworld.js'],
|
||||
// version: 3,
|
||||
// };
|
||||
```
|
||||
|
||||
In this example, `loader` will be called twice:
|
||||
|
||||
1. `"transformed.js"`, the first source file pointer in the `minifiedTransformedMap`. We return the
|
||||
associated sourcemap for it (its a transformed file, after all) so that sourcemap locations can
|
||||
be traced through it into the source files it represents.
|
||||
2. `"helloworld.js"`, our original, unmodified source code. This file does not have a sourcemap, so
|
||||
we return `null`.
|
||||
|
||||
The `remapped` sourcemap now points from `transformed.min.js` into locations in `helloworld.js`. If
|
||||
you were to read the `mappings`, it says "0th column of the first line output line points to the 1st
|
||||
column of the 2nd line of the file `helloworld.js`".
|
||||
|
||||
### Multiple transformations of a file
|
||||
|
||||
As a convenience, if you have multiple single-source transformations of a file, you may pass an
|
||||
array of sourcemap files in the order of most-recent transformation sourcemap first. Note that this
|
||||
changes the `importer` and `depth` of each call to our loader. So our above example could have been
|
||||
written as:
|
||||
|
||||
```js
|
||||
const remapped = remapping(
|
||||
[minifiedTransformedMap, transformedMap],
|
||||
() => null
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// file: 'transpiled.min.js',
|
||||
// mappings: 'AAEE',
|
||||
// sources: ['helloworld.js'],
|
||||
// version: 3,
|
||||
// };
|
||||
```
|
||||
|
||||
### Advanced control of the loading graph
|
||||
|
||||
#### `source`
|
||||
|
||||
The `source` property can overridden to any value to change the location of the current load. Eg,
|
||||
for an original source file, it allows us to change the location to the original source regardless
|
||||
of what the sourcemap source entry says. And for transformed files, it allows us to change the
|
||||
relative resolving location for child sources of the loaded sourcemap.
|
||||
|
||||
```js
|
||||
const remapped = remapping(
|
||||
minifiedTransformedMap,
|
||||
(file, ctx) => {
|
||||
|
||||
if (file === 'transformed.js') {
|
||||
// We pretend the transformed.js file actually exists in the 'src/' directory. When the nested
|
||||
// source files are loaded, they will now be relative to `src/`.
|
||||
ctx.source = 'src/transformed.js';
|
||||
return transformedMap;
|
||||
}
|
||||
|
||||
console.assert(file === 'src/helloworld.js');
|
||||
// We could futher change the source of this original file, eg, to be inside a nested directory
|
||||
// itself. This will be reflected in the remapped sourcemap.
|
||||
ctx.source = 'src/nested/transformed.js';
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// …,
|
||||
// sources: ['src/nested/helloworld.js'],
|
||||
// };
|
||||
```
|
||||
|
||||
|
||||
#### `content`
|
||||
|
||||
The `content` property can be overridden when we encounter an original source file. Eg, this allows
|
||||
you to manually provide the source content of the original file regardless of whether the
|
||||
`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove
|
||||
the source content.
|
||||
|
||||
```js
|
||||
const remapped = remapping(
|
||||
minifiedTransformedMap,
|
||||
(file, ctx) => {
|
||||
|
||||
if (file === 'transformed.js') {
|
||||
// transformedMap does not include a `sourcesContent` field, so usually the remapped sourcemap
|
||||
// would not include any `sourcesContent` values.
|
||||
return transformedMap;
|
||||
}
|
||||
|
||||
console.assert(file === 'helloworld.js');
|
||||
// We can read the file to provide the source content.
|
||||
ctx.content = fs.readFileSync(file, 'utf8');
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// …,
|
||||
// sourcesContent: [
|
||||
// 'console.log("Hello world!")',
|
||||
// ],
|
||||
// };
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
#### excludeContent
|
||||
|
||||
By default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the
|
||||
`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce
|
||||
the size out the sourcemap.
|
||||
|
||||
#### decodedMappings
|
||||
|
||||
By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the
|
||||
`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of
|
||||
encoding into a VLQ string.
|
204
node_modules/@ampproject/remapping/dist/remapping.mjs
generated
vendored
Normal file
204
node_modules/@ampproject/remapping/dist/remapping.mjs
generated
vendored
Normal file
@ -0,0 +1,204 @@
|
||||
import { decodedMappings, traceSegment, TraceMap } from '@jridgewell/trace-mapping';
|
||||
import { GenMapping, addSegment, setSourceContent, decodedMap, encodedMap } from '@jridgewell/gen-mapping';
|
||||
|
||||
const SOURCELESS_MAPPING = {
|
||||
source: null,
|
||||
column: null,
|
||||
line: null,
|
||||
name: null,
|
||||
content: null,
|
||||
};
|
||||
const EMPTY_SOURCES = [];
|
||||
function Source(map, sources, source, content) {
|
||||
return {
|
||||
map,
|
||||
sources,
|
||||
source,
|
||||
content,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
||||
* (which may themselves be SourceMapTrees).
|
||||
*/
|
||||
function MapSource(map, sources) {
|
||||
return Source(map, sources, '', null);
|
||||
}
|
||||
/**
|
||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
||||
* segment tracing ends at the `OriginalSource`.
|
||||
*/
|
||||
function OriginalSource(source, content) {
|
||||
return Source(null, EMPTY_SOURCES, source, content);
|
||||
}
|
||||
/**
|
||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
||||
* resolving each mapping in terms of the original source files.
|
||||
*/
|
||||
function traceMappings(tree) {
|
||||
const gen = new GenMapping({ file: tree.map.file });
|
||||
const { sources: rootSources, map } = tree;
|
||||
const rootNames = map.names;
|
||||
const rootMappings = decodedMappings(map);
|
||||
for (let i = 0; i < rootMappings.length; i++) {
|
||||
const segments = rootMappings[i];
|
||||
let lastSource = null;
|
||||
let lastSourceLine = null;
|
||||
let lastSourceColumn = null;
|
||||
for (let j = 0; j < segments.length; j++) {
|
||||
const segment = segments[j];
|
||||
const genCol = segment[0];
|
||||
let traced = SOURCELESS_MAPPING;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length !== 1) {
|
||||
const source = rootSources[segment[1]];
|
||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
||||
// respective segment into an original source.
|
||||
if (traced == null)
|
||||
continue;
|
||||
}
|
||||
// So we traced a segment down into its original source file. Now push a
|
||||
// new segment pointing to this location.
|
||||
const { column, line, name, content, source } = traced;
|
||||
if (line === lastSourceLine && column === lastSourceColumn && source === lastSource) {
|
||||
continue;
|
||||
}
|
||||
lastSourceLine = line;
|
||||
lastSourceColumn = column;
|
||||
lastSource = source;
|
||||
// Sigh, TypeScript can't figure out source/line/column are either all null, or all non-null...
|
||||
addSegment(gen, i, genCol, source, line, column, name);
|
||||
if (content != null)
|
||||
setSourceContent(gen, source, content);
|
||||
}
|
||||
}
|
||||
return gen;
|
||||
}
|
||||
/**
|
||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
||||
* child SourceMapTrees, until we find the original source map.
|
||||
*/
|
||||
function originalPositionFor(source, line, column, name) {
|
||||
if (!source.map) {
|
||||
return { column, line, name, source: source.source, content: source.content };
|
||||
}
|
||||
const segment = traceSegment(source.map, line, column);
|
||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
||||
if (segment == null)
|
||||
return null;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length === 1)
|
||||
return SOURCELESS_MAPPING;
|
||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
||||
}
|
||||
|
||||
function asArray(value) {
|
||||
if (Array.isArray(value))
|
||||
return value;
|
||||
return [value];
|
||||
}
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
function buildSourceMapTree(input, loader) {
|
||||
const maps = asArray(input).map((m) => new TraceMap(m, ''));
|
||||
const map = maps.pop();
|
||||
for (let i = 0; i < maps.length; i++) {
|
||||
if (maps[i].sources.length > 1) {
|
||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
||||
'Did you specify these with the most recent transformation maps first?');
|
||||
}
|
||||
}
|
||||
let tree = build(map, loader, '', 0);
|
||||
for (let i = maps.length - 1; i >= 0; i--) {
|
||||
tree = MapSource(maps[i], [tree]);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
function build(map, loader, importer, importerDepth) {
|
||||
const { resolvedSources, sourcesContent } = map;
|
||||
const depth = importerDepth + 1;
|
||||
const children = resolvedSources.map((sourceFile, i) => {
|
||||
// The loading context gives the loader more information about why this file is being loaded
|
||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
||||
// an unmodified source file.
|
||||
const ctx = {
|
||||
importer,
|
||||
depth,
|
||||
source: sourceFile || '',
|
||||
content: undefined,
|
||||
};
|
||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
||||
// TODO: We should eventually support async loading of sourcemap files.
|
||||
const sourceMap = loader(ctx.source, ctx);
|
||||
const { source, content } = ctx;
|
||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
||||
if (sourceMap)
|
||||
return build(new TraceMap(sourceMap, source), loader, source, depth);
|
||||
// Else, it's an an unmodified source file.
|
||||
// The contents of this unmodified source file can be overridden via the loader context,
|
||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
||||
// the importing sourcemap's `sourcesContent` field.
|
||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
||||
return OriginalSource(source, sourceContent);
|
||||
});
|
||||
return MapSource(map, children);
|
||||
}
|
||||
|
||||
/**
|
||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
||||
* provided to it.
|
||||
*/
|
||||
class SourceMap {
|
||||
constructor(map, options) {
|
||||
const out = options.decodedMappings ? decodedMap(map) : encodedMap(map);
|
||||
this.version = out.version; // SourceMap spec says this should be first.
|
||||
this.file = out.file;
|
||||
this.mappings = out.mappings;
|
||||
this.names = out.names;
|
||||
this.sourceRoot = out.sourceRoot;
|
||||
this.sources = out.sources;
|
||||
if (!options.excludeContent) {
|
||||
this.sourcesContent = out.sourcesContent;
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return JSON.stringify(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traces through all the mappings in the root sourcemap, through the sources
|
||||
* (and their sourcemaps), all the way back to the original source location.
|
||||
*
|
||||
* `loader` will be called every time we encounter a source file. If it returns
|
||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
||||
* it returns a falsey value, that source file is treated as an original,
|
||||
* unmodified source file.
|
||||
*
|
||||
* Pass `excludeContent` to exclude any self-containing source file content
|
||||
* from the output sourcemap.
|
||||
*
|
||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
||||
* VLQ encoded) mappings.
|
||||
*/
|
||||
function remapping(input, loader, options) {
|
||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
||||
const tree = buildSourceMapTree(input, loader);
|
||||
return new SourceMap(traceMappings(tree), opts);
|
||||
}
|
||||
|
||||
export { remapping as default };
|
||||
//# sourceMappingURL=remapping.mjs.map
|
1
node_modules/@ampproject/remapping/dist/remapping.mjs.map
generated
vendored
Normal file
1
node_modules/@ampproject/remapping/dist/remapping.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
209
node_modules/@ampproject/remapping/dist/remapping.umd.js
generated
vendored
Normal file
209
node_modules/@ampproject/remapping/dist/remapping.umd.js
generated
vendored
Normal file
@ -0,0 +1,209 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@jridgewell/trace-mapping'), require('@jridgewell/gen-mapping')) :
|
||||
typeof define === 'function' && define.amd ? define(['@jridgewell/trace-mapping', '@jridgewell/gen-mapping'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.remapping = factory(global.traceMapping, global.genMapping));
|
||||
})(this, (function (traceMapping, genMapping) { 'use strict';
|
||||
|
||||
const SOURCELESS_MAPPING = {
|
||||
source: null,
|
||||
column: null,
|
||||
line: null,
|
||||
name: null,
|
||||
content: null,
|
||||
};
|
||||
const EMPTY_SOURCES = [];
|
||||
function Source(map, sources, source, content) {
|
||||
return {
|
||||
map,
|
||||
sources,
|
||||
source,
|
||||
content,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
||||
* (which may themselves be SourceMapTrees).
|
||||
*/
|
||||
function MapSource(map, sources) {
|
||||
return Source(map, sources, '', null);
|
||||
}
|
||||
/**
|
||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
||||
* segment tracing ends at the `OriginalSource`.
|
||||
*/
|
||||
function OriginalSource(source, content) {
|
||||
return Source(null, EMPTY_SOURCES, source, content);
|
||||
}
|
||||
/**
|
||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
||||
* resolving each mapping in terms of the original source files.
|
||||
*/
|
||||
function traceMappings(tree) {
|
||||
const gen = new genMapping.GenMapping({ file: tree.map.file });
|
||||
const { sources: rootSources, map } = tree;
|
||||
const rootNames = map.names;
|
||||
const rootMappings = traceMapping.decodedMappings(map);
|
||||
for (let i = 0; i < rootMappings.length; i++) {
|
||||
const segments = rootMappings[i];
|
||||
let lastSource = null;
|
||||
let lastSourceLine = null;
|
||||
let lastSourceColumn = null;
|
||||
for (let j = 0; j < segments.length; j++) {
|
||||
const segment = segments[j];
|
||||
const genCol = segment[0];
|
||||
let traced = SOURCELESS_MAPPING;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length !== 1) {
|
||||
const source = rootSources[segment[1]];
|
||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
||||
// respective segment into an original source.
|
||||
if (traced == null)
|
||||
continue;
|
||||
}
|
||||
// So we traced a segment down into its original source file. Now push a
|
||||
// new segment pointing to this location.
|
||||
const { column, line, name, content, source } = traced;
|
||||
if (line === lastSourceLine && column === lastSourceColumn && source === lastSource) {
|
||||
continue;
|
||||
}
|
||||
lastSourceLine = line;
|
||||
lastSourceColumn = column;
|
||||
lastSource = source;
|
||||
// Sigh, TypeScript can't figure out source/line/column are either all null, or all non-null...
|
||||
genMapping.addSegment(gen, i, genCol, source, line, column, name);
|
||||
if (content != null)
|
||||
genMapping.setSourceContent(gen, source, content);
|
||||
}
|
||||
}
|
||||
return gen;
|
||||
}
|
||||
/**
|
||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
||||
* child SourceMapTrees, until we find the original source map.
|
||||
*/
|
||||
function originalPositionFor(source, line, column, name) {
|
||||
if (!source.map) {
|
||||
return { column, line, name, source: source.source, content: source.content };
|
||||
}
|
||||
const segment = traceMapping.traceSegment(source.map, line, column);
|
||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
||||
if (segment == null)
|
||||
return null;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length === 1)
|
||||
return SOURCELESS_MAPPING;
|
||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
||||
}
|
||||
|
||||
function asArray(value) {
|
||||
if (Array.isArray(value))
|
||||
return value;
|
||||
return [value];
|
||||
}
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
function buildSourceMapTree(input, loader) {
|
||||
const maps = asArray(input).map((m) => new traceMapping.TraceMap(m, ''));
|
||||
const map = maps.pop();
|
||||
for (let i = 0; i < maps.length; i++) {
|
||||
if (maps[i].sources.length > 1) {
|
||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
||||
'Did you specify these with the most recent transformation maps first?');
|
||||
}
|
||||
}
|
||||
let tree = build(map, loader, '', 0);
|
||||
for (let i = maps.length - 1; i >= 0; i--) {
|
||||
tree = MapSource(maps[i], [tree]);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
function build(map, loader, importer, importerDepth) {
|
||||
const { resolvedSources, sourcesContent } = map;
|
||||
const depth = importerDepth + 1;
|
||||
const children = resolvedSources.map((sourceFile, i) => {
|
||||
// The loading context gives the loader more information about why this file is being loaded
|
||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
||||
// an unmodified source file.
|
||||
const ctx = {
|
||||
importer,
|
||||
depth,
|
||||
source: sourceFile || '',
|
||||
content: undefined,
|
||||
};
|
||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
||||
// TODO: We should eventually support async loading of sourcemap files.
|
||||
const sourceMap = loader(ctx.source, ctx);
|
||||
const { source, content } = ctx;
|
||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
||||
if (sourceMap)
|
||||
return build(new traceMapping.TraceMap(sourceMap, source), loader, source, depth);
|
||||
// Else, it's an an unmodified source file.
|
||||
// The contents of this unmodified source file can be overridden via the loader context,
|
||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
||||
// the importing sourcemap's `sourcesContent` field.
|
||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
||||
return OriginalSource(source, sourceContent);
|
||||
});
|
||||
return MapSource(map, children);
|
||||
}
|
||||
|
||||
/**
|
||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
||||
* provided to it.
|
||||
*/
|
||||
class SourceMap {
|
||||
constructor(map, options) {
|
||||
const out = options.decodedMappings ? genMapping.decodedMap(map) : genMapping.encodedMap(map);
|
||||
this.version = out.version; // SourceMap spec says this should be first.
|
||||
this.file = out.file;
|
||||
this.mappings = out.mappings;
|
||||
this.names = out.names;
|
||||
this.sourceRoot = out.sourceRoot;
|
||||
this.sources = out.sources;
|
||||
if (!options.excludeContent) {
|
||||
this.sourcesContent = out.sourcesContent;
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return JSON.stringify(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traces through all the mappings in the root sourcemap, through the sources
|
||||
* (and their sourcemaps), all the way back to the original source location.
|
||||
*
|
||||
* `loader` will be called every time we encounter a source file. If it returns
|
||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
||||
* it returns a falsey value, that source file is treated as an original,
|
||||
* unmodified source file.
|
||||
*
|
||||
* Pass `excludeContent` to exclude any self-containing source file content
|
||||
* from the output sourcemap.
|
||||
*
|
||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
||||
* VLQ encoded) mappings.
|
||||
*/
|
||||
function remapping(input, loader, options) {
|
||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
||||
const tree = buildSourceMapTree(input, loader);
|
||||
return new SourceMap(traceMappings(tree), opts);
|
||||
}
|
||||
|
||||
return remapping;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=remapping.umd.js.map
|
1
node_modules/@ampproject/remapping/dist/remapping.umd.js.map
generated
vendored
Normal file
1
node_modules/@ampproject/remapping/dist/remapping.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts
generated
vendored
Normal file
14
node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
import type { MapSource as MapSourceType } from './source-map-tree';
|
||||
import type { SourceMapInput, SourceMapLoader } from './types';
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
export default function buildSourceMapTree(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader): MapSourceType;
|
19
node_modules/@ampproject/remapping/dist/types/remapping.d.ts
generated
vendored
Normal file
19
node_modules/@ampproject/remapping/dist/types/remapping.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import SourceMap from './source-map';
|
||||
import type { SourceMapInput, SourceMapLoader, Options } from './types';
|
||||
export type { SourceMapSegment, EncodedSourceMap, EncodedSourceMap as RawSourceMap, DecodedSourceMap, SourceMapInput, SourceMapLoader, LoaderContext, Options, } from './types';
|
||||
/**
|
||||
* Traces through all the mappings in the root sourcemap, through the sources
|
||||
* (and their sourcemaps), all the way back to the original source location.
|
||||
*
|
||||
* `loader` will be called every time we encounter a source file. If it returns
|
||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
||||
* it returns a falsey value, that source file is treated as an original,
|
||||
* unmodified source file.
|
||||
*
|
||||
* Pass `excludeContent` to exclude any self-containing source file content
|
||||
* from the output sourcemap.
|
||||
*
|
||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
||||
* VLQ encoded) mappings.
|
||||
*/
|
||||
export default function remapping(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader, options?: boolean | Options): SourceMap;
|
48
node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts
generated
vendored
Normal file
48
node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
import { GenMapping } from '@jridgewell/gen-mapping';
|
||||
import type { TraceMap } from '@jridgewell/trace-mapping';
|
||||
export declare type SourceMapSegmentObject = {
|
||||
column: number;
|
||||
line: number;
|
||||
name: string;
|
||||
source: string;
|
||||
content: string | null;
|
||||
} | {
|
||||
column: null;
|
||||
line: null;
|
||||
name: null;
|
||||
source: null;
|
||||
content: null;
|
||||
};
|
||||
export declare type OriginalSource = {
|
||||
map: TraceMap;
|
||||
sources: Sources[];
|
||||
source: string;
|
||||
content: string | null;
|
||||
};
|
||||
export declare type MapSource = {
|
||||
map: TraceMap;
|
||||
sources: Sources[];
|
||||
source: string;
|
||||
content: string | null;
|
||||
};
|
||||
export declare type Sources = OriginalSource | MapSource;
|
||||
/**
|
||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
||||
* (which may themselves be SourceMapTrees).
|
||||
*/
|
||||
export declare function MapSource(map: TraceMap, sources: Sources[]): MapSource;
|
||||
/**
|
||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
||||
* segment tracing ends at the `OriginalSource`.
|
||||
*/
|
||||
export declare function OriginalSource(source: string, content: string | null): OriginalSource;
|
||||
/**
|
||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
||||
* resolving each mapping in terms of the original source files.
|
||||
*/
|
||||
export declare function traceMappings(tree: MapSource): GenMapping;
|
||||
/**
|
||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
||||
* child SourceMapTrees, until we find the original source map.
|
||||
*/
|
||||
export declare function originalPositionFor(source: Sources, line: number, column: number, name: string): SourceMapSegmentObject | null;
|
17
node_modules/@ampproject/remapping/dist/types/source-map.d.ts
generated
vendored
Normal file
17
node_modules/@ampproject/remapping/dist/types/source-map.d.ts
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
import type { GenMapping } from '@jridgewell/gen-mapping';
|
||||
import type { DecodedSourceMap, EncodedSourceMap, Options } from './types';
|
||||
/**
|
||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
||||
* provided to it.
|
||||
*/
|
||||
export default class SourceMap {
|
||||
file?: string | null;
|
||||
mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings'];
|
||||
sourceRoot?: string;
|
||||
names: string[];
|
||||
sources: (string | null)[];
|
||||
sourcesContent?: (string | null)[];
|
||||
version: 3;
|
||||
constructor(map: GenMapping, options: Options);
|
||||
toString(): string;
|
||||
}
|
14
node_modules/@ampproject/remapping/dist/types/types.d.ts
generated
vendored
Normal file
14
node_modules/@ampproject/remapping/dist/types/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
import type { SourceMapInput } from '@jridgewell/trace-mapping';
|
||||
export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping';
|
||||
export type { SourceMapInput };
|
||||
export declare type LoaderContext = {
|
||||
readonly importer: string;
|
||||
readonly depth: number;
|
||||
source: string;
|
||||
content: string | null | undefined;
|
||||
};
|
||||
export declare type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void;
|
||||
export declare type Options = {
|
||||
excludeContent?: boolean;
|
||||
decodedMappings?: boolean;
|
||||
};
|
99
node_modules/@ampproject/remapping/package.json
generated
vendored
Normal file
99
node_modules/@ampproject/remapping/package.json
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@ampproject/remapping@2.2.0",
|
||||
"/home/node/nuxt"
|
||||
]
|
||||
],
|
||||
"_from": "@ampproject/remapping@2.2.0",
|
||||
"_id": "@ampproject/remapping@2.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==",
|
||||
"_location": "/@ampproject/remapping",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@ampproject/remapping@2.2.0",
|
||||
"name": "@ampproject/remapping",
|
||||
"escapedName": "@ampproject%2fremapping",
|
||||
"scope": "@ampproject",
|
||||
"rawSpec": "2.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz",
|
||||
"_spec": "2.2.0",
|
||||
"_where": "/home/node/nuxt",
|
||||
"author": {
|
||||
"name": "Justin Ridgewell",
|
||||
"email": "jridgewell@google.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ampproject/remapping/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.1.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
},
|
||||
"description": "Remap sequential sourcemaps through transformations to point at the original source code",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "8.3.2",
|
||||
"@types/jest": "27.4.1",
|
||||
"@typescript-eslint/eslint-plugin": "5.20.0",
|
||||
"@typescript-eslint/parser": "5.20.0",
|
||||
"eslint": "8.14.0",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"jest": "27.5.1",
|
||||
"jest-config": "27.5.1",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.6.2",
|
||||
"rollup": "2.70.2",
|
||||
"ts-jest": "27.1.4",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/ampproject/remapping#readme",
|
||||
"keywords": [
|
||||
"source",
|
||||
"map",
|
||||
"remap"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/remapping.umd.js",
|
||||
"module": "dist/remapping.mjs",
|
||||
"name": "@ampproject/remapping",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ampproject/remapping.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "run-s -n build:*",
|
||||
"build:rollup": "rollup -c rollup.config.js",
|
||||
"build:ts": "tsc --project tsconfig.build.json",
|
||||
"lint": "run-s -n lint:*",
|
||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
||||
"prebuild": "rm -rf dist",
|
||||
"prepublishOnly": "npm run preversion",
|
||||
"preversion": "run-s test build",
|
||||
"test": "run-s -n test:lint test:only",
|
||||
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
||||
"test:lint": "run-s -n test:lint:*",
|
||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
||||
"test:only": "jest --coverage",
|
||||
"test:watch": "jest --coverage --watch"
|
||||
},
|
||||
"typings": "dist/types/remapping.d.ts",
|
||||
"version": "2.2.0"
|
||||
}
|
2
node_modules/@babel/code-frame/README.md
generated
vendored
2
node_modules/@babel/code-frame/README.md
generated
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
> Generate errors that contain a code frame that point to source locations.
|
||||
|
||||
See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information.
|
||||
See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
|
16
node_modules/@babel/code-frame/lib/index.js
generated
vendored
16
node_modules/@babel/code-frame/lib/index.js
generated
vendored
@ -6,11 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.codeFrameColumns = codeFrameColumns;
|
||||
exports.default = _default;
|
||||
|
||||
var _highlight = _interopRequireWildcard(require("@babel/highlight"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
var _highlight = require("@babel/highlight");
|
||||
|
||||
let deprecationWarningShown = false;
|
||||
|
||||
@ -105,10 +101,10 @@ function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end).length;
|
||||
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
||||
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
|
||||
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||
const gutter = ` ${paddedNumber} | `;
|
||||
const gutter = ` ${paddedNumber} |`;
|
||||
const hasMarker = markerLines[number];
|
||||
const lastMarkerLine = !markerLines[number + 1];
|
||||
|
||||
@ -118,16 +114,16 @@ function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
if (Array.isArray(hasMarker)) {
|
||||
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||
const numberOfMarkers = hasMarker[1] || 1;
|
||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
||||
|
||||
if (lastMarkerLine && opts.message) {
|
||||
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
||||
}
|
||||
}
|
||||
|
||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
|
||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
|
||||
} else {
|
||||
return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
|
||||
return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
||||
}
|
||||
}).join("\n");
|
||||
|
||||
|
42
node_modules/@babel/code-frame/package.json
generated
vendored
42
node_modules/@babel/code-frame/package.json
generated
vendored
@ -1,26 +1,26 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/code-frame@7.10.4",
|
||||
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
|
||||
"@babel/code-frame@7.18.6",
|
||||
"/home/node/nuxt"
|
||||
]
|
||||
],
|
||||
"_from": "@babel/code-frame@7.10.4",
|
||||
"_id": "@babel/code-frame@7.10.4",
|
||||
"_from": "@babel/code-frame@7.18.6",
|
||||
"_id": "@babel/code-frame@7.18.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
|
||||
"_integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==",
|
||||
"_location": "/@babel/code-frame",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/code-frame@7.10.4",
|
||||
"raw": "@babel/code-frame@7.18.6",
|
||||
"name": "@babel/code-frame",
|
||||
"escapedName": "@babel%2fcode-frame",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.10.4",
|
||||
"rawSpec": "7.18.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.10.4"
|
||||
"fetchSpec": "7.18.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/core",
|
||||
@ -31,28 +31,31 @@
|
||||
"/eslint-plugin-unicorn/parse-json",
|
||||
"/fork-ts-checker-webpack-plugin"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
|
||||
"_spec": "7.10.4",
|
||||
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
|
||||
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz",
|
||||
"_spec": "7.18.6",
|
||||
"_where": "/home/node/nuxt",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
"name": "The Babel Team",
|
||||
"url": "https://babel.dev/team"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
"url": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.10.4"
|
||||
"@babel/highlight": "^7.18.6"
|
||||
},
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"devDependencies": {
|
||||
"@types/chalk": "^2.0.0",
|
||||
"chalk": "^2.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"main": "./lib/index.js",
|
||||
"name": "@babel/code-frame",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@ -62,5 +65,6 @@
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-code-frame"
|
||||
},
|
||||
"version": "7.10.4"
|
||||
"type": "commonjs",
|
||||
"version": "7.18.6"
|
||||
}
|
||||
|
19
node_modules/@babel/compat-data/README.md
generated
vendored
Normal file
19
node_modules/@babel/compat-data/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# @babel/compat-data
|
||||
|
||||
>
|
||||
|
||||
See our website [@babel/compat-data](https://babeljs.io/docs/en/babel-compat-data) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/compat-data
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/compat-data
|
||||
```
|
3
node_modules/@babel/compat-data/corejs2-built-ins.js
generated
vendored
3
node_modules/@babel/compat-data/corejs2-built-ins.js
generated
vendored
@ -1,4 +1 @@
|
||||
// Node < 13.3 doesn't support export maps in package.json.
|
||||
// Use this proxy file as a fallback.
|
||||
|
||||
module.exports = require("./data/corejs2-built-ins.json");
|
||||
|
3
node_modules/@babel/compat-data/corejs3-shipped-proposals.js
generated
vendored
3
node_modules/@babel/compat-data/corejs3-shipped-proposals.js
generated
vendored
@ -1,4 +1 @@
|
||||
// Node < 13.3 doesn't support export maps in package.json.
|
||||
// Use this proxy file as a fallback.
|
||||
|
||||
module.exports = require("./data/corejs3-shipped-proposals.json");
|
||||
|
349
node_modules/@babel/compat-data/data/corejs2-built-ins.json
generated
vendored
349
node_modules/@babel/compat-data/data/corejs2-built-ins.json
generated
vendored
File diff suppressed because it is too large
Load Diff
19
node_modules/@babel/compat-data/data/native-modules.json
generated
vendored
19
node_modules/@babel/compat-data/data/native-modules.json
generated
vendored
@ -1,15 +1,18 @@
|
||||
{
|
||||
"es6.module": {
|
||||
"chrome": "61",
|
||||
"and_chr": "61",
|
||||
"edge": "16",
|
||||
"firefox": "60",
|
||||
"chrome": "61",
|
||||
"safari": "10.1",
|
||||
"opera": "48",
|
||||
"ios_saf": "10.3",
|
||||
"android": "61",
|
||||
"op_mob": "48",
|
||||
"and_chr": "61",
|
||||
"and_ff": "60",
|
||||
"samsung": "8.2"
|
||||
"node": "13.2.0",
|
||||
"opera": "48",
|
||||
"op_mob": "48",
|
||||
"safari": "10.1",
|
||||
"ios": "10.3",
|
||||
"samsung": "8.2",
|
||||
"android": "61",
|
||||
"electron": "2.0",
|
||||
"ios_saf": "10.3"
|
||||
}
|
||||
}
|
||||
|
6
node_modules/@babel/compat-data/data/overlapping-plugins.json
generated
vendored
6
node_modules/@babel/compat-data/data/overlapping-plugins.json
generated
vendored
@ -3,7 +3,8 @@
|
||||
"bugfix/transform-async-arrows-in-class"
|
||||
],
|
||||
"transform-parameters": [
|
||||
"bugfix/transform-edge-default-parameters"
|
||||
"bugfix/transform-edge-default-parameters",
|
||||
"bugfix/transform-safari-id-destructuring-collision-in-function-expression"
|
||||
],
|
||||
"transform-function-name": [
|
||||
"bugfix/transform-edge-function-name"
|
||||
@ -14,5 +15,8 @@
|
||||
],
|
||||
"transform-template-literals": [
|
||||
"bugfix/transform-tagged-template-caching"
|
||||
],
|
||||
"proposal-optional-chaining": [
|
||||
"bugfix/transform-v8-spread-parameters-in-optional-chaining"
|
||||
]
|
||||
}
|
||||
|
142
node_modules/@babel/compat-data/data/plugin-bugfixes.json
generated
vendored
142
node_modules/@babel/compat-data/data/plugin-bugfixes.json
generated
vendored
@ -1,15 +1,4 @@
|
||||
{
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7.6",
|
||||
"ios": "10.3",
|
||||
"samsung": "6",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"bugfix/transform-async-arrows-in-class": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
@ -21,17 +10,6 @@
|
||||
"samsung": "6",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"transform-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-edge-default-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
@ -43,17 +21,6 @@
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"bugfix/transform-edge-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
@ -65,17 +32,6 @@
|
||||
"samsung": "5",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-block-scoping": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "51",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-safari-block-shadowing": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
@ -98,18 +54,17 @@
|
||||
"ie": "11",
|
||||
"ios": "11",
|
||||
"samsung": "5",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-template-literals": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "13",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"samsung": "3.4",
|
||||
"electron": "0.22"
|
||||
"bugfix/transform-safari-id-destructuring-collision-in-function-expression": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "2",
|
||||
"node": "6",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-tagged-template-caching": {
|
||||
"chrome": "41",
|
||||
@ -120,6 +75,83 @@
|
||||
"node": "4",
|
||||
"ios": "13",
|
||||
"samsung": "3.4",
|
||||
"electron": "0.22"
|
||||
"rhino": "1.7.14",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"bugfix/transform-v8-spread-parameters-in-optional-chaining": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "16.9",
|
||||
"ios": "13.4",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"proposal-optional-chaining": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"transform-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7.6",
|
||||
"ios": "10.3",
|
||||
"samsung": "6",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"transform-template-literals": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "13",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"samsung": "3.4",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-block-scoping": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "51",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
}
|
||||
}
|
||||
|
138
node_modules/@babel/compat-data/data/plugins.json
generated
vendored
138
node_modules/@babel/compat-data/data/plugins.json
generated
vendored
@ -1,4 +1,44 @@
|
||||
{
|
||||
"proposal-class-static-block": {
|
||||
"chrome": "94",
|
||||
"opera": "80",
|
||||
"edge": "94",
|
||||
"firefox": "93",
|
||||
"node": "16.11",
|
||||
"electron": "15.0"
|
||||
},
|
||||
"proposal-private-property-in-object": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "90",
|
||||
"safari": "15",
|
||||
"node": "16.9",
|
||||
"ios": "15",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"proposal-class-properties": {
|
||||
"chrome": "74",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"firefox": "90",
|
||||
"safari": "14.1",
|
||||
"node": "12",
|
||||
"ios": "15",
|
||||
"samsung": "11",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"proposal-private-methods": {
|
||||
"chrome": "84",
|
||||
"opera": "70",
|
||||
"edge": "84",
|
||||
"firefox": "90",
|
||||
"safari": "15",
|
||||
"node": "14.6",
|
||||
"ios": "15",
|
||||
"samsung": "14",
|
||||
"electron": "10.0"
|
||||
},
|
||||
"proposal-numeric-separator": {
|
||||
"chrome": "75",
|
||||
"opera": "62",
|
||||
@ -8,18 +48,19 @@
|
||||
"node": "12.5",
|
||||
"ios": "13",
|
||||
"samsung": "11",
|
||||
"electron": "6"
|
||||
"rhino": "1.7.14",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"proposal-class-properties": {
|
||||
"chrome": "74",
|
||||
"opera": "61",
|
||||
"edge": "79",
|
||||
"node": "12",
|
||||
"electron": "6.1"
|
||||
},
|
||||
"proposal-private-methods": {
|
||||
"chrome": "84",
|
||||
"opera": "71"
|
||||
"proposal-logical-assignment-operators": {
|
||||
"chrome": "85",
|
||||
"opera": "71",
|
||||
"edge": "85",
|
||||
"firefox": "79",
|
||||
"safari": "14",
|
||||
"node": "15",
|
||||
"ios": "14",
|
||||
"samsung": "14",
|
||||
"electron": "10.0"
|
||||
},
|
||||
"proposal-nullish-coalescing-operator": {
|
||||
"chrome": "80",
|
||||
@ -28,16 +69,19 @@
|
||||
"firefox": "72",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"electron": "8.1"
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"proposal-optional-chaining": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"electron": "8.1"
|
||||
"node": "16.9",
|
||||
"ios": "13.4",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"proposal-json-strings": {
|
||||
"chrome": "66",
|
||||
@ -48,7 +92,8 @@
|
||||
"node": "10",
|
||||
"ios": "12",
|
||||
"samsung": "9",
|
||||
"electron": "3"
|
||||
"rhino": "1.7.14",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-optional-catch-binding": {
|
||||
"chrome": "66",
|
||||
@ -59,16 +104,14 @@
|
||||
"node": "10",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"electron": "3"
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "18",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
@ -81,7 +124,7 @@
|
||||
"node": "10",
|
||||
"ios": "12",
|
||||
"samsung": "8",
|
||||
"electron": "3"
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-object-rest-spread": {
|
||||
"chrome": "60",
|
||||
@ -92,7 +135,7 @@
|
||||
"node": "8.3",
|
||||
"ios": "11.3",
|
||||
"samsung": "8",
|
||||
"electron": "2"
|
||||
"electron": "2.0"
|
||||
},
|
||||
"transform-dotall-regex": {
|
||||
"chrome": "62",
|
||||
@ -103,7 +146,7 @@
|
||||
"node": "8.10",
|
||||
"ios": "11.3",
|
||||
"samsung": "8",
|
||||
"electron": "3"
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-unicode-property-regex": {
|
||||
"chrome": "64",
|
||||
@ -114,17 +157,18 @@
|
||||
"node": "10",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"electron": "3"
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-named-capturing-groups-regex": {
|
||||
"chrome": "64",
|
||||
"opera": "51",
|
||||
"edge": "79",
|
||||
"firefox": "78",
|
||||
"safari": "11.1",
|
||||
"node": "10",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"electron": "3"
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
@ -146,6 +190,7 @@
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"samsung": "6",
|
||||
"rhino": "1.7.14",
|
||||
"electron": "1.3"
|
||||
},
|
||||
"transform-template-literals": {
|
||||
@ -157,7 +202,7 @@
|
||||
"node": "4",
|
||||
"ios": "13",
|
||||
"samsung": "3.4",
|
||||
"electron": "0.22"
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-literals": {
|
||||
"chrome": "44",
|
||||
@ -185,11 +230,12 @@
|
||||
"chrome": "47",
|
||||
"opera": "34",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"firefox": "43",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-block-scoped-functions": {
|
||||
@ -202,7 +248,7 @@
|
||||
"ie": "11",
|
||||
"ios": "10",
|
||||
"samsung": "3.4",
|
||||
"electron": "0.22"
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-classes": {
|
||||
"chrome": "46",
|
||||
@ -235,7 +281,8 @@
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"samsung": "4",
|
||||
"electron": "0.28"
|
||||
"rhino": "1.7.14",
|
||||
"electron": "0.27"
|
||||
},
|
||||
"transform-duplicate-keys": {
|
||||
"chrome": "42",
|
||||
@ -307,7 +354,7 @@
|
||||
"chrome": "46",
|
||||
"opera": "33",
|
||||
"edge": "13",
|
||||
"firefox": "36",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
@ -345,6 +392,7 @@
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"samsung": "3",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"transform-new-target": {
|
||||
@ -375,12 +423,13 @@
|
||||
"edge": "12",
|
||||
"firefox": "2",
|
||||
"safari": "5.1",
|
||||
"node": "0.10",
|
||||
"node": "0.4",
|
||||
"ie": "9",
|
||||
"android": "4",
|
||||
"ios": "6",
|
||||
"phantom": "2",
|
||||
"phantom": "1.9",
|
||||
"samsung": "1",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"transform-property-literals": {
|
||||
@ -389,12 +438,13 @@
|
||||
"edge": "12",
|
||||
"firefox": "2",
|
||||
"safari": "5.1",
|
||||
"node": "0.10",
|
||||
"node": "0.4",
|
||||
"ie": "9",
|
||||
"android": "4",
|
||||
"ios": "6",
|
||||
"phantom": "2",
|
||||
"phantom": "1.9",
|
||||
"samsung": "1",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"transform-reserved-words": {
|
||||
@ -403,12 +453,26 @@
|
||||
"edge": "12",
|
||||
"firefox": "2",
|
||||
"safari": "3.1",
|
||||
"node": "0.10",
|
||||
"node": "0.6",
|
||||
"ie": "9",
|
||||
"android": "4.4",
|
||||
"ios": "6",
|
||||
"phantom": "2",
|
||||
"phantom": "1.9",
|
||||
"samsung": "1",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"proposal-export-namespace-from": {
|
||||
"chrome": "72",
|
||||
"and_chr": "72",
|
||||
"edge": "79",
|
||||
"firefox": "80",
|
||||
"and_ff": "80",
|
||||
"node": "13.2",
|
||||
"opera": "60",
|
||||
"op_mob": "51",
|
||||
"samsung": "11.0",
|
||||
"android": "72",
|
||||
"electron": "5.0"
|
||||
}
|
||||
}
|
||||
|
3
node_modules/@babel/compat-data/native-modules.js
generated
vendored
3
node_modules/@babel/compat-data/native-modules.js
generated
vendored
@ -1,4 +1 @@
|
||||
// Node < 13.3 doesn't support export maps in package.json.
|
||||
// Use this proxy file as a fallback.
|
||||
|
||||
module.exports = require("./data/native-modules.json");
|
||||
|
3
node_modules/@babel/compat-data/overlapping-plugins.js
generated
vendored
3
node_modules/@babel/compat-data/overlapping-plugins.js
generated
vendored
@ -1,4 +1 @@
|
||||
// Node < 13.3 doesn't support export maps in package.json.
|
||||
// Use this proxy file as a fallback.
|
||||
|
||||
module.exports = require("./data/overlapping-plugins.json");
|
||||
|
64
node_modules/@babel/compat-data/package.json
generated
vendored
64
node_modules/@babel/compat-data/package.json
generated
vendored
@ -1,62 +1,61 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/compat-data@7.10.4",
|
||||
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
|
||||
"@babel/compat-data@7.18.8",
|
||||
"/home/node/nuxt"
|
||||
]
|
||||
],
|
||||
"_from": "@babel/compat-data@7.10.4",
|
||||
"_id": "@babel/compat-data@7.10.4",
|
||||
"_from": "@babel/compat-data@7.18.8",
|
||||
"_id": "@babel/compat-data@7.18.8",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-t+rjExOrSVvjQQXNp5zAIYDp00KjdvGl/TpDX5REPr0S9IAIPQMTilcfG6q8c0QFmj9lSTVySV2VTsyggvtNIw==",
|
||||
"_integrity": "sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ==",
|
||||
"_location": "/@babel/compat-data",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/compat-data@7.10.4",
|
||||
"raw": "@babel/compat-data@7.18.8",
|
||||
"name": "@babel/compat-data",
|
||||
"escapedName": "@babel%2fcompat-data",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.10.4",
|
||||
"rawSpec": "7.18.8",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.10.4"
|
||||
"fetchSpec": "7.18.8"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/helper-compilation-targets",
|
||||
"/@babel/preset-env"
|
||||
"/@babel/plugin-proposal-object-rest-spread",
|
||||
"/@babel/preset-env",
|
||||
"/@nuxt/babel-preset-app",
|
||||
"/babel-plugin-polyfill-corejs2"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.10.4.tgz",
|
||||
"_spec": "7.10.4",
|
||||
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
|
||||
"_resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.18.8.tgz",
|
||||
"_spec": "7.18.8",
|
||||
"_where": "/home/node/nuxt",
|
||||
"author": {
|
||||
"name": "The Babel Team",
|
||||
"url": "https://babeljs.io/team"
|
||||
"url": "https://babel.dev/team"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"browserslist": "^4.12.0",
|
||||
"invariant": "^2.2.4",
|
||||
"semver": "^5.5.0"
|
||||
},
|
||||
"description": "",
|
||||
"description": ">",
|
||||
"devDependencies": {
|
||||
"@babel/helper-compilation-targets": "^7.10.4",
|
||||
"caniuse-db": "1.0.30001035",
|
||||
"electron-to-chromium": "1.3.377",
|
||||
"lodash": "^4.17.15"
|
||||
"@mdn/browser-compat-data": "^4.0.10",
|
||||
"core-js-compat": "^3.22.1",
|
||||
"electron-to-chromium": "^1.4.113"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"exports": {
|
||||
"./plugins": "./data/plugins.json",
|
||||
"./native-modules": "./data/native-modules.json",
|
||||
"./corejs2-built-ins": "./data/corejs2-built-ins.json",
|
||||
"./corejs3-shipped-proposals": "./data/corejs3-shipped-proposals.json",
|
||||
"./overlapping-plugins": "./data/overlapping-plugins.json",
|
||||
"./plugin-bugfixes": "./data/plugin-bugfixes.json"
|
||||
"./plugins": "./plugins.js",
|
||||
"./native-modules": "./native-modules.js",
|
||||
"./corejs2-built-ins": "./corejs2-built-ins.js",
|
||||
"./corejs3-shipped-proposals": "./corejs3-shipped-proposals.js",
|
||||
"./overlapping-plugins": "./overlapping-plugins.js",
|
||||
"./plugin-bugfixes": "./plugin-bugfixes.js"
|
||||
},
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://github.com/babel/babel#readme",
|
||||
"keywords": [
|
||||
"babel",
|
||||
@ -74,7 +73,8 @@
|
||||
"directory": "packages/babel-compat-data"
|
||||
},
|
||||
"scripts": {
|
||||
"build-data": "./scripts/download-compat-table.sh; node ./scripts/build-data.js; node ./scripts/build-modules-support.js; node ./scripts/build-bugfixes-targets.js"
|
||||
"build-data": "./scripts/download-compat-table.sh && node ./scripts/build-data.js && node ./scripts/build-modules-support.js && node ./scripts/build-bugfixes-targets.js"
|
||||
},
|
||||
"version": "7.10.4"
|
||||
"type": "commonjs",
|
||||
"version": "7.18.8"
|
||||
}
|
||||
|
3
node_modules/@babel/compat-data/plugin-bugfixes.js
generated
vendored
3
node_modules/@babel/compat-data/plugin-bugfixes.js
generated
vendored
@ -1,4 +1 @@
|
||||
// Node < 13.3 doesn't support export maps in package.json.
|
||||
// Use this proxy file as a fallback.
|
||||
|
||||
module.exports = require("./data/plugin-bugfixes.json");
|
||||
|
3
node_modules/@babel/compat-data/plugins.js
generated
vendored
3
node_modules/@babel/compat-data/plugins.js
generated
vendored
@ -1,4 +1 @@
|
||||
// Node < 13.3 doesn't support export maps in package.json.
|
||||
// Use this proxy file as a fallback.
|
||||
|
||||
module.exports = require("./data/plugins.json");
|
||||
|
2
node_modules/@babel/core/README.md
generated
vendored
2
node_modules/@babel/core/README.md
generated
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
> Babel compiler core.
|
||||
|
||||
See our website [@babel/core](https://babeljs.io/docs/en/next/babel-core.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
|
||||
See our website [@babel/core](https://babeljs.io/docs/en/babel-core) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
|
1
node_modules/@babel/core/lib/config/cache-contexts.js
generated
vendored
Normal file
1
node_modules/@babel/core/lib/config/cache-contexts.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
0 && 0;
|
19
node_modules/@babel/core/lib/config/caching.js
generated
vendored
19
node_modules/@babel/core/lib/config/caching.js
generated
vendored
@ -3,14 +3,14 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeWeakCache = makeWeakCache;
|
||||
exports.makeWeakCacheSync = makeWeakCacheSync;
|
||||
exports.assertSimpleType = assertSimpleType;
|
||||
exports.makeStrongCache = makeStrongCache;
|
||||
exports.makeStrongCacheSync = makeStrongCacheSync;
|
||||
exports.assertSimpleType = assertSimpleType;
|
||||
exports.makeWeakCache = makeWeakCache;
|
||||
exports.makeWeakCacheSync = makeWeakCacheSync;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
@ -23,13 +23,11 @@ var _async = require("../gensync-utils/async");
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const synchronize = gen => {
|
||||
return (0, _gensync().default)(gen).sync;
|
||||
return _gensync()(gen).sync;
|
||||
};
|
||||
|
||||
function* genTrue(data) {
|
||||
function* genTrue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -182,6 +180,7 @@ class CacheConfigurator {
|
||||
this._invalidate = false;
|
||||
this._configured = false;
|
||||
this._pairs = [];
|
||||
this._data = void 0;
|
||||
this._data = data;
|
||||
}
|
||||
|
||||
@ -310,6 +309,8 @@ function assertSimpleType(value) {
|
||||
class Lock {
|
||||
constructor() {
|
||||
this.released = false;
|
||||
this.promise = void 0;
|
||||
this._resolve = void 0;
|
||||
this.promise = new Promise(resolve => {
|
||||
this._resolve = resolve;
|
||||
});
|
||||
@ -322,3 +323,5 @@ class Lock {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
0 && 0;
|
234
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
234
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.buildPresetChain = buildPresetChain;
|
||||
exports.buildRootChain = buildRootChain;
|
||||
exports.buildPresetChainWalker = void 0;
|
||||
exports.buildRootChain = buildRootChain;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
@ -18,7 +18,7 @@ function _path() {
|
||||
}
|
||||
|
||||
function _debug() {
|
||||
const data = _interopRequireDefault(require("debug"));
|
||||
const data = require("debug");
|
||||
|
||||
_debug = function () {
|
||||
return data;
|
||||
@ -29,7 +29,9 @@ function _debug() {
|
||||
|
||||
var _options = require("./validation/options");
|
||||
|
||||
var _patternToRegex = _interopRequireDefault(require("./pattern-to-regex"));
|
||||
var _patternToRegex = require("./pattern-to-regex");
|
||||
|
||||
var _printer = require("./printer");
|
||||
|
||||
var _files = require("./files");
|
||||
|
||||
@ -37,9 +39,7 @@ var _caching = require("./caching");
|
||||
|
||||
var _configDescriptors = require("./config-descriptors");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const debug = (0, _debug().default)("babel:config:config-chain");
|
||||
const debug = _debug()("babel:config:config-chain");
|
||||
|
||||
function* buildPresetChain(arg, context) {
|
||||
const chain = yield* buildPresetChainWalker(arg, context);
|
||||
@ -47,7 +47,8 @@ function* buildPresetChain(arg, context) {
|
||||
return {
|
||||
plugins: dedupDescriptors(chain.plugins),
|
||||
presets: dedupDescriptors(chain.presets),
|
||||
options: chain.options.map(o => normalizeOptions(o))
|
||||
options: chain.options.map(o => normalizeOptions(o)),
|
||||
files: new Set()
|
||||
};
|
||||
}
|
||||
|
||||
@ -55,7 +56,8 @@ const buildPresetChainWalker = makeChainWalker({
|
||||
root: preset => loadPresetDescriptors(preset),
|
||||
env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
|
||||
overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
|
||||
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName)
|
||||
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName),
|
||||
createLogger: () => () => {}
|
||||
});
|
||||
exports.buildPresetChainWalker = buildPresetChainWalker;
|
||||
const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
|
||||
@ -64,11 +66,14 @@ const loadPresetOverridesDescriptors = (0, _caching.makeWeakCacheSync)(preset =>
|
||||
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||
|
||||
function* buildRootChain(opts, context) {
|
||||
let configReport, babelRcReport;
|
||||
const programmaticLogger = new _printer.ConfigPrinter();
|
||||
const programmaticChain = yield* loadProgrammaticChain({
|
||||
options: opts,
|
||||
dirname: context.cwd
|
||||
}, context);
|
||||
}, context, undefined, programmaticLogger);
|
||||
if (!programmaticChain) return null;
|
||||
const programmaticReport = yield* programmaticLogger.output();
|
||||
let configFile;
|
||||
|
||||
if (typeof opts.configFile === "string") {
|
||||
@ -83,11 +88,13 @@ function* buildRootChain(opts, context) {
|
||||
} = opts;
|
||||
let babelrcRootsDirectory = context.cwd;
|
||||
const configFileChain = emptyChain();
|
||||
const configFileLogger = new _printer.ConfigPrinter();
|
||||
|
||||
if (configFile) {
|
||||
const validatedFile = validateConfigFile(configFile);
|
||||
const result = yield* loadFileChain(validatedFile, context);
|
||||
const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger);
|
||||
if (!result) return null;
|
||||
configReport = yield* configFileLogger.output();
|
||||
|
||||
if (babelrc === undefined) {
|
||||
babelrc = validatedFile.options.babelrc;
|
||||
@ -101,35 +108,60 @@ function* buildRootChain(opts, context) {
|
||||
mergeChain(configFileChain, result);
|
||||
}
|
||||
|
||||
const pkgData = typeof context.filename === "string" ? yield* (0, _files.findPackageData)(context.filename) : null;
|
||||
let ignoreFile, babelrcFile;
|
||||
let isIgnored = false;
|
||||
const fileChain = emptyChain();
|
||||
|
||||
if ((babelrc === true || babelrc === undefined) && pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) {
|
||||
({
|
||||
ignore: ignoreFile,
|
||||
config: babelrcFile
|
||||
} = yield* (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller));
|
||||
if ((babelrc === true || babelrc === undefined) && typeof context.filename === "string") {
|
||||
const pkgData = yield* (0, _files.findPackageData)(context.filename);
|
||||
|
||||
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
|
||||
return null;
|
||||
}
|
||||
if (pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) {
|
||||
({
|
||||
ignore: ignoreFile,
|
||||
config: babelrcFile
|
||||
} = yield* (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller));
|
||||
|
||||
if (babelrcFile) {
|
||||
const result = yield* loadFileChain(validateBabelrcFile(babelrcFile), context);
|
||||
if (!result) return null;
|
||||
mergeChain(fileChain, result);
|
||||
if (ignoreFile) {
|
||||
fileChain.files.add(ignoreFile.filepath);
|
||||
}
|
||||
|
||||
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
|
||||
isIgnored = true;
|
||||
}
|
||||
|
||||
if (babelrcFile && !isIgnored) {
|
||||
const validatedFile = validateBabelrcFile(babelrcFile);
|
||||
const babelrcLogger = new _printer.ConfigPrinter();
|
||||
const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger);
|
||||
|
||||
if (!result) {
|
||||
isIgnored = true;
|
||||
} else {
|
||||
babelRcReport = yield* babelrcLogger.output();
|
||||
mergeChain(fileChain, result);
|
||||
}
|
||||
}
|
||||
|
||||
if (babelrcFile && isIgnored) {
|
||||
fileChain.files.add(babelrcFile.filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (context.showConfig) {
|
||||
console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n") + "\n-----End Babel configs-----");
|
||||
}
|
||||
|
||||
const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
|
||||
return {
|
||||
plugins: dedupDescriptors(chain.plugins),
|
||||
presets: dedupDescriptors(chain.presets),
|
||||
options: chain.options.map(o => normalizeOptions(o)),
|
||||
plugins: isIgnored ? [] : dedupDescriptors(chain.plugins),
|
||||
presets: isIgnored ? [] : dedupDescriptors(chain.presets),
|
||||
options: isIgnored ? [] : chain.options.map(o => normalizeOptions(o)),
|
||||
fileHandling: isIgnored ? "ignored" : "transpile",
|
||||
ignore: ignoreFile || undefined,
|
||||
babelrc: babelrcFile || undefined,
|
||||
config: configFile || undefined
|
||||
config: configFile || undefined,
|
||||
files: chain.files
|
||||
};
|
||||
}
|
||||
|
||||
@ -142,9 +174,13 @@ function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirector
|
||||
}
|
||||
|
||||
let babelrcPatterns = babelrcRoots;
|
||||
if (!Array.isArray(babelrcPatterns)) babelrcPatterns = [babelrcPatterns];
|
||||
|
||||
if (!Array.isArray(babelrcPatterns)) {
|
||||
babelrcPatterns = [babelrcPatterns];
|
||||
}
|
||||
|
||||
babelrcPatterns = babelrcPatterns.map(pat => {
|
||||
return typeof pat === "string" ? _path().default.resolve(babelrcRootsDirectory, pat) : pat;
|
||||
return typeof pat === "string" ? _path().resolve(babelrcRootsDirectory, pat) : pat;
|
||||
});
|
||||
|
||||
if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {
|
||||
@ -181,19 +217,42 @@ const loadProgrammaticChain = makeChainWalker({
|
||||
root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors),
|
||||
env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName),
|
||||
overrides: (input, index) => buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index),
|
||||
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName)
|
||||
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName),
|
||||
createLogger: (input, context, baseLogger) => buildProgrammaticLogger(input, context, baseLogger)
|
||||
});
|
||||
const loadFileChain = makeChainWalker({
|
||||
const loadFileChainWalker = makeChainWalker({
|
||||
root: file => loadFileDescriptors(file),
|
||||
env: (file, envName) => loadFileEnvDescriptors(file)(envName),
|
||||
overrides: (file, index) => loadFileOverridesDescriptors(file)(index),
|
||||
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName)
|
||||
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName),
|
||||
createLogger: (file, context, baseLogger) => buildFileLogger(file.filepath, context, baseLogger)
|
||||
});
|
||||
|
||||
function* loadFileChain(input, context, files, baseLogger) {
|
||||
const chain = yield* loadFileChainWalker(input, context, files, baseLogger);
|
||||
|
||||
if (chain) {
|
||||
chain.files.add(input.filepath);
|
||||
}
|
||||
|
||||
return chain;
|
||||
}
|
||||
|
||||
const loadFileDescriptors = (0, _caching.makeWeakCacheSync)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
|
||||
const loadFileEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
|
||||
const loadFileOverridesDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
|
||||
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||
|
||||
function buildFileLogger(filepath, context, baseLogger) {
|
||||
if (!baseLogger) {
|
||||
return () => {};
|
||||
}
|
||||
|
||||
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Config, {
|
||||
filepath
|
||||
});
|
||||
}
|
||||
|
||||
function buildRootDescriptors({
|
||||
dirname,
|
||||
options
|
||||
@ -201,6 +260,18 @@ function buildRootDescriptors({
|
||||
return descriptors(dirname, options, alias);
|
||||
}
|
||||
|
||||
function buildProgrammaticLogger(_, context, baseLogger) {
|
||||
var _context$caller;
|
||||
|
||||
if (!baseLogger) {
|
||||
return () => {};
|
||||
}
|
||||
|
||||
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Programmatic, {
|
||||
callerName: (_context$caller = context.caller) == null ? void 0 : _context$caller.name
|
||||
});
|
||||
}
|
||||
|
||||
function buildEnvDescriptors({
|
||||
dirname,
|
||||
options
|
||||
@ -232,9 +303,10 @@ function makeChainWalker({
|
||||
root,
|
||||
env,
|
||||
overrides,
|
||||
overridesEnv
|
||||
overridesEnv,
|
||||
createLogger
|
||||
}) {
|
||||
return function* (input, context, files = new Set()) {
|
||||
return function* (input, context, files = new Set(), baseLogger) {
|
||||
const {
|
||||
dirname
|
||||
} = input;
|
||||
@ -242,51 +314,75 @@ function makeChainWalker({
|
||||
const rootOpts = root(input);
|
||||
|
||||
if (configIsApplicable(rootOpts, dirname, context)) {
|
||||
flattenedConfigs.push(rootOpts);
|
||||
flattenedConfigs.push({
|
||||
config: rootOpts,
|
||||
envName: undefined,
|
||||
index: undefined
|
||||
});
|
||||
const envOpts = env(input, context.envName);
|
||||
|
||||
if (envOpts && configIsApplicable(envOpts, dirname, context)) {
|
||||
flattenedConfigs.push(envOpts);
|
||||
flattenedConfigs.push({
|
||||
config: envOpts,
|
||||
envName: context.envName,
|
||||
index: undefined
|
||||
});
|
||||
}
|
||||
|
||||
(rootOpts.options.overrides || []).forEach((_, index) => {
|
||||
const overrideOps = overrides(input, index);
|
||||
|
||||
if (configIsApplicable(overrideOps, dirname, context)) {
|
||||
flattenedConfigs.push(overrideOps);
|
||||
flattenedConfigs.push({
|
||||
config: overrideOps,
|
||||
index,
|
||||
envName: undefined
|
||||
});
|
||||
const overrideEnvOpts = overridesEnv(input, index, context.envName);
|
||||
|
||||
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context)) {
|
||||
flattenedConfigs.push(overrideEnvOpts);
|
||||
flattenedConfigs.push({
|
||||
config: overrideEnvOpts,
|
||||
index,
|
||||
envName: context.envName
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (flattenedConfigs.some(({
|
||||
options: {
|
||||
ignore,
|
||||
only
|
||||
config: {
|
||||
options: {
|
||||
ignore,
|
||||
only
|
||||
}
|
||||
}
|
||||
}) => shouldIgnore(context, ignore, only, dirname))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const chain = emptyChain();
|
||||
const logger = createLogger(input, context, baseLogger);
|
||||
|
||||
for (const op of flattenedConfigs) {
|
||||
if (!(yield* mergeExtendsChain(chain, op.options, dirname, context, files))) {
|
||||
for (const {
|
||||
config,
|
||||
index,
|
||||
envName
|
||||
} of flattenedConfigs) {
|
||||
if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
mergeChainOpts(chain, op);
|
||||
logger(config, index, envName);
|
||||
yield* mergeChainOpts(chain, config);
|
||||
}
|
||||
|
||||
return chain;
|
||||
};
|
||||
}
|
||||
|
||||
function* mergeExtendsChain(chain, opts, dirname, context, files) {
|
||||
function* mergeExtendsChain(chain, opts, dirname, context, files, baseLogger) {
|
||||
if (opts.extends === undefined) return true;
|
||||
const file = yield* (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller);
|
||||
|
||||
@ -295,7 +391,7 @@ function* mergeExtendsChain(chain, opts, dirname, context, files) {
|
||||
}
|
||||
|
||||
files.add(file);
|
||||
const fileChain = yield* loadFileChain(validateExtendFile(file), context, files);
|
||||
const fileChain = yield* loadFileChain(validateExtendFile(file), context, files, baseLogger);
|
||||
files.delete(file);
|
||||
if (!fileChain) return false;
|
||||
mergeChain(chain, fileChain);
|
||||
@ -306,17 +402,22 @@ function mergeChain(target, source) {
|
||||
target.options.push(...source.options);
|
||||
target.plugins.push(...source.plugins);
|
||||
target.presets.push(...source.presets);
|
||||
|
||||
for (const file of source.files) {
|
||||
target.files.add(file);
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
function mergeChainOpts(target, {
|
||||
function* mergeChainOpts(target, {
|
||||
options,
|
||||
plugins,
|
||||
presets
|
||||
}) {
|
||||
target.options.push(options);
|
||||
target.plugins.push(...plugins());
|
||||
target.presets.push(...presets());
|
||||
target.plugins.push(...(yield* plugins()));
|
||||
target.presets.push(...(yield* presets()));
|
||||
return target;
|
||||
}
|
||||
|
||||
@ -324,7 +425,8 @@ function emptyChain() {
|
||||
return {
|
||||
options: [],
|
||||
presets: [],
|
||||
plugins: []
|
||||
plugins: [],
|
||||
files: new Set()
|
||||
};
|
||||
}
|
||||
|
||||
@ -399,14 +501,38 @@ function configFieldIsApplicable(context, test, dirname) {
|
||||
return matchesPatterns(context, patterns, dirname);
|
||||
}
|
||||
|
||||
function ignoreListReplacer(_key, value) {
|
||||
if (value instanceof RegExp) {
|
||||
return String(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function shouldIgnore(context, ignore, only, dirname) {
|
||||
if (ignore && matchesPatterns(context, ignore, dirname)) {
|
||||
debug("Ignored %o because it matched one of %O from %o", context.filename, ignore, dirname);
|
||||
var _context$filename;
|
||||
|
||||
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore, ignoreListReplacer)}\` from "${dirname}"`;
|
||||
debug(message);
|
||||
|
||||
if (context.showConfig) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (only && !matchesPatterns(context, only, dirname)) {
|
||||
debug("Ignored %o because it failed to match one of %O from %o", context.filename, only, dirname);
|
||||
var _context$filename2;
|
||||
|
||||
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only, ignoreListReplacer)}\` from "${dirname}"`;
|
||||
debug(message);
|
||||
|
||||
if (context.showConfig) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -436,3 +562,5 @@ function matchPattern(pattern, dirname, pathToTest, context) {
|
||||
|
||||
return pattern.test(pathToTest);
|
||||
}
|
||||
|
||||
0 && 0;
|
75
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
75
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
@ -4,8 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createCachedDescriptors = createCachedDescriptors;
|
||||
exports.createUncachedDescriptors = createUncachedDescriptors;
|
||||
exports.createDescriptor = createDescriptor;
|
||||
exports.createUncachedDescriptors = createUncachedDescriptors;
|
||||
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _files = require("./files");
|
||||
|
||||
@ -13,10 +23,24 @@ var _item = require("./item");
|
||||
|
||||
var _caching = require("./caching");
|
||||
|
||||
var _resolveTargets = require("./resolve-targets");
|
||||
|
||||
function isEqualDescriptor(a, b) {
|
||||
return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && (a.file && a.file.request) === (b.file && b.file.request) && (a.file && a.file.resolved) === (b.file && b.file.resolved);
|
||||
}
|
||||
|
||||
function* handlerOf(value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
function optionsWithResolvedBrowserslistConfigFile(options, dirname) {
|
||||
if (typeof options.browserslistConfigFile === "string") {
|
||||
options.browserslistConfigFile = (0, _resolveTargets.resolveBrowserslistConfigFile)(options.browserslistConfigFile, dirname);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function createCachedDescriptors(dirname, options, alias) {
|
||||
const {
|
||||
plugins,
|
||||
@ -24,9 +48,9 @@ function createCachedDescriptors(dirname, options, alias) {
|
||||
passPerPreset
|
||||
} = options;
|
||||
return {
|
||||
options,
|
||||
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => [],
|
||||
presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => []
|
||||
options: optionsWithResolvedBrowserslistConfigFile(options, dirname),
|
||||
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => handlerOf([]),
|
||||
presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => handlerOf([])
|
||||
};
|
||||
}
|
||||
|
||||
@ -34,33 +58,42 @@ function createUncachedDescriptors(dirname, options, alias) {
|
||||
let plugins;
|
||||
let presets;
|
||||
return {
|
||||
options,
|
||||
plugins: () => {
|
||||
options: optionsWithResolvedBrowserslistConfigFile(options, dirname),
|
||||
|
||||
*plugins() {
|
||||
if (!plugins) {
|
||||
plugins = createPluginDescriptors(options.plugins || [], dirname, alias);
|
||||
plugins = yield* createPluginDescriptors(options.plugins || [], dirname, alias);
|
||||
}
|
||||
|
||||
return plugins;
|
||||
},
|
||||
presets: () => {
|
||||
|
||||
*presets() {
|
||||
if (!presets) {
|
||||
presets = createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset);
|
||||
presets = yield* createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset);
|
||||
}
|
||||
|
||||
return presets;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
const PRESET_DESCRIPTOR_CACHE = new WeakMap();
|
||||
const createCachedPresetDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
||||
const dirname = cache.using(dir => dir);
|
||||
return (0, _caching.makeStrongCacheSync)(alias => (0, _caching.makeStrongCacheSync)(passPerPreset => createPresetDescriptors(items, dirname, alias, passPerPreset).map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc))));
|
||||
return (0, _caching.makeStrongCacheSync)(alias => (0, _caching.makeStrongCache)(function* (passPerPreset) {
|
||||
const descriptors = yield* createPresetDescriptors(items, dirname, alias, passPerPreset);
|
||||
return descriptors.map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc));
|
||||
}));
|
||||
});
|
||||
const PLUGIN_DESCRIPTOR_CACHE = new WeakMap();
|
||||
const createCachedPluginDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
||||
const dirname = cache.using(dir => dir);
|
||||
return (0, _caching.makeStrongCacheSync)(alias => createPluginDescriptors(items, dirname, alias).map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)));
|
||||
return (0, _caching.makeStrongCache)(function* (alias) {
|
||||
const descriptors = yield* createPluginDescriptors(items, dirname, alias);
|
||||
return descriptors.map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc));
|
||||
});
|
||||
});
|
||||
const DEFAULT_OPTIONS = {};
|
||||
|
||||
@ -97,25 +130,25 @@ function loadCachedDescriptor(cache, desc) {
|
||||
return desc;
|
||||
}
|
||||
|
||||
function createPresetDescriptors(items, dirname, alias, passPerPreset) {
|
||||
return createDescriptors("preset", items, dirname, alias, passPerPreset);
|
||||
function* createPresetDescriptors(items, dirname, alias, passPerPreset) {
|
||||
return yield* createDescriptors("preset", items, dirname, alias, passPerPreset);
|
||||
}
|
||||
|
||||
function createPluginDescriptors(items, dirname, alias) {
|
||||
return createDescriptors("plugin", items, dirname, alias);
|
||||
function* createPluginDescriptors(items, dirname, alias) {
|
||||
return yield* createDescriptors("plugin", items, dirname, alias);
|
||||
}
|
||||
|
||||
function createDescriptors(type, items, dirname, alias, ownPass) {
|
||||
const descriptors = items.map((item, index) => createDescriptor(item, dirname, {
|
||||
function* createDescriptors(type, items, dirname, alias, ownPass) {
|
||||
const descriptors = yield* _gensync().all(items.map((item, index) => createDescriptor(item, dirname, {
|
||||
type,
|
||||
alias: `${alias}$${index}`,
|
||||
ownPass: !!ownPass
|
||||
}));
|
||||
})));
|
||||
assertNoDuplicates(descriptors);
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
function createDescriptor(pair, dirname, {
|
||||
function* createDescriptor(pair, dirname, {
|
||||
type,
|
||||
alias,
|
||||
ownPass
|
||||
@ -151,7 +184,7 @@ function createDescriptor(pair, dirname, {
|
||||
({
|
||||
filepath,
|
||||
value
|
||||
} = resolver(value, dirname));
|
||||
} = yield* resolver(value, dirname));
|
||||
file = {
|
||||
request,
|
||||
resolved: filepath
|
||||
@ -209,3 +242,5 @@ function assertNoDuplicates(items) {
|
||||
nameMap.add(item.name);
|
||||
}
|
||||
}
|
||||
|
||||
0 && 0;
|
112
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
112
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
@ -3,14 +3,15 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||
exports.findConfigUpwards = findConfigUpwards;
|
||||
exports.findRelativeConfig = findRelativeConfig;
|
||||
exports.findRootConfig = findRootConfig;
|
||||
exports.loadConfig = loadConfig;
|
||||
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||
exports.resolveShowConfigPath = resolveShowConfigPath;
|
||||
|
||||
function _debug() {
|
||||
const data = _interopRequireDefault(require("debug"));
|
||||
const data = require("debug");
|
||||
|
||||
_debug = function () {
|
||||
return data;
|
||||
@ -19,8 +20,18 @@ function _debug() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
@ -30,7 +41,7 @@ function _path() {
|
||||
}
|
||||
|
||||
function _json() {
|
||||
const data = _interopRequireDefault(require("json5"));
|
||||
const data = require("json5");
|
||||
|
||||
_json = function () {
|
||||
return data;
|
||||
@ -40,7 +51,7 @@ function _json() {
|
||||
}
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
@ -51,41 +62,44 @@ function _gensync() {
|
||||
|
||||
var _caching = require("../caching");
|
||||
|
||||
var _configApi = _interopRequireDefault(require("../helpers/config-api"));
|
||||
var _configApi = require("../helpers/config-api");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var _moduleTypes = _interopRequireDefault(require("./module-types"));
|
||||
var _moduleTypes = require("./module-types");
|
||||
|
||||
var _patternToRegex = _interopRequireDefault(require("../pattern-to-regex"));
|
||||
var _patternToRegex = require("../pattern-to-regex");
|
||||
|
||||
var fs = _interopRequireWildcard(require("../../gensync-utils/fs"));
|
||||
var fs = require("../../gensync-utils/fs");
|
||||
|
||||
var _resolve = _interopRequireDefault(require("../../gensync-utils/resolve"));
|
||||
function _module() {
|
||||
const data = require("module");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
_module = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
const debug = _debug()("babel:config:loading:files:configuration");
|
||||
|
||||
const debug = (0, _debug().default)("babel:config:loading:files:configuration");
|
||||
const ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json"];
|
||||
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
|
||||
const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json"];
|
||||
const BABELIGNORE_FILENAME = ".babelignore";
|
||||
|
||||
function* findConfigUpwards(rootDir) {
|
||||
function findConfigUpwards(rootDir) {
|
||||
let dirname = rootDir;
|
||||
|
||||
while (true) {
|
||||
for (;;) {
|
||||
for (const filename of ROOT_CONFIG_FILENAMES) {
|
||||
if (yield* fs.exists(_path().default.join(dirname, filename))) {
|
||||
if (_fs().existsSync(_path().join(dirname, filename))) {
|
||||
return dirname;
|
||||
}
|
||||
}
|
||||
|
||||
const nextDir = _path().default.dirname(dirname);
|
||||
const nextDir = _path().dirname(dirname);
|
||||
|
||||
if (dirname === nextDir) break;
|
||||
dirname = nextDir;
|
||||
@ -98,7 +112,7 @@ function* findRelativeConfig(packageData, envName, caller) {
|
||||
let config = null;
|
||||
let ignore = null;
|
||||
|
||||
const dirname = _path().default.dirname(packageData.filepath);
|
||||
const dirname = _path().dirname(packageData.filepath);
|
||||
|
||||
for (const loc of packageData.directories) {
|
||||
if (!config) {
|
||||
@ -108,7 +122,7 @@ function* findRelativeConfig(packageData, envName, caller) {
|
||||
}
|
||||
|
||||
if (!ignore) {
|
||||
const ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME);
|
||||
const ignoreLoc = _path().join(loc, BABELIGNORE_FILENAME);
|
||||
|
||||
ignore = yield* readIgnoreConfig(ignoreLoc);
|
||||
|
||||
@ -129,10 +143,10 @@ function findRootConfig(dirname, envName, caller) {
|
||||
}
|
||||
|
||||
function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) {
|
||||
const configs = yield* _gensync().default.all(names.map(filename => readConfig(_path().default.join(dirname, filename), envName, caller)));
|
||||
const configs = yield* _gensync().all(names.map(filename => readConfig(_path().join(dirname, filename), envName, caller)));
|
||||
const config = configs.reduce((previousConfig, config) => {
|
||||
if (config && previousConfig) {
|
||||
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`);
|
||||
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`);
|
||||
}
|
||||
|
||||
return config || previousConfig;
|
||||
@ -146,8 +160,17 @@ function* loadOneConfig(names, dirname, envName, caller, previousConfig = null)
|
||||
}
|
||||
|
||||
function* loadConfig(name, dirname, envName, caller) {
|
||||
const filepath = yield* (0, _resolve.default)(name, {
|
||||
basedir: dirname
|
||||
const filepath = (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
|
||||
paths: [b]
|
||||
}, M = require("module")) => {
|
||||
let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
|
||||
|
||||
if (f) return f;
|
||||
f = new Error(`Cannot resolve module '${r}'`);
|
||||
f.code = "MODULE_NOT_FOUND";
|
||||
throw f;
|
||||
})(name, {
|
||||
paths: [dirname]
|
||||
});
|
||||
const conf = yield* readConfig(filepath, envName, caller);
|
||||
|
||||
@ -160,7 +183,7 @@ function* loadConfig(name, dirname, envName, caller) {
|
||||
}
|
||||
|
||||
function readConfig(filepath, envName, caller) {
|
||||
const ext = _path().default.extname(filepath);
|
||||
const ext = _path().extname(filepath);
|
||||
|
||||
return ext === ".js" || ext === ".cjs" || ext === ".mjs" ? readConfigJS(filepath, {
|
||||
envName,
|
||||
@ -170,8 +193,8 @@ function readConfig(filepath, envName, caller) {
|
||||
|
||||
const LOADING_CONFIGS = new Set();
|
||||
const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepath, cache) {
|
||||
if (!fs.exists.sync(filepath)) {
|
||||
cache.forever();
|
||||
if (!_fs().existsSync(filepath)) {
|
||||
cache.never();
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -180,7 +203,7 @@ const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepa
|
||||
debug("Auto-ignoring usage of config %o.", filepath);
|
||||
return {
|
||||
filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
dirname: _path().dirname(filepath),
|
||||
options: {}
|
||||
};
|
||||
}
|
||||
@ -201,7 +224,7 @@ const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepa
|
||||
|
||||
if (typeof options === "function") {
|
||||
yield* [];
|
||||
options = options((0, _configApi.default)(cache));
|
||||
options = options((0, _configApi.makeConfigAPI)(cache));
|
||||
assertCache = true;
|
||||
}
|
||||
|
||||
@ -216,7 +239,7 @@ const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepa
|
||||
if (assertCache && !cache.configured()) throwConfigError();
|
||||
return {
|
||||
filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
dirname: _path().dirname(filepath),
|
||||
options
|
||||
};
|
||||
});
|
||||
@ -238,7 +261,7 @@ const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||
let options;
|
||||
|
||||
try {
|
||||
options = _json().default.parse(content);
|
||||
options = _json().parse(content);
|
||||
} catch (err) {
|
||||
err.message = `${filepath}: Error while parsing config - ${err.message}`;
|
||||
throw err;
|
||||
@ -254,14 +277,15 @@ const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||
throw new Error(`${filepath}: Expected config object but found array`);
|
||||
}
|
||||
|
||||
delete options["$schema"];
|
||||
return {
|
||||
filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
dirname: _path().dirname(filepath),
|
||||
options
|
||||
};
|
||||
});
|
||||
const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||
const ignoreDir = _path().default.dirname(filepath);
|
||||
const ignoreDir = _path().dirname(filepath);
|
||||
|
||||
const ignorePatterns = content.split("\n").map(line => line.replace(/#(.*?)$/, "").trim()).filter(line => !!line);
|
||||
|
||||
@ -273,11 +297,29 @@ const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) =>
|
||||
|
||||
return {
|
||||
filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
dirname: _path().dirname(filepath),
|
||||
ignore: ignorePatterns.map(pattern => (0, _patternToRegex.default)(pattern, ignoreDir))
|
||||
};
|
||||
});
|
||||
|
||||
function* resolveShowConfigPath(dirname) {
|
||||
const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;
|
||||
|
||||
if (targetPath != null) {
|
||||
const absolutePath = _path().resolve(dirname, targetPath);
|
||||
|
||||
const stats = yield* fs.stat(absolutePath);
|
||||
|
||||
if (!stats.isFile()) {
|
||||
throw new Error(`${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`);
|
||||
}
|
||||
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function throwConfigError() {
|
||||
throw new Error(`\
|
||||
Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
|
||||
@ -314,3 +356,5 @@ module.exports = function(api) {
|
||||
return { };
|
||||
};`);
|
||||
}
|
||||
|
||||
0 && 0;
|
43
node_modules/@babel/core/lib/config/files/import-meta-resolve.js
generated
vendored
Normal file
43
node_modules/@babel/core/lib/config/files/import-meta-resolve.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = resolve;
|
||||
|
||||
function _module() {
|
||||
const data = require("module");
|
||||
|
||||
_module = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _importMetaResolve = require("../../vendor/import-meta-resolve");
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
let import_;
|
||||
|
||||
try {
|
||||
import_ = require("./import").default;
|
||||
} catch (_unused) {}
|
||||
|
||||
const importMetaResolveP = import_ && process.execArgv.includes("--experimental-import-meta-resolve") ? import_("data:text/javascript,export default import.meta.resolve").then(m => m.default || _importMetaResolve.resolve, () => _importMetaResolve.resolve) : Promise.resolve(_importMetaResolve.resolve);
|
||||
|
||||
function resolve(_x, _x2) {
|
||||
return _resolve.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _resolve() {
|
||||
_resolve = _asyncToGenerator(function* (specifier, parent) {
|
||||
return (yield importMetaResolveP)(specifier, parent);
|
||||
});
|
||||
return _resolve.apply(this, arguments);
|
||||
}
|
||||
|
||||
0 && 0;
|
2
node_modules/@babel/core/lib/config/files/import.js
generated
vendored
2
node_modules/@babel/core/lib/config/files/import.js
generated
vendored
@ -8,3 +8,5 @@ exports.default = import_;
|
||||
function import_(filepath) {
|
||||
return import(filepath);
|
||||
}
|
||||
|
||||
0 && 0;
|
16
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
16
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
@ -3,18 +3,19 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||
exports.findConfigUpwards = findConfigUpwards;
|
||||
exports.findPackageData = findPackageData;
|
||||
exports.findRelativeConfig = findRelativeConfig;
|
||||
exports.findRootConfig = findRootConfig;
|
||||
exports.loadConfig = loadConfig;
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
exports.resolvePreset = resolvePreset;
|
||||
exports.loadPlugin = loadPlugin;
|
||||
exports.loadPreset = loadPreset;
|
||||
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
exports.resolvePreset = resolvePreset;
|
||||
exports.resolveShowConfigPath = resolveShowConfigPath;
|
||||
|
||||
function* findConfigUpwards(rootDir) {
|
||||
function findConfigUpwards(rootDir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -29,7 +30,6 @@ function* findPackageData(filepath) {
|
||||
|
||||
function* findRelativeConfig(pkgData, envName, caller) {
|
||||
return {
|
||||
pkg: null,
|
||||
config: null,
|
||||
ignore: null
|
||||
};
|
||||
@ -43,6 +43,10 @@ function* loadConfig(name, dirname, envName, caller) {
|
||||
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
|
||||
}
|
||||
|
||||
function* resolveShowConfigPath(dirname) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const ROOT_CONFIG_FILENAMES = [];
|
||||
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
|
||||
|
||||
@ -61,3 +65,5 @@ function loadPlugin(name, dirname) {
|
||||
function loadPreset(name, dirname) {
|
||||
throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`);
|
||||
}
|
||||
|
||||
0 && 0;
|
60
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
60
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
@ -3,10 +3,10 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "findPackageData", {
|
||||
Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _package.findPackageData;
|
||||
return _configuration.ROOT_CONFIG_FILENAMES;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findConfigUpwards", {
|
||||
@ -15,6 +15,12 @@ Object.defineProperty(exports, "findConfigUpwards", {
|
||||
return _configuration.findConfigUpwards;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findPackageData", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _package.findPackageData;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findRelativeConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
@ -33,34 +39,23 @@ Object.defineProperty(exports, "loadConfig", {
|
||||
return _configuration.loadConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.ROOT_CONFIG_FILENAMES;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePlugin", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.resolvePlugin;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePreset", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.resolvePreset;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPlugin", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.loadPlugin;
|
||||
return plugins.loadPlugin;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPreset", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.loadPreset;
|
||||
return plugins.loadPreset;
|
||||
}
|
||||
});
|
||||
exports.resolvePreset = exports.resolvePlugin = void 0;
|
||||
Object.defineProperty(exports, "resolveShowConfigPath", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.resolveShowConfigPath;
|
||||
}
|
||||
});
|
||||
|
||||
@ -68,6 +63,25 @@ var _package = require("./package");
|
||||
|
||||
var _configuration = require("./configuration");
|
||||
|
||||
var _plugins = require("./plugins");
|
||||
var plugins = require("./plugins");
|
||||
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
({});
|
||||
|
||||
const resolvePlugin = _gensync()(plugins.resolvePlugin).sync;
|
||||
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
|
||||
const resolvePreset = _gensync()(plugins.resolvePreset).sync;
|
||||
|
||||
exports.resolvePreset = resolvePreset;
|
||||
0 && 0;
|
41
node_modules/@babel/core/lib/config/files/module-types.js
generated
vendored
41
node_modules/@babel/core/lib/config/files/module-types.js
generated
vendored
@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loadCjsOrMjsDefault;
|
||||
exports.supportsESM = void 0;
|
||||
|
||||
var _async = require("../../gensync-utils/async");
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
@ -27,7 +28,25 @@ function _url() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _module() {
|
||||
const data = require("module");
|
||||
|
||||
_module = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _semver() {
|
||||
const data = require("semver");
|
||||
|
||||
_semver = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
@ -39,14 +58,18 @@ try {
|
||||
import_ = require("./import").default;
|
||||
} catch (_unused) {}
|
||||
|
||||
function* loadCjsOrMjsDefault(filepath, asyncError) {
|
||||
const supportsESM = _semver().satisfies(process.versions.node, "^12.17 || >=13.2");
|
||||
|
||||
exports.supportsESM = supportsESM;
|
||||
|
||||
function* loadCjsOrMjsDefault(filepath, asyncError, fallbackToTranspiledModule = false) {
|
||||
switch (guessJSModuleType(filepath)) {
|
||||
case "cjs":
|
||||
return loadCjsDefault(filepath);
|
||||
return loadCjsDefault(filepath, fallbackToTranspiledModule);
|
||||
|
||||
case "unknown":
|
||||
try {
|
||||
return loadCjsDefault(filepath);
|
||||
return loadCjsDefault(filepath, fallbackToTranspiledModule);
|
||||
} catch (e) {
|
||||
if (e.code !== "ERR_REQUIRE_ESM") throw e;
|
||||
}
|
||||
@ -61,7 +84,7 @@ function* loadCjsOrMjsDefault(filepath, asyncError) {
|
||||
}
|
||||
|
||||
function guessJSModuleType(filename) {
|
||||
switch (_path().default.extname(filename)) {
|
||||
switch (_path().extname(filename)) {
|
||||
case ".cjs":
|
||||
return "cjs";
|
||||
|
||||
@ -73,10 +96,10 @@ function guessJSModuleType(filename) {
|
||||
}
|
||||
}
|
||||
|
||||
function loadCjsDefault(filepath) {
|
||||
function loadCjsDefault(filepath, fallbackToTranspiledModule) {
|
||||
const module = require(filepath);
|
||||
|
||||
return (module == null ? void 0 : module.__esModule) ? module.default || undefined : module;
|
||||
return module != null && module.__esModule ? module.default || (fallbackToTranspiledModule ? module : undefined) : module;
|
||||
}
|
||||
|
||||
function loadMjsDefault(_x) {
|
||||
@ -94,3 +117,5 @@ function _loadMjsDefault() {
|
||||
});
|
||||
return _loadMjsDefault.apply(this, arguments);
|
||||
}
|
||||
|
||||
0 && 0;
|
15
node_modules/@babel/core/lib/config/files/package.js
generated
vendored
15
node_modules/@babel/core/lib/config/files/package.js
generated
vendored
@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.findPackageData = findPackageData;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
@ -17,8 +17,6 @@ function _path() {
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const PACKAGE_FILENAME = "package.json";
|
||||
|
||||
function* findPackageData(filepath) {
|
||||
@ -26,13 +24,13 @@ function* findPackageData(filepath) {
|
||||
const directories = [];
|
||||
let isPackage = true;
|
||||
|
||||
let dirname = _path().default.dirname(filepath);
|
||||
let dirname = _path().dirname(filepath);
|
||||
|
||||
while (!pkg && _path().default.basename(dirname) !== "node_modules") {
|
||||
while (!pkg && _path().basename(dirname) !== "node_modules") {
|
||||
directories.push(dirname);
|
||||
pkg = yield* readConfigPackage(_path().default.join(dirname, PACKAGE_FILENAME));
|
||||
pkg = yield* readConfigPackage(_path().join(dirname, PACKAGE_FILENAME));
|
||||
|
||||
const nextLoc = _path().default.dirname(dirname);
|
||||
const nextLoc = _path().dirname(dirname);
|
||||
|
||||
if (dirname === nextLoc) {
|
||||
isPackage = false;
|
||||
@ -72,7 +70,8 @@ const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) =>
|
||||
|
||||
return {
|
||||
filepath,
|
||||
dirname: _path().default.dirname(filepath),
|
||||
dirname: _path().dirname(filepath),
|
||||
options
|
||||
};
|
||||
});
|
||||
0 && 0;
|
294
node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
294
node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
@ -3,13 +3,13 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
exports.resolvePreset = resolvePreset;
|
||||
exports.loadPlugin = loadPlugin;
|
||||
exports.loadPreset = loadPreset;
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
exports.resolvePreset = resolvePreset;
|
||||
|
||||
function _debug() {
|
||||
const data = _interopRequireDefault(require("debug"));
|
||||
const data = require("debug");
|
||||
|
||||
_debug = function () {
|
||||
return data;
|
||||
@ -18,18 +18,8 @@ function _debug() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _resolve() {
|
||||
const data = _interopRequireDefault(require("resolve"));
|
||||
|
||||
_resolve = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
@ -38,9 +28,48 @@ function _path() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _async = require("../../gensync-utils/async");
|
||||
|
||||
var _moduleTypes = require("./module-types");
|
||||
|
||||
function _url() {
|
||||
const data = require("url");
|
||||
|
||||
_url = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _importMetaResolve = require("./import-meta-resolve");
|
||||
|
||||
function _module() {
|
||||
const data = require("module");
|
||||
|
||||
_module = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
const debug = _debug()("babel:config:loading:files:plugins");
|
||||
|
||||
const debug = (0, _debug().default)("babel:config:loading:files:plugins");
|
||||
const EXACT_RE = /^module:/;
|
||||
const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
|
||||
const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
|
||||
@ -50,22 +79,17 @@ const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-plugin(?:-|\/|$
|
||||
const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-preset(?:-|\/|$)|[^/]+\/)/;
|
||||
const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;
|
||||
|
||||
function resolvePlugin(name, dirname) {
|
||||
return resolveStandardizedName("plugin", name, dirname);
|
||||
function* resolvePlugin(name, dirname) {
|
||||
return yield* resolveStandardizedName("plugin", name, dirname);
|
||||
}
|
||||
|
||||
function resolvePreset(name, dirname) {
|
||||
return resolveStandardizedName("preset", name, dirname);
|
||||
function* resolvePreset(name, dirname) {
|
||||
return yield* resolveStandardizedName("preset", name, dirname);
|
||||
}
|
||||
|
||||
function loadPlugin(name, dirname) {
|
||||
const filepath = resolvePlugin(name, dirname);
|
||||
|
||||
if (!filepath) {
|
||||
throw new Error(`Plugin ${name} not found relative to ${dirname}`);
|
||||
}
|
||||
|
||||
const value = requireModule("plugin", filepath);
|
||||
function* loadPlugin(name, dirname) {
|
||||
const filepath = yield* resolvePlugin(name, dirname);
|
||||
const value = yield* requireModule("plugin", filepath);
|
||||
debug("Loaded plugin %o from %o.", name, dirname);
|
||||
return {
|
||||
filepath,
|
||||
@ -73,14 +97,9 @@ function loadPlugin(name, dirname) {
|
||||
};
|
||||
}
|
||||
|
||||
function loadPreset(name, dirname) {
|
||||
const filepath = resolvePreset(name, dirname);
|
||||
|
||||
if (!filepath) {
|
||||
throw new Error(`Preset ${name} not found relative to ${dirname}`);
|
||||
}
|
||||
|
||||
const value = requireModule("preset", filepath);
|
||||
function* loadPreset(name, dirname) {
|
||||
const filepath = yield* resolvePreset(name, dirname);
|
||||
const value = yield* requireModule("preset", filepath);
|
||||
debug("Loaded preset %o from %o.", name, dirname);
|
||||
return {
|
||||
filepath,
|
||||
@ -89,81 +108,168 @@ function loadPreset(name, dirname) {
|
||||
}
|
||||
|
||||
function standardizeName(type, name) {
|
||||
if (_path().default.isAbsolute(name)) return name;
|
||||
if (_path().isAbsolute(name)) return name;
|
||||
const isPreset = type === "preset";
|
||||
return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, `babel-${type}-`).replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, `$1${type}-`).replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, `$1babel-${type}-`).replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`).replace(EXACT_RE, "");
|
||||
}
|
||||
|
||||
function resolveStandardizedName(type, name, dirname = process.cwd()) {
|
||||
function* resolveAlternativesHelper(type, name) {
|
||||
const standardizedName = standardizeName(type, name);
|
||||
const {
|
||||
error,
|
||||
value
|
||||
} = yield standardizedName;
|
||||
if (!error) return value;
|
||||
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
||||
|
||||
if (standardizedName !== name && !(yield name).error) {
|
||||
error.message += `\n- If you want to resolve "${name}", use "module:${name}"`;
|
||||
}
|
||||
|
||||
if (!(yield standardizeName(type, "@babel/" + name)).error) {
|
||||
error.message += `\n- Did you mean "@babel/${name}"?`;
|
||||
}
|
||||
|
||||
const oppositeType = type === "preset" ? "plugin" : "preset";
|
||||
|
||||
if (!(yield standardizeName(oppositeType, name)).error) {
|
||||
error.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
function tryRequireResolve(id, {
|
||||
paths: [dirname]
|
||||
}) {
|
||||
try {
|
||||
return _resolve().default.sync(standardizedName, {
|
||||
basedir: dirname
|
||||
});
|
||||
} catch (e) {
|
||||
if (e.code !== "MODULE_NOT_FOUND") throw e;
|
||||
return {
|
||||
error: null,
|
||||
value: (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
|
||||
paths: [b]
|
||||
}, M = require("module")) => {
|
||||
let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
|
||||
|
||||
if (standardizedName !== name) {
|
||||
let resolvedOriginal = false;
|
||||
if (f) return f;
|
||||
f = new Error(`Cannot resolve module '${r}'`);
|
||||
f.code = "MODULE_NOT_FOUND";
|
||||
throw f;
|
||||
})(id, {
|
||||
paths: [dirname]
|
||||
})
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
error,
|
||||
value: null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function tryImportMetaResolve(_x, _x2) {
|
||||
return _tryImportMetaResolve.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _tryImportMetaResolve() {
|
||||
_tryImportMetaResolve = _asyncToGenerator(function* (id, options) {
|
||||
try {
|
||||
return {
|
||||
error: null,
|
||||
value: yield (0, _importMetaResolve.default)(id, options)
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
error,
|
||||
value: null
|
||||
};
|
||||
}
|
||||
});
|
||||
return _tryImportMetaResolve.apply(this, arguments);
|
||||
}
|
||||
|
||||
function resolveStandardizedNameForRequire(type, name, dirname) {
|
||||
const it = resolveAlternativesHelper(type, name);
|
||||
let res = it.next();
|
||||
|
||||
while (!res.done) {
|
||||
res = it.next(tryRequireResolve(res.value, {
|
||||
paths: [dirname]
|
||||
}));
|
||||
}
|
||||
|
||||
return res.value;
|
||||
}
|
||||
|
||||
function resolveStandardizedNameForImport(_x3, _x4, _x5) {
|
||||
return _resolveStandardizedNameForImport.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _resolveStandardizedNameForImport() {
|
||||
_resolveStandardizedNameForImport = _asyncToGenerator(function* (type, name, dirname) {
|
||||
const parentUrl = (0, _url().pathToFileURL)(_path().join(dirname, "./babel-virtual-resolve-base.js")).href;
|
||||
const it = resolveAlternativesHelper(type, name);
|
||||
let res = it.next();
|
||||
|
||||
while (!res.done) {
|
||||
res = it.next(yield tryImportMetaResolve(res.value, parentUrl));
|
||||
}
|
||||
|
||||
return (0, _url().fileURLToPath)(res.value);
|
||||
});
|
||||
return _resolveStandardizedNameForImport.apply(this, arguments);
|
||||
}
|
||||
|
||||
const resolveStandardizedName = _gensync()({
|
||||
sync(type, name, dirname = process.cwd()) {
|
||||
return resolveStandardizedNameForRequire(type, name, dirname);
|
||||
},
|
||||
|
||||
async(type, name, dirname = process.cwd()) {
|
||||
return _asyncToGenerator(function* () {
|
||||
if (!_moduleTypes.supportsESM) {
|
||||
return resolveStandardizedNameForRequire(type, name, dirname);
|
||||
}
|
||||
|
||||
try {
|
||||
_resolve().default.sync(name, {
|
||||
basedir: dirname
|
||||
});
|
||||
|
||||
resolvedOriginal = true;
|
||||
} catch (_unused) {}
|
||||
|
||||
if (resolvedOriginal) {
|
||||
e.message += `\n- If you want to resolve "${name}", use "module:${name}"`;
|
||||
return yield resolveStandardizedNameForImport(type, name, dirname);
|
||||
} catch (e) {
|
||||
try {
|
||||
return resolveStandardizedNameForRequire(type, name, dirname);
|
||||
} catch (e2) {
|
||||
if (e.type === "MODULE_NOT_FOUND") throw e;
|
||||
if (e2.type === "MODULE_NOT_FOUND") throw e2;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let resolvedBabel = false;
|
||||
|
||||
try {
|
||||
_resolve().default.sync(standardizeName(type, "@babel/" + name), {
|
||||
basedir: dirname
|
||||
});
|
||||
|
||||
resolvedBabel = true;
|
||||
} catch (_unused2) {}
|
||||
|
||||
if (resolvedBabel) {
|
||||
e.message += `\n- Did you mean "@babel/${name}"?`;
|
||||
}
|
||||
|
||||
let resolvedOppositeType = false;
|
||||
const oppositeType = type === "preset" ? "plugin" : "preset";
|
||||
|
||||
try {
|
||||
_resolve().default.sync(standardizeName(oppositeType, name), {
|
||||
basedir: dirname
|
||||
});
|
||||
|
||||
resolvedOppositeType = true;
|
||||
} catch (_unused3) {}
|
||||
|
||||
if (resolvedOppositeType) {
|
||||
e.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
|
||||
}
|
||||
|
||||
throw e;
|
||||
})();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
{
|
||||
var LOADING_MODULES = new Set();
|
||||
}
|
||||
|
||||
const LOADING_MODULES = new Set();
|
||||
|
||||
function requireModule(type, name) {
|
||||
if (LOADING_MODULES.has(name)) {
|
||||
throw new Error(`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.');
|
||||
function* requireModule(type, name) {
|
||||
{
|
||||
if (!(yield* (0, _async.isAsync)()) && LOADING_MODULES.has(name)) {
|
||||
throw new Error(`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.');
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
LOADING_MODULES.add(name);
|
||||
return require(name);
|
||||
{
|
||||
LOADING_MODULES.add(name);
|
||||
}
|
||||
return yield* (0, _moduleTypes.default)(name, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously.", true);
|
||||
} catch (err) {
|
||||
err.message = `[BABEL]: ${err.message} (While processing: ${name})`;
|
||||
throw err;
|
||||
} finally {
|
||||
LOADING_MODULES.delete(name);
|
||||
{
|
||||
LOADING_MODULES.delete(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
0 && 0;
|
1
node_modules/@babel/core/lib/config/files/types.js
generated
vendored
1
node_modules/@babel/core/lib/config/files/types.js
generated
vendored
@ -0,0 +1 @@
|
||||
0 && 0;
|
17
node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
17
node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
@ -7,10 +7,10 @@ exports.makeStaticFileCache = makeStaticFileCache;
|
||||
|
||||
var _caching = require("../caching");
|
||||
|
||||
var fs = _interopRequireWildcard(require("../../gensync-utils/fs"));
|
||||
var fs = require("../../gensync-utils/fs");
|
||||
|
||||
function _fs2() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
const data = require("fs");
|
||||
|
||||
_fs2 = function () {
|
||||
return data;
|
||||
@ -19,18 +19,11 @@ function _fs2() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function makeStaticFileCache(fn) {
|
||||
return (0, _caching.makeStrongCache)(function* (filepath, cache) {
|
||||
const cached = cache.invalidate(() => fileMtime(filepath));
|
||||
|
||||
if (cached === null) {
|
||||
cache.forever();
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -39,11 +32,15 @@ function makeStaticFileCache(fn) {
|
||||
}
|
||||
|
||||
function fileMtime(filepath) {
|
||||
if (!_fs2().existsSync(filepath)) return null;
|
||||
|
||||
try {
|
||||
return +_fs2().default.statSync(filepath).mtime;
|
||||
return +_fs2().statSync(filepath).mtime;
|
||||
} catch (e) {
|
||||
if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
0 && 0;
|
289
node_modules/@babel/core/lib/config/full.js
generated
vendored
289
node_modules/@babel/core/lib/config/full.js
generated
vendored
@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.default = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
@ -19,16 +19,18 @@ var _async = require("../gensync-utils/async");
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
var context = _interopRequireWildcard(require("../index"));
|
||||
var context = require("../index");
|
||||
|
||||
var _plugin = _interopRequireDefault(require("./plugin"));
|
||||
var _plugin = require("./plugin");
|
||||
|
||||
var _item = require("./item");
|
||||
|
||||
var _configChain = require("./config-chain");
|
||||
|
||||
var _deepArray = require("./helpers/deep-array");
|
||||
|
||||
function _traverse() {
|
||||
const data = _interopRequireDefault(require("@babel/traverse"));
|
||||
const data = require("@babel/traverse");
|
||||
|
||||
_traverse = function () {
|
||||
return data;
|
||||
@ -43,17 +45,15 @@ var _options = require("./validation/options");
|
||||
|
||||
var _plugins = require("./validation/plugins");
|
||||
|
||||
var _configApi = _interopRequireDefault(require("./helpers/config-api"));
|
||||
var _configApi = require("./helpers/config-api");
|
||||
|
||||
var _partial = _interopRequireDefault(require("./partial"));
|
||||
var _partial = require("./partial");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
var Context = require("./cache-contexts");
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
var _default = _gensync()(function* loadFullConfig(inputOpts) {
|
||||
var _opts$assumptions;
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var _default = (0, _gensync().default)(function* loadFullConfig(inputOpts) {
|
||||
const result = yield* (0, _partial.default)(inputOpts);
|
||||
|
||||
if (!result) {
|
||||
@ -62,114 +62,126 @@ var _default = (0, _gensync().default)(function* loadFullConfig(inputOpts) {
|
||||
|
||||
const {
|
||||
options,
|
||||
context
|
||||
context,
|
||||
fileHandling
|
||||
} = result;
|
||||
|
||||
if (fileHandling === "ignored") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const optionDefaults = {};
|
||||
const passes = [[]];
|
||||
const {
|
||||
plugins,
|
||||
presets
|
||||
} = options;
|
||||
|
||||
try {
|
||||
const {
|
||||
plugins,
|
||||
presets
|
||||
} = options;
|
||||
if (!plugins || !presets) {
|
||||
throw new Error("Assertion failure - plugins and presets exist");
|
||||
}
|
||||
|
||||
if (!plugins || !presets) {
|
||||
throw new Error("Assertion failure - plugins and presets exist");
|
||||
const presetContext = Object.assign({}, context, {
|
||||
targets: options.targets
|
||||
});
|
||||
|
||||
const toDescriptor = item => {
|
||||
const desc = (0, _item.getItemDescriptor)(item);
|
||||
|
||||
if (!desc) {
|
||||
throw new Error("Assertion failure - must be config item");
|
||||
}
|
||||
|
||||
const ignored = yield* function* recurseDescriptors(config, pass) {
|
||||
const plugins = [];
|
||||
return desc;
|
||||
};
|
||||
|
||||
for (let i = 0; i < config.plugins.length; i++) {
|
||||
const descriptor = config.plugins[i];
|
||||
const presetsDescriptors = presets.map(toDescriptor);
|
||||
const initialPluginsDescriptors = plugins.map(toDescriptor);
|
||||
const pluginDescriptorsByPass = [[]];
|
||||
const passes = [];
|
||||
const externalDependencies = [];
|
||||
const ignored = yield* enhanceError(context, function* recursePresetDescriptors(rawPresets, pluginDescriptorsPass) {
|
||||
const presets = [];
|
||||
|
||||
if (descriptor.options !== false) {
|
||||
try {
|
||||
plugins.push(yield* loadPluginDescriptor(descriptor, context));
|
||||
} catch (e) {
|
||||
if (i > 0 && e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") {
|
||||
(0, _options.checkNoUnwrappedItemOptionPairs)(config.plugins[i - 1], descriptor, "plugin", i, e);
|
||||
}
|
||||
for (let i = 0; i < rawPresets.length; i++) {
|
||||
const descriptor = rawPresets[i];
|
||||
|
||||
throw e;
|
||||
if (descriptor.options !== false) {
|
||||
try {
|
||||
var preset = yield* loadPresetDescriptor(descriptor, presetContext);
|
||||
} catch (e) {
|
||||
if (e.code === "BABEL_UNKNOWN_OPTION") {
|
||||
(0, _options.checkNoUnwrappedItemOptionPairs)(rawPresets, i, "preset", e);
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
const presets = [];
|
||||
externalDependencies.push(preset.externalDependencies);
|
||||
|
||||
for (let i = 0; i < config.presets.length; i++) {
|
||||
const descriptor = config.presets[i];
|
||||
|
||||
if (descriptor.options !== false) {
|
||||
try {
|
||||
presets.push({
|
||||
preset: yield* loadPresetDescriptor(descriptor, context),
|
||||
pass: descriptor.ownPass ? [] : pass
|
||||
});
|
||||
} catch (e) {
|
||||
if (i > 0 && e.code === "BABEL_UNKNOWN_OPTION") {
|
||||
(0, _options.checkNoUnwrappedItemOptionPairs)(config.presets[i - 1], descriptor, "preset", i, e);
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (presets.length > 0) {
|
||||
passes.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pass));
|
||||
|
||||
for (const {
|
||||
preset,
|
||||
pass
|
||||
} of presets) {
|
||||
if (!preset) return true;
|
||||
const ignored = yield* recurseDescriptors({
|
||||
plugins: preset.plugins,
|
||||
presets: preset.presets
|
||||
}, pass);
|
||||
if (ignored) return true;
|
||||
preset.options.forEach(opts => {
|
||||
(0, _util.mergeOptions)(optionDefaults, opts);
|
||||
if (descriptor.ownPass) {
|
||||
presets.push({
|
||||
preset: preset.chain,
|
||||
pass: []
|
||||
});
|
||||
} else {
|
||||
presets.unshift({
|
||||
preset: preset.chain,
|
||||
pass: pluginDescriptorsPass
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (plugins.length > 0) {
|
||||
pass.unshift(...plugins);
|
||||
}
|
||||
}({
|
||||
plugins: plugins.map(item => {
|
||||
const desc = (0, _item.getItemDescriptor)(item);
|
||||
|
||||
if (!desc) {
|
||||
throw new Error("Assertion failure - must be config item");
|
||||
}
|
||||
|
||||
return desc;
|
||||
}),
|
||||
presets: presets.map(item => {
|
||||
const desc = (0, _item.getItemDescriptor)(item);
|
||||
|
||||
if (!desc) {
|
||||
throw new Error("Assertion failure - must be config item");
|
||||
}
|
||||
|
||||
return desc;
|
||||
})
|
||||
}, passes[0]);
|
||||
if (ignored) return null;
|
||||
} catch (e) {
|
||||
if (!/^\[BABEL\]/.test(e.message)) {
|
||||
e.message = `[BABEL] ${context.filename || "unknown"}: ${e.message}`;
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
if (presets.length > 0) {
|
||||
pluginDescriptorsByPass.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pluginDescriptorsPass));
|
||||
|
||||
for (const {
|
||||
preset,
|
||||
pass
|
||||
} of presets) {
|
||||
if (!preset) return true;
|
||||
pass.push(...preset.plugins);
|
||||
const ignored = yield* recursePresetDescriptors(preset.presets, pass);
|
||||
if (ignored) return true;
|
||||
preset.options.forEach(opts => {
|
||||
(0, _util.mergeOptions)(optionDefaults, opts);
|
||||
});
|
||||
}
|
||||
}
|
||||
})(presetsDescriptors, pluginDescriptorsByPass[0]);
|
||||
if (ignored) return null;
|
||||
const opts = optionDefaults;
|
||||
(0, _util.mergeOptions)(opts, options);
|
||||
const pluginContext = Object.assign({}, presetContext, {
|
||||
assumptions: (_opts$assumptions = opts.assumptions) != null ? _opts$assumptions : {}
|
||||
});
|
||||
yield* enhanceError(context, function* loadPluginDescriptors() {
|
||||
pluginDescriptorsByPass[0].unshift(...initialPluginsDescriptors);
|
||||
|
||||
for (const descs of pluginDescriptorsByPass) {
|
||||
const pass = [];
|
||||
passes.push(pass);
|
||||
|
||||
for (let i = 0; i < descs.length; i++) {
|
||||
const descriptor = descs[i];
|
||||
|
||||
if (descriptor.options !== false) {
|
||||
try {
|
||||
var plugin = yield* loadPluginDescriptor(descriptor, pluginContext);
|
||||
} catch (e) {
|
||||
if (e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") {
|
||||
(0, _options.checkNoUnwrappedItemOptionPairs)(descs, i, "plugin", e);
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
pass.push(plugin);
|
||||
externalDependencies.push(plugin.externalDependencies);
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
opts.plugins = passes[0];
|
||||
opts.presets = passes.slice(1).filter(plugins => plugins.length > 0).map(plugins => ({
|
||||
plugins
|
||||
@ -177,12 +189,28 @@ var _default = (0, _gensync().default)(function* loadFullConfig(inputOpts) {
|
||||
opts.passPerPreset = opts.presets.length > 0;
|
||||
return {
|
||||
options: opts,
|
||||
passes: passes
|
||||
passes: passes,
|
||||
externalDependencies: (0, _deepArray.finalize)(externalDependencies)
|
||||
};
|
||||
});
|
||||
|
||||
exports.default = _default;
|
||||
const loadDescriptor = (0, _caching.makeWeakCache)(function* ({
|
||||
|
||||
function enhanceError(context, fn) {
|
||||
return function* (arg1, arg2) {
|
||||
try {
|
||||
return yield* fn(arg1, arg2);
|
||||
} catch (e) {
|
||||
if (!/^\[BABEL\]/.test(e.message)) {
|
||||
e.message = `[BABEL] ${context.filename || "unknown"}: ${e.message}`;
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const makeDescriptorLoader = apiFactory => (0, _caching.makeWeakCache)(function* ({
|
||||
value,
|
||||
options,
|
||||
dirname,
|
||||
@ -190,13 +218,15 @@ const loadDescriptor = (0, _caching.makeWeakCache)(function* ({
|
||||
}, cache) {
|
||||
if (options === false) throw new Error("Assertion failure");
|
||||
options = options || {};
|
||||
const externalDependencies = [];
|
||||
let item = value;
|
||||
|
||||
if (typeof value === "function") {
|
||||
const api = Object.assign({}, context, (0, _configApi.default)(cache));
|
||||
const factory = (0, _async.maybeAsync)(value, `You appear to be using an async plugin/preset, but Babel has been called synchronously`);
|
||||
const api = Object.assign({}, context, apiFactory(cache, externalDependencies));
|
||||
|
||||
try {
|
||||
item = value(api, options, dirname);
|
||||
item = yield* factory(api, options, dirname);
|
||||
} catch (e) {
|
||||
if (alias) {
|
||||
e.message += ` (While processing: ${JSON.stringify(alias)})`;
|
||||
@ -210,19 +240,36 @@ const loadDescriptor = (0, _caching.makeWeakCache)(function* ({
|
||||
throw new Error("Plugin/Preset did not return an object.");
|
||||
}
|
||||
|
||||
if (typeof item.then === "function") {
|
||||
if ((0, _async.isThenable)(item)) {
|
||||
yield* [];
|
||||
throw new Error(`You appear to be using an async plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`);
|
||||
throw new Error(`You appear to be using a promise as a plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version. ` + `As an alternative, you can prefix the promise with "await". ` + `(While processing: ${JSON.stringify(alias)})`);
|
||||
}
|
||||
|
||||
if (externalDependencies.length > 0 && (!cache.configured() || cache.mode() === "forever")) {
|
||||
let error = `A plugin/preset has external untracked dependencies ` + `(${externalDependencies[0]}), but the cache `;
|
||||
|
||||
if (!cache.configured()) {
|
||||
error += `has not been configured to be invalidated when the external dependencies change. `;
|
||||
} else {
|
||||
error += ` has been configured to never be invalidated. `;
|
||||
}
|
||||
|
||||
error += `Plugins/presets should configure their cache to be invalidated when the external ` + `dependencies change, for example using \`api.cache.invalidate(() => ` + `statSync(filepath).mtimeMs)\` or \`api.cache.never()\`\n` + `(While processing: ${JSON.stringify(alias)})`;
|
||||
throw new Error(error);
|
||||
}
|
||||
|
||||
return {
|
||||
value: item,
|
||||
options,
|
||||
dirname,
|
||||
alias
|
||||
alias,
|
||||
externalDependencies: (0, _deepArray.finalize)(externalDependencies)
|
||||
};
|
||||
});
|
||||
|
||||
const pluginDescriptorLoader = makeDescriptorLoader(_configApi.makePluginAPI);
|
||||
const presetDescriptorLoader = makeDescriptorLoader(_configApi.makePresetAPI);
|
||||
|
||||
function* loadPluginDescriptor(descriptor, context) {
|
||||
if (descriptor.value instanceof _plugin.default) {
|
||||
if (descriptor.options) {
|
||||
@ -232,14 +279,15 @@ function* loadPluginDescriptor(descriptor, context) {
|
||||
return descriptor.value;
|
||||
}
|
||||
|
||||
return yield* instantiatePlugin(yield* loadDescriptor(descriptor, context), context);
|
||||
return yield* instantiatePlugin(yield* pluginDescriptorLoader(descriptor, context), context);
|
||||
}
|
||||
|
||||
const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({
|
||||
value,
|
||||
options,
|
||||
dirname,
|
||||
alias
|
||||
alias,
|
||||
externalDependencies
|
||||
}, cache) {
|
||||
const pluginObj = (0, _plugins.validatePluginObject)(value);
|
||||
const plugin = Object.assign({}, pluginObj);
|
||||
@ -263,15 +311,23 @@ const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({
|
||||
plugin.post = chain(inherits.post, plugin.post);
|
||||
plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions);
|
||||
plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]);
|
||||
|
||||
if (inherits.externalDependencies.length > 0) {
|
||||
if (externalDependencies.length === 0) {
|
||||
externalDependencies = inherits.externalDependencies;
|
||||
} else {
|
||||
externalDependencies = (0, _deepArray.finalize)([externalDependencies, inherits.externalDependencies]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new _plugin.default(plugin, options, alias);
|
||||
return new _plugin.default(plugin, options, alias, externalDependencies);
|
||||
});
|
||||
|
||||
const validateIfOptionNeedsFilename = (options, descriptor) => {
|
||||
if (options.test || options.include || options.exclude) {
|
||||
const formattedPresetName = descriptor.name ? `"${descriptor.name}"` : "/* your preset */";
|
||||
throw new Error([`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, `\`\`\``, `babel.transform(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, `\`\`\``, `See https://babeljs.io/docs/en/options#filename for more information.`].join("\n"));
|
||||
throw new Error([`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, `\`\`\``, `babel.transformSync(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, `\`\`\``, `See https://babeljs.io/docs/en/options#filename for more information.`].join("\n"));
|
||||
}
|
||||
};
|
||||
|
||||
@ -289,20 +345,25 @@ const validatePreset = (preset, context, descriptor) => {
|
||||
};
|
||||
|
||||
function* loadPresetDescriptor(descriptor, context) {
|
||||
const preset = instantiatePreset(yield* loadDescriptor(descriptor, context));
|
||||
const preset = instantiatePreset(yield* presetDescriptorLoader(descriptor, context));
|
||||
validatePreset(preset, context, descriptor);
|
||||
return yield* (0, _configChain.buildPresetChain)(preset, context);
|
||||
return {
|
||||
chain: yield* (0, _configChain.buildPresetChain)(preset, context),
|
||||
externalDependencies: preset.externalDependencies
|
||||
};
|
||||
}
|
||||
|
||||
const instantiatePreset = (0, _caching.makeWeakCacheSync)(({
|
||||
value,
|
||||
dirname,
|
||||
alias
|
||||
alias,
|
||||
externalDependencies
|
||||
}) => {
|
||||
return {
|
||||
options: (0, _options.validate)("preset", value),
|
||||
alias,
|
||||
dirname
|
||||
dirname,
|
||||
externalDependencies
|
||||
};
|
||||
});
|
||||
|
||||
@ -315,3 +376,5 @@ function chain(a, b) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
0 && 0;
|
38
node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
38
node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
@ -3,10 +3,12 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = makeAPI;
|
||||
exports.makeConfigAPI = makeConfigAPI;
|
||||
exports.makePluginAPI = makePluginAPI;
|
||||
exports.makePresetAPI = makePresetAPI;
|
||||
|
||||
function _semver() {
|
||||
const data = _interopRequireDefault(require("semver"));
|
||||
const data = require("semver");
|
||||
|
||||
_semver = function () {
|
||||
return data;
|
||||
@ -19,9 +21,9 @@ var _ = require("../../");
|
||||
|
||||
var _caching = require("../caching");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var Context = require("../cache-contexts");
|
||||
|
||||
function makeAPI(cache) {
|
||||
function makeConfigAPI(cache) {
|
||||
const env = value => cache.using(data => {
|
||||
if (typeof value === "undefined") return data.envName;
|
||||
|
||||
@ -29,8 +31,7 @@ function makeAPI(cache) {
|
||||
return (0, _caching.assertSimpleType)(value(data.envName));
|
||||
}
|
||||
|
||||
if (!Array.isArray(value)) value = [value];
|
||||
return value.some(entry => {
|
||||
return (Array.isArray(value) ? value : [value]).some(entry => {
|
||||
if (typeof entry !== "string") {
|
||||
throw new Error("Unexpected non-string value");
|
||||
}
|
||||
@ -51,6 +52,27 @@ function makeAPI(cache) {
|
||||
};
|
||||
}
|
||||
|
||||
function makePresetAPI(cache, externalDependencies) {
|
||||
const targets = () => JSON.parse(cache.using(data => JSON.stringify(data.targets)));
|
||||
|
||||
const addExternalDependency = ref => {
|
||||
externalDependencies.push(ref);
|
||||
};
|
||||
|
||||
return Object.assign({}, makeConfigAPI(cache), {
|
||||
targets,
|
||||
addExternalDependency
|
||||
});
|
||||
}
|
||||
|
||||
function makePluginAPI(cache, externalDependencies) {
|
||||
const assumption = name => cache.using(data => data.assumptions[name]);
|
||||
|
||||
return Object.assign({}, makePresetAPI(cache, externalDependencies), {
|
||||
assumption
|
||||
});
|
||||
}
|
||||
|
||||
function assertVersion(range) {
|
||||
if (typeof range === "number") {
|
||||
if (!Number.isInteger(range)) {
|
||||
@ -64,7 +86,7 @@ function assertVersion(range) {
|
||||
throw new Error("Expected string or integer value.");
|
||||
}
|
||||
|
||||
if (_semver().default.satisfies(_.version, range)) return;
|
||||
if (_semver().satisfies(_.version, range)) return;
|
||||
const limit = Error.stackTraceLimit;
|
||||
|
||||
if (typeof limit === "number" && limit < 25) {
|
||||
@ -83,3 +105,5 @@ function assertVersion(range) {
|
||||
range
|
||||
});
|
||||
}
|
||||
|
||||
0 && 0;
|
26
node_modules/@babel/core/lib/config/helpers/deep-array.js
generated
vendored
Normal file
26
node_modules/@babel/core/lib/config/helpers/deep-array.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.finalize = finalize;
|
||||
exports.flattenToSet = flattenToSet;
|
||||
|
||||
function finalize(deepArr) {
|
||||
return Object.freeze(deepArr);
|
||||
}
|
||||
|
||||
function flattenToSet(arr) {
|
||||
const result = new Set();
|
||||
const stack = [arr];
|
||||
|
||||
while (stack.length > 0) {
|
||||
for (const el of stack.pop()) {
|
||||
if (Array.isArray(el)) stack.push(el);else result.add(el);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
0 && 0;
|
2
node_modules/@babel/core/lib/config/helpers/environment.js
generated
vendored
2
node_modules/@babel/core/lib/config/helpers/environment.js
generated
vendored
@ -8,3 +8,5 @@ exports.getEnv = getEnv;
|
||||
function getEnv(defaultValue = "development") {
|
||||
return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;
|
||||
}
|
||||
|
||||
0 && 0;
|
30
node_modules/@babel/core/lib/config/index.js
generated
vendored
30
node_modules/@babel/core/lib/config/index.js
generated
vendored
@ -3,16 +3,18 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createConfigItem = createConfigItem;
|
||||
exports.createConfigItemSync = exports.createConfigItemAsync = void 0;
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _full.default;
|
||||
}
|
||||
});
|
||||
exports.loadOptionsAsync = exports.loadOptionsSync = exports.loadOptions = exports.loadPartialConfigAsync = exports.loadPartialConfigSync = exports.loadPartialConfig = void 0;
|
||||
exports.loadPartialConfigSync = exports.loadPartialConfigAsync = exports.loadPartialConfig = exports.loadOptionsSync = exports.loadOptionsAsync = exports.loadOptions = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
@ -21,19 +23,21 @@ function _gensync() {
|
||||
return data;
|
||||
}
|
||||
|
||||
var _full = _interopRequireDefault(require("./full"));
|
||||
var _full = require("./full");
|
||||
|
||||
var _partial = require("./partial");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _item = require("./item");
|
||||
|
||||
const loadOptionsRunner = (0, _gensync().default)(function* (opts) {
|
||||
const loadOptionsRunner = _gensync()(function* (opts) {
|
||||
var _config$options;
|
||||
|
||||
const config = yield* (0, _full.default)(opts);
|
||||
return (_config$options = config == null ? void 0 : config.options) != null ? _config$options : null;
|
||||
});
|
||||
|
||||
const createConfigItemRunner = _gensync()(_item.createConfigItem);
|
||||
|
||||
const maybeErrback = runner => (opts, callback) => {
|
||||
if (callback === undefined && typeof opts === "function") {
|
||||
callback = opts;
|
||||
@ -55,3 +59,19 @@ const loadOptionsSync = loadOptionsRunner.sync;
|
||||
exports.loadOptionsSync = loadOptionsSync;
|
||||
const loadOptionsAsync = loadOptionsRunner.async;
|
||||
exports.loadOptionsAsync = loadOptionsAsync;
|
||||
const createConfigItemSync = createConfigItemRunner.sync;
|
||||
exports.createConfigItemSync = createConfigItemSync;
|
||||
const createConfigItemAsync = createConfigItemRunner.async;
|
||||
exports.createConfigItemAsync = createConfigItemAsync;
|
||||
|
||||
function createConfigItem(target, options, callback) {
|
||||
if (callback !== undefined) {
|
||||
return createConfigItemRunner.errback(target, options, callback);
|
||||
} else if (typeof options === "function") {
|
||||
return createConfigItemRunner.errback(target, undefined, callback);
|
||||
} else {
|
||||
return createConfigItemRunner.sync(target, options);
|
||||
}
|
||||
}
|
||||
|
||||
0 && 0;
|
25
node_modules/@babel/core/lib/config/item.js
generated
vendored
25
node_modules/@babel/core/lib/config/item.js
generated
vendored
@ -3,12 +3,12 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createItemFromDescriptor = createItemFromDescriptor;
|
||||
exports.createConfigItem = createConfigItem;
|
||||
exports.createItemFromDescriptor = createItemFromDescriptor;
|
||||
exports.getItemDescriptor = getItemDescriptor;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
@ -19,17 +19,15 @@ function _path() {
|
||||
|
||||
var _configDescriptors = require("./config-descriptors");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function createItemFromDescriptor(desc) {
|
||||
return new ConfigItem(desc);
|
||||
}
|
||||
|
||||
function createConfigItem(value, {
|
||||
function* createConfigItem(value, {
|
||||
dirname = ".",
|
||||
type
|
||||
} = {}) {
|
||||
const descriptor = (0, _configDescriptors.createDescriptor)(value, _path().default.resolve(dirname), {
|
||||
const descriptor = yield* (0, _configDescriptors.createDescriptor)(value, _path().resolve(dirname), {
|
||||
type,
|
||||
alias: "programmatic item"
|
||||
});
|
||||
@ -37,19 +35,31 @@ function createConfigItem(value, {
|
||||
}
|
||||
|
||||
function getItemDescriptor(item) {
|
||||
if (item instanceof ConfigItem) {
|
||||
if (item != null && item[CONFIG_ITEM_BRAND]) {
|
||||
return item._descriptor;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const CONFIG_ITEM_BRAND = Symbol.for("@babel/core@7 - ConfigItem");
|
||||
|
||||
class ConfigItem {
|
||||
constructor(descriptor) {
|
||||
this._descriptor = void 0;
|
||||
this[CONFIG_ITEM_BRAND] = true;
|
||||
this.value = void 0;
|
||||
this.options = void 0;
|
||||
this.dirname = void 0;
|
||||
this.name = void 0;
|
||||
this.file = void 0;
|
||||
this._descriptor = descriptor;
|
||||
Object.defineProperty(this, "_descriptor", {
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(this, CONFIG_ITEM_BRAND, {
|
||||
enumerable: false
|
||||
});
|
||||
this.value = this._descriptor.value;
|
||||
this.options = this._descriptor.options;
|
||||
this.dirname = this._descriptor.dirname;
|
||||
@ -64,3 +74,4 @@ class ConfigItem {
|
||||
}
|
||||
|
||||
Object.freeze(ConfigItem.prototype);
|
||||
0 && 0;
|
104
node_modules/@babel/core/lib/config/partial.js
generated
vendored
104
node_modules/@babel/core/lib/config/partial.js
generated
vendored
@ -7,7 +7,7 @@ exports.default = loadPrivatePartialConfig;
|
||||
exports.loadPartialConfig = void 0;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
@ -17,7 +17,7 @@ function _path() {
|
||||
}
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
@ -26,7 +26,7 @@ function _gensync() {
|
||||
return data;
|
||||
}
|
||||
|
||||
var _plugin = _interopRequireDefault(require("./plugin"));
|
||||
var _plugin = require("./plugin");
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
@ -40,22 +40,26 @@ var _options = require("./validation/options");
|
||||
|
||||
var _files = require("./files");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _resolveTargets = require("./resolve-targets");
|
||||
|
||||
function* resolveRootMode(rootDir, rootMode) {
|
||||
const _excluded = ["showIgnoredFiles"];
|
||||
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
||||
|
||||
function resolveRootMode(rootDir, rootMode) {
|
||||
switch (rootMode) {
|
||||
case "root":
|
||||
return rootDir;
|
||||
|
||||
case "upward-optional":
|
||||
{
|
||||
const upwardRootDir = yield* (0, _files.findConfigUpwards)(rootDir);
|
||||
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir);
|
||||
return upwardRootDir === null ? rootDir : upwardRootDir;
|
||||
}
|
||||
|
||||
case "upward":
|
||||
{
|
||||
const upwardRootDir = yield* (0, _files.findConfigUpwards)(rootDir);
|
||||
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir);
|
||||
if (upwardRootDir !== null) return upwardRootDir;
|
||||
throw Object.assign(new Error(`Babel was run with rootMode:"upward" but a root could not ` + `be found when searching upward from "${rootDir}".\n` + `One of the following config files must be in the directory tree: ` + `"${_files.ROOT_CONFIG_FILENAMES.join(", ")}".`), {
|
||||
code: "BABEL_ROOT_NOT_FOUND",
|
||||
@ -79,67 +83,108 @@ function* loadPrivatePartialConfig(inputOpts) {
|
||||
cwd = ".",
|
||||
root: rootDir = ".",
|
||||
rootMode = "root",
|
||||
caller
|
||||
caller,
|
||||
cloneInputAst = true
|
||||
} = args;
|
||||
|
||||
const absoluteCwd = _path().default.resolve(cwd);
|
||||
const absoluteCwd = _path().resolve(cwd);
|
||||
|
||||
const absoluteRootDir = yield* resolveRootMode(_path().default.resolve(absoluteCwd, rootDir), rootMode);
|
||||
const absoluteRootDir = resolveRootMode(_path().resolve(absoluteCwd, rootDir), rootMode);
|
||||
const filename = typeof args.filename === "string" ? _path().resolve(cwd, args.filename) : undefined;
|
||||
const showConfigPath = yield* (0, _files.resolveShowConfigPath)(absoluteCwd);
|
||||
const context = {
|
||||
filename: typeof args.filename === "string" ? _path().default.resolve(cwd, args.filename) : undefined,
|
||||
filename,
|
||||
cwd: absoluteCwd,
|
||||
root: absoluteRootDir,
|
||||
envName,
|
||||
caller
|
||||
caller,
|
||||
showConfig: showConfigPath === filename
|
||||
};
|
||||
const configChain = yield* (0, _configChain.buildRootChain)(args, context);
|
||||
if (!configChain) return null;
|
||||
const options = {};
|
||||
const merged = {
|
||||
assumptions: {}
|
||||
};
|
||||
configChain.options.forEach(opts => {
|
||||
(0, _util.mergeOptions)(options, opts);
|
||||
(0, _util.mergeOptions)(merged, opts);
|
||||
});
|
||||
const options = Object.assign({}, merged, {
|
||||
targets: (0, _resolveTargets.resolveTargets)(merged, absoluteRootDir),
|
||||
cloneInputAst,
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
browserslistConfigFile: false,
|
||||
passPerPreset: false,
|
||||
envName: context.envName,
|
||||
cwd: context.cwd,
|
||||
root: context.root,
|
||||
rootMode: "root",
|
||||
filename: typeof context.filename === "string" ? context.filename : undefined,
|
||||
plugins: configChain.plugins.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor)),
|
||||
presets: configChain.presets.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor))
|
||||
});
|
||||
options.babelrc = false;
|
||||
options.configFile = false;
|
||||
options.passPerPreset = false;
|
||||
options.envName = context.envName;
|
||||
options.cwd = context.cwd;
|
||||
options.root = context.root;
|
||||
options.filename = typeof context.filename === "string" ? context.filename : undefined;
|
||||
options.plugins = configChain.plugins.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor));
|
||||
options.presets = configChain.presets.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor));
|
||||
return {
|
||||
options,
|
||||
context,
|
||||
fileHandling: configChain.fileHandling,
|
||||
ignore: configChain.ignore,
|
||||
babelrc: configChain.babelrc,
|
||||
config: configChain.config
|
||||
config: configChain.config,
|
||||
files: configChain.files
|
||||
};
|
||||
}
|
||||
|
||||
const loadPartialConfig = (0, _gensync().default)(function* (inputOpts) {
|
||||
const result = yield* loadPrivatePartialConfig(inputOpts);
|
||||
const loadPartialConfig = _gensync()(function* (opts) {
|
||||
let showIgnoredFiles = false;
|
||||
|
||||
if (typeof opts === "object" && opts !== null && !Array.isArray(opts)) {
|
||||
var _opts = opts;
|
||||
({
|
||||
showIgnoredFiles
|
||||
} = _opts);
|
||||
opts = _objectWithoutPropertiesLoose(_opts, _excluded);
|
||||
_opts;
|
||||
}
|
||||
|
||||
const result = yield* loadPrivatePartialConfig(opts);
|
||||
if (!result) return null;
|
||||
const {
|
||||
options,
|
||||
babelrc,
|
||||
ignore,
|
||||
config
|
||||
config,
|
||||
fileHandling,
|
||||
files
|
||||
} = result;
|
||||
|
||||
if (fileHandling === "ignored" && !showIgnoredFiles) {
|
||||
return null;
|
||||
}
|
||||
|
||||
(options.plugins || []).forEach(item => {
|
||||
if (item.value instanceof _plugin.default) {
|
||||
throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()");
|
||||
}
|
||||
});
|
||||
return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined);
|
||||
return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined, fileHandling, files);
|
||||
});
|
||||
|
||||
exports.loadPartialConfig = loadPartialConfig;
|
||||
|
||||
class PartialConfig {
|
||||
constructor(options, babelrc, ignore, config) {
|
||||
constructor(options, babelrc, ignore, config, fileHandling, files) {
|
||||
this.options = void 0;
|
||||
this.babelrc = void 0;
|
||||
this.babelignore = void 0;
|
||||
this.config = void 0;
|
||||
this.fileHandling = void 0;
|
||||
this.files = void 0;
|
||||
this.options = options;
|
||||
this.babelignore = ignore;
|
||||
this.babelrc = babelrc;
|
||||
this.config = config;
|
||||
this.fileHandling = fileHandling;
|
||||
this.files = files;
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
@ -150,3 +195,4 @@ class PartialConfig {
|
||||
}
|
||||
|
||||
Object.freeze(PartialConfig.prototype);
|
||||
0 && 0;
|
28
node_modules/@babel/core/lib/config/pattern-to-regex.js
generated
vendored
28
node_modules/@babel/core/lib/config/pattern-to-regex.js
generated
vendored
@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.default = pathToPattern;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
@ -15,19 +15,7 @@ function _path() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _escapeRegExp() {
|
||||
const data = _interopRequireDefault(require("lodash/escapeRegExp"));
|
||||
|
||||
_escapeRegExp = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const sep = `\\${_path().default.sep}`;
|
||||
const sep = `\\${_path().sep}`;
|
||||
const endSep = `(?:${sep}|$)`;
|
||||
const substitution = `[^${sep}]+`;
|
||||
const starPat = `(?:${substitution}${sep})`;
|
||||
@ -35,8 +23,12 @@ const starPatLast = `(?:${substitution}${endSep})`;
|
||||
const starStarPat = `${starPat}*?`;
|
||||
const starStarPatLast = `${starPat}*?${starPatLast}?`;
|
||||
|
||||
function escapeRegExp(string) {
|
||||
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
||||
}
|
||||
|
||||
function pathToPattern(pattern, dirname) {
|
||||
const parts = _path().default.resolve(dirname, pattern).split(_path().default.sep);
|
||||
const parts = _path().resolve(dirname, pattern).split(_path().sep);
|
||||
|
||||
return new RegExp(["^", ...parts.map((part, i) => {
|
||||
const last = i === parts.length - 1;
|
||||
@ -44,9 +36,11 @@ function pathToPattern(pattern, dirname) {
|
||||
if (part === "*") return last ? starPatLast : starPat;
|
||||
|
||||
if (part.indexOf("*.") === 0) {
|
||||
return substitution + (0, _escapeRegExp().default)(part.slice(1)) + (last ? endSep : sep);
|
||||
return substitution + escapeRegExp(part.slice(1)) + (last ? endSep : sep);
|
||||
}
|
||||
|
||||
return (0, _escapeRegExp().default)(part) + (last ? endSep : sep);
|
||||
return escapeRegExp(part) + (last ? endSep : sep);
|
||||
})].join(""));
|
||||
}
|
||||
|
||||
0 && 0;
|
15
node_modules/@babel/core/lib/config/plugin.js
generated
vendored
15
node_modules/@babel/core/lib/config/plugin.js
generated
vendored
@ -5,8 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _deepArray = require("./helpers/deep-array");
|
||||
|
||||
class Plugin {
|
||||
constructor(plugin, options, key) {
|
||||
constructor(plugin, options, key, externalDependencies = (0, _deepArray.finalize)([])) {
|
||||
this.key = void 0;
|
||||
this.manipulateOptions = void 0;
|
||||
this.post = void 0;
|
||||
this.pre = void 0;
|
||||
this.visitor = void 0;
|
||||
this.parserOverride = void 0;
|
||||
this.generatorOverride = void 0;
|
||||
this.options = void 0;
|
||||
this.externalDependencies = void 0;
|
||||
this.key = plugin.name || key;
|
||||
this.manipulateOptions = plugin.manipulateOptions;
|
||||
this.post = plugin.post;
|
||||
@ -15,8 +26,10 @@ class Plugin {
|
||||
this.parserOverride = plugin.parserOverride;
|
||||
this.generatorOverride = plugin.generatorOverride;
|
||||
this.options = options;
|
||||
this.externalDependencies = externalDependencies;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = Plugin;
|
||||
0 && 0;
|
140
node_modules/@babel/core/lib/config/printer.js
generated
vendored
Normal file
140
node_modules/@babel/core/lib/config/printer.js
generated
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ConfigPrinter = exports.ChainFormatter = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const ChainFormatter = {
|
||||
Programmatic: 0,
|
||||
Config: 1
|
||||
};
|
||||
exports.ChainFormatter = ChainFormatter;
|
||||
const Formatter = {
|
||||
title(type, callerName, filepath) {
|
||||
let title = "";
|
||||
|
||||
if (type === ChainFormatter.Programmatic) {
|
||||
title = "programmatic options";
|
||||
|
||||
if (callerName) {
|
||||
title += " from " + callerName;
|
||||
}
|
||||
} else {
|
||||
title = "config " + filepath;
|
||||
}
|
||||
|
||||
return title;
|
||||
},
|
||||
|
||||
loc(index, envName) {
|
||||
let loc = "";
|
||||
|
||||
if (index != null) {
|
||||
loc += `.overrides[${index}]`;
|
||||
}
|
||||
|
||||
if (envName != null) {
|
||||
loc += `.env["${envName}"]`;
|
||||
}
|
||||
|
||||
return loc;
|
||||
},
|
||||
|
||||
*optionsAndDescriptors(opt) {
|
||||
const content = Object.assign({}, opt.options);
|
||||
delete content.overrides;
|
||||
delete content.env;
|
||||
const pluginDescriptors = [...(yield* opt.plugins())];
|
||||
|
||||
if (pluginDescriptors.length) {
|
||||
content.plugins = pluginDescriptors.map(d => descriptorToConfig(d));
|
||||
}
|
||||
|
||||
const presetDescriptors = [...(yield* opt.presets())];
|
||||
|
||||
if (presetDescriptors.length) {
|
||||
content.presets = [...presetDescriptors].map(d => descriptorToConfig(d));
|
||||
}
|
||||
|
||||
return JSON.stringify(content, undefined, 2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function descriptorToConfig(d) {
|
||||
var _d$file;
|
||||
|
||||
let name = (_d$file = d.file) == null ? void 0 : _d$file.request;
|
||||
|
||||
if (name == null) {
|
||||
if (typeof d.value === "object") {
|
||||
name = d.value;
|
||||
} else if (typeof d.value === "function") {
|
||||
name = `[Function: ${d.value.toString().slice(0, 50)} ... ]`;
|
||||
}
|
||||
}
|
||||
|
||||
if (name == null) {
|
||||
name = "[Unknown]";
|
||||
}
|
||||
|
||||
if (d.options === undefined) {
|
||||
return name;
|
||||
} else if (d.name == null) {
|
||||
return [name, d.options];
|
||||
} else {
|
||||
return [name, d.options, d.name];
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigPrinter {
|
||||
constructor() {
|
||||
this._stack = [];
|
||||
}
|
||||
|
||||
configure(enabled, type, {
|
||||
callerName,
|
||||
filepath
|
||||
}) {
|
||||
if (!enabled) return () => {};
|
||||
return (content, index, envName) => {
|
||||
this._stack.push({
|
||||
type,
|
||||
callerName,
|
||||
filepath,
|
||||
content,
|
||||
index,
|
||||
envName
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
static *format(config) {
|
||||
let title = Formatter.title(config.type, config.callerName, config.filepath);
|
||||
const loc = Formatter.loc(config.index, config.envName);
|
||||
if (loc) title += ` ${loc}`;
|
||||
const content = yield* Formatter.optionsAndDescriptors(config.content);
|
||||
return `${title}\n${content}`;
|
||||
}
|
||||
|
||||
*output() {
|
||||
if (this._stack.length === 0) return "";
|
||||
const configs = yield* _gensync().all(this._stack.map(s => ConfigPrinter.format(s)));
|
||||
return configs.join("\n\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.ConfigPrinter = ConfigPrinter;
|
||||
0 && 0;
|
47
node_modules/@babel/core/lib/config/resolve-targets-browser.js
generated
vendored
Normal file
47
node_modules/@babel/core/lib/config/resolve-targets-browser.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.resolveBrowserslistConfigFile = resolveBrowserslistConfigFile;
|
||||
exports.resolveTargets = resolveTargets;
|
||||
|
||||
function _helperCompilationTargets() {
|
||||
const data = require("@babel/helper-compilation-targets");
|
||||
|
||||
_helperCompilationTargets = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function resolveBrowserslistConfigFile(browserslistConfigFile, configFilePath) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function resolveTargets(options, root) {
|
||||
const optTargets = options.targets;
|
||||
let targets;
|
||||
|
||||
if (typeof optTargets === "string" || Array.isArray(optTargets)) {
|
||||
targets = {
|
||||
browsers: optTargets
|
||||
};
|
||||
} else if (optTargets) {
|
||||
if ("esmodules" in optTargets) {
|
||||
targets = Object.assign({}, optTargets, {
|
||||
esmodules: "intersect"
|
||||
});
|
||||
} else {
|
||||
targets = optTargets;
|
||||
}
|
||||
}
|
||||
|
||||
return (0, _helperCompilationTargets().default)(targets, {
|
||||
ignoreBrowserslistConfig: true,
|
||||
browserslistEnv: options.browserslistEnv
|
||||
});
|
||||
}
|
||||
|
||||
0 && 0;
|
73
node_modules/@babel/core/lib/config/resolve-targets.js
generated
vendored
Normal file
73
node_modules/@babel/core/lib/config/resolve-targets.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.resolveBrowserslistConfigFile = resolveBrowserslistConfigFile;
|
||||
exports.resolveTargets = resolveTargets;
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _helperCompilationTargets() {
|
||||
const data = require("@babel/helper-compilation-targets");
|
||||
|
||||
_helperCompilationTargets = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
({});
|
||||
|
||||
function resolveBrowserslistConfigFile(browserslistConfigFile, configFileDir) {
|
||||
return _path().resolve(configFileDir, browserslistConfigFile);
|
||||
}
|
||||
|
||||
function resolveTargets(options, root) {
|
||||
const optTargets = options.targets;
|
||||
let targets;
|
||||
|
||||
if (typeof optTargets === "string" || Array.isArray(optTargets)) {
|
||||
targets = {
|
||||
browsers: optTargets
|
||||
};
|
||||
} else if (optTargets) {
|
||||
if ("esmodules" in optTargets) {
|
||||
targets = Object.assign({}, optTargets, {
|
||||
esmodules: "intersect"
|
||||
});
|
||||
} else {
|
||||
targets = optTargets;
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
browserslistConfigFile
|
||||
} = options;
|
||||
let configFile;
|
||||
let ignoreBrowserslistConfig = false;
|
||||
|
||||
if (typeof browserslistConfigFile === "string") {
|
||||
configFile = browserslistConfigFile;
|
||||
} else {
|
||||
ignoreBrowserslistConfig = browserslistConfigFile === false;
|
||||
}
|
||||
|
||||
return (0, _helperCompilationTargets().default)(targets, {
|
||||
ignoreBrowserslistConfig,
|
||||
configFile,
|
||||
configPath: root,
|
||||
browserslistEnv: options.browserslistEnv
|
||||
});
|
||||
}
|
||||
|
||||
0 && 0;
|
14
node_modules/@babel/core/lib/config/util.js
generated
vendored
14
node_modules/@babel/core/lib/config/util.js
generated
vendored
@ -3,19 +3,15 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.mergeOptions = mergeOptions;
|
||||
exports.isIterableIterator = isIterableIterator;
|
||||
exports.mergeOptions = mergeOptions;
|
||||
|
||||
function mergeOptions(target, source) {
|
||||
for (const k of Object.keys(source)) {
|
||||
if (k === "parserOpts" && source.parserOpts) {
|
||||
const parserOpts = source.parserOpts;
|
||||
const targetObj = target.parserOpts = target.parserOpts || {};
|
||||
if ((k === "parserOpts" || k === "generatorOpts" || k === "assumptions") && source[k]) {
|
||||
const parserOpts = source[k];
|
||||
const targetObj = target[k] || (target[k] = {});
|
||||
mergeDefaultFields(targetObj, parserOpts);
|
||||
} else if (k === "generatorOpts" && source.generatorOpts) {
|
||||
const generatorOpts = source.generatorOpts;
|
||||
const targetObj = target.generatorOpts = target.generatorOpts || {};
|
||||
mergeDefaultFields(targetObj, generatorOpts);
|
||||
} else {
|
||||
const val = source[k];
|
||||
if (val !== undefined) target[k] = val;
|
||||
@ -33,3 +29,5 @@ function mergeDefaultFields(target, source) {
|
||||
function isIterableIterator(value) {
|
||||
return !!value && typeof value.next === "function" && typeof value[Symbol.iterator] === "function";
|
||||
}
|
||||
|
||||
0 && 0;
|
114
node_modules/@babel/core/lib/config/validation/option-assertions.js
generated
vendored
114
node_modules/@babel/core/lib/config/validation/option-assertions.js
generated
vendored
@ -3,24 +3,38 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.msg = msg;
|
||||
exports.access = access;
|
||||
exports.assertRootMode = assertRootMode;
|
||||
exports.assertSourceMaps = assertSourceMaps;
|
||||
exports.assertCompact = assertCompact;
|
||||
exports.assertSourceType = assertSourceType;
|
||||
exports.assertCallerMetadata = assertCallerMetadata;
|
||||
exports.assertInputSourceMap = assertInputSourceMap;
|
||||
exports.assertString = assertString;
|
||||
exports.assertFunction = assertFunction;
|
||||
exports.assertBoolean = assertBoolean;
|
||||
exports.assertObject = assertObject;
|
||||
exports.assertArray = assertArray;
|
||||
exports.assertIgnoreList = assertIgnoreList;
|
||||
exports.assertAssumptions = assertAssumptions;
|
||||
exports.assertBabelrcSearch = assertBabelrcSearch;
|
||||
exports.assertBoolean = assertBoolean;
|
||||
exports.assertCallerMetadata = assertCallerMetadata;
|
||||
exports.assertCompact = assertCompact;
|
||||
exports.assertConfigApplicableTest = assertConfigApplicableTest;
|
||||
exports.assertConfigFileSearch = assertConfigFileSearch;
|
||||
exports.assertBabelrcSearch = assertBabelrcSearch;
|
||||
exports.assertFunction = assertFunction;
|
||||
exports.assertIgnoreList = assertIgnoreList;
|
||||
exports.assertInputSourceMap = assertInputSourceMap;
|
||||
exports.assertObject = assertObject;
|
||||
exports.assertPluginList = assertPluginList;
|
||||
exports.assertRootMode = assertRootMode;
|
||||
exports.assertSourceMaps = assertSourceMaps;
|
||||
exports.assertSourceType = assertSourceType;
|
||||
exports.assertString = assertString;
|
||||
exports.assertTargets = assertTargets;
|
||||
exports.msg = msg;
|
||||
|
||||
function _helperCompilationTargets() {
|
||||
const data = require("@babel/helper-compilation-targets");
|
||||
|
||||
_helperCompilationTargets = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _options = require("./options");
|
||||
|
||||
function msg(loc) {
|
||||
switch (loc.type) {
|
||||
@ -88,7 +102,7 @@ function assertCallerMetadata(loc, value) {
|
||||
const obj = assertObject(loc, value);
|
||||
|
||||
if (obj) {
|
||||
if (typeof obj["name"] !== "string") {
|
||||
if (typeof obj.name !== "string") {
|
||||
throw new Error(`${msg(loc)} set but does not contain "name" property string`);
|
||||
}
|
||||
|
||||
@ -266,3 +280,75 @@ function assertPluginTarget(loc, value) {
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertTargets(loc, value) {
|
||||
if ((0, _helperCompilationTargets().isBrowsersQueryValid)(value)) return value;
|
||||
|
||||
if (typeof value !== "object" || !value || Array.isArray(value)) {
|
||||
throw new Error(`${msg(loc)} must be a string, an array of strings or an object`);
|
||||
}
|
||||
|
||||
const browsersLoc = access(loc, "browsers");
|
||||
const esmodulesLoc = access(loc, "esmodules");
|
||||
assertBrowsersList(browsersLoc, value.browsers);
|
||||
assertBoolean(esmodulesLoc, value.esmodules);
|
||||
|
||||
for (const key of Object.keys(value)) {
|
||||
const val = value[key];
|
||||
const subLoc = access(loc, key);
|
||||
if (key === "esmodules") assertBoolean(subLoc, val);else if (key === "browsers") assertBrowsersList(subLoc, val);else if (!Object.hasOwnProperty.call(_helperCompilationTargets().TargetNames, key)) {
|
||||
const validTargets = Object.keys(_helperCompilationTargets().TargetNames).join(", ");
|
||||
throw new Error(`${msg(subLoc)} is not a valid target. Supported targets are ${validTargets}`);
|
||||
} else assertBrowserVersion(subLoc, val);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
function assertBrowsersList(loc, value) {
|
||||
if (value !== undefined && !(0, _helperCompilationTargets().isBrowsersQueryValid)(value)) {
|
||||
throw new Error(`${msg(loc)} must be undefined, a string or an array of strings`);
|
||||
}
|
||||
}
|
||||
|
||||
function assertBrowserVersion(loc, value) {
|
||||
if (typeof value === "number" && Math.round(value) === value) return;
|
||||
if (typeof value === "string") return;
|
||||
throw new Error(`${msg(loc)} must be a string or an integer number`);
|
||||
}
|
||||
|
||||
function assertAssumptions(loc, value) {
|
||||
if (value === undefined) return;
|
||||
|
||||
if (typeof value !== "object" || value === null) {
|
||||
throw new Error(`${msg(loc)} must be an object or undefined.`);
|
||||
}
|
||||
|
||||
let root = loc;
|
||||
|
||||
do {
|
||||
root = root.parent;
|
||||
} while (root.type !== "root");
|
||||
|
||||
const inPreset = root.source === "preset";
|
||||
|
||||
for (const name of Object.keys(value)) {
|
||||
const subLoc = access(loc, name);
|
||||
|
||||
if (!_options.assumptionsNames.has(name)) {
|
||||
throw new Error(`${msg(subLoc)} is not a supported assumption.`);
|
||||
}
|
||||
|
||||
if (typeof value[name] !== "boolean") {
|
||||
throw new Error(`${msg(subLoc)} must be a boolean.`);
|
||||
}
|
||||
|
||||
if (inPreset && value[name] === false) {
|
||||
throw new Error(`${msg(subLoc)} cannot be set to 'false' inside presets.`);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
0 && 0;
|
41
node_modules/@babel/core/lib/config/validation/options.js
generated
vendored
41
node_modules/@babel/core/lib/config/validation/options.js
generated
vendored
@ -3,17 +3,16 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.validate = validate;
|
||||
exports.assumptionsNames = void 0;
|
||||
exports.checkNoUnwrappedItemOptionPairs = checkNoUnwrappedItemOptionPairs;
|
||||
exports.validate = validate;
|
||||
|
||||
var _plugin = _interopRequireDefault(require("../plugin"));
|
||||
var _plugin = require("../plugin");
|
||||
|
||||
var _removed = _interopRequireDefault(require("./removed"));
|
||||
var _removed = require("./removed");
|
||||
|
||||
var _optionAssertions = require("./option-assertions");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const ROOT_VALIDATORS = {
|
||||
cwd: _optionAssertions.assertString,
|
||||
root: _optionAssertions.assertString,
|
||||
@ -24,6 +23,7 @@ const ROOT_VALIDATORS = {
|
||||
filenameRelative: _optionAssertions.assertString,
|
||||
code: _optionAssertions.assertBoolean,
|
||||
ast: _optionAssertions.assertBoolean,
|
||||
cloneInputAst: _optionAssertions.assertBoolean,
|
||||
envName: _optionAssertions.assertString
|
||||
};
|
||||
const BABELRC_VALIDATORS = {
|
||||
@ -33,13 +33,17 @@ const BABELRC_VALIDATORS = {
|
||||
const NONPRESET_VALIDATORS = {
|
||||
extends: _optionAssertions.assertString,
|
||||
ignore: _optionAssertions.assertIgnoreList,
|
||||
only: _optionAssertions.assertIgnoreList
|
||||
only: _optionAssertions.assertIgnoreList,
|
||||
targets: _optionAssertions.assertTargets,
|
||||
browserslistConfigFile: _optionAssertions.assertConfigFileSearch,
|
||||
browserslistEnv: _optionAssertions.assertString
|
||||
};
|
||||
const COMMON_VALIDATORS = {
|
||||
inputSourceMap: _optionAssertions.assertInputSourceMap,
|
||||
presets: _optionAssertions.assertPluginList,
|
||||
plugins: _optionAssertions.assertPluginList,
|
||||
passPerPreset: _optionAssertions.assertBoolean,
|
||||
assumptions: _optionAssertions.assertAssumptions,
|
||||
env: assertEnvSet,
|
||||
overrides: assertOverridesList,
|
||||
test: _optionAssertions.assertConfigApplicableTest,
|
||||
@ -59,13 +63,20 @@ const COMMON_VALIDATORS = {
|
||||
sourceMap: _optionAssertions.assertSourceMaps,
|
||||
sourceFileName: _optionAssertions.assertString,
|
||||
sourceRoot: _optionAssertions.assertString,
|
||||
getModuleId: _optionAssertions.assertFunction,
|
||||
moduleRoot: _optionAssertions.assertString,
|
||||
moduleIds: _optionAssertions.assertBoolean,
|
||||
moduleId: _optionAssertions.assertString,
|
||||
parserOpts: _optionAssertions.assertObject,
|
||||
generatorOpts: _optionAssertions.assertObject
|
||||
};
|
||||
{
|
||||
Object.assign(COMMON_VALIDATORS, {
|
||||
getModuleId: _optionAssertions.assertFunction,
|
||||
moduleRoot: _optionAssertions.assertString,
|
||||
moduleIds: _optionAssertions.assertBoolean,
|
||||
moduleId: _optionAssertions.assertString
|
||||
});
|
||||
}
|
||||
const knownAssumptions = ["arrayLikeIsIterable", "constantReexports", "constantSuper", "enumerableModuleMeta", "ignoreFunctionLength", "ignoreToPrimitiveHint", "iterableIsArray", "mutableTemplateObject", "noClassCalls", "noDocumentAll", "noIncompleteNsImportDetection", "noNewArrows", "objectRestNoSymbols", "privateFieldsAsProperties", "pureGetters", "setClassMethods", "setComputedProperties", "setPublicClassFields", "setSpreadProperties", "skipForOfIteratorClosing", "superIsCallableConstructor"];
|
||||
const assumptionsNames = new Set(knownAssumptions);
|
||||
exports.assumptionsNames = assumptionsNames;
|
||||
|
||||
function getSource(loc) {
|
||||
return loc.type === "root" ? loc.source : getSource(loc.parent);
|
||||
@ -189,8 +200,14 @@ function assertOverridesList(loc, value) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
function checkNoUnwrappedItemOptionPairs(lastItem, thisItem, type, index, e) {
|
||||
function checkNoUnwrappedItemOptionPairs(items, index, type, e) {
|
||||
if (index === 0) return;
|
||||
const lastItem = items[index - 1];
|
||||
const thisItem = items[index];
|
||||
|
||||
if (lastItem.file && lastItem.options === undefined && typeof thisItem.value === "object") {
|
||||
e.message += `\n- Maybe you meant to use\n` + `"${type}": [\n ["${lastItem.file.request}", ${JSON.stringify(thisItem.value, undefined, 2)}]\n]\n` + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;
|
||||
e.message += `\n- Maybe you meant to use\n` + `"${type}s": [\n ["${lastItem.file.request}", ${JSON.stringify(thisItem.value, undefined, 2)}]\n]\n` + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;
|
||||
}
|
||||
}
|
||||
|
||||
0 && 0;
|
2
node_modules/@babel/core/lib/config/validation/plugins.js
generated
vendored
2
node_modules/@babel/core/lib/config/validation/plugins.js
generated
vendored
@ -69,3 +69,5 @@ function validatePluginObject(obj) {
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
|
||||
0 && 0;
|
1
node_modules/@babel/core/lib/config/validation/removed.js
generated
vendored
1
node_modules/@babel/core/lib/config/validation/removed.js
generated
vendored
@ -64,3 +64,4 @@ var _default = {
|
||||
}
|
||||
};
|
||||
exports.default = _default;
|
||||
0 && 0;
|
31
node_modules/@babel/core/lib/gensync-utils/async.js
generated
vendored
31
node_modules/@babel/core/lib/gensync-utils/async.js
generated
vendored
@ -3,13 +3,14 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.maybeAsync = maybeAsync;
|
||||
exports.forwardAsync = forwardAsync;
|
||||
exports.isAsync = void 0;
|
||||
exports.isThenable = isThenable;
|
||||
exports.waitFor = exports.onFirstPause = exports.isAsync = void 0;
|
||||
exports.maybeAsync = maybeAsync;
|
||||
exports.waitFor = exports.onFirstPause = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
@ -18,21 +19,21 @@ function _gensync() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const id = x => x;
|
||||
|
||||
const runGenerator = (0, _gensync().default)(function* (item) {
|
||||
const runGenerator = _gensync()(function* (item) {
|
||||
return yield* item;
|
||||
});
|
||||
const isAsync = (0, _gensync().default)({
|
||||
|
||||
const isAsync = _gensync()({
|
||||
sync: () => false,
|
||||
errback: cb => cb(null, true)
|
||||
});
|
||||
|
||||
exports.isAsync = isAsync;
|
||||
|
||||
function maybeAsync(fn, message) {
|
||||
return (0, _gensync().default)({
|
||||
return _gensync()({
|
||||
sync(...args) {
|
||||
const result = fn.apply(this, args);
|
||||
if (isThenable(result)) throw new Error(message);
|
||||
@ -46,20 +47,21 @@ function maybeAsync(fn, message) {
|
||||
});
|
||||
}
|
||||
|
||||
const withKind = (0, _gensync().default)({
|
||||
const withKind = _gensync()({
|
||||
sync: cb => cb("sync"),
|
||||
async: cb => cb("async")
|
||||
});
|
||||
|
||||
function forwardAsync(action, cb) {
|
||||
const g = (0, _gensync().default)(action);
|
||||
const g = _gensync()(action);
|
||||
|
||||
return withKind(kind => {
|
||||
const adapted = g[kind];
|
||||
return cb(adapted);
|
||||
});
|
||||
}
|
||||
|
||||
const onFirstPause = (0, _gensync().default)({
|
||||
const onFirstPause = _gensync()({
|
||||
name: "onFirstPause",
|
||||
arity: 2,
|
||||
sync: function (item) {
|
||||
@ -77,13 +79,18 @@ const onFirstPause = (0, _gensync().default)({
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exports.onFirstPause = onFirstPause;
|
||||
const waitFor = (0, _gensync().default)({
|
||||
|
||||
const waitFor = _gensync()({
|
||||
sync: id,
|
||||
async: id
|
||||
});
|
||||
|
||||
exports.waitFor = waitFor;
|
||||
|
||||
function isThenable(val) {
|
||||
return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function";
|
||||
}
|
||||
|
||||
0 && 0;
|
33
node_modules/@babel/core/lib/gensync-utils/fs.js
generated
vendored
33
node_modules/@babel/core/lib/gensync-utils/fs.js
generated
vendored
@ -3,10 +3,10 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.exists = exports.readFile = void 0;
|
||||
exports.stat = exports.readFile = void 0;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require("fs"));
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
@ -16,7 +16,7 @@ function _fs() {
|
||||
}
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
@ -25,24 +25,17 @@ function _gensync() {
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const readFile = (0, _gensync().default)({
|
||||
sync: _fs().default.readFileSync,
|
||||
errback: _fs().default.readFile
|
||||
const readFile = _gensync()({
|
||||
sync: _fs().readFileSync,
|
||||
errback: _fs().readFile
|
||||
});
|
||||
|
||||
exports.readFile = readFile;
|
||||
const exists = (0, _gensync().default)({
|
||||
sync(path) {
|
||||
try {
|
||||
_fs().default.accessSync(path);
|
||||
|
||||
return true;
|
||||
} catch (_unused) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
errback: (path, cb) => _fs().default.access(path, undefined, err => cb(null, !err))
|
||||
const stat = _gensync()({
|
||||
sync: _fs().statSync,
|
||||
errback: _fs().stat
|
||||
});
|
||||
exports.exists = exists;
|
||||
|
||||
exports.stat = stat;
|
||||
0 && 0;
|
216
node_modules/@babel/core/lib/index.js
generated
vendored
216
node_modules/@babel/core/lib/index.js
generated
vendored
@ -3,19 +3,99 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Plugin = Plugin;
|
||||
exports.DEFAULT_EXTENSIONS = void 0;
|
||||
Object.defineProperty(exports, "File", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _file.default;
|
||||
}
|
||||
});
|
||||
exports.OptionManager = void 0;
|
||||
exports.Plugin = Plugin;
|
||||
Object.defineProperty(exports, "buildExternalHelpers", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _buildExternalHelpers.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createConfigItem", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.createConfigItem;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createConfigItemAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.createConfigItemAsync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createConfigItemSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.createConfigItemSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getEnv", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _environment.getEnv;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptions", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadOptions;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptionsAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadOptionsAsync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptionsSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadOptionsSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadPartialConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfigAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadPartialConfigAsync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfigSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadPartialConfigSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parse", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parse.parse;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parseAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parse.parseAsync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parseSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parse.parseSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePlugin", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
@ -28,76 +108,16 @@ Object.defineProperty(exports, "resolvePreset", {
|
||||
return _files.resolvePreset;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "version", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _package.version;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getEnv", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _environment.getEnv;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "tokTypes", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parser().tokTypes;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "traverse", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _traverse().default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "template", {
|
||||
Object.defineProperty((0, exports), "template", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _template().default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createConfigItem", {
|
||||
Object.defineProperty((0, exports), "tokTypes", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _item.createConfigItem;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadPartialConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfigSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadPartialConfigSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPartialConfigAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadPartialConfigAsync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptions", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadOptions;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptionsSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadOptionsSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadOptionsAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _config.loadOptionsAsync;
|
||||
return _parser().tokTypes;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transform", {
|
||||
@ -106,12 +126,6 @@ Object.defineProperty(exports, "transform", {
|
||||
return _transform.transform;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _transform.transformSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
@ -124,68 +138,60 @@ Object.defineProperty(exports, "transformFile", {
|
||||
return _transformFile.transformFile;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFileSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _transformFile.transformFileSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFileAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _transformFile.transformFileAsync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFileSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _transformFile.transformFileSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFromAst", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _transformAst.transformFromAst;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFromAstSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _transformAst.transformFromAstSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "transformFromAstAsync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _transformAst.transformFromAstAsync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parse", {
|
||||
Object.defineProperty(exports, "transformFromAstSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parse.parse;
|
||||
return _transformAst.transformFromAstSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parseSync", {
|
||||
Object.defineProperty(exports, "transformSync", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parse.parseSync;
|
||||
return _transform.transformSync;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "parseAsync", {
|
||||
Object.defineProperty((0, exports), "traverse", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _parse.parseAsync;
|
||||
return _traverse().default;
|
||||
}
|
||||
});
|
||||
exports.types = exports.OptionManager = exports.DEFAULT_EXTENSIONS = void 0;
|
||||
exports.version = exports.types = void 0;
|
||||
|
||||
var _file = _interopRequireDefault(require("./transformation/file/file"));
|
||||
var _file = require("./transformation/file/file");
|
||||
|
||||
var _buildExternalHelpers = _interopRequireDefault(require("./tools/build-external-helpers"));
|
||||
var _buildExternalHelpers = require("./tools/build-external-helpers");
|
||||
|
||||
var _files = require("./config/files");
|
||||
|
||||
var _package = require("../package.json");
|
||||
|
||||
var _environment = require("./config/helpers/environment");
|
||||
|
||||
function _types() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
const data = require("@babel/types");
|
||||
|
||||
_types = function () {
|
||||
return data;
|
||||
@ -194,7 +200,7 @@ function _types() {
|
||||
return data;
|
||||
}
|
||||
|
||||
Object.defineProperty(exports, "types", {
|
||||
Object.defineProperty((0, exports), "types", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _types();
|
||||
@ -212,7 +218,7 @@ function _parser() {
|
||||
}
|
||||
|
||||
function _traverse() {
|
||||
const data = _interopRequireDefault(require("@babel/traverse"));
|
||||
const data = require("@babel/traverse");
|
||||
|
||||
_traverse = function () {
|
||||
return data;
|
||||
@ -222,7 +228,7 @@ function _traverse() {
|
||||
}
|
||||
|
||||
function _template() {
|
||||
const data = _interopRequireDefault(require("@babel/template"));
|
||||
const data = require("@babel/template");
|
||||
|
||||
_template = function () {
|
||||
return data;
|
||||
@ -231,8 +237,6 @@ function _template() {
|
||||
return data;
|
||||
}
|
||||
|
||||
var _item = require("./config/item");
|
||||
|
||||
var _config = require("./config");
|
||||
|
||||
var _transform = require("./transform");
|
||||
@ -243,18 +247,14 @@ var _transformAst = require("./transform-ast");
|
||||
|
||||
var _parse = require("./parse");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]);
|
||||
const version = "7.18.6";
|
||||
exports.version = version;
|
||||
const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]);
|
||||
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS;
|
||||
|
||||
class OptionManager {
|
||||
init(opts) {
|
||||
return (0, _config.loadOptions)(opts);
|
||||
return (0, _config.loadOptionsSync)(opts);
|
||||
}
|
||||
|
||||
}
|
||||
@ -264,3 +264,5 @@ exports.OptionManager = OptionManager;
|
||||
function Plugin(alias) {
|
||||
throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`);
|
||||
}
|
||||
|
||||
0 && (exports.types = exports.traverse = exports.tokTypes = exports.template = 0);
|
22
node_modules/@babel/core/lib/parse.js
generated
vendored
22
node_modules/@babel/core/lib/parse.js
generated
vendored
@ -3,10 +3,10 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.parseAsync = exports.parseSync = exports.parse = void 0;
|
||||
exports.parseSync = exports.parseAsync = exports.parse = void 0;
|
||||
|
||||
function _gensync() {
|
||||
const data = _interopRequireDefault(require("gensync"));
|
||||
const data = require("gensync");
|
||||
|
||||
_gensync = function () {
|
||||
return data;
|
||||
@ -15,15 +15,13 @@ function _gensync() {
|
||||
return data;
|
||||
}
|
||||
|
||||
var _config = _interopRequireDefault(require("./config"));
|
||||
var _config = require("./config");
|
||||
|
||||
var _parser = _interopRequireDefault(require("./parser"));
|
||||
var _parser = require("./parser");
|
||||
|
||||
var _normalizeOpts = _interopRequireDefault(require("./transformation/normalize-opts"));
|
||||
var _normalizeOpts = require("./transformation/normalize-opts");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const parseRunner = (0, _gensync().default)(function* parse(code, opts) {
|
||||
const parseRunner = _gensync()(function* parse(code, opts) {
|
||||
const config = yield* (0, _config.default)(opts);
|
||||
|
||||
if (config === null) {
|
||||
@ -39,7 +37,12 @@ const parse = function parse(code, opts, callback) {
|
||||
opts = undefined;
|
||||
}
|
||||
|
||||
if (callback === undefined) return parseRunner.sync(code, opts);
|
||||
if (callback === undefined) {
|
||||
{
|
||||
return parseRunner.sync(code, opts);
|
||||
}
|
||||
}
|
||||
|
||||
parseRunner.errback(code, opts, callback);
|
||||
};
|
||||
|
||||
@ -48,3 +51,4 @@ const parseSync = parseRunner.sync;
|
||||
exports.parseSync = parseSync;
|
||||
const parseAsync = parseRunner.async;
|
||||
exports.parseAsync = parseAsync;
|
||||
0 && 0;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user