UNPKG

3.1 kBSource Map (JSON)View Raw
1{"version":3,"file":"DocumenterConfig.js","sourceRoot":"","sources":["../../src/documenters/DocumenterConfig.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAAiF;AAEjF,uGAAwE;AAExE;;;;GAIG;AACH,MAAa,gBAAgB;IAoB3B,YAAoB,QAAgB,EAAE,UAAuB;QAC3D,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,QAAQ,UAAU,CAAC,WAAW,EAAE;YAC9B,KAAK,IAAI;gBACP,IAAI,CAAC,WAAW,GAAG,+BAAW,CAAC,EAAE,CAAC;gBAClC,MAAM;YACR,KAAK,IAAI;gBACP,IAAI,CAAC,WAAW,GAAG,+BAAW,CAAC,SAAS,CAAC;gBACzC,MAAM;YACR;gBACE,IAAI,CAAC,WAAW,GAAG,+BAAW,CAAC,IAAI,CAAC;gBACpC,MAAM;SACT;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,QAAQ,CAAC,cAAsB;QAC3C,MAAM,UAAU,GAAgB,4BAAQ,CAAC,eAAe,CAAC,cAAc,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAEtG,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;IACxE,CAAC;;AAlCD;;GAEG;AACoB,2BAAU,GAAe,8BAAU,CAAC,gBAAgB,CAAC,oCAAmB,CAAC,CAAC;AAEjG;;GAEG;AACoB,yBAAQ,GAAW,qBAAqB,CAAC;AAlBrD,4CAAgB","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport { JsonSchema, JsonFile, NewlineKind } from '@rushstack/node-core-library';\nimport type { IConfigFile } from './IConfigFile';\nimport apiDocumenterSchema from '../schemas/api-documenter.schema.json';\n\n/**\n * Helper for loading the api-documenter.json file format. Later when the schema is more mature,\n * this class will be used to represent the validated and normalized configuration, whereas `IConfigFile`\n * represents the raw JSON file structure.\n */\nexport class DocumenterConfig {\n public readonly configFilePath: string;\n public readonly configFile: IConfigFile;\n\n /**\n * Specifies what type of newlines API Documenter should use when writing output files. By default, the output files\n * will be written with Windows-style newlines.\n */\n public readonly newlineKind: NewlineKind;\n\n /**\n * The JSON Schema for API Documenter config file (api-documenter.schema.json).\n */\n public static readonly jsonSchema: JsonSchema = JsonSchema.fromLoadedObject(apiDocumenterSchema);\n\n /**\n * The config file name \"api-documenter.json\".\n */\n public static readonly FILENAME: string = 'api-documenter.json';\n\n private constructor(filePath: string, configFile: IConfigFile) {\n this.configFilePath = filePath;\n this.configFile = configFile;\n\n switch (configFile.newlineKind) {\n case 'lf':\n this.newlineKind = NewlineKind.Lf;\n break;\n case 'os':\n this.newlineKind = NewlineKind.OsDefault;\n break;\n default:\n this.newlineKind = NewlineKind.CrLf;\n break;\n }\n }\n\n /**\n * Load and validate an api-documenter.json file.\n */\n public static loadFile(configFilePath: string): DocumenterConfig {\n const configFile: IConfigFile = JsonFile.loadAndValidate(configFilePath, DocumenterConfig.jsonSchema);\n\n return new DocumenterConfig(path.resolve(configFilePath), configFile);\n }\n}\n"]}
\No newline at end of file