@shopify/create-app 3.80.0 → 3.80.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  errorHandler,
13
13
  registerCleanBugsnagErrorsFromWithinPlugins,
14
14
  require_end_of_stream
15
- } from "./chunk-VUMC3Y3I.js";
15
+ } from "./chunk-MJEERJNX.js";
16
16
  import {
17
17
  setNextDeprecationDate
18
18
  } from "./chunk-CP3BRHWK.js";
@@ -21,11 +21,11 @@ import {
21
21
  getListOfTunnelPlugins,
22
22
  reportAnalyticsEvent,
23
23
  requestIdsCollection
24
- } from "./chunk-ABZFL5NQ.js";
24
+ } from "./chunk-IJGCYDXR.js";
25
25
  import {
26
26
  setCurrentCommandId,
27
27
  showNotificationsIfNeeded
28
- } from "./chunk-E7FQPEOZ.js";
28
+ } from "./chunk-3O26NP2I.js";
29
29
  import {
30
30
  CLI_KIT_VERSION,
31
31
  ClientError,
@@ -33,6 +33,7 @@ import {
33
33
  GraphQLClient,
34
34
  GraphQLClientError,
35
35
  abortSignalFromRequestBehaviour,
36
+ adminFqdn,
36
37
  appDevFqdn,
37
38
  appManagementFqdn,
38
39
  blockPartnersAccess,
@@ -72,7 +73,7 @@ import {
72
73
  setLastSeenUserIdAfterAuth,
73
74
  shopifyFetch,
74
75
  z as z2
75
- } from "./chunk-CVMOVSIB.js";
76
+ } from "./chunk-IKCTE3XD.js";
76
77
  import "./chunk-25IMI7TH.js";
77
78
  import {
78
79
  LocalStorage,
@@ -97,7 +98,7 @@ import {
97
98
  usesWorkspaces,
98
99
  versionSatisfies,
99
100
  writePackageJSON
100
- } from "./chunk-MJT2RCS3.js";
101
+ } from "./chunk-JYLKKAQB.js";
101
102
  import {
102
103
  AbortController as AbortController2,
103
104
  AbortError,
@@ -291,7 +292,7 @@ import {
291
292
  username,
292
293
  writeFile,
293
294
  writeFileSync
294
- } from "./chunk-CAGO7XJB.js";
295
+ } from "./chunk-VVG53QBQ.js";
295
296
  import {
296
297
  require_brace_expansion,
297
298
  require_lib as require_lib2
@@ -319487,7 +319488,7 @@ import { pipeline } from "stream/promises";
319487
319488
  import stream from "node:stream/promises";
319488
319489
  import * as gzip from "node:zlib";
319489
319490
  import { fileURLToPath } from "node:url";
319490
- var PREFERRED_FUNCTION_RUNNER_VERSION = "v8.0.1", PREFERRED_JAVY_VERSION = "v5.0.3", PREFERRED_JAVY_PLUGIN_VERSION = "v2", BINARYEN_VERSION = "123.0.0", TRAMPOLINE_VERSION = "v1.0.0";
319491
+ var PREFERRED_FUNCTION_RUNNER_VERSION = "v9.0.0", PREFERRED_JAVY_VERSION = "v5.0.3", PREFERRED_JAVY_PLUGIN_VERSION = "v2", BINARYEN_VERSION = "123.0.0", TRAMPOLINE_VERSION = "v1.0.0";
319491
319492
  function deriveJavaScriptBinaryDependencies(version) {
319492
319493
  return version === "0" || version === "1" ? {
319493
319494
  functionRunner: "v7.0.1",
@@ -319968,7 +319969,7 @@ init_cjs_shims();
319968
319969
 
319969
319970
  // ../cli-kit/dist/public/node/toml.js
319970
319971
  init_cjs_shims();
319971
- var toml = __toESM(require_toml(), 1);
319972
+ var toml = __toESM(require_toml());
319972
319973
  function decodeToml(input) {
319973
319974
  let normalizedInput = input.replace(/\r\n$/g, `
319974
319975
  `);
@@ -322877,50 +322878,21 @@ Request ID: ${requestId}
322877
322878
  }
322878
322879
 
322879
322880
  // ../cli-kit/dist/public/node/api/graphql.js
322880
- async function createGraphQLClient({ url, addedHeaders, token }) {
322881
- let headers = {
322881
+ async function performGraphQLRequest(options2) {
322882
+ let { token, addedHeaders, queryAsString, variables, api, url, responseOptions, unauthorizedHandler, cacheOptions } = options2, headers = {
322882
322883
  ...addedHeaders,
322883
322884
  ...buildHeaders(token)
322884
- }, clientOptions = { agent: await httpsAgent(), headers };
322885
- return {
322886
- client: new GraphQLClient(url, clientOptions),
322887
- headers
322888
322885
  };
322889
- }
322890
- async function performGraphQLRequest(options2) {
322891
- let { token, addedHeaders, queryAsString, variables, api, url, responseOptions, unauthorizedHandler, cacheOptions } = options2, requestBehaviour = requestMode(options2.preferredBehaviour ?? "default"), { headers, client } = await createGraphQLClient({ url, addedHeaders, token });
322892
322886
  debugLogRequestInfo(api, queryAsString, url, variables, headers);
322893
- let rawGraphQLRequest = async () => {
322887
+ let requestBehaviour = requestMode(options2.preferredBehaviour ?? "default"), clientOptions = { agent: await httpsAgent(), headers }, client = new GraphQLClient(url, clientOptions), performRequest = async () => {
322894
322888
  let fullResponse;
322895
322889
  try {
322896
322890
  return client.requestConfig.signal = abortSignalFromRequestBehaviour(requestBehaviour), fullResponse = await client.rawRequest(queryAsString, variables), await logLastRequestIdFromResponse(fullResponse), fullResponse;
322897
322891
  } catch (error) {
322898
322892
  throw error instanceof ClientError && await logLastRequestIdFromResponse(error.response), error;
322899
322893
  }
322900
- }, simpleUnauthorizedHandler = unauthorizedHandler?.type === "simple" ? unauthorizedHandler.handler : void 0, tokenRefreshHandler = unauthorizedHandler?.type === "token_refresh" ? unauthorizedHandler.handler : void 0, tokenRefreshUnauthorizedHandlerFunction = tokenRefreshHandler ? async () => {
322901
- let refreshTokenResult = await tokenRefreshHandler();
322902
- if (refreshTokenResult.token) {
322903
- let { client: newClient, headers: newHeaders } = await createGraphQLClient({
322904
- url,
322905
- addedHeaders,
322906
- token: refreshTokenResult.token
322907
- });
322908
- return client = newClient, headers = newHeaders, !0;
322909
- } else
322910
- return !1;
322911
- } : void 0, request = () => retryAwareRequest({ request: rawGraphQLRequest, url, ...requestBehaviour }, responseOptions?.handleErrors === !1 ? void 0 : errorHandler2(api), simpleUnauthorizedHandler), executeWithTimer = () => runWithTimer("cmd_all_timing_network_ms")(async () => {
322912
- let response;
322913
- try {
322914
- response = await request();
322915
- } catch (error) {
322916
- if (error instanceof ClientError && error.response.status === 401 && tokenRefreshUnauthorizedHandlerFunction)
322917
- if (await tokenRefreshUnauthorizedHandlerFunction())
322918
- response = await request();
322919
- else
322920
- throw error;
322921
- else
322922
- throw error;
322923
- }
322894
+ }, executeWithTimer = () => runWithTimer("cmd_all_timing_network_ms")(async () => {
322895
+ let response = await retryAwareRequest({ request: performRequest, url, ...requestBehaviour }, responseOptions?.handleErrors === !1 ? void 0 : errorHandler2(api), unauthorizedHandler);
322924
322896
  return responseOptions?.onResponse && responseOptions.onResponse(response), response.data;
322925
322897
  });
322926
322898
  if (cacheOptions === void 0)
@@ -322998,7 +322970,7 @@ async function adminRequestDoc(options2) {
322998
322970
  token: session.token,
322999
322971
  addedHeaders
323000
322972
  }, unauthorizedHandler;
323001
- return "refresh" in session && (unauthorizedHandler = { type: "simple", handler: session.refresh }), graphqlRequestDoc({
322973
+ return "refresh" in session && (unauthorizedHandler = session.refresh), graphqlRequestDoc({
323002
322974
  ...opts,
323003
322975
  query,
323004
322976
  variables,
@@ -324295,7 +324267,7 @@ function generateCertificatePrompt() {
324295
324267
  return renderConfirmationPrompt({
324296
324268
  message: "--use-localhost requires a certificate for `localhost`. Generate it now?",
324297
324269
  confirmationMessage: "Yes, use mkcert to generate it",
324298
- cancellationMessage: "No, I'll provide it manually"
324270
+ cancellationMessage: "No, I'll run `app dev` again without `--use-localhost`"
324299
324271
  });
324300
324272
  }
324301
324273
 
@@ -325351,30 +325323,28 @@ async function setupRequest(token) {
325351
325323
  responseOptions: { onResponse: handleDeprecations }
325352
325324
  };
325353
325325
  }
325354
- async function partnersRequest(query, token, variables, cacheOptions, preferredBehaviour, unauthorizedHandler) {
325326
+ async function partnersRequest(query, token, variables, cacheOptions, preferredBehaviour) {
325355
325327
  let opts = await setupRequest(token);
325356
325328
  return limiter.schedule(() => graphqlRequest({
325357
325329
  ...opts,
325358
325330
  query,
325359
325331
  variables,
325360
325332
  cacheOptions,
325361
- preferredBehaviour,
325362
- unauthorizedHandler
325333
+ preferredBehaviour
325363
325334
  }));
325364
325335
  }
325365
325336
  var generateFetchAppLogUrl = async (cursor, filters) => {
325366
325337
  let url = `https://${await partnersFqdn()}/app_logs/poll`;
325367
325338
  return addCursorAndFiltersToAppLogsUrl(url, cursor, filters);
325368
325339
  };
325369
- async function partnersRequestDoc(query, token, variables, preferredBehaviour, unauthorizedHandler) {
325340
+ async function partnersRequestDoc(query, token, variables, preferredBehaviour) {
325370
325341
  try {
325371
325342
  let opts = await setupRequest(token);
325372
325343
  return limiter.schedule(() => graphqlRequestDoc({
325373
325344
  ...opts,
325374
325345
  query,
325375
325346
  variables,
325376
- preferredBehaviour,
325377
- unauthorizedHandler
325347
+ preferredBehaviour
325378
325348
  }));
325379
325349
  } catch (error) {
325380
325350
  if (error.errors?.[0]?.extensions?.type === "unsupported_client_version") {
@@ -325422,7 +325392,10 @@ var PartnersClient = class {
325422
325392
  if (!this._session) {
325423
325393
  if (isUnitTest())
325424
325394
  throw new Error("PartnersClient.session() should not be invoked dynamically in a unit test");
325425
- let { token, userId } = await ensureAuthenticatedPartners();
325395
+ let { token, userId } = await ensureAuthenticatedPartners([], process.env, {
325396
+ noPrompt: !1,
325397
+ forceRefresh: !0
325398
+ });
325426
325399
  this._session = {
325427
325400
  token,
325428
325401
  businessPlatformToken: "",
@@ -325435,10 +325408,10 @@ var PartnersClient = class {
325435
325408
  return this._session;
325436
325409
  }
325437
325410
  async request(query, variables = void 0, cacheOptions, preferredBehaviour) {
325438
- return partnersRequest(query, await this.token(), variables, cacheOptions, preferredBehaviour, this.createUnauthorizedHandler());
325411
+ return partnersRequest(query, await this.token(), variables, cacheOptions, preferredBehaviour);
325439
325412
  }
325440
325413
  async requestDoc(document2, variables) {
325441
- return partnersRequestDoc(document2, await this.token(), variables, void 0, this.createUnauthorizedHandler());
325414
+ return partnersRequestDoc(document2, await this.token(), variables);
325442
325415
  }
325443
325416
  async token() {
325444
325417
  return (await this.session()).token;
@@ -325693,9 +325666,6 @@ ${`https://${await partnersFqdn()}/${orgId}/stores`}
325693
325666
  let parsedOrg = { id: org.id, businessName: org.businessName, source: this.organizationSource }, appsWithOrg = org.apps.nodes.map((app) => ({ ...app, organizationId: org.id }));
325694
325667
  return { organization: parsedOrg, apps: { ...org.apps, nodes: appsWithOrg }, stores: [] };
325695
325668
  }
325696
- createUnauthorizedHandler() {
325697
- return createUnauthorizedHandler(this);
325698
- }
325699
325669
  }, fetchAppLogs = async ({ jwtToken, cursor, filters }) => {
325700
325670
  let url = await generateFetchAppLogUrl(cursor, filters), userAgent = `Shopify CLI; v=${CLI_KIT_VERSION}`, headers = {
325701
325671
  Authorization: `Bearer ${jwtToken}`,
@@ -327731,15 +327701,14 @@ var appManagementHeaders = (token) => buildHeaders(token), appManagementAppLogsU
327731
327701
  let url = `https://${await appManagementFqdn()}/app_management/unstable/organizations/${organizationId}/app_logs/poll`;
327732
327702
  return addCursorAndFiltersToAppLogsUrl(url, cursor, filters);
327733
327703
  };
327734
- async function appManagementRequestDoc(orgId, query, token, variables, cacheOptions, requestOptions, unauthorizedHandler) {
327704
+ async function appManagementRequestDoc(orgId, query, token, variables, cacheOptions, requestOptions) {
327735
327705
  let cacheExtraKey = (cacheOptions?.cacheExtraKey ?? "") + orgId, newCacheOptions = cacheOptions ? { ...cacheOptions, cacheExtraKey } : void 0;
327736
327706
  return limiter2.schedule(async () => graphqlRequestDoc({
327737
327707
  ...await setupRequest2(orgId, token),
327738
327708
  query,
327739
327709
  variables,
327740
327710
  cacheOptions: newCacheOptions,
327741
- preferredBehaviour: requestOptions?.requestMode,
327742
- unauthorizedHandler
327711
+ preferredBehaviour: requestOptions?.requestMode
327743
327712
  }));
327744
327713
  }
327745
327714
  function handleDeprecations2(response) {
@@ -327984,7 +327953,7 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
327984
327953
  async appsForOrg(organizationId, term = "") {
327985
327954
  let query = ListApps, variables = {
327986
327955
  query: term.split(" ").filter((word) => word).map((word) => `title:${word}`).join(" ")
327987
- }, result = await appManagementRequestDoc(organizationId, query, await this.token(), variables, void 0, void 0, createUnauthorizedHandler(this));
327956
+ }, result = await appManagementRequestDoc(organizationId, query, await this.token(), variables);
327988
327957
  if (!result.appsConnection)
327989
327958
  throw new BugError("Server failed to retrieve apps");
327990
327959
  return {
@@ -328001,7 +327970,7 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
328001
327970
  };
328002
327971
  }
328003
327972
  async specifications({ organizationId }) {
328004
- return (await appManagementRequestDoc(organizationId, FetchSpecifications, await this.token(), void 0, void 0, void 0, createUnauthorizedHandler(this))).specifications.map((spec2) => ({
327973
+ return (await appManagementRequestDoc(organizationId, FetchSpecifications, await this.token())).specifications.map((spec2) => ({
328005
327974
  name: spec2.name,
328006
327975
  externalName: spec2.name,
328007
327976
  identifier: spec2.identifier,
@@ -328038,7 +328007,7 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
328038
328007
  return (await allowedTemplates(templates2, async (betaFlags) => this.organizationBetaFlags(organizationId, betaFlags))).map((template) => ({ ...template, sortPriority: counter++ }));
328039
328008
  }
328040
328009
  async createApp(org, options2) {
328041
- let apiVersion = (await this.apiVersions(org.id)).publicApiVersions.filter((version) => version !== "unstable").sort().at(-1) ?? "unstable", variables = createAppVars(options2, apiVersion), mutation = CreateApp, result = await appManagementRequestDoc(org.id, mutation, await this.token(), variables, void 0, void 0, createUnauthorizedHandler(this));
328010
+ let apiVersion = (await this.apiVersions(org.id)).publicApiVersions.filter((version) => version !== "unstable").sort().at(-1) ?? "unstable", variables = createAppVars(options2, apiVersion), mutation = CreateApp, result = await appManagementRequestDoc(org.id, mutation, await this.token(), variables);
328042
328011
  if (!result.appCreate.app || result.appCreate.userErrors?.length > 0) {
328043
328012
  let errors = result.appCreate.userErrors.map((error) => error.message).join(", ");
328044
328013
  throw new AbortError(errors);
@@ -328088,7 +328057,7 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
328088
328057
  };
328089
328058
  }
328090
328059
  async appVersions({ id, organizationId, title }) {
328091
- let query = AppVersions, variables = { appId: id }, result = await appManagementRequestDoc(organizationId, query, await this.token(), variables, void 0, void 0, createUnauthorizedHandler(this));
328060
+ let query = AppVersions, variables = { appId: id }, result = await appManagementRequestDoc(organizationId, query, await this.token(), variables);
328092
328061
  return {
328093
328062
  app: {
328094
328063
  id: result.app.id,
@@ -328116,7 +328085,7 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
328116
328085
  };
328117
328086
  }
328118
328087
  async appVersionByTag({ id: appId, organizationId }, versionTag) {
328119
- let query = AppVersionByTag, variables = { versionTag }, version = (await appManagementRequestDoc(organizationId, query, await this.token(), variables, void 0, void 0, createUnauthorizedHandler(this))).versionByTag;
328088
+ let query = AppVersionByTag, variables = { versionTag }, version = (await appManagementRequestDoc(organizationId, query, await this.token(), variables)).versionByTag;
328120
328089
  if (!version)
328121
328090
  throw new AbortError(`Version not found for tag: ${versionTag}`);
328122
328091
  return {
@@ -328164,7 +328133,9 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
328164
328133
  };
328165
328134
  }
328166
328135
  async generateSignedUploadUrl({ organizationId }) {
328167
- let variables = { sourceExtension: "BR" }, result = await appManagementRequestDoc(organizationId, CreateAssetUrl, await this.token(), variables, { cacheTTL: { minutes: 59 } }, void 0, createUnauthorizedHandler(this));
328136
+ let variables = { sourceExtension: "BR" }, result = await appManagementRequestDoc(organizationId, CreateAssetUrl, await this.token(), variables, {
328137
+ cacheTTL: { minutes: 59 }
328138
+ });
328168
328139
  return {
328169
328140
  assetUrl: result.appRequestSourceUploadUrl.sourceUploadUrl,
328170
328141
  userErrors: result.appRequestSourceUploadUrl.userErrors
@@ -328191,7 +328162,7 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
328191
328162
  appId,
328192
328163
  version: queryVersion,
328193
328164
  metadata: metadata2
328194
- }, result = await appManagementRequestDoc(organizationId, CreateAppVersion, await this.token(), variables, void 0, { requestMode: "slow-request" }, createUnauthorizedHandler(this)), { version } = result.appVersionCreate, userErrors = result.appVersionCreate.userErrors.map(toUserError) ?? [];
328165
+ }, result = await appManagementRequestDoc(organizationId, CreateAppVersion, await this.token(), variables, void 0, { requestMode: "slow-request" }), { version } = result.appVersionCreate, userErrors = result.appVersionCreate.userErrors.map(toUserError) ?? [];
328195
328166
  if (!version)
328196
328167
  return { appDeploy: { userErrors } };
328197
328168
  let versionResult = {
@@ -328214,11 +328185,11 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
328214
328185
  };
328215
328186
  if (noRelease)
328216
328187
  return versionResult;
328217
- let releaseVariables = { appId, versionId: version.id }, releaseResult = await appManagementRequestDoc(organizationId, ReleaseVersion, await this.token(), releaseVariables, void 0, void 0, createUnauthorizedHandler(this));
328188
+ let releaseVariables = { appId, versionId: version.id }, releaseResult = await appManagementRequestDoc(organizationId, ReleaseVersion, await this.token(), releaseVariables);
328218
328189
  return releaseResult.appReleaseCreate.userErrors && (versionResult.appDeploy.userErrors = (versionResult.appDeploy.userErrors ?? []).concat(releaseResult.appReleaseCreate.userErrors.map(toUserError))), versionResult;
328219
328190
  }
328220
328191
  async release({ app: { id: appId, organizationId }, version: { versionId } }) {
328221
- let releaseVariables = { appId, versionId }, releaseResult = await appManagementRequestDoc(organizationId, ReleaseVersion, await this.token(), releaseVariables, void 0, void 0, createUnauthorizedHandler(this));
328192
+ let releaseVariables = { appId, versionId }, releaseResult = await appManagementRequestDoc(organizationId, ReleaseVersion, await this.token(), releaseVariables);
328222
328193
  return releaseResult.appReleaseCreate.release ? {
328223
328194
  appRelease: {
328224
328195
  appVersion: {
@@ -328367,9 +328338,6 @@ var TEMPLATE_JSON_URL = "https://cdn.shopify.com/static/cli/extensions/templates
328367
328338
  ${`https://${await developerDashboardFqdn()}/dashboard/${orgId}/stores`}
328368
328339
  `;
328369
328340
  }
328370
- createUnauthorizedHandler() {
328371
- return createUnauthorizedHandler(this);
328372
- }
328373
328341
  async activeAppVersionRawResult({ organizationId, apiKey }) {
328374
328342
  return appManagementRequestDoc(organizationId, ActiveAppReleaseFromApiKey, await this.token(), { apiKey });
328375
328343
  }
@@ -328383,7 +328351,7 @@ ${`https://${await developerDashboardFqdn()}/dashboard/${orgId}/stores`}
328383
328351
  }
328384
328352
  }, MAGIC_URL2 = "https://shopify.dev/apps/default-app-home", MAGIC_REDIRECT_URL2 = "https://shopify.dev/apps/default-app-home/api/auth";
328385
328353
  function createAppVars(options2, apiVersion) {
328386
- let { isLaunchable, scopesArray, name, isEmbedded } = options2;
328354
+ let { isLaunchable, scopesArray, name } = options2;
328387
328355
  return { initialVersion: { source: {
328388
328356
  source: {
328389
328357
  name,
@@ -328392,7 +328360,10 @@ function createAppVars(options2, apiVersion) {
328392
328360
  type: AppHomeSpecIdentifier,
328393
328361
  config: {
328394
328362
  app_url: isLaunchable ? "https://example.com" : MAGIC_URL2,
328395
- embedded: isEmbedded
328363
+ // Ext-only apps should be embedded = false, however we are hardcoding this to
328364
+ // match Partners behaviour for now
328365
+ // https://github.com/Shopify/develop-app-inner-loop/issues/2789
328366
+ embedded: !0
328396
328367
  }
328397
328368
  },
328398
328369
  {
@@ -328523,22 +328494,6 @@ function filterDisabledFlags(disabledFlags = []) {
328523
328494
  let defaultActiveFlags = [], remoteDisabledFlags = disabledFlags.map((flag) => FlagMap[flag]);
328524
328495
  return defaultActiveFlags.filter((flag) => !remoteDisabledFlags.includes(flag));
328525
328496
  }
328526
- var inProgressRefreshes = /* @__PURE__ */ new WeakMap();
328527
- function createUnauthorizedHandler(client) {
328528
- return {
328529
- type: "token_refresh",
328530
- handler: async () => {
328531
- let tokenRefresher = inProgressRefreshes.get(client);
328532
- if (tokenRefresher)
328533
- return { token: await tokenRefresher };
328534
- try {
328535
- return tokenRefresher = client.refreshToken(), inProgressRefreshes.set(client, tokenRefresher), { token: await tokenRefresher };
328536
- } finally {
328537
- inProgressRefreshes.delete(client);
328538
- }
328539
- }
328540
- };
328541
- }
328542
328497
 
328543
328498
  // ../app/dist/cli/services/dev/fetch.js
328544
328499
  var NoOrgError = class extends AbortError {
@@ -330073,7 +330028,7 @@ init_cjs_shims();
330073
330028
  init_cjs_shims();
330074
330029
  import { fileURLToPath as fileURLToPath2 } from "node:url";
330075
330030
  async function launchCLI(options2) {
330076
- let { errorHandler: errorHandler3 } = await import("./error-handler-7T2LK45I.js"), { isDevelopment: isDevelopment2 } = await import("./local-VNVIK4LL.js"), oclif = await import("./lib-TMSQAG3Q.js"), { ShopifyConfig } = await import("./custom-oclif-loader-VPMAYVED.js");
330031
+ let { errorHandler: errorHandler3 } = await import("./error-handler-IZWRBHEL.js"), { isDevelopment: isDevelopment2 } = await import("./local-ACC65FTH.js"), oclif = await import("./lib-TMSQAG3Q.js"), { ShopifyConfig } = await import("./custom-oclif-loader-IKM6XX3W.js");
330077
330032
  isDevelopment2() && (oclif.default.settings.debug = !0);
330078
330033
  try {
330079
330034
  let config2 = new ShopifyConfig({ root: fileURLToPath2(options2.moduleURL) });
@@ -330088,7 +330043,7 @@ var import_core3 = __toESM(require_lib2());
330088
330043
  async function exitIfOldNodeVersion(versions2 = process.versions) {
330089
330044
  let nodeVersion = versions2.node, nodeMajorVersion = Number(nodeVersion.split(".")[0]);
330090
330045
  if (nodeMajorVersion < 18) {
330091
- let { renderError: renderError2 } = await import("./ui-MMRHABCP.js");
330046
+ let { renderError: renderError2 } = await import("./ui-DWLHKTCX.js");
330092
330047
  renderError2({
330093
330048
  headline: "Upgrade to a supported Node version now.",
330094
330049
  body: [
@@ -330115,7 +330070,7 @@ async function runCLI(options2, launchCLI2 = launchCLI, argv = process.argv, env
330115
330070
  return setupEnvironmentVariables(options2, argv, env), options2.runInCreateMode && await addInitToArgvWhenRunningCreateCLI(options2, argv), forceNoColor(argv, env), await exitIfOldNodeVersion(versions2), launchCLI2({ moduleURL: options2.moduleURL });
330116
330071
  }
330117
330072
  async function addInitToArgvWhenRunningCreateCLI(options2, argv = process.argv) {
330118
- let { findUpAndReadPackageJson: findUpAndReadPackageJson2 } = await import("./node-package-manager-YRPMMHJS.js"), { moduleDirectory: moduleDirectory2 } = await import("./path-GWAZZN2N.js"), name = (await findUpAndReadPackageJson2(moduleDirectory2(options2.moduleURL))).content.name.replace("@shopify/create-", "");
330073
+ let { findUpAndReadPackageJson: findUpAndReadPackageJson2 } = await import("./node-package-manager-YZ5RU4OK.js"), { moduleDirectory: moduleDirectory2 } = await import("./path-GWAZZN2N.js"), name = (await findUpAndReadPackageJson2(moduleDirectory2(options2.moduleURL))).content.name.replace("@shopify/create-", "");
330119
330074
  if (argv.findIndex((arg) => arg.includes("init")) === -1) {
330120
330075
  let initIndex2 = argv.findIndex((arg) => arg.match(new RegExp(`bin(\\/|\\\\)+(create-${name}|dev|run)`))) + 1;
330121
330076
  argv.splice(initIndex2, 0, "init");
@@ -336290,7 +336245,8 @@ function parseServerEvent(event) {
336290
336245
  }
336291
336246
 
336292
336247
  // ../theme/dist/cli/utilities/theme-environment/local-assets.js
336293
- var import_liquid_html_parser = __toESM(require_dist(), 1), tagContentCache = {
336248
+ var import_liquid_html_parser = __toESM(require_dist(), 1);
336249
+ var tagContentCache = {
336294
336250
  stylesheet: /* @__PURE__ */ new Map(),
336295
336251
  javascript: /* @__PURE__ */ new Map()
336296
336252
  };
@@ -336412,9 +336368,17 @@ function getTagContent(file, tag) {
336412
336368
  if (cache3.delete(file.key), !file.value)
336413
336369
  return;
336414
336370
  let contents = [`/* ${file.key} */`];
336415
- if ((0, import_liquid_html_parser.walk)((0, import_liquid_html_parser.toLiquidHtmlAST)(file.value), (node) => {
336416
- node.type === import_liquid_html_parser.NodeTypes.LiquidRawTag && node.name === tag && contents.push(node.body.value);
336417
- }), contents.length > 1) {
336371
+ try {
336372
+ (0, import_liquid_html_parser.walk)((0, import_liquid_html_parser.toLiquidHtmlAST)(file.value), (node) => {
336373
+ node.type === import_liquid_html_parser.NodeTypes.LiquidRawTag && node.name === tag && contents.push(node.body.value);
336374
+ });
336375
+ } catch (err2) {
336376
+ let error = err2;
336377
+ outputDebug(`Error parsing Liquid file "${file.key}" to extract ${tag} tag. ${error.stack ?? error.message}`);
336378
+ let tagRE = new RegExp(`{%\\s*${tag}\\s*%}([^%]*){%\\s*end${tag}\\s*%}`), tagContent = file.value?.match(tagRE)?.[1];
336379
+ tagContent && contents.push(tagContent);
336380
+ }
336381
+ if (contents.length > 1) {
336418
336382
  let content = contents.join(`
336419
336383
  `);
336420
336384
  return cache3.set(file.key, { checksum: file.checksum, content }), content;
@@ -336513,7 +336477,7 @@ function getExtensionInMemoryTemplates(ctx) {
336513
336477
  var import_theme_check_node4 = __toESM(require_dist5(), 1);
336514
336478
  var import_liquid_html_parser2 = __toESM(require_dist(), 1);
336515
336479
  import EventEmitter3 from "node:events";
336516
- var tagContentCache2 = /* @__PURE__ */ new Map(), sectionNamesByFile = /* @__PURE__ */ new Map();
336480
+ var fileDetailsCache = /* @__PURE__ */ new Map(), sectionNamesByFile = /* @__PURE__ */ new Map();
336517
336481
  function saveSectionsFromJson(fileKey, content) {
336518
336482
  let maybeJson = (0, import_theme_check_node4.parseJSON)(content, null, !0);
336519
336483
  if (!maybeJson)
@@ -336561,7 +336525,7 @@ function setupInMemoryTemplateWatcher2(theme, ctx) {
336561
336525
  if (fileKey.endsWith(".json")) {
336562
336526
  let content = file.value ?? await ctx.localThemeFileSystem.read(fileKey);
336563
336527
  content && typeof content == "string" && saveSectionsFromJson(fileKey, content);
336564
- }
336528
+ } else fileKey.endsWith(".liquid") && getUpdatedFileParts(file);
336565
336529
  }));
336566
336530
  });
336567
336531
  }
@@ -336668,11 +336632,11 @@ function findSectionNamesToReload(key, ctx) {
336668
336632
  return [...sectionsToUpdate];
336669
336633
  }
336670
336634
  function collectReloadInfoForFile(key, ctx) {
336671
- let [type] = key.split("/");
336635
+ let [type] = key.split("/"), file = ctx.localThemeFileSystem.files.get(key);
336672
336636
  return {
336673
336637
  sectionNames: type === "sections" ? findSectionNamesToReload(key, ctx) : [],
336674
336638
  replaceTemplates: needsTemplateUpdate(key) ? getInMemoryTemplates(ctx) : {},
336675
- updatedFileParts: getUpdatedFileParts(key, ctx)
336639
+ updatedFileParts: file && getUpdatedFileParts(file)
336676
336640
  };
336677
336641
  }
336678
336642
  var hotReloadScriptId = "hot-reload-client", hotReloadScriptUrl = "/cdn/shopifycloud/theme-hot-reload/theme-hot-reload.js", hotReloadScriptRE = new RegExp(`<script id="${hotReloadScriptId}"[^>]*>[^<]*</script>`), localHotReloadScriptEndpoint = "/@shopify/theme-hot-reload";
@@ -336682,28 +336646,44 @@ function handleHotReloadScriptInjection(html, ctx) {
336682
336646
  function isAsset(key) {
336683
336647
  return key.startsWith("assets/");
336684
336648
  }
336685
- function getUpdatedFileParts(key, ctx) {
336686
- let file = ctx.localThemeFileSystem.files.get(key), isValidFileType = ["sections/", "snippets/", "blocks/"].some((prefix) => key.startsWith(prefix)) && key.endsWith(".liquid");
336687
- if (!file || !isValidFileType)
336688
- return { stylesheetTag: !1, javascriptTag: !1 };
336689
- let tagContents = getTagContents(file);
336690
- return {
336691
- stylesheetTag: tagContents.stylesheet.changed,
336692
- javascriptTag: tagContents.javascript.changed
336693
- };
336694
- }
336695
- function getTagContents(file) {
336696
- let cached = tagContentCache2.get(file.key), cacheEntry = {
336649
+ function getUpdatedFileParts(file) {
336650
+ if (!(["sections/", "snippets/", "blocks/"].some((prefix) => file.key.startsWith(prefix)) && file.key.endsWith(".liquid")))
336651
+ return;
336652
+ let result = {
336653
+ stylesheetTag: !1,
336654
+ javascriptTag: !1,
336655
+ schemaTag: !1,
336656
+ liquid: !1
336657
+ }, cacheEntry = {
336697
336658
  checksum: file.checksum,
336698
- stylesheet: { content: "", changed: !1 },
336699
- javascript: { content: "", changed: !1 }
336659
+ liquid: "",
336660
+ stylesheetTag: "",
336661
+ javascriptTag: "",
336662
+ schemaTag: ""
336663
+ }, cached = fileDetailsCache.get(file.key);
336664
+ if (cached?.checksum === file.checksum || (fileDetailsCache.delete(file.key), !file.value))
336665
+ return result;
336666
+ let liquidTags = ["stylesheet", "javascript", "schema"], normalizeContent = (content) => content?.replace(/\s+/g, " ").trim(), otherContent = file.value, handleTagMatch = (tag, value) => {
336667
+ otherContent = otherContent.replace(value, "");
336668
+ let content = normalizeContent(value), tagName = `${tag}Tag`;
336669
+ result[tagName] = !cached || content !== cached[tagName], cacheEntry[tagName] = content;
336700
336670
  };
336701
- return cached?.checksum === file.checksum ? cached : (tagContentCache2.delete(file.key), file.value && ((0, import_liquid_html_parser2.walk)((0, import_liquid_html_parser2.toLiquidHtmlAST)(file.value), (node) => {
336702
- if (node.type === import_liquid_html_parser2.NodeTypes.LiquidRawTag && (node.name === "stylesheet" || node.name === "javascript")) {
336703
- let content = node.body.value, changed = !cached || content !== cached[node.name].content;
336704
- cacheEntry[node.name] = { content, changed };
336671
+ try {
336672
+ (0, import_liquid_html_parser2.walk)((0, import_liquid_html_parser2.toLiquidHtmlAST)(file.value), (node) => {
336673
+ if (node.type !== import_liquid_html_parser2.NodeTypes.LiquidRawTag)
336674
+ return;
336675
+ let nodeName = node.name;
336676
+ liquidTags.includes(nodeName) && handleTagMatch(nodeName, node.body.value);
336677
+ });
336678
+ } catch (err2) {
336679
+ let error = err2;
336680
+ outputDebug(`Error parsing Liquid file "${file.key}" to detect updated file parts. ${error.stack ?? error.message}`);
336681
+ for (let tag of liquidTags) {
336682
+ let tagRE = new RegExp(`{%\\s*${tag}\\s*%}([^%]*){%\\s*end${tag}\\s*%}`), match2 = otherContent.match(tagRE)?.[1];
336683
+ match2 && handleTagMatch(tag, match2);
336705
336684
  }
336706
- }), tagContentCache2.set(file.key, cacheEntry)), cacheEntry);
336685
+ }
336686
+ return otherContent = normalizeContent(otherContent.replace(/<!--[\s\S]*?-->/g, "").replace(/{%\s*comment\s*%}[\s\S]*?{%\s*endcomment\s*%}/g, "").replace(/{%\s*doc\s*%}[\s\S]*?{%\s*enddoc\s*%}/g, "")), cacheEntry.liquid = otherContent, result.liquid = !cached || otherContent !== cached.liquid, fileDetailsCache.set(file.key, cacheEntry), result;
336707
336687
  }
336708
336688
 
336709
336689
  // ../theme/dist/cli/utilities/theme-fs.js
@@ -342442,7 +342422,7 @@ async function findOrCreateHostTheme(adminSession, theme) {
342442
342422
  return hostTheme;
342443
342423
  }
342444
342424
  async function buildAppUrl(remoteApp) {
342445
- return `https://${await partnersFqdn()}/${remoteApp.organizationId}/apps/${remoteApp.id}/test`;
342425
+ return remoteApp.id.startsWith("gid://") ? `https://${await adminFqdn()}/?organization_id=${remoteApp.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${remoteApp.apiKey}` : `https://${await partnersFqdn()}/${remoteApp.organizationId}/apps/${remoteApp.id}/test`;
342446
342426
  }
342447
342427
 
342448
342428
  // ../app/dist/cli/services/dev/processes/previewable-extension.js
@@ -344781,7 +344761,7 @@ var DevSession = class _DevSession {
344781
344761
  * @returns The signed URL if we uploaded any assets, otherwise undefined
344782
344762
  */
344783
344763
  async uploadAssetsIfNeeded(assets, bundleController, includeManifest) {
344784
- if (!assets.length)
344764
+ if (!assets.length && !includeManifest)
344785
344765
  return;
344786
344766
  let compressedBundlePath = joinPath(dirname(this.bundlePath), `dev-bundle.${this.options.developerPlatformClient.bundleFormat}`);
344787
344767
  if (bundleController.signal.aborted)
@@ -22,7 +22,7 @@ import {
22
22
  themeToken,
23
23
  useEmbeddedThemeCLI,
24
24
  useThemebundling
25
- } from "./chunk-CAGO7XJB.js";
25
+ } from "./chunk-VVG53QBQ.js";
26
26
  import "./chunk-3INFDIM3.js";
27
27
  import "./chunk-3I3GQNEW.js";
28
28
  import "./chunk-ZUCWDIGE.js";
@@ -58,4 +58,4 @@ export {
58
58
  useEmbeddedThemeCLI,
59
59
  useThemebundling
60
60
  };
61
- //# sourceMappingURL=local-VNVIK4LL.js.map
61
+ //# sourceMappingURL=local-ACC65FTH.js.map
@@ -29,8 +29,8 @@ import {
29
29
  versionSatisfies,
30
30
  writePackageJSON,
31
31
  yarnLockfile
32
- } from "./chunk-MJT2RCS3.js";
33
- import "./chunk-CAGO7XJB.js";
32
+ } from "./chunk-JYLKKAQB.js";
33
+ import "./chunk-VVG53QBQ.js";
34
34
  import "./chunk-3INFDIM3.js";
35
35
  import "./chunk-3I3GQNEW.js";
36
36
  import "./chunk-ZUCWDIGE.js";
@@ -73,4 +73,4 @@ export {
73
73
  writePackageJSON,
74
74
  yarnLockfile
75
75
  };
76
- //# sourceMappingURL=node-package-manager-YRPMMHJS.js.map
76
+ //# sourceMappingURL=node-package-manager-YZ5RU4OK.js.map