@ms-cloudpack/package-utilities 3.1.6 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/lib/PackageDefinitions.d.ts +21 -5
  2. package/lib/PackageDefinitions.d.ts.map +1 -1
  3. package/lib/PackageDefinitions.js +29 -17
  4. package/lib/PackageDefinitions.js.map +1 -1
  5. package/lib/addExportsMapEntry.d.ts +3 -5
  6. package/lib/addExportsMapEntry.d.ts.map +1 -1
  7. package/lib/addExportsMapEntry.js +3 -3
  8. package/lib/addExportsMapEntry.js.map +1 -1
  9. package/lib/createExportsMap.d.ts +4 -2
  10. package/lib/createExportsMap.d.ts.map +1 -1
  11. package/lib/createExportsMap.js +14 -12
  12. package/lib/createExportsMap.js.map +1 -1
  13. package/lib/createImportMap.d.ts +7 -4
  14. package/lib/createImportMap.d.ts.map +1 -1
  15. package/lib/createImportMap.js +7 -8
  16. package/lib/createImportMap.js.map +1 -1
  17. package/lib/createResolveMap/addLinkedEntryDependencies.d.ts +5 -4
  18. package/lib/createResolveMap/addLinkedEntryDependencies.d.ts.map +1 -1
  19. package/lib/createResolveMap/addLinkedEntryDependencies.js +69 -49
  20. package/lib/createResolveMap/addLinkedEntryDependencies.js.map +1 -1
  21. package/lib/createResolveMap/convertToResolveMap.d.ts +2 -2
  22. package/lib/createResolveMap/convertToResolveMap.d.ts.map +1 -1
  23. package/lib/createResolveMap/convertToResolveMap.js.map +1 -1
  24. package/lib/createResolveMap/createResolveMap.d.ts +6 -5
  25. package/lib/createResolveMap/createResolveMap.d.ts.map +1 -1
  26. package/lib/createResolveMap/createResolveMap.js +5 -7
  27. package/lib/createResolveMap/createResolveMap.js.map +1 -1
  28. package/lib/createResolveMap/detachEntry.d.ts +2 -2
  29. package/lib/createResolveMap/detachEntry.d.ts.map +1 -1
  30. package/lib/createResolveMap/detachEntry.js.map +1 -1
  31. package/lib/createResolveMap/diffResolveMaps.d.ts +5 -4
  32. package/lib/createResolveMap/diffResolveMaps.d.ts.map +1 -1
  33. package/lib/createResolveMap/diffResolveMaps.js +4 -6
  34. package/lib/createResolveMap/diffResolveMaps.js.map +1 -1
  35. package/lib/createResolveMap/entrySorter.d.ts +1 -1
  36. package/lib/createResolveMap/entrySorter.d.ts.map +1 -1
  37. package/lib/createResolveMap/entrySorter.js.map +1 -1
  38. package/lib/createResolveMap/findPackagesFromPath.d.ts +7 -6
  39. package/lib/createResolveMap/findPackagesFromPath.d.ts.map +1 -1
  40. package/lib/createResolveMap/findPackagesFromPath.js +7 -7
  41. package/lib/createResolveMap/findPackagesFromPath.js.map +1 -1
  42. package/lib/createResolveMap/linkPath.d.ts +6 -6
  43. package/lib/createResolveMap/linkPath.d.ts.map +1 -1
  44. package/lib/createResolveMap/linkPath.js +25 -12
  45. package/lib/createResolveMap/linkPath.js.map +1 -1
  46. package/lib/findFileInPackage.d.ts +4 -1
  47. package/lib/findFileInPackage.d.ts.map +1 -1
  48. package/lib/findFileInPackage.js +3 -3
  49. package/lib/findFileInPackage.js.map +1 -1
  50. package/lib/findPackagePath.d.ts +3 -0
  51. package/lib/findPackagePath.d.ts.map +1 -1
  52. package/lib/findPackagePath.js +3 -3
  53. package/lib/findPackagePath.js.map +1 -1
  54. package/lib/findResolveMapEntry.d.ts +2 -2
  55. package/lib/findResolveMapEntry.d.ts.map +1 -1
  56. package/lib/findResolveMapEntry.js.map +1 -1
  57. package/lib/getExportsMap.d.ts +5 -3
  58. package/lib/getExportsMap.d.ts.map +1 -1
  59. package/lib/getExportsMap.js +5 -13
  60. package/lib/getExportsMap.js.map +1 -1
  61. package/lib/getVersion.d.ts +3 -1
  62. package/lib/getVersion.d.ts.map +1 -1
  63. package/lib/getVersion.js +4 -2
  64. package/lib/getVersion.js.map +1 -1
  65. package/lib/index.d.ts +3 -2
  66. package/lib/index.d.ts.map +1 -1
  67. package/lib/index.js.map +1 -1
  68. package/lib/types/LinkedPath.d.ts +22 -0
  69. package/lib/types/LinkedPath.d.ts.map +1 -0
  70. package/lib/types/LinkedPath.js +2 -0
  71. package/lib/types/LinkedPath.js.map +1 -0
  72. package/lib/types/PackageMap.d.ts.map +1 -0
  73. package/lib/types/PackageMap.js.map +1 -0
  74. package/lib/{createResolveMap → types}/ResolveMap.d.ts +3 -0
  75. package/lib/types/ResolveMap.d.ts.map +1 -0
  76. package/lib/types/ResolveMap.js.map +1 -0
  77. package/lib/types/ResolveMapEntry.d.ts.map +1 -0
  78. package/lib/types/ResolveMapEntry.js.map +1 -0
  79. package/package.json +6 -6
  80. package/lib/createResolveMap/PackageMap.d.ts.map +0 -1
  81. package/lib/createResolveMap/PackageMap.js.map +0 -1
  82. package/lib/createResolveMap/ResolveMap.d.ts.map +0 -1
  83. package/lib/createResolveMap/ResolveMap.js.map +0 -1
  84. package/lib/createResolveMap/ResolveMapEntry.d.ts.map +0 -1
  85. package/lib/createResolveMap/ResolveMapEntry.js.map +0 -1
  86. /package/lib/{createResolveMap → types}/PackageMap.d.ts +0 -0
  87. /package/lib/{createResolveMap → types}/PackageMap.js +0 -0
  88. /package/lib/{createResolveMap → types}/ResolveMap.js +0 -0
  89. /package/lib/{createResolveMap → types}/ResolveMapEntry.d.ts +0 -0
  90. /package/lib/{createResolveMap → types}/ResolveMapEntry.js +0 -0
@@ -14,7 +14,7 @@ import { flattenExportsMap } from './flattenExportsMap.js';
14
14
  * exists, or in internal packages, if `src/index.tsx` exists, then this is a valid candidate. If the file does not
15
15
  * exist, then we should not include it in the exports map.
16
16
  */
17
- export async function findFileInPackage(options) {
17
+ export async function findFileInPackage(options, context) {
18
18
  const { packagePath } = options;
19
19
  let filePath = safeRelativePath(options.filePath);
20
20
  let sourcePath;
@@ -57,7 +57,7 @@ export async function findFileInPackage(options) {
57
57
  const result = {};
58
58
  if (isNestedPackageDefinition) {
59
59
  const nestedDefinitionPath = path.dirname(path.join(packagePath, filePath));
60
- const exportsMap = await getExportsMap(nestedDefinitionPath);
60
+ const exportsMap = await getExportsMap({ packagePath: nestedDefinitionPath }, context);
61
61
  const entryPath = flattenExportsMap(exportsMap)['.'];
62
62
  if (entryPath) {
63
63
  typesPath = flattenExportsMap(exportsMap, { conditions: ['types'] })['.'];
@@ -65,7 +65,7 @@ export async function findFileInPackage(options) {
65
65
  ...(await findFileInPackage({
66
66
  packagePath,
67
67
  filePath: safeRelativePath(path.relative(packagePath, path.join(nestedDefinitionPath, entryPath))),
68
- })),
68
+ }, context)),
69
69
  typesPath: typesPath && safeRelativePath(path.relative(packagePath, path.join(nestedDefinitionPath, typesPath))),
70
70
  };
71
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"findFileInPackage.js","sourceRoot":"","sources":["../src/findFileInPackage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAa3D;;;;;;;;;GASG;AAEH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAiC;IACvE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,IAAI,QAAQ,GAAuB,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtE,IAAI,UAA8B,CAAC;IACnC,IAAI,SAA6B,CAAC;IAClC,MAAM,UAAU,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,UAAU,GAAG;QACjB,QAAQ;QACR,QAAQ,GAAG,KAAK;QAChB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACjD,gBAA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IAAI,yBAAyB,EAAE;QAC7B,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAkB,CAAC,CAAC,CAAC;QACtF,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,oBAAoB,CAAC,CAAC;QAC7D,MAAM,SAAS,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC;QAErD,IAAI,SAAS,EAAE;YACb,SAAS,GAAG,iBAAiB,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;YAE1E,OAAO;gBACL,GAAG,CAAC,MAAM,iBAAiB,CAAC;oBAC1B,WAAW;oBACX,QAAQ,EAAE,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC;iBACnG,CAAC,CAAC;gBACH,SAAS,EACP,SAAS,IAAI,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC;aACxG,CAAC;SACH;KACF;IAED,IAAI,SAAS,EAAE;QACb,MAAM,CAAC,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;KAChD;IAED,IAAI,QAAQ,EAAE;QACZ,MAAM,CAAC,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KAC9C;IAED,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;KAClD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import path from 'path';\nimport { intermediateToSourcePath, sourceToIntermediatePath, isFile } from '@ms-cloudpack/path-utilities';\nimport { isExternalPackage } from './isExternalPackage.js';\nimport { safeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { getExportsMap } from './getExportsMap.js';\nimport { flattenExportsMap } from './flattenExportsMap.js';\n\nexport type FindFileInPackageOptions = {\n packagePath: string;\n filePath: string;\n};\n\nexport type FindFileInPackageResult = {\n filePath?: string;\n typesPath?: string;\n sourcePath?: string;\n};\n\n/**\n * Given a requested partial filePath, resolves the relative path intermediate path if the file exists, with special\n * consideration for internal packages, which may not have intermediate files but only source files. Paths returned\n * are always relative and start with `./`.\n *\n * This helper is used in deriving if the given package.json entries are actual validate candidates when constructing an\n * exports map from existing metadata. For example, a package.json may list `main` as `lib/index.js`. If this file\n * exists, or in internal packages, if `src/index.tsx` exists, then this is a valid candidate. If the file does not\n * exist, then we should not include it in the exports map.\n */\n\nexport async function findFileInPackage(options: FindFileInPackageOptions): Promise<FindFileInPackageResult> {\n const { packagePath } = options;\n let filePath: string | undefined = safeRelativePath(options.filePath);\n let sourcePath: string | undefined;\n let typesPath: string | undefined;\n const isInternal = !isExternalPackage(packagePath);\n\n const candidates = [\n filePath,\n filePath + '.js',\n safeRelativePath(path.join(filePath, 'index.js')),\n safeRelativePath(path.join(filePath, 'package.json')),\n ];\n\n filePath = undefined;\n for (const candidate of candidates) {\n if (await isFile(path.join(packagePath, candidate))) {\n filePath = candidate;\n break;\n }\n }\n\n // For internal packages, try and find source/typings and convert to intermediate (which may be missing.)\n if (isInternal) {\n for (const candidate of candidates) {\n const intermediateCandidate = intermediateToSourcePath(candidate, packagePath);\n if (intermediateCandidate && (await isFile(path.join(packagePath, intermediateCandidate)))) {\n sourcePath = intermediateCandidate;\n break;\n }\n }\n\n // If we couldn't find a unique source file, stick with the resolved intermediate file as the only known truth.\n if (filePath && sourcePath === filePath) {\n sourcePath = undefined;\n }\n\n if (sourcePath) {\n if (!filePath) {\n filePath = sourceToIntermediatePath(sourcePath);\n }\n\n typesPath = filePath && path.extname(filePath) === '.js' ? filePath.replace(/\\.js$/, '.d.ts') : undefined;\n }\n }\n\n const isNestedPackageDefinition =\n filePath && path.basename(filePath) === 'package.json' && path.basename(options.filePath) !== 'package.json';\n const result: FindFileInPackageResult = {};\n\n if (isNestedPackageDefinition) {\n const nestedDefinitionPath = path.dirname(path.join(packagePath, filePath as string));\n const exportsMap = await getExportsMap(nestedDefinitionPath);\n const entryPath = flattenExportsMap(exportsMap)['.'];\n\n if (entryPath) {\n typesPath = flattenExportsMap(exportsMap, { conditions: ['types'] })['.'];\n\n return {\n ...(await findFileInPackage({\n packagePath,\n filePath: safeRelativePath(path.relative(packagePath, path.join(nestedDefinitionPath, entryPath))),\n })),\n typesPath:\n typesPath && safeRelativePath(path.relative(packagePath, path.join(nestedDefinitionPath, typesPath))),\n };\n }\n }\n\n if (typesPath) {\n result.typesPath = safeRelativePath(typesPath);\n }\n\n if (filePath) {\n result.filePath = safeRelativePath(filePath);\n }\n\n if (sourcePath) {\n result.sourcePath = safeRelativePath(sourcePath);\n }\n\n return result;\n}\n"]}
1
+ {"version":3,"file":"findFileInPackage.js","sourceRoot":"","sources":["../src/findFileInPackage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAc3D;;;;;;;;;GASG;AAEH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAiC,EACjC,OAA8C;IAE9C,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,IAAI,QAAQ,GAAuB,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtE,IAAI,UAA8B,CAAC;IACnC,IAAI,S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C,CAAC;KAC9C;IAED,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;KAClD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import path from 'path';\nimport { intermediateToSourcePath, sourceToIntermediatePath, isFile } from '@ms-cloudpack/path-utilities';\nimport { isExternalPackage } from './isExternalPackage.js';\nimport { safeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport { getExportsMap } from './getExportsMap.js';\nimport { flattenExportsMap } from './flattenExportsMap.js';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\n\nexport type FindFileInPackageOptions = {\n packagePath: string;\n filePath: string;\n};\n\nexport type FindFileInPackageResult = {\n filePath?: string;\n typesPath?: string;\n sourcePath?: string;\n};\n\n/**\n * Given a requested partial filePath, resolves the relative path intermediate path if the file exists, with special\n * consideration for internal packages, which may not have intermediate files but only source files. Paths returned\n * are always relative and start with `./`.\n *\n * This helper is used in deriving if the given package.json entries are actual validate candidates when constructing an\n * exports map from existing metadata. For example, a package.json may list `main` as `lib/index.js`. If this file\n * exists, or in internal packages, if `src/index.tsx` exists, then this is a valid candidate. If the file does not\n * exist, then we should not include it in the exports map.\n */\n\nexport async function findFileInPackage(\n options: FindFileInPackageOptions,\n context: { packages: PackageDefinitionsCache },\n): Promise<FindFileInPackageResult> {\n const { packagePath } = options;\n let filePath: string | undefined = safeRelativePath(options.filePath);\n let sourcePath: string | undefined;\n let typesPath: string | undefined;\n const isInternal = !isExternalPackage(packagePath);\n\n const candidates = [\n filePath,\n filePath + '.js',\n safeRelativePath(path.join(filePath, 'index.js')),\n safeRelativePath(path.join(filePath, 'package.json')),\n ];\n\n filePath = undefined;\n for (const candidate of candidates) {\n if (await isFile(path.join(packagePath, candidate))) {\n filePath = candidate;\n break;\n }\n }\n\n // For internal packages, try and find source/typings and convert to intermediate (which may be missing.)\n if (isInternal) {\n for (const candidate of candidates) {\n const intermediateCandidate = intermediateToSourcePath(candidate, packagePath);\n if (intermediateCandidate && (await isFile(path.join(packagePath, intermediateCandidate)))) {\n sourcePath = intermediateCandidate;\n break;\n }\n }\n\n // If we couldn't find a unique source file, stick with the resolved intermediate file as the only known truth.\n if (filePath && sourcePath === filePath) {\n sourcePath = undefined;\n }\n\n if (sourcePath) {\n if (!filePath) {\n filePath = sourceToIntermediatePath(sourcePath);\n }\n\n typesPath = filePath && path.extname(filePath) === '.js' ? filePath.replace(/\\.js$/, '.d.ts') : undefined;\n }\n }\n\n const isNestedPackageDefinition =\n filePath && path.basename(filePath) === 'package.json' && path.basename(options.filePath) !== 'package.json';\n const result: FindFileInPackageResult = {};\n\n if (isNestedPackageDefinition) {\n const nestedDefinitionPath = path.dirname(path.join(packagePath, filePath as string));\n const exportsMap = await getExportsMap({ packagePath: nestedDefinitionPath }, context);\n const entryPath = flattenExportsMap(exportsMap)['.'];\n\n if (entryPath) {\n typesPath = flattenExportsMap(exportsMap, { conditions: ['types'] })['.'];\n\n return {\n ...(await findFileInPackage(\n {\n packagePath,\n filePath: safeRelativePath(path.relative(packagePath, path.join(nestedDefinitionPath, entryPath))),\n },\n context,\n )),\n typesPath:\n typesPath && safeRelativePath(path.relative(packagePath, path.join(nestedDefinitionPath, typesPath))),\n };\n }\n }\n\n if (typesPath) {\n result.typesPath = safeRelativePath(typesPath);\n }\n\n if (filePath) {\n result.filePath = safeRelativePath(filePath);\n }\n\n if (sourcePath) {\n result.sourcePath = safeRelativePath(sourcePath);\n }\n\n return result;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
1
2
  /**
2
3
  *
3
4
  * @param options
@@ -8,5 +9,7 @@ export declare function findPackagePath(options: {
8
9
  versionRequirement: string | undefined;
9
10
  cwd: string;
10
11
  gitRootPath?: string;
12
+ }, context: {
13
+ packages: PackageDefinitionsCache;
11
14
  }): Promise<string | undefined>;
12
15
  //# sourceMappingURL=findPackagePath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findPackagePath.d.ts","sourceRoot":"","sources":["../src/findPackagePath.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA2B9B"}
1
+ {"version":3,"file":"findPackagePath.d.ts","sourceRoot":"","sources":["../src/findPackagePath.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE;IACP,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,EACD,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;CACnC,GACA,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA4B7B"}
@@ -1,18 +1,18 @@
1
1
  import path from 'path';
2
2
  import fsPromises from 'fs/promises';
3
3
  import semver from 'semver';
4
- import { PackageDefinitions } from './PackageDefinitions.js';
5
4
  /**
6
5
  *
7
6
  * @param options
8
7
  * @returns
9
8
  */
10
- export async function findPackagePath(options) {
9
+ export async function findPackagePath(options, context) {
11
10
  const { dependencyName, versionRequirement, cwd, gitRootPath } = options;
11
+ const { packages } = context;
12
12
  let packagePath = cwd;
13
13
  do {
14
14
  const resolvedPath = path.join(packagePath, 'node_modules', dependencyName);
15
- const definition = await PackageDefinitions.getInstance().get(resolvedPath);
15
+ const definition = await packages.get(resolvedPath);
16
16
  if (definition?.version && (!versionRequirement || semver.satisfies(definition.version, versionRequirement))) {
17
17
  return fsPromises.realpath(resolvedPath);
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"findPackagePath.js","sourceRoot":"","sources":["../src/findPackagePath.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAKrC;IACC,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IACzE,IAAI,WAAW,GAAG,GAAG,CAAC;IAEtB,GAAG;QACD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAE5E,IAAI,UAAU,EAAE,OAAO,IAAI,CAAC,CAAC,kBAAkB,IAAI,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE;YAC5G,OAAO,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;SAC1C;QAED,mDAAmD;QACnD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAExC,oDAAoD;QACpD,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC9C,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACzC;QAED,yCAAyC;QACzC,IAAI,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YACxC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACzC;KACF,QAAQ,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE;IAElH,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import path from 'path';\nimport fsPromises from 'fs/promises';\nimport semver from 'semver';\nimport { PackageDefinitions } from './PackageDefinitions.js';\n\n/**\n *\n * @param options\n * @returns\n */\nexport async function findPackagePath(options: {\n dependencyName: string;\n versionRequirement: string | undefined;\n cwd: string;\n gitRootPath?: string;\n}): Promise<string | undefined> {\n const { dependencyName, versionRequirement, cwd, gitRootPath } = options;\n let packagePath = cwd;\n\n do {\n const resolvedPath = path.join(packagePath, 'node_modules', dependencyName);\n const definition = await PackageDefinitions.getInstance().get(resolvedPath);\n\n if (definition?.version && (!versionRequirement || semver.satisfies(definition.version, versionRequirement))) {\n return fsPromises.realpath(resolvedPath);\n }\n\n // We haven't found it. Try to move up a directory.\n packagePath = path.dirname(packagePath);\n\n // If we moved up into a scope folder, skip over it.\n if (path.basename(packagePath).startsWith('@')) {\n packagePath = path.dirname(packagePath);\n }\n\n // Skip over nested node_modules folders.\n if (packagePath.endsWith('node_modules')) {\n packagePath = path.dirname(packagePath);\n }\n } while ((!gitRootPath || packagePath.length >= gitRootPath.length) && path.dirname(packagePath) !== packagePath);\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"findPackagePath.js","sourceRoot":"","sources":["../src/findPackagePath.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAKC,EACD,OAEC;IAED,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IACzE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC7B,IAAI,WAAW,GAAG,GAAG,CAAC;IAEtB,GAAG;QACD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAEpD,IAAI,UAAU,EAAE,OAAO,IAAI,CAAC,CAAC,kBAAkB,IAAI,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE;YAC5G,OAAO,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;SAC1C;QAED,mDAAmD;QACnD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAExC,oDAAoD;QACpD,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC9C,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACzC;QAED,yCAAyC;QACzC,IAAI,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YACxC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACzC;KACF,QAAQ,CAAC,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE;IAElH,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import path from 'path';\nimport fsPromises from 'fs/promises';\nimport semver from 'semver';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\n\n/**\n *\n * @param options\n * @returns\n */\nexport async function findPackagePath(\n options: {\n dependencyName: string;\n versionRequirement: string | undefined;\n cwd: string;\n gitRootPath?: string;\n },\n context: {\n packages: PackageDefinitionsCache;\n },\n): Promise<string | undefined> {\n const { dependencyName, versionRequirement, cwd, gitRootPath } = options;\n const { packages } = context;\n let packagePath = cwd;\n\n do {\n const resolvedPath = path.join(packagePath, 'node_modules', dependencyName);\n const definition = await packages.get(resolvedPath);\n\n if (definition?.version && (!versionRequirement || semver.satisfies(definition.version, versionRequirement))) {\n return fsPromises.realpath(resolvedPath);\n }\n\n // We haven't found it. Try to move up a directory.\n packagePath = path.dirname(packagePath);\n\n // If we moved up into a scope folder, skip over it.\n if (path.basename(packagePath).startsWith('@')) {\n packagePath = path.dirname(packagePath);\n }\n\n // Skip over nested node_modules folders.\n if (packagePath.endsWith('node_modules')) {\n packagePath = path.dirname(packagePath);\n }\n } while ((!gitRootPath || packagePath.length >= gitRootPath.length) && path.dirname(packagePath) !== packagePath);\n\n return undefined;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import type { ResolveMap } from './createResolveMap/ResolveMap.js';
2
- import type { ResolveMapEntry } from './createResolveMap/ResolveMapEntry.js';
1
+ import type { ResolveMap } from './types/ResolveMap.js';
2
+ import type { ResolveMapEntry } from './types/ResolveMapEntry.js';
3
3
  import type { PackageJson } from '@ms-cloudpack/bundler-types';
4
4
  /**
5
5
  * Helper which, given a definition/resolveMap/dependency name, returns the resolve map entry for the dependency.
@@ -1 +1 @@
1
- {"version":3,"file":"findResolveMapEntry.d.ts","sourceRoot":"","sources":["../src/findResolveMapEntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,UAAU,EACV,UAAU,EACV,OAAO,GACR,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,GAAG,eAAe,GAAG,SAAS,CA2B9B"}
1
+ {"version":3,"file":"findResolveMapEntry.d.ts","sourceRoot":"","sources":["../src/findResolveMapEntry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,UAAU,EACV,UAAU,EACV,OAAO,GACR,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,GAAG,eAAe,GAAG,SAAS,CA2B9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"findResolveMapEntry.js","sourceRoot":"","sources":["../src/findResolveMapEntry.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,WAAW,EACX,UAAU,EACV,UAAU,EACV,OAAO,GAMR;IACC,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAE7C,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,UAAU,IAAI,CAAC,OAAO,EAAE;QAC3B,OAAO,YAAY,CAAC;KACrB;IAED,IAAI,OAAO,EAAE;QACX,IAAI,YAAY,CAAC,OAAO,KAAK,OAAO,EAAE;YACpC,OAAO,YAAY,CAAC;SACrB;QAED,OAAO,YAAY,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC;KAC/C;IAED,IAAI,UAAU,EAAE;QACd,MAAM,YAAY,GAA0B,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACvF,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;QAE/G,OAAO,WAAW,IAAI,YAAY,CAAC;KACpC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { ResolveMap } from './createResolveMap/ResolveMap.js';\nimport type { ResolveMapEntry } from './createResolveMap/ResolveMapEntry.js';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\n\n/**\n * Helper which, given a definition/resolveMap/dependency name, returns the resolve map entry for the dependency.\n */\nexport function findResolveMapEntry({\n packageName,\n resolveMap,\n definition,\n version,\n}: {\n packageName: string;\n resolveMap: ResolveMap;\n version?: string;\n definition?: PackageJson;\n}): ResolveMapEntry | undefined {\n const resolveEntry = resolveMap[packageName];\n\n if (!resolveEntry) {\n return undefined;\n }\n\n if (!definition && !version) {\n return resolveEntry;\n }\n\n if (version) {\n if (resolveEntry.version === version) {\n return resolveEntry;\n }\n\n return resolveEntry.scopedVersions?.[version];\n }\n\n if (definition) {\n const requiredById: `${string}@${string}` = `${definition.name}@${definition.version}`;\n const scopedEntry = Object.values(resolveEntry.scopedVersions || {}).find((e) => !!e.requiredBy[requiredById]);\n\n return scopedEntry || resolveEntry;\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"findResolveMapEntry.js","sourceRoot":"","sources":["../src/findResolveMapEntry.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,WAAW,EACX,UAAU,EACV,UAAU,EACV,OAAO,GAMR;IACC,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAE7C,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,UAAU,IAAI,CAAC,OAAO,EAAE;QAC3B,OAAO,YAAY,CAAC;KACrB;IAED,IAAI,OAAO,EAAE;QACX,IAAI,YAAY,CAAC,OAAO,KAAK,OAAO,EAAE;YACpC,OAAO,YAAY,CAAC;SACrB;QAED,OAAO,YAAY,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC;KAC/C;IAED,IAAI,UAAU,EAAE;QACd,MAAM,YAAY,GAA0B,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;QACvF,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;QAE/G,OAAO,WAAW,IAAI,YAAY,CAAC;KACpC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { ResolveMap } from './types/ResolveMap.js';\nimport type { ResolveMapEntry } from './types/ResolveMapEntry.js';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\n\n/**\n * Helper which, given a definition/resolveMap/dependency name, returns the resolve map entry for the dependency.\n */\nexport function findResolveMapEntry({\n packageName,\n resolveMap,\n definition,\n version,\n}: {\n packageName: string;\n resolveMap: ResolveMap;\n version?: string;\n definition?: PackageJson;\n}): ResolveMapEntry | undefined {\n const resolveEntry = resolveMap[packageName];\n\n if (!resolveEntry) {\n return undefined;\n }\n\n if (!definition && !version) {\n return resolveEntry;\n }\n\n if (version) {\n if (resolveEntry.version === version) {\n return resolveEntry;\n }\n\n return resolveEntry.scopedVersions?.[version];\n }\n\n if (definition) {\n const requiredById: `${string}@${string}` = `${definition.name}@${definition.version}`;\n const scopedEntry = Object.values(resolveEntry.scopedVersions || {}).find((e) => !!e.requiredBy[requiredById]);\n\n return scopedEntry || resolveEntry;\n }\n\n return undefined;\n}\n"]}
@@ -1,5 +1,7 @@
1
- import type { PackageJsonExports, PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
2
- export declare function getExportsMap(packagePath: string, options?: {
3
- packages?: PackageDefinitionsCache;
1
+ import type { PackageDefinitionsCache, PackageJsonExports } from '@ms-cloudpack/bundler-types';
2
+ export declare function getExportsMap(options: {
3
+ packagePath: string;
4
+ }, context: {
5
+ packages: PackageDefinitionsCache;
4
6
  }): Promise<PackageJsonExports>;
5
7
  //# sourceMappingURL=getExportsMap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getExportsMap.d.ts","sourceRoot":"","sources":["../src/getExportsMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAI/F,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,uBAAuB,CAAA;CAAO,GACnD,OAAO,CAAC,kBAAkB,CAAC,CAmB7B"}
1
+ {"version":3,"file":"getExportsMap.d.ts","sourceRoot":"","sources":["../src/getExportsMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAG/F,wBAAsB,aAAa,CACjC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,EAChC,OAAO,EAAE;IAAE,QAAQ,EAAE,uBAAuB,CAAA;CAAE,GAC7C,OAAO,CAAC,kBAAkB,CAAC,CAY7B"}
@@ -1,20 +1,12 @@
1
- import { PackageDefinitions } from './PackageDefinitions.js';
2
1
  import { createExportsMap } from './createExportsMap.js';
3
- export async function getExportsMap(packagePath, options = {}) {
4
- const { packages = PackageDefinitions.getInstance() } = options;
2
+ export async function getExportsMap(options, context) {
3
+ const { packagePath } = options;
4
+ const { packages } = context;
5
5
  const packageDefinition = await packages.get(packagePath);
6
6
  if (!packageDefinition) {
7
7
  throw new Error(`Package definition not found for ${packagePath}`);
8
8
  }
9
- let { exports } = packageDefinition;
10
- // If the package definition doesn't have a full object-based exports map, create one.
11
- if (typeof exports === 'string') {
12
- exports = {
13
- '.': {
14
- default: exports,
15
- },
16
- };
17
- }
18
- return exports || (await createExportsMap(packagePath, options));
9
+ const { exports } = packageDefinition;
10
+ return exports === undefined ? await createExportsMap(options, context) : exports;
19
11
  }
20
12
  //# sourceMappingURL=getExportsMap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getExportsMap.js","sourceRoot":"","sources":["../src/getExportsMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,WAAmB,EACnB,UAAkD,EAAE;IAEpD,MAAM,EAAE,QAAQ,GAAG,kBAAkB,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC;IAChE,MAAM,iBAAiB,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE1D,IAAI,CAAC,iBAAiB,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,oCAAoC,WAAW,EAAE,CAAC,CAAC;KACpE;IAED,IAAI,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;IAEpC,sFAAsF;IACtF,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO,GAAG;YACR,GAAG,EAAE;gBACH,OAAO,EAAE,OAAO;aACjB;SACF,CAAC;KACH;IACD,OAAO,OAAO,IAAI,CAAC,MAAM,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import type { PackageJsonExports, PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport { PackageDefinitions } from './PackageDefinitions.js';\nimport { createExportsMap } from './createExportsMap.js';\n\nexport async function getExportsMap(\n packagePath: string,\n options: { packages?: PackageDefinitionsCache } = {},\n): Promise<PackageJsonExports> {\n const { packages = PackageDefinitions.getInstance() } = options;\n const packageDefinition = await packages.get(packagePath);\n\n if (!packageDefinition) {\n throw new Error(`Package definition not found for ${packagePath}`);\n }\n\n let { exports } = packageDefinition;\n\n // If the package definition doesn't have a full object-based exports map, create one.\n if (typeof exports === 'string') {\n exports = {\n '.': {\n default: exports,\n },\n };\n }\n return exports || (await createExportsMap(packagePath, options));\n}\n"]}
1
+ {"version":3,"file":"getExportsMap.js","sourceRoot":"","sources":["../src/getExportsMap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAgC,EAChC,OAA8C;IAE9C,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC7B,MAAM,iBAAiB,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE1D,IAAI,CAAC,iBAAiB,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,oCAAoC,WAAW,EAAE,CAAC,CAAC;KACpE;IAED,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;IAEtC,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACpF,CAAC","sourcesContent":["import type { PackageDefinitionsCache, PackageJsonExports } from '@ms-cloudpack/bundler-types';\nimport { createExportsMap } from './createExportsMap.js';\n\nexport async function getExportsMap(\n options: { packagePath: string },\n context: { packages: PackageDefinitionsCache },\n): Promise<PackageJsonExports> {\n const { packagePath } = options;\n const { packages } = context;\n const packageDefinition = await packages.get(packagePath);\n\n if (!packageDefinition) {\n throw new Error(`Package definition not found for ${packagePath}`);\n }\n\n const { exports } = packageDefinition;\n\n return exports === undefined ? await createExportsMap(options, context) : exports;\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Returns the version of the package which contains the import url provided.
2
+ * Returns the displayable version of the package which contains the import url provided. If the package
3
+ * is a local package rather than a node_modules external package, we display the version as "0.0.0-local"
4
+ * with the path following it.
3
5
  * @param importUrl - import.meta.url
4
6
  * @returns - the version of the package. If the package is not in node_modules, it returns "0.0.0-local".
5
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getVersion.d.ts","sourceRoot":"","sources":["../src/getVersion.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAYpD"}
1
+ {"version":3,"file":"getVersion.d.ts","sourceRoot":"","sources":["../src/getVersion.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAYpD"}
package/lib/getVersion.js CHANGED
@@ -4,13 +4,15 @@ import path from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { isExternalPackage } from './isExternalPackage.js';
6
6
  /**
7
- * Returns the version of the package which contains the import url provided.
7
+ * Returns the displayable version of the package which contains the import url provided. If the package
8
+ * is a local package rather than a node_modules external package, we display the version as "0.0.0-local"
9
+ * with the path following it.
8
10
  * @param importUrl - import.meta.url
9
11
  * @returns - the version of the package. If the package is not in node_modules, it returns "0.0.0-local".
10
12
  */
11
13
  export function getVersion(importUrl) {
12
- let version = '0.0.0-local';
13
14
  const packagePath = findPackageRoot(path.dirname(fileURLToPath(importUrl)));
15
+ let version = `0.0.0-local ${packagePath}`;
14
16
  if (packagePath && isExternalPackage(packagePath)) {
15
17
  const packageJSONpath = path.join(packagePath, 'package.json');
16
18
  // eslint-disable-next-line no-restricted-syntax
@@ -1 +1 @@
1
- {"version":3,"file":"getVersion.js","sourceRoot":"","sources":["../src/getVersion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,IAAI,OAAO,GAAG,aAAa,CAAC;IAC5B,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAE5E,IAAI,WAAW,IAAI,iBAAiB,CAAC,WAAW,CAAC,EAAE;QACjD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAE/D,gDAAgD;QAChD,OAAO,GAAI,YAAY,CAAC,eAAe,CAAiB,CAAC,OAAO,IAAI,OAAO,CAAC;KAC7E;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport { readJsonSync } from '@ms-cloudpack/json-utilities';\nimport { findPackageRoot } from '@ms-cloudpack/path-utilities';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { isExternalPackage } from './isExternalPackage.js';\n\n/**\n * Returns the version of the package which contains the import url provided.\n * @param importUrl - import.meta.url\n * @returns - the version of the package. If the package is not in node_modules, it returns \"0.0.0-local\".\n */\nexport function getVersion(importUrl: string): string {\n let version = '0.0.0-local';\n const packagePath = findPackageRoot(path.dirname(fileURLToPath(importUrl)));\n\n if (packagePath && isExternalPackage(packagePath)) {\n const packageJSONpath = path.join(packagePath, 'package.json');\n\n // eslint-disable-next-line no-restricted-syntax\n version = (readJsonSync(packageJSONpath) as PackageJson).version || version;\n }\n\n return version;\n}\n"]}
1
+ {"version":3,"file":"getVersion.js","sourceRoot":"","sources":["../src/getVersion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5E,IAAI,OAAO,GAAG,eAAe,WAAW,EAAE,CAAC;IAE3C,IAAI,WAAW,IAAI,iBAAiB,CAAC,WAAW,CAAC,EAAE;QACjD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAE/D,gDAAgD;QAChD,OAAO,GAAI,YAAY,CAAC,eAAe,CAAiB,CAAC,OAAO,IAAI,OAAO,CAAC;KAC7E;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport { readJsonSync } from '@ms-cloudpack/json-utilities';\nimport { findPackageRoot } from '@ms-cloudpack/path-utilities';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { isExternalPackage } from './isExternalPackage.js';\n\n/**\n * Returns the displayable version of the package which contains the import url provided. If the package\n * is a local package rather than a node_modules external package, we display the version as \"0.0.0-local\"\n * with the path following it.\n * @param importUrl - import.meta.url\n * @returns - the version of the package. If the package is not in node_modules, it returns \"0.0.0-local\".\n */\nexport function getVersion(importUrl: string): string {\n const packagePath = findPackageRoot(path.dirname(fileURLToPath(importUrl)));\n let version = `0.0.0-local ${packagePath}`;\n\n if (packagePath && isExternalPackage(packagePath)) {\n const packageJSONpath = path.join(packagePath, 'package.json');\n\n // eslint-disable-next-line no-restricted-syntax\n version = (readJsonSync(packageJSONpath) as PackageJson).version || version;\n }\n\n return version;\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  export { PackageDefinitions } from './PackageDefinitions.js';
2
2
  export { createResolveMap } from './createResolveMap/createResolveMap.js';
3
- export type { ResolveMap } from './createResolveMap/ResolveMap.js';
4
- export type { ResolveMapEntry } from './createResolveMap/ResolveMapEntry.js';
3
+ export type { ResolveMap } from './types/ResolveMap.js';
4
+ export type { ResolveMapEntry } from './types/ResolveMapEntry.js';
5
5
  export { findResolveMapEntry } from './findResolveMapEntry.js';
6
6
  export type { DiffResolveMapsChanges, DiffResolveMapsStats } from './createResolveMap/diffResolveMaps.js';
7
7
  export { diffResolveMaps } from './createResolveMap/diffResolveMaps.js';
8
+ export type { LinkedPath } from './types/LinkedPath.js';
8
9
  export { flattenExportsMap } from './flattenExportsMap.js';
9
10
  export { createExportsMap } from './createExportsMap.js';
10
11
  export { addExportsMapEntry, type AddExportsMapEntryOptions } from './addExportsMapEntry.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,YAAY,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,YAAY,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC1G,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,OAAO,EAAE,i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AAgB,EAAmB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAA+D,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["// Package definition parsing\nexport { PackageDefinitions } from './PackageDefinitions.js';\n\n// ResolveMap creation\nexport { createResolveMap } from './createResolveMap/createResolveMap.js';\nexport type { ResolveMap } from './createResolveMap/ResolveMap.js';\nexport type { ResolveMapEntry } from './createResolveMap/ResolveMapEntry.js';\nexport { findResolveMapEntry } from './findResolveMapEntry.js';\nexport type { DiffResolveMapsChanges, DiffResolveMapsStats } from './createResolveMap/diffResolveMaps.js';\nexport { diffResolveMaps } from './createResolveMap/diffResolveMaps.js';\n\n// ExportsMap parsing and creation\nexport { flattenExportsMap } from './flattenExportsMap.js';\nexport { createExportsMap } from './createExportsMap.js';\nexport { addExportsMapEntry, type AddExportsMapEntryOptions } from './addExportsMapEntry.js';\nexport { getExportsMap } from './getExportsMap.js';\n\n// ImportMap creation\nexport { createImportMap, type ImportMap } from './createImportMap.js';\n\n// Import resolution utilities\nexport { resolve } from './resolve.js';\n\n// Other package utilities\nexport { detectModuleType, type ModuleType } from './detectModuleType.js';\nexport { isExternalPackage } from './isExternalPackage.js';\nexport { findFileInPackage, type FindFileInPackageOptions, type FindFileInPackageResult } from './findFileInPackage.js';\nexport { getVersion } from './getVersion.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,sBAAsB;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAG1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,kCAAkC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAkC,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,qBAAqB;AACrB,OAAO,EAAE,eAAe,EAAkB,MAAM,sBAAsB,CAAC;AAEvE,8BAA8B;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,0BAA0B;AAC1B,OAAO,EAAE,gBAAgB,EAAmB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAA+D,MAAM,wBAAwB,CAAC;AACxH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["// Package definition parsing\nexport { PackageDefinitions } from './PackageDefinitions.js';\n\n// ResolveMap creation\nexport { createResolveMap } from './createResolveMap/createResolveMap.js';\nexport type { ResolveMap } from './types/ResolveMap.js';\nexport type { ResolveMapEntry } from './types/ResolveMapEntry.js';\nexport { findResolveMapEntry } from './findResolveMapEntry.js';\nexport type { DiffResolveMapsChanges, DiffResolveMapsStats } from './createResolveMap/diffResolveMaps.js';\nexport { diffResolveMaps } from './createResolveMap/diffResolveMaps.js';\nexport type { LinkedPath } from './types/LinkedPath.js';\n\n// ExportsMap parsing and creation\nexport { flattenExportsMap } from './flattenExportsMap.js';\nexport { createExportsMap } from './createExportsMap.js';\nexport { addExportsMapEntry, type AddExportsMapEntryOptions } from './addExportsMapEntry.js';\nexport { getExportsMap } from './getExportsMap.js';\n\n// ImportMap creation\nexport { createImportMap, type ImportMap } from './createImportMap.js';\n\n// Import resolution utilities\nexport { resolve } from './resolve.js';\n\n// Other package utilities\nexport { detectModuleType, type ModuleType } from './detectModuleType.js';\nexport { isExternalPackage } from './isExternalPackage.js';\nexport { findFileInPackage, type FindFileInPackageOptions, type FindFileInPackageResult } from './findFileInPackage.js';\nexport { getVersion } from './getVersion.js';\n"]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Represents a path linked to the resolve map.
3
+ */
4
+ export interface LinkedPath {
5
+ /**
6
+ * Path to where the link originates.
7
+ */
8
+ path: string;
9
+ /**
10
+ * Optional git root to limit package resolution discovery.
11
+ */
12
+ gitRootPath?: string;
13
+ /**
14
+ * If true, transitive internal packages will be linked rather than only the matched packages.
15
+ */
16
+ includeAll?: boolean;
17
+ /**
18
+ * Package matches to ignore when linking.
19
+ */
20
+ ignoredPackages?: string[];
21
+ }
22
+ //# sourceMappingURL=LinkedPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkedPath.d.ts","sourceRoot":"","sources":["../../src/types/LinkedPath.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=LinkedPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkedPath.js","sourceRoot":"","sources":["../../src/types/LinkedPath.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a path linked to the resolve map.\n */\nexport interface LinkedPath {\n /**\n * Path to where the link originates.\n */\n path: string;\n\n /**\n * Optional git root to limit package resolution discovery.\n */\n gitRootPath?: string;\n\n /**\n * If true, transitive internal packages will be linked rather than only the matched packages.\n */\n includeAll?: boolean;\n\n /**\n * Package matches to ignore when linking.\n */\n ignoredPackages?: string[];\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackageMap.d.ts","sourceRoot":"","sources":["../../src/types/PackageMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,IAAI,EAAE,MAAM,GAAG;QACd,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC;KACpC,CAAC;CACH,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackageMap.js","sourceRoot":"","sources":["../../src/types/PackageMap.ts"],"names":[],"mappings":"","sourcesContent":["import type { ResolveMapEntry } from './ResolveMapEntry.js';\n\nexport type PackageMap = {\n [name: string]: {\n [version: string]: ResolveMapEntry;\n };\n};\n"]}
@@ -1,3 +1,6 @@
1
1
  import type { ResolveMapEntry } from './ResolveMapEntry.js';
2
+ /**
3
+ * A map of package names to ResolveMapEntry objects.
4
+ */
2
5
  export type ResolveMap = Record<string, ResolveMapEntry>;
3
6
  //# sourceMappingURL=ResolveMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolveMap.d.ts","sourceRoot":"","sources":["../../src/types/ResolveMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolveMap.js","sourceRoot":"","sources":["../../src/types/ResolveMap.ts"],"names":[],"mappings":"","sourcesContent":["import type { ResolveMapEntry } from './ResolveMapEntry.js';\n\n/**\n * A map of package names to ResolveMapEntry objects.\n */\nexport type ResolveMap = Record<string, ResolveMapEntry>;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolveMapEntry.d.ts","sourceRoot":"","sources":["../../src/types/ResolveMapEntry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC,GAAG,MAAM,IAAI,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;IAElD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,cAAc,CAAC,EAAE;QACf,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC;KACpC,CAAC;CACH,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolveMapEntry.js","sourceRoot":"","sources":["../../src/types/ResolveMapEntry.ts"],"names":[],"mappings":"","sourcesContent":["export type ResolveMapEntry = {\n name: string;\n version: string;\n path: string;\n\n dependencies: Record<string, string>;\n requiredBy: Record<`${string}@${string}`, string>;\n\n isLinked?: boolean;\n isExternal?: boolean;\n\n scopedVersions?: {\n [version: string]: ResolveMapEntry;\n };\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/package-utilities",
3
- "version": "3.1.6",
3
+ "version": "5.0.0",
4
4
  "description": "Utilities for resolving/parsing packages and their imports.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,11 +15,11 @@
15
15
  "dependencies": {
16
16
  "@babel/parser": "^7.16.12",
17
17
  "@babel/traverse": "^7.16.10",
18
- "@ms-cloudpack/bundler-types": "^0.15.0",
19
- "@ms-cloudpack/json-utilities": "^0.0.6",
20
- "@ms-cloudpack/package-overrides": "^0.3.10",
21
- "@ms-cloudpack/path-utilities": "^2.3.0",
22
- "@ms-cloudpack/path-string-parsing": "^1.0.2",
18
+ "@ms-cloudpack/bundler-types": "^0.16.0",
19
+ "@ms-cloudpack/json-utilities": "^0.0.7",
20
+ "@ms-cloudpack/package-overrides": "^0.3.11",
21
+ "@ms-cloudpack/path-utilities": "^2.3.1",
22
+ "@ms-cloudpack/path-string-parsing": "^1.0.3",
23
23
  "fast-glob": "^3.2.12",
24
24
  "merge": "^2.1.1",
25
25
  "resolve": "^1.22.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"PackageMap.d.ts","sourceRoot":"","sources":["../../src/createResolveMap/PackageMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,IAAI,EAAE,MAAM,GAAG;QACd,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC;KACpC,CAAC;CACH,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"PackageMap.js","sourceRoot":"","sources":["../../src/createResolveMap/PackageMap.ts"],"names":[],"mappings":"","sourcesContent":["import type { ResolveMapEntry } from './ResolveMapEntry.js';\n\nexport type PackageMap = {\n [name: string]: {\n [version: string]: ResolveMapEntry;\n };\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResolveMap.d.ts","sourceRoot":"","sources":["../../src/createResolveMap/ResolveMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResolveMap.js","sourceRoot":"","sources":["../../src/createResolveMap/ResolveMap.ts"],"names":[],"mappings":"","sourcesContent":["import type { ResolveMapEntry } from './ResolveMapEntry.js';\n\nexport type ResolveMap = Record<string, ResolveMapEntry>;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResolveMapEntry.d.ts","sourceRoot":"","sources":["../../src/createResolveMap/ResolveMapEntry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC,GAAG,MAAM,IAAI,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;IAElD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,cAAc,CAAC,EAAE;QACf,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC;KACpC,CAAC;CACH,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResolveMapEntry.js","sourceRoot":"","sources":["../../src/createResolveMap/ResolveMapEntry.ts"],"names":[],"mappings":"","sourcesContent":["export type ResolveMapEntry = {\n name: string;\n version: string;\n path: string;\n\n dependencies: Record<string, string>;\n requiredBy: Record<`${string}@${string}`, string>;\n\n isLinked?: boolean;\n isExternal?: boolean;\n\n scopedVersions?: {\n [version: string]: ResolveMapEntry;\n };\n};\n"]}
File without changes
File without changes
File without changes