first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

16
node_modules/@expo/xcpretty/README.md generated vendored Normal file
View File

@@ -0,0 +1,16 @@
# @expo/xcpretty
This can be used to parse and format xcodebuild logs.
The default error and warning format matches that of other tools in the Expo ecosystem.
```ts
import { Formatter } from '@expo/xcpretty';
const formatter = new Formatter({ projectRoot: '/' });
const lines = formatter.pipe('xcodebuild log results...');
for (const line of lines) {
console.log(line);
}
```

View File

@@ -0,0 +1,36 @@
import { CopyFileProps, FileOperation, Formatter } from './Formatter';
import { MetroParser } from './MetroParser';
export type ExpoRunFormatterProps = {
projectRoot: string;
podfile?: Record<string, Record<string, string>>;
appName?: string;
isDebug?: boolean;
};
/**
* A superset of `Formatter` which adds support for Metro build errors and cleaner formatting for Node projects.
*/
export declare class ExpoRunFormatter extends Formatter {
props: ExpoRunFormatterProps;
static create(projectRoot: string, { xcodeProject, isDebug, }?: {
xcodeProject?: {
name: string;
};
} & Pick<ExpoRunFormatterProps, 'isDebug'>): ExpoRunFormatter;
private podfileTracer;
_parser: MetroParser | undefined;
get parser(): MetroParser;
constructor(props: ExpoRunFormatterProps);
formatMetroAssetCollectionError(errorContents: string): string;
shouldShowCompileWarning(filePath: string, lineNumber?: string, columnNumber?: string): boolean;
shouldShowLinkerWarning(methodName: string, collisions: {
filePath: string;
name: string;
}[]): boolean;
shouldShowWarningInTarget({ target }: {
target?: string;
}): boolean;
getNodeModuleName(filePath: string, target?: string): string | null;
formatFileOperation(props: FileOperation): string;
formatCopy({ from, to, target }: CopyFileProps): string;
formatPhaseScriptExecution(scriptName: string, target?: string, project?: string): string;
}

134
node_modules/@expo/xcpretty/build/ExpoRunFormatter.js generated vendored Normal file
View File

@@ -0,0 +1,134 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpoRunFormatter = void 0;
const chalk_1 = __importDefault(require("chalk"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const Formatter_1 = require("./Formatter");
const MetroParser_1 = require("./MetroParser");
const PodfileTracer_1 = require("./utils/PodfileTracer");
const parsePodfileLock_1 = require("./utils/parsePodfileLock");
const symbols_1 = require("./utils/symbols");
/**
* A superset of `Formatter` which adds support for Metro build errors and cleaner formatting for Node projects.
*/
class ExpoRunFormatter extends Formatter_1.Formatter {
static create(projectRoot, { xcodeProject, isDebug, } = {}) {
var _a;
const appName = ((_a = xcodeProject === null || xcodeProject === void 0 ? void 0 : xcodeProject.name.match(/.*\/(.*)\.\w+/)) === null || _a === void 0 ? void 0 : _a[1]) || '';
const formatter = new ExpoRunFormatter({
projectRoot,
appName,
isDebug,
});
return formatter;
}
get parser() {
if (this._parser) {
return this._parser;
}
this._parser = new MetroParser_1.MetroParser(this);
return this._parser;
}
constructor(props) {
var _a;
super(props);
this.props = props;
let podfile = {};
const podfileLock = path_1.default.join(props.projectRoot, 'ios', 'Podfile.lock');
try {
const podfileContents = fs_1.default.readFileSync(podfileLock, 'utf8');
podfile = (_a = (0, parsePodfileLock_1.parsePodfileLock)(podfileContents)) !== null && _a !== void 0 ? _a : {};
}
catch { }
this.podfileTracer = new PodfileTracer_1.PodfileTracer({
...props,
podfile,
});
}
formatMetroAssetCollectionError(errorContents) {
const results = `\n${chalk_1.default.red(symbols_1.ERROR +
// Provide proper attribution.
'Metro encountered an error:\n' +
errorContents)}\nLearn more: https://docs.expo.dev/build-reference/troubleshooting\n`;
this.errors.push(results);
return results;
}
shouldShowCompileWarning(filePath, lineNumber, columnNumber) {
if (this.props.isDebug) {
return true;
}
return (!filePath.match(/node_modules/) &&
!filePath.match(/\/ios\/Pods\//) &&
// Don't show warnings in the generated build folder.
!Formatter_1.Formatter.getAppRoot(filePath));
}
shouldShowLinkerWarning(methodName, collisions) {
if (this.props.isDebug) {
return true;
}
return (
// Don't show warnings from cocoapods that come from non-root target pods.
!collisions.some(({ filePath }) => {
const nodeModule = this.podfileTracer.getNodeModuleNameForTarget(path_1.default.dirname(filePath));
return !(nodeModule === null || nodeModule === void 0 ? void 0 : nodeModule.isRootTarget);
}));
}
shouldShowWarningInTarget({ target }) {
if (this.props.isDebug || !target) {
return true;
}
const nodeModule = this.podfileTracer.getNodeModuleNameForTarget(target);
return !nodeModule || nodeModule.isRootTarget;
}
getNodeModuleName(filePath, target) {
const results = this.podfileTracer.getNodeModuleName(filePath, target);
return (results === null || results === void 0 ? void 0 : results.name) ? chalk_1.default.cyan(results.name) : null;
}
formatFileOperation(props) {
const title = this.getFileOperationTitle(props.type);
const moduleNameTag = this.getNodeModuleName(props.filePath, props.target);
return Formatter_1.Formatter.format(title, [moduleNameTag, Formatter_1.Formatter.formatBreadCrumb(props.fileName, props.target, props.project)]
.filter(Boolean)
.join(' '));
}
formatCopy({ from, to, target }) {
let relativeFile = Formatter_1.Formatter.relativePath(this.props.projectRoot, from);
// If the relative file reaches outside of the project root, we
// should attempt to resolve relative to the app output directory.
if (relativeFile.startsWith('../../')) {
const appFileRoot = Formatter_1.Formatter.getAppRoot(from);
relativeFile = Formatter_1.Formatter.highlightLastPathComponent(Formatter_1.Formatter.relativePath(appFileRoot, from));
}
const appFileRoot = Formatter_1.Formatter.getAppRoot(to);
const relativeAppFile = Formatter_1.Formatter.highlightLastPathComponent(Formatter_1.Formatter.relativePath(appFileRoot, to));
const moduleNameTag = this.getNodeModuleName('', target);
return Formatter_1.Formatter.format('Copying ', [moduleNameTag, [relativeFile, relativeAppFile].join(' ➜ ')].filter(Boolean).join(' '));
}
formatPhaseScriptExecution(scriptName, target, project) {
const moduleNameTag = this.getNodeModuleName('', target);
if (scriptName === 'Start Packager') {
const port = process.env.RCT_METRO_PORT || '8081';
const isDisabled = isTruthy(process.env.RCT_NO_LAUNCH_PACKAGER);
const status = isDisabled ? 'disabled' : `http://localhost:${port}`;
// Add some insight into if the bundler was started or not, and which port was used.
if (isDisabled) {
scriptName = chalk_1.default.gray(`${scriptName} (disabled)`);
}
else {
scriptName = scriptName + chalk_1.default.gray(` on ${status}`);
}
}
return Formatter_1.Formatter.format('Executing', [moduleNameTag, Formatter_1.Formatter.formatBreadCrumb(scriptName, target, project)]
.filter(Boolean)
.join(' '));
}
}
exports.ExpoRunFormatter = ExpoRunFormatter;
function isTruthy(value) {
return value === 'true' || value === 1 || value === '1';
}
//# sourceMappingURL=ExpoRunFormatter.js.map

File diff suppressed because one or more lines are too long

196
node_modules/@expo/xcpretty/build/Formatter.d.ts generated vendored Normal file
View File

@@ -0,0 +1,196 @@
import { Failure, Parser } from './Parser';
declare function highlightLastPathComponent(filePath: string): string;
declare function format(command: string, argumentText?: string, success?: boolean): string;
declare function relativePath(projectRoot: string, filePath: string): string;
declare function formatBreadCrumb(fileName: string, target?: string, project?: string): string;
declare function getAppRoot(filePath: string): string;
export type FileOperation = {
type: 'Analyze' | 'GenerateDSYMFile' | 'Ld' | 'Libtool' | 'ProcessPCH' | 'ProcessInfoPlistFile' | 'CodeSign' | 'Touch' | 'CompileC' | 'CompileSwift' | 'CompileXIB' | 'CompileStoryboard';
filePath: string;
fileName: string;
arch?: string;
linkType?: string;
target?: string;
project?: string;
};
export type ConfigurationOperation = {
type: 'Analyze' | 'Aggregate' | 'Build' | 'Clean';
configuration: string;
target?: string;
project?: string;
};
export type CopyFileProps = {
type: 'CpResource' | 'CopyStringsFile' | 'CopyPlistFile' | 'CpHeader';
from: string;
to: string;
target?: string;
project?: string;
};
export declare class Formatter {
props: {
projectRoot: string;
/** Sets the max character length for a warning before cropping the preview. Useful for minified files that can be upwards of a thousand characters long. */
maxWarningLineLength?: number;
};
static format: typeof format;
static formatBreadCrumb: typeof formatBreadCrumb;
static getAppRoot: typeof getAppRoot;
static highlightLastPathComponent: typeof highlightLastPathComponent;
static relativePath: typeof relativePath;
_parser: Parser | undefined;
get parser(): Parser;
errors: string[];
warnings: string[];
constructor(props: {
projectRoot: string;
/** Sets the max character length for a warning before cropping the preview. Useful for minified files that can be upwards of a thousand characters long. */
maxWarningLineLength?: number;
});
pipe(data: string): string[];
private dimConfiguration;
getTitleForConfigurationType(type: ConfigurationOperation['type']): string;
formatTarget(props: ConfigurationOperation): string;
formatCopy({ from, to }: CopyFileProps): string;
getFileOperationTitle(type: FileOperation['type']): string;
formatFileOperation(props: FileOperation): string;
formatPhaseSuccess(phaseName: string, duration?: string): string;
formatPhaseScriptExecution(scriptName: string, target?: string, project?: string): string;
formatPreprocess(file: string): string;
formatShellCommand(command: string, args: string): string;
formatCompileCommand(compilerCommand: string, filePath: string): string;
formatProcessPchCommand(filePath: string): string;
formatWriteFile(file: string): string;
formatOther(text: string): string;
formatSingleLineCompileIssue(type: 'warning' | 'error', filePathAndLocation: string, fileName: string, reason: string, target: string, project: string): string;
formatRemark(msg: string): string;
formatEmitSwiftModule(type: 'normal' | string, arch: 'x86_64' | string, target?: string, project?: string): string;
formatCompileSwiftSources(type: 'normal' | string, arch: 'x86_64' | string, pkg: string | 'com.apple.xcode.tools.swift.compiler', target?: string, project?: string): string;
formatCleanRemove(msg: string): string;
formatWriteAuxiliaryFiles(text: string): string;
formatTiffutil(file: string): string;
formatCheckDependencies(text: string): string;
formatWillNotBeCodeSigned(message: string): string;
/**
*
* @param fileName 'SampleTest.m',
* @param filePathAndLocation '/Users/foo/bar.m:12:59',
* @param reason 'expected identifier',
* @param line ' [[thread should] equal:thread.];',
* @param cursor ' ^'
*/
formatCompileError(fileName: string, filePathAndLocation: string, reason: string, line: string, cursor: string): string;
formatError(message: string): string;
/**
* In: `error: Provisioning profile "iOS Team Provisioning Profile: *" doesn't support the Push Notifications capability. (in target 'yolo90' from project 'yolo90')`
* Out: `❌ yolo90/yolo90: Provisioning Profile "iOS Team Provisioning Profile: *" does not support the Push Notifications capability.`
*
* In: `error: Provisioning profile "iOS Team Provisioning Profile: *" doesn't include the aps-environment entitlement. (in target 'yolo90' from project 'yolo90')`
* Out: `❌ yolo90/yolo90: Entitlements file defines the value "aps-environment" which is not registered for profile "iOS Team Provisioning Profile: *".`
*
* @param profileName `"iOS Team Provisioning Profile: *"`
* @param entitlementName `Push Notifications` | `aps-environment`
* @param entitlementType `capability` | `entitlement`
* @param target boost-for-react-native
* @param project Pods
*/
formatUnsupportedEntitlementError(profileName: string, entitlementName: string, entitlementType: 'capability' | 'entitlement', target?: string, project?: string): string;
formatFileMissingError(reason: string, filePath: string): string;
formatLdWarning(reason: string): string;
formatUndefinedSymbols(message: string, symbol: string, reference: string): string;
formatLdMethodOverride(methodName: string, collisions: {
filePath: string;
name: string;
}[]): string;
formatDuplicateSymbols(message: string, filePaths: string[], isWarning: boolean): string;
/**
* In: `The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target 'boost-for-react-native' from project 'Pods')`
* Out: `⚠️ Pods/boost-for-react-native: iOS@8.0 version mismatch. Expected >= 9.0 < 14.3.99`
*
* @param os iOS
* @param deploymentTarget IPHONEOS_DEPLOYMENT_TARGET
* @param version 8.0
* @param minVersion 9.0
* @param maxVersion 14.3.99
* @param target boost-for-react-native
* @param project Pods
*/
formatVersionMismatchWarning(os: string, deploymentTarget: string, version: string, minVersion: string, maxVersion: string, target: string, project: string): string;
/**
* In: `warning: [CP] Vendored binary '/Users/evanbacon/Library/Developer/Xcode/DerivedData/yolo67-hcjsxsdqyxnsgdednlbpylgeffja/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/hermes-engine.build/DerivedSources/hermes.framework.dSYM/Contents/Resources/DWARF/hermes' contains architectures (armv7 armv7s arm64) none of which match the current build architectures (x86_64).`
* Out: `⚠️ Vendored binary '[app]/hermes-engine.build/DerivedSources/hermes.framework.dSYM/Contents/Resources/DWARF/hermes' does not support current build architecture (x86_64). Supported architectures: armv7, armv7s, arm64.`
*
* @param os iOS
* @param deploymentTarget IPHONEOS_DEPLOYMENT_TARGET
* @param version 8.0
* @param minVersion 9.0
* @param maxVersion 14.3.99
* @param target boost-for-react-native
* @param project Pods
*/
formatMissingArchitectureWarning(binaryPath: string, architectures: string[], currentArchitectures: string[]): string;
/**
* In: `Skipping duplicate build file in Compile Sources build phase: /Users/evanbacon/Documents/GitHub/expo/ios/Exponent/Kernel/ReactAppManager/EXReactAppManager.mm (in target 'Exponent' from project 'Exponent')`
* Out:
* `⚠️ Skipping duplicate file: Exponent/Kernel/ReactAppManager/EXReactAppManager.mm:
* Remove: Exponent » Exponent » Build Phases » Compile Sources » EXReactAppManager.mm`
*
* @param filePath
* @param buildPhase 'Compile Sources'
* @param target Exponent-watch-app
* @param project Exponent
*/
formatDuplicateFileCompilerWarning(filePath: string, buildPhase: string, target: string, project: string): string;
/**
* In: `The Copy Bundle Resources build phase contains this target's Info.plist file '/Users/evanbacon/Documents/GitHub/expo/ios/Exponent/Supporting/Info.plist'. (in target 'Exponent' from project 'Exponent')`
* Out:
* `⚠️ Target's Info.plist file is incorrectly linked: Exponent/Supporting/Info.plist:
* Remove: Exponent » Exponent » Build Phases » Copy Bundle Resources » Info.plist`
*
* @param filePath
* @param reservedFileDescription 'entitlements'
* @param target Exponent-watch-app
* @param project Exponent
*/
formatReservedFileInCopyBundleResourcesCompilerWarning(filePath: string, reservedFileDescription: string, target: string, project: string): string;
/**
* In: `Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hermes-engine' from project 'Pods')`
* Out:
* `⚠️ Script has ambiguous dependencies causing it to run on every build.
* To fix, go to: Xcode » Pods/hermes-engine » Build Phases » [CP-User] [Hermes] Replace Hermes for the right configuration, if needed
* Either: Uncheck "Based on dependency analysis", or select output files to trigger the script`
*
* @param script [CP-User] [Hermes] Replace Hermes for the right configuration, if needed
* @param target Exponent-watch-app
* @param project Exponent
*/
formatAmbiguousRunScriptOutputsWarning(script: string, target: string, project: string): string;
formatMissingFileCompilerWarning(filePath: string): string;
formatGenericError(message: string): string;
formatGenericWarning(message: string): string;
formatWarning(message: string): string;
formatCompileWarning(fileName: string, filePathAndLocation: string, reason: string, line?: string, cursor?: string): string;
shouldShowWarningInTarget(props: {
target?: string;
}): boolean;
shouldShowCompileWarning(filePath: string, lineNumber?: string, columnNumber?: string): boolean;
shouldShowLinkerWarning(methodName: string, collisions: {
filePath: string;
name: string;
}[]): boolean;
formatPendingTest(suite: string, test: string): string;
formatPassingTest(suite: string, test: string, time: string): string;
formatMeasuringTest(suite: string, test: string, time: string): string;
formatFailingTest(suite: string, test: string, reason: string, filePath: string): string;
formatTestRunStarted(name: string): string;
formatTestSuiteStarted(name: string): string;
formatTestRunFinished(name: string, time: string): string;
formatTestSummary(executedMessage: string, failuresPerSuite: Record<string, Failure[]>): string;
formatFailures(failuresPerSuite: Record<string, Failure[]>): string;
formatFailure(f: Failure): string;
finish(): void;
prettyFormat(text: string): string | void;
optionalNewline(): string;
getBuildSummary(): string;
checkForBundlingErrors(lines: string | string[]): void;
}
export {};

836
node_modules/@expo/xcpretty/build/Formatter.js generated vendored Normal file
View File

@@ -0,0 +1,836 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Formatter = void 0;
const chalk_1 = __importDefault(require("chalk"));
const fs = __importStar(require("fs"));
const os = __importStar(require("os"));
const path = __importStar(require("path"));
const Matchers_1 = require("./Matchers");
const Parser_1 = require("./Parser");
const switchRegex_1 = require("./switchRegex");
const symbols_1 = require("./utils/symbols");
var Status;
(function (Status) {
Status["Pass"] = "pass";
Status["Fail"] = "fail";
Status["Pending"] = "pending";
Status["Error"] = "error";
Status["Completion"] = "completion";
Status["Measure"] = "measure";
})(Status || (Status = {}));
function highlightLastPathComponent(filePath) {
return chalk_1.default.dim(path.dirname(filePath) + '/') + path.basename(filePath);
}
function format(command, argumentText = '', success = true) {
const symbol = statusSymbol(success ? Status.Completion : Status.Fail);
return [symbol, chalk_1.default.bold(command), argumentText].join(' ').trim();
}
function formatTest(testCase, status) {
return [statusSymbol(status), testCase].join(' ').trim();
}
function heading(prefix, text, description) {
return [prefix, chalk_1.default.white(text), description].join(' ').trim();
}
function statusSymbol(status) {
switch (status) {
case Status.Pass:
return chalk_1.default.green(symbols_1.PASS);
case Status.Fail:
return chalk_1.default.red(symbols_1.FAIL);
case Status.Pending:
return chalk_1.default.cyan(symbols_1.PENDING);
case Status.Error:
return chalk_1.default.red(symbols_1.ERROR);
case Status.Completion:
return chalk_1.default.white(symbols_1.COMPLETION);
case Status.Measure:
return chalk_1.default.magenta(symbols_1.MEASURE);
default:
return '';
}
}
function coloredTime(time) {
const flt = parseFloat(time);
if (flt >= 0 && flt <= 0.025) {
return time;
}
else if (flt >= 0.026 && flt <= 0.1) {
return chalk_1.default.yellow(time);
}
return chalk_1.default.red(time);
}
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function relativePath(projectRoot, filePath) {
return slash(path.relative(projectRoot, filePath));
}
function formatBreadCrumb(fileName, target, project) {
// TODO: Simplify
return [project === target ? project : [project, target].filter(Boolean).join(`/`), fileName]
.filter(Boolean)
.join(` ${symbols_1.BREADCRUMB} `);
}
function getAppRoot(filePath) {
let appRoot = filePath;
const isBuildFolder = (path) => /((Debug|Release)-[^/\s\d]*$)|(.app$)/.test(path);
while (!isBuildFolder(appRoot) && appRoot.length > 1) {
appRoot = path.dirname(appRoot);
}
return isBuildFolder(appRoot) ? appRoot : '';
}
class Formatter {
get parser() {
if (this._parser) {
return this._parser;
}
this._parser = new Parser_1.Parser(this);
return this._parser;
}
constructor(props) {
this.props = props;
this.errors = [];
this.warnings = [];
}
pipe(data) {
const lines = [];
data.split(os.EOL).forEach(line => {
const results = this.parser.parse(line);
if (typeof results === 'string' && results.trim()) {
lines.push(results);
}
});
this.checkForBundlingErrors(lines);
return lines;
}
dimConfiguration(configuration) {
return chalk_1.default.dim(`(${configuration})`);
}
getTitleForConfigurationType(type) {
switch (type) {
case 'Clean':
return 'Cleaning';
case 'Aggregate':
return 'Aggregate';
case 'Analyze':
return 'Analyzing';
case 'Build':
return 'Building';
default:
return 'Unknown';
}
}
formatTarget(props) {
return format(this.getTitleForConfigurationType(props.type), this.dimConfiguration(formatBreadCrumb(props.configuration, props.target, props.project)));
}
formatCopy({ from, to }) {
const relativeFile = relativePath(this.props.projectRoot, from);
const appFileRoot = getAppRoot(to);
const relativeAppFile = relativePath(appFileRoot, to);
return format('Copying ', [relativeFile, relativeAppFile].join(' ➜ '));
}
getFileOperationTitle(type) {
switch (type) {
case 'Analyze':
return 'Analyzing';
case 'GenerateDSYMFile':
return `Generating debug`;
case 'Ld':
return 'Linking ';
case 'Libtool':
return 'Packaging';
case 'ProcessPCH':
return 'Precompiling';
case 'ProcessInfoPlistFile':
return 'Preparing';
case 'CodeSign':
return 'Signing ';
case 'Touch':
return 'Creating ';
case 'CompileC':
case 'CompileSwift':
case 'CompileXIB':
case 'CompileStoryboard':
return 'Compiling';
default:
// Unknown file operation
return '';
}
}
formatFileOperation(props) {
const title = this.getFileOperationTitle(props.type);
switch (props.type) {
case 'Analyze':
return format(title, formatBreadCrumb(props.fileName, props.target, props.project));
case 'GenerateDSYMFile':
return format(title, formatBreadCrumb(`'${props.fileName}'`, props.target, props.project));
case 'Ld':
return format(title, formatBreadCrumb(props.fileName, props.target, props.project));
case 'Libtool':
return format(title, formatBreadCrumb(props.fileName, props.target, props.project));
case 'ProcessPCH':
return format(title, formatBreadCrumb(props.fileName, props.target, props.project));
case 'ProcessInfoPlistFile':
return format(title, formatBreadCrumb(props.fileName, props.target, props.project));
case 'CodeSign':
return format(title, formatBreadCrumb(props.fileName, props.target, props.project));
case 'Touch':
return format(title, props.fileName);
case 'CompileC':
case 'CompileSwift':
case 'CompileXIB':
case 'CompileStoryboard':
return format(title, formatBreadCrumb(props.fileName, props.target, props.project));
default:
// Unknown file operation
return '';
}
}
formatPhaseSuccess(phaseName, duration) {
return format(capitalize(phaseName.toLowerCase()), `Succeeded${duration ? ` (${duration})` : ''}`, true);
}
formatPhaseScriptExecution(scriptName, target, project) {
// TODO: Track (scriptName === '[CP] Copy XCFrameworks')
return format('Executing', formatBreadCrumb(`'${scriptName}'`, target, project));
}
formatPreprocess(file) {
return format('Preprocessing', file);
}
formatShellCommand(command, args) {
return '';
}
formatCompileCommand(compilerCommand, filePath) {
return '';
}
formatProcessPchCommand(filePath) {
return '';
}
formatWriteFile(file) {
return '';
}
formatOther(text) {
return '';
}
formatSingleLineCompileIssue(type, filePathAndLocation, fileName, reason, target, project) {
// Allow disabling this warning.
const { filePath, lineNumber, columnNumber } = splitPathInfo(filePathAndLocation);
if (type === 'warning') {
if (!this.shouldShowCompileWarning(filePath, lineNumber, columnNumber)) {
return '';
}
}
// Prevent `/foo/bar:1:1` instead using `/foo/bar` since it's a bit more focused.
const sanitizedFilePath = lineNumber === '1' && columnNumber === '1' ? filePath : filePathAndLocation;
// Get the `Project/Target` prefix.
const packageName = [project, target].join('/');
// Choose a color.
const color = type === 'warning' ? chalk_1.default.yellow : chalk_1.default.red;
const platform = color.bold(`${packageName}:`);
// Choose a symbol.
const symbol = type === 'warning' ? symbols_1.WARNING : symbols_1.ERROR;
// Get a more concise file path when the issue is inside the build folder.
const appFileRoot = getAppRoot(sanitizedFilePath);
const relativeAppFile = appFileRoot
? chalk_1.default.gray('[app]/') + relativePath(appFileRoot, sanitizedFilePath)
: sanitizedFilePath;
// Create the message.
const results = (0, chalk_1.default) `${symbol} ${platform} ${reason.trim()}\n {gray └─${relativeAppFile}}`;
// Ensure we track the message
if (type === 'warning') {
this.warnings.push(results);
}
else {
this.errors.push(results);
}
return results;
}
// These are like comments but for Xcode logs.
formatRemark(msg) {
return '';
}
formatEmitSwiftModule(type, arch, target, project) {
return '';
}
formatCompileSwiftSources(type, arch, pkg, target, project) {
return '';
}
formatCleanRemove(msg) {
return '';
}
formatWriteAuxiliaryFiles(text) {
return '';
}
formatTiffutil(file) {
return format('Validating', file);
}
formatCheckDependencies(text) {
return format('Check Dependencies');
}
formatWillNotBeCodeSigned(message) {
const results = `${chalk_1.default.yellow(symbols_1.WARNING + ' ' + message)}`;
this.warnings.push(results);
return results;
}
// COMPILER / LINKER ERRORS AND WARNINGS
/**
*
* @param fileName 'SampleTest.m',
* @param filePathAndLocation '/Users/foo/bar.m:12:59',
* @param reason 'expected identifier',
* @param line ' [[thread should] equal:thread.];',
* @param cursor ' ^'
*/
formatCompileError(fileName, filePathAndLocation, reason, line, cursor) {
const { filePath, lineNumber, columnNumber } = splitPathInfo(filePathAndLocation);
const results = formatWarningOrError({
isError: true,
filePath,
reason,
cursor,
lineText: line,
lineNumber,
columnNumber,
projectRoot: this.props.projectRoot,
maxWarningLineLength: this.props.maxWarningLineLength,
});
this.errors.push(results);
return results;
}
formatError(message) {
const results = (0, switchRegex_1.switchRegex)(message, [
[
Matchers_1.Matchers.Errors.UNSUPPORTED_ENTITLEMENT_MATCHER,
([, $1, $2, $3, $4, $5]) => {
return this.formatUnsupportedEntitlementError($1, $2, $3, $4, $5);
},
],
[null, () => this.formatGenericError(message)],
]);
this.errors.push(results);
return results;
}
/**
* In: `error: Provisioning profile "iOS Team Provisioning Profile: *" doesn't support the Push Notifications capability. (in target 'yolo90' from project 'yolo90')`
* Out: `❌ yolo90/yolo90: Provisioning Profile "iOS Team Provisioning Profile: *" does not support the Push Notifications capability.`
*
* In: `error: Provisioning profile "iOS Team Provisioning Profile: *" doesn't include the aps-environment entitlement. (in target 'yolo90' from project 'yolo90')`
* Out: `❌ yolo90/yolo90: Entitlements file defines the value "aps-environment" which is not registered for profile "iOS Team Provisioning Profile: *".`
*
* @param profileName `"iOS Team Provisioning Profile: *"`
* @param entitlementName `Push Notifications` | `aps-environment`
* @param entitlementType `capability` | `entitlement`
* @param target boost-for-react-native
* @param project Pods
*/
formatUnsupportedEntitlementError(profileName, entitlementName, entitlementType, target, project) {
const packageName = [project, target].join('/');
const platform = chalk_1.default.red.bold(`${packageName}:`);
if (entitlementType === 'capability') {
return (0, chalk_1.default) `${symbols_1.ERROR} ${platform} Provisioning Profile ${profileName} does not support the {red ${entitlementName}} capability.`;
}
return (0, chalk_1.default) `${symbols_1.ERROR} ${platform} Entitlements file defines the value {red "${entitlementName}"} which is not registered for profile ${profileName}.`;
}
formatFileMissingError(reason, filePath) {
const results = `\n${chalk_1.default.red(symbols_1.ERROR + ' ' + reason)} ${filePath}\n\n`;
this.errors.push(results);
return results;
}
formatLdWarning(reason) {
const results = (0, switchRegex_1.switchRegex)(reason, [
[
Matchers_1.Matchers.Warnings.LINKER_METHOD_OVERRIDE,
([, $1, $2, $3, $4, $5]) => {
return this.formatLdMethodOverride($1, [
{ filePath: $2, name: $3 },
{ filePath: $4, name: $5 },
]);
},
],
[
Matchers_1.Matchers.Warnings.LINKER_METHOD_SINGLE_OVERRIDE,
([, $1, $2, $3]) => {
return this.formatLdMethodOverride($1, [{ filePath: $2, name: $3 }]);
},
],
[null, () => `${chalk_1.default.yellow(symbols_1.WARNING + ' ' + reason)}`],
]);
if (results) {
this.warnings.push(results);
}
return results;
}
formatUndefinedSymbols(message, symbol, reference) {
const symbols = chalk_1.default.gray(`┌─ Symbol: ${symbol}\n└─ Referenced from: ${reference}`);
const results = `${chalk_1.default.red(symbols_1.ERROR + ' ' + message)}\n${symbols}\n`;
this.errors.push(results);
return results;
}
formatLdMethodOverride(methodName, collisions) {
if (!this.shouldShowLinkerWarning(methodName, collisions)) {
return '';
}
const formattedMessage = chalk_1.default.yellow(symbols_1.WARNING + ` ld: duplicate method '${chalk_1.default.bold(methodName)}' in`);
const types = ['category', 'class'];
const symbols = chalk_1.default.gray(collisions
.map(({ filePath, name }, i) => {
const appFileRoot = getAppRoot(filePath);
const relativeAppFile = relativePath(appFileRoot, filePath);
const branch = i === collisions.length - 1 ? '└─' : i === 0 ? '┌─' : '├─';
return `${branch}${`[${types[i]}]`}: ${name} ${chalk_1.default.dim(relativeAppFile)}`;
})
.join('\n'));
return `${formattedMessage}\n${symbols}\n`;
}
formatDuplicateSymbols(message, filePaths, isWarning) {
const formattedMessage = isWarning
? chalk_1.default.yellow(symbols_1.WARNING + ' ' + message)
: chalk_1.default.red(symbols_1.ERROR + ' ' + message);
const symbols = chalk_1.default.gray(filePaths
.map((p, i) => {
const branch = i === filePaths.length - 1 ? '└─' : i === 0 ? '┌─' : '├─';
return `${branch} ${path.basename(p)}`;
})
.join('\n'));
const results = `${formattedMessage}\n${symbols}\n`;
if (isWarning) {
this.warnings.push(results);
}
else {
this.errors.push(results);
}
return results;
}
/**
* In: `The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target 'boost-for-react-native' from project 'Pods')`
* Out: `⚠️ Pods/boost-for-react-native: iOS@8.0 version mismatch. Expected >= 9.0 < 14.3.99`
*
* @param os iOS
* @param deploymentTarget IPHONEOS_DEPLOYMENT_TARGET
* @param version 8.0
* @param minVersion 9.0
* @param maxVersion 14.3.99
* @param target boost-for-react-native
* @param project Pods
*/
formatVersionMismatchWarning(os, deploymentTarget, version, minVersion, maxVersion, target, project) {
const packageName = [project, target].join('/');
const platform = chalk_1.default.bold(`${packageName}:`);
const packageNameWithVersion = chalk_1.default.greenBright(os) + chalk_1.default.cyan `@` + chalk_1.default.magenta(version);
const expectedRange = `>= ${minVersion} <= ${maxVersion}`;
return `${symbols_1.WARNING} ${platform} ${packageNameWithVersion} deployment version mismatch, expected ${expectedRange}`;
}
/**
* In: `warning: [CP] Vendored binary '/Users/evanbacon/Library/Developer/Xcode/DerivedData/yolo67-hcjsxsdqyxnsgdednlbpylgeffja/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/hermes-engine.build/DerivedSources/hermes.framework.dSYM/Contents/Resources/DWARF/hermes' contains architectures (armv7 armv7s arm64) none of which match the current build architectures (x86_64).`
* Out: `⚠️ Vendored binary '[app]/hermes-engine.build/DerivedSources/hermes.framework.dSYM/Contents/Resources/DWARF/hermes' does not support current build architecture (x86_64). Supported architectures: armv7, armv7s, arm64.`
*
* @param os iOS
* @param deploymentTarget IPHONEOS_DEPLOYMENT_TARGET
* @param version 8.0
* @param minVersion 9.0
* @param maxVersion 14.3.99
* @param target boost-for-react-native
* @param project Pods
*/
formatMissingArchitectureWarning(binaryPath, architectures, currentArchitectures) {
const appFileRoot = getAppRoot(binaryPath);
const relativeAppFile = appFileRoot
? chalk_1.default.gray('[app]/') + relativePath(appFileRoot, binaryPath)
: binaryPath;
const architectureString = currentArchitectures.length === 1 ? 'architecture' : 'architectures';
const supportedString = chalk_1.default.dim(`Supported architectures: ${architectures.join(', ')}.`);
return (chalk_1.default.yellow(`${symbols_1.WARNING} Vendored binary '${relativeAppFile}' does not support current build ${architectureString} (${chalk_1.default.bold(currentArchitectures.join(', '))}). `) + supportedString);
}
/**
* In: `Skipping duplicate build file in Compile Sources build phase: /Users/evanbacon/Documents/GitHub/expo/ios/Exponent/Kernel/ReactAppManager/EXReactAppManager.mm (in target 'Exponent' from project 'Exponent')`
* Out:
* `⚠️ Skipping duplicate file: Exponent/Kernel/ReactAppManager/EXReactAppManager.mm:
* Remove: Exponent » Exponent » Build Phases » Compile Sources » EXReactAppManager.mm`
*
* @param filePath
* @param buildPhase 'Compile Sources'
* @param target Exponent-watch-app
* @param project Exponent
*/
formatDuplicateFileCompilerWarning(filePath, buildPhase, target, project) {
const message = `${chalk_1.default.yellow `Skipping duplicate file:`} ${relativePath(this.props.projectRoot, filePath)}`;
const fileName = path.basename(filePath);
const crumbs = chalk_1.default.gray('Remove: ' +
['Xcode', `${project}/${target}`, 'Build Phases', buildPhase, fileName].join(` ${symbols_1.BREADCRUMB} `));
return `${symbols_1.WARNING} ${message}\n ${crumbs}\n`;
}
/**
* In: `The Copy Bundle Resources build phase contains this target's Info.plist file '/Users/evanbacon/Documents/GitHub/expo/ios/Exponent/Supporting/Info.plist'. (in target 'Exponent' from project 'Exponent')`
* Out:
* `⚠️ Target's Info.plist file is incorrectly linked: Exponent/Supporting/Info.plist:
* Remove: Exponent » Exponent » Build Phases » Copy Bundle Resources » Info.plist`
*
* @param filePath
* @param reservedFileDescription 'entitlements'
* @param target Exponent-watch-app
* @param project Exponent
*/
formatReservedFileInCopyBundleResourcesCompilerWarning(filePath, reservedFileDescription, target, project) {
const message = `${chalk_1.default.yellow `Target's ${chalk_1.default.bold(reservedFileDescription)} file is incorrectly linked:`} ${relativePath(this.props.projectRoot, filePath)}`;
const fileName = path.basename(filePath);
const crumbs = chalk_1.default.gray('Remove: ' +
['Xcode', `${project}/${target}`, 'Build Phases', 'Copy Bundle Resources', fileName].join(` ${symbols_1.BREADCRUMB} `));
return `${symbols_1.WARNING} ${message}\n ${crumbs}\n`;
}
/**
* In: `Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hermes-engine' from project 'Pods')`
* Out:
* `⚠️ Script has ambiguous dependencies causing it to run on every build.
* To fix, go to: Xcode » Pods/hermes-engine » Build Phases » [CP-User] [Hermes] Replace Hermes for the right configuration, if needed
* Either: Uncheck "Based on dependency analysis", or select output files to trigger the script`
*
* @param script [CP-User] [Hermes] Replace Hermes for the right configuration, if needed
* @param target Exponent-watch-app
* @param project Exponent
*/
formatAmbiguousRunScriptOutputsWarning(script, target, project) {
if (!this.shouldShowWarningInTarget({ target })) {
return '';
}
const message = chalk_1.default.yellow `Script has ambiguous dependencies causing it to run on every build.`;
const crumbs = chalk_1.default.gray('To fix, go to: ' +
['Xcode', `${project}/${target}`, 'Build Phases', `'${script}'`].join(` ${symbols_1.BREADCRUMB} `));
const solution = chalk_1.default.gray(`Either: Uncheck "Based on dependency analysis", or select output files to trigger the script`);
return `${symbols_1.WARNING} ${message}\n ${crumbs}\n ${solution}\n`;
}
formatMissingFileCompilerWarning(filePath) {
return `${symbols_1.WARNING} ${chalk_1.default.yellow `No such file or directory:`} ${filePath}`;
}
formatGenericError(message) {
return `\n${chalk_1.default.red(symbols_1.ERROR + ' ' + message)}\n\n`;
}
formatGenericWarning(message) {
return symbols_1.INDENT + chalk_1.default.yellow(message);
}
formatWarning(message) {
const results = (0, switchRegex_1.switchRegex)(message, [
[
Matchers_1.Matchers.Warnings.MISSING_ARCHITECTURE,
([, $1, $2, $3]) => {
return this.formatMissingArchitectureWarning($1, $2 === null || $2 === void 0 ? void 0 : $2.split(' ').map(value => value.trim()), $3 === null || $3 === void 0 ? void 0 : $3.split(' ').map(value => value.trim()));
},
],
[
Matchers_1.Matchers.Warnings.VERSION_MISMATCH,
([, $1, $2, $3, $4, $5, $6, $7]) => {
return this.formatVersionMismatchWarning($1, $2, $3, $4, $5, $6, $7);
},
],
[
Matchers_1.Matchers.Warnings.MISSING_FILE_COMPILER_WARNING_MATCHER,
([, $1]) => {
return this.formatMissingFileCompilerWarning($1);
},
],
[
Matchers_1.Matchers.Warnings.SKIPPING_DUPLICATE_FILE,
([, $1, $2, $3, $4]) => {
return this.formatDuplicateFileCompilerWarning($2, $1, $3, $4);
},
],
[
Matchers_1.Matchers.Warnings.TARGETS_FILE_INCLUDED,
([, $1, $2, $3, $4]) => {
return this.formatReservedFileInCopyBundleResourcesCompilerWarning($2, $1, $3, $4);
},
],
[
Matchers_1.Matchers.Warnings.AMBIGUOUS_RUN_SCRIPT,
([, $1, $2, $3, $4]) => {
return this.formatAmbiguousRunScriptOutputsWarning($1, $2, $3);
},
],
[null, () => this.formatGenericWarning(message)],
]);
// If the warning wasn't skipped then add it.
if (results) {
this.warnings.push(results);
}
return results;
}
// TODO: see how we can unify formatError and formatCompileError,
// the same for warnings
formatCompileWarning(fileName, filePathAndLocation, reason, line, cursor) {
const { filePath, lineNumber, columnNumber } = splitPathInfo(filePathAndLocation);
if (this.shouldShowCompileWarning(filePath, lineNumber, columnNumber)) {
const results = formatWarningOrError({
isError: false,
filePath,
reason,
cursor,
lineText: line,
lineNumber,
columnNumber,
projectRoot: this.props.projectRoot,
maxWarningLineLength: this.props.maxWarningLineLength,
});
if (results) {
this.warnings.push(results);
}
return results;
}
return '';
}
shouldShowWarningInTarget(props) {
return true;
}
shouldShowCompileWarning(filePath, lineNumber, columnNumber) {
return true;
}
shouldShowLinkerWarning(methodName, collisions) {
return true;
}
formatPendingTest(suite, test) {
return symbols_1.INDENT + formatTest(`${test} [PENDING]`, Status.Pending);
}
formatPassingTest(suite, test, time) {
return symbols_1.INDENT + formatTest(`${test} (${coloredTime(time)} seconds)`, Status.Pass);
}
formatMeasuringTest(suite, test, time) {
return symbols_1.INDENT + formatTest(`${test} measured (${coloredTime(time)} seconds)`, Status.Measure);
}
formatFailingTest(suite, test, reason, filePath) {
return symbols_1.INDENT + formatTest(`${test}, ${reason}`, Status.Fail);
}
formatTestRunStarted(name) {
return heading('Test Suite', name, 'started');
}
formatTestSuiteStarted(name) {
return heading('', name, '');
}
formatTestRunFinished(name, time) {
return '';
}
// Will be printed by default. Override with '' if you don't want summary
formatTestSummary(executedMessage, failuresPerSuite) {
const failures = this.formatFailures(failuresPerSuite);
let finalMessage = '';
if (!failures) {
finalMessage = chalk_1.default.green(executedMessage);
}
else {
finalMessage = chalk_1.default.red(executedMessage);
}
const text = [failures, finalMessage].join('\n\n\n').trim();
return `\n\n${text}`;
}
formatFailures(failuresPerSuite) {
return Object.entries(failuresPerSuite)
.map(([suite, failures]) => {
const formattedFailures = failures.map(failure => this.formatFailure(failure)).join('\n\n');
return `\n${suite}\n${formattedFailures}`;
})
.join('\n');
}
formatFailure(f) {
const { filePath, lineNumber, columnNumber } = splitPathInfo(f.filePath);
return formatWarningOrError({
isError: true,
testName: f.testCase,
filePath,
reason: f.reason,
// cursor,
lineNumber,
columnNumber,
projectRoot: this.props.projectRoot,
maxWarningLineLength: this.props.maxWarningLineLength,
});
}
finish() { }
// Override if you want to catch something specific with your regex
prettyFormat(text) {
return this.parser.parse(text);
}
// If you want to print inline, override #optionalNewline with ''
optionalNewline() {
return '\n';
}
getBuildSummary() {
return `\n\u203A ${this.errors.length} error(s), and ${this.warnings.length} warning(s)\n`;
}
checkForBundlingErrors(lines) {
lines = Array.isArray(lines) ? lines : lines.split('\n');
// Find the last line beginning with `Error:` in the logs
const lastErrorIndex = findLastIndex(lines);
// Unless we find an error, we don't need to do anything
if (lastErrorIndex === -1) {
return;
}
// Take 12 lines from the `Error:` line forwards
const block = lines.slice(lastErrorIndex, lastErrorIndex + 11).join('\n');
const result = this.formatError(block);
this.errors.push(result);
}
}
exports.Formatter = Formatter;
Formatter.format = format;
Formatter.formatBreadCrumb = formatBreadCrumb;
Formatter.getAppRoot = getAppRoot;
Formatter.highlightLastPathComponent = highlightLastPathComponent;
Formatter.relativePath = relativePath;
function findLastIndex(arr) {
for (let i = arr.length - 1; i >= 0; i--) {
if (arr[i].startsWith('Error:')) {
return i;
}
}
return -1;
}
function formatPaths(config) {
const filePath = chalk_1.default.reset.cyan(config.filePath);
return (chalk_1.default.dim('(') +
filePath +
chalk_1.default.dim(`:${[config.line, config.col].filter(Boolean).join(':')})`));
}
/**
* Split a string like `/Users/foo/bar.m:420:68` into its components.
*
* @param filePath '/Users/foo/bar.m:420:68'
*/
function splitPathInfo(filePathAndLocation) {
const [path, line, column] = filePathAndLocation.split(':');
return {
filePath: path || filePathAndLocation,
lineNumber: line,
columnNumber: column,
};
}
function parseOptionalInt(text) {
if (!text)
return undefined;
try {
const result = parseInt(text, 10);
return isNaN(result) ? undefined : result;
}
catch {
return undefined;
}
}
function formatWarningOrError({ projectRoot, filePath, reason, cursor, lineText, lineNumber, columnNumber, isError, maxWarningLineLength = 200, }) {
var _a;
const line = parseOptionalInt(lineNumber) || 0;
const column = parseOptionalInt(columnNumber);
const color = isError ? chalk_1.default.red : chalk_1.default.yellow;
const icon = color(isError ? symbols_1.ERROR : symbols_1.WARNING);
const displayFilePath = !filePath
? // If no file path, use null
null
: // If the file path is inside of the build folder (Hermes), then use absolute path.
getAppRoot(filePath)
? filePath
: // Otherwise, use relative path
slash(path.relative(projectRoot, filePath));
const formattedPath = formatPaths({
filePath: displayFilePath,
col: column,
line,
});
const pathWithPrefix = `${icon} ${formattedPath}`;
const formattedReason = color(grayOutMatch(reason, /(\[-.*?\])/).replace(/(\(.*?\)\s?)/, ''));
// Add special case for .jsbundle files that are parsed with Hermes.
const isHermes = filePath.endsWith('.jsbundle');
const isPreviewTooLong = isHermes || (lineText && lineText.length > maxWarningLineLength);
// When the preview is too long, we skip reading the file and attempting to apply
// code coloring, this is because it can get very slow.
if (isPreviewTooLong) {
let previewLine = '';
let cursorLine = formattedReason;
// Create a curtailed preview line like:
// `...transition:'fade'},k._updatePropsStack=function(){clearImmediate(k._updateImmediate),k._updateImmediate...`
// If there is no text preview or column number, we can't do anything.
if (lineText && column != null) {
const rangeWindow = Math.round(Math.max((_a = displayFilePath === null || displayFilePath === void 0 ? void 0 : displayFilePath.length) !== null && _a !== void 0 ? _a : 0, 80) / 2);
let minBounds = Math.max(0, column - rangeWindow);
const maxBounds = Math.min(minBounds + rangeWindow * 2, lineText.length);
previewLine = lineText.slice(minBounds, maxBounds);
// If we splice content off the start, then we should append `...`.
// This is unlikely to happen since we limit the activation size.
if (minBounds > 0) {
// Adjust the min bounds so the cursor is aligned after we add the "..."
minBounds -= 3;
previewLine = chalk_1.default.dim('...') + previewLine;
}
if (maxBounds < lineText.length) {
previewLine += chalk_1.default.dim('...');
}
// If the column property could be found, then use that to fix the cursor location which is often broken in regex.
cursorLine =
(column == null ? chalk_1.default.reset(cursor) : fill(column) + chalk_1.default.reset('^')).slice(minBounds) +
' ' +
formattedReason;
}
return ['', pathWithPrefix, '', previewLine, cursorLine, chalk_1.default.dim('(warning truncated)')].join('\n');
}
const { codeFrameColumns } = require('@babel/code-frame');
try {
const raw = fs.readFileSync(filePath, 'utf8');
const location = { start: { line, column } };
const framed = codeFrameColumns(raw, location, {
// TODO: Support iOS languages: C++, Objc, swift, Ruby, Bash
// Maybe something like prism but for terminals?
highlightCode: false,
// Remove `(_Nonnull, _Nullable, or _Null_unspecified)` options
message: formattedReason,
});
return `\n${pathWithPrefix}\n\n${framed}\n`;
}
catch {
// If the column property could be found, then use that to fix the cursor location which is often broken in regex.
const customCursor = column == null ? chalk_1.default.reset(cursor) : fill(column) + chalk_1.default.reset('^');
const framed = `${lineText}\n${customCursor} ${formattedReason}`;
return `\n${pathWithPrefix}\n\n${framed}\n`;
}
}
function fill(width) {
return width >= 0 ? Array(width).join(' ') : '';
}
// Dim values like `[-Wnullability-completeness]`
function grayOutMatch(text, reg) {
return replaceMatch(text, reg, chalk_1.default.gray.dim);
}
function replaceMatch(text, reg, callback) {
const match = text.match(reg);
if (match === null || match === void 0 ? void 0 : match.length) {
return text.replace(reg, callback(match[0]));
}
return text;
}
function slash(path) {
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
if (isExtendedLengthPath || hasNonAscii) {
return path;
}
return path.replace(/\\/g, '/');
}
//# sourceMappingURL=Formatter.js.map

1
node_modules/@expo/xcpretty/build/Formatter.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

420
node_modules/@expo/xcpretty/build/Matchers.d.ts generated vendored Normal file
View File

@@ -0,0 +1,420 @@
export declare const Matchers: {
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName
*/
ANALYZE_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` target
* `$2` project
* `$3` configuration
*/
BUILD_TARGET_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` target
* `$2` project
* `$3` configuration
*/
AGGREGATE_TARGET_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` target
* `$2` project
* `$3` configuration
*/
ANALYZE_TARGET_MATCHER: RegExp;
CHECK_DEPENDENCIES_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` command path
* `$2` arguments
*/
SHELL_COMMAND_MATCHER: RegExp;
/**
* @regex Nothing returned here for now
*/
CLEAN_REMOVE_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` target
* `$2` project
* `$3` configuration
*/
CLEAN_TARGET_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = file
* `$2` fileName (e.g. Exponent.app)
* `$3` target (e.g. ABI39_0_0EXAdsFacebook)
* `$4` project (e.g. ABI39_0_0)
*/
CODESIGN_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = file
*/
CODESIGN_FRAMEWORK_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` type
* `$2` filePath
* `$3` fileName (e.g. KWNull.m)
* `$4` target (e.g. ABI39_0_0EXAdsFacebook)
* `$5` project (e.g. ABI39_0_0)
*
* The order of extensions is important in order to make alternation greedier.
*/
COMPILE_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` compiler_command
* `$2` filePath
*/
COMPILE_COMMAND_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName (e.g. MainMenu.xib)
*/
COMPILE_XIB_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName (e.g. Main.storyboard)
*/
COMPILE_STORYBOARD_MATCHER: RegExp;
/**
* `$1` type of copy
* `$2` file path 1
* `$3` file path 2
* `$4` target
* `$5` project
*/
ANY_COPY_MATCHER: RegExp;
/**
* `CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'expo-dev-menu-interface' from project 'Pods')`
*/
COMPILE_SWIFT_SOURCES_MATCHER: RegExp;
/**
* `EmitSwiftModule normal x86_64 (in target 'expo-dev-menu-interface' from project 'Pods')`
*/
EMIT_SWIFT_MODULE_MATCHER: RegExp;
EXECUTED_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole message.
*
* `remark: Incremental compilation has been disabled: it is not compatible with whole module optimization`
*/
REMARK_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = file
* `$2` = test_suite
* `$3` = test_case
* `$4` = reason
*/
FAILING_TEST_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = file
* `$2` = reason
*/
UI_FAILING_TEST_MATCHER: RegExp;
/**
* @regex Captured groups
*/
RESTARTING_TESTS_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = dsym
*/
GENERATE_DSYM_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = library
*/
LIBTOOL_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = targetName
* `$2` = build_variants (normal, profile, debug)
* `$3` = architecture
*/
LINKING_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = suite
* `$2` = test_case
* `$3` = time
*/
TEST_CASE_PASSED_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = suite
* `$2` = test_case
*/
TEST_CASE_STARTED_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = suite
* `$2` = test_case
*/
TEST_CASE_PENDING_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = suite
* `$2` = test_case
* `$3` = time
*/
TEST_CASE_MEASURED_MATCHER: RegExp;
PHASE_SUCCESS_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = script_name
*/
PHASE_SCRIPT_EXECUTION_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = file
* `$1` = target
* `$1` = project
*/
PROCESS_PCH_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` filePath
*/
PROCESS_PCH_COMMAND_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = file
*/
PREPROCESS_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = file
*/
PBXCP_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = file
*/
PROCESS_INFO_PLIST_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = suite
* `$2` = time
*/
TESTS_RUN_COMPLETION_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = suite
* `$2` = time
*/
TEST_SUITE_STARTED_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` test suite name
*/
TEST_SUITE_START_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` fileName
*/
TIFFUTIL_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName
*/
TOUCH_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` filePath
*/
WRITE_FILE_MATCHER: RegExp;
WRITE_AUXILIARY_FILES: RegExp;
Warnings: {
/**
* @regex Captured groups
* `$1` = filePath
* `$2` = fileName
* `$3` = reason
*/
COMPILE_WARNING_MATCHER: RegExp;
COMPILE_WARNING_INLINE_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = ld prefix
* `$2` = warning message
*/
LD_WARNING_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole warning
*/
GENERIC_WARNING_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = filePath
*/
MISSING_FILE_COMPILER_WARNING_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName
*/
VERSION_MISMATCH: RegExp;
/**
* @regex Captured groups
*/
MISSING_ARCHITECTURE: RegExp;
/**
* @regex Captured groups
* `$1` buildPhase
* `$2` filePath
* `$3` target
* `$4` project
*/
SKIPPING_DUPLICATE_FILE: RegExp;
/**
* @regex Captured groups
* `$1` reservedFileDescription (Info.plist or entitlements)
* `$2` filePath
* `$3` target
* `$4` project
*/
TARGETS_FILE_INCLUDED: RegExp;
/**
* Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hermes-engine' from project 'Pods')
*
* @regex Captured groups
* `$1` script name
* `$2` target
* `$3` project
*/
AMBIGUOUS_RUN_SCRIPT: RegExp;
/**
* @regex Captured groups
* `$1` = whole warning
*/
WILL_NOT_BE_CODE_SIGNED_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole warning
*/
LINKER_METHOD_OVERRIDE: RegExp;
/**
* @regex Captured groups
* `$1` = whole warning
*/
LINKER_METHOD_SINGLE_OVERRIDE: RegExp;
};
Errors: {
/**
* @regex Captured groups
* `$1` = whole error
*/
CLANG_ERROR_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole error
*/
CHECK_DEPENDENCIES_ERRORS_MATCHER: RegExp;
/**
* @regex Captured groups
* `$0` = whole error
* `$1` = profile name
* `$2` = entitlement name
* `$3` = entitlement type <capability|entitlement>
* `$4` = native target
* `$5` = native project
*/
UNSUPPORTED_ENTITLEMENT_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole error
*/
PROVISIONING_PROFILE_REQUIRED_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole error
*/
NO_CERTIFICATE_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = filePath
* `$2` = fileName
* `$3` = reason
*/
COMPILE_ERROR_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` cursor (with whitespaces and tildes)
*/
CURSOR_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole error.
*
* Appears to be related to the installation of files on the connected device
*/
RSYNC_ERROR_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole error.
* it varies a lot, not sure if it makes sense to catch everything separately
*/
FATAL_ERROR_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole error.
* `$2` = file path
*/
FILE_MISSING_ERROR_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = whole error
*/
LD_ERROR_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` file path
*/
LINKER_DUPLICATE_SYMBOLS_LOCATION_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` reason
*/
LINKER_DUPLICATE_SYMBOLS_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` symbol location
*/
LINKER_UNDEFINED_SYMBOL_LOCATION_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` reason
*/
LINKER_UNDEFINED_SYMBOLS_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` reason
*/
PODS_ERROR_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = reference
*/
SYMBOL_REFERENCED_FROM_MATCHER: RegExp;
/**
* @regex Captured groups
* `$1` = error reason
*/
MODULE_INCLUDES_ERROR_MATCHER: RegExp;
};
};

424
node_modules/@expo/xcpretty/build/Matchers.js generated vendored Normal file
View File

@@ -0,0 +1,424 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Matchers = void 0;
exports.Matchers = {
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName
*/
ANALYZE_MATCHER: /^Analyze(?:Shallow)?\s(.*\/(.*\.(?:m|mm|cc|cpp|c|cxx)))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` target
* `$2` project
* `$3` configuration
*/
BUILD_TARGET_MATCHER: /^=== BUILD TARGET\s(.*)\sOF PROJECT\s(.*)\sWITH.*CONFIGURATION\s(.*)\s===/m,
/**
* @regex Captured groups
* `$1` target
* `$2` project
* `$3` configuration
*/
AGGREGATE_TARGET_MATCHER: /^=== BUILD AGGREGATE TARGET\s(.*)\sOF PROJECT\s(.*)\sWITH.*CONFIGURATION\s(.*)\s===/m,
/**
* @regex Captured groups
* `$1` target
* `$2` project
* `$3` configuration
*/
ANALYZE_TARGET_MATCHER: /^=== ANALYZE TARGET\s(.*)\sOF PROJECT\s(.*)\sWITH.*CONFIGURATION\s(.*)\s===/m,
CHECK_DEPENDENCIES_MATCHER: /^Check dependencies/m,
/**
* @regex Captured groups
* `$1` command path
* `$2` arguments
*/
SHELL_COMMAND_MATCHER: /^\s{4}(cd|setenv|(?:[\w/:\\\s\-.]+?\/)?[\w-]+)\s(.*)$/m,
/**
* @regex Nothing returned here for now
*/
CLEAN_REMOVE_MATCHER: /^Clean.Remove/m,
/**
* @regex Captured groups
* `$1` target
* `$2` project
* `$3` configuration
*/
CLEAN_TARGET_MATCHER: /^=== CLEAN TARGET\s(.*)\sOF PROJECT\s(.*)\sWITH CONFIGURATION\s(.*)\s===/m,
/**
* @regex Captured groups
* `$1` = file
* `$2` fileName (e.g. Exponent.app)
* `$3` target (e.g. ABI39_0_0EXAdsFacebook)
* `$4` project (e.g. ABI39_0_0)
*/
CODESIGN_MATCHER: /^CodeSign\s((?:\\.|[^ ])+\/((?:\\.|[^ ])+\.(?:\w+)))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` = file
*/
CODESIGN_FRAMEWORK_MATCHER: /^CodeSign\s((?:\\.|[^ ])+\/((?:\\.|[^ ])+\.framework))\/Versions\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` type
* `$2` filePath
* `$3` fileName (e.g. KWNull.m)
* `$4` target (e.g. ABI39_0_0EXAdsFacebook)
* `$5` project (e.g. ABI39_0_0)
*
* The order of extensions is important in order to make alternation greedier.
*/
COMPILE_MATCHER: /^(Compile[\w]+)\s.+?\s((?:\\.|[^ ])+\/((?:\\.|[^ ])+\.(?:mm|m|cpp|cxx|cc|c|swift)))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` compiler_command
* `$2` filePath
*/
COMPILE_COMMAND_MATCHER: /^\s*(.*clang\s.*\s-c\s(.*\.(?:m|mm|c|cc|cpp|cxx))\s.*\.o)$/m,
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName (e.g. MainMenu.xib)
*/
COMPILE_XIB_MATCHER: /^CompileXIB\s(.*\/(.*\.xib))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName (e.g. Main.storyboard)
*/
COMPILE_STORYBOARD_MATCHER: /^CompileStoryboard\s(.*\/([^/].*\.storyboard))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* `$1` type of copy
* `$2` file path 1
* `$3` file path 2
* `$4` target
* `$5` project
*/
ANY_COPY_MATCHER: /^(CpResource|CopyStringsFile|CopyPlistFile|CpHeader|PBXCp)\s(\/?.*\/(?:.*\.\w+))\s(\/?.*\/(?:.*\.\w+))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m,
/**
* `CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'expo-dev-menu-interface' from project 'Pods')`
*/
COMPILE_SWIFT_SOURCES_MATCHER: /^(CompileSwiftSources)\s([^\s]+) ([^\s]+) ([^\s]+) (?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m,
/**
* `EmitSwiftModule normal x86_64 (in target 'expo-dev-menu-interface' from project 'Pods')`
*/
EMIT_SWIFT_MODULE_MATCHER: /^(EmitSwiftModule)\s([^\s]+) ([^\s]+) (?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m,
EXECUTED_MATCHER: /^\s*Executed/m,
/**
* @regex Captured groups
* `$1` = whole message.
*
* `remark: Incremental compilation has been disabled: it is not compatible with whole module optimization`
*/
REMARK_MATCHER: /^remark: (.*)$/m,
/**
* @regex Captured groups
* `$1` = file
* `$2` = test_suite
* `$3` = test_case
* `$4` = reason
*/
FAILING_TEST_MATCHER: /^\s*(.+:\d+):\serror:\s[+-]\[(.*)\s(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/m,
/**
* @regex Captured groups
* `$1` = file
* `$2` = reason
*/
UI_FAILING_TEST_MATCHER: /^\s{4}t = \s+\d+\.\d+s\s+Assertion Failure: (.*:\d+): (.*)$/m,
/**
* @regex Captured groups
*/
RESTARTING_TESTS_MATCHER: /^Restarting after unexpected exit or crash in.+$/m,
/**
* @regex Captured groups
* `$1` = dsym
*/
GENERATE_DSYM_MATCHER: /^GenerateDSYMFile (\/.*\/(.*\.dSYM))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` = library
*/
LIBTOOL_MATCHER: /^Libtool\s(.*\/(.*\.a))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` = targetName
* `$2` = build_variants (normal, profile, debug)
* `$3` = architecture
*/
LINKING_MATCHER: /^Ld (\/?.*\/(.+?(?:[^\\](?=\s)))) ([^(|\s]*)(?:\s([^(|\s]*)\s)?\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` = suite
* `$2` = test_case
* `$3` = time
*/
TEST_CASE_PASSED_MATCHER: /^\s*Test Case\s'-\[(.*)\s(.*)\]'\spassed\s\((\d*\.\d{3})\sseconds\)/m,
/**
* @regex Captured groups
* `$1` = suite
* `$2` = test_case
*/
TEST_CASE_STARTED_MATCHER: /^Test Case '-\[(.*) (.*)\]' started.$/m,
/**
* @regex Captured groups
* `$1` = suite
* `$2` = test_case
*/
TEST_CASE_PENDING_MATCHER: /^Test Case\s'-\[(.*)\s(.*)PENDING\]'\spassed/m,
/**
* @regex Captured groups
* `$1` = suite
* `$2` = test_case
* `$3` = time
*/
TEST_CASE_MEASURED_MATCHER: /^[^:]*:[^:]*:\sTest Case\s'-\[(.*)\s(.*)\]'\smeasured\s\[Time,\sseconds\]\saverage:\s(\d*\.\d{3}),/m,
PHASE_SUCCESS_MATCHER: /^\*\*\s(.*)\sSUCCEEDED\s\*\*(?:\s+\[(.*)\])?/m,
/**
* @regex Captured groups
* `$1` = script_name
*/
PHASE_SCRIPT_EXECUTION_MATCHER: /^PhaseScriptExecution\s((?:\\ |\S)*)\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m,
/**
* @regex Captured groups
* `$1` = file
* `$1` = target
* `$1` = project
*/
PROCESS_PCH_MATCHER: /^ProcessPCH(?:\+\+)? (\/?.*\/([^(|\s|\n]*(?:.pch.(?:g|p)ch)))(?:\s(.*.pch))? ([^(|\s]*)(?:\s([^(|\s]*)\s)?\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` filePath
*/
PROCESS_PCH_COMMAND_MATCHER: /^\s*.*\/usr\/bin\/clang\s.*\s-c\s(.*)\s-o\s.*/m,
/**
* @regex Captured groups
* `$1` = file
*/
PREPROCESS_MATCHER: /^Preprocess\s(?:(?:\\ |[^ ])*)\s((?:\\ |[^ ])*)$/m,
/**
* @regex Captured groups
* `$1` = file
*/
PBXCP_MATCHER: /^PBXCp\s((?:\\ |[^ ])*)/m,
/**
* @regex Captured groups
* `$1` = file
*/
PROCESS_INFO_PLIST_MATCHER: /^ProcessInfoPlistFile\s.*\.plist\s(.*\/+(.*\.plist))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` = suite
* `$2` = time
*/
TESTS_RUN_COMPLETION_MATCHER: /^\s*Test Suite '(?:.*\/)?(.*[ox]ctest.*)' (finished|passed|failed) at (.*)/m,
/**
* @regex Captured groups
* `$1` = suite
* `$2` = time
*/
TEST_SUITE_STARTED_MATCHER: /^\s*Test Suite '(?:.*\/)?(.*[ox]ctest.*)' started at(.*)/m,
/**
* @regex Captured groups
* `$1` test suite name
*/
TEST_SUITE_START_MATCHER: /^\s*Test Suite '(.*)' started at/m,
/**
* @regex Captured groups
* `$1` fileName
*/
TIFFUTIL_MATCHER: /^TiffUtil\s(.*)/m,
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName
*/
TOUCH_MATCHER: /^Touch\s(.*\/([^(|\n]+))\s?[^(]+(?:\(in\s.*target '([^']*)'.*project '([^']*)'\))?/m,
/**
* @regex Captured groups
* `$1` filePath
*/
WRITE_FILE_MATCHER: /^write-file\s(.*)/m,
WRITE_AUXILIARY_FILES: /^Write auxiliary files/m,
Warnings: {
/**
* @regex Captured groups
* `$1` = filePath
* `$2` = fileName
* `$3` = reason
*/
COMPILE_WARNING_MATCHER: /^(\/.+\/(.*):.*:.*):\swarning:\s(.+?(?=\(in)?)(?:\(in target '([^']*)' from project '([^']*)'\))?$/m,
COMPILE_WARNING_INLINE_MATCHER: /^(\/.+\/(.*):.*:.*):\swarning:\s(.+?(?=\(in)?)(?:\(in target '([^']*)' from project '([^']*)'\))$/m,
/**
* @regex Captured groups
* `$1` = ld prefix
* `$2` = warning message
*/
LD_WARNING_MATCHER: /^(ld: )warning: (.*)/m,
/**
* @regex Captured groups
* `$1` = whole warning
*/
GENERIC_WARNING_MATCHER: /^warning:\s(.*)$/m,
/**
* @regex Captured groups
* `$1` = filePath
*/
MISSING_FILE_COMPILER_WARNING_MATCHER: /(.*): No such file or directory$/m,
/**
* @regex Captured groups
* `$1` filePath
* `$2` fileName
*/
VERSION_MISMATCH: /^The\s(\w*)\s.*'([^']*)'.*to (\d+\.?\d+\.?\d*),.*(\d+\.?\d+\.?\d*) to (\d+\.?\d+\.?\d*).\s.*target '([^']*)'.*project '([^']*)'/m,
/**
* @regex Captured groups
*/
MISSING_ARCHITECTURE: /^\[CP\] Vendored binary\s'([^']*)'.*contains architectures \(([\w\d\s]+)\) none of which match the current build architectures \(([\w\d\s]+)\)/m,
/**
* @regex Captured groups
* `$1` buildPhase
* `$2` filePath
* `$3` target
* `$4` project
*/
SKIPPING_DUPLICATE_FILE: /^Skipping duplicate build file in ([A-Za-z\s]+) build phase: (.*) \(in\s.*target '([^']*)'.*project '([^']*)'/m,
/**
* @regex Captured groups
* `$1` reservedFileDescription (Info.plist or entitlements)
* `$2` filePath
* `$3` target
* `$4` project
*/
TARGETS_FILE_INCLUDED: /^The Copy Bundle Resources build phase contains this target's (.*) file\s?'(.*)'. \(in\s.*target '([^']*)'.*project '([^']*)'/m,
/**
* Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hermes-engine' from project 'Pods')
*
* @regex Captured groups
* `$1` script name
* `$2` target
* `$3` project
*/
AMBIGUOUS_RUN_SCRIPT: /^Run script build phase '(.+)' will be run during every build because it does not specify any outputs\. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase\. \(in\s.*target '([^']*)'.*project '([^']*)'/m,
/**
* @regex Captured groups
* `$1` = whole warning
*/
WILL_NOT_BE_CODE_SIGNED_MATCHER: /^(.* will not be code signed because .*)$/m,
/**
* @regex Captured groups
* `$1` = whole warning
*/
LINKER_METHOD_OVERRIDE: /method '(.*)' in category from (?:(.*\/(?:.*\.\w))(?:\((.*\.\w)\)))\soverrides method from class in (?:(.*\/(?:.*\.\w))(?:\((.*\.\w)\)))/m,
/**
* @regex Captured groups
* `$1` = whole warning
*/
LINKER_METHOD_SINGLE_OVERRIDE: /method '(.*)' in category from (?:(.*\/(?:.*\.\w))(?:\((.*\.\w)\)))\sconflicts with same method from another category/m,
},
Errors: {
/**
* @regex Captured groups
* `$1` = whole error
*/
CLANG_ERROR_MATCHER: /^(clang: error:.*)$/m,
/**
* @regex Captured groups
* `$1` = whole error
*/
CHECK_DEPENDENCIES_ERRORS_MATCHER: /^(Code\s?Sign error:.*|Code signing is required for product type .* in SDK .*|No profile matching .* found:.*|Provisioning profile .* doesn't .*|Swift is unavailable on .*|.?Use Legacy Swift Language Version.*)$/m,
/**
* @regex Captured groups
* `$0` = whole error
* `$1` = profile name
* `$2` = entitlement name
* `$3` = entitlement type <capability|entitlement>
* `$4` = native target
* `$5` = native project
*/
UNSUPPORTED_ENTITLEMENT_MATCHER: /^error: Provisioning profile (.*) doesn't (?:support|include) the (.*) (capability|entitlement)\.(?:\s\(in\s.*target '([^']*)'.*project '([^']*)'\)$)?/m,
/**
* @regex Captured groups
* `$1` = whole error
*/
PROVISIONING_PROFILE_REQUIRED_MATCHER: /^(.*requires a provisioning profile.*)$/m,
/**
* @regex Captured groups
* `$1` = whole error
*/
NO_CERTIFICATE_MATCHER: /^(No certificate matching.*)$/m,
/**
* @regex Captured groups
* `$1` = filePath
* `$2` = fileName
* `$3` = reason
*/
COMPILE_ERROR_MATCHER: /^(\/.+\/(.*):.*:.*):\s(?:fatal\s)?error:\s(.+?(?=\(in)?)(?:\(in target '([^']*)' from project '([^']*)'\))?$/m,
/**
* @regex Captured groups
* `$1` cursor (with whitespaces and tildes)
*/
CURSOR_MATCHER: /^(?:\s+\|)?([\s~]*\^[\s~]*)$/m,
/**
* @regex Captured groups
* `$1` = whole error.
*
* Appears to be related to the installation of files on the connected device
*/
RSYNC_ERROR_MATCHER: /^(rsync error:.*)$/m,
/**
* @regex Captured groups
* `$1` = whole error.
* it varies a lot, not sure if it makes sense to catch everything separately
*/
FATAL_ERROR_MATCHER: /^(fatal error:.*)$/m,
/**
* @regex Captured groups
* `$1` = whole error.
* `$2` = file path
*/
FILE_MISSING_ERROR_MATCHER: /^<unknown>:0:\s(error:\s.*)\s'(\/.+\/.*\..*)'$/m,
/**
* @regex Captured groups
* `$1` = whole error
*/
LD_ERROR_MATCHER: /^(ld:.*)/m,
/**
* @regex Captured groups
* `$1` file path
*/
LINKER_DUPLICATE_SYMBOLS_LOCATION_MATCHER: /^\s+(\/.*\.o[)]?)$/m,
/**
* @regex Captured groups
* `$1` reason
*/
LINKER_DUPLICATE_SYMBOLS_MATCHER: /^((duplicate symbol|ld: warning: duplicate symbol) .*):$/m,
/**
* @regex Captured groups
* `$1` symbol location
*/
LINKER_UNDEFINED_SYMBOL_LOCATION_MATCHER: /^(.* in .*\.o[)]?)$/m,
/**
* @regex Captured groups
* `$1` reason
*/
LINKER_UNDEFINED_SYMBOLS_MATCHER: /^(Undefined symbols for architecture .*):$/m,
/**
* @regex Captured groups
* `$1` reason
*/
PODS_ERROR_MATCHER: /^(error:\s.*)/m,
/**
* @regex Captured groups
* `$1` = reference
*/
SYMBOL_REFERENCED_FROM_MATCHER: /\s+"(.*)", referenced from:$/m,
/**
* @regex Captured groups
* `$1` = error reason
*/
MODULE_INCLUDES_ERROR_MATCHER: /^<module-includes>:.*?:.*?:\s(?:fatal\s)?(error:\s.*)$/m,
},
};
//# sourceMappingURL=Matchers.js.map

1
node_modules/@expo/xcpretty/build/Matchers.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

10
node_modules/@expo/xcpretty/build/MetroParser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { Formatter } from './Formatter';
import { Parser } from './Parser';
export declare class MetroParser extends Parser {
formatter: Formatter;
private isCollectingMetroError;
private metroError;
constructor(formatter: Formatter);
parse(text: string): void | string;
checkMetroError(text: string): string;
}

65
node_modules/@expo/xcpretty/build/MetroParser.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MetroParser = void 0;
const Parser_1 = require("./Parser");
const switchRegex_1 = require("./switchRegex");
class MetroParser extends Parser_1.Parser {
constructor(formatter) {
super(formatter);
this.formatter = formatter;
this.isCollectingMetroError = false;
this.metroError = [];
}
parse(text) {
const results = this.checkMetroError(text);
if (results) {
return results;
}
return super.parse(text);
}
// Error for the build script wrapper in expo-updates that catches metro bundler errors.
// This can be repro'd by importing a file that doesn't exist, then building.
// Metro will fail to generate the JS bundle, and throw an error that should be caught here.
checkMetroError(text) {
// In expo-updates, we wrap the bundler script and add regex around the error message so we can present it nicely to the user.
return (0, switchRegex_1.switchRegex)(text, [
[
/@build-script-error-begin/m,
() => {
this.isCollectingMetroError = true;
},
],
[
/@build-script-error-end/m,
() => {
const results = this.metroError.join('\n');
// Reset the metro collection error array (should never need this).
this.isCollectingMetroError = false;
this.metroError = [];
if ('formatMetroAssetCollectionError' in this.formatter) {
return this.formatter.formatMetroAssetCollectionError(results);
}
throw new Error('Current `@expo/xcpretty` formatter cannot handle Metro errors');
},
],
[
null,
() => {
// Collect all the lines in the metro build error
if (this.isCollectingMetroError) {
let results = text;
if (!this.metroError.length) {
const match = text.match(/Error loading assets JSON from Metro.*steps correctly.((.|\n)*)/m);
if (match && match[1]) {
results = match[1].trim();
}
}
this.metroError.push(results);
}
},
],
]);
}
}
exports.MetroParser = MetroParser;
//# sourceMappingURL=MetroParser.js.map

1
node_modules/@expo/xcpretty/build/MetroParser.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"MetroParser.js","sourceRoot":"","sources":["../src/MetroParser.ts"],"names":[],"mappings":";;;AACA,qCAAkC;AAClC,+CAA4C;AAE5C,MAAa,WAAY,SAAQ,eAAM;IAIrC,YAAmB,SAAoB;QACrC,KAAK,CAAC,SAAS,CAAC,CAAC;QADA,cAAS,GAAT,SAAS,CAAW;QAH/B,2BAAsB,GAAG,KAAK,CAAC;QAC/B,eAAU,GAAa,EAAE,CAAC;IAIlC,CAAC;IAED,KAAK,CAAC,IAAY;QAChB,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,wFAAwF;IACxF,6EAA6E;IAC7E,4FAA4F;IAC5F,eAAe,CAAC,IAAY;QAC1B,8HAA8H;QAC9H,OAAO,IAAA,yBAAW,EAAC,IAAI,EAAE;YACvB;gBACE,4BAA4B;gBAC5B,GAAG,EAAE;oBACH,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;gBACrC,CAAC;aACF;YACD;gBACE,0BAA0B;gBAC1B,GAAG,EAAE;oBACH,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC3C,mEAAmE;oBACnE,IAAI,CAAC,sBAAsB,GAAG,KAAK,CAAC;oBACpC,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;oBACrB,IAAI,iCAAiC,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;wBACxD,OAAQ,IAAI,CAAC,SAAiB,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC;oBAC1E,CAAC;oBACD,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;gBACnF,CAAC;aACF;YACD;gBACE,IAAI;gBACJ,GAAG,EAAE;oBACH,iDAAiD;oBACjD,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;wBAChC,IAAI,OAAO,GAAG,IAAI,CAAC;wBACnB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;4BAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CACtB,kEAAkE,CACnE,CAAC;4BACF,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;gCACtB,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;4BAC5B,CAAC;wBACH,CAAC;wBACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBAChC,CAAC;gBACH,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF;AA7DD,kCA6DC","sourcesContent":["import { Formatter } from './Formatter';\nimport { Parser } from './Parser';\nimport { switchRegex } from './switchRegex';\n\nexport class MetroParser extends Parser {\n private isCollectingMetroError = false;\n private metroError: string[] = [];\n\n constructor(public formatter: Formatter) {\n super(formatter);\n }\n\n parse(text: string): void | string {\n const results = this.checkMetroError(text);\n if (results) {\n return results;\n }\n return super.parse(text);\n }\n\n // Error for the build script wrapper in expo-updates that catches metro bundler errors.\n // This can be repro'd by importing a file that doesn't exist, then building.\n // Metro will fail to generate the JS bundle, and throw an error that should be caught here.\n checkMetroError(text: string) {\n // In expo-updates, we wrap the bundler script and add regex around the error message so we can present it nicely to the user.\n return switchRegex(text, [\n [\n /@build-script-error-begin/m,\n () => {\n this.isCollectingMetroError = true;\n },\n ],\n [\n /@build-script-error-end/m,\n () => {\n const results = this.metroError.join('\\n');\n // Reset the metro collection error array (should never need this).\n this.isCollectingMetroError = false;\n this.metroError = [];\n if ('formatMetroAssetCollectionError' in this.formatter) {\n return (this.formatter as any).formatMetroAssetCollectionError(results);\n }\n throw new Error('Current `@expo/xcpretty` formatter cannot handle Metro errors');\n },\n ],\n [\n null,\n () => {\n // Collect all the lines in the metro build error\n if (this.isCollectingMetroError) {\n let results = text;\n if (!this.metroError.length) {\n const match = text.match(\n /Error loading assets JSON from Metro.*steps correctly.((.|\\n)*)/m\n );\n if (match && match[1]) {\n results = match[1].trim();\n }\n }\n this.metroError.push(results);\n }\n },\n ],\n ]);\n }\n}\n"]}

52
node_modules/@expo/xcpretty/build/Parser.d.ts generated vendored Normal file
View File

@@ -0,0 +1,52 @@
import { Formatter } from './Formatter';
export type Failure = {
filePath: string;
testCase: string;
reason: string;
};
interface TestIssue {
reason?: string;
cursor?: string;
line?: string;
filePath?: string;
fileName?: string;
}
interface LinkerFailure {
message?: string;
symbol?: string;
reference?: string;
files: string[];
isWarning?: boolean;
}
export declare class Parser {
formatter: Formatter;
testSuite?: string;
testCase?: string;
testsDone?: boolean;
formattedSummary: boolean;
failures: Record<string, Failure[]>;
formattingLinkerFailure?: boolean;
formattingWarning?: boolean;
formattingError?: boolean;
linkerFailure: LinkerFailure;
currentIssue: TestIssue;
constructor(formatter: Formatter);
parse(text: string): void | string;
private updateTestState;
private updateErrorState;
private updateLinkerFailureState;
private shouldFormatError;
private shouldFormatWarning;
private errorOrWarningIsPresent;
private shouldFormatUndefinedSymbols;
private shouldFormatDuplicateSymbols;
private formatCompileError;
private formatCompileWarning;
private formatUndefinedSymbols;
private formatDuplicateSymbols;
private resetLinkerFormatState;
private storeFailure;
private formatSummaryIfNeeded;
private shouldFormatSummary;
}
export {};

549
node_modules/@expo/xcpretty/build/Parser.js generated vendored Normal file
View File

@@ -0,0 +1,549 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parser = void 0;
const path_1 = require("path");
const Matchers_1 = require("./Matchers");
const switchRegex_1 = require("./switchRegex");
function unescaped(args) {
return args.map(v => v.replace(/\\/g, ''));
}
class Parser {
constructor(formatter) {
this.formatter = formatter;
this.formattedSummary = false;
this.failures = {};
this.linkerFailure = {
files: [],
};
this.currentIssue = {};
}
parse(text) {
const matchedErrorResults = this.updateErrorState(text);
if (this.shouldFormatWarning()) {
return this.formatCompileWarning();
}
if (this.shouldFormatError()) {
return this.formatCompileError();
}
if (matchedErrorResults) {
return '';
}
const matchedLinkerResults = this.updateLinkerFailureState(text);
if (this.shouldFormatUndefinedSymbols()) {
return this.formatUndefinedSymbols();
}
if (this.shouldFormatDuplicateSymbols()) {
return this.formatDuplicateSymbols();
}
if (matchedLinkerResults) {
return '';
}
this.updateTestState(text);
const { formatter } = this;
return (0, switchRegex_1.switchRegex)(text, [
[
Matchers_1.Matchers.ANALYZE_MATCHER,
([, $1, $2, $3, $4]) => formatter.formatFileOperation({
type: 'Analyze',
filePath: $1,
fileName: $2,
target: $3,
project: $4,
}),
],
[
Matchers_1.Matchers.BUILD_TARGET_MATCHER,
([, $1, $2, $3]) => formatter.formatTarget({
type: 'Build',
configuration: $3,
target: $1,
project: $2,
}),
],
[
Matchers_1.Matchers.AGGREGATE_TARGET_MATCHER,
([, $1, $2, $3]) => formatter.formatTarget({
type: 'Aggregate',
configuration: $3,
target: $1,
project: $2,
}),
],
[
Matchers_1.Matchers.ANALYZE_TARGET_MATCHER,
([, $1, $2, $3]) => formatter.formatTarget({
type: 'Analyze',
configuration: $3,
target: $1,
project: $2,
}),
],
[Matchers_1.Matchers.CLEAN_REMOVE_MATCHER, ([$0]) => formatter.formatCleanRemove($0)],
[
Matchers_1.Matchers.CLEAN_TARGET_MATCHER,
([, $1, $2, $3]) => formatter.formatTarget({
type: 'Clean',
configuration: $3,
target: $1,
project: $2,
}),
],
[
Matchers_1.Matchers.ANY_COPY_MATCHER,
([, $1, $2, $3, $4, $5]) => {
let from = $3;
let to = $2;
// Flipped with CpResource and CpHeader
if ($1.startsWith('Cp')) {
from = $2;
to = $3;
}
return formatter.formatCopy({ type: $1, from, to, target: $4, project: $5 });
},
],
[Matchers_1.Matchers.CHECK_DEPENDENCIES_MATCHER, ([$0]) => formatter.formatCheckDependencies($0)],
[Matchers_1.Matchers.Errors.CLANG_ERROR_MATCHER, ([, $1]) => formatter.formatError($1)],
[
Matchers_1.Matchers.CODESIGN_FRAMEWORK_MATCHER,
([, $1, $2, $3, $4]) => formatter.formatFileOperation({
type: 'CodeSign',
fileName: $2,
filePath: $1,
target: $3,
project: $4,
}),
],
[
Matchers_1.Matchers.CODESIGN_MATCHER,
([, $1, $2, $3, $4]) => formatter.formatFileOperation({
type: 'CodeSign',
fileName: $2,
filePath: $1,
target: $3,
project: $4,
}),
],
[Matchers_1.Matchers.Errors.CHECK_DEPENDENCIES_ERRORS_MATCHER, ([, $1]) => formatter.formatError($1)],
[
Matchers_1.Matchers.Errors.PROVISIONING_PROFILE_REQUIRED_MATCHER,
([, $1]) => formatter.formatError($1),
],
[Matchers_1.Matchers.Errors.NO_CERTIFICATE_MATCHER, ([, $1]) => formatter.formatError($1)],
[
Matchers_1.Matchers.COMPILE_MATCHER,
([, $1, $2, $3, $4, $5]) => formatter.formatFileOperation({
type: $1,
fileName: $3,
filePath: $2,
target: $4,
project: $5,
}),
],
[Matchers_1.Matchers.COMPILE_COMMAND_MATCHER, ([, $1, $2]) => formatter.formatCompileCommand($1, $2)],
[
Matchers_1.Matchers.COMPILE_XIB_MATCHER,
([, $1, $2, $3, $4]) => formatter.formatFileOperation({
type: 'CompileXIB',
fileName: $2,
filePath: $1,
target: $3,
project: $4,
}),
],
[
Matchers_1.Matchers.COMPILE_STORYBOARD_MATCHER,
([, $1, $2, $3, $4]) => formatter.formatFileOperation({
type: 'CompileStoryboard',
fileName: $2,
filePath: $1,
target: $3,
project: $4,
}),
],
[Matchers_1.Matchers.EXECUTED_MATCHER, () => this.formatSummaryIfNeeded(text)],
[Matchers_1.Matchers.REMARK_MATCHER, ([, $1]) => formatter.formatRemark($1)],
[
Matchers_1.Matchers.COMPILE_SWIFT_SOURCES_MATCHER,
([, , $2, $3, $4, $5, $6]) => formatter.formatCompileSwiftSources($2, $3, $4, $5, $6),
],
[
Matchers_1.Matchers.EMIT_SWIFT_MODULE_MATCHER,
([, , $2, $3, $4, $5]) => formatter.formatEmitSwiftModule($2, $3, $4, $5),
],
[
Matchers_1.Matchers.RESTARTING_TESTS_MATCHER,
() => formatter.formatFailingTest(this.testSuite, this.testCase, 'Test crashed', 'n/a'),
],
[
Matchers_1.Matchers.UI_FAILING_TEST_MATCHER,
([, $1, $2]) => formatter.formatFailingTest(this.testSuite, this.testCase, $2, $1),
],
[
Matchers_1.Matchers.FAILING_TEST_MATCHER,
([, $1, $2, $3, $4]) => formatter.formatFailingTest($2, $3, $4, $1),
],
[Matchers_1.Matchers.Errors.FATAL_ERROR_MATCHER, ([, $1]) => formatter.formatError($1)],
[Matchers_1.Matchers.Errors.RSYNC_ERROR_MATCHER, ([, $1]) => formatter.formatError($1)],
[
Matchers_1.Matchers.Errors.FILE_MISSING_ERROR_MATCHER,
([, $1, $2]) => formatter.formatFileMissingError($1, $2),
],
[
Matchers_1.Matchers.GENERATE_DSYM_MATCHER,
([, $1, $2, $3, $4]) => formatter.formatFileOperation({
type: 'GenerateDSYMFile',
filePath: $1,
fileName: $2,
target: $3,
project: $4,
}),
],
[
Matchers_1.Matchers.Warnings.LD_WARNING_MATCHER,
([, $1, $2]) => {
// Skip printing ld warnings when we're collecting multiline ld duplicate symbol warnings.
if (this.linkerFailure.isWarning) {
return '';
}
return formatter.formatLdWarning($1 + $2);
},
],
[Matchers_1.Matchers.Errors.LD_ERROR_MATCHER, ([, $1]) => formatter.formatError($1)],
[
Matchers_1.Matchers.LIBTOOL_MATCHER,
([, $1, $2, $3, $4]) => formatter.formatFileOperation({
type: 'Libtool',
filePath: $1,
fileName: $2,
target: $3,
project: $4,
}),
],
[
Matchers_1.Matchers.LINKING_MATCHER,
([, $1, $2, $3, $4, $5, $6]) => formatter.formatFileOperation({
type: 'Ld',
filePath: $1,
fileName: $2,
linkType: $3,
arch: $4,
target: $5,
project: $6,
}),
],
[Matchers_1.Matchers.Errors.MODULE_INCLUDES_ERROR_MATCHER, ([, $1]) => formatter.formatError($1)],
[
Matchers_1.Matchers.TEST_CASE_MEASURED_MATCHER,
([, $1, $2, $3]) => formatter.formatMeasuringTest($1, $2, $3),
],
[Matchers_1.Matchers.TEST_CASE_PENDING_MATCHER, ([, $1, $2]) => formatter.formatPendingTest($1, $2)],
[
Matchers_1.Matchers.TEST_CASE_PASSED_MATCHER,
([, $1, $2, $3]) => formatter.formatPassingTest($1, $2, $3),
],
[Matchers_1.Matchers.Errors.PODS_ERROR_MATCHER, ([, $1]) => formatter.formatError($1)],
[
Matchers_1.Matchers.PROCESS_INFO_PLIST_MATCHER,
([, $1, $2, $3, $4]) => {
const [filePath, fileName] = unescaped([$1, $2]);
return formatter.formatFileOperation({
type: 'ProcessInfoPlistFile',
fileName,
filePath,
target: $3,
project: $4,
});
},
],
[
Matchers_1.Matchers.PHASE_SCRIPT_EXECUTION_MATCHER,
// @ts-ignore: spread
([, $1, $2, $3]) => formatter.formatPhaseScriptExecution(...unescaped([$1]), $2, $3),
],
[Matchers_1.Matchers.PHASE_SUCCESS_MATCHER, ([, $1, $2]) => formatter.formatPhaseSuccess($1, $2)],
[
Matchers_1.Matchers.PROCESS_PCH_MATCHER,
([,
// pch / gch
$1,
// filename
$2,
// extra pch
$3,
// type
$4,
// arch
$5, $6, $7,]) => formatter.formatFileOperation({
type: 'ProcessPCH',
filePath: $1,
fileName: $2,
linkType: $4,
arch: $5,
target: $6,
project: $7,
}),
],
[Matchers_1.Matchers.PROCESS_PCH_COMMAND_MATCHER, ([, $1]) => formatter.formatProcessPchCommand($1)],
[Matchers_1.Matchers.PREPROCESS_MATCHER, ([, $1]) => formatter.formatPreprocess($1)],
[
Matchers_1.Matchers.TESTS_RUN_COMPLETION_MATCHER,
([, $1, , $3]) => formatter.formatTestRunFinished($1, $3),
],
[Matchers_1.Matchers.TEST_SUITE_STARTED_MATCHER, ([, $1]) => formatter.formatTestRunStarted($1)],
[Matchers_1.Matchers.TEST_SUITE_START_MATCHER, ([, $1]) => formatter.formatTestSuiteStarted($1)],
[Matchers_1.Matchers.TIFFUTIL_MATCHER, ([, $1]) => formatter.formatTiffutil($1)],
[
Matchers_1.Matchers.TOUCH_MATCHER,
([, $1, $2, $3, $4]) => formatter.formatFileOperation({
type: 'Touch',
filePath: $1,
// file name is undefined in newer projects
fileName: $2 || (0, path_1.basename)($1 || ''),
target: $3,
project: $4,
}),
],
[Matchers_1.Matchers.WRITE_FILE_MATCHER, ([, $1]) => formatter.formatWriteFile($1)],
[Matchers_1.Matchers.WRITE_AUXILIARY_FILES, ([$0]) => formatter.formatWriteAuxiliaryFiles($0)],
[Matchers_1.Matchers.SHELL_COMMAND_MATCHER, ([, $1, $2]) => formatter.formatShellCommand($1, $2)],
[Matchers_1.Matchers.Warnings.GENERIC_WARNING_MATCHER, ([, $1]) => formatter.formatWarning($1)],
[
Matchers_1.Matchers.Warnings.WILL_NOT_BE_CODE_SIGNED_MATCHER,
([, $1]) => formatter.formatWillNotBeCodeSigned($1),
],
[
Matchers_1.Matchers.Errors.COMPILE_ERROR_MATCHER,
([, $1, $2, $3, $4, $5]) => {
return formatter.formatSingleLineCompileIssue('error', $1, $2, $3, $4, $5);
},
],
[
Matchers_1.Matchers.Warnings.COMPILE_WARNING_INLINE_MATCHER,
([, $1, $2, $3, $4, $5]) => {
return formatter.formatSingleLineCompileIssue('warning', $1, $2, $3, $4, $5);
},
],
[null, () => formatter.formatOther(text)],
]);
}
updateTestState(text) {
return (0, switchRegex_1.switchRegex)(text, [
[
Matchers_1.Matchers.TEST_SUITE_STARTED_MATCHER,
() => {
this.testsDone = false;
this.formattedSummary = false;
this.failures = {};
},
],
[
Matchers_1.Matchers.TEST_CASE_STARTED_MATCHER,
([, $1, $2]) => {
this.testSuite = $1;
this.testCase = $2;
},
],
[
Matchers_1.Matchers.TESTS_RUN_COMPLETION_MATCHER,
() => {
this.testsDone = true;
},
],
[
Matchers_1.Matchers.FAILING_TEST_MATCHER,
([, $1, $2, $3, $4]) => this.storeFailure({ file: $1, testSuite: $2, testCase: $3, reason: $4 }),
],
[
Matchers_1.Matchers.UI_FAILING_TEST_MATCHER,
([, $1, $2]) => this.storeFailure({
file: $1,
testSuite: this.testSuite,
testCase: this.testCase,
reason: $2,
}),
],
[
Matchers_1.Matchers.RESTARTING_TESTS_MATCHER,
() => this.storeFailure({
file: 'n/a',
testSuite: this.testSuite,
testCase: this.testCase,
reason: 'Test crashed',
}),
],
], true);
}
updateErrorState(text) {
const updateError = ([, $1, $2, $3]) => {
this.currentIssue.reason = $3;
this.currentIssue.filePath = $1;
this.currentIssue.fileName = $2;
};
const results = (0, switchRegex_1.switchRegex)(text, [
[
Matchers_1.Matchers.Errors.COMPILE_ERROR_MATCHER,
matches => {
// Prevent matching a one-liner error.
if (matches === null || matches === void 0 ? void 0 : matches[4]) {
return 'unmatched';
}
this.formattingError = true;
updateError(matches);
return null;
},
],
[
Matchers_1.Matchers.Warnings.COMPILE_WARNING_MATCHER,
matches => {
// Prevent matching a one-liner warning.
if (matches === null || matches === void 0 ? void 0 : matches[4]) {
return 'unmatched';
}
this.formattingWarning = true;
updateError(matches);
return null;
},
],
[
Matchers_1.Matchers.Errors.CURSOR_MATCHER,
([, $1]) => {
// is trim === chomp ?
this.currentIssue.cursor = $1;
},
],
[
null,
() => {
var _a, _b;
if (this.formattingError || this.formattingWarning) {
// Framework compile errors can have formatting like babel now:
// ' 305 | std::__construct_at(__p, std::forward<_Args>(__args)...);'
// So we need to strip the prefix (' 305 |') portion.
this.currentIssue.line = (_b = (_a = text.match(/^(?:[\s]+\d+ \|\s)?(.*)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : text;
}
return 'unmatched';
},
],
]);
return results !== 'unmatched';
}
updateLinkerFailureState(text) {
const handleLinkerFail = ([, $1]) => {
this.linkerFailure.message = $1;
// Some linker failures can be warnings...
const messageMatch = this.linkerFailure.message.match(/^(ld: )warning: (.*)/m);
if (messageMatch && messageMatch[2]) {
// Format like: `ld: duplicate symbol` to match other ld warnings.
this.linkerFailure.message = messageMatch[1] + messageMatch[2];
this.linkerFailure.isWarning = true;
}
this.formattingLinkerFailure = true;
};
(0, switchRegex_1.switchRegex)(text, [
[Matchers_1.Matchers.Errors.LINKER_UNDEFINED_SYMBOLS_MATCHER, handleLinkerFail],
[Matchers_1.Matchers.Errors.LINKER_DUPLICATE_SYMBOLS_MATCHER, handleLinkerFail],
]);
if (!this.formattingLinkerFailure) {
return false;
}
const results = (0, switchRegex_1.switchRegex)(text, [
[
Matchers_1.Matchers.Errors.SYMBOL_REFERENCED_FROM_MATCHER,
([, $1]) => {
this.linkerFailure.symbol = $1;
},
],
[
Matchers_1.Matchers.Errors.LINKER_UNDEFINED_SYMBOL_LOCATION_MATCHER,
() => {
// TODO: trim === strip ?
this.linkerFailure.reference = text.trim();
},
],
[
Matchers_1.Matchers.Errors.LINKER_DUPLICATE_SYMBOLS_LOCATION_MATCHER,
([, $1]) => {
// TODO: trim === strip ?
this.linkerFailure.files.push($1);
},
],
[
null,
() => {
return 'unmatched';
},
],
]);
return results !== 'unmatched';
}
// TODO: clean up the mess around all this
shouldFormatError() {
return !!this.formattingError && this.errorOrWarningIsPresent();
}
shouldFormatWarning() {
return this.formattingWarning && this.errorOrWarningIsPresent();
}
errorOrWarningIsPresent() {
var _a, _b, _c;
return !!((_a = this.currentIssue) === null || _a === void 0 ? void 0 : _a.reason) && !!((_b = this.currentIssue) === null || _b === void 0 ? void 0 : _b.cursor) && !!((_c = this.currentIssue) === null || _c === void 0 ? void 0 : _c.line);
}
shouldFormatUndefinedSymbols() {
var _a, _b, _c;
return (((_a = this.linkerFailure) === null || _a === void 0 ? void 0 : _a.message) && ((_b = this.linkerFailure) === null || _b === void 0 ? void 0 : _b.symbol) && ((_c = this.linkerFailure) === null || _c === void 0 ? void 0 : _c.reference));
}
shouldFormatDuplicateSymbols() {
var _a, _b, _c;
return ((_a = this.linkerFailure) === null || _a === void 0 ? void 0 : _a.message) && ((_c = (_b = this.linkerFailure) === null || _b === void 0 ? void 0 : _b.files) === null || _c === void 0 ? void 0 : _c.length) > 1;
}
formatCompileError() {
const error = { ...this.currentIssue };
this.currentIssue = {};
this.formattingError = false;
return this.formatter.formatCompileError(error.fileName, error.filePath, error.reason, error.line, error.cursor);
}
formatCompileWarning() {
const warning = { ...this.currentIssue };
this.currentIssue = {};
this.formattingWarning = false;
return this.formatter.formatCompileWarning(warning.fileName, warning.filePath, warning.reason, warning.line, warning.cursor);
}
formatUndefinedSymbols() {
const result = this.formatter.formatUndefinedSymbols(this.linkerFailure.message, this.linkerFailure.symbol, this.linkerFailure.reference);
this.resetLinkerFormatState();
return result;
}
formatDuplicateSymbols() {
const result = this.formatter.formatDuplicateSymbols(this.linkerFailure.message, this.linkerFailure.files, !!this.linkerFailure.isWarning);
this.resetLinkerFormatState();
return result;
}
resetLinkerFormatState() {
this.linkerFailure = { files: [] };
this.formattingLinkerFailure = false;
}
storeFailure({ file, testCase, testSuite, reason, }) {
if (!this.failures) {
this.failures = {};
}
if (!Array.isArray(this.failures[testSuite])) {
this.failures[testSuite] = [];
}
this.failures[testSuite].push({
filePath: file,
reason,
testCase,
});
}
formatSummaryIfNeeded(executedMessage) {
if (!this.shouldFormatSummary()) {
return '';
}
this.formattedSummary = true;
return this.formatter.formatTestSummary(executedMessage, this.failures);
}
shouldFormatSummary() {
return !!this.testsDone && !this.formattedSummary;
}
}
exports.Parser = Parser;
//# sourceMappingURL=Parser.js.map

1
node_modules/@expo/xcpretty/build/Parser.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

14
node_modules/@expo/xcpretty/build/Runner.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
export declare function formatXcodeBuildPipeProcessAsync(projectRoot: string, { xcodeProjectName }?: {
xcodeProjectName?: string;
}): Promise<string>;
export declare function createXcodeBuildHooks(projectRoot: string, { xcodeProjectName, resolve, reject, }: {
xcodeProjectName?: string;
resolve: (buildOutput: string) => void;
reject: (error: Error) => void;
}): {
onData: (data: Buffer) => void;
onErr: (data: Buffer) => void;
onEnd: (code: number) => void;
};
export declare function writeBuildLogs(projectRoot: string, buildOutput: string, errorOutput: string): string;
export declare function getErrorLogFilePath(projectRoot: string): [string, string];

101
node_modules/@expo/xcpretty/build/Runner.js generated vendored Normal file
View File

@@ -0,0 +1,101 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatXcodeBuildPipeProcessAsync = formatXcodeBuildPipeProcessAsync;
exports.createXcodeBuildHooks = createXcodeBuildHooks;
exports.writeBuildLogs = writeBuildLogs;
exports.getErrorLogFilePath = getErrorLogFilePath;
const chalk_1 = __importDefault(require("chalk"));
const fs_1 = __importDefault(require("fs"));
const os_1 = __importDefault(require("os"));
const path_1 = __importDefault(require("path"));
const ExpoRunFormatter_1 = require("./ExpoRunFormatter");
function formatXcodeBuildPipeProcessAsync(projectRoot, { xcodeProjectName } = {}) {
return new Promise(async (resolve, reject) => {
const hooks = createXcodeBuildHooks(projectRoot, { xcodeProjectName, resolve, reject });
process.stdin.on('data', hooks.onData);
process.stdin.on('end', () => {
hooks.onEnd(0);
});
});
}
function createXcodeBuildHooks(projectRoot, { xcodeProjectName, resolve, reject, }) {
const formatter = ExpoRunFormatter_1.ExpoRunFormatter.create(projectRoot, {
xcodeProject: xcodeProjectName ? { name: xcodeProjectName } : undefined,
isDebug: isTruthy(process.env.EXPO_DEBUG),
});
let buildOutput = '';
let errorOutput = '';
let currentBuffer = '';
// Data can be sent in chunks that would have no relevance to our regex
// this can cause massive slowdowns, so we need to ensure the data is complete before attempting to parse it.
function flushBuffer() {
if (!currentBuffer) {
return;
}
const data = currentBuffer;
currentBuffer = '';
const lines = formatter.pipe(data);
for (const line of lines) {
console.log(line);
}
}
const onData = (data) => {
const stringData = data.toString();
buildOutput += stringData;
currentBuffer += stringData;
if (currentBuffer.endsWith(os_1.default.EOL)) {
flushBuffer();
}
};
const onErr = (data) => {
flushBuffer();
const stringData = data instanceof Buffer ? data.toString() : data;
errorOutput += stringData;
};
const onEnd = (code) => {
flushBuffer();
console.log(formatter.getBuildSummary());
const logFilePath = writeBuildLogs(projectRoot, buildOutput, errorOutput);
if (code !== 0) {
// Determine if the logger found any errors;
const wasErrorPresented = !!formatter.errors.length;
const errorTitle = `Failed to build iOS project. "xcodebuild" exited with error code ${code}.`;
if (wasErrorPresented) {
// This has a flaw, if the user is missing a file, and there is a script error, only the missing file error will be shown.
// They will only see the script error if they fix the missing file and rerun.
// The flaw can be fixed by catching script errors in the custom logger.
reject(new Error(errorTitle));
return;
}
// Show all the log info because often times the error is coming from a shell script,
// that invoked a node script, that started metro, which threw an error.
reject(new Error(`${errorTitle}\nTo view more error logs, try building the app with Xcode directly, by opening ${'unknown'}.\n\n` +
buildOutput +
'\n\n' +
errorOutput +
`Build logs written to ${chalk_1.default.underline(logFilePath)}`));
return;
}
resolve(buildOutput);
};
return { onData, onErr, onEnd };
}
function writeBuildLogs(projectRoot, buildOutput, errorOutput) {
const [logFilePath, errorFilePath] = getErrorLogFilePath(projectRoot);
fs_1.default.writeFileSync(logFilePath, buildOutput);
fs_1.default.writeFileSync(errorFilePath, errorOutput);
return logFilePath;
}
function getErrorLogFilePath(projectRoot) {
const folder = path_1.default.join(projectRoot, '.expo');
fs_1.default.mkdirSync(folder, { recursive: true });
return [path_1.default.join(folder, 'xcodebuild.log'), path_1.default.join(folder, 'xcodebuild-error.log')];
}
function isTruthy(value) {
const str = String(value).toLowerCase();
return str === 'true' || str === '1';
}
//# sourceMappingURL=Runner.js.map

1
node_modules/@expo/xcpretty/build/Runner.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
node_modules/@expo/xcpretty/build/cli.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env node
export {};

11
node_modules/@expo/xcpretty/build/cli.js generated vendored Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env node
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const Runner_1 = require("./Runner");
const projectRoot = path_1.default.resolve(process.argv[2] || '.');
(0, Runner_1.formatXcodeBuildPipeProcessAsync)(projectRoot);
//# sourceMappingURL=cli.js.map

1
node_modules/@expo/xcpretty/build/cli.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AACA,gDAAwB;AAExB,qCAA4D;AAE5D,MAAM,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;AAEzD,IAAA,yCAAgC,EAAC,WAAW,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport path from 'path';\n\nimport { formatXcodeBuildPipeProcessAsync } from './Runner';\n\nconst projectRoot = path.resolve(process.argv[2] || '.');\n\nformatXcodeBuildPipeProcessAsync(projectRoot);\n"]}

8
node_modules/@expo/xcpretty/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import * as Runner from './Runner';
export { Parser } from './Parser';
export { MetroParser } from './MetroParser';
export { PodfileTracer } from './utils/PodfileTracer';
export { ExpoRunFormatter, ExpoRunFormatterProps } from './ExpoRunFormatter';
export * from './Formatter';
export { switchRegex } from './switchRegex';
export { Runner };

43
node_modules/@expo/xcpretty/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Runner = exports.switchRegex = exports.ExpoRunFormatter = exports.PodfileTracer = exports.MetroParser = exports.Parser = void 0;
const Runner = __importStar(require("./Runner"));
exports.Runner = Runner;
var Parser_1 = require("./Parser");
Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return Parser_1.Parser; } });
var MetroParser_1 = require("./MetroParser");
Object.defineProperty(exports, "MetroParser", { enumerable: true, get: function () { return MetroParser_1.MetroParser; } });
var PodfileTracer_1 = require("./utils/PodfileTracer");
Object.defineProperty(exports, "PodfileTracer", { enumerable: true, get: function () { return PodfileTracer_1.PodfileTracer; } });
var ExpoRunFormatter_1 = require("./ExpoRunFormatter");
Object.defineProperty(exports, "ExpoRunFormatter", { enumerable: true, get: function () { return ExpoRunFormatter_1.ExpoRunFormatter; } });
__exportStar(require("./Formatter"), exports);
var switchRegex_1 = require("./switchRegex");
Object.defineProperty(exports, "switchRegex", { enumerable: true, get: function () { return switchRegex_1.switchRegex; } });
//# sourceMappingURL=index.js.map

1
node_modules/@expo/xcpretty/build/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAQ1B,wBAAM;AANf,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,uDAA6E;AAApE,oHAAA,gBAAgB,OAAA;AACzB,8CAA4B;AAC5B,6CAA4C;AAAnC,0GAAA,WAAW,OAAA","sourcesContent":["import * as Runner from './Runner';\n\nexport { Parser } from './Parser';\nexport { MetroParser } from './MetroParser';\nexport { PodfileTracer } from './utils/PodfileTracer';\nexport { ExpoRunFormatter, ExpoRunFormatterProps } from './ExpoRunFormatter';\nexport * from './Formatter';\nexport { switchRegex } from './switchRegex';\nexport { Runner };\n"]}

1
node_modules/@expo/xcpretty/build/switchRegex.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function switchRegex(text: string, cases: [RegExp | null, (matches: RegExpMatchArray) => string | void][], isAll?: boolean): string;

19
node_modules/@expo/xcpretty/build/switchRegex.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.switchRegex = switchRegex;
function switchRegex(text, cases, isAll = false) {
for (const [reg, callback] of cases) {
if (!reg) {
return callback(['']) || '';
}
const results = text.match(reg);
if (results) {
const res = callback(results);
if (!isAll) {
return res || '';
}
}
}
return '';
}
//# sourceMappingURL=switchRegex.js.map

1
node_modules/@expo/xcpretty/build/switchRegex.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"switchRegex.js","sourceRoot":"","sources":["../src/switchRegex.ts"],"names":[],"mappings":";;AAAA,kCAkBC;AAlBD,SAAgB,WAAW,CACzB,IAAY,EACZ,KAAsE,EACtE,QAAiB,KAAK;IAEtB,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9B,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO,GAAG,IAAI,EAAE,CAAC;YACnB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["export function switchRegex(\n text: string,\n cases: [RegExp | null, (matches: RegExpMatchArray) => string | void][],\n isAll: boolean = false\n): string {\n for (const [reg, callback] of cases) {\n if (!reg) {\n return callback(['']) || '';\n }\n const results = text.match(reg);\n if (results) {\n const res = callback(results);\n if (!isAll) {\n return res || '';\n }\n }\n }\n return '';\n}\n"]}

View File

@@ -0,0 +1,50 @@
import { PodfileLock } from './parsePodfileLock';
/**
* A utility for tracing dependencies from a Podfile.lock.
*/
export declare class PodfileTracer {
props: {
projectRoot: string;
rootTargetName?: string;
podfile: PodfileLock;
};
static create(projectRoot: string, { xcodeProject }?: {
xcodeProject?: {
name: string;
};
}): PodfileTracer;
get podfile(): PodfileLock;
constructor(props: {
projectRoot: string;
rootTargetName?: string;
podfile: PodfileLock;
});
getNodeModuleNameForTarget: (key: string) => {
name: string;
isRootTarget: boolean;
} | null;
getNodeModuleNameForTargetWithoutCache(target: string): {
name: string;
isRootTarget: boolean;
} | null;
isRootTarget(target: string): boolean | "" | undefined;
getNodeModuleName(filePath: string, target?: string): {
name: string;
isRootTarget: boolean;
} | null;
getExternalSourceForPod: (key: string) => {
pod: string;
source: string;
} | null;
getExternalSourceForPodWithoutCache(pod?: string): {
pod: string;
source: string;
} | null;
private memoizedGetPackageJsonAnyFilePathInModule;
/** This can be a path like `/app/node_modules/expo-camera/ios` or `/app/node_modules/react-native-webrtc` depending on where the podspec is. */
getPackageJsonAnyFilePathInModule(props: {
target: string;
filePath: string;
}): Record<string, any> | null;
getPackageJsonAnyFilePathInModuleWithoutCache(filePath: string): Record<string, any> | null;
}

View File

@@ -0,0 +1,164 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PodfileTracer = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const getFirstExternalSourceForPod_1 = require("./getFirstExternalSourceForPod");
const getNodeModuleName_1 = require("./getNodeModuleName");
const getPackageJsonForPath_1 = require("./getPackageJsonForPath");
const parsePodfileLock_1 = require("./parsePodfileLock");
/**
* A utility for tracing dependencies from a Podfile.lock.
*/
class PodfileTracer {
static create(projectRoot, { xcodeProject } = {}) {
var _a, _b;
const podfileLock = path_1.default.join(projectRoot, 'ios', 'Podfile.lock');
const podfileContents = fs_1.default.readFileSync(podfileLock, 'utf8');
const rootTargetName = ((_a = xcodeProject === null || xcodeProject === void 0 ? void 0 : xcodeProject.name.match(/.*\/(.*)\.\w+/)) === null || _a === void 0 ? void 0 : _a[1]) || '';
const formatter = new PodfileTracer({
projectRoot,
rootTargetName,
podfile: (_b = (0, parsePodfileLock_1.parsePodfileLock)(podfileContents)) !== null && _b !== void 0 ? _b : {},
});
return formatter;
}
get podfile() {
return this.props.podfile || {};
}
constructor(props) {
this.props = props;
// Wrap the expensive method in a cache
this.getNodeModuleNameForTarget = memoize(this.getNodeModuleNameForTargetWithoutCache.bind(this));
this.getExternalSourceForPod = memoize(this.getExternalSourceForPodWithoutCache.bind(this));
this.memoizedGetPackageJsonAnyFilePathInModule = memoizeTrigger(this.getPackageJsonAnyFilePathInModuleWithoutCache.bind(this));
}
getNodeModuleNameForTargetWithoutCache(target) {
if (!target) {
return null;
}
// Check the list of known pods that are hardcoded into the system.
if (target in knownPackages) {
return { name: knownPackages[target], isRootTarget: false };
}
// Check if the target matches the root project.
if (this.isRootTarget(target)) {
// Get the root package.json
const pkg = this.getPackageJsonAnyFilePathInModule({
target,
filePath: this.props.projectRoot,
});
return pkg ? { name: pkg.name, isRootTarget: true } : null;
}
// Otherwise, start tracing for dependencies.
let source = this.getExternalSourceForPod(target);
if (!source) {
// Some modules are formatted incorrectly in Xcode like `EXUpdates-EXUpdates` or `EXConstants-EXConstants`
// here we'll attempt to split the value, ensure there's more than one copy, and that all copies are the same, then we'll check against that new value.
const parts = target.split('-');
if (!!parts[0] && parts.length > 1 && parts.every(s => s === parts[0])) {
source = this.getExternalSourceForPod(parts[0]);
}
}
if (source === null || source === void 0 ? void 0 : source.source) {
// Finally attempt to trace the podspec file.
const pkg = this.getPackageJsonAnyFilePathInModule({
target: source.pod,
filePath: source.source,
});
if (pkg) {
return { name: pkg.name, isRootTarget: false };
}
}
return null;
}
isRootTarget(target) {
return (this.props.rootTargetName &&
(target === this.props.rootTargetName || target === `Pods-${this.props.rootTargetName}`));
}
getNodeModuleName(filePath, target) {
const moduleName = (0, getNodeModuleName_1.getNodeModuleName)(filePath);
if (moduleName) {
return { name: moduleName, isRootTarget: false };
}
else if (!target) {
return null;
}
return this.getNodeModuleNameForTarget(target);
}
getExternalSourceForPodWithoutCache(pod) {
var _a, _b;
if (!pod) {
return null;
}
const results = (0, getFirstExternalSourceForPod_1.getFirstExternalSourceForPod)(this.podfile, { name: pod });
// Keep tracing until we get to a development pod with a local file reference.
const filePath = (_b = (_a = results === null || results === void 0 ? void 0 : results.source[':podspec']) !== null && _a !== void 0 ? _a : results === null || results === void 0 ? void 0 : results.source[':path']) !== null && _b !== void 0 ? _b : null;
if (results && filePath) {
return { pod: results.pod, source: filePath };
}
return null;
}
/** This can be a path like `/app/node_modules/expo-camera/ios` or `/app/node_modules/react-native-webrtc` depending on where the podspec is. */
getPackageJsonAnyFilePathInModule(props) {
return this.memoizedGetPackageJsonAnyFilePathInModule({
key: props.target,
args: [props.filePath],
});
}
getPackageJsonAnyFilePathInModuleWithoutCache(filePath) {
if (!this.props.projectRoot || !filePath) {
return null;
}
const nativeProjectRoot = path_1.default.join(this.props.projectRoot, 'ios');
// In the case of the root level podspec file.
try {
const rootLevelPkgJsonPath = path_1.default.join(nativeProjectRoot, 'package.json');
return require(rootLevelPkgJsonPath);
}
catch {
return (0, getPackageJsonForPath_1.getPackageJsonForPath)(path_1.default.join(nativeProjectRoot, filePath));
}
}
}
exports.PodfileTracer = PodfileTracer;
function memoize(func) {
const cache = {};
return function (key) {
if (key in cache) {
return cache[key];
}
const result = func(key);
cache[key] = result;
return result;
};
}
function memoizeTrigger(func) {
const cache = {};
return function ({ key, args }) {
if (key in cache) {
return cache[key];
}
// @ts-ignore
const result = func(...args);
cache[key] = result;
return result;
};
}
// A list of packages that aren't linked through cocoapods directly.
const knownPackages = {
// Added to ReactCore as a `resource_bundle`
'React-Core-AccessibilityResources': 'react-native',
YogaKit: 'react-native',
// flipper
'Flipper-DoubleConversion': 'react-native',
'Flipper-Folly': 'react-native',
'OpenSSL-Universal': 'react-native',
FlipperKit: 'react-native',
Flipper: 'react-native',
'Flipper-RSocket': 'react-native',
};
//# sourceMappingURL=PodfileTracer.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,20 @@
import { ExternalSource, PodfileLock } from './parsePodfileLock';
export declare function getDependentPods(podfileLock: PodfileLock, { name, version }: {
name: string;
version?: string;
}): string[];
/**
* Find the first "external source" (local file path reference) for a given pod.
*
* @param podfileLock
* @param props.name The pod name to search for.
* @param props.checked A recursive parameter to prevent infinite recursion, not for public use.
* @returns
*/
export declare function getFirstExternalSourceForPod(podfileLock: PodfileLock, { name, checked }: {
name: string;
checked?: string[];
}): {
pod: string;
source: ExternalSource;
} | null;

View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDependentPods = getDependentPods;
exports.getFirstExternalSourceForPod = getFirstExternalSourceForPod;
function getDependentPods(podfileLock, { name, version }) {
if (!podfileLock.pods) {
return [];
}
const hasPodDependency = (pods) => {
for (const podDependency of pods) {
if (podDependency.name === name) {
return !version || podDependency.version === version;
}
if (podDependency.dependencies && hasPodDependency(podDependency.dependencies)) {
return true;
}
}
return false;
};
return podfileLock.pods.reduce((prev, curr) => {
if (curr.name !== name && curr.dependencies && hasPodDependency(curr.dependencies)) {
return [...prev, curr.name];
}
return prev;
}, []);
}
/**
* Find the first "external source" (local file path reference) for a given pod.
*
* @param podfileLock
* @param props.name The pod name to search for.
* @param props.checked A recursive parameter to prevent infinite recursion, not for public use.
* @returns
*/
function getFirstExternalSourceForPod(podfileLock, { name, checked }) {
if (!podfileLock.externalSources) {
return null;
}
if (podfileLock.externalSources[name]) {
return { pod: name, source: podfileLock.externalSources[name] };
}
else if (name.includes('/')) {
// Short cut for pods with a path
const possibleName = name.split('/')[0];
if (podfileLock.externalSources[possibleName]) {
return { pod: possibleName, source: podfileLock.externalSources[possibleName] };
}
}
if (!checked) {
checked = [];
}
checked.push(name);
const dependents = getDependentPods(podfileLock, { name });
for (const dependent of dependents) {
// Prevent pods with cyclic dependencies from causing infinite loops.
if (!checked.includes(dependent)) {
const results = getFirstExternalSourceForPod(podfileLock, { name: dependent, checked });
if (results) {
return results;
}
}
}
return null;
}
//# sourceMappingURL=getFirstExternalSourceForPod.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getFirstExternalSourceForPod.js","sourceRoot":"","sources":["../../src/utils/getFirstExternalSourceForPod.ts"],"names":[],"mappings":";;AAEA,4CA2BC;AAUD,oEAmCC;AAxED,SAAgB,gBAAgB,CAC9B,WAAwB,EACxB,EAAE,IAAI,EAAE,OAAO,EAAsC;IAErD,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,gBAAgB,GAAG,CAAC,IAAqB,EAAE,EAAE;QACjD,KAAK,MAAM,aAAa,IAAI,IAAI,EAAE,CAAC;YACjC,IAAI,aAAa,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBAChC,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO,KAAK,OAAO,CAAC;YACvD,CAAC;YACD,IAAI,aAAa,CAAC,YAAY,IAAI,gBAAgB,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;gBAC/E,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,CAAW,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACtD,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,YAAY,IAAI,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YACnF,OAAO,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,4BAA4B,CAC1C,WAAwB,EACxB,EAAE,IAAI,EAAE,OAAO,EAAwC;IAEvD,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;IAClE,CAAC;SAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,iCAAiC;QACjC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,IAAI,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9C,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;QAClF,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnB,MAAM,UAAU,GAAG,gBAAgB,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAE3D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,qEAAqE;QACrE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACjC,MAAM,OAAO,GAAG,4BAA4B,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;YACxF,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { ExternalSource, PodDependency, PodfileLock } from './parsePodfileLock';\n\nexport function getDependentPods(\n podfileLock: PodfileLock,\n { name, version }: { name: string; version?: string }\n): string[] {\n if (!podfileLock.pods) {\n return [];\n }\n\n const hasPodDependency = (pods: PodDependency[]) => {\n for (const podDependency of pods) {\n if (podDependency.name === name) {\n return !version || podDependency.version === version;\n }\n if (podDependency.dependencies && hasPodDependency(podDependency.dependencies)) {\n return true;\n }\n }\n return false;\n };\n\n return podfileLock.pods.reduce<string[]>((prev, curr) => {\n if (curr.name !== name && curr.dependencies && hasPodDependency(curr.dependencies)) {\n return [...prev, curr.name];\n }\n\n return prev;\n }, []);\n}\n\n/**\n * Find the first \"external source\" (local file path reference) for a given pod.\n *\n * @param podfileLock\n * @param props.name The pod name to search for.\n * @param props.checked A recursive parameter to prevent infinite recursion, not for public use.\n * @returns\n */\nexport function getFirstExternalSourceForPod(\n podfileLock: PodfileLock,\n { name, checked }: { name: string; checked?: string[] }\n): { pod: string; source: ExternalSource } | null {\n if (!podfileLock.externalSources) {\n return null;\n }\n\n if (podfileLock.externalSources[name]) {\n return { pod: name, source: podfileLock.externalSources[name] };\n } else if (name.includes('/')) {\n // Short cut for pods with a path\n const possibleName = name.split('/')[0];\n if (podfileLock.externalSources[possibleName]) {\n return { pod: possibleName, source: podfileLock.externalSources[possibleName] };\n }\n }\n\n if (!checked) {\n checked = [];\n }\n checked.push(name);\n\n const dependents = getDependentPods(podfileLock, { name });\n\n for (const dependent of dependents) {\n // Prevent pods with cyclic dependencies from causing infinite loops.\n if (!checked.includes(dependent)) {\n const results = getFirstExternalSourceForPod(podfileLock, { name: dependent, checked });\n if (results) {\n return results;\n }\n }\n }\n return null;\n}\n"]}

View File

@@ -0,0 +1 @@
export declare function getNodeModuleName(filePath: string): string | null;

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNodeModuleName = getNodeModuleName;
function moduleNameFromPath(modulePath) {
if (modulePath.startsWith('@')) {
const [org, packageName] = modulePath.split('/');
if (org && packageName) {
return [org, packageName].join('/');
}
return modulePath;
}
const [packageName] = modulePath.split('/');
return packageName ? packageName : modulePath;
}
const NODE_MODULE_PATTERN = /node_modules(\/\.(pnpm|store)\/.*\/node_modules)?\//i;
function getNodeModuleName(filePath) {
// '/<project>/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'
// '/<project>/node_modules/.pnpm/react-native@0.73.1_@babel+core@7.20.2_react@18.2.0/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'
// '/<project>/node_modules/.store/react-native@0.73.1-OKL2xQk6utgOIuOl3VvO_g/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'
const [, , , modulePath] = filePath.split(NODE_MODULE_PATTERN);
if (modulePath) {
return moduleNameFromPath(modulePath);
}
return null;
}
//# sourceMappingURL=getNodeModuleName.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getNodeModuleName.js","sourceRoot":"","sources":["../../src/utils/getNodeModuleName.ts"],"names":[],"mappings":";;AAcA,8CASC;AAvBD,SAAS,kBAAkB,CAAC,UAAkB;IAC5C,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjD,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,MAAM,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5C,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC;AAChD,CAAC;AAED,MAAM,mBAAmB,GAAG,sDAAsD,CAAC;AAEnF,SAAgB,iBAAiB,CAAC,QAAgB;IAChD,wGAAwG;IACxG,+KAA+K;IAC/K,uKAAuK;IACvK,MAAM,CAAC,EAAE,AAAD,EAAG,AAAD,EAAG,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC/D,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["function moduleNameFromPath(modulePath: string) {\n if (modulePath.startsWith('@')) {\n const [org, packageName] = modulePath.split('/');\n if (org && packageName) {\n return [org, packageName].join('/');\n }\n return modulePath;\n }\n const [packageName] = modulePath.split('/');\n return packageName ? packageName : modulePath;\n}\n\nconst NODE_MODULE_PATTERN = /node_modules(\\/\\.(pnpm|store)\\/.*\\/node_modules)?\\//i;\n\nexport function getNodeModuleName(filePath: string): string | null {\n // '/<project>/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'\n // '/<project>/node_modules/.pnpm/react-native@0.73.1_@babel+core@7.20.2_react@18.2.0/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'\n // '/<project>/node_modules/.store/react-native@0.73.1-OKL2xQk6utgOIuOl3VvO_g/node_modules/react-native/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp'\n const [, , , modulePath] = filePath.split(NODE_MODULE_PATTERN);\n if (modulePath) {\n return moduleNameFromPath(modulePath);\n }\n return null;\n}\n"]}

View File

@@ -0,0 +1 @@
export declare const getPackageJsonForPath: (root: string) => any;

View File

@@ -0,0 +1,19 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPackageJsonForPath = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const getPackageJsonForPath = (root) => {
for (let dir = root; path_1.default.dirname(dir) !== dir; dir = path_1.default.dirname(dir)) {
const file = path_1.default.resolve(dir, 'package.json');
if (fs_1.default.existsSync(file)) {
return require(file);
}
}
return null;
};
exports.getPackageJsonForPath = getPackageJsonForPath;
//# sourceMappingURL=getPackageJsonForPath.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getPackageJsonForPath.js","sourceRoot":"","sources":["../../src/utils/getPackageJsonForPath.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAEjB,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAO,EAAE;IACzD,KAAK,IAAI,GAAG,GAAG,IAAI,EAAE,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QAC/C,IAAI,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nexport const getPackageJsonForPath = (root: string): any => {\n for (let dir = root; path.dirname(dir) !== dir; dir = path.dirname(dir)) {\n const file = path.resolve(dir, 'package.json');\n if (fs.existsSync(file)) {\n return require(file);\n }\n }\n return null;\n};\n"]}

View File

@@ -0,0 +1,31 @@
export interface PodDependency {
name: string;
version?: string;
dependencies?: PodDependency[];
}
export interface ExternalSource {
/** "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" */
':podspec'?: string;
/** "../node_modules/expo-application/ios" */
':path'?: string;
}
export interface PodfileLock {
pods?: PodDependency[];
/** "1.11.2" */
cocoapods?: string;
externalSources?: Record<string, ExternalSource>;
/** 73e35020f8f5d49ffd32debe3c1bdd501f8029a6 */
podfileChecksum?: string;
/** { "DoubleConversion": "cf9b38bf0b2d048436d9a82ad2abe1404f11e7de" } */
specChecksums?: Record<string, string>;
}
/**
* Parses a podfile.lock file from from YAML into a JSON object.
*
* @param str Podfile.lock file contents in YAML format.
* @returns
*/
export declare function loadPodfileLock(str: string): null | Record<string, any>;
export declare const parsePodDependency: (pod: string | Record<string, string | Record<string, any>>) => PodDependency[];
export declare function parsePodfileLock(fileContent: string): PodfileLock | null;
export declare function getFilePathForExternalSource(podLock: PodfileLock, pod: string): string | null;

View File

@@ -0,0 +1,84 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parsePodDependency = void 0;
exports.loadPodfileLock = loadPodfileLock;
exports.parsePodfileLock = parsePodfileLock;
exports.getFilePathForExternalSource = getFilePathForExternalSource;
const js_yaml_1 = require("js-yaml");
const EXTERNAL_SOURCES_KEY = 'EXTERNAL SOURCES';
/**
* Parses a podfile.lock file from from YAML into a JSON object.
*
* @param str Podfile.lock file contents in YAML format.
* @returns
*/
function loadPodfileLock(str) {
const contents = (0, js_yaml_1.load)(str);
if (!contents || typeof contents !== 'object') {
return null;
}
return contents;
}
const parsePodDependency = (pod) => {
if (typeof pod === 'string') {
// js-yaml fails to parse an array with a single item and instead formats it as a string divided by a `-` (hyphen).
// Here we match if a hyphen comes after a space. We use fake-nested-Podfile to test this hack.
const singleItemArrayBug = pod.match(/(.*)\s-\s(.*)/);
if (singleItemArrayBug === null || singleItemArrayBug === void 0 ? void 0 : singleItemArrayBug[2]) {
return (0, exports.parsePodDependency)({ [singleItemArrayBug[1]]: singleItemArrayBug[2] });
}
return [splitPodNameVersion(pod)];
}
return Object.entries(pod).map(([k, v]) => {
const results = splitPodNameVersion(k);
if (Array.isArray(v)) {
return {
...results,
dependencies: v.map(x => (0, exports.parsePodDependency)(x)).flat(),
};
}
else if (typeof v === 'string') {
return {
...results,
dependencies: (0, exports.parsePodDependency)(v),
};
}
return results;
});
};
exports.parsePodDependency = parsePodDependency;
function parsePodfileLock(fileContent) {
var _a;
const contents = (_a = loadPodfileLock(fileContent)) !== null && _a !== void 0 ? _a : loadPodfileLock(EXTERNAL_SOURCES_KEY + fileContent.split(EXTERNAL_SOURCES_KEY).slice(1));
if (!contents) {
return null;
}
const parsed = Object.entries(contents).reduce((acc, [key, value]) => {
return {
...acc,
[kebabCaseToCamelCase(rubyCaseToKebab(key))]: value,
};
}, {});
if (Array.isArray(parsed.pods)) {
const parsedPods = parsed.pods.map(exports.parsePodDependency);
parsed.pods = parsedPods.flat();
}
return parsed;
}
function splitPodNameVersion(pod) {
var _a;
const [name] = pod.split(' ');
return { name, version: (_a = pod.match(/\((.*)\)/)) === null || _a === void 0 ? void 0 : _a[1] };
}
function rubyCaseToKebab(str) {
return str.toLowerCase().split(' ').join('-');
}
function kebabCaseToCamelCase(str) {
return str.replace(/-([a-z])/g, g => g[1].toUpperCase());
}
function getFilePathForExternalSource(podLock, pod) {
var _a, _b, _c;
const source = (_a = podLock.externalSources) === null || _a === void 0 ? void 0 : _a[pod];
return (_c = (_b = source === null || source === void 0 ? void 0 : source[':podspec']) !== null && _b !== void 0 ? _b : source === null || source === void 0 ? void 0 : source[':path']) !== null && _c !== void 0 ? _c : null;
}
//# sourceMappingURL=parsePodfileLock.js.map

File diff suppressed because one or more lines are too long

9
node_modules/@expo/xcpretty/build/utils/symbols.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
export declare const PASS = "\u2713";
export declare const FAIL = "\u2717";
export declare const PENDING = "\u29D6";
export declare const COMPLETION = "\u203A";
export declare const MEASURE = "\u25F7";
export declare const ERROR: string;
export declare const WARNING: string;
export declare const INDENT = " ";
export declare const BREADCRUMB = "\u00BB";

14
node_modules/@expo/xcpretty/build/utils/symbols.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BREADCRUMB = exports.INDENT = exports.WARNING = exports.ERROR = exports.MEASURE = exports.COMPLETION = exports.PENDING = exports.FAIL = exports.PASS = void 0;
const USE_ASCII = false;
exports.PASS = '✓';
exports.FAIL = '✗';
exports.PENDING = '⧖';
exports.COMPLETION = '\u203A'; //'▸';
exports.MEASURE = '◷';
exports.ERROR = USE_ASCII ? '[x]' : '❌ ';
exports.WARNING = USE_ASCII ? '[!]' : '⚠️ ';
exports.INDENT = ' ';
exports.BREADCRUMB = '»';
//# sourceMappingURL=symbols.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/utils/symbols.ts"],"names":[],"mappings":";;;AAAA,MAAM,SAAS,GAAG,KAAK,CAAC;AAEX,QAAA,IAAI,GAAG,GAAG,CAAC;AACX,QAAA,IAAI,GAAG,GAAG,CAAC;AACX,QAAA,OAAO,GAAG,GAAG,CAAC;AACd,QAAA,UAAU,GAAG,QAAQ,CAAC,CAAC,MAAM;AAC7B,QAAA,OAAO,GAAG,GAAG,CAAC;AACd,QAAA,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACjC,QAAA,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACpC,QAAA,MAAM,GAAG,MAAM,CAAC;AAChB,QAAA,UAAU,GAAG,GAAG,CAAC","sourcesContent":["const USE_ASCII = false;\n\nexport const PASS = '✓';\nexport const FAIL = '✗';\nexport const PENDING = '⧖';\nexport const COMPLETION = '\\u203A'; //'▸';\nexport const MEASURE = '◷';\nexport const ERROR = USE_ASCII ? '[x]' : '❌ ';\nexport const WARNING = USE_ASCII ? '[!]' : '⚠️ ';\nexport const INDENT = ' ';\nexport const BREADCRUMB = '»';\n"]}

1
node_modules/@expo/xcpretty/node_modules/.bin/js-yaml generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../js-yaml/bin/js-yaml.js

View File

@@ -0,0 +1,216 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.1] - 2020-08-29
### Fixed
- Fix issue with `process.argv` when used with interpreters (`coffee`, `ts-node`, etc.), #150.
## [2.0.0] - 2020-08-14
### Changed
- Full rewrite. Now port from python 3.9.0 & more precise following.
See [doc](./doc) for difference and migration info.
- node.js 10+ required
- Removed most of local docs in favour of original ones.
## [1.0.10] - 2018-02-15
### Fixed
- Use .concat instead of + for arrays, #122.
## [1.0.9] - 2016-09-29
### Changed
- Rerelease after 1.0.8 - deps cleanup.
## [1.0.8] - 2016-09-29
### Changed
- Maintenance (deps bump, fix node 6.5+ tests, coverage report).
## [1.0.7] - 2016-03-17
### Changed
- Teach `addArgument` to accept string arg names. #97, @tomxtobin.
## [1.0.6] - 2016-02-06
### Changed
- Maintenance: moved to eslint & updated CS.
## [1.0.5] - 2016-02-05
### Changed
- Removed lodash dependency to significantly reduce install size.
Thanks to @mourner.
## [1.0.4] - 2016-01-17
### Changed
- Maintenance: lodash update to 4.0.0.
## [1.0.3] - 2015-10-27
### Fixed
- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple.
## [1.0.2] - 2015-03-22
### Changed
- Relaxed lodash version dependency.
## [1.0.1] - 2015-02-20
### Changed
- Changed dependencies to be compatible with ancient nodejs.
## [1.0.0] - 2015-02-19
### Changed
- Maintenance release.
- Replaced `underscore` with `lodash`.
- Bumped version to 1.0.0 to better reflect semver meaning.
- HISTORY.md -> CHANGELOG.md
## [0.1.16] - 2013-12-01
### Changed
- Maintenance release. Updated dependencies and docs.
## [0.1.15] - 2013-05-13
### Fixed
- Fixed #55, @trebor89
## [0.1.14] - 2013-05-12
### Fixed
- Fixed #62, @maxtaco
## [0.1.13] - 2013-04-08
### Changed
- Added `.npmignore` to reduce package size
## [0.1.12] - 2013-02-10
### Fixed
- Fixed conflictHandler (#46), @hpaulj
## [0.1.11] - 2013-02-07
### Added
- Added 70+ tests (ported from python), @hpaulj
- Added conflictHandler, @applepicke
- Added fromfilePrefixChar, @hpaulj
### Fixed
- Multiple bugfixes, @hpaulj
## [0.1.10] - 2012-12-30
### Added
- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion)
support, thanks to @hpaulj
### Fixed
- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj
## [0.1.9] - 2012-12-27
### Fixed
- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj
- Fixed default value behavior with `*` positionals, thanks to @hpaulj
- Improve `getDefault()` behavior, thanks to @hpaulj
- Improve negative argument parsing, thanks to @hpaulj
## [0.1.8] - 2012-12-01
### Fixed
- Fixed parser parents (issue #19), thanks to @hpaulj
- Fixed negative argument parse (issue #20), thanks to @hpaulj
## [0.1.7] - 2012-10-14
### Fixed
- Fixed 'choices' argument parse (issue #16)
- Fixed stderr output (issue #15)
## [0.1.6] - 2012-09-09
### Fixed
- Fixed check for conflict of options (thanks to @tomxtobin)
## [0.1.5] - 2012-09-03
### Fixed
- Fix parser #setDefaults method (thanks to @tomxtobin)
## [0.1.4] - 2012-07-30
### Fixed
- Fixed pseudo-argument support (thanks to @CGamesPlay)
- Fixed addHelp default (should be true), if not set (thanks to @benblank)
## [0.1.3] - 2012-06-27
### Fixed
- Fixed formatter api name: Formatter -> HelpFormatter
## [0.1.2] - 2012-05-29
### Fixed
- Removed excess whitespace in help
- Fixed error reporting, when parcer with subcommands
called with empty arguments
### Added
- Added basic tests
## [0.1.1] - 2012-05-23
### Fixed
- Fixed line wrapping in help formatter
- Added better error reporting on invalid arguments
## [0.1.0] - 2012-05-16
### Added
- First release.
[2.0.1]: https://github.com/nodeca/argparse/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/nodeca/argparse/compare/1.0.10...2.0.0
[1.0.10]: https://github.com/nodeca/argparse/compare/1.0.9...1.0.10
[1.0.9]: https://github.com/nodeca/argparse/compare/1.0.8...1.0.9
[1.0.8]: https://github.com/nodeca/argparse/compare/1.0.7...1.0.8
[1.0.7]: https://github.com/nodeca/argparse/compare/1.0.6...1.0.7
[1.0.6]: https://github.com/nodeca/argparse/compare/1.0.5...1.0.6
[1.0.5]: https://github.com/nodeca/argparse/compare/1.0.4...1.0.5
[1.0.4]: https://github.com/nodeca/argparse/compare/1.0.3...1.0.4
[1.0.3]: https://github.com/nodeca/argparse/compare/1.0.2...1.0.3
[1.0.2]: https://github.com/nodeca/argparse/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/nodeca/argparse/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/nodeca/argparse/compare/0.1.16...1.0.0
[0.1.16]: https://github.com/nodeca/argparse/compare/0.1.15...0.1.16
[0.1.15]: https://github.com/nodeca/argparse/compare/0.1.14...0.1.15
[0.1.14]: https://github.com/nodeca/argparse/compare/0.1.13...0.1.14
[0.1.13]: https://github.com/nodeca/argparse/compare/0.1.12...0.1.13
[0.1.12]: https://github.com/nodeca/argparse/compare/0.1.11...0.1.12
[0.1.11]: https://github.com/nodeca/argparse/compare/0.1.10...0.1.11
[0.1.10]: https://github.com/nodeca/argparse/compare/0.1.9...0.1.10
[0.1.9]: https://github.com/nodeca/argparse/compare/0.1.8...0.1.9
[0.1.8]: https://github.com/nodeca/argparse/compare/0.1.7...0.1.8
[0.1.7]: https://github.com/nodeca/argparse/compare/0.1.6...0.1.7
[0.1.6]: https://github.com/nodeca/argparse/compare/0.1.5...0.1.6
[0.1.5]: https://github.com/nodeca/argparse/compare/0.1.4...0.1.5
[0.1.4]: https://github.com/nodeca/argparse/compare/0.1.3...0.1.4
[0.1.3]: https://github.com/nodeca/argparse/compare/0.1.2...0.1.3
[0.1.2]: https://github.com/nodeca/argparse/compare/0.1.1...0.1.2
[0.1.1]: https://github.com/nodeca/argparse/compare/0.1.0...0.1.1
[0.1.0]: https://github.com/nodeca/argparse/releases/tag/0.1.0

View File

@@ -0,0 +1,254 @@
A. HISTORY OF THE SOFTWARE
==========================
Python was created in the early 1990s by Guido van Rossum at Stichting
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
as a successor of a language called ABC. Guido remains Python's
principal author, although it includes many contributions from others.
In 1995, Guido continued his work on Python at the Corporation for
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
in Reston, Virginia where he released several versions of the
software.
In May 2000, Guido and the Python core development team moved to
BeOpen.com to form the BeOpen PythonLabs team. In October of the same
year, the PythonLabs team moved to Digital Creations, which became
Zope Corporation. In 2001, the Python Software Foundation (PSF, see
https://www.python.org/psf/) was formed, a non-profit organization
created specifically to own Python-related Intellectual Property.
Zope Corporation was a sponsoring member of the PSF.
All Python releases are Open Source (see http://www.opensource.org for
the Open Source Definition). Historically, most, but not all, Python
releases have also been GPL-compatible; the table below summarizes
the various releases.
Release Derived Year Owner GPL-
from compatible? (1)
0.9.0 thru 1.2 1991-1995 CWI yes
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
1.6 1.5.2 2000 CNRI no
2.0 1.6 2000 BeOpen.com no
1.6.1 1.6 2001 CNRI yes (2)
2.1 2.0+1.6.1 2001 PSF no
2.0.1 2.0+1.6.1 2001 PSF yes
2.1.1 2.1+2.0.1 2001 PSF yes
2.1.2 2.1.1 2002 PSF yes
2.1.3 2.1.2 2002 PSF yes
2.2 and above 2.1.1 2001-now PSF yes
Footnotes:
(1) GPL-compatible doesn't mean that we're distributing Python under
the GPL. All Python licenses, unlike the GPL, let you distribute
a modified version without making your changes open source. The
GPL-compatible licenses make it possible to combine Python with
other software that is released under the GPL; the others don't.
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
because its license has a choice of law clause. According to
CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
is "not incompatible" with the GPL.
Thanks to the many outside volunteers who have worked under Guido's
direction to make these releases possible.
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
===============================================================
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.
4. PSF is making Python available to Licensee on an "AS IS"
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
-------------------------------------------
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
Individual or Organization ("Licensee") accessing and otherwise using
this software in source or binary form and its associated
documentation ("the Software").
2. Subject to the terms and conditions of this BeOpen Python License
Agreement, BeOpen hereby grants Licensee a non-exclusive,
royalty-free, world-wide license to reproduce, analyze, test, perform
and/or display publicly, prepare derivative works, distribute, and
otherwise use the Software alone or in any derivative version,
provided, however, that the BeOpen Python License is retained in the
Software, alone or in any derivative version prepared by Licensee.
3. BeOpen is making the Software available to Licensee on an "AS IS"
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
5. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
6. This License Agreement shall be governed by and interpreted in all
respects by the law of the State of California, excluding conflict of
law provisions. Nothing in this License Agreement shall be deemed to
create any relationship of agency, partnership, or joint venture
between BeOpen and Licensee. This License Agreement does not grant
permission to use BeOpen trademarks or trade names in a trademark
sense to endorse or promote products or services of Licensee, or any
third party. As an exception, the "BeOpen Python" logos available at
http://www.pythonlabs.com/logos.html may be used according to the
permissions granted on that web page.
7. By copying, installing or otherwise using the software, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
---------------------------------------
1. This LICENSE AGREEMENT is between the Corporation for National
Research Initiatives, having an office at 1895 Preston White Drive,
Reston, VA 20191 ("CNRI"), and the Individual or Organization
("Licensee") accessing and otherwise using Python 1.6.1 software in
source or binary form and its associated documentation.
2. Subject to the terms and conditions of this License Agreement, CNRI
hereby grants Licensee a nonexclusive, royalty-free, world-wide
license to reproduce, analyze, test, perform and/or display publicly,
prepare derivative works, distribute, and otherwise use Python 1.6.1
alone or in any derivative version, provided, however, that CNRI's
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
1995-2001 Corporation for National Research Initiatives; All Rights
Reserved" are retained in Python 1.6.1 alone or in any derivative
version prepared by Licensee. Alternately, in lieu of CNRI's License
Agreement, Licensee may substitute the following text (omitting the
quotes): "Python 1.6.1 is made available subject to the terms and
conditions in CNRI's License Agreement. This Agreement together with
Python 1.6.1 may be located on the Internet using the following
unique, persistent identifier (known as a handle): 1895.22/1013. This
Agreement may also be obtained from a proxy server on the Internet
using the following URL: http://hdl.handle.net/1895.22/1013".
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python 1.6.1 or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python 1.6.1.
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. This License Agreement shall be governed by the federal
intellectual property law of the United States, including without
limitation the federal copyright law, and, to the extent such
U.S. federal law does not apply, by the law of the Commonwealth of
Virginia, excluding Virginia's conflict of law provisions.
Notwithstanding the foregoing, with regard to derivative works based
on Python 1.6.1 that incorporate non-separable material that was
previously distributed under the GNU General Public License (GPL), the
law of the Commonwealth of Virginia shall govern this License
Agreement only as to issues arising under or with respect to
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
License Agreement shall be deemed to create any relationship of
agency, partnership, or joint venture between CNRI and Licensee. This
License Agreement does not grant permission to use CNRI trademarks or
trade name in a trademark sense to endorse or promote products or
services of Licensee, or any third party.
8. By clicking on the "ACCEPT" button where indicated, or by copying,
installing or otherwise using Python 1.6.1, Licensee agrees to be
bound by the terms and conditions of this License Agreement.
ACCEPT
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
--------------------------------------------------
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
The Netherlands. All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,84 @@
argparse
========
[![Build Status](https://secure.travis-ci.org/nodeca/argparse.svg?branch=master)](http://travis-ci.org/nodeca/argparse)
[![NPM version](https://img.shields.io/npm/v/argparse.svg)](https://www.npmjs.org/package/argparse)
CLI arguments parser for node.js, with [sub-commands](https://docs.python.org/3.9/library/argparse.html#sub-commands) support. Port of python's [argparse](http://docs.python.org/dev/library/argparse.html) (version [3.9.0](https://github.com/python/cpython/blob/v3.9.0rc1/Lib/argparse.py)).
**Difference with original.**
- JS has no keyword arguments support.
- Pass options instead: `new ArgumentParser({ description: 'example', add_help: true })`.
- JS has no python's types `int`, `float`, ...
- Use string-typed names: `.add_argument('-b', { type: 'int', help: 'help' })`.
- `%r` format specifier uses `require('util').inspect()`.
More details in [doc](./doc).
Example
-------
`test.js` file:
```javascript
#!/usr/bin/env node
'use strict';
const { ArgumentParser } = require('argparse');
const { version } = require('./package.json');
const parser = new ArgumentParser({
description: 'Argparse example'
});
parser.add_argument('-v', '--version', { action: 'version', version });
parser.add_argument('-f', '--foo', { help: 'foo bar' });
parser.add_argument('-b', '--bar', { help: 'bar foo' });
parser.add_argument('--baz', { help: 'baz bar' });
console.dir(parser.parse_args());
```
Display help:
```
$ ./test.js -h
usage: test.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ]
Argparse example
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-f FOO, --foo FOO foo bar
-b BAR, --bar BAR bar foo
--baz BAZ baz bar
```
Parse arguments:
```
$ ./test.js -f=3 --bar=4 --baz 5
{ foo: '3', bar: '4', baz: '5' }
```
API docs
--------
Since this is a port with minimal divergence, there's no separate documentation.
Use original one instead, with notes about difference.
1. [Original doc](https://docs.python.org/3.9/library/argparse.html).
2. [Original tutorial](https://docs.python.org/3.9/howto/argparse.html).
3. [Difference with python](./doc).
argparse for enterprise
-----------------------
Available as part of the Tidelift Subscription
The maintainers of argparse and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-argparse?utm_source=npm-argparse&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
// Limited implementation of python % string operator, supports only %s and %r for now
// (other formats are not used here, but may appear in custom templates)
'use strict'
const { inspect } = require('util')
module.exports = function sub(pattern, ...values) {
let regex = /%(?:(%)|(-)?(\*)?(?:\((\w+)\))?([A-Za-z]))/g
let result = pattern.replace(regex, function (_, is_literal, is_left_align, is_padded, name, format) {
if (is_literal) return '%'
let padded_count = 0
if (is_padded) {
if (values.length === 0) throw new TypeError('not enough arguments for format string')
padded_count = values.shift()
if (!Number.isInteger(padded_count)) throw new TypeError('* wants int')
}
let str
if (name !== undefined) {
let dict = values[0]
if (typeof dict !== 'object' || dict === null) throw new TypeError('format requires a mapping')
if (!(name in dict)) throw new TypeError(`no such key: '${name}'`)
str = dict[name]
} else {
if (values.length === 0) throw new TypeError('not enough arguments for format string')
str = values.shift()
}
switch (format) {
case 's':
str = String(str)
break
case 'r':
str = inspect(str)
break
case 'd':
case 'i':
if (typeof str !== 'number') {
throw new TypeError(`%${format} format: a number is required, not ${typeof str}`)
}
str = String(str.toFixed(0))
break
default:
throw new TypeError(`unsupported format character '${format}'`)
}
if (padded_count > 0) {
return is_left_align ? str.padEnd(padded_count) : str.padStart(padded_count)
} else {
return str
}
})
if (values.length) {
if (values.length === 1 && typeof values[0] === 'object' && values[0] !== null) {
// mapping
} else {
throw new TypeError('not all arguments converted during string formatting')
}
}
return result
}

View File

@@ -0,0 +1,440 @@
// Partial port of python's argparse module, version 3.9.0 (only wrap and fill functions):
// https://github.com/python/cpython/blob/v3.9.0b4/Lib/textwrap.py
'use strict'
/*
* Text wrapping and filling.
*/
// Copyright (C) 1999-2001 Gregory P. Ward.
// Copyright (C) 2002, 2003 Python Software Foundation.
// Copyright (C) 2020 argparse.js authors
// Originally written by Greg Ward <gward@python.net>
// Hardcode the recognized whitespace characters to the US-ASCII
// whitespace characters. The main reason for doing this is that
// some Unicode spaces (like \u00a0) are non-breaking whitespaces.
//
// This less funky little regex just split on recognized spaces. E.g.
// "Hello there -- you goof-ball, use the -b option!"
// splits into
// Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/
const wordsep_simple_re = /([\t\n\x0b\x0c\r ]+)/
class TextWrapper {
/*
* Object for wrapping/filling text. The public interface consists of
* the wrap() and fill() methods; the other methods are just there for
* subclasses to override in order to tweak the default behaviour.
* If you want to completely replace the main wrapping algorithm,
* you'll probably have to override _wrap_chunks().
*
* Several instance attributes control various aspects of wrapping:
* width (default: 70)
* the maximum width of wrapped lines (unless break_long_words
* is false)
* initial_indent (default: "")
* string that will be prepended to the first line of wrapped
* output. Counts towards the line's width.
* subsequent_indent (default: "")
* string that will be prepended to all lines save the first
* of wrapped output; also counts towards each line's width.
* expand_tabs (default: true)
* Expand tabs in input text to spaces before further processing.
* Each tab will become 0 .. 'tabsize' spaces, depending on its position
* in its line. If false, each tab is treated as a single character.
* tabsize (default: 8)
* Expand tabs in input text to 0 .. 'tabsize' spaces, unless
* 'expand_tabs' is false.
* replace_whitespace (default: true)
* Replace all whitespace characters in the input text by spaces
* after tab expansion. Note that if expand_tabs is false and
* replace_whitespace is true, every tab will be converted to a
* single space!
* fix_sentence_endings (default: false)
* Ensure that sentence-ending punctuation is always followed
* by two spaces. Off by default because the algorithm is
* (unavoidably) imperfect.
* break_long_words (default: true)
* Break words longer than 'width'. If false, those words will not
* be broken, and some lines might be longer than 'width'.
* break_on_hyphens (default: true)
* Allow breaking hyphenated words. If true, wrapping will occur
* preferably on whitespaces and right after hyphens part of
* compound words.
* drop_whitespace (default: true)
* Drop leading and trailing whitespace from lines.
* max_lines (default: None)
* Truncate wrapped lines.
* placeholder (default: ' [...]')
* Append to the last line of truncated text.
*/
constructor(options = {}) {
let {
width = 70,
initial_indent = '',
subsequent_indent = '',
expand_tabs = true,
replace_whitespace = true,
fix_sentence_endings = false,
break_long_words = true,
drop_whitespace = true,
break_on_hyphens = true,
tabsize = 8,
max_lines = undefined,
placeholder=' [...]'
} = options
this.width = width
this.initial_indent = initial_indent
this.subsequent_indent = subsequent_indent
this.expand_tabs = expand_tabs
this.replace_whitespace = replace_whitespace
this.fix_sentence_endings = fix_sentence_endings
this.break_long_words = break_long_words
this.drop_whitespace = drop_whitespace
this.break_on_hyphens = break_on_hyphens
this.tabsize = tabsize
this.max_lines = max_lines
this.placeholder = placeholder
}
// -- Private methods -----------------------------------------------
// (possibly useful for subclasses to override)
_munge_whitespace(text) {
/*
* _munge_whitespace(text : string) -> string
*
* Munge whitespace in text: expand tabs and convert all other
* whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz"
* becomes " foo bar baz".
*/
if (this.expand_tabs) {
text = text.replace(/\t/g, ' '.repeat(this.tabsize)) // not strictly correct in js
}
if (this.replace_whitespace) {
text = text.replace(/[\t\n\x0b\x0c\r]/g, ' ')
}
return text
}
_split(text) {
/*
* _split(text : string) -> [string]
*
* Split the text to wrap into indivisible chunks. Chunks are
* not quite the same as words; see _wrap_chunks() for full
* details. As an example, the text
* Look, goof-ball -- use the -b option!
* breaks into the following chunks:
* 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
* 'use', ' ', 'the', ' ', '-b', ' ', 'option!'
* if break_on_hyphens is True, or in:
* 'Look,', ' ', 'goof-ball', ' ', '--', ' ',
* 'use', ' ', 'the', ' ', '-b', ' ', option!'
* otherwise.
*/
let chunks = text.split(wordsep_simple_re)
chunks = chunks.filter(Boolean)
return chunks
}
_handle_long_word(reversed_chunks, cur_line, cur_len, width) {
/*
* _handle_long_word(chunks : [string],
* cur_line : [string],
* cur_len : int, width : int)
*
* Handle a chunk of text (most likely a word, not whitespace) that
* is too long to fit in any line.
*/
// Figure out when indent is larger than the specified width, and make
// sure at least one character is stripped off on every pass
let space_left
if (width < 1) {
space_left = 1
} else {
space_left = width - cur_len
}
// If we're allowed to break long words, then do so: put as much
// of the next chunk onto the current line as will fit.
if (this.break_long_words) {
cur_line.push(reversed_chunks[reversed_chunks.length - 1].slice(0, space_left))
reversed_chunks[reversed_chunks.length - 1] = reversed_chunks[reversed_chunks.length - 1].slice(space_left)
// Otherwise, we have to preserve the long word intact. Only add
// it to the current line if there's nothing already there --
// that minimizes how much we violate the width constraint.
} else if (!cur_line) {
cur_line.push(...reversed_chunks.pop())
}
// If we're not allowed to break long words, and there's already
// text on the current line, do nothing. Next time through the
// main loop of _wrap_chunks(), we'll wind up here again, but
// cur_len will be zero, so the next line will be entirely
// devoted to the long word that we can't handle right now.
}
_wrap_chunks(chunks) {
/*
* _wrap_chunks(chunks : [string]) -> [string]
*
* Wrap a sequence of text chunks and return a list of lines of
* length 'self.width' or less. (If 'break_long_words' is false,
* some lines may be longer than this.) Chunks correspond roughly
* to words and the whitespace between them: each chunk is
* indivisible (modulo 'break_long_words'), but a line break can
* come between any two chunks. Chunks should not have internal
* whitespace; ie. a chunk is either all whitespace or a "word".
* Whitespace chunks will be removed from the beginning and end of
* lines, but apart from that whitespace is preserved.
*/
let lines = []
let indent
if (this.width <= 0) {
throw Error(`invalid width ${this.width} (must be > 0)`)
}
if (this.max_lines !== undefined) {
if (this.max_lines > 1) {
indent = this.subsequent_indent
} else {
indent = this.initial_indent
}
if (indent.length + this.placeholder.trimStart().length > this.width) {
throw Error('placeholder too large for max width')
}
}
// Arrange in reverse order so items can be efficiently popped
// from a stack of chucks.
chunks = chunks.reverse()
while (chunks.length > 0) {
// Start the list of chunks that will make up the current line.
// cur_len is just the length of all the chunks in cur_line.
let cur_line = []
let cur_len = 0
// Figure out which static string will prefix this line.
let indent
if (lines) {
indent = this.subsequent_indent
} else {
indent = this.initial_indent
}
// Maximum width for this line.
let width = this.width - indent.length
// First chunk on line is whitespace -- drop it, unless this
// is the very beginning of the text (ie. no lines started yet).
if (this.drop_whitespace && chunks[chunks.length - 1].trim() === '' && lines.length > 0) {
chunks.pop()
}
while (chunks.length > 0) {
let l = chunks[chunks.length - 1].length
// Can at least squeeze this chunk onto the current line.
if (cur_len + l <= width) {
cur_line.push(chunks.pop())
cur_len += l
// Nope, this line is full.
} else {
break
}
}
// The current line is full, and the next chunk is too big to
// fit on *any* line (not just this one).
if (chunks.length && chunks[chunks.length - 1].length > width) {
this._handle_long_word(chunks, cur_line, cur_len, width)
cur_len = cur_line.map(l => l.length).reduce((a, b) => a + b, 0)
}
// If the last chunk on this line is all whitespace, drop it.
if (this.drop_whitespace && cur_line.length > 0 && cur_line[cur_line.length - 1].trim() === '') {
cur_len -= cur_line[cur_line.length - 1].length
cur_line.pop()
}
if (cur_line) {
if (this.max_lines === undefined ||
lines.length + 1 < this.max_lines ||
(chunks.length === 0 ||
this.drop_whitespace &&
chunks.length === 1 &&
!chunks[0].trim()) && cur_len <= width) {
// Convert current line back to a string and store it in
// list of all lines (return value).
lines.push(indent + cur_line.join(''))
} else {
let had_break = false
while (cur_line) {
if (cur_line[cur_line.length - 1].trim() &&
cur_len + this.placeholder.length <= width) {
cur_line.push(this.placeholder)
lines.push(indent + cur_line.join(''))
had_break = true
break
}
cur_len -= cur_line[-1].length
cur_line.pop()
}
if (!had_break) {
if (lines) {
let prev_line = lines[lines.length - 1].trimEnd()
if (prev_line.length + this.placeholder.length <=
this.width) {
lines[lines.length - 1] = prev_line + this.placeholder
break
}
}
lines.push(indent + this.placeholder.lstrip())
}
break
}
}
}
return lines
}
_split_chunks(text) {
text = this._munge_whitespace(text)
return this._split(text)
}
// -- Public interface ----------------------------------------------
wrap(text) {
/*
* wrap(text : string) -> [string]
*
* Reformat the single paragraph in 'text' so it fits in lines of
* no more than 'self.width' columns, and return a list of wrapped
* lines. Tabs in 'text' are expanded with string.expandtabs(),
* and all other whitespace characters (including newline) are
* converted to space.
*/
let chunks = this._split_chunks(text)
// not implemented in js
//if (this.fix_sentence_endings) {
// this._fix_sentence_endings(chunks)
//}
return this._wrap_chunks(chunks)
}
fill(text) {
/*
* fill(text : string) -> string
*
* Reformat the single paragraph in 'text' to fit in lines of no
* more than 'self.width' columns, and return a new string
* containing the entire wrapped paragraph.
*/
return this.wrap(text).join('\n')
}
}
// -- Convenience interface ---------------------------------------------
function wrap(text, options = {}) {
/*
* Wrap a single paragraph of text, returning a list of wrapped lines.
*
* Reformat the single paragraph in 'text' so it fits in lines of no
* more than 'width' columns, and return a list of wrapped lines. By
* default, tabs in 'text' are expanded with string.expandtabs(), and
* all other whitespace characters (including newline) are converted to
* space. See TextWrapper class for available keyword args to customize
* wrapping behaviour.
*/
let { width = 70, ...kwargs } = options
let w = new TextWrapper(Object.assign({ width }, kwargs))
return w.wrap(text)
}
function fill(text, options = {}) {
/*
* Fill a single paragraph of text, returning a new string.
*
* Reformat the single paragraph in 'text' to fit in lines of no more
* than 'width' columns, and return a new string containing the entire
* wrapped paragraph. As with wrap(), tabs are expanded and other
* whitespace characters converted to space. See TextWrapper class for
* available keyword args to customize wrapping behaviour.
*/
let { width = 70, ...kwargs } = options
let w = new TextWrapper(Object.assign({ width }, kwargs))
return w.fill(text)
}
// -- Loosely related functionality -------------------------------------
let _whitespace_only_re = /^[ \t]+$/mg
let _leading_whitespace_re = /(^[ \t]*)(?:[^ \t\n])/mg
function dedent(text) {
/*
* Remove any common leading whitespace from every line in `text`.
*
* This can be used to make triple-quoted strings line up with the left
* edge of the display, while still presenting them in the source code
* in indented form.
*
* Note that tabs and spaces are both treated as whitespace, but they
* are not equal: the lines " hello" and "\\thello" are
* considered to have no common leading whitespace.
*
* Entirely blank lines are normalized to a newline character.
*/
// Look for the longest leading string of spaces and tabs common to
// all lines.
let margin = undefined
text = text.replace(_whitespace_only_re, '')
let indents = text.match(_leading_whitespace_re) || []
for (let indent of indents) {
indent = indent.slice(0, -1)
if (margin === undefined) {
margin = indent
// Current line more deeply indented than previous winner:
// no change (previous winner is still on top).
} else if (indent.startsWith(margin)) {
// pass
// Current line consistent with and no deeper than previous winner:
// it's the new winner.
} else if (margin.startsWith(indent)) {
margin = indent
// Find the largest common whitespace between current line and previous
// winner.
} else {
for (let i = 0; i < margin.length && i < indent.length; i++) {
if (margin[i] !== indent[i]) {
margin = margin.slice(0, i)
break
}
}
}
}
if (margin) {
text = text.replace(new RegExp('^' + margin, 'mg'), '')
}
return text
}
module.exports = { wrap, fill, dedent }

View File

@@ -0,0 +1,31 @@
{
"name": "argparse",
"description": "CLI arguments parser. Native port of python's argparse.",
"version": "2.0.1",
"keywords": [
"cli",
"parser",
"argparse",
"option",
"args"
],
"main": "argparse.js",
"files": [
"argparse.js",
"lib/"
],
"license": "Python-2.0",
"repository": "nodeca/argparse",
"scripts": {
"lint": "eslint .",
"test": "npm run lint && nyc mocha",
"coverage": "npm run test && nyc report --reporter html"
},
"devDependencies": {
"@babel/eslint-parser": "^7.11.0",
"@babel/plugin-syntax-class-properties": "^7.10.4",
"eslint": "^7.5.0",
"mocha": "^8.0.1",
"nyc": "^15.1.0"
}
}

View File

@@ -0,0 +1,21 @@
(The MIT License)
Copyright (C) 2011-2015 by Vitaly Puzrin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,247 @@
JS-YAML - YAML 1.2 parser / writer for JavaScript
=================================================
[![CI](https://github.com/nodeca/js-yaml/workflows/CI/badge.svg?branch=master)](https://github.com/nodeca/js-yaml/actions)
[![NPM version](https://img.shields.io/npm/v/js-yaml.svg)](https://www.npmjs.org/package/js-yaml)
__[Online Demo](https://nodeca.github.io/js-yaml/)__
This is an implementation of [YAML](https://yaml.org/), a human-friendly data
serialization language. Started as [PyYAML](https://pyyaml.org/) port, it was
completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.
Installation
------------
### YAML module for node.js
```
npm install js-yaml
```
### CLI executable
If you want to inspect your YAML files from CLI, install js-yaml globally:
```
npm install -g js-yaml
```
#### Usage
```
usage: js-yaml [-h] [-v] [-c] [-t] file
Positional arguments:
file File with YAML document(s)
Optional arguments:
-h, --help Show this help message and exit.
-v, --version Show program's version number and exit.
-c, --compact Display errors in compact mode
-t, --trace Show stack trace on error
```
API
---
Here we cover the most 'useful' methods. If you need advanced details (creating
your own tags), see [examples](https://github.com/nodeca/js-yaml/tree/master/examples)
for more info.
``` javascript
const yaml = require('js-yaml');
const fs = require('fs');
// Get document, or throw exception on error
try {
const doc = yaml.load(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
console.log(doc);
} catch (e) {
console.log(e);
}
```
### load (string [ , options ])
Parses `string` as single YAML document. Returns either a
plain object, a string, a number, `null` or `undefined`, or throws `YAMLException` on error. By default, does
not support regexps, functions and undefined.
options:
- `filename` _(default: null)_ - string to be used as a file path in
error/warning messages.
- `onWarning` _(default: null)_ - function to call on warning messages.
Loader will call this function with an instance of `YAMLException` for each warning.
- `schema` _(default: `DEFAULT_SCHEMA`)_ - specifies a schema to use.
- `FAILSAFE_SCHEMA` - only strings, arrays and plain objects:
https://www.yaml.org/spec/1.2/spec.html#id2802346
- `JSON_SCHEMA` - all JSON-supported types:
https://www.yaml.org/spec/1.2/spec.html#id2803231
- `CORE_SCHEMA` - same as `JSON_SCHEMA`:
https://www.yaml.org/spec/1.2/spec.html#id2804923
- `DEFAULT_SCHEMA` - all supported YAML types.
- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
NOTE: This function **does not** understand multi-document sources, it throws
exception on those.
NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions.
So, the JSON schema is not as strictly defined in the YAML specification.
It allows numbers in any notation, use `Null` and `NULL` as `null`, etc.
The core schema also has no such restrictions. It allows binary notation for integers.
### loadAll (string [, iterator] [, options ])
Same as `load()`, but understands multi-document sources. Applies
`iterator` to each document if specified, or returns array of documents.
``` javascript
const yaml = require('js-yaml');
yaml.loadAll(data, function (doc) {
console.log(doc);
});
```
### dump (object [ , options ])
Serializes `object` as a YAML document. Uses `DEFAULT_SCHEMA`, so it will
throw an exception if you try to dump regexps or functions. However, you can
disable exceptions by setting the `skipInvalid` option to `true`.
options:
- `indent` _(default: 2)_ - indentation width to use (in spaces).
- `noArrayIndent` _(default: false)_ - when true, will not add an indentation level to array elements
- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function
in the safe schema) and skip pairs and single values with such types.
- `flowLevel` _(default: -1)_ - specifies level of nesting, when to switch from
block to flow style for collections. -1 means block style everwhere
- `styles` - "tag" => "style" map. Each tag may have own set of styles.
- `schema` _(default: `DEFAULT_SCHEMA`)_ specifies a schema to use.
- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a
function, use the function to sort the keys.
- `lineWidth` _(default: `80`)_ - set max line width. Set `-1` for unlimited width.
- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references
- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
- `quotingType` _(`'` or `"`, default: `'`)_ - strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters.
- `forceQuotes` _(default: `false`)_ - if `true`, all non-key strings will be quoted even if they normally don't need to.
- `replacer` - callback `function (key, value)` called recursively on each key/value in source object (see `replacer` docs for `JSON.stringify`).
The following table show availlable styles (e.g. "canonical",
"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml
output is shown on the right side after `=>` (default setting) or `->`:
``` none
!!null
"canonical" -> "~"
"lowercase" => "null"
"uppercase" -> "NULL"
"camelcase" -> "Null"
"empty" -> ""
!!int
"binary" -> "0b1", "0b101010", "0b1110001111010"
"octal" -> "0o1", "0o52", "0o16172"
"decimal" => "1", "42", "7290"
"hexadecimal" -> "0x1", "0x2A", "0x1C7A"
!!bool
"lowercase" => "true", "false"
"uppercase" -> "TRUE", "FALSE"
"camelcase" -> "True", "False"
!!float
"lowercase" => ".nan", '.inf'
"uppercase" -> ".NAN", '.INF'
"camelcase" -> ".NaN", '.Inf'
```
Example:
``` javascript
dump(object, {
'styles': {
'!!null': 'canonical' // dump null as ~
},
'sortKeys': true // sort object keys
});
```
Supported YAML types
--------------------
The list of standard YAML tags and corresponding JavaScript types. See also
[YAML tag discussion](https://pyyaml.org/wiki/YAMLTagDiscussion) and
[YAML types repository](https://yaml.org/type/).
```
!!null '' # null
!!bool 'yes' # bool
!!int '3...' # number
!!float '3.14...' # number
!!binary '...base64...' # buffer
!!timestamp 'YYYY-...' # date
!!omap [ ... ] # array of key-value pairs
!!pairs [ ... ] # array or array pairs
!!set { ... } # array of objects with given keys and null values
!!str '...' # string
!!seq [ ... ] # array
!!map { ... } # object
```
**JavaScript-specific tags**
See [js-yaml-js-types](https://github.com/nodeca/js-yaml-js-types) for
extra types.
Caveats
-------
Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects
or arrays as keys, and stringifies (by calling `toString()` method) them at the
moment of adding them.
``` yaml
---
? [ foo, bar ]
: - baz
? { foo: bar }
: - baz
- baz
```
``` javascript
{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }
```
Also, reading of properties on implicit block mapping keys is not supported yet.
So, the following YAML document cannot be loaded.
``` yaml
&anchor foo:
foo: bar
*anchor: duplicate key
baz: bat
*anchor: duplicate key
```
js-yaml for enterprise
----------------------
Available as part of the Tidelift Subscription
The maintainers of js-yaml and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-js-yaml?utm_source=npm-js-yaml&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

View File

@@ -0,0 +1,126 @@
#!/usr/bin/env node
'use strict';
/*eslint-disable no-console*/
var fs = require('fs');
var argparse = require('argparse');
var yaml = require('..');
////////////////////////////////////////////////////////////////////////////////
var cli = new argparse.ArgumentParser({
prog: 'js-yaml',
add_help: true
});
cli.add_argument('-v', '--version', {
action: 'version',
version: require('../package.json').version
});
cli.add_argument('-c', '--compact', {
help: 'Display errors in compact mode',
action: 'store_true'
});
// deprecated (not needed after we removed output colors)
// option suppressed, but not completely removed for compatibility
cli.add_argument('-j', '--to-json', {
help: argparse.SUPPRESS,
dest: 'json',
action: 'store_true'
});
cli.add_argument('-t', '--trace', {
help: 'Show stack trace on error',
action: 'store_true'
});
cli.add_argument('file', {
help: 'File to read, utf-8 encoded without BOM',
nargs: '?',
default: '-'
});
////////////////////////////////////////////////////////////////////////////////
var options = cli.parse_args();
////////////////////////////////////////////////////////////////////////////////
function readFile(filename, encoding, callback) {
if (options.file === '-') {
// read from stdin
var chunks = [];
process.stdin.on('data', function (chunk) {
chunks.push(chunk);
});
process.stdin.on('end', function () {
return callback(null, Buffer.concat(chunks).toString(encoding));
});
} else {
fs.readFile(filename, encoding, callback);
}
}
readFile(options.file, 'utf8', function (error, input) {
var output, isYaml;
if (error) {
if (error.code === 'ENOENT') {
console.error('File not found: ' + options.file);
process.exit(2);
}
console.error(
options.trace && error.stack ||
error.message ||
String(error));
process.exit(1);
}
try {
output = JSON.parse(input);
isYaml = false;
} catch (err) {
if (err instanceof SyntaxError) {
try {
output = [];
yaml.loadAll(input, function (doc) { output.push(doc); }, {});
isYaml = true;
if (output.length === 0) output = null;
else if (output.length === 1) output = output[0];
} catch (e) {
if (options.trace && err.stack) console.error(e.stack);
else console.error(e.toString(options.compact));
process.exit(1);
}
} else {
console.error(
options.trace && err.stack ||
err.message ||
String(err));
process.exit(1);
}
}
if (isYaml) console.log(JSON.stringify(output, null, ' '));
else console.log(yaml.dump(output));
});

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
'use strict';
var loader = require('./lib/loader');
var dumper = require('./lib/dumper');
function renamed(from, to) {
return function () {
throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
'Use yaml.' + to + ' instead, which is now safe by default.');
};
}
module.exports.Type = require('./lib/type');
module.exports.Schema = require('./lib/schema');
module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe');
module.exports.JSON_SCHEMA = require('./lib/schema/json');
module.exports.CORE_SCHEMA = require('./lib/schema/core');
module.exports.DEFAULT_SCHEMA = require('./lib/schema/default');
module.exports.load = loader.load;
module.exports.loadAll = loader.loadAll;
module.exports.dump = dumper.dump;
module.exports.YAMLException = require('./lib/exception');
// Re-export all types in case user wants to create custom schema
module.exports.types = {
binary: require('./lib/type/binary'),
float: require('./lib/type/float'),
map: require('./lib/type/map'),
null: require('./lib/type/null'),
pairs: require('./lib/type/pairs'),
set: require('./lib/type/set'),
timestamp: require('./lib/type/timestamp'),
bool: require('./lib/type/bool'),
int: require('./lib/type/int'),
merge: require('./lib/type/merge'),
omap: require('./lib/type/omap'),
seq: require('./lib/type/seq'),
str: require('./lib/type/str')
};
// Removed functions from JS-YAML 3.0.x
module.exports.safeLoad = renamed('safeLoad', 'load');
module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll');
module.exports.safeDump = renamed('safeDump', 'dump');

View File

@@ -0,0 +1,59 @@
'use strict';
function isNothing(subject) {
return (typeof subject === 'undefined') || (subject === null);
}
function isObject(subject) {
return (typeof subject === 'object') && (subject !== null);
}
function toArray(sequence) {
if (Array.isArray(sequence)) return sequence;
else if (isNothing(sequence)) return [];
return [ sequence ];
}
function extend(target, source) {
var index, length, key, sourceKeys;
if (source) {
sourceKeys = Object.keys(source);
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
key = sourceKeys[index];
target[key] = source[key];
}
}
return target;
}
function repeat(string, count) {
var result = '', cycle;
for (cycle = 0; cycle < count; cycle += 1) {
result += string;
}
return result;
}
function isNegativeZero(number) {
return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
}
module.exports.isNothing = isNothing;
module.exports.isObject = isObject;
module.exports.toArray = toArray;
module.exports.repeat = repeat;
module.exports.isNegativeZero = isNegativeZero;
module.exports.extend = extend;

View File

@@ -0,0 +1,965 @@
'use strict';
/*eslint-disable no-use-before-define*/
var common = require('./common');
var YAMLException = require('./exception');
var DEFAULT_SCHEMA = require('./schema/default');
var _toString = Object.prototype.toString;
var _hasOwnProperty = Object.prototype.hasOwnProperty;
var CHAR_BOM = 0xFEFF;
var CHAR_TAB = 0x09; /* Tab */
var CHAR_LINE_FEED = 0x0A; /* LF */
var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
var CHAR_SPACE = 0x20; /* Space */
var CHAR_EXCLAMATION = 0x21; /* ! */
var CHAR_DOUBLE_QUOTE = 0x22; /* " */
var CHAR_SHARP = 0x23; /* # */
var CHAR_PERCENT = 0x25; /* % */
var CHAR_AMPERSAND = 0x26; /* & */
var CHAR_SINGLE_QUOTE = 0x27; /* ' */
var CHAR_ASTERISK = 0x2A; /* * */
var CHAR_COMMA = 0x2C; /* , */
var CHAR_MINUS = 0x2D; /* - */
var CHAR_COLON = 0x3A; /* : */
var CHAR_EQUALS = 0x3D; /* = */
var CHAR_GREATER_THAN = 0x3E; /* > */
var CHAR_QUESTION = 0x3F; /* ? */
var CHAR_COMMERCIAL_AT = 0x40; /* @ */
var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
var CHAR_GRAVE_ACCENT = 0x60; /* ` */
var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
var CHAR_VERTICAL_LINE = 0x7C; /* | */
var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
var ESCAPE_SEQUENCES = {};
ESCAPE_SEQUENCES[0x00] = '\\0';
ESCAPE_SEQUENCES[0x07] = '\\a';
ESCAPE_SEQUENCES[0x08] = '\\b';
ESCAPE_SEQUENCES[0x09] = '\\t';
ESCAPE_SEQUENCES[0x0A] = '\\n';
ESCAPE_SEQUENCES[0x0B] = '\\v';
ESCAPE_SEQUENCES[0x0C] = '\\f';
ESCAPE_SEQUENCES[0x0D] = '\\r';
ESCAPE_SEQUENCES[0x1B] = '\\e';
ESCAPE_SEQUENCES[0x22] = '\\"';
ESCAPE_SEQUENCES[0x5C] = '\\\\';
ESCAPE_SEQUENCES[0x85] = '\\N';
ESCAPE_SEQUENCES[0xA0] = '\\_';
ESCAPE_SEQUENCES[0x2028] = '\\L';
ESCAPE_SEQUENCES[0x2029] = '\\P';
var DEPRECATED_BOOLEANS_SYNTAX = [
'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
];
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
function compileStyleMap(schema, map) {
var result, keys, index, length, tag, style, type;
if (map === null) return {};
result = {};
keys = Object.keys(map);
for (index = 0, length = keys.length; index < length; index += 1) {
tag = keys[index];
style = String(map[tag]);
if (tag.slice(0, 2) === '!!') {
tag = 'tag:yaml.org,2002:' + tag.slice(2);
}
type = schema.compiledTypeMap['fallback'][tag];
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
style = type.styleAliases[style];
}
result[tag] = style;
}
return result;
}
function encodeHex(character) {
var string, handle, length;
string = character.toString(16).toUpperCase();
if (character <= 0xFF) {
handle = 'x';
length = 2;
} else if (character <= 0xFFFF) {
handle = 'u';
length = 4;
} else if (character <= 0xFFFFFFFF) {
handle = 'U';
length = 8;
} else {
throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
}
return '\\' + handle + common.repeat('0', length - string.length) + string;
}
var QUOTING_TYPE_SINGLE = 1,
QUOTING_TYPE_DOUBLE = 2;
function State(options) {
this.schema = options['schema'] || DEFAULT_SCHEMA;
this.indent = Math.max(1, (options['indent'] || 2));
this.noArrayIndent = options['noArrayIndent'] || false;
this.skipInvalid = options['skipInvalid'] || false;
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
this.sortKeys = options['sortKeys'] || false;
this.lineWidth = options['lineWidth'] || 80;
this.noRefs = options['noRefs'] || false;
this.noCompatMode = options['noCompatMode'] || false;
this.condenseFlow = options['condenseFlow'] || false;
this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
this.forceQuotes = options['forceQuotes'] || false;
this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;
this.implicitTypes = this.schema.compiledImplicit;
this.explicitTypes = this.schema.compiledExplicit;
this.tag = null;
this.result = '';
this.duplicates = [];
this.usedDuplicates = null;
}
// Indents every line in a string. Empty lines (\n only) are not indented.
function indentString(string, spaces) {
var ind = common.repeat(' ', spaces),
position = 0,
next = -1,
result = '',
line,
length = string.length;
while (position < length) {
next = string.indexOf('\n', position);
if (next === -1) {
line = string.slice(position);
position = length;
} else {
line = string.slice(position, next + 1);
position = next + 1;
}
if (line.length && line !== '\n') result += ind;
result += line;
}
return result;
}
function generateNextLine(state, level) {
return '\n' + common.repeat(' ', state.indent * level);
}
function testImplicitResolving(state, str) {
var index, length, type;
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
type = state.implicitTypes[index];
if (type.resolve(str)) {
return true;
}
}
return false;
}
// [33] s-white ::= s-space | s-tab
function isWhitespace(c) {
return c === CHAR_SPACE || c === CHAR_TAB;
}
// Returns true if the character can be printed without escaping.
// From YAML 1.2: "any allowed characters known to be non-printable
// should also be escaped. [However,] This isnt mandatory"
// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
function isPrintable(c) {
return (0x00020 <= c && c <= 0x00007E)
|| ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
|| ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)
|| (0x10000 <= c && c <= 0x10FFFF);
}
// [34] ns-char ::= nb-char - s-white
// [27] nb-char ::= c-printable - b-char - c-byte-order-mark
// [26] b-char ::= b-line-feed | b-carriage-return
// Including s-white (for some reason, examples doesn't match specs in this aspect)
// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark
function isNsCharOrWhitespace(c) {
return isPrintable(c)
&& c !== CHAR_BOM
// - b-char
&& c !== CHAR_CARRIAGE_RETURN
&& c !== CHAR_LINE_FEED;
}
// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out
// c = flow-in ⇒ ns-plain-safe-in
// c = block-key ⇒ ns-plain-safe-out
// c = flow-key ⇒ ns-plain-safe-in
// [128] ns-plain-safe-out ::= ns-char
// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator
// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” )
// | ( /* An ns-char preceding */ “#” )
// | ( “:” /* Followed by an ns-plain-safe(c) */ )
function isPlainSafe(c, prev, inblock) {
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
return (
// ns-plain-safe
inblock ? // c = flow-in
cIsNsCharOrWhitespace
: cIsNsCharOrWhitespace
// - c-flow-indicator
&& c !== CHAR_COMMA
&& c !== CHAR_LEFT_SQUARE_BRACKET
&& c !== CHAR_RIGHT_SQUARE_BRACKET
&& c !== CHAR_LEFT_CURLY_BRACKET
&& c !== CHAR_RIGHT_CURLY_BRACKET
)
// ns-plain-char
&& c !== CHAR_SHARP // false on '#'
&& !(prev === CHAR_COLON && !cIsNsChar) // false on ': '
|| (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'
|| (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'
}
// Simplified test for values allowed as the first character in plain style.
function isPlainSafeFirst(c) {
// Uses a subset of ns-char - c-indicator
// where ns-char = nb-char - s-white.
// No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part
return isPrintable(c) && c !== CHAR_BOM
&& !isWhitespace(c) // - s-white
// - (c-indicator ::=
// “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
&& c !== CHAR_MINUS
&& c !== CHAR_QUESTION
&& c !== CHAR_COLON
&& c !== CHAR_COMMA
&& c !== CHAR_LEFT_SQUARE_BRACKET
&& c !== CHAR_RIGHT_SQUARE_BRACKET
&& c !== CHAR_LEFT_CURLY_BRACKET
&& c !== CHAR_RIGHT_CURLY_BRACKET
// | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
&& c !== CHAR_SHARP
&& c !== CHAR_AMPERSAND
&& c !== CHAR_ASTERISK
&& c !== CHAR_EXCLAMATION
&& c !== CHAR_VERTICAL_LINE
&& c !== CHAR_EQUALS
&& c !== CHAR_GREATER_THAN
&& c !== CHAR_SINGLE_QUOTE
&& c !== CHAR_DOUBLE_QUOTE
// | “%” | “@” | “`”)
&& c !== CHAR_PERCENT
&& c !== CHAR_COMMERCIAL_AT
&& c !== CHAR_GRAVE_ACCENT;
}
// Simplified test for values allowed as the last character in plain style.
function isPlainSafeLast(c) {
// just not whitespace or colon, it will be checked to be plain character later
return !isWhitespace(c) && c !== CHAR_COLON;
}
// Same as 'string'.codePointAt(pos), but works in older browsers.
function codePointAt(string, pos) {
var first = string.charCodeAt(pos), second;
if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {
second = string.charCodeAt(pos + 1);
if (second >= 0xDC00 && second <= 0xDFFF) {
// https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
}
}
return first;
}
// Determines whether block indentation indicator is required.
function needIndentIndicator(string) {
var leadingSpaceRe = /^\n* /;
return leadingSpaceRe.test(string);
}
var STYLE_PLAIN = 1,
STYLE_SINGLE = 2,
STYLE_LITERAL = 3,
STYLE_FOLDED = 4,
STYLE_DOUBLE = 5;
// Determines which scalar styles are possible and returns the preferred style.
// lineWidth = -1 => no limit.
// Pre-conditions: str.length > 0.
// Post-conditions:
// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,
testAmbiguousType, quotingType, forceQuotes, inblock) {
var i;
var char = 0;
var prevChar = null;
var hasLineBreak = false;
var hasFoldableLine = false; // only checked if shouldTrackWidth
var shouldTrackWidth = lineWidth !== -1;
var previousLineBreak = -1; // count the first line correctly
var plain = isPlainSafeFirst(codePointAt(string, 0))
&& isPlainSafeLast(codePointAt(string, string.length - 1));
if (singleLineOnly || forceQuotes) {
// Case: no block styles.
// Check for disallowed characters to rule out plain and single.
for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
char = codePointAt(string, i);
if (!isPrintable(char)) {
return STYLE_DOUBLE;
}
plain = plain && isPlainSafe(char, prevChar, inblock);
prevChar = char;
}
} else {
// Case: block styles permitted.
for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
char = codePointAt(string, i);
if (char === CHAR_LINE_FEED) {
hasLineBreak = true;
// Check if any line can be folded.
if (shouldTrackWidth) {
hasFoldableLine = hasFoldableLine ||
// Foldable line = too long, and not more-indented.
(i - previousLineBreak - 1 > lineWidth &&
string[previousLineBreak + 1] !== ' ');
previousLineBreak = i;
}
} else if (!isPrintable(char)) {
return STYLE_DOUBLE;
}
plain = plain && isPlainSafe(char, prevChar, inblock);
prevChar = char;
}
// in case the end is missing a \n
hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
(i - previousLineBreak - 1 > lineWidth &&
string[previousLineBreak + 1] !== ' '));
}
// Although every style can represent \n without escaping, prefer block styles
// for multiline, since they're more readable and they don't add empty lines.
// Also prefer folding a super-long line.
if (!hasLineBreak && !hasFoldableLine) {
// Strings interpretable as another type have to be quoted;
// e.g. the string 'true' vs. the boolean true.
if (plain && !forceQuotes && !testAmbiguousType(string)) {
return STYLE_PLAIN;
}
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
}
// Edge case: block indentation indicator can only have one digit.
if (indentPerLevel > 9 && needIndentIndicator(string)) {
return STYLE_DOUBLE;
}
// At this point we know block styles are valid.
// Prefer literal style unless we want to fold.
if (!forceQuotes) {
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
}
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
}
// Note: line breaking/folding is implemented for only the folded style.
// NB. We drop the last trailing newline (if any) of a returned block scalar
// since the dumper adds its own newline. This always works:
// • No ending newline => unaffected; already using strip "-" chomping.
// • Ending newline => removed then restored.
// Importantly, this keeps the "+" chomp indicator from gaining an extra line.
function writeScalar(state, string, level, iskey, inblock) {
state.dump = (function () {
if (string.length === 0) {
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
}
if (!state.noCompatMode) {
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'");
}
}
var indent = state.indent * Math.max(1, level); // no 0-indent scalars
// As indentation gets deeper, let the width decrease monotonically
// to the lower bound min(state.lineWidth, 40).
// Note that this implies
// state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
// state.lineWidth > 40 + state.indent: width decreases until the lower bound.
// This behaves better than a constant minimum width which disallows narrower options,
// or an indent threshold which causes the width to suddenly increase.
var lineWidth = state.lineWidth === -1
? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
// Without knowing if keys are implicit/explicit, assume implicit for safety.
var singleLineOnly = iskey
// No block styles in flow mode.
|| (state.flowLevel > -1 && level >= state.flowLevel);
function testAmbiguity(string) {
return testImplicitResolving(state, string);
}
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,
testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
case STYLE_PLAIN:
return string;
case STYLE_SINGLE:
return "'" + string.replace(/'/g, "''") + "'";
case STYLE_LITERAL:
return '|' + blockHeader(string, state.indent)
+ dropEndingNewline(indentString(string, indent));
case STYLE_FOLDED:
return '>' + blockHeader(string, state.indent)
+ dropEndingNewline(indentString(foldString(string, lineWidth), indent));
case STYLE_DOUBLE:
return '"' + escapeString(string, lineWidth) + '"';
default:
throw new YAMLException('impossible error: invalid scalar style');
}
}());
}
// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
function blockHeader(string, indentPerLevel) {
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
// note the special case: the string '\n' counts as a "trailing" empty line.
var clip = string[string.length - 1] === '\n';
var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
var chomp = keep ? '+' : (clip ? '' : '-');
return indentIndicator + chomp + '\n';
}
// (See the note for writeScalar.)
function dropEndingNewline(string) {
return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
}
// Note: a long line without a suitable break point will exceed the width limit.
// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
function foldString(string, width) {
// In folded style, $k$ consecutive newlines output as $k+1$ newlines—
// unless they're before or after a more-indented line, or at the very
// beginning or end, in which case $k$ maps to $k$.
// Therefore, parse each chunk as newline(s) followed by a content line.
var lineRe = /(\n+)([^\n]*)/g;
// first line (possibly an empty line)
var result = (function () {
var nextLF = string.indexOf('\n');
nextLF = nextLF !== -1 ? nextLF : string.length;
lineRe.lastIndex = nextLF;
return foldLine(string.slice(0, nextLF), width);
}());
// If we haven't reached the first content line yet, don't add an extra \n.
var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
var moreIndented;
// rest of the lines
var match;
while ((match = lineRe.exec(string))) {
var prefix = match[1], line = match[2];
moreIndented = (line[0] === ' ');
result += prefix
+ (!prevMoreIndented && !moreIndented && line !== ''
? '\n' : '')
+ foldLine(line, width);
prevMoreIndented = moreIndented;
}
return result;
}
// Greedy line breaking.
// Picks the longest line under the limit each time,
// otherwise settles for the shortest line over the limit.
// NB. More-indented lines *cannot* be folded, as that would add an extra \n.
function foldLine(line, width) {
if (line === '' || line[0] === ' ') return line;
// Since a more-indented line adds a \n, breaks can't be followed by a space.
var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
var match;
// start is an inclusive index. end, curr, and next are exclusive.
var start = 0, end, curr = 0, next = 0;
var result = '';
// Invariants: 0 <= start <= length-1.
// 0 <= curr <= next <= max(0, length-2). curr - start <= width.
// Inside the loop:
// A match implies length >= 2, so curr and next are <= length-2.
while ((match = breakRe.exec(line))) {
next = match.index;
// maintain invariant: curr - start <= width
if (next - start > width) {
end = (curr > start) ? curr : next; // derive end <= length-2
result += '\n' + line.slice(start, end);
// skip the space that was output as \n
start = end + 1; // derive start <= length-1
}
curr = next;
}
// By the invariants, start <= length-1, so there is something left over.
// It is either the whole string or a part starting from non-whitespace.
result += '\n';
// Insert a break if the remainder is too long and there is a break available.
if (line.length - start > width && curr > start) {
result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
} else {
result += line.slice(start);
}
return result.slice(1); // drop extra \n joiner
}
// Escapes a double-quoted string.
function escapeString(string) {
var result = '';
var char = 0;
var escapeSeq;
for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
char = codePointAt(string, i);
escapeSeq = ESCAPE_SEQUENCES[char];
if (!escapeSeq && isPrintable(char)) {
result += string[i];
if (char >= 0x10000) result += string[i + 1];
} else {
result += escapeSeq || encodeHex(char);
}
}
return result;
}
function writeFlowSequence(state, level, object) {
var _result = '',
_tag = state.tag,
index,
length,
value;
for (index = 0, length = object.length; index < length; index += 1) {
value = object[index];
if (state.replacer) {
value = state.replacer.call(object, String(index), value);
}
// Write only valid elements, put null instead of invalid elements.
if (writeNode(state, level, value, false, false) ||
(typeof value === 'undefined' &&
writeNode(state, level, null, false, false))) {
if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');
_result += state.dump;
}
}
state.tag = _tag;
state.dump = '[' + _result + ']';
}
function writeBlockSequence(state, level, object, compact) {
var _result = '',
_tag = state.tag,
index,
length,
value;
for (index = 0, length = object.length; index < length; index += 1) {
value = object[index];
if (state.replacer) {
value = state.replacer.call(object, String(index), value);
}
// Write only valid elements, put null instead of invalid elements.
if (writeNode(state, level + 1, value, true, true, false, true) ||
(typeof value === 'undefined' &&
writeNode(state, level + 1, null, true, true, false, true))) {
if (!compact || _result !== '') {
_result += generateNextLine(state, level);
}
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
_result += '-';
} else {
_result += '- ';
}
_result += state.dump;
}
}
state.tag = _tag;
state.dump = _result || '[]'; // Empty sequence if no valid values.
}
function writeFlowMapping(state, level, object) {
var _result = '',
_tag = state.tag,
objectKeyList = Object.keys(object),
index,
length,
objectKey,
objectValue,
pairBuffer;
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
pairBuffer = '';
if (_result !== '') pairBuffer += ', ';
if (state.condenseFlow) pairBuffer += '"';
objectKey = objectKeyList[index];
objectValue = object[objectKey];
if (state.replacer) {
objectValue = state.replacer.call(object, objectKey, objectValue);
}
if (!writeNode(state, level, objectKey, false, false)) {
continue; // Skip this pair because of invalid key;
}
if (state.dump.length > 1024) pairBuffer += '? ';
pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
if (!writeNode(state, level, objectValue, false, false)) {
continue; // Skip this pair because of invalid value.
}
pairBuffer += state.dump;
// Both key and value are valid.
_result += pairBuffer;
}
state.tag = _tag;
state.dump = '{' + _result + '}';
}
function writeBlockMapping(state, level, object, compact) {
var _result = '',
_tag = state.tag,
objectKeyList = Object.keys(object),
index,
length,
objectKey,
objectValue,
explicitPair,
pairBuffer;
// Allow sorting keys so that the output file is deterministic
if (state.sortKeys === true) {
// Default sorting
objectKeyList.sort();
} else if (typeof state.sortKeys === 'function') {
// Custom sort function
objectKeyList.sort(state.sortKeys);
} else if (state.sortKeys) {
// Something is wrong
throw new YAMLException('sortKeys must be a boolean or a function');
}
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
pairBuffer = '';
if (!compact || _result !== '') {
pairBuffer += generateNextLine(state, level);
}
objectKey = objectKeyList[index];
objectValue = object[objectKey];
if (state.replacer) {
objectValue = state.replacer.call(object, objectKey, objectValue);
}
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
continue; // Skip this pair because of invalid key.
}
explicitPair = (state.tag !== null && state.tag !== '?') ||
(state.dump && state.dump.length > 1024);
if (explicitPair) {
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
pairBuffer += '?';
} else {
pairBuffer += '? ';
}
}
pairBuffer += state.dump;
if (explicitPair) {
pairBuffer += generateNextLine(state, level);
}
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
continue; // Skip this pair because of invalid value.
}
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
pairBuffer += ':';
} else {
pairBuffer += ': ';
}
pairBuffer += state.dump;
// Both key and value are valid.
_result += pairBuffer;
}
state.tag = _tag;
state.dump = _result || '{}'; // Empty mapping if no valid pairs.
}
function detectType(state, object, explicit) {
var _result, typeList, index, length, type, style;
typeList = explicit ? state.explicitTypes : state.implicitTypes;
for (index = 0, length = typeList.length; index < length; index += 1) {
type = typeList[index];
if ((type.instanceOf || type.predicate) &&
(!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
(!type.predicate || type.predicate(object))) {
if (explicit) {
if (type.multi && type.representName) {
state.tag = type.representName(object);
} else {
state.tag = type.tag;
}
} else {
state.tag = '?';
}
if (type.represent) {
style = state.styleMap[type.tag] || type.defaultStyle;
if (_toString.call(type.represent) === '[object Function]') {
_result = type.represent(object, style);
} else if (_hasOwnProperty.call(type.represent, style)) {
_result = type.represent[style](object, style);
} else {
throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
}
state.dump = _result;
}
return true;
}
}
return false;
}
// Serializes `object` and writes it to global `result`.
// Returns true on success, or false on invalid object.
//
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
state.tag = null;
state.dump = object;
if (!detectType(state, object, false)) {
detectType(state, object, true);
}
var type = _toString.call(state.dump);
var inblock = block;
var tagStr;
if (block) {
block = (state.flowLevel < 0 || state.flowLevel > level);
}
var objectOrArray = type === '[object Object]' || type === '[object Array]',
duplicateIndex,
duplicate;
if (objectOrArray) {
duplicateIndex = state.duplicates.indexOf(object);
duplicate = duplicateIndex !== -1;
}
if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
compact = false;
}
if (duplicate && state.usedDuplicates[duplicateIndex]) {
state.dump = '*ref_' + duplicateIndex;
} else {
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
state.usedDuplicates[duplicateIndex] = true;
}
if (type === '[object Object]') {
if (block && (Object.keys(state.dump).length !== 0)) {
writeBlockMapping(state, level, state.dump, compact);
if (duplicate) {
state.dump = '&ref_' + duplicateIndex + state.dump;
}
} else {
writeFlowMapping(state, level, state.dump);
if (duplicate) {
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
}
}
} else if (type === '[object Array]') {
if (block && (state.dump.length !== 0)) {
if (state.noArrayIndent && !isblockseq && level > 0) {
writeBlockSequence(state, level - 1, state.dump, compact);
} else {
writeBlockSequence(state, level, state.dump, compact);
}
if (duplicate) {
state.dump = '&ref_' + duplicateIndex + state.dump;
}
} else {
writeFlowSequence(state, level, state.dump);
if (duplicate) {
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
}
}
} else if (type === '[object String]') {
if (state.tag !== '?') {
writeScalar(state, state.dump, level, iskey, inblock);
}
} else if (type === '[object Undefined]') {
return false;
} else {
if (state.skipInvalid) return false;
throw new YAMLException('unacceptable kind of an object to dump ' + type);
}
if (state.tag !== null && state.tag !== '?') {
// Need to encode all characters except those allowed by the spec:
//
// [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */
// [36] ns-hex-digit ::= ns-dec-digit
// | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */
// [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */
// [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-”
// [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#”
// | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,”
// | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]”
//
// Also need to encode '!' because it has special meaning (end of tag prefix).
//
tagStr = encodeURI(
state.tag[0] === '!' ? state.tag.slice(1) : state.tag
).replace(/!/g, '%21');
if (state.tag[0] === '!') {
tagStr = '!' + tagStr;
} else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {
tagStr = '!!' + tagStr.slice(18);
} else {
tagStr = '!<' + tagStr + '>';
}
state.dump = tagStr + ' ' + state.dump;
}
}
return true;
}
function getDuplicateReferences(object, state) {
var objects = [],
duplicatesIndexes = [],
index,
length;
inspectNode(object, objects, duplicatesIndexes);
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
state.duplicates.push(objects[duplicatesIndexes[index]]);
}
state.usedDuplicates = new Array(length);
}
function inspectNode(object, objects, duplicatesIndexes) {
var objectKeyList,
index,
length;
if (object !== null && typeof object === 'object') {
index = objects.indexOf(object);
if (index !== -1) {
if (duplicatesIndexes.indexOf(index) === -1) {
duplicatesIndexes.push(index);
}
} else {
objects.push(object);
if (Array.isArray(object)) {
for (index = 0, length = object.length; index < length; index += 1) {
inspectNode(object[index], objects, duplicatesIndexes);
}
} else {
objectKeyList = Object.keys(object);
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
}
}
}
}
}
function dump(input, options) {
options = options || {};
var state = new State(options);
if (!state.noRefs) getDuplicateReferences(input, state);
var value = input;
if (state.replacer) {
value = state.replacer.call({ '': value }, '', value);
}
if (writeNode(state, 0, value, true, true)) return state.dump + '\n';
return '';
}
module.exports.dump = dump;

View File

@@ -0,0 +1,55 @@
// YAML error class. http://stackoverflow.com/questions/8458984
//
'use strict';
function formatError(exception, compact) {
var where = '', message = exception.reason || '(unknown reason)';
if (!exception.mark) return message;
if (exception.mark.name) {
where += 'in "' + exception.mark.name + '" ';
}
where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';
if (!compact && exception.mark.snippet) {
where += '\n\n' + exception.mark.snippet;
}
return message + ' ' + where;
}
function YAMLException(reason, mark) {
// Super constructor
Error.call(this);
this.name = 'YAMLException';
this.reason = reason;
this.mark = mark;
this.message = formatError(this, false);
// Include stack trace in error object
if (Error.captureStackTrace) {
// Chrome and NodeJS
Error.captureStackTrace(this, this.constructor);
} else {
// FF, IE 10+ and Safari 6+. Fallback for others
this.stack = (new Error()).stack || '';
}
}
// Inherit from Error
YAMLException.prototype = Object.create(Error.prototype);
YAMLException.prototype.constructor = YAMLException;
YAMLException.prototype.toString = function toString(compact) {
return this.name + ': ' + formatError(this, compact);
};
module.exports = YAMLException;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,121 @@
'use strict';
/*eslint-disable max-len*/
var YAMLException = require('./exception');
var Type = require('./type');
function compileList(schema, name) {
var result = [];
schema[name].forEach(function (currentType) {
var newIndex = result.length;
result.forEach(function (previousType, previousIndex) {
if (previousType.tag === currentType.tag &&
previousType.kind === currentType.kind &&
previousType.multi === currentType.multi) {
newIndex = previousIndex;
}
});
result[newIndex] = currentType;
});
return result;
}
function compileMap(/* lists... */) {
var result = {
scalar: {},
sequence: {},
mapping: {},
fallback: {},
multi: {
scalar: [],
sequence: [],
mapping: [],
fallback: []
}
}, index, length;
function collectType(type) {
if (type.multi) {
result.multi[type.kind].push(type);
result.multi['fallback'].push(type);
} else {
result[type.kind][type.tag] = result['fallback'][type.tag] = type;
}
}
for (index = 0, length = arguments.length; index < length; index += 1) {
arguments[index].forEach(collectType);
}
return result;
}
function Schema(definition) {
return this.extend(definition);
}
Schema.prototype.extend = function extend(definition) {
var implicit = [];
var explicit = [];
if (definition instanceof Type) {
// Schema.extend(type)
explicit.push(definition);
} else if (Array.isArray(definition)) {
// Schema.extend([ type1, type2, ... ])
explicit = explicit.concat(definition);
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
// Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })
if (definition.implicit) implicit = implicit.concat(definition.implicit);
if (definition.explicit) explicit = explicit.concat(definition.explicit);
} else {
throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' +
'or a schema definition ({ implicit: [...], explicit: [...] })');
}
implicit.forEach(function (type) {
if (!(type instanceof Type)) {
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
}
if (type.loadKind && type.loadKind !== 'scalar') {
throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
}
if (type.multi) {
throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');
}
});
explicit.forEach(function (type) {
if (!(type instanceof Type)) {
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
}
});
var result = Object.create(Schema.prototype);
result.implicit = (this.implicit || []).concat(implicit);
result.explicit = (this.explicit || []).concat(explicit);
result.compiledImplicit = compileList(result, 'implicit');
result.compiledExplicit = compileList(result, 'explicit');
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
return result;
};
module.exports = Schema;

View File

@@ -0,0 +1,11 @@
// Standard YAML's Core schema.
// http://www.yaml.org/spec/1.2/spec.html#id2804923
//
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
// So, Core schema has no distinctions from JSON schema is JS-YAML.
'use strict';
module.exports = require('./json');

View File

@@ -0,0 +1,22 @@
// JS-YAML's default schema for `safeLoad` function.
// It is not described in the YAML specification.
//
// This schema is based on standard YAML's Core schema and includes most of
// extra types described at YAML tag repository. (http://yaml.org/type/)
'use strict';
module.exports = require('./core').extend({
implicit: [
require('../type/timestamp'),
require('../type/merge')
],
explicit: [
require('../type/binary'),
require('../type/omap'),
require('../type/pairs'),
require('../type/set')
]
});

View File

@@ -0,0 +1,17 @@
// Standard YAML's Failsafe schema.
// http://www.yaml.org/spec/1.2/spec.html#id2802346
'use strict';
var Schema = require('../schema');
module.exports = new Schema({
explicit: [
require('../type/str'),
require('../type/seq'),
require('../type/map')
]
});

View File

@@ -0,0 +1,19 @@
// Standard YAML's JSON schema.
// http://www.yaml.org/spec/1.2/spec.html#id2803231
//
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
// So, this schema is not such strict as defined in the YAML specification.
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
'use strict';
module.exports = require('./failsafe').extend({
implicit: [
require('../type/null'),
require('../type/bool'),
require('../type/int'),
require('../type/float')
]
});

View File

@@ -0,0 +1,101 @@
'use strict';
var common = require('./common');
// get snippet for a single line, respecting maxLength
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
var head = '';
var tail = '';
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
if (position - lineStart > maxHalfLength) {
head = ' ... ';
lineStart = position - maxHalfLength + head.length;
}
if (lineEnd - position > maxHalfLength) {
tail = ' ...';
lineEnd = position + maxHalfLength - tail.length;
}
return {
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
pos: position - lineStart + head.length // relative position
};
}
function padStart(string, max) {
return common.repeat(' ', max - string.length) + string;
}
function makeSnippet(mark, options) {
options = Object.create(options || null);
if (!mark.buffer) return null;
if (!options.maxLength) options.maxLength = 79;
if (typeof options.indent !== 'number') options.indent = 1;
if (typeof options.linesBefore !== 'number') options.linesBefore = 3;
if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
var re = /\r?\n|\r|\0/g;
var lineStarts = [ 0 ];
var lineEnds = [];
var match;
var foundLineNo = -1;
while ((match = re.exec(mark.buffer))) {
lineEnds.push(match.index);
lineStarts.push(match.index + match[0].length);
if (mark.position <= match.index && foundLineNo < 0) {
foundLineNo = lineStarts.length - 2;
}
}
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
var result = '', i, line;
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
for (i = 1; i <= options.linesBefore; i++) {
if (foundLineNo - i < 0) break;
line = getLine(
mark.buffer,
lineStarts[foundLineNo - i],
lineEnds[foundLineNo - i],
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
maxLineLength
);
result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
' | ' + line.str + '\n' + result;
}
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
' | ' + line.str + '\n';
result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n';
for (i = 1; i <= options.linesAfter; i++) {
if (foundLineNo + i >= lineEnds.length) break;
line = getLine(
mark.buffer,
lineStarts[foundLineNo + i],
lineEnds[foundLineNo + i],
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
maxLineLength
);
result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
' | ' + line.str + '\n';
}
return result.replace(/\n$/, '');
}
module.exports = makeSnippet;

View File

@@ -0,0 +1,66 @@
'use strict';
var YAMLException = require('./exception');
var TYPE_CONSTRUCTOR_OPTIONS = [
'kind',
'multi',
'resolve',
'construct',
'instanceOf',
'predicate',
'represent',
'representName',
'defaultStyle',
'styleAliases'
];
var YAML_NODE_KINDS = [
'scalar',
'sequence',
'mapping'
];
function compileStyleAliases(map) {
var result = {};
if (map !== null) {
Object.keys(map).forEach(function (style) {
map[style].forEach(function (alias) {
result[String(alias)] = style;
});
});
}
return result;
}
function Type(tag, options) {
options = options || {};
Object.keys(options).forEach(function (name) {
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
}
});
// TODO: Add tag format check.
this.options = options; // keep original options in case user wants to extend this type later
this.tag = tag;
this.kind = options['kind'] || null;
this.resolve = options['resolve'] || function () { return true; };
this.construct = options['construct'] || function (data) { return data; };
this.instanceOf = options['instanceOf'] || null;
this.predicate = options['predicate'] || null;
this.represent = options['represent'] || null;
this.representName = options['representName'] || null;
this.defaultStyle = options['defaultStyle'] || null;
this.multi = options['multi'] || false;
this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
}
}
module.exports = Type;

View File

@@ -0,0 +1,125 @@
'use strict';
/*eslint-disable no-bitwise*/
var Type = require('../type');
// [ 64, 65, 66 ] -> [ padding, CR, LF ]
var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
function resolveYamlBinary(data) {
if (data === null) return false;
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
// Convert one by one.
for (idx = 0; idx < max; idx++) {
code = map.indexOf(data.charAt(idx));
// Skip CR/LF
if (code > 64) continue;
// Fail on illegal characters
if (code < 0) return false;
bitlen += 6;
}
// If there are any bits left, source was corrupted
return (bitlen % 8) === 0;
}
function constructYamlBinary(data) {
var idx, tailbits,
input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
max = input.length,
map = BASE64_MAP,
bits = 0,
result = [];
// Collect by 6*4 bits (3 bytes)
for (idx = 0; idx < max; idx++) {
if ((idx % 4 === 0) && idx) {
result.push((bits >> 16) & 0xFF);
result.push((bits >> 8) & 0xFF);
result.push(bits & 0xFF);
}
bits = (bits << 6) | map.indexOf(input.charAt(idx));
}
// Dump tail
tailbits = (max % 4) * 6;
if (tailbits === 0) {
result.push((bits >> 16) & 0xFF);
result.push((bits >> 8) & 0xFF);
result.push(bits & 0xFF);
} else if (tailbits === 18) {
result.push((bits >> 10) & 0xFF);
result.push((bits >> 2) & 0xFF);
} else if (tailbits === 12) {
result.push((bits >> 4) & 0xFF);
}
return new Uint8Array(result);
}
function representYamlBinary(object /*, style*/) {
var result = '', bits = 0, idx, tail,
max = object.length,
map = BASE64_MAP;
// Convert every three bytes to 4 ASCII characters.
for (idx = 0; idx < max; idx++) {
if ((idx % 3 === 0) && idx) {
result += map[(bits >> 18) & 0x3F];
result += map[(bits >> 12) & 0x3F];
result += map[(bits >> 6) & 0x3F];
result += map[bits & 0x3F];
}
bits = (bits << 8) + object[idx];
}
// Dump tail
tail = max % 3;
if (tail === 0) {
result += map[(bits >> 18) & 0x3F];
result += map[(bits >> 12) & 0x3F];
result += map[(bits >> 6) & 0x3F];
result += map[bits & 0x3F];
} else if (tail === 2) {
result += map[(bits >> 10) & 0x3F];
result += map[(bits >> 4) & 0x3F];
result += map[(bits << 2) & 0x3F];
result += map[64];
} else if (tail === 1) {
result += map[(bits >> 2) & 0x3F];
result += map[(bits << 4) & 0x3F];
result += map[64];
result += map[64];
}
return result;
}
function isBinary(obj) {
return Object.prototype.toString.call(obj) === '[object Uint8Array]';
}
module.exports = new Type('tag:yaml.org,2002:binary', {
kind: 'scalar',
resolve: resolveYamlBinary,
construct: constructYamlBinary,
predicate: isBinary,
represent: representYamlBinary
});

View File

@@ -0,0 +1,35 @@
'use strict';
var Type = require('../type');
function resolveYamlBoolean(data) {
if (data === null) return false;
var max = data.length;
return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
(max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
}
function constructYamlBoolean(data) {
return data === 'true' ||
data === 'True' ||
data === 'TRUE';
}
function isBoolean(object) {
return Object.prototype.toString.call(object) === '[object Boolean]';
}
module.exports = new Type('tag:yaml.org,2002:bool', {
kind: 'scalar',
resolve: resolveYamlBoolean,
construct: constructYamlBoolean,
predicate: isBoolean,
represent: {
lowercase: function (object) { return object ? 'true' : 'false'; },
uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
camelcase: function (object) { return object ? 'True' : 'False'; }
},
defaultStyle: 'lowercase'
});

View File

@@ -0,0 +1,97 @@
'use strict';
var common = require('../common');
var Type = require('../type');
var YAML_FLOAT_PATTERN = new RegExp(
// 2.5e4, 2.5 and integers
'^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
// .2e4, .2
// special case, seems not from spec
'|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
// .inf
'|[-+]?\\.(?:inf|Inf|INF)' +
// .nan
'|\\.(?:nan|NaN|NAN))$');
function resolveYamlFloat(data) {
if (data === null) return false;
if (!YAML_FLOAT_PATTERN.test(data) ||
// Quick hack to not allow integers end with `_`
// Probably should update regexp & check speed
data[data.length - 1] === '_') {
return false;
}
return true;
}
function constructYamlFloat(data) {
var value, sign;
value = data.replace(/_/g, '').toLowerCase();
sign = value[0] === '-' ? -1 : 1;
if ('+-'.indexOf(value[0]) >= 0) {
value = value.slice(1);
}
if (value === '.inf') {
return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
} else if (value === '.nan') {
return NaN;
}
return sign * parseFloat(value, 10);
}
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
function representYamlFloat(object, style) {
var res;
if (isNaN(object)) {
switch (style) {
case 'lowercase': return '.nan';
case 'uppercase': return '.NAN';
case 'camelcase': return '.NaN';
}
} else if (Number.POSITIVE_INFINITY === object) {
switch (style) {
case 'lowercase': return '.inf';
case 'uppercase': return '.INF';
case 'camelcase': return '.Inf';
}
} else if (Number.NEGATIVE_INFINITY === object) {
switch (style) {
case 'lowercase': return '-.inf';
case 'uppercase': return '-.INF';
case 'camelcase': return '-.Inf';
}
} else if (common.isNegativeZero(object)) {
return '-0.0';
}
res = object.toString(10);
// JS stringifier can build scientific format without dots: 5e-100,
// while YAML requres dot: 5.e-100. Fix it with simple hack
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
}
function isFloat(object) {
return (Object.prototype.toString.call(object) === '[object Number]') &&
(object % 1 !== 0 || common.isNegativeZero(object));
}
module.exports = new Type('tag:yaml.org,2002:float', {
kind: 'scalar',
resolve: resolveYamlFloat,
construct: constructYamlFloat,
predicate: isFloat,
represent: representYamlFloat,
defaultStyle: 'lowercase'
});

View File

@@ -0,0 +1,156 @@
'use strict';
var common = require('../common');
var Type = require('../type');
function isHexCode(c) {
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
((0x61/* a */ <= c) && (c <= 0x66/* f */));
}
function isOctCode(c) {
return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
}
function isDecCode(c) {
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
}
function resolveYamlInteger(data) {
if (data === null) return false;
var max = data.length,
index = 0,
hasDigits = false,
ch;
if (!max) return false;
ch = data[index];
// sign
if (ch === '-' || ch === '+') {
ch = data[++index];
}
if (ch === '0') {
// 0
if (index + 1 === max) return true;
ch = data[++index];
// base 2, base 8, base 16
if (ch === 'b') {
// base 2
index++;
for (; index < max; index++) {
ch = data[index];
if (ch === '_') continue;
if (ch !== '0' && ch !== '1') return false;
hasDigits = true;
}
return hasDigits && ch !== '_';
}
if (ch === 'x') {
// base 16
index++;
for (; index < max; index++) {
ch = data[index];
if (ch === '_') continue;
if (!isHexCode(data.charCodeAt(index))) return false;
hasDigits = true;
}
return hasDigits && ch !== '_';
}
if (ch === 'o') {
// base 8
index++;
for (; index < max; index++) {
ch = data[index];
if (ch === '_') continue;
if (!isOctCode(data.charCodeAt(index))) return false;
hasDigits = true;
}
return hasDigits && ch !== '_';
}
}
// base 10 (except 0)
// value should not start with `_`;
if (ch === '_') return false;
for (; index < max; index++) {
ch = data[index];
if (ch === '_') continue;
if (!isDecCode(data.charCodeAt(index))) {
return false;
}
hasDigits = true;
}
// Should have digits and should not end with `_`
if (!hasDigits || ch === '_') return false;
return true;
}
function constructYamlInteger(data) {
var value = data, sign = 1, ch;
if (value.indexOf('_') !== -1) {
value = value.replace(/_/g, '');
}
ch = value[0];
if (ch === '-' || ch === '+') {
if (ch === '-') sign = -1;
value = value.slice(1);
ch = value[0];
}
if (value === '0') return 0;
if (ch === '0') {
if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);
if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);
}
return sign * parseInt(value, 10);
}
function isInteger(object) {
return (Object.prototype.toString.call(object)) === '[object Number]' &&
(object % 1 === 0 && !common.isNegativeZero(object));
}
module.exports = new Type('tag:yaml.org,2002:int', {
kind: 'scalar',
resolve: resolveYamlInteger,
construct: constructYamlInteger,
predicate: isInteger,
represent: {
binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },
decimal: function (obj) { return obj.toString(10); },
/* eslint-disable max-len */
hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
},
defaultStyle: 'decimal',
styleAliases: {
binary: [ 2, 'bin' ],
octal: [ 8, 'oct' ],
decimal: [ 10, 'dec' ],
hexadecimal: [ 16, 'hex' ]
}
});

View File

@@ -0,0 +1,8 @@
'use strict';
var Type = require('../type');
module.exports = new Type('tag:yaml.org,2002:map', {
kind: 'mapping',
construct: function (data) { return data !== null ? data : {}; }
});

View File

@@ -0,0 +1,12 @@
'use strict';
var Type = require('../type');
function resolveYamlMerge(data) {
return data === '<<' || data === null;
}
module.exports = new Type('tag:yaml.org,2002:merge', {
kind: 'scalar',
resolve: resolveYamlMerge
});

View File

@@ -0,0 +1,35 @@
'use strict';
var Type = require('../type');
function resolveYamlNull(data) {
if (data === null) return true;
var max = data.length;
return (max === 1 && data === '~') ||
(max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
}
function constructYamlNull() {
return null;
}
function isNull(object) {
return object === null;
}
module.exports = new Type('tag:yaml.org,2002:null', {
kind: 'scalar',
resolve: resolveYamlNull,
construct: constructYamlNull,
predicate: isNull,
represent: {
canonical: function () { return '~'; },
lowercase: function () { return 'null'; },
uppercase: function () { return 'NULL'; },
camelcase: function () { return 'Null'; },
empty: function () { return ''; }
},
defaultStyle: 'lowercase'
});

View File

@@ -0,0 +1,44 @@
'use strict';
var Type = require('../type');
var _hasOwnProperty = Object.prototype.hasOwnProperty;
var _toString = Object.prototype.toString;
function resolveYamlOmap(data) {
if (data === null) return true;
var objectKeys = [], index, length, pair, pairKey, pairHasKey,
object = data;
for (index = 0, length = object.length; index < length; index += 1) {
pair = object[index];
pairHasKey = false;
if (_toString.call(pair) !== '[object Object]') return false;
for (pairKey in pair) {
if (_hasOwnProperty.call(pair, pairKey)) {
if (!pairHasKey) pairHasKey = true;
else return false;
}
}
if (!pairHasKey) return false;
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
else return false;
}
return true;
}
function constructYamlOmap(data) {
return data !== null ? data : [];
}
module.exports = new Type('tag:yaml.org,2002:omap', {
kind: 'sequence',
resolve: resolveYamlOmap,
construct: constructYamlOmap
});

View File

@@ -0,0 +1,53 @@
'use strict';
var Type = require('../type');
var _toString = Object.prototype.toString;
function resolveYamlPairs(data) {
if (data === null) return true;
var index, length, pair, keys, result,
object = data;
result = new Array(object.length);
for (index = 0, length = object.length; index < length; index += 1) {
pair = object[index];
if (_toString.call(pair) !== '[object Object]') return false;
keys = Object.keys(pair);
if (keys.length !== 1) return false;
result[index] = [ keys[0], pair[keys[0]] ];
}
return true;
}
function constructYamlPairs(data) {
if (data === null) return [];
var index, length, pair, keys, result,
object = data;
result = new Array(object.length);
for (index = 0, length = object.length; index < length; index += 1) {
pair = object[index];
keys = Object.keys(pair);
result[index] = [ keys[0], pair[keys[0]] ];
}
return result;
}
module.exports = new Type('tag:yaml.org,2002:pairs', {
kind: 'sequence',
resolve: resolveYamlPairs,
construct: constructYamlPairs
});

View File

@@ -0,0 +1,8 @@
'use strict';
var Type = require('../type');
module.exports = new Type('tag:yaml.org,2002:seq', {
kind: 'sequence',
construct: function (data) { return data !== null ? data : []; }
});

View File

@@ -0,0 +1,29 @@
'use strict';
var Type = require('../type');
var _hasOwnProperty = Object.prototype.hasOwnProperty;
function resolveYamlSet(data) {
if (data === null) return true;
var key, object = data;
for (key in object) {
if (_hasOwnProperty.call(object, key)) {
if (object[key] !== null) return false;
}
}
return true;
}
function constructYamlSet(data) {
return data !== null ? data : {};
}
module.exports = new Type('tag:yaml.org,2002:set', {
kind: 'mapping',
resolve: resolveYamlSet,
construct: constructYamlSet
});

View File

@@ -0,0 +1,8 @@
'use strict';
var Type = require('../type');
module.exports = new Type('tag:yaml.org,2002:str', {
kind: 'scalar',
construct: function (data) { return data !== null ? data : ''; }
});

View File

@@ -0,0 +1,88 @@
'use strict';
var Type = require('../type');
var YAML_DATE_REGEXP = new RegExp(
'^([0-9][0-9][0-9][0-9])' + // [1] year
'-([0-9][0-9])' + // [2] month
'-([0-9][0-9])$'); // [3] day
var YAML_TIMESTAMP_REGEXP = new RegExp(
'^([0-9][0-9][0-9][0-9])' + // [1] year
'-([0-9][0-9]?)' + // [2] month
'-([0-9][0-9]?)' + // [3] day
'(?:[Tt]|[ \\t]+)' + // ...
'([0-9][0-9]?)' + // [4] hour
':([0-9][0-9])' + // [5] minute
':([0-9][0-9])' + // [6] second
'(?:\\.([0-9]*))?' + // [7] fraction
'(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
'(?::([0-9][0-9]))?))?$'); // [11] tz_minute
function resolveYamlTimestamp(data) {
if (data === null) return false;
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
return false;
}
function constructYamlTimestamp(data) {
var match, year, month, day, hour, minute, second, fraction = 0,
delta = null, tz_hour, tz_minute, date;
match = YAML_DATE_REGEXP.exec(data);
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
if (match === null) throw new Error('Date resolve error');
// match: [1] year [2] month [3] day
year = +(match[1]);
month = +(match[2]) - 1; // JS month starts with 0
day = +(match[3]);
if (!match[4]) { // no hour
return new Date(Date.UTC(year, month, day));
}
// match: [4] hour [5] minute [6] second [7] fraction
hour = +(match[4]);
minute = +(match[5]);
second = +(match[6]);
if (match[7]) {
fraction = match[7].slice(0, 3);
while (fraction.length < 3) { // milli-seconds
fraction += '0';
}
fraction = +fraction;
}
// match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
if (match[9]) {
tz_hour = +(match[10]);
tz_minute = +(match[11] || 0);
delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
if (match[9] === '-') delta = -delta;
}
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
if (delta) date.setTime(date.getTime() - delta);
return date;
}
function representYamlTimestamp(object /*, style*/) {
return object.toISOString();
}
module.exports = new Type('tag:yaml.org,2002:timestamp', {
kind: 'scalar',
resolve: resolveYamlTimestamp,
construct: constructYamlTimestamp,
instanceOf: Date,
represent: representYamlTimestamp
});

View File

@@ -0,0 +1,66 @@
{
"name": "js-yaml",
"version": "4.1.1",
"description": "YAML 1.2 parser and serializer",
"keywords": [
"yaml",
"parser",
"serializer",
"pyyaml"
],
"author": "Vladimir Zapparov <dervus.grim@gmail.com>",
"contributors": [
"Aleksey V Zapparov <ixti@member.fsf.org> (http://www.ixti.net/)",
"Vitaly Puzrin <vitaly@rcdesign.ru> (https://github.com/puzrin)",
"Martin Grenfell <martin.grenfell@gmail.com> (http://got-ravings.blogspot.com)"
],
"license": "MIT",
"repository": "nodeca/js-yaml",
"files": [
"index.js",
"lib/",
"bin/",
"dist/"
],
"bin": {
"js-yaml": "bin/js-yaml.js"
},
"module": "./dist/js-yaml.mjs",
"exports": {
".": {
"import": "./dist/js-yaml.mjs",
"require": "./index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"lint": "eslint .",
"test": "npm run lint && mocha",
"coverage": "npm run lint && nyc mocha && nyc report --reporter html",
"demo": "npm run lint && node support/build_demo.js",
"gh-demo": "npm run demo && gh-pages -d demo -f",
"browserify": "rollup -c support/rollup.config.js",
"prepublishOnly": "npm run gh-demo"
},
"unpkg": "dist/js-yaml.min.js",
"jsdelivr": "dist/js-yaml.min.js",
"dependencies": {
"argparse": "^2.0.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"ansi": "^0.3.1",
"benchmark": "^2.1.4",
"codemirror": "^5.13.4",
"eslint": "^7.0.0",
"fast-check": "^2.8.0",
"gh-pages": "^3.1.0",
"mocha": "^8.2.1",
"nyc": "^15.1.0",
"rollup": "^2.34.1",
"rollup-plugin-node-polyfills": "^0.2.1",
"rollup-plugin-terser": "^7.0.2",
"shelljs": "^0.8.4"
}
}

42
node_modules/@expo/xcpretty/package.json generated vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"name": "@expo/xcpretty",
"description": "Parse and format xcodebuild logs",
"version": "4.4.1",
"main": "build/index.js",
"types": "build/index.d.ts",
"author": "Evan Bacon <bacon@expo.io> (https://github.com/evanbacon)",
"homepage": "https://github.com/expo/expo-cli",
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "https://github.com/expo/expo-cli.git"
},
"bin": {
"excpretty": "./build/cli.js"
},
"scripts": {
"watch": "tsc --watch",
"build": "tsc",
"prepare": "yarn run clean && yarn build",
"clean": "rimraf build ./tsconfig.tsbuildinfo",
"lint": "eslint . --ext .ts",
"test": "jest"
},
"keywords": [
"xcodebuild",
"formatter",
"logging"
],
"files": [
"build"
],
"dependencies": {
"@babel/code-frame": "^7.20.0",
"chalk": "^4.1.0",
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@types/babel__code-frame": "^7.27.0",
"@types/js-yaml": "^4.0.1"
}
}