create project

This commit is contained in:
ismailsosic
2022-12-27 12:05:56 +01:00
parent 2a33a2d3de
commit cd2143287c
16035 changed files with 2489703 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env node
import { cliCommand } from '../lib/commands';
declare const nextBuild: cliCommand;
export { nextBuild };

124
kitabcitab/node_modules/next/dist/cli/next-build.js generated vendored Normal file
View File

@@ -0,0 +1,124 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nextBuild = void 0;
var _fs = require("fs");
var _indexJs = _interopRequireDefault(require("next/dist/compiled/arg/index.js"));
var Log = _interopRequireWildcard(require("../build/output/log"));
var _build = _interopRequireDefault(require("../build"));
var _utils = require("../server/lib/utils");
var _isError = _interopRequireDefault(require("../lib/is-error"));
var _getProjectDir = require("../lib/get-project-dir");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (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 nextBuild = (argv)=>{
const validArgs = {
// Types
"--help": Boolean,
"--profile": Boolean,
"--debug": Boolean,
"--no-lint": Boolean,
"--no-mangling": Boolean,
// Aliases
"-h": "--help",
"-d": "--debug"
};
let args;
try {
args = (0, _indexJs).default(validArgs, {
argv
});
} catch (error) {
if ((0, _isError).default(error) && error.code === "ARG_UNKNOWN_OPTION") {
return (0, _utils).printAndExit(error.message, 1);
}
throw error;
}
if (args["--help"]) {
(0, _utils).printAndExit(`
Description
Compiles the application for production deployment
Usage
$ next build <dir>
<dir> represents the directory of the Next.js application.
If no directory is provided, the current directory will be used.
Options
--profile Can be used to enable React Production Profiling
--no-lint Disable linting
--no-mangling Disable mangling
`, 0);
}
if (args["--profile"]) {
Log.warn("Profiling is enabled. Note: This may affect performance");
}
if (args["--no-lint"]) {
Log.warn("Linting is disabled");
}
if (args["--no-mangling"]) {
Log.warn("Mangling is disabled. Note: This may affect performance and should only be used for debugging purposes");
}
const dir = (0, _getProjectDir).getProjectDir(args._[0]);
// Check if the provided directory exists
if (!(0, _fs).existsSync(dir)) {
(0, _utils).printAndExit(`> No such directory exists as the project root: ${dir}`);
}
return (0, _build).default(dir, null, args["--profile"], args["--debug"], !args["--no-lint"], args["--no-mangling"]).catch((err)=>{
console.error("");
if ((0, _isError).default(err) && (err.code === "INVALID_RESOLVE_ALIAS" || err.code === "WEBPACK_ERRORS" || err.code === "BUILD_OPTIMIZATION_FAILED" || err.code === "EDGE_RUNTIME_UNSUPPORTED_API")) {
(0, _utils).printAndExit(`> ${err.message}`);
} else {
console.error("> Build error occurred");
(0, _utils).printAndExit(err);
}
});
};
exports.nextBuild = nextBuild;
//# sourceMappingURL=next-build.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../cli/next-build.ts"],"names":["Log","nextBuild","argv","validArgs","Boolean","args","arg","error","isError","code","printAndExit","message","warn","dir","getProjectDir","_","existsSync","build","catch","err","console"],"mappings":"AAAA;;;;;;AAC2B,IAAA,GAAI,WAAJ,IAAI,CAAA;AACf,IAAA,QAAiC,kCAAjC,iCAAiC,EAAA;AACrCA,IAAAA,GAAG,mCAAM,qBAAqB,EAA3B;AAEG,IAAA,MAAU,kCAAV,UAAU,EAAA;AACC,IAAA,MAA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normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env node
import { cliCommand } from '../lib/commands';
declare const nextDev: cliCommand;
export { nextDev };

368
kitabcitab/node_modules/next/dist/cli/next-dev.js generated vendored Normal file
View File

@@ -0,0 +1,368 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nextDev = void 0;
var _indexJs = _interopRequireDefault(require("next/dist/compiled/arg/index.js"));
var _fs = require("fs");
var _startServer = require("../server/lib/start-server");
var _utils = require("../server/lib/utils");
var Log = _interopRequireWildcard(require("../build/output/log"));
var _output = require("../build/output");
var _isError = _interopRequireDefault(require("../lib/is-error"));
var _getProjectDir = require("../lib/get-project-dir");
var _constants = require("../shared/lib/constants");
var _path = _interopRequireDefault(require("path"));
var _shared = require("../trace/shared");
var _cluster = _interopRequireDefault(require("cluster"));
var _storage = require("../telemetry/storage");
var _config = _interopRequireDefault(require("../server/config"));
var _findPagesDir = require("../lib/find-pages-dir");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (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;
}
let isTurboSession = false;
let sessionStopHandled = false;
let sessionStarted = Date.now();
let dir;
const handleSessionStop = async ()=>{
if (sessionStopHandled) return;
sessionStopHandled = true;
try {
const { eventCliSession } = require("../telemetry/events/session-stopped");
const config = await (0, _config).default(_constants.PHASE_DEVELOPMENT_SERVER, dir);
let telemetry = _shared.traceGlobals.get("telemetry") || new _storage.Telemetry({
distDir: _path.default.join(dir, config.distDir)
});
let appDir = !!_shared.traceGlobals.get("pagesDir");
let pagesDir = !!_shared.traceGlobals.get("appDir");
if (typeof _shared.traceGlobals.get("pagesDir") === "undefined" || typeof _shared.traceGlobals.get("appDir") === "undefined") {
const pagesResult = await (0, _findPagesDir).findPagesDir(dir, !!config.experimental.appDir);
appDir = !!pagesResult.appDir;
pagesDir = !!pagesResult.pagesDir;
}
telemetry.record(eventCliSession({
cliCommand: "dev",
turboFlag: isTurboSession,
durationMilliseconds: Date.now() - sessionStarted,
pagesDir,
appDir
}));
await telemetry.flush();
} catch (err) {
console.error(err);
}
process.exit(0);
};
process.on("SIGINT", handleSessionStop);
process.on("SIGTERM", handleSessionStop);
const nextDev = async (argv)=>{
const validArgs = {
// Types
"--help": Boolean,
"--port": Number,
"--hostname": String,
"--turbo": Boolean,
// To align current messages with native binary.
// Will need to adjust subcommand later.
"--show-all": Boolean,
"--root": String,
// Aliases
"-h": "--help",
"-p": "--port",
"-H": "--hostname"
};
let args;
try {
args = (0, _indexJs).default(validArgs, {
argv
});
} catch (error) {
if ((0, _isError).default(error) && error.code === "ARG_UNKNOWN_OPTION") {
return (0, _utils).printAndExit(error.message, 1);
}
throw error;
}
if (args["--help"]) {
console.log(`
Description
Starts the application in development mode (hot-code reloading, error
reporting, etc.)
Usage
$ next dev <dir> -p <port number>
<dir> represents the directory of the Next.js application.
If no directory is provided, the current directory will be used.
Options
--port, -p A port number on which to start the application
--hostname, -H Hostname on which to start the application (default: 0.0.0.0)
--help, -h Displays this message
`);
process.exit(0);
}
dir = (0, _getProjectDir).getProjectDir(args._[0]);
// Check if pages dir exists and warn if not
if (!(0, _fs).existsSync(dir)) {
(0, _utils).printAndExit(`> No such directory exists as the project root: ${dir}`);
}
async function preflight() {
const { getPackageVersion } = await Promise.resolve(require("../lib/get-package-version"));
const [sassVersion, nodeSassVersion] = await Promise.all([
getPackageVersion({
cwd: dir,
name: "sass"
}),
getPackageVersion({
cwd: dir,
name: "node-sass"
}),
]);
if (sassVersion && nodeSassVersion) {
Log.warn("Your project has both `sass` and `node-sass` installed as dependencies, but should only use one or the other. " + "Please remove the `node-sass` dependency from your project. " + " Read more: https://nextjs.org/docs/messages/duplicate-sass");
}
}
const port = (0, _utils).getPort(args);
// If neither --port nor PORT were specified, it's okay to retry new ports.
const allowRetry = args["--port"] === undefined && process.env.PORT === undefined;
// We do not set a default host value here to prevent breaking
// some set-ups that rely on listening on other interfaces
const host = args["--hostname"];
const devServerOptions = {
allowRetry,
dev: true,
dir,
hostname: host,
isNextDevCommand: true,
port
};
// check for babelrc, swc plugins
async function validateNextConfig(isCustomTurbopack) {
const { getPkgManager } = require("../lib/helpers/get-pkg-manager");
const { getBabelConfigFile } = require("../build/webpack-config");
const { defaultConfig } = require("../server/config-shared");
const chalk = require("next/dist/compiled/chalk");
const { interopDefault } = require("../lib/interop-default");
// To regenerate the TURBOPACK gradient require('gradient-string')('blue', 'red')('>>> TURBOPACK')
const isTTY = process.stdout.isTTY;
const turbopackGradient = `${chalk.bold(isTTY ? "\x1b[38;2;0;0;255m>\x1b[39m\x1b[38;2;23;0;232m>\x1b[39m\x1b[38;2;46;0;209m>\x1b[39m \x1b[38;2;70;0;185mT\x1b[39m\x1b[38;2;93;0;162mU\x1b[39m\x1b[38;2;116;0;139mR\x1b[39m\x1b[38;2;139;0;116mB\x1b[39m\x1b[38;2;162;0;93mO\x1b[39m\x1b[38;2;185;0;70mP\x1b[39m\x1b[38;2;209;0;46mA\x1b[39m\x1b[38;2;232;0;23mC\x1b[39m\x1b[38;2;255;0;0mK\x1b[39m" : ">>> TURBOPACK")} ${chalk.dim("(alpha)")}\n\n`;
let thankYouMsg = `Thank you for trying Next.js v13 with Turbopack! As a reminder,\nTurbopack is currently in alpha and not yet ready for production.\nWe appreciate your ongoing support as we work to make it ready\nfor everyone.\n`;
let unsupportedParts = "";
let babelrc = await getBabelConfigFile(dir);
if (babelrc) babelrc = _path.default.basename(babelrc);
let hasNonDefaultConfig;
let rawNextConfig = {};
try {
rawNextConfig = interopDefault(await (0, _config).default(_constants.PHASE_DEVELOPMENT_SERVER, dir, undefined, true));
if (typeof rawNextConfig === "function") {
rawNextConfig = rawNextConfig(_constants.PHASE_DEVELOPMENT_SERVER, {
defaultConfig
});
}
const checkUnsupportedCustomConfig = (configKey = "", parentUserConfig, parentDefaultConfig)=>{
try {
// these should not error
if (configKey === "serverComponentsExternalPackages" || configKey === "appDir" || configKey === "images" || configKey === "reactStrictMode" || configKey === "swcMinify" || configKey === "configFileName") {
return false;
}
let userValue = parentUserConfig == null ? void 0 : parentUserConfig[configKey];
let defaultValue = parentDefaultConfig == null ? void 0 : parentDefaultConfig[configKey];
if (typeof defaultValue !== "object") {
return defaultValue !== userValue;
}
return Object.keys(userValue || {}).some((key)=>{
return checkUnsupportedCustomConfig(key, userValue, defaultValue);
});
} catch (e) {
console.error(`Unexpected error occurred while checking ${configKey}`, e);
return false;
}
};
hasNonDefaultConfig = Object.keys(rawNextConfig).some((key)=>checkUnsupportedCustomConfig(key, rawNextConfig, defaultConfig));
} catch (e) {
console.error("Unexpected error occurred while checking config", e);
}
const hasWarningOrError = babelrc || hasNonDefaultConfig;
if (!hasWarningOrError) {
thankYouMsg = chalk.dim(thankYouMsg);
}
console.log(turbopackGradient + thankYouMsg);
let feedbackMessage = `Learn more about Next.js v13 and Turbopack: ${chalk.underline("https://nextjs.link/with-turbopack")}\nPlease direct feedback to: ${chalk.underline("https://nextjs.link/turbopack-feedback")}\n`;
if (!hasWarningOrError) {
feedbackMessage = chalk.dim(feedbackMessage);
}
if (babelrc) {
unsupportedParts += `\n- Babel detected (${chalk.cyan(babelrc)})\n ${chalk.dim(`Babel is not yet supported. To use Turbopack at the moment,\n you'll need to remove your usage of Babel.`)}`;
}
if (hasNonDefaultConfig) {
unsupportedParts += `\n\n- Unsupported Next.js configuration option(s) (${chalk.cyan("next.config.js")})\n ${chalk.dim(`The only configurations options supported are:\n${[
"reactStrictMode",
"experimental.appDir",
"experimental.serverComponentsExternalPackages",
"images",
"swcMinify",
"configFileName",
].map((name)=>` - ${chalk.cyan(name)}\n`).join("")} To use Turbopack, remove other configuration options.`)} `;
}
if (unsupportedParts) {
const pkgManager = getPkgManager(dir);
console.error(`${chalk.bold.red("Error:")} You are using configuration and/or tools that are not yet\nsupported by Next.js v13 with Turbopack:\n${unsupportedParts}\n
If you cannot make the changes above, but still want to try out\nNext.js v13 with Turbopack, create the Next.js v13 playground app\nby running the following commands:
${chalk.bold.cyan(`${pkgManager === "npm" ? "npx create-next-app" : `${pkgManager} create next-app`} --example with-turbopack with-turbopack-app`)}\n cd with-turbopack-app\n ${pkgManager} run dev
`);
console.warn(feedbackMessage);
if (!isCustomTurbopack) {
process.exit(1);
} else {
console.warn(`\n${chalk.bold.yellow("Warning:")} Unsupported config found; but continuing with custom Turbopack binary.\n`);
}
}
console.log(feedbackMessage);
return rawNextConfig;
}
if (args["--turbo"]) {
var ref;
isTurboSession = true;
const { loadBindings , __isCustomTurbopackBinary } = require("../build/swc");
const { eventCliSession } = require("../telemetry/events/version");
const { setGlobal } = require("../trace");
require("../telemetry/storage");
const findUp = require("next/dist/compiled/find-up");
const isCustomTurbopack = await __isCustomTurbopackBinary();
const rawNextConfig = await validateNextConfig(isCustomTurbopack);
const distDir = _path.default.join(dir, rawNextConfig.distDir || ".next");
const { pagesDir , appDir } = (0, _findPagesDir).findPagesDir(dir, !!((ref = rawNextConfig.experimental) == null ? void 0 : ref.appDir));
const telemetry = new _storage.Telemetry({
distDir
});
setGlobal("appDir", appDir);
setGlobal("pagesDir", pagesDir);
setGlobal("telemetry", telemetry);
if (!isCustomTurbopack) {
telemetry.record(eventCliSession(distDir, rawNextConfig, {
webpackVersion: 5,
cliCommand: "dev",
isSrcDir: _path.default.relative(dir, pagesDir || appDir || "").startsWith("src"),
hasNowJson: !!await findUp("now.json", {
cwd: dir
}),
isCustomServer: false,
turboFlag: true,
pagesDir: !!pagesDir,
appDir: !!appDir
}));
}
const turboJson = findUp.sync("turbo.json", {
cwd: dir
});
// eslint-disable-next-line no-shadow
const packagePath = findUp.sync("package.json", {
cwd: dir
});
let bindings = await loadBindings();
let server = bindings.turbo.startDev({
...devServerOptions,
showAll: args["--show-all"] ?? false,
root: args["--root"] ?? (turboJson ? _path.default.dirname(turboJson) : packagePath ? _path.default.dirname(packagePath) : undefined)
});
// Start preflight after server is listening and ignore errors:
preflight().catch(()=>{});
await telemetry.flush();
return server;
} else {
// we're using a sub worker to avoid memory leaks. When memory usage exceeds 90%, we kill the worker and restart it.
// this is a temporary solution until we can fix the memory leaks.
// the logic for the worker killing itself is in `packages/next/server/lib/start-server.ts`
if (!process.env.__NEXT_DISABLE_MEMORY_WATCHER && _cluster.default.isMaster) {
_cluster.default.fork();
_cluster.default.on("exit", (worker)=>{
if (worker.exitedAfterDisconnect) {
_cluster.default.fork();
} else {
process.exit(1);
}
});
} else {
(0, _startServer).startServer(devServerOptions).then(async (app)=>{
const appUrl = `http://${app.hostname}:${app.port}`;
(0, _output).startedDevelopmentServer(appUrl, `${host || "0.0.0.0"}:${app.port}`);
// Start preflight after server is listening and ignore errors:
preflight().catch(()=>{});
// Finalize server bootup:
await app.prepare();
}).catch((err)=>{
if (err.code === "EADDRINUSE") {
let errorMessage = `Port ${port} is already in use.`;
const pkgAppPath = require("next/dist/compiled/find-up").sync("package.json", {
cwd: dir
});
const appPackage = require(pkgAppPath);
if (appPackage.scripts) {
const nextScript = Object.entries(appPackage.scripts).find((scriptLine)=>scriptLine[1] === "next");
if (nextScript) {
errorMessage += `\nUse \`npm run ${nextScript[0]} -- -p <some other port>\`.`;
}
}
console.error(errorMessage);
} else {
console.error(err);
}
process.nextTick(()=>process.exit(1));
});
}
}
for (const CONFIG_FILE of _constants.CONFIG_FILES){
(0, _fs).watchFile(_path.default.join(dir, CONFIG_FILE), (cur, prev)=>{
if (cur.size > 0 || prev.size > 0) {
console.log(`\n> Found a change in ${CONFIG_FILE}. Restart the server to see the changes in effect.`);
}
});
}
};
exports.nextDev = nextDev;
//# sourceMappingURL=next-dev.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env node
import { cliCommand } from '../lib/commands';
declare const nextExport: cliCommand;
export { nextExport };

82
kitabcitab/node_modules/next/dist/cli/next-export.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nextExport = void 0;
var _path = require("path");
var _fs = require("fs");
var _indexJs = _interopRequireDefault(require("next/dist/compiled/arg/index.js"));
var _export = _interopRequireDefault(require("../export"));
var _utils = require("../server/lib/utils");
var _trace = require("../trace");
var _isError = _interopRequireDefault(require("../lib/is-error"));
var _getProjectDir = require("../lib/get-project-dir");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const nextExport = (argv)=>{
const nextExportCliSpan = (0, _trace).trace("next-export-cli");
const validArgs = {
// Types
"--help": Boolean,
"--silent": Boolean,
"--outdir": String,
"--threads": Number,
// Aliases
"-h": "--help",
"-s": "--silent",
"-o": "--outdir"
};
let args;
try {
args = (0, _indexJs).default(validArgs, {
argv
});
} catch (error) {
if ((0, _isError).default(error) && error.code === "ARG_UNKNOWN_OPTION") {
return (0, _utils).printAndExit(error.message, 1);
}
throw error;
}
if (args["--help"]) {
console.log(`
Description
Exports the application for production deployment
Usage
$ next export [options] <dir>
<dir> represents the directory of the Next.js application.
If no directory is provided, the current directory will be used.
Options
-h - list this help
-o - set the output dir (defaults to 'out')
-s - do not print any messages to console
`);
process.exit(0);
}
const dir = (0, _getProjectDir).getProjectDir(args._[0]);
// Check if pages dir exists and warn if not
if (!(0, _fs).existsSync(dir)) {
(0, _utils).printAndExit(`> No such directory exists as the project root: ${dir}`);
}
const options = {
silent: args["--silent"] || false,
threads: args["--threads"],
outdir: args["--outdir"] ? (0, _path).resolve(args["--outdir"]) : (0, _path).join(dir, "out")
};
(0, _export).default(dir, options, nextExportCliSpan).then(()=>{
nextExportCliSpan.stop();
(0, _utils).printAndExit(`Export successful. Files written to ${options.outdir}`, 0);
}).catch((err)=>{
nextExportCliSpan.stop();
(0, _utils).printAndExit(err);
});
};
exports.nextExport = nextExport;
//# sourceMappingURL=next-export.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../cli/next-export.ts"],"names":["nextExport","argv","nextExportCliSpan","trace","validArgs","Boolean","String","Number","args","arg","error","isError","code","printAndExit","message","console","log","process","exit","dir","getProjectDir","_","existsSync","options","silent","threads","outdir","resolve","join","exportApp","then","stop","catch","err"],"mappings":"AAAA;;;;;;AAC8B,IAAA,KAAM,WAAN,MAAM,CAAA;AACT,IAAA,GAAI,WAAJ,IAAI,CAAA;AACf,IAAA,QAAiC,kCAAjC,iCAAiC,EAAA;AAC3B,IAAA,OAAW,kCAAX,WAAW,EAAA;AACJ,IAAA,MAAqB,WAArB,qBAAqB,CAAA;AAE5B,IAAA,MAAU,WAAV,UAAU,CAAA;AACZ,IAAA,QAAiB,kCAAjB,iBAAiB,EAAA;AACP,IAAA,cAAwB,WAAxB,wBAAwB,CAAA;;;;;;AAEtD,MAAMA,UAAU,GAAe,CAACC,IAAI,GAAK;IACvC,MAAMC,iBAAiB,GAAGC,CAAAA,GAAAA,MAAK,AAAmB,CAAA,MAAnB,CAAC,iBAAiB,CAAC;IAClD,MAAMC,SAAS,GAAa;QAC1B,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,UAAU,EAAEA,OAAO;QACnB,UAAU,EAAEC,MAAM;QAClB,WAAW,EAAEC,MAAM;QAEnB,UAAU;QACV,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU;KACjB;IACD,IAAIC,IAAI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;IAEDU,CAAAA,GAAAA,OAAS,AAAiC,CAAA,QAAjC,CAACV,GAAG,EAAEI,OAAO,EAAErB,iBAAiB,CAAC,CACvC4B,IAAI,CAAC,IAAM;QACV5B,iBAAiB,CAAC6B,IAAI,EAAE;QACxBlB,CAAAA,GAAAA,MAAY,AAA4D,CAAA,aAA5D,CAAC,CAAC,oCAAoC,EAAEU,OAAO,CAACG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;KACzE,CAAC,CACDM,KAAK,CAAC,CAACC,GAAG,GAAK;QACd/B,iBAAiB,CAAC6B,IAAI,EAAE;QACxBlB,CAAAA,GAAAA,MAAY,AAAK,CAAA,aAAL,CAACoB,GAAG,CAAC;KAClB,CAAC;CACL;QAEQjC,UAAU,GAAVA,UAAU"}

4
kitabcitab/node_modules/next/dist/cli/next-info.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env node
import { cliCommand } from '../lib/commands';
declare const nextInfo: cliCommand;
export { nextInfo };

99
kitabcitab/node_modules/next/dist/cli/next-info.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nextInfo = void 0;
var _os = _interopRequireDefault(require("os"));
var _childProcess = _interopRequireDefault(require("child_process"));
var _chalk = _interopRequireDefault(require("next/dist/compiled/chalk"));
var _indexJs = _interopRequireDefault(require("next/dist/compiled/arg/index.js"));
var _nodeFetch = _interopRequireDefault(require("next/dist/compiled/node-fetch"));
var _utils = require("../server/lib/utils");
var _isError = _interopRequireDefault(require("../lib/is-error"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function getPackageVersion(packageName) {
try {
return require(`${packageName}/package.json`).version;
} catch {
return "N/A";
}
}
function getBinaryVersion(binaryName) {
try {
return _childProcess.default.execFileSync(binaryName, [
"--version"
]).toString().trim();
} catch {
return "N/A";
}
}
const nextInfo = async (argv)=>{
const validArgs = {
// Types
"--help": Boolean,
// Aliases
"-h": "--help"
};
let args;
try {
args = (0, _indexJs).default(validArgs, {
argv
});
} catch (error) {
if ((0, _isError).default(error) && error.code === "ARG_UNKNOWN_OPTION") {
return (0, _utils).printAndExit(error.message, 1);
}
throw error;
}
if (args["--help"]) {
console.log(`
Description
Prints relevant details about the current system which can be used to report Next.js bugs
Usage
$ next info
Learn more: ${_chalk.default.cyan("https://nextjs.org/docs/api-reference/cli#info")}`);
return;
}
const installedRelease = getPackageVersion("next");
console.log(`
Operating System:
Platform: ${_os.default.platform()}
Arch: ${_os.default.arch()}
Version: ${_os.default.version()}
Binaries:
Node: ${process.versions.node}
npm: ${getBinaryVersion("npm")}
Yarn: ${getBinaryVersion("yarn")}
pnpm: ${getBinaryVersion("pnpm")}
Relevant packages:
next: ${installedRelease}
eslint-config-next: ${getPackageVersion("eslint-config-next")}
react: ${getPackageVersion("react")}
react-dom: ${getPackageVersion("react-dom")}
`);
try {
const res = await (0, _nodeFetch).default("https://api.github.com/repos/vercel/next.js/releases");
const releases = await res.json();
const newestRelease = releases[0].tag_name.replace(/^v/, "");
if (installedRelease !== newestRelease) {
console.warn(`${_chalk.default.yellow(_chalk.default.bold("warn"))} - Latest canary version not detected, detected: "${installedRelease}", newest: "${newestRelease}".
Please try the latest canary version (\`npm install next@canary\`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue`);
}
} catch (e) {
console.warn(`${_chalk.default.yellow(_chalk.default.bold("warn"))} - Failed to fetch latest canary version. (Reason: ${e.message}.)
Detected "${installedRelease}". Visit https://github.com/vercel/next.js/releases.
Make sure to try the latest canary version (eg.: \`npm install next@canary\`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue`);
}
};
exports.nextInfo = nextInfo;
//# sourceMappingURL=next-info.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../cli/next-info.ts"],"names":["getPackageVersion","packageName","require","version","getBinaryVersion","binaryName","childProcess","execFileSync","toString","trim","nextInfo","argv","validArgs","Boolean","args","arg","error","isError","code","printAndExit","message","console","log","chalk","cyan","installedRelease","os","platform","arch","process","versions","node","res","fetch","releases","json","newestRelease","tag_name","replace","warn","yellow","bold","e"],"mappings":"AAAA;;;;;;AACe,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACM,IAAA,aAAe,kCAAf,eAAe,EAAA;AAEtB,IAAA,MAA0B,kCAA1B,0BAA0B,EAAA;AAC5B,IAAA,QAAiC,kCAAjC,iCAAiC,EAAA;AAC/B,IAAA,UAA+B,kCAA/B,+BAA+B,EAAA;AACpB,IAAA,MAAqB,WAArB,qBAAqB,CAAA;AAE9B,IAAA,QAAiB,kCAAjB,iBAAiB,EAAA;;;;;;AAErC,SAASA,iBAAiB,CAACC,WAAmB,EAAE;IAC9C,IAAI;QACF,OAAOC,OAAO,CAAC,CAAC,EAAED,WAAW,CAAC,aAAa,CAAC,CAAC,CAACE,OAAO,CAAA;KACtD,CAAC,OAAM;QACN,OAAO,KAAK,CAAA;KACb;CACF;AAED,SAASC,gBAAgB,CAACC,UAAkB,EAAE;IAC5C,IAAI;QACF,OAAOC,aAAY,QAAA,CAChBC,YAAY,CAACF,UAAU,EAAE;YAAC,WAAW;SAAC,CAAC,CACvCG,QAAQ,EAAE,CACVC,IAAI,EAAE,CAAA;KACV,CAAC,OAAM;QACN,OAAO,KAAK,CAAA;KACb;CACF;AAED,MAAMC,QAAQ,GAAe,OAAOC,IAAI,GAAK;IAC3C,MAAMC,SAAS,GAAa;QAC1B,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,UAAU;QACV,IAAI,EAAE,QAAQ;KACf;IACD,IAAIC,IAAI,AAAsB;IAC9B,IAAI;QACFA,IAAI,GAAGC,CAAAA,GAAAA,QAAG,AAAqB,CAAA,QAArB,CAACH,SAAS,EAAE;YAAED,IAAI;SAAE,CAAC;KAChC,CAAC,OAAOK,KAAK,EAAE;QACd,IAAIC,CAAAA,GAAAA,QAAO,AAAO,CAAA,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AACG,QAAQ,CAACC,OAAO,OAAO,EAAE,CAAC;QAE5D,IAAIb,gBAAgB,KAAKW,aAAa,EAAE;YACtCf,OAAO,CAACkB,IAAI,CACV,CAAC,EAAEhB,MAAK,QAAA,CAACiB,MAAM,CACbjB,MAAK,QAAA,CAACkB,IAAI,CAAC,MAAM,CAAC,CACnB,CAAC,mDAAmD,EAAEhB,gBAAgB,CAAC,YAAY,EAAEW,aAAa,CAAC;;qEAEvC,CAAC,CAC/D;SACF;KACF,CAAC,OAAOM,CAAC,EAAE;QACVrB,OAAO,CAACkB,IAAI,CACV,CAAC,EAAEhB,MAAK,QAAA,CAACiB,MAAM,CACbjB,MAAK,QAAA,CAACkB,IAAI,CAAC,MAAM,CAAC,CACnB,CAAC,oDAAoD,EACpD,AAACC,CAAC,CAAWtB,OAAO,CACrB;gBACS,EAAEK,gBAAgB,CAAC;;mEAEgC,CAAC,CAC/D;KACF;CACF;QAEQf,QAAQ,GAARA,QAAQ"}

4
kitabcitab/node_modules/next/dist/cli/next-lint.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env node
import { cliCommand } from '../lib/commands';
declare const nextLint: cliCommand;
export { nextLint };

231
kitabcitab/node_modules/next/dist/cli/next-lint.js generated vendored Normal file
View File

@@ -0,0 +1,231 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nextLint = void 0;
var _fs = require("fs");
var _indexJs = _interopRequireDefault(require("next/dist/compiled/arg/index.js"));
var _path = require("path");
var _chalk = _interopRequireDefault(require("next/dist/compiled/chalk"));
var _constants = require("../lib/constants");
var _runLintCheck = require("../lib/eslint/runLintCheck");
var _utils = require("../server/lib/utils");
var _storage = require("../telemetry/storage");
var _config = _interopRequireDefault(require("../server/config"));
var _constants1 = require("../shared/lib/constants");
var _events = require("../telemetry/events");
var _compileError = require("../lib/compile-error");
var _isError = _interopRequireDefault(require("../lib/is-error"));
var _getProjectDir = require("../lib/get-project-dir");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const eslintOptions = (args, defaultCacheLocation)=>({
overrideConfigFile: args["--config"] || null,
extensions: args["--ext"] ?? [
".js",
".mjs",
".cjs",
".jsx",
".ts",
".mts",
".cts",
".tsx",
],
resolvePluginsRelativeTo: args["--resolve-plugins-relative-to"] || null,
rulePaths: args["--rulesdir"] ?? [],
fix: args["--fix"] ?? false,
fixTypes: args["--fix-type"] ?? null,
ignorePath: args["--ignore-path"] || null,
ignore: !Boolean(args["--no-ignore"]),
allowInlineConfig: !Boolean(args["--no-inline-config"]),
reportUnusedDisableDirectives: args["--report-unused-disable-directives"] || null,
cache: !Boolean(args["--no-cache"]),
cacheLocation: args["--cache-location"] || defaultCacheLocation,
cacheStrategy: args["--cache-strategy"] || "metadata",
errorOnUnmatchedPattern: args["--error-on-unmatched-pattern"] ? Boolean(args["--error-on-unmatched-pattern"]) : false
});
const nextLint = async (argv)=>{
var ref;
const validArgs = {
// Types
"--help": Boolean,
"--base-dir": String,
"--dir": [
String
],
"--file": [
String
],
"--strict": Boolean,
// Aliases
"-h": "--help",
"-b": "--base-dir",
"-d": "--dir"
};
const validEslintArgs = {
// Types
"--config": String,
"--ext": [
String
],
"--resolve-plugins-relative-to": String,
"--rulesdir": [
String
],
"--fix": Boolean,
"--fix-type": [
String
],
"--ignore-path": String,
"--no-ignore": Boolean,
"--quiet": Boolean,
"--max-warnings": Number,
"--no-inline-config": Boolean,
"--report-unused-disable-directives": String,
"--cache": Boolean,
"--no-cache": Boolean,
"--cache-location": String,
"--cache-strategy": String,
"--error-on-unmatched-pattern": Boolean,
"--format": String,
"--output-file": String,
// Aliases
"-c": "--config",
"-f": "--format",
"-o": "--output-file"
};
let args;
try {
args = (0, _indexJs).default({
...validArgs,
...validEslintArgs
}, {
argv
});
} catch (error) {
if ((0, _isError).default(error) && error.code === "ARG_UNKNOWN_OPTION") {
return (0, _utils).printAndExit(error.message, 1);
}
throw error;
}
if (args["--help"]) {
(0, _utils).printAndExit(`
Description
Run ESLint on every file in specified directories.
If not configured, ESLint will be set up for the first time.
Usage
$ next lint <baseDir> [options]
<baseDir> represents the directory of the Next.js application.
If no directory is provided, the current directory will be used.
Options
Basic configuration:
-h, --help List this help
-d, --dir Array Include directory, or directories, to run ESLint - default: 'pages', 'components', and 'lib'
--file Array Include file, or files, to run ESLint
-c, --config path::String Use this configuration file, overriding all other config options
--ext [String] Specify JavaScript file extensions - default: .js, .mjs, .cjs, .jsx, .ts, .mts, .cts, .tsx
--resolve-plugins-relative-to path::String A folder where plugins should be resolved from, CWD by default
Initial setup:
--strict Creates an .eslintrc.json file using the Next.js strict configuration (only possible if no .eslintrc.json file is present)
Specifying rules:
--rulesdir [path::String] Use additional rules from this directory
Fixing problems:
--fix Automatically fix problems
--fix-type Array Specify the types of fixes to apply (problem, suggestion, layout)
Ignoring files:
--ignore-path path::String Specify path of ignore file
--no-ignore Disable use of ignore files and patterns
Handling warnings:
--quiet Report errors only - default: false
--max-warnings Int Number of warnings to trigger nonzero exit code - default: -1
Output:
-o, --output-file path::String Specify file to write report to
-f, --format String Use a specific output format - default: Next.js custom formatter
Inline configuration comments:
--no-inline-config Prevent comments from changing config or rules
--report-unused-disable-directives Adds reported errors for unused eslint-disable directives ("error" | "warn" | "off")
Caching:
--no-cache Disable caching
--cache-location path::String Path to the cache file or directory - default: .eslintcache
--cache-strategy String Strategy to use for detecting changed files in the cache, either metadata or content - default: metadata
Miscellaneous:
--error-on-unmatched-pattern Show errors when any file patterns are unmatched - default: false
`, 0);
}
const baseDir = (0, _getProjectDir).getProjectDir(args._[0]);
// Check if the provided directory exists
if (!(0, _fs).existsSync(baseDir)) {
(0, _utils).printAndExit(`> No such directory exists as the project root: ${baseDir}`);
}
const nextConfig = await (0, _config).default(_constants1.PHASE_PRODUCTION_BUILD, baseDir);
const files = args["--file"] ?? [];
const dirs = args["--dir"] ?? ((ref = nextConfig.eslint) == null ? void 0 : ref.dirs);
const filesToLint = [
...dirs ?? [],
...files
];
const pathsToLint = (filesToLint.length ? filesToLint : _constants.ESLINT_DEFAULT_DIRS).reduce((res, d)=>{
const currDir = (0, _path).join(baseDir, d);
if (!(0, _fs).existsSync(currDir)) return res;
res.push(currDir);
return res;
}, []);
const reportErrorsOnly = Boolean(args["--quiet"]);
const maxWarnings = args["--max-warnings"] ?? -1;
const formatter = args["--format"] || null;
const strict = Boolean(args["--strict"]);
const outputFile = args["--output-file"] || null;
const distDir = (0, _path).join(baseDir, nextConfig.distDir);
const defaultCacheLocation = (0, _path).join(distDir, "cache", "eslint/");
const hasAppDir = !!nextConfig.experimental.appDir;
(0, _runLintCheck).runLintCheck(baseDir, pathsToLint, hasAppDir, {
lintDuringBuild: false,
eslintOptions: eslintOptions(args, defaultCacheLocation),
reportErrorsOnly: reportErrorsOnly,
maxWarnings,
formatter,
outputFile,
strict
}).then(async (lintResults)=>{
const lintOutput = typeof lintResults === "string" ? lintResults : lintResults == null ? void 0 : lintResults.output;
if (typeof lintResults !== "string" && (lintResults == null ? void 0 : lintResults.eventInfo)) {
const telemetry = new _storage.Telemetry({
distDir
});
telemetry.record((0, _events).eventLintCheckCompleted({
...lintResults.eventInfo,
buildLint: false
}));
await telemetry.flush();
}
if (typeof lintResults !== "string" && (lintResults == null ? void 0 : lintResults.isError) && lintOutput) {
throw new _compileError.CompileError(lintOutput);
}
if (lintOutput) {
(0, _utils).printAndExit(lintOutput, 0);
} else if (lintResults && !lintOutput) {
(0, _utils).printAndExit(_chalk.default.green("\u2714 No ESLint warnings or errors"), 0);
}
}).catch((err)=>{
(0, _utils).printAndExit(err.message);
});
};
exports.nextLint = nextLint;
//# sourceMappingURL=next-lint.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env node
import { cliCommand } from '../lib/commands';
declare const nextStart: cliCommand;
export { nextStart };

124
kitabcitab/node_modules/next/dist/cli/next-start.js generated vendored Normal file
View File

@@ -0,0 +1,124 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nextStart = void 0;
var _indexJs = _interopRequireDefault(require("next/dist/compiled/arg/index.js"));
var _startServer = require("../server/lib/start-server");
var _utils = require("../server/lib/utils");
var Log = _interopRequireWildcard(require("../build/output/log"));
var _isError = _interopRequireDefault(require("../lib/is-error"));
var _getProjectDir = require("../lib/get-project-dir");
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== "function") return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (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 nextStart = (argv)=>{
const validArgs = {
// Types
"--help": Boolean,
"--port": Number,
"--hostname": String,
"--keepAliveTimeout": Number,
// Aliases
"-h": "--help",
"-p": "--port",
"-H": "--hostname"
};
let args;
try {
args = (0, _indexJs).default(validArgs, {
argv
});
} catch (error) {
if ((0, _isError).default(error) && error.code === "ARG_UNKNOWN_OPTION") {
return (0, _utils).printAndExit(error.message, 1);
}
throw error;
}
if (args["--help"]) {
console.log(`
Description
Starts the application in production mode.
The application should be compiled with \`next build\` first.
Usage
$ next start <dir> -p <port>
<dir> represents the directory of the Next.js application.
If no directory is provided, the current directory will be used.
Options
--port, -p A port number on which to start the application
--hostname, -H Hostname on which to start the application (default: 0.0.0.0)
--keepAliveTimeout Max milliseconds to wait before closing inactive connections
--help, -h Displays this message
`);
process.exit(0);
}
const dir = (0, _getProjectDir).getProjectDir(args._[0]);
const host = args["--hostname"] || "0.0.0.0";
const port = (0, _utils).getPort(args);
const keepAliveTimeoutArg = args["--keepAliveTimeout"];
if (typeof keepAliveTimeoutArg !== "undefined" && (Number.isNaN(keepAliveTimeoutArg) || !Number.isFinite(keepAliveTimeoutArg) || keepAliveTimeoutArg < 0)) {
(0, _utils).printAndExit(`Invalid --keepAliveTimeout, expected a non negative number but received "${keepAliveTimeoutArg}"`, 1);
}
const keepAliveTimeout = keepAliveTimeoutArg ? Math.ceil(keepAliveTimeoutArg) : undefined;
(0, _startServer).startServer({
dir,
hostname: host,
port,
keepAliveTimeout
}).then(async (app)=>{
const appUrl = `http://${app.hostname}:${app.port}`;
Log.ready(`started server on ${host}:${app.port}, url: ${appUrl}`);
await app.prepare();
}).catch((err)=>{
console.error(err);
process.exit(1);
});
};
exports.nextStart = nextStart;
//# sourceMappingURL=next-start.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../cli/next-start.ts"],"names":["Log","nextStart","argv","validArgs","Boolean","Number","String","args","arg","error","isError","code","printAndExit","message","console","log","process","exit","dir","getProjectDir","_","host","port","getPort","keepAliveTimeoutArg","isNaN","isFinite","keepAliveTimeout","Math","ceil","undefined","startServer","hostname","then","app","appUrl","ready","prepare","catch","err"],"mappings":"AAAA;;;;;;AAEgB,IAAA,QAAiC,kCAAjC,iCAAiC,EAAA;AACrB,IAAA,YAA4B,WAA5B,4BAA4B,CAAA;AAClB,IAAA,MAAqB,WAArB,qBAAqB,CAAA;AAC/CA,IAAAA,GAAG,mCAAM,qBAAqB,EAA3B;AACK,IAAA,QAAiB,kCAAjB,iBAAiB,EAAA;AACP,IAAA,cAAwB,WAAxB,wBAAwB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtD,MAAMC,SAAS,GAAe,CAACC,IAAI,GA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AAmB,CAAC,IAChC,CAACnB,MAAM,CAACqB,QAAQ,CAACF,mBAAmB,CAAC,IACrCA,mBAAmB,GAAG,CAAC,CAAC,EAC1B;QACAZ,CAAAA,GAAAA,MAAY,AAGX,CAAA,aAHW,CACV,CAAC,yEAAyE,EAAEY,mBAAmB,CAAC,CAAC,CAAC,EAClG,CAAC,CACF;KACF;IAED,MAAMG,gBAAgB,GAAGH,mBAAmB,GACxCI,IAAI,CAACC,IAAI,CAACL,mBAAmB,CAAC,GAC9BM,SAAS;IAEbC,CAAAA,GAAAA,YAAW,AAKT,CAAA,YALS,CAAC;QACVb,GAAG;QACHc,QAAQ,EAAEX,IAAI;QACdC,IAAI;QACJK,gBAAgB;KACjB,CAAC,CACCM,IAAI,CAAC,OAAOC,GAAG,GAAK;QACnB,MAAMC,MAAM,GAAG,CAAC,OAAO,EAAED,GAAG,CAACF,QAAQ,CAAC,CAAC,EAAEE,GAAG,CAACZ,IAAI,CAAC,CAAC;QACnDtB,GAAG,CAACoC,KAAK,CAAC,CAAC,kBAAkB,EAAEf,IAAI,CAAC,CAAC,EAAEa,GAAG,CAACZ,IAAI,CAAC,OAAO,EAAEa,MAAM,CAAC,CAAC,CAAC;QAClE,MAAMD,GAAG,CAACG,OAAO,EAAE;KACpB,CAAC,CACDC,KAAK,CAAC,CAACC,GAAG,GAAK;QACdzB,OAAO,CAACL,KAAK,CAAC8B,GAAG,CAAC;QAClBvB,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;KAChB,CAAC;CACL;QAEQhB,SAAS,GAATA,SAAS"}

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env node
import { cliCommand } from '../lib/commands';
declare const nextTelemetry: cliCommand;
export { nextTelemetry };

View File

@@ -0,0 +1,86 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nextTelemetry = void 0;
var _chalk = _interopRequireDefault(require("next/dist/compiled/chalk"));
var _indexJs = _interopRequireDefault(require("next/dist/compiled/arg/index.js"));
var _utils = require("../server/lib/utils");
var _storage = require("../telemetry/storage");
var _isError = _interopRequireDefault(require("../lib/is-error"));
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
const nextTelemetry = (argv)=>{
const validArgs = {
// Types
"--help": Boolean,
"--enable": Boolean,
"--disable": Boolean,
// Aliases
"-h": "--help"
};
let args;
try {
args = (0, _indexJs).default(validArgs, {
argv
});
} catch (error) {
if ((0, _isError).default(error) && error.code === "ARG_UNKNOWN_OPTION") {
return (0, _utils).printAndExit(error.message, 1);
}
throw error;
}
if (args["--help"]) {
console.log(`
Description
Allows you to control Next.js' telemetry collection
Usage
$ next telemetry [enable/disable]
You may pass the 'enable' or 'disable' argument to turn Next.js' telemetry collection on or off.
Learn more: ${_chalk.default.cyan("https://nextjs.org/telemetry")}
`);
return;
}
const telemetry = new _storage.Telemetry({
distDir: process.cwd()
});
let isEnabled = telemetry.isEnabled;
if (args["--enable"] || args._[0] === "enable") {
telemetry.setEnabled(true);
console.log(_chalk.default.cyan("Success!"));
console.log();
isEnabled = true;
} else if (args["--disable"] || args._[0] === "disable") {
const path = telemetry.setEnabled(false);
if (isEnabled) {
console.log(_chalk.default.cyan(`Your preference has been saved${path ? ` to ${path}` : ""}.`));
} else {
console.log(_chalk.default.yellow(`Next.js' telemetry collection is already disabled.`));
}
console.log();
isEnabled = false;
} else {
console.log(_chalk.default.bold("Next.js Telemetry"));
console.log();
}
console.log(`Status: ${isEnabled ? _chalk.default.bold.green("Enabled") : _chalk.default.bold.red("Disabled")}`);
console.log();
if (isEnabled) {
console.log(`Next.js telemetry is completely anonymous. Thank you for participating!`);
} else {
console.log(`You have opted-out of Next.js' anonymous telemetry program.`);
console.log(`No data will be collected from your machine.`);
}
console.log(`Learn more: https://nextjs.org/telemetry`);
console.log();
};
exports.nextTelemetry = nextTelemetry;
//# sourceMappingURL=next-telemetry.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../cli/next-telemetry.ts"],"names":["nextTelemetry","argv","validArgs","Boolean","args","arg","error","isError","code","printAndExit","message","console","log","chalk","cyan","telemetry","Telemetry","distDir","process","cwd","isEnabled","_","setEnabled","path","yellow","bold","green","red"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAA0B,kCAA1B,0BAA0B,EAAA;AAC5B,IAAA,QAAiC,kCAAjC,iCAAiC,EAAA;AACpB,IAAA,MAAqB,WAArB,qBAAqB,CAAA;AAExB,IAAA,QAAsB,WAAtB,sBAAsB,CAAA;AAC5B,IAAA,QAAiB,kCAAjB,iBAAiB,EAAA;;;;;;AAErC,MAAMA,aAAa,GAAe,CAACC,IAAI,GAAK;IAC1C,MAAMC,SAAS,GAAa;QAC1B,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,UAAU,EAAEA,OAAO;QACnB,WAAW,EAAEA,OAAO;QACpB,UAAU;QACV,IAAI,EAAE,QAAQ;KACf;IACD,IAAIC,IAAI,AAAsB;IAC9B,IAAI;QACFA,IAAI,GAAGC,CAAAA,GAAAA,QAAG,AAAqB,CAAA,QAArB,CAACH,SAAS,EAAE;YAAED,IAAI;SAAE,CAAC;KAChC,CAAC,OAAOK,KAAK,EAAE;QACd,IAAIC,CAAAA,GAAAA,QAAO,AAAO,CAAA,QAAP,CAACD,KAAK,CAAC,IAAIA,KAAK,CAACE,IAAI,KAAK,oBAAoB,EAAE;YACzD,OAAOC,CAAAA,GAAAA,MAAY,AAAkB,CAAA,aAAlB,CAACH,KAAK,CAACI,OAAO,EAAE,CAAC,CAAC,CAAA;SACtC;QACD,MAAMJ,KAAK,CAAA;KACZ;IAED,IAAIF,IAAI,CAAC,QAAQ,CAAC,EAAE;QAClBO,OAAO,CAACC,GAAG,CACT,CAAC;;;;;;;;;kBASW,EAAEC,MAAK,QAAA,CAACC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC3D,CAAC,CACA;QACD,OAAM;KACP;IAED,MAAMC,SAAS,GAAG,IAAIC,QAAS,UAAA,CAAC;QAAEC,OAAO,E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