@ms-cloudpack/cli 0.49.17 → 0.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/lib/commands/init/evaluateImportsForOverrides.d.ts +3 -3
  2. package/lib/commands/init/evaluateImportsForOverrides.d.ts.map +1 -1
  3. package/lib/commands/init/evaluateImportsForOverrides.js +4 -4
  4. package/lib/commands/init/evaluateImportsForOverrides.js.map +1 -1
  5. package/lib/commands/init/evaluatePath.d.ts +2 -2
  6. package/lib/commands/init/evaluatePath.d.ts.map +1 -1
  7. package/lib/commands/init/evaluatePath.js +2 -2
  8. package/lib/commands/init/evaluatePath.js.map +1 -1
  9. package/lib/commands/init/init.d.ts +1 -1
  10. package/lib/commands/init/init.d.ts.map +1 -1
  11. package/lib/commands/init/init.js +6 -7
  12. package/lib/commands/init/init.js.map +1 -1
  13. package/lib/commands/start/appServer/createRoutes.d.ts +2 -2
  14. package/lib/commands/start/appServer/createRoutes.d.ts.map +1 -1
  15. package/lib/commands/start/appServer/createRoutes.js +1 -1
  16. package/lib/commands/start/appServer/createRoutes.js.map +1 -1
  17. package/lib/commands/start/appServer/startAppServer.d.ts +2 -2
  18. package/lib/commands/start/appServer/startAppServer.d.ts.map +1 -1
  19. package/lib/commands/start/appServer/startAppServer.js.map +1 -1
  20. package/lib/commands/start/mergeFeatures.d.ts +1 -1
  21. package/lib/commands/start/mergeFeatures.d.ts.map +1 -1
  22. package/lib/commands/start/mergeFeatures.js +1 -1
  23. package/lib/commands/start/mergeFeatures.js.map +1 -1
  24. package/lib/common/createInitializeFunction.d.ts +1 -1
  25. package/lib/common/findPackageOverride.d.ts +1 -1
  26. package/lib/common/findPackageOverride.d.ts.map +1 -1
  27. package/lib/common/findPackageOverride.js.map +1 -1
  28. package/lib/common/runPrerequisites.d.ts +1 -1
  29. package/lib/common/runPrerequisites.d.ts.map +1 -1
  30. package/lib/common/runPrerequisites.js.map +1 -1
  31. package/lib/initTelemetry.d.ts +1 -1
  32. package/lib/initTelemetry.d.ts.map +1 -1
  33. package/lib/initTelemetry.js +1 -1
  34. package/lib/initTelemetry.js.map +1 -1
  35. package/lib/setupReporting.d.ts +1 -1
  36. package/lib/setupReporting.d.ts.map +1 -1
  37. package/lib/setupReporting.js.map +1 -1
  38. package/lib/types/CommandAction.d.ts +1 -1
  39. package/lib/types/CommandAction.d.ts.map +1 -1
  40. package/lib/types/CommandAction.js.map +1 -1
  41. package/lib/types/CommandContext.d.ts +2 -1
  42. package/lib/types/CommandContext.d.ts.map +1 -1
  43. package/lib/types/CommandContext.js.map +1 -1
  44. package/package.json +8 -7
@@ -1,6 +1,6 @@
1
1
  import type { DetectedImports } from '@ms-cloudpack/api-server';
2
- import type { PackageDefinitionsCache, PackageJson } from '@ms-cloudpack/bundler-types';
3
- import type { GeneratedConfig } from '@ms-cloudpack/config';
2
+ import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
3
+ import type { CloudpackConfig, PackageJson } from '@ms-cloudpack/config-types';
4
4
  import type { ResolveMap } from '@ms-cloudpack/package-utilities';
5
5
  import type { GeneratedPackageChanges } from './types/GeneratedPackageChanges.js';
6
6
  /**
@@ -12,7 +12,7 @@ export declare function evaluateImportsForOverrides(options: {
12
12
  imports: DetectedImports;
13
13
  definition: PackageJson;
14
14
  packagePath: string;
15
- generatedConfig: GeneratedConfig;
15
+ config: CloudpackConfig;
16
16
  resolveMap: ResolveMap;
17
17
  }): Promise<{
18
18
  changes: GeneratedPackageChanges[];
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateImportsForOverrides.d.ts","sourceRoot":"","sources":["../../../src/commands/init/evaluateImportsForOverrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,sBAAsB,CAAC;AAE7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAQlE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAElF;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE;IACzD,QAAQ,EAAE,uBAAuB,CAAC;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;CACxB,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,uBAAuB,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC,CAmGD"}
1
+ {"version":3,"file":"evaluateImportsForOverrides.d.ts","sourceRoot":"","sources":["../../../src/commands/init/evaluateImportsForOverrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAmB,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEhG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAQlE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAElF;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE;IACzD,QAAQ,EAAE,uBAAuB,CAAC;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,WAAW,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,UAAU,CAAC;CACxB,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,uBAAuB,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC,CAmGD"}
@@ -6,7 +6,7 @@ import { bulletedList, cyan } from '@ms-cloudpack/task-reporter';
6
6
  * If so, updates package overrides to the given packageOverrides array.
7
7
  */
8
8
  export async function evaluateImportsForOverrides(options) {
9
- const { packages, imports, definition, packagePath, generatedConfig, resolveMap } = options;
9
+ const { packages, imports, definition, packagePath, config, resolveMap } = options;
10
10
  const displayName = `${definition.name}@${definition.version}`;
11
11
  const changes = [];
12
12
  const errors = [];
@@ -29,9 +29,9 @@ export async function evaluateImportsForOverrides(options) {
29
29
  // Make sure to add the package to the list of packages to evaluate.
30
30
  pathsToEvaluate.add(dependencyPath);
31
31
  // Get the flattened bundle-able exports map for this dependency and iterate through our import paths to ensure nothing is missing.
32
- const exports = await getExportsMap({ packagePath: dependencyPath }, { packages });
32
+ const exports = await getExportsMap({ packagePath: dependencyPath }, { packages, config });
33
33
  const flattenedExports = flattenExportsMap(exports);
34
- const packageSettings = (generatedConfig.packageSettings ??= []);
34
+ const packageSettings = (config.generated.packageSettings ??= []);
35
35
  let generatedPackageSettings;
36
36
  for (const dependencyImportPath of dependencyImportPaths) {
37
37
  if (flattenedExports[dependencyImportPath]) {
@@ -56,7 +56,7 @@ export async function evaluateImportsForOverrides(options) {
56
56
  exports: generatedPackageSettings.exports,
57
57
  packagePath: dependencyPath,
58
58
  importPath: dependencyImportPath,
59
- }, { packages });
59
+ }, { packages, config });
60
60
  if (addedEntry) {
61
61
  changes.push({
62
62
  name: dependencyName,
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateImportsForOverrides.js","sourceRoot":"","sources":["../../../src/commands/init/evaluateImportsForOverrides.ts"],"names":[],"mappings":"AAGA,OAAO,EAA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,EACD,EAAE,QAAQ,EAAE,CACb,CAAC;YAEF,IAAI,UAAU,EAAE;gBACd,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE,oBAAoB,CAAC,OAAO,IAAI,EAAE;oBAC3C,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,cAAc;4BACpB,MAAM,EAAE,oBAAoB;4BAC5B,MAAM,EAAE,gBAAgB,WAAW,GAAG;yBACvC;qBACF;iBACF,CAAC,CAAC;gBAEH,4FAA4F;gBAC5F,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;aACpC;iBAAM;gBACL,MAAM,YAAY,GAAG,aAAa,IAAI,CACpC,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAClD,0FAA0F,IAAI,CAC7F,cAAc,CACf,6DAA6D,YAAY,CACxE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,cAAc,EAAE,CAAC,EACtF,CAAC,CACF,EAAE,CAAC;gBACJ,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aAC3B;SACF;KACF;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["import type { DetectedImports } from '@ms-cloudpack/api-server';\nimport type { PackageDefinitionsCache, PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { GeneratedConfig, PackageSettings } from '@ms-cloudpack/config';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n flattenExportsMap,\n getExportsMap,\n} from '@ms-cloudpack/package-utilities';\nimport { bulletedList, cyan } from '@ms-cloudpack/task-reporter';\nimport type { GeneratedPackageChanges } from './types/GeneratedPackageChanges.js';\n\n/**\n * Evaluate the imports depended on by a package to determine if missing exports map paths need to be added.\n * If so, updates package overrides to the given packageOverrides array.\n */\nexport async function evaluateImportsForOverrides(options: {\n packages: PackageDefinitionsCache;\n imports: DetectedImports;\n definition: PackageJson;\n packagePath: string;\n generatedConfig: GeneratedConfig;\n resolveMap: ResolveMap;\n}): Promise<{\n changes: GeneratedPackageChanges[];\n errors: string[];\n pathsToEvaluate: Set<string>;\n pathsToRefresh: Set<string>;\n}> {\n const { packages, imports, definition, packagePath, generatedConfig, resolveMap } = options;\n const displayName = `${definition.name}@${definition.version}`;\n const changes: GeneratedPackageChanges[] = [];\n const errors: string[] = [];\n const pathsToEvaluate = new Set<string>();\n const pathsToRefresh = new Set<string>();\n\n // Iterate through imports and find their path from the resolve map.\n for (const [dependencyName, dependencyImportPaths] of Object.entries(imports)) {\n const resolveEntry = findResolveMapEntry({ definition, packageName: dependencyName, resolveMap });\n const dependencyPath = resolveEntry?.path;\n const dependencyDefinition = dependencyPath ? await packages.get(dependencyPath) : undefined;\n\n if (!dependencyPath || !dependencyDefinition) {\n errors.push(\n `Package \"${displayName}\" imports from the package \"${dependencyName}\" but it couldn't be found. ` +\n `Ensure that \"${dependencyName}\" is listed in dependencies of \"${displayName}\".`,\n );\n continue;\n }\n\n const { name, version } = dependencyDefinition as Required<PackageJson>;\n if (!name || !version) {\n throw new Error(`Package \"${displayName}\" depends on \"${dependencyName}\" but it is missing a name or version.`);\n }\n\n // Make sure to add the package to the list of packages to evaluate.\n pathsToEvaluate.add(dependencyPath);\n\n // Get the flattened bundle-able exports map for this dependency and iterate through our import paths to ensure nothing is missing.\n const exports = await getExportsMap({ packagePath: dependencyPath }, { packages });\n const flattenedExports = flattenExportsMap(exports);\n const packageSettings = (generatedConfig.packageSettings ??= []);\n let generatedPackageSettings: PackageSettings | undefined;\n\n for (const dependencyImportPath of dependencyImportPaths) {\n if (flattenedExports[dependencyImportPath]) {\n continue;\n }\n\n // We are missing an import path. We need to add this entry to the exports map in package settings.\n generatedPackageSettings ??= getPackageSettings({\n config: { generated: { packageSettings } },\n name,\n version,\n firstMatch: true,\n }).generatedPackageSettings;\n\n if (!generatedPackageSettings) {\n generatedPackageSettings = {\n match: { name, version: `^${version}` },\n exports: {},\n };\n packageSettings.push(generatedPackageSettings);\n }\n\n generatedPackageSettings.exports ??= {};\n\n const addedEntry = await addExportsMapEntry(\n {\n exports: generatedPackageSettings.exports,\n packagePath: dependencyPath,\n importPath: dependencyImportPath,\n },\n { packages },\n );\n\n if (addedEntry) {\n changes.push({\n name: dependencyName,\n version: dependencyDefinition.version || '',\n path: dependencyPath,\n changes: [\n {\n type: 'added-export',\n change: dependencyImportPath,\n reason: `Imported by \"${displayName}\"`,\n },\n ],\n });\n\n // Since we've found a missing exports, we need to re-enqueue the dependency for evaluation.\n pathsToRefresh.add(dependencyPath);\n } else {\n const errorMessage = `Imported \"${cyan(\n dependencyImportPath.replace('.', dependencyName),\n )}\" but a corresponding file couldn't be found. Either correct the import or adjust the \"${cyan(\n dependencyName,\n )}\" package version to one that supports this import path.\\n${bulletedList(\n [`${cyan(displayName)}: ${packagePath}`, `${cyan(dependencyName)}: ${dependencyPath}`],\n 2,\n )}`;\n errors.push(errorMessage);\n }\n }\n }\n\n return { changes, errors, pathsToEvaluate, pathsToRefresh };\n}\n"]}
1
+ {"version":3,"file":"evaluateImportsForOverrides.js","sourceRoot":"","sources":["../../../src/commands/init/evaluateImportsForOverrides.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGjE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,OAOjD;IAMC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,U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oB;4BAC5B,MAAM,EAAE,gBAAgB,WAAW,GAAG;yBACvC;qBACF;iBACF,CAAC,CAAC;gBAEH,4FAA4F;gBAC5F,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;aACpC;iBAAM;gBACL,MAAM,YAAY,GAAG,aAAa,IAAI,CACpC,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAClD,0FAA0F,IAAI,CAC7F,cAAc,CACf,6DAA6D,YAAY,CACxE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,cAAc,EAAE,CAAC,EACtF,CAAC,CACF,EAAE,CAAC;gBACJ,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aAC3B;SACF;KACF;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["import type { DetectedImports } from '@ms-cloudpack/api-server';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { PackageSettings, CloudpackConfig, PackageJson } from '@ms-cloudpack/config-types';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n flattenExportsMap,\n getExportsMap,\n} from '@ms-cloudpack/package-utilities';\nimport { bulletedList, cyan } from '@ms-cloudpack/task-reporter';\nimport type { GeneratedPackageChanges } from './types/GeneratedPackageChanges.js';\n\n/**\n * Evaluate the imports depended on by a package to determine if missing exports map paths need to be added.\n * If so, updates package overrides to the given packageOverrides array.\n */\nexport async function evaluateImportsForOverrides(options: {\n packages: PackageDefinitionsCache;\n imports: DetectedImports;\n definition: PackageJson;\n packagePath: string;\n config: CloudpackConfig;\n resolveMap: ResolveMap;\n}): Promise<{\n changes: GeneratedPackageChanges[];\n errors: string[];\n pathsToEvaluate: Set<string>;\n pathsToRefresh: Set<string>;\n}> {\n const { packages, imports, definition, packagePath, config, resolveMap } = options;\n const displayName = `${definition.name}@${definition.version}`;\n const changes: GeneratedPackageChanges[] = [];\n const errors: string[] = [];\n const pathsToEvaluate = new Set<string>();\n const pathsToRefresh = new Set<string>();\n\n // Iterate through imports and find their path from the resolve map.\n for (const [dependencyName, dependencyImportPaths] of Object.entries(imports)) {\n const resolveEntry = findResolveMapEntry({ definition, packageName: dependencyName, resolveMap });\n const dependencyPath = resolveEntry?.path;\n const dependencyDefinition = dependencyPath ? await packages.get(dependencyPath) : undefined;\n\n if (!dependencyPath || !dependencyDefinition) {\n errors.push(\n `Package \"${displayName}\" imports from the package \"${dependencyName}\" but it couldn't be found. ` +\n `Ensure that \"${dependencyName}\" is listed in dependencies of \"${displayName}\".`,\n );\n continue;\n }\n\n const { name, version } = dependencyDefinition as Required<PackageJson>;\n if (!name || !version) {\n throw new Error(`Package \"${displayName}\" depends on \"${dependencyName}\" but it is missing a name or version.`);\n }\n\n // Make sure to add the package to the list of packages to evaluate.\n pathsToEvaluate.add(dependencyPath);\n\n // Get the flattened bundle-able exports map for this dependency and iterate through our import paths to ensure nothing is missing.\n const exports = await getExportsMap({ packagePath: dependencyPath }, { packages, config });\n const flattenedExports = flattenExportsMap(exports);\n const packageSettings = (config.generated.packageSettings ??= []);\n let generatedPackageSettings: PackageSettings | undefined;\n\n for (const dependencyImportPath of dependencyImportPaths) {\n if (flattenedExports[dependencyImportPath]) {\n continue;\n }\n\n // We are missing an import path. We need to add this entry to the exports map in package settings.\n generatedPackageSettings ??= getPackageSettings({\n config: { generated: { packageSettings } },\n name,\n version,\n firstMatch: true,\n }).generatedPackageSettings;\n\n if (!generatedPackageSettings) {\n generatedPackageSettings = {\n match: { name, version: `^${version}` },\n exports: {},\n };\n packageSettings.push(generatedPackageSettings);\n }\n\n generatedPackageSettings.exports ??= {};\n\n const addedEntry = await addExportsMapEntry(\n {\n exports: generatedPackageSettings.exports,\n packagePath: dependencyPath,\n importPath: dependencyImportPath,\n },\n { packages, config },\n );\n\n if (addedEntry) {\n changes.push({\n name: dependencyName,\n version: dependencyDefinition.version || '',\n path: dependencyPath,\n changes: [\n {\n type: 'added-export',\n change: dependencyImportPath,\n reason: `Imported by \"${displayName}\"`,\n },\n ],\n });\n\n // Since we've found a missing exports, we need to re-enqueue the dependency for evaluation.\n pathsToRefresh.add(dependencyPath);\n } else {\n const errorMessage = `Imported \"${cyan(\n dependencyImportPath.replace('.', dependencyName),\n )}\" but a corresponding file couldn't be found. Either correct the import or adjust the \"${cyan(\n dependencyName,\n )}\" package version to one that supports this import path.\\n${bulletedList(\n [`${cyan(displayName)}: ${packagePath}`, `${cyan(dependencyName)}: ${dependencyPath}`],\n 2,\n )}`;\n errors.push(errorMessage);\n }\n }\n }\n\n return { changes, errors, pathsToEvaluate, pathsToRefresh };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { EnsurePackageBundledContext } from '@ms-cloudpack/api-server/apis';
2
- import type { GeneratedConfig } from '@ms-cloudpack/config';
2
+ import type { CloudpackConfig } from '@ms-cloudpack/config-types';
3
3
  import type { ResolveMap } from '@ms-cloudpack/package-utilities';
4
4
  import type { TelemetryClient } from '@ms-cloudpack/telemetry';
5
5
  import type { InitSummaryData } from './InitSummaryData.js';
@@ -11,7 +11,7 @@ import type { InitOptions } from './types/InitOptions.js';
11
11
  */
12
12
  export declare function evaluatePath(options: {
13
13
  packagePath: string;
14
- generatedConfig: GeneratedConfig;
14
+ config: CloudpackConfig;
15
15
  resolveMap: ResolveMap;
16
16
  telemetryClient: TelemetryClient;
17
17
  initOptions: InitOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"evaluatePath.d.ts","sourceRoot":"","sources":["../../../src/commands/init/evaluatePath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,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B,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;IACjC,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,eAAe,CAAC;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,2BAA2B,CAAC;CAClC,GAAG,OAAO,CAAC;IAAE,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAqEjG"}
@@ -6,7 +6,7 @@ import { evaluateImportsForOverrides } from './evaluateImportsForOverrides.js';
6
6
  * in the generated config.
7
7
  */
8
8
  export async function evaluatePath(options) {
9
- const { packagePath, generatedConfig, initOptions, telemetryClient, resolveMap, summaryData, shouldForce, ctx } = options;
9
+ const { packagePath, config, initOptions, telemetryClient, resolveMap, summaryData, shouldForce, ctx } = options;
10
10
  const { packages } = ctx;
11
11
  const definition = await packages.get(packagePath, { refresh: true });
12
12
  const { name, version } = definition || {};
@@ -37,7 +37,7 @@ export async function evaluatePath(options) {
37
37
  return {};
38
38
  }
39
39
  // Given the package imports, find the missing exports maps and update packageOverrides.
40
- const { changes, errors: evalErrors, pathsToEvaluate, pathsToRefresh, } = await evaluateImportsForOverrides({ definition, packagePath, packages, imports, generatedConfig, resolveMap });
40
+ const { changes, errors: evalErrors, pathsToEvaluate, pathsToRefresh, } = await evaluateImportsForOverrides({ definition, packagePath, packages, imports, config, resolveMap });
41
41
  if (evalErrors.length) {
42
42
  summaryData.recordResult({
43
43
  ...resultIdentifier,
@@ -1 +1 @@
1
- {"version":3,"file":"evaluatePath.js","sourceRoot":"","sources":["../../../src/commands/init/evaluatePath.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MA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;IACxF,MAAM,EACJ,OAAO,EACP,MAAM,EAAE,UAAU,EAClB,eAAe,EACf,cAAc,GACf,GAAG,MAAM,2BAA2B,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC,CAAC;IAEnH,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,WAAW,CAAC,YAAY,CAAC;YACvB,GAAG,gBAAgB;YACnB,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;SAC7C,CAAC,CAAC;KACJ;SAAM;QACL,WAAW,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;KAC7C;IAED,IAAI,WAAW,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;QAC9D,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,EAAE;YACrD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,UAAU;SACpE,CAAC,CAAC;QAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,OAAO;QACL,eAAe;QACf,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["import type { EnsurePackageBundledContext } from '@ms-cloudpack/api-server/apis';\nimport type { GeneratedConfig } from '@ms-cloudpack/config';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { InitSummaryData } from './InitSummaryData.js';\nimport type { InitOptions } from './types/InitOptions.js';\n\nimport { ensurePackageBundled } from '@ms-cloudpack/api-server/apis';\nimport { evaluateImportsForOverrides } from './evaluateImportsForOverrides.js';\n\n/**\n * A helper which given the packagePath, tries to evaluate the path by bundling things, finding imports,\n * and cross checking the imports with explicit exports. If any exports are missing, they are documented\n * in the generated config.\n */\nexport async function evaluatePath(options: {\n packagePath: string;\n generatedConfig: GeneratedConfig;\n resolveMap: ResolveMap;\n telemetryClient: TelemetryClient;\n initOptions: InitOptions;\n summaryData: InitSummaryData;\n shouldForce: boolean;\n ctx: EnsurePackageBundledContext;\n}): Promise<{ pathsToEvaluate?: Set<string>; pathsToRefresh?: Set<string>; shouldExit?: boolean }> {\n const { packagePath, generatedConfig, initOptions, telemetryClient, resolveMap, summaryData, shouldForce, ctx } =\n options;\n const { packages } = ctx;\n const definition = await packages.get(packagePath, { refresh: true });\n const { name, version } = definition || {};\n\n if (!definition || !name || !version) {\n // Unsure why a package would be missing a definition/name/version - we've built the resolve map already.\n throw new Error(\n `${packagePath} evaluation failed because the package.json with a name/version was not found or not readable.`,\n );\n }\n\n // Bundle the package and find the imports it depends on.\n const { result } = await ensurePackageBundled({\n input: {\n name,\n version,\n shouldFindImports: true,\n shouldForce,\n },\n ctx,\n });\n\n const { errors, warnings, imports } = result;\n\n // Record the results for the summary.\n const resultIdentifier = {\n name: definition.name || '',\n version: definition.version || '',\n path: packagePath,\n };\n\n summaryData.recordResult({ ...resultIdentifier, errors, warnings });\n\n // If there were errors or no imports, return early.\n if (errors?.length || !imports) {\n return {};\n }\n\n // Given the package imports, find the missing exports maps and update packageOverrides.\n const {\n changes,\n errors: evalErrors,\n pathsToEvaluate,\n pathsToRefresh,\n } = await evaluateImportsForOverrides({ definition, packagePath, packages, imports, generatedConfig, resolveMap });\n\n if (evalErrors.length) {\n summaryData.recordResult({\n ...resultIdentifier,\n errors: evalErrors.map((text) => ({ text })),\n });\n } else {\n summaryData.recordGeneratedChanges(changes);\n }\n\n if (initOptions.check && (changes.length || evalErrors.length)) {\n telemetryClient.rootSpan.addEvent('INIT_CHECK_FAILED', {\n reason: changes.length ? 'Config needs to be updated.' : evalErrors,\n });\n\n return { shouldExit: true };\n }\n\n return {\n pathsToEvaluate,\n pathsToRefresh,\n };\n}\n"]}
1
+ {"version":3,"file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EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEpE,oDAAoD;IACpD,IAAI,MAAM,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE;QAC9B,OAAO,EAAE,CAAC;KACX;IAED,wFAAwF;IACxF,MAAM,EACJ,OAAO,EACP,MAAM,EAAE,UAAU,EAClB,eAAe,EACf,cAAc,GACf,GAAG,MAAM,2BAA2B,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAE1G,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,WAAW,CAAC,YAAY,CAAC;YACvB,GAAG,gBAAgB;YACnB,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;SAC7C,CAAC,CAAC;KACJ;SAAM;QACL,WAAW,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;KAC7C;IAED,IAAI,WAAW,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;QAC9D,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,EAAE;YACrD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,UAAU;SACpE,CAAC,CAAC;QAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;KAC7B;IAED,OAAO;QACL,eAAe;QACf,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["import type { EnsurePackageBundledContext } from '@ms-cloudpack/api-server/apis';\nimport type { CloudpackConfig } from '@ms-cloudpack/config-types';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { InitSummaryData } from './InitSummaryData.js';\nimport type { InitOptions } from './types/InitOptions.js';\n\nimport { ensurePackageBundled } from '@ms-cloudpack/api-server/apis';\nimport { evaluateImportsForOverrides } from './evaluateImportsForOverrides.js';\n\n/**\n * A helper which given the packagePath, tries to evaluate the path by bundling things, finding imports,\n * and cross checking the imports with explicit exports. If any exports are missing, they are documented\n * in the generated config.\n */\nexport async function evaluatePath(options: {\n packagePath: string;\n config: CloudpackConfig;\n resolveMap: ResolveMap;\n telemetryClient: TelemetryClient;\n initOptions: InitOptions;\n summaryData: InitSummaryData;\n shouldForce: boolean;\n ctx: EnsurePackageBundledContext;\n}): Promise<{ pathsToEvaluate?: Set<string>; pathsToRefresh?: Set<string>; shouldExit?: boolean }> {\n const { packagePath, config, initOptions, telemetryClient, resolveMap, summaryData, shouldForce, ctx } = options;\n const { packages } = ctx;\n const definition = await packages.get(packagePath, { refresh: true });\n const { name, version } = definition || {};\n\n if (!definition || !name || !version) {\n // Unsure why a package would be missing a definition/name/version - we've built the resolve map already.\n throw new Error(\n `${packagePath} evaluation failed because the package.json with a name/version was not found or not readable.`,\n );\n }\n\n // Bundle the package and find the imports it depends on.\n const { result } = await ensurePackageBundled({\n input: {\n name,\n version,\n shouldFindImports: true,\n shouldForce,\n },\n ctx,\n });\n\n const { errors, warnings, imports } = result;\n\n // Record the results for the summary.\n const resultIdentifier = {\n name: definition.name || '',\n version: definition.version || '',\n path: packagePath,\n };\n\n summaryData.recordResult({ ...resultIdentifier, errors, warnings });\n\n // If there were errors or no imports, return early.\n if (errors?.length || !imports) {\n return {};\n }\n\n // Given the package imports, find the missing exports maps and update packageOverrides.\n const {\n changes,\n errors: evalErrors,\n pathsToEvaluate,\n pathsToRefresh,\n } = await evaluateImportsForOverrides({ definition, packagePath, packages, imports, config, resolveMap });\n\n if (evalErrors.length) {\n summaryData.recordResult({\n ...resultIdentifier,\n errors: evalErrors.map((text) => ({ text })),\n });\n } else {\n summaryData.recordGeneratedChanges(changes);\n }\n\n if (initOptions.check && (changes.length || evalErrors.length)) {\n telemetryClient.rootSpan.addEvent('INIT_CHECK_FAILED', {\n reason: changes.length ? 'Config needs to be updated.' : evalErrors,\n });\n\n return { shouldExit: true };\n }\n\n return {\n pathsToEvaluate,\n pathsToRefresh,\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { CloudpackConfig } from '@ms-cloudpack/config';
1
+ import type { CloudpackConfig } from '@ms-cloudpack/config-types';
2
2
  import type { TaskReporter } from '@ms-cloudpack/task-reporter';
3
3
  import type { TelemetryClient } from '@ms-cloudpack/telemetry';
4
4
  import type { AutoDispose } from '../../types/AutoDispose.js';
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,sBAAsB,CAAC;AAE7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQ1D;;GAEG;AACH,wBAAsB,IAAI,CAAC,UAAU,EAAE;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;CAClC,GAAG,OAAO,CAAC,WAAW,CAAC,CAwGvB"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAA6C,MAAM,4BAA4B,CAAC;AAE7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQ1D;;GAEG;AACH,wBAAsB,IAAI,CAAC,UAAU,EAAE;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;CAClC,GAAG,OAAO,CAAC,WAAW,CAAC,CAuGvB"}
@@ -25,9 +25,8 @@ export async function init(parameters) {
25
25
  });
26
26
  autoDispose(ctx);
27
27
  const resolveMap = ctx.session.resolveMap;
28
- // Ensure generatedConfig.packageSettings is initialized.
29
- const generatedConfig = config.generated;
30
- generatedConfig.packageSettings ??= [];
28
+ // Ensure config.generated.packageSettings is initialized.
29
+ config.generated.packageSettings ??= [];
31
30
  const summaryData = new InitSummaryData();
32
31
  await new Promise((resolve, reject) => {
33
32
  let pending = 0;
@@ -52,7 +51,7 @@ export async function init(parameters) {
52
51
  // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.
53
52
  evaluatePath({
54
53
  packagePath: path,
55
- generatedConfig,
54
+ config,
56
55
  telemetryClient,
57
56
  resolveMap,
58
57
  shouldForce,
@@ -87,9 +86,9 @@ export async function init(parameters) {
87
86
  }
88
87
  });
89
88
  const summary = summaryData.summarize();
90
- if (!options.check && summary.totalChanges && generatedConfig.packageSettings?.length) {
91
- sortExportKeys(generatedConfig);
92
- await writeGeneratedConfig(generatedConfig, appPath);
89
+ if (!options.check && summary.totalChanges && config.generated.packageSettings?.length) {
90
+ sortExportKeys(config.generated);
91
+ await writeGeneratedConfig(config.generated, appPath);
93
92
  }
94
93
  return summary;
95
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,UAO1B;IACC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,UAAU,CAAC;IAExF,4CAA4C;IAC5C,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE;QAClC,MAAM,KAAK,CAAC,0CAA0C,CAAC,CAAC;KACzD;IAED,uDAAuD;IACvD,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;KACvB;IAED,MAAM,GAAG,GAAY,MAAM,uBAAuB,CAAC;QACjD,OAAO;QACP,MAAM;QACN,QAAQ;QACR,eAAe;QACf,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,EAAE,eAAe,CAAC;KACtG,CAAC,CAAC;IACH,WAAW,CAAC,GAAG,CAAC,CAAC;IACjB,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC;IAE1C,yDAAyD;IACzD,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC;IACzC,eAAe,CAAC,eAAe,KAAK,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G,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAErE,QAAQ,CAAC,GAAG,CACV,WAAW,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,MAAM,EACrF,YAAY,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAC7F,CAAC;IAEF,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,eAAe,GAAG,EAAE,EAAmB;IAC/D,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE;QACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACrB,SAAS;SACV;QAED,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAmC,CAAC;QAErE,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;aACzB,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CACvC,CAAC;KACH;AACH,CAAC","sourcesContent":["import type { Context } from '@ms-cloudpack/api-server';\nimport type { PackageJsonExportsObject } from '@ms-cloudpack/bundler-types';\nimport type { CloudpackConfig, GeneratedConfig } from '@ms-cloudpack/config';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { AutoDispose } from '../../types/AutoDispose.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { InitSummary } from './types/InitSummary.js';\n\nimport { createPartialApiContext } from '@ms-cloudpack/api-server/apis';\nimport { writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { bold, bulletedList, formatPackageName, plural } from '@ms-cloudpack/task-reporter';\nimport { InitSummaryData } from './InitSummaryData.js';\nimport { evaluatePath } from './evaluatePath.js';\n\n/**\n * Init execution function.\n */\nexport async function init(parameters: {\n options: InitOptions;\n appPath: string;\n config: CloudpackConfig;\n autoDispose: AutoDispose;\n reporter: TaskReporter;\n telemetryClient: TelemetryClient;\n}): Promise<InitSummary> {\n const { options, appPath, config, reporter, autoDispose, telemetryClient } = parameters;\n\n // Don't allow --check and --reset together.\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n // If --reset is specified, reset the generated config.\n if (options.reset) {\n config.generated = {};\n }\n\n const ctx: Context = await createPartialApiContext({\n appPath,\n config,\n reporter,\n telemetryClient,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session', 'packageImportPaths', 'packageHashes'],\n });\n autoDispose(ctx);\n const resolveMap = ctx.session.resolveMap;\n\n // Ensure generatedConfig.packageSettings is initialized.\n const generatedConfig = config.generated;\n generatedConfig.packageSettings ??= [];\n\n const summaryData = new InitSummaryData();\n\n await new Promise<void>((resolve, reject) => {\n let pending = 0;\n let isExitingPrematurely = false;\n const visitedSet = new Set<string>();\n const refreshPaths = new Set<string>();\n\n // Start with the app path or requested matches\n enqueuePaths(getInitialPaths({ appPath, match: options.match, resolveMap, reporter }));\n\n // Create a function to enqueue more paths.\n function enqueuePaths(newPaths: string[]) {\n if (isExitingPrematurely) {\n return;\n }\n\n // Iterate through the given paths.\n for (const path of newPaths) {\n if (visitedSet.has(path)) {\n continue;\n }\n\n const shouldForce = refreshPaths.delete(path);\n\n visitedSet.add(path);\n pending++;\n\n // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.\n evaluatePath({\n packagePath: path,\n generatedConfig,\n telemetryClient,\n resolveMap,\n shouldForce,\n initOptions: options,\n summaryData,\n ctx,\n })\n .then(({ pathsToEvaluate, pathsToRefresh, shouldExit }) => {\n pending--;\n\n if (shouldExit) {\n isExitingPrematurely = true;\n } else if (pathsToEvaluate?.size && !options.match) {\n // If there are paths that need to be rebuilt, add them to the refresh set so that on re-enqueuing\n // we pass the `shouldRerun` flag through\n pathsToRefresh?.forEach((refreshPath) => {\n refreshPaths.add(refreshPath);\n visitedSet.delete(refreshPath);\n });\n\n // Try to enqueue the new paths.\n enqueuePaths(Array.from(pathsToEvaluate));\n }\n\n // If nothing is pending after this call, we're complete.\n if (!pending) {\n resolve();\n }\n })\n .catch((error) => {\n reject(error);\n });\n }\n }\n });\n\n const summary = summaryData.summarize();\n\n if (!options.check && summary.totalChanges && generatedConfig.packageSettings?.length) {\n sortExportKeys(generatedConfig);\n\n await writeGeneratedConfig(generatedConfig, appPath);\n }\n\n return summary;\n}\n\n/**\n * Get initial package paths to process: either the app path, or packages matching `match` in the init options.\n */\nfunction getInitialPaths(params: {\n appPath: string;\n match: string | undefined;\n resolveMap: ResolveMap;\n reporter: TaskReporter;\n}): string[] {\n const { appPath, match, resolveMap, reporter } = params;\n\n if (!match) {\n return [appPath];\n }\n\n // Find package in resolve-map\n const matchNames = Object.keys(resolveMap).filter((k) => k.includes(match));\n const resolveMapEntries = matchNames.map((name) => resolveMap[name]);\n\n reporter.log(\n `\\nFound ${plural(resolveMapEntries.length, 'package')} matching \"${bold(match)}\":\\n`,\n bulletedList(resolveMapEntries.map((entry) => `${formatPackageName(entry)}: ${entry.path}`)),\n );\n\n return resolveMapEntries.map((entry) => entry.path);\n}\n\nfunction sortExportKeys({ packageSettings = [] }: GeneratedConfig) {\n for (const settings of packageSettings) {\n if (!settings.exports) {\n continue;\n }\n\n const unsortedExports = settings.exports as PackageJsonExportsObject;\n\n settings.exports = Object.fromEntries(\n Object.keys(unsortedExports)\n .sort()\n .map((k) => [k, unsortedExports[k]]),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"init.js","sourceRoot":"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AG,CACV,WAAW,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,MAAM,EACrF,YAAY,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAC7F,CAAC;IAEF,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,eAAe,GAAG,EAAE,EAAmB;IAC/D,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE;QACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACrB,SAAS;SACV;QAED,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAmC,CAAC;QAErE,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;aACzB,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CACvC,CAAC;KACH;AACH,CAAC","sourcesContent":["import type { Context } from '@ms-cloudpack/api-server';\nimport type { CloudpackConfig, GeneratedConfig, PackageJsonExportsObject } from '@ms-cloudpack/config-types';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { AutoDispose } from '../../types/AutoDispose.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { InitSummary } from './types/InitSummary.js';\n\nimport { createPartialApiContext } from '@ms-cloudpack/api-server/apis';\nimport { writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { bold, bulletedList, formatPackageName, plural } from '@ms-cloudpack/task-reporter';\nimport { InitSummaryData } from './InitSummaryData.js';\nimport { evaluatePath } from './evaluatePath.js';\n\n/**\n * Init execution function.\n */\nexport async function init(parameters: {\n options: InitOptions;\n appPath: string;\n config: CloudpackConfig;\n autoDispose: AutoDispose;\n reporter: TaskReporter;\n telemetryClient: TelemetryClient;\n}): Promise<InitSummary> {\n const { options, appPath, config, reporter, autoDispose, telemetryClient } = parameters;\n\n // Don't allow --check and --reset together.\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n // If --reset is specified, reset the generated config.\n if (options.reset) {\n config.generated = {};\n }\n\n const ctx: Context = await createPartialApiContext({\n appPath,\n config,\n reporter,\n telemetryClient,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session', 'packageImportPaths', 'packageHashes'],\n });\n autoDispose(ctx);\n const resolveMap = ctx.session.resolveMap;\n\n // Ensure config.generated.packageSettings is initialized.\n config.generated.packageSettings ??= [];\n\n const summaryData = new InitSummaryData();\n\n await new Promise<void>((resolve, reject) => {\n let pending = 0;\n let isExitingPrematurely = false;\n const visitedSet = new Set<string>();\n const refreshPaths = new Set<string>();\n\n // Start with the app path or requested matches\n enqueuePaths(getInitialPaths({ appPath, match: options.match, resolveMap, reporter }));\n\n // Create a function to enqueue more paths.\n function enqueuePaths(newPaths: string[]) {\n if (isExitingPrematurely) {\n return;\n }\n\n // Iterate through the given paths.\n for (const path of newPaths) {\n if (visitedSet.has(path)) {\n continue;\n }\n\n const shouldForce = refreshPaths.delete(path);\n\n visitedSet.add(path);\n pending++;\n\n // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.\n evaluatePath({\n packagePath: path,\n config,\n telemetryClient,\n resolveMap,\n shouldForce,\n initOptions: options,\n summaryData,\n ctx,\n })\n .then(({ pathsToEvaluate, pathsToRefresh, shouldExit }) => {\n pending--;\n\n if (shouldExit) {\n isExitingPrematurely = true;\n } else if (pathsToEvaluate?.size && !options.match) {\n // If there are paths that need to be rebuilt, add them to the refresh set so that on re-enqueuing\n // we pass the `shouldRerun` flag through\n pathsToRefresh?.forEach((refreshPath) => {\n refreshPaths.add(refreshPath);\n visitedSet.delete(refreshPath);\n });\n\n // Try to enqueue the new paths.\n enqueuePaths(Array.from(pathsToEvaluate));\n }\n\n // If nothing is pending after this call, we're complete.\n if (!pending) {\n resolve();\n }\n })\n .catch((error) => {\n reject(error);\n });\n }\n }\n });\n\n const summary = summaryData.summarize();\n\n if (!options.check && summary.totalChanges && config.generated.packageSettings?.length) {\n sortExportKeys(config.generated);\n\n await writeGeneratedConfig(config.generated, appPath);\n }\n\n return summary;\n}\n\n/**\n * Get initial package paths to process: either the app path, or packages matching `match` in the init options.\n */\nfunction getInitialPaths(params: {\n appPath: string;\n match: string | undefined;\n resolveMap: ResolveMap;\n reporter: TaskReporter;\n}): string[] {\n const { appPath, match, resolveMap, reporter } = params;\n\n if (!match) {\n return [appPath];\n }\n\n // Find package in resolve-map\n const matchNames = Object.keys(resolveMap).filter((k) => k.includes(match));\n const resolveMapEntries = matchNames.map((name) => resolveMap[name]);\n\n reporter.log(\n `\\nFound ${plural(resolveMapEntries.length, 'package')} matching \"${bold(match)}\":\\n`,\n bulletedList(resolveMapEntries.map((entry) => `${formatPackageName(entry)}: ${entry.path}`)),\n );\n\n return resolveMapEntries.map((entry) => entry.path);\n}\n\nfunction sortExportKeys({ packageSettings = [] }: GeneratedConfig) {\n for (const settings of packageSettings) {\n if (!settings.exports) {\n continue;\n }\n\n const unsortedExports = settings.exports as PackageJsonExportsObject;\n\n settings.exports = Object.fromEntries(\n Object.keys(unsortedExports)\n .sort()\n .map((k) => [k, unsortedExports[k]]),\n );\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
- import type { PackageDefinitionsCache, PackageJson } from '@ms-cloudpack/bundler-types';
1
+ import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
2
2
  import type { Express } from '@ms-cloudpack/create-express-app';
3
3
  import type { BundleServer } from '../../../types/BundleServer.js';
4
4
  import type { ApiServer, Session } from '@ms-cloudpack/api-server';
5
- import type { CloudpackConfig } from '@ms-cloudpack/config';
5
+ import type { CloudpackConfig, PackageJson } from '@ms-cloudpack/config-types';
6
6
  import type { PackageImportPaths } from '@ms-cloudpack/package-utilities';
7
7
  import type { PackageHashes } from '@ms-cloudpack/package-hashes';
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"createRoutes.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/appServer/createRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,kCAAkC,CAAC;AAKnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAKnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,GAAG,EACH,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,aAAa,GACd,EAAE;IACD,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,WAAW,CAAC;IACxB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,aAAa,EAAE,aAAa,CAAC;CAC9B,QAyEA"}
1
+ {"version":3,"file":"createRoutes.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/appServer/createRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,kCAAkC,CAAC;AAKnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAKnE,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,GAAG,EACH,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,aAAa,GACd,EAAE;IACD,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,WAAW,CAAC;IACxB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,aAAa,EAAE,aAAa,CAAC;CAC9B,QAyEA"}
@@ -36,7 +36,7 @@ export function createRoutes({ app, url, session, definition, bundleServer, apiS
36
36
  sessionVersion: session.getSessionVersion(),
37
37
  targetVersions: session.targetVersions,
38
38
  hashPackages: config.features?.hashPackages,
39
- }, { packages, packageImportPaths, getPackageHash }));
39
+ }, { packages, packageImportPaths, getPackageHash, config: session.config }));
40
40
  // Parse the request path, extension, grab the overlay script path.
41
41
  const requestPath = slash(req.path.substring(1));
42
42
  const requestExt = path.extname(requestPath);
@@ -1 +1 @@
1
- {"version":3,"file":"createRoutes.js","sourceRoot":"","sources":["../../../../src/commands/start/appServer/createRoutes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK7C;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,GAAG,EACH,GAAG,EACH,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,aAAa,GAYd;IACC,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IACrD,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC;IAE3F,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,GAAG;SACjB,CAAC,CAAC;KACJ;IAED,MAAM,cAAc,GAAG,CAAC,WAAmB,EAAE,EAAE;QAC7C,OAAO,aAAa,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,s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AAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;oBAChG,iEAAiE;oBACjE,2GAA2G;oBAC3G,0GAA0G;oBAC1G,uGAAuG;oBACvG,UAAU,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC;oBACtD,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,CAAC;oBAC/C,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,MAAM,eAAe,CAAC;wBACjE,KAAK;wBACL,OAAO,EAAE,GAAG;wBACZ,SAAS;wBACT,aAAa;wBACb,WAAW;wBACX,OAAO;wBACP,UAAU;wBACV,aAAa;wBACb,GAAG;wBACH,GAAG;qBACJ,CAAC,CAAC;oBAEH,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC;oBAE7D,GAAG,CAAC,wBAAwB,WAAW,UAAU,UAAU,EAAE,CAAC,CAAC;gBACjE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACjB,OAAO,CAAC,KAAK,CAAE,GAAa,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;oBAC5C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAC;gBACpD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;KACF;AACH,CAAC","sourcesContent":["import type { PackageDefinitionsCache, PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { Express, Request, Response } from '@ms-cloudpack/create-express-app';\nimport { express } from '@ms-cloudpack/create-express-app';\nimport { createImportMap } from '@ms-cloudpack/package-utilities';\nimport { slash } from '@ms-cloudpack/path-string-parsing';\nimport path from 'path';\nimport type { BundleServer } from '../../../types/BundleServer.js';\nimport type { ApiServer, Session } from '@ms-cloudpack/api-server';\nimport { getHtmlResponse } from './getHtmlResponse.js';\nimport { getInlineScripts } from './inlineScripts/getInlineScripts.js';\nimport { log } from './log.js';\nimport { setHeaders } from './setHeaders.js';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { PackageImportPaths } from '@ms-cloudpack/package-utilities';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\n/**\n * Creates the routes for the express app, considering how the config is defined.\n */\nexport function createRoutes({\n app,\n url,\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n packages,\n packageImportPaths,\n packageHashes,\n}: {\n app: Express;\n url: string;\n session: Session;\n definition: PackageJson;\n bundleServer: BundleServer;\n apiServer: ApiServer;\n config: CloudpackConfig;\n packages: PackageDefinitionsCache;\n packageImportPaths: PackageImportPaths;\n packageHashes: PackageHashes;\n}) {\n const routes = [...(config.devServer?.routes || [])];\n const hasDefaultRoute = routes.some((route) => route.match === '*' || route.match === '/');\n\n if (!hasDefaultRoute) {\n routes.push({\n match: '*',\n exportEntry: '.',\n });\n }\n\n const getPackageHash = (packagePath: string) => {\n return packageHashes.get({ packagePath, isSourceHashingEnabled: true });\n };\n\n for (const route of routes) {\n if (route.staticPath) {\n app.use(route.match, express.static(path.resolve(session.appPath, route.staticPath)));\n } else {\n app.get(route.match, (req: Request, res: Response) => {\n (async () => {\n // Build the import map if it hasn't been built yet for this session version.\n const importMap =\n session.getImportMap() ||\n session.setImportMap(\n await createImportMap(\n {\n resolveMap: session.resolveMap,\n bundleServerUrl: bundleServer.url,\n sessionVersion: session.getSessionVersion(),\n targetVersions: session.targetVersions,\n hashPackages: config.features?.hashPackages,\n },\n { packages, packageImportPaths, getPackageHash },\n ),\n );\n\n // Parse the request path, extension, grab the overlay script path.\n const requestPath = slash(req.path.substring(1));\n const requestExt = path.extname(requestPath);\n const overlayScript = importMap.imports['@ms-cloudpack/overlay'];\n const entryScript =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n route.exportEntry && importMap.imports[slash(path.join(definition.name!, route.exportEntry))];\n // Set the appropriate Cloudpack headers/cookies in the response.\n // TODO: setting the headers here prohibits cases where the page rendering is owned by existing server code\n // that can only accept changing the scripts. We should consider moving to a model where an initial script\n // fetch loads the import map and sets Cloudpack settings in local storage rather than headers/cookies.\n setHeaders({ res, session, apiServer, bundleServer });\n const inlineScripts = await getInlineScripts();\n const { content, statusCode, contentType } = await getHtmlResponse({\n route,\n baseUrl: url,\n importMap,\n overlayScript,\n entryScript,\n session,\n definition,\n inlineScripts,\n req,\n res,\n });\n\n res.type(contentType).status(statusCode).send(content).end();\n\n log(`App server: Request: ${requestPath}, ext: ${requestExt}`);\n })().catch((err) => {\n console.error((err as Error)?.stack || err);\n res.status(500).send(`Error loading app: ${err}`);\n });\n });\n }\n }\n}\n"]}
1
+ {"version":3,"file":"createRoutes.js","sourceRoot":"","sources":["../../../../src/commands/start/appServer/createRoutes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK7C;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,GAAG,EACH,GAAG,EACH,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,aAAa,GAYd;IACC,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,IAAI,EAAE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E,KAAK,IAAI,GAAG,CAAC,CAAC;oBAC5C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAC;gBACpD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;KACF;AACH,CAAC","sourcesContent":["import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { Express, Request, Response } from '@ms-cloudpack/create-express-app';\nimport { express } from '@ms-cloudpack/create-express-app';\nimport { createImportMap } from '@ms-cloudpack/package-utilities';\nimport { slash } from '@ms-cloudpack/path-string-parsing';\nimport path from 'path';\nimport type { BundleServer } from '../../../types/BundleServer.js';\nimport type { ApiServer, Session } from '@ms-cloudpack/api-server';\nimport { getHtmlResponse } from './getHtmlResponse.js';\nimport { getInlineScripts } from './inlineScripts/getInlineScripts.js';\nimport { log } from './log.js';\nimport { setHeaders } from './setHeaders.js';\nimport type { CloudpackConfig, PackageJson } from '@ms-cloudpack/config-types';\nimport type { PackageImportPaths } from '@ms-cloudpack/package-utilities';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\n/**\n * Creates the routes for the express app, considering how the config is defined.\n */\nexport function createRoutes({\n app,\n url,\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n packages,\n packageImportPaths,\n packageHashes,\n}: {\n app: Express;\n url: string;\n session: Session;\n definition: PackageJson;\n bundleServer: BundleServer;\n apiServer: ApiServer;\n config: CloudpackConfig;\n packages: PackageDefinitionsCache;\n packageImportPaths: PackageImportPaths;\n packageHashes: PackageHashes;\n}) {\n const routes = [...(config.devServer?.routes || [])];\n const hasDefaultRoute = routes.some((route) => route.match === '*' || route.match === '/');\n\n if (!hasDefaultRoute) {\n routes.push({\n match: '*',\n exportEntry: '.',\n });\n }\n\n const getPackageHash = (packagePath: string) => {\n return packageHashes.get({ packagePath, isSourceHashingEnabled: true });\n };\n\n for (const route of routes) {\n if (route.staticPath) {\n app.use(route.match, express.static(path.resolve(session.appPath, route.staticPath)));\n } else {\n app.get(route.match, (req: Request, res: Response) => {\n (async () => {\n // Build the import map if it hasn't been built yet for this session version.\n const importMap =\n session.getImportMap() ||\n session.setImportMap(\n await createImportMap(\n {\n resolveMap: session.resolveMap,\n bundleServerUrl: bundleServer.url,\n sessionVersion: session.getSessionVersion(),\n targetVersions: session.targetVersions,\n hashPackages: config.features?.hashPackages,\n },\n { packages, packageImportPaths, getPackageHash, config: session.config },\n ),\n );\n\n // Parse the request path, extension, grab the overlay script path.\n const requestPath = slash(req.path.substring(1));\n const requestExt = path.extname(requestPath);\n const overlayScript = importMap.imports['@ms-cloudpack/overlay'];\n const entryScript =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n route.exportEntry && importMap.imports[slash(path.join(definition.name!, route.exportEntry))];\n // Set the appropriate Cloudpack headers/cookies in the response.\n // TODO: setting the headers here prohibits cases where the page rendering is owned by existing server code\n // that can only accept changing the scripts. We should consider moving to a model where an initial script\n // fetch loads the import map and sets Cloudpack settings in local storage rather than headers/cookies.\n setHeaders({ res, session, apiServer, bundleServer });\n const inlineScripts = await getInlineScripts();\n const { content, statusCode, contentType } = await getHtmlResponse({\n route,\n baseUrl: url,\n importMap,\n overlayScript,\n entryScript,\n session,\n definition,\n inlineScripts,\n req,\n res,\n });\n\n res.type(contentType).status(statusCode).send(content).end();\n\n log(`App server: Request: ${requestPath}, ext: ${requestExt}`);\n })().catch((err) => {\n console.error((err as Error)?.stack || err);\n res.status(500).send(`Error loading app: ${err}`);\n });\n });\n }\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { BundleServer } from '../../../types/BundleServer.js';
2
- import type { PackageDefinitionsCache, PackageJson } from '@ms-cloudpack/bundler-types';
2
+ import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
3
3
  import { type TaskReporter } from '@ms-cloudpack/task-reporter';
4
- import type { CloudpackConfig } from '@ms-cloudpack/config';
4
+ import type { CloudpackConfig, PackageJson } from '@ms-cloudpack/config-types';
5
5
  import type { ApiServer, Session } from '@ms-cloudpack/api-server';
6
6
  import type { PackageImportPaths } from '@ms-cloudpack/package-utilities';
7
7
  import type { PackageHashes } from '@ms-cloudpack/package-hashes';
@@ -1 +1 @@
1
- {"version":3,"file":"startAppServer.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/appServer/startAppServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAGxF,OAAO,EAAE,KAAK,YAAY,EAAQ,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,YAAY,EACZ,SAAS,EACT,UAAU,EACV,MAA8B,EAC9B,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,aAAa,GACd,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,WAAW,CAAC;IACxB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;CAC9B;;;;GAgDA"}
1
+ {"version":3,"file":"startAppServer.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/appServer/startAppServer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAG3E,OAAO,EAAE,KAAK,YAAY,EAAQ,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,YAAY,EACZ,SAAS,EACT,UAAU,EACV,MAA8B,EAC9B,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,aAAa,GACd,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,WAAW,CAAC;IACxB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;CAC9B;;;;GAgDA"}
@@ -1 +1 @@
1
- {"version":3,"file":"startAppServer.js","sourceRoot":"","sources":["../../../../src/commands/start/appServer/startAppServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAqB,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAMtE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UA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IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,4BAA4B,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1F,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAEvD,MAAM,GAAG,CAAC;KACX;AACH,CAAC","sourcesContent":["import { createExpressApp } from '@ms-cloudpack/create-express-app';\nimport type { BundleServer } from '../../../types/BundleServer.js';\nimport type { PackageDefinitionsCache, PackageJson } from '@ms-cloudpack/bundler-types';\nimport { createRoutes } from './createRoutes.js';\nimport { exitIfPortUnavailable } from './exitIfPortUnavailable.js';\nimport { type TaskReporter, cyan } from '@ms-cloudpack/task-reporter';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { ApiServer, Session } from '@ms-cloudpack/api-server';\nimport type { PackageImportPaths } from '@ms-cloudpack/package-utilities';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\n/**\n * The app server hosts the appropriate routes for the web app, primarily returning html content\n * which loads resources from the bundle server.\n *\n * Separating the app server from the bundle service keeps the routes separate - the app server\n * can support whichever routes the app needs, while the bundle server can provide package\n * assets in various forms using its own routing.\n */\nexport async function startAppServer({\n session,\n bundleServer,\n apiServer,\n definition,\n config = {} as CloudpackConfig,\n packages,\n packageImportPaths,\n reporter,\n packageHashes,\n}: {\n session: Session;\n definition: PackageJson;\n bundleServer: BundleServer;\n apiServer: ApiServer;\n config: CloudpackConfig;\n packages: PackageDefinitionsCache;\n packageImportPaths: PackageImportPaths;\n reporter: TaskReporter;\n packageHashes: PackageHashes;\n}) {\n const { devServer = {} } = config || ({} as CloudpackConfig);\n\n // Read the port from the config file or default to array of ports.\n const requireSpecifiedPort = devServer?.port !== undefined;\n const ports = devServer?.port ?? [5000, 5001, 5002, 5003];\n\n // Directory to serve as plain static assets. Defaults to \"public\".\n // Can be overridden by setting the 'publicDir' option in the cloudpack config.\n // const publicDir = path.resolve(devServer.publicPath ?? 'public');\n\n const task = reporter.addTask(`Starting app server for \"${definition.name}\"`);\n\n try {\n const { close, port, url } = await createExpressApp({\n portRange: ports,\n requireSpecifiedPort,\n hostname: devServer?.domain,\n sslOptions: config.devServer?.https,\n // publicDir,\n setupCallback: (app, appUrl) =>\n createRoutes({\n app,\n url: appUrl,\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n packages,\n packageImportPaths,\n packageHashes,\n }),\n });\n\n task.complete({ message: `Available @ ${cyan(url)}`, forceShow: true });\n\n return {\n close,\n port,\n url,\n };\n } catch (err: unknown) {\n task.complete({ status: 'fail', message: 'Failed to start app server', forceShow: true });\n exitIfPortUnavailable(err, session.projectName, ports);\n\n throw err;\n }\n}\n"]}
1
+ {"version":3,"file":"startAppServer.js","sourceRoot":"","sources":["../../../../src/commands/start/appServer/startAppServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAqB,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAMtE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EACnC,OAAO,EACP,YAAY,EACZ,SAAS,EACT,UAAU,EACV,MAAM,GAAG,EAAqB,EAC9B,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,aAAa,GAWd;IACC,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,MAAM,IAAK,EAAsB,CAAC;IAE7D,mEAAmE;IACnE,MAAM,oBAAoB,GAAG,SAAS,EAAE,IAAI,KAAK,SAAS,CAAC;IAC3D,MAAM,KAAK,GAAG,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAE1D,mEAAmE;IACnE,+EAA+E;IAC/E,oEAAoE;IAEpE,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,4BAA4B,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;IAE9E,IAAI;QACF,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,gBAAgB,CAAC;YAClD,SAAS,EAAE,KAAK;YAChB,oBAAoB;YACpB,QAAQ,EAAE,SAAS,EAAE,MAAM;YAC3B,UAAU,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK;YACnC,cAAc;YACd,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAC7B,YAAY,CAAC;gBACX,GAAG;gBACH,GAAG,EAAE,MAAM;gBACX,OAAO;gBACP,UAAU;gBACV,YAAY;gBACZ,SAAS;gBACT,MAAM;gBACN,QAAQ;gBACR,kBAAkB;gBAClB,aAAa;aACd,CAAC;SACL,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,eAAe,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAExE,OAAO;YACL,KAAK;YACL,IAAI;YACJ,GAAG;SACJ,CAAC;KACH;IAAC,OAAO,GAAY,EAAE;QACrB,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,4BAA4B,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1F,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAEvD,MAAM,GAAG,CAAC;KACX;AACH,CAAC","sourcesContent":["import { createExpressApp } from '@ms-cloudpack/create-express-app';\nimport type { BundleServer } from '../../../types/BundleServer.js';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport { createRoutes } from './createRoutes.js';\nimport { exitIfPortUnavailable } from './exitIfPortUnavailable.js';\nimport { type TaskReporter, cyan } from '@ms-cloudpack/task-reporter';\nimport type { CloudpackConfig, PackageJson } from '@ms-cloudpack/config-types';\nimport type { ApiServer, Session } from '@ms-cloudpack/api-server';\nimport type { PackageImportPaths } from '@ms-cloudpack/package-utilities';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\n/**\n * The app server hosts the appropriate routes for the web app, primarily returning html content\n * which loads resources from the bundle server.\n *\n * Separating the app server from the bundle service keeps the routes separate - the app server\n * can support whichever routes the app needs, while the bundle server can provide package\n * assets in various forms using its own routing.\n */\nexport async function startAppServer({\n session,\n bundleServer,\n apiServer,\n definition,\n config = {} as CloudpackConfig,\n packages,\n packageImportPaths,\n reporter,\n packageHashes,\n}: {\n session: Session;\n definition: PackageJson;\n bundleServer: BundleServer;\n apiServer: ApiServer;\n config: CloudpackConfig;\n packages: PackageDefinitionsCache;\n packageImportPaths: PackageImportPaths;\n reporter: TaskReporter;\n packageHashes: PackageHashes;\n}) {\n const { devServer = {} } = config || ({} as CloudpackConfig);\n\n // Read the port from the config file or default to array of ports.\n const requireSpecifiedPort = devServer?.port !== undefined;\n const ports = devServer?.port ?? [5000, 5001, 5002, 5003];\n\n // Directory to serve as plain static assets. Defaults to \"public\".\n // Can be overridden by setting the 'publicDir' option in the cloudpack config.\n // const publicDir = path.resolve(devServer.publicPath ?? 'public');\n\n const task = reporter.addTask(`Starting app server for \"${definition.name}\"`);\n\n try {\n const { close, port, url } = await createExpressApp({\n portRange: ports,\n requireSpecifiedPort,\n hostname: devServer?.domain,\n sslOptions: config.devServer?.https,\n // publicDir,\n setupCallback: (app, appUrl) =>\n createRoutes({\n app,\n url: appUrl,\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n packages,\n packageImportPaths,\n packageHashes,\n }),\n });\n\n task.complete({ message: `Available @ ${cyan(url)}`, forceShow: true });\n\n return {\n close,\n port,\n url,\n };\n } catch (err: unknown) {\n task.complete({ status: 'fail', message: 'Failed to start app server', forceShow: true });\n exitIfPortUnavailable(err, session.projectName, ports);\n\n throw err;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { allFeatures } from '@ms-cloudpack/config';
1
+ import { allFeatures } from '@ms-cloudpack/config-types';
2
2
  export declare function mergeFeatures<TFeatureSet extends Record<string, unknown> = typeof allFeatures>({ configFeatures, commandLineFeatures, featureSet, }: {
3
3
  configFeatures?: {
4
4
  [key in keyof typeof featureSet]?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"mergeFeatures.d.ts","sourceRoot":"","sources":["../../../src/commands/start/mergeFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,wBAAgB,aAAa,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,WAAW,EAAE,EAC9F,cAAc,EACd,mBAAmB,EACnB,UAAkD,GACnD,EAAE;IACD,cAAc,CAAC,EAAE;SAAG,GAAG,IAAI,MAAM,OAAO,UAAU,CAAC,CAAC,EAAE,OAAO;KAAE,CAAC;IAChE,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,yDAiBA"}
1
+ {"version":3,"file":"mergeFeatures.d.ts","sourceRoot":"","sources":["../../../src/commands/start/mergeFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,wBAAgB,aAAa,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,WAAW,EAAE,EAC9F,cAAc,EACd,mBAAmB,EACnB,UAAkD,GACnD,EAAE;IACD,cAAc,CAAC,EAAE;SAAG,GAAG,IAAI,MAAM,OAAO,UAAU,CAAC,CAAC,EAAE,OAAO;KAAE,CAAC;IAChE,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B,yDAiBA"}
@@ -1,4 +1,4 @@
1
- import { allFeatures } from '@ms-cloudpack/config';
1
+ import { allFeatures } from '@ms-cloudpack/config-types';
2
2
  export function mergeFeatures({ configFeatures, commandLineFeatures, featureSet = allFeatures, }) {
3
3
  const featureList = Object.keys(featureSet);
4
4
  const features = { ...configFeatures };
@@ -1 +1 @@
1
- {"version":3,"file":"mergeFeatures.js","sourceRoot":"","sources":["../../../src/commands/start/mergeFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,UAAU,aAAa,CAAmE,EAC9F,cAAc,EACd,mBAAmB,EACnB,UAAU,GAAG,WAAqC,GAKnD;IACC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,EAAE,GAAG,cAAc,EAAE,CAAC;IAEvC,mBAAmB,EAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,EAAE;QAClD,yDAAyD;QACzD,MAAM,kBAAkB,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,kBAAkB,CAAC,WAAW,EAAE,CAAC;YACvG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAE5E,CAAC;QAEd,IAAI,kBAAkB,EAAE;YACtB,QAAQ,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,QAA0D,CAAC;AACpE,CAAC","sourcesContent":["import { allFeatures } from '@ms-cloudpack/config';\n\nexport function mergeFeatures<TFeatureSet extends Record<string, unknown> = typeof allFeatures>({\n configFeatures,\n commandLineFeatures,\n featureSet = allFeatures as unknown as TFeatureSet,\n}: {\n configFeatures?: { [key in keyof typeof featureSet]?: boolean };\n commandLineFeatures?: string[];\n featureSet?: TFeatureSet;\n}) {\n const featureList = Object.keys(featureSet);\n const features = { ...configFeatures };\n\n commandLineFeatures?.forEach((partialFeatureName) => {\n // Prefer an exact match, but fall back to partial match.\n const matchedFeatureName = (featureList.find((f) => f.toLowerCase() === partialFeatureName.toLowerCase()) ||\n featureList.find((f) => f.toLowerCase().indexOf(partialFeatureName.toLowerCase()) > -1)) as\n | keyof typeof features\n | undefined;\n\n if (matchedFeatureName) {\n features[matchedFeatureName] = true;\n }\n });\n\n return features as { [key in keyof typeof featureSet]?: boolean };\n}\n"]}
1
+ {"version":3,"file":"mergeFeatures.js","sourceRoot":"","sources":["../../../src/commands/start/mergeFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,UAAU,aAAa,CAAmE,EAC9F,cAAc,EACd,mBAAmB,EACnB,UAAU,GAAG,WAAqC,GAKnD;IACC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,QAAQ,GAAG,EAAE,GAAG,cAAc,EAAE,CAAC;IAEvC,mBAAmB,EAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,EAAE;QAClD,yDAAyD;QACzD,MAAM,kBAAkB,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,kBAAkB,CAAC,WAAW,EAAE,CAAC;YACvG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAE5E,CAAC;QAEd,IAAI,kBAAkB,EAAE;YACtB,QAAQ,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,QAA0D,CAAC;AACpE,CAAC","sourcesContent":["import { allFeatures } from '@ms-cloudpack/config-types';\n\nexport function mergeFeatures<TFeatureSet extends Record<string, unknown> = typeof allFeatures>({\n configFeatures,\n commandLineFeatures,\n featureSet = allFeatures as unknown as TFeatureSet,\n}: {\n configFeatures?: { [key in keyof typeof featureSet]?: boolean };\n commandLineFeatures?: string[];\n featureSet?: TFeatureSet;\n}) {\n const featureList = Object.keys(featureSet);\n const features = { ...configFeatures };\n\n commandLineFeatures?.forEach((partialFeatureName) => {\n // Prefer an exact match, but fall back to partial match.\n const matchedFeatureName = (featureList.find((f) => f.toLowerCase() === partialFeatureName.toLowerCase()) ||\n featureList.find((f) => f.toLowerCase().indexOf(partialFeatureName.toLowerCase()) > -1)) as\n | keyof typeof features\n | undefined;\n\n if (matchedFeatureName) {\n features[matchedFeatureName] = true;\n }\n });\n\n return features as { [key in keyof typeof featureSet]?: boolean };\n}\n"]}
@@ -14,6 +14,6 @@ export declare function createInitializeFunction(params: {
14
14
  optionsOverrides?: Partial<SharedOptions>;
15
15
  }) => Promise<{
16
16
  telemetryClient: import("@ms-cloudpack/telemetry").TelemetryClient;
17
- config: import("@ms-cloudpack/config").CloudpackConfig;
17
+ config: import("@ms-cloudpack/config-types").CloudpackConfig;
18
18
  }>;
19
19
  //# sourceMappingURL=createInitializeFunction.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { PackageOverride } from '@ms-cloudpack/config';
1
+ import type { PackageOverride } from '@ms-cloudpack/config-types';
2
2
  /**
3
3
  * Given a set of package overrides, finds the overrides for the given package name and version.
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"findPackageOverride.d.ts","sourceRoot":"","sources":["../../src/common/findPackageOverride.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,eAAe,EAAE,EACnC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,eAAe,GAAG,SAAS,CAI7B"}
1
+ {"version":3,"file":"findPackageOverride.d.ts","sourceRoot":"","sources":["../../src/common/findPackageOverride.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,eAAe,EAAE,EACnC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,GACrB,eAAe,GAAG,SAAS,CAI7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"findPackageOverride.js","sourceRoot":"","sources":["../../src/common/findPackageOverride.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,gBAAmC,EACnC,WAAmB,EACnB,cAAsB;IAEtB,OAAO,gBAAgB,CAAC,IAAI,CAC1B,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAC7G,CAAC;AACJ,CAAC","sourcesContent":["import semver from 'semver';\nimport type { PackageOverride } from '@ms-cloudpack/config';\n\n/**\n * Given a set of package overrides, finds the overrides for the given package name and version.\n */\nexport function findPackageOverride(\n packageOverrides: PackageOverride[],\n packageName: string,\n packageVersion: string,\n): PackageOverride | undefined {\n return packageOverrides.find(\n (override) => override.name === packageName && semver.satisfies(packageVersion, override.versionRequirement),\n );\n}\n"]}
1
+ {"version":3,"file":"findPackageOverride.js","sourceRoot":"","sources":["../../src/common/findPackageOverride.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,gBAAmC,EACnC,WAAmB,EACnB,cAAsB;IAEtB,OAAO,gBAAgB,CAAC,IAAI,CAC1B,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAC7G,CAAC;AACJ,CAAC","sourcesContent":["import semver from 'semver';\nimport type { PackageOverride } from '@ms-cloudpack/config-types';\n\n/**\n * Given a set of package overrides, finds the overrides for the given package name and version.\n */\nexport function findPackageOverride(\n packageOverrides: PackageOverride[],\n packageName: string,\n packageVersion: string,\n): PackageOverride | undefined {\n return packageOverrides.find(\n (override) => override.name === packageName && semver.satisfies(packageVersion, override.versionRequirement),\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { CloudpackConfig } from '@ms-cloudpack/config';
1
+ import type { CloudpackConfig } from '@ms-cloudpack/config-types';
2
2
  /**
3
3
  * Runs the pre-requisites specified in the given Cloudpack config
4
4
  * @param config - The Cloudpack config of containing a list of prerequisites to run
@@ -1 +1 @@
1
- {"version":3,"file":"runPrerequisites.d.ts","sourceRoot":"","sources":["../../src/common/runPrerequisites.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,QAQhF"}
1
+ {"version":3,"file":"runPrerequisites.d.ts","sourceRoot":"","sources":["../../src/common/runPrerequisites.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,QAQhF"}
@@ -1 +1 @@
1
- {"version":3,"file":"runPrerequisites.js","sourceRoot":"","sources":["../../src/common/runPrerequisites.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAmC,EAAE,GAAW;IAC/E,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","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 prerequisites to run\n */\nexport function runPrerequisites(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"]}
1
+ {"version":3,"file":"runPrerequisites.js","sourceRoot":"","sources":["../../src/common/runPrerequisites.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,aAAa,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAmC,EAAE,GAAW;IAC/E,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","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/config-types';\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 prerequisites to run\n */\nexport function runPrerequisites(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"]}
@@ -1,4 +1,4 @@
1
- import { type TelemetryConfig } from '@ms-cloudpack/config';
1
+ import { type TelemetryConfig } from '@ms-cloudpack/config-types';
2
2
  import { type SpanAttributes } from '@ms-cloudpack/telemetry';
3
3
  import type { TaskReporter } from '@ms-cloudpack/task-reporter';
4
4
  export interface TelemetryInitOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"initTelemetry.d.ts","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAErF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;IAC7C,oBAAoB,CAAC,EAAE,cAAc,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,YAAY,8DA4B5F"}
1
+ {"version":3,"file":"initTelemetry.d.ts","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAErF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;IAC7C,oBAAoB,CAAC,EAAE,cAAc,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,YAAY,8DA4B5F"}
@@ -1,4 +1,4 @@
1
- import {} from '@ms-cloudpack/config';
1
+ import {} from '@ms-cloudpack/config-types';
2
2
  import { getVersion } from '@ms-cloudpack/package-utilities';
3
3
  import { createTelemetryClient } from '@ms-cloudpack/telemetry';
4
4
  import { registerPerformanceObservers } from './performance/registerPerformanceObservers.js';
@@ -1 +1 @@
1
- {"version":3,"file":"initTelemetry.js","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAuB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAU7F;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA6B,EAAE,YAA0B;IAC3F,MAAM,gBAAgB,GACpB,OAAO,CAAC,eAAe,EAAE,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC;IAEjG,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACvG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;QAC5B,YAAY,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;KACvD;IAED,MAAM,eAAe,GAAG,MAAM,qBAAqB,CAAC;QAClD,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3C,gBAAgB;QAChB,QAAQ;QACR,gBAAgB,EAAE,WAAW;QAC7B,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,oBAAoB,EAAE;QAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE;YACvE,eAAe,CAAC,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACpD;KACF;IAED,qFAAqF;IACrF,4BAA4B,CAAC,eAAe,CAAC,CAAC;IAE9C,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import { type TelemetryConfig } from '@ms-cloudpack/config';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport { createTelemetryClient, type SpanAttributes } from '@ms-cloudpack/telemetry';\nimport { registerPerformanceObservers } from './performance/registerPerformanceObservers.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport interface TelemetryInitOptions {\n useDebugLogging: boolean;\n useVerboseLogging: boolean;\n telemetryConfig: TelemetryConfig | undefined;\n sharedSpanAttributes?: SpanAttributes;\n}\n\n/**\n * Initialize the telemetry client, create the root span, register performance observers.\n * Telemetry will not be sent if no instrumentation key is found.\n * @param options - options to initialize telemetry\n * @returns\n */\nexport async function initTelemetry(options: TelemetryInitOptions, taskReporter: TaskReporter) {\n const connectionString =\n options.telemetryConfig?.connectionString || process.env.CLOUDPACK_TELEMETRY_CONNECTION_STRING;\n\n const logLevel = options.useVerboseLogging ? 'VERBOSE' : options.useDebugLogging ? 'DEBUG' : undefined;\n if (!options.useDebugLogging) {\n taskReporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n const telemetryClient = await createTelemetryClient({\n productVersion: getVersion(import.meta.url),\n connectionString,\n logLevel,\n serviceNamespace: 'cloudpack',\n serviceName: 'cli',\n rootSpanName: 'CLI',\n });\n\n if (options.sharedSpanAttributes) {\n for (const [key, value] of Object.entries(options.sharedSpanAttributes)) {\n telemetryClient.setSharedSpanAttribute(key, value);\n }\n }\n\n // Register performance observers to track performance metrics as events of CLI span.\n registerPerformanceObservers(telemetryClient);\n\n return telemetryClient;\n}\n"]}
1
+ {"version":3,"file":"initTelemetry.js","sourceRoot":"","sources":["../src/initTelemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAuB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAU7F;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAA6B,EAAE,YAA0B;IAC3F,MAAM,gBAAgB,GACpB,OAAO,CAAC,eAAe,EAAE,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC;IAEjG,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IACvG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;QAC5B,YAAY,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;KACvD;IAED,MAAM,eAAe,GAAG,MAAM,qBAAqB,CAAC;QAClD,cAAc,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3C,gBAAgB;QAChB,QAAQ;QACR,gBAAgB,EAAE,WAAW;QAC7B,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,oBAAoB,EAAE;QAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE;YACvE,eAAe,CAAC,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACpD;KACF;IAED,qFAAqF;IACrF,4BAA4B,CAAC,eAAe,CAAC,CAAC;IAE9C,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import { type TelemetryConfig } from '@ms-cloudpack/config-types';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport { createTelemetryClient, type SpanAttributes } from '@ms-cloudpack/telemetry';\nimport { registerPerformanceObservers } from './performance/registerPerformanceObservers.js';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\n\nexport interface TelemetryInitOptions {\n useDebugLogging: boolean;\n useVerboseLogging: boolean;\n telemetryConfig: TelemetryConfig | undefined;\n sharedSpanAttributes?: SpanAttributes;\n}\n\n/**\n * Initialize the telemetry client, create the root span, register performance observers.\n * Telemetry will not be sent if no instrumentation key is found.\n * @param options - options to initialize telemetry\n * @returns\n */\nexport async function initTelemetry(options: TelemetryInitOptions, taskReporter: TaskReporter) {\n const connectionString =\n options.telemetryConfig?.connectionString || process.env.CLOUDPACK_TELEMETRY_CONNECTION_STRING;\n\n const logLevel = options.useVerboseLogging ? 'VERBOSE' : options.useDebugLogging ? 'DEBUG' : undefined;\n if (!options.useDebugLogging) {\n taskReporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n const telemetryClient = await createTelemetryClient({\n productVersion: getVersion(import.meta.url),\n connectionString,\n logLevel,\n serviceNamespace: 'cloudpack',\n serviceName: 'cli',\n rootSpanName: 'CLI',\n });\n\n if (options.sharedSpanAttributes) {\n for (const [key, value] of Object.entries(options.sharedSpanAttributes)) {\n telemetryClient.setSharedSpanAttribute(key, value);\n }\n }\n\n // Register performance observers to track performance metrics as events of CLI span.\n registerPerformanceObservers(telemetryClient);\n\n return telemetryClient;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { CloudpackConfig } from '@ms-cloudpack/config';
1
+ import type { CloudpackConfig } from '@ms-cloudpack/config-types';
2
2
  import { type TaskReporter } from '@ms-cloudpack/task-reporter';
3
3
  import type { Command } from 'commander';
4
4
  import type { SharedOptions } from './types/SharedOptions.js';
@@ -1 +1 @@
1
- {"version":3,"file":"setupReporting.d.ts","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAC3C,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;CAClB,8DAgDA"}
1
+ {"version":3,"file":"setupReporting.d.ts","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG/E,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAC3C,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;CAClB,8DAgDA"}
@@ -1 +1 @@
1
- {"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../src/setupReporting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WAAW;QAC/B,aAAa,EAAE,CAAC,OAAO,CAAC,KAAK;QAC7B,GAAG,CAAC,OAAO,CAAC,KAAK;YACf,CAAC,CAAC,kBAAkB;YACpB,CAAC,CAAC,OAAO,CAAC,OAAO;gBACjB,CAAC,CAAC,oBAAoB;gBACtB,CAAC,CAAC,OAAO,CAAC,KAAK;oBACf,CAAC,CAAC,eAAe;oBACjB,CAAC,CAAC,oBAAoB,CAAC;KAC1B,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAgB,CAAC;IAEvF,MAAM,eAAe,GAAG,MAAM,aAAa,CACzC;QACE,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK;QAChC,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO;QACpC,eAAe,EAAE,MAAM,CAAC,SAAS;QACjC,oBAAoB,EAAE;YACpB,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAClC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;YACzC,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;SACzC;KACF,EACD,QAAQ,CACT,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport {\n bold,\n defaultLoggingConfig,\n verboseLoggingConfig,\n debugLoggingConfig,\n noLoggingConfig,\n type TaskReporter,\n} from '@ms-cloudpack/task-reporter';\nimport type { Command } from 'commander';\nimport path from 'path';\nimport { initTelemetry } from './initTelemetry.js';\nimport type { SharedOptions } from './types/SharedOptions.js';\nimport { isCIBuild } from './utilities/isCIBuild.js';\n\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting(params: {\n options: SharedOptions;\n reporter: TaskReporter;\n config: CloudpackConfig;\n appPath: string;\n /** Command object for the current command (not the whole program). */\n command: Command;\n}) {\n const { appPath, config, reporter, options, command } = params;\n\n // commander stores the original argv under the \"program\" command where `parseAsync` was called.\n // Usually `command` is a sub-command (e.g. \"bundle\"), but it could also be a sub-sub-command\n // (e.g. \"cache clean\"), so we look up two levels if present.\n const program = command.parent?.parent || command.parent || command;\n // It looks like rawArgs was intended to be a public API (\"private\" member are prefixed with _)\n // but isn't included in the types...\n const argv = (program as unknown as { rawArgs: string[] }).rawArgs;\n\n // For same reasons as above, check if this is a sub-sub-command\n const verb = command.parent?.parent ? command.parent.name() : command.name();\n\n // Set reporter options and print the product info header\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n plainTextMode: !options.color,\n ...(options.debug\n ? debugLoggingConfig\n : options.verbose\n ? verboseLoggingConfig\n : options.quiet\n ? noLoggingConfig\n : defaultLoggingConfig),\n });\n\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n const telemetryClient = await initTelemetry(\n {\n useDebugLogging: !!options.debug,\n useVerboseLogging: !!options.verbose,\n telemetryConfig: config.telemetry,\n sharedSpanAttributes: {\n verb,\n arguments: argv.slice(3).join(' '),\n environment: isCIBuild() ? 'ci' : 'local',\n appName: definition?.name || '<unknown>',\n },\n },\n reporter,\n );\n\n return telemetryClient;\n}\n"]}
1
+ {"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EACL,IAAI,EACJ,oBAAoB,EACpB,oBAAoB,E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gBACtB,CAAC,CAAC,OAAO,CAAC,KAAK;oBACf,CAAC,CAAC,eAAe;oBACjB,CAAC,CAAC,oBAAoB,CAAC;KAC1B,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAgB,CAAC;IAEvF,MAAM,eAAe,GAAG,MAAM,aAAa,CACzC;QACE,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK;QAChC,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO;QACpC,eAAe,EAAE,MAAM,CAAC,SAAS;QACjC,oBAAoB,EAAE;YACpB,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAClC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;YACzC,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;SACzC;KACF,EACD,QAAQ,CACT,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { PackageJson, CloudpackConfig } from '@ms-cloudpack/config-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport {\n bold,\n defaultLoggingConfig,\n verboseLoggingConfig,\n debugLoggingConfig,\n noLoggingConfig,\n type TaskReporter,\n} from '@ms-cloudpack/task-reporter';\nimport type { Command } from 'commander';\nimport path from 'path';\nimport { initTelemetry } from './initTelemetry.js';\nimport type { SharedOptions } from './types/SharedOptions.js';\nimport { isCIBuild } from './utilities/isCIBuild.js';\n\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting(params: {\n options: SharedOptions;\n reporter: TaskReporter;\n config: CloudpackConfig;\n appPath: string;\n /** Command object for the current command (not the whole program). */\n command: Command;\n}) {\n const { appPath, config, reporter, options, command } = params;\n\n // commander stores the original argv under the \"program\" command where `parseAsync` was called.\n // Usually `command` is a sub-command (e.g. \"bundle\"), but it could also be a sub-sub-command\n // (e.g. \"cache clean\"), so we look up two levels if present.\n const program = command.parent?.parent || command.parent || command;\n // It looks like rawArgs was intended to be a public API (\"private\" member are prefixed with _)\n // but isn't included in the types...\n const argv = (program as unknown as { rawArgs: string[] }).rawArgs;\n\n // For same reasons as above, check if this is a sub-sub-command\n const verb = command.parent?.parent ? command.parent.name() : command.name();\n\n // Set reporter options and print the product info header\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n plainTextMode: !options.color,\n ...(options.debug\n ? debugLoggingConfig\n : options.verbose\n ? verboseLoggingConfig\n : options.quiet\n ? noLoggingConfig\n : defaultLoggingConfig),\n });\n\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n const telemetryClient = await initTelemetry(\n {\n useDebugLogging: !!options.debug,\n useVerboseLogging: !!options.verbose,\n telemetryConfig: config.telemetry,\n sharedSpanAttributes: {\n verb,\n arguments: argv.slice(3).join(' '),\n environment: isCIBuild() ? 'ci' : 'local',\n appName: definition?.name || '<unknown>',\n },\n },\n reporter,\n );\n\n return telemetryClient;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { TaskReporter } from '@ms-cloudpack/task-reporter';
2
- import type { CloudpackConfig } from '@ms-cloudpack/config';
2
+ import type { CloudpackConfig } from '@ms-cloudpack/config-types';
3
3
  import type { TelemetryClient } from '@ms-cloudpack/telemetry';
4
4
  import type { AutoDispose } from './AutoDispose.js';
5
5
  import type { SharedOptions } from '../types/SharedOptions.js';
@@ -1 +1 @@
1
- {"version":3,"file":"CommandAction.d.ts","sourceRoot":"","sources":["../../src/types/CommandAction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE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EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,MAAM,oBAAoB,CAAC,QAAQ,IAAI;IAC3C;;;;OAIG;IACH,OAAO,EAAE,QAAQ,CAAC;IAElB,QAAQ,EAAE,YAAY,CAAC;IAEvB,WAAW,EAAE,WAAW,CAAC;IAEzB;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC;IAEzB;;;OAGG;IACH,UAAU,EAAE,CAAC,iBAAiB,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC;QACxG,eAAe,EAAE,eAAe,CAAC;QACjC,MAAM,EAAE,eAAe,CAAC;KACzB,CAAC,CAAC;IAEH;;;OAGG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,QAAQ,IAAI,CAAC,OAAO,EAAE,oBAAoB,CAAC,QAAQ,GAAG,aAAa,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEjH,MAAM,MAAM,mBAAmB,CAAC,QAAQ,IAAI;IAC1C,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;CAClC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CommandAction.js","sourceRoot":"","sources":["../../src/types/CommandAction.ts"],"names":[],"mappings":"","sourcesContent":["import type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { AutoDispose } from './AutoDispose.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\n\nexport type CommandActionOptions<TOptions> = {\n /**\n * Command-specific options, parsed from `process.argv`.\n * Types are generally defined in each command's `src/commands/<name>/types/<Name>Types.ts` module.\n * The command line options are defined in each command's `src/commands/<name>/index.ts` module.\n */\n options: TOptions;\n\n reporter: TaskReporter;\n\n abortSignal: AbortSignal;\n\n /**\n * Function that can be called with any `Disposable`s that should be cleaned up automatically\n * when the program exits. (See `AutoDisposableList.add` for implementation.)\n */\n autoDispose: AutoDispose;\n\n /**\n * This should be called at or near the beginning of the action to initialize the config,\n * telemetry, and reporting. (See `createInitializeFunction` for implementation.)\n */\n initialize: (initializeOptions: { appPath: string; overrideOptions?: Partial<SharedOptions> }) => Promise<{\n telemetryClient: TelemetryClient;\n config: CloudpackConfig;\n }>;\n\n /**\n * This should be called at the end of the action to dispose resources, log completion,\n * and exit the program. (See `createExitFunction` for implementation.)\n */\n exit: (result: { exitCode: number; message?: string }) => Promise<void>;\n};\n\n/**\n * Command action function. This is the type of the `execute` function which should be exported\n * from each command's `src/commands/<name>/execute.ts` module.\n */\nexport type CommandAction<TOptions> = (options: CommandActionOptions<TOptions & SharedOptions>) => Promise<void>;\n\nexport type CommandActionModule<TOptions> = {\n execute: CommandAction<TOptions>;\n};\n"]}
1
+ {"version":3,"file":"CommandAction.js","sourceRoot":"","sources":["../../src/types/CommandAction.ts"],"names":[],"mappings":"","sourcesContent":["import type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { CloudpackConfig } from '@ms-cloudpack/config-types';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { AutoDispose } from './AutoDispose.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\n\nexport type CommandActionOptions<TOptions> = {\n /**\n * Command-specific options, parsed from `process.argv`.\n * Types are generally defined in each command's `src/commands/<name>/types/<Name>Types.ts` module.\n * The command line options are defined in each command's `src/commands/<name>/index.ts` module.\n */\n options: TOptions;\n\n reporter: TaskReporter;\n\n abortSignal: AbortSignal;\n\n /**\n * Function that can be called with any `Disposable`s that should be cleaned up automatically\n * when the program exits. (See `AutoDisposableList.add` for implementation.)\n */\n autoDispose: AutoDispose;\n\n /**\n * This should be called at or near the beginning of the action to initialize the config,\n * telemetry, and reporting. (See `createInitializeFunction` for implementation.)\n */\n initialize: (initializeOptions: { appPath: string; overrideOptions?: Partial<SharedOptions> }) => Promise<{\n telemetryClient: TelemetryClient;\n config: CloudpackConfig;\n }>;\n\n /**\n * This should be called at the end of the action to dispose resources, log completion,\n * and exit the program. (See `createExitFunction` for implementation.)\n */\n exit: (result: { exitCode: number; message?: string }) => Promise<void>;\n};\n\n/**\n * Command action function. This is the type of the `execute` function which should be exported\n * from each command's `src/commands/<name>/execute.ts` module.\n */\nexport type CommandAction<TOptions> = (options: CommandActionOptions<TOptions & SharedOptions>) => Promise<void>;\n\nexport type CommandActionModule<TOptions> = {\n execute: CommandAction<TOptions>;\n};\n"]}
@@ -1,4 +1,5 @@
1
- import type { CloudpackConfig, readConfig } from '@ms-cloudpack/config';
1
+ import type { CloudpackConfig } from '@ms-cloudpack/config-types';
2
+ import type { readConfig } from '@ms-cloudpack/config';
2
3
  import type { TaskReporter } from '@ms-cloudpack/task-reporter';
3
4
  import type { TelemetryClient } from '@ms-cloudpack/telemetry';
4
5
  export type CreateCommandContext = () => Promise<CommandContext>;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandContext.d.ts","sourceRoot":"","sources":["../../src/types/CommandContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,qBAAqB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;CAC9E"}
1
+ {"version":3,"file":"CommandContext.d.ts","sourceRoot":"","sources":["../../src/types/CommandContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,qBAAqB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;CAC9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"CommandContext.js","sourceRoot":"","sources":["../../src/types/CommandContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { CloudpackConfig, readConfig } from '@ms-cloudpack/config';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\n\nexport type CreateCommandContext = () => Promise<CommandContext>;\n\nexport interface CommandContext {\n reporter: TaskReporter;\n readConfig: typeof readConfig;\n createTelemetryClient: (config: CloudpackConfig) => Promise<TelemetryClient>;\n}\n"]}
1
+ {"version":3,"file":"CommandContext.js","sourceRoot":"","sources":["../../src/types/CommandContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { CloudpackConfig } from '@ms-cloudpack/config-types';\nimport type { readConfig } from '@ms-cloudpack/config';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\n\nexport type CreateCommandContext = () => Promise<CommandContext>;\n\nexport interface CommandContext {\n reporter: TaskReporter;\n readConfig: typeof readConfig;\n createTelemetryClient: (config: CloudpackConfig) => Promise<TelemetryClient>;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.49.17",
3
+ "version": "0.50.1",
4
4
  "description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -10,13 +10,14 @@
10
10
  "cloudpack": "./bin/cloudpack.js"
11
11
  },
12
12
  "dependencies": {
13
- "@ms-cloudpack/api-server": "^0.26.3",
14
- "@ms-cloudpack/config": "^0.15.0",
13
+ "@ms-cloudpack/api-server": "^0.27.1",
14
+ "@ms-cloudpack/config": "^0.17.0",
15
+ "@ms-cloudpack/config-types": "^0.1.0",
15
16
  "@ms-cloudpack/create-express-app": "^1.3.12",
16
- "@ms-cloudpack/json-utilities": "^0.1.0",
17
- "@ms-cloudpack/overlay": "^0.16.22",
18
- "@ms-cloudpack/package-hashes": "^0.1.2",
19
- "@ms-cloudpack/package-utilities": "^5.4.0",
17
+ "@ms-cloudpack/json-utilities": "^0.1.1",
18
+ "@ms-cloudpack/overlay": "^0.16.24",
19
+ "@ms-cloudpack/package-hashes": "^0.2.1",
20
+ "@ms-cloudpack/package-utilities": "^5.5.1",
20
21
  "@ms-cloudpack/path-string-parsing": "^1.1.1",
21
22
  "@ms-cloudpack/task-reporter": "^0.10.0",
22
23
  "@ms-cloudpack/telemetry": "^0.4.3",