Initial boiler plate project

This commit is contained in:
2024-09-24 03:52:46 +00:00
parent 6120b2d6c3
commit 154b93e267
10034 changed files with 2079352 additions and 2 deletions

68
node_modules/next/README.md generated vendored Normal file
View File

@ -0,0 +1,68 @@
<p align="center">
<a href="https://nextjs.org">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://assets.vercel.com/image/upload/v1662130559/nextjs/Icon_dark_background.png">
<img src="https://assets.vercel.com/image/upload/v1662130559/nextjs/Icon_light_background.png" height="128">
</picture>
<h1 align="center">Next.js</h1>
</a>
</p>
<p align="center">
<a aria-label="Vercel logo" href="https://vercel.com">
<img src="https://img.shields.io/badge/MADE%20BY%20Vercel-000000.svg?style=for-the-badge&logo=Vercel&labelColor=000">
</a>
<a aria-label="NPM version" href="https://www.npmjs.com/package/next">
<img alt="" src="https://img.shields.io/npm/v/next.svg?style=for-the-badge&labelColor=000000">
</a>
<a aria-label="License" href="https://github.com/vercel/next.js/blob/canary/license.md">
<img alt="" src="https://img.shields.io/npm/l/next.svg?style=for-the-badge&labelColor=000000">
</a>
<a aria-label="Join the community on GitHub" href="https://github.com/vercel/next.js/discussions">
<img alt="" src="https://img.shields.io/badge/Join%20the%20community-blueviolet.svg?style=for-the-badge&logo=Next.js&labelColor=000000&logoWidth=20">
</a>
</p>
## Getting Started
Used by some of the world's largest companies, Next.js enables you to create full-stack web applications by extending the latest React features, and integrating powerful Rust-based JavaScript tooling for the fastest builds.
- Visit our [Learn Next.js](https://nextjs.org/learn) course to get started with Next.js.
- Visit the [Next.js Showcase](https://nextjs.org/showcase) to see more sites built with Next.js.
## Documentation
Visit [https://nextjs.org/docs](https://nextjs.org/docs) to view the full documentation.
## Community
The Next.js community can be found on [GitHub Discussions](https://github.com/vercel/next.js/discussions) where you can ask questions, voice ideas, and share your projects with other people.
To chat with other community members you can join the Next.js [Discord](https://nextjs.org/discord) server.
Do note that our [Code of Conduct](https://github.com/vercel/next.js/blob/canary/CODE_OF_CONDUCT.md) applies to all Next.js community channels. Users are **highly encouraged** to read and adhere to them to avoid repercussions.
## Contributing
Contributions to Next.js are welcome and highly appreciated. However, before you jump right into it, we would like you to review our [Contribution Guidelines](/contributing.md) to make sure you have a smooth experience contributing to Next.js.
### Good First Issues:
We have a list of **[good first issues](https://github.com/vercel/next.js/labels/good%20first%20issue)** that contain bugs that have a relatively limited scope. This is a great place for newcomers and beginners alike to get started, gain experience, and get familiar with our contribution process.
## Authors
A list of the original co-authors of Next.js that helped bring this amazing framework to life!
- Tim Neutkens ([@timneutkens](https://twitter.com/timneutkens))
- Naoyuki Kanezawa ([@nkzawa](https://twitter.com/nkzawa))
- Guillermo Rauch ([@rauchg](https://twitter.com/rauchg))
- Arunoda Susiripala ([@arunoda](https://twitter.com/arunoda))
- Tony Kovanen ([@tonykovanen](https://twitter.com/tonykovanen))
- Dan Zajdband ([@impronunciable](https://twitter.com/impronunciable))
---
## Security
If you believe you have found a security vulnerability in Next.js, we encourage you to **_responsibly disclose this and NOT open a public issue_**. We will investigate all legitimate reports. Email `security@vercel.com` to disclose any security vulnerabilities. Alternatively, you can visit this [link](https://vercel.com/security) to know more about Vercel's security and report any security vulnerabilities.

1
node_modules/next/amp.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from './dist/shared/lib/amp'

1
node_modules/next/amp.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('./dist/shared/lib/amp')

3
node_modules/next/app.d.ts generated vendored Normal file
View File

@ -0,0 +1,3 @@
import App from './dist/pages/_app'
export * from './dist/pages/_app'
export default App

1
node_modules/next/app.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('./dist/pages/_app')

1
node_modules/next/babel.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from './dist/build/babel/preset'

1
node_modules/next/babel.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('./dist/build/babel/preset')

6
node_modules/next/cache.d.ts generated vendored Normal file
View File

@ -0,0 +1,6 @@
export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache'
export {
revalidateTag,
revalidatePath,
} from 'next/dist/server/web/spec-extension/revalidate'
export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store'

21
node_modules/next/cache.js generated vendored Normal file
View File

@ -0,0 +1,21 @@
const cacheExports = {
unstable_cache: require('next/dist/server/web/spec-extension/unstable-cache')
.unstable_cache,
revalidateTag: require('next/dist/server/web/spec-extension/revalidate')
.revalidateTag,
revalidatePath: require('next/dist/server/web/spec-extension/revalidate')
.revalidatePath,
unstable_noStore:
require('next/dist/server/web/spec-extension/unstable-no-store')
.unstable_noStore,
}
// https://nodejs.org/api/esm.html#commonjs-namespaces
// When importing CommonJS modules, the module.exports object is provided as the default export
module.exports = cacheExports
// make import { xxx } from 'next/cache' work
exports.unstable_cache = cacheExports.unstable_cache
exports.revalidatePath = cacheExports.revalidatePath
exports.revalidateTag = cacheExports.revalidateTag
exports.unstable_noStore = cacheExports.unstable_noStore

1
node_modules/next/client.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from './dist/client/index'

1
node_modules/next/client.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('./dist/client/index')

1
node_modules/next/compat/router.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from '../dist/client/compat/router'

1
node_modules/next/compat/router.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('../dist/client/compat/router')

3
node_modules/next/config.d.ts generated vendored Normal file
View File

@ -0,0 +1,3 @@
import getConfig from './dist/shared/lib/runtime-config.external'
export * from './dist/shared/lib/runtime-config.external'
export default getConfig

1
node_modules/next/config.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('./dist/shared/lib/runtime-config.external')

1
node_modules/next/constants.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from './dist/shared/lib/constants'

1
node_modules/next/constants.js generated vendored Normal file
View File

@ -0,0 +1 @@
module.exports = require('./dist/shared/lib/constants')

2
node_modules/next/dist/api/app-dynamic.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from '../shared/lib/app-dynamic';
export { default } from '../shared/lib/app-dynamic';

4
node_modules/next/dist/api/app-dynamic.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export * from "../shared/lib/app-dynamic";
export { default } from "../shared/lib/app-dynamic";
//# sourceMappingURL=app-dynamic.js.map

1
node_modules/next/dist/api/app-dynamic.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/app-dynamic.ts"],"names":["default"],"mappings":"AAAA,cAAc,4BAA2B;AACzC,SAASA,OAAO,QAAQ,4BAA2B"}

2
node_modules/next/dist/api/app.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from '../pages/_app';
export { default } from '../pages/_app';

4
node_modules/next/dist/api/app.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export * from "../pages/_app";
export { default } from "../pages/_app";
//# sourceMappingURL=app.js.map

1
node_modules/next/dist/api/app.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/app.tsx"],"names":["default"],"mappings":"AAAA,cAAc,gBAAe;AAC7B,SAASA,OAAO,QAAQ,gBAAe"}

1
node_modules/next/dist/api/constants.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from '../shared/lib/constants';

3
node_modules/next/dist/api/constants.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
export * from "../shared/lib/constants";
//# sourceMappingURL=constants.js.map

1
node_modules/next/dist/api/constants.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/constants.ts"],"names":[],"mappings":"AAAA,cAAc,0BAAyB"}

2
node_modules/next/dist/api/document.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from '../pages/_document';
export { default } from '../pages/_document';

4
node_modules/next/dist/api/document.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export * from "../pages/_document";
export { default } from "../pages/_document";
//# sourceMappingURL=document.js.map

1
node_modules/next/dist/api/document.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/document.tsx"],"names":["default"],"mappings":"AAAA,cAAc,qBAAoB;AAClC,SAASA,OAAO,QAAQ,qBAAoB"}

2
node_modules/next/dist/api/dynamic.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export { default } from '../shared/lib/dynamic';
export * from '../shared/lib/dynamic';

4
node_modules/next/dist/api/dynamic.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export { default } from "../shared/lib/dynamic";
export * from "../shared/lib/dynamic";
//# sourceMappingURL=dynamic.js.map

1
node_modules/next/dist/api/dynamic.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/dynamic.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAO,QAAQ,wBAAuB;AAC/C,cAAc,wBAAuB"}

2
node_modules/next/dist/api/head.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export { default } from '../shared/lib/head';
export * from '../shared/lib/head';

4
node_modules/next/dist/api/head.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export { default } from "../shared/lib/head";
export * from "../shared/lib/head";
//# sourceMappingURL=head.js.map

1
node_modules/next/dist/api/head.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/head.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAO,QAAQ,qBAAoB;AAC5C,cAAc,qBAAoB"}

1
node_modules/next/dist/api/headers.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from '../client/components/headers';

3
node_modules/next/dist/api/headers.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
export * from "../client/components/headers";
//# sourceMappingURL=headers.js.map

1
node_modules/next/dist/api/headers.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/headers.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA8B"}

2
node_modules/next/dist/api/image.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export { default } from '../shared/lib/image-external';
export * from '../shared/lib/image-external';

4
node_modules/next/dist/api/image.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export { default } from "../shared/lib/image-external";
export * from "../shared/lib/image-external";
//# sourceMappingURL=image.js.map

1
node_modules/next/dist/api/image.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/image.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAO,QAAQ,+BAA8B;AACtD,cAAc,+BAA8B"}

2
node_modules/next/dist/api/link.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export { default } from '../client/link';
export * from '../client/link';

4
node_modules/next/dist/api/link.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export { default } from "../client/link";
export * from "../client/link";
//# sourceMappingURL=link.js.map

1
node_modules/next/dist/api/link.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/link.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAO,QAAQ,iBAAgB;AACxC,cAAc,iBAAgB"}

1
node_modules/next/dist/api/navigation.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from '../client/components/navigation';

3
node_modules/next/dist/api/navigation.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
export * from "../client/components/navigation";
//# sourceMappingURL=navigation.js.map

1
node_modules/next/dist/api/navigation.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/navigation.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAiC"}

View File

@ -0,0 +1 @@
export * from '../client/components/navigation.react-server';

View File

@ -0,0 +1,3 @@
export * from "../client/components/navigation.react-server";
//# sourceMappingURL=navigation.react-server.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/navigation.react-server.ts"],"names":[],"mappings":"AAAA,cAAc,+CAA8C"}

1
node_modules/next/dist/api/og.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from '../server/og/image-response';

3
node_modules/next/dist/api/og.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
export * from "../server/og/image-response";
//# sourceMappingURL=og.js.map

1
node_modules/next/dist/api/og.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/og.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA6B"}

2
node_modules/next/dist/api/router.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export { default } from '../client/router';
export * from '../client/router';

4
node_modules/next/dist/api/router.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export { default } from "../client/router";
export * from "../client/router";
//# sourceMappingURL=router.js.map

1
node_modules/next/dist/api/router.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/router.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAO,QAAQ,mBAAkB;AAC1C,cAAc,mBAAkB"}

2
node_modules/next/dist/api/script.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export { default } from '../client/script';
export * from '../client/script';

4
node_modules/next/dist/api/script.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
export { default } from "../client/script";
export * from "../client/script";
//# sourceMappingURL=script.js.map

1
node_modules/next/dist/api/script.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/script.ts"],"names":["default"],"mappings":"AAAA,SAASA,OAAO,QAAQ,mBAAkB;AAC1C,cAAc,mBAAkB"}

1
node_modules/next/dist/api/server.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export * from '../server/web/exports/index';

3
node_modules/next/dist/api/server.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
export * from "../server/web/exports/index";
//# sourceMappingURL=server.js.map

1
node_modules/next/dist/api/server.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/api/server.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA6B"}

113
node_modules/next/dist/bin/next generated vendored Executable file
View File

@ -0,0 +1,113 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
require("../server/require-hook");
const _commander = require("next/dist/compiled/commander");
const _log = require("../build/output/log");
const _semver = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/semver"));
const _picocolors = require("../lib/picocolors");
const _formatclihelpoutput = require("../lib/format-cli-help-output");
const _constants = require("../lib/constants");
const _utils = require("../server/lib/utils");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
if (_semver.default.lt(process.versions.node, "18.17.0")) {
console.error(`You are using Node.js ${process.versions.node}. For Next.js, Node.js version >= v${"18.17.0"} is required.`);
process.exit(1);
}
// Start performance profiling after Node.js version is checked
performance.mark("next-start");
for (const dependency of [
"react",
"react-dom"
]){
try {
// When 'npm link' is used it checks the clone location. Not the project.
require.resolve(dependency);
} catch (err) {
console.warn(`The module '${dependency}' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install ${dependency}'`);
}
}
class MyRootCommand extends _commander.Command {
createCommand(name) {
const cmd = new _commander.Command(name);
cmd.addOption(new _commander.Option("--inspect").hideHelp());
cmd.hook("preAction", (thisCommand)=>{
const cmdName = thisCommand.name();
const defaultEnv = cmdName === "dev" ? "development" : "production";
const standardEnv = [
"production",
"development",
"test"
];
if (process.env.NODE_ENV) {
const isNotStandard = !standardEnv.includes(process.env.NODE_ENV);
const shouldWarnCommands = process.env.NODE_ENV === "development" ? [
"start",
"build"
] : process.env.NODE_ENV === "production" ? [
"dev"
] : [];
if (isNotStandard || shouldWarnCommands.includes(cmdName)) {
(0, _log.warn)(_constants.NON_STANDARD_NODE_ENV);
}
}
process.env.NODE_ENV = process.env.NODE_ENV || defaultEnv;
process.env.NEXT_RUNTIME = "nodejs";
if (thisCommand.getOptionValue("inspect") === true) {
console.error(`\`--inspect\` flag is deprecated. Use env variable NODE_OPTIONS instead: NODE_OPTIONS='--inspect' next ${cmdName}`);
process.exit(1);
}
});
return cmd;
}
}
const program = new MyRootCommand();
program.name("next").description("The Next.js CLI allows you to develop, build, start your application, and more.").configureHelp({
formatHelp: (cmd, helper)=>(0, _formatclihelpoutput.formatCliHelpOutput)(cmd, helper),
subcommandTerm: (cmd)=>`${cmd.name()} ${cmd.usage()}`
}).helpCommand(false).helpOption("-h, --help", "Displays this message.").version(`Next.js v${"14.2.13"}`, "-v, --version", "Outputs the Next.js version.");
program.command("build").description("Creates an optimized production build of your application. The output displays information about each route.").argument("[directory]", `A directory on which to build the application. ${(0, _picocolors.italic)("If no directory is provided, the current directory will be used.")}`).option("-d, --debug", "Enables a more verbose build output.").option("--no-lint", "Disables linting.").option("--no-mangling", "Disables mangling.").option("--profile", "Enables production profiling for React.").option("--experimental-app-only", "Builds only App Router routes.").addOption(new _commander.Option("--experimental-turbo").hideHelp()).addOption(new _commander.Option("--experimental-build-mode [mode]", "Uses an experimental build mode.").choices([
"compile",
"generate"
]).default("default")).option("--experimental-debug-memory-usage", "Enables memory profiling features to debug memory consumption.").action((directory, options)=>// ensure process exits after build completes so open handles/connections
// don't cause process to hang
import("../cli/next-build.js").then((mod)=>mod.nextBuild(options, directory).then(()=>process.exit(0)))).usage("[directory] [options]");
program.command("dev", {
isDefault: true
}).description("Starts Next.js in development mode with hot-code reloading, error reporting, and more.").argument("[directory]", `A directory on which to build the application. ${(0, _picocolors.italic)("If no directory is provided, the current directory will be used.")}`).option("--turbo", "Starts development mode using Turbopack (beta).").addOption(new _commander.Option("-p, --port <port>", "Specify a port number on which to start the application.").argParser(_utils.myParseInt).default(3000).env("PORT")).option("-H, --hostname <hostname>", "Specify a hostname on which to start the application (default: 0.0.0.0).").option("--experimental-https", "Starts the server with HTTPS and generates a self-signed certificate.").option("--experimental-https-key, <path>", "Path to a HTTPS key file.").option("--experimental-https-cert, <path>", "Path to a HTTPS certificate file.").option("--experimental-https-ca, <path>", "Path to a HTTPS certificate authority file.").option("--experimental-upload-trace, <traceUrl>", "Reports a subset of the debugging trace to a remote HTTP URL. Includes sensitive data.").action((directory, options, { _optionValueSources })=>{
const portSource = _optionValueSources.port;
import("../cli/next-dev.js").then((mod)=>mod.nextDev(options, portSource, directory));
}).usage("[directory] [options]");
program.command("export", {
hidden: true
}).action(()=>import("../cli/next-export.js").then((mod)=>mod.nextExport())).helpOption(false);
program.command("info").description("Prints relevant details about the current system which can be used to report Next.js bugs.").addHelpText("after", `\nLearn more: ${(0, _picocolors.cyan)("https://nextjs.org/docs/api-reference/cli#info")}`).option("--verbose", "Collects additional information for debugging.").action((options)=>import("../cli/next-info.js").then((mod)=>mod.nextInfo(options)));
program.command("lint").description("Runs ESLint for all files in the `/src`, `/app`, `/pages`, `/components`, and `/lib` directories. It also provides a guided setup to install any required dependencies if ESLint is not already configured in your application.").argument("[directory]", `A base directory on which to lint the application. ${(0, _picocolors.italic)("If no directory is provided, the current directory will be used.")}`).option("-d, --dir, <dirs...>", "Include directory, or directories, to run ESLint.").option("--file, <files...>", "Include file, or files, to run ESLint.").addOption(new _commander.Option("--ext, [exts...]", "Specify JavaScript file extensions.").default([
".js",
".mjs",
".cjs",
".jsx",
".ts",
".mts",
".cts",
".tsx"
])).option("-c, --config, <config>", "Uses this configuration file, overriding all other configuration options.").option("--resolve-plugins-relative-to, <rprt>", "Specify a directory where plugins should be resolved from.").option("--strict", "Creates a `.eslintrc.json` file using the Next.js strict configuration.").option("--rulesdir, <rulesdir...>", "Uses additional rules from this directory(s).").option("--fix", "Automatically fix linting issues.").option("--fix-type <fixType>", "Specify the types of fixes to apply (e.g., problem, suggestion, layout).").option("--ignore-path <path>", "Specify a file to ignore.").option("--no-ignore", "Disables the `--ignore-path` option.").option("--quiet", "Reports errors only.").addOption(new _commander.Option("--max-warnings [maxWarnings]", "Specify the number of warnings before triggering a non-zero exit code.").argParser(_utils.myParseInt).default(-1)).option("-o, --output-file, <outputFile>", "Specify a file to write report to.").option("-f, --format, <format>", "Uses a specific output format.").option("--no-inline-config", "Prevents comments from changing config or rules.").addOption(new _commander.Option("--report-unused-disable-directives-severity <level>", "Specify severity level for unused eslint-disable directives.").choices([
"error",
"off",
"warn"
])).option("--no-cache", "Disables caching.").option("--cache-location, <cacheLocation>", "Specify a location for cache.").addOption(new _commander.Option("--cache-strategy, [cacheStrategy]", "Specify a strategy to use for detecting changed files in the cache.").default("metadata")).option("--error-on-unmatched-pattern", "Reports errors when any file patterns are unmatched.").action((directory, options)=>import("../cli/next-lint.js").then((mod)=>mod.nextLint(options, directory))).usage("[directory] [options]");
program.command("start").description("Starts Next.js in production mode. The application should be compiled with `next build` first.").argument("[directory]", `A directory on which to start the application. ${(0, _picocolors.italic)("If no directory is provided, the current directory will be used.")}`).addOption(new _commander.Option("-p, --port <port>", "Specify a port number on which to start the application.").argParser(_utils.myParseInt).default(3000).env("PORT")).option("-H, --hostname <hostname>", "Specify a hostname on which to start the application (default: 0.0.0.0).").addOption(new _commander.Option("--keepAliveTimeout <keepAliveTimeout>", "Specify the maximum amount of milliseconds to wait before closing inactive connections.").argParser(_utils.myParseInt)).action((directory, options)=>import("../cli/next-start.js").then((mod)=>mod.nextStart(options, directory))).usage("[directory] [options]");
program.command("telemetry").description(`Allows you to enable or disable Next.js' ${(0, _picocolors.bold)("completely anonymous")} telemetry collection.`).addArgument(new _commander.Argument("[arg]").choices([
"disable",
"enable",
"status"
])).addHelpText("after", `\nLearn more: ${(0, _picocolors.cyan)("https://nextjs.org/telemetry")}`).addOption(new _commander.Option("--enable", `Enables Next.js' telemetry collection.`).conflicts("disable")).option("--disable", `Disables Next.js' telemetry collection.`).action((arg, options)=>import("../cli/next-telemetry.js").then((mod)=>mod.nextTelemetry(options, arg))).usage("[options]");
program.parse(process.argv);
//# sourceMappingURL=next.map

2
node_modules/next/dist/bin/next.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env node
import '../server/require-hook';

1
node_modules/next/dist/bin/next.map generated vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,23 @@
import type { Module } from '@swc/core';
export declare class NoSuchDeclarationError extends Error {
}
export declare class UnsupportedValueError extends Error {
/** @example `config.runtime[0].value` */
path?: string;
constructor(message: string, paths?: string[]);
}
/**
* Extracts the value of an exported const variable named `exportedName`
* (e.g. "export const config = { runtime: 'edge' }") from swc's AST.
* The value must be one of (or throws UnsupportedValueError):
* - string
* - boolean
* - number
* - null
* - undefined
* - array containing values listed in this list
* - object containing values listed in this list
*
* Throws NoSuchDeclarationError if the declaration is not found.
*/
export declare function extractExportedConstValue(module: Module, exportedName: string): any;

View File

@ -0,0 +1,200 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
NoSuchDeclarationError: null,
UnsupportedValueError: null,
extractExportedConstValue: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
NoSuchDeclarationError: function() {
return NoSuchDeclarationError;
},
UnsupportedValueError: function() {
return UnsupportedValueError;
},
extractExportedConstValue: function() {
return extractExportedConstValue;
}
});
class NoSuchDeclarationError extends Error {
}
function isExportDeclaration(node) {
return node.type === "ExportDeclaration";
}
function isVariableDeclaration(node) {
return node.type === "VariableDeclaration";
}
function isIdentifier(node) {
return node.type === "Identifier";
}
function isBooleanLiteral(node) {
return node.type === "BooleanLiteral";
}
function isNullLiteral(node) {
return node.type === "NullLiteral";
}
function isStringLiteral(node) {
return node.type === "StringLiteral";
}
function isNumericLiteral(node) {
return node.type === "NumericLiteral";
}
function isArrayExpression(node) {
return node.type === "ArrayExpression";
}
function isObjectExpression(node) {
return node.type === "ObjectExpression";
}
function isKeyValueProperty(node) {
return node.type === "KeyValueProperty";
}
function isRegExpLiteral(node) {
return node.type === "RegExpLiteral";
}
function isTemplateLiteral(node) {
return node.type === "TemplateLiteral";
}
class UnsupportedValueError extends Error {
constructor(message, paths){
super(message);
// Generating "path" that looks like "config.runtime[0].value"
let codePath;
if (paths) {
codePath = "";
for (const path of paths){
if (path[0] === "[") {
// "array" + "[0]"
codePath += path;
} else {
if (codePath === "") {
codePath = path;
} else {
// "object" + ".key"
codePath += `.${path}`;
}
}
}
}
this.path = codePath;
}
}
function extractValue(node, path) {
if (isNullLiteral(node)) {
return null;
} else if (isBooleanLiteral(node)) {
// e.g. true / false
return node.value;
} else if (isStringLiteral(node)) {
// e.g. "abc"
return node.value;
} else if (isNumericLiteral(node)) {
// e.g. 123
return node.value;
} else if (isRegExpLiteral(node)) {
// e.g. /abc/i
return new RegExp(node.pattern, node.flags);
} else if (isIdentifier(node)) {
switch(node.value){
case "undefined":
return undefined;
default:
throw new UnsupportedValueError(`Unknown identifier "${node.value}"`, path);
}
} else if (isArrayExpression(node)) {
// e.g. [1, 2, 3]
const arr = [];
for(let i = 0, len = node.elements.length; i < len; i++){
const elem = node.elements[i];
if (elem) {
if (elem.spread) {
// e.g. [ ...a ]
throw new UnsupportedValueError("Unsupported spread operator in the Array Expression", path);
}
arr.push(extractValue(elem.expression, path && [
...path,
`[${i}]`
]));
} else {
// e.g. [1, , 2]
// ^^
arr.push(undefined);
}
}
return arr;
} else if (isObjectExpression(node)) {
// e.g. { a: 1, b: 2 }
const obj = {};
for (const prop of node.properties){
if (!isKeyValueProperty(prop)) {
// e.g. { ...a }
throw new UnsupportedValueError("Unsupported spread operator in the Object Expression", path);
}
let key;
if (isIdentifier(prop.key)) {
// e.g. { a: 1, b: 2 }
key = prop.key.value;
} else if (isStringLiteral(prop.key)) {
// e.g. { "a": 1, "b": 2 }
key = prop.key.value;
} else {
throw new UnsupportedValueError(`Unsupported key type "${prop.key.type}" in the Object Expression`, path);
}
obj[key] = extractValue(prop.value, path && [
...path,
key
]);
}
return obj;
} else if (isTemplateLiteral(node)) {
// e.g. `abc`
if (node.expressions.length !== 0) {
// TODO: should we add support for `${'e'}d${'g'}'e'`?
throw new UnsupportedValueError("Unsupported template literal with expressions", path);
}
// When TemplateLiteral has 0 expressions, the length of quasis is always 1.
// Because when parsing TemplateLiteral, the parser yields the first quasi,
// then the first expression, then the next quasi, then the next expression, etc.,
// until the last quasi.
// Thus if there is no expression, the parser ends at the frst and also last quasis
//
// A "cooked" interpretation where backslashes have special meaning, while a
// "raw" interpretation where backslashes do not have special meaning
// https://exploringjs.com/impatient-js/ch_template-literals.html#template-strings-cooked-vs-raw
const [{ cooked, raw }] = node.quasis;
return cooked ?? raw;
} else {
throw new UnsupportedValueError(`Unsupported node type "${node.type}"`, path);
}
}
function extractExportedConstValue(module1, exportedName) {
for (const moduleItem of module1.body){
if (!isExportDeclaration(moduleItem)) {
continue;
}
const declaration = moduleItem.declaration;
if (!isVariableDeclaration(declaration)) {
continue;
}
if (declaration.kind !== "const") {
continue;
}
for (const decl of declaration.declarations){
if (isIdentifier(decl.id) && decl.id.value === exportedName && decl.init) {
return extractValue(decl.init, [
exportedName
]);
}
}
}
throw new NoSuchDeclarationError();
}
//# sourceMappingURL=extract-const-value.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/build/analysis/extract-const-value.ts"],"names":["NoSuchDeclarationError","UnsupportedValueError","extractExportedConstValue","Error","isExportDeclaration","node","type","isVariableDeclaration","isIdentifier","isBooleanLiteral","isNullLiteral","isStringLiteral","isNumericLiteral","isArrayExpression","isObjectExpression","isKeyValueProperty","isRegExpLiteral","isTemplateLiteral","constructor","message","paths","codePath","path","extractValue","value","RegExp","pattern","flags","undefined","arr","i","len","elements","length","elem","spread","push","expression","obj","prop","properties","key","expressions","cooked","raw","quasis","module","exportedName","moduleItem","body","declaration","kind","decl","declarations","id","init"],"mappings":"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"}

View File

@ -0,0 +1,58 @@
import type { NextConfig } from '../../server/config-shared';
import type { RouteHas } from '../../lib/load-custom-routes';
import type { ServerRuntime } from 'next/types';
import type { RSCMeta } from '../webpack/loaders/get-module-build-info';
import { PAGE_TYPES } from '../../lib/page-types';
export interface MiddlewareConfigParsed extends Omit<MiddlewareConfig, 'matcher'> {
matchers?: MiddlewareMatcher[];
}
/**
* This interface represents the exported `config` object in a `middleware.ts` file.
*
* Read more: [Next.js Docs: Middleware `config` object](https://nextjs.org/docs/app/api-reference/file-conventions/middleware#config-object-optional)
*/
export interface MiddlewareConfig {
/**
* Read more: [Next.js Docs: Middleware `matcher`](https://nextjs.org/docs/app/api-reference/file-conventions/middleware#matcher),
* [Next.js Docs: Middleware matching paths](https://nextjs.org/docs/app/building-your-application/routing/middleware#matching-paths)
*/
matcher?: string | string[] | MiddlewareMatcher[];
unstable_allowDynamicGlobs?: string[];
regions?: string[] | string;
}
export interface MiddlewareMatcher {
regexp: string;
locale?: false;
has?: RouteHas[];
missing?: RouteHas[];
originalSource: string;
}
export interface PageStaticInfo {
runtime?: ServerRuntime;
preferredRegion?: string | string[];
ssg?: boolean;
ssr?: boolean;
rsc?: RSCModuleType;
generateStaticParams?: boolean;
middleware?: MiddlewareConfigParsed;
amp?: boolean | 'hybrid';
extraConfig?: Record<string, any>;
}
export type RSCModuleType = 'server' | 'client';
export declare function getRSCModuleInformation(source: string, isReactServerLayer: boolean): RSCMeta;
export declare function getMiddlewareMatchers(matcherOrMatchers: unknown, nextConfig: NextConfig): MiddlewareMatcher[];
export declare function isDynamicMetadataRoute(pageFilePath: string): Promise<boolean>;
/**
* For a given pageFilePath and nextConfig, if the config supports it, this
* function will read the file and return the runtime that should be used.
* It will look into the file content only if the page *requires* a runtime
* to be specified, that is, when gSSP or gSP is used.
* Related discussion: https://github.com/vercel/next.js/discussions/34179
*/
export declare function getPageStaticInfo(params: {
pageFilePath: string;
nextConfig: Partial<NextConfig>;
isDev?: boolean;
page?: string;
pageType: PAGE_TYPES;
}): Promise<PageStaticInfo>;

View File

@ -0,0 +1,494 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
getMiddlewareMatchers: null,
getPageStaticInfo: null,
getRSCModuleInformation: null,
isDynamicMetadataRoute: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getMiddlewareMatchers: function() {
return getMiddlewareMatchers;
},
getPageStaticInfo: function() {
return getPageStaticInfo;
},
getRSCModuleInformation: function() {
return getRSCModuleInformation;
},
isDynamicMetadataRoute: function() {
return isDynamicMetadataRoute;
}
});
const _fs = require("fs");
const _lrucache = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/lru-cache"));
const _picomatch = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/picomatch"));
const _extractconstvalue = require("./extract-const-value");
const _parsemodule = require("./parse-module");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../output/log"));
const _constants = require("../../lib/constants");
const _loadcustomroutes = require("../../lib/load-custom-routes");
const _trytoparsepath = require("../../lib/try-to-parse-path");
const _isapiroute = require("../../lib/is-api-route");
const _isedgeruntime = require("../../lib/is-edge-runtime");
const _constants1 = require("../../shared/lib/constants");
const _pagetypes = require("../../lib/page-types");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
// TODO: migrate preferredRegion here
// Don't forget to update the next-types-plugin file as well
const AUTHORIZED_EXTRA_ROUTER_PROPS = [
"maxDuration"
];
const CLIENT_MODULE_LABEL = /\/\* __next_internal_client_entry_do_not_use__ ([^ ]*) (cjs|auto) \*\//;
const ACTION_MODULE_LABEL = /\/\* __next_internal_action_entry_do_not_use__ (\{[^}]+\}) \*\//;
const CLIENT_DIRECTIVE = "use client";
const SERVER_ACTION_DIRECTIVE = "use server";
function getRSCModuleInformation(source, isReactServerLayer) {
var _clientInfoMatch_;
const actionsJson = source.match(ACTION_MODULE_LABEL);
const actions = actionsJson ? Object.values(JSON.parse(actionsJson[1])) : undefined;
const clientInfoMatch = source.match(CLIENT_MODULE_LABEL);
const isClientRef = !!clientInfoMatch;
if (!isReactServerLayer) {
return {
type: _constants1.RSC_MODULE_TYPES.client,
actions,
isClientRef
};
}
const clientRefs = clientInfoMatch == null ? void 0 : (_clientInfoMatch_ = clientInfoMatch[1]) == null ? void 0 : _clientInfoMatch_.split(",");
const clientEntryType = clientInfoMatch == null ? void 0 : clientInfoMatch[2];
const type = clientRefs ? _constants1.RSC_MODULE_TYPES.client : _constants1.RSC_MODULE_TYPES.server;
return {
type,
actions,
clientRefs,
clientEntryType,
isClientRef
};
}
const warnedInvalidValueMap = {
runtime: new Map(),
preferredRegion: new Map()
};
function warnInvalidValue(pageFilePath, key, message) {
if (warnedInvalidValueMap[key].has(pageFilePath)) return;
_log.warn(`Next.js can't recognize the exported \`${key}\` field in "${pageFilePath}" as ${message}.` + "\n" + "The default runtime will be used instead.");
warnedInvalidValueMap[key].set(pageFilePath, true);
}
/**
* Receives a parsed AST from SWC and checks if it belongs to a module that
* requires a runtime to be specified. Those are:
* - Modules with `export function getStaticProps | getServerSideProps`
* - Modules with `export { getStaticProps | getServerSideProps } <from ...>`
* - Modules with `export const runtime = ...`
*/ function checkExports(swcAST, pageFilePath) {
const exportsSet = new Set([
"getStaticProps",
"getServerSideProps",
"generateImageMetadata",
"generateSitemaps",
"generateStaticParams"
]);
if (Array.isArray(swcAST == null ? void 0 : swcAST.body)) {
try {
let runtime;
let preferredRegion;
let ssr = false;
let ssg = false;
let generateImageMetadata = false;
let generateSitemaps = false;
let generateStaticParams = false;
let extraProperties = new Set();
let directives = new Set();
let hasLeadingNonDirectiveNode = false;
for (const node of swcAST.body){
var _node_declaration, _node_declaration1, _node_declaration_identifier, _node_declaration2;
// There should be no non-string literals nodes before directives
if (node.type === "ExpressionStatement" && node.expression.type === "StringLiteral") {
if (!hasLeadingNonDirectiveNode) {
const directive = node.expression.value;
if (CLIENT_DIRECTIVE === directive) {
directives.add("client");
}
if (SERVER_ACTION_DIRECTIVE === directive) {
directives.add("server");
}
}
} else {
hasLeadingNonDirectiveNode = true;
}
if (node.type === "ExportDeclaration" && ((_node_declaration = node.declaration) == null ? void 0 : _node_declaration.type) === "VariableDeclaration") {
var _node_declaration3;
for (const declaration of (_node_declaration3 = node.declaration) == null ? void 0 : _node_declaration3.declarations){
if (declaration.id.value === "runtime") {
runtime = declaration.init.value;
} else if (declaration.id.value === "preferredRegion") {
if (declaration.init.type === "ArrayExpression") {
const elements = [];
for (const element of declaration.init.elements){
const { expression } = element;
if (expression.type !== "StringLiteral") {
continue;
}
elements.push(expression.value);
}
preferredRegion = elements;
} else {
preferredRegion = declaration.init.value;
}
} else {
extraProperties.add(declaration.id.value);
}
}
}
if (node.type === "ExportDeclaration" && ((_node_declaration1 = node.declaration) == null ? void 0 : _node_declaration1.type) === "FunctionDeclaration" && exportsSet.has((_node_declaration_identifier = node.declaration.identifier) == null ? void 0 : _node_declaration_identifier.value)) {
const id = node.declaration.identifier.value;
ssg = id === "getStaticProps";
ssr = id === "getServerSideProps";
generateImageMetadata = id === "generateImageMetadata";
generateSitemaps = id === "generateSitemaps";
generateStaticParams = id === "generateStaticParams";
}
if (node.type === "ExportDeclaration" && ((_node_declaration2 = node.declaration) == null ? void 0 : _node_declaration2.type) === "VariableDeclaration") {
var _node_declaration_declarations_, _node_declaration4;
const id = (_node_declaration4 = node.declaration) == null ? void 0 : (_node_declaration_declarations_ = _node_declaration4.declarations[0]) == null ? void 0 : _node_declaration_declarations_.id.value;
if (exportsSet.has(id)) {
ssg = id === "getStaticProps";
ssr = id === "getServerSideProps";
generateImageMetadata = id === "generateImageMetadata";
generateSitemaps = id === "generateSitemaps";
generateStaticParams = id === "generateStaticParams";
}
}
if (node.type === "ExportNamedDeclaration") {
const values = node.specifiers.map((specifier)=>{
var _specifier_orig, _specifier_orig1;
return specifier.type === "ExportSpecifier" && ((_specifier_orig = specifier.orig) == null ? void 0 : _specifier_orig.type) === "Identifier" && ((_specifier_orig1 = specifier.orig) == null ? void 0 : _specifier_orig1.value);
});
for (const value of values){
if (!ssg && value === "getStaticProps") ssg = true;
if (!ssr && value === "getServerSideProps") ssr = true;
if (!generateImageMetadata && value === "generateImageMetadata") generateImageMetadata = true;
if (!generateSitemaps && value === "generateSitemaps") generateSitemaps = true;
if (!generateStaticParams && value === "generateStaticParams") generateStaticParams = true;
if (!runtime && value === "runtime") warnInvalidValue(pageFilePath, "runtime", "it was not assigned to a string literal");
if (!preferredRegion && value === "preferredRegion") warnInvalidValue(pageFilePath, "preferredRegion", "it was not assigned to a string literal or an array of string literals");
}
}
}
return {
ssr,
ssg,
runtime,
preferredRegion,
generateImageMetadata,
generateSitemaps,
generateStaticParams,
extraProperties,
directives
};
} catch (err) {}
}
return {
ssg: false,
ssr: false,
runtime: undefined,
preferredRegion: undefined,
generateImageMetadata: false,
generateSitemaps: false,
generateStaticParams: false,
extraProperties: undefined,
directives: undefined
};
}
async function tryToReadFile(filePath, shouldThrow) {
try {
return await _fs.promises.readFile(filePath, {
encoding: "utf8"
});
} catch (error) {
if (shouldThrow) {
error.message = `Next.js ERROR: Failed to read file ${filePath}:\n${error.message}`;
throw error;
}
}
}
function getMiddlewareMatchers(matcherOrMatchers, nextConfig) {
let matchers = [];
if (Array.isArray(matcherOrMatchers)) {
matchers = matcherOrMatchers;
} else {
matchers.push(matcherOrMatchers);
}
const { i18n } = nextConfig;
const originalSourceMap = new Map();
let routes = matchers.map((m)=>{
let middleware = typeof m === "string" ? {
source: m
} : m;
if (middleware) {
originalSourceMap.set(middleware, middleware.source);
}
return middleware;
});
// check before we process the routes and after to ensure
// they are still valid
(0, _loadcustomroutes.checkCustomRoutes)(routes, "middleware");
routes = routes.map((r)=>{
let { source } = r;
const isRoot = source === "/";
if ((i18n == null ? void 0 : i18n.locales) && r.locale !== false) {
source = `/:nextInternalLocale((?!_next/)[^/.]{1,})${isRoot ? "" : source}`;
}
source = `/:nextData(_next/data/[^/]{1,})?${source}${isRoot ? `(${nextConfig.i18n ? "|\\.json|" : ""}/?index|/?index\\.json)?` : "(.json)?"}`;
if (nextConfig.basePath) {
source = `${nextConfig.basePath}${source}`;
}
r.source = source;
return r;
});
(0, _loadcustomroutes.checkCustomRoutes)(routes, "middleware");
return routes.map((r)=>{
const { source, ...rest } = r;
const parsedPage = (0, _trytoparsepath.tryToParsePath)(source);
if (parsedPage.error || !parsedPage.regexStr) {
throw new Error(`Invalid source: ${source}`);
}
const originalSource = originalSourceMap.get(r);
return {
...rest,
regexp: parsedPage.regexStr,
originalSource: originalSource || source
};
});
}
function getMiddlewareConfig(pageFilePath, config, nextConfig) {
const result = {};
if (config.matcher) {
result.matchers = getMiddlewareMatchers(config.matcher, nextConfig);
}
if (typeof config.regions === "string" || Array.isArray(config.regions)) {
result.regions = config.regions;
} else if (typeof config.regions !== "undefined") {
_log.warn(`The \`regions\` config was ignored: config must be empty, a string or an array of strings. (${pageFilePath})`);
}
if (config.unstable_allowDynamic) {
result.unstable_allowDynamicGlobs = Array.isArray(config.unstable_allowDynamic) ? config.unstable_allowDynamic : [
config.unstable_allowDynamic
];
for (const glob of result.unstable_allowDynamicGlobs ?? []){
try {
(0, _picomatch.default)(glob);
} catch (err) {
throw new Error(`${pageFilePath} exported 'config.unstable_allowDynamic' contains invalid pattern '${glob}': ${err.message}`);
}
}
}
return result;
}
const apiRouteWarnings = new _lrucache.default({
max: 250
});
function warnAboutExperimentalEdge(apiRoute) {
if (process.env.NODE_ENV === "production" && process.env.NEXT_PRIVATE_BUILD_WORKER === "1") {
return;
}
if (apiRouteWarnings.has(apiRoute)) {
return;
}
_log.warn(apiRoute ? `${apiRoute} provided runtime 'experimental-edge'. It can be updated to 'edge' instead.` : `You are using an experimental edge runtime, the API might change.`);
apiRouteWarnings.set(apiRoute, 1);
}
const warnedUnsupportedValueMap = new _lrucache.default({
max: 250
});
function warnAboutUnsupportedValue(pageFilePath, page, error) {
if (warnedUnsupportedValueMap.has(pageFilePath)) {
return;
}
_log.warn(`Next.js can't recognize the exported \`config\` field in ` + (page ? `route "${page}"` : `"${pageFilePath}"`) + ":\n" + error.message + (error.path ? ` at "${error.path}"` : "") + ".\n" + "The default config will be used instead.\n" + "Read More - https://nextjs.org/docs/messages/invalid-page-config");
warnedUnsupportedValueMap.set(pageFilePath, true);
}
async function isDynamicMetadataRoute(pageFilePath) {
const fileContent = await tryToReadFile(pageFilePath, true) || "";
if (/generateImageMetadata|generateSitemaps/.test(fileContent)) {
const swcAST = await (0, _parsemodule.parseModule)(pageFilePath, fileContent);
const exportsInfo = checkExports(swcAST, pageFilePath);
return !!(exportsInfo.generateImageMetadata || exportsInfo.generateSitemaps);
}
return false;
}
async function getPageStaticInfo(params) {
const { isDev, pageFilePath, nextConfig, page, pageType } = params;
const fileContent = await tryToReadFile(pageFilePath, !isDev) || "";
if (/(?<!(_jsx|jsx-))runtime|preferredRegion|getStaticProps|getServerSideProps|generateStaticParams|export const/.test(fileContent)) {
const swcAST = await (0, _parsemodule.parseModule)(pageFilePath, fileContent);
const { ssg, ssr, runtime, preferredRegion, generateStaticParams, extraProperties, directives } = checkExports(swcAST, pageFilePath);
const rscInfo = getRSCModuleInformation(fileContent, true);
const rsc = rscInfo.type;
// default / failsafe value for config
let config// TODO: type this as unknown
;
try {
config = (0, _extractconstvalue.extractExportedConstValue)(swcAST, "config");
} catch (e) {
if (e instanceof _extractconstvalue.UnsupportedValueError) {
warnAboutUnsupportedValue(pageFilePath, page, e);
}
// `export config` doesn't exist, or other unknown error thrown by swc, silence them
}
const extraConfig = {};
if (extraProperties && pageType === _pagetypes.PAGE_TYPES.APP) {
for (const prop of extraProperties){
if (!AUTHORIZED_EXTRA_ROUTER_PROPS.includes(prop)) continue;
try {
extraConfig[prop] = (0, _extractconstvalue.extractExportedConstValue)(swcAST, prop);
} catch (e) {
if (e instanceof _extractconstvalue.UnsupportedValueError) {
warnAboutUnsupportedValue(pageFilePath, page, e);
}
}
}
} else if (pageType === _pagetypes.PAGE_TYPES.PAGES) {
for(const key in config){
if (!AUTHORIZED_EXTRA_ROUTER_PROPS.includes(key)) continue;
extraConfig[key] = config[key];
}
}
if (pageType === _pagetypes.PAGE_TYPES.APP) {
if (config) {
let message = `Page config in ${pageFilePath} is deprecated. Replace \`export const config=…\` with the following:`;
if (config.runtime) {
message += `\n - \`export const runtime = ${JSON.stringify(config.runtime)}\``;
}
if (config.regions) {
message += `\n - \`export const preferredRegion = ${JSON.stringify(config.regions)}\``;
}
message += `\nVisit https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config for more information.`;
if (isDev) {
_log.warnOnce(message);
} else {
throw new Error(message);
}
config = {};
}
}
if (!config) config = {};
// We use `export const config = { runtime: '...' }` to specify the page runtime for pages/.
// In the new app directory, we prefer to use `export const runtime = '...'`
// and deprecate the old way. To prevent breaking changes for `pages`, we use the exported config
// as the fallback value.
let resolvedRuntime;
if (pageType === _pagetypes.PAGE_TYPES.APP) {
resolvedRuntime = runtime;
} else {
resolvedRuntime = runtime || config.runtime;
}
if (typeof resolvedRuntime !== "undefined" && resolvedRuntime !== _constants.SERVER_RUNTIME.nodejs && !(0, _isedgeruntime.isEdgeRuntime)(resolvedRuntime)) {
const options = Object.values(_constants.SERVER_RUNTIME).join(", ");
const message = typeof resolvedRuntime !== "string" ? `The \`runtime\` config must be a string. Please leave it empty or choose one of: ${options}` : `Provided runtime "${resolvedRuntime}" is not supported. Please leave it empty or choose one of: ${options}`;
if (isDev) {
_log.error(message);
} else {
throw new Error(message);
}
}
const requiresServerRuntime = ssr || ssg || pageType === _pagetypes.PAGE_TYPES.APP;
const isAnAPIRoute = (0, _isapiroute.isAPIRoute)(page == null ? void 0 : page.replace(/^(?:\/src)?\/pages\//, "/"));
resolvedRuntime = (0, _isedgeruntime.isEdgeRuntime)(resolvedRuntime) || requiresServerRuntime ? resolvedRuntime : undefined;
if (resolvedRuntime === _constants.SERVER_RUNTIME.experimentalEdge) {
warnAboutExperimentalEdge(isAnAPIRoute ? page : null);
}
if (resolvedRuntime === _constants.SERVER_RUNTIME.edge && pageType === _pagetypes.PAGE_TYPES.PAGES && page && !isAnAPIRoute) {
const message = `Page ${page} provided runtime 'edge', the edge runtime for rendering is currently experimental. Use runtime 'experimental-edge' instead.`;
if (isDev) {
_log.error(message);
} else {
throw new Error(message);
}
}
const middlewareConfig = getMiddlewareConfig(page ?? "middleware/edge API route", config, nextConfig);
if (pageType === _pagetypes.PAGE_TYPES.APP && (directives == null ? void 0 : directives.has("client")) && generateStaticParams) {
throw new Error(`Page "${page}" cannot use both "use client" and export function "generateStaticParams()".`);
}
return {
ssr,
ssg,
rsc,
generateStaticParams,
amp: config.amp || false,
...middlewareConfig && {
middleware: middlewareConfig
},
...resolvedRuntime && {
runtime: resolvedRuntime
},
preferredRegion,
extraConfig
};
}
return {
ssr: false,
ssg: false,
rsc: _constants1.RSC_MODULE_TYPES.server,
generateStaticParams: false,
amp: false,
runtime: undefined
};
}
//# sourceMappingURL=get-page-static-info.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
/**
* Parses a module with SWC using an LRU cache where the parsed module will
* be indexed by a sha of its content holding up to 500 entries.
*/
export declare const parseModule: (_: string, content: string) => Promise<any>;

27
node_modules/next/dist/build/analysis/parse-module.js generated vendored Normal file
View File

@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "parseModule", {
enumerable: true,
get: function() {
return parseModule;
}
});
const _lrucache = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/lru-cache"));
const _withpromisecache = require("../../lib/with-promise-cache");
const _crypto = require("crypto");
const _swc = require("../swc");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const parseModule = (0, _withpromisecache.withPromiseCache)(new _lrucache.default({
max: 500
}), async (filename, content)=>(0, _swc.parse)(content, {
isModule: "unknown",
filename
}).catch(()=>null), (_, content)=>(0, _crypto.createHash)("sha1").update(content).digest("hex"));
//# sourceMappingURL=parse-module.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/build/analysis/parse-module.ts"],"names":["parseModule","withPromiseCache","LRUCache","max","filename","content","parse","isModule","catch","_","createHash","update","digest"],"mappings":";;;;+BASaA;;;eAAAA;;;iEATQ;kCACY;wBACN;qBACL;;;;;;AAMf,MAAMA,cAAcC,IAAAA,kCAAgB,EACzC,IAAIC,iBAAQ,CAAc;IAAEC,KAAK;AAAI,IACrC,OAAOC,UAAkBC,UACvBC,IAAAA,UAAK,EAACD,SAAS;QAAEE,UAAU;QAAWH;IAAS,GAAGI,KAAK,CAAC,IAAM,OAChE,CAACC,GAAGJ,UAAYK,IAAAA,kBAAU,EAAC,QAAQC,MAAM,CAACN,SAASO,MAAM,CAAC"}

View File

@ -0,0 +1,10 @@
import type { NextBabelLoaderOptions, NextJsLoaderContext } from './types';
type BabelConfig = any;
export default function getConfig(this: NextJsLoaderContext, { source, target, loaderOptions, filename, inputSourceMap, }: {
source: string;
loaderOptions: NextBabelLoaderOptions;
target: string;
filename: string;
inputSourceMap?: object | null;
}): BabelConfig;
export {};

335
node_modules/next/dist/build/babel/loader/get-config.js generated vendored Normal file
View File

@ -0,0 +1,335 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return getConfig;
}
});
const _fs = require("fs");
const _json5 = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/json5"));
const _core = require("next/dist/compiled/babel/core");
const _corelibconfig = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/babel/core-lib-config"));
const _util = require("./util");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../output/log"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
const nextDistPath = /(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/;
const fileExtensionRegex = /\.([a-z]+)$/;
function getCacheCharacteristics(loaderOptions, source, filename) {
var _fileExtensionRegex_exec;
const { isServer, pagesDir } = loaderOptions;
const isPageFile = filename.startsWith(pagesDir);
const isNextDist = nextDistPath.test(filename);
const hasModuleExports = source.indexOf("module.exports") !== -1;
const fileExt = ((_fileExtensionRegex_exec = fileExtensionRegex.exec(filename)) == null ? void 0 : _fileExtensionRegex_exec[1]) || "unknown";
return {
isServer,
isPageFile,
isNextDist,
hasModuleExports,
fileExt
};
}
/**
* Return an array of Babel plugins, conditioned upon loader options and
* source file characteristics.
*/ function getPlugins(loaderOptions, cacheCharacteristics) {
const { isServer, isPageFile, isNextDist, hasModuleExports } = cacheCharacteristics;
const { hasReactRefresh, development } = loaderOptions;
const applyCommonJsItem = hasModuleExports ? (0, _core.createConfigItem)(require("../plugins/commonjs"), {
type: "plugin"
}) : null;
const reactRefreshItem = hasReactRefresh ? (0, _core.createConfigItem)([
require("next/dist/compiled/react-refresh/babel"),
{
skipEnvCheck: true
}
], {
type: "plugin"
}) : null;
const pageConfigItem = !isServer && isPageFile ? (0, _core.createConfigItem)([
require("../plugins/next-page-config")
], {
type: "plugin"
}) : null;
const disallowExportAllItem = !isServer && isPageFile ? (0, _core.createConfigItem)([
require("../plugins/next-page-disallow-re-export-all-exports")
], {
type: "plugin"
}) : null;
const transformDefineItem = (0, _core.createConfigItem)([
require.resolve("next/dist/compiled/babel/plugin-transform-define"),
{
"process.env.NODE_ENV": development ? "development" : "production",
"typeof window": isServer ? "undefined" : "object",
"process.browser": isServer ? false : true
},
"next-js-transform-define-instance"
], {
type: "plugin"
});
const nextSsgItem = !isServer && isPageFile ? (0, _core.createConfigItem)([
require.resolve("../plugins/next-ssg-transform")
], {
type: "plugin"
}) : null;
const commonJsItem = isNextDist ? (0, _core.createConfigItem)(require("next/dist/compiled/babel/plugin-transform-modules-commonjs"), {
type: "plugin"
}) : null;
const nextFontUnsupported = (0, _core.createConfigItem)([
require("../plugins/next-font-unsupported")
], {
type: "plugin"
});
return [
reactRefreshItem,
pageConfigItem,
disallowExportAllItem,
applyCommonJsItem,
transformDefineItem,
nextSsgItem,
commonJsItem,
nextFontUnsupported
].filter(Boolean);
}
const isJsonFile = /\.(json|babelrc)$/;
const isJsFile = /\.js$/;
/**
* While this function does block execution while reading from disk, it
* should not introduce any issues. The function is only invoked when
* generating a fresh config, and only a small handful of configs should
* be generated during compilation.
*/ function getCustomBabelConfig(configFilePath) {
if (isJsonFile.exec(configFilePath)) {
const babelConfigRaw = (0, _fs.readFileSync)(configFilePath, "utf8");
return _json5.default.parse(babelConfigRaw);
} else if (isJsFile.exec(configFilePath)) {
return require(configFilePath);
}
throw new Error("The Next.js Babel loader does not support .mjs or .cjs config files.");
}
let babelConfigWarned = false;
/**
* Check if custom babel configuration from user only contains options that
* can be migrated into latest Next.js features supported by SWC.
*
* This raises soft warning messages only, not making any errors yet.
*/ function checkCustomBabelConfigDeprecation(config) {
if (!config || Object.keys(config).length === 0) {
return;
}
const { plugins, presets, ...otherOptions } = config;
if (Object.keys(otherOptions ?? {}).length > 0) {
return;
}
if (babelConfigWarned) {
return;
}
babelConfigWarned = true;
const isPresetReadyToDeprecate = !presets || presets.length === 0 || presets.length === 1 && presets[0] === "next/babel";
const pluginReasons = [];
const unsupportedPlugins = [];
if (Array.isArray(plugins)) {
for (const plugin of plugins){
const pluginName = Array.isArray(plugin) ? plugin[0] : plugin;
// [NOTE]: We cannot detect if the user uses babel-plugin-macro based transform plugins,
// such as `styled-components/macro` in here.
switch(pluginName){
case "styled-components":
case "babel-plugin-styled-components":
pluginReasons.push(`\t- 'styled-components' can be enabled via 'compiler.styledComponents' in 'next.config.js'`);
break;
case "@emotion/babel-plugin":
pluginReasons.push(`\t- '@emotion/babel-plugin' can be enabled via 'compiler.emotion' in 'next.config.js'`);
break;
case "babel-plugin-relay":
pluginReasons.push(`\t- 'babel-plugin-relay' can be enabled via 'compiler.relay' in 'next.config.js'`);
break;
case "react-remove-properties":
pluginReasons.push(`\t- 'react-remove-properties' can be enabled via 'compiler.reactRemoveProperties' in 'next.config.js'`);
break;
case "transform-remove-console":
pluginReasons.push(`\t- 'transform-remove-console' can be enabled via 'compiler.removeConsole' in 'next.config.js'`);
break;
default:
unsupportedPlugins.push(pluginName);
break;
}
}
}
if (isPresetReadyToDeprecate && unsupportedPlugins.length === 0) {
_log.warn(`It looks like there is a custom Babel configuration that can be removed${pluginReasons.length > 0 ? ":" : "."}`);
if (pluginReasons.length > 0) {
_log.warn(`Next.js supports the following features natively: `);
_log.warn(pluginReasons.join(""));
_log.warn(`For more details configuration options, please refer https://nextjs.org/docs/architecture/nextjs-compiler#supported-features`);
}
}
}
/**
* Generate a new, flat Babel config, ready to be handed to Babel-traverse.
* This config should have no unresolved overrides, presets, etc.
*/ function getFreshConfig(cacheCharacteristics, loaderOptions, target, filename, inputSourceMap) {
let { isServer, pagesDir, development, hasJsxRuntime, configFile, srcDir } = loaderOptions;
let customConfig = configFile ? getCustomBabelConfig(configFile) : undefined;
checkCustomBabelConfigDeprecation(customConfig);
let options = {
babelrc: false,
cloneInputAst: false,
filename,
inputSourceMap: inputSourceMap || undefined,
// Set the default sourcemap behavior based on Webpack's mapping flag,
// but allow users to override if they want.
sourceMaps: loaderOptions.sourceMaps === undefined ? this.sourceMap : loaderOptions.sourceMaps,
// Ensure that Webpack will get a full absolute path in the sourcemap
// so that it can properly map the module back to its internal cached
// modules.
sourceFileName: filename,
plugins: [
...getPlugins(loaderOptions, cacheCharacteristics),
...(customConfig == null ? void 0 : customConfig.plugins) || []
],
// target can be provided in babelrc
target: isServer ? undefined : customConfig == null ? void 0 : customConfig.target,
// env can be provided in babelrc
env: customConfig == null ? void 0 : customConfig.env,
presets: (()=>{
// If presets is defined the user will have next/babel in their babelrc
if (customConfig == null ? void 0 : customConfig.presets) {
return customConfig.presets;
}
// If presets is not defined the user will likely have "env" in their babelrc
if (customConfig) {
return undefined;
}
// If no custom config is provided the default is to use next/babel
return [
"next/babel"
];
})(),
overrides: loaderOptions.overrides,
caller: {
name: "next-babel-turbo-loader",
supportsStaticESM: true,
supportsDynamicImport: true,
// Provide plugins with insight into webpack target.
// https://github.com/babel/babel-loader/issues/787
target: target,
// Webpack 5 supports TLA behind a flag. We enable it by default
// for Babel, and then webpack will throw an error if the experimental
// flag isn't enabled.
supportsTopLevelAwait: true,
isServer,
srcDir,
pagesDir,
isDev: development,
hasJsxRuntime,
...loaderOptions.caller
}
};
// Babel does strict checks on the config so undefined is not allowed
if (typeof options.target === "undefined") {
delete options.target;
}
Object.defineProperty(options.caller, "onWarning", {
enumerable: false,
writable: false,
value: (reason)=>{
if (!(reason instanceof Error)) {
reason = new Error(reason);
}
this.emitWarning(reason);
}
});
const loadedOptions = (0, _core.loadOptions)(options);
const config = (0, _util.consumeIterator)((0, _corelibconfig.default)(loadedOptions));
return config;
}
/**
* Each key returned here corresponds with a Babel config that can be shared.
* The conditions of permissible sharing between files is dependent on specific
* file attributes and Next.js compiler states: `CharacteristicsGermaneToCaching`.
*/ function getCacheKey(cacheCharacteristics) {
const { isServer, isPageFile, isNextDist, hasModuleExports, fileExt } = cacheCharacteristics;
const flags = 0 | (isServer ? 1 : 0) | (isPageFile ? 2 : 0) | (isNextDist ? 4 : 0) | (hasModuleExports ? 8 : 0);
return fileExt + flags;
}
const configCache = new Map();
const configFiles = new Set();
function getConfig({ source, target, loaderOptions, filename, inputSourceMap }) {
const cacheCharacteristics = getCacheCharacteristics(loaderOptions, source, filename);
if (loaderOptions.configFile) {
// Ensures webpack invalidates the cache for this loader when the config file changes
this.addDependency(loaderOptions.configFile);
}
const cacheKey = getCacheKey(cacheCharacteristics);
if (configCache.has(cacheKey)) {
const cachedConfig = configCache.get(cacheKey);
return {
...cachedConfig,
options: {
...cachedConfig.options,
cwd: loaderOptions.cwd,
root: loaderOptions.cwd,
filename,
sourceFileName: filename
}
};
}
if (loaderOptions.configFile && !configFiles.has(loaderOptions.configFile)) {
configFiles.add(loaderOptions.configFile);
_log.info(`Using external babel configuration from ${loaderOptions.configFile}`);
}
const freshConfig = getFreshConfig.call(this, cacheCharacteristics, loaderOptions, target, filename, inputSourceMap);
configCache.set(cacheKey, freshConfig);
return freshConfig;
}
//# sourceMappingURL=get-config.js.map

File diff suppressed because one or more lines are too long

3
node_modules/next/dist/build/babel/loader/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,3 @@
import type { NextJsLoaderContext } from './types';
declare const nextBabelLoaderOuter: (this: NextJsLoaderContext, inputSource: string, inputSourceMap: object | null | undefined) => void;
export default nextBabelLoaderOuter;

38
node_modules/next/dist/build/babel/loader/index.js generated vendored Normal file
View File

@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _transform = /*#__PURE__*/ _interop_require_default(require("./transform"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
async function nextBabelLoader(parentTrace, inputSource, inputSourceMap) {
const filename = this.resourcePath;
const target = this.target;
const loaderOptions = parentTrace.traceChild("get-options")// @ts-ignore TODO: remove ignore once webpack 5 types are used
.traceFn(()=>this.getOptions());
const loaderSpanInner = parentTrace.traceChild("next-babel-turbo-transform");
const { code: transformedSource, map: outputSourceMap } = loaderSpanInner.traceFn(()=>_transform.default.call(this, inputSource, inputSourceMap, loaderOptions, filename, target, loaderSpanInner));
return [
transformedSource,
outputSourceMap
];
}
const nextBabelLoaderOuter = function nextBabelLoaderOuter(inputSource, inputSourceMap) {
const callback = this.async();
const loaderSpan = this.currentTraceSpan.traceChild("next-babel-turbo-loader");
loaderSpan.traceAsyncFn(()=>nextBabelLoader.call(this, loaderSpan, inputSource, inputSourceMap)).then(([transformedSource, outputSourceMap])=>callback == null ? void 0 : callback(null, transformedSource, outputSourceMap || inputSourceMap), (err)=>{
callback == null ? void 0 : callback(err);
});
};
const _default = nextBabelLoaderOuter;
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/babel/loader/index.ts"],"names":["nextBabelLoader","parentTrace","inputSource","inputSourceMap","filename","resourcePath","target","loaderOptions","traceChild","traceFn","getOptions","loaderSpanInner","code","transformedSource","map","outputSourceMap","transform","call","nextBabelLoaderOuter","callback","async","loaderSpan","currentTraceSpan","traceAsyncFn","then","err"],"mappings":";;;;+BAuDA;;;eAAA;;;kEAtDsB;;;;;;AAGtB,eAAeA,gBAEbC,WAAiB,EACjBC,WAAmB,EACnBC,cAAyC;IAEzC,MAAMC,WAAW,IAAI,CAACC,YAAY;IAClC,MAAMC,SAAS,IAAI,CAACA,MAAM;IAC1B,MAAMC,gBAAgBN,YACnBO,UAAU,CAAC,cACZ,+DAA+D;KAC9DC,OAAO,CAAC,IAAM,IAAI,CAACC,UAAU;IAEhC,MAAMC,kBAAkBV,YAAYO,UAAU,CAAC;IAC/C,MAAM,EAAEI,MAAMC,iBAAiB,EAAEC,KAAKC,eAAe,EAAE,GACrDJ,gBAAgBF,OAAO,CAAC,IACtBO,kBAAS,CAACC,IAAI,CACZ,IAAI,EACJf,aACAC,gBACAI,eACAH,UACAE,QACAK;IAIN,OAAO;QAACE;QAAmBE;KAAgB;AAC7C;AAEA,MAAMG,uBAAuB,SAASA,qBAEpChB,WAAmB,EACnBC,cAAyC;IAEzC,MAAMgB,WAAW,IAAI,CAACC,KAAK;IAE3B,MAAMC,aAAa,IAAI,CAACC,gBAAgB,CAACd,UAAU,CAAC;IACpDa,WACGE,YAAY,CAAC,IACZvB,gBAAgBiB,IAAI,CAAC,IAAI,EAAEI,YAAYnB,aAAaC,iBAErDqB,IAAI,CACH,CAAC,CAACX,mBAAmBE,gBAAqB,GACxCI,4BAAAA,SAAW,MAAMN,mBAAmBE,mBAAmBZ,iBACzD,CAACsB;QACCN,4BAAAA,SAAWM;IACb;AAEN;MAEA,WAAeP"}

View File

@ -0,0 +1,14 @@
import type { Span } from '../../../trace';
import type { NextJsLoaderContext } from './types';
export default function transform(this: NextJsLoaderContext, source: string, inputSourceMap: object | null | undefined, loaderOptions: any, filename: string, target: string, parentSpan: Span): {
code: string;
map: {
version: number;
sources: string[];
names: string[];
sourceRoot?: string | undefined;
sourcesContent?: string[] | undefined;
mappings: string;
file: string;
} | null;
};

97
node_modules/next/dist/build/babel/loader/transform.js generated vendored Normal file
View File

@ -0,0 +1,97 @@
/*
* Partially adapted from @babel/core (MIT license).
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return transform;
}
});
const _traverse = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/babel/traverse"));
const _generator = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/babel/generator"));
const _corelibnormalizefile = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/babel/core-lib-normalize-file"));
const _corelibnormalizeopts = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/babel/core-lib-normalize-opts"));
const _corelibblockhoistplugin = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/babel/core-lib-block-hoist-plugin"));
const _corelibpluginpass = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/babel/core-lib-plugin-pass"));
const _getconfig = /*#__PURE__*/ _interop_require_default(require("./get-config"));
const _util = require("./util");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getTraversalParams(file, pluginPairs) {
const passPairs = [];
const passes = [];
const visitors = [];
for (const plugin of pluginPairs.concat((0, _corelibblockhoistplugin.default)())){
const pass = new _corelibpluginpass.default(file, plugin.key, plugin.options);
passPairs.push([
plugin,
pass
]);
passes.push(pass);
visitors.push(plugin.visitor);
}
return {
passPairs,
passes,
visitors
};
}
function invokePluginPre(file, passPairs) {
for (const [{ pre }, pass] of passPairs){
if (pre) {
pre.call(pass, file);
}
}
}
function invokePluginPost(file, passPairs) {
for (const [{ post }, pass] of passPairs){
if (post) {
post.call(pass, file);
}
}
}
function transformAstPass(file, pluginPairs, parentSpan) {
const { passPairs, passes, visitors } = getTraversalParams(file, pluginPairs);
invokePluginPre(file, passPairs);
const visitor = _traverse.default.visitors.merge(visitors, passes, // @ts-ignore - the exported types are incorrect here
file.opts.wrapPluginVisitorMethod);
parentSpan.traceChild("babel-turbo-traverse").traceFn(()=>(0, _traverse.default)(file.ast, visitor, file.scope));
invokePluginPost(file, passPairs);
}
function transformAst(file, babelConfig, parentSpan) {
for (const pluginPairs of babelConfig.passes){
transformAstPass(file, pluginPairs, parentSpan);
}
}
function transform(source, inputSourceMap, loaderOptions, filename, target, parentSpan) {
const getConfigSpan = parentSpan.traceChild("babel-turbo-get-config");
const babelConfig = _getconfig.default.call(this, {
source,
loaderOptions,
inputSourceMap,
target,
filename
});
getConfigSpan.stop();
const normalizeSpan = parentSpan.traceChild("babel-turbo-normalize-file");
const file = (0, _util.consumeIterator)((0, _corelibnormalizefile.default)(babelConfig.passes, (0, _corelibnormalizeopts.default)(babelConfig), source));
normalizeSpan.stop();
const transformSpan = parentSpan.traceChild("babel-turbo-transform");
transformAst(file, babelConfig, transformSpan);
transformSpan.stop();
const generateSpan = parentSpan.traceChild("babel-turbo-generate");
const { code, map } = (0, _generator.default)(file.ast, file.opts.generatorOpts, file.code);
generateSpan.stop();
return {
code,
map
};
}
//# sourceMappingURL=transform.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/babel/loader/transform.ts"],"names":["transform","getTraversalParams","file","pluginPairs","passPairs","passes","visitors","plugin","concat","loadBlockHoistPlugin","pass","PluginPass","key","options","push","visitor","invokePluginPre","pre","call","invokePluginPost","post","transformAstPass","parentSpan","traverse","merge","opts","wrapPluginVisitorMethod","traceChild","traceFn","ast","scope","transformAst","babelConfig","source","inputSourceMap","loaderOptions","filename","target","getConfigSpan","getConfig","stop","normalizeSpan","consumeIterator","normalizeFile","normalizeOpts","transformSpan","generateSpan","code","map","generate","generatorOpts"],"mappings":"AAAA;;CAEC;;;;+BAqED;;;eAAwBA;;;iEAnEH;kEACA;6EACK;6EACA;gFACO;0EACV;kEAED;sBACU;;;;;;AAIhC,SAASC,mBAAmBC,IAAS,EAAEC,WAAkB;IACvD,MAAMC,YAAY,EAAE;IACpB,MAAMC,SAAS,EAAE;IACjB,MAAMC,WAAW,EAAE;IAEnB,KAAK,MAAMC,UAAUJ,YAAYK,MAAM,CAACC,IAAAA,gCAAoB,KAAK;QAC/D,MAAMC,OAAO,IAAIC,0BAAU,CAACT,MAAMK,OAAOK,GAAG,EAAEL,OAAOM,OAAO;QAC5DT,UAAUU,IAAI,CAAC;YAACP;YAAQG;SAAK;QAC7BL,OAAOS,IAAI,CAACJ;QACZJ,SAASQ,IAAI,CAACP,OAAOQ,OAAO;IAC9B;IAEA,OAAO;QAAEX;QAAWC;QAAQC;IAAS;AACvC;AAEA,SAASU,gBAAgBd,IAAS,EAAEE,SAAgB;IAClD,KAAK,MAAM,CAAC,EAAEa,GAAG,EAAE,EAAEP,KAAK,IAAIN,UAAW;QACvC,IAAIa,KAAK;YACPA,IAAIC,IAAI,CAACR,MAAMR;QACjB;IACF;AACF;AAEA,SAASiB,iBAAiBjB,IAAS,EAAEE,SAAgB;IACnD,KAAK,MAAM,CAAC,EAAEgB,IAAI,EAAE,EAAEV,KAAK,IAAIN,UAAW;QACxC,IAAIgB,MAAM;YACRA,KAAKF,IAAI,CAACR,MAAMR;QAClB;IACF;AACF;AAEA,SAASmB,iBAAiBnB,IAAS,EAAEC,WAAkB,EAAEmB,UAAgB;IACvE,MAAM,EAAElB,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAE,GAAGL,mBAAmBC,MAAMC;IAEjEa,gBAAgBd,MAAME;IACtB,MAAMW,UAAUQ,iBAAQ,CAACjB,QAAQ,CAACkB,KAAK,CACrClB,UACAD,QACA,qDAAqD;IACrDH,KAAKuB,IAAI,CAACC,uBAAuB;IAGnCJ,WACGK,UAAU,CAAC,wBACXC,OAAO,CAAC,IAAML,IAAAA,iBAAQ,EAACrB,KAAK2B,GAAG,EAAEd,SAASb,KAAK4B,KAAK;IAEvDX,iBAAiBjB,MAAME;AACzB;AAEA,SAAS2B,aAAa7B,IAAS,EAAE8B,WAAgB,EAAEV,UAAgB;IACjE,KAAK,MAAMnB,eAAe6B,YAAY3B,MAAM,CAAE;QAC5CgB,iBAAiBnB,MAAMC,aAAamB;IACtC;AACF;AAEe,SAAStB,UAEtBiC,MAAc,EACdC,cAAyC,EACzCC,aAAkB,EAClBC,QAAgB,EAChBC,MAAc,EACdf,UAAgB;IAEhB,MAAMgB,gBAAgBhB,WAAWK,UAAU,CAAC;IAC5C,MAAMK,cAAcO,kBAAS,CAACrB,IAAI,CAAC,IAAI,EAAE;QACvCe;QACAE;QACAD;QACAG;QACAD;IACF;IACAE,cAAcE,IAAI;IAElB,MAAMC,gBAAgBnB,WAAWK,UAAU,CAAC;IAC5C,MAAMzB,OAAOwC,IAAAA,qBAAe,EAC1BC,IAAAA,6BAAa,EAACX,YAAY3B,MAAM,EAAEuC,IAAAA,6BAAa,EAACZ,cAAcC;IAEhEQ,cAAcD,IAAI;IAElB,MAAMK,gBAAgBvB,WAAWK,UAAU,CAAC;IAC5CI,aAAa7B,MAAM8B,aAAaa;IAChCA,cAAcL,IAAI;IAElB,MAAMM,eAAexB,WAAWK,UAAU,CAAC;IAC3C,MAAM,EAAEoB,IAAI,EAAEC,GAAG,EAAE,GAAGC,IAAAA,kBAAQ,EAAC/C,KAAK2B,GAAG,EAAE3B,KAAKuB,IAAI,CAACyB,aAAa,EAAEhD,KAAK6C,IAAI;IAC3ED,aAAaN,IAAI;IAEjB,OAAO;QAAEO;QAAMC;IAAI;AACrB"}

21
node_modules/next/dist/build/babel/loader/types.d.ts generated vendored Normal file
View File

@ -0,0 +1,21 @@
import type { webpack } from 'next/dist/compiled/webpack/webpack'
import type { Span } from '../../../trace'
export interface NextJsLoaderContext extends webpack.LoaderContext<{}> {
currentTraceSpan: Span
target: string
}
export interface NextBabelLoaderOptions {
hasJsxRuntime: boolean
hasReactRefresh: boolean
isServer: boolean
development: boolean
pagesDir: string
sourceMaps?: any[]
overrides: any
caller: any
configFile: string | undefined
cwd: string
srcDir: string
}

1
node_modules/next/dist/build/babel/loader/util.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export declare function consumeIterator(iter: Iterator<any>): any;

20
node_modules/next/dist/build/babel/loader/util.js generated vendored Normal file
View File

@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "consumeIterator", {
enumerable: true,
get: function() {
return consumeIterator;
}
});
function consumeIterator(iter) {
while(true){
const { value, done } = iter.next();
if (done) {
return value;
}
}
}
//# sourceMappingURL=util.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/babel/loader/util.ts"],"names":["consumeIterator","iter","value","done","next"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,gBAAgBC,IAAmB;IACjD,MAAO,KAAM;QACX,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGF,KAAKG,IAAI;QACjC,IAAID,MAAM;YACR,OAAOD;QACT;IACF;AACF"}

View File

@ -0,0 +1,2 @@
import type { PluginObj } from 'next/dist/compiled/babel/core';
export default function AmpAttributePatcher(): PluginObj;

View File

@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return AmpAttributePatcher;
}
});
function AmpAttributePatcher() {
return {
visitor: {
JSXOpeningElement (path) {
const openingElement = path.node;
const { name, attributes } = openingElement;
if (!(name && name.type === "JSXIdentifier")) {
return;
}
if (!name.name.startsWith("amp-")) {
return;
}
for (const attribute of attributes){
if (attribute.type !== "JSXAttribute") {
continue;
}
if (attribute.name.name === "className") {
attribute.name.name = "class";
}
}
}
}
};
}
//# sourceMappingURL=amp-attributes.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/babel/plugins/amp-attributes.ts"],"names":["AmpAttributePatcher","visitor","JSXOpeningElement","path","openingElement","node","name","attributes","type","startsWith","attribute"],"mappings":";;;;+BAEA;;;eAAwBA;;;AAAT,SAASA;IACtB,OAAO;QACLC,SAAS;YACPC,mBAAkBC,IAAuC;gBACvD,MAAMC,iBAAiBD,KAAKE,IAAI;gBAEhC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAE,GAAGH;gBAC7B,IAAI,CAAEE,CAAAA,QAAQA,KAAKE,IAAI,KAAK,eAAc,GAAI;oBAC5C;gBACF;gBAEA,IAAI,CAACF,KAAKA,IAAI,CAACG,UAAU,CAAC,SAAS;oBACjC;gBACF;gBAEA,KAAK,MAAMC,aAAaH,WAAY;oBAClC,IAAIG,UAAUF,IAAI,KAAK,gBAAgB;wBACrC;oBACF;oBAEA,IAAIE,UAAUJ,IAAI,CAACA,IAAI,KAAK,aAAa;wBACvCI,UAAUJ,IAAI,CAACA,IAAI,GAAG;oBACxB;gBACF;YACF;QACF;IACF;AACF"}

View File

@ -0,0 +1,2 @@
import type { PluginObj } from 'next/dist/compiled/babel/core';
export default function CommonJSModulePlugin(...args: any): PluginObj;

42
node_modules/next/dist/build/babel/plugins/commonjs.js generated vendored Normal file
View File

@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, // Handle module.exports in user code
"default", {
enumerable: true,
get: function() {
return CommonJSModulePlugin;
}
});
const _plugintransformmodulescommonjs = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/babel/plugin-transform-modules-commonjs"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function CommonJSModulePlugin(...args) {
const commonjs = (0, _plugintransformmodulescommonjs.default)(...args);
return {
visitor: {
Program: {
exit (path, state) {
let foundModuleExports = false;
path.traverse({
MemberExpression (expressionPath) {
if (expressionPath.node.object.name !== "module") return;
if (expressionPath.node.property.name !== "exports") return;
foundModuleExports = true;
}
});
if (!foundModuleExports) {
return;
}
commonjs.visitor.Program.exit.call(this, path, state);
}
}
}
};
}
//# sourceMappingURL=commonjs.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/babel/plugins/commonjs.ts"],"names":["CommonJSModulePlugin","args","commonjs","commonjsPlugin","visitor","Program","exit","path","state","foundModuleExports","traverse","MemberExpression","expressionPath","node","object","name","property","call"],"mappings":";;;;+BAIA,qCAAqC;AACrC;;;eAAwBA;;;uFAHG;;;;;;AAGZ,SAASA,qBAAqB,GAAGC,IAAS;IACvD,MAAMC,WAAWC,IAAAA,uCAAc,KAAIF;IACnC,OAAO;QACLG,SAAS;YACPC,SAAS;gBACPC,MAAKC,IAA6B,EAAEC,KAAK;oBACvC,IAAIC,qBAAqB;oBACzBF,KAAKG,QAAQ,CAAC;wBACZC,kBAAiBC,cAAmB;4BAClC,IAAIA,eAAeC,IAAI,CAACC,MAAM,CAACC,IAAI,KAAK,UAAU;4BAClD,IAAIH,eAAeC,IAAI,CAACG,QAAQ,CAACD,IAAI,KAAK,WAAW;4BACrDN,qBAAqB;wBACvB;oBACF;oBAEA,IAAI,CAACA,oBAAoB;wBACvB;oBACF;oBAEAP,SAASE,OAAO,CAACC,OAAO,CAACC,IAAI,CAACW,IAAI,CAAC,IAAI,EAAEV,MAAMC;gBACjD;YACF;QACF;IACF;AACF"}

View File

@ -0,0 +1,5 @@
import type { types as BabelTypes } from 'next/dist/compiled/babel/core';
import type { PluginObj } from 'next/dist/compiled/babel/core';
export default function ({ types: t, }: {
types: typeof BabelTypes;
}): PluginObj<any>;

View File

@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _pluginsyntaxjsx = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/babel/plugin-syntax-jsx"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _default({ types: t }) {
return {
inherits: _pluginsyntaxjsx.default,
visitor: {
JSXElement (_path, state) {
state.set("jsx", true);
},
// Fragment syntax is still JSX since it compiles to createElement(),
// but JSXFragment is not a JSXElement
JSXFragment (_path, state) {
state.set("jsx", true);
},
Program: {
exit (path, state) {
if (state.get("jsx")) {
const pragma = t.identifier(state.opts.pragma);
let importAs = pragma;
// if there's already a React in scope, use that instead of adding an import
const existingBinding = state.opts.reuseImport !== false && state.opts.importAs && path.scope.getBinding(state.opts.importAs);
// var _jsx = _pragma.createElement;
if (state.opts.property) {
if (state.opts.importAs) {
importAs = t.identifier(state.opts.importAs);
} else {
importAs = path.scope.generateUidIdentifier("pragma");
}
const mapping = t.variableDeclaration("var", [
t.variableDeclarator(pragma, t.memberExpression(importAs, t.identifier(state.opts.property)))
]);
// if the React binding came from a require('react'),
// make sure that our usage comes after it.
let newPath;
if (existingBinding && t.isVariableDeclarator(existingBinding.path.node) && t.isCallExpression(existingBinding.path.node.init) && t.isIdentifier(existingBinding.path.node.init.callee) && existingBinding.path.node.init.callee.name === "require") {
[newPath] = existingBinding.path.parentPath.insertAfter(mapping);
} else {
[newPath] = path.unshiftContainer("body", mapping);
}
for (const declar of newPath.get("declarations")){
path.scope.registerBinding(newPath.node.kind, declar);
}
}
if (!existingBinding) {
const importSpecifier = t.importDeclaration([
state.opts.import ? t.importSpecifier(importAs, t.identifier(state.opts.import)) : state.opts.importNamespace ? t.importNamespaceSpecifier(importAs) : t.importDefaultSpecifier(importAs)
], t.stringLiteral(state.opts.module || "react"));
const [newPath] = path.unshiftContainer("body", importSpecifier);
for (const specifier of newPath.get("specifiers")){
path.scope.registerBinding("module", specifier);
}
}
}
}
}
}
};
}
//# sourceMappingURL=jsx-pragma.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/babel/plugins/jsx-pragma.ts"],"names":["types","t","inherits","jsx","visitor","JSXElement","_path","state","set","JSXFragment","Program","exit","path","get","pragma","identifier","opts","importAs","existingBinding","reuseImport","scope","getBinding","property","generateUidIdentifier","mapping","variableDeclaration","variableDeclarator","memberExpression","newPath","isVariableDeclarator","node","isCallExpression","init","isIdentifier","callee","name","parentPath","insertAfter","unshiftContainer","declar","registerBinding","kind","importSpecifier","importDeclaration","import","importNamespace","importNamespaceSpecifier","importDefaultSpecifier","stringLiteral","module","specifier"],"mappings":"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"}

View File

@ -0,0 +1,2 @@
import type { PluginObj } from 'next/dist/compiled/babel/core';
export default function NextPageDisallowReExportAllExports(): PluginObj<any>;

View File

@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return NextPageDisallowReExportAllExports;
}
});
function NextPageDisallowReExportAllExports() {
return {
visitor: {
ImportDeclaration (path) {
if ([
"@next/font/local",
"@next/font/google",
"next/font/local",
"next/font/google"
].includes(path.node.source.value)) {
var _path_node_loc, _path_node_loc1;
const err = new SyntaxError(`"next/font" requires SWC although Babel is being used due to a custom babel config being present.\nRead more: https://nextjs.org/docs/messages/babel-font-loader-conflict`);
err.code = "BABEL_PARSE_ERROR";
err.loc = ((_path_node_loc = path.node.loc) == null ? void 0 : _path_node_loc.start) ?? ((_path_node_loc1 = path.node.loc) == null ? void 0 : _path_node_loc1.end) ?? path.node.loc;
throw err;
}
}
}
};
}
//# sourceMappingURL=next-font-unsupported.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/build/babel/plugins/next-font-unsupported.ts"],"names":["NextPageDisallowReExportAllExports","visitor","ImportDeclaration","path","includes","node","source","value","err","SyntaxError","code","loc","start","end"],"mappings":";;;;+BAGA;;;eAAwBA;;;AAAT,SAASA;IACtB,OAAO;QACLC,SAAS;YACPC,mBAAkBC,IAAuC;gBACvD,IACE;oBACE;oBACA;oBACA;oBACA;iBACD,CAACC,QAAQ,CAACD,KAAKE,IAAI,CAACC,MAAM,CAACC,KAAK,GACjC;wBAMEJ,gBAAwBA;oBAL1B,MAAMK,MAAM,IAAIC,YACd,CAAC,yKAAyK,CAAC;oBAE3KD,IAAYE,IAAI,GAAG;oBACnBF,IAAYG,GAAG,GACfR,EAAAA,iBAAAA,KAAKE,IAAI,CAACM,GAAG,qBAAbR,eAAeS,KAAK,OAAIT,kBAAAA,KAAKE,IAAI,CAACM,GAAG,qBAAbR,gBAAeU,GAAG,KAAIV,KAAKE,IAAI,CAACM,GAAG;oBAC7D,MAAMH;gBACR;YACF;QACF;IACF;AACF"}

View File

@ -0,0 +1,5 @@
import { types as BabelTypes } from 'next/dist/compiled/babel/core';
import type { PluginObj } from 'next/dist/compiled/babel/core';
export default function nextPageConfig({ types: t, }: {
types: typeof BabelTypes;
}): PluginObj;

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