added fonts
This commit is contained in:
1 parent
4134e3a234
commit
142d2986b6
9079 files changed
+1498421
-2
No files matched your search
+83
@@ -0,0 +1,83 @@
|
||||
import type { webpack } from 'next/dist/compiled/webpack/webpack';
|
||||
import type { MiddlewareConfig } from '../../../analysis/get-page-static-info';
|
||||
import { RouteKind } from '../../../../server/route-kind';
|
||||
import type { MappedPages } from '../../../build-context';
|
||||
type RouteLoaderOptionsPagesAPIInput = {
|
||||
kind: RouteKind.PAGES_API;
|
||||
page: string;
|
||||
preferredRegion: string | string[] | undefined;
|
||||
absolutePagePath: string;
|
||||
middlewareConfig: MiddlewareConfig;
|
||||
};
|
||||
type RouteLoaderOptionsPagesInput = {
|
||||
kind: RouteKind.PAGES;
|
||||
page: string;
|
||||
pages: MappedPages;
|
||||
preferredRegion: string | string[] | undefined;
|
||||
absolutePagePath: string;
|
||||
middlewareConfig: MiddlewareConfig;
|
||||
};
|
||||
type RouteLoaderOptionsInput = RouteLoaderOptionsPagesInput | RouteLoaderOptionsPagesAPIInput;
|
||||
type RouteLoaderPagesAPIOptions = {
|
||||
kind: RouteKind.PAGES_API;
|
||||
/**
|
||||
* The page name for this particular route.
|
||||
*/
|
||||
page: string;
|
||||
/**
|
||||
* The preferred region for this route.
|
||||
*/
|
||||
preferredRegion: string | string[] | undefined;
|
||||
/**
|
||||
* The absolute path to the userland page file.
|
||||
*/
|
||||
absolutePagePath: string;
|
||||
/**
|
||||
* The middleware config for this route.
|
||||
*/
|
||||
middlewareConfigBase64: string;
|
||||
};
|
||||
type RouteLoaderPagesOptions = {
|
||||
kind: RouteKind.PAGES;
|
||||
/**
|
||||
* The page name for this particular route.
|
||||
*/
|
||||
page: string;
|
||||
/**
|
||||
* The preferred region for this route.
|
||||
*/
|
||||
preferredRegion: string | string[] | undefined;
|
||||
/**
|
||||
* The absolute path to the userland page file.
|
||||
*/
|
||||
absolutePagePath: string;
|
||||
/**
|
||||
* The absolute paths to the app path file.
|
||||
*/
|
||||
absoluteAppPath: string;
|
||||
/**
|
||||
* The absolute paths to the document path file.
|
||||
*/
|
||||
absoluteDocumentPath: string;
|
||||
/**
|
||||
* The middleware config for this route.
|
||||
*/
|
||||
middlewareConfigBase64: string;
|
||||
};
|
||||
/**
|
||||
* The options for the route loader.
|
||||
*/
|
||||
type RouteLoaderOptions = RouteLoaderPagesOptions | RouteLoaderPagesAPIOptions;
|
||||
/**
|
||||
* Returns the loader entry for a given page.
|
||||
*
|
||||
* @param options the options to create the loader entry
|
||||
* @returns the encoded loader entry
|
||||
*/
|
||||
export declare function getRouteLoaderEntry(options: RouteLoaderOptionsInput): string;
|
||||
/**
|
||||
* Handles the `next-route-loader` options.
|
||||
* @returns the loader definition function
|
||||
*/
|
||||
declare const loader: webpack.LoaderDefinitionFunction<RouteLoaderOptions>;
|
||||
export default loader;
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
default: null,
|
||||
getRouteLoaderEntry: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
default: function() {
|
||||
return _default;
|
||||
},
|
||||
getRouteLoaderEntry: function() {
|
||||
return getRouteLoaderEntry;
|
||||
}
|
||||
});
|
||||
const _querystring = require("querystring");
|
||||
const _getmodulebuildinfo = require("../get-module-build-info");
|
||||
const _routekind = require("../../../../server/route-kind");
|
||||
const _normalizepagepath = require("../../../../shared/lib/page-path/normalize-page-path");
|
||||
const _utils = require("../utils");
|
||||
const _utils1 = require("../../../utils");
|
||||
const _loadentrypoint = require("../../../load-entrypoint");
|
||||
function getRouteLoaderEntry(options) {
|
||||
switch(options.kind){
|
||||
case _routekind.RouteKind.PAGES:
|
||||
{
|
||||
const query = {
|
||||
kind: options.kind,
|
||||
page: options.page,
|
||||
preferredRegion: options.preferredRegion,
|
||||
absolutePagePath: options.absolutePagePath,
|
||||
// These are the path references to the internal components that may be
|
||||
// overridden by userland components.
|
||||
absoluteAppPath: options.pages['/_app'],
|
||||
absoluteDocumentPath: options.pages['/_document'],
|
||||
middlewareConfigBase64: (0, _utils.encodeToBase64)(options.middlewareConfig)
|
||||
};
|
||||
return `next-route-loader?${(0, _querystring.stringify)(query)}!`;
|
||||
}
|
||||
case _routekind.RouteKind.PAGES_API:
|
||||
{
|
||||
const query = {
|
||||
kind: options.kind,
|
||||
page: options.page,
|
||||
preferredRegion: options.preferredRegion,
|
||||
absolutePagePath: options.absolutePagePath,
|
||||
middlewareConfigBase64: (0, _utils.encodeToBase64)(options.middlewareConfig)
|
||||
};
|
||||
return `next-route-loader?${(0, _querystring.stringify)(query)}!`;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw Object.defineProperty(new Error('Invariant: Unexpected route kind'), "__NEXT_ERROR_CODE", {
|
||||
value: "E453",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const loadPages = async ({ page, absolutePagePath, absoluteDocumentPath, absoluteAppPath, preferredRegion, middlewareConfigBase64 }, buildInfo)=>{
|
||||
const middlewareConfig = (0, _utils.decodeFromBase64)(middlewareConfigBase64);
|
||||
// Attach build info to the module.
|
||||
buildInfo.route = {
|
||||
page,
|
||||
absolutePagePath,
|
||||
preferredRegion,
|
||||
middlewareConfig
|
||||
};
|
||||
let file = await (0, _loadentrypoint.loadEntrypoint)('pages', {
|
||||
VAR_USERLAND: absolutePagePath,
|
||||
VAR_MODULE_DOCUMENT: absoluteDocumentPath,
|
||||
VAR_MODULE_APP: absoluteAppPath,
|
||||
VAR_DEFINITION_PAGE: (0, _normalizepagepath.normalizePagePath)(page),
|
||||
VAR_DEFINITION_PATHNAME: page
|
||||
});
|
||||
if ((0, _utils1.isInstrumentationHookFile)(page)) {
|
||||
// When we're building the instrumentation page (only when the
|
||||
// instrumentation file conflicts with a page also labeled
|
||||
// /instrumentation) hoist the `register` method.
|
||||
file += '\nexport const register = hoist(userland, "register")';
|
||||
}
|
||||
return file;
|
||||
};
|
||||
const loadPagesAPI = async ({ page, absolutePagePath, preferredRegion, middlewareConfigBase64 }, buildInfo)=>{
|
||||
const middlewareConfig = (0, _utils.decodeFromBase64)(middlewareConfigBase64);
|
||||
// Attach build info to the module.
|
||||
buildInfo.route = {
|
||||
page,
|
||||
absolutePagePath,
|
||||
preferredRegion,
|
||||
middlewareConfig
|
||||
};
|
||||
return await (0, _loadentrypoint.loadEntrypoint)('pages-api', {
|
||||
VAR_USERLAND: absolutePagePath,
|
||||
VAR_DEFINITION_PAGE: (0, _normalizepagepath.normalizePagePath)(page),
|
||||
VAR_DEFINITION_PATHNAME: page
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Handles the `next-route-loader` options.
|
||||
* @returns the loader definition function
|
||||
*/ const loader = async function() {
|
||||
if (!this._module) {
|
||||
throw Object.defineProperty(new Error('Invariant: expected this to reference a module'), "__NEXT_ERROR_CODE", {
|
||||
value: "E383",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
const buildInfo = (0, _getmodulebuildinfo.getModuleBuildInfo)(this._module);
|
||||
const opts = this.getOptions();
|
||||
switch(opts.kind){
|
||||
case _routekind.RouteKind.PAGES:
|
||||
{
|
||||
return await loadPages(opts, buildInfo);
|
||||
}
|
||||
case _routekind.RouteKind.PAGES_API:
|
||||
{
|
||||
return await loadPagesAPI(opts, buildInfo);
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw Object.defineProperty(new Error('Invariant: Unexpected route kind'), "__NEXT_ERROR_CODE", {
|
||||
value: "E453",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
const _default = loader;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-route-loader/index.ts"],"sourcesContent":["import type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport type { MiddlewareConfig } from '../../../analysis/get-page-static-info'\n\nimport { stringify } from 'querystring'\nimport {\n type ModuleBuildInfo,\n getModuleBuildInfo,\n} from '../get-module-build-info'\nimport { RouteKind } from '../../../../server/route-kind'\nimport { normalizePagePath } from '../../../../shared/lib/page-path/normalize-page-path'\nimport { decodeFromBase64, encodeToBase64 } from '../utils'\nimport { isInstrumentationHookFile } from '../../../utils'\nimport { loadEntrypoint } from '../../../load-entrypoint'\nimport type { MappedPages } from '../../../build-context'\n\ntype RouteLoaderOptionsPagesAPIInput = {\n kind: RouteKind.PAGES_API\n page: string\n preferredRegion: string | string[] | undefined\n absolutePagePath: string\n middlewareConfig: MiddlewareConfig\n}\n\ntype RouteLoaderOptionsPagesInput = {\n kind: RouteKind.PAGES\n page: string\n pages: MappedPages\n preferredRegion: string | string[] | undefined\n absolutePagePath: string\n middlewareConfig: MiddlewareConfig\n}\n\ntype RouteLoaderOptionsInput =\n | RouteLoaderOptionsPagesInput\n | RouteLoaderOptionsPagesAPIInput\n\ntype RouteLoaderPagesAPIOptions = {\n kind: RouteKind.PAGES_API\n\n /**\n * The page name for this particular route.\n */\n page: string\n\n /**\n * The preferred region for this route.\n */\n preferredRegion: string | string[] | undefined\n\n /**\n * The absolute path to the userland page file.\n */\n absolutePagePath: string\n\n /**\n * The middleware config for this route.\n */\n middlewareConfigBase64: string\n}\n\ntype RouteLoaderPagesOptions = {\n kind: RouteKind.PAGES\n\n /**\n * The page name for this particular route.\n */\n page: string\n\n /**\n * The preferred region for this route.\n */\n preferredRegion: string | string[] | undefined\n\n /**\n * The absolute path to the userland page file.\n */\n absolutePagePath: string\n\n /**\n * The absolute paths to the app path file.\n */\n absoluteAppPath: string\n\n /**\n * The absolute paths to the document path file.\n */\n absoluteDocumentPath: string\n\n /**\n * The middleware config for this route.\n */\n middlewareConfigBase64: string\n}\n\n/**\n * The options for the route loader.\n */\ntype RouteLoaderOptions = RouteLoaderPagesOptions | RouteLoaderPagesAPIOptions\n\n/**\n * Returns the loader entry for a given page.\n *\n * @param options the options to create the loader entry\n * @returns the encoded loader entry\n */\nexport function getRouteLoaderEntry(options: RouteLoaderOptionsInput): string {\n switch (options.kind) {\n case RouteKind.PAGES: {\n const query: RouteLoaderPagesOptions = {\n kind: options.kind,\n page: options.page,\n preferredRegion: options.preferredRegion,\n absolutePagePath: options.absolutePagePath,\n // These are the path references to the internal components that may be\n // overridden by userland components.\n absoluteAppPath: options.pages['/_app'],\n absoluteDocumentPath: options.pages['/_document'],\n middlewareConfigBase64: encodeToBase64(options.middlewareConfig),\n }\n\n return `next-route-loader?${stringify(query)}!`\n }\n case RouteKind.PAGES_API: {\n const query: RouteLoaderPagesAPIOptions = {\n kind: options.kind,\n page: options.page,\n preferredRegion: options.preferredRegion,\n absolutePagePath: options.absolutePagePath,\n middlewareConfigBase64: encodeToBase64(options.middlewareConfig),\n }\n\n return `next-route-loader?${stringify(query)}!`\n }\n default: {\n throw new Error('Invariant: Unexpected route kind')\n }\n }\n}\n\nconst loadPages = async (\n {\n page,\n absolutePagePath,\n absoluteDocumentPath,\n absoluteAppPath,\n preferredRegion,\n middlewareConfigBase64,\n }: RouteLoaderPagesOptions,\n buildInfo: ModuleBuildInfo\n) => {\n const middlewareConfig: MiddlewareConfig = decodeFromBase64(\n middlewareConfigBase64\n )\n\n // Attach build info to the module.\n buildInfo.route = {\n page,\n absolutePagePath,\n preferredRegion,\n middlewareConfig,\n }\n\n let file = await loadEntrypoint('pages', {\n VAR_USERLAND: absolutePagePath,\n VAR_MODULE_DOCUMENT: absoluteDocumentPath,\n VAR_MODULE_APP: absoluteAppPath,\n VAR_DEFINITION_PAGE: normalizePagePath(page),\n VAR_DEFINITION_PATHNAME: page,\n })\n\n if (isInstrumentationHookFile(page)) {\n // When we're building the instrumentation page (only when the\n // instrumentation file conflicts with a page also labeled\n // /instrumentation) hoist the `register` method.\n file += '\\nexport const register = hoist(userland, \"register\")'\n }\n\n return file\n}\n\nconst loadPagesAPLine truncated
|
||||
Reference in new issue
Block a user