@ms-cloudpack/cli 0.47.8 → 0.47.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,aAAa,CAuChD,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,aAAa,CAwChD,CAAC"}
@@ -19,6 +19,7 @@ export const execute = async ({ options, cwd, reporter, initialize, exit, autoDi
19
19
  outputPath: path.resolve(packagePath, outdir),
20
20
  bundlerType,
21
21
  disableSourceMaps,
22
+ shouldForce: true,
22
23
  },
23
24
  ctx,
24
25
  });
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,EAAE,EAC1D,OAAO,EACP,GAAG,EACH,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1D,MAAM,WAAW,GAAG,GAAG,CAAC;IAExB,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAEzF,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CACvB,MAAM,uBAAuB,CAAC;QAC5B,OAAO,EAAE,WAAW;QACpB,MAAM;QACN,QAAQ;QACR,eAAe;QACf,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC;KAC/D,CAAC,CACH,CAAC;IAEF,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEvD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,oBAAoB,CAAC;QAC5C,KAAK,EAAE;YACL,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;YACrC,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,OAAO;YACvC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;YAC7C,WAAW;YACX,iBAAiB;SAClB;QACD,GAAG;KACJ,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC;QACT,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,uBAAuB","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\n\nimport { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server/apis';\nimport path from 'path';\n\nexport const execute: CommandAction<BundleOptions> = async ({\n options,\n cwd,\n reporter,\n initialize,\n exit,\n autoDispose,\n}) => {\n const { config, telemetryClient } = await initialize(cwd);\n const packagePath = cwd;\n\n const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;\n\n const [ctx] = autoDispose(\n await createPartialApiContext({\n appPath: packagePath,\n config,\n reporter,\n telemetryClient,\n items: ['packages', 'watcher', 'session', 'taskRunner', 'bus'],\n }),\n );\n\n const definition = await ctx.packages.get(packagePath);\n\n const { result } = await ensurePackageBundled({\n input: {\n name: definition?.name ?? '<unknown>',\n version: definition?.version ?? '0.0.0',\n outputPath: path.resolve(packagePath, outdir),\n bundlerType,\n disableSourceMaps,\n },\n ctx,\n });\n\n await exit({\n exitCode: result?.errors?.length === 0 ? 0 : 1,\n });\n};\n\n// cspell:ignore outdir\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/bundle/execute.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,EAAE,EAC1D,OAAO,EACP,GAAG,EACH,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;IAC1D,MAAM,WAAW,GAAG,GAAG,CAAC;IAExB,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAEzF,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CACvB,MAAM,uBAAuB,CAAC;QAC5B,OAAO,EAAE,WAAW;QACpB,MAAM;QACN,QAAQ;QACR,eAAe;QACf,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC;KAC/D,CAAC,CACH,CAAC;IAEF,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEvD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,oBAAoB,CAAC;QAC5C,KAAK,EAAE;YACL,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;YACrC,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,OAAO;YACvC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;YAC7C,WAAW;YACX,iBAAiB;YACjB,WAAW,EAAE,IAAI;SAClB;QACD,GAAG;KACJ,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC;QACT,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,uBAAuB","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\n\nimport { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server/apis';\nimport path from 'path';\n\nexport const execute: CommandAction<BundleOptions> = async ({\n options,\n cwd,\n reporter,\n initialize,\n exit,\n autoDispose,\n}) => {\n const { config, telemetryClient } = await initialize(cwd);\n const packagePath = cwd;\n\n const { bundler: bundlerType, outdir = 'dist/browser-esm', disableSourceMaps } = options;\n\n const [ctx] = autoDispose(\n await createPartialApiContext({\n appPath: packagePath,\n config,\n reporter,\n telemetryClient,\n items: ['packages', 'watcher', 'session', 'taskRunner', 'bus'],\n }),\n );\n\n const definition = await ctx.packages.get(packagePath);\n\n const { result } = await ensurePackageBundled({\n input: {\n name: definition?.name ?? '<unknown>',\n version: definition?.version ?? '0.0.0',\n outputPath: path.resolve(packagePath, outdir),\n bundlerType,\n disableSourceMaps,\n shouldForce: true,\n },\n ctx,\n });\n\n await exit({\n exitCode: result?.errors?.length === 0 ? 0 : 1,\n });\n};\n\n// cspell:ignore outdir\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateImportsForOverrides.d.ts","sourceRoot":"","sources":["../../../src/commands/init/evaluateImportsForOverrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,sBAAsB,CAAC;AAE7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAQlE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAElF;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE;IACzD,QAAQ,EAAE,uBAAuB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,UAAU,EAAE,WAAW,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;CACxB,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,uBAAuB,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC,CAmHD"}
1
+ {"version":3,"file":"evaluateImportsForOverrides.d.ts","sourceRoot":"","sources":["../../../src/commands/init/evaluateImportsForOverrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,sBAAsB,CAAC;AAE7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAQlE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAElF;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE;IACzD,QAAQ,EAAE,uBAAuB,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,UAAU,EAAE,WAAW,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;CACxB,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,uBAAuB,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC,CAiHD"}
@@ -18,10 +18,8 @@ export async function evaluateImportsForOverrides(options) {
18
18
  const dependencyPath = resolveEntry?.path;
19
19
  const dependencyDefinition = dependencyPath ? await packages.get(dependencyPath) : undefined;
20
20
  if (!dependencyPath || !dependencyDefinition) {
21
- const errorMessage = `Package "${displayName}" imports from the package "${dependencyName}" but it couldn't be found. ` +
22
- `Ensure that "${dependencyName}" is listed in dependencies of "${displayName}".`;
23
- console.error(errorMessage);
24
- errors.push(errorMessage);
21
+ errors.push(`Package "${displayName}" imports from the package "${dependencyName}" but it couldn't be found. ` +
22
+ `Ensure that "${dependencyName}" is listed in dependencies of "${displayName}".`);
25
23
  continue;
26
24
  }
27
25
  // Make sure to add the package to the list of packages to evaluate.
@@ -66,7 +64,6 @@ export async function evaluateImportsForOverrides(options) {
66
64
  });
67
65
  if (!addedEntry) {
68
66
  const errorMessage = `Imported "${cyan(dependencyImportPath.replace('.', dependencyName))}" but a corresponding file couldn't be found. Either correct the import or adjust the "${cyan(dependencyName)}" package version to one that supports this import path.\n${bulletedList([`${cyan(displayName)}: ${packagePath}`, `${cyan(dependencyName)}: ${dependencyPath}`], 2)}`;
69
- console.error(errorMessage);
70
67
  errors.push(errorMessage);
71
68
  }
72
69
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateImportsForOverrides.js","sourceRoot":"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AE,CAAC;YAExC,MAAM,UAAU,GAAG,MAAM,kBAAkB,CACzC;gBACE,OAAO,EAAE,wBAAwB,CAAC,OAAO;gBACzC,WAAW,EAAE,cAAc;gBAC3B,UAAU,EAAE,oBAAoB;aACjC,EACD;gBACE,QAAQ;aACT,CACF,CAAC;YAEF,IAAI,CAAC,UAAU,EAAE;gBACf,MAAM,YAAY,GAAG,aAAa,IAAI,CACpC,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAClD,0FAA0F,IAAI,CAC7F,cAAc,CACf,6DAA6D,YAAY,CACxE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,cAAc,EAAE,CAAC,EACtF,CAAC,CACF,EAAE,CAAC;gBACJ,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;gBAC5B,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aAC3B;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE,oBAAoB,CAAC,OAAO,IAAI,EAAE;oBAC3C,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,cAAc;4BACpB,MAAM,EAAE,oBAAoB;4BAC5B,MAAM,EAAE,gBAAgB,WAAW,GAAG;yBACvC;qBACF;iBACF,CAAC,CAAC;gBAEH,4FAA4F;gBAC5F,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;aACpC;SACF;KACF;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["import type { PackageDefinitionsCache, PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { GeneratedConfig, PackageSettings } from '@ms-cloudpack/config';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n flattenExportsMap,\n getExportsMap,\n} from '@ms-cloudpack/package-utilities';\nimport { bulletedList, cyan } from '@ms-cloudpack/task-reporter';\nimport type { GeneratedPackageChanges } from './types/GeneratedPackageChanges.js';\n\n/**\n * Evaluate the imports depended on by a package to determine if missing exports map paths need to be added.\n * If so, updates package overrides to the given packageOverrides array.\n */\nexport async function evaluateImportsForOverrides(options: {\n packages: PackageDefinitionsCache;\n imports: Record<string, string[]>;\n definition: PackageJson;\n packagePath: string;\n generatedConfig: GeneratedConfig;\n resolveMap: ResolveMap;\n}): Promise<{\n changes: GeneratedPackageChanges[];\n errors: string[];\n pathsToEvaluate: Set<string>;\n pathsToRefresh: Set<string>;\n}> {\n const {\n packages,\n imports,\n definition,\n packagePath,\n generatedConfig,\n\n resolveMap,\n } = options;\n const displayName = `${definition.name}@${definition.version}`;\n const changes: GeneratedPackageChanges[] = [];\n const errors: string[] = [];\n const pathsToEvaluate = new Set<string>();\n const pathsToRefresh = new Set<string>();\n\n // Iterate through imports and find their path from the resolve map.\n for (const [dependencyName, dependencyImportPaths] of Object.entries(imports)) {\n const resolveEntry = findResolveMapEntry({ definition, packageName: dependencyName, resolveMap });\n const dependencyPath = resolveEntry?.path;\n const dependencyDefinition = dependencyPath ? await packages.get(dependencyPath) : undefined;\n\n if (!dependencyPath || !dependencyDefinition) {\n const errorMessage =\n `Package \"${displayName}\" imports from the package \"${dependencyName}\" but it couldn't be found. ` +\n `Ensure that \"${dependencyName}\" is listed in dependencies of \"${displayName}\".`;\n console.error(errorMessage);\n errors.push(errorMessage);\n\n continue;\n }\n\n // Make sure to add the package to the list of packages to evaluate.\n pathsToEvaluate.add(dependencyPath);\n\n // Get the flattened bundle-able exports map for this dependency and iterate through our import paths to ensure nothing is missing.\n const exports = await getExportsMap({ packagePath: dependencyPath }, { packages });\n const flattenedExports = flattenExportsMap(exports);\n const packageSettings = (generatedConfig.packageSettings ??= []);\n const { name, version } = dependencyDefinition;\n let generatedPackageSettings: PackageSettings | undefined;\n\n if (!name || !version) {\n throw new Error(`Package \"${displayName}\" depends on \"${dependencyName}\" but it is missing a name or version.`);\n }\n\n for (const dependencyImportPath of dependencyImportPaths) {\n if (flattenedExports[dependencyImportPath]) {\n continue;\n }\n\n // We are missing an import path. We need to add this entry to the exports map in package settings.\n generatedPackageSettings ??= getPackageSettings({\n config: { generated: { packageSettings } },\n name,\n version,\n firstMatch: true,\n }).generatedPackageSettings;\n\n if (!generatedPackageSettings) {\n generatedPackageSettings = {\n match: {\n name,\n version: `^${version}`,\n },\n exports: {},\n };\n packageSettings.push(generatedPackageSettings);\n }\n\n generatedPackageSettings.exports ??= {};\n\n const addedEntry = await addExportsMapEntry(\n {\n exports: generatedPackageSettings.exports,\n packagePath: dependencyPath,\n importPath: dependencyImportPath,\n },\n {\n packages,\n },\n );\n\n if (!addedEntry) {\n const errorMessage = `Imported \"${cyan(\n dependencyImportPath.replace('.', dependencyName),\n )}\" but a corresponding file couldn't be found. Either correct the import or adjust the \"${cyan(\n dependencyName,\n )}\" package version to one that supports this import path.\\n${bulletedList(\n [`${cyan(displayName)}: ${packagePath}`, `${cyan(dependencyName)}: ${dependencyPath}`],\n 2,\n )}`;\n console.error(errorMessage);\n errors.push(errorMessage);\n } else {\n changes.push({\n name: dependencyName,\n version: dependencyDefinition.version || '',\n path: dependencyPath,\n changes: [\n {\n type: 'added-export',\n change: dependencyImportPath,\n reason: `Imported by \"${displayName}\"`,\n },\n ],\n });\n\n // Since we've found a missing exports, we need to re-enqueue the dependency for evaluation.\n pathsToRefresh.add(dependencyPath);\n }\n }\n }\n\n return { changes, errors, pathsToEvaluate, pathsToRefresh };\n}\n"]}
1
+ {"version":3,"file":"evaluateImportsForOverrides.js","sourceRoot":"","sources":["../../../src/commands/init/evaluateImportsForOverrides.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,kB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AE;gBACf,MAAM,YAAY,GAAG,aAAa,IAAI,CACpC,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAClD,0FAA0F,IAAI,CAC7F,cAAc,CACf,6DAA6D,YAAY,CACxE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,cAAc,EAAE,CAAC,EACtF,CAAC,CACF,EAAE,CAAC;gBACJ,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;aAC3B;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE,oBAAoB,CAAC,OAAO,IAAI,EAAE;oBAC3C,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,cAAc;4BACpB,MAAM,EAAE,oBAAoB;4BAC5B,MAAM,EAAE,gBAAgB,WAAW,GAAG;yBACvC;qBACF;iBACF,CAAC,CAAC;gBAEH,4FAA4F;gBAC5F,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;aACpC;SACF;KACF;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["import type { PackageDefinitionsCache, PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { GeneratedConfig, PackageSettings } from '@ms-cloudpack/config';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n flattenExportsMap,\n getExportsMap,\n} from '@ms-cloudpack/package-utilities';\nimport { bulletedList, cyan } from '@ms-cloudpack/task-reporter';\nimport type { GeneratedPackageChanges } from './types/GeneratedPackageChanges.js';\n\n/**\n * Evaluate the imports depended on by a package to determine if missing exports map paths need to be added.\n * If so, updates package overrides to the given packageOverrides array.\n */\nexport async function evaluateImportsForOverrides(options: {\n packages: PackageDefinitionsCache;\n imports: Record<string, string[]>;\n definition: PackageJson;\n packagePath: string;\n generatedConfig: GeneratedConfig;\n resolveMap: ResolveMap;\n}): Promise<{\n changes: GeneratedPackageChanges[];\n errors: string[];\n pathsToEvaluate: Set<string>;\n pathsToRefresh: Set<string>;\n}> {\n const {\n packages,\n imports,\n definition,\n packagePath,\n generatedConfig,\n\n resolveMap,\n } = options;\n const displayName = `${definition.name}@${definition.version}`;\n const changes: GeneratedPackageChanges[] = [];\n const errors: string[] = [];\n const pathsToEvaluate = new Set<string>();\n const pathsToRefresh = new Set<string>();\n\n // Iterate through imports and find their path from the resolve map.\n for (const [dependencyName, dependencyImportPaths] of Object.entries(imports)) {\n const resolveEntry = findResolveMapEntry({ definition, packageName: dependencyName, resolveMap });\n const dependencyPath = resolveEntry?.path;\n const dependencyDefinition = dependencyPath ? await packages.get(dependencyPath) : undefined;\n\n if (!dependencyPath || !dependencyDefinition) {\n errors.push(\n `Package \"${displayName}\" imports from the package \"${dependencyName}\" but it couldn't be found. ` +\n `Ensure that \"${dependencyName}\" is listed in dependencies of \"${displayName}\".`,\n );\n\n continue;\n }\n\n // Make sure to add the package to the list of packages to evaluate.\n pathsToEvaluate.add(dependencyPath);\n\n // Get the flattened bundle-able exports map for this dependency and iterate through our import paths to ensure nothing is missing.\n const exports = await getExportsMap({ packagePath: dependencyPath }, { packages });\n const flattenedExports = flattenExportsMap(exports);\n const packageSettings = (generatedConfig.packageSettings ??= []);\n const { name, version } = dependencyDefinition;\n let generatedPackageSettings: PackageSettings | undefined;\n\n if (!name || !version) {\n throw new Error(`Package \"${displayName}\" depends on \"${dependencyName}\" but it is missing a name or version.`);\n }\n\n for (const dependencyImportPath of dependencyImportPaths) {\n if (flattenedExports[dependencyImportPath]) {\n continue;\n }\n\n // We are missing an import path. We need to add this entry to the exports map in package settings.\n generatedPackageSettings ??= getPackageSettings({\n config: { generated: { packageSettings } },\n name,\n version,\n firstMatch: true,\n }).generatedPackageSettings;\n\n if (!generatedPackageSettings) {\n generatedPackageSettings = {\n match: {\n name,\n version: `^${version}`,\n },\n exports: {},\n };\n packageSettings.push(generatedPackageSettings);\n }\n\n generatedPackageSettings.exports ??= {};\n\n const addedEntry = await addExportsMapEntry(\n {\n exports: generatedPackageSettings.exports,\n packagePath: dependencyPath,\n importPath: dependencyImportPath,\n },\n {\n packages,\n },\n );\n\n if (!addedEntry) {\n const errorMessage = `Imported \"${cyan(\n dependencyImportPath.replace('.', dependencyName),\n )}\" but a corresponding file couldn't be found. Either correct the import or adjust the \"${cyan(\n dependencyName,\n )}\" package version to one that supports this import path.\\n${bulletedList(\n [`${cyan(displayName)}: ${packagePath}`, `${cyan(dependencyName)}: ${dependencyPath}`],\n 2,\n )}`;\n errors.push(errorMessage);\n } else {\n changes.push({\n name: dependencyName,\n version: dependencyDefinition.version || '',\n path: dependencyPath,\n changes: [\n {\n type: 'added-export',\n change: dependencyImportPath,\n reason: `Imported by \"${displayName}\"`,\n },\n ],\n });\n\n // Since we've found a missing exports, we need to re-enqueue the dependency for evaluation.\n pathsToRefresh.add(dependencyPath);\n }\n }\n }\n\n return { changes, errors, pathsToEvaluate, pathsToRefresh };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"formatInitSummary.d.ts","sourceRoot":"","sources":["../../../src/commands/init/formatInitSummary.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW,UA4F5E"}
1
+ {"version":3,"file":"formatInitSummary.d.ts","sourceRoot":"","sources":["../../../src/commands/init/formatInitSummary.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,WAAW,UAkG5E"}
@@ -1,5 +1,5 @@
1
1
  import { slash } from '@ms-cloudpack/path-string-parsing';
2
- import { bold, bulletedList, cyan, green, lightCyan, plural, red, yellow, formatTime, } from '@ms-cloudpack/task-reporter';
2
+ import { bold, bulletedList, cyan, green, lightCyan, plural, red, yellow, formatTime, statusCharacter, } from '@ms-cloudpack/task-reporter';
3
3
  import path from 'path';
4
4
  /**
5
5
  * Given an init summary and init options, returns a formatted string message to display to the user via console.
@@ -26,28 +26,33 @@ export function formatInitSummary(summary, options) {
26
26
  // Report packages with warnings.
27
27
  if (packagesWithWarnings.length) {
28
28
  summaryString.push(`${plural(packagesWithWarnings.length, 'package')} with ${yellow('warnings')}:\n`);
29
+ let currentCount = 1;
29
30
  for (const packageWithWarnings of packagesWithWarnings) {
30
- summaryString.push(`${formatPackageName(packageWithWarnings)} - ${yellow(plural(packageWithWarnings.warnings.length, 'warning'))}, ${packageWithWarnings.path}:`);
31
+ summaryString.push(`${yellow(`${statusCharacter.warn} ${currentCount++}.`)} ${formatPackageName(packageWithWarnings)} - ${yellow(plural(packageWithWarnings.warnings.length, 'warning'))}, ${packageWithWarnings.path}:`);
31
32
  summaryString.push(formatBundleMessages(packageWithWarnings, false), '');
32
33
  }
33
34
  }
34
35
  // Report packages with errors.
35
36
  if (packagesWithErrors.length) {
36
37
  summaryString.push(`${plural(packagesWithErrors.length, 'package')} ${red('failed')}:\n`);
38
+ let currentCount = 1;
37
39
  for (const packageWithErrors of packagesWithErrors) {
38
- summaryString.push(`${formatPackageName(packageWithErrors)} - ${red(plural(packageWithErrors.errors.length, 'error'))}, ${packageWithErrors.path}:`);
40
+ summaryString.push(`${red(`${statusCharacter.fail} ${currentCount++}.`)} ${formatPackageName(packageWithErrors)} - ${red(plural(packageWithErrors.errors.length, 'error'))}, ${packageWithErrors.path}:`);
39
41
  summaryString.push(formatBundleMessages(packageWithErrors, true), '');
40
42
  }
41
43
  }
42
44
  const generatedUpdateCount = (check && !!generatedFileUpdates.length) || 0;
43
45
  const blockingIssueCount = packagesWithErrors.length || 0;
44
- const requiresChanges = check && totalChanges;
46
+ const requiresChanges = (check && totalChanges) || 0;
45
47
  // Add summary.
46
- summaryString.push(`${cyan(plural(totalPackages, 'package'))} evaluated in ${formatTime(summary.duration)}${requiresChanges ? `, ${red(plural(totalChanges, 'change'))} required` : ''}${blockingIssueCount
47
- ? `, ${blockingIssueCount} with ${red('blocking issues')}`
48
- : requiresChanges
49
- ? ''
50
- : `, ${green('no blocking issues found')}`}. (Total: ${plural(totalErrors, 'error')}, ${plural(totalWarnings, 'warning')})`, '');
48
+ summaryString.push(`${cyan(plural(totalPackages, 'total package'))} evaluated in ${formatTime(summary.duration)}:`, bulletedList([
49
+ requiresChanges ? `${red(plural(totalChanges, 'change'))} required` : undefined,
50
+ `${green(plural(totalPackages - blockingIssueCount, 'package'))} built successfully${packagesWithWarnings.length
51
+ ? ` (${yellow(plural(packagesWithWarnings.length, 'package'))} with warnings)`
52
+ : ''}`,
53
+ blockingIssueCount ? `${red(plural(blockingIssueCount, 'package'))} failed to build` : undefined,
54
+ `Totals: ${red(plural(totalErrors, 'error'))}, ${yellow(plural(totalWarnings, 'warning'))}`,
55
+ ].filter(Boolean)));
51
56
  if (generatedUpdateCount) {
52
57
  summaryString.push(`Run "${yellow('cloudpack init')}" in your application folder to apply changes to the ${cyan('cloudpack.generated.json')} file.`);
53
58
  }
@@ -59,15 +64,16 @@ function formatBundleMessages(result, formatErrors) {
59
64
  const unformattedMessages = (formatErrors ? result.errors : result.warnings) || [];
60
65
  for (const message of unformattedMessages) {
61
66
  const { location, text } = message;
67
+ const prefix = formatErrors ? red('Error') : yellow('Warning');
62
68
  if (!location?.file) {
63
- messages.push(text);
69
+ messages.push(`${prefix}: ${text}`);
64
70
  }
65
71
  else {
66
72
  const relativeFilePath = cyan(slash(path.relative(result.path, location.file)));
67
73
  const characterLocation = location.line !== undefined && location.column !== undefined
68
74
  ? yellow(`:${location.line}:${location.column}`)
69
75
  : ``;
70
- messages.push(`${relativeFilePath}${characterLocation} - ${text}`);
76
+ messages.push(`${prefix}: ${relativeFilePath}${characterLocation} - ${text}`);
71
77
  }
72
78
  }
73
79
  return messages.length ? bulletedList(messages) : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"formatInitSummary.js","sourceRoot":"","sources":["../../../src/commands/init/formatInitSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,MAAM,EACN,GAAG,EACH,MAAM,EACN,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAoB,EAAE,OAAqB;IAC3E,MAAM,EACJ,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,GACrB,GAAG,OAAO,CAAC;IACZ,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAChC,MAAM,aAAa,GAA2B,EAAE,CAAC;IAEjD,6FAA6F;IAC7F,IAAI,CAAC,kBAAkB,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE;QAC9D,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KAClC;IAED,0CAA0C;IAC1C,IAAI,CAAC,kBAAkB,CAAC,MAAM,IAAI,oBAAoB,CAAC,MAAM,EAAE;QAC7D,aAAa,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,0BAA0B,CAA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B,GAAG,iBAAiB,MAAM,IAAI,EAAE,CAAC,CAAC;SACpE;KACF;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC;AAED,sCAAsC;AACtC,SAAS,iBAAiB,CAAC,iBAAwC;IACjE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;IAE5C,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,OAAO,IAAI,cAAc,EAAE,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { slash } from '@ms-cloudpack/path-string-parsing';\nimport {\n bold,\n bulletedList,\n cyan,\n green,\n lightCyan,\n plural,\n red,\n yellow,\n formatTime,\n} from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { InitPackageIdentifier } from './types/InitPackageIdentifier.js';\nimport type { InitPackageResult } from './types/InitPackageResult.js';\nimport type { InitSummary } from './types/InitSummary.js';\n\n/**\n * Given an init summary and init options, returns a formatted string message to display to the user via console.\n */\nexport function formatInitSummary(summary: InitSummary, options?: InitOptions) {\n const {\n totalPackages,\n totalErrors,\n totalWarnings,\n totalChanges,\n packagesWithErrors,\n packagesWithWarnings,\n generatedFileUpdates,\n } = summary;\n const { check } = options || {};\n const summaryString: (string | undefined)[] = [];\n\n // Report the \"Summary\" title if no errors or warnings are listed (seems redundant otherwise.\n if (!packagesWithErrors.length && !packagesWithWarnings.length) {\n summaryString.push('Summary:\\n');\n }\n\n // Report work done to the generated file.\n if (!packagesWithErrors.length && generatedFileUpdates.length) {\n summaryString.push(`Updates ${check ? 'needed for' : 'made to'} ${cyan(`cloudpack.generated.json`)}:\\n`);\n\n for (const packageUpdates of generatedFileUpdates) {\n const exportsUpdates = packageUpdates.changes.filter((u) => u.type === 'added-export');\n\n if (exportsUpdates.length) {\n summaryString.push(\n `${formatPackageName(packageUpdates)} - ${yellow(\n plural(exportsUpdates.length, 'path'),\n )} missing from exports map`,\n );\n summaryString.push(\n bulletedList(exportsUpdates.map((u) => `${cyan(u.change)}${u.reason ? ` - ${u.reason}` : ``}`)),\n '',\n );\n }\n }\n }\n\n // Report packages with warnings.\n if (packagesWithWarnings.length) {\n summaryString.push(`${plural(packagesWithWarnings.length, 'package')} with ${yellow('warnings')}:\\n`);\n for (const packageWithWarnings of packagesWithWarnings) {\n summaryString.push(\n `${formatPackageName(packageWithWarnings)} - ${yellow(\n plural(packageWithWarnings.warnings.length, 'warning'),\n )}, ${packageWithWarnings.path}:`,\n );\n summaryString.push(formatBundleMessages(packageWithWarnings as InitPackageResult, false), '');\n }\n }\n\n // Report packages with errors.\n if (packagesWithErrors.length) {\n summaryString.push(`${plural(packagesWithErrors.length, 'package')} ${red('failed')}:\\n`);\n for (const packageWithErrors of packagesWithErrors) {\n summaryString.push(\n `${formatPackageName(packageWithErrors)} - ${red(plural(packageWithErrors.errors.length, 'error'))}, ${\n packageWithErrors.path\n }:`,\n );\n summaryString.push(formatBundleMessages(packageWithErrors as InitPackageResult, true), '');\n }\n }\n\n const generatedUpdateCount = (check && !!generatedFileUpdates.length) || 0;\n const blockingIssueCount = packagesWithErrors.length || 0;\n const requiresChanges = check && totalChanges;\n\n // Add summary.\n summaryString.push(\n `${cyan(plural(totalPackages, 'package'))} evaluated in ${formatTime(summary.duration)}${\n requiresChanges ? `, ${red(plural(totalChanges, 'change'))} required` : ''\n }${\n blockingIssueCount\n ? `, ${blockingIssueCount} with ${red('blocking issues')}`\n : requiresChanges\n ? ''\n : `, ${green('no blocking issues found')}`\n }. (Total: ${plural(totalErrors, 'error')}, ${plural(totalWarnings, 'warning')})`,\n '',\n );\n\n if (generatedUpdateCount) {\n summaryString.push(\n `Run \"${yellow('cloudpack init')}\" in your application folder to apply changes to the ${cyan(\n 'cloudpack.generated.json',\n )} file.`,\n );\n }\n\n return summaryString.filter((a) => a !== undefined).join('\\n');\n}\n\n/** Helper to format bundle messages. */\nfunction formatBundleMessages(result: InitPackageResult, formatErrors: boolean) {\n const messages: string[] = [];\n const unformattedMessages = (formatErrors ? result.errors : result.warnings) || [];\n\n for (const message of unformattedMessages) {\n const { location, text } = message;\n\n if (!location?.file) {\n messages.push(text);\n } else {\n const relativeFilePath = cyan(slash(path.relative(result.path, location.file)));\n const characterLocation =\n location.line !== undefined && location.column !== undefined\n ? yellow(`:${location.line}:${location.column}`)\n : ``;\n\n messages.push(`${relativeFilePath}${characterLocation} - ${text}`);\n }\n }\n\n return messages.length ? bulletedList(messages) : undefined;\n}\n\n/** Helper to format package names. */\nfunction formatPackageName(packageIdentifier: InitPackageIdentifier) {\n const { name, version } = packageIdentifier;\n\n return bold(lightCyan(`${name}@${version || `<no-version>`}`));\n}\n"]}
1
+ {"version":3,"file":"formatInitSummary.js","sourceRoot":"","sources":["../../../src/commands/init/formatInitSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,MAAM,EACN,GAAG,EACH,MAAM,EACN,UAAU,EACV,eAAe,GAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAoB,EAAE,OAAqB;IAC3E,MAAM,EACJ,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,GACrB,GAAG,OAAO,CAAC;IACZ,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAChC,MAAM,aAAa,GAA2B,EAAE,CAAC;IAEjD,6FAA6F;IAC7F,IAAI,CAAC,kBAAkB,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE;QAC9D,aAAa,CAAC,IAAI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AAG,IAAI,IAAI,OAAO,IAAI,cAAc,EAAE,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { slash } from '@ms-cloudpack/path-string-parsing';\nimport {\n bold,\n bulletedList,\n cyan,\n green,\n lightCyan,\n plural,\n red,\n yellow,\n formatTime,\n statusCharacter,\n} from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { InitPackageIdentifier } from './types/InitPackageIdentifier.js';\nimport type { InitPackageResult } from './types/InitPackageResult.js';\nimport type { InitSummary } from './types/InitSummary.js';\n\n/**\n * Given an init summary and init options, returns a formatted string message to display to the user via console.\n */\nexport function formatInitSummary(summary: InitSummary, options?: InitOptions) {\n const {\n totalPackages,\n totalErrors,\n totalWarnings,\n totalChanges,\n packagesWithErrors,\n packagesWithWarnings,\n generatedFileUpdates,\n } = summary;\n const { check } = options || {};\n const summaryString: (string | undefined)[] = [];\n\n // Report the \"Summary\" title if no errors or warnings are listed (seems redundant otherwise.\n if (!packagesWithErrors.length && !packagesWithWarnings.length) {\n summaryString.push('Summary:\\n');\n }\n\n // Report work done to the generated file.\n if (!packagesWithErrors.length && generatedFileUpdates.length) {\n summaryString.push(`Updates ${check ? 'needed for' : 'made to'} ${cyan(`cloudpack.generated.json`)}:\\n`);\n\n for (const packageUpdates of generatedFileUpdates) {\n const exportsUpdates = packageUpdates.changes.filter((u) => u.type === 'added-export');\n\n if (exportsUpdates.length) {\n summaryString.push(\n `${formatPackageName(packageUpdates)} - ${yellow(\n plural(exportsUpdates.length, 'path'),\n )} missing from exports map`,\n );\n summaryString.push(\n bulletedList(exportsUpdates.map((u) => `${cyan(u.change)}${u.reason ? ` - ${u.reason}` : ``}`)),\n '',\n );\n }\n }\n }\n\n // Report packages with warnings.\n if (packagesWithWarnings.length) {\n summaryString.push(`${plural(packagesWithWarnings.length, 'package')} with ${yellow('warnings')}:\\n`);\n let currentCount = 1;\n\n for (const packageWithWarnings of packagesWithWarnings) {\n summaryString.push(\n `${yellow(`${statusCharacter.warn} ${currentCount++}.`)} ${formatPackageName(packageWithWarnings)} - ${yellow(\n plural(packageWithWarnings.warnings.length, 'warning'),\n )}, ${packageWithWarnings.path}:`,\n );\n summaryString.push(formatBundleMessages(packageWithWarnings as InitPackageResult, false), '');\n }\n }\n\n // Report packages with errors.\n if (packagesWithErrors.length) {\n summaryString.push(`${plural(packagesWithErrors.length, 'package')} ${red('failed')}:\\n`);\n let currentCount = 1;\n for (const packageWithErrors of packagesWithErrors) {\n summaryString.push(\n `${red(`${statusCharacter.fail} ${currentCount++}.`)} ${formatPackageName(packageWithErrors)} - ${red(\n plural(packageWithErrors.errors.length, 'error'),\n )}, ${packageWithErrors.path}:`,\n );\n summaryString.push(formatBundleMessages(packageWithErrors as InitPackageResult, true), '');\n }\n }\n\n const generatedUpdateCount = (check && !!generatedFileUpdates.length) || 0;\n const blockingIssueCount = packagesWithErrors.length || 0;\n const requiresChanges = (check && totalChanges) || 0;\n\n // Add summary.\n summaryString.push(\n `${cyan(plural(totalPackages, 'total package'))} evaluated in ${formatTime(summary.duration)}:`,\n bulletedList(\n [\n requiresChanges ? `${red(plural(totalChanges, 'change'))} required` : undefined,\n `${green(plural(totalPackages - blockingIssueCount, 'package'))} built successfully${\n packagesWithWarnings.length\n ? ` (${yellow(plural(packagesWithWarnings.length, 'package'))} with warnings)`\n : ''\n }`,\n blockingIssueCount ? `${red(plural(blockingIssueCount, 'package'))} failed to build` : undefined,\n `Totals: ${red(plural(totalErrors, 'error'))}, ${yellow(plural(totalWarnings, 'warning'))}`,\n ].filter(Boolean),\n ),\n );\n\n if (generatedUpdateCount) {\n summaryString.push(\n `Run \"${yellow('cloudpack init')}\" in your application folder to apply changes to the ${cyan(\n 'cloudpack.generated.json',\n )} file.`,\n );\n }\n\n return summaryString.filter((a) => a !== undefined).join('\\n');\n}\n\n/** Helper to format bundle messages. */\nfunction formatBundleMessages(result: InitPackageResult, formatErrors: boolean) {\n const messages: string[] = [];\n const unformattedMessages = (formatErrors ? result.errors : result.warnings) || [];\n\n for (const message of unformattedMessages) {\n const { location, text } = message;\n const prefix = formatErrors ? red('Error') : yellow('Warning');\n\n if (!location?.file) {\n messages.push(`${prefix}: ${text}`);\n } else {\n const relativeFilePath = cyan(slash(path.relative(result.path, location.file)));\n const characterLocation =\n location.line !== undefined && location.column !== undefined\n ? yellow(`:${location.line}:${location.column}`)\n : ``;\n\n messages.push(`${prefix}: ${relativeFilePath}${characterLocation} - ${text}`);\n }\n }\n\n return messages.length ? bulletedList(messages) : undefined;\n}\n\n/** Helper to format package names. */\nfunction formatPackageName(packageIdentifier: InitPackageIdentifier) {\n const { name, version } = packageIdentifier;\n\n return bold(lightCyan(`${name}@${version || `<no-version>`}`));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,eAalB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,eAiBlB,CAAC"}
@@ -5,6 +5,7 @@ export const init = (command, createAction) => {
5
5
  .description('Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.')
6
6
  .option('--reset', 'Ignores existing overrides when determining all entries.')
7
7
  .option('--check', 'Fails if any package exports are missing.')
8
+ .option('--match <name><@version>', 'Only evaluate a specific package match. This can be a partial match. (e.g. @ms-cloudpack/)')
8
9
  .action(createAction(() => ({
9
10
  execute: import('./execute.js'),
10
11
  })));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAEA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;IAC7D,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,sIAAsI,CACvI;SACA,MAAM,CAAC,SAAS,EAAE,0DAA0D,CAAC;SAC7E,MAAM,CAAC,SAAS,EAAE,2CAA2C,CAAC;SAC9D,MAAM,CACL,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC;KAChC,CAAC,CAAC,CACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\n/** Defines the \"init\" verb. */\nexport const init: CommandFunction = (command, createAction) => {\n command\n .command('init')\n .description(\n 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',\n )\n .option('--reset', 'Ignores existing overrides when determining all entries.')\n .option('--check', 'Fails if any package exports are missing.')\n .action(\n createAction(() => ({\n execute: import('./execute.js'),\n })),\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAEA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;IAC7D,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,sIAAsI,CACvI;SACA,MAAM,CAAC,SAAS,EAAE,0DAA0D,CAAC;SAC7E,MAAM,CAAC,SAAS,EAAE,2CAA2C,CAAC;SAC9D,MAAM,CACL,0BAA0B,EAC1B,4FAA4F,CAC7F;SACA,MAAM,CACL,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC,cAAc,CAAC;KAChC,CAAC,CAAC,CACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\n/** Defines the \"init\" verb. */\nexport const init: CommandFunction = (command, createAction) => {\n command\n .command('init')\n .description(\n 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',\n )\n .option('--reset', 'Ignores existing overrides when determining all entries.')\n .option('--check', 'Fails if any package exports are missing.')\n .option(\n '--match <name><@version>',\n 'Only evaluate a specific package match. This can be a partial match. (e.g. @ms-cloudpack/)',\n )\n .action(\n createAction(() => ({\n execute: import('./execute.js'),\n })),\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAO1D;;GAEG;AACH,wBAAsB,IAAI,CAAC,UAAU,EAAE;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;CAClC,GAAG,OAAO,CAAC,WAAW,CAAC,CA2GvB"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQ1D;;GAEG;AACH,wBAAsB,IAAI,CAAC,UAAU,EAAE;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;CAClC,GAAG,OAAO,CAAC,WAAW,CAAC,CAwHvB"}
@@ -1,5 +1,6 @@
1
1
  import { createPartialApiContext } from '@ms-cloudpack/api-server/apis';
2
2
  import { writeGeneratedConfig } from '@ms-cloudpack/config';
3
+ import { bold, bulletedList, formatPackageName, plural } from '@ms-cloudpack/task-reporter';
3
4
  import { InitSummaryData } from './InitSummaryData.js';
4
5
  import { evaluatePath } from './evaluatePath.js';
5
6
  /**
@@ -62,7 +63,7 @@ export async function init(parameters) {
62
63
  if (shouldExit) {
63
64
  isExitingPrematurely = true;
64
65
  }
65
- if (!isExitingPrematurely && pathsToEvaluate?.size) {
66
+ if (!isExitingPrematurely && pathsToEvaluate?.size && !options.match) {
66
67
  // If there are paths that need to be rebuilt, add them to the refresh set so that on re-enqueuing
67
68
  // we pass the `shouldRerun` flag through
68
69
  pathsToRefresh?.forEach((refreshPath) => {
@@ -83,7 +84,17 @@ export async function init(parameters) {
83
84
  }
84
85
  }
85
86
  // Start with the app path.
86
- enqueuePaths([appPath]);
87
+ if (!options.match) {
88
+ enqueuePaths([appPath]);
89
+ }
90
+ else {
91
+ // Find package in resolve-map
92
+ const { match } = options;
93
+ const matchNames = Object.keys(resolveMap).filter((k) => k.includes(match));
94
+ const resolveMapEntries = matchNames.map((name) => resolveMap[name]);
95
+ reporter.log(`\nFound ${plural(resolveMapEntries.length, 'package')} matching "${bold(options.match)}":\n`, bulletedList(resolveMapEntries.map((entry) => `${formatPackageName(entry)}: ${entry.path}`)));
96
+ enqueuePaths(resolveMapEntries.map((entry) => entry.path));
97
+ }
87
98
  });
88
99
  const { totalChanges } = summary;
89
100
  if (!options.check && totalChanges && generatedConfig.packageSettings?.length) {
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,UAO1B;IACC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,UAAU,CAAC;IACxF,IAAI,oBAAoB,GAAG,KAAK,CAAC;IAEjC,4CAA4C;IAC5C,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE;QAClC,MAAM,KAAK,CAAC,0CAA0C,CAAC,CAAC;KACzD;IAED,uDAAuD;IACvD,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;KACvB;IAED,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;IAC1C,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CACvB,MAAM,uBAAuB,CAAC;QAC5B,OAAO;QACP,MAAM;QACN,QAAQ;QACR,eAAe;QACf,KAAK,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC;KAC/D,CAAC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CAAC,EAAE,EAAE;gBAC5C,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;gBAC1B,OAAO,CAAC,CAAC;YACX,CAAC,EAAE,EAA8B,CAAC,CAAC;SACpC;KACF;AACH,CAAC","sourcesContent":["import type { PackageJsonExportsObject, PackageJsonExportsValue } from '@ms-cloudpack/bundler-types';\nimport type { CloudpackConfig, GeneratedConfig } from '@ms-cloudpack/config';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { AutoDispose } from '../../types/AutoDispose.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { InitSummary } from './types/InitSummary.js';\n\nimport { createPartialApiContext } from '@ms-cloudpack/api-server/apis';\nimport { writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { InitSummaryData } from './InitSummaryData.js';\nimport { evaluatePath } from './evaluatePath.js';\n\n/**\n * Init execution function.\n */\nexport async function init(parameters: {\n options: InitOptions;\n appPath: string;\n config: CloudpackConfig;\n autoDispose: AutoDispose;\n reporter: TaskReporter;\n telemetryClient: TelemetryClient;\n}): Promise<InitSummary> {\n const { options, appPath, config, reporter, autoDispose, telemetryClient } = parameters;\n let isExitingPrematurely = false;\n\n // Don't allow --check and --reset together.\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n // If --reset is specified, reset the generated config.\n if (options.reset) {\n config.generated = {};\n }\n\n const summaryData = new InitSummaryData();\n const [ctx] = autoDispose(\n await createPartialApiContext({\n appPath,\n config,\n reporter,\n telemetryClient,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session'],\n }),\n );\n const { session } = ctx;\n const { resolveMap } = session;\n const refreshPaths = new Set<string>();\n const generatedConfig = config.generated;\n\n // Ensure generatedConfig.packageSettings is initialized.\n generatedConfig.packageSettings ??= [];\n\n const summary = await new Promise<InitSummary>((resolve, reject) => {\n let pending = 0;\n const visitedSet = new Set<string>();\n\n // Create a function to enqueue more paths.\n function enqueuePaths(newPaths: string[]) {\n if (isExitingPrematurely) {\n return;\n }\n\n // Iterate through the given paths.\n for (const path of newPaths) {\n if (visitedSet.has(path)) {\n continue;\n }\n\n const shouldForce = refreshPaths.delete(path);\n\n visitedSet.add(path);\n pending++;\n\n // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.\n evaluatePath({\n packagePath: path,\n generatedConfig,\n telemetryClient,\n resolveMap,\n shouldForce,\n initOptions: options,\n summaryData,\n ctx,\n })\n .then(({ pathsToEvaluate, pathsToRefresh, shouldExit }) => {\n pending--;\n\n if (shouldExit) {\n isExitingPrematurely = true;\n }\n\n if (!isExitingPrematurely && pathsToEvaluate?.size) {\n // If there are paths that need to be rebuilt, add them to the refresh set so that on re-enqueuing\n // we pass the `shouldRerun` flag through\n pathsToRefresh?.forEach((refreshPath) => {\n refreshPaths.add(refreshPath);\n visitedSet.delete(refreshPath);\n });\n\n // Try to enqueue the new paths.\n enqueuePaths(Array.from(pathsToEvaluate));\n }\n\n // If nothing is pending after this call, we're complete.\n if (!pending) {\n resolve(summaryData.summarize());\n }\n })\n .catch((error) => {\n reject(error);\n });\n }\n }\n\n // Start with the app path.\n enqueuePaths([appPath]);\n });\n\n const { totalChanges } = summary;\n\n if (!options.check && totalChanges && generatedConfig.packageSettings?.length) {\n sortExportKeys(generatedConfig);\n\n await writeGeneratedConfig(generatedConfig, appPath);\n }\n\n return summary;\n}\n\nfunction sortExportKeys({ packageSettings = [] }: GeneratedConfig) {\n for (const settings of packageSettings) {\n if (settings.exports) {\n const unsortedExports = settings.exports as Record<string, PackageJsonExportsValue>;\n const sortedKeys = Object.keys(settings.exports).sort();\n\n settings.exports = sortedKeys.reduce((p, n) => {\n p[n] = unsortedExports[n];\n return p;\n }, {} as PackageJsonExportsObject);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uB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AI,CAAC,OAAO,CAAC,KAAK,IAAI,YAAY,IAAI,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE;QAC7E,cAAc,CAAC,eAAe,CAAC,CAAC;QAEhC,MAAM,oBAAoB,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;KACtD;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,eAAe,GAAG,EAAE,EAAmB;IAC/D,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE;QACtC,IAAI,QAAQ,CAAC,OAAO,EAAE;YACpB,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAkD,CAAC;YACpF,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;YAExD,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC5C,CAAC,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;gBAC1B,OAAO,CAAC,CAAC;YACX,CAAC,EAAE,EAA8B,CAAC,CAAC;SACpC;KACF;AACH,CAAC","sourcesContent":["import type { PackageJsonExportsObject, PackageJsonExportsValue } from '@ms-cloudpack/bundler-types';\nimport type { CloudpackConfig, GeneratedConfig } from '@ms-cloudpack/config';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { AutoDispose } from '../../types/AutoDispose.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { InitSummary } from './types/InitSummary.js';\n\nimport { createPartialApiContext } from '@ms-cloudpack/api-server/apis';\nimport { writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { bold, bulletedList, formatPackageName, plural } from '@ms-cloudpack/task-reporter';\nimport { InitSummaryData } from './InitSummaryData.js';\nimport { evaluatePath } from './evaluatePath.js';\n\n/**\n * Init execution function.\n */\nexport async function init(parameters: {\n options: InitOptions;\n appPath: string;\n config: CloudpackConfig;\n autoDispose: AutoDispose;\n reporter: TaskReporter;\n telemetryClient: TelemetryClient;\n}): Promise<InitSummary> {\n const { options, appPath, config, reporter, autoDispose, telemetryClient } = parameters;\n let isExitingPrematurely = false;\n\n // Don't allow --check and --reset together.\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n // If --reset is specified, reset the generated config.\n if (options.reset) {\n config.generated = {};\n }\n\n const summaryData = new InitSummaryData();\n const [ctx] = autoDispose(\n await createPartialApiContext({\n appPath,\n config,\n reporter,\n telemetryClient,\n items: ['bus', 'taskRunner', 'watcher', 'packages', 'session'],\n }),\n );\n const { session } = ctx;\n const { resolveMap } = session;\n const refreshPaths = new Set<string>();\n const generatedConfig = config.generated;\n\n // Ensure generatedConfig.packageSettings is initialized.\n generatedConfig.packageSettings ??= [];\n\n const summary = await new Promise<InitSummary>((resolve, reject) => {\n let pending = 0;\n const visitedSet = new Set<string>();\n\n // Create a function to enqueue more paths.\n function enqueuePaths(newPaths: string[]) {\n if (isExitingPrematurely) {\n return;\n }\n\n // Iterate through the given paths.\n for (const path of newPaths) {\n if (visitedSet.has(path)) {\n continue;\n }\n\n const shouldForce = refreshPaths.delete(path);\n\n visitedSet.add(path);\n pending++;\n\n // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.\n evaluatePath({\n packagePath: path,\n generatedConfig,\n telemetryClient,\n resolveMap,\n shouldForce,\n initOptions: options,\n summaryData,\n ctx,\n })\n .then(({ pathsToEvaluate, pathsToRefresh, shouldExit }) => {\n pending--;\n\n if (shouldExit) {\n isExitingPrematurely = true;\n }\n\n if (!isExitingPrematurely && pathsToEvaluate?.size && !options.match) {\n // If there are paths that need to be rebuilt, add them to the refresh set so that on re-enqueuing\n // we pass the `shouldRerun` flag through\n pathsToRefresh?.forEach((refreshPath) => {\n refreshPaths.add(refreshPath);\n visitedSet.delete(refreshPath);\n });\n\n // Try to enqueue the new paths.\n enqueuePaths(Array.from(pathsToEvaluate));\n }\n\n // If nothing is pending after this call, we're complete.\n if (!pending) {\n resolve(summaryData.summarize());\n }\n })\n .catch((error) => {\n reject(error);\n });\n }\n }\n\n // Start with the app path.\n if (!options.match) {\n enqueuePaths([appPath]);\n } else {\n // Find package in resolve-map\n const { match } = options;\n const matchNames = Object.keys(resolveMap).filter((k) => k.includes(match));\n const resolveMapEntries = matchNames.map((name) => resolveMap[name]);\n\n reporter.log(\n `\\nFound ${plural(resolveMapEntries.length, 'package')} matching \"${bold(options.match)}\":\\n`,\n bulletedList(resolveMapEntries.map((entry) => `${formatPackageName(entry)}: ${entry.path}`)),\n );\n enqueuePaths(resolveMapEntries.map((entry) => entry.path));\n }\n });\n\n const { totalChanges } = summary;\n\n if (!options.check && totalChanges && generatedConfig.packageSettings?.length) {\n sortExportKeys(generatedConfig);\n\n await writeGeneratedConfig(generatedConfig, appPath);\n }\n\n return summary;\n}\n\nfunction sortExportKeys({ packageSettings = [] }: GeneratedConfig) {\n for (const settings of packageSettings) {\n if (settings.exports) {\n const unsortedExports = settings.exports as Record<string, PackageJsonExportsValue>;\n const sortedKeys = Object.keys(settings.exports).sort();\n\n settings.exports = sortedKeys.reduce((p, n) => {\n p[n] = unsortedExports[n];\n return p;\n }, {} as PackageJsonExportsObject);\n }\n }\n}\n"]}
@@ -10,5 +10,9 @@ export interface InitOptions {
10
10
  * Whether to fail on missing exports.
11
11
  */
12
12
  check?: boolean;
13
+ /**
14
+ * Only evaluate a specific package match. (e.g. @ms-cloudpack/)
15
+ */
16
+ match?: string;
13
17
  }
14
18
  //# sourceMappingURL=InitOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InitOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
1
+ {"version":3,"file":"InitOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"InitOptions.js","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Defines the options for the \"init\" command.\n */\nexport interface InitOptions {\n /**\n * Whether to ignore existing overrides when determining all entries.\n */\n reset?: boolean;\n\n /**\n * Whether to fail on missing exports.\n */\n check?: boolean;\n}\n"]}
1
+ {"version":3,"file":"InitOptions.js","sourceRoot":"","sources":["../../../../src/commands/init/types/InitOptions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Defines the options for the \"init\" command.\n */\nexport interface InitOptions {\n /**\n * Whether to ignore existing overrides when determining all entries.\n */\n reset?: boolean;\n\n /**\n * Whether to fail on missing exports.\n */\n check?: boolean;\n\n /**\n * Only evaluate a specific package match. (e.g. @ms-cloudpack/)\n */\n match?: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getPageLoadTime.inline.js","sourceRoot":"","sources":["../../../../../src/commands/start/appServer/inlineScripts/getPageLoadTime.inline.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAInG,kGAAkG;AAClG,MAAM,gBAAgB,GAAgC,wBAAwB,CAAC;AAE/E;;;GAGG;AACH,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAElD,8DAA8D;AAC9D,MAAM,WAAW,GAAa,CAAC,gBAAgB,CAAC,CAAC;AAIjD,SAAS,QAAQ,CAAsB,IAAqB,EAAE,IAAY;IACxE,IAAI,OAA6C,CAAC;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C,GAAG,EAAE,CAAC;gBAE/B,uBAAuB;gBACvB,WAAW,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;gBAEvC,0BAA0B;gBAC1B,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBAEjC,4BAA4B;gBAC5B,gCAAgC,CAAC,IAAI,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;QAC9B,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,WAAW,KAAK,EAA+B,CAAC;AACvD,MAAM,CAAC,WAAW,CAAC,eAAe,GAAG,GAAG,EAAE,CAAC,mBAAmB,CAAC","sourcesContent":["// This file must NOT import other files (except types), because they won't be resolved at runtime.\n\nimport type { overlayRootDivId as overlayRootDivIdType } from '@ms-cloudpack/overlay/constants';\n\n// Typing hack to ensure this ID is correct while working around the limitation on runtime imports\nconst overlayRootDivId: typeof overlayRootDivIdType = 'cloudpack-overlay-root';\n\n/**\n * Performance mark name for page load time.\n * This makes it easier to see the page load time in the performance tab in dev tools\n */\nconst pageLoadMarker = 'CLOUDPACK_PAGE_LOAD_TIME';\n\n// The below dom elements will be ignored by mutation observer\nconst excludedIds: string[] = [overlayRootDivId];\n\ntype DebounceFunc<T extends unknown[]> = (...args: T) => void;\n\nfunction debounce<T extends unknown[]>(func: DebounceFunc<T>, wait: number): DebounceFunc<T> {\n let timeout: ReturnType<typeof setTimeout> | null;\n\n return function (...args: T) {\n const later = () => {\n timeout = null;\n func(...args);\n };\n\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(later, wait);\n };\n}\n\nfunction hasMutationNonExcludedNodes(mutation: MutationRecord) {\n return [...mutation.addedNodes].some((node) => {\n const id = (node as { id?: string }).id;\n\n if (id) {\n return !excludedIds.includes(id);\n }\n\n return true;\n });\n}\n\nconst pageLoadTimePromise = new Promise<number>((resolve) => {\n const observer = new MutationObserver(domChanged);\n\n function reportLastAnimationTime(time: number) {\n // Stop observing the DOM\n observer.disconnect();\n\n // Resolve the promise with the page load time\n resolve(time);\n }\n\n const debouncedReportLastAnimationTime = debounce(reportLastAnimationTime, 2000 /* wait ms */);\n\n function domChanged(mutations: MutationRecord[]) {\n const shouldProcess = mutations.filter(hasMutationNonExcludedNodes).length > 0;\n\n if (shouldProcess) {\n requestAnimationFrame(() => {\n // Get the current time in ms since the time when navigation has started in window\n const time = performance.now();\n\n // Clear previous marks\n performance.clearMarks(pageLoadMarker);\n\n // Mark the page load time\n performance.mark(pageLoadMarker);\n\n // Report the page load time\n debouncedReportLastAnimationTime(time);\n });\n }\n }\n\n observer.observe(document.body, {\n childList: true,\n });\n});\n\nwindow.__cloudpack ??= {} as typeof window.__cloudpack;\nwindow.__cloudpack.getPageLoadTime = () => pageLoadTimePromise;\n"]}
1
+ {"version":3,"file":"getPageLoadTime.inline.js","sourceRoot":"","sources":["../../../../../src/commands/start/appServer/inlineScripts/getPageLoadTime.inline.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAInG,kGAAkG;AAClG,MAAM,gBAAgB,GAAgC,wBAAwB,CAAC;AAE/E;;;GAGG;AACH,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAElD,8DAA8D;AAC9D,MAAM,WAAW,GAAa,CAAC,gBAAgB,CAAC,CAAC;AAIjD,SAAS,QAAQ,CAAsB,IAAqB,EAAE,IAAY;IACxE,IAAI,OAA6C,CAAC;IAElD,OAAO,UAAU,GAAG,IAAO;QACzB,MAAM,KAAK,GAAG,GAAG,EAAE;YACjB,OAAO,GAAG,IAAI,CAAC;YACf,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC;QAEF,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;QACD,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC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CAAC,IAAI,EAAE;QAC9B,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,WAAW,KAAK,EAA+B,CAAC;AACvD,MAAM,CAAC,WAAW,CAAC,eAAe,GAAG,GAAG,EAAE,CAAC,mBAAmB,CAAC","sourcesContent":["// This file must NOT import other files (except types), because they won't be resolved at runtime.\n\nimport type { elementIds } from '@ms-cloudpack/overlay/constants';\n\n// Typing hack to ensure this ID is correct while working around the limitation on runtime imports\nconst overlayRootDivId: (typeof elementIds)['root'] = 'cloudpack-overlay-root';\n\n/**\n * Performance mark name for page load time.\n * This makes it easier to see the page load time in the performance tab in dev tools\n */\nconst pageLoadMarker = 'CLOUDPACK_PAGE_LOAD_TIME';\n\n// The below dom elements will be ignored by mutation observer\nconst excludedIds: string[] = [overlayRootDivId];\n\ntype DebounceFunc<T extends unknown[]> = (...args: T) => void;\n\nfunction debounce<T extends unknown[]>(func: DebounceFunc<T>, wait: number): DebounceFunc<T> {\n let timeout: ReturnType<typeof setTimeout> | null;\n\n return function (...args: T) {\n const later = () => {\n timeout = null;\n func(...args);\n };\n\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(later, wait);\n };\n}\n\nfunction hasMutationNonExcludedNodes(mutation: MutationRecord) {\n return [...mutation.addedNodes].some((node) => {\n const id = (node as { id?: string }).id;\n\n if (id) {\n return !excludedIds.includes(id);\n }\n\n return true;\n });\n}\n\nconst pageLoadTimePromise = new Promise<number>((resolve) => {\n const observer = new MutationObserver(domChanged);\n\n function reportLastAnimationTime(time: number) {\n // Stop observing the DOM\n observer.disconnect();\n\n // Resolve the promise with the page load time\n resolve(time);\n }\n\n const debouncedReportLastAnimationTime = debounce(reportLastAnimationTime, 2000 /* wait ms */);\n\n function domChanged(mutations: MutationRecord[]) {\n const shouldProcess = mutations.filter(hasMutationNonExcludedNodes).length > 0;\n\n if (shouldProcess) {\n requestAnimationFrame(() => {\n // Get the current time in ms since the time when navigation has started in window\n const time = performance.now();\n\n // Clear previous marks\n performance.clearMarks(pageLoadMarker);\n\n // Mark the page load time\n performance.mark(pageLoadMarker);\n\n // Report the page load time\n debouncedReportLastAnimationTime(time);\n });\n }\n }\n\n observer.observe(document.body, {\n childList: true,\n });\n});\n\nwindow.__cloudpack ??= {} as typeof window.__cloudpack;\nwindow.__cloudpack.getPageLoadTime = () => pageLoadTimePromise;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAO3D;;;GAGG;AACH,wBAAsB,IAAI,CAAC,WAAW,CAAC,EAAE;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,iBA2CA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAO3D;;;GAGG;AACH,wBAAsB,IAAI,CAAC,WAAW,CAAC,EAAE;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,iBA0CA"}
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getVersion } from '@ms-cloudpack/package-utilities';
2
2
  import { Command } from 'commander';
3
- import glob from 'glob';
3
+ import glob from 'fast-glob';
4
4
  import path from 'path';
5
5
  import { fileURLToPath, pathToFileURL } from 'url';
6
6
  import { PerfMarkerCliEntry } from './performance/markers.js';
@@ -22,9 +22,8 @@ export async function main(testOptions) {
22
22
  const program = new Command();
23
23
  const version = getVersion(import.meta.url);
24
24
  program.name('cloudpack').version(version).usage('<command> [options]');
25
- // Ensure the glob works in tests
26
- const commandsGlob = `commands/*/index${dynamicImportExtension}`;
27
- const commands = glob.sync(commandsGlob, { cwd: currentPath });
25
+ // Get all the available commands (with the correct extension for runtime context)
26
+ const commands = await glob(`commands/*/index${dynamicImportExtension}`, { cwd: currentPath });
28
27
  if (!commands.length) {
29
28
  // There was an issue with the glob above not working in tests, so make sure that doesn't happen again
30
29
  throw new Error(`No commands found under "${currentPath}".`);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,WAK1B;IACC,WAAW,CAAC,IAAI,CAAC,kBAA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AmE,CAAC,CAAC;IACrG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,kEAAkE,CAAC,CAAC;IAClG,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,gDAAgD,CAAC,CAAC;IAEnF,WAAW,EAAE,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;AACH,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport { Command } from 'commander';\nimport glob from 'glob';\nimport path from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\nimport { PerfMarkerCliEntry } from './performance/markers.js';\nimport type { CommandFunction } from './types/CommandFunction.js';\nimport { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { createCommandActionFunction } from './common/createCommandActionFunction.js';\nimport { dynamicImportExtension } from './utilities/dynamicImportExtension.js';\n\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentPath = path.dirname(currentFilePath);\n\n/**\n * Entry point for the cloudpack CLI.\n * Resolves all commands defined within the \"./commands\" folder.\n */\nexport async function main(testOptions?: {\n appPath: string;\n argv: string[];\n reporter: TaskReporter;\n preParseOverrides?: (program: Command) => void;\n}) {\n performance.mark(PerfMarkerCliEntry);\n\n const argv = testOptions?.argv || process.argv;\n const cwd = testOptions?.appPath || process.cwd();\n const reporter = testOptions?.reporter || new TaskReporter();\n\n const abortController = new AbortController();\n\n const program = new Command();\n const version = getVersion(import.meta.url);\n\n program.name('cloudpack').version(version).usage('<command> [options]');\n\n // Ensure the glob works in tests\n const commandsGlob = `commands/*/index${dynamicImportExtension}`;\n const commands = glob.sync(commandsGlob, { cwd: currentPath });\n if (!commands.length) {\n // There was an issue with the glob above not working in tests, so make sure that doesn't happen again\n throw new Error(`No commands found under \"${currentPath}\".`);\n }\n\n const createAction = createCommandActionFunction({ cwd, reporter, abortController });\n\n for (const commandPath of commands) {\n const commandFunction = (await import(pathToFileURL(path.join(currentPath, commandPath)).toString())) as {\n init: CommandFunction;\n };\n\n commandFunction.init(program, createAction);\n }\n\n program.option('-v, --verbose', 'Show additional details about the running tasks. (default: false)');\n program.option('-d, --debug', 'Show debug information (superset of --verbose). (default: false)');\n program.option('-n, --no-color', 'Disable colors in the output. (default: false)');\n\n testOptions?.preParseOverrides?.(program);\n\n await program.parseAsync(argv);\n\n if (program.args.length === 0) {\n program.help();\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,WAK1B;IACC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAErC,MAAM,IAAI,GAAG,WAAW,EAAE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAC/C,MAAM,GAAG,GAAG,WA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EAAE,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;AACH,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport { Command } from 'commander';\nimport glob from 'fast-glob';\nimport path from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\nimport { PerfMarkerCliEntry } from './performance/markers.js';\nimport type { CommandFunction } from './types/CommandFunction.js';\nimport { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { createCommandActionFunction } from './common/createCommandActionFunction.js';\nimport { dynamicImportExtension } from './utilities/dynamicImportExtension.js';\n\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentPath = path.dirname(currentFilePath);\n\n/**\n * Entry point for the cloudpack CLI.\n * Resolves all commands defined within the \"./commands\" folder.\n */\nexport async function main(testOptions?: {\n appPath: string;\n argv: string[];\n reporter: TaskReporter;\n preParseOverrides?: (program: Command) => void;\n}) {\n performance.mark(PerfMarkerCliEntry);\n\n const argv = testOptions?.argv || process.argv;\n const cwd = testOptions?.appPath || process.cwd();\n const reporter = testOptions?.reporter || new TaskReporter();\n\n const abortController = new AbortController();\n\n const program = new Command();\n const version = getVersion(import.meta.url);\n\n program.name('cloudpack').version(version).usage('<command> [options]');\n\n // Get all the available commands (with the correct extension for runtime context)\n const commands = await glob(`commands/*/index${dynamicImportExtension}`, { cwd: currentPath });\n if (!commands.length) {\n // There was an issue with the glob above not working in tests, so make sure that doesn't happen again\n throw new Error(`No commands found under \"${currentPath}\".`);\n }\n\n const createAction = createCommandActionFunction({ cwd, reporter, abortController });\n\n for (const commandPath of commands) {\n const commandFunction = (await import(pathToFileURL(path.join(currentPath, commandPath)).toString())) as {\n init: CommandFunction;\n };\n\n commandFunction.init(program, createAction);\n }\n\n program.option('-v, --verbose', 'Show additional details about the running tasks. (default: false)');\n program.option('-d, --debug', 'Show debug information (superset of --verbose). (default: false)');\n program.option('-n, --no-color', 'Disable colors in the output. (default: false)');\n\n testOptions?.preParseOverrides?.(program);\n\n await program.parseAsync(argv);\n\n if (program.args.length === 0) {\n program.help();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"setupReporting.d.ts","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,6BAA6B,CAAC;AAKrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAQ5D,wBAAsB,cAAc,CAAC,gBAAgB,EAAE;IACrD,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,8DA8BA"}
1
+ {"version":3,"file":"setupReporting.d.ts","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,6BAA6B,CAAC;AAKrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAQ5D,wBAAsB,cAAc,CAAC,gBAAgB,EAAE;IACrD,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,8DA+BA"}
@@ -16,6 +16,7 @@ export async function setupReporting(reportingOptions) {
16
16
  version,
17
17
  description: () => `Running "${bold(argv.slice(2).join(' '))}"`,
18
18
  helpMessage: config.helpMessage,
19
+ plainTextMode: argv.includes('--no-color'),
19
20
  ...defaultLoggingConfig,
20
21
  ...(useVerboseLogging && verboseLoggingConfig),
21
22
  ...(useDebugLogging && debugLoggingConfig),
@@ -1 +1 @@
1
- {"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AAAA,OAAO,E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pB,CAAC,CAAC;IAE1B,MAAM,UAAU,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAgB,CAAC;IAEvF,MAAM,eAAe,GAAG,MAAM,aAAa,CACzC;QACE,eAAe;QACf,iBAAiB;QACjB,eAAe,EAAE,MAAM,CAAC,SAAS;QACjC,oBAAoB,EAAE;YACpB,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAClC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;YACzC,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;SACzC;KACF,EACD,QAAQ,CACT,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport { initTelemetry } from './initTelemetry.js';\nimport { bold, defaultLoggingConfig, verboseLoggingConfig, debugLoggingConfig } from '@ms-cloudpack/task-reporter';\nimport type { TaskReporter, TaskReporterOptions } from '@ms-cloudpack/task-reporter';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport path from 'path';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport { isCIBuild } from './utilities/isCIBuild.js';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\n\nconst { argv } = process;\nconst useDebugLogging = argv.includes('--debug') || argv.includes('-d');\nconst verb = argv[2];\nconst useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting(reportingOptions: {\n reporter: TaskReporter;\n config: CloudpackConfig;\n appPath: string;\n}) {\n const { appPath, config, reporter } = reportingOptions;\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n ...defaultLoggingConfig,\n ...(useVerboseLogging && verboseLoggingConfig),\n ...(useDebugLogging && debugLoggingConfig),\n } as TaskReporterOptions);\n\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n const telemetryClient = await initTelemetry(\n {\n useDebugLogging,\n useVerboseLogging,\n telemetryConfig: config.telemetry,\n sharedSpanAttributes: {\n verb,\n arguments: argv.slice(3).join(' '),\n environment: isCIBuild() ? 'ci' : 'local',\n appName: definition?.name || '<unknown>',\n },\n },\n reporter,\n );\n\n return telemetryClient;\n}\n"]}
1
+ {"version":3,"file":"setupReporting.js","sourceRoot":"","sources":["../src/setupReporting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEnH,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGrD,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AACzB,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxE,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACrB,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,QAAQ,CAAC;AACjG,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,gBAIpC;IACC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC;IACvD,QAAQ,CAAC,UAAU,CAAC;QAClB,WAAW,EAAE,WAAW;QACxB,OAAO;QACP,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG;QAC/D,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC1C,GAAG,oBAAoB;QACvB,GAAG,CAAC,iBAAiB,IAAI,oBAAoB,CAAC;QAC9C,GAAG,CAAC,eAAe,IAAI,kBAAkB,CAAC;KACpB,CAAC,CAAC;IAE1B,MAAM,UAAU,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAgB,CAAC;IAEvF,MAAM,eAAe,GAAG,MAAM,aAAa,CACzC;QACE,eAAe;QACf,iBAAiB;QACjB,eAAe,EAAE,MAAM,CAAC,SAAS;QACjC,oBAAoB,EAAE;YACpB,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAClC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;YACzC,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,WAAW;SACzC;KACF,EACD,QAAQ,CACT,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import { getVersion } from '@ms-cloudpack/package-utilities';\nimport { initTelemetry } from './initTelemetry.js';\nimport { bold, defaultLoggingConfig, verboseLoggingConfig, debugLoggingConfig } from '@ms-cloudpack/task-reporter';\nimport type { TaskReporter, TaskReporterOptions } from '@ms-cloudpack/task-reporter';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport path from 'path';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport { isCIBuild } from './utilities/isCIBuild.js';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\n\nconst { argv } = process;\nconst useDebugLogging = argv.includes('--debug') || argv.includes('-d');\nconst verb = argv[2];\nconst useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';\nconst version = getVersion(import.meta.url);\n\nexport async function setupReporting(reportingOptions: {\n reporter: TaskReporter;\n config: CloudpackConfig;\n appPath: string;\n}) {\n const { appPath, config, reporter } = reportingOptions;\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n plainTextMode: argv.includes('--no-color'),\n ...defaultLoggingConfig,\n ...(useVerboseLogging && verboseLoggingConfig),\n ...(useDebugLogging && debugLoggingConfig),\n } as TaskReporterOptions);\n\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n const telemetryClient = await initTelemetry(\n {\n useDebugLogging,\n useVerboseLogging,\n telemetryConfig: config.telemetry,\n sharedSpanAttributes: {\n verb,\n arguments: argv.slice(3).join(' '),\n environment: isCIBuild() ? 'ci' : 'local',\n appName: definition?.name || '<unknown>',\n },\n },\n reporter,\n );\n\n return telemetryClient;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.47.8",
3
+ "version": "0.47.10",
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",
@@ -11,20 +11,20 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@lage-run/target-graph": "^0.8.7",
14
- "@ms-cloudpack/api-server": "^0.20.1",
15
- "@ms-cloudpack/config": "^0.12.6",
16
- "@ms-cloudpack/create-express-app": "^1.3.10",
14
+ "@ms-cloudpack/api-server": "^0.20.3",
15
+ "@ms-cloudpack/config": "^0.12.7",
16
+ "@ms-cloudpack/create-express-app": "^1.3.11",
17
17
  "@ms-cloudpack/json-utilities": "^0.0.7",
18
- "@ms-cloudpack/overlay": "^0.15.2",
19
- "@ms-cloudpack/package-utilities": "^5.1.8",
18
+ "@ms-cloudpack/overlay": "^0.16.1",
19
+ "@ms-cloudpack/package-utilities": "^5.1.9",
20
20
  "@ms-cloudpack/path-string-parsing": "^1.1.0",
21
- "@ms-cloudpack/path-utilities": "^2.3.3",
22
- "@ms-cloudpack/task-reporter": "^0.8.0",
23
- "@ms-cloudpack/telemetry": "^0.3.8",
21
+ "@ms-cloudpack/path-utilities": "^2.3.4",
22
+ "@ms-cloudpack/task-reporter": "^0.8.1",
23
+ "@ms-cloudpack/telemetry": "^0.3.9",
24
24
  "commander": "^11.0.0",
25
25
  "cross-spawn": "^7.0.3",
26
+ "fast-glob": "^3.2.12",
26
27
  "fs-extra": "^11.0.0",
27
- "glob": "^8.0.0",
28
28
  "glob-hasher": "^1.2.1",
29
29
  "jsdom": "^22.0.0",
30
30
  "open": "^9.0.0",
@@ -37,7 +37,6 @@
37
37
  "@ms-cloudpack/scripts": "*",
38
38
  "@ms-cloudpack/test-utilities": "*",
39
39
  "@types/cross-spawn": "^6.0.2",
40
- "@types/glob": "^8.1.0",
41
40
  "@types/jsdom": "^21.1.1",
42
41
  "@types/object-hash": "^3.0.2",
43
42
  "@types/prompts": "^2.4.4",