@ms-cloudpack/cli 0.75.0 → 0.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/lib/commands/cache/clean.d.ts +1 -2
  2. package/lib/commands/cache/clean.d.ts.map +1 -1
  3. package/lib/commands/cache/clean.js.map +1 -1
  4. package/lib/commands/cache/index.d.ts.map +1 -1
  5. package/lib/commands/cache/index.js.map +1 -1
  6. package/lib/commands/config/delete.d.ts +1 -3
  7. package/lib/commands/config/delete.d.ts.map +1 -1
  8. package/lib/commands/config/delete.js.map +1 -1
  9. package/lib/commands/config/get.d.ts +1 -3
  10. package/lib/commands/config/get.d.ts.map +1 -1
  11. package/lib/commands/config/get.js.map +1 -1
  12. package/lib/commands/config/index.d.ts.map +1 -1
  13. package/lib/commands/config/index.js.map +1 -1
  14. package/lib/commands/config/list.d.ts +1 -3
  15. package/lib/commands/config/list.d.ts.map +1 -1
  16. package/lib/commands/config/list.js.map +1 -1
  17. package/lib/commands/config/set.d.ts +1 -3
  18. package/lib/commands/config/set.d.ts.map +1 -1
  19. package/lib/commands/config/set.js.map +1 -1
  20. package/lib/commands/info/lockFile/execute.d.ts +1 -4
  21. package/lib/commands/info/lockFile/execute.d.ts.map +1 -1
  22. package/lib/commands/info/lockFile/execute.js.map +1 -1
  23. package/lib/commands/init/init.d.ts.map +1 -1
  24. package/lib/commands/init/init.js +9 -2
  25. package/lib/commands/init/init.js.map +1 -1
  26. package/lib/commands/link/createRemoteApiUrls.js +1 -1
  27. package/lib/commands/link/createRemoteApiUrls.js.map +1 -1
  28. package/lib/commands/link/getActiveSessions.js +1 -1
  29. package/lib/commands/link/getActiveSessions.js.map +1 -1
  30. package/lib/utilities/parseDefine.js +1 -1
  31. package/lib/utilities/parseDefine.js.map +1 -1
  32. package/lib/utilities/sequentialPromiseExecutor.d.ts +22 -0
  33. package/lib/utilities/sequentialPromiseExecutor.d.ts.map +1 -0
  34. package/lib/utilities/sequentialPromiseExecutor.js +51 -0
  35. package/lib/utilities/sequentialPromiseExecutor.js.map +1 -0
  36. package/package.json +19 -19
@@ -1,7 +1,6 @@
1
1
  import type { CommandAction } from '../../types/CommandAction.js';
2
- interface CleanOptions {
2
+ export interface CleanOptions {
3
3
  }
4
4
  /** Clear the Cloudpack cache. */
5
5
  export declare const execute: CommandAction<CleanOptions>;
6
- export {};
7
6
  //# sourceMappingURL=clean.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,UAAU,YAAY;CAAG;AAEzB,iCAAiC;AACjC,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CAgB/C,CAAC"}
1
+ {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,YAAY;CAAG;AAEhC,iCAAiC;AACjC,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CAgB/C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,UAAU,MAAM,aAAa,CAAC;AAKrC,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAgC,KAAK,EAAE,MAAM,EAAE,EAAE;IACnE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE3B,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,wBAAwB,SAAS,GAAG,CAAC;IAE9D,IAAI,CAAC;QACH,2FAA2F;QAC3F,MAAM,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,OAAO,EAAE,OAAO,EAAE,wBAAwB,gBAAgB,EAAE,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,mBAAmB,gBAAgB,KAAM,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;YAChF,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { getCachePath } from '@ms-cloudpack/config';\nimport fsPromises from 'fs/promises';\nimport type { CommandAction } from '../../types/CommandAction.js';\n\ninterface CleanOptions {}\n\n/** Clear the Cloudpack cache. */\nexport const execute: CommandAction<CleanOptions> = async (params) => {\n const { options } = params;\n\n const cachePath = await getCachePath(options.cachePath);\n const cacheDescription = `the Cloudpack cache (${cachePath})`;\n\n try {\n // NOTE: if the method used here changes, be sure to update what cache.e2e.test.ts spies on\n await fsPromises.rm(cachePath, { recursive: true, force: true });\n return { message: `Successfully cleared ${cacheDescription}` };\n } catch (err) {\n return {\n message: `Failed to clear ${cacheDescription}: ${(err as Error).message || err}`,\n hasErrors: true,\n };\n }\n};\n"]}
1
+ {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,UAAU,MAAM,aAAa,CAAC;AAMrC,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAgC,KAAK,EAAE,MAAM,EAAE,EAAE;IACnE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAE3B,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,wBAAwB,SAAS,GAAG,CAAC;IAE9D,IAAI,CAAC;QACH,2FAA2F;QAC3F,MAAM,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,OAAO,EAAE,OAAO,EAAE,wBAAwB,gBAAgB,EAAE,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,mBAAmB,gBAAgB,KAAM,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;YAChF,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { getCachePath } from '@ms-cloudpack/config';\nimport fsPromises from 'fs/promises';\nimport type { CommandAction } from '../../types/CommandAction.js';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface CleanOptions {}\n\n/** Clear the Cloudpack cache. */\nexport const execute: CommandAction<CleanOptions> = async (params) => {\n const { options } = params;\n\n const cachePath = await getCachePath(options.cachePath);\n const cacheDescription = `the Cloudpack cache (${cachePath})`;\n\n try {\n // NOTE: if the method used here changes, be sure to update what cache.e2e.test.ts spies on\n await fsPromises.rm(cachePath, { recursive: true, force: true });\n return { message: `Successfully cleared ${cacheDescription}` };\n } catch (err) {\n return {\n message: `Failed to clear ${cacheDescription}: ${(err as Error).message || err}`,\n hasErrors: true,\n };\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAalB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAalB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAEA,gCAAgC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;QACzC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,qEAAqE;QAClF,KAAK,EAAE,WAAW;KACnB,CAAC,CAAC;IAEH,YAAY,CAAC,aAAa,CAAC;QACzB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,6BAA6B;QAC1C,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC;KACxC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandInitFunction } from '../../types/CommandInitFunction.js';\n\n/** Defines the \"cache\" verb. */\nexport const init: CommandInitFunction = (program) => {\n const cacheCommand = program.addSubCommand({\n name: 'cache',\n description: 'Operations related to the Cloudpack cache (requires a sub-command).',\n usage: '<command>',\n });\n\n cacheCommand.addSubCommand({\n name: 'clean',\n alias: 'clear',\n description: 'Clears the Cloudpack cache.',\n getExecutor: () => import('./clean.js'),\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAGA,gCAAgC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;QACzC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,qEAAqE;QAClF,KAAK,EAAE,WAAW;KACnB,CAAC,CAAC;IAEH,YAAY,CAAC,aAAa,CAAe;QACvC,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,6BAA6B;QAC1C,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC;KACxC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { CleanOptions } from './clean.js';\n\n/** Defines the \"cache\" verb. */\nexport const init: CommandInitFunction = (program) => {\n const cacheCommand = program.addSubCommand({\n name: 'cache',\n description: 'Operations related to the Cloudpack cache (requires a sub-command).',\n usage: '<command>',\n });\n\n cacheCommand.addSubCommand<CleanOptions>({\n name: 'clean',\n alias: 'clear',\n description: 'Clears the Cloudpack cache.',\n getExecutor: () => import('./clean.js'),\n });\n};\n"]}
@@ -1,9 +1,7 @@
1
1
  import type { CommandAction } from '../../types/CommandAction.js';
2
- export interface DeleteOptions {
3
- }
4
2
  export interface DeleteArguments {
5
3
  key: string;
6
4
  }
7
5
  /** Delete a Cloudpack user preference value. */
8
- export declare const execute: CommandAction<DeleteOptions>;
6
+ export declare const execute: CommandAction<never>;
9
7
  //# sourceMappingURL=delete.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/config/delete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,aAAa;CAAG;AAEjC,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,gDAAgD;AAChD,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,aAAa,CAiBhD,CAAC"}
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/config/delete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,gDAAgD;AAChD,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,KAAK,CAiBxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/config/delete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAQ5D,gDAAgD;AAChD,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,EAAE,MAAM,EAAE,EAAE;IACpE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA0B,CAAC;IAE7C,IAAI,CAAC;QACH,qFAAqF;QACrF,yCAAyC;QACzC,MAAM,oBAAoB,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,6EAA6E;QAC7E,4CAA4C;QAC5C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,qBAAqB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACvE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { UserPreferences } from '@ms-cloudpack/common-types';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { updateUserPreference } from '@ms-cloudpack/config';\n\nexport interface DeleteOptions {}\n\nexport interface DeleteArguments {\n key: string;\n}\n\n/** Delete a Cloudpack user preference value. */\nexport const execute: CommandAction<DeleteOptions> = async (params) => {\n const { args } = params;\n const key = args[0] as keyof UserPreferences;\n\n try {\n // Commander should have validated the key based on the given choices, and the update\n // function will also validate its input.\n await updateUserPreference({ key, deleteValue: true });\n // Following the pattern of other tools, we don't output anything on success,\n // or if the key was valid but didn't exist.\n return { message: '' };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to delete \"${key}\": ${(err as Error).message || err}`,\n };\n }\n};\n"]}
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/config/delete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAM5D,gDAAgD;AAChD,MAAM,CAAC,MAAM,OAAO,GAAyB,KAAK,EAAE,MAAM,EAAE,EAAE;IAC5D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA0B,CAAC;IAE7C,IAAI,CAAC;QACH,qFAAqF;QACrF,yCAAyC;QACzC,MAAM,oBAAoB,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,6EAA6E;QAC7E,4CAA4C;QAC5C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,qBAAqB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACvE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { UserPreferences } from '@ms-cloudpack/common-types';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { updateUserPreference } from '@ms-cloudpack/config';\n\nexport interface DeleteArguments {\n key: string;\n}\n\n/** Delete a Cloudpack user preference value. */\nexport const execute: CommandAction<never> = async (params) => {\n const { args } = params;\n const key = args[0] as keyof UserPreferences;\n\n try {\n // Commander should have validated the key based on the given choices, and the update\n // function will also validate its input.\n await updateUserPreference({ key, deleteValue: true });\n // Following the pattern of other tools, we don't output anything on success,\n // or if the key was valid but didn't exist.\n return { message: '' };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to delete \"${key}\": ${(err as Error).message || err}`,\n };\n }\n};\n"]}
@@ -1,9 +1,7 @@
1
1
  import type { CommandAction } from '../../types/CommandAction.js';
2
- export interface GetOptions {
3
- }
4
2
  export interface GetArguments {
5
3
  key: string;
6
4
  }
7
5
  /** Get a Cloudpack user preference value. */
8
- export declare const execute: CommandAction<GetOptions>;
6
+ export declare const execute: CommandAction<never>;
9
7
  //# sourceMappingURL=get.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/config/get.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,UAAU;CAAG;AAE9B,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,6CAA6C;AAC7C,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,UAAU,CAoB7C,CAAC"}
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/config/get.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,6CAA6C;AAC7C,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,KAAK,CAoBxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/config/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAQ/E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAA8B,KAAK,EAAE,MAAM,EAAE,EAAE;IACjE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxB,sEAAsE;IACtE,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA0B,CAAC;IAE7C,IAAI,CAAC;QACH,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,mBAAmB,EAAE,CAAC;QACpD,OAAO;YACL,OAAO,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE;SACzC,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,kBAAkB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACpE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { UserPreferences } from '@ms-cloudpack/common-types';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { allUserPreferences, readUserPreferences } from '@ms-cloudpack/config';\n\nexport interface GetOptions {}\n\nexport interface GetArguments {\n key: string;\n}\n\n/** Get a Cloudpack user preference value. */\nexport const execute: CommandAction<GetOptions> = async (params) => {\n const { args } = params;\n // Commander should have validated the key based on the given choices.\n const key = args[0] as keyof UserPreferences;\n\n try {\n if (!allUserPreferences[key]) {\n throw new Error(`Invalid key name`);\n }\n\n const userPreferences = await readUserPreferences();\n return {\n message: `${userPreferences[key] || ''}`,\n };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to get \"${key}\": ${(err as Error).message || err}`,\n };\n }\n};\n"]}
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/config/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAM/E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAyB,KAAK,EAAE,MAAM,EAAE,EAAE;IAC5D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxB,sEAAsE;IACtE,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA0B,CAAC;IAE7C,IAAI,CAAC;QACH,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,mBAAmB,EAAE,CAAC;QACpD,OAAO;YACL,OAAO,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE;SACzC,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,kBAAkB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACpE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { UserPreferences } from '@ms-cloudpack/common-types';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { allUserPreferences, readUserPreferences } from '@ms-cloudpack/config';\n\nexport interface GetArguments {\n key: string;\n}\n\n/** Get a Cloudpack user preference value. */\nexport const execute: CommandAction<never> = async (params) => {\n const { args } = params;\n // Commander should have validated the key based on the given choices.\n const key = args[0] as keyof UserPreferences;\n\n try {\n if (!allUserPreferences[key]) {\n throw new Error(`Invalid key name`);\n }\n\n const userPreferences = await readUserPreferences();\n return {\n message: `${userPreferences[key] || ''}`,\n };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to get \"${key}\": ${(err as Error).message || err}`,\n };\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAM9E,eAAO,MAAM,IAAI,EAAE,mBAwDlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAK9E,eAAO,MAAM,IAAI,EAAE,mBAwDlB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/config/index.ts"],"names":[],"mappings":"AA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C;KACtC,CAAC,CAAC;IAEH,aAAa,CAAC,aAAa,CAA2B;QACpD,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,wBAAwB;QACrC,IAAI,EAAE;YACJ,GAAG,EAAE,IAAI,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE;SACzF;QACD,iBAAiB,EAAE,IAAI;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;IAEH,aAAa,CAAC,aAAa,CAAc;QACvC,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,oCAAoC;QACjD,iBAAiB,EAAE,IAAI;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC;KACvC,CAAC,CAAC;IAEH,aAAa,CAAC,aAAa,CAAiC;QAC1D,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,2BAA2B;QACxC,KAAK,EAAE,OAAO,EAAE,qBAAqB;QACrC,IAAI,EAAE;YACJ,GAAG,EAAE,IAAI,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE;SAC5F;QACD,iBAAiB,EAAE,IAAI;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC;KACzC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { allUserPreferences } from '@ms-cloudpack/config';\nimport { Argument } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { DeleteArguments, DeleteOptions } from './delete.js';\nimport type { GetArguments, GetOptions } from './get.js';\nimport type { ListOptions } from './list.js';\nimport type { SetArguments, SetOptions } from './set.js';\n\nexport const init: CommandInitFunction = (program) => {\n const userPreferencesKeys = Object.keys(allUserPreferences) as (keyof typeof allUserPreferences)[];\n const keyWidth = Math.max(20, ...userPreferencesKeys.map((key) => key.length + 1));\n\n const configCommand = program.addSubCommand({\n name: 'config',\n description: 'Manage Cloudpack user preferences (requires a sub-command).',\n usage: '<command>',\n hideSharedOptions: true,\n addHelpText: {\n position: 'afterAll',\n text:\n '\\nAvailable preferences:\\n' +\n userPreferencesKeys.map((key) => ` ${key.padEnd(keyWidth)}${allUserPreferences[key]}`).join('\\n'),\n },\n });\n\n configCommand.addSubCommand<SetOptions, SetArguments>({\n name: 'set',\n description: 'Set a user preference.',\n args: {\n // commander will throw if key is not one of these values, so we don't need manual validation later.\n key: new Argument('<key>', 'The key to set.').choices(userPreferencesKeys).argRequired(),\n value: new Argument('<value>', 'The value to set.').argRequired(),\n },\n hideSharedOptions: true,\n getExecutor: () => import('./set.js'),\n });\n\n configCommand.addSubCommand<GetOptions, GetArguments>({\n name: 'get',\n description: 'Get a user preference.',\n args: {\n key: new Argument('<key>', 'The key to get.').choices(userPreferencesKeys).argRequired(),\n },\n hideSharedOptions: true,\n getExecutor: () => import('./get.js'),\n });\n\n configCommand.addSubCommand<ListOptions>({\n name: 'list',\n description: 'List the current user preferences.',\n hideSharedOptions: true,\n getExecutor: () => import('./list.js'),\n });\n\n configCommand.addSubCommand<DeleteOptions, DeleteArguments>({\n name: 'delete',\n description: 'Delete a user preference.',\n alias: 'unset', // git uses this name\n args: {\n key: new Argument('<key>', 'The key to delete.').choices(userPreferencesKeys).argRequired(),\n },\n hideSharedOptions: true,\n getExecutor: () => import('./delete.js'),\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAMrC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAwC,CAAC;IACn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F;QACD,iBAAiB,EAAE,IAAI;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC;KACtC,CAAC,CAAC;IAEH,aAAa,CAAC,aAAa,CAAQ;QACjC,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,oCAAoC;QACjD,iBAAiB,EAAE,IAAI;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC;KACvC,CAAC,CAAC;IAEH,aAAa,CAAC,aAAa,CAAyB;QAClD,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,2BAA2B;QACxC,KAAK,EAAE,OAAO,EAAE,qBAAqB;QACrC,IAAI,EAAE;YACJ,GAAG,EAAE,IAAI,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE;SAC5F;QACD,iBAAiB,EAAE,IAAI;QACvB,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC;KACzC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { allUserPreferences } from '@ms-cloudpack/config';\nimport { Argument } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { DeleteArguments } from './delete.js';\nimport type { GetArguments } from './get.js';\nimport type { SetArguments } from './set.js';\n\nexport const init: CommandInitFunction = (program) => {\n const userPreferencesKeys = Object.keys(allUserPreferences) as (keyof typeof allUserPreferences)[];\n const keyWidth = Math.max(20, ...userPreferencesKeys.map((key) => key.length + 1));\n\n const configCommand = program.addSubCommand({\n name: 'config',\n description: 'Manage Cloudpack user preferences (requires a sub-command).',\n usage: '<command>',\n hideSharedOptions: true,\n addHelpText: {\n position: 'afterAll',\n text:\n '\\nAvailable preferences:\\n' +\n userPreferencesKeys.map((key) => ` ${key.padEnd(keyWidth)}${allUserPreferences[key]}`).join('\\n'),\n },\n });\n\n configCommand.addSubCommand<never, SetArguments>({\n name: 'set',\n description: 'Set a user preference.',\n args: {\n // commander will throw if key is not one of these values, so we don't need manual validation later.\n key: new Argument('<key>', 'The key to set.').choices(userPreferencesKeys).argRequired(),\n value: new Argument('<value>', 'The value to set.').argRequired(),\n },\n hideSharedOptions: true,\n getExecutor: () => import('./set.js'),\n });\n\n configCommand.addSubCommand<never, GetArguments>({\n name: 'get',\n description: 'Get a user preference.',\n args: {\n key: new Argument('<key>', 'The key to get.').choices(userPreferencesKeys).argRequired(),\n },\n hideSharedOptions: true,\n getExecutor: () => import('./get.js'),\n });\n\n configCommand.addSubCommand<never>({\n name: 'list',\n description: 'List the current user preferences.',\n hideSharedOptions: true,\n getExecutor: () => import('./list.js'),\n });\n\n configCommand.addSubCommand<never, DeleteArguments>({\n name: 'delete',\n description: 'Delete a user preference.',\n alias: 'unset', // git uses this name\n args: {\n key: new Argument('<key>', 'The key to delete.').choices(userPreferencesKeys).argRequired(),\n },\n hideSharedOptions: true,\n getExecutor: () => import('./delete.js'),\n });\n};\n"]}
@@ -1,6 +1,4 @@
1
1
  import type { CommandAction } from '../../types/CommandAction.js';
2
- export interface ListOptions {
3
- }
4
2
  /** List Cloudpack user preferences. */
5
- export declare const execute: CommandAction<ListOptions>;
3
+ export declare const execute: CommandAction<never>;
6
4
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/config/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,WAAW;CAAG;AAE/B,uCAAuC;AACvC,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,WAAW,CAc9C,CAAC"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/config/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,uCAAuC;AACvC,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,KAAK,CAcxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/config/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAI3D,uCAAuC;AACvC,MAAM,CAAC,MAAM,OAAO,GAA+B,KAAK,IAAI,EAAE;IAC5D,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,MAAM,mBAAmB,EAAE,CAAC;QACpD,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;iBACrC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;iBACzC,IAAI,CAAC,IAAI,CAAC;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,+BAAgC,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACxE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport { readUserPreferences } from '@ms-cloudpack/config';\n\nexport interface ListOptions {}\n\n/** List Cloudpack user preferences. */\nexport const execute: CommandAction<ListOptions> = async () => {\n try {\n const userPreferences = await readUserPreferences();\n return {\n message: Object.entries(userPreferences)\n .map(([key, value]) => `${key}: ${value}`)\n .join('\\n'),\n };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to list preferences: ${(err as Error).message || err}`,\n };\n }\n};\n"]}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/config/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,uCAAuC;AACvC,MAAM,CAAC,MAAM,OAAO,GAAyB,KAAK,IAAI,EAAE;IACtD,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,MAAM,mBAAmB,EAAE,CAAC;QACpD,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;iBACrC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;iBACzC,IAAI,CAAC,IAAI,CAAC;SACd,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,+BAAgC,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACxE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../types/CommandAction.js';\nimport { readUserPreferences } from '@ms-cloudpack/config';\n\n/** List Cloudpack user preferences. */\nexport const execute: CommandAction<never> = async () => {\n try {\n const userPreferences = await readUserPreferences();\n return {\n message: Object.entries(userPreferences)\n .map(([key, value]) => `${key}: ${value}`)\n .join('\\n'),\n };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to list preferences: ${(err as Error).message || err}`,\n };\n }\n};\n"]}
@@ -1,10 +1,8 @@
1
1
  import type { CommandAction } from '../../types/CommandAction.js';
2
- export interface SetOptions {
3
- }
4
2
  export interface SetArguments {
5
3
  key: string;
6
4
  value: string;
7
5
  }
8
6
  /** Delete a Cloudpack user preference value. */
9
- export declare const execute: CommandAction<SetOptions>;
7
+ export declare const execute: CommandAction<never>;
10
8
  //# sourceMappingURL=set.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/commands/config/set.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,UAAU;CAAG;AAE9B,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gDAAgD;AAChD,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,UAAU,CAgB7C,CAAC"}
1
+ {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/commands/config/set.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gDAAgD;AAChD,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,KAAK,CAgBxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/commands/config/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAW5D,gDAAgD;AAChD,MAAM,CAAC,MAAM,OAAO,GAA8B,KAAK,EAAE,MAAM,EAAE,EAAE;IACjE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;IAE7B,IAAI,CAAC;QACH,qFAAqF;QACrF,yCAAyC;QACzC,MAAM,oBAAoB,CAAC,EAAE,GAAG,EAAE,GAA4B,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5E,6EAA6E;QAC7E,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,kBAAkB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACpE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { updateUserPreference } from '@ms-cloudpack/config';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport type { UserPreferences } from '@ms-cloudpack/common-types';\n\nexport interface SetOptions {}\n\nexport interface SetArguments {\n key: string;\n value: string;\n}\n\n/** Delete a Cloudpack user preference value. */\nexport const execute: CommandAction<SetOptions> = async (params) => {\n const { args } = params;\n const [key, newValue] = args;\n\n try {\n // Commander should have validated the key based on the given choices, and the update\n // function will also validate its input.\n await updateUserPreference({ key: key as keyof UserPreferences, newValue });\n // Following the pattern of other tools, we don't output anything on success.\n return { message: '' };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to set \"${key}\": ${(err as Error).message || err}`,\n };\n }\n};\n"]}
1
+ {"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/commands/config/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAS5D,gDAAgD;AAChD,MAAM,CAAC,MAAM,OAAO,GAAyB,KAAK,EAAE,MAAM,EAAE,EAAE;IAC5D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;IAE7B,IAAI,CAAC;QACH,qFAAqF;QACrF,yCAAyC;QACzC,MAAM,oBAAoB,CAAC,EAAE,GAAG,EAAE,GAA4B,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5E,6EAA6E;QAC7E,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,kBAAkB,GAAG,MAAO,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE;SACpE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { updateUserPreference } from '@ms-cloudpack/config';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport type { UserPreferences } from '@ms-cloudpack/common-types';\n\nexport interface SetArguments {\n key: string;\n value: string;\n}\n\n/** Delete a Cloudpack user preference value. */\nexport const execute: CommandAction<never> = async (params) => {\n const { args } = params;\n const [key, newValue] = args;\n\n try {\n // Commander should have validated the key based on the given choices, and the update\n // function will also validate its input.\n await updateUserPreference({ key: key as keyof UserPreferences, newValue });\n // Following the pattern of other tools, we don't output anything on success.\n return { message: '' };\n } catch (err) {\n return {\n hasErrors: true,\n message: `Failed to set \"${key}\": ${(err as Error).message || err}`,\n };\n }\n};\n"]}
@@ -1,7 +1,4 @@
1
1
  import type { CommandAction } from '../../../types/CommandAction.js';
2
- interface LockFileOptions {
3
- }
4
2
  /** Executor for the "info lock-file" verb */
5
- export declare const execute: CommandAction<LockFileOptions>;
6
- export {};
3
+ export declare const execute: CommandAction<never>;
7
4
  //# sourceMappingURL=execute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/commands/info/lockFile/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAKrE,UAAU,eAAe;CAAG;AAE5B,6CAA6C;AAC7C,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,eAAe,CAoBlD,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../src/commands/info/lockFile/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAKrE,6CAA6C;AAC7C,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,KAAK,CAoBxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/info/lockFile/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAmC,KAAK,EAAE,MAAM,EAAE,EAAE;IACtE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAEhC,IAAI,CAAC;QACH,iEAAiE;QACjE,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAClD,CAAC;QAED,MAAM,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QACrD,OAAO;YACL,OAAO,EAAE,qBAAqB,CAAC,gBAAgB,CAAC;SACjD,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,qCAAsC,GAAa,CAAC,KAAK,IAAI,GAAG,EAAE;YAC3E,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../../types/CommandAction.js';\nimport { checkResolvedVersions } from './checkResolvedVersions.js';\nimport { readYarnLock } from './readYarnLock.js';\nimport { processYarnLock } from './processYarnLock.js';\n\ninterface LockFileOptions {}\n\n/** Executor for the \"info lock-file\" verb */\nexport const execute: CommandAction<LockFileOptions> = async (params) => {\n const { appPath: cwd } = params;\n\n try {\n // This returns either the lock file contents or an error message\n const lockResult = await readYarnLock(cwd);\n if (typeof lockResult === 'string') {\n return { message: lockResult, hasErrors: true };\n }\n\n const resolvedVersions = processYarnLock(lockResult);\n return {\n message: checkResolvedVersions(resolvedVersions),\n };\n } catch (err) {\n return {\n message: `Error getting info from lockfile: ${(err as Error).stack || err}`,\n hasErrors: true,\n };\n }\n};\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../src/commands/info/lockFile/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAyB,KAAK,EAAE,MAAM,EAAE,EAAE;IAC5D,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAEhC,IAAI,CAAC;QACH,iEAAiE;QACjE,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAClD,CAAC;QAED,MAAM,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QACrD,OAAO;YACL,OAAO,EAAE,qBAAqB,CAAC,gBAAgB,CAAC;SACjD,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,qCAAsC,GAAa,CAAC,KAAK,IAAI,GAAG,EAAE;YAC3E,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { CommandAction } from '../../../types/CommandAction.js';\nimport { checkResolvedVersions } from './checkResolvedVersions.js';\nimport { readYarnLock } from './readYarnLock.js';\nimport { processYarnLock } from './processYarnLock.js';\n\n/** Executor for the \"info lock-file\" verb */\nexport const execute: CommandAction<never> = async (params) => {\n const { appPath: cwd } = params;\n\n try {\n // This returns either the lock file contents or an error message\n const lockResult = await readYarnLock(cwd);\n if (typeof lockResult === 'string') {\n return { message: lockResult, hasErrors: true };\n }\n\n const resolvedVersions = processYarnLock(lockResult);\n return {\n message: checkResolvedVersions(resolvedVersions),\n };\n } catch (err) {\n return {\n message: `Error getting info from lockfile: ${(err as Error).stack || err}`,\n hasErrors: true,\n };\n }\n};\n"]}
@@ -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;AAS3F;;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;CAC9B,GACA,OAAO,CAAC,IAAI,CAAC,CAgBf"}
@@ -8,6 +8,7 @@ import { runPrerequisites } from '../../utilities/runPrerequisites.js';
8
8
  import { getFilteredPackages } from '../../utilities/getFilteredPackages.js';
9
9
  import { optimizeDependencies } from './optimizeDependencies.js';
10
10
  import { bulletedList } from '@ms-cloudpack/task-reporter';
11
+ import { SequentialPromiseExecutor } from '../../utilities/sequentialPromiseExecutor.js';
11
12
  /**
12
13
  * Init execution function.
13
14
  */
@@ -29,6 +30,7 @@ async function initApp(options, context) {
29
30
  const { match } = initOptions;
30
31
  const { config, resolveMap } = context.session;
31
32
  const { appPath } = config;
33
+ const executor = new SequentialPromiseExecutor();
32
34
  // Ensure config.generated.packageSettings is initialized.
33
35
  config.generated.packageSettings ??= [];
34
36
  let isExitingPrematurely = false;
@@ -40,7 +42,7 @@ async function initApp(options, context) {
40
42
  // Start with the app path or requested matches
41
43
  const initialPaths = match ? getFilteredPackages(resolveMap, match) : [appPath];
42
44
  if (!initialPaths.length) {
43
- summaryData.addErrors(appPath, [{ text: `No packages found matching ${match}`, source: 'init' }]);
45
+ summaryData.addErrors(appPath, [{ text: `No packages found matching ${JSON.stringify(match)}`, source: 'init' }]);
44
46
  resolve();
45
47
  }
46
48
  enqueuePaths(new Map(initialPaths.map((packagePath) => [packagePath, undefined])));
@@ -65,6 +67,9 @@ async function initApp(options, context) {
65
67
  const priority = priorityMap.get(packagePath) ?? 0;
66
68
  // Lower priority of this package path by 1.
67
69
  priorityMap.set(packagePath, priority - 1);
70
+ // Use the sequential executor to run the evaluation to avoid concurrency issues.
71
+ executor
72
+ .execute(packagePath, () =>
68
73
  // Evaluate this path, but don't await - when we're done, we'll re-enqueue newly discovered paths.
69
74
  evaluatePath({
70
75
  ...options,
@@ -74,7 +79,7 @@ async function initApp(options, context) {
74
79
  // as we'll re-evaluate packages if they are different since we use a different task id.
75
80
  shouldForce: !isMultiApp && shouldForce,
76
81
  priority,
77
- }, context)
82
+ }, context))
78
83
  .then(({ pathsToEvaluate, pathsToRefresh, shouldExit }) => {
79
84
  pending--;
80
85
  if (shouldExit) {
@@ -118,6 +123,8 @@ async function initApp(options, context) {
118
123
  isExitingPrematurely = true;
119
124
  summaryData.recordException({ packagePath: appPath, error, source: 'init', context: 'running init' });
120
125
  });
126
+ // Clear the executor so that it doesn't hold onto any references to the promises.
127
+ executor.clear();
121
128
  // Log the resolve map to a file if requested. Do this *after* the main init process in case
122
129
  // any additional deps were discovered and added.
123
130
  if (initOptions.logResolveMap) {
@@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,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';\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\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 ${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 // 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 .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 // 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;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAEzF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,MAMC;IAED,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAE1F,MAAM,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtE,iCAAiC;QACjC,MAAM,gBAAgB,CAAC,MAAM,CAAC,CAAC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C;YACnC,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,WAAW,CAAC,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;YAC9E,KAAK,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;gBACnE,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;YAC7C,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"]}
@@ -21,7 +21,7 @@ export function createRemoteApiUrls(params) {
21
21
  try {
22
22
  remoteProtocol = makeUrl(remote).protocol;
23
23
  }
24
- catch (e) {
24
+ catch {
25
25
  // Ignore error and proceed with undefined protocol
26
26
  }
27
27
  // Return as is if it is a WebSocket URL
@@ -1 +1 @@
1
- {"version":3,"file":"createRemoteApiUrls.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AAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;IAC9E,CAAC;SAAM,CAAC;QACN,mEAAmE;QACnE,4BAA4B;QAC5B,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;QAEzE,0BAA0B;QAC1B,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;QAEvE,gDAAgD;QAChD,iBAAiB,GAAG,CAAC,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,4CAA4C;IAC5C,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,MAAM,CAAC,YAAY,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import { makeUrl } from '@ms-cloudpack/path-string-parsing';\nimport { apiServerPort } from '@ms-cloudpack/api-server';\n\n/**\n * Creates API server URLs for remote connection\n *\n * Generates WebSocket URLs for connecting to remote API servers based on\n * the provided remote host and available ports.\n *\n * If the remote host is not specified, it starts from 'localhost'.\n * It accepts both HTTP and HTTPS protocols, and generates the appropriate\n * WebSocket URLs based on the protocol of the remote host and known api server ports.\n * It also accepts WS and WSS protocols based on the remote host's protocol and returns as is.\n *\n * When the protocol is undefined (not HTTP or HTTPS), it generates both secure (wss://)\n * and non-secure (ws://) WebSocket URLs, with wss:// URLs listed first.\n */\nexport function createRemoteApiUrls(params: { remote: string | boolean; apiServerUrl: string }): string[] {\n const remote = typeof params.remote === 'string' ? params.remote : 'localhost';\n\n // Extract the protocol from the remote if available\n let remoteProtocol: string | undefined = undefined;\n try {\n remoteProtocol = makeUrl(remote).protocol;\n } catch (e) {\n // Ignore error and proceed with undefined protocol\n }\n\n // Return as is if it is a WebSocket URL\n if (remoteProtocol === 'ws:' || remoteProtocol === 'wss:') {\n return [remote];\n }\n\n // Get the hostname (host without port, protocol, etc.). Use dummy protocol to extract the hostname if needed.\n const hostname = remote.startsWith('http') ? makeUrl(remote).hostname : makeUrl(`http://${remote}`).hostname;\n\n // Generate URLs based on protocol\n let hostApiServerURLs: string[] = [];\n\n if (remoteProtocol === 'https:') {\n // For HTTPS, only use secure WebSockets\n hostApiServerURLs = apiServerPort.map((port) => `wss://${hostname}:${port}`);\n } else if (remoteProtocol === 'http:') {\n // For HTTP, only use non-secure WebSockets\n hostApiServerURLs = apiServerPort.map((port) => `ws://${hostname}:${port}`);\n } else {\n // For undefined protocol, generate both secure and non-secure URLs\n // First add all wss:// URLs\n const wssUrls = apiServerPort.map((port) => `wss://${hostname}:${port}`);\n\n // Then add all ws:// URLs\n const wsUrls = apiServerPort.map((port) => `ws://${hostname}:${port}`);\n\n // Combine both sets of URLs with wss URLs first\n hostApiServerURLs = [...wssUrls, ...wsUrls];\n }\n\n // Exclude the current api url from the list\n return hostApiServerURLs.filter((url) => url !== params.apiServerUrl);\n}\n"]}
1
+ {"version":3,"file":"createRemoteApiUrls.js","sourceRoot":"","sources":["../../../src/commands/link/createRemoteApiUrls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA0D;IAC5F,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC;IAE/E,oDAAoD;IACpD,IAAI,cAAc,GAAuB,SAAS,CAAC;IACnD,IAAI,CAAC;QACH,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;IAC5C,CA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,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,MAAM,CAAC,YAAY,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import { makeUrl } from '@ms-cloudpack/path-string-parsing';\nimport { apiServerPort } from '@ms-cloudpack/api-server';\n\n/**\n * Creates API server URLs for remote connection\n *\n * Generates WebSocket URLs for connecting to remote API servers based on\n * the provided remote host and available ports.\n *\n * If the remote host is not specified, it starts from 'localhost'.\n * It accepts both HTTP and HTTPS protocols, and generates the appropriate\n * WebSocket URLs based on the protocol of the remote host and known api server ports.\n * It also accepts WS and WSS protocols based on the remote host's protocol and returns as is.\n *\n * When the protocol is undefined (not HTTP or HTTPS), it generates both secure (wss://)\n * and non-secure (ws://) WebSocket URLs, with wss:// URLs listed first.\n */\nexport function createRemoteApiUrls(params: { remote: string | boolean; apiServerUrl: string }): string[] {\n const remote = typeof params.remote === 'string' ? params.remote : 'localhost';\n\n // Extract the protocol from the remote if available\n let remoteProtocol: string | undefined = undefined;\n try {\n remoteProtocol = makeUrl(remote).protocol;\n } catch {\n // Ignore error and proceed with undefined protocol\n }\n\n // Return as is if it is a WebSocket URL\n if (remoteProtocol === 'ws:' || remoteProtocol === 'wss:') {\n return [remote];\n }\n\n // Get the hostname (host without port, protocol, etc.). Use dummy protocol to extract the hostname if needed.\n const hostname = remote.startsWith('http') ? makeUrl(remote).hostname : makeUrl(`http://${remote}`).hostname;\n\n // Generate URLs based on protocol\n let hostApiServerURLs: string[] = [];\n\n if (remoteProtocol === 'https:') {\n // For HTTPS, only use secure WebSockets\n hostApiServerURLs = apiServerPort.map((port) => `wss://${hostname}:${port}`);\n } else if (remoteProtocol === 'http:') {\n // For HTTP, only use non-secure WebSockets\n hostApiServerURLs = apiServerPort.map((port) => `ws://${hostname}:${port}`);\n } else {\n // For undefined protocol, generate both secure and non-secure URLs\n // First add all wss:// URLs\n const wssUrls = apiServerPort.map((port) => `wss://${hostname}:${port}`);\n\n // Then add all ws:// URLs\n const wsUrls = apiServerPort.map((port) => `ws://${hostname}:${port}`);\n\n // Combine both sets of URLs with wss URLs first\n hostApiServerURLs = [...wssUrls, ...wsUrls];\n }\n\n // Exclude the current api url from the list\n return hostApiServerURLs.filter((url) => url !== params.apiServerUrl);\n}\n"]}
@@ -41,7 +41,7 @@ async function isSessionActive(session, reporter) {
41
41
  try {
42
42
  isActive = (await client.getSessionId.query()) === session.id;
43
43
  }
44
- catch (e) {
44
+ catch {
45
45
  /* no-op */
46
46
  }
47
47
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"getActiveSessions.js","sourceRoot":"","sources":["../../../src/commands/link/getActiveSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAsD;IAC5F,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IACvC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAC5D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC7D,MAAM,sBAAsB,GAAG,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,EAAE;QAChF,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAU,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC,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,CAAC","sourcesContent":["import { createCloudpackClient, getActiveSessionsPath } from '@ms-cloudpack/api-server';\nimport type { Session } from '@ms-cloudpack/common-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { readdir, rm } from 'fs/promises';\nimport path from 'path';\nimport fs from 'fs';\n\n/**\n * Get array of active sessions.\n * An active session is one that has a valid session file and the api server is still active.\n * This function will also delete inactive session files.\n */\nexport async function getActiveSessions(params: { cachePath: string; reporter?: TaskReporter }): Promise<Session[]> {\n const { reporter, cachePath } = params;\n const activeSessionPaths = getActiveSessionsPath(cachePath);\n if (!fs.existsSync(activeSessionPaths)) {\n return [];\n }\n const activeSessionFiles = await readdir(activeSessionPaths);\n const activeSessionsPromises = activeSessionFiles.map(async (activeSessionFile) => {\n const session = await readJson<Session>(path.join(activeSessionPaths, activeSessionFile));\n if (session && (await isSessionActive(session, reporter))) {\n return session;\n } else {\n console.debug(`Deleting invalid session file: ${activeSessionFile}`);\n await rm(path.join(activeSessionPaths, activeSessionFile));\n return null;\n }\n });\n\n const activeSessionsResults = await Promise.all(activeSessionsPromises);\n return activeSessionsResults.filter((session) => session !== null);\n}\n\nasync function isSessionActive(session: Session, reporter?: TaskReporter): Promise<boolean> {\n const { apiServer } = session.urls;\n\n if (!apiServer) {\n return false;\n }\n\n console.debug(`Checking session: ${session.id}`);\n\n const client = await createCloudpackClient({ url: apiServer, reporter });\n // Ping the api server to see if it is still active\n let isActive = false;\n try {\n isActive = (await client.getSessionId.query()) === session.id;\n } catch (e) {\n /* no-op */\n } finally {\n await client.close();\n }\n\n return isActive;\n}\n"]}
1
+ {"version":3,"file":"getActiveSessions.js","sourceRoot":"","sources":["../../../src/commands/link/getActiveSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAA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AU,eAAe,CAAC,OAAgB,EAAE,QAAuB;IACtE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAEnC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,qBAAqB,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IACzE,mDAAmD;IACnD,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,WAAW;IACb,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { createCloudpackClient, getActiveSessionsPath } from '@ms-cloudpack/api-server';\nimport type { Session } from '@ms-cloudpack/common-types';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { readdir, rm } from 'fs/promises';\nimport path from 'path';\nimport fs from 'fs';\n\n/**\n * Get array of active sessions.\n * An active session is one that has a valid session file and the api server is still active.\n * This function will also delete inactive session files.\n */\nexport async function getActiveSessions(params: { cachePath: string; reporter?: TaskReporter }): Promise<Session[]> {\n const { reporter, cachePath } = params;\n const activeSessionPaths = getActiveSessionsPath(cachePath);\n if (!fs.existsSync(activeSessionPaths)) {\n return [];\n }\n const activeSessionFiles = await readdir(activeSessionPaths);\n const activeSessionsPromises = activeSessionFiles.map(async (activeSessionFile) => {\n const session = await readJson<Session>(path.join(activeSessionPaths, activeSessionFile));\n if (session && (await isSessionActive(session, reporter))) {\n return session;\n } else {\n console.debug(`Deleting invalid session file: ${activeSessionFile}`);\n await rm(path.join(activeSessionPaths, activeSessionFile));\n return null;\n }\n });\n\n const activeSessionsResults = await Promise.all(activeSessionsPromises);\n return activeSessionsResults.filter((session) => session !== null);\n}\n\nasync function isSessionActive(session: Session, reporter?: TaskReporter): Promise<boolean> {\n const { apiServer } = session.urls;\n\n if (!apiServer) {\n return false;\n }\n\n console.debug(`Checking session: ${session.id}`);\n\n const client = await createCloudpackClient({ url: apiServer, reporter });\n // Ping the api server to see if it is still active\n let isActive = false;\n try {\n isActive = (await client.getSessionId.query()) === session.id;\n } catch {\n /* no-op */\n } finally {\n await client.close();\n }\n\n return isActive;\n}\n"]}
@@ -7,7 +7,7 @@ function parseArray(value) {
7
7
  const arrayItems = arrayContent.split(',').map((item) => item.trim());
8
8
  return arrayItems.map((item) => parseValue(item));
9
9
  }
10
- catch (e) {
10
+ catch {
11
11
  // If parsing fails, treat as a string
12
12
  return value;
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parseDefine.js","sourceRoot":"","sources":["../../src/utilities/parseDefine.ts"],"names":[],"mappings":"AAEA,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1D,IAAI,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACtE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,CAAC,E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AE,CAAC;QACvB,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YACjB,SAAS;QACX,CAAC;QAED,sCAAsC;QACtC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE,CAAC;YACvB,oCAAoC;YACpC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;YAClD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC3D,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { DefineFlags } from '@ms-cloudpack/common-types-browser';\n\nfunction parseArray(value: string): (boolean | string | number)[] | string {\n try {\n const arrayContent = value.substring(1, value.length - 1);\n if (arrayContent.trim() === '') {\n return [];\n }\n const arrayItems = arrayContent.split(',').map((item) => item.trim());\n return arrayItems.map((item) => parseValue(item));\n } catch (e) {\n // If parsing fails, treat as a string\n return value;\n }\n}\n\nfunction isArray(value: string): boolean {\n return value.startsWith('[') && value.endsWith(']');\n}\n\nfunction parseValue(value: string): boolean | string | number {\n // Handle quoted strings (remove the quotes and keep as string)\n if ((value.startsWith('\"') && value.endsWith('\"')) || (value.startsWith(\"'\") && value.endsWith(\"'\"))) {\n return value.substring(1, value.length - 1);\n }\n\n if (value === 'true') {\n return true;\n } else if (value === 'false') {\n return false;\n } else if (!isNaN(Number(value)) && value.trim() !== '') {\n return Number(value);\n }\n return value;\n}\n\nexport function parseDefine(define: string, accDefine: DefineFlags = {}): DefineFlags {\n // Handle empty string case\n if (!define.trim()) {\n return accDefine;\n }\n\n // Parse define string respecting arrays and quoted strings\n const defineParts: string[] = [];\n let currentPart = '';\n let inArray = 0; // Counter for nested arrays\n let inString: string | null = null; // Track if inside quotes\n let escaped = false; // Track if next character is escaped\n\n for (const char of define) {\n // Handle escaping characters in strings\n if (inString && char === '\\\\' && !escaped) {\n escaped = true;\n currentPart += char;\n continue;\n }\n\n // Handle string boundaries\n if ((char === '\"' || char === \"'\") && !escaped) {\n if (inString === char) {\n inString = null; // Exiting string\n } else if (inString === null) {\n inString = char; // Entering string\n }\n currentPart += char;\n continue;\n }\n\n if (escaped) escaped = false;\n\n // Handle array boundaries\n if (char === '[' && !inString) inArray++;\n else if (char === ']' && !inString) inArray--;\n\n // Split on commas only when not in an array or string\n if (char === ',' && inArray === 0 && inString === null) {\n defineParts.push(currentPart.trim());\n currentPart = '';\n } else {\n currentPart += char;\n }\n }\n\n // Add the last part\n if (currentPart.trim()) {\n defineParts.push(currentPart.trim());\n }\n for (const part of defineParts) {\n if (!part.trim()) {\n continue;\n }\n\n // Split on the first equals sign only\n const equalsIndex = part.indexOf('=');\n if (equalsIndex === -1) {\n // No equals sign means boolean flag\n accDefine[part.trim()] = true;\n } else {\n const key = part.substring(0, equalsIndex).trim();\n const valueString = part.substring(equalsIndex + 1).trim();\n accDefine[key] = isArray(valueString) ? parseArray(valueString) : parseValue(valueString);\n }\n }\n\n return accDefine;\n}\n"]}
1
+ {"version":3,"file":"parseDefine.js","sourceRoot":"","sources":["../../src/utilities/parseDefine.ts"],"names":[],"mappings":"AAEA,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,CA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CAAC,WAAW,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { DefineFlags } from '@ms-cloudpack/common-types-browser';\n\nfunction parseArray(value: string): (boolean | string | number)[] | string {\n try {\n const arrayContent = value.substring(1, value.length - 1);\n if (arrayContent.trim() === '') {\n return [];\n }\n const arrayItems = arrayContent.split(',').map((item) => item.trim());\n return arrayItems.map((item) => parseValue(item));\n } catch {\n // If parsing fails, treat as a string\n return value;\n }\n}\n\nfunction isArray(value: string): boolean {\n return value.startsWith('[') && value.endsWith(']');\n}\n\nfunction parseValue(value: string): boolean | string | number {\n // Handle quoted strings (remove the quotes and keep as string)\n if ((value.startsWith('\"') && value.endsWith('\"')) || (value.startsWith(\"'\") && value.endsWith(\"'\"))) {\n return value.substring(1, value.length - 1);\n }\n\n if (value === 'true') {\n return true;\n } else if (value === 'false') {\n return false;\n } else if (!isNaN(Number(value)) && value.trim() !== '') {\n return Number(value);\n }\n return value;\n}\n\nexport function parseDefine(define: string, accDefine: DefineFlags = {}): DefineFlags {\n // Handle empty string case\n if (!define.trim()) {\n return accDefine;\n }\n\n // Parse define string respecting arrays and quoted strings\n const defineParts: string[] = [];\n let currentPart = '';\n let inArray = 0; // Counter for nested arrays\n let inString: string | null = null; // Track if inside quotes\n let escaped = false; // Track if next character is escaped\n\n for (const char of define) {\n // Handle escaping characters in strings\n if (inString && char === '\\\\' && !escaped) {\n escaped = true;\n currentPart += char;\n continue;\n }\n\n // Handle string boundaries\n if ((char === '\"' || char === \"'\") && !escaped) {\n if (inString === char) {\n inString = null; // Exiting string\n } else if (inString === null) {\n inString = char; // Entering string\n }\n currentPart += char;\n continue;\n }\n\n if (escaped) escaped = false;\n\n // Handle array boundaries\n if (char === '[' && !inString) inArray++;\n else if (char === ']' && !inString) inArray--;\n\n // Split on commas only when not in an array or string\n if (char === ',' && inArray === 0 && inString === null) {\n defineParts.push(currentPart.trim());\n currentPart = '';\n } else {\n currentPart += char;\n }\n }\n\n // Add the last part\n if (currentPart.trim()) {\n defineParts.push(currentPart.trim());\n }\n for (const part of defineParts) {\n if (!part.trim()) {\n continue;\n }\n\n // Split on the first equals sign only\n const equalsIndex = part.indexOf('=');\n if (equalsIndex === -1) {\n // No equals sign means boolean flag\n accDefine[part.trim()] = true;\n } else {\n const key = part.substring(0, equalsIndex).trim();\n const valueString = part.substring(equalsIndex + 1).trim();\n accDefine[key] = isArray(valueString) ? parseArray(valueString) : parseValue(valueString);\n }\n }\n\n return accDefine;\n}\n"]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Class for executing promises sequentially by ID.
3
+ * Ensures that operations with the same ID are processed in order.
4
+ * Automatically cleans up completed operations to prevent memory leaks.
5
+ */
6
+ export declare class SequentialPromiseExecutor {
7
+ /**
8
+ * Map tracking the last operation promise for each ID
9
+ */
10
+ operations: Map<string, Promise<unknown>>;
11
+ /**
12
+ * Execute a promise-returning function, ensuring sequential execution for the same ID.
13
+ * Automatically removes the promise from tracking once it completes.
14
+ */
15
+ execute<T>(id: string, execute: () => Promise<T>): Promise<T>;
16
+ /**
17
+ * Clear all tracked operations for all IDs.
18
+ * This is still useful for forcibly clearing all operations when needed.
19
+ */
20
+ clear(): void;
21
+ }
22
+ //# sourceMappingURL=sequentialPromiseExecutor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequentialPromiseExecutor.d.ts","sourceRoot":"","sources":["../../src/utilities/sequentialPromiseExecutor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,yBAAyB;IACpC;;OAEG;IACI,UAAU,gCAAuC;IAExD;;;OAGG;IACU,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAiC1E;;;OAGG;IACI,KAAK,IAAI,IAAI;CAGrB"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Class for executing promises sequentially by ID.
3
+ * Ensures that operations with the same ID are processed in order.
4
+ * Automatically cleans up completed operations to prevent memory leaks.
5
+ */
6
+ export class SequentialPromiseExecutor {
7
+ /**
8
+ * Map tracking the last operation promise for each ID
9
+ */
10
+ operations = new Map();
11
+ /**
12
+ * Execute a promise-returning function, ensuring sequential execution for the same ID.
13
+ * Automatically removes the promise from tracking once it completes.
14
+ */
15
+ async execute(id, execute) {
16
+ // Get the promise for the last operation with this ID, or a resolved promise if none
17
+ const lastOperation = this.operations.get(id) || Promise.resolve();
18
+ // Create a new operation that starts after the previous one finishes
19
+ const operation = lastOperation
20
+ // Suppress errors from previous operations to prevent chain breakage
21
+ .catch((err) => {
22
+ console.debug(`Ignoring error from previous operation on ${id}: ${err instanceof Error ? err.stack : err}`);
23
+ })
24
+ .then(execute); // Execute the new operation and use its return value
25
+ // Set up cleanup when this operation completes (success or failure)
26
+ const cleanupOperation = operation
27
+ // Ensure cleanup happens even if operation fails
28
+ .catch((err) => {
29
+ console.debug(`Ignoring error cleaning operation on ${id}: ${err instanceof Error ? err.stack : err}`);
30
+ })
31
+ .finally(() => {
32
+ // Only clean up if this is still the current operation for this ID
33
+ if (this.operations.get(id) === cleanupOperation) {
34
+ this.operations.delete(id);
35
+ }
36
+ });
37
+ // Update the last operation for this ID with the operation that includes cleanup
38
+ this.operations.set(id, cleanupOperation);
39
+ // Return the original operation without the cleanup logic to avoid creating
40
+ // a circular reference that might prevent garbage collection
41
+ return operation;
42
+ }
43
+ /**
44
+ * Clear all tracked operations for all IDs.
45
+ * This is still useful for forcibly clearing all operations when needed.
46
+ */
47
+ clear() {
48
+ this.operations.clear();
49
+ }
50
+ }
51
+ //# sourceMappingURL=sequentialPromiseExecutor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequentialPromiseExecutor.js","sourceRoot":"","sources":["../../src/utilities/sequentialPromiseExecutor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IACpC;;OAEG;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I,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * Class for executing promises sequentially by ID.\n * Ensures that operations with the same ID are processed in order.\n * Automatically cleans up completed operations to prevent memory leaks.\n */\nexport class SequentialPromiseExecutor {\n /**\n * Map tracking the last operation promise for each ID\n */\n public operations = new Map<string, Promise<unknown>>();\n\n /**\n * Execute a promise-returning function, ensuring sequential execution for the same ID.\n * Automatically removes the promise from tracking once it completes.\n */\n public async execute<T>(id: string, execute: () => Promise<T>): Promise<T> {\n // Get the promise for the last operation with this ID, or a resolved promise if none\n const lastOperation = this.operations.get(id) || Promise.resolve();\n\n // Create a new operation that starts after the previous one finishes\n const operation = lastOperation\n // Suppress errors from previous operations to prevent chain breakage\n .catch((err) => {\n console.debug(`Ignoring error from previous operation on ${id}: ${err instanceof Error ? err.stack : err}`);\n })\n .then(execute); // Execute the new operation and use its return value\n\n // Set up cleanup when this operation completes (success or failure)\n const cleanupOperation = operation\n // Ensure cleanup happens even if operation fails\n .catch((err) => {\n console.debug(`Ignoring error cleaning operation on ${id}: ${err instanceof Error ? err.stack : err}`);\n })\n .finally(() => {\n // Only clean up if this is still the current operation for this ID\n if (this.operations.get(id) === cleanupOperation) {\n this.operations.delete(id);\n }\n });\n\n // Update the last operation for this ID with the operation that includes cleanup\n this.operations.set(id, cleanupOperation);\n\n // Return the original operation without the cleanup logic to avoid creating\n // a circular reference that might prevent garbage collection\n return operation;\n }\n\n /**\n * Clear all tracked operations for all IDs.\n * This is still useful for forcibly clearing all operations when needed.\n */\n public clear(): void {\n this.operations.clear();\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.75.0",
3
+ "version": "0.76.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",
@@ -18,26 +18,26 @@
18
18
  "cloudpack": "./bin/cloudpack.js"
19
19
  },
20
20
  "dependencies": {
21
- "@ms-cloudpack/api-server": "^0.63.11",
22
- "@ms-cloudpack/app-server": "^0.18.14",
23
- "@ms-cloudpack/bundler": "^0.25.13",
24
- "@ms-cloudpack/bundler-capabilities": "^0.2.26",
25
- "@ms-cloudpack/common-types": "^0.24.20",
26
- "@ms-cloudpack/config": "^0.35.10",
27
- "@ms-cloudpack/create-express-app": "^1.10.35",
21
+ "@ms-cloudpack/api-server": "^0.64.1",
22
+ "@ms-cloudpack/app-server": "^0.18.16",
23
+ "@ms-cloudpack/bundler": "^0.25.15",
24
+ "@ms-cloudpack/bundler-capabilities": "^0.2.28",
25
+ "@ms-cloudpack/common-types": "^0.25.1",
26
+ "@ms-cloudpack/config": "^0.35.12",
27
+ "@ms-cloudpack/create-express-app": "^1.10.37",
28
28
  "@ms-cloudpack/environment": "^0.1.1",
29
29
  "@ms-cloudpack/json-utilities": "^0.1.10",
30
- "@ms-cloudpack/link-proxy": "^0.2.13",
31
- "@ms-cloudpack/overlay": "^0.19.9",
32
- "@ms-cloudpack/package-utilities": "^12.3.12",
30
+ "@ms-cloudpack/link-proxy": "^0.2.15",
31
+ "@ms-cloudpack/overlay": "^0.19.11",
32
+ "@ms-cloudpack/package-utilities": "^12.3.14",
33
33
  "@ms-cloudpack/path-string-parsing": "^1.2.7",
34
- "@ms-cloudpack/path-utilities": "^3.1.6",
35
- "@ms-cloudpack/remote-cache": "^0.11.22",
36
- "@ms-cloudpack/setup-utilities": "^0.5.27",
37
- "@ms-cloudpack/task-reporter": "^0.17.0",
38
- "@ms-cloudpack/telemetry": "^0.11.24",
34
+ "@ms-cloudpack/path-utilities": "^3.1.8",
35
+ "@ms-cloudpack/remote-cache": "^0.11.24",
36
+ "@ms-cloudpack/setup-utilities": "^0.5.29",
37
+ "@ms-cloudpack/task-reporter": "^0.17.2",
38
+ "@ms-cloudpack/telemetry": "^0.11.26",
39
39
  "@yarnpkg/lockfile": "^1.1.0",
40
- "commander": "^13.0.0",
40
+ "commander": "^14.0.0",
41
41
  "cross-spawn": "^7.0.3",
42
42
  "didyoumean": "^1.2.2",
43
43
  "get-port": "^7.0.0",
@@ -48,8 +48,8 @@
48
48
  "workspace-tools": "^0.38.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@ms-cloudpack/common-types": "^0.24.20",
52
- "@ms-cloudpack/common-types-browser": "^0.6.1",
51
+ "@ms-cloudpack/common-types": "^0.25.1",
52
+ "@ms-cloudpack/common-types-browser": "^0.6.2",
53
53
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
54
54
  "@ms-cloudpack/scripts": "^0.0.1",
55
55
  "@ms-cloudpack/test-utilities": "^0.5.0",