@ms-cloudpack/api-server 0.35.0 → 0.37.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 (64) hide show
  1. package/lib/apis/ensurePackageBundled.d.ts.map +1 -1
  2. package/lib/apis/ensurePackageBundled.js +33 -15
  3. package/lib/apis/ensurePackageBundled.js.map +1 -1
  4. package/lib/apis/openCodeEditor.d.ts.map +1 -1
  5. package/lib/apis/openCodeEditor.js +3 -2
  6. package/lib/apis/openCodeEditor.js.map +1 -1
  7. package/lib/data/busSources.d.ts +94 -80
  8. package/lib/data/busSources.d.ts.map +1 -1
  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/BundleTaskOptions.d.ts +8 -0
  13. package/lib/types/BundleTaskOptions.d.ts.map +1 -1
  14. package/lib/types/BundleTaskOptions.js.map +1 -1
  15. package/lib/types/TaskDescription.d.ts +74 -64
  16. package/lib/types/TaskDescription.d.ts.map +1 -1
  17. package/lib/types/TaskEndDescription.d.ts +74 -64
  18. package/lib/types/TaskEndDescription.d.ts.map +1 -1
  19. package/lib/types/TaskMessage.d.ts +37 -34
  20. package/lib/types/TaskMessage.d.ts.map +1 -1
  21. package/lib/types/TaskMessage.js +1 -0
  22. package/lib/types/TaskMessage.js.map +1 -1
  23. package/lib/types/TaskMessageLocation.d.ts +6 -6
  24. package/lib/types/TaskMessageLocation.js +2 -2
  25. package/lib/types/TaskMessageLocation.js.map +1 -1
  26. package/lib/types/TaskResponse.d.ts +94 -80
  27. package/lib/types/TaskResponse.d.ts.map +1 -1
  28. package/lib/types/TaskResult.d.ts +74 -64
  29. package/lib/types/TaskResult.d.ts.map +1 -1
  30. package/lib/utilities/TaskRunner.d.ts.map +1 -1
  31. package/lib/utilities/TaskRunner.js +21 -35
  32. package/lib/utilities/TaskRunner.js.map +1 -1
  33. package/lib/utilities/addOverride.js +1 -1
  34. package/lib/utilities/addOverride.js.map +1 -1
  35. package/lib/utilities/bundleTask.d.ts.map +1 -1
  36. package/lib/utilities/bundleTask.js +11 -9
  37. package/lib/utilities/bundleTask.js.map +1 -1
  38. package/lib/utilities/createBundleRequestForPackage.d.ts +2 -4
  39. package/lib/utilities/createBundleRequestForPackage.d.ts.map +1 -1
  40. package/lib/utilities/createBundleRequestForPackage.js +3 -10
  41. package/lib/utilities/createBundleRequestForPackage.js.map +1 -1
  42. package/lib/utilities/createBundleTask.d.ts.map +1 -1
  43. package/lib/utilities/createBundleTask.js +4 -3
  44. package/lib/utilities/createBundleTask.js.map +1 -1
  45. package/lib/utilities/createRemoteCacheClient.js +2 -2
  46. package/lib/utilities/createRemoteCacheClient.js.map +1 -1
  47. package/lib/utilities/ensureRemoteCacheEnabled.d.ts +1 -0
  48. package/lib/utilities/ensureRemoteCacheEnabled.d.ts.map +1 -1
  49. package/lib/utilities/formatBundleErrors.d.ts +1 -1
  50. package/lib/utilities/formatBundleErrors.d.ts.map +1 -1
  51. package/lib/utilities/formatBundleErrors.js +9 -12
  52. package/lib/utilities/formatBundleErrors.js.map +1 -1
  53. package/lib/utilities/getBundleInfo.d.ts.map +1 -1
  54. package/lib/utilities/getBundleInfo.js +12 -13
  55. package/lib/utilities/getBundleInfo.js.map +1 -1
  56. package/lib/utilities/getBundleLocation.d.ts +1 -0
  57. package/lib/utilities/getBundleLocation.d.ts.map +1 -1
  58. package/lib/utilities/getBundleLocation.js +11 -10
  59. package/lib/utilities/getBundleLocation.js.map +1 -1
  60. package/lib/utilities/getConsumedDependencies.js +2 -2
  61. package/lib/utilities/getConsumedDependencies.js.map +1 -1
  62. package/lib/utilities/getConsumedPaths.js +2 -2
  63. package/lib/utilities/getConsumedPaths.js.map +1 -1
  64. package/package.json +11 -11
@@ -1,8 +1,8 @@
1
1
  import type { CloudpackConfig } from '@ms-cloudpack/common-types';
2
2
  import type { ResolveMapEntry } from '@ms-cloudpack/package-utilities';
3
3
  import type { BundleRequest } from '../types/BundleRequest.js';
4
- import type { PackageHashes } from '@ms-cloudpack/package-hashes';
5
4
  export declare function createBundleRequestForPackage(options: {
5
+ id: string;
6
6
  packageEntry: ResolveMapEntry;
7
7
  outputPath?: string;
8
8
  bundlerType?: string;
@@ -10,9 +10,7 @@ export declare function createBundleRequestForPackage(options: {
10
10
  shouldGetBundleInfo?: boolean;
11
11
  disableCache?: boolean;
12
12
  isIncremental?: boolean;
13
- useHashAsId?: boolean;
14
13
  }, context: {
15
14
  config: CloudpackConfig;
16
- packageHashes: PackageHashes;
17
- }): Promise<BundleRequest>;
15
+ }): BundleRequest;
18
16
  //# sourceMappingURL=createBundleRequestForPackage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createBundleRequestForPackage.d.ts","sourceRoot":"","sources":["../../src/utilities/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAsB,6BAA6B,CACjD,OAAO,EAAE;IACP,YAAY,EAAE,eAAe,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,EACD,OAAO,EAAE;IACP,MAAM,EAAE,eAAe,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;CAC9B,GACA,OAAO,CAAC,aAAa,CAAC,CA2BxB"}
1
+ {"version":3,"file":"createBundleRequestForPackage.d.ts","sourceRoot":"","sources":["../../src/utilities/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE;IACP,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,eAAe,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,OAAO,EAAE;IACP,MAAM,EAAE,eAAe,CAAC;CACzB,GACA,aAAa,CAmBf"}
@@ -1,15 +1,8 @@
1
- export async function createBundleRequestForPackage(options, context) {
2
- const { packageEntry, isIncremental, useHashAsId } = options;
3
- const { config, packageHashes } = context;
1
+ export function createBundleRequestForPackage(options, context) {
2
+ const { id, packageEntry, isIncremental } = options;
3
+ const { config } = context;
4
4
  const { features = {} } = config;
5
5
  const { path, version, name, isExternal } = packageEntry;
6
- const id = useHashAsId
7
- ? await packageHashes.get({
8
- packagePath: packageEntry.path,
9
- isSourceHashingEnabled: false,
10
- shouldRecalculate: true,
11
- })
12
- : path;
13
6
  return {
14
7
  id,
15
8
  packagePath: path,
@@ -1 +1 @@
1
- {"version":3,"file":"createBundleRequestForPackage.js","sourceRoot":"","sources":["../../src/utilities/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OASC,EACD,OAGC;IAED,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAC7D,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAC1C,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IACjC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC;IAEzD,MAAM,EAAE,GAAG,WAAW;QACpB,CAAC,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC;YACtB,WAAW,EAAE,YAAY,CAAC,IAAI;YAC9B,sBAAsB,EAAE,KAAK;YAC7B,iBAAiB,EAAE,IAAI;SACxB,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;IAET,OAAO;QACL,EAAE;QACF,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,aAAa,EAAE,aAAa;QAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,OAAO;QACP,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB;QAC1E,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,QAAQ,CAAC,mBAAmB;QAChF,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/common-types';\nimport type { ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\nexport async function createBundleRequestForPackage(\n options: {\n packageEntry: ResolveMapEntry;\n outputPath?: string;\n bundlerType?: string;\n disableSourceMaps?: boolean;\n shouldGetBundleInfo?: boolean;\n disableCache?: boolean;\n isIncremental?: boolean;\n useHashAsId?: boolean;\n },\n context: {\n config: CloudpackConfig;\n packageHashes: PackageHashes;\n },\n): Promise<BundleRequest> {\n const { packageEntry, isIncremental, useHashAsId } = options;\n const { config, packageHashes } = context;\n const { features = {} } = config;\n const { path, version, name, isExternal } = packageEntry;\n\n const id = useHashAsId\n ? await packageHashes.get({\n packagePath: packageEntry.path,\n isSourceHashingEnabled: false,\n shouldRecalculate: true,\n })\n : path;\n\n return {\n id,\n packagePath: path,\n packageName: name,\n isExternal: !!isExternal,\n isIncremental: isIncremental,\n outputPath: options.outputPath,\n version,\n disableSourceMaps: options.disableSourceMaps ?? features.disableSourceMaps,\n shouldGetBundleInfo: options.shouldGetBundleInfo ?? features.enqueueDependencies,\n disableCache: options.disableCache,\n bundlerType: options.bundlerType,\n };\n}\n"]}
1
+ {"version":3,"file":"createBundleRequestForPackage.js","sourceRoot":"","sources":["../../src/utilities/createBundleRequestForPackage.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,6BAA6B,CAC3C,OASC,EACD,OAEC;IAED,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IACpD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IACjC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC;IAEzD,OAAO;QACL,EAAE;QACF,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,CAAC,CAAC,UAAU;QACxB,aAAa,EAAE,aAAa;QAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,OAAO;QACP,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB;QAC1E,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,IAAI,QAAQ,CAAC,mBAAmB;QAChF,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/common-types';\nimport type { ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport type { BundleRequest } from '../types/BundleRequest.js';\n\nexport function createBundleRequestForPackage(\n options: {\n id: string;\n packageEntry: ResolveMapEntry;\n outputPath?: string;\n bundlerType?: string;\n disableSourceMaps?: boolean;\n shouldGetBundleInfo?: boolean;\n disableCache?: boolean;\n isIncremental?: boolean;\n },\n context: {\n config: CloudpackConfig;\n },\n): BundleRequest {\n const { id, packageEntry, isIncremental } = options;\n const { config } = context;\n const { features = {} } = config;\n const { path, version, name, isExternal } = packageEntry;\n\n return {\n id,\n packagePath: path,\n packageName: name,\n isExternal: !!isExternal,\n isIncremental: isIncremental,\n outputPath: options.outputPath,\n version,\n disableSourceMaps: options.disableSourceMaps ?? features.disableSourceMaps,\n shouldGetBundleInfo: options.shouldGetBundleInfo ?? features.enqueueDependencies,\n disableCache: options.disableCache,\n bundlerType: options.bundlerType,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createBundleTask.d.ts","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAK7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK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aAAa,CAAC;QAC7B,kBAAkB,EAAE,kBAAkB,CAAC;QACvC,QAAQ,CAAC,EAAE,YAAY,CAAC;QACxB,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC,CAAC;IACF,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,GAAG,IAAI,CAAC,aAAa,CAAC,CAoEtB"}
@@ -7,10 +7,11 @@ import { addImportMapHash } from '@ms-cloudpack/import-map';
7
7
  * remotely (e.g. in the browser) and allows the user to cancel tasks.
8
8
  */
9
9
  export function createBundleTask(params) {
10
- const { bundleRequest, context, options } = params;
10
+ const { bundleRequest, context, options = {} } = params;
11
11
  const { id, packageName, version, packagePath, isExternal } = bundleRequest;
12
12
  const { session, reporter, telemetryClient, packageImportPaths, packages, packageHashes } = context;
13
13
  const { config, resolveMap } = session;
14
+ const { hash, sourceHash } = options;
14
15
  return {
15
16
  name: `Bundle ${packageName}@${version}`,
16
17
  id,
@@ -30,8 +31,8 @@ export function createBundleTask(params) {
30
31
  },
31
32
  });
32
33
  try {
33
- const hash = await packageHashes.get({ packagePath, isSourceHashingEnabled: !isExternal });
34
- addImportMapHash({ packageName, version, importMap: session.getImportMap(), resolveMap, hash }, {
34
+ const importMapHash = sourceHash || hash || (await packageHashes.get({ packagePath, isSourceHashingEnabled: !isExternal }));
35
+ addImportMapHash({ packageName, version, importMap: session.getImportMap(), resolveMap, hash: importMapHash }, {
35
36
  packageImportPaths,
36
37
  });
37
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createBundleTask.js","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAO5D;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAWhC;IACC,M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I,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;gBAC1B,OAAO;YACT,CAAC;YAED,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;YAEjC,qGAAqG;YACrG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAE7E,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC;QACnC,CAAC;QACD,SAAS,EAAE,GAAG,EAAE;YACd,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC;QACpC,CAAC;QACD,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM;QAC7C,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;YAC1B,EAAE;YACF,IAAI,EAAE,UAAU,WAAW,IAAI,OAAO,EAAE;YACxC,SAAS,EAAE,WAAW,IAAI,EAAE;SAC7B,CAAC;QACF,iBAAiB,EAAE,CAAC,UAAU,EAAE,EAAE,CAChC,CAAC;YACC,EAAE;YACF,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM;YAClC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ;YACtC,UAAU,EAAE,aAAa,CAAC,MAAM,EAAE,UAAU,IAAI,EAAE;SACnD,CAAuB;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["import type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport type { Task } from '../types/Task.js';\nimport type { TaskEndDescription } from '../types/TaskEndDescription.js';\nimport path from 'path';\nimport fs from 'fs';\nimport { bundleTask } from './bundleTask.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { addImportMapHash } from '@ms-cloudpack/import-map';\nimport type { Session } from '../types/Session.js';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { PackageImportPaths } from '@ms-cloudpack/import-map';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\n/**\n * Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked\n * remotely (e.g. in the browser) and allows the user to cancel tasks.\n */\nexport function createBundleTask(params: {\n bundleRequest: BundleRequest;\n context: {\n session: Session;\n packages: PackageDefinitionsCache;\n packageHashes: PackageHashes;\n packageImportPaths: PackageImportPaths;\n reporter?: TaskReporter;\n telemetryClient?: TelemetryClient;\n };\n options?: BundleTaskOptions;\n}): Task<BundleRequest> {\n const { bundleRequest, context, options } = params;\n const { id, packageName, version, packagePath, isExternal } = bundleRequest;\n const { session, reporter, telemetryClient, packageImportPaths, packages, packageHashes } = context;\n const { config, resolveMap } = session;\n\n return {\n name: `Bundle ${packageName}@${version}`,\n id,\n dir: `${path.join(packagePath, 'src')}`,\n watch: !isExternal,\n async execute(): Promise<BundleRequest> {\n await bundleTask({\n bundleRequest,\n options,\n context: {\n packages,\n config,\n resolveMap,\n packageHashes,\n reporter,\n telemetryClient,\n },\n });\n try {\n const hash = await packageHashes.get({ packagePath, isSourceHashingEnabled: !isExternal });\n addImportMapHash(\n { packageName, version, importMap: session.getImportMap(), resolveMap, hash },\n {\n packageImportPaths,\n },\n );\n } catch (e) {\n console.error(`Error adding hash to import map for ${bundleRequest.packagePath}:`, (e as Error).stack || e);\n }\n return bundleRequest;\n },\n clear: () => {\n if (!bundleRequest.result) {\n return;\n }\n\n bundleRequest.result.dispose?.();\n\n // eslint-disable-next-line @ms-cloudpack/internal/no-sync-filesystem -- this function can't be async\n fs.rmSync(bundleRequest.result.outputPath, { recursive: true, force: true });\n\n bundleRequest.result = undefined;\n },\n onDispose: () => {\n bundleRequest.result?.dispose?.();\n },\n getErrors: () => bundleRequest.result?.errors,\n getStartDescription: () => ({\n id,\n name: `Bundle ${packageName}@${version}`,\n inputPath: packagePath || '',\n }),\n getEndDescription: (taskResult) =>\n ({\n id,\n errors: taskResult?.result?.errors,\n warnings: taskResult?.result?.warnings,\n outputPath: bundleRequest.result?.outputPath || '',\n }) as TaskEndDescription,\n };\n}\n"]}
1
+ {"version":3,"file":"createBundleTask.js","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAO5D;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAWhC;IACC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IACxD,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;IAC5E,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,kBAAkB,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IACpG,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACvC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAErC,OAAO;QACL,IAAI,EAAE,UAAU,WAAW,IAAI,OAAO,EAAE;QACxC,EAAE;QACF,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE;QACvC,KAAK,EAAE,CAAC,UAAU;QAClB,KAAK,CAAC,OAAO;YACX,MAAM,UAAU,CAAC;gBACf,aAAa;gBACb,OAAO;gBACP,OAAO,EAAE;oBACP,QAAQ;oBACR,MAAM;oBACN,UAAU;oBACV,aAAa;oBACb,QAAQ;oBACR,eAAe;iBAChB;aACF,CAAC,CAAC;YACH,IAAI,CAAC;gBACH,MAAM,a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AC;YACC,EAAE;YACF,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM;YAClC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ;YACtC,UAAU,EAAE,aAAa,CAAC,MAAM,EAAE,UAAU,IAAI,EAAE;SACnD,CAAuB;KAC3B,CAAC;AACJ,CAAC","sourcesContent":["import type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport type { Task } from '../types/Task.js';\nimport type { TaskEndDescription } from '../types/TaskEndDescription.js';\nimport path from 'path';\nimport fs from 'fs';\nimport { bundleTask } from './bundleTask.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { addImportMapHash } from '@ms-cloudpack/import-map';\nimport type { Session } from '../types/Session.js';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { PackageImportPaths } from '@ms-cloudpack/import-map';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\n/**\n * Creates a bundle task tracked in the task runner of the api server. This allows active tasks to be tracked\n * remotely (e.g. in the browser) and allows the user to cancel tasks.\n */\nexport function createBundleTask(params: {\n bundleRequest: BundleRequest;\n context: {\n session: Session;\n packages: PackageDefinitionsCache;\n packageHashes: PackageHashes;\n packageImportPaths: PackageImportPaths;\n reporter?: TaskReporter;\n telemetryClient?: TelemetryClient;\n };\n options?: BundleTaskOptions;\n}): Task<BundleRequest> {\n const { bundleRequest, context, options = {} } = params;\n const { id, packageName, version, packagePath, isExternal } = bundleRequest;\n const { session, reporter, telemetryClient, packageImportPaths, packages, packageHashes } = context;\n const { config, resolveMap } = session;\n const { hash, sourceHash } = options;\n\n return {\n name: `Bundle ${packageName}@${version}`,\n id,\n dir: `${path.join(packagePath, 'src')}`,\n watch: !isExternal,\n async execute(): Promise<BundleRequest> {\n await bundleTask({\n bundleRequest,\n options,\n context: {\n packages,\n config,\n resolveMap,\n packageHashes,\n reporter,\n telemetryClient,\n },\n });\n try {\n const importMapHash =\n sourceHash || hash || (await packageHashes.get({ packagePath, isSourceHashingEnabled: !isExternal }));\n addImportMapHash(\n { packageName, version, importMap: session.getImportMap(), resolveMap, hash: importMapHash },\n {\n packageImportPaths,\n },\n );\n } catch (e) {\n console.error(`Error adding hash to import map for ${bundleRequest.packagePath}:`, (e as Error).stack || e);\n }\n return bundleRequest;\n },\n clear: () => {\n if (!bundleRequest.result) {\n return;\n }\n\n bundleRequest.result.dispose?.();\n\n // eslint-disable-next-line @ms-cloudpack/internal/no-sync-filesystem -- this function can't be async\n fs.rmSync(bundleRequest.result.outputPath, { recursive: true, force: true });\n\n bundleRequest.result = undefined;\n },\n onDispose: () => {\n bundleRequest.result?.dispose?.();\n },\n getErrors: () => bundleRequest.result?.errors,\n getStartDescription: () => ({\n id,\n name: `Bundle ${packageName}@${version}`,\n inputPath: packagePath || '',\n }),\n getEndDescription: (taskResult) =>\n ({\n id,\n errors: taskResult?.result?.errors,\n warnings: taskResult?.result?.warnings,\n outputPath: bundleRequest.result?.outputPath || '',\n }) as TaskEndDescription,\n };\n}\n"]}
@@ -4,11 +4,11 @@ export async function createRemoteCacheClient(params) {
4
4
  const { ctx, input } = params;
5
5
  const { loginMethod } = input;
6
6
  const { session, reporter, telemetryClient } = ctx;
7
- const { container, storageAccount } = ensureRemoteCacheEnabled(session.config);
7
+ const { container, storageAccount, tenantId } = ensureRemoteCacheEnabled(session.config);
8
8
  const remoteCacheModule = await import('@ms-cloudpack/remote-cache');
9
9
  const client = await remoteCacheModule.createRemoteCacheClient({
10
10
  context: { reporter, telemetryClient },
11
- options: { container, loginMethod, storageAccount, cachePath: getCachePath() },
11
+ options: { container, loginMethod, storageAccount, cachePath: getCachePath(), tenantId },
12
12
  });
13
13
  return client;
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createRemoteCacheClient.js","sourceRoot":"","sources":["../../src/utilities/createRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAGpF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAKC;IAED,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAC9B,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;IACnD,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/E,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,uBAAuB,CAAC;QAC7D,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE;QACtC,OAAO,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE;KAC/E,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { ensureRemoteCacheEnabled } from '../utilities/ensureRemoteCacheEnabled.js';\nimport type { LoginMethod } from '@ms-cloudpack/remote-cache';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { getCachePath } from './getCachePath.js';\n\nexport async function createRemoteCacheClient(\n params: ApiParams<\n {\n loginMethod: LoginMethod;\n },\n 'session' | 'reporter' | 'telemetryClient'\n >,\n) {\n const { ctx, input } = params;\n const { loginMethod } = input;\n const { session, reporter, telemetryClient } = ctx;\n const { container, storageAccount } = ensureRemoteCacheEnabled(session.config);\n\n const remoteCacheModule = await import('@ms-cloudpack/remote-cache');\n\n const client = await remoteCacheModule.createRemoteCacheClient({\n context: { reporter, telemetryClient },\n options: { container, loginMethod, storageAccount, cachePath: getCachePath() },\n });\n\n return client;\n}\n"]}
1
+ {"version":3,"file":"createRemoteCacheClient.js","sourceRoot":"","sources":["../../src/utilities/createRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAGpF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAKC;IAED,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAC9B,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;IACnD,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzF,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,uBAAuB,CAAC;QAC7D,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE;QACtC,OAAO,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE;KACzF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { ensureRemoteCacheEnabled } from '../utilities/ensureRemoteCacheEnabled.js';\nimport type { LoginMethod } from '@ms-cloudpack/remote-cache';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { getCachePath } from './getCachePath.js';\n\nexport async function createRemoteCacheClient(\n params: ApiParams<\n {\n loginMethod: LoginMethod;\n },\n 'session' | 'reporter' | 'telemetryClient'\n >,\n) {\n const { ctx, input } = params;\n const { loginMethod } = input;\n const { session, reporter, telemetryClient } = ctx;\n const { container, storageAccount, tenantId } = ensureRemoteCacheEnabled(session.config);\n\n const remoteCacheModule = await import('@ms-cloudpack/remote-cache');\n\n const client = await remoteCacheModule.createRemoteCacheClient({\n context: { reporter, telemetryClient },\n options: { container, loginMethod, storageAccount, cachePath: getCachePath(), tenantId },\n });\n\n return client;\n}\n"]}
@@ -7,5 +7,6 @@ import type { CloudpackConfig } from '@ms-cloudpack/common-types';
7
7
  export declare function ensureRemoteCacheEnabled({ remoteCache }: CloudpackConfig): {
8
8
  storageAccount: string;
9
9
  container: string;
10
+ tenantId?: string | undefined;
10
11
  };
11
12
  //# sourceMappingURL=ensureRemoteCacheEnabled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ensureRemoteCacheEnabled.d.ts","sourceRoot":"","sources":["../../src/utilities/ensureRemoteCacheEnabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,WAAW,EAAE,EAAE,eAAe;;;EAMxE"}
1
+ {"version":3,"file":"ensureRemoteCacheEnabled.d.ts","sourceRoot":"","sources":["../../src/utilities/ensureRemoteCacheEnabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,WAAW,EAAE,EAAE,eAAe;;;;EAMxE"}
@@ -1,5 +1,5 @@
1
1
  import type { BundleMessage } from '@ms-cloudpack/common-types';
2
- export declare function formatBundleErrors(errors: BundleMessage[] | undefined): {
2
+ export declare function formatBundleErrors(errors: BundleMessage[] | undefined, packagePath: string): {
3
3
  message?: undefined;
4
4
  details?: undefined;
5
5
  } | {
@@ -1 +1 @@
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
+ {"version":3,"file":"formatBundleErrors.d.ts","sourceRoot":"","sources":["../../src/utilities/formatBundleErrors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM;;;;;;EAO1F"}
@@ -1,19 +1,16 @@
1
- import { darkGrey, red, bulletedList } from '@ms-cloudpack/task-reporter';
2
- export function formatBundleErrors(errors) {
1
+ import { formatLocation } from '@ms-cloudpack/path-utilities';
2
+ import { red, bulletedList, plural, indent } from '@ms-cloudpack/task-reporter';
3
+ export function formatBundleErrors(errors, packagePath) {
3
4
  if (!errors?.length)
4
5
  return {};
5
6
  return {
6
- message: `${errors.length} ${errors.length === 1 ? 'error' : 'errors'} found`,
7
- details: bulletedList(errors.map((error) => formatError(error))),
7
+ message: plural(errors.length, 'error$s found'),
8
+ details: bulletedList(errors.map((error) => formatError(error, packagePath))),
8
9
  };
9
10
  }
10
- function formatError(error) {
11
- const { location } = error;
12
- return [
13
- location && darkGrey(`${location.file}:${location.line}:${location.column}:`),
14
- red(error.text ? error.text : JSON.stringify(error, null, 2)),
15
- ]
16
- .filter(Boolean)
17
- .join(' ');
11
+ function formatError(error, packagePath) {
12
+ const { text, source, location } = error;
13
+ const filePath = location ? ' ' + formatLocation({ ...location, fromPath: packagePath }) : '';
14
+ return `[${source}]${filePath}\n${red(indent(text, 1))}`;
18
15
  }
19
16
  //# sourceMappingURL=formatBundleErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatBundleErrors.js","sourceRoot":"","sources":["../../src/utilities/formatBundleErrors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,UAAU,kBAAkB,CAAC,MAAmC;IACpE,IAAI,CAAC,MAAM,EAAE,MAAM;QAAE,OAAO,EAAE,CAAC;IAE/B,OAAO;QACL,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,QAAQ;QAC7E,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,QAAQ,EAAE,GAAG,KAAK,CAAC;IAE3B,OAAO;QACL,QAAQ,IAAI,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAC7E,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;KAC9D;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["import type { BundleMessage } from '@ms-cloudpack/common-types';\nimport { darkGrey, red, bulletedList } from '@ms-cloudpack/task-reporter';\n\nexport function formatBundleErrors(errors: BundleMessage[] | undefined) {\n if (!errors?.length) return {};\n\n return {\n message: `${errors.length} ${errors.length === 1 ? 'error' : 'errors'} found`,\n details: bulletedList(errors.map((error) => formatError(error))),\n };\n}\n\nfunction formatError(error: BundleMessage) {\n const { location } = error;\n\n return [\n location && darkGrey(`${location.file}:${location.line}:${location.column}:`),\n red(error.text ? error.text : JSON.stringify(error, null, 2)),\n ]\n .filter(Boolean)\n .join(' ');\n}\n"]}
1
+ {"version":3,"file":"formatBundleErrors.js","sourceRoot":"","sources":["../../src/utilities/formatBundleErrors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAEhF,MAAM,UAAU,kBAAkB,CAAC,MAAmC,EAAE,WAAmB;IACzF,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,EAAE,WAAW,CAAC,CAAC,CAAC;KAC9E,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,KAAoB,EAAE,WAAmB;IAC5D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEzC,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,cAAc,CAAC,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9F,OAAO,IAAI,MAAM,IAAI,QAAQ,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["import type { BundleMessage } from '@ms-cloudpack/common-types';\nimport { formatLocation } from '@ms-cloudpack/path-utilities';\nimport { red, bulletedList, plural, indent } from '@ms-cloudpack/task-reporter';\n\nexport function formatBundleErrors(errors: BundleMessage[] | undefined, packagePath: string) {\n if (!errors?.length) return {};\n\n return {\n message: plural(errors.length, 'error$s found'),\n details: bulletedList(errors.map((error) => formatError(error, packagePath))),\n };\n}\n\nfunction formatError(error: BundleMessage, packagePath: string) {\n const { text, source, location } = error;\n\n const filePath = location ? ' ' + formatLocation({ ...location, fromPath: packagePath }) : '';\n return `[${source}]${filePath}\\n${red(indent(text, 1))}`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getBundleInfo.d.ts","sourceRoot":"","sources":["../../src/utilities/getBundleInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,OAAO,CAAC,UAAU,CAAC,CAoHtB"}
1
+ {"version":3,"file":"getBundleInfo.d.ts","sourceRoot":"","sources":["../../src/utilities/getBundleInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,OAAO,CAAC,UAAU,CAAC,CAmHtB"}
@@ -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,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,UAAU,EAAE,GAAG,MAAM,CAAC;IACnE,MAAM,UAAU,GAAe;QAC7B,KAAK,EAAE,EAAE;KACV,CAAC;IAEF,8DAA8D;IAC9D,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,mGAAmG;IACnG,MAAM,cAAc,GAA6D,EAAE,CAAC;IACpF,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,+DAA+D;QAC/D,MAAM,QAAQ,GAAG,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxD,sDAAsD;QACtD,cAAc,CAAC,QAAQ,CAAC,GAAG;YACzB,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,IAAI,GAAG,CAAS,IAAI,CAAC,OAAO,CAAC;SACxC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,eAAe,GA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C;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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AC,SAAS,CACrD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,IAAI,CAAC,CAAC,UAAU,KAAK,UAAU,CACpE,CAAC;gBACF,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;oBACnB,kBAAkB;oBAClB,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;wBAC9B,WAAW,EAAE,WAAW;wBACxB,UAAU,EAAE,UAAU,IAAI,GAAG;wBAC7B,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC;qBAClB,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,8CAA8C;oBAC9C,4EAA4E;oBAC5E,UAAU,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"]}
@@ -3,6 +3,7 @@ import type { PackageHashes } from '@ms-cloudpack/package-hashes';
3
3
  export declare function getBundleLocation(options: {
4
4
  packagePath: string;
5
5
  shouldRecalculate?: boolean;
6
+ hash?: string;
6
7
  }, context: {
7
8
  packages: PackageDefinitionsCache;
8
9
  packageHashes: PackageHashes;
@@ -1 +1 @@
1
- {"version":3,"file":"getBundleLocation.d.ts","sourceRoot":"","sources":["../../src/utilities/getBundleLocation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAsB,iBAAiB,CACrC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,EAC7D,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;IAClC,aAAa,EAAE,aAAa,CAAC;CAC9B;;;GAiCF"}
1
+ {"version":3,"file":"getBundleLocation.d.ts","sourceRoot":"","sources":["../../src/utilities/getBundleLocation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAsB,iBAAiB,CACrC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAC5E,OAAO,EAAE;IACP,QAAQ,EAAE,uBAAuB,CAAC;IAClC,aAAa,EAAE,aAAa,CAAC;CAC9B;;;GAmCF"}
@@ -2,7 +2,7 @@ import filenamify from 'filenamify';
2
2
  import path from 'path';
3
3
  import { getCachePath } from './getCachePath.js';
4
4
  export async function getBundleLocation(options, context) {
5
- const { packagePath, shouldRecalculate } = options;
5
+ const { packagePath, shouldRecalculate, hash } = options;
6
6
  const { packages, packageHashes } = context;
7
7
  const definition = await packages.get(packagePath);
8
8
  if (!definition) {
@@ -12,15 +12,16 @@ export async function getBundleLocation(options, context) {
12
12
  throw new Error(`Package definition (package.json) missing name at "${packagePath}"`);
13
13
  }
14
14
  const { name, version } = definition;
15
- const hashResult = await packageHashes.get({
16
- packagePath,
17
- /**
18
- * We don't use source hashing for location,
19
- * because we do not want to create a new folder for each change in a package.
20
- */
21
- isSourceHashingEnabled: false,
22
- shouldRecalculate,
23
- });
15
+ const hashResult = hash ||
16
+ (await packageHashes.get({
17
+ packagePath,
18
+ /**
19
+ * We don't use source hashing for location,
20
+ * because we do not want to create a new folder for each change in a package.
21
+ */
22
+ isSourceHashingEnabled: false,
23
+ shouldRecalculate,
24
+ }));
24
25
  // Derive where the output should be.
25
26
  const folderName = `${filenamify(name, { replacement: '^' })}-${version}-${hashResult}`;
26
27
  const outputPath = path.join(getCachePath(), folderName);
@@ -1 +1 @@
1
- {"version":3,"file":"getBundleLocation.js","sourceRoot":"","sources":["../../src/utilities/getBundleLocation.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAA6D,EAC7D,OAGC;IAED,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAC5C,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,4DAA4D,WAAW,GAAG,CAAC,CAAC;IAC9F,CAAC;IAED,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sDAAsD,WAAW,GAAG,CAAC,CAAC;IACxF,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAErC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC;QACzC,WAAW;QACX;;;WAGG;QACH,sBAAsB,EAAE,KAAK;QAC7B,iBAAiB;KAClB,CAAC,CAAC;IACH,qCAAqC;IACrC,MAAM,UAAU,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;IACxF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,UAAU,CAAC,CAAC;IAEzD,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["import filenamify from 'filenamify';\nimport path from 'path';\nimport { getCachePath } from './getCachePath.js';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\nexport async function getBundleLocation(\n options: { packagePath: string; shouldRecalculate?: boolean },\n context: {\n packages: PackageDefinitionsCache;\n packageHashes: PackageHashes;\n },\n) {\n const { packagePath, shouldRecalculate } = options;\n const { packages, packageHashes } = context;\n const definition = await packages.get(packagePath);\n\n if (!definition) {\n throw new Error(`Package definition (package.json) missing or invalid at \"${packagePath}\"`);\n }\n\n if (!definition.name) {\n throw new Error(`Package definition (package.json) missing name at \"${packagePath}\"`);\n }\n\n const { name, version } = definition;\n\n const hashResult = await packageHashes.get({\n packagePath,\n /**\n * We don't use source hashing for location,\n * because we do not want to create a new folder for each change in a package.\n */\n isSourceHashingEnabled: false,\n shouldRecalculate,\n });\n // Derive where the output should be.\n const folderName = `${filenamify(name, { replacement: '^' })}-${version}-${hashResult}`;\n const outputPath = path.join(getCachePath(), folderName);\n\n return {\n path: outputPath,\n folderName,\n };\n}\n"]}
1
+ {"version":3,"file":"getBundleLocation.js","sourceRoot":"","sources":["../../src/utilities/getBundleLocation.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAA4E,EAC5E,OAGC;IAED,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzD,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAC5C,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,4DAA4D,WAAW,GAAG,CAAC,CAAC;IAC9F,CAAC;IAED,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sDAAsD,WAAW,GAAG,CAAC,CAAC;IACxF,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAErC,MAAM,UAAU,GACd,IAAI;QACJ,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC;YACvB,WAAW;YACX;;;eAGG;YACH,sBAAsB,EAAE,KAAK;YAC7B,iBAAiB;SAClB,CAAC,CAAC,CAAC;IACN,qCAAqC;IACrC,MAAM,UAAU,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;IACxF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,UAAU,CAAC,CAAC;IAEzD,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["import filenamify from 'filenamify';\nimport path from 'path';\nimport { getCachePath } from './getCachePath.js';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\nexport async function getBundleLocation(\n options: { packagePath: string; shouldRecalculate?: boolean; hash?: string },\n context: {\n packages: PackageDefinitionsCache;\n packageHashes: PackageHashes;\n },\n) {\n const { packagePath, shouldRecalculate, hash } = options;\n const { packages, packageHashes } = context;\n const definition = await packages.get(packagePath);\n\n if (!definition) {\n throw new Error(`Package definition (package.json) missing or invalid at \"${packagePath}\"`);\n }\n\n if (!definition.name) {\n throw new Error(`Package definition (package.json) missing name at \"${packagePath}\"`);\n }\n\n const { name, version } = definition;\n\n const hashResult =\n hash ||\n (await packageHashes.get({\n packagePath,\n /**\n * We don't use source hashing for location,\n * because we do not want to create a new folder for each change in a package.\n */\n isSourceHashingEnabled: false,\n shouldRecalculate,\n }));\n // Derive where the output should be.\n const folderName = `${filenamify(name, { replacement: '^' })}-${version}-${hashResult}`;\n const outputPath = path.join(getCachePath(), folderName);\n\n return {\n path: outputPath,\n folderName,\n };\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.35.0",
3
+ "version": "0.37.0",
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.1",
31
- "@ms-cloudpack/common-types": "^0.2.0",
32
- "@ms-cloudpack/config": "^0.18.1",
33
- "@ms-cloudpack/create-express-app": "^1.6.1",
30
+ "@ms-cloudpack/bundler": "^0.19.3",
31
+ "@ms-cloudpack/common-types": "^0.2.2",
32
+ "@ms-cloudpack/config": "^0.19.1",
33
+ "@ms-cloudpack/create-express-app": "^1.6.3",
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.1",
36
+ "@ms-cloudpack/import-map": "^0.2.3",
37
37
  "@ms-cloudpack/json-utilities": "^0.1.4",
38
- "@ms-cloudpack/package-hashes": "^0.5.1",
39
- "@ms-cloudpack/package-utilities": "^7.1.1",
38
+ "@ms-cloudpack/package-hashes": "^0.5.3",
39
+ "@ms-cloudpack/package-utilities": "^7.1.3",
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.2",
43
- "@ms-cloudpack/task-reporter": "^0.11.3",
41
+ "@ms-cloudpack/path-utilities": "^2.7.0",
42
+ "@ms-cloudpack/remote-cache": "^0.6.4",
43
+ "@ms-cloudpack/task-reporter": "^0.13.0",
44
44
  "@ms-cloudpack/telemetry": "^0.5.1",
45
45
  "@trpc/client": "^10.45.0",
46
46
  "@trpc/server": "^10.45.0",