Initial boiler plate project
This commit is contained in:
22
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/CssSyntaxError.js
generated
vendored
Normal file
22
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/CssSyntaxError.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
export default class CssSyntaxError extends Error {
|
||||
constructor(error){
|
||||
super(error);
|
||||
const { reason, line, column } = error;
|
||||
this.name = "CssSyntaxError";
|
||||
// Based on https://github.com/postcss/postcss/blob/master/lib/css-syntax-error.es6#L132
|
||||
// We don't need `plugin` and `file` properties.
|
||||
this.message = `${this.name}\n\n`;
|
||||
if (typeof line !== "undefined") {
|
||||
this.message += `(${line}:${column}) `;
|
||||
}
|
||||
this.message += reason;
|
||||
const code = error.showSourceCode();
|
||||
if (code) {
|
||||
this.message += `\n\n${code}\n`;
|
||||
}
|
||||
// We don't need stack https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md#31-dont-show-js-stack-for-csssyntaxerror
|
||||
this.stack = false;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=CssSyntaxError.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/CssSyntaxError.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/CssSyntaxError.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/css-loader/src/CssSyntaxError.ts"],"names":["CssSyntaxError","Error","constructor","error","reason","line","column","name","message","code","showSourceCode","stack"],"mappings":"AAAA,eAAe,MAAMA,uBAAuBC;IAE1CC,YAAYC,KAAU,CAAE;QACtB,KAAK,CAACA;QAEN,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAE,GAAGH;QAEjC,IAAI,CAACI,IAAI,GAAG;QAEZ,wFAAwF;QACxF,gDAAgD;QAChD,IAAI,CAACC,OAAO,GAAG,CAAC,EAAE,IAAI,CAACD,IAAI,CAAC,IAAI,CAAC;QAEjC,IAAI,OAAOF,SAAS,aAAa;YAC/B,IAAI,CAACG,OAAO,IAAI,CAAC,CAAC,EAAEH,KAAK,CAAC,EAAEC,OAAO,EAAE,CAAC;QACxC;QAEA,IAAI,CAACE,OAAO,IAAIJ;QAEhB,MAAMK,OAAON,MAAMO,cAAc;QAEjC,IAAID,MAAM;YACR,IAAI,CAACD,OAAO,IAAI,CAAC,IAAI,EAAEC,KAAK,EAAE,CAAC;QACjC;QAEA,wIAAwI;QACxI,IAAI,CAACE,KAAK,GAAG;IACf;AACF"}
|
||||
79
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/camelcase.js
generated
vendored
Normal file
79
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/camelcase.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/ const preserveCamelCase = (string, locale)=>{
|
||||
let isLastCharLower = false;
|
||||
let isLastCharUpper = false;
|
||||
let isLastLastCharUpper = false;
|
||||
for(let i = 0; i < string.length; i++){
|
||||
const character = string[i];
|
||||
if (isLastCharLower && /[\p{Lu}]/u.test(character)) {
|
||||
string = string.slice(0, i) + "-" + string.slice(i);
|
||||
isLastCharLower = false;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = true;
|
||||
i++;
|
||||
} else if (isLastCharUpper && isLastLastCharUpper && /[\p{Ll}]/u.test(character)) {
|
||||
string = string.slice(0, i - 1) + "-" + string.slice(i - 1);
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = false;
|
||||
isLastCharLower = true;
|
||||
} else {
|
||||
isLastCharLower = character.toLocaleLowerCase(locale) === character && character.toLocaleUpperCase(locale) !== character;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = character.toLocaleUpperCase(locale) === character && character.toLocaleLowerCase(locale) !== character;
|
||||
}
|
||||
}
|
||||
return string;
|
||||
};
|
||||
const preserveConsecutiveUppercase = (input)=>{
|
||||
return input.replace(/^[\p{Lu}](?![\p{Lu}])/gu, (m1)=>m1.toLowerCase());
|
||||
};
|
||||
const postProcess = (input, options)=>{
|
||||
return input.replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1)=>p1.toLocaleUpperCase(options.locale)).replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, (m)=>m.toLocaleUpperCase(options.locale));
|
||||
};
|
||||
const camelCase = (input, options)=>{
|
||||
if (!(typeof input === "string" || Array.isArray(input))) {
|
||||
throw new TypeError("Expected the input to be `string | string[]`");
|
||||
}
|
||||
options = {
|
||||
pascalCase: false,
|
||||
preserveConsecutiveUppercase: false,
|
||||
...options
|
||||
};
|
||||
if (Array.isArray(input)) {
|
||||
input = input.map((x)=>x.trim()).filter((x)=>x.length).join("-");
|
||||
} else {
|
||||
input = input.trim();
|
||||
}
|
||||
if (input.length === 0) {
|
||||
return "";
|
||||
}
|
||||
if (input.length === 1) {
|
||||
return options.pascalCase ? input.toLocaleUpperCase(options.locale) : input.toLocaleLowerCase(options.locale);
|
||||
}
|
||||
const hasUpperCase = input !== input.toLocaleLowerCase(options.locale);
|
||||
if (hasUpperCase) {
|
||||
input = preserveCamelCase(input, options.locale);
|
||||
}
|
||||
input = input.replace(/^[_.\- ]+/, "");
|
||||
if (options.preserveConsecutiveUppercase) {
|
||||
input = preserveConsecutiveUppercase(input);
|
||||
} else {
|
||||
input = input.toLocaleLowerCase();
|
||||
}
|
||||
if (options.pascalCase) {
|
||||
input = input.charAt(0).toLocaleUpperCase(options.locale) + input.slice(1);
|
||||
}
|
||||
return postProcess(input, options);
|
||||
};
|
||||
export default camelCase;
|
||||
|
||||
//# sourceMappingURL=camelcase.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/camelcase.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/camelcase.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/css-loader/src/camelcase.ts"],"names":["preserveCamelCase","string","locale","isLastCharLower","isLastCharUpper","isLastLastCharUpper","i","length","character","test","slice","toLocaleLowerCase","toLocaleUpperCase","preserveConsecutiveUppercase","input","replace","m1","toLowerCase","postProcess","options","_","p1","m","camelCase","Array","isArray","TypeError","pascalCase","map","x","trim","filter","join","hasUpperCase","charAt"],"mappings":"AAAA;;;;;;;;;;AAUA,GAEA,MAAMA,oBAAoB,CAACC,QAAgBC;IACzC,IAAIC,kBAAkB;IACtB,IAAIC,kBAAkB;IACtB,IAAIC,sBAAsB;IAE1B,IAAK,IAAIC,IAAI,GAAGA,IAAIL,OAAOM,MAAM,EAAED,IAAK;QACtC,MAAME,YAAYP,MAAM,CAACK,EAAE;QAE3B,IAAIH,mBAAmB,YAAYM,IAAI,CAACD,YAAY;YAClDP,SAASA,OAAOS,KAAK,CAAC,GAAGJ,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AEA,IAAIhB,MAAMP,MAAM,KAAK,GAAG;QACtB,OAAO;IACT;IAEA,IAAIO,MAAMP,MAAM,KAAK,GAAG;QACtB,OAAOY,QAAQQ,UAAU,GACrBb,MAAMF,iBAAiB,CAACO,QAAQjB,MAAM,IACtCY,MAAMH,iBAAiB,CAACQ,QAAQjB,MAAM;IAC5C;IAEA,MAAM+B,eAAenB,UAAUA,MAAMH,iBAAiB,CAACQ,QAAQjB,MAAM;IAErE,IAAI+B,cAAc;QAChBnB,QAAQd,kBAAkBc,OAAOK,QAAQjB,MAAM;IACjD;IAEAY,QAAQA,MAAMC,OAAO,CAAC,aAAa;IAEnC,IAAII,QAAQN,4BAA4B,EAAE;QACxCC,QAAQD,6BAA6BC;IACvC,OAAO;QACLA,QAAQA,MAAMH,iBAAiB;IACjC;IAEA,IAAIQ,QAAQQ,UAAU,EAAE;QACtBb,QAAQA,MAAMoB,MAAM,CAAC,GAAGtB,iBAAiB,CAACO,QAAQjB,MAAM,IAAIY,MAAMJ,KAAK,CAAC;IAC1E;IAEA,OAAOQ,YAAYJ,OAAOK;AAC5B;AAEA,eAAeI,UAAS"}
|
||||
254
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/index.js
generated
vendored
Normal file
254
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/index.js
generated
vendored
Normal file
@ -0,0 +1,254 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/ import CssSyntaxError from "./CssSyntaxError";
|
||||
import Warning from "../../postcss-loader/src/Warning";
|
||||
import { stringifyRequest } from "../../../stringify-request";
|
||||
const moduleRegExp = /\.module\.\w+$/i;
|
||||
function getModulesOptions(rawOptions, loaderContext) {
|
||||
const { resourcePath } = loaderContext;
|
||||
if (typeof rawOptions.modules === "undefined") {
|
||||
const isModules = moduleRegExp.test(resourcePath);
|
||||
if (!isModules) {
|
||||
return false;
|
||||
}
|
||||
} else if (typeof rawOptions.modules === "boolean" && rawOptions.modules === false) {
|
||||
return false;
|
||||
}
|
||||
let modulesOptions = {
|
||||
compileType: rawOptions.icss ? "icss" : "module",
|
||||
auto: true,
|
||||
mode: "local",
|
||||
exportGlobals: false,
|
||||
localIdentName: "[hash:base64]",
|
||||
localIdentContext: loaderContext.rootContext,
|
||||
localIdentHashPrefix: "",
|
||||
// eslint-disable-next-line no-undefined
|
||||
localIdentRegExp: undefined,
|
||||
namedExport: false,
|
||||
exportLocalsConvention: "asIs",
|
||||
exportOnlyLocals: false
|
||||
};
|
||||
if (typeof rawOptions.modules === "boolean" || typeof rawOptions.modules === "string") {
|
||||
modulesOptions.mode = typeof rawOptions.modules === "string" ? rawOptions.modules : "local";
|
||||
} else {
|
||||
if (rawOptions.modules) {
|
||||
if (typeof rawOptions.modules.auto === "boolean") {
|
||||
const isModules = rawOptions.modules.auto && moduleRegExp.test(resourcePath);
|
||||
if (!isModules) {
|
||||
return false;
|
||||
}
|
||||
} else if (rawOptions.modules.auto instanceof RegExp) {
|
||||
const isModules = rawOptions.modules.auto.test(resourcePath);
|
||||
if (!isModules) {
|
||||
return false;
|
||||
}
|
||||
} else if (typeof rawOptions.modules.auto === "function") {
|
||||
const isModule = rawOptions.modules.auto(resourcePath);
|
||||
if (!isModule) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (rawOptions.modules.namedExport === true && typeof rawOptions.modules.exportLocalsConvention === "undefined") {
|
||||
modulesOptions.exportLocalsConvention = "camelCaseOnly";
|
||||
}
|
||||
}
|
||||
modulesOptions = {
|
||||
...modulesOptions,
|
||||
...rawOptions.modules || {}
|
||||
};
|
||||
}
|
||||
if (typeof modulesOptions.mode === "function") {
|
||||
modulesOptions.mode = modulesOptions.mode(loaderContext.resourcePath);
|
||||
}
|
||||
if (modulesOptions.namedExport === true) {
|
||||
if (rawOptions.esModule === false) {
|
||||
throw new Error('The "modules.namedExport" option requires the "esModules" option to be enabled');
|
||||
}
|
||||
if (modulesOptions.exportLocalsConvention !== "camelCaseOnly") {
|
||||
throw new Error('The "modules.namedExport" option requires the "modules.exportLocalsConvention" option to be "camelCaseOnly"');
|
||||
}
|
||||
}
|
||||
return modulesOptions;
|
||||
}
|
||||
function normalizeOptions(rawOptions, loaderContext) {
|
||||
if (rawOptions.icss) {
|
||||
loaderContext.emitWarning(new Error('The "icss" option is deprecated, use "modules.compileType: "icss"" instead'));
|
||||
}
|
||||
const modulesOptions = getModulesOptions(rawOptions, loaderContext);
|
||||
return {
|
||||
url: typeof rawOptions.url === "undefined" ? true : rawOptions.url,
|
||||
import: typeof rawOptions.import === "undefined" ? true : rawOptions.import,
|
||||
modules: modulesOptions,
|
||||
// TODO remove in the next major release
|
||||
icss: typeof rawOptions.icss === "undefined" ? false : rawOptions.icss,
|
||||
sourceMap: typeof rawOptions.sourceMap === "boolean" ? rawOptions.sourceMap : loaderContext.sourceMap,
|
||||
importLoaders: typeof rawOptions.importLoaders === "string" ? parseInt(rawOptions.importLoaders, 10) : rawOptions.importLoaders,
|
||||
esModule: typeof rawOptions.esModule === "undefined" ? true : rawOptions.esModule,
|
||||
fontLoader: rawOptions.fontLoader
|
||||
};
|
||||
}
|
||||
export default async function loader(content, map, meta) {
|
||||
const rawOptions = this.getOptions();
|
||||
const plugins = [];
|
||||
const callback = this.async();
|
||||
const loaderSpan = this.currentTraceSpan.traceChild("css-loader");
|
||||
loaderSpan.traceAsyncFn(async ()=>{
|
||||
let options;
|
||||
try {
|
||||
options = normalizeOptions(rawOptions, this);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
const { postcss } = await rawOptions.postcss();
|
||||
const { shouldUseModulesPlugins, shouldUseImportPlugin, shouldUseURLPlugin, shouldUseIcssPlugin, getPreRequester, getExportCode, getFilter, getImportCode, getModuleCode, getModulesPlugins, normalizeSourceMap, sort } = require("./utils");
|
||||
const { icssParser, importParser, urlParser } = require("./plugins");
|
||||
const replacements = [];
|
||||
// if it's a font loader next-font-loader will have exports that should be exported as is
|
||||
const exports = options.fontLoader ? meta.exports : [];
|
||||
if (shouldUseModulesPlugins(options)) {
|
||||
plugins.push(...getModulesPlugins(options, this, meta));
|
||||
}
|
||||
const importPluginImports = [];
|
||||
const importPluginApi = [];
|
||||
if (shouldUseImportPlugin(options)) {
|
||||
const resolver = this.getResolve({
|
||||
conditionNames: [
|
||||
"style"
|
||||
],
|
||||
extensions: [
|
||||
".css"
|
||||
],
|
||||
mainFields: [
|
||||
"css",
|
||||
"style",
|
||||
"main",
|
||||
"..."
|
||||
],
|
||||
mainFiles: [
|
||||
"index",
|
||||
"..."
|
||||
],
|
||||
restrictions: [
|
||||
/\.css$/i
|
||||
]
|
||||
});
|
||||
plugins.push(importParser({
|
||||
imports: importPluginImports,
|
||||
api: importPluginApi,
|
||||
context: this.context,
|
||||
rootContext: this.rootContext,
|
||||
filter: getFilter(options.import, this.resourcePath),
|
||||
resolver,
|
||||
urlHandler: (url)=>stringifyRequest(this, getPreRequester(this)(options.importLoaders) + url)
|
||||
}));
|
||||
}
|
||||
const urlPluginImports = [];
|
||||
if (shouldUseURLPlugin(options)) {
|
||||
const urlResolver = this.getResolve({
|
||||
conditionNames: [
|
||||
"asset"
|
||||
],
|
||||
mainFields: [
|
||||
"asset"
|
||||
],
|
||||
mainFiles: [],
|
||||
extensions: []
|
||||
});
|
||||
plugins.push(urlParser({
|
||||
imports: urlPluginImports,
|
||||
replacements,
|
||||
context: this.context,
|
||||
rootContext: this.rootContext,
|
||||
filter: getFilter(options.url, this.resourcePath),
|
||||
resolver: urlResolver,
|
||||
urlHandler: (url)=>stringifyRequest(this, url)
|
||||
}));
|
||||
}
|
||||
const icssPluginImports = [];
|
||||
const icssPluginApi = [];
|
||||
if (shouldUseIcssPlugin(options)) {
|
||||
const icssResolver = this.getResolve({
|
||||
conditionNames: [
|
||||
"style"
|
||||
],
|
||||
extensions: [],
|
||||
mainFields: [
|
||||
"css",
|
||||
"style",
|
||||
"main",
|
||||
"..."
|
||||
],
|
||||
mainFiles: [
|
||||
"index",
|
||||
"..."
|
||||
]
|
||||
});
|
||||
plugins.push(icssParser({
|
||||
imports: icssPluginImports,
|
||||
api: icssPluginApi,
|
||||
replacements,
|
||||
exports,
|
||||
context: this.context,
|
||||
rootContext: this.rootContext,
|
||||
resolver: icssResolver,
|
||||
urlHandler: (url)=>stringifyRequest(this, getPreRequester(this)(options.importLoaders) + url)
|
||||
}));
|
||||
}
|
||||
// Reuse CSS AST (PostCSS AST e.g 'postcss-loader') to avoid reparsing
|
||||
if (meta) {
|
||||
const { ast } = meta;
|
||||
if (ast && ast.type === "postcss") {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
content = ast.root;
|
||||
loaderSpan.setAttribute("astUsed", "true");
|
||||
}
|
||||
}
|
||||
const { resourcePath } = this;
|
||||
let result;
|
||||
try {
|
||||
result = await postcss(plugins).process(content, {
|
||||
from: resourcePath,
|
||||
to: resourcePath,
|
||||
map: options.sourceMap ? {
|
||||
prev: map ? normalizeSourceMap(map, resourcePath) : null,
|
||||
inline: false,
|
||||
annotation: false
|
||||
} : false
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.file) {
|
||||
this.addDependency(error.file);
|
||||
}
|
||||
throw error.name === "CssSyntaxError" ? new CssSyntaxError(error) : error;
|
||||
}
|
||||
for (const warning of result.warnings()){
|
||||
this.emitWarning(new Warning(warning));
|
||||
}
|
||||
const imports = [
|
||||
...icssPluginImports.sort(sort),
|
||||
...importPluginImports.sort(sort),
|
||||
...urlPluginImports.sort(sort)
|
||||
];
|
||||
const api = [
|
||||
...importPluginApi.sort(sort),
|
||||
...icssPluginApi.sort(sort)
|
||||
];
|
||||
if (options.modules.exportOnlyLocals !== true) {
|
||||
imports.unshift({
|
||||
importName: "___CSS_LOADER_API_IMPORT___",
|
||||
url: stringifyRequest(this, require.resolve("./runtime/api"))
|
||||
});
|
||||
}
|
||||
const importCode = getImportCode(imports, options);
|
||||
const moduleCode = getModuleCode(result, api, replacements, options, this);
|
||||
const exportCode = getExportCode(exports, replacements, options);
|
||||
return `${importCode}${moduleCode}${exportCode}`;
|
||||
}).then((code)=>{
|
||||
callback(null, code);
|
||||
}, (err)=>{
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/index.js
generated
vendored
Normal file
6
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/index.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import importParser from "./postcss-import-parser";
|
||||
import icssParser from "./postcss-icss-parser";
|
||||
import urlParser from "./postcss-url-parser";
|
||||
export { importParser, icssParser, urlParser };
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../../src/build/webpack/loaders/css-loader/src/plugins/index.ts"],"names":["importParser","icssParser","urlParser"],"mappings":"AAAA,OAAOA,kBAAkB,0BAAyB;AAClD,OAAOC,gBAAgB,wBAAuB;AAC9C,OAAOC,eAAe,uBAAsB;AAE5C,SAASF,YAAY,EAAEC,UAAU,EAAEC,SAAS,GAAE"}
|
||||
97
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-icss-parser.js
generated
vendored
Normal file
97
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-icss-parser.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
import { extractICSS, replaceValueSymbols, replaceSymbols } from "next/dist/compiled/icss-utils";
|
||||
import { normalizeUrl, resolveRequests, requestify } from "../utils";
|
||||
const plugin = (options = {})=>{
|
||||
return {
|
||||
postcssPlugin: "postcss-icss-parser",
|
||||
async OnceExit (root) {
|
||||
const importReplacements = Object.create(null);
|
||||
const { icssImports, icssExports } = extractICSS(root);
|
||||
const imports = new Map();
|
||||
const tasks = [];
|
||||
// eslint-disable-next-line guard-for-in
|
||||
for(const url in icssImports){
|
||||
const tokens = icssImports[url];
|
||||
if (Object.keys(tokens).length === 0) {
|
||||
continue;
|
||||
}
|
||||
let normalizedUrl = url;
|
||||
let prefix = "";
|
||||
const queryParts = normalizedUrl.split("!");
|
||||
if (queryParts.length > 1) {
|
||||
normalizedUrl = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
const request = requestify(normalizeUrl(normalizedUrl, true), options.rootContext);
|
||||
const doResolve = async ()=>{
|
||||
const { resolver, context } = options;
|
||||
const resolvedUrl = await resolveRequests(resolver, context, [
|
||||
...new Set([
|
||||
normalizedUrl,
|
||||
request
|
||||
])
|
||||
]);
|
||||
if (!resolvedUrl) {
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line consistent-return
|
||||
return {
|
||||
url: resolvedUrl,
|
||||
prefix,
|
||||
tokens
|
||||
};
|
||||
};
|
||||
tasks.push(doResolve());
|
||||
}
|
||||
const results = await Promise.all(tasks);
|
||||
for(let index = 0; index <= results.length - 1; index++){
|
||||
const item = results[index];
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
const newUrl = item.prefix ? `${item.prefix}!${item.url}` : item.url;
|
||||
const importKey = newUrl;
|
||||
let importName = imports.get(importKey);
|
||||
if (!importName) {
|
||||
importName = `___CSS_LOADER_ICSS_IMPORT_${imports.size}___`;
|
||||
imports.set(importKey, importName);
|
||||
options.imports.push({
|
||||
type: "icss_import",
|
||||
importName,
|
||||
url: options.urlHandler(newUrl),
|
||||
icss: true,
|
||||
index
|
||||
});
|
||||
options.api.push({
|
||||
importName,
|
||||
dedupe: true,
|
||||
index
|
||||
});
|
||||
}
|
||||
for (const [replacementIndex, token] of Object.keys(item.tokens).entries()){
|
||||
const replacementName = `___CSS_LOADER_ICSS_IMPORT_${index}_REPLACEMENT_${replacementIndex}___`;
|
||||
const localName = item.tokens[token];
|
||||
importReplacements[token] = replacementName;
|
||||
options.replacements.push({
|
||||
replacementName,
|
||||
importName,
|
||||
localName
|
||||
});
|
||||
}
|
||||
}
|
||||
if (Object.keys(importReplacements).length > 0) {
|
||||
replaceSymbols(root, importReplacements);
|
||||
}
|
||||
for (const name of Object.keys(icssExports)){
|
||||
const value = replaceValueSymbols(icssExports[name], importReplacements);
|
||||
options.exports.push({
|
||||
name,
|
||||
value
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
plugin.postcss = true;
|
||||
export default plugin;
|
||||
|
||||
//# sourceMappingURL=postcss-icss-parser.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-icss-parser.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-icss-parser.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../../src/build/webpack/loaders/css-loader/src/plugins/postcss-icss-parser.ts"],"names":["extractICSS","replaceValueSymbols","replaceSymbols","normalizeUrl","resolveRequests","requestify","plugin","options","postcssPlugin","OnceExit","root","importReplacements","Object","create","icssImports","icssExports","imports","Map","tasks","url","tokens","keys","length","normalizedUrl","prefix","queryParts","split","pop","join","request","rootContext","doResolve","resolver","context","resolvedUrl","Set","push","results","Promise","all","index","item","newUrl","importKey","importName","get","size","set","type","urlHandler","icss","api","dedupe","replacementIndex","token","entries","replacementName","localName","replacements","name","value","exports","postcss"],"mappings":"AAAA,SACEA,WAAW,EACXC,mBAAmB,EACnBC,cAAc,QACT,gCAA+B;AAEtC,SAASC,YAAY,EAAEC,eAAe,EAAEC,UAAU,QAAQ,WAAU;AAEpE,MAAMC,SAAS,CAACC,UAAe,CAAC,CAAC;IAC/B,OAAO;QAC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_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-import-parser.js
generated
vendored
Normal file
193
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-import-parser.js
generated
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
import valueParser from "next/dist/compiled/postcss-value-parser";
|
||||
import { normalizeUrl, resolveRequests, isUrlRequestable, requestify, // @ts-expect-error TODO: this export doesn't exist? Double check.
|
||||
WEBPACK_IGNORE_COMMENT_REGEXP } from "../utils";
|
||||
function parseNode(atRule, key) {
|
||||
// Convert only top-level @import
|
||||
if (atRule.parent.type !== "root") {
|
||||
return;
|
||||
}
|
||||
if (atRule.raws && atRule.raws.afterName && atRule.raws.afterName.trim().length > 0) {
|
||||
const lastCommentIndex = atRule.raws.afterName.lastIndexOf("/*");
|
||||
const matched = atRule.raws.afterName.slice(lastCommentIndex).match(WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
if (matched && matched[2] === "true") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
const prevNode = atRule.prev();
|
||||
if (prevNode && prevNode.type === "comment") {
|
||||
const matched = prevNode.text.match(WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
if (matched && matched[2] === "true") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Nodes do not exists - `@import url('http://') :root {}`
|
||||
if (atRule.nodes) {
|
||||
const error = new Error("It looks like you didn't end your @import statement correctly. Child nodes are attached to it.");
|
||||
error.node = atRule;
|
||||
throw error;
|
||||
}
|
||||
const { nodes: paramsNodes } = valueParser(atRule[key]);
|
||||
// No nodes - `@import ;`
|
||||
// Invalid type - `@import foo-bar;`
|
||||
if (paramsNodes.length === 0 || paramsNodes[0].type !== "string" && paramsNodes[0].type !== "function") {
|
||||
const error = new Error(`Unable to find uri in "${atRule.toString()}"`);
|
||||
error.node = atRule;
|
||||
throw error;
|
||||
}
|
||||
let isStringValue;
|
||||
let url;
|
||||
if (paramsNodes[0].type === "string") {
|
||||
isStringValue = true;
|
||||
url = paramsNodes[0].value;
|
||||
} else {
|
||||
// Invalid function - `@import nourl(test.css);`
|
||||
if (paramsNodes[0].value.toLowerCase() !== "url") {
|
||||
const error = new Error(`Unable to find uri in "${atRule.toString()}"`);
|
||||
error.node = atRule;
|
||||
throw error;
|
||||
}
|
||||
isStringValue = paramsNodes[0].nodes.length !== 0 && paramsNodes[0].nodes[0].type === "string";
|
||||
url = isStringValue ? paramsNodes[0].nodes[0].value : valueParser.stringify(paramsNodes[0].nodes);
|
||||
}
|
||||
url = normalizeUrl(url, isStringValue);
|
||||
const isRequestable = isUrlRequestable(url);
|
||||
let prefix;
|
||||
if (isRequestable) {
|
||||
const queryParts = url.split("!");
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
}
|
||||
// Empty url - `@import "";` or `@import url();`
|
||||
if (url.trim().length === 0) {
|
||||
const error = new Error(`Unable to find uri in "${atRule.toString()}"`);
|
||||
error.node = atRule;
|
||||
throw error;
|
||||
}
|
||||
const mediaNodes = paramsNodes.slice(1);
|
||||
let media;
|
||||
if (mediaNodes.length > 0) {
|
||||
media = valueParser.stringify(mediaNodes).trim().toLowerCase();
|
||||
}
|
||||
// eslint-disable-next-line consistent-return
|
||||
return {
|
||||
atRule,
|
||||
prefix,
|
||||
url,
|
||||
media,
|
||||
isRequestable
|
||||
};
|
||||
}
|
||||
const plugin = (options = {})=>{
|
||||
return {
|
||||
postcssPlugin: "postcss-import-parser",
|
||||
prepare (result) {
|
||||
const parsedAtRules = [];
|
||||
return {
|
||||
AtRule: {
|
||||
import (atRule) {
|
||||
let parsedAtRule;
|
||||
try {
|
||||
// @ts-expect-error TODO: there is no third argument?
|
||||
parsedAtRule = parseNode(atRule, "params", result);
|
||||
} catch (error) {
|
||||
result.warn(error.message, {
|
||||
node: error.node
|
||||
});
|
||||
}
|
||||
if (!parsedAtRule) {
|
||||
return;
|
||||
}
|
||||
parsedAtRules.push(parsedAtRule);
|
||||
}
|
||||
},
|
||||
async OnceExit () {
|
||||
if (parsedAtRules.length === 0) {
|
||||
return;
|
||||
}
|
||||
const resolvedAtRules = await Promise.all(parsedAtRules.map(async (parsedAtRule)=>{
|
||||
const { atRule, isRequestable, prefix, url, media } = parsedAtRule;
|
||||
if (options.filter) {
|
||||
const needKeep = await options.filter(url, media);
|
||||
if (!needKeep) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isRequestable) {
|
||||
const request = requestify(url, options.rootContext);
|
||||
const { resolver, context } = options;
|
||||
const resolvedUrl = await resolveRequests(resolver, context, [
|
||||
...new Set([
|
||||
request,
|
||||
url
|
||||
])
|
||||
]);
|
||||
if (!resolvedUrl) {
|
||||
return;
|
||||
}
|
||||
if (resolvedUrl === options.resourcePath) {
|
||||
atRule.remove();
|
||||
return;
|
||||
}
|
||||
atRule.remove();
|
||||
// eslint-disable-next-line consistent-return
|
||||
return {
|
||||
url: resolvedUrl,
|
||||
media,
|
||||
prefix,
|
||||
isRequestable
|
||||
};
|
||||
}
|
||||
atRule.remove();
|
||||
// eslint-disable-next-line consistent-return
|
||||
return {
|
||||
url,
|
||||
media,
|
||||
prefix,
|
||||
isRequestable
|
||||
};
|
||||
}));
|
||||
const urlToNameMap = new Map();
|
||||
for(let index = 0; index <= resolvedAtRules.length - 1; index++){
|
||||
const resolvedAtRule = resolvedAtRules[index];
|
||||
if (!resolvedAtRule) {
|
||||
continue;
|
||||
}
|
||||
const { url, isRequestable, media } = resolvedAtRule;
|
||||
if (!isRequestable) {
|
||||
options.api.push({
|
||||
url,
|
||||
media,
|
||||
index
|
||||
});
|
||||
continue;
|
||||
}
|
||||
const { prefix } = resolvedAtRule;
|
||||
const newUrl = prefix ? `${prefix}!${url}` : url;
|
||||
let importName = urlToNameMap.get(newUrl);
|
||||
if (!importName) {
|
||||
importName = `___CSS_LOADER_AT_RULE_IMPORT_${urlToNameMap.size}___`;
|
||||
urlToNameMap.set(newUrl, importName);
|
||||
options.imports.push({
|
||||
type: "rule_import",
|
||||
importName,
|
||||
url: options.urlHandler(newUrl),
|
||||
index
|
||||
});
|
||||
}
|
||||
options.api.push({
|
||||
importName,
|
||||
media,
|
||||
index
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
plugin.postcss = true;
|
||||
export default plugin;
|
||||
|
||||
//# sourceMappingURL=postcss-import-parser.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-import-parser.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-import-parser.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
313
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-url-parser.js
generated
vendored
Normal file
313
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-url-parser.js
generated
vendored
Normal file
@ -0,0 +1,313 @@
|
||||
import valueParser from "next/dist/compiled/postcss-value-parser";
|
||||
import { resolveRequests, normalizeUrl, requestify, isUrlRequestable, isDataUrl, // @ts-expect-error TODO: this export doesn't exist? Double check.
|
||||
WEBPACK_IGNORE_COMMENT_REGEXP } from "../utils";
|
||||
const isUrlFunc = /url/i;
|
||||
const isImageSetFunc = /^(?:-webkit-)?image-set$/i;
|
||||
const needParseDeclaration = /(?:url|(?:-webkit-)?image-set)\(/i;
|
||||
function getNodeFromUrlFunc(node) {
|
||||
return node.nodes && node.nodes[0];
|
||||
}
|
||||
function getWebpackIgnoreCommentValue(index, nodes, inBetween) {
|
||||
if (index === 0 && typeof inBetween !== "undefined") {
|
||||
return inBetween;
|
||||
}
|
||||
let prevValueNode = nodes[index - 1];
|
||||
if (!prevValueNode) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return;
|
||||
}
|
||||
if (prevValueNode.type === "space") {
|
||||
if (!nodes[index - 2]) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return;
|
||||
}
|
||||
prevValueNode = nodes[index - 2];
|
||||
}
|
||||
if (prevValueNode.type !== "comment") {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return;
|
||||
}
|
||||
const matched = prevValueNode.value.match(WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
return matched && matched[2] === "true";
|
||||
}
|
||||
function shouldHandleURL(url, declaration, result, isSupportDataURLInNewURL) {
|
||||
if (url.length === 0) {
|
||||
result.warn(`Unable to find uri in '${declaration.toString()}'`, {
|
||||
node: declaration
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (isDataUrl(url) && isSupportDataURLInNewURL) {
|
||||
try {
|
||||
decodeURIComponent(url);
|
||||
} catch (ignoreError) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!isUrlRequestable(url)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function parseDeclaration(declaration, key, result, isSupportDataURLInNewURL) {
|
||||
if (!needParseDeclaration.test(declaration[key])) {
|
||||
return;
|
||||
}
|
||||
const parsed = valueParser(declaration.raws && declaration.raws.value && declaration.raws.value.raw ? declaration.raws.value.raw : declaration[key]);
|
||||
let inBetween;
|
||||
if (declaration.raws && declaration.raws.between) {
|
||||
const lastCommentIndex = declaration.raws.between.lastIndexOf("/*");
|
||||
const matched = declaration.raws.between.slice(lastCommentIndex).match(WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
if (matched) {
|
||||
inBetween = matched[2] === "true";
|
||||
}
|
||||
}
|
||||
let isIgnoreOnDeclaration = false;
|
||||
const prevNode = declaration.prev();
|
||||
if (prevNode && prevNode.type === "comment") {
|
||||
const matched = prevNode.text.match(WEBPACK_IGNORE_COMMENT_REGEXP);
|
||||
if (matched) {
|
||||
isIgnoreOnDeclaration = matched[2] === "true";
|
||||
}
|
||||
}
|
||||
let needIgnore;
|
||||
const parsedURLs = [];
|
||||
parsed.walk((valueNode, index, valueNodes)=>{
|
||||
if (valueNode.type !== "function") {
|
||||
return;
|
||||
}
|
||||
if (isUrlFunc.test(valueNode.value)) {
|
||||
needIgnore = getWebpackIgnoreCommentValue(index, valueNodes, inBetween);
|
||||
if (isIgnoreOnDeclaration && typeof needIgnore === "undefined" || needIgnore) {
|
||||
if (needIgnore) {
|
||||
// eslint-disable-next-line no-undefined
|
||||
needIgnore = undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const { nodes } = valueNode;
|
||||
const isStringValue = nodes.length !== 0 && nodes[0].type === "string";
|
||||
let url = isStringValue ? nodes[0].value : valueParser.stringify(nodes);
|
||||
url = normalizeUrl(url, isStringValue);
|
||||
// Do not traverse inside `url`
|
||||
if (!shouldHandleURL(url, declaration, result, isSupportDataURLInNewURL)) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return false;
|
||||
}
|
||||
const queryParts = url.split("!");
|
||||
let prefix;
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
parsedURLs.push({
|
||||
declaration,
|
||||
parsed,
|
||||
node: getNodeFromUrlFunc(valueNode),
|
||||
prefix,
|
||||
url,
|
||||
needQuotes: false
|
||||
});
|
||||
// eslint-disable-next-line consistent-return
|
||||
return false;
|
||||
} else if (isImageSetFunc.test(valueNode.value)) {
|
||||
for (const [innerIndex, nNode] of valueNode.nodes.entries()){
|
||||
const { type, value } = nNode;
|
||||
if (type === "function" && isUrlFunc.test(value)) {
|
||||
needIgnore = getWebpackIgnoreCommentValue(innerIndex, valueNode.nodes);
|
||||
if (isIgnoreOnDeclaration && typeof needIgnore === "undefined" || needIgnore) {
|
||||
if (needIgnore) {
|
||||
// eslint-disable-next-line no-undefined
|
||||
needIgnore = undefined;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const { nodes } = nNode;
|
||||
const isStringValue = nodes.length !== 0 && nodes[0].type === "string";
|
||||
let url = isStringValue ? nodes[0].value : valueParser.stringify(nodes);
|
||||
url = normalizeUrl(url, isStringValue);
|
||||
// Do not traverse inside `url`
|
||||
if (!shouldHandleURL(url, declaration, result, isSupportDataURLInNewURL)) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return false;
|
||||
}
|
||||
const queryParts = url.split("!");
|
||||
let prefix;
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
parsedURLs.push({
|
||||
declaration,
|
||||
parsed,
|
||||
node: getNodeFromUrlFunc(nNode),
|
||||
prefix,
|
||||
url,
|
||||
needQuotes: false
|
||||
});
|
||||
} else if (type === "string") {
|
||||
needIgnore = getWebpackIgnoreCommentValue(innerIndex, valueNode.nodes);
|
||||
if (isIgnoreOnDeclaration && typeof needIgnore === "undefined" || needIgnore) {
|
||||
if (needIgnore) {
|
||||
// eslint-disable-next-line no-undefined
|
||||
needIgnore = undefined;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let url = normalizeUrl(value, true);
|
||||
// Do not traverse inside `url`
|
||||
if (!shouldHandleURL(url, declaration, result, isSupportDataURLInNewURL)) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return false;
|
||||
}
|
||||
const queryParts = url.split("!");
|
||||
let prefix;
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
parsedURLs.push({
|
||||
declaration,
|
||||
parsed,
|
||||
node: nNode,
|
||||
prefix,
|
||||
url,
|
||||
needQuotes: true
|
||||
});
|
||||
}
|
||||
}
|
||||
// Do not traverse inside `image-set`
|
||||
// eslint-disable-next-line consistent-return
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// eslint-disable-next-line consistent-return
|
||||
return parsedURLs;
|
||||
}
|
||||
const plugin = (options = {})=>{
|
||||
return {
|
||||
postcssPlugin: "postcss-url-parser",
|
||||
prepare (result) {
|
||||
const parsedDeclarations = [];
|
||||
return {
|
||||
Declaration (declaration) {
|
||||
const { isSupportDataURLInNewURL } = options;
|
||||
const parsedURL = parseDeclaration(declaration, "value", result, isSupportDataURLInNewURL);
|
||||
if (!parsedURL) {
|
||||
return;
|
||||
}
|
||||
parsedDeclarations.push(...parsedURL);
|
||||
},
|
||||
async OnceExit () {
|
||||
if (parsedDeclarations.length === 0) {
|
||||
return;
|
||||
}
|
||||
const resolvedDeclarations = await Promise.all(parsedDeclarations.map(async (parsedDeclaration)=>{
|
||||
const { url } = parsedDeclaration;
|
||||
if (options.filter) {
|
||||
const needKeep = await options.filter(url);
|
||||
if (!needKeep) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (isDataUrl(url)) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return parsedDeclaration;
|
||||
}
|
||||
const [pathname, query, hashOrQuery] = url.split(/(\?)?#/, 3);
|
||||
let hash = query ? "?" : "";
|
||||
hash += hashOrQuery ? `#${hashOrQuery}` : "";
|
||||
const { needToResolveURL, rootContext } = options;
|
||||
const request = requestify(pathname, rootContext, // @ts-expect-error TODO: only 2 arguments allowed.
|
||||
needToResolveURL);
|
||||
if (!needToResolveURL) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return {
|
||||
...parsedDeclaration,
|
||||
url: request,
|
||||
hash
|
||||
};
|
||||
}
|
||||
const { resolver, context } = options;
|
||||
const resolvedUrl = await resolveRequests(resolver, context, [
|
||||
...new Set([
|
||||
request,
|
||||
url
|
||||
])
|
||||
]);
|
||||
if (!resolvedUrl) {
|
||||
// eslint-disable-next-line consistent-return
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line consistent-return
|
||||
return {
|
||||
...parsedDeclaration,
|
||||
url: resolvedUrl,
|
||||
hash
|
||||
};
|
||||
}));
|
||||
const urlToNameMap = new Map();
|
||||
const urlToReplacementMap = new Map();
|
||||
let hasUrlImportHelper = false;
|
||||
for(let index = 0; index <= resolvedDeclarations.length - 1; index++){
|
||||
const item = resolvedDeclarations[index];
|
||||
if (!item) {
|
||||
continue;
|
||||
}
|
||||
if (!hasUrlImportHelper) {
|
||||
options.imports.push({
|
||||
type: "get_url_import",
|
||||
importName: "___CSS_LOADER_GET_URL_IMPORT___",
|
||||
url: options.urlHandler(require.resolve("../runtime/getUrl.js")),
|
||||
index: -1
|
||||
});
|
||||
hasUrlImportHelper = true;
|
||||
}
|
||||
const { url, prefix } = item;
|
||||
const newUrl = prefix ? `${prefix}!${url}` : url;
|
||||
let importName = urlToNameMap.get(newUrl);
|
||||
if (!importName) {
|
||||
importName = `___CSS_LOADER_URL_IMPORT_${urlToNameMap.size}___`;
|
||||
urlToNameMap.set(newUrl, importName);
|
||||
options.imports.push({
|
||||
type: "url",
|
||||
importName,
|
||||
url: options.needToResolveURL ? options.urlHandler(newUrl) : JSON.stringify(newUrl),
|
||||
index
|
||||
});
|
||||
}
|
||||
const { hash, needQuotes } = item;
|
||||
const replacementKey = JSON.stringify({
|
||||
newUrl,
|
||||
hash,
|
||||
needQuotes
|
||||
});
|
||||
let replacementName = urlToReplacementMap.get(replacementKey);
|
||||
if (!replacementName) {
|
||||
replacementName = `___CSS_LOADER_URL_REPLACEMENT_${urlToReplacementMap.size}___`;
|
||||
urlToReplacementMap.set(replacementKey, replacementName);
|
||||
options.replacements.push({
|
||||
replacementName,
|
||||
importName,
|
||||
hash,
|
||||
needQuotes
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
item.node.type = "word";
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
item.node.value = replacementName;
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
item.declaration.value = item.parsed.toString();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
plugin.postcss = true;
|
||||
export default plugin;
|
||||
|
||||
//# sourceMappingURL=postcss-url-parser.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-url-parser.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/plugins/postcss-url-parser.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
90
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/runtime/api.js
generated
vendored
Normal file
90
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/runtime/api.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/ // css base code, injected by the css-loader
|
||||
// eslint-disable-next-line func-names
|
||||
module.exports = function(useSourceMap) {
|
||||
var list = [] // return the list of modules as css string
|
||||
;
|
||||
list.toString = function toString() {
|
||||
return this.map(function(item) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
var content = cssWithMappingToString(item, useSourceMap);
|
||||
if (item[2]) {
|
||||
return "@media ".concat(item[2], " {").concat(content, "}");
|
||||
}
|
||||
return content;
|
||||
}).join("");
|
||||
} // import a list of modules into the list
|
||||
;
|
||||
// eslint-disable-next-line func-names
|
||||
// @ts-expect-error TODO: fix type
|
||||
list.i = function(modules, mediaQuery, dedupe) {
|
||||
if (typeof modules === "string") {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
modules = [
|
||||
[
|
||||
null,
|
||||
modules,
|
||||
""
|
||||
]
|
||||
];
|
||||
}
|
||||
var alreadyImportedModules = {};
|
||||
if (dedupe) {
|
||||
for(var i = 0; i < this.length; i++){
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
var id = this[i][0];
|
||||
if (id != null) {
|
||||
alreadyImportedModules[id] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var _i = 0; _i < modules.length; _i++){
|
||||
var item = [].concat(modules[_i]);
|
||||
if (dedupe && alreadyImportedModules[item[0]]) {
|
||||
continue;
|
||||
}
|
||||
if (mediaQuery) {
|
||||
if (!item[2]) {
|
||||
item[2] = mediaQuery;
|
||||
} else {
|
||||
item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
|
||||
}
|
||||
}
|
||||
list.push(item);
|
||||
}
|
||||
};
|
||||
return list;
|
||||
};
|
||||
function cssWithMappingToString(item, useSourceMap) {
|
||||
var content = item[1] || "" // eslint-disable-next-line prefer-destructuring
|
||||
;
|
||||
var cssMapping = item[3];
|
||||
if (!cssMapping) {
|
||||
return content;
|
||||
}
|
||||
if (useSourceMap && typeof btoa === "function") {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
var sourceMapping = toComment(cssMapping);
|
||||
var sourceURLs = cssMapping.sources.map(function(source) {
|
||||
return "/*# sourceURL=".concat(cssMapping.sourceRoot || "").concat(source, " */");
|
||||
});
|
||||
return [
|
||||
content
|
||||
].concat(sourceURLs).concat([
|
||||
sourceMapping
|
||||
]).join("\n");
|
||||
}
|
||||
return [
|
||||
content
|
||||
].join("\n");
|
||||
} // Adapted from convert-source-map (MIT)
|
||||
function toComment(sourceMap) {
|
||||
// eslint-disable-next-line no-undef
|
||||
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
|
||||
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
|
||||
return "/*# ".concat(data, " */");
|
||||
}
|
||||
|
||||
//# sourceMappingURL=api.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/runtime/api.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/runtime/api.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../../src/build/webpack/loaders/css-loader/src/runtime/api.ts"],"names":["module","exports","useSourceMap","list","toString","map","item","content","cssWithMappingToString","concat","join","i","modules","mediaQuery","dedupe","alreadyImportedModules","length","id","_i","push","cssMapping","btoa","sourceMapping","toComment","sourceURLs","sources","source","sourceRoot","sourceMap","base64","unescape","encodeURIComponent","JSON","stringify","data"],"mappings":"AAAA;;;AAGA,GACA,4CAA4C;AAC5C,sCAAsC;AACtCA,OAAOC,OAAO,GAAG,SAAUC,YAAiB;IAC1C,IAAIC,OAAc,EAAE,CAAC,2CAA2C;;IAEhEA,KAAKC,QAAQ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;IAEA,OAAOH;AACT;AAEA,SAASK,uBAAuBF,IAAS,EAAEJ,YAAiB;IAC1D,IAAIK,UAAUD,IAAI,CAAC,EAAE,IAAI,GAAG,gDAAgD;;IAE5E,IAAIc,aAAad,IAAI,CAAC,EAAE;IAExB,IAAI,CAACc,YAAY;QACf,OAAOb;IACT;IAEA,IAAIL,gBAAgB,OAAOmB,SAAS,YAAY;QAC9C,mEAAmE;QACnE,IAAIC,gBAAgBC,UAAUH;QAC9B,IAAII,aAAaJ,WAAWK,OAAO,CAACpB,GAAG,CAAC,SAAUqB,MAAc;YAC9D,OAAO,iBACJjB,MAAM,CAACW,WAAWO,UAAU,IAAI,IAChClB,MAAM,CAACiB,QAAQ;QACpB;QACA,OAAO;YAACnB;SAAQ,CAACE,MAAM,CAACe,YAAYf,MAAM,CAAC;YAACa;SAAc,EAAEZ,IAAI,CAAC;IACnE;IAEA,OAAO;QAACH;KAAQ,CAACG,IAAI,CAAC;AACxB,EAAE,wCAAwC;AAE1C,SAASa,UAAUK,SAAc;IAC/B,oCAAoC;IACpC,IAAIC,SAASR,KAAKS,SAASC,mBAAmBC,KAAKC,SAAS,CAACL;IAC7D,IAAIM,OACF,+DAA+DzB,MAAM,CACnEoB;IAEJ,OAAO,OAAOpB,MAAM,CAACyB,MAAM;AAC7B"}
|
||||
25
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/runtime/getUrl.js
generated
vendored
Normal file
25
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/runtime/getUrl.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
module.exports = function(url, options) {
|
||||
if (!options) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
options = {};
|
||||
} // eslint-disable-next-line no-underscore-dangle, no-param-reassign
|
||||
url = url && url.__esModule ? url.default : url;
|
||||
if (typeof url !== "string") {
|
||||
return url;
|
||||
} // If url is already wrapped in quotes, remove them
|
||||
if (/^['"].*['"]$/.test(url)) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url = url.slice(1, -1);
|
||||
}
|
||||
if (options.hash) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
url += options.hash;
|
||||
} // Should url be wrapped?
|
||||
// See https://drafts.csswg.org/css-values-3/#urls
|
||||
if (/["'() \t\n]/.test(url) || options.needQuotes) {
|
||||
return '"'.concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), '"');
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=getUrl.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/runtime/getUrl.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/runtime/getUrl.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../../src/build/webpack/loaders/css-loader/src/runtime/getUrl.ts"],"names":["module","exports","url","options","__esModule","default","test","slice","hash","needQuotes","concat","replace"],"mappings":"AAAAA,OAAOC,OAAO,GAAG,SAAUC,GAAQ,EAAEC,OAAY;IAC/C,IAAI,CAACA,SAAS;QACZ,6CAA6C;QAC7CA,UAAU,CAAC;IACb,EAAE,mEAAmE;IAErED,MAAMA,OAAOA,IAAIE,UAAU,GAAGF,IAAIG,OAAO,GAAGH;IAE5C,IAAI,OAAOA,QAAQ,UAAU;QAC3B,OAAOA;IACT,EAAE,mDAAmD;IAErD,IAAI,eAAeI,IAAI,CAACJ,MAAM;QAC5B,6CAA6C;QAC7CA,MAAMA,IAAIK,KAAK,CAAC,GAAG,CAAC;IACtB;IAEA,IAAIJ,QAAQK,IAAI,EAAE;QAChB,6CAA6C;QAC7CN,OAAOC,QAAQK,IAAI;IACrB,EAAE,yBAAyB;IAC3B,kDAAkD;IAElD,IAAI,cAAcF,IAAI,CAACJ,QAAQC,QAAQM,UAAU,EAAE;QACjD,OAAO,IAAIC,MAAM,CAACR,IAAIS,OAAO,CAAC,MAAM,OAAOA,OAAO,CAAC,OAAO,QAAQ;IACpE;IAEA,OAAOT;AACT"}
|
||||
369
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/utils.js
generated
vendored
Normal file
369
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/utils.js
generated
vendored
Normal file
@ -0,0 +1,369 @@
|
||||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/ import { fileURLToPath } from "url";
|
||||
import path from "path";
|
||||
import { urlToRequest } from "next/dist/compiled/loader-utils3";
|
||||
import modulesValues from "next/dist/compiled/postcss-modules-values";
|
||||
import localByDefault from "next/dist/compiled/postcss-modules-local-by-default";
|
||||
import extractImports from "next/dist/compiled/postcss-modules-extract-imports";
|
||||
import modulesScope from "next/dist/compiled/postcss-modules-scope";
|
||||
import camelCase from "./camelcase";
|
||||
const whitespace = "[\\x20\\t\\r\\n\\f]";
|
||||
const unescapeRegExp = new RegExp(`\\\\([\\da-f]{1,6}${whitespace}?|(${whitespace})|.)`, "ig");
|
||||
const matchNativeWin32Path = /^[A-Z]:[/\\]|^\\\\/i;
|
||||
function unescape(str) {
|
||||
return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace)=>{
|
||||
const high = `0x${escaped}` - 0x10000;
|
||||
/* eslint-disable line-comment-position */ // NaN means non-codepoint
|
||||
// Workaround erroneous numeric interpretation of +"0x"
|
||||
// eslint-disable-next-line no-self-compare
|
||||
return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 0x10000) : // eslint-disable-next-line no-bitwise
|
||||
String.fromCharCode(high >> 10 | 0xd800, high & 0x3ff | 0xdc00);
|
||||
/* eslint-enable line-comment-position */ });
|
||||
}
|
||||
function normalizePath(file) {
|
||||
return path.sep === "\\" ? file.replace(/\\/g, "/") : file;
|
||||
}
|
||||
function fixedEncodeURIComponent(str) {
|
||||
return str.replace(/[!'()*]/g, (c)=>`%${c.charCodeAt(0).toString(16)}`);
|
||||
}
|
||||
function normalizeUrl(url, isStringValue) {
|
||||
let normalizedUrl = url;
|
||||
if (isStringValue && /\\(\n|\r\n|\r|\f)/.test(normalizedUrl)) {
|
||||
normalizedUrl = normalizedUrl.replace(/\\(\n|\r\n|\r|\f)/g, "");
|
||||
}
|
||||
if (matchNativeWin32Path.test(url)) {
|
||||
try {
|
||||
normalizedUrl = decodeURIComponent(normalizedUrl);
|
||||
} catch (error) {
|
||||
// Ignores invalid and broken URLs and try to resolve them as is
|
||||
}
|
||||
return normalizedUrl;
|
||||
}
|
||||
normalizedUrl = unescape(normalizedUrl);
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
if (isDataUrl(url)) {
|
||||
return fixedEncodeURIComponent(normalizedUrl);
|
||||
}
|
||||
try {
|
||||
normalizedUrl = decodeURI(normalizedUrl);
|
||||
} catch (error) {
|
||||
// Ignores invalid and broken URLs and try to resolve them as is
|
||||
}
|
||||
return normalizedUrl;
|
||||
}
|
||||
function requestify(url, rootContext) {
|
||||
if (/^file:/i.test(url)) {
|
||||
return fileURLToPath(url);
|
||||
}
|
||||
if (/^[a-z][a-z0-9+.-]*:/i.test(url)) {
|
||||
return url;
|
||||
}
|
||||
return url.charAt(0) === "/" ? urlToRequest(url, rootContext) : urlToRequest(url);
|
||||
}
|
||||
function getFilter(filter, resourcePath) {
|
||||
return (...args)=>{
|
||||
if (typeof filter === "function") {
|
||||
return filter(...args, resourcePath);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
function shouldUseImportPlugin(options) {
|
||||
if (options.modules.exportOnlyLocals) {
|
||||
return false;
|
||||
}
|
||||
if (typeof options.import === "boolean") {
|
||||
return options.import;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function shouldUseURLPlugin(options) {
|
||||
if (options.modules.exportOnlyLocals) {
|
||||
return false;
|
||||
}
|
||||
if (typeof options.url === "boolean") {
|
||||
return options.url;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function shouldUseModulesPlugins(options) {
|
||||
return options.modules.compileType === "module";
|
||||
}
|
||||
function shouldUseIcssPlugin(options) {
|
||||
return options.icss === true || Boolean(options.modules);
|
||||
}
|
||||
function getModulesPlugins(options, loaderContext, meta) {
|
||||
const { mode, getLocalIdent, localIdentName, localIdentContext, localIdentHashPrefix, localIdentRegExp } = options.modules;
|
||||
let plugins = [];
|
||||
try {
|
||||
plugins = [
|
||||
modulesValues,
|
||||
localByDefault({
|
||||
mode
|
||||
}),
|
||||
extractImports(),
|
||||
modulesScope({
|
||||
generateScopedName (exportName) {
|
||||
return getLocalIdent(loaderContext, localIdentName, exportName, {
|
||||
context: localIdentContext,
|
||||
hashPrefix: localIdentHashPrefix,
|
||||
regExp: localIdentRegExp
|
||||
}, meta);
|
||||
},
|
||||
exportGlobals: options.modules.exportGlobals
|
||||
})
|
||||
];
|
||||
} catch (error) {
|
||||
loaderContext.emitError(error);
|
||||
}
|
||||
return plugins;
|
||||
}
|
||||
const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
|
||||
const ABSOLUTE_SCHEME = /^[a-z0-9+\-.]+:/i;
|
||||
function getURLType(source) {
|
||||
if (source[0] === "/") {
|
||||
if (source[1] === "/") {
|
||||
return "scheme-relative";
|
||||
}
|
||||
return "path-absolute";
|
||||
}
|
||||
if (IS_NATIVE_WIN32_PATH.test(source)) {
|
||||
return "path-absolute";
|
||||
}
|
||||
return ABSOLUTE_SCHEME.test(source) ? "absolute" : "path-relative";
|
||||
}
|
||||
function normalizeSourceMap(map, resourcePath) {
|
||||
let newMap = map;
|
||||
// Some loader emit source map as string
|
||||
// Strip any JSON XSSI avoidance prefix from the string (as documented in the source maps specification), and then parse the string as JSON.
|
||||
if (typeof newMap === "string") {
|
||||
newMap = JSON.parse(newMap);
|
||||
}
|
||||
delete newMap.file;
|
||||
const { sourceRoot } = newMap;
|
||||
delete newMap.sourceRoot;
|
||||
if (newMap.sources) {
|
||||
// Source maps should use forward slash because it is URLs (https://github.com/mozilla/source-map/issues/91)
|
||||
// We should normalize path because previous loaders like `sass-loader` using backslash when generate source map
|
||||
newMap.sources = newMap.sources.map((source)=>{
|
||||
// Non-standard syntax from `postcss`
|
||||
if (source.indexOf("<") === 0) {
|
||||
return source;
|
||||
}
|
||||
const sourceType = getURLType(source);
|
||||
// Do no touch `scheme-relative` and `absolute` URLs
|
||||
if (sourceType === "path-relative" || sourceType === "path-absolute") {
|
||||
const absoluteSource = sourceType === "path-relative" && sourceRoot ? path.resolve(sourceRoot, normalizePath(source)) : normalizePath(source);
|
||||
return path.relative(path.dirname(resourcePath), absoluteSource);
|
||||
}
|
||||
return source;
|
||||
});
|
||||
}
|
||||
return newMap;
|
||||
}
|
||||
function getPreRequester({ loaders, loaderIndex }) {
|
||||
const cache = Object.create(null);
|
||||
return (number)=>{
|
||||
if (cache[number]) {
|
||||
return cache[number];
|
||||
}
|
||||
if (number === false) {
|
||||
cache[number] = "";
|
||||
} else {
|
||||
const loadersRequest = loaders.slice(loaderIndex, loaderIndex + 1 + (typeof number !== "number" ? 0 : number)).map((x)=>x.request).join("!");
|
||||
cache[number] = `-!${loadersRequest}!`;
|
||||
}
|
||||
return cache[number];
|
||||
};
|
||||
}
|
||||
function getImportCode(imports, options) {
|
||||
let code = "";
|
||||
for (const item of imports){
|
||||
const { importName, url, icss } = item;
|
||||
if (options.esModule) {
|
||||
if (icss && options.modules.namedExport) {
|
||||
code += `import ${options.modules.exportOnlyLocals ? "" : `${importName}, `}* as ${importName}_NAMED___ from ${url};\n`;
|
||||
} else {
|
||||
code += `import ${importName} from ${url};\n`;
|
||||
}
|
||||
} else {
|
||||
code += `var ${importName} = require(${url});\n`;
|
||||
}
|
||||
}
|
||||
return code ? `// Imports\n${code}` : "";
|
||||
}
|
||||
function normalizeSourceMapForRuntime(map, loaderContext) {
|
||||
const resultMap = map ? map.toJSON() : null;
|
||||
if (resultMap) {
|
||||
delete resultMap.file;
|
||||
resultMap.sourceRoot = "";
|
||||
resultMap.sources = resultMap.sources.map((source)=>{
|
||||
// Non-standard syntax from `postcss`
|
||||
if (source.indexOf("<") === 0) {
|
||||
return source;
|
||||
}
|
||||
const sourceType = getURLType(source);
|
||||
if (sourceType !== "path-relative") {
|
||||
return source;
|
||||
}
|
||||
const resourceDirname = path.dirname(loaderContext.resourcePath);
|
||||
const absoluteSource = path.resolve(resourceDirname, source);
|
||||
const contextifyPath = normalizePath(path.relative(loaderContext.rootContext, absoluteSource));
|
||||
return `webpack://${contextifyPath}`;
|
||||
});
|
||||
}
|
||||
return JSON.stringify(resultMap);
|
||||
}
|
||||
function getModuleCode(result, api, replacements, options, loaderContext) {
|
||||
if (options.modules.exportOnlyLocals === true) {
|
||||
return "";
|
||||
}
|
||||
const sourceMapValue = options.sourceMap ? `,${normalizeSourceMapForRuntime(result.map, loaderContext)}` : "";
|
||||
let code = JSON.stringify(result.css);
|
||||
let beforeCode = `var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${options.sourceMap});\n`;
|
||||
for (const item of api){
|
||||
const { url, media, dedupe } = item;
|
||||
beforeCode += url ? `___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(`@import url(${url});`)}${media ? `, ${JSON.stringify(media)}` : ""}]);\n` : `___CSS_LOADER_EXPORT___.i(${item.importName}${media ? `, ${JSON.stringify(media)}` : dedupe ? ', ""' : ""}${dedupe ? ", true" : ""});\n`;
|
||||
}
|
||||
for (const item of replacements){
|
||||
const { replacementName, importName, localName } = item;
|
||||
if (localName) {
|
||||
code = code.replace(new RegExp(replacementName, "g"), ()=>options.modules.namedExport ? `" + ${importName}_NAMED___[${JSON.stringify(camelCase(localName))}] + "` : `" + ${importName}.locals[${JSON.stringify(localName)}] + "`);
|
||||
} else {
|
||||
const { hash, needQuotes } = item;
|
||||
const getUrlOptions = [
|
||||
...hash ? [
|
||||
`hash: ${JSON.stringify(hash)}`
|
||||
] : [],
|
||||
...needQuotes ? "needQuotes: true" : []
|
||||
];
|
||||
const preparedOptions = getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(", ")} }` : "";
|
||||
beforeCode += `var ${replacementName} = ___CSS_LOADER_GET_URL_IMPORT___(${importName}${preparedOptions});\n`;
|
||||
code = code.replace(new RegExp(replacementName, "g"), ()=>`" + ${replacementName} + "`);
|
||||
}
|
||||
}
|
||||
return `${beforeCode}// Module\n___CSS_LOADER_EXPORT___.push([module.id, ${code}, ""${sourceMapValue}]);\n`;
|
||||
}
|
||||
function dashesCamelCase(str) {
|
||||
return str.replace(/-+(\w)/g, (_match, firstLetter)=>firstLetter.toUpperCase());
|
||||
}
|
||||
function getExportCode(exports, replacements, options) {
|
||||
let code = "// Exports\n";
|
||||
let localsCode = "";
|
||||
const addExportToLocalsCode = (name, value)=>{
|
||||
if (options.modules.namedExport) {
|
||||
localsCode += `export const ${camelCase(name)} = ${JSON.stringify(value)};\n`;
|
||||
} else {
|
||||
if (localsCode) {
|
||||
localsCode += `,\n`;
|
||||
}
|
||||
localsCode += `\t${JSON.stringify(name)}: ${JSON.stringify(value)}`;
|
||||
}
|
||||
};
|
||||
for (const { name, value } of exports){
|
||||
switch(options.modules.exportLocalsConvention){
|
||||
case "camelCase":
|
||||
{
|
||||
addExportToLocalsCode(name, value);
|
||||
const modifiedName = camelCase(name);
|
||||
if (modifiedName !== name) {
|
||||
addExportToLocalsCode(modifiedName, value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "camelCaseOnly":
|
||||
{
|
||||
addExportToLocalsCode(camelCase(name), value);
|
||||
break;
|
||||
}
|
||||
case "dashes":
|
||||
{
|
||||
addExportToLocalsCode(name, value);
|
||||
const modifiedName = dashesCamelCase(name);
|
||||
if (modifiedName !== name) {
|
||||
addExportToLocalsCode(modifiedName, value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "dashesOnly":
|
||||
{
|
||||
addExportToLocalsCode(dashesCamelCase(name), value);
|
||||
break;
|
||||
}
|
||||
case "asIs":
|
||||
default:
|
||||
addExportToLocalsCode(name, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const item of replacements){
|
||||
const { replacementName, localName } = item;
|
||||
if (localName) {
|
||||
const { importName } = item;
|
||||
localsCode = localsCode.replace(new RegExp(replacementName, "g"), ()=>{
|
||||
if (options.modules.namedExport) {
|
||||
return `" + ${importName}_NAMED___[${JSON.stringify(camelCase(localName))}] + "`;
|
||||
} else if (options.modules.exportOnlyLocals) {
|
||||
return `" + ${importName}[${JSON.stringify(localName)}] + "`;
|
||||
}
|
||||
return `" + ${importName}.locals[${JSON.stringify(localName)}] + "`;
|
||||
});
|
||||
} else {
|
||||
localsCode = localsCode.replace(new RegExp(replacementName, "g"), ()=>`" + ${replacementName} + "`);
|
||||
}
|
||||
}
|
||||
if (options.modules.exportOnlyLocals) {
|
||||
code += options.modules.namedExport ? localsCode : `${options.esModule ? "export default" : "module.exports ="} {\n${localsCode}\n};\n`;
|
||||
return code;
|
||||
}
|
||||
if (localsCode) {
|
||||
code += options.modules.namedExport ? localsCode : `___CSS_LOADER_EXPORT___.locals = {\n${localsCode}\n};\n`;
|
||||
}
|
||||
code += `${options.esModule ? "export default" : "module.exports ="} ___CSS_LOADER_EXPORT___;\n`;
|
||||
return code;
|
||||
}
|
||||
async function resolveRequests(resolve, context, possibleRequests) {
|
||||
return resolve(context, possibleRequests[0]).then((result)=>{
|
||||
return result;
|
||||
}).catch((error)=>{
|
||||
const [, ...tailPossibleRequests] = possibleRequests;
|
||||
if (tailPossibleRequests.length === 0) {
|
||||
throw error;
|
||||
}
|
||||
return resolveRequests(resolve, context, tailPossibleRequests);
|
||||
});
|
||||
}
|
||||
function isUrlRequestable(url) {
|
||||
// Protocol-relative URLs
|
||||
if (/^\/\//.test(url)) {
|
||||
return false;
|
||||
}
|
||||
// `file:` protocol
|
||||
if (/^file:/i.test(url)) {
|
||||
return true;
|
||||
}
|
||||
// Absolute URLs
|
||||
if (/^[a-z][a-z0-9+.-]*:/i.test(url)) {
|
||||
return true;
|
||||
}
|
||||
// `#` URLs
|
||||
if (/^#/.test(url)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function sort(a, b) {
|
||||
return a.index - b.index;
|
||||
}
|
||||
function isDataUrl(url) {
|
||||
if (/^data:/i.test(url)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
export { isDataUrl, shouldUseModulesPlugins, shouldUseImportPlugin, shouldUseURLPlugin, shouldUseIcssPlugin, normalizeUrl, requestify, getFilter, getModulesPlugins, normalizeSourceMap, getPreRequester, getImportCode, getModuleCode, getExportCode, resolveRequests, isUrlRequestable, sort, // For lightningcss-loader
|
||||
normalizeSourceMapForRuntime, dashesCamelCase, };
|
||||
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/utils.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/css-loader/src/utils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/next/dist/esm/build/webpack/loaders/empty-loader.js
generated
vendored
Normal file
4
node_modules/next/dist/esm/build/webpack/loaders/empty-loader.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
const EmptyLoader = ()=>"export default {}";
|
||||
export default EmptyLoader;
|
||||
|
||||
//# sourceMappingURL=empty-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/empty-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/empty-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/empty-loader.ts"],"names":["EmptyLoader"],"mappings":"AAEA,MAAMA,cAAgD,IAAM;AAC5D,eAAeA,YAAW"}
|
||||
17
node_modules/next/dist/esm/build/webpack/loaders/error-loader.js
generated
vendored
Normal file
17
node_modules/next/dist/esm/build/webpack/loaders/error-loader.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
import { cyan } from "../../../lib/picocolors";
|
||||
import path from "path";
|
||||
const ErrorLoader = function() {
|
||||
var _this__module_issuer, _this__module, _this__compiler;
|
||||
// @ts-ignore exists
|
||||
const options = this.getOptions() || {};
|
||||
const { reason = "An unknown error has occurred" } = options;
|
||||
// @ts-expect-error
|
||||
const resource = ((_this__module = this._module) == null ? void 0 : (_this__module_issuer = _this__module.issuer) == null ? void 0 : _this__module_issuer.resource) ?? null;
|
||||
const context = this.rootContext ?? ((_this__compiler = this._compiler) == null ? void 0 : _this__compiler.context);
|
||||
const issuer = resource ? context ? path.relative(context, resource) : resource : null;
|
||||
const err = new Error(reason + (issuer ? `\nLocation: ${cyan(issuer)}` : ""));
|
||||
this.emitError(err);
|
||||
};
|
||||
export default ErrorLoader;
|
||||
|
||||
//# sourceMappingURL=error-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/error-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/error-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/error-loader.ts"],"names":["cyan","path","ErrorLoader","options","getOptions","reason","resource","_module","issuer","context","rootContext","_compiler","relative","err","Error","emitError"],"mappings":"AAAA,SAASA,IAAI,QAAQ,0BAAyB;AAC9C,OAAOC,UAAU,OAAM;AAGvB,MAAMC,cAAgD;QAOnC,sBAAA,eACmB;IAPpC,oBAAoB;IACpB,MAAMC,UAAU,IAAI,CAACC,UAAU,MAAO,CAAC;IAEvC,MAAM,EAAEC,SAAS,+BAA+B,EAAE,GAAGF;IAErD,mBAAmB;IACnB,MAAMG,WAAW,EAAA,gBAAA,IAAI,CAACC,OAAO,sBAAZ,uBAAA,cAAcC,MAAM,qBAApB,qBAAsBF,QAAQ,KAAI;IACnD,MAAMG,UAAU,IAAI,CAACC,WAAW,MAAI,kBAAA,IAAI,CAACC,SAAS,qBAAd,gBAAgBF,OAAO;IAE3D,MAAMD,SAASF,WACXG,UACER,KAAKW,QAAQ,CAACH,SAASH,YACvBA,WACF;IAEJ,MAAMO,MAAM,IAAIC,MAAMT,SAAUG,CAAAA,SAAS,CAAC,YAAY,EAAER,KAAKQ,QAAQ,CAAC,GAAG,EAAC;IAC1E,IAAI,CAACO,SAAS,CAACF;AACjB;AAEA,eAAeX,YAAW"}
|
||||
8
node_modules/next/dist/esm/build/webpack/loaders/get-module-build-info.js
generated
vendored
Normal file
8
node_modules/next/dist/esm/build/webpack/loaders/get-module-build-info.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* A getter for module build info that casts to the type it should have.
|
||||
* We also expose here types to make easier to use it.
|
||||
*/ export function getModuleBuildInfo(webpackModule) {
|
||||
return webpackModule.buildInfo;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-module-build-info.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/get-module-build-info.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/get-module-build-info.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/get-module-build-info.ts"],"names":["getModuleBuildInfo","webpackModule","buildInfo"],"mappings":"AAoBA;;;CAGC,GACD,OAAO,SAASA,mBAAmBC,aAA6B;IAC9D,OAAOA,cAAcC,SAAS;AAChC"}
|
||||
125
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/codegen.js
generated
vendored
Normal file
125
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/codegen.js
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
import camelCase from "../../css-loader/src/camelcase";
|
||||
import { dashesCamelCase, normalizeSourceMapForRuntime } from "../../css-loader/src/utils";
|
||||
export function getImportCode(imports, options) {
|
||||
let code = "";
|
||||
for (const item of imports){
|
||||
const { importName, url, icss } = item;
|
||||
if (options.esModule) {
|
||||
if (icss && options.modules.namedExport) {
|
||||
code += `import ${options.modules.exportOnlyLocals ? "" : `${importName}, `}* as ${importName}_NAMED___ from ${url};\n`;
|
||||
} else {
|
||||
code += `import ${importName} from ${url};\n`;
|
||||
}
|
||||
} else {
|
||||
code += `var ${importName} = require(${url});\n`;
|
||||
}
|
||||
}
|
||||
return code ? `// Imports\n${code}` : "";
|
||||
}
|
||||
export function getModuleCode(result, api, replacements, options, loaderContext) {
|
||||
if (options.modules.exportOnlyLocals === true) {
|
||||
return "";
|
||||
}
|
||||
const sourceMapValue = options.sourceMap ? `,${normalizeSourceMapForRuntime(result.map, loaderContext)}` : "";
|
||||
let code = JSON.stringify(result.css);
|
||||
let beforeCode = `var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(${options.sourceMap});\n`;
|
||||
for (const item of api){
|
||||
const { url, media, dedupe } = item;
|
||||
beforeCode += url ? `___CSS_LOADER_EXPORT___.push([module.id, ${JSON.stringify(`@import url(${url});`)}${media ? `, ${JSON.stringify(media)}` : ""}]);\n` : `___CSS_LOADER_EXPORT___.i(${item.importName}${media ? `, ${JSON.stringify(media)}` : dedupe ? ', ""' : ""}${dedupe ? ", true" : ""});\n`;
|
||||
}
|
||||
for (const item of replacements){
|
||||
const { replacementName, importName, localName } = item;
|
||||
if (localName) {
|
||||
code = code.replace(new RegExp(replacementName, "g"), ()=>options.modules.namedExport ? `" + ${importName}_NAMED___[${JSON.stringify(camelCase(localName))}] + "` : `" + ${importName}.locals[${JSON.stringify(localName)}] + "`);
|
||||
} else {
|
||||
const { hash, needQuotes } = item;
|
||||
const getUrlOptions = [
|
||||
...hash ? [
|
||||
`hash: ${JSON.stringify(hash)}`
|
||||
] : [],
|
||||
...needQuotes ? "needQuotes: true" : []
|
||||
];
|
||||
const preparedOptions = getUrlOptions.length > 0 ? `, { ${getUrlOptions.join(", ")} }` : "";
|
||||
beforeCode += `var ${replacementName} = ___CSS_LOADER_GET_URL_IMPORT___(${importName}${preparedOptions});\n`;
|
||||
code = code.replace(new RegExp(replacementName, "g"), ()=>`" + ${replacementName} + "`);
|
||||
}
|
||||
}
|
||||
return `${beforeCode}// Module\n___CSS_LOADER_EXPORT___.push([module.id, ${code}, ""${sourceMapValue}]);\n`;
|
||||
}
|
||||
export function getExportCode(exports, replacements, options) {
|
||||
let code = "// Exports\n";
|
||||
let localsCode = "";
|
||||
const addExportToLocalsCode = (name, value)=>{
|
||||
if (options.modules.namedExport) {
|
||||
localsCode += `export const ${camelCase(name)} = ${JSON.stringify(value)};\n`;
|
||||
} else {
|
||||
if (localsCode) {
|
||||
localsCode += `,\n`;
|
||||
}
|
||||
localsCode += `\t${JSON.stringify(name)}: ${JSON.stringify(value)}`;
|
||||
}
|
||||
};
|
||||
for (const { name, value } of exports){
|
||||
switch(options.modules.exportLocalsConvention){
|
||||
case "camelCase":
|
||||
{
|
||||
addExportToLocalsCode(name, value);
|
||||
const modifiedName = camelCase(name);
|
||||
if (modifiedName !== name) {
|
||||
addExportToLocalsCode(modifiedName, value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "camelCaseOnly":
|
||||
{
|
||||
addExportToLocalsCode(camelCase(name), value);
|
||||
break;
|
||||
}
|
||||
case "dashes":
|
||||
{
|
||||
addExportToLocalsCode(name, value);
|
||||
const modifiedName = dashesCamelCase(name);
|
||||
if (modifiedName !== name) {
|
||||
addExportToLocalsCode(modifiedName, value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "dashesOnly":
|
||||
{
|
||||
addExportToLocalsCode(dashesCamelCase(name), value);
|
||||
break;
|
||||
}
|
||||
case "asIs":
|
||||
default:
|
||||
addExportToLocalsCode(name, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const item of replacements){
|
||||
const { replacementName, localName } = item;
|
||||
if (localName) {
|
||||
const { importName } = item;
|
||||
localsCode = localsCode.replace(new RegExp(replacementName, "g"), ()=>{
|
||||
if (options.modules.namedExport) {
|
||||
return `" + ${importName}_NAMED___[${JSON.stringify(camelCase(localName))}] + "`;
|
||||
} else if (options.modules.exportOnlyLocals) {
|
||||
return `" + ${importName}[${JSON.stringify(localName)}] + "`;
|
||||
}
|
||||
return `" + ${importName}.locals[${JSON.stringify(localName)}] + "`;
|
||||
});
|
||||
} else {
|
||||
localsCode = localsCode.replace(new RegExp(replacementName, "g"), ()=>`" + ${replacementName} + "`);
|
||||
}
|
||||
}
|
||||
if (options.modules.exportOnlyLocals) {
|
||||
code += options.modules.namedExport ? localsCode : `${options.esModule ? "export default" : "module.exports ="} {\n${localsCode}\n};\n`;
|
||||
return code;
|
||||
}
|
||||
if (localsCode) {
|
||||
code += options.modules.namedExport ? localsCode : `___CSS_LOADER_EXPORT___.locals = {\n${localsCode}\n};\n`;
|
||||
}
|
||||
code += `${options.esModule ? "export default" : "module.exports ="} ___CSS_LOADER_EXPORT___;\n`;
|
||||
return code;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=codegen.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/codegen.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/codegen.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/lightningcss-loader/src/codegen.ts"],"names":["camelCase","dashesCamelCase","normalizeSourceMapForRuntime","getImportCode","imports","options","code","item","importName","url","icss","esModule","modules","namedExport","exportOnlyLocals","getModuleCode","result","api","replacements","loaderContext","sourceMapValue","sourceMap","map","JSON","stringify","css","beforeCode","media","dedupe","replacementName","localName","replace","RegExp","hash","needQuotes","getUrlOptions","preparedOptions","length","join","getExportCode","exports","localsCode","addExportToLocalsCode","name","value","exportLocalsConvention","modifiedName"],"mappings":"AACA,OAAOA,eAAe,iCAAgC;AACtD,SACEC,eAAe,EACfC,4BAA4B,QACvB,6BAA4B;AAmCnC,OAAO,SAASC,cAAcC,OAAoB,EAAEC,OAAY;IAC9D,IAAIC,OAAO;IAEX,KAAK,MAAMC,QAAQH,QAAS;QAC1B,MAAM,EAAEI,UAAU,EAAEC,GAAG,EAAEC,IAAI,EAAE,GAAGH;QAElC,IAAIF,QAAQM,QAAQ,EAAE;YACpB,IAAID,QAAQL,Q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AC/B,OAAO,CAAC,IAAI,EAAEL,WAAW,UAAU,EAAEe,KAAKC,SAAS,CACjDxB,UAAU8B,YACV,KAAK,CAAC;gBACV,OAAO,IAAIzB,QAAQO,OAAO,CAACE,gBAAgB,EAAE;oBAC3C,OAAO,CAAC,IAAI,EAAEN,WAAW,CAAC,EAAEe,KAAKC,SAAS,CAACM,WAAW,KAAK,CAAC;gBAC9D;gBAEA,OAAO,CAAC,IAAI,EAAEtB,WAAW,QAAQ,EAAEe,KAAKC,SAAS,CAACM,WAAW,KAAK,CAAC;YACrE;QACF,OAAO;YACLW,aAAaA,WAAWV,OAAO,CAC7B,IAAIC,OAAOH,iBAAiB,MAC5B,IAAM,CAAC,IAAI,EAAEA,gBAAgB,IAAI,CAAC;QAEtC;IACF;IAEA,IAAIxB,QAAQO,OAAO,CAACE,gBAAgB,EAAE;QACpCR,QAAQD,QAAQO,OAAO,CAACC,WAAW,GAC/B4B,aACA,CAAC,EACCpC,QAAQM,QAAQ,GAAG,mBAAmB,mBACvC,IAAI,EAAE8B,WAAW,MAAM,CAAC;QAE7B,OAAOnC;IACT;IAEA,IAAImC,YAAY;QACdnC,QAAQD,QAAQO,OAAO,CAACC,WAAW,GAC/B4B,aACA,CAAC,oCAAoC,EAAEA,WAAW,MAAM,CAAC;IAC/D;IAEAnC,QAAQ,CAAC,EACPD,QAAQM,QAAQ,GAAG,mBAAmB,mBACvC,2BAA2B,CAAC;IAE7B,OAAOL;AACT"}
|
||||
5
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/index.js
generated
vendored
Normal file
5
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/index.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { LightningCssLoader } from "./loader";
|
||||
export { LightningCssMinifyPlugin } from "./minify";
|
||||
export default LightningCssLoader;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/lightningcss-loader/src/index.ts"],"names":["LightningCssLoader","LightningCssMinifyPlugin"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,WAAU;AAE7C,SAASC,wBAAwB,QAAQ,WAAU;AACnD,eAAeD,mBAAkB"}
|
||||
7
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/interface.js
generated
vendored
Normal file
7
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/interface.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
export var ECacheKey;
|
||||
(function(ECacheKey) {
|
||||
ECacheKey["loader"] = "loader";
|
||||
ECacheKey["minify"] = "minify";
|
||||
})(ECacheKey || (ECacheKey = {}));
|
||||
|
||||
//# sourceMappingURL=interface.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/interface.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/interface.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/lightningcss-loader/src/interface.ts"],"names":["ECacheKey"],"mappings":";UAAYA;;;GAAAA,cAAAA"}
|
||||
388
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/loader.js
generated
vendored
Normal file
388
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/loader.js
generated
vendored
Normal file
@ -0,0 +1,388 @@
|
||||
import { getTargets } from "./utils";
|
||||
import { getImportCode, getModuleCode, getExportCode } from "./codegen";
|
||||
import { getFilter, getPreRequester, isDataUrl, isUrlRequestable, requestify, resolveRequests } from "../../css-loader/src/utils";
|
||||
import { stringifyRequest } from "../../../stringify-request";
|
||||
import { ECacheKey } from "./interface";
|
||||
const encoder = new TextEncoder();
|
||||
const moduleRegExp = /\.module\.\w+$/i;
|
||||
function createUrlAndImportVisitor(visitorOptions, apis, imports, replacements, replacedUrls, replacedImportUrls) {
|
||||
const importUrlToNameMap = new Map();
|
||||
let hasUrlImportHelper = false;
|
||||
const urlToNameMap = new Map();
|
||||
const urlToReplacementMap = new Map();
|
||||
let urlIndex = -1;
|
||||
let importUrlIndex = -1;
|
||||
function handleUrl(u) {
|
||||
let url = u.url;
|
||||
const needKeep = visitorOptions.urlFilter(url);
|
||||
if (!needKeep) {
|
||||
return u;
|
||||
}
|
||||
if (isDataUrl(url)) {
|
||||
return u;
|
||||
}
|
||||
urlIndex++;
|
||||
replacedUrls.set(urlIndex, url);
|
||||
url = `__NEXT_LIGHTNINGCSS_LOADER_URL_REPLACE_${urlIndex}__`;
|
||||
const [, query, hashOrQuery] = url.split(/(\?)?#/, 3);
|
||||
const queryParts = url.split("!");
|
||||
let prefix;
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
let hash = query ? "?" : "";
|
||||
hash += hashOrQuery ? `#${hashOrQuery}` : "";
|
||||
if (!hasUrlImportHelper) {
|
||||
imports.push({
|
||||
type: "get_url_import",
|
||||
importName: "___CSS_LOADER_GET_URL_IMPORT___",
|
||||
url: JSON.stringify(require.resolve("../../css-loader/src/runtime/getUrl.js")),
|
||||
index: -1
|
||||
});
|
||||
hasUrlImportHelper = true;
|
||||
}
|
||||
const newUrl = prefix ? `${prefix}!${url}` : url;
|
||||
let importName = urlToNameMap.get(newUrl);
|
||||
if (!importName) {
|
||||
importName = `___CSS_LOADER_URL_IMPORT_${urlToNameMap.size}___`;
|
||||
urlToNameMap.set(newUrl, importName);
|
||||
imports.push({
|
||||
type: "url",
|
||||
importName,
|
||||
url: JSON.stringify(newUrl),
|
||||
index: urlIndex
|
||||
});
|
||||
}
|
||||
// This should be true for string-urls in image-set
|
||||
const needQuotes = false;
|
||||
const replacementKey = JSON.stringify({
|
||||
newUrl,
|
||||
hash,
|
||||
needQuotes
|
||||
});
|
||||
let replacementName = urlToReplacementMap.get(replacementKey);
|
||||
if (!replacementName) {
|
||||
replacementName = `___CSS_LOADER_URL_REPLACEMENT_${urlToReplacementMap.size}___`;
|
||||
urlToReplacementMap.set(replacementKey, replacementName);
|
||||
replacements.push({
|
||||
replacementName,
|
||||
importName,
|
||||
hash,
|
||||
needQuotes
|
||||
});
|
||||
}
|
||||
return {
|
||||
loc: u.loc,
|
||||
url: replacementName
|
||||
};
|
||||
}
|
||||
return {
|
||||
Rule: {
|
||||
import (node) {
|
||||
if (visitorOptions.importFilter) {
|
||||
const needKeep = visitorOptions.importFilter(node.value.url, node.value.media);
|
||||
if (!needKeep) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
let url = node.value.url;
|
||||
importUrlIndex++;
|
||||
replacedImportUrls.set(importUrlIndex, url);
|
||||
url = `__NEXT_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${importUrlIndex}__`;
|
||||
// TODO: Use identical logic as valueParser.stringify()
|
||||
const media = node.value.media.mediaQueries.length ? JSON.stringify(node.value.media.mediaQueries) : undefined;
|
||||
const isRequestable = isUrlRequestable(url);
|
||||
let prefix;
|
||||
if (isRequestable) {
|
||||
const queryParts = url.split("!");
|
||||
if (queryParts.length > 1) {
|
||||
url = queryParts.pop();
|
||||
prefix = queryParts.join("!");
|
||||
}
|
||||
}
|
||||
if (!isRequestable) {
|
||||
apis.push({
|
||||
url,
|
||||
media
|
||||
});
|
||||
// Bug of lightningcss
|
||||
return {
|
||||
type: "ignored",
|
||||
value: ""
|
||||
};
|
||||
}
|
||||
const newUrl = prefix ? `${prefix}!${url}` : url;
|
||||
let importName = importUrlToNameMap.get(newUrl);
|
||||
if (!importName) {
|
||||
importName = `___CSS_LOADER_AT_RULE_IMPORT_${importUrlToNameMap.size}___`;
|
||||
importUrlToNameMap.set(newUrl, importName);
|
||||
const importUrl = visitorOptions.urlHandler(newUrl);
|
||||
imports.push({
|
||||
type: "rule_import",
|
||||
importName,
|
||||
url: importUrl
|
||||
});
|
||||
}
|
||||
apis.push({
|
||||
importName,
|
||||
media
|
||||
});
|
||||
// Bug of lightningcss
|
||||
return {
|
||||
type: "ignored",
|
||||
value: ""
|
||||
};
|
||||
}
|
||||
},
|
||||
Url (node) {
|
||||
return handleUrl(node);
|
||||
}
|
||||
};
|
||||
}
|
||||
function createIcssVisitor({ apis, imports, replacements, replacedUrls, urlHandler }) {
|
||||
let index = -1;
|
||||
let replacementIndex = -1;
|
||||
return {
|
||||
Declaration: {
|
||||
composes (node) {
|
||||
if (node.property === "unparsed") {
|
||||
return;
|
||||
}
|
||||
const specifier = node.value.from;
|
||||
if ((specifier == null ? void 0 : specifier.type) !== "file") {
|
||||
return;
|
||||
}
|
||||
let url = specifier.value;
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
index++;
|
||||
replacedUrls.set(index, url);
|
||||
url = `__NEXT_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${index}__`;
|
||||
const importName = `___CSS_LOADER_ICSS_IMPORT_${imports.length}___`;
|
||||
imports.push({
|
||||
type: "icss_import",
|
||||
importName,
|
||||
icss: true,
|
||||
url: urlHandler(url),
|
||||
index
|
||||
});
|
||||
apis.push({
|
||||
importName,
|
||||
dedupe: true,
|
||||
index
|
||||
});
|
||||
const newNames = [];
|
||||
for (const localName of node.value.names){
|
||||
replacementIndex++;
|
||||
const replacementName = `___CSS_LOADER_ICSS_IMPORT_${index}_REPLACEMENT_${replacementIndex}___`;
|
||||
replacements.push({
|
||||
replacementName,
|
||||
importName,
|
||||
localName
|
||||
});
|
||||
newNames.push(replacementName);
|
||||
}
|
||||
return {
|
||||
property: "composes",
|
||||
value: {
|
||||
loc: node.value.loc,
|
||||
names: newNames,
|
||||
from: specifier
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
const LOADER_NAME = `lightningcss-loader`;
|
||||
export async function LightningCssLoader(source, prevMap) {
|
||||
var _options_modules;
|
||||
const done = this.async();
|
||||
const options = this.getOptions();
|
||||
const { implementation, targets: userTargets, ...opts } = options;
|
||||
options.modules ??= {};
|
||||
if (implementation && typeof implementation.transformCss !== "function") {
|
||||
done(new TypeError(`[${LOADER_NAME}]: options.implementation.transformCss must be an 'lightningcss' transform function. Received ${typeof implementation.transformCss}`));
|
||||
return;
|
||||
}
|
||||
const exports = [];
|
||||
const imports = [];
|
||||
const icssImports = [];
|
||||
const apis = [];
|
||||
const replacements = [];
|
||||
if (((_options_modules = options.modules) == null ? void 0 : _options_modules.exportOnlyLocals) !== true) {
|
||||
imports.unshift({
|
||||
type: "api_import",
|
||||
importName: "___CSS_LOADER_API_IMPORT___",
|
||||
url: stringifyRequest(this, require.resolve("../../css-loader/src/runtime/api"))
|
||||
});
|
||||
}
|
||||
const { loadBindings } = require("next/dist/build/swc");
|
||||
const transform = (implementation == null ? void 0 : implementation.transformCss) ?? (await loadBindings()).css.lightning.transform;
|
||||
const replacedUrls = new Map();
|
||||
const icssReplacedUrls = new Map();
|
||||
const replacedImportUrls = new Map();
|
||||
const urlImportVisitor = createUrlAndImportVisitor({
|
||||
urlHandler: (url)=>stringifyRequest(this, getPreRequester(this)(options.importLoaders ?? 0) + url),
|
||||
urlFilter: getFilter(options.url, this.resourcePath),
|
||||
importFilter: getFilter(options.import, this.resourcePath),
|
||||
context: this.context
|
||||
}, apis, imports, replacements, replacedUrls, replacedImportUrls);
|
||||
const icssVisitor = createIcssVisitor({
|
||||
apis,
|
||||
imports: icssImports,
|
||||
replacements,
|
||||
replacedUrls: icssReplacedUrls,
|
||||
urlHandler: (url)=>stringifyRequest(this, getPreRequester(this)(options.importLoaders) + url)
|
||||
});
|
||||
// This works by returned visitors are not conflicting.
|
||||
// naive workaround for composeVisitors, as we do not directly depends on lightningcss's npm pkg
|
||||
// but next-swc provides bindings
|
||||
const visitor = {
|
||||
...urlImportVisitor,
|
||||
...icssVisitor
|
||||
};
|
||||
try {
|
||||
const { code, map, exports: moduleExports } = transform({
|
||||
...opts,
|
||||
visitor,
|
||||
cssModules: options.modules && moduleRegExp.test(this.resourcePath) ? {
|
||||
pattern: process.env.__NEXT_TEST_MODE ? "[name]__[local]" : "[name]__[hash]__[local]"
|
||||
} : undefined,
|
||||
filename: this.resourcePath,
|
||||
code: encoder.encode(source),
|
||||
sourceMap: this.sourceMap,
|
||||
targets: getTargets({
|
||||
targets: userTargets,
|
||||
key: ECacheKey.loader
|
||||
}),
|
||||
inputSourceMap: this.sourceMap && prevMap ? JSON.stringify(prevMap) : undefined,
|
||||
include: 1
|
||||
});
|
||||
let cssCodeAsString = code.toString();
|
||||
if (moduleExports) {
|
||||
for(const name in moduleExports){
|
||||
if (Object.prototype.hasOwnProperty.call(moduleExports, name)) {
|
||||
const v = moduleExports[name];
|
||||
let value = v.name;
|
||||
for (const compose of v.composes){
|
||||
value += ` ${compose.name}`;
|
||||
}
|
||||
exports.push({
|
||||
name,
|
||||
value
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (replacedUrls.size !== 0) {
|
||||
const urlResolver = this.getResolve({
|
||||
conditionNames: [
|
||||
"asset"
|
||||
],
|
||||
mainFields: [
|
||||
"asset"
|
||||
],
|
||||
mainFiles: [],
|
||||
extensions: []
|
||||
});
|
||||
for (const [index, url] of replacedUrls.entries()){
|
||||
const [pathname] = url.split(/(\?)?#/, 3);
|
||||
const request = requestify(pathname, this.rootContext);
|
||||
const resolvedUrl = await resolveRequests(urlResolver, this.context, [
|
||||
...new Set([
|
||||
request,
|
||||
url
|
||||
])
|
||||
]);
|
||||
for (const importItem of imports){
|
||||
importItem.url = importItem.url.replace(`__NEXT_LIGHTNINGCSS_LOADER_URL_REPLACE_${index}__`, resolvedUrl ?? url);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (replacedImportUrls.size !== 0) {
|
||||
const importResolver = this.getResolve({
|
||||
conditionNames: [
|
||||
"style"
|
||||
],
|
||||
extensions: [
|
||||
".css"
|
||||
],
|
||||
mainFields: [
|
||||
"css",
|
||||
"style",
|
||||
"main",
|
||||
"..."
|
||||
],
|
||||
mainFiles: [
|
||||
"index",
|
||||
"..."
|
||||
],
|
||||
restrictions: [
|
||||
/\.css$/i
|
||||
]
|
||||
});
|
||||
for (const [index, url] of replacedImportUrls.entries()){
|
||||
const [pathname] = url.split(/(\?)?#/, 3);
|
||||
const request = requestify(pathname, this.rootContext);
|
||||
const resolvedUrl = await resolveRequests(importResolver, this.context, [
|
||||
...new Set([
|
||||
request,
|
||||
url
|
||||
])
|
||||
]);
|
||||
for (const importItem of imports){
|
||||
importItem.url = importItem.url.replace(`__NEXT_LIGHTNINGCSS_LOADER_IMPORT_URL_REPLACE_${index}__`, resolvedUrl ?? url);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (icssReplacedUrls.size !== 0) {
|
||||
const icssResolver = this.getResolve({
|
||||
conditionNames: [
|
||||
"style"
|
||||
],
|
||||
extensions: [],
|
||||
mainFields: [
|
||||
"css",
|
||||
"style",
|
||||
"main",
|
||||
"..."
|
||||
],
|
||||
mainFiles: [
|
||||
"index",
|
||||
"..."
|
||||
]
|
||||
});
|
||||
for (const [index, url] of icssReplacedUrls.entries()){
|
||||
const [pathname] = url.split(/(\?)?#/, 3);
|
||||
const request = requestify(pathname, this.rootContext);
|
||||
const resolvedUrl = await resolveRequests(icssResolver, this.context, [
|
||||
...new Set([
|
||||
url,
|
||||
request
|
||||
])
|
||||
]);
|
||||
for (const importItem of icssImports){
|
||||
importItem.url = importItem.url.replace(`__NEXT_LIGHTNINGCSS_LOADER_ICSS_URL_REPLACE_${index}__`, resolvedUrl ?? url);
|
||||
}
|
||||
}
|
||||
}
|
||||
imports.push(...icssImports);
|
||||
const importCode = getImportCode(imports, options);
|
||||
const moduleCode = getModuleCode({
|
||||
css: cssCodeAsString,
|
||||
map
|
||||
}, apis, replacements, options, this);
|
||||
const exportCode = getExportCode(exports, replacements, options);
|
||||
const esCode = `${importCode}${moduleCode}${exportCode}`;
|
||||
done(null, esCode, map && JSON.parse(map.toString()));
|
||||
} catch (error) {
|
||||
console.error("lightningcss-loader error", error);
|
||||
done(error);
|
||||
}
|
||||
}
|
||||
export const raw = true;
|
||||
|
||||
//# sourceMappingURL=loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/loader.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
82
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/minify.js
generated
vendored
Normal file
82
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/minify.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
// @ts-ignore
|
||||
import { ModuleFilenameHelpers } from "next/dist/compiled/webpack/webpack";
|
||||
import { webpack } from "next/dist/compiled/webpack/webpack";
|
||||
// @ts-ignore
|
||||
import { RawSource, SourceMapSource } from "next/dist/compiled/webpack-sources3";
|
||||
import { ECacheKey } from "./interface";
|
||||
import { getTargets } from "./utils";
|
||||
import { Buffer } from "buffer";
|
||||
const PLUGIN_NAME = "lightning-css-minify";
|
||||
const CSS_FILE_REG = /\.css(?:\?.*)?$/i;
|
||||
export class LightningCssMinifyPlugin {
|
||||
constructor(opts = {}){
|
||||
const { implementation, ...otherOpts } = opts;
|
||||
if (implementation && typeof implementation.transformCss !== "function") {
|
||||
throw new TypeError(`[LightningCssMinifyPlugin]: implementation.transformCss must be an 'lightningcss' transform function. Received ${typeof implementation.transformCss}`);
|
||||
}
|
||||
this.transform = implementation == null ? void 0 : implementation.transformCss;
|
||||
this.options = otherOpts;
|
||||
}
|
||||
apply(compiler) {
|
||||
const meta = JSON.stringify({
|
||||
name: "@next/lightningcss-loader",
|
||||
version: "0.0.0",
|
||||
options: this.options
|
||||
});
|
||||
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation)=>{
|
||||
compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash)=>hash.update(meta));
|
||||
compilation.hooks.processAssets.tapPromise({
|
||||
name: PLUGIN_NAME,
|
||||
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
|
||||
additionalAssets: true
|
||||
}, async ()=>await this.transformAssets(compilation));
|
||||
compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (statsPrinter)=>{
|
||||
statsPrinter.hooks.print.for("asset.info.minimized")// @ts-ignore
|
||||
.tap(PLUGIN_NAME, (minimized, { green, formatFlag })=>{
|
||||
// @ts-ignore
|
||||
return minimized ? green(formatFlag("minimized")) : undefined;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
async transformAssets(compilation) {
|
||||
const { options: { devtool } } = compilation.compiler;
|
||||
if (!this.transform) {
|
||||
const { loadBindings } = require("next/dist/build/swc");
|
||||
this.transform = (await loadBindings()).css.lightning.transform;
|
||||
}
|
||||
const sourcemap = this.options.sourceMap === undefined ? devtool && devtool.includes("source-map") : this.options.sourceMap;
|
||||
const { include, exclude, test: testRegExp, targets: userTargets, ...transformOptions } = this.options;
|
||||
const assets = compilation.getAssets().filter((asset)=>// Filter out already minimized
|
||||
!asset.info.minimized && // Filter out by file type
|
||||
(testRegExp || CSS_FILE_REG).test(asset.name) && ModuleFilenameHelpers.matchObject({
|
||||
include,
|
||||
exclude
|
||||
}, asset.name));
|
||||
await Promise.all(assets.map(async (asset)=>{
|
||||
const { source, map } = asset.source.sourceAndMap();
|
||||
const sourceAsString = source.toString();
|
||||
const code = typeof source === "string" ? Buffer.from(source) : source;
|
||||
const targets = getTargets({
|
||||
targets: userTargets,
|
||||
key: ECacheKey.minify
|
||||
});
|
||||
const result = await this.transform({
|
||||
filename: asset.name,
|
||||
code,
|
||||
minify: true,
|
||||
sourceMap: sourcemap,
|
||||
targets,
|
||||
...transformOptions
|
||||
});
|
||||
const codeString = result.code.toString();
|
||||
compilation.updateAsset(asset.name, // @ts-ignore
|
||||
sourcemap ? new SourceMapSource(codeString, asset.name, JSON.parse(result.map.toString()), sourceAsString, map, true) : new RawSource(codeString), {
|
||||
...asset.info,
|
||||
minimized: true
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=minify.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/minify.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/minify.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/lightningcss-loader/src/minify.ts"],"names":["ModuleFilenameHelpers","webpack","RawSource","SourceMapSource","ECacheKey","getTargets","Buffer","PLUGIN_NAME","CSS_FILE_REG","LightningCssMinifyPlugin","constructor","opts","implementation","otherOpts","transformCss","TypeError","transform","options","apply","compiler","meta","JSON","stringify","name","version","hooks","compilation","tap","chunkHash","_","hash","update","processAssets","tapPromise","stage","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE","additionalAssets","transformAssets","statsPrinter","print","for","minimized","green","formatFlag","undefined","devtool","loadBindings","require","css","lightning","sourcemap","sourceMap","includes","include","exclude","test","testRegExp","targets","userTargets","transformOptions","assets","getAssets","filter","asset","info","matchObject","Promise","all","map","source","sourceAndMap","sourceAsString","toString","code","from","key","minify","result","filename","codeString","updateAsset","parse"],"mappings":"AAAA,aAAa;AACb,SAASA,qBAAqB,QAAQ,qCAAoC;AAC1E,SAASC,OAAO,QAAQ,qCAAoC;AAC5D,aAAa;AACb,SAASC,SAAS,EAAEC,eAAe,QAAQ,sCAAqC;AAChF,SAASC,SAAS,QAAQ,cAAa;AAEvC,SAASC,UAAU,QAAQ,UAAS;AACpC,SAASC,MAAM,QAAQ,SAAQ;AAE/B,MAAMC,cAAc;AACpB,MAAMC,eAAe;AAErB,OAAO,MAAMC;IAIXC,YAAYC,OAAY,CAAC,CAAC,CAAE;QAC1B,MAAM,EAAEC,cAAc,EAAE,GAAGC,WAAW,GAAGF;QACzC,IAAIC,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,EACVF,KAAK6D,KAAK,CAACJ,OAAOT,GAAG,CAAEI,QAAQ,KAC/BD,gBACAH,KACA,QAEF,IAAInE,UAAU8E,aAClB;gBACE,GAAGhB,MAAMC,IAAI;gBACbvB,WAAW;YACb;QAEJ;IAEJ;AACF"}
|
||||
48
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/utils.js
generated
vendored
Normal file
48
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/utils.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
let targetsCache = {};
|
||||
/**
|
||||
* Convert a version number to a single 24-bit number
|
||||
*
|
||||
* https://github.com/lumeland/lume/blob/4cc75599006df423a14befc06d3ed8493c645b09/plugins/lightningcss.ts#L160
|
||||
*/ function version(major, minor = 0, patch = 0) {
|
||||
return major << 16 | minor << 8 | patch;
|
||||
}
|
||||
function parseVersion(v) {
|
||||
return v.split(".").reduce((acc, val)=>{
|
||||
if (!acc) {
|
||||
return null;
|
||||
}
|
||||
const parsed = parseInt(val, 10);
|
||||
if (isNaN(parsed)) {
|
||||
return null;
|
||||
}
|
||||
acc.push(parsed);
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
function browserslistToTargets(targets) {
|
||||
return targets.reduce((acc, value)=>{
|
||||
const [name, v] = value.split(" ");
|
||||
const parsedVersion = parseVersion(v);
|
||||
if (!parsedVersion) {
|
||||
return acc;
|
||||
}
|
||||
const versionDigit = version(parsedVersion[0], parsedVersion[1], parsedVersion[2]);
|
||||
if (name === "and_qq" || name === "and_uc" || name === "baidu" || name === "bb" || name === "kaios" || name === "op_mini") {
|
||||
return acc;
|
||||
}
|
||||
if (acc[name] == null || versionDigit < acc[name]) {
|
||||
acc[name] = versionDigit;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
export const getTargets = (opts)=>{
|
||||
const cache = targetsCache[opts.key];
|
||||
if (cache) {
|
||||
return cache;
|
||||
}
|
||||
const result = browserslistToTargets(opts.targets ?? []);
|
||||
return targetsCache[opts.key] = result;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/utils.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/lightningcss-loader/src/utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/lightningcss-loader/src/utils.ts"],"names":["targetsCache","version","major","minor","patch","parseVersion","v","split","reduce","acc","val","parsed","parseInt","isNaN","push","browserslistToTargets","targets","value","name","parsedVersion","versionDigit","getTargets","opts","cache","key","result"],"mappings":"AAAA,IAAIA,eAAoC,CAAC;AAEzC;;;;CAIC,GACD,SAASC,QAAQC,KAAa,EAAEC,QAAQ,CAAC,EAAEC,QAAQ,CAAC;IAClD,OAAO,AAACF,SAAS,KAAOC,SAAS,IAAKC;AACxC;AAEA,SAASC,aAAaC,CAAS;IAC7B,OAAOA,EAAEC,KAAK,CAAC,KAAKC,MAAM,CAAC,CAACC,KAAKC;QAC/B,IAAI,CAACD,KAAK;YACR,OAAO;QACT;QAEA,MAAME,SAASC,SAASF,KAAK;QAC7B,IAAIG,MAAMF,SAAS;YACjB,OAAO;QACT;QACAF,IAAIK,IAAI,CAACH;QACT,OAAOF;IACT,GAAG,EAAE;AACP;AAEA,SAASM,sBAAsBC,OAAsB;IACnD,OAAOA,QAAQR,MAAM,CAAC,CAACC,KAAKQ;QAC1B,MAAM,CAACC,MAAMZ,EAAE,GAAGW,MAAMV,KAAK,CAAC;QAC9B,MAAMY,gBAAgBd,aAAaC;QAEnC,IAAI,CAACa,eAAe;YAClB,OAAOV;QACT;QACA,MAAMW,eAAenB,QACnBkB,aAAa,CAAC,EAAE,EAChBA,aAAa,CAAC,EAAE,EAChBA,aAAa,CAAC,EAAE;QAGlB,IACED,SAAS,YACTA,SAAS,YACTA,SAAS,WACTA,SAAS,QACTA,SAAS,WACTA,SAAS,WACT;YACA,OAAOT;QACT;QAEA,IAAIA,GAAG,CAACS,KAAK,IAAI,QAAQE,eAAeX,GAAG,CAACS,KAAK,EAAE;YACjDT,GAAG,CAACS,KAAK,GAAGE;QACd;QAEA,OAAOX;IACT,GAAG,CAAC;AACN;AAEA,OAAO,MAAMY,aAAa,CAACC;IACzB,MAAMC,QAAQvB,YAAY,CAACsB,KAAKE,GAAG,CAAC;IACpC,IAAID,OAAO;QACT,OAAOA;IACT;IAEA,MAAME,SAASV,sBAAsBO,KAAKN,OAAO,IAAI,EAAE;IACvD,OAAQhB,YAAY,CAACsB,KAAKE,GAAG,CAAC,GAAGC;AACnC,EAAC"}
|
||||
92
node_modules/next/dist/esm/build/webpack/loaders/metadata/discover.js
generated
vendored
Normal file
92
node_modules/next/dist/esm/build/webpack/loaders/metadata/discover.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
import path from "path";
|
||||
import { stringify } from "querystring";
|
||||
import { STATIC_METADATA_IMAGES } from "../../../../lib/metadata/is-metadata-route";
|
||||
import { WEBPACK_RESOURCE_QUERIES } from "../../../../lib/constants";
|
||||
const METADATA_TYPE = "metadata";
|
||||
// Produce all compositions with filename (icon, apple-icon, etc.) with extensions (png, jpg, etc.)
|
||||
async function enumMetadataFiles(dir, filename, extensions, { metadataResolver, // When set to true, possible filename without extension could: icon, icon0, ..., icon9
|
||||
numericSuffix }) {
|
||||
const collectedFiles = [];
|
||||
const possibleFileNames = [
|
||||
filename
|
||||
].concat(numericSuffix ? Array(10).fill(0).map((_, index)=>filename + index) : []);
|
||||
for (const name of possibleFileNames){
|
||||
const resolved = await metadataResolver(dir, name, extensions);
|
||||
if (resolved) {
|
||||
collectedFiles.push(resolved);
|
||||
}
|
||||
}
|
||||
return collectedFiles;
|
||||
}
|
||||
export async function createStaticMetadataFromRoute(resolvedDir, { segment, metadataResolver, isRootLayoutOrRootPage, pageExtensions, basePath }) {
|
||||
let hasStaticMetadataFiles = false;
|
||||
const staticImagesMetadata = {
|
||||
icon: [],
|
||||
apple: [],
|
||||
twitter: [],
|
||||
openGraph: [],
|
||||
manifest: undefined
|
||||
};
|
||||
async function collectIconModuleIfExists(type) {
|
||||
if (type === "manifest") {
|
||||
const staticManifestExtension = [
|
||||
"webmanifest",
|
||||
"json"
|
||||
];
|
||||
const manifestFile = await enumMetadataFiles(resolvedDir, "manifest", staticManifestExtension.concat(pageExtensions), {
|
||||
metadataResolver,
|
||||
numericSuffix: false
|
||||
});
|
||||
if (manifestFile.length > 0) {
|
||||
hasStaticMetadataFiles = true;
|
||||
const { name, ext } = path.parse(manifestFile[0]);
|
||||
const extension = staticManifestExtension.includes(ext.slice(1)) ? ext.slice(1) : "webmanifest";
|
||||
staticImagesMetadata.manifest = JSON.stringify(`/${name}.${extension}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const resolvedMetadataFiles = await enumMetadataFiles(resolvedDir, STATIC_METADATA_IMAGES[type].filename, [
|
||||
...STATIC_METADATA_IMAGES[type].extensions,
|
||||
...type === "favicon" ? [] : pageExtensions
|
||||
], {
|
||||
metadataResolver,
|
||||
numericSuffix: true
|
||||
});
|
||||
resolvedMetadataFiles.sort((a, b)=>a.localeCompare(b)).forEach((filepath)=>{
|
||||
const imageModuleImportSource = `next-metadata-image-loader?${stringify({
|
||||
type,
|
||||
segment,
|
||||
basePath,
|
||||
pageExtensions
|
||||
})}!${filepath}?${WEBPACK_RESOURCE_QUERIES.metadata}`;
|
||||
const imageModule = `(async (props) => (await import(/* webpackMode: "eager" */ ${JSON.stringify(imageModuleImportSource)})).default(props))`;
|
||||
hasStaticMetadataFiles = true;
|
||||
if (type === "favicon") {
|
||||
staticImagesMetadata.icon.unshift(imageModule);
|
||||
} else {
|
||||
staticImagesMetadata[type].push(imageModule);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Intentionally make these serial to reuse directory access cache.
|
||||
await collectIconModuleIfExists("icon");
|
||||
await collectIconModuleIfExists("apple");
|
||||
await collectIconModuleIfExists("openGraph");
|
||||
await collectIconModuleIfExists("twitter");
|
||||
if (isRootLayoutOrRootPage) {
|
||||
await collectIconModuleIfExists("favicon");
|
||||
await collectIconModuleIfExists("manifest");
|
||||
}
|
||||
return hasStaticMetadataFiles ? staticImagesMetadata : null;
|
||||
}
|
||||
export function createMetadataExportsCode(metadata) {
|
||||
return metadata ? `${METADATA_TYPE}: {
|
||||
icon: [${metadata.icon.join(",")}],
|
||||
apple: [${metadata.apple.join(",")}],
|
||||
openGraph: [${metadata.openGraph.join(",")}],
|
||||
twitter: [${metadata.twitter.join(",")}],
|
||||
manifest: ${metadata.manifest ? metadata.manifest : "undefined"}
|
||||
}` : "";
|
||||
}
|
||||
|
||||
//# sourceMappingURL=discover.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/metadata/discover.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/metadata/discover.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/metadata/discover.ts"],"names":["path","stringify","STATIC_METADATA_IMAGES","WEBPACK_RESOURCE_QUERIES","METADATA_TYPE","enumMetadataFiles","dir","filename","extensions","metadataResolver","numericSuffix","collectedFiles","possibleFileNames","concat","Array","fill","map","_","index","name","resolved","push","createStaticMetadataFromRoute","resolvedDir","segment","isRootLayoutOrRootPage","pageExtensions","basePath","hasStaticMetadataFiles","staticImagesMetadata","icon","apple","twitter","openGraph","manifest","undefined","collectIconModuleIfExists","type","staticManifestExtension","manifestFile","length","ext","parse","extension","includes","slice","JSON","resolvedMetadataFiles","sort","a","b","localeCompare","forEach","filepath","imageModuleImportSource","metadata","imageModule","unshift","createMetadataExportsCode","join"],"mappings":"AAIA,OAAOA,UAAU,OAAM;AACvB,SAASC,SAAS,QAAQ,cAAa;AACvC,SAASC,sBAAsB,QAAQ,6CAA4C;AACnF,SAASC,wBAAwB,QAAQ,4BAA2B;AAIpE,MAAMC,gBAAgB;AAEtB,mGAAmG;AACnG,eAAeC,kBACbC,GAA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J,SAASrB,QAAQ,GAAGqB,SAASrB,QAAQ,GAAG,YAAY;GACjE,CAAC,GACE;AACN"}
|
||||
99
node_modules/next/dist/esm/build/webpack/loaders/metadata/resolve-route-data.js
generated
vendored
Normal file
99
node_modules/next/dist/esm/build/webpack/loaders/metadata/resolve-route-data.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
import { resolveArray } from "../../../../lib/metadata/generate/utils";
|
||||
// convert robots data to txt string
|
||||
export function resolveRobots(data) {
|
||||
let content = "";
|
||||
const rules = Array.isArray(data.rules) ? data.rules : [
|
||||
data.rules
|
||||
];
|
||||
for (const rule of rules){
|
||||
const userAgent = resolveArray(rule.userAgent || [
|
||||
"*"
|
||||
]);
|
||||
for (const agent of userAgent){
|
||||
content += `User-Agent: ${agent}\n`;
|
||||
}
|
||||
if (rule.allow) {
|
||||
const allow = resolveArray(rule.allow);
|
||||
for (const item of allow){
|
||||
content += `Allow: ${item}\n`;
|
||||
}
|
||||
}
|
||||
if (rule.disallow) {
|
||||
const disallow = resolveArray(rule.disallow);
|
||||
for (const item of disallow){
|
||||
content += `Disallow: ${item}\n`;
|
||||
}
|
||||
}
|
||||
if (rule.crawlDelay) {
|
||||
content += `Crawl-delay: ${rule.crawlDelay}\n`;
|
||||
}
|
||||
content += "\n";
|
||||
}
|
||||
if (data.host) {
|
||||
content += `Host: ${data.host}\n`;
|
||||
}
|
||||
if (data.sitemap) {
|
||||
const sitemap = resolveArray(data.sitemap);
|
||||
// TODO-METADATA: support injecting sitemap url into robots.txt
|
||||
sitemap.forEach((item)=>{
|
||||
content += `Sitemap: ${item}\n`;
|
||||
});
|
||||
}
|
||||
return content;
|
||||
}
|
||||
// TODO-METADATA: support multi sitemap files
|
||||
// convert sitemap data to xml string
|
||||
export function resolveSitemap(data) {
|
||||
const hasAlternates = data.some((item)=>Object.keys(item.alternates ?? {}).length > 0);
|
||||
let content = "";
|
||||
content += '<?xml version="1.0" encoding="UTF-8"?>\n';
|
||||
content += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
|
||||
if (hasAlternates) {
|
||||
content += ' xmlns:xhtml="http://www.w3.org/1999/xhtml">\n';
|
||||
} else {
|
||||
content += ">\n";
|
||||
}
|
||||
for (const item of data){
|
||||
var _item_alternates;
|
||||
content += "<url>\n";
|
||||
content += `<loc>${item.url}</loc>\n`;
|
||||
const languages = (_item_alternates = item.alternates) == null ? void 0 : _item_alternates.languages;
|
||||
if (languages && Object.keys(languages).length) {
|
||||
// Since sitemap is separated from the page rendering, there's not metadataBase accessible yet.
|
||||
// we give the default setting that won't effect the languages resolving.
|
||||
for(const language in languages){
|
||||
content += `<xhtml:link rel="alternate" hreflang="${language}" href="${languages[language]}" />\n`;
|
||||
}
|
||||
}
|
||||
if (item.lastModified) {
|
||||
const serializedDate = item.lastModified instanceof Date ? item.lastModified.toISOString() : item.lastModified;
|
||||
content += `<lastmod>${serializedDate}</lastmod>\n`;
|
||||
}
|
||||
if (item.changeFrequency) {
|
||||
content += `<changefreq>${item.changeFrequency}</changefreq>\n`;
|
||||
}
|
||||
if (typeof item.priority === "number") {
|
||||
content += `<priority>${item.priority}</priority>\n`;
|
||||
}
|
||||
content += "</url>\n";
|
||||
}
|
||||
content += "</urlset>\n";
|
||||
return content;
|
||||
}
|
||||
export function resolveManifest(data) {
|
||||
return JSON.stringify(data);
|
||||
}
|
||||
export function resolveRouteData(data, fileType) {
|
||||
if (fileType === "robots") {
|
||||
return resolveRobots(data);
|
||||
}
|
||||
if (fileType === "sitemap") {
|
||||
return resolveSitemap(data);
|
||||
}
|
||||
if (fileType === "manifest") {
|
||||
return resolveManifest(data);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//# sourceMappingURL=resolve-route-data.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/metadata/resolve-route-data.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/metadata/resolve-route-data.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/metadata/resolve-route-data.ts"],"names":["resolveArray","resolveRobots","data","content","rules","Array","isArray","rule","userAgent","agent","allow","item","disallow","crawlDelay","host","sitemap","forEach","resolveSitemap","hasAlternates","some","Object","keys","alternates","length","url","languages","language","lastModified","serializedDate","Date","toISOString","changeFrequency","priority","resolveManifest","JSON","stringify","resolveRouteData","fileType"],"mappings":"AACA,SAASA,YAAY,QAAQ,0CAAyC;AAEtE,oCAAoC;AACpC,OAAO,SAASC,cAAcC,IAA0B;IACtD,IAAIC,UAAU;IACd,MAAMC,QAAQC,MAAMC,OAAO,CAACJ,KAAKE,KAAK,IAAIF,KAAKE,KAAK,GAAG;QAACF,KAAKE,KAAK;KAAC;IACnE,KAAK,MAAMG,QAAQH,MAAO;QACxB,MAAMI,YAAYR,aAAaO,KAAKC,SAAS,IAAI;YAAC;SAAI;QACtD,KAAK,MAAMC,SAASD,UAAW;YAC7BL,WAAW,CAAC,YAAY,EAAEM,MAAM,EAAE,CAAC;QACrC;QACA,IAAIF,KAAKG,KAAK,EAAE;YACd,MAAMA,QAAQV,aAAaO,KAAKG,KAAK;YACrC,KAAK,MAAMC,QAAQD,MAAO;gBACxBP,WAAW,CAAC,OAAO,EAAEQ,KAAK,EAAE,CAAC;YAC/B;QACF;QACA,IAAIJ,KAAKK,QAAQ,EAAE;YACjB,MAAMA,WAAWZ,aAAaO,KAAKK,QAAQ;YAC3C,KAAK,MAAMD,QAAQC,SAAU;gBAC3BT,WAAW,CAAC,UAAU,EAAEQ,KAAK,EAAE,CAAC;YAClC;QACF;QACA,IAAIJ,KAAKM,UAAU,EAAE;YACnBV,WAAW,CAAC,aAAa,EAAEI,KAAKM,UAAU,CAAC,EAAE,CAAC;QAChD;QACAV,WAAW;IACb;IACA,IAAID,KAAKY,IAAI,EAAE;QACbX,WAAW,CAAC,MAAM,EAAED,KAAKY,IAAI,CAAC,EAAE,CAAC;IACnC;IACA,IAAIZ,KAAKa,OAAO,EAAE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WAAW,CAAC,UAAU,EAAEQ,KAAKqB,QAAQ,CAAC,aAAa,CAAC;QACtD;QAEA7B,WAAW;IACb;IAEAA,WAAW;IAEX,OAAOA;AACT;AAEA,OAAO,SAAS8B,gBAAgB/B,IAA4B;IAC1D,OAAOgC,KAAKC,SAAS,CAACjC;AACxB;AAEA,OAAO,SAASkC,iBACdlC,IAA2E,EAC3EmC,QAA2C;IAE3C,IAAIA,aAAa,UAAU;QACzB,OAAOpC,cAAcC;IACvB;IACA,IAAImC,aAAa,WAAW;QAC1B,OAAOpB,eAAef;IACxB;IACA,IAAImC,aAAa,YAAY;QAC3B,OAAOJ,gBAAgB/B;IACzB;IACA,OAAO;AACT"}
|
||||
4
node_modules/next/dist/esm/build/webpack/loaders/metadata/types.js
generated
vendored
Normal file
4
node_modules/next/dist/esm/build/webpack/loaders/metadata/types.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
// TODO-APP: check if this can be narrowed.
|
||||
export { };
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/metadata/types.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/metadata/types.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/metadata/types.ts"],"names":[],"mappings":"AAAA,2CAA2C;AA4C3C,WAEc"}
|
||||
24
node_modules/next/dist/esm/build/webpack/loaders/modularize-import-loader.js
generated
vendored
Normal file
24
node_modules/next/dist/esm/build/webpack/loaders/modularize-import-loader.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import path from "path";
|
||||
/**
|
||||
* This loader is to create special re-exports from a specific file.
|
||||
* For example, the following loader:
|
||||
*
|
||||
* modularize-import-loader?name=Arrow&from=Arrow&as=default&join=./icons/Arrow!lucide-react
|
||||
*
|
||||
* will be used to create a re-export of:
|
||||
*
|
||||
* export { Arrow as default } from "join(resolve_path('lucide-react'), '/icons/Arrow')"
|
||||
*
|
||||
* This works even if there's no export field in the package.json of the package.
|
||||
*/ export default function transformSource() {
|
||||
const { name, from, as, join } = this.getOptions();
|
||||
const { resourcePath } = this;
|
||||
const fullPath = join ? path.join(path.dirname(resourcePath), join) : resourcePath;
|
||||
return `
|
||||
export {
|
||||
${from === "default" ? "default" : name} as ${as === "default" ? "default" : name}
|
||||
} from ${JSON.stringify(fullPath)}
|
||||
`;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=modularize-import-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/modularize-import-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/modularize-import-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/modularize-import-loader.ts"],"names":["path","transformSource","name","from","as","join","getOptions","resourcePath","fullPath","dirname","JSON","stringify"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AASvB;;;;;;;;;;;CAWC,GACD,eAAe,SAASC;IACtB,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,EAAE,EAAEC,IAAI,EAAE,GAC5B,IAAI,CAACC,UAAU;IACjB,MAAM,EAAEC,YAAY,EAAE,GAAG,IAAI;IAC7B,MAAMC,WAAWH,OACbL,KAAKK,IAAI,CAACL,KAAKS,OAAO,CAACF,eAAeF,QACtCE;IAEJ,OAAO,CAAC;;EAER,EAAEJ,SAAS,YAAY,YAAYD,KAAK,IAAI,EAC1CE,OAAO,YAAY,YAAYF,KAChC;OACI,EAAEQ,KAAKC,SAAS,CAACH,UAAU;AAClC,CAAC;AACD"}
|
||||
496
node_modules/next/dist/esm/build/webpack/loaders/next-app-loader.js
generated
vendored
Normal file
496
node_modules/next/dist/esm/build/webpack/loaders/next-app-loader.js
generated
vendored
Normal file
@ -0,0 +1,496 @@
|
||||
import { UNDERSCORE_NOT_FOUND_ROUTE, UNDERSCORE_NOT_FOUND_ROUTE_ENTRY } from "../../../shared/lib/constants";
|
||||
import path from "path";
|
||||
import { stringify } from "querystring";
|
||||
import { bold } from "../../../lib/picocolors";
|
||||
import { getModuleBuildInfo } from "./get-module-build-info";
|
||||
import { verifyRootLayout } from "../../../lib/verify-root-layout";
|
||||
import * as Log from "../../output/log";
|
||||
import { APP_DIR_ALIAS, WEBPACK_RESOURCE_QUERIES } from "../../../lib/constants";
|
||||
import { createMetadataExportsCode, createStaticMetadataFromRoute } from "./metadata/discover";
|
||||
import { promises as fs } from "fs";
|
||||
import { isAppRouteRoute } from "../../../lib/is-app-route-route";
|
||||
import { isMetadataRoute } from "../../../lib/metadata/is-metadata-route";
|
||||
import { AppPathnameNormalizer } from "../../../server/future/normalizers/built/app/app-pathname-normalizer";
|
||||
import { AppBundlePathNormalizer } from "../../../server/future/normalizers/built/app/app-bundle-path-normalizer";
|
||||
import { getFilenameAndExtension } from "./next-metadata-route-loader";
|
||||
import { isAppBuiltinNotFoundPage } from "../../utils";
|
||||
import { loadEntrypoint } from "../../load-entrypoint";
|
||||
import { isGroupSegment, DEFAULT_SEGMENT_KEY, PAGE_SEGMENT_KEY } from "../../../shared/lib/segment";
|
||||
import { getFilesInDir } from "../../../lib/get-files-in-dir";
|
||||
import { PARALLEL_ROUTE_DEFAULT_PATH } from "../../../client/components/parallel-route-default";
|
||||
const FILE_TYPES = {
|
||||
layout: "layout",
|
||||
template: "template",
|
||||
error: "error",
|
||||
loading: "loading",
|
||||
"not-found": "not-found"
|
||||
};
|
||||
const GLOBAL_ERROR_FILE_TYPE = "global-error";
|
||||
const PAGE_SEGMENT = "page$";
|
||||
const PARALLEL_CHILDREN_SEGMENT = "children$";
|
||||
const defaultNotFoundPath = "next/dist/client/components/not-found-error";
|
||||
const defaultGlobalErrorPath = "next/dist/client/components/error-boundary";
|
||||
const defaultLayoutPath = "next/dist/client/components/default-layout";
|
||||
async function createAppRouteCode({ name, page, pagePath, resolveAppRoute, pageExtensions, nextConfigOutput }) {
|
||||
// routePath is the path to the route handler file,
|
||||
// but could be aliased e.g. private-next-app-dir/favicon.ico
|
||||
const routePath = pagePath.replace(/[\\/]/, "/");
|
||||
// This, when used with the resolver will give us the pathname to the built
|
||||
// route handler file.
|
||||
let resolvedPagePath = await resolveAppRoute(routePath);
|
||||
if (!resolvedPagePath) {
|
||||
throw new Error(`Invariant: could not resolve page path for ${name} at ${routePath}`);
|
||||
}
|
||||
// If this is a metadata route, then we need to use the metadata loader for
|
||||
// the route to ensure that the route is generated.
|
||||
const filename = path.parse(resolvedPagePath).name;
|
||||
if (isMetadataRoute(name) && filename !== "route") {
|
||||
const { ext } = getFilenameAndExtension(resolvedPagePath);
|
||||
const isDynamic = pageExtensions.includes(ext);
|
||||
resolvedPagePath = `next-metadata-route-loader?${stringify({
|
||||
page,
|
||||
filePath: resolvedPagePath,
|
||||
isDynamic: isDynamic ? "1" : "0"
|
||||
})}!?${WEBPACK_RESOURCE_QUERIES.metadataRoute}`;
|
||||
}
|
||||
const pathname = new AppPathnameNormalizer().normalize(page);
|
||||
const bundlePath = new AppBundlePathNormalizer().normalize(page);
|
||||
return await loadEntrypoint("app-route", {
|
||||
VAR_USERLAND: resolvedPagePath,
|
||||
VAR_DEFINITION_PAGE: page,
|
||||
VAR_DEFINITION_PATHNAME: pathname,
|
||||
VAR_DEFINITION_FILENAME: filename,
|
||||
VAR_DEFINITION_BUNDLE_PATH: bundlePath,
|
||||
VAR_RESOLVED_PAGE_PATH: resolvedPagePath,
|
||||
VAR_ORIGINAL_PATHNAME: page
|
||||
}, {
|
||||
nextConfigOutput: JSON.stringify(nextConfigOutput)
|
||||
});
|
||||
}
|
||||
const normalizeParallelKey = (key)=>key.startsWith("@") ? key.slice(1) : key;
|
||||
const isDirectory = async (pathname)=>{
|
||||
try {
|
||||
const stat = await fs.stat(pathname);
|
||||
return stat.isDirectory();
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
async function createTreeCodeFromPath(pagePath, { page, resolveDir, resolver, resolveParallelSegments, metadataResolver, pageExtensions, basePath, collectedAsyncImports }) {
|
||||
const splittedPath = pagePath.split(/[\\/]/, 1);
|
||||
const isNotFoundRoute = page === UNDERSCORE_NOT_FOUND_ROUTE_ENTRY;
|
||||
const isDefaultNotFound = isAppBuiltinNotFoundPage(pagePath);
|
||||
const appDirPrefix = isDefaultNotFound ? APP_DIR_ALIAS : splittedPath[0];
|
||||
const hasRootNotFound = await resolver(`${appDirPrefix}/${FILE_TYPES["not-found"]}`);
|
||||
const pages = [];
|
||||
let rootLayout;
|
||||
let globalError;
|
||||
async function resolveAdjacentParallelSegments(segmentPath) {
|
||||
const absoluteSegmentPath = await resolveDir(`${appDirPrefix}${segmentPath}`);
|
||||
if (!absoluteSegmentPath) {
|
||||
return [];
|
||||
}
|
||||
const segmentIsDirectory = await isDirectory(absoluteSegmentPath);
|
||||
if (!segmentIsDirectory) {
|
||||
return [];
|
||||
}
|
||||
// We need to resolve all parallel routes in this level.
|
||||
const files = await fs.opendir(absoluteSegmentPath);
|
||||
const parallelSegments = [
|
||||
"children"
|
||||
];
|
||||
for await (const dirent of files){
|
||||
// Make sure name starts with "@" and is a directory.
|
||||
if (dirent.isDirectory() && dirent.name.charCodeAt(0) === 64) {
|
||||
parallelSegments.push(dirent.name);
|
||||
}
|
||||
}
|
||||
return parallelSegments;
|
||||
}
|
||||
async function createSubtreePropsFromSegmentPath(segments, nestedCollectedAsyncImports) {
|
||||
const segmentPath = segments.join("/");
|
||||
// Existing tree are the children of the current segment
|
||||
const props = {};
|
||||
// Root layer could be 1st layer of normal routes
|
||||
const isRootLayer = segments.length === 0;
|
||||
const isRootLayoutOrRootPage = segments.length <= 1;
|
||||
// We need to resolve all parallel routes in this level.
|
||||
const parallelSegments = [];
|
||||
if (isRootLayer) {
|
||||
parallelSegments.push([
|
||||
"children",
|
||||
""
|
||||
]);
|
||||
} else {
|
||||
parallelSegments.push(...resolveParallelSegments(segmentPath));
|
||||
}
|
||||
let metadata = null;
|
||||
const routerDirPath = `${appDirPrefix}${segmentPath}`;
|
||||
// For default not-found, don't traverse the directory to find metadata.
|
||||
const resolvedRouteDir = isDefaultNotFound ? "" : await resolveDir(routerDirPath);
|
||||
if (resolvedRouteDir) {
|
||||
metadata = await createStaticMetadataFromRoute(resolvedRouteDir, {
|
||||
basePath,
|
||||
segment: segmentPath,
|
||||
metadataResolver,
|
||||
isRootLayoutOrRootPage,
|
||||
pageExtensions
|
||||
});
|
||||
}
|
||||
for (const [parallelKey, parallelSegment] of parallelSegments){
|
||||
// if parallelSegment is the page segment (ie, `page$` and not ['page$']), it gets loaded into the __PAGE__ slot
|
||||
// as it's the page for the current route.
|
||||
if (parallelSegment === PAGE_SEGMENT) {
|
||||
const matchedPagePath = `${appDirPrefix}${segmentPath}${parallelKey === "children" ? "" : `/${parallelKey}`}/page`;
|
||||
const resolvedPagePath = await resolver(matchedPagePath);
|
||||
if (resolvedPagePath) {
|
||||
pages.push(resolvedPagePath);
|
||||
nestedCollectedAsyncImports.push(resolvedPagePath);
|
||||
}
|
||||
// Use '' for segment as it's the page. There can't be a segment called '' so this is the safest way to add it.
|
||||
props[normalizeParallelKey(parallelKey)] = `['${PAGE_SEGMENT_KEY}', {}, {
|
||||
page: [() => import(/* webpackMode: "eager" */ ${JSON.stringify(resolvedPagePath)}), ${JSON.stringify(resolvedPagePath)}],
|
||||
${createMetadataExportsCode(metadata)}
|
||||
}]`;
|
||||
if (resolvedPagePath) continue;
|
||||
}
|
||||
// if the parallelSegment was not matched to the __PAGE__ slot, then it's a parallel route at this level.
|
||||
// the code below recursively traverses the parallel slots directory to match the corresponding __PAGE__ for each parallel slot
|
||||
// while also filling in layout/default/etc files into the loader tree at each segment level.
|
||||
const subSegmentPath = [
|
||||
...segments
|
||||
];
|
||||
if (parallelKey !== "children") {
|
||||
// A `children` parallel key should have already been processed in the above segment
|
||||
// So we exclude it when constructing the subsegment path for the remaining segment levels
|
||||
subSegmentPath.push(parallelKey);
|
||||
}
|
||||
const normalizedParallelSegment = Array.isArray(parallelSegment) ? parallelSegment[0] : parallelSegment;
|
||||
if (normalizedParallelSegment !== PAGE_SEGMENT && normalizedParallelSegment !== PARALLEL_CHILDREN_SEGMENT) {
|
||||
// If we don't have a page segment, nor a special $children marker, it means we need to traverse the next directory
|
||||
// (ie, `normalizedParallelSegment` would correspond with the folder that contains the next level of pages/layout/etc)
|
||||
// we push it to the subSegmentPath so that we can fill in the loader tree for that segment.
|
||||
subSegmentPath.push(normalizedParallelSegment);
|
||||
}
|
||||
const { treeCode: pageSubtreeCode } = await createSubtreePropsFromSegmentPath(subSegmentPath, nestedCollectedAsyncImports);
|
||||
const parallelSegmentPath = subSegmentPath.join("/");
|
||||
// Fill in the loader tree for all of the special files types (layout, default, etc) at this level
|
||||
// `page` is not included here as it's added above.
|
||||
const filePaths = await Promise.all(Object.values(FILE_TYPES).map(async (file)=>{
|
||||
return [
|
||||
file,
|
||||
await resolver(`${appDirPrefix}${// TODO-APP: parallelSegmentPath sometimes ends in `/` but sometimes it doesn't. This should be consistent.
|
||||
parallelSegmentPath.endsWith("/") ? parallelSegmentPath : parallelSegmentPath + "/"}${file}`)
|
||||
];
|
||||
}));
|
||||
const definedFilePaths = filePaths.filter(([, filePath])=>filePath !== undefined);
|
||||
// Add default not found error as root not found if not present
|
||||
const hasNotFoundFile = definedFilePaths.some(([type])=>type === "not-found");
|
||||
// If the first layer is a group route, we treat it as root layer
|
||||
const isFirstLayerGroupRoute = segments.length === 1 && subSegmentPath.filter((seg)=>isGroupSegment(seg)).length === 1;
|
||||
if ((isRootLayer || isFirstLayerGroupRoute) && !hasNotFoundFile) {
|
||||
// If you already have a root not found, don't insert default not-found to group routes root
|
||||
if (!(hasRootNotFound && isFirstLayerGroupRoute)) {
|
||||
definedFilePaths.push([
|
||||
"not-found",
|
||||
defaultNotFoundPath
|
||||
]);
|
||||
}
|
||||
}
|
||||
if (!rootLayout) {
|
||||
var _definedFilePaths_find;
|
||||
const layoutPath = (_definedFilePaths_find = definedFilePaths.find(([type])=>type === "layout")) == null ? void 0 : _definedFilePaths_find[1];
|
||||
rootLayout = layoutPath;
|
||||
if (isDefaultNotFound && !layoutPath && !rootLayout) {
|
||||
rootLayout = defaultLayoutPath;
|
||||
definedFilePaths.push([
|
||||
"layout",
|
||||
rootLayout
|
||||
]);
|
||||
}
|
||||
}
|
||||
if (!globalError) {
|
||||
const resolvedGlobalErrorPath = await resolver(`${appDirPrefix}/${GLOBAL_ERROR_FILE_TYPE}`);
|
||||
if (resolvedGlobalErrorPath) {
|
||||
globalError = resolvedGlobalErrorPath;
|
||||
}
|
||||
}
|
||||
let parallelSegmentKey = Array.isArray(parallelSegment) ? parallelSegment[0] : parallelSegment;
|
||||
// normalize the parallel segment key to remove any special markers that we inserted in the
|
||||
// earlier logic (such as children$ and page$). These should never appear in the loader tree, and
|
||||
// should instead be the corresponding segment keys (ie `__PAGE__`) or the `children` parallel route.
|
||||
parallelSegmentKey = parallelSegmentKey === PARALLEL_CHILDREN_SEGMENT ? "children" : parallelSegmentKey === PAGE_SEGMENT ? PAGE_SEGMENT_KEY : parallelSegmentKey;
|
||||
const normalizedParallelKey = normalizeParallelKey(parallelKey);
|
||||
let subtreeCode = pageSubtreeCode;
|
||||
// If it's root not found page, set not-found boundary as children page
|
||||
if (isNotFoundRoute && normalizedParallelKey === "children") {
|
||||
var _definedFilePaths_find1;
|
||||
const notFoundPath = ((_definedFilePaths_find1 = definedFilePaths.find(([type])=>type === "not-found")) == null ? void 0 : _definedFilePaths_find1[1]) ?? defaultNotFoundPath;
|
||||
nestedCollectedAsyncImports.push(notFoundPath);
|
||||
subtreeCode = `{
|
||||
children: [${JSON.stringify(UNDERSCORE_NOT_FOUND_ROUTE)}, {
|
||||
children: ['${PAGE_SEGMENT_KEY}', {}, {
|
||||
page: [
|
||||
() => import(/* webpackMode: "eager" */ ${JSON.stringify(notFoundPath)}),
|
||||
${JSON.stringify(notFoundPath)}
|
||||
]
|
||||
}]
|
||||
}, {}]
|
||||
}`;
|
||||
}
|
||||
const componentsCode = `{
|
||||
${definedFilePaths.map(([file, filePath])=>{
|
||||
if (filePath) nestedCollectedAsyncImports.push(filePath);
|
||||
return `'${file}': [() => import(/* webpackMode: "eager" */ ${JSON.stringify(filePath)}), ${JSON.stringify(filePath)}],`;
|
||||
}).join("\n")}
|
||||
${createMetadataExportsCode(metadata)}
|
||||
}`;
|
||||
props[normalizedParallelKey] = `[
|
||||
'${parallelSegmentKey}',
|
||||
${subtreeCode},
|
||||
${componentsCode}
|
||||
]`;
|
||||
}
|
||||
const adjacentParallelSegments = await resolveAdjacentParallelSegments(segmentPath);
|
||||
for (const adjacentParallelSegment of adjacentParallelSegments){
|
||||
if (!props[normalizeParallelKey(adjacentParallelSegment)]) {
|
||||
const actualSegment = adjacentParallelSegment === "children" ? "" : `/${adjacentParallelSegment}`;
|
||||
// if a default is found, use that. Otherwise use the fallback, which will trigger a `notFound()`
|
||||
const defaultPath = await resolver(`${appDirPrefix}${segmentPath}${actualSegment}/default`) ?? PARALLEL_ROUTE_DEFAULT_PATH;
|
||||
nestedCollectedAsyncImports.push(defaultPath);
|
||||
props[normalizeParallelKey(adjacentParallelSegment)] = `[
|
||||
'${DEFAULT_SEGMENT_KEY}',
|
||||
{},
|
||||
{
|
||||
defaultPage: [() => import(/* webpackMode: "eager" */ ${JSON.stringify(defaultPath)}), ${JSON.stringify(defaultPath)}],
|
||||
}
|
||||
]`;
|
||||
}
|
||||
}
|
||||
return {
|
||||
treeCode: `{
|
||||
${Object.entries(props).map(([key, value])=>`${key}: ${value}`).join(",\n")}
|
||||
}`
|
||||
};
|
||||
}
|
||||
const { treeCode } = await createSubtreePropsFromSegmentPath([], collectedAsyncImports);
|
||||
return {
|
||||
treeCode: `${treeCode}.children;`,
|
||||
pages: `${JSON.stringify(pages)};`,
|
||||
rootLayout,
|
||||
globalError: globalError ?? defaultGlobalErrorPath
|
||||
};
|
||||
}
|
||||
function createAbsolutePath(appDir, pathToTurnAbsolute) {
|
||||
return pathToTurnAbsolute// Replace all POSIX path separators with the current OS path separator
|
||||
.replace(/\//g, path.sep).replace(/^private-next-app-dir/, appDir);
|
||||
}
|
||||
const nextAppLoader = async function nextAppLoader() {
|
||||
const loaderOptions = this.getOptions();
|
||||
const { name, appDir, appPaths, pagePath, pageExtensions, rootDir, tsconfigPath, isDev, nextConfigOutput, preferredRegion, basePath, middlewareConfig: middlewareConfigBase64, nextConfigExperimentalUseEarlyImport } = loaderOptions;
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
const collectedAsyncImports = [];
|
||||
const page = name.replace(/^app/, "");
|
||||
const middlewareConfig = JSON.parse(Buffer.from(middlewareConfigBase64, "base64").toString());
|
||||
buildInfo.route = {
|
||||
page,
|
||||
absolutePagePath: createAbsolutePath(appDir, pagePath),
|
||||
preferredRegion,
|
||||
middlewareConfig
|
||||
};
|
||||
const extensions = pageExtensions.map((extension)=>`.${extension}`);
|
||||
const normalizedAppPaths = typeof appPaths === "string" ? [
|
||||
appPaths
|
||||
] : appPaths || [];
|
||||
const resolveParallelSegments = (pathname)=>{
|
||||
const matched = {};
|
||||
let existingChildrenPath;
|
||||
for (const appPath of normalizedAppPaths){
|
||||
if (appPath.startsWith(pathname + "/")) {
|
||||
const rest = appPath.slice(pathname.length + 1).split("/");
|
||||
// It is the actual page, mark it specially.
|
||||
if (rest.length === 1 && rest[0] === "page") {
|
||||
existingChildrenPath = appPath;
|
||||
matched.children = PAGE_SEGMENT;
|
||||
continue;
|
||||
}
|
||||
const isParallelRoute = rest[0].startsWith("@");
|
||||
if (isParallelRoute) {
|
||||
if (rest.length === 2 && rest[1] === "page") {
|
||||
// We found a parallel route at this level. We don't want to mark it explicitly as the page segment,
|
||||
// as that should be matched to the `children` slot. Instead, we use an array, to signal to `createSubtreePropsFromSegmentPath`
|
||||
// that it needs to recursively fill in the loader tree code for the parallel route at the appropriate levels.
|
||||
matched[rest[0]] = [
|
||||
PAGE_SEGMENT
|
||||
];
|
||||
continue;
|
||||
}
|
||||
// If it was a parallel route but we weren't able to find the page segment (ie, maybe the page is nested further)
|
||||
// we first insert a special marker to ensure that we still process layout/default/etc at the slot level prior to continuing
|
||||
// on to the page segment.
|
||||
matched[rest[0]] = [
|
||||
PARALLEL_CHILDREN_SEGMENT,
|
||||
...rest.slice(1)
|
||||
];
|
||||
continue;
|
||||
}
|
||||
if (existingChildrenPath && matched.children !== rest[0]) {
|
||||
// If we get here, it means we already set a `page` segment earlier in the loop,
|
||||
// meaning we already matched a page to the `children` parallel segment.
|
||||
const isIncomingParallelPage = appPath.includes("@");
|
||||
const hasCurrentParallelPage = existingChildrenPath.includes("@");
|
||||
if (isIncomingParallelPage) {
|
||||
continue;
|
||||
} else if (!hasCurrentParallelPage && !isIncomingParallelPage) {
|
||||
// Both the current `children` and the incoming `children` are regular pages.
|
||||
throw new Error(`You cannot have two parallel pages that resolve to the same path. Please check ${existingChildrenPath} and ${appPath}. Refer to the route group docs for more information: https://nextjs.org/docs/app/building-your-application/routing/route-groups`);
|
||||
}
|
||||
}
|
||||
existingChildrenPath = appPath;
|
||||
matched.children = rest[0];
|
||||
}
|
||||
}
|
||||
return Object.entries(matched);
|
||||
};
|
||||
const resolveDir = (pathToResolve)=>{
|
||||
return createAbsolutePath(appDir, pathToResolve);
|
||||
};
|
||||
const resolveAppRoute = (pathToResolve)=>{
|
||||
return createAbsolutePath(appDir, pathToResolve);
|
||||
};
|
||||
// Cached checker to see if a file exists in a given directory.
|
||||
// This can be more efficient than checking them with `fs.stat` one by one
|
||||
// because all the thousands of files are likely in a few possible directories.
|
||||
// Note that it should only be cached for this compilation, not globally.
|
||||
const filesInDir = new Map();
|
||||
const fileExistsInDirectory = async (dirname, fileName)=>{
|
||||
const existingFiles = filesInDir.get(dirname);
|
||||
if (existingFiles) {
|
||||
return existingFiles.has(fileName);
|
||||
}
|
||||
try {
|
||||
const files = await getFilesInDir(dirname);
|
||||
const fileNames = new Set(files);
|
||||
filesInDir.set(dirname, fileNames);
|
||||
return fileNames.has(fileName);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
const resolver = async (pathname)=>{
|
||||
const absolutePath = createAbsolutePath(appDir, pathname);
|
||||
const filenameIndex = absolutePath.lastIndexOf(path.sep);
|
||||
const dirname = absolutePath.slice(0, filenameIndex);
|
||||
const filename = absolutePath.slice(filenameIndex + 1);
|
||||
let result;
|
||||
for (const ext of extensions){
|
||||
const absolutePathWithExtension = `${absolutePath}${ext}`;
|
||||
if (!result && await fileExistsInDirectory(dirname, `${filename}${ext}`)) {
|
||||
result = absolutePathWithExtension;
|
||||
}
|
||||
// Call `addMissingDependency` for all files even if they didn't match,
|
||||
// because they might be added or removed during development.
|
||||
this.addMissingDependency(absolutePathWithExtension);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
const metadataResolver = async (dirname, filename, exts)=>{
|
||||
const absoluteDir = createAbsolutePath(appDir, dirname);
|
||||
let result;
|
||||
for (const ext of exts){
|
||||
// Compared to `resolver` above the exts do not have the `.` included already, so it's added here.
|
||||
const filenameWithExt = `${filename}.${ext}`;
|
||||
const absolutePathWithExtension = `${absoluteDir}${path.sep}${filenameWithExt}`;
|
||||
if (!result && await fileExistsInDirectory(dirname, filenameWithExt)) {
|
||||
result = absolutePathWithExtension;
|
||||
}
|
||||
// Call `addMissingDependency` for all files even if they didn't match,
|
||||
// because they might be added or removed during development.
|
||||
this.addMissingDependency(absolutePathWithExtension);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
if (isAppRouteRoute(name)) {
|
||||
return createAppRouteCode({
|
||||
// TODO: investigate if the local `page` is the same as the loaderOptions.page
|
||||
page: loaderOptions.page,
|
||||
name,
|
||||
pagePath,
|
||||
resolveAppRoute,
|
||||
pageExtensions,
|
||||
nextConfigOutput
|
||||
});
|
||||
}
|
||||
let treeCodeResult = await createTreeCodeFromPath(pagePath, {
|
||||
page,
|
||||
resolveDir,
|
||||
resolver,
|
||||
metadataResolver,
|
||||
resolveParallelSegments,
|
||||
loaderContext: this,
|
||||
pageExtensions,
|
||||
basePath,
|
||||
collectedAsyncImports
|
||||
});
|
||||
if (!treeCodeResult.rootLayout) {
|
||||
if (!isDev) {
|
||||
// If we're building and missing a root layout, exit the build
|
||||
Log.error(`${bold(pagePath.replace(`${APP_DIR_ALIAS}/`, ""))} doesn't have a root layout. To fix this error, make sure every page has a root layout.`);
|
||||
process.exit(1);
|
||||
} else {
|
||||
// In dev we'll try to create a root layout
|
||||
const [createdRootLayout, rootLayoutPath] = await verifyRootLayout({
|
||||
appDir: appDir,
|
||||
dir: rootDir,
|
||||
tsconfigPath: tsconfigPath,
|
||||
pagePath,
|
||||
pageExtensions
|
||||
});
|
||||
if (!createdRootLayout) {
|
||||
let message = `${bold(pagePath.replace(`${APP_DIR_ALIAS}/`, ""))} doesn't have a root layout. `;
|
||||
if (rootLayoutPath) {
|
||||
var _this__compiler;
|
||||
message += `We tried to create ${bold(path.relative(((_this__compiler = this._compiler) == null ? void 0 : _this__compiler.context) ?? "", rootLayoutPath))} for you but something went wrong.`;
|
||||
} else {
|
||||
message += "To fix this error, make sure every page has a root layout.";
|
||||
}
|
||||
throw new Error(message);
|
||||
}
|
||||
// Clear fs cache, get the new result with the created root layout.
|
||||
filesInDir.clear();
|
||||
treeCodeResult = await createTreeCodeFromPath(pagePath, {
|
||||
page,
|
||||
resolveDir,
|
||||
resolver,
|
||||
metadataResolver,
|
||||
resolveParallelSegments,
|
||||
loaderContext: this,
|
||||
pageExtensions,
|
||||
basePath,
|
||||
collectedAsyncImports
|
||||
});
|
||||
}
|
||||
}
|
||||
const pathname = new AppPathnameNormalizer().normalize(page);
|
||||
// Prefer to modify next/src/server/app-render/entry-base.ts since this is shared with Turbopack.
|
||||
// Any changes to this code should be reflected in Turbopack's app_source.rs and/or app-renderer.tsx as well.
|
||||
const code = await loadEntrypoint("app-page", {
|
||||
VAR_DEFINITION_PAGE: page,
|
||||
VAR_DEFINITION_PATHNAME: pathname,
|
||||
VAR_MODULE_GLOBAL_ERROR: treeCodeResult.globalError,
|
||||
VAR_ORIGINAL_PATHNAME: page
|
||||
}, {
|
||||
tree: treeCodeResult.treeCode,
|
||||
pages: treeCodeResult.pages,
|
||||
__next_app_require__: "__webpack_require__",
|
||||
__next_app_load_chunk__: "() => Promise.resolve()"
|
||||
});
|
||||
// Evaluated the imported modules early in the generated code
|
||||
const earlyEvaluateCode = nextConfigExperimentalUseEarlyImport && process.env.NODE_ENV === "production" ? collectedAsyncImports.map((modulePath)=>{
|
||||
return `import ${JSON.stringify(modulePath)};`;
|
||||
}).join("\n") : "";
|
||||
return earlyEvaluateCode + code;
|
||||
};
|
||||
export default nextAppLoader;
|
||||
|
||||
//# sourceMappingURL=next-app-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-app-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-app-loader.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
248
node_modules/next/dist/esm/build/webpack/loaders/next-barrel-loader.js
generated
vendored
Normal file
248
node_modules/next/dist/esm/build/webpack/loaders/next-barrel-loader.js
generated
vendored
Normal file
@ -0,0 +1,248 @@
|
||||
/**
|
||||
* ## Barrel Optimizations
|
||||
*
|
||||
* This loader is used to optimize the imports of "barrel" files that have many
|
||||
* re-exports. Currently, both Node.js and Webpack have to enter all of these
|
||||
* submodules even if we only need a few of them.
|
||||
*
|
||||
* For example, say a file `foo.js` with the following contents:
|
||||
*
|
||||
* export { a } from './a'
|
||||
* export { b } from './b'
|
||||
* export { c } from './c'
|
||||
* ...
|
||||
*
|
||||
* If the user imports `a` only, this loader will accept the `names` option to
|
||||
* be `['a']`. Then, it request the "__barrel_transform__" SWC transform to load
|
||||
* `foo.js` and receive the following output:
|
||||
*
|
||||
* export const __next_private_export_map__ = '[["a","./a","a"],["b","./b","b"],["c","./c","c"],...]'
|
||||
*
|
||||
* format: '["<imported identifier>", "<import path>", "<exported name>"]'
|
||||
* e.g.: import { a as b } from './module-a' => '["b", "./module-a", "a"]'
|
||||
*
|
||||
* The export map, generated by SWC, is a JSON that represents the exports of
|
||||
* that module, their original file, and their original name (since you can do
|
||||
* `export { a as b }`).
|
||||
*
|
||||
* Then, this loader can safely remove all the exports that are not needed and
|
||||
* re-export the ones from `names`:
|
||||
*
|
||||
* export { a } from './a'
|
||||
*
|
||||
* That's the basic situation and also the happy path.
|
||||
*
|
||||
*
|
||||
*
|
||||
* ## Wildcard Exports
|
||||
*
|
||||
* For wildcard exports (e.g. `export * from './a'`), it becomes a bit more complicated.
|
||||
* Say `foo.js` with the following contents:
|
||||
*
|
||||
* export * from './a'
|
||||
* export * from './b'
|
||||
* export * from './c'
|
||||
* ...
|
||||
*
|
||||
* If the user imports `bar` from it, SWC can never know which files are going to be
|
||||
* exporting `bar`. So, we have to keep all the wildcard exports and do the same
|
||||
* process recursively. This loader will return the following output:
|
||||
*
|
||||
* export * from '__barrel_optimize__?names=bar&wildcard!=!./a'
|
||||
* export * from '__barrel_optimize__?names=bar&wildcard!=!./b'
|
||||
* export * from '__barrel_optimize__?names=bar&wildcard!=!./c'
|
||||
* ...
|
||||
*
|
||||
* The "!=!" tells Webpack to use the same loader to process './a', './b', and './c'.
|
||||
* After the recursive process, the "inner loaders" will either return an empty string
|
||||
* or:
|
||||
*
|
||||
* export * from './target'
|
||||
*
|
||||
* Where `target` is the file that exports `bar`.
|
||||
*
|
||||
*
|
||||
*
|
||||
* ## Non-Barrel Files
|
||||
*
|
||||
* If the file is not a barrel, we can't apply any optimizations. That's because
|
||||
* we can't easily remove things from the file. For example, say `foo.js` with:
|
||||
*
|
||||
* const v = 1
|
||||
* export function b () {
|
||||
* return v
|
||||
* }
|
||||
*
|
||||
* If the user imports `b` only, we can't remove the `const v = 1` even though
|
||||
* the file is side-effect free. In these caes, this loader will simply re-export
|
||||
* `foo.js`:
|
||||
*
|
||||
* export * from './foo'
|
||||
*
|
||||
* Besides these cases, this loader also carefully handles the module cache so
|
||||
* SWC won't analyze the same file twice, and no instance of the same file will
|
||||
* be accidentally created as different instances.
|
||||
*/ import path from "path";
|
||||
import { transform } from "../../swc";
|
||||
// This is a in-memory cache for the mapping of barrel exports. This only applies
|
||||
// to the packages that we optimize. It will never change (e.g. upgrading packages)
|
||||
// during the lifetime of the server so we can safely cache it.
|
||||
// There is also no need to collect the cache for the same reason.
|
||||
const barrelTransformMappingCache = new Map();
|
||||
async function getBarrelMapping(resourcePath, swcCacheDir, resolve, fs) {
|
||||
if (barrelTransformMappingCache.has(resourcePath)) {
|
||||
return barrelTransformMappingCache.get(resourcePath);
|
||||
}
|
||||
// This is a SWC transform specifically for `optimizeBarrelExports`. We don't
|
||||
// care about other things but the export map only.
|
||||
async function transpileSource(filename, source, isWildcard) {
|
||||
const isTypeScript = filename.endsWith(".ts") || filename.endsWith(".tsx");
|
||||
return new Promise((res)=>transform(source, {
|
||||
filename,
|
||||
inputSourceMap: undefined,
|
||||
sourceFileName: filename,
|
||||
optimizeBarrelExports: {
|
||||
wildcard: isWildcard
|
||||
},
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: isTypeScript ? "typescript" : "ecmascript",
|
||||
[isTypeScript ? "tsx" : "jsx"]: true
|
||||
},
|
||||
experimental: {
|
||||
cacheRoot: swcCacheDir
|
||||
}
|
||||
}
|
||||
}).then((output)=>{
|
||||
res(output.code);
|
||||
}));
|
||||
}
|
||||
// Avoid circular `export *` dependencies
|
||||
const visited = new Set();
|
||||
async function getMatches(file, isWildcard, isClientEntry) {
|
||||
if (visited.has(file)) {
|
||||
return null;
|
||||
}
|
||||
visited.add(file);
|
||||
const source = await new Promise((res, rej)=>{
|
||||
fs.readFile(file, (err, data)=>{
|
||||
if (err || data === undefined) {
|
||||
rej(err);
|
||||
} else {
|
||||
res(data.toString());
|
||||
}
|
||||
});
|
||||
});
|
||||
const output = await transpileSource(file, source, isWildcard);
|
||||
const matches = output.match(/^([^]*)export (const|var) __next_private_export_map__ = ('[^']+'|"[^"]+")/);
|
||||
if (!matches) {
|
||||
return null;
|
||||
}
|
||||
const matchedDirectives = output.match(/^([^]*)export (const|var) __next_private_directive_list__ = '([^']+)'/);
|
||||
const directiveList = matchedDirectives ? JSON.parse(matchedDirectives[3]) : [];
|
||||
// "use client" in barrel files has to be transferred to the target file.
|
||||
isClientEntry = directiveList.includes("use client");
|
||||
let exportList = JSON.parse(matches[3].slice(1, -1));
|
||||
const wildcardExports = [
|
||||
...output.matchAll(/export \* from "([^"]+)"/g)
|
||||
].map((match)=>match[1]);
|
||||
// In the wildcard case, if the value is exported from another file, we
|
||||
// redirect to that file (decl[0]). Otherwise, export from the current
|
||||
// file itself.
|
||||
if (isWildcard) {
|
||||
for (const decl of exportList){
|
||||
decl[1] = file;
|
||||
decl[2] = decl[0];
|
||||
}
|
||||
}
|
||||
// This recursively handles the wildcard exports (e.g. `export * from './a'`)
|
||||
if (wildcardExports.length) {
|
||||
await Promise.all(wildcardExports.map(async (req)=>{
|
||||
const targetPath = await resolve(path.dirname(file), req.replace("__barrel_optimize__?names=__PLACEHOLDER__!=!", ""));
|
||||
const targetMatches = await getMatches(targetPath, true, isClientEntry);
|
||||
if (targetMatches) {
|
||||
// Merge the export list
|
||||
exportList = exportList.concat(targetMatches.exportList);
|
||||
}
|
||||
}));
|
||||
}
|
||||
return {
|
||||
exportList,
|
||||
wildcardExports,
|
||||
isClientEntry
|
||||
};
|
||||
}
|
||||
const res = await getMatches(resourcePath, false, false);
|
||||
barrelTransformMappingCache.set(resourcePath, res);
|
||||
return res;
|
||||
}
|
||||
const NextBarrelLoader = async function() {
|
||||
this.async();
|
||||
this.cacheable(true);
|
||||
const { names, swcCacheDir } = this.getOptions();
|
||||
// For barrel optimizations, we always prefer the "module" field over the
|
||||
// "main" field because ESM handling is more robust with better tree-shaking.
|
||||
const resolve = this.getResolve({
|
||||
mainFields: [
|
||||
"module",
|
||||
"main"
|
||||
]
|
||||
});
|
||||
const mapping = await getBarrelMapping(this.resourcePath, swcCacheDir, resolve, this.fs);
|
||||
// `resolve` adds all sub-paths to the dependency graph. However, we already
|
||||
// cached the mapping and we assume them to not change. So, we can safely
|
||||
// clear the dependencies here to avoid unnecessary watchers which turned out
|
||||
// to be very expensive.
|
||||
this.clearDependencies();
|
||||
if (!mapping) {
|
||||
// This file isn't a barrel and we can't apply any optimizations. Let's re-export everything.
|
||||
// Since this loader accepts `names` and the request is keyed with `names`, we can't simply
|
||||
// return the original source here. That will create these imports with different names as
|
||||
// different modules instances.
|
||||
this.callback(null, `export * from ${JSON.stringify(this.resourcePath)}`);
|
||||
return;
|
||||
}
|
||||
const exportList = mapping.exportList;
|
||||
const isClientEntry = mapping.isClientEntry;
|
||||
const exportMap = new Map();
|
||||
for (const [name, filePath, orig] of exportList){
|
||||
exportMap.set(name, [
|
||||
filePath,
|
||||
orig
|
||||
]);
|
||||
}
|
||||
let output = "";
|
||||
let missedNames = [];
|
||||
for (const name of names){
|
||||
// If the name matches
|
||||
if (exportMap.has(name)) {
|
||||
const decl = exportMap.get(name);
|
||||
if (decl[1] === "*") {
|
||||
output += `\nexport * as ${name} from ${JSON.stringify(decl[0])}`;
|
||||
} else if (decl[1] === "default") {
|
||||
output += `\nexport { default as ${name} } from ${JSON.stringify(decl[0])}`;
|
||||
} else if (decl[1] === name) {
|
||||
output += `\nexport { ${name} } from ${JSON.stringify(decl[0])}`;
|
||||
} else {
|
||||
output += `\nexport { ${decl[1]} as ${name} } from ${JSON.stringify(decl[0])}`;
|
||||
}
|
||||
} else {
|
||||
missedNames.push(name);
|
||||
}
|
||||
}
|
||||
// These are from wildcard exports.
|
||||
if (missedNames.length > 0) {
|
||||
for (const req of mapping.wildcardExports){
|
||||
output += `\nexport * from ${JSON.stringify(req.replace("__PLACEHOLDER__", missedNames.join(",") + "&wildcard"))}`;
|
||||
}
|
||||
}
|
||||
// When it has `"use client"` inherited from its barrel files, we need to
|
||||
// prefix it to this target file as well.
|
||||
if (isClientEntry) {
|
||||
output = `"use client";\n${output}`;
|
||||
}
|
||||
this.callback(null, output);
|
||||
};
|
||||
export default NextBarrelLoader;
|
||||
|
||||
//# sourceMappingURL=next-barrel-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-barrel-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-barrel-loader.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
27
node_modules/next/dist/esm/build/webpack/loaders/next-client-pages-loader.js
generated
vendored
Normal file
27
node_modules/next/dist/esm/build/webpack/loaders/next-client-pages-loader.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
import { stringifyRequest } from "../stringify-request";
|
||||
// this parameter: https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters
|
||||
function nextClientPagesLoader() {
|
||||
const pagesLoaderSpan = this.currentTraceSpan.traceChild("next-client-pages-loader");
|
||||
return pagesLoaderSpan.traceFn(()=>{
|
||||
const { absolutePagePath, page } = this.getOptions();
|
||||
pagesLoaderSpan.setAttribute("absolutePagePath", absolutePagePath);
|
||||
const stringifiedPageRequest = stringifyRequest(this, absolutePagePath);
|
||||
const stringifiedPage = JSON.stringify(page);
|
||||
return `
|
||||
(window.__NEXT_P = window.__NEXT_P || []).push([
|
||||
${stringifiedPage},
|
||||
function () {
|
||||
return require(${stringifiedPageRequest});
|
||||
}
|
||||
]);
|
||||
if(module.hot) {
|
||||
module.hot.dispose(function () {
|
||||
window.__NEXT_P.push([${stringifiedPage}])
|
||||
});
|
||||
}
|
||||
`;
|
||||
});
|
||||
}
|
||||
export default nextClientPagesLoader;
|
||||
|
||||
//# sourceMappingURL=next-client-pages-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-client-pages-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-client-pages-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-client-pages-loader.ts"],"names":["stringifyRequest","nextClientPagesLoader","pagesLoaderSpan","currentTraceSpan","traceChild","traceFn","absolutePagePath","page","getOptions","setAttribute","stringifiedPageRequest","stringifiedPage","JSON","stringify"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,uBAAsB;AAOvD,8FAA8F;AAC9F,SAASC;IACP,MAAMC,kBAAkB,IAAI,CAACC,gBAAgB,CAACC,UAAU,CACtD;IAGF,OAAOF,gBAAgBG,OAAO,CAAC;QAC7B,MAAM,EAAEC,gBAAgB,EAAEC,IAAI,EAAE,GAC9B,IAAI,CAACC,UAAU;QAEjBN,gBAAgBO,YAAY,CAAC,oBAAoBH;QAEjD,MAAMI,yBAAyBV,iBAAiB,IAAI,EAAEM;QACtD,MAAMK,kBAAkBC,KAAKC,SAAS,CAACN;QAEvC,OAAO,CAAC;;MAEN,EAAEI,gBAAgB;;uBAED,EAAED,uBAAuB;;;;;8BAKlB,EAAEC,gBAAgB;;;EAG9C,CAAC;IACD;AACF;AAEA,eAAeV,sBAAqB"}
|
||||
31
node_modules/next/dist/esm/build/webpack/loaders/next-edge-app-route-loader/index.js
generated
vendored
Normal file
31
node_modules/next/dist/esm/build/webpack/loaders/next-edge-app-route-loader/index.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
import { getModuleBuildInfo } from "../get-module-build-info";
|
||||
import { stringifyRequest } from "../../stringify-request";
|
||||
import { WEBPACK_RESOURCE_QUERIES } from "../../../../lib/constants";
|
||||
import { loadEntrypoint } from "../../../load-entrypoint";
|
||||
const EdgeAppRouteLoader = async function() {
|
||||
const { page, absolutePagePath, preferredRegion, appDirLoader: appDirLoaderBase64 = "", middlewareConfig: middlewareConfigBase64 = "" } = this.getOptions();
|
||||
const appDirLoader = Buffer.from(appDirLoaderBase64, "base64").toString();
|
||||
const middlewareConfig = JSON.parse(Buffer.from(middlewareConfigBase64, "base64").toString());
|
||||
// Ensure we only run this loader for as a module.
|
||||
if (!this._module) throw new Error("This loader is only usable as a module");
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
buildInfo.nextEdgeSSR = {
|
||||
isServerComponent: false,
|
||||
page: page,
|
||||
isAppDir: true
|
||||
};
|
||||
buildInfo.route = {
|
||||
page,
|
||||
absolutePagePath,
|
||||
preferredRegion,
|
||||
middlewareConfig
|
||||
};
|
||||
const stringifiedPagePath = stringifyRequest(this, absolutePagePath);
|
||||
const modulePath = `${appDirLoader}${stringifiedPagePath.substring(1, stringifiedPagePath.length - 1)}?${WEBPACK_RESOURCE_QUERIES.edgeSSREntry}`;
|
||||
return await loadEntrypoint("edge-app-route", {
|
||||
VAR_USERLAND: modulePath
|
||||
});
|
||||
};
|
||||
export default EdgeAppRouteLoader;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-edge-app-route-loader/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-edge-app-route-loader/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-edge-app-route-loader/index.ts"],"names":["getModuleBuildInfo","stringifyRequest","WEBPACK_RESOURCE_QUERIES","loadEntrypoint","EdgeAppRouteLoader","page","absolutePagePath","preferredRegion","appDirLoader","appDirLoaderBase64","middlewareConfig","middlewareConfigBase64","getOptions","Buffer","from","toString","JSON","parse","_module","Error","buildInfo","nextEdgeSSR","isServerComponent","isAppDir","route","stringifiedPagePath","modulePath","substring","length","edgeSSREntry","VAR_USERLAND"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,gBAAgB,QAAQ,0BAAyB;AAG1D,SAASC,wBAAwB,QAAQ,4BAA2B;AAEpE,SAASC,cAAc,QAAQ,2BAA0B;AAWzD,MAAMC,qBACJ;IACE,MAAM,EACJC,IAAI,EACJC,gBAAgB,EAChBC,eAAe,EACfC,cAAcC,qBAAqB,EAAE,EACrCC,kBAAkBC,yBAAyB,EAAE,EAC9C,GAAG,IAAI,CAACC,UAAU;IAEnB,MAAMJ,eAAeK,OAAOC,IAAI,CAACL,oBAAoB,UAAUM,QAAQ;IACvE,MAAML,mBAAqCM,KAAKC,KAAK,CACnDJ,OAAOC,IAAI,CAACH,wBAAwB,UAAUI,QAAQ;IAGxD,kDAAkD;IAClD,IAAI,CAAC,IAAI,CAACG,OAAO,EAAE,MAAM,IAAIC,MAAM;IAEnC,MAAMC,YAAYpB,mBAAmB,IAAI,CAACkB,OAAO;IAEjDE,UAAUC,WAAW,GAAG;QACtBC,mBAAmB;QACnBjB,MAAMA;QACNkB,UAAU;IACZ;IACAH,UAAUI,KAAK,GAAG;QAChBnB;QACAC;QACAC;QACAG;IACF;IAEA,MAAMe,sBAAsBxB,iBAAiB,IAAI,EAAEK;IACnD,MAAMoB,aAAa,CAAC,EAAElB,aAAa,EAAEiB,oBAAoBE,SAAS,CAChE,GACAF,oBAAoBG,MAAM,GAAG,GAC7B,CAAC,EAAE1B,yBAAyB2B,YAAY,CAAC,CAAC;IAE5C,OAAO,MAAM1B,eAAe,kBAAkB;QAC5C2B,cAAcJ;IAChB;AACF;AAEF,eAAetB,mBAAkB"}
|
||||
42
node_modules/next/dist/esm/build/webpack/loaders/next-edge-function-loader.js
generated
vendored
Normal file
42
node_modules/next/dist/esm/build/webpack/loaders/next-edge-function-loader.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
import { getModuleBuildInfo } from "./get-module-build-info";
|
||||
import { stringifyRequest } from "../stringify-request";
|
||||
const nextEdgeFunctionLoader = function nextEdgeFunctionLoader() {
|
||||
const { absolutePagePath, page, rootDir, preferredRegion, middlewareConfig: middlewareConfigBase64 } = this.getOptions();
|
||||
const stringifiedPagePath = stringifyRequest(this, absolutePagePath);
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
const middlewareConfig = JSON.parse(Buffer.from(middlewareConfigBase64, "base64").toString());
|
||||
buildInfo.route = {
|
||||
page: page || "/",
|
||||
absolutePagePath,
|
||||
preferredRegion,
|
||||
middlewareConfig
|
||||
};
|
||||
buildInfo.nextEdgeApiFunction = {
|
||||
page: page || "/"
|
||||
};
|
||||
buildInfo.rootDir = rootDir;
|
||||
return `
|
||||
import 'next/dist/esm/server/web/globals'
|
||||
import { adapter } from 'next/dist/esm/server/web/adapter'
|
||||
import { IncrementalCache } from 'next/dist/esm/server/lib/incremental-cache'
|
||||
import { wrapApiHandler } from 'next/dist/esm/server/api-utils'
|
||||
|
||||
import handler from ${stringifiedPagePath}
|
||||
|
||||
if (typeof handler !== 'function') {
|
||||
throw new Error('The Edge Function "pages${page}" must export a \`default\` function');
|
||||
}
|
||||
|
||||
export default function nHandler (opts) {
|
||||
return adapter({
|
||||
...opts,
|
||||
IncrementalCache,
|
||||
page: ${JSON.stringify(page)},
|
||||
handler: wrapApiHandler(${JSON.stringify(page)}, handler),
|
||||
})
|
||||
}
|
||||
`;
|
||||
};
|
||||
export default nextEdgeFunctionLoader;
|
||||
|
||||
//# sourceMappingURL=next-edge-function-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-edge-function-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-edge-function-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-edge-function-loader.ts"],"names":["getModuleBuildInfo","stringifyRequest","nextEdgeFunctionLoader","absolutePagePath","page","rootDir","preferredRegion","middlewareConfig","middlewareConfigBase64","getOptions","stringifiedPagePath","buildInfo","_module","JSON","parse","Buffer","from","toString","route","nextEdgeApiFunction","stringify"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,gBAAgB,QAAQ,uBAAsB;AAWvD,MAAMC,yBACJ,SAASA;IACP,MAAM,EACJC,gBAAgB,EAChBC,IAAI,EACJC,OAAO,EACPC,eAAe,EACfC,kBAAkBC,sBAAsB,EACzC,GAA8B,IAAI,CAACC,UAAU;IAC9C,MAAMC,sBAAsBT,iBAAiB,IAAI,EAAEE;IACnD,MAAMQ,YAAYX,mBAAmB,IAAI,CAACY,OAAO;IACjD,MAAML,mBAAqCM,KAAKC,KAAK,CACnDC,OAAOC,IAAI,CAACR,wBAAwB,UAAUS,QAAQ;IAExDN,UAAUO,KAAK,GAAG;QAChBd,MAAMA,QAAQ;QACdD;QACAG;QACAC;IACF;IACAI,UAAUQ,mBAAmB,GAAG;QAC9Bf,MAAMA,QAAQ;IAChB;IACAO,UAAUN,OAAO,GAAGA;IAEpB,OAAO,CAAC;;;;;;4BAMgB,EAAEK,oBAAoB;;;mDAGC,EAAEN,KAAK;;;;;;;oBAOtC,EAAES,KAAKO,SAAS,CAAChB,MAAM;sCACL,EAAES,KAAKO,SAAS,CAAChB,MAAM;;;IAGzD,CAAC;AACH;AAEF,eAAeF,uBAAsB"}
|
||||
90
node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/index.js
generated
vendored
Normal file
90
node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/index.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
import { getModuleBuildInfo } from "../get-module-build-info";
|
||||
import { WEBPACK_RESOURCE_QUERIES } from "../../../../lib/constants";
|
||||
import { RouteKind } from "../../../../server/future/route-kind";
|
||||
import { normalizePagePath } from "../../../../shared/lib/page-path/normalize-page-path";
|
||||
import { loadEntrypoint } from "../../../load-entrypoint";
|
||||
/*
|
||||
For pages SSR'd at the edge, we bundle them with the ESM version of Next in order to
|
||||
benefit from the better tree-shaking and thus, smaller bundle sizes.
|
||||
|
||||
The absolute paths for _app, _error and _document, used in this loader, link to the regular CJS modules.
|
||||
They are generated in `createPagesMapping` where we don't have access to `isEdgeRuntime`,
|
||||
so we have to do it here. It's not that bad because it keeps all references to ESM modules magic in this place.
|
||||
*/ function swapDistFolderWithEsmDistFolder(path) {
|
||||
return path.replace("next/dist/pages", "next/dist/esm/pages");
|
||||
}
|
||||
function getRouteModuleOptions(page) {
|
||||
const options = {
|
||||
definition: {
|
||||
kind: RouteKind.PAGES,
|
||||
page: normalizePagePath(page),
|
||||
pathname: page,
|
||||
// The following aren't used in production.
|
||||
bundlePath: "",
|
||||
filename: ""
|
||||
}
|
||||
};
|
||||
return options;
|
||||
}
|
||||
const edgeSSRLoader = async function edgeSSRLoader() {
|
||||
const { dev, page, absolutePagePath, absoluteAppPath, absoluteDocumentPath, absolute500Path, absoluteErrorPath, isServerComponent, stringifiedConfig: stringifiedConfigBase64, appDirLoader: appDirLoaderBase64, pagesType, sriEnabled, cacheHandler, preferredRegion, middlewareConfig: middlewareConfigBase64, serverActions } = this.getOptions();
|
||||
const middlewareConfig = JSON.parse(Buffer.from(middlewareConfigBase64, "base64").toString());
|
||||
const stringifiedConfig = Buffer.from(stringifiedConfigBase64 || "", "base64").toString();
|
||||
const appDirLoader = Buffer.from(appDirLoaderBase64 || "", "base64").toString();
|
||||
const isAppDir = pagesType === "app";
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
buildInfo.nextEdgeSSR = {
|
||||
isServerComponent,
|
||||
page: page,
|
||||
isAppDir
|
||||
};
|
||||
buildInfo.route = {
|
||||
page,
|
||||
absolutePagePath,
|
||||
preferredRegion,
|
||||
middlewareConfig
|
||||
};
|
||||
const pagePath = this.utils.contextify(this.context || this.rootContext, absolutePagePath);
|
||||
const appPath = this.utils.contextify(this.context || this.rootContext, swapDistFolderWithEsmDistFolder(absoluteAppPath));
|
||||
const errorPath = this.utils.contextify(this.context || this.rootContext, swapDistFolderWithEsmDistFolder(absoluteErrorPath));
|
||||
const documentPath = this.utils.contextify(this.context || this.rootContext, swapDistFolderWithEsmDistFolder(absoluteDocumentPath));
|
||||
const userland500Path = absolute500Path ? this.utils.contextify(this.context || this.rootContext, swapDistFolderWithEsmDistFolder(absolute500Path)) : null;
|
||||
const stringifiedPagePath = JSON.stringify(pagePath);
|
||||
const pageModPath = `${appDirLoader}${stringifiedPagePath.substring(1, stringifiedPagePath.length - 1)}${isAppDir ? `?${WEBPACK_RESOURCE_QUERIES.edgeSSREntry}` : ""}`;
|
||||
if (isAppDir) {
|
||||
return await loadEntrypoint("edge-ssr-app", {
|
||||
VAR_USERLAND: pageModPath,
|
||||
VAR_PAGE: page
|
||||
}, {
|
||||
sriEnabled: JSON.stringify(sriEnabled),
|
||||
nextConfig: stringifiedConfig,
|
||||
isServerComponent: JSON.stringify(isServerComponent),
|
||||
dev: JSON.stringify(dev),
|
||||
serverActions: typeof serverActions === "undefined" ? "undefined" : JSON.stringify(serverActions)
|
||||
}, {
|
||||
incrementalCacheHandler: cacheHandler ?? null
|
||||
});
|
||||
} else {
|
||||
return await loadEntrypoint("edge-ssr", {
|
||||
VAR_USERLAND: pageModPath,
|
||||
VAR_PAGE: page,
|
||||
VAR_MODULE_DOCUMENT: documentPath,
|
||||
VAR_MODULE_APP: appPath,
|
||||
VAR_MODULE_GLOBAL_ERROR: errorPath
|
||||
}, {
|
||||
pagesType: JSON.stringify(pagesType),
|
||||
sriEnabled: JSON.stringify(sriEnabled),
|
||||
nextConfig: stringifiedConfig,
|
||||
dev: JSON.stringify(dev),
|
||||
pageRouteModuleOptions: JSON.stringify(getRouteModuleOptions(page)),
|
||||
errorRouteModuleOptions: JSON.stringify(getRouteModuleOptions("/_error")),
|
||||
user500RouteModuleOptions: JSON.stringify(getRouteModuleOptions("/500"))
|
||||
}, {
|
||||
userland500Page: userland500Path,
|
||||
incrementalCacheHandler: cacheHandler ?? null
|
||||
});
|
||||
}
|
||||
};
|
||||
export default edgeSSRLoader;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-edge-ssr-loader/index.ts"],"names":["getModuleBuildInfo","WEBPACK_RESOURCE_QUERIES","RouteKind","normalizePagePath","loadEntrypoint","swapDistFolderWithEsmDistFolder","path","replace","getRouteModuleOptions","page","options","definition","kind","PAGES","pathname","bundlePath","filename","edgeSSRLoader","dev","absolutePagePath","absoluteAppPath","absoluteDocumentPath","absolute500Path","absoluteErrorPath","isServerComponent","stringifiedConfig","stringifiedConfigBase64","appDirLoader","appDirLoaderBase64","pagesType","sriEnabled","cacheHandler","preferredRegion","middlewareConfig","middlewareConfigBase64","serverActions","getOptions","JSON","parse","Buffer","from","toString","isAppDir","buildInfo","_module","nextEdgeSSR","route","pagePath","utils","contextify","context","rootContext","appPath","errorPath","documentPath","userland500Path","stringifiedPagePath","stringify","pageModPath","substring","length","edgeSSREntry","VAR_USERLAND","VAR_PAGE","nextConfig","incrementalCacheHandler","VAR_MODULE_DOCUMENT","VAR_MODULE_APP","VAR_MODULE_GLOBAL_ERROR","pageRouteModuleOptions","errorRouteModuleOptions","user500RouteModuleOptions","userland500Page"],"mappings":"AAKA,SAASA,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,4BAA2B;AACpE,SAASC,SAAS,QAAQ,uCAAsC;AAChE,SAASC,iBAAiB,QAAQ,uDAAsD;AACxF,SAASC,cAAc,QAAQ,2BAA0B;AAyBzD;;;;;;;AAOA,GACA,SAASC,gCAAgCC,IAAY;IACnD,OAAOA,KAAKC,OAAO,CAAC,mBAAmB;AACzC;AAEA,SAASC,sBAAsBC,IAAY;IACzC,MAAMC,UAAoE;QACxEC,YAAY;YACVC,MAAMV,UAAUW,KAAK;YACrBJ,MAAMN,kBAAkBM;YACxBK,UAAUL;YACV,2CAA2C;YAC3CM,YAAY;YACZC,UAAU;QACZ;IACF;IAEA,OAAON;AACT;AAEA,MAAMO,gBACJ,eAAeA;IACb,MAAM,EACJC,GAAG,EACHT,IAAI,EACJU,gBAAgB,EAChBC,eAAe,EACfC,oBAAoB,EACpBC,eAAe,EACfC,iBAAiB,EACjBC,iBAAiB,EACjBC,mBAAmBC,uBAAuB,EAC1CC,cAAcC,kBAAkB,EAChCC,SAAS,EACTC,UAAU,EACVC,YAAY,EACZC,eAAe,EACfC,kBAAkB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ElB,WAAW,CAAC,CAAC,EAAEzC,yBAAyB4D,YAAY,CAAC,CAAC,GAAG,GAAG,CAAC;IAEjE,IAAInB,UAAU;QACZ,OAAO,MAAMtC,eACX,gBACA;YACE0D,cAAcJ;YACdK,UAAUtD;QACZ,GACA;YACEqB,YAAYO,KAAKoB,SAAS,CAAC3B;YAC3BkC,YAAYvC;YACZD,mBAAmBa,KAAKoB,SAAS,CAACjC;YAClCN,KAAKmB,KAAKoB,SAAS,CAACvC;YACpBiB,eACE,OAAOA,kBAAkB,cACrB,cACAE,KAAKoB,SAAS,CAACtB;QACvB,GACA;YACE8B,yBAAyBlC,gBAAgB;QAC3C;IAEJ,OAAO;QACL,OAAO,MAAM3B,eACX,YACA;YACE0D,cAAcJ;YACdK,UAAUtD;YACVyD,qBAAqBZ;YACrBa,gBAAgBf;YAChBgB,yBAAyBf;QAC3B,GACA;YACExB,WAAWQ,KAAKoB,SAAS,CAAC5B;YAC1BC,YAAYO,KAAKoB,SAAS,CAAC3B;YAC3BkC,YAAYvC;YACZP,KAAKmB,KAAKoB,SAAS,CAACvC;YACpBmD,wBAAwBhC,KAAKoB,SAAS,CAACjD,sBAAsBC;YAC7D6D,yBAAyBjC,KAAKoB,SAAS,CACrCjD,sBAAsB;YAExB+D,2BAA2BlC,KAAKoB,SAAS,CACvCjD,sBAAsB;QAE1B,GACA;YACEgE,iBAAiBjB;YACjBU,yBAAyBlC,gBAAgB;QAC3C;IAEJ;AACF;AACF,eAAed,cAAa"}
|
||||
99
node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/render.js
generated
vendored
Normal file
99
node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/render.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
import WebServer from "../../../../server/web-server";
|
||||
import { WebNextRequest, WebNextResponse } from "../../../../server/base-http/web";
|
||||
import { SERVER_RUNTIME } from "../../../../lib/constants";
|
||||
import { normalizeAppPath } from "../../../../shared/lib/router/utils/app-paths";
|
||||
import { internal_getCurrentFunctionWaitUntil } from "../../../../server/web/internal-edge-wait-until";
|
||||
export function getRender({ dev, page, appMod, pageMod, errorMod, error500Mod, pagesType, Document, buildManifest, reactLoadableManifest, interceptionRouteRewrites, renderToHTML, clientReferenceManifest, subresourceIntegrityManifest, serverActionsManifest, serverActions, config, buildId, nextFontManifest, incrementalCacheHandler }) {
|
||||
const isAppPath = pagesType === "app";
|
||||
const baseLoadComponentResult = {
|
||||
dev,
|
||||
buildManifest,
|
||||
reactLoadableManifest,
|
||||
subresourceIntegrityManifest,
|
||||
Document,
|
||||
App: appMod == null ? void 0 : appMod.default,
|
||||
clientReferenceManifest
|
||||
};
|
||||
const server = new WebServer({
|
||||
dev,
|
||||
conf: config,
|
||||
minimalMode: true,
|
||||
webServerConfig: {
|
||||
page,
|
||||
pathname: isAppPath ? normalizeAppPath(page) : page,
|
||||
pagesType,
|
||||
interceptionRouteRewrites,
|
||||
extendRenderOpts: {
|
||||
buildId,
|
||||
runtime: SERVER_RUNTIME.experimentalEdge,
|
||||
supportsDynamicResponse: true,
|
||||
disableOptimizedLoading: true,
|
||||
serverActionsManifest,
|
||||
serverActions,
|
||||
nextFontManifest
|
||||
},
|
||||
renderToHTML,
|
||||
incrementalCacheHandler,
|
||||
loadComponent: async (inputPage)=>{
|
||||
if (inputPage === page) {
|
||||
return {
|
||||
...baseLoadComponentResult,
|
||||
Component: pageMod.default,
|
||||
pageConfig: pageMod.config || {},
|
||||
getStaticProps: pageMod.getStaticProps,
|
||||
getServerSideProps: pageMod.getServerSideProps,
|
||||
getStaticPaths: pageMod.getStaticPaths,
|
||||
ComponentMod: pageMod,
|
||||
isAppPath: !!pageMod.__next_app__,
|
||||
page: inputPage,
|
||||
routeModule: pageMod.routeModule
|
||||
};
|
||||
}
|
||||
// If there is a custom 500 page, we need to handle it separately.
|
||||
if (inputPage === "/500" && error500Mod) {
|
||||
return {
|
||||
...baseLoadComponentResult,
|
||||
Component: error500Mod.default,
|
||||
pageConfig: error500Mod.config || {},
|
||||
getStaticProps: error500Mod.getStaticProps,
|
||||
getServerSideProps: error500Mod.getServerSideProps,
|
||||
getStaticPaths: error500Mod.getStaticPaths,
|
||||
ComponentMod: error500Mod,
|
||||
page: inputPage,
|
||||
routeModule: error500Mod.routeModule
|
||||
};
|
||||
}
|
||||
if (inputPage === "/_error") {
|
||||
return {
|
||||
...baseLoadComponentResult,
|
||||
Component: errorMod.default,
|
||||
pageConfig: errorMod.config || {},
|
||||
getStaticProps: errorMod.getStaticProps,
|
||||
getServerSideProps: errorMod.getServerSideProps,
|
||||
getStaticPaths: errorMod.getStaticPaths,
|
||||
ComponentMod: errorMod,
|
||||
page: inputPage,
|
||||
routeModule: errorMod.routeModule
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
const handler = server.getRequestHandler();
|
||||
return async function render(request, event) {
|
||||
const extendedReq = new WebNextRequest(request);
|
||||
const extendedRes = new WebNextResponse();
|
||||
handler(extendedReq, extendedRes);
|
||||
const result = await extendedRes.toResponse();
|
||||
if (event == null ? void 0 : event.waitUntil) {
|
||||
const waitUntilPromise = internal_getCurrentFunctionWaitUntil();
|
||||
if (waitUntilPromise) {
|
||||
event.waitUntil(waitUntilPromise);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=render.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/render.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/render.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-edge-ssr-loader/render.ts"],"names":["WebServer","WebNextRequest","WebNextResponse","SERVER_RUNTIME","normalizeAppPath","internal_getCurrentFunctionWaitUntil","getRender","dev","page","appMod","pageMod","errorMod","error500Mod","pagesType","Document","buildManifest","reactLoadableManifest","interceptionRouteRewrites","renderToHTML","clientReferenceManifest","subresourceIntegrityManifest","serverActionsManifest","serverActions","config","buildId","nextFontManifest","incrementalCacheHandler","isAppPath","baseLoadComponentResult","App","default","server","conf","minimalMode","webServerConfig","pathname","extendRenderOpts","runtime","experimentalEdge","supportsDynamicResponse","disableOptimizedLoading","loadComponent","inputPage","Component","pageConfig","getStaticProps","getServerSideProps","getStaticPaths","ComponentMod","__next_app__","routeModule","handler","getRequestHandler","render","request","event","extendedReq","extendedRes","result","toResponse","waitUntil","waitUntilPromise"],"mappings":"AASA,OAAOA,eAAe,gCAA+B;AACrD,SACEC,cAAc,EACdC,eAAe,QACV,mCAAkC;AACzC,SAASC,cAAc,QAAQ,4BAA2B;AAE1D,SAASC,gBAAgB,QAAQ,gDAA+C;AAEhF,SAASC,oCAAoC,QAAQ,kDAAiD;AAItG,OAAO,SAASC,UAAU,EACxBC,GAAG,EACHC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,QAAQ,EACRC,WAAW,EACXC,SAAS,EACTC,QAAQ,EACRC,aAAa,EACbC,qBAAqB,EACrBC,yBAAyB,EACzBC,YAAY,EACZC,uBAAuB,EACvBC,4BAA4B,EAC5BC,qBAAqB,EACrBC,aAAa,EACbC,MAAM,EACNC,OAAO,EACPC,gBAAgB,EAChBC,uBAAuB,EAyBxB;IACC,MAAMC,YAAYd,cAAc;IAChC,MAAMe,0BAA0B;QAC9BrB;QACAQ;QACAC;QACAI;QACAN;QACAe,GAAG,EAAEpB,0BAAAA,OAAQqB,OAAO;QACpBX;IACF;IAEA,MAAMY,SAAS,IAAI/B,UAAU;QAC3BO;QACAyB,MAAMT;QACNU,aAAa;QACbC,iBAAiB;YACf1B;YACA2B,UAAUR,YAAYvB,iBAAiBI,QAAQA;YAC/CK;YACAI;YACAmB,kBAAkB;gBAChBZ;gBACAa,SAASlC,eAAemC,gBAAgB;gBACxCC,yBAAyB;gBACzBC,yBAAyB;gBACzBnB;gBACAC;gBACAG;YACF;YACAP;YACAQ;YACAe,eAAe,OAAOC;g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rB,MAAMC,SAAS,MAAMD,YAAYE,UAAU;QAE3C,IAAIJ,yBAAAA,MAAOK,SAAS,EAAE;YACpB,MAAMC,mBAAmBxD;YACzB,IAAIwD,kBAAkB;gBACpBN,MAAMK,SAAS,CAACC;YAClB;QACF;QAEA,OAAOH;IACT;AACF"}
|
||||
37
node_modules/next/dist/esm/build/webpack/loaders/next-flight-action-entry-loader.js
generated
vendored
Normal file
37
node_modules/next/dist/esm/build/webpack/loaders/next-flight-action-entry-loader.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
import { generateActionId } from "./utils";
|
||||
function nextFlightActionEntryLoader() {
|
||||
const { actions } = this.getOptions();
|
||||
const actionList = JSON.parse(actions);
|
||||
const individualActions = actionList.map(([path, names])=>{
|
||||
return names.map((name)=>{
|
||||
const id = generateActionId(path, name);
|
||||
return [
|
||||
id,
|
||||
path,
|
||||
name
|
||||
];
|
||||
});
|
||||
}).flat();
|
||||
return `
|
||||
const actions = {
|
||||
${individualActions.map(([id, path, name])=>{
|
||||
return `'${id}': () => import(/* webpackMode: "eager" */ ${JSON.stringify(path)}).then(mod => mod[${JSON.stringify(name)}]),`;
|
||||
}).join("\n")}
|
||||
}
|
||||
|
||||
async function endpoint(id, ...args) {
|
||||
const action = await actions[id]()
|
||||
return action.apply(null, args)
|
||||
}
|
||||
|
||||
// Using CJS to avoid this to be tree-shaken away due to unused exports.
|
||||
module.exports = {
|
||||
${individualActions.map(([id])=>{
|
||||
return ` '${id}': endpoint.bind(null, '${id}'),`;
|
||||
}).join("\n")}
|
||||
}
|
||||
`;
|
||||
}
|
||||
export default nextFlightActionEntryLoader;
|
||||
|
||||
//# sourceMappingURL=next-flight-action-entry-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-action-entry-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-action-entry-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-action-entry-loader.ts"],"names":["generateActionId","nextFlightActionEntryLoader","actions","getOptions","actionList","JSON","parse","individualActions","map","path","names","name","id","flat","stringify","join"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,UAAS;AAM1C,SAASC;IACP,MAAM,EAAEC,OAAO,EAAE,GAAuC,IAAI,CAACC,UAAU;IAEvE,MAAMC,aAAaC,KAAKC,KAAK,CAACJ;IAC9B,MAAMK,oBAAoBH,WACvBI,GAAG,CAAC,CAAC,CAACC,MAAMC,MAAM;QACjB,OAAOA,MAAMF,GAAG,CAAC,CAACG;YAChB,MAAMC,KAAKZ,iBAAiBS,MAAME;YAClC,OAAO;gBAACC;gBAAIH;gBAAME;aAAK;QACzB;IACF,GACCE,IAAI;IAEP,OAAO,CAAC;;AAEV,EAAEN,kBACCC,GAAG,CAAC,CAAC,CAACI,IAAIH,MAAME,KAAK;QACpB,OAAO,CAAC,CAAC,EAAEC,GAAG,2CAA2C,EAAEP,KAAKS,SAAS,CACvEL,MACA,kBAAkB,EAAEJ,KAAKS,SAAS,CAACH,MAAM,GAAG,CAAC;IACjD,GACCI,IAAI,CAAC,MAAM;;;;;;;;;;AAUd,EAAER,kBACCC,GAAG,CAAC,CAAC,CAACI,GAAG;QACR,OAAO,CAAC,GAAG,EAAEA,GAAG,wBAAwB,EAAEA,GAAG,GAAG,CAAC;IACnD,GACCG,IAAI,CAAC,MAAM;;AAEd,CAAC;AACD;AAEA,eAAed,4BAA2B"}
|
||||
31
node_modules/next/dist/esm/build/webpack/loaders/next-flight-client-entry-loader.js
generated
vendored
Normal file
31
node_modules/next/dist/esm/build/webpack/loaders/next-flight-client-entry-loader.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
import { BARREL_OPTIMIZATION_PREFIX, RSC_MODULE_TYPES } from "../../../shared/lib/constants";
|
||||
import { getModuleBuildInfo } from "./get-module-build-info";
|
||||
import { regexCSS } from "./utils";
|
||||
export default function transformSource() {
|
||||
let { modules, server } = this.getOptions();
|
||||
const isServer = server === "true";
|
||||
if (!Array.isArray(modules)) {
|
||||
modules = modules ? [
|
||||
modules
|
||||
] : [];
|
||||
}
|
||||
const code = modules.map((x)=>JSON.parse(x))// Filter out CSS files in the SSR compilation
|
||||
.filter(({ request })=>isServer ? !regexCSS.test(request) : true).map(({ request, ids })=>{
|
||||
const importPath = JSON.stringify(request.startsWith(BARREL_OPTIMIZATION_PREFIX) ? request.replace(":", "!=!") : request);
|
||||
// When we cannot determine the export names, we use eager mode to include the whole module.
|
||||
// Otherwise, we use eager mode with webpackExports to only include the necessary exports.
|
||||
// If we have '*' in the ids, we include all the imports
|
||||
if (ids.length === 0 || ids.includes("*")) {
|
||||
return `import(/* webpackMode: "eager" */ ${importPath});\n`;
|
||||
} else {
|
||||
return `import(/* webpackMode: "eager", webpackExports: ${JSON.stringify(ids)} */ ${importPath});\n`;
|
||||
}
|
||||
}).join(";\n");
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
buildInfo.rsc = {
|
||||
type: RSC_MODULE_TYPES.client
|
||||
};
|
||||
return code;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-flight-client-entry-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-client-entry-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-client-entry-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-client-entry-loader.ts"],"names":["BARREL_OPTIMIZATION_PREFIX","RSC_MODULE_TYPES","getModuleBuildInfo","regexCSS","transformSource","modules","server","getOptions","isServer","Array","isArray","code","map","x","JSON","parse","filter","request","test","ids","importPath","stringify","startsWith","replace","length","includes","join","buildInfo","_module","rsc","type","client"],"mappings":"AACA,SACEA,0BAA0B,EAC1BC,gBAAgB,QACX,gCAA+B;AACtC,SAASC,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,QAAQ,QAAQ,UAAS;AAqBlC,eAAe,SAASC;IAGtB,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAG,IAAI,CAACC,UAAU;IACzC,MAAMC,WAAWF,WAAW;IAE5B,IAAI,CAACG,MAAMC,OAAO,CAACL,UAAU;QAC3BA,UAAUA,UAAU;YAACA;SAAQ,GAAG,EAAE;IACpC;IAEA,MAAMM,OAAON,QACVO,GAAG,CAAC,CAACC,IAAMC,KAAKC,KAAK,CAACF,GACvB,8CAA8C;KAC7CG,MAAM,CAAC,CAAC,EAAEC,OAAO,EAAE,GAAMT,WAAW,CAACL,SAASe,IAAI,CAACD,WAAW,MAC9DL,GAAG,CAAC,CAAC,EAAEK,OAAO,EAAEE,GAAG,EAA+B;QACjD,MAAMC,aAAaN,KAAKO,SAAS,CAC/BJ,QAAQK,UAAU,CAACtB,8BACfiB,QAAQM,OAAO,CAAC,KAAK,SACrBN;QAGN,4FAA4F;QAC5F,0FAA0F;QAC1F,wDAAwD;QACxD,IAAIE,IAAIK,MAAM,KAAK,KAAKL,IAAIM,QAAQ,CAAC,MAAM;YACzC,OAAO,CAAC,kCAAkC,EAAEL,WAAW,IAAI,CAAC;QAC9D,OAAO;YACL,OAAO,CAAC,gDAAgD,EAAEN,KAAKO,SAAS,CACtEF,KACA,IAAI,EAAEC,WAAW,IAAI,CAAC;QAC1B;IACF,GACCM,IAAI,CAAC;IAER,MAAMC,YAAYzB,mBAAmB,IAAI,CAAC0B,OAAO;IAEjDD,UAAUE,GAAG,GAAG;QACdC,MAAM7B,iBAAiB8B,MAAM;IAC/B;IAEA,OAAOpB;AACT"}
|
||||
27
node_modules/next/dist/esm/build/webpack/loaders/next-flight-client-module-loader.js
generated
vendored
Normal file
27
node_modules/next/dist/esm/build/webpack/loaders/next-flight-client-module-loader.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
import { getRSCModuleInformation } from "../../analysis/get-page-static-info";
|
||||
import { getModuleBuildInfo } from "./get-module-build-info";
|
||||
export default function transformSource(source, sourceMap) {
|
||||
// Avoid buffer to be consumed
|
||||
if (typeof source !== "string") {
|
||||
throw new Error("Expected source to have been transformed to a string.");
|
||||
}
|
||||
// Assign the RSC meta information to buildInfo.
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
buildInfo.rsc = getRSCModuleInformation(source, false);
|
||||
// This is a server action entry module in the client layer. We need to attach
|
||||
// noop exports of `callServer` wrappers for each action.
|
||||
if (buildInfo.rsc.actions) {
|
||||
source = `
|
||||
import { callServer } from 'next/dist/client/app-call-server'
|
||||
|
||||
function __build_action__(action, args) {
|
||||
return callServer(action.$$id, args)
|
||||
}
|
||||
|
||||
${source}
|
||||
`;
|
||||
}
|
||||
return this.callback(null, source, sourceMap);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-flight-client-module-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-client-module-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-client-module-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-client-module-loader.ts"],"names":["getRSCModuleInformation","getModuleBuildInfo","transformSource","source","sourceMap","Error","buildInfo","_module","rsc","actions","callback"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,sCAAqC;AAC7E,SAASC,kBAAkB,QAAQ,0BAAyB;AAE5D,eAAe,SAASC,gBAEtBC,MAAc,EACdC,SAAc;IAEd,8BAA8B;IAC9B,IAAI,OAAOD,WAAW,UAAU;QAC9B,MAAM,IAAIE,MAAM;IAClB;IAEA,gDAAgD;IAChD,MAAMC,YAAYL,mBAAmB,IAAI,CAACM,OAAO;IACjDD,UAAUE,GAAG,GAAGR,wBAAwBG,QAAQ;IAEhD,8EAA8E;IAC9E,yDAAyD;IACzD,IAAIG,UAAUE,GAAG,CAACC,OAAO,EAAE;QACzBN,SAAS,CAAC;;;;;;;AAOd,EAAEA,OAAO;AACT,CAAC;IACC;IAEA,OAAO,IAAI,CAACO,QAAQ,CAAC,MAAMP,QAAQC;AACrC"}
|
||||
37
node_modules/next/dist/esm/build/webpack/loaders/next-flight-css-loader.js
generated
vendored
Normal file
37
node_modules/next/dist/esm/build/webpack/loaders/next-flight-css-loader.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* For server-side CSS imports, we need to ignore the actual module content but
|
||||
* still trigger the hot-reloading diff mechanism. So here we put the content
|
||||
* inside a comment.
|
||||
*/ import crypto from "crypto";
|
||||
const NextServerCSSLoader = function(content) {
|
||||
this.cacheable && this.cacheable();
|
||||
const options = this.getOptions();
|
||||
let isCSSModule = options.cssModules;
|
||||
// Only add the checksum during development.
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
// This check is only for backwards compatibility.
|
||||
// TODO: Remove this in the next major version (next 14)
|
||||
if (isCSSModule === undefined) {
|
||||
this.emitWarning(new Error("No 'cssModules' option was found for the next-flight-css-loader plugin."));
|
||||
isCSSModule = this.resourcePath.match(/\.module\.(css|sass|scss)$/) !== null;
|
||||
}
|
||||
const checksum = crypto.createHash("sha1").update(typeof content === "string" ? Buffer.from(content) : content).digest().toString("hex").substring(0, 12);
|
||||
if (isCSSModule) {
|
||||
return `\
|
||||
${content}
|
||||
module.exports.__checksum = ${JSON.stringify(checksum)}
|
||||
`;
|
||||
}
|
||||
// Server CSS imports are always available for HMR, so we attach
|
||||
// `module.hot.accept()` to the generated module.
|
||||
const hmrCode = "if (module.hot) { module.hot.accept() }";
|
||||
return `\
|
||||
export default ${JSON.stringify(checksum)}
|
||||
${hmrCode}
|
||||
`;
|
||||
}
|
||||
return content;
|
||||
};
|
||||
export default NextServerCSSLoader;
|
||||
|
||||
//# sourceMappingURL=next-flight-css-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-css-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-css-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-flight-css-loader.ts"],"names":["crypto","NextServerCSSLoader","content","cacheable","options","getOptions","isCSSModule","cssModules","process","env","NODE_ENV","undefined","emitWarning","Error","resourcePath","match","checksum","createHash","update","Buffer","from","digest","toString","substring","JSON","stringify","hmrCode"],"mappings":"AAAA;;;;CAIC,GAED,OAAOA,YAAY,SAAQ;AAO3B,MAAMC,sBACJ,SAAUC,OAAO;IACf,IAAI,CAACC,SAAS,IAAI,IAAI,CAACA,SAAS;IAChC,MAAMC,UAAU,IAAI,CAACC,UAAU;IAC/B,IAAIC,cAAcF,QAAQG,UAAU;IAEpC,4CAA4C;IAC5C,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,kDAAkD;QAClD,wDAAwD;QACxD,IAAIJ,gBAAgBK,WAAW;YAC7B,IAAI,CAACC,WAAW,CACd,IAAIC,MACF;YAGJP,cACE,IAAI,CAACQ,YAAY,CAACC,KAAK,CAAC,kCAAkC;QAC9D;QACA,MAAMC,WAAWhB,OACdiB,UAAU,CAAC,QACXC,MAAM,CAAC,OAAOhB,YAAY,WAAWiB,OAAOC,IAAI,CAAClB,WAAWA,SAC5DmB,MAAM,GACNC,QAAQ,CAAC,OACTC,SAAS,CAAC,GAAG;QAEhB,IAAIjB,aAAa;YACf,OAAO,CAAC;AAChB,EAAEJ,QAAQ;4BACkB,EAAEsB,KAAKC,SAAS,CAACT,UAAU;AACvD,CAAC;QACK;QAEA,gEAAgE;QAChE,iDAAiD;QACjD,MAAMU,UAAU;QAEhB,OAAO,CAAC;eACC,EAAEF,KAAKC,SAAS,CAACT,UAAU;AAC1C,EAAEU,QAAQ;AACV,CAAC;IACG;IAEA,OAAOxB;AACT;AAEF,eAAeD,oBAAmB"}
|
||||
15
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/action-client-wrapper.js
generated
vendored
Normal file
15
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/action-client-wrapper.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// This file must be bundled in the app's client layer, it shouldn't be directly
|
||||
// imported by the server.
|
||||
import { callServer } from "next/dist/client/app-call-server";
|
||||
// A noop wrapper to let the Flight client create the server reference.
|
||||
// See also: https://github.com/facebook/react/pull/26632
|
||||
export function createServerReference(id) {
|
||||
// Since we're using the Edge build of Flight client for SSR [1], here we need to
|
||||
// also use the same Edge build to create the reference. For the client bundle,
|
||||
// we use the default and let Webpack to resolve it to the correct version.
|
||||
// 1: https://github.com/vercel/next.js/blob/16eb80b0b0be13f04a6407943664b5efd8f3d7d0/packages/next/src/server/app-render/use-flight-response.tsx#L24-L26
|
||||
const { createServerReference: createServerReferenceImpl } = !!process.env.NEXT_RUNTIME ? require("react-server-dom-webpack/client.edge") : require("react-server-dom-webpack/client");
|
||||
return createServerReferenceImpl(id, callServer);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=action-client-wrapper.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/action-client-wrapper.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/action-client-wrapper.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/action-client-wrapper.ts"],"names":["callServer","createServerReference","id","createServerReferenceImpl","process","env","NEXT_RUNTIME","require"],"mappings":"AAAA,gFAAgF;AAChF,0BAA0B;AAE1B,SAASA,UAAU,QAAQ,mCAAkC;AAE7D,uEAAuE;AACvE,yDAAyD;AACzD,OAAO,SAASC,sBAAsBC,EAAU;IAC9C,iFAAiF;IACjF,+EAA+E;IAC/E,2EAA2E;IAC3E,yJAAyJ;IACzJ,MAAM,EAAED,uBAAuBE,yBAAyB,EAAE,GACxD,CAAC,CAACC,QAAQC,GAAG,CAACC,YAAY,GAEtBC,QAAQ,0CAERA,QAAQ;IAGd,OAAOJ,0BAA0BD,IAAIF;AACvC"}
|
||||
13
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/action-validate.js
generated
vendored
Normal file
13
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/action-validate.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// This function ensures that all the exported values are valid server actions,
|
||||
// during the runtime. By definition all actions are required to be async
|
||||
// functions, but here we can only check that they are functions.
|
||||
export function ensureServerEntryExports(actions) {
|
||||
for(let i = 0; i < actions.length; i++){
|
||||
const action = actions[i];
|
||||
if (typeof action !== "function") {
|
||||
throw new Error(`A "use server" file can only export async functions, found ${typeof action}.\nRead more: https://nextjs.org/docs/messages/invalid-use-server-value`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=action-validate.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/action-validate.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/action-validate.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/action-validate.ts"],"names":["ensureServerEntryExports","actions","i","length","action","Error"],"mappings":"AAAA,+EAA+E;AAC/E,yEAAyE;AACzE,iEAAiE;AACjE,OAAO,SAASA,yBAAyBC,OAAc;IACrD,IAAK,IAAIC,IAAI,GAAGA,IAAID,QAAQE,MAAM,EAAED,IAAK;QACvC,MAAME,SAASH,OAAO,CAACC,EAAE;QACzB,IAAI,OAAOE,WAAW,YAAY;YAChC,MAAM,IAAIC,MACR,CAAC,2DAA2D,EAAE,OAAOD,OAAO,uEAAuE,CAAC;QAExJ;IACF;AACF"}
|
||||
98
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/index.js
generated
vendored
Normal file
98
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/index.js
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
import { RSC_MOD_REF_PROXY_ALIAS } from "../../../../lib/constants";
|
||||
import { BARREL_OPTIMIZATION_PREFIX, RSC_MODULE_TYPES } from "../../../../shared/lib/constants";
|
||||
import { warnOnce } from "../../../../shared/lib/utils/warn-once";
|
||||
import { getRSCModuleInformation } from "../../../analysis/get-page-static-info";
|
||||
import { formatBarrelOptimizedResource } from "../../utils";
|
||||
import { getModuleBuildInfo } from "../get-module-build-info";
|
||||
const noopHeadPath = require.resolve("next/dist/client/components/noop-head");
|
||||
// For edge runtime it will be aliased to esm version by webpack
|
||||
const MODULE_PROXY_PATH = "next/dist/build/webpack/loaders/next-flight-loader/module-proxy";
|
||||
export function getAssumedSourceType(mod, sourceType) {
|
||||
var _buildInfo_rsc, _buildInfo_rsc1;
|
||||
const buildInfo = getModuleBuildInfo(mod);
|
||||
const detectedClientEntryType = buildInfo == null ? void 0 : (_buildInfo_rsc = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc.clientEntryType;
|
||||
const clientRefs = (buildInfo == null ? void 0 : (_buildInfo_rsc1 = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc1.clientRefs) || [];
|
||||
// It's tricky to detect the type of a client boundary, but we should always
|
||||
// use the `module` type when we can, to support `export *` and `export from`
|
||||
// syntax in other modules that import this client boundary.
|
||||
let assumedSourceType = sourceType;
|
||||
if (assumedSourceType === "auto" && detectedClientEntryType === "auto") {
|
||||
if (clientRefs.length === 0 || clientRefs.length === 1 && clientRefs[0] === "") {
|
||||
// If there's zero export detected in the client boundary, and it's the
|
||||
// `auto` type, we can safely assume it's a CJS module because it doesn't
|
||||
// have ESM exports.
|
||||
assumedSourceType = "commonjs";
|
||||
} else if (!clientRefs.includes("*")) {
|
||||
// Otherwise, we assume it's an ESM module.
|
||||
assumedSourceType = "module";
|
||||
}
|
||||
}
|
||||
return assumedSourceType;
|
||||
}
|
||||
export default function transformSource(source, sourceMap) {
|
||||
var _this__module_matchResource, _this__module, _buildInfo_rsc, _buildInfo_rsc1;
|
||||
// Avoid buffer to be consumed
|
||||
if (typeof source !== "string") {
|
||||
throw new Error("Expected source to have been transformed to a string.");
|
||||
}
|
||||
// Assign the RSC meta information to buildInfo.
|
||||
// Exclude next internal files which are not marked as client files
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
buildInfo.rsc = getRSCModuleInformation(source, true);
|
||||
// Resource key is the unique identifier for the resource. When RSC renders
|
||||
// a client module, that key is used to identify that module across all compiler
|
||||
// layers.
|
||||
//
|
||||
// Usually it's the module's file path + the export name (e.g. `foo.js#bar`).
|
||||
// But with Barrel Optimizations, one file can be splitted into multiple modules,
|
||||
// so when you import `foo.js#bar` and `foo.js#baz`, they are actually different
|
||||
// "foo.js" being created by the Barrel Loader (one only exports `bar`, the other
|
||||
// only exports `baz`).
|
||||
//
|
||||
// Because of that, we must add another query param to the resource key to
|
||||
// differentiate them.
|
||||
let resourceKey = this.resourcePath;
|
||||
if ((_this__module = this._module) == null ? void 0 : (_this__module_matchResource = _this__module.matchResource) == null ? void 0 : _this__module_matchResource.startsWith(BARREL_OPTIMIZATION_PREFIX)) {
|
||||
resourceKey = formatBarrelOptimizedResource(resourceKey, this._module.matchResource);
|
||||
}
|
||||
// A client boundary.
|
||||
if (((_buildInfo_rsc = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc.type) === RSC_MODULE_TYPES.client) {
|
||||
var _this__module_parser, _this__module1;
|
||||
const assumedSourceType = getAssumedSourceType(this._module, (_this__module1 = this._module) == null ? void 0 : (_this__module_parser = _this__module1.parser) == null ? void 0 : _this__module_parser.sourceType);
|
||||
const clientRefs = buildInfo.rsc.clientRefs;
|
||||
if (assumedSourceType === "module") {
|
||||
if (clientRefs.includes("*")) {
|
||||
this.callback(new Error(`It's currently unsupported to use "export *" in a client boundary. Please use named exports instead.`));
|
||||
return;
|
||||
}
|
||||
let esmSource = `\
|
||||
import { createProxy } from "${MODULE_PROXY_PATH}"
|
||||
`;
|
||||
let cnt = 0;
|
||||
for (const ref of clientRefs){
|
||||
if (ref === "") {
|
||||
esmSource += `\nexports[''] = createProxy(String.raw\`${resourceKey}#\`);`;
|
||||
} else if (ref === "default") {
|
||||
esmSource += `\
|
||||
export default createProxy(String.raw\`${resourceKey}#default\`);
|
||||
`;
|
||||
} else {
|
||||
esmSource += `
|
||||
const e${cnt} = createProxy(String.raw\`${resourceKey}#${ref}\`);
|
||||
export { e${cnt++} as ${ref} };`;
|
||||
}
|
||||
}
|
||||
this.callback(null, esmSource, sourceMap);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (((_buildInfo_rsc1 = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc1.type) !== RSC_MODULE_TYPES.client) {
|
||||
if (noopHeadPath === this.resourcePath) {
|
||||
warnOnce(`Warning: You're using \`next/head\` inside the \`app\` directory, please migrate to the Metadata API. See https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#step-3-migrating-nexthead for more details.`);
|
||||
}
|
||||
}
|
||||
const replacedSource = source.replace(RSC_MOD_REF_PROXY_ALIAS, MODULE_PROXY_PATH);
|
||||
this.callback(null, replacedSource, sourceMap);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/index.ts"],"names":["RSC_MOD_REF_PROXY_ALIAS","BARREL_OPTIMIZATION_PREFIX","RSC_MODULE_TYPES","warnOnce","getRSCModuleInformation","formatBarrelOptimizedResource","getModuleBuildInfo","noopHeadPath","require","resolve","MODULE_PROXY_PATH","getAssumedSourceType","mod","sourceType","buildInfo","detectedClientEntryType","rsc","clientEntryType","clientRefs","assumedSourceType","length","includes","transformSource","source","sourceMap","Error","_module","resourceKey","resourcePath","matchResource","startsWith","type","client","parser","callback","esmSource","cnt","ref","replacedSource","replace"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,4BAA2B;AACnE,SACEC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QAAQ,CAAC,MAAMC,WAAWX;YAC/B;QACF;IACF;IAEA,IAAIV,EAAAA,kBAAAA,UAAUE,GAAG,qBAAbF,gBAAeiB,IAAI,MAAK7B,iBAAiB8B,MAAM,EAAE;QACnD,IAAIzB,iBAAiB,IAAI,CAACqB,YAAY,EAAE;YACtCzB,SACE,CAAC,0OAA0O,CAAC;QAEhP;IACF;IAEA,MAAMmC,iBAAiBf,OAAOgB,OAAO,CACnCvC,yBACAU;IAEF,IAAI,CAACwB,QAAQ,CAAC,MAAMI,gBAAgBd;AACtC"}
|
||||
5
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/module-proxy.js
generated
vendored
Normal file
5
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/module-proxy.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */ import { createClientModuleProxy } from "react-server-dom-webpack/server.edge";
|
||||
// Re-assign to make it typed.
|
||||
export const createProxy = createClientModuleProxy;
|
||||
|
||||
//# sourceMappingURL=module-proxy.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/module-proxy.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/module-proxy.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/module-proxy.ts"],"names":["createClientModuleProxy","createProxy"],"mappings":"AAAA,oDAAoD,GACpD,SAASA,uBAAuB,QAAQ,uCAAsC;AAE9E,8BAA8B;AAC9B,OAAO,MAAMC,cAAyCD,wBAAuB"}
|
||||
6
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/server-reference.js
generated
vendored
Normal file
6
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/server-reference.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */ import { registerServerReference as flightRegisterServerReference } from "react-server-dom-webpack/server.edge";
|
||||
export function registerServerReference(id, action) {
|
||||
return flightRegisterServerReference(action, id, null);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=server-reference.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/server-reference.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-flight-loader/server-reference.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/server-reference.ts"],"names":["registerServerReference","flightRegisterServerReference","id","action"],"mappings":"AAAA,oDAAoD,GACpD,SAASA,2BAA2BC,6BAA6B,QAAQ,uCAAsC;AAE/G,OAAO,SAASD,wBAAwBE,EAAU,EAAEC,MAAW;IAC7D,OAAOF,8BAA8BE,QAAQD,IAAI;AACnD"}
|
||||
105
node_modules/next/dist/esm/build/webpack/loaders/next-font-loader/index.js
generated
vendored
Normal file
105
node_modules/next/dist/esm/build/webpack/loaders/next-font-loader/index.js
generated
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
import path from "path";
|
||||
import { bold, cyan } from "../../../../lib/picocolors";
|
||||
import loaderUtils from "next/dist/compiled/loader-utils3";
|
||||
import postcssNextFontPlugin from "./postcss-next-font";
|
||||
import { promisify } from "util";
|
||||
export default async function nextFontLoader() {
|
||||
const nextFontLoaderSpan = this.currentTraceSpan.traceChild("next-font-loader");
|
||||
return nextFontLoaderSpan.traceAsyncFn(async ()=>{
|
||||
const callback = this.async();
|
||||
/**
|
||||
* The next-swc plugin next-transform-font turns font function calls into CSS imports.
|
||||
* At the end of the import, it adds the call arguments and some additional data as a resourceQuery.
|
||||
* e.g:
|
||||
* const inter = Inter({ subset: ['latin'] })
|
||||
* ->
|
||||
* import inter from 'next/font/google/target.css?{"import":"Inter","subsets":["latin"]}'
|
||||
*
|
||||
* Here we parse the resourceQuery to get the font function name, call arguments, and the path to the file that called the font function.
|
||||
*/ const { path: relativeFilePathFromRoot, import: functionName, arguments: data, variableName } = JSON.parse(this.resourceQuery.slice(1));
|
||||
// Throw error if @next/font is used in _document.js
|
||||
if (/pages[\\/]_document\./.test(relativeFilePathFromRoot)) {
|
||||
const err = new Error(`${bold("Cannot")} be used within ${cyan("pages/_document.js")}.`);
|
||||
err.name = "NextFontError";
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
const { isDev, isServer, assetPrefix, fontLoaderPath, postcss: getPostcss } = this.getOptions();
|
||||
if (assetPrefix && !/^\/|https?:\/\//.test(assetPrefix)) {
|
||||
const err = new Error("assetPrefix must start with a leading slash or be an absolute URL(http:// or https://)");
|
||||
err.name = "NextFontError";
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Emit font files to .next/static/media as [hash].[ext].
|
||||
*
|
||||
* If the font should be preloaded, add .p to the filename: [hash].p.[ext]
|
||||
* NextFontManifestPlugin adds these files to the next/font manifest.
|
||||
*
|
||||
* If the font is using a size-adjust fallback font, add -s to the filename: [hash]-s.[ext]
|
||||
* NextFontManifestPlugin uses this to see if fallback fonts are being used.
|
||||
* This is used to collect stats on fallback fonts usage by the Google Aurora team.
|
||||
*/ const emitFontFile = (content, ext, preload, isUsingSizeAdjust)=>{
|
||||
const opts = {
|
||||
context: this.rootContext,
|
||||
content
|
||||
};
|
||||
const interpolatedName = loaderUtils.interpolateName(this, `static/media/[hash]${isUsingSizeAdjust ? "-s" : ""}${preload ? ".p" : ""}.${ext}`, opts);
|
||||
const outputPath = `${assetPrefix}/_next/${interpolatedName}`;
|
||||
// Only the client emits the font file
|
||||
if (!isServer) {
|
||||
this.emitFile(interpolatedName, content, null);
|
||||
}
|
||||
// But both the server and client must get the resulting path
|
||||
return outputPath;
|
||||
};
|
||||
try {
|
||||
// Import the font loader function from either next/font/local or next/font/google
|
||||
// The font loader function emits font files and returns @font-faces and fallback font metrics
|
||||
const fontLoader = require(fontLoaderPath).default;
|
||||
let { css, fallbackFonts, adjustFontFallback, weight, style, variable } = await nextFontLoaderSpan.traceChild("font-loader").traceAsyncFn(()=>fontLoader({
|
||||
functionName,
|
||||
variableName,
|
||||
data,
|
||||
emitFontFile,
|
||||
resolve: (src)=>promisify(this.resolve)(path.dirname(path.join(this.rootContext, relativeFilePathFromRoot)), src.startsWith(".") ? src : `./${src}`),
|
||||
isDev,
|
||||
isServer,
|
||||
loaderContext: this
|
||||
}));
|
||||
const { postcss } = await getPostcss();
|
||||
// Exports will be exported as is from css-loader instead of a CSS module export
|
||||
const exports = [];
|
||||
// Generate a hash from the CSS content. Used to generate classnames and font families
|
||||
const fontFamilyHash = loaderUtils.getHashDigest(Buffer.from(css), "sha1", "hex", 6);
|
||||
// Add CSS classes, exports and make the font-family locally scoped by turning it unguessable
|
||||
const result = await nextFontLoaderSpan.traceChild("postcss").traceAsyncFn(()=>postcss(postcssNextFontPlugin({
|
||||
exports,
|
||||
fontFamilyHash,
|
||||
fallbackFonts,
|
||||
weight,
|
||||
style,
|
||||
adjustFontFallback,
|
||||
variable
|
||||
})).process(css, {
|
||||
from: undefined
|
||||
}));
|
||||
const ast = {
|
||||
type: "postcss",
|
||||
version: result.processor.version,
|
||||
root: result.root
|
||||
};
|
||||
// Return the resulting CSS and send the postcss ast, font exports and the hash to the css-loader in the meta argument.
|
||||
callback(null, result.css, null, {
|
||||
exports,
|
||||
ast,
|
||||
fontFamilyHash
|
||||
});
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-font-loader/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-font-loader/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-font-loader/index.ts"],"names":["path","bold","cyan","loaderUtils","postcssNextFontPlugin","promisify","nextFontLoader","nextFontLoaderSpan","currentTraceSpan","traceChild","traceAsyncFn","callback","async","relativeFilePathFromRoot","import","functionName","arguments","data","variableName","JSON","parse","resourceQuery","slice","test","err","Error","name","isDev","isServer","assetPrefix","fontLoaderPath","postcss","getPostcss","getOptions","emitFontFile","content","ext","preload","isUsingSizeAdjust","opts","context","rootContext","interpolatedName","interpolateName","outputPath","emitFile","fontLoader","require","default","css","fallbackFonts","adjustFontFallback","weight","style","variable","resolve","src","dirname","join","startsWith","loaderContext","exports","fontFamilyHash","getHashDigest","Buffer","from","result","process","undefined","ast","type","version","processor","root"],"mappings":"AAEA,OAAOA,UAAU,OAAM;AACvB,SAASC,IAAI,EAAEC,IAAI,QAAQ,6BAA4B;AACvD,OAAOC,iBAAiB,mCAAkC;AAC1D,OAAOC,2BAA2B,sBAAqB;AACvD,SAASC,SAAS,QAAQ,OAAM;AAEhC,eAAe,eAAeC;IAC5B,MAAMC,qBACJ,IAAI,CAACC,gBAAgB,CAACC,UAAU,CAAC;IACnC,OAAOF,mBAAmBG,YAAY,CAAC;QACrC,MAAMC,WAAW,IAAI,CAACC,KAAK;QAE3B;;;;;;;;;KASC,GACD,MAAM,EACJZ,MAAMa,wBAAwB,EAC9BC,QAAQC,YAAY,EACpBC,WAAWC,IAAI,EACfC,YAAY,EACb,GAAGC,KAAKC,KAAK,CAAC,IAAI,CAACC,aAAa,CAACC,KAAK,CAAC;QAExC,oDAAoD;QACpD,IAAI,wBAAwBC,IAAI,CAACV,2BAA2B;YAC1D,MAAMW,MAAM,IAAIC,MACd,CAAC,EAAExB,KAAK,UAAU,gBAAgB,EAAEC,KAAK,sBAAsB,CAAC,CAAC;YAEnEsB,IAAIE,IAAI,GAAG;YACXf,SAASa;YACT;QACF;QAEA,MAAM,EACJG,KAAK,EACLC,QAAQ,EACRC,WAAW,EACXC,cAAc,EACdC,SAASC,UAAU,EACpB,GAAG,IAAI,CAACC,UAAU;QAEnB,IAAIJ,eAAe,CAAC,kBAAkBN,IAAI,CAACM,cAAc;YACvD,MAAML,MAAM,IAAIC,MACd;YAEFD,IAAIE,IAAI,GAAG;YACXf,SA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AA6F;YAC7F,MAAMiB,SAAS,MAAM3D,mBAClBE,UAAU,CAAC,WACXC,YAAY,CAAC,IACZqB,QACE3B,sBAAsB;oBACpByD;oBACAC;oBACAZ;oBACAE;oBACAC;oBACAF;oBACAG;gBACF,IACAa,OAAO,CAAClB,KAAK;oBACbgB,MAAMG;gBACR;YAGJ,MAAMC,MAAM;gBACVC,MAAM;gBACNC,SAASL,OAAOM,SAAS,CAACD,OAAO;gBACjCE,MAAMP,OAAOO,IAAI;YACnB;YAEA,uHAAuH;YACvH9D,SAAS,MAAMuD,OAAOjB,GAAG,EAAE,MAAM;gBAC/BY;gBACAQ;gBACAP;YACF;QACF,EAAE,OAAOtC,KAAU;YACjBb,SAASa;QACX;IACF;AACF"}
|
||||
151
node_modules/next/dist/esm/build/webpack/loaders/next-font-loader/postcss-next-font.js
generated
vendored
Normal file
151
node_modules/next/dist/esm/build/webpack/loaders/next-font-loader/postcss-next-font.js
generated
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
import postcss from "postcss";
|
||||
/**
|
||||
* The next/font postcss plugin recieves the @font-face declarations returned from the next/font loaders.
|
||||
*
|
||||
* It hashes the font-family name to make it unguessable, it shouldn't be globally accessible.
|
||||
* If it were global, we wouldn't be able to tell which pages are using which fonts when generating preload tags.
|
||||
*
|
||||
* If the font loader returned fallback metrics, generate a fallback @font-face.
|
||||
*
|
||||
* If the font loader returned a variable name, add a CSS class that declares a variable containing the font and fallback fonts.
|
||||
*
|
||||
* Lastly, it adds the font-family to the exports object.
|
||||
* This enables you to access the actual font-family name, not just through the CSS class.
|
||||
* e.g:
|
||||
* const inter = Inter({ subsets: ['latin'] })
|
||||
* inter.style.fontFamily // => '__Inter_123456'
|
||||
*/ const postcssNextFontPlugin = ({ exports, fontFamilyHash, fallbackFonts = [], adjustFontFallback, variable, weight, style })=>{
|
||||
return {
|
||||
postcssPlugin: "postcss-next-font",
|
||||
Once (root) {
|
||||
let fontFamily;
|
||||
const normalizeFamily = (family)=>{
|
||||
return family.replace(/['"]/g, "");
|
||||
};
|
||||
const formatFamily = (family)=>{
|
||||
// Turn the font family unguessable to make it locally scoped
|
||||
return `'__${family.replace(/ /g, "_")}_${fontFamilyHash}'`;
|
||||
};
|
||||
// Hash font-family names
|
||||
for (const node of root.nodes){
|
||||
if (node.type === "atrule" && node.name === "font-face") {
|
||||
const familyNode = node.nodes.find((decl)=>decl.prop === "font-family");
|
||||
if (!familyNode) {
|
||||
continue;
|
||||
}
|
||||
if (!fontFamily) {
|
||||
fontFamily = normalizeFamily(familyNode.value);
|
||||
}
|
||||
familyNode.value = formatFamily(fontFamily);
|
||||
}
|
||||
}
|
||||
if (!fontFamily) {
|
||||
throw new Error("Font loaders must return one or more @font-face's");
|
||||
}
|
||||
// Add fallback @font-face with the provided override values
|
||||
let adjustFontFallbackFamily;
|
||||
if (adjustFontFallback) {
|
||||
adjustFontFallbackFamily = formatFamily(`${fontFamily} Fallback`);
|
||||
const fallbackFontFace = postcss.atRule({
|
||||
name: "font-face"
|
||||
});
|
||||
const { fallbackFont, ascentOverride, descentOverride, lineGapOverride, sizeAdjust } = adjustFontFallback;
|
||||
fallbackFontFace.nodes = [
|
||||
new postcss.Declaration({
|
||||
prop: "font-family",
|
||||
value: adjustFontFallbackFamily
|
||||
}),
|
||||
new postcss.Declaration({
|
||||
prop: "src",
|
||||
value: `local("${fallbackFont}")`
|
||||
}),
|
||||
...ascentOverride ? [
|
||||
new postcss.Declaration({
|
||||
prop: "ascent-override",
|
||||
value: ascentOverride
|
||||
})
|
||||
] : [],
|
||||
...descentOverride ? [
|
||||
new postcss.Declaration({
|
||||
prop: "descent-override",
|
||||
value: descentOverride
|
||||
})
|
||||
] : [],
|
||||
...lineGapOverride ? [
|
||||
new postcss.Declaration({
|
||||
prop: "line-gap-override",
|
||||
value: lineGapOverride
|
||||
})
|
||||
] : [],
|
||||
...sizeAdjust ? [
|
||||
new postcss.Declaration({
|
||||
prop: "size-adjust",
|
||||
value: sizeAdjust
|
||||
})
|
||||
] : []
|
||||
];
|
||||
root.nodes.push(fallbackFontFace);
|
||||
}
|
||||
// Variable fonts can define ranges of values
|
||||
const isRange = (value)=>value.trim().includes(" ");
|
||||
// Format the font families to be used in the CSS
|
||||
const formattedFontFamilies = [
|
||||
formatFamily(fontFamily),
|
||||
...adjustFontFallbackFamily ? [
|
||||
adjustFontFallbackFamily
|
||||
] : [],
|
||||
...fallbackFonts
|
||||
].join(", ");
|
||||
// Add class with family, weight and style
|
||||
const classRule = new postcss.Rule({
|
||||
selector: ".className"
|
||||
});
|
||||
classRule.nodes = [
|
||||
new postcss.Declaration({
|
||||
prop: "font-family",
|
||||
value: formattedFontFamilies
|
||||
}),
|
||||
// If the font only has one weight or style, we can set it on the class
|
||||
...weight && !isRange(weight) ? [
|
||||
new postcss.Declaration({
|
||||
prop: "font-weight",
|
||||
value: weight
|
||||
})
|
||||
] : [],
|
||||
...style && !isRange(style) ? [
|
||||
new postcss.Declaration({
|
||||
prop: "font-style",
|
||||
value: style
|
||||
})
|
||||
] : []
|
||||
];
|
||||
root.nodes.push(classRule);
|
||||
// Add CSS class that defines a variable with the font families
|
||||
if (variable) {
|
||||
const varialbeRule = new postcss.Rule({
|
||||
selector: ".variable"
|
||||
});
|
||||
varialbeRule.nodes = [
|
||||
new postcss.Declaration({
|
||||
prop: variable,
|
||||
value: formattedFontFamilies
|
||||
})
|
||||
];
|
||||
root.nodes.push(varialbeRule);
|
||||
}
|
||||
// Export @font-face values as is
|
||||
exports.push({
|
||||
name: "style",
|
||||
value: {
|
||||
fontFamily: formattedFontFamilies,
|
||||
fontWeight: !Number.isNaN(Number(weight)) ? Number(weight) : undefined,
|
||||
fontStyle: style && !isRange(style) ? style : undefined
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
postcssNextFontPlugin.postcss = true;
|
||||
export default postcssNextFontPlugin;
|
||||
|
||||
//# sourceMappingURL=postcss-next-font.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-font-loader/postcss-next-font.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-font-loader/postcss-next-font.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-font-loader/postcss-next-font.ts"],"names":["postcss","postcssNextFontPlugin","exports","fontFamilyHash","fallbackFonts","adjustFontFallback","variable","weight","style","postcssPlugin","Once","root","fontFamily","normalizeFamily","family","replace","formatFamily","node","nodes","type","name","familyNode","find","decl","prop","value","Error","adjustFontFallbackFamily","fallbackFontFace","atRule","fallbackFont","ascentOverride","descentOverride","lineGapOverride","sizeAdjust","Declaration","push","isRange","trim","includes","formattedFontFamilies","join","classRule","Rule","selector","varialbeRule","fontWeight","Number","isNaN","undefined","fontStyle"],"mappings":"AAEA,OAAOA,aAAa,UAAS;AAE7B;;;;;;;;;;;;;;;CAeC,GACD,MAAMC,wBAAwB,CAAC,EAC7BC,OAAO,EACPC,cAAc,EACdC,gBAAgB,EAAE,EAClBC,kBAAkB,EAClBC,QAAQ,EACRC,MAAM,EACNC,KAAK,EASN;IACC,OAAO;QACLC,eAAe;QACfC,MAAKC,IAAS;YACZ,IAAIC;YAEJ,MAAMC,kBAAkB,CAACC;gBACvB,OAAOA,OAAOC,OAAO,CAAC,SAAS;YACjC;YAEA,MAAMC,eAAe,CAACF;gBACpB,6DAA6D;gBAC7D,OAAO,CAAC,GAAG,EAAEA,OAAOC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAEZ,eAAe,CAAC,CAAC;YAC7D;YAEA,yBAAyB;YACzB,KAAK,MAAMc,QAAQN,KAAKO,KAAK,CAAE;gBAC7B,IAAID,KAAKE,IAAI,KAAK,YAAYF,KAAKG,IAAI,KAAK,aAAa;oBACvD,MAAMC,aAAaJ,KAAKC,KAAK,CAACI,IAAI,CAChC,CAACC,OAAsBA,KAAKC,IAAI,KAAK;oBAEvC,IAAI,CAACH,YAAY;wBACf;oBACF;oBAEA,IAAI,CAACT,YAAY;wBACf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AACA;iBAAyB,GAAG,EAAE;mBAC3DvB;aACJ,CAACqC,IAAI,CAAC;YAEP,0CAA0C;YAC1C,MAAMC,YAAY,IAAI1C,QAAQ2C,IAAI,CAAC;gBAAEC,UAAU;YAAa;YAC5DF,UAAUxB,KAAK,GAAG;gBAChB,IAAIlB,QAAQmC,WAAW,CAAC;oBACtBX,MAAM;oBACNC,OAAOe;gBACT;gBACA,uEAAuE;mBACnEjC,UAAU,CAAC8B,QAAQ9B,UACnB;oBACE,IAAIP,QAAQmC,WAAW,CAAC;wBACtBX,MAAM;wBACNC,OAAOlB;oBACT;iBACD,GACD,EAAE;mBACFC,SAAS,CAAC6B,QAAQ7B,SAClB;oBACE,IAAIR,QAAQmC,WAAW,CAAC;wBACtBX,MAAM;wBACNC,OAAOjB;oBACT;iBACD,GACD,EAAE;aACP;YACDG,KAAKO,KAAK,CAACkB,IAAI,CAACM;YAEhB,+DAA+D;YAC/D,IAAIpC,UAAU;gBACZ,MAAMuC,eAAe,IAAI7C,QAAQ2C,IAAI,CAAC;oBAAEC,UAAU;gBAAY;gBAC9DC,aAAa3B,KAAK,GAAG;oBACnB,IAAIlB,QAAQmC,WAAW,CAAC;wBACtBX,MAAMlB;wBACNmB,OAAOe;oBACT;iBACD;gBACD7B,KAAKO,KAAK,CAACkB,IAAI,CAACS;YAClB;YAEA,iCAAiC;YACjC3C,QAAQkC,IAAI,CAAC;gBACXhB,MAAM;gBACNK,OAAO;oBACLb,YAAY4B;oBACZM,YAAY,CAACC,OAAOC,KAAK,CAACD,OAAOxC,WAC7BwC,OAAOxC,UACP0C;oBACJC,WAAW1C,SAAS,CAAC6B,QAAQ7B,SAASA,QAAQyC;gBAChD;YACF;QACF;IACF;AACF;AAEAhD,sBAAsBD,OAAO,GAAG;AAEhC,eAAeC,sBAAqB"}
|
||||
58
node_modules/next/dist/esm/build/webpack/loaders/next-image-loader/blur.js
generated
vendored
Normal file
58
node_modules/next/dist/esm/build/webpack/loaders/next-image-loader/blur.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
import isAnimated from "next/dist/compiled/is-animated";
|
||||
import { optimizeImage } from "../../../../server/image-optimizer";
|
||||
const BLUR_IMG_SIZE = 8;
|
||||
const BLUR_QUALITY = 70;
|
||||
const VALID_BLUR_EXT = [
|
||||
"jpeg",
|
||||
"png",
|
||||
"webp",
|
||||
"avif"
|
||||
] // should match other usages
|
||||
;
|
||||
export async function getBlurImage(content, extension, imageSize, { basePath, outputPath, isDev, tracing = ()=>({
|
||||
traceFn: (fn)=>(...args)=>fn(...args),
|
||||
traceAsyncFn: (fn)=>(...args)=>fn(...args)
|
||||
}) }) {
|
||||
let blurDataURL;
|
||||
let blurWidth = 0;
|
||||
let blurHeight = 0;
|
||||
if (VALID_BLUR_EXT.includes(extension) && !isAnimated(content)) {
|
||||
// Shrink the image's largest dimension
|
||||
if (imageSize.width >= imageSize.height) {
|
||||
blurWidth = BLUR_IMG_SIZE;
|
||||
blurHeight = Math.max(Math.round(imageSize.height / imageSize.width * BLUR_IMG_SIZE), 1);
|
||||
} else {
|
||||
blurWidth = Math.max(Math.round(imageSize.width / imageSize.height * BLUR_IMG_SIZE), 1);
|
||||
blurHeight = BLUR_IMG_SIZE;
|
||||
}
|
||||
if (isDev) {
|
||||
// During `next dev`, we don't want to generate blur placeholders with webpack
|
||||
// because it can delay starting the dev server. Instead, we inline a
|
||||
// special url to lazily generate the blur placeholder at request time.
|
||||
const prefix = "http://localhost";
|
||||
const url = new URL(`${basePath || ""}/_next/image`, prefix);
|
||||
url.searchParams.set("url", outputPath);
|
||||
url.searchParams.set("w", String(blurWidth));
|
||||
url.searchParams.set("q", String(BLUR_QUALITY));
|
||||
blurDataURL = url.href.slice(prefix.length);
|
||||
} else {
|
||||
const resizeImageSpan = tracing("image-resize");
|
||||
const resizedImage = await resizeImageSpan.traceAsyncFn(()=>optimizeImage({
|
||||
buffer: content,
|
||||
width: blurWidth,
|
||||
height: blurHeight,
|
||||
contentType: `image/${extension}`,
|
||||
quality: BLUR_QUALITY
|
||||
}));
|
||||
const blurDataURLSpan = tracing("image-base64-tostring");
|
||||
blurDataURL = blurDataURLSpan.traceFn(()=>`data:image/${extension};base64,${resizedImage.toString("base64")}`);
|
||||
}
|
||||
}
|
||||
return {
|
||||
dataURL: blurDataURL,
|
||||
width: blurWidth,
|
||||
height: blurHeight
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=blur.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-image-loader/blur.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-image-loader/blur.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-image-loader/blur.ts"],"names":["isAnimated","optimizeImage","BLUR_IMG_SIZE","BLUR_QUALITY","VALID_BLUR_EXT","getBlurImage","content","extension","imageSize","basePath","outputPath","isDev","tracing","traceFn","fn","args","traceAsyncFn","blurDataURL","blurWidth","blurHeight","includes","width","height","Math","max","round","prefix","url","URL","searchParams","set","String","href","slice","length","resizeImageSpan","resizedImage","buffer","contentType","quality","blurDataURLSpan","toString","dataURL"],"mappings":"AAAA,OAAOA,gBAAgB,iCAAgC;AACvD,SAASC,aAAa,QAAQ,qCAAoC;AAElE,MAAMC,gBAAgB;AACtB,MAAMC,eAAe;AACrB,MAAMC,iBAAiB;IAAC;IAAQ;IAAO;IAAQ;CAAO,CAAC,4BAA4B;;AAEnF,OAAO,eAAeC,aACpBC,OAAe,EACfC,SAAiB,EACjBC,SAA4C,EAC5C,EACEC,QAAQ,EACRC,UAAU,EACVC,KAAK,EACLC,UAAU,IAAO,CAAA;QACfC,SACE,CAACC,KACD,CAAC,GAAGC,OACFD,MAAMC;QACVC,cACE,CAACF,KACD,CAAC,GAAGC,OACFD,MAAMC;IACZ,CAAA,CAAE,EASH;IAED,IAAIE;IACJ,IAAIC,YAAoB;IACxB,IAAIC,aAAqB;IAEzB,IAAIf,eAAegB,QAAQ,C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image-loader/index.js
generated
vendored
Normal file
53
node_modules/next/dist/esm/build/webpack/loaders/next-image-loader/index.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
import path from "path";
|
||||
import loaderUtils from "next/dist/compiled/loader-utils3";
|
||||
import { getImageSize } from "../../../../server/image-optimizer";
|
||||
import { getBlurImage } from "./blur";
|
||||
function nextImageLoader(content) {
|
||||
const imageLoaderSpan = this.currentTraceSpan.traceChild("next-image-loader");
|
||||
return imageLoaderSpan.traceAsyncFn(async ()=>{
|
||||
const options = this.getOptions();
|
||||
const { compilerType, isDev, assetPrefix, basePath } = options;
|
||||
const context = this.rootContext;
|
||||
const opts = {
|
||||
context,
|
||||
content
|
||||
};
|
||||
const interpolatedName = loaderUtils.interpolateName(this, "/static/media/[name].[hash:8].[ext]", opts);
|
||||
const outputPath = assetPrefix + "/_next" + interpolatedName;
|
||||
let extension = loaderUtils.interpolateName(this, "[ext]", opts);
|
||||
if (extension === "jpg") {
|
||||
extension = "jpeg";
|
||||
}
|
||||
const imageSizeSpan = imageLoaderSpan.traceChild("image-size-calculation");
|
||||
const imageSize = await imageSizeSpan.traceAsyncFn(()=>getImageSize(content, extension).catch((err)=>err));
|
||||
if (imageSize instanceof Error) {
|
||||
const err = imageSize;
|
||||
err.name = "InvalidImageFormatError";
|
||||
throw err;
|
||||
}
|
||||
const { dataURL: blurDataURL, width: blurWidth, height: blurHeight } = await getBlurImage(content, extension, imageSize, {
|
||||
basePath,
|
||||
outputPath,
|
||||
isDev,
|
||||
tracing: imageLoaderSpan.traceChild.bind(imageLoaderSpan)
|
||||
});
|
||||
const stringifiedData = imageLoaderSpan.traceChild("image-data-stringify").traceFn(()=>JSON.stringify({
|
||||
src: outputPath,
|
||||
height: imageSize.height,
|
||||
width: imageSize.width,
|
||||
blurDataURL,
|
||||
blurWidth,
|
||||
blurHeight
|
||||
}));
|
||||
if (compilerType === "client") {
|
||||
this.emitFile(interpolatedName, content, null);
|
||||
} else {
|
||||
this.emitFile(path.join("..", isDev || compilerType === "edge-server" ? "" : "..", interpolatedName), content, null);
|
||||
}
|
||||
return `export default ${stringifiedData};`;
|
||||
});
|
||||
}
|
||||
export const raw = true;
|
||||
export default nextImageLoader;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-image-loader/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-image-loader/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-image-loader/index.ts"],"names":["path","loaderUtils","getImageSize","getBlurImage","nextImageLoader","content","imageLoaderSpan","currentTraceSpan","traceChild","traceAsyncFn","options","getOptions","compilerType","isDev","assetPrefix","basePath","context","rootContext","opts","interpolatedName","interpolateName","outputPath","extension","imageSizeSpan","imageSize","catch","err","Error","name","dataURL","blurDataURL","width","blurWidth","height","blurHeight","tracing","bind","stringifiedData","traceFn","JSON","stringify","src","emitFile","join","raw"],"mappings":"AAEA,OAAOA,UAAU,OAAM;AACvB,OAAOC,iBAAiB,mCAAkC;AAC1D,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,YAAY,QAAQ,SAAQ;AASrC,SAASC,gBAA2BC,OAAe;IACjD,MAAMC,kBAAkB,IAAI,CAACC,gBAAgB,CAACC,UAAU,CAAC;IACzD,OAAOF,gBAAgBG,YAAY,CAAC;QAClC,MAAMC,UAAmB,IAAI,CAACC,UAAU;QACxC,MAAM,EAAEC,YAAY,EAAEC,KAAK,EAAEC,WAAW,EAAEC,QAAQ,EAAE,GAAGL;QACvD,MAAMM,UAAU,IAAI,CAACC,WAAW;QAEhC,MAAMC,OAAO;YAAEF;YAASX;QAAQ;QAChC,MAAMc,mBAAmBlB,YAAYmB,eAAe,CAClD,IAAI,EACJ,uCACAF;QAEF,MAAMG,aAAaP,cAAc,WAAWK;QAC5C,IAAIG,YAAYrB,YAAYmB,eAAe,CAAC,IAAI,EAAE,SAASF;QAC3D,IAAII,cAAc,OAAO;YACvBA,YAAY;QACd;QAEA,MAAMC,gBAAgBjB,gBAAgBE,UAAU,CAAC;QACjD,MAAMgB,YAAY,MAAMD,cAAcd,YAAY,CAAC,IACjDP,aAAaG,SAASiB,WAAWG,KAAK,CAAC,CAACC,MAAQA;QAGlD,IAAIF,qBAAqBG,OAAO;YAC9B,MAAMD,MAAMF;YACZE,IAAIE,IAAI,GAAG;YACX,MAAMF;QACR;QAEA,MAAM,EACJG,SAASC,WAAW,EACpBC,OAAOC,SAAS,EAChBC,QAAQC,UAAU,EACnB,GAAG,MAAM/B,aAAaE,SAASiB,WAAWE,WAAW;YACpDT;YACAM;YACAR;YACAsB,SAAS7B,gBAAgBE,UAAU,CAAC4B,IAAI,CAAC9B;QAC3C;QAEA,MAAM+B,kBAAkB/B,gBACrBE,UAAU,CAAC,wBACX8B,OAAO,CAAC,IACPC,KAAKC,SAAS,CAAC;gBACbC,KAAKpB;gBACLY,QAAQT,UAAUS,MAAM;gBACxBF,OAAOP,UAAUO,KAAK;gBACtBD;gBACAE;gBACAE;YACF;QAGJ,IAAItB,iBAAiB,UAAU;YAC7B,IAAI,CAAC8B,QAAQ,CAACvB,kBAAkBd,SAAS;QAC3C,OAAO;YACL,IAAI,CAACqC,QAAQ,CACX1C,KAAK2C,IAAI,CACP,MACA9B,SAASD,iBAAiB,gBAAgB,KAAK,MAC/CO,mBAEFd,SACA;QAEJ;QAEA,OAAO,CAAC,eAAe,EAAEgC,gBAAgB,CAAC,CAAC;IAC7C;AACF;AACA,OAAO,MAAMO,MAAM,KAAI;AACvB,eAAexC,gBAAe"}
|
||||
6
node_modules/next/dist/esm/build/webpack/loaders/next-invalid-import-error-loader.js
generated
vendored
Normal file
6
node_modules/next/dist/esm/build/webpack/loaders/next-invalid-import-error-loader.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export default function nextInvalidImportErrorLoader() {
|
||||
const { message } = this.getOptions();
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-invalid-import-error-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-invalid-import-error-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-invalid-import-error-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-invalid-import-error-loader.ts"],"names":["nextInvalidImportErrorLoader","message","getOptions","Error"],"mappings":"AAAA,eAAe,SAASA;IACtB,MAAM,EAAEC,OAAO,EAAE,GAAG,IAAI,CAACC,UAAU;IACnC,MAAM,IAAIC,MAAMF;AAClB"}
|
||||
121
node_modules/next/dist/esm/build/webpack/loaders/next-metadata-image-loader.js
generated
vendored
Normal file
121
node_modules/next/dist/esm/build/webpack/loaders/next-metadata-image-loader.js
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* This loader is responsible for extracting the metadata image info for rendering in html
|
||||
*/ import { existsSync, promises as fs } from "fs";
|
||||
import path from "path";
|
||||
import loaderUtils from "next/dist/compiled/loader-utils3";
|
||||
import { getImageSize } from "../../../server/image-optimizer";
|
||||
import { imageExtMimeTypeMap } from "../../../lib/mime-type";
|
||||
import { WEBPACK_RESOURCE_QUERIES } from "../../../lib/constants";
|
||||
import { normalizePathSep } from "../../../shared/lib/page-path/normalize-path-sep";
|
||||
import { getLoaderModuleNamedExports } from "./utils";
|
||||
// [NOTE] For turbopack
|
||||
// refer loader_tree's write_static|dynamic_metadata for corresponding features
|
||||
async function nextMetadataImageLoader(content) {
|
||||
const options = this.getOptions();
|
||||
const { type, segment, pageExtensions, basePath } = options;
|
||||
const { resourcePath, rootContext: context } = this;
|
||||
const { name: fileNameBase, ext } = path.parse(resourcePath);
|
||||
const useNumericSizes = type === "twitter" || type === "openGraph";
|
||||
let extension = ext.slice(1);
|
||||
if (extension === "jpg") {
|
||||
extension = "jpeg";
|
||||
}
|
||||
const opts = {
|
||||
context,
|
||||
content
|
||||
};
|
||||
// No hash query for favicon.ico
|
||||
const contentHash = type === "favicon" ? "" : loaderUtils.interpolateName(this, "[contenthash]", opts);
|
||||
const interpolatedName = loaderUtils.interpolateName(this, "[name].[ext]", opts);
|
||||
const isDynamicResource = pageExtensions.includes(extension);
|
||||
const pageSegment = isDynamicResource ? fileNameBase : interpolatedName;
|
||||
const hashQuery = contentHash ? "?" + contentHash : "";
|
||||
const pathnamePrefix = normalizePathSep(path.join(basePath, segment));
|
||||
if (isDynamicResource) {
|
||||
const exportedFieldsExcludingDefault = (await getLoaderModuleNamedExports(resourcePath, this)).filter((name)=>name !== "default");
|
||||
// re-export and spread as `exportedImageData` to avoid non-exported error
|
||||
return `\
|
||||
import {
|
||||
${exportedFieldsExcludingDefault.map((field)=>`${field} as _${field}`).join(",")}
|
||||
} from ${JSON.stringify(// This is an arbitrary resource query to ensure it's a new request, instead
|
||||
// of sharing the same module with next-metadata-route-loader.
|
||||
// Since here we only need export fields such as `size`, `alt` and
|
||||
// `generateImageMetadata`, avoid sharing the same module can make this entry
|
||||
// smaller.
|
||||
resourcePath + "?" + WEBPACK_RESOURCE_QUERIES.metadataImageMeta)}
|
||||
import { fillMetadataSegment } from 'next/dist/lib/metadata/get-metadata-route'
|
||||
|
||||
const imageModule = {
|
||||
${exportedFieldsExcludingDefault.map((field)=>`${field}: _${field}`).join(",")}
|
||||
}
|
||||
|
||||
export default async function (props) {
|
||||
const { __metadata_id__: _, ...params } = props.params
|
||||
const imageUrl = fillMetadataSegment(${JSON.stringify(pathnamePrefix)}, params, ${JSON.stringify(pageSegment)})
|
||||
|
||||
const { generateImageMetadata } = imageModule
|
||||
|
||||
function getImageMetadata(imageMetadata, idParam) {
|
||||
const data = {
|
||||
alt: imageMetadata.alt,
|
||||
type: imageMetadata.contentType || 'image/png',
|
||||
url: imageUrl + (idParam ? ('/' + idParam) : '') + ${JSON.stringify(hashQuery)},
|
||||
}
|
||||
const { size } = imageMetadata
|
||||
if (size) {
|
||||
${type === "twitter" || type === "openGraph" ? "data.width = size.width; data.height = size.height;" : 'data.sizes = size.width + "x" + size.height;'}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
if (generateImageMetadata) {
|
||||
const imageMetadataArray = await generateImageMetadata({ params })
|
||||
return imageMetadataArray.map((imageMetadata, index) => {
|
||||
const idParam = (imageMetadata.id || index) + ''
|
||||
return getImageMetadata(imageMetadata, idParam)
|
||||
})
|
||||
} else {
|
||||
return [getImageMetadata(imageModule, '')]
|
||||
}
|
||||
}`;
|
||||
}
|
||||
const imageSize = await getImageSize(content, extension).catch((err)=>err);
|
||||
if (imageSize instanceof Error) {
|
||||
const err = imageSize;
|
||||
err.name = "InvalidImageFormatError";
|
||||
throw err;
|
||||
}
|
||||
const imageData = {
|
||||
...extension in imageExtMimeTypeMap && {
|
||||
type: imageExtMimeTypeMap[extension]
|
||||
},
|
||||
...useNumericSizes && imageSize.width != null && imageSize.height != null ? imageSize : {
|
||||
sizes: // For SVGs, skip sizes and use "any" to let it scale automatically based on viewport,
|
||||
// For the images doesn't provide the size properly, use "any" as well.
|
||||
// If the size is presented, use the actual size for the image.
|
||||
extension !== "svg" && imageSize.width != null && imageSize.height != null ? `${imageSize.width}x${imageSize.height}` : "any"
|
||||
}
|
||||
};
|
||||
if (type === "openGraph" || type === "twitter") {
|
||||
const altPath = path.join(path.dirname(resourcePath), fileNameBase + ".alt.txt");
|
||||
if (existsSync(altPath)) {
|
||||
imageData.alt = await fs.readFile(altPath, "utf8");
|
||||
}
|
||||
}
|
||||
return `\
|
||||
import { fillMetadataSegment } from 'next/dist/lib/metadata/get-metadata-route'
|
||||
|
||||
export default (props) => {
|
||||
const imageData = ${JSON.stringify(imageData)}
|
||||
const imageUrl = fillMetadataSegment(${JSON.stringify(pathnamePrefix)}, props.params, ${JSON.stringify(pageSegment)})
|
||||
|
||||
return [{
|
||||
...imageData,
|
||||
url: imageUrl + ${JSON.stringify(type === "favicon" ? "" : hashQuery)},
|
||||
}]
|
||||
}`;
|
||||
}
|
||||
export const raw = true;
|
||||
export default nextMetadataImageLoader;
|
||||
|
||||
//# sourceMappingURL=next-metadata-image-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-metadata-image-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-metadata-image-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-metadata-image-loader.ts"],"names":["existsSync","promises","fs","path","loaderUtils","getImageSize","imageExtMimeTypeMap","WEBPACK_RESOURCE_QUERIES","normalizePathSep","getLoaderModuleNamedExports","nextMetadataImageLoader","content","options","getOptions","type","segment","pageExtensions","basePath","resourcePath","rootContext","context","name","fileNameBase","ext","parse","useNumericSizes","extension","slice","opts","contentHash","interpolateName","interpolatedName","isDynamicResource","includes","pageSegment","hashQuery","pathnamePrefix","join","exportedFieldsExcludingDefault","filter","map","field","JSON","stringify","metadataImageMeta","imageSize","catch","err","Error","imageData","width","height","sizes","altPath","dirname","alt","readFile","raw"],"mappings":"AAAA;;CAEC,GAOD,SAASA,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAC/C,OAAOC,UAAU,OAAM;AACvB,OAAOC,iBAAiB,mCAAkC;AAC1D,SAASC,YAAY,QAAQ,kCAAiC;AAC9D,SAASC,mBAAmB,QAAQ,yBAAwB;AAC5D,SAASC,wBAAwB,QAAQ,yBAAwB;AACjE,SAASC,gBAAgB,QAAQ,mDAAkD;AAEnF,SAASC,2BAA2B,QAAQ,UAAS;AASrD,uBAAuB;AACvB,+EAA+E;AAC/E,eAAeC,wBAEbC,OAAe;IAEf,MAAMC,UAAmB,IAAI,CAACC,UAAU;IACxC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,cAAc,EAAEC,QAAQ,EAAE,GAAGL;IACpD,MAAM,EAAEM,YAAY,EAAEC,aAAaC,OAAO,EAAE,GAAG,IAAI;IACnD,MAAM,EAAEC,MAAMC,YAAY,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generated
vendored
Normal file
227
node_modules/next/dist/esm/build/webpack/loaders/next-metadata-route-loader.js
generated
vendored
Normal file
@ -0,0 +1,227 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { imageExtMimeTypeMap } from "../../../lib/mime-type";
|
||||
import { getLoaderModuleNamedExports } from "./utils";
|
||||
function errorOnBadHandler(resourcePath) {
|
||||
return `
|
||||
if (typeof handler !== 'function') {
|
||||
throw new Error('Default export is missing in ${JSON.stringify(resourcePath)}')
|
||||
}
|
||||
`;
|
||||
}
|
||||
const cacheHeader = {
|
||||
none: "no-cache, no-store",
|
||||
longCache: "public, immutable, no-transform, max-age=31536000",
|
||||
revalidate: "public, max-age=0, must-revalidate"
|
||||
};
|
||||
export function getFilenameAndExtension(resourcePath) {
|
||||
const filename = path.basename(resourcePath);
|
||||
const [name, ext] = filename.split(".", 2);
|
||||
return {
|
||||
name,
|
||||
ext
|
||||
};
|
||||
}
|
||||
function getContentType(resourcePath) {
|
||||
let { name, ext } = getFilenameAndExtension(resourcePath);
|
||||
if (ext === "jpg") ext = "jpeg";
|
||||
if (name === "favicon" && ext === "ico") return "image/x-icon";
|
||||
if (name === "sitemap") return "application/xml";
|
||||
if (name === "robots") return "text/plain";
|
||||
if (name === "manifest") return "application/manifest+json";
|
||||
if (ext === "png" || ext === "jpeg" || ext === "ico" || ext === "svg") {
|
||||
return imageExtMimeTypeMap[ext];
|
||||
}
|
||||
return "text/plain";
|
||||
}
|
||||
async function getStaticAssetRouteCode(resourcePath, fileBaseName) {
|
||||
const cache = fileBaseName === "favicon" ? "public, max-age=0, must-revalidate" : process.env.NODE_ENV !== "production" ? cacheHeader.none : cacheHeader.longCache;
|
||||
const code = `\
|
||||
/* static asset route */
|
||||
import { NextResponse } from 'next/server'
|
||||
|
||||
const contentType = ${JSON.stringify(getContentType(resourcePath))}
|
||||
const buffer = Buffer.from(${JSON.stringify((await fs.promises.readFile(resourcePath)).toString("base64"))}, 'base64'
|
||||
)
|
||||
|
||||
export function GET() {
|
||||
return new NextResponse(buffer, {
|
||||
headers: {
|
||||
'Content-Type': contentType,
|
||||
'Cache-Control': ${JSON.stringify(cache)},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const dynamic = 'force-static'
|
||||
`;
|
||||
return code;
|
||||
}
|
||||
function getDynamicTextRouteCode(resourcePath) {
|
||||
return `\
|
||||
/* dynamic asset route */
|
||||
import { NextResponse } from 'next/server'
|
||||
import handler from ${JSON.stringify(resourcePath)}
|
||||
import { resolveRouteData } from 'next/dist/build/webpack/loaders/metadata/resolve-route-data'
|
||||
|
||||
const contentType = ${JSON.stringify(getContentType(resourcePath))}
|
||||
const fileType = ${JSON.stringify(getFilenameAndExtension(resourcePath).name)}
|
||||
|
||||
${errorOnBadHandler(resourcePath)}
|
||||
|
||||
export async function GET() {
|
||||
const data = await handler()
|
||||
const content = resolveRouteData(data, fileType)
|
||||
|
||||
return new NextResponse(content, {
|
||||
headers: {
|
||||
'Content-Type': contentType,
|
||||
'Cache-Control': ${JSON.stringify(cacheHeader.revalidate)},
|
||||
},
|
||||
})
|
||||
}
|
||||
`;
|
||||
}
|
||||
// <metadata-image>/[id]/route.js
|
||||
function getDynamicImageRouteCode(resourcePath) {
|
||||
return `\
|
||||
/* dynamic image route */
|
||||
import { NextResponse } from 'next/server'
|
||||
import * as userland from ${JSON.stringify(resourcePath)}
|
||||
|
||||
const imageModule = { ...userland }
|
||||
|
||||
const handler = imageModule.default
|
||||
const generateImageMetadata = imageModule.generateImageMetadata
|
||||
|
||||
${errorOnBadHandler(resourcePath)}
|
||||
|
||||
export async function GET(_, ctx) {
|
||||
const { __metadata_id__, ...params } = ctx.params || {}
|
||||
const targetId = __metadata_id__?.[0]
|
||||
let id = undefined
|
||||
const imageMetadata = generateImageMetadata ? await generateImageMetadata({ params }) : null
|
||||
|
||||
if (imageMetadata) {
|
||||
id = imageMetadata.find((item) => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (item?.id == null) {
|
||||
throw new Error('id property is required for every item returned from generateImageMetadata')
|
||||
}
|
||||
}
|
||||
return item.id.toString() === targetId
|
||||
})?.id
|
||||
if (id == null) {
|
||||
return new NextResponse('Not Found', {
|
||||
status: 404,
|
||||
})
|
||||
}
|
||||
}
|
||||
return handler({ params: ctx.params ? params : undefined, id })
|
||||
}
|
||||
`;
|
||||
}
|
||||
async function getDynamicSiteMapRouteCode(resourcePath, page, loaderContext) {
|
||||
let staticGenerationCode = "";
|
||||
const exportNames = await getLoaderModuleNamedExports(resourcePath, loaderContext);
|
||||
// Re-export configs but avoid conflicted exports
|
||||
const reExportNames = exportNames.filter((name)=>name !== "default" && name !== "generateSitemaps");
|
||||
const hasGenerateSiteMaps = exportNames.includes("generateSitemaps");
|
||||
if (process.env.NODE_ENV === "production" && hasGenerateSiteMaps && page.includes("[__metadata_id__]")) {
|
||||
staticGenerationCode = `\
|
||||
/* dynamic sitemap route */
|
||||
export async function generateStaticParams() {
|
||||
const sitemaps = generateSitemaps ? await generateSitemaps() : []
|
||||
const params = []
|
||||
|
||||
for (const item of sitemaps) {
|
||||
params.push({ __metadata_id__: item.id.toString() + '.xml' })
|
||||
}
|
||||
return params
|
||||
}
|
||||
`;
|
||||
}
|
||||
const code = `\
|
||||
import { NextResponse } from 'next/server'
|
||||
import * as userland from ${JSON.stringify(resourcePath)}
|
||||
import { resolveRouteData } from 'next/dist/build/webpack/loaders/metadata/resolve-route-data'
|
||||
|
||||
const sitemapModule = { ...userland }
|
||||
const handler = sitemapModule.default
|
||||
const generateSitemaps = sitemapModule.generateSitemaps
|
||||
const contentType = ${JSON.stringify(getContentType(resourcePath))}
|
||||
const fileType = ${JSON.stringify(getFilenameAndExtension(resourcePath).name)}
|
||||
|
||||
${errorOnBadHandler(resourcePath)}
|
||||
|
||||
${"" /* re-export the userland route configs */ }
|
||||
${reExportNames.length > 0 ? `export { ${reExportNames.join(", ")} } from ${JSON.stringify(resourcePath)}\n` : ""}
|
||||
|
||||
export async function GET(_, ctx) {
|
||||
const { __metadata_id__, ...params } = ctx.params || {}
|
||||
${"" /* sitemap will be optimized to [__metadata_id__] from [[..._metadata_id__]] in production */ }
|
||||
const targetId = process.env.NODE_ENV !== 'production'
|
||||
? __metadata_id__?.[0]
|
||||
: __metadata_id__
|
||||
|
||||
let id = undefined
|
||||
const sitemaps = generateSitemaps ? await generateSitemaps() : null
|
||||
|
||||
if (sitemaps) {
|
||||
id = sitemaps.find((item) => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (item?.id == null) {
|
||||
throw new Error('id property is required for every item returned from generateSitemaps')
|
||||
}
|
||||
}
|
||||
let itemID = item.id.toString()
|
||||
if(process.env.NODE_ENV === 'production') {
|
||||
itemID += '.xml'
|
||||
}
|
||||
return itemID === targetId
|
||||
})?.id
|
||||
if (id == null) {
|
||||
return new NextResponse('Not Found', {
|
||||
status: 404,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const data = await handler({ id })
|
||||
const content = resolveRouteData(data, fileType)
|
||||
|
||||
return new NextResponse(content, {
|
||||
headers: {
|
||||
'Content-Type': contentType,
|
||||
'Cache-Control': ${JSON.stringify(cacheHeader.revalidate)},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
${staticGenerationCode}
|
||||
`;
|
||||
return code;
|
||||
}
|
||||
// When it's static route, it could be favicon.ico, sitemap.xml, robots.txt etc.
|
||||
// TODO-METADATA: improve the cache control strategy
|
||||
const nextMetadataRouterLoader = async function() {
|
||||
const { page, isDynamic, filePath } = this.getOptions();
|
||||
const { name: fileBaseName } = getFilenameAndExtension(filePath);
|
||||
this.addDependency(filePath);
|
||||
let code = "";
|
||||
if (isDynamic === "1") {
|
||||
if (fileBaseName === "robots" || fileBaseName === "manifest") {
|
||||
code = getDynamicTextRouteCode(filePath);
|
||||
} else if (fileBaseName === "sitemap") {
|
||||
code = await getDynamicSiteMapRouteCode(filePath, page, this);
|
||||
} else {
|
||||
code = getDynamicImageRouteCode(filePath);
|
||||
}
|
||||
} else {
|
||||
code = await getStaticAssetRouteCode(filePath, fileBaseName);
|
||||
}
|
||||
return code;
|
||||
};
|
||||
export default nextMetadataRouterLoader;
|
||||
|
||||
//# sourceMappingURL=next-metadata-route-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-metadata-route-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-metadata-route-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-metadata-route-loader.ts"],"names":["fs","path","imageExtMimeTypeMap","getLoaderModuleNamedExports","errorOnBadHandler","resourcePath","JSON","stringify","cacheHeader","none","longCache","revalidate","getFilenameAndExtension","filename","basename","name","ext","split","getContentType","getStaticAssetRouteCode","fileBaseName","cache","process","env","NODE_ENV","code","promises","readFile","toString","getDynamicTextRouteCode","getDynamicImageRouteCode","getDynamicSiteMapRouteCode","page","loaderContext","staticGenerationCode","exportNames","reExportNames","filter","hasGenerateSiteMaps","includes","length","join","nextMetadataRouterLoader","isDynamic","filePath","getOptions","addDependency"],"mappings":"AACA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AACvB,SAASC,mBAAmB,QAAQ,yBAAwB;AAC5D,SAASC,2BAA2B,QAAQ,UAAS;AAErD,SAASC,kBAAkBC,YAAoB;IAC7C,OAAO,CAAC;;kDAEwC,EAAEC,KAAKC,SAAS,CAC5DF,cACA;;EAEJ,CAAC;AACH;AAEA,MAAMG,cAAc;IAClBC,MAAM;IACNC,WAAW;IACXC,YAAY;AACd;AAUA,OAAO,SAASC,wBAAwBP,YAAoB;IAC1D,MAAMQ,WAAWZ,KAAKa,QAAQ,CAACT;IAC/B,MAAM,CAACU,MAAMC,IAAI,GAAGH,SAASI,KAAK,CAAC,KAAK;IACxC,OAAO;QAAEF;QAAMC;IAAI;AACrB;AAEA,SAASE,eAAeb,YAAoB;IAC1C,IAAI,EAAEU,IAAI,EAAEC,GAAG,EAAE,GAAGJ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F;IAEnB,IAAInB,OAAO;IACX,IAAIkB,cAAc,KAAK;QACrB,IAAIvB,iBAAiB,YAAYA,iBAAiB,YAAY;YAC5DK,OAAOI,wBAAwBe;QACjC,OAAO,IAAIxB,iBAAiB,WAAW;YACrCK,OAAO,MAAMM,2BAA2Ba,UAAUZ,MAAM,IAAI;QAC9D,OAAO;YACLP,OAAOK,yBAAyBc;QAClC;IACF,OAAO;QACLnB,OAAO,MAAMN,wBAAwByB,UAAUxB;IACjD;IAEA,OAAOK;AACT;AAEF,eAAeiB,yBAAwB"}
|
||||
19
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-asset-loader.js
generated
vendored
Normal file
19
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-asset-loader.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import loaderUtils from "next/dist/compiled/loader-utils3";
|
||||
import { getModuleBuildInfo } from "./get-module-build-info";
|
||||
export default function MiddlewareAssetLoader(source) {
|
||||
const name = loaderUtils.interpolateName(this, "[name].[hash].[ext]", {
|
||||
context: this.rootContext,
|
||||
content: source
|
||||
});
|
||||
const filePath = `edge-chunks/asset_${name}`;
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
buildInfo.nextAssetMiddlewareBinding = {
|
||||
filePath: `server/${filePath}`,
|
||||
name
|
||||
};
|
||||
this.emitFile(filePath, source);
|
||||
return `module.exports = ${JSON.stringify(`blob:${name}`)}`;
|
||||
}
|
||||
export const raw = true;
|
||||
|
||||
//# sourceMappingURL=next-middleware-asset-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-asset-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-asset-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-middleware-asset-loader.ts"],"names":["loaderUtils","getModuleBuildInfo","MiddlewareAssetLoader","source","name","interpolateName","context","rootContext","content","filePath","buildInfo","_module","nextAssetMiddlewareBinding","emitFile","JSON","stringify","raw"],"mappings":"AAAA,OAAOA,iBAAiB,mCAAkC;AAC1D,SAASC,kBAAkB,QAAQ,0BAAyB;AAE5D,eAAe,SAASC,sBAAiCC,MAAc;IACrE,MAAMC,OAAOJ,YAAYK,eAAe,CAAC,IAAI,EAAE,uBAAuB;QACpEC,SAAS,IAAI,CAACC,WAAW;QACzBC,SAASL;IACX;IACA,MAAMM,WAAW,CAAC,kBAAkB,EAAEL,KAAK,CAAC;IAC5C,MAAMM,YAAYT,mBAAmB,IAAI,CAACU,OAAO;IACjDD,UAAUE,0BAA0B,GAAG;QACrCH,UAAU,CAAC,OAAO,EAAEA,SAAS,CAAC;QAC9BL;IACF;IACA,IAAI,CAACS,QAAQ,CAACJ,UAAUN;IACxB,OAAO,CAAC,iBAAiB,EAAEW,KAAKC,SAAS,CAAC,CAAC,KAAK,EAAEX,KAAK,CAAC,EAAE,CAAC;AAC7D;AAEA,OAAO,MAAMY,MAAM,KAAI"}
|
||||
35
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-loader.js
generated
vendored
Normal file
35
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-loader.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import { getModuleBuildInfo } from "./get-module-build-info";
|
||||
import { MIDDLEWARE_LOCATION_REGEXP } from "../../../lib/constants";
|
||||
import { loadEntrypoint } from "../../load-entrypoint";
|
||||
// matchers can have special characters that break the loader params
|
||||
// parsing so we base64 encode/decode the string
|
||||
export function encodeMatchers(matchers) {
|
||||
return Buffer.from(JSON.stringify(matchers)).toString("base64");
|
||||
}
|
||||
export function decodeMatchers(encodedMatchers) {
|
||||
return JSON.parse(Buffer.from(encodedMatchers, "base64").toString());
|
||||
}
|
||||
export default async function middlewareLoader() {
|
||||
const { absolutePagePath, page, rootDir, matchers: encodedMatchers, preferredRegion, middlewareConfig: middlewareConfigBase64 } = this.getOptions();
|
||||
const matchers = encodedMatchers ? decodeMatchers(encodedMatchers) : undefined;
|
||||
const pagePath = this.utils.contextify(this.context || this.rootContext, absolutePagePath);
|
||||
const middlewareConfig = JSON.parse(Buffer.from(middlewareConfigBase64, "base64").toString());
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
buildInfo.nextEdgeMiddleware = {
|
||||
matchers,
|
||||
page: page.replace(new RegExp(`/${MIDDLEWARE_LOCATION_REGEXP}$`), "") || "/"
|
||||
};
|
||||
buildInfo.rootDir = rootDir;
|
||||
buildInfo.route = {
|
||||
page,
|
||||
absolutePagePath,
|
||||
preferredRegion,
|
||||
middlewareConfig
|
||||
};
|
||||
return await loadEntrypoint("middleware", {
|
||||
VAR_USERLAND: pagePath,
|
||||
VAR_DEFINITION_PAGE: page
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-middleware-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-middleware-loader.ts"],"names":["getModuleBuildInfo","MIDDLEWARE_LOCATION_REGEXP","loadEntrypoint","encodeMatchers","matchers","Buffer","from","JSON","stringify","toString","decodeMatchers","encodedMatchers","parse","middlewareLoader","absolutePagePath","page","rootDir","preferredRegion","middlewareConfig","middlewareConfigBase64","getOptions","undefined","pagePath","utils","contextify","context","rootContext","buildInfo","_module","nextEdgeMiddleware","replace","RegExp","route","VAR_USERLAND","VAR_DEFINITION_PAGE"],"mappings":"AAIA,SAASA,kBAAkB,QAAQ,0BAAyB;AAC5D,SAASC,0BAA0B,QAAQ,yBAAwB;AACnE,SAASC,cAAc,QAAQ,wBAAuB;AAWtD,oEAAoE;AACpE,gDAAgD;AAChD,OAAO,SAASC,eAAeC,QAA6B;IAC1D,OAAOC,OAAOC,IAAI,CAACC,KAAKC,SAAS,CAACJ,WAAWK,QAAQ,CAAC;AACxD;AAEA,OAAO,SAASC,eAAeC,eAAuB;IACpD,OAAOJ,KAAKK,KAAK,CACfP,OAAOC,IAAI,CAACK,iBAAiB,UAAUF,QAAQ;AAEnD;AAEA,eAAe,eAAeI;IAC5B,MAAM,EACJC,gBAAgB,EAChBC,IAAI,EACJC,OAAO,EACPZ,UAAUO,eAAe,EACzBM,eAAe,EACfC,kBAAkBC,sBAAsB,EACzC,GAA4B,IAAI,CAACC,UAAU;IAC5C,MAAMhB,WAAWO,kBAAkBD,eAAeC,mBAAmBU;IACrE,MAAMC,WAAW,IAAI,CAACC,KAAK,CAACC,UAAU,CACpC,IAAI,CAACC,OAAO,IAAI,IAAI,CAACC,WAAW,EAChCZ;IAGF,MAAMI,mBAAqCX,KAAKK,KAAK,CACnDP,OAAOC,IAAI,CAACa,wBAAwB,UAAUV,QAAQ;IAExD,MAAMkB,YAAY3B,mBAAmB,IAAI,CAAC4B,OAAO;IACjDD,UAAUE,kBAAkB,GAAG;QAC7BzB;QACAW,MACEA,KAAKe,OAAO,CAAC,IAAIC,OAAO,CAAC,CAAC,EAAE9B,2BAA2B,CAAC,CAAC,GAAG,OAAO;IACvE;IACA0B,UAAUX,OAAO,GAAGA;IACpBW,UAAUK,KAAK,GAAG;QAChBjB;QACAD;QACAG;QACAC;IACF;IAEA,OAAO,MAAMhB,eAAe,cAAc;QACxC+B,cAAcX;QACdY,qBAAqBnB;IACvB;AACF"}
|
||||
19
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-wasm-loader.js
generated
vendored
Normal file
19
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-wasm-loader.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import { getModuleBuildInfo } from "./get-module-build-info";
|
||||
import crypto from "crypto";
|
||||
function sha1(source) {
|
||||
return crypto.createHash("sha1").update(source).digest("hex");
|
||||
}
|
||||
export default function MiddlewareWasmLoader(source) {
|
||||
const name = `wasm_${sha1(source)}`;
|
||||
const filePath = `edge-chunks/${name}.wasm`;
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
buildInfo.nextWasmMiddlewareBinding = {
|
||||
filePath: `server/${filePath}`,
|
||||
name
|
||||
};
|
||||
this.emitFile(`/${filePath}`, source, null);
|
||||
return `module.exports = ${name};`;
|
||||
}
|
||||
export const raw = true;
|
||||
|
||||
//# sourceMappingURL=next-middleware-wasm-loader.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-wasm-loader.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-middleware-wasm-loader.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/build/webpack/loaders/next-middleware-wasm-loader.ts"],"names":["getModuleBuildInfo","crypto","sha1","source","createHash","update","digest","MiddlewareWasmLoader","name","filePath","buildInfo","_module","nextWasmMiddlewareBinding","emitFile","raw"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,0BAAyB;AAC5D,OAAOC,YAAY,SAAQ;AAE3B,SAASC,KAAKC,MAAuB;IACnC,OAAOF,OAAOG,UAAU,CAAC,QAAQC,MAAM,CAACF,QAAQG,MAAM,CAAC;AACzD;AAEA,eAAe,SAASC,qBAAgCJ,MAAc;IACpE,MAAMK,OAAO,CAAC,KAAK,EAAEN,KAAKC,QAAQ,CAAC;IACnC,MAAMM,WAAW,CAAC,YAAY,EAAED,KAAK,KAAK,CAAC;IAC3C,MAAME,YAAYV,mBAAmB,IAAI,CAACW,OAAO;IACjDD,UAAUE,yBAAyB,GAAG;QAAEH,UAAU,CAAC,OAAO,EAAEA,SAAS,CAAC;QAAED;IAAK;IAC7E,IAAI,CAACK,QAAQ,CAAC,CAAC,CAAC,EAAEJ,SAAS,CAAC,EAAEN,QAAQ;IACtC,OAAO,CAAC,iBAAiB,EAAEK,KAAK,CAAC,CAAC;AACpC;AAEA,OAAO,MAAMM,MAAM,KAAI"}
|
||||
112
node_modules/next/dist/esm/build/webpack/loaders/next-route-loader/index.js
generated
vendored
Normal file
112
node_modules/next/dist/esm/build/webpack/loaders/next-route-loader/index.js
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
import { stringify } from "querystring";
|
||||
import { getModuleBuildInfo } from "../get-module-build-info";
|
||||
import { RouteKind } from "../../../../server/future/route-kind";
|
||||
import { normalizePagePath } from "../../../../shared/lib/page-path/normalize-page-path";
|
||||
import { decodeFromBase64, encodeToBase64 } from "../utils";
|
||||
import { isInstrumentationHookFile } from "../../../utils";
|
||||
import { loadEntrypoint } from "../../../load-entrypoint";
|
||||
/**
|
||||
* Returns the loader entry for a given page.
|
||||
*
|
||||
* @param options the options to create the loader entry
|
||||
* @returns the encoded loader entry
|
||||
*/ export function getRouteLoaderEntry(options) {
|
||||
switch(options.kind){
|
||||
case 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: encodeToBase64(options.middlewareConfig)
|
||||
};
|
||||
return `next-route-loader?${stringify(query)}!`;
|
||||
}
|
||||
case RouteKind.PAGES_API:
|
||||
{
|
||||
const query = {
|
||||
kind: options.kind,
|
||||
page: options.page,
|
||||
preferredRegion: options.preferredRegion,
|
||||
absolutePagePath: options.absolutePagePath,
|
||||
middlewareConfigBase64: encodeToBase64(options.middlewareConfig)
|
||||
};
|
||||
return `next-route-loader?${stringify(query)}!`;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new Error("Invariant: Unexpected route kind");
|
||||
}
|
||||
}
|
||||
}
|
||||
const loadPages = async ({ page, absolutePagePath, absoluteDocumentPath, absoluteAppPath, preferredRegion, middlewareConfigBase64 }, buildInfo)=>{
|
||||
const middlewareConfig = decodeFromBase64(middlewareConfigBase64);
|
||||
// Attach build info to the module.
|
||||
buildInfo.route = {
|
||||
page,
|
||||
absolutePagePath,
|
||||
preferredRegion,
|
||||
middlewareConfig
|
||||
};
|
||||
let file = await loadEntrypoint("pages", {
|
||||
VAR_USERLAND: absolutePagePath,
|
||||
VAR_MODULE_DOCUMENT: absoluteDocumentPath,
|
||||
VAR_MODULE_APP: absoluteAppPath,
|
||||
VAR_DEFINITION_PAGE: normalizePagePath(page),
|
||||
VAR_DEFINITION_PATHNAME: page
|
||||
});
|
||||
if (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 = decodeFromBase64(middlewareConfigBase64);
|
||||
// Attach build info to the module.
|
||||
buildInfo.route = {
|
||||
page,
|
||||
absolutePagePath,
|
||||
preferredRegion,
|
||||
middlewareConfig
|
||||
};
|
||||
return await loadEntrypoint("pages-api", {
|
||||
VAR_USERLAND: absolutePagePath,
|
||||
VAR_DEFINITION_PAGE: 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 new Error("Invariant: expected this to reference a module");
|
||||
}
|
||||
const buildInfo = getModuleBuildInfo(this._module);
|
||||
const opts = this.getOptions();
|
||||
switch(opts.kind){
|
||||
case RouteKind.PAGES:
|
||||
{
|
||||
return await loadPages(opts, buildInfo);
|
||||
}
|
||||
case RouteKind.PAGES_API:
|
||||
{
|
||||
return await loadPagesAPI(opts, buildInfo);
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new Error("Invariant: Unexpected route kind");
|
||||
}
|
||||
}
|
||||
};
|
||||
export default loader;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/build/webpack/loaders/next-route-loader/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/build/webpack/loaders/next-route-loader/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-route-loader/index.ts"],"names":["stringify","getModuleBuildInfo","RouteKind","normalizePagePath","decodeFromBase64","encodeToBase64","isInstrumentationHookFile","loadEntrypoint","getRouteLoaderEntry","options","kind","PAGES","query","page","preferredRegion","absolutePagePath","absoluteAppPath","pages","absoluteDocumentPath","middlewareConfigBase64","middlewareConfig","PAGES_API","Error","loadPages","buildInfo","route","file","VAR_USERLAND","VAR_MODULE_DOCUMENT","VAR_MODULE_APP","VAR_DEFINITION_PAGE","VAR_DEFINITION_PATHNAME","loadPagesAPI","loader","_module","opts","getOptions"],"mappings":"AAGA,SAASA,SAAS,QAAQ,cAAa;AACvC,SAEEC,kBAAkB,QACb,2BAA0B;AACjC,SAASC,SAAS,QAAQ,uCAAsC;AAChE,SAASC,iBAAiB,QAAQ,uDAAsD;AACxF,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,WAAU;AAC3D,SAASC,yBAAyB,QAAQ,iBAAgB;AAC1D,SAASC,cAAc,QAAQ,2BAA0B;AAuFzD;;;;;CAKC,GACD,OAAO,SAASC,oBAAoBC,OAAgC;IAClE,OAAQA,QAAQC,IAAI;QAClB,KAAKR,UAAUS,KAAK;YAAE;gBACpB,MAAMC,QAAiC;oBACrCF,MAAMD,QAAQC,IAAI;oBAClBG,MAAMJ,QAAQI,IAAI;oBAClBC,iBAAiBL,QAAQK,eAAe;oBACxCC,kBAAkBN,QAAQM,gBAAgB;oBAC1C,uEAAuE;oBACvE,qCAAqC;oBACrCC,iBAAiBP,QAAQQ,KAAK,CAAC,QAAQ;oBACvCC,sBAAsBT,QAAQQ,KAA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kB,yBAAyBlB;IAC3B;AACF;AAEA;;;CAGC,GACD,MAAMoB,SACJ;IACE,IAAI,CAAC,IAAI,CAACC,OAAO,EAAE;QACjB,MAAM,IAAIZ,MAAM;IAClB;IAEA,MAAME,YAAYvB,mBAAmB,IAAI,CAACiC,OAAO;IACjD,MAAMC,OAAO,IAAI,CAACC,UAAU;IAE5B,OAAQD,KAAKzB,IAAI;QACf,KAAKR,UAAUS,KAAK;YAAE;gBACpB,OAAO,MAAMY,UAAUY,MAAMX;YAC/B;QACA,KAAKtB,UAAUmB,SAAS;YAAE;gBACxB,OAAO,MAAMW,aAAaG,MAAMX;YAClC;QACA;YAAS;gBACP,MAAM,IAAIF,MAAM;YAClB;IACF;AACF;AAEF,eAAeW,OAAM"}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user