%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/node_modules/@rushstack/eslint-patch/lib/
Upload File :
Create Path :
Current File : /var/www/html/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js.map

{"version":3,"file":"modern-module-resolution.js","sourceRoot":"","sources":["../src/modern-module-resolution.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;AAE3D,wEAAwE;AACxE,EAAE;AACF,oHAAoH;AACpH,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,MAAM,uBAAuB,GAA6B,CAAC,EAAE,EAAE,EAAE,CAC/D,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,CAAC,EAAE,IAAI,MAAM,IAAI,EAAE,IAAK,EAAwB,CAAC,IAAI,KAAK,kBAAkB,CAAC;AAE1G,+BAA+B;AAC/B,oDAAoD;AACpD,IAAI,kBAAkB,GAAuB,SAAS,CAAC;AAEvD,0CAA0C;AAC1C,2DAA2D;AAC3D,IAAI,sBAAsB,GAAuB,SAAS,CAAC;AAE3D,8CAA8C;AAC9C,sEAAsE;AACtE,IAAI,kBAAkB,GAAuB,SAAS,CAAC;AAEvD,uDAAuD;AACvD,qCAAqC;AACrC,IAAI,YAAY,GAAuB,SAAS,CAAC;AAEjD,uCAAuC;AACvC,KAAK,IAAI,aAAa,GAAG,MAAM,IAAM;IACnC,IAAI,CAAC,kBAAkB,EAAE;QACvB,yEAAyE;QACzE,2CAA2C;QAC3C,IAAI;YACF,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CACjC,OAAO,CAAC,OAAO,CAAC,+BAA+B,EAAE,EAAE,KAAK,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAClF,CAAC;YAEF,6DAA6D;YAC7D,0CAA0C;YAC1C,IAAI,IAAI,CA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AAS,CAAC,WAAW,GAAG,UAAU,IAAY,EAAE,GAA4B;YAC7F,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,CAAC;YAC/C,IAAI;gBACF,cAAc,CAAC,OAAO,GAAG,UAAU,UAAkB,EAAE,cAAsB;oBAC3E,uDAAuD;oBACvD,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC9D,CAAC,CAAC;gBACF,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;aAClD;oBAAS;gBACR,cAAc,CAAC,OAAO,GAAG,eAAe,CAAC;aAC1C;QACH,CAAC,CAAC;KACH;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\n// This is a workaround for https://github.com/eslint/eslint/issues/3458\r\n//\r\n// To correct how ESLint searches for plugin packages, add this line to the top of your project's .eslintrc.js file:\r\n//\r\n//    require(\"@rushstack/eslint-patch/modern-module-resolution\");\r\n//\r\nconst path = require('path');\r\nconst fs = require('fs');\r\n\r\nconst isModuleResolutionError: (ex: unknown) => boolean = (ex) =>\r\n  typeof ex === 'object' && !!ex && 'code' in ex && (ex as { code: unknown }).code === 'MODULE_NOT_FOUND';\r\n\r\n// Module path for eslintrc.cjs\r\n// Example: \".../@eslint/eslintrc/dist/eslintrc.cjs\"\r\nlet eslintrcBundlePath: string | undefined = undefined;\r\n\r\n// Module path for config-array-factory.js\r\n// Example: \".../@eslint/eslintrc/lib/config-array-factory\"\r\nlet configArrayFactoryPath: string | undefined = undefined;\r\n\r\n// Module path for relative-module-resolver.js\r\n// Example: \".../@eslint/eslintrc/lib/shared/relative-module-resolver\"\r\nlet moduleResolverPath: string | undefined = undefined;\r\n\r\n// Folder path where ESLint's package.json can be found\r\n// Example: \".../node_modules/eslint\"\r\nlet eslintFolder: string | undefined = undefined;\r\n\r\n// Probe for the ESLint >=8.0.0 layout:\r\nfor (let currentModule = module; ; ) {\r\n  if (!eslintrcBundlePath) {\r\n    // For ESLint >=8.0.0, all @eslint/eslintrc code is bundled at this path:\r\n    //   .../@eslint/eslintrc/dist/eslintrc.cjs\r\n    try {\r\n      const eslintrcFolder = path.dirname(\r\n        require.resolve('@eslint/eslintrc/package.json', { paths: [currentModule.path] })\r\n      );\r\n\r\n      // Make sure we actually resolved the module in our call path\r\n      // and not some other spurious dependency.\r\n      if (path.join(eslintrcFolder, 'dist/eslintrc.cjs') === currentModule.filename) {\r\n        eslintrcBundlePath = path.join(eslintrcFolder, 'dist/eslintrc.cjs');\r\n      }\r\n    } catch (ex: unknown) {\r\n      // Module resolution failures are expected, as we're walking\r\n      // up our require stack to look for eslint. All other errors\r\n      // are rethrown.\r\n      if (!isModuleResolutionError(ex)) {\r\n        throw ex;\r\n      }\r\n    }\r\n  } else {\r\n    // Next look for a file in ESLint's folder\r\n    //   .../eslint/lib/cli-engine/cli-engine.js\r\n    try {\r\n      const eslintCandidateFolder = path.dirname(\r\n        require.resolve('eslint/package.json', {\r\n          paths: [currentModule.path]\r\n        })\r\n      );\r\n\r\n      // Make sure we actually resolved the module in our call path\r\n      // and not some other spurious dependency.\r\n      if (path.join(eslintCandidateFolder, 'lib/cli-engine/cli-engine.js') === currentModule.filename) {\r\n        eslintFolder = eslintCandidateFolder;\r\n        break;\r\n      }\r\n    } catch (ex: unknown) {\r\n      // Module resolution failures are expected, as we're walking\r\n      // up our require stack to look for eslint. All other errors\r\n      // are rethrown.\r\n      if (!isModuleResolutionError(ex)) {\r\n        throw ex;\r\n      }\r\n    }\r\n  }\r\n\r\n  if (!currentModule.parent) {\r\n    break;\r\n  }\r\n  currentModule = currentModule.parent;\r\n}\r\n\r\nif (!eslintFolder) {\r\n  // Probe for the ESLint >=7.8.0 layout:\r\n  for (let currentModule = module; ; ) {\r\n    if (!configArrayFactoryPath) {\r\n      // For ESLint >=7.8.0, config-array-factory.js is at this path:\r\n      //   .../@eslint/eslintrc/lib/config-array-factory.js\r\n      try {\r\n        const eslintrcFolder = path.dirname(\r\n          require.resolve('@eslint/eslintrc/package.json', {\r\n            paths: [currentModule.path]\r\n          })\r\n        );\r\n\r\n        if (path.join(eslintrcFolder, '/lib/config-array-factory.js') == currentModule.filename) {\r\n          configArrayFactoryPath = path.join(eslintrcFolder, 'lib/config-array-factory.js');\r\n          moduleResolverPath = path.join(eslintrcFolder, 'lib/shared/relative-module-resolver');\r\n        }\r\n      } catch (ex: unknown) {\r\n        // Module resolution failures are expected, as we're walking\r\n        // up our require stack to look for eslint. All other errors\r\n        // are rethrown.\r\n        if (!isModuleResolutionError(ex)) {\r\n          throw ex;\r\n        }\r\n      }\r\n    } else {\r\n      // Next look for a file in ESLint's folder\r\n      //   .../eslint/lib/cli-engine/cli-engine.js\r\n      try {\r\n        const eslintCandidateFolder = path.dirname(\r\n          require.resolve('eslint/package.json', {\r\n            paths: [currentModule.path]\r\n          })\r\n        );\r\n\r\n        if (path.join(eslintCandidateFolder, 'lib/cli-engine/cli-engine.js') == currentModule.filename) {\r\n          eslintFolder = eslintCandidateFolder;\r\n          break;\r\n        }\r\n      } catch (ex: unknown) {\r\n        // Module resolution failures are expected, as we're walking\r\n        // up our require stack to look for eslint. All other errors\r\n        // are rethrown.\r\n        if (!isModuleResolutionError(ex)) {\r\n          throw ex;\r\n        }\r\n      }\r\n    }\r\n\r\n    if (!currentModule.parent) {\r\n      break;\r\n    }\r\n    currentModule = currentModule.parent;\r\n  }\r\n}\r\n\r\nif (!eslintFolder) {\r\n  // Probe for the <7.8.0 layout:\r\n  for (let currentModule = module; ; ) {\r\n    // For ESLint <7.8.0, config-array-factory.js was at this path:\r\n    //   .../eslint/lib/cli-engine/config-array-factory.js\r\n    if (/[\\\\/]eslint[\\\\/]lib[\\\\/]cli-engine[\\\\/]config-array-factory\\.js$/i.test(currentModule.filename)) {\r\n      eslintFolder = path.join(path.dirname(currentModule.filename), '../..');\r\n      configArrayFactoryPath = path.join(eslintFolder, 'lib/cli-engine/config-array-factory');\r\n      moduleResolverPath = path.join(eslintFolder, 'lib/shared/relative-module-resolver');\r\n      break;\r\n    }\r\n\r\n    if (!currentModule.parent) {\r\n      // This was tested with ESLint 6.1.0 .. 7.12.1.\r\n      throw new Error(\r\n        'Failed to patch ESLint because the calling module was not recognized.\\n' +\r\n          'If you are using a newer ESLint version that may be unsupported, please create a GitHub issue:\\n' +\r\n          'https://github.com/microsoft/rushstack/issues'\r\n      );\r\n    }\r\n    currentModule = currentModule.parent;\r\n  }\r\n}\r\n\r\n// Detect the ESLint package version\r\nconst eslintPackageJson = fs.readFileSync(path.join(eslintFolder, 'package.json')).toString();\r\nconst eslintPackageObject = JSON.parse(eslintPackageJson);\r\nconst eslintPackageVersion = eslintPackageObject.version;\r\nconst versionMatch = /^([0-9]+)\\./.exec(eslintPackageVersion); // parse the SemVer MAJOR part\r\nif (!versionMatch) {\r\n  throw new Error('Unable to parse ESLint version: ' + eslintPackageVersion);\r\n}\r\nconst eslintMajorVersion = Number(versionMatch[1]);\r\nif (!(eslintMajorVersion >= 6 && eslintMajorVersion <= 8)) {\r\n  throw new Error(\r\n    'The patch-eslint.js script has only been tested with ESLint version 6.x, 7.x, and 8.x.' +\r\n      ` (Your version: ${eslintPackageVersion})\\n` +\r\n      'Consider reporting a GitHub issue:\\n' +\r\n      'https://github.com/microsoft/rushstack/issues'\r\n  );\r\n}\r\n\r\nlet ConfigArrayFactory;\r\nif (eslintMajorVersion === 8) {\r\n  ConfigArrayFactory = require(eslintrcBundlePath!).Legacy.ConfigArrayFactory;\r\n} else {\r\n  ConfigArrayFactory = require(configArrayFactoryPath!).ConfigArrayFactory;\r\n}\r\nif (!ConfigArrayFactory.__patched) {\r\n  ConfigArrayFactory.__patched = true;\r\n\r\n  let ModuleResolver: { resolve: any };\r\n  if (eslintMajorVersion === 8) {\r\n    ModuleResolver = require(eslintrcBundlePath!).Legacy.ModuleResolver;\r\n  } else {\r\n    ModuleResolver = require(moduleResolverPath!);\r\n  }\r\n  const originalLoadPlugin = ConfigArrayFactory.prototype._loadPlugin;\r\n\r\n  if (eslintMajorVersion === 6) {\r\n    // ESLint 6.x\r\n    ConfigArrayFactory.prototype._loadPlugin = function (\r\n      name: string,\r\n      importerPath: string,\r\n      importerName: string\r\n    ) {\r\n      const originalResolve = ModuleResolver.resolve;\r\n      try {\r\n        ModuleResolver.resolve = function (moduleName: string, relativeToPath: string) {\r\n          // resolve using importerPath instead of relativeToPath\r\n          return originalResolve.call(this, moduleName, importerPath);\r\n        };\r\n        return originalLoadPlugin.apply(this, arguments);\r\n      } finally {\r\n        ModuleResolver.resolve = originalResolve;\r\n      }\r\n    };\r\n  } else {\r\n    // ESLint 7.x || 8.x\r\n    ConfigArrayFactory.prototype._loadPlugin = function (name: string, ctx: Record<string, unknown>) {\r\n      const originalResolve = ModuleResolver.resolve;\r\n      try {\r\n        ModuleResolver.resolve = function (moduleName: string, relativeToPath: string) {\r\n          // resolve using ctx.filePath instead of relativeToPath\r\n          return originalResolve.call(this, moduleName, ctx.filePath);\r\n        };\r\n        return originalLoadPlugin.apply(this, arguments);\r\n      } finally {\r\n        ModuleResolver.resolve = originalResolve;\r\n      }\r\n    };\r\n  }\r\n}\r\n"]}

Zerion Mini Shell 1.0