UNPKG

37.4 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../src/prepack-cli.js"],"names":["run","Object","Array","console","JSON","process","prepackStdin","prepackFileSync","FatalError","CompatibilityValues","fs","HELP_STR","map","v","join","args","from","argv","splice","inputFilenames","outputFilename","check","compatibility","mathRandomSeed","inputSourceMap","outputSourceMap","statsFileName","maxStackDepth","timeout","debugIdentifiers","lazyObjectsRuntime","heapGraphFilePath","debugInFilePath","debugOutFilePath","reactOutput","reproFilePath","cpuprofilePath","invariantMode","invariantLevel","flags","initializeMoreModules","trace","debugNames","emitConcreteModel","inlineExpressions","logStatistics","logModules","delayInitializations","delayUnsupportedRequires","accelerateUnsupportedRequires","internalDebug","debugScopes","serialize","residual","profile","instantRender","reactEnabled","reproArguments","reproFileNames","inputFile","fileName","push","path","basename","debuggerConfigArgs","length","arg","shift","startsWith","inputs","trim","split","input","slice","includes","error","exit","value","isNaN","parseInt","toString","seconds","debugIdentifiersString","range","unshift","pair","Number","MAX_SAFE_INTEGER","start","isInteger","count","ReactOutputValues","InvariantModeValues","invariantLevelString","diagnosticSeverity","buckRoot","options","flag","keys","log","option","version","undefined","zip","content","readFileSync","file","a","data","generate","base64","compression","writeFileSync","resolvedOptions","assign","inputSourceMapFilename","errorHandler","sourceMaps","heapGraphFormat","compilerDiagnostics","Map","compilerDiagnosticsList","compilerDiagnostic","location","set","printDiagnostics","caughtFatalError","size","informations","warnings","recoverableErrors","fatalErrors","printCompilerDiagnostic","locString","severity","errorCode","message","callStack","eolPos","indexOf","substring","loc","sourceMessage","source","line","column","plural","word","filter","s","profiler","success","require","e","setSamplingInterval","startProfiling","processSerializedCode","serialized","err","stack","stopProfiling","Date","now","stream","createWriteStream","getNextToken","write","token","once","end","code","statistics","stats","RealmStatistics","getRealmStatistics","SerializerStatistics","getSerializerStatistics","TimingStatistics","projectPerformanceTrackers","pt","time","HeapStatistics","memory","MemoryStatistics","v8","getHeapStatistics","stringify","heapGraph","__residual"],"mappings":";;AAaA;;AACA;;A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AAImB,sBAAsBuE,SAA1B,EAAqC;AACnC,8BAAUuD,WAAW8B,SAArB;AACAjL,SAAGsG,aAAH,CAAiBjF,iBAAjB,EAAoC8H,WAAW8B,SAA/C;AACD;AACF;;AAED,MAAI,CAACpC,OAAL,EAAclJ,QAAQuE,IAAR,CAAa,CAAb;AACf;;AAED,IAAI,OAAOgH,UAAP,KAAsB,UAA1B,EAAsC;AACpC;AACA;AACAA,aACE,SADF,EAEE5L,GAFF,EAGEC,MAHF,EAIEC,KAJF,EAKEC,OALF,EAMEC,IANF,EAOEC,OAPF,EAQEC,yBARF,EASEC,4BATF,EAUEC,kBAVF,EAWEC,4BAXF,EAYEC,WAZF;AAcD,CAjBD,MAiBO;AACLV,MAAIC,MAAJ,EAAYC,KAAZ,EAAmBC,OAAnB,EAA4BC,IAA5B,EAAkCC,OAAlC,EAA2CC,yBAA3C,EAAyDC,4BAAzD,EAA0EC,kBAA1E,EAAsFC,4BAAtF,EAA2GC,WAA3G;AACD","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\n/* eslint-disable no-shadow */\n\nimport { CompilerDiagnostic, type ErrorHandlerResult, FatalError } from \"./errors.js\";\nimport {\n type Compatibility,\n CompatibilityValues,\n type ReactOutputTypes,\n ReactOutputValues,\n type InvariantModeTypes,\n InvariantModeValues,\n} from \"./options.js\";\nimport { type SerializedResult } from \"./serializer/types.js\";\nimport { prepackStdin, prepackFileSync } from \"./prepack-node.js\";\nimport type { BabelNodeSourceLocation } from \"@babel/types\";\nimport fs from \"fs\";\nimport v8 from \"v8\";\nimport { version } from \"../package.json\";\nimport invariant from \"./invariant\";\nimport zipFactory from \"node-zip\";\nimport path from \"path\";\nimport JSONTokenizer from \"./utils/JSONTokenizer.js\";\nimport type { DebuggerConfigArguments } from \"./types\";\n\n// Prepack helper\ndeclare var __residual: any;\n\nfunction run(\n Object,\n Array,\n console,\n JSON,\n process,\n prepackStdin,\n prepackFileSync,\n FatalError,\n CompatibilityValues,\n fs\n) {\n let HELP_STR = `\n input The name of the file to run Prepack over (for web please provide the single js bundle file)\n --out The name of the output file\n --compatibility The target environment for Prepack [${CompatibilityValues.map(v => `\"${v}\"`).join(\", \")}]\n --mathRandomSeed If you want Prepack to evaluate Math.random() calls, please provide a seed.\n --srcmapIn The input sourcemap filename. If present, Prepack will output a sourcemap that maps from\n the original file (pre-input sourcemap) to Prepack's output\n --srcmapOut The output sourcemap filename.\n --maxStackDepth Specify the maximum call stack depth.\n --timeout The amount of time in seconds until Prepack should time out.\n --lazyObjectsRuntime Enable lazy objects feature and specify the JS runtime that support this feature.\n --debugNames Changes the output of Prepack so that for named functions and variables that get emitted into\n Prepack's output, the original name is appended as a suffix to Prepack's generated identifier.\n --initializeMoreModules Enable speculative initialization of modules (for the module system Prepack has builtin\n knowledge about). Prepack will try to execute all factory functions it is able to.\n --trace Traces the order of module initialization.\n --serialize Serializes the partially evaluated global environment as a program that recreates it.\n (default = true)\n --check [start[, count]] Check residual functions for diagnostic messages. Do not serialize or produce residual code.\n --residual Produces the residual program that results after constant folding.\n --profile Collect statistics about time and memory usage of the different internal passes\n --logStatistics Log statistics to console\n --statsFile The name of the output file where statistics will be written to.\n --heapGraphFilePath The name of the output file where heap graph will be written to.\n --inlineExpressions When generating code, tells prepack to avoid naming expressions when they are only used once,\n and instead inline them where they are used.\n --invariantLevel 0: no invariants (default); 1: checks for abstract values; 2: checks for accessed built-ins; 3: internal consistency\n --invariantMode Whether to throw an exception or call a console function to log an invariant violation; default = throw.\n --emitConcreteModel Synthesize concrete model values for abstract models(defined by __assumeDataProperty).\n --version Output the version number.\n --repro Create a zip file with all information needed to reproduce a Prepack run.\n --cpuprofile Create a CPU profile file for the run that can be loaded into the Chrome JavaScript CPU Profile viewer.\n --debugDiagnosticSeverity FatalError | RecoverableError | Warning | Information (default = FatalError). Diagnostic level at which debugger will stop.\n --debugBuckRoot Root directory that buck assumes when creating sourcemap paths.\n `;\n let args = Array.from(process.argv);\n args.splice(0, 2);\n let inputFilenames = [];\n let outputFilename;\n let check: void | Array<number>;\n let compatibility: Compatibility;\n let mathRandomSeed;\n let inputSourceMap;\n let outputSourceMap;\n let statsFileName;\n let maxStackDepth: number;\n let timeout: number;\n let debugIdentifiers: void | Array<string>;\n let lazyObjectsRuntime: string;\n let heapGraphFilePath: void | string;\n let debugInFilePath: string;\n let debugOutFilePath: string;\n let reactOutput: ReactOutputTypes = \"create-element\";\n let reproFilePath: void | string;\n let cpuprofilePath: void | string;\n let invariantMode: void | InvariantModeTypes;\n let invariantLevel: void | number;\n let flags = {\n initializeMoreModules: false,\n trace: false,\n debugNames: false,\n emitConcreteModel: false,\n inlineExpressions: false,\n logStatistics: false,\n logModules: false,\n delayInitializations: false,\n delayUnsupportedRequires: false,\n accelerateUnsupportedRequires: true,\n internalDebug: false,\n debugScopes: false,\n serialize: false,\n residual: false,\n profile: false,\n instantRender: false,\n reactEnabled: false,\n };\n\n let reproArguments = [];\n let reproFileNames = [];\n let inputFile = fileName => {\n reproFileNames.push(fileName);\n return path.basename(fileName);\n };\n let debuggerConfigArgs: DebuggerConfigArguments = {};\n while (args.length) {\n let arg = args.shift();\n if (!arg.startsWith(\"--\")) {\n let inputs = arg.trim().split(/\\s+/g); // Split on all whitespace\n for (let input of inputs) {\n inputFilenames.push(input);\n reproArguments.push(inputFile(input));\n }\n } else {\n arg = arg.slice(2);\n switch (arg) {\n case \"out\":\n arg = args.shift();\n outputFilename = arg;\n // do not include this in reproArguments needed by --repro, as path is likely not portable between environments\n break;\n case \"compatibility\":\n arg = args.shift();\n if (!CompatibilityValues.includes(arg)) {\n console.error(`Unsupported compatibility: ${arg}`);\n process.exit(1);\n }\n compatibility = (arg: any);\n reproArguments.push(\"--compatibility\", compatibility);\n break;\n case \"mathRandomSeed\":\n mathRandomSeed = args.shift();\n reproArguments.push(\"--mathRandomSeed\", mathRandomSeed);\n break;\n case \"srcmapIn\":\n inputSourceMap = args.shift();\n reproArguments.push(\"--srcmapIn\", inputFile(inputSourceMap));\n break;\n case \"srcmapOut\":\n outputSourceMap = args.shift();\n // do not include this in reproArguments needed by --repro, as path is likely not portable between environments\n break;\n case \"statsFile\":\n statsFileName = args.shift();\n // do not include this in reproArguments needed by --repro, as path is likely not portable between environments\n break;\n case \"maxStackDepth\":\n let value = args.shift();\n if (isNaN(value)) {\n console.error(\"Stack depth value must be a number\");\n process.exit(1);\n }\n maxStackDepth = parseInt(value, 10);\n reproArguments.push(\"--maxStackDepth\", maxStackDepth.toString());\n break;\n case \"timeout\":\n let seconds = args.shift();\n if (isNaN(seconds)) {\n console.error(\"Timeout must be a number\");\n process.exit(1);\n }\n timeout = parseInt(seconds, 10) * 1000;\n reproArguments.push(\"--timeout\", timeout.toString());\n break;\n case \"debugIdentifiers\":\n let debugIdentifiersString = args.shift();\n debugIdentifiers = debugIdentifiersString.split(\",\");\n reproArguments.push(\"--debugIdentifiers\", debugIdentifiersString);\n break;\n case \"check\":\n let range = args.shift();\n if (range.startsWith(\"--\")) {\n args.unshift(range);\n range = \"0\";\n }\n let pair: Array<any> = range.split(\",\");\n if (pair.length === 1) pair.push(Number.MAX_SAFE_INTEGER);\n let start = +pair[0];\n if (start < 0 || !Number.isInteger(start)) {\n console.error(\"check start offset must be a number\");\n process.exit(1);\n }\n let count = +pair[1];\n if (count < 0 || !Number.isInteger(count)) {\n console.error(\"check count must be a number\");\n process.exit(1);\n }\n check = [start, count];\n reproArguments.push(\"--check\", range);\n break;\n case \"debugInFilePath\":\n debugInFilePath = args.shift();\n // do not include this in reproArguments needed by --repro, as debugger behavior is not currently supported for repros\n break;\n case \"debugOutFilePath\":\n debugOutFilePath = args.shift();\n // do not include this in reproArguments needed by --repro, as debugger behavior is not currently supported for repros\n break;\n case \"lazyObjectsRuntime\":\n lazyObjectsRuntime = args.shift();\n reproArguments.push(\"--lazyObjectsRuntime\", lazyObjectsRuntime);\n break;\n case \"heapGraphFilePath\":\n heapGraphFilePath = args.shift();\n // do not include this in reproArguments needed by --repro, as path is likely not portable between environments\n break;\n case \"reactOutput\":\n arg = args.shift();\n if (!ReactOutputValues.includes(arg)) {\n console.error(`Unsupported reactOutput: ${arg}`);\n process.exit(1);\n }\n reactOutput = (arg: any);\n reproArguments.push(\"--reactOutput\", reactOutput);\n break;\n case \"repro\":\n reproFilePath = args.shift();\n // do not include this in reproArguments needed by --repro, as we don't need to create a repro from the repro...\n break;\n case \"cpuprofile\":\n cpuprofilePath = args.shift();\n // do not include this in reproArguments needed by --repro, as path is likely not portable between environments\n break;\n case \"invariantMode\":\n arg = args.shift();\n if (!InvariantModeValues.includes(arg)) {\n console.error(`Unsupported invariantMode: ${arg}`);\n process.exit(1);\n }\n invariantMode = (arg: any);\n reproArguments.push(\"--invariantMode\", invariantMode);\n break;\n case \"invariantLevel\":\n let invariantLevelString = args.shift();\n if (isNaN(invariantLevelString)) {\n console.error(\"invariantLevel must be a number\");\n process.exit(1);\n }\n invariantLevel = parseInt(invariantLevelString, 10);\n reproArguments.push(\"--invariantLevel\", invariantLevel.toString());\n break;\n case \"debugDiagnosticSeverity\":\n arg = args.shift();\n invariant(\n arg === \"FatalError\" || arg === \"RecoverableError\" || arg === \"Warning\" || arg === \"Information\",\n `Invalid debugger diagnostic severity: ${arg}`\n );\n debuggerConfigArgs.diagnosticSeverity = arg;\n break;\n case \"debugBuckRoot\":\n debuggerConfigArgs.buckRoot = args.shift();\n break;\n case \"help\":\n const options = [\n \"-- | input.js\",\n \"--out output.js\",\n \"--compatibility jsc\",\n \"--mathRandomSeed seedvalue\",\n \"--srcmapIn inputMap\",\n \"--srcmapOut outputMap\",\n \"--maxStackDepth depthValue\",\n \"--timeout seconds\",\n \"--debugIdentifiers id1,id2,...\",\n \"--check [start[, number]]\",\n \"--lazyObjectsRuntime lazyObjectsRuntimeName\",\n \"--heapGraphFilePath heapGraphFilePath\",\n \"--reactOutput \" + ReactOutputValues.join(\" | \"),\n \"--repro reprofile.zip\",\n \"--cpuprofile name.cpuprofile\",\n \"--invariantMode \" + InvariantModeValues.join(\" | \"),\n ];\n for (let flag of Object.keys(flags)) options.push(`--${flag}`);\n\n console.log(\"Usage: prepack.js \" + options.map(option => `[ ${option} ]`).join(\" \") + \"\\n\" + HELP_STR);\n return;\n case \"version\":\n console.log(version);\n return;\n default:\n if (arg in flags) {\n flags[arg] = true;\n reproArguments.push(\"--\" + arg);\n } else {\n console.error(`Unknown option: ${arg}`);\n process.exit(1);\n }\n }\n }\n }\n\n if (reproFilePath !== undefined) {\n const zip = zipFactory();\n for (let fileName of reproFileNames) {\n let content = fs.readFileSync(fileName, \"utf8\");\n zip.file(path.basename(fileName), content);\n }\n zip.file(\n \"repro.sh\",\n `#!/bin/bash\nif [ -z \"$PREPACK\" ]; then\n echo \"Set environment variable PREPACK to bin/prepack.js in your Prepack directory.\"\nelse\n node \"$PREPACK\" ${reproArguments.map(a => `\"${a}\"`).join(\" \")}\nfi\n`\n );\n const data = zip.generate({ base64: false, compression: \"DEFLATE\" });\n fs.writeFileSync(reproFilePath, data, \"binary\");\n }\n\n if (!flags.serialize && !flags.residual) flags.serialize = true;\n if (check) {\n flags.serialize = false;\n flags.residual = false;\n }\n\n let resolvedOptions = Object.assign(\n {},\n {\n compatibility,\n mathRandomSeed,\n inputSourceMapFilename: inputSourceMap,\n errorHandler,\n sourceMaps: !!outputSourceMap,\n maxStackDepth,\n timeout,\n debugIdentifiers,\n check,\n lazyObjectsRuntime,\n debugInFilePath,\n debugOutFilePath,\n reactOutput,\n invariantMode,\n invariantLevel,\n debuggerConfigArgs,\n },\n flags\n );\n if (heapGraphFilePath !== undefined) resolvedOptions.heapGraphFormat = \"DotLanguage\";\n if (lazyObjectsRuntime !== undefined && (resolvedOptions.delayInitializations || resolvedOptions.inlineExpressions)) {\n console.error(\"lazy objects feature is incompatible with delayInitializations and inlineExpressions options\");\n process.exit(1);\n }\n\n let compilerDiagnostics: Map<BabelNodeSourceLocation, CompilerDiagnostic> = new Map();\n let compilerDiagnosticsList: Array<CompilerDiagnostic> = [];\n function errorHandler(compilerDiagnostic: CompilerDiagnostic): ErrorHandlerResult {\n if (compilerDiagnostic.location) compilerDiagnostics.set(compilerDiagnostic.location, compilerDiagnostic);\n else compilerDiagnosticsList.push(compilerDiagnostic);\n return \"Recover\";\n }\n\n function printDiagnostics(caughtFatalError: boolean): boolean {\n if (compilerDiagnostics.size === 0 && compilerDiagnosticsList.length === 0) {\n // FatalErrors must have generated at least one CompilerDiagnostic.\n invariant(!caughtFatalError, \"FatalError must generate at least one CompilerDiagnostic\");\n return true;\n }\n\n let informations = 0;\n let warnings = 0;\n let recoverableErrors = 0;\n let fatalErrors = 0;\n let printCompilerDiagnostic = (\n compilerDiagnostic: CompilerDiagnostic,\n locString?: string = \"At an unknown location\"\n ) => {\n switch (compilerDiagnostic.severity) {\n case \"Information\":\n informations++;\n break;\n case \"Warning\":\n warnings++;\n break;\n case \"RecoverableError\":\n recoverableErrors++;\n break;\n default:\n invariant(compilerDiagnostic.severity === \"FatalError\");\n fatalErrors++;\n break;\n }\n console.error(\n `${locString} ${compilerDiagnostic.severity} ${compilerDiagnostic.errorCode}: ${compilerDiagnostic.message}` +\n ` (https://github.com/facebook/prepack/wiki/${compilerDiagnostic.errorCode})`\n );\n let callStack = compilerDiagnostic.callStack;\n if (callStack !== undefined) {\n let eolPos = callStack.indexOf(\"\\n\");\n if (eolPos > 0) console.error(callStack.substring(eolPos + 1));\n }\n };\n for (let [loc, compilerDiagnostic] of compilerDiagnostics) {\n let sourceMessage = \"\";\n switch (loc.source) {\n case null:\n case \"\":\n sourceMessage = \"In an unknown source file\";\n break;\n case \"no-filename-specified\":\n sourceMessage = \"In stdin\";\n break;\n default:\n invariant(loc !== null && loc.source !== null);\n sourceMessage = `In input file ${loc.source}`;\n break;\n }\n\n let locString = `${sourceMessage}(${loc.start.line}:${loc.start.column + 1})`;\n printCompilerDiagnostic(compilerDiagnostic, locString);\n }\n for (let compilerDiagnostic of compilerDiagnosticsList) printCompilerDiagnostic(compilerDiagnostic);\n invariant(informations + warnings + recoverableErrors + fatalErrors > 0);\n let plural = (count, word) => (count === 1 ? word : `${word}s`);\n console.error(\n `Prepack ${fatalErrors > 0 ? \"failed\" : \"succeeded\"}, reporting ${[\n fatalErrors > 0 ? `${fatalErrors} ${plural(fatalErrors, \"fatal error\")}` : undefined,\n recoverableErrors > 0 ? `${recoverableErrors} ${plural(recoverableErrors, \"recoverable error\")}` : undefined,\n warnings > 0 ? `${warnings} ${plural(warnings, \"warning\")}` : undefined,\n informations > 0 ? `${informations} ${plural(informations, \"informational message\")}` : undefined,\n ]\n .filter(s => s !== undefined)\n .join(\", \")}.`\n );\n\n return fatalErrors === 0;\n }\n\n let profiler;\n let success;\n try {\n if (cpuprofilePath !== undefined) {\n try {\n profiler = require(\"v8-profiler\");\n } catch (e) {\n // Profiler optional dependency failed\n console.error(\"v8-profiler doesn't work correctly on Windows, see issue #1695\");\n throw e;\n }\n profiler.setSamplingInterval(100); // default is 1000us\n profiler.startProfiling(\"\");\n }\n\n try {\n if (inputFilenames.length === 0) {\n prepackStdin(resolvedOptions, processSerializedCode, printDiagnostics);\n return;\n }\n let serialized = prepackFileSync(inputFilenames, resolvedOptions);\n success = printDiagnostics(false);\n if (resolvedOptions.serialize && serialized) processSerializedCode(serialized);\n } catch (err) {\n printDiagnostics(err instanceof FatalError);\n if (!(err instanceof FatalError)) {\n // if it is not a FatalError, it means prepack failed, and we should display the Prepack stack trace.\n console.error(err.stack);\n }\n success = false;\n }\n } finally {\n if (profiler !== undefined) {\n let data = profiler.stopProfiling(\"\");\n let start = Date.now();\n invariant(cpuprofilePath !== undefined);\n let stream = fs.createWriteStream(cpuprofilePath);\n let getNextToken = JSONTokenizer(data);\n let write = () => {\n for (let token = getNextToken(); token !== undefined; token = getNextToken()) {\n if (!stream.write(token)) {\n stream.once(\"drain\", write);\n return;\n }\n }\n stream.end();\n invariant(cpuprofilePath !== undefined);\n console.log(`Wrote ${cpuprofilePath} in ${Date.now() - start}ms`);\n };\n write();\n }\n }\n\n function processSerializedCode(serialized: SerializedResult) {\n if (serialized.code === \"\") {\n console.error(\"Prepack returned empty code.\");\n return;\n }\n if (outputFilename) {\n console.log(`Prepacked source code written to ${outputFilename}.`);\n fs.writeFileSync(outputFilename, serialized.code);\n } else {\n console.log(serialized.code);\n }\n if (statsFileName) {\n let statistics = serialized.statistics;\n if (statistics === undefined) {\n return;\n }\n let stats = {\n RealmStatistics: statistics.getRealmStatistics(),\n SerializerStatistics: statistics.getSerializerStatistics(),\n TimingStatistics: statistics.projectPerformanceTrackers(\"Time\", pt => pt.time),\n HeapStatistics: statistics.projectPerformanceTrackers(\"Memory\", pt => pt.memory),\n MemoryStatistics: v8.getHeapStatistics(),\n };\n fs.writeFileSync(statsFileName, JSON.stringify(stats));\n }\n if (outputSourceMap) {\n fs.writeFileSync(outputSourceMap, serialized.map ? JSON.stringify(serialized.map) : \"\");\n }\n if (heapGraphFilePath !== undefined) {\n invariant(serialized.heapGraph);\n fs.writeFileSync(heapGraphFilePath, serialized.heapGraph);\n }\n }\n\n if (!success) process.exit(1);\n}\n\nif (typeof __residual === \"function\") {\n // If we're running inside of Prepack. This is the residual function we'll\n // want to leave untouched in the final program.\n __residual(\n \"boolean\",\n run,\n Object,\n Array,\n console,\n JSON,\n process,\n prepackStdin,\n prepackFileSync,\n FatalError,\n CompatibilityValues,\n fs\n );\n} else {\n run(Object, Array, console, JSON, process, prepackStdin, prepackFileSync, FatalError, CompatibilityValues, fs);\n}\n"],"file":"prepack-cli.js"}
\No newline at end of file