@shopify/cli-kit 3.31.1 → 3.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/README.md +1 -1
  2. package/dist/constants.d.ts +1 -0
  3. package/dist/constants.js +1 -0
  4. package/dist/constants.js.map +1 -1
  5. package/dist/environment/local.d.ts +1 -0
  6. package/dist/environment/local.js +4 -1
  7. package/dist/environment/local.js.map +1 -1
  8. package/dist/file.d.ts +10 -3
  9. package/dist/file.js +34 -34
  10. package/dist/file.js.map +1 -1
  11. package/dist/index.d.ts +0 -3
  12. package/dist/index.js +0 -3
  13. package/dist/index.js.map +1 -1
  14. package/dist/metadata.d.ts +1 -1
  15. package/dist/metadata.js.map +1 -1
  16. package/dist/monorail.d.ts +1 -1
  17. package/dist/monorail.js.map +1 -1
  18. package/dist/os.d.ts +4 -3
  19. package/dist/os.js +3 -4
  20. package/dist/os.js.map +1 -1
  21. package/dist/output.d.ts +2 -2
  22. package/dist/output.js +1 -1
  23. package/dist/output.js.map +1 -1
  24. package/dist/path.d.ts +3 -1
  25. package/dist/path.js +2 -2
  26. package/dist/path.js.map +1 -1
  27. package/dist/plugins.d.ts +1 -1
  28. package/dist/plugins.js.map +1 -1
  29. package/dist/{json.d.ts → private/common/json.d.ts} +0 -0
  30. package/dist/{json.js → private/common/json.js} +0 -0
  31. package/dist/private/common/json.js.map +1 -0
  32. package/dist/private/node/analytics.d.ts +27 -0
  33. package/dist/private/node/analytics.js +57 -0
  34. package/dist/private/node/analytics.js.map +1 -0
  35. package/dist/private/node/ui/components/Alert.test.js +5 -5
  36. package/dist/private/node/ui/components/Alert.test.js.map +1 -1
  37. package/dist/private/node/ui/components/Banner.js +5 -5
  38. package/dist/private/node/ui/components/Banner.js.map +1 -1
  39. package/dist/private/node/ui/components/Banner.test.js +11 -11
  40. package/dist/private/node/ui/components/Banner.test.js.map +1 -1
  41. package/dist/private/node/ui/components/Command.test.js +3 -3
  42. package/dist/private/node/ui/components/Command.test.js.map +1 -1
  43. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +2 -2
  44. package/dist/private/node/ui/components/ConcurrentOutput.js +1 -1
  45. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  46. package/dist/private/node/ui/components/ConcurrentOutput.test.js +3 -3
  47. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
  48. package/dist/private/node/ui/components/FatalError.test.js +9 -9
  49. package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
  50. package/dist/private/node/ui/components/FilePath.test.js +3 -3
  51. package/dist/private/node/ui/components/FilePath.test.js.map +1 -1
  52. package/dist/private/node/ui/components/Link.test.js +5 -5
  53. package/dist/private/node/ui/components/Link.test.js.map +1 -1
  54. package/dist/private/node/ui/components/List.test.js +5 -5
  55. package/dist/private/node/ui/components/List.test.js.map +1 -1
  56. package/dist/private/node/ui/components/SelectInput.d.ts +2 -2
  57. package/dist/private/node/ui/components/SelectInput.js +16 -24
  58. package/dist/private/node/ui/components/SelectInput.js.map +1 -1
  59. package/dist/private/node/ui/components/SelectInput.test.js +62 -32
  60. package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
  61. package/dist/private/node/ui/components/{Prompt.d.ts → SelectPrompt.d.ts} +4 -3
  62. package/dist/private/node/ui/components/SelectPrompt.js +34 -0
  63. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -0
  64. package/dist/private/node/ui/components/{Prompt.test.d.ts → SelectPrompt.test.d.ts} +0 -0
  65. package/dist/private/node/ui/components/{Prompt.test.js → SelectPrompt.test.js} +7 -6
  66. package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -0
  67. package/dist/private/node/ui/components/Table.js +1 -1
  68. package/dist/private/node/ui/components/Table.js.map +1 -1
  69. package/dist/private/node/ui/components/Tasks.d.ts +1 -1
  70. package/dist/private/node/ui/components/Tasks.js +3 -3
  71. package/dist/private/node/ui/components/Tasks.js.map +1 -1
  72. package/dist/private/node/ui/components/Tasks.test.js +4 -4
  73. package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
  74. package/dist/private/node/ui/components/TextAnimation.js.map +1 -1
  75. package/dist/private/node/ui/components/TextInput.d.ts +9 -0
  76. package/dist/private/node/ui/components/TextInput.js +74 -0
  77. package/dist/private/node/ui/components/TextInput.js.map +1 -0
  78. package/dist/private/node/ui/components/TextInput.test.d.ts +1 -0
  79. package/dist/private/node/ui/components/TextInput.test.js +139 -0
  80. package/dist/private/node/ui/components/TextInput.test.js.map +1 -0
  81. package/dist/private/node/ui/components/TextPrompt.d.ts +8 -0
  82. package/dist/private/node/ui/components/TextPrompt.js +52 -0
  83. package/dist/private/node/ui/components/TextPrompt.js.map +1 -0
  84. package/dist/private/node/ui/components/TextPrompt.test.d.ts +1 -0
  85. package/dist/private/node/ui/components/TextPrompt.test.js +68 -0
  86. package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -0
  87. package/dist/private/node/ui/components/TokenizedText.test.js +3 -3
  88. package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
  89. package/dist/private/node/ui/components/UserInput.test.js +3 -3
  90. package/dist/private/node/ui/components/UserInput.test.js.map +1 -1
  91. package/dist/private/node/ui/hooks/use-layout.d.ts +6 -3
  92. package/dist/private/node/ui/hooks/use-layout.js +17 -8
  93. package/dist/private/node/ui/hooks/use-layout.js.map +1 -1
  94. package/dist/private/node/ui.d.ts +2 -3
  95. package/dist/private/node/ui.js +7 -16
  96. package/dist/private/node/ui.js.map +1 -1
  97. package/dist/public/common/array.js +1 -1
  98. package/dist/public/common/array.js.map +1 -1
  99. package/dist/public/common/collection.js +1 -1
  100. package/dist/public/common/collection.js.map +1 -1
  101. package/dist/public/common/function.js +1 -1
  102. package/dist/public/common/function.js.map +1 -1
  103. package/dist/public/common/lang.js +1 -1
  104. package/dist/public/common/lang.js.map +1 -1
  105. package/dist/public/common/object.js +1 -1
  106. package/dist/public/common/object.js.map +1 -1
  107. package/dist/public/common/url.d.ts +7 -0
  108. package/dist/public/common/url.js +17 -0
  109. package/dist/public/common/url.js.map +1 -0
  110. package/dist/public/node/abort.d.ts +16 -0
  111. package/dist/public/node/abort.js +17 -0
  112. package/dist/public/node/abort.js.map +1 -0
  113. package/dist/public/node/analytics.d.ts +13 -0
  114. package/dist/public/node/analytics.js +82 -0
  115. package/dist/public/node/analytics.js.map +1 -0
  116. package/dist/public/node/archiver.js +1 -1
  117. package/dist/public/node/archiver.js.map +1 -1
  118. package/dist/public/node/base-command.js.map +1 -1
  119. package/dist/public/node/error-handler.js +3 -2
  120. package/dist/public/node/error-handler.js.map +1 -1
  121. package/dist/public/node/framework.js +1 -1
  122. package/dist/public/node/framework.js.map +1 -1
  123. package/dist/public/node/hooks/postrun.js +2 -2
  124. package/dist/public/node/hooks/postrun.js.map +1 -1
  125. package/dist/public/node/hooks/prerun.js +2 -2
  126. package/dist/public/node/hooks/prerun.js.map +1 -1
  127. package/dist/public/node/node-package-manager.d.ts +3 -3
  128. package/dist/public/node/node-package-manager.js +1 -1
  129. package/dist/public/node/node-package-manager.js.map +1 -1
  130. package/dist/public/node/presets.d.ts +1 -1
  131. package/dist/public/node/presets.js.map +1 -1
  132. package/dist/public/node/ruby.d.ts +2 -2
  133. package/dist/public/node/ruby.js +2 -2
  134. package/dist/public/node/ruby.js.map +1 -1
  135. package/dist/public/node/ui.d.ts +12 -17
  136. package/dist/public/node/ui.js +25 -29
  137. package/dist/public/node/ui.js.map +1 -1
  138. package/dist/session/authorize.js +1 -1
  139. package/dist/session/authorize.js.map +1 -1
  140. package/dist/session/redirect-listener.js +6 -3
  141. package/dist/session/redirect-listener.js.map +1 -1
  142. package/dist/system.d.ts +2 -2
  143. package/dist/system.js.map +1 -1
  144. package/dist/testing/ui.d.ts +1 -1
  145. package/dist/testing/ui.js +1 -1
  146. package/dist/testing/ui.js.map +1 -1
  147. package/dist/tsconfig.tsbuildinfo +1 -1
  148. package/dist/ui/inquirer/autocomplete.d.ts +2 -2
  149. package/dist/ui/inquirer/autocomplete.js.map +1 -1
  150. package/dist/ui/inquirer/input.d.ts +2 -2
  151. package/dist/ui/inquirer/input.js.map +1 -1
  152. package/dist/ui/inquirer/password.d.ts +2 -2
  153. package/dist/ui/inquirer/password.js.map +1 -1
  154. package/dist/ui/inquirer/select.d.ts +2 -2
  155. package/dist/ui/inquirer/select.js +2 -2
  156. package/dist/ui/inquirer/select.js.map +1 -1
  157. package/package.json +29 -27
  158. package/dist/abort.d.ts +0 -1
  159. package/dist/abort.js +0 -2
  160. package/dist/abort.js.map +0 -1
  161. package/dist/analytics.d.ts +0 -44
  162. package/dist/analytics.js +0 -154
  163. package/dist/analytics.js.map +0 -1
  164. package/dist/id.d.ts +0 -6
  165. package/dist/id.js +0 -18
  166. package/dist/id.js.map +0 -1
  167. package/dist/json.js.map +0 -1
  168. package/dist/private/node/ui/components/Prompt.js +0 -23
  169. package/dist/private/node/ui/components/Prompt.js.map +0 -1
  170. package/dist/private/node/ui/components/Prompt.test.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/public/common/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAGzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,MAAM,UAAU,OAAO,CAAkC,IAAO,EAAE,QAA8C;IAC9G,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACzC,OAAO,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,8DAA8D;AAC9D,MAAM,UAAU,QAAQ,CACtB,IAAO,EACP,IAAa,EACb,OAA0B;IAE1B,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACjD,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AAC5C,CAAC","sourcesContent":["import {createRequire} from 'node:module'\nimport type {DebouncedFunc, DebounceSettings} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for\n * storing the result based on the arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with\n * the this binding of the memoized function.\n *\n * @param func - The function to have its output memoized.\n * @param resolver - The function to resolve the cache key.\n * @returns Returns the new memoizing function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function memoize<T extends (...args: any) => any>(func: T, resolver?: (...args: Parameters<T>) => unknown): T {\n const memoize = require('lodash/memoize')\n return memoize(func, resolver)\n}\n\n/**\n * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since\n * the last time the debounced function was invoked. The debounced function comes with a cancel method to\n * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to\n * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent\n * calls to the debounced function return the result of the last func invocation.\n *\n * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only\n * if the the debounced function is invoked more than once during the wait timeout.\n *\n * See David Corbacho’s article for details over the differences between _.debounce and _.throttle.\n *\n * @param func - The function to debounce.\n * @param wait - The number of milliseconds to delay.\n * @param options - The options object.\n * @returns Returns the new debounced function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function debounce<T extends (...args: any) => any>(\n func: T,\n wait?: number,\n options?: DebounceSettings,\n): DebouncedFunc<T> {\n const lodashDebounce = require('lodash/debounce')\n return lodashDebounce(func, wait, options)\n}\n"]}
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/public/common/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAGpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;;GASG;AACH,8DAA8D;AAC9D,MAAM,UAAU,OAAO,CAAkC,IAAO,EAAE,QAA8C;IAC9G,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACzC,OAAO,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,8DAA8D;AAC9D,MAAM,UAAU,QAAQ,CACtB,IAAO,EACP,IAAa,EACb,OAA0B;IAE1B,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACjD,OAAO,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AAC5C,CAAC","sourcesContent":["import {createRequire} from 'module'\nimport type {DebouncedFunc, DebounceSettings} from 'lodash'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for\n * storing the result based on the arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with\n * the this binding of the memoized function.\n *\n * @param func - The function to have its output memoized.\n * @param resolver - The function to resolve the cache key.\n * @returns Returns the new memoizing function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function memoize<T extends (...args: any) => any>(func: T, resolver?: (...args: Parameters<T>) => unknown): T {\n const memoize = require('lodash/memoize')\n return memoize(func, resolver)\n}\n\n/**\n * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since\n * the last time the debounced function was invoked. The debounced function comes with a cancel method to\n * cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to\n * indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent\n * calls to the debounced function return the result of the last func invocation.\n *\n * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only\n * if the the debounced function is invoked more than once during the wait timeout.\n *\n * See David Corbacho’s article for details over the differences between _.debounce and _.throttle.\n *\n * @param func - The function to debounce.\n * @param wait - The number of milliseconds to delay.\n * @param options - The options object.\n * @returns Returns the new debounced function.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function debounce<T extends (...args: any) => any>(\n func: T,\n wait?: number,\n options?: DebounceSettings,\n): DebouncedFunc<T> {\n const lodashDebounce = require('lodash/debounce')\n return lodashDebounce(func, wait, options)\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { createRequire } from 'node:module';
1
+ import { createRequire } from 'module';
2
2
  const require = createRequire(import.meta.url);
3
3
  /**
4
4
  * Performs a deep comparison between two values to determine if they are
@@ -1 +1 @@
1
- {"version":3,"file":"lang.js","sourceRoot":"","sources":["../../../src/public/common/lang.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAEzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc,EAAE,KAAc;IACpD,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC/C,OAAO,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACpC,CAAC","sourcesContent":["import {createRequire} from 'node:module'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are **not** supported.\n *\n * @param value - The value to compare.\n * @param other - The other value to compare.\n * @returns Returns `true` if the values are equivalent, else `false`.\n * @example\n */\nexport function isEqual(value: unknown, other: unknown): boolean {\n const lodashIsEqual = require('lodash/isEqual')\n return lodashIsEqual(value, other)\n}\n"]}
1
+ {"version":3,"file":"lang.js","sourceRoot":"","sources":["../../../src/public/common/lang.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc,EAAE,KAAc;IACpD,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC/C,OAAO,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACpC,CAAC","sourcesContent":["import {createRequire} from 'module'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are **not** supported.\n *\n * @param value - The value to compare.\n * @param other - The other value to compare.\n * @returns Returns `true` if the values are equivalent, else `false`.\n * @example\n */\nexport function isEqual(value: unknown, other: unknown): boolean {\n const lodashIsEqual = require('lodash/isEqual')\n return lodashIsEqual(value, other)\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import deepMerge from 'deepmerge';
2
- import { createRequire } from 'node:module';
2
+ import { createRequire } from 'module';
3
3
  const require = createRequire(import.meta.url);
4
4
  /**
5
5
  * Deep merges the two objects and returns a new object with the merge result.
@@ -1 +1 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/public/common/object.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAA;AAEzC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAgB,EAChB,GAAgB,EAChB,qBAAyF,kBAAkB;IAE3G,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAC,UAAU,EAAE,kBAAkB,EAAC,CAAC,CAAA;AAC9D,CAAC;AAED,SAAS,kBAAkB,CAAC,gBAA2B,EAAE,WAAsB;IAC7E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AACnE,CAAC;AAED;;;;;;;GAOG;AACH,gEAAgE;AAChE,MAAM,UAAU,MAAM,CACpB,MAAwC,EACxC,SAA+B;IAE/B,MAAM,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAChD,OAAO,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CACvB,GAAyB,EACzB,QAAoC;IAEpC,MAAM,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACtD,OAAO,eAAe,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AACvC,CAAC","sourcesContent":["import deepMerge from 'deepmerge'\nimport {Dictionary, ObjectIterator, ValueKeyIteratee} from 'lodash'\nimport {createRequire} from 'node:module'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Deep merges the two objects and returns a new object with the merge result.\n *\n * @param lhs - One of the objects to be merged.\n * @param rhs - Another object to be merged.\n * @param arrayMergeStrategy - Strategy used to merge the array typed fields. Union strategy is used by default to avoid\n * duplicated elements.\n * @returns A Javascrip tobject with th emerged objects.\n */\nexport function deepMergeObjects<T1, T2>(\n lhs: Partial<T1>,\n rhs: Partial<T2>,\n arrayMergeStrategy: (destinationArray: unknown[], sourceArray: unknown[]) => unknown[] = unionArrayStrategy,\n): T1 & T2 {\n return deepMerge(lhs, rhs, {arrayMerge: arrayMergeStrategy})\n}\n\nfunction unionArrayStrategy(destinationArray: unknown[], sourceArray: unknown[]): unknown[] {\n return Array.from(new Set([...destinationArray, ...sourceArray]))\n}\n\n/**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @param object- The source object.\n * @param predicate - The function invoked per property.\n * @returns Returns the new object.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function pickBy<T, S extends T>(\n object: Dictionary<T> | null | undefined,\n predicate?: ValueKeyIteratee<T>,\n): Dictionary<S> {\n const lodashPickBy = require('lodash/pickBy.js')\n return lodashPickBy(object, predicate)\n}\n\n/**\n * Creates an object with the same keys as object and values generated by running each own\n * enumerable property of object through iteratee. The iteratee function is\n * invoked with three arguments: (value, key, object).\n *\n * @param object - The object to iterate over.\n * @param callback - The function invoked per iteration.\n * @returns Returns the new mapped object.\n */\nexport function mapValues<T extends object, TResult>(\n obj: T | null | undefined,\n callback: ObjectIterator<T, TResult>,\n): {[P in keyof T]: TResult} {\n const lodashMapValues = require('lodash/mapValues.js')\n return lodashMapValues(obj, callback)\n}\n"]}
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/public/common/object.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,aAAa,EAAC,MAAM,QAAQ,CAAA;AAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAgB,EAChB,GAAgB,EAChB,qBAAyF,kBAAkB;IAE3G,OAAO,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAC,UAAU,EAAE,kBAAkB,EAAC,CAAC,CAAA;AAC9D,CAAC;AAED,SAAS,kBAAkB,CAAC,gBAA2B,EAAE,WAAsB;IAC7E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;AACnE,CAAC;AAED;;;;;;;GAOG;AACH,gEAAgE;AAChE,MAAM,UAAU,MAAM,CACpB,MAAwC,EACxC,SAA+B;IAE/B,MAAM,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAChD,OAAO,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CACvB,GAAyB,EACzB,QAAoC;IAEpC,MAAM,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACtD,OAAO,eAAe,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AACvC,CAAC","sourcesContent":["import deepMerge from 'deepmerge'\nimport {Dictionary, ObjectIterator, ValueKeyIteratee} from 'lodash'\nimport {createRequire} from 'module'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Deep merges the two objects and returns a new object with the merge result.\n *\n * @param lhs - One of the objects to be merged.\n * @param rhs - Another object to be merged.\n * @param arrayMergeStrategy - Strategy used to merge the array typed fields. Union strategy is used by default to avoid\n * duplicated elements.\n * @returns A Javascrip tobject with th emerged objects.\n */\nexport function deepMergeObjects<T1, T2>(\n lhs: Partial<T1>,\n rhs: Partial<T2>,\n arrayMergeStrategy: (destinationArray: unknown[], sourceArray: unknown[]) => unknown[] = unionArrayStrategy,\n): T1 & T2 {\n return deepMerge(lhs, rhs, {arrayMerge: arrayMergeStrategy})\n}\n\nfunction unionArrayStrategy(destinationArray: unknown[], sourceArray: unknown[]): unknown[] {\n return Array.from(new Set([...destinationArray, ...sourceArray]))\n}\n\n/**\n * Creates an object composed of the `object` properties `predicate` returns\n * truthy for. The predicate is invoked with two arguments: (value, key).\n *\n * @param object- The source object.\n * @param predicate - The function invoked per property.\n * @returns Returns the new object.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function pickBy<T, S extends T>(\n object: Dictionary<T> | null | undefined,\n predicate?: ValueKeyIteratee<T>,\n): Dictionary<S> {\n const lodashPickBy = require('lodash/pickBy.js')\n return lodashPickBy(object, predicate)\n}\n\n/**\n * Creates an object with the same keys as object and values generated by running each own\n * enumerable property of object through iteratee. The iteratee function is\n * invoked with three arguments: (value, key, object).\n *\n * @param object - The object to iterate over.\n * @param callback - The function invoked per iteration.\n * @returns Returns the new mapped object.\n */\nexport function mapValues<T extends object, TResult>(\n obj: T | null | undefined,\n callback: ObjectIterator<T, TResult>,\n): {[P in keyof T]: TResult} {\n const lodashMapValues = require('lodash/mapValues.js')\n return lodashMapValues(obj, callback)\n}\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Check if the format of a URL is valid or not.
3
+ *
4
+ * @param url - URL to be checked.
5
+ * @returns True if the URL is valid, false otherwise.
6
+ */
7
+ export declare const isValidURL: (url: string) => boolean;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Check if the format of a URL is valid or not.
3
+ *
4
+ * @param url - URL to be checked.
5
+ * @returns True if the URL is valid, false otherwise.
6
+ */
7
+ export const isValidURL = (url) => {
8
+ try {
9
+ return Boolean(new URL(url));
10
+ }
11
+ catch (error) {
12
+ if (error instanceof TypeError)
13
+ return false;
14
+ throw error;
15
+ }
16
+ };
17
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/public/common/url.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAW,EAAE;IACjD,IAAI;QACF,OAAO,OAAO,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;KAC7B;IAAC,OAAO,KAAc,EAAE;QACvB,IAAI,KAAK,YAAY,SAAS;YAAE,OAAO,KAAK,CAAA;QAC5C,MAAM,KAAK,CAAA;KACZ;AACH,CAAC,CAAA","sourcesContent":["/**\n * Check if the format of a URL is valid or not.\n *\n * @param url - URL to be checked.\n * @returns True if the URL is valid, false otherwise.\n */\nexport const isValidURL = (url: string): boolean => {\n try {\n return Boolean(new URL(url))\n } catch (error: unknown) {\n if (error instanceof TypeError) return false\n throw error\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { AbortController as NodeAbortController, AbortSignal as NodeAbortControllerSignal } from 'node-abort-controller';
2
+ /**
3
+ * The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired.
4
+ *
5
+ * - MDN Documentation: https://developer.mozilla.org/en-US/docs/Web/API/AbortController
6
+ *
7
+ * This class is necessary because AbortController support was added to Node 15 and the minimum
8
+ * version that we support is Node 14.
9
+ */
10
+ export declare class AbortController extends NodeAbortController {
11
+ }
12
+ /**
13
+ * The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a fetch request) and abort it if required via an AbortController object.
14
+ */
15
+ export declare class AbortSignal extends NodeAbortControllerSignal {
16
+ }
@@ -0,0 +1,17 @@
1
+ import { AbortController as NodeAbortController, AbortSignal as NodeAbortControllerSignal } from 'node-abort-controller';
2
+ /**
3
+ * The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired.
4
+ *
5
+ * - MDN Documentation: https://developer.mozilla.org/en-US/docs/Web/API/AbortController
6
+ *
7
+ * This class is necessary because AbortController support was added to Node 15 and the minimum
8
+ * version that we support is Node 14.
9
+ */
10
+ export class AbortController extends NodeAbortController {
11
+ }
12
+ /**
13
+ * The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a fetch request) and abort it if required via an AbortController object.
14
+ */
15
+ export class AbortSignal extends NodeAbortControllerSignal {
16
+ }
17
+ //# sourceMappingURL=abort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort.js","sourceRoot":"","sources":["../../../src/public/node/abort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,mBAAmB,EAAE,WAAW,IAAI,yBAAyB,EAAC,MAAM,uBAAuB,CAAA;AAEtH;;;;;;;GAOG;AACH,MAAM,OAAO,eAAgB,SAAQ,mBAAmB;CAAG;AAE3D;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,yBAAyB;CAAG","sourcesContent":["import {AbortController as NodeAbortController, AbortSignal as NodeAbortControllerSignal} from 'node-abort-controller'\n\n/**\n * The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired.\n *\n * - MDN Documentation: https://developer.mozilla.org/en-US/docs/Web/API/AbortController\n *\n * This class is necessary because AbortController support was added to Node 15 and the minimum\n * version that we support is Node 14.\n */\nexport class AbortController extends NodeAbortController {}\n\n/**\n * The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a fetch request) and abort it if required via an AbortController object.\n */\nexport class AbortSignal extends NodeAbortControllerSignal {}\n"]}
@@ -0,0 +1,13 @@
1
+ import { Interfaces } from '@oclif/core';
2
+ interface ReportAnalyticsEventOptions {
3
+ config: Interfaces.Config;
4
+ errorMessage?: string;
5
+ }
6
+ /**
7
+ * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.
8
+ *
9
+ * The payload for an event includes both generic data, and data gathered from installed plug-ins.
10
+ *
11
+ */
12
+ export declare function reportAnalyticsEvent(options: ReportAnalyticsEventOptions): Promise<void>;
13
+ export {};
@@ -0,0 +1,82 @@
1
+ import { version as rubyVersion } from './ruby.js';
2
+ import * as environment from '../../environment.js';
3
+ import { content, debug, token } from '../../output.js';
4
+ import constants from '../../constants.js';
5
+ import * as metadata from '../../metadata.js';
6
+ import { publishEvent, MONORAIL_COMMAND_TOPIC } from '../../monorail.js';
7
+ import { fanoutHooks } from '../../plugins.js';
8
+ import { getEnvironmentData, getSensitiveEnvironmentData } from '../../private/node/analytics.js';
9
+ /**
10
+ * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.
11
+ *
12
+ * The payload for an event includes both generic data, and data gathered from installed plug-ins.
13
+ *
14
+ */
15
+ export async function reportAnalyticsEvent(options) {
16
+ try {
17
+ const payload = await buildPayload(options);
18
+ if (payload === undefined) {
19
+ // Nothing to log
20
+ return;
21
+ }
22
+ if (!environment.local.alwaysLogAnalytics() && environment.local.analyticsDisabled()) {
23
+ debug(content `Skipping command analytics, payload: ${token.json(payload)}`);
24
+ return;
25
+ }
26
+ const response = await publishEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive);
27
+ if (response.type === 'error') {
28
+ debug(response.message);
29
+ }
30
+ // eslint-disable-next-line no-catch-all/no-catch-all
31
+ }
32
+ catch (error) {
33
+ let message = 'Failed to report usage analytics';
34
+ if (error instanceof Error) {
35
+ message = message.concat(`: ${error.message}`);
36
+ }
37
+ debug(message);
38
+ }
39
+ }
40
+ async function buildPayload({ config, errorMessage }) {
41
+ const { commandStartOptions, ...sensitiveMetadata } = metadata.getAllSensitive();
42
+ if (commandStartOptions === undefined) {
43
+ debug('Unable to log analytics event - no information on executed command');
44
+ return;
45
+ }
46
+ const { startCommand, startArgs, startTime } = commandStartOptions;
47
+ const currentTime = new Date().getTime();
48
+ const { '@shopify/app': appPublic, ...otherPluginsPublic } = await fanoutHooks(config, 'public_command_metadata', {});
49
+ const { '@shopify/app': appSensitive, ...otherPluginsSensitive } = await fanoutHooks(config, 'sensitive_command_metadata', {});
50
+ const environmentData = await getEnvironmentData(config);
51
+ const sensitiveEnvironmentData = await getSensitiveEnvironmentData(config);
52
+ return {
53
+ public: {
54
+ command: startCommand,
55
+ time_start: startTime,
56
+ time_end: currentTime,
57
+ total_time: currentTime - startTime,
58
+ success: errorMessage === undefined,
59
+ cli_version: await constants.versions.cliKit(),
60
+ ruby_version: (await rubyVersion()) || '',
61
+ node_version: process.version.replace('v', ''),
62
+ is_employee: await environment.local.isShopify(),
63
+ ...environmentData,
64
+ ...appPublic,
65
+ ...metadata.getAllPublic(),
66
+ },
67
+ sensitive: {
68
+ args: startArgs.join(' '),
69
+ error_message: errorMessage,
70
+ ...appSensitive,
71
+ ...sensitiveEnvironmentData,
72
+ metadata: JSON.stringify({
73
+ ...sensitiveMetadata,
74
+ extraPublic: {
75
+ ...otherPluginsPublic,
76
+ },
77
+ extraSensitive: { ...otherPluginsSensitive },
78
+ }),
79
+ },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AS,CAAC,QAAQ,CAAC,MAAM,EAAE;YAC9C,YAAY,EAAE,CAAC,MAAM,WAAW,EAAE,CAAC,IAAI,EAAE;YACzC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;YAC9C,WAAW,EAAE,MAAM,WAAW,CAAC,KAAK,CAAC,SAAS,EAAE;YAChD,GAAG,eAAe;YAClB,GAAG,SAAS;YACZ,GAAG,QAAQ,CAAC,YAAY,EAAE;SAC3B;QACD,SAAS,EAAE;YACT,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;YACzB,aAAa,EAAE,YAAY;YAC3B,GAAG,YAAY;YACf,GAAG,wBAAwB;YAC3B,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC;gBACvB,GAAG,iBAAiB;gBACpB,WAAW,EAAE;oBACX,GAAG,kBAAkB;iBACtB;gBACD,cAAc,EAAE,EAAC,GAAG,qBAAqB,EAAC;aAC3C,CAAC;SACH;KACF,CAAA;AACH,CAAC","sourcesContent":["import {version as rubyVersion} from './ruby.js'\nimport * as environment from '../../environment.js'\nimport {content, debug, token} from '../../output.js'\nimport constants from '../../constants.js'\nimport * as metadata from '../../metadata.js'\nimport {publishEvent, MONORAIL_COMMAND_TOPIC} from '../../monorail.js'\nimport {fanoutHooks} from '../../plugins.js'\nimport {getEnvironmentData, getSensitiveEnvironmentData} from '../../private/node/analytics.js'\nimport {Interfaces} from '@oclif/core'\n\ninterface ReportAnalyticsEventOptions {\n config: Interfaces.Config\n errorMessage?: string\n}\n\n/**\n * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.\n *\n * The payload for an event includes both generic data, and data gathered from installed plug-ins.\n *\n */\nexport async function reportAnalyticsEvent(options: ReportAnalyticsEventOptions): Promise<void> {\n try {\n const payload = await buildPayload(options)\n if (payload === undefined) {\n // Nothing to log\n return\n }\n if (!environment.local.alwaysLogAnalytics() && environment.local.analyticsDisabled()) {\n debug(content`Skipping command analytics, payload: ${token.json(payload)}`)\n return\n }\n const response = await publishEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive)\n if (response.type === 'error') {\n debug(response.message)\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n let message = 'Failed to report usage analytics'\n if (error instanceof Error) {\n message = message.concat(`: ${error.message}`)\n }\n debug(message)\n }\n}\n\nasync function buildPayload({config, errorMessage}: ReportAnalyticsEventOptions) {\n const {commandStartOptions, ...sensitiveMetadata} = metadata.getAllSensitive()\n if (commandStartOptions === undefined) {\n debug('Unable to log analytics event - no information on executed command')\n return\n }\n const {startCommand, startArgs, startTime} = commandStartOptions\n const currentTime = new Date().getTime()\n\n const {'@shopify/app': appPublic, ...otherPluginsPublic} = await fanoutHooks(config, 'public_command_metadata', {})\n const {'@shopify/app': appSensitive, ...otherPluginsSensitive} = await fanoutHooks(\n config,\n 'sensitive_command_metadata',\n {},\n )\n\n const environmentData = await getEnvironmentData(config)\n const sensitiveEnvironmentData = await getSensitiveEnvironmentData(config)\n\n return {\n public: {\n command: startCommand,\n time_start: startTime,\n time_end: currentTime,\n total_time: currentTime - startTime,\n success: errorMessage === undefined,\n cli_version: await constants.versions.cliKit(),\n ruby_version: (await rubyVersion()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await environment.local.isShopify(),\n ...environmentData,\n ...appPublic,\n ...metadata.getAllPublic(),\n },\n sensitive: {\n args: startArgs.join(' '),\n error_message: errorMessage,\n ...appSensitive,\n ...sensitiveEnvironmentData,\n metadata: JSON.stringify({\n ...sensitiveMetadata,\n extraPublic: {\n ...otherPluginsPublic,\n },\n extraSensitive: {...otherPluginsSensitive},\n }),\n },\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { debug, content, token } from '../../output.js';
2
2
  import { glob, relative as relativePath } from '../../path.js';
3
3
  import archiver from 'archiver';
4
- import { createWriteStream } from 'node:fs';
4
+ import { createWriteStream } from 'fs';
5
5
  /**
6
6
  * It zips a directory normalizing the paths to be forward-slash. Note that unzipping
7
7
  * the zip generated by this function from a Windows environment won't work because paths
@@ -1 +1 @@
1
- {"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../../src/public/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAC,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAC,MAAM,eAAe,CAAA;AAC5D,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AACzC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,cAAsB,EAAE,aAAqB;IACrE,KAAK,CAAC,OAAO,CAAA,WAAW,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IACvF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,EAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAC,CAAC,CAAA;IACnH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC/B,MAAM,MAAM,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAA;QAE/C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE;YACjB,OAAO,EAAE,CAAA;QACX,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK;YACjC,MAAM,CAAC,KAAK,CAAC,CAAA;QACf,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;YACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;YAC/D,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC,CAAA;SACjD;QAED,mEAAmE;QACnE,OAAO,CAAC,QAAQ,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {debug, content, token} from '../../output.js'\nimport {glob, relative as relativePath} from '../../path.js'\nimport archiver from 'archiver'\nimport {createWriteStream} from 'node:fs'\n/**\n * It zips a directory normalizing the paths to be forward-slash. Note that unzipping\n * the zip generated by this function from a Windows environment won't work because paths\n * need to be made backward-slash.\n *\n * @param inputDirectory - The absolute path to the directory to be zipped.\n * @param outputZipPath - The absolute path to the output zip file.\n */\nexport async function zip(inputDirectory: string, outputZipPath: string): Promise<void> {\n debug(content`Zipping ${token.path(inputDirectory)} into ${token.path(outputZipPath)}`)\n const pathsToZip = await glob('**/*', {cwd: inputDirectory, absolute: true, dot: true, followSymbolicLinks: false})\n return new Promise((resolve, reject) => {\n const archive = archiver('zip')\n const output = createWriteStream(outputZipPath)\n\n output.on('close', function () {\n resolve()\n })\n archive.on('error', function (error) {\n reject(error)\n })\n archive.pipe(output)\n\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive.finalize()\n })\n}\n"]}
1
+ {"version":3,"file":"archiver.js","sourceRoot":"","sources":["../../../src/public/node/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAC,IAAI,EAAE,QAAQ,IAAI,YAAY,EAAC,MAAM,eAAe,CAAA;AAC5D,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,iBAAiB,EAAC,MAAM,IAAI,CAAA;AACpC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,cAAsB,EAAE,aAAqB;IACrE,KAAK,CAAC,OAAO,CAAA,WAAW,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IACvF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,EAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAC,CAAC,CAAA;IACnH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC/B,MAAM,MAAM,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAA;QAE/C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE;YACjB,OAAO,EAAE,CAAA;QACX,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK;YACjC,MAAM,CAAC,KAAK,CAAC,CAAA;QACf,CAAC,CAAC,CAAA;QACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;YACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;YAC/D,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC,CAAA;SACjD;QAED,mEAAmE;QACnE,OAAO,CAAC,QAAQ,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {debug, content, token} from '../../output.js'\nimport {glob, relative as relativePath} from '../../path.js'\nimport archiver from 'archiver'\nimport {createWriteStream} from 'fs'\n/**\n * It zips a directory normalizing the paths to be forward-slash. Note that unzipping\n * the zip generated by this function from a Windows environment won't work because paths\n * need to be made backward-slash.\n *\n * @param inputDirectory - The absolute path to the directory to be zipped.\n * @param outputZipPath - The absolute path to the output zip file.\n */\nexport async function zip(inputDirectory: string, outputZipPath: string): Promise<void> {\n debug(content`Zipping ${token.path(inputDirectory)} into ${token.path(outputZipPath)}`)\n const pathsToZip = await glob('**/*', {cwd: inputDirectory, absolute: true, dot: true, followSymbolicLinks: false})\n return new Promise((resolve, reject) => {\n const archive = archiver('zip')\n const output = createWriteStream(outputZipPath)\n\n output.on('close', function () {\n resolve()\n })\n archive.on('error', function (error) {\n reject(error)\n })\n archive.pipe(output)\n\n for (const filePath of pathsToZip) {\n const fileRelativePath = relativePath(inputDirectory, filePath)\n archive.file(filePath, {name: fileRelativePath})\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n archive.finalize()\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../../src/public/node/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,2CAA2C,EAAC,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAC,wBAAwB,EAAC,MAAM,cAAc,CAAA;AAErD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,gCAAgC,CAAA;AACvD,OAAO,EAAC,OAAO,EAAa,MAAM,aAAa,CAAA;AAO/C,MAAe,WAAY,SAAQ,OAAO;IACjC,MAAM,CAAC,qBAAqB;QACjC,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CAAC,CAAA;aAClE;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;aACpC;SACF;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,eAAe,WAAW,CAAA","sourcesContent":["import {errorHandler, registerCleanBugsnagErrorsFromWithinPlugins} from './error-handler.js'\nimport {loadPresetsFromDirectory} from './presets.js'\nimport {JsonMap} from '../../json.js'\nimport {isDevelopment} from '../../environment/local.js'\nimport {Abort} from '../../error.js'\nimport {addPublic} from '../../metadata.js'\nimport {content, info, token} from '../../output.js'\nimport {hashString} from '../../string.js'\nimport {isTruthy} from '../../environment/utilities.js'\nimport {Command, Interfaces} from '@oclif/core'\n\ninterface PresettableFlags {\n preset?: string\n path?: string\n}\n\nabstract class BaseCommand extends Command {\n public static analyticsNameOverride(): string | undefined {\n return undefined\n }\n\n async catch(error: Error & {exitCode?: number | undefined}): Promise<void> {\n await errorHandler(error, this.config)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected async init(): Promise<any> {\n this.exitWithTimestampWhenEnvVariablePresent()\n if (!isDevelopment()) {\n // This function runs just prior to `run`\n await registerCleanBugsnagErrorsFromWithinPlugins(this.config)\n }\n return super.init()\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n protected exitWithTimestampWhenEnvVariablePresent() {\n if (isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN)) {\n info(`\n SHOPIFY_CLI_TIMESTAMP_START\n { \"timestamp\": ${Date.now()} }\n SHOPIFY_CLI_TIMESTAMP_END\n `)\n process.exit(0)\n }\n }\n\n protected async parse<\n TFlags extends Interfaces.FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n >(\n options?: Interfaces.Input<TFlags, TGlobalFlags>,\n argv?: string[],\n ): Promise<Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n let result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, argv)\n result = await this.resultWithPreset<TFlags, TGlobalFlags, TArgs>(result, options, argv)\n await addFromParsedFlags(result.flags)\n return result\n }\n\n protected async resultWithPreset<\n TFlags extends Interfaces.FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n >(\n originalResult: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>,\n options?: Interfaces.Input<TFlags, TGlobalFlags>,\n argv?: string[],\n ): Promise<Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n // If no preset is specified, don't modify the results\n const flags = originalResult.flags as PresettableFlags\n if (!flags.preset) return originalResult\n\n // If the specified preset isn't found, don't modify the results\n const presets = await loadPresetsFromDirectory(await this.presetsPath(flags), {findUp: this.findUpForPresets()})\n const preset = presets[flags.preset]\n if (!preset) return originalResult\n\n // Parse using noDefaultsOptions to derive a list of flags specified as\n // command-line arguments.\n const noDefaultsResult = await super.parse<TFlags, TGlobalFlags, TArgs>(noDefaultsOptions(options), argv)\n\n // Add the preset's settings to argv and pass them to `super.parse`. This\n // invokes oclif's validation system without breaking the oclif black box.\n // Replace the original result with this one.\n const result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, [\n // Need to specify argv default because we're merging with argsFromPreset.\n ...(argv || this.argv),\n ...argsFromPreset<TFlags, TGlobalFlags, TArgs>(preset, options, noDefaultsResult),\n ])\n\n // Report successful application of the preset.\n reportPresetApplication<TFlags, TGlobalFlags, TArgs>(noDefaultsResult.flags, result.flags, flags.preset, preset)\n\n return result\n }\n\n protected async presetsPath(rawFlags: {path?: string}): Promise<string> {\n return rawFlags.path || process.cwd()\n }\n\n protected findUpForPresets(): boolean {\n return true\n }\n}\n\nexport async function addFromParsedFlags(flags: {path?: string; verbose?: boolean}): Promise<void> {\n await addPublic(() => ({\n cmd_all_verbose: flags.verbose,\n cmd_all_path_override: flags.path !== undefined,\n cmd_all_path_override_hash: flags.path === undefined ? undefined : hashString(flags.path),\n }))\n}\n\n/**\n * Any flag which is:\n *\n * 1. Present in the final set of flags\n * 2. Specified in the preset\n * 3. Not specified by the user as a command line argument\n *\n * should be reported.\n *\n * It doesn't matter if the preset flag's value was the same as the default; from\n * the user's perspective, they want to know their preset was applied.\n */\nfunction reportPresetApplication<\n TFlags extends Interfaces.FlagOutput,\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n>(\n noDefaultsFlags: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n flagsWithPresets: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n presetName: string,\n preset: JsonMap,\n): void {\n const changes: JsonMap = {}\n for (const [name, value] of Object.entries(flagsWithPresets)) {\n const userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name)\n const presetContainsFlag = Object.prototype.hasOwnProperty.call(preset, name)\n if (!userSpecifiedThisFlag && presetContainsFlag) changes[name] = value\n }\n if (Object.keys(changes).length === 0) return\n info(content`Using applicable flags from the preset ${token.yellow(presetName)}:\n\n${Object.entries(changes)\n .map(([name, value]) => `• ${name} = ${value}`)\n .join('\\n')}\\n`)\n}\n\n/**\n * Strips the defaults from configured flags. For example, if flags contains:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag',\n * default: false\n * })\n * ```\n *\n * it becomes:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag'\n * })\n * ```\n *\n * If we parse using this configuration, the only specified flags will be those\n * the user actually passed on the command line.\n */\n\nfunction noDefaultsOptions<TFlags extends Interfaces.FlagOutput, TGlobalFlags extends Interfaces.FlagOutput>(\n options: Interfaces.Input<TFlags, TGlobalFlags> | undefined,\n): Interfaces.Input<TFlags, TGlobalFlags> | undefined {\n if (!options?.flags) return options\n return {\n ...options,\n flags: Object.fromEntries(\n Object.entries(options.flags).map(([label, settings]) => {\n const copiedSettings = {...(settings as {default?: unknown})}\n delete copiedSettings.default\n return [label, copiedSettings]\n }),\n ) as Interfaces.FlagInput<TFlags>,\n }\n}\n\n/**\n * Converts the preset's settings to arguments as though passed on the command\n * line, skipping any arguments the user specified on the command line.\n */\nfunction argsFromPreset<\n TFlags extends Interfaces.FlagOutput,\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n>(\n preset: JsonMap,\n options: Interfaces.Input<TFlags, TGlobalFlags> | undefined,\n noDefaultsResult: Interfaces.ParserOutput<TFlags, TArgs>,\n): string[] {\n const args: string[] = []\n for (const [label, value] of Object.entries(preset)) {\n const flagIsRelevantToCommand = options?.flags && Object.prototype.hasOwnProperty.call(options.flags, label)\n const userSpecifiedThisFlag =\n noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label)\n if (flagIsRelevantToCommand && !userSpecifiedThisFlag) {\n if (typeof value === 'boolean') {\n if (value === true) {\n args.push(`--${label}`)\n } else {\n throw new Abort(\n content`Presets can only specify true for boolean flags. Attempted to set ${token.yellow(label)} to false.`,\n )\n }\n } else if (Array.isArray(value)) {\n value.forEach((element) => args.push(`--${label}`, `${element}`))\n } else {\n args.push(`--${label}`, `${value}`)\n }\n }\n }\n return args\n}\n\nexport default BaseCommand\n"]}
1
+ {"version":3,"file":"base-command.js","sourceRoot":"","sources":["../../../src/public/node/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,2CAA2C,EAAC,MAAM,oBAAoB,CAAA;AAC5F,OAAO,EAAC,wBAAwB,EAAC,MAAM,cAAc,CAAA;AAErD,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAA;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Y,CAC5G,CAAA;iBACF;aACF;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBAC/B,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAA;aAClE;iBAAM;gBACL,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;aACpC;SACF;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,eAAe,WAAW,CAAA","sourcesContent":["import {errorHandler, registerCleanBugsnagErrorsFromWithinPlugins} from './error-handler.js'\nimport {loadPresetsFromDirectory} from './presets.js'\nimport {JsonMap} from '../../private/common/json.js'\nimport {isDevelopment} from '../../environment/local.js'\nimport {Abort} from '../../error.js'\nimport {addPublic} from '../../metadata.js'\nimport {content, info, token} from '../../output.js'\nimport {hashString} from '../../string.js'\nimport {isTruthy} from '../../environment/utilities.js'\nimport {Command, Interfaces} from '@oclif/core'\n\ninterface PresettableFlags {\n preset?: string\n path?: string\n}\n\nabstract class BaseCommand extends Command {\n public static analyticsNameOverride(): string | undefined {\n return undefined\n }\n\n async catch(error: Error & {exitCode?: number | undefined}): Promise<void> {\n await errorHandler(error, this.config)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n protected async init(): Promise<any> {\n this.exitWithTimestampWhenEnvVariablePresent()\n if (!isDevelopment()) {\n // This function runs just prior to `run`\n await registerCleanBugsnagErrorsFromWithinPlugins(this.config)\n }\n return super.init()\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n protected exitWithTimestampWhenEnvVariablePresent() {\n if (isTruthy(process.env.SHOPIFY_CLI_ENV_STARTUP_PERFORMANCE_RUN)) {\n info(`\n SHOPIFY_CLI_TIMESTAMP_START\n { \"timestamp\": ${Date.now()} }\n SHOPIFY_CLI_TIMESTAMP_END\n `)\n process.exit(0)\n }\n }\n\n protected async parse<\n TFlags extends Interfaces.FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n >(\n options?: Interfaces.Input<TFlags, TGlobalFlags>,\n argv?: string[],\n ): Promise<Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n let result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, argv)\n result = await this.resultWithPreset<TFlags, TGlobalFlags, TArgs>(result, options, argv)\n await addFromParsedFlags(result.flags)\n return result\n }\n\n protected async resultWithPreset<\n TFlags extends Interfaces.FlagOutput & {path?: string; verbose?: boolean},\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n >(\n originalResult: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>,\n options?: Interfaces.Input<TFlags, TGlobalFlags>,\n argv?: string[],\n ): Promise<Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>> {\n // If no preset is specified, don't modify the results\n const flags = originalResult.flags as PresettableFlags\n if (!flags.preset) return originalResult\n\n // If the specified preset isn't found, don't modify the results\n const presets = await loadPresetsFromDirectory(await this.presetsPath(flags), {findUp: this.findUpForPresets()})\n const preset = presets[flags.preset]\n if (!preset) return originalResult\n\n // Parse using noDefaultsOptions to derive a list of flags specified as\n // command-line arguments.\n const noDefaultsResult = await super.parse<TFlags, TGlobalFlags, TArgs>(noDefaultsOptions(options), argv)\n\n // Add the preset's settings to argv and pass them to `super.parse`. This\n // invokes oclif's validation system without breaking the oclif black box.\n // Replace the original result with this one.\n const result = await super.parse<TFlags, TGlobalFlags, TArgs>(options, [\n // Need to specify argv default because we're merging with argsFromPreset.\n ...(argv || this.argv),\n ...argsFromPreset<TFlags, TGlobalFlags, TArgs>(preset, options, noDefaultsResult),\n ])\n\n // Report successful application of the preset.\n reportPresetApplication<TFlags, TGlobalFlags, TArgs>(noDefaultsResult.flags, result.flags, flags.preset, preset)\n\n return result\n }\n\n protected async presetsPath(rawFlags: {path?: string}): Promise<string> {\n return rawFlags.path || process.cwd()\n }\n\n protected findUpForPresets(): boolean {\n return true\n }\n}\n\nexport async function addFromParsedFlags(flags: {path?: string; verbose?: boolean}): Promise<void> {\n await addPublic(() => ({\n cmd_all_verbose: flags.verbose,\n cmd_all_path_override: flags.path !== undefined,\n cmd_all_path_override_hash: flags.path === undefined ? undefined : hashString(flags.path),\n }))\n}\n\n/**\n * Any flag which is:\n *\n * 1. Present in the final set of flags\n * 2. Specified in the preset\n * 3. Not specified by the user as a command line argument\n *\n * should be reported.\n *\n * It doesn't matter if the preset flag's value was the same as the default; from\n * the user's perspective, they want to know their preset was applied.\n */\nfunction reportPresetApplication<\n TFlags extends Interfaces.FlagOutput,\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n>(\n noDefaultsFlags: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n flagsWithPresets: Interfaces.ParserOutput<TFlags, TGlobalFlags, TArgs>['flags'],\n presetName: string,\n preset: JsonMap,\n): void {\n const changes: JsonMap = {}\n for (const [name, value] of Object.entries(flagsWithPresets)) {\n const userSpecifiedThisFlag = Object.prototype.hasOwnProperty.call(noDefaultsFlags, name)\n const presetContainsFlag = Object.prototype.hasOwnProperty.call(preset, name)\n if (!userSpecifiedThisFlag && presetContainsFlag) changes[name] = value\n }\n if (Object.keys(changes).length === 0) return\n info(content`Using applicable flags from the preset ${token.yellow(presetName)}:\n\n${Object.entries(changes)\n .map(([name, value]) => `• ${name} = ${value}`)\n .join('\\n')}\\n`)\n}\n\n/**\n * Strips the defaults from configured flags. For example, if flags contains:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag',\n * default: false\n * })\n * ```\n *\n * it becomes:\n *\n * ```\n * someFlag: Flags.boolean({\n * description: 'some flag'\n * })\n * ```\n *\n * If we parse using this configuration, the only specified flags will be those\n * the user actually passed on the command line.\n */\n\nfunction noDefaultsOptions<TFlags extends Interfaces.FlagOutput, TGlobalFlags extends Interfaces.FlagOutput>(\n options: Interfaces.Input<TFlags, TGlobalFlags> | undefined,\n): Interfaces.Input<TFlags, TGlobalFlags> | undefined {\n if (!options?.flags) return options\n return {\n ...options,\n flags: Object.fromEntries(\n Object.entries(options.flags).map(([label, settings]) => {\n const copiedSettings = {...(settings as {default?: unknown})}\n delete copiedSettings.default\n return [label, copiedSettings]\n }),\n ) as Interfaces.FlagInput<TFlags>,\n }\n}\n\n/**\n * Converts the preset's settings to arguments as though passed on the command\n * line, skipping any arguments the user specified on the command line.\n */\nfunction argsFromPreset<\n TFlags extends Interfaces.FlagOutput,\n TGlobalFlags extends Interfaces.FlagOutput,\n TArgs extends Interfaces.OutputArgs,\n>(\n preset: JsonMap,\n options: Interfaces.Input<TFlags, TGlobalFlags> | undefined,\n noDefaultsResult: Interfaces.ParserOutput<TFlags, TArgs>,\n): string[] {\n const args: string[] = []\n for (const [label, value] of Object.entries(preset)) {\n const flagIsRelevantToCommand = options?.flags && Object.prototype.hasOwnProperty.call(options.flags, label)\n const userSpecifiedThisFlag =\n noDefaultsResult.flags && Object.prototype.hasOwnProperty.call(noDefaultsResult.flags, label)\n if (flagIsRelevantToCommand && !userSpecifiedThisFlag) {\n if (typeof value === 'boolean') {\n if (value === true) {\n args.push(`--${label}`)\n } else {\n throw new Abort(\n content`Presets can only specify true for boolean flags. Attempted to set ${token.yellow(label)} to false.`,\n )\n }\n } else if (Array.isArray(value)) {\n value.forEach((element) => args.push(`--${label}`, `${element}`))\n } else {\n args.push(`--${label}`, `${value}`)\n }\n }\n }\n return args\n}\n\nexport default BaseCommand\n"]}
@@ -1,6 +1,7 @@
1
+ import { reportAnalyticsEvent } from './analytics.js';
2
+ import { getEnvironmentData } from '../../private/node/analytics.js';
1
3
  import { AbortSilent, CancelExecution, mapper as errorMapper, shouldReport as shouldReportError, handler, cleanSingleStackTracePath, } from '../../error.js';
2
4
  import { debug, info } from '../../output.js';
3
- import { getEnvironmentData, reportEvent } from '../../analytics.js';
4
5
  import * as path from '../../path.js';
5
6
  import * as metadata from '../../metadata.js';
6
7
  import { fanoutHooks } from '../../plugins.js';
@@ -32,7 +33,7 @@ export function errorHandler(error, config) {
32
33
  const reportError = async (error, config) => {
33
34
  if (config !== undefined) {
34
35
  // Log an analytics event when there's an error
35
- await reportEvent({ config, errorMessage: error instanceof Error ? error.message : undefined });
36
+ await reportAnalyticsEvent({ config, errorMessage: error instanceof Error ? error.message : undefined });
36
37
  }
37
38
  await sendErrorToBugsnag(error);
38
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/public/node/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,MAAM,IAAI,WAAW,EACrB,YAAY,IAAI,iBAAiB,EACjC,OAAO,EACP,yBAAyB,GAC1B,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAA;AAClE,OAAO,KAAK,IAAI,MAAM,eAAe,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAC5C,OAAO,SAAS,EAAE,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAC,QAAQ,EAAa,MAAM,aAAa,CAAA;AAChD,OAAO,WAAW,MAAM,aAAa,CAAA;AACrC,OAAO,OAAgB,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAA;AAOpC,MAAM,UAAU,YAAY,CAAC,KAA8C,EAAE,MAA0B;IACrG,IAAI,KAAK,YAAY,eAAe,EAAE;QACpC,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,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AW;QACpB,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,QAAQ;KACf,CAAA;IACD,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE;QAC5D,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,KAAK,UAAU,iBAAiB;IAC9B,IAAI,OAAO,CAAC,SAAS,EAAE,EAAE;QACvB,OAAM;KACP;IACD,OAAO,CAAC,KAAK,CAAC;QACZ,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,MAAM,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE;QAC7C,iBAAiB,EAAE,KAAK;QACxB,gBAAgB,EAAE,KAAK;KACxB,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n AbortSilent,\n CancelExecution,\n mapper as errorMapper,\n shouldReport as shouldReportError,\n handler,\n cleanSingleStackTracePath,\n} from '../../error.js'\nimport {debug, info} from '../../output.js'\nimport {getEnvironmentData, reportEvent} from '../../analytics.js'\nimport * as path from '../../path.js'\nimport * as metadata from '../../metadata.js'\nimport {fanoutHooks} from '../../plugins.js'\nimport constants, {bugsnagApiKey} from '../../constants.js'\nimport {settings, Interfaces} from '@oclif/core'\nimport StackTracey from 'stacktracey'\nimport Bugsnag, {Event} from '@bugsnag/js'\nimport {realpath} from 'fs/promises'\n\nexport function errorHandler(\n error: (CancelExecution | AbortSilent) & {exitCode?: number | undefined},\n config?: Interfaces.Config,\n): void\nexport function errorHandler(error: Error & {exitCode?: number | undefined}, config?: Interfaces.Config): Promise<void>\nexport function errorHandler(error: Error & {exitCode?: number | undefined}, config?: Interfaces.Config): unknown {\n if (error instanceof CancelExecution) {\n if (error.message && error.message !== '') {\n info(`✨ ${error.message}`)\n }\n } else if (error instanceof AbortSilent) {\n process.exit(1)\n } else {\n return errorMapper(error)\n .then((error) => {\n return handler(error)\n })\n .then((mappedError) => reportError(mappedError, config))\n .then(() => {\n process.exit(1)\n })\n }\n}\n\nconst reportError = async (error: unknown, config?: Interfaces.Config): Promise<void> => {\n if (config !== undefined) {\n // Log an analytics event when there's an error\n await reportEvent({config, errorMessage: error instanceof Error ? error.message : undefined})\n }\n await sendErrorToBugsnag(error)\n}\n\n/**\n * Sends an error to Bugsnag. This is configured automatically for uncaught errors from CLI commands, but can also be used to manually record an error.\n *\n * @returns the reported error (this may have been tweaked for better reporting), and a bool to indicate if the error was actually submitted or not\n */\nexport async function sendErrorToBugsnag(\n error: unknown,\n): Promise<{reported: false; error: unknown} | {error: Error; reported: true}> {\n if (settings.debug || !shouldReportError(error)) return {reported: false, error}\n\n let reportableError: Error\n let stacktrace: string | undefined\n let report = false\n\n if (error instanceof Error) {\n report = true\n reportableError = new Error(error.message)\n stacktrace = error.stack\n\n /**\n * Some errors that reach this point have an empty string. For example:\n * https://app.bugsnag.com/shopify/cli/errors/62cd5d31fd5040000814086c?filters[event.since]=30d&filters[error.status]=new&filters[release.seen_in]=3.1.0\n *\n * Because at this point we have neither the error message nor a stack trace reporting them\n * to Bugsnag is pointless and adds noise.\n */\n } else if (typeof error === 'string' && error.trim().length !== 0) {\n report = true\n reportableError = new Error(error)\n stacktrace = reportableError.stack\n } else {\n report = false\n reportableError = new Error('Unknown error')\n }\n\n const formattedStacktrace = new StackTracey(stacktrace ?? '')\n .clean()\n .items.map((item) => {\n const filePath = cleanSingleStackTracePath(item.file)\n return ` at ${item.callee} (${filePath}:${item.line}:${item.column})`\n })\n .join('\\n')\n reportableError.stack = `Error: ${reportableError.message}\\n${formattedStacktrace}`\n\n if (report) {\n await initializeBugsnag()\n await new Promise((resolve, reject) => {\n Bugsnag.notify(reportableError, undefined, (error, event) => {\n if (error) {\n reject(error)\n } else {\n resolve(reportableError)\n }\n })\n })\n }\n return {error: reportableError, reported: report}\n}\n\n/**\n * If the given file path is within a node_modules folder, remove prefix up\n * to and including the node_modules folder.\n *\n * This gives us very consistent paths for errors generated by the CLI.\n */\nexport function cleanStackFrameFilePath({\n currentFilePath,\n projectRoot,\n pluginLocations,\n}: {\n currentFilePath: string\n projectRoot: string\n pluginLocations: {name: string; pluginPath: string}[]\n}): string {\n const fullLocation = path.isAbsolute(currentFilePath) ? currentFilePath : path.join(projectRoot, currentFilePath)\n\n const matchingPluginPath = pluginLocations.filter(({pluginPath}) => fullLocation.indexOf(pluginPath) === 0)[0]\n\n if (matchingPluginPath !== undefined) {\n // the plugin name (e.g. @shopify/cli-kit), plus the relative path of the error line from within the plugin's code (e.g. dist/something.js )\n return path.join(matchingPluginPath.name, path.relative(matchingPluginPath.pluginPath, fullLocation))\n }\n\n // strip prefix up to node_modules folder, so we can normalize error reporting\n return currentFilePath.replace(/.*node_modules\\//, '')\n}\n\n/**\n * Register a Bugsnag error listener to clean up stack traces for errors within plugin code.\n *\n */\nexport async function registerCleanBugsnagErrorsFromWithinPlugins(config: Interfaces.Config): Promise<void> {\n // Bugsnag have their own plug-ins that use this private field\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const bugsnagConfigProjectRoot: string = (Bugsnag as any)?._client?._config?.projectRoot ?? process.cwd()\n const projectRoot = path.normalize(bugsnagConfigProjectRoot)\n const pluginLocations = await Promise.all(\n config.plugins.map(async (plugin) => {\n const followSymlinks = await realpath(plugin.root)\n return {name: plugin.name, pluginPath: path.normalize(followSymlinks)}\n }),\n )\n await initializeBugsnag()\n Bugsnag.addOnError(async (event) => {\n event.errors.forEach((error) => {\n error.stacktrace.forEach((stackFrame) => {\n stackFrame.file = cleanStackFrameFilePath({currentFilePath: stackFrame.file, projectRoot, pluginLocations})\n })\n })\n try {\n await addBugsnagMetadata(event, config)\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (metadataError) {\n debug(`There was an error adding metadata to the Bugsnag report; Ignoring and carrying on ${metadataError}`)\n }\n })\n}\n\nexport async function addBugsnagMetadata(event: Event, config: Interfaces.Config): Promise<void> {\n const publicData = metadata.getAllPublic()\n const {commandStartOptions} = metadata.getAllSensitive()\n const {startCommand} = commandStartOptions ?? {}\n\n const {'@shopify/app': appPublic, ...otherPluginsPublic} = await fanoutHooks(config, 'public_command_metadata', {})\n\n const environment = await getEnvironmentData(config)\n\n const allMetadata = {\n command: startCommand,\n ...appPublic,\n ...publicData,\n ...environment,\n pluginData: otherPluginsPublic,\n }\n\n const appData = {} as {[key: string]: unknown}\n const commandData = {} as {[key: string]: unknown}\n const environmentData = {} as {[key: string]: unknown}\n const miscData = {} as {[key: string]: unknown}\n const appKeys = ['api_key', 'partner_id', 'project_type']\n const commandKeys = ['command']\n const environmentKeys = ['cli_version', 'node_version', 'ruby_version', 'uname']\n\n Object.entries(allMetadata).forEach(([key, value]) => {\n if (key.startsWith('app_') || appKeys.includes(key)) {\n appData[key] = value\n } else if (key.startsWith('cmd_') || commandKeys.includes(key)) {\n commandData[key] = value\n } else if (key.startsWith('env_') || environmentKeys) {\n environmentData[key] = value\n } else {\n miscData[key] = value\n }\n })\n\n // app, command, environment, misc\n const bugsnagMetadata = {\n 'Shopify App': appData,\n Command: commandData,\n Environment: environmentData,\n Misc: miscData,\n }\n Object.entries(bugsnagMetadata).forEach(([section, values]) => {\n event.addMetadata(section, values)\n })\n}\n\nasync function initializeBugsnag() {\n if (Bugsnag.isStarted()) {\n return\n }\n Bugsnag.start({\n appType: 'node',\n apiKey: bugsnagApiKey,\n logger: null,\n appVersion: await constants.versions.cliKit(),\n autoTrackSessions: false,\n autoDetectErrors: false,\n })\n}\n"]}
1
+ {"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/public/node/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAClE,OAAO,EACL,WAAW,EACX,eAAe,EACf,MAAM,IAAI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AE,KAAK;KACxB,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {reportAnalyticsEvent} from './analytics.js'\nimport {getEnvironmentData} from '../../private/node/analytics.js'\nimport {\n AbortSilent,\n CancelExecution,\n mapper as errorMapper,\n shouldReport as shouldReportError,\n handler,\n cleanSingleStackTracePath,\n} from '../../error.js'\nimport {debug, info} from '../../output.js'\nimport * as path from '../../path.js'\nimport * as metadata from '../../metadata.js'\nimport {fanoutHooks} from '../../plugins.js'\nimport constants, {bugsnagApiKey} from '../../constants.js'\nimport {settings, Interfaces} from '@oclif/core'\nimport StackTracey from 'stacktracey'\nimport Bugsnag, {Event} from '@bugsnag/js'\nimport {realpath} from 'fs/promises'\n\nexport function errorHandler(\n error: (CancelExecution | AbortSilent) & {exitCode?: number | undefined},\n config?: Interfaces.Config,\n): void\nexport function errorHandler(error: Error & {exitCode?: number | undefined}, config?: Interfaces.Config): Promise<void>\nexport function errorHandler(error: Error & {exitCode?: number | undefined}, config?: Interfaces.Config): unknown {\n if (error instanceof CancelExecution) {\n if (error.message && error.message !== '') {\n info(`✨ ${error.message}`)\n }\n } else if (error instanceof AbortSilent) {\n process.exit(1)\n } else {\n return errorMapper(error)\n .then((error) => {\n return handler(error)\n })\n .then((mappedError) => reportError(mappedError, config))\n .then(() => {\n process.exit(1)\n })\n }\n}\n\nconst reportError = async (error: unknown, config?: Interfaces.Config): Promise<void> => {\n if (config !== undefined) {\n // Log an analytics event when there's an error\n await reportAnalyticsEvent({config, errorMessage: error instanceof Error ? error.message : undefined})\n }\n await sendErrorToBugsnag(error)\n}\n\n/**\n * Sends an error to Bugsnag. This is configured automatically for uncaught errors from CLI commands, but can also be used to manually record an error.\n *\n * @returns the reported error (this may have been tweaked for better reporting), and a bool to indicate if the error was actually submitted or not\n */\nexport async function sendErrorToBugsnag(\n error: unknown,\n): Promise<{reported: false; error: unknown} | {error: Error; reported: true}> {\n if (settings.debug || !shouldReportError(error)) return {reported: false, error}\n\n let reportableError: Error\n let stacktrace: string | undefined\n let report = false\n\n if (error instanceof Error) {\n report = true\n reportableError = new Error(error.message)\n stacktrace = error.stack\n\n /**\n * Some errors that reach this point have an empty string. For example:\n * https://app.bugsnag.com/shopify/cli/errors/62cd5d31fd5040000814086c?filters[event.since]=30d&filters[error.status]=new&filters[release.seen_in]=3.1.0\n *\n * Because at this point we have neither the error message nor a stack trace reporting them\n * to Bugsnag is pointless and adds noise.\n */\n } else if (typeof error === 'string' && error.trim().length !== 0) {\n report = true\n reportableError = new Error(error)\n stacktrace = reportableError.stack\n } else {\n report = false\n reportableError = new Error('Unknown error')\n }\n\n const formattedStacktrace = new StackTracey(stacktrace ?? '')\n .clean()\n .items.map((item) => {\n const filePath = cleanSingleStackTracePath(item.file)\n return ` at ${item.callee} (${filePath}:${item.line}:${item.column})`\n })\n .join('\\n')\n reportableError.stack = `Error: ${reportableError.message}\\n${formattedStacktrace}`\n\n if (report) {\n await initializeBugsnag()\n await new Promise((resolve, reject) => {\n Bugsnag.notify(reportableError, undefined, (error, event) => {\n if (error) {\n reject(error)\n } else {\n resolve(reportableError)\n }\n })\n })\n }\n return {error: reportableError, reported: report}\n}\n\n/**\n * If the given file path is within a node_modules folder, remove prefix up\n * to and including the node_modules folder.\n *\n * This gives us very consistent paths for errors generated by the CLI.\n */\nexport function cleanStackFrameFilePath({\n currentFilePath,\n projectRoot,\n pluginLocations,\n}: {\n currentFilePath: string\n projectRoot: string\n pluginLocations: {name: string; pluginPath: string}[]\n}): string {\n const fullLocation = path.isAbsolute(currentFilePath) ? currentFilePath : path.join(projectRoot, currentFilePath)\n\n const matchingPluginPath = pluginLocations.filter(({pluginPath}) => fullLocation.indexOf(pluginPath) === 0)[0]\n\n if (matchingPluginPath !== undefined) {\n // the plugin name (e.g. @shopify/cli-kit), plus the relative path of the error line from within the plugin's code (e.g. dist/something.js )\n return path.join(matchingPluginPath.name, path.relative(matchingPluginPath.pluginPath, fullLocation))\n }\n\n // strip prefix up to node_modules folder, so we can normalize error reporting\n return currentFilePath.replace(/.*node_modules\\//, '')\n}\n\n/**\n * Register a Bugsnag error listener to clean up stack traces for errors within plugin code.\n *\n */\nexport async function registerCleanBugsnagErrorsFromWithinPlugins(config: Interfaces.Config): Promise<void> {\n // Bugsnag have their own plug-ins that use this private field\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const bugsnagConfigProjectRoot: string = (Bugsnag as any)?._client?._config?.projectRoot ?? process.cwd()\n const projectRoot = path.normalize(bugsnagConfigProjectRoot)\n const pluginLocations = await Promise.all(\n config.plugins.map(async (plugin) => {\n const followSymlinks = await realpath(plugin.root)\n return {name: plugin.name, pluginPath: path.normalize(followSymlinks)}\n }),\n )\n await initializeBugsnag()\n Bugsnag.addOnError(async (event) => {\n event.errors.forEach((error) => {\n error.stacktrace.forEach((stackFrame) => {\n stackFrame.file = cleanStackFrameFilePath({currentFilePath: stackFrame.file, projectRoot, pluginLocations})\n })\n })\n try {\n await addBugsnagMetadata(event, config)\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (metadataError) {\n debug(`There was an error adding metadata to the Bugsnag report; Ignoring and carrying on ${metadataError}`)\n }\n })\n}\n\nexport async function addBugsnagMetadata(event: Event, config: Interfaces.Config): Promise<void> {\n const publicData = metadata.getAllPublic()\n const {commandStartOptions} = metadata.getAllSensitive()\n const {startCommand} = commandStartOptions ?? {}\n\n const {'@shopify/app': appPublic, ...otherPluginsPublic} = await fanoutHooks(config, 'public_command_metadata', {})\n\n const environment = await getEnvironmentData(config)\n\n const allMetadata = {\n command: startCommand,\n ...appPublic,\n ...publicData,\n ...environment,\n pluginData: otherPluginsPublic,\n }\n\n const appData = {} as {[key: string]: unknown}\n const commandData = {} as {[key: string]: unknown}\n const environmentData = {} as {[key: string]: unknown}\n const miscData = {} as {[key: string]: unknown}\n const appKeys = ['api_key', 'partner_id', 'project_type']\n const commandKeys = ['command']\n const environmentKeys = ['cli_version', 'node_version', 'ruby_version', 'uname']\n\n Object.entries(allMetadata).forEach(([key, value]) => {\n if (key.startsWith('app_') || appKeys.includes(key)) {\n appData[key] = value\n } else if (key.startsWith('cmd_') || commandKeys.includes(key)) {\n commandData[key] = value\n } else if (key.startsWith('env_') || environmentKeys) {\n environmentData[key] = value\n } else {\n miscData[key] = value\n }\n })\n\n // app, command, environment, misc\n const bugsnagMetadata = {\n 'Shopify App': appData,\n Command: commandData,\n Environment: environmentData,\n Misc: miscData,\n }\n Object.entries(bugsnagMetadata).forEach(([section, values]) => {\n event.addMetadata(section, values)\n })\n}\n\nasync function initializeBugsnag() {\n if (Bugsnag.isStarted()) {\n return\n }\n Bugsnag.start({\n appType: 'node',\n apiKey: bugsnagApiKey,\n logger: null,\n appVersion: await constants.versions.cliKit(),\n autoTrackSessions: false,\n autoDetectErrors: false,\n })\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { join as pathJoin } from '../../path.js';
2
- import { existsSync, readFileSync } from 'node:fs';
2
+ import { existsSync, readFileSync } from 'fs';
3
3
  const frameworks = [
4
4
  {
5
5
  name: 'remix',
@@ -1 +1 @@
1
- {"version":3,"file":"framework.js","sourceRoot":"","sources":["../../../src/public/node/framework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,SAAS,CAAA;AA2ChD,MAAM,UAAU,GAAgB;IAC9B;QACE,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACT,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,cAAc;oBACpB,YAAY,EAAE,sEAAsE;iBACrF;gBACD;oBACE,IAAI,EAAE,cAAc;oBACpB,YAAY,EAAE,4DAA4D;iBAC3E;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE;YACT,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,cAAc;oBACpB,YAAY,EAAE,2DAA2D;iBAC1E;gBACD;oBACE,IAAI,EAAE,cAAc;oBACpB,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ErE,aAAa,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAAA;IAC5C,OAAO,aAAa,CAAA;AACtB,CAAC","sourcesContent":["import {join as pathJoin} from '../../path.js'\nimport {existsSync, readFileSync} from 'node:fs'\n\ninterface FrameworkDetectionPattern {\n /**\n * @example A file path\n * ```\n * \"package.json\"\n * ```\n */\n path: string\n /**\n * @example A matcher\n * ```\n * \"\\\"(dev)?(d|D)ependencies\\\":\\\\s*{[^}]*\\\"next\\\":\\\\s*\\\".+?\\\"[^}]*}\"\n * ```\n */\n matchContent?: string\n}\n\ninterface Framework {\n /**\n * Name of the framework\n * @example \"nextjs\"\n */\n name: string\n\n /**\n * Detectors used to find out the framework\n */\n detectors: {\n /**\n * Collection of detectors that must be matched for the framework\n * to be detected.\n */\n every?: FrameworkDetectionPattern[]\n /**\n * Collection of detectors where one match triggers the framework\n * to be detected.\n */\n some?: FrameworkDetectionPattern[]\n }\n}\n\nconst frameworks: Framework[] = [\n {\n name: 'remix',\n detectors: {\n every: [\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"@remix-run\\\\/.*\":\\\\s*\".+?\"[^}]*}',\n },\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"react\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n {\n name: 'nextjs',\n detectors: {\n every: [\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"next\":\\\\s*\".+?\"[^}]*}',\n },\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"react\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n {\n name: 'express',\n detectors: {\n every: [\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"express\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n {\n name: 'rails',\n detectors: {\n every: [\n {\n path: 'Gemfile',\n matchContent: 'gem \"rails\"',\n },\n ],\n },\n },\n {\n name: 'flask',\n detectors: {\n every: [\n {\n path: 'Pipfile',\n matchContent: 'flask',\n },\n ],\n },\n },\n {\n name: 'django',\n detectors: {\n every: [\n {\n path: 'Pipfile',\n matchContent: 'django',\n },\n ],\n },\n },\n {\n name: 'laravel',\n detectors: {\n every: [\n {\n path: 'composer.json',\n matchContent: '\"require\":\\\\s*{[^}]*\"laravel/framework\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n {\n name: 'symfony',\n detectors: {\n every: [\n {\n path: 'composer.json',\n matchContent: '\"require\":\\\\s*{[^}]*\"symfony\\\\/.*\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n]\n\n/**\n * Tries to identify the using of a framework analyzing the existence and/or content of different files inside a\n * specific directory.\n *\n * @param rootDirectory - Directory from which the files required for each framework are searched\n * @returns The name of the framework used or 'unknown' otherwise\n */\nexport async function resolveFramework(rootDirectory: string): Promise<string> {\n const fwConfigFiles: {[key: string]: string | undefined} = {}\n\n const matchedFramework = frameworks.find(\n (framework) =>\n (!framework.detectors?.some ||\n framework.detectors?.some?.reduce(\n (_previousDetectorsMatch: boolean, detector) =>\n matchDetector(detector, loadFwConfigFile(rootDirectory, detector.path, fwConfigFiles)),\n false,\n )) &&\n (!framework.detectors?.every ||\n framework.detectors?.every?.reduce(\n (previousDetectorsMatch: boolean, detector) =>\n previousDetectorsMatch\n ? matchDetector(detector, loadFwConfigFile(rootDirectory, detector.path, fwConfigFiles))\n : false,\n true,\n )),\n )\n\n return matchedFramework ? matchedFramework.name : 'unknown'\n}\n\nfunction matchDetector(detector: FrameworkDetectionPattern, fwConfigFiles: {[key: string]: string | undefined} = {}) {\n if (!fwConfigFiles[detector.path]) return false\n\n return !detector.matchContent || new RegExp(detector.matchContent).test(fwConfigFiles[detector.path]!)\n}\n\nfunction loadFwConfigFile(\n rootPath: string,\n fwConfigFileName: string,\n fwConfigFiles: {[key: string]: string | undefined} = {},\n) {\n if (fwConfigFiles[fwConfigFileName]) {\n return fwConfigFiles\n }\n\n const fwConfigFilePath = pathJoin(rootPath, fwConfigFileName)\n if (!existsSync(fwConfigFilePath)) {\n return fwConfigFiles\n }\n\n const rawContent = readFileSync(fwConfigFilePath, {encoding: 'utf8'})\n\n fwConfigFiles[fwConfigFileName] = rawContent\n return fwConfigFiles\n}\n"]}
1
+ {"version":3,"file":"framework.js","sourceRoot":"","sources":["../../../src/public/node/framework.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,QAAQ,EAAC,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,IAAI,CAAA;AA2C3C,MAAM,UAAU,GAAgB;IAC9B;QACE,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACT,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,cAAc;oBACpB,YAAY,EAAE,sEAAsE;iBACrF;gBACD;oBACE,IAAI,EAAE,cAAc;oBACpB,YAAY,EAAE,4DAA4D;iBAC3E;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE;YACT,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,cAAc;oBACpB,YAAY,EAAE,2DAA2D;iBAC1E;gBACD;oBACE,IAAI,EAAE,cAAc;oBACpB,YAAY,EAAE,4DAA4D;iBAC3E;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,SAAS;QACf,SAAS,EAAE;YACT,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,cAAc;oBACpB,YAAY,EAAE,8DAA8D;iBAC7E;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACT,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,SAAS;oBACf,YAAY,EAAE,aAAa;iBAC5B;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACT,KAAK,E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AC;gBACxF,CAAC,CAAC,KAAK,EACX,IAAI,CACL,CAAC,CACP,CAAA;IAED,OAAO,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AAC7D,CAAC;AAED,SAAS,aAAa,CAAC,QAAmC,EAAE,gBAAqD,EAAE;IACjH,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAE/C,OAAO,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAE,CAAC,CAAA;AACxG,CAAC;AAED,SAAS,gBAAgB,CACvB,QAAgB,EAChB,gBAAwB,EACxB,gBAAqD,EAAE;IAEvD,IAAI,aAAa,CAAC,gBAAgB,CAAC,EAAE;QACnC,OAAO,aAAa,CAAA;KACrB;IAED,MAAM,gBAAgB,GAAG,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;IAC7D,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;QACjC,OAAO,aAAa,CAAA;KACrB;IAED,MAAM,UAAU,GAAG,YAAY,CAAC,gBAAgB,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAA;IAErE,aAAa,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAAA;IAC5C,OAAO,aAAa,CAAA;AACtB,CAAC","sourcesContent":["import {join as pathJoin} from '../../path.js'\nimport {existsSync, readFileSync} from 'fs'\n\ninterface FrameworkDetectionPattern {\n /**\n * @example A file path\n * ```\n * \"package.json\"\n * ```\n */\n path: string\n /**\n * @example A matcher\n * ```\n * \"\\\"(dev)?(d|D)ependencies\\\":\\\\s*{[^}]*\\\"next\\\":\\\\s*\\\".+?\\\"[^}]*}\"\n * ```\n */\n matchContent?: string\n}\n\ninterface Framework {\n /**\n * Name of the framework\n * @example \"nextjs\"\n */\n name: string\n\n /**\n * Detectors used to find out the framework\n */\n detectors: {\n /**\n * Collection of detectors that must be matched for the framework\n * to be detected.\n */\n every?: FrameworkDetectionPattern[]\n /**\n * Collection of detectors where one match triggers the framework\n * to be detected.\n */\n some?: FrameworkDetectionPattern[]\n }\n}\n\nconst frameworks: Framework[] = [\n {\n name: 'remix',\n detectors: {\n every: [\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"@remix-run\\\\/.*\":\\\\s*\".+?\"[^}]*}',\n },\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"react\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n {\n name: 'nextjs',\n detectors: {\n every: [\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"next\":\\\\s*\".+?\"[^}]*}',\n },\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"react\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n {\n name: 'express',\n detectors: {\n every: [\n {\n path: 'package.json',\n matchContent: '\"(dev)?(d|D)ependencies\":\\\\s*{[^}]*\"express\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n {\n name: 'rails',\n detectors: {\n every: [\n {\n path: 'Gemfile',\n matchContent: 'gem \"rails\"',\n },\n ],\n },\n },\n {\n name: 'flask',\n detectors: {\n every: [\n {\n path: 'Pipfile',\n matchContent: 'flask',\n },\n ],\n },\n },\n {\n name: 'django',\n detectors: {\n every: [\n {\n path: 'Pipfile',\n matchContent: 'django',\n },\n ],\n },\n },\n {\n name: 'laravel',\n detectors: {\n every: [\n {\n path: 'composer.json',\n matchContent: '\"require\":\\\\s*{[^}]*\"laravel/framework\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n {\n name: 'symfony',\n detectors: {\n every: [\n {\n path: 'composer.json',\n matchContent: '\"require\":\\\\s*{[^}]*\"symfony\\\\/.*\":\\\\s*\".+?\"[^}]*}',\n },\n ],\n },\n },\n]\n\n/**\n * Tries to identify the using of a framework analyzing the existence and/or content of different files inside a\n * specific directory.\n *\n * @param rootDirectory - Directory from which the files required for each framework are searched\n * @returns The name of the framework used or 'unknown' otherwise\n */\nexport async function resolveFramework(rootDirectory: string): Promise<string> {\n const fwConfigFiles: {[key: string]: string | undefined} = {}\n\n const matchedFramework = frameworks.find(\n (framework) =>\n (!framework.detectors?.some ||\n framework.detectors?.some?.reduce(\n (_previousDetectorsMatch: boolean, detector) =>\n matchDetector(detector, loadFwConfigFile(rootDirectory, detector.path, fwConfigFiles)),\n false,\n )) &&\n (!framework.detectors?.every ||\n framework.detectors?.every?.reduce(\n (previousDetectorsMatch: boolean, detector) =>\n previousDetectorsMatch\n ? matchDetector(detector, loadFwConfigFile(rootDirectory, detector.path, fwConfigFiles))\n : false,\n true,\n )),\n )\n\n return matchedFramework ? matchedFramework.name : 'unknown'\n}\n\nfunction matchDetector(detector: FrameworkDetectionPattern, fwConfigFiles: {[key: string]: string | undefined} = {}) {\n if (!fwConfigFiles[detector.path]) return false\n\n return !detector.matchContent || new RegExp(detector.matchContent).test(fwConfigFiles[detector.path]!)\n}\n\nfunction loadFwConfigFile(\n rootPath: string,\n fwConfigFileName: string,\n fwConfigFiles: {[key: string]: string | undefined} = {},\n) {\n if (fwConfigFiles[fwConfigFileName]) {\n return fwConfigFiles\n }\n\n const fwConfigFilePath = pathJoin(rootPath, fwConfigFileName)\n if (!existsSync(fwConfigFilePath)) {\n return fwConfigFiles\n }\n\n const rawContent = readFileSync(fwConfigFilePath, {encoding: 'utf8'})\n\n fwConfigFiles[fwConfigFileName] = rawContent\n return fwConfigFiles\n}\n"]}
@@ -1,8 +1,8 @@
1
- import { reportEvent } from '../../../analytics.js';
1
+ import { reportAnalyticsEvent } from '../analytics.js';
2
2
  import { debug } from '../../../output.js';
3
3
  // This hook is called after each successful command run. More info: https://oclif.io/docs/hooks
4
4
  export const hookPost = async ({ config, Command }) => {
5
- await reportEvent({ config });
5
+ await reportAnalyticsEvent({ config });
6
6
  const command = Command?.id?.replace(/:/g, ' ');
7
7
  debug(`Completed command ${command}`);
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../../../src/public/node/hooks/postrun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAA;AAGxC,gGAAgG;AAChG,MAAM,CAAC,MAAM,QAAQ,GAAiB,KAAK,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC,EAAE,EAAE;IAChE,MAAM,WAAW,CAAC,EAAC,MAAM,EAAC,CAAC,CAAA;IAC3B,MAAM,OAAO,GAAG,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,KAAK,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAA;AACvC,CAAC,CAAA","sourcesContent":["import {reportEvent} from '../../../analytics.js'\nimport {debug} from '../../../output.js'\nimport {Hook} from '@oclif/core'\n\n// This hook is called after each successful command run. More info: https://oclif.io/docs/hooks\nexport const hookPost: Hook.Postrun = async ({config, Command}) => {\n await reportEvent({config})\n const command = Command?.id?.replace(/:/g, ' ')\n debug(`Completed command ${command}`)\n}\n"]}
1
+ {"version":3,"file":"postrun.js","sourceRoot":"","sources":["../../../../src/public/node/hooks/postrun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAA;AAGxC,gGAAgG;AAChG,MAAM,CAAC,MAAM,QAAQ,GAAiB,KAAK,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC,EAAE,EAAE;IAChE,MAAM,oBAAoB,CAAC,EAAC,MAAM,EAAC,CAAC,CAAA;IACpC,MAAM,OAAO,GAAG,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,KAAK,CAAC,qBAAqB,OAAO,EAAE,CAAC,CAAA;AACvC,CAAC,CAAA","sourcesContent":["import {reportAnalyticsEvent} from '../analytics.js'\nimport {debug} from '../../../output.js'\nimport {Hook} from '@oclif/core'\n\n// This hook is called after each successful command run. More info: https://oclif.io/docs/hooks\nexport const hookPost: Hook.Postrun = async ({config, Command}) => {\n await reportAnalyticsEvent({config})\n const command = Command?.id?.replace(/:/g, ' ')\n debug(`Completed command ${command}`)\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { start } from '../../../analytics.js';
1
+ import { startAnalytics } from '../../../private/node/analytics.js';
2
2
  import { debug } from '../../../output.js';
3
3
  // This hook is called before each command run. More info: https://oclif.io/docs/hooks
4
4
  export const hook = async (options) => {
@@ -9,7 +9,7 @@ export const hook = async (options) => {
9
9
  });
10
10
  const args = options.argv;
11
11
  debug(`Running command ${commandContent.command}`);
12
- await start({ commandContent, args, commandClass: options.Command });
12
+ await startAnalytics({ commandContent, args, commandClass: options.Command });
13
13
  };
14
14
  export function parseCommandContent(cmdInfo) {
15
15
  let commandContent = parseCreateCommand(cmdInfo.pluginAlias);
@@ -1 +1 @@
1
- {"version":3,"file":"prerun.js","sourceRoot":"","sources":["../../../../src/public/node/hooks/prerun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,uBAAuB,CAAA;AAC3C,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAA;AASxC,sFAAsF;AACtF,MAAM,CAAC,MAAM,IAAI,GAAgB,KAAK,EAAE,OAAO,EAAE,EAAE;IACjD,MAAM,cAAc,GAAG,mBAAmB,CAAC;QACzC,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO;QAChC,WAAW,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AAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,OAAiB;IAClC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC3C,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAC1E,CAAA;IACD,IAAI,aAAa,EAAE;QACjB,OAAO,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;KACxC;AACH,CAAC","sourcesContent":["import {start} from '../../../analytics.js'\nimport {debug} from '../../../output.js'\nimport Command from '../../../public/node/base-command.js'\nimport {Hook} from '@oclif/core'\n\nexport declare interface CommandContent {\n command: string\n topic?: string\n alias?: string\n}\n// This hook is called before each command run. More info: https://oclif.io/docs/hooks\nexport const hook: Hook.Prerun = async (options) => {\n const commandContent = parseCommandContent({\n id: options.Command.id,\n aliases: options.Command.aliases,\n pluginAlias: options.Command.plugin?.alias,\n })\n const args = options.argv\n debug(`Running command ${commandContent.command}`)\n await start({commandContent, args, commandClass: options.Command as unknown as typeof Command})\n}\n\nexport function parseCommandContent(cmdInfo: {id: string; aliases: string[]; pluginAlias?: string}): CommandContent {\n let commandContent = parseCreateCommand(cmdInfo.pluginAlias)\n if (!commandContent) {\n commandContent = parseNormalCommand(cmdInfo.id, cmdInfo.aliases)\n }\n return commandContent\n}\n\nfunction parseNormalCommand(id: string, aliases: string[]): CommandContent {\n return {\n command: id.replace(/:/g, ' '),\n topic: parseTopic(id),\n alias: findAlias(aliases),\n }\n}\n\n/**\n * Create commands implement Init by default, so the name of the command must be extracted from\n * the plugin/module name. Neither alias or topic are supported\n *\n * @param commandClass - Oclif command configuration\n * @returns Command content with the name of the command or undefined otherwise\n */\nfunction parseCreateCommand(pluginAlias?: string): CommandContent | undefined {\n if (!pluginAlias || !pluginAlias.startsWith('@shopify/create-')) {\n return undefined\n }\n\n return {command: pluginAlias.substring(pluginAlias.indexOf('/') + 1)}\n}\n\n/**\n * Commands use this pattern topic:subtopic1:...:subtopicN:command. This method extract the topic and subtopic\n * information replacing the ':' separator with one space\n *\n * @param cmd - Complete command string to extract the topic information\n * @returns The topic name or undefined otherwise\n */\nfunction parseTopic(cmd: string) {\n if (cmd.lastIndexOf(':') === -1) {\n return\n }\n return cmd.slice(0, cmd.lastIndexOf(':')).replace(/:/g, ' ')\n}\n\n/**\n * Identifies if the command was launched using an alias instead of the oficial command name\n *\n * @param aliases - List of possible alias a command has\n * @returns The alias used or undefined otherwise\n */\nfunction findAlias(aliases: string[]) {\n const existingAlias = aliases.find((alias) =>\n alias.split(':').every((aliasToken) => process.argv.includes(aliasToken)),\n )\n if (existingAlias) {\n return existingAlias.replace(/:/g, ' ')\n }\n}\n"]}
1
+ {"version":3,"file":"prerun.js","sourceRoot":"","sources":["../../../../src/public/node/hooks/prerun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAA;AASxC,sFAAsF;AACtF,MAAM,CAAC,MAAM,IAAI,GAAgB,KAAK,EAAE,OAAO,EAAE,EAAE;IACjD,MAAM,cAAc,GAAG,mBAAmB,CAAC;QACzC,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO;QAChC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK;KAC3C,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IACzB,KAAK,CAAC,mBAAmB,cAAc,CAAC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;;;GAKG;AACH,SAAS,SAAS,CAAC,OAAiB;IAClC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAC3C,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAC1E,CAAA;IACD,IAAI,aAAa,EAAE;QACjB,OAAO,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;KACxC;AACH,CAAC","sourcesContent":["import {startAnalytics} from '../../../private/node/analytics.js'\nimport {debug} from '../../../output.js'\nimport Command from '../../../public/node/base-command.js'\nimport {Hook} from '@oclif/core'\n\nexport declare interface CommandContent {\n command: string\n topic?: string\n alias?: string\n}\n// This hook is called before each command run. More info: https://oclif.io/docs/hooks\nexport const hook: Hook.Prerun = async (options) => {\n const commandContent = parseCommandContent({\n id: options.Command.id,\n aliases: options.Command.aliases,\n pluginAlias: options.Command.plugin?.alias,\n })\n const args = options.argv\n debug(`Running command ${commandContent.command}`)\n await startAnalytics({commandContent, args, commandClass: options.Command as unknown as typeof Command})\n}\n\nexport function parseCommandContent(cmdInfo: {id: string; aliases: string[]; pluginAlias?: string}): CommandContent {\n let commandContent = parseCreateCommand(cmdInfo.pluginAlias)\n if (!commandContent) {\n commandContent = parseNormalCommand(cmdInfo.id, cmdInfo.aliases)\n }\n return commandContent\n}\n\nfunction parseNormalCommand(id: string, aliases: string[]): CommandContent {\n return {\n command: id.replace(/:/g, ' '),\n topic: parseTopic(id),\n alias: findAlias(aliases),\n }\n}\n\n/**\n * Create commands implement Init by default, so the name of the command must be extracted from\n * the plugin/module name. Neither alias or topic are supported\n *\n * @param commandClass - Oclif command configuration\n * @returns Command content with the name of the command or undefined otherwise\n */\nfunction parseCreateCommand(pluginAlias?: string): CommandContent | undefined {\n if (!pluginAlias || !pluginAlias.startsWith('@shopify/create-')) {\n return undefined\n }\n\n return {command: pluginAlias.substring(pluginAlias.indexOf('/') + 1)}\n}\n\n/**\n * Commands use this pattern topic:subtopic1:...:subtopicN:command. This method extract the topic and subtopic\n * information replacing the ':' separator with one space\n *\n * @param cmd - Complete command string to extract the topic information\n * @returns The topic name or undefined otherwise\n */\nfunction parseTopic(cmd: string) {\n if (cmd.lastIndexOf(':') === -1) {\n return\n }\n return cmd.slice(0, cmd.lastIndexOf(':')).replace(/:/g, ' ')\n}\n\n/**\n * Identifies if the command was launched using an alias instead of the oficial command name\n *\n * @param aliases - List of possible alias a command has\n * @returns The alias used or undefined otherwise\n */\nfunction findAlias(aliases: string[]) {\n const existingAlias = aliases.find((alias) =>\n alias.split(':').every((aliasToken) => process.argv.includes(aliasToken)),\n )\n if (existingAlias) {\n return existingAlias.replace(/:/g, ' ')\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  import { AbortError, BugError } from './error.js';
4
- import { AbortSignal } from 'abort-controller';
5
- import type { Writable } from 'node:stream';
4
+ import { AbortSignal } from './abort.js';
5
+ import type { Writable } from 'stream';
6
6
  /** The name of the Yarn lock file */
7
7
  export declare const yarnLockfile = "yarn.lock";
8
8
  /** The name of the npm lock file */
@@ -231,7 +231,7 @@ export declare function addResolutionOrOverride(directory: string, dependencies:
231
231
  [key: string]: string;
232
232
  }): Promise<void>;
233
233
  interface FindPackageVersionUpOptions {
234
- fromModuleURL: URL | string;
234
+ fromModuleURL: import('url').URL | string;
235
235
  }
236
236
  /**
237
237
  * Given a module URL, it traverses the directory hierarchy up until it finds a package.json
@@ -1,11 +1,11 @@
1
1
  import { AbortError, BugError } from './error.js';
2
2
  import { Version } from './semver.js';
3
+ import { AbortController } from './abort.js';
3
4
  import { exec } from '../../system.js';
4
5
  import { exists as fileExists, read as readFile, write as writeFile } from '../../file.js';
5
6
  import { glob, dirname, join as pathJoin, findUp, moduleDirectory } from '../../path.js';
6
7
  import { token, content, debug } from '../../output.js';
7
8
  import { Bug } from '../../error.js';
8
- import { AbortController } from 'abort-controller';
9
9
  import latestVersion from 'latest-version';
10
10
  /** The name of the Yarn lock file */
11
11
  export const yarnLockfile = 'yarn.lock';