Skip to content

Commit 4eb7b13

Browse files
committed
holy
1 parent cd1f4da commit 4eb7b13

File tree

172 files changed

+9062
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+9062
-7
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ node_modules
1919
# Test
2020
__mocks__
2121
sample
22+
test/fixtures/next_dist

test/fixtures/next_dist/BUILD_ID

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lslSRKVgJwCnxOZou7Oma
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"polyfillFiles": [
3+
"static/chunks/polyfills-36bde18dcfde0c144be5.js"
4+
],
5+
"devFiles": [],
6+
"ampDevFiles": [],
7+
"lowPriorityFiles": [
8+
"static/lslSRKVgJwCnxOZou7Oma/_buildManifest.js",
9+
"static/lslSRKVgJwCnxOZou7Oma/_ssgManifest.js"
10+
],
11+
"pages": {
12+
"/": [
13+
"static/chunks/main-a140d580cf631c156faf.js",
14+
"static/chunks/webpack-e067438c4cf4ef2ef178.js",
15+
"static/chunks/framework.cb05d56be993eb6b088a.js",
16+
"static/chunks/pages/index-407dc420b294115bf34b.js"
17+
],
18+
"/_app": [
19+
"static/chunks/main-a140d580cf631c156faf.js",
20+
"static/chunks/webpack-e067438c4cf4ef2ef178.js",
21+
"static/chunks/framework.cb05d56be993eb6b088a.js",
22+
"static/chunks/f6078781a05fe1bcb0902d23dbbb2662c8d200b3.b1b4058541fcfd6d9ff9.js",
23+
"static/chunks/pages/_app-972cb3097f665332c080.js"
24+
],
25+
"/_error": [
26+
"static/chunks/main-a140d580cf631c156faf.js",
27+
"static/chunks/webpack-e067438c4cf4ef2ef178.js",
28+
"static/chunks/framework.cb05d56be993eb6b088a.js",
29+
"static/chunks/pages/_error-ed1b06dc12d6382f8fbd.js"
30+
]
31+
},
32+
"ampFirstPages": []
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ast":null,"code":"\"use strict\";\n\nexports.__esModule = true;\nexports.execOnce = execOnce;\nexports.getLocationOrigin = getLocationOrigin;\nexports.getURL = getURL;\nexports.getDisplayName = getDisplayName;\nexports.isResSent = isResSent;\nexports.loadGetInitialProps = loadGetInitialProps;\nexports.formatWithValidation = formatWithValidation;\nexports.ST = exports.SP = exports.urlObjectKeys = void 0;\n\nvar _formatUrl = require(\"./router/utils/format-url\");\n/**\n* Utils\n*/\n\n\nfunction execOnce(fn) {\n let used = false;\n let result;\n return (...args) => {\n if (!used) {\n used = true;\n result = fn(...args);\n }\n\n return result;\n };\n}\n\nfunction getLocationOrigin() {\n const {\n protocol,\n hostname,\n port\n } = window.location;\n return `${protocol}//${hostname}${port ? ':' + port : ''}`;\n}\n\nfunction getURL() {\n const {\n href\n } = window.location;\n const origin = getLocationOrigin();\n return href.substring(origin.length);\n}\n\nfunction getDisplayName(Component) {\n return typeof Component === 'string' ? Component : Component.displayName || Component.name || 'Unknown';\n}\n\nfunction isResSent(res) {\n return res.finished || res.headersSent;\n}\n\nasync function loadGetInitialProps(App, ctx) {\n if (false) {\n var _App$prototype;\n\n if ((_App$prototype = App.prototype) === null || _App$prototype === void 0 ? void 0 : _App$prototype.getInitialProps) {\n const message = `\"${getDisplayName(App)}.getInitialProps()\" is defined as an instance method - visit https://err.sh/vercel/next.js/get-initial-props-as-an-instance-method for more information.`;\n throw new Error(message);\n }\n } // when called from _app `ctx` is nested in `ctx`\n\n\n const res = ctx.res || ctx.ctx && ctx.ctx.res;\n\n if (!App.getInitialProps) {\n if (ctx.ctx && ctx.Component) {\n // @ts-ignore pageProps default\n return {\n pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx)\n };\n }\n\n return {};\n }\n\n const props = await App.getInitialProps(ctx);\n\n if (res && isResSent(res)) {\n return props;\n }\n\n if (!props) {\n const message = `\"${getDisplayName(App)}.getInitialProps()\" should resolve to an object. But found \"${props}\" instead.`;\n throw new Error(message);\n }\n\n if (false) {\n if (Object.keys(props).length === 0 && !ctx.ctx) {\n console.warn(`${getDisplayName(App)} returned an empty object from \\`getInitialProps\\`. This de-optimizes and prevents automatic static optimization. https://err.sh/vercel/next.js/empty-object-getInitialProps`);\n }\n }\n\n return props;\n}\n\nconst urlObjectKeys = ['auth', 'hash', 'host', 'hostname', 'href', 'path', 'pathname', 'port', 'protocol', 'query', 'search', 'slashes'];\nexports.urlObjectKeys = urlObjectKeys;\n\nfunction formatWithValidation(url) {\n if (false) {\n if (url !== null && typeof url === 'object') {\n Object.keys(url).forEach(key => {\n if (urlObjectKeys.indexOf(key) === -1) {\n console.warn(`Unknown key passed via urlObject into url.format: ${key}`);\n }\n });\n }\n }\n\n return (0, _formatUrl.formatUrl)(url);\n}\n\nconst SP = typeof performance !== 'undefined';\nexports.SP = SP;\nconst ST = SP && typeof performance.mark === 'function' && typeof performance.measure === 'function';\nexports.ST = ST;","map":null,"metadata":{},"sourceType":"script"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ast":null,"code":"\"use strict\";\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _webVitals = require(\"web-vitals\");\n\nvar _default = onPerfEntry => {\n (0, _webVitals.getCLS)(onPerfEntry);\n (0, _webVitals.getFID)(onPerfEntry);\n (0, _webVitals.getFCP)(onPerfEntry);\n (0, _webVitals.getLCP)(onPerfEntry);\n (0, _webVitals.getTTFB)(onPerfEntry);\n};\n\nexports.default = _default;","map":null,"metadata":{},"sourceType":"script"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ast":null,"code":"\"use strict\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nexports.__esModule = true;\nexports.pathToRegexp = exports.default = exports.customRouteMatcherOptions = exports.matcherOptions = void 0;\n\nvar pathToRegexp = _interopRequireWildcard(require(\"next/dist/compiled/path-to-regexp\"));\n\nexports.pathToRegexp = pathToRegexp;\n\nfunction _getRequireWildcardCache() {\n if (typeof WeakMap !== \"function\") return null;\n var cache = new WeakMap();\n\n _getRequireWildcardCache = function () {\n return cache;\n };\n\n return cache;\n}\n\nfunction _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n }\n\n if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") {\n return {\n default: obj\n };\n }\n\n var cache = _getRequireWildcardCache();\n\n if (cache && cache.has(obj)) {\n return cache.get(obj);\n }\n\n var newObj = {};\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n\n if (desc && (desc.get || desc.set)) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n\n newObj.default = obj;\n\n if (cache) {\n cache.set(obj, newObj);\n }\n\n return newObj;\n}\n\nconst matcherOptions = {\n sensitive: false,\n delimiter: '/',\n decode: decodeParam\n};\nexports.matcherOptions = matcherOptions;\n\nconst customRouteMatcherOptions = _objectSpread(_objectSpread({}, matcherOptions), {}, {\n strict: true\n});\n\nexports.customRouteMatcherOptions = customRouteMatcherOptions;\n\nvar _default = (customRoute = false) => {\n return path => {\n const keys = [];\n const matcherRegex = pathToRegexp.pathToRegexp(path, keys, customRoute ? customRouteMatcherOptions : matcherOptions);\n const matcher = pathToRegexp.regexpToFunction(matcherRegex, keys, matcherOptions);\n return (pathname, params) => {\n const res = pathname == null ? false : matcher(pathname);\n\n if (!res) {\n return false;\n }\n\n if (customRoute) {\n for (const key of keys) {\n // unnamed params should be removed as they\n // are not allowed to be used in the destination\n if (typeof key.name === 'number') {\n delete res.params[key.name];\n }\n }\n }\n\n return _objectSpread(_objectSpread({}, params), res.params);\n };\n };\n};\n\nexports.default = _default;\n\nfunction decodeParam(param) {\n try {\n return decodeURIComponent(param);\n } catch (_) {\n const err = new Error('failed to decode param');\n err.code = 'DECODE_FAILED';\n throw err;\n }\n}","map":null,"metadata":{},"sourceType":"script"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ast":null,"code":"\"use strict\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nexports.__esModule = true;\nexports.default = void 0;\n\nvar _react = _interopRequireDefault(require(\"react\"));\n\nvar _useSubscription = require(\"use-subscription\");\n\nvar _loadableContext = require(\"./loadable-context\");\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\n/**\n@copyright (c) 2017-present James Kyle <[email protected]>\nMIT License\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE\n*/\n// https://github.com/jamiebuilds/react-loadable/blob/v5.5.0/src/index.js\n// Modified to be compatible with webpack 4 / Next.js\n\n\nconst ALL_INITIALIZERS = [];\nconst READY_INITIALIZERS = [];\nlet initialized = false;\n\nfunction load(loader) {\n let promise = loader();\n let state = {\n loading: true,\n loaded: null,\n error: null\n };\n state.promise = promise.then(loaded => {\n state.loading = false;\n state.loaded = loaded;\n return loaded;\n }).catch(err => {\n state.loading = false;\n state.error = err;\n throw err;\n });\n return state;\n}\n\nfunction loadMap(obj) {\n let state = {\n loading: false,\n loaded: {},\n error: null\n };\n let promises = [];\n\n try {\n Object.keys(obj).forEach(key => {\n let result = load(obj[key]);\n\n if (!result.loading) {\n state.loaded[key] = result.loaded;\n state.error = result.error;\n } else {\n state.loading = true;\n }\n\n promises.push(result.promise);\n result.promise.then(res => {\n state.loaded[key] = res;\n }).catch(err => {\n state.error = err;\n });\n });\n } catch (err) {\n state.error = err;\n }\n\n state.promise = Promise.all(promises).then(res => {\n state.loading = false;\n return res;\n }).catch(err => {\n state.loading = false;\n throw err;\n });\n return state;\n}\n\nfunction resolve(obj) {\n return obj && obj.__esModule ? obj.default : obj;\n}\n\nfunction render(loaded, props) {\n return /*#__PURE__*/_react.default.createElement(resolve(loaded), props);\n}\n\nfunction createLoadableComponent(loadFn, options) {\n let opts = Object.assign({\n loader: null,\n loading: null,\n delay: 200,\n timeout: null,\n render: render,\n webpack: null,\n modules: null\n }, options);\n let subscription = null;\n\n function init() {\n if (!subscription) {\n const sub = new LoadableSubscription(loadFn, opts);\n subscription = {\n getCurrentValue: sub.getCurrentValue.bind(sub),\n subscribe: sub.subscribe.bind(sub),\n retry: sub.retry.bind(sub),\n promise: sub.promise.bind(sub)\n };\n }\n\n return subscription.promise();\n } // Server only\n\n\n if (true) {\n ALL_INITIALIZERS.push(init);\n } // Client only\n\n\n if (!initialized && false && typeof opts.webpack === 'function') {\n const moduleIds = opts.webpack();\n READY_INITIALIZERS.push(ids => {\n for (const moduleId of moduleIds) {\n if (ids.indexOf(moduleId) !== -1) {\n return init();\n }\n }\n });\n }\n\n const LoadableComponent = (props, ref) => {\n init();\n\n const context = _react.default.useContext(_loadableContext.LoadableContext);\n\n const state = (0, _useSubscription.useSubscription)(subscription);\n\n _react.default.useImperativeHandle(ref, () => ({\n retry: subscription.retry\n }), []);\n\n if (context && Array.isArray(opts.modules)) {\n opts.modules.forEach(moduleName => {\n context(moduleName);\n });\n }\n\n return _react.default.useMemo(() => {\n if (state.loading || state.error) {\n return /*#__PURE__*/_react.default.createElement(opts.loading, {\n isLoading: state.loading,\n pastDelay: state.pastDelay,\n timedOut: state.timedOut,\n error: state.error,\n retry: subscription.retry\n });\n } else if (state.loaded) {\n return opts.render(state.loaded, props);\n } else {\n return null;\n }\n }, [props, state]);\n };\n\n LoadableComponent.preload = () => init();\n\n LoadableComponent.displayName = 'LoadableComponent';\n return /*#__PURE__*/_react.default.forwardRef(LoadableComponent);\n}\n\nclass LoadableSubscription {\n constructor(loadFn, opts) {\n this._loadFn = loadFn;\n this._opts = opts;\n this._callbacks = new Set();\n this._delay = null;\n this._timeout = null;\n this.retry();\n }\n\n promise() {\n return this._res.promise;\n }\n\n retry() {\n this._clearTimeouts();\n\n this._res = this._loadFn(this._opts.loader);\n this._state = {\n pastDelay: false,\n timedOut: false\n };\n const {\n _res: res,\n _opts: opts\n } = this;\n\n if (res.loading) {\n if (typeof opts.delay === 'number') {\n if (opts.delay === 0) {\n this._state.pastDelay = true;\n } else {\n this._delay = setTimeout(() => {\n this._update({\n pastDelay: true\n });\n }, opts.delay);\n }\n }\n\n if (typeof opts.timeout === 'number') {\n this._timeout = setTimeout(() => {\n this._update({\n timedOut: true\n });\n }, opts.timeout);\n }\n }\n\n this._res.promise.then(() => {\n this._update({});\n\n this._clearTimeouts();\n }).catch(_err => {\n this._update({});\n\n this._clearTimeouts();\n });\n\n this._update({});\n }\n\n _update(partial) {\n this._state = _objectSpread(_objectSpread({}, this._state), {}, {\n error: this._res.error,\n loaded: this._res.loaded,\n loading: this._res.loading\n }, partial);\n\n this._callbacks.forEach(callback => callback());\n }\n\n _clearTimeouts() {\n clearTimeout(this._delay);\n clearTimeout(this._timeout);\n }\n\n getCurrentValue() {\n return this._state;\n }\n\n subscribe(callback) {\n this._callbacks.add(callback);\n\n return () => {\n this._callbacks.delete(callback);\n };\n }\n\n}\n\nfunction Loadable(opts) {\n return createLoadableComponent(load, opts);\n}\n\nfunction LoadableMap(opts) {\n if (typeof opts.render !== 'function') {\n throw new Error('LoadableMap requires a `render(loaded, props)` function');\n }\n\n return createLoadableComponent(loadMap, opts);\n}\n\nLoadable.Map = LoadableMap;\n\nfunction flushInitializers(initializers, ids) {\n let promises = [];\n\n while (initializers.length) {\n let init = initializers.pop();\n promises.push(init(ids));\n }\n\n return Promise.all(promises).then(() => {\n if (initializers.length) {\n return flushInitializers(initializers, ids);\n }\n });\n}\n\nLoadable.preloadAll = () => {\n return new Promise((resolveInitializers, reject) => {\n flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject);\n });\n};\n\nLoadable.preloadReady = (ids = []) => {\n return new Promise(resolvePreload => {\n const res = () => {\n initialized = true;\n return resolvePreload();\n }; // We always will resolve, errors should be handled within loading UIs.\n\n\n flushInitializers(READY_INITIALIZERS, ids).then(res, res);\n });\n};\n\nif (false) {\n window.__NEXT_PRELOADREADY = Loadable.preloadReady;\n}\n\nvar _default = Loadable;\nexports.default = _default;","map":null,"metadata":{},"sourceType":"script"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ast":null,"code":"\"use strict\";\n\nexports.__esModule = true;\nexports.searchParamsToUrlQuery = searchParamsToUrlQuery;\nexports.urlQueryToSearchParams = urlQueryToSearchParams;\nexports.assign = assign;\n\nfunction searchParamsToUrlQuery(searchParams) {\n const query = {};\n searchParams.forEach((value, key) => {\n if (typeof query[key] === 'undefined') {\n query[key] = value;\n } else if (Array.isArray(query[key])) {\n ;\n query[key].push(value);\n } else {\n query[key] = [query[key], value];\n }\n });\n return query;\n}\n\nfunction urlQueryToSearchParams(urlQuery) {\n const result = new URLSearchParams();\n Object.entries(urlQuery).forEach(([key, value]) => {\n if (Array.isArray(value)) {\n value.forEach(item => result.append(key, item));\n } else {\n result.set(key, value);\n }\n });\n return result;\n}\n\nfunction assign(target, ...searchParamsList) {\n searchParamsList.forEach(searchParams => {\n Array.from(searchParams.keys()).forEach(key => target.delete(key));\n searchParams.forEach((value, key) => target.append(key, value));\n });\n return target;\n}","map":null,"metadata":{},"sourceType":"script"}

0 commit comments

Comments
 (0)