@shopify/cli 3.67.3 → 3.68.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 (85) hide show
  1. package/dist/{chunk-7BK74JM2.js → chunk-4H7GRGC6.js} +3 -3
  2. package/dist/{chunk-OVBHC7XZ.js → chunk-5VZ6BLBM.js} +3 -3
  3. package/dist/{chunk-ESCACI7K.js → chunk-6IS7OFWG.js} +5 -5
  4. package/dist/{chunk-67E32Z72.js → chunk-7PUJMPXN.js} +5528 -17168
  5. package/dist/{chunk-XHO4O3WD.js → chunk-A3DV6VXO.js} +2 -2
  6. package/dist/{chunk-QQWDDZPJ.js → chunk-C4FBYE7F.js} +4 -4
  7. package/dist/{chunk-CL6KB3RG.js → chunk-D72SCNZ2.js} +6 -2
  8. package/dist/chunk-DD5ULVKP.js +103 -0
  9. package/dist/{chunk-FMTK2DLI.js → chunk-DMM6NVLV.js} +4 -4
  10. package/dist/{chunk-MP5JBUFB.js → chunk-E2OAY724.js} +2 -2
  11. package/dist/{chunk-YZHXAE4H.js → chunk-EUBA2XGP.js} +4 -4
  12. package/dist/{chunk-QK4M5NLW.js → chunk-FIAUTHMT.js} +2 -2
  13. package/dist/{chunk-SK3QXUXV.js → chunk-FKQTUQ3O.js} +4 -4
  14. package/dist/{chunk-Y6XYGV3K.js → chunk-G47SEBU3.js} +3 -3
  15. package/dist/{chunk-IVO3C5LM.js → chunk-GDKBDEZV.js} +3 -3
  16. package/dist/{chunk-UOH7XDLM.js → chunk-HTDUPJH5.js} +3 -3
  17. package/dist/{chunk-SAKJRSNZ.js → chunk-IL455HI5.js} +3 -3
  18. package/dist/{chunk-J44K26AK.js → chunk-INEJACZ7.js} +3 -3
  19. package/dist/{chunk-X2LIPDBQ.js → chunk-JAH3NBCG.js} +4 -4
  20. package/dist/{chunk-SERYSNVE.js → chunk-JAQZDU4S.js} +2 -2
  21. package/dist/{chunk-ADIIAXPI.js → chunk-JJOZP7G6.js} +3 -3
  22. package/dist/{chunk-UE5ILNA5.js → chunk-JR6ZN4TY.js} +4 -4
  23. package/dist/{chunk-5GMBDXCT.js → chunk-MXZ6B3TP.js} +2 -2
  24. package/dist/{chunk-EMUNMNK7.js → chunk-NCUKAORS.js} +6 -6
  25. package/dist/{chunk-NBY455BA.js → chunk-OBX5DIH4.js} +4 -4
  26. package/dist/{chunk-FPTBJGSU.js → chunk-QIBFYG6F.js} +3 -3
  27. package/dist/{chunk-NV2K2JNI.js → chunk-RUR45G5U.js} +15 -3
  28. package/dist/{chunk-VVCAHOHL.js → chunk-UCYJX4VB.js} +2 -2
  29. package/dist/{chunk-UI7DIACQ.js → chunk-VVY6VJR6.js} +2 -2
  30. package/dist/{chunk-AYJMV2UJ.js → chunk-WJBW5QHV.js} +2 -2
  31. package/dist/chunk-WUA6LTEH.js +15959 -0
  32. package/dist/{chunk-F2FF5RRS.js → chunk-XCGES3AJ.js} +3 -3
  33. package/dist/{chunk-GBZFBWCM.js → chunk-YKH4ILAB.js} +14 -12
  34. package/dist/{chunk-UTJGWPED.js → chunk-ZJZ3SGOJ.js} +2 -2
  35. package/dist/cli/commands/auth/logout.js +11 -12
  36. package/dist/cli/commands/auth/logout.test.js +12 -13
  37. package/dist/cli/commands/debug/command-flags.js +10 -9
  38. package/dist/cli/commands/demo/catalog.js +11 -11
  39. package/dist/cli/commands/demo/generate-file.js +11 -11
  40. package/dist/cli/commands/demo/index.js +11 -11
  41. package/dist/cli/commands/demo/print-ai-prompt.js +11 -11
  42. package/dist/cli/commands/docs/generate.js +10 -9
  43. package/dist/cli/commands/docs/generate.test.js +10 -9
  44. package/dist/cli/commands/help.js +10 -9
  45. package/dist/cli/commands/kitchen-sink/async.js +11 -10
  46. package/dist/cli/commands/kitchen-sink/async.test.js +11 -10
  47. package/dist/cli/commands/kitchen-sink/index.js +13 -12
  48. package/dist/cli/commands/kitchen-sink/index.test.js +13 -12
  49. package/dist/cli/commands/kitchen-sink/prompts.js +11 -10
  50. package/dist/cli/commands/kitchen-sink/prompts.test.js +11 -10
  51. package/dist/cli/commands/kitchen-sink/static.js +11 -10
  52. package/dist/cli/commands/kitchen-sink/static.test.js +11 -10
  53. package/dist/cli/commands/search.js +11 -10
  54. package/dist/cli/commands/upgrade.js +11 -10
  55. package/dist/cli/commands/version.js +11 -10
  56. package/dist/cli/commands/version.test.js +11 -10
  57. package/dist/cli/services/commands/search.js +2 -2
  58. package/dist/cli/services/commands/search.test.js +2 -2
  59. package/dist/cli/services/commands/version.js +3 -3
  60. package/dist/cli/services/commands/version.test.js +4 -4
  61. package/dist/cli/services/demo.js +2 -2
  62. package/dist/cli/services/demo.test.js +3 -3
  63. package/dist/cli/services/kitchen-sink/async.js +2 -2
  64. package/dist/cli/services/kitchen-sink/prompts.js +2 -2
  65. package/dist/cli/services/kitchen-sink/static.js +2 -2
  66. package/dist/cli/services/upgrade.js +3 -3
  67. package/dist/cli/services/upgrade.test.js +5 -5
  68. package/dist/{custom-oclif-loader-ROCHTOS5.js → custom-oclif-loader-Y5TLP3GI.js} +2 -2
  69. package/dist/{error-handler-GT7C27BQ.js → error-handler-EORUUIBK.js} +9 -8
  70. package/dist/hooks/postrun.js +9 -9
  71. package/dist/hooks/prerun.js +8 -6
  72. package/dist/index.d.ts +1 -0
  73. package/dist/index.js +500 -605
  74. package/dist/{local-T3UMODTX.js → local-4NQ3UGM2.js} +4 -2
  75. package/dist/{node-V2ZJPWY5.js → node-NWOSUD3V.js} +12 -13
  76. package/dist/{node-package-manager-PYU7QL5O.js → node-package-manager-D7JIOBLM.js} +5 -3
  77. package/dist/{system-CEM4NSPG.js → system-WDT2XUAD.js} +2 -2
  78. package/dist/tsconfig.tsbuildinfo +1 -1
  79. package/dist/{ui-KGCQLCOJ.js → ui-JUVEDXYN.js} +2 -2
  80. package/dist/{workerd-TOCBV52P.js → workerd-VWTWLJIV.js} +12 -13
  81. package/oclif.manifest.json +15 -52
  82. package/package.json +6 -6
  83. package/dist/chunk-3E44DPAU.js +0 -118
  84. package/dist/chunk-EMJI2MUZ.js +0 -4244
  85. package/dist/chunk-LCWH3FW5.js +0 -33
package/dist/index.js CHANGED
@@ -123,7 +123,7 @@ import {
123
123
  unsetStorefront,
124
124
  waitForJob,
125
125
  writeDotEnv
126
- } from "./chunk-GBZFBWCM.js";
126
+ } from "./chunk-YKH4ILAB.js";
127
127
  import {
128
128
  require_lib as require_lib4
129
129
  } from "./chunk-NUP5TATA.js";
@@ -141,93 +141,72 @@ import {
141
141
  } from "./chunk-OXKHBIW7.js";
142
142
  import {
143
143
  KitchenSinkStatic
144
- } from "./chunk-FPTBJGSU.js";
144
+ } from "./chunk-QIBFYG6F.js";
145
145
  import {
146
146
  Search
147
- } from "./chunk-Y6XYGV3K.js";
147
+ } from "./chunk-G47SEBU3.js";
148
148
  import {
149
149
  Upgrade
150
- } from "./chunk-QQWDDZPJ.js";
150
+ } from "./chunk-C4FBYE7F.js";
151
151
  import {
152
152
  getOutputUpdateCLIReminder
153
- } from "./chunk-ADIIAXPI.js";
153
+ } from "./chunk-JJOZP7G6.js";
154
154
  import {
155
155
  Version
156
- } from "./chunk-SAKJRSNZ.js";
157
- import "./chunk-F2FF5RRS.js";
158
- import "./chunk-5GMBDXCT.js";
156
+ } from "./chunk-IL455HI5.js";
157
+ import "./chunk-XCGES3AJ.js";
158
+ import "./chunk-MXZ6B3TP.js";
159
159
  import {
160
160
  HelpCommand
161
- } from "./chunk-UI7DIACQ.js";
161
+ } from "./chunk-VVY6VJR6.js";
162
162
  import {
163
163
  KitchenSinkAsync
164
- } from "./chunk-UOH7XDLM.js";
164
+ } from "./chunk-HTDUPJH5.js";
165
165
  import {
166
166
  KitchenSinkAll
167
- } from "./chunk-ESCACI7K.js";
168
- import "./chunk-UTJGWPED.js";
169
- import "./chunk-VVCAHOHL.js";
167
+ } from "./chunk-6IS7OFWG.js";
168
+ import "./chunk-ZJZ3SGOJ.js";
169
+ import "./chunk-UCYJX4VB.js";
170
170
  import {
171
171
  KitchenSinkPrompts
172
- } from "./chunk-7BK74JM2.js";
173
- import "./chunk-MP5JBUFB.js";
172
+ } from "./chunk-4H7GRGC6.js";
173
+ import "./chunk-E2OAY724.js";
174
174
  import {
175
175
  Logout
176
- } from "./chunk-X2LIPDBQ.js";
176
+ } from "./chunk-JAH3NBCG.js";
177
177
  import {
178
- appManagementFqdn,
179
- checkPort,
180
- developerDashboardFqdn,
181
178
  ensureAuthenticatedAdmin,
182
179
  ensureAuthenticatedAppManagement,
183
180
  ensureAuthenticatedBusinessPlatform,
184
181
  ensureAuthenticatedPartners,
185
182
  ensureAuthenticatedStorefront,
186
- ensureAuthenticatedThemes,
187
- err,
188
- getRandomPort,
189
- graphqlRequest,
190
- graphqlRequestDoc,
191
- normalizeStoreFqdn,
192
- ok,
193
- partnersFqdn,
194
- partnersRequest,
195
- partnersRequestDoc,
196
- require_lib as require_lib3
197
- } from "./chunk-EMJI2MUZ.js";
198
- import {
199
- setNextDeprecationDate
200
- } from "./chunk-LCWH3FW5.js";
183
+ ensureAuthenticatedThemes
184
+ } from "./chunk-DD5ULVKP.js";
201
185
  import {
202
186
  CommandFlags
203
- } from "./chunk-IVO3C5LM.js";
187
+ } from "./chunk-GDKBDEZV.js";
204
188
  import {
205
189
  Catalog
206
- } from "./chunk-NBY455BA.js";
190
+ } from "./chunk-OBX5DIH4.js";
207
191
  import {
208
192
  GenerateFile
209
- } from "./chunk-SK3QXUXV.js";
193
+ } from "./chunk-FKQTUQ3O.js";
210
194
  import {
211
195
  Demo
212
- } from "./chunk-UE5ILNA5.js";
196
+ } from "./chunk-JR6ZN4TY.js";
213
197
  import {
214
198
  PrintAIPrompt
215
- } from "./chunk-FMTK2DLI.js";
199
+ } from "./chunk-DMM6NVLV.js";
216
200
  import "./chunk-QSUS3GJF.js";
217
- import "./chunk-AYJMV2UJ.js";
218
- import {
219
- deepStrict,
220
- errorsToString,
221
- z
222
- } from "./chunk-NLUGD7PZ.js";
201
+ import "./chunk-WJBW5QHV.js";
223
202
  import {
224
203
  DocsGenerate
225
- } from "./chunk-OVBHC7XZ.js";
204
+ } from "./chunk-5VZ6BLBM.js";
226
205
  import {
227
206
  base_command_default,
228
207
  decodeToml,
229
208
  encodeToml
230
- } from "./chunk-YZHXAE4H.js";
209
+ } from "./chunk-EUBA2XGP.js";
231
210
  import {
232
211
  require_byline,
233
212
  require_end_of_stream,
@@ -235,36 +214,52 @@ import {
235
214
  require_iserror,
236
215
  require_pump,
237
216
  require_stack_generator
238
- } from "./chunk-EMUNMNK7.js";
217
+ } from "./chunk-NCUKAORS.js";
239
218
  import {
240
- ClientError,
241
- FetchError,
242
- buildHeaders,
243
219
  execCLI2,
244
220
  fanoutHooks,
221
+ getListOfTunnelPlugins,
222
+ reportAnalyticsEvent,
223
+ version
224
+ } from "./chunk-WUA6LTEH.js";
225
+ import {
226
+ ClientError,
227
+ FetchError,
228
+ appManagementFqdn,
229
+ checkPort,
230
+ developerDashboardFqdn,
231
+ err,
245
232
  fetch as fetch2,
233
+ fileHash,
246
234
  formData,
247
235
  getBackendPort,
248
236
  getEnvironmentVariables,
249
- getListOfTunnelPlugins,
250
237
  getOrganization,
238
+ getRandomPort,
251
239
  gql,
252
- reportAnalyticsEvent,
240
+ graphqlRequest,
241
+ graphqlRequestDoc,
242
+ hashString,
243
+ normalizeStoreFqdn,
244
+ ok,
245
+ partnersFqdn,
246
+ partnersRequest,
247
+ partnersRequestDoc,
248
+ randomUUID,
253
249
  require_graphql,
254
250
  require_lib as require_lib2,
251
+ require_lib2 as require_lib3,
255
252
  require_mime_types,
256
- version
257
- } from "./chunk-67E32Z72.js";
253
+ restRequestBody,
254
+ restRequestHeaders,
255
+ restRequestUrl,
256
+ setNextDeprecationDate
257
+ } from "./chunk-7PUJMPXN.js";
258
258
  import "./chunk-VSLR7ET4.js";
259
- import {
260
- fileHash,
261
- hashString,
262
- randomUUID
263
- } from "./chunk-3E44DPAU.js";
264
259
  import {
265
260
  platformAndArch,
266
261
  username
267
- } from "./chunk-SERYSNVE.js";
262
+ } from "./chunk-JAQZDU4S.js";
268
263
  import {
269
264
  LocalStorage,
270
265
  UnknownPackageManagerError,
@@ -276,17 +271,17 @@ import {
276
271
  getPackageManager,
277
272
  getPackageName,
278
273
  getPackageVersion,
274
+ inferPackageManager,
279
275
  installNPMDependenciesRecursively,
280
276
  installNodeModules,
281
277
  lockfiles,
282
- packageManager,
283
278
  packageManagerFromUserAgent,
284
279
  readAndParsePackageJson,
285
280
  require_ajv,
286
281
  usesWorkspaces,
287
282
  versionSatisfies,
288
283
  writePackageJSON
289
- } from "./chunk-NV2K2JNI.js";
284
+ } from "./chunk-RUR45G5U.js";
290
285
  import {
291
286
  require_semver
292
287
  } from "./chunk-BYPQXSAL.js";
@@ -295,7 +290,12 @@ import {
295
290
  } from "./chunk-O5K4AU7Q.js";
296
291
  import {
297
292
  CLI_KIT_VERSION
298
- } from "./chunk-XHO4O3WD.js";
293
+ } from "./chunk-A3DV6VXO.js";
294
+ import {
295
+ deepStrict,
296
+ errorsToString,
297
+ z
298
+ } from "./chunk-NLUGD7PZ.js";
299
299
  import {
300
300
  AbortController as AbortController2,
301
301
  AbortError,
@@ -472,13 +472,11 @@ import {
472
472
  use_stdin_default,
473
473
  writeFile,
474
474
  writeFileSync
475
- } from "./chunk-CL6KB3RG.js";
475
+ } from "./chunk-D72SCNZ2.js";
476
476
  import {
477
477
  require_signal_exit
478
478
  } from "./chunk-QETDXAFX.js";
479
479
  import {
480
- defaultThemeKitAccessDomain,
481
- environmentVariables,
482
480
  logsFolder
483
481
  } from "./chunk-NZDBLGNM.js";
484
482
  import {
@@ -144612,7 +144610,7 @@ import { fileURLToPath } from "url";
144612
144610
  async function warnIfOldNodeVersion() {
144613
144611
  let nodeVersion = process.versions.node, nodeMajorVersion = Number(nodeVersion.split(".")[0]);
144614
144612
  if (nodeMajorVersion < 18) {
144615
- let { renderWarning: renderWarning2 } = await import("./ui-KGCQLCOJ.js");
144613
+ let { renderWarning: renderWarning2 } = await import("./ui-JUVEDXYN.js");
144616
144614
  renderWarning2({
144617
144615
  headline: "Upgrade to a supported Node version now.",
144618
144616
  body: [
@@ -144637,7 +144635,7 @@ function forceNoColor() {
144637
144635
  }
144638
144636
  async function runCLI(options) {
144639
144637
  setupEnvironmentVariables(options), forceNoColor(), await warnIfOldNodeVersion();
144640
- let { errorHandler: errorHandler2 } = await import("./error-handler-GT7C27BQ.js"), { isDevelopment } = await import("./local-T3UMODTX.js"), oclif = await import("./lib-4WCTNKJK.js"), { ShopifyConfig } = await import("./custom-oclif-loader-ROCHTOS5.js");
144638
+ let { errorHandler: errorHandler2 } = await import("./error-handler-EORUUIBK.js"), { isDevelopment } = await import("./local-4NQ3UGM2.js"), oclif = await import("./lib-4WCTNKJK.js"), { ShopifyConfig } = await import("./custom-oclif-loader-Y5TLP3GI.js");
144641
144639
  isDevelopment() && (oclif.default.settings.debug = !0);
144642
144640
  try {
144643
144641
  let config2 = new ShopifyConfig({ root: fileURLToPath(options.moduleURL) });
@@ -144647,8 +144645,8 @@ async function runCLI(options) {
144647
144645
  }
144648
144646
  }
144649
144647
  async function useLocalCLIIfDetected(filepath) {
144650
- let { environmentVariables: environmentVariables2 } = await import("./constants-TR6ABVLJ.js"), { joinPath: join6 } = await import("./path-T2RCZTRE.js"), { exec: exec2 } = await import("./system-CEM4NSPG.js");
144651
- if (!isTruthy(process.env[environmentVariables2.enableCliRedirect]) || isTruthy(process.env[environmentVariables2.skipCliRedirect]) || process.env.npm_config_user_agent)
144648
+ let { environmentVariables } = await import("./constants-TR6ABVLJ.js"), { joinPath: join6 } = await import("./path-T2RCZTRE.js"), { exec: exec2 } = await import("./system-WDT2XUAD.js");
144649
+ if (!isTruthy(process.env[environmentVariables.enableCliRedirect]) || isTruthy(process.env[environmentVariables.skipCliRedirect]) || process.env.npm_config_user_agent)
144652
144650
  return !1;
144653
144651
  let cliPackage = await localCliPackage();
144654
144652
  if (!cliPackage)
@@ -144659,7 +144657,7 @@ async function useLocalCLIIfDetected(filepath) {
144659
144657
  try {
144660
144658
  await exec2(correctExecutablePath, process.argv.slice(2, process.argv.length), {
144661
144659
  stdio: "inherit",
144662
- env: { [environmentVariables2.skipCliRedirect]: "1" }
144660
+ env: { [environmentVariables.skipCliRedirect]: "1" }
144663
144661
  });
144664
144662
  } catch (processError) {
144665
144663
  process.exit(processError.exitCode);
@@ -144667,7 +144665,7 @@ async function useLocalCLIIfDetected(filepath) {
144667
144665
  return !0;
144668
144666
  }
144669
144667
  async function localCliPackage() {
144670
- let { captureOutput } = await import("./system-CEM4NSPG.js"), npmListOutput = "", localShopifyCLI = {};
144668
+ let { captureOutput } = await import("./system-WDT2XUAD.js"), npmListOutput = "", localShopifyCLI = {};
144671
144669
  try {
144672
144670
  npmListOutput = await captureOutput("npm", ["list", "@shopify/cli", "--json", "-l"]), localShopifyCLI = JSON.parse(npmListOutput);
144673
144671
  } catch {
@@ -145061,26 +145059,6 @@ function header(response, name) {
145061
145059
 
145062
145060
  // ../cli-kit/dist/public/node/api/admin.js
145063
145061
  init_cjs_shims();
145064
-
145065
- // ../cli-kit/dist/private/node/api/rest.js
145066
- init_cjs_shims();
145067
- function restRequestBody(requestBody) {
145068
- if (requestBody)
145069
- return JSON.stringify(requestBody);
145070
- }
145071
- function restRequestUrl(session, apiVersion, path3, searchParams = {}, env = process.env) {
145072
- let themeKitAccessDomain = env[environmentVariables.themeKitAccessDomain] || defaultThemeKitAccessDomain, url = new URL(isThemeAccessSession(session) ? `https://${themeKitAccessDomain}/cli/admin/api/${apiVersion}${path3}.json` : `https://${session.storeFqdn}/admin/api/${apiVersion}${path3}.json`);
145073
- return Object.entries(searchParams).forEach(([name, value]) => url.searchParams.set(name, value)), url.toString();
145074
- }
145075
- function restRequestHeaders(session) {
145076
- let store = session.storeFqdn, token = session.token, headers = buildHeaders(session.token);
145077
- return isThemeAccessSession(session) && (headers["X-Shopify-Shop"] = store, headers["X-Shopify-Access-Token"] = token), headers;
145078
- }
145079
- function isThemeAccessSession(session) {
145080
- return session.token.startsWith("shptka_");
145081
- }
145082
-
145083
- // ../cli-kit/dist/public/node/api/admin.js
145084
145062
  async function adminRequest2(query, session, variables) {
145085
145063
  let api = "Admin", version2 = await fetchLatestSupportedApiVersion(session), url = adminUrl(session.storeFqdn, version2);
145086
145064
  return graphqlRequest({ query, api, url, token: session.token, variables });
@@ -146454,7 +146432,7 @@ function toNodeListener(app) {
146454
146432
  async function render2(session, context) {
146455
146433
  let url = buildStorefrontUrl(session, context), replaceTemplates = Object.keys({ ...context.replaceTemplates, ...context.replaceExtensionTemplates });
146456
146434
  outputDebug(`\u2192 Rendering ${url} (with ${replaceTemplates})...`);
146457
- let bodyParams = storefrontReplaceTemplatesParams(context), headers = await buildHeaders2(session, context), response = await fetch2(url, {
146435
+ let bodyParams = storefrontReplaceTemplatesParams(context), headers = await buildHeaders(session, context), response = await fetch2(url, {
146458
146436
  method: "POST",
146459
146437
  body: bodyParams,
146460
146438
  headers: {
@@ -146471,8 +146449,8 @@ async function render2(session, context) {
146471
146449
  }), requestId = response.headers.get("x-request-id");
146472
146450
  return outputDebug(`\u2190 ${response.status} (request_id: ${requestId})`), response.headers.delete("Content-Type"), response;
146473
146451
  }
146474
- async function buildHeaders2(session, context) {
146475
- return isThemeAccessSession2(session) ? buildThemeAccessHeaders(session, context) : buildStandardHeaders(session, context);
146452
+ async function buildHeaders(session, context) {
146453
+ return isThemeAccessSession(session) ? buildThemeAccessHeaders(session, context) : buildStandardHeaders(session, context);
146476
146454
  }
146477
146455
  async function buildStandardHeaders(session, context) {
146478
146456
  let cookies = await buildCookies(session, context), storefrontToken = session.storefrontToken;
@@ -146510,9 +146488,9 @@ function buildStorefrontUrl(session, { path: path3, sectionId, appBlockId, query
146510
146488
  return sectionId ? params.append("section_id", sectionId) : appBlockId && params.append("app_block_id", appBlockId), `${url}?${params}`;
146511
146489
  }
146512
146490
  function buildBaseStorefrontUrl(session) {
146513
- return isThemeAccessSession2(session) ? "https://theme-kit-access.shopifyapps.com/cli/sfr" : `https://${session.storeFqdn}`;
146491
+ return isThemeAccessSession(session) ? "https://theme-kit-access.shopifyapps.com/cli/sfr" : `https://${session.storeFqdn}`;
146514
146492
  }
146515
- function isThemeAccessSession2(session) {
146493
+ function isThemeAccessSession(session) {
146516
146494
  return session.token.startsWith("shptka_");
146517
146495
  }
146518
146496
  function themeAccessHeaders(session) {
@@ -146813,6 +146791,10 @@ init_cjs_shims();
146813
146791
  // ../theme/dist/cli/utilities/theme-selector/fetch.js
146814
146792
  init_cjs_shims();
146815
146793
  var ALLOWED_ROLES = ["live", "unpublished", "development"];
146794
+ async function publicFetchStoreThemes(store, password) {
146795
+ let adminSession = await ensureAuthenticatedThemes(store, password);
146796
+ return fetchStoreThemes(adminSession);
146797
+ }
146816
146798
  async function fetchStoreThemes(session) {
146817
146799
  let store = session.storeFqdn, themes = (await fetchThemes(session)).filter(isRoleAllowed);
146818
146800
  if (themes.length === 0)
@@ -147682,10 +147664,10 @@ ${result.errors.asset.map((error) => `- ${error}`).join(`
147682
147664
  }, handleFileDelete = (themeId, adminSession, fileKey) => {
147683
147665
  isFileIgnored(fileKey) || (files.delete(fileKey), unsyncedFileKeys.add(fileKey), emitEvent("unlink", { fileKey }), deleteThemeAsset(Number(themeId), fileKey, adminSession).then(async (success) => {
147684
147666
  if (!success)
147685
- throw new Error("Unknown issue.");
147667
+ throw new Error(`Failed to delete file "${fileKey}" from remote theme.`);
147686
147668
  unsyncedFileKeys.delete(fileKey), outputSyncResult("delete", fileKey);
147687
147669
  }).catch((error) => {
147688
- renderWarning({ headline: `Failed to delete file "${fileKey}".`, body: error.message });
147670
+ outputDebug(error.message);
147689
147671
  }));
147690
147672
  }, directoriesToWatch = new Set(THEME_DIRECTORY_PATTERNS.map((pattern) => joinPath(root, pattern.split("/").shift() ?? "")));
147691
147673
  return {
@@ -147697,7 +147679,12 @@ ${result.errors.asset.map((error) => `- ${error}`).join(`
147697
147679
  files.delete(fileKey), await removeThemeFile(root, fileKey);
147698
147680
  },
147699
147681
  write: async (asset) => {
147700
- files.set(asset.key, asset), await writeThemeFile(root, asset);
147682
+ files.set(asset.key, buildThemeAsset({
147683
+ key: asset.key,
147684
+ checksum: asset.checksum,
147685
+ value: asset.value ?? "",
147686
+ attachment: asset.attachment ?? ""
147687
+ })), await writeThemeFile(root, asset);
147701
147688
  },
147702
147689
  read,
147703
147690
  applyIgnoreFilters: (files2) => applyIgnoreFilters(files2, filterPatterns),
@@ -147765,7 +147752,8 @@ function isTextFile(path3) {
147765
147752
  "application/liquid",
147766
147753
  "text/css",
147767
147754
  "text/x-sass",
147768
- "text/x-scss"
147755
+ "text/x-scss",
147756
+ "image/svg+xml"
147769
147757
  ].includes(lookupMimeType(path3));
147770
147758
  }
147771
147759
  async function hasRequiredThemeDirectories(path3) {
@@ -147902,7 +147890,7 @@ function getStoreFqdnForRegEx(ctx) {
147902
147890
  function injectCdnProxy(originalContent, ctx) {
147903
147891
  let content = originalContent, vanityCdnRE = new RegExp(`(https?:)?//${getStoreFqdnForRegEx(ctx)}${VANITY_CDN_PREFIX}`, "g");
147904
147892
  content = content.replace(vanityCdnRE, VANITY_CDN_PREFIX);
147905
- let mainCdnRE = /(?:https?:)?\/\/cdn\.shopify\.com\/(.*?\/(assets\/[^?">]+)(?:\?|"|>|$))/g, filterAssets = (key) => key.startsWith("assets"), existingAssets = new Set([...ctx.localThemeFileSystem.files.keys()].filter(filterAssets)), existingExtAssets = new Set([...ctx.localThemeExtensionFileSystem.files.keys()].filter(filterAssets));
147893
+ let mainCdnRE = /(?:https?:)?\/\/cdn\.shopify\.com\/(.*?\/(assets\/[^?#"'`>\s]+))/g, filterAssets = (key) => key.startsWith("assets/"), existingAssets = new Set([...ctx.localThemeFileSystem.files.keys()].filter(filterAssets)), existingExtAssets = new Set([...ctx.localThemeExtensionFileSystem.files.keys()].filter(filterAssets));
147906
147894
  return content = content.replace(mainCdnRE, (matchedUrl, pathname, matchedAsset) => {
147907
147895
  let isLocalAsset = matchedAsset && existingAssets.has(matchedAsset), isLocalExtAsset = matchedAsset && existingExtAssets.has(matchedAsset) && pathname.startsWith("extensions/");
147908
147896
  return lookupMimeType(matchedAsset).startsWith("image/") ? matchedUrl : isLocalExtAsset ? `${EXTENSION_CDN_PREFIX}${pathname}` : isLocalAsset ? `${VANITY_CDN_PREFIX}${pathname}` : matchedUrl;
@@ -147919,7 +147907,7 @@ function patchCookieDomains(cookieHeader, ctx) {
147919
147907
  async function patchRenderingResponse(ctx, event, response) {
147920
147908
  setResponseStatus(event, response.status, response.statusText), setResponseHeaders(event, Object.fromEntries(response.headers.entries())), patchProxiedResponseHeaders(ctx, event, response);
147921
147909
  let html = await response.text();
147922
- return removeResponseHeader(event, "content-encoding"), html = injectCdnProxy(html, ctx), html = patchBaseUrlAttributes(html, ctx), html;
147910
+ return removeResponseHeader(event, "content-encoding"), setResponseHeader(event, "content-type", "text/html; charset=utf-8"), html = injectCdnProxy(html, ctx), html = patchBaseUrlAttributes(html, ctx), html;
147923
147911
  }
147924
147912
  var HOP_BY_HOP_HEADERS = [
147925
147913
  "connection",
@@ -147930,7 +147918,9 @@ var HOP_BY_HOP_HEADERS = [
147930
147918
  "trailer",
147931
147919
  "transfer-encoding",
147932
147920
  "upgrade",
147933
- "content-security-policy"
147921
+ "expect",
147922
+ "content-security-policy",
147923
+ "host"
147934
147924
  ];
147935
147925
  function patchProxiedResponseHeaders(ctx, event, response) {
147936
147926
  clearResponseHeaders(event, HOP_BY_HOP_HEADERS);
@@ -147949,7 +147939,7 @@ function patchProxiedResponseHeaders(ctx, event, response) {
147949
147939
  }
147950
147940
  }
147951
147941
  function getProxyStorefrontHeaders(event) {
147952
- let proxyRequestHeaders = getProxyRequestHeaders(event);
147942
+ let proxyRequestHeaders = getRequestHeaders(event);
147953
147943
  for (let headerKey of HOP_BY_HOP_HEADERS)
147954
147944
  delete proxyRequestHeaders[headerKey];
147955
147945
  delete proxyRequestHeaders["upgrade-insecure-requests"];
@@ -148083,7 +148073,7 @@ function getAssetsHandler(_theme, ctx) {
148083
148073
  isUnsynced && sendError(event, createError({ statusCode: 404, statusMessage: "Not found" }));
148084
148074
  return;
148085
148075
  }
148086
- let fileContent = file.value ? injectCdnProxy(file.value, ctx) : Buffer.from(file.attachment ?? "", "base64");
148076
+ let fileContent = file.value ? Buffer.from(injectCdnProxy(file.value, ctx)) : Buffer.from(file.attachment ?? "", "base64");
148087
148077
  return serveStatic(event, {
148088
148078
  getContents: () => fileContent,
148089
148079
  // Note: stats.size is the length of the base64 string for attachments,
@@ -148101,7 +148091,7 @@ function findLocalFile(event, ctx) {
148101
148091
  return { file, isUnsynced, fileKey };
148102
148092
  }
148103
148093
  };
148104
- return tryGetFile(/^\/cdn\/.*?\/assets\/([^?]+)(\?|$)/, ctx.localThemeFileSystem) ?? tryGetFile(/^\/ext\/cdn\/extensions\/.*?\/.*?\/assets\/([^?]+)(\?|$)/, ctx.localThemeExtensionFileSystem) ?? {
148094
+ return tryGetFile(/^\/cdn\/.*?\/assets\/([^?]+)/, ctx.localThemeFileSystem) ?? tryGetFile(/^\/ext\/cdn\/extensions\/.*?\/assets\/([^?]+)/, ctx.localThemeExtensionFileSystem) ?? {
148105
148095
  isUnsynced: !1,
148106
148096
  fileKey: void 0,
148107
148097
  file: void 0
@@ -148215,7 +148205,7 @@ function getHtmlHandler(theme, ctx) {
148215
148205
  replaceTemplates: getInMemoryTemplates(ctx, browserPathname, getCookie2(event, "localization")?.toLowerCase())
148216
148206
  }).then(async (response) => {
148217
148207
  let html = await patchRenderingResponse(ctx, event, response);
148218
- return html = prettifySyntaxErrors(html), ctx.options.liveReload !== "off" && (html = injectHotReloadScript(html)), html;
148208
+ return html = prettifySyntaxErrors(html), assertThemeId(response, html, String(theme.id)), ctx.options.liveReload !== "off" && (html = injectHotReloadScript(html)), html;
148219
148209
  }).catch(async (error) => {
148220
148210
  let headline = `Failed to render storefront with status ${error.statusCode} (${error.statusMessage}).`;
148221
148211
  error.data?.requestId && (headline += `
@@ -148227,7 +148217,7 @@ URL: ${error.data.url}`);
148227
148217
  `), errorPageHtml = getErrorPage({
148228
148218
  title,
148229
148219
  header: title,
148230
- message: [...rest, error.message].join("<br>"),
148220
+ message: [...rest, cause?.message ?? error.message].join("<br>"),
148231
148221
  code: error.stack?.replace(`${error.message}
148232
148222
  `, "") ?? ""
148233
148223
  });
@@ -148264,6 +148254,14 @@ function getErrorPage(options) {
148264
148254
  </body>
148265
148255
  </html>`;
148266
148256
  }
148257
+ function assertThemeId(response, html, expectedThemeId) {
148258
+ let obtainedThemeId = html.match(/Shopify\.theme\s*=\s*{[^}]+?"id":\s*"?(\d+)"?(}|,)/)?.[1];
148259
+ obtainedThemeId && obtainedThemeId !== expectedThemeId && (renderFatalError(new AbortError(`Theme ID mismatch: expected ${expectedThemeId} but got ${obtainedThemeId}.
148260
+ Request ID: ${response.headers.get("x-request-id")}
148261
+ URL: ${response.url}`, `This is likely related to an issue in upstream Shopify APIs.
148262
+ Please try again in a few minutes and report this issue:
148263
+ https://github.com/Shopify/cli/issues/new?template=bug-report.yml`)), process.exit(1));
148264
+ }
148267
148265
 
148268
148266
  // ../theme/dist/cli/utilities/theme-environment/hot-reload/server.js
148269
148267
  var import_theme_check_node3 = __toESM(require_dist5(), 1);
@@ -148297,7 +148295,7 @@ function getInMemoryTemplates(ctx, currentRoute, locale) {
148297
148295
  }
148298
148296
  return inMemoryTemplates;
148299
148297
  }
148300
- function setupInMemoryTemplateWatcher2(theme, ctx) {
148298
+ function setupInMemoryTemplateWatcher2(ctx) {
148301
148299
  let handleFileUpdate = ({ fileKey, onContent, onSync }) => {
148302
148300
  let extension = extname(fileKey);
148303
148301
  fileKey.startsWith("assets/") ? extension === ".liquid" ? onSync(() => triggerHotReload(fileKey, ctx)) : triggerHotReload(fileKey, ctx) : needsTemplateUpdate(fileKey) ? onContent((content) => {
@@ -148307,7 +148305,6 @@ function setupInMemoryTemplateWatcher2(theme, ctx) {
148307
148305
  return ctx.localThemeFileSystem.addEventListener("add", handleFileUpdate), ctx.localThemeFileSystem.addEventListener("change", handleFileUpdate), ctx.localThemeFileSystem.addEventListener("unlink", ({ fileKey }) => {
148308
148306
  sectionNamesByFile.delete(fileKey), triggerHotReload(fileKey, ctx);
148309
148307
  }), ctx.localThemeFileSystem.ready().then(async () => {
148310
- await ctx.localThemeFileSystem.startWatcher(theme.id.toString(), ctx.session);
148311
148308
  let files = [...ctx.localThemeFileSystem.files];
148312
148309
  return Promise.allSettled(files.map(async ([fileKey, file]) => {
148313
148310
  if (fileKey.endsWith(".json")) {
@@ -148410,7 +148407,7 @@ function hotReloadSections(key, ctx) {
148410
148407
  for (let [type, name] of sections)
148411
148408
  type === sectionId && sectionsToUpdate.add(name);
148412
148409
  }
148413
- sectionsToUpdate.size > 0 && emitHotReloadEvent({ type: "section", key, names: [...sectionsToUpdate] });
148410
+ sectionsToUpdate.size > 0 ? emitHotReloadEvent({ type: "section", key, names: [...sectionsToUpdate] }) : emitHotReloadEvent({ type: "full", key });
148414
148411
  }
148415
148412
  function injectHotReloadScript(html) {
148416
148413
  return html.replace(/<\/head>/, `${getClientScripts()}</head>`);
@@ -148783,8 +148780,7 @@ function reportFailedUploads(uploadResults) {
148783
148780
  // ../theme/dist/cli/utilities/theme-environment/theme-environment.js
148784
148781
  import { createServer as createServer2 } from "node:http";
148785
148782
  function setupDevServer(theme, ctx) {
148786
- let watcherPromise = setupInMemoryTemplateWatcher2(theme, ctx), envSetup = ensureThemeEnvironmentSetup(theme, ctx), workPromise = Promise.all([watcherPromise, envSetup.workPromise]).then(() => {
148787
- }), server = createDevelopmentServer(theme, ctx, workPromise);
148783
+ let watcherPromise = setupInMemoryTemplateWatcher2(ctx), envSetup = ensureThemeEnvironmentSetup(theme, ctx), workPromise = Promise.all([watcherPromise, envSetup.workPromise]).then(() => ctx.localThemeFileSystem.startWatcher(theme.id.toString(), ctx.session)), server = createDevelopmentServer(theme, ctx, workPromise);
148788
148784
  return {
148789
148785
  workPromise,
148790
148786
  serverStart: server.start,
@@ -149737,7 +149733,24 @@ function notNull(value) {
149737
149733
  }
149738
149734
 
149739
149735
  // ../theme/dist/cli/services/pull.js
149740
- async function pull(theme, session, options) {
149736
+ async function pull(flags) {
149737
+ showEmbeddedCLIWarning();
149738
+ let store = ensureThemeStore({ store: flags.store }), adminSession = await ensureAuthenticatedThemes(store, flags.password), developmentThemeManager = new DevelopmentThemeManager(adminSession), developmentTheme = await (flags.development ? developmentThemeManager.find() : developmentThemeManager.fetch()), { path: path3, nodelete, live, development, only, ignore, force } = flags, theme = await findOrSelectTheme(adminSession, {
149739
+ header: "Select a theme to open",
149740
+ filter: {
149741
+ live,
149742
+ theme: development ? `${developmentTheme?.id}` : flags.theme
149743
+ }
149744
+ });
149745
+ await executePull(theme, adminSession, {
149746
+ path: path3 || cwd(),
149747
+ nodelete: nodelete || !1,
149748
+ only: only || [],
149749
+ ignore: ignore || [],
149750
+ force: force || !1
149751
+ });
149752
+ }
149753
+ async function executePull(theme, session, options) {
149741
149754
  let path3 = options.path, force = options.force;
149742
149755
  if (!await isEmptyDir(path3) && !await hasRequiredThemeDirectories(path3) && !await currentDirectoryConfirmed(force))
149743
149756
  return;
@@ -149777,21 +149790,25 @@ var import_core12 = __toESM(require_lib(), 1);
149777
149790
  var _a10, Pull = class extends ThemeCommand {
149778
149791
  async run() {
149779
149792
  showEmbeddedCLIWarning();
149780
- let { flags } = await this.parse(_a10), store = ensureThemeStore(flags), adminSession = await ensureAuthenticatedThemes(store, flags.password), developmentThemeManager = new DevelopmentThemeManager(adminSession), developmentTheme = await (flags.development ? developmentThemeManager.find() : developmentThemeManager.fetch());
149781
- if (!flags.legacy) {
149782
- let { path: path3, nodelete, live, development, only, ignore, force } = flags, theme = await findOrSelectTheme(adminSession, {
149783
- header: "Select a theme to open",
149784
- filter: {
149785
- live,
149786
- theme: development ? `${developmentTheme?.id}` : flags.theme
149787
- }
149788
- });
149789
- await pull(theme, adminSession, { path: path3, nodelete, only, ignore, force });
149790
- return;
149791
- }
149792
- let flagsForCli2 = flags;
149793
+ let { flags } = await this.parse(_a10), pullFlags = {
149794
+ path: flags.path,
149795
+ password: flags.password,
149796
+ environment: flags.environment,
149797
+ store: flags.store,
149798
+ theme: flags.theme,
149799
+ development: flags.development,
149800
+ live: flags.live,
149801
+ nodelete: flags.nodelete,
149802
+ only: flags.only,
149803
+ ignore: flags.ignore,
149804
+ force: flags.force
149805
+ };
149806
+ flags.legacy ? await this.execLegacy() : await pull(pullFlags);
149807
+ }
149808
+ async execLegacy() {
149809
+ let { flags } = await this.parse(_a10), store = ensureThemeStore({ store: flags.store }), adminSession = await ensureAuthenticatedThemes(store, flags.password), developmentThemeManager = new DevelopmentThemeManager(adminSession), developmentTheme = await (flags.development ? developmentThemeManager.find() : developmentThemeManager.fetch()), flagsForCli2 = flags;
149793
149810
  developmentTheme && (flagsForCli2.development && (flagsForCli2.theme = `${developmentTheme.id}`, flagsForCli2.development = !1), useEmbeddedThemeCLI() && (flagsForCli2["development-theme-id"] = developmentTheme.id));
149794
- let flagsToPass = this.passThroughFlags(flagsForCli2, { allowedFlags: _a10.cli2Flags }), command = ["theme", "pull", flagsForCli2.path, ...flagsToPass];
149811
+ let flagsToPass = this.passThroughFlags(flagsForCli2, { allowedFlags: _a10.cli2Flags }), command = ["theme", "pull", flagsForCli2.path, ...flagsToPass].filter((arg) => arg !== void 0);
149795
149812
  await execCLI2(command, { store, adminToken: adminSession.token });
149796
149813
  }
149797
149814
  };
@@ -149856,7 +149873,22 @@ init_cjs_shims();
149856
149873
 
149857
149874
  // ../theme/dist/cli/services/push.js
149858
149875
  init_cjs_shims();
149859
- async function push(theme, session, options) {
149876
+ async function push(flags) {
149877
+ let { path: path3 } = flags, force = flags.force ?? !1, store = ensureThemeStore({ store: flags.store }), adminSession = await ensureAuthenticatedThemes(store, flags.password), workingDirectory = path3 ? resolvePath(path3) : cwd();
149878
+ if (!await hasRequiredThemeDirectories(workingDirectory) && !await currentDirectoryConfirmed(force))
149879
+ return;
149880
+ let selectedTheme = await createOrSelectTheme(adminSession, flags);
149881
+ selectedTheme && await executePush(selectedTheme, adminSession, {
149882
+ path: workingDirectory,
149883
+ nodelete: flags.nodelete || !1,
149884
+ publish: flags.publish || !1,
149885
+ json: flags.json || !1,
149886
+ force,
149887
+ ignore: flags.ignore || [],
149888
+ only: flags.only || []
149889
+ });
149890
+ }
149891
+ async function executePush(theme, session, options) {
149860
149892
  let themeChecksums = await fetchChecksums(theme.id, session), themeFileSystem = mountThemeFileSystem(options.path, { filters: options }), { uploadResults, renderThemeSyncProgress } = await uploadTheme(theme, session, themeChecksums, themeFileSystem, options);
149861
149893
  await renderThemeSyncProgress(), options.publish && await publishTheme(theme.id, session), await handlePushOutput(uploadResults, theme, session, options);
149862
149894
  }
@@ -149917,29 +149949,76 @@ function handleOutput(theme, hasErrors, session) {
149917
149949
  nextSteps
149918
149950
  });
149919
149951
  }
149952
+ async function createOrSelectTheme(adminSession, flags) {
149953
+ let { live, development, unpublished, theme } = flags;
149954
+ if (development)
149955
+ return new DevelopmentThemeManager(adminSession).findOrCreate();
149956
+ if (unpublished) {
149957
+ let themeName = theme || await promptThemeName("Name of the new theme");
149958
+ return createTheme({
149959
+ name: themeName,
149960
+ role: UNPUBLISHED_THEME_ROLE
149961
+ }, adminSession);
149962
+ } else {
149963
+ let selectedTheme = await findOrSelectTheme(adminSession, {
149964
+ header: "Select a theme to push to:",
149965
+ filter: {
149966
+ live,
149967
+ theme
149968
+ }
149969
+ });
149970
+ if (await confirmPushToTheme(selectedTheme.role, flags["allow-live"], adminSession.storeFqdn))
149971
+ return selectedTheme;
149972
+ }
149973
+ }
149974
+ async function confirmPushToTheme(themeRole, allowLive, storeFqdn) {
149975
+ if (themeRole === LIVE_THEME_ROLE) {
149976
+ if (allowLive)
149977
+ return !0;
149978
+ let options = {
149979
+ message: `Push theme files to the ${themeRole} theme on ${storeFqdn}?`,
149980
+ confirmationMessage: "Yes, confirm changes",
149981
+ cancellationMessage: "Cancel"
149982
+ };
149983
+ return renderConfirmationPrompt(options);
149984
+ }
149985
+ return !0;
149986
+ }
149920
149987
 
149921
149988
  // ../theme/dist/cli/commands/theme/push.js
149922
149989
  var import_core13 = __toESM(require_lib(), 1);
149923
149990
  var _a11, Push = class extends ThemeCommand {
149924
149991
  async run() {
149925
- let { flags } = await this.parse(_a11), { path: path3, force } = flags, store = ensureThemeStore(flags), adminSession = await ensureAuthenticatedThemes(store, flags.password), workingDirectory = path3 ? resolvePath(path3) : cwd();
149926
- if (!await hasRequiredThemeDirectories(workingDirectory) && !await currentDirectoryConfirmed(force))
149927
- return;
149928
- if (!flags.legacy && !flags.password) {
149929
- let { path: path4, nodelete, publish: publish2, json, force: force2, ignore, only } = flags, selectedTheme = await createOrSelectTheme(adminSession, flags);
149930
- if (!selectedTheme)
149931
- return;
149932
- await push(selectedTheme, adminSession, {
149933
- path: path4,
149934
- nodelete,
149935
- publish: publish2,
149936
- json,
149937
- force: force2,
149938
- ignore,
149939
- only
149940
- });
149992
+ let { flags } = await this.parse(_a11);
149993
+ if (flags.password || flags.legacy) {
149994
+ await this.execLegacyPush();
149941
149995
  return;
149942
149996
  }
149997
+ let pushFlags = {
149998
+ path: flags.path,
149999
+ password: flags.password,
150000
+ store: flags.store,
150001
+ environment: flags.environment,
150002
+ theme: flags.theme,
150003
+ development: flags.development,
150004
+ live: flags.live,
150005
+ unpublished: flags.unpublished,
150006
+ nodelete: flags.nodelete,
150007
+ only: flags.only,
150008
+ ignore: flags.ignore,
150009
+ json: flags.json,
150010
+ allowLive: flags["allow-live"],
150011
+ publish: flags.publish,
150012
+ force: flags.force,
150013
+ noColor: flags["no-color"],
150014
+ verbose: flags.verbose
150015
+ };
150016
+ await push(pushFlags);
150017
+ }
150018
+ async execLegacyPush() {
150019
+ let { flags } = await this.parse(_a11), path3 = flags.path || cwd(), force = flags.force || !1, store = ensureThemeStore({ store: flags.store }), adminSession = await ensureAuthenticatedThemes(store, flags.password), workingDirectory = path3 ? resolvePath(path3) : cwd();
150020
+ if (!await hasRequiredThemeDirectories(workingDirectory) && !await currentDirectoryConfirmed(force))
150021
+ return;
149943
150022
  let flagsForCli2 = flags;
149944
150023
  showEmbeddedCLIWarning();
149945
150024
  let developmentThemeManager = new DevelopmentThemeManager(adminSession), targetTheme = await (flagsForCli2.development ? developmentThemeManager.findOrCreate() : developmentThemeManager.fetch());
@@ -150064,41 +150143,6 @@ Push.cli2Flags = [
150064
150143
  "development-theme-id"
150065
150144
  ];
150066
150145
  var push_default = Push;
150067
- async function createOrSelectTheme(adminSession, flags) {
150068
- let { live, development, unpublished, theme } = flags;
150069
- if (development)
150070
- return new DevelopmentThemeManager(adminSession).findOrCreate();
150071
- if (unpublished) {
150072
- let themeName = theme || await promptThemeName("Name of the new theme");
150073
- return createTheme({
150074
- name: themeName,
150075
- role: UNPUBLISHED_THEME_ROLE
150076
- }, adminSession);
150077
- } else {
150078
- let selectedTheme = await findOrSelectTheme(adminSession, {
150079
- header: "Select a theme to push to:",
150080
- filter: {
150081
- live,
150082
- theme
150083
- }
150084
- });
150085
- if (await confirmPushToTheme(selectedTheme.role, flags["allow-live"], adminSession.storeFqdn))
150086
- return selectedTheme;
150087
- }
150088
- }
150089
- async function confirmPushToTheme(themeRole, allowLive, storeFqdn) {
150090
- if (themeRole === LIVE_THEME_ROLE) {
150091
- if (allowLive)
150092
- return !0;
150093
- let options = {
150094
- message: `Push theme files to the ${themeRole} theme on ${storeFqdn}?`,
150095
- confirmationMessage: "Yes, confirm changes",
150096
- cancellationMessage: "Cancel"
150097
- };
150098
- return renderConfirmationPrompt(options);
150099
- }
150100
- return !0;
150101
- }
150102
150146
 
150103
150147
  // ../theme/dist/cli/commands/theme/rename.js
150104
150148
  init_cjs_shims();
@@ -150479,8 +150523,8 @@ async function checkLockfileStatus(directory, shouldExit = !1) {
150479
150523
  if (isHydrogenMonorepo && !process.env.SHOPIFY_UNIT_TEST)
150480
150524
  return;
150481
150525
  let foundPackageManagers = [];
150482
- for (let packageManager2 of packageManagers)
150483
- await fileExists(resolvePath(directory, packageManager2.lockfile)) && foundPackageManagers.push(packageManager2);
150526
+ for (let packageManager of packageManagers)
150527
+ await fileExists(resolvePath(directory, packageManager.lockfile)) && foundPackageManagers.push(packageManager);
150484
150528
  if (foundPackageManagers.length === 0)
150485
150529
  return missingLockfileWarning(shouldExit);
150486
150530
  if (foundPackageManagers.length > 1)
@@ -150956,7 +151000,7 @@ async function runClassicCompilerBuild({
150956
151000
  if (!disableRouteWarning) {
150957
151001
  let missingRoutes = findMissingRoutes(remixConfig);
150958
151002
  if (missingRoutes.length) {
150959
- let packageManager2 = await getPackageManager(root), exec2 = packageManager2 === "npm" ? "npx" : packageManager2;
151003
+ let packageManager = await getPackageManager(root), exec2 = packageManager === "npm" ? "npx" : packageManager;
150960
151004
  outputWarn(
150961
151005
  `Heads up: Shopify stores have a number of standard routes that aren\u2019t set up yet.
150962
151006
  Some functionality and backlinks might not work as expected until these are created or redirects are set up.
@@ -151301,7 +151345,7 @@ async function runBuild({
151301
151345
  if (!watch && !disableRouteWarning) {
151302
151346
  let missingRoutes = findMissingRoutes(remixConfig);
151303
151347
  if (missingRoutes.length) {
151304
- let packageManager2 = await getPackageManager(root), exec2 = packageManager2 === "npm" ? "npx" : packageManager2;
151348
+ let packageManager = await getPackageManager(root), exec2 = packageManager === "npm" ? "npx" : packageManager;
151305
151349
  outputWarn(
151306
151350
  `Heads up: Shopify stores have a number of standard routes that aren\u2019t set up yet.
151307
151351
  Some functionality and backlinks might not work as expected until these are created or redirects are set up.
@@ -153615,7 +153659,7 @@ file://${instrunctionsFilePath}`;
153615
153659
  let releaseNotesUrl = `https://hydrogen.shopify.dev/releases/${selectedRelease.version}`;
153616
153660
  nextSteps.push(`Release notes:
153617
153661
  ${releaseNotesUrl}`);
153618
- let currentPinnedVersion = getAbsoluteVersion(currentVersion), selectedPinnedVersion = getAbsoluteVersion(selectedRelease.version), upgradedDependenciesOnly = currentPinnedVersion === selectedPinnedVersion, fromToMsg = `${currentPinnedVersion} \u2192 ${selectedPinnedVersion}`, headline = upgradedDependenciesOnly ? `You've have upgraded Hydrogen ${selectedPinnedVersion} dependencies` : `You've have upgraded from ${fromToMsg}`, packageManager2 = await getPackageManager(appPath);
153662
+ let currentPinnedVersion = getAbsoluteVersion(currentVersion), selectedPinnedVersion = getAbsoluteVersion(selectedRelease.version), upgradedDependenciesOnly = currentPinnedVersion === selectedPinnedVersion, fromToMsg = `${currentPinnedVersion} \u2192 ${selectedPinnedVersion}`, headline = upgradedDependenciesOnly ? `You've have upgraded Hydrogen ${selectedPinnedVersion} dependencies` : `You've have upgraded from ${fromToMsg}`, packageManager = await getPackageManager(appPath);
153619
153663
  return renderSuccess({
153620
153664
  headline,
153621
153665
  // @ts-ignore we know that filter(Boolean) will always return an array
@@ -153646,7 +153690,7 @@ ${releaseNotesUrl}`);
153646
153690
  {
153647
153691
  list: {
153648
153692
  items: [
153649
- `Run \`git restore . && git clean -df && ${packageManager2} i\``
153693
+ `Run \`git restore . && git clean -df && ${packageManager} i\``
153650
153694
  ]
153651
153695
  }
153652
153696
  }
@@ -153836,10 +153880,10 @@ async function buildAssetsUrl(port, root) {
153836
153880
  async function startMiniOxygen(options, useNodeRuntime = !1) {
153837
153881
  if (useNodeRuntime) {
153838
153882
  process.env.MINIFLARE_SUBREQUEST_LIMIT = 100;
153839
- let { startNodeServer } = await import("./node-V2ZJPWY5.js");
153883
+ let { startNodeServer } = await import("./node-NWOSUD3V.js");
153840
153884
  return startNodeServer(options);
153841
153885
  }
153842
- let { startWorkerdServer } = await import("./workerd-TOCBV52P.js");
153886
+ let { startWorkerdServer } = await import("./workerd-VWTWLJIV.js");
153843
153887
  return startWorkerdServer(options);
153844
153888
  }
153845
153889
 
@@ -154939,27 +154983,27 @@ async function runEnvPush({
154939
154983
  ({ id }) => id === pushToBranchSelection
154940
154984
  );
154941
154985
  }
154942
- let { environmentVariables: environmentVariables2 = [] } = await getStorefrontEnvVariables(
154986
+ let { environmentVariables = [] } = await getStorefrontEnvVariables(
154943
154987
  session,
154944
154988
  config2.storefront.id,
154945
154989
  validatedEnvironment.handle
154946
- ) ?? {}, comparableRemoteVars = environmentVariables2.filter(
154990
+ ) ?? {}, comparableRemoteVars = environmentVariables.filter(
154947
154991
  ({ isSecret, readOnly }) => !isSecret && !readOnly
154948
154992
  ).sort((a, b) => a.key.localeCompare(b.key)).map(({ key, value }) => createDotEnvFileLine(key, value)).join(`
154949
154993
  `) + `
154950
154994
  `, compareableLocalVars = Object.keys(localVariables).sort((a, b) => a.localeCompare(b)).reduce((acc, key) => {
154951
- let { isSecret, readOnly } = environmentVariables2.find((variable) => variable.key === key) ?? {};
154995
+ let { isSecret, readOnly } = environmentVariables.find((variable) => variable.key === key) ?? {};
154952
154996
  return isSecret || readOnly ? acc : [...acc, createDotEnvFileLine(key, localVariables[key])];
154953
154997
  }, []).join(`
154954
154998
  `) + `
154955
154999
  `;
154956
155000
  if (!validatedEnvironment.name)
154957
155001
  throw new AbortError("Missing environment name");
154958
- let remoteReadOnlyOrSecrets = environmentVariables2.reduce(
155002
+ let remoteReadOnlyOrSecrets = environmentVariables.reduce(
154959
155003
  (acc, { isSecret, readOnly, key }) => {
154960
155004
  if (!isSecret && !readOnly)
154961
155005
  return acc;
154962
- let localVar = localVariables[key], remoteVar = environmentVariables2.find(
155006
+ let localVar = localVariables[key], remoteVar = environmentVariables.find(
154963
155007
  (variable) => variable.key === key
154964
155008
  );
154965
155009
  return localVar === remoteVar?.value ? acc : [...acc, key];
@@ -155140,9 +155184,9 @@ async function checkCurrentCLIVersion() {
155140
155184
  label: "Global CLI reference",
155141
155185
  url: "https://shopify.dev/docs/api/shopify-cli/"
155142
155186
  }
155143
- }), (packageManager2) => {
155144
- packageManager2 ??= packageManagerFromUserAgent(), (packageManager2 === "unknown" || !packageManager2) && (packageManager2 = inferPackageManagerForGlobalCLI()), packageManager2 === "unknown" && (packageManager2 = "npm");
155145
- let installMessage = pkgName === UPGRADABLE_CLI_NAMES.cli ? `Please install the latest Shopify CLI version with \`${packageManager2 === "yarn" ? `yarn global add ${UPGRADABLE_CLI_NAMES.cli}` : `${packageManager2} install -g ${UPGRADABLE_CLI_NAMES.cli}`}\` and try again.` : `Please use the latest version with \`${packageManager2} create @shopify/hydrogen@latest\``;
155187
+ }), (packageManager) => {
155188
+ packageManager ??= packageManagerFromUserAgent(), (packageManager === "unknown" || !packageManager) && (packageManager = inferPackageManagerForGlobalCLI()), packageManager === "unknown" && (packageManager = "npm");
155189
+ let installMessage = pkgName === UPGRADABLE_CLI_NAMES.cli ? `Please install the latest Shopify CLI version with \`${packageManager === "yarn" ? `yarn global add ${UPGRADABLE_CLI_NAMES.cli}` : `${packageManager} install -g ${UPGRADABLE_CLI_NAMES.cli}`}\` and try again.` : `Please use the latest version with \`${packageManager} create @shopify/hydrogen@latest\``;
155146
155190
  return renderInfo({
155147
155191
  headline: "Upgrade available",
155148
155192
  body: `Version ${newVersionAvailable} of ${pkgName} is now available.
@@ -155274,17 +155318,17 @@ async function setupLocalStarterTemplate(options, controller) {
155274
155318
  "Setup " + CSS_STRATEGY_NAME_MAP[cssStrategy]
155275
155319
  ) : void 0
155276
155320
  ));
155277
- let { packageManager: packageManager2, shouldInstallDeps, installDeps } = await handleDependencies(
155321
+ let { packageManager, shouldInstallDeps, installDeps } = await handleDependencies(
155278
155322
  project.directory,
155279
155323
  controller,
155280
155324
  options.packageManager,
155281
155325
  options.installDeps
155282
155326
  ), setupSummary = {
155283
155327
  language,
155284
- packageManager: packageManager2,
155328
+ packageManager,
155285
155329
  cssStrategy,
155286
155330
  depsInstalled: !1,
155287
- cliCommand: await getCliCommand("", packageManager2)
155331
+ cliCommand: await getCliCommand("", packageManager)
155288
155332
  };
155289
155333
  if (shouldInstallDeps) {
155290
155334
  let installingDepsPromise = backgroundWorkPromise.then(async () => {
@@ -155519,16 +155563,16 @@ async function setupRemoteTemplate(options, controller) {
155519
155563
  backgroundWorkPromise = backgroundWorkPromise.then(() => transpileProject().catch(abort2)).then(
155520
155564
  () => options.git ? createInitialCommit(project.directory) : void 0
155521
155565
  );
155522
- let { packageManager: packageManager2, shouldInstallDeps, installDeps } = await handleDependencies(
155566
+ let { packageManager, shouldInstallDeps, installDeps } = await handleDependencies(
155523
155567
  project.directory,
155524
155568
  controller,
155525
155569
  options.packageManager,
155526
155570
  options.installDeps
155527
155571
  ), setupSummary = {
155528
155572
  language,
155529
- packageManager: packageManager2,
155573
+ packageManager,
155530
155574
  depsInstalled: !1,
155531
- cliCommand: await getCliCommand("", packageManager2)
155575
+ cliCommand: await getCliCommand("", packageManager)
155532
155576
  }, tasks = [
155533
155577
  {
155534
155578
  title: "Downloading template",
@@ -156087,10 +156131,10 @@ ${CSS_STRATEGY_HELP_URL_MAP[strategy]}`
156087
156131
  tasks.push({
156088
156132
  title: "Installing new dependencies",
156089
156133
  task: async () => {
156090
- let packageManager2 = await gettingPkgManagerPromise;
156091
- isNpm = packageManager2 === "npm" || packageManager2 === "unknown", await installNodeModules({
156134
+ let packageManager = await gettingPkgManagerPromise;
156135
+ isNpm = packageManager === "npm" || packageManager === "unknown", await installNodeModules({
156092
156136
  directory: remixConfig.rootDirectory,
156093
- packageManager: packageManager2,
156137
+ packageManager,
156094
156138
  args: []
156095
156139
  });
156096
156140
  }
@@ -158277,7 +158321,7 @@ init_cjs_shims();
158277
158321
 
158278
158322
  // ../app/dist/cli/models/extensions/schemas.js
158279
158323
  init_cjs_shims();
158280
- var MAX_EXTENSION_HANDLE_LENGTH = 30, MetafieldSchema = z.object({
158324
+ var MAX_EXTENSION_HANDLE_LENGTH = 50, MetafieldSchema = z.object({
158281
158325
  namespace: z.string(),
158282
158326
  key: z.string()
158283
158327
  }), CollectBuyerConsentCapabilitySchema = z.object({
@@ -158466,6 +158510,17 @@ function createContractBasedConfigModuleSpecification(identifier, ...topLevelKey
158466
158510
  }
158467
158511
  });
158468
158512
  }
158513
+ function createContractBasedModuleSpecification(identifier, appModuleFeatures) {
158514
+ return createExtensionSpecification({
158515
+ identifier,
158516
+ schema: z.any({}),
158517
+ appModuleFeatures: () => appModuleFeatures ?? [],
158518
+ deployConfig: async (config2, _2) => {
158519
+ let { type, handle, uid, ...configWithoutFirstClassFields } = config2;
158520
+ return configWithoutFirstClassFields;
158521
+ }
158522
+ });
158523
+ }
158469
158524
  function resolveAppConfigTransform(transformConfig) {
158470
158525
  return transformConfig ? Object.keys(transformConfig).includes("forward") ? transformConfig.forward : (content) => appConfigTransform(content, transformConfig) : (content) => defaultAppConfigTransform(content);
158471
158526
  }
@@ -159591,9 +159646,9 @@ async function handlePartnersErrors(request2) {
159591
159646
  return await request2();
159592
159647
  } catch (error) {
159593
159648
  if (error.errors?.[0]?.extensions?.type === "unsupported_client_version") {
159594
- let packageManager2 = await getPackageManager(cwd());
159649
+ let packageManager = await getPackageManager(cwd());
159595
159650
  throw new AbortError(["Upgrade your CLI version to run the", { command: "deploy" }, "command."], null, [
159596
- ["Run", { command: formatPackageManagerCommand(packageManager2, "shopify upgrade") }]
159651
+ ["Run", { command: formatPackageManagerCommand(packageManager, "shopify upgrade") }]
159597
159652
  ]);
159598
159653
  }
159599
159654
  throw error;
@@ -159796,7 +159851,7 @@ var CONFIG_EXTENSION_IDS = [
159796
159851
  return this.configuration.handle ?? slugify(this.configuration.name ?? "");
159797
159852
  case "dynamic":
159798
159853
  let subscription = this.configuration, handle = `${subscription.topic}${subscription.uri}${subscription.filter}`;
159799
- return hashString(handle).substring(0, 30);
159854
+ return hashString(handle).substring(0, MAX_EXTENSION_HANDLE_LENGTH);
159800
159855
  }
159801
159856
  }
159802
159857
  };
@@ -160907,8 +160962,8 @@ var WebConfigurationAuthCallbackPathSchema = z.preprocess(ensurePathStartsWithSl
160907
160962
  baseWebConfigurationSchema.extend({ roles: z.array(webTypes) }),
160908
160963
  baseWebConfigurationSchema.extend({ type: webTypes })
160909
160964
  ]), ProcessedWebConfigurationSchema = baseWebConfigurationSchema.extend({ roles: z.array(webTypes) }), App = class {
160910
- constructor({ name, directory, packageManager: packageManager2, configuration, nodeDependencies, webs, modules, usesWorkspaces: usesWorkspaces2, dotenv, errors: errors2, specifications, configSchema, remoteFlags }) {
160911
- this.idEnvironmentVariableName = "SHOPIFY_API_KEY", this.name = name, this.directory = directory, this.packageManager = packageManager2, this.configuration = configuration, this.nodeDependencies = nodeDependencies, this.webs = webs, this.dotenv = dotenv, this.realExtensions = modules, this.errors = errors2, this.usesWorkspaces = usesWorkspaces2, this.specifications = specifications, this.configSchema = configSchema ?? AppSchema, this.remoteFlags = remoteFlags ?? [];
160965
+ constructor({ name, directory, packageManager, configuration, nodeDependencies, webs, modules, usesWorkspaces: usesWorkspaces2, dotenv, errors: errors2, specifications, configSchema, remoteFlags }) {
160966
+ this.idEnvironmentVariableName = "SHOPIFY_API_KEY", this.name = name, this.directory = directory, this.packageManager = packageManager, this.configuration = configuration, this.nodeDependencies = nodeDependencies, this.webs = webs, this.dotenv = dotenv, this.realExtensions = modules, this.errors = errors2, this.usesWorkspaces = usesWorkspaces2, this.specifications = specifications, this.configSchema = configSchema ?? AppSchema, this.remoteFlags = remoteFlags ?? [];
160912
160967
  }
160913
160968
  get allExtensions() {
160914
160969
  return this.remoteFlags.includes(Flag.DeclarativeWebhooks) || this.filterDeclarativeWebhooksConfig(), this.includeConfigOnDeploy ? this.realExtensions : this.realExtensions.filter((ext) => !ext.isAppConfigExtension);
@@ -161269,9 +161324,7 @@ function updateURLsPrompt(currentAppUrl, currentRedirectUrls) {
161269
161324
  // ../app/dist/cli/services/dev/select-app.js
161270
161325
  async function selectOrCreateApp(localAppName, apps, hasMorePages, org, developerPlatformClient, options) {
161271
161326
  let createNewApp = apps.length === 0;
161272
- if (createNewApp || (outputInfo(`
161273
- Before proceeding, your project needs to be associated with an app.
161274
- `), createNewApp = await createAsNewAppPrompt()), createNewApp) {
161327
+ if (createNewApp || (createNewApp = await createAsNewAppPrompt()), createNewApp) {
161275
161328
  let name = await appNamePrompt(localAppName);
161276
161329
  return developerPlatformClient.createApp(org, name, options);
161277
161330
  } else {
@@ -163055,170 +163108,7 @@ var TaxCalculationsSchema = BaseSchema.extend({
163055
163108
 
163056
163109
  // ../app/dist/cli/models/extensions/specifications/marketing_activity.js
163057
163110
  init_cjs_shims();
163058
-
163059
- // ../app/dist/cli/models/extensions/specifications/marketing_activity_schemas/marketing_activity_schema.js
163060
- init_cjs_shims();
163061
- var BaseFieldSchema = z.object({
163062
- ui_type: z.string()
163063
- }), CommonFieldSchema = BaseFieldSchema.extend({
163064
- name: z.string(),
163065
- label: z.string(),
163066
- help_text: z.string().optional(),
163067
- required: z.boolean()
163068
- }), BudgetScheduleFieldSchema = CommonFieldSchema.extend({
163069
- ui_type: z.literal("budget-schedule"),
163070
- use_scheduling: z.boolean(),
163071
- use_end_date: z.boolean(),
163072
- use_daily_budget: z.boolean(),
163073
- use_lifetime_budget: z.boolean()
163074
- }), DiscountPickerFieldSchema = CommonFieldSchema.extend({
163075
- ui_type: z.literal("discount-picker"),
163076
- min_resources: z.number().nullable(),
163077
- max_resources: z.number().nullable()
163078
- }), ScheduleFieldSchema = CommonFieldSchema.extend({
163079
- ui_type: z.literal("schedule"),
163080
- use_end_date: z.boolean()
163081
- }), ProductPickerFieldSchema = CommonFieldSchema.extend({
163082
- ui_type: z.literal("product-picker"),
163083
- allow_product_image_selection: z.boolean(),
163084
- allow_uploaded_image_as_product_image: z.boolean(),
163085
- allow_free_image_as_product_image: z.boolean(),
163086
- min_resources: z.number().optional(),
163087
- max_resources: z.number().optional(),
163088
- min_image_select_per_product: z.number().optional(),
163089
- max_image_select_per_product: z.number().optional()
163090
- }), SingleLineTextFieldSchema = CommonFieldSchema.extend({
163091
- ui_type: z.enum(["text-single-line", "text-email", "text-tel", "text-url"]),
163092
- placeholder: z.string().optional(),
163093
- min_length: z.number(),
163094
- max_length: z.number()
163095
- }), TextMultiLineFieldSchema = CommonFieldSchema.extend({
163096
- ui_type: z.literal("text-multi-line"),
163097
- placeholder: z.string(),
163098
- min_length: z.number(),
163099
- max_length: z.number()
163100
- }), DividerFieldSchema = BaseFieldSchema.extend({
163101
- ui_type: z.literal("divider"),
163102
- title: z.string(),
163103
- name: z.string()
163104
- }), SelectFieldSchema = CommonFieldSchema.extend({
163105
- ui_type: z.enum(["select-single", "select-multiple"]),
163106
- choices: z.array(z.object({
163107
- label: z.string(),
163108
- value: z.string()
163109
- }))
163110
- }), ParagraphFieldSchema = BaseFieldSchema.extend({
163111
- ui_type: z.literal("paragraph"),
163112
- heading: z.string().optional(),
163113
- body: z.string().optional()
163114
- }), TypeAheadFieldSchema = CommonFieldSchema.extend({
163115
- ui_type: z.literal("type-ahead"),
163116
- placeholder: z.string()
163117
- }), NumberFieldSchema = CommonFieldSchema.extend({
163118
- ui_type: z.enum(["number-float", "number-integer"]),
163119
- min: z.number(),
163120
- max: z.number(),
163121
- step: z.number()
163122
- }), ImagePickerFieldSchema = CommonFieldSchema.extend({
163123
- ui_type: z.literal("image-picker"),
163124
- min_resources: z.number(),
163125
- max_resources: z.number(),
163126
- allow_free_images: z.boolean(),
163127
- alt_text_required: z.boolean()
163128
- }), UISchemaMapping = {
163129
- "budget-schedule": BudgetScheduleFieldSchema,
163130
- "discount-picker": DiscountPickerFieldSchema,
163131
- schedule: ScheduleFieldSchema,
163132
- "product-picker": ProductPickerFieldSchema,
163133
- "text-single-line": SingleLineTextFieldSchema,
163134
- "text-email": SingleLineTextFieldSchema,
163135
- "text-tel": SingleLineTextFieldSchema,
163136
- "text-url": SingleLineTextFieldSchema,
163137
- "text-multi-line": TextMultiLineFieldSchema,
163138
- "select-single": SelectFieldSchema,
163139
- "select-multiple": SelectFieldSchema,
163140
- paragraph: ParagraphFieldSchema,
163141
- "type-ahead": TypeAheadFieldSchema,
163142
- "number-float": NumberFieldSchema,
163143
- "number-integer": NumberFieldSchema,
163144
- "image-picker": ImagePickerFieldSchema,
163145
- divider: DividerFieldSchema
163146
- }, MarketingActivityExtensionSchema = BaseSchema.extend({
163147
- title: z.string().min(1),
163148
- description: z.string().min(1),
163149
- api_path: z.string(),
163150
- tactic: z.enum([
163151
- "ad",
163152
- "retargeting",
163153
- "post",
163154
- "message",
163155
- "transactional",
163156
- "newsletter",
163157
- "abandoned_cart",
163158
- "affililate",
163159
- "loyalty",
163160
- "link",
163161
- "storefront_app"
163162
- ]),
163163
- marketing_channel: z.enum(["social", "search", "email", "sms", "display", "marketplace"]),
163164
- referring_domain: z.string().optional(),
163165
- is_automation: z.boolean().optional(),
163166
- use_external_editor: z.boolean().optional(),
163167
- preview_data: z.object({
163168
- types: z.array(z.object({
163169
- label: z.string(),
163170
- value: z.string()
163171
- })).max(3).min(1)
163172
- }),
163173
- fields: z.array(z.any().superRefine((val, ctx) => {
163174
- if (typeof val != "object")
163175
- return ctx.addIssue({
163176
- message: "Field must be an object",
163177
- code: z.ZodIssueCode.custom
163178
- });
163179
- if (val.ui_type === void 0)
163180
- return ctx.addIssue({
163181
- message: "Field must have a ui_type",
163182
- code: z.ZodIssueCode.custom
163183
- });
163184
- let schema = UISchemaMapping[val.ui_type];
163185
- if (schema === void 0)
163186
- return ctx.addIssue({
163187
- message: `Unknown ui_type for Field: ${val.ui_type}`,
163188
- code: z.ZodIssueCode.custom
163189
- });
163190
- let result = schema.safeParse(val);
163191
- if (!result.success)
163192
- return ctx.addIssue({
163193
- message: `Error found on Field "${val.name}": ${result.error.message}`,
163194
- code: z.ZodIssueCode.custom
163195
- });
163196
- })).min(1)
163197
- });
163198
-
163199
- // ../app/dist/cli/models/extensions/specifications/marketing_activity.js
163200
- var spec2 = createExtensionSpecification({
163201
- identifier: "marketing_activity",
163202
- schema: MarketingActivityExtensionSchema,
163203
- appModuleFeatures: (_2) => ["bundling"],
163204
- deployConfig: async (config2, _2) => ({
163205
- title: config2.title,
163206
- description: config2.description,
163207
- api_path: config2.api_path,
163208
- tactic: config2.tactic,
163209
- marketing_channel: config2.marketing_channel,
163210
- referring_domain: config2.referring_domain,
163211
- is_automation: config2.is_automation,
163212
- use_external_editor: config2.use_external_editor,
163213
- preview_data: config2.preview_data,
163214
- fields: config2.fields.map((field) => ({
163215
- ...field,
163216
- // NOTE: we're not using this id anywhere, generating it to satisfy the schema
163217
- // decided not to remove it from the schema for now to minimize the risk of breaking changes
163218
- id: randomUUID()
163219
- }))
163220
- })
163221
- }), marketing_activity_default = spec2;
163111
+ var spec2 = createContractBasedModuleSpecification("marketing_activity"), marketing_activity_default = spec2;
163222
163112
 
163223
163113
  // ../app/dist/cli/models/extensions/specifications/theme.js
163224
163114
  init_cjs_shims();
@@ -163631,7 +163521,7 @@ async function unifiedConfigurationParserFactory(merged) {
163631
163521
  return merged.parseConfigurationObject;
163632
163522
  let contract = await normaliseJsonSchema(contractJsonSchema);
163633
163523
  return (config2) => {
163634
- let zodParse = merged.parseConfigurationObject(config2), zodValidatedData = zodParse.state === "ok" ? zodParse.data : void 0, jsonSchemaParse = jsonSchemaValidate(zodValidatedData ?? config2, contract), errors2 = zodParse.errors || [];
163524
+ let zodParse = merged.parseConfigurationObject(config2), zodValidatedData = zodParse.state === "ok" ? zodParse.data : void 0, subjectForAjv = zodValidatedData ?? config2, { type, handle, uid, ...subjectForAjvWithoutFirstClassFields } = subjectForAjv, jsonSchemaParse = jsonSchemaValidate(subjectForAjvWithoutFirstClassFields, contract), errors2 = zodParse.errors || [];
163635
163525
  jsonSchemaParse.state === "error" && (errors2 = errors2.concat(jsonSchemaParse.errors));
163636
163526
  let errorSet = /* @__PURE__ */ new Set();
163637
163527
  return errors2 = errors2.filter((error) => {
@@ -163697,7 +163587,12 @@ async function link(options, shouldRenderSuccess = !0) {
163697
163587
  async function selectOrCreateRemoteAppToLinkTo(options) {
163698
163588
  let developerPlatformClient = await sniffServiceOptionsAndAppConfigToSelectPlatformClient(options), { creationOptions, appDirectory: possibleAppDirectory } = await getAppCreationDefaultsFromLocalApp(options), appDirectory = possibleAppDirectory || options.directory;
163699
163589
  if (options.apiKey) {
163700
- let remoteApp2 = await appFromId({ apiKey: options.apiKey, developerPlatformClient });
163590
+ let remoteApp2 = await appFromId({
163591
+ apiKey: options.apiKey,
163592
+ id: options.appId,
163593
+ developerPlatformClient,
163594
+ organizationId: options.organizationId
163595
+ });
163701
163596
  if (!remoteApp2) {
163702
163597
  let errorMessage2 = InvalidApiKeyErrorMessage(options.apiKey);
163703
163598
  throw new AbortError(errorMessage2.message, errorMessage2.tryMessage);
@@ -163835,7 +163730,7 @@ function buildOptionsForGeneratedConfigFile(options) {
163835
163730
  if (!isEmpty(buildOptions))
163836
163731
  return buildOptions;
163837
163732
  }
163838
- function renderSuccessMessage(configFileName, appName, packageManager2) {
163733
+ function renderSuccessMessage(configFileName, appName, packageManager) {
163839
163734
  renderSuccess({
163840
163735
  headline: `${configFileName} is now linked to "${appName}" on Shopify`,
163841
163736
  body: `Using ${configFileName} as your default config.`,
@@ -163844,7 +163739,7 @@ function renderSuccessMessage(configFileName, appName, packageManager2) {
163844
163739
  [
163845
163740
  "To upload your config, run",
163846
163741
  {
163847
- command: formatPackageManagerCommand(packageManager2, "shopify app deploy")
163742
+ command: formatPackageManagerCommand(packageManager, "shopify app deploy")
163848
163743
  }
163849
163744
  ]
163850
163745
  ],
@@ -164318,12 +164213,12 @@ async function fetchDevDataFromOptions(options, orgId, developerPlatformClient)
164318
164213
  ]), selectedStore;
164319
164214
  return options.storeFqdn && (selectedStore = orgWithStore.store, await convertToTransferDisabledStoreIfNeeded(selectedStore, orgWithStore.organization.id, developerPlatformClient, "never")), { app: selectedApp, store: selectedStore };
164320
164215
  }
164321
- async function getAppContext({ reset, directory, developerPlatformClient, configName, enableLinkingPrompt = !0 }) {
164216
+ async function getAppContext({ reset, directory, configName, enableLinkingPrompt = !0 }) {
164322
164217
  await linkIfNecessary(directory, reset, enableLinkingPrompt);
164323
164218
  let cachedInfo = getCachedAppInfo(directory), { configuration } = await loadAppConfiguration({
164324
164219
  directory,
164325
164220
  userProvidedConfigName: configName
164326
- }), remoteApp;
164221
+ }), developerPlatformClient = selectDeveloperPlatformClient({ configuration }), remoteApp;
164327
164222
  return isCurrentAppSchema(configuration) && (remoteApp = await appFromId({
164328
164223
  apiKey: configuration.client_id,
164329
164224
  id: configuration.app_id,
@@ -164428,12 +164323,12 @@ async function developerPreviewUpdate({ apiKey, developerPlatformClient, enabled
164428
164323
  async function use2({ directory, configName, warningContent, shouldRenderSuccess = !0, reset = !1 }) {
164429
164324
  if (reset) {
164430
164325
  clearCurrentConfigFile(directory);
164431
- let packageManager2 = await getPackageManager(directory);
164326
+ let packageManager = await getPackageManager(directory);
164432
164327
  renderSuccess({
164433
164328
  headline: "Cleared current configuration.",
164434
164329
  body: [
164435
164330
  "In order to set a new current configuration, please run",
164436
- { command: formatPackageManagerCommand(packageManager2, "shopify app config use CONFIG_NAME") },
164331
+ { command: formatPackageManagerCommand(packageManager, "shopify app config use CONFIG_NAME") },
164437
164332
  { char: "." }
164438
164333
  ]
164439
164334
  });
@@ -164676,12 +164571,12 @@ var alreadyShownCLIWarning = !1, AppLoader = class {
164676
164571
  async loaded() {
164677
164572
  let { configuration, directory, configurationLoadResultMetadata, configSchema } = this.loadedConfiguration;
164678
164573
  await logMetadataFromAppLoadingProcess(configurationLoadResultMetadata);
164679
- let dotenv = await loadDotEnv(directory, configuration.path), extensions = await this.loadExtensions(directory, configuration), packageJSONPath = joinPath(directory, "package.json"), name = await loadAppName(directory), nodeDependencies = await getDependencies(packageJSONPath), packageManager2 = await getPackageManager(directory);
164680
- this.showGlobalCLIWarningIfNeeded(nodeDependencies, packageManager2);
164574
+ let dotenv = await loadDotEnv(directory, configuration.path), extensions = await this.loadExtensions(directory, configuration), packageJSONPath = joinPath(directory, "package.json"), name = await loadAppName(directory), nodeDependencies = await getDependencies(packageJSONPath), packageManager = await getPackageManager(directory);
164575
+ this.showGlobalCLIWarningIfNeeded(nodeDependencies, packageManager);
164681
164576
  let { webs, usedCustomLayout: usedCustomLayoutForWeb } = await this.loadWebs(directory, configuration.web_directories), usesWorkspaces2 = await usesWorkspaces(directory), appClass = new App({
164682
164577
  name,
164683
164578
  directory,
164684
- packageManager: packageManager2,
164579
+ packageManager,
164685
164580
  configuration,
164686
164581
  nodeDependencies,
164687
164582
  webs,
@@ -164703,13 +164598,13 @@ var alreadyShownCLIWarning = !1, AppLoader = class {
164703
164598
  parseConfigurationFile(schema, filepath, decode3 = decodeToml) {
164704
164599
  return parseConfigurationFile(schema, filepath, this.abortOrReport.bind(this), decode3);
164705
164600
  }
164706
- showGlobalCLIWarningIfNeeded(nodeDependencies, packageManager2) {
164601
+ showGlobalCLIWarningIfNeeded(nodeDependencies, packageManager) {
164707
164602
  let hasLocalCLI = nodeDependencies["@shopify/cli"] !== void 0;
164708
164603
  if (currentProcessIsGlobal() && hasLocalCLI && !sniffForJson() && !alreadyShownCLIWarning) {
164709
164604
  let warningContent = {
164710
164605
  headline: "You are running a global installation of Shopify CLI",
164711
164606
  body: [
164712
- `This project has Shopify CLI as a local dependency in package.json. If you prefer to use that version, run the command with your package manager (e.g. ${packageManager2} run shopify).`
164607
+ `This project has Shopify CLI as a local dependency in package.json. If you prefer to use that version, run the command with your package manager (e.g. ${packageManager} run shopify).`
164713
164608
  ],
164714
164609
  link: {
164715
164610
  label: "For more information, see Shopify CLI documentation",
@@ -164782,7 +164677,7 @@ var alreadyShownCLIWarning = !1, AppLoader = class {
164782
164677
  let directory = dirname(configurationPath), obj = await loadConfigurationFileContent(configurationPath), { extensions, type } = ExtensionsArraySchema.parse(obj);
164783
164678
  if (extensions) {
164784
164679
  let configuration = await this.parseConfigurationFile(UnifiedSchema, configurationPath), extensionsInstancesPromises = configuration.extensions.map(async (extensionConfig) => {
164785
- let mergedConfig = { ...configuration, ...extensionConfig }, { extensions: extensions2, ...restConfig } = mergedConfig;
164680
+ let mergedConfig = { ...configuration, ...extensionConfig }, { extensions: extensions2, path: path3, ...restConfig } = mergedConfig;
164786
164681
  return restConfig.handle || (this.abortOrReport(outputContent`Missing handle for extension "${restConfig.name}" at ${relativePath(appDirectory, configurationPath)}`, void 0, configurationPath), restConfig.handle = "unknown-handle"), this.createExtensionInstance(mergedConfig.type, restConfig, configurationPath, directory);
164787
164682
  });
164788
164683
  return Promise.all(extensionsInstancesPromises);
@@ -165122,14 +165017,6 @@ async function build(options) {
165122
165017
  }
165123
165018
  var build_default = build;
165124
165019
 
165125
- // ../app/dist/cli/utilities/app-command.js
165126
- init_cjs_shims();
165127
- var AppCommand = class extends base_command_default {
165128
- environmentsFilename() {
165129
- return configurationFileNames.appEnvironments;
165130
- }
165131
- };
165132
-
165133
165020
  // ../app/dist/cli/prompts/deprecation-warnings.js
165134
165021
  init_cjs_shims();
165135
165022
  async function showApiKeyDeprecationWarning() {
@@ -165140,6 +165027,14 @@ async function showApiKeyDeprecationWarning() {
165140
165027
  });
165141
165028
  }
165142
165029
 
165030
+ // ../app/dist/cli/utilities/app-command.js
165031
+ init_cjs_shims();
165032
+ var AppCommand = class extends base_command_default {
165033
+ environmentsFilename() {
165034
+ return configurationFileNames.appEnvironments;
165035
+ }
165036
+ };
165037
+
165143
165038
  // ../app/dist/cli/commands/app/build.js
165144
165039
  var import_core29 = __toESM(require_lib(), 1);
165145
165040
  var _a14, Build2 = class extends AppCommand {
@@ -165155,7 +165050,7 @@ var _a14, Build2 = class extends AppCommand {
165155
165050
  directory: flags.path,
165156
165051
  userProvidedConfigName: flags.config
165157
165052
  });
165158
- await build_default({ app, skipDependenciesInstallation: flags["skip-dependencies-installation"], apiKey });
165053
+ return await build_default({ app, skipDependenciesInstallation: flags["skip-dependencies-installation"], apiKey }), { app };
165159
165054
  }
165160
165055
  };
165161
165056
  _a14 = Build2;
@@ -165196,6 +165091,12 @@ var _a15, ConfigLink = class extends AppCommand {
165196
165091
  apiKey: flags["client-id"]
165197
165092
  };
165198
165093
  await link(options);
165094
+ let specifications = await loadLocalExtensionsSpecifications();
165095
+ return { app: await loadApp({
165096
+ specifications,
165097
+ directory: flags.path,
165098
+ userProvidedConfigName: void 0
165099
+ }) };
165199
165100
  }
165200
165101
  };
165201
165102
  _a15 = ConfigLink;
@@ -165223,6 +165124,12 @@ var _a16, { config, ...appFlagsWithoutConfig } = appFlags, ConfigUse = class ext
165223
165124
  async run() {
165224
165125
  let { flags, args } = await this.parse(_a16);
165225
165126
  await checkFolderIsValidApp(flags.path), await use2({ directory: flags.path, configName: args.config, reset: flags.reset });
165127
+ let specifications = await loadLocalExtensionsSpecifications();
165128
+ return { app: await loadApp({
165129
+ specifications,
165130
+ directory: flags.path,
165131
+ userProvidedConfigName: void 0
165132
+ }) };
165226
165133
  }
165227
165134
  };
165228
165135
  _a16 = ConfigUse;
@@ -165413,7 +165320,7 @@ var DemoWatcher = class _DemoWatcher extends AppCommand {
165413
165320
  userProvidedConfigName: flags.config,
165414
165321
  mode: "report"
165415
165322
  }), watcher = new AppEventWatcher(app);
165416
- await watcher.start(), outputInfo(`Watching for changes in ${app.name}...`), watcher.onEvent(async ({ app: _newApp, extensionEvents, startTime, path: path3 }) => {
165323
+ return await watcher.start(), outputInfo(`Watching for changes in ${app.name}...`), watcher.onEvent(async ({ app: _newApp, extensionEvents, startTime, path: path3 }) => {
165417
165324
  outputInfo(`\u{1F195} Event [${endHRTimeInMs(startTime)}ms]`), outputInfo(` \u{1F4C2} ${path3}`), extensionEvents.forEach((event) => {
165418
165325
  switch (event.type) {
165419
165326
  case EventType.Created:
@@ -165431,7 +165338,7 @@ var DemoWatcher = class _DemoWatcher extends AppCommand {
165431
165338
  }
165432
165339
  });
165433
165340
  }), setInterval(() => {
165434
- }, 1 << 30);
165341
+ }, 1 << 30), { app };
165435
165342
  }
165436
165343
  };
165437
165344
  DemoWatcher.summary = "Watch and prints out changes to an app.";
@@ -165479,7 +165386,7 @@ async function deploy(options) {
165479
165386
  let apiKey = identifiers?.app ?? remoteApp.apiKey;
165480
165387
  outputNewline(), release2 ? outputInfo(`Releasing a new app version as part of ${remoteApp.title}`) : outputInfo(`Creating a new app version as part of ${remoteApp.title}`), outputNewline();
165481
165388
  let uploadExtensionsBundleResult;
165482
- await inTemporaryDirectory(async (tmpDir) => {
165389
+ return await inTemporaryDirectory(async (tmpDir) => {
165483
165390
  try {
165484
165391
  let bundle = app.allExtensions.some((ext) => ext.features.includes("bundling")), bundlePath;
165485
165392
  bundle && (bundlePath = joinPath(tmpDir, "bundle.zip"), await mkdir(dirname(bundlePath))), await bundleAndBuildExtensions({ app, bundlePath, identifiers });
@@ -165523,7 +165430,7 @@ async function deploy(options) {
165523
165430
  } catch (error) {
165524
165431
  throw await updateAppIdentifiers({ app, identifiers, command: "deploy", developerPlatformClient }), error;
165525
165432
  }
165526
- });
165433
+ }), { app };
165527
165434
  }
165528
165435
  async function outputCompletionMessage({ app, release: release2, uploadExtensionsBundleResult }) {
165529
165436
  let linkAndMessage = [
@@ -165601,7 +165508,7 @@ var _a17, Deploy2 = class extends AppCommand {
165601
165508
  userProvidedConfigName: flags.config,
165602
165509
  specifications: await loadLocalExtensionsSpecifications()
165603
165510
  }), requiredNonTTYFlags = ["force"];
165604
- !apiKey && !app.configuration.client_id && requiredNonTTYFlags.push("client-id"), this.failMissingNonTTYFlags(flags, requiredNonTTYFlags), await deploy({
165511
+ return !apiKey && !app.configuration.client_id && requiredNonTTYFlags.push("client-id"), this.failMissingNonTTYFlags(flags, requiredNonTTYFlags), { app: (await deploy({
165605
165512
  app,
165606
165513
  apiKey,
165607
165514
  reset: flags.reset,
@@ -165610,7 +165517,7 @@ var _a17, Deploy2 = class extends AppCommand {
165610
165517
  message: flags.message,
165611
165518
  version: flags.version,
165612
165519
  commitReference: flags["source-control-url"]
165613
- });
165520
+ })).app };
165614
165521
  }
165615
165522
  };
165616
165523
  _a17 = Deploy2;
@@ -165685,6 +165592,13 @@ init_cjs_shims();
165685
165592
 
165686
165593
  // ../cli-kit/dist/public/common/url.js
165687
165594
  init_cjs_shims();
165595
+ function safeParseURL(url) {
165596
+ try {
165597
+ return new URL(url);
165598
+ } catch {
165599
+ return;
165600
+ }
165601
+ }
165688
165602
 
165689
165603
  // ../app/dist/cli/services/dev/urls.js
165690
165604
  async function generateFrontendURL(options) {
@@ -166436,7 +166350,9 @@ async function reloadExtensionConfig({ extension }) {
166436
166350
  extensionConfig || abort2(`ERROR: Invalid handle
166437
166351
  - Expected handle: "${extension.handle}"
166438
166352
  - Configuration file path: ${relativizePath(extension.configurationPath)}.
166439
- - Handles are immutable, you can't change them once they are set.`), configObject = { ...configuration, ...extensionConfig };
166353
+ - Handles are immutable, you can't change them once they are set.`);
166354
+ let mergedConfig = { ...configuration, ...extensionConfig }, { extensions: extensions2, path: path3, ...restConfig } = mergedConfig;
166355
+ configObject = restConfig;
166440
166356
  }
166441
166357
  let newConfig = await parseConfigurationObjectAgainstSpecification(extension.specification, extension.configurationPath, configObject, abort2), previousConfig = extension.configuration;
166442
166358
  return extension.configuration = newConfig, {
@@ -169282,7 +169198,7 @@ async function dev2(commandOptions) {
169282
169198
  let config2 = await prepareForDev(commandOptions);
169283
169199
  await actionsBeforeSettingUpDevProcesses(config2);
169284
169200
  let { processes, graphiqlUrl, previewUrl } = await setupDevProcesses(config2);
169285
- await actionsBeforeLaunchingDevProcesses(config2), await launchDevProcesses({ processes, previewUrl, graphiqlUrl, config: config2 });
169201
+ return await actionsBeforeLaunchingDevProcesses(config2), await launchDevProcesses({ processes, previewUrl, graphiqlUrl, config: config2 }), { app: config2.localApp };
169286
169202
  }
169287
169203
  async function prepareForDev(commandOptions) {
169288
169204
  let tunnelPort = await getAvailableTCPPort(), tunnelClient;
@@ -169531,13 +169447,15 @@ var _a18, Dev4 = class extends AppCommand {
169531
169447
  graphiqlKey: flags["graphiql-key"],
169532
169448
  devPreview: !flags.legacy
169533
169449
  };
169534
- await dev2(devOptions);
169450
+ return { app: (await dev2(devOptions)).app };
169535
169451
  }
169536
169452
  };
169537
169453
  _a18 = Dev4;
169538
169454
  Dev4.summary = "Run the app.";
169539
169455
  Dev4.descriptionWithMarkdown = `[Builds the app](https://shopify.dev/docs/api/shopify-cli/app/app-build) and lets you preview it on a [development store](https://shopify.dev/docs/apps/tools/development-stores) or [Plus sandbox store](https://help.shopify.com/partners/dashboard/managing-stores/plus-sandbox-store).
169540
169456
 
169457
+ > Note: Development store preview of extension drafts is not supported for Plus sandbox stores. You must \`deploy\` your app.
169458
+
169541
169459
  To preview your app on a development store or Plus sandbox store, Shopify CLI walks you through the following steps. If you've run \`dev\` before, then your settings are saved and some of these steps are skipped. You can reset these configurations using \`dev --reset\` to go through all of them again:
169542
169460
 
169543
169461
  - Associating your project with an app associated with your Partner account or organization, or creating a new app.
@@ -170000,7 +169918,7 @@ async function logs(commandOptions) {
170000
169918
  jwtToken,
170001
169919
  filters
170002
169920
  };
170003
- commandOptions.format === "json" ? (consoleLog(JSON.stringify({ subscribedToStores: commandOptions.storeFqdns })), consoleLog(JSON.stringify({ message: "Waiting for app logs..." })), await renderJsonLogs({
169921
+ return commandOptions.format === "json" ? (consoleLog(JSON.stringify({ subscribedToStores: commandOptions.storeFqdns })), consoleLog(JSON.stringify({ message: "Waiting for app logs..." })), await renderJsonLogs({
170004
169922
  options: {
170005
169923
  variables,
170006
169924
  developerPlatformClient: logsConfig.developerPlatformClient
@@ -170015,7 +169933,7 @@ async function logs(commandOptions) {
170015
169933
  },
170016
169934
  pollOptions,
170017
169935
  storeNameById: logsConfig.storeNameById
170018
- }));
169936
+ })), logsConfig.localApp;
170019
169937
  }
170020
169938
  async function prepareForLogs(commandOptions) {
170021
169939
  let { configuration } = await loadAppConfiguration({
@@ -170055,19 +169973,19 @@ function renderAppLogsConfigInfo(appName, storeFqdn, storeFqdns, configFile, org
170055
169973
  var import_core34 = __toESM(require_lib(), 1);
170056
169974
  var _a19, Logs2 = class extends AppCommand {
170057
169975
  async run() {
170058
- let { flags } = await this.parse(_a19), apiKey = flags["client-id"] || flags["api-key"], sources2 = flags.source;
169976
+ let { flags } = await this.parse(_a19), apiKey = flags["client-id"] || flags["api-key"];
170059
169977
  await checkFolderIsValidApp(flags.path);
170060
169978
  let logOptions = {
170061
169979
  apiKey,
170062
169980
  directory: flags.path,
170063
169981
  storeFqdns: flags.store,
170064
- sources: sources2,
169982
+ sources: flags.source,
170065
169983
  status: flags.status,
170066
169984
  configName: flags.config,
170067
169985
  reset: flags.reset,
170068
169986
  format: flags.json ? "json" : "text"
170069
169987
  };
170070
- await logs(logOptions);
169988
+ return { app: await logs(logOptions) };
170071
169989
  }
170072
169990
  };
170073
169991
  _a19 = Logs2;
@@ -170087,10 +170005,6 @@ Logs2.flags = {
170087
170005
  parse: async (input) => normalizeStoreFqdn(input)
170088
170006
  }),
170089
170007
  reset: dev_default2.flags.reset,
170090
- "no-tunnel": dev_default2.flags["no-tunnel"],
170091
- "graphiql-port": dev_default2.flags["graphiql-port"],
170092
- "graphiql-key": dev_default2.flags["graphiql-key"],
170093
- stable: dev_default2.flags.legacy,
170094
170008
  source: import_core34.Flags.string({
170095
170009
  description: "Filters output to the specified log source.",
170096
170010
  env: "SHOPIFY_FLAG_SOURCE",
@@ -170137,7 +170051,7 @@ var _a20, Sources = class extends AppCommand {
170137
170051
  userProvidedConfigName: flags.config,
170138
170052
  mode: "report"
170139
170053
  });
170140
- app.errors ? process.exit(2) : sources(app);
170054
+ return app.errors ? process.exit(2) : sources(app), { app };
170141
170055
  }
170142
170056
  };
170143
170057
  _a20 = Sources;
@@ -170222,7 +170136,7 @@ var _a21, EnvPull2 = class extends AppCommand {
170222
170136
  userProvidedConfigName: flags.config,
170223
170137
  mode: "report"
170224
170138
  }), envFile = joinPath(app.directory, flags["env-file"] ?? getDotEnvFileName(app.configuration.path));
170225
- outputInfo(await pullEnv(app, { envFile }));
170139
+ return outputInfo(await pullEnv(app, { envFile })), { app };
170226
170140
  }
170227
170141
  };
170228
170142
  _a21 = EnvPull2;
@@ -170270,7 +170184,7 @@ var _a22, EnvShow = class extends AppCommand {
170270
170184
  userProvidedConfigName: flags.config,
170271
170185
  mode: "report"
170272
170186
  });
170273
- outputInfo(await showEnv(app));
170187
+ return outputInfo(await showEnv(app)), { app };
170274
170188
  }
170275
170189
  };
170276
170190
  _a22 = EnvShow;
@@ -170378,22 +170292,20 @@ async function getOrGenerateSchemaPath(extension, app) {
170378
170292
  }
170379
170293
 
170380
170294
  // ../app/dist/cli/commands/app/function/build.js
170381
- var _a23, FunctionBuild = class extends base_command_default {
170295
+ var _a23, FunctionBuild = class extends AppCommand {
170382
170296
  async run() {
170383
170297
  let { flags } = await this.parse(_a23);
170384
- await inFunctionContext({
170298
+ return { app: await inFunctionContext({
170385
170299
  path: flags.path,
170386
170300
  userProvidedConfigName: flags.config,
170387
- callback: async (app, ourFunction) => {
170388
- await buildFunctionExtension(ourFunction, {
170389
- app,
170390
- stdout: process.stdout,
170391
- stderr: process.stderr,
170392
- useTasks: !0,
170393
- environment: "production"
170394
- }), renderSuccess({ headline: "Function built successfully." });
170395
- }
170396
- });
170301
+ callback: async (app2, ourFunction) => (await buildFunctionExtension(ourFunction, {
170302
+ app: app2,
170303
+ stdout: process.stdout,
170304
+ stderr: process.stderr,
170305
+ useTasks: !0,
170306
+ environment: "production"
170307
+ }), renderSuccess({ headline: "Function built successfully." }), app2)
170308
+ }) };
170397
170309
  }
170398
170310
  };
170399
170311
  _a23 = FunctionBuild;
@@ -170762,26 +170674,24 @@ function getIdentifierFromFilename(fileName) {
170762
170674
  }
170763
170675
 
170764
170676
  // ../app/dist/cli/commands/app/function/replay.js
170765
- var import_core37 = __toESM(require_lib(), 1), _a24, FunctionReplay = class extends base_command_default {
170677
+ var import_core37 = __toESM(require_lib(), 1), _a24, FunctionReplay = class extends AppCommand {
170766
170678
  async run() {
170767
170679
  let { flags } = await this.parse(_a24);
170768
170680
  flags["api-key"] && await showApiKeyDeprecationWarning();
170769
170681
  let apiKey = flags["client-id"] || flags["api-key"];
170770
- await inFunctionContext({
170682
+ return { app: await inFunctionContext({
170771
170683
  path: flags.path,
170772
170684
  userProvidedConfigName: flags.config,
170773
- callback: async (app, ourFunction) => {
170774
- await replay({
170775
- app,
170776
- extension: ourFunction,
170777
- apiKey,
170778
- path: flags.path,
170779
- log: flags.log,
170780
- json: flags.json,
170781
- watch: flags.watch
170782
- });
170783
- }
170784
- });
170685
+ callback: async (app2, ourFunction) => (await replay({
170686
+ app: app2,
170687
+ extension: ourFunction,
170688
+ apiKey,
170689
+ path: flags.path,
170690
+ log: flags.log,
170691
+ json: flags.json,
170692
+ watch: flags.watch
170693
+ }), app2)
170694
+ }) };
170785
170695
  }
170786
170696
  };
170787
170697
  _a24 = FunctionReplay;
@@ -170829,13 +170739,13 @@ var replay_default = FunctionReplay;
170829
170739
  // ../app/dist/cli/commands/app/function/run.js
170830
170740
  init_cjs_shims();
170831
170741
  var import_core38 = __toESM(require_lib(), 1);
170832
- var _a25, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends base_command_default {
170742
+ var _a25, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends AppCommand {
170833
170743
  async run() {
170834
170744
  let { flags } = await this.parse(_a25);
170835
- await inFunctionContext({
170745
+ return { app: await inFunctionContext({
170836
170746
  path: flags.path,
170837
170747
  userProvidedConfigName: flags.config,
170838
- callback: async (app, ourFunction) => {
170748
+ callback: async (app2, ourFunction) => {
170839
170749
  let functionExport = DEFAULT_FUNCTION_EXPORT;
170840
170750
  if (flags.export !== void 0)
170841
170751
  outputDebug(`Using export ${flags.export} from the --export flag.`), functionExport = flags.export;
@@ -170854,8 +170764,8 @@ var _a25, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends base_c
170854
170764
  functionExport = targeting?.[0]?.export || DEFAULT_FUNCTION_EXPORT, outputDebug(`Using export '${functionExport}'. Use the --export flag or an interactive terminal to select a different export.`);
170855
170765
  } else
170856
170766
  outputDebug(`No targeting information found. Using the default export '${functionExport}'. Use the --export flag or an interactive terminal to select a different export.`);
170857
- let inputQueryPath = ourFunction?.configuration.targeting?.[0]?.input_query, queryPath = inputQueryPath && `${ourFunction?.directory}/${inputQueryPath}`, schemaPath = await getOrGenerateSchemaPath(ourFunction, app);
170858
- await runFunction({
170767
+ let inputQueryPath = ourFunction?.configuration.targeting?.[0]?.input_query, queryPath = inputQueryPath && `${ourFunction?.directory}/${inputQueryPath}`, schemaPath = await getOrGenerateSchemaPath(ourFunction, app2);
170768
+ return await runFunction({
170859
170769
  functionExtension: ourFunction,
170860
170770
  json: flags.json,
170861
170771
  inputPath: flags.input,
@@ -170863,9 +170773,9 @@ var _a25, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends base_c
170863
170773
  stdin: "inherit",
170864
170774
  schemaPath,
170865
170775
  queryPath
170866
- });
170776
+ }), app2;
170867
170777
  }
170868
- });
170778
+ }) };
170869
170779
  }
170870
170780
  };
170871
170781
  _a25 = FunctionRun;
@@ -170899,24 +170809,22 @@ var run_default = FunctionRun;
170899
170809
  // ../app/dist/cli/commands/app/function/schema.js
170900
170810
  init_cjs_shims();
170901
170811
  var import_core39 = __toESM(require_lib(), 1);
170902
- var _a26, FetchSchema = class extends base_command_default {
170812
+ var _a26, FetchSchema = class extends AppCommand {
170903
170813
  async run() {
170904
170814
  let { flags } = await this.parse(_a26);
170905
170815
  flags["api-key"] && await showApiKeyDeprecationWarning();
170906
170816
  let apiKey = flags["client-id"] || flags["api-key"];
170907
- await inFunctionContext({
170817
+ return { app: await inFunctionContext({
170908
170818
  path: flags.path,
170909
170819
  userProvidedConfigName: flags.config,
170910
- callback: async (app, ourFunction) => {
170911
- await generateSchemaService({
170912
- app,
170913
- extension: ourFunction,
170914
- apiKey,
170915
- stdout: flags.stdout,
170916
- path: flags.path
170917
- });
170918
- }
170919
- });
170820
+ callback: async (app2, ourFunction) => (await generateSchemaService({
170821
+ app: app2,
170822
+ extension: ourFunction,
170823
+ apiKey,
170824
+ stdout: flags.stdout,
170825
+ path: flags.path
170826
+ }), app2)
170827
+ }) };
170920
170828
  }
170921
170829
  };
170922
170830
  _a26 = FetchSchema;
@@ -170951,16 +170859,14 @@ var schema_default = FetchSchema;
170951
170859
 
170952
170860
  // ../app/dist/cli/commands/app/function/typegen.js
170953
170861
  init_cjs_shims();
170954
- var _a27, FunctionTypegen = class extends base_command_default {
170862
+ var _a27, FunctionTypegen = class extends AppCommand {
170955
170863
  async run() {
170956
170864
  let { flags } = await this.parse(_a27);
170957
- await inFunctionContext({
170865
+ return { app: await inFunctionContext({
170958
170866
  path: flags.path,
170959
170867
  userProvidedConfigName: flags.config,
170960
- callback: async (app, ourFunction) => {
170961
- await buildGraphqlTypes(ourFunction, { stdout: process.stdout, stderr: process.stderr, app }), renderSuccess({ headline: "GraphQL types generated successfully." });
170962
- }
170963
- });
170868
+ callback: async (app2, ourFunction) => (await buildGraphqlTypes(ourFunction, { stdout: process.stdout, stderr: process.stderr, app: app2 }), renderSuccess({ headline: "GraphQL types generated successfully." }), app2)
170869
+ }) };
170964
170870
  }
170965
170871
  };
170966
170872
  _a27 = FunctionTypegen;
@@ -171150,17 +171056,17 @@ async function uiExtensionInit({ directory, url, app, name, extensionFlavor, uid
171150
171056
  {
171151
171057
  title: "Installing dependencies",
171152
171058
  task: async () => {
171153
- let packageManager2 = app.packageManager;
171059
+ let packageManager = app.packageManager;
171154
171060
  if (app.usesWorkspaces)
171155
171061
  getTemplateLanguage(extensionFlavor?.value) === "javascript" && await installNodeModules({
171156
- packageManager: packageManager2,
171062
+ packageManager,
171157
171063
  directory: app.directory
171158
171064
  });
171159
171065
  else {
171160
171066
  await addResolutionOrOverrideIfNeeded(app.directory, extensionFlavor?.value);
171161
171067
  let extensionPackageJsonPath = joinPath(directory, "package.json"), requiredDependencies = await getProdDependencies(extensionPackageJsonPath);
171162
171068
  await addNPMDependenciesIfNeeded(requiredDependencies, {
171163
- packageManager: packageManager2,
171069
+ packageManager,
171164
171070
  type: "prod",
171165
171071
  directory: app.directory
171166
171072
  }), await removeFile(extensionPackageJsonPath);
@@ -171227,7 +171133,7 @@ async function generate(options) {
171227
171133
  }), availableSpecifications = specifications.map((spec3) => spec3.identifier), extensionTemplates = await fetchExtensionTemplates(developerPlatformClient, remoteApp, availableSpecifications), promptOptions = await buildPromptOptions(extensionTemplates, specifications, app, options), promptAnswers = await extension_default(promptOptions);
171228
171134
  await saveAnalyticsMetadata(promptAnswers, options.template);
171229
171135
  let generateExtensionOptions = buildGenerateOptions(promptAnswers, app, options, developerPlatformClient), generatedExtension = await generateExtensionTemplate(generateExtensionOptions);
171230
- renderSuccessMessage2(generatedExtension, app.packageManager);
171136
+ return renderSuccessMessage2(generatedExtension, app.packageManager), { app };
171231
171137
  }
171232
171138
  async function buildPromptOptions(extensionTemplates, specifications, app, options) {
171233
171139
  let extensionTemplate = await handleTypeParameter(options.template, app, extensionTemplates, specifications);
@@ -171268,8 +171174,8 @@ function buildGenerateOptions(promptAnswers, app, options, developerPlatformClie
171268
171174
  developerPlatformClient
171269
171175
  };
171270
171176
  }
171271
- function renderSuccessMessage2(extension, packageManager2) {
171272
- let formattedSuccessfulMessage = formatSuccessfulRunMessage(extension.extensionTemplate, extension.directory, packageManager2);
171177
+ function renderSuccessMessage2(extension, packageManager) {
171178
+ let formattedSuccessfulMessage = formatSuccessfulRunMessage(extension.extensionTemplate, extension.directory, packageManager);
171273
171179
  renderSuccess(formattedSuccessfulMessage);
171274
171180
  }
171275
171181
  function validateExtensionFlavor(extensionTemplate, flavor) {
@@ -171318,18 +171224,14 @@ var _a28, AppGenerateExtension = class extends AppCommand {
171318
171224
  let { flags } = await this.parse(_a28);
171319
171225
  flags["api-key"] && await showApiKeyDeprecationWarning();
171320
171226
  let apiKey = flags["client-id"] || flags["api-key"];
171321
- if (await metadata_default.addPublicMetadata(() => ({
171227
+ return await metadata_default.addPublicMetadata(() => ({
171322
171228
  cmd_scaffold_required_auth: !0,
171323
171229
  cmd_scaffold_template_custom: flags["clone-url"] !== void 0,
171324
171230
  cmd_scaffold_type_owner: "@shopify/app"
171325
- })), flags.type) {
171326
- renderWarning({
171327
- headline: ["The flag --type has been deprecated in favor of --template."],
171328
- body: ["Please use --template instead."]
171329
- });
171330
- return;
171331
- }
171332
- await checkFolderIsValidApp(flags.path), await generate_default({
171231
+ })), flags.type && (renderWarning({
171232
+ headline: ["The flag --type has been deprecated in favor of --template."],
171233
+ body: ["Please use --template instead."]
171234
+ }), process.exit(2)), await checkFolderIsValidApp(flags.path), { app: (await generate_default({
171333
171235
  directory: flags.path,
171334
171236
  reset: flags.reset,
171335
171237
  apiKey,
@@ -171338,7 +171240,7 @@ var _a28, AppGenerateExtension = class extends AppCommand {
171338
171240
  template: flags.template,
171339
171241
  flavor: flags.flavor,
171340
171242
  configName: flags.config
171341
- });
171243
+ })).app };
171342
171244
  }
171343
171245
  };
171344
171246
  _a28 = AppGenerateExtension;
@@ -171684,16 +171586,12 @@ var getMigrationChoices = (isShopifolk) => [
171684
171586
  directory: flags.path,
171685
171587
  userProvidedConfigName: flags.config
171686
171588
  }), isShopifolk = await isShopify(), migrationChoices = getMigrationChoices(isShopifolk), choices = migrationChoices.map((choice) => ({ label: choice.label, value: choice.value })), promptAnswer = await renderSelectPrompt({ message: "Extension type to migrate", choices }), migrationChoice = migrationChoices.find((choice) => choice.value === promptAnswer);
171687
- if (migrationChoice === void 0) {
171688
- renderFatalError(new AbortError("Invalid migration choice"));
171689
- return;
171690
- }
171691
- await importExtensions({
171589
+ return migrationChoice === void 0 ? (renderFatalError(new AbortError("Invalid migration choice")), { app }) : (await importExtensions({
171692
171590
  app,
171693
171591
  apiKey: flags["client-id"],
171694
171592
  extensionTypes: migrationChoice.extensionTypes,
171695
171593
  buildTomlObject: migrationChoice.buildTomlObject
171696
- });
171594
+ }), { app });
171697
171595
  }
171698
171596
  };
171699
171597
  ImportExtensions.description = "Import dashboard-managed extensions into your app.";
@@ -171764,15 +171662,12 @@ var UNKNOWN_TEXT = outputContent`${outputToken.italic("unknown")}`.value, NOT_CO
171764
171662
  `);
171765
171663
  }
171766
171664
  async devConfigsSection() {
171767
- let title = "Current app configuration", developerPlatformClient = this.options.developerPlatformClient, { cachedInfo, remoteApp } = await getAppContext({
171768
- developerPlatformClient,
171665
+ let title = "Current app configuration", { cachedInfo, remoteApp } = await getAppContext({
171769
171666
  directory: this.app.directory,
171770
171667
  reset: !1,
171771
171668
  configName: this.options.configName,
171772
171669
  enableLinkingPrompt: !1
171773
- });
171774
- developerPlatformClient = remoteApp?.developerPlatformClient ?? developerPlatformClient;
171775
- let postscript = outputContent`💡 To change these, run ${outputToken.packagejsonScript(this.app.packageManager, "dev", "--reset")}`.value, updateUrls;
171670
+ }), developerPlatformClient = remoteApp?.developerPlatformClient ?? this.options.developerPlatformClient, postscript = outputContent`💡 To change these, run ${outputToken.packagejsonScript(this.app.packageManager, "dev", "--reset")}`.value, updateUrls;
171776
171671
  cachedInfo?.updateURLs === void 0 ? updateUrls = NOT_CONFIGURED_TEXT : updateUrls = cachedInfo.updateURLs ? "Yes" : "No";
171777
171672
  let partnersAccountInfo = ["Partners account", "unknown"], retrievedAccountInfo = await developerPlatformClient.accountInfo();
171778
171673
  isServiceAccount(retrievedAccountInfo) ? partnersAccountInfo = ["Service account", retrievedAccountInfo.orgName] : isUserAccount(retrievedAccountInfo) && (partnersAccountInfo = ["Partners account", retrievedAccountInfo.email]);
@@ -171884,11 +171779,11 @@ var _a30, AppInfo2 = class extends AppCommand {
171884
171779
  userProvidedConfigName: flags.config,
171885
171780
  mode: "report"
171886
171781
  });
171887
- outputInfo(await info(app, {
171782
+ return outputInfo(await info(app, {
171888
171783
  format: flags.json ? "json" : "text",
171889
171784
  webEnv: flags["web-env"],
171890
171785
  configName: flags.config
171891
- })), app.errors && process.exit(2);
171786
+ })), app.errors && process.exit(2), { app };
171892
171787
  }
171893
171788
  };
171894
171789
  _a30 = AppInfo2;
@@ -171920,10 +171815,7 @@ var info_default2 = AppInfo2;
171920
171815
  // ../app/dist/cli/commands/app/init.js
171921
171816
  init_cjs_shims();
171922
171817
 
171923
- // ../create-app/dist/commands/init.js
171924
- init_cjs_shims();
171925
-
171926
- // ../create-app/dist/prompts/init.js
171818
+ // ../app/dist/cli/prompts/init/init.js
171927
171819
  init_cjs_shims();
171928
171820
  var templates = {
171929
171821
  remix: {
@@ -171956,24 +171848,10 @@ var templates = {
171956
171848
  visible: !1
171957
171849
  }
171958
171850
  }, allTemplates = Object.keys(templates), visibleTemplates = allTemplates.filter((key) => templates[key].visible), templateOptionsInOrder = ["remix", "none"], init = async (options) => {
171959
- let name = options.name, template2 = options.template, flavor = options.flavor, defaults = {
171960
- name: await generateRandomNameForSubdirectory({ suffix: "app", directory: options.directory }),
171851
+ let template2 = options.template, flavor = options.flavor, defaults = {
171961
171852
  template: templates.remix.url
171962
- }, welcomed = !1;
171963
- name || (renderText({ text: `
171964
- Welcome. Let\u2019s get started by naming your app project. You can change it later.` }), welcomed = !0, name = await renderTextPrompt({
171965
- message: "Your project name?",
171966
- defaultValue: defaults.name,
171967
- validate: (value) => {
171968
- if (value.length === 0)
171969
- return "App name can't be empty";
171970
- if (value.length > 30)
171971
- return "Enter a shorter name (30 character max.)";
171972
- if (value.toLowerCase().includes("shopify"))
171973
- return "App name can't include the word 'shopify'";
171974
- }
171975
- })), template2 || (welcomed || (renderText({ text: `
171976
- Welcome. Let\u2019s get started by choosing a template for your app project.` }), welcomed = !0), template2 = await renderSelectPrompt({
171853
+ };
171854
+ template2 || (template2 = await renderSelectPrompt({
171977
171855
  choices: templateOptionsInOrder.map((key) => ({
171978
171856
  label: templates[key].label || key,
171979
171857
  value: key
@@ -171983,7 +171861,6 @@ Welcome. Let\u2019s get started by choosing a template for your app project.` })
171983
171861
  }));
171984
171862
  let answers = {
171985
171863
  ...options,
171986
- name,
171987
171864
  template: template2,
171988
171865
  templateType: isPredefinedTemplate(template2) ? template2 : "custom",
171989
171866
  globalCLIResult: { install: !1, alreadyInstalled: !1 }
@@ -172004,10 +171881,10 @@ function isPredefinedTemplate(template2) {
172004
171881
  return allTemplates.includes(template2);
172005
171882
  }
172006
171883
 
172007
- // ../create-app/dist/services/init.js
171884
+ // ../app/dist/cli/services/init/init.js
172008
171885
  init_cjs_shims();
172009
171886
 
172010
- // ../create-app/dist/utils/template/npm.js
171887
+ // ../app/dist/cli/services/init/template/npm.js
172011
171888
  init_cjs_shims();
172012
171889
  import { platform } from "os";
172013
171890
  async function updateCLIDependencies({ packageJSON, local, useGlobalCLI }) {
@@ -172027,12 +171904,12 @@ async function packagePath(packageName) {
172027
171904
  cwd: moduleDirectory(import.meta.url)
172028
171905
  })}`;
172029
171906
  }
172030
- async function getDeepInstallNPMTasks({ from, packageManager: packageManager2 }) {
172031
- let args = platform() === "win32" && packageManager2 === "yarn" ? ["--network-concurrency", "1"] : [];
172032
- return installNodeModules({ directory: normalizePath(from), packageManager: packageManager2, args });
171907
+ async function getDeepInstallNPMTasks({ from, packageManager }) {
171908
+ let args = platform() === "win32" && packageManager === "yarn" ? ["--network-concurrency", "1"] : [];
171909
+ return installNodeModules({ directory: normalizePath(from), packageManager, args });
172033
171910
  }
172034
171911
 
172035
- // ../create-app/dist/utils/template/cleanup.js
171912
+ // ../app/dist/cli/services/init/template/cleanup.js
172036
171913
  init_cjs_shims();
172037
171914
  async function cleanup(webOutputDirectory) {
172038
171915
  let gitPaths = await glob([
@@ -172052,13 +171929,13 @@ async function cleanup(webOutputDirectory) {
172052
171929
  });
172053
171930
  }
172054
171931
 
172055
- // ../create-app/dist/services/init.js
171932
+ // ../app/dist/cli/services/init/init.js
172056
171933
  async function init2(options) {
172057
- let packageManager2 = options.packageManager, hyphenizedName = hyphenate(options.name), outputDirectory = joinPath(options.directory, hyphenizedName), githubRepo = parseGitHubRepositoryReference(options.template);
172058
- await ensureAppDirectoryIsAvailable(outputDirectory, hyphenizedName), await clearCache(outputDirectory), renderInfo({
171934
+ let packageManager = options.packageManager, hyphenizedName = hyphenate(options.name), outputDirectory = joinPath(options.directory, hyphenizedName), githubRepo = parseGitHubRepositoryReference(options.template);
171935
+ return await ensureAppDirectoryIsAvailable(outputDirectory, hyphenizedName), await clearCache(outputDirectory), renderInfo({
172059
171936
  body: [
172060
171937
  "Initializing project with",
172061
- { command: packageManager2 },
171938
+ { command: packageManager },
172062
171939
  `
172063
171940
  Use the`,
172064
171941
  { command: "--package-manager" },
@@ -172083,7 +171960,7 @@ Use the`,
172083
171960
  title: "Parsing liquid",
172084
171961
  task: async () => {
172085
171962
  await recursiveLiquidTemplateCopy(templatePathDir, templateScaffoldDir, {
172086
- dependency_manager: packageManager2,
171963
+ dependency_manager: packageManager,
172087
171964
  app_name: options.name
172088
171965
  });
172089
171966
  }
@@ -172093,7 +171970,7 @@ Use the`,
172093
171970
  let packageJSON = (await findUpAndReadPackageJson(templateScaffoldDir)).content;
172094
171971
  packageJSON.name = hyphenizedName, packageJSON.author = await username() ?? "", packageJSON.private = !0;
172095
171972
  let workspacesFolders = ["extensions/*"].concat(detectAdditionalWorkspacesFolders(templateScaffoldDir));
172096
- switch (packageManager2) {
171973
+ switch (packageManager) {
172097
171974
  case "npm":
172098
171975
  case "yarn":
172099
171976
  case "bun":
@@ -172137,9 +172014,9 @@ ${workspacesContent}`), await appendFile(joinPath(templateScaffoldDir, ".npmrc")
172137
172014
  `);
172138
172015
  }
172139
172016
  }), tasks.push({
172140
- title: `Installing dependencies with ${packageManager2}`,
172017
+ title: `Installing dependencies with ${packageManager}`,
172141
172018
  task: async () => {
172142
- await getDeepInstallNPMTasks({ from: templateScaffoldDir, packageManager: packageManager2 });
172019
+ await getDeepInstallNPMTasks({ from: templateScaffoldDir, packageManager });
172143
172020
  }
172144
172021
  }, {
172145
172022
  title: "Cleaning up",
@@ -172152,21 +172029,28 @@ ${workspacesContent}`), await appendFile(joinPath(templateScaffoldDir, ".npmrc")
172152
172029
  await initializeGitRepository(templateScaffoldDir);
172153
172030
  }
172154
172031
  }), await renderTasks(tasks), await moveFile(templateScaffoldDir, outputDirectory);
172155
- }), renderSuccess({
172032
+ }), await link({
172033
+ directory: outputDirectory,
172034
+ apiKey: options.app.apiKey,
172035
+ appId: options.app.id,
172036
+ organizationId: options.app.organizationId,
172037
+ configName: "shopify.app.toml",
172038
+ developerPlatformClient: options.developerPlatformClient
172039
+ }, !1), renderSuccess({
172156
172040
  headline: [{ userInput: hyphenizedName }, "is ready for you to build!"],
172157
172041
  nextSteps: [
172158
172042
  ["Run", { command: `cd ${hyphenizedName}` }],
172159
- ["For extensions, run", { command: formatPackageManagerCommand(packageManager2, "shopify app generate extension") }],
172160
- ["To see your app, run", { command: formatPackageManagerCommand(packageManager2, "shopify app dev") }]
172043
+ ["For extensions, run", { command: formatPackageManagerCommand(packageManager, "shopify app generate extension") }],
172044
+ ["To see your app, run", { command: formatPackageManagerCommand(packageManager, "shopify app dev") }]
172161
172045
  ],
172162
172046
  reference: [
172163
172047
  { link: { label: "Shopify docs", url: "https://shopify.dev" } },
172164
172048
  [
172165
172049
  "For an overview of commands, run",
172166
- { command: `${formatPackageManagerCommand(packageManager2, "shopify app", "--help")}` }
172050
+ { command: `${formatPackageManagerCommand(packageManager, "shopify app", "--help")}` }
172167
172051
  ]
172168
172052
  ]
172169
- });
172053
+ }), { outputDirectory };
172170
172054
  }
172171
172055
  async function ensureAppDirectoryIsAvailable(directory, name) {
172172
172056
  if (await fileExists(directory))
@@ -172183,73 +172067,75 @@ function detectAdditionalWorkspacesFolders(directory) {
172183
172067
  }
172184
172068
  var init_default4 = init2;
172185
172069
 
172186
- // ../create-app/dist/commands/init.js
172070
+ // ../app/dist/cli/services/init/validate.js
172071
+ init_cjs_shims();
172072
+ function validateTemplateValue(template2) {
172073
+ if (!template2)
172074
+ return;
172075
+ let url = safeParseURL(template2);
172076
+ if (url && url.origin !== "https://github.com")
172077
+ throw new AbortError("Only GitHub repository references are supported, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]");
172078
+ if (!url && !isPredefinedTemplate(template2))
172079
+ throw new AbortError(outputContent`Only ${visibleTemplates.map((alias) => outputContent`${outputToken.yellow(alias)}`.value).join(", ")} template aliases are supported, please provide a valid URL`);
172080
+ }
172081
+ function validateFlavorValue(template2, flavor) {
172082
+ if (!template2) {
172083
+ if (flavor)
172084
+ throw new AbortError(outputContent`The ${outputToken.yellow("--flavor")} flag requires the ${outputToken.yellow("--template")} flag to be set`);
172085
+ return;
172086
+ }
172087
+ if (!flavor)
172088
+ return;
172089
+ if (!isPredefinedTemplate(template2))
172090
+ throw new AbortError(outputContent`The ${outputToken.yellow("--flavor")} flag is not supported for custom templates`);
172091
+ let templateConfig = templates[template2];
172092
+ if (!templateConfig.branches)
172093
+ throw new AbortError(outputContent`The ${outputToken.yellow(template2)} template does not support flavors`);
172094
+ if (!templateConfig.branches.options[flavor])
172095
+ throw new AbortError(outputContent`Invalid option for ${outputToken.yellow("--flavor")}\nThe ${outputToken.yellow("--flavor")} flag for ${outputToken.yellow(template2)} accepts only ${Object.keys(templateConfig.branches.options).map((alias) => outputContent`${outputToken.yellow(alias)}`.value).join(", ")}`);
172096
+ }
172097
+
172098
+ // ../app/dist/cli/commands/app/init.js
172187
172099
  var import_core43 = __toESM(require_lib(), 1);
172188
- var _a31, Init3 = class extends base_command_default {
172100
+ var _a31, Init3 = class extends AppCommand {
172189
172101
  async run() {
172190
172102
  let { flags } = await this.parse(_a31);
172191
- this.validateTemplateValue(flags.template), this.validateFlavorValue(flags.template, flags.flavor);
172192
- let inferredPackageManager = this.inferPackageManager(flags["package-manager"]), promptAnswers = await init_default3({
172193
- name: flags.name,
172103
+ validateTemplateValue(flags.template), validateFlavorValue(flags.template, flags.flavor);
172104
+ let inferredPackageManager = inferPackageManager(flags["package-manager"]), name = flags.name ?? await generateRandomNameForSubdirectory({ suffix: "app", directory: flags.path }), developerPlatformClient = selectDeveloperPlatformClient(), selectedApp;
172105
+ if (flags["client-id"])
172106
+ selectedApp = await appFromId({ apiKey: flags["client-id"], developerPlatformClient });
172107
+ else {
172108
+ renderText({ text: `
172109
+ Welcome. Let's get started by linking this new project to an app in your organization.` });
172110
+ let org = await selectOrg(), { organization, apps, hasMorePages } = await developerPlatformClient.orgAndApps(org.id);
172111
+ selectedApp = await selectOrCreateApp(name, apps, hasMorePages, organization, developerPlatformClient);
172112
+ }
172113
+ let promptAnswers = await init_default3({
172194
172114
  template: flags.template,
172195
- flavor: flags.flavor,
172196
- directory: flags.path
172115
+ flavor: flags.flavor
172197
172116
  });
172198
172117
  promptAnswers.globalCLIResult.install && await installGlobalShopifyCLI(inferredPackageManager), await addPublicMetadata(() => ({
172199
172118
  cmd_create_app_template: promptAnswers.templateType,
172200
172119
  cmd_create_app_template_url: promptAnswers.template
172201
- })), await init_default4({
172202
- name: promptAnswers.name,
172120
+ }));
172121
+ let platformClient = selectedApp.developerPlatformClient ?? developerPlatformClient, result = await init_default4({
172122
+ name: selectedApp.title,
172123
+ app: selectedApp,
172203
172124
  packageManager: inferredPackageManager,
172204
172125
  template: promptAnswers.template,
172205
172126
  local: flags.local,
172206
172127
  directory: flags.path,
172207
172128
  useGlobalCLI: promptAnswers.globalCLIResult.alreadyInstalled || promptAnswers.globalCLIResult.install,
172129
+ developerPlatformClient: platformClient,
172208
172130
  postCloneActions: {
172209
172131
  removeLockfilesFromGitignore: promptAnswers.templateType !== "custom"
172210
172132
  }
172211
- });
172212
- }
172213
- validateTemplateValue(template2) {
172214
- if (!template2)
172215
- return;
172216
- let url = this.parseURL(template2);
172217
- if (url && url.origin !== "https://github.com")
172218
- throw new AbortError("Only GitHub repository references are supported, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]");
172219
- if (!url && !isPredefinedTemplate(template2))
172220
- throw new AbortError(outputContent`Only ${visibleTemplates.map((alias) => outputContent`${outputToken.yellow(alias)}`.value).join(", ")} template aliases are supported, please provide a valid URL`);
172221
- }
172222
- validateFlavorValue(template2, flavor) {
172223
- if (!template2) {
172224
- if (flavor)
172225
- throw new AbortError(outputContent`The ${outputToken.yellow("--flavor")} flag requires the ${outputToken.yellow("--template")} flag to be set`);
172226
- return;
172227
- }
172228
- if (!flavor)
172229
- return;
172230
- if (!isPredefinedTemplate(template2))
172231
- throw new AbortError(outputContent`The ${outputToken.yellow("--flavor")} flag is not supported for custom templates`);
172232
- let templateConfig = templates[template2];
172233
- if (!templateConfig.branches)
172234
- throw new AbortError(outputContent`The ${outputToken.yellow(template2)} template does not support flavors`);
172235
- if (!templateConfig.branches.options[flavor])
172236
- throw new AbortError(outputContent`Invalid option for ${outputToken.yellow("--flavor")}\nThe ${outputToken.yellow("--flavor")} flag for ${outputToken.yellow(template2)} accepts only ${Object.keys(templateConfig.branches.options).map((alias) => outputContent`${outputToken.yellow(alias)}`.value).join(", ")}`);
172237
- }
172238
- parseURL(url) {
172239
- try {
172240
- return new URL(url);
172241
- } catch {
172242
- return;
172243
- }
172244
- }
172245
- inferPackageManager(optionsPackageManager) {
172246
- if (optionsPackageManager && packageManager.includes(optionsPackageManager))
172247
- return optionsPackageManager;
172248
- let usedPackageManager = packageManagerFromUserAgent();
172249
- if (usedPackageManager !== "unknown")
172250
- return usedPackageManager;
172251
- let globalPackageManager = inferPackageManagerForGlobalCLI();
172252
- return globalPackageManager !== "unknown" ? globalPackageManager : "npm";
172133
+ }), specifications = await loadLocalExtensionsSpecifications();
172134
+ return { app: await loadApp({
172135
+ specifications,
172136
+ directory: result.outputDirectory,
172137
+ userProvidedConfigName: void 0
172138
+ }) };
172253
172139
  }
172254
172140
  };
172255
172141
  _a31 = Init3;
@@ -172289,6 +172175,12 @@ Init3.flags = {
172289
172175
  env: "SHOPIFY_FLAG_LOCAL",
172290
172176
  default: !1,
172291
172177
  hidden: !0
172178
+ }),
172179
+ "client-id": import_core43.Flags.string({
172180
+ hidden: !1,
172181
+ description: "The Client ID of your app. Use this to automatically link your new project to an existing app. Using this flag avoids the app selection prompt.",
172182
+ env: "SHOPIFY_FLAG_CLIENT_ID",
172183
+ exclusive: ["config"]
172292
172184
  })
172293
172185
  };
172294
172186
  var init_default5 = Init3;
@@ -172365,13 +172257,13 @@ var _a32, Release = class extends AppCommand {
172365
172257
  directory: flags.path,
172366
172258
  userProvidedConfigName: flags.config
172367
172259
  }), requiredNonTTYFlags = ["force"];
172368
- !apiKey && !app.configuration.client_id && requiredNonTTYFlags.push("client-id"), this.failMissingNonTTYFlags(flags, requiredNonTTYFlags), await release({
172260
+ return !apiKey && !app.configuration.client_id && requiredNonTTYFlags.push("client-id"), this.failMissingNonTTYFlags(flags, requiredNonTTYFlags), await release({
172369
172261
  app,
172370
172262
  apiKey,
172371
172263
  reset: flags.reset,
172372
172264
  force: flags.force,
172373
172265
  version: flags.version
172374
- });
172266
+ }), { app };
172375
172267
  }
172376
172268
  };
172377
172269
  _a32 = Release;
@@ -172489,12 +172381,12 @@ var import_core45 = __toESM(require_lib(), 1), _a33, VersionsList = class extend
172489
172381
  directory: flags.path,
172490
172382
  userProvidedConfigName: flags.config
172491
172383
  });
172492
- await versionList({
172384
+ return await versionList({
172493
172385
  app,
172494
172386
  apiKey,
172495
172387
  reset: !1,
172496
172388
  json: flags.json
172497
- });
172389
+ }), { app };
172498
172390
  }
172499
172391
  };
172500
172392
  _a33 = VersionsList;
@@ -172622,7 +172514,7 @@ async function webhookTriggerService(flags) {
172622
172514
  userProvidedConfigName: flags.config,
172623
172515
  specifications: await loadLocalExtensionsSpecifications()
172624
172516
  }), developerPlatformClient = flags.developerPlatformClient ?? selectDeveloperPlatformClient({ configuration: app.configuration }), options = await validateAndCollectFlags(flags, developerPlatformClient, app);
172625
- await sendSample(options);
172517
+ return await sendSample(options), { app };
172626
172518
  }
172627
172519
  async function validateAndCollectFlags(flags, developerPlatformClient, app) {
172628
172520
  let apiVersion = await collectApiVersion(developerPlatformClient, flags.apiVersion), topic = await collectTopic(developerPlatformClient, apiVersion, flags.topic), [address, deliveryMethod] = await collectAddressAndMethod(flags.deliveryMethod, flags.address), clientCredentials = await collectCredentials(flags.clientId, flags.clientSecret, app, deliveryMethod);
@@ -172672,7 +172564,7 @@ function formatErrors(errors2) {
172672
172564
 
172673
172565
  // ../app/dist/cli/commands/app/webhook/trigger.js
172674
172566
  var import_core46 = __toESM(require_lib(), 1);
172675
- var _a34, WebhookTrigger = class extends base_command_default {
172567
+ var _a34, WebhookTrigger = class extends AppCommand {
172676
172568
  async run() {
172677
172569
  let { flags } = await this.parse(_a34), usedFlags = {
172678
172570
  topic: flags.topic,
@@ -172684,12 +172576,12 @@ var _a34, WebhookTrigger = class extends base_command_default {
172684
172576
  path: flags.path,
172685
172577
  config: flags.config
172686
172578
  };
172687
- flags["shared-secret"] && renderWarning({
172579
+ return flags["shared-secret"] && renderWarning({
172688
172580
  headline: [
172689
172581
  "The flag shared-secret has been deprecated in favor of client-secret and will eventually be deleted."
172690
172582
  ],
172691
172583
  body: ["Please use --client-secret instead."]
172692
- }), await webhookTriggerService(usedFlags);
172584
+ }), { app: (await webhookTriggerService(usedFlags)).app };
172693
172585
  }
172694
172586
  };
172695
172587
  _a34 = WebhookTrigger;
@@ -174331,7 +174223,10 @@ export {
174331
174223
  hooks as PluginHook,
174332
174224
  provider_default as TunnelProviderHook,
174333
174225
  tunnel_default as TunnelStartHook,
174334
- src_default as default
174226
+ src_default as default,
174227
+ publicFetchStoreThemes as fetchStoreThemes,
174228
+ pull,
174229
+ push
174335
174230
  };
174336
174231
  /*! Bundled license information:
174337
174232