@ms-cloudpack/cli 0.58.6 → 0.59.1

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 (48) hide show
  1. package/lib/commands/bundle/execute.d.ts.map +1 -1
  2. package/lib/commands/bundle/execute.js +48 -53
  3. package/lib/commands/bundle/execute.js.map +1 -1
  4. package/lib/commands/bundle/index.d.ts.map +1 -1
  5. package/lib/commands/bundle/index.js +6 -2
  6. package/lib/commands/bundle/index.js.map +1 -1
  7. package/lib/commands/bundle/types/BundleOptions.d.ts +6 -1
  8. package/lib/commands/bundle/types/BundleOptions.d.ts.map +1 -1
  9. package/lib/commands/bundle/types/BundleOptions.js.map +1 -1
  10. package/lib/commands/init/evaluateImportsForOverrides.d.ts +3 -3
  11. package/lib/commands/init/evaluateImportsForOverrides.d.ts.map +1 -1
  12. package/lib/commands/init/evaluateImportsForOverrides.js +39 -25
  13. package/lib/commands/init/evaluateImportsForOverrides.js.map +1 -1
  14. package/lib/commands/init/evaluatePath.d.ts.map +1 -1
  15. package/lib/commands/init/evaluatePath.js +4 -16
  16. package/lib/commands/init/evaluatePath.js.map +1 -1
  17. package/lib/commands/init/formatInitSummary.d.ts.map +1 -1
  18. package/lib/commands/init/formatInitSummary.js +12 -17
  19. package/lib/commands/init/formatInitSummary.js.map +1 -1
  20. package/lib/commands/init/index.d.ts.map +1 -1
  21. package/lib/commands/init/index.js +6 -3
  22. package/lib/commands/init/index.js.map +1 -1
  23. package/lib/commands/init/init.d.ts.map +1 -1
  24. package/lib/commands/init/init.js +101 -107
  25. package/lib/commands/init/init.js.map +1 -1
  26. package/lib/commands/init/optimizeDependencies.d.ts +3 -10
  27. package/lib/commands/init/optimizeDependencies.d.ts.map +1 -1
  28. package/lib/commands/init/optimizeDependencies.js +3 -6
  29. package/lib/commands/init/optimizeDependencies.js.map +1 -1
  30. package/lib/commands/init/types/InitOptions.d.ts +3 -2
  31. package/lib/commands/init/types/InitOptions.d.ts.map +1 -1
  32. package/lib/commands/init/types/InitOptions.js.map +1 -1
  33. package/lib/commands/init/types/InitPackageIdentifier.d.ts +1 -0
  34. package/lib/commands/init/types/InitPackageIdentifier.d.ts.map +1 -1
  35. package/lib/commands/init/types/InitPackageIdentifier.js.map +1 -1
  36. package/lib/commands/init/verifyExports.d.ts +2 -2
  37. package/lib/commands/init/verifyExports.d.ts.map +1 -1
  38. package/lib/commands/init/verifyExports.js +52 -75
  39. package/lib/commands/init/verifyExports.js.map +1 -1
  40. package/lib/utilities/getFilteredPackages.d.ts +7 -0
  41. package/lib/utilities/getFilteredPackages.d.ts.map +1 -0
  42. package/lib/utilities/getFilteredPackages.js +21 -0
  43. package/lib/utilities/getFilteredPackages.js.map +1 -0
  44. package/lib/utilities/parseMatch.d.ts +6 -0
  45. package/lib/utilities/parseMatch.d.ts.map +1 -0
  46. package/lib/utilities/parseMatch.js +27 -0
  47. package/lib/utilities/parseMatch.js.map +1 -0
  48. package/package.json +12 -12
@@ -1,6 +1,6 @@
1
- import type { InitPackageResult } from './types/InitPackageResult.js';
1
+ import type { Session } from '@ms-cloudpack/api-server';
2
2
  import type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';
3
- import type { Session } from '@ms-cloudpack//api-server';
3
+ import type { InitPackageResult } from './types/InitPackageResult.js';
4
4
  /**
5
5
  * Checks that the imports/exports of packages match.
6
6
  * To be called before `summarize`.
@@ -1 +1 @@
1
- {"version":3,"file":"verifyExports.d.ts","sourceRoot":"","sources":["../../../src/commands/init/verifyExports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EACjD,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB,GACA,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAmH9B"}
1
+ {"version":3,"file":"verifyExports.d.ts","sourceRoot":"","sources":["../../../src/commands/init/verifyExports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAG1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGtE;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EACjD,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB,GACA,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAgG9B"}
@@ -1,6 +1,6 @@
1
1
  import { findResolveMapEntry, flattenExportsMap, getExportsMap } from '@ms-cloudpack/package-utilities';
2
- import { bulletedList } from '@ms-cloudpack/task-reporter';
3
2
  import path from 'path';
3
+ import { bulletedList } from '@ms-cloudpack/task-reporter';
4
4
  /**
5
5
  * Checks that the imports/exports of packages match.
6
6
  * To be called before `summarize`.
@@ -13,99 +13,76 @@ export async function verifyExports(packageResults, context) {
13
13
  const allErrors = [];
14
14
  const packageResultsArray = Object.values(packageResults);
15
15
  // Iterate through each package
16
- for (const packagePath in packageResults) {
17
- const result = packageResults[packagePath];
18
- // Skip packages with errors
19
- if (!result || result.errors?.length) {
20
- continue;
21
- }
22
- const { info, name, version } = result;
23
- const definition = {
24
- name,
25
- version,
26
- path: packagePath,
27
- };
28
- const packageError = {
29
- ...definition,
30
- };
31
- // Makes sure that the errors array is initialized and typescript happy.
32
- packageError.errors = [];
33
- const missingExportsErrors = {};
34
- // Skip packages with no info
35
- if (!info?.entry) {
16
+ for (const [parentPath, parentResult] of Object.entries(packageResults)) {
17
+ // Skip packages with build errors or no info
18
+ if (!parentResult?.info || parentResult.errors?.length) {
36
19
  continue;
37
20
  }
38
- // Iterate through each entry
39
- for (const [exportsEntry, required] of Object.entries(info.entry)) {
40
- const { consumes } = required;
21
+ /**
22
+ * Mapping from imported dependency package ID (`name@version`) to import path
23
+ * to export names missing from that file.
24
+ */
25
+ const depsMissingExports = {};
26
+ // Iterate through each entry path from the parent package
27
+ for (const { consumes } of Object.values(parentResult.info)) {
41
28
  // Skip entries with no imports
42
29
  if (!consumes?.length) {
43
30
  continue;
44
31
  }
45
32
  // Iterate through each imported package
46
- for (const { packageName, importPath, names } of consumes) {
47
- const entry = findResolveMapEntry({ packageName, definition, resolveMap });
48
- // Skip if we can't find the imported package in the resolve map
49
- if (!entry) {
33
+ for (const { packageName: depName, importPath: depImportPath, names: consumedNames } of consumes) {
34
+ const depResolveMapEntry = findResolveMapEntry({ packageName: depName, definition: parentResult, resolveMap });
35
+ const depEntries = depResolveMapEntry &&
36
+ packageResultsArray.find((r) => r.name === depResolveMapEntry.name && r.version === depResolveMapEntry.version)?.info;
37
+ // Skip if we can't find the imported package in the resolve map, or there's no info about
38
+ // its entries/exports.
39
+ if (!depEntries) {
50
40
  continue;
51
41
  }
52
- const packageResult = packageResultsArray.find((r) => r.name === entry.name && r.version === entry.version);
53
- // Skip packages without information.
54
- if (!packageResult?.info?.entry) {
42
+ const importProduces = (depEntries[depImportPath] || depEntries[`${depImportPath}.js`])?.produces;
43
+ if (!importProduces || importProduces.includes('*')) {
44
+ // Skip if the imported package has no entry for the import path, or if the import
45
+ // produces `*` (everything) since we can't check that. (If the path is missing,
46
+ // evaluateImportsForOverrides has already run and tried to fix it or reported an error.)
55
47
  continue;
56
48
  }
57
- let realImportPath;
58
- // Check if there is an entry for the import path.
59
- if (packageResult.info.entry[importPath]) {
60
- realImportPath = importPath;
61
- // Check again with '.js' extension.
62
- }
63
- else if (packageResult.info.entry[`${importPath}.js`]) {
64
- realImportPath = `${importPath}.js`;
65
- }
66
- else {
67
- // evaluateImportsForOverrides has already been run,
68
- // so if the export is missing it has tried to fix it and has already reported an error.
69
- // Skip if the imported package has no entry for the import path
70
- continue;
71
- }
72
- const { produces: importProduces } = packageResult.info.entry[realImportPath];
73
- // Skip if the import produces everything `*` because we can't check that.
74
- if (importProduces.includes('*')) {
75
- continue;
76
- }
77
- const missing = [];
78
- // Iterate through each imported name.
79
- for (const namedImport of names) {
80
- // Error if the imported name is not exported.
81
- if (namedImport !== '*' && !importProduces.includes(namedImport)) {
82
- missing.push(namedImport);
83
- }
84
- }
85
- // No missing exports found.
49
+ // Find any missing names.
50
+ const missing = consumedNames.filter((namedImport) => namedImport !== '*' && !importProduces.includes(namedImport));
86
51
  if (!missing.length) {
87
52
  continue;
88
53
  }
89
- const exportsMapConsumed = await getExportsMap({ packagePath: entry.path }, { packages, config });
90
- const flattenedExportsMapConsumed = flattenExportsMap(exportsMapConsumed);
91
- const location = `"${packageName}@${entry.version}" (${path.join(entry.path, flattenedExportsMapConsumed[exportsEntry] || '')})`;
92
- missingExportsErrors[location] ??= new Set();
93
- missing.forEach((m) => missingExportsErrors[location].add(m));
54
+ // Figure out which actual file the exports appear to be missing from.
55
+ const depExportsMap = await getExportsMap({ packagePath: depResolveMapEntry.path }, { packages, config });
56
+ const depFlattenedExportsMap = flattenExportsMap(depExportsMap);
57
+ // If the package is missing an exports map, assume the import path is the real path.
58
+ const relativePath = depFlattenedExportsMap[depImportPath] || depImportPath;
59
+ const filePath = path.join(depResolveMapEntry.path, relativePath);
60
+ // Save the missing names for this path within the package.
61
+ const depKey = `${depResolveMapEntry.name}@${depResolveMapEntry.version}`;
62
+ depsMissingExports[depKey] ??= {};
63
+ depsMissingExports[depKey][filePath] ??= new Set();
64
+ missing.forEach((m) => depsMissingExports[depKey][filePath].add(m));
94
65
  }
95
66
  }
96
- for (const location in missingExportsErrors) {
97
- const missing = Array.from(missingExportsErrors[location]);
98
- packageError.errors.push({
99
- text: errorText({ location, missing }),
67
+ const depErrors = Object.entries(depsMissingExports).map(([packageId, missing]) => {
68
+ // We want a single error for each package, with a bulleted list of files with missing exports.
69
+ const missingExportsForFiles = Object.entries(missing).map(([file, names]) => `${file}:\n${[...names].sort().join(', ')}`);
70
+ return {
71
+ text: `Imported names are missing from exports of external package ${packageId}:\n${bulletedList(missingExportsForFiles)}`,
72
+ source: 'verify exports',
73
+ // Don't include a whole-message location here because that doesn't make sense for this error type,
74
+ // and we already put full paths to individual problem files within the message.
75
+ };
76
+ });
77
+ if (depErrors.length) {
78
+ allErrors.push({
79
+ name: parentResult.name,
80
+ version: parentResult.version,
81
+ path: parentPath,
82
+ errors: depErrors,
100
83
  });
101
84
  }
102
- if (packageError.errors?.length) {
103
- allErrors.push(packageError);
104
- }
105
85
  }
106
86
  return allErrors;
107
87
  }
108
- function errorText({ location, missing }) {
109
- return `Imported names are missing from external package's exports:\n${bulletedList([`Missing export(s): ${missing.join(', ')}`, `From: ${location}`], 2)}\n`;
110
- }
111
88
  //# sourceMappingURL=verifyExports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"verifyExports.js","sourceRoot":"","sources":["../../../src/commands/init/verifyExports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAKxB;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,cAAiD,EACjD,OAGC;IAED,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACtC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACvC,MAAM,SAAS,GAAwB,EAAE,CAAC;IAC1C,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,C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ourcesContent":["import { findResolveMapEntry, flattenExportsMap, getExportsMap } from '@ms-cloudpack/package-utilities';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport type { InitPackageResult } from './types/InitPackageResult.js';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport type { Session } from '@ms-cloudpack//api-server';\n\n/**\n * Checks that the imports/exports of packages match.\n * To be called before `summarize`.\n * @param packageResults - The package results to check.\n * @param context - The context to use.\n */\nexport async function verifyExports(\n packageResults: Record<string, InitPackageResult>,\n context: {\n packages: PackageDefinitionsCache;\n session: Session;\n },\n): Promise<InitPackageResult[]> {\n const { packages, session } = context;\n const { config, resolveMap } = session;\n const allErrors: InitPackageResult[] = [];\n const packageResultsArray = Object.values(packageResults);\n\n // Iterate through each package\n for (const packagePath in packageResults) {\n const result = packageResults[packagePath];\n\n // Skip packages with errors\n if (!result || result.errors?.length) {\n continue;\n }\n\n const { info, name, version } = result;\n const definition = {\n name,\n version,\n path: packagePath,\n };\n\n const packageError: InitPackageResult = {\n ...definition,\n };\n // Makes sure that the errors array is initialized and typescript happy.\n packageError.errors = [];\n const missingExportsErrors: Record<string, Set<string>> = {};\n\n // Skip packages with no info\n if (!info?.entry) {\n continue;\n }\n\n // Iterate through each entry\n for (const [exportsEntry, required] of Object.entries(info.entry)) {\n const { consumes } = required;\n\n // Skip entries with no imports\n if (!consumes?.length) {\n continue;\n }\n\n // Iterate through each imported package\n for (const { packageName, importPath, names } of consumes) {\n const entry = findResolveMapEntry({ packageName, definition, resolveMap });\n\n // Skip if we can't find the imported package in the resolve map\n if (!entry) {\n continue;\n }\n\n const packageResult = packageResultsArray.find((r) => r.name === entry.name && r.version === entry.version);\n\n // Skip packages without information.\n if (!packageResult?.info?.entry) {\n continue;\n }\n\n let realImportPath: string;\n // Check if there is an entry for the import path.\n if (packageResult.info.entry[importPath]) {\n realImportPath = importPath;\n // Check again with '.js' extension.\n } else if (packageResult.info.entry[`${importPath}.js`]) {\n realImportPath = `${importPath}.js`;\n } else {\n // evaluateImportsForOverrides has already been run,\n // so if the export is missing it has tried to fix it and has already reported an error.\n // Skip if the imported package has no entry for the import path\n continue;\n }\n\n const { produces: importProduces } = packageResult.info.entry[realImportPath];\n\n // Skip if the import produces everything `*` because we can't check that.\n if (importProduces.includes('*')) {\n continue;\n }\n\n const missing = [];\n // Iterate through each imported name.\n for (const namedImport of names) {\n // Error if the imported name is not exported.\n if (namedImport !== '*' && !importProduces.includes(namedImport)) {\n missing.push(namedImport);\n }\n }\n\n // No missing exports found.\n if (!missing.length) {\n continue;\n }\n\n const exportsMapConsumed = await getExportsMap({ packagePath: entry.path }, { packages, config });\n const flattenedExportsMapConsumed = flattenExportsMap(exportsMapConsumed);\n const location = `\"${packageName}@${entry.version}\" (${path.join(entry.path, flattenedExportsMapConsumed[exportsEntry] || '')})`;\n missingExportsErrors[location] ??= new Set();\n missing.forEach((m) => missingExportsErrors[location].add(m));\n }\n }\n\n for (const location in missingExportsErrors) {\n const missing = Array.from(missingExportsErrors[location]);\n packageError.errors.push({\n text: errorText({ location, missing }),\n });\n }\n\n if (packageError.errors?.length) {\n allErrors.push(packageError);\n }\n }\n\n return allErrors;\n}\n\nfunction errorText({ location, missing }: { location: string; missing: string[] }) {\n return `Imported names are missing from external package's exports:\\n${bulletedList(\n [`Missing export(s): ${missing.join(', ')}`, `From: ${location}`],\n 2,\n )}\\n`;\n}\n"]}
1
+ {"version":3,"file":"verifyExports.js","sourceRoot":"","sources":["../../../src/commands/init/verifyExports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,cAAiD,EACjD,OAGC;IAED,MAAM,EAAE,QAAQ,EAAE,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C,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE;YAChF,+FAA+F;YAC/F,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CACxD,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC/D,CAAC;YACF,OAAO;gBACL,IAAI,EAAE,+DAA+D,SAAS,MAAM,YAAY,CAAC,sBAAsB,CAAC,EAAE;gBAC1H,MAAM,EAAE,gBAAgB;gBACxB,mGAAmG;gBACnG,gFAAgF;aACjF,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;YACrB,SAAS,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,YAAY,CAAC,IAAI;gBACvB,OAAO,EAAE,YAAY,CAAC,OAAO;gBAC7B,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,SAAS;aAClB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { Session } from '@ms-cloudpack/api-server';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport { findResolveMapEntry, flattenExportsMap, getExportsMap } from '@ms-cloudpack/package-utilities';\nimport path from 'path';\nimport type { InitPackageResult } from './types/InitPackageResult.js';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\n\n/**\n * Checks that the imports/exports of packages match.\n * To be called before `summarize`.\n * @param packageResults - The package results to check.\n * @param context - The context to use.\n */\nexport async function verifyExports(\n packageResults: Record<string, InitPackageResult>,\n context: {\n packages: PackageDefinitionsCache;\n session: Session;\n },\n): Promise<InitPackageResult[]> {\n const { packages, session } = context;\n const { config, resolveMap } = session;\n const allErrors: InitPackageResult[] = [];\n const packageResultsArray = Object.values(packageResults);\n\n // Iterate through each package\n for (const [parentPath, parentResult] of Object.entries(packageResults)) {\n // Skip packages with build errors or no info\n if (!parentResult?.info || parentResult.errors?.length) {\n continue;\n }\n\n /**\n * Mapping from imported dependency package ID (`name@version`) to import path\n * to export names missing from that file.\n */\n const depsMissingExports: Record<string, Record<string, Set<string>>> = {};\n\n // Iterate through each entry path from the parent package\n for (const { consumes } of Object.values(parentResult.info)) {\n // Skip entries with no imports\n if (!consumes?.length) {\n continue;\n }\n\n // Iterate through each imported package\n for (const { packageName: depName, importPath: depImportPath, names: consumedNames } of consumes) {\n const depResolveMapEntry = findResolveMapEntry({ packageName: depName, definition: parentResult, resolveMap });\n const depEntries =\n depResolveMapEntry &&\n packageResultsArray.find(\n (r) => r.name === depResolveMapEntry.name && r.version === depResolveMapEntry.version,\n )?.info;\n\n // Skip if we can't find the imported package in the resolve map, or there's no info about\n // its entries/exports.\n if (!depEntries) {\n continue;\n }\n\n const importProduces = (depEntries[depImportPath] || depEntries[`${depImportPath}.js`])?.produces;\n if (!importProduces || importProduces.includes('*')) {\n // Skip if the imported package has no entry for the import path, or if the import\n // produces `*` (everything) since we can't check that. (If the path is missing,\n // evaluateImportsForOverrides has already run and tried to fix it or reported an error.)\n continue;\n }\n\n // Find any missing names.\n const missing = consumedNames.filter(\n (namedImport) => namedImport !== '*' && !importProduces.includes(namedImport),\n );\n if (!missing.length) {\n continue;\n }\n\n // Figure out which actual file the exports appear to be missing from.\n const depExportsMap = await getExportsMap({ packagePath: depResolveMapEntry.path }, { packages, config });\n const depFlattenedExportsMap = flattenExportsMap(depExportsMap);\n // If the package is missing an exports map, assume the import path is the real path.\n const relativePath = depFlattenedExportsMap[depImportPath] || depImportPath;\n const filePath = path.join(depResolveMapEntry.path, relativePath);\n\n // Save the missing names for this path within the package.\n const depKey = `${depResolveMapEntry.name}@${depResolveMapEntry.version}`;\n depsMissingExports[depKey] ??= {};\n depsMissingExports[depKey][filePath] ??= new Set();\n missing.forEach((m) => depsMissingExports[depKey][filePath].add(m));\n }\n }\n\n const depErrors = Object.entries(depsMissingExports).map(([packageId, missing]) => {\n // We want a single error for each package, with a bulleted list of files with missing exports.\n const missingExportsForFiles = Object.entries(missing).map(\n ([file, names]) => `${file}:\\n${[...names].sort().join(', ')}`,\n );\n return {\n text: `Imported names are missing from exports of external package ${packageId}:\\n${bulletedList(missingExportsForFiles)}`,\n source: 'verify exports',\n // Don't include a whole-message location here because that doesn't make sense for this error type,\n // and we already put full paths to individual problem files within the message.\n };\n });\n\n if (depErrors.length) {\n allErrors.push({\n name: parentResult.name,\n version: parentResult.version,\n path: parentPath,\n errors: depErrors,\n });\n }\n }\n\n return allErrors;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import type { PackageSettings } from '@ms-cloudpack/common-types';
2
+ import type { ResolveMap } from '@ms-cloudpack/package-utilities';
3
+ /**
4
+ * Find packages in the resolve map that match the requested names and versions.
5
+ */
6
+ export declare function getFilteredPackages(resolveMap: ResolveMap, match: PackageSettings['match'][]): string[];
7
+ //# sourceMappingURL=getFilteredPackages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFilteredPackages.d.ts","sourceRoot":"","sources":["../../src/utilities/getFilteredPackages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGlE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,CAoBvG"}
@@ -0,0 +1,21 @@
1
+ import { checkMatch } from '@ms-cloudpack/config';
2
+ import { bold, bulletedList, formatPackageName, plural } from '@ms-cloudpack/task-reporter';
3
+ /**
4
+ * Find packages in the resolve map that match the requested names and versions.
5
+ */
6
+ export function getFilteredPackages(resolveMap, match) {
7
+ // Find matching packages in the resolve map
8
+ const resolveMapEntries = Object.values(resolveMap).filter((entry) => match.some((m) => checkMatch({ name: entry.name, version: entry.version, match: m })));
9
+ const matchArgsString = match
10
+ .map((m) => `"${bold(typeof m === 'string' ? m : `${m.name}@${m.version || '*'}`)}"`)
11
+ .join(', ');
12
+ if (!resolveMapEntries.length) {
13
+ console.error(`No packages found matching ${matchArgsString}`);
14
+ }
15
+ else {
16
+ console.log(`\nFound ${plural(resolveMapEntries.length, 'package')} matching ${matchArgsString}:\n` +
17
+ bulletedList(resolveMapEntries.map((entry) => `${formatPackageName(entry)}: ${entry.path}`)));
18
+ }
19
+ return resolveMapEntries.map((entry) => entry.path);
20
+ }
21
+ //# sourceMappingURL=getFilteredPackages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFilteredPackages.js","sourceRoot":"","sources":["../../src/utilities/getFilteredPackages.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE5F;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAsB,EAAE,KAAiC;IAC3F,4CAA4C;IAC5C,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CACnE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CACtF,CAAC;IAEF,MAAM,eAAe,GAAG,KAAK;SAC1B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC;SACpF,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,8BAA8B,eAAe,EAAE,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CACT,WAAW,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,aAAa,eAAe,KAAK;YACrF,YAAY,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAC/F,CAAC;IACJ,CAAC;IAED,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import type { PackageSettings } from '@ms-cloudpack/common-types';\nimport { checkMatch } from '@ms-cloudpack/config';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport { bold, bulletedList, formatPackageName, plural } from '@ms-cloudpack/task-reporter';\n\n/**\n * Find packages in the resolve map that match the requested names and versions.\n */\nexport function getFilteredPackages(resolveMap: ResolveMap, match: PackageSettings['match'][]): string[] {\n // Find matching packages in the resolve map\n const resolveMapEntries = Object.values(resolveMap).filter((entry) =>\n match.some((m) => checkMatch({ name: entry.name, version: entry.version, match: m })),\n );\n\n const matchArgsString = match\n .map((m) => `\"${bold(typeof m === 'string' ? m : `${m.name}@${m.version || '*'}`)}\"`)\n .join(', ');\n\n if (!resolveMapEntries.length) {\n console.error(`No packages found matching ${matchArgsString}`);\n } else {\n console.log(\n `\\nFound ${plural(resolveMapEntries.length, 'package')} matching ${matchArgsString}:\\n` +\n bulletedList(resolveMapEntries.map((entry) => `${formatPackageName(entry)}: ${entry.path}`)),\n );\n }\n\n return resolveMapEntries.map((entry) => entry.path);\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { PackageSettings } from '@ms-cloudpack/common-types';
2
+ /**
3
+ * Parse a `--match` argument, e.g. `"foo"`, `"@foo/bar"`, `"@foo/*"`, `"@foo/bar@1.2.3"`.
4
+ */
5
+ export declare function parseMatch(match: string, acc?: PackageSettings['match'][]): PackageSettings['match'][];
6
+ //# sourceMappingURL=parseMatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseMatch.d.ts","sourceRoot":"","sources":["../../src/utilities/parseMatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAIlE;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,eAAe,CAAC,OAAO,CAAC,EAAO,GAAG,eAAe,CAAC,OAAO,CAAC,EAAE,CAyB1G"}
@@ -0,0 +1,27 @@
1
+ import { InvalidArgumentError } from 'commander';
2
+ import semver from 'semver';
3
+ /**
4
+ * Parse a `--match` argument, e.g. `"foo"`, `"@foo/bar"`, `"@foo/*"`, `"@foo/bar@1.2.3"`.
5
+ */
6
+ export function parseMatch(match, acc = []) {
7
+ let name;
8
+ let version;
9
+ const atVersionIndex = match.indexOf('@', 1);
10
+ if (atVersionIndex === -1) {
11
+ name = match;
12
+ }
13
+ else {
14
+ name = match.substring(0, atVersionIndex);
15
+ version = match.substring(atVersionIndex + 1);
16
+ }
17
+ const nameStarIndex = name.indexOf('*');
18
+ if (nameStarIndex !== -1 && nameStarIndex !== name.length - 1) {
19
+ throw new InvalidArgumentError(`Invalid match string "${match}". A wildcard is only supported at the end of the name.`);
20
+ }
21
+ if (version && !semver.validRange(version)) {
22
+ throw new InvalidArgumentError(`Invalid match string "${match}". The version "${version}" is not valid semver.`);
23
+ }
24
+ acc.push(version && version !== '*' ? { name, version } : name);
25
+ return acc;
26
+ }
27
+ //# sourceMappingURL=parseMatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseMatch.js","sourceRoot":"","sources":["../../src/utilities/parseMatch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,MAAkC,EAAE;IAC5E,IAAI,IAAY,CAAC;IACjB,IAAI,OAA2B,CAAC;IAChC,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC7C,IAAI,cAAc,KAAK,CAAC,CAAC,EAAE,CAAC;QAC1B,IAAI,GAAG,KAAK,CAAC;IACf,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QAC1C,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,aAAa,KAAK,CAAC,CAAC,IAAI,aAAa,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,oBAAoB,CAC5B,yBAAyB,KAAK,yDAAyD,CACxF,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,oBAAoB,CAAC,yBAAyB,KAAK,mBAAmB,OAAO,wBAAwB,CAAC,CAAC;IACnH,CAAC;IAED,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEhE,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import type { PackageSettings } from '@ms-cloudpack/common-types';\nimport { InvalidArgumentError } from 'commander';\nimport semver from 'semver';\n\n/**\n * Parse a `--match` argument, e.g. `\"foo\"`, `\"@foo/bar\"`, `\"@foo/*\"`, `\"@foo/bar@1.2.3\"`.\n */\nexport function parseMatch(match: string, acc: PackageSettings['match'][] = []): PackageSettings['match'][] {\n let name: string;\n let version: string | undefined;\n const atVersionIndex = match.indexOf('@', 1);\n if (atVersionIndex === -1) {\n name = match;\n } else {\n name = match.substring(0, atVersionIndex);\n version = match.substring(atVersionIndex + 1);\n }\n\n const nameStarIndex = name.indexOf('*');\n if (nameStarIndex !== -1 && nameStarIndex !== name.length - 1) {\n throw new InvalidArgumentError(\n `Invalid match string \"${match}\". A wildcard is only supported at the end of the name.`,\n );\n }\n\n if (version && !semver.validRange(version)) {\n throw new InvalidArgumentError(`Invalid match string \"${match}\". The version \"${version}\" is not valid semver.`);\n }\n\n acc.push(version && version !== '*' ? { name, version } : name);\n\n return acc;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.58.6",
3
+ "version": "0.59.1",
4
4
  "description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -10,18 +10,18 @@
10
10
  "cloudpack": "./bin/cloudpack.js"
11
11
  },
12
12
  "dependencies": {
13
- "@ms-cloudpack/api-server": "^0.35.0",
14
- "@ms-cloudpack/app-server": "^0.3.6",
15
- "@ms-cloudpack/bundle-server": "^0.2.50",
16
- "@ms-cloudpack/common-types": "^0.2.0",
17
- "@ms-cloudpack/config": "^0.18.1",
13
+ "@ms-cloudpack/api-server": "^0.37.0",
14
+ "@ms-cloudpack/app-server": "^0.3.8",
15
+ "@ms-cloudpack/bundle-server": "^0.2.52",
16
+ "@ms-cloudpack/common-types": "^0.2.2",
17
+ "@ms-cloudpack/config": "^0.19.1",
18
18
  "@ms-cloudpack/feature-flags": "^0.1.1",
19
19
  "@ms-cloudpack/json-utilities": "^0.1.4",
20
- "@ms-cloudpack/overlay": "^0.16.99",
21
- "@ms-cloudpack/package-utilities": "^7.1.1",
22
- "@ms-cloudpack/path-utilities": "^2.6.1",
23
- "@ms-cloudpack/remote-cache": "^0.6.2",
24
- "@ms-cloudpack/task-reporter": "^0.11.3",
20
+ "@ms-cloudpack/overlay": "^0.16.101",
21
+ "@ms-cloudpack/package-utilities": "^7.1.3",
22
+ "@ms-cloudpack/path-utilities": "^2.7.0",
23
+ "@ms-cloudpack/remote-cache": "^0.6.4",
24
+ "@ms-cloudpack/task-reporter": "^0.13.0",
25
25
  "@ms-cloudpack/telemetry": "^0.5.1",
26
26
  "@yarnpkg/lockfile": "^1.1.0",
27
27
  "commander": "^11.1.0",
@@ -34,7 +34,7 @@
34
34
  "workspace-tools": "^0.36.4"
35
35
  },
36
36
  "devDependencies": {
37
- "@ms-cloudpack/common-types": "^0.2.0",
37
+ "@ms-cloudpack/common-types": "^0.2.2",
38
38
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
39
39
  "@ms-cloudpack/scripts": "^0.0.1",
40
40
  "@ms-cloudpack/test-utilities": "^0.5.0",