Files
voyage/apps/public-web/node_modules/next/dist/bin/next
PascalSchattenburg d147843c76 feat(blog): add file-based blog with dynamic slugs, MDX content and layout shell
- Introduced blog routing using Next.js App Router
- Implemented dynamic [slug] pages for blog posts
- Added MDX-based content loading via lib/posts
- Integrated shared TopBar layout with navigation
- Established clear content, lib and component separation
2026-01-22 14:14:15 +01:00

155 lines
14 KiB
JavaScript
Executable File

#!/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");
const _nexttest = require("../cli/next-test.js");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
if (process.env.NEXT_RSPACK) {
// silent rspack's schema check
process.env.RSPACK_CONFIG_VALIDATE = 'loose-silent';
}
if (!_semver.default.satisfies(process.versions.node, ">=20.9.0", {
includePrerelease: true
})) {
console.error(`You are using Node.js ${process.versions.node}. For Next.js, Node.js version "${">=20.9.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 NextRootCommand extends _commander.Command {
createCommand(name) {
const command = new _commander.Command(name);
command.hook('preAction', (event)=>{
const commandName = event.name();
const defaultEnv = commandName === '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(commandName)) {
(0, _log.warn)(_constants.NON_STANDARD_NODE_ENV);
}
}
;
process.env.NODE_ENV = process.env.NODE_ENV || defaultEnv;
process.env.NEXT_RUNTIME = 'nodejs';
if (commandName !== 'dev' && event.getOptionValue('inspect') === true) {
console.error(`\`--inspect\` flag is deprecated. Use env variable NODE_OPTIONS instead: NODE_OPTIONS='--inspect' next ${commandName}`);
process.exit(1);
}
});
return command;
}
}
function parseValidInspectAddress(value) {
const address = (0, _utils.getParsedDebugAddress)(value);
if (Number.isNaN(address.port)) {
throw new _commander.InvalidArgumentError('The given value is not a valid inspect address. ' + 'Did you mean to pass an app path?\n' + `Try switching the order of the arguments or set the default address explicitly e.g.\n` + `next dev ${value} --inspect\n` + `next dev --inspect= ${value}`);
}
return address;
}
const program = new NextRootCommand();
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${"16.1.4"}`, '-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('--experimental-analyze', 'Analyze bundle output. Only compatible with Turbopack.').option('-d, --debug', 'Enables a more verbose build output.').option('--debug-prerender', 'Enables debug mode for prerendering. Not for production use!').option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('--experimental-app-only', 'Builds only App Router routes.').option('--turbo', 'Builds using Turbopack.').option('--turbopack', 'Builds using Turbopack.').option('--webpack', 'Builds using webpack.').addOption(new _commander.Option('--experimental-build-mode [mode]', 'Uses an experimental build mode.').choices([
'compile',
'generate',
'generate-env'
]).default('default')).option('--experimental-debug-memory-usage', 'Enables memory profiling features to debug memory consumption.').option('--experimental-upload-trace, <traceUrl>', 'Reports a subset of the debugging trace to a remote HTTP URL. Includes sensitive data.').option('--experimental-next-config-strip-types', 'Use Node.js native TypeScript resolution for next.config.(ts|mts)').option('--debug-build-paths <patterns>', 'Comma-separated glob patterns or explicit paths for selective builds. Examples: "app/*", "app/page.tsx", "app/**/page.tsx"').action((directory, options)=>{
if (options.experimentalNextConfigStripTypes) {
process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'true';
}
// ensure process exits after build completes so open handles/connections
// don't cause process to hang
return import('../cli/next-build.js').then((mod)=>mod.nextBuild(options, directory).then(()=>process.exit(0)));
}).usage('[directory] [options]');
program.command('experimental-analyze').description('Analyze production bundle output with an interactive web ui. Does not produce an application build. Only compatible with Turbopack.').argument('[directory]', `A directory on which to analyze the application. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).option('--no-mangling', 'Disables mangling.').option('--profile', 'Enables production profiling for React.').option('-o, --output', 'Only write analysis files to disk. Does not start the server.').addOption(new _commander.Option('--port <port>', 'Specify a port number to serve the analyzer on.').implies({
serve: true
}).argParser(_utils.parseValidPositiveInteger).default(4000).env('PORT')).action((directory, options)=>{
return import('../cli/next-analyze.js').then((mod)=>mod.nextAnalyze(options, directory)).then(()=>{
if (options.output) {
// The Next.js process is held open by something on the event loop. Exit manually like the `build` command does.
// TODO: Fix the underlying issue so this is not necessary.
process.exit(0);
}
});
});
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.')}`).addOption(new _commander.Option('--inspect [[host:]port]', 'Allows inspecting server-side code. See https://nextjs.org/docs/app/guides/debugging#server-side-code').argParser(parseValidInspectAddress)).option('--turbo', 'Starts development mode using Turbopack.').option('--turbopack', 'Starts development mode using Turbopack.').option('--webpack', 'Starts development mode using webpack.').addOption(new _commander.Option('-p, --port <port>', 'Specify a port number on which to start the application.').argParser(_utils.parseValidPositiveInteger).default(3000).env('PORT')).option('-H, --hostname <hostname>', 'Specify a hostname on which to start the application (default: 0.0.0.0).').option('--disable-source-maps', "Don't start the Dev server with `--enable-source-maps`.", false).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.').option('--experimental-next-config-strip-types', 'Use Node.js native TypeScript resolution for next.config.(ts|mts)').action((directory, options, { _optionValueSources })=>{
if (options.experimentalNextConfigStripTypes) {
process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'true';
}
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('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.parseValidPositiveInteger).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.parseValidPositiveInteger)).option('--experimental-next-config-strip-types', 'Use Node.js native TypeScript resolution for next.config.(ts|mts)').action((directory, options)=>{
if (options.experimentalNextConfigStripTypes) {
process.env.__NEXT_NODE_NATIVE_TS_LOADER_ENABLED = 'true';
}
return 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)));
program.command('typegen').description('Generate TypeScript definitions for routes, pages, and layouts without running a full build.').argument('[directory]', `A directory on which to generate types. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).action((directory, options)=>// ensure process exits after typegen completes so open handles/connections
// don't cause process to hang
import('../cli/next-typegen.js').then((mod)=>mod.nextTypegen(options, directory).then(()=>process.exit(0)))).usage('[directory] [options]');
const nextVersion = "16.1.4" || 'unknown';
program.command('upgrade').description('Upgrade Next.js apps to desired versions with a single command.').argument('[directory]', `A Next.js project directory to upgrade. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).usage('[directory] [options]').option('--revision <revision>', 'Specify the target Next.js version using an NPM dist tag (e.g. "latest", "canary", "rc", "beta") or an exact version number (e.g. "15.0.0").', nextVersion.includes('-canary.') ? 'canary' : nextVersion.includes('-rc.') ? 'rc' : nextVersion.includes('-beta.') ? 'beta' : 'latest').option('--verbose', 'Verbose output', false).action(async (directory, options)=>{
const mod = await import('../cli/next-upgrade.js');
mod.spawnNextUpgrade(directory, options);
});
program.command('experimental-test').description(`Execute \`next/experimental/testmode\` tests using a specified test runner. The test runner defaults to 'playwright' if the \`experimental.defaultTestRunner\` configuration option or the \`--test-runner\` option are not set.`).argument('[directory]', `A Next.js project directory to execute the test runner on. ${(0, _picocolors.italic)('If no directory is provided, the current directory will be used.')}`).argument('[test-runner-args...]', 'Any additional arguments or options to pass down to the test runner `test` command.').option('--test-runner [test-runner]', `Any supported test runner. Options: ${(0, _picocolors.bold)(_nexttest.SUPPORTED_TEST_RUNNERS_LIST.join(', '))}. ${(0, _picocolors.italic)("If no test runner is provided, the Next.js config option `experimental.defaultTestRunner`, or 'playwright' will be used.")}`).allowUnknownOption().action((directory, testRunnerArgs, options)=>{
return import('../cli/next-test.js').then((mod)=>{
mod.nextTest(directory, testRunnerArgs, options);
});
}).usage('[directory] [options]');
const internal = program.command('internal').description('Internal debugging commands. Use with caution. Not covered by semver.');
internal.command('trace').alias('turbo-trace-server').argument('file', 'Trace file to serve.').addOption(new _commander.Option('-p, --port <port>', 'Override the port.').argParser(_utils.parseValidPositiveInteger)).action((file, options)=>{
return import('../cli/internal/turbo-trace-server.js').then((mod)=>mod.startTurboTraceServerCli(file, options.port));
});
program.parse(process.argv);
//# sourceMappingURL=next.map