@ms-cloudpack/cli 0.78.1 → 0.79.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,49 @@
1
1
  # Change Log - @ms-cloudpack/cli
2
2
 
3
- <!-- This log was last generated on Fri, 27 Mar 2026 21:15:10 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Tue, 31 Mar 2026 22:10:39 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.79.1
8
+
9
+ Tue, 31 Mar 2026 22:10:39 GMT
10
+
11
+ ### Patches
12
+
13
+ - `@ms-cloudpack/cli`
14
+ - Update TaskReporter usage, and clear screen at beginning of start command (elcraig@microsoft.com)
15
+ - `@ms-cloudpack/task-reporter`
16
+ - Add enableReset option and if it's not set, don't track console/task outputs. Also fully clear scrollback on reset. (elcraig@microsoft.com)
17
+
18
+ ## 0.79.0
19
+
20
+ Sat, 28 Mar 2026 06:27:20 GMT
21
+
22
+ ### Minor changes
23
+
24
+ - `@ms-cloudpack/api-server`
25
+ - Add analyzePackageImports for fast static analysis of package imports without bundling (stchur@microsoft.com)
26
+ - `@ms-cloudpack/cli`
27
+ - Add staticAnalysisInit feature flag support in init and auto-init before start (stchur@microsoft.com)
28
+ - `@ms-cloudpack/common-types`
29
+ - Add staticAnalysisInit feature flag (stchur@microsoft.com)
30
+ - `@ms-cloudpack/package-utilities`
31
+ - Export findPackage and its types for reuse in static analysis init (stchur@microsoft.com)
32
+
33
+ ### Patches
34
+
35
+ - `@ms-cloudpack/api-server`
36
+ - Enable staticAnalysisInit to use the same missing-dep fallback as autoUpdateEntries, with in-memory-only overrides (no disk write) when autoUpdateEntries is off (stchur@microsoft.com)
37
+ - `@ms-cloudpack/import-map`
38
+ - Generate /missing/ fallback routes in import map when staticAnalysisInit is enabled (stchur@microsoft.com)
39
+ - Add missing/ fallback routes in import map when staticAnalysisInit is enabled (stchur@microsoft.com)
40
+ - `@ms-cloudpack/bundle-server`
41
+ - Widen missing-dep fallback gate to trigger when staticAnalysisInit is enabled (stchur@microsoft.com)
42
+ - Add runtime fallback and developer warning when staticAnalysisInit misses a CJS dependency (stchur@microsoft.com)
43
+
7
44
  ## 0.78.1
8
45
 
9
- Fri, 27 Mar 2026 21:15:10 GMT
46
+ Fri, 27 Mar 2026 21:17:14 GMT
10
47
 
11
48
  ### Minor changes
12
49
 
@@ -1,4 +1,4 @@
1
- import type { EnsurePackageBundledContext } from '@ms-cloudpack/api-server';
1
+ import { type EnsurePackageBundledContext } from '@ms-cloudpack/api-server';
2
2
  import { type EvaluateImportsForOverridesOptions, type EvaluateImportsForOverridesResult } from './evaluateImportsForOverrides.js';
3
3
  import type { InitAppOptions } from './types/InitAppOptions.js';
4
4
  /**
@@ -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,0BAA0B,CAAC;AAI5E,OAAO,EAEL,KAAK,kCAAkC,EACvC,KAAK,iCAAiC,EACvC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,cAAc,GACrB,IAAI,CAAC,kCAAkC,EAAE,aAAa,GAAG,iBAAiB,CAAC,GAAG;IAC5E,WAAW,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC;CAClB,EACH,GAAG,EAAE,2BAA2B,GAC/B,OAAO,CACR,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,iBAAiB,GAAG,gBAAgB,CAAC,CAAC,GAAG;IACvF,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CACF,CA8FA"}
1
+ {"version":3,"file":"evaluatePath.d.ts","sourceRoot":"","sources":["../../../src/commands/init/evaluatePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAEL,KAAK,kCAAkC,EACvC,KAAK,iCAAiC,EACvC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,cAAc,GACrB,IAAI,CAAC,kCAAkC,EAAE,aAAa,GAAG,iBAAiB,CAAC,GAAG;IAC5E,WAAW,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC;CAClB,EACH,GAAG,EAAE,2BAA2B,GAC/B,OAAO,CACR,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,iBAAiB,GAAG,gBAAgB,CAAC,CAAC,GAAG;IACvF,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CACF,CAsHA"}
@@ -1,4 +1,4 @@
1
- import { ensurePackageBundled } from '@ms-cloudpack/api-server';
1
+ import { analyzePackageImports, ensurePackageBundled, } from '@ms-cloudpack/api-server';
2
2
  import { evaluateImportsForOverrides, } from './evaluateImportsForOverrides.js';
3
3
  import { evaluateDynamicImports } from './evaluateDynamicImports.js';
4
4
  /**
@@ -17,23 +17,47 @@ export async function evaluatePath(options, ctx) {
17
17
  const definition = await packages.get(packagePath, { refresh: true, importerContext });
18
18
  const { name, version } = definition;
19
19
  console.debug(`Evaluating ${packagePath} with context ${JSON.stringify(importerContext)}`);
20
- // Bundle the package and find the imports it depends on.
21
- const { result } = await ensurePackageBundled({
22
- name,
23
- version,
24
- isIncremental: false,
25
- shouldGetBundleInfo: true,
26
- shouldForce,
27
- shouldRerun: shouldForce,
28
- useHashAsId: isMultiApp,
29
- priority,
30
- disableCache: !initOptions.cache,
31
- }, ctx);
32
- // Record the results for the summary.
33
- summaryData.recordResult(packagePath, result);
34
- // If there were errors or no imports, return early.
35
- const { info } = result;
36
- if (result.errors?.length || !info) {
20
+ let info;
21
+ if (features?.staticAnalysisInit) {
22
+ // Use fast static analysis instead of bundling to discover imports.
23
+ try {
24
+ info = await analyzePackageImports({ packagePath, packages });
25
+ summaryData.recordResult(packagePath, { name, version, info });
26
+ }
27
+ catch (error) {
28
+ summaryData.recordException({
29
+ packagePath,
30
+ error,
31
+ source: 'analyzePackageImports',
32
+ context: 'analyzing package imports',
33
+ name,
34
+ version,
35
+ });
36
+ return {};
37
+ }
38
+ }
39
+ else {
40
+ // Bundle the package and find the imports it depends on.
41
+ const { result } = await ensurePackageBundled({
42
+ name,
43
+ version,
44
+ isIncremental: false,
45
+ shouldGetBundleInfo: true,
46
+ shouldForce,
47
+ shouldRerun: shouldForce,
48
+ useHashAsId: isMultiApp,
49
+ priority,
50
+ disableCache: !initOptions.cache,
51
+ }, ctx);
52
+ // Record the results for the summary.
53
+ summaryData.recordResult(packagePath, result);
54
+ info = result.info;
55
+ // If there were errors, return early.
56
+ if (result.errors?.length) {
57
+ return {};
58
+ }
59
+ }
60
+ if (!info) {
37
61
  return {};
38
62
  }
39
63
  // Given the package imports, find the missing exports maps and update packageOverrides.
@@ -1 +1 @@
1
- {"version":3,"file":"evaluatePath.js","sourceRoot":"","sources":["../../../src/commands/init/evaluatePath.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EACL,2BAA2B,GAG5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAKG,EACH,GAAgC;IAOhC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG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MAAM,EAAE,cAAc,IAAI,qBAAqB,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,4BAA4B;SAC/G,CAAC,CAAC;QAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,eAAe;QACf,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["import type { EnsurePackageBundledContext } from '@ms-cloudpack/api-server';\nimport type { GeneratedPackageChanges } from './types/GeneratedPackageChanges.js';\n\nimport { ensurePackageBundled } from '@ms-cloudpack/api-server';\nimport {\n evaluateImportsForOverrides,\n type EvaluateImportsForOverridesOptions,\n type EvaluateImportsForOverridesResult,\n} from './evaluateImportsForOverrides.js';\nimport { evaluateDynamicImports } from './evaluateDynamicImports.js';\nimport type { InitAppOptions } from './types/InitAppOptions.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(\n options: InitAppOptions &\n Pick<EvaluateImportsForOverridesOptions, 'packagePath' | 'importerContext'> & {\n shouldForce: boolean;\n /** The priority of the package being evaluated. To be used in the task runner. */\n priority: number;\n },\n ctx: EnsurePackageBundledContext,\n): Promise<\n Partial<Pick<EvaluateImportsForOverridesResult, 'pathsToEvaluate' | 'pathsToRefresh'>> & {\n /** Whether a fatal error was encountered. */\n shouldExit?: boolean;\n }\n> {\n const { packagePath, initOptions, span, summaryData, importerContext, shouldForce, isMultiApp, priority } = options;\n const { packages, session } = ctx;\n const { config } = session;\n const { features } = config;\n\n // This line is the reason we have to track the importerContext for packages to evaluate:\n // otherwise if a non-semver package is read here, we'd lose the modifications from the initial\n // time the package was read (and getNonSemverTransform was called) when building the resolve map.\n const definition = await packages.get(packagePath, { refresh: true, importerContext });\n const { name, version } = definition;\n\n console.debug(`Evaluating ${packagePath} with context ${JSON.stringify(importerContext)}`);\n\n // Bundle the package and find the imports it depends on.\n const { result } = await ensurePackageBundled(\n {\n name,\n version,\n isIncremental: false,\n shouldGetBundleInfo: true,\n shouldForce,\n shouldRerun: shouldForce,\n useHashAsId: isMultiApp,\n priority,\n disableCache: !initOptions.cache,\n },\n ctx,\n );\n\n // Record the results for the summary.\n summaryData.recordResult(packagePath, result);\n\n // If there were errors or no imports, return early.\n const { info } = result;\n if (result.errors?.length || !info) {\n return {};\n }\n\n // Given the package imports, find the missing exports maps and update packageOverrides.\n const {\n exportsChanges,\n includedDependenciesChanges,\n removedExcludedDependenciesChanges,\n errors: evalErrors,\n warnings: evalWarnings,\n pathsToEvaluate,\n pathsToRefresh,\n } = await evaluateImportsForOverrides({ definition, packagePath, info, importerContext }, ctx);\n\n if (evalErrors.length) {\n summaryData.addErrors(packagePath, evalErrors);\n }\n if (evalWarnings.length) {\n summaryData.addWarnings(packagePath, evalWarnings);\n }\n summaryData.recordGeneratedChanges(exportsChanges);\n summaryData.recordGeneratedChanges(includedDependenciesChanges);\n summaryData.recordGeneratedChanges(removedExcludedDependenciesChanges);\n\n let dynamicImportsChanges: undefined | GeneratedPackageChanges[] = undefined;\n if (features?.evaluateDynamicImports) {\n const dynamicImportsResult = await evaluateDynamicImports({ definition, packagePath, info }, ctx);\n\n dynamicImportsChanges = dynamicImportsResult.dynamicImportsChanges;\n\n summaryData.recordGeneratedChanges(dynamicImportsChanges);\n\n if (dynamicImportsResult.shouldReevaluate) {\n pathsToEvaluate.set(packagePath, importerContext);\n }\n if (dynamicImportsResult.shouldRefresh) {\n pathsToRefresh.add(packagePath);\n }\n }\n\n // Uncomment this when #1694 init does not cache packages correctly after editing config is fixed\n // and the heap does not reach the limit as almost every package is enqueued.\n // importPathsToEvaluate?.forEach((path) => pathsToEvaluate.set(path, importerContext));\n // importPathsToRefresh?.forEach((path) => pathsToRefresh.add(path));\n\n if (initOptions.check && (exportsChanges.length || evalErrors.length || dynamicImportsChanges?.length)) {\n span.addEvent('INIT_CHECK_FAILED', {\n // Don't log the specific errors to telemetry, as they may contain sensitive information.\n reason: exportsChanges || dynamicImportsChanges ? 'Config needs to be updated.' : 'Errors found with imports.',\n });\n\n return { shouldExit: true };\n }\n\n return {\n pathsToEvaluate,\n pathsToRefresh,\n };\n}\n"]}
1
+ {"version":3,"file":"evaluatePath.js","sourceRoot":"","sources":["../../../src/commands/init/evaluatePath.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,2BAA2B,GAG5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAKG,EACH,GAAgC;IAOhC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACpH,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IAClC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE5B,yFAAyF;IACzF,+FAA+F;IAC/F,kGAAkG;IAClG,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IACvF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAErC,OAAO,CAAC,KAAK,CAAC,cAAc,WAAW,iBAAiB,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAE3F,IAAI,IAA4B,CAAC;IAEjC,IAAI,QAAQ,EAAE,kBAAkB,EAAE,CAAC;QACjC,oEAAoE;QACpE,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,qBAAq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AAC,6BAA6B,CAAC,CAAC,CAAC,4BAA4B;SAC/G,CAAC,CAAC;QAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,eAAe;QACf,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["import {\n analyzePackageImports,\n ensurePackageBundled,\n type BundleInfo,\n type EnsurePackageBundledContext,\n} from '@ms-cloudpack/api-server';\nimport type { GeneratedPackageChanges } from './types/GeneratedPackageChanges.js';\nimport {\n evaluateImportsForOverrides,\n type EvaluateImportsForOverridesOptions,\n type EvaluateImportsForOverridesResult,\n} from './evaluateImportsForOverrides.js';\nimport { evaluateDynamicImports } from './evaluateDynamicImports.js';\nimport type { InitAppOptions } from './types/InitAppOptions.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(\n options: InitAppOptions &\n Pick<EvaluateImportsForOverridesOptions, 'packagePath' | 'importerContext'> & {\n shouldForce: boolean;\n /** The priority of the package being evaluated. To be used in the task runner. */\n priority: number;\n },\n ctx: EnsurePackageBundledContext,\n): Promise<\n Partial<Pick<EvaluateImportsForOverridesResult, 'pathsToEvaluate' | 'pathsToRefresh'>> & {\n /** Whether a fatal error was encountered. */\n shouldExit?: boolean;\n }\n> {\n const { packagePath, initOptions, span, summaryData, importerContext, shouldForce, isMultiApp, priority } = options;\n const { packages, session } = ctx;\n const { config } = session;\n const { features } = config;\n\n // This line is the reason we have to track the importerContext for packages to evaluate:\n // otherwise if a non-semver package is read here, we'd lose the modifications from the initial\n // time the package was read (and getNonSemverTransform was called) when building the resolve map.\n const definition = await packages.get(packagePath, { refresh: true, importerContext });\n const { name, version } = definition;\n\n console.debug(`Evaluating ${packagePath} with context ${JSON.stringify(importerContext)}`);\n\n let info: BundleInfo | undefined;\n\n if (features?.staticAnalysisInit) {\n // Use fast static analysis instead of bundling to discover imports.\n try {\n info = await analyzePackageImports({ packagePath, packages });\n summaryData.recordResult(packagePath, { name, version, info });\n } catch (error) {\n summaryData.recordException({\n packagePath,\n error,\n source: 'analyzePackageImports',\n context: 'analyzing package imports',\n name,\n version,\n });\n return {};\n }\n } else {\n // Bundle the package and find the imports it depends on.\n const { result } = await ensurePackageBundled(\n {\n name,\n version,\n isIncremental: false,\n shouldGetBundleInfo: true,\n shouldForce,\n shouldRerun: shouldForce,\n useHashAsId: isMultiApp,\n priority,\n disableCache: !initOptions.cache,\n },\n ctx,\n );\n\n // Record the results for the summary.\n summaryData.recordResult(packagePath, result);\n info = result.info;\n\n // If there were errors, return early.\n if (result.errors?.length) {\n return {};\n }\n }\n\n if (!info) {\n return {};\n }\n\n // Given the package imports, find the missing exports maps and update packageOverrides.\n const {\n exportsChanges,\n includedDependenciesChanges,\n removedExcludedDependenciesChanges,\n errors: evalErrors,\n warnings: evalWarnings,\n pathsToEvaluate,\n pathsToRefresh,\n } = await evaluateImportsForOverrides({ definition, packagePath, info, importerContext }, ctx);\n\n if (evalErrors.length) {\n summaryData.addErrors(packagePath, evalErrors);\n }\n if (evalWarnings.length) {\n summaryData.addWarnings(packagePath, evalWarnings);\n }\n summaryData.recordGeneratedChanges(exportsChanges);\n summaryData.recordGeneratedChanges(includedDependenciesChanges);\n summaryData.recordGeneratedChanges(removedExcludedDependenciesChanges);\n\n let dynamicImportsChanges: undefined | GeneratedPackageChanges[] = undefined;\n if (features?.evaluateDynamicImports) {\n const dynamicImportsResult = await evaluateDynamicImports({ definition, packagePath, info }, ctx);\n\n dynamicImportsChanges = dynamicImportsResult.dynamicImportsChanges;\n\n summaryData.recordGeneratedChanges(dynamicImportsChanges);\n\n if (dynamicImportsResult.shouldReevaluate) {\n pathsToEvaluate.set(packagePath, importerContext);\n }\n if (dynamicImportsResult.shouldRefresh) {\n pathsToRefresh.add(packagePath);\n }\n }\n\n // Uncomment this when #1694 init does not cache packages correctly after editing config is fixed\n // and the heap does not reach the limit as almost every package is enqueued.\n // importPathsToEvaluate?.forEach((path) => pathsToEvaluate.set(path, importerContext));\n // importPathsToRefresh?.forEach((path) => pathsToRefresh.add(path));\n\n if (initOptions.check && (exportsChanges.length || evalErrors.length || dynamicImportsChanges?.length)) {\n span.addEvent('INIT_CHECK_FAILED', {\n // Don't log the specific errors to telemetry, as they may contain sensitive information.\n reason: exportsChanges || dynamicImportsChanges ? 'Config needs to be updated.' : 'Errors found with imports.',\n });\n\n return { shouldExit: true };\n }\n\n return {\n pathsToEvaluate,\n pathsToRefresh,\n };\n}\n"]}
@@ -10,5 +10,10 @@ export declare function init(params: Pick<CommandActionParams<InitOptions>, keyo
10
10
  * if the process is interrupted.
11
11
  */
12
12
  summaryData: InitSummaryData;
13
+ /**
14
+ * Skip writing the generated config to disk. Useful when init is run
15
+ * inline before start, since the in-memory config is all that's needed.
16
+ */
17
+ skipWrite?: boolean;
13
18
  }): Promise<void>;
14
19
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAU3F;;GAEG;AACH,wBAAsB,IAAI,CACxB,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,iBAAiB,GAAG,SAAS,GAAG,YAAY,CAAC,GAAG;IACnG;;;OAGG;IACH,WAAW,EAAE,eAAe,CAAC;CAC9B,GACA,OAAO,CAAC,IAAI,CAAC,CAgBf"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAU3F;;GAEG;AACH,wBAAsB,IAAI,CACxB,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,iBAAiB,GAAG,SAAS,GAAG,YAAY,CAAC,GAAG;IACnG;;;OAGG;IACH,WAAW,EAAE,eAAe,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACA,OAAO,CAAC,IAAI,CAAC,CAgBf"}
@@ -13,7 +13,7 @@ import { SequentialPromiseExecutor } from '../../utilities/sequentialPromiseExec
13
13
  * Init execution function.
14
14
  */
15
15
  export async function init(params) {
16
- const { options: initOptions, summaryData, isMultiApp, config, telemetryClient } = params;
16
+ const { options: initOptions, summaryData, isMultiApp, config, telemetryClient, skipWrite } = params;
17
17
  await telemetryClient.tracer.startActiveSpan('INIT_APP', async (span) => {
18
18
  // Run prerequisites for the app.
19
19
  await runPrerequisites(params);
@@ -22,7 +22,7 @@ export async function init(params) {
22
22
  config.generated = {};
23
23
  }
24
24
  const context = await createPartialApiContext(params);
25
- await initApp({ span, summaryData, initOptions, isMultiApp }, context);
25
+ await initApp({ span, summaryData, initOptions, isMultiApp, skipWrite }, context);
26
26
  });
27
27
  }
28
28
  async function initApp(options, context) {
@@ -154,7 +154,7 @@ async function initApp(options, context) {
154
154
  // The feature "removeUnusedExports" doesn't (yet) write summary changes, but we still
155
155
  // want to write the generated config if that featureFlag is on.
156
156
  const hasSummaryChanges = config.features?.removeUnusedExports || summaryData.hasChanges();
157
- if (!initOptions.check && hasSummaryChanges) {
157
+ if (!initOptions.check && !options.skipWrite && hasSummaryChanges) {
158
158
  // Update the generated config: either write it if there are settings, or delete it if it
159
159
  // previously existed but is no longer needed.
160
160
  const generatedResult = await writeGeneratedConfig(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AC7C,CAAC;QACH,CAAC;IACH,CAAC;IAED,sFAAsF;IACtF,gEAAgE;IAChE,MAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,EAAE,mBAAmB,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;IAE3F,IAAI,CAAC,WAAW,CAAC,KAAK,IAAI,iBAAiB,EAAE,CAAC;QAC5C,yFAAyF;QACzF,8CAA8C;QAC9C,MAAM,eAAe,GAAG,MAAM,oBAAoB,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC9E,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YAClC,WAAW,CAAC,sBAAsB,GAAG,IAAI,CAAC;QAC5C,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { EnsurePackageBundledContext } from '@ms-cloudpack/api-server';\nimport type { PackageImporterContext } from '@ms-cloudpack/common-types';\nimport type { InitOptions } from './types/InitOptions.js';\n\nimport { createPartialApiContext } from '@ms-cloudpack/api-server';\nimport { writeGeneratedConfig } from '@ms-cloudpack/config';\nimport type { InitSummaryData } from './InitSummaryData.js';\nimport { evaluatePath } from './evaluatePath.js';\nimport { verifyExports } from './verifyExports.js';\nimport type { AppCommandContext, CommandActionParams } from '../../types/CommandAction.js';\nimport path from 'path';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { runPrerequisites } from '../../utilities/runPrerequisites.js';\nimport { getFilteredPackages } from '../../utilities/getFilteredPackages.js';\nimport { optimizeDependencies } from './optimizeDependencies.js';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\nimport type { InitAppOptions } from './types/InitAppOptions.js';\nimport { SequentialPromiseExecutor } from '../../utilities/sequentialPromiseExecutor.js';\n\n/**\n * Init execution function.\n */\nexport async function init(\n params: Pick<CommandActionParams<InitOptions>, keyof AppCommandContext | 'options' | 'isMultiApp'> & {\n /**\n * App summary object, created ahead of time so that a partial summary can be generated\n * if the process is interrupted.\n */\n summaryData: InitSummaryData;\n },\n): Promise<void> {\n const { options: initOptions, summaryData, isMultiApp, config, telemetryClient } = params;\n\n await telemetryClient.tracer.startActiveSpan('INIT_APP', async (span) => {\n // Run prerequisites for the app.\n await runPrerequisites(params);\n\n // If --reset is specified, reset the generated config.\n if (initOptions.reset) {\n config.generated = {};\n }\n\n const context = await createPartialApiContext(params);\n\n await initApp({ span, summaryData, initOptions, isMultiApp }, context);\n });\n}\n\nasync function initApp(options: InitAppOptions, context: EnsurePackageBundledContext): Promise<void> {\n const { initOptions, summaryData, span, isMultiApp } = options;\n const { match } = initOptions;\n const { config, resolveMap } = context.session;\n const { appPath } = config;\n const executor = new SequentialPromiseExecutor();\n\n // Ensure config.generated.packageSettings is initialized.\n config.generated.packageSettings ??= [];\n\n let isExitingPrematurely = false;\n\n await new Promise<void>((resolve) => {\n let pending = 0;\n const visitedSet = new Set<string>();\n const refreshPaths = new Set<string>();\n const priorityMap = new Map<string, number>();\n\n // Start with the app path or requested matches\n const initialPaths = match ? getFilteredPackages(resolveMap, match) : [appPath];\n if (!initialPaths.length) {\n summaryData.addErrors(appPath, [{ text: `No packages found matching ${JSON.stringify(match)}`, source: 'init' }]);\n resolve();\n }\n\n enqueuePaths(new Map(initialPaths.map((packagePath) => [packagePath, undefined])));\n\n /**\n * Enqueue more paths.\n * @param newPaths Mapping from package path to importer context.\n */\n function enqueuePaths(newPaths: Map<string, PackageImporterContext | undefined>): void {\n if (isExitingPrematurely) {\n return;\n }\n\n // Iterate through the given paths.\n for (const [packagePath, importerContext] of newPaths) {\n if (visitedSet.has(packagePath)) {\n console.debug(`Skipping ${packagePath} as it has already been visited.`);\n continue;\n }\n\n visitedSet.add(packagePath);\n pending++;\n\n const shouldForce = refreshPaths.delete(packagePath);\n\n // Get the priority value for this package path, defaults to 0.\n const priority = priorityMap.get(packagePath) ?? 0;\n // Lower priority of this package path by 1.\n priorityMap.set(packagePath, priority - 1);\n\n // Use the sequential executor to run the evaluation to avoid concurrency issues.\n executor\n .execute(packagePath, () =>\n // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.\n evaluatePath(\n {\n ...options,\n packagePath,\n importerContext,\n // No need to force if we're in a multi-app scenario\n // as we'll re-evaluate packages if they are different since we use a different task id.\n shouldForce: !isMultiApp && shouldForce,\n priority,\n },\n context,\n ),\n )\n .then(({ pathsToEvaluate, pathsToRefresh, shouldExit }) => {\n pending--;\n\n if (shouldExit) {\n isExitingPrematurely = true;\n } else if (pathsToEvaluate?.size) {\n // If there are packages that need to be rebuilt, delete them from the visited set to re-enqueue them\n // and add them to the refresh set so that on re-enqueuing we pass the `shouldRerun` flag through\n // on single app runs.\n pathsToRefresh?.forEach((refreshPath) => {\n refreshPaths.add(refreshPath);\n visitedSet.delete(refreshPath);\n });\n\n // Try to enqueue the new paths.\n console.debug(\n `Enqueuing paths found from ${packagePath}:\\n` +\n bulletedList(\n [...pathsToEvaluate].map(([newPath, newContext]) => `${newPath} ${JSON.stringify(newContext)}`),\n ),\n );\n enqueuePaths(pathsToEvaluate);\n }\n\n // If nothing is pending after this call, we're complete.\n if (!pending) {\n resolve();\n }\n })\n .catch((error: unknown) => {\n // Record the exception as an init error for the package.\n // This gives better context than a stack trace which could have come from any package.\n let prefix = 'evaluating package';\n if (importerContext) {\n prefix += ` (context: ${JSON.stringify(importerContext, null, 2).replace(/\\s+/g, ' ')})`;\n }\n summaryData.recordException({ packagePath, error, source: 'init', context: prefix });\n\n // Don't immediately stop evaluation, but don't enqueue more paths.\n isExitingPrematurely = true;\n });\n }\n }\n }).catch((error: unknown) => {\n // If there's an error thrown from some other part of the promise besides evaluatePath (not likely),\n // record it as an init error for the app instead of allowing it to propagate.\n // This allows the overall init summary and any other errors to be logged as usual.\n isExitingPrematurely = true;\n summaryData.recordException({ packagePath: appPath, error, source: 'init', context: 'running init' });\n });\n\n // Clear the executor so that it doesn't hold onto any references to the promises.\n executor.clear();\n\n // Log the resolve map to a file if requested. Do this *after* the main init process in case\n // any additional deps were discovered and added.\n if (initOptions.logResolveMap) {\n console.log('\\nWriting resolve map to `resolve-map.json`.');\n await writeJson(path.join(appPath, 'resolve-map.json'), resolveMap);\n }\n\n if (isExitingPrematurely) {\n span.setAttribute('isExitingPrematurely', true);\n } else {\n // Only do extra checks if there's not a major error already\n if (config.features?.optimizeDependencies) {\n // Conditionally scan dependency usage so that we can populate\n // include/excludeDependencies automatically, ensuring the dep list\n // is both minimal (remove unused deps) and complete (include\n // specific devDeps.)\n const excludedDependenciesChanges = await optimizeDependencies(summaryData.getResults(), context);\n summaryData.recordGeneratedChanges(excludedDependenciesChanges);\n }\n\n if (config.features?.verifyExports) {\n const packageResults = await verifyExports(summaryData.getResults(), context);\n for (const [packagePath, errors] of Object.entries(packageResults)) {\n summaryData.addErrors(packagePath, errors);\n }\n }\n }\n\n // The feature \"removeUnusedExports\" doesn't (yet) write summary changes, but we still\n // want to write the generated config if that featureFlag is on.\n const hasSummaryChanges = config.features?.removeUnusedExports || summaryData.hasChanges();\n\n if (!initOptions.check && hasSummaryChanges) {\n // Update the generated config: either write it if there are settings, or delete it if it\n // previously existed but is no longer needed.\n const generatedResult = await writeGeneratedConfig(config.generated, appPath);\n if (generatedResult === 'deleted') {\n summaryData.deletedGeneratedConfig = true;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7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;AACH,CAAC","sourcesContent":["import type { EnsurePackageBundledContext } from '@ms-cloudpack/api-server';\nimport type { PackageImporterContext } from '@ms-cloudpack/common-types';\nimport type { InitOptions } from './types/InitOptions.js';\n\nimport { createPartialApiContext } from '@ms-cloudpack/api-server';\nimport { writeGeneratedConfig } from '@ms-cloudpack/config';\nimport type { InitSummaryData } from './InitSummaryData.js';\nimport { evaluatePath } from './evaluatePath.js';\nimport { verifyExports } from './verifyExports.js';\nimport type { AppCommandContext, CommandActionParams } from '../../types/CommandAction.js';\nimport path from 'path';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { runPrerequisites } from '../../utilities/runPrerequisites.js';\nimport { getFilteredPackages } from '../../utilities/getFilteredPackages.js';\nimport { optimizeDependencies } from './optimizeDependencies.js';\nimport { bulletedList } from '@ms-cloudpack/task-reporter';\nimport type { InitAppOptions } from './types/InitAppOptions.js';\nimport { SequentialPromiseExecutor } from '../../utilities/sequentialPromiseExecutor.js';\n\n/**\n * Init execution function.\n */\nexport async function init(\n params: Pick<CommandActionParams<InitOptions>, keyof AppCommandContext | 'options' | 'isMultiApp'> & {\n /**\n * App summary object, created ahead of time so that a partial summary can be generated\n * if the process is interrupted.\n */\n summaryData: InitSummaryData;\n /**\n * Skip writing the generated config to disk. Useful when init is run\n * inline before start, since the in-memory config is all that's needed.\n */\n skipWrite?: boolean;\n },\n): Promise<void> {\n const { options: initOptions, summaryData, isMultiApp, config, telemetryClient, skipWrite } = params;\n\n await telemetryClient.tracer.startActiveSpan('INIT_APP', async (span) => {\n // Run prerequisites for the app.\n await runPrerequisites(params);\n\n // If --reset is specified, reset the generated config.\n if (initOptions.reset) {\n config.generated = {};\n }\n\n const context = await createPartialApiContext(params);\n\n await initApp({ span, summaryData, initOptions, isMultiApp, skipWrite }, context);\n });\n}\n\nasync function initApp(options: InitAppOptions, context: EnsurePackageBundledContext): Promise<void> {\n const { initOptions, summaryData, span, isMultiApp } = options;\n const { match } = initOptions;\n const { config, resolveMap } = context.session;\n const { appPath } = config;\n const executor = new SequentialPromiseExecutor();\n\n // Ensure config.generated.packageSettings is initialized.\n config.generated.packageSettings ??= [];\n\n let isExitingPrematurely = false;\n\n await new Promise<void>((resolve) => {\n let pending = 0;\n const visitedSet = new Set<string>();\n const refreshPaths = new Set<string>();\n const priorityMap = new Map<string, number>();\n\n // Start with the app path or requested matches\n const initialPaths = match ? getFilteredPackages(resolveMap, match) : [appPath];\n if (!initialPaths.length) {\n summaryData.addErrors(appPath, [{ text: `No packages found matching ${JSON.stringify(match)}`, source: 'init' }]);\n resolve();\n }\n\n enqueuePaths(new Map(initialPaths.map((packagePath) => [packagePath, undefined])));\n\n /**\n * Enqueue more paths.\n * @param newPaths Mapping from package path to importer context.\n */\n function enqueuePaths(newPaths: Map<string, PackageImporterContext | undefined>): void {\n if (isExitingPrematurely) {\n return;\n }\n\n // Iterate through the given paths.\n for (const [packagePath, importerContext] of newPaths) {\n if (visitedSet.has(packagePath)) {\n console.debug(`Skipping ${packagePath} as it has already been visited.`);\n continue;\n }\n\n visitedSet.add(packagePath);\n pending++;\n\n const shouldForce = refreshPaths.delete(packagePath);\n\n // Get the priority value for this package path, defaults to 0.\n const priority = priorityMap.get(packagePath) ?? 0;\n // Lower priority of this package path by 1.\n priorityMap.set(packagePath, priority - 1);\n\n // Use the sequential executor to run the evaluation to avoid concurrency issues.\n executor\n .execute(packagePath, () =>\n // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.\n evaluatePath(\n {\n ...options,\n packagePath,\n importerContext,\n // No need to force if we're in a multi-app scenario\n // as we'll re-evaluate packages if they are different since we use a different task id.\n shouldForce: !isMultiApp && shouldForce,\n priority,\n },\n context,\n ),\n )\n .then(({ pathsToEvaluate, pathsToRefresh, shouldExit }) => {\n pending--;\n\n if (shouldExit) {\n isExitingPrematurely = true;\n } else if (pathsToEvaluate?.size) {\n // If there are packages that need to be rebuilt, delete them from the visited set to re-enqueue them\n // and add them to the refresh set so that on re-enqueuing we pass the `shouldRerun` flag through\n // on single app runs.\n pathsToRefresh?.forEach((refreshPath) => {\n refreshPaths.add(refreshPath);\n visitedSet.delete(refreshPath);\n });\n\n // Try to enqueue the new paths.\n console.debug(\n `Enqueuing paths found from ${packagePath}:\\n` +\n bulletedList(\n [...pathsToEvaluate].map(([newPath, newContext]) => `${newPath} ${JSON.stringify(newContext)}`),\n ),\n );\n enqueuePaths(pathsToEvaluate);\n }\n\n // If nothing is pending after this call, we're complete.\n if (!pending) {\n resolve();\n }\n })\n .catch((error: unknown) => {\n // Record the exception as an init error for the package.\n // This gives better context than a stack trace which could have come from any package.\n let prefix = 'evaluating package';\n if (importerContext) {\n prefix += ` (context: ${JSON.stringify(importerContext, null, 2).replace(/\\s+/g, ' ')})`;\n }\n summaryData.recordException({ packagePath, error, source: 'init', context: prefix });\n\n // Don't immediately stop evaluation, but don't enqueue more paths.\n isExitingPrematurely = true;\n });\n }\n }\n }).catch((error: unknown) => {\n // If there's an error thrown from some other part of the promise besides evaluatePath (not likely),\n // record it as an init error for the app instead of allowing it to propagate.\n // This allows the overall init summary and any other errors to be logged as usual.\n isExitingPrematurely = true;\n summaryData.recordException({ packagePath: appPath, error, source: 'init', context: 'running init' });\n });\n\n // Clear the executor so that it doesn't hold onto any references to the promises.\n executor.clear();\n\n // Log the resolve map to a file if requested. Do this *after* the main init process in case\n // any additional deps were discovered and added.\n if (initOptions.logResolveMap) {\n console.log('\\nWriting resolve map to `resolve-map.json`.');\n await writeJson(path.join(appPath, 'resolve-map.json'), resolveMap);\n }\n\n if (isExitingPrematurely) {\n span.setAttribute('isExitingPrematurely', true);\n } else {\n // Only do extra checks if there's not a major error already\n if (config.features?.optimizeDependencies) {\n // Conditionally scan dependency usage so that we can populate\n // include/excludeDependencies automatically, ensuring the dep list\n // is both minimal (remove unused deps) and complete (include\n // specific devDeps.)\n const excludedDependenciesChanges = await optimizeDependencies(summaryData.getResults(), context);\n summaryData.recordGeneratedChanges(excludedDependenciesChanges);\n }\n\n if (config.features?.verifyExports) {\n const packageResults = await verifyExports(summaryData.getResults(), context);\n for (const [packagePath, errors] of Object.entries(packageResults)) {\n summaryData.addErrors(packagePath, errors);\n }\n }\n }\n\n // The feature \"removeUnusedExports\" doesn't (yet) write summary changes, but we still\n // want to write the generated config if that featureFlag is on.\n const hasSummaryChanges = config.features?.removeUnusedExports || summaryData.hasChanges();\n\n if (!initOptions.check && !options.skipWrite && hasSummaryChanges) {\n // Update the generated config: either write it if there are settings, or delete it if it\n // previously existed but is no longer needed.\n const generatedResult = await writeGeneratedConfig(config.generated, appPath);\n if (generatedResult === 'deleted') {\n summaryData.deletedGeneratedConfig = true;\n }\n }\n}\n"]}
@@ -12,5 +12,7 @@ export interface InitAppOptions extends Pick<CommandActionParams<object>, 'isMul
12
12
  summaryData: InitSummaryData;
13
13
  /** Span for the INIT_APP operation. */
14
14
  span: Span;
15
+ /** Skip writing the generated config to disk. */
16
+ skipWrite?: boolean;
15
17
  }
16
18
  //# sourceMappingURL=InitAppOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InitAppOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/types/InitAppOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IACrF,kBAAkB;IAClB,WAAW,EAAE,WAAW,CAAC;IAEzB;;;OAGG;IACH,WAAW,EAAE,eAAe,CAAC;IAE7B,uCAAuC;IACvC,IAAI,EAAE,IAAI,CAAC;CACZ"}
1
+ {"version":3,"file":"InitAppOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/types/InitAppOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IACrF,kBAAkB;IAClB,WAAW,EAAE,WAAW,CAAC;IAEzB;;;OAGG;IACH,WAAW,EAAE,eAAe,CAAC;IAE7B,uCAAuC;IACvC,IAAI,EAAE,IAAI,CAAC;IAEX,iDAAiD;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"InitAppOptions.js","sourceRoot":"","sources":["../../../../src/commands/init/types/InitAppOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { Span } from '@ms-cloudpack/telemetry';\nimport type { CommandActionParams } from '../../../types/CommandAction.js';\nimport type { InitSummaryData } from '../InitSummaryData.js';\nimport type { InitOptions } from './InitOptions.js';\n\nexport interface InitAppOptions extends Pick<CommandActionParams<object>, 'isMultiApp'> {\n /** CLI options */\n initOptions: InitOptions;\n\n /**\n * App summary object, created ahead of time so that a partial summary can be generated\n * if the process is interrupted.\n */\n summaryData: InitSummaryData;\n\n /** Span for the INIT_APP operation. */\n span: Span;\n}\n"]}
1
+ {"version":3,"file":"InitAppOptions.js","sourceRoot":"","sources":["../../../../src/commands/init/types/InitAppOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { Span } from '@ms-cloudpack/telemetry';\nimport type { CommandActionParams } from '../../../types/CommandAction.js';\nimport type { InitSummaryData } from '../InitSummaryData.js';\nimport type { InitOptions } from './InitOptions.js';\n\nexport interface InitAppOptions extends Pick<CommandActionParams<object>, 'isMultiApp'> {\n /** CLI options */\n initOptions: InitOptions;\n\n /**\n * App summary object, created ahead of time so that a partial summary can be generated\n * if the process is interrupted.\n */\n summaryData: InitSummaryData;\n\n /** Span for the INIT_APP operation. */\n span: Span;\n\n /** Skip writing the generated config to disk. */\n skipWrite?: boolean;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAU5D;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CA6H/C,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAU5D;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CAyJ/C,CAAC"}
@@ -22,6 +22,30 @@ export const execute = async (params) => {
22
22
  console.log('App path:', yellow(appPath));
23
23
  console.log('Bundle mode:', yellow(options.mode));
24
24
  await runPrerequisites(params);
25
+ // Auto-run init with static analysis before start. Since static analysis is fast (~22s),
26
+ // always run it to ensure the generated config is up to date with current dependencies.
27
+ if (config.features?.staticAnalysisInit) {
28
+ const { init } = await import('../init/init.js');
29
+ const { InitSummaryData } = await import('../init/InitSummaryData.js');
30
+ const { formatInitSummary } = await import('../init/formatInitSummary.js');
31
+ config.generated = {};
32
+ console.log('Running init with static analysis...\n');
33
+ const summaryData = new InitSummaryData({ appPath });
34
+ await init({
35
+ appPath: params.appPath,
36
+ cachePath: params.cachePath,
37
+ config: params.config,
38
+ reporter: params.reporter,
39
+ taskRunner: params.taskRunner,
40
+ telemetryClient: params.telemetryClient,
41
+ options: { cache: options.cache },
42
+ skipWrite: true,
43
+ isMultiApp: false,
44
+ summaryData,
45
+ });
46
+ const summary = summaryData.summarize();
47
+ console.log(formatInitSummary({ summary, check: false, isMultiApp: false, verb: 'init' }));
48
+ }
25
49
  // If the user has specified https options in the config, parse them at start.
26
50
  // This makes sure that the HTTPS configuration is ready before starting the servers and shows errors early.
27
51
  // We need to do this after prerequisites are run, in case users setup their certs there.
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAuB,MAAM,0BAA0B,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAk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,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;IAElF,oBAAoB;IACpB,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,UAAU,CAAC,CAAC;IAClE,CAAC;SAAM,CAAC;QACN,IAAI,SAAiB,CAAC;QACtB,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrC,+FAA+F;YAC/F,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBAChF,SAAS,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;YAC7E,CAAC;iBAAM,CAAC;gBACN,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;YAC3B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,8DAA8D;YAC9D,SAAS,GAAG,UAAU,CAAC;QACzB,CAAC;QAED,KAAK,WAAW,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;YACtE,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAG,GAAyB,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;YACjF,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,UAAU,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,wBAAwB","sourcesContent":["import { createApiContext, ensurePackageBundled, type PartialContext } from '@ms-cloudpack/api-server';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { makeUrl } from '@ms-cloudpack/path-string-parsing';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport type { CommandExitParams, CommandAction } from '../../types/CommandAction.js';\nimport { runPrerequisites } from '../../utilities/runPrerequisites.js';\nimport { openBrowser } from './openBrowser.js';\nimport { trackSession } from './trackSession.js';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { getCliStartTime } from '../../utilities/getCliStartTime.js';\nimport { createApiServer } from '../../utilities/createApiServer.js';\nimport { resolveCloudpackInternalPath } from '../../utilities/resolveCloudpackInternalPath.js';\nimport { getDomain, parseHttpsConfig } from '@ms-cloudpack/create-express-app';\nimport { handleKnownParseHttpsErrors } from '../../utilities/handleKnownParseHttpsErrors.js';\nimport { createWatcher } from '@ms-cloudpack/file-watcher';\nimport { readConfig } from '@ms-cloudpack/config';\nimport { disposeServer } from '../../utilities/disposeServer.js';\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport const execute: CommandAction<StartOptions> = async (params) => {\n const { appPath, config, options, autoDispose, isRestart } = params;\n\n console.log('App path:', yellow(appPath));\n console.log('Bundle mode:', yellow(options.mode));\n\n await runPrerequisites(params);\n\n // If the user has specified https options in the config, parse them at start.\n // This makes sure that the HTTPS configuration is ready before starting the servers and shows errors early.\n // We need to do this after prerequisites are run, in case users setup their certs there.\n if (config?.server?.https) {\n try {\n const domain = getDomain(config.server.domain);\n config.server.parsedHttps = await parseHttpsConfig({ domain, https: config.server.https, cwd: appPath });\n } catch (err) {\n handleKnownParseHttpsErrors({ err, projectName: path.basename(appPath) });\n throw err;\n }\n }\n\n const overlayPath = await resolveCloudpackInternalPath({\n packageName: '@ms-cloudpack/overlay',\n importMetaUrl: import.meta.url,\n });\n\n const shouldUseRemoteCache = config.features?.enableCloudHosted || config.features?.enableRemoteCacheDownloads;\n const apiContext = autoDispose(\n await createApiContext({\n ...params,\n remoteCacheClientLoginMethod: shouldUseRemoteCache ? options.login : undefined,\n additionalPaths: overlayPath ? [overlayPath] : undefined,\n }),\n );\n const { packages, session, telemetryClient } = apiContext;\n\n return new Promise<CommandExitParams>((resolve) => {\n (async () => {\n let hasConfigChanged = false;\n const configWatcher = createWatcher();\n await Promise.all(\n config.configPaths?.appConfigPaths.map(\n (configPath) =>\n configWatcher.watch({ path: path.basename(configPath), watchPaths: [configPath] }, () => {\n if (hasConfigChanged) {\n return;\n }\n void readConfig(appPath)\n .then(() => {\n hasConfigChanged = true;\n resolve({ restart: true, message: 'Config changed. Restarting Cloudpack...' });\n })\n .catch((error) => console.warn('Config change detected, but the config file is invalid.', error));\n }) ?? [],\n ) ?? [],\n );\n\n // Set up config watcher disposal (up here in case the config changes before setup completes).\n autoDispose(configWatcher);\n\n // Increment the session version if caching is disabled.\n if (options.cache === false) {\n session.incrementSessionVersion();\n }\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n // Start api server for tracking status and handling remote requests.\n const apiServerResult = await createApiServer({ port: options.apiServerPort }, apiContext);\n if (apiServerResult.hasErrors) {\n return apiServerResult;\n }\n const { apiServer } = apiServerResult;\n autoDispose({ dispose: () => disposeServer('API server', apiServer) });\n\n // Kick off bundling app package as soon as api server is ready.\n void ensurePackageBundled(\n {\n name: definition.name,\n version: definition.version,\n shouldGetBundleInfo: options.logBundleInfo,\n },\n apiContext,\n );\n\n // Then start bundle and app servers for hosting the app.\n const { startServers } = await import('@ms-cloudpack/app-server');\n const servers = await startServers(\n {\n definition,\n bundleServerOptions: { disableCache: !options.cache, port: options.bundleServerPort },\n port: options.appServerPort,\n },\n apiContext,\n );\n autoDispose({ dispose: () => disposeServer('app server', servers.appServer) });\n autoDispose({ dispose: () => disposeServer('bundle server', servers.bundleServer) });\n\n // Save the session to active sessions.\n const sessionTracker = await trackSession(session);\n autoDispose({ dispose: () => sessionTracker.close() });\n\n // Log the time elapsed from when the CLI started until the browser is ready to be opened.\n await telemetryClient.tracer.startActiveSpan(\n 'TIME_TO_OPEN_BROWSER',\n { startTime: getCliStartTime(), attributes: { open: options.open } },\n () => {\n if (!isRestart) {\n handleOpenBrowser(options, apiContext);\n }\n },\n );\n\n params.commandEvents.emit('ready');\n })().catch((err) => {\n console.error('Error in start command:', err);\n resolve({ hasErrors: true, message: `Error in start command: ${err}` });\n });\n });\n};\n\nfunction handleOpenBrowser(\n options: StartOptions,\n apiContext: PartialContext<'telemetryClient', 'config' | 'urls'>,\n): void {\n const { config, urls } = apiContext.session;\n\n const defaultUrl = makeUrl(config.server?.defaultPath || '', urls.appServer).href;\n\n // Open the browser.\n if (options.open === false) {\n console.log('Please open the browser manually to:', defaultUrl);\n } else {\n let urlToOpen: string;\n if (typeof options.open === 'string') {\n // If the string doesn't start with http or https, pick a protocol based on config.server.https\n if (!options.open.startsWith('http://') && !options.open.startsWith('https://')) {\n urlToOpen = `${config.server?.https ? 'https' : 'http'}://${options.open}`;\n } else {\n urlToOpen = options.open;\n }\n } else {\n // Use the default path from the config with the first domain.\n urlToOpen = defaultUrl;\n }\n\n void openBrowser({ url: urlToOpen }, apiContext).catch((err: unknown) => {\n console.warn('Error opening browser:', (err as Error | undefined)?.stack || err);\n console.warn('Please open the browser manually to:', defaultUrl);\n });\n }\n}\n\n// cspell:ignore Prereqs\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAuB,MAAM,0BAA0B,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,M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AC,CAAC,GAAY,EAAE,EAAE;YACtE,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAG,GAAyB,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;YACjF,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,UAAU,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,wBAAwB","sourcesContent":["import { createApiContext, ensurePackageBundled, type PartialContext } from '@ms-cloudpack/api-server';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { makeUrl } from '@ms-cloudpack/path-string-parsing';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport type { CommandExitParams, CommandAction } from '../../types/CommandAction.js';\nimport { runPrerequisites } from '../../utilities/runPrerequisites.js';\nimport { openBrowser } from './openBrowser.js';\nimport { trackSession } from './trackSession.js';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { getCliStartTime } from '../../utilities/getCliStartTime.js';\nimport { createApiServer } from '../../utilities/createApiServer.js';\nimport { resolveCloudpackInternalPath } from '../../utilities/resolveCloudpackInternalPath.js';\nimport { getDomain, parseHttpsConfig } from '@ms-cloudpack/create-express-app';\nimport { handleKnownParseHttpsErrors } from '../../utilities/handleKnownParseHttpsErrors.js';\nimport { createWatcher } from '@ms-cloudpack/file-watcher';\nimport { readConfig } from '@ms-cloudpack/config';\nimport { disposeServer } from '../../utilities/disposeServer.js';\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport const execute: CommandAction<StartOptions> = async (params) => {\n const { appPath, config, options, autoDispose, isRestart } = params;\n\n console.log('App path:', yellow(appPath));\n console.log('Bundle mode:', yellow(options.mode));\n\n await runPrerequisites(params);\n\n // Auto-run init with static analysis before start. Since static analysis is fast (~22s),\n // always run it to ensure the generated config is up to date with current dependencies.\n if (config.features?.staticAnalysisInit) {\n const { init } = await import('../init/init.js');\n const { InitSummaryData } = await import('../init/InitSummaryData.js');\n const { formatInitSummary } = await import('../init/formatInitSummary.js');\n\n config.generated = {};\n console.log('Running init with static analysis...\\n');\n\n const summaryData = new InitSummaryData({ appPath });\n await init({\n appPath: params.appPath,\n cachePath: params.cachePath,\n config: params.config,\n reporter: params.reporter,\n taskRunner: params.taskRunner,\n telemetryClient: params.telemetryClient,\n options: { cache: options.cache },\n skipWrite: true,\n isMultiApp: false,\n summaryData,\n });\n\n const summary = summaryData.summarize();\n console.log(formatInitSummary({ summary, check: false, isMultiApp: false, verb: 'init' }));\n }\n\n // If the user has specified https options in the config, parse them at start.\n // This makes sure that the HTTPS configuration is ready before starting the servers and shows errors early.\n // We need to do this after prerequisites are run, in case users setup their certs there.\n if (config?.server?.https) {\n try {\n const domain = getDomain(config.server.domain);\n config.server.parsedHttps = await parseHttpsConfig({ domain, https: config.server.https, cwd: appPath });\n } catch (err) {\n handleKnownParseHttpsErrors({ err, projectName: path.basename(appPath) });\n throw err;\n }\n }\n\n const overlayPath = await resolveCloudpackInternalPath({\n packageName: '@ms-cloudpack/overlay',\n importMetaUrl: import.meta.url,\n });\n\n const shouldUseRemoteCache = config.features?.enableCloudHosted || config.features?.enableRemoteCacheDownloads;\n const apiContext = autoDispose(\n await createApiContext({\n ...params,\n remoteCacheClientLoginMethod: shouldUseRemoteCache ? options.login : undefined,\n additionalPaths: overlayPath ? [overlayPath] : undefined,\n }),\n );\n const { packages, session, telemetryClient } = apiContext;\n\n return new Promise<CommandExitParams>((resolve) => {\n (async () => {\n let hasConfigChanged = false;\n const configWatcher = createWatcher();\n await Promise.all(\n config.configPaths?.appConfigPaths.map(\n (configPath) =>\n configWatcher.watch({ path: path.basename(configPath), watchPaths: [configPath] }, () => {\n if (hasConfigChanged) {\n return;\n }\n void readConfig(appPath)\n .then(() => {\n hasConfigChanged = true;\n resolve({ restart: true, message: 'Config changed. Restarting Cloudpack...' });\n })\n .catch((error) => console.warn('Config change detected, but the config file is invalid.', error));\n }) ?? [],\n ) ?? [],\n );\n\n // Set up config watcher disposal (up here in case the config changes before setup completes).\n autoDispose(configWatcher);\n\n // Increment the session version if caching is disabled.\n if (options.cache === false) {\n session.incrementSessionVersion();\n }\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n // Start api server for tracking status and handling remote requests.\n const apiServerResult = await createApiServer({ port: options.apiServerPort }, apiContext);\n if (apiServerResult.hasErrors) {\n return apiServerResult;\n }\n const { apiServer } = apiServerResult;\n autoDispose({ dispose: () => disposeServer('API server', apiServer) });\n\n // Kick off bundling app package as soon as api server is ready.\n void ensurePackageBundled(\n {\n name: definition.name,\n version: definition.version,\n shouldGetBundleInfo: options.logBundleInfo,\n },\n apiContext,\n );\n\n // Then start bundle and app servers for hosting the app.\n const { startServers } = await import('@ms-cloudpack/app-server');\n const servers = await startServers(\n {\n definition,\n bundleServerOptions: { disableCache: !options.cache, port: options.bundleServerPort },\n port: options.appServerPort,\n },\n apiContext,\n );\n autoDispose({ dispose: () => disposeServer('app server', servers.appServer) });\n autoDispose({ dispose: () => disposeServer('bundle server', servers.bundleServer) });\n\n // Save the session to active sessions.\n const sessionTracker = await trackSession(session);\n autoDispose({ dispose: () => sessionTracker.close() });\n\n // Log the time elapsed from when the CLI started until the browser is ready to be opened.\n await telemetryClient.tracer.startActiveSpan(\n 'TIME_TO_OPEN_BROWSER',\n { startTime: getCliStartTime(), attributes: { open: options.open } },\n () => {\n if (!isRestart) {\n handleOpenBrowser(options, apiContext);\n }\n },\n );\n\n params.commandEvents.emit('ready');\n })().catch((err) => {\n console.error('Error in start command:', err);\n resolve({ hasErrors: true, message: `Error in start command: ${err}` });\n });\n });\n};\n\nfunction handleOpenBrowser(\n options: StartOptions,\n apiContext: PartialContext<'telemetryClient', 'config' | 'urls'>,\n): void {\n const { config, urls } = apiContext.session;\n\n const defaultUrl = makeUrl(config.server?.defaultPath || '', urls.appServer).href;\n\n // Open the browser.\n if (options.open === false) {\n console.log('Please open the browser manually to:', defaultUrl);\n } else {\n let urlToOpen: string;\n if (typeof options.open === 'string') {\n // If the string doesn't start with http or https, pick a protocol based on config.server.https\n if (!options.open.startsWith('http://') && !options.open.startsWith('https://')) {\n urlToOpen = `${config.server?.https ? 'https' : 'http'}://${options.open}`;\n } else {\n urlToOpen = options.open;\n }\n } else {\n // Use the default path from the config with the first domain.\n urlToOpen = defaultUrl;\n }\n\n void openBrowser({ url: urlToOpen }, apiContext).catch((err: unknown) => {\n console.warn('Error opening browser:', (err as Error | undefined)?.stack || err);\n console.warn('Please open the browser manually to:', defaultUrl);\n });\n }\n}\n\n// cspell:ignore Prereqs\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAQ9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAkClB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAQ9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAmClB,CAAC"}
@@ -32,6 +32,7 @@ export const init = (program) => {
32
32
  // If cwd isn't a cloudpack app, discover other cloudpack apps and possibly prompt the user
33
33
  // to choose one. Also handles --app.
34
34
  discoverAppPaths: 'single',
35
+ enableReporterReset: true,
35
36
  });
36
37
  };
37
38
  function getPortOption(flags, name, isFirst) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAA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} from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { portNumbers } from 'get-port';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n// verify the values are correct\nconst showOverlayChoices: NonNullable<StartOptions['showOverlay']>[] = ['always', 'errors-only', 'never'];\n\n/** Defines the \"start\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<StartOptions>({\n name: 'start',\n description: 'Starts a web inner-loop for an app.',\n options: {\n app: reusedOptions.app(),\n open: [\n new Option('--open [url]', 'Open the browser (to the URL if provided).'),\n new Option('--no-open', 'Do not open the browser.'),\n ],\n cache: reusedOptions.cache(),\n mode: reusedOptions.mode({ action: 'run' }),\n showOverlay: new Option(\n '--show-overlay <when>',\n 'Override whether to show the Cloudpack overlay (status badge and dialog) in the app UI.',\n // Don't specify a default for this option to avoid unconditionally overriding any value\n // set in the ServerConfig\n ).choices(showOverlayChoices),\n logResolveMap: reusedOptions.logResolveMap(),\n logBundleInfo: reusedOptions.logBundleInfo({ requiresNoCache: true }),\n apiServerPort: getPortOption('--api-server-port <port>', 'API', true),\n appServerPort: getPortOption('--app-server-port <port>', 'app'),\n bundleServerPort: getPortOption('--bundle-server-port <port>', 'bundle'),\n login: reusedOptions.login('start'),\n },\n applyOptionsToConfig: ({ showOverlay, open }) => {\n // These will be ignored if no values are set\n return { extraServerConfig: { showOverlay, open } };\n },\n getExecutor: () => import('./execute.js'),\n // If cwd isn't a cloudpack app, discover other cloudpack apps and possibly prompt the user\n // to choose one. Also handles --app.\n discoverAppPaths: 'single',\n });\n};\n\nfunction getPortOption(flags: string, name: string, isFirst?: boolean): Option {\n return new Option(\n flags,\n `Port for the ${name} server (${isFirst ? 'single, comma-separated, or range with dash' : 'as above'}).`,\n ).argParser(parsePorts);\n}\n\nfunction parsePorts(value: string): number[] {\n if (value.includes('-')) {\n const split = value.split('-');\n if (split.length !== 2) {\n throw new InvalidArgumentError(`Invalid port range: \"${value}\"`);\n }\n return [...portNumbers(parseNumber(split[0]), parseNumber(split[1]))];\n }\n\n return value.split(',').map(parseNumber);\n}\n\nfunction parseNumber(value: string): number {\n value = value.trim();\n const parsed = parseInt(value, 10);\n if (isNaN(parsed)) {\n throw new InvalidArgumentError(`Port must be a number; received: \"${value}\"`);\n }\n return parsed;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,gCAAgC;AAChC,MAAM,kBAAkB,GAA+C,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAE1G,gCAAgC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAe;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,qCAAqC;QAClD,OAAO,EAAE;YACP,GAAG,EAAE,aAAa,CAAC,GAAG,EAAE;YACxB,IAAI,EAAE;gBACJ,IAAI,MAAM,CAAC,cAAc,EAAE,4CAA4C,CAAC;gBACxE,IAAI,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC;aACpD;YACD,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;YAC5B,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YAC3C,WAAW,EAAE,IAAI,MAAM,CACrB,uBAAuB,EACvB,yFAAyF,CAG1F,CAAC,OAAO,CAAC,kBAAkB,CAAC;YAC7B,aAAa,EAAE,aAAa,CAAC,aAAa,EAAE;YAC5C,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;YACr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AAC,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,oBAAoB,CAAC,qCAAqC,KAAK,GAAG,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { InvalidArgumentError, Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { portNumbers } from 'get-port';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n// verify the values are correct\nconst showOverlayChoices: NonNullable<StartOptions['showOverlay']>[] = ['always', 'errors-only', 'never'];\n\n/** Defines the \"start\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<StartOptions>({\n name: 'start',\n description: 'Starts a web inner-loop for an app.',\n options: {\n app: reusedOptions.app(),\n open: [\n new Option('--open [url]', 'Open the browser (to the URL if provided).'),\n new Option('--no-open', 'Do not open the browser.'),\n ],\n cache: reusedOptions.cache(),\n mode: reusedOptions.mode({ action: 'run' }),\n showOverlay: new Option(\n '--show-overlay <when>',\n 'Override whether to show the Cloudpack overlay (status badge and dialog) in the app UI.',\n // Don't specify a default for this option to avoid unconditionally overriding any value\n // set in the ServerConfig\n ).choices(showOverlayChoices),\n logResolveMap: reusedOptions.logResolveMap(),\n logBundleInfo: reusedOptions.logBundleInfo({ requiresNoCache: true }),\n apiServerPort: getPortOption('--api-server-port <port>', 'API', true),\n appServerPort: getPortOption('--app-server-port <port>', 'app'),\n bundleServerPort: getPortOption('--bundle-server-port <port>', 'bundle'),\n login: reusedOptions.login('start'),\n },\n applyOptionsToConfig: ({ showOverlay, open }) => {\n // These will be ignored if no values are set\n return { extraServerConfig: { showOverlay, open } };\n },\n getExecutor: () => import('./execute.js'),\n // If cwd isn't a cloudpack app, discover other cloudpack apps and possibly prompt the user\n // to choose one. Also handles --app.\n discoverAppPaths: 'single',\n enableReporterReset: true,\n });\n};\n\nfunction getPortOption(flags: string, name: string, isFirst?: boolean): Option {\n return new Option(\n flags,\n `Port for the ${name} server (${isFirst ? 'single, comma-separated, or range with dash' : 'as above'}).`,\n ).argParser(parsePorts);\n}\n\nfunction parsePorts(value: string): number[] {\n if (value.includes('-')) {\n const split = value.split('-');\n if (split.length !== 2) {\n throw new InvalidArgumentError(`Invalid port range: \"${value}\"`);\n }\n return [...portNumbers(parseNumber(split[0]), parseNumber(split[1]))];\n }\n\n return value.split(',').map(parseNumber);\n}\n\nfunction parseNumber(value: string): number {\n value = value.trim();\n const parsed = parseInt(value, 10);\n if (isNaN(parsed)) {\n throw new InvalidArgumentError(`Port must be a number; received: \"${value}\"`);\n }\n return parsed;\n}\n"]}
@@ -6,7 +6,7 @@ import { type CommandExecutorParams } from './CommandExecutor.js';
6
6
  * Parameters for creating a command.
7
7
  * `TOptions` should be the command-specific options (if any), e.g. `StartOptions`.
8
8
  */
9
- export interface CloudpackCommandParams<TOptions extends object, TArguments extends object> extends Partial<Pick<CommandExecutorParams<TOptions>, 'discoverAppPaths' | 'applyOptionsToConfig'>> {
9
+ export interface CloudpackCommandParams<TOptions extends object, TArguments extends object> extends Partial<Pick<CommandExecutorParams<TOptions>, 'discoverAppPaths' | 'enableReporterReset' | 'applyOptionsToConfig'>> {
10
10
  /** Command name */
11
11
  name: string;
12
12
  /** Command description */
@@ -1 +1 @@
1
- {"version":3,"file":"CloudpackCommand.d.ts","sourceRoot":"","sources":["../../src/utilities/CloudpackCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAA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Aa,SAAS,MAAM,EAAE,eAAe,SAAS,MAAM,GAAG,KAAK,EACvF,MAAM,EAAE,sBAAsB,CAAC,aAAa,EAAE,eAAe,CAAC,GAC7D,gBAAgB,CAAC,aAAa,EAAE,eAAe,CAAC;IAQnD,qEAAqE;IACxD,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAWjC,qGAAqG;IACrG,OAAO,CAAC,aAAa;IAMrB,iGAAiG;IACjG,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,UAAU;CAoCnB"}
@@ -25,6 +25,7 @@ export class CloudpackCommand {
25
25
  this._executorOptions = {
26
26
  programOptions: params.programOptions,
27
27
  discoverAppPaths: params.discoverAppPaths,
28
+ enableReporterReset: params.enableReporterReset,
28
29
  applyOptionsToConfig: params.applyOptionsToConfig,
29
30
  };
30
31
  const command = params.parent?.command(params.name) || new Command(params.name);
@@ -1 +1 @@
1
- {"version":3,"file":"CloudpackCommand.js","sourceRoot":"","sources":["../../src/utilities/CloudpackCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAqE,MAAM,WAAW,CAAC;AAG/G,OAAO,EAAE,eAAe,EAA8B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA2DjE;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IACnB,QAAQ,CAAU;IAClB,gBAAgB,CAGtB;IAEF;;;OAGG;IACH;IACE,4EAA4E;IAC5E,MAIG;QAEH,IAAI,CAAC,gBAAgB,GAAG;YACtB,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,oBAAoB,EAAE,M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AC,OAAO,CAAC,IAAI,EAAE,CAAC;YAEpG,0CAA0C;YAC1C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;YACxC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBAClC,2EAA2E;gBAC3E,MAAM,IAAI,KAAK,CAAC,gEAAgE,IAAI,GAAG,CAAC,CAAC;YAC3F,CAAC;YAED,MAAM,eAAe,GAAG,IAAI,eAAe,CAA2B;gBACpE,IAAI,EAAE,aAAa;gBACnB,OAAO;gBACP,OAAO;gBACP,IAAI;gBACJ,GAAG,IAAI,CAAC,gBAAgB;aACzB,CAAC,CAAC;YACH,MAAM,eAAe,CAAC,OAAO,EAAE,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { Command, Option, type AddHelpTextPosition, type Argument, type OutputConfiguration } from 'commander';\nimport type { CommandActionModule } from '../types/CommandAction.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\nimport { CommandExecutor, type CommandExecutorParams } from './CommandExecutor.js';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport { parseFeature } from './parseFeature.js';\nimport { parseDefine } from './parseDefine.js';\nimport { CloudpackHelp, optionGroups } from './CloudpackHelp.js';\n\n/**\n * Parameters for creating a command.\n * `TOptions` should be the command-specific options (if any), e.g. `StartOptions`.\n */\nexport interface CloudpackCommandParams<TOptions extends object, TArguments extends object> extends Partial<\n Pick<CommandExecutorParams<TOptions>, 'discoverAppPaths' | 'applyOptionsToConfig'>\n> {\n /** Command name */\n name: string;\n\n /** Command description */\n description: string;\n\n /**\n * Options specific to this command. The record ensures that all options are available in the CLI.\n * Allow multiple options for the same key since commander supports it with negatable options.\n */\n options?: Record<keyof TOptions, Option | Option[]>; //\n\n /** Arguments specific to this command. Key order determines the arg order. */\n args?: Record<keyof TArguments, Argument>;\n\n /**\n * Function returning an async import of the command's `src/commands/<name>/execute.ts` module.\n * Importing only on demand makes Cloudpack start up faster since it doesn't have to parse\n * every command's dependencies (many of which may be unrelated to the command being run).\n *\n * This can be undefined for a command that only has sub-commands.\n */\n getExecutor?: () => Promise<CommandActionModule<TOptions>>;\n\n /** Usage message override */\n usage?: string;\n\n /** Alternative name for the command */\n alias?: string;\n\n /** Extra text to be displayed with the built-in help. */\n addHelpText?: {\n /**\n * `'before'` or `'after'` to affect just this command.\n * `'beforeAll'` or `'afterAll'` to affect this command and all its subcommands.\n */\n position: AddHelpTextPosition;\n text: string;\n };\n\n /** Output options override (mainly for testing) */\n outputOptions?: OutputConfiguration;\n\n /**\n * The shared options are relevant for most commands, but this allows omitting them from help\n * where they're not relevant. `true` hides all shared options, or an array hides specific ones.\n */\n hideSharedOptions?: Array<keyof SharedOptions> | true;\n}\n\n/**\n * This wraps the `Command` class from [`commander`](https://www.npmjs.com/package/commander) with\n * Cloudpack-specific functionality and simpler APIs.\n *\n * Similar to the pattern from `commander`, this class represents both the program and its sub-commands.\n * - The top-level \"program\" command should be created with `new CloudpackCommand()`.\n * - Sub-commands should be created with the `.addSubCommand` method on the parent.\n */\nexport class CloudpackCommand<TOptions extends object, TArguments extends object> {\n private _command: Command;\n private _executorOptions: Pick<\n CommandExecutorParams<TOptions>,\n 'programOptions' | 'discoverAppPaths' | 'applyOptionsToConfig'\n >;\n\n /**\n * This should only be used directly (outside this class) to create the top-level `program` command.\n * To add sub-commands, use `.addSubCommand` instead.\n */\n constructor(\n // The extra options here shouldn't be exposed to the `createSubCommand` API\n params: CloudpackCommandParams<TOptions, TArguments> &\n Pick<CommandExecutorParams<TOptions>, 'programOptions'> & {\n /** This must be undefined for the top-level program command */\n parent?: Command;\n },\n ) {\n this._executorOptions = {\n programOptions: params.programOptions,\n discoverAppPaths: params.discoverAppPaths,\n applyOptionsToConfig: params.applyOptionsToConfig,\n };\n\n const command = params.parent?.command(params.name) || new Command(params.name);\n this._command = command;\n\n command.version(params.programOptions.version);\n command.description(params.description);\n command.allowExcessArguments(false);\n\n const isTopLevel = !params.parent;\n\n if (isTopLevel && environmentInfo.isJest) {\n // In tests, throw instead of exiting the process on invalid args\n command.exitOverride((err) => {\n throw new Error(`Process exited with code ${err.exitCode} due to arg parsing error`);\n });\n }\n\n command.createHelp = () => new CloudpackHelp({ isTopLevel });\n // set the default help group for options\n command.optionsGroup(optionGroups.default);\n\n params.usage && command.usage(params.usage);\n params.alias && command.alias(params.alias);\n params.addHelpText && command.addHelpText(params.addHelpText.position, params.addHelpText.text);\n params.outputOptions && command.configureOutput(params.outputOptions);\n params.getExecutor && this._addAction(params.getExecutor);\n\n if (params.args) {\n this._addArguments<TArguments>(params.args);\n }\n\n if (params.options) {\n // Add the command-specific options first so they show up first in help\n this._addOptions<TOptions>(params.options);\n }\n\n // Add shared options. These must be manually added to the program command and each sub-command\n // because commander doesn't natively support inheriting options.\n this._addOptions<SharedOptions>(\n {\n verbose: new Option('-v, --verbose', 'Show additional details in logging.').helpGroup(optionGroups.logging),\n debug: new Option('-d, --debug', 'Show debug information (superset of --verbose).')\n .conflicts('verbose')\n .helpGroup(optionGroups.logging),\n quiet: new Option('-q, --quiet', 'Disable non-essential logging.')\n .conflicts('verbose')\n .conflicts('debug')\n .helpGroup(optionGroups.logging),\n color:\n // In the parsed options, this will be a boolean `color` with default value true, except in tests, CI, or environments without a TTY (e.g., concurrently).\n new Option('-n, --no-color', 'Disable colors in the output.')\n .helpGroup(optionGroups.logging)\n .default(\n !environmentInfo.isJest && !environmentInfo.isLage && !environmentInfo.isCI && !!process.stdout.isTTY,\n ),\n logFile: new Option('--log-file', 'Write a log file with all console output.').helpGroup(optionGroups.logging),\n cachePath: new Option(\n '--cache-path <path>',\n 'Custom cache folder. To change the default, run `cloudpack config set cachePath <path>`.',\n ).helpGroup(optionGroups.common),\n config: new Option(\n '-c, --config <filename>',\n 'Custom config file name to use instead of cloudpack.config.json.',\n ).helpGroup(optionGroups.common),\n define: new Option('--define <key=value>', 'Define a global variable. Can be specified multiple times.')\n .helpGroup(optionGroups.common)\n .argParser(parseDefine),\n features: new Option('--features <featureNames...>', 'Enable experimental features.')\n .helpGroup(optionGroups.common)\n .argParser(parseFeature),\n },\n params.hideSharedOptions,\n );\n }\n\n /** Create a child command. */\n public addSubCommand<TChildOptions extends object, TChildArguments extends object = never>(\n params: CloudpackCommandParams<TChildOptions, TChildArguments>,\n ): CloudpackCommand<TChildOptions, TChildArguments> {\n return new CloudpackCommand<TChildOptions, TChildArguments>({\n ...params,\n programOptions: this._executorOptions.programOptions,\n parent: this._command,\n });\n }\n\n /** Run the program (only works on the top-level program command). */\n public async run(): Promise<void> {\n if (this._command.parent) {\n throw new Error('Only the top-level program command can be run directly.');\n }\n\n await this._command.parseAsync(this._executorOptions.programOptions.argv);\n if (this._command.args.length === 0) {\n this._command.help();\n }\n }\n\n /** Add arguments. The generic enforces that argument objects are included for all keys of a type. */\n private _addArguments<TAddArguments extends object>(args: Record<keyof TAddArguments, Argument>): void {\n for (const argument of Object.values(args)) {\n this._command.addArgument(argument as Argument);\n }\n }\n\n /** Add options. The generic enforces that option objects are included for all keys of a type. */\n private _addOptions<TAddOptions extends object>(\n options: Record<keyof TAddOptions, Option | Option[]>,\n hideOptions?: Array<keyof TAddOptions> | true,\n ): void {\n for (const [name, optionOrOptions] of Object.entries(options) as [keyof TAddOptions, Option | Option[]][]) {\n const optionArray = Array.isArray(optionOrOptions) ? optionOrOptions : [optionOrOptions];\n for (const option of optionArray) {\n if (hideOptions === true || hideOptions?.includes(name)) {\n option.hideHelp();\n }\n this._command.addOption(option);\n }\n }\n }\n\n private _addAction(getExecutor: NonNullable<CloudpackCommandParams<TOptions, TArguments>['getExecutor']>): void {\n const command = this._command;\n // The action function receives parsed options as its first parameter, but we ignore those\n // because they only contain options *specific to this command*, not shared options like `debug`.\n command.action(async () => {\n // Commander has support for custom parsers that parse arguments.\n // Use processedArgs instead of args to get the parsed arguments.\n const processedArgs = command.processedArgs as string[];\n\n // Get the shared options too, not just the ones for this command.\n // (In `cloudpackCommand`, we added the shared options to each command object so that they show up\n // in help, but commander still seems to respect options only at the first command where they're\n // encountered, which for shared options will always be the program command.)\n const options = command.optsWithGlobals<TOptions & SharedOptions>();\n\n // Usually `command` will be a sub-command (e.g. \"bundle\"), but it could also be a sub-sub-command\n // (e.g. \"cache clean\").\n const verb = command.parent?.parent ? `${command.parent.name()} ${command.name()}` : command.name();\n\n // Dynamically import the execute function\n const { execute } = await getExecutor();\n if (typeof execute !== 'function') {\n // throw instead of exiting politely, since this is a major developer error\n throw new Error(`No execute function was exported from the command module for ${verb}.`);\n }\n\n const commandExecutor = new CommandExecutor<TOptions & SharedOptions>({\n args: processedArgs,\n options,\n execute,\n verb,\n ...this._executorOptions,\n });\n await commandExecutor.execute();\n });\n }\n}\n"]}
1
+ {"version":3,"file":"CloudpackCommand.js","sourceRoot":"","sources":["../../src/utilities/CloudpackCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAqE,MAAM,WAAW,CAAC;AAG/G,OAAO,EAAE,eAAe,EAA8B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA2DjE;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IACnB,QAAQ,CAAU;IAClB,gBAAgB,CAGtB;IAEF;;;OAGG;IACH;IACE,4EAA4E;IAC5E,MAIG;QAEH,IAAI,CAAC,gBAAgB,GAAG;YACtB,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;YAC/C,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;SAClD,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,CAAC,M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OAAO,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;YACxC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBAClC,2EAA2E;gBAC3E,MAAM,IAAI,KAAK,CAAC,gEAAgE,IAAI,GAAG,CAAC,CAAC;YAC3F,CAAC;YAED,MAAM,eAAe,GAAG,IAAI,eAAe,CAA2B;gBACpE,IAAI,EAAE,aAAa;gBACnB,OAAO;gBACP,OAAO;gBACP,IAAI;gBACJ,GAAG,IAAI,CAAC,gBAAgB;aACzB,CAAC,CAAC;YACH,MAAM,eAAe,CAAC,OAAO,EAAE,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { Command, Option, type AddHelpTextPosition, type Argument, type OutputConfiguration } from 'commander';\nimport type { CommandActionModule } from '../types/CommandAction.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\nimport { CommandExecutor, type CommandExecutorParams } from './CommandExecutor.js';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport { parseFeature } from './parseFeature.js';\nimport { parseDefine } from './parseDefine.js';\nimport { CloudpackHelp, optionGroups } from './CloudpackHelp.js';\n\n/**\n * Parameters for creating a command.\n * `TOptions` should be the command-specific options (if any), e.g. `StartOptions`.\n */\nexport interface CloudpackCommandParams<TOptions extends object, TArguments extends object> extends Partial<\n Pick<CommandExecutorParams<TOptions>, 'discoverAppPaths' | 'enableReporterReset' | 'applyOptionsToConfig'>\n> {\n /** Command name */\n name: string;\n\n /** Command description */\n description: string;\n\n /**\n * Options specific to this command. The record ensures that all options are available in the CLI.\n * Allow multiple options for the same key since commander supports it with negatable options.\n */\n options?: Record<keyof TOptions, Option | Option[]>; //\n\n /** Arguments specific to this command. Key order determines the arg order. */\n args?: Record<keyof TArguments, Argument>;\n\n /**\n * Function returning an async import of the command's `src/commands/<name>/execute.ts` module.\n * Importing only on demand makes Cloudpack start up faster since it doesn't have to parse\n * every command's dependencies (many of which may be unrelated to the command being run).\n *\n * This can be undefined for a command that only has sub-commands.\n */\n getExecutor?: () => Promise<CommandActionModule<TOptions>>;\n\n /** Usage message override */\n usage?: string;\n\n /** Alternative name for the command */\n alias?: string;\n\n /** Extra text to be displayed with the built-in help. */\n addHelpText?: {\n /**\n * `'before'` or `'after'` to affect just this command.\n * `'beforeAll'` or `'afterAll'` to affect this command and all its subcommands.\n */\n position: AddHelpTextPosition;\n text: string;\n };\n\n /** Output options override (mainly for testing) */\n outputOptions?: OutputConfiguration;\n\n /**\n * The shared options are relevant for most commands, but this allows omitting them from help\n * where they're not relevant. `true` hides all shared options, or an array hides specific ones.\n */\n hideSharedOptions?: Array<keyof SharedOptions> | true;\n}\n\n/**\n * This wraps the `Command` class from [`commander`](https://www.npmjs.com/package/commander) with\n * Cloudpack-specific functionality and simpler APIs.\n *\n * Similar to the pattern from `commander`, this class represents both the program and its sub-commands.\n * - The top-level \"program\" command should be created with `new CloudpackCommand()`.\n * - Sub-commands should be created with the `.addSubCommand` method on the parent.\n */\nexport class CloudpackCommand<TOptions extends object, TArguments extends object> {\n private _command: Command;\n private _executorOptions: Pick<\n CommandExecutorParams<TOptions>,\n 'programOptions' | 'discoverAppPaths' | 'enableReporterReset' | 'applyOptionsToConfig'\n >;\n\n /**\n * This should only be used directly (outside this class) to create the top-level `program` command.\n * To add sub-commands, use `.addSubCommand` instead.\n */\n constructor(\n // The extra options here shouldn't be exposed to the `createSubCommand` API\n params: CloudpackCommandParams<TOptions, TArguments> &\n Pick<CommandExecutorParams<TOptions>, 'programOptions'> & {\n /** This must be undefined for the top-level program command */\n parent?: Command;\n },\n ) {\n this._executorOptions = {\n programOptions: params.programOptions,\n discoverAppPaths: params.discoverAppPaths,\n enableReporterReset: params.enableReporterReset,\n applyOptionsToConfig: params.applyOptionsToConfig,\n };\n\n const command = params.parent?.command(params.name) || new Command(params.name);\n this._command = command;\n\n command.version(params.programOptions.version);\n command.description(params.description);\n command.allowExcessArguments(false);\n\n const isTopLevel = !params.parent;\n\n if (isTopLevel && environmentInfo.isJest) {\n // In tests, throw instead of exiting the process on invalid args\n command.exitOverride((err) => {\n throw new Error(`Process exited with code ${err.exitCode} due to arg parsing error`);\n });\n }\n\n command.createHelp = () => new CloudpackHelp({ isTopLevel });\n // set the default help group for options\n command.optionsGroup(optionGroups.default);\n\n params.usage && command.usage(params.usage);\n params.alias && command.alias(params.alias);\n params.addHelpText && command.addHelpText(params.addHelpText.position, params.addHelpText.text);\n params.outputOptions && command.configureOutput(params.outputOptions);\n params.getExecutor && this._addAction(params.getExecutor);\n\n if (params.args) {\n this._addArguments<TArguments>(params.args);\n }\n\n if (params.options) {\n // Add the command-specific options first so they show up first in help\n this._addOptions<TOptions>(params.options);\n }\n\n // Add shared options. These must be manually added to the program command and each sub-command\n // because commander doesn't natively support inheriting options.\n this._addOptions<SharedOptions>(\n {\n verbose: new Option('-v, --verbose', 'Show additional details in logging.').helpGroup(optionGroups.logging),\n debug: new Option('-d, --debug', 'Show debug information (superset of --verbose).')\n .conflicts('verbose')\n .helpGroup(optionGroups.logging),\n quiet: new Option('-q, --quiet', 'Disable non-essential logging.')\n .conflicts('verbose')\n .conflicts('debug')\n .helpGroup(optionGroups.logging),\n color:\n // In the parsed options, this will be a boolean `color` with default value true, except in tests, CI, or environments without a TTY (e.g., concurrently).\n new Option('-n, --no-color', 'Disable colors in the output.')\n .helpGroup(optionGroups.logging)\n .default(\n !environmentInfo.isJest && !environmentInfo.isLage && !environmentInfo.isCI && !!process.stdout.isTTY,\n ),\n logFile: new Option('--log-file', 'Write a log file with all console output.').helpGroup(optionGroups.logging),\n cachePath: new Option(\n '--cache-path <path>',\n 'Custom cache folder. To change the default, run `cloudpack config set cachePath <path>`.',\n ).helpGroup(optionGroups.common),\n config: new Option(\n '-c, --config <filename>',\n 'Custom config file name to use instead of cloudpack.config.json.',\n ).helpGroup(optionGroups.common),\n define: new Option('--define <key=value>', 'Define a global variable. Can be specified multiple times.')\n .helpGroup(optionGroups.common)\n .argParser(parseDefine),\n features: new Option('--features <featureNames...>', 'Enable experimental features.')\n .helpGroup(optionGroups.common)\n .argParser(parseFeature),\n },\n params.hideSharedOptions,\n );\n }\n\n /** Create a child command. */\n public addSubCommand<TChildOptions extends object, TChildArguments extends object = never>(\n params: CloudpackCommandParams<TChildOptions, TChildArguments>,\n ): CloudpackCommand<TChildOptions, TChildArguments> {\n return new CloudpackCommand<TChildOptions, TChildArguments>({\n ...params,\n programOptions: this._executorOptions.programOptions,\n parent: this._command,\n });\n }\n\n /** Run the program (only works on the top-level program command). */\n public async run(): Promise<void> {\n if (this._command.parent) {\n throw new Error('Only the top-level program command can be run directly.');\n }\n\n await this._command.parseAsync(this._executorOptions.programOptions.argv);\n if (this._command.args.length === 0) {\n this._command.help();\n }\n }\n\n /** Add arguments. The generic enforces that argument objects are included for all keys of a type. */\n private _addArguments<TAddArguments extends object>(args: Record<keyof TAddArguments, Argument>): void {\n for (const argument of Object.values(args)) {\n this._command.addArgument(argument as Argument);\n }\n }\n\n /** Add options. The generic enforces that option objects are included for all keys of a type. */\n private _addOptions<TAddOptions extends object>(\n options: Record<keyof TAddOptions, Option | Option[]>,\n hideOptions?: Array<keyof TAddOptions> | true,\n ): void {\n for (const [name, optionOrOptions] of Object.entries(options) as [keyof TAddOptions, Option | Option[]][]) {\n const optionArray = Array.isArray(optionOrOptions) ? optionOrOptions : [optionOrOptions];\n for (const option of optionArray) {\n if (hideOptions === true || hideOptions?.includes(name)) {\n option.hideHelp();\n }\n this._command.addOption(option);\n }\n }\n }\n\n private _addAction(getExecutor: NonNullable<CloudpackCommandParams<TOptions, TArguments>['getExecutor']>): void {\n const command = this._command;\n // The action function receives parsed options as its first parameter, but we ignore those\n // because they only contain options *specific to this command*, not shared options like `debug`.\n command.action(async () => {\n // Commander has support for custom parsers that parse arguments.\n // Use processedArgs instead of args to get the parsed arguments.\n const processedArgs = command.processedArgs as string[];\n\n // Get the shared options too, not just the ones for this command.\n // (In `cloudpackCommand`, we added the shared options to each command object so that they show up\n // in help, but commander still seems to respect options only at the first command where they're\n // encountered, which for shared options will always be the program command.)\n const options = command.optsWithGlobals<TOptions & SharedOptions>();\n\n // Usually `command` will be a sub-command (e.g. \"bundle\"), but it could also be a sub-sub-command\n // (e.g. \"cache clean\").\n const verb = command.parent?.parent ? `${command.parent.name()} ${command.name()}` : command.name();\n\n // Dynamically import the execute function\n const { execute } = await getExecutor();\n if (typeof execute !== 'function') {\n // throw instead of exiting politely, since this is a major developer error\n throw new Error(`No execute function was exported from the command module for ${verb}.`);\n }\n\n const commandExecutor = new CommandExecutor<TOptions & SharedOptions>({\n args: processedArgs,\n options,\n execute,\n verb,\n ...this._executorOptions,\n });\n await commandExecutor.execute();\n });\n }\n}\n"]}
@@ -25,6 +25,13 @@ export interface CommandExecutorParams<TOptions extends SharedOptions> {
25
25
  * multiple apps are found.
26
26
  */
27
27
  discoverAppPaths: AppPathDiscoveryMode | undefined;
28
+ /**
29
+ * Whether to set `TaskReporter`'s `enableReset` option, which enables resetting console output.
30
+ * This should only be true for commands like start which use watch mode, and needs to be set at
31
+ * the beginning instead of being toggled by the command to ensure everything is captured.
32
+ * (If true, the screen will also be cleared on startup.)
33
+ */
34
+ enableReporterReset: boolean | undefined;
28
35
  /**
29
36
  * Apply any command-specific CLI options that need to be passed through to `readConfig`.
30
37
  * (Shared and reused options are applied automatically.)
@@ -40,6 +47,7 @@ export declare class CommandExecutor<TOptions extends SharedOptions> {
40
47
  private _programOptions;
41
48
  private _verb;
42
49
  private _discoverAppPaths;
50
+ private _enableReporterReset;
43
51
  private _applyOptionsToConfig;
44
52
  private _reporter;
45
53
  /** Items which should be disposed before a restart, as well as at process exit */
@@ -1 +1 @@
1
- {"version":3,"file":"CommandExecutor.d.ts","sourceRoot":"","sources":["../../src/utilities/CommandExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAe9D,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAqB,MAAM,2BAA2B,CAAC;AAC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AAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,YAAY,CAAC,CAAa;IAClC,OAAO,CAAC,sBAAsB,CAAC,CAAe;IAE9C,gFAAgF;IAEhF,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAmC;IAClE,kEAAkE;IAClE,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAkC;IAEjE;;;OAGG;WACW,uBAAuB,CAAC,QAAQ,EAAE,OAAO,OAAO,CAAC,IAAI,GAAG,SAAS,GAAG,IAAI;IAItF;;;OAGG;WACiB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO7E;;OAEG;WACW,kBAAkB,IAAI,MAAM,EAAE;gBAMhC,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC;IAiEnD;;;OAGG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBrC;;;OAGG;YACW,YAAY;IA4E1B;;;OAGG;YACW,mBAAmB;IAqGjC,qEAAqE;IACrE,OAAO,CAAC,+BAA+B;YAgBzB,cAAc;IAkD5B,OAAO,CAAC,cAAc,CAgBpB;IAEF,OAAO,CAAC,yBAAyB,CAO/B;IAEF,OAAO,CAAC,uBAAuB,CAI7B;IAEF;;;;;;OAMG;YACW,KAAK;IA6BnB,wDAAwD;IACxD,OAAO,CAAC,gBAAgB;CAGzB"}
@@ -22,6 +22,7 @@ export class CommandExecutor {
22
22
  _programOptions;
23
23
  _verb;
24
24
  _discoverAppPaths;
25
+ _enableReporterReset;
25
26
  _applyOptionsToConfig;
26
27
  _reporter;
27
28
  /** Items which should be disposed before a restart, as well as at process exit */
@@ -68,11 +69,19 @@ export class CommandExecutor {
68
69
  this._programOptions = params.programOptions;
69
70
  this._verb = params.verb;
70
71
  this._discoverAppPaths = params.discoverAppPaths;
72
+ this._enableReporterReset = !!params.enableReporterReset;
71
73
  this._applyOptionsToConfig = params.applyOptionsToConfig;
72
74
  this._autoDisposableList = new AutoDisposableList();
73
75
  this._finalDisposableList = new AutoDisposableList();
74
76
  this._finalDisposableList.add(this._autoDisposableList);
75
- this._reporter = new TaskReporter();
77
+ if (this._enableReporterReset) {
78
+ // If running an interactive command, start by clearing the screen
79
+ this._reporter = new TaskReporter({ enableReset: true });
80
+ this._reporter.reset();
81
+ }
82
+ else {
83
+ this._reporter = new TaskReporter();
84
+ }
76
85
  this._finalDisposableList.add(this._reporter);
77
86
  CommandExecutor._activeInstances.add(this);
78
87
  this._finalDisposableList.add({
@@ -259,6 +268,7 @@ export class CommandExecutor {
259
268
  plainTextMode: !this._options.color,
260
269
  logFile: !!this._options.logFile,
261
270
  cwd: this._programOptions.cwd,
271
+ enableReset: this._enableReporterReset,
262
272
  ...(this._options.debug
263
273
  ? debugLoggingConfig
264
274
  : this._options.verbose
@@ -1 +1 @@
1
- {"version":3,"file":"CommandExecutor.js","sourceRoot":"","sources":["../../src/utilities/CommandExecutor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,GAAG,EACH,oBAAoB,EACpB,MAAM,GACP,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAA2C,MAAM,yBAAyB,CAAC;AAClG,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAoC,MAAM,uBAAuB,CAAC;A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,qBAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;QAEjH,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,mEAAmE;YACnE,8FAA8F;YAC9F,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;gBAC5B,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;qBACxC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,GAAG,CAAC;qBAC1C,IAAI,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO,CAAC,IAAI,CAAC,0DAA0D,YAAY,GAAG,CAAC,CAAC;YAC1F,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAE3B,8DAA8D;YAC9D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;gBACtB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;gBAC3C,QAAQ,EAAE,QAAQ,KAAK,CAAC;aACzB,CAAC,CAAC;YAEH,wBAAwB;YACxB,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QAC5C,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED,wDAAwD;IAChD,gBAAgB,CAAC,QAAgB;QACvC,CAAC,eAAe,CAAC,gBAAgB,IAAI,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC","sourcesContent":["import type { ReadConfigOptions } from '@ms-cloudpack/config';\nimport type { CloudpackConfig, PackageJson } from '@ms-cloudpack/common-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport {\n TaskReporter,\n bold,\n debugLoggingConfig,\n defaultLoggingConfig,\n noLoggingConfig,\n red,\n verboseLoggingConfig,\n yellow,\n} from '@ms-cloudpack/task-reporter';\nimport { startTelemetry, type TelemetryApi, type TelemetryClient } from '@ms-cloudpack/telemetry';\nimport path from 'path';\nimport type { CommandAction, CommandExitParams, AppCommandContext } from '../types/CommandAction.js';\nimport type { ProgramOptions } from '../types/ProgramOptions.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\nimport { AutoDisposableList } from './AutoDisposableList.js';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport type { ReusedOptions } from '../types/ReusedOptions.js';\nimport type { AppPathDiscoveryMode } from '../types/AppPathDiscoveryMode.js';\nimport { discoverRemoteAppPaths } from './discoverRemoteAppPaths.js';\nimport { discoverLocalAppPaths } from './discoverLocalAppPaths.js';\nimport { TaskRunner } from '@ms-cloudpack/api-server';\nimport { readLocalConfigs, type InvalidCloudpackConfigError } from './readLocalConfigs.js';\nimport { readRemoteConfigs } from './readRemoteConfigs.js';\nimport { getCliStartTime } from './getCliStartTime.js';\n\nexport interface CommandExecutorParams<TOptions extends SharedOptions> {\n /** Command-specific arguments */\n args: string[];\n\n /** Command-specific and shared options. */\n options: TOptions;\n\n /** Function to execute the command. */\n execute: CommandAction<TOptions>;\n\n /** Shared program-level configuration. */\n programOptions: ProgramOptions;\n\n /** Verb being run, e.g. `bundle` or `cache clean`. */\n verb: string;\n\n /**\n * By default, the command will run against `cwd` (usually `process.cwd()`).\n * If this option is set, attempt to discover app path(s) instead.\n * (`cwd` will still be preferred if it has a `cloudpack.config.json`.)\n * See {@link AppPathDiscoveryMode} for details.\n *\n * Note that `isMultiApp` elsewhere will only be true if this is set to `'multi'` and\n * multiple apps are found.\n */\n discoverAppPaths: AppPathDiscoveryMode | undefined;\n\n /**\n * Apply any command-specific CLI options that need to be passed through to `readConfig`.\n * (Shared and reused options are applied automatically.)\n */\n applyOptionsToConfig:\n | ((\n options: Omit<TOptions, keyof (SharedOptions & ReusedOptions)>,\n ) => Pick<ReadConfigOptions, 'extraServerConfig'> | undefined)\n | undefined;\n}\n\ninterface ExtendedAppCommandContext extends AppCommandContext {\n /** Name of the app package */\n appName: string;\n}\n\n// eslint-disable-next-line no-restricted-properties -- this is the central handler\nconst realProcessExit = process.exit.bind(process);\n\n/**\n * This class manages orchestration and shared state while executing a command.\n */\nexport class CommandExecutor<TOptions extends SharedOptions> {\n private _options: TOptions;\n private _execute: CommandAction<TOptions>;\n private _programOptions: ProgramOptions;\n private _verb: string;\n private _discoverAppPaths: AppPathDiscoveryMode | undefined;\n private _applyOptionsToConfig: CommandExecutorParams<TOptions>['applyOptionsToConfig'];\n private _reporter: TaskReporter;\n /** Items which should be disposed before a restart, as well as at process exit */\n private _autoDisposableList: AutoDisposableList;\n /** Items which should be disposed before exit only */\n private _finalDisposableList: AutoDisposableList;\n private _hasCalledExit = false;\n private _args: string[];\n private _sigintCount = 0;\n private _onInterrupt?: () => void;\n private _getMessageOnInterrupt?: () => string;\n\n /** Active `CommandExecutor` instances. In tests, there may be more than one. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- options type isn't used\n private static _activeInstances = new Set<CommandExecutor<any>>();\n /** Mock implementation of `process.exit` for testing purposes. */\n private static _mockProcessExit: typeof process.exit | undefined;\n\n /**\n * Set a mock `process.exit()` implementation for tests, to handle cases where the command would\n * call `process.exit()`.\n */\n public static mockProcessExitForTests(mockImpl: typeof process.exit | undefined): void {\n CommandExecutor._mockProcessExit = mockImpl;\n }\n\n /**\n * For testing use only: end all active CommandExecutor instances and call `process.exit()`\n * (which should be mocked by the test).\n */\n public static async exitAllForTests(params: CommandExitParams): Promise<void> {\n for (const instance of CommandExecutor._activeInstances) {\n await instance._exit(params);\n }\n CommandExecutor._activeInstances = new Set();\n }\n\n /**\n * Get a list of the commands that are running, including their arguments.\n */\n public static getRunningCommands(): string[] {\n return Array.from(CommandExecutor._activeInstances).map((instance) =>\n [instance._verb, ...instance._args].join(' '),\n );\n }\n\n constructor(params: CommandExecutorParams<TOptions>) {\n this._args = params.args;\n this._options = params.options;\n this._execute = params.execute;\n this._programOptions = params.programOptions;\n this._verb = params.verb;\n this._discoverAppPaths = params.discoverAppPaths;\n this._applyOptionsToConfig = params.applyOptionsToConfig;\n\n this._autoDisposableList = new AutoDisposableList();\n this._finalDisposableList = new AutoDisposableList();\n this._finalDisposableList.add(this._autoDisposableList);\n\n this._reporter = new TaskReporter();\n this._finalDisposableList.add(this._reporter);\n\n CommandExecutor._activeInstances.add(this);\n this._finalDisposableList.add({\n dispose: () => {\n CommandExecutor._activeInstances.delete(this);\n\n // Command event listeners are currently only removed on final disposal since the start tests rely on\n // a 'ready' event listener carrying over across restarts.\n this._programOptions.commandEvents.removeAllListeners();\n },\n });\n\n // Handle SIGINT (Ctrl+C) and unhandled errors. These must be removed in _exit.\n // (Skip in tests to avoid interfering with test framework handling.)\n if (!environmentInfo.isJest) {\n process.on('SIGINT', this._sigintHandler);\n // This should also catch unhandled promise rejections\n process.on('uncaughtException', this._uncaughtExceptionHandler);\n process.on('error', this._unexpectedErrorHandler);\n // Also override process.exit in case some code calls it directly.\n // eslint-disable-next-line no-restricted-properties -- central handling code\n process.exit = ((code) => {\n // Get the call stack to display\n const error = new Error(`Unexpected process.exit(${code ?? ''}) call`);\n void this._exit({\n message: error.stack || '',\n hasErrors: true,\n exitCode: 1,\n });\n }) as typeof process.exit;\n\n this._finalDisposableList.add({\n dispose: () => {\n process.off('SIGINT', this._sigintHandler);\n process.off('uncaughtException', this._uncaughtExceptionHandler);\n process.off('error', this._unexpectedErrorHandler);\n // eslint-disable-next-line no-restricted-properties\n process.exit = realProcessExit;\n },\n });\n }\n }\n\n /**\n * Run the command, including handling for restarts. This should only be called once per instance,\n * immediately after the constructor (since constructors can't be async).\n */\n public async execute(): Promise<void> {\n try {\n let shouldRestart = false;\n do {\n shouldRestart = await this._executeOnce(shouldRestart);\n } while (shouldRestart);\n } catch (error) {\n // If an error occurs, exit the process with a non-zero exit code.\n const err = error as InvalidCloudpackConfigError;\n const message = err.isExpected\n ? err.message // Only show message for expected errors\n : err.stack || err.message || String(error); // Show full stack for unexpected errors\n\n await this._exit({\n hasErrors: true,\n message,\n });\n }\n }\n\n /**\n * Execute a single iteration of the command.\n * @returns true if a restart is needed\n */\n private async _executeOnce(isRestart: boolean): Promise<boolean> {\n const contexts = await this._initializeContexts();\n\n if (!Array.isArray(contexts)) {\n await this._exit(contexts);\n return false;\n }\n\n const spanName = `${this._verb.toUpperCase().replace(/ /g, '_')}_EXECUTE`;\n const results: CommandExitParams[] = [];\n\n for (const context of contexts) {\n // Call the execute function which is the real command logic\n // (ie: real init command logic, real start command logic, etc.)\n const result = await context.telemetryClient.tracer.startActiveSpan(spanName, async (span) => {\n this._onInterrupt = () => {\n span.setAttribute('isInterrupted', true);\n span.end();\n };\n\n const isMultiApp = contexts.length > 1;\n if (isMultiApp) {\n console.log();\n console.log(`==== Starting ${this._verb} for ${context.appName} ====`);\n }\n\n return this._execute({\n ...context,\n span,\n isMultiApp,\n args: this._args,\n options: this._options,\n commandEvents: this._programOptions.commandEvents,\n isRestart,\n autoDispose: (disposable) => this._autoDisposableList.add(disposable),\n setInterruptMessageHandler: (getMessage) => {\n this._getMessageOnInterrupt = getMessage;\n },\n });\n });\n if (result?.isInterrupted) {\n await this._exit(result);\n return false;\n }\n if (result) {\n results.push(result);\n } else {\n // If the command returned null, this means it should keep running (e.g. start).\n // We disallow returning undefined to avoid accidents.\n throw new Error('Command executor must return exit options or null');\n }\n this._onInterrupt = undefined;\n }\n\n // Determine whether a command requested a restart in this iteration.\n const shouldRestart = results.some((r) => r.restart);\n\n if (shouldRestart) {\n // Dispose all registered disposables.\n await this._autoDisposableList.dispose();\n this._reporter.reset(true /* clearOutputs */);\n\n console.warn(results.map((r) => r.message).join('\\n'));\n } else if (results.length) {\n // If one or more apps returned a result, exit.\n await this._exit({\n message: results.map((r) => r.message).join('\\n'),\n hasErrors: results.some((r) => r.hasErrors),\n // If any app returned a non-zero exit code, use that.\n exitCode: results.find(({ exitCode }) => !!exitCode)?.exitCode,\n });\n }\n\n return shouldRestart;\n }\n\n /**\n * Determine the app paths and initialize the context for each app.\n * @returns Context(s), or an exit options object if there was an error. (might also throw on error)\n */\n private async _initializeContexts(): Promise<ExtendedAppCommandContext[] | CommandExitParams> {\n let appPaths: string[];\n\n if (this._discoverAppPaths) {\n // Search for cloudpack configs to determine the app path(s)\n const { app, login } = this._options as unknown as Pick<ReusedOptions, 'app' | 'login'>;\n const appPathsResult =\n this._discoverAppPaths === 'remote'\n ? await discoverRemoteAppPaths({\n options: {\n login,\n cachePath: this._options.cachePath,\n desiredApp: app,\n },\n context: { reporter: this._reporter },\n })\n : await discoverLocalAppPaths({\n cwd: this._programOptions.cwd,\n discover: this._discoverAppPaths,\n desiredApp: app,\n });\n if (!Array.isArray(appPathsResult)) {\n // This means there was an error (or the user cancelled) while getting app paths.\n return appPathsResult;\n }\n appPaths = appPathsResult;\n } else {\n // Just use the cwd\n appPaths = [this._programOptions.cwd];\n }\n\n // The task runner is shared between all apps so that task results can potentially be reused.\n const taskRunner = new TaskRunner();\n\n const readConfig = this._discoverAppPaths === 'remote' ? readRemoteConfigs : readLocalConfigs;\n const configs = await readConfig(appPaths, {\n ...this._getConfigOptionsFromCliOptions(),\n enableDefaultFeatures: true,\n });\n\n const helpMessages = new Set<string>(\n Object.values(configs)\n .filter((c) => c.helpMessage)\n .map((c) => c.helpMessage) as string[],\n );\n\n // Set reporter options and print the product info header\n this._reporter.setOptions({\n productName: 'Cloudpack',\n version: this._programOptions.version,\n description: () => `Running \"${bold(this._programOptions.argv.slice(2).join(' '))}\"`,\n helpMessage: [...helpMessages].join('\\n'),\n plainTextMode: !this._options.color,\n logFile: !!this._options.logFile,\n cwd: this._programOptions.cwd,\n ...(this._options.debug\n ? debugLoggingConfig\n : this._options.verbose\n ? verboseLoggingConfig\n : this._options.quiet\n ? noLoggingConfig\n : defaultLoggingConfig),\n });\n\n const logLevel = this._options.verbose ? 'VERBOSE' : this._options.debug ? 'DEBUG' : undefined;\n if (!this._options.debug) {\n this._reporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n const telemetryApi = startTelemetry({\n productVersion: getVersion(import.meta.url),\n logLevel,\n serviceName: 'cli',\n });\n\n this._autoDisposableList.add({ dispose: () => telemetryApi.shutdown() });\n\n const contexts: ExtendedAppCommandContext[] = [];\n\n for (const appPath of Object.keys(configs)) {\n const config = configs[appPath];\n const definition = await readJson<PackageJson>(path.join(appPath, 'package.json'));\n const { name = path.basename(appPath) } = definition || {};\n\n const telemetryClient = await this._initTelemetry(name, config, telemetryApi);\n\n contexts.push({\n appPath,\n appName: name,\n cachePath: this._options.cachePath,\n config,\n reporter: this._reporter,\n telemetryClient,\n taskRunner,\n });\n }\n\n return contexts;\n }\n\n /** Translate certain CLI options into options for `readConfig()`. */\n private _getConfigOptionsFromCliOptions(): ReadConfigOptions {\n // These options don't exist for all commands, but that's fine.\n const options = this._options as Partial<ReusedOptions & SharedOptions>;\n return {\n mode: options.mode,\n logBundleInfo: options.logBundleInfo,\n configFileName: options.config,\n // Handle --bundler by passing it as a universal package override, which will be appended\n // to any user-provided packageSettings so that it takes precedence.\n extraPackageSettings: options.bundler ? [{ match: '*', bundler: options.bundler }] : undefined,\n extraFeatures: options.features,\n extraDefineFlags: options.define,\n ...(this._applyOptionsToConfig?.(this._options) || {}),\n };\n }\n\n private async _initTelemetry(\n appName: string | undefined,\n config: CloudpackConfig,\n telemetryApi: TelemetryApi,\n ): Promise<TelemetryClient> {\n // Mark the start time for telemetry.\n const startTime = performance.now();\n\n const programOptions = this._programOptions;\n\n const connectionString =\n this._programOptions.disableTelemetry || environmentInfo.isJest\n ? undefined\n : config.telemetry?.connectionString || environmentInfo.cloudpack.telemetryConnectionString;\n\n const telemetryClient = await telemetryApi.createClient(connectionString);\n\n telemetryClient.tracer.startSpan('CLI_ENTRY', { startTime: getCliStartTime() }).end();\n\n await telemetryClient.tracer.startActiveSpan('INIT_TELEMETRY', { startTime }, (span) => {\n const enabledFeatureNames = Object.entries(config.features || {})\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n if (enabledFeatureNames.length) {\n console.log(`Enabled features for ${appName}: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n const telemetryAttributes = {\n verb: this._verb,\n arguments: programOptions.argv.slice(3).join(' '),\n environment: environmentInfo.isCI ? 'ci' : environmentInfo.isCodespaces ? 'codespaces' : 'local',\n appName: appName || '<unknown>',\n mode: config.mode,\n features: enabledFeatureNames,\n externalCorrelationId: environmentInfo.cloudpack.telemetryExternalCorrelationId,\n // Azure DevOps build attributes\n ...environmentInfo.ado,\n };\n\n for (const [key, value] of Object.entries(telemetryAttributes)) {\n if (value) {\n span.setAttribute(key, value);\n }\n }\n });\n\n return telemetryClient;\n }\n\n private _sigintHandler = (): void => {\n this._sigintCount++;\n\n if (this._sigintCount > 1) {\n console.debug('Forcing exit');\n\n // We are forcing the process to exit.\n // No clean-up is needed because user pressed Ctrl+C twice.\n this._callProcessExit(1);\n return;\n }\n\n this._onInterrupt?.();\n\n // We are trying to exit gracefully.\n void this._exit({ isInterrupted: true, message: '' });\n };\n\n private _uncaughtExceptionHandler: NodeJS.UncaughtExceptionListener = (error, reason) => {\n const errorType = reason === 'uncaughtException' ? 'Uncaught exception' : 'Unhandled promise rejection';\n const message = `${errorType}: ${error.stack || error.message || String(error)}`;\n // Go ahead and log the message in case the process exits before cleanup is complete\n console.error(message);\n\n void this._exit({ message, hasErrors: true, exitCode: 1 });\n };\n\n private _unexpectedErrorHandler = (...args: unknown[]): void => {\n const err = new Error('Unexpected process error');\n console.error(err.stack);\n console.error('Error details:', ...args);\n };\n\n /**\n * Exit function called with the result returned by the command's execute function,\n * or manually via `CommandExecutor.exitAll()` in tests.\n *\n * Except in tests, execution can be assumed to have stopped after this is called.\n * (In tests, `process.exit` is probably mocked to throw.)\n */\n private async _exit(params: CommandExitParams): Promise<void> {\n const { hasErrors = this._reporter.hasErrors(), exitCode = hasErrors ? 1 : 0 } = params;\n const message = params.isInterrupted ? this._getMessageOnInterrupt?.() || 'Interrupted by user' : params.message;\n\n if (this._hasCalledExit) {\n // Skip most of the operations if exit() was called multiple times.\n // But only use the error message if not in a test, due to the way we're mocking process.exit.\n if (!environmentInfo.isJest) {\n const prettyParams = Object.entries(params)\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join(', ');\n console.warn(`exit() was called multiple times. This call's options: ${prettyParams}.`);\n }\n } else {\n this._hasCalledExit = true;\n\n // Show the summary message (this will throw if called twice).\n this._reporter.complete({\n summary: hasErrors ? red(message) : message,\n showHelp: exitCode !== 0,\n });\n\n // Dispose all resources\n await this._finalDisposableList.dispose();\n }\n\n this._callProcessExit(exitCode);\n }\n\n /** Call the mocked or real `process.exit()` function */\n private _callProcessExit(exitCode: number): void {\n (CommandExecutor._mockProcessExit || realProcessExit)(exitCode);\n }\n}\n"]}
1
+ {"version":3,"file":"CommandExecutor.js","sourceRoot":"","sources":["../../src/utilities/CommandExecutor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,GAAG,EACH,oBAAoB,EACpB,MAAM,GACP,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAA2C,MAAM,yBAAyB,CAAC;AAClG,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAoC,MAAM,uBAAuB,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,CAAC;IAClC,CAAC;IAED,wDAAwD;IAChD,gBAAgB,CAAC,QAAgB;QACvC,CAAC,eAAe,CAAC,gBAAgB,IAAI,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC","sourcesContent":["import type { ReadConfigOptions } from '@ms-cloudpack/config';\nimport type { CloudpackConfig, PackageJson } from '@ms-cloudpack/common-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport {\n TaskReporter,\n bold,\n debugLoggingConfig,\n defaultLoggingConfig,\n noLoggingConfig,\n red,\n verboseLoggingConfig,\n yellow,\n} from '@ms-cloudpack/task-reporter';\nimport { startTelemetry, type TelemetryApi, type TelemetryClient } from '@ms-cloudpack/telemetry';\nimport path from 'path';\nimport type { CommandAction, CommandExitParams, AppCommandContext } from '../types/CommandAction.js';\nimport type { ProgramOptions } from '../types/ProgramOptions.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\nimport { AutoDisposableList } from './AutoDisposableList.js';\nimport { getVersion } from '@ms-cloudpack/package-utilities';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport type { ReusedOptions } from '../types/ReusedOptions.js';\nimport type { AppPathDiscoveryMode } from '../types/AppPathDiscoveryMode.js';\nimport { discoverRemoteAppPaths } from './discoverRemoteAppPaths.js';\nimport { discoverLocalAppPaths } from './discoverLocalAppPaths.js';\nimport { TaskRunner } from '@ms-cloudpack/api-server';\nimport { readLocalConfigs, type InvalidCloudpackConfigError } from './readLocalConfigs.js';\nimport { readRemoteConfigs } from './readRemoteConfigs.js';\nimport { getCliStartTime } from './getCliStartTime.js';\n\nexport interface CommandExecutorParams<TOptions extends SharedOptions> {\n /** Command-specific arguments */\n args: string[];\n\n /** Command-specific and shared options. */\n options: TOptions;\n\n /** Function to execute the command. */\n execute: CommandAction<TOptions>;\n\n /** Shared program-level configuration. */\n programOptions: ProgramOptions;\n\n /** Verb being run, e.g. `bundle` or `cache clean`. */\n verb: string;\n\n /**\n * By default, the command will run against `cwd` (usually `process.cwd()`).\n * If this option is set, attempt to discover app path(s) instead.\n * (`cwd` will still be preferred if it has a `cloudpack.config.json`.)\n * See {@link AppPathDiscoveryMode} for details.\n *\n * Note that `isMultiApp` elsewhere will only be true if this is set to `'multi'` and\n * multiple apps are found.\n */\n discoverAppPaths: AppPathDiscoveryMode | undefined;\n\n /**\n * Whether to set `TaskReporter`'s `enableReset` option, which enables resetting console output.\n * This should only be true for commands like start which use watch mode, and needs to be set at\n * the beginning instead of being toggled by the command to ensure everything is captured.\n * (If true, the screen will also be cleared on startup.)\n */\n enableReporterReset: boolean | undefined;\n\n /**\n * Apply any command-specific CLI options that need to be passed through to `readConfig`.\n * (Shared and reused options are applied automatically.)\n */\n applyOptionsToConfig:\n | ((\n options: Omit<TOptions, keyof (SharedOptions & ReusedOptions)>,\n ) => Pick<ReadConfigOptions, 'extraServerConfig'> | undefined)\n | undefined;\n}\n\ninterface ExtendedAppCommandContext extends AppCommandContext {\n /** Name of the app package */\n appName: string;\n}\n\n// eslint-disable-next-line no-restricted-properties -- this is the central handler\nconst realProcessExit = process.exit.bind(process);\n\n/**\n * This class manages orchestration and shared state while executing a command.\n */\nexport class CommandExecutor<TOptions extends SharedOptions> {\n private _options: TOptions;\n private _execute: CommandAction<TOptions>;\n private _programOptions: ProgramOptions;\n private _verb: string;\n private _discoverAppPaths: AppPathDiscoveryMode | undefined;\n private _enableReporterReset: boolean;\n private _applyOptionsToConfig: CommandExecutorParams<TOptions>['applyOptionsToConfig'];\n private _reporter: TaskReporter;\n /** Items which should be disposed before a restart, as well as at process exit */\n private _autoDisposableList: AutoDisposableList;\n /** Items which should be disposed before exit only */\n private _finalDisposableList: AutoDisposableList;\n private _hasCalledExit = false;\n private _args: string[];\n private _sigintCount = 0;\n private _onInterrupt?: () => void;\n private _getMessageOnInterrupt?: () => string;\n\n /** Active `CommandExecutor` instances. In tests, there may be more than one. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- options type isn't used\n private static _activeInstances = new Set<CommandExecutor<any>>();\n /** Mock implementation of `process.exit` for testing purposes. */\n private static _mockProcessExit: typeof process.exit | undefined;\n\n /**\n * Set a mock `process.exit()` implementation for tests, to handle cases where the command would\n * call `process.exit()`.\n */\n public static mockProcessExitForTests(mockImpl: typeof process.exit | undefined): void {\n CommandExecutor._mockProcessExit = mockImpl;\n }\n\n /**\n * For testing use only: end all active CommandExecutor instances and call `process.exit()`\n * (which should be mocked by the test).\n */\n public static async exitAllForTests(params: CommandExitParams): Promise<void> {\n for (const instance of CommandExecutor._activeInstances) {\n await instance._exit(params);\n }\n CommandExecutor._activeInstances = new Set();\n }\n\n /**\n * Get a list of the commands that are running, including their arguments.\n */\n public static getRunningCommands(): string[] {\n return Array.from(CommandExecutor._activeInstances).map((instance) =>\n [instance._verb, ...instance._args].join(' '),\n );\n }\n\n constructor(params: CommandExecutorParams<TOptions>) {\n this._args = params.args;\n this._options = params.options;\n this._execute = params.execute;\n this._programOptions = params.programOptions;\n this._verb = params.verb;\n this._discoverAppPaths = params.discoverAppPaths;\n this._enableReporterReset = !!params.enableReporterReset;\n this._applyOptionsToConfig = params.applyOptionsToConfig;\n\n this._autoDisposableList = new AutoDisposableList();\n this._finalDisposableList = new AutoDisposableList();\n this._finalDisposableList.add(this._autoDisposableList);\n\n if (this._enableReporterReset) {\n // If running an interactive command, start by clearing the screen\n this._reporter = new TaskReporter({ enableReset: true });\n this._reporter.reset();\n } else {\n this._reporter = new TaskReporter();\n }\n this._finalDisposableList.add(this._reporter);\n\n CommandExecutor._activeInstances.add(this);\n this._finalDisposableList.add({\n dispose: () => {\n CommandExecutor._activeInstances.delete(this);\n\n // Command event listeners are currently only removed on final disposal since the start tests rely on\n // a 'ready' event listener carrying over across restarts.\n this._programOptions.commandEvents.removeAllListeners();\n },\n });\n\n // Handle SIGINT (Ctrl+C) and unhandled errors. These must be removed in _exit.\n // (Skip in tests to avoid interfering with test framework handling.)\n if (!environmentInfo.isJest) {\n process.on('SIGINT', this._sigintHandler);\n // This should also catch unhandled promise rejections\n process.on('uncaughtException', this._uncaughtExceptionHandler);\n process.on('error', this._unexpectedErrorHandler);\n // Also override process.exit in case some code calls it directly.\n // eslint-disable-next-line no-restricted-properties -- central handling code\n process.exit = ((code) => {\n // Get the call stack to display\n const error = new Error(`Unexpected process.exit(${code ?? ''}) call`);\n void this._exit({\n message: error.stack || '',\n hasErrors: true,\n exitCode: 1,\n });\n }) as typeof process.exit;\n\n this._finalDisposableList.add({\n dispose: () => {\n process.off('SIGINT', this._sigintHandler);\n process.off('uncaughtException', this._uncaughtExceptionHandler);\n process.off('error', this._unexpectedErrorHandler);\n // eslint-disable-next-line no-restricted-properties\n process.exit = realProcessExit;\n },\n });\n }\n }\n\n /**\n * Run the command, including handling for restarts. This should only be called once per instance,\n * immediately after the constructor (since constructors can't be async).\n */\n public async execute(): Promise<void> {\n try {\n let shouldRestart = false;\n do {\n shouldRestart = await this._executeOnce(shouldRestart);\n } while (shouldRestart);\n } catch (error) {\n // If an error occurs, exit the process with a non-zero exit code.\n const err = error as InvalidCloudpackConfigError;\n const message = err.isExpected\n ? err.message // Only show message for expected errors\n : err.stack || err.message || String(error); // Show full stack for unexpected errors\n\n await this._exit({\n hasErrors: true,\n message,\n });\n }\n }\n\n /**\n * Execute a single iteration of the command.\n * @returns true if a restart is needed\n */\n private async _executeOnce(isRestart: boolean): Promise<boolean> {\n const contexts = await this._initializeContexts();\n\n if (!Array.isArray(contexts)) {\n await this._exit(contexts);\n return false;\n }\n\n const spanName = `${this._verb.toUpperCase().replace(/ /g, '_')}_EXECUTE`;\n const results: CommandExitParams[] = [];\n\n for (const context of contexts) {\n // Call the execute function which is the real command logic\n // (ie: real init command logic, real start command logic, etc.)\n const result = await context.telemetryClient.tracer.startActiveSpan(spanName, async (span) => {\n this._onInterrupt = () => {\n span.setAttribute('isInterrupted', true);\n span.end();\n };\n\n const isMultiApp = contexts.length > 1;\n if (isMultiApp) {\n console.log();\n console.log(`==== Starting ${this._verb} for ${context.appName} ====`);\n }\n\n return this._execute({\n ...context,\n span,\n isMultiApp,\n args: this._args,\n options: this._options,\n commandEvents: this._programOptions.commandEvents,\n isRestart,\n autoDispose: (disposable) => this._autoDisposableList.add(disposable),\n setInterruptMessageHandler: (getMessage) => {\n this._getMessageOnInterrupt = getMessage;\n },\n });\n });\n if (result?.isInterrupted) {\n await this._exit(result);\n return false;\n }\n if (result) {\n results.push(result);\n } else {\n // If the command returned null, this means it should keep running (e.g. start).\n // We disallow returning undefined to avoid accidents.\n throw new Error('Command executor must return exit options or null');\n }\n this._onInterrupt = undefined;\n }\n\n // Determine whether a command requested a restart in this iteration.\n const shouldRestart = results.some((r) => r.restart);\n\n if (shouldRestart) {\n // Dispose all registered disposables.\n await this._autoDisposableList.dispose();\n this._reporter.reset(true /* clearOutputs */);\n\n console.warn(results.map((r) => r.message).join('\\n'));\n } else if (results.length) {\n // If one or more apps returned a result, exit.\n await this._exit({\n message: results.map((r) => r.message).join('\\n'),\n hasErrors: results.some((r) => r.hasErrors),\n // If any app returned a non-zero exit code, use that.\n exitCode: results.find(({ exitCode }) => !!exitCode)?.exitCode,\n });\n }\n\n return shouldRestart;\n }\n\n /**\n * Determine the app paths and initialize the context for each app.\n * @returns Context(s), or an exit options object if there was an error. (might also throw on error)\n */\n private async _initializeContexts(): Promise<ExtendedAppCommandContext[] | CommandExitParams> {\n let appPaths: string[];\n\n if (this._discoverAppPaths) {\n // Search for cloudpack configs to determine the app path(s)\n const { app, login } = this._options as unknown as Pick<ReusedOptions, 'app' | 'login'>;\n const appPathsResult =\n this._discoverAppPaths === 'remote'\n ? await discoverRemoteAppPaths({\n options: {\n login,\n cachePath: this._options.cachePath,\n desiredApp: app,\n },\n context: { reporter: this._reporter },\n })\n : await discoverLocalAppPaths({\n cwd: this._programOptions.cwd,\n discover: this._discoverAppPaths,\n desiredApp: app,\n });\n if (!Array.isArray(appPathsResult)) {\n // This means there was an error (or the user cancelled) while getting app paths.\n return appPathsResult;\n }\n appPaths = appPathsResult;\n } else {\n // Just use the cwd\n appPaths = [this._programOptions.cwd];\n }\n\n // The task runner is shared between all apps so that task results can potentially be reused.\n const taskRunner = new TaskRunner();\n\n const readConfig = this._discoverAppPaths === 'remote' ? readRemoteConfigs : readLocalConfigs;\n const configs = await readConfig(appPaths, {\n ...this._getConfigOptionsFromCliOptions(),\n enableDefaultFeatures: true,\n });\n\n const helpMessages = new Set<string>(\n Object.values(configs)\n .filter((c) => c.helpMessage)\n .map((c) => c.helpMessage) as string[],\n );\n\n // Set reporter options and print the product info header\n this._reporter.setOptions({\n productName: 'Cloudpack',\n version: this._programOptions.version,\n description: () => `Running \"${bold(this._programOptions.argv.slice(2).join(' '))}\"`,\n helpMessage: [...helpMessages].join('\\n'),\n plainTextMode: !this._options.color,\n logFile: !!this._options.logFile,\n cwd: this._programOptions.cwd,\n enableReset: this._enableReporterReset,\n ...(this._options.debug\n ? debugLoggingConfig\n : this._options.verbose\n ? verboseLoggingConfig\n : this._options.quiet\n ? noLoggingConfig\n : defaultLoggingConfig),\n });\n\n const logLevel = this._options.verbose ? 'VERBOSE' : this._options.debug ? 'DEBUG' : undefined;\n if (!this._options.debug) {\n this._reporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n const telemetryApi = startTelemetry({\n productVersion: getVersion(import.meta.url),\n logLevel,\n serviceName: 'cli',\n });\n\n this._autoDisposableList.add({ dispose: () => telemetryApi.shutdown() });\n\n const contexts: ExtendedAppCommandContext[] = [];\n\n for (const appPath of Object.keys(configs)) {\n const config = configs[appPath];\n const definition = await readJson<PackageJson>(path.join(appPath, 'package.json'));\n const { name = path.basename(appPath) } = definition || {};\n\n const telemetryClient = await this._initTelemetry(name, config, telemetryApi);\n\n contexts.push({\n appPath,\n appName: name,\n cachePath: this._options.cachePath,\n config,\n reporter: this._reporter,\n telemetryClient,\n taskRunner,\n });\n }\n\n return contexts;\n }\n\n /** Translate certain CLI options into options for `readConfig()`. */\n private _getConfigOptionsFromCliOptions(): ReadConfigOptions {\n // These options don't exist for all commands, but that's fine.\n const options = this._options as Partial<ReusedOptions & SharedOptions>;\n return {\n mode: options.mode,\n logBundleInfo: options.logBundleInfo,\n configFileName: options.config,\n // Handle --bundler by passing it as a universal package override, which will be appended\n // to any user-provided packageSettings so that it takes precedence.\n extraPackageSettings: options.bundler ? [{ match: '*', bundler: options.bundler }] : undefined,\n extraFeatures: options.features,\n extraDefineFlags: options.define,\n ...(this._applyOptionsToConfig?.(this._options) || {}),\n };\n }\n\n private async _initTelemetry(\n appName: string | undefined,\n config: CloudpackConfig,\n telemetryApi: TelemetryApi,\n ): Promise<TelemetryClient> {\n // Mark the start time for telemetry.\n const startTime = performance.now();\n\n const programOptions = this._programOptions;\n\n const connectionString =\n this._programOptions.disableTelemetry || environmentInfo.isJest\n ? undefined\n : config.telemetry?.connectionString || environmentInfo.cloudpack.telemetryConnectionString;\n\n const telemetryClient = await telemetryApi.createClient(connectionString);\n\n telemetryClient.tracer.startSpan('CLI_ENTRY', { startTime: getCliStartTime() }).end();\n\n await telemetryClient.tracer.startActiveSpan('INIT_TELEMETRY', { startTime }, (span) => {\n const enabledFeatureNames = Object.entries(config.features || {})\n .filter(([, value]) => value)\n .map(([key]) => key);\n\n if (enabledFeatureNames.length) {\n console.log(`Enabled features for ${appName}: ${enabledFeatureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n const telemetryAttributes = {\n verb: this._verb,\n arguments: programOptions.argv.slice(3).join(' '),\n environment: environmentInfo.isCI ? 'ci' : environmentInfo.isCodespaces ? 'codespaces' : 'local',\n appName: appName || '<unknown>',\n mode: config.mode,\n features: enabledFeatureNames,\n externalCorrelationId: environmentInfo.cloudpack.telemetryExternalCorrelationId,\n // Azure DevOps build attributes\n ...environmentInfo.ado,\n };\n\n for (const [key, value] of Object.entries(telemetryAttributes)) {\n if (value) {\n span.setAttribute(key, value);\n }\n }\n });\n\n return telemetryClient;\n }\n\n private _sigintHandler = (): void => {\n this._sigintCount++;\n\n if (this._sigintCount > 1) {\n console.debug('Forcing exit');\n\n // We are forcing the process to exit.\n // No clean-up is needed because user pressed Ctrl+C twice.\n this._callProcessExit(1);\n return;\n }\n\n this._onInterrupt?.();\n\n // We are trying to exit gracefully.\n void this._exit({ isInterrupted: true, message: '' });\n };\n\n private _uncaughtExceptionHandler: NodeJS.UncaughtExceptionListener = (error, reason) => {\n const errorType = reason === 'uncaughtException' ? 'Uncaught exception' : 'Unhandled promise rejection';\n const message = `${errorType}: ${error.stack || error.message || String(error)}`;\n // Go ahead and log the message in case the process exits before cleanup is complete\n console.error(message);\n\n void this._exit({ message, hasErrors: true, exitCode: 1 });\n };\n\n private _unexpectedErrorHandler = (...args: unknown[]): void => {\n const err = new Error('Unexpected process error');\n console.error(err.stack);\n console.error('Error details:', ...args);\n };\n\n /**\n * Exit function called with the result returned by the command's execute function,\n * or manually via `CommandExecutor.exitAll()` in tests.\n *\n * Except in tests, execution can be assumed to have stopped after this is called.\n * (In tests, `process.exit` is probably mocked to throw.)\n */\n private async _exit(params: CommandExitParams): Promise<void> {\n const { hasErrors = this._reporter.hasErrors(), exitCode = hasErrors ? 1 : 0 } = params;\n const message = params.isInterrupted ? this._getMessageOnInterrupt?.() || 'Interrupted by user' : params.message;\n\n if (this._hasCalledExit) {\n // Skip most of the operations if exit() was called multiple times.\n // But only use the error message if not in a test, due to the way we're mocking process.exit.\n if (!environmentInfo.isJest) {\n const prettyParams = Object.entries(params)\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join(', ');\n console.warn(`exit() was called multiple times. This call's options: ${prettyParams}.`);\n }\n } else {\n this._hasCalledExit = true;\n\n // Show the summary message (this will throw if called twice).\n this._reporter.complete({\n summary: hasErrors ? red(message) : message,\n showHelp: exitCode !== 0,\n });\n\n // Dispose all resources\n await this._finalDisposableList.dispose();\n }\n\n this._callProcessExit(exitCode);\n }\n\n /** Call the mocked or real `process.exit()` function */\n private _callProcessExit(exitCode: number): void {\n (CommandExecutor._mockProcessExit || realProcessExit)(exitCode);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.78.1",
3
+ "version": "0.79.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",
@@ -30,25 +30,25 @@
30
30
  "test": "cloudpack-scripts test"
31
31
  },
32
32
  "dependencies": {
33
- "@ms-cloudpack/api-server": "^0.66.24",
34
- "@ms-cloudpack/app-server": "^0.20.63",
35
- "@ms-cloudpack/bundler": "^0.27.25",
36
- "@ms-cloudpack/bundler-capabilities": "^0.5.2",
37
- "@ms-cloudpack/common-types": "^0.33.3",
38
- "@ms-cloudpack/config": "^0.38.37",
39
- "@ms-cloudpack/create-express-app": "^1.10.73",
33
+ "@ms-cloudpack/api-server": "^0.67.1",
34
+ "@ms-cloudpack/app-server": "^0.20.65",
35
+ "@ms-cloudpack/bundler": "^0.27.27",
36
+ "@ms-cloudpack/bundler-capabilities": "^0.5.3",
37
+ "@ms-cloudpack/common-types": "^0.34.0",
38
+ "@ms-cloudpack/config": "^0.38.39",
39
+ "@ms-cloudpack/create-express-app": "^1.10.74",
40
40
  "@ms-cloudpack/environment": "^0.1.1",
41
- "@ms-cloudpack/file-watcher": "^0.4.32",
41
+ "@ms-cloudpack/file-watcher": "^0.4.33",
42
42
  "@ms-cloudpack/json-utilities": "^0.1.11",
43
- "@ms-cloudpack/link-proxy": "^0.2.85",
44
- "@ms-cloudpack/overlay": "^0.19.81",
45
- "@ms-cloudpack/package-utilities": "^13.7.3",
43
+ "@ms-cloudpack/link-proxy": "^0.2.87",
44
+ "@ms-cloudpack/overlay": "^0.19.83",
45
+ "@ms-cloudpack/package-utilities": "^13.8.1",
46
46
  "@ms-cloudpack/path-string-parsing": "^1.3.0",
47
- "@ms-cloudpack/path-utilities": "^3.2.9",
48
- "@ms-cloudpack/remote-cache": "^0.11.72",
49
- "@ms-cloudpack/setup-utilities": "^0.5.57",
50
- "@ms-cloudpack/task-reporter": "^0.20.0",
51
- "@ms-cloudpack/telemetry": "^0.11.72",
47
+ "@ms-cloudpack/path-utilities": "^3.2.10",
48
+ "@ms-cloudpack/remote-cache": "^0.11.74",
49
+ "@ms-cloudpack/setup-utilities": "^0.5.58",
50
+ "@ms-cloudpack/task-reporter": "^0.20.1",
51
+ "@ms-cloudpack/telemetry": "^0.11.74",
52
52
  "@yarnpkg/lockfile": "^1.1.0",
53
53
  "commander": "^14.0.0",
54
54
  "cross-spawn": "^7.0.3",
@@ -61,7 +61,7 @@
61
61
  "workspace-tools": "^0.41.0"
62
62
  },
63
63
  "devDependencies": {
64
- "@ms-cloudpack/common-types": "^0.33.3",
64
+ "@ms-cloudpack/common-types": "^0.34.0",
65
65
  "@ms-cloudpack/common-types-browser": "^0.6.5",
66
66
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
67
67
  "@ms-cloudpack/scripts": "^0.0.1",
@@ -974,7 +974,7 @@
974
974
  "type": "number",
975
975
  "description": "The length of the array."
976
976
  },
977
- "__@toStringTag@1177": {
977
+ "__@toStringTag@1178": {
978
978
  "type": "string",
979
979
  "const": "BigUint64Array"
980
980
  }
@@ -985,7 +985,7 @@
985
985
  "byteLength",
986
986
  "byteOffset",
987
987
  "length",
988
- "__@toStringTag@1177"
988
+ "__@toStringTag@1178"
989
989
  ],
990
990
  "additionalProperties": {
991
991
  "type": "number"
@@ -1025,7 +1025,7 @@
1025
1025
  "type": "number",
1026
1026
  "description": "The length of the array."
1027
1027
  },
1028
- "__@toStringTag@1177": {
1028
+ "__@toStringTag@1178": {
1029
1029
  "type": "string",
1030
1030
  "const": "BigInt64Array"
1031
1031
  }
@@ -1036,7 +1036,7 @@
1036
1036
  "byteLength",
1037
1037
  "byteOffset",
1038
1038
  "length",
1039
- "__@toStringTag@1177"
1039
+ "__@toStringTag@1178"
1040
1040
  ],
1041
1041
  "additionalProperties": {
1042
1042
  "type": "number"
@@ -1505,6 +1505,9 @@
1505
1505
  "syncInternalPackages": {
1506
1506
  "type": "boolean"
1507
1507
  },
1508
+ "staticAnalysisInit": {
1509
+ "type": "boolean"
1510
+ },
1508
1511
  "useSingleWebServer": {
1509
1512
  "type": "boolean"
1510
1513
  },
@@ -975,7 +975,7 @@
975
975
  "type": "number",
976
976
  "description": "The length of the array."
977
977
  },
978
- "__@toStringTag@1177": {
978
+ "__@toStringTag@1178": {
979
979
  "type": "string",
980
980
  "const": "BigUint64Array"
981
981
  }
@@ -986,7 +986,7 @@
986
986
  "byteLength",
987
987
  "byteOffset",
988
988
  "length",
989
- "__@toStringTag@1177"
989
+ "__@toStringTag@1178"
990
990
  ],
991
991
  "additionalProperties": {
992
992
  "type": "number"
@@ -1026,7 +1026,7 @@
1026
1026
  "type": "number",
1027
1027
  "description": "The length of the array."
1028
1028
  },
1029
- "__@toStringTag@1177": {
1029
+ "__@toStringTag@1178": {
1030
1030
  "type": "string",
1031
1031
  "const": "BigInt64Array"
1032
1032
  }
@@ -1037,7 +1037,7 @@
1037
1037
  "byteLength",
1038
1038
  "byteOffset",
1039
1039
  "length",
1040
- "__@toStringTag@1177"
1040
+ "__@toStringTag@1178"
1041
1041
  ],
1042
1042
  "additionalProperties": {
1043
1043
  "type": "number"
@@ -1506,6 +1506,9 @@
1506
1506
  "syncInternalPackages": {
1507
1507
  "type": "boolean"
1508
1508
  },
1509
+ "staticAnalysisInit": {
1510
+ "type": "boolean"
1511
+ },
1509
1512
  "useSingleWebServer": {
1510
1513
  "type": "boolean"
1511
1514
  },