utils/node_modules/@rushstack/rig-package/lib/Helpers.js.map
2024-02-07 01:33:07 -05:00

1 line
2.6 KiB
Plaintext

{"version":3,"file":"Helpers.js","sourceRoot":"","sources":["../src/Helpers.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,uCAAyB;AACzB,sDAAkC;AAElC,gEAAgE;AAChE,MAAa,OAAO;IAIX,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAU,EAAE,IAA2B;QAC1E,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAiC,EAAE,MAA8B,EAAE,EAAE;YAC7F,IAAA,iBAAW,EAAC,EAAE,EAAE,IAAI,EAAE,CAAC,KAAmB,EAAE,MAA0B,EAAE,EAAE;gBACxE,IAAI,KAAK,EAAE;oBACT,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;qBAAM;oBACL,OAAO,CAAC,MAAO,CAAC,CAAC;iBAClB;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,cAA2B;QAC3D,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAkC,EAAE,EAAE;YAC9D,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,MAAe,EAAE,EAAE;gBAC5C,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,uEAAuE;IAChE,MAAM,CAAC,kBAAkB,CAAC,SAAiB;QAChD,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAC9B,OAAO,KAAK,CAAC;SACd;QACD,uBAAuB;QACvB,IAAI,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;YACnD,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;;AAjCD,uEAAuE;AACxD,+BAAuB,GAAW,0BAA0B,CAAC;AAFjE,0BAAO","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 * as fs from 'fs';\nimport nodeResolve from 'resolve';\n\n// These helpers avoid taking dependencies on other NPM packages\nexport class Helpers {\n // Based on Path.isDownwardRelative() from @rushstack/node-core-library\n private static _upwardPathSegmentRegex: RegExp = /([\\/\\\\]|^)\\.\\.([\\/\\\\]|$)/;\n\n public static async nodeResolveAsync(id: string, opts: nodeResolve.AsyncOpts): Promise<string> {\n return await new Promise((resolve: (result: string) => void, reject: (error: Error) => void) => {\n nodeResolve(id, opts, (error: Error | null, result: string | undefined) => {\n if (error) {\n reject(error);\n } else {\n resolve(result!);\n }\n });\n });\n }\n\n public static async fsExistsAsync(filesystemPath: fs.PathLike): Promise<boolean> {\n return await new Promise((resolve: (result: boolean) => void) => {\n fs.exists(filesystemPath, (exists: boolean) => {\n resolve(exists);\n });\n });\n }\n\n // Based on Path.isDownwardRelative() from @rushstack/node-core-library\n public static isDownwardRelative(inputPath: string): boolean {\n if (path.isAbsolute(inputPath)) {\n return false;\n }\n // Does it contain \"..\"\n if (Helpers._upwardPathSegmentRegex.test(inputPath)) {\n return false;\n }\n return true;\n }\n}\n"]}