@ms-cloudpack/cli 0.40.6 → 0.42.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 (98) hide show
  1. package/lib/commands/bundle/bundle.d.ts.map +1 -1
  2. package/lib/commands/bundle/bundle.js +3 -0
  3. package/lib/commands/bundle/bundle.js.map +1 -1
  4. package/lib/commands/init/bundleAndGetImports.d.ts.map +1 -1
  5. package/lib/commands/init/bundleAndGetImports.js +2 -1
  6. package/lib/commands/init/bundleAndGetImports.js.map +1 -1
  7. package/lib/commands/init/evaluateImportsForOverrides.d.ts.map +1 -1
  8. package/lib/commands/init/evaluateImportsForOverrides.js +11 -1
  9. package/lib/commands/init/evaluateImportsForOverrides.js.map +1 -1
  10. package/lib/commands/init/init.d.ts.map +1 -1
  11. package/lib/commands/init/init.js +22 -8
  12. package/lib/commands/init/init.js.map +1 -1
  13. package/lib/commands/start/appServer/startAppServer.js +1 -1
  14. package/lib/commands/start/appServer/startAppServer.js.map +1 -1
  15. package/lib/commands/start/createBundleRequestForPackage.js +2 -2
  16. package/lib/commands/start/createBundleRequestForPackage.js.map +1 -1
  17. package/lib/commands/start/createPathToChoiceMap.d.ts +16 -0
  18. package/lib/commands/start/createPathToChoiceMap.d.ts.map +1 -0
  19. package/lib/commands/start/createPathToChoiceMap.js +35 -0
  20. package/lib/commands/start/createPathToChoiceMap.js.map +1 -0
  21. package/lib/commands/start/getAppPathFromUser.d.ts +9 -0
  22. package/lib/commands/start/getAppPathFromUser.d.ts.map +1 -0
  23. package/lib/commands/start/getAppPathFromUser.js +28 -0
  24. package/lib/commands/start/getAppPathFromUser.js.map +1 -0
  25. package/lib/commands/start/getMatchingApps.d.ts +9 -0
  26. package/lib/commands/start/getMatchingApps.d.ts.map +1 -0
  27. package/lib/commands/start/getMatchingApps.js +10 -0
  28. package/lib/commands/start/getMatchingApps.js.map +1 -0
  29. package/lib/commands/start/getStartingAppPath.d.ts +10 -0
  30. package/lib/commands/start/getStartingAppPath.d.ts.map +1 -0
  31. package/lib/commands/start/getStartingAppPath.js +29 -0
  32. package/lib/commands/start/getStartingAppPath.js.map +1 -0
  33. package/lib/commands/start/index.d.ts.map +1 -1
  34. package/lib/commands/start/index.js +1 -0
  35. package/lib/commands/start/index.js.map +1 -1
  36. package/lib/commands/start/runPrereqs.d.ts +7 -0
  37. package/lib/commands/start/runPrereqs.d.ts.map +1 -0
  38. package/lib/commands/start/runPrereqs.js +15 -0
  39. package/lib/commands/start/runPrereqs.js.map +1 -0
  40. package/lib/commands/start/setupReporting.d.ts +3 -0
  41. package/lib/commands/start/setupReporting.d.ts.map +1 -0
  42. package/lib/commands/start/setupReporting.js +25 -0
  43. package/lib/commands/start/setupReporting.js.map +1 -0
  44. package/lib/commands/start/start.d.ts +3 -1
  45. package/lib/commands/start/start.d.ts.map +1 -1
  46. package/lib/commands/start/start.js +21 -2
  47. package/lib/commands/start/start.js.map +1 -1
  48. package/lib/commands/start/types/StartOptions.d.ts +1 -0
  49. package/lib/commands/start/types/StartOptions.d.ts.map +1 -1
  50. package/lib/commands/start/types/StartOptions.js.map +1 -1
  51. package/lib/commands/sync/Task.d.ts +6 -0
  52. package/lib/commands/sync/Task.d.ts.map +1 -0
  53. package/lib/commands/sync/Task.js +2 -0
  54. package/lib/commands/sync/Task.js.map +1 -0
  55. package/lib/commands/sync/createDownloadTask.d.ts +5 -0
  56. package/lib/commands/sync/createDownloadTask.d.ts.map +1 -0
  57. package/lib/commands/sync/createDownloadTask.js +22 -0
  58. package/lib/commands/sync/createDownloadTask.js.map +1 -0
  59. package/lib/commands/sync/createUploadTask.d.ts +5 -0
  60. package/lib/commands/sync/createUploadTask.d.ts.map +1 -0
  61. package/lib/commands/sync/createUploadTask.js +18 -0
  62. package/lib/commands/sync/createUploadTask.js.map +1 -0
  63. package/lib/commands/sync/getPackagesToSync.d.ts +9 -0
  64. package/lib/commands/sync/getPackagesToSync.d.ts.map +1 -0
  65. package/lib/commands/sync/getPackagesToSync.js +24 -0
  66. package/lib/commands/sync/getPackagesToSync.js.map +1 -0
  67. package/lib/commands/sync/index.d.ts +4 -0
  68. package/lib/commands/sync/index.d.ts.map +1 -0
  69. package/lib/commands/sync/index.js +12 -0
  70. package/lib/commands/sync/index.js.map +1 -0
  71. package/lib/commands/sync/sync.d.ts +4 -0
  72. package/lib/commands/sync/sync.d.ts.map +1 -0
  73. package/lib/commands/sync/sync.js +21 -0
  74. package/lib/commands/sync/sync.js.map +1 -0
  75. package/lib/commands/sync/syncInternal.d.ts +10 -0
  76. package/lib/commands/sync/syncInternal.d.ts.map +1 -0
  77. package/lib/commands/sync/syncInternal.js +39 -0
  78. package/lib/commands/sync/syncInternal.js.map +1 -0
  79. package/lib/commands/sync/types/SyncOptions.d.ts +4 -0
  80. package/lib/commands/sync/types/SyncOptions.d.ts.map +1 -0
  81. package/lib/commands/sync/types/SyncOptions.js +2 -0
  82. package/lib/commands/sync/types/SyncOptions.js.map +1 -0
  83. package/lib/common/findCloudpackAppPaths.d.ts +7 -0
  84. package/lib/common/findCloudpackAppPaths.d.ts.map +1 -0
  85. package/lib/common/findCloudpackAppPaths.js +11 -0
  86. package/lib/common/findCloudpackAppPaths.js.map +1 -0
  87. package/lib/common/getBundleDetails.d.ts +4 -1
  88. package/lib/common/getBundleDetails.d.ts.map +1 -1
  89. package/lib/common/getBundleDetails.js +6 -2
  90. package/lib/common/getBundleDetails.js.map +1 -1
  91. package/lib/index.d.ts.map +1 -1
  92. package/lib/index.js +3 -21
  93. package/lib/index.js.map +1 -1
  94. package/lib/performance/markers.d.ts +12 -0
  95. package/lib/performance/markers.d.ts.map +1 -1
  96. package/lib/performance/markers.js +12 -0
  97. package/lib/performance/markers.js.map +1 -1
  98. package/package.json +15 -11
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runPrereqs.d.ts","sourceRoot":"","sources":["../../../src/commands/start/runPrereqs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,QAQ1E"}
@@ -0,0 +1,15 @@
1
+ import spawn from 'cross-spawn';
2
+ /**
3
+ * Runs the pre-requisites specified in the given Cloudpack config
4
+ * @param config - The Cloudpack config of containing a list of prereqs to run
5
+ */
6
+ export function runPrereqs(config, cwd) {
7
+ const dependsOn = config?.dependsOn;
8
+ if (dependsOn) {
9
+ for (const [command, args] of dependsOn) {
10
+ spawn.sync(command, args, { stdio: 'inherit', cwd });
11
+ }
12
+ }
13
+ }
14
+ // cspell:ignore Prereqs
15
+ //# sourceMappingURL=runPrereqs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runPrereqs.js","sourceRoot":"","sources":["../../../src/commands/start/runPrereqs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,MAAmC,EAAE,GAAW;IACzE,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,CAAC;IAEpC,IAAI,SAAS,EAAE;QACb,KAAK,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS,EAAE;YACvC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;SACtD;KACF;AACH,CAAC;AAED,wBAAwB","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/config';\nimport spawn from 'cross-spawn';\n\n/**\n * Runs the pre-requisites specified in the given Cloudpack config\n * @param config - The Cloudpack config of containing a list of prereqs to run\n */\nexport function runPrereqs(config: CloudpackConfig | undefined, cwd: string) {\n const dependsOn = config?.dependsOn;\n\n if (dependsOn) {\n for (const [command, args] of dependsOn) {\n spawn.sync(command, args, { stdio: 'inherit', cwd });\n }\n }\n}\n\n// cspell:ignore Prereqs\n"]}
@@ -0,0 +1,3 @@
1
+ import type { TaskContext } from '../../types/TaskContext.js';
2
+ export declare function setupReporting({ reporter, config }: Pick<TaskContext, 'reporter' | 'config'>): Promise<void>;
3
+ //# sourceMappingURL=setupReporting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupReporting.d.ts","sourceRoot":"","sources":["../../../src/commands/start/setupReporting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAgB9D,wBAAsB,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,QAAQ,CAAC,iBAmBlG"}
@@ -0,0 +1,25 @@
1
+ import { getVersion } from '@ms-cloudpack/package-utilities';
2
+ import { initTelemetry } from '../../initTelemetry.js';
3
+ import { bold, defaultLoggingConfig, verboseLoggingConfig, debugLoggingConfig, } from '@ms-cloudpack/task-reporter';
4
+ const { argv } = process;
5
+ const useDebugLogging = argv.includes('--debug') || argv.includes('-d');
6
+ const verb = argv[2];
7
+ const useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';
8
+ const version = getVersion(import.meta.url);
9
+ export async function setupReporting({ reporter, config }) {
10
+ reporter.setOptions({
11
+ productName: 'Cloudpack',
12
+ version,
13
+ description: () => `Running "${bold(argv.slice(2).join(' '))}"`,
14
+ helpMessage: config.helpMessage,
15
+ ...defaultLoggingConfig,
16
+ ...(useVerboseLogging && verboseLoggingConfig),
17
+ ...(useDebugLogging && debugLoggingConfig),
18
+ });
19
+ await initTelemetry({
20
+ useDebugLogging,
21
+ useVerboseLogging,
22
+ telemetryConfig: config.telemetry,
23
+ }, reporter);
24
+ }
25
+ //# sourceMappingURL=setupReporting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../../../src/commands/start/setupReporting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM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\nimport { initTelemetry } from '../../initTelemetry.js';\nimport {\n bold,\n defaultLoggingConfig,\n verboseLoggingConfig,\n type TaskReporterOptions,\n debugLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\n\nconst { argv } = process;\nconst useDebugLogging = argv.includes('--debug') || argv.includes('-d');\nconst verb = argv[2];\nconst useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting({ reporter, config }: Pick<TaskContext, 'reporter' | 'config'>) {\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n ...defaultLoggingConfig,\n ...(useVerboseLogging && verboseLoggingConfig),\n ...(useDebugLogging && debugLoggingConfig),\n } as TaskReporterOptions);\n\n await initTelemetry(\n {\n useDebugLogging,\n useVerboseLogging,\n telemetryConfig: config.telemetry,\n },\n reporter,\n );\n}\n"]}
@@ -1,7 +1,9 @@
1
1
  import type { StartOptions } from './types/StartOptions.js';
2
2
  import type { TaskContext } from '../../types/TaskContext.js';
3
+ /** Stop all started cloudpack instances, for testing */
4
+ export declare function stopServers(): Promise<void>;
3
5
  /**
4
6
  * Defines the "start" verb entry point.
5
7
  */
6
- export declare function start(options: StartOptions, { reporter, appPath, config }: TaskContext): Promise<void>;
8
+ export declare function start(options: StartOptions, { reporter, appPath: initialCwd }: TaskContext): Promise<void>;
7
9
  //# sourceMappingURL=start.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAU5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAqB9D;;GAEG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,iBAyH5F"}
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAU5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAO9D,wDAAwD;AACxD,wBAAsB,WAAW,kBAKhC;AAqBD;;GAEG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,WAAW,iBAsIhG"}
@@ -3,13 +3,24 @@ import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';
3
3
  import path from 'path';
4
4
  import { createSession } from './createSession.js';
5
5
  import { openBrowser } from './openBrowser.js';
6
- import { createPackageDefinitions } from '@ms-cloudpack/config';
6
+ import { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';
7
7
  import { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';
8
8
  import { setSharedTelemetryAttribute, stopTelemetry, rootSpan } from '../../initTelemetry.js';
9
9
  import { createBundleRequestForPackage } from './createBundleRequestForPackage.js';
10
10
  import { createBundleTask } from './createBundleTask.js';
11
11
  import { mergeFeatures } from './mergeFeatures.js';
12
12
  import { yellow } from '@ms-cloudpack/task-reporter';
13
+ import { getStartingAppPath } from './getStartingAppPath.js';
14
+ import { runPrereqs } from './runPrereqs.js';
15
+ import { setupReporting } from './setupReporting.js';
16
+ let cleanupFunctions = [];
17
+ /** Stop all started cloudpack instances, for testing */
18
+ export async function stopServers() {
19
+ for (const func of cleanupFunctions) {
20
+ await func();
21
+ }
22
+ cleanupFunctions = [];
23
+ }
13
24
  async function createAppBundleTask(options, context) {
14
25
  const { packageName } = options;
15
26
  const { session } = context;
@@ -26,7 +37,13 @@ async function createAppBundleTask(options, context) {
26
37
  /**
27
38
  * Defines the "start" verb entry point.
28
39
  */
29
- export async function start(options, { reporter, appPath, config }) {
40
+ export async function start(options, { reporter, appPath: initialCwd }) {
41
+ const appPath = await getStartingAppPath(initialCwd, options.app);
42
+ const config = await readConfig(appPath);
43
+ await setupReporting({ reporter, config });
44
+ console.log('App path:', yellow(appPath));
45
+ process.chdir(appPath);
46
+ runPrereqs(config, appPath);
30
47
  try {
31
48
  // Merge in any additional features from the command line.
32
49
  config.features = mergeFeatures({
@@ -100,6 +117,7 @@ export async function start(options, { reporter, appPath, config }) {
100
117
  // Flush and close telemetry.
101
118
  await stopTelemetry();
102
119
  };
120
+ cleanupFunctions.push(cleanup);
103
121
  // Setup cleanup and close things on completion.
104
122
  let sigintCount = 0;
105
123
  process.on('SIGINT', () => {
@@ -128,4 +146,5 @@ export async function start(options, { reporter, appPath, config }) {
128
146
  process.exit(1);
129
147
  }
130
148
  }
149
+ // cspell:ignore Prereqs
131
150
  //# sourceMappingURL=start.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,M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AC,cAAc,CAAC,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;YAED,6FAA6F;YAC7F,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,oBAAoB;QACpB,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC;QAE1B,WAAW,CAAC,OAAO,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;QACpE,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YAC7B,sEAAsE;YACtE,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC","sourcesContent":["import { writeJson } from '@ms-cloudpack/json-utilities';\nimport { findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport path from 'path';\nimport { createSession } from './createSession.js';\nimport { openBrowser } from './openBrowser.js';\nimport type { Session } from '@ms-cloudpack/api-server';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { createPackageDefinitions } from '@ms-cloudpack/config';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';\nimport { setSharedTelemetryAttribute, stopTelemetry, rootSpan } from '../../initTelemetry.js';\nimport { createBundleRequestForPackage } from './createBundleRequestForPackage.js';\nimport { createBundleTask } from './createBundleTask.js';\nimport { mergeFeatures } from './mergeFeatures.js';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { TaskContext } from '../../types/TaskContext.js';\n\nasync function createAppBundleTask(\n options: { packageName: string },\n context: { session: Session; config: CloudpackConfig; packages: PackageDefinitionsCache },\n) {\n const { packageName } = options;\n const { session } = context;\n const packageEntry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${packageName} in the resolve map.`);\n }\n const bundleRequest = await createBundleRequestForPackage({ packageEntry }, context);\n\n return createBundleTask(bundleRequest);\n}\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport async function start(options: StartOptions, { reporter, appPath, config }: TaskContext) {\n try {\n // Merge in any additional features from the command line.\n config.features = mergeFeatures({\n configFeatures: config.features,\n commandLineFeatures: options.features,\n });\n\n const enabledFeatureNames = Object.entries(config.features)\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n if (enabledFeatureNames.length) {\n console.log(`Enabled features: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n // Initialize package overrides.\n const packages = createPackageDefinitions({ config });\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // Initialize session definition.\n const session = await createSession({ appPath, config }, { reporter, packages });\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n setSharedTelemetryAttribute('sessionId', session.id);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n const apiServer = await startApiServer({\n session,\n rootSpan,\n reporter,\n packages,\n });\n\n // Kick off bundling app package as soon as api server is ready.\n void apiServer.addTask(await createAppBundleTask({ packageName: definition.name }, { session, config, packages }));\n\n // Then start bundle and app servers for hosting the app.\n const { startBundleServer } = await import('./startBundleServer.js');\n const bundleServer = await startBundleServer({ apiServer, session, reporter, packages });\n\n // Finally start the app server.\n const { startAppServer } = await import('./appServer/startAppServer.js');\n const appServer = await startAppServer({\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n reporter,\n packages,\n });\n\n const cleanup = async () => {\n for (const [name, server] of [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ]) {\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server.close();\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }\n\n // Complete the reporting and list pending tasks as aborted.\n reporter.complete();\n\n // Flush and close telemetry.\n await stopTelemetry();\n };\n\n // Setup cleanup and close things on completion.\n let sigintCount = 0;\n\n process.on('SIGINT', () => {\n sigintCount++;\n if (sigintCount > 1) {\n console.debug('Forcing exit');\n process.exit(1);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises -- handler can't be async\n cleanup().finally(() => {\n process.exit(0);\n });\n });\n\n // Open the browser.\n const url = appServer.url;\n\n performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n openBrowser(url).catch((err) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n console.warn('Error opening browser:', err?.stack || err);\n console.warn('Please open the browser manually to:', url);\n });\n } catch (err) {\n console.error(err);\n reporter.complete();\n process.exit(1);\n }\n}\n"]}
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MA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AK,CAAC,cAAc,CAAC,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;YAED,6FAA6F;YAC7F,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;gBACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,oBAAoB;QACpB,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC;QAE1B,WAAW,CAAC,OAAO,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;QACpE,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YAC7B,sEAAsE;YACtE,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AAED,wBAAwB","sourcesContent":["import { writeJson } from '@ms-cloudpack/json-utilities';\nimport { findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport path from 'path';\nimport { createSession } from './createSession.js';\nimport { openBrowser } from './openBrowser.js';\nimport type { Session } from '@ms-cloudpack/api-server';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';\nimport { setSharedTelemetryAttribute, stopTelemetry, rootSpan } from '../../initTelemetry.js';\nimport { createBundleRequestForPackage } from './createBundleRequestForPackage.js';\nimport { createBundleTask } from './createBundleTask.js';\nimport { mergeFeatures } from './mergeFeatures.js';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport { getStartingAppPath } from './getStartingAppPath.js';\nimport { runPrereqs } from './runPrereqs.js';\nimport { setupReporting } from './setupReporting.js';\n\nlet cleanupFunctions: Array<() => Promise<void>> = [];\n\n/** Stop all started cloudpack instances, for testing */\nexport async function stopServers() {\n for (const func of cleanupFunctions) {\n await func();\n }\n cleanupFunctions = [];\n}\n\nasync function createAppBundleTask(\n options: { packageName: string },\n context: { session: Session; config: CloudpackConfig; packages: PackageDefinitionsCache },\n) {\n const { packageName } = options;\n const { session } = context;\n const packageEntry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${packageName} in the resolve map.`);\n }\n const bundleRequest = await createBundleRequestForPackage({ packageEntry }, context);\n\n return createBundleTask(bundleRequest);\n}\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport async function start(options: StartOptions, { reporter, appPath: initialCwd }: TaskContext) {\n const appPath = await getStartingAppPath(initialCwd, options.app);\n const config = await readConfig(appPath);\n\n await setupReporting({ reporter, config });\n\n console.log('App path:', yellow(appPath));\n\n process.chdir(appPath);\n\n runPrereqs(config, appPath);\n\n try {\n // Merge in any additional features from the command line.\n config.features = mergeFeatures({\n configFeatures: config.features,\n commandLineFeatures: options.features,\n });\n\n const enabledFeatureNames = Object.entries(config.features)\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n if (enabledFeatureNames.length) {\n console.log(`Enabled features: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n // Initialize package overrides.\n const packages = createPackageDefinitions({ config });\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // Initialize session definition.\n const session = await createSession({ appPath, config }, { reporter, packages });\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n setSharedTelemetryAttribute('sessionId', session.id);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n const apiServer = await startApiServer({\n session,\n rootSpan,\n reporter,\n packages,\n });\n\n // Kick off bundling app package as soon as api server is ready.\n void apiServer.addTask(await createAppBundleTask({ packageName: definition.name }, { session, config, packages }));\n\n // Then start bundle and app servers for hosting the app.\n const { startBundleServer } = await import('./startBundleServer.js');\n const bundleServer = await startBundleServer({ apiServer, session, reporter, packages });\n\n // Finally start the app server.\n const { startAppServer } = await import('./appServer/startAppServer.js');\n const appServer = await startAppServer({\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n reporter,\n packages,\n });\n\n const cleanup = async () => {\n for (const [name, server] of [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ]) {\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server.close();\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }\n\n // Complete the reporting and list pending tasks as aborted.\n reporter.complete();\n\n // Flush and close telemetry.\n await stopTelemetry();\n };\n\n cleanupFunctions.push(cleanup);\n\n // Setup cleanup and close things on completion.\n let sigintCount = 0;\n\n process.on('SIGINT', () => {\n sigintCount++;\n if (sigintCount > 1) {\n console.debug('Forcing exit');\n process.exit(1);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises -- handler can't be async\n cleanup().finally(() => {\n process.exit(0);\n });\n });\n\n // Open the browser.\n const url = appServer.url;\n\n performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n openBrowser(url).catch((err) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n console.warn('Error opening browser:', err?.stack || err);\n console.warn('Please open the browser manually to:', url);\n });\n } catch (err) {\n console.error(err);\n reporter.complete();\n process.exit(1);\n }\n}\n\n// cspell:ignore Prereqs\n"]}
@@ -2,5 +2,6 @@ export interface StartOptions {
2
2
  logResolveMap?: boolean;
3
3
  sourcemap?: boolean;
4
4
  features?: string[];
5
+ app?: string;
5
6
  }
6
7
  //# sourceMappingURL=StartOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StartOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB"}
1
+ {"version":3,"file":"StartOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"StartOptions.js","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface StartOptions {\n logResolveMap?: boolean;\n sourcemap?: boolean;\n features?: string[];\n}\n"]}
1
+ {"version":3,"file":"StartOptions.js","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface StartOptions {\n logResolveMap?: boolean;\n sourcemap?: boolean;\n features?: string[];\n app?: string;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { TaskReporterTaskResult } from '@ms-cloudpack/task-reporter';
2
+ export interface Task {
3
+ name: string;
4
+ execute: () => Promise<TaskReporterTaskResult>;
5
+ }
6
+ //# sourceMappingURL=Task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/Task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAChD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/commands/sync/Task.ts"],"names":[],"mappings":"","sourcesContent":["import type { TaskReporterTaskResult } from '@ms-cloudpack/task-reporter';\n\nexport interface Task {\n name: string;\n execute: () => Promise<TaskReporterTaskResult>;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';
2
+ import { type PackageToSync } from './getPackagesToSync.js';
3
+ import type { Task } from './Task.js';
4
+ export declare function createDownloadTask(client: RemoteCacheClient, { folderName, packageName, path, version }: PackageToSync): Task;
5
+ //# sourceMappingURL=createDownloadTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDownloadTask.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/createDownloadTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa,GACxD,IAAI,CAmBN"}
@@ -0,0 +1,22 @@
1
+ import {} from './getPackagesToSync.js';
2
+ import { existsSync } from 'fs';
3
+ import { bulletedList } from '@ms-cloudpack/task-reporter';
4
+ export function createDownloadTask(client, { folderName, packageName, path, version }) {
5
+ return {
6
+ name: `Downloading ${packageName}@${version}`,
7
+ execute: async () => {
8
+ if (existsSync(path)) {
9
+ return { status: 'skip', message: 'Package is already exist in the local cache.' };
10
+ }
11
+ const result = await client.downloadFolder(folderName, path);
12
+ if (!result) {
13
+ return { status: 'skip', message: `not found in the remote cache.` };
14
+ }
15
+ return {
16
+ status: 'complete',
17
+ details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),
18
+ };
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=createDownloadTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDownloadTask.js","sourceRoot":"","sources":["../../../src/commands/sync/createDownloadTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,UAAU,kBAAkB,CAChC,MAAyB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAiB;IAEzD,OAAO;QACL,IAAI,EAAE,eAAe,WAAW,IAAI,OAAO,EAAE;QAC7C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;gBACpB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,8CAA8C,EAAE,CAAC;aACpF;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC7D,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gCAAgC,EAAE,CAAC;aACtE;YAED,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,YAAY,CAAC,CAAC,eAAe,UAAU,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;aAC7F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';\nimport { type PackageToSync } from './getPackagesToSync.js';\nimport type { Task } from './Task.js';\nimport { existsSync } from 'fs';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\n\nexport function createDownloadTask(\n client: RemoteCacheClient,\n { folderName, packageName, path, version }: PackageToSync,\n): Task {\n return {\n name: `Downloading ${packageName}@${version}`,\n execute: async () => {\n if (existsSync(path)) {\n return { status: 'skip', message: 'Package is already exist in the local cache.' };\n }\n\n const result = await client.downloadFolder(folderName, path);\n if (!result) {\n return { status: 'skip', message: `not found in the remote cache.` };\n }\n\n return {\n status: 'complete',\n details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),\n };\n },\n };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';
2
+ import type { PackageToSync } from './getPackagesToSync.js';
3
+ import type { Task } from './Task.js';
4
+ export declare function createUploadTask(client: RemoteCacheClient, { folderName, packageName, path, version }: PackageToSync): Task;
5
+ //# sourceMappingURL=createUploadTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUploadTask.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/createUploadTask.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,iBAAiB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa,GACxD,IAAI,CAeN"}
@@ -0,0 +1,18 @@
1
+ import { existsSync } from 'fs';
2
+ import { bulletedList } from '@ms-cloudpack/task-reporter';
3
+ export function createUploadTask(client, { folderName, packageName, path, version }) {
4
+ return {
5
+ name: `Uploading ${packageName}@${version}`,
6
+ execute: async () => {
7
+ if (!existsSync(path)) {
8
+ return { status: 'skip', message: `Not found in the local cache.` };
9
+ }
10
+ await client.uploadFolder(folderName, path);
11
+ return {
12
+ status: 'complete',
13
+ details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),
14
+ };
15
+ },
16
+ };
17
+ }
18
+ //# sourceMappingURL=createUploadTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUploadTask.js","sourceRoot":"","sources":["../../../src/commands/sync/createUploadTask.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,UAAU,gBAAgB,CAC9B,MAAyB,EACzB,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAiB;IAEzD,OAAO;QACL,IAAI,EAAE,aAAa,WAAW,IAAI,OAAO,EAAE;QAC3C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACrB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC;aACrE;YAED,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC5C,OAAO;gBACL,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,YAAY,CAAC,CAAC,eAAe,UAAU,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;aAC7F,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';\nimport type { PackageToSync } from './getPackagesToSync.js';\nimport type { Task } from './Task.js';\nimport { existsSync } from 'fs';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\n\nexport function createUploadTask(\n client: RemoteCacheClient,\n { folderName, packageName, path, version }: PackageToSync,\n): Task {\n return {\n name: `Uploading ${packageName}@${version}`,\n execute: async () => {\n if (!existsSync(path)) {\n return { status: 'skip', message: `Not found in the local cache.` };\n }\n\n await client.uploadFolder(folderName, path);\n return {\n status: 'complete',\n details: bulletedList([`FolderName: ${folderName}`, `Path: ${path}`, `Version: ${version}`]),\n };\n },\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { TaskReporter } from '@ms-cloudpack/task-reporter';
2
+ export interface PackageToSync {
3
+ path: string;
4
+ folderName: string;
5
+ packageName: string;
6
+ version: string;
7
+ }
8
+ export declare function getPackagesToSync(appPath: string, reporter: TaskReporter): Promise<PackageToSync[]>;
9
+ //# sourceMappingURL=getPackagesToSync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPackagesToSync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/getPackagesToSync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAyBzG"}
@@ -0,0 +1,24 @@
1
+ import { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';
2
+ import { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';
3
+ import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';
4
+ import { getBundleDetails } from '../../common/getBundleDetails.js';
5
+ export async function getPackagesToSync(appPath, reporter) {
6
+ const list = [];
7
+ const config = await readConfig(appPath);
8
+ const packages = createPackageDefinitions({ config });
9
+ const resolveMap = await resolveDependenciesTask({ appPath }, { packages, reporter });
10
+ const packageEntries = Object.keys(resolveMap)
11
+ .map((packageName) => findResolveMapEntry({
12
+ packageName,
13
+ resolveMap,
14
+ }))
15
+ .filter((item) => item);
16
+ for (const { path: packagePath, name, version } of packageEntries) {
17
+ const details = await getBundleDetails({ packagePath }, { packages });
18
+ if (details.isExternal) {
19
+ list.push({ ...details.outputLocation, packageName: name, version });
20
+ }
21
+ }
22
+ return list;
23
+ }
24
+ //# sourceMappingURL=getPackagesToSync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPackagesToSync.js","sourceRoot":"","sources":["../../../src/commands/sync/getPackagesToSync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAwB,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAUpE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAe,EAAE,QAAsB;IAC7E,MAAM,IAAI,GAAoB,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtD,MAAM,UAAU,GAAG,MAAM,uBAAuB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEtF,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;SAC3C,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACnB,mBAAmB,CAAC;QAClB,WAAW;QACX,UAAU;KACX,CAAC,CACH;SACA,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAsB,CAAC;IAE/C,KAAK,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,cAAc,EAAE;QACjE,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtE,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;SACtE;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { createPackageDefinitions, readConfig } from '@ms-cloudpack/config';\nimport { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';\nimport { findResolveMapEntry, type ResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { getBundleDetails } from '../../common/getBundleDetails.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport interface PackageToSync {\n path: string;\n folderName: string;\n packageName: string;\n version: string;\n}\n\nexport async function getPackagesToSync(appPath: string, reporter: TaskReporter): Promise<PackageToSync[]> {\n const list: PackageToSync[] = [];\n\n const config = await readConfig(appPath);\n const packages = createPackageDefinitions({ config });\n\n const resolveMap = await resolveDependenciesTask({ appPath }, { packages, reporter });\n\n const packageEntries = Object.keys(resolveMap)\n .map((packageName) =>\n findResolveMapEntry({\n packageName,\n resolveMap,\n }),\n )\n .filter((item) => item) as ResolveMapEntry[];\n\n for (const { path: packagePath, name, version } of packageEntries) {\n const details = await getBundleDetails({ packagePath }, { packages });\n if (details.isExternal) {\n list.push({ ...details.outputLocation, packageName: name, version });\n }\n }\n\n return list;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { CommandFunction } from '../../types/CommandFunction.js';
2
+ /** Defines the "sync" verb. */
3
+ export declare const init: CommandFunction;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtE,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,eAWlB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** Defines the "sync" verb. */
2
+ export const init = (command, context) => {
3
+ command
4
+ .command('sync')
5
+ .description('Syncs the packages from/to the remote cache. If the package is not in the local cache, it will be downloaded.')
6
+ .option('--upload', 'Uploads the packages to the remote cache.')
7
+ .action(async (options) => {
8
+ const { sync } = await import('./sync.js');
9
+ await sync(options, context);
10
+ });
11
+ };
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAGA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IACxD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,+GAA+G,CAChH;SACA,MAAM,CAAC,UAAU,EAAE,2CAA2C,CAAC;SAC/D,MAAM,CAAC,KAAK,EAAE,OAAoB,EAAE,EAAE;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3C,MAAM,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\nimport type { SyncOptions } from './types/SyncOptions.js';\n\n/** Defines the \"sync\" verb. */\nexport const init: CommandFunction = (command, context) => {\n command\n .command('sync')\n .description(\n 'Syncs the packages from/to the remote cache. If the package is not in the local cache, it will be downloaded.',\n )\n .option('--upload', 'Uploads the packages to the remote cache.')\n .action(async (options: SyncOptions) => {\n const { sync } = await import('./sync.js');\n await sync(options, context);\n });\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import type { TaskContext } from '../../types/TaskContext.js';
2
+ import type { SyncOptions } from './types/SyncOptions.js';
3
+ export declare function sync(options: SyncOptions, context: TaskContext): Promise<void>;
4
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,iBAcpE"}
@@ -0,0 +1,21 @@
1
+ import { red } from '@ms-cloudpack/task-reporter';
2
+ import { stopTelemetry } from '../../initTelemetry.js';
3
+ import { syncInternal } from './syncInternal.js';
4
+ export async function sync(options, context) {
5
+ let hasErrors = false;
6
+ let message = '';
7
+ try {
8
+ await syncInternal(options, context);
9
+ hasErrors = context.reporter.hasErrors();
10
+ }
11
+ catch (error) {
12
+ message = error instanceof Error ? error.message : '<Unknown error>';
13
+ hasErrors = true;
14
+ }
15
+ finally {
16
+ context.reporter.complete(hasErrors ? red(message) : message);
17
+ await stopTelemetry();
18
+ process.exit(hasErrors ? 1 : 0);
19
+ }
20
+ }
21
+ //# sourceMappingURL=sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAoB,EAAE,OAAoB;IACnE,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,OAAO,GAAW,EAAE,CAAC;IACzB,IAAI;QACF,MAAM,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;KAC1C;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACrE,SAAS,GAAG,IAAI,CAAC;KAClB;YAAS;QACR,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC9D,MAAM,aAAa,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACjC;AACH,CAAC","sourcesContent":["import { red } from '@ms-cloudpack/task-reporter';\nimport { stopTelemetry } from '../../initTelemetry.js';\nimport { syncInternal } from './syncInternal.js';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport type { SyncOptions } from './types/SyncOptions.js';\n\nexport async function sync(options: SyncOptions, context: TaskContext) {\n let hasErrors = false;\n let message: string = '';\n try {\n await syncInternal(options, context);\n hasErrors = context.reporter.hasErrors();\n } catch (error) {\n message = error instanceof Error ? error.message : '<Unknown error>';\n hasErrors = true;\n } finally {\n context.reporter.complete(hasErrors ? red(message) : message);\n await stopTelemetry();\n process.exit(hasErrors ? 1 : 0);\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { TaskContext } from '../../types/TaskContext.js';
2
+ import type { SyncOptions } from './types/SyncOptions.js';
3
+ /**
4
+ * Syncs the packages to the remote cache.
5
+ * @param syncOptions - The options for the sync command.
6
+ * @param context - The task context.
7
+ * @returns The number of packages synced.
8
+ */
9
+ export declare function syncInternal({ upload: isUpload }: SyncOptions, context: TaskContext): Promise<void>;
10
+ //# sourceMappingURL=syncInternal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncInternal.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/syncInternal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAW9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCzG"}
@@ -0,0 +1,39 @@
1
+ import { getPackagesToSync } from './getPackagesToSync.js';
2
+ import { createUploadTask } from './createUploadTask.js';
3
+ import { createDownloadTask } from './createDownloadTask.js';
4
+ import { PerfMarkerSyncStart, PerfMeasurementSyncDownload, PerfMeasurementSyncUpload, } from '../../performance/markers.js';
5
+ import { readConfig } from '@ms-cloudpack/config';
6
+ import { RemoteCacheClient, getAuthenticatedConnectionString } from '@ms-cloudpack/remote-cache';
7
+ /**
8
+ * Syncs the packages to the remote cache.
9
+ * @param syncOptions - The options for the sync command.
10
+ * @param context - The task context.
11
+ * @returns The number of packages synced.
12
+ */
13
+ export async function syncInternal({ upload: isUpload }, context) {
14
+ const { appPath, reporter } = context;
15
+ const config = await readConfig(appPath);
16
+ if (!config.remoteCache) {
17
+ console.warn('Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file.');
18
+ return;
19
+ }
20
+ const { container, storageAccount } = config.remoteCache;
21
+ const connectionString = await getAuthenticatedConnectionString({
22
+ storageAccount,
23
+ container,
24
+ permissions: { read: !isUpload, write: isUpload },
25
+ });
26
+ const client = new RemoteCacheClient({
27
+ container,
28
+ connectionString,
29
+ });
30
+ const list = await getPackagesToSync(appPath, reporter);
31
+ performance.mark(PerfMarkerSyncStart);
32
+ const uploads = list.map((item) => {
33
+ const { name, execute } = isUpload ? createUploadTask(client, item) : createDownloadTask(client, item);
34
+ return reporter.runTask(name, execute);
35
+ });
36
+ await Promise.all(uploads);
37
+ performance.measure(isUpload ? PerfMeasurementSyncUpload : PerfMeasurementSyncDownload, PerfMarkerSyncStart);
38
+ }
39
+ //# sourceMappingURL=syncInternal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncInternal.js","sourceRoot":"","sources":["../../../src/commands/sync/syncInternal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAGjG;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAe,EAAE,OAAoB;IACxF,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEtC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;QACvB,OAAO,CAAC,IAAI,CAAC,4FAA4F,CAAC,CAAC;QAC3G,OAAO;KACR;IAED,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC;IACzD,MAAM,gBAAgB,GAAG,MAAM,gCAAgC,CAAC;QAC9D,cAAc;QACd,SAAS;QACT,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;KAClD,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC;QACnC,SAAS;QACT,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAExD,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAEtC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAChC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvG,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE3B,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,2BAA2B,EAAE,mBAAmB,CAAC,CAAC;AAC/G,CAAC","sourcesContent":["import type { TaskContext } from '../../types/TaskContext.js';\nimport { getPackagesToSync } from './getPackagesToSync.js';\nimport { createUploadTask } from './createUploadTask.js';\nimport { createDownloadTask } from './createDownloadTask.js';\nimport {\n PerfMarkerSyncStart,\n PerfMeasurementSyncDownload,\n PerfMeasurementSyncUpload,\n} from '../../performance/markers.js';\nimport { readConfig } from '@ms-cloudpack/config';\nimport { RemoteCacheClient, getAuthenticatedConnectionString } from '@ms-cloudpack/remote-cache';\nimport type { SyncOptions } from './types/SyncOptions.js';\n\n/**\n * Syncs the packages to the remote cache.\n * @param syncOptions - The options for the sync command.\n * @param context - The task context.\n * @returns The number of packages synced.\n */\nexport async function syncInternal({ upload: isUpload }: SyncOptions, context: TaskContext): Promise<void> {\n const { appPath, reporter } = context;\n\n const config = await readConfig(appPath);\n if (!config.remoteCache) {\n console.warn('Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file.');\n return;\n }\n\n const { container, storageAccount } = config.remoteCache;\n const connectionString = await getAuthenticatedConnectionString({\n storageAccount,\n container,\n permissions: { read: !isUpload, write: isUpload },\n });\n\n const client = new RemoteCacheClient({\n container,\n connectionString,\n });\n\n const list = await getPackagesToSync(appPath, reporter);\n\n performance.mark(PerfMarkerSyncStart);\n\n const uploads = list.map((item) => {\n const { name, execute } = isUpload ? createUploadTask(client, item) : createDownloadTask(client, item);\n return reporter.runTask(name, execute);\n });\n\n await Promise.all(uploads);\n\n performance.measure(isUpload ? PerfMeasurementSyncUpload : PerfMeasurementSyncDownload, PerfMarkerSyncStart);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export interface SyncOptions {
2
+ upload: boolean;
3
+ }
4
+ //# sourceMappingURL=SyncOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/sync/types/SyncOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SyncOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncOptions.js","sourceRoot":"","sources":["../../../../src/commands/sync/types/SyncOptions.ts"],"names":[],"mappings":"","sourcesContent":["export interface SyncOptions {\n upload: boolean;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ *
3
+ * @param startingPath The path to start searching from when finding Cloudpack apps
4
+ * @returns An array of app paths corresponding to all discovered Cloudpack apps
5
+ */
6
+ export declare function findCloudpackAppPaths(startingPath: string): string[];
7
+ //# sourceMappingURL=findCloudpackAppPaths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findCloudpackAppPaths.d.ts","sourceRoot":"","sources":["../../src/common/findCloudpackAppPaths.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,YAIzD"}
@@ -0,0 +1,11 @@
1
+ import glob from 'glob-hasher';
2
+ import path from 'path';
3
+ /**
4
+ *
5
+ * @param startingPath The path to start searching from when finding Cloudpack apps
6
+ * @returns An array of app paths corresponding to all discovered Cloudpack apps
7
+ */
8
+ export function findCloudpackAppPaths(startingPath) {
9
+ return (glob.glob(['**/cloudpack.config.json', '!**/node_modules'], { cwd: startingPath }) ?? []).map((file) => path.dirname(file));
10
+ }
11
+ //# sourceMappingURL=findCloudpackAppPaths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findCloudpackAppPaths.js","sourceRoot":"","sources":["../../src/common/findCloudpackAppPaths.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAoB;IACxD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAC7G,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CACnB,CAAC;AACJ,CAAC","sourcesContent":["import glob from 'glob-hasher';\nimport path from 'path';\n\n/**\n *\n * @param startingPath The path to start searching from when finding Cloudpack apps\n * @returns An array of app paths corresponding to all discovered Cloudpack apps\n */\nexport function findCloudpackAppPaths(startingPath: string) {\n return (glob.glob(['**/cloudpack.config.json', '!**/node_modules'], { cwd: startingPath }) ?? []).map((file) =>\n path.dirname(file),\n );\n}\n"]}
@@ -6,6 +6,9 @@ export declare function getBundleDetails(options: {
6
6
  }): Promise<{
7
7
  bundleId: string;
8
8
  isExternal: boolean;
9
- outputPath: string;
9
+ outputLocation: {
10
+ path: string;
11
+ folderName: string;
12
+ };
10
13
  }>;
11
14
  //# sourceMappingURL=getBundleDetails.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getBundleDetails.d.ts","sourceRoot":"","sources":["../../src/common/getBundleDetails.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,wBAAsB,gBAAgB,CACpC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,EAChC,OAAO,EAAE;IAAE,QAAQ,EAAE,uBAAuB,CAAA;CAAE;;;;GA+B/C"}
1
+ {"version":3,"file":"getBundleDetails.d.ts","sourceRoot":"","sources":["../../src/common/getBundleDetails.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,wBAAsB,gBAAgB,CACpC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,EAChC,OAAO,EAAE;IAAE,QAAQ,EAAE,uBAAuB,CAAA;CAAE;;;;;;;GAmC/C"}
@@ -21,11 +21,15 @@ export async function getBundleDetails(options, context) {
21
21
  version: (isExternal ? version : packagePath) || packagePath,
22
22
  });
23
23
  // Derive where the output should be.
24
- const outputPath = path.join(getCachePath(), `${filenamify(packageName)}-${version}-${bundleId}`);
24
+ const folderName = `${filenamify(packageName)}-${version}-${bundleId}`;
25
+ const outputPath = path.join(getCachePath(), folderName);
25
26
  return {
26
27
  bundleId,
27
28
  isExternal,
28
- outputPath,
29
+ outputLocation: {
30
+ path: outputPath,
31
+ folderName,
32
+ },
29
33
  };
30
34
  }
31
35
  //# sourceMappingURL=getBundleDetails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getBundleDetails.js","sourceRoot":"","sources":["../../src/common/getBundleDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgC,EAChC,OAA8C;IAE9C,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC7B,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,4DAA4D,WAAW,GAAG,CAAC,CAAC;KAC7F;IAED,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAElD,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,WAAW,GAAG,CAAC,CAAC;KACvF;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC;QACpB,IAAI,EAAE,WAAW;QACjB,GAAG,UAAU;QACb,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,WAAW;KAC7D,CAAC,CAAC;IAEH,qCAAqC;IACrC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC,CAAC;IAElG,OAAO;QACL,QAAQ;QACR,UAAU;QACV,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["import { isExternalPackage } from '@ms-cloudpack/package-utilities';\nimport hash from 'object-hash';\nimport filenamify from 'filenamify';\nimport path from 'path';\nimport { getCachePath } from '@ms-cloudpack/api-server';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\n\nexport async function getBundleDetails(\n options: { packagePath: string },\n context: { packages: PackageDefinitionsCache },\n) {\n const { packagePath } = options;\n const { packages } = 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 const { name: packageName, version } = definition;\n\n if (!packageName) {\n throw new Error(`Package definition (package.json) missing name at \"${packagePath}\"`);\n }\n\n const isExternal = isExternalPackage(packagePath);\n const bundleId = hash({\n name: packageName,\n ...definition,\n version: (isExternal ? version : packagePath) || packagePath,\n });\n\n // Derive where the output should be.\n const outputPath = path.join(getCachePath(), `${filenamify(packageName)}-${version}-${bundleId}`);\n\n return {\n bundleId,\n isExternal,\n outputPath,\n };\n}\n"]}
1
+ {"version":3,"file":"getBundleDetails.js","sourceRoot":"","sources":["../../src/common/getBundleDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgC,EAChC,OAA8C;IAE9C,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC7B,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,4DAA4D,WAAW,GAAG,CAAC,CAAC;KAC7F;IAED,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAElD,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,WAAW,GAAG,CAAC,CAAC;KACvF;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC;QACpB,IAAI,EAAE,WAAW;QACjB,GAAG,UAAU;QACb,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,WAAW;KAC7D,CAAC,CAAC;IAEH,qCAAqC;IACrC,MAAM,UAAU,GAAG,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;IACvE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,UAAU,CAAC,CAAC;IAEzD,OAAO;QACL,QAAQ;QACR,UAAU;QACV,cAAc,EAAE;YACd,IAAI,EAAE,UAAU;YAChB,UAAU;SACX;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { isExternalPackage } from '@ms-cloudpack/package-utilities';\nimport hash from 'object-hash';\nimport filenamify from 'filenamify';\nimport path from 'path';\nimport { getCachePath } from '@ms-cloudpack/api-server';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\n\nexport async function getBundleDetails(\n options: { packagePath: string },\n context: { packages: PackageDefinitionsCache },\n) {\n const { packagePath } = options;\n const { packages } = 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 const { name: packageName, version } = definition;\n\n if (!packageName) {\n throw new Error(`Package definition (package.json) missing name at \"${packagePath}\"`);\n }\n\n const isExternal = isExternalPackage(packagePath);\n const bundleId = hash({\n name: packageName,\n ...definition,\n version: (isExternal ? version : packagePath) || packagePath,\n });\n\n // Derive where the output should be.\n const folderName = `${filenamify(packageName)}-${version}-${bundleId}`;\n const outputPath = path.join(getCachePath(), folderName);\n\n return {\n bundleId,\n isExternal,\n outputLocation: {\n path: outputPath,\n folderName,\n },\n };\n}\n"]}