UNPKG

3.27 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../cli/next-build.ts"],"names":["nextBuild","argv","validArgs","Boolean","args","error","code","message","Log","warn","dir","_","catch","err","console"],"mappings":"AAAA;8DACA,sBACA,8EACA,0BACA,gEAEA,uDACA,0C,w4BAEA,KAAMA,CAAAA,SAAqB,CAAIC,IAAD,EAAU,CACtC,KAAMC,CAAAA,SAAmB,CAAG,CAC1B;AACA,SAAUC,OAFgB,CAG1B,YAAaA,OAHa,CAI1B,UAAWA,OAJe,CAK1B,YAAaA,OALa,CAM1B;AACA,KAAM,QAPoB,CAQ1B,KAAM,SARoB,CAA5B,CAWA,GAAIC,CAAAA,IAAJ,CACA,GAAI,CACFA,IAAI,CAAG,mBAAIF,SAAJ,CAAe,CAAED,IAAF,CAAf,CAAP,CACD,CAAC,MAAOI,KAAP,CAAc,CACd,GAAIA,KAAK,CAACC,IAAN,GAAe,oBAAnB,CAAyC,CACvC,MAAO,wBAAaD,KAAK,CAACE,OAAnB,CAA4B,CAA5B,CAAP,CACD,CACD,KAAMF,CAAAA,KAAN,CACD,CACD,GAAID,IAAI,CAAC,QAAD,CAAR,CAAoB,CAClB,wBACG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAdI,CAeE,CAfF,EAiBD,CACD,GAAIA,IAAI,CAAC,WAAD,CAAR,CAAuB,CACrBI,GAAG,CAACC,IAAJ,CAAS,yDAAT,EACD,CACD,GAAIL,IAAI,CAAC,WAAD,CAAR,CAAuB,CACrBI,GAAG,CAACC,IAAJ,CAAS,qBAAT,EACD,CACD,KAAMC,CAAAA,GAAG,CAAG,kBAAQN,IAAI,CAACO,CAAL,CAAO,CAAP,GAAa,GAArB,CAAZ,CAEA;AACA,GAAI,CAAC,mBAAWD,GAAX,CAAL,CAAsB,CACpB,wBAAc,mDAAkDA,GAAI,EAApE,EACD,CAED,MAAO,mBACLA,GADK,CAEL,IAFK,CAGLN,IAAI,CAAC,WAAD,CAHC,CAILA,IAAI,CAAC,SAAD,CAJC,CAKL,CAACA,IAAI,CAAC,WAAD,CALA,EAMLQ,KANK,CAMEC,GAAD,EAAS,CACfC,OAAO,CAACT,KAAR,CAAc,EAAd,EACAS,OAAO,CAACT,KAAR,CAAc,wBAAd,EACA,wBAAaQ,GAAb,EACD,CAVM,CAAP,CAWD,CAhED,C","sourcesContent":["#!/usr/bin/env node\nimport { existsSync } from 'fs'\nimport arg from 'next/dist/compiled/arg/index.js'\nimport { resolve } from 'path'\nimport * as Log from '../build/output/log'\nimport { cliCommand } from '../bin/next'\nimport build from '../build'\nimport { printAndExit } from '../server/lib/utils'\n\nconst nextBuild: cliCommand = (argv) => {\n const validArgs: arg.Spec = {\n // Types\n '--help': Boolean,\n '--profile': Boolean,\n '--debug': Boolean,\n '--no-lint': Boolean,\n // Aliases\n '-h': '--help',\n '-d': '--debug',\n }\n\n let args: arg.Result<arg.Spec>\n try {\n args = arg(validArgs, { argv })\n } catch (error) {\n if (error.code === 'ARG_UNKNOWN_OPTION') {\n return printAndExit(error.message, 1)\n }\n throw error\n }\n if (args['--help']) {\n printAndExit(\n `\n Description\n Compiles the application for production deployment\n\n Usage\n $ next build <dir>\n\n <dir> represents the directory of the Next.js application.\n If no directory is provided, the current directory will be used.\n\n Options\n --profile Can be used to enable React Production Profiling\n --no-lint Disable linting\n `,\n 0\n )\n }\n if (args['--profile']) {\n Log.warn('Profiling is enabled. Note: This may affect performance')\n }\n if (args['--no-lint']) {\n Log.warn('Linting is disabled')\n }\n const dir = resolve(args._[0] || '.')\n\n // Check if the provided directory exists\n if (!existsSync(dir)) {\n printAndExit(`> No such directory exists as the project root: ${dir}`)\n }\n\n return build(\n dir,\n null,\n args['--profile'],\n args['--debug'],\n !args['--no-lint']\n ).catch((err) => {\n console.error('')\n console.error('> Build error occurred')\n printAndExit(err)\n })\n}\n\nexport { nextBuild }\n"]}
\No newline at end of file