@ms-cloudpack/api-server 0.36.0 → 0.37.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 (49) hide show
  1. package/lib/apis/ensurePackageBundled.d.ts +2 -0
  2. package/lib/apis/ensurePackageBundled.d.ts.map +1 -1
  3. package/lib/apis/ensurePackageBundled.js +12 -13
  4. package/lib/apis/ensurePackageBundled.js.map +1 -1
  5. package/lib/apis/openCodeEditor.d.ts.map +1 -1
  6. package/lib/apis/openCodeEditor.js +3 -2
  7. package/lib/apis/openCodeEditor.js.map +1 -1
  8. package/lib/data/busSources.d.ts +80 -80
  9. package/lib/types/BundleInfo.d.ts +25 -11
  10. package/lib/types/BundleInfo.d.ts.map +1 -1
  11. package/lib/types/BundleInfo.js.map +1 -1
  12. package/lib/types/TaskDescription.d.ts +64 -64
  13. package/lib/types/TaskEndDescription.d.ts +64 -64
  14. package/lib/types/TaskMessage.d.ts +34 -34
  15. package/lib/types/TaskMessageLocation.d.ts +6 -6
  16. package/lib/types/TaskMessageLocation.js +2 -2
  17. package/lib/types/TaskMessageLocation.js.map +1 -1
  18. package/lib/types/TaskOptions.d.ts +1 -0
  19. package/lib/types/TaskOptions.d.ts.map +1 -1
  20. package/lib/types/TaskOptions.js.map +1 -1
  21. package/lib/types/TaskResponse.d.ts +80 -80
  22. package/lib/types/TaskResult.d.ts +64 -64
  23. package/lib/utilities/TaskRunner.d.ts +4 -0
  24. package/lib/utilities/TaskRunner.d.ts.map +1 -1
  25. package/lib/utilities/TaskRunner.js +10 -2
  26. package/lib/utilities/TaskRunner.js.map +1 -1
  27. package/lib/utilities/bundleTask.d.ts.map +1 -1
  28. package/lib/utilities/bundleTask.js +3 -36
  29. package/lib/utilities/bundleTask.js.map +1 -1
  30. package/lib/utilities/createRemoteCacheClient.js +2 -2
  31. package/lib/utilities/createRemoteCacheClient.js.map +1 -1
  32. package/lib/utilities/ensureRemoteCacheEnabled.d.ts +1 -0
  33. package/lib/utilities/ensureRemoteCacheEnabled.d.ts.map +1 -1
  34. package/lib/utilities/formatBundleTaskResult.d.ts +4 -0
  35. package/lib/utilities/formatBundleTaskResult.d.ts.map +1 -0
  36. package/lib/utilities/formatBundleTaskResult.js +48 -0
  37. package/lib/utilities/formatBundleTaskResult.js.map +1 -0
  38. package/lib/utilities/getBundleInfo.d.ts.map +1 -1
  39. package/lib/utilities/getBundleInfo.js +12 -13
  40. package/lib/utilities/getBundleInfo.js.map +1 -1
  41. package/lib/utilities/getConsumedDependencies.js +2 -2
  42. package/lib/utilities/getConsumedDependencies.js.map +1 -1
  43. package/lib/utilities/getConsumedPaths.js +2 -2
  44. package/lib/utilities/getConsumedPaths.js.map +1 -1
  45. package/package.json +11 -11
  46. package/lib/utilities/formatBundleErrors.d.ts +0 -9
  47. package/lib/utilities/formatBundleErrors.d.ts.map +0 -1
  48. package/lib/utilities/formatBundleErrors.js +0 -15
  49. package/lib/utilities/formatBundleErrors.js.map +0 -1
@@ -7,9 +7,7 @@ import { getImportsAndExports } from './getImportsAndExports.js';
7
7
  */
8
8
  export async function getBundleInfo(params) {
9
9
  const { outputPath, outputFiles, exportsMap, isExternal } = params;
10
- const bundleInfo = {
11
- entry: {},
12
- };
10
+ const bundleInfo = {};
13
11
  // If there are no output files, return the empty bundle info.
14
12
  if (!outputFiles.length) {
15
13
  return bundleInfo;
@@ -54,7 +52,7 @@ export async function getBundleInfo(params) {
54
52
  continue;
55
53
  }
56
54
  const safePath = localPathToSafe[filePath];
57
- if (safePath === undefined) {
55
+ if (safePath === undefined || !outputFileInfo[safePath]) {
58
56
  throw new Error(`Found file that was not expected to be processed: ${filePath}`);
59
57
  }
60
58
  const parseResult = await getImportsAndExports(filePath);
@@ -62,12 +60,9 @@ export async function getBundleInfo(params) {
62
60
  continue;
63
61
  }
64
62
  const { exportNames, imports } = parseResult;
65
- const { entry, produces } = outputFileInfo[safePath] || {
66
- entry: safePath,
67
- produces: new Set(),
68
- };
63
+ const { entry, produces } = outputFileInfo[safePath];
69
64
  exportNames.forEach((name) => produces.add(name));
70
- bundleInfo.entry[entry] ??= {
65
+ bundleInfo[entry] ??= {
71
66
  bundlePath: safePath,
72
67
  produces: Array.from(produces),
73
68
  consumes: [],
@@ -83,15 +78,19 @@ export async function getBundleInfo(params) {
83
78
  }
84
79
  else if (packageName && !packageName.startsWith('node:')) {
85
80
  // Find if the import is already in the consumes list.
86
- const entryIndex = bundleInfo.entry[entry].consumes.findIndex((c) => c.packageName === packageName && c.importPath === importPath);
81
+ const entryIndex = bundleInfo[entry].consumes.findIndex((c) => c.packageName === packageName && c.importPath === importPath);
87
82
  if (entryIndex < 0) {
88
83
  // If not, add it.
89
- bundleInfo.entry[entry].consumes.push({ packageName, importPath: importPath || '.', names: [...names] });
84
+ bundleInfo[entry].consumes.push({
85
+ packageName: packageName,
86
+ importPath: importPath || '.',
87
+ names: [...names],
88
+ });
90
89
  }
91
90
  else {
92
91
  // If so, add the names to the existing entry.
93
92
  // This is necessary because the same import may be used in multiple places.
94
- bundleInfo.entry[entry].consumes[entryIndex].names = Array.from(new Set([...names, ...bundleInfo.entry[entry].consumes[entryIndex].names]));
93
+ bundleInfo[entry].consumes[entryIndex].names = Array.from(new Set([...names, ...bundleInfo[entry].consumes[entryIndex].names]));
95
94
  }
96
95
  }
97
96
  }
@@ -99,7 +98,7 @@ export async function getBundleInfo(params) {
99
98
  // Multiple entries for the same path.
100
99
  for (const repeatedEntry of repeatedExports[safePath]) {
101
100
  if (repeatedEntry !== entry) {
102
- bundleInfo.entry[repeatedEntry] = bundleInfo.entry[entry];
101
+ bundleInfo[repeatedEntry] = bundleInfo[entry];
103
102
  }
104
103
  }
105
104
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getBundleInfo.js","sourceRoot":"","sources":["../../src/utilities/getBundleInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAA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AAU,GAAG,CAAC,EAAE,CAAC;oBACnB,kBAAkB;oBAClB,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,IAAI,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;gBAC3G,CAAC;qBAAM,CAAC;oBACN,8CAA8C;oBAC9C,4EAA4E;oBAC5E,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAC7D,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAC3E,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,sCAAsC;YACtC,KAAK,MAAM,aAAa,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACtD,IAAI,aAAa,KAAK,KAAK,EAAE,CAAC;oBAC5B,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import type { BundleOutputFile, PackageJsonExports } from '@ms-cloudpack/common-types';\nimport { getRuntimeEntryPaths } from '@ms-cloudpack/import-map';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport path from 'path';\nimport type { BundleInfo } from '../types/BundleInfo.js';\nimport { getImportsAndExports } from './getImportsAndExports.js';\n/**\n * Returns a mapping from entry file path to list of paths that are produced and consumed in the searched files.\n */\nexport async function getBundleInfo(params: {\n outputPath: string;\n outputFiles: BundleOutputFile[];\n exportsMap: PackageJsonExports;\n isExternal: boolean;\n}): Promise<BundleInfo> {\n const { outputPath, outputFiles, exportsMap, isExternal } = params;\n const bundleInfo: BundleInfo = {\n entry: {},\n };\n\n // If there are no output files, return the empty bundle info.\n if (!outputFiles.length) {\n return bundleInfo;\n }\n\n /** Mapping from output file (safe/normalized relative path) to possible entry path and exports. */\n const outputFileInfo: Record<string, { entry: string; produces: Set<string> }> = {};\n outputFiles.forEach((file) => {\n // Normalize the path to start with ./ (or . for an empty path)\n const safePath = normalizeRelativePath(file.outputPath);\n // Store safe path to possible entry path and exports.\n outputFileInfo[safePath] = {\n entry: safePath,\n produces: new Set<string>(file.exports),\n };\n });\n\n const repeatedExports: Record<string, string[]> = {};\n const entryPaths = getRuntimeEntryPaths({ isExternal, exportsMap });\n\n for (const [importPath, actualEntryPath] of Object.entries(entryPaths)) {\n const safePath = normalizeRelativePath(actualEntryPath);\n\n if (outputFileInfo[safePath]) {\n if (repeatedExports[safePath]) {\n repeatedExports[safePath].push(importPath);\n } else {\n // Change best guess entry path to exports map entry.\n outputFileInfo[safePath].entry = importPath;\n repeatedExports[safePath] = [importPath];\n }\n }\n }\n\n const localPathToSafe: Record<string, string> = {};\n Object.keys(outputFileInfo).forEach((safePath) => {\n localPathToSafe[path.resolve(outputPath, safePath)] = safePath;\n });\n\n const filePaths = Object.keys(localPathToSafe);\n const visitedPaths = new Set(filePaths);\n const pathsToParse = [...filePaths];\n\n while (pathsToParse.length) {\n const filePath = pathsToParse.shift();\n // Ignore any non-JS/TS files such as SVGs and sourcemaps\n if (!filePath || path.extname(filePath) !== '.js') {\n continue;\n }\n\n const safePath = localPathToSafe[filePath];\n if (safePath === undefined) {\n throw new Error(`Found file that was not expected to be processed: ${filePath}`);\n }\n\n const parseResult = await getImportsAndExports(filePath);\n if (!parseResult) {\n continue;\n }\n const { exportNames, imports } = parseResult;\n\n const { entry, produces } = outputFileInfo[safePath] || {\n entry: safePath,\n produces: new Set<string>(),\n };\n exportNames.forEach((name) => produces.add(name));\n\n bundleInfo.entry[entry] ??= {\n bundlePath: safePath,\n produces: Array.from(produces),\n consumes: [],\n };\n\n for (const { packageName, importPath, names } of imports) {\n if (packageName?.startsWith('.')) {\n const localPath = path.resolve(path.dirname(filePath), packageName, importPath || '');\n\n if (!visitedPaths.has(localPath)) {\n visitedPaths.add(localPath);\n pathsToParse.push(localPath);\n localPathToSafe[localPath] = importPath;\n }\n } else if (packageName && !packageName.startsWith('node:')) {\n // Find if the import is already in the consumes list.\n const entryIndex = bundleInfo.entry[entry].consumes.findIndex(\n (c) => c.packageName === packageName && c.importPath === importPath,\n );\n if (entryIndex < 0) {\n // If not, add it.\n bundleInfo.entry[entry].consumes.push({ packageName, importPath: importPath || '.', names: [...names] });\n } else {\n // If so, add the names to the existing entry.\n // This is necessary because the same import may be used in multiple places.\n bundleInfo.entry[entry].consumes[entryIndex].names = Array.from(\n new Set([...names, ...bundleInfo.entry[entry].consumes[entryIndex].names]),\n );\n }\n }\n }\n if (repeatedExports[safePath]?.length > 1) {\n // Multiple entries for the same path.\n for (const repeatedEntry of repeatedExports[safePath]) {\n if (repeatedEntry !== entry) {\n bundleInfo.entry[repeatedEntry] = bundleInfo.entry[entry];\n }\n }\n }\n }\n\n return bundleInfo;\n}\n"]}
1
+ {"version":3,"file":"getBundleInfo.js","sourceRoot":"","sources":["../../src/utilities/getBundleInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAKnC;IACC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,UAA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CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CACvD,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CACrE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,sCAAsC;YACtC,KAAK,MAAM,aAAa,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACtD,IAAI,aAAa,KAAK,KAAK,EAAE,CAAC;oBAC5B,UAAU,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import type { BundleOutputFile, PackageJsonExports } from '@ms-cloudpack/common-types';\nimport { getRuntimeEntryPaths } from '@ms-cloudpack/import-map';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport path from 'path';\nimport type { BundleInfo } from '../types/BundleInfo.js';\nimport { getImportsAndExports } from './getImportsAndExports.js';\n/**\n * Returns a mapping from entry file path to list of paths that are produced and consumed in the searched files.\n */\nexport async function getBundleInfo(params: {\n outputPath: string;\n outputFiles: BundleOutputFile[];\n exportsMap: PackageJsonExports;\n isExternal: boolean;\n}): Promise<BundleInfo> {\n const { outputPath, outputFiles, exportsMap, isExternal } = params;\n const bundleInfo: BundleInfo = {};\n\n // If there are no output files, return the empty bundle info.\n if (!outputFiles.length) {\n return bundleInfo;\n }\n\n /** Mapping from output file (safe/normalized relative path) to possible entry path and exports. */\n const outputFileInfo: Record<string, { entry: string; produces: Set<string> }> = {};\n outputFiles.forEach((file) => {\n // Normalize the path to start with ./ (or . for an empty path)\n const safePath = normalizeRelativePath(file.outputPath);\n // Store safe path to possible entry path and exports.\n outputFileInfo[safePath] = {\n entry: safePath,\n produces: new Set<string>(file.exports),\n };\n });\n\n const repeatedExports: Record<string, string[]> = {};\n const entryPaths = getRuntimeEntryPaths({ isExternal, exportsMap });\n\n for (const [importPath, actualEntryPath] of Object.entries(entryPaths)) {\n const safePath = normalizeRelativePath(actualEntryPath);\n\n if (outputFileInfo[safePath]) {\n if (repeatedExports[safePath]) {\n repeatedExports[safePath].push(importPath);\n } else {\n // Change best guess entry path to exports map entry.\n outputFileInfo[safePath].entry = importPath;\n repeatedExports[safePath] = [importPath];\n }\n }\n }\n\n const localPathToSafe: Record<string, string> = {};\n Object.keys(outputFileInfo).forEach((safePath) => {\n localPathToSafe[path.resolve(outputPath, safePath)] = safePath;\n });\n\n const filePaths = Object.keys(localPathToSafe);\n const visitedPaths = new Set(filePaths);\n const pathsToParse = [...filePaths];\n\n while (pathsToParse.length) {\n const filePath = pathsToParse.shift();\n // Ignore any non-JS/TS files such as SVGs and sourcemaps\n if (!filePath || path.extname(filePath) !== '.js') {\n continue;\n }\n\n const safePath = localPathToSafe[filePath];\n if (safePath === undefined || !outputFileInfo[safePath]) {\n throw new Error(`Found file that was not expected to be processed: ${filePath}`);\n }\n\n const parseResult = await getImportsAndExports(filePath);\n if (!parseResult) {\n continue;\n }\n const { exportNames, imports } = parseResult;\n\n const { entry, produces } = outputFileInfo[safePath];\n exportNames.forEach((name) => produces.add(name));\n\n bundleInfo[entry] ??= {\n bundlePath: safePath,\n produces: Array.from(produces),\n consumes: [],\n };\n\n for (const { packageName, importPath, names } of imports) {\n if (packageName?.startsWith('.')) {\n const localPath = path.resolve(path.dirname(filePath), packageName, importPath || '');\n\n if (!visitedPaths.has(localPath)) {\n visitedPaths.add(localPath);\n pathsToParse.push(localPath);\n localPathToSafe[localPath] = importPath;\n }\n } else if (packageName && !packageName.startsWith('node:')) {\n // Find if the import is already in the consumes list.\n const entryIndex = bundleInfo[entry].consumes.findIndex(\n (c) => c.packageName === packageName && c.importPath === importPath,\n );\n if (entryIndex < 0) {\n // If not, add it.\n bundleInfo[entry].consumes.push({\n packageName: packageName,\n importPath: importPath || '.',\n names: [...names],\n });\n } else {\n // If so, add the names to the existing entry.\n // This is necessary because the same import may be used in multiple places.\n bundleInfo[entry].consumes[entryIndex].names = Array.from(\n new Set([...names, ...bundleInfo[entry].consumes[entryIndex].names]),\n );\n }\n }\n }\n if (repeatedExports[safePath]?.length > 1) {\n // Multiple entries for the same path.\n for (const repeatedEntry of repeatedExports[safePath]) {\n if (repeatedEntry !== entry) {\n bundleInfo[repeatedEntry] = bundleInfo[entry];\n }\n }\n }\n }\n\n return bundleInfo;\n}\n"]}
@@ -6,8 +6,8 @@
6
6
  export function getConsumedDependencies(info) {
7
7
  const consumedDependencies = new Set();
8
8
  // Iterate through imports and find their path from the resolve map.
9
- for (const entryInfo of Object.values(info.entry)) {
10
- // iterate through all package names of result.info.entry.consumes
9
+ for (const entryInfo of Object.values(info)) {
10
+ // iterate through all package names of result.info.consumes
11
11
  for (const consume of entryInfo.consumes) {
12
12
  consumedDependencies.add(consume.packageName);
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getConsumedDependencies.js","sourceRoot":"","sources":["../../src/utilities/getConsumedDependencies.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAgB;IACtD,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/C,oEAAoE;IACpE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,kEAAkE;QAClE,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;YACzC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["import type { BundleInfo } from '../types/BundleInfo.js';\n\n/**\n * Get the set of dependencies consumed by the given bundle info.\n * @param info - The bundle info.\n * @returns The deduplicated set of dependencies consumed by the given bundle info.\n */\nexport function getConsumedDependencies(info: BundleInfo) {\n const consumedDependencies = new Set<string>();\n // Iterate through imports and find their path from the resolve map.\n for (const entryInfo of Object.values(info.entry)) {\n // iterate through all package names of result.info.entry.consumes\n for (const consume of entryInfo.consumes) {\n consumedDependencies.add(consume.packageName);\n }\n }\n\n return consumedDependencies;\n}\n"]}
1
+ {"version":3,"file":"getConsumedDependencies.js","sourceRoot":"","sources":["../../src/utilities/getConsumedDependencies.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAgB;IACtD,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/C,oEAAoE;IACpE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,4DAA4D;QAC5D,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;YACzC,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,OAAO,oBAAoB,CAAC;AAC9B,CAAC","sourcesContent":["import type { BundleInfo } from '../types/BundleInfo.js';\n\n/**\n * Get the set of dependencies consumed by the given bundle info.\n * @param info - The bundle info.\n * @returns The deduplicated set of dependencies consumed by the given bundle info.\n */\nexport function getConsumedDependencies(info: BundleInfo) {\n const consumedDependencies = new Set<string>();\n // Iterate through imports and find their path from the resolve map.\n for (const entryInfo of Object.values(info)) {\n // iterate through all package names of result.info.consumes\n for (const consume of entryInfo.consumes) {\n consumedDependencies.add(consume.packageName);\n }\n }\n\n return consumedDependencies;\n}\n"]}
@@ -6,8 +6,8 @@
6
6
  export function getConsumedPaths(info) {
7
7
  const consumedPaths = {};
8
8
  // Iterate through imports and find their path from the resolve map.
9
- for (const entryInfo of Object.values(info.entry)) {
10
- // iterate through all package names of result.info.entry.consumes
9
+ for (const entryInfo of Object.values(info)) {
10
+ // iterate through all package names of result.info.consumes
11
11
  for (const consume of entryInfo.consumes) {
12
12
  consumedPaths[consume.packageName] ??= new Set();
13
13
  consumedPaths[consume.packageName].add(consume.importPath);
@@ -1 +1 @@
1
- {"version":3,"file":"getConsumedPaths.js","sourceRoot":"","sources":["../../src/utilities/getConsumedPaths.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAC/C,MAAM,aAAa,GAAgC,EAAE,CAAC;IACtD,oEAAoE;IACpE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,kEAAkE;QAClE,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;YACzC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC;YACjD,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { BundleInfo } from '../types/BundleInfo.js';\n\n/**\n * Get a record of the consumed dependencies and their import paths by the given bundle info.\n * @param info - The bundle info.\n * @returns The record of consumed dependencies and their import paths.\n */\nexport function getConsumedPaths(info: BundleInfo) {\n const consumedPaths: Record<string, Set<string>> = {};\n // Iterate through imports and find their path from the resolve map.\n for (const entryInfo of Object.values(info.entry)) {\n // iterate through all package names of result.info.entry.consumes\n for (const consume of entryInfo.consumes) {\n consumedPaths[consume.packageName] ??= new Set();\n consumedPaths[consume.packageName].add(consume.importPath);\n }\n }\n\n return consumedPaths;\n}\n"]}
1
+ {"version":3,"file":"getConsumedPaths.js","sourceRoot":"","sources":["../../src/utilities/getConsumedPaths.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAC/C,MAAM,aAAa,GAAgC,EAAE,CAAC;IACtD,oEAAoE;IACpE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,4DAA4D;QAC5D,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;YACzC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC;YACjD,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { BundleInfo } from '../types/BundleInfo.js';\n\n/**\n * Get a record of the consumed dependencies and their import paths by the given bundle info.\n * @param info - The bundle info.\n * @returns The record of consumed dependencies and their import paths.\n */\nexport function getConsumedPaths(info: BundleInfo) {\n const consumedPaths: Record<string, Set<string>> = {};\n // Iterate through imports and find their path from the resolve map.\n for (const entryInfo of Object.values(info)) {\n // iterate through all package names of result.info.consumes\n for (const consume of entryInfo.consumes) {\n consumedPaths[consume.packageName] ??= new Set();\n consumedPaths[consume.packageName].add(consume.importPath);\n }\n }\n\n return consumedPaths;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/api-server",
3
- "version": "0.36.0",
3
+ "version": "0.37.1",
4
4
  "description": "An implementation of the API server that does interacts with a task scheduler.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,20 +27,20 @@
27
27
  "@lage-run/logger": "^1.3.0",
28
28
  "@lage-run/scheduler": "^1.1.9",
29
29
  "@lage-run/target-graph": "^0.8.9",
30
- "@ms-cloudpack/bundler": "^0.19.2",
31
- "@ms-cloudpack/common-types": "^0.2.1",
32
- "@ms-cloudpack/config": "^0.19.0",
33
- "@ms-cloudpack/create-express-app": "^1.6.2",
30
+ "@ms-cloudpack/bundler": "^0.19.4",
31
+ "@ms-cloudpack/common-types": "^0.2.3",
32
+ "@ms-cloudpack/config": "^0.19.2",
33
+ "@ms-cloudpack/create-express-app": "^1.6.4",
34
34
  "@ms-cloudpack/data-bus": "^0.4.2",
35
35
  "@ms-cloudpack/file-watcher": "^0.1.2",
36
- "@ms-cloudpack/import-map": "^0.2.2",
36
+ "@ms-cloudpack/import-map": "^0.2.4",
37
37
  "@ms-cloudpack/json-utilities": "^0.1.4",
38
- "@ms-cloudpack/package-hashes": "^0.5.2",
39
- "@ms-cloudpack/package-utilities": "^7.1.2",
38
+ "@ms-cloudpack/package-hashes": "^0.5.4",
39
+ "@ms-cloudpack/package-utilities": "^7.1.4",
40
40
  "@ms-cloudpack/path-string-parsing": "^1.2.1",
41
- "@ms-cloudpack/path-utilities": "^2.6.1",
42
- "@ms-cloudpack/remote-cache": "^0.6.3",
43
- "@ms-cloudpack/task-reporter": "^0.12.0",
41
+ "@ms-cloudpack/path-utilities": "^2.7.1",
42
+ "@ms-cloudpack/remote-cache": "^0.6.5",
43
+ "@ms-cloudpack/task-reporter": "^0.13.1",
44
44
  "@ms-cloudpack/telemetry": "^0.5.1",
45
45
  "@trpc/client": "^10.45.0",
46
46
  "@trpc/server": "^10.45.0",
@@ -1,9 +0,0 @@
1
- import type { BundleMessage } from '@ms-cloudpack/common-types';
2
- export declare function formatBundleErrors(errors: BundleMessage[] | undefined): {
3
- message?: undefined;
4
- details?: undefined;
5
- } | {
6
- message: string;
7
- details: string;
8
- };
9
- //# sourceMappingURL=formatBundleErrors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatBundleErrors.d.ts","sourceRoot":"","sources":["../../src/utilities/formatBundleErrors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,SAAS;;;;;;EAOrE"}
@@ -1,15 +0,0 @@
1
- import { darkGrey, red, bulletedList, plural } from '@ms-cloudpack/task-reporter';
2
- export function formatBundleErrors(errors) {
3
- if (!errors?.length)
4
- return {};
5
- return {
6
- message: plural(errors.length, 'error$s found'),
7
- details: bulletedList(errors.map((error) => formatError(error))),
8
- };
9
- }
10
- function formatError(error) {
11
- const { text, source, location } = error;
12
- const fileLocation = location && darkGrey(`${location.file}:${location.line}:${location.column}`);
13
- return [`[${source}]`, fileLocation, red(text)].filter(Boolean).join(' ');
14
- }
15
- //# sourceMappingURL=formatBundleErrors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatBundleErrors.js","sourceRoot":"","sources":["../../src/utilities/formatBundleErrors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAElF,MAAM,UAAU,kBAAkB,CAAC,MAAmC;IACpE,IAAI,CAAC,MAAM,EAAE,MAAM;QAAE,OAAO,EAAE,CAAC;IAE/B,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;QAC/C,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;KACjE,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,KAAoB;IACvC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEzC,MAAM,YAAY,GAAG,QAAQ,IAAI,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAClG,OAAO,CAAC,IAAI,MAAM,GAAG,EAAE,YAAY,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import type { BundleMessage } from '@ms-cloudpack/common-types';\nimport { darkGrey, red, bulletedList, plural } from '@ms-cloudpack/task-reporter';\n\nexport function formatBundleErrors(errors: BundleMessage[] | undefined) {\n if (!errors?.length) return {};\n\n return {\n message: plural(errors.length, 'error$s found'),\n details: bulletedList(errors.map((error) => formatError(error))),\n };\n}\n\nfunction formatError(error: BundleMessage) {\n const { text, source, location } = error;\n\n const fileLocation = location && darkGrey(`${location.file}:${location.line}:${location.column}`);\n return [`[${source}]`, fileLocation, red(text)].filter(Boolean).join(' ');\n}\n"]}