main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
/// <reference types="lodash" />
import { webpack } from 'next/dist/compiled/webpack/webpack';
import { ConfigurationContext } from '../utils';
export declare const base: import("lodash").CurriedFunction2<ConfigurationContext, webpack.Configuration, webpack.Configuration>;

View File

@@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "base", {
enumerable: true,
get: function() {
return base;
}
});
const _lodashcurry = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/lodash.curry"));
const _constants = require("../../../../shared/lib/constants");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const base = (0, _lodashcurry.default)(function base(ctx, config) {
config.mode = ctx.isDevelopment ? "development" : "production";
config.name = ctx.isServer ? ctx.isEdgeRuntime ? _constants.COMPILER_NAMES.edgeServer : _constants.COMPILER_NAMES.server : _constants.COMPILER_NAMES.client;
config.target = !ctx.targetWeb ? "node16.14" // Same version defined in packages/next/package.json#engines
: ctx.isEdgeRuntime ? [
"web",
"es6"
] : [
"web",
"es5"
];
// https://webpack.js.org/configuration/devtool/#development
if (ctx.isDevelopment) {
if (process.env.__NEXT_TEST_MODE && !process.env.__NEXT_TEST_WITH_DEVTOOL) {
config.devtool = false;
} else {
// `eval-source-map` provides full-fidelity source maps for the
// original source, including columns and original variable names.
// This is desirable so the in-browser debugger can correctly pause
// and show scoped variables with their original names.
config.devtool = "eval-source-map";
}
} else {
if (ctx.isEdgeRuntime || ctx.isServer && ctx.serverSourceMaps || // Enable browser sourcemaps:
ctx.productionBrowserSourceMaps && ctx.isClient) {
config.devtool = "source-map";
} else {
config.devtool = false;
}
}
if (!config.module) {
config.module = {
rules: []
};
}
// TODO: add codemod for "Should not import the named export" with JSON files
// config.module.strictExportPresence = !isWebpack5
return config;
});
//# sourceMappingURL=base.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/config/blocks/base.ts"],"names":["base","curry","ctx","config","mode","isDevelopment","name","isServer","isEdgeRuntime","COMPILER_NAMES","edgeServer","server","client","target","targetWeb","process","env","__NEXT_TEST_MODE","__NEXT_TEST_WITH_DEVTOOL","devtool","serverSourceMaps","productionBrowserSourceMaps","isClient","module","rules"],"mappings":";;;;+BAKaA;;;eAAAA;;;oEALK;2BAEa;;;;;;AAGxB,MAAMA,OAAOC,IAAAA,oBAAK,EAAC,SAASD,KACjCE,GAAyB,EACzBC,MAA6B;IAE7BA,OAAOC,IAAI,GAAGF,IAAIG,aAAa,GAAG,gBAAgB;IAClDF,OAAOG,IAAI,GAAGJ,IAAIK,QAAQ,GACtBL,IAAIM,aAAa,GACfC,yBAAc,CAACC,UAAU,GACzBD,yBAAc,CAACE,MAAM,GACvBF,yBAAc,CAACG,MAAM;IAEzBT,OAAOU,MAAM,GAAG,CAACX,IAAIY,SAAS,GAC1B,YAAY,6DAA6D;OACzEZ,IAAIM,aAAa,GACjB;QAAC;QAAO;KAAM,GACd;QAAC;QAAO;KAAM;IAElB,4DAA4D;IAC5D,IAAIN,IAAIG,aAAa,EAAE;QACrB,IAAIU,QAAQC,GAAG,CAACC,gBAAgB,IAAI,CAACF,QAAQC,GAAG,CAACE,wBAAwB,EAAE;YACzEf,OAAOgB,OAAO,GAAG;QACnB,OAAO;YACL,+DAA+D;YAC/D,kEAAkE;YAClE,mEAAmE;YACnE,uDAAuD;YACvDhB,OAAOgB,OAAO,GAAG;QACnB;IACF,OAAO;QACL,IACEjB,IAAIM,aAAa,IAChBN,IAAIK,QAAQ,IAAIL,IAAIkB,gBAAgB,IACrC,6BAA6B;QAC5BlB,IAAImB,2BAA2B,IAAInB,IAAIoB,QAAQ,EAChD;YACAnB,OAAOgB,OAAO,GAAG;QACnB,OAAO;YACLhB,OAAOgB,OAAO,GAAG;QACnB;IACF;IAEA,IAAI,CAAChB,OAAOoB,MAAM,EAAE;QAClBpB,OAAOoB,MAAM,GAAG;YAAEC,OAAO,EAAE;QAAC;IAC9B;IAEA,6EAA6E;IAC7E,mDAAmD;IAEnD,OAAOrB;AACT"}

View File

@@ -0,0 +1,6 @@
/// <reference types="lodash" />
import { webpack } from 'next/dist/compiled/webpack/webpack';
import { ConfigurationContext } from '../../utils';
export declare const regexLikeCss: RegExp;
export declare function lazyPostCSS(rootDirectory: string, supportedBrowsers: string[] | undefined, disablePostcssPresetEnv: boolean | undefined): Promise<any>;
export declare const css: import("lodash").CurriedFunction2<ConfigurationContext, webpack.Configuration, Promise<webpack.Configuration>>;

View File

@@ -0,0 +1,568 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
regexLikeCss: null,
lazyPostCSS: null,
css: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
regexLikeCss: function() {
return regexLikeCss;
},
lazyPostCSS: function() {
return lazyPostCSS;
},
css: function() {
return css;
}
});
const _lodashcurry = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/lodash.curry"));
const _helpers = require("../../helpers");
const _utils = require("../../utils");
const _loaders = require("./loaders");
const _nextfont = require("./loaders/next-font");
const _messages = require("./messages");
const _plugins = require("./plugins");
const _nonnullable = require("../../../../../lib/non-nullable");
const _constants = require("../../../../../lib/constants");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const regexLikeCss = /\.(css|scss|sass)$/;
// RegExps for Style Sheets
const regexCssGlobal = /(?<!\.module)\.css$/;
const regexCssModules = /\.module\.css$/;
// RegExps for Syntactically Awesome Style Sheets
const regexSassGlobal = /(?<!\.module)\.(scss|sass)$/;
const regexSassModules = /\.module\.(scss|sass)$/;
const APP_LAYER_RULE = {
or: [
_constants.WEBPACK_LAYERS.reactServerComponents,
_constants.WEBPACK_LAYERS.serverSideRendering,
_constants.WEBPACK_LAYERS.appPagesBrowser
]
};
const PAGES_LAYER_RULE = {
not: [
_constants.WEBPACK_LAYERS.reactServerComponents,
_constants.WEBPACK_LAYERS.serverSideRendering,
_constants.WEBPACK_LAYERS.appPagesBrowser
]
};
/**
* Mark a rule as removable if built-in CSS support is disabled
*/ function markRemovable(r) {
Object.defineProperty(r, Symbol.for("__next_css_remove"), {
enumerable: false,
value: true
});
return r;
}
let postcssInstancePromise;
async function lazyPostCSS(rootDirectory, supportedBrowsers, disablePostcssPresetEnv) {
if (!postcssInstancePromise) {
postcssInstancePromise = (async ()=>{
const postcss = require("postcss");
// @ts-ignore backwards compat
postcss.plugin = function postcssPlugin(name, initializer) {
function creator(...args) {
let transformer = initializer(...args);
transformer.postcssPlugin = name;
// transformer.postcssVersion = new Processor().version
return transformer;
}
let cache;
Object.defineProperty(creator, "postcss", {
get () {
if (!cache) cache = creator();
return cache;
}
});
creator.process = function(css, processOpts, pluginOpts) {
return postcss([
creator(pluginOpts)
]).process(css, processOpts);
};
return creator;
};
// @ts-ignore backwards compat
postcss.vendor = {
/**
* Returns the vendor prefix extracted from an input string.
*
* @example
* postcss.vendor.prefix('-moz-tab-size') //=> '-moz-'
* postcss.vendor.prefix('tab-size') //=> ''
*/ prefix: function prefix(prop) {
const match = prop.match(/^(-\w+-)/);
if (match) {
return match[0];
}
return "";
},
/**
* Returns the input string stripped of its vendor prefix.
*
* @example
* postcss.vendor.unprefixed('-moz-tab-size') //=> 'tab-size'
*/ unprefixed: function unprefixed(/**
* String with or without vendor prefix.
*/ prop) {
return prop.replace(/^-\w+-/, "");
}
};
const postCssPlugins = await (0, _plugins.getPostCssPlugins)(rootDirectory, supportedBrowsers, disablePostcssPresetEnv);
return {
postcss,
postcssWithPlugins: postcss(postCssPlugins)
};
})();
}
return postcssInstancePromise;
}
const css = (0, _lodashcurry.default)(async function css(ctx, config) {
const { prependData: sassPrependData, additionalData: sassAdditionalData, ...sassOptions } = ctx.sassOptions;
const lazyPostCSSInitializer = ()=>lazyPostCSS(ctx.rootDirectory, ctx.supportedBrowsers, ctx.experimental.disablePostcssPresetEnv);
const sassPreprocessors = [
// First, process files with `sass-loader`: this inlines content, and
// compiles away the proprietary syntax.
{
loader: require.resolve("next/dist/compiled/sass-loader"),
options: {
// Source maps are required so that `resolve-url-loader` can locate
// files original to their source directory.
sourceMap: true,
sassOptions: {
// The "fibers" option is not needed for Node.js 16+, but it's causing
// problems for Node.js <= 14 users as you'll have to manually install
// the `fibers` package:
// https://github.com/webpack-contrib/sass-loader#:~:text=We%20automatically%20inject%20the%20fibers%20package
// https://github.com/vercel/next.js/issues/45052
// Since it's optional and not required, we'll disable it by default
// to avoid the confusion.
fibers: false,
...sassOptions
},
additionalData: sassPrependData || sassAdditionalData
}
},
// Then, `sass-loader` will have passed-through CSS imports as-is instead
// of inlining them. Because they were inlined, the paths are no longer
// correct.
// To fix this, we use `resolve-url-loader` to rewrite the CSS
// imports to real file paths.
{
loader: require.resolve("../../../loaders/resolve-url-loader/index"),
options: {
postcss: lazyPostCSSInitializer,
// Source maps are not required here, but we may as well emit
// them.
sourceMap: true
}
}
];
const fns = [];
const googleLoader = require.resolve("next/dist/compiled/@next/font/google/loader");
const localLoader = require.resolve("next/dist/compiled/@next/font/local/loader");
const nextFontLoaders = [
[
require.resolve("next/font/google/target.css"),
googleLoader
],
[
require.resolve("next/font/local/target.css"),
localLoader
],
// TODO: remove this in the next major version
[
/node_modules[\\/]@next[\\/]font[\\/]google[\\/]target.css/,
googleLoader
],
[
/node_modules[\\/]@next[\\/]font[\\/]local[\\/]target.css/,
localLoader
]
];
nextFontLoaders.forEach(([fontLoaderTarget, fontLoaderPath])=>{
// Matches the resolved font loaders noop files to run next-font-loader
fns.push((0, _helpers.loader)({
oneOf: [
markRemovable({
sideEffects: false,
test: fontLoaderTarget,
use: (0, _nextfont.getNextFontLoader)(ctx, lazyPostCSSInitializer, fontLoaderPath)
})
]
}));
});
// CSS cannot be imported in _document. This comes before everything because
// global CSS nor CSS modules work in said file.
fns.push((0, _helpers.loader)({
oneOf: [
markRemovable({
test: regexLikeCss,
// Use a loose regex so we don't have to crawl the file system to
// find the real file name (if present).
issuer: /pages[\\/]_document\./,
use: {
loader: "error-loader",
options: {
reason: (0, _messages.getCustomDocumentError)()
}
}
})
]
}));
const shouldIncludeExternalCSSImports = !!ctx.experimental.craCompat || !!ctx.transpilePackages;
// CSS modules & SASS modules support. They are allowed to be imported in anywhere.
fns.push(// CSS Modules should never have side effects. This setting will
// allow unused CSS to be removed from the production build.
// We ensure this by disallowing `:global()` CSS at the top-level
// via the `pure` mode in `css-loader`.
(0, _helpers.loader)({
oneOf: [
// For app dir, we need to match the specific app layer.
ctx.hasAppDir ? markRemovable({
sideEffects: false,
test: regexCssModules,
issuerLayer: APP_LAYER_RULE,
use: [
{
loader: require.resolve("../../../loaders/next-flight-css-loader"),
options: {
cssModules: true
}
},
...(0, _loaders.getCssModuleLoader)({
...ctx,
isAppDir: true
}, lazyPostCSSInitializer)
]
}) : null,
markRemovable({
sideEffects: false,
test: regexCssModules,
issuerLayer: PAGES_LAYER_RULE,
use: (0, _loaders.getCssModuleLoader)({
...ctx,
isAppDir: false
}, lazyPostCSSInitializer)
})
].filter(_nonnullable.nonNullable)
}), // Opt-in support for Sass (using .scss or .sass extensions).
// Sass Modules should never have side effects. This setting will
// allow unused Sass to be removed from the production build.
// We ensure this by disallowing `:global()` Sass at the top-level
// via the `pure` mode in `css-loader`.
(0, _helpers.loader)({
oneOf: [
// For app dir, we need to match the specific app layer.
ctx.hasAppDir ? markRemovable({
sideEffects: false,
test: regexSassModules,
issuerLayer: APP_LAYER_RULE,
use: [
{
loader: require.resolve("../../../loaders/next-flight-css-loader"),
options: {
cssModules: true
}
},
...(0, _loaders.getCssModuleLoader)({
...ctx,
isAppDir: true
}, lazyPostCSSInitializer, sassPreprocessors)
]
}) : null,
markRemovable({
sideEffects: false,
test: regexSassModules,
issuerLayer: PAGES_LAYER_RULE,
use: (0, _loaders.getCssModuleLoader)({
...ctx,
isAppDir: false
}, lazyPostCSSInitializer, sassPreprocessors)
})
].filter(_nonnullable.nonNullable)
}), // Throw an error for CSS Modules used outside their supported scope
(0, _helpers.loader)({
oneOf: [
markRemovable({
test: [
regexCssModules,
regexSassModules
],
use: {
loader: "error-loader",
options: {
reason: (0, _messages.getLocalModuleImportError)()
}
}
})
]
}));
// Global CSS and SASS support.
if (ctx.isServer) {
fns.push((0, _helpers.loader)({
oneOf: [
ctx.hasAppDir && !ctx.isProduction ? markRemovable({
sideEffects: true,
test: [
regexCssGlobal,
regexSassGlobal
],
issuerLayer: APP_LAYER_RULE,
use: {
loader: require.resolve("../../../loaders/next-flight-css-loader"),
options: {
cssModules: false
}
}
}) : null,
markRemovable({
// CSS imports have side effects, even on the server side.
sideEffects: true,
test: [
regexCssGlobal,
regexSassGlobal
],
use: require.resolve("next/dist/compiled/ignore-loader")
})
].filter(_nonnullable.nonNullable)
}));
} else {
// External CSS files are allowed to be loaded when any of the following is true:
// - hasAppDir: all CSS files are allowed
// - If the CSS file is located in `node_modules`
// - If the CSS file is located in another package in a monorepo (outside of the current rootDir)
// - If the issuer is pages/_app (matched later)
const allowedPagesGlobalCSSPath = ctx.hasAppDir ? undefined : {
and: [
{
or: [
/node_modules/,
{
not: [
ctx.rootDirectory
]
}
]
}
]
};
const allowedPagesGlobalCSSIssuer = ctx.hasAppDir ? undefined : shouldIncludeExternalCSSImports ? undefined : {
and: [
ctx.rootDirectory
],
not: [
/node_modules/
]
};
fns.push((0, _helpers.loader)({
oneOf: [
...ctx.hasAppDir ? [
markRemovable({
sideEffects: true,
test: regexCssGlobal,
issuerLayer: APP_LAYER_RULE,
use: [
{
loader: require.resolve("../../../loaders/next-flight-css-loader"),
options: {
cssModules: false
}
},
...(0, _loaders.getGlobalCssLoader)({
...ctx,
isAppDir: true
}, lazyPostCSSInitializer)
]
}),
markRemovable({
sideEffects: true,
test: regexSassGlobal,
issuerLayer: APP_LAYER_RULE,
use: [
{
loader: require.resolve("../../../loaders/next-flight-css-loader"),
options: {
cssModules: false
}
},
...(0, _loaders.getGlobalCssLoader)({
...ctx,
isAppDir: true
}, lazyPostCSSInitializer, sassPreprocessors)
]
})
] : [],
markRemovable({
sideEffects: true,
test: regexCssGlobal,
include: allowedPagesGlobalCSSPath,
issuer: allowedPagesGlobalCSSIssuer,
issuerLayer: PAGES_LAYER_RULE,
use: (0, _loaders.getGlobalCssLoader)({
...ctx,
isAppDir: false
}, lazyPostCSSInitializer)
}),
markRemovable({
sideEffects: true,
test: regexSassGlobal,
include: allowedPagesGlobalCSSPath,
issuer: allowedPagesGlobalCSSIssuer,
issuerLayer: PAGES_LAYER_RULE,
use: (0, _loaders.getGlobalCssLoader)({
...ctx,
isAppDir: false
}, lazyPostCSSInitializer, sassPreprocessors)
})
].filter(_nonnullable.nonNullable)
}));
if (ctx.customAppFile) {
fns.push((0, _helpers.loader)({
oneOf: [
markRemovable({
sideEffects: true,
test: regexCssGlobal,
issuer: {
and: [
ctx.customAppFile
]
},
use: (0, _loaders.getGlobalCssLoader)({
...ctx,
isAppDir: false
}, lazyPostCSSInitializer)
})
]
}), (0, _helpers.loader)({
oneOf: [
markRemovable({
sideEffects: true,
test: regexSassGlobal,
issuer: {
and: [
ctx.customAppFile
]
},
use: (0, _loaders.getGlobalCssLoader)({
...ctx,
isAppDir: false
}, lazyPostCSSInitializer, sassPreprocessors)
})
]
}));
}
}
// Throw an error for Global CSS used inside of `node_modules`
if (!shouldIncludeExternalCSSImports) {
fns.push((0, _helpers.loader)({
oneOf: [
markRemovable({
test: [
regexCssGlobal,
regexSassGlobal
],
issuer: {
and: [
/node_modules/
]
},
use: {
loader: "error-loader",
options: {
reason: (0, _messages.getGlobalModuleImportError)()
}
}
})
]
}));
}
// Throw an error for Global CSS used outside of our custom <App> file
fns.push((0, _helpers.loader)({
oneOf: [
markRemovable({
test: [
regexCssGlobal,
regexSassGlobal
],
issuer: ctx.hasAppDir ? {
// If it's inside the app dir, but not importing from a layout file,
// throw an error.
and: [
ctx.rootDirectory
],
not: [
/layout\.(js|mjs|jsx|ts|tsx)$/
]
} : undefined,
use: {
loader: "error-loader",
options: {
reason: (0, _messages.getGlobalImportError)()
}
}
})
]
}));
if (ctx.isClient) {
// Automatically transform references to files (i.e. url()) into URLs
// e.g. url(./logo.svg)
fns.push((0, _helpers.loader)({
oneOf: [
markRemovable({
// This should only be applied to CSS files
issuer: regexLikeCss,
// Exclude extensions that webpack handles by default
exclude: [
/\.(js|mjs|jsx|ts|tsx)$/,
/\.html$/,
/\.json$/,
/\.webpack\[[^\]]+\]$/
],
// `asset/resource` always emits a URL reference, where `asset`
// might inline the asset as a data URI
type: "asset/resource"
})
]
}));
}
// Enable full mini-css-extract-plugin hmr for prod mode pages or app dir
if (ctx.isClient && (ctx.isProduction || ctx.hasAppDir)) {
// Extract CSS as CSS file(s) in the client-side production bundle.
const MiniCssExtractPlugin = require("../../../plugins/mini-css-extract-plugin").default;
fns.push((0, _helpers.plugin)(// @ts-ignore webpack 5 compat
new MiniCssExtractPlugin({
filename: ctx.isProduction ? "static/css/[contenthash].css" : "static/css/[name].css",
chunkFilename: ctx.isProduction ? "static/css/[contenthash].css" : "static/css/[name].css",
// Next.js guarantees that CSS order "doesn't matter", due to imposed
// restrictions:
// 1. Global CSS can only be defined in a single entrypoint (_app)
// 2. CSS Modules generate scoped class names by default and cannot
// include Global CSS (:global() selector).
//
// While not a perfect guarantee (e.g. liberal use of `:global()`
// selector), this assumption is required to code-split CSS.
//
// If this warning were to trigger, it'd be unactionable by the user,
// but likely not valid -- so we disable it.
ignoreOrder: true
})));
}
const fn = (0, _utils.pipe)(...fns);
return fn(config);
});
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
import type { webpack } from 'next/dist/compiled/webpack/webpack';
export declare function getClientStyleLoader({ hasAppDir, isAppDir, isDevelopment, assetPrefix, }: {
hasAppDir: boolean;
isAppDir?: boolean;
isDevelopment: boolean;
assetPrefix: string;
}): webpack.RuleSetUseItem;

View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getClientStyleLoader", {
enumerable: true,
get: function() {
return getClientStyleLoader;
}
});
function getClientStyleLoader({ hasAppDir, isAppDir, isDevelopment, assetPrefix }) {
const shouldEnableApp = typeof isAppDir === "boolean" ? isAppDir : hasAppDir;
// Keep next-style-loader for development mode in `pages/`
if (isDevelopment && !shouldEnableApp) {
return {
loader: "next-style-loader",
options: {
insert: function(element) {
// By default, style-loader injects CSS into the bottom
// of <head>. This causes ordering problems between dev
// and prod. To fix this, we render a <noscript> tag as
// an anchor for the styles to be placed before. These
// styles will be applied _before_ <style jsx global>.
// These elements should always exist. If they do not,
// this code should fail.
var anchorElement = document.querySelector("#__next_css__DO_NOT_USE__");
var parentNode = anchorElement.parentNode// Normally <head>
;
// Each style tag should be placed right before our
// anchor. By inserting before and not after, we do not
// need to track the last inserted element.
parentNode.insertBefore(element, anchorElement);
}
}
};
}
const MiniCssExtractPlugin = require("../../../../plugins/mini-css-extract-plugin").default;
return {
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: `${assetPrefix}/_next/`,
esModule: false
}
};
}
//# sourceMappingURL=client.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/build/webpack/config/blocks/css/loaders/client.ts"],"names":["getClientStyleLoader","hasAppDir","isAppDir","isDevelopment","assetPrefix","shouldEnableApp","loader","options","insert","element","anchorElement","document","querySelector","parentNode","insertBefore","MiniCssExtractPlugin","require","default","publicPath","esModule"],"mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,qBAAqB,EACnCC,SAAS,EACTC,QAAQ,EACRC,aAAa,EACbC,WAAW,EAMZ;IACC,MAAMC,kBAAkB,OAAOH,aAAa,YAAYA,WAAWD;IAEnE,0DAA0D;IAC1D,IAAIE,iBAAiB,CAACE,iBAAiB;QACrC,OAAO;YACLC,QAAQ;YACRC,SAAS;gBACPC,QAAQ,SAAUC,OAAa;oBAC7B,uDAAuD;oBACvD,uDAAuD;oBACvD,uDAAuD;oBACvD,sDAAsD;oBACtD,sDAAsD;oBAEtD,sDAAsD;oBACtD,yBAAyB;oBACzB,IAAIC,gBAAgBC,SAASC,aAAa,CACxC;oBAEF,IAAIC,aAAaH,cAAcG,UAAU,AAAE,kBAAkB;;oBAE7D,mDAAmD;oBACnD,uDAAuD;oBACvD,2CAA2C;oBAC3CA,WAAWC,YAAY,CAACL,SAASC;gBACnC;YACF;QACF;IACF;IAEA,MAAMK,uBACJC,QAAQ,+CAA+CC,OAAO;IAChE,OAAO;QACLX,QAAQS,qBAAqBT,MAAM;QACnCC,SAAS;YACPW,YAAY,CAAC,EAAEd,YAAY,OAAO,CAAC;YACnCe,UAAU;QACZ;IACF;AACF"}

View File

@@ -0,0 +1 @@
export declare function cssFileResolve(url: string, _resourcePath: string, urlImports: any): boolean;

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "cssFileResolve", {
enumerable: true,
get: function() {
return cssFileResolve;
}
});
function cssFileResolve(url, _resourcePath, urlImports) {
if (url.startsWith("/")) {
return false;
}
if (!urlImports && /^[a-z][a-z0-9+.-]*:/i.test(url)) {
return false;
}
return true;
}
//# sourceMappingURL=file-resolve.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/build/webpack/config/blocks/css/loaders/file-resolve.ts"],"names":["cssFileResolve","url","_resourcePath","urlImports","startsWith","test"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,eACdC,GAAW,EACXC,aAAqB,EACrBC,UAAe;IAEf,IAAIF,IAAIG,UAAU,CAAC,MAAM;QACvB,OAAO;IACT;IACA,IAAI,CAACD,cAAc,uBAAuBE,IAAI,CAACJ,MAAM;QACnD,OAAO;IACT;IACA,OAAO;AACT"}

View File

@@ -0,0 +1,2 @@
import { webpack } from 'next/dist/compiled/webpack/webpack';
export declare function getCssModuleLocalIdent(context: webpack.LoaderContext<{}>, _: any, exportName: string, options: object): any;

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getCssModuleLocalIdent", {
enumerable: true,
get: function() {
return getCssModuleLocalIdent;
}
});
const _loaderutils3 = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/loader-utils3"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const regexLikeIndexModule = /(?<!pages[\\/])index\.module\.(scss|sass|css)$/;
function getCssModuleLocalIdent(context, _, exportName, options) {
const relativePath = _path.default.relative(context.rootContext, context.resourcePath).replace(/\\+/g, "/");
// Generate a more meaningful name (parent folder) when the user names the
// file `index.module.css`.
const fileNameOrFolder = regexLikeIndexModule.test(relativePath) ? "[folder]" : "[name]";
// Generate a hash to make the class name unique.
const hash = _loaderutils3.default.getHashDigest(Buffer.from(`filePath:${relativePath}#className:${exportName}`), "sha1", "base64", 5);
// Have webpack interpolate the `[folder]` or `[name]` to its real value.
return _loaderutils3.default.interpolateName(context, fileNameOrFolder + "_" + exportName + "__" + hash, options).replace(// Webpack name interpolation returns `about.module_root__2oFM9` for
// `.root {}` inside a file named `about.module.css`. Let's simplify
// this.
/\.module_/, "_")// Replace invalid symbols with underscores instead of escaping
// https://mathiasbynens.be/notes/css-escapes#identifiers-strings
.replace(/[^a-zA-Z0-9-_]/g, "_")// "they cannot start with a digit, two hyphens, or a hyphen followed by a digit [sic]"
// https://www.w3.org/TR/CSS21/syndata.html#characters
.replace(/^(\d|--|-\d)/, "__$1");
}
//# sourceMappingURL=getCssModuleLocalIdent.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/build/webpack/config/blocks/css/loaders/getCssModuleLocalIdent.ts"],"names":["getCssModuleLocalIdent","regexLikeIndexModule","context","_","exportName","options","relativePath","path","relative","rootContext","resourcePath","replace","fileNameOrFolder","test","hash","loaderUtils","getHashDigest","Buffer","from","interpolateName"],"mappings":";;;;+BAMgBA;;;eAAAA;;;qEANQ;6DACP;;;;;;AAGjB,MAAMC,uBAAuB;AAEtB,SAASD,uBACdE,OAAkC,EAClCC,CAAM,EACNC,UAAkB,EAClBC,OAAe;IAEf,MAAMC,eAAeC,aAAI,CACtBC,QAAQ,CAACN,QAAQO,WAAW,EAAEP,QAAQQ,YAAY,EAClDC,OAAO,CAAC,QAAQ;IAEnB,0EAA0E;IAC1E,2BAA2B;IAC3B,MAAMC,mBAAmBX,qBAAqBY,IAAI,CAACP,gBAC/C,aACA;IAEJ,iDAAiD;IACjD,MAAMQ,OAAOC,qBAAW,CAACC,aAAa,CACpCC,OAAOC,IAAI,CAAC,CAAC,SAAS,EAAEZ,aAAa,WAAW,EAAEF,WAAW,CAAC,GAC9D,QACA,UACA;IAGF,yEAAyE;IACzE,OACEW,qBAAW,CACRI,eAAe,CACdjB,SACAU,mBAAmB,MAAMR,aAAa,OAAOU,MAC7CT,SAEDM,OAAO,CACN,oEAAoE;IACpE,oEAAoE;IACpE,QAAQ;IACR,aACA,IAEF,+DAA+D;IAC/D,iEAAiE;KAChEA,OAAO,CAAC,mBAAmB,IAC5B,uFAAuF;IACvF,sDAAsD;KACrDA,OAAO,CAAC,gBAAgB;AAE/B"}

View File

@@ -0,0 +1,3 @@
import type { webpack } from 'next/dist/compiled/webpack/webpack';
import type { ConfigurationContext } from '../../../utils';
export declare function getGlobalCssLoader(ctx: ConfigurationContext, postcss: any, preProcessors?: readonly webpack.RuleSetUseItem[]): webpack.RuleSetUseItem[];

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getGlobalCssLoader", {
enumerable: true,
get: function() {
return getGlobalCssLoader;
}
});
const _client = require("./client");
const _fileresolve = require("./file-resolve");
function getGlobalCssLoader(ctx, postcss, preProcessors = []) {
const loaders = [];
if (ctx.isClient) {
// Add appropriate development more or production mode style
// loader
loaders.push((0, _client.getClientStyleLoader)({
hasAppDir: ctx.hasAppDir,
isAppDir: ctx.isAppDir,
isDevelopment: ctx.isDevelopment,
assetPrefix: ctx.assetPrefix
}));
}
// Resolve CSS `@import`s and `url()`s
loaders.push({
loader: require.resolve("../../../../loaders/css-loader/src"),
options: {
postcss,
importLoaders: 1 + preProcessors.length,
// Next.js controls CSS Modules eligibility:
modules: false,
url: (url, resourcePath)=>(0, _fileresolve.cssFileResolve)(url, resourcePath, ctx.experimental.urlImports),
import: (url, _, resourcePath)=>(0, _fileresolve.cssFileResolve)(url, resourcePath, ctx.experimental.urlImports)
}
});
// Compile CSS
loaders.push({
loader: require.resolve("../../../../loaders/postcss-loader/src"),
options: {
postcss
}
});
loaders.push(// Webpack loaders run like a stack, so we need to reverse the natural
// order of preprocessors.
...preProcessors.slice().reverse());
return loaders;
}
//# sourceMappingURL=global.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/build/webpack/config/blocks/css/loaders/global.ts"],"names":["getGlobalCssLoader","ctx","postcss","preProcessors","loaders","isClient","push","getClientStyleLoader","hasAppDir","isAppDir","isDevelopment","assetPrefix","loader","require","resolve","options","importLoaders","length","modules","url","resourcePath","cssFileResolve","experimental","urlImports","import","_","slice","reverse"],"mappings":";;;;+BAMgBA;;;eAAAA;;;wBAHqB;6BACN;AAExB,SAASA,mBACdC,GAAyB,EACzBC,OAAY,EACZC,gBAAmD,EAAE;IAErD,MAAMC,UAAoC,EAAE;IAE5C,IAAIH,IAAII,QAAQ,EAAE;QAChB,4DAA4D;QAC5D,SAAS;QACTD,QAAQE,IAAI,CACVC,IAAAA,4BAAoB,EAAC;YACnBC,WAAWP,IAAIO,SAAS;YACxBC,UAAUR,IAAIQ,QAAQ;YACtBC,eAAeT,IAAIS,aAAa;YAChCC,aAAaV,IAAIU,WAAW;QAC9B;IAEJ;IAEA,sCAAsC;IACtCP,QAAQE,IAAI,CAAC;QACXM,QAAQC,QAAQC,OAAO,CAAC;QACxBC,SAAS;YACPb;YACAc,eAAe,IAAIb,cAAcc,MAAM;YACvC,4CAA4C;YAC5CC,SAAS;YACTC,KAAK,CAACA,KAAaC,eACjBC,IAAAA,2BAAc,EAACF,KAAKC,cAAcnB,IAAIqB,YAAY,CAACC,UAAU;YAC/DC,QAAQ,CAACL,KAAaM,GAAQL,eAC5BC,IAAAA,2BAAc,EAACF,KAAKC,cAAcnB,IAAIqB,YAAY,CAACC,UAAU;QACjE;IACF;IAEA,cAAc;IACdnB,QAAQE,IAAI,CAAC;QACXM,QAAQC,QAAQC,OAAO,CAAC;QACxBC,SAAS;YACPb;QACF;IACF;IAEAE,QAAQE,IAAI,CACV,sEAAsE;IACtE,0BAA0B;OACvBH,cAAcuB,KAAK,GAAGC,OAAO;IAGlC,OAAOvB;AACT"}

View File

@@ -0,0 +1,2 @@
export * from './global';
export * from './modules';

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && __export(require("./global")) && __export(require("./modules"));
_export_star(require("./global"), exports);
_export_star(require("./modules"), exports);
function _export_star(from, to) {
Object.keys(from).forEach(function(k) {
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
Object.defineProperty(to, k, {
enumerable: true,
get: function() {
return from[k];
}
});
}
});
return from;
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/build/webpack/config/blocks/css/loaders/index.ts"],"names":[],"mappings":";;;;;qBAAc;qBACA"}

View File

@@ -0,0 +1,3 @@
import { webpack } from 'next/dist/compiled/webpack/webpack';
import { ConfigurationContext } from '../../../utils';
export declare function getCssModuleLoader(ctx: ConfigurationContext, postcss: any, preProcessors?: readonly webpack.RuleSetUseItem[]): webpack.RuleSetUseItem[];

View File

@@ -0,0 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getCssModuleLoader", {
enumerable: true,
get: function() {
return getCssModuleLoader;
}
});
const _client = require("./client");
const _fileresolve = require("./file-resolve");
const _getCssModuleLocalIdent = require("./getCssModuleLocalIdent");
function getCssModuleLoader(ctx, postcss, preProcessors = []) {
const loaders = [];
if (ctx.isClient) {
// Add appropriate development more or production mode style
// loader
loaders.push((0, _client.getClientStyleLoader)({
hasAppDir: ctx.hasAppDir,
isAppDir: ctx.isAppDir,
isDevelopment: ctx.isDevelopment,
assetPrefix: ctx.assetPrefix
}));
}
// Resolve CSS `@import`s and `url()`s
loaders.push({
loader: require.resolve("../../../../loaders/css-loader/src"),
options: {
postcss,
importLoaders: 1 + preProcessors.length,
// Use CJS mode for backwards compatibility:
esModule: false,
url: (url, resourcePath)=>(0, _fileresolve.cssFileResolve)(url, resourcePath, ctx.experimental.urlImports),
import: (url, _, resourcePath)=>(0, _fileresolve.cssFileResolve)(url, resourcePath, ctx.experimental.urlImports),
modules: {
// Do not transform class names (CJS mode backwards compatibility):
exportLocalsConvention: "asIs",
// Server-side (Node.js) rendering support:
exportOnlyLocals: ctx.isServer,
// Disallow global style exports so we can code-split CSS and
// not worry about loading order.
mode: "pure",
// Generate a friendly production-ready name so it's
// reasonably understandable. The same name is used for
// development.
// TODO: Consider making production reduce this to a single
// character?
getLocalIdent: _getCssModuleLocalIdent.getCssModuleLocalIdent
}
}
});
// Compile CSS
loaders.push({
loader: require.resolve("../../../../loaders/postcss-loader/src"),
options: {
postcss
}
});
loaders.push(// Webpack loaders run like a stack, so we need to reverse the natural
// order of preprocessors.
...preProcessors.slice().reverse());
return loaders;
}
//# sourceMappingURL=modules.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/build/webpack/config/blocks/css/loaders/modules.ts"],"names":["getCssModuleLoader","ctx","postcss","preProcessors","loaders","isClient","push","getClientStyleLoader","hasAppDir","isAppDir","isDevelopment","assetPrefix","loader","require","resolve","options","importLoaders","length","esModule","url","resourcePath","cssFileResolve","experimental","urlImports","import","_","modules","exportLocalsConvention","exportOnlyLocals","isServer","mode","getLocalIdent","getCssModuleLocalIdent","slice","reverse"],"mappings":";;;;+BA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pack';
import { ConfigurationContext } from '../../../utils';
export declare function getNextFontLoader(ctx: ConfigurationContext, postcss: any, fontLoaderPath: string): webpack.RuleSetUseItem[];

View File

@@ -0,0 +1,62 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getNextFontLoader", {
enumerable: true,
get: function() {
return getNextFontLoader;
}
});
const _client = require("./client");
const _fileresolve = require("./file-resolve");
function getNextFontLoader(ctx, postcss, fontLoaderPath) {
const loaders = [];
if (ctx.isClient) {
// Add appropriate development mode or production mode style
// loader
loaders.push((0, _client.getClientStyleLoader)({
hasAppDir: ctx.hasAppDir,
isDevelopment: ctx.isDevelopment,
assetPrefix: ctx.assetPrefix
}));
}
loaders.push({
loader: require.resolve("../../../../loaders/css-loader/src"),
options: {
postcss,
importLoaders: 1,
// Use CJS mode for backwards compatibility:
esModule: false,
url: (url, resourcePath)=>(0, _fileresolve.cssFileResolve)(url, resourcePath, ctx.experimental.urlImports),
import: (url, _, resourcePath)=>(0, _fileresolve.cssFileResolve)(url, resourcePath, ctx.experimental.urlImports),
modules: {
// Do not transform class names (CJS mode backwards compatibility):
exportLocalsConvention: "asIs",
// Server-side (Node.js) rendering support:
exportOnlyLocals: ctx.isServer,
// Disallow global style exports so we can code-split CSS and
// not worry about loading order.
mode: "pure",
getLocalIdent: (_context, _localIdentName, exportName, _options, meta)=>{
// hash from next-font-loader
return `__${exportName}_${meta.fontFamilyHash}`;
}
},
fontLoader: true
}
});
loaders.push({
loader: "next-font-loader",
options: {
isDev: ctx.isDevelopment,
isServer: ctx.isServer,
assetPrefix: ctx.assetPrefix,
fontLoaderPath,
postcss
}
});
return loaders;
}
//# sourceMappingURL=next-font.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/build/webpack/config/blocks/css/loaders/next-font.ts"],"names":["getNextFontLoader","ctx","postcss","fontLoaderPath","loaders","isClient","push","getClientStyleLoader","hasAppDir","isDevelopment","assetPrefix","loader","require","resolve","options","importLoaders","esModule","url","resourcePath","cssFileResolve","experimental","urlImports","import","_","modules","exportLocalsConvention","exportOnlyLocals","isServer","mode","getLocalIdent","_context","_localIdentName","exportName","_options","meta","fontFamilyHash","fontLoader","isDev"],"mappings":";;;;+BAKgBA;;;eAAAA;;;wBAHqB;6BACN;AAExB,SAASA,kBACdC,GAAyB,EACzBC,OAAY,EACZC,cAAsB;IAEtB,MAAMC,UAAoC,EAAE;IAE5C,IAAIH,IAAII,QAAQ,EAAE;QAChB,4DAA4D;QAC5D,SAAS;QACTD,QAAQE,IAAI,CACVC,IAAAA,4BAAoB,EAAC;YACnBC,WAAWP,IAAIO,SAAS;YACxBC,eAAeR,IAAIQ,aAAa;YAChCC,aAAaT,IAAIS,WAAW;QAC9B;IAEJ;IAEAN,QAAQE,IAAI,CAAC;QACXK,QAAQC,QAAQC,OAAO,CAAC;QACxBC,SAAS;YACPZ;YACAa,eAAe;YACf,4CAA4C;YAC5CC,UAAU;YACVC,KAAK,CAACA,KAAaC,eACjBC,IAAAA,2BAAc,EAACF,KAAKC,cAAcjB,IAAImB,YAAY,CAACC,UAAU;YAC/DC,QAAQ,CAACL,KAAaM,GAAQL,eAC5BC,IAAAA,2BAAc,EAACF,KAAKC,cAAcjB,IAAImB,YAAY,CAACC,UAAU;YAC/DG,SAAS;gBACP,mEAAmE;gBACnEC,wBAAwB;gBACxB,2CAA2C;gBAC3CC,kBAAkBzB,IAAI0B,QAAQ;gBAC9B,6DAA6D;gBAC7D,iCAAiC;gBACjCC,MAAM;gBACNC,eAAe,CACbC,UACAC,iBACAC,YACAC,UACAC;oBAEA,6BAA6B;oBAC7B,OAAO,CAAC,EAAE,EAAEF,WAAW,CAAC,EAAEE,KAAKC,cAAc,CAAC,CAAC;gBACjD;YACF;YACAC,YAAY;QACd;IACF;IAEAhC,QAAQE,IAAI,CAAC;QACXK,QAAQ;QACRG,SAAS;YACPuB,OAAOpC,IAAIQ,aAAa;YACxBkB,UAAU1B,IAAI0B,QAAQ;YACtBjB,aAAaT,IAAIS,WAAW;YAC5BP;YACAD;QACF;IACF;IAEA,OAAOE;AACT"}

View File

@@ -0,0 +1,4 @@
export declare function getGlobalImportError(): string;
export declare function getGlobalModuleImportError(): string;
export declare function getLocalModuleImportError(): string;
export declare function getCustomDocumentError(): string;

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getGlobalImportError: null,
getGlobalModuleImportError: null,
getLocalModuleImportError: null,
getCustomDocumentError: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getGlobalImportError: function() {
return getGlobalImportError;
},
getGlobalModuleImportError: function() {
return getGlobalModuleImportError;
},
getLocalModuleImportError: function() {
return getLocalModuleImportError;
},
getCustomDocumentError: function() {
return getCustomDocumentError;
}
});
const _chalk = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/chalk"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getGlobalImportError() {
return `Global CSS ${_chalk.default.bold("cannot")} be imported from files other than your ${_chalk.default.bold("Custom <App>")}. Due to the Global nature of stylesheets, and to avoid conflicts, Please move all first-party global CSS imports to ${_chalk.default.cyan("pages/_app.js")}. Or convert the import to Component-Level CSS (CSS Modules).\nRead more: https://nextjs.org/docs/messages/css-global`;
}
function getGlobalModuleImportError() {
return `Global CSS ${_chalk.default.bold("cannot")} be imported from within ${_chalk.default.bold("node_modules")}.\nRead more: https://nextjs.org/docs/messages/css-npm`;
}
function getLocalModuleImportError() {
return `CSS Modules ${_chalk.default.bold("cannot")} be imported from within ${_chalk.default.bold("node_modules")}.\nRead more: https://nextjs.org/docs/messages/css-modules-npm`;
}
function getCustomDocumentError() {
return `CSS ${_chalk.default.bold("cannot")} be imported within ${_chalk.default.cyan("pages/_document.js")}. Please move global styles to ${_chalk.default.cyan("pages/_app.js")}.`;
}
//# sourceMappingURL=messages.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/build/webpack/config/blocks/css/messages.ts"],"names":["getGlobalImportError","getGlobalModuleImportError","getLocalModuleImportError","getCustomDocumentError","chalk","bold","cyan"],"mappings":";;;;;;;;;;;;;;;;;IAEgBA,oBAAoB;eAApBA;;IAUAC,0BAA0B;eAA1BA;;IAQAC,yBAAyB;eAAzBA;;IAQAC,sBAAsB;eAAtBA;;;8DA5BE;;;;;;AAEX,SAASH;IACd,OAAO,CAAC,WAAW,EAAEI,cAAK,CAACC,IAAI,CAC7B,UACA,wCAAwC,EAAED,cAAK,CAACC,IAAI,CACpD,gBACA,qHAAqH,EAAED,cAAK,CAACE,IAAI,CACjI,iBACA,qHAAqH,CAAC;AAC1H;AAEO,SAASL;IACd,OAAO,CAAC,WAAW,EAAEG,cAAK,CAACC,IAAI,CAC7B,UACA,yBAAyB,EAAED,cAAK,CAACC,IAAI,CACrC,gBACA,sDAAsD,CAAC;AAC3D;AAEO,SAASH;IACd,OAAO,CAAC,YAAY,EAAEE,cAAK,CAACC,IAAI,CAC9B,UACA,yBAAyB,EAAED,cAAK,CAACC,IAAI,CACrC,gBACA,8DAA8D,CAAC;AACnE;AAEO,SAASF;IACd,OAAO,CAAC,IAAI,EAAEC,cAAK,CAACC,IAAI,CAAC,UAAU,oBAAoB,EAAED,cAAK,CAACE,IAAI,CACjE,sBACA,+BAA+B,EAAEF,cAAK,CAACE,IAAI,CAAC,iBAAiB,CAAC,CAAC;AACnE"}

View File

@@ -0,0 +1 @@
export declare function getPostCssPlugins(dir: string, supportedBrowsers: string[] | undefined, disablePostcssPresetEnv?: boolean): Promise<import('postcss').AcceptedPlugin[]>;

View File

@@ -0,0 +1,167 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getPostCssPlugins", {
enumerable: true,
get: function() {
return getPostCssPlugins;
}
});
const _chalk = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/chalk"));
const _findconfig = require("../../../../../lib/find-config");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const genericErrorText = "Malformed PostCSS Configuration";
function getError_NullConfig(pluginName) {
return `${_chalk.default.red.bold("Error")}: Your PostCSS configuration for '${pluginName}' cannot have ${_chalk.default.bold("null")} configuration.\nTo disable '${pluginName}', pass ${_chalk.default.bold("false")}, otherwise, pass ${_chalk.default.bold("true")} or a configuration object.`;
}
function isIgnoredPlugin(pluginPath) {
const ignoredRegex = /(?:^|[\\/])(postcss-modules-values|postcss-modules-scope|postcss-modules-extract-imports|postcss-modules-local-by-default|postcss-modules)(?:[\\/]|$)/i;
const match = ignoredRegex.exec(pluginPath);
if (match == null) {
return false;
}
const plugin = match.pop();
console.warn(`${_chalk.default.yellow.bold("Warning")}: Please remove the ${_chalk.default.underline(plugin)} plugin from your PostCSS configuration. ` + `This plugin is automatically configured by Next.js.\n` + "Read more: https://nextjs.org/docs/messages/postcss-ignored-plugin");
return true;
}
const createLazyPostCssPlugin = (fn)=>{
let result = undefined;
const plugin = (...args)=>{
if (result === undefined) result = fn();
if (result.postcss === true) {
return result(...args);
} else if (result.postcss) {
return result.postcss;
}
return result;
};
plugin.postcss = true;
return plugin;
};
async function loadPlugin(dir, pluginName, options) {
if (options === false || isIgnoredPlugin(pluginName)) {
return false;
}
if (options == null) {
console.error(getError_NullConfig(pluginName));
throw new Error(genericErrorText);
}
const pluginPath = require.resolve(pluginName, {
paths: [
dir
]
});
if (isIgnoredPlugin(pluginPath)) {
return false;
} else if (options === true) {
return createLazyPostCssPlugin(()=>require(pluginPath));
} else {
if (typeof options === "object" && Object.keys(options).length === 0) {
return createLazyPostCssPlugin(()=>require(pluginPath));
}
return createLazyPostCssPlugin(()=>require(pluginPath)(options));
}
}
function getDefaultPlugins(supportedBrowsers, disablePostcssPresetEnv) {
return [
require.resolve("next/dist/compiled/postcss-flexbugs-fixes"),
disablePostcssPresetEnv ? false : [
require.resolve("next/dist/compiled/postcss-preset-env"),
{
browsers: supportedBrowsers ?? [
"defaults"
],
autoprefixer: {
// Disable legacy flexbox support
flexbox: "no-2009"
},
// Enable CSS features that have shipped to the
// web platform, i.e. in 2+ browsers unflagged.
stage: 3,
features: {
"custom-properties": false
}
}
]
].filter(Boolean);
}
async function getPostCssPlugins(dir, supportedBrowsers, disablePostcssPresetEnv = false) {
let config = await (0, _findconfig.findConfig)(dir, "postcss");
if (config == null) {
config = {
plugins: getDefaultPlugins(supportedBrowsers, disablePostcssPresetEnv)
};
}
if (typeof config === "function") {
throw new Error(`Your custom PostCSS configuration may not export a function. Please export a plain object instead.\n` + "Read more: https://nextjs.org/docs/messages/postcss-function");
}
// Warn user about configuration keys which are not respected
const invalidKey = Object.keys(config).find((key)=>key !== "plugins");
if (invalidKey) {
console.warn(`${_chalk.default.yellow.bold("Warning")}: Your PostCSS configuration defines a field which is not supported (\`${invalidKey}\`). ` + `Please remove this configuration value.`);
}
// Enforce the user provided plugins if the configuration file is present
let plugins = config.plugins;
if (plugins == null || typeof plugins !== "object") {
throw new Error(`Your custom PostCSS configuration must export a \`plugins\` key.`);
}
if (!Array.isArray(plugins)) {
// Capture variable so TypeScript is happy
const pc = plugins;
plugins = Object.keys(plugins).reduce((acc, curr)=>{
const p = pc[curr];
if (typeof p === "undefined") {
console.error(getError_NullConfig(curr));
throw new Error(genericErrorText);
}
acc.push([
curr,
p
]);
return acc;
}, []);
}
const parsed = [];
plugins.forEach((plugin)=>{
if (plugin == null) {
console.warn(`${_chalk.default.yellow.bold("Warning")}: A ${_chalk.default.bold("null")} PostCSS plugin was provided. This entry will be ignored.`);
} else if (typeof plugin === "string") {
parsed.push([
plugin,
true
]);
} else if (Array.isArray(plugin)) {
const pluginName = plugin[0];
const pluginConfig = plugin[1];
if (typeof pluginName === "string" && (typeof pluginConfig === "boolean" || typeof pluginConfig === "object" || typeof pluginConfig === "string")) {
parsed.push([
pluginName,
pluginConfig
]);
} else {
if (typeof pluginName !== "string") {
console.error(`${_chalk.default.red.bold("Error")}: A PostCSS Plugin must be provided as a ${_chalk.default.bold("string")}. Instead, we got: '${pluginName}'.\n` + "Read more: https://nextjs.org/docs/messages/postcss-shape");
} else {
console.error(`${_chalk.default.red.bold("Error")}: A PostCSS Plugin was passed as an array but did not provide its configuration ('${pluginName}').\n` + "Read more: https://nextjs.org/docs/messages/postcss-shape");
}
throw new Error(genericErrorText);
}
} else if (typeof plugin === "function") {
console.error(`${_chalk.default.red.bold("Error")}: A PostCSS Plugin was passed as a function using require(), but it must be provided as a ${_chalk.default.bold("string")}.\nRead more: https://nextjs.org/docs/messages/postcss-shape`);
throw new Error(genericErrorText);
} else {
console.error(`${_chalk.default.red.bold("Error")}: An unknown PostCSS plugin was provided (${plugin}).\n` + "Read more: https://nextjs.org/docs/messages/postcss-shape");
throw new Error(genericErrorText);
}
});
const resolved = await Promise.all(parsed.map((p)=>loadPlugin(dir, p[0], p[1])));
const filtered = resolved.filter(Boolean);
return filtered;
}
//# sourceMappingURL=plugins.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/build/webpack/config/blocks/css/plugins.ts"],"names":["getPostCssPlugins","genericErrorText","getError_NullConfig","pluginName","chalk","red","bold","isIgnoredPlugin","pluginPath","ignoredRegex","match","exec","plugin","pop","console","warn","yellow","underline","createLazyPostCssPlugin","fn","result","undefined","args","postcss","loadPlugin","dir","options","error","Error","require","resolve","paths","Object","keys","length","getDefaultPlugins","supportedBrowsers","disablePostcssPresetEnv","browsers","autoprefixer","flexbox","stage","features","filter","Boolean","config","findConfig","plugins","invalidKey","find","key","Array","isArray","pc","reduce","acc","curr","p","push","parsed","forEach","pluginConfig","resolved","Promise","all","map","filtered"],"mappings":";;;;+BAmHsBA;;;eAAAA;;;8DAnHJ;4BACS;;;;;;AAY3B,MAAMC,mBAAmB;AAEzB,SAASC,oBAAoBC,UAAkB;IAC7C,OAAO,CAAC,EAAEC,cAAK,CAACC,GAAG,CAACC,IAAI,CACtB,SACA,kCAAkC,EAAEH,WAAW,cAAc,EAAEC,cAAK,CAACE,IAAI,CAC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B,cAAK,CAACC,GAAG,CAACC,IAAI,CACf,SACA,kFAAkF,EAAEH,WAAW,KAAK,CAAC,GACrG;gBAEN;gBACA,MAAM,IAAIyB,MAAM3B;YAClB;QACF,OAAO,IAAI,OAAOW,WAAW,YAAY;YACvCE,QAAQa,KAAK,CACX,CAAC,EAAEvB,cAAK,CAACC,GAAG,CAACC,IAAI,CACf,SACA,0FAA0F,EAAEF,cAAK,CAACE,IAAI,CACtG,UACA,4DAA4D,CAAC;YAEjE,MAAM,IAAIsB,MAAM3B;QAClB,OAAO;YACLa,QAAQa,KAAK,CACX,CAAC,EAAEvB,cAAK,CAACC,GAAG,CAACC,IAAI,CACf,SACA,0CAA0C,EAAEM,OAAO,IAAI,CAAC,GACxD;YAEJ,MAAM,IAAIgB,MAAM3B;QAClB;IACF;IAEA,MAAM6D,WAAW,MAAMC,QAAQC,GAAG,CAChCL,OAAOM,GAAG,CAAC,CAACR,IAAMjC,WAAWC,KAAKgC,CAAC,CAAC,EAAE,EAAEA,CAAC,CAAC,EAAE;IAE9C,MAAMS,WAA+CJ,SAASnB,MAAM,CAClEC;IAGF,OAAOsB;AACT"}

View File

@@ -0,0 +1,4 @@
/// <reference types="lodash" />
import { webpack } from 'next/dist/compiled/webpack/webpack';
import { ConfigurationContext } from '../../utils';
export declare const images: import("lodash").CurriedFunction2<ConfigurationContext, webpack.Configuration, Promise<webpack.Configuration>>;

View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "images", {
enumerable: true,
get: function() {
return images;
}
});
const _lodashcurry = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/lodash.curry"));
const _webpackconfig = require("../../../../webpack-config");
const _helpers = require("../../helpers");
const _utils = require("../../utils");
const _messages = require("./messages");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const images = (0, _lodashcurry.default)(async function images(_ctx, config) {
const fns = [
(0, _helpers.loader)({
oneOf: [
{
test: _webpackconfig.nextImageLoaderRegex,
use: {
loader: "error-loader",
options: {
reason: (0, _messages.getCustomDocumentImageError)()
}
},
issuer: /pages[\\/]_document\./
}
]
})
];
const fn = (0, _utils.pipe)(...fns);
return fn(config);
});
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/build/webpack/config/blocks/images/index.ts"],"names":["images","curry","_ctx","config","fns","loader","oneOf","test","nextImageLoaderRegex","use","options","reason","getCustomDocumentImageError","issuer","fn","pipe"],"mappings":";;;;+BAOaA;;;eAAAA;;;oEAPK;+BAEmB;yBACd;uBACqC;0BAChB;;;;;;AAErC,MAAMA,SAASC,IAAAA,oBAAK,EAAC,eAAeD,OACzCE,IAA0B,EAC1BC,MAA6B;IAE7B,MAAMC,MAAyB;QAC7BC,IAAAA,eAAM,EAAC;YACLC,OAAO;gBACL;oBACEC,MAAMC,mCAAoB;oBAC1BC,KAAK;wBACHJ,QAAQ;wBACRK,SAAS;4BACPC,QAAQC,IAAAA,qCAA2B;wBACrC;oBACF;oBACAC,QAAQ;gBACV;aACD;QACH;KACD;IAED,MAAMC,KAAKC,IAAAA,WAAI,KAAIX;IACnB,OAAOU,GAAGX;AACZ"}

View File

@@ -0,0 +1 @@
export declare function getCustomDocumentImageError(): string;

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getCustomDocumentImageError", {
enumerable: true,
get: function() {
return getCustomDocumentImageError;
}
});
const _chalk = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/chalk"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getCustomDocumentImageError() {
return `Images ${_chalk.default.bold("cannot")} be imported within ${_chalk.default.cyan("pages/_document.js")}. Please move image imports that need to be displayed on every page into ${_chalk.default.cyan("pages/_app.js")}.\nRead more: https://nextjs.org/docs/messages/custom-document-image-import`;
}
//# sourceMappingURL=messages.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../src/build/webpack/config/blocks/images/messages.ts"],"names":["getCustomDocumentImageError","chalk","bold","cyan"],"mappings":";;;;+BAEgBA;;;eAAAA;;;8DAFE;;;;;;AAEX,SAASA;IACd,OAAO,CAAC,OAAO,EAAEC,cAAK,CAACC,IAAI,CAAC,UAAU,oBAAoB,EAAED,cAAK,CAACE,IAAI,CACpE,sBACA,yEAAyE,EAAEF,cAAK,CAACE,IAAI,CACrF,iBACA,2EAA2E,CAAC;AAChF"}

View File

@@ -0,0 +1,5 @@
/// <reference types="lodash" />
import { webpack } from 'next/dist/compiled/webpack/webpack';
export declare const loader: import("lodash").CurriedFunction2<webpack.RuleSetRule, webpack.Configuration, webpack.Configuration>;
export declare const unshiftLoader: import("lodash").CurriedFunction2<webpack.RuleSetRule, webpack.Configuration, webpack.Configuration>;
export declare const plugin: import("lodash").CurriedFunction2<webpack.WebpackPluginInstance, webpack.Configuration, webpack.Configuration>;

78
node_modules/next/dist/build/webpack/config/helpers.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
loader: null,
unshiftLoader: null,
plugin: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
loader: function() {
return loader;
},
unshiftLoader: function() {
return unshiftLoader;
},
plugin: function() {
return plugin;
}
});
const _lodashcurry = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/lodash.curry"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const loader = (0, _lodashcurry.default)(function loader(rule, config) {
var _config_module_rules;
if (!config.module) {
config.module = {
rules: []
};
}
if (rule.oneOf) {
var _config_module_rules1;
const existing = (_config_module_rules1 = config.module.rules) == null ? void 0 : _config_module_rules1.find((arrayRule)=>arrayRule && typeof arrayRule === "object" && arrayRule.oneOf);
if (existing && typeof existing === "object") {
existing.oneOf.push(...rule.oneOf);
return config;
}
}
(_config_module_rules = config.module.rules) == null ? void 0 : _config_module_rules.push(rule);
return config;
});
const unshiftLoader = (0, _lodashcurry.default)(function unshiftLoader(rule, config) {
var _config_module_rules;
if (!config.module) {
config.module = {
rules: []
};
}
if (rule.oneOf) {
var _config_module_rules1;
const existing = (_config_module_rules1 = config.module.rules) == null ? void 0 : _config_module_rules1.find((arrayRule)=>arrayRule && typeof arrayRule === "object" && arrayRule.oneOf);
if (existing && typeof existing === "object") {
var _existing_oneOf;
(_existing_oneOf = existing.oneOf) == null ? void 0 : _existing_oneOf.unshift(...rule.oneOf);
return config;
}
}
(_config_module_rules = config.module.rules) == null ? void 0 : _config_module_rules.unshift(rule);
return config;
});
const plugin = (0, _lodashcurry.default)(function plugin(p, config) {
if (!config.plugins) {
config.plugins = [];
}
config.plugins.push(p);
return config;
});
//# sourceMappingURL=helpers.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/webpack/config/helpers.ts"],"names":["loader","unshiftLoader","plugin","curry","rule","config","module","rules","oneOf","existing","find","arrayRule","push","unshift","p","plugins"],"mappings":";;;;;;;;;;;;;;;;IAGaA,MAAM;eAANA;;IAuBAC,aAAa;eAAbA;;IAuBAC,MAAM;eAANA;;;oEAjDK;;;;;;AAGX,MAAMF,SAASG,IAAAA,oBAAK,EAAC,SAASH,OACnCI,IAAyB,EACzBC,MAA6B;QAiB7BA;IAfA,IAAI,CAACA,OAAOC,MAAM,EAAE;QAClBD,OAAOC,MAAM,GAAG;YAAEC,OAAO,EAAE;QAAC;IAC9B;IAEA,IAAIH,KAAKI,KAAK,EAAE;YACGH;QAAjB,MAAMI,YAAWJ,wBAAAA,OAAOC,MAAM,CAACC,KAAK,qBAAnBF,sBAAqBK,IAAI,CACxC,CAACC,YACCA,aAAa,OAAOA,cAAc,YAAYA,UAAUH,KAAK;QAEjE,IAAIC,YAAY,OAAOA,aAAa,UAAU;YAC5CA,SAASD,KAAK,CAAEI,IAAI,IAAIR,KAAKI,KAAK;YAClC,OAAOH;QACT;IACF;KAEAA,uBAAAA,OAAOC,MAAM,CAACC,KAAK,qBAAnBF,qBAAqBO,IAAI,CAACR;IAC1B,OAAOC;AACT;AAEO,MAAMJ,gBAAgBE,IAAAA,oBAAK,EAAC,SAASF,cAC1CG,IAAyB,EACzBC,MAA6B;QAiB7BA;IAfA,IAAI,CAACA,OAAOC,MAAM,EAAE;QAClBD,OAAOC,MAAM,GAAG;YAAEC,OAAO,EAAE;QAAC;IAC9B;IAEA,IAAIH,KAAKI,KAAK,EAAE;YACGH;QAAjB,MAAMI,YAAWJ,wBAAAA,OAAOC,MAAM,CAACC,KAAK,qBAAnBF,sBAAqBK,IAAI,CACxC,CAACC,YACCA,aAAa,OAAOA,cAAc,YAAYA,UAAUH,KAAK;QAEjE,IAAIC,YAAY,OAAOA,aAAa,UAAU;gBAC5CA;aAAAA,kBAAAA,SAASD,KAAK,qBAAdC,gBAAgBI,OAAO,IAAIT,KAAKI,KAAK;YACrC,OAAOH;QACT;IACF;KAEAA,uBAAAA,OAAOC,MAAM,CAACC,KAAK,qBAAnBF,qBAAqBQ,OAAO,CAACT;IAC7B,OAAOC;AACT;AAEO,MAAMH,SAASC,IAAAA,oBAAK,EAAC,SAASD,OACnCY,CAAgC,EAChCT,MAA6B;IAE7B,IAAI,CAACA,OAAOU,OAAO,EAAE;QACnBV,OAAOU,OAAO,GAAG,EAAE;IACrB;IACAV,OAAOU,OAAO,CAACH,IAAI,CAACE;IACpB,OAAOT;AACT"}

20
node_modules/next/dist/build/webpack/config/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import type { webpack } from 'next/dist/compiled/webpack/webpack';
import type { NextConfigComplete } from '../../../server/config-shared';
export declare function buildConfiguration(config: webpack.Configuration, { hasAppDir, supportedBrowsers, rootDirectory, customAppFile, isDevelopment, isServer, isEdgeRuntime, targetWeb, assetPrefix, sassOptions, productionBrowserSourceMaps, future, transpilePackages, experimental, disableStaticImages, serverSourceMaps, }: {
hasAppDir: boolean;
supportedBrowsers: string[] | undefined;
rootDirectory: string;
customAppFile: RegExp | undefined;
isDevelopment: boolean;
isServer: boolean;
isEdgeRuntime: boolean;
targetWeb: boolean;
assetPrefix: string;
sassOptions: any;
productionBrowserSourceMaps: boolean;
transpilePackages: NextConfigComplete['transpilePackages'];
future: NextConfigComplete['future'];
experimental: NextConfigComplete['experimental'];
disableStaticImages: NextConfigComplete['disableStaticImages'];
serverSourceMaps: NextConfigComplete['experimental']['serverSourceMaps'];
}): Promise<webpack.Configuration>;

46
node_modules/next/dist/build/webpack/config/index.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "buildConfiguration", {
enumerable: true,
get: function() {
return buildConfiguration;
}
});
const _base = require("./blocks/base");
const _css = require("./blocks/css");
const _images = require("./blocks/images");
const _utils = require("./utils");
async function buildConfiguration(config, { hasAppDir, supportedBrowsers, rootDirectory, customAppFile, isDevelopment, isServer, isEdgeRuntime, targetWeb, assetPrefix, sassOptions, productionBrowserSourceMaps, future, transpilePackages, experimental, disableStaticImages, serverSourceMaps }) {
const ctx = {
hasAppDir,
supportedBrowsers,
rootDirectory,
customAppFile,
isDevelopment,
isProduction: !isDevelopment,
isServer,
isEdgeRuntime,
isClient: !isServer,
targetWeb,
assetPrefix: assetPrefix ? assetPrefix.endsWith("/") ? assetPrefix.slice(0, -1) : assetPrefix : "",
sassOptions,
productionBrowserSourceMaps,
transpilePackages,
future,
experimental,
serverSourceMaps: serverSourceMaps ?? false
};
let fns = [
(0, _base.base)(ctx),
(0, _css.css)(ctx)
];
if (!disableStaticImages) {
fns.push((0, _images.images)(ctx));
}
const fn = (0, _utils.pipe)(...fns);
return fn(config);
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/webpack/config/index.ts"],"names":["buildConfiguration","config","hasAppDir","supportedBrowsers","rootDirectory","customAppFile","isDevelopment","isServer","isEdgeRuntime","targetWeb","assetPrefix","sassOptions","productionBrowserSourceMaps","future","transpilePackages","experimental","disableStaticImages","serverSourceMaps","ctx","isProduction","isClient","endsWith","slice","fns","base","css","push","images","fn","pipe"],"mappings":";;;;+BASsBA;;;eAAAA;;;sBALD;qBACD;wBACG;uBACF;AAEd,eAAeA,mBACpBC,MAA6B,EAC7B,EACEC,SAAS,EACTC,iBAAiB,EACjBC,aAAa,EACbC,aAAa,EACbC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,SAAS,EACTC,WAAW,EACXC,WAAW,EACXC,2BAA2B,EAC3BC,MAAM,EACNC,iBAAiB,EACjBC,YAAY,EACZC,mBAAmB,EACnBC,gBAAgB,EAkBjB;IAED,MAAMC,MAA4B;QAChChB;QACAC;QACAC;QACAC;QACAC;QACAa,cAAc,CAACb;QACfC;QACAC;QACAY,UAAU,CAACb;QACXE;QACAC,aAAaA,cACTA,YAAYW,QAAQ,CAAC,OACnBX,YAAYY,KAAK,CAAC,GAAG,CAAC,KACtBZ,cACF;QACJC;QACAC;QACAE;QACAD;QACAE;QACAE,kBAAkBA,oBAAoB;IACxC;IAEA,IAAIM,MAAM;QAACC,IAAAA,UAAI,EAACN;QAAMO,IAAAA,QAAG,EAACP;KAAK;IAC/B,IAAI,CAACF,qBAAqB;QACxBO,IAAIG,IAAI,CAACC,IAAAA,cAAM,EAACT;IAClB;IACA,MAAMU,KAAKC,IAAAA,WAAI,KAAIN;IACnB,OAAOK,GAAG3B;AACZ"}

24
node_modules/next/dist/build/webpack/config/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import type { webpack } from 'next/dist/compiled/webpack/webpack';
import type { NextConfigComplete } from '../../../server/config-shared';
export type ConfigurationContext = {
hasAppDir: boolean;
isAppDir?: boolean;
supportedBrowsers: string[] | undefined;
rootDirectory: string;
customAppFile: RegExp | undefined;
isDevelopment: boolean;
isProduction: boolean;
isServer: boolean;
isClient: boolean;
isEdgeRuntime: boolean;
targetWeb: boolean;
assetPrefix: string;
sassOptions: any;
productionBrowserSourceMaps: boolean;
serverSourceMaps: boolean;
transpilePackages: NextConfigComplete['transpilePackages'];
future: NextConfigComplete['future'];
experimental: NextConfigComplete['experimental'];
};
export type ConfigurationFn = (a: webpack.Configuration) => webpack.Configuration;
export declare const pipe: <R>(...fns: ((a: R) => R | Promise<R>)[]) => (param: R) => R | Promise<R>;

13
node_modules/next/dist/build/webpack/config/utils.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "pipe", {
enumerable: true,
get: function() {
return pipe;
}
});
const pipe = (...fns)=>(param)=>fns.reduce(async (result, next)=>next(await result), param);
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/webpack/config/utils.ts"],"names":["pipe","fns","param","reduce","result","next"],"mappings":";;;;+BAoCaA;;;eAAAA;;;AAAN,MAAMA,OACX,CAAI,GAAGC,MACP,CAACC,QACCD,IAAIE,MAAM,CACR,OAAOC,QAAwBC,OAASA,KAAK,MAAMD,SACnDF"}

View File

@@ -0,0 +1,4 @@
export default class CssSyntaxError extends Error {
stack: any;
constructor(error: any);
}

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return CssSyntaxError;
}
});
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

View 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":";;;;+BAAA;;;eAAqBA;;;AAAN,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,IAAI,CAAC,EAAEJ,OAAO,CAAC;QAE3B,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"}

View File

@@ -0,0 +1,2 @@
declare const camelCase: (input: string | string[], options?: any) => string;
export default camelCase;

View File

@@ -0,0 +1,89 @@
/*
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.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
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);
};
const _default = camelCase;
//# sourceMappingURL=camelcase.js.map

View 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;;;;+BAwGA;;;eAAA;;;AAtGA,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,KAAK,MAAML,OAAOS,KAAK,CAACJ;YACjDH,kBAAkB;YAClBE,sBAAsBD;YACtBA,kBAAkB;YAClBE;QACF,OAAO,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,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;MAEA,WAAeI"}

View File

@@ -0,0 +1 @@
export default function loader(this: any, content: string, map: any, meta: any): Promise<void>;

View File

@@ -0,0 +1,269 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return loader;
}
});
const _CssSyntaxError = /*#__PURE__*/ _interop_require_default(require("./CssSyntaxError"));
const _Warning = /*#__PURE__*/ _interop_require_default(require("../../postcss-loader/src/Warning"));
const _stringifyrequest = require("../../../stringify-request");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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
};
}
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 exports1 = 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)=>(0, _stringifyrequest.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)=>(0, _stringifyrequest.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: exports1,
context: this.context,
rootContext: this.rootContext,
resolver: icssResolver,
urlHandler: (url)=>(0, _stringifyrequest.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.default(error) : error;
}
for (const warning of result.warnings()){
this.emitWarning(new _Warning.default(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: (0, _stringifyrequest.stringifyRequest)(this, require.resolve("./runtime/api"))
});
}
const importCode = getImportCode(imports, options);
const moduleCode = getModuleCode(result, api, replacements, options, this);
const exportCode = getExportCode(exports1, replacements, options);
return `${importCode}${moduleCode}${exportCode}`;
}).then((code)=>{
callback(null, code);
}, (err)=>{
callback(err);
});
}
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import importParser from './postcss-import-parser';
import icssParser from './postcss-icss-parser';
import urlParser from './postcss-url-parser';
export { importParser, icssParser, urlParser };

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
importParser: null,
icssParser: null,
urlParser: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
importParser: function() {
return _postcssimportparser.default;
},
icssParser: function() {
return _postcssicssparser.default;
},
urlParser: function() {
return _postcssurlparser.default;
}
});
const _postcssimportparser = /*#__PURE__*/ _interop_require_default(require("./postcss-import-parser"));
const _postcssicssparser = /*#__PURE__*/ _interop_require_default(require("./postcss-icss-parser"));
const _postcssurlparser = /*#__PURE__*/ _interop_require_default(require("./postcss-url-parser"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/build/webpack/loaders/css-loader/src/plugins/index.ts"],"names":["importParser","icssParser","urlParser"],"mappings":";;;;;;;;;;;;;;;;IAISA,YAAY;eAAZA,4BAAY;;IAAEC,UAAU;eAAVA,0BAAU;;IAAEC,SAAS;eAATA,yBAAS;;;4EAJnB;0EACF;yEACD"}

View File

@@ -0,0 +1,8 @@
declare const plugin: {
(options?: any): {
postcssPlugin: string;
OnceExit(root: any): Promise<void>;
};
postcss: boolean;
};
export default plugin;

View File

@@ -0,0 +1,107 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _icssutils = require("next/dist/compiled/icss-utils");
const _utils = require("../utils");
const plugin = (options = {})=>{
return {
postcssPlugin: "postcss-icss-parser",
async OnceExit (root) {
const importReplacements = Object.create(null);
const { icssImports, icssExports } = (0, _icssutils.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 = (0, _utils.requestify)((0, _utils.normalizeUrl)(normalizedUrl, true), options.rootContext);
const doResolve = async ()=>{
const { resolver, context } = options;
const resolvedUrl = await (0, _utils.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) {
(0, _icssutils.replaceSymbols)(root, importReplacements);
}
for (const name of Object.keys(icssExports)){
const value = (0, _icssutils.replaceValueSymbols)(icssExports[name], importReplacements);
options.exports.push({
name,
value
});
}
}
};
};
plugin.postcss = true;
const _default = plugin;
//# sourceMappingURL=postcss-icss-parser.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../../../src/build/webpack/loaders/css-loader/src/plugins/postcss-icss-parser.ts"],"names":["plugin","options","postcssPlugin","OnceExit","root","importReplacements","Object","create","icssImports","icssExports","extractICSS","imports","Map","tasks","url","tokens","keys","length","normalizedUrl","prefix","queryParts","split","pop","join","request","requestify","normalizeUrl","rootContext","doResolve","resolver","context","resolvedUrl","resolveRequests","Set","push","results","Promise","all","index","item","newUrl","importKey","importName","get","size","set","type","urlHandler","icss","api","dedupe","replacementIndex","token","entries","replacementName","localName","replacements","replaceSymbols","name","value","replaceValueSymbols","exports","postcss"],"mappings":";;;;+BAiHA;;;eAAA;;;2BA7GO;uBAEmD;AAE1D,MAAMA,SAAS,CAACC,UAAe,CAAC,CAAC;IAC/B,OAAO;QACLC,eAAe;QACf,MAAMC,UAASC,IAAS;YACtB,MAAMC,qBAAqBC,OAAOC,MAAM,CAAC;YACzC,MAAM,EAAEC,WAAW,EAAEC,WAAW,EAAE,GAAGC,IAAAA,sBAAW,EAACN;YACjD,MAAMO,UAAU,IAAIC;YACpB,MAAMC,QAAQ,EAAE;YAEhB,wCAAwC;YACxC,IAAK,MAAMC,OAAON,YAAa;gBAC7B,MAAMO,SAASP,WAAW,CAACM,IAAI;gBAE/B,IAAIR,OAAOU,IAAI,CAACD,QAAQE,MAAM,KAAK,GAAG;oBAEpC;gBACF;gBAEA,IAAIC,gBAAgBJ;gBACpB,IAAIK,SAAS;gBAEb,MAAMC,aAAaF,cAAcG,KAAK,CAAC;gBAEvC,IAAID,WAAWH,MAAM,GAAG,GAAG;oBACzBC,gBAAgBE,WAAWE,GAAG;oBAC9BH,SAASC,WAAWG,IAAI,CAAC;gBAC3B;gBAEA,MAAMC,UAAUC,IAAAA,iBAAU,EACxBC,IAAAA,mBAAY,EAACR,eAAe,OAC5BjB,QAAQ0B,WAAW;gBAErB,MAAMC,YAAY;oBAChB,MAAM,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAG7B;oBAC9B,MAAM8B,cAAc,MAAMC,IAAAA,sBAAe,EAACH,UAAUC,SAAS;2BACxD,IAAIG,IAAI;4BAACf;4BAAeM;yBAAQ;qBACpC;oBAED,IAAI,CAACO,aAAa;wBAChB;oBACF;oBAEA,6CAA6C;oBAC7C,OAAO;w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IAAIjD,OAAOU,IAAI,CAACX,oBAAoBY,MAAM,GAAG,GAAG;gBAC9CwC,IAAAA,yBAAc,EAACrD,MAAMC;YACvB;YAEA,KAAK,MAAMqD,QAAQpD,OAAOU,IAAI,CAACP,aAAc;gBAC3C,MAAMkD,QAAQC,IAAAA,8BAAmB,EAACnD,WAAW,CAACiD,KAAK,EAAErD;gBAErDJ,QAAQ4D,OAAO,CAAC3B,IAAI,CAAC;oBAAEwB;oBAAMC;gBAAM;YACrC;QACF;IACF;AACF;AAEA3D,OAAO8D,OAAO,GAAG;MAEjB,WAAe9D"}

View File

@@ -0,0 +1,13 @@
declare const plugin: {
(options?: any): {
postcssPlugin: string;
prepare(result: any): {
AtRule: {
import(atRule: any): void;
};
OnceExit(): Promise<void>;
};
};
postcss: boolean;
};
export default plugin;

View File

@@ -0,0 +1,207 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _postcssvalueparser = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/postcss-value-parser"));
const _utils = require("../utils");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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(_utils.WEBPACK_IGNORE_COMMENT_REGEXP);
if (matched && matched[2] === "true") {
return;
}
}
const prevNode = atRule.prev();
if (prevNode && prevNode.type === "comment") {
const matched = prevNode.text.match(_utils.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 } = (0, _postcssvalueparser.default)(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 : _postcssvalueparser.default.stringify(paramsNodes[0].nodes);
}
url = (0, _utils.normalizeUrl)(url, isStringValue);
const isRequestable = (0, _utils.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 = _postcssvalueparser.default.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 = (0, _utils.requestify)(url, options.rootContext);
const { resolver, context } = options;
const resolvedUrl = await (0, _utils.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;
const _default = plugin;
//# sourceMappingURL=postcss-import-parser.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
declare const plugin: {
(options?: any): {
postcssPlugin: string;
prepare(result: any): {
Declaration(declaration: any): void;
OnceExit(): Promise<void>;
};
};
postcss: boolean;
};
export default plugin;

View File

@@ -0,0 +1,328 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _postcssvalueparser = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/postcss-value-parser"));
const _utils = require("../utils");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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(_utils.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 ((0, _utils.isDataUrl)(url) && isSupportDataURLInNewURL) {
try {
decodeURIComponent(url);
} catch (ignoreError) {
return false;
}
return true;
}
if (!(0, _utils.isUrlRequestable)(url)) {
return false;
}
return true;
}
function parseDeclaration(declaration, key, result, isSupportDataURLInNewURL) {
if (!needParseDeclaration.test(declaration[key])) {
return;
}
const parsed = (0, _postcssvalueparser.default)(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(_utils.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(_utils.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 : _postcssvalueparser.default.stringify(nodes);
url = (0, _utils.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 : _postcssvalueparser.default.stringify(nodes);
url = (0, _utils.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 = (0, _utils.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 ((0, _utils.isDataUrl)(url)) {
// eslint-disable-next-line consistent-return
return parsedDeclaration;
}
const splittedUrl = url.split(/(\?)?#/);
const [pathname, query, hashOrQuery] = splittedUrl;
let hash = query ? "?" : "";
hash += hashOrQuery ? `#${hashOrQuery}` : "";
const { needToResolveURL, rootContext } = options;
const request = (0, _utils.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 (0, _utils.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;
const _default = plugin;
//# sourceMappingURL=postcss-url-parser.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
declare function cssWithMappingToString(item: any, useSourceMap: any): any;
declare function toComment(sourceMap: any): string;

View File

@@ -0,0 +1,91 @@
/*
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
"use strict";
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

View 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,GAAG,SAASA;QACvB,OAAO,IAAI,CAACC,GAAG,CAAC,SAAUC,IAAI;YAC5B,mEAAmE;YACnE,IAAIC,UAAUC,uBAAuBF,MAAMJ;YAE3C,IAAII,IAAI,CAAC,EAAE,EAAE;gBACX,OAAO,UAAUG,MAAM,CAACH,IAAI,CAAC,EAAE,EAAE,MAAMG,MAAM,CAACF,SAAS;YACzD;YAEA,OAAOA;QACT,GAAGG,IAAI,CAAC;IACV,EAAE,yCAAyC;;IAC3C,sCAAsC;IAEtC,kCAAkC;IAClCP,KAAKQ,CAAC,GAAG,SAAUC,OAAY,EAAEC,UAAe,EAAEC,MAAW;QAC3D,IAAI,OAAOF,YAAY,UAAU;YAC/B,6CAA6C;YAC7CA,UAAU;gBAAC;oBAAC;oBAAMA;oBAAS;iBAAG;aAAC;QACjC;QAEA,IAAIG,yBAA8B,CAAC;QAEnC,IAAID,QAAQ;YACV,IAAK,IAAIH,IAAI,GAAGA,IAAI,IAAI,CAACK,MAAM,EAAEL,IAAK;gBACpC,gDAAgD;gBAChD,IAAIM,KAAK,IAAI,CAACN,EAAE,CAAC,EAAE;gBAEnB,IAAIM,MAAM,MAAM;oBACdF,sBAAsB,CAACE,GAAG,GAAG;gBAC/B;YACF;QACF;QAEA,IAAK,IAAIC,KAAK,GAAGA,KAAKN,QAAQI,MAAM,EAAEE,KAAM;YAC1C,IAAIZ,OAAY,EAAE,CAACG,MAAM,CAACG,OAAO,CAACM,GAAG;YAErC,IAAIJ,UAAUC,sBAAsB,CAACT,IAAI,CAAC,EAAE,CAAC,EAAE;gBAE7C;YACF;YAEA,IAAIO,YAAY;gBACd,IAAI,CAACP,IAAI,CAAC,EAAE,EAAE;oBACZA,IAAI,CAAC,EAAE,GAAGO;gBACZ,OAAO;oBACLP,IAAI,CAAC,EAAE,GAAG,GAAGG,MAAM,CAACI,YAAY,SAASJ,MAAM,CAACH,IAAI,CAAC,EAAE;gBACzD;YACF;YAEAH,KAAKgB,IAAI,CAACb;QACZ;IACF;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"}

View File

@@ -0,0 +1,26 @@
"use strict";
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

View 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"}

View File

@@ -0,0 +1,38 @@
declare function normalizeUrl(url: string, isStringValue: boolean): string;
declare function requestify(url: string, rootContext: string): any;
declare function getFilter(filter: any, resourcePath: string): (...args: any[]) => any;
declare function shouldUseImportPlugin(options: any): any;
declare function shouldUseURLPlugin(options: any): any;
declare function shouldUseModulesPlugins(options: any): boolean;
declare function shouldUseIcssPlugin(options: any): boolean;
declare function getModulesPlugins(options: any, loaderContext: any, meta: any): any[];
declare function normalizeSourceMap(map: any, resourcePath: string): any;
declare function getPreRequester({ loaders, loaderIndex }: any): (number: any) => any;
declare function getImportCode(imports: any, options: any): string;
declare function getModuleCode(result: {
map: any;
css: any;
}, api: any, replacements: any, options: {
modules: {
exportOnlyLocals: boolean;
namedExport: any;
};
sourceMap: any;
}, loaderContext: any): string;
declare function getExportCode(exports: any, replacements: any, options: {
modules: {
namedExport: any;
exportLocalsConvention: any;
exportOnlyLocals: any;
};
esModule: any;
}): string;
declare function resolveRequests(resolve: (arg0: any, arg1: any) => Promise<any>, context: any, possibleRequests: any[]): Promise<any>;
declare function isUrlRequestable(url: string): boolean;
declare function sort(a: {
index: number;
}, b: {
index: number;
}): number;
declare function isDataUrl(url: string): boolean;
export { isDataUrl, shouldUseModulesPlugins, shouldUseImportPlugin, shouldUseURLPlugin, shouldUseIcssPlugin, normalizeUrl, requestify, getFilter, getModulesPlugins, normalizeSourceMap, getPreRequester, getImportCode, getModuleCode, getExportCode, resolveRequests, isUrlRequestable, sort, };

View File

@@ -0,0 +1,454 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
isDataUrl: null,
shouldUseModulesPlugins: null,
shouldUseImportPlugin: null,
shouldUseURLPlugin: null,
shouldUseIcssPlugin: null,
normalizeUrl: null,
requestify: null,
getFilter: null,
getModulesPlugins: null,
normalizeSourceMap: null,
getPreRequester: null,
getImportCode: null,
getModuleCode: null,
getExportCode: null,
resolveRequests: null,
isUrlRequestable: null,
sort: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
isDataUrl: function() {
return isDataUrl;
},
shouldUseModulesPlugins: function() {
return shouldUseModulesPlugins;
},
shouldUseImportPlugin: function() {
return shouldUseImportPlugin;
},
shouldUseURLPlugin: function() {
return shouldUseURLPlugin;
},
shouldUseIcssPlugin: function() {
return shouldUseIcssPlugin;
},
normalizeUrl: function() {
return normalizeUrl;
},
requestify: function() {
return requestify;
},
getFilter: function() {
return getFilter;
},
getModulesPlugins: function() {
return getModulesPlugins;
},
normalizeSourceMap: function() {
return normalizeSourceMap;
},
getPreRequester: function() {
return getPreRequester;
},
getImportCode: function() {
return getImportCode;
},
getModuleCode: function() {
return getModuleCode;
},
getExportCode: function() {
return getExportCode;
},
resolveRequests: function() {
return resolveRequests;
},
isUrlRequestable: function() {
return isUrlRequestable;
},
sort: function() {
return sort;
}
});
const _url = require("url");
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _loaderutils3 = require("next/dist/compiled/loader-utils3");
const _postcssmodulesvalues = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/postcss-modules-values"));
const _postcssmoduleslocalbydefault = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/postcss-modules-local-by-default"));
const _postcssmodulesextractimports = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/postcss-modules-extract-imports"));
const _postcssmodulesscope = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/postcss-modules-scope"));
const _camelcase = /*#__PURE__*/ _interop_require_default(require("./camelcase"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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.default.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 (0, _url.fileURLToPath)(url);
}
if (/^[a-z][a-z0-9+.-]*:/i.test(url)) {
return url;
}
return url.charAt(0) === "/" ? (0, _loaderutils3.urlToRequest)(url, rootContext) : (0, _loaderutils3.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 = [
_postcssmodulesvalues.default,
(0, _postcssmoduleslocalbydefault.default)({
mode
}),
(0, _postcssmodulesextractimports.default)(),
(0, _postcssmodulesscope.default)({
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.default.resolve(sourceRoot, normalizePath(source)) : normalizePath(source);
return _path.default.relative(_path.default.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.default.dirname(loaderContext.resourcePath);
const absoluteSource = _path.default.resolve(resourceDirname, source);
const contextifyPath = normalizePath(_path.default.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((0, _camelcase.default)(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(exports1, replacements, options) {
let code = "// Exports\n";
let localsCode = "";
const addExportToLocalsCode = (name, value)=>{
if (options.modules.namedExport) {
localsCode += `export const ${(0, _camelcase.default)(name)} = ${JSON.stringify(value)};\n`;
} else {
if (localsCode) {
localsCode += `,\n`;
}
localsCode += `\t${JSON.stringify(name)}: ${JSON.stringify(value)}`;
}
};
for (const { name, value } of exports1){
switch(options.modules.exportLocalsConvention){
case "camelCase":
{
addExportToLocalsCode(name, value);
const modifiedName = (0, _camelcase.default)(name);
if (modifiedName !== name) {
addExportToLocalsCode(modifiedName, value);
}
break;
}
case "camelCaseOnly":
{
addExportToLocalsCode((0, _camelcase.default)(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((0, _camelcase.default)(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;
}
//# sourceMappingURL=utils.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import type { webpack } from 'next/dist/compiled/webpack/webpack';
declare const EmptyLoader: webpack.LoaderDefinitionFunction;
export default EmptyLoader;

View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const EmptyLoader = ()=>"export default {}";
const _default = EmptyLoader;
//# sourceMappingURL=empty-loader.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/webpack/loaders/empty-loader.ts"],"names":["EmptyLoader"],"mappings":";;;;+BAGA;;;eAAA;;;AADA,MAAMA,cAAgD,IAAM;MAC5D,WAAeA"}

View File

@@ -0,0 +1,3 @@
import { webpack } from 'next/dist/compiled/webpack/webpack';
declare const ErrorLoader: webpack.LoaderDefinitionFunction;
export default ErrorLoader;

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _chalk = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/chalk"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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.default.relative(context, resource) : resource : null;
const err = new Error(reason + (issuer ? `\nLocation: ${_chalk.default.cyan(issuer)}` : ""));
this.emitError(err);
};
const _default = ErrorLoader;
//# sourceMappingURL=error-loader.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/webpack/loaders/error-loader.ts"],"names":["ErrorLoader","options","getOptions","reason","resource","_module","issuer","context","rootContext","_compiler","path","relative","err","Error","chalk","cyan","emitError"],"mappings":";;;;+BA0BA;;;eAAA;;;8DA1BkB;6DACD;;;;;;AAGjB,MAAMA,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,UACEG,aAAI,CAACC,QAAQ,CAACJ,SAASH,YACvBA,WACF;IAEJ,MAAMQ,MAAM,IAAIC,MACdV,SAAUG,CAAAA,SAAS,CAAC,YAAY,EAAEQ,cAAK,CAACC,IAAI,CAACT,QAAQ,CAAC,GAAG,EAAC;IAE5D,IAAI,CAACU,SAAS,CAACJ;AACjB;MAEA,WAAeZ"}

View File

@@ -0,0 +1,46 @@
import type { MiddlewareConfig, MiddlewareMatcher, RSCModuleType } from '../../analysis/get-page-static-info';
import { webpack } from 'next/dist/compiled/webpack/webpack';
export type ModuleBuildInfo = {
nextEdgeMiddleware?: EdgeMiddlewareMeta;
nextEdgeApiFunction?: EdgeMiddlewareMeta;
nextEdgeSSR?: EdgeSSRMeta;
nextWasmMiddlewareBinding?: AssetBinding;
nextAssetMiddlewareBinding?: AssetBinding;
usingIndirectEval?: boolean | Set<string>;
route?: RouteMeta;
importLocByPath?: Map<string, any>;
rootDir?: string;
rsc?: RSCMeta;
};
/**
* 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 declare function getModuleBuildInfo(webpackModule: webpack.Module): ModuleBuildInfo;
export interface RSCMeta {
type: RSCModuleType;
actions?: string[];
clientRefs?: string[];
clientEntryType?: 'cjs' | 'auto';
isClientRef?: boolean;
requests?: string[];
}
export interface RouteMeta {
page: string;
absolutePagePath: string;
preferredRegion: string | string[] | undefined;
middlewareConfig: MiddlewareConfig;
}
export interface EdgeMiddlewareMeta {
page: string;
matchers?: MiddlewareMatcher[];
}
export interface EdgeSSRMeta {
isServerComponent: boolean;
isAppDir?: boolean;
page: string;
}
export interface AssetBinding {
filePath: string;
name: string;
}

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getModuleBuildInfo", {
enumerable: true,
get: function() {
return getModuleBuildInfo;
}
});
function getModuleBuildInfo(webpackModule) {
return webpackModule.buildInfo;
}
//# sourceMappingURL=get-module-build-info.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/webpack/loaders/get-module-build-info.ts"],"names":["getModuleBuildInfo","webpackModule","buildInfo"],"mappings":";;;;+BAwBgBA;;;eAAAA;;;AAAT,SAASA,mBAAmBC,aAA6B;IAC9D,OAAOA,cAAcC,SAAS;AAChC"}

View File

@@ -0,0 +1,10 @@
import type { CollectingMetadata } from './types';
import { MetadataResolver } from '../next-app-loader';
export declare function createStaticMetadataFromRoute(resolvedDir: string, { segment, metadataResolver, isRootLayoutOrRootPage, pageExtensions, basePath, }: {
segment: string;
metadataResolver: MetadataResolver;
isRootLayoutOrRootPage: boolean;
pageExtensions: string[];
basePath: string;
}): Promise<CollectingMetadata | null>;
export declare function createMetadataExportsCode(metadata: Awaited<ReturnType<typeof createStaticMetadataFromRoute>>): string;

View File

@@ -0,0 +1,119 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
createStaticMetadataFromRoute: null,
createMetadataExportsCode: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
createStaticMetadataFromRoute: function() {
return createStaticMetadataFromRoute;
},
createMetadataExportsCode: function() {
return createMetadataExportsCode;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _querystring = require("querystring");
const _ismetadataroute = require("../../../../lib/metadata/is-metadata-route");
const _constants = require("../../../../lib/constants");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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;
}
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.default.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, _ismetadataroute.STATIC_METADATA_IMAGES[type].filename, [
..._ismetadataroute.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?${(0, _querystring.stringify)({
type,
segment,
basePath,
pageExtensions
})}!${filepath}?${_constants.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);
}
});
}
// Intentially 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;
}
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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/metadata/discover.ts"],"names":["createStaticMetadataFromRoute","createMetadataExportsCode","METADATA_TYPE","enumMetadataFiles","dir","filename","extensions","metadataResolver","numericSuffix","collectedFiles","possibleFileNames","concat","Array","fill","map","_","index","name","resolved","push","resolvedDir","segment","isRootLayoutOrRootPage","pageExtensions","basePath","hasStaticMetadataFiles","staticImagesMetadata","icon","apple","twitter","openGraph","manifest","undefined","collectIconModuleIfExists","type","staticManifestExtension","manifestFile","length","ext","path","parse","extension","includes","slice","JSON","stringify","resolvedMetadataFiles","STATIC_METADATA_IMAGES","sort","a","b","localeCompare","forEach","filepath","imageModuleImportSource","WEBPACK_RESOURCE_QUERIES","metadata","imageModule","unshift","join"],"mappings":";;;;;;;;;;;;;;;IA6CsBA,6BAA6B;eAA7BA;;IA8FNC,yBAAyB;eAAzBA;;;6DAvIC;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C6B,IAAI,CAAC,KAAK;cACjC,EAAEH,SAAS3B,OAAO,CAAC8B,IAAI,CAAC,KAAK;cAC7B,EAAEH,SAASzB,QAAQ,GAAGyB,SAASzB,QAAQ,GAAG,YAAY;GACjE,CAAC,GACE;AACN"}

View File

@@ -0,0 +1,5 @@
import type { MetadataRoute } from '../../../../lib/metadata/types/metadata-interface';
export declare function resolveRobots(data: MetadataRoute.Robots): string;
export declare function resolveSitemap(data: MetadataRoute.Sitemap): string;
export declare function resolveManifest(data: MetadataRoute.Manifest): string;
export declare function resolveRouteData(data: MetadataRoute.Robots | MetadataRoute.Sitemap | MetadataRoute.Manifest, fileType: 'robots' | 'sitemap' | 'manifest'): string;

View File

@@ -0,0 +1,111 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
resolveRobots: null,
resolveSitemap: null,
resolveManifest: null,
resolveRouteData: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
resolveRobots: function() {
return resolveRobots;
},
resolveSitemap: function() {
return resolveSitemap;
},
resolveManifest: function() {
return resolveManifest;
},
resolveRouteData: function() {
return resolveRouteData;
}
});
const _utils = require("../../../../lib/metadata/generate/utils");
function resolveRobots(data) {
let content = "";
const rules = Array.isArray(data.rules) ? data.rules : [
data.rules
];
for (const rule of rules){
const userAgent = (0, _utils.resolveArray)(rule.userAgent || [
"*"
]);
for (const agent of userAgent){
content += `User-Agent: ${agent}\n`;
}
if (rule.allow) {
const allow = (0, _utils.resolveArray)(rule.allow);
for (const item of allow){
content += `Allow: ${item}\n`;
}
}
if (rule.disallow) {
const disallow = (0, _utils.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 = (0, _utils.resolveArray)(data.sitemap);
// TODO-METADATA: support injecting sitemap url into robots.txt
sitemap.forEach((item)=>{
content += `Sitemap: ${item}\n`;
});
}
return content;
}
function resolveSitemap(data) {
let content = "";
content += '<?xml version="1.0" encoding="UTF-8"?>\n';
content += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n';
for (const item of data){
content += "<url>\n";
content += `<loc>${item.url}</loc>\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;
}
function resolveManifest(data) {
return JSON.stringify(data);
}
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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/metadata/resolve-route-data.ts"],"names":["resolveRobots","resolveSitemap","resolveManifest","resolveRouteData","data","content","rules","Array","isArray","rule","userAgent","resolveArray","agent","allow","item","disallow","crawlDelay","host","sitemap","forEach","url","lastModified","serializedDate","Date","toISOString","changeFrequency","priority","JSON","stringify","fileType"],"mappings":";;;;;;;;;;;;;;;;;IAIgBA,aAAa;eAAbA;;IAyCAC,cAAc;eAAdA;;IAkCAC,eAAe;eAAfA;;IAIAC,gBAAgB;eAAhBA;;;uBAlFa;AAGtB,SAASH,cAAcI,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,YAAYC,IAAAA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YAEvBhB,WAAW,CAAC,SAAS,EAAEiB,eAAe,YAAY,CAAC;QACrD;QAEA,IAAIR,KAAKW,eAAe,EAAE;YACxBpB,WAAW,CAAC,YAAY,EAAES,KAAKW,eAAe,CAAC,eAAe,CAAC;QACjE;QAEA,IAAI,OAAOX,KAAKY,QAAQ,KAAK,UAAU;YACrCrB,WAAW,CAAC,UAAU,EAAES,KAAKY,QAAQ,CAAC,aAAa,CAAC;QACtD;QAEArB,WAAW;IACb;IAEAA,WAAW;IAEX,OAAOA;AACT;AAEO,SAASH,gBAAgBE,IAA4B;IAC1D,OAAOuB,KAAKC,SAAS,CAACxB;AACxB;AAEO,SAASD,iBACdC,IAA2E,EAC3EyB,QAA2C;IAE3C,IAAIA,aAAa,UAAU;QACzB,OAAO7B,cAAcI;IACvB;IACA,IAAIyB,aAAa,WAAW;QAC1B,OAAO5B,eAAeG;IACxB;IACA,IAAIyB,aAAa,YAAY;QAC3B,OAAO3B,gBAAgBE;IACzB;IACA,OAAO;AACT"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,31 @@
export type ComponentModule = () => any;
export type ModuleReference = [
componentModule: ComponentModule,
filePath: string
];
export type CollectingMetadata = {
icon: string[];
apple: string[];
twitter: string[];
openGraph: string[];
manifest?: string;
};
export type CollectedMetadata = {
icon: ComponentModule[];
apple: ComponentModule[];
twitter: ComponentModule[] | null;
openGraph: ComponentModule[] | null;
manifest?: string;
};
export type MetadataImageModule = {
url: string;
type?: string;
alt?: string;
} & ({
sizes?: string;
} | {
width?: number;
height?: number;
});
export type PossibleImageFileNameConvention = 'icon' | 'apple' | 'favicon' | 'twitter' | 'openGraph';
export type PossibleStaticMetadataFileNameConvention = PossibleImageFileNameConvention | 'manifest';

View File

@@ -0,0 +1,7 @@
// TODO-APP: check if this can be narrowed.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/metadata/types.ts"],"names":[],"mappings":"AAAA,2CAA2C"}

View File

@@ -0,0 +1,19 @@
export type ModularizeImportLoaderOptions = {
name: string;
join?: string;
from: 'default' | 'named';
as: 'default' | 'named';
};
/**
* 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(this: any): string;

View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, /**
* 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.
*/ "default", {
enumerable: true,
get: function() {
return transformSource;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function transformSource() {
const { name, from, as, join } = this.getOptions();
const { resourcePath } = this;
const fullPath = join ? _path.default.join(_path.default.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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/webpack/loaders/modularize-import-loader.ts"],"names":["transformSource","name","from","as","join","getOptions","resourcePath","fullPath","path","dirname","JSON","stringify"],"mappings":";;;;+BASA;;;;;;;;;;;CAWC,GACD;;;eAAwBA;;;6DArBP;;;;;;AAqBF,SAASA;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,OACbI,aAAI,CAACJ,IAAI,CAACI,aAAI,CAACC,OAAO,CAACH,eAAeF,QACtCE;IAEJ,OAAO,CAAC;;EAER,EAAEJ,SAAS,YAAY,YAAYD,KAAK,IAAI,EAC1CE,OAAO,YAAY,YAAYF,KAChC;OACI,EAAES,KAAKC,SAAS,CAACJ,UAAU;AAClC,CAAC;AACD"}

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