@shopify/cli 3.67.2 → 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-6PW7I4PG.js → chunk-4H7GRGC6.js} +3 -3
  2. package/dist/{chunk-DRZBXASC.js → chunk-5VZ6BLBM.js} +3 -3
  3. package/dist/{chunk-5RIQPY5J.js → chunk-6IS7OFWG.js} +5 -5
  4. package/dist/{chunk-3WDAYAS7.js → chunk-7PUJMPXN.js} +5528 -17168
  5. package/dist/{chunk-2Q4KXXH7.js → chunk-A3DV6VXO.js} +2 -2
  6. package/dist/{chunk-ZCKALXEF.js → chunk-C4FBYE7F.js} +4 -4
  7. package/dist/{chunk-FH3MZSH6.js → chunk-D72SCNZ2.js} +6 -2
  8. package/dist/chunk-DD5ULVKP.js +103 -0
  9. package/dist/{chunk-UU4VCC4D.js → chunk-DMM6NVLV.js} +4 -4
  10. package/dist/{chunk-7IU4SQFO.js → chunk-E2OAY724.js} +2 -2
  11. package/dist/{chunk-EFKO63JK.js → chunk-EUBA2XGP.js} +4 -4
  12. package/dist/{chunk-LC2LNJNM.js → chunk-FIAUTHMT.js} +2 -2
  13. package/dist/{chunk-STZTH6VQ.js → chunk-FKQTUQ3O.js} +4 -4
  14. package/dist/{chunk-FQIDK63N.js → chunk-G47SEBU3.js} +3 -3
  15. package/dist/{chunk-EJNO7GOB.js → chunk-GDKBDEZV.js} +3 -3
  16. package/dist/{chunk-R3LRKILP.js → chunk-HTDUPJH5.js} +3 -3
  17. package/dist/{chunk-ZBI666QU.js → chunk-IL455HI5.js} +3 -3
  18. package/dist/{chunk-TSBX37ED.js → chunk-INEJACZ7.js} +3 -3
  19. package/dist/{chunk-B2FBI5M7.js → chunk-JAH3NBCG.js} +4 -4
  20. package/dist/{chunk-J5YDWXWQ.js → chunk-JAQZDU4S.js} +2 -2
  21. package/dist/{chunk-NSWINIBD.js → chunk-JJOZP7G6.js} +3 -3
  22. package/dist/{chunk-VN52QBYW.js → chunk-JR6ZN4TY.js} +4 -4
  23. package/dist/{chunk-7BYOY5N5.js → chunk-MXZ6B3TP.js} +2 -2
  24. package/dist/{chunk-PMK54HHN.js → chunk-NCUKAORS.js} +6 -6
  25. package/dist/{chunk-BC6U7ADI.js → chunk-OBX5DIH4.js} +4 -4
  26. package/dist/{chunk-562KSNGI.js → chunk-QIBFYG6F.js} +3 -3
  27. package/dist/{chunk-V6H23CVU.js → chunk-RUR45G5U.js} +14 -2
  28. package/dist/{chunk-Z56WKKTE.js → chunk-UCYJX4VB.js} +2 -2
  29. package/dist/{chunk-WETDRCPJ.js → chunk-VVY6VJR6.js} +2 -2
  30. package/dist/{chunk-JOCNTZDE.js → chunk-WJBW5QHV.js} +2 -2
  31. package/dist/chunk-WUA6LTEH.js +15959 -0
  32. package/dist/{chunk-JAG2AX55.js → chunk-XCGES3AJ.js} +3 -3
  33. package/dist/{chunk-PAZH6CHQ.js → chunk-YKH4ILAB.js} +14 -12
  34. package/dist/{chunk-X2SV2NGT.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-YYAVL5FV.js → custom-oclif-loader-Y5TLP3GI.js} +2 -2
  69. package/dist/{error-handler-64WEMROQ.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 +512 -615
  74. package/dist/{local-XTOGAMBD.js → local-4NQ3UGM2.js} +4 -2
  75. package/dist/{node-7GXTBJVP.js → node-NWOSUD3V.js} +12 -13
  76. package/dist/{node-package-manager-OQGCO62Q.js → node-package-manager-D7JIOBLM.js} +5 -3
  77. package/dist/{system-OLJOMCQB.js → system-WDT2XUAD.js} +2 -2
  78. package/dist/tsconfig.tsbuildinfo +1 -1
  79. package/dist/{ui-XXPOXZHJ.js → ui-JUVEDXYN.js} +2 -2
  80. package/dist/{workerd-PZPTMVQ4.js → workerd-VWTWLJIV.js} +12 -13
  81. package/oclif.manifest.json +15 -52
  82. package/package.json +6 -6
  83. package/dist/chunk-3UX657AK.js +0 -4244
  84. package/dist/chunk-HH7KQOBX.js +0 -118
  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-PAZH6CHQ.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-562KSNGI.js";
144
+ } from "./chunk-QIBFYG6F.js";
145
145
  import {
146
146
  Search
147
- } from "./chunk-FQIDK63N.js";
147
+ } from "./chunk-G47SEBU3.js";
148
148
  import {
149
149
  Upgrade
150
- } from "./chunk-ZCKALXEF.js";
150
+ } from "./chunk-C4FBYE7F.js";
151
151
  import {
152
152
  getOutputUpdateCLIReminder
153
- } from "./chunk-NSWINIBD.js";
153
+ } from "./chunk-JJOZP7G6.js";
154
154
  import {
155
155
  Version
156
- } from "./chunk-ZBI666QU.js";
157
- import "./chunk-JAG2AX55.js";
158
- import "./chunk-7BYOY5N5.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-WETDRCPJ.js";
161
+ } from "./chunk-VVY6VJR6.js";
162
162
  import {
163
163
  KitchenSinkAsync
164
- } from "./chunk-R3LRKILP.js";
164
+ } from "./chunk-HTDUPJH5.js";
165
165
  import {
166
166
  KitchenSinkAll
167
- } from "./chunk-5RIQPY5J.js";
168
- import "./chunk-X2SV2NGT.js";
169
- import "./chunk-Z56WKKTE.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-6PW7I4PG.js";
173
- import "./chunk-7IU4SQFO.js";
172
+ } from "./chunk-4H7GRGC6.js";
173
+ import "./chunk-E2OAY724.js";
174
174
  import {
175
175
  Logout
176
- } from "./chunk-B2FBI5M7.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-3UX657AK.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-EJNO7GOB.js";
187
+ } from "./chunk-GDKBDEZV.js";
204
188
  import {
205
189
  Catalog
206
- } from "./chunk-BC6U7ADI.js";
190
+ } from "./chunk-OBX5DIH4.js";
207
191
  import {
208
192
  GenerateFile
209
- } from "./chunk-STZTH6VQ.js";
193
+ } from "./chunk-FKQTUQ3O.js";
210
194
  import {
211
195
  Demo
212
- } from "./chunk-VN52QBYW.js";
196
+ } from "./chunk-JR6ZN4TY.js";
213
197
  import {
214
198
  PrintAIPrompt
215
- } from "./chunk-UU4VCC4D.js";
199
+ } from "./chunk-DMM6NVLV.js";
216
200
  import "./chunk-QSUS3GJF.js";
217
- import "./chunk-JOCNTZDE.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-DRZBXASC.js";
204
+ } from "./chunk-5VZ6BLBM.js";
226
205
  import {
227
206
  base_command_default,
228
207
  decodeToml,
229
208
  encodeToml
230
- } from "./chunk-EFKO63JK.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-PMK54HHN.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-3WDAYAS7.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-HH7KQOBX.js";
264
259
  import {
265
260
  platformAndArch,
266
261
  username
267
- } from "./chunk-J5YDWXWQ.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-V6H23CVU.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-2Q4KXXH7.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-FH3MZSH6.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-XXPOXZHJ.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-64WEMROQ.js"), { isDevelopment } = await import("./local-XTOGAMBD.js"), oclif = await import("./lib-4WCTNKJK.js"), { ShopifyConfig } = await import("./custom-oclif-loader-YYAVL5FV.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-OLJOMCQB.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-OLJOMCQB.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)
@@ -147039,9 +147021,17 @@ init_cjs_shims();
147039
147021
  // ../theme/dist/cli/utilities/asset-checksum.js
147040
147022
  init_cjs_shims();
147041
147023
  function calculateChecksum(fileKey, fileContent) {
147024
+ return fileContent ? Buffer.isBuffer(fileContent) ? md5(fileContent) : isSettingsData(fileKey) ? minifiedJSONFileChecksum(fileContent) : regularFileChecksum(fileKey, fileContent) : "";
147025
+ }
147026
+ function minifiedJSONFileChecksum(fileContent) {
147042
147027
  let content = fileContent;
147043
- return content ? (Buffer.isBuffer(content) || (isTextFile(fileKey) && (content = content.replace(/\r\n/g, `
147044
- `)), isJson(fileKey) && !isThemeAsset(fileKey) && !isSettingsSchema(fileKey) && (content = normalizeJson(content), content = content.replace(/(?<!\\)\//g, "\\/"))), md5(content)) : "";
147028
+ return content = content.replace(/\r\n/g, `
147029
+ `), content = content.replace(/\/\*[\s\S]*?\*\//, ""), content = normalizeJson(content), md5(content);
147030
+ }
147031
+ function regularFileChecksum(fileKey, fileContent) {
147032
+ let content = fileContent;
147033
+ return isTextFile(fileKey) && (content = content.replace(/\r\n/g, `
147034
+ `)), md5(content);
147045
147035
  }
147046
147036
  function normalizeJson(jsonStr) {
147047
147037
  let inStr = !1, wasBackslash = !1, formattedStr = "";
@@ -147060,8 +147050,8 @@ function rejectGeneratedStaticAssets(themeChecksums) {
147060
147050
  function hasLiquidSource(checksums, key) {
147061
147051
  return checksums.some((checksum) => checksum.key === `${key}.liquid`);
147062
147052
  }
147063
- function isSettingsSchema(path3) {
147064
- return path3.endsWith("/settings_schema.json");
147053
+ function isSettingsData(path3) {
147054
+ return path3.endsWith("/settings_data.json");
147065
147055
  }
147066
147056
 
147067
147057
  // ../theme/dist/cli/utilities/asset-ignore.js
@@ -147674,10 +147664,10 @@ ${result.errors.asset.map((error) => `- ${error}`).join(`
147674
147664
  }, handleFileDelete = (themeId, adminSession, fileKey) => {
147675
147665
  isFileIgnored(fileKey) || (files.delete(fileKey), unsyncedFileKeys.add(fileKey), emitEvent("unlink", { fileKey }), deleteThemeAsset(Number(themeId), fileKey, adminSession).then(async (success) => {
147676
147666
  if (!success)
147677
- throw new Error("Unknown issue.");
147667
+ throw new Error(`Failed to delete file "${fileKey}" from remote theme.`);
147678
147668
  unsyncedFileKeys.delete(fileKey), outputSyncResult("delete", fileKey);
147679
147669
  }).catch((error) => {
147680
- renderWarning({ headline: `Failed to delete file "${fileKey}".`, body: error.message });
147670
+ outputDebug(error.message);
147681
147671
  }));
147682
147672
  }, directoriesToWatch = new Set(THEME_DIRECTORY_PATTERNS.map((pattern) => joinPath(root, pattern.split("/").shift() ?? "")));
147683
147673
  return {
@@ -147689,7 +147679,12 @@ ${result.errors.asset.map((error) => `- ${error}`).join(`
147689
147679
  files.delete(fileKey), await removeThemeFile(root, fileKey);
147690
147680
  },
147691
147681
  write: async (asset) => {
147692
- 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);
147693
147688
  },
147694
147689
  read,
147695
147690
  applyIgnoreFilters: (files2) => applyIgnoreFilters(files2, filterPatterns),
@@ -147730,12 +147725,6 @@ async function removeThemeFile(root, path3) {
147730
147725
  }
147731
147726
  await removeFile(absolutePath);
147732
147727
  }
147733
- function isThemeAsset(path3) {
147734
- return path3.startsWith("assets/");
147735
- }
147736
- function isJson(path3) {
147737
- return lookupMimeType(path3) === "application/json";
147738
- }
147739
147728
  function partitionThemeFiles(files) {
147740
147729
  let sectionLiquidFiles = [], otherLiquidFiles = [], sectionJsonFiles = [], templateJsonFiles = [], otherJsonFiles = [], contextualizedJsonFiles = [], configFiles = [], staticAssetFiles = [];
147741
147730
  return files.forEach((file) => {
@@ -147763,7 +147752,8 @@ function isTextFile(path3) {
147763
147752
  "application/liquid",
147764
147753
  "text/css",
147765
147754
  "text/x-sass",
147766
- "text/x-scss"
147755
+ "text/x-scss",
147756
+ "image/svg+xml"
147767
147757
  ].includes(lookupMimeType(path3));
147768
147758
  }
147769
147759
  async function hasRequiredThemeDirectories(path3) {
@@ -147900,7 +147890,7 @@ function getStoreFqdnForRegEx(ctx) {
147900
147890
  function injectCdnProxy(originalContent, ctx) {
147901
147891
  let content = originalContent, vanityCdnRE = new RegExp(`(https?:)?//${getStoreFqdnForRegEx(ctx)}${VANITY_CDN_PREFIX}`, "g");
147902
147892
  content = content.replace(vanityCdnRE, VANITY_CDN_PREFIX);
147903
- 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));
147904
147894
  return content = content.replace(mainCdnRE, (matchedUrl, pathname, matchedAsset) => {
147905
147895
  let isLocalAsset = matchedAsset && existingAssets.has(matchedAsset), isLocalExtAsset = matchedAsset && existingExtAssets.has(matchedAsset) && pathname.startsWith("extensions/");
147906
147896
  return lookupMimeType(matchedAsset).startsWith("image/") ? matchedUrl : isLocalExtAsset ? `${EXTENSION_CDN_PREFIX}${pathname}` : isLocalAsset ? `${VANITY_CDN_PREFIX}${pathname}` : matchedUrl;
@@ -147917,7 +147907,7 @@ function patchCookieDomains(cookieHeader, ctx) {
147917
147907
  async function patchRenderingResponse(ctx, event, response) {
147918
147908
  setResponseStatus(event, response.status, response.statusText), setResponseHeaders(event, Object.fromEntries(response.headers.entries())), patchProxiedResponseHeaders(ctx, event, response);
147919
147909
  let html = await response.text();
147920
- 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;
147921
147911
  }
147922
147912
  var HOP_BY_HOP_HEADERS = [
147923
147913
  "connection",
@@ -147928,7 +147918,9 @@ var HOP_BY_HOP_HEADERS = [
147928
147918
  "trailer",
147929
147919
  "transfer-encoding",
147930
147920
  "upgrade",
147931
- "content-security-policy"
147921
+ "expect",
147922
+ "content-security-policy",
147923
+ "host"
147932
147924
  ];
147933
147925
  function patchProxiedResponseHeaders(ctx, event, response) {
147934
147926
  clearResponseHeaders(event, HOP_BY_HOP_HEADERS);
@@ -147947,7 +147939,7 @@ function patchProxiedResponseHeaders(ctx, event, response) {
147947
147939
  }
147948
147940
  }
147949
147941
  function getProxyStorefrontHeaders(event) {
147950
- let proxyRequestHeaders = getProxyRequestHeaders(event);
147942
+ let proxyRequestHeaders = getRequestHeaders(event);
147951
147943
  for (let headerKey of HOP_BY_HOP_HEADERS)
147952
147944
  delete proxyRequestHeaders[headerKey];
147953
147945
  delete proxyRequestHeaders["upgrade-insecure-requests"];
@@ -148081,7 +148073,7 @@ function getAssetsHandler(_theme, ctx) {
148081
148073
  isUnsynced && sendError(event, createError({ statusCode: 404, statusMessage: "Not found" }));
148082
148074
  return;
148083
148075
  }
148084
- 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");
148085
148077
  return serveStatic(event, {
148086
148078
  getContents: () => fileContent,
148087
148079
  // Note: stats.size is the length of the base64 string for attachments,
@@ -148099,7 +148091,7 @@ function findLocalFile(event, ctx) {
148099
148091
  return { file, isUnsynced, fileKey };
148100
148092
  }
148101
148093
  };
148102
- 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) ?? {
148103
148095
  isUnsynced: !1,
148104
148096
  fileKey: void 0,
148105
148097
  file: void 0
@@ -148213,7 +148205,7 @@ function getHtmlHandler(theme, ctx) {
148213
148205
  replaceTemplates: getInMemoryTemplates(ctx, browserPathname, getCookie2(event, "localization")?.toLowerCase())
148214
148206
  }).then(async (response) => {
148215
148207
  let html = await patchRenderingResponse(ctx, event, response);
148216
- 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;
148217
148209
  }).catch(async (error) => {
148218
148210
  let headline = `Failed to render storefront with status ${error.statusCode} (${error.statusMessage}).`;
148219
148211
  error.data?.requestId && (headline += `
@@ -148225,7 +148217,7 @@ URL: ${error.data.url}`);
148225
148217
  `), errorPageHtml = getErrorPage({
148226
148218
  title,
148227
148219
  header: title,
148228
- message: [...rest, error.message].join("<br>"),
148220
+ message: [...rest, cause?.message ?? error.message].join("<br>"),
148229
148221
  code: error.stack?.replace(`${error.message}
148230
148222
  `, "") ?? ""
148231
148223
  });
@@ -148262,6 +148254,14 @@ function getErrorPage(options) {
148262
148254
  </body>
148263
148255
  </html>`;
148264
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
+ }
148265
148265
 
148266
148266
  // ../theme/dist/cli/utilities/theme-environment/hot-reload/server.js
148267
148267
  var import_theme_check_node3 = __toESM(require_dist5(), 1);
@@ -148295,7 +148295,7 @@ function getInMemoryTemplates(ctx, currentRoute, locale) {
148295
148295
  }
148296
148296
  return inMemoryTemplates;
148297
148297
  }
148298
- function setupInMemoryTemplateWatcher2(theme, ctx) {
148298
+ function setupInMemoryTemplateWatcher2(ctx) {
148299
148299
  let handleFileUpdate = ({ fileKey, onContent, onSync }) => {
148300
148300
  let extension = extname(fileKey);
148301
148301
  fileKey.startsWith("assets/") ? extension === ".liquid" ? onSync(() => triggerHotReload(fileKey, ctx)) : triggerHotReload(fileKey, ctx) : needsTemplateUpdate(fileKey) ? onContent((content) => {
@@ -148305,7 +148305,6 @@ function setupInMemoryTemplateWatcher2(theme, ctx) {
148305
148305
  return ctx.localThemeFileSystem.addEventListener("add", handleFileUpdate), ctx.localThemeFileSystem.addEventListener("change", handleFileUpdate), ctx.localThemeFileSystem.addEventListener("unlink", ({ fileKey }) => {
148306
148306
  sectionNamesByFile.delete(fileKey), triggerHotReload(fileKey, ctx);
148307
148307
  }), ctx.localThemeFileSystem.ready().then(async () => {
148308
- await ctx.localThemeFileSystem.startWatcher(theme.id.toString(), ctx.session);
148309
148308
  let files = [...ctx.localThemeFileSystem.files];
148310
148309
  return Promise.allSettled(files.map(async ([fileKey, file]) => {
148311
148310
  if (fileKey.endsWith(".json")) {
@@ -148408,7 +148407,7 @@ function hotReloadSections(key, ctx) {
148408
148407
  for (let [type, name] of sections)
148409
148408
  type === sectionId && sectionsToUpdate.add(name);
148410
148409
  }
148411
- sectionsToUpdate.size > 0 && emitHotReloadEvent({ type: "section", key, names: [...sectionsToUpdate] });
148410
+ sectionsToUpdate.size > 0 ? emitHotReloadEvent({ type: "section", key, names: [...sectionsToUpdate] }) : emitHotReloadEvent({ type: "full", key });
148412
148411
  }
148413
148412
  function injectHotReloadScript(html) {
148414
148413
  return html.replace(/<\/head>/, `${getClientScripts()}</head>`);
@@ -148781,8 +148780,7 @@ function reportFailedUploads(uploadResults) {
148781
148780
  // ../theme/dist/cli/utilities/theme-environment/theme-environment.js
148782
148781
  import { createServer as createServer2 } from "node:http";
148783
148782
  function setupDevServer(theme, ctx) {
148784
- let watcherPromise = setupInMemoryTemplateWatcher2(theme, ctx), envSetup = ensureThemeEnvironmentSetup(theme, ctx), workPromise = Promise.all([watcherPromise, envSetup.workPromise]).then(() => {
148785
- }), 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);
148786
148784
  return {
148787
148785
  workPromise,
148788
148786
  serverStart: server.start,
@@ -149735,7 +149733,24 @@ function notNull(value) {
149735
149733
  }
149736
149734
 
149737
149735
  // ../theme/dist/cli/services/pull.js
149738
- 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) {
149739
149754
  let path3 = options.path, force = options.force;
149740
149755
  if (!await isEmptyDir(path3) && !await hasRequiredThemeDirectories(path3) && !await currentDirectoryConfirmed(force))
149741
149756
  return;
@@ -149775,21 +149790,25 @@ var import_core12 = __toESM(require_lib(), 1);
149775
149790
  var _a10, Pull = class extends ThemeCommand {
149776
149791
  async run() {
149777
149792
  showEmbeddedCLIWarning();
149778
- 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());
149779
- if (!flags.legacy) {
149780
- let { path: path3, nodelete, live, development, only, ignore, force } = flags, theme = await findOrSelectTheme(adminSession, {
149781
- header: "Select a theme to open",
149782
- filter: {
149783
- live,
149784
- theme: development ? `${developmentTheme?.id}` : flags.theme
149785
- }
149786
- });
149787
- await pull(theme, adminSession, { path: path3, nodelete, only, ignore, force });
149788
- return;
149789
- }
149790
- 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;
149791
149810
  developmentTheme && (flagsForCli2.development && (flagsForCli2.theme = `${developmentTheme.id}`, flagsForCli2.development = !1), useEmbeddedThemeCLI() && (flagsForCli2["development-theme-id"] = developmentTheme.id));
149792
- 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);
149793
149812
  await execCLI2(command, { store, adminToken: adminSession.token });
149794
149813
  }
149795
149814
  };
@@ -149854,7 +149873,22 @@ init_cjs_shims();
149854
149873
 
149855
149874
  // ../theme/dist/cli/services/push.js
149856
149875
  init_cjs_shims();
149857
- 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) {
149858
149892
  let themeChecksums = await fetchChecksums(theme.id, session), themeFileSystem = mountThemeFileSystem(options.path, { filters: options }), { uploadResults, renderThemeSyncProgress } = await uploadTheme(theme, session, themeChecksums, themeFileSystem, options);
149859
149893
  await renderThemeSyncProgress(), options.publish && await publishTheme(theme.id, session), await handlePushOutput(uploadResults, theme, session, options);
149860
149894
  }
@@ -149915,29 +149949,76 @@ function handleOutput(theme, hasErrors, session) {
149915
149949
  nextSteps
149916
149950
  });
149917
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
+ }
149918
149987
 
149919
149988
  // ../theme/dist/cli/commands/theme/push.js
149920
149989
  var import_core13 = __toESM(require_lib(), 1);
149921
149990
  var _a11, Push = class extends ThemeCommand {
149922
149991
  async run() {
149923
- let { flags } = await this.parse(_a11), { path: path3, force } = flags, store = ensureThemeStore(flags), adminSession = await ensureAuthenticatedThemes(store, flags.password), workingDirectory = path3 ? resolvePath(path3) : cwd();
149924
- if (!await hasRequiredThemeDirectories(workingDirectory) && !await currentDirectoryConfirmed(force))
149925
- return;
149926
- if (!flags.legacy && !flags.password) {
149927
- let { path: path4, nodelete, publish: publish2, json, force: force2, ignore, only } = flags, selectedTheme = await createOrSelectTheme(adminSession, flags);
149928
- if (!selectedTheme)
149929
- return;
149930
- await push(selectedTheme, adminSession, {
149931
- path: path4,
149932
- nodelete,
149933
- publish: publish2,
149934
- json,
149935
- force: force2,
149936
- ignore,
149937
- only
149938
- });
149992
+ let { flags } = await this.parse(_a11);
149993
+ if (flags.password || flags.legacy) {
149994
+ await this.execLegacyPush();
149939
149995
  return;
149940
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;
149941
150022
  let flagsForCli2 = flags;
149942
150023
  showEmbeddedCLIWarning();
149943
150024
  let developmentThemeManager = new DevelopmentThemeManager(adminSession), targetTheme = await (flagsForCli2.development ? developmentThemeManager.findOrCreate() : developmentThemeManager.fetch());
@@ -150062,41 +150143,6 @@ Push.cli2Flags = [
150062
150143
  "development-theme-id"
150063
150144
  ];
150064
150145
  var push_default = Push;
150065
- async function createOrSelectTheme(adminSession, flags) {
150066
- let { live, development, unpublished, theme } = flags;
150067
- if (development)
150068
- return new DevelopmentThemeManager(adminSession).findOrCreate();
150069
- if (unpublished) {
150070
- let themeName = theme || await promptThemeName("Name of the new theme");
150071
- return createTheme({
150072
- name: themeName,
150073
- role: UNPUBLISHED_THEME_ROLE
150074
- }, adminSession);
150075
- } else {
150076
- let selectedTheme = await findOrSelectTheme(adminSession, {
150077
- header: "Select a theme to push to:",
150078
- filter: {
150079
- live,
150080
- theme
150081
- }
150082
- });
150083
- if (await confirmPushToTheme(selectedTheme.role, flags["allow-live"], adminSession.storeFqdn))
150084
- return selectedTheme;
150085
- }
150086
- }
150087
- async function confirmPushToTheme(themeRole, allowLive, storeFqdn) {
150088
- if (themeRole === LIVE_THEME_ROLE) {
150089
- if (allowLive)
150090
- return !0;
150091
- let options = {
150092
- message: `Push theme files to the ${themeRole} theme on ${storeFqdn}?`,
150093
- confirmationMessage: "Yes, confirm changes",
150094
- cancellationMessage: "Cancel"
150095
- };
150096
- return renderConfirmationPrompt(options);
150097
- }
150098
- return !0;
150099
- }
150100
150146
 
150101
150147
  // ../theme/dist/cli/commands/theme/rename.js
150102
150148
  init_cjs_shims();
@@ -150477,8 +150523,8 @@ async function checkLockfileStatus(directory, shouldExit = !1) {
150477
150523
  if (isHydrogenMonorepo && !process.env.SHOPIFY_UNIT_TEST)
150478
150524
  return;
150479
150525
  let foundPackageManagers = [];
150480
- for (let packageManager2 of packageManagers)
150481
- 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);
150482
150528
  if (foundPackageManagers.length === 0)
150483
150529
  return missingLockfileWarning(shouldExit);
150484
150530
  if (foundPackageManagers.length > 1)
@@ -150954,7 +151000,7 @@ async function runClassicCompilerBuild({
150954
151000
  if (!disableRouteWarning) {
150955
151001
  let missingRoutes = findMissingRoutes(remixConfig);
150956
151002
  if (missingRoutes.length) {
150957
- let packageManager2 = await getPackageManager(root), exec2 = packageManager2 === "npm" ? "npx" : packageManager2;
151003
+ let packageManager = await getPackageManager(root), exec2 = packageManager === "npm" ? "npx" : packageManager;
150958
151004
  outputWarn(
150959
151005
  `Heads up: Shopify stores have a number of standard routes that aren\u2019t set up yet.
150960
151006
  Some functionality and backlinks might not work as expected until these are created or redirects are set up.
@@ -151299,7 +151345,7 @@ async function runBuild({
151299
151345
  if (!watch && !disableRouteWarning) {
151300
151346
  let missingRoutes = findMissingRoutes(remixConfig);
151301
151347
  if (missingRoutes.length) {
151302
- let packageManager2 = await getPackageManager(root), exec2 = packageManager2 === "npm" ? "npx" : packageManager2;
151348
+ let packageManager = await getPackageManager(root), exec2 = packageManager === "npm" ? "npx" : packageManager;
151303
151349
  outputWarn(
151304
151350
  `Heads up: Shopify stores have a number of standard routes that aren\u2019t set up yet.
151305
151351
  Some functionality and backlinks might not work as expected until these are created or redirects are set up.
@@ -153613,7 +153659,7 @@ file://${instrunctionsFilePath}`;
153613
153659
  let releaseNotesUrl = `https://hydrogen.shopify.dev/releases/${selectedRelease.version}`;
153614
153660
  nextSteps.push(`Release notes:
153615
153661
  ${releaseNotesUrl}`);
153616
- 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);
153617
153663
  return renderSuccess({
153618
153664
  headline,
153619
153665
  // @ts-ignore we know that filter(Boolean) will always return an array
@@ -153644,7 +153690,7 @@ ${releaseNotesUrl}`);
153644
153690
  {
153645
153691
  list: {
153646
153692
  items: [
153647
- `Run \`git restore . && git clean -df && ${packageManager2} i\``
153693
+ `Run \`git restore . && git clean -df && ${packageManager} i\``
153648
153694
  ]
153649
153695
  }
153650
153696
  }
@@ -153834,10 +153880,10 @@ async function buildAssetsUrl(port, root) {
153834
153880
  async function startMiniOxygen(options, useNodeRuntime = !1) {
153835
153881
  if (useNodeRuntime) {
153836
153882
  process.env.MINIFLARE_SUBREQUEST_LIMIT = 100;
153837
- let { startNodeServer } = await import("./node-7GXTBJVP.js");
153883
+ let { startNodeServer } = await import("./node-NWOSUD3V.js");
153838
153884
  return startNodeServer(options);
153839
153885
  }
153840
- let { startWorkerdServer } = await import("./workerd-PZPTMVQ4.js");
153886
+ let { startWorkerdServer } = await import("./workerd-VWTWLJIV.js");
153841
153887
  return startWorkerdServer(options);
153842
153888
  }
153843
153889
 
@@ -154937,27 +154983,27 @@ async function runEnvPush({
154937
154983
  ({ id }) => id === pushToBranchSelection
154938
154984
  );
154939
154985
  }
154940
- let { environmentVariables: environmentVariables2 = [] } = await getStorefrontEnvVariables(
154986
+ let { environmentVariables = [] } = await getStorefrontEnvVariables(
154941
154987
  session,
154942
154988
  config2.storefront.id,
154943
154989
  validatedEnvironment.handle
154944
- ) ?? {}, comparableRemoteVars = environmentVariables2.filter(
154990
+ ) ?? {}, comparableRemoteVars = environmentVariables.filter(
154945
154991
  ({ isSecret, readOnly }) => !isSecret && !readOnly
154946
154992
  ).sort((a, b) => a.key.localeCompare(b.key)).map(({ key, value }) => createDotEnvFileLine(key, value)).join(`
154947
154993
  `) + `
154948
154994
  `, compareableLocalVars = Object.keys(localVariables).sort((a, b) => a.localeCompare(b)).reduce((acc, key) => {
154949
- let { isSecret, readOnly } = environmentVariables2.find((variable) => variable.key === key) ?? {};
154995
+ let { isSecret, readOnly } = environmentVariables.find((variable) => variable.key === key) ?? {};
154950
154996
  return isSecret || readOnly ? acc : [...acc, createDotEnvFileLine(key, localVariables[key])];
154951
154997
  }, []).join(`
154952
154998
  `) + `
154953
154999
  `;
154954
155000
  if (!validatedEnvironment.name)
154955
155001
  throw new AbortError("Missing environment name");
154956
- let remoteReadOnlyOrSecrets = environmentVariables2.reduce(
155002
+ let remoteReadOnlyOrSecrets = environmentVariables.reduce(
154957
155003
  (acc, { isSecret, readOnly, key }) => {
154958
155004
  if (!isSecret && !readOnly)
154959
155005
  return acc;
154960
- let localVar = localVariables[key], remoteVar = environmentVariables2.find(
155006
+ let localVar = localVariables[key], remoteVar = environmentVariables.find(
154961
155007
  (variable) => variable.key === key
154962
155008
  );
154963
155009
  return localVar === remoteVar?.value ? acc : [...acc, key];
@@ -155138,9 +155184,9 @@ async function checkCurrentCLIVersion() {
155138
155184
  label: "Global CLI reference",
155139
155185
  url: "https://shopify.dev/docs/api/shopify-cli/"
155140
155186
  }
155141
- }), (packageManager2) => {
155142
- packageManager2 ??= packageManagerFromUserAgent(), (packageManager2 === "unknown" || !packageManager2) && (packageManager2 = inferPackageManagerForGlobalCLI()), packageManager2 === "unknown" && (packageManager2 = "npm");
155143
- 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\``;
155144
155190
  return renderInfo({
155145
155191
  headline: "Upgrade available",
155146
155192
  body: `Version ${newVersionAvailable} of ${pkgName} is now available.
@@ -155272,17 +155318,17 @@ async function setupLocalStarterTemplate(options, controller) {
155272
155318
  "Setup " + CSS_STRATEGY_NAME_MAP[cssStrategy]
155273
155319
  ) : void 0
155274
155320
  ));
155275
- let { packageManager: packageManager2, shouldInstallDeps, installDeps } = await handleDependencies(
155321
+ let { packageManager, shouldInstallDeps, installDeps } = await handleDependencies(
155276
155322
  project.directory,
155277
155323
  controller,
155278
155324
  options.packageManager,
155279
155325
  options.installDeps
155280
155326
  ), setupSummary = {
155281
155327
  language,
155282
- packageManager: packageManager2,
155328
+ packageManager,
155283
155329
  cssStrategy,
155284
155330
  depsInstalled: !1,
155285
- cliCommand: await getCliCommand("", packageManager2)
155331
+ cliCommand: await getCliCommand("", packageManager)
155286
155332
  };
155287
155333
  if (shouldInstallDeps) {
155288
155334
  let installingDepsPromise = backgroundWorkPromise.then(async () => {
@@ -155517,16 +155563,16 @@ async function setupRemoteTemplate(options, controller) {
155517
155563
  backgroundWorkPromise = backgroundWorkPromise.then(() => transpileProject().catch(abort2)).then(
155518
155564
  () => options.git ? createInitialCommit(project.directory) : void 0
155519
155565
  );
155520
- let { packageManager: packageManager2, shouldInstallDeps, installDeps } = await handleDependencies(
155566
+ let { packageManager, shouldInstallDeps, installDeps } = await handleDependencies(
155521
155567
  project.directory,
155522
155568
  controller,
155523
155569
  options.packageManager,
155524
155570
  options.installDeps
155525
155571
  ), setupSummary = {
155526
155572
  language,
155527
- packageManager: packageManager2,
155573
+ packageManager,
155528
155574
  depsInstalled: !1,
155529
- cliCommand: await getCliCommand("", packageManager2)
155575
+ cliCommand: await getCliCommand("", packageManager)
155530
155576
  }, tasks = [
155531
155577
  {
155532
155578
  title: "Downloading template",
@@ -156085,10 +156131,10 @@ ${CSS_STRATEGY_HELP_URL_MAP[strategy]}`
156085
156131
  tasks.push({
156086
156132
  title: "Installing new dependencies",
156087
156133
  task: async () => {
156088
- let packageManager2 = await gettingPkgManagerPromise;
156089
- isNpm = packageManager2 === "npm" || packageManager2 === "unknown", await installNodeModules({
156134
+ let packageManager = await gettingPkgManagerPromise;
156135
+ isNpm = packageManager === "npm" || packageManager === "unknown", await installNodeModules({
156090
156136
  directory: remixConfig.rootDirectory,
156091
- packageManager: packageManager2,
156137
+ packageManager,
156092
156138
  args: []
156093
156139
  });
156094
156140
  }
@@ -158275,7 +158321,7 @@ init_cjs_shims();
158275
158321
 
158276
158322
  // ../app/dist/cli/models/extensions/schemas.js
158277
158323
  init_cjs_shims();
158278
- var MAX_EXTENSION_HANDLE_LENGTH = 30, MetafieldSchema = z.object({
158324
+ var MAX_EXTENSION_HANDLE_LENGTH = 50, MetafieldSchema = z.object({
158279
158325
  namespace: z.string(),
158280
158326
  key: z.string()
158281
158327
  }), CollectBuyerConsentCapabilitySchema = z.object({
@@ -158464,6 +158510,17 @@ function createContractBasedConfigModuleSpecification(identifier, ...topLevelKey
158464
158510
  }
158465
158511
  });
158466
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
+ }
158467
158524
  function resolveAppConfigTransform(transformConfig) {
158468
158525
  return transformConfig ? Object.keys(transformConfig).includes("forward") ? transformConfig.forward : (content) => appConfigTransform(content, transformConfig) : (content) => defaultAppConfigTransform(content);
158469
158526
  }
@@ -159589,9 +159646,9 @@ async function handlePartnersErrors(request2) {
159589
159646
  return await request2();
159590
159647
  } catch (error) {
159591
159648
  if (error.errors?.[0]?.extensions?.type === "unsupported_client_version") {
159592
- let packageManager2 = await getPackageManager(cwd());
159649
+ let packageManager = await getPackageManager(cwd());
159593
159650
  throw new AbortError(["Upgrade your CLI version to run the", { command: "deploy" }, "command."], null, [
159594
- ["Run", { command: formatPackageManagerCommand(packageManager2, "shopify upgrade") }]
159651
+ ["Run", { command: formatPackageManagerCommand(packageManager, "shopify upgrade") }]
159595
159652
  ]);
159596
159653
  }
159597
159654
  throw error;
@@ -159794,7 +159851,7 @@ var CONFIG_EXTENSION_IDS = [
159794
159851
  return this.configuration.handle ?? slugify(this.configuration.name ?? "");
159795
159852
  case "dynamic":
159796
159853
  let subscription = this.configuration, handle = `${subscription.topic}${subscription.uri}${subscription.filter}`;
159797
- return hashString(handle).substring(0, 30);
159854
+ return hashString(handle).substring(0, MAX_EXTENSION_HANDLE_LENGTH);
159798
159855
  }
159799
159856
  }
159800
159857
  };
@@ -160905,8 +160962,8 @@ var WebConfigurationAuthCallbackPathSchema = z.preprocess(ensurePathStartsWithSl
160905
160962
  baseWebConfigurationSchema.extend({ roles: z.array(webTypes) }),
160906
160963
  baseWebConfigurationSchema.extend({ type: webTypes })
160907
160964
  ]), ProcessedWebConfigurationSchema = baseWebConfigurationSchema.extend({ roles: z.array(webTypes) }), App = class {
160908
- constructor({ name, directory, packageManager: packageManager2, configuration, nodeDependencies, webs, modules, usesWorkspaces: usesWorkspaces2, dotenv, errors: errors2, specifications, configSchema, remoteFlags }) {
160909
- 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 ?? [];
160910
160967
  }
160911
160968
  get allExtensions() {
160912
160969
  return this.remoteFlags.includes(Flag.DeclarativeWebhooks) || this.filterDeclarativeWebhooksConfig(), this.includeConfigOnDeploy ? this.realExtensions : this.realExtensions.filter((ext) => !ext.isAppConfigExtension);
@@ -161267,9 +161324,7 @@ function updateURLsPrompt(currentAppUrl, currentRedirectUrls) {
161267
161324
  // ../app/dist/cli/services/dev/select-app.js
161268
161325
  async function selectOrCreateApp(localAppName, apps, hasMorePages, org, developerPlatformClient, options) {
161269
161326
  let createNewApp = apps.length === 0;
161270
- if (createNewApp || (outputInfo(`
161271
- Before proceeding, your project needs to be associated with an app.
161272
- `), createNewApp = await createAsNewAppPrompt()), createNewApp) {
161327
+ if (createNewApp || (createNewApp = await createAsNewAppPrompt()), createNewApp) {
161273
161328
  let name = await appNamePrompt(localAppName);
161274
161329
  return developerPlatformClient.createApp(org, name, options);
161275
161330
  } else {
@@ -163053,170 +163108,7 @@ var TaxCalculationsSchema = BaseSchema.extend({
163053
163108
 
163054
163109
  // ../app/dist/cli/models/extensions/specifications/marketing_activity.js
163055
163110
  init_cjs_shims();
163056
-
163057
- // ../app/dist/cli/models/extensions/specifications/marketing_activity_schemas/marketing_activity_schema.js
163058
- init_cjs_shims();
163059
- var BaseFieldSchema = z.object({
163060
- ui_type: z.string()
163061
- }), CommonFieldSchema = BaseFieldSchema.extend({
163062
- name: z.string(),
163063
- label: z.string(),
163064
- help_text: z.string().optional(),
163065
- required: z.boolean()
163066
- }), BudgetScheduleFieldSchema = CommonFieldSchema.extend({
163067
- ui_type: z.literal("budget-schedule"),
163068
- use_scheduling: z.boolean(),
163069
- use_end_date: z.boolean(),
163070
- use_daily_budget: z.boolean(),
163071
- use_lifetime_budget: z.boolean()
163072
- }), DiscountPickerFieldSchema = CommonFieldSchema.extend({
163073
- ui_type: z.literal("discount-picker"),
163074
- min_resources: z.number().nullable(),
163075
- max_resources: z.number().nullable()
163076
- }), ScheduleFieldSchema = CommonFieldSchema.extend({
163077
- ui_type: z.literal("schedule"),
163078
- use_end_date: z.boolean()
163079
- }), ProductPickerFieldSchema = CommonFieldSchema.extend({
163080
- ui_type: z.literal("product-picker"),
163081
- allow_product_image_selection: z.boolean(),
163082
- allow_uploaded_image_as_product_image: z.boolean(),
163083
- allow_free_image_as_product_image: z.boolean(),
163084
- min_resources: z.number().optional(),
163085
- max_resources: z.number().optional(),
163086
- min_image_select_per_product: z.number().optional(),
163087
- max_image_select_per_product: z.number().optional()
163088
- }), SingleLineTextFieldSchema = CommonFieldSchema.extend({
163089
- ui_type: z.enum(["text-single-line", "text-email", "text-tel", "text-url"]),
163090
- placeholder: z.string().optional(),
163091
- min_length: z.number(),
163092
- max_length: z.number()
163093
- }), TextMultiLineFieldSchema = CommonFieldSchema.extend({
163094
- ui_type: z.literal("text-multi-line"),
163095
- placeholder: z.string(),
163096
- min_length: z.number(),
163097
- max_length: z.number()
163098
- }), DividerFieldSchema = BaseFieldSchema.extend({
163099
- ui_type: z.literal("divider"),
163100
- title: z.string(),
163101
- name: z.string()
163102
- }), SelectFieldSchema = CommonFieldSchema.extend({
163103
- ui_type: z.enum(["select-single", "select-multiple"]),
163104
- choices: z.array(z.object({
163105
- label: z.string(),
163106
- value: z.string()
163107
- }))
163108
- }), ParagraphFieldSchema = BaseFieldSchema.extend({
163109
- ui_type: z.literal("paragraph"),
163110
- heading: z.string().optional(),
163111
- body: z.string().optional()
163112
- }), TypeAheadFieldSchema = CommonFieldSchema.extend({
163113
- ui_type: z.literal("type-ahead"),
163114
- placeholder: z.string()
163115
- }), NumberFieldSchema = CommonFieldSchema.extend({
163116
- ui_type: z.enum(["number-float", "number-integer"]),
163117
- min: z.number(),
163118
- max: z.number(),
163119
- step: z.number()
163120
- }), ImagePickerFieldSchema = CommonFieldSchema.extend({
163121
- ui_type: z.literal("image-picker"),
163122
- min_resources: z.number(),
163123
- max_resources: z.number(),
163124
- allow_free_images: z.boolean(),
163125
- alt_text_required: z.boolean()
163126
- }), UISchemaMapping = {
163127
- "budget-schedule": BudgetScheduleFieldSchema,
163128
- "discount-picker": DiscountPickerFieldSchema,
163129
- schedule: ScheduleFieldSchema,
163130
- "product-picker": ProductPickerFieldSchema,
163131
- "text-single-line": SingleLineTextFieldSchema,
163132
- "text-email": SingleLineTextFieldSchema,
163133
- "text-tel": SingleLineTextFieldSchema,
163134
- "text-url": SingleLineTextFieldSchema,
163135
- "text-multi-line": TextMultiLineFieldSchema,
163136
- "select-single": SelectFieldSchema,
163137
- "select-multiple": SelectFieldSchema,
163138
- paragraph: ParagraphFieldSchema,
163139
- "type-ahead": TypeAheadFieldSchema,
163140
- "number-float": NumberFieldSchema,
163141
- "number-integer": NumberFieldSchema,
163142
- "image-picker": ImagePickerFieldSchema,
163143
- divider: DividerFieldSchema
163144
- }, MarketingActivityExtensionSchema = BaseSchema.extend({
163145
- title: z.string().min(1),
163146
- description: z.string().min(1),
163147
- api_path: z.string(),
163148
- tactic: z.enum([
163149
- "ad",
163150
- "retargeting",
163151
- "post",
163152
- "message",
163153
- "transactional",
163154
- "newsletter",
163155
- "abandoned_cart",
163156
- "affililate",
163157
- "loyalty",
163158
- "link",
163159
- "storefront_app"
163160
- ]),
163161
- marketing_channel: z.enum(["social", "search", "email", "sms", "display", "marketplace"]),
163162
- referring_domain: z.string().optional(),
163163
- is_automation: z.boolean().optional(),
163164
- use_external_editor: z.boolean().optional(),
163165
- preview_data: z.object({
163166
- types: z.array(z.object({
163167
- label: z.string(),
163168
- value: z.string()
163169
- })).max(3).min(1)
163170
- }),
163171
- fields: z.array(z.any().superRefine((val, ctx) => {
163172
- if (typeof val != "object")
163173
- return ctx.addIssue({
163174
- message: "Field must be an object",
163175
- code: z.ZodIssueCode.custom
163176
- });
163177
- if (val.ui_type === void 0)
163178
- return ctx.addIssue({
163179
- message: "Field must have a ui_type",
163180
- code: z.ZodIssueCode.custom
163181
- });
163182
- let schema = UISchemaMapping[val.ui_type];
163183
- if (schema === void 0)
163184
- return ctx.addIssue({
163185
- message: `Unknown ui_type for Field: ${val.ui_type}`,
163186
- code: z.ZodIssueCode.custom
163187
- });
163188
- let result = schema.safeParse(val);
163189
- if (!result.success)
163190
- return ctx.addIssue({
163191
- message: `Error found on Field "${val.name}": ${result.error.message}`,
163192
- code: z.ZodIssueCode.custom
163193
- });
163194
- })).min(1)
163195
- });
163196
-
163197
- // ../app/dist/cli/models/extensions/specifications/marketing_activity.js
163198
- var spec2 = createExtensionSpecification({
163199
- identifier: "marketing_activity",
163200
- schema: MarketingActivityExtensionSchema,
163201
- appModuleFeatures: (_2) => ["bundling"],
163202
- deployConfig: async (config2, _2) => ({
163203
- title: config2.title,
163204
- description: config2.description,
163205
- api_path: config2.api_path,
163206
- tactic: config2.tactic,
163207
- marketing_channel: config2.marketing_channel,
163208
- referring_domain: config2.referring_domain,
163209
- is_automation: config2.is_automation,
163210
- use_external_editor: config2.use_external_editor,
163211
- preview_data: config2.preview_data,
163212
- fields: config2.fields.map((field) => ({
163213
- ...field,
163214
- // NOTE: we're not using this id anywhere, generating it to satisfy the schema
163215
- // decided not to remove it from the schema for now to minimize the risk of breaking changes
163216
- id: randomUUID()
163217
- }))
163218
- })
163219
- }), marketing_activity_default = spec2;
163111
+ var spec2 = createContractBasedModuleSpecification("marketing_activity"), marketing_activity_default = spec2;
163220
163112
 
163221
163113
  // ../app/dist/cli/models/extensions/specifications/theme.js
163222
163114
  init_cjs_shims();
@@ -163629,7 +163521,7 @@ async function unifiedConfigurationParserFactory(merged) {
163629
163521
  return merged.parseConfigurationObject;
163630
163522
  let contract = await normaliseJsonSchema(contractJsonSchema);
163631
163523
  return (config2) => {
163632
- 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 || [];
163633
163525
  jsonSchemaParse.state === "error" && (errors2 = errors2.concat(jsonSchemaParse.errors));
163634
163526
  let errorSet = /* @__PURE__ */ new Set();
163635
163527
  return errors2 = errors2.filter((error) => {
@@ -163695,7 +163587,12 @@ async function link(options, shouldRenderSuccess = !0) {
163695
163587
  async function selectOrCreateRemoteAppToLinkTo(options) {
163696
163588
  let developerPlatformClient = await sniffServiceOptionsAndAppConfigToSelectPlatformClient(options), { creationOptions, appDirectory: possibleAppDirectory } = await getAppCreationDefaultsFromLocalApp(options), appDirectory = possibleAppDirectory || options.directory;
163697
163589
  if (options.apiKey) {
163698
- 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
+ });
163699
163596
  if (!remoteApp2) {
163700
163597
  let errorMessage2 = InvalidApiKeyErrorMessage(options.apiKey);
163701
163598
  throw new AbortError(errorMessage2.message, errorMessage2.tryMessage);
@@ -163833,7 +163730,7 @@ function buildOptionsForGeneratedConfigFile(options) {
163833
163730
  if (!isEmpty(buildOptions))
163834
163731
  return buildOptions;
163835
163732
  }
163836
- function renderSuccessMessage(configFileName, appName, packageManager2) {
163733
+ function renderSuccessMessage(configFileName, appName, packageManager) {
163837
163734
  renderSuccess({
163838
163735
  headline: `${configFileName} is now linked to "${appName}" on Shopify`,
163839
163736
  body: `Using ${configFileName} as your default config.`,
@@ -163842,7 +163739,7 @@ function renderSuccessMessage(configFileName, appName, packageManager2) {
163842
163739
  [
163843
163740
  "To upload your config, run",
163844
163741
  {
163845
- command: formatPackageManagerCommand(packageManager2, "shopify app deploy")
163742
+ command: formatPackageManagerCommand(packageManager, "shopify app deploy")
163846
163743
  }
163847
163744
  ]
163848
163745
  ],
@@ -164316,12 +164213,12 @@ async function fetchDevDataFromOptions(options, orgId, developerPlatformClient)
164316
164213
  ]), selectedStore;
164317
164214
  return options.storeFqdn && (selectedStore = orgWithStore.store, await convertToTransferDisabledStoreIfNeeded(selectedStore, orgWithStore.organization.id, developerPlatformClient, "never")), { app: selectedApp, store: selectedStore };
164318
164215
  }
164319
- async function getAppContext({ reset, directory, developerPlatformClient, configName, enableLinkingPrompt = !0 }) {
164216
+ async function getAppContext({ reset, directory, configName, enableLinkingPrompt = !0 }) {
164320
164217
  await linkIfNecessary(directory, reset, enableLinkingPrompt);
164321
164218
  let cachedInfo = getCachedAppInfo(directory), { configuration } = await loadAppConfiguration({
164322
164219
  directory,
164323
164220
  userProvidedConfigName: configName
164324
- }), remoteApp;
164221
+ }), developerPlatformClient = selectDeveloperPlatformClient({ configuration }), remoteApp;
164325
164222
  return isCurrentAppSchema(configuration) && (remoteApp = await appFromId({
164326
164223
  apiKey: configuration.client_id,
164327
164224
  id: configuration.app_id,
@@ -164426,12 +164323,12 @@ async function developerPreviewUpdate({ apiKey, developerPlatformClient, enabled
164426
164323
  async function use2({ directory, configName, warningContent, shouldRenderSuccess = !0, reset = !1 }) {
164427
164324
  if (reset) {
164428
164325
  clearCurrentConfigFile(directory);
164429
- let packageManager2 = await getPackageManager(directory);
164326
+ let packageManager = await getPackageManager(directory);
164430
164327
  renderSuccess({
164431
164328
  headline: "Cleared current configuration.",
164432
164329
  body: [
164433
164330
  "In order to set a new current configuration, please run",
164434
- { command: formatPackageManagerCommand(packageManager2, "shopify app config use CONFIG_NAME") },
164331
+ { command: formatPackageManagerCommand(packageManager, "shopify app config use CONFIG_NAME") },
164435
164332
  { char: "." }
164436
164333
  ]
164437
164334
  });
@@ -164674,12 +164571,12 @@ var alreadyShownCLIWarning = !1, AppLoader = class {
164674
164571
  async loaded() {
164675
164572
  let { configuration, directory, configurationLoadResultMetadata, configSchema } = this.loadedConfiguration;
164676
164573
  await logMetadataFromAppLoadingProcess(configurationLoadResultMetadata);
164677
- 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);
164678
- 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);
164679
164576
  let { webs, usedCustomLayout: usedCustomLayoutForWeb } = await this.loadWebs(directory, configuration.web_directories), usesWorkspaces2 = await usesWorkspaces(directory), appClass = new App({
164680
164577
  name,
164681
164578
  directory,
164682
- packageManager: packageManager2,
164579
+ packageManager,
164683
164580
  configuration,
164684
164581
  nodeDependencies,
164685
164582
  webs,
@@ -164701,13 +164598,13 @@ var alreadyShownCLIWarning = !1, AppLoader = class {
164701
164598
  parseConfigurationFile(schema, filepath, decode3 = decodeToml) {
164702
164599
  return parseConfigurationFile(schema, filepath, this.abortOrReport.bind(this), decode3);
164703
164600
  }
164704
- showGlobalCLIWarningIfNeeded(nodeDependencies, packageManager2) {
164601
+ showGlobalCLIWarningIfNeeded(nodeDependencies, packageManager) {
164705
164602
  let hasLocalCLI = nodeDependencies["@shopify/cli"] !== void 0;
164706
164603
  if (currentProcessIsGlobal() && hasLocalCLI && !sniffForJson() && !alreadyShownCLIWarning) {
164707
164604
  let warningContent = {
164708
164605
  headline: "You are running a global installation of Shopify CLI",
164709
164606
  body: [
164710
- `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).`
164711
164608
  ],
164712
164609
  link: {
164713
164610
  label: "For more information, see Shopify CLI documentation",
@@ -164780,7 +164677,7 @@ var alreadyShownCLIWarning = !1, AppLoader = class {
164780
164677
  let directory = dirname(configurationPath), obj = await loadConfigurationFileContent(configurationPath), { extensions, type } = ExtensionsArraySchema.parse(obj);
164781
164678
  if (extensions) {
164782
164679
  let configuration = await this.parseConfigurationFile(UnifiedSchema, configurationPath), extensionsInstancesPromises = configuration.extensions.map(async (extensionConfig) => {
164783
- let mergedConfig = { ...configuration, ...extensionConfig }, { extensions: extensions2, ...restConfig } = mergedConfig;
164680
+ let mergedConfig = { ...configuration, ...extensionConfig }, { extensions: extensions2, path: path3, ...restConfig } = mergedConfig;
164784
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);
164785
164682
  });
164786
164683
  return Promise.all(extensionsInstancesPromises);
@@ -165120,14 +165017,6 @@ async function build(options) {
165120
165017
  }
165121
165018
  var build_default = build;
165122
165019
 
165123
- // ../app/dist/cli/utilities/app-command.js
165124
- init_cjs_shims();
165125
- var AppCommand = class extends base_command_default {
165126
- environmentsFilename() {
165127
- return configurationFileNames.appEnvironments;
165128
- }
165129
- };
165130
-
165131
165020
  // ../app/dist/cli/prompts/deprecation-warnings.js
165132
165021
  init_cjs_shims();
165133
165022
  async function showApiKeyDeprecationWarning() {
@@ -165138,6 +165027,14 @@ async function showApiKeyDeprecationWarning() {
165138
165027
  });
165139
165028
  }
165140
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
+
165141
165038
  // ../app/dist/cli/commands/app/build.js
165142
165039
  var import_core29 = __toESM(require_lib(), 1);
165143
165040
  var _a14, Build2 = class extends AppCommand {
@@ -165153,7 +165050,7 @@ var _a14, Build2 = class extends AppCommand {
165153
165050
  directory: flags.path,
165154
165051
  userProvidedConfigName: flags.config
165155
165052
  });
165156
- await build_default({ app, skipDependenciesInstallation: flags["skip-dependencies-installation"], apiKey });
165053
+ return await build_default({ app, skipDependenciesInstallation: flags["skip-dependencies-installation"], apiKey }), { app };
165157
165054
  }
165158
165055
  };
165159
165056
  _a14 = Build2;
@@ -165194,6 +165091,12 @@ var _a15, ConfigLink = class extends AppCommand {
165194
165091
  apiKey: flags["client-id"]
165195
165092
  };
165196
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
+ }) };
165197
165100
  }
165198
165101
  };
165199
165102
  _a15 = ConfigLink;
@@ -165221,6 +165124,12 @@ var _a16, { config, ...appFlagsWithoutConfig } = appFlags, ConfigUse = class ext
165221
165124
  async run() {
165222
165125
  let { flags, args } = await this.parse(_a16);
165223
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
+ }) };
165224
165133
  }
165225
165134
  };
165226
165135
  _a16 = ConfigUse;
@@ -165411,7 +165320,7 @@ var DemoWatcher = class _DemoWatcher extends AppCommand {
165411
165320
  userProvidedConfigName: flags.config,
165412
165321
  mode: "report"
165413
165322
  }), watcher = new AppEventWatcher(app);
165414
- 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 }) => {
165415
165324
  outputInfo(`\u{1F195} Event [${endHRTimeInMs(startTime)}ms]`), outputInfo(` \u{1F4C2} ${path3}`), extensionEvents.forEach((event) => {
165416
165325
  switch (event.type) {
165417
165326
  case EventType.Created:
@@ -165429,7 +165338,7 @@ var DemoWatcher = class _DemoWatcher extends AppCommand {
165429
165338
  }
165430
165339
  });
165431
165340
  }), setInterval(() => {
165432
- }, 1 << 30);
165341
+ }, 1 << 30), { app };
165433
165342
  }
165434
165343
  };
165435
165344
  DemoWatcher.summary = "Watch and prints out changes to an app.";
@@ -165477,7 +165386,7 @@ async function deploy(options) {
165477
165386
  let apiKey = identifiers?.app ?? remoteApp.apiKey;
165478
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();
165479
165388
  let uploadExtensionsBundleResult;
165480
- await inTemporaryDirectory(async (tmpDir) => {
165389
+ return await inTemporaryDirectory(async (tmpDir) => {
165481
165390
  try {
165482
165391
  let bundle = app.allExtensions.some((ext) => ext.features.includes("bundling")), bundlePath;
165483
165392
  bundle && (bundlePath = joinPath(tmpDir, "bundle.zip"), await mkdir(dirname(bundlePath))), await bundleAndBuildExtensions({ app, bundlePath, identifiers });
@@ -165521,7 +165430,7 @@ async function deploy(options) {
165521
165430
  } catch (error) {
165522
165431
  throw await updateAppIdentifiers({ app, identifiers, command: "deploy", developerPlatformClient }), error;
165523
165432
  }
165524
- });
165433
+ }), { app };
165525
165434
  }
165526
165435
  async function outputCompletionMessage({ app, release: release2, uploadExtensionsBundleResult }) {
165527
165436
  let linkAndMessage = [
@@ -165599,7 +165508,7 @@ var _a17, Deploy2 = class extends AppCommand {
165599
165508
  userProvidedConfigName: flags.config,
165600
165509
  specifications: await loadLocalExtensionsSpecifications()
165601
165510
  }), requiredNonTTYFlags = ["force"];
165602
- !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({
165603
165512
  app,
165604
165513
  apiKey,
165605
165514
  reset: flags.reset,
@@ -165608,7 +165517,7 @@ var _a17, Deploy2 = class extends AppCommand {
165608
165517
  message: flags.message,
165609
165518
  version: flags.version,
165610
165519
  commitReference: flags["source-control-url"]
165611
- });
165520
+ })).app };
165612
165521
  }
165613
165522
  };
165614
165523
  _a17 = Deploy2;
@@ -165683,6 +165592,13 @@ init_cjs_shims();
165683
165592
 
165684
165593
  // ../cli-kit/dist/public/common/url.js
165685
165594
  init_cjs_shims();
165595
+ function safeParseURL(url) {
165596
+ try {
165597
+ return new URL(url);
165598
+ } catch {
165599
+ return;
165600
+ }
165601
+ }
165686
165602
 
165687
165603
  // ../app/dist/cli/services/dev/urls.js
165688
165604
  async function generateFrontendURL(options) {
@@ -166434,7 +166350,9 @@ async function reloadExtensionConfig({ extension }) {
166434
166350
  extensionConfig || abort2(`ERROR: Invalid handle
166435
166351
  - Expected handle: "${extension.handle}"
166436
166352
  - Configuration file path: ${relativizePath(extension.configurationPath)}.
166437
- - 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;
166438
166356
  }
166439
166357
  let newConfig = await parseConfigurationObjectAgainstSpecification(extension.specification, extension.configurationPath, configObject, abort2), previousConfig = extension.configuration;
166440
166358
  return extension.configuration = newConfig, {
@@ -169280,7 +169198,7 @@ async function dev2(commandOptions) {
169280
169198
  let config2 = await prepareForDev(commandOptions);
169281
169199
  await actionsBeforeSettingUpDevProcesses(config2);
169282
169200
  let { processes, graphiqlUrl, previewUrl } = await setupDevProcesses(config2);
169283
- 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 };
169284
169202
  }
169285
169203
  async function prepareForDev(commandOptions) {
169286
169204
  let tunnelPort = await getAvailableTCPPort(), tunnelClient;
@@ -169529,13 +169447,15 @@ var _a18, Dev4 = class extends AppCommand {
169529
169447
  graphiqlKey: flags["graphiql-key"],
169530
169448
  devPreview: !flags.legacy
169531
169449
  };
169532
- await dev2(devOptions);
169450
+ return { app: (await dev2(devOptions)).app };
169533
169451
  }
169534
169452
  };
169535
169453
  _a18 = Dev4;
169536
169454
  Dev4.summary = "Run the app.";
169537
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).
169538
169456
 
169457
+ > Note: Development store preview of extension drafts is not supported for Plus sandbox stores. You must \`deploy\` your app.
169458
+
169539
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:
169540
169460
 
169541
169461
  - Associating your project with an app associated with your Partner account or organization, or creating a new app.
@@ -169998,7 +169918,7 @@ async function logs(commandOptions) {
169998
169918
  jwtToken,
169999
169919
  filters
170000
169920
  };
170001
- 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({
170002
169922
  options: {
170003
169923
  variables,
170004
169924
  developerPlatformClient: logsConfig.developerPlatformClient
@@ -170013,7 +169933,7 @@ async function logs(commandOptions) {
170013
169933
  },
170014
169934
  pollOptions,
170015
169935
  storeNameById: logsConfig.storeNameById
170016
- }));
169936
+ })), logsConfig.localApp;
170017
169937
  }
170018
169938
  async function prepareForLogs(commandOptions) {
170019
169939
  let { configuration } = await loadAppConfiguration({
@@ -170053,19 +169973,19 @@ function renderAppLogsConfigInfo(appName, storeFqdn, storeFqdns, configFile, org
170053
169973
  var import_core34 = __toESM(require_lib(), 1);
170054
169974
  var _a19, Logs2 = class extends AppCommand {
170055
169975
  async run() {
170056
- 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"];
170057
169977
  await checkFolderIsValidApp(flags.path);
170058
169978
  let logOptions = {
170059
169979
  apiKey,
170060
169980
  directory: flags.path,
170061
169981
  storeFqdns: flags.store,
170062
- sources: sources2,
169982
+ sources: flags.source,
170063
169983
  status: flags.status,
170064
169984
  configName: flags.config,
170065
169985
  reset: flags.reset,
170066
169986
  format: flags.json ? "json" : "text"
170067
169987
  };
170068
- await logs(logOptions);
169988
+ return { app: await logs(logOptions) };
170069
169989
  }
170070
169990
  };
170071
169991
  _a19 = Logs2;
@@ -170085,10 +170005,6 @@ Logs2.flags = {
170085
170005
  parse: async (input) => normalizeStoreFqdn(input)
170086
170006
  }),
170087
170007
  reset: dev_default2.flags.reset,
170088
- "no-tunnel": dev_default2.flags["no-tunnel"],
170089
- "graphiql-port": dev_default2.flags["graphiql-port"],
170090
- "graphiql-key": dev_default2.flags["graphiql-key"],
170091
- stable: dev_default2.flags.legacy,
170092
170008
  source: import_core34.Flags.string({
170093
170009
  description: "Filters output to the specified log source.",
170094
170010
  env: "SHOPIFY_FLAG_SOURCE",
@@ -170135,7 +170051,7 @@ var _a20, Sources = class extends AppCommand {
170135
170051
  userProvidedConfigName: flags.config,
170136
170052
  mode: "report"
170137
170053
  });
170138
- app.errors ? process.exit(2) : sources(app);
170054
+ return app.errors ? process.exit(2) : sources(app), { app };
170139
170055
  }
170140
170056
  };
170141
170057
  _a20 = Sources;
@@ -170220,7 +170136,7 @@ var _a21, EnvPull2 = class extends AppCommand {
170220
170136
  userProvidedConfigName: flags.config,
170221
170137
  mode: "report"
170222
170138
  }), envFile = joinPath(app.directory, flags["env-file"] ?? getDotEnvFileName(app.configuration.path));
170223
- outputInfo(await pullEnv(app, { envFile }));
170139
+ return outputInfo(await pullEnv(app, { envFile })), { app };
170224
170140
  }
170225
170141
  };
170226
170142
  _a21 = EnvPull2;
@@ -170268,7 +170184,7 @@ var _a22, EnvShow = class extends AppCommand {
170268
170184
  userProvidedConfigName: flags.config,
170269
170185
  mode: "report"
170270
170186
  });
170271
- outputInfo(await showEnv(app));
170187
+ return outputInfo(await showEnv(app)), { app };
170272
170188
  }
170273
170189
  };
170274
170190
  _a22 = EnvShow;
@@ -170376,22 +170292,20 @@ async function getOrGenerateSchemaPath(extension, app) {
170376
170292
  }
170377
170293
 
170378
170294
  // ../app/dist/cli/commands/app/function/build.js
170379
- var _a23, FunctionBuild = class extends base_command_default {
170295
+ var _a23, FunctionBuild = class extends AppCommand {
170380
170296
  async run() {
170381
170297
  let { flags } = await this.parse(_a23);
170382
- await inFunctionContext({
170298
+ return { app: await inFunctionContext({
170383
170299
  path: flags.path,
170384
170300
  userProvidedConfigName: flags.config,
170385
- callback: async (app, ourFunction) => {
170386
- await buildFunctionExtension(ourFunction, {
170387
- app,
170388
- stdout: process.stdout,
170389
- stderr: process.stderr,
170390
- useTasks: !0,
170391
- environment: "production"
170392
- }), renderSuccess({ headline: "Function built successfully." });
170393
- }
170394
- });
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
+ }) };
170395
170309
  }
170396
170310
  };
170397
170311
  _a23 = FunctionBuild;
@@ -170760,26 +170674,24 @@ function getIdentifierFromFilename(fileName) {
170760
170674
  }
170761
170675
 
170762
170676
  // ../app/dist/cli/commands/app/function/replay.js
170763
- 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 {
170764
170678
  async run() {
170765
170679
  let { flags } = await this.parse(_a24);
170766
170680
  flags["api-key"] && await showApiKeyDeprecationWarning();
170767
170681
  let apiKey = flags["client-id"] || flags["api-key"];
170768
- await inFunctionContext({
170682
+ return { app: await inFunctionContext({
170769
170683
  path: flags.path,
170770
170684
  userProvidedConfigName: flags.config,
170771
- callback: async (app, ourFunction) => {
170772
- await replay({
170773
- app,
170774
- extension: ourFunction,
170775
- apiKey,
170776
- path: flags.path,
170777
- log: flags.log,
170778
- json: flags.json,
170779
- watch: flags.watch
170780
- });
170781
- }
170782
- });
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
+ }) };
170783
170695
  }
170784
170696
  };
170785
170697
  _a24 = FunctionReplay;
@@ -170827,13 +170739,13 @@ var replay_default = FunctionReplay;
170827
170739
  // ../app/dist/cli/commands/app/function/run.js
170828
170740
  init_cjs_shims();
170829
170741
  var import_core38 = __toESM(require_lib(), 1);
170830
- var _a25, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends base_command_default {
170742
+ var _a25, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends AppCommand {
170831
170743
  async run() {
170832
170744
  let { flags } = await this.parse(_a25);
170833
- await inFunctionContext({
170745
+ return { app: await inFunctionContext({
170834
170746
  path: flags.path,
170835
170747
  userProvidedConfigName: flags.config,
170836
- callback: async (app, ourFunction) => {
170748
+ callback: async (app2, ourFunction) => {
170837
170749
  let functionExport = DEFAULT_FUNCTION_EXPORT;
170838
170750
  if (flags.export !== void 0)
170839
170751
  outputDebug(`Using export ${flags.export} from the --export flag.`), functionExport = flags.export;
@@ -170852,8 +170764,8 @@ var _a25, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends base_c
170852
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.`);
170853
170765
  } else
170854
170766
  outputDebug(`No targeting information found. Using the default export '${functionExport}'. Use the --export flag or an interactive terminal to select a different export.`);
170855
- let inputQueryPath = ourFunction?.configuration.targeting?.[0]?.input_query, queryPath = inputQueryPath && `${ourFunction?.directory}/${inputQueryPath}`, schemaPath = await getOrGenerateSchemaPath(ourFunction, app);
170856
- 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({
170857
170769
  functionExtension: ourFunction,
170858
170770
  json: flags.json,
170859
170771
  inputPath: flags.input,
@@ -170861,9 +170773,9 @@ var _a25, DEFAULT_FUNCTION_EXPORT = "_start", FunctionRun = class extends base_c
170861
170773
  stdin: "inherit",
170862
170774
  schemaPath,
170863
170775
  queryPath
170864
- });
170776
+ }), app2;
170865
170777
  }
170866
- });
170778
+ }) };
170867
170779
  }
170868
170780
  };
170869
170781
  _a25 = FunctionRun;
@@ -170897,24 +170809,22 @@ var run_default = FunctionRun;
170897
170809
  // ../app/dist/cli/commands/app/function/schema.js
170898
170810
  init_cjs_shims();
170899
170811
  var import_core39 = __toESM(require_lib(), 1);
170900
- var _a26, FetchSchema = class extends base_command_default {
170812
+ var _a26, FetchSchema = class extends AppCommand {
170901
170813
  async run() {
170902
170814
  let { flags } = await this.parse(_a26);
170903
170815
  flags["api-key"] && await showApiKeyDeprecationWarning();
170904
170816
  let apiKey = flags["client-id"] || flags["api-key"];
170905
- await inFunctionContext({
170817
+ return { app: await inFunctionContext({
170906
170818
  path: flags.path,
170907
170819
  userProvidedConfigName: flags.config,
170908
- callback: async (app, ourFunction) => {
170909
- await generateSchemaService({
170910
- app,
170911
- extension: ourFunction,
170912
- apiKey,
170913
- stdout: flags.stdout,
170914
- path: flags.path
170915
- });
170916
- }
170917
- });
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
+ }) };
170918
170828
  }
170919
170829
  };
170920
170830
  _a26 = FetchSchema;
@@ -170949,16 +170859,14 @@ var schema_default = FetchSchema;
170949
170859
 
170950
170860
  // ../app/dist/cli/commands/app/function/typegen.js
170951
170861
  init_cjs_shims();
170952
- var _a27, FunctionTypegen = class extends base_command_default {
170862
+ var _a27, FunctionTypegen = class extends AppCommand {
170953
170863
  async run() {
170954
170864
  let { flags } = await this.parse(_a27);
170955
- await inFunctionContext({
170865
+ return { app: await inFunctionContext({
170956
170866
  path: flags.path,
170957
170867
  userProvidedConfigName: flags.config,
170958
- callback: async (app, ourFunction) => {
170959
- await buildGraphqlTypes(ourFunction, { stdout: process.stdout, stderr: process.stderr, app }), renderSuccess({ headline: "GraphQL types generated successfully." });
170960
- }
170961
- });
170868
+ callback: async (app2, ourFunction) => (await buildGraphqlTypes(ourFunction, { stdout: process.stdout, stderr: process.stderr, app: app2 }), renderSuccess({ headline: "GraphQL types generated successfully." }), app2)
170869
+ }) };
170962
170870
  }
170963
170871
  };
170964
170872
  _a27 = FunctionTypegen;
@@ -171148,17 +171056,17 @@ async function uiExtensionInit({ directory, url, app, name, extensionFlavor, uid
171148
171056
  {
171149
171057
  title: "Installing dependencies",
171150
171058
  task: async () => {
171151
- let packageManager2 = app.packageManager;
171059
+ let packageManager = app.packageManager;
171152
171060
  if (app.usesWorkspaces)
171153
171061
  getTemplateLanguage(extensionFlavor?.value) === "javascript" && await installNodeModules({
171154
- packageManager: packageManager2,
171062
+ packageManager,
171155
171063
  directory: app.directory
171156
171064
  });
171157
171065
  else {
171158
171066
  await addResolutionOrOverrideIfNeeded(app.directory, extensionFlavor?.value);
171159
171067
  let extensionPackageJsonPath = joinPath(directory, "package.json"), requiredDependencies = await getProdDependencies(extensionPackageJsonPath);
171160
171068
  await addNPMDependenciesIfNeeded(requiredDependencies, {
171161
- packageManager: packageManager2,
171069
+ packageManager,
171162
171070
  type: "prod",
171163
171071
  directory: app.directory
171164
171072
  }), await removeFile(extensionPackageJsonPath);
@@ -171225,7 +171133,7 @@ async function generate(options) {
171225
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);
171226
171134
  await saveAnalyticsMetadata(promptAnswers, options.template);
171227
171135
  let generateExtensionOptions = buildGenerateOptions(promptAnswers, app, options, developerPlatformClient), generatedExtension = await generateExtensionTemplate(generateExtensionOptions);
171228
- renderSuccessMessage2(generatedExtension, app.packageManager);
171136
+ return renderSuccessMessage2(generatedExtension, app.packageManager), { app };
171229
171137
  }
171230
171138
  async function buildPromptOptions(extensionTemplates, specifications, app, options) {
171231
171139
  let extensionTemplate = await handleTypeParameter(options.template, app, extensionTemplates, specifications);
@@ -171266,8 +171174,8 @@ function buildGenerateOptions(promptAnswers, app, options, developerPlatformClie
171266
171174
  developerPlatformClient
171267
171175
  };
171268
171176
  }
171269
- function renderSuccessMessage2(extension, packageManager2) {
171270
- let formattedSuccessfulMessage = formatSuccessfulRunMessage(extension.extensionTemplate, extension.directory, packageManager2);
171177
+ function renderSuccessMessage2(extension, packageManager) {
171178
+ let formattedSuccessfulMessage = formatSuccessfulRunMessage(extension.extensionTemplate, extension.directory, packageManager);
171271
171179
  renderSuccess(formattedSuccessfulMessage);
171272
171180
  }
171273
171181
  function validateExtensionFlavor(extensionTemplate, flavor) {
@@ -171316,18 +171224,14 @@ var _a28, AppGenerateExtension = class extends AppCommand {
171316
171224
  let { flags } = await this.parse(_a28);
171317
171225
  flags["api-key"] && await showApiKeyDeprecationWarning();
171318
171226
  let apiKey = flags["client-id"] || flags["api-key"];
171319
- if (await metadata_default.addPublicMetadata(() => ({
171227
+ return await metadata_default.addPublicMetadata(() => ({
171320
171228
  cmd_scaffold_required_auth: !0,
171321
171229
  cmd_scaffold_template_custom: flags["clone-url"] !== void 0,
171322
171230
  cmd_scaffold_type_owner: "@shopify/app"
171323
- })), flags.type) {
171324
- renderWarning({
171325
- headline: ["The flag --type has been deprecated in favor of --template."],
171326
- body: ["Please use --template instead."]
171327
- });
171328
- return;
171329
- }
171330
- 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({
171331
171235
  directory: flags.path,
171332
171236
  reset: flags.reset,
171333
171237
  apiKey,
@@ -171336,7 +171240,7 @@ var _a28, AppGenerateExtension = class extends AppCommand {
171336
171240
  template: flags.template,
171337
171241
  flavor: flags.flavor,
171338
171242
  configName: flags.config
171339
- });
171243
+ })).app };
171340
171244
  }
171341
171245
  };
171342
171246
  _a28 = AppGenerateExtension;
@@ -171682,16 +171586,12 @@ var getMigrationChoices = (isShopifolk) => [
171682
171586
  directory: flags.path,
171683
171587
  userProvidedConfigName: flags.config
171684
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);
171685
- if (migrationChoice === void 0) {
171686
- renderFatalError(new AbortError("Invalid migration choice"));
171687
- return;
171688
- }
171689
- await importExtensions({
171589
+ return migrationChoice === void 0 ? (renderFatalError(new AbortError("Invalid migration choice")), { app }) : (await importExtensions({
171690
171590
  app,
171691
171591
  apiKey: flags["client-id"],
171692
171592
  extensionTypes: migrationChoice.extensionTypes,
171693
171593
  buildTomlObject: migrationChoice.buildTomlObject
171694
- });
171594
+ }), { app });
171695
171595
  }
171696
171596
  };
171697
171597
  ImportExtensions.description = "Import dashboard-managed extensions into your app.";
@@ -171762,15 +171662,12 @@ var UNKNOWN_TEXT = outputContent`${outputToken.italic("unknown")}`.value, NOT_CO
171762
171662
  `);
171763
171663
  }
171764
171664
  async devConfigsSection() {
171765
- let title = "Current app configuration", developerPlatformClient = this.options.developerPlatformClient, { cachedInfo, remoteApp } = await getAppContext({
171766
- developerPlatformClient,
171665
+ let title = "Current app configuration", { cachedInfo, remoteApp } = await getAppContext({
171767
171666
  directory: this.app.directory,
171768
171667
  reset: !1,
171769
171668
  configName: this.options.configName,
171770
171669
  enableLinkingPrompt: !1
171771
- });
171772
- developerPlatformClient = remoteApp?.developerPlatformClient ?? developerPlatformClient;
171773
- 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;
171774
171671
  cachedInfo?.updateURLs === void 0 ? updateUrls = NOT_CONFIGURED_TEXT : updateUrls = cachedInfo.updateURLs ? "Yes" : "No";
171775
171672
  let partnersAccountInfo = ["Partners account", "unknown"], retrievedAccountInfo = await developerPlatformClient.accountInfo();
171776
171673
  isServiceAccount(retrievedAccountInfo) ? partnersAccountInfo = ["Service account", retrievedAccountInfo.orgName] : isUserAccount(retrievedAccountInfo) && (partnersAccountInfo = ["Partners account", retrievedAccountInfo.email]);
@@ -171882,11 +171779,11 @@ var _a30, AppInfo2 = class extends AppCommand {
171882
171779
  userProvidedConfigName: flags.config,
171883
171780
  mode: "report"
171884
171781
  });
171885
- outputInfo(await info(app, {
171782
+ return outputInfo(await info(app, {
171886
171783
  format: flags.json ? "json" : "text",
171887
171784
  webEnv: flags["web-env"],
171888
171785
  configName: flags.config
171889
- })), app.errors && process.exit(2);
171786
+ })), app.errors && process.exit(2), { app };
171890
171787
  }
171891
171788
  };
171892
171789
  _a30 = AppInfo2;
@@ -171918,10 +171815,7 @@ var info_default2 = AppInfo2;
171918
171815
  // ../app/dist/cli/commands/app/init.js
171919
171816
  init_cjs_shims();
171920
171817
 
171921
- // ../create-app/dist/commands/init.js
171922
- init_cjs_shims();
171923
-
171924
- // ../create-app/dist/prompts/init.js
171818
+ // ../app/dist/cli/prompts/init/init.js
171925
171819
  init_cjs_shims();
171926
171820
  var templates = {
171927
171821
  remix: {
@@ -171954,24 +171848,10 @@ var templates = {
171954
171848
  visible: !1
171955
171849
  }
171956
171850
  }, allTemplates = Object.keys(templates), visibleTemplates = allTemplates.filter((key) => templates[key].visible), templateOptionsInOrder = ["remix", "none"], init = async (options) => {
171957
- let name = options.name, template2 = options.template, flavor = options.flavor, defaults = {
171958
- name: await generateRandomNameForSubdirectory({ suffix: "app", directory: options.directory }),
171851
+ let template2 = options.template, flavor = options.flavor, defaults = {
171959
171852
  template: templates.remix.url
171960
- }, welcomed = !1;
171961
- name || (renderText({ text: `
171962
- Welcome. Let\u2019s get started by naming your app project. You can change it later.` }), welcomed = !0, name = await renderTextPrompt({
171963
- message: "Your project name?",
171964
- defaultValue: defaults.name,
171965
- validate: (value) => {
171966
- if (value.length === 0)
171967
- return "App name can't be empty";
171968
- if (value.length > 30)
171969
- return "Enter a shorter name (30 character max.)";
171970
- if (value.toLowerCase().includes("shopify"))
171971
- return "App name can't include the word 'shopify'";
171972
- }
171973
- })), template2 || (welcomed || (renderText({ text: `
171974
- Welcome. Let\u2019s get started by choosing a template for your app project.` }), welcomed = !0), template2 = await renderSelectPrompt({
171853
+ };
171854
+ template2 || (template2 = await renderSelectPrompt({
171975
171855
  choices: templateOptionsInOrder.map((key) => ({
171976
171856
  label: templates[key].label || key,
171977
171857
  value: key
@@ -171981,7 +171861,6 @@ Welcome. Let\u2019s get started by choosing a template for your app project.` })
171981
171861
  }));
171982
171862
  let answers = {
171983
171863
  ...options,
171984
- name,
171985
171864
  template: template2,
171986
171865
  templateType: isPredefinedTemplate(template2) ? template2 : "custom",
171987
171866
  globalCLIResult: { install: !1, alreadyInstalled: !1 }
@@ -172002,10 +171881,10 @@ function isPredefinedTemplate(template2) {
172002
171881
  return allTemplates.includes(template2);
172003
171882
  }
172004
171883
 
172005
- // ../create-app/dist/services/init.js
171884
+ // ../app/dist/cli/services/init/init.js
172006
171885
  init_cjs_shims();
172007
171886
 
172008
- // ../create-app/dist/utils/template/npm.js
171887
+ // ../app/dist/cli/services/init/template/npm.js
172009
171888
  init_cjs_shims();
172010
171889
  import { platform } from "os";
172011
171890
  async function updateCLIDependencies({ packageJSON, local, useGlobalCLI }) {
@@ -172025,12 +171904,12 @@ async function packagePath(packageName) {
172025
171904
  cwd: moduleDirectory(import.meta.url)
172026
171905
  })}`;
172027
171906
  }
172028
- async function getDeepInstallNPMTasks({ from, packageManager: packageManager2 }) {
172029
- let args = platform() === "win32" && packageManager2 === "yarn" ? ["--network-concurrency", "1"] : [];
172030
- 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 });
172031
171910
  }
172032
171911
 
172033
- // ../create-app/dist/utils/template/cleanup.js
171912
+ // ../app/dist/cli/services/init/template/cleanup.js
172034
171913
  init_cjs_shims();
172035
171914
  async function cleanup(webOutputDirectory) {
172036
171915
  let gitPaths = await glob([
@@ -172050,13 +171929,13 @@ async function cleanup(webOutputDirectory) {
172050
171929
  });
172051
171930
  }
172052
171931
 
172053
- // ../create-app/dist/services/init.js
171932
+ // ../app/dist/cli/services/init/init.js
172054
171933
  async function init2(options) {
172055
- let packageManager2 = options.packageManager, hyphenizedName = hyphenate(options.name), outputDirectory = joinPath(options.directory, hyphenizedName), githubRepo = parseGitHubRepositoryReference(options.template);
172056
- 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({
172057
171936
  body: [
172058
171937
  "Initializing project with",
172059
- { command: packageManager2 },
171938
+ { command: packageManager },
172060
171939
  `
172061
171940
  Use the`,
172062
171941
  { command: "--package-manager" },
@@ -172081,7 +171960,7 @@ Use the`,
172081
171960
  title: "Parsing liquid",
172082
171961
  task: async () => {
172083
171962
  await recursiveLiquidTemplateCopy(templatePathDir, templateScaffoldDir, {
172084
- dependency_manager: packageManager2,
171963
+ dependency_manager: packageManager,
172085
171964
  app_name: options.name
172086
171965
  });
172087
171966
  }
@@ -172091,7 +171970,7 @@ Use the`,
172091
171970
  let packageJSON = (await findUpAndReadPackageJson(templateScaffoldDir)).content;
172092
171971
  packageJSON.name = hyphenizedName, packageJSON.author = await username() ?? "", packageJSON.private = !0;
172093
171972
  let workspacesFolders = ["extensions/*"].concat(detectAdditionalWorkspacesFolders(templateScaffoldDir));
172094
- switch (packageManager2) {
171973
+ switch (packageManager) {
172095
171974
  case "npm":
172096
171975
  case "yarn":
172097
171976
  case "bun":
@@ -172135,9 +172014,9 @@ ${workspacesContent}`), await appendFile(joinPath(templateScaffoldDir, ".npmrc")
172135
172014
  `);
172136
172015
  }
172137
172016
  }), tasks.push({
172138
- title: `Installing dependencies with ${packageManager2}`,
172017
+ title: `Installing dependencies with ${packageManager}`,
172139
172018
  task: async () => {
172140
- await getDeepInstallNPMTasks({ from: templateScaffoldDir, packageManager: packageManager2 });
172019
+ await getDeepInstallNPMTasks({ from: templateScaffoldDir, packageManager });
172141
172020
  }
172142
172021
  }, {
172143
172022
  title: "Cleaning up",
@@ -172150,21 +172029,28 @@ ${workspacesContent}`), await appendFile(joinPath(templateScaffoldDir, ".npmrc")
172150
172029
  await initializeGitRepository(templateScaffoldDir);
172151
172030
  }
172152
172031
  }), await renderTasks(tasks), await moveFile(templateScaffoldDir, outputDirectory);
172153
- }), 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({
172154
172040
  headline: [{ userInput: hyphenizedName }, "is ready for you to build!"],
172155
172041
  nextSteps: [
172156
172042
  ["Run", { command: `cd ${hyphenizedName}` }],
172157
- ["For extensions, run", { command: formatPackageManagerCommand(packageManager2, "shopify app generate extension") }],
172158
- ["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") }]
172159
172045
  ],
172160
172046
  reference: [
172161
172047
  { link: { label: "Shopify docs", url: "https://shopify.dev" } },
172162
172048
  [
172163
172049
  "For an overview of commands, run",
172164
- { command: `${formatPackageManagerCommand(packageManager2, "shopify app", "--help")}` }
172050
+ { command: `${formatPackageManagerCommand(packageManager, "shopify app", "--help")}` }
172165
172051
  ]
172166
172052
  ]
172167
- });
172053
+ }), { outputDirectory };
172168
172054
  }
172169
172055
  async function ensureAppDirectoryIsAvailable(directory, name) {
172170
172056
  if (await fileExists(directory))
@@ -172181,73 +172067,75 @@ function detectAdditionalWorkspacesFolders(directory) {
172181
172067
  }
172182
172068
  var init_default4 = init2;
172183
172069
 
172184
- // ../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
172185
172099
  var import_core43 = __toESM(require_lib(), 1);
172186
- var _a31, Init3 = class extends base_command_default {
172100
+ var _a31, Init3 = class extends AppCommand {
172187
172101
  async run() {
172188
172102
  let { flags } = await this.parse(_a31);
172189
- this.validateTemplateValue(flags.template), this.validateFlavorValue(flags.template, flags.flavor);
172190
- let inferredPackageManager = this.inferPackageManager(flags["package-manager"]), promptAnswers = await init_default3({
172191
- 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({
172192
172114
  template: flags.template,
172193
- flavor: flags.flavor,
172194
- directory: flags.path
172115
+ flavor: flags.flavor
172195
172116
  });
172196
172117
  promptAnswers.globalCLIResult.install && await installGlobalShopifyCLI(inferredPackageManager), await addPublicMetadata(() => ({
172197
172118
  cmd_create_app_template: promptAnswers.templateType,
172198
172119
  cmd_create_app_template_url: promptAnswers.template
172199
- })), await init_default4({
172200
- name: promptAnswers.name,
172120
+ }));
172121
+ let platformClient = selectedApp.developerPlatformClient ?? developerPlatformClient, result = await init_default4({
172122
+ name: selectedApp.title,
172123
+ app: selectedApp,
172201
172124
  packageManager: inferredPackageManager,
172202
172125
  template: promptAnswers.template,
172203
172126
  local: flags.local,
172204
172127
  directory: flags.path,
172205
172128
  useGlobalCLI: promptAnswers.globalCLIResult.alreadyInstalled || promptAnswers.globalCLIResult.install,
172129
+ developerPlatformClient: platformClient,
172206
172130
  postCloneActions: {
172207
172131
  removeLockfilesFromGitignore: promptAnswers.templateType !== "custom"
172208
172132
  }
172209
- });
172210
- }
172211
- validateTemplateValue(template2) {
172212
- if (!template2)
172213
- return;
172214
- let url = this.parseURL(template2);
172215
- if (url && url.origin !== "https://github.com")
172216
- throw new AbortError("Only GitHub repository references are supported, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]");
172217
- if (!url && !isPredefinedTemplate(template2))
172218
- throw new AbortError(outputContent`Only ${visibleTemplates.map((alias) => outputContent`${outputToken.yellow(alias)}`.value).join(", ")} template aliases are supported, please provide a valid URL`);
172219
- }
172220
- validateFlavorValue(template2, flavor) {
172221
- if (!template2) {
172222
- if (flavor)
172223
- throw new AbortError(outputContent`The ${outputToken.yellow("--flavor")} flag requires the ${outputToken.yellow("--template")} flag to be set`);
172224
- return;
172225
- }
172226
- if (!flavor)
172227
- return;
172228
- if (!isPredefinedTemplate(template2))
172229
- throw new AbortError(outputContent`The ${outputToken.yellow("--flavor")} flag is not supported for custom templates`);
172230
- let templateConfig = templates[template2];
172231
- if (!templateConfig.branches)
172232
- throw new AbortError(outputContent`The ${outputToken.yellow(template2)} template does not support flavors`);
172233
- if (!templateConfig.branches.options[flavor])
172234
- 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(", ")}`);
172235
- }
172236
- parseURL(url) {
172237
- try {
172238
- return new URL(url);
172239
- } catch {
172240
- return;
172241
- }
172242
- }
172243
- inferPackageManager(optionsPackageManager) {
172244
- if (optionsPackageManager && packageManager.includes(optionsPackageManager))
172245
- return optionsPackageManager;
172246
- let usedPackageManager = packageManagerFromUserAgent();
172247
- if (usedPackageManager !== "unknown")
172248
- return usedPackageManager;
172249
- let globalPackageManager = inferPackageManagerForGlobalCLI();
172250
- 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
+ }) };
172251
172139
  }
172252
172140
  };
172253
172141
  _a31 = Init3;
@@ -172287,6 +172175,12 @@ Init3.flags = {
172287
172175
  env: "SHOPIFY_FLAG_LOCAL",
172288
172176
  default: !1,
172289
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"]
172290
172184
  })
172291
172185
  };
172292
172186
  var init_default5 = Init3;
@@ -172363,13 +172257,13 @@ var _a32, Release = class extends AppCommand {
172363
172257
  directory: flags.path,
172364
172258
  userProvidedConfigName: flags.config
172365
172259
  }), requiredNonTTYFlags = ["force"];
172366
- !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({
172367
172261
  app,
172368
172262
  apiKey,
172369
172263
  reset: flags.reset,
172370
172264
  force: flags.force,
172371
172265
  version: flags.version
172372
- });
172266
+ }), { app };
172373
172267
  }
172374
172268
  };
172375
172269
  _a32 = Release;
@@ -172487,12 +172381,12 @@ var import_core45 = __toESM(require_lib(), 1), _a33, VersionsList = class extend
172487
172381
  directory: flags.path,
172488
172382
  userProvidedConfigName: flags.config
172489
172383
  });
172490
- await versionList({
172384
+ return await versionList({
172491
172385
  app,
172492
172386
  apiKey,
172493
172387
  reset: !1,
172494
172388
  json: flags.json
172495
- });
172389
+ }), { app };
172496
172390
  }
172497
172391
  };
172498
172392
  _a33 = VersionsList;
@@ -172620,7 +172514,7 @@ async function webhookTriggerService(flags) {
172620
172514
  userProvidedConfigName: flags.config,
172621
172515
  specifications: await loadLocalExtensionsSpecifications()
172622
172516
  }), developerPlatformClient = flags.developerPlatformClient ?? selectDeveloperPlatformClient({ configuration: app.configuration }), options = await validateAndCollectFlags(flags, developerPlatformClient, app);
172623
- await sendSample(options);
172517
+ return await sendSample(options), { app };
172624
172518
  }
172625
172519
  async function validateAndCollectFlags(flags, developerPlatformClient, app) {
172626
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);
@@ -172670,7 +172564,7 @@ function formatErrors(errors2) {
172670
172564
 
172671
172565
  // ../app/dist/cli/commands/app/webhook/trigger.js
172672
172566
  var import_core46 = __toESM(require_lib(), 1);
172673
- var _a34, WebhookTrigger = class extends base_command_default {
172567
+ var _a34, WebhookTrigger = class extends AppCommand {
172674
172568
  async run() {
172675
172569
  let { flags } = await this.parse(_a34), usedFlags = {
172676
172570
  topic: flags.topic,
@@ -172682,12 +172576,12 @@ var _a34, WebhookTrigger = class extends base_command_default {
172682
172576
  path: flags.path,
172683
172577
  config: flags.config
172684
172578
  };
172685
- flags["shared-secret"] && renderWarning({
172579
+ return flags["shared-secret"] && renderWarning({
172686
172580
  headline: [
172687
172581
  "The flag shared-secret has been deprecated in favor of client-secret and will eventually be deleted."
172688
172582
  ],
172689
172583
  body: ["Please use --client-secret instead."]
172690
- }), await webhookTriggerService(usedFlags);
172584
+ }), { app: (await webhookTriggerService(usedFlags)).app };
172691
172585
  }
172692
172586
  };
172693
172587
  _a34 = WebhookTrigger;
@@ -174329,7 +174223,10 @@ export {
174329
174223
  hooks as PluginHook,
174330
174224
  provider_default as TunnelProviderHook,
174331
174225
  tunnel_default as TunnelStartHook,
174332
- src_default as default
174226
+ src_default as default,
174227
+ publicFetchStoreThemes as fetchStoreThemes,
174228
+ pull,
174229
+ push
174333
174230
  };
174334
174231
  /*! Bundled license information:
174335
174232