@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.
- package/lib/commands/bundle/execute.d.ts.map +1 -1
- package/lib/commands/bundle/execute.js +48 -53
- package/lib/commands/bundle/execute.js.map +1 -1
- package/lib/commands/bundle/index.d.ts.map +1 -1
- package/lib/commands/bundle/index.js +6 -2
- package/lib/commands/bundle/index.js.map +1 -1
- package/lib/commands/bundle/types/BundleOptions.d.ts +6 -1
- package/lib/commands/bundle/types/BundleOptions.d.ts.map +1 -1
- package/lib/commands/bundle/types/BundleOptions.js.map +1 -1
- package/lib/commands/init/evaluateImportsForOverrides.d.ts +3 -3
- package/lib/commands/init/evaluateImportsForOverrides.d.ts.map +1 -1
- package/lib/commands/init/evaluateImportsForOverrides.js +39 -25
- package/lib/commands/init/evaluateImportsForOverrides.js.map +1 -1
- package/lib/commands/init/evaluatePath.d.ts.map +1 -1
- package/lib/commands/init/evaluatePath.js +4 -16
- package/lib/commands/init/evaluatePath.js.map +1 -1
- package/lib/commands/init/formatInitSummary.d.ts.map +1 -1
- package/lib/commands/init/formatInitSummary.js +12 -17
- package/lib/commands/init/formatInitSummary.js.map +1 -1
- package/lib/commands/init/index.d.ts.map +1 -1
- package/lib/commands/init/index.js +6 -3
- package/lib/commands/init/index.js.map +1 -1
- package/lib/commands/init/init.d.ts.map +1 -1
- package/lib/commands/init/init.js +101 -107
- package/lib/commands/init/init.js.map +1 -1
- package/lib/commands/init/optimizeDependencies.d.ts +3 -10
- package/lib/commands/init/optimizeDependencies.d.ts.map +1 -1
- package/lib/commands/init/optimizeDependencies.js +3 -6
- package/lib/commands/init/optimizeDependencies.js.map +1 -1
- package/lib/commands/init/types/InitOptions.d.ts +3 -2
- package/lib/commands/init/types/InitOptions.d.ts.map +1 -1
- package/lib/commands/init/types/InitOptions.js.map +1 -1
- package/lib/commands/init/types/InitPackageIdentifier.d.ts +1 -0
- package/lib/commands/init/types/InitPackageIdentifier.d.ts.map +1 -1
- package/lib/commands/init/types/InitPackageIdentifier.js.map +1 -1
- package/lib/commands/init/verifyExports.d.ts +2 -2
- package/lib/commands/init/verifyExports.d.ts.map +1 -1
- package/lib/commands/init/verifyExports.js +52 -75
- package/lib/commands/init/verifyExports.js.map +1 -1
- package/lib/utilities/getFilteredPackages.d.ts +7 -0
- package/lib/utilities/getFilteredPackages.d.ts.map +1 -0
- package/lib/utilities/getFilteredPackages.js +21 -0
- package/lib/utilities/getFilteredPackages.js.map +1 -0
- package/lib/utilities/parseMatch.d.ts +6 -0
- package/lib/utilities/parseMatch.d.ts.map +1 -0
- package/lib/utilities/parseMatch.js +27 -0
- package/lib/utilities/parseMatch.js.map +1 -0
- package/package.json +12 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Session } from '@ms-cloudpack/api-server';
|
|
2
2
|
import type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';
|
|
3
|
-
import type {
|
|
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":"
|
|
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
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
58
|
-
|
|
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
|
-
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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":"
|
|
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,UAA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AAK,IAAI,GAAG,EAAE,CAAC;gBACnD,OAAO,CAAC,OAAO,CAAC,CAAC,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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ack/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.
|
|
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.
|
|
14
|
-
"@ms-cloudpack/app-server": "^0.3.
|
|
15
|
-
"@ms-cloudpack/bundle-server": "^0.2.
|
|
16
|
-
"@ms-cloudpack/common-types": "^0.2.
|
|
17
|
-
"@ms-cloudpack/config": "^0.
|
|
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.
|
|
21
|
-
"@ms-cloudpack/package-utilities": "^7.1.
|
|
22
|
-
"@ms-cloudpack/path-utilities": "^2.
|
|
23
|
-
"@ms-cloudpack/remote-cache": "^0.6.
|
|
24
|
-
"@ms-cloudpack/task-reporter": "^0.
|
|
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.
|
|
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",
|